Debian Codegraph @

upstream/debian-unstable/man2/uselib.2

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