.\" This file is distributed according to the GNU General Public License.
.\" See the file COPYING in the top level source directory for details.
.\"
-.\" 2006-02-09, some reformatting by Luc Van Oostenryck; some
+.\" 2006-02-09, some reformatting by Luc Van Oostenryck; some
.\" reformatting and rewordings by mtk
.\"
.TH QUERY_MODULE 2 "2002" "Linux" "Linux Module Support"
.nf
.B #include <linux/module.h>
.sp
-.BI "int query_module(const char *" name ", int " which ", void *" buf ,
+.BI "int query_module(const char *" name ", int " which ", void *" buf ,
.BI " size_t " bufsize ", size_t *" ret );
.fi
.SH DESCRIPTION
.IR buf .
The caller must specify the size of
.I buf
-in
+in
.IR bufsize .
The precise nature and format of the returned information
depend on the operation specified by
.IR which :
.TP
.B 0
-Always returns success.
+Always returns success.
Used to probe for availability of the system call.
.TP
.B QM_MODULES
-Returns the names of all loaded modules.
+Returns the names of all loaded modules.
The returned buffer consists of a sequence of null-terminated strings;
.I ret
is set to the number of
is set to the number of modules.
.TP
.B QM_REFS
-Returns the names of all modules using the indicated module. This is
-the inverse of
+Returns the names of all modules using the indicated module.
+This is the inverse of
.BR QM_DEPS .
The returned buffer consists of a sequence of null-terminated strings;
.I ret
.TP
.B QM_SYMBOLS
Returns the symbols and values exported by the kernel or the indicated
-module.
+module.
The returned buffer is an array of structures of the following form
.RS
.PP
.RE
.TP
.B QM_INFO
-Returns miscellaneous information about the indicated module. The output
-buffer format is:
+Returns miscellaneous information about the indicated module.
+The output buffer format is:
.RS
.PP
.nf
is a mask of
.BR MOD_RUNNING ,
.BR MOD_AUTOCLEAN ,
-etc. that indicates the current status of the module
-(see the kernel source file
+etc. that indicates the current status of the module
+(see the kernel source file
.IR include/linux/module.h ).
.I ret
is set to the size of the
structure.
.RE
.SH "RETURN VALUE"
-On success, zero is returned. On error, \-1 is returned and
+On success, zero is returned.
+On error, \-1 is returned and
.I errno
is set appropriately.
.SH ERRORS
.IR which ;
or
.I name
-is NULL (indicating "the kernel"),
+is NULL (indicating "the kernel"),
but this is not permitted with the specified value of
.IR which .
.\" Not permitted with QM_DEPS, QM_REFS, or QM_INFO.
.BR query_module ()
is Linux specific.
.SH NOTES
-This system call is only present on Linux up until kernel 2.4;
+This system call is only present on Linux up until kernel 2.4;
it was removed in Linux 2.6.
.\" Removed in Linux-2.5.48
Some of the information that was available via
.BR query_module ()
can be obtained from
.IR /proc/modules ,
-.IR /proc/kallsyms ,
+.IR /proc/kallsyms ,
and
.IR /sys/modules .
.SH "SEE ALSO"