Describes the ld_info and ld_xinfo data types, along with associated loader entry points.
#include <sys/ldr.h>
The /usr/include/sys/ldr.h header file contains declarations of the ld_info and ld_xinfo data structures and the system loader entry points available to processes and kernel extensions.
The ld_info structure describes a loadable module in the context of either tracing a process (with the ptrace system call) or examining a core file. The ldr.h file can define 2 variants of the ld_info structure, one for describing 32-bit processes (__ld_info32) and one for describing 64-bit processes (__ld_info64). If the __LDINFO_PTRACE32__ symbol is defined, so is the struct __ld_info32 type. If the __LDINFO_PTRACE64__ symbol is defined, so is the struct __ld_info64 type. If the compilation mode is 32-bit and the __LDINFO_PTRACE32__ symbol is defined, the struct __ld_info32 and struct ld_info types are equivalent. If the compilation mode is 64-bit and the __LDINFO_PTRACE64__ symbol is defined, the struct __ld_info64 and struct ld_info types are equivalent.
When using ptrace in a 32-bit program to debug a 64-bit process, define __LDINFO_PTRACE64__. When using ptrace in a 64-bit program to debug a 32-bit process, define __LDINFO_PTRACE32__.
The types and sizes of these structures' fields depend on whether the compilation mode is 32-bit or 64-bit. The same field names are generated in both structure modes, with the exception that the 64-bit structure has an ldinfo_flags field.
The __ld_info32 and __ld_info64 structures contain the following fields of the indicated sizes and types; when two types are listed, the first is used when the compilation mode is 32-bit and the second is used when the mode is 64-bit:
Field and Description | __ld_info32 | __ld_info64 |
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The ld_xinfo structure is similar to the ld_info structure, but the ld_xinfo structure has additional fields for modules defining thread-local storage. Furthermore, all fields are large enough to describe regions of a 64-bit process, so only a single variant of the ld_xinfo structure exists.
The additional fields in the ld_xinfo structure are the following:
Field | Description |
---|---|
ldinfo_tdatasize | Size of the .tdata section. |
ldinfo_tbsssize | Size of the .tbss section. |
ldinfo_tdataorg | Effective address of the initialization template for .tdata. |
ldinfo_tdataoff | Offset of the module's thread-local storage in its region. |
ldinfo_tls_rnum | Thread-local storage region number. |
In addition, the ldinfo_filename field has a different interpretation in the ld_xinfo structure. The value of this field in the ld_xinfo structure is an offset from the beginning of the structure to a null-terminated path name followed by null-terminated member name.
int kmod_load(caddr_t path, uint flags, caddr_t libpath, mid_t *kmid);
int kmod_unload(mid_t kmid, uint flags);
void (*(kmod_entrypt(mid_t kmid, uint flags)))();
int ld_info(int __flags, pid_t __pid, void *__buffer, unsigned int __length);
__LOAD_T *load(char *__filenameparm, uint __flags, char *__libpathparm);
int loadbind(int __lflags, void *__exporter, void *__importer);
int unload(void *__function);
int loadquery(int __lflags, void *__buffer, unsigned int __length);
__handler_t *__lazySetErrorHandler( __handler_t *fp );