]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/uselib.2
Ready for 5.00
[thirdparty/man-pages.git] / man2 / uselib.2
CommitLineData
fea681da
MK
1.\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
2.\"
93015253 3.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
1dba3c20 12.\"
fea681da
MK
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
1dba3c20 20.\"
fea681da
MK
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 23.\" %%%LICENSE_END
fea681da
MK
24.\"
25.\" Modified by Michael Haardt <michael@moria.de>
26.\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
27.\" Modified 1996-10-22 by Eric S. Raymond <esr@thyrsus.com>
81f3ee48 28.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
1dba3c20 29.\" Modified 2005-01-09 by aeb
fea681da 30.\"
4b8c67d9 31.TH USELIB 2 2017-09-15 "Linux" "Linux Programmer's Manual"
fea681da 32.SH NAME
1dba3c20 33uselib \- load shared library
fea681da
MK
34.SH SYNOPSIS
35.B #include <unistd.h>
68e4db0a 36.PP
fea681da 37.BI "int uselib(const char *" library );
dbfe9c70 38.PP
b575a20f
MK
39.IR Note :
40No declaration of this system call is provided in glibc headers; see NOTES.
fea681da 41.SH DESCRIPTION
60a90ecd
MK
42The system call
43.BR uselib ()
44serves to load
1dba3c20 45a shared library to be used by the calling process.
c13182ef
MK
46It is given a pathname.
47The address where to load is found
48in the library itself.
49The library can have any recognized
1dba3c20 50binary format.
47297adb 51.SH RETURN VALUE
c13182ef
MK
52On success, zero is returned.
53On error, \-1 is returned, and
fea681da
MK
54.I errno
55is set appropriately.
56.SH ERRORS
57In addition to all of the error codes returned by
58.BR open (2)
59and
60.BR mmap (2),
61the following may also be returned:
fea681da
MK
62.TP
63.B EACCES
64The library specified by
65.I library
1dba3c20
MK
66does not have read or execute permission, or the caller does not have
67search permission for one of the directories in the path prefix.
68(See also
ad7cc990 69.BR path_resolution (7).)
fea681da
MK
70.TP
71.B ENFILE
e258766b 72The system-wide limit on the total number of open files has been reached.
fea681da
MK
73.TP
74.B ENOEXEC
75The file specified by
76.I library
10850212
MK
77is not an executable of a known type;
78for example, it does not have the correct magic numbers.
47297adb 79.SH CONFORMING TO
60a90ecd 80.BR uselib ()
8382f16d 81is Linux-specific, and should not be used in programs
fea681da 82intended to be portable.
1dba3c20 83.SH NOTES
b575a20f
MK
84This obsolete system call is not supported by glibc.
85No declaration is provided in glibc headers, but, through a quirk of history,
86glibc versions before 2.23 did export an ABI for this system call.
87Therefore, in order to employ this system call,
88it was sufficient to manually declare the interface in your code;
89alternatively, you could invoke the system call using
90.BR syscall (2).
efeece04 91.PP
b575a20f 92In ancient libc versions,
60a90ecd 93.BR uselib ()
d04b14bd 94was used to load
1dba3c20
MK
95the shared libraries with names found in an array of names
96in the binary.
dd3568a1 97.PP
1dba3c20
MK
98.\" libc 4.3.1f - changelog 1993-03-02
99Since libc 4.3.2, startup code tries to prefix these names
100with "/usr/lib", "/lib" and "" before giving up.
101.\" libc 4.3.4 - changelog 1993-04-21
102In libc 4.3.4 and later these names are looked for in the directories
2f0af33b
MK
103found in
104.BR LD_LIBRARY_PATH ,
105and if not found there,
1dba3c20 106prefixes "/usr/lib", "/lib" and "/" are tried.
dd3568a1 107.PP
1dba3c20
MK
108From libc 4.4.4 on only the library "/lib/ld.so" is loaded,
109so that this dynamic library can load the remaining libraries needed
110(again using this call).
111This is also the state of affairs in libc5.
dd3568a1 112.PP
1dba3c20 113glibc2 does not use this call.
efeece04 114.PP
50f6c774
MK
115Since Linux 3.15,
116.\" commit 69369a7003735d0d8ef22097e27a55a8bad9557a
117this system call is available only when the kernel is configured with the
118.B CONFIG_USELIB
119option.
47297adb 120.SH SEE ALSO
fea681da
MK
121.BR ar (1),
122.BR gcc (1),
123.BR ld (1),
124.BR ldd (1),
125.BR mmap (2),
126.BR open (2),
1dba3c20 127.BR dlopen (3),
9f1a6ca7 128.BR capabilities (7),
fea681da 129.BR ld.so (8)