mirror of https://github.com/mkerrisk/man-pages
Formatting fixes
This commit is contained in:
parent
14ee3bff41
commit
d355f1edc4
|
@ -34,12 +34,12 @@ dl_iterate_phdr \- walk through list of shared objects
|
|||
.fi
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B dl_iterate_phdr
|
||||
.BR dl_iterate_phdr ()
|
||||
function allows an application to inquire at run-time to find
|
||||
out which shared objects it has loaded.
|
||||
|
||||
The
|
||||
.B dl_iterate_phdr
|
||||
.BR dl_iterate_phdr ()
|
||||
function walks through the list of an
|
||||
application's shared objects and calls the function
|
||||
.I callback
|
||||
|
@ -63,7 +63,7 @@ which is a copy of whatever value was passed by the calling
|
|||
program as the second argument (also named
|
||||
.IR data )
|
||||
in the call to
|
||||
.BR dl_iterate_phdr .
|
||||
.BR dl_iterate_phdr ().
|
||||
|
||||
The
|
||||
.I info
|
||||
|
@ -176,12 +176,12 @@ main(int argc, char *argv[])
|
|||
.fi
|
||||
.SH RETURN VALUE
|
||||
The
|
||||
.B dl_iterate_phdr
|
||||
.BR dl_iterate_phdr ()
|
||||
function returns whatever value was returned by the last call to
|
||||
.IR callback .
|
||||
.SH "CONFORMING TO"
|
||||
The
|
||||
.B dl_iterate_phdr
|
||||
.BR dl_iterate_phdr ()
|
||||
function is Linux specific and should be avoided in portable applications.
|
||||
.SH "SEE ALSO"
|
||||
.BR ldd (1),
|
||||
|
|
|
@ -47,23 +47,23 @@ dynamic linking loader
|
|||
.BI "int dlclose(void *" handle );
|
||||
.SH DESCRIPTION
|
||||
The four functions
|
||||
.BR dlopen() ,
|
||||
.BR dlsym() ,
|
||||
.BR dlclose() ,
|
||||
.BR dlerror()
|
||||
.BR dlopen (),
|
||||
.BR dlsym (),
|
||||
.BR dlclose (),
|
||||
.BR dlerror ()
|
||||
implement the interface to the dynamic linking loader.
|
||||
.SS "dlerror"
|
||||
The function
|
||||
.B dlerror()
|
||||
.BR dlerror ()
|
||||
returns a human readable string describing the most recent error
|
||||
that occurred from any of the dl routines (dlopen, dlsym or dlclose)
|
||||
since the last call to
|
||||
.BR dlerror() .
|
||||
.BR dlerror () .
|
||||
It returns NULL if no errors have occurred since initialization or since
|
||||
it was last called.
|
||||
.SS "dlopen"
|
||||
The function
|
||||
.B dlopen()
|
||||
.BR dlopen ()
|
||||
loads the dynamic library file named by the null-terminated
|
||||
string
|
||||
.I filename
|
||||
|
@ -96,16 +96,16 @@ contains a DT_RUNPATH tag, then the directories listed in that tag
|
|||
are searched.
|
||||
.IP o
|
||||
The cache file
|
||||
.BR /etc/ld.so.cache
|
||||
.IR /etc/ld.so.cache
|
||||
(maintained by
|
||||
.BR ldconfig (8))
|
||||
is checked to see whether it contains an entry for
|
||||
.IR filename .
|
||||
.IP o
|
||||
The directories
|
||||
.B /lib
|
||||
.I /lib
|
||||
and
|
||||
.B /usr/lib
|
||||
.I /usr/lib
|
||||
are searched (in that order).
|
||||
.PP
|
||||
If the library has dependencies on other shared libraries,
|
||||
|
@ -125,7 +125,7 @@ is specified, or the environment variable
|
|||
.B LD_BIND_NOW
|
||||
is set to a non-empty string,
|
||||
all undefined symbols in the library are resolved before
|
||||
.B dlopen()
|
||||
.BR dlopen ()
|
||||
returns. If this cannot be done, an error is returned.
|
||||
Otherwise binding is lazy: symbol values are first resolved
|
||||
when needed.
|
||||
|
@ -148,11 +148,11 @@ If
|
|||
.I filename
|
||||
is a NULL pointer, then the returned handle is for the main program.
|
||||
When given to
|
||||
.BR dlsym() ,
|
||||
.BR dlsym (),
|
||||
this handle causes a search for a symbol in the main program,
|
||||
followed by all shared libraries loaded at program startup,
|
||||
and then all shared libraries loaded by
|
||||
.BR dlopen()
|
||||
.BR dlopen ()
|
||||
with the flag
|
||||
.BR RTLD_GLOBAL .
|
||||
.PP
|
||||
|
@ -167,13 +167,13 @@ then the global symbols in the executable will also be used
|
|||
to resolve references in a dynamically loaded library.
|
||||
.PP
|
||||
If the same library is loaded again with
|
||||
.BR dlopen() ,
|
||||
.BR dlopen (),
|
||||
the same file handle is returned. The dl library maintains reference
|
||||
counts for library handles, so a dynamic library is not
|
||||
deallocated until
|
||||
.B dlclose()
|
||||
.BR dlclose ()
|
||||
has been called on it as many times as
|
||||
.B dlopen()
|
||||
.BR dlopen ()
|
||||
has succeeded on it. The
|
||||
.B _init
|
||||
routine, if present, is only called once. But a subsequent call with
|
||||
|
@ -182,32 +182,32 @@ may force symbol resolution for a library earlier loaded with
|
|||
.BR RTLD_LAZY .
|
||||
.PP
|
||||
If
|
||||
.B dlopen()
|
||||
.BR dlopen ()
|
||||
fails for any reason, it returns NULL.
|
||||
.SS "dlsym"
|
||||
The function
|
||||
.B dlsym()
|
||||
.BR dlsym ()
|
||||
takes a "handle" of a dynamic library returned by dlopen and the
|
||||
NUL-terminated symbol name, returning the address where that symbol is
|
||||
loaded into memory. If the symbol is not found, in the specified
|
||||
library or any of the libraries that were automatically loaded by
|
||||
.B dlopen()
|
||||
.BR dlopen ()
|
||||
when that library was loaded,
|
||||
.B dlsym()
|
||||
.BR dlsym ()
|
||||
returns NULL.
|
||||
(The search performed by
|
||||
.B dlsym()
|
||||
.BR dlsym ()
|
||||
is breadth first through the dependency tree of these libraries.)
|
||||
Since the value of the symbol could actually be NULL (so that a
|
||||
NULL return from
|
||||
.B dlsym()
|
||||
.BR dlsym ()
|
||||
need not indicate an error), the correct way to test for an error
|
||||
is to call
|
||||
.B dlerror()
|
||||
.BR dlerror ()
|
||||
to clear any old error conditions, then call
|
||||
.BR dlsym() ,
|
||||
.BR dlsym (),
|
||||
and then call
|
||||
.B dlerror()
|
||||
.BR dlerror ()
|
||||
again, saving its return value into a variable, and check whether
|
||||
this saved value is not NULL.
|
||||
.PP
|
||||
|
@ -222,14 +222,14 @@ after the current library. This allows one to provide a wrapper
|
|||
around a function in another shared library.
|
||||
.SS "dlclose"
|
||||
The function
|
||||
.B dlclose()
|
||||
.BR dlclose ()
|
||||
decrements the reference count on the dynamic library handle
|
||||
.IR handle .
|
||||
If the reference count drops to zero and no other loaded libraries use
|
||||
symbols in it, then the dynamic library is unloaded.
|
||||
.LP
|
||||
The function
|
||||
.B dlclose()
|
||||
.BR dlclose ()
|
||||
returns 0 on success, and non-zero on error.
|
||||
.SS "The obsolete symbols _init and _fini"
|
||||
The linker recognizes special symbols
|
||||
|
@ -239,7 +239,7 @@ and
|
|||
If a dynamic library exports a routine named
|
||||
.BR _init ,
|
||||
then that code is executed after the loading, before
|
||||
.B dlopen()
|
||||
.BR dlopen ()
|
||||
returns. If the dynamic library exports a routine named
|
||||
.BR _fini ,
|
||||
then that routine is called just before the library is unloaded.
|
||||
|
@ -280,7 +280,7 @@ Glibc adds two functions not described by POSIX, with prototypes
|
|||
.fi
|
||||
.PP
|
||||
The function
|
||||
.B dladdr()
|
||||
.BR dladdr ()
|
||||
takes a function pointer and tries to resolve name
|
||||
and file where it is located. Information is stored in the
|
||||
Dl_info structure:
|
||||
|
@ -294,14 +294,14 @@ typedef struct {
|
|||
} Dl_info;
|
||||
.fi
|
||||
.sp
|
||||
.B dladdr()
|
||||
.BR dladdr ()
|
||||
returns 0 on error, and non-zero on success.
|
||||
.PP
|
||||
The function
|
||||
.B dlvsym()
|
||||
.BR dlvsym ()
|
||||
does the same as
|
||||
.B dlsym()
|
||||
but takes a version string as additional argument.
|
||||
.BR dlsym ()
|
||||
but takes a version string as an additional argument.
|
||||
|
||||
.SH EXAMPLE
|
||||
.B Load the math library, and print the cosine of 2.0:
|
||||
|
@ -358,7 +358,7 @@ The symbols RTLD_DEFAULT and RTLD_NEXT are defined by
|
|||
only when _GNU_SOURCE was defined before including it.
|
||||
.\" .LP
|
||||
.\" The string returned by
|
||||
.\" .B dlerror()
|
||||
.\" .BR dlerror()
|
||||
.\" should not be modified. Some systems give the prototype as
|
||||
.\" .sp
|
||||
.\" .in +5
|
||||
|
@ -366,9 +366,16 @@ only when _GNU_SOURCE was defined before including it.
|
|||
.\" .in
|
||||
.SH HISTORY
|
||||
The dlopen interface standard comes from SunOS. That system also has
|
||||
dladdr, but not dlvsym.
|
||||
.BR dladdr (),
|
||||
but not
|
||||
.BR dlvsym ().
|
||||
.SH "CONFORMING TO"
|
||||
POSIX 1003.1-2003 describes dlclose, dlerror, dlopen, dlsym.
|
||||
POSIX 1003.1-2003 describes
|
||||
.BR dlclose (),
|
||||
.BR dlerror (),
|
||||
.BR dlopen (),
|
||||
and
|
||||
.BR dlsym ().
|
||||
.SH "SEE ALSO"
|
||||
.BR ld (1),
|
||||
.BR ldd (1),
|
||||
|
|
Loading…
Reference in New Issue