dlopen_ia.3c (2010 09)

d
dlopen_ia(3C) dlopen_ia(3C)
(Integrity Systems Only)
[RTLD_ERR_IO] I/O error mapping library.
[RTLD_ERR_LIB_OPEN] Unable to find library.
[RTLD_ERR_MMAP_FAILED]
mmap() failed for library.
[RTLD_ERR_MPROTECT_FAILED]
mprotect() failed for the library.
[RTLD_ERR_NO_MEMORY] Out of memory.
[RTLD_ERR_NOMMAP_FAILED]
Encounter error while loading library (
dlopene()
only).
[RTLD_ERR_NON_TLS_RELOC_TO_TLS_SYM]
Non-thread-specific relocation referencing TLS symbol.
[RTLD_ERR_OPEN] Unable to open library.
[RTLD_ERR_PREALLOC_ADDR_NOT_USE]
Cannot use pre-allocated address for mapping library that requires a
fixed address (
dlopene() only).
[RTLD_ERR_SETCANCELSTATE_FAILED]
__thread_setcancelstate
failed on entry to or exit from dld API.
[RTLD_ERR_SIGENABLE_FAILED]
sigenable failed on exit from dld API.
[RTLD_ERR_SIGINHIBIT_FAILED]
siginhibit failed on entry to dld API.
[RTLD_ERR_TPREL_NON_TLS_SYM]
TPREL relocation on non-TLS symbol.
EXAMPLES
The following example illustrates the use of dlopene() to load a shared library with an explicit data
segment address. For simplicity, error checking has been omitted.
#include <dlfcn.h>
#include <sys/mman.h>
int main() {
struct dlfileinfo info;
void *handle;
struct dlopen_opts opts;
int status;
memset(&info, 0, sizeof(info));
memset(&opts, 0, sizeof(opts));
/* Get file info */
status = dlgetfileinfo("libfoo.so", sizeof(info), &info);
opts.flags = RTLD_EXT_DATA_ADDR;
/* allocate memory for the data segment */
opts.data_addr = (char*) mmap(0, info.data_size,
PROT_READ|PROT_WRITE,
MAP_SHARED|MAP_ANONYMOUS,
-1, 0);
/* call dlopene */
handle = dlopene("libfoo.so", RTLD_NOW|RTLD_GLOBAL, &opts);
/* Insert user code to use library */
/* close library */
status = dlclose(handle);
HP-UX 11i Version 3: September 2010 5 Hewlett-Packard Company 5