1QUERY_MODULE(2)            Linux Programmer's Manual           QUERY_MODULE(2)
2
3
4

NAME

6       query_module - query the kernel for various bits pertaining to modules
7

SYNOPSIS

9       #include <linux/module.h>
10
11       int query_module(const char *name, int which, void *buf,
12                        size_t bufsize, size_t *ret);
13

DESCRIPTION

15       query_module() requests information from the kernel about loadable mod‐
16       ules.  The returned information is placed in the buffer pointed  to  by
17       buf.   The caller must specify the size of buf in bufsize.  The precise
18       nature and format of the returned information depend on  the  operation
19       specified  by  which.   Some operations require name to identify a cur‐
20       rently loaded module, some allow name to be NULL, indicating the kernel
21       proper.
22
23       The following values can be specified for which:
24
25       0      Returns success, if the kernel supports query_module().  Used to
26              probe for availability of the system call.
27
28       QM_MODULES
29              Returns the names of all loaded modules.   The  returned  buffer
30              consists of a sequence of null-terminated strings; ret is set to
31              the number of modules.
32
33       QM_DEPS
34              Returns the names of all modules used by the  indicated  module.
35              The  returned  buffer  consists of a sequence of null-terminated
36              strings; ret is set to the number of modules.
37
38       QM_REFS
39              Returns the names of all modules  using  the  indicated  module.
40              This is the inverse of QM_DEPS.  The returned buffer consists of
41              a sequence of null-terminated strings; ret is set to the  number
42              of modules.
43
44       QM_SYMBOLS
45              Returns  the  symbols  and  values exported by the kernel or the
46              indicated module.  The returned buffer is an array of structures
47              of the following form
48
49                  struct module_symbol {
50                      unsigned long value;
51                      unsigned long name;
52                  };
53
54              followed  by  null-terminated strings.  The value of name is the
55              character offset of the string relative to the start of buf; ret
56              is set to the number of symbols.
57
58       QM_INFO
59              Returns  miscellaneous  information  about the indicated module.
60              The output buffer format is:
61
62                  struct module_info {
63                      unsigned long address;
64                      unsigned long size;
65                      unsigned long flags;
66                  };
67
68              where address is the kernel address at which the module resides,
69              size  is the size of the module in bytes, and flags is a mask of
70              MOD_RUNNING, MOD_AUTOCLEAN, etc. that indicates the current sta‐
71              tus of the module (see the kernel source file include/linux/mod‐
72              ule.h).  ret is set to the size of the module_info structure.
73

RETURN VALUE

75       On success, zero is returned.  On error, -1 is returned  and  errno  is
76       set appropriately.
77

ERRORS

79       EFAULT At  least  one  of  name,  buf, or ret was outside the program's
80              accessible address space.
81
82       EINVAL Invalid which; or name is NULL (indicating  "the  kernel"),  but
83              this is not permitted with the specified value of which.
84
85       ENOENT No module by that name exists.
86
87       ENOSPC The buffer size provided was too small.  ret is set to the mini‐
88              mum size needed.
89
90       ENOSYS query_module() is not supported in this version of the kernel.
91

CONFORMING TO

93       query_module() is Linux-specific.
94

NOTES

96       This system call is only present on Linux up until kernel 2.4;  it  was
97       removed  in  Linux 2.6.  Some of the information that was available via
98       query_module() can be obtained from /proc/modules, /proc/kallsyms,  and
99       /sys/modules.
100

SEE ALSO

102       create_module(2), delete_module(2), get_kernel_syms(2), init_module(2)
103

COLOPHON

105       This  page  is  part of release 3.22 of the Linux man-pages project.  A
106       description of the project, and information about reporting  bugs,  can
107       be found at http://www.kernel.org/doc/man-pages/.
108
109
110
111Linux                             2007-06-03                   QUERY_MODULE(2)
Impressum