blob: 0970d710ee2a260743dd1d3e011b32a4dcf967ac [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
52#define MS_VERBOSE 32768
53#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
54#define MS_ACTIVE (1<<30)
55#define MS_NOUSER (1<<31)
Roland McGrath6af37482006-01-12 21:21:06 +000056#define MS_MGC_VAL 0xc0ed0000 /* Magic flag number */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000057
58#include <sys/socket.h>
59#include <netinet/in.h>
60#include <arpa/inet.h>
61
Nate Sammons8d5860c1999-07-03 18:53:05 +000062#include <sys/syscall.h>
63
Nate Sammons8d5860c1999-07-03 18:53:05 +000064#ifdef SYS_capget
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000065#include <linux/capability.h>
66#endif
67
Nate Sammons8d5860c1999-07-03 18:53:05 +000068#ifdef SYS_cacheflush
Wichert Akkerman2e2553a1999-05-09 00:29:58 +000069#include <asm/cachectl.h>
70#endif
71
Wichert Akkermand6b92492001-04-07 21:37:12 +000072#ifdef HAVE_LINUX_USTNAME_H
73#include <linux/utsname.h>
74#endif
75
Michal Ludvig39c0e942002-11-06 14:00:12 +000076#ifdef MIPS
Wichert Akkermand6b92492001-04-07 21:37:12 +000077#include <asm/sysmips.h>
78#endif
79
Wichert Akkerman22fe9d21999-05-27 12:00:57 +000080#include <linux/sysctl.h>
Wichert Akkerman22fe9d21999-05-27 12:00:57 +000081
Roland McGrathd9f816f2004-09-04 03:39:20 +000082static const struct xlat mount_flags[] = {
Roland McGrath6af37482006-01-12 21:21:06 +000083 { MS_MGC_VAL, "MS_MGC_VAL" },
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000084 { MS_RDONLY, "MS_RDONLY" },
85 { MS_NOSUID, "MS_NOSUID" },
86 { MS_NODEV, "MS_NODEV" },
87 { MS_NOEXEC, "MS_NOEXEC" },
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000088 { MS_SYNCHRONOUS,"MS_SYNCHRONOUS"},
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000089 { MS_REMOUNT, "MS_REMOUNT" },
Roland McGrathcbd33582005-02-02 04:36:11 +000090 { MS_MANDLOCK, "MS_MANDLOCK" },
91 { MS_NOATIME, "MS_NOATIME" },
92 { MS_NODIRATIME,"MS_NODIRATIME" },
93 { MS_BIND, "MS_BIND" },
94 { MS_MOVE, "MS_MOVE" },
95 { MS_REC, "MS_REC" },
96 { MS_VERBOSE, "MS_VERBOSE" },
97 { MS_POSIXACL, "MS_POSIXACL" },
98 { MS_ACTIVE, "MS_ACTIVE" },
99 { MS_NOUSER, "MS_NOUSER" },
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000100 { 0, NULL },
101};
102
103int
104sys_mount(tcp)
105struct tcb *tcp;
106{
107 if (entering(tcp)) {
108 printpath(tcp, tcp->u_arg[0]);
109 tprintf(", ");
110 printpath(tcp, tcp->u_arg[1]);
111 tprintf(", ");
Roland McGrathcbd33582005-02-02 04:36:11 +0000112 if ((tcp->u_arg[3] & (MS_BIND|MS_MOVE|MS_REMOUNT)) == 0)
113 printpath(tcp, tcp->u_arg[2]);
114 else
115 tprintf("%#lx", tcp->u_arg[2]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000116 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000117 printflags(mount_flags, tcp->u_arg[3], "MS_???");
Roland McGrath6af37482006-01-12 21:21:06 +0000118 tprintf(", ");
119 if ((tcp->u_arg[3] & (MS_BIND|MS_MOVE)) == 0)
120 printstr(tcp, tcp->u_arg[4], -1);
121 else
122 tprintf("%#lx", tcp->u_arg[4]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000123 }
124 return 0;
125}
126
Dmitry V. Levin5c7ad8c2007-01-13 11:15:48 +0000127#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */
128#define MNT_DETACH 0x00000002 /* Just detach from the tree */
129#define MNT_EXPIRE 0x00000004 /* Mark for expiry */
130
131static const struct xlat umount_flags[] = {
132 { MNT_FORCE, "MNT_FORCE" },
133 { MNT_DETACH, "MNT_DETACH" },
134 { MNT_EXPIRE, "MNT_EXPIRE" },
135 { 0, NULL },
136};
137
Wichert Akkermandacfb6e1999-06-03 14:21:07 +0000138int
Dmitry V. Levin5c7ad8c2007-01-13 11:15:48 +0000139sys_umount2(struct tcb *tcp)
Wichert Akkermandacfb6e1999-06-03 14:21:07 +0000140{
141 if (entering(tcp)) {
142 printstr(tcp, tcp->u_arg[0], -1);
143 tprintf(", ");
Dmitry V. Levin5c7ad8c2007-01-13 11:15:48 +0000144 printflags(umount_flags, tcp->u_arg[1], "MNT_???");
Wichert Akkermandacfb6e1999-06-03 14:21:07 +0000145 }
146 return 0;
147}
148
Roland McGrathced50da2004-08-31 06:48:46 +0000149/* These are not macros, but enums. We just copy the values by hand
150 from Linux 2.6.9 here. */
Roland McGrathd9f816f2004-09-04 03:39:20 +0000151static const struct xlat personality_options[] = {
Roland McGrathced50da2004-08-31 06:48:46 +0000152 { 0, "PER_LINUX" },
153 { 0x00800000, "PER_LINUX_32BIT"},
154 { 0x04100001, "PER_SVR4" },
155 { 0x05000002, "PER_SVR3" },
156 { 0x07000003, "PER_SCOSVR3" },
157 { 0x06000003, "PER_OSR5" },
158 { 0x05000004, "PER_WYSEV386" },
159 { 0x04000005, "PER_ISCR4" },
160 { 0x00000006, "PER_BSD" },
161 { 0x04000006, "PER_SUNOS" },
162 { 0x05000007, "PER_XENIX" },
163 { 0x00000008, "PER_LINUX32" },
164 { 0x08000008, "PER_LINUX32_3GB"},
165 { 0x04000009, "PER_IRIX32" },
166 { 0x0400000a, "PER_IRIXN32" },
167 { 0x0400000b, "PER_IRIX64" },
168 { 0x0000000c, "PER_RISCOS" },
169 { 0x0400000d, "PER_SOLARIS" },
170 { 0x0410000e, "PER_UW7" },
171 { 0x0000000f, "PER_OSF4" },
172 { 0x00000010, "PER_HPUX" },
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000173 { 0, NULL },
174};
175
176int
177sys_personality(tcp)
178struct tcb *tcp;
179{
180 if (entering(tcp))
181 printxval(personality_options, tcp->u_arg[0], "PER_???");
182 return 0;
183}
184
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000185#include <linux/reboot.h>
Roland McGrathd9f816f2004-09-04 03:39:20 +0000186static const struct xlat bootflags1[] = {
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000187 { LINUX_REBOOT_MAGIC1, "LINUX_REBOOT_MAGIC1" },
188 { 0, NULL },
189};
190
Roland McGrathd9f816f2004-09-04 03:39:20 +0000191static const struct xlat bootflags2[] = {
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000192 { LINUX_REBOOT_MAGIC2, "LINUX_REBOOT_MAGIC2" },
193 { LINUX_REBOOT_MAGIC2A, "LINUX_REBOOT_MAGIC2A" },
194 { LINUX_REBOOT_MAGIC2B, "LINUX_REBOOT_MAGIC2B" },
195 { 0, NULL },
196};
197
Roland McGrathd9f816f2004-09-04 03:39:20 +0000198static const struct xlat bootflags3[] = {
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000199 { LINUX_REBOOT_CMD_CAD_OFF, "LINUX_REBOOT_CMD_CAD_OFF" },
200 { LINUX_REBOOT_CMD_RESTART, "LINUX_REBOOT_CMD_RESTART" },
201 { LINUX_REBOOT_CMD_HALT, "LINUX_REBOOT_CMD_HALT" },
202 { LINUX_REBOOT_CMD_CAD_ON, "LINUX_REBOOT_CMD_CAD_ON" },
203 { LINUX_REBOOT_CMD_POWER_OFF, "LINUX_REBOOT_CMD_POWER_OFF" },
204 { LINUX_REBOOT_CMD_RESTART2, "LINUX_REBOOT_CMD_RESTART2" },
205 { 0, NULL },
206};
207
208int
209sys_reboot(tcp)
210struct tcb *tcp;
211{
212 if (entering(tcp)) {
Roland McGrathb2dee132005-06-01 19:02:36 +0000213 printflags(bootflags1, tcp->u_arg[0], "LINUX_REBOOT_MAGIC_???");
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000214 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000215 printflags(bootflags2, tcp->u_arg[1], "LINUX_REBOOT_MAGIC_???");
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000216 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000217 printflags(bootflags3, tcp->u_arg[2], "LINUX_REBOOT_CMD_???");
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000218 if (tcp->u_arg[2] == LINUX_REBOOT_CMD_RESTART2) {
219 tprintf(", ");
220 printstr(tcp, tcp->u_arg[3], -1);
221 }
222 }
223 return 0;
224}
225
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000226#ifdef M68K
Roland McGrathd9f816f2004-09-04 03:39:20 +0000227static const struct xlat cacheflush_scope[] = {
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000228#ifdef FLUSH_SCOPE_LINE
229 { FLUSH_SCOPE_LINE, "FLUSH_SCOPE_LINE" },
230#endif
231#ifdef FLUSH_SCOPE_PAGE
232 { FLUSH_SCOPE_PAGE, "FLUSH_SCOPE_PAGE" },
233#endif
234#ifdef FLUSH_SCOPE_ALL
235 { FLUSH_SCOPE_ALL, "FLUSH_SCOPE_ALL" },
236#endif
237 { 0, NULL },
238};
239
Roland McGrathd9f816f2004-09-04 03:39:20 +0000240static const struct xlat cacheflush_flags[] = {
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000241#ifdef FLUSH_CACHE_BOTH
242 { FLUSH_CACHE_BOTH, "FLUSH_CACHE_BOTH" },
243#endif
244#ifdef FLUSH_CACHE_DATA
245 { FLUSH_CACHE_DATA, "FLUSH_CACHE_DATA" },
246#endif
247#ifdef FLUSH_CACHE_INSN
248 { FLUSH_CACHE_INSN, "FLUSH_CACHE_INSN" },
249#endif
250 { 0, NULL },
251};
252
253int
254sys_cacheflush(tcp)
255struct tcb *tcp;
256{
257 if (entering(tcp)) {
258 /* addr */
259 tprintf("%#lx, ", tcp->u_arg[0]);
260 /* scope */
261 printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
262 tprintf(", ");
263 /* flags */
Roland McGrathb2dee132005-06-01 19:02:36 +0000264 printflags(cacheflush_flags, tcp->u_arg[2], "FLUSH_CACHE_???");
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000265 /* len */
266 tprintf(", %lu", tcp->u_arg[3]);
267 }
268 return 0;
269}
270#endif /* M68K */
271
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000272#endif /* LINUX */
273
274#ifdef SUNOS4
275
276#include <sys/reboot.h>
277#define NFSCLIENT
278#define LOFS
279#define RFS
280#define PCFS
281#include <sys/mount.h>
282#include <sys/socket.h>
283#include <nfs/export.h>
284#include <rpc/types.h>
285#include <rpc/auth.h>
286
287/*ARGSUSED*/
288int
289sys_sync(tcp)
290struct tcb *tcp;
291{
292 return 0;
293}
294
Roland McGrathd9f816f2004-09-04 03:39:20 +0000295static const struct xlat bootflags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000296 { RB_AUTOBOOT, "RB_AUTOBOOT" }, /* for system auto-booting itself */
297 { RB_ASKNAME, "RB_ASKNAME" }, /* ask for file name to reboot from */
298 { RB_SINGLE, "RB_SINGLE" }, /* reboot to single user only */
299 { RB_NOSYNC, "RB_NOSYNC" }, /* dont sync before reboot */
300 { RB_HALT, "RB_HALT" }, /* don't reboot, just halt */
301 { RB_INITNAME, "RB_INITNAME" }, /* name given for /etc/init */
302 { RB_NOBOOTRC, "RB_NOBOOTRC" }, /* don't run /etc/rc.boot */
303 { RB_DEBUG, "RB_DEBUG" }, /* being run under debugger */
304 { RB_DUMP, "RB_DUMP" }, /* dump system core */
305 { RB_WRITABLE, "RB_WRITABLE" }, /* mount root read/write */
306 { RB_STRING, "RB_STRING" }, /* pass boot args to prom monitor */
307 { 0, NULL },
308};
309
310int
311sys_reboot(tcp)
312struct tcb *tcp;
313{
314 if (entering(tcp)) {
Roland McGrathb2dee132005-06-01 19:02:36 +0000315 printflags(bootflags, tcp->u_arg[0], "RB_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000316 if (tcp->u_arg[0] & RB_STRING) {
317 printstr(tcp, tcp->u_arg[1], -1);
318 }
319 }
320 return 0;
321}
322
323int
324sys_sysacct(tcp)
325struct tcb *tcp;
326{
327 if (entering(tcp)) {
328 printstr(tcp, tcp->u_arg[0], -1);
329 }
330 return 0;
331}
332
333int
334sys_swapon(tcp)
335struct tcb *tcp;
336{
337 if (entering(tcp)) {
338 printstr(tcp, tcp->u_arg[0], -1);
339 }
340 return 0;
341}
342
343int
344sys_nfs_svc(tcp)
345struct tcb *tcp;
346{
347 if (entering(tcp)) {
348 printsock(tcp, tcp->u_arg[0]);
349 }
350 return 0;
351}
352
Roland McGrathd9f816f2004-09-04 03:39:20 +0000353static const struct xlat mountflags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000354 { M_RDONLY, "M_RDONLY" },
355 { M_NOSUID, "M_NOSUID" },
356 { M_NEWTYPE, "M_NEWTYPE" },
357 { M_GRPID, "M_GRPID" },
358#ifdef M_REMOUNT
359 { M_REMOUNT, "M_REMOUNT" },
360#endif
361#ifdef M_NOSUB
362 { M_NOSUB, "M_NOSUB" },
363#endif
364#ifdef M_MULTI
365 { M_MULTI, "M_MULTI" },
366#endif
367#ifdef M_SYS5
368 { M_SYS5, "M_SYS5" },
369#endif
370 { 0, NULL },
371};
372
Roland McGrathd9f816f2004-09-04 03:39:20 +0000373static const struct xlat nfsflags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000374 { NFSMNT_SOFT, "NFSMNT_SOFT" },
375 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
376 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
377 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
378 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
379 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
380 { NFSMNT_INT, "NFSMNT_INT" },
381 { NFSMNT_NOAC, "NFSMNT_NOAC" },
382 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
383 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
384 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
385 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
386#ifdef NFSMNT_SECURE
387 { NFSMNT_SECURE, "NFSMNT_SECURE" },
388#endif
389#ifdef NFSMNT_NOCTO
390 { NFSMNT_NOCTO, "NFSMNT_NOCTO" },
391#endif
392#ifdef NFSMNT_POSIX
393 { NFSMNT_POSIX, "NFSMNT_POSIX" },
394#endif
395 { 0, NULL },
396};
397
398int
399sys_mount(tcp)
400struct tcb *tcp;
401{
402 char type[4];
403
404 if (entering(tcp)) {
405 if (!(tcp->u_arg[2] & M_NEWTYPE) || umovestr(tcp,
406 tcp->u_arg[0], sizeof type, type) < 0) {
407 tprintf("OLDTYPE:#%lx", tcp->u_arg[0]);
408 } else {
409 tprintf("\"%s\", ", type);
410 }
411 printstr(tcp, tcp->u_arg[1], -1);
412 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000413 printflags(mountflags, tcp->u_arg[2] & ~M_NEWTYPE, "M_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000414 tprintf(", ");
415
416 if (strcmp(type, "4.2") == 0) {
417 struct ufs_args a;
418 if (umove(tcp, tcp->u_arg[3], &a) < 0)
419 return 0;
420 printstr(tcp, (int)a.fspec, -1);
421 } else if (strcmp(type, "lo") == 0) {
422 struct lo_args a;
423 if (umove(tcp, tcp->u_arg[3], &a) < 0)
424 return 0;
425 printstr(tcp, (int)a.fsdir, -1);
426 } else if (strcmp(type, "nfs") == 0) {
427 struct nfs_args a;
428 if (umove(tcp, tcp->u_arg[3], &a) < 0)
429 return 0;
430 tprintf("[");
431 printsock(tcp, (int) a.addr);
432 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000433 printflags(nfsflags, a.flags, "NFSMNT_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000434 tprintf(", ws:%u,rs:%u,to:%u,re:%u,",
435 a.wsize, a.rsize, a.timeo, a.retrans);
436 if (a.flags & NFSMNT_HOSTNAME && a.hostname)
437 printstr(tcp, (int)a.hostname, -1);
438 else
439 tprintf("%#lx", (unsigned long) a.hostname);
440 tprintf(",reg-min:%u,max:%u,dir-min:%u,max:%u,",
441 a.acregmin, a.acregmax, a.acdirmin, a.acdirmax);
442 if ((a.flags & NFSMNT_SECURE) && a.netname)
443 printstr(tcp, (int) a.netname, -1);
444 else
445 tprintf("%#lx", (unsigned long) a.netname);
446 tprintf("]");
447 } else if (strcmp(type, "rfs") == 0) {
448 struct rfs_args a;
449 struct token t;
450 if (umove(tcp, tcp->u_arg[3], &a) < 0)
451 return 0;
452 tprintf("[");
453 printstr(tcp, (int)a.rmtfs, -1);
454 if (umove(tcp, (int)a.token, &t) < 0)
455 return 0;
456 tprintf(", %u, %s]", t.t_id, t.t_uname);
457 } else if (strcmp(type, "pcfs") == 0) {
458 struct pc_args a;
459 if (umove(tcp, tcp->u_arg[3], &a) < 0)
460 return 0;
461 printstr(tcp, (int)a.fspec, -1);
462 }
463 }
464 return 0;
465}
466
467int
468sys_unmount(tcp)
469struct tcb *tcp;
470{
471 if (entering(tcp)) {
472 printstr(tcp, tcp->u_arg[0], -1);
473 }
474 return 0;
475}
476
477int
478sys_umount(tcp)
479struct tcb *tcp;
480{
481 return sys_unmount(tcp);
482}
483
484int
485sys_auditsys(tcp)
486struct tcb *tcp;
487{
488 /* XXX - no information available */
489 return printargs(tcp);
490}
491
Roland McGrathd9f816f2004-09-04 03:39:20 +0000492static const struct xlat ex_auth_flags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000493 { AUTH_UNIX, "AUTH_UNIX" },
494 { AUTH_DES, "AUTH_DES" },
495 { 0, NULL },
496};
497
498int
499sys_exportfs(tcp)
500struct tcb *tcp;
501{
502 struct export e;
503 int i;
504
505 if (entering(tcp)) {
506 printstr(tcp, tcp->u_arg[0], -1);
507 if (umove(tcp, tcp->u_arg[1], &e) < 0) {
508 tprintf("%#lx", tcp->u_arg[1]);
509 return 0;
510 }
511 tprintf("{fl:%u, anon:%u, ", e.ex_flags, e.ex_anon);
512 printxval(ex_auth_flags, e.ex_auth, "AUTH_???");
513 tprintf(", roots:[");
514 if (e.ex_auth == AUTH_UNIX) {
515 for (i=0; i<e.ex_u.exunix.rootaddrs.naddrs; i++) {
516 printsock(tcp,
517 (int)&e.ex_u.exunix.rootaddrs.addrvec[i]);
518 }
519 tprintf("], writers:[");
520 for (i=0; i<e.ex_writeaddrs.naddrs; i++) {
521 printsock(tcp,
522 (int)&e.ex_writeaddrs.addrvec[i]);
523 }
524 tprintf("]");
525 } else {
526 for (i=0; i<e.ex_u.exdes.nnames; i++) {
527 printsock(tcp,
528 (int)&e.ex_u.exdes.rootnames[i]);
529 tprintf(", ");
530 }
531 tprintf("], window:%u", e.ex_u.exdes.window);
532 }
533 tprintf("}");
534 }
535 return 0;
536}
537
Roland McGrathd9f816f2004-09-04 03:39:20 +0000538static const struct xlat sysconflimits[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000539#ifdef _SC_ARG_MAX
540 { _SC_ARG_MAX, "_SC_ARG_MAX" }, /* space for argv & envp */
541#endif
542#ifdef _SC_CHILD_MAX
543 { _SC_CHILD_MAX, "_SC_CHILD_MAX" }, /* maximum children per process??? */
544#endif
545#ifdef _SC_CLK_TCK
546 { _SC_CLK_TCK, "_SC_CLK_TCK" }, /* clock ticks/sec */
547#endif
548#ifdef _SC_NGROUPS_MAX
549 { _SC_NGROUPS_MAX, "_SC_NGROUPS_MAX" }, /* number of groups if multple supp. */
550#endif
551#ifdef _SC_OPEN_MAX
552 { _SC_OPEN_MAX, "_SC_OPEN_MAX" }, /* max open files per process */
553#endif
554#ifdef _SC_JOB_CONTROL
555 { _SC_JOB_CONTROL, "_SC_JOB_CONTROL" }, /* do we have job control */
556#endif
557#ifdef _SC_SAVED_IDS
558 { _SC_SAVED_IDS, "_SC_SAVED_IDS" }, /* do we have saved uid/gids */
559#endif
560#ifdef _SC_VERSION
561 { _SC_VERSION, "_SC_VERSION" }, /* POSIX version supported */
562#endif
563 { 0, NULL },
564};
565
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000566int
567sys_sysconf(tcp)
568struct tcb *tcp;
569{
570 if (entering(tcp)) {
571 printxval(sysconflimits, tcp->u_arg[0], "_SC_???");
572 }
573 return 0;
574}
575
576#endif /* SUNOS4 */
577
578#if defined(SUNOS4) || defined(FREEBSD)
Roland McGrathd9f816f2004-09-04 03:39:20 +0000579static const struct xlat pathconflimits[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000580#ifdef _PC_LINK_MAX
581 { _PC_LINK_MAX, "_PC_LINK_MAX" }, /* max links to file/dir */
582#endif
583#ifdef _PC_MAX_CANON
584 { _PC_MAX_CANON, "_PC_MAX_CANON" }, /* max line length */
585#endif
586#ifdef _PC_MAX_INPUT
587 { _PC_MAX_INPUT, "_PC_MAX_INPUT" }, /* max "packet" to a tty device */
588#endif
589#ifdef _PC_NAME_MAX
590 { _PC_NAME_MAX, "_PC_NAME_MAX" }, /* max pathname component length */
591#endif
592#ifdef _PC_PATH_MAX
593 { _PC_PATH_MAX, "_PC_PATH_MAX" }, /* max pathname length */
594#endif
595#ifdef _PC_PIPE_BUF
596 { _PC_PIPE_BUF, "_PC_PIPE_BUF" }, /* size of a pipe */
597#endif
598#ifdef _PC_CHOWN_RESTRICTED
599 { _PC_CHOWN_RESTRICTED, "_PC_CHOWN_RESTRICTED" }, /* can we give away files */
600#endif
601#ifdef _PC_NO_TRUNC
602 { _PC_NO_TRUNC, "_PC_NO_TRUNC" }, /* trunc or error on >NAME_MAX */
603#endif
604#ifdef _PC_VDISABLE
605 { _PC_VDISABLE, "_PC_VDISABLE" }, /* best char to shut off tty c_cc */
606#endif
607 { 0, NULL },
608};
609
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000610
611int
612sys_pathconf(tcp)
613struct tcb *tcp;
614{
615 if (entering(tcp)) {
616 printstr(tcp, tcp->u_arg[0], -1);
617 tprintf(", ");
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000618 printxval(pathconflimits, tcp->u_arg[1], "_PC_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000619 }
620 return 0;
621}
622
623int
624sys_fpathconf(tcp)
625struct tcb *tcp;
626{
627 if (entering(tcp)) {
628 tprintf("%lu, ", tcp->u_arg[0]);
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000629 printxval(pathconflimits, tcp->u_arg[1], "_PC_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000630 }
631 return 0;
632}
633
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000634#endif /* SUNOS4 || FREEBSD */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000635
636#ifdef SVR4
637
638#ifdef HAVE_SYS_SYSCONFIG_H
639#include <sys/sysconfig.h>
640#endif /* HAVE_SYS_SYSCONFIG_H */
641
642#include <sys/mount.h>
643#include <sys/systeminfo.h>
644#include <sys/utsname.h>
645
Roland McGrathd9f816f2004-09-04 03:39:20 +0000646static const struct xlat sysconfig_options[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000647#ifdef _CONFIG_NGROUPS
648 { _CONFIG_NGROUPS, "_CONFIG_NGROUPS" },
649#endif
650#ifdef _CONFIG_CHILD_MAX
651 { _CONFIG_CHILD_MAX, "_CONFIG_CHILD_MAX" },
652#endif
653#ifdef _CONFIG_OPEN_FILES
654 { _CONFIG_OPEN_FILES, "_CONFIG_OPEN_FILES" },
655#endif
656#ifdef _CONFIG_POSIX_VER
657 { _CONFIG_POSIX_VER, "_CONFIG_POSIX_VER" },
658#endif
659#ifdef _CONFIG_PAGESIZE
660 { _CONFIG_PAGESIZE, "_CONFIG_PAGESIZE" },
661#endif
662#ifdef _CONFIG_CLK_TCK
663 { _CONFIG_CLK_TCK, "_CONFIG_CLK_TCK" },
664#endif
665#ifdef _CONFIG_XOPEN_VER
666 { _CONFIG_XOPEN_VER, "_CONFIG_XOPEN_VER" },
667#endif
668#ifdef _CONFIG_PROF_TCK
669 { _CONFIG_PROF_TCK, "_CONFIG_PROF_TCK" },
670#endif
671#ifdef _CONFIG_NPROC_CONF
672 { _CONFIG_NPROC_CONF, "_CONFIG_NPROC_CONF" },
673#endif
674#ifdef _CONFIG_NPROC_ONLN
675 { _CONFIG_NPROC_ONLN, "_CONFIG_NPROC_ONLN" },
676#endif
677#ifdef _CONFIG_AIO_LISTIO_MAX
678 { _CONFIG_AIO_LISTIO_MAX, "_CONFIG_AIO_LISTIO_MAX" },
679#endif
680#ifdef _CONFIG_AIO_MAX
681 { _CONFIG_AIO_MAX, "_CONFIG_AIO_MAX" },
682#endif
683#ifdef _CONFIG_AIO_PRIO_DELTA_MAX
684 { _CONFIG_AIO_PRIO_DELTA_MAX, "_CONFIG_AIO_PRIO_DELTA_MAX" },
685#endif
686#ifdef _CONFIG_CONFIG_DELAYTIMER_MAX
687 { _CONFIG_DELAYTIMER_MAX, "_CONFIG_DELAYTIMER_MAX" },
688#endif
689#ifdef _CONFIG_MQ_OPEN_MAX
690 { _CONFIG_MQ_OPEN_MAX, "_CONFIG_MQ_OPEN_MAX" },
691#endif
692#ifdef _CONFIG_MQ_PRIO_MAX
693 { _CONFIG_MQ_PRIO_MAX, "_CONFIG_MQ_PRIO_MAX" },
694#endif
695#ifdef _CONFIG_RTSIG_MAX
696 { _CONFIG_RTSIG_MAX, "_CONFIG_RTSIG_MAX" },
697#endif
698#ifdef _CONFIG_SEM_NSEMS_MAX
699 { _CONFIG_SEM_NSEMS_MAX, "_CONFIG_SEM_NSEMS_MAX" },
700#endif
701#ifdef _CONFIG_SEM_VALUE_MAX
702 { _CONFIG_SEM_VALUE_MAX, "_CONFIG_SEM_VALUE_MAX" },
703#endif
704#ifdef _CONFIG_SIGQUEUE_MAX
705 { _CONFIG_SIGQUEUE_MAX, "_CONFIG_SIGQUEUE_MAX" },
706#endif
707#ifdef _CONFIG_SIGRT_MIN
708 { _CONFIG_SIGRT_MIN, "_CONFIG_SIGRT_MIN" },
709#endif
710#ifdef _CONFIG_SIGRT_MAX
711 { _CONFIG_SIGRT_MAX, "_CONFIG_SIGRT_MAX" },
712#endif
713#ifdef _CONFIG_TIMER_MAX
714 { _CONFIG_TIMER_MAX, "_CONFIG_TIMER_MAX" },
715#endif
716#ifdef _CONFIG_CONFIG_PHYS_PAGES
717 { _CONFIG_PHYS_PAGES, "_CONFIG_PHYS_PAGES" },
718#endif
719#ifdef _CONFIG_AVPHYS_PAGES
720 { _CONFIG_AVPHYS_PAGES, "_CONFIG_AVPHYS_PAGES" },
721#endif
722 { 0, NULL },
723};
724
725int
726sys_sysconfig(tcp)
727struct tcb *tcp;
728{
729 if (entering(tcp))
730 printxval(sysconfig_options, tcp->u_arg[0], "_CONFIG_???");
731 return 0;
732}
733
Roland McGrathd9f816f2004-09-04 03:39:20 +0000734static const struct xlat sysinfo_options[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000735 { SI_SYSNAME, "SI_SYSNAME" },
736 { SI_HOSTNAME, "SI_HOSTNAME" },
737 { SI_RELEASE, "SI_RELEASE" },
738 { SI_VERSION, "SI_VERSION" },
739 { SI_MACHINE, "SI_MACHINE" },
740 { SI_ARCHITECTURE, "SI_ARCHITECTURE" },
741 { SI_HW_SERIAL, "SI_HW_SERIAL" },
742 { SI_HW_PROVIDER, "SI_HW_PROVIDER" },
743 { SI_SRPC_DOMAIN, "SI_SRPC_DOMAIN" },
744#ifdef SI_SET_HOSTNAME
745 { SI_SET_HOSTNAME, "SI_SET_HOSTNAME" },
746#endif
747#ifdef SI_SET_SRPC_DOMAIN
748 { SI_SET_SRPC_DOMAIN, "SI_SET_SRPC_DOMAIN" },
749#endif
750#ifdef SI_SET_KERB_REALM
751 { SI_SET_KERB_REALM, "SI_SET_KERB_REALM" },
752#endif
753#ifdef SI_KERB_REALM
754 { SI_KERB_REALM, "SI_KERB_REALM" },
755#endif
756 { 0, NULL },
757};
758
759int
760sys_sysinfo(tcp)
761struct tcb *tcp;
762{
763 if (entering(tcp)) {
764 printxval(sysinfo_options, tcp->u_arg[0], "SI_???");
765 tprintf(", ");
766 }
767 else {
768 /* Technically some calls write values. So what. */
769 if (syserror(tcp))
770 tprintf("%#lx", tcp->u_arg[1]);
771 else
772 printpath(tcp, tcp->u_arg[1]);
773 tprintf(", %lu", tcp->u_arg[2]);
774 }
775 return 0;
776}
777
778#ifdef MIPS
779
780#include <sys/syssgi.h>
781
Roland McGrathd9f816f2004-09-04 03:39:20 +0000782static const struct xlat syssgi_options[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000783 { SGI_SYSID, "SGI_SYSID" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000784#ifdef SGI_RDUBLK
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000785 { SGI_RDUBLK, "SGI_RDUBLK" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000786#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000787 { SGI_TUNE, "SGI_TUNE" },
788 { SGI_IDBG, "SGI_IDBG" },
789 { SGI_INVENT, "SGI_INVENT" },
790 { SGI_RDNAME, "SGI_RDNAME" },
791 { SGI_SETLED, "SGI_SETLED" },
792 { SGI_SETNVRAM, "SGI_SETNVRAM" },
793 { SGI_GETNVRAM, "SGI_GETNVRAM" },
794 { SGI_QUERY_FTIMER, "SGI_QUERY_FTIMER" },
795 { SGI_QUERY_CYCLECNTR, "SGI_QUERY_CYCLECNTR" },
796 { SGI_PROCSZ, "SGI_PROCSZ" },
797 { SGI_SIGACTION, "SGI_SIGACTION" },
798 { SGI_SIGPENDING, "SGI_SIGPENDING" },
799 { SGI_SIGPROCMASK, "SGI_SIGPROCMASK" },
800 { SGI_SIGSUSPEND, "SGI_SIGSUSPEND" },
801 { SGI_SETSID, "SGI_SETSID" },
802 { SGI_SETPGID, "SGI_SETPGID" },
803 { SGI_SYSCONF, "SGI_SYSCONF" },
804 { SGI_WAIT4, "SGI_WAIT4" },
805 { SGI_PATHCONF, "SGI_PATHCONF" },
806 { SGI_READB, "SGI_READB" },
807 { SGI_WRITEB, "SGI_WRITEB" },
808 { SGI_SETGROUPS, "SGI_SETGROUPS" },
809 { SGI_GETGROUPS, "SGI_GETGROUPS" },
810 { SGI_SETTIMEOFDAY, "SGI_SETTIMEOFDAY" },
811 { SGI_SETTIMETRIM, "SGI_SETTIMETRIM" },
812 { SGI_GETTIMETRIM, "SGI_GETTIMETRIM" },
813 { SGI_SPROFIL, "SGI_SPROFIL" },
814 { SGI_RUSAGE, "SGI_RUSAGE" },
815 { SGI_SIGSTACK, "SGI_SIGSTACK" },
816 { SGI_SIGSTATUS, "SGI_SIGSTATUS" },
817 { SGI_NETPROC, "SGI_NETPROC" },
818 { SGI_SIGALTSTACK, "SGI_SIGALTSTACK" },
819 { SGI_BDFLUSHCNT, "SGI_BDFLUSHCNT" },
820 { SGI_SSYNC, "SGI_SSYNC" },
821 { SGI_NFSCNVT, "SGI_NFSCNVT" },
822 { SGI_GETPGID, "SGI_GETPGID" },
823 { SGI_GETSID, "SGI_GETSID" },
824 { SGI_IOPROBE, "SGI_IOPROBE" },
825 { SGI_CONFIG, "SGI_CONFIG" },
826 { SGI_ELFMAP, "SGI_ELFMAP" },
827 { SGI_MCONFIG, "SGI_MCONFIG" },
828 { SGI_GETPLABEL, "SGI_GETPLABEL" },
829 { SGI_SETPLABEL, "SGI_SETPLABEL" },
830 { SGI_GETLABEL, "SGI_GETLABEL" },
831 { SGI_SETLABEL, "SGI_SETLABEL" },
832 { SGI_SATREAD, "SGI_SATREAD" },
833 { SGI_SATWRITE, "SGI_SATWRITE" },
834 { SGI_SATCTL, "SGI_SATCTL" },
835 { SGI_LOADATTR, "SGI_LOADATTR" },
836 { SGI_UNLOADATTR, "SGI_UNLOADATTR" },
837#ifdef SGI_RECVLMSG
838 { SGI_RECVLMSG, "SGI_RECVLMSG" },
839#endif
840 { SGI_PLANGMOUNT, "SGI_PLANGMOUNT" },
841 { SGI_GETPSOACL, "SGI_GETPSOACL" },
842 { SGI_SETPSOACL, "SGI_SETPSOACL" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000843#ifdef SGI_EAG_GET_ATTR
844 { SGI_EAG_GET_ATTR, "SGI_EAG_GET_ATTR" },
845#endif
846#ifdef SGI_EAG_SET_ATTR
847 { SGI_EAG_SET_ATTR, "SGI_EAG_SET_ATTR" },
848#endif
849#ifdef SGI_EAG_GET_PROCATTR
850 { SGI_EAG_GET_PROCATTR, "SGI_EAG_GET_PROCATTR" },
851#endif
852#ifdef SGI_EAG_SET_PROCATTR
853 { SGI_EAG_SET_PROCATTR, "SGI_EAG_SET_PROCATTR" },
854#endif
855#ifdef SGI_FREVOKE
856 { SGI_FREVOKE, "SGI_FREVOKE" },
857#endif
858#ifdef SGI_SBE_GET_INFO
859 { SGI_SBE_GET_INFO, "SGI_SBE_GET_INFO" },
860#endif
861#ifdef SGI_SBE_CLR_INFO
862 { SGI_SBE_CLR_INFO, "SGI_SBE_CLR_INFO" },
863#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000864 { SGI_RMI_FIXECC, "SGI_RMI_FIXECC" },
865 { SGI_R4K_CERRS, "SGI_R4K_CERRS" },
866 { SGI_GET_EVCONF, "SGI_GET_EVCONF" },
867 { SGI_MPCWAROFF, "SGI_MPCWAROFF" },
868 { SGI_SET_AUTOPWRON, "SGI_SET_AUTOPWRON" },
869 { SGI_SPIPE, "SGI_SPIPE" },
870 { SGI_SYMTAB, "SGI_SYMTAB" },
871#ifdef SGI_SET_FPDEBUG
872 { SGI_SET_FPDEBUG, "SGI_SET_FPDEBUG" },
873#endif
Wichert Akkerman8829a551999-06-11 13:18:40 +0000874#ifdef SGI_SET_FP_PRECISE
875 { SGI_SET_FP_PRECISE, "SGI_SET_FP_PRECISE" },
876#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000877 { SGI_TOSSTSAVE, "SGI_TOSSTSAVE" },
878 { SGI_FDHI, "SGI_FDHI" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000879#ifdef SGI_SET_CONFIG_SMM
880 { SGI_SET_CONFIG_SMM, "SGI_SET_CONFIG_SMM" },
881#endif
882#ifdef SGI_SET_FP_PRESERVE
883 { SGI_SET_FP_PRESERVE, "SGI_SET_FP_PRESERVE" },
884#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000885 { SGI_MINRSS, "SGI_MINRSS" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000886#ifdef SGI_GRIO
887 { SGI_GRIO, "SGI_GRIO" },
888#endif
889#ifdef SGI_XLV_SET_TAB
890 { SGI_XLV_SET_TAB, "SGI_XLV_SET_TAB" },
891#endif
892#ifdef SGI_XLV_GET_TAB
893 { SGI_XLV_GET_TAB, "SGI_XLV_GET_TAB" },
894#endif
895#ifdef SGI_GET_FP_PRECISE
896 { SGI_GET_FP_PRECISE, "SGI_GET_FP_PRECISE" },
897#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000898#ifdef SGI_GET_CONFIG_SMM
Wichert Akkerman8829a551999-06-11 13:18:40 +0000899 { SGI_GET_CONFIG_SMM, "SGI_GET_CONFIG_SMM" },
900#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000901#ifdef SGI_FP_IMPRECISE_SUPP
Wichert Akkerman8829a551999-06-11 13:18:40 +0000902 { SGI_FP_IMPRECISE_SUPP,"SGI_FP_IMPRECISE_SUPP" },
903#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000904#ifdef SGI_CONFIG_NSMM_SUPP
Wichert Akkerman8829a551999-06-11 13:18:40 +0000905 { SGI_CONFIG_NSMM_SUPP, "SGI_CONFIG_NSMM_SUPP" },
906#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000907#ifdef SGI_RT_TSTAMP_CREATE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000908 { SGI_RT_TSTAMP_CREATE, "SGI_RT_TSTAMP_CREATE" },
909#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000910#ifdef SGI_RT_TSTAMP_DELETE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000911 { SGI_RT_TSTAMP_DELETE, "SGI_RT_TSTAMP_DELETE" },
912#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000913#ifdef SGI_RT_TSTAMP_START
Wichert Akkerman8829a551999-06-11 13:18:40 +0000914 { SGI_RT_TSTAMP_START, "SGI_RT_TSTAMP_START" },
915#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000916#ifdef SGI_RT_TSTAMP_STOP
Wichert Akkerman8829a551999-06-11 13:18:40 +0000917 { SGI_RT_TSTAMP_STOP, "SGI_RT_TSTAMP_STOP" },
918#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000919#ifdef SGI_RT_TSTAMP_ADDR
Wichert Akkerman8829a551999-06-11 13:18:40 +0000920 { SGI_RT_TSTAMP_ADDR, "SGI_RT_TSTAMP_ADDR" },
921#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000922#ifdef SGI_RT_TSTAMP_MASK
Wichert Akkerman8829a551999-06-11 13:18:40 +0000923 { SGI_RT_TSTAMP_MASK, "SGI_RT_TSTAMP_MASK" },
924#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000925#ifdef SGI_RT_TSTAMP_EOB_MODE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000926 { SGI_RT_TSTAMP_EOB_MODE,"SGI_RT_TSTAMP_EOB_MODE"},
927#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000928#ifdef SGI_USE_FP_BCOPY
Wichert Akkerman8829a551999-06-11 13:18:40 +0000929 { SGI_USE_FP_BCOPY, "SGI_USE_FP_BCOPY" },
930#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000931#ifdef SGI_GET_UST
Wichert Akkerman8829a551999-06-11 13:18:40 +0000932 { SGI_GET_UST, "SGI_GET_UST" },
933#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000934#ifdef SGI_SPECULATIVE_EXEC
Wichert Akkerman8829a551999-06-11 13:18:40 +0000935 { SGI_SPECULATIVE_EXEC, "SGI_SPECULATIVE_EXEC" },
936#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000937#ifdef SGI_XLV_NEXT_RQST
Wichert Akkerman8829a551999-06-11 13:18:40 +0000938 { SGI_XLV_NEXT_RQST, "SGI_XLV_NEXT_RQST" },
939#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000940#ifdef SGI_XLV_ATTR_CURSOR
Wichert Akkerman8829a551999-06-11 13:18:40 +0000941 { SGI_XLV_ATTR_CURSOR, "SGI_XLV_ATTR_CURSOR" },
942#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000943#ifdef SGI_XLV_ATTR_GET
Wichert Akkerman8829a551999-06-11 13:18:40 +0000944 { SGI_XLV_ATTR_GET, "SGI_XLV_ATTR_GET" },
945#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000946#ifdef SGI_XLV_ATTR_SET
Wichert Akkerman8829a551999-06-11 13:18:40 +0000947 { SGI_XLV_ATTR_SET, "SGI_XLV_ATTR_SET" },
948#endif
949#ifdef SGI_BTOOLSIZE
950 { SGI_BTOOLSIZE, "SGI_BTOOLSIZE" },
951#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000952#ifdef SGI_BTOOLGET
Wichert Akkerman8829a551999-06-11 13:18:40 +0000953 { SGI_BTOOLGET, "SGI_BTOOLGET" },
954#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000955#ifdef SGI_BTOOLREINIT
Wichert Akkerman8829a551999-06-11 13:18:40 +0000956 { SGI_BTOOLREINIT, "SGI_BTOOLREINIT" },
957#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000958#ifdef SGI_CREATE_UUID
Wichert Akkerman8829a551999-06-11 13:18:40 +0000959 { SGI_CREATE_UUID, "SGI_CREATE_UUID" },
960#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000961#ifdef SGI_NOFPE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000962 { SGI_NOFPE, "SGI_NOFPE" },
963#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000964#ifdef SGI_OLD_SOFTFP
Wichert Akkerman8829a551999-06-11 13:18:40 +0000965 { SGI_OLD_SOFTFP, "SGI_OLD_SOFTFP" },
966#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000967#ifdef SGI_FS_INUMBERS
Wichert Akkerman8829a551999-06-11 13:18:40 +0000968 { SGI_FS_INUMBERS, "SGI_FS_INUMBERS" },
969#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000970#ifdef SGI_FS_BULKSTAT
Wichert Akkerman8829a551999-06-11 13:18:40 +0000971 { SGI_FS_BULKSTAT, "SGI_FS_BULKSTAT" },
972#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000973#ifdef SGI_RT_TSTAMP_WAIT
Wichert Akkerman8829a551999-06-11 13:18:40 +0000974 { SGI_RT_TSTAMP_WAIT, "SGI_RT_TSTAMP_WAIT" },
975#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000976#ifdef SGI_RT_TSTAMP_UPDATE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000977 { SGI_RT_TSTAMP_UPDATE, "SGI_RT_TSTAMP_UPDATE" },
978#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000979#ifdef SGI_PATH_TO_HANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000980 { SGI_PATH_TO_HANDLE, "SGI_PATH_TO_HANDLE" },
981#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000982#ifdef SGI_PATH_TO_FSHANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000983 { SGI_PATH_TO_FSHANDLE, "SGI_PATH_TO_FSHANDLE" },
984#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000985#ifdef SGI_FD_TO_HANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000986 { SGI_FD_TO_HANDLE, "SGI_FD_TO_HANDLE" },
987#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000988#ifdef SGI_OPEN_BY_HANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000989 { SGI_OPEN_BY_HANDLE, "SGI_OPEN_BY_HANDLE" },
990#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000991#ifdef SGI_READLINK_BY_HANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000992 { SGI_READLINK_BY_HANDLE,"SGI_READLINK_BY_HANDLE"},
993#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000994#ifdef SGI_READ_DANGID
Wichert Akkerman8829a551999-06-11 13:18:40 +0000995 { SGI_READ_DANGID, "SGI_READ_DANGID" },
996#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000997#ifdef SGI_CONST
Wichert Akkerman8829a551999-06-11 13:18:40 +0000998 { SGI_CONST, "SGI_CONST" },
999#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001000#ifdef SGI_XFS_FSOPERATIONS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001001 { SGI_XFS_FSOPERATIONS, "SGI_XFS_FSOPERATIONS" },
1002#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001003#ifdef SGI_SETASH
Wichert Akkerman8829a551999-06-11 13:18:40 +00001004 { SGI_SETASH, "SGI_SETASH" },
1005#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001006#ifdef SGI_GETASH
Wichert Akkerman8829a551999-06-11 13:18:40 +00001007 { SGI_GETASH, "SGI_GETASH" },
1008#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001009#ifdef SGI_SETPRID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001010 { SGI_SETPRID, "SGI_SETPRID" },
1011#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001012#ifdef SGI_GETPRID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001013 { SGI_GETPRID, "SGI_GETPRID" },
1014#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001015#ifdef SGI_SETSPINFO
Wichert Akkerman8829a551999-06-11 13:18:40 +00001016 { SGI_SETSPINFO, "SGI_SETSPINFO" },
1017#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001018#ifdef SGI_GETSPINFO
Wichert Akkerman8829a551999-06-11 13:18:40 +00001019 { SGI_GETSPINFO, "SGI_GETSPINFO" },
1020#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001021#ifdef SGI_SHAREII
Wichert Akkerman8829a551999-06-11 13:18:40 +00001022 { SGI_SHAREII, "SGI_SHAREII" },
1023#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001024#ifdef SGI_NEWARRAYSESS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001025 { SGI_NEWARRAYSESS, "SGI_NEWARRAYSESS" },
1026#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001027#ifdef SGI_GETDFLTPRID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001028 { SGI_GETDFLTPRID, "SGI_GETDFLTPRID" },
1029#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001030#ifdef SGI_SET_DISMISSED_EXC_CNT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001031 { SGI_SET_DISMISSED_EXC_CNT,"SGI_SET_DISMISSED_EXC_CNT" },
1032#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001033#ifdef SGI_GET_DISMISSED_EXC_CNT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001034 { SGI_GET_DISMISSED_EXC_CNT,"SGI_GET_DISMISSED_EXC_CNT" },
1035#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001036#ifdef SGI_CYCLECNTR_SIZE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001037 { SGI_CYCLECNTR_SIZE, "SGI_CYCLECNTR_SIZE" },
1038#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001039#ifdef SGI_QUERY_FASTTIMER
Wichert Akkerman8829a551999-06-11 13:18:40 +00001040 { SGI_QUERY_FASTTIMER, "SGI_QUERY_FASTTIMER" },
1041#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001042#ifdef SGI_PIDSINASH
Wichert Akkerman8829a551999-06-11 13:18:40 +00001043 { SGI_PIDSINASH, "SGI_PIDSINASH" },
1044#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001045#ifdef SGI_ULI
Wichert Akkerman8829a551999-06-11 13:18:40 +00001046 { SGI_ULI, "SGI_ULI" },
1047#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001048#ifdef SGI_LPG_SHMGET
Wichert Akkerman8829a551999-06-11 13:18:40 +00001049 { SGI_LPG_SHMGET, "SGI_LPG_SHMGET" },
1050#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001051#ifdef SGI_LPG_MAP
Wichert Akkerman8829a551999-06-11 13:18:40 +00001052 { SGI_LPG_MAP, "SGI_LPG_MAP" },
1053#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001054#ifdef SGI_CACHEFS_SYS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001055 { SGI_CACHEFS_SYS, "SGI_CACHEFS_SYS" },
1056#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001057#ifdef SGI_NFSNOTIFY
Wichert Akkerman8829a551999-06-11 13:18:40 +00001058 { SGI_NFSNOTIFY, "SGI_NFSNOTIFY" },
1059#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001060#ifdef SGI_LOCKDSYS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001061 { SGI_LOCKDSYS, "SGI_LOCKDSYS" },
1062#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001063#ifdef SGI_EVENTCTR
Wichert Akkerman8829a551999-06-11 13:18:40 +00001064 { SGI_EVENTCTR, "SGI_EVENTCTR" },
1065#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001066#ifdef SGI_GETPRUSAGE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001067 { SGI_GETPRUSAGE, "SGI_GETPRUSAGE" },
1068#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001069#ifdef SGI_PROCMASK_LOCATION
Wichert Akkerman8829a551999-06-11 13:18:40 +00001070 { SGI_PROCMASK_LOCATION,"SGI_PROCMASK_LOCATION" },
1071#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001072#ifdef SGI_UNUSED
Wichert Akkerman8829a551999-06-11 13:18:40 +00001073 { SGI_UNUSED, "SGI_UNUSED" },
1074#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001075#ifdef SGI_CKPT_SYS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001076 { SGI_CKPT_SYS, "SGI_CKPT_SYS" },
1077#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001078#ifdef SGI_CKPT_SYS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001079 { SGI_CKPT_SYS, "SGI_CKPT_SYS" },
1080#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001081#ifdef SGI_GETGRPPID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001082 { SGI_GETGRPPID, "SGI_GETGRPPID" },
1083#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001084#ifdef SGI_GETSESPID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001085 { SGI_GETSESPID, "SGI_GETSESPID" },
1086#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001087#ifdef SGI_ENUMASHS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001088 { SGI_ENUMASHS, "SGI_ENUMASHS" },
1089#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001090#ifdef SGI_SETASMACHID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001091 { SGI_SETASMACHID, "SGI_SETASMACHID" },
1092#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001093#ifdef SGI_GETASMACHID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001094 { SGI_GETASMACHID, "SGI_GETASMACHID" },
1095#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001096#ifdef SGI_GETARSESS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001097 { SGI_GETARSESS, "SGI_GETARSESS" },
1098#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001099#ifdef SGI_JOINARRAYSESS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001100 { SGI_JOINARRAYSESS, "SGI_JOINARRAYSESS" },
1101#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001102#ifdef SGI_SPROC_KILL
Wichert Akkerman8829a551999-06-11 13:18:40 +00001103 { SGI_SPROC_KILL, "SGI_SPROC_KILL" },
1104#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001105#ifdef SGI_DBA_CONFIG
Wichert Akkerman8829a551999-06-11 13:18:40 +00001106 { SGI_DBA_CONFIG, "SGI_DBA_CONFIG" },
1107#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001108#ifdef SGI_RELEASE_NAME
Wichert Akkerman8829a551999-06-11 13:18:40 +00001109 { SGI_RELEASE_NAME, "SGI_RELEASE_NAME" },
1110#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001111#ifdef SGI_SYNCH_CACHE_HANDLER
Wichert Akkerman8829a551999-06-11 13:18:40 +00001112 { SGI_SYNCH_CACHE_HANDLER,"SGI_SYNCH_CACHE_HANDLER"},
1113#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001114#ifdef SGI_SWASH_INIT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001115 { SGI_SWASH_INIT, "SGI_SWASH_INIT" },
1116#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001117#ifdef SGI_NUMA_MIGR_PAGE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001118 { SGI_NUMA_MIGR_PAGE, "SGI_NUMA_MIGR_PAGE" },
1119#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001120#ifdef SGI_NUMA_MIGR_PAGE_ALT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001121 { SGI_NUMA_MIGR_PAGE_ALT,"SGI_NUMA_MIGR_PAGE_ALT"},
1122#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001123#ifdef SGI_KAIO_USERINIT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001124 { SGI_KAIO_USERINIT, "SGI_KAIO_USERINIT" },
1125#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001126#ifdef SGI_KAIO_READ
Wichert Akkerman8829a551999-06-11 13:18:40 +00001127 { SGI_KAIO_READ, "SGI_KAIO_READ" },
1128#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001129#ifdef SGI_KAIO_WRITE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001130 { SGI_KAIO_WRITE, "SGI_KAIO_WRITE" },
1131#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001132#ifdef SGI_KAIO_SUSPEND
Wichert Akkerman8829a551999-06-11 13:18:40 +00001133 { SGI_KAIO_SUSPEND, "SGI_KAIO_SUSPEND" },
1134#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001135#ifdef SGI_KAIO_STATS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001136 { SGI_KAIO_STATS, "SGI_KAIO_STATS" },
1137#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001138#ifdef SGI_INITIAL_PT_SPROC
Wichert Akkerman8829a551999-06-11 13:18:40 +00001139 { SGI_INITIAL_PT_SPROC, "SGI_INITIAL_PT_SPROC" },
1140#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001141 { 0, NULL },
1142};
1143
1144int
1145sys_syssgi(tcp)
1146struct tcb *tcp;
1147{
1148 int i;
1149
1150 if (entering(tcp)) {
1151 printxval(syssgi_options, tcp->u_arg[0], "SGI_???");
1152 switch (tcp->u_arg[0]) {
1153 default:
1154 for (i = 1; i < tcp->u_nargs; i++)
1155 tprintf(", %#lx", tcp->u_arg[i]);
1156 break;
1157 }
1158 }
1159 return 0;
1160}
1161
1162#include <sys/types.h>
1163#include <rpc/rpc.h>
1164struct cred;
1165struct uio;
1166#include <sys/fsid.h>
1167#include <sys/vnode.h>
1168#include <sys/fs/nfs.h>
1169#include <sys/fs/nfs_clnt.h>
1170
Roland McGrathd9f816f2004-09-04 03:39:20 +00001171static const struct xlat mount_flags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001172 { MS_RDONLY, "MS_RDONLY" },
1173 { MS_FSS, "MS_FSS" },
1174 { MS_DATA, "MS_DATA" },
1175 { MS_NOSUID, "MS_NOSUID" },
1176 { MS_REMOUNT, "MS_REMOUNT" },
1177 { MS_NOTRUNC, "MS_NOTRUNC" },
1178 { MS_GRPID, "MS_GRPID" },
1179 { MS_NODEV, "MS_NODEV" },
1180 { MS_BEFORE, "MS_BEFORE" },
1181 { MS_AFTER, "MS_AFTER" },
1182 { 0, NULL },
1183};
1184
Roland McGrathd9f816f2004-09-04 03:39:20 +00001185static const struct xlat nfs_flags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001186 { NFSMNT_SOFT, "NFSMNT_SOFT" },
1187 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
1188 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
1189 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
1190 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
1191 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001192#ifdef NFSMNT_NOINT /* IRIX 6 */
1193 { NFSMNT_NOINT, "NFSMNT_NOINT" },
1194#endif
1195#ifdef NFSMNT_INT /* IRIX 5 */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001196 { NFSMNT_INT, "NFSMNT_INT" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001197#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001198 { NFSMNT_NOAC, "NFSMNT_NOAC" },
1199 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
1200 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
1201 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
1202 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
1203 { NFSMNT_PRIVATE, "NFSMNT_PRIVATE" },
1204 { NFSMNT_SYMTTL, "NFSMNT_SYMTTL" },
1205 { NFSMNT_LOOPBACK, "NFSMNT_LOOPBACK" },
1206 { NFSMNT_BASETYPE, "NFSMNT_BASETYPE" },
1207 { NFSMNT_NAMEMAX, "NFSMNT_NAMEMAX" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001208#ifdef NFSMNT_SHORTUID /* IRIX 6 */
1209 { NFSMNT_SHORTUID, "NFSMNT_SHORTUID" },
1210#endif
1211#ifdef NFSMNT_ASYNCNLM /* IRIX 6 */
1212 { NFSMNT_ASYNCNLM, "NFSMNT_ASYNCNLM" },
1213#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001214 { 0, NULL },
1215};
1216
1217int
1218sys_mount(tcp)
1219struct tcb *tcp;
1220{
1221 if (entering(tcp)) {
1222 printpath(tcp, tcp->u_arg[0]);
1223 tprintf(", ");
1224 printpath(tcp, tcp->u_arg[1]);
1225 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001226 printflags(mount_flags, tcp->u_arg[2], "MS_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001227 if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
1228 tprintf(", ");
1229 tprintf("%ld", tcp->u_arg[3]);
1230 }
1231 if (tcp->u_arg[2] & MS_DATA) {
1232 int nfs_type = sysfs(GETFSIND, FSID_NFS);
1233
1234 tprintf(", ");
1235 if (tcp->u_arg[3] == nfs_type) {
1236 struct nfs_args args;
1237 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1238 tprintf("%#lx", tcp->u_arg[4]);
1239 else {
1240 tprintf("addr=");
1241 printsock(tcp, (int) args.addr);
1242 tprintf(", flags=");
Roland McGrathb2dee132005-06-01 19:02:36 +00001243 printflags(nfs_flags, args.flags, "NFSMNT_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001244 tprintf(", hostname=");
1245 printstr(tcp, (int) args.hostname, -1);
1246 tprintf(", ...}");
1247 }
1248 }
1249 else
1250 tprintf("%#lx", tcp->u_arg[4]);
1251 tprintf(", %ld", tcp->u_arg[5]);
1252 }
1253 }
1254 return 0;
1255}
1256
1257#else /* !MIPS */
1258
Wichert Akkerman3377df71999-11-26 13:14:41 +00001259#if UNIXWARE
1260
1261#include <sys/types.h>
1262#include <sys/fstyp.h>
1263#include <sys/mount.h>
1264#include <sys/xti.h>
1265
1266#define NFSCLIENT 1
1267#include <nfs/mount.h>
1268
1269#include <sys/fs/vx_ioctl.h>
1270
Roland McGrathd9f816f2004-09-04 03:39:20 +00001271static const struct xlat mount_flags[] = {
Wichert Akkerman3377df71999-11-26 13:14:41 +00001272 { MS_RDONLY, "MS_RDONLY" },
1273 { MS_FSS, "MS_FSS" },
1274 { MS_DATA, "MS_DATA" },
1275 { MS_HADBAD, "MS_HADBAD" },
1276 { MS_NOSUID, "MS_NOSUID" },
1277 { MS_REMOUNT, "MS_REMOUNT" },
1278 { MS_NOTRUNC, "MS_NOTRUNC" },
1279 { MS_SOFTMNT, "MS_SOFTMNT" },
1280 { MS_SYSSPACE, "MS_SYSSPACE" },
1281 { 0, NULL },
1282};
1283
1284#ifdef VX_MS_MASK
Roland McGrathd9f816f2004-09-04 03:39:20 +00001285static const struct xlat vxfs_flags[] = {
Wichert Akkerman3377df71999-11-26 13:14:41 +00001286 { VX_MS_NOLOG, "VX_MS_NOLOG" },
1287 { VX_MS_BLKCLEAR, "VX_MS_BLKCLEAR" },
1288 { VX_MS_SNAPSHOT, "VX_MS_SNAPSHOT" },
1289 { VX_MS_NODATAINLOG, "VX_MS_NODATAINLOG" },
1290 { VX_MS_DELAYLOG, "VX_MS_DELAYLOG" },
1291 { VX_MS_TMPLOG, "VX_MS_TMPLOG" },
1292 { VX_MS_FILESET, "VX_MS_FILESET" },
1293
1294 { VX_MS_CACHE_DIRECT, "VX_MS_CACHE_DIRECT" },
1295 { VX_MS_CACHE_DSYNC, "VX_MS_CACHE_DSYNC" },
1296 { VX_MS_CACHE_CLOSESYNC,"VX_MS_CACHE_CLOSESYNC" },
1297 { VX_MS_CACHE_TMPCACHE, "VX_MS_CACHE_TMPCACHE" },
1298
1299 { VX_MS_OSYNC_DIRECT, "VX_MS_OSYNC_DIRECT" },
1300 { VX_MS_OSYNC_DSYNC, "VX_MS_OSYNC_DSYNC" },
1301 { VX_MS_OSYNC_CLOSESYNC,"VX_MS_OSYNC_CLOSESYNC" },
1302 { VX_MS_OSYNC_DELAY, "VX_MS_OSYNC_DELAY" },
1303 { 0, NULL, },
1304};
1305#endif
1306
Roland McGrathd9f816f2004-09-04 03:39:20 +00001307static const struct xlat nfs_flags[] = {
Wichert Akkerman3377df71999-11-26 13:14:41 +00001308 { NFSMNT_SOFT, "NFSMNT_SOFT" },
1309 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
1310 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
1311 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
1312 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
1313 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
1314 { NFSMNT_INT, "NFSMNT_INT" },
1315 { NFSMNT_NOAC, "NFSMNT_NOAC" },
1316 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
1317 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
1318 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
1319 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
1320 { NFSMNT_SECURE, "NFSMNT_SECURE" },
1321 { NFSMNT_NOCTO, "NFSMNT_NOCTO" },
1322 { NFSMNT_GRPID, "NFSMNT_GRPID" },
1323 { NFSMNT_RPCTIMESYNC, "NFSMNT_RPCTIMESYNC" },
1324 { NFSMNT_LWPSMAX, "NFSMNT_LWPSMAX" },
1325 { 0, NULL },
1326};
1327
1328int
1329sys_mount(tcp)
1330struct tcb *tcp;
1331{
1332 if (entering(tcp)) {
1333 char fstyp [FSTYPSZ];
1334 printpath(tcp, tcp->u_arg[0]);
1335 tprintf(", ");
1336 printpath(tcp, tcp->u_arg[1]);
1337 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001338 printflags(mount_flags, tcp->u_arg[2], "MS_???");
Wichert Akkerman3377df71999-11-26 13:14:41 +00001339 /* The doc sez that the file system type is given as a
1340 fsindex, and we should use sysfs to work out the name.
1341 This appears to be untrue for UW. Maybe it's untrue
1342 for all SVR4's? */
1343 if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
1344 if (umovestr(tcp, tcp->u_arg[3], FSTYPSZ, fstyp) < 0) {
1345 *fstyp = 0;
1346 tprintf(", %ld", tcp->u_arg[3]);
1347 }
1348 else
1349 tprintf(", \"%s\"", fstyp);
1350 }
1351 if (tcp->u_arg[2] & MS_DATA) {
1352 tprintf(", ");
1353#ifdef VX_MS_MASK
1354 /* On UW7 they don't give us the defines and structs
1355 we need to see what is going on. Bummer. */
1356 if (strcmp (fstyp, "vxfs") == 0) {
1357 struct vx_mountargs5 args;
1358 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1359 tprintf("%#lx", tcp->u_arg[4]);
1360 else {
1361 tprintf("{ flags=");
Roland McGrathb2dee132005-06-01 19:02:36 +00001362 printflags(vxfs_flags, args.mflags, "VX_MS_???");
Wichert Akkerman3377df71999-11-26 13:14:41 +00001363 if (args.mflags & VX_MS_SNAPSHOT) {
1364 tprintf (", snapof=");
1365 printstr (tcp,
Roland McGrathced50da2004-08-31 06:48:46 +00001366 (long) args.primaryspec,
Wichert Akkerman3377df71999-11-26 13:14:41 +00001367 -1);
1368 if (args.snapsize > 0)
1369 tprintf (", snapsize=%ld", args.snapsize);
1370 }
1371 tprintf(" }");
1372 }
1373 }
1374 else
1375#endif
1376 if (strcmp (fstyp, "specfs") == 0) {
1377 tprintf ("dev=");
1378 printstr (tcp, tcp->u_arg[4], -1);
1379 }
1380 else
1381 if (strcmp (fstyp, "nfs") == 0) {
1382 struct nfs_args args;
1383 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1384 tprintf("%#lx", tcp->u_arg[4]);
1385 else {
1386 struct netbuf addr;
1387 tprintf("{ addr=");
1388 if (umove (tcp, (int) args.addr, &addr) < 0) {
1389 tprintf ("%#lx", (long) args.addr);
1390 }
1391 else {
1392 printsock(tcp, (int) addr.buf, addr.len);
1393 }
1394 tprintf(", flags=");
Roland McGrathb2dee132005-06-01 19:02:36 +00001395 printflags(nfs_flags, args.flags, "NFSMNT_???");
Wichert Akkerman3377df71999-11-26 13:14:41 +00001396 tprintf(", hostname=");
1397 printstr(tcp, (int) args.hostname, -1);
1398 tprintf(", ...}");
1399 }
1400 }
1401 else
1402 tprintf("%#lx", tcp->u_arg[4]);
1403 tprintf(", %ld", tcp->u_arg[5]);
1404 }
1405 }
1406 return 0;
1407}
1408
1409#else /* !UNIXWARE */
1410
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001411int
1412sys_mount(tcp)
1413struct tcb *tcp;
1414{
1415 if (entering(tcp)) {
1416 printpath(tcp, tcp->u_arg[0]);
1417 tprintf(", ");
1418 printpath(tcp, tcp->u_arg[1]);
1419 tprintf(", ...");
1420 }
1421 return 0;
1422}
Wichert Akkermanea78f0f1999-11-29 15:34:02 +00001423#endif /* !UNIXWARE */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001424
1425#endif /* !MIPS */
1426
1427#endif /* SVR4 */
1428
Nate Sammons8d5860c1999-07-03 18:53:05 +00001429#ifdef SYS_capget
Wichert Akkermanc7926982000-04-10 22:22:31 +00001430
Roland McGrathd9f816f2004-09-04 03:39:20 +00001431static const struct xlat capabilities[] = {
Wichert Akkermanc7926982000-04-10 22:22:31 +00001432 { 1<<CAP_CHOWN, "CAP_CHOWN" },
1433 { 1<<CAP_DAC_OVERRIDE, "CAP_DAC_OVERRIDE"},
1434 { 1<<CAP_DAC_READ_SEARCH,"CAP_DAC_READ_SEARCH"},
1435 { 1<<CAP_FOWNER, "CAP_FOWNER" },
1436 { 1<<CAP_FSETID, "CAP_FSETID" },
1437 { 1<<CAP_KILL, "CAP_KILL" },
1438 { 1<<CAP_SETGID, "CAP_SETGID" },
1439 { 1<<CAP_SETUID, "CAP_SETUID" },
1440 { 1<<CAP_SETPCAP, "CAP_SETPCAP" },
1441 { 1<<CAP_LINUX_IMMUTABLE,"CAP_LINUX_IMMUTABLE"},
1442 { 1<<CAP_NET_BIND_SERVICE,"CAP_NET_BIND_SERVICE"},
1443 { 1<<CAP_NET_BROADCAST, "CAP_NET_BROADCAST"},
1444 { 1<<CAP_NET_ADMIN, "CAP_NET_ADMIN" },
1445 { 1<<CAP_NET_RAW, "CAP_NET_RAW" },
1446 { 1<<CAP_IPC_LOCK, "CAP_IPC_LOCK" },
1447 { 1<<CAP_IPC_OWNER, "CAP_IPC_OWNER" },
1448 { 1<<CAP_SYS_MODULE, "CAP_SYS_MODULE"},
1449 { 1<<CAP_SYS_RAWIO, "CAP_SYS_RAWIO" },
1450 { 1<<CAP_SYS_CHROOT, "CAP_SYS_CHROOT"},
1451 { 1<<CAP_SYS_PTRACE, "CAP_SYS_PTRACE"},
1452 { 1<<CAP_SYS_PACCT, "CAP_SYS_PACCT" },
1453 { 1<<CAP_SYS_ADMIN, "CAP_SYS_ADMIN" },
1454 { 1<<CAP_SYS_BOOT, "CAP_SYS_BOOT" },
1455 { 1<<CAP_SYS_NICE, "CAP_SYS_NICE" },
1456 { 1<<CAP_SYS_RESOURCE, "CAP_SYS_RESOURCE"},
1457 { 1<<CAP_SYS_TIME, "CAP_SYS_TIME" },
1458 { 1<<CAP_SYS_TTY_CONFIG,"CAP_SYS_TTY_CONFIG"},
1459 { 0, NULL },
1460};
1461
1462
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001463int
1464sys_capget(tcp)
1465struct tcb *tcp;
1466{
Wichert Akkermanc7926982000-04-10 22:22:31 +00001467 static cap_user_header_t arg0 = NULL;
1468 static cap_user_data_t arg1 = NULL;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001469
1470 if(!entering(tcp)) {
Wichert Akkermanc7926982000-04-10 22:22:31 +00001471 if (!arg0) {
1472 if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001473 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001474 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001475 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001476 }
1477 }
1478 if (!arg1) {
1479 if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001480 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001481 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001482 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001483 }
1484 }
1485
1486 if (!tcp->u_arg[0])
1487 tprintf("NULL");
1488 else if (!verbose(tcp))
1489 tprintf("%#lx", tcp->u_arg[0]);
1490 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
1491 tprintf("???");
1492 else {
1493 tprintf("%#x, %d", arg0->version, arg0->pid);
1494 }
1495 tprintf(", ");
1496 if (!tcp->u_arg[1])
1497 tprintf("NULL");
1498 else if (!verbose(tcp))
1499 tprintf("%#lx", tcp->u_arg[1]);
1500 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
1501 tprintf("???");
1502 else {
1503 tprintf("{");
Roland McGrathb2dee132005-06-01 19:02:36 +00001504 printflags(capabilities, arg1->effective, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001505 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001506 printflags(capabilities, arg1->permitted, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001507 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001508 printflags(capabilities, arg1->inheritable, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001509 tprintf("}");
Roland McGrathced50da2004-08-31 06:48:46 +00001510 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001511 }
1512 return 0;
1513}
1514
1515int
1516sys_capset(tcp)
1517struct tcb *tcp;
1518{
Wichert Akkermanc7926982000-04-10 22:22:31 +00001519 static cap_user_header_t arg0 = NULL;
1520 static cap_user_data_t arg1 = NULL;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001521
Wichert Akkermanc7926982000-04-10 22:22:31 +00001522 if(entering(tcp)) {
1523 if (!arg0) {
1524 if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001525 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001526 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001527 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001528 }
1529 }
1530 if (!arg1) {
1531 if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001532 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001533 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001534 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001535 }
1536 }
1537
1538 if (!tcp->u_arg[0])
1539 tprintf("NULL");
1540 else if (!verbose(tcp))
1541 tprintf("%#lx", tcp->u_arg[0]);
1542 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
1543 tprintf("???");
1544 else {
1545 tprintf("%#x, %d", arg0->version, arg0->pid);
1546 }
1547 tprintf(", ");
1548 if (!tcp->u_arg[1])
1549 tprintf("NULL");
1550 else if (!verbose(tcp))
1551 tprintf("%#lx", tcp->u_arg[1]);
1552 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
1553 tprintf("???");
1554 else {
1555 tprintf("{");
Roland McGrathb2dee132005-06-01 19:02:36 +00001556 printflags(capabilities, arg1->effective, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001557 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001558 printflags(capabilities, arg1->permitted, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001559 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001560 printflags(capabilities, arg1->inheritable, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001561 tprintf("}");
Roland McGrathced50da2004-08-31 06:48:46 +00001562 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001563 }
1564 return 0;
1565}
1566
1567#else
1568
1569int sys_capget(tcp)
1570struct tcb *tcp;
1571{
1572 return printargs(tcp);
1573}
1574
1575int sys_capset(tcp)
1576struct tcb *tcp;
1577{
1578 return printargs(tcp);
1579}
1580
1581#endif
1582
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001583#ifdef LINUX
Dmitry V. Levin35a55782006-12-04 13:48:10 +00001584/* Linux 2.6.18+ headers removed CTL_PROC enum. */
1585# define CTL_PROC 4
Roland McGrath5eb1aa52007-01-11 22:48:39 +00001586# define CTL_CPU 10 /* older headers lack */
Roland McGrathd9f816f2004-09-04 03:39:20 +00001587static const struct xlat sysctl_root[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001588 { CTL_KERN, "CTL_KERN" },
1589 { CTL_VM, "CTL_VM" },
1590 { CTL_NET, "CTL_NET" },
1591 { CTL_PROC, "CTL_PROC" },
1592 { CTL_FS, "CTL_FS" },
1593 { CTL_DEBUG, "CTL_DEBUG" },
1594 { CTL_DEV, "CTL_DEV" },
Dmitry V. Levin35a55782006-12-04 13:48:10 +00001595 { CTL_BUS, "CTL_BUS" },
1596 { CTL_ABI, "CTL_ABI" },
1597 { CTL_CPU, "CTL_CPU" },
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001598 { 0, NULL }
1599};
1600
Roland McGrathd9f816f2004-09-04 03:39:20 +00001601static const struct xlat sysctl_kern[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001602 { KERN_OSTYPE, "KERN_OSTYPE" },
1603 { KERN_OSRELEASE, "KERN_OSRELEASE" },
1604 { KERN_OSREV, "KERN_OSREV" },
1605 { KERN_VERSION, "KERN_VERSION" },
1606 { KERN_SECUREMASK, "KERN_SECUREMASK" },
1607 { KERN_PROF, "KERN_PROF" },
1608 { KERN_NODENAME, "KERN_NODENAME" },
1609 { KERN_DOMAINNAME, "KERN_DOMAINNAME" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001610#ifdef KERN_SECURELVL
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001611 { KERN_SECURELVL, "KERN_SECURELVL" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001612#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001613 { KERN_PANIC, "KERN_PANIC" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001614#ifdef KERN_REALROOTDEV
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001615 { KERN_REALROOTDEV, "KERN_REALROOTDEV" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001616#endif
1617#ifdef KERN_JAVA_INTERPRETER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001618 { KERN_JAVA_INTERPRETER, "KERN_JAVA_INTERPRETER" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001619#endif
1620#ifdef KERN_JAVA_APPLETVIEWER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001621 { KERN_JAVA_APPLETVIEWER, "KERN_JAVA_APPLETVIEWER" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001622#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001623 { KERN_SPARC_REBOOT, "KERN_SPARC_REBOOT" },
1624 { KERN_CTLALTDEL, "KERN_CTLALTDEL" },
1625 { KERN_PRINTK, "KERN_PRINTK" },
1626 { KERN_NAMETRANS, "KERN_NAMETRANS" },
1627 { KERN_PPC_HTABRECLAIM, "KERN_PPC_HTABRECLAIM" },
1628 { KERN_PPC_ZEROPAGED, "KERN_PPC_ZEROPAGED" },
1629 { KERN_PPC_POWERSAVE_NAP, "KERN_PPC_POWERSAVE_NAP" },
1630 { KERN_MODPROBE, "KERN_MODPROBE" },
1631 { KERN_SG_BIG_BUFF, "KERN_SG_BIG_BUFF" },
1632 { KERN_ACCT, "KERN_ACCT" },
1633 { KERN_PPC_L2CR, "KERN_PPC_L2CR" },
1634 { KERN_RTSIGNR, "KERN_RTSIGNR" },
1635 { KERN_RTSIGMAX, "KERN_RTSIGMAX" },
1636 { KERN_SHMMAX, "KERN_SHMMAX" },
1637 { KERN_MSGMAX, "KERN_MSGMAX" },
1638 { KERN_MSGMNB, "KERN_MSGMNB" },
1639 { KERN_MSGPOOL, "KERN_MSGPOOL" },
1640 { 0, NULL }
1641};
1642
Roland McGrathd9f816f2004-09-04 03:39:20 +00001643static const struct xlat sysctl_vm[] = {
Roland McGratha796fd02004-03-01 22:10:54 +00001644#ifdef VM_SWAPCTL
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001645 { VM_SWAPCTL, "VM_SWAPCTL" },
Roland McGratha796fd02004-03-01 22:10:54 +00001646#endif
1647#ifdef VM_UNUSED1
1648 { VM_UNUSED1, "VM_UNUSED1" },
1649#endif
1650#ifdef VM_SWAPOUT
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001651 { VM_SWAPOUT, "VM_SWAPOUT" },
Roland McGratha796fd02004-03-01 22:10:54 +00001652#endif
1653#ifdef VM_UNUSED2
1654 { VM_UNUSED2, "VM_UNUSED2" },
1655#endif
1656#ifdef VM_FREEPG
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001657 { VM_FREEPG, "VM_FREEPG" },
Roland McGratha796fd02004-03-01 22:10:54 +00001658#endif
1659#ifdef VM_UNUSED3
1660 { VM_UNUSED3, "VM_UNUSED3" },
1661#endif
1662#ifdef VM_BDFLUSH
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001663 { VM_BDFLUSH, "VM_BDFLUSH" },
Roland McGratha796fd02004-03-01 22:10:54 +00001664#endif
1665#ifdef VM_UNUSED4
1666 { VM_UNUSED4, "VM_UNUSED4" },
1667#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001668 { VM_OVERCOMMIT_MEMORY, "VM_OVERCOMMIT_MEMORY" },
Roland McGratha796fd02004-03-01 22:10:54 +00001669#ifdef VM_BUFFERMEM
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001670 { VM_BUFFERMEM, "VM_BUFFERMEM" },
Roland McGratha796fd02004-03-01 22:10:54 +00001671#endif
1672#ifdef VM_UNUSED5
1673 { VM_UNUSED5, "VM_UNUSED5" },
1674#endif
1675#ifdef VM_PAGECACHE
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001676 { VM_PAGECACHE, "VM_PAGECACHE" },
Roland McGratha796fd02004-03-01 22:10:54 +00001677#endif
1678#ifdef VM_UNUSED7
1679 { VM_UNUSED7, "VM_UNUSED7" },
1680#endif
1681#ifdef VM_PAGERDAEMON
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001682 { VM_PAGERDAEMON, "VM_PAGERDAEMON" },
Roland McGratha796fd02004-03-01 22:10:54 +00001683#endif
1684#ifdef VM_UNUSED8
1685 { VM_UNUSED8, "VM_UNUSED8" },
1686#endif
1687#ifdef VM_PGT_CACHE
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001688 { VM_PGT_CACHE, "VM_PGT_CACHE" },
Roland McGratha796fd02004-03-01 22:10:54 +00001689#endif
1690#ifdef VM_UNUSED9
1691 { VM_UNUSED9, "VM_UNUSED9" },
1692#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001693 { VM_PAGE_CLUSTER, "VM_PAGE_CLUSTER" },
1694 { 0, NULL },
1695};
1696
Roland McGrathd9f816f2004-09-04 03:39:20 +00001697static const struct xlat sysctl_net[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001698 { NET_CORE, "NET_CORE" },
1699 { NET_ETHER, "NET_ETHER" },
1700 { NET_802, "NET_802" },
1701 { NET_UNIX, "NET_UNIX" },
1702 { NET_IPV4, "NET_IPV4" },
1703 { NET_IPX, "NET_IPX" },
1704 { NET_ATALK, "NET_ATALK" },
1705 { NET_NETROM, "NET_NETROM" },
1706 { NET_AX25, "NET_AX25" },
1707 { NET_BRIDGE, "NET_BRIDGE" },
1708 { NET_ROSE, "NET_ROSE" },
1709 { NET_IPV6, "NET_IPV6" },
1710 { NET_X25, "NET_X25" },
1711 { NET_TR, "NET_TR" },
1712 { NET_DECNET, "NET_DECNET" },
1713 { 0, NULL }
1714};
1715
Roland McGrathd9f816f2004-09-04 03:39:20 +00001716static const struct xlat sysctl_net_core[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001717 { NET_CORE_WMEM_MAX, "NET_CORE_WMEM_MAX" },
1718 { NET_CORE_RMEM_MAX, "NET_CORE_RMEM_MAX" },
1719 { NET_CORE_WMEM_DEFAULT, "NET_CORE_WMEM_DEFAULT" },
1720 { NET_CORE_RMEM_DEFAULT, "NET_CORE_RMEM_DEFAULT" },
1721 { NET_CORE_MAX_BACKLOG, "NET_CORE_MAX_BACKLOG" },
1722 { NET_CORE_FASTROUTE, "NET_CORE_FASTROUTE" },
1723 { NET_CORE_MSG_COST, "NET_CORE_MSG_COST" },
1724 { NET_CORE_MSG_BURST, "NET_CORE_MSG_BURST" },
1725 { NET_CORE_OPTMEM_MAX, "NET_CORE_OPTMEM_MAX" },
1726 { 0, NULL }
1727};
1728
Roland McGrathd9f816f2004-09-04 03:39:20 +00001729static const struct xlat sysctl_net_unix[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001730 { NET_UNIX_DESTROY_DELAY, "NET_UNIX_DESTROY_DELAY" },
1731 { NET_UNIX_DELETE_DELAY, "NET_UNIX_DELETE_DELAY" },
1732 { 0, NULL }
1733};
1734
Roland McGrathd9f816f2004-09-04 03:39:20 +00001735static const struct xlat sysctl_net_ipv4[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001736 { NET_IPV4_FORWARD, "NET_IPV4_FORWARD" },
1737 { NET_IPV4_DYNADDR, "NET_IPV4_DYNADDR" },
1738 { NET_IPV4_CONF, "NET_IPV4_CONF" },
1739 { NET_IPV4_NEIGH, "NET_IPV4_NEIGH" },
1740 { NET_IPV4_ROUTE, "NET_IPV4_ROUTE" },
1741 { NET_IPV4_FIB_HASH, "NET_IPV4_FIB_HASH" },
1742 { NET_IPV4_TCP_TIMESTAMPS, "NET_IPV4_TCP_TIMESTAMPS" },
1743 { NET_IPV4_TCP_WINDOW_SCALING, "NET_IPV4_TCP_WINDOW_SCALING" },
1744 { NET_IPV4_TCP_SACK, "NET_IPV4_TCP_SACK" },
1745 { NET_IPV4_TCP_RETRANS_COLLAPSE, "NET_IPV4_TCP_RETRANS_COLLAPSE" },
1746 { NET_IPV4_DEFAULT_TTL, "NET_IPV4_DEFAULT_TTL" },
1747 { NET_IPV4_AUTOCONFIG, "NET_IPV4_AUTOCONFIG" },
1748 { NET_IPV4_NO_PMTU_DISC, "NET_IPV4_NO_PMTU_DISC" },
1749 { NET_IPV4_TCP_SYN_RETRIES, "NET_IPV4_TCP_SYN_RETRIES" },
1750 { NET_IPV4_IPFRAG_HIGH_THRESH, "NET_IPV4_IPFRAG_HIGH_THRESH" },
1751 { NET_IPV4_IPFRAG_LOW_THRESH, "NET_IPV4_IPFRAG_LOW_THRESH" },
1752 { NET_IPV4_IPFRAG_TIME, "NET_IPV4_IPFRAG_TIME" },
1753 { NET_IPV4_TCP_MAX_KA_PROBES, "NET_IPV4_TCP_MAX_KA_PROBES" },
1754 { NET_IPV4_TCP_KEEPALIVE_TIME, "NET_IPV4_TCP_KEEPALIVE_TIME" },
1755 { NET_IPV4_TCP_KEEPALIVE_PROBES, "NET_IPV4_TCP_KEEPALIVE_PROBES" },
1756 { NET_IPV4_TCP_RETRIES1, "NET_IPV4_TCP_RETRIES1" },
1757 { NET_IPV4_TCP_RETRIES2, "NET_IPV4_TCP_RETRIES2" },
1758 { NET_IPV4_TCP_FIN_TIMEOUT, "NET_IPV4_TCP_FIN_TIMEOUT" },
1759 { NET_IPV4_IP_MASQ_DEBUG, "NET_IPV4_IP_MASQ_DEBUG" },
1760 { NET_TCP_SYNCOOKIES, "NET_TCP_SYNCOOKIES" },
1761 { NET_TCP_STDURG, "NET_TCP_STDURG" },
1762 { NET_TCP_RFC1337, "NET_TCP_RFC1337" },
1763 { NET_TCP_SYN_TAILDROP, "NET_TCP_SYN_TAILDROP" },
1764 { NET_TCP_MAX_SYN_BACKLOG, "NET_TCP_MAX_SYN_BACKLOG" },
1765 { NET_IPV4_LOCAL_PORT_RANGE, "NET_IPV4_LOCAL_PORT_RANGE" },
1766 { NET_IPV4_ICMP_ECHO_IGNORE_ALL, "NET_IPV4_ICMP_ECHO_IGNORE_ALL" },
1767 { NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS" },
1768 { NET_IPV4_ICMP_SOURCEQUENCH_RATE, "NET_IPV4_ICMP_SOURCEQUENCH_RATE" },
1769 { NET_IPV4_ICMP_DESTUNREACH_RATE, "NET_IPV4_ICMP_DESTUNREACH_RATE" },
1770 { NET_IPV4_ICMP_TIMEEXCEED_RATE, "NET_IPV4_ICMP_TIMEEXCEED_RATE" },
1771 { NET_IPV4_ICMP_PARAMPROB_RATE, "NET_IPV4_ICMP_PARAMPROB_RATE" },
1772 { NET_IPV4_ICMP_ECHOREPLY_RATE, "NET_IPV4_ICMP_ECHOREPLY_RATE" },
1773 { NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES" },
1774 { NET_IPV4_IGMP_MAX_MEMBERSHIPS, "NET_IPV4_IGMP_MAX_MEMBERSHIPS" },
1775 { 0, NULL }
1776};
1777
Roland McGrathd9f816f2004-09-04 03:39:20 +00001778static const struct xlat sysctl_net_ipv4_route[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001779 { NET_IPV4_ROUTE_FLUSH, "NET_IPV4_ROUTE_FLUSH" },
1780 { NET_IPV4_ROUTE_MIN_DELAY, "NET_IPV4_ROUTE_MIN_DELAY" },
1781 { NET_IPV4_ROUTE_MAX_DELAY, "NET_IPV4_ROUTE_MAX_DELAY" },
1782 { NET_IPV4_ROUTE_GC_THRESH, "NET_IPV4_ROUTE_GC_THRESH" },
1783 { NET_IPV4_ROUTE_MAX_SIZE, "NET_IPV4_ROUTE_MAX_SIZE" },
1784 { NET_IPV4_ROUTE_GC_MIN_INTERVAL, "NET_IPV4_ROUTE_GC_MIN_INTERVAL" },
1785 { NET_IPV4_ROUTE_GC_TIMEOUT, "NET_IPV4_ROUTE_GC_TIMEOUT" },
1786 { NET_IPV4_ROUTE_GC_INTERVAL, "NET_IPV4_ROUTE_GC_INTERVAL" },
1787 { NET_IPV4_ROUTE_REDIRECT_LOAD, "NET_IPV4_ROUTE_REDIRECT_LOAD" },
1788 { NET_IPV4_ROUTE_REDIRECT_NUMBER, "NET_IPV4_ROUTE_REDIRECT_NUMBER" },
1789 { NET_IPV4_ROUTE_REDIRECT_SILENCE, "NET_IPV4_ROUTE_REDIRECT_SILENCE" },
1790 { NET_IPV4_ROUTE_ERROR_COST, "NET_IPV4_ROUTE_ERROR_COST" },
1791 { NET_IPV4_ROUTE_ERROR_BURST, "NET_IPV4_ROUTE_ERROR_BURST" },
1792 { NET_IPV4_ROUTE_GC_ELASTICITY, "NET_IPV4_ROUTE_GC_ELASTICITY" },
1793 { 0, NULL }
1794};
1795
Roland McGrathd9f816f2004-09-04 03:39:20 +00001796static const struct xlat sysctl_net_ipv4_conf[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001797 { NET_IPV4_CONF_FORWARDING, "NET_IPV4_CONF_FORWARDING" },
1798 { NET_IPV4_CONF_MC_FORWARDING, "NET_IPV4_CONF_MC_FORWARDING" },
1799 { NET_IPV4_CONF_PROXY_ARP, "NET_IPV4_CONF_PROXY_ARP" },
1800 { NET_IPV4_CONF_ACCEPT_REDIRECTS, "NET_IPV4_CONF_ACCEPT_REDIRECTS" },
1801 { NET_IPV4_CONF_SECURE_REDIRECTS, "NET_IPV4_CONF_SECURE_REDIRECTS" },
1802 { NET_IPV4_CONF_SEND_REDIRECTS, "NET_IPV4_CONF_SEND_REDIRECTS" },
1803 { NET_IPV4_CONF_SHARED_MEDIA, "NET_IPV4_CONF_SHARED_MEDIA" },
1804 { NET_IPV4_CONF_RP_FILTER, "NET_IPV4_CONF_RP_FILTER" },
1805 { NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, "NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE" },
1806 { NET_IPV4_CONF_BOOTP_RELAY, "NET_IPV4_CONF_BOOTP_RELAY" },
1807 { NET_IPV4_CONF_LOG_MARTIANS, "NET_IPV4_CONF_LOG_MARTIANS" },
1808 { 0, NULL }
1809};
1810
Roland McGrathd9f816f2004-09-04 03:39:20 +00001811static const struct xlat sysctl_net_ipv6[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001812 { NET_IPV6_CONF, "NET_IPV6_CONF" },
1813 { NET_IPV6_NEIGH, "NET_IPV6_NEIGH" },
1814 { NET_IPV6_ROUTE, "NET_IPV6_ROUTE" },
1815 { 0, NULL }
1816};
1817
Roland McGrathd9f816f2004-09-04 03:39:20 +00001818static const struct xlat sysctl_net_ipv6_route[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001819 { NET_IPV6_ROUTE_FLUSH, "NET_IPV6_ROUTE_FLUSH" },
1820 { NET_IPV6_ROUTE_GC_THRESH, "NET_IPV6_ROUTE_GC_THRESH" },
1821 { NET_IPV6_ROUTE_MAX_SIZE, "NET_IPV6_ROUTE_MAX_SIZE" },
1822 { NET_IPV6_ROUTE_GC_MIN_INTERVAL, "NET_IPV6_ROUTE_GC_MIN_INTERVAL" },
1823 { NET_IPV6_ROUTE_GC_TIMEOUT, "NET_IPV6_ROUTE_GC_TIMEOUT" },
1824 { NET_IPV6_ROUTE_GC_INTERVAL, "NET_IPV6_ROUTE_GC_INTERVAL" },
1825 { NET_IPV6_ROUTE_GC_ELASTICITY, "NET_IPV6_ROUTE_GC_ELASTICITY" },
1826 { 0, NULL }
1827};
1828
1829int
1830sys_sysctl(tcp)
1831struct tcb *tcp;
1832{
1833 struct __sysctl_args info;
1834 int *name;
Roland McGrathaa524c82005-06-01 19:22:06 +00001835 unsigned long size;
1836
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001837 if (umove (tcp, tcp->u_arg[0], &info) < 0)
1838 return printargs(tcp);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001839
Roland McGrathaa524c82005-06-01 19:22:06 +00001840 size = sizeof (int) * (unsigned long) info.nlen;
1841 name = (size / sizeof (int) != info.nlen) ? NULL : malloc (size);
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001842 if (name == NULL ||
Roland McGrathaa524c82005-06-01 19:22:06 +00001843 umoven(tcp, (unsigned long) info.name, size, (char *) name) < 0) {
1844 free(name);
1845 if (entering(tcp))
1846 tprintf("{%p, %d, %p, %p, %p, %Zu}",
1847 info.name, info.nlen, info.oldval,
1848 info.oldlenp, info.newval, info.newlen);
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001849 return 0;
1850 }
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001851
1852 if (entering(tcp)) {
Roland McGrathaa524c82005-06-01 19:22:06 +00001853 int cnt = 0, max_cnt;
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001854
1855 tprintf("{{");
1856
1857 if (info.nlen == 0)
1858 goto out;
1859 printxval(sysctl_root, name[0], "CTL_???");
1860 ++cnt;
1861
1862 if (info.nlen == 1)
1863 goto out;
1864 switch (name[0]) {
1865 case CTL_KERN:
1866 tprintf(", ");
1867 printxval(sysctl_kern, name[1], "KERN_???");
1868 ++cnt;
1869 break;
1870 case CTL_VM:
1871 tprintf(", ");
1872 printxval(sysctl_vm, name[1], "VM_???");
1873 ++cnt;
1874 break;
1875 case CTL_NET:
1876 tprintf(", ");
1877 printxval(sysctl_net, name[1], "NET_???");
1878 ++cnt;
1879
1880 if (info.nlen == 2)
1881 goto out;
1882 switch (name[1]) {
1883 case NET_CORE:
1884 tprintf(", ");
1885 printxval(sysctl_net_core, name[2],
1886 "NET_CORE_???");
1887 break;
1888 case NET_UNIX:
1889 tprintf(", ");
1890 printxval(sysctl_net_unix, name[2],
1891 "NET_UNIX_???");
1892 break;
1893 case NET_IPV4:
1894 tprintf(", ");
1895 printxval(sysctl_net_ipv4, name[2],
1896 "NET_IPV4_???");
1897
1898 if (info.nlen == 3)
1899 goto out;
1900 switch (name[2]) {
1901 case NET_IPV4_ROUTE:
1902 tprintf(", ");
1903 printxval(sysctl_net_ipv4_route,
1904 name[3],
1905 "NET_IPV4_ROUTE_???");
1906 break;
1907 case NET_IPV4_CONF:
1908 tprintf(", ");
1909 printxval(sysctl_net_ipv4_conf,
1910 name[3],
1911 "NET_IPV4_CONF_???");
1912 break;
1913 default:
1914 goto out;
1915 }
1916 break;
1917 case NET_IPV6:
1918 tprintf(", ");
1919 printxval(sysctl_net_ipv6, name[2],
1920 "NET_IPV6_???");
1921
1922 if (info.nlen == 3)
1923 goto out;
1924 switch (name[2]) {
1925 case NET_IPV6_ROUTE:
1926 tprintf(", ");
1927 printxval(sysctl_net_ipv6_route,
1928 name[3],
1929 "NET_IPV6_ROUTE_???");
1930 break;
1931 default:
1932 goto out;
1933 }
1934 break;
1935 default:
1936 goto out;
1937 }
1938 break;
1939 default:
1940 goto out;
1941 }
1942 out:
Roland McGrath8e4a3e62006-01-12 11:03:46 +00001943 max_cnt = info.nlen;
1944 if (abbrev(tcp) && max_cnt > max_strlen)
1945 max_cnt = max_strlen;
Roland McGrathaa524c82005-06-01 19:22:06 +00001946 while (cnt < max_cnt)
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001947 tprintf(", %x", name[cnt++]);
Roland McGrathaa524c82005-06-01 19:22:06 +00001948 if (cnt < info.nlen)
1949 tprintf(", ...");
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001950 tprintf("}, %d, ", info.nlen);
1951 } else {
1952 size_t oldlen;
Roland McGrathaa524c82005-06-01 19:22:06 +00001953 if (umove(tcp, (size_t)info.oldlenp, &oldlen) >= 0
1954 && info.nlen >= 2
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001955 && ((name[0] == CTL_KERN
1956 && (name[1] == KERN_OSRELEASE
1957 || name[1] == KERN_OSTYPE
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001958#ifdef KERN_JAVA_INTERPRETER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001959 || name[1] == KERN_JAVA_INTERPRETER
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001960#endif
1961#ifdef KERN_JAVA_APPLETVIEWER
1962 || name[1] == KERN_JAVA_APPLETVIEWER
1963#endif
1964 )))) {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001965 printpath(tcp, (size_t)info.oldval);
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001966 tprintf(", %Zu, ", oldlen);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001967 if (info.newval == 0)
1968 tprintf("NULL");
1969 else if (syserror(tcp))
1970 tprintf("%p", info.newval);
1971 else
1972 printpath(tcp, (size_t)info.newval);
1973 tprintf(", %Zd", info.newlen);
1974 } else {
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001975 tprintf("%p, %Zd, %p, %Zd", info.oldval, oldlen,
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001976 info.newval, info.newlen);
1977 }
1978 tprintf("}");
1979 }
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001980
1981 free(name);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001982 return 0;
1983}
1984#else
1985int sys_sysctl(tcp)
1986struct tcb *tcp;
1987{
1988 return printargs(tcp);
1989}
1990#endif
1991
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001992#ifdef FREEBSD
1993#include <sys/sysctl.h>
1994
1995int sys___sysctl(tcp)
1996struct tcb *tcp;
1997{
1998 int qoid[CTL_MAXNAME+2];
1999 char ctl[1024];
2000 size_t len;
2001 int i, numeric;
Roland McGrathced50da2004-08-31 06:48:46 +00002002
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00002003 if (entering(tcp)) {
2004 if (tcp->u_arg[1] < 0 || tcp->u_arg[1] > CTL_MAXNAME ||
2005 (umoven(tcp, tcp->u_arg[0], tcp->u_arg[1] * sizeof(int),
2006 (char *) (qoid + 2)) < 0))
2007 tprintf("[...], ");
2008 else {
2009 /* Use sysctl to ask the name of the current MIB
2010 This uses the undocumented "Staff-functions" used
2011 by the sysctl program. See kern_sysctl.c for
2012 details. */
2013 qoid[0] = 0; /* sysctl */
2014 qoid[1] = 1; /* name */
2015 i = sizeof(ctl);
2016 tprintf("[");
2017 if (sysctl(qoid, tcp->u_arg[1] + 2, ctl, &i, 0, 0) >= 0) {
2018 numeric = !abbrev(tcp);
2019 tprintf("%s%s", ctl, numeric ? ", " : "");
2020 } else
2021 numeric = 1;
2022 if (numeric) {
2023 for (i = 0; i < tcp->u_arg[1]; i++)
2024 tprintf("%s%d", i ? "." : "", qoid[i + 2]);
2025 }
2026 tprintf("], ");
2027 tprintf("%lu, ", tcp->u_arg[1]);
2028 }
2029 } else {
2030 if (!syserror(tcp) && (umove(tcp, tcp->u_arg[3], &len) >= 0)) {
2031 printstr(tcp, tcp->u_arg[2], len);
2032 tprintf(", [%u], ", len);
Roland McGrathced50da2004-08-31 06:48:46 +00002033 } else
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00002034 tprintf("%#lx, %#lx, ", tcp->u_arg[2], tcp->u_arg[3]);
2035 printstr(tcp, tcp->u_arg[4], tcp->u_arg[5]);
2036 tprintf(", %lu", tcp->u_arg[5]);
2037 }
2038 return 0;
2039}
2040#endif
Wichert Akkerman16a03d22000-08-10 02:14:04 +00002041
2042#if UNIXWARE >= 2
2043
2044#include <sys/ksym.h>
2045#include <sys/elf.h>
2046
Roland McGrathd9f816f2004-09-04 03:39:20 +00002047static const struct xlat ksym_flags[] = {
Roland McGrathced50da2004-08-31 06:48:46 +00002048 { STT_NOTYPE, "STT_NOTYPE" },
2049 { STT_FUNC, "STT_FUNC" },
2050 { STT_OBJECT, "STT_OBJECT" },
Wichert Akkerman16a03d22000-08-10 02:14:04 +00002051 { 0, NULL },
2052};
2053
2054int
2055sys_getksym(tcp)
2056struct tcb *tcp;
2057{
2058 if (entering (tcp)) {
2059 printstr(tcp, tcp->u_arg[0], -1);
2060 tprintf(", ");
2061 }
2062 else {
2063 if (syserror(tcp)) {
2064 tprintf("%#lx, %#lx",
2065 tcp->u_arg[1], tcp->u_arg[2]);
2066 }
2067 else {
2068 int val;
2069 printnum (tcp, tcp->u_arg[1], "%#lx");
2070 tprintf(", ");
2071 if (umove(tcp, tcp->u_arg[2], &val) < 0) {
2072 tprintf("%#lx", tcp->u_arg[2]);
2073 }
2074 else {
2075 tprintf("[");
2076 printxval (ksym_flags, val, "STT_???");
2077 tprintf("]");
2078 }
2079 }
2080 }
2081
2082 return 0;
2083}
2084
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002085#ifdef HAVE_SYS_NSCSYS_H
John Hughes4e36a812001-04-18 15:11:51 +00002086
John Hughes0aadba42001-10-16 18:19:52 +00002087struct cred;
John Hughes4e36a812001-04-18 15:11:51 +00002088#include <sys/nscsys.h>
2089
Roland McGrathd9f816f2004-09-04 03:39:20 +00002090static const struct xlat ssi_cmd [] = {
John Hughes4e36a812001-04-18 15:11:51 +00002091 { SSISYS_BADOP, "SSISYS_BADOP" },
2092 { SSISYS_LDLVL_INIT,"SSISYS_LDLVL_INIT"},
2093 { SSISYS_LDLVL_GETVEC,"SSISYS_LDLVL_GETVEC"},
2094 { SSISYS_LDLVL_PUTVEC,"SSISYS_LDLVL_PUTVEC"},
2095 { SSISYS_LDLVL_PUTRCMDS,"SSISYS_LDLVL_PUTRCMDS"},
2096 { SSISYS_LDLVL_SETREXEC,"SSISYS_LDLVL_SETREXEC"},
2097 { SSISYS_CMS_CLUSTERID,"SSISYS_CMS_CLUSTERID"},
2098 { SSISYS_CFS_STATVFS,"SSISYS_CFS_STATVFS"},
2099 { SSISYS_NODE_GETNUM,"SSISYS_NODE_GETNUM"},
2100 { SSISYS_NODE_TABLE,"SSISYS_NODE_TABLE"},
2101 { SSISYS_NODE_DOWN,"SSISYS_NODE_DOWN"},
2102 { SSISYS_RECLAIM_CHILD,"SSISYS_RECLAIM_CHILD"},
2103 { SSISYS_IPC_GETINFO,"SSISYS_IPC_GETINFO"},
2104 { SSISYS_ICS_TEST,"SSISYS_ICS_TEST"},
2105 { SSISYS_NODE_PID,"SSISYS_NODE_PID"},
2106 { SSISYS_ISLOCAL,"SSISYS_ISLOCAL"},
2107 { SSISYS_CFS_ISSTACKED,"SSISYS_CFS_ISSTACKED"},
2108 { SSISYS_DNET_SYNC,"SSISYS_DNET_SYNC"},
2109 { SSISYS_CFS_WAIT_MODE,"SSISYS_CFS_WAIT_MODE"},
2110 { SSISYS_CFS_UMOUNT,"SSISYS_CFS_UMOUNT"},
2111 { SSISYS_LLSTAT,"SSISYS_LLSTAT" },
2112 { SSISYS_LTS_PERFTEST,"SSISYS_LTS_PERFTEST"},
2113 { SSISYS_LTS_CONFIG,"SSISYS_LTS_CONFIG"},
2114 { SSISYS_SNET_PERFTEST,"SSISYS_SNET_PERFTEST"},
2115 { SSISYS_IGNORE_HALFUP,"SSISYS_IGNORE_HALFUP"},
2116 { SSISYS_NODE_ROOTDEV,"SSISYS_NODE_ROOTDEV"},
2117 { SSISYS_GET_PRIMARY,"SSISYS_GET_PRIMARY"},
2118 { SSISYS_GET_SECONDARY,"SSISYS_GET_SECONDARY"},
2119 { SSISYS_GET_ROOTDISK,"SSISYS_GET_ROOTDISK"},
2120 { SSISYS_CLUSTERNODE_NUM,"SSISYS_CLUSTERNODE_NUM"},
2121 { SSISYS_CLUSTER_MEMBERSHIP,"SSISYS_CLUSTER_MEMBERSHIP"},
2122 { SSISYS_CLUSTER_DETAILEDTRANS,"SSISYS_CLUSTER_DETAILEDTRANS"},
2123 { SSISYS_CLUSTERNODE_INFO,"SSISYS_CLUSTERNODE_INFO"},
2124 { SSISYS_CLUSTERNODE_SETINFO,"SSISYS_CLUSTERNODE_SETINFO"},
2125 { SSISYS_CLUSTERNODE_AVAIL,"SSISYS_CLUSTERNODE_AVAIL"},
2126 { SSISYS_CLUSTER_MAXNODES,"SSISYS_CLUSTER_MAXNODES"},
2127 { SSISYS_SET_MEMPRIO,"SSISYS_SET_MEMPRIO"},
2128 { SSISYS_GET_USERS,"SSISYS_GET_USERS"},
2129 { SSISYS_FORCE_ROOT_NODE,"SSISYS_FORCE_ROOT_NODE"},
2130 { SSISYS_CVIP_SET,"SSISYS_CVIP_SET"},
2131 { SSISYS_CVIP_GET,"SSISYS_CVIP_GET"},
2132 { SSISYS_GET_NODE_COUNTS,"SSISYS_GET_NODE_COUNTS"},
2133 { SSISYS_GET_TRANSPORT,"SSISYS_GET_TRANSPORT"},
2134 { 0, NULL },
2135};
2136
2137int sys_ssisys (tcp)
2138struct tcb *tcp;
2139{
2140 struct ssisys_iovec iov;
John Hughes2d8b2c52001-10-18 14:52:24 +00002141 cls_nodeinfo_args_t cni;
2142 clusternode_info_t info;
2143
John Hughes4e36a812001-04-18 15:11:51 +00002144 if (entering (tcp)) {
John Hughes0aadba42001-10-16 18:19:52 +00002145 ts_reclaim_child_inargs_t trc;
John Hughes4e36a812001-04-18 15:11:51 +00002146 if (tcp->u_arg[1] != sizeof iov ||
2147 umove (tcp, tcp->u_arg[0], &iov) < 0)
2148 {
2149 tprintf ("%#lx, %ld", tcp->u_arg[0], tcp->u_arg[1]);
2150 return 0;
2151 }
2152 tprintf ("{id=");
2153 printxval(ssi_cmd, iov.tio_id.id_cmd, "SSISYS_???");
2154 tprintf (":%d", iov.tio_id.id_ver);
2155 switch (iov.tio_id.id_cmd) {
John Hughes0aadba42001-10-16 18:19:52 +00002156 case SSISYS_RECLAIM_CHILD:
2157 if (iov.tio_udatainlen != sizeof trc ||
2158 umove (tcp, (long) iov.tio_udatain, &trc) < 0)
2159 goto bad;
2160 tprintf (", in={pid=%ld, start=%ld}",
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002161 trc.trc_pid, trc.trc_start);
John Hughes0aadba42001-10-16 18:19:52 +00002162 break;
2163 case SSISYS_CLUSTERNODE_INFO:
2164 if (iov.tio_udatainlen != sizeof cni ||
2165 umove (tcp, (long) iov.tio_udatain, &cni) < 0)
2166 goto bad;
2167 tprintf (", in={node=%ld, len=%d}",
2168 cni.nodenum, cni.info_len);
2169 break;
John Hughes4e36a812001-04-18 15:11:51 +00002170 default:
John Hughes0aadba42001-10-16 18:19:52 +00002171 bad:
John Hughes4e36a812001-04-18 15:11:51 +00002172 if (iov.tio_udatainlen) {
2173 tprintf (", in=[/* %d bytes */]",
2174 iov.tio_udatainlen);
2175 }
2176 }
2177 }
2178 else {
John Hughes2d8b2c52001-10-18 14:52:24 +00002179 if (tcp->u_arg[1] != sizeof iov ||
2180 umove (tcp, tcp->u_arg[0], &iov) < 0)
2181 goto done;
John Hughes4e36a812001-04-18 15:11:51 +00002182 switch (iov.tio_id.id_cmd) {
John Hughes2d8b2c52001-10-18 14:52:24 +00002183 case SSISYS_CLUSTERNODE_INFO:
2184 if (iov.tio_udatainlen != sizeof cni ||
2185 umove (tcp, (long) iov.tio_udatain, &cni) < 0)
2186 goto bad_out;
Roland McGrathced50da2004-08-31 06:48:46 +00002187 if (cni.info_len != sizeof info ||
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002188 iov.tio_udataoutlen != sizeof &info ||
John Hughes2d8b2c52001-10-18 14:52:24 +00002189 umove (tcp, (long) iov.tio_udataout, &info) < 0)
2190 goto bad_out;
2191 tprintf (", out={node=%ld, cpus=%d, online=%d}",
2192 info.node_num, info.node_totalcpus,
2193 info.node_onlinecpus);
2194 break;
Roland McGrathced50da2004-08-31 06:48:46 +00002195
John Hughes4e36a812001-04-18 15:11:51 +00002196 default:
John Hughes2d8b2c52001-10-18 14:52:24 +00002197 bad_out:
John Hughes4e36a812001-04-18 15:11:51 +00002198 if (iov.tio_udataoutlen) {
2199 tprintf (", out=[/* %d bytes */]",
2200 iov.tio_udataoutlen);
2201 }
2202 }
John Hughes2d8b2c52001-10-18 14:52:24 +00002203 done:
John Hughes4e36a812001-04-18 15:11:51 +00002204 tprintf ("}, %ld", tcp->u_arg[1]);
2205 }
2206 return 0;
2207}
2208
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002209#endif
John Hughes4e36a812001-04-18 15:11:51 +00002210
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002211#endif /* UNIXWARE > 2 */
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002212
2213#ifdef MIPS
2214
Wichert Akkermand6b92492001-04-07 21:37:12 +00002215#ifndef __NEW_UTS_LEN
2216#define __NEW_UTS_LEN 64
2217#endif
2218
Roland McGrathd9f816f2004-09-04 03:39:20 +00002219static const struct xlat sysmips_operations[] = {
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002220 { SETNAME, "SETNAME" },
2221 { FLUSH_CACHE, "FLUSH_CACHE" },
2222 { MIPS_FIXADE, "MIPS_FIXADE" },
2223 { MIPS_RDNVRAM, "MIPS_RDNVRAM" },
2224 { MIPS_ATOMIC_SET, "MIPS_ATOMIC_SET" },
2225 { 0, NULL }
2226};
2227
2228int sys_sysmips(tcp)
2229struct tcb *tcp;
2230{
2231 if (entering(tcp)) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002232 printxval(sysmips_operations, tcp->u_arg[0], "???");
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002233 if (!verbose(tcp)) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002234 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002235 } else if (tcp->u_arg[0]==SETNAME) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002236 char nodename[__NEW_UTS_LEN + 1];
2237 if (umovestr(tcp, tcp->u_arg[1], (__NEW_UTS_LEN + 1), nodename) < 0)
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002238 tprintf(", %#lx", tcp->u_arg[1]);
2239 else
2240 tprintf(", \"%s\"", nodename);
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002241 } else if (tcp->u_arg[0] == MIPS_ATOMIC_SET) {
2242 tprintf(", %#lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
2243 } else if (tcp->u_arg[0] == MIPS_FIXADE) {
2244 tprintf(", 0x%lx", tcp->u_arg[1]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002245 } else {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002246 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002247 }
2248 }
2249
2250 return 0;
2251}
2252
2253#endif /* MIPS */