tzfile.5, tzselect.8: sync from tzdb upstream
[man-pages.git] / man2 / uselib.2
blob34365cc845527f4ce1bd9760551a92d63161885d
1 .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .\" Modified by Michael Haardt <michael@moria.de>
6 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
7 .\" Modified 1996-10-22 by Eric S. Raymond <esr@thyrsus.com>
8 .\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
9 .\" Modified 2005-01-09 by aeb
10 .\"
11 .TH uselib 2 (date) "Linux man-pages (unreleased)"
12 .SH NAME
13 uselib \- load shared library
14 .SH SYNOPSIS
15 .nf
16 .B #include <unistd.h>
17 .PP
18 .BI "[[deprecated]] int uselib(const char *" library );
19 .fi
20 .SH DESCRIPTION
21 The system call
22 .BR uselib ()
23 serves to load
24 a shared library to be used by the calling process.
25 It is given a pathname.
26 The address where to load is found
27 in the library itself.
28 The library can have any recognized
29 binary format.
30 .SH RETURN VALUE
31 On success, zero is returned.
32 On error, \-1 is returned, and
33 .I errno
34 is set to indicate the error.
35 .SH ERRORS
36 In addition to all of the error codes returned by
37 .BR open (2)
38 and
39 .BR mmap (2),
40 the following may also be returned:
41 .TP
42 .B EACCES
43 The library specified by
44 .I library
45 does not have read or execute permission, or the caller does not have
46 search permission for one of the directories in the path prefix.
47 (See also
48 .BR path_resolution (7).)
49 .TP
50 .B ENFILE
51 The system-wide limit on the total number of open files has been reached.
52 .TP
53 .B ENOEXEC
54 The file specified by
55 .I library
56 is not an executable of a known type;
57 for example, it does not have the correct magic numbers.
58 .SH STANDARDS
59 .BR uselib ()
60 is Linux-specific, and should not be used in programs
61 intended to be portable.
62 .SH NOTES
63 This obsolete system call is not supported by glibc.
64 No declaration is provided in glibc headers, but, through a quirk of history,
65 glibc before glibc 2.23 did export an ABI for this system call.
66 Therefore, in order to employ this system call,
67 it was sufficient to manually declare the interface in your code;
68 alternatively, you could invoke the system call using
69 .BR syscall (2).
70 .PP
71 In ancient libc versions (before glibc 2.0),
72 .BR uselib ()
73 was used to load
74 the shared libraries with names found in an array of names
75 in the binary.
76 .\" .PP
77 .\" .\" libc 4.3.1f - changelog 1993-03-02
78 .\" Since libc 4.3.2, startup code tries to prefix these names
79 .\" with "/usr/lib", "/lib" and "" before giving up.
80 .\" .\" libc 4.3.4 - changelog 1993-04-21
81 .\" In libc 4.3.4 and later these names are looked for in the directories
82 .\" found in
83 .\" .BR LD_LIBRARY_PATH ,
84 .\" and if not found there,
85 .\" prefixes "/usr/lib", "/lib" and "/" are tried.
86 .\" .PP
87 .\" From libc 4.4.4 on only the library "/lib/ld.so" is loaded,
88 .\" so that this dynamic library can load the remaining libraries needed
89 .\" (again using this call).
90 .\" This is also the state of affairs in libc5.
91 .\" .PP
92 .\" glibc2 does not use this call.
93 .PP
94 Since Linux 3.15,
95 .\" commit 69369a7003735d0d8ef22097e27a55a8bad9557a
96 this system call is available only when the kernel is configured with the
97 .B CONFIG_USELIB
98 option.
99 .SH SEE ALSO
100 .BR ar (1),
101 .BR gcc (1),
102 .BR ld (1),
103 .BR ldd (1),
104 .BR mmap (2),
105 .BR open (2),
106 .BR dlopen (3),
107 .BR capabilities (7),
108 .BR ld.so (8)