dlgetfileinfo.3c (2010 09)

d
dlgetfileinfo(3C) dlgetfileinfo(3C)
if (status == 0) {
/* Make a copy of the library pathname returned by
* dlgetfileinfo().
*/
pathname = strdup(info.filename);
/* Allocate data segment */
opts.data_addr = allocate_data(info.data_size);
/* Not preallocating text segment */
opts.text_addr = 0;
/* Set dlopene() flags to indicate the data segment
* has been preallocated.
*/
opts.flags = RTLD_EXT_DATA_ADDR;
/* Call dlopene() to load the library using the path
* where dlgetfileinfo found the library and the
* preallocated memory buffer for mapping the library’s
* data segment.
*/
handle = dlopene(pathname, RTLD_LAZY, &opts);
/* Remove copy of library pathname */
free(pathname);
/* Insert code here to use library */
/* Close library */
status = dlclose(handle);
/* Insert code here to free storage allocated by
* allocate_data().
*/
}
}
RETURN VALUE
If successful,
dlgetfileinfo()
returns 0, otherwise a non-0 value is returned. More detailed diag-
nostic information is available through
dlerror() or dlerrno().
ERRORS
If
dlgetfileinfo() fails, a subsequent call to dlerrno() returns one of the following values:
[RTLD_ERR_BAD_ELF_VER]
Unknown ELF version in library.
[RTLD_ERR_LIB_OPEN]
Unable to find library.
[RTLD_ERR_NO_MEMORY]
Cannot allocate dynamic memory.
[RTLD_ERR_INTERNAL_ERROR]
Internal error encountered in
dlgetfileinfo().
[RTLD_ERR_CANT_APPLY_RELOC]
Failed to apply relocation while resolving call to
dlgetfileinfo().
[RTLD_ERR_SIGINHIBIT_FAILED]
siginhibit call failed on entry to dlgetfileinfo().
[RTLD_ERR_SIGENABLE_FAILED]
sigenable call failed on exit from dlgetfileinfo().
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010