void *(*read_tgt_mem) (void* buffer, uint64_t ptr,

 

size_t bufsiz,

 

int ident),

 

int ident_parm,

 

uint64_t load_map_parm);

Table 33 Parameters

 

 

 

Parameter

Definition

 

 

desc

A buffer of memory allocated by the user program. The dynamic loader fills this in with

 

module information.

 

 

desc_size

Size in bytes of the desc buffer.

 

 

read_tgm_mem

A pointer to a function used by dlmodinfo to retrieve needed information. If the value is

 

NULL, the dynamic loader uses its own internal data structures to find the correct load module

 

and ignore the ident_parm and load_map_parm parameters.

 

 

buffer

A buffer supplied by dlmodinfo to read into. ptr The virtual memory address to read from.

 

 

bufsiz

The size of buffer in bytes.

 

 

ident

The value of the ident_parm parameter to dlmodinfo.

 

 

ident_parm

Only used to pass the fourth parameter to read_tgt_mem.

 

 

load_map_parm

Only used when calling through read_tgt_mem. Contains the starting address of the load

 

map.

 

 

Return Values

If successful, dlgetmodinfo returns a handle for the shared library as defined by the return value from dlopen(). NULL is returned otherwise. The return values are type-converted to uint64_t.

Description

The dlgetmodinfo routine is one of a family of routines that give the user direct access to the dynamic linking facilities. The dlgetmodinfo routine retrieves information about a load module from an index specifying the placement of the load module in the dynamic loader's search list. Unlike dlget, dlgetmodinfo can retrieve information about a load module in another process.

An index of -1 requests information about the dynamic loader; an index of -2 requests information about the program file itself. The dlgetmodinfo routine fills the load_module_desc with information from the matching load module.

Using dlgetmodinfo

The following example shows how to use dlgetmodinfo:

#include <dlfcn.h> #include <stdio.h> int main()

{

void *handle;

struct load_module_desc desc; handle = dlgetmodinfo((void*) -2,

&desc,

sizeof(struct load_module_desc), NULL,

0,

0);

if (handle == NULL) {

printf("Error: dlgetmodinfo returns NULL\n"); exit(1);

The dlopen Shared Library Management Routines 167