blob: efa6cd861772cbe29f99001b24c48bc8d75ff2fb [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
39#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
46#include <sys/socket.h>
47#include <netinet/in.h>
48#include <arpa/inet.h>
49
Nate Sammons8d5860c1999-07-03 18:53:05 +000050#include <sys/syscall.h>
51
52#ifdef SYS_personality
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000053/* Workaround for kernel namespace pollution. */
Wichert Akkerman2e2553a1999-05-09 00:29:58 +000054#define _LINUX_PTRACE_H
Nate Sammons8d5860c1999-07-03 18:53:05 +000055/* Yuck yuck yuck. We can't include linux/ptrace.h, but personality.h
56 makes a declaration with struct pt_regs, which is defined there. */
57struct pt_regs;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000058#define sys_personality kernel_sys_personality
59#include <linux/personality.h>
60#undef sys_personality
Nate Sammons8d5860c1999-07-03 18:53:05 +000061#endif /* SYS_personality */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000062
Nate Sammons8d5860c1999-07-03 18:53:05 +000063#ifdef SYS_capget
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000064#include <linux/capability.h>
65#endif
66
Nate Sammons8d5860c1999-07-03 18:53:05 +000067#ifdef SYS_cacheflush
Wichert Akkerman2e2553a1999-05-09 00:29:58 +000068#include <asm/cachectl.h>
69#endif
70
Wichert Akkermand6b92492001-04-07 21:37:12 +000071#ifdef HAVE_LINUX_USTNAME_H
72#include <linux/utsname.h>
73#endif
74
Michal Ludvig39c0e942002-11-06 14:00:12 +000075#ifdef MIPS
Wichert Akkermand6b92492001-04-07 21:37:12 +000076#include <asm/sysmips.h>
77#endif
78
Wichert Akkerman22fe9d21999-05-27 12:00:57 +000079#include <linux/sysctl.h>
Wichert Akkerman22fe9d21999-05-27 12:00:57 +000080
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000081static struct xlat mount_flags[] = {
82 { MS_RDONLY, "MS_RDONLY" },
83 { MS_NOSUID, "MS_NOSUID" },
84 { MS_NODEV, "MS_NODEV" },
85 { MS_NOEXEC, "MS_NOEXEC" },
86#ifdef MS_SYNCHRONOUS
87 { MS_SYNCHRONOUS,"MS_SYNCHRONOUS"},
88#else
89 { MS_SYNC, "MS_SYNC" },
90#endif
91 { MS_REMOUNT, "MS_REMOUNT" },
92 { 0, NULL },
93};
94
95int
96sys_mount(tcp)
97struct tcb *tcp;
98{
99 if (entering(tcp)) {
100 printpath(tcp, tcp->u_arg[0]);
101 tprintf(", ");
102 printpath(tcp, tcp->u_arg[1]);
103 tprintf(", ");
104 printpath(tcp, tcp->u_arg[2]);
105 tprintf(", ");
106 printflags(mount_flags, tcp->u_arg[3]);
107 tprintf(", %#lx", tcp->u_arg[4]);
108 }
109 return 0;
110}
111
Wichert Akkermandacfb6e1999-06-03 14:21:07 +0000112int
113sys_umount2(tcp)
114struct tcb *tcp;
115{
116 if (entering(tcp)) {
117 printstr(tcp, tcp->u_arg[0], -1);
118 tprintf(", ");
119 if (tcp->u_arg[1] & 1)
120 tprintf("MNT_FORCE");
121 else
122 tprintf("0");
123 }
124 return 0;
125}
126
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000127static struct xlat personality_options[] = {
128#ifdef PER_LINUX
129 { PER_LINUX, "PER_LINUX" },
130#endif
131#ifdef PER_LINUX_32BIT
132 { PER_LINUX_32BIT, "PER_LINUX" },
133#endif
134#ifdef PER_SVR4
135 { PER_SVR4, "PER_SVR4" },
136#endif
137#ifdef PER_SVR3
138 { PER_SVR3, "PER_SVR3" },
139#endif
140#ifdef PER_SCOSVR3
141 { PER_SCOSVR3, "PER_SCOSVR3" },
142#endif
143#ifdef PER_WYSEV386
144 { PER_WYSEV386, "PER_WYSEV386" },
145#endif
146#ifdef PER_ISCR4
147 { PER_ISCR4, "PER_ISCR4" },
148#endif
149#ifdef PER_BSD
150 { PER_BSD, "PER_BSD" },
151#endif
152#ifdef PER_XENIX
153 { PER_XENIX, "PER_XENIX" },
154#endif
155 { 0, NULL },
156};
157
158int
159sys_personality(tcp)
160struct tcb *tcp;
161{
162 if (entering(tcp))
163 printxval(personality_options, tcp->u_arg[0], "PER_???");
164 return 0;
165}
166
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000167#include <linux/reboot.h>
168static struct xlat bootflags1[] = {
169 { LINUX_REBOOT_MAGIC1, "LINUX_REBOOT_MAGIC1" },
170 { 0, NULL },
171};
172
173static struct xlat bootflags2[] = {
174 { LINUX_REBOOT_MAGIC2, "LINUX_REBOOT_MAGIC2" },
175 { LINUX_REBOOT_MAGIC2A, "LINUX_REBOOT_MAGIC2A" },
176 { LINUX_REBOOT_MAGIC2B, "LINUX_REBOOT_MAGIC2B" },
177 { 0, NULL },
178};
179
180static struct xlat bootflags3[] = {
181 { LINUX_REBOOT_CMD_CAD_OFF, "LINUX_REBOOT_CMD_CAD_OFF" },
182 { LINUX_REBOOT_CMD_RESTART, "LINUX_REBOOT_CMD_RESTART" },
183 { LINUX_REBOOT_CMD_HALT, "LINUX_REBOOT_CMD_HALT" },
184 { LINUX_REBOOT_CMD_CAD_ON, "LINUX_REBOOT_CMD_CAD_ON" },
185 { LINUX_REBOOT_CMD_POWER_OFF, "LINUX_REBOOT_CMD_POWER_OFF" },
186 { LINUX_REBOOT_CMD_RESTART2, "LINUX_REBOOT_CMD_RESTART2" },
187 { 0, NULL },
188};
189
190int
191sys_reboot(tcp)
192struct tcb *tcp;
193{
194 if (entering(tcp)) {
195 if (!printflags(bootflags1, tcp->u_arg[0]))
196 tprintf("LINUX_REBOOT_MAGIC???");
197 tprintf(", ");
198 if (!printflags(bootflags2, tcp->u_arg[1]))
199 tprintf("LINUX_REBOOT_MAGIC???");
200 tprintf(", ");
201 if (!printflags(bootflags3, tcp->u_arg[2]))
202 tprintf("LINUX_REBOOT_CMD_???");
203 if (tcp->u_arg[2] == LINUX_REBOOT_CMD_RESTART2) {
204 tprintf(", ");
205 printstr(tcp, tcp->u_arg[3], -1);
206 }
207 }
208 return 0;
209}
210
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000211#ifdef M68K
212static struct xlat cacheflush_scope[] = {
213#ifdef FLUSH_SCOPE_LINE
214 { FLUSH_SCOPE_LINE, "FLUSH_SCOPE_LINE" },
215#endif
216#ifdef FLUSH_SCOPE_PAGE
217 { FLUSH_SCOPE_PAGE, "FLUSH_SCOPE_PAGE" },
218#endif
219#ifdef FLUSH_SCOPE_ALL
220 { FLUSH_SCOPE_ALL, "FLUSH_SCOPE_ALL" },
221#endif
222 { 0, NULL },
223};
224
225static struct xlat cacheflush_flags[] = {
226#ifdef FLUSH_CACHE_BOTH
227 { FLUSH_CACHE_BOTH, "FLUSH_CACHE_BOTH" },
228#endif
229#ifdef FLUSH_CACHE_DATA
230 { FLUSH_CACHE_DATA, "FLUSH_CACHE_DATA" },
231#endif
232#ifdef FLUSH_CACHE_INSN
233 { FLUSH_CACHE_INSN, "FLUSH_CACHE_INSN" },
234#endif
235 { 0, NULL },
236};
237
238int
239sys_cacheflush(tcp)
240struct tcb *tcp;
241{
242 if (entering(tcp)) {
243 /* addr */
244 tprintf("%#lx, ", tcp->u_arg[0]);
245 /* scope */
246 printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
247 tprintf(", ");
248 /* flags */
249 printflags(cacheflush_flags, tcp->u_arg[2]);
250 /* len */
251 tprintf(", %lu", tcp->u_arg[3]);
252 }
253 return 0;
254}
255#endif /* M68K */
256
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000257#endif /* LINUX */
258
259#ifdef SUNOS4
260
261#include <sys/reboot.h>
262#define NFSCLIENT
263#define LOFS
264#define RFS
265#define PCFS
266#include <sys/mount.h>
267#include <sys/socket.h>
268#include <nfs/export.h>
269#include <rpc/types.h>
270#include <rpc/auth.h>
271
272/*ARGSUSED*/
273int
274sys_sync(tcp)
275struct tcb *tcp;
276{
277 return 0;
278}
279
280static struct xlat bootflags[] = {
281 { RB_AUTOBOOT, "RB_AUTOBOOT" }, /* for system auto-booting itself */
282 { RB_ASKNAME, "RB_ASKNAME" }, /* ask for file name to reboot from */
283 { RB_SINGLE, "RB_SINGLE" }, /* reboot to single user only */
284 { RB_NOSYNC, "RB_NOSYNC" }, /* dont sync before reboot */
285 { RB_HALT, "RB_HALT" }, /* don't reboot, just halt */
286 { RB_INITNAME, "RB_INITNAME" }, /* name given for /etc/init */
287 { RB_NOBOOTRC, "RB_NOBOOTRC" }, /* don't run /etc/rc.boot */
288 { RB_DEBUG, "RB_DEBUG" }, /* being run under debugger */
289 { RB_DUMP, "RB_DUMP" }, /* dump system core */
290 { RB_WRITABLE, "RB_WRITABLE" }, /* mount root read/write */
291 { RB_STRING, "RB_STRING" }, /* pass boot args to prom monitor */
292 { 0, NULL },
293};
294
295int
296sys_reboot(tcp)
297struct tcb *tcp;
298{
299 if (entering(tcp)) {
300 if (!printflags(bootflags, tcp->u_arg[0]))
301 tprintf("RB_???");
302 if (tcp->u_arg[0] & RB_STRING) {
303 printstr(tcp, tcp->u_arg[1], -1);
304 }
305 }
306 return 0;
307}
308
309int
310sys_sysacct(tcp)
311struct tcb *tcp;
312{
313 if (entering(tcp)) {
314 printstr(tcp, tcp->u_arg[0], -1);
315 }
316 return 0;
317}
318
319int
320sys_swapon(tcp)
321struct tcb *tcp;
322{
323 if (entering(tcp)) {
324 printstr(tcp, tcp->u_arg[0], -1);
325 }
326 return 0;
327}
328
329int
330sys_nfs_svc(tcp)
331struct tcb *tcp;
332{
333 if (entering(tcp)) {
334 printsock(tcp, tcp->u_arg[0]);
335 }
336 return 0;
337}
338
339static struct xlat mountflags[] = {
340 { M_RDONLY, "M_RDONLY" },
341 { M_NOSUID, "M_NOSUID" },
342 { M_NEWTYPE, "M_NEWTYPE" },
343 { M_GRPID, "M_GRPID" },
344#ifdef M_REMOUNT
345 { M_REMOUNT, "M_REMOUNT" },
346#endif
347#ifdef M_NOSUB
348 { M_NOSUB, "M_NOSUB" },
349#endif
350#ifdef M_MULTI
351 { M_MULTI, "M_MULTI" },
352#endif
353#ifdef M_SYS5
354 { M_SYS5, "M_SYS5" },
355#endif
356 { 0, NULL },
357};
358
359static struct xlat nfsflags[] = {
360 { NFSMNT_SOFT, "NFSMNT_SOFT" },
361 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
362 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
363 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
364 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
365 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
366 { NFSMNT_INT, "NFSMNT_INT" },
367 { NFSMNT_NOAC, "NFSMNT_NOAC" },
368 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
369 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
370 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
371 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
372#ifdef NFSMNT_SECURE
373 { NFSMNT_SECURE, "NFSMNT_SECURE" },
374#endif
375#ifdef NFSMNT_NOCTO
376 { NFSMNT_NOCTO, "NFSMNT_NOCTO" },
377#endif
378#ifdef NFSMNT_POSIX
379 { NFSMNT_POSIX, "NFSMNT_POSIX" },
380#endif
381 { 0, NULL },
382};
383
384int
385sys_mount(tcp)
386struct tcb *tcp;
387{
388 char type[4];
389
390 if (entering(tcp)) {
391 if (!(tcp->u_arg[2] & M_NEWTYPE) || umovestr(tcp,
392 tcp->u_arg[0], sizeof type, type) < 0) {
393 tprintf("OLDTYPE:#%lx", tcp->u_arg[0]);
394 } else {
395 tprintf("\"%s\", ", type);
396 }
397 printstr(tcp, tcp->u_arg[1], -1);
398 tprintf(", ");
399 if (!printflags(mountflags, tcp->u_arg[2] & ~M_NEWTYPE))
400 tprintf("0");
401 tprintf(", ");
402
403 if (strcmp(type, "4.2") == 0) {
404 struct ufs_args a;
405 if (umove(tcp, tcp->u_arg[3], &a) < 0)
406 return 0;
407 printstr(tcp, (int)a.fspec, -1);
408 } else if (strcmp(type, "lo") == 0) {
409 struct lo_args a;
410 if (umove(tcp, tcp->u_arg[3], &a) < 0)
411 return 0;
412 printstr(tcp, (int)a.fsdir, -1);
413 } else if (strcmp(type, "nfs") == 0) {
414 struct nfs_args a;
415 if (umove(tcp, tcp->u_arg[3], &a) < 0)
416 return 0;
417 tprintf("[");
418 printsock(tcp, (int) a.addr);
419 tprintf(", ");
420 if (!printflags(nfsflags, a.flags))
421 tprintf("NFSMNT_???");
422 tprintf(", ws:%u,rs:%u,to:%u,re:%u,",
423 a.wsize, a.rsize, a.timeo, a.retrans);
424 if (a.flags & NFSMNT_HOSTNAME && a.hostname)
425 printstr(tcp, (int)a.hostname, -1);
426 else
427 tprintf("%#lx", (unsigned long) a.hostname);
428 tprintf(",reg-min:%u,max:%u,dir-min:%u,max:%u,",
429 a.acregmin, a.acregmax, a.acdirmin, a.acdirmax);
430 if ((a.flags & NFSMNT_SECURE) && a.netname)
431 printstr(tcp, (int) a.netname, -1);
432 else
433 tprintf("%#lx", (unsigned long) a.netname);
434 tprintf("]");
435 } else if (strcmp(type, "rfs") == 0) {
436 struct rfs_args a;
437 struct token t;
438 if (umove(tcp, tcp->u_arg[3], &a) < 0)
439 return 0;
440 tprintf("[");
441 printstr(tcp, (int)a.rmtfs, -1);
442 if (umove(tcp, (int)a.token, &t) < 0)
443 return 0;
444 tprintf(", %u, %s]", t.t_id, t.t_uname);
445 } else if (strcmp(type, "pcfs") == 0) {
446 struct pc_args a;
447 if (umove(tcp, tcp->u_arg[3], &a) < 0)
448 return 0;
449 printstr(tcp, (int)a.fspec, -1);
450 }
451 }
452 return 0;
453}
454
455int
456sys_unmount(tcp)
457struct tcb *tcp;
458{
459 if (entering(tcp)) {
460 printstr(tcp, tcp->u_arg[0], -1);
461 }
462 return 0;
463}
464
465int
466sys_umount(tcp)
467struct tcb *tcp;
468{
469 return sys_unmount(tcp);
470}
471
472int
473sys_auditsys(tcp)
474struct tcb *tcp;
475{
476 /* XXX - no information available */
477 return printargs(tcp);
478}
479
480static struct xlat ex_auth_flags[] = {
481 { AUTH_UNIX, "AUTH_UNIX" },
482 { AUTH_DES, "AUTH_DES" },
483 { 0, NULL },
484};
485
486int
487sys_exportfs(tcp)
488struct tcb *tcp;
489{
490 struct export e;
491 int i;
492
493 if (entering(tcp)) {
494 printstr(tcp, tcp->u_arg[0], -1);
495 if (umove(tcp, tcp->u_arg[1], &e) < 0) {
496 tprintf("%#lx", tcp->u_arg[1]);
497 return 0;
498 }
499 tprintf("{fl:%u, anon:%u, ", e.ex_flags, e.ex_anon);
500 printxval(ex_auth_flags, e.ex_auth, "AUTH_???");
501 tprintf(", roots:[");
502 if (e.ex_auth == AUTH_UNIX) {
503 for (i=0; i<e.ex_u.exunix.rootaddrs.naddrs; i++) {
504 printsock(tcp,
505 (int)&e.ex_u.exunix.rootaddrs.addrvec[i]);
506 }
507 tprintf("], writers:[");
508 for (i=0; i<e.ex_writeaddrs.naddrs; i++) {
509 printsock(tcp,
510 (int)&e.ex_writeaddrs.addrvec[i]);
511 }
512 tprintf("]");
513 } else {
514 for (i=0; i<e.ex_u.exdes.nnames; i++) {
515 printsock(tcp,
516 (int)&e.ex_u.exdes.rootnames[i]);
517 tprintf(", ");
518 }
519 tprintf("], window:%u", e.ex_u.exdes.window);
520 }
521 tprintf("}");
522 }
523 return 0;
524}
525
526static struct xlat sysconflimits[] = {
527#ifdef _SC_ARG_MAX
528 { _SC_ARG_MAX, "_SC_ARG_MAX" }, /* space for argv & envp */
529#endif
530#ifdef _SC_CHILD_MAX
531 { _SC_CHILD_MAX, "_SC_CHILD_MAX" }, /* maximum children per process??? */
532#endif
533#ifdef _SC_CLK_TCK
534 { _SC_CLK_TCK, "_SC_CLK_TCK" }, /* clock ticks/sec */
535#endif
536#ifdef _SC_NGROUPS_MAX
537 { _SC_NGROUPS_MAX, "_SC_NGROUPS_MAX" }, /* number of groups if multple supp. */
538#endif
539#ifdef _SC_OPEN_MAX
540 { _SC_OPEN_MAX, "_SC_OPEN_MAX" }, /* max open files per process */
541#endif
542#ifdef _SC_JOB_CONTROL
543 { _SC_JOB_CONTROL, "_SC_JOB_CONTROL" }, /* do we have job control */
544#endif
545#ifdef _SC_SAVED_IDS
546 { _SC_SAVED_IDS, "_SC_SAVED_IDS" }, /* do we have saved uid/gids */
547#endif
548#ifdef _SC_VERSION
549 { _SC_VERSION, "_SC_VERSION" }, /* POSIX version supported */
550#endif
551 { 0, NULL },
552};
553
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000554int
555sys_sysconf(tcp)
556struct tcb *tcp;
557{
558 if (entering(tcp)) {
559 printxval(sysconflimits, tcp->u_arg[0], "_SC_???");
560 }
561 return 0;
562}
563
564#endif /* SUNOS4 */
565
566#if defined(SUNOS4) || defined(FREEBSD)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000567static struct xlat pathconflimits[] = {
568#ifdef _PC_LINK_MAX
569 { _PC_LINK_MAX, "_PC_LINK_MAX" }, /* max links to file/dir */
570#endif
571#ifdef _PC_MAX_CANON
572 { _PC_MAX_CANON, "_PC_MAX_CANON" }, /* max line length */
573#endif
574#ifdef _PC_MAX_INPUT
575 { _PC_MAX_INPUT, "_PC_MAX_INPUT" }, /* max "packet" to a tty device */
576#endif
577#ifdef _PC_NAME_MAX
578 { _PC_NAME_MAX, "_PC_NAME_MAX" }, /* max pathname component length */
579#endif
580#ifdef _PC_PATH_MAX
581 { _PC_PATH_MAX, "_PC_PATH_MAX" }, /* max pathname length */
582#endif
583#ifdef _PC_PIPE_BUF
584 { _PC_PIPE_BUF, "_PC_PIPE_BUF" }, /* size of a pipe */
585#endif
586#ifdef _PC_CHOWN_RESTRICTED
587 { _PC_CHOWN_RESTRICTED, "_PC_CHOWN_RESTRICTED" }, /* can we give away files */
588#endif
589#ifdef _PC_NO_TRUNC
590 { _PC_NO_TRUNC, "_PC_NO_TRUNC" }, /* trunc or error on >NAME_MAX */
591#endif
592#ifdef _PC_VDISABLE
593 { _PC_VDISABLE, "_PC_VDISABLE" }, /* best char to shut off tty c_cc */
594#endif
595 { 0, NULL },
596};
597
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000598
599int
600sys_pathconf(tcp)
601struct tcb *tcp;
602{
603 if (entering(tcp)) {
604 printstr(tcp, tcp->u_arg[0], -1);
605 tprintf(", ");
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000606 printxval(pathconflimits, tcp->u_arg[1], "_PC_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000607 }
608 return 0;
609}
610
611int
612sys_fpathconf(tcp)
613struct tcb *tcp;
614{
615 if (entering(tcp)) {
616 tprintf("%lu, ", tcp->u_arg[0]);
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000617 printxval(pathconflimits, tcp->u_arg[1], "_PC_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000618 }
619 return 0;
620}
621
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000622#endif /* SUNOS4 || FREEBSD */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000623
624#ifdef SVR4
625
626#ifdef HAVE_SYS_SYSCONFIG_H
627#include <sys/sysconfig.h>
628#endif /* HAVE_SYS_SYSCONFIG_H */
629
630#include <sys/mount.h>
631#include <sys/systeminfo.h>
632#include <sys/utsname.h>
633
634static struct xlat sysconfig_options[] = {
635#ifdef _CONFIG_NGROUPS
636 { _CONFIG_NGROUPS, "_CONFIG_NGROUPS" },
637#endif
638#ifdef _CONFIG_CHILD_MAX
639 { _CONFIG_CHILD_MAX, "_CONFIG_CHILD_MAX" },
640#endif
641#ifdef _CONFIG_OPEN_FILES
642 { _CONFIG_OPEN_FILES, "_CONFIG_OPEN_FILES" },
643#endif
644#ifdef _CONFIG_POSIX_VER
645 { _CONFIG_POSIX_VER, "_CONFIG_POSIX_VER" },
646#endif
647#ifdef _CONFIG_PAGESIZE
648 { _CONFIG_PAGESIZE, "_CONFIG_PAGESIZE" },
649#endif
650#ifdef _CONFIG_CLK_TCK
651 { _CONFIG_CLK_TCK, "_CONFIG_CLK_TCK" },
652#endif
653#ifdef _CONFIG_XOPEN_VER
654 { _CONFIG_XOPEN_VER, "_CONFIG_XOPEN_VER" },
655#endif
656#ifdef _CONFIG_PROF_TCK
657 { _CONFIG_PROF_TCK, "_CONFIG_PROF_TCK" },
658#endif
659#ifdef _CONFIG_NPROC_CONF
660 { _CONFIG_NPROC_CONF, "_CONFIG_NPROC_CONF" },
661#endif
662#ifdef _CONFIG_NPROC_ONLN
663 { _CONFIG_NPROC_ONLN, "_CONFIG_NPROC_ONLN" },
664#endif
665#ifdef _CONFIG_AIO_LISTIO_MAX
666 { _CONFIG_AIO_LISTIO_MAX, "_CONFIG_AIO_LISTIO_MAX" },
667#endif
668#ifdef _CONFIG_AIO_MAX
669 { _CONFIG_AIO_MAX, "_CONFIG_AIO_MAX" },
670#endif
671#ifdef _CONFIG_AIO_PRIO_DELTA_MAX
672 { _CONFIG_AIO_PRIO_DELTA_MAX, "_CONFIG_AIO_PRIO_DELTA_MAX" },
673#endif
674#ifdef _CONFIG_CONFIG_DELAYTIMER_MAX
675 { _CONFIG_DELAYTIMER_MAX, "_CONFIG_DELAYTIMER_MAX" },
676#endif
677#ifdef _CONFIG_MQ_OPEN_MAX
678 { _CONFIG_MQ_OPEN_MAX, "_CONFIG_MQ_OPEN_MAX" },
679#endif
680#ifdef _CONFIG_MQ_PRIO_MAX
681 { _CONFIG_MQ_PRIO_MAX, "_CONFIG_MQ_PRIO_MAX" },
682#endif
683#ifdef _CONFIG_RTSIG_MAX
684 { _CONFIG_RTSIG_MAX, "_CONFIG_RTSIG_MAX" },
685#endif
686#ifdef _CONFIG_SEM_NSEMS_MAX
687 { _CONFIG_SEM_NSEMS_MAX, "_CONFIG_SEM_NSEMS_MAX" },
688#endif
689#ifdef _CONFIG_SEM_VALUE_MAX
690 { _CONFIG_SEM_VALUE_MAX, "_CONFIG_SEM_VALUE_MAX" },
691#endif
692#ifdef _CONFIG_SIGQUEUE_MAX
693 { _CONFIG_SIGQUEUE_MAX, "_CONFIG_SIGQUEUE_MAX" },
694#endif
695#ifdef _CONFIG_SIGRT_MIN
696 { _CONFIG_SIGRT_MIN, "_CONFIG_SIGRT_MIN" },
697#endif
698#ifdef _CONFIG_SIGRT_MAX
699 { _CONFIG_SIGRT_MAX, "_CONFIG_SIGRT_MAX" },
700#endif
701#ifdef _CONFIG_TIMER_MAX
702 { _CONFIG_TIMER_MAX, "_CONFIG_TIMER_MAX" },
703#endif
704#ifdef _CONFIG_CONFIG_PHYS_PAGES
705 { _CONFIG_PHYS_PAGES, "_CONFIG_PHYS_PAGES" },
706#endif
707#ifdef _CONFIG_AVPHYS_PAGES
708 { _CONFIG_AVPHYS_PAGES, "_CONFIG_AVPHYS_PAGES" },
709#endif
710 { 0, NULL },
711};
712
713int
714sys_sysconfig(tcp)
715struct tcb *tcp;
716{
717 if (entering(tcp))
718 printxval(sysconfig_options, tcp->u_arg[0], "_CONFIG_???");
719 return 0;
720}
721
722static struct xlat sysinfo_options[] = {
723 { SI_SYSNAME, "SI_SYSNAME" },
724 { SI_HOSTNAME, "SI_HOSTNAME" },
725 { SI_RELEASE, "SI_RELEASE" },
726 { SI_VERSION, "SI_VERSION" },
727 { SI_MACHINE, "SI_MACHINE" },
728 { SI_ARCHITECTURE, "SI_ARCHITECTURE" },
729 { SI_HW_SERIAL, "SI_HW_SERIAL" },
730 { SI_HW_PROVIDER, "SI_HW_PROVIDER" },
731 { SI_SRPC_DOMAIN, "SI_SRPC_DOMAIN" },
732#ifdef SI_SET_HOSTNAME
733 { SI_SET_HOSTNAME, "SI_SET_HOSTNAME" },
734#endif
735#ifdef SI_SET_SRPC_DOMAIN
736 { SI_SET_SRPC_DOMAIN, "SI_SET_SRPC_DOMAIN" },
737#endif
738#ifdef SI_SET_KERB_REALM
739 { SI_SET_KERB_REALM, "SI_SET_KERB_REALM" },
740#endif
741#ifdef SI_KERB_REALM
742 { SI_KERB_REALM, "SI_KERB_REALM" },
743#endif
744 { 0, NULL },
745};
746
747int
748sys_sysinfo(tcp)
749struct tcb *tcp;
750{
751 if (entering(tcp)) {
752 printxval(sysinfo_options, tcp->u_arg[0], "SI_???");
753 tprintf(", ");
754 }
755 else {
756 /* Technically some calls write values. So what. */
757 if (syserror(tcp))
758 tprintf("%#lx", tcp->u_arg[1]);
759 else
760 printpath(tcp, tcp->u_arg[1]);
761 tprintf(", %lu", tcp->u_arg[2]);
762 }
763 return 0;
764}
765
766#ifdef MIPS
767
768#include <sys/syssgi.h>
769
770static struct xlat syssgi_options[] = {
771 { SGI_SYSID, "SGI_SYSID" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000772#ifdef SGI_RDUBLK
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000773 { SGI_RDUBLK, "SGI_RDUBLK" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000774#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000775 { SGI_TUNE, "SGI_TUNE" },
776 { SGI_IDBG, "SGI_IDBG" },
777 { SGI_INVENT, "SGI_INVENT" },
778 { SGI_RDNAME, "SGI_RDNAME" },
779 { SGI_SETLED, "SGI_SETLED" },
780 { SGI_SETNVRAM, "SGI_SETNVRAM" },
781 { SGI_GETNVRAM, "SGI_GETNVRAM" },
782 { SGI_QUERY_FTIMER, "SGI_QUERY_FTIMER" },
783 { SGI_QUERY_CYCLECNTR, "SGI_QUERY_CYCLECNTR" },
784 { SGI_PROCSZ, "SGI_PROCSZ" },
785 { SGI_SIGACTION, "SGI_SIGACTION" },
786 { SGI_SIGPENDING, "SGI_SIGPENDING" },
787 { SGI_SIGPROCMASK, "SGI_SIGPROCMASK" },
788 { SGI_SIGSUSPEND, "SGI_SIGSUSPEND" },
789 { SGI_SETSID, "SGI_SETSID" },
790 { SGI_SETPGID, "SGI_SETPGID" },
791 { SGI_SYSCONF, "SGI_SYSCONF" },
792 { SGI_WAIT4, "SGI_WAIT4" },
793 { SGI_PATHCONF, "SGI_PATHCONF" },
794 { SGI_READB, "SGI_READB" },
795 { SGI_WRITEB, "SGI_WRITEB" },
796 { SGI_SETGROUPS, "SGI_SETGROUPS" },
797 { SGI_GETGROUPS, "SGI_GETGROUPS" },
798 { SGI_SETTIMEOFDAY, "SGI_SETTIMEOFDAY" },
799 { SGI_SETTIMETRIM, "SGI_SETTIMETRIM" },
800 { SGI_GETTIMETRIM, "SGI_GETTIMETRIM" },
801 { SGI_SPROFIL, "SGI_SPROFIL" },
802 { SGI_RUSAGE, "SGI_RUSAGE" },
803 { SGI_SIGSTACK, "SGI_SIGSTACK" },
804 { SGI_SIGSTATUS, "SGI_SIGSTATUS" },
805 { SGI_NETPROC, "SGI_NETPROC" },
806 { SGI_SIGALTSTACK, "SGI_SIGALTSTACK" },
807 { SGI_BDFLUSHCNT, "SGI_BDFLUSHCNT" },
808 { SGI_SSYNC, "SGI_SSYNC" },
809 { SGI_NFSCNVT, "SGI_NFSCNVT" },
810 { SGI_GETPGID, "SGI_GETPGID" },
811 { SGI_GETSID, "SGI_GETSID" },
812 { SGI_IOPROBE, "SGI_IOPROBE" },
813 { SGI_CONFIG, "SGI_CONFIG" },
814 { SGI_ELFMAP, "SGI_ELFMAP" },
815 { SGI_MCONFIG, "SGI_MCONFIG" },
816 { SGI_GETPLABEL, "SGI_GETPLABEL" },
817 { SGI_SETPLABEL, "SGI_SETPLABEL" },
818 { SGI_GETLABEL, "SGI_GETLABEL" },
819 { SGI_SETLABEL, "SGI_SETLABEL" },
820 { SGI_SATREAD, "SGI_SATREAD" },
821 { SGI_SATWRITE, "SGI_SATWRITE" },
822 { SGI_SATCTL, "SGI_SATCTL" },
823 { SGI_LOADATTR, "SGI_LOADATTR" },
824 { SGI_UNLOADATTR, "SGI_UNLOADATTR" },
825#ifdef SGI_RECVLMSG
826 { SGI_RECVLMSG, "SGI_RECVLMSG" },
827#endif
828 { SGI_PLANGMOUNT, "SGI_PLANGMOUNT" },
829 { SGI_GETPSOACL, "SGI_GETPSOACL" },
830 { SGI_SETPSOACL, "SGI_SETPSOACL" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000831#ifdef SGI_EAG_GET_ATTR
832 { SGI_EAG_GET_ATTR, "SGI_EAG_GET_ATTR" },
833#endif
834#ifdef SGI_EAG_SET_ATTR
835 { SGI_EAG_SET_ATTR, "SGI_EAG_SET_ATTR" },
836#endif
837#ifdef SGI_EAG_GET_PROCATTR
838 { SGI_EAG_GET_PROCATTR, "SGI_EAG_GET_PROCATTR" },
839#endif
840#ifdef SGI_EAG_SET_PROCATTR
841 { SGI_EAG_SET_PROCATTR, "SGI_EAG_SET_PROCATTR" },
842#endif
843#ifdef SGI_FREVOKE
844 { SGI_FREVOKE, "SGI_FREVOKE" },
845#endif
846#ifdef SGI_SBE_GET_INFO
847 { SGI_SBE_GET_INFO, "SGI_SBE_GET_INFO" },
848#endif
849#ifdef SGI_SBE_CLR_INFO
850 { SGI_SBE_CLR_INFO, "SGI_SBE_CLR_INFO" },
851#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000852 { SGI_RMI_FIXECC, "SGI_RMI_FIXECC" },
853 { SGI_R4K_CERRS, "SGI_R4K_CERRS" },
854 { SGI_GET_EVCONF, "SGI_GET_EVCONF" },
855 { SGI_MPCWAROFF, "SGI_MPCWAROFF" },
856 { SGI_SET_AUTOPWRON, "SGI_SET_AUTOPWRON" },
857 { SGI_SPIPE, "SGI_SPIPE" },
858 { SGI_SYMTAB, "SGI_SYMTAB" },
859#ifdef SGI_SET_FPDEBUG
860 { SGI_SET_FPDEBUG, "SGI_SET_FPDEBUG" },
861#endif
Wichert Akkerman8829a551999-06-11 13:18:40 +0000862#ifdef SGI_SET_FP_PRECISE
863 { SGI_SET_FP_PRECISE, "SGI_SET_FP_PRECISE" },
864#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000865 { SGI_TOSSTSAVE, "SGI_TOSSTSAVE" },
866 { SGI_FDHI, "SGI_FDHI" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000867#ifdef SGI_SET_CONFIG_SMM
868 { SGI_SET_CONFIG_SMM, "SGI_SET_CONFIG_SMM" },
869#endif
870#ifdef SGI_SET_FP_PRESERVE
871 { SGI_SET_FP_PRESERVE, "SGI_SET_FP_PRESERVE" },
872#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000873 { SGI_MINRSS, "SGI_MINRSS" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000874#ifdef SGI_GRIO
875 { SGI_GRIO, "SGI_GRIO" },
876#endif
877#ifdef SGI_XLV_SET_TAB
878 { SGI_XLV_SET_TAB, "SGI_XLV_SET_TAB" },
879#endif
880#ifdef SGI_XLV_GET_TAB
881 { SGI_XLV_GET_TAB, "SGI_XLV_GET_TAB" },
882#endif
883#ifdef SGI_GET_FP_PRECISE
884 { SGI_GET_FP_PRECISE, "SGI_GET_FP_PRECISE" },
885#endif
886#ifdef SGI_GET_CONFIG_SMM
887 { SGI_GET_CONFIG_SMM, "SGI_GET_CONFIG_SMM" },
888#endif
889#ifdef SGI_FP_IMPRECISE_SUPP
890 { SGI_FP_IMPRECISE_SUPP,"SGI_FP_IMPRECISE_SUPP" },
891#endif
892#ifdef SGI_CONFIG_NSMM_SUPP
893 { SGI_CONFIG_NSMM_SUPP, "SGI_CONFIG_NSMM_SUPP" },
894#endif
895#ifdef SGI_RT_TSTAMP_CREATE
896 { SGI_RT_TSTAMP_CREATE, "SGI_RT_TSTAMP_CREATE" },
897#endif
898#ifdef SGI_RT_TSTAMP_DELETE
899 { SGI_RT_TSTAMP_DELETE, "SGI_RT_TSTAMP_DELETE" },
900#endif
901#ifdef SGI_RT_TSTAMP_START
902 { SGI_RT_TSTAMP_START, "SGI_RT_TSTAMP_START" },
903#endif
904#ifdef SGI_RT_TSTAMP_STOP
905 { SGI_RT_TSTAMP_STOP, "SGI_RT_TSTAMP_STOP" },
906#endif
907#ifdef SGI_RT_TSTAMP_ADDR
908 { SGI_RT_TSTAMP_ADDR, "SGI_RT_TSTAMP_ADDR" },
909#endif
910#ifdef SGI_RT_TSTAMP_MASK
911 { SGI_RT_TSTAMP_MASK, "SGI_RT_TSTAMP_MASK" },
912#endif
913#ifdef SGI_RT_TSTAMP_EOB_MODE
914 { SGI_RT_TSTAMP_EOB_MODE,"SGI_RT_TSTAMP_EOB_MODE"},
915#endif
916#ifdef SGI_USE_FP_BCOPY
917 { SGI_USE_FP_BCOPY, "SGI_USE_FP_BCOPY" },
918#endif
919#ifdef SGI_GET_UST
920 { SGI_GET_UST, "SGI_GET_UST" },
921#endif
922#ifdef SGI_SPECULATIVE_EXEC
923 { SGI_SPECULATIVE_EXEC, "SGI_SPECULATIVE_EXEC" },
924#endif
925#ifdef SGI_XLV_NEXT_RQST
926 { SGI_XLV_NEXT_RQST, "SGI_XLV_NEXT_RQST" },
927#endif
928#ifdef SGI_XLV_ATTR_CURSOR
929 { SGI_XLV_ATTR_CURSOR, "SGI_XLV_ATTR_CURSOR" },
930#endif
931#ifdef SGI_XLV_ATTR_GET
932 { SGI_XLV_ATTR_GET, "SGI_XLV_ATTR_GET" },
933#endif
934#ifdef SGI_XLV_ATTR_SET
935 { SGI_XLV_ATTR_SET, "SGI_XLV_ATTR_SET" },
936#endif
937#ifdef SGI_BTOOLSIZE
938 { SGI_BTOOLSIZE, "SGI_BTOOLSIZE" },
939#endif
940#ifdef SGI_BTOOLGET
941 { SGI_BTOOLGET, "SGI_BTOOLGET" },
942#endif
943#ifdef SGI_BTOOLREINIT
944 { SGI_BTOOLREINIT, "SGI_BTOOLREINIT" },
945#endif
946#ifdef SGI_CREATE_UUID
947 { SGI_CREATE_UUID, "SGI_CREATE_UUID" },
948#endif
949#ifdef SGI_NOFPE
950 { SGI_NOFPE, "SGI_NOFPE" },
951#endif
952#ifdef SGI_OLD_SOFTFP
953 { SGI_OLD_SOFTFP, "SGI_OLD_SOFTFP" },
954#endif
955#ifdef SGI_FS_INUMBERS
956 { SGI_FS_INUMBERS, "SGI_FS_INUMBERS" },
957#endif
958#ifdef SGI_FS_BULKSTAT
959 { SGI_FS_BULKSTAT, "SGI_FS_BULKSTAT" },
960#endif
961#ifdef SGI_RT_TSTAMP_WAIT
962 { SGI_RT_TSTAMP_WAIT, "SGI_RT_TSTAMP_WAIT" },
963#endif
964#ifdef SGI_RT_TSTAMP_UPDATE
965 { SGI_RT_TSTAMP_UPDATE, "SGI_RT_TSTAMP_UPDATE" },
966#endif
967#ifdef SGI_PATH_TO_HANDLE
968 { SGI_PATH_TO_HANDLE, "SGI_PATH_TO_HANDLE" },
969#endif
970#ifdef SGI_PATH_TO_FSHANDLE
971 { SGI_PATH_TO_FSHANDLE, "SGI_PATH_TO_FSHANDLE" },
972#endif
973#ifdef SGI_FD_TO_HANDLE
974 { SGI_FD_TO_HANDLE, "SGI_FD_TO_HANDLE" },
975#endif
976#ifdef SGI_OPEN_BY_HANDLE
977 { SGI_OPEN_BY_HANDLE, "SGI_OPEN_BY_HANDLE" },
978#endif
979#ifdef SGI_READLINK_BY_HANDLE
980 { SGI_READLINK_BY_HANDLE,"SGI_READLINK_BY_HANDLE"},
981#endif
982#ifdef SGI_READ_DANGID
983 { SGI_READ_DANGID, "SGI_READ_DANGID" },
984#endif
985#ifdef SGI_CONST
986 { SGI_CONST, "SGI_CONST" },
987#endif
988#ifdef SGI_XFS_FSOPERATIONS
989 { SGI_XFS_FSOPERATIONS, "SGI_XFS_FSOPERATIONS" },
990#endif
991#ifdef SGI_SETASH
992 { SGI_SETASH, "SGI_SETASH" },
993#endif
994#ifdef SGI_GETASH
995 { SGI_GETASH, "SGI_GETASH" },
996#endif
997#ifdef SGI_SETPRID
998 { SGI_SETPRID, "SGI_SETPRID" },
999#endif
1000#ifdef SGI_GETPRID
1001 { SGI_GETPRID, "SGI_GETPRID" },
1002#endif
1003#ifdef SGI_SETSPINFO
1004 { SGI_SETSPINFO, "SGI_SETSPINFO" },
1005#endif
1006#ifdef SGI_GETSPINFO
1007 { SGI_GETSPINFO, "SGI_GETSPINFO" },
1008#endif
1009#ifdef SGI_SHAREII
1010 { SGI_SHAREII, "SGI_SHAREII" },
1011#endif
1012#ifdef SGI_NEWARRAYSESS
1013 { SGI_NEWARRAYSESS, "SGI_NEWARRAYSESS" },
1014#endif
1015#ifdef SGI_GETDFLTPRID
1016 { SGI_GETDFLTPRID, "SGI_GETDFLTPRID" },
1017#endif
1018#ifdef SGI_SET_DISMISSED_EXC_CNT
1019 { SGI_SET_DISMISSED_EXC_CNT,"SGI_SET_DISMISSED_EXC_CNT" },
1020#endif
1021#ifdef SGI_GET_DISMISSED_EXC_CNT
1022 { SGI_GET_DISMISSED_EXC_CNT,"SGI_GET_DISMISSED_EXC_CNT" },
1023#endif
1024#ifdef SGI_CYCLECNTR_SIZE
1025 { SGI_CYCLECNTR_SIZE, "SGI_CYCLECNTR_SIZE" },
1026#endif
1027#ifdef SGI_QUERY_FASTTIMER
1028 { SGI_QUERY_FASTTIMER, "SGI_QUERY_FASTTIMER" },
1029#endif
1030#ifdef SGI_PIDSINASH
1031 { SGI_PIDSINASH, "SGI_PIDSINASH" },
1032#endif
1033#ifdef SGI_ULI
1034 { SGI_ULI, "SGI_ULI" },
1035#endif
1036#ifdef SGI_LPG_SHMGET
1037 { SGI_LPG_SHMGET, "SGI_LPG_SHMGET" },
1038#endif
1039#ifdef SGI_LPG_MAP
1040 { SGI_LPG_MAP, "SGI_LPG_MAP" },
1041#endif
1042#ifdef SGI_CACHEFS_SYS
1043 { SGI_CACHEFS_SYS, "SGI_CACHEFS_SYS" },
1044#endif
1045#ifdef SGI_NFSNOTIFY
1046 { SGI_NFSNOTIFY, "SGI_NFSNOTIFY" },
1047#endif
1048#ifdef SGI_LOCKDSYS
1049 { SGI_LOCKDSYS, "SGI_LOCKDSYS" },
1050#endif
1051#ifdef SGI_EVENTCTR
1052 { SGI_EVENTCTR, "SGI_EVENTCTR" },
1053#endif
1054#ifdef SGI_GETPRUSAGE
1055 { SGI_GETPRUSAGE, "SGI_GETPRUSAGE" },
1056#endif
1057#ifdef SGI_PROCMASK_LOCATION
1058 { SGI_PROCMASK_LOCATION,"SGI_PROCMASK_LOCATION" },
1059#endif
1060#ifdef SGI_UNUSED
1061 { SGI_UNUSED, "SGI_UNUSED" },
1062#endif
1063#ifdef SGI_CKPT_SYS
1064 { SGI_CKPT_SYS, "SGI_CKPT_SYS" },
1065#endif
1066#ifdef SGI_CKPT_SYS
1067 { SGI_CKPT_SYS, "SGI_CKPT_SYS" },
1068#endif
1069#ifdef SGI_GETGRPPID
1070 { SGI_GETGRPPID, "SGI_GETGRPPID" },
1071#endif
1072#ifdef SGI_GETSESPID
1073 { SGI_GETSESPID, "SGI_GETSESPID" },
1074#endif
1075#ifdef SGI_ENUMASHS
1076 { SGI_ENUMASHS, "SGI_ENUMASHS" },
1077#endif
1078#ifdef SGI_SETASMACHID
1079 { SGI_SETASMACHID, "SGI_SETASMACHID" },
1080#endif
1081#ifdef SGI_GETASMACHID
1082 { SGI_GETASMACHID, "SGI_GETASMACHID" },
1083#endif
1084#ifdef SGI_GETARSESS
1085 { SGI_GETARSESS, "SGI_GETARSESS" },
1086#endif
1087#ifdef SGI_JOINARRAYSESS
1088 { SGI_JOINARRAYSESS, "SGI_JOINARRAYSESS" },
1089#endif
1090#ifdef SGI_SPROC_KILL
1091 { SGI_SPROC_KILL, "SGI_SPROC_KILL" },
1092#endif
1093#ifdef SGI_DBA_CONFIG
1094 { SGI_DBA_CONFIG, "SGI_DBA_CONFIG" },
1095#endif
1096#ifdef SGI_RELEASE_NAME
1097 { SGI_RELEASE_NAME, "SGI_RELEASE_NAME" },
1098#endif
1099#ifdef SGI_SYNCH_CACHE_HANDLER
1100 { SGI_SYNCH_CACHE_HANDLER,"SGI_SYNCH_CACHE_HANDLER"},
1101#endif
1102#ifdef SGI_SWASH_INIT
1103 { SGI_SWASH_INIT, "SGI_SWASH_INIT" },
1104#endif
1105#ifdef SGI_NUMA_MIGR_PAGE
1106 { SGI_NUMA_MIGR_PAGE, "SGI_NUMA_MIGR_PAGE" },
1107#endif
1108#ifdef SGI_NUMA_MIGR_PAGE_ALT
1109 { SGI_NUMA_MIGR_PAGE_ALT,"SGI_NUMA_MIGR_PAGE_ALT"},
1110#endif
1111#ifdef SGI_KAIO_USERINIT
1112 { SGI_KAIO_USERINIT, "SGI_KAIO_USERINIT" },
1113#endif
1114#ifdef SGI_KAIO_READ
1115 { SGI_KAIO_READ, "SGI_KAIO_READ" },
1116#endif
1117#ifdef SGI_KAIO_WRITE
1118 { SGI_KAIO_WRITE, "SGI_KAIO_WRITE" },
1119#endif
1120#ifdef SGI_KAIO_SUSPEND
1121 { SGI_KAIO_SUSPEND, "SGI_KAIO_SUSPEND" },
1122#endif
1123#ifdef SGI_KAIO_STATS
1124 { SGI_KAIO_STATS, "SGI_KAIO_STATS" },
1125#endif
1126#ifdef SGI_INITIAL_PT_SPROC
1127 { SGI_INITIAL_PT_SPROC, "SGI_INITIAL_PT_SPROC" },
1128#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001129 { 0, NULL },
1130};
1131
1132int
1133sys_syssgi(tcp)
1134struct tcb *tcp;
1135{
1136 int i;
1137
1138 if (entering(tcp)) {
1139 printxval(syssgi_options, tcp->u_arg[0], "SGI_???");
1140 switch (tcp->u_arg[0]) {
1141 default:
1142 for (i = 1; i < tcp->u_nargs; i++)
1143 tprintf(", %#lx", tcp->u_arg[i]);
1144 break;
1145 }
1146 }
1147 return 0;
1148}
1149
1150#include <sys/types.h>
1151#include <rpc/rpc.h>
1152struct cred;
1153struct uio;
1154#include <sys/fsid.h>
1155#include <sys/vnode.h>
1156#include <sys/fs/nfs.h>
1157#include <sys/fs/nfs_clnt.h>
1158
1159static struct xlat mount_flags[] = {
1160 { MS_RDONLY, "MS_RDONLY" },
1161 { MS_FSS, "MS_FSS" },
1162 { MS_DATA, "MS_DATA" },
1163 { MS_NOSUID, "MS_NOSUID" },
1164 { MS_REMOUNT, "MS_REMOUNT" },
1165 { MS_NOTRUNC, "MS_NOTRUNC" },
1166 { MS_GRPID, "MS_GRPID" },
1167 { MS_NODEV, "MS_NODEV" },
1168 { MS_BEFORE, "MS_BEFORE" },
1169 { MS_AFTER, "MS_AFTER" },
1170 { 0, NULL },
1171};
1172
1173static struct xlat nfs_flags[] = {
1174 { NFSMNT_SOFT, "NFSMNT_SOFT" },
1175 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
1176 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
1177 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
1178 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
1179 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001180#ifdef NFSMNT_NOINT /* IRIX 6 */
1181 { NFSMNT_NOINT, "NFSMNT_NOINT" },
1182#endif
1183#ifdef NFSMNT_INT /* IRIX 5 */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001184 { NFSMNT_INT, "NFSMNT_INT" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001185#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001186 { NFSMNT_NOAC, "NFSMNT_NOAC" },
1187 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
1188 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
1189 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
1190 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
1191 { NFSMNT_PRIVATE, "NFSMNT_PRIVATE" },
1192 { NFSMNT_SYMTTL, "NFSMNT_SYMTTL" },
1193 { NFSMNT_LOOPBACK, "NFSMNT_LOOPBACK" },
1194 { NFSMNT_BASETYPE, "NFSMNT_BASETYPE" },
1195 { NFSMNT_NAMEMAX, "NFSMNT_NAMEMAX" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001196#ifdef NFSMNT_SHORTUID /* IRIX 6 */
1197 { NFSMNT_SHORTUID, "NFSMNT_SHORTUID" },
1198#endif
1199#ifdef NFSMNT_ASYNCNLM /* IRIX 6 */
1200 { NFSMNT_ASYNCNLM, "NFSMNT_ASYNCNLM" },
1201#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001202 { 0, NULL },
1203};
1204
1205int
1206sys_mount(tcp)
1207struct tcb *tcp;
1208{
1209 if (entering(tcp)) {
1210 printpath(tcp, tcp->u_arg[0]);
1211 tprintf(", ");
1212 printpath(tcp, tcp->u_arg[1]);
1213 tprintf(", ");
1214 printflags(mount_flags, tcp->u_arg[2]);
1215 if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
1216 tprintf(", ");
1217 tprintf("%ld", tcp->u_arg[3]);
1218 }
1219 if (tcp->u_arg[2] & MS_DATA) {
1220 int nfs_type = sysfs(GETFSIND, FSID_NFS);
1221
1222 tprintf(", ");
1223 if (tcp->u_arg[3] == nfs_type) {
1224 struct nfs_args args;
1225 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1226 tprintf("%#lx", tcp->u_arg[4]);
1227 else {
1228 tprintf("addr=");
1229 printsock(tcp, (int) args.addr);
1230 tprintf(", flags=");
1231 if (!printflags(nfs_flags, args.flags))
1232 tprintf("NFSMNT_???");
1233 tprintf(", hostname=");
1234 printstr(tcp, (int) args.hostname, -1);
1235 tprintf(", ...}");
1236 }
1237 }
1238 else
1239 tprintf("%#lx", tcp->u_arg[4]);
1240 tprintf(", %ld", tcp->u_arg[5]);
1241 }
1242 }
1243 return 0;
1244}
1245
1246#else /* !MIPS */
1247
Wichert Akkerman3377df71999-11-26 13:14:41 +00001248#if UNIXWARE
1249
1250#include <sys/types.h>
1251#include <sys/fstyp.h>
1252#include <sys/mount.h>
1253#include <sys/xti.h>
1254
1255#define NFSCLIENT 1
1256#include <nfs/mount.h>
1257
1258#include <sys/fs/vx_ioctl.h>
1259
1260static struct xlat mount_flags[] = {
1261 { MS_RDONLY, "MS_RDONLY" },
1262 { MS_FSS, "MS_FSS" },
1263 { MS_DATA, "MS_DATA" },
1264 { MS_HADBAD, "MS_HADBAD" },
1265 { MS_NOSUID, "MS_NOSUID" },
1266 { MS_REMOUNT, "MS_REMOUNT" },
1267 { MS_NOTRUNC, "MS_NOTRUNC" },
1268 { MS_SOFTMNT, "MS_SOFTMNT" },
1269 { MS_SYSSPACE, "MS_SYSSPACE" },
1270 { 0, NULL },
1271};
1272
1273#ifdef VX_MS_MASK
1274static struct xlat vxfs_flags[] = {
1275 { VX_MS_NOLOG, "VX_MS_NOLOG" },
1276 { VX_MS_BLKCLEAR, "VX_MS_BLKCLEAR" },
1277 { VX_MS_SNAPSHOT, "VX_MS_SNAPSHOT" },
1278 { VX_MS_NODATAINLOG, "VX_MS_NODATAINLOG" },
1279 { VX_MS_DELAYLOG, "VX_MS_DELAYLOG" },
1280 { VX_MS_TMPLOG, "VX_MS_TMPLOG" },
1281 { VX_MS_FILESET, "VX_MS_FILESET" },
1282
1283 { VX_MS_CACHE_DIRECT, "VX_MS_CACHE_DIRECT" },
1284 { VX_MS_CACHE_DSYNC, "VX_MS_CACHE_DSYNC" },
1285 { VX_MS_CACHE_CLOSESYNC,"VX_MS_CACHE_CLOSESYNC" },
1286 { VX_MS_CACHE_TMPCACHE, "VX_MS_CACHE_TMPCACHE" },
1287
1288 { VX_MS_OSYNC_DIRECT, "VX_MS_OSYNC_DIRECT" },
1289 { VX_MS_OSYNC_DSYNC, "VX_MS_OSYNC_DSYNC" },
1290 { VX_MS_OSYNC_CLOSESYNC,"VX_MS_OSYNC_CLOSESYNC" },
1291 { VX_MS_OSYNC_DELAY, "VX_MS_OSYNC_DELAY" },
1292 { 0, NULL, },
1293};
1294#endif
1295
1296static struct xlat nfs_flags[] = {
1297 { NFSMNT_SOFT, "NFSMNT_SOFT" },
1298 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
1299 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
1300 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
1301 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
1302 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
1303 { NFSMNT_INT, "NFSMNT_INT" },
1304 { NFSMNT_NOAC, "NFSMNT_NOAC" },
1305 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
1306 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
1307 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
1308 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
1309 { NFSMNT_SECURE, "NFSMNT_SECURE" },
1310 { NFSMNT_NOCTO, "NFSMNT_NOCTO" },
1311 { NFSMNT_GRPID, "NFSMNT_GRPID" },
1312 { NFSMNT_RPCTIMESYNC, "NFSMNT_RPCTIMESYNC" },
1313 { NFSMNT_LWPSMAX, "NFSMNT_LWPSMAX" },
1314 { 0, NULL },
1315};
1316
1317int
1318sys_mount(tcp)
1319struct tcb *tcp;
1320{
1321 if (entering(tcp)) {
1322 char fstyp [FSTYPSZ];
1323 printpath(tcp, tcp->u_arg[0]);
1324 tprintf(", ");
1325 printpath(tcp, tcp->u_arg[1]);
1326 tprintf(", ");
1327 printflags(mount_flags, tcp->u_arg[2]);
1328 /* The doc sez that the file system type is given as a
1329 fsindex, and we should use sysfs to work out the name.
1330 This appears to be untrue for UW. Maybe it's untrue
1331 for all SVR4's? */
1332 if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
1333 if (umovestr(tcp, tcp->u_arg[3], FSTYPSZ, fstyp) < 0) {
1334 *fstyp = 0;
1335 tprintf(", %ld", tcp->u_arg[3]);
1336 }
1337 else
1338 tprintf(", \"%s\"", fstyp);
1339 }
1340 if (tcp->u_arg[2] & MS_DATA) {
1341 tprintf(", ");
1342#ifdef VX_MS_MASK
1343 /* On UW7 they don't give us the defines and structs
1344 we need to see what is going on. Bummer. */
1345 if (strcmp (fstyp, "vxfs") == 0) {
1346 struct vx_mountargs5 args;
1347 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1348 tprintf("%#lx", tcp->u_arg[4]);
1349 else {
1350 tprintf("{ flags=");
1351 if (!printflags(vxfs_flags, args.mflags))
1352 tprintf("0x%08x", args.mflags);
1353 if (args.mflags & VX_MS_SNAPSHOT) {
1354 tprintf (", snapof=");
1355 printstr (tcp,
1356 (long) args.primaryspec,
1357 -1);
1358 if (args.snapsize > 0)
1359 tprintf (", snapsize=%ld", args.snapsize);
1360 }
1361 tprintf(" }");
1362 }
1363 }
1364 else
1365#endif
1366 if (strcmp (fstyp, "specfs") == 0) {
1367 tprintf ("dev=");
1368 printstr (tcp, tcp->u_arg[4], -1);
1369 }
1370 else
1371 if (strcmp (fstyp, "nfs") == 0) {
1372 struct nfs_args args;
1373 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1374 tprintf("%#lx", tcp->u_arg[4]);
1375 else {
1376 struct netbuf addr;
1377 tprintf("{ addr=");
1378 if (umove (tcp, (int) args.addr, &addr) < 0) {
1379 tprintf ("%#lx", (long) args.addr);
1380 }
1381 else {
1382 printsock(tcp, (int) addr.buf, addr.len);
1383 }
1384 tprintf(", flags=");
1385 if (!printflags(nfs_flags, args.flags))
1386 tprintf("NFSMNT_???");
1387 tprintf(", hostname=");
1388 printstr(tcp, (int) args.hostname, -1);
1389 tprintf(", ...}");
1390 }
1391 }
1392 else
1393 tprintf("%#lx", tcp->u_arg[4]);
1394 tprintf(", %ld", tcp->u_arg[5]);
1395 }
1396 }
1397 return 0;
1398}
1399
1400#else /* !UNIXWARE */
1401
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001402int
1403sys_mount(tcp)
1404struct tcb *tcp;
1405{
1406 if (entering(tcp)) {
1407 printpath(tcp, tcp->u_arg[0]);
1408 tprintf(", ");
1409 printpath(tcp, tcp->u_arg[1]);
1410 tprintf(", ...");
1411 }
1412 return 0;
1413}
Wichert Akkermanea78f0f1999-11-29 15:34:02 +00001414#endif /* !UNIXWARE */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001415
1416#endif /* !MIPS */
1417
1418#endif /* SVR4 */
1419
Nate Sammons8d5860c1999-07-03 18:53:05 +00001420#ifdef SYS_capget
Wichert Akkermanc7926982000-04-10 22:22:31 +00001421
1422static struct xlat capabilities[] = {
1423 { 1<<CAP_CHOWN, "CAP_CHOWN" },
1424 { 1<<CAP_DAC_OVERRIDE, "CAP_DAC_OVERRIDE"},
1425 { 1<<CAP_DAC_READ_SEARCH,"CAP_DAC_READ_SEARCH"},
1426 { 1<<CAP_FOWNER, "CAP_FOWNER" },
1427 { 1<<CAP_FSETID, "CAP_FSETID" },
1428 { 1<<CAP_KILL, "CAP_KILL" },
1429 { 1<<CAP_SETGID, "CAP_SETGID" },
1430 { 1<<CAP_SETUID, "CAP_SETUID" },
1431 { 1<<CAP_SETPCAP, "CAP_SETPCAP" },
1432 { 1<<CAP_LINUX_IMMUTABLE,"CAP_LINUX_IMMUTABLE"},
1433 { 1<<CAP_NET_BIND_SERVICE,"CAP_NET_BIND_SERVICE"},
1434 { 1<<CAP_NET_BROADCAST, "CAP_NET_BROADCAST"},
1435 { 1<<CAP_NET_ADMIN, "CAP_NET_ADMIN" },
1436 { 1<<CAP_NET_RAW, "CAP_NET_RAW" },
1437 { 1<<CAP_IPC_LOCK, "CAP_IPC_LOCK" },
1438 { 1<<CAP_IPC_OWNER, "CAP_IPC_OWNER" },
1439 { 1<<CAP_SYS_MODULE, "CAP_SYS_MODULE"},
1440 { 1<<CAP_SYS_RAWIO, "CAP_SYS_RAWIO" },
1441 { 1<<CAP_SYS_CHROOT, "CAP_SYS_CHROOT"},
1442 { 1<<CAP_SYS_PTRACE, "CAP_SYS_PTRACE"},
1443 { 1<<CAP_SYS_PACCT, "CAP_SYS_PACCT" },
1444 { 1<<CAP_SYS_ADMIN, "CAP_SYS_ADMIN" },
1445 { 1<<CAP_SYS_BOOT, "CAP_SYS_BOOT" },
1446 { 1<<CAP_SYS_NICE, "CAP_SYS_NICE" },
1447 { 1<<CAP_SYS_RESOURCE, "CAP_SYS_RESOURCE"},
1448 { 1<<CAP_SYS_TIME, "CAP_SYS_TIME" },
1449 { 1<<CAP_SYS_TTY_CONFIG,"CAP_SYS_TTY_CONFIG"},
1450 { 0, NULL },
1451};
1452
1453
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001454int
1455sys_capget(tcp)
1456struct tcb *tcp;
1457{
Wichert Akkermanc7926982000-04-10 22:22:31 +00001458 static cap_user_header_t arg0 = NULL;
1459 static cap_user_data_t arg1 = NULL;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001460
1461 if(!entering(tcp)) {
Wichert Akkermanc7926982000-04-10 22:22:31 +00001462 if (!arg0) {
1463 if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
1464 fprintf(stderr, "sys_capget: no memory\n");
1465 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001466 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001467 }
1468 }
1469 if (!arg1) {
1470 if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
1471 fprintf(stderr, "sys_capget: no memory\n");
1472 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001473 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001474 }
1475 }
1476
1477 if (!tcp->u_arg[0])
1478 tprintf("NULL");
1479 else if (!verbose(tcp))
1480 tprintf("%#lx", tcp->u_arg[0]);
1481 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
1482 tprintf("???");
1483 else {
1484 tprintf("%#x, %d", arg0->version, arg0->pid);
1485 }
1486 tprintf(", ");
1487 if (!tcp->u_arg[1])
1488 tprintf("NULL");
1489 else if (!verbose(tcp))
1490 tprintf("%#lx", tcp->u_arg[1]);
1491 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
1492 tprintf("???");
1493 else {
1494 tprintf("{");
1495 printflags(capabilities, arg1->effective);
1496 tprintf(", ");
1497 printflags(capabilities, arg1->permitted);
1498 tprintf(", ");
1499 printflags(capabilities, arg1->inheritable);
1500 tprintf("}");
1501 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001502 }
1503 return 0;
1504}
1505
1506int
1507sys_capset(tcp)
1508struct tcb *tcp;
1509{
Wichert Akkermanc7926982000-04-10 22:22:31 +00001510 static cap_user_header_t arg0 = NULL;
1511 static cap_user_data_t arg1 = NULL;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001512
Wichert Akkermanc7926982000-04-10 22:22:31 +00001513 if(entering(tcp)) {
1514 if (!arg0) {
1515 if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
1516 fprintf(stderr, "sys_capset: no memory\n");
1517 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001518 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001519 }
1520 }
1521 if (!arg1) {
1522 if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
1523 fprintf(stderr, "sys_capset: no memory\n");
1524 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001525 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001526 }
1527 }
1528
1529 if (!tcp->u_arg[0])
1530 tprintf("NULL");
1531 else if (!verbose(tcp))
1532 tprintf("%#lx", tcp->u_arg[0]);
1533 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
1534 tprintf("???");
1535 else {
1536 tprintf("%#x, %d", arg0->version, arg0->pid);
1537 }
1538 tprintf(", ");
1539 if (!tcp->u_arg[1])
1540 tprintf("NULL");
1541 else if (!verbose(tcp))
1542 tprintf("%#lx", tcp->u_arg[1]);
1543 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
1544 tprintf("???");
1545 else {
1546 tprintf("{");
1547 printflags(capabilities, arg1->effective);
1548 tprintf(", ");
1549 printflags(capabilities, arg1->permitted);
1550 tprintf(", ");
1551 printflags(capabilities, arg1->inheritable);
1552 tprintf("}");
1553 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001554 }
1555 return 0;
1556}
1557
1558#else
1559
1560int sys_capget(tcp)
1561struct tcb *tcp;
1562{
1563 return printargs(tcp);
1564}
1565
1566int sys_capset(tcp)
1567struct tcb *tcp;
1568{
1569 return printargs(tcp);
1570}
1571
1572#endif
1573
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001574#ifdef LINUX
1575static struct xlat sysctl_root[] = {
1576 { CTL_KERN, "CTL_KERN" },
1577 { CTL_VM, "CTL_VM" },
1578 { CTL_NET, "CTL_NET" },
1579 { CTL_PROC, "CTL_PROC" },
1580 { CTL_FS, "CTL_FS" },
1581 { CTL_DEBUG, "CTL_DEBUG" },
1582 { CTL_DEV, "CTL_DEV" },
1583 { 0, NULL }
1584};
1585
1586static struct xlat sysctl_kern[] = {
1587 { KERN_OSTYPE, "KERN_OSTYPE" },
1588 { KERN_OSRELEASE, "KERN_OSRELEASE" },
1589 { KERN_OSREV, "KERN_OSREV" },
1590 { KERN_VERSION, "KERN_VERSION" },
1591 { KERN_SECUREMASK, "KERN_SECUREMASK" },
1592 { KERN_PROF, "KERN_PROF" },
1593 { KERN_NODENAME, "KERN_NODENAME" },
1594 { KERN_DOMAINNAME, "KERN_DOMAINNAME" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001595#ifdef KERN_SECURELVL
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001596 { KERN_SECURELVL, "KERN_SECURELVL" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001597#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001598 { KERN_PANIC, "KERN_PANIC" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001599#ifdef KERN_REALROOTDEV
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001600 { KERN_REALROOTDEV, "KERN_REALROOTDEV" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001601#endif
1602#ifdef KERN_JAVA_INTERPRETER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001603 { KERN_JAVA_INTERPRETER, "KERN_JAVA_INTERPRETER" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001604#endif
1605#ifdef KERN_JAVA_APPLETVIEWER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001606 { KERN_JAVA_APPLETVIEWER, "KERN_JAVA_APPLETVIEWER" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001607#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001608 { KERN_SPARC_REBOOT, "KERN_SPARC_REBOOT" },
1609 { KERN_CTLALTDEL, "KERN_CTLALTDEL" },
1610 { KERN_PRINTK, "KERN_PRINTK" },
1611 { KERN_NAMETRANS, "KERN_NAMETRANS" },
1612 { KERN_PPC_HTABRECLAIM, "KERN_PPC_HTABRECLAIM" },
1613 { KERN_PPC_ZEROPAGED, "KERN_PPC_ZEROPAGED" },
1614 { KERN_PPC_POWERSAVE_NAP, "KERN_PPC_POWERSAVE_NAP" },
1615 { KERN_MODPROBE, "KERN_MODPROBE" },
1616 { KERN_SG_BIG_BUFF, "KERN_SG_BIG_BUFF" },
1617 { KERN_ACCT, "KERN_ACCT" },
1618 { KERN_PPC_L2CR, "KERN_PPC_L2CR" },
1619 { KERN_RTSIGNR, "KERN_RTSIGNR" },
1620 { KERN_RTSIGMAX, "KERN_RTSIGMAX" },
1621 { KERN_SHMMAX, "KERN_SHMMAX" },
1622 { KERN_MSGMAX, "KERN_MSGMAX" },
1623 { KERN_MSGMNB, "KERN_MSGMNB" },
1624 { KERN_MSGPOOL, "KERN_MSGPOOL" },
1625 { 0, NULL }
1626};
1627
1628static struct xlat sysctl_vm[] = {
Roland McGratha796fd02004-03-01 22:10:54 +00001629#ifdef VM_SWAPCTL
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001630 { VM_SWAPCTL, "VM_SWAPCTL" },
Roland McGratha796fd02004-03-01 22:10:54 +00001631#endif
1632#ifdef VM_UNUSED1
1633 { VM_UNUSED1, "VM_UNUSED1" },
1634#endif
1635#ifdef VM_SWAPOUT
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001636 { VM_SWAPOUT, "VM_SWAPOUT" },
Roland McGratha796fd02004-03-01 22:10:54 +00001637#endif
1638#ifdef VM_UNUSED2
1639 { VM_UNUSED2, "VM_UNUSED2" },
1640#endif
1641#ifdef VM_FREEPG
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001642 { VM_FREEPG, "VM_FREEPG" },
Roland McGratha796fd02004-03-01 22:10:54 +00001643#endif
1644#ifdef VM_UNUSED3
1645 { VM_UNUSED3, "VM_UNUSED3" },
1646#endif
1647#ifdef VM_BDFLUSH
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001648 { VM_BDFLUSH, "VM_BDFLUSH" },
Roland McGratha796fd02004-03-01 22:10:54 +00001649#endif
1650#ifdef VM_UNUSED4
1651 { VM_UNUSED4, "VM_UNUSED4" },
1652#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001653 { VM_OVERCOMMIT_MEMORY, "VM_OVERCOMMIT_MEMORY" },
Roland McGratha796fd02004-03-01 22:10:54 +00001654#ifdef VM_BUFFERMEM
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001655 { VM_BUFFERMEM, "VM_BUFFERMEM" },
Roland McGratha796fd02004-03-01 22:10:54 +00001656#endif
1657#ifdef VM_UNUSED5
1658 { VM_UNUSED5, "VM_UNUSED5" },
1659#endif
1660#ifdef VM_PAGECACHE
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001661 { VM_PAGECACHE, "VM_PAGECACHE" },
Roland McGratha796fd02004-03-01 22:10:54 +00001662#endif
1663#ifdef VM_UNUSED7
1664 { VM_UNUSED7, "VM_UNUSED7" },
1665#endif
1666#ifdef VM_PAGERDAEMON
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001667 { VM_PAGERDAEMON, "VM_PAGERDAEMON" },
Roland McGratha796fd02004-03-01 22:10:54 +00001668#endif
1669#ifdef VM_UNUSED8
1670 { VM_UNUSED8, "VM_UNUSED8" },
1671#endif
1672#ifdef VM_PGT_CACHE
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001673 { VM_PGT_CACHE, "VM_PGT_CACHE" },
Roland McGratha796fd02004-03-01 22:10:54 +00001674#endif
1675#ifdef VM_UNUSED9
1676 { VM_UNUSED9, "VM_UNUSED9" },
1677#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001678 { VM_PAGE_CLUSTER, "VM_PAGE_CLUSTER" },
1679 { 0, NULL },
1680};
1681
1682static struct xlat sysctl_net[] = {
1683 { NET_CORE, "NET_CORE" },
1684 { NET_ETHER, "NET_ETHER" },
1685 { NET_802, "NET_802" },
1686 { NET_UNIX, "NET_UNIX" },
1687 { NET_IPV4, "NET_IPV4" },
1688 { NET_IPX, "NET_IPX" },
1689 { NET_ATALK, "NET_ATALK" },
1690 { NET_NETROM, "NET_NETROM" },
1691 { NET_AX25, "NET_AX25" },
1692 { NET_BRIDGE, "NET_BRIDGE" },
1693 { NET_ROSE, "NET_ROSE" },
1694 { NET_IPV6, "NET_IPV6" },
1695 { NET_X25, "NET_X25" },
1696 { NET_TR, "NET_TR" },
1697 { NET_DECNET, "NET_DECNET" },
1698 { 0, NULL }
1699};
1700
1701static struct xlat sysctl_net_core[] = {
1702 { NET_CORE_WMEM_MAX, "NET_CORE_WMEM_MAX" },
1703 { NET_CORE_RMEM_MAX, "NET_CORE_RMEM_MAX" },
1704 { NET_CORE_WMEM_DEFAULT, "NET_CORE_WMEM_DEFAULT" },
1705 { NET_CORE_RMEM_DEFAULT, "NET_CORE_RMEM_DEFAULT" },
1706 { NET_CORE_MAX_BACKLOG, "NET_CORE_MAX_BACKLOG" },
1707 { NET_CORE_FASTROUTE, "NET_CORE_FASTROUTE" },
1708 { NET_CORE_MSG_COST, "NET_CORE_MSG_COST" },
1709 { NET_CORE_MSG_BURST, "NET_CORE_MSG_BURST" },
1710 { NET_CORE_OPTMEM_MAX, "NET_CORE_OPTMEM_MAX" },
1711 { 0, NULL }
1712};
1713
1714static struct xlat sysctl_net_unix[] = {
1715 { NET_UNIX_DESTROY_DELAY, "NET_UNIX_DESTROY_DELAY" },
1716 { NET_UNIX_DELETE_DELAY, "NET_UNIX_DELETE_DELAY" },
1717 { 0, NULL }
1718};
1719
1720static struct xlat sysctl_net_ipv4[] = {
1721 { NET_IPV4_FORWARD, "NET_IPV4_FORWARD" },
1722 { NET_IPV4_DYNADDR, "NET_IPV4_DYNADDR" },
1723 { NET_IPV4_CONF, "NET_IPV4_CONF" },
1724 { NET_IPV4_NEIGH, "NET_IPV4_NEIGH" },
1725 { NET_IPV4_ROUTE, "NET_IPV4_ROUTE" },
1726 { NET_IPV4_FIB_HASH, "NET_IPV4_FIB_HASH" },
1727 { NET_IPV4_TCP_TIMESTAMPS, "NET_IPV4_TCP_TIMESTAMPS" },
1728 { NET_IPV4_TCP_WINDOW_SCALING, "NET_IPV4_TCP_WINDOW_SCALING" },
1729 { NET_IPV4_TCP_SACK, "NET_IPV4_TCP_SACK" },
1730 { NET_IPV4_TCP_RETRANS_COLLAPSE, "NET_IPV4_TCP_RETRANS_COLLAPSE" },
1731 { NET_IPV4_DEFAULT_TTL, "NET_IPV4_DEFAULT_TTL" },
1732 { NET_IPV4_AUTOCONFIG, "NET_IPV4_AUTOCONFIG" },
1733 { NET_IPV4_NO_PMTU_DISC, "NET_IPV4_NO_PMTU_DISC" },
1734 { NET_IPV4_TCP_SYN_RETRIES, "NET_IPV4_TCP_SYN_RETRIES" },
1735 { NET_IPV4_IPFRAG_HIGH_THRESH, "NET_IPV4_IPFRAG_HIGH_THRESH" },
1736 { NET_IPV4_IPFRAG_LOW_THRESH, "NET_IPV4_IPFRAG_LOW_THRESH" },
1737 { NET_IPV4_IPFRAG_TIME, "NET_IPV4_IPFRAG_TIME" },
1738 { NET_IPV4_TCP_MAX_KA_PROBES, "NET_IPV4_TCP_MAX_KA_PROBES" },
1739 { NET_IPV4_TCP_KEEPALIVE_TIME, "NET_IPV4_TCP_KEEPALIVE_TIME" },
1740 { NET_IPV4_TCP_KEEPALIVE_PROBES, "NET_IPV4_TCP_KEEPALIVE_PROBES" },
1741 { NET_IPV4_TCP_RETRIES1, "NET_IPV4_TCP_RETRIES1" },
1742 { NET_IPV4_TCP_RETRIES2, "NET_IPV4_TCP_RETRIES2" },
1743 { NET_IPV4_TCP_FIN_TIMEOUT, "NET_IPV4_TCP_FIN_TIMEOUT" },
1744 { NET_IPV4_IP_MASQ_DEBUG, "NET_IPV4_IP_MASQ_DEBUG" },
1745 { NET_TCP_SYNCOOKIES, "NET_TCP_SYNCOOKIES" },
1746 { NET_TCP_STDURG, "NET_TCP_STDURG" },
1747 { NET_TCP_RFC1337, "NET_TCP_RFC1337" },
1748 { NET_TCP_SYN_TAILDROP, "NET_TCP_SYN_TAILDROP" },
1749 { NET_TCP_MAX_SYN_BACKLOG, "NET_TCP_MAX_SYN_BACKLOG" },
1750 { NET_IPV4_LOCAL_PORT_RANGE, "NET_IPV4_LOCAL_PORT_RANGE" },
1751 { NET_IPV4_ICMP_ECHO_IGNORE_ALL, "NET_IPV4_ICMP_ECHO_IGNORE_ALL" },
1752 { NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS" },
1753 { NET_IPV4_ICMP_SOURCEQUENCH_RATE, "NET_IPV4_ICMP_SOURCEQUENCH_RATE" },
1754 { NET_IPV4_ICMP_DESTUNREACH_RATE, "NET_IPV4_ICMP_DESTUNREACH_RATE" },
1755 { NET_IPV4_ICMP_TIMEEXCEED_RATE, "NET_IPV4_ICMP_TIMEEXCEED_RATE" },
1756 { NET_IPV4_ICMP_PARAMPROB_RATE, "NET_IPV4_ICMP_PARAMPROB_RATE" },
1757 { NET_IPV4_ICMP_ECHOREPLY_RATE, "NET_IPV4_ICMP_ECHOREPLY_RATE" },
1758 { NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES" },
1759 { NET_IPV4_IGMP_MAX_MEMBERSHIPS, "NET_IPV4_IGMP_MAX_MEMBERSHIPS" },
1760 { 0, NULL }
1761};
1762
1763static struct xlat sysctl_net_ipv4_route[] = {
1764 { NET_IPV4_ROUTE_FLUSH, "NET_IPV4_ROUTE_FLUSH" },
1765 { NET_IPV4_ROUTE_MIN_DELAY, "NET_IPV4_ROUTE_MIN_DELAY" },
1766 { NET_IPV4_ROUTE_MAX_DELAY, "NET_IPV4_ROUTE_MAX_DELAY" },
1767 { NET_IPV4_ROUTE_GC_THRESH, "NET_IPV4_ROUTE_GC_THRESH" },
1768 { NET_IPV4_ROUTE_MAX_SIZE, "NET_IPV4_ROUTE_MAX_SIZE" },
1769 { NET_IPV4_ROUTE_GC_MIN_INTERVAL, "NET_IPV4_ROUTE_GC_MIN_INTERVAL" },
1770 { NET_IPV4_ROUTE_GC_TIMEOUT, "NET_IPV4_ROUTE_GC_TIMEOUT" },
1771 { NET_IPV4_ROUTE_GC_INTERVAL, "NET_IPV4_ROUTE_GC_INTERVAL" },
1772 { NET_IPV4_ROUTE_REDIRECT_LOAD, "NET_IPV4_ROUTE_REDIRECT_LOAD" },
1773 { NET_IPV4_ROUTE_REDIRECT_NUMBER, "NET_IPV4_ROUTE_REDIRECT_NUMBER" },
1774 { NET_IPV4_ROUTE_REDIRECT_SILENCE, "NET_IPV4_ROUTE_REDIRECT_SILENCE" },
1775 { NET_IPV4_ROUTE_ERROR_COST, "NET_IPV4_ROUTE_ERROR_COST" },
1776 { NET_IPV4_ROUTE_ERROR_BURST, "NET_IPV4_ROUTE_ERROR_BURST" },
1777 { NET_IPV4_ROUTE_GC_ELASTICITY, "NET_IPV4_ROUTE_GC_ELASTICITY" },
1778 { 0, NULL }
1779};
1780
1781static struct xlat sysctl_net_ipv4_conf[] = {
1782 { NET_IPV4_CONF_FORWARDING, "NET_IPV4_CONF_FORWARDING" },
1783 { NET_IPV4_CONF_MC_FORWARDING, "NET_IPV4_CONF_MC_FORWARDING" },
1784 { NET_IPV4_CONF_PROXY_ARP, "NET_IPV4_CONF_PROXY_ARP" },
1785 { NET_IPV4_CONF_ACCEPT_REDIRECTS, "NET_IPV4_CONF_ACCEPT_REDIRECTS" },
1786 { NET_IPV4_CONF_SECURE_REDIRECTS, "NET_IPV4_CONF_SECURE_REDIRECTS" },
1787 { NET_IPV4_CONF_SEND_REDIRECTS, "NET_IPV4_CONF_SEND_REDIRECTS" },
1788 { NET_IPV4_CONF_SHARED_MEDIA, "NET_IPV4_CONF_SHARED_MEDIA" },
1789 { NET_IPV4_CONF_RP_FILTER, "NET_IPV4_CONF_RP_FILTER" },
1790 { NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, "NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE" },
1791 { NET_IPV4_CONF_BOOTP_RELAY, "NET_IPV4_CONF_BOOTP_RELAY" },
1792 { NET_IPV4_CONF_LOG_MARTIANS, "NET_IPV4_CONF_LOG_MARTIANS" },
1793 { 0, NULL }
1794};
1795
1796static struct xlat sysctl_net_ipv6[] = {
1797 { NET_IPV6_CONF, "NET_IPV6_CONF" },
1798 { NET_IPV6_NEIGH, "NET_IPV6_NEIGH" },
1799 { NET_IPV6_ROUTE, "NET_IPV6_ROUTE" },
1800 { 0, NULL }
1801};
1802
1803static struct xlat sysctl_net_ipv6_route[] = {
1804 { NET_IPV6_ROUTE_FLUSH, "NET_IPV6_ROUTE_FLUSH" },
1805 { NET_IPV6_ROUTE_GC_THRESH, "NET_IPV6_ROUTE_GC_THRESH" },
1806 { NET_IPV6_ROUTE_MAX_SIZE, "NET_IPV6_ROUTE_MAX_SIZE" },
1807 { NET_IPV6_ROUTE_GC_MIN_INTERVAL, "NET_IPV6_ROUTE_GC_MIN_INTERVAL" },
1808 { NET_IPV6_ROUTE_GC_TIMEOUT, "NET_IPV6_ROUTE_GC_TIMEOUT" },
1809 { NET_IPV6_ROUTE_GC_INTERVAL, "NET_IPV6_ROUTE_GC_INTERVAL" },
1810 { NET_IPV6_ROUTE_GC_ELASTICITY, "NET_IPV6_ROUTE_GC_ELASTICITY" },
1811 { 0, NULL }
1812};
1813
1814int
1815sys_sysctl(tcp)
1816struct tcb *tcp;
1817{
1818 struct __sysctl_args info;
1819 int *name;
1820 umove (tcp, tcp->u_arg[0], &info);
1821
1822 name = alloca (sizeof (int) * info.nlen);
1823 umoven(tcp, (size_t) info.name, sizeof (int) * info.nlen, (char *) name);
1824
1825 if (entering(tcp)) {
1826 int cnt = 0;
1827
1828 tprintf("{{");
1829
1830 if (info.nlen == 0)
1831 goto out;
1832 printxval(sysctl_root, name[0], "CTL_???");
1833 ++cnt;
1834
1835 if (info.nlen == 1)
1836 goto out;
1837 switch (name[0]) {
1838 case CTL_KERN:
1839 tprintf(", ");
1840 printxval(sysctl_kern, name[1], "KERN_???");
1841 ++cnt;
1842 break;
1843 case CTL_VM:
1844 tprintf(", ");
1845 printxval(sysctl_vm, name[1], "VM_???");
1846 ++cnt;
1847 break;
1848 case CTL_NET:
1849 tprintf(", ");
1850 printxval(sysctl_net, name[1], "NET_???");
1851 ++cnt;
1852
1853 if (info.nlen == 2)
1854 goto out;
1855 switch (name[1]) {
1856 case NET_CORE:
1857 tprintf(", ");
1858 printxval(sysctl_net_core, name[2],
1859 "NET_CORE_???");
1860 break;
1861 case NET_UNIX:
1862 tprintf(", ");
1863 printxval(sysctl_net_unix, name[2],
1864 "NET_UNIX_???");
1865 break;
1866 case NET_IPV4:
1867 tprintf(", ");
1868 printxval(sysctl_net_ipv4, name[2],
1869 "NET_IPV4_???");
1870
1871 if (info.nlen == 3)
1872 goto out;
1873 switch (name[2]) {
1874 case NET_IPV4_ROUTE:
1875 tprintf(", ");
1876 printxval(sysctl_net_ipv4_route,
1877 name[3],
1878 "NET_IPV4_ROUTE_???");
1879 break;
1880 case NET_IPV4_CONF:
1881 tprintf(", ");
1882 printxval(sysctl_net_ipv4_conf,
1883 name[3],
1884 "NET_IPV4_CONF_???");
1885 break;
1886 default:
1887 goto out;
1888 }
1889 break;
1890 case NET_IPV6:
1891 tprintf(", ");
1892 printxval(sysctl_net_ipv6, name[2],
1893 "NET_IPV6_???");
1894
1895 if (info.nlen == 3)
1896 goto out;
1897 switch (name[2]) {
1898 case NET_IPV6_ROUTE:
1899 tprintf(", ");
1900 printxval(sysctl_net_ipv6_route,
1901 name[3],
1902 "NET_IPV6_ROUTE_???");
1903 break;
1904 default:
1905 goto out;
1906 }
1907 break;
1908 default:
1909 goto out;
1910 }
1911 break;
1912 default:
1913 goto out;
1914 }
1915 out:
1916 while (cnt < info.nlen)
1917 tprintf(", %x", name[cnt++]);
1918 tprintf("}, %d, ", info.nlen);
1919 } else {
1920 size_t oldlen;
1921 umove(tcp, (size_t)info.oldlenp, &oldlen);
1922 if (info.nlen >= 2
1923 && ((name[0] == CTL_KERN
1924 && (name[1] == KERN_OSRELEASE
1925 || name[1] == KERN_OSTYPE
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001926#ifdef KERN_JAVA_INTERPRETER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001927 || name[1] == KERN_JAVA_INTERPRETER
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001928#endif
1929#ifdef KERN_JAVA_APPLETVIEWER
1930 || name[1] == KERN_JAVA_APPLETVIEWER
1931#endif
1932 )))) {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001933 printpath(tcp, (size_t)info.oldval);
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001934 tprintf(", %Zu, ", oldlen);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001935 if (info.newval == 0)
1936 tprintf("NULL");
1937 else if (syserror(tcp))
1938 tprintf("%p", info.newval);
1939 else
1940 printpath(tcp, (size_t)info.newval);
1941 tprintf(", %Zd", info.newlen);
1942 } else {
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001943 tprintf("%p, %Zd, %p, %Zd", info.oldval, oldlen,
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001944 info.newval, info.newlen);
1945 }
1946 tprintf("}");
1947 }
1948 return 0;
1949}
1950#else
1951int sys_sysctl(tcp)
1952struct tcb *tcp;
1953{
1954 return printargs(tcp);
1955}
1956#endif
1957
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001958#ifdef FREEBSD
1959#include <sys/sysctl.h>
1960
1961int sys___sysctl(tcp)
1962struct tcb *tcp;
1963{
1964 int qoid[CTL_MAXNAME+2];
1965 char ctl[1024];
1966 size_t len;
1967 int i, numeric;
1968
1969 if (entering(tcp)) {
1970 if (tcp->u_arg[1] < 0 || tcp->u_arg[1] > CTL_MAXNAME ||
1971 (umoven(tcp, tcp->u_arg[0], tcp->u_arg[1] * sizeof(int),
1972 (char *) (qoid + 2)) < 0))
1973 tprintf("[...], ");
1974 else {
1975 /* Use sysctl to ask the name of the current MIB
1976 This uses the undocumented "Staff-functions" used
1977 by the sysctl program. See kern_sysctl.c for
1978 details. */
1979 qoid[0] = 0; /* sysctl */
1980 qoid[1] = 1; /* name */
1981 i = sizeof(ctl);
1982 tprintf("[");
1983 if (sysctl(qoid, tcp->u_arg[1] + 2, ctl, &i, 0, 0) >= 0) {
1984 numeric = !abbrev(tcp);
1985 tprintf("%s%s", ctl, numeric ? ", " : "");
1986 } else
1987 numeric = 1;
1988 if (numeric) {
1989 for (i = 0; i < tcp->u_arg[1]; i++)
1990 tprintf("%s%d", i ? "." : "", qoid[i + 2]);
1991 }
1992 tprintf("], ");
1993 tprintf("%lu, ", tcp->u_arg[1]);
1994 }
1995 } else {
1996 if (!syserror(tcp) && (umove(tcp, tcp->u_arg[3], &len) >= 0)) {
1997 printstr(tcp, tcp->u_arg[2], len);
1998 tprintf(", [%u], ", len);
1999 } else
2000 tprintf("%#lx, %#lx, ", tcp->u_arg[2], tcp->u_arg[3]);
2001 printstr(tcp, tcp->u_arg[4], tcp->u_arg[5]);
2002 tprintf(", %lu", tcp->u_arg[5]);
2003 }
2004 return 0;
2005}
2006#endif
Wichert Akkerman16a03d22000-08-10 02:14:04 +00002007
2008#if UNIXWARE >= 2
2009
2010#include <sys/ksym.h>
2011#include <sys/elf.h>
2012
2013static struct xlat ksym_flags[] = {
2014 { STT_NOTYPE, "STT_NOTYPE" },
2015 { STT_FUNC, "STT_FUNC" },
2016 { STT_OBJECT, "STT_OBJECT" },
2017 { 0, NULL },
2018};
2019
2020int
2021sys_getksym(tcp)
2022struct tcb *tcp;
2023{
2024 if (entering (tcp)) {
2025 printstr(tcp, tcp->u_arg[0], -1);
2026 tprintf(", ");
2027 }
2028 else {
2029 if (syserror(tcp)) {
2030 tprintf("%#lx, %#lx",
2031 tcp->u_arg[1], tcp->u_arg[2]);
2032 }
2033 else {
2034 int val;
2035 printnum (tcp, tcp->u_arg[1], "%#lx");
2036 tprintf(", ");
2037 if (umove(tcp, tcp->u_arg[2], &val) < 0) {
2038 tprintf("%#lx", tcp->u_arg[2]);
2039 }
2040 else {
2041 tprintf("[");
2042 printxval (ksym_flags, val, "STT_???");
2043 tprintf("]");
2044 }
2045 }
2046 }
2047
2048 return 0;
2049}
2050
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002051#ifdef HAVE_SYS_NSCSYS_H
John Hughes4e36a812001-04-18 15:11:51 +00002052
John Hughes0aadba42001-10-16 18:19:52 +00002053struct cred;
John Hughes4e36a812001-04-18 15:11:51 +00002054#include <sys/nscsys.h>
2055
2056static struct xlat ssi_cmd [] = {
2057 { SSISYS_BADOP, "SSISYS_BADOP" },
2058 { SSISYS_LDLVL_INIT,"SSISYS_LDLVL_INIT"},
2059 { SSISYS_LDLVL_GETVEC,"SSISYS_LDLVL_GETVEC"},
2060 { SSISYS_LDLVL_PUTVEC,"SSISYS_LDLVL_PUTVEC"},
2061 { SSISYS_LDLVL_PUTRCMDS,"SSISYS_LDLVL_PUTRCMDS"},
2062 { SSISYS_LDLVL_SETREXEC,"SSISYS_LDLVL_SETREXEC"},
2063 { SSISYS_CMS_CLUSTERID,"SSISYS_CMS_CLUSTERID"},
2064 { SSISYS_CFS_STATVFS,"SSISYS_CFS_STATVFS"},
2065 { SSISYS_NODE_GETNUM,"SSISYS_NODE_GETNUM"},
2066 { SSISYS_NODE_TABLE,"SSISYS_NODE_TABLE"},
2067 { SSISYS_NODE_DOWN,"SSISYS_NODE_DOWN"},
2068 { SSISYS_RECLAIM_CHILD,"SSISYS_RECLAIM_CHILD"},
2069 { SSISYS_IPC_GETINFO,"SSISYS_IPC_GETINFO"},
2070 { SSISYS_ICS_TEST,"SSISYS_ICS_TEST"},
2071 { SSISYS_NODE_PID,"SSISYS_NODE_PID"},
2072 { SSISYS_ISLOCAL,"SSISYS_ISLOCAL"},
2073 { SSISYS_CFS_ISSTACKED,"SSISYS_CFS_ISSTACKED"},
2074 { SSISYS_DNET_SYNC,"SSISYS_DNET_SYNC"},
2075 { SSISYS_CFS_WAIT_MODE,"SSISYS_CFS_WAIT_MODE"},
2076 { SSISYS_CFS_UMOUNT,"SSISYS_CFS_UMOUNT"},
2077 { SSISYS_LLSTAT,"SSISYS_LLSTAT" },
2078 { SSISYS_LTS_PERFTEST,"SSISYS_LTS_PERFTEST"},
2079 { SSISYS_LTS_CONFIG,"SSISYS_LTS_CONFIG"},
2080 { SSISYS_SNET_PERFTEST,"SSISYS_SNET_PERFTEST"},
2081 { SSISYS_IGNORE_HALFUP,"SSISYS_IGNORE_HALFUP"},
2082 { SSISYS_NODE_ROOTDEV,"SSISYS_NODE_ROOTDEV"},
2083 { SSISYS_GET_PRIMARY,"SSISYS_GET_PRIMARY"},
2084 { SSISYS_GET_SECONDARY,"SSISYS_GET_SECONDARY"},
2085 { SSISYS_GET_ROOTDISK,"SSISYS_GET_ROOTDISK"},
2086 { SSISYS_CLUSTERNODE_NUM,"SSISYS_CLUSTERNODE_NUM"},
2087 { SSISYS_CLUSTER_MEMBERSHIP,"SSISYS_CLUSTER_MEMBERSHIP"},
2088 { SSISYS_CLUSTER_DETAILEDTRANS,"SSISYS_CLUSTER_DETAILEDTRANS"},
2089 { SSISYS_CLUSTERNODE_INFO,"SSISYS_CLUSTERNODE_INFO"},
2090 { SSISYS_CLUSTERNODE_SETINFO,"SSISYS_CLUSTERNODE_SETINFO"},
2091 { SSISYS_CLUSTERNODE_AVAIL,"SSISYS_CLUSTERNODE_AVAIL"},
2092 { SSISYS_CLUSTER_MAXNODES,"SSISYS_CLUSTER_MAXNODES"},
2093 { SSISYS_SET_MEMPRIO,"SSISYS_SET_MEMPRIO"},
2094 { SSISYS_GET_USERS,"SSISYS_GET_USERS"},
2095 { SSISYS_FORCE_ROOT_NODE,"SSISYS_FORCE_ROOT_NODE"},
2096 { SSISYS_CVIP_SET,"SSISYS_CVIP_SET"},
2097 { SSISYS_CVIP_GET,"SSISYS_CVIP_GET"},
2098 { SSISYS_GET_NODE_COUNTS,"SSISYS_GET_NODE_COUNTS"},
2099 { SSISYS_GET_TRANSPORT,"SSISYS_GET_TRANSPORT"},
2100 { 0, NULL },
2101};
2102
2103int sys_ssisys (tcp)
2104struct tcb *tcp;
2105{
2106 struct ssisys_iovec iov;
John Hughes2d8b2c52001-10-18 14:52:24 +00002107 cls_nodeinfo_args_t cni;
2108 clusternode_info_t info;
2109
John Hughes4e36a812001-04-18 15:11:51 +00002110 if (entering (tcp)) {
John Hughes0aadba42001-10-16 18:19:52 +00002111 ts_reclaim_child_inargs_t trc;
John Hughes4e36a812001-04-18 15:11:51 +00002112 if (tcp->u_arg[1] != sizeof iov ||
2113 umove (tcp, tcp->u_arg[0], &iov) < 0)
2114 {
2115 tprintf ("%#lx, %ld", tcp->u_arg[0], tcp->u_arg[1]);
2116 return 0;
2117 }
2118 tprintf ("{id=");
2119 printxval(ssi_cmd, iov.tio_id.id_cmd, "SSISYS_???");
2120 tprintf (":%d", iov.tio_id.id_ver);
2121 switch (iov.tio_id.id_cmd) {
John Hughes0aadba42001-10-16 18:19:52 +00002122 case SSISYS_RECLAIM_CHILD:
2123 if (iov.tio_udatainlen != sizeof trc ||
2124 umove (tcp, (long) iov.tio_udatain, &trc) < 0)
2125 goto bad;
2126 tprintf (", in={pid=%ld, start=%ld}",
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002127 trc.trc_pid, trc.trc_start);
John Hughes0aadba42001-10-16 18:19:52 +00002128 break;
2129 case SSISYS_CLUSTERNODE_INFO:
2130 if (iov.tio_udatainlen != sizeof cni ||
2131 umove (tcp, (long) iov.tio_udatain, &cni) < 0)
2132 goto bad;
2133 tprintf (", in={node=%ld, len=%d}",
2134 cni.nodenum, cni.info_len);
2135 break;
John Hughes4e36a812001-04-18 15:11:51 +00002136 default:
John Hughes0aadba42001-10-16 18:19:52 +00002137 bad:
John Hughes4e36a812001-04-18 15:11:51 +00002138 if (iov.tio_udatainlen) {
2139 tprintf (", in=[/* %d bytes */]",
2140 iov.tio_udatainlen);
2141 }
2142 }
2143 }
2144 else {
John Hughes2d8b2c52001-10-18 14:52:24 +00002145 if (tcp->u_arg[1] != sizeof iov ||
2146 umove (tcp, tcp->u_arg[0], &iov) < 0)
2147 goto done;
John Hughes4e36a812001-04-18 15:11:51 +00002148 switch (iov.tio_id.id_cmd) {
John Hughes2d8b2c52001-10-18 14:52:24 +00002149 case SSISYS_CLUSTERNODE_INFO:
2150 if (iov.tio_udatainlen != sizeof cni ||
2151 umove (tcp, (long) iov.tio_udatain, &cni) < 0)
2152 goto bad_out;
2153 if (cni.info_len != sizeof info ||
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002154 iov.tio_udataoutlen != sizeof &info ||
John Hughes2d8b2c52001-10-18 14:52:24 +00002155 umove (tcp, (long) iov.tio_udataout, &info) < 0)
2156 goto bad_out;
2157 tprintf (", out={node=%ld, cpus=%d, online=%d}",
2158 info.node_num, info.node_totalcpus,
2159 info.node_onlinecpus);
2160 break;
2161
John Hughes4e36a812001-04-18 15:11:51 +00002162 default:
John Hughes2d8b2c52001-10-18 14:52:24 +00002163 bad_out:
John Hughes4e36a812001-04-18 15:11:51 +00002164 if (iov.tio_udataoutlen) {
2165 tprintf (", out=[/* %d bytes */]",
2166 iov.tio_udataoutlen);
2167 }
2168 }
John Hughes2d8b2c52001-10-18 14:52:24 +00002169 done:
John Hughes4e36a812001-04-18 15:11:51 +00002170 tprintf ("}, %ld", tcp->u_arg[1]);
2171 }
2172 return 0;
2173}
2174
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002175#endif
John Hughes4e36a812001-04-18 15:11:51 +00002176
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002177#endif /* UNIXWARE > 2 */
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002178
2179#ifdef MIPS
2180
Wichert Akkermand6b92492001-04-07 21:37:12 +00002181#ifndef __NEW_UTS_LEN
2182#define __NEW_UTS_LEN 64
2183#endif
2184
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002185static struct xlat sysmips_operations[] = {
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002186 { SETNAME, "SETNAME" },
2187 { FLUSH_CACHE, "FLUSH_CACHE" },
2188 { MIPS_FIXADE, "MIPS_FIXADE" },
2189 { MIPS_RDNVRAM, "MIPS_RDNVRAM" },
2190 { MIPS_ATOMIC_SET, "MIPS_ATOMIC_SET" },
2191 { 0, NULL }
2192};
2193
2194int sys_sysmips(tcp)
2195struct tcb *tcp;
2196{
2197 if (entering(tcp)) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002198 printxval(sysmips_operations, tcp->u_arg[0], "???");
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002199 if (!verbose(tcp)) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002200 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002201 } else if (tcp->u_arg[0]==SETNAME) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002202 char nodename[__NEW_UTS_LEN + 1];
2203 if (umovestr(tcp, tcp->u_arg[1], (__NEW_UTS_LEN + 1), nodename) < 0)
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002204 tprintf(", %#lx", tcp->u_arg[1]);
2205 else
2206 tprintf(", \"%s\"", nodename);
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002207 } else if (tcp->u_arg[0] == MIPS_ATOMIC_SET) {
2208 tprintf(", %#lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
2209 } else if (tcp->u_arg[0] == MIPS_FIXADE) {
2210 tprintf(", 0x%lx", tcp->u_arg[1]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002211 } else {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002212 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002213 }
2214 }
2215
2216 return 0;
2217}
2218
2219#endif /* MIPS */