Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

end(3)

getsegbyname(3)

getmachheaders(3)

GETSECTBYNAME(3)  —  UNIX Programmer’s Manual

NAME

getsectbyname, getsectdata − get the section information for the named section

SYNOPSIS

#include <ldsyms.h>
#include <sys/loader.h>

const struct section ∗getsectbynamefromheader(struct mach_header ∗mhp, char ∗segname, char ∗sectname)
const struct section ∗getsectbyname(char ∗segname, char ∗sectname);
void ∗getsectdatafromheader(struct mach_header ∗mhp, char ∗segname, char ∗sectname, int ∗size)
void ∗getsectdata(char ∗segname, char ∗sectname, int ∗size);
void ∗getsectdatafromlib(char ∗libname, char ∗segname, char ∗sectname, int ∗size)

DESCRIPTION

Getsectbynamefromheader returns the section structure for the named section in the named segment if it exists in the Mach-O (Mach object) executable for the specified Mach header getsectbynamefromheader(3) is linked into.  Otherwise it returns NULL.  The Mach header can either be the link editor defined symbol _mh_execute_header or the header address of a Mach fixed virtual memory shared library. This routine just looks through the load commands that follow the header to find the specified section.  Since the headers are mapped into the text segment they are read only and thus const. 

Getsectbyname is the same as getsectbynamefromheader with its first argument being the link editor defined symbol _mh_execute_header. 

Getsectdatafromheader returns a pointer to the data for the named section in the named segment if it exists in the Mach-O executable for the specified Mach header it is linked into.  Also it returns the size of the section data indirectly through the pointer size.  Otherwise it returns NULL for the pointer and zero for the size. 

Getsectdata is the same as getsectdatafromheader with its first argument being the link editor defined symbol _mh_execute_header. 

Getsectdatafromlib is the same as getsectdatafromheader with its first argument being the name of a shared library (for example: “libNeXT_s” for /usr/shlib/libNeXT_s.A.shlib) to get the section data from.  If that shared library isn’t used in the executable then it returns NULL for the pointer and zero for the size. 

SEE ALSO

end(3), getsegbyname(3), getmachheaders(3)

NeXT Computer, Inc.  —  March 1, 1989

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026