]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/uselib.2
intro.1, _exit.2, access.2, alarm.2, alloc_hugepages.2, arch_prctl.2, bind.2, chdir...
[thirdparty/man-pages.git] / man2 / uselib.2
CommitLineData
fea681da
MK
1.\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
2.\"
4b72fb64 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>
1dba3c20
MK
28.\" Modified 2004-06-23 by Michael Kerrisk <mtk16@ext.canterbury.ac.nz>
29.\" Modified 2005-01-09 by aeb
fea681da 30.\"
d9343c5c 31.TH USELIB 2 2005-01-09 "Linux" "Linux Programmer's Manual"
fea681da 32.SH NAME
1dba3c20 33uselib \- load shared library
fea681da
MK
34.SH SYNOPSIS
35.B #include <unistd.h>
36.sp
37.BI "int uselib(const char *" library );
38.SH DESCRIPTION
60a90ecd
MK
39The system call
40.BR uselib ()
41serves to load
1dba3c20 42a shared library to be used by the calling process.
c13182ef
MK
43It is given a pathname.
44The address where to load is found
45in the library itself.
46The library can have any recognized
1dba3c20 47binary format.
47297adb 48.SH RETURN VALUE
c13182ef
MK
49On success, zero is returned.
50On error, \-1 is returned, and
fea681da
MK
51.I errno
52is set appropriately.
53.SH ERRORS
54In addition to all of the error codes returned by
55.BR open (2)
56and
57.BR mmap (2),
58the following may also be returned:
fea681da
MK
59.TP
60.B EACCES
61The library specified by
62.I library
1dba3c20
MK
63does not have read or execute permission, or the caller does not have
64search permission for one of the directories in the path prefix.
65(See also
ad7cc990 66.BR path_resolution (7).)
fea681da
MK
67.TP
68.B ENFILE
69The system limit on the total number of open files has been reached.
70.TP
71.B ENOEXEC
72The file specified by
73.I library
1dba3c20
MK
74is not an executable of known type,
75e.g., does not have the correct magic numbers.
47297adb 76.SH CONFORMING TO
60a90ecd 77.BR uselib ()
8382f16d 78is Linux-specific, and should not be used in programs
fea681da 79intended to be portable.
1dba3c20 80.SH NOTES
60a90ecd
MK
81.BR uselib ()
82was used by early libc startup code to load
1dba3c20
MK
83the shared libraries with names found in an array of names
84in the binary.
85.LP
86.\" libc 4.3.1f - changelog 1993-03-02
87Since libc 4.3.2, startup code tries to prefix these names
88with "/usr/lib", "/lib" and "" before giving up.
89.\" libc 4.3.4 - changelog 1993-04-21
90In libc 4.3.4 and later these names are looked for in the directories
2f0af33b
MK
91found in
92.BR LD_LIBRARY_PATH ,
93and if not found there,
1dba3c20
MK
94prefixes "/usr/lib", "/lib" and "/" are tried.
95.LP
96From libc 4.4.4 on only the library "/lib/ld.so" is loaded,
97so that this dynamic library can load the remaining libraries needed
98(again using this call).
99This is also the state of affairs in libc5.
100.LP
101glibc2 does not use this call.
47297adb 102.SH SEE ALSO
fea681da
MK
103.BR ar (1),
104.BR gcc (1),
105.BR ld (1),
106.BR ldd (1),
107.BR mmap (2),
108.BR open (2),
1dba3c20 109.BR dlopen (3),
9f1a6ca7 110.BR capabilities (7),
fea681da 111.BR ld.so (8)