[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Files Reference

ldr.h File

Purpose

Describes the ld_info data type and loader entry points.

Syntax

#include <sys/ldr.h

Description

The /usr/include/sys/ldr.h header file contains declarations of the ld_info structure and the system loader entry points available to processes and kernel extensions.

The ld_info structure describes an XCOFF object file 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__. (This is not supported in AIX 4.3.)

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, which is reserved for future use.

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 Description __ld_info32 __ld_info64
Size Type(s) Size Type(s)
ldinfo_next Offset from current entry of next entry, or zero if last entry. 4 uint 4 uint
ldinfo_flags Reserved for future use. N/A N/A 4 uint
ldinfo_fd File descriptor returned by ptrace to debugger. 4 int 4 int
ldinfo_fp File pointer returned by loader to ptrace. 4 struct file *, uint 4 struct file *, uint
ldinfo_core Offset into core file of object. 4 int 8 long long, long
ldinfo_textorg Offset to loaded program image, including the XCOFF headers. 4 void *, uint 8 unsigned long long, void *
ldinfo_textsize Length of loaded program image. 4 int 8 long long, long
ldinfo_dataorg Start of data. 4 void *, uint 8 unsigned long long, void *
ldinfo_datasize Size of data. 4 int 8 long long, long
ldinfo_filename Nul-terminated path name followed by nul-terminated member name; member name is empty if not an archive. variable char[2] variable char[2]

The ldr.h header declares the following functions:

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 );

Related Information

The load, loadbind, loadquery, and unload subroutines.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]