193 lines
4.8 KiB
HTML
193 lines
4.8 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of USELIB</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>USELIB</H1>
|
|
Section: Linux Programmer's Manual (2)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
uselib - load shared library
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/unistd.h">unistd.h</A>></B>
|
|
|
|
<P>
|
|
|
|
<B>int uselib(const char *</B><I>library</I><B>);</B>
|
|
|
|
<P>
|
|
|
|
<I>Note</I>:
|
|
|
|
No declaration of this system call is provided in glibc headers; see NOTES.
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
The system call
|
|
<B>uselib</B>()
|
|
|
|
serves to load
|
|
a shared library to be used by the calling process.
|
|
It is given a pathname.
|
|
The address where to load is found
|
|
in the library itself.
|
|
The library can have any recognized
|
|
binary format.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On success, zero is returned.
|
|
On error, -1 is returned, and
|
|
<I>errno</I>
|
|
|
|
is set appropriately.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
In addition to all of the error codes returned by
|
|
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2)
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mmap">mmap</A></B>(2),
|
|
|
|
the following may also be returned:
|
|
<DL COMPACT>
|
|
<DT id="1"><B>EACCES</B>
|
|
|
|
<DD>
|
|
The library specified by
|
|
<I>library</I>
|
|
|
|
does not have read or execute permission, or the caller does not have
|
|
search permission for one of the directories in the path prefix.
|
|
(See also
|
|
<B><A HREF="/cgi-bin/man/man2html?7+path_resolution">path_resolution</A></B>(7).)
|
|
|
|
<DT id="2"><B>ENFILE</B>
|
|
|
|
<DD>
|
|
The system-wide limit on the total number of open files has been reached.
|
|
<DT id="3"><B>ENOEXEC</B>
|
|
|
|
<DD>
|
|
The file specified by
|
|
<I>library</I>
|
|
|
|
is not an executable of a known type;
|
|
for example, it does not have the correct magic numbers.
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
<B>uselib</B>()
|
|
|
|
is Linux-specific, and should not be used in programs
|
|
intended to be portable.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
This obsolete system call is not supported by glibc.
|
|
No declaration is provided in glibc headers, but, through a quirk of history,
|
|
glibc versions before 2.23 did export an ABI for this system call.
|
|
Therefore, in order to employ this system call,
|
|
it was sufficient to manually declare the interface in your code;
|
|
alternatively, you could invoke the system call using
|
|
<B><A HREF="/cgi-bin/man/man2html?2+syscall">syscall</A></B>(2).
|
|
|
|
<P>
|
|
|
|
In ancient libc versions,
|
|
<B>uselib</B>()
|
|
|
|
was used to load
|
|
the shared libraries with names found in an array of names
|
|
in the binary.
|
|
<P>
|
|
|
|
|
|
Since libc 4.3.2, startup code tries to prefix these names
|
|
with "/usr/lib", "/lib" and "" before giving up.
|
|
|
|
In libc 4.3.4 and later these names are looked for in the directories
|
|
found in
|
|
<B>LD_LIBRARY_PATH</B>,
|
|
|
|
and if not found there,
|
|
prefixes "/usr/lib", "/lib" and "/" are tried.
|
|
<P>
|
|
|
|
From libc 4.4.4 on only the library "/lib/ld.so" is loaded,
|
|
so that this dynamic library can load the remaining libraries needed
|
|
(again using this call).
|
|
This is also the state of affairs in libc5.
|
|
<P>
|
|
|
|
glibc2 does not use this call.
|
|
<P>
|
|
|
|
Since Linux 3.15,
|
|
|
|
this system call is available only when the kernel is configured with the
|
|
<B>CONFIG_USELIB</B>
|
|
|
|
option.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ar">ar</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+gcc">gcc</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ld">ld</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+ldd">ldd</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+mmap">mmap</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+dlopen">dlopen</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+capabilities">capabilities</A></B>(7),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+ld.so">ld.so</A></B>(8)
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="4"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="5"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="6"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="7"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="8"><A HREF="#lbAF">ERRORS</A><DD>
|
|
<DT id="9"><A HREF="#lbAG">CONFORMING TO</A><DD>
|
|
<DT id="10"><A HREF="#lbAH">NOTES</A><DD>
|
|
<DT id="11"><A HREF="#lbAI">SEE ALSO</A><DD>
|
|
<DT id="12"><A HREF="#lbAJ">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:35 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|