Start of man-pages-5.14: updating Changes and Changes.old
[man-pages.git] / man2 / uselib.2
blobf6feca9f0acca11f913a2c0de5c351a7db505a7c
1 .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
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.
12 .\"
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.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
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>
28 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
29 .\" Modified 2005-01-09 by aeb
30 .\"
31 .TH USELIB 2 2021-03-22 "Linux" "Linux Programmer's Manual"
32 .SH NAME
33 uselib \- load shared library
34 .SH SYNOPSIS
35 .nf
36 .B #include <unistd.h>
37 .PP
38 .BI "int uselib(const char *" library );
39 .fi
40 .PP
41 .IR Note :
42 No declaration of this system call is provided in glibc headers; see NOTES.
43 .SH DESCRIPTION
44 The system call
45 .BR uselib ()
46 serves to load
47 a shared library to be used by the calling process.
48 It is given a pathname.
49 The address where to load is found
50 in the library itself.
51 The library can have any recognized
52 binary format.
53 .SH RETURN VALUE
54 On success, zero is returned.
55 On error, \-1 is returned, and
56 .I errno
57 is set to indicate the error.
58 .SH ERRORS
59 In addition to all of the error codes returned by
60 .BR open (2)
61 and
62 .BR mmap (2),
63 the following may also be returned:
64 .TP
65 .B EACCES
66 The library specified by
67 .I library
68 does not have read or execute permission, or the caller does not have
69 search permission for one of the directories in the path prefix.
70 (See also
71 .BR path_resolution (7).)
72 .TP
73 .B ENFILE
74 The system-wide limit on the total number of open files has been reached.
75 .TP
76 .B ENOEXEC
77 The file specified by
78 .I library
79 is not an executable of a known type;
80 for example, it does not have the correct magic numbers.
81 .SH CONFORMING TO
82 .BR uselib ()
83 is Linux-specific, and should not be used in programs
84 intended to be portable.
85 .SH NOTES
86 This obsolete system call is not supported by glibc.
87 No declaration is provided in glibc headers, but, through a quirk of history,
88 glibc versions before 2.23 did export an ABI for this system call.
89 Therefore, in order to employ this system call,
90 it was sufficient to manually declare the interface in your code;
91 alternatively, you could invoke the system call using
92 .BR syscall (2).
93 .PP
94 In ancient libc versions (before glibc 2.0),
95 .BR uselib ()
96 was used to load
97 the shared libraries with names found in an array of names
98 in the binary.
99 .\" .PP
100 .\" .\" libc 4.3.1f - changelog 1993-03-02
101 .\" Since libc 4.3.2, startup code tries to prefix these names
102 .\" with "/usr/lib", "/lib" and "" before giving up.
103 .\" .\" libc 4.3.4 - changelog 1993-04-21
104 .\" In libc 4.3.4 and later these names are looked for in the directories
105 .\" found in
106 .\" .BR LD_LIBRARY_PATH ,
107 .\" and if not found there,
108 .\" prefixes "/usr/lib", "/lib" and "/" are tried.
109 .\" .PP
110 .\" From libc 4.4.4 on only the library "/lib/ld.so" is loaded,
111 .\" so that this dynamic library can load the remaining libraries needed
112 .\" (again using this call).
113 .\" This is also the state of affairs in libc5.
114 .\" .PP
115 .\" glibc2 does not use this call.
117 Since Linux 3.15,
118 .\" commit 69369a7003735d0d8ef22097e27a55a8bad9557a
119 this system call is available only when the kernel is configured with the
120 .B CONFIG_USELIB
121 option.
122 .SH SEE ALSO
123 .BR ar (1),
124 .BR gcc (1),
125 .BR ld (1),
126 .BR ldd (1),
127 .BR mmap (2),
128 .BR open (2),
129 .BR dlopen (3),
130 .BR capabilities (7),
131 .BR ld.so (8)