1 .\" Copyright (C) 1996 Free Software Foundation, Inc.
2 .\" This file is distributed according to the GNU General Public License.
3 .\" See the file COPYING in the top level source directory for details.
5 .\" 2006-02-09, some reformatting by Luc Van Oostenryck; some
6 .\" reformatting and rewordings by mtk
8 .TH QUERY_MODULE 2 2007-06-03 "Linux" "Linux Programmer's Manual"
10 query_module \- query the kernel for various bits pertaining to modules
13 .B #include <linux/module.h>
15 .BI "int query_module(const char *" name ", int " which ", void *" buf ,
16 .BI " size_t " bufsize ", size_t *" ret );
20 requests information from the kernel about loadable modules.
21 The returned information is placed in the buffer pointed to by
23 The caller must specify the size of
27 The precise nature and format of the returned information
28 depend on the operation specified by
30 Some operations require
32 to identify a currently loaded module, some allow
34 to be NULL, indicating the kernel proper.
36 The following values can be specified for
40 Returns success, if the kernel supports
42 Used to probe for availability of the system call.
45 Returns the names of all loaded modules.
46 The returned buffer consists of a sequence of null-terminated strings;
48 is set to the number of
50 .\" ret is set on ENOSPC
53 Returns the names of all modules used by the indicated module.
54 The returned buffer consists of a sequence of null-terminated strings;
56 is set to the number of modules.
57 .\" ret is set on ENOSPC
60 Returns the names of all modules using the indicated module.
61 This is the inverse of
63 The returned buffer consists of a sequence of null-terminated strings;
65 is set to the number of modules.
66 .\" ret is set on ENOSPC
69 Returns the symbols and values exported by the kernel or the indicated
71 The returned buffer is an array of structures of the following form
72 .\" ret is set on ENOSPC
76 struct module_symbol {
83 followed by null-terminated strings.
86 is the character offset of the string relative to the start of
89 is set to the number of symbols.
92 Returns miscellaneous information about the indicated module.
93 The output buffer format is:
98 unsigned long address;
107 is the kernel address at which the module resides,
109 is the size of the module in bytes, and
114 etc. that indicates the current status of the module
115 (see the kernel source file
116 .IR include/linux/module.h ).
118 is set to the size of the
123 On success, zero is returned.
124 On error, \-1 is returned and
126 is set appropriately.
135 was outside the program's accessible address space.
142 is NULL (indicating "the kernel"),
143 but this is not permitted with the specified value of
145 .\" Not permitted with QM_DEPS, QM_REFS, or QM_INFO.
153 The buffer size provided was too small.
155 is set to the minimum size needed.
159 is not supported in this version of the kernel.
164 This system call is only present on Linux up until kernel 2.4;
165 it was removed in Linux 2.6.
166 .\" Removed in Linux 2.5.48
167 Some of the information that was available via
175 .BR create_module (2),
176 .BR delete_module (2),
177 .BR get_kernel_syms (2),