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