blob: f3308d14bd4ff787c21987c97b8b43a074490f77 [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
Wichert Akkermandacfb6e1999-06-03 14:21:07 +0000127int
128sys_umount2(tcp)
129struct tcb *tcp;
130{
131 if (entering(tcp)) {
132 printstr(tcp, tcp->u_arg[0], -1);
133 tprintf(", ");
134 if (tcp->u_arg[1] & 1)
135 tprintf("MNT_FORCE");
136 else
137 tprintf("0");
138 }
139 return 0;
140}
141
Roland McGrathced50da2004-08-31 06:48:46 +0000142/* These are not macros, but enums. We just copy the values by hand
143 from Linux 2.6.9 here. */
Roland McGrathd9f816f2004-09-04 03:39:20 +0000144static const struct xlat personality_options[] = {
Roland McGrathced50da2004-08-31 06:48:46 +0000145 { 0, "PER_LINUX" },
146 { 0x00800000, "PER_LINUX_32BIT"},
147 { 0x04100001, "PER_SVR4" },
148 { 0x05000002, "PER_SVR3" },
149 { 0x07000003, "PER_SCOSVR3" },
150 { 0x06000003, "PER_OSR5" },
151 { 0x05000004, "PER_WYSEV386" },
152 { 0x04000005, "PER_ISCR4" },
153 { 0x00000006, "PER_BSD" },
154 { 0x04000006, "PER_SUNOS" },
155 { 0x05000007, "PER_XENIX" },
156 { 0x00000008, "PER_LINUX32" },
157 { 0x08000008, "PER_LINUX32_3GB"},
158 { 0x04000009, "PER_IRIX32" },
159 { 0x0400000a, "PER_IRIXN32" },
160 { 0x0400000b, "PER_IRIX64" },
161 { 0x0000000c, "PER_RISCOS" },
162 { 0x0400000d, "PER_SOLARIS" },
163 { 0x0410000e, "PER_UW7" },
164 { 0x0000000f, "PER_OSF4" },
165 { 0x00000010, "PER_HPUX" },
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000166 { 0, NULL },
167};
168
169int
170sys_personality(tcp)
171struct tcb *tcp;
172{
173 if (entering(tcp))
174 printxval(personality_options, tcp->u_arg[0], "PER_???");
175 return 0;
176}
177
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000178#include <linux/reboot.h>
Roland McGrathd9f816f2004-09-04 03:39:20 +0000179static const struct xlat bootflags1[] = {
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000180 { LINUX_REBOOT_MAGIC1, "LINUX_REBOOT_MAGIC1" },
181 { 0, NULL },
182};
183
Roland McGrathd9f816f2004-09-04 03:39:20 +0000184static const struct xlat bootflags2[] = {
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000185 { LINUX_REBOOT_MAGIC2, "LINUX_REBOOT_MAGIC2" },
186 { LINUX_REBOOT_MAGIC2A, "LINUX_REBOOT_MAGIC2A" },
187 { LINUX_REBOOT_MAGIC2B, "LINUX_REBOOT_MAGIC2B" },
188 { 0, NULL },
189};
190
Roland McGrathd9f816f2004-09-04 03:39:20 +0000191static const struct xlat bootflags3[] = {
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000192 { LINUX_REBOOT_CMD_CAD_OFF, "LINUX_REBOOT_CMD_CAD_OFF" },
193 { LINUX_REBOOT_CMD_RESTART, "LINUX_REBOOT_CMD_RESTART" },
194 { LINUX_REBOOT_CMD_HALT, "LINUX_REBOOT_CMD_HALT" },
195 { LINUX_REBOOT_CMD_CAD_ON, "LINUX_REBOOT_CMD_CAD_ON" },
196 { LINUX_REBOOT_CMD_POWER_OFF, "LINUX_REBOOT_CMD_POWER_OFF" },
197 { LINUX_REBOOT_CMD_RESTART2, "LINUX_REBOOT_CMD_RESTART2" },
198 { 0, NULL },
199};
200
201int
202sys_reboot(tcp)
203struct tcb *tcp;
204{
205 if (entering(tcp)) {
Roland McGrathb2dee132005-06-01 19:02:36 +0000206 printflags(bootflags1, tcp->u_arg[0], "LINUX_REBOOT_MAGIC_???");
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000207 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000208 printflags(bootflags2, tcp->u_arg[1], "LINUX_REBOOT_MAGIC_???");
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000209 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000210 printflags(bootflags3, tcp->u_arg[2], "LINUX_REBOOT_CMD_???");
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000211 if (tcp->u_arg[2] == LINUX_REBOOT_CMD_RESTART2) {
212 tprintf(", ");
213 printstr(tcp, tcp->u_arg[3], -1);
214 }
215 }
216 return 0;
217}
218
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000219#ifdef M68K
Roland McGrathd9f816f2004-09-04 03:39:20 +0000220static const struct xlat cacheflush_scope[] = {
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000221#ifdef FLUSH_SCOPE_LINE
222 { FLUSH_SCOPE_LINE, "FLUSH_SCOPE_LINE" },
223#endif
224#ifdef FLUSH_SCOPE_PAGE
225 { FLUSH_SCOPE_PAGE, "FLUSH_SCOPE_PAGE" },
226#endif
227#ifdef FLUSH_SCOPE_ALL
228 { FLUSH_SCOPE_ALL, "FLUSH_SCOPE_ALL" },
229#endif
230 { 0, NULL },
231};
232
Roland McGrathd9f816f2004-09-04 03:39:20 +0000233static const struct xlat cacheflush_flags[] = {
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000234#ifdef FLUSH_CACHE_BOTH
235 { FLUSH_CACHE_BOTH, "FLUSH_CACHE_BOTH" },
236#endif
237#ifdef FLUSH_CACHE_DATA
238 { FLUSH_CACHE_DATA, "FLUSH_CACHE_DATA" },
239#endif
240#ifdef FLUSH_CACHE_INSN
241 { FLUSH_CACHE_INSN, "FLUSH_CACHE_INSN" },
242#endif
243 { 0, NULL },
244};
245
246int
247sys_cacheflush(tcp)
248struct tcb *tcp;
249{
250 if (entering(tcp)) {
251 /* addr */
252 tprintf("%#lx, ", tcp->u_arg[0]);
253 /* scope */
254 printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
255 tprintf(", ");
256 /* flags */
Roland McGrathb2dee132005-06-01 19:02:36 +0000257 printflags(cacheflush_flags, tcp->u_arg[2], "FLUSH_CACHE_???");
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000258 /* len */
259 tprintf(", %lu", tcp->u_arg[3]);
260 }
261 return 0;
262}
263#endif /* M68K */
264
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000265#endif /* LINUX */
266
267#ifdef SUNOS4
268
269#include <sys/reboot.h>
270#define NFSCLIENT
271#define LOFS
272#define RFS
273#define PCFS
274#include <sys/mount.h>
275#include <sys/socket.h>
276#include <nfs/export.h>
277#include <rpc/types.h>
278#include <rpc/auth.h>
279
280/*ARGSUSED*/
281int
282sys_sync(tcp)
283struct tcb *tcp;
284{
285 return 0;
286}
287
Roland McGrathd9f816f2004-09-04 03:39:20 +0000288static const struct xlat bootflags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000289 { RB_AUTOBOOT, "RB_AUTOBOOT" }, /* for system auto-booting itself */
290 { RB_ASKNAME, "RB_ASKNAME" }, /* ask for file name to reboot from */
291 { RB_SINGLE, "RB_SINGLE" }, /* reboot to single user only */
292 { RB_NOSYNC, "RB_NOSYNC" }, /* dont sync before reboot */
293 { RB_HALT, "RB_HALT" }, /* don't reboot, just halt */
294 { RB_INITNAME, "RB_INITNAME" }, /* name given for /etc/init */
295 { RB_NOBOOTRC, "RB_NOBOOTRC" }, /* don't run /etc/rc.boot */
296 { RB_DEBUG, "RB_DEBUG" }, /* being run under debugger */
297 { RB_DUMP, "RB_DUMP" }, /* dump system core */
298 { RB_WRITABLE, "RB_WRITABLE" }, /* mount root read/write */
299 { RB_STRING, "RB_STRING" }, /* pass boot args to prom monitor */
300 { 0, NULL },
301};
302
303int
304sys_reboot(tcp)
305struct tcb *tcp;
306{
307 if (entering(tcp)) {
Roland McGrathb2dee132005-06-01 19:02:36 +0000308 printflags(bootflags, tcp->u_arg[0], "RB_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000309 if (tcp->u_arg[0] & RB_STRING) {
310 printstr(tcp, tcp->u_arg[1], -1);
311 }
312 }
313 return 0;
314}
315
316int
317sys_sysacct(tcp)
318struct tcb *tcp;
319{
320 if (entering(tcp)) {
321 printstr(tcp, tcp->u_arg[0], -1);
322 }
323 return 0;
324}
325
326int
327sys_swapon(tcp)
328struct tcb *tcp;
329{
330 if (entering(tcp)) {
331 printstr(tcp, tcp->u_arg[0], -1);
332 }
333 return 0;
334}
335
336int
337sys_nfs_svc(tcp)
338struct tcb *tcp;
339{
340 if (entering(tcp)) {
341 printsock(tcp, tcp->u_arg[0]);
342 }
343 return 0;
344}
345
Roland McGrathd9f816f2004-09-04 03:39:20 +0000346static const struct xlat mountflags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000347 { M_RDONLY, "M_RDONLY" },
348 { M_NOSUID, "M_NOSUID" },
349 { M_NEWTYPE, "M_NEWTYPE" },
350 { M_GRPID, "M_GRPID" },
351#ifdef M_REMOUNT
352 { M_REMOUNT, "M_REMOUNT" },
353#endif
354#ifdef M_NOSUB
355 { M_NOSUB, "M_NOSUB" },
356#endif
357#ifdef M_MULTI
358 { M_MULTI, "M_MULTI" },
359#endif
360#ifdef M_SYS5
361 { M_SYS5, "M_SYS5" },
362#endif
363 { 0, NULL },
364};
365
Roland McGrathd9f816f2004-09-04 03:39:20 +0000366static const struct xlat nfsflags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000367 { NFSMNT_SOFT, "NFSMNT_SOFT" },
368 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
369 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
370 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
371 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
372 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
373 { NFSMNT_INT, "NFSMNT_INT" },
374 { NFSMNT_NOAC, "NFSMNT_NOAC" },
375 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
376 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
377 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
378 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
379#ifdef NFSMNT_SECURE
380 { NFSMNT_SECURE, "NFSMNT_SECURE" },
381#endif
382#ifdef NFSMNT_NOCTO
383 { NFSMNT_NOCTO, "NFSMNT_NOCTO" },
384#endif
385#ifdef NFSMNT_POSIX
386 { NFSMNT_POSIX, "NFSMNT_POSIX" },
387#endif
388 { 0, NULL },
389};
390
391int
392sys_mount(tcp)
393struct tcb *tcp;
394{
395 char type[4];
396
397 if (entering(tcp)) {
398 if (!(tcp->u_arg[2] & M_NEWTYPE) || umovestr(tcp,
399 tcp->u_arg[0], sizeof type, type) < 0) {
400 tprintf("OLDTYPE:#%lx", tcp->u_arg[0]);
401 } else {
402 tprintf("\"%s\", ", type);
403 }
404 printstr(tcp, tcp->u_arg[1], -1);
405 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000406 printflags(mountflags, tcp->u_arg[2] & ~M_NEWTYPE, "M_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000407 tprintf(", ");
408
409 if (strcmp(type, "4.2") == 0) {
410 struct ufs_args a;
411 if (umove(tcp, tcp->u_arg[3], &a) < 0)
412 return 0;
413 printstr(tcp, (int)a.fspec, -1);
414 } else if (strcmp(type, "lo") == 0) {
415 struct lo_args a;
416 if (umove(tcp, tcp->u_arg[3], &a) < 0)
417 return 0;
418 printstr(tcp, (int)a.fsdir, -1);
419 } else if (strcmp(type, "nfs") == 0) {
420 struct nfs_args a;
421 if (umove(tcp, tcp->u_arg[3], &a) < 0)
422 return 0;
423 tprintf("[");
424 printsock(tcp, (int) a.addr);
425 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000426 printflags(nfsflags, a.flags, "NFSMNT_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000427 tprintf(", ws:%u,rs:%u,to:%u,re:%u,",
428 a.wsize, a.rsize, a.timeo, a.retrans);
429 if (a.flags & NFSMNT_HOSTNAME && a.hostname)
430 printstr(tcp, (int)a.hostname, -1);
431 else
432 tprintf("%#lx", (unsigned long) a.hostname);
433 tprintf(",reg-min:%u,max:%u,dir-min:%u,max:%u,",
434 a.acregmin, a.acregmax, a.acdirmin, a.acdirmax);
435 if ((a.flags & NFSMNT_SECURE) && a.netname)
436 printstr(tcp, (int) a.netname, -1);
437 else
438 tprintf("%#lx", (unsigned long) a.netname);
439 tprintf("]");
440 } else if (strcmp(type, "rfs") == 0) {
441 struct rfs_args a;
442 struct token t;
443 if (umove(tcp, tcp->u_arg[3], &a) < 0)
444 return 0;
445 tprintf("[");
446 printstr(tcp, (int)a.rmtfs, -1);
447 if (umove(tcp, (int)a.token, &t) < 0)
448 return 0;
449 tprintf(", %u, %s]", t.t_id, t.t_uname);
450 } else if (strcmp(type, "pcfs") == 0) {
451 struct pc_args a;
452 if (umove(tcp, tcp->u_arg[3], &a) < 0)
453 return 0;
454 printstr(tcp, (int)a.fspec, -1);
455 }
456 }
457 return 0;
458}
459
460int
461sys_unmount(tcp)
462struct tcb *tcp;
463{
464 if (entering(tcp)) {
465 printstr(tcp, tcp->u_arg[0], -1);
466 }
467 return 0;
468}
469
470int
471sys_umount(tcp)
472struct tcb *tcp;
473{
474 return sys_unmount(tcp);
475}
476
477int
478sys_auditsys(tcp)
479struct tcb *tcp;
480{
481 /* XXX - no information available */
482 return printargs(tcp);
483}
484
Roland McGrathd9f816f2004-09-04 03:39:20 +0000485static const struct xlat ex_auth_flags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000486 { AUTH_UNIX, "AUTH_UNIX" },
487 { AUTH_DES, "AUTH_DES" },
488 { 0, NULL },
489};
490
491int
492sys_exportfs(tcp)
493struct tcb *tcp;
494{
495 struct export e;
496 int i;
497
498 if (entering(tcp)) {
499 printstr(tcp, tcp->u_arg[0], -1);
500 if (umove(tcp, tcp->u_arg[1], &e) < 0) {
501 tprintf("%#lx", tcp->u_arg[1]);
502 return 0;
503 }
504 tprintf("{fl:%u, anon:%u, ", e.ex_flags, e.ex_anon);
505 printxval(ex_auth_flags, e.ex_auth, "AUTH_???");
506 tprintf(", roots:[");
507 if (e.ex_auth == AUTH_UNIX) {
508 for (i=0; i<e.ex_u.exunix.rootaddrs.naddrs; i++) {
509 printsock(tcp,
510 (int)&e.ex_u.exunix.rootaddrs.addrvec[i]);
511 }
512 tprintf("], writers:[");
513 for (i=0; i<e.ex_writeaddrs.naddrs; i++) {
514 printsock(tcp,
515 (int)&e.ex_writeaddrs.addrvec[i]);
516 }
517 tprintf("]");
518 } else {
519 for (i=0; i<e.ex_u.exdes.nnames; i++) {
520 printsock(tcp,
521 (int)&e.ex_u.exdes.rootnames[i]);
522 tprintf(", ");
523 }
524 tprintf("], window:%u", e.ex_u.exdes.window);
525 }
526 tprintf("}");
527 }
528 return 0;
529}
530
Roland McGrathd9f816f2004-09-04 03:39:20 +0000531static const struct xlat sysconflimits[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000532#ifdef _SC_ARG_MAX
533 { _SC_ARG_MAX, "_SC_ARG_MAX" }, /* space for argv & envp */
534#endif
535#ifdef _SC_CHILD_MAX
536 { _SC_CHILD_MAX, "_SC_CHILD_MAX" }, /* maximum children per process??? */
537#endif
538#ifdef _SC_CLK_TCK
539 { _SC_CLK_TCK, "_SC_CLK_TCK" }, /* clock ticks/sec */
540#endif
541#ifdef _SC_NGROUPS_MAX
542 { _SC_NGROUPS_MAX, "_SC_NGROUPS_MAX" }, /* number of groups if multple supp. */
543#endif
544#ifdef _SC_OPEN_MAX
545 { _SC_OPEN_MAX, "_SC_OPEN_MAX" }, /* max open files per process */
546#endif
547#ifdef _SC_JOB_CONTROL
548 { _SC_JOB_CONTROL, "_SC_JOB_CONTROL" }, /* do we have job control */
549#endif
550#ifdef _SC_SAVED_IDS
551 { _SC_SAVED_IDS, "_SC_SAVED_IDS" }, /* do we have saved uid/gids */
552#endif
553#ifdef _SC_VERSION
554 { _SC_VERSION, "_SC_VERSION" }, /* POSIX version supported */
555#endif
556 { 0, NULL },
557};
558
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000559int
560sys_sysconf(tcp)
561struct tcb *tcp;
562{
563 if (entering(tcp)) {
564 printxval(sysconflimits, tcp->u_arg[0], "_SC_???");
565 }
566 return 0;
567}
568
569#endif /* SUNOS4 */
570
571#if defined(SUNOS4) || defined(FREEBSD)
Roland McGrathd9f816f2004-09-04 03:39:20 +0000572static const struct xlat pathconflimits[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000573#ifdef _PC_LINK_MAX
574 { _PC_LINK_MAX, "_PC_LINK_MAX" }, /* max links to file/dir */
575#endif
576#ifdef _PC_MAX_CANON
577 { _PC_MAX_CANON, "_PC_MAX_CANON" }, /* max line length */
578#endif
579#ifdef _PC_MAX_INPUT
580 { _PC_MAX_INPUT, "_PC_MAX_INPUT" }, /* max "packet" to a tty device */
581#endif
582#ifdef _PC_NAME_MAX
583 { _PC_NAME_MAX, "_PC_NAME_MAX" }, /* max pathname component length */
584#endif
585#ifdef _PC_PATH_MAX
586 { _PC_PATH_MAX, "_PC_PATH_MAX" }, /* max pathname length */
587#endif
588#ifdef _PC_PIPE_BUF
589 { _PC_PIPE_BUF, "_PC_PIPE_BUF" }, /* size of a pipe */
590#endif
591#ifdef _PC_CHOWN_RESTRICTED
592 { _PC_CHOWN_RESTRICTED, "_PC_CHOWN_RESTRICTED" }, /* can we give away files */
593#endif
594#ifdef _PC_NO_TRUNC
595 { _PC_NO_TRUNC, "_PC_NO_TRUNC" }, /* trunc or error on >NAME_MAX */
596#endif
597#ifdef _PC_VDISABLE
598 { _PC_VDISABLE, "_PC_VDISABLE" }, /* best char to shut off tty c_cc */
599#endif
600 { 0, NULL },
601};
602
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000603
604int
605sys_pathconf(tcp)
606struct tcb *tcp;
607{
608 if (entering(tcp)) {
609 printstr(tcp, tcp->u_arg[0], -1);
610 tprintf(", ");
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000611 printxval(pathconflimits, tcp->u_arg[1], "_PC_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000612 }
613 return 0;
614}
615
616int
617sys_fpathconf(tcp)
618struct tcb *tcp;
619{
620 if (entering(tcp)) {
621 tprintf("%lu, ", tcp->u_arg[0]);
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000622 printxval(pathconflimits, tcp->u_arg[1], "_PC_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000623 }
624 return 0;
625}
626
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000627#endif /* SUNOS4 || FREEBSD */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000628
629#ifdef SVR4
630
631#ifdef HAVE_SYS_SYSCONFIG_H
632#include <sys/sysconfig.h>
633#endif /* HAVE_SYS_SYSCONFIG_H */
634
635#include <sys/mount.h>
636#include <sys/systeminfo.h>
637#include <sys/utsname.h>
638
Roland McGrathd9f816f2004-09-04 03:39:20 +0000639static const struct xlat sysconfig_options[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000640#ifdef _CONFIG_NGROUPS
641 { _CONFIG_NGROUPS, "_CONFIG_NGROUPS" },
642#endif
643#ifdef _CONFIG_CHILD_MAX
644 { _CONFIG_CHILD_MAX, "_CONFIG_CHILD_MAX" },
645#endif
646#ifdef _CONFIG_OPEN_FILES
647 { _CONFIG_OPEN_FILES, "_CONFIG_OPEN_FILES" },
648#endif
649#ifdef _CONFIG_POSIX_VER
650 { _CONFIG_POSIX_VER, "_CONFIG_POSIX_VER" },
651#endif
652#ifdef _CONFIG_PAGESIZE
653 { _CONFIG_PAGESIZE, "_CONFIG_PAGESIZE" },
654#endif
655#ifdef _CONFIG_CLK_TCK
656 { _CONFIG_CLK_TCK, "_CONFIG_CLK_TCK" },
657#endif
658#ifdef _CONFIG_XOPEN_VER
659 { _CONFIG_XOPEN_VER, "_CONFIG_XOPEN_VER" },
660#endif
661#ifdef _CONFIG_PROF_TCK
662 { _CONFIG_PROF_TCK, "_CONFIG_PROF_TCK" },
663#endif
664#ifdef _CONFIG_NPROC_CONF
665 { _CONFIG_NPROC_CONF, "_CONFIG_NPROC_CONF" },
666#endif
667#ifdef _CONFIG_NPROC_ONLN
668 { _CONFIG_NPROC_ONLN, "_CONFIG_NPROC_ONLN" },
669#endif
670#ifdef _CONFIG_AIO_LISTIO_MAX
671 { _CONFIG_AIO_LISTIO_MAX, "_CONFIG_AIO_LISTIO_MAX" },
672#endif
673#ifdef _CONFIG_AIO_MAX
674 { _CONFIG_AIO_MAX, "_CONFIG_AIO_MAX" },
675#endif
676#ifdef _CONFIG_AIO_PRIO_DELTA_MAX
677 { _CONFIG_AIO_PRIO_DELTA_MAX, "_CONFIG_AIO_PRIO_DELTA_MAX" },
678#endif
679#ifdef _CONFIG_CONFIG_DELAYTIMER_MAX
680 { _CONFIG_DELAYTIMER_MAX, "_CONFIG_DELAYTIMER_MAX" },
681#endif
682#ifdef _CONFIG_MQ_OPEN_MAX
683 { _CONFIG_MQ_OPEN_MAX, "_CONFIG_MQ_OPEN_MAX" },
684#endif
685#ifdef _CONFIG_MQ_PRIO_MAX
686 { _CONFIG_MQ_PRIO_MAX, "_CONFIG_MQ_PRIO_MAX" },
687#endif
688#ifdef _CONFIG_RTSIG_MAX
689 { _CONFIG_RTSIG_MAX, "_CONFIG_RTSIG_MAX" },
690#endif
691#ifdef _CONFIG_SEM_NSEMS_MAX
692 { _CONFIG_SEM_NSEMS_MAX, "_CONFIG_SEM_NSEMS_MAX" },
693#endif
694#ifdef _CONFIG_SEM_VALUE_MAX
695 { _CONFIG_SEM_VALUE_MAX, "_CONFIG_SEM_VALUE_MAX" },
696#endif
697#ifdef _CONFIG_SIGQUEUE_MAX
698 { _CONFIG_SIGQUEUE_MAX, "_CONFIG_SIGQUEUE_MAX" },
699#endif
700#ifdef _CONFIG_SIGRT_MIN
701 { _CONFIG_SIGRT_MIN, "_CONFIG_SIGRT_MIN" },
702#endif
703#ifdef _CONFIG_SIGRT_MAX
704 { _CONFIG_SIGRT_MAX, "_CONFIG_SIGRT_MAX" },
705#endif
706#ifdef _CONFIG_TIMER_MAX
707 { _CONFIG_TIMER_MAX, "_CONFIG_TIMER_MAX" },
708#endif
709#ifdef _CONFIG_CONFIG_PHYS_PAGES
710 { _CONFIG_PHYS_PAGES, "_CONFIG_PHYS_PAGES" },
711#endif
712#ifdef _CONFIG_AVPHYS_PAGES
713 { _CONFIG_AVPHYS_PAGES, "_CONFIG_AVPHYS_PAGES" },
714#endif
715 { 0, NULL },
716};
717
718int
719sys_sysconfig(tcp)
720struct tcb *tcp;
721{
722 if (entering(tcp))
723 printxval(sysconfig_options, tcp->u_arg[0], "_CONFIG_???");
724 return 0;
725}
726
Roland McGrathd9f816f2004-09-04 03:39:20 +0000727static const struct xlat sysinfo_options[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000728 { SI_SYSNAME, "SI_SYSNAME" },
729 { SI_HOSTNAME, "SI_HOSTNAME" },
730 { SI_RELEASE, "SI_RELEASE" },
731 { SI_VERSION, "SI_VERSION" },
732 { SI_MACHINE, "SI_MACHINE" },
733 { SI_ARCHITECTURE, "SI_ARCHITECTURE" },
734 { SI_HW_SERIAL, "SI_HW_SERIAL" },
735 { SI_HW_PROVIDER, "SI_HW_PROVIDER" },
736 { SI_SRPC_DOMAIN, "SI_SRPC_DOMAIN" },
737#ifdef SI_SET_HOSTNAME
738 { SI_SET_HOSTNAME, "SI_SET_HOSTNAME" },
739#endif
740#ifdef SI_SET_SRPC_DOMAIN
741 { SI_SET_SRPC_DOMAIN, "SI_SET_SRPC_DOMAIN" },
742#endif
743#ifdef SI_SET_KERB_REALM
744 { SI_SET_KERB_REALM, "SI_SET_KERB_REALM" },
745#endif
746#ifdef SI_KERB_REALM
747 { SI_KERB_REALM, "SI_KERB_REALM" },
748#endif
749 { 0, NULL },
750};
751
752int
753sys_sysinfo(tcp)
754struct tcb *tcp;
755{
756 if (entering(tcp)) {
757 printxval(sysinfo_options, tcp->u_arg[0], "SI_???");
758 tprintf(", ");
759 }
760 else {
761 /* Technically some calls write values. So what. */
762 if (syserror(tcp))
763 tprintf("%#lx", tcp->u_arg[1]);
764 else
765 printpath(tcp, tcp->u_arg[1]);
766 tprintf(", %lu", tcp->u_arg[2]);
767 }
768 return 0;
769}
770
771#ifdef MIPS
772
773#include <sys/syssgi.h>
774
Roland McGrathd9f816f2004-09-04 03:39:20 +0000775static const struct xlat syssgi_options[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000776 { SGI_SYSID, "SGI_SYSID" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000777#ifdef SGI_RDUBLK
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000778 { SGI_RDUBLK, "SGI_RDUBLK" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000779#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000780 { SGI_TUNE, "SGI_TUNE" },
781 { SGI_IDBG, "SGI_IDBG" },
782 { SGI_INVENT, "SGI_INVENT" },
783 { SGI_RDNAME, "SGI_RDNAME" },
784 { SGI_SETLED, "SGI_SETLED" },
785 { SGI_SETNVRAM, "SGI_SETNVRAM" },
786 { SGI_GETNVRAM, "SGI_GETNVRAM" },
787 { SGI_QUERY_FTIMER, "SGI_QUERY_FTIMER" },
788 { SGI_QUERY_CYCLECNTR, "SGI_QUERY_CYCLECNTR" },
789 { SGI_PROCSZ, "SGI_PROCSZ" },
790 { SGI_SIGACTION, "SGI_SIGACTION" },
791 { SGI_SIGPENDING, "SGI_SIGPENDING" },
792 { SGI_SIGPROCMASK, "SGI_SIGPROCMASK" },
793 { SGI_SIGSUSPEND, "SGI_SIGSUSPEND" },
794 { SGI_SETSID, "SGI_SETSID" },
795 { SGI_SETPGID, "SGI_SETPGID" },
796 { SGI_SYSCONF, "SGI_SYSCONF" },
797 { SGI_WAIT4, "SGI_WAIT4" },
798 { SGI_PATHCONF, "SGI_PATHCONF" },
799 { SGI_READB, "SGI_READB" },
800 { SGI_WRITEB, "SGI_WRITEB" },
801 { SGI_SETGROUPS, "SGI_SETGROUPS" },
802 { SGI_GETGROUPS, "SGI_GETGROUPS" },
803 { SGI_SETTIMEOFDAY, "SGI_SETTIMEOFDAY" },
804 { SGI_SETTIMETRIM, "SGI_SETTIMETRIM" },
805 { SGI_GETTIMETRIM, "SGI_GETTIMETRIM" },
806 { SGI_SPROFIL, "SGI_SPROFIL" },
807 { SGI_RUSAGE, "SGI_RUSAGE" },
808 { SGI_SIGSTACK, "SGI_SIGSTACK" },
809 { SGI_SIGSTATUS, "SGI_SIGSTATUS" },
810 { SGI_NETPROC, "SGI_NETPROC" },
811 { SGI_SIGALTSTACK, "SGI_SIGALTSTACK" },
812 { SGI_BDFLUSHCNT, "SGI_BDFLUSHCNT" },
813 { SGI_SSYNC, "SGI_SSYNC" },
814 { SGI_NFSCNVT, "SGI_NFSCNVT" },
815 { SGI_GETPGID, "SGI_GETPGID" },
816 { SGI_GETSID, "SGI_GETSID" },
817 { SGI_IOPROBE, "SGI_IOPROBE" },
818 { SGI_CONFIG, "SGI_CONFIG" },
819 { SGI_ELFMAP, "SGI_ELFMAP" },
820 { SGI_MCONFIG, "SGI_MCONFIG" },
821 { SGI_GETPLABEL, "SGI_GETPLABEL" },
822 { SGI_SETPLABEL, "SGI_SETPLABEL" },
823 { SGI_GETLABEL, "SGI_GETLABEL" },
824 { SGI_SETLABEL, "SGI_SETLABEL" },
825 { SGI_SATREAD, "SGI_SATREAD" },
826 { SGI_SATWRITE, "SGI_SATWRITE" },
827 { SGI_SATCTL, "SGI_SATCTL" },
828 { SGI_LOADATTR, "SGI_LOADATTR" },
829 { SGI_UNLOADATTR, "SGI_UNLOADATTR" },
830#ifdef SGI_RECVLMSG
831 { SGI_RECVLMSG, "SGI_RECVLMSG" },
832#endif
833 { SGI_PLANGMOUNT, "SGI_PLANGMOUNT" },
834 { SGI_GETPSOACL, "SGI_GETPSOACL" },
835 { SGI_SETPSOACL, "SGI_SETPSOACL" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000836#ifdef SGI_EAG_GET_ATTR
837 { SGI_EAG_GET_ATTR, "SGI_EAG_GET_ATTR" },
838#endif
839#ifdef SGI_EAG_SET_ATTR
840 { SGI_EAG_SET_ATTR, "SGI_EAG_SET_ATTR" },
841#endif
842#ifdef SGI_EAG_GET_PROCATTR
843 { SGI_EAG_GET_PROCATTR, "SGI_EAG_GET_PROCATTR" },
844#endif
845#ifdef SGI_EAG_SET_PROCATTR
846 { SGI_EAG_SET_PROCATTR, "SGI_EAG_SET_PROCATTR" },
847#endif
848#ifdef SGI_FREVOKE
849 { SGI_FREVOKE, "SGI_FREVOKE" },
850#endif
851#ifdef SGI_SBE_GET_INFO
852 { SGI_SBE_GET_INFO, "SGI_SBE_GET_INFO" },
853#endif
854#ifdef SGI_SBE_CLR_INFO
855 { SGI_SBE_CLR_INFO, "SGI_SBE_CLR_INFO" },
856#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000857 { SGI_RMI_FIXECC, "SGI_RMI_FIXECC" },
858 { SGI_R4K_CERRS, "SGI_R4K_CERRS" },
859 { SGI_GET_EVCONF, "SGI_GET_EVCONF" },
860 { SGI_MPCWAROFF, "SGI_MPCWAROFF" },
861 { SGI_SET_AUTOPWRON, "SGI_SET_AUTOPWRON" },
862 { SGI_SPIPE, "SGI_SPIPE" },
863 { SGI_SYMTAB, "SGI_SYMTAB" },
864#ifdef SGI_SET_FPDEBUG
865 { SGI_SET_FPDEBUG, "SGI_SET_FPDEBUG" },
866#endif
Wichert Akkerman8829a551999-06-11 13:18:40 +0000867#ifdef SGI_SET_FP_PRECISE
868 { SGI_SET_FP_PRECISE, "SGI_SET_FP_PRECISE" },
869#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000870 { SGI_TOSSTSAVE, "SGI_TOSSTSAVE" },
871 { SGI_FDHI, "SGI_FDHI" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000872#ifdef SGI_SET_CONFIG_SMM
873 { SGI_SET_CONFIG_SMM, "SGI_SET_CONFIG_SMM" },
874#endif
875#ifdef SGI_SET_FP_PRESERVE
876 { SGI_SET_FP_PRESERVE, "SGI_SET_FP_PRESERVE" },
877#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000878 { SGI_MINRSS, "SGI_MINRSS" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000879#ifdef SGI_GRIO
880 { SGI_GRIO, "SGI_GRIO" },
881#endif
882#ifdef SGI_XLV_SET_TAB
883 { SGI_XLV_SET_TAB, "SGI_XLV_SET_TAB" },
884#endif
885#ifdef SGI_XLV_GET_TAB
886 { SGI_XLV_GET_TAB, "SGI_XLV_GET_TAB" },
887#endif
888#ifdef SGI_GET_FP_PRECISE
889 { SGI_GET_FP_PRECISE, "SGI_GET_FP_PRECISE" },
890#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000891#ifdef SGI_GET_CONFIG_SMM
Wichert Akkerman8829a551999-06-11 13:18:40 +0000892 { SGI_GET_CONFIG_SMM, "SGI_GET_CONFIG_SMM" },
893#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000894#ifdef SGI_FP_IMPRECISE_SUPP
Wichert Akkerman8829a551999-06-11 13:18:40 +0000895 { SGI_FP_IMPRECISE_SUPP,"SGI_FP_IMPRECISE_SUPP" },
896#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000897#ifdef SGI_CONFIG_NSMM_SUPP
Wichert Akkerman8829a551999-06-11 13:18:40 +0000898 { SGI_CONFIG_NSMM_SUPP, "SGI_CONFIG_NSMM_SUPP" },
899#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000900#ifdef SGI_RT_TSTAMP_CREATE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000901 { SGI_RT_TSTAMP_CREATE, "SGI_RT_TSTAMP_CREATE" },
902#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000903#ifdef SGI_RT_TSTAMP_DELETE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000904 { SGI_RT_TSTAMP_DELETE, "SGI_RT_TSTAMP_DELETE" },
905#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000906#ifdef SGI_RT_TSTAMP_START
Wichert Akkerman8829a551999-06-11 13:18:40 +0000907 { SGI_RT_TSTAMP_START, "SGI_RT_TSTAMP_START" },
908#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000909#ifdef SGI_RT_TSTAMP_STOP
Wichert Akkerman8829a551999-06-11 13:18:40 +0000910 { SGI_RT_TSTAMP_STOP, "SGI_RT_TSTAMP_STOP" },
911#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000912#ifdef SGI_RT_TSTAMP_ADDR
Wichert Akkerman8829a551999-06-11 13:18:40 +0000913 { SGI_RT_TSTAMP_ADDR, "SGI_RT_TSTAMP_ADDR" },
914#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000915#ifdef SGI_RT_TSTAMP_MASK
Wichert Akkerman8829a551999-06-11 13:18:40 +0000916 { SGI_RT_TSTAMP_MASK, "SGI_RT_TSTAMP_MASK" },
917#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000918#ifdef SGI_RT_TSTAMP_EOB_MODE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000919 { SGI_RT_TSTAMP_EOB_MODE,"SGI_RT_TSTAMP_EOB_MODE"},
920#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000921#ifdef SGI_USE_FP_BCOPY
Wichert Akkerman8829a551999-06-11 13:18:40 +0000922 { SGI_USE_FP_BCOPY, "SGI_USE_FP_BCOPY" },
923#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000924#ifdef SGI_GET_UST
Wichert Akkerman8829a551999-06-11 13:18:40 +0000925 { SGI_GET_UST, "SGI_GET_UST" },
926#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000927#ifdef SGI_SPECULATIVE_EXEC
Wichert Akkerman8829a551999-06-11 13:18:40 +0000928 { SGI_SPECULATIVE_EXEC, "SGI_SPECULATIVE_EXEC" },
929#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000930#ifdef SGI_XLV_NEXT_RQST
Wichert Akkerman8829a551999-06-11 13:18:40 +0000931 { SGI_XLV_NEXT_RQST, "SGI_XLV_NEXT_RQST" },
932#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000933#ifdef SGI_XLV_ATTR_CURSOR
Wichert Akkerman8829a551999-06-11 13:18:40 +0000934 { SGI_XLV_ATTR_CURSOR, "SGI_XLV_ATTR_CURSOR" },
935#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000936#ifdef SGI_XLV_ATTR_GET
Wichert Akkerman8829a551999-06-11 13:18:40 +0000937 { SGI_XLV_ATTR_GET, "SGI_XLV_ATTR_GET" },
938#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000939#ifdef SGI_XLV_ATTR_SET
Wichert Akkerman8829a551999-06-11 13:18:40 +0000940 { SGI_XLV_ATTR_SET, "SGI_XLV_ATTR_SET" },
941#endif
942#ifdef SGI_BTOOLSIZE
943 { SGI_BTOOLSIZE, "SGI_BTOOLSIZE" },
944#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000945#ifdef SGI_BTOOLGET
Wichert Akkerman8829a551999-06-11 13:18:40 +0000946 { SGI_BTOOLGET, "SGI_BTOOLGET" },
947#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000948#ifdef SGI_BTOOLREINIT
Wichert Akkerman8829a551999-06-11 13:18:40 +0000949 { SGI_BTOOLREINIT, "SGI_BTOOLREINIT" },
950#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000951#ifdef SGI_CREATE_UUID
Wichert Akkerman8829a551999-06-11 13:18:40 +0000952 { SGI_CREATE_UUID, "SGI_CREATE_UUID" },
953#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000954#ifdef SGI_NOFPE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000955 { SGI_NOFPE, "SGI_NOFPE" },
956#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000957#ifdef SGI_OLD_SOFTFP
Wichert Akkerman8829a551999-06-11 13:18:40 +0000958 { SGI_OLD_SOFTFP, "SGI_OLD_SOFTFP" },
959#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000960#ifdef SGI_FS_INUMBERS
Wichert Akkerman8829a551999-06-11 13:18:40 +0000961 { SGI_FS_INUMBERS, "SGI_FS_INUMBERS" },
962#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000963#ifdef SGI_FS_BULKSTAT
Wichert Akkerman8829a551999-06-11 13:18:40 +0000964 { SGI_FS_BULKSTAT, "SGI_FS_BULKSTAT" },
965#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000966#ifdef SGI_RT_TSTAMP_WAIT
Wichert Akkerman8829a551999-06-11 13:18:40 +0000967 { SGI_RT_TSTAMP_WAIT, "SGI_RT_TSTAMP_WAIT" },
968#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000969#ifdef SGI_RT_TSTAMP_UPDATE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000970 { SGI_RT_TSTAMP_UPDATE, "SGI_RT_TSTAMP_UPDATE" },
971#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000972#ifdef SGI_PATH_TO_HANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000973 { SGI_PATH_TO_HANDLE, "SGI_PATH_TO_HANDLE" },
974#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000975#ifdef SGI_PATH_TO_FSHANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000976 { SGI_PATH_TO_FSHANDLE, "SGI_PATH_TO_FSHANDLE" },
977#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000978#ifdef SGI_FD_TO_HANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000979 { SGI_FD_TO_HANDLE, "SGI_FD_TO_HANDLE" },
980#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000981#ifdef SGI_OPEN_BY_HANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000982 { SGI_OPEN_BY_HANDLE, "SGI_OPEN_BY_HANDLE" },
983#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000984#ifdef SGI_READLINK_BY_HANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000985 { SGI_READLINK_BY_HANDLE,"SGI_READLINK_BY_HANDLE"},
986#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000987#ifdef SGI_READ_DANGID
Wichert Akkerman8829a551999-06-11 13:18:40 +0000988 { SGI_READ_DANGID, "SGI_READ_DANGID" },
989#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000990#ifdef SGI_CONST
Wichert Akkerman8829a551999-06-11 13:18:40 +0000991 { SGI_CONST, "SGI_CONST" },
992#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000993#ifdef SGI_XFS_FSOPERATIONS
Wichert Akkerman8829a551999-06-11 13:18:40 +0000994 { SGI_XFS_FSOPERATIONS, "SGI_XFS_FSOPERATIONS" },
995#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000996#ifdef SGI_SETASH
Wichert Akkerman8829a551999-06-11 13:18:40 +0000997 { SGI_SETASH, "SGI_SETASH" },
998#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000999#ifdef SGI_GETASH
Wichert Akkerman8829a551999-06-11 13:18:40 +00001000 { SGI_GETASH, "SGI_GETASH" },
1001#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001002#ifdef SGI_SETPRID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001003 { SGI_SETPRID, "SGI_SETPRID" },
1004#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001005#ifdef SGI_GETPRID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001006 { SGI_GETPRID, "SGI_GETPRID" },
1007#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001008#ifdef SGI_SETSPINFO
Wichert Akkerman8829a551999-06-11 13:18:40 +00001009 { SGI_SETSPINFO, "SGI_SETSPINFO" },
1010#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001011#ifdef SGI_GETSPINFO
Wichert Akkerman8829a551999-06-11 13:18:40 +00001012 { SGI_GETSPINFO, "SGI_GETSPINFO" },
1013#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001014#ifdef SGI_SHAREII
Wichert Akkerman8829a551999-06-11 13:18:40 +00001015 { SGI_SHAREII, "SGI_SHAREII" },
1016#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001017#ifdef SGI_NEWARRAYSESS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001018 { SGI_NEWARRAYSESS, "SGI_NEWARRAYSESS" },
1019#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001020#ifdef SGI_GETDFLTPRID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001021 { SGI_GETDFLTPRID, "SGI_GETDFLTPRID" },
1022#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001023#ifdef SGI_SET_DISMISSED_EXC_CNT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001024 { SGI_SET_DISMISSED_EXC_CNT,"SGI_SET_DISMISSED_EXC_CNT" },
1025#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001026#ifdef SGI_GET_DISMISSED_EXC_CNT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001027 { SGI_GET_DISMISSED_EXC_CNT,"SGI_GET_DISMISSED_EXC_CNT" },
1028#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001029#ifdef SGI_CYCLECNTR_SIZE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001030 { SGI_CYCLECNTR_SIZE, "SGI_CYCLECNTR_SIZE" },
1031#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001032#ifdef SGI_QUERY_FASTTIMER
Wichert Akkerman8829a551999-06-11 13:18:40 +00001033 { SGI_QUERY_FASTTIMER, "SGI_QUERY_FASTTIMER" },
1034#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001035#ifdef SGI_PIDSINASH
Wichert Akkerman8829a551999-06-11 13:18:40 +00001036 { SGI_PIDSINASH, "SGI_PIDSINASH" },
1037#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001038#ifdef SGI_ULI
Wichert Akkerman8829a551999-06-11 13:18:40 +00001039 { SGI_ULI, "SGI_ULI" },
1040#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001041#ifdef SGI_LPG_SHMGET
Wichert Akkerman8829a551999-06-11 13:18:40 +00001042 { SGI_LPG_SHMGET, "SGI_LPG_SHMGET" },
1043#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001044#ifdef SGI_LPG_MAP
Wichert Akkerman8829a551999-06-11 13:18:40 +00001045 { SGI_LPG_MAP, "SGI_LPG_MAP" },
1046#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001047#ifdef SGI_CACHEFS_SYS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001048 { SGI_CACHEFS_SYS, "SGI_CACHEFS_SYS" },
1049#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001050#ifdef SGI_NFSNOTIFY
Wichert Akkerman8829a551999-06-11 13:18:40 +00001051 { SGI_NFSNOTIFY, "SGI_NFSNOTIFY" },
1052#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001053#ifdef SGI_LOCKDSYS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001054 { SGI_LOCKDSYS, "SGI_LOCKDSYS" },
1055#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001056#ifdef SGI_EVENTCTR
Wichert Akkerman8829a551999-06-11 13:18:40 +00001057 { SGI_EVENTCTR, "SGI_EVENTCTR" },
1058#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001059#ifdef SGI_GETPRUSAGE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001060 { SGI_GETPRUSAGE, "SGI_GETPRUSAGE" },
1061#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001062#ifdef SGI_PROCMASK_LOCATION
Wichert Akkerman8829a551999-06-11 13:18:40 +00001063 { SGI_PROCMASK_LOCATION,"SGI_PROCMASK_LOCATION" },
1064#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001065#ifdef SGI_UNUSED
Wichert Akkerman8829a551999-06-11 13:18:40 +00001066 { SGI_UNUSED, "SGI_UNUSED" },
1067#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001068#ifdef SGI_CKPT_SYS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001069 { SGI_CKPT_SYS, "SGI_CKPT_SYS" },
1070#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001071#ifdef SGI_CKPT_SYS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001072 { SGI_CKPT_SYS, "SGI_CKPT_SYS" },
1073#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001074#ifdef SGI_GETGRPPID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001075 { SGI_GETGRPPID, "SGI_GETGRPPID" },
1076#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001077#ifdef SGI_GETSESPID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001078 { SGI_GETSESPID, "SGI_GETSESPID" },
1079#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001080#ifdef SGI_ENUMASHS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001081 { SGI_ENUMASHS, "SGI_ENUMASHS" },
1082#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001083#ifdef SGI_SETASMACHID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001084 { SGI_SETASMACHID, "SGI_SETASMACHID" },
1085#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001086#ifdef SGI_GETASMACHID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001087 { SGI_GETASMACHID, "SGI_GETASMACHID" },
1088#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001089#ifdef SGI_GETARSESS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001090 { SGI_GETARSESS, "SGI_GETARSESS" },
1091#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001092#ifdef SGI_JOINARRAYSESS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001093 { SGI_JOINARRAYSESS, "SGI_JOINARRAYSESS" },
1094#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001095#ifdef SGI_SPROC_KILL
Wichert Akkerman8829a551999-06-11 13:18:40 +00001096 { SGI_SPROC_KILL, "SGI_SPROC_KILL" },
1097#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001098#ifdef SGI_DBA_CONFIG
Wichert Akkerman8829a551999-06-11 13:18:40 +00001099 { SGI_DBA_CONFIG, "SGI_DBA_CONFIG" },
1100#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001101#ifdef SGI_RELEASE_NAME
Wichert Akkerman8829a551999-06-11 13:18:40 +00001102 { SGI_RELEASE_NAME, "SGI_RELEASE_NAME" },
1103#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001104#ifdef SGI_SYNCH_CACHE_HANDLER
Wichert Akkerman8829a551999-06-11 13:18:40 +00001105 { SGI_SYNCH_CACHE_HANDLER,"SGI_SYNCH_CACHE_HANDLER"},
1106#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001107#ifdef SGI_SWASH_INIT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001108 { SGI_SWASH_INIT, "SGI_SWASH_INIT" },
1109#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001110#ifdef SGI_NUMA_MIGR_PAGE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001111 { SGI_NUMA_MIGR_PAGE, "SGI_NUMA_MIGR_PAGE" },
1112#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001113#ifdef SGI_NUMA_MIGR_PAGE_ALT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001114 { SGI_NUMA_MIGR_PAGE_ALT,"SGI_NUMA_MIGR_PAGE_ALT"},
1115#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001116#ifdef SGI_KAIO_USERINIT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001117 { SGI_KAIO_USERINIT, "SGI_KAIO_USERINIT" },
1118#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001119#ifdef SGI_KAIO_READ
Wichert Akkerman8829a551999-06-11 13:18:40 +00001120 { SGI_KAIO_READ, "SGI_KAIO_READ" },
1121#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001122#ifdef SGI_KAIO_WRITE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001123 { SGI_KAIO_WRITE, "SGI_KAIO_WRITE" },
1124#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001125#ifdef SGI_KAIO_SUSPEND
Wichert Akkerman8829a551999-06-11 13:18:40 +00001126 { SGI_KAIO_SUSPEND, "SGI_KAIO_SUSPEND" },
1127#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001128#ifdef SGI_KAIO_STATS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001129 { SGI_KAIO_STATS, "SGI_KAIO_STATS" },
1130#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001131#ifdef SGI_INITIAL_PT_SPROC
Wichert Akkerman8829a551999-06-11 13:18:40 +00001132 { SGI_INITIAL_PT_SPROC, "SGI_INITIAL_PT_SPROC" },
1133#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001134 { 0, NULL },
1135};
1136
1137int
1138sys_syssgi(tcp)
1139struct tcb *tcp;
1140{
1141 int i;
1142
1143 if (entering(tcp)) {
1144 printxval(syssgi_options, tcp->u_arg[0], "SGI_???");
1145 switch (tcp->u_arg[0]) {
1146 default:
1147 for (i = 1; i < tcp->u_nargs; i++)
1148 tprintf(", %#lx", tcp->u_arg[i]);
1149 break;
1150 }
1151 }
1152 return 0;
1153}
1154
1155#include <sys/types.h>
1156#include <rpc/rpc.h>
1157struct cred;
1158struct uio;
1159#include <sys/fsid.h>
1160#include <sys/vnode.h>
1161#include <sys/fs/nfs.h>
1162#include <sys/fs/nfs_clnt.h>
1163
Roland McGrathd9f816f2004-09-04 03:39:20 +00001164static const struct xlat mount_flags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001165 { MS_RDONLY, "MS_RDONLY" },
1166 { MS_FSS, "MS_FSS" },
1167 { MS_DATA, "MS_DATA" },
1168 { MS_NOSUID, "MS_NOSUID" },
1169 { MS_REMOUNT, "MS_REMOUNT" },
1170 { MS_NOTRUNC, "MS_NOTRUNC" },
1171 { MS_GRPID, "MS_GRPID" },
1172 { MS_NODEV, "MS_NODEV" },
1173 { MS_BEFORE, "MS_BEFORE" },
1174 { MS_AFTER, "MS_AFTER" },
1175 { 0, NULL },
1176};
1177
Roland McGrathd9f816f2004-09-04 03:39:20 +00001178static const struct xlat nfs_flags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001179 { NFSMNT_SOFT, "NFSMNT_SOFT" },
1180 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
1181 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
1182 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
1183 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
1184 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001185#ifdef NFSMNT_NOINT /* IRIX 6 */
1186 { NFSMNT_NOINT, "NFSMNT_NOINT" },
1187#endif
1188#ifdef NFSMNT_INT /* IRIX 5 */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001189 { NFSMNT_INT, "NFSMNT_INT" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001190#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001191 { NFSMNT_NOAC, "NFSMNT_NOAC" },
1192 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
1193 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
1194 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
1195 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
1196 { NFSMNT_PRIVATE, "NFSMNT_PRIVATE" },
1197 { NFSMNT_SYMTTL, "NFSMNT_SYMTTL" },
1198 { NFSMNT_LOOPBACK, "NFSMNT_LOOPBACK" },
1199 { NFSMNT_BASETYPE, "NFSMNT_BASETYPE" },
1200 { NFSMNT_NAMEMAX, "NFSMNT_NAMEMAX" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001201#ifdef NFSMNT_SHORTUID /* IRIX 6 */
1202 { NFSMNT_SHORTUID, "NFSMNT_SHORTUID" },
1203#endif
1204#ifdef NFSMNT_ASYNCNLM /* IRIX 6 */
1205 { NFSMNT_ASYNCNLM, "NFSMNT_ASYNCNLM" },
1206#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001207 { 0, NULL },
1208};
1209
1210int
1211sys_mount(tcp)
1212struct tcb *tcp;
1213{
1214 if (entering(tcp)) {
1215 printpath(tcp, tcp->u_arg[0]);
1216 tprintf(", ");
1217 printpath(tcp, tcp->u_arg[1]);
1218 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001219 printflags(mount_flags, tcp->u_arg[2], "MS_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001220 if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
1221 tprintf(", ");
1222 tprintf("%ld", tcp->u_arg[3]);
1223 }
1224 if (tcp->u_arg[2] & MS_DATA) {
1225 int nfs_type = sysfs(GETFSIND, FSID_NFS);
1226
1227 tprintf(", ");
1228 if (tcp->u_arg[3] == nfs_type) {
1229 struct nfs_args args;
1230 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1231 tprintf("%#lx", tcp->u_arg[4]);
1232 else {
1233 tprintf("addr=");
1234 printsock(tcp, (int) args.addr);
1235 tprintf(", flags=");
Roland McGrathb2dee132005-06-01 19:02:36 +00001236 printflags(nfs_flags, args.flags, "NFSMNT_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001237 tprintf(", hostname=");
1238 printstr(tcp, (int) args.hostname, -1);
1239 tprintf(", ...}");
1240 }
1241 }
1242 else
1243 tprintf("%#lx", tcp->u_arg[4]);
1244 tprintf(", %ld", tcp->u_arg[5]);
1245 }
1246 }
1247 return 0;
1248}
1249
1250#else /* !MIPS */
1251
Wichert Akkerman3377df71999-11-26 13:14:41 +00001252#if UNIXWARE
1253
1254#include <sys/types.h>
1255#include <sys/fstyp.h>
1256#include <sys/mount.h>
1257#include <sys/xti.h>
1258
1259#define NFSCLIENT 1
1260#include <nfs/mount.h>
1261
1262#include <sys/fs/vx_ioctl.h>
1263
Roland McGrathd9f816f2004-09-04 03:39:20 +00001264static const struct xlat mount_flags[] = {
Wichert Akkerman3377df71999-11-26 13:14:41 +00001265 { MS_RDONLY, "MS_RDONLY" },
1266 { MS_FSS, "MS_FSS" },
1267 { MS_DATA, "MS_DATA" },
1268 { MS_HADBAD, "MS_HADBAD" },
1269 { MS_NOSUID, "MS_NOSUID" },
1270 { MS_REMOUNT, "MS_REMOUNT" },
1271 { MS_NOTRUNC, "MS_NOTRUNC" },
1272 { MS_SOFTMNT, "MS_SOFTMNT" },
1273 { MS_SYSSPACE, "MS_SYSSPACE" },
1274 { 0, NULL },
1275};
1276
1277#ifdef VX_MS_MASK
Roland McGrathd9f816f2004-09-04 03:39:20 +00001278static const struct xlat vxfs_flags[] = {
Wichert Akkerman3377df71999-11-26 13:14:41 +00001279 { VX_MS_NOLOG, "VX_MS_NOLOG" },
1280 { VX_MS_BLKCLEAR, "VX_MS_BLKCLEAR" },
1281 { VX_MS_SNAPSHOT, "VX_MS_SNAPSHOT" },
1282 { VX_MS_NODATAINLOG, "VX_MS_NODATAINLOG" },
1283 { VX_MS_DELAYLOG, "VX_MS_DELAYLOG" },
1284 { VX_MS_TMPLOG, "VX_MS_TMPLOG" },
1285 { VX_MS_FILESET, "VX_MS_FILESET" },
1286
1287 { VX_MS_CACHE_DIRECT, "VX_MS_CACHE_DIRECT" },
1288 { VX_MS_CACHE_DSYNC, "VX_MS_CACHE_DSYNC" },
1289 { VX_MS_CACHE_CLOSESYNC,"VX_MS_CACHE_CLOSESYNC" },
1290 { VX_MS_CACHE_TMPCACHE, "VX_MS_CACHE_TMPCACHE" },
1291
1292 { VX_MS_OSYNC_DIRECT, "VX_MS_OSYNC_DIRECT" },
1293 { VX_MS_OSYNC_DSYNC, "VX_MS_OSYNC_DSYNC" },
1294 { VX_MS_OSYNC_CLOSESYNC,"VX_MS_OSYNC_CLOSESYNC" },
1295 { VX_MS_OSYNC_DELAY, "VX_MS_OSYNC_DELAY" },
1296 { 0, NULL, },
1297};
1298#endif
1299
Roland McGrathd9f816f2004-09-04 03:39:20 +00001300static const struct xlat nfs_flags[] = {
Wichert Akkerman3377df71999-11-26 13:14:41 +00001301 { NFSMNT_SOFT, "NFSMNT_SOFT" },
1302 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
1303 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
1304 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
1305 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
1306 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
1307 { NFSMNT_INT, "NFSMNT_INT" },
1308 { NFSMNT_NOAC, "NFSMNT_NOAC" },
1309 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
1310 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
1311 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
1312 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
1313 { NFSMNT_SECURE, "NFSMNT_SECURE" },
1314 { NFSMNT_NOCTO, "NFSMNT_NOCTO" },
1315 { NFSMNT_GRPID, "NFSMNT_GRPID" },
1316 { NFSMNT_RPCTIMESYNC, "NFSMNT_RPCTIMESYNC" },
1317 { NFSMNT_LWPSMAX, "NFSMNT_LWPSMAX" },
1318 { 0, NULL },
1319};
1320
1321int
1322sys_mount(tcp)
1323struct tcb *tcp;
1324{
1325 if (entering(tcp)) {
1326 char fstyp [FSTYPSZ];
1327 printpath(tcp, tcp->u_arg[0]);
1328 tprintf(", ");
1329 printpath(tcp, tcp->u_arg[1]);
1330 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001331 printflags(mount_flags, tcp->u_arg[2], "MS_???");
Wichert Akkerman3377df71999-11-26 13:14:41 +00001332 /* The doc sez that the file system type is given as a
1333 fsindex, and we should use sysfs to work out the name.
1334 This appears to be untrue for UW. Maybe it's untrue
1335 for all SVR4's? */
1336 if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
1337 if (umovestr(tcp, tcp->u_arg[3], FSTYPSZ, fstyp) < 0) {
1338 *fstyp = 0;
1339 tprintf(", %ld", tcp->u_arg[3]);
1340 }
1341 else
1342 tprintf(", \"%s\"", fstyp);
1343 }
1344 if (tcp->u_arg[2] & MS_DATA) {
1345 tprintf(", ");
1346#ifdef VX_MS_MASK
1347 /* On UW7 they don't give us the defines and structs
1348 we need to see what is going on. Bummer. */
1349 if (strcmp (fstyp, "vxfs") == 0) {
1350 struct vx_mountargs5 args;
1351 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1352 tprintf("%#lx", tcp->u_arg[4]);
1353 else {
1354 tprintf("{ flags=");
Roland McGrathb2dee132005-06-01 19:02:36 +00001355 printflags(vxfs_flags, args.mflags, "VX_MS_???");
Wichert Akkerman3377df71999-11-26 13:14:41 +00001356 if (args.mflags & VX_MS_SNAPSHOT) {
1357 tprintf (", snapof=");
1358 printstr (tcp,
Roland McGrathced50da2004-08-31 06:48:46 +00001359 (long) args.primaryspec,
Wichert Akkerman3377df71999-11-26 13:14:41 +00001360 -1);
1361 if (args.snapsize > 0)
1362 tprintf (", snapsize=%ld", args.snapsize);
1363 }
1364 tprintf(" }");
1365 }
1366 }
1367 else
1368#endif
1369 if (strcmp (fstyp, "specfs") == 0) {
1370 tprintf ("dev=");
1371 printstr (tcp, tcp->u_arg[4], -1);
1372 }
1373 else
1374 if (strcmp (fstyp, "nfs") == 0) {
1375 struct nfs_args args;
1376 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1377 tprintf("%#lx", tcp->u_arg[4]);
1378 else {
1379 struct netbuf addr;
1380 tprintf("{ addr=");
1381 if (umove (tcp, (int) args.addr, &addr) < 0) {
1382 tprintf ("%#lx", (long) args.addr);
1383 }
1384 else {
1385 printsock(tcp, (int) addr.buf, addr.len);
1386 }
1387 tprintf(", flags=");
Roland McGrathb2dee132005-06-01 19:02:36 +00001388 printflags(nfs_flags, args.flags, "NFSMNT_???");
Wichert Akkerman3377df71999-11-26 13:14:41 +00001389 tprintf(", hostname=");
1390 printstr(tcp, (int) args.hostname, -1);
1391 tprintf(", ...}");
1392 }
1393 }
1394 else
1395 tprintf("%#lx", tcp->u_arg[4]);
1396 tprintf(", %ld", tcp->u_arg[5]);
1397 }
1398 }
1399 return 0;
1400}
1401
1402#else /* !UNIXWARE */
1403
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001404int
1405sys_mount(tcp)
1406struct tcb *tcp;
1407{
1408 if (entering(tcp)) {
1409 printpath(tcp, tcp->u_arg[0]);
1410 tprintf(", ");
1411 printpath(tcp, tcp->u_arg[1]);
1412 tprintf(", ...");
1413 }
1414 return 0;
1415}
Wichert Akkermanea78f0f1999-11-29 15:34:02 +00001416#endif /* !UNIXWARE */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001417
1418#endif /* !MIPS */
1419
1420#endif /* SVR4 */
1421
Nate Sammons8d5860c1999-07-03 18:53:05 +00001422#ifdef SYS_capget
Wichert Akkermanc7926982000-04-10 22:22:31 +00001423
Roland McGrathd9f816f2004-09-04 03:39:20 +00001424static const struct xlat capabilities[] = {
Wichert Akkermanc7926982000-04-10 22:22:31 +00001425 { 1<<CAP_CHOWN, "CAP_CHOWN" },
1426 { 1<<CAP_DAC_OVERRIDE, "CAP_DAC_OVERRIDE"},
1427 { 1<<CAP_DAC_READ_SEARCH,"CAP_DAC_READ_SEARCH"},
1428 { 1<<CAP_FOWNER, "CAP_FOWNER" },
1429 { 1<<CAP_FSETID, "CAP_FSETID" },
1430 { 1<<CAP_KILL, "CAP_KILL" },
1431 { 1<<CAP_SETGID, "CAP_SETGID" },
1432 { 1<<CAP_SETUID, "CAP_SETUID" },
1433 { 1<<CAP_SETPCAP, "CAP_SETPCAP" },
1434 { 1<<CAP_LINUX_IMMUTABLE,"CAP_LINUX_IMMUTABLE"},
1435 { 1<<CAP_NET_BIND_SERVICE,"CAP_NET_BIND_SERVICE"},
1436 { 1<<CAP_NET_BROADCAST, "CAP_NET_BROADCAST"},
1437 { 1<<CAP_NET_ADMIN, "CAP_NET_ADMIN" },
1438 { 1<<CAP_NET_RAW, "CAP_NET_RAW" },
1439 { 1<<CAP_IPC_LOCK, "CAP_IPC_LOCK" },
1440 { 1<<CAP_IPC_OWNER, "CAP_IPC_OWNER" },
1441 { 1<<CAP_SYS_MODULE, "CAP_SYS_MODULE"},
1442 { 1<<CAP_SYS_RAWIO, "CAP_SYS_RAWIO" },
1443 { 1<<CAP_SYS_CHROOT, "CAP_SYS_CHROOT"},
1444 { 1<<CAP_SYS_PTRACE, "CAP_SYS_PTRACE"},
1445 { 1<<CAP_SYS_PACCT, "CAP_SYS_PACCT" },
1446 { 1<<CAP_SYS_ADMIN, "CAP_SYS_ADMIN" },
1447 { 1<<CAP_SYS_BOOT, "CAP_SYS_BOOT" },
1448 { 1<<CAP_SYS_NICE, "CAP_SYS_NICE" },
1449 { 1<<CAP_SYS_RESOURCE, "CAP_SYS_RESOURCE"},
1450 { 1<<CAP_SYS_TIME, "CAP_SYS_TIME" },
1451 { 1<<CAP_SYS_TTY_CONFIG,"CAP_SYS_TTY_CONFIG"},
1452 { 0, NULL },
1453};
1454
1455
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001456int
1457sys_capget(tcp)
1458struct tcb *tcp;
1459{
Wichert Akkermanc7926982000-04-10 22:22:31 +00001460 static cap_user_header_t arg0 = NULL;
1461 static cap_user_data_t arg1 = NULL;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001462
1463 if(!entering(tcp)) {
Wichert Akkermanc7926982000-04-10 22:22:31 +00001464 if (!arg0) {
1465 if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001466 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001467 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001468 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001469 }
1470 }
1471 if (!arg1) {
1472 if ((arg1 = malloc(sizeof(*arg1))) == 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
1479 if (!tcp->u_arg[0])
1480 tprintf("NULL");
1481 else if (!verbose(tcp))
1482 tprintf("%#lx", tcp->u_arg[0]);
1483 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
1484 tprintf("???");
1485 else {
1486 tprintf("%#x, %d", arg0->version, arg0->pid);
1487 }
1488 tprintf(", ");
1489 if (!tcp->u_arg[1])
1490 tprintf("NULL");
1491 else if (!verbose(tcp))
1492 tprintf("%#lx", tcp->u_arg[1]);
1493 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
1494 tprintf("???");
1495 else {
1496 tprintf("{");
Roland McGrathb2dee132005-06-01 19:02:36 +00001497 printflags(capabilities, arg1->effective, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001498 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001499 printflags(capabilities, arg1->permitted, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001500 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001501 printflags(capabilities, arg1->inheritable, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001502 tprintf("}");
Roland McGrathced50da2004-08-31 06:48:46 +00001503 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001504 }
1505 return 0;
1506}
1507
1508int
1509sys_capset(tcp)
1510struct tcb *tcp;
1511{
Wichert Akkermanc7926982000-04-10 22:22:31 +00001512 static cap_user_header_t arg0 = NULL;
1513 static cap_user_data_t arg1 = NULL;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001514
Wichert Akkermanc7926982000-04-10 22:22:31 +00001515 if(entering(tcp)) {
1516 if (!arg0) {
1517 if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001518 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001519 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001520 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001521 }
1522 }
1523 if (!arg1) {
1524 if ((arg1 = malloc(sizeof(*arg1))) == 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
1531 if (!tcp->u_arg[0])
1532 tprintf("NULL");
1533 else if (!verbose(tcp))
1534 tprintf("%#lx", tcp->u_arg[0]);
1535 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
1536 tprintf("???");
1537 else {
1538 tprintf("%#x, %d", arg0->version, arg0->pid);
1539 }
1540 tprintf(", ");
1541 if (!tcp->u_arg[1])
1542 tprintf("NULL");
1543 else if (!verbose(tcp))
1544 tprintf("%#lx", tcp->u_arg[1]);
1545 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
1546 tprintf("???");
1547 else {
1548 tprintf("{");
Roland McGrathb2dee132005-06-01 19:02:36 +00001549 printflags(capabilities, arg1->effective, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001550 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001551 printflags(capabilities, arg1->permitted, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001552 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001553 printflags(capabilities, arg1->inheritable, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001554 tprintf("}");
Roland McGrathced50da2004-08-31 06:48:46 +00001555 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001556 }
1557 return 0;
1558}
1559
1560#else
1561
1562int sys_capget(tcp)
1563struct tcb *tcp;
1564{
1565 return printargs(tcp);
1566}
1567
1568int sys_capset(tcp)
1569struct tcb *tcp;
1570{
1571 return printargs(tcp);
1572}
1573
1574#endif
1575
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001576#ifdef LINUX
Roland McGrathd9f816f2004-09-04 03:39:20 +00001577static const struct xlat sysctl_root[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001578 { CTL_KERN, "CTL_KERN" },
1579 { CTL_VM, "CTL_VM" },
1580 { CTL_NET, "CTL_NET" },
1581 { CTL_PROC, "CTL_PROC" },
1582 { CTL_FS, "CTL_FS" },
1583 { CTL_DEBUG, "CTL_DEBUG" },
1584 { CTL_DEV, "CTL_DEV" },
1585 { 0, NULL }
1586};
1587
Roland McGrathd9f816f2004-09-04 03:39:20 +00001588static const struct xlat sysctl_kern[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001589 { KERN_OSTYPE, "KERN_OSTYPE" },
1590 { KERN_OSRELEASE, "KERN_OSRELEASE" },
1591 { KERN_OSREV, "KERN_OSREV" },
1592 { KERN_VERSION, "KERN_VERSION" },
1593 { KERN_SECUREMASK, "KERN_SECUREMASK" },
1594 { KERN_PROF, "KERN_PROF" },
1595 { KERN_NODENAME, "KERN_NODENAME" },
1596 { KERN_DOMAINNAME, "KERN_DOMAINNAME" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001597#ifdef KERN_SECURELVL
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001598 { KERN_SECURELVL, "KERN_SECURELVL" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001599#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001600 { KERN_PANIC, "KERN_PANIC" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001601#ifdef KERN_REALROOTDEV
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001602 { KERN_REALROOTDEV, "KERN_REALROOTDEV" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001603#endif
1604#ifdef KERN_JAVA_INTERPRETER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001605 { KERN_JAVA_INTERPRETER, "KERN_JAVA_INTERPRETER" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001606#endif
1607#ifdef KERN_JAVA_APPLETVIEWER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001608 { KERN_JAVA_APPLETVIEWER, "KERN_JAVA_APPLETVIEWER" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001609#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001610 { KERN_SPARC_REBOOT, "KERN_SPARC_REBOOT" },
1611 { KERN_CTLALTDEL, "KERN_CTLALTDEL" },
1612 { KERN_PRINTK, "KERN_PRINTK" },
1613 { KERN_NAMETRANS, "KERN_NAMETRANS" },
1614 { KERN_PPC_HTABRECLAIM, "KERN_PPC_HTABRECLAIM" },
1615 { KERN_PPC_ZEROPAGED, "KERN_PPC_ZEROPAGED" },
1616 { KERN_PPC_POWERSAVE_NAP, "KERN_PPC_POWERSAVE_NAP" },
1617 { KERN_MODPROBE, "KERN_MODPROBE" },
1618 { KERN_SG_BIG_BUFF, "KERN_SG_BIG_BUFF" },
1619 { KERN_ACCT, "KERN_ACCT" },
1620 { KERN_PPC_L2CR, "KERN_PPC_L2CR" },
1621 { KERN_RTSIGNR, "KERN_RTSIGNR" },
1622 { KERN_RTSIGMAX, "KERN_RTSIGMAX" },
1623 { KERN_SHMMAX, "KERN_SHMMAX" },
1624 { KERN_MSGMAX, "KERN_MSGMAX" },
1625 { KERN_MSGMNB, "KERN_MSGMNB" },
1626 { KERN_MSGPOOL, "KERN_MSGPOOL" },
1627 { 0, NULL }
1628};
1629
Roland McGrathd9f816f2004-09-04 03:39:20 +00001630static const struct xlat sysctl_vm[] = {
Roland McGratha796fd02004-03-01 22:10:54 +00001631#ifdef VM_SWAPCTL
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001632 { VM_SWAPCTL, "VM_SWAPCTL" },
Roland McGratha796fd02004-03-01 22:10:54 +00001633#endif
1634#ifdef VM_UNUSED1
1635 { VM_UNUSED1, "VM_UNUSED1" },
1636#endif
1637#ifdef VM_SWAPOUT
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001638 { VM_SWAPOUT, "VM_SWAPOUT" },
Roland McGratha796fd02004-03-01 22:10:54 +00001639#endif
1640#ifdef VM_UNUSED2
1641 { VM_UNUSED2, "VM_UNUSED2" },
1642#endif
1643#ifdef VM_FREEPG
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001644 { VM_FREEPG, "VM_FREEPG" },
Roland McGratha796fd02004-03-01 22:10:54 +00001645#endif
1646#ifdef VM_UNUSED3
1647 { VM_UNUSED3, "VM_UNUSED3" },
1648#endif
1649#ifdef VM_BDFLUSH
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001650 { VM_BDFLUSH, "VM_BDFLUSH" },
Roland McGratha796fd02004-03-01 22:10:54 +00001651#endif
1652#ifdef VM_UNUSED4
1653 { VM_UNUSED4, "VM_UNUSED4" },
1654#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001655 { VM_OVERCOMMIT_MEMORY, "VM_OVERCOMMIT_MEMORY" },
Roland McGratha796fd02004-03-01 22:10:54 +00001656#ifdef VM_BUFFERMEM
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001657 { VM_BUFFERMEM, "VM_BUFFERMEM" },
Roland McGratha796fd02004-03-01 22:10:54 +00001658#endif
1659#ifdef VM_UNUSED5
1660 { VM_UNUSED5, "VM_UNUSED5" },
1661#endif
1662#ifdef VM_PAGECACHE
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001663 { VM_PAGECACHE, "VM_PAGECACHE" },
Roland McGratha796fd02004-03-01 22:10:54 +00001664#endif
1665#ifdef VM_UNUSED7
1666 { VM_UNUSED7, "VM_UNUSED7" },
1667#endif
1668#ifdef VM_PAGERDAEMON
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001669 { VM_PAGERDAEMON, "VM_PAGERDAEMON" },
Roland McGratha796fd02004-03-01 22:10:54 +00001670#endif
1671#ifdef VM_UNUSED8
1672 { VM_UNUSED8, "VM_UNUSED8" },
1673#endif
1674#ifdef VM_PGT_CACHE
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001675 { VM_PGT_CACHE, "VM_PGT_CACHE" },
Roland McGratha796fd02004-03-01 22:10:54 +00001676#endif
1677#ifdef VM_UNUSED9
1678 { VM_UNUSED9, "VM_UNUSED9" },
1679#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001680 { VM_PAGE_CLUSTER, "VM_PAGE_CLUSTER" },
1681 { 0, NULL },
1682};
1683
Roland McGrathd9f816f2004-09-04 03:39:20 +00001684static const struct xlat sysctl_net[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001685 { NET_CORE, "NET_CORE" },
1686 { NET_ETHER, "NET_ETHER" },
1687 { NET_802, "NET_802" },
1688 { NET_UNIX, "NET_UNIX" },
1689 { NET_IPV4, "NET_IPV4" },
1690 { NET_IPX, "NET_IPX" },
1691 { NET_ATALK, "NET_ATALK" },
1692 { NET_NETROM, "NET_NETROM" },
1693 { NET_AX25, "NET_AX25" },
1694 { NET_BRIDGE, "NET_BRIDGE" },
1695 { NET_ROSE, "NET_ROSE" },
1696 { NET_IPV6, "NET_IPV6" },
1697 { NET_X25, "NET_X25" },
1698 { NET_TR, "NET_TR" },
1699 { NET_DECNET, "NET_DECNET" },
1700 { 0, NULL }
1701};
1702
Roland McGrathd9f816f2004-09-04 03:39:20 +00001703static const struct xlat sysctl_net_core[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001704 { NET_CORE_WMEM_MAX, "NET_CORE_WMEM_MAX" },
1705 { NET_CORE_RMEM_MAX, "NET_CORE_RMEM_MAX" },
1706 { NET_CORE_WMEM_DEFAULT, "NET_CORE_WMEM_DEFAULT" },
1707 { NET_CORE_RMEM_DEFAULT, "NET_CORE_RMEM_DEFAULT" },
1708 { NET_CORE_MAX_BACKLOG, "NET_CORE_MAX_BACKLOG" },
1709 { NET_CORE_FASTROUTE, "NET_CORE_FASTROUTE" },
1710 { NET_CORE_MSG_COST, "NET_CORE_MSG_COST" },
1711 { NET_CORE_MSG_BURST, "NET_CORE_MSG_BURST" },
1712 { NET_CORE_OPTMEM_MAX, "NET_CORE_OPTMEM_MAX" },
1713 { 0, NULL }
1714};
1715
Roland McGrathd9f816f2004-09-04 03:39:20 +00001716static const struct xlat sysctl_net_unix[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001717 { NET_UNIX_DESTROY_DELAY, "NET_UNIX_DESTROY_DELAY" },
1718 { NET_UNIX_DELETE_DELAY, "NET_UNIX_DELETE_DELAY" },
1719 { 0, NULL }
1720};
1721
Roland McGrathd9f816f2004-09-04 03:39:20 +00001722static const struct xlat sysctl_net_ipv4[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001723 { NET_IPV4_FORWARD, "NET_IPV4_FORWARD" },
1724 { NET_IPV4_DYNADDR, "NET_IPV4_DYNADDR" },
1725 { NET_IPV4_CONF, "NET_IPV4_CONF" },
1726 { NET_IPV4_NEIGH, "NET_IPV4_NEIGH" },
1727 { NET_IPV4_ROUTE, "NET_IPV4_ROUTE" },
1728 { NET_IPV4_FIB_HASH, "NET_IPV4_FIB_HASH" },
1729 { NET_IPV4_TCP_TIMESTAMPS, "NET_IPV4_TCP_TIMESTAMPS" },
1730 { NET_IPV4_TCP_WINDOW_SCALING, "NET_IPV4_TCP_WINDOW_SCALING" },
1731 { NET_IPV4_TCP_SACK, "NET_IPV4_TCP_SACK" },
1732 { NET_IPV4_TCP_RETRANS_COLLAPSE, "NET_IPV4_TCP_RETRANS_COLLAPSE" },
1733 { NET_IPV4_DEFAULT_TTL, "NET_IPV4_DEFAULT_TTL" },
1734 { NET_IPV4_AUTOCONFIG, "NET_IPV4_AUTOCONFIG" },
1735 { NET_IPV4_NO_PMTU_DISC, "NET_IPV4_NO_PMTU_DISC" },
1736 { NET_IPV4_TCP_SYN_RETRIES, "NET_IPV4_TCP_SYN_RETRIES" },
1737 { NET_IPV4_IPFRAG_HIGH_THRESH, "NET_IPV4_IPFRAG_HIGH_THRESH" },
1738 { NET_IPV4_IPFRAG_LOW_THRESH, "NET_IPV4_IPFRAG_LOW_THRESH" },
1739 { NET_IPV4_IPFRAG_TIME, "NET_IPV4_IPFRAG_TIME" },
1740 { NET_IPV4_TCP_MAX_KA_PROBES, "NET_IPV4_TCP_MAX_KA_PROBES" },
1741 { NET_IPV4_TCP_KEEPALIVE_TIME, "NET_IPV4_TCP_KEEPALIVE_TIME" },
1742 { NET_IPV4_TCP_KEEPALIVE_PROBES, "NET_IPV4_TCP_KEEPALIVE_PROBES" },
1743 { NET_IPV4_TCP_RETRIES1, "NET_IPV4_TCP_RETRIES1" },
1744 { NET_IPV4_TCP_RETRIES2, "NET_IPV4_TCP_RETRIES2" },
1745 { NET_IPV4_TCP_FIN_TIMEOUT, "NET_IPV4_TCP_FIN_TIMEOUT" },
1746 { NET_IPV4_IP_MASQ_DEBUG, "NET_IPV4_IP_MASQ_DEBUG" },
1747 { NET_TCP_SYNCOOKIES, "NET_TCP_SYNCOOKIES" },
1748 { NET_TCP_STDURG, "NET_TCP_STDURG" },
1749 { NET_TCP_RFC1337, "NET_TCP_RFC1337" },
1750 { NET_TCP_SYN_TAILDROP, "NET_TCP_SYN_TAILDROP" },
1751 { NET_TCP_MAX_SYN_BACKLOG, "NET_TCP_MAX_SYN_BACKLOG" },
1752 { NET_IPV4_LOCAL_PORT_RANGE, "NET_IPV4_LOCAL_PORT_RANGE" },
1753 { NET_IPV4_ICMP_ECHO_IGNORE_ALL, "NET_IPV4_ICMP_ECHO_IGNORE_ALL" },
1754 { NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS" },
1755 { NET_IPV4_ICMP_SOURCEQUENCH_RATE, "NET_IPV4_ICMP_SOURCEQUENCH_RATE" },
1756 { NET_IPV4_ICMP_DESTUNREACH_RATE, "NET_IPV4_ICMP_DESTUNREACH_RATE" },
1757 { NET_IPV4_ICMP_TIMEEXCEED_RATE, "NET_IPV4_ICMP_TIMEEXCEED_RATE" },
1758 { NET_IPV4_ICMP_PARAMPROB_RATE, "NET_IPV4_ICMP_PARAMPROB_RATE" },
1759 { NET_IPV4_ICMP_ECHOREPLY_RATE, "NET_IPV4_ICMP_ECHOREPLY_RATE" },
1760 { NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES" },
1761 { NET_IPV4_IGMP_MAX_MEMBERSHIPS, "NET_IPV4_IGMP_MAX_MEMBERSHIPS" },
1762 { 0, NULL }
1763};
1764
Roland McGrathd9f816f2004-09-04 03:39:20 +00001765static const struct xlat sysctl_net_ipv4_route[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001766 { NET_IPV4_ROUTE_FLUSH, "NET_IPV4_ROUTE_FLUSH" },
1767 { NET_IPV4_ROUTE_MIN_DELAY, "NET_IPV4_ROUTE_MIN_DELAY" },
1768 { NET_IPV4_ROUTE_MAX_DELAY, "NET_IPV4_ROUTE_MAX_DELAY" },
1769 { NET_IPV4_ROUTE_GC_THRESH, "NET_IPV4_ROUTE_GC_THRESH" },
1770 { NET_IPV4_ROUTE_MAX_SIZE, "NET_IPV4_ROUTE_MAX_SIZE" },
1771 { NET_IPV4_ROUTE_GC_MIN_INTERVAL, "NET_IPV4_ROUTE_GC_MIN_INTERVAL" },
1772 { NET_IPV4_ROUTE_GC_TIMEOUT, "NET_IPV4_ROUTE_GC_TIMEOUT" },
1773 { NET_IPV4_ROUTE_GC_INTERVAL, "NET_IPV4_ROUTE_GC_INTERVAL" },
1774 { NET_IPV4_ROUTE_REDIRECT_LOAD, "NET_IPV4_ROUTE_REDIRECT_LOAD" },
1775 { NET_IPV4_ROUTE_REDIRECT_NUMBER, "NET_IPV4_ROUTE_REDIRECT_NUMBER" },
1776 { NET_IPV4_ROUTE_REDIRECT_SILENCE, "NET_IPV4_ROUTE_REDIRECT_SILENCE" },
1777 { NET_IPV4_ROUTE_ERROR_COST, "NET_IPV4_ROUTE_ERROR_COST" },
1778 { NET_IPV4_ROUTE_ERROR_BURST, "NET_IPV4_ROUTE_ERROR_BURST" },
1779 { NET_IPV4_ROUTE_GC_ELASTICITY, "NET_IPV4_ROUTE_GC_ELASTICITY" },
1780 { 0, NULL }
1781};
1782
Roland McGrathd9f816f2004-09-04 03:39:20 +00001783static const struct xlat sysctl_net_ipv4_conf[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001784 { NET_IPV4_CONF_FORWARDING, "NET_IPV4_CONF_FORWARDING" },
1785 { NET_IPV4_CONF_MC_FORWARDING, "NET_IPV4_CONF_MC_FORWARDING" },
1786 { NET_IPV4_CONF_PROXY_ARP, "NET_IPV4_CONF_PROXY_ARP" },
1787 { NET_IPV4_CONF_ACCEPT_REDIRECTS, "NET_IPV4_CONF_ACCEPT_REDIRECTS" },
1788 { NET_IPV4_CONF_SECURE_REDIRECTS, "NET_IPV4_CONF_SECURE_REDIRECTS" },
1789 { NET_IPV4_CONF_SEND_REDIRECTS, "NET_IPV4_CONF_SEND_REDIRECTS" },
1790 { NET_IPV4_CONF_SHARED_MEDIA, "NET_IPV4_CONF_SHARED_MEDIA" },
1791 { NET_IPV4_CONF_RP_FILTER, "NET_IPV4_CONF_RP_FILTER" },
1792 { NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, "NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE" },
1793 { NET_IPV4_CONF_BOOTP_RELAY, "NET_IPV4_CONF_BOOTP_RELAY" },
1794 { NET_IPV4_CONF_LOG_MARTIANS, "NET_IPV4_CONF_LOG_MARTIANS" },
1795 { 0, NULL }
1796};
1797
Roland McGrathd9f816f2004-09-04 03:39:20 +00001798static const struct xlat sysctl_net_ipv6[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001799 { NET_IPV6_CONF, "NET_IPV6_CONF" },
1800 { NET_IPV6_NEIGH, "NET_IPV6_NEIGH" },
1801 { NET_IPV6_ROUTE, "NET_IPV6_ROUTE" },
1802 { 0, NULL }
1803};
1804
Roland McGrathd9f816f2004-09-04 03:39:20 +00001805static const struct xlat sysctl_net_ipv6_route[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001806 { NET_IPV6_ROUTE_FLUSH, "NET_IPV6_ROUTE_FLUSH" },
1807 { NET_IPV6_ROUTE_GC_THRESH, "NET_IPV6_ROUTE_GC_THRESH" },
1808 { NET_IPV6_ROUTE_MAX_SIZE, "NET_IPV6_ROUTE_MAX_SIZE" },
1809 { NET_IPV6_ROUTE_GC_MIN_INTERVAL, "NET_IPV6_ROUTE_GC_MIN_INTERVAL" },
1810 { NET_IPV6_ROUTE_GC_TIMEOUT, "NET_IPV6_ROUTE_GC_TIMEOUT" },
1811 { NET_IPV6_ROUTE_GC_INTERVAL, "NET_IPV6_ROUTE_GC_INTERVAL" },
1812 { NET_IPV6_ROUTE_GC_ELASTICITY, "NET_IPV6_ROUTE_GC_ELASTICITY" },
1813 { 0, NULL }
1814};
1815
1816int
1817sys_sysctl(tcp)
1818struct tcb *tcp;
1819{
1820 struct __sysctl_args info;
1821 int *name;
Roland McGrathaa524c82005-06-01 19:22:06 +00001822 unsigned long size;
1823
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001824 if (umove (tcp, tcp->u_arg[0], &info) < 0)
1825 return printargs(tcp);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001826
Roland McGrathaa524c82005-06-01 19:22:06 +00001827 size = sizeof (int) * (unsigned long) info.nlen;
1828 name = (size / sizeof (int) != info.nlen) ? NULL : malloc (size);
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001829 if (name == NULL ||
Roland McGrathaa524c82005-06-01 19:22:06 +00001830 umoven(tcp, (unsigned long) info.name, size, (char *) name) < 0) {
1831 free(name);
1832 if (entering(tcp))
1833 tprintf("{%p, %d, %p, %p, %p, %Zu}",
1834 info.name, info.nlen, info.oldval,
1835 info.oldlenp, info.newval, info.newlen);
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001836 return 0;
1837 }
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001838
1839 if (entering(tcp)) {
Roland McGrathaa524c82005-06-01 19:22:06 +00001840 int cnt = 0, max_cnt;
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001841
1842 tprintf("{{");
1843
1844 if (info.nlen == 0)
1845 goto out;
1846 printxval(sysctl_root, name[0], "CTL_???");
1847 ++cnt;
1848
1849 if (info.nlen == 1)
1850 goto out;
1851 switch (name[0]) {
1852 case CTL_KERN:
1853 tprintf(", ");
1854 printxval(sysctl_kern, name[1], "KERN_???");
1855 ++cnt;
1856 break;
1857 case CTL_VM:
1858 tprintf(", ");
1859 printxval(sysctl_vm, name[1], "VM_???");
1860 ++cnt;
1861 break;
1862 case CTL_NET:
1863 tprintf(", ");
1864 printxval(sysctl_net, name[1], "NET_???");
1865 ++cnt;
1866
1867 if (info.nlen == 2)
1868 goto out;
1869 switch (name[1]) {
1870 case NET_CORE:
1871 tprintf(", ");
1872 printxval(sysctl_net_core, name[2],
1873 "NET_CORE_???");
1874 break;
1875 case NET_UNIX:
1876 tprintf(", ");
1877 printxval(sysctl_net_unix, name[2],
1878 "NET_UNIX_???");
1879 break;
1880 case NET_IPV4:
1881 tprintf(", ");
1882 printxval(sysctl_net_ipv4, name[2],
1883 "NET_IPV4_???");
1884
1885 if (info.nlen == 3)
1886 goto out;
1887 switch (name[2]) {
1888 case NET_IPV4_ROUTE:
1889 tprintf(", ");
1890 printxval(sysctl_net_ipv4_route,
1891 name[3],
1892 "NET_IPV4_ROUTE_???");
1893 break;
1894 case NET_IPV4_CONF:
1895 tprintf(", ");
1896 printxval(sysctl_net_ipv4_conf,
1897 name[3],
1898 "NET_IPV4_CONF_???");
1899 break;
1900 default:
1901 goto out;
1902 }
1903 break;
1904 case NET_IPV6:
1905 tprintf(", ");
1906 printxval(sysctl_net_ipv6, name[2],
1907 "NET_IPV6_???");
1908
1909 if (info.nlen == 3)
1910 goto out;
1911 switch (name[2]) {
1912 case NET_IPV6_ROUTE:
1913 tprintf(", ");
1914 printxval(sysctl_net_ipv6_route,
1915 name[3],
1916 "NET_IPV6_ROUTE_???");
1917 break;
1918 default:
1919 goto out;
1920 }
1921 break;
1922 default:
1923 goto out;
1924 }
1925 break;
1926 default:
1927 goto out;
1928 }
1929 out:
Roland McGrath8e4a3e62006-01-12 11:03:46 +00001930 max_cnt = info.nlen;
1931 if (abbrev(tcp) && max_cnt > max_strlen)
1932 max_cnt = max_strlen;
Roland McGrathaa524c82005-06-01 19:22:06 +00001933 while (cnt < max_cnt)
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001934 tprintf(", %x", name[cnt++]);
Roland McGrathaa524c82005-06-01 19:22:06 +00001935 if (cnt < info.nlen)
1936 tprintf(", ...");
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001937 tprintf("}, %d, ", info.nlen);
1938 } else {
1939 size_t oldlen;
Roland McGrathaa524c82005-06-01 19:22:06 +00001940 if (umove(tcp, (size_t)info.oldlenp, &oldlen) >= 0
1941 && info.nlen >= 2
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001942 && ((name[0] == CTL_KERN
1943 && (name[1] == KERN_OSRELEASE
1944 || name[1] == KERN_OSTYPE
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001945#ifdef KERN_JAVA_INTERPRETER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001946 || name[1] == KERN_JAVA_INTERPRETER
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001947#endif
1948#ifdef KERN_JAVA_APPLETVIEWER
1949 || name[1] == KERN_JAVA_APPLETVIEWER
1950#endif
1951 )))) {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001952 printpath(tcp, (size_t)info.oldval);
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001953 tprintf(", %Zu, ", oldlen);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001954 if (info.newval == 0)
1955 tprintf("NULL");
1956 else if (syserror(tcp))
1957 tprintf("%p", info.newval);
1958 else
1959 printpath(tcp, (size_t)info.newval);
1960 tprintf(", %Zd", info.newlen);
1961 } else {
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001962 tprintf("%p, %Zd, %p, %Zd", info.oldval, oldlen,
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001963 info.newval, info.newlen);
1964 }
1965 tprintf("}");
1966 }
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001967
1968 free(name);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001969 return 0;
1970}
1971#else
1972int sys_sysctl(tcp)
1973struct tcb *tcp;
1974{
1975 return printargs(tcp);
1976}
1977#endif
1978
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001979#ifdef FREEBSD
1980#include <sys/sysctl.h>
1981
1982int sys___sysctl(tcp)
1983struct tcb *tcp;
1984{
1985 int qoid[CTL_MAXNAME+2];
1986 char ctl[1024];
1987 size_t len;
1988 int i, numeric;
Roland McGrathced50da2004-08-31 06:48:46 +00001989
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001990 if (entering(tcp)) {
1991 if (tcp->u_arg[1] < 0 || tcp->u_arg[1] > CTL_MAXNAME ||
1992 (umoven(tcp, tcp->u_arg[0], tcp->u_arg[1] * sizeof(int),
1993 (char *) (qoid + 2)) < 0))
1994 tprintf("[...], ");
1995 else {
1996 /* Use sysctl to ask the name of the current MIB
1997 This uses the undocumented "Staff-functions" used
1998 by the sysctl program. See kern_sysctl.c for
1999 details. */
2000 qoid[0] = 0; /* sysctl */
2001 qoid[1] = 1; /* name */
2002 i = sizeof(ctl);
2003 tprintf("[");
2004 if (sysctl(qoid, tcp->u_arg[1] + 2, ctl, &i, 0, 0) >= 0) {
2005 numeric = !abbrev(tcp);
2006 tprintf("%s%s", ctl, numeric ? ", " : "");
2007 } else
2008 numeric = 1;
2009 if (numeric) {
2010 for (i = 0; i < tcp->u_arg[1]; i++)
2011 tprintf("%s%d", i ? "." : "", qoid[i + 2]);
2012 }
2013 tprintf("], ");
2014 tprintf("%lu, ", tcp->u_arg[1]);
2015 }
2016 } else {
2017 if (!syserror(tcp) && (umove(tcp, tcp->u_arg[3], &len) >= 0)) {
2018 printstr(tcp, tcp->u_arg[2], len);
2019 tprintf(", [%u], ", len);
Roland McGrathced50da2004-08-31 06:48:46 +00002020 } else
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00002021 tprintf("%#lx, %#lx, ", tcp->u_arg[2], tcp->u_arg[3]);
2022 printstr(tcp, tcp->u_arg[4], tcp->u_arg[5]);
2023 tprintf(", %lu", tcp->u_arg[5]);
2024 }
2025 return 0;
2026}
2027#endif
Wichert Akkerman16a03d22000-08-10 02:14:04 +00002028
2029#if UNIXWARE >= 2
2030
2031#include <sys/ksym.h>
2032#include <sys/elf.h>
2033
Roland McGrathd9f816f2004-09-04 03:39:20 +00002034static const struct xlat ksym_flags[] = {
Roland McGrathced50da2004-08-31 06:48:46 +00002035 { STT_NOTYPE, "STT_NOTYPE" },
2036 { STT_FUNC, "STT_FUNC" },
2037 { STT_OBJECT, "STT_OBJECT" },
Wichert Akkerman16a03d22000-08-10 02:14:04 +00002038 { 0, NULL },
2039};
2040
2041int
2042sys_getksym(tcp)
2043struct tcb *tcp;
2044{
2045 if (entering (tcp)) {
2046 printstr(tcp, tcp->u_arg[0], -1);
2047 tprintf(", ");
2048 }
2049 else {
2050 if (syserror(tcp)) {
2051 tprintf("%#lx, %#lx",
2052 tcp->u_arg[1], tcp->u_arg[2]);
2053 }
2054 else {
2055 int val;
2056 printnum (tcp, tcp->u_arg[1], "%#lx");
2057 tprintf(", ");
2058 if (umove(tcp, tcp->u_arg[2], &val) < 0) {
2059 tprintf("%#lx", tcp->u_arg[2]);
2060 }
2061 else {
2062 tprintf("[");
2063 printxval (ksym_flags, val, "STT_???");
2064 tprintf("]");
2065 }
2066 }
2067 }
2068
2069 return 0;
2070}
2071
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002072#ifdef HAVE_SYS_NSCSYS_H
John Hughes4e36a812001-04-18 15:11:51 +00002073
John Hughes0aadba42001-10-16 18:19:52 +00002074struct cred;
John Hughes4e36a812001-04-18 15:11:51 +00002075#include <sys/nscsys.h>
2076
Roland McGrathd9f816f2004-09-04 03:39:20 +00002077static const struct xlat ssi_cmd [] = {
John Hughes4e36a812001-04-18 15:11:51 +00002078 { SSISYS_BADOP, "SSISYS_BADOP" },
2079 { SSISYS_LDLVL_INIT,"SSISYS_LDLVL_INIT"},
2080 { SSISYS_LDLVL_GETVEC,"SSISYS_LDLVL_GETVEC"},
2081 { SSISYS_LDLVL_PUTVEC,"SSISYS_LDLVL_PUTVEC"},
2082 { SSISYS_LDLVL_PUTRCMDS,"SSISYS_LDLVL_PUTRCMDS"},
2083 { SSISYS_LDLVL_SETREXEC,"SSISYS_LDLVL_SETREXEC"},
2084 { SSISYS_CMS_CLUSTERID,"SSISYS_CMS_CLUSTERID"},
2085 { SSISYS_CFS_STATVFS,"SSISYS_CFS_STATVFS"},
2086 { SSISYS_NODE_GETNUM,"SSISYS_NODE_GETNUM"},
2087 { SSISYS_NODE_TABLE,"SSISYS_NODE_TABLE"},
2088 { SSISYS_NODE_DOWN,"SSISYS_NODE_DOWN"},
2089 { SSISYS_RECLAIM_CHILD,"SSISYS_RECLAIM_CHILD"},
2090 { SSISYS_IPC_GETINFO,"SSISYS_IPC_GETINFO"},
2091 { SSISYS_ICS_TEST,"SSISYS_ICS_TEST"},
2092 { SSISYS_NODE_PID,"SSISYS_NODE_PID"},
2093 { SSISYS_ISLOCAL,"SSISYS_ISLOCAL"},
2094 { SSISYS_CFS_ISSTACKED,"SSISYS_CFS_ISSTACKED"},
2095 { SSISYS_DNET_SYNC,"SSISYS_DNET_SYNC"},
2096 { SSISYS_CFS_WAIT_MODE,"SSISYS_CFS_WAIT_MODE"},
2097 { SSISYS_CFS_UMOUNT,"SSISYS_CFS_UMOUNT"},
2098 { SSISYS_LLSTAT,"SSISYS_LLSTAT" },
2099 { SSISYS_LTS_PERFTEST,"SSISYS_LTS_PERFTEST"},
2100 { SSISYS_LTS_CONFIG,"SSISYS_LTS_CONFIG"},
2101 { SSISYS_SNET_PERFTEST,"SSISYS_SNET_PERFTEST"},
2102 { SSISYS_IGNORE_HALFUP,"SSISYS_IGNORE_HALFUP"},
2103 { SSISYS_NODE_ROOTDEV,"SSISYS_NODE_ROOTDEV"},
2104 { SSISYS_GET_PRIMARY,"SSISYS_GET_PRIMARY"},
2105 { SSISYS_GET_SECONDARY,"SSISYS_GET_SECONDARY"},
2106 { SSISYS_GET_ROOTDISK,"SSISYS_GET_ROOTDISK"},
2107 { SSISYS_CLUSTERNODE_NUM,"SSISYS_CLUSTERNODE_NUM"},
2108 { SSISYS_CLUSTER_MEMBERSHIP,"SSISYS_CLUSTER_MEMBERSHIP"},
2109 { SSISYS_CLUSTER_DETAILEDTRANS,"SSISYS_CLUSTER_DETAILEDTRANS"},
2110 { SSISYS_CLUSTERNODE_INFO,"SSISYS_CLUSTERNODE_INFO"},
2111 { SSISYS_CLUSTERNODE_SETINFO,"SSISYS_CLUSTERNODE_SETINFO"},
2112 { SSISYS_CLUSTERNODE_AVAIL,"SSISYS_CLUSTERNODE_AVAIL"},
2113 { SSISYS_CLUSTER_MAXNODES,"SSISYS_CLUSTER_MAXNODES"},
2114 { SSISYS_SET_MEMPRIO,"SSISYS_SET_MEMPRIO"},
2115 { SSISYS_GET_USERS,"SSISYS_GET_USERS"},
2116 { SSISYS_FORCE_ROOT_NODE,"SSISYS_FORCE_ROOT_NODE"},
2117 { SSISYS_CVIP_SET,"SSISYS_CVIP_SET"},
2118 { SSISYS_CVIP_GET,"SSISYS_CVIP_GET"},
2119 { SSISYS_GET_NODE_COUNTS,"SSISYS_GET_NODE_COUNTS"},
2120 { SSISYS_GET_TRANSPORT,"SSISYS_GET_TRANSPORT"},
2121 { 0, NULL },
2122};
2123
2124int sys_ssisys (tcp)
2125struct tcb *tcp;
2126{
2127 struct ssisys_iovec iov;
John Hughes2d8b2c52001-10-18 14:52:24 +00002128 cls_nodeinfo_args_t cni;
2129 clusternode_info_t info;
2130
John Hughes4e36a812001-04-18 15:11:51 +00002131 if (entering (tcp)) {
John Hughes0aadba42001-10-16 18:19:52 +00002132 ts_reclaim_child_inargs_t trc;
John Hughes4e36a812001-04-18 15:11:51 +00002133 if (tcp->u_arg[1] != sizeof iov ||
2134 umove (tcp, tcp->u_arg[0], &iov) < 0)
2135 {
2136 tprintf ("%#lx, %ld", tcp->u_arg[0], tcp->u_arg[1]);
2137 return 0;
2138 }
2139 tprintf ("{id=");
2140 printxval(ssi_cmd, iov.tio_id.id_cmd, "SSISYS_???");
2141 tprintf (":%d", iov.tio_id.id_ver);
2142 switch (iov.tio_id.id_cmd) {
John Hughes0aadba42001-10-16 18:19:52 +00002143 case SSISYS_RECLAIM_CHILD:
2144 if (iov.tio_udatainlen != sizeof trc ||
2145 umove (tcp, (long) iov.tio_udatain, &trc) < 0)
2146 goto bad;
2147 tprintf (", in={pid=%ld, start=%ld}",
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002148 trc.trc_pid, trc.trc_start);
John Hughes0aadba42001-10-16 18:19:52 +00002149 break;
2150 case SSISYS_CLUSTERNODE_INFO:
2151 if (iov.tio_udatainlen != sizeof cni ||
2152 umove (tcp, (long) iov.tio_udatain, &cni) < 0)
2153 goto bad;
2154 tprintf (", in={node=%ld, len=%d}",
2155 cni.nodenum, cni.info_len);
2156 break;
John Hughes4e36a812001-04-18 15:11:51 +00002157 default:
John Hughes0aadba42001-10-16 18:19:52 +00002158 bad:
John Hughes4e36a812001-04-18 15:11:51 +00002159 if (iov.tio_udatainlen) {
2160 tprintf (", in=[/* %d bytes */]",
2161 iov.tio_udatainlen);
2162 }
2163 }
2164 }
2165 else {
John Hughes2d8b2c52001-10-18 14:52:24 +00002166 if (tcp->u_arg[1] != sizeof iov ||
2167 umove (tcp, tcp->u_arg[0], &iov) < 0)
2168 goto done;
John Hughes4e36a812001-04-18 15:11:51 +00002169 switch (iov.tio_id.id_cmd) {
John Hughes2d8b2c52001-10-18 14:52:24 +00002170 case SSISYS_CLUSTERNODE_INFO:
2171 if (iov.tio_udatainlen != sizeof cni ||
2172 umove (tcp, (long) iov.tio_udatain, &cni) < 0)
2173 goto bad_out;
Roland McGrathced50da2004-08-31 06:48:46 +00002174 if (cni.info_len != sizeof info ||
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002175 iov.tio_udataoutlen != sizeof &info ||
John Hughes2d8b2c52001-10-18 14:52:24 +00002176 umove (tcp, (long) iov.tio_udataout, &info) < 0)
2177 goto bad_out;
2178 tprintf (", out={node=%ld, cpus=%d, online=%d}",
2179 info.node_num, info.node_totalcpus,
2180 info.node_onlinecpus);
2181 break;
Roland McGrathced50da2004-08-31 06:48:46 +00002182
John Hughes4e36a812001-04-18 15:11:51 +00002183 default:
John Hughes2d8b2c52001-10-18 14:52:24 +00002184 bad_out:
John Hughes4e36a812001-04-18 15:11:51 +00002185 if (iov.tio_udataoutlen) {
2186 tprintf (", out=[/* %d bytes */]",
2187 iov.tio_udataoutlen);
2188 }
2189 }
John Hughes2d8b2c52001-10-18 14:52:24 +00002190 done:
John Hughes4e36a812001-04-18 15:11:51 +00002191 tprintf ("}, %ld", tcp->u_arg[1]);
2192 }
2193 return 0;
2194}
2195
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002196#endif
John Hughes4e36a812001-04-18 15:11:51 +00002197
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002198#endif /* UNIXWARE > 2 */
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002199
2200#ifdef MIPS
2201
Wichert Akkermand6b92492001-04-07 21:37:12 +00002202#ifndef __NEW_UTS_LEN
2203#define __NEW_UTS_LEN 64
2204#endif
2205
Roland McGrathd9f816f2004-09-04 03:39:20 +00002206static const struct xlat sysmips_operations[] = {
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002207 { SETNAME, "SETNAME" },
2208 { FLUSH_CACHE, "FLUSH_CACHE" },
2209 { MIPS_FIXADE, "MIPS_FIXADE" },
2210 { MIPS_RDNVRAM, "MIPS_RDNVRAM" },
2211 { MIPS_ATOMIC_SET, "MIPS_ATOMIC_SET" },
2212 { 0, NULL }
2213};
2214
2215int sys_sysmips(tcp)
2216struct tcb *tcp;
2217{
2218 if (entering(tcp)) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002219 printxval(sysmips_operations, tcp->u_arg[0], "???");
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002220 if (!verbose(tcp)) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002221 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002222 } else if (tcp->u_arg[0]==SETNAME) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002223 char nodename[__NEW_UTS_LEN + 1];
2224 if (umovestr(tcp, tcp->u_arg[1], (__NEW_UTS_LEN + 1), nodename) < 0)
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002225 tprintf(", %#lx", tcp->u_arg[1]);
2226 else
2227 tprintf(", \"%s\"", nodename);
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002228 } else if (tcp->u_arg[0] == MIPS_ATOMIC_SET) {
2229 tprintf(", %#lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
2230 } else if (tcp->u_arg[0] == MIPS_FIXADE) {
2231 tprintf(", 0x%lx", tcp->u_arg[1]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002232 } else {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002233 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002234 }
2235 }
2236
2237 return 0;
2238}
2239
2240#endif /* MIPS */