blob: 9480004a86fb1b62ee84615547469e450698312d [file] [log] [blame]
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001/*
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>
Wichert Akkerman4dc8a2a1999-12-23 14:20:14 +00005 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00006 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
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.
18 *
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.
29 *
30 * $Id$
31 */
32
33#include "defs.h"
34
35#ifdef LINUX
36#define _LINUX_SOCKET_H
Wichert Akkerman14cd9f01999-07-09 18:56:34 +000037#define _LINUX_FS_H
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000038
Roland McGrathcbd33582005-02-02 04:36:11 +000039#define MS_RDONLY 1 /* Mount read-only */
40#define MS_NOSUID 2 /* Ignore suid and sgid bits */
41#define MS_NODEV 4 /* Disallow access to device special files */
42#define MS_NOEXEC 8 /* Disallow program execution */
43#define MS_SYNCHRONOUS 16 /* Writes are synced at once */
44#define MS_REMOUNT 32 /* Alter flags of a mounted FS */
45#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */
46#define MS_DIRSYNC 128 /* Directory modifications are synchronous */
47#define MS_NOATIME 1024 /* Do not update access times. */
48#define MS_NODIRATIME 2048 /* Do not update directory access times */
49#define MS_BIND 4096
50#define MS_MOVE 8192
51#define MS_REC 16384
Dmitry V. Levin817b7082007-01-16 15:10:07 +000052#define MS_SILENT 32768
Roland McGrathcbd33582005-02-02 04:36:11 +000053#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
Dmitry V. Levin817b7082007-01-16 15:10:07 +000054#define MS_UNBINDABLE (1<<17) /* change to unbindable */
55#define MS_PRIVATE (1<<18) /* change to private */
56#define MS_SLAVE (1<<19) /* change to slave */
57#define MS_SHARED (1<<20) /* change to shared */
Roland McGrathcbd33582005-02-02 04:36:11 +000058#define MS_ACTIVE (1<<30)
59#define MS_NOUSER (1<<31)
Roland McGrath6af37482006-01-12 21:21:06 +000060#define MS_MGC_VAL 0xc0ed0000 /* Magic flag number */
Dmitry V. Levin817b7082007-01-16 15:10:07 +000061#define MS_MGC_MSK 0xffff0000 /* Magic flag mask */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000062
63#include <sys/socket.h>
64#include <netinet/in.h>
65#include <arpa/inet.h>
66
Nate Sammons8d5860c1999-07-03 18:53:05 +000067#include <sys/syscall.h>
68
Nate Sammons8d5860c1999-07-03 18:53:05 +000069#ifdef SYS_capget
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000070#include <linux/capability.h>
71#endif
72
Nate Sammons8d5860c1999-07-03 18:53:05 +000073#ifdef SYS_cacheflush
Wichert Akkerman2e2553a1999-05-09 00:29:58 +000074#include <asm/cachectl.h>
75#endif
76
Wichert Akkermand6b92492001-04-07 21:37:12 +000077#ifdef HAVE_LINUX_USTNAME_H
78#include <linux/utsname.h>
79#endif
80
Michal Ludvig39c0e942002-11-06 14:00:12 +000081#ifdef MIPS
Wichert Akkermand6b92492001-04-07 21:37:12 +000082#include <asm/sysmips.h>
83#endif
84
Wichert Akkerman22fe9d21999-05-27 12:00:57 +000085#include <linux/sysctl.h>
Wichert Akkerman22fe9d21999-05-27 12:00:57 +000086
Roland McGrathd9f816f2004-09-04 03:39:20 +000087static const struct xlat mount_flags[] = {
Roland McGrath6af37482006-01-12 21:21:06 +000088 { MS_MGC_VAL, "MS_MGC_VAL" },
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000089 { MS_RDONLY, "MS_RDONLY" },
90 { MS_NOSUID, "MS_NOSUID" },
91 { MS_NODEV, "MS_NODEV" },
92 { MS_NOEXEC, "MS_NOEXEC" },
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000093 { MS_SYNCHRONOUS,"MS_SYNCHRONOUS"},
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000094 { MS_REMOUNT, "MS_REMOUNT" },
Roland McGrathcbd33582005-02-02 04:36:11 +000095 { MS_MANDLOCK, "MS_MANDLOCK" },
96 { MS_NOATIME, "MS_NOATIME" },
97 { MS_NODIRATIME,"MS_NODIRATIME" },
98 { MS_BIND, "MS_BIND" },
99 { MS_MOVE, "MS_MOVE" },
100 { MS_REC, "MS_REC" },
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000101 { MS_SILENT, "MS_SILENT" },
Roland McGrathcbd33582005-02-02 04:36:11 +0000102 { MS_POSIXACL, "MS_POSIXACL" },
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000103 { MS_UNBINDABLE,"MS_UNBINDABLE" },
104 { MS_PRIVATE, "MS_PRIVATE" },
105 { MS_SLAVE, "MS_SLAVE" },
106 { MS_SHARED, "MS_SHARED" },
Roland McGrathcbd33582005-02-02 04:36:11 +0000107 { MS_ACTIVE, "MS_ACTIVE" },
108 { MS_NOUSER, "MS_NOUSER" },
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000109 { 0, NULL },
110};
111
112int
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000113sys_mount(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000114{
115 if (entering(tcp)) {
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000116 int ignore_type = 0, ignore_data = 0;
117 unsigned long flags = tcp->u_arg[3];
118
119 /* Discard magic */
120 if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
121 flags &= ~MS_MGC_MSK;
122
123 if (flags & MS_REMOUNT)
124 ignore_type = 1;
125 else if (flags & (MS_BIND | MS_MOVE))
126 ignore_type = ignore_data = 1;
127
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000128 printpath(tcp, tcp->u_arg[0]);
129 tprintf(", ");
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000130
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000131 printpath(tcp, tcp->u_arg[1]);
132 tprintf(", ");
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000133
134 if (ignore_type && tcp->u_arg[2])
Roland McGrathcbd33582005-02-02 04:36:11 +0000135 tprintf("%#lx", tcp->u_arg[2]);
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000136 else
137 printstr(tcp, tcp->u_arg[2], -1);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000138 tprintf(", ");
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000139
Roland McGrathb2dee132005-06-01 19:02:36 +0000140 printflags(mount_flags, tcp->u_arg[3], "MS_???");
Roland McGrath6af37482006-01-12 21:21:06 +0000141 tprintf(", ");
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000142
143 if (ignore_data && tcp->u_arg[4])
Roland McGrath6af37482006-01-12 21:21:06 +0000144 tprintf("%#lx", tcp->u_arg[4]);
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000145 else
146 printstr(tcp, tcp->u_arg[4], -1);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000147 }
148 return 0;
149}
150
Dmitry V. Levin5c7ad8c2007-01-13 11:15:48 +0000151#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */
152#define MNT_DETACH 0x00000002 /* Just detach from the tree */
153#define MNT_EXPIRE 0x00000004 /* Mark for expiry */
154
155static const struct xlat umount_flags[] = {
156 { MNT_FORCE, "MNT_FORCE" },
157 { MNT_DETACH, "MNT_DETACH" },
158 { MNT_EXPIRE, "MNT_EXPIRE" },
159 { 0, NULL },
160};
161
Wichert Akkermandacfb6e1999-06-03 14:21:07 +0000162int
Dmitry V. Levin5c7ad8c2007-01-13 11:15:48 +0000163sys_umount2(struct tcb *tcp)
Wichert Akkermandacfb6e1999-06-03 14:21:07 +0000164{
165 if (entering(tcp)) {
166 printstr(tcp, tcp->u_arg[0], -1);
167 tprintf(", ");
Dmitry V. Levin5c7ad8c2007-01-13 11:15:48 +0000168 printflags(umount_flags, tcp->u_arg[1], "MNT_???");
Wichert Akkermandacfb6e1999-06-03 14:21:07 +0000169 }
170 return 0;
171}
172
Roland McGrathced50da2004-08-31 06:48:46 +0000173/* These are not macros, but enums. We just copy the values by hand
174 from Linux 2.6.9 here. */
Roland McGrathd9f816f2004-09-04 03:39:20 +0000175static const struct xlat personality_options[] = {
Roland McGrathced50da2004-08-31 06:48:46 +0000176 { 0, "PER_LINUX" },
177 { 0x00800000, "PER_LINUX_32BIT"},
178 { 0x04100001, "PER_SVR4" },
179 { 0x05000002, "PER_SVR3" },
180 { 0x07000003, "PER_SCOSVR3" },
181 { 0x06000003, "PER_OSR5" },
182 { 0x05000004, "PER_WYSEV386" },
183 { 0x04000005, "PER_ISCR4" },
184 { 0x00000006, "PER_BSD" },
185 { 0x04000006, "PER_SUNOS" },
186 { 0x05000007, "PER_XENIX" },
187 { 0x00000008, "PER_LINUX32" },
188 { 0x08000008, "PER_LINUX32_3GB"},
189 { 0x04000009, "PER_IRIX32" },
190 { 0x0400000a, "PER_IRIXN32" },
191 { 0x0400000b, "PER_IRIX64" },
192 { 0x0000000c, "PER_RISCOS" },
193 { 0x0400000d, "PER_SOLARIS" },
194 { 0x0410000e, "PER_UW7" },
195 { 0x0000000f, "PER_OSF4" },
196 { 0x00000010, "PER_HPUX" },
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000197 { 0, NULL },
198};
199
200int
201sys_personality(tcp)
202struct tcb *tcp;
203{
204 if (entering(tcp))
205 printxval(personality_options, tcp->u_arg[0], "PER_???");
206 return 0;
207}
208
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000209#include <linux/reboot.h>
Roland McGrathd9f816f2004-09-04 03:39:20 +0000210static const struct xlat bootflags1[] = {
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000211 { LINUX_REBOOT_MAGIC1, "LINUX_REBOOT_MAGIC1" },
212 { 0, NULL },
213};
214
Roland McGrathd9f816f2004-09-04 03:39:20 +0000215static const struct xlat bootflags2[] = {
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000216 { LINUX_REBOOT_MAGIC2, "LINUX_REBOOT_MAGIC2" },
217 { LINUX_REBOOT_MAGIC2A, "LINUX_REBOOT_MAGIC2A" },
218 { LINUX_REBOOT_MAGIC2B, "LINUX_REBOOT_MAGIC2B" },
219 { 0, NULL },
220};
221
Roland McGrathd9f816f2004-09-04 03:39:20 +0000222static const struct xlat bootflags3[] = {
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000223 { LINUX_REBOOT_CMD_CAD_OFF, "LINUX_REBOOT_CMD_CAD_OFF" },
224 { LINUX_REBOOT_CMD_RESTART, "LINUX_REBOOT_CMD_RESTART" },
225 { LINUX_REBOOT_CMD_HALT, "LINUX_REBOOT_CMD_HALT" },
226 { LINUX_REBOOT_CMD_CAD_ON, "LINUX_REBOOT_CMD_CAD_ON" },
227 { LINUX_REBOOT_CMD_POWER_OFF, "LINUX_REBOOT_CMD_POWER_OFF" },
228 { LINUX_REBOOT_CMD_RESTART2, "LINUX_REBOOT_CMD_RESTART2" },
229 { 0, NULL },
230};
231
232int
233sys_reboot(tcp)
234struct tcb *tcp;
235{
236 if (entering(tcp)) {
Roland McGrathb2dee132005-06-01 19:02:36 +0000237 printflags(bootflags1, tcp->u_arg[0], "LINUX_REBOOT_MAGIC_???");
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000238 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000239 printflags(bootflags2, tcp->u_arg[1], "LINUX_REBOOT_MAGIC_???");
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000240 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000241 printflags(bootflags3, tcp->u_arg[2], "LINUX_REBOOT_CMD_???");
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000242 if (tcp->u_arg[2] == LINUX_REBOOT_CMD_RESTART2) {
243 tprintf(", ");
244 printstr(tcp, tcp->u_arg[3], -1);
245 }
246 }
247 return 0;
248}
249
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000250#ifdef M68K
Roland McGrathd9f816f2004-09-04 03:39:20 +0000251static const struct xlat cacheflush_scope[] = {
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000252#ifdef FLUSH_SCOPE_LINE
253 { FLUSH_SCOPE_LINE, "FLUSH_SCOPE_LINE" },
254#endif
255#ifdef FLUSH_SCOPE_PAGE
256 { FLUSH_SCOPE_PAGE, "FLUSH_SCOPE_PAGE" },
257#endif
258#ifdef FLUSH_SCOPE_ALL
259 { FLUSH_SCOPE_ALL, "FLUSH_SCOPE_ALL" },
260#endif
261 { 0, NULL },
262};
263
Roland McGrathd9f816f2004-09-04 03:39:20 +0000264static const struct xlat cacheflush_flags[] = {
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000265#ifdef FLUSH_CACHE_BOTH
266 { FLUSH_CACHE_BOTH, "FLUSH_CACHE_BOTH" },
267#endif
268#ifdef FLUSH_CACHE_DATA
269 { FLUSH_CACHE_DATA, "FLUSH_CACHE_DATA" },
270#endif
271#ifdef FLUSH_CACHE_INSN
272 { FLUSH_CACHE_INSN, "FLUSH_CACHE_INSN" },
273#endif
274 { 0, NULL },
275};
276
277int
278sys_cacheflush(tcp)
279struct tcb *tcp;
280{
281 if (entering(tcp)) {
282 /* addr */
283 tprintf("%#lx, ", tcp->u_arg[0]);
284 /* scope */
285 printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
286 tprintf(", ");
287 /* flags */
Roland McGrathb2dee132005-06-01 19:02:36 +0000288 printflags(cacheflush_flags, tcp->u_arg[2], "FLUSH_CACHE_???");
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000289 /* len */
290 tprintf(", %lu", tcp->u_arg[3]);
291 }
292 return 0;
293}
294#endif /* M68K */
295
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000296#endif /* LINUX */
297
298#ifdef SUNOS4
299
300#include <sys/reboot.h>
301#define NFSCLIENT
302#define LOFS
303#define RFS
304#define PCFS
305#include <sys/mount.h>
306#include <sys/socket.h>
307#include <nfs/export.h>
308#include <rpc/types.h>
309#include <rpc/auth.h>
310
311/*ARGSUSED*/
312int
313sys_sync(tcp)
314struct tcb *tcp;
315{
316 return 0;
317}
318
Roland McGrathd9f816f2004-09-04 03:39:20 +0000319static const struct xlat bootflags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000320 { RB_AUTOBOOT, "RB_AUTOBOOT" }, /* for system auto-booting itself */
321 { RB_ASKNAME, "RB_ASKNAME" }, /* ask for file name to reboot from */
322 { RB_SINGLE, "RB_SINGLE" }, /* reboot to single user only */
323 { RB_NOSYNC, "RB_NOSYNC" }, /* dont sync before reboot */
324 { RB_HALT, "RB_HALT" }, /* don't reboot, just halt */
325 { RB_INITNAME, "RB_INITNAME" }, /* name given for /etc/init */
326 { RB_NOBOOTRC, "RB_NOBOOTRC" }, /* don't run /etc/rc.boot */
327 { RB_DEBUG, "RB_DEBUG" }, /* being run under debugger */
328 { RB_DUMP, "RB_DUMP" }, /* dump system core */
329 { RB_WRITABLE, "RB_WRITABLE" }, /* mount root read/write */
330 { RB_STRING, "RB_STRING" }, /* pass boot args to prom monitor */
331 { 0, NULL },
332};
333
334int
335sys_reboot(tcp)
336struct tcb *tcp;
337{
338 if (entering(tcp)) {
Roland McGrathb2dee132005-06-01 19:02:36 +0000339 printflags(bootflags, tcp->u_arg[0], "RB_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000340 if (tcp->u_arg[0] & RB_STRING) {
341 printstr(tcp, tcp->u_arg[1], -1);
342 }
343 }
344 return 0;
345}
346
347int
348sys_sysacct(tcp)
349struct tcb *tcp;
350{
351 if (entering(tcp)) {
352 printstr(tcp, tcp->u_arg[0], -1);
353 }
354 return 0;
355}
356
357int
358sys_swapon(tcp)
359struct tcb *tcp;
360{
361 if (entering(tcp)) {
362 printstr(tcp, tcp->u_arg[0], -1);
363 }
364 return 0;
365}
366
367int
368sys_nfs_svc(tcp)
369struct tcb *tcp;
370{
371 if (entering(tcp)) {
372 printsock(tcp, tcp->u_arg[0]);
373 }
374 return 0;
375}
376
Roland McGrathd9f816f2004-09-04 03:39:20 +0000377static const struct xlat mountflags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000378 { M_RDONLY, "M_RDONLY" },
379 { M_NOSUID, "M_NOSUID" },
380 { M_NEWTYPE, "M_NEWTYPE" },
381 { M_GRPID, "M_GRPID" },
382#ifdef M_REMOUNT
383 { M_REMOUNT, "M_REMOUNT" },
384#endif
385#ifdef M_NOSUB
386 { M_NOSUB, "M_NOSUB" },
387#endif
388#ifdef M_MULTI
389 { M_MULTI, "M_MULTI" },
390#endif
391#ifdef M_SYS5
392 { M_SYS5, "M_SYS5" },
393#endif
394 { 0, NULL },
395};
396
Roland McGrathd9f816f2004-09-04 03:39:20 +0000397static const struct xlat nfsflags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000398 { NFSMNT_SOFT, "NFSMNT_SOFT" },
399 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
400 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
401 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
402 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
403 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
404 { NFSMNT_INT, "NFSMNT_INT" },
405 { NFSMNT_NOAC, "NFSMNT_NOAC" },
406 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
407 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
408 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
409 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
410#ifdef NFSMNT_SECURE
411 { NFSMNT_SECURE, "NFSMNT_SECURE" },
412#endif
413#ifdef NFSMNT_NOCTO
414 { NFSMNT_NOCTO, "NFSMNT_NOCTO" },
415#endif
416#ifdef NFSMNT_POSIX
417 { NFSMNT_POSIX, "NFSMNT_POSIX" },
418#endif
419 { 0, NULL },
420};
421
422int
423sys_mount(tcp)
424struct tcb *tcp;
425{
426 char type[4];
427
428 if (entering(tcp)) {
429 if (!(tcp->u_arg[2] & M_NEWTYPE) || umovestr(tcp,
430 tcp->u_arg[0], sizeof type, type) < 0) {
431 tprintf("OLDTYPE:#%lx", tcp->u_arg[0]);
432 } else {
433 tprintf("\"%s\", ", type);
434 }
435 printstr(tcp, tcp->u_arg[1], -1);
436 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000437 printflags(mountflags, tcp->u_arg[2] & ~M_NEWTYPE, "M_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000438 tprintf(", ");
439
440 if (strcmp(type, "4.2") == 0) {
441 struct ufs_args a;
442 if (umove(tcp, tcp->u_arg[3], &a) < 0)
443 return 0;
444 printstr(tcp, (int)a.fspec, -1);
445 } else if (strcmp(type, "lo") == 0) {
446 struct lo_args a;
447 if (umove(tcp, tcp->u_arg[3], &a) < 0)
448 return 0;
449 printstr(tcp, (int)a.fsdir, -1);
450 } else if (strcmp(type, "nfs") == 0) {
451 struct nfs_args a;
452 if (umove(tcp, tcp->u_arg[3], &a) < 0)
453 return 0;
454 tprintf("[");
455 printsock(tcp, (int) a.addr);
456 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000457 printflags(nfsflags, a.flags, "NFSMNT_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000458 tprintf(", ws:%u,rs:%u,to:%u,re:%u,",
459 a.wsize, a.rsize, a.timeo, a.retrans);
460 if (a.flags & NFSMNT_HOSTNAME && a.hostname)
461 printstr(tcp, (int)a.hostname, -1);
462 else
463 tprintf("%#lx", (unsigned long) a.hostname);
464 tprintf(",reg-min:%u,max:%u,dir-min:%u,max:%u,",
465 a.acregmin, a.acregmax, a.acdirmin, a.acdirmax);
466 if ((a.flags & NFSMNT_SECURE) && a.netname)
467 printstr(tcp, (int) a.netname, -1);
468 else
469 tprintf("%#lx", (unsigned long) a.netname);
470 tprintf("]");
471 } else if (strcmp(type, "rfs") == 0) {
472 struct rfs_args a;
473 struct token t;
474 if (umove(tcp, tcp->u_arg[3], &a) < 0)
475 return 0;
476 tprintf("[");
477 printstr(tcp, (int)a.rmtfs, -1);
478 if (umove(tcp, (int)a.token, &t) < 0)
479 return 0;
480 tprintf(", %u, %s]", t.t_id, t.t_uname);
481 } else if (strcmp(type, "pcfs") == 0) {
482 struct pc_args a;
483 if (umove(tcp, tcp->u_arg[3], &a) < 0)
484 return 0;
485 printstr(tcp, (int)a.fspec, -1);
486 }
487 }
488 return 0;
489}
490
491int
492sys_unmount(tcp)
493struct tcb *tcp;
494{
495 if (entering(tcp)) {
496 printstr(tcp, tcp->u_arg[0], -1);
497 }
498 return 0;
499}
500
501int
502sys_umount(tcp)
503struct tcb *tcp;
504{
505 return sys_unmount(tcp);
506}
507
508int
509sys_auditsys(tcp)
510struct tcb *tcp;
511{
512 /* XXX - no information available */
513 return printargs(tcp);
514}
515
Roland McGrathd9f816f2004-09-04 03:39:20 +0000516static const struct xlat ex_auth_flags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000517 { AUTH_UNIX, "AUTH_UNIX" },
518 { AUTH_DES, "AUTH_DES" },
519 { 0, NULL },
520};
521
522int
523sys_exportfs(tcp)
524struct tcb *tcp;
525{
526 struct export e;
527 int i;
528
529 if (entering(tcp)) {
530 printstr(tcp, tcp->u_arg[0], -1);
531 if (umove(tcp, tcp->u_arg[1], &e) < 0) {
532 tprintf("%#lx", tcp->u_arg[1]);
533 return 0;
534 }
535 tprintf("{fl:%u, anon:%u, ", e.ex_flags, e.ex_anon);
536 printxval(ex_auth_flags, e.ex_auth, "AUTH_???");
537 tprintf(", roots:[");
538 if (e.ex_auth == AUTH_UNIX) {
539 for (i=0; i<e.ex_u.exunix.rootaddrs.naddrs; i++) {
540 printsock(tcp,
541 (int)&e.ex_u.exunix.rootaddrs.addrvec[i]);
542 }
543 tprintf("], writers:[");
544 for (i=0; i<e.ex_writeaddrs.naddrs; i++) {
545 printsock(tcp,
546 (int)&e.ex_writeaddrs.addrvec[i]);
547 }
548 tprintf("]");
549 } else {
550 for (i=0; i<e.ex_u.exdes.nnames; i++) {
551 printsock(tcp,
552 (int)&e.ex_u.exdes.rootnames[i]);
553 tprintf(", ");
554 }
555 tprintf("], window:%u", e.ex_u.exdes.window);
556 }
557 tprintf("}");
558 }
559 return 0;
560}
561
Roland McGrathd9f816f2004-09-04 03:39:20 +0000562static const struct xlat sysconflimits[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000563#ifdef _SC_ARG_MAX
564 { _SC_ARG_MAX, "_SC_ARG_MAX" }, /* space for argv & envp */
565#endif
566#ifdef _SC_CHILD_MAX
567 { _SC_CHILD_MAX, "_SC_CHILD_MAX" }, /* maximum children per process??? */
568#endif
569#ifdef _SC_CLK_TCK
570 { _SC_CLK_TCK, "_SC_CLK_TCK" }, /* clock ticks/sec */
571#endif
572#ifdef _SC_NGROUPS_MAX
573 { _SC_NGROUPS_MAX, "_SC_NGROUPS_MAX" }, /* number of groups if multple supp. */
574#endif
575#ifdef _SC_OPEN_MAX
576 { _SC_OPEN_MAX, "_SC_OPEN_MAX" }, /* max open files per process */
577#endif
578#ifdef _SC_JOB_CONTROL
579 { _SC_JOB_CONTROL, "_SC_JOB_CONTROL" }, /* do we have job control */
580#endif
581#ifdef _SC_SAVED_IDS
582 { _SC_SAVED_IDS, "_SC_SAVED_IDS" }, /* do we have saved uid/gids */
583#endif
584#ifdef _SC_VERSION
585 { _SC_VERSION, "_SC_VERSION" }, /* POSIX version supported */
586#endif
587 { 0, NULL },
588};
589
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000590int
591sys_sysconf(tcp)
592struct tcb *tcp;
593{
594 if (entering(tcp)) {
595 printxval(sysconflimits, tcp->u_arg[0], "_SC_???");
596 }
597 return 0;
598}
599
600#endif /* SUNOS4 */
601
602#if defined(SUNOS4) || defined(FREEBSD)
Roland McGrathd9f816f2004-09-04 03:39:20 +0000603static const struct xlat pathconflimits[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000604#ifdef _PC_LINK_MAX
605 { _PC_LINK_MAX, "_PC_LINK_MAX" }, /* max links to file/dir */
606#endif
607#ifdef _PC_MAX_CANON
608 { _PC_MAX_CANON, "_PC_MAX_CANON" }, /* max line length */
609#endif
610#ifdef _PC_MAX_INPUT
611 { _PC_MAX_INPUT, "_PC_MAX_INPUT" }, /* max "packet" to a tty device */
612#endif
613#ifdef _PC_NAME_MAX
614 { _PC_NAME_MAX, "_PC_NAME_MAX" }, /* max pathname component length */
615#endif
616#ifdef _PC_PATH_MAX
617 { _PC_PATH_MAX, "_PC_PATH_MAX" }, /* max pathname length */
618#endif
619#ifdef _PC_PIPE_BUF
620 { _PC_PIPE_BUF, "_PC_PIPE_BUF" }, /* size of a pipe */
621#endif
622#ifdef _PC_CHOWN_RESTRICTED
623 { _PC_CHOWN_RESTRICTED, "_PC_CHOWN_RESTRICTED" }, /* can we give away files */
624#endif
625#ifdef _PC_NO_TRUNC
626 { _PC_NO_TRUNC, "_PC_NO_TRUNC" }, /* trunc or error on >NAME_MAX */
627#endif
628#ifdef _PC_VDISABLE
629 { _PC_VDISABLE, "_PC_VDISABLE" }, /* best char to shut off tty c_cc */
630#endif
631 { 0, NULL },
632};
633
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000634
635int
636sys_pathconf(tcp)
637struct tcb *tcp;
638{
639 if (entering(tcp)) {
640 printstr(tcp, tcp->u_arg[0], -1);
641 tprintf(", ");
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000642 printxval(pathconflimits, tcp->u_arg[1], "_PC_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000643 }
644 return 0;
645}
646
647int
648sys_fpathconf(tcp)
649struct tcb *tcp;
650{
651 if (entering(tcp)) {
652 tprintf("%lu, ", tcp->u_arg[0]);
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000653 printxval(pathconflimits, tcp->u_arg[1], "_PC_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000654 }
655 return 0;
656}
657
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000658#endif /* SUNOS4 || FREEBSD */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000659
660#ifdef SVR4
661
662#ifdef HAVE_SYS_SYSCONFIG_H
663#include <sys/sysconfig.h>
664#endif /* HAVE_SYS_SYSCONFIG_H */
665
666#include <sys/mount.h>
667#include <sys/systeminfo.h>
668#include <sys/utsname.h>
669
Roland McGrathd9f816f2004-09-04 03:39:20 +0000670static const struct xlat sysconfig_options[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000671#ifdef _CONFIG_NGROUPS
672 { _CONFIG_NGROUPS, "_CONFIG_NGROUPS" },
673#endif
674#ifdef _CONFIG_CHILD_MAX
675 { _CONFIG_CHILD_MAX, "_CONFIG_CHILD_MAX" },
676#endif
677#ifdef _CONFIG_OPEN_FILES
678 { _CONFIG_OPEN_FILES, "_CONFIG_OPEN_FILES" },
679#endif
680#ifdef _CONFIG_POSIX_VER
681 { _CONFIG_POSIX_VER, "_CONFIG_POSIX_VER" },
682#endif
683#ifdef _CONFIG_PAGESIZE
684 { _CONFIG_PAGESIZE, "_CONFIG_PAGESIZE" },
685#endif
686#ifdef _CONFIG_CLK_TCK
687 { _CONFIG_CLK_TCK, "_CONFIG_CLK_TCK" },
688#endif
689#ifdef _CONFIG_XOPEN_VER
690 { _CONFIG_XOPEN_VER, "_CONFIG_XOPEN_VER" },
691#endif
692#ifdef _CONFIG_PROF_TCK
693 { _CONFIG_PROF_TCK, "_CONFIG_PROF_TCK" },
694#endif
695#ifdef _CONFIG_NPROC_CONF
696 { _CONFIG_NPROC_CONF, "_CONFIG_NPROC_CONF" },
697#endif
698#ifdef _CONFIG_NPROC_ONLN
699 { _CONFIG_NPROC_ONLN, "_CONFIG_NPROC_ONLN" },
700#endif
701#ifdef _CONFIG_AIO_LISTIO_MAX
702 { _CONFIG_AIO_LISTIO_MAX, "_CONFIG_AIO_LISTIO_MAX" },
703#endif
704#ifdef _CONFIG_AIO_MAX
705 { _CONFIG_AIO_MAX, "_CONFIG_AIO_MAX" },
706#endif
707#ifdef _CONFIG_AIO_PRIO_DELTA_MAX
708 { _CONFIG_AIO_PRIO_DELTA_MAX, "_CONFIG_AIO_PRIO_DELTA_MAX" },
709#endif
710#ifdef _CONFIG_CONFIG_DELAYTIMER_MAX
711 { _CONFIG_DELAYTIMER_MAX, "_CONFIG_DELAYTIMER_MAX" },
712#endif
713#ifdef _CONFIG_MQ_OPEN_MAX
714 { _CONFIG_MQ_OPEN_MAX, "_CONFIG_MQ_OPEN_MAX" },
715#endif
716#ifdef _CONFIG_MQ_PRIO_MAX
717 { _CONFIG_MQ_PRIO_MAX, "_CONFIG_MQ_PRIO_MAX" },
718#endif
719#ifdef _CONFIG_RTSIG_MAX
720 { _CONFIG_RTSIG_MAX, "_CONFIG_RTSIG_MAX" },
721#endif
722#ifdef _CONFIG_SEM_NSEMS_MAX
723 { _CONFIG_SEM_NSEMS_MAX, "_CONFIG_SEM_NSEMS_MAX" },
724#endif
725#ifdef _CONFIG_SEM_VALUE_MAX
726 { _CONFIG_SEM_VALUE_MAX, "_CONFIG_SEM_VALUE_MAX" },
727#endif
728#ifdef _CONFIG_SIGQUEUE_MAX
729 { _CONFIG_SIGQUEUE_MAX, "_CONFIG_SIGQUEUE_MAX" },
730#endif
731#ifdef _CONFIG_SIGRT_MIN
732 { _CONFIG_SIGRT_MIN, "_CONFIG_SIGRT_MIN" },
733#endif
734#ifdef _CONFIG_SIGRT_MAX
735 { _CONFIG_SIGRT_MAX, "_CONFIG_SIGRT_MAX" },
736#endif
737#ifdef _CONFIG_TIMER_MAX
738 { _CONFIG_TIMER_MAX, "_CONFIG_TIMER_MAX" },
739#endif
740#ifdef _CONFIG_CONFIG_PHYS_PAGES
741 { _CONFIG_PHYS_PAGES, "_CONFIG_PHYS_PAGES" },
742#endif
743#ifdef _CONFIG_AVPHYS_PAGES
744 { _CONFIG_AVPHYS_PAGES, "_CONFIG_AVPHYS_PAGES" },
745#endif
746 { 0, NULL },
747};
748
749int
750sys_sysconfig(tcp)
751struct tcb *tcp;
752{
753 if (entering(tcp))
754 printxval(sysconfig_options, tcp->u_arg[0], "_CONFIG_???");
755 return 0;
756}
757
Roland McGrathd9f816f2004-09-04 03:39:20 +0000758static const struct xlat sysinfo_options[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000759 { SI_SYSNAME, "SI_SYSNAME" },
760 { SI_HOSTNAME, "SI_HOSTNAME" },
761 { SI_RELEASE, "SI_RELEASE" },
762 { SI_VERSION, "SI_VERSION" },
763 { SI_MACHINE, "SI_MACHINE" },
764 { SI_ARCHITECTURE, "SI_ARCHITECTURE" },
765 { SI_HW_SERIAL, "SI_HW_SERIAL" },
766 { SI_HW_PROVIDER, "SI_HW_PROVIDER" },
767 { SI_SRPC_DOMAIN, "SI_SRPC_DOMAIN" },
768#ifdef SI_SET_HOSTNAME
769 { SI_SET_HOSTNAME, "SI_SET_HOSTNAME" },
770#endif
771#ifdef SI_SET_SRPC_DOMAIN
772 { SI_SET_SRPC_DOMAIN, "SI_SET_SRPC_DOMAIN" },
773#endif
774#ifdef SI_SET_KERB_REALM
775 { SI_SET_KERB_REALM, "SI_SET_KERB_REALM" },
776#endif
777#ifdef SI_KERB_REALM
778 { SI_KERB_REALM, "SI_KERB_REALM" },
779#endif
780 { 0, NULL },
781};
782
783int
784sys_sysinfo(tcp)
785struct tcb *tcp;
786{
787 if (entering(tcp)) {
788 printxval(sysinfo_options, tcp->u_arg[0], "SI_???");
789 tprintf(", ");
790 }
791 else {
792 /* Technically some calls write values. So what. */
793 if (syserror(tcp))
794 tprintf("%#lx", tcp->u_arg[1]);
795 else
796 printpath(tcp, tcp->u_arg[1]);
797 tprintf(", %lu", tcp->u_arg[2]);
798 }
799 return 0;
800}
801
802#ifdef MIPS
803
804#include <sys/syssgi.h>
805
Roland McGrathd9f816f2004-09-04 03:39:20 +0000806static const struct xlat syssgi_options[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000807 { SGI_SYSID, "SGI_SYSID" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000808#ifdef SGI_RDUBLK
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000809 { SGI_RDUBLK, "SGI_RDUBLK" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000810#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000811 { SGI_TUNE, "SGI_TUNE" },
812 { SGI_IDBG, "SGI_IDBG" },
813 { SGI_INVENT, "SGI_INVENT" },
814 { SGI_RDNAME, "SGI_RDNAME" },
815 { SGI_SETLED, "SGI_SETLED" },
816 { SGI_SETNVRAM, "SGI_SETNVRAM" },
817 { SGI_GETNVRAM, "SGI_GETNVRAM" },
818 { SGI_QUERY_FTIMER, "SGI_QUERY_FTIMER" },
819 { SGI_QUERY_CYCLECNTR, "SGI_QUERY_CYCLECNTR" },
820 { SGI_PROCSZ, "SGI_PROCSZ" },
821 { SGI_SIGACTION, "SGI_SIGACTION" },
822 { SGI_SIGPENDING, "SGI_SIGPENDING" },
823 { SGI_SIGPROCMASK, "SGI_SIGPROCMASK" },
824 { SGI_SIGSUSPEND, "SGI_SIGSUSPEND" },
825 { SGI_SETSID, "SGI_SETSID" },
826 { SGI_SETPGID, "SGI_SETPGID" },
827 { SGI_SYSCONF, "SGI_SYSCONF" },
828 { SGI_WAIT4, "SGI_WAIT4" },
829 { SGI_PATHCONF, "SGI_PATHCONF" },
830 { SGI_READB, "SGI_READB" },
831 { SGI_WRITEB, "SGI_WRITEB" },
832 { SGI_SETGROUPS, "SGI_SETGROUPS" },
833 { SGI_GETGROUPS, "SGI_GETGROUPS" },
834 { SGI_SETTIMEOFDAY, "SGI_SETTIMEOFDAY" },
835 { SGI_SETTIMETRIM, "SGI_SETTIMETRIM" },
836 { SGI_GETTIMETRIM, "SGI_GETTIMETRIM" },
837 { SGI_SPROFIL, "SGI_SPROFIL" },
838 { SGI_RUSAGE, "SGI_RUSAGE" },
839 { SGI_SIGSTACK, "SGI_SIGSTACK" },
840 { SGI_SIGSTATUS, "SGI_SIGSTATUS" },
841 { SGI_NETPROC, "SGI_NETPROC" },
842 { SGI_SIGALTSTACK, "SGI_SIGALTSTACK" },
843 { SGI_BDFLUSHCNT, "SGI_BDFLUSHCNT" },
844 { SGI_SSYNC, "SGI_SSYNC" },
845 { SGI_NFSCNVT, "SGI_NFSCNVT" },
846 { SGI_GETPGID, "SGI_GETPGID" },
847 { SGI_GETSID, "SGI_GETSID" },
848 { SGI_IOPROBE, "SGI_IOPROBE" },
849 { SGI_CONFIG, "SGI_CONFIG" },
850 { SGI_ELFMAP, "SGI_ELFMAP" },
851 { SGI_MCONFIG, "SGI_MCONFIG" },
852 { SGI_GETPLABEL, "SGI_GETPLABEL" },
853 { SGI_SETPLABEL, "SGI_SETPLABEL" },
854 { SGI_GETLABEL, "SGI_GETLABEL" },
855 { SGI_SETLABEL, "SGI_SETLABEL" },
856 { SGI_SATREAD, "SGI_SATREAD" },
857 { SGI_SATWRITE, "SGI_SATWRITE" },
858 { SGI_SATCTL, "SGI_SATCTL" },
859 { SGI_LOADATTR, "SGI_LOADATTR" },
860 { SGI_UNLOADATTR, "SGI_UNLOADATTR" },
861#ifdef SGI_RECVLMSG
862 { SGI_RECVLMSG, "SGI_RECVLMSG" },
863#endif
864 { SGI_PLANGMOUNT, "SGI_PLANGMOUNT" },
865 { SGI_GETPSOACL, "SGI_GETPSOACL" },
866 { SGI_SETPSOACL, "SGI_SETPSOACL" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000867#ifdef SGI_EAG_GET_ATTR
868 { SGI_EAG_GET_ATTR, "SGI_EAG_GET_ATTR" },
869#endif
870#ifdef SGI_EAG_SET_ATTR
871 { SGI_EAG_SET_ATTR, "SGI_EAG_SET_ATTR" },
872#endif
873#ifdef SGI_EAG_GET_PROCATTR
874 { SGI_EAG_GET_PROCATTR, "SGI_EAG_GET_PROCATTR" },
875#endif
876#ifdef SGI_EAG_SET_PROCATTR
877 { SGI_EAG_SET_PROCATTR, "SGI_EAG_SET_PROCATTR" },
878#endif
879#ifdef SGI_FREVOKE
880 { SGI_FREVOKE, "SGI_FREVOKE" },
881#endif
882#ifdef SGI_SBE_GET_INFO
883 { SGI_SBE_GET_INFO, "SGI_SBE_GET_INFO" },
884#endif
885#ifdef SGI_SBE_CLR_INFO
886 { SGI_SBE_CLR_INFO, "SGI_SBE_CLR_INFO" },
887#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000888 { SGI_RMI_FIXECC, "SGI_RMI_FIXECC" },
889 { SGI_R4K_CERRS, "SGI_R4K_CERRS" },
890 { SGI_GET_EVCONF, "SGI_GET_EVCONF" },
891 { SGI_MPCWAROFF, "SGI_MPCWAROFF" },
892 { SGI_SET_AUTOPWRON, "SGI_SET_AUTOPWRON" },
893 { SGI_SPIPE, "SGI_SPIPE" },
894 { SGI_SYMTAB, "SGI_SYMTAB" },
895#ifdef SGI_SET_FPDEBUG
896 { SGI_SET_FPDEBUG, "SGI_SET_FPDEBUG" },
897#endif
Wichert Akkerman8829a551999-06-11 13:18:40 +0000898#ifdef SGI_SET_FP_PRECISE
899 { SGI_SET_FP_PRECISE, "SGI_SET_FP_PRECISE" },
900#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000901 { SGI_TOSSTSAVE, "SGI_TOSSTSAVE" },
902 { SGI_FDHI, "SGI_FDHI" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000903#ifdef SGI_SET_CONFIG_SMM
904 { SGI_SET_CONFIG_SMM, "SGI_SET_CONFIG_SMM" },
905#endif
906#ifdef SGI_SET_FP_PRESERVE
907 { SGI_SET_FP_PRESERVE, "SGI_SET_FP_PRESERVE" },
908#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000909 { SGI_MINRSS, "SGI_MINRSS" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000910#ifdef SGI_GRIO
911 { SGI_GRIO, "SGI_GRIO" },
912#endif
913#ifdef SGI_XLV_SET_TAB
914 { SGI_XLV_SET_TAB, "SGI_XLV_SET_TAB" },
915#endif
916#ifdef SGI_XLV_GET_TAB
917 { SGI_XLV_GET_TAB, "SGI_XLV_GET_TAB" },
918#endif
919#ifdef SGI_GET_FP_PRECISE
920 { SGI_GET_FP_PRECISE, "SGI_GET_FP_PRECISE" },
921#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000922#ifdef SGI_GET_CONFIG_SMM
Wichert Akkerman8829a551999-06-11 13:18:40 +0000923 { SGI_GET_CONFIG_SMM, "SGI_GET_CONFIG_SMM" },
924#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000925#ifdef SGI_FP_IMPRECISE_SUPP
Wichert Akkerman8829a551999-06-11 13:18:40 +0000926 { SGI_FP_IMPRECISE_SUPP,"SGI_FP_IMPRECISE_SUPP" },
927#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000928#ifdef SGI_CONFIG_NSMM_SUPP
Wichert Akkerman8829a551999-06-11 13:18:40 +0000929 { SGI_CONFIG_NSMM_SUPP, "SGI_CONFIG_NSMM_SUPP" },
930#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000931#ifdef SGI_RT_TSTAMP_CREATE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000932 { SGI_RT_TSTAMP_CREATE, "SGI_RT_TSTAMP_CREATE" },
933#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000934#ifdef SGI_RT_TSTAMP_DELETE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000935 { SGI_RT_TSTAMP_DELETE, "SGI_RT_TSTAMP_DELETE" },
936#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000937#ifdef SGI_RT_TSTAMP_START
Wichert Akkerman8829a551999-06-11 13:18:40 +0000938 { SGI_RT_TSTAMP_START, "SGI_RT_TSTAMP_START" },
939#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000940#ifdef SGI_RT_TSTAMP_STOP
Wichert Akkerman8829a551999-06-11 13:18:40 +0000941 { SGI_RT_TSTAMP_STOP, "SGI_RT_TSTAMP_STOP" },
942#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000943#ifdef SGI_RT_TSTAMP_ADDR
Wichert Akkerman8829a551999-06-11 13:18:40 +0000944 { SGI_RT_TSTAMP_ADDR, "SGI_RT_TSTAMP_ADDR" },
945#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000946#ifdef SGI_RT_TSTAMP_MASK
Wichert Akkerman8829a551999-06-11 13:18:40 +0000947 { SGI_RT_TSTAMP_MASK, "SGI_RT_TSTAMP_MASK" },
948#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000949#ifdef SGI_RT_TSTAMP_EOB_MODE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000950 { SGI_RT_TSTAMP_EOB_MODE,"SGI_RT_TSTAMP_EOB_MODE"},
951#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000952#ifdef SGI_USE_FP_BCOPY
Wichert Akkerman8829a551999-06-11 13:18:40 +0000953 { SGI_USE_FP_BCOPY, "SGI_USE_FP_BCOPY" },
954#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000955#ifdef SGI_GET_UST
Wichert Akkerman8829a551999-06-11 13:18:40 +0000956 { SGI_GET_UST, "SGI_GET_UST" },
957#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000958#ifdef SGI_SPECULATIVE_EXEC
Wichert Akkerman8829a551999-06-11 13:18:40 +0000959 { SGI_SPECULATIVE_EXEC, "SGI_SPECULATIVE_EXEC" },
960#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000961#ifdef SGI_XLV_NEXT_RQST
Wichert Akkerman8829a551999-06-11 13:18:40 +0000962 { SGI_XLV_NEXT_RQST, "SGI_XLV_NEXT_RQST" },
963#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000964#ifdef SGI_XLV_ATTR_CURSOR
Wichert Akkerman8829a551999-06-11 13:18:40 +0000965 { SGI_XLV_ATTR_CURSOR, "SGI_XLV_ATTR_CURSOR" },
966#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000967#ifdef SGI_XLV_ATTR_GET
Wichert Akkerman8829a551999-06-11 13:18:40 +0000968 { SGI_XLV_ATTR_GET, "SGI_XLV_ATTR_GET" },
969#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000970#ifdef SGI_XLV_ATTR_SET
Wichert Akkerman8829a551999-06-11 13:18:40 +0000971 { SGI_XLV_ATTR_SET, "SGI_XLV_ATTR_SET" },
972#endif
973#ifdef SGI_BTOOLSIZE
974 { SGI_BTOOLSIZE, "SGI_BTOOLSIZE" },
975#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000976#ifdef SGI_BTOOLGET
Wichert Akkerman8829a551999-06-11 13:18:40 +0000977 { SGI_BTOOLGET, "SGI_BTOOLGET" },
978#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000979#ifdef SGI_BTOOLREINIT
Wichert Akkerman8829a551999-06-11 13:18:40 +0000980 { SGI_BTOOLREINIT, "SGI_BTOOLREINIT" },
981#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000982#ifdef SGI_CREATE_UUID
Wichert Akkerman8829a551999-06-11 13:18:40 +0000983 { SGI_CREATE_UUID, "SGI_CREATE_UUID" },
984#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000985#ifdef SGI_NOFPE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000986 { SGI_NOFPE, "SGI_NOFPE" },
987#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000988#ifdef SGI_OLD_SOFTFP
Wichert Akkerman8829a551999-06-11 13:18:40 +0000989 { SGI_OLD_SOFTFP, "SGI_OLD_SOFTFP" },
990#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000991#ifdef SGI_FS_INUMBERS
Wichert Akkerman8829a551999-06-11 13:18:40 +0000992 { SGI_FS_INUMBERS, "SGI_FS_INUMBERS" },
993#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000994#ifdef SGI_FS_BULKSTAT
Wichert Akkerman8829a551999-06-11 13:18:40 +0000995 { SGI_FS_BULKSTAT, "SGI_FS_BULKSTAT" },
996#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000997#ifdef SGI_RT_TSTAMP_WAIT
Wichert Akkerman8829a551999-06-11 13:18:40 +0000998 { SGI_RT_TSTAMP_WAIT, "SGI_RT_TSTAMP_WAIT" },
999#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001000#ifdef SGI_RT_TSTAMP_UPDATE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001001 { SGI_RT_TSTAMP_UPDATE, "SGI_RT_TSTAMP_UPDATE" },
1002#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001003#ifdef SGI_PATH_TO_HANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001004 { SGI_PATH_TO_HANDLE, "SGI_PATH_TO_HANDLE" },
1005#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001006#ifdef SGI_PATH_TO_FSHANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001007 { SGI_PATH_TO_FSHANDLE, "SGI_PATH_TO_FSHANDLE" },
1008#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001009#ifdef SGI_FD_TO_HANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001010 { SGI_FD_TO_HANDLE, "SGI_FD_TO_HANDLE" },
1011#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001012#ifdef SGI_OPEN_BY_HANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001013 { SGI_OPEN_BY_HANDLE, "SGI_OPEN_BY_HANDLE" },
1014#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001015#ifdef SGI_READLINK_BY_HANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001016 { SGI_READLINK_BY_HANDLE,"SGI_READLINK_BY_HANDLE"},
1017#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001018#ifdef SGI_READ_DANGID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001019 { SGI_READ_DANGID, "SGI_READ_DANGID" },
1020#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001021#ifdef SGI_CONST
Wichert Akkerman8829a551999-06-11 13:18:40 +00001022 { SGI_CONST, "SGI_CONST" },
1023#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001024#ifdef SGI_XFS_FSOPERATIONS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001025 { SGI_XFS_FSOPERATIONS, "SGI_XFS_FSOPERATIONS" },
1026#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001027#ifdef SGI_SETASH
Wichert Akkerman8829a551999-06-11 13:18:40 +00001028 { SGI_SETASH, "SGI_SETASH" },
1029#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001030#ifdef SGI_GETASH
Wichert Akkerman8829a551999-06-11 13:18:40 +00001031 { SGI_GETASH, "SGI_GETASH" },
1032#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001033#ifdef SGI_SETPRID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001034 { SGI_SETPRID, "SGI_SETPRID" },
1035#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001036#ifdef SGI_GETPRID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001037 { SGI_GETPRID, "SGI_GETPRID" },
1038#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001039#ifdef SGI_SETSPINFO
Wichert Akkerman8829a551999-06-11 13:18:40 +00001040 { SGI_SETSPINFO, "SGI_SETSPINFO" },
1041#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001042#ifdef SGI_GETSPINFO
Wichert Akkerman8829a551999-06-11 13:18:40 +00001043 { SGI_GETSPINFO, "SGI_GETSPINFO" },
1044#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001045#ifdef SGI_SHAREII
Wichert Akkerman8829a551999-06-11 13:18:40 +00001046 { SGI_SHAREII, "SGI_SHAREII" },
1047#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001048#ifdef SGI_NEWARRAYSESS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001049 { SGI_NEWARRAYSESS, "SGI_NEWARRAYSESS" },
1050#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001051#ifdef SGI_GETDFLTPRID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001052 { SGI_GETDFLTPRID, "SGI_GETDFLTPRID" },
1053#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001054#ifdef SGI_SET_DISMISSED_EXC_CNT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001055 { SGI_SET_DISMISSED_EXC_CNT,"SGI_SET_DISMISSED_EXC_CNT" },
1056#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001057#ifdef SGI_GET_DISMISSED_EXC_CNT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001058 { SGI_GET_DISMISSED_EXC_CNT,"SGI_GET_DISMISSED_EXC_CNT" },
1059#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001060#ifdef SGI_CYCLECNTR_SIZE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001061 { SGI_CYCLECNTR_SIZE, "SGI_CYCLECNTR_SIZE" },
1062#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001063#ifdef SGI_QUERY_FASTTIMER
Wichert Akkerman8829a551999-06-11 13:18:40 +00001064 { SGI_QUERY_FASTTIMER, "SGI_QUERY_FASTTIMER" },
1065#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001066#ifdef SGI_PIDSINASH
Wichert Akkerman8829a551999-06-11 13:18:40 +00001067 { SGI_PIDSINASH, "SGI_PIDSINASH" },
1068#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001069#ifdef SGI_ULI
Wichert Akkerman8829a551999-06-11 13:18:40 +00001070 { SGI_ULI, "SGI_ULI" },
1071#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001072#ifdef SGI_LPG_SHMGET
Wichert Akkerman8829a551999-06-11 13:18:40 +00001073 { SGI_LPG_SHMGET, "SGI_LPG_SHMGET" },
1074#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001075#ifdef SGI_LPG_MAP
Wichert Akkerman8829a551999-06-11 13:18:40 +00001076 { SGI_LPG_MAP, "SGI_LPG_MAP" },
1077#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001078#ifdef SGI_CACHEFS_SYS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001079 { SGI_CACHEFS_SYS, "SGI_CACHEFS_SYS" },
1080#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001081#ifdef SGI_NFSNOTIFY
Wichert Akkerman8829a551999-06-11 13:18:40 +00001082 { SGI_NFSNOTIFY, "SGI_NFSNOTIFY" },
1083#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001084#ifdef SGI_LOCKDSYS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001085 { SGI_LOCKDSYS, "SGI_LOCKDSYS" },
1086#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001087#ifdef SGI_EVENTCTR
Wichert Akkerman8829a551999-06-11 13:18:40 +00001088 { SGI_EVENTCTR, "SGI_EVENTCTR" },
1089#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001090#ifdef SGI_GETPRUSAGE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001091 { SGI_GETPRUSAGE, "SGI_GETPRUSAGE" },
1092#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001093#ifdef SGI_PROCMASK_LOCATION
Wichert Akkerman8829a551999-06-11 13:18:40 +00001094 { SGI_PROCMASK_LOCATION,"SGI_PROCMASK_LOCATION" },
1095#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001096#ifdef SGI_UNUSED
Wichert Akkerman8829a551999-06-11 13:18:40 +00001097 { SGI_UNUSED, "SGI_UNUSED" },
1098#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001099#ifdef SGI_CKPT_SYS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001100 { SGI_CKPT_SYS, "SGI_CKPT_SYS" },
1101#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001102#ifdef SGI_CKPT_SYS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001103 { SGI_CKPT_SYS, "SGI_CKPT_SYS" },
1104#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001105#ifdef SGI_GETGRPPID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001106 { SGI_GETGRPPID, "SGI_GETGRPPID" },
1107#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001108#ifdef SGI_GETSESPID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001109 { SGI_GETSESPID, "SGI_GETSESPID" },
1110#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001111#ifdef SGI_ENUMASHS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001112 { SGI_ENUMASHS, "SGI_ENUMASHS" },
1113#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001114#ifdef SGI_SETASMACHID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001115 { SGI_SETASMACHID, "SGI_SETASMACHID" },
1116#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001117#ifdef SGI_GETASMACHID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001118 { SGI_GETASMACHID, "SGI_GETASMACHID" },
1119#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001120#ifdef SGI_GETARSESS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001121 { SGI_GETARSESS, "SGI_GETARSESS" },
1122#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001123#ifdef SGI_JOINARRAYSESS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001124 { SGI_JOINARRAYSESS, "SGI_JOINARRAYSESS" },
1125#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001126#ifdef SGI_SPROC_KILL
Wichert Akkerman8829a551999-06-11 13:18:40 +00001127 { SGI_SPROC_KILL, "SGI_SPROC_KILL" },
1128#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001129#ifdef SGI_DBA_CONFIG
Wichert Akkerman8829a551999-06-11 13:18:40 +00001130 { SGI_DBA_CONFIG, "SGI_DBA_CONFIG" },
1131#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001132#ifdef SGI_RELEASE_NAME
Wichert Akkerman8829a551999-06-11 13:18:40 +00001133 { SGI_RELEASE_NAME, "SGI_RELEASE_NAME" },
1134#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001135#ifdef SGI_SYNCH_CACHE_HANDLER
Wichert Akkerman8829a551999-06-11 13:18:40 +00001136 { SGI_SYNCH_CACHE_HANDLER,"SGI_SYNCH_CACHE_HANDLER"},
1137#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001138#ifdef SGI_SWASH_INIT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001139 { SGI_SWASH_INIT, "SGI_SWASH_INIT" },
1140#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001141#ifdef SGI_NUMA_MIGR_PAGE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001142 { SGI_NUMA_MIGR_PAGE, "SGI_NUMA_MIGR_PAGE" },
1143#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001144#ifdef SGI_NUMA_MIGR_PAGE_ALT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001145 { SGI_NUMA_MIGR_PAGE_ALT,"SGI_NUMA_MIGR_PAGE_ALT"},
1146#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001147#ifdef SGI_KAIO_USERINIT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001148 { SGI_KAIO_USERINIT, "SGI_KAIO_USERINIT" },
1149#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001150#ifdef SGI_KAIO_READ
Wichert Akkerman8829a551999-06-11 13:18:40 +00001151 { SGI_KAIO_READ, "SGI_KAIO_READ" },
1152#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001153#ifdef SGI_KAIO_WRITE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001154 { SGI_KAIO_WRITE, "SGI_KAIO_WRITE" },
1155#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001156#ifdef SGI_KAIO_SUSPEND
Wichert Akkerman8829a551999-06-11 13:18:40 +00001157 { SGI_KAIO_SUSPEND, "SGI_KAIO_SUSPEND" },
1158#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001159#ifdef SGI_KAIO_STATS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001160 { SGI_KAIO_STATS, "SGI_KAIO_STATS" },
1161#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001162#ifdef SGI_INITIAL_PT_SPROC
Wichert Akkerman8829a551999-06-11 13:18:40 +00001163 { SGI_INITIAL_PT_SPROC, "SGI_INITIAL_PT_SPROC" },
1164#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001165 { 0, NULL },
1166};
1167
1168int
1169sys_syssgi(tcp)
1170struct tcb *tcp;
1171{
1172 int i;
1173
1174 if (entering(tcp)) {
1175 printxval(syssgi_options, tcp->u_arg[0], "SGI_???");
1176 switch (tcp->u_arg[0]) {
1177 default:
1178 for (i = 1; i < tcp->u_nargs; i++)
1179 tprintf(", %#lx", tcp->u_arg[i]);
1180 break;
1181 }
1182 }
1183 return 0;
1184}
1185
1186#include <sys/types.h>
1187#include <rpc/rpc.h>
1188struct cred;
1189struct uio;
1190#include <sys/fsid.h>
1191#include <sys/vnode.h>
1192#include <sys/fs/nfs.h>
1193#include <sys/fs/nfs_clnt.h>
1194
Roland McGrathd9f816f2004-09-04 03:39:20 +00001195static const struct xlat mount_flags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001196 { MS_RDONLY, "MS_RDONLY" },
1197 { MS_FSS, "MS_FSS" },
1198 { MS_DATA, "MS_DATA" },
1199 { MS_NOSUID, "MS_NOSUID" },
1200 { MS_REMOUNT, "MS_REMOUNT" },
1201 { MS_NOTRUNC, "MS_NOTRUNC" },
1202 { MS_GRPID, "MS_GRPID" },
1203 { MS_NODEV, "MS_NODEV" },
1204 { MS_BEFORE, "MS_BEFORE" },
1205 { MS_AFTER, "MS_AFTER" },
1206 { 0, NULL },
1207};
1208
Roland McGrathd9f816f2004-09-04 03:39:20 +00001209static const struct xlat nfs_flags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001210 { NFSMNT_SOFT, "NFSMNT_SOFT" },
1211 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
1212 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
1213 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
1214 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
1215 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001216#ifdef NFSMNT_NOINT /* IRIX 6 */
1217 { NFSMNT_NOINT, "NFSMNT_NOINT" },
1218#endif
1219#ifdef NFSMNT_INT /* IRIX 5 */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001220 { NFSMNT_INT, "NFSMNT_INT" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001221#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001222 { NFSMNT_NOAC, "NFSMNT_NOAC" },
1223 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
1224 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
1225 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
1226 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
1227 { NFSMNT_PRIVATE, "NFSMNT_PRIVATE" },
1228 { NFSMNT_SYMTTL, "NFSMNT_SYMTTL" },
1229 { NFSMNT_LOOPBACK, "NFSMNT_LOOPBACK" },
1230 { NFSMNT_BASETYPE, "NFSMNT_BASETYPE" },
1231 { NFSMNT_NAMEMAX, "NFSMNT_NAMEMAX" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001232#ifdef NFSMNT_SHORTUID /* IRIX 6 */
1233 { NFSMNT_SHORTUID, "NFSMNT_SHORTUID" },
1234#endif
1235#ifdef NFSMNT_ASYNCNLM /* IRIX 6 */
1236 { NFSMNT_ASYNCNLM, "NFSMNT_ASYNCNLM" },
1237#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001238 { 0, NULL },
1239};
1240
1241int
1242sys_mount(tcp)
1243struct tcb *tcp;
1244{
1245 if (entering(tcp)) {
1246 printpath(tcp, tcp->u_arg[0]);
1247 tprintf(", ");
1248 printpath(tcp, tcp->u_arg[1]);
1249 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001250 printflags(mount_flags, tcp->u_arg[2], "MS_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001251 if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
1252 tprintf(", ");
1253 tprintf("%ld", tcp->u_arg[3]);
1254 }
1255 if (tcp->u_arg[2] & MS_DATA) {
1256 int nfs_type = sysfs(GETFSIND, FSID_NFS);
1257
1258 tprintf(", ");
1259 if (tcp->u_arg[3] == nfs_type) {
1260 struct nfs_args args;
1261 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1262 tprintf("%#lx", tcp->u_arg[4]);
1263 else {
1264 tprintf("addr=");
1265 printsock(tcp, (int) args.addr);
1266 tprintf(", flags=");
Roland McGrathb2dee132005-06-01 19:02:36 +00001267 printflags(nfs_flags, args.flags, "NFSMNT_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001268 tprintf(", hostname=");
1269 printstr(tcp, (int) args.hostname, -1);
1270 tprintf(", ...}");
1271 }
1272 }
1273 else
1274 tprintf("%#lx", tcp->u_arg[4]);
1275 tprintf(", %ld", tcp->u_arg[5]);
1276 }
1277 }
1278 return 0;
1279}
1280
1281#else /* !MIPS */
1282
Wichert Akkerman3377df71999-11-26 13:14:41 +00001283#if UNIXWARE
1284
1285#include <sys/types.h>
1286#include <sys/fstyp.h>
1287#include <sys/mount.h>
1288#include <sys/xti.h>
1289
1290#define NFSCLIENT 1
1291#include <nfs/mount.h>
1292
1293#include <sys/fs/vx_ioctl.h>
1294
Roland McGrathd9f816f2004-09-04 03:39:20 +00001295static const struct xlat mount_flags[] = {
Wichert Akkerman3377df71999-11-26 13:14:41 +00001296 { MS_RDONLY, "MS_RDONLY" },
1297 { MS_FSS, "MS_FSS" },
1298 { MS_DATA, "MS_DATA" },
1299 { MS_HADBAD, "MS_HADBAD" },
1300 { MS_NOSUID, "MS_NOSUID" },
1301 { MS_REMOUNT, "MS_REMOUNT" },
1302 { MS_NOTRUNC, "MS_NOTRUNC" },
1303 { MS_SOFTMNT, "MS_SOFTMNT" },
1304 { MS_SYSSPACE, "MS_SYSSPACE" },
1305 { 0, NULL },
1306};
1307
1308#ifdef VX_MS_MASK
Roland McGrathd9f816f2004-09-04 03:39:20 +00001309static const struct xlat vxfs_flags[] = {
Wichert Akkerman3377df71999-11-26 13:14:41 +00001310 { VX_MS_NOLOG, "VX_MS_NOLOG" },
1311 { VX_MS_BLKCLEAR, "VX_MS_BLKCLEAR" },
1312 { VX_MS_SNAPSHOT, "VX_MS_SNAPSHOT" },
1313 { VX_MS_NODATAINLOG, "VX_MS_NODATAINLOG" },
1314 { VX_MS_DELAYLOG, "VX_MS_DELAYLOG" },
1315 { VX_MS_TMPLOG, "VX_MS_TMPLOG" },
1316 { VX_MS_FILESET, "VX_MS_FILESET" },
1317
1318 { VX_MS_CACHE_DIRECT, "VX_MS_CACHE_DIRECT" },
1319 { VX_MS_CACHE_DSYNC, "VX_MS_CACHE_DSYNC" },
1320 { VX_MS_CACHE_CLOSESYNC,"VX_MS_CACHE_CLOSESYNC" },
1321 { VX_MS_CACHE_TMPCACHE, "VX_MS_CACHE_TMPCACHE" },
1322
1323 { VX_MS_OSYNC_DIRECT, "VX_MS_OSYNC_DIRECT" },
1324 { VX_MS_OSYNC_DSYNC, "VX_MS_OSYNC_DSYNC" },
1325 { VX_MS_OSYNC_CLOSESYNC,"VX_MS_OSYNC_CLOSESYNC" },
1326 { VX_MS_OSYNC_DELAY, "VX_MS_OSYNC_DELAY" },
1327 { 0, NULL, },
1328};
1329#endif
1330
Roland McGrathd9f816f2004-09-04 03:39:20 +00001331static const struct xlat nfs_flags[] = {
Wichert Akkerman3377df71999-11-26 13:14:41 +00001332 { NFSMNT_SOFT, "NFSMNT_SOFT" },
1333 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
1334 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
1335 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
1336 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
1337 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
1338 { NFSMNT_INT, "NFSMNT_INT" },
1339 { NFSMNT_NOAC, "NFSMNT_NOAC" },
1340 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
1341 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
1342 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
1343 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
1344 { NFSMNT_SECURE, "NFSMNT_SECURE" },
1345 { NFSMNT_NOCTO, "NFSMNT_NOCTO" },
1346 { NFSMNT_GRPID, "NFSMNT_GRPID" },
1347 { NFSMNT_RPCTIMESYNC, "NFSMNT_RPCTIMESYNC" },
1348 { NFSMNT_LWPSMAX, "NFSMNT_LWPSMAX" },
1349 { 0, NULL },
1350};
1351
1352int
1353sys_mount(tcp)
1354struct tcb *tcp;
1355{
1356 if (entering(tcp)) {
1357 char fstyp [FSTYPSZ];
1358 printpath(tcp, tcp->u_arg[0]);
1359 tprintf(", ");
1360 printpath(tcp, tcp->u_arg[1]);
1361 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001362 printflags(mount_flags, tcp->u_arg[2], "MS_???");
Wichert Akkerman3377df71999-11-26 13:14:41 +00001363 /* The doc sez that the file system type is given as a
1364 fsindex, and we should use sysfs to work out the name.
1365 This appears to be untrue for UW. Maybe it's untrue
1366 for all SVR4's? */
1367 if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
1368 if (umovestr(tcp, tcp->u_arg[3], FSTYPSZ, fstyp) < 0) {
1369 *fstyp = 0;
1370 tprintf(", %ld", tcp->u_arg[3]);
1371 }
1372 else
1373 tprintf(", \"%s\"", fstyp);
1374 }
1375 if (tcp->u_arg[2] & MS_DATA) {
1376 tprintf(", ");
1377#ifdef VX_MS_MASK
1378 /* On UW7 they don't give us the defines and structs
1379 we need to see what is going on. Bummer. */
1380 if (strcmp (fstyp, "vxfs") == 0) {
1381 struct vx_mountargs5 args;
1382 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1383 tprintf("%#lx", tcp->u_arg[4]);
1384 else {
1385 tprintf("{ flags=");
Roland McGrathb2dee132005-06-01 19:02:36 +00001386 printflags(vxfs_flags, args.mflags, "VX_MS_???");
Wichert Akkerman3377df71999-11-26 13:14:41 +00001387 if (args.mflags & VX_MS_SNAPSHOT) {
1388 tprintf (", snapof=");
1389 printstr (tcp,
Roland McGrathced50da2004-08-31 06:48:46 +00001390 (long) args.primaryspec,
Wichert Akkerman3377df71999-11-26 13:14:41 +00001391 -1);
1392 if (args.snapsize > 0)
1393 tprintf (", snapsize=%ld", args.snapsize);
1394 }
1395 tprintf(" }");
1396 }
1397 }
1398 else
1399#endif
1400 if (strcmp (fstyp, "specfs") == 0) {
1401 tprintf ("dev=");
1402 printstr (tcp, tcp->u_arg[4], -1);
1403 }
1404 else
1405 if (strcmp (fstyp, "nfs") == 0) {
1406 struct nfs_args args;
1407 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1408 tprintf("%#lx", tcp->u_arg[4]);
1409 else {
1410 struct netbuf addr;
1411 tprintf("{ addr=");
1412 if (umove (tcp, (int) args.addr, &addr) < 0) {
1413 tprintf ("%#lx", (long) args.addr);
1414 }
1415 else {
1416 printsock(tcp, (int) addr.buf, addr.len);
1417 }
1418 tprintf(", flags=");
Roland McGrathb2dee132005-06-01 19:02:36 +00001419 printflags(nfs_flags, args.flags, "NFSMNT_???");
Wichert Akkerman3377df71999-11-26 13:14:41 +00001420 tprintf(", hostname=");
1421 printstr(tcp, (int) args.hostname, -1);
1422 tprintf(", ...}");
1423 }
1424 }
1425 else
1426 tprintf("%#lx", tcp->u_arg[4]);
1427 tprintf(", %ld", tcp->u_arg[5]);
1428 }
1429 }
1430 return 0;
1431}
1432
1433#else /* !UNIXWARE */
1434
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001435int
1436sys_mount(tcp)
1437struct tcb *tcp;
1438{
1439 if (entering(tcp)) {
1440 printpath(tcp, tcp->u_arg[0]);
1441 tprintf(", ");
1442 printpath(tcp, tcp->u_arg[1]);
1443 tprintf(", ...");
1444 }
1445 return 0;
1446}
Wichert Akkermanea78f0f1999-11-29 15:34:02 +00001447#endif /* !UNIXWARE */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001448
1449#endif /* !MIPS */
1450
1451#endif /* SVR4 */
1452
Nate Sammons8d5860c1999-07-03 18:53:05 +00001453#ifdef SYS_capget
Wichert Akkermanc7926982000-04-10 22:22:31 +00001454
Roland McGrathd9f816f2004-09-04 03:39:20 +00001455static const struct xlat capabilities[] = {
Wichert Akkermanc7926982000-04-10 22:22:31 +00001456 { 1<<CAP_CHOWN, "CAP_CHOWN" },
1457 { 1<<CAP_DAC_OVERRIDE, "CAP_DAC_OVERRIDE"},
1458 { 1<<CAP_DAC_READ_SEARCH,"CAP_DAC_READ_SEARCH"},
1459 { 1<<CAP_FOWNER, "CAP_FOWNER" },
1460 { 1<<CAP_FSETID, "CAP_FSETID" },
1461 { 1<<CAP_KILL, "CAP_KILL" },
1462 { 1<<CAP_SETGID, "CAP_SETGID" },
1463 { 1<<CAP_SETUID, "CAP_SETUID" },
1464 { 1<<CAP_SETPCAP, "CAP_SETPCAP" },
1465 { 1<<CAP_LINUX_IMMUTABLE,"CAP_LINUX_IMMUTABLE"},
1466 { 1<<CAP_NET_BIND_SERVICE,"CAP_NET_BIND_SERVICE"},
1467 { 1<<CAP_NET_BROADCAST, "CAP_NET_BROADCAST"},
1468 { 1<<CAP_NET_ADMIN, "CAP_NET_ADMIN" },
1469 { 1<<CAP_NET_RAW, "CAP_NET_RAW" },
1470 { 1<<CAP_IPC_LOCK, "CAP_IPC_LOCK" },
1471 { 1<<CAP_IPC_OWNER, "CAP_IPC_OWNER" },
1472 { 1<<CAP_SYS_MODULE, "CAP_SYS_MODULE"},
1473 { 1<<CAP_SYS_RAWIO, "CAP_SYS_RAWIO" },
1474 { 1<<CAP_SYS_CHROOT, "CAP_SYS_CHROOT"},
1475 { 1<<CAP_SYS_PTRACE, "CAP_SYS_PTRACE"},
1476 { 1<<CAP_SYS_PACCT, "CAP_SYS_PACCT" },
1477 { 1<<CAP_SYS_ADMIN, "CAP_SYS_ADMIN" },
1478 { 1<<CAP_SYS_BOOT, "CAP_SYS_BOOT" },
1479 { 1<<CAP_SYS_NICE, "CAP_SYS_NICE" },
1480 { 1<<CAP_SYS_RESOURCE, "CAP_SYS_RESOURCE"},
1481 { 1<<CAP_SYS_TIME, "CAP_SYS_TIME" },
1482 { 1<<CAP_SYS_TTY_CONFIG,"CAP_SYS_TTY_CONFIG"},
1483 { 0, NULL },
1484};
1485
1486
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001487int
1488sys_capget(tcp)
1489struct tcb *tcp;
1490{
Wichert Akkermanc7926982000-04-10 22:22:31 +00001491 static cap_user_header_t arg0 = NULL;
1492 static cap_user_data_t arg1 = NULL;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001493
1494 if(!entering(tcp)) {
Wichert Akkermanc7926982000-04-10 22:22:31 +00001495 if (!arg0) {
1496 if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001497 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001498 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001499 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001500 }
1501 }
1502 if (!arg1) {
1503 if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001504 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001505 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001506 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001507 }
1508 }
1509
1510 if (!tcp->u_arg[0])
1511 tprintf("NULL");
1512 else if (!verbose(tcp))
1513 tprintf("%#lx", tcp->u_arg[0]);
1514 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
1515 tprintf("???");
1516 else {
1517 tprintf("%#x, %d", arg0->version, arg0->pid);
1518 }
1519 tprintf(", ");
1520 if (!tcp->u_arg[1])
1521 tprintf("NULL");
1522 else if (!verbose(tcp))
1523 tprintf("%#lx", tcp->u_arg[1]);
1524 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
1525 tprintf("???");
1526 else {
1527 tprintf("{");
Roland McGrathb2dee132005-06-01 19:02:36 +00001528 printflags(capabilities, arg1->effective, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001529 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001530 printflags(capabilities, arg1->permitted, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001531 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001532 printflags(capabilities, arg1->inheritable, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001533 tprintf("}");
Roland McGrathced50da2004-08-31 06:48:46 +00001534 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001535 }
1536 return 0;
1537}
1538
1539int
1540sys_capset(tcp)
1541struct tcb *tcp;
1542{
Wichert Akkermanc7926982000-04-10 22:22:31 +00001543 static cap_user_header_t arg0 = NULL;
1544 static cap_user_data_t arg1 = NULL;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001545
Wichert Akkermanc7926982000-04-10 22:22:31 +00001546 if(entering(tcp)) {
1547 if (!arg0) {
1548 if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001549 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001550 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001551 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001552 }
1553 }
1554 if (!arg1) {
1555 if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001556 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001557 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001558 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001559 }
1560 }
1561
1562 if (!tcp->u_arg[0])
1563 tprintf("NULL");
1564 else if (!verbose(tcp))
1565 tprintf("%#lx", tcp->u_arg[0]);
1566 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
1567 tprintf("???");
1568 else {
1569 tprintf("%#x, %d", arg0->version, arg0->pid);
1570 }
1571 tprintf(", ");
1572 if (!tcp->u_arg[1])
1573 tprintf("NULL");
1574 else if (!verbose(tcp))
1575 tprintf("%#lx", tcp->u_arg[1]);
1576 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
1577 tprintf("???");
1578 else {
1579 tprintf("{");
Roland McGrathb2dee132005-06-01 19:02:36 +00001580 printflags(capabilities, arg1->effective, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001581 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001582 printflags(capabilities, arg1->permitted, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001583 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001584 printflags(capabilities, arg1->inheritable, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001585 tprintf("}");
Roland McGrathced50da2004-08-31 06:48:46 +00001586 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001587 }
1588 return 0;
1589}
1590
1591#else
1592
1593int sys_capget(tcp)
1594struct tcb *tcp;
1595{
1596 return printargs(tcp);
1597}
1598
1599int sys_capset(tcp)
1600struct tcb *tcp;
1601{
1602 return printargs(tcp);
1603}
1604
1605#endif
1606
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001607#ifdef LINUX
Dmitry V. Levin35a55782006-12-04 13:48:10 +00001608/* Linux 2.6.18+ headers removed CTL_PROC enum. */
1609# define CTL_PROC 4
Roland McGrath5eb1aa52007-01-11 22:48:39 +00001610# define CTL_CPU 10 /* older headers lack */
Roland McGrathd9f816f2004-09-04 03:39:20 +00001611static const struct xlat sysctl_root[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001612 { CTL_KERN, "CTL_KERN" },
1613 { CTL_VM, "CTL_VM" },
1614 { CTL_NET, "CTL_NET" },
1615 { CTL_PROC, "CTL_PROC" },
1616 { CTL_FS, "CTL_FS" },
1617 { CTL_DEBUG, "CTL_DEBUG" },
1618 { CTL_DEV, "CTL_DEV" },
Dmitry V. Levin35a55782006-12-04 13:48:10 +00001619 { CTL_BUS, "CTL_BUS" },
1620 { CTL_ABI, "CTL_ABI" },
1621 { CTL_CPU, "CTL_CPU" },
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001622 { 0, NULL }
1623};
1624
Roland McGrathd9f816f2004-09-04 03:39:20 +00001625static const struct xlat sysctl_kern[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001626 { KERN_OSTYPE, "KERN_OSTYPE" },
1627 { KERN_OSRELEASE, "KERN_OSRELEASE" },
1628 { KERN_OSREV, "KERN_OSREV" },
1629 { KERN_VERSION, "KERN_VERSION" },
1630 { KERN_SECUREMASK, "KERN_SECUREMASK" },
1631 { KERN_PROF, "KERN_PROF" },
1632 { KERN_NODENAME, "KERN_NODENAME" },
1633 { KERN_DOMAINNAME, "KERN_DOMAINNAME" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001634#ifdef KERN_SECURELVL
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001635 { KERN_SECURELVL, "KERN_SECURELVL" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001636#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001637 { KERN_PANIC, "KERN_PANIC" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001638#ifdef KERN_REALROOTDEV
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001639 { KERN_REALROOTDEV, "KERN_REALROOTDEV" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001640#endif
1641#ifdef KERN_JAVA_INTERPRETER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001642 { KERN_JAVA_INTERPRETER, "KERN_JAVA_INTERPRETER" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001643#endif
1644#ifdef KERN_JAVA_APPLETVIEWER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001645 { KERN_JAVA_APPLETVIEWER, "KERN_JAVA_APPLETVIEWER" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001646#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001647 { KERN_SPARC_REBOOT, "KERN_SPARC_REBOOT" },
1648 { KERN_CTLALTDEL, "KERN_CTLALTDEL" },
1649 { KERN_PRINTK, "KERN_PRINTK" },
1650 { KERN_NAMETRANS, "KERN_NAMETRANS" },
1651 { KERN_PPC_HTABRECLAIM, "KERN_PPC_HTABRECLAIM" },
1652 { KERN_PPC_ZEROPAGED, "KERN_PPC_ZEROPAGED" },
1653 { KERN_PPC_POWERSAVE_NAP, "KERN_PPC_POWERSAVE_NAP" },
1654 { KERN_MODPROBE, "KERN_MODPROBE" },
1655 { KERN_SG_BIG_BUFF, "KERN_SG_BIG_BUFF" },
1656 { KERN_ACCT, "KERN_ACCT" },
1657 { KERN_PPC_L2CR, "KERN_PPC_L2CR" },
1658 { KERN_RTSIGNR, "KERN_RTSIGNR" },
1659 { KERN_RTSIGMAX, "KERN_RTSIGMAX" },
1660 { KERN_SHMMAX, "KERN_SHMMAX" },
1661 { KERN_MSGMAX, "KERN_MSGMAX" },
1662 { KERN_MSGMNB, "KERN_MSGMNB" },
1663 { KERN_MSGPOOL, "KERN_MSGPOOL" },
1664 { 0, NULL }
1665};
1666
Roland McGrathd9f816f2004-09-04 03:39:20 +00001667static const struct xlat sysctl_vm[] = {
Roland McGratha796fd02004-03-01 22:10:54 +00001668#ifdef VM_SWAPCTL
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001669 { VM_SWAPCTL, "VM_SWAPCTL" },
Roland McGratha796fd02004-03-01 22:10:54 +00001670#endif
1671#ifdef VM_UNUSED1
1672 { VM_UNUSED1, "VM_UNUSED1" },
1673#endif
1674#ifdef VM_SWAPOUT
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001675 { VM_SWAPOUT, "VM_SWAPOUT" },
Roland McGratha796fd02004-03-01 22:10:54 +00001676#endif
1677#ifdef VM_UNUSED2
1678 { VM_UNUSED2, "VM_UNUSED2" },
1679#endif
1680#ifdef VM_FREEPG
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001681 { VM_FREEPG, "VM_FREEPG" },
Roland McGratha796fd02004-03-01 22:10:54 +00001682#endif
1683#ifdef VM_UNUSED3
1684 { VM_UNUSED3, "VM_UNUSED3" },
1685#endif
1686#ifdef VM_BDFLUSH
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001687 { VM_BDFLUSH, "VM_BDFLUSH" },
Roland McGratha796fd02004-03-01 22:10:54 +00001688#endif
1689#ifdef VM_UNUSED4
1690 { VM_UNUSED4, "VM_UNUSED4" },
1691#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001692 { VM_OVERCOMMIT_MEMORY, "VM_OVERCOMMIT_MEMORY" },
Roland McGratha796fd02004-03-01 22:10:54 +00001693#ifdef VM_BUFFERMEM
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001694 { VM_BUFFERMEM, "VM_BUFFERMEM" },
Roland McGratha796fd02004-03-01 22:10:54 +00001695#endif
1696#ifdef VM_UNUSED5
1697 { VM_UNUSED5, "VM_UNUSED5" },
1698#endif
1699#ifdef VM_PAGECACHE
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001700 { VM_PAGECACHE, "VM_PAGECACHE" },
Roland McGratha796fd02004-03-01 22:10:54 +00001701#endif
1702#ifdef VM_UNUSED7
1703 { VM_UNUSED7, "VM_UNUSED7" },
1704#endif
1705#ifdef VM_PAGERDAEMON
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001706 { VM_PAGERDAEMON, "VM_PAGERDAEMON" },
Roland McGratha796fd02004-03-01 22:10:54 +00001707#endif
1708#ifdef VM_UNUSED8
1709 { VM_UNUSED8, "VM_UNUSED8" },
1710#endif
1711#ifdef VM_PGT_CACHE
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001712 { VM_PGT_CACHE, "VM_PGT_CACHE" },
Roland McGratha796fd02004-03-01 22:10:54 +00001713#endif
1714#ifdef VM_UNUSED9
1715 { VM_UNUSED9, "VM_UNUSED9" },
1716#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001717 { VM_PAGE_CLUSTER, "VM_PAGE_CLUSTER" },
1718 { 0, NULL },
1719};
1720
Roland McGrathd9f816f2004-09-04 03:39:20 +00001721static const struct xlat sysctl_net[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001722 { NET_CORE, "NET_CORE" },
1723 { NET_ETHER, "NET_ETHER" },
1724 { NET_802, "NET_802" },
1725 { NET_UNIX, "NET_UNIX" },
1726 { NET_IPV4, "NET_IPV4" },
1727 { NET_IPX, "NET_IPX" },
1728 { NET_ATALK, "NET_ATALK" },
1729 { NET_NETROM, "NET_NETROM" },
1730 { NET_AX25, "NET_AX25" },
1731 { NET_BRIDGE, "NET_BRIDGE" },
1732 { NET_ROSE, "NET_ROSE" },
1733 { NET_IPV6, "NET_IPV6" },
1734 { NET_X25, "NET_X25" },
1735 { NET_TR, "NET_TR" },
1736 { NET_DECNET, "NET_DECNET" },
1737 { 0, NULL }
1738};
1739
Roland McGrathd9f816f2004-09-04 03:39:20 +00001740static const struct xlat sysctl_net_core[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001741 { NET_CORE_WMEM_MAX, "NET_CORE_WMEM_MAX" },
1742 { NET_CORE_RMEM_MAX, "NET_CORE_RMEM_MAX" },
1743 { NET_CORE_WMEM_DEFAULT, "NET_CORE_WMEM_DEFAULT" },
1744 { NET_CORE_RMEM_DEFAULT, "NET_CORE_RMEM_DEFAULT" },
1745 { NET_CORE_MAX_BACKLOG, "NET_CORE_MAX_BACKLOG" },
1746 { NET_CORE_FASTROUTE, "NET_CORE_FASTROUTE" },
1747 { NET_CORE_MSG_COST, "NET_CORE_MSG_COST" },
1748 { NET_CORE_MSG_BURST, "NET_CORE_MSG_BURST" },
1749 { NET_CORE_OPTMEM_MAX, "NET_CORE_OPTMEM_MAX" },
1750 { 0, NULL }
1751};
1752
Roland McGrathd9f816f2004-09-04 03:39:20 +00001753static const struct xlat sysctl_net_unix[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001754 { NET_UNIX_DESTROY_DELAY, "NET_UNIX_DESTROY_DELAY" },
1755 { NET_UNIX_DELETE_DELAY, "NET_UNIX_DELETE_DELAY" },
1756 { 0, NULL }
1757};
1758
Roland McGrathd9f816f2004-09-04 03:39:20 +00001759static const struct xlat sysctl_net_ipv4[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001760 { NET_IPV4_FORWARD, "NET_IPV4_FORWARD" },
1761 { NET_IPV4_DYNADDR, "NET_IPV4_DYNADDR" },
1762 { NET_IPV4_CONF, "NET_IPV4_CONF" },
1763 { NET_IPV4_NEIGH, "NET_IPV4_NEIGH" },
1764 { NET_IPV4_ROUTE, "NET_IPV4_ROUTE" },
1765 { NET_IPV4_FIB_HASH, "NET_IPV4_FIB_HASH" },
1766 { NET_IPV4_TCP_TIMESTAMPS, "NET_IPV4_TCP_TIMESTAMPS" },
1767 { NET_IPV4_TCP_WINDOW_SCALING, "NET_IPV4_TCP_WINDOW_SCALING" },
1768 { NET_IPV4_TCP_SACK, "NET_IPV4_TCP_SACK" },
1769 { NET_IPV4_TCP_RETRANS_COLLAPSE, "NET_IPV4_TCP_RETRANS_COLLAPSE" },
1770 { NET_IPV4_DEFAULT_TTL, "NET_IPV4_DEFAULT_TTL" },
1771 { NET_IPV4_AUTOCONFIG, "NET_IPV4_AUTOCONFIG" },
1772 { NET_IPV4_NO_PMTU_DISC, "NET_IPV4_NO_PMTU_DISC" },
1773 { NET_IPV4_TCP_SYN_RETRIES, "NET_IPV4_TCP_SYN_RETRIES" },
1774 { NET_IPV4_IPFRAG_HIGH_THRESH, "NET_IPV4_IPFRAG_HIGH_THRESH" },
1775 { NET_IPV4_IPFRAG_LOW_THRESH, "NET_IPV4_IPFRAG_LOW_THRESH" },
1776 { NET_IPV4_IPFRAG_TIME, "NET_IPV4_IPFRAG_TIME" },
1777 { NET_IPV4_TCP_MAX_KA_PROBES, "NET_IPV4_TCP_MAX_KA_PROBES" },
1778 { NET_IPV4_TCP_KEEPALIVE_TIME, "NET_IPV4_TCP_KEEPALIVE_TIME" },
1779 { NET_IPV4_TCP_KEEPALIVE_PROBES, "NET_IPV4_TCP_KEEPALIVE_PROBES" },
1780 { NET_IPV4_TCP_RETRIES1, "NET_IPV4_TCP_RETRIES1" },
1781 { NET_IPV4_TCP_RETRIES2, "NET_IPV4_TCP_RETRIES2" },
1782 { NET_IPV4_TCP_FIN_TIMEOUT, "NET_IPV4_TCP_FIN_TIMEOUT" },
1783 { NET_IPV4_IP_MASQ_DEBUG, "NET_IPV4_IP_MASQ_DEBUG" },
1784 { NET_TCP_SYNCOOKIES, "NET_TCP_SYNCOOKIES" },
1785 { NET_TCP_STDURG, "NET_TCP_STDURG" },
1786 { NET_TCP_RFC1337, "NET_TCP_RFC1337" },
1787 { NET_TCP_SYN_TAILDROP, "NET_TCP_SYN_TAILDROP" },
1788 { NET_TCP_MAX_SYN_BACKLOG, "NET_TCP_MAX_SYN_BACKLOG" },
1789 { NET_IPV4_LOCAL_PORT_RANGE, "NET_IPV4_LOCAL_PORT_RANGE" },
1790 { NET_IPV4_ICMP_ECHO_IGNORE_ALL, "NET_IPV4_ICMP_ECHO_IGNORE_ALL" },
1791 { NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS" },
1792 { NET_IPV4_ICMP_SOURCEQUENCH_RATE, "NET_IPV4_ICMP_SOURCEQUENCH_RATE" },
1793 { NET_IPV4_ICMP_DESTUNREACH_RATE, "NET_IPV4_ICMP_DESTUNREACH_RATE" },
1794 { NET_IPV4_ICMP_TIMEEXCEED_RATE, "NET_IPV4_ICMP_TIMEEXCEED_RATE" },
1795 { NET_IPV4_ICMP_PARAMPROB_RATE, "NET_IPV4_ICMP_PARAMPROB_RATE" },
1796 { NET_IPV4_ICMP_ECHOREPLY_RATE, "NET_IPV4_ICMP_ECHOREPLY_RATE" },
1797 { NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES" },
1798 { NET_IPV4_IGMP_MAX_MEMBERSHIPS, "NET_IPV4_IGMP_MAX_MEMBERSHIPS" },
1799 { 0, NULL }
1800};
1801
Roland McGrathd9f816f2004-09-04 03:39:20 +00001802static const struct xlat sysctl_net_ipv4_route[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001803 { NET_IPV4_ROUTE_FLUSH, "NET_IPV4_ROUTE_FLUSH" },
1804 { NET_IPV4_ROUTE_MIN_DELAY, "NET_IPV4_ROUTE_MIN_DELAY" },
1805 { NET_IPV4_ROUTE_MAX_DELAY, "NET_IPV4_ROUTE_MAX_DELAY" },
1806 { NET_IPV4_ROUTE_GC_THRESH, "NET_IPV4_ROUTE_GC_THRESH" },
1807 { NET_IPV4_ROUTE_MAX_SIZE, "NET_IPV4_ROUTE_MAX_SIZE" },
1808 { NET_IPV4_ROUTE_GC_MIN_INTERVAL, "NET_IPV4_ROUTE_GC_MIN_INTERVAL" },
1809 { NET_IPV4_ROUTE_GC_TIMEOUT, "NET_IPV4_ROUTE_GC_TIMEOUT" },
1810 { NET_IPV4_ROUTE_GC_INTERVAL, "NET_IPV4_ROUTE_GC_INTERVAL" },
1811 { NET_IPV4_ROUTE_REDIRECT_LOAD, "NET_IPV4_ROUTE_REDIRECT_LOAD" },
1812 { NET_IPV4_ROUTE_REDIRECT_NUMBER, "NET_IPV4_ROUTE_REDIRECT_NUMBER" },
1813 { NET_IPV4_ROUTE_REDIRECT_SILENCE, "NET_IPV4_ROUTE_REDIRECT_SILENCE" },
1814 { NET_IPV4_ROUTE_ERROR_COST, "NET_IPV4_ROUTE_ERROR_COST" },
1815 { NET_IPV4_ROUTE_ERROR_BURST, "NET_IPV4_ROUTE_ERROR_BURST" },
1816 { NET_IPV4_ROUTE_GC_ELASTICITY, "NET_IPV4_ROUTE_GC_ELASTICITY" },
1817 { 0, NULL }
1818};
1819
Roland McGrathd9f816f2004-09-04 03:39:20 +00001820static const struct xlat sysctl_net_ipv4_conf[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001821 { NET_IPV4_CONF_FORWARDING, "NET_IPV4_CONF_FORWARDING" },
1822 { NET_IPV4_CONF_MC_FORWARDING, "NET_IPV4_CONF_MC_FORWARDING" },
1823 { NET_IPV4_CONF_PROXY_ARP, "NET_IPV4_CONF_PROXY_ARP" },
1824 { NET_IPV4_CONF_ACCEPT_REDIRECTS, "NET_IPV4_CONF_ACCEPT_REDIRECTS" },
1825 { NET_IPV4_CONF_SECURE_REDIRECTS, "NET_IPV4_CONF_SECURE_REDIRECTS" },
1826 { NET_IPV4_CONF_SEND_REDIRECTS, "NET_IPV4_CONF_SEND_REDIRECTS" },
1827 { NET_IPV4_CONF_SHARED_MEDIA, "NET_IPV4_CONF_SHARED_MEDIA" },
1828 { NET_IPV4_CONF_RP_FILTER, "NET_IPV4_CONF_RP_FILTER" },
1829 { NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, "NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE" },
1830 { NET_IPV4_CONF_BOOTP_RELAY, "NET_IPV4_CONF_BOOTP_RELAY" },
1831 { NET_IPV4_CONF_LOG_MARTIANS, "NET_IPV4_CONF_LOG_MARTIANS" },
1832 { 0, NULL }
1833};
1834
Roland McGrathd9f816f2004-09-04 03:39:20 +00001835static const struct xlat sysctl_net_ipv6[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001836 { NET_IPV6_CONF, "NET_IPV6_CONF" },
1837 { NET_IPV6_NEIGH, "NET_IPV6_NEIGH" },
1838 { NET_IPV6_ROUTE, "NET_IPV6_ROUTE" },
1839 { 0, NULL }
1840};
1841
Roland McGrathd9f816f2004-09-04 03:39:20 +00001842static const struct xlat sysctl_net_ipv6_route[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001843 { NET_IPV6_ROUTE_FLUSH, "NET_IPV6_ROUTE_FLUSH" },
1844 { NET_IPV6_ROUTE_GC_THRESH, "NET_IPV6_ROUTE_GC_THRESH" },
1845 { NET_IPV6_ROUTE_MAX_SIZE, "NET_IPV6_ROUTE_MAX_SIZE" },
1846 { NET_IPV6_ROUTE_GC_MIN_INTERVAL, "NET_IPV6_ROUTE_GC_MIN_INTERVAL" },
1847 { NET_IPV6_ROUTE_GC_TIMEOUT, "NET_IPV6_ROUTE_GC_TIMEOUT" },
1848 { NET_IPV6_ROUTE_GC_INTERVAL, "NET_IPV6_ROUTE_GC_INTERVAL" },
1849 { NET_IPV6_ROUTE_GC_ELASTICITY, "NET_IPV6_ROUTE_GC_ELASTICITY" },
1850 { 0, NULL }
1851};
1852
1853int
1854sys_sysctl(tcp)
1855struct tcb *tcp;
1856{
1857 struct __sysctl_args info;
1858 int *name;
Roland McGrathaa524c82005-06-01 19:22:06 +00001859 unsigned long size;
1860
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001861 if (umove (tcp, tcp->u_arg[0], &info) < 0)
1862 return printargs(tcp);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001863
Roland McGrathaa524c82005-06-01 19:22:06 +00001864 size = sizeof (int) * (unsigned long) info.nlen;
1865 name = (size / sizeof (int) != info.nlen) ? NULL : malloc (size);
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001866 if (name == NULL ||
Roland McGrathaa524c82005-06-01 19:22:06 +00001867 umoven(tcp, (unsigned long) info.name, size, (char *) name) < 0) {
1868 free(name);
1869 if (entering(tcp))
1870 tprintf("{%p, %d, %p, %p, %p, %Zu}",
1871 info.name, info.nlen, info.oldval,
1872 info.oldlenp, info.newval, info.newlen);
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001873 return 0;
1874 }
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001875
1876 if (entering(tcp)) {
Roland McGrathaa524c82005-06-01 19:22:06 +00001877 int cnt = 0, max_cnt;
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001878
1879 tprintf("{{");
1880
1881 if (info.nlen == 0)
1882 goto out;
1883 printxval(sysctl_root, name[0], "CTL_???");
1884 ++cnt;
1885
1886 if (info.nlen == 1)
1887 goto out;
1888 switch (name[0]) {
1889 case CTL_KERN:
1890 tprintf(", ");
1891 printxval(sysctl_kern, name[1], "KERN_???");
1892 ++cnt;
1893 break;
1894 case CTL_VM:
1895 tprintf(", ");
1896 printxval(sysctl_vm, name[1], "VM_???");
1897 ++cnt;
1898 break;
1899 case CTL_NET:
1900 tprintf(", ");
1901 printxval(sysctl_net, name[1], "NET_???");
1902 ++cnt;
1903
1904 if (info.nlen == 2)
1905 goto out;
1906 switch (name[1]) {
1907 case NET_CORE:
1908 tprintf(", ");
1909 printxval(sysctl_net_core, name[2],
1910 "NET_CORE_???");
1911 break;
1912 case NET_UNIX:
1913 tprintf(", ");
1914 printxval(sysctl_net_unix, name[2],
1915 "NET_UNIX_???");
1916 break;
1917 case NET_IPV4:
1918 tprintf(", ");
1919 printxval(sysctl_net_ipv4, name[2],
1920 "NET_IPV4_???");
1921
1922 if (info.nlen == 3)
1923 goto out;
1924 switch (name[2]) {
1925 case NET_IPV4_ROUTE:
1926 tprintf(", ");
1927 printxval(sysctl_net_ipv4_route,
1928 name[3],
1929 "NET_IPV4_ROUTE_???");
1930 break;
1931 case NET_IPV4_CONF:
1932 tprintf(", ");
1933 printxval(sysctl_net_ipv4_conf,
1934 name[3],
1935 "NET_IPV4_CONF_???");
1936 break;
1937 default:
1938 goto out;
1939 }
1940 break;
1941 case NET_IPV6:
1942 tprintf(", ");
1943 printxval(sysctl_net_ipv6, name[2],
1944 "NET_IPV6_???");
1945
1946 if (info.nlen == 3)
1947 goto out;
1948 switch (name[2]) {
1949 case NET_IPV6_ROUTE:
1950 tprintf(", ");
1951 printxval(sysctl_net_ipv6_route,
1952 name[3],
1953 "NET_IPV6_ROUTE_???");
1954 break;
1955 default:
1956 goto out;
1957 }
1958 break;
1959 default:
1960 goto out;
1961 }
1962 break;
1963 default:
1964 goto out;
1965 }
1966 out:
Roland McGrath8e4a3e62006-01-12 11:03:46 +00001967 max_cnt = info.nlen;
1968 if (abbrev(tcp) && max_cnt > max_strlen)
1969 max_cnt = max_strlen;
Roland McGrathaa524c82005-06-01 19:22:06 +00001970 while (cnt < max_cnt)
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001971 tprintf(", %x", name[cnt++]);
Roland McGrathaa524c82005-06-01 19:22:06 +00001972 if (cnt < info.nlen)
1973 tprintf(", ...");
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001974 tprintf("}, %d, ", info.nlen);
1975 } else {
1976 size_t oldlen;
Roland McGrathaa524c82005-06-01 19:22:06 +00001977 if (umove(tcp, (size_t)info.oldlenp, &oldlen) >= 0
1978 && info.nlen >= 2
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001979 && ((name[0] == CTL_KERN
1980 && (name[1] == KERN_OSRELEASE
1981 || name[1] == KERN_OSTYPE
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001982#ifdef KERN_JAVA_INTERPRETER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001983 || name[1] == KERN_JAVA_INTERPRETER
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001984#endif
1985#ifdef KERN_JAVA_APPLETVIEWER
1986 || name[1] == KERN_JAVA_APPLETVIEWER
1987#endif
1988 )))) {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001989 printpath(tcp, (size_t)info.oldval);
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001990 tprintf(", %Zu, ", oldlen);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001991 if (info.newval == 0)
1992 tprintf("NULL");
1993 else if (syserror(tcp))
1994 tprintf("%p", info.newval);
1995 else
1996 printpath(tcp, (size_t)info.newval);
1997 tprintf(", %Zd", info.newlen);
1998 } else {
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001999 tprintf("%p, %Zd, %p, %Zd", info.oldval, oldlen,
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002000 info.newval, info.newlen);
2001 }
2002 tprintf("}");
2003 }
Roland McGrath2cbe44e2005-05-26 23:21:09 +00002004
2005 free(name);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002006 return 0;
2007}
2008#else
2009int sys_sysctl(tcp)
2010struct tcb *tcp;
2011{
2012 return printargs(tcp);
2013}
2014#endif
2015
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00002016#ifdef FREEBSD
2017#include <sys/sysctl.h>
2018
2019int sys___sysctl(tcp)
2020struct tcb *tcp;
2021{
2022 int qoid[CTL_MAXNAME+2];
2023 char ctl[1024];
2024 size_t len;
2025 int i, numeric;
Roland McGrathced50da2004-08-31 06:48:46 +00002026
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00002027 if (entering(tcp)) {
2028 if (tcp->u_arg[1] < 0 || tcp->u_arg[1] > CTL_MAXNAME ||
2029 (umoven(tcp, tcp->u_arg[0], tcp->u_arg[1] * sizeof(int),
2030 (char *) (qoid + 2)) < 0))
2031 tprintf("[...], ");
2032 else {
2033 /* Use sysctl to ask the name of the current MIB
2034 This uses the undocumented "Staff-functions" used
2035 by the sysctl program. See kern_sysctl.c for
2036 details. */
2037 qoid[0] = 0; /* sysctl */
2038 qoid[1] = 1; /* name */
2039 i = sizeof(ctl);
2040 tprintf("[");
2041 if (sysctl(qoid, tcp->u_arg[1] + 2, ctl, &i, 0, 0) >= 0) {
2042 numeric = !abbrev(tcp);
2043 tprintf("%s%s", ctl, numeric ? ", " : "");
2044 } else
2045 numeric = 1;
2046 if (numeric) {
2047 for (i = 0; i < tcp->u_arg[1]; i++)
2048 tprintf("%s%d", i ? "." : "", qoid[i + 2]);
2049 }
2050 tprintf("], ");
2051 tprintf("%lu, ", tcp->u_arg[1]);
2052 }
2053 } else {
2054 if (!syserror(tcp) && (umove(tcp, tcp->u_arg[3], &len) >= 0)) {
2055 printstr(tcp, tcp->u_arg[2], len);
2056 tprintf(", [%u], ", len);
Roland McGrathced50da2004-08-31 06:48:46 +00002057 } else
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00002058 tprintf("%#lx, %#lx, ", tcp->u_arg[2], tcp->u_arg[3]);
2059 printstr(tcp, tcp->u_arg[4], tcp->u_arg[5]);
2060 tprintf(", %lu", tcp->u_arg[5]);
2061 }
2062 return 0;
2063}
2064#endif
Wichert Akkerman16a03d22000-08-10 02:14:04 +00002065
2066#if UNIXWARE >= 2
2067
2068#include <sys/ksym.h>
2069#include <sys/elf.h>
2070
Roland McGrathd9f816f2004-09-04 03:39:20 +00002071static const struct xlat ksym_flags[] = {
Roland McGrathced50da2004-08-31 06:48:46 +00002072 { STT_NOTYPE, "STT_NOTYPE" },
2073 { STT_FUNC, "STT_FUNC" },
2074 { STT_OBJECT, "STT_OBJECT" },
Wichert Akkerman16a03d22000-08-10 02:14:04 +00002075 { 0, NULL },
2076};
2077
2078int
2079sys_getksym(tcp)
2080struct tcb *tcp;
2081{
2082 if (entering (tcp)) {
2083 printstr(tcp, tcp->u_arg[0], -1);
2084 tprintf(", ");
2085 }
2086 else {
2087 if (syserror(tcp)) {
2088 tprintf("%#lx, %#lx",
2089 tcp->u_arg[1], tcp->u_arg[2]);
2090 }
2091 else {
2092 int val;
2093 printnum (tcp, tcp->u_arg[1], "%#lx");
2094 tprintf(", ");
2095 if (umove(tcp, tcp->u_arg[2], &val) < 0) {
2096 tprintf("%#lx", tcp->u_arg[2]);
2097 }
2098 else {
2099 tprintf("[");
2100 printxval (ksym_flags, val, "STT_???");
2101 tprintf("]");
2102 }
2103 }
2104 }
2105
2106 return 0;
2107}
2108
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002109#ifdef HAVE_SYS_NSCSYS_H
John Hughes4e36a812001-04-18 15:11:51 +00002110
John Hughes0aadba42001-10-16 18:19:52 +00002111struct cred;
John Hughes4e36a812001-04-18 15:11:51 +00002112#include <sys/nscsys.h>
2113
Roland McGrathd9f816f2004-09-04 03:39:20 +00002114static const struct xlat ssi_cmd [] = {
John Hughes4e36a812001-04-18 15:11:51 +00002115 { SSISYS_BADOP, "SSISYS_BADOP" },
2116 { SSISYS_LDLVL_INIT,"SSISYS_LDLVL_INIT"},
2117 { SSISYS_LDLVL_GETVEC,"SSISYS_LDLVL_GETVEC"},
2118 { SSISYS_LDLVL_PUTVEC,"SSISYS_LDLVL_PUTVEC"},
2119 { SSISYS_LDLVL_PUTRCMDS,"SSISYS_LDLVL_PUTRCMDS"},
2120 { SSISYS_LDLVL_SETREXEC,"SSISYS_LDLVL_SETREXEC"},
2121 { SSISYS_CMS_CLUSTERID,"SSISYS_CMS_CLUSTERID"},
2122 { SSISYS_CFS_STATVFS,"SSISYS_CFS_STATVFS"},
2123 { SSISYS_NODE_GETNUM,"SSISYS_NODE_GETNUM"},
2124 { SSISYS_NODE_TABLE,"SSISYS_NODE_TABLE"},
2125 { SSISYS_NODE_DOWN,"SSISYS_NODE_DOWN"},
2126 { SSISYS_RECLAIM_CHILD,"SSISYS_RECLAIM_CHILD"},
2127 { SSISYS_IPC_GETINFO,"SSISYS_IPC_GETINFO"},
2128 { SSISYS_ICS_TEST,"SSISYS_ICS_TEST"},
2129 { SSISYS_NODE_PID,"SSISYS_NODE_PID"},
2130 { SSISYS_ISLOCAL,"SSISYS_ISLOCAL"},
2131 { SSISYS_CFS_ISSTACKED,"SSISYS_CFS_ISSTACKED"},
2132 { SSISYS_DNET_SYNC,"SSISYS_DNET_SYNC"},
2133 { SSISYS_CFS_WAIT_MODE,"SSISYS_CFS_WAIT_MODE"},
2134 { SSISYS_CFS_UMOUNT,"SSISYS_CFS_UMOUNT"},
2135 { SSISYS_LLSTAT,"SSISYS_LLSTAT" },
2136 { SSISYS_LTS_PERFTEST,"SSISYS_LTS_PERFTEST"},
2137 { SSISYS_LTS_CONFIG,"SSISYS_LTS_CONFIG"},
2138 { SSISYS_SNET_PERFTEST,"SSISYS_SNET_PERFTEST"},
2139 { SSISYS_IGNORE_HALFUP,"SSISYS_IGNORE_HALFUP"},
2140 { SSISYS_NODE_ROOTDEV,"SSISYS_NODE_ROOTDEV"},
2141 { SSISYS_GET_PRIMARY,"SSISYS_GET_PRIMARY"},
2142 { SSISYS_GET_SECONDARY,"SSISYS_GET_SECONDARY"},
2143 { SSISYS_GET_ROOTDISK,"SSISYS_GET_ROOTDISK"},
2144 { SSISYS_CLUSTERNODE_NUM,"SSISYS_CLUSTERNODE_NUM"},
2145 { SSISYS_CLUSTER_MEMBERSHIP,"SSISYS_CLUSTER_MEMBERSHIP"},
2146 { SSISYS_CLUSTER_DETAILEDTRANS,"SSISYS_CLUSTER_DETAILEDTRANS"},
2147 { SSISYS_CLUSTERNODE_INFO,"SSISYS_CLUSTERNODE_INFO"},
2148 { SSISYS_CLUSTERNODE_SETINFO,"SSISYS_CLUSTERNODE_SETINFO"},
2149 { SSISYS_CLUSTERNODE_AVAIL,"SSISYS_CLUSTERNODE_AVAIL"},
2150 { SSISYS_CLUSTER_MAXNODES,"SSISYS_CLUSTER_MAXNODES"},
2151 { SSISYS_SET_MEMPRIO,"SSISYS_SET_MEMPRIO"},
2152 { SSISYS_GET_USERS,"SSISYS_GET_USERS"},
2153 { SSISYS_FORCE_ROOT_NODE,"SSISYS_FORCE_ROOT_NODE"},
2154 { SSISYS_CVIP_SET,"SSISYS_CVIP_SET"},
2155 { SSISYS_CVIP_GET,"SSISYS_CVIP_GET"},
2156 { SSISYS_GET_NODE_COUNTS,"SSISYS_GET_NODE_COUNTS"},
2157 { SSISYS_GET_TRANSPORT,"SSISYS_GET_TRANSPORT"},
2158 { 0, NULL },
2159};
2160
2161int sys_ssisys (tcp)
2162struct tcb *tcp;
2163{
2164 struct ssisys_iovec iov;
John Hughes2d8b2c52001-10-18 14:52:24 +00002165 cls_nodeinfo_args_t cni;
2166 clusternode_info_t info;
2167
John Hughes4e36a812001-04-18 15:11:51 +00002168 if (entering (tcp)) {
John Hughes0aadba42001-10-16 18:19:52 +00002169 ts_reclaim_child_inargs_t trc;
John Hughes4e36a812001-04-18 15:11:51 +00002170 if (tcp->u_arg[1] != sizeof iov ||
2171 umove (tcp, tcp->u_arg[0], &iov) < 0)
2172 {
2173 tprintf ("%#lx, %ld", tcp->u_arg[0], tcp->u_arg[1]);
2174 return 0;
2175 }
2176 tprintf ("{id=");
2177 printxval(ssi_cmd, iov.tio_id.id_cmd, "SSISYS_???");
2178 tprintf (":%d", iov.tio_id.id_ver);
2179 switch (iov.tio_id.id_cmd) {
John Hughes0aadba42001-10-16 18:19:52 +00002180 case SSISYS_RECLAIM_CHILD:
2181 if (iov.tio_udatainlen != sizeof trc ||
2182 umove (tcp, (long) iov.tio_udatain, &trc) < 0)
2183 goto bad;
2184 tprintf (", in={pid=%ld, start=%ld}",
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002185 trc.trc_pid, trc.trc_start);
John Hughes0aadba42001-10-16 18:19:52 +00002186 break;
2187 case SSISYS_CLUSTERNODE_INFO:
2188 if (iov.tio_udatainlen != sizeof cni ||
2189 umove (tcp, (long) iov.tio_udatain, &cni) < 0)
2190 goto bad;
2191 tprintf (", in={node=%ld, len=%d}",
2192 cni.nodenum, cni.info_len);
2193 break;
John Hughes4e36a812001-04-18 15:11:51 +00002194 default:
John Hughes0aadba42001-10-16 18:19:52 +00002195 bad:
John Hughes4e36a812001-04-18 15:11:51 +00002196 if (iov.tio_udatainlen) {
2197 tprintf (", in=[/* %d bytes */]",
2198 iov.tio_udatainlen);
2199 }
2200 }
2201 }
2202 else {
John Hughes2d8b2c52001-10-18 14:52:24 +00002203 if (tcp->u_arg[1] != sizeof iov ||
2204 umove (tcp, tcp->u_arg[0], &iov) < 0)
2205 goto done;
John Hughes4e36a812001-04-18 15:11:51 +00002206 switch (iov.tio_id.id_cmd) {
John Hughes2d8b2c52001-10-18 14:52:24 +00002207 case SSISYS_CLUSTERNODE_INFO:
2208 if (iov.tio_udatainlen != sizeof cni ||
2209 umove (tcp, (long) iov.tio_udatain, &cni) < 0)
2210 goto bad_out;
Roland McGrathced50da2004-08-31 06:48:46 +00002211 if (cni.info_len != sizeof info ||
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002212 iov.tio_udataoutlen != sizeof &info ||
John Hughes2d8b2c52001-10-18 14:52:24 +00002213 umove (tcp, (long) iov.tio_udataout, &info) < 0)
2214 goto bad_out;
2215 tprintf (", out={node=%ld, cpus=%d, online=%d}",
2216 info.node_num, info.node_totalcpus,
2217 info.node_onlinecpus);
2218 break;
Roland McGrathced50da2004-08-31 06:48:46 +00002219
John Hughes4e36a812001-04-18 15:11:51 +00002220 default:
John Hughes2d8b2c52001-10-18 14:52:24 +00002221 bad_out:
John Hughes4e36a812001-04-18 15:11:51 +00002222 if (iov.tio_udataoutlen) {
2223 tprintf (", out=[/* %d bytes */]",
2224 iov.tio_udataoutlen);
2225 }
2226 }
John Hughes2d8b2c52001-10-18 14:52:24 +00002227 done:
John Hughes4e36a812001-04-18 15:11:51 +00002228 tprintf ("}, %ld", tcp->u_arg[1]);
2229 }
2230 return 0;
2231}
2232
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002233#endif
John Hughes4e36a812001-04-18 15:11:51 +00002234
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002235#endif /* UNIXWARE > 2 */
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002236
2237#ifdef MIPS
2238
Wichert Akkermand6b92492001-04-07 21:37:12 +00002239#ifndef __NEW_UTS_LEN
2240#define __NEW_UTS_LEN 64
2241#endif
2242
Roland McGrathd9f816f2004-09-04 03:39:20 +00002243static const struct xlat sysmips_operations[] = {
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002244 { SETNAME, "SETNAME" },
2245 { FLUSH_CACHE, "FLUSH_CACHE" },
2246 { MIPS_FIXADE, "MIPS_FIXADE" },
2247 { MIPS_RDNVRAM, "MIPS_RDNVRAM" },
2248 { MIPS_ATOMIC_SET, "MIPS_ATOMIC_SET" },
2249 { 0, NULL }
2250};
2251
2252int sys_sysmips(tcp)
2253struct tcb *tcp;
2254{
2255 if (entering(tcp)) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002256 printxval(sysmips_operations, tcp->u_arg[0], "???");
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002257 if (!verbose(tcp)) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002258 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002259 } else if (tcp->u_arg[0]==SETNAME) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002260 char nodename[__NEW_UTS_LEN + 1];
2261 if (umovestr(tcp, tcp->u_arg[1], (__NEW_UTS_LEN + 1), nodename) < 0)
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002262 tprintf(", %#lx", tcp->u_arg[1]);
2263 else
2264 tprintf(", \"%s\"", nodename);
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002265 } else if (tcp->u_arg[0] == MIPS_ATOMIC_SET) {
2266 tprintf(", %#lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
2267 } else if (tcp->u_arg[0] == MIPS_FIXADE) {
2268 tprintf(", 0x%lx", tcp->u_arg[1]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002269 } else {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002270 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002271 }
2272 }
2273
2274 return 0;
2275}
2276
2277#endif /* MIPS */