Blame man2/uselib.2

Packit 7cfc04
.\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(VERBATIM)
Packit 7cfc04
.\" Permission is granted to make and distribute verbatim copies of this
Packit 7cfc04
.\" manual provided the copyright notice and this permission notice are
Packit 7cfc04
.\" preserved on all copies.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Permission is granted to copy and distribute modified versions of this
Packit 7cfc04
.\" manual under the conditions for verbatim copying, provided that the
Packit 7cfc04
.\" entire resulting derived work is distributed under the terms of a
Packit 7cfc04
.\" permission notice identical to this one.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Since the Linux kernel and libraries are constantly changing, this
Packit 7cfc04
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
Packit 7cfc04
.\" responsibility for errors or omissions, or for damages resulting from
Packit 7cfc04
.\" the use of the information contained herein.  The author(s) may not
Packit 7cfc04
.\" have taken the same level of care in the production of this manual,
Packit 7cfc04
.\" which is licensed free of charge, as they might when working
Packit 7cfc04
.\" professionally.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Formatted or processed versions of this manual, if unaccompanied by
Packit 7cfc04
.\" the source, must acknowledge the copyright and authors of this work.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.\" Modified by Michael Haardt <michael@moria.de>
Packit 7cfc04
.\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
Packit 7cfc04
.\" Modified 1996-10-22 by Eric S. Raymond <esr@thyrsus.com>
Packit 7cfc04
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
Packit 7cfc04
.\" Modified 2005-01-09 by aeb
Packit 7cfc04
.\"
Packit 7cfc04
.TH USELIB 2 2017-09-15 "Linux" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
uselib \- load shared library
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.B #include <unistd.h>
Packit 7cfc04
.PP
Packit 7cfc04
.BI "int uselib(const char *" library );
Packit 7cfc04
.PP
Packit 7cfc04
.IR Note :
Packit 7cfc04
No declaration of this system call is provided in glibc headers; see NOTES.
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
The system call
Packit 7cfc04
.BR uselib ()
Packit 7cfc04
serves to load
Packit 7cfc04
a shared library to be used by the calling process.
Packit 7cfc04
It is given a pathname.
Packit 7cfc04
The address where to load is found
Packit 7cfc04
in the library itself.
Packit 7cfc04
The library can have any recognized
Packit 7cfc04
binary format.
Packit 7cfc04
.SH RETURN VALUE
Packit 7cfc04
On success, zero is returned.
Packit 7cfc04
On error, \-1 is returned, and
Packit 7cfc04
.I errno
Packit 7cfc04
is set appropriately.
Packit 7cfc04
.SH ERRORS
Packit 7cfc04
In addition to all of the error codes returned by
Packit 7cfc04
.BR open (2)
Packit 7cfc04
and
Packit 7cfc04
.BR mmap (2),
Packit 7cfc04
the following may also be returned:
Packit 7cfc04
.TP
Packit 7cfc04
.B EACCES
Packit 7cfc04
The library specified by
Packit 7cfc04
.I library
Packit 7cfc04
does not have read or execute permission, or the caller does not have
Packit 7cfc04
search permission for one of the directories in the path prefix.
Packit 7cfc04
(See also
Packit 7cfc04
.BR path_resolution (7).)
Packit 7cfc04
.TP
Packit 7cfc04
.B ENFILE
Packit 7cfc04
The system-wide limit on the total number of open files has been reached.
Packit 7cfc04
.TP
Packit 7cfc04
.B ENOEXEC
Packit 7cfc04
The file specified by
Packit 7cfc04
.I library
Packit 7cfc04
is not an executable of a known type;
Packit 7cfc04
for example, it does not have the correct magic numbers.
Packit 7cfc04
.SH CONFORMING TO
Packit 7cfc04
.BR uselib ()
Packit 7cfc04
is Linux-specific, and should not be used in programs
Packit 7cfc04
intended to be portable.
Packit 7cfc04
.SH NOTES
Packit 7cfc04
This obsolete system call is not supported by glibc.
Packit 7cfc04
No declaration is provided in glibc headers, but, through a quirk of history,
Packit 7cfc04
glibc versions before 2.23 did export an ABI for this system call.
Packit 7cfc04
Therefore, in order to employ this system call,
Packit 7cfc04
it was sufficient to manually declare the interface in your code;
Packit 7cfc04
alternatively, you could invoke the system call using
Packit 7cfc04
.BR syscall (2).
Packit 7cfc04
.PP
Packit 7cfc04
In ancient libc versions,
Packit 7cfc04
.BR uselib ()
Packit 7cfc04
was used to load
Packit 7cfc04
the shared libraries with names found in an array of names
Packit 7cfc04
in the binary.
Packit 7cfc04
.PP
Packit 7cfc04
.\" libc 4.3.1f - changelog 1993-03-02
Packit 7cfc04
Since libc 4.3.2, startup code tries to prefix these names
Packit 7cfc04
with "/usr/lib", "/lib" and "" before giving up.
Packit 7cfc04
.\" libc 4.3.4 - changelog 1993-04-21
Packit 7cfc04
In libc 4.3.4 and later these names are looked for in the directories
Packit 7cfc04
found in
Packit 7cfc04
.BR LD_LIBRARY_PATH ,
Packit 7cfc04
and if not found there,
Packit 7cfc04
prefixes "/usr/lib", "/lib" and "/" are tried.
Packit 7cfc04
.PP
Packit 7cfc04
From libc 4.4.4 on only the library "/lib/ld.so" is loaded,
Packit 7cfc04
so that this dynamic library can load the remaining libraries needed
Packit 7cfc04
(again using this call).
Packit 7cfc04
This is also the state of affairs in libc5.
Packit 7cfc04
.PP
Packit 7cfc04
glibc2 does not use this call.
Packit 7cfc04
.PP
Packit 7cfc04
Since Linux 3.15,
Packit 7cfc04
.\" commit 69369a7003735d0d8ef22097e27a55a8bad9557a
Packit 7cfc04
this system call is available only when the kernel is configured with the
Packit 7cfc04
.B CONFIG_USELIB
Packit 7cfc04
option.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR ar (1),
Packit 7cfc04
.BR gcc (1),
Packit 7cfc04
.BR ld (1),
Packit 7cfc04
.BR ldd (1),
Packit 7cfc04
.BR mmap (2),
Packit 7cfc04
.BR open (2),
Packit 7cfc04
.BR dlopen (3),
Packit 7cfc04
.BR capabilities (7),
Packit 7cfc04
.BR ld.so (8)
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.