summaryrefslogtreecommitdiffstats
path: root/upstream/debian-bookworm/man2/get_kernel_syms.2
blob: b48b013ac7d630304665fdaf00ace0306a52ba1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
.\" Copyright (C) 1996 Free Software Foundation, Inc.
.\"
.\" SPDX-License-Identifier: GPL-1.0-or-later
.\"
.\" 2006-02-09, some reformatting by Luc Van Oostenryck; some
.\" reformatting and rewordings by mtk
.\"
.TH get_kernel_syms 2 2022-12-04 "Linux man-pages 6.03"
.SH NAME
get_kernel_syms \- retrieve exported kernel and module symbols
.SH SYNOPSIS
.nf
.B #include <linux/module.h>
.PP
.BI "[[deprecated]] int get_kernel_syms(struct kernel_sym *" table );
.fi
.SH DESCRIPTION
.BR Note :
This system call is present only before Linux 2.6.
.PP
If
.I table
is NULL,
.BR get_kernel_syms ()
returns the number of symbols available for query.
Otherwise, it fills in a table of structures:
.PP
.in +4n
.EX
struct kernel_sym {
    unsigned long value;
    char          name[60];
};
.EE
.in
.PP
The symbols are interspersed with magic symbols of the form
.BI # module-name
with the kernel having an empty name.
The value associated with a symbol of this form is the address at
which the module is loaded.
.PP
The symbols exported from each module follow their magic module tag
and the modules are returned in the reverse of the
order in which they were loaded.
.SH RETURN VALUE
On success, returns the number of symbols copied to
.IR table .
On error, \-1 is returned and
.I errno
is set to indicate the error.
.SH ERRORS
There is only one possible error return:
.TP
.B ENOSYS
.BR get_kernel_syms ()
is not supported in this version of the kernel.
.SH VERSIONS
This system call is present only up until Linux 2.4;
it was removed in Linux 2.6.
.\" Removed in Linux 2.5.48
.SH STANDARDS
.BR get_kernel_syms ()
is Linux-specific.
.SH NOTES
This obsolete system call is not supported by glibc.
No declaration is provided in glibc headers, but, through a quirk of history,
glibc versions before glibc 2.23 did export an ABI for this system call.
Therefore, in order to employ this system call,
it was sufficient to manually declare the interface in your code;
alternatively, you could invoke the system call using
.BR syscall (2).
.SH BUGS
There is no way to indicate the size of the buffer allocated for
.IR table .
If symbols have been added to the kernel since the
program queried for the symbol table size, memory will be corrupted.
.PP
The length of exported symbol names is limited to 59 characters.
.PP
Because of these limitations, this system call is deprecated in
favor of
.BR query_module (2)
(which is itself nowadays deprecated
in favor of other interfaces described on its manual page).
.SH SEE ALSO
.BR create_module (2),
.BR delete_module (2),
.BR init_module (2),
.BR query_module (2)