blob: f16b711c6ef91b50fd87a1dfb8d00a0af929265c [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 Akkerman22fe9d21999-05-27 12:00:57 +000071#include <linux/sysctl.h>
Wichert Akkerman22fe9d21999-05-27 12:00:57 +000072
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000073static struct xlat mount_flags[] = {
74 { MS_RDONLY, "MS_RDONLY" },
75 { MS_NOSUID, "MS_NOSUID" },
76 { MS_NODEV, "MS_NODEV" },
77 { MS_NOEXEC, "MS_NOEXEC" },
78#ifdef MS_SYNCHRONOUS
79 { MS_SYNCHRONOUS,"MS_SYNCHRONOUS"},
80#else
81 { MS_SYNC, "MS_SYNC" },
82#endif
83 { MS_REMOUNT, "MS_REMOUNT" },
84 { 0, NULL },
85};
86
87int
88sys_mount(tcp)
89struct tcb *tcp;
90{
91 if (entering(tcp)) {
92 printpath(tcp, tcp->u_arg[0]);
93 tprintf(", ");
94 printpath(tcp, tcp->u_arg[1]);
95 tprintf(", ");
96 printpath(tcp, tcp->u_arg[2]);
97 tprintf(", ");
98 printflags(mount_flags, tcp->u_arg[3]);
99 tprintf(", %#lx", tcp->u_arg[4]);
100 }
101 return 0;
102}
103
Wichert Akkermandacfb6e1999-06-03 14:21:07 +0000104int
105sys_umount2(tcp)
106struct tcb *tcp;
107{
108 if (entering(tcp)) {
109 printstr(tcp, tcp->u_arg[0], -1);
110 tprintf(", ");
111 if (tcp->u_arg[1] & 1)
112 tprintf("MNT_FORCE");
113 else
114 tprintf("0");
115 }
116 return 0;
117}
118
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000119static struct xlat personality_options[] = {
120#ifdef PER_LINUX
121 { PER_LINUX, "PER_LINUX" },
122#endif
123#ifdef PER_LINUX_32BIT
124 { PER_LINUX_32BIT, "PER_LINUX" },
125#endif
126#ifdef PER_SVR4
127 { PER_SVR4, "PER_SVR4" },
128#endif
129#ifdef PER_SVR3
130 { PER_SVR3, "PER_SVR3" },
131#endif
132#ifdef PER_SCOSVR3
133 { PER_SCOSVR3, "PER_SCOSVR3" },
134#endif
135#ifdef PER_WYSEV386
136 { PER_WYSEV386, "PER_WYSEV386" },
137#endif
138#ifdef PER_ISCR4
139 { PER_ISCR4, "PER_ISCR4" },
140#endif
141#ifdef PER_BSD
142 { PER_BSD, "PER_BSD" },
143#endif
144#ifdef PER_XENIX
145 { PER_XENIX, "PER_XENIX" },
146#endif
147 { 0, NULL },
148};
149
150int
151sys_personality(tcp)
152struct tcb *tcp;
153{
154 if (entering(tcp))
155 printxval(personality_options, tcp->u_arg[0], "PER_???");
156 return 0;
157}
158
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000159#include <linux/reboot.h>
160static struct xlat bootflags1[] = {
161 { LINUX_REBOOT_MAGIC1, "LINUX_REBOOT_MAGIC1" },
162 { 0, NULL },
163};
164
165static struct xlat bootflags2[] = {
166 { LINUX_REBOOT_MAGIC2, "LINUX_REBOOT_MAGIC2" },
167 { LINUX_REBOOT_MAGIC2A, "LINUX_REBOOT_MAGIC2A" },
168 { LINUX_REBOOT_MAGIC2B, "LINUX_REBOOT_MAGIC2B" },
169 { 0, NULL },
170};
171
172static struct xlat bootflags3[] = {
173 { LINUX_REBOOT_CMD_CAD_OFF, "LINUX_REBOOT_CMD_CAD_OFF" },
174 { LINUX_REBOOT_CMD_RESTART, "LINUX_REBOOT_CMD_RESTART" },
175 { LINUX_REBOOT_CMD_HALT, "LINUX_REBOOT_CMD_HALT" },
176 { LINUX_REBOOT_CMD_CAD_ON, "LINUX_REBOOT_CMD_CAD_ON" },
177 { LINUX_REBOOT_CMD_POWER_OFF, "LINUX_REBOOT_CMD_POWER_OFF" },
178 { LINUX_REBOOT_CMD_RESTART2, "LINUX_REBOOT_CMD_RESTART2" },
179 { 0, NULL },
180};
181
182int
183sys_reboot(tcp)
184struct tcb *tcp;
185{
186 if (entering(tcp)) {
187 if (!printflags(bootflags1, tcp->u_arg[0]))
188 tprintf("LINUX_REBOOT_MAGIC???");
189 tprintf(", ");
190 if (!printflags(bootflags2, tcp->u_arg[1]))
191 tprintf("LINUX_REBOOT_MAGIC???");
192 tprintf(", ");
193 if (!printflags(bootflags3, tcp->u_arg[2]))
194 tprintf("LINUX_REBOOT_CMD_???");
195 if (tcp->u_arg[2] == LINUX_REBOOT_CMD_RESTART2) {
196 tprintf(", ");
197 printstr(tcp, tcp->u_arg[3], -1);
198 }
199 }
200 return 0;
201}
202
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000203#ifdef M68K
204static struct xlat cacheflush_scope[] = {
205#ifdef FLUSH_SCOPE_LINE
206 { FLUSH_SCOPE_LINE, "FLUSH_SCOPE_LINE" },
207#endif
208#ifdef FLUSH_SCOPE_PAGE
209 { FLUSH_SCOPE_PAGE, "FLUSH_SCOPE_PAGE" },
210#endif
211#ifdef FLUSH_SCOPE_ALL
212 { FLUSH_SCOPE_ALL, "FLUSH_SCOPE_ALL" },
213#endif
214 { 0, NULL },
215};
216
217static struct xlat cacheflush_flags[] = {
218#ifdef FLUSH_CACHE_BOTH
219 { FLUSH_CACHE_BOTH, "FLUSH_CACHE_BOTH" },
220#endif
221#ifdef FLUSH_CACHE_DATA
222 { FLUSH_CACHE_DATA, "FLUSH_CACHE_DATA" },
223#endif
224#ifdef FLUSH_CACHE_INSN
225 { FLUSH_CACHE_INSN, "FLUSH_CACHE_INSN" },
226#endif
227 { 0, NULL },
228};
229
230int
231sys_cacheflush(tcp)
232struct tcb *tcp;
233{
234 if (entering(tcp)) {
235 /* addr */
236 tprintf("%#lx, ", tcp->u_arg[0]);
237 /* scope */
238 printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
239 tprintf(", ");
240 /* flags */
241 printflags(cacheflush_flags, tcp->u_arg[2]);
242 /* len */
243 tprintf(", %lu", tcp->u_arg[3]);
244 }
245 return 0;
246}
247#endif /* M68K */
248
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000249#endif /* LINUX */
250
251#ifdef SUNOS4
252
253#include <sys/reboot.h>
254#define NFSCLIENT
255#define LOFS
256#define RFS
257#define PCFS
258#include <sys/mount.h>
259#include <sys/socket.h>
260#include <nfs/export.h>
261#include <rpc/types.h>
262#include <rpc/auth.h>
263
264/*ARGSUSED*/
265int
266sys_sync(tcp)
267struct tcb *tcp;
268{
269 return 0;
270}
271
272static struct xlat bootflags[] = {
273 { RB_AUTOBOOT, "RB_AUTOBOOT" }, /* for system auto-booting itself */
274 { RB_ASKNAME, "RB_ASKNAME" }, /* ask for file name to reboot from */
275 { RB_SINGLE, "RB_SINGLE" }, /* reboot to single user only */
276 { RB_NOSYNC, "RB_NOSYNC" }, /* dont sync before reboot */
277 { RB_HALT, "RB_HALT" }, /* don't reboot, just halt */
278 { RB_INITNAME, "RB_INITNAME" }, /* name given for /etc/init */
279 { RB_NOBOOTRC, "RB_NOBOOTRC" }, /* don't run /etc/rc.boot */
280 { RB_DEBUG, "RB_DEBUG" }, /* being run under debugger */
281 { RB_DUMP, "RB_DUMP" }, /* dump system core */
282 { RB_WRITABLE, "RB_WRITABLE" }, /* mount root read/write */
283 { RB_STRING, "RB_STRING" }, /* pass boot args to prom monitor */
284 { 0, NULL },
285};
286
287int
288sys_reboot(tcp)
289struct tcb *tcp;
290{
291 if (entering(tcp)) {
292 if (!printflags(bootflags, tcp->u_arg[0]))
293 tprintf("RB_???");
294 if (tcp->u_arg[0] & RB_STRING) {
295 printstr(tcp, tcp->u_arg[1], -1);
296 }
297 }
298 return 0;
299}
300
301int
302sys_sysacct(tcp)
303struct tcb *tcp;
304{
305 if (entering(tcp)) {
306 printstr(tcp, tcp->u_arg[0], -1);
307 }
308 return 0;
309}
310
311int
312sys_swapon(tcp)
313struct tcb *tcp;
314{
315 if (entering(tcp)) {
316 printstr(tcp, tcp->u_arg[0], -1);
317 }
318 return 0;
319}
320
321int
322sys_nfs_svc(tcp)
323struct tcb *tcp;
324{
325 if (entering(tcp)) {
326 printsock(tcp, tcp->u_arg[0]);
327 }
328 return 0;
329}
330
331static struct xlat mountflags[] = {
332 { M_RDONLY, "M_RDONLY" },
333 { M_NOSUID, "M_NOSUID" },
334 { M_NEWTYPE, "M_NEWTYPE" },
335 { M_GRPID, "M_GRPID" },
336#ifdef M_REMOUNT
337 { M_REMOUNT, "M_REMOUNT" },
338#endif
339#ifdef M_NOSUB
340 { M_NOSUB, "M_NOSUB" },
341#endif
342#ifdef M_MULTI
343 { M_MULTI, "M_MULTI" },
344#endif
345#ifdef M_SYS5
346 { M_SYS5, "M_SYS5" },
347#endif
348 { 0, NULL },
349};
350
351static struct xlat nfsflags[] = {
352 { NFSMNT_SOFT, "NFSMNT_SOFT" },
353 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
354 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
355 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
356 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
357 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
358 { NFSMNT_INT, "NFSMNT_INT" },
359 { NFSMNT_NOAC, "NFSMNT_NOAC" },
360 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
361 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
362 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
363 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
364#ifdef NFSMNT_SECURE
365 { NFSMNT_SECURE, "NFSMNT_SECURE" },
366#endif
367#ifdef NFSMNT_NOCTO
368 { NFSMNT_NOCTO, "NFSMNT_NOCTO" },
369#endif
370#ifdef NFSMNT_POSIX
371 { NFSMNT_POSIX, "NFSMNT_POSIX" },
372#endif
373 { 0, NULL },
374};
375
376int
377sys_mount(tcp)
378struct tcb *tcp;
379{
380 char type[4];
381
382 if (entering(tcp)) {
383 if (!(tcp->u_arg[2] & M_NEWTYPE) || umovestr(tcp,
384 tcp->u_arg[0], sizeof type, type) < 0) {
385 tprintf("OLDTYPE:#%lx", tcp->u_arg[0]);
386 } else {
387 tprintf("\"%s\", ", type);
388 }
389 printstr(tcp, tcp->u_arg[1], -1);
390 tprintf(", ");
391 if (!printflags(mountflags, tcp->u_arg[2] & ~M_NEWTYPE))
392 tprintf("0");
393 tprintf(", ");
394
395 if (strcmp(type, "4.2") == 0) {
396 struct ufs_args a;
397 if (umove(tcp, tcp->u_arg[3], &a) < 0)
398 return 0;
399 printstr(tcp, (int)a.fspec, -1);
400 } else if (strcmp(type, "lo") == 0) {
401 struct lo_args a;
402 if (umove(tcp, tcp->u_arg[3], &a) < 0)
403 return 0;
404 printstr(tcp, (int)a.fsdir, -1);
405 } else if (strcmp(type, "nfs") == 0) {
406 struct nfs_args a;
407 if (umove(tcp, tcp->u_arg[3], &a) < 0)
408 return 0;
409 tprintf("[");
410 printsock(tcp, (int) a.addr);
411 tprintf(", ");
412 if (!printflags(nfsflags, a.flags))
413 tprintf("NFSMNT_???");
414 tprintf(", ws:%u,rs:%u,to:%u,re:%u,",
415 a.wsize, a.rsize, a.timeo, a.retrans);
416 if (a.flags & NFSMNT_HOSTNAME && a.hostname)
417 printstr(tcp, (int)a.hostname, -1);
418 else
419 tprintf("%#lx", (unsigned long) a.hostname);
420 tprintf(",reg-min:%u,max:%u,dir-min:%u,max:%u,",
421 a.acregmin, a.acregmax, a.acdirmin, a.acdirmax);
422 if ((a.flags & NFSMNT_SECURE) && a.netname)
423 printstr(tcp, (int) a.netname, -1);
424 else
425 tprintf("%#lx", (unsigned long) a.netname);
426 tprintf("]");
427 } else if (strcmp(type, "rfs") == 0) {
428 struct rfs_args a;
429 struct token t;
430 if (umove(tcp, tcp->u_arg[3], &a) < 0)
431 return 0;
432 tprintf("[");
433 printstr(tcp, (int)a.rmtfs, -1);
434 if (umove(tcp, (int)a.token, &t) < 0)
435 return 0;
436 tprintf(", %u, %s]", t.t_id, t.t_uname);
437 } else if (strcmp(type, "pcfs") == 0) {
438 struct pc_args a;
439 if (umove(tcp, tcp->u_arg[3], &a) < 0)
440 return 0;
441 printstr(tcp, (int)a.fspec, -1);
442 }
443 }
444 return 0;
445}
446
447int
448sys_unmount(tcp)
449struct tcb *tcp;
450{
451 if (entering(tcp)) {
452 printstr(tcp, tcp->u_arg[0], -1);
453 }
454 return 0;
455}
456
457int
458sys_umount(tcp)
459struct tcb *tcp;
460{
461 return sys_unmount(tcp);
462}
463
464int
465sys_auditsys(tcp)
466struct tcb *tcp;
467{
468 /* XXX - no information available */
469 return printargs(tcp);
470}
471
472static struct xlat ex_auth_flags[] = {
473 { AUTH_UNIX, "AUTH_UNIX" },
474 { AUTH_DES, "AUTH_DES" },
475 { 0, NULL },
476};
477
478int
479sys_exportfs(tcp)
480struct tcb *tcp;
481{
482 struct export e;
483 int i;
484
485 if (entering(tcp)) {
486 printstr(tcp, tcp->u_arg[0], -1);
487 if (umove(tcp, tcp->u_arg[1], &e) < 0) {
488 tprintf("%#lx", tcp->u_arg[1]);
489 return 0;
490 }
491 tprintf("{fl:%u, anon:%u, ", e.ex_flags, e.ex_anon);
492 printxval(ex_auth_flags, e.ex_auth, "AUTH_???");
493 tprintf(", roots:[");
494 if (e.ex_auth == AUTH_UNIX) {
495 for (i=0; i<e.ex_u.exunix.rootaddrs.naddrs; i++) {
496 printsock(tcp,
497 (int)&e.ex_u.exunix.rootaddrs.addrvec[i]);
498 }
499 tprintf("], writers:[");
500 for (i=0; i<e.ex_writeaddrs.naddrs; i++) {
501 printsock(tcp,
502 (int)&e.ex_writeaddrs.addrvec[i]);
503 }
504 tprintf("]");
505 } else {
506 for (i=0; i<e.ex_u.exdes.nnames; i++) {
507 printsock(tcp,
508 (int)&e.ex_u.exdes.rootnames[i]);
509 tprintf(", ");
510 }
511 tprintf("], window:%u", e.ex_u.exdes.window);
512 }
513 tprintf("}");
514 }
515 return 0;
516}
517
518static struct xlat sysconflimits[] = {
519#ifdef _SC_ARG_MAX
520 { _SC_ARG_MAX, "_SC_ARG_MAX" }, /* space for argv & envp */
521#endif
522#ifdef _SC_CHILD_MAX
523 { _SC_CHILD_MAX, "_SC_CHILD_MAX" }, /* maximum children per process??? */
524#endif
525#ifdef _SC_CLK_TCK
526 { _SC_CLK_TCK, "_SC_CLK_TCK" }, /* clock ticks/sec */
527#endif
528#ifdef _SC_NGROUPS_MAX
529 { _SC_NGROUPS_MAX, "_SC_NGROUPS_MAX" }, /* number of groups if multple supp. */
530#endif
531#ifdef _SC_OPEN_MAX
532 { _SC_OPEN_MAX, "_SC_OPEN_MAX" }, /* max open files per process */
533#endif
534#ifdef _SC_JOB_CONTROL
535 { _SC_JOB_CONTROL, "_SC_JOB_CONTROL" }, /* do we have job control */
536#endif
537#ifdef _SC_SAVED_IDS
538 { _SC_SAVED_IDS, "_SC_SAVED_IDS" }, /* do we have saved uid/gids */
539#endif
540#ifdef _SC_VERSION
541 { _SC_VERSION, "_SC_VERSION" }, /* POSIX version supported */
542#endif
543 { 0, NULL },
544};
545
546static struct xlat pathconflimits[] = {
547#ifdef _PC_LINK_MAX
548 { _PC_LINK_MAX, "_PC_LINK_MAX" }, /* max links to file/dir */
549#endif
550#ifdef _PC_MAX_CANON
551 { _PC_MAX_CANON, "_PC_MAX_CANON" }, /* max line length */
552#endif
553#ifdef _PC_MAX_INPUT
554 { _PC_MAX_INPUT, "_PC_MAX_INPUT" }, /* max "packet" to a tty device */
555#endif
556#ifdef _PC_NAME_MAX
557 { _PC_NAME_MAX, "_PC_NAME_MAX" }, /* max pathname component length */
558#endif
559#ifdef _PC_PATH_MAX
560 { _PC_PATH_MAX, "_PC_PATH_MAX" }, /* max pathname length */
561#endif
562#ifdef _PC_PIPE_BUF
563 { _PC_PIPE_BUF, "_PC_PIPE_BUF" }, /* size of a pipe */
564#endif
565#ifdef _PC_CHOWN_RESTRICTED
566 { _PC_CHOWN_RESTRICTED, "_PC_CHOWN_RESTRICTED" }, /* can we give away files */
567#endif
568#ifdef _PC_NO_TRUNC
569 { _PC_NO_TRUNC, "_PC_NO_TRUNC" }, /* trunc or error on >NAME_MAX */
570#endif
571#ifdef _PC_VDISABLE
572 { _PC_VDISABLE, "_PC_VDISABLE" }, /* best char to shut off tty c_cc */
573#endif
574 { 0, NULL },
575};
576
577int
578sys_sysconf(tcp)
579struct tcb *tcp;
580{
581 if (entering(tcp)) {
582 printxval(sysconflimits, tcp->u_arg[0], "_SC_???");
583 }
584 return 0;
585}
586
587int
588sys_pathconf(tcp)
589struct tcb *tcp;
590{
591 if (entering(tcp)) {
592 printstr(tcp, tcp->u_arg[0], -1);
593 tprintf(", ");
594 printxval(pathconflimits, tcp->u_arg[1], "_SC_???");
595 }
596 return 0;
597}
598
599int
600sys_fpathconf(tcp)
601struct tcb *tcp;
602{
603 if (entering(tcp)) {
604 tprintf("%lu, ", tcp->u_arg[0]);
605 printxval(pathconflimits, tcp->u_arg[1], "_SC_???");
606 }
607 return 0;
608}
609
610#endif /* SUNOS4 */
611
612#ifdef SVR4
613
614#ifdef HAVE_SYS_SYSCONFIG_H
615#include <sys/sysconfig.h>
616#endif /* HAVE_SYS_SYSCONFIG_H */
617
618#include <sys/mount.h>
619#include <sys/systeminfo.h>
620#include <sys/utsname.h>
621
622static struct xlat sysconfig_options[] = {
623#ifdef _CONFIG_NGROUPS
624 { _CONFIG_NGROUPS, "_CONFIG_NGROUPS" },
625#endif
626#ifdef _CONFIG_CHILD_MAX
627 { _CONFIG_CHILD_MAX, "_CONFIG_CHILD_MAX" },
628#endif
629#ifdef _CONFIG_OPEN_FILES
630 { _CONFIG_OPEN_FILES, "_CONFIG_OPEN_FILES" },
631#endif
632#ifdef _CONFIG_POSIX_VER
633 { _CONFIG_POSIX_VER, "_CONFIG_POSIX_VER" },
634#endif
635#ifdef _CONFIG_PAGESIZE
636 { _CONFIG_PAGESIZE, "_CONFIG_PAGESIZE" },
637#endif
638#ifdef _CONFIG_CLK_TCK
639 { _CONFIG_CLK_TCK, "_CONFIG_CLK_TCK" },
640#endif
641#ifdef _CONFIG_XOPEN_VER
642 { _CONFIG_XOPEN_VER, "_CONFIG_XOPEN_VER" },
643#endif
644#ifdef _CONFIG_PROF_TCK
645 { _CONFIG_PROF_TCK, "_CONFIG_PROF_TCK" },
646#endif
647#ifdef _CONFIG_NPROC_CONF
648 { _CONFIG_NPROC_CONF, "_CONFIG_NPROC_CONF" },
649#endif
650#ifdef _CONFIG_NPROC_ONLN
651 { _CONFIG_NPROC_ONLN, "_CONFIG_NPROC_ONLN" },
652#endif
653#ifdef _CONFIG_AIO_LISTIO_MAX
654 { _CONFIG_AIO_LISTIO_MAX, "_CONFIG_AIO_LISTIO_MAX" },
655#endif
656#ifdef _CONFIG_AIO_MAX
657 { _CONFIG_AIO_MAX, "_CONFIG_AIO_MAX" },
658#endif
659#ifdef _CONFIG_AIO_PRIO_DELTA_MAX
660 { _CONFIG_AIO_PRIO_DELTA_MAX, "_CONFIG_AIO_PRIO_DELTA_MAX" },
661#endif
662#ifdef _CONFIG_CONFIG_DELAYTIMER_MAX
663 { _CONFIG_DELAYTIMER_MAX, "_CONFIG_DELAYTIMER_MAX" },
664#endif
665#ifdef _CONFIG_MQ_OPEN_MAX
666 { _CONFIG_MQ_OPEN_MAX, "_CONFIG_MQ_OPEN_MAX" },
667#endif
668#ifdef _CONFIG_MQ_PRIO_MAX
669 { _CONFIG_MQ_PRIO_MAX, "_CONFIG_MQ_PRIO_MAX" },
670#endif
671#ifdef _CONFIG_RTSIG_MAX
672 { _CONFIG_RTSIG_MAX, "_CONFIG_RTSIG_MAX" },
673#endif
674#ifdef _CONFIG_SEM_NSEMS_MAX
675 { _CONFIG_SEM_NSEMS_MAX, "_CONFIG_SEM_NSEMS_MAX" },
676#endif
677#ifdef _CONFIG_SEM_VALUE_MAX
678 { _CONFIG_SEM_VALUE_MAX, "_CONFIG_SEM_VALUE_MAX" },
679#endif
680#ifdef _CONFIG_SIGQUEUE_MAX
681 { _CONFIG_SIGQUEUE_MAX, "_CONFIG_SIGQUEUE_MAX" },
682#endif
683#ifdef _CONFIG_SIGRT_MIN
684 { _CONFIG_SIGRT_MIN, "_CONFIG_SIGRT_MIN" },
685#endif
686#ifdef _CONFIG_SIGRT_MAX
687 { _CONFIG_SIGRT_MAX, "_CONFIG_SIGRT_MAX" },
688#endif
689#ifdef _CONFIG_TIMER_MAX
690 { _CONFIG_TIMER_MAX, "_CONFIG_TIMER_MAX" },
691#endif
692#ifdef _CONFIG_CONFIG_PHYS_PAGES
693 { _CONFIG_PHYS_PAGES, "_CONFIG_PHYS_PAGES" },
694#endif
695#ifdef _CONFIG_AVPHYS_PAGES
696 { _CONFIG_AVPHYS_PAGES, "_CONFIG_AVPHYS_PAGES" },
697#endif
698 { 0, NULL },
699};
700
701int
702sys_sysconfig(tcp)
703struct tcb *tcp;
704{
705 if (entering(tcp))
706 printxval(sysconfig_options, tcp->u_arg[0], "_CONFIG_???");
707 return 0;
708}
709
710static struct xlat sysinfo_options[] = {
711 { SI_SYSNAME, "SI_SYSNAME" },
712 { SI_HOSTNAME, "SI_HOSTNAME" },
713 { SI_RELEASE, "SI_RELEASE" },
714 { SI_VERSION, "SI_VERSION" },
715 { SI_MACHINE, "SI_MACHINE" },
716 { SI_ARCHITECTURE, "SI_ARCHITECTURE" },
717 { SI_HW_SERIAL, "SI_HW_SERIAL" },
718 { SI_HW_PROVIDER, "SI_HW_PROVIDER" },
719 { SI_SRPC_DOMAIN, "SI_SRPC_DOMAIN" },
720#ifdef SI_SET_HOSTNAME
721 { SI_SET_HOSTNAME, "SI_SET_HOSTNAME" },
722#endif
723#ifdef SI_SET_SRPC_DOMAIN
724 { SI_SET_SRPC_DOMAIN, "SI_SET_SRPC_DOMAIN" },
725#endif
726#ifdef SI_SET_KERB_REALM
727 { SI_SET_KERB_REALM, "SI_SET_KERB_REALM" },
728#endif
729#ifdef SI_KERB_REALM
730 { SI_KERB_REALM, "SI_KERB_REALM" },
731#endif
732 { 0, NULL },
733};
734
735int
736sys_sysinfo(tcp)
737struct tcb *tcp;
738{
739 if (entering(tcp)) {
740 printxval(sysinfo_options, tcp->u_arg[0], "SI_???");
741 tprintf(", ");
742 }
743 else {
744 /* Technically some calls write values. So what. */
745 if (syserror(tcp))
746 tprintf("%#lx", tcp->u_arg[1]);
747 else
748 printpath(tcp, tcp->u_arg[1]);
749 tprintf(", %lu", tcp->u_arg[2]);
750 }
751 return 0;
752}
753
754#ifdef MIPS
755
756#include <sys/syssgi.h>
757
758static struct xlat syssgi_options[] = {
759 { SGI_SYSID, "SGI_SYSID" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000760#ifdef SGI_RDUBLK
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000761 { SGI_RDUBLK, "SGI_RDUBLK" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000762#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000763 { SGI_TUNE, "SGI_TUNE" },
764 { SGI_IDBG, "SGI_IDBG" },
765 { SGI_INVENT, "SGI_INVENT" },
766 { SGI_RDNAME, "SGI_RDNAME" },
767 { SGI_SETLED, "SGI_SETLED" },
768 { SGI_SETNVRAM, "SGI_SETNVRAM" },
769 { SGI_GETNVRAM, "SGI_GETNVRAM" },
770 { SGI_QUERY_FTIMER, "SGI_QUERY_FTIMER" },
771 { SGI_QUERY_CYCLECNTR, "SGI_QUERY_CYCLECNTR" },
772 { SGI_PROCSZ, "SGI_PROCSZ" },
773 { SGI_SIGACTION, "SGI_SIGACTION" },
774 { SGI_SIGPENDING, "SGI_SIGPENDING" },
775 { SGI_SIGPROCMASK, "SGI_SIGPROCMASK" },
776 { SGI_SIGSUSPEND, "SGI_SIGSUSPEND" },
777 { SGI_SETSID, "SGI_SETSID" },
778 { SGI_SETPGID, "SGI_SETPGID" },
779 { SGI_SYSCONF, "SGI_SYSCONF" },
780 { SGI_WAIT4, "SGI_WAIT4" },
781 { SGI_PATHCONF, "SGI_PATHCONF" },
782 { SGI_READB, "SGI_READB" },
783 { SGI_WRITEB, "SGI_WRITEB" },
784 { SGI_SETGROUPS, "SGI_SETGROUPS" },
785 { SGI_GETGROUPS, "SGI_GETGROUPS" },
786 { SGI_SETTIMEOFDAY, "SGI_SETTIMEOFDAY" },
787 { SGI_SETTIMETRIM, "SGI_SETTIMETRIM" },
788 { SGI_GETTIMETRIM, "SGI_GETTIMETRIM" },
789 { SGI_SPROFIL, "SGI_SPROFIL" },
790 { SGI_RUSAGE, "SGI_RUSAGE" },
791 { SGI_SIGSTACK, "SGI_SIGSTACK" },
792 { SGI_SIGSTATUS, "SGI_SIGSTATUS" },
793 { SGI_NETPROC, "SGI_NETPROC" },
794 { SGI_SIGALTSTACK, "SGI_SIGALTSTACK" },
795 { SGI_BDFLUSHCNT, "SGI_BDFLUSHCNT" },
796 { SGI_SSYNC, "SGI_SSYNC" },
797 { SGI_NFSCNVT, "SGI_NFSCNVT" },
798 { SGI_GETPGID, "SGI_GETPGID" },
799 { SGI_GETSID, "SGI_GETSID" },
800 { SGI_IOPROBE, "SGI_IOPROBE" },
801 { SGI_CONFIG, "SGI_CONFIG" },
802 { SGI_ELFMAP, "SGI_ELFMAP" },
803 { SGI_MCONFIG, "SGI_MCONFIG" },
804 { SGI_GETPLABEL, "SGI_GETPLABEL" },
805 { SGI_SETPLABEL, "SGI_SETPLABEL" },
806 { SGI_GETLABEL, "SGI_GETLABEL" },
807 { SGI_SETLABEL, "SGI_SETLABEL" },
808 { SGI_SATREAD, "SGI_SATREAD" },
809 { SGI_SATWRITE, "SGI_SATWRITE" },
810 { SGI_SATCTL, "SGI_SATCTL" },
811 { SGI_LOADATTR, "SGI_LOADATTR" },
812 { SGI_UNLOADATTR, "SGI_UNLOADATTR" },
813#ifdef SGI_RECVLMSG
814 { SGI_RECVLMSG, "SGI_RECVLMSG" },
815#endif
816 { SGI_PLANGMOUNT, "SGI_PLANGMOUNT" },
817 { SGI_GETPSOACL, "SGI_GETPSOACL" },
818 { SGI_SETPSOACL, "SGI_SETPSOACL" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000819#ifdef SGI_EAG_GET_ATTR
820 { SGI_EAG_GET_ATTR, "SGI_EAG_GET_ATTR" },
821#endif
822#ifdef SGI_EAG_SET_ATTR
823 { SGI_EAG_SET_ATTR, "SGI_EAG_SET_ATTR" },
824#endif
825#ifdef SGI_EAG_GET_PROCATTR
826 { SGI_EAG_GET_PROCATTR, "SGI_EAG_GET_PROCATTR" },
827#endif
828#ifdef SGI_EAG_SET_PROCATTR
829 { SGI_EAG_SET_PROCATTR, "SGI_EAG_SET_PROCATTR" },
830#endif
831#ifdef SGI_FREVOKE
832 { SGI_FREVOKE, "SGI_FREVOKE" },
833#endif
834#ifdef SGI_SBE_GET_INFO
835 { SGI_SBE_GET_INFO, "SGI_SBE_GET_INFO" },
836#endif
837#ifdef SGI_SBE_CLR_INFO
838 { SGI_SBE_CLR_INFO, "SGI_SBE_CLR_INFO" },
839#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000840 { SGI_RMI_FIXECC, "SGI_RMI_FIXECC" },
841 { SGI_R4K_CERRS, "SGI_R4K_CERRS" },
842 { SGI_GET_EVCONF, "SGI_GET_EVCONF" },
843 { SGI_MPCWAROFF, "SGI_MPCWAROFF" },
844 { SGI_SET_AUTOPWRON, "SGI_SET_AUTOPWRON" },
845 { SGI_SPIPE, "SGI_SPIPE" },
846 { SGI_SYMTAB, "SGI_SYMTAB" },
847#ifdef SGI_SET_FPDEBUG
848 { SGI_SET_FPDEBUG, "SGI_SET_FPDEBUG" },
849#endif
Wichert Akkerman8829a551999-06-11 13:18:40 +0000850#ifdef SGI_SET_FP_PRECISE
851 { SGI_SET_FP_PRECISE, "SGI_SET_FP_PRECISE" },
852#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000853 { SGI_TOSSTSAVE, "SGI_TOSSTSAVE" },
854 { SGI_FDHI, "SGI_FDHI" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000855#ifdef SGI_SET_CONFIG_SMM
856 { SGI_SET_CONFIG_SMM, "SGI_SET_CONFIG_SMM" },
857#endif
858#ifdef SGI_SET_FP_PRESERVE
859 { SGI_SET_FP_PRESERVE, "SGI_SET_FP_PRESERVE" },
860#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000861 { SGI_MINRSS, "SGI_MINRSS" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000862#ifdef SGI_GRIO
863 { SGI_GRIO, "SGI_GRIO" },
864#endif
865#ifdef SGI_XLV_SET_TAB
866 { SGI_XLV_SET_TAB, "SGI_XLV_SET_TAB" },
867#endif
868#ifdef SGI_XLV_GET_TAB
869 { SGI_XLV_GET_TAB, "SGI_XLV_GET_TAB" },
870#endif
871#ifdef SGI_GET_FP_PRECISE
872 { SGI_GET_FP_PRECISE, "SGI_GET_FP_PRECISE" },
873#endif
874#ifdef SGI_GET_CONFIG_SMM
875 { SGI_GET_CONFIG_SMM, "SGI_GET_CONFIG_SMM" },
876#endif
877#ifdef SGI_FP_IMPRECISE_SUPP
878 { SGI_FP_IMPRECISE_SUPP,"SGI_FP_IMPRECISE_SUPP" },
879#endif
880#ifdef SGI_CONFIG_NSMM_SUPP
881 { SGI_CONFIG_NSMM_SUPP, "SGI_CONFIG_NSMM_SUPP" },
882#endif
883#ifdef SGI_RT_TSTAMP_CREATE
884 { SGI_RT_TSTAMP_CREATE, "SGI_RT_TSTAMP_CREATE" },
885#endif
886#ifdef SGI_RT_TSTAMP_DELETE
887 { SGI_RT_TSTAMP_DELETE, "SGI_RT_TSTAMP_DELETE" },
888#endif
889#ifdef SGI_RT_TSTAMP_START
890 { SGI_RT_TSTAMP_START, "SGI_RT_TSTAMP_START" },
891#endif
892#ifdef SGI_RT_TSTAMP_STOP
893 { SGI_RT_TSTAMP_STOP, "SGI_RT_TSTAMP_STOP" },
894#endif
895#ifdef SGI_RT_TSTAMP_ADDR
896 { SGI_RT_TSTAMP_ADDR, "SGI_RT_TSTAMP_ADDR" },
897#endif
898#ifdef SGI_RT_TSTAMP_MASK
899 { SGI_RT_TSTAMP_MASK, "SGI_RT_TSTAMP_MASK" },
900#endif
901#ifdef SGI_RT_TSTAMP_EOB_MODE
902 { SGI_RT_TSTAMP_EOB_MODE,"SGI_RT_TSTAMP_EOB_MODE"},
903#endif
904#ifdef SGI_USE_FP_BCOPY
905 { SGI_USE_FP_BCOPY, "SGI_USE_FP_BCOPY" },
906#endif
907#ifdef SGI_GET_UST
908 { SGI_GET_UST, "SGI_GET_UST" },
909#endif
910#ifdef SGI_SPECULATIVE_EXEC
911 { SGI_SPECULATIVE_EXEC, "SGI_SPECULATIVE_EXEC" },
912#endif
913#ifdef SGI_XLV_NEXT_RQST
914 { SGI_XLV_NEXT_RQST, "SGI_XLV_NEXT_RQST" },
915#endif
916#ifdef SGI_XLV_ATTR_CURSOR
917 { SGI_XLV_ATTR_CURSOR, "SGI_XLV_ATTR_CURSOR" },
918#endif
919#ifdef SGI_XLV_ATTR_GET
920 { SGI_XLV_ATTR_GET, "SGI_XLV_ATTR_GET" },
921#endif
922#ifdef SGI_XLV_ATTR_SET
923 { SGI_XLV_ATTR_SET, "SGI_XLV_ATTR_SET" },
924#endif
925#ifdef SGI_BTOOLSIZE
926 { SGI_BTOOLSIZE, "SGI_BTOOLSIZE" },
927#endif
928#ifdef SGI_BTOOLGET
929 { SGI_BTOOLGET, "SGI_BTOOLGET" },
930#endif
931#ifdef SGI_BTOOLREINIT
932 { SGI_BTOOLREINIT, "SGI_BTOOLREINIT" },
933#endif
934#ifdef SGI_CREATE_UUID
935 { SGI_CREATE_UUID, "SGI_CREATE_UUID" },
936#endif
937#ifdef SGI_NOFPE
938 { SGI_NOFPE, "SGI_NOFPE" },
939#endif
940#ifdef SGI_OLD_SOFTFP
941 { SGI_OLD_SOFTFP, "SGI_OLD_SOFTFP" },
942#endif
943#ifdef SGI_FS_INUMBERS
944 { SGI_FS_INUMBERS, "SGI_FS_INUMBERS" },
945#endif
946#ifdef SGI_FS_BULKSTAT
947 { SGI_FS_BULKSTAT, "SGI_FS_BULKSTAT" },
948#endif
949#ifdef SGI_RT_TSTAMP_WAIT
950 { SGI_RT_TSTAMP_WAIT, "SGI_RT_TSTAMP_WAIT" },
951#endif
952#ifdef SGI_RT_TSTAMP_UPDATE
953 { SGI_RT_TSTAMP_UPDATE, "SGI_RT_TSTAMP_UPDATE" },
954#endif
955#ifdef SGI_PATH_TO_HANDLE
956 { SGI_PATH_TO_HANDLE, "SGI_PATH_TO_HANDLE" },
957#endif
958#ifdef SGI_PATH_TO_FSHANDLE
959 { SGI_PATH_TO_FSHANDLE, "SGI_PATH_TO_FSHANDLE" },
960#endif
961#ifdef SGI_FD_TO_HANDLE
962 { SGI_FD_TO_HANDLE, "SGI_FD_TO_HANDLE" },
963#endif
964#ifdef SGI_OPEN_BY_HANDLE
965 { SGI_OPEN_BY_HANDLE, "SGI_OPEN_BY_HANDLE" },
966#endif
967#ifdef SGI_READLINK_BY_HANDLE
968 { SGI_READLINK_BY_HANDLE,"SGI_READLINK_BY_HANDLE"},
969#endif
970#ifdef SGI_READ_DANGID
971 { SGI_READ_DANGID, "SGI_READ_DANGID" },
972#endif
973#ifdef SGI_CONST
974 { SGI_CONST, "SGI_CONST" },
975#endif
976#ifdef SGI_XFS_FSOPERATIONS
977 { SGI_XFS_FSOPERATIONS, "SGI_XFS_FSOPERATIONS" },
978#endif
979#ifdef SGI_SETASH
980 { SGI_SETASH, "SGI_SETASH" },
981#endif
982#ifdef SGI_GETASH
983 { SGI_GETASH, "SGI_GETASH" },
984#endif
985#ifdef SGI_SETPRID
986 { SGI_SETPRID, "SGI_SETPRID" },
987#endif
988#ifdef SGI_GETPRID
989 { SGI_GETPRID, "SGI_GETPRID" },
990#endif
991#ifdef SGI_SETSPINFO
992 { SGI_SETSPINFO, "SGI_SETSPINFO" },
993#endif
994#ifdef SGI_GETSPINFO
995 { SGI_GETSPINFO, "SGI_GETSPINFO" },
996#endif
997#ifdef SGI_SHAREII
998 { SGI_SHAREII, "SGI_SHAREII" },
999#endif
1000#ifdef SGI_NEWARRAYSESS
1001 { SGI_NEWARRAYSESS, "SGI_NEWARRAYSESS" },
1002#endif
1003#ifdef SGI_GETDFLTPRID
1004 { SGI_GETDFLTPRID, "SGI_GETDFLTPRID" },
1005#endif
1006#ifdef SGI_SET_DISMISSED_EXC_CNT
1007 { SGI_SET_DISMISSED_EXC_CNT,"SGI_SET_DISMISSED_EXC_CNT" },
1008#endif
1009#ifdef SGI_GET_DISMISSED_EXC_CNT
1010 { SGI_GET_DISMISSED_EXC_CNT,"SGI_GET_DISMISSED_EXC_CNT" },
1011#endif
1012#ifdef SGI_CYCLECNTR_SIZE
1013 { SGI_CYCLECNTR_SIZE, "SGI_CYCLECNTR_SIZE" },
1014#endif
1015#ifdef SGI_QUERY_FASTTIMER
1016 { SGI_QUERY_FASTTIMER, "SGI_QUERY_FASTTIMER" },
1017#endif
1018#ifdef SGI_PIDSINASH
1019 { SGI_PIDSINASH, "SGI_PIDSINASH" },
1020#endif
1021#ifdef SGI_ULI
1022 { SGI_ULI, "SGI_ULI" },
1023#endif
1024#ifdef SGI_LPG_SHMGET
1025 { SGI_LPG_SHMGET, "SGI_LPG_SHMGET" },
1026#endif
1027#ifdef SGI_LPG_MAP
1028 { SGI_LPG_MAP, "SGI_LPG_MAP" },
1029#endif
1030#ifdef SGI_CACHEFS_SYS
1031 { SGI_CACHEFS_SYS, "SGI_CACHEFS_SYS" },
1032#endif
1033#ifdef SGI_NFSNOTIFY
1034 { SGI_NFSNOTIFY, "SGI_NFSNOTIFY" },
1035#endif
1036#ifdef SGI_LOCKDSYS
1037 { SGI_LOCKDSYS, "SGI_LOCKDSYS" },
1038#endif
1039#ifdef SGI_EVENTCTR
1040 { SGI_EVENTCTR, "SGI_EVENTCTR" },
1041#endif
1042#ifdef SGI_GETPRUSAGE
1043 { SGI_GETPRUSAGE, "SGI_GETPRUSAGE" },
1044#endif
1045#ifdef SGI_PROCMASK_LOCATION
1046 { SGI_PROCMASK_LOCATION,"SGI_PROCMASK_LOCATION" },
1047#endif
1048#ifdef SGI_UNUSED
1049 { SGI_UNUSED, "SGI_UNUSED" },
1050#endif
1051#ifdef SGI_CKPT_SYS
1052 { SGI_CKPT_SYS, "SGI_CKPT_SYS" },
1053#endif
1054#ifdef SGI_CKPT_SYS
1055 { SGI_CKPT_SYS, "SGI_CKPT_SYS" },
1056#endif
1057#ifdef SGI_GETGRPPID
1058 { SGI_GETGRPPID, "SGI_GETGRPPID" },
1059#endif
1060#ifdef SGI_GETSESPID
1061 { SGI_GETSESPID, "SGI_GETSESPID" },
1062#endif
1063#ifdef SGI_ENUMASHS
1064 { SGI_ENUMASHS, "SGI_ENUMASHS" },
1065#endif
1066#ifdef SGI_SETASMACHID
1067 { SGI_SETASMACHID, "SGI_SETASMACHID" },
1068#endif
1069#ifdef SGI_GETASMACHID
1070 { SGI_GETASMACHID, "SGI_GETASMACHID" },
1071#endif
1072#ifdef SGI_GETARSESS
1073 { SGI_GETARSESS, "SGI_GETARSESS" },
1074#endif
1075#ifdef SGI_JOINARRAYSESS
1076 { SGI_JOINARRAYSESS, "SGI_JOINARRAYSESS" },
1077#endif
1078#ifdef SGI_SPROC_KILL
1079 { SGI_SPROC_KILL, "SGI_SPROC_KILL" },
1080#endif
1081#ifdef SGI_DBA_CONFIG
1082 { SGI_DBA_CONFIG, "SGI_DBA_CONFIG" },
1083#endif
1084#ifdef SGI_RELEASE_NAME
1085 { SGI_RELEASE_NAME, "SGI_RELEASE_NAME" },
1086#endif
1087#ifdef SGI_SYNCH_CACHE_HANDLER
1088 { SGI_SYNCH_CACHE_HANDLER,"SGI_SYNCH_CACHE_HANDLER"},
1089#endif
1090#ifdef SGI_SWASH_INIT
1091 { SGI_SWASH_INIT, "SGI_SWASH_INIT" },
1092#endif
1093#ifdef SGI_NUMA_MIGR_PAGE
1094 { SGI_NUMA_MIGR_PAGE, "SGI_NUMA_MIGR_PAGE" },
1095#endif
1096#ifdef SGI_NUMA_MIGR_PAGE_ALT
1097 { SGI_NUMA_MIGR_PAGE_ALT,"SGI_NUMA_MIGR_PAGE_ALT"},
1098#endif
1099#ifdef SGI_KAIO_USERINIT
1100 { SGI_KAIO_USERINIT, "SGI_KAIO_USERINIT" },
1101#endif
1102#ifdef SGI_KAIO_READ
1103 { SGI_KAIO_READ, "SGI_KAIO_READ" },
1104#endif
1105#ifdef SGI_KAIO_WRITE
1106 { SGI_KAIO_WRITE, "SGI_KAIO_WRITE" },
1107#endif
1108#ifdef SGI_KAIO_SUSPEND
1109 { SGI_KAIO_SUSPEND, "SGI_KAIO_SUSPEND" },
1110#endif
1111#ifdef SGI_KAIO_STATS
1112 { SGI_KAIO_STATS, "SGI_KAIO_STATS" },
1113#endif
1114#ifdef SGI_INITIAL_PT_SPROC
1115 { SGI_INITIAL_PT_SPROC, "SGI_INITIAL_PT_SPROC" },
1116#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001117 { 0, NULL },
1118};
1119
1120int
1121sys_syssgi(tcp)
1122struct tcb *tcp;
1123{
1124 int i;
1125
1126 if (entering(tcp)) {
1127 printxval(syssgi_options, tcp->u_arg[0], "SGI_???");
1128 switch (tcp->u_arg[0]) {
1129 default:
1130 for (i = 1; i < tcp->u_nargs; i++)
1131 tprintf(", %#lx", tcp->u_arg[i]);
1132 break;
1133 }
1134 }
1135 return 0;
1136}
1137
1138#include <sys/types.h>
1139#include <rpc/rpc.h>
1140struct cred;
1141struct uio;
1142#include <sys/fsid.h>
1143#include <sys/vnode.h>
1144#include <sys/fs/nfs.h>
1145#include <sys/fs/nfs_clnt.h>
1146
1147static struct xlat mount_flags[] = {
1148 { MS_RDONLY, "MS_RDONLY" },
1149 { MS_FSS, "MS_FSS" },
1150 { MS_DATA, "MS_DATA" },
1151 { MS_NOSUID, "MS_NOSUID" },
1152 { MS_REMOUNT, "MS_REMOUNT" },
1153 { MS_NOTRUNC, "MS_NOTRUNC" },
1154 { MS_GRPID, "MS_GRPID" },
1155 { MS_NODEV, "MS_NODEV" },
1156 { MS_BEFORE, "MS_BEFORE" },
1157 { MS_AFTER, "MS_AFTER" },
1158 { 0, NULL },
1159};
1160
1161static struct xlat nfs_flags[] = {
1162 { NFSMNT_SOFT, "NFSMNT_SOFT" },
1163 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
1164 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
1165 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
1166 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
1167 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001168#ifdef NFSMNT_NOINT /* IRIX 6 */
1169 { NFSMNT_NOINT, "NFSMNT_NOINT" },
1170#endif
1171#ifdef NFSMNT_INT /* IRIX 5 */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001172 { NFSMNT_INT, "NFSMNT_INT" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001173#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001174 { NFSMNT_NOAC, "NFSMNT_NOAC" },
1175 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
1176 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
1177 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
1178 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
1179 { NFSMNT_PRIVATE, "NFSMNT_PRIVATE" },
1180 { NFSMNT_SYMTTL, "NFSMNT_SYMTTL" },
1181 { NFSMNT_LOOPBACK, "NFSMNT_LOOPBACK" },
1182 { NFSMNT_BASETYPE, "NFSMNT_BASETYPE" },
1183 { NFSMNT_NAMEMAX, "NFSMNT_NAMEMAX" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001184#ifdef NFSMNT_SHORTUID /* IRIX 6 */
1185 { NFSMNT_SHORTUID, "NFSMNT_SHORTUID" },
1186#endif
1187#ifdef NFSMNT_ASYNCNLM /* IRIX 6 */
1188 { NFSMNT_ASYNCNLM, "NFSMNT_ASYNCNLM" },
1189#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001190 { 0, NULL },
1191};
1192
1193int
1194sys_mount(tcp)
1195struct tcb *tcp;
1196{
1197 if (entering(tcp)) {
1198 printpath(tcp, tcp->u_arg[0]);
1199 tprintf(", ");
1200 printpath(tcp, tcp->u_arg[1]);
1201 tprintf(", ");
1202 printflags(mount_flags, tcp->u_arg[2]);
1203 if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
1204 tprintf(", ");
1205 tprintf("%ld", tcp->u_arg[3]);
1206 }
1207 if (tcp->u_arg[2] & MS_DATA) {
1208 int nfs_type = sysfs(GETFSIND, FSID_NFS);
1209
1210 tprintf(", ");
1211 if (tcp->u_arg[3] == nfs_type) {
1212 struct nfs_args args;
1213 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1214 tprintf("%#lx", tcp->u_arg[4]);
1215 else {
1216 tprintf("addr=");
1217 printsock(tcp, (int) args.addr);
1218 tprintf(", flags=");
1219 if (!printflags(nfs_flags, args.flags))
1220 tprintf("NFSMNT_???");
1221 tprintf(", hostname=");
1222 printstr(tcp, (int) args.hostname, -1);
1223 tprintf(", ...}");
1224 }
1225 }
1226 else
1227 tprintf("%#lx", tcp->u_arg[4]);
1228 tprintf(", %ld", tcp->u_arg[5]);
1229 }
1230 }
1231 return 0;
1232}
1233
1234#else /* !MIPS */
1235
Wichert Akkerman3377df71999-11-26 13:14:41 +00001236#if UNIXWARE
1237
1238#include <sys/types.h>
1239#include <sys/fstyp.h>
1240#include <sys/mount.h>
1241#include <sys/xti.h>
1242
1243#define NFSCLIENT 1
1244#include <nfs/mount.h>
1245
1246#include <sys/fs/vx_ioctl.h>
1247
1248static struct xlat mount_flags[] = {
1249 { MS_RDONLY, "MS_RDONLY" },
1250 { MS_FSS, "MS_FSS" },
1251 { MS_DATA, "MS_DATA" },
1252 { MS_HADBAD, "MS_HADBAD" },
1253 { MS_NOSUID, "MS_NOSUID" },
1254 { MS_REMOUNT, "MS_REMOUNT" },
1255 { MS_NOTRUNC, "MS_NOTRUNC" },
1256 { MS_SOFTMNT, "MS_SOFTMNT" },
1257 { MS_SYSSPACE, "MS_SYSSPACE" },
1258 { 0, NULL },
1259};
1260
1261#ifdef VX_MS_MASK
1262static struct xlat vxfs_flags[] = {
1263 { VX_MS_NOLOG, "VX_MS_NOLOG" },
1264 { VX_MS_BLKCLEAR, "VX_MS_BLKCLEAR" },
1265 { VX_MS_SNAPSHOT, "VX_MS_SNAPSHOT" },
1266 { VX_MS_NODATAINLOG, "VX_MS_NODATAINLOG" },
1267 { VX_MS_DELAYLOG, "VX_MS_DELAYLOG" },
1268 { VX_MS_TMPLOG, "VX_MS_TMPLOG" },
1269 { VX_MS_FILESET, "VX_MS_FILESET" },
1270
1271 { VX_MS_CACHE_DIRECT, "VX_MS_CACHE_DIRECT" },
1272 { VX_MS_CACHE_DSYNC, "VX_MS_CACHE_DSYNC" },
1273 { VX_MS_CACHE_CLOSESYNC,"VX_MS_CACHE_CLOSESYNC" },
1274 { VX_MS_CACHE_TMPCACHE, "VX_MS_CACHE_TMPCACHE" },
1275
1276 { VX_MS_OSYNC_DIRECT, "VX_MS_OSYNC_DIRECT" },
1277 { VX_MS_OSYNC_DSYNC, "VX_MS_OSYNC_DSYNC" },
1278 { VX_MS_OSYNC_CLOSESYNC,"VX_MS_OSYNC_CLOSESYNC" },
1279 { VX_MS_OSYNC_DELAY, "VX_MS_OSYNC_DELAY" },
1280 { 0, NULL, },
1281};
1282#endif
1283
1284static struct xlat nfs_flags[] = {
1285 { NFSMNT_SOFT, "NFSMNT_SOFT" },
1286 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
1287 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
1288 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
1289 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
1290 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
1291 { NFSMNT_INT, "NFSMNT_INT" },
1292 { NFSMNT_NOAC, "NFSMNT_NOAC" },
1293 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
1294 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
1295 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
1296 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
1297 { NFSMNT_SECURE, "NFSMNT_SECURE" },
1298 { NFSMNT_NOCTO, "NFSMNT_NOCTO" },
1299 { NFSMNT_GRPID, "NFSMNT_GRPID" },
1300 { NFSMNT_RPCTIMESYNC, "NFSMNT_RPCTIMESYNC" },
1301 { NFSMNT_LWPSMAX, "NFSMNT_LWPSMAX" },
1302 { 0, NULL },
1303};
1304
1305int
1306sys_mount(tcp)
1307struct tcb *tcp;
1308{
1309 if (entering(tcp)) {
1310 char fstyp [FSTYPSZ];
1311 printpath(tcp, tcp->u_arg[0]);
1312 tprintf(", ");
1313 printpath(tcp, tcp->u_arg[1]);
1314 tprintf(", ");
1315 printflags(mount_flags, tcp->u_arg[2]);
1316 /* The doc sez that the file system type is given as a
1317 fsindex, and we should use sysfs to work out the name.
1318 This appears to be untrue for UW. Maybe it's untrue
1319 for all SVR4's? */
1320 if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
1321 if (umovestr(tcp, tcp->u_arg[3], FSTYPSZ, fstyp) < 0) {
1322 *fstyp = 0;
1323 tprintf(", %ld", tcp->u_arg[3]);
1324 }
1325 else
1326 tprintf(", \"%s\"", fstyp);
1327 }
1328 if (tcp->u_arg[2] & MS_DATA) {
1329 tprintf(", ");
1330#ifdef VX_MS_MASK
1331 /* On UW7 they don't give us the defines and structs
1332 we need to see what is going on. Bummer. */
1333 if (strcmp (fstyp, "vxfs") == 0) {
1334 struct vx_mountargs5 args;
1335 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1336 tprintf("%#lx", tcp->u_arg[4]);
1337 else {
1338 tprintf("{ flags=");
1339 if (!printflags(vxfs_flags, args.mflags))
1340 tprintf("0x%08x", args.mflags);
1341 if (args.mflags & VX_MS_SNAPSHOT) {
1342 tprintf (", snapof=");
1343 printstr (tcp,
1344 (long) args.primaryspec,
1345 -1);
1346 if (args.snapsize > 0)
1347 tprintf (", snapsize=%ld", args.snapsize);
1348 }
1349 tprintf(" }");
1350 }
1351 }
1352 else
1353#endif
1354 if (strcmp (fstyp, "specfs") == 0) {
1355 tprintf ("dev=");
1356 printstr (tcp, tcp->u_arg[4], -1);
1357 }
1358 else
1359 if (strcmp (fstyp, "nfs") == 0) {
1360 struct nfs_args args;
1361 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1362 tprintf("%#lx", tcp->u_arg[4]);
1363 else {
1364 struct netbuf addr;
1365 tprintf("{ addr=");
1366 if (umove (tcp, (int) args.addr, &addr) < 0) {
1367 tprintf ("%#lx", (long) args.addr);
1368 }
1369 else {
1370 printsock(tcp, (int) addr.buf, addr.len);
1371 }
1372 tprintf(", flags=");
1373 if (!printflags(nfs_flags, args.flags))
1374 tprintf("NFSMNT_???");
1375 tprintf(", hostname=");
1376 printstr(tcp, (int) args.hostname, -1);
1377 tprintf(", ...}");
1378 }
1379 }
1380 else
1381 tprintf("%#lx", tcp->u_arg[4]);
1382 tprintf(", %ld", tcp->u_arg[5]);
1383 }
1384 }
1385 return 0;
1386}
1387
1388#else /* !UNIXWARE */
1389
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001390int
1391sys_mount(tcp)
1392struct tcb *tcp;
1393{
1394 if (entering(tcp)) {
1395 printpath(tcp, tcp->u_arg[0]);
1396 tprintf(", ");
1397 printpath(tcp, tcp->u_arg[1]);
1398 tprintf(", ...");
1399 }
1400 return 0;
1401}
Wichert Akkermanea78f0f1999-11-29 15:34:02 +00001402#endif /* !UNIXWARE */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001403
1404#endif /* !MIPS */
1405
1406#endif /* SVR4 */
1407
Nate Sammons8d5860c1999-07-03 18:53:05 +00001408#ifdef SYS_capget
Wichert Akkermanc7926982000-04-10 22:22:31 +00001409
1410static struct xlat capabilities[] = {
1411 { 1<<CAP_CHOWN, "CAP_CHOWN" },
1412 { 1<<CAP_DAC_OVERRIDE, "CAP_DAC_OVERRIDE"},
1413 { 1<<CAP_DAC_READ_SEARCH,"CAP_DAC_READ_SEARCH"},
1414 { 1<<CAP_FOWNER, "CAP_FOWNER" },
1415 { 1<<CAP_FSETID, "CAP_FSETID" },
1416 { 1<<CAP_KILL, "CAP_KILL" },
1417 { 1<<CAP_SETGID, "CAP_SETGID" },
1418 { 1<<CAP_SETUID, "CAP_SETUID" },
1419 { 1<<CAP_SETPCAP, "CAP_SETPCAP" },
1420 { 1<<CAP_LINUX_IMMUTABLE,"CAP_LINUX_IMMUTABLE"},
1421 { 1<<CAP_NET_BIND_SERVICE,"CAP_NET_BIND_SERVICE"},
1422 { 1<<CAP_NET_BROADCAST, "CAP_NET_BROADCAST"},
1423 { 1<<CAP_NET_ADMIN, "CAP_NET_ADMIN" },
1424 { 1<<CAP_NET_RAW, "CAP_NET_RAW" },
1425 { 1<<CAP_IPC_LOCK, "CAP_IPC_LOCK" },
1426 { 1<<CAP_IPC_OWNER, "CAP_IPC_OWNER" },
1427 { 1<<CAP_SYS_MODULE, "CAP_SYS_MODULE"},
1428 { 1<<CAP_SYS_RAWIO, "CAP_SYS_RAWIO" },
1429 { 1<<CAP_SYS_CHROOT, "CAP_SYS_CHROOT"},
1430 { 1<<CAP_SYS_PTRACE, "CAP_SYS_PTRACE"},
1431 { 1<<CAP_SYS_PACCT, "CAP_SYS_PACCT" },
1432 { 1<<CAP_SYS_ADMIN, "CAP_SYS_ADMIN" },
1433 { 1<<CAP_SYS_BOOT, "CAP_SYS_BOOT" },
1434 { 1<<CAP_SYS_NICE, "CAP_SYS_NICE" },
1435 { 1<<CAP_SYS_RESOURCE, "CAP_SYS_RESOURCE"},
1436 { 1<<CAP_SYS_TIME, "CAP_SYS_TIME" },
1437 { 1<<CAP_SYS_TTY_CONFIG,"CAP_SYS_TTY_CONFIG"},
1438 { 0, NULL },
1439};
1440
1441
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001442int
1443sys_capget(tcp)
1444struct tcb *tcp;
1445{
Wichert Akkermanc7926982000-04-10 22:22:31 +00001446 static cap_user_header_t arg0 = NULL;
1447 static cap_user_data_t arg1 = NULL;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001448
1449 if(!entering(tcp)) {
Wichert Akkermanc7926982000-04-10 22:22:31 +00001450 if (!arg0) {
1451 if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
1452 fprintf(stderr, "sys_capget: no memory\n");
1453 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001454 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001455 }
1456 }
1457 if (!arg1) {
1458 if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
1459 fprintf(stderr, "sys_capget: no memory\n");
1460 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001461 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001462 }
1463 }
1464
1465 if (!tcp->u_arg[0])
1466 tprintf("NULL");
1467 else if (!verbose(tcp))
1468 tprintf("%#lx", tcp->u_arg[0]);
1469 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
1470 tprintf("???");
1471 else {
1472 tprintf("%#x, %d", arg0->version, arg0->pid);
1473 }
1474 tprintf(", ");
1475 if (!tcp->u_arg[1])
1476 tprintf("NULL");
1477 else if (!verbose(tcp))
1478 tprintf("%#lx", tcp->u_arg[1]);
1479 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
1480 tprintf("???");
1481 else {
1482 tprintf("{");
1483 printflags(capabilities, arg1->effective);
1484 tprintf(", ");
1485 printflags(capabilities, arg1->permitted);
1486 tprintf(", ");
1487 printflags(capabilities, arg1->inheritable);
1488 tprintf("}");
1489 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001490 }
1491 return 0;
1492}
1493
1494int
1495sys_capset(tcp)
1496struct tcb *tcp;
1497{
Wichert Akkermanc7926982000-04-10 22:22:31 +00001498 static cap_user_header_t arg0 = NULL;
1499 static cap_user_data_t arg1 = NULL;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001500
Wichert Akkermanc7926982000-04-10 22:22:31 +00001501 if(entering(tcp)) {
1502 if (!arg0) {
1503 if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
1504 fprintf(stderr, "sys_capset: no memory\n");
1505 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001506 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001507 }
1508 }
1509 if (!arg1) {
1510 if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
1511 fprintf(stderr, "sys_capset: no memory\n");
1512 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001513 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001514 }
1515 }
1516
1517 if (!tcp->u_arg[0])
1518 tprintf("NULL");
1519 else if (!verbose(tcp))
1520 tprintf("%#lx", tcp->u_arg[0]);
1521 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
1522 tprintf("???");
1523 else {
1524 tprintf("%#x, %d", arg0->version, arg0->pid);
1525 }
1526 tprintf(", ");
1527 if (!tcp->u_arg[1])
1528 tprintf("NULL");
1529 else if (!verbose(tcp))
1530 tprintf("%#lx", tcp->u_arg[1]);
1531 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
1532 tprintf("???");
1533 else {
1534 tprintf("{");
1535 printflags(capabilities, arg1->effective);
1536 tprintf(", ");
1537 printflags(capabilities, arg1->permitted);
1538 tprintf(", ");
1539 printflags(capabilities, arg1->inheritable);
1540 tprintf("}");
1541 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001542 }
1543 return 0;
1544}
1545
1546#else
1547
1548int sys_capget(tcp)
1549struct tcb *tcp;
1550{
1551 return printargs(tcp);
1552}
1553
1554int sys_capset(tcp)
1555struct tcb *tcp;
1556{
1557 return printargs(tcp);
1558}
1559
1560#endif
1561
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001562#ifdef LINUX
1563static struct xlat sysctl_root[] = {
1564 { CTL_KERN, "CTL_KERN" },
1565 { CTL_VM, "CTL_VM" },
1566 { CTL_NET, "CTL_NET" },
1567 { CTL_PROC, "CTL_PROC" },
1568 { CTL_FS, "CTL_FS" },
1569 { CTL_DEBUG, "CTL_DEBUG" },
1570 { CTL_DEV, "CTL_DEV" },
1571 { 0, NULL }
1572};
1573
1574static struct xlat sysctl_kern[] = {
1575 { KERN_OSTYPE, "KERN_OSTYPE" },
1576 { KERN_OSRELEASE, "KERN_OSRELEASE" },
1577 { KERN_OSREV, "KERN_OSREV" },
1578 { KERN_VERSION, "KERN_VERSION" },
1579 { KERN_SECUREMASK, "KERN_SECUREMASK" },
1580 { KERN_PROF, "KERN_PROF" },
1581 { KERN_NODENAME, "KERN_NODENAME" },
1582 { KERN_DOMAINNAME, "KERN_DOMAINNAME" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001583#ifdef KERN_SECURELVL
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001584 { KERN_SECURELVL, "KERN_SECURELVL" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001585#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001586 { KERN_PANIC, "KERN_PANIC" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001587#ifdef KERN_REALROOTDEV
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001588 { KERN_REALROOTDEV, "KERN_REALROOTDEV" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001589#endif
1590#ifdef KERN_JAVA_INTERPRETER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001591 { KERN_JAVA_INTERPRETER, "KERN_JAVA_INTERPRETER" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001592#endif
1593#ifdef KERN_JAVA_APPLETVIEWER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001594 { KERN_JAVA_APPLETVIEWER, "KERN_JAVA_APPLETVIEWER" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001595#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001596 { KERN_SPARC_REBOOT, "KERN_SPARC_REBOOT" },
1597 { KERN_CTLALTDEL, "KERN_CTLALTDEL" },
1598 { KERN_PRINTK, "KERN_PRINTK" },
1599 { KERN_NAMETRANS, "KERN_NAMETRANS" },
1600 { KERN_PPC_HTABRECLAIM, "KERN_PPC_HTABRECLAIM" },
1601 { KERN_PPC_ZEROPAGED, "KERN_PPC_ZEROPAGED" },
1602 { KERN_PPC_POWERSAVE_NAP, "KERN_PPC_POWERSAVE_NAP" },
1603 { KERN_MODPROBE, "KERN_MODPROBE" },
1604 { KERN_SG_BIG_BUFF, "KERN_SG_BIG_BUFF" },
1605 { KERN_ACCT, "KERN_ACCT" },
1606 { KERN_PPC_L2CR, "KERN_PPC_L2CR" },
1607 { KERN_RTSIGNR, "KERN_RTSIGNR" },
1608 { KERN_RTSIGMAX, "KERN_RTSIGMAX" },
1609 { KERN_SHMMAX, "KERN_SHMMAX" },
1610 { KERN_MSGMAX, "KERN_MSGMAX" },
1611 { KERN_MSGMNB, "KERN_MSGMNB" },
1612 { KERN_MSGPOOL, "KERN_MSGPOOL" },
1613 { 0, NULL }
1614};
1615
1616static struct xlat sysctl_vm[] = {
1617 { VM_SWAPCTL, "VM_SWAPCTL" },
1618 { VM_SWAPOUT, "VM_SWAPOUT" },
1619 { VM_FREEPG, "VM_FREEPG" },
1620 { VM_BDFLUSH, "VM_BDFLUSH" },
1621 { VM_OVERCOMMIT_MEMORY, "VM_OVERCOMMIT_MEMORY" },
1622 { VM_BUFFERMEM, "VM_BUFFERMEM" },
1623 { VM_PAGECACHE, "VM_PAGECACHE" },
1624 { VM_PAGERDAEMON, "VM_PAGERDAEMON" },
1625 { VM_PGT_CACHE, "VM_PGT_CACHE" },
1626 { VM_PAGE_CLUSTER, "VM_PAGE_CLUSTER" },
1627 { 0, NULL },
1628};
1629
1630static struct xlat sysctl_net[] = {
1631 { NET_CORE, "NET_CORE" },
1632 { NET_ETHER, "NET_ETHER" },
1633 { NET_802, "NET_802" },
1634 { NET_UNIX, "NET_UNIX" },
1635 { NET_IPV4, "NET_IPV4" },
1636 { NET_IPX, "NET_IPX" },
1637 { NET_ATALK, "NET_ATALK" },
1638 { NET_NETROM, "NET_NETROM" },
1639 { NET_AX25, "NET_AX25" },
1640 { NET_BRIDGE, "NET_BRIDGE" },
1641 { NET_ROSE, "NET_ROSE" },
1642 { NET_IPV6, "NET_IPV6" },
1643 { NET_X25, "NET_X25" },
1644 { NET_TR, "NET_TR" },
1645 { NET_DECNET, "NET_DECNET" },
1646 { 0, NULL }
1647};
1648
1649static struct xlat sysctl_net_core[] = {
1650 { NET_CORE_WMEM_MAX, "NET_CORE_WMEM_MAX" },
1651 { NET_CORE_RMEM_MAX, "NET_CORE_RMEM_MAX" },
1652 { NET_CORE_WMEM_DEFAULT, "NET_CORE_WMEM_DEFAULT" },
1653 { NET_CORE_RMEM_DEFAULT, "NET_CORE_RMEM_DEFAULT" },
1654 { NET_CORE_MAX_BACKLOG, "NET_CORE_MAX_BACKLOG" },
1655 { NET_CORE_FASTROUTE, "NET_CORE_FASTROUTE" },
1656 { NET_CORE_MSG_COST, "NET_CORE_MSG_COST" },
1657 { NET_CORE_MSG_BURST, "NET_CORE_MSG_BURST" },
1658 { NET_CORE_OPTMEM_MAX, "NET_CORE_OPTMEM_MAX" },
1659 { 0, NULL }
1660};
1661
1662static struct xlat sysctl_net_unix[] = {
1663 { NET_UNIX_DESTROY_DELAY, "NET_UNIX_DESTROY_DELAY" },
1664 { NET_UNIX_DELETE_DELAY, "NET_UNIX_DELETE_DELAY" },
1665 { 0, NULL }
1666};
1667
1668static struct xlat sysctl_net_ipv4[] = {
1669 { NET_IPV4_FORWARD, "NET_IPV4_FORWARD" },
1670 { NET_IPV4_DYNADDR, "NET_IPV4_DYNADDR" },
1671 { NET_IPV4_CONF, "NET_IPV4_CONF" },
1672 { NET_IPV4_NEIGH, "NET_IPV4_NEIGH" },
1673 { NET_IPV4_ROUTE, "NET_IPV4_ROUTE" },
1674 { NET_IPV4_FIB_HASH, "NET_IPV4_FIB_HASH" },
1675 { NET_IPV4_TCP_TIMESTAMPS, "NET_IPV4_TCP_TIMESTAMPS" },
1676 { NET_IPV4_TCP_WINDOW_SCALING, "NET_IPV4_TCP_WINDOW_SCALING" },
1677 { NET_IPV4_TCP_SACK, "NET_IPV4_TCP_SACK" },
1678 { NET_IPV4_TCP_RETRANS_COLLAPSE, "NET_IPV4_TCP_RETRANS_COLLAPSE" },
1679 { NET_IPV4_DEFAULT_TTL, "NET_IPV4_DEFAULT_TTL" },
1680 { NET_IPV4_AUTOCONFIG, "NET_IPV4_AUTOCONFIG" },
1681 { NET_IPV4_NO_PMTU_DISC, "NET_IPV4_NO_PMTU_DISC" },
1682 { NET_IPV4_TCP_SYN_RETRIES, "NET_IPV4_TCP_SYN_RETRIES" },
1683 { NET_IPV4_IPFRAG_HIGH_THRESH, "NET_IPV4_IPFRAG_HIGH_THRESH" },
1684 { NET_IPV4_IPFRAG_LOW_THRESH, "NET_IPV4_IPFRAG_LOW_THRESH" },
1685 { NET_IPV4_IPFRAG_TIME, "NET_IPV4_IPFRAG_TIME" },
1686 { NET_IPV4_TCP_MAX_KA_PROBES, "NET_IPV4_TCP_MAX_KA_PROBES" },
1687 { NET_IPV4_TCP_KEEPALIVE_TIME, "NET_IPV4_TCP_KEEPALIVE_TIME" },
1688 { NET_IPV4_TCP_KEEPALIVE_PROBES, "NET_IPV4_TCP_KEEPALIVE_PROBES" },
1689 { NET_IPV4_TCP_RETRIES1, "NET_IPV4_TCP_RETRIES1" },
1690 { NET_IPV4_TCP_RETRIES2, "NET_IPV4_TCP_RETRIES2" },
1691 { NET_IPV4_TCP_FIN_TIMEOUT, "NET_IPV4_TCP_FIN_TIMEOUT" },
1692 { NET_IPV4_IP_MASQ_DEBUG, "NET_IPV4_IP_MASQ_DEBUG" },
1693 { NET_TCP_SYNCOOKIES, "NET_TCP_SYNCOOKIES" },
1694 { NET_TCP_STDURG, "NET_TCP_STDURG" },
1695 { NET_TCP_RFC1337, "NET_TCP_RFC1337" },
1696 { NET_TCP_SYN_TAILDROP, "NET_TCP_SYN_TAILDROP" },
1697 { NET_TCP_MAX_SYN_BACKLOG, "NET_TCP_MAX_SYN_BACKLOG" },
1698 { NET_IPV4_LOCAL_PORT_RANGE, "NET_IPV4_LOCAL_PORT_RANGE" },
1699 { NET_IPV4_ICMP_ECHO_IGNORE_ALL, "NET_IPV4_ICMP_ECHO_IGNORE_ALL" },
1700 { NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS" },
1701 { NET_IPV4_ICMP_SOURCEQUENCH_RATE, "NET_IPV4_ICMP_SOURCEQUENCH_RATE" },
1702 { NET_IPV4_ICMP_DESTUNREACH_RATE, "NET_IPV4_ICMP_DESTUNREACH_RATE" },
1703 { NET_IPV4_ICMP_TIMEEXCEED_RATE, "NET_IPV4_ICMP_TIMEEXCEED_RATE" },
1704 { NET_IPV4_ICMP_PARAMPROB_RATE, "NET_IPV4_ICMP_PARAMPROB_RATE" },
1705 { NET_IPV4_ICMP_ECHOREPLY_RATE, "NET_IPV4_ICMP_ECHOREPLY_RATE" },
1706 { NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES" },
1707 { NET_IPV4_IGMP_MAX_MEMBERSHIPS, "NET_IPV4_IGMP_MAX_MEMBERSHIPS" },
1708 { 0, NULL }
1709};
1710
1711static struct xlat sysctl_net_ipv4_route[] = {
1712 { NET_IPV4_ROUTE_FLUSH, "NET_IPV4_ROUTE_FLUSH" },
1713 { NET_IPV4_ROUTE_MIN_DELAY, "NET_IPV4_ROUTE_MIN_DELAY" },
1714 { NET_IPV4_ROUTE_MAX_DELAY, "NET_IPV4_ROUTE_MAX_DELAY" },
1715 { NET_IPV4_ROUTE_GC_THRESH, "NET_IPV4_ROUTE_GC_THRESH" },
1716 { NET_IPV4_ROUTE_MAX_SIZE, "NET_IPV4_ROUTE_MAX_SIZE" },
1717 { NET_IPV4_ROUTE_GC_MIN_INTERVAL, "NET_IPV4_ROUTE_GC_MIN_INTERVAL" },
1718 { NET_IPV4_ROUTE_GC_TIMEOUT, "NET_IPV4_ROUTE_GC_TIMEOUT" },
1719 { NET_IPV4_ROUTE_GC_INTERVAL, "NET_IPV4_ROUTE_GC_INTERVAL" },
1720 { NET_IPV4_ROUTE_REDIRECT_LOAD, "NET_IPV4_ROUTE_REDIRECT_LOAD" },
1721 { NET_IPV4_ROUTE_REDIRECT_NUMBER, "NET_IPV4_ROUTE_REDIRECT_NUMBER" },
1722 { NET_IPV4_ROUTE_REDIRECT_SILENCE, "NET_IPV4_ROUTE_REDIRECT_SILENCE" },
1723 { NET_IPV4_ROUTE_ERROR_COST, "NET_IPV4_ROUTE_ERROR_COST" },
1724 { NET_IPV4_ROUTE_ERROR_BURST, "NET_IPV4_ROUTE_ERROR_BURST" },
1725 { NET_IPV4_ROUTE_GC_ELASTICITY, "NET_IPV4_ROUTE_GC_ELASTICITY" },
1726 { 0, NULL }
1727};
1728
1729static struct xlat sysctl_net_ipv4_conf[] = {
1730 { NET_IPV4_CONF_FORWARDING, "NET_IPV4_CONF_FORWARDING" },
1731 { NET_IPV4_CONF_MC_FORWARDING, "NET_IPV4_CONF_MC_FORWARDING" },
1732 { NET_IPV4_CONF_PROXY_ARP, "NET_IPV4_CONF_PROXY_ARP" },
1733 { NET_IPV4_CONF_ACCEPT_REDIRECTS, "NET_IPV4_CONF_ACCEPT_REDIRECTS" },
1734 { NET_IPV4_CONF_SECURE_REDIRECTS, "NET_IPV4_CONF_SECURE_REDIRECTS" },
1735 { NET_IPV4_CONF_SEND_REDIRECTS, "NET_IPV4_CONF_SEND_REDIRECTS" },
1736 { NET_IPV4_CONF_SHARED_MEDIA, "NET_IPV4_CONF_SHARED_MEDIA" },
1737 { NET_IPV4_CONF_RP_FILTER, "NET_IPV4_CONF_RP_FILTER" },
1738 { NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, "NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE" },
1739 { NET_IPV4_CONF_BOOTP_RELAY, "NET_IPV4_CONF_BOOTP_RELAY" },
1740 { NET_IPV4_CONF_LOG_MARTIANS, "NET_IPV4_CONF_LOG_MARTIANS" },
1741 { 0, NULL }
1742};
1743
1744static struct xlat sysctl_net_ipv6[] = {
1745 { NET_IPV6_CONF, "NET_IPV6_CONF" },
1746 { NET_IPV6_NEIGH, "NET_IPV6_NEIGH" },
1747 { NET_IPV6_ROUTE, "NET_IPV6_ROUTE" },
1748 { 0, NULL }
1749};
1750
1751static struct xlat sysctl_net_ipv6_route[] = {
1752 { NET_IPV6_ROUTE_FLUSH, "NET_IPV6_ROUTE_FLUSH" },
1753 { NET_IPV6_ROUTE_GC_THRESH, "NET_IPV6_ROUTE_GC_THRESH" },
1754 { NET_IPV6_ROUTE_MAX_SIZE, "NET_IPV6_ROUTE_MAX_SIZE" },
1755 { NET_IPV6_ROUTE_GC_MIN_INTERVAL, "NET_IPV6_ROUTE_GC_MIN_INTERVAL" },
1756 { NET_IPV6_ROUTE_GC_TIMEOUT, "NET_IPV6_ROUTE_GC_TIMEOUT" },
1757 { NET_IPV6_ROUTE_GC_INTERVAL, "NET_IPV6_ROUTE_GC_INTERVAL" },
1758 { NET_IPV6_ROUTE_GC_ELASTICITY, "NET_IPV6_ROUTE_GC_ELASTICITY" },
1759 { 0, NULL }
1760};
1761
1762int
1763sys_sysctl(tcp)
1764struct tcb *tcp;
1765{
1766 struct __sysctl_args info;
1767 int *name;
1768 umove (tcp, tcp->u_arg[0], &info);
1769
1770 name = alloca (sizeof (int) * info.nlen);
1771 umoven(tcp, (size_t) info.name, sizeof (int) * info.nlen, (char *) name);
1772
1773 if (entering(tcp)) {
1774 int cnt = 0;
1775
1776 tprintf("{{");
1777
1778 if (info.nlen == 0)
1779 goto out;
1780 printxval(sysctl_root, name[0], "CTL_???");
1781 ++cnt;
1782
1783 if (info.nlen == 1)
1784 goto out;
1785 switch (name[0]) {
1786 case CTL_KERN:
1787 tprintf(", ");
1788 printxval(sysctl_kern, name[1], "KERN_???");
1789 ++cnt;
1790 break;
1791 case CTL_VM:
1792 tprintf(", ");
1793 printxval(sysctl_vm, name[1], "VM_???");
1794 ++cnt;
1795 break;
1796 case CTL_NET:
1797 tprintf(", ");
1798 printxval(sysctl_net, name[1], "NET_???");
1799 ++cnt;
1800
1801 if (info.nlen == 2)
1802 goto out;
1803 switch (name[1]) {
1804 case NET_CORE:
1805 tprintf(", ");
1806 printxval(sysctl_net_core, name[2],
1807 "NET_CORE_???");
1808 break;
1809 case NET_UNIX:
1810 tprintf(", ");
1811 printxval(sysctl_net_unix, name[2],
1812 "NET_UNIX_???");
1813 break;
1814 case NET_IPV4:
1815 tprintf(", ");
1816 printxval(sysctl_net_ipv4, name[2],
1817 "NET_IPV4_???");
1818
1819 if (info.nlen == 3)
1820 goto out;
1821 switch (name[2]) {
1822 case NET_IPV4_ROUTE:
1823 tprintf(", ");
1824 printxval(sysctl_net_ipv4_route,
1825 name[3],
1826 "NET_IPV4_ROUTE_???");
1827 break;
1828 case NET_IPV4_CONF:
1829 tprintf(", ");
1830 printxval(sysctl_net_ipv4_conf,
1831 name[3],
1832 "NET_IPV4_CONF_???");
1833 break;
1834 default:
1835 goto out;
1836 }
1837 break;
1838 case NET_IPV6:
1839 tprintf(", ");
1840 printxval(sysctl_net_ipv6, name[2],
1841 "NET_IPV6_???");
1842
1843 if (info.nlen == 3)
1844 goto out;
1845 switch (name[2]) {
1846 case NET_IPV6_ROUTE:
1847 tprintf(", ");
1848 printxval(sysctl_net_ipv6_route,
1849 name[3],
1850 "NET_IPV6_ROUTE_???");
1851 break;
1852 default:
1853 goto out;
1854 }
1855 break;
1856 default:
1857 goto out;
1858 }
1859 break;
1860 default:
1861 goto out;
1862 }
1863 out:
1864 while (cnt < info.nlen)
1865 tprintf(", %x", name[cnt++]);
1866 tprintf("}, %d, ", info.nlen);
1867 } else {
1868 size_t oldlen;
1869 umove(tcp, (size_t)info.oldlenp, &oldlen);
1870 if (info.nlen >= 2
1871 && ((name[0] == CTL_KERN
1872 && (name[1] == KERN_OSRELEASE
1873 || name[1] == KERN_OSTYPE
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001874#ifdef KERN_JAVA_INTERPRETER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001875 || name[1] == KERN_JAVA_INTERPRETER
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001876#endif
1877#ifdef KERN_JAVA_APPLETVIEWER
1878 || name[1] == KERN_JAVA_APPLETVIEWER
1879#endif
1880 )))) {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001881 printpath(tcp, (size_t)info.oldval);
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001882 tprintf(", %Zu, ", oldlen);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001883 if (info.newval == 0)
1884 tprintf("NULL");
1885 else if (syserror(tcp))
1886 tprintf("%p", info.newval);
1887 else
1888 printpath(tcp, (size_t)info.newval);
1889 tprintf(", %Zd", info.newlen);
1890 } else {
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001891 tprintf("%p, %Zd, %p, %Zd", info.oldval, oldlen,
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001892 info.newval, info.newlen);
1893 }
1894 tprintf("}");
1895 }
1896 return 0;
1897}
1898#else
1899int sys_sysctl(tcp)
1900struct tcb *tcp;
1901{
1902 return printargs(tcp);
1903}
1904#endif
1905
Wichert Akkerman16a03d22000-08-10 02:14:04 +00001906
1907#if UNIXWARE >= 2
1908
1909#include <sys/ksym.h>
1910#include <sys/elf.h>
1911
1912static struct xlat ksym_flags[] = {
1913 { STT_NOTYPE, "STT_NOTYPE" },
1914 { STT_FUNC, "STT_FUNC" },
1915 { STT_OBJECT, "STT_OBJECT" },
1916 { 0, NULL },
1917};
1918
1919int
1920sys_getksym(tcp)
1921struct tcb *tcp;
1922{
1923 if (entering (tcp)) {
1924 printstr(tcp, tcp->u_arg[0], -1);
1925 tprintf(", ");
1926 }
1927 else {
1928 if (syserror(tcp)) {
1929 tprintf("%#lx, %#lx",
1930 tcp->u_arg[1], tcp->u_arg[2]);
1931 }
1932 else {
1933 int val;
1934 printnum (tcp, tcp->u_arg[1], "%#lx");
1935 tprintf(", ");
1936 if (umove(tcp, tcp->u_arg[2], &val) < 0) {
1937 tprintf("%#lx", tcp->u_arg[2]);
1938 }
1939 else {
1940 tprintf("[");
1941 printxval (ksym_flags, val, "STT_???");
1942 tprintf("]");
1943 }
1944 }
1945 }
1946
1947 return 0;
1948}
1949
1950#endif