2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
5 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 #include <sys/resource.h>
36 #include <sys/utsname.h>
38 /* Bits of module.flags. */
40 #define MOD_UNINITIALIZED 0
43 #define MOD_AUTOCLEAN 4
45 #define MOD_USED_ONCE 16
46 #define MOD_JUST_FREED 32
47 #define MOD_INITIALIZING 64
49 /* Values for query_module's which. */
71 #include "xlat/qm_which.h"
72 #include "xlat/modflags.h"
73 #include "xlat/delete_module_flags.h"
75 SYS_FUNC(query_module)
78 printstr(tcp, tcp->u_arg[0], -1);
80 printxval(qm_which, tcp->u_arg[1], "QM_???");
85 if (!verbose(tcp) || syserror(tcp) ||
86 umove(tcp, tcp->u_arg[4], &ret) < 0) {
87 tprintf("%#lx, %lu, %#lx", tcp->u_arg[2],
88 tcp->u_arg[3], tcp->u_arg[4]);
89 } else if (tcp->u_arg[1]==QM_INFO) {
90 struct module_info mi;
91 if (umove(tcp, tcp->u_arg[2], &mi) < 0) {
92 tprintf("%#lx, ", tcp->u_arg[2]);
94 tprintf("{address=%#lx, size=%lu, flags=",
96 printflags(modflags, mi.flags, "MOD_???");
97 tprintf(", usecount=%lu}, ", mi.usecount);
99 tprintf("%lu", (unsigned long)ret);
100 } else if ((tcp->u_arg[1]==QM_MODULES) ||
101 (tcp->u_arg[1]==QM_DEPS) ||
102 (tcp->u_arg[1]==QM_REFS)) {
105 char* data = malloc(tcp->u_arg[3]);
110 error_msg("Out of memory");
111 tprintf(" /* %lu entries */ ", (unsigned long)ret);
113 if (umoven(tcp, tcp->u_arg[2],
114 tcp->u_arg[3], data) < 0) {
115 tprintf(" /* %lu entries */ ", (unsigned long)ret);
117 for (idx = 0; idx < ret; idx++) {
121 mod += strlen(mod)+1;
127 tprintf(" /* %lu entries */ ", (unsigned long)ret);
128 tprintf("}, %lu", (unsigned long)ret);
129 } else if (tcp->u_arg[1]==QM_SYMBOLS) {
132 char* data = malloc(tcp->u_arg[3]);
133 struct module_symbol* sym = (struct module_symbol*)data;
137 error_msg("Out of memory");
138 tprintf(" /* %lu entries */ ", (unsigned long)ret);
140 if (umoven(tcp, tcp->u_arg[2],
141 tcp->u_arg[3], data) < 0) {
142 tprintf(" /* %lu entries */ ", (unsigned long)ret);
144 for (idx = 0; idx < ret; idx++) {
145 tprintf("%s{name=%s, value=%lu}",
147 data+(long)sym->name,
155 tprintf(" /* %lu entries */ ", (unsigned long)ret);
156 tprintf("}, %ld", (unsigned long)ret);
158 printstr(tcp, tcp->u_arg[2], tcp->u_arg[3]);
159 tprintf(", %#lx", tcp->u_arg[4]);
165 SYS_FUNC(create_module)
168 printpath(tcp, tcp->u_arg[0]);
169 tprintf(", %lu", tcp->u_arg[1]);
174 SYS_FUNC(delete_module)
177 printstr(tcp, tcp->u_arg[0], -1);
179 printflags(delete_module_flags, tcp->u_arg[1], "O_???");
184 SYS_FUNC(init_module)
187 tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
188 printstr(tcp, tcp->u_arg[2], -1);
193 #define MODULE_INIT_IGNORE_MODVERSIONS 1
194 #define MODULE_INIT_IGNORE_VERMAGIC 2
196 #include "xlat/module_init_flags.h"
198 SYS_FUNC(finit_module)
203 /* file descriptor */
204 printfd(tcp, tcp->u_arg[0]);
207 printstr(tcp, tcp->u_arg[1], -1);
210 printflags(module_init_flags, tcp->u_arg[2], "MODULE_INIT_???");