blob: 506be6145668389317be63c0c0bfb5d2f5c3e6e7 [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>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * $Id$
30 */
31
32#include "defs.h"
33
34#ifdef LINUX
35#define _LINUX_SOCKET_H
36
37#define MS_RDONLY 1 /* Mount read-only */
38#define MS_NOSUID 2 /* Ignore suid and sgid bits */
39#define MS_NODEV 4 /* Disallow access to device special files */
40#define MS_NOEXEC 8 /* Disallow program execution */
41#define MS_SYNCHRONOUS 16 /* Writes are synced at once */
42#define MS_REMOUNT 32 /* Alter flags of a mounted FS */
43
44#include <sys/socket.h>
45#include <netinet/in.h>
46#include <arpa/inet.h>
47
Wichert Akkerman2e2553a1999-05-09 00:29:58 +000048#ifdef __NR_personality
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000049/* Workaround for kernel namespace pollution. */
Wichert Akkerman2e2553a1999-05-09 00:29:58 +000050#define _LINUX_PTRACE_H
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000051#define sys_personality kernel_sys_personality
52#include <linux/personality.h>
53#undef sys_personality
54#endif /* __NR_personality */
55
56#ifdef __NR_capget
57#include <linux/capability.h>
58#endif
59
Wichert Akkerman2e2553a1999-05-09 00:29:58 +000060#ifdef __NR_cacheflush
61#include <asm/cachectl.h>
62#endif
63
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000064static struct xlat mount_flags[] = {
65 { MS_RDONLY, "MS_RDONLY" },
66 { MS_NOSUID, "MS_NOSUID" },
67 { MS_NODEV, "MS_NODEV" },
68 { MS_NOEXEC, "MS_NOEXEC" },
69#ifdef MS_SYNCHRONOUS
70 { MS_SYNCHRONOUS,"MS_SYNCHRONOUS"},
71#else
72 { MS_SYNC, "MS_SYNC" },
73#endif
74 { MS_REMOUNT, "MS_REMOUNT" },
75 { 0, NULL },
76};
77
78int
79sys_mount(tcp)
80struct tcb *tcp;
81{
82 if (entering(tcp)) {
83 printpath(tcp, tcp->u_arg[0]);
84 tprintf(", ");
85 printpath(tcp, tcp->u_arg[1]);
86 tprintf(", ");
87 printpath(tcp, tcp->u_arg[2]);
88 tprintf(", ");
89 printflags(mount_flags, tcp->u_arg[3]);
90 tprintf(", %#lx", tcp->u_arg[4]);
91 }
92 return 0;
93}
94
95static struct xlat personality_options[] = {
96#ifdef PER_LINUX
97 { PER_LINUX, "PER_LINUX" },
98#endif
99#ifdef PER_LINUX_32BIT
100 { PER_LINUX_32BIT, "PER_LINUX" },
101#endif
102#ifdef PER_SVR4
103 { PER_SVR4, "PER_SVR4" },
104#endif
105#ifdef PER_SVR3
106 { PER_SVR3, "PER_SVR3" },
107#endif
108#ifdef PER_SCOSVR3
109 { PER_SCOSVR3, "PER_SCOSVR3" },
110#endif
111#ifdef PER_WYSEV386
112 { PER_WYSEV386, "PER_WYSEV386" },
113#endif
114#ifdef PER_ISCR4
115 { PER_ISCR4, "PER_ISCR4" },
116#endif
117#ifdef PER_BSD
118 { PER_BSD, "PER_BSD" },
119#endif
120#ifdef PER_XENIX
121 { PER_XENIX, "PER_XENIX" },
122#endif
123 { 0, NULL },
124};
125
126int
127sys_personality(tcp)
128struct tcb *tcp;
129{
130 if (entering(tcp))
131 printxval(personality_options, tcp->u_arg[0], "PER_???");
132 return 0;
133}
134
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000135#ifdef M68K
136static struct xlat cacheflush_scope[] = {
137#ifdef FLUSH_SCOPE_LINE
138 { FLUSH_SCOPE_LINE, "FLUSH_SCOPE_LINE" },
139#endif
140#ifdef FLUSH_SCOPE_PAGE
141 { FLUSH_SCOPE_PAGE, "FLUSH_SCOPE_PAGE" },
142#endif
143#ifdef FLUSH_SCOPE_ALL
144 { FLUSH_SCOPE_ALL, "FLUSH_SCOPE_ALL" },
145#endif
146 { 0, NULL },
147};
148
149static struct xlat cacheflush_flags[] = {
150#ifdef FLUSH_CACHE_BOTH
151 { FLUSH_CACHE_BOTH, "FLUSH_CACHE_BOTH" },
152#endif
153#ifdef FLUSH_CACHE_DATA
154 { FLUSH_CACHE_DATA, "FLUSH_CACHE_DATA" },
155#endif
156#ifdef FLUSH_CACHE_INSN
157 { FLUSH_CACHE_INSN, "FLUSH_CACHE_INSN" },
158#endif
159 { 0, NULL },
160};
161
162int
163sys_cacheflush(tcp)
164struct tcb *tcp;
165{
166 if (entering(tcp)) {
167 /* addr */
168 tprintf("%#lx, ", tcp->u_arg[0]);
169 /* scope */
170 printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
171 tprintf(", ");
172 /* flags */
173 printflags(cacheflush_flags, tcp->u_arg[2]);
174 /* len */
175 tprintf(", %lu", tcp->u_arg[3]);
176 }
177 return 0;
178}
179#endif /* M68K */
180
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000181#endif /* LINUX */
182
183#ifdef SUNOS4
184
185#include <sys/reboot.h>
186#define NFSCLIENT
187#define LOFS
188#define RFS
189#define PCFS
190#include <sys/mount.h>
191#include <sys/socket.h>
192#include <nfs/export.h>
193#include <rpc/types.h>
194#include <rpc/auth.h>
195
196/*ARGSUSED*/
197int
198sys_sync(tcp)
199struct tcb *tcp;
200{
201 return 0;
202}
203
204static struct xlat bootflags[] = {
205 { RB_AUTOBOOT, "RB_AUTOBOOT" }, /* for system auto-booting itself */
206 { RB_ASKNAME, "RB_ASKNAME" }, /* ask for file name to reboot from */
207 { RB_SINGLE, "RB_SINGLE" }, /* reboot to single user only */
208 { RB_NOSYNC, "RB_NOSYNC" }, /* dont sync before reboot */
209 { RB_HALT, "RB_HALT" }, /* don't reboot, just halt */
210 { RB_INITNAME, "RB_INITNAME" }, /* name given for /etc/init */
211 { RB_NOBOOTRC, "RB_NOBOOTRC" }, /* don't run /etc/rc.boot */
212 { RB_DEBUG, "RB_DEBUG" }, /* being run under debugger */
213 { RB_DUMP, "RB_DUMP" }, /* dump system core */
214 { RB_WRITABLE, "RB_WRITABLE" }, /* mount root read/write */
215 { RB_STRING, "RB_STRING" }, /* pass boot args to prom monitor */
216 { 0, NULL },
217};
218
219int
220sys_reboot(tcp)
221struct tcb *tcp;
222{
223 if (entering(tcp)) {
224 if (!printflags(bootflags, tcp->u_arg[0]))
225 tprintf("RB_???");
226 if (tcp->u_arg[0] & RB_STRING) {
227 printstr(tcp, tcp->u_arg[1], -1);
228 }
229 }
230 return 0;
231}
232
233int
234sys_sysacct(tcp)
235struct tcb *tcp;
236{
237 if (entering(tcp)) {
238 printstr(tcp, tcp->u_arg[0], -1);
239 }
240 return 0;
241}
242
243int
244sys_swapon(tcp)
245struct tcb *tcp;
246{
247 if (entering(tcp)) {
248 printstr(tcp, tcp->u_arg[0], -1);
249 }
250 return 0;
251}
252
253int
254sys_nfs_svc(tcp)
255struct tcb *tcp;
256{
257 if (entering(tcp)) {
258 printsock(tcp, tcp->u_arg[0]);
259 }
260 return 0;
261}
262
263static struct xlat mountflags[] = {
264 { M_RDONLY, "M_RDONLY" },
265 { M_NOSUID, "M_NOSUID" },
266 { M_NEWTYPE, "M_NEWTYPE" },
267 { M_GRPID, "M_GRPID" },
268#ifdef M_REMOUNT
269 { M_REMOUNT, "M_REMOUNT" },
270#endif
271#ifdef M_NOSUB
272 { M_NOSUB, "M_NOSUB" },
273#endif
274#ifdef M_MULTI
275 { M_MULTI, "M_MULTI" },
276#endif
277#ifdef M_SYS5
278 { M_SYS5, "M_SYS5" },
279#endif
280 { 0, NULL },
281};
282
283static struct xlat nfsflags[] = {
284 { NFSMNT_SOFT, "NFSMNT_SOFT" },
285 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
286 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
287 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
288 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
289 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
290 { NFSMNT_INT, "NFSMNT_INT" },
291 { NFSMNT_NOAC, "NFSMNT_NOAC" },
292 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
293 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
294 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
295 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
296#ifdef NFSMNT_SECURE
297 { NFSMNT_SECURE, "NFSMNT_SECURE" },
298#endif
299#ifdef NFSMNT_NOCTO
300 { NFSMNT_NOCTO, "NFSMNT_NOCTO" },
301#endif
302#ifdef NFSMNT_POSIX
303 { NFSMNT_POSIX, "NFSMNT_POSIX" },
304#endif
305 { 0, NULL },
306};
307
308int
309sys_mount(tcp)
310struct tcb *tcp;
311{
312 char type[4];
313
314 if (entering(tcp)) {
315 if (!(tcp->u_arg[2] & M_NEWTYPE) || umovestr(tcp,
316 tcp->u_arg[0], sizeof type, type) < 0) {
317 tprintf("OLDTYPE:#%lx", tcp->u_arg[0]);
318 } else {
319 tprintf("\"%s\", ", type);
320 }
321 printstr(tcp, tcp->u_arg[1], -1);
322 tprintf(", ");
323 if (!printflags(mountflags, tcp->u_arg[2] & ~M_NEWTYPE))
324 tprintf("0");
325 tprintf(", ");
326
327 if (strcmp(type, "4.2") == 0) {
328 struct ufs_args a;
329 if (umove(tcp, tcp->u_arg[3], &a) < 0)
330 return 0;
331 printstr(tcp, (int)a.fspec, -1);
332 } else if (strcmp(type, "lo") == 0) {
333 struct lo_args a;
334 if (umove(tcp, tcp->u_arg[3], &a) < 0)
335 return 0;
336 printstr(tcp, (int)a.fsdir, -1);
337 } else if (strcmp(type, "nfs") == 0) {
338 struct nfs_args a;
339 if (umove(tcp, tcp->u_arg[3], &a) < 0)
340 return 0;
341 tprintf("[");
342 printsock(tcp, (int) a.addr);
343 tprintf(", ");
344 if (!printflags(nfsflags, a.flags))
345 tprintf("NFSMNT_???");
346 tprintf(", ws:%u,rs:%u,to:%u,re:%u,",
347 a.wsize, a.rsize, a.timeo, a.retrans);
348 if (a.flags & NFSMNT_HOSTNAME && a.hostname)
349 printstr(tcp, (int)a.hostname, -1);
350 else
351 tprintf("%#lx", (unsigned long) a.hostname);
352 tprintf(",reg-min:%u,max:%u,dir-min:%u,max:%u,",
353 a.acregmin, a.acregmax, a.acdirmin, a.acdirmax);
354 if ((a.flags & NFSMNT_SECURE) && a.netname)
355 printstr(tcp, (int) a.netname, -1);
356 else
357 tprintf("%#lx", (unsigned long) a.netname);
358 tprintf("]");
359 } else if (strcmp(type, "rfs") == 0) {
360 struct rfs_args a;
361 struct token t;
362 if (umove(tcp, tcp->u_arg[3], &a) < 0)
363 return 0;
364 tprintf("[");
365 printstr(tcp, (int)a.rmtfs, -1);
366 if (umove(tcp, (int)a.token, &t) < 0)
367 return 0;
368 tprintf(", %u, %s]", t.t_id, t.t_uname);
369 } else if (strcmp(type, "pcfs") == 0) {
370 struct pc_args a;
371 if (umove(tcp, tcp->u_arg[3], &a) < 0)
372 return 0;
373 printstr(tcp, (int)a.fspec, -1);
374 }
375 }
376 return 0;
377}
378
379int
380sys_unmount(tcp)
381struct tcb *tcp;
382{
383 if (entering(tcp)) {
384 printstr(tcp, tcp->u_arg[0], -1);
385 }
386 return 0;
387}
388
389int
390sys_umount(tcp)
391struct tcb *tcp;
392{
393 return sys_unmount(tcp);
394}
395
396int
397sys_auditsys(tcp)
398struct tcb *tcp;
399{
400 /* XXX - no information available */
401 return printargs(tcp);
402}
403
404static struct xlat ex_auth_flags[] = {
405 { AUTH_UNIX, "AUTH_UNIX" },
406 { AUTH_DES, "AUTH_DES" },
407 { 0, NULL },
408};
409
410int
411sys_exportfs(tcp)
412struct tcb *tcp;
413{
414 struct export e;
415 int i;
416
417 if (entering(tcp)) {
418 printstr(tcp, tcp->u_arg[0], -1);
419 if (umove(tcp, tcp->u_arg[1], &e) < 0) {
420 tprintf("%#lx", tcp->u_arg[1]);
421 return 0;
422 }
423 tprintf("{fl:%u, anon:%u, ", e.ex_flags, e.ex_anon);
424 printxval(ex_auth_flags, e.ex_auth, "AUTH_???");
425 tprintf(", roots:[");
426 if (e.ex_auth == AUTH_UNIX) {
427 for (i=0; i<e.ex_u.exunix.rootaddrs.naddrs; i++) {
428 printsock(tcp,
429 (int)&e.ex_u.exunix.rootaddrs.addrvec[i]);
430 }
431 tprintf("], writers:[");
432 for (i=0; i<e.ex_writeaddrs.naddrs; i++) {
433 printsock(tcp,
434 (int)&e.ex_writeaddrs.addrvec[i]);
435 }
436 tprintf("]");
437 } else {
438 for (i=0; i<e.ex_u.exdes.nnames; i++) {
439 printsock(tcp,
440 (int)&e.ex_u.exdes.rootnames[i]);
441 tprintf(", ");
442 }
443 tprintf("], window:%u", e.ex_u.exdes.window);
444 }
445 tprintf("}");
446 }
447 return 0;
448}
449
450static struct xlat sysconflimits[] = {
451#ifdef _SC_ARG_MAX
452 { _SC_ARG_MAX, "_SC_ARG_MAX" }, /* space for argv & envp */
453#endif
454#ifdef _SC_CHILD_MAX
455 { _SC_CHILD_MAX, "_SC_CHILD_MAX" }, /* maximum children per process??? */
456#endif
457#ifdef _SC_CLK_TCK
458 { _SC_CLK_TCK, "_SC_CLK_TCK" }, /* clock ticks/sec */
459#endif
460#ifdef _SC_NGROUPS_MAX
461 { _SC_NGROUPS_MAX, "_SC_NGROUPS_MAX" }, /* number of groups if multple supp. */
462#endif
463#ifdef _SC_OPEN_MAX
464 { _SC_OPEN_MAX, "_SC_OPEN_MAX" }, /* max open files per process */
465#endif
466#ifdef _SC_JOB_CONTROL
467 { _SC_JOB_CONTROL, "_SC_JOB_CONTROL" }, /* do we have job control */
468#endif
469#ifdef _SC_SAVED_IDS
470 { _SC_SAVED_IDS, "_SC_SAVED_IDS" }, /* do we have saved uid/gids */
471#endif
472#ifdef _SC_VERSION
473 { _SC_VERSION, "_SC_VERSION" }, /* POSIX version supported */
474#endif
475 { 0, NULL },
476};
477
478static struct xlat pathconflimits[] = {
479#ifdef _PC_LINK_MAX
480 { _PC_LINK_MAX, "_PC_LINK_MAX" }, /* max links to file/dir */
481#endif
482#ifdef _PC_MAX_CANON
483 { _PC_MAX_CANON, "_PC_MAX_CANON" }, /* max line length */
484#endif
485#ifdef _PC_MAX_INPUT
486 { _PC_MAX_INPUT, "_PC_MAX_INPUT" }, /* max "packet" to a tty device */
487#endif
488#ifdef _PC_NAME_MAX
489 { _PC_NAME_MAX, "_PC_NAME_MAX" }, /* max pathname component length */
490#endif
491#ifdef _PC_PATH_MAX
492 { _PC_PATH_MAX, "_PC_PATH_MAX" }, /* max pathname length */
493#endif
494#ifdef _PC_PIPE_BUF
495 { _PC_PIPE_BUF, "_PC_PIPE_BUF" }, /* size of a pipe */
496#endif
497#ifdef _PC_CHOWN_RESTRICTED
498 { _PC_CHOWN_RESTRICTED, "_PC_CHOWN_RESTRICTED" }, /* can we give away files */
499#endif
500#ifdef _PC_NO_TRUNC
501 { _PC_NO_TRUNC, "_PC_NO_TRUNC" }, /* trunc or error on >NAME_MAX */
502#endif
503#ifdef _PC_VDISABLE
504 { _PC_VDISABLE, "_PC_VDISABLE" }, /* best char to shut off tty c_cc */
505#endif
506 { 0, NULL },
507};
508
509int
510sys_sysconf(tcp)
511struct tcb *tcp;
512{
513 if (entering(tcp)) {
514 printxval(sysconflimits, tcp->u_arg[0], "_SC_???");
515 }
516 return 0;
517}
518
519int
520sys_pathconf(tcp)
521struct tcb *tcp;
522{
523 if (entering(tcp)) {
524 printstr(tcp, tcp->u_arg[0], -1);
525 tprintf(", ");
526 printxval(pathconflimits, tcp->u_arg[1], "_SC_???");
527 }
528 return 0;
529}
530
531int
532sys_fpathconf(tcp)
533struct tcb *tcp;
534{
535 if (entering(tcp)) {
536 tprintf("%lu, ", tcp->u_arg[0]);
537 printxval(pathconflimits, tcp->u_arg[1], "_SC_???");
538 }
539 return 0;
540}
541
542#endif /* SUNOS4 */
543
544#ifdef SVR4
545
546#ifdef HAVE_SYS_SYSCONFIG_H
547#include <sys/sysconfig.h>
548#endif /* HAVE_SYS_SYSCONFIG_H */
549
550#include <sys/mount.h>
551#include <sys/systeminfo.h>
552#include <sys/utsname.h>
553
554static struct xlat sysconfig_options[] = {
555#ifdef _CONFIG_NGROUPS
556 { _CONFIG_NGROUPS, "_CONFIG_NGROUPS" },
557#endif
558#ifdef _CONFIG_CHILD_MAX
559 { _CONFIG_CHILD_MAX, "_CONFIG_CHILD_MAX" },
560#endif
561#ifdef _CONFIG_OPEN_FILES
562 { _CONFIG_OPEN_FILES, "_CONFIG_OPEN_FILES" },
563#endif
564#ifdef _CONFIG_POSIX_VER
565 { _CONFIG_POSIX_VER, "_CONFIG_POSIX_VER" },
566#endif
567#ifdef _CONFIG_PAGESIZE
568 { _CONFIG_PAGESIZE, "_CONFIG_PAGESIZE" },
569#endif
570#ifdef _CONFIG_CLK_TCK
571 { _CONFIG_CLK_TCK, "_CONFIG_CLK_TCK" },
572#endif
573#ifdef _CONFIG_XOPEN_VER
574 { _CONFIG_XOPEN_VER, "_CONFIG_XOPEN_VER" },
575#endif
576#ifdef _CONFIG_PROF_TCK
577 { _CONFIG_PROF_TCK, "_CONFIG_PROF_TCK" },
578#endif
579#ifdef _CONFIG_NPROC_CONF
580 { _CONFIG_NPROC_CONF, "_CONFIG_NPROC_CONF" },
581#endif
582#ifdef _CONFIG_NPROC_ONLN
583 { _CONFIG_NPROC_ONLN, "_CONFIG_NPROC_ONLN" },
584#endif
585#ifdef _CONFIG_AIO_LISTIO_MAX
586 { _CONFIG_AIO_LISTIO_MAX, "_CONFIG_AIO_LISTIO_MAX" },
587#endif
588#ifdef _CONFIG_AIO_MAX
589 { _CONFIG_AIO_MAX, "_CONFIG_AIO_MAX" },
590#endif
591#ifdef _CONFIG_AIO_PRIO_DELTA_MAX
592 { _CONFIG_AIO_PRIO_DELTA_MAX, "_CONFIG_AIO_PRIO_DELTA_MAX" },
593#endif
594#ifdef _CONFIG_CONFIG_DELAYTIMER_MAX
595 { _CONFIG_DELAYTIMER_MAX, "_CONFIG_DELAYTIMER_MAX" },
596#endif
597#ifdef _CONFIG_MQ_OPEN_MAX
598 { _CONFIG_MQ_OPEN_MAX, "_CONFIG_MQ_OPEN_MAX" },
599#endif
600#ifdef _CONFIG_MQ_PRIO_MAX
601 { _CONFIG_MQ_PRIO_MAX, "_CONFIG_MQ_PRIO_MAX" },
602#endif
603#ifdef _CONFIG_RTSIG_MAX
604 { _CONFIG_RTSIG_MAX, "_CONFIG_RTSIG_MAX" },
605#endif
606#ifdef _CONFIG_SEM_NSEMS_MAX
607 { _CONFIG_SEM_NSEMS_MAX, "_CONFIG_SEM_NSEMS_MAX" },
608#endif
609#ifdef _CONFIG_SEM_VALUE_MAX
610 { _CONFIG_SEM_VALUE_MAX, "_CONFIG_SEM_VALUE_MAX" },
611#endif
612#ifdef _CONFIG_SIGQUEUE_MAX
613 { _CONFIG_SIGQUEUE_MAX, "_CONFIG_SIGQUEUE_MAX" },
614#endif
615#ifdef _CONFIG_SIGRT_MIN
616 { _CONFIG_SIGRT_MIN, "_CONFIG_SIGRT_MIN" },
617#endif
618#ifdef _CONFIG_SIGRT_MAX
619 { _CONFIG_SIGRT_MAX, "_CONFIG_SIGRT_MAX" },
620#endif
621#ifdef _CONFIG_TIMER_MAX
622 { _CONFIG_TIMER_MAX, "_CONFIG_TIMER_MAX" },
623#endif
624#ifdef _CONFIG_CONFIG_PHYS_PAGES
625 { _CONFIG_PHYS_PAGES, "_CONFIG_PHYS_PAGES" },
626#endif
627#ifdef _CONFIG_AVPHYS_PAGES
628 { _CONFIG_AVPHYS_PAGES, "_CONFIG_AVPHYS_PAGES" },
629#endif
630 { 0, NULL },
631};
632
633int
634sys_sysconfig(tcp)
635struct tcb *tcp;
636{
637 if (entering(tcp))
638 printxval(sysconfig_options, tcp->u_arg[0], "_CONFIG_???");
639 return 0;
640}
641
642static struct xlat sysinfo_options[] = {
643 { SI_SYSNAME, "SI_SYSNAME" },
644 { SI_HOSTNAME, "SI_HOSTNAME" },
645 { SI_RELEASE, "SI_RELEASE" },
646 { SI_VERSION, "SI_VERSION" },
647 { SI_MACHINE, "SI_MACHINE" },
648 { SI_ARCHITECTURE, "SI_ARCHITECTURE" },
649 { SI_HW_SERIAL, "SI_HW_SERIAL" },
650 { SI_HW_PROVIDER, "SI_HW_PROVIDER" },
651 { SI_SRPC_DOMAIN, "SI_SRPC_DOMAIN" },
652#ifdef SI_SET_HOSTNAME
653 { SI_SET_HOSTNAME, "SI_SET_HOSTNAME" },
654#endif
655#ifdef SI_SET_SRPC_DOMAIN
656 { SI_SET_SRPC_DOMAIN, "SI_SET_SRPC_DOMAIN" },
657#endif
658#ifdef SI_SET_KERB_REALM
659 { SI_SET_KERB_REALM, "SI_SET_KERB_REALM" },
660#endif
661#ifdef SI_KERB_REALM
662 { SI_KERB_REALM, "SI_KERB_REALM" },
663#endif
664 { 0, NULL },
665};
666
667int
668sys_sysinfo(tcp)
669struct tcb *tcp;
670{
671 if (entering(tcp)) {
672 printxval(sysinfo_options, tcp->u_arg[0], "SI_???");
673 tprintf(", ");
674 }
675 else {
676 /* Technically some calls write values. So what. */
677 if (syserror(tcp))
678 tprintf("%#lx", tcp->u_arg[1]);
679 else
680 printpath(tcp, tcp->u_arg[1]);
681 tprintf(", %lu", tcp->u_arg[2]);
682 }
683 return 0;
684}
685
686#ifdef MIPS
687
688#include <sys/syssgi.h>
689
690static struct xlat syssgi_options[] = {
691 { SGI_SYSID, "SGI_SYSID" },
692 { SGI_RDUBLK, "SGI_RDUBLK" },
693 { SGI_TUNE, "SGI_TUNE" },
694 { SGI_IDBG, "SGI_IDBG" },
695 { SGI_INVENT, "SGI_INVENT" },
696 { SGI_RDNAME, "SGI_RDNAME" },
697 { SGI_SETLED, "SGI_SETLED" },
698 { SGI_SETNVRAM, "SGI_SETNVRAM" },
699 { SGI_GETNVRAM, "SGI_GETNVRAM" },
700 { SGI_QUERY_FTIMER, "SGI_QUERY_FTIMER" },
701 { SGI_QUERY_CYCLECNTR, "SGI_QUERY_CYCLECNTR" },
702 { SGI_PROCSZ, "SGI_PROCSZ" },
703 { SGI_SIGACTION, "SGI_SIGACTION" },
704 { SGI_SIGPENDING, "SGI_SIGPENDING" },
705 { SGI_SIGPROCMASK, "SGI_SIGPROCMASK" },
706 { SGI_SIGSUSPEND, "SGI_SIGSUSPEND" },
707 { SGI_SETSID, "SGI_SETSID" },
708 { SGI_SETPGID, "SGI_SETPGID" },
709 { SGI_SYSCONF, "SGI_SYSCONF" },
710 { SGI_WAIT4, "SGI_WAIT4" },
711 { SGI_PATHCONF, "SGI_PATHCONF" },
712 { SGI_READB, "SGI_READB" },
713 { SGI_WRITEB, "SGI_WRITEB" },
714 { SGI_SETGROUPS, "SGI_SETGROUPS" },
715 { SGI_GETGROUPS, "SGI_GETGROUPS" },
716 { SGI_SETTIMEOFDAY, "SGI_SETTIMEOFDAY" },
717 { SGI_SETTIMETRIM, "SGI_SETTIMETRIM" },
718 { SGI_GETTIMETRIM, "SGI_GETTIMETRIM" },
719 { SGI_SPROFIL, "SGI_SPROFIL" },
720 { SGI_RUSAGE, "SGI_RUSAGE" },
721 { SGI_SIGSTACK, "SGI_SIGSTACK" },
722 { SGI_SIGSTATUS, "SGI_SIGSTATUS" },
723 { SGI_NETPROC, "SGI_NETPROC" },
724 { SGI_SIGALTSTACK, "SGI_SIGALTSTACK" },
725 { SGI_BDFLUSHCNT, "SGI_BDFLUSHCNT" },
726 { SGI_SSYNC, "SGI_SSYNC" },
727 { SGI_NFSCNVT, "SGI_NFSCNVT" },
728 { SGI_GETPGID, "SGI_GETPGID" },
729 { SGI_GETSID, "SGI_GETSID" },
730 { SGI_IOPROBE, "SGI_IOPROBE" },
731 { SGI_CONFIG, "SGI_CONFIG" },
732 { SGI_ELFMAP, "SGI_ELFMAP" },
733 { SGI_MCONFIG, "SGI_MCONFIG" },
734 { SGI_GETPLABEL, "SGI_GETPLABEL" },
735 { SGI_SETPLABEL, "SGI_SETPLABEL" },
736 { SGI_GETLABEL, "SGI_GETLABEL" },
737 { SGI_SETLABEL, "SGI_SETLABEL" },
738 { SGI_SATREAD, "SGI_SATREAD" },
739 { SGI_SATWRITE, "SGI_SATWRITE" },
740 { SGI_SATCTL, "SGI_SATCTL" },
741 { SGI_LOADATTR, "SGI_LOADATTR" },
742 { SGI_UNLOADATTR, "SGI_UNLOADATTR" },
743#ifdef SGI_RECVLMSG
744 { SGI_RECVLMSG, "SGI_RECVLMSG" },
745#endif
746 { SGI_PLANGMOUNT, "SGI_PLANGMOUNT" },
747 { SGI_GETPSOACL, "SGI_GETPSOACL" },
748 { SGI_SETPSOACL, "SGI_SETPSOACL" },
749 { SGI_RMI_FIXECC, "SGI_RMI_FIXECC" },
750 { SGI_R4K_CERRS, "SGI_R4K_CERRS" },
751 { SGI_GET_EVCONF, "SGI_GET_EVCONF" },
752 { SGI_MPCWAROFF, "SGI_MPCWAROFF" },
753 { SGI_SET_AUTOPWRON, "SGI_SET_AUTOPWRON" },
754 { SGI_SPIPE, "SGI_SPIPE" },
755 { SGI_SYMTAB, "SGI_SYMTAB" },
756#ifdef SGI_SET_FPDEBUG
757 { SGI_SET_FPDEBUG, "SGI_SET_FPDEBUG" },
758#endif
759 { SGI_TOSSTSAVE, "SGI_TOSSTSAVE" },
760 { SGI_FDHI, "SGI_FDHI" },
761 { SGI_MINRSS, "SGI_MINRSS" },
762 { 0, NULL },
763};
764
765int
766sys_syssgi(tcp)
767struct tcb *tcp;
768{
769 int i;
770
771 if (entering(tcp)) {
772 printxval(syssgi_options, tcp->u_arg[0], "SGI_???");
773 switch (tcp->u_arg[0]) {
774 default:
775 for (i = 1; i < tcp->u_nargs; i++)
776 tprintf(", %#lx", tcp->u_arg[i]);
777 break;
778 }
779 }
780 return 0;
781}
782
783#include <sys/types.h>
784#include <rpc/rpc.h>
785struct cred;
786struct uio;
787#include <sys/fsid.h>
788#include <sys/vnode.h>
789#include <sys/fs/nfs.h>
790#include <sys/fs/nfs_clnt.h>
791
792static struct xlat mount_flags[] = {
793 { MS_RDONLY, "MS_RDONLY" },
794 { MS_FSS, "MS_FSS" },
795 { MS_DATA, "MS_DATA" },
796 { MS_NOSUID, "MS_NOSUID" },
797 { MS_REMOUNT, "MS_REMOUNT" },
798 { MS_NOTRUNC, "MS_NOTRUNC" },
799 { MS_GRPID, "MS_GRPID" },
800 { MS_NODEV, "MS_NODEV" },
801 { MS_BEFORE, "MS_BEFORE" },
802 { MS_AFTER, "MS_AFTER" },
803 { 0, NULL },
804};
805
806static struct xlat nfs_flags[] = {
807 { NFSMNT_SOFT, "NFSMNT_SOFT" },
808 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
809 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
810 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
811 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
812 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
813 { NFSMNT_INT, "NFSMNT_INT" },
814 { NFSMNT_NOAC, "NFSMNT_NOAC" },
815 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
816 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
817 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
818 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
819 { NFSMNT_PRIVATE, "NFSMNT_PRIVATE" },
820 { NFSMNT_SYMTTL, "NFSMNT_SYMTTL" },
821 { NFSMNT_LOOPBACK, "NFSMNT_LOOPBACK" },
822 { NFSMNT_BASETYPE, "NFSMNT_BASETYPE" },
823 { NFSMNT_NAMEMAX, "NFSMNT_NAMEMAX" },
824 { 0, NULL },
825};
826
827int
828sys_mount(tcp)
829struct tcb *tcp;
830{
831 if (entering(tcp)) {
832 printpath(tcp, tcp->u_arg[0]);
833 tprintf(", ");
834 printpath(tcp, tcp->u_arg[1]);
835 tprintf(", ");
836 printflags(mount_flags, tcp->u_arg[2]);
837 if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
838 tprintf(", ");
839 tprintf("%ld", tcp->u_arg[3]);
840 }
841 if (tcp->u_arg[2] & MS_DATA) {
842 int nfs_type = sysfs(GETFSIND, FSID_NFS);
843
844 tprintf(", ");
845 if (tcp->u_arg[3] == nfs_type) {
846 struct nfs_args args;
847 if (umove(tcp, tcp->u_arg[4], &args) < 0)
848 tprintf("%#lx", tcp->u_arg[4]);
849 else {
850 tprintf("addr=");
851 printsock(tcp, (int) args.addr);
852 tprintf(", flags=");
853 if (!printflags(nfs_flags, args.flags))
854 tprintf("NFSMNT_???");
855 tprintf(", hostname=");
856 printstr(tcp, (int) args.hostname, -1);
857 tprintf(", ...}");
858 }
859 }
860 else
861 tprintf("%#lx", tcp->u_arg[4]);
862 tprintf(", %ld", tcp->u_arg[5]);
863 }
864 }
865 return 0;
866}
867
868#else /* !MIPS */
869
870int
871sys_mount(tcp)
872struct tcb *tcp;
873{
874 if (entering(tcp)) {
875 printpath(tcp, tcp->u_arg[0]);
876 tprintf(", ");
877 printpath(tcp, tcp->u_arg[1]);
878 tprintf(", ...");
879 }
880 return 0;
881}
882
883#endif /* !MIPS */
884
885#endif /* SVR4 */
886
887#ifdef __NR_capget
888int
889sys_capget(tcp)
890struct tcb *tcp;
891{
892 cap_user_header_t arg0;
893 cap_user_data_t arg1;
894
895 if(!entering(tcp)) {
896 arg0 = (cap_user_header_t)tcp->u_arg[0];
897 arg1 = (cap_user_data_t)tcp->u_arg[1];
898 tprintf("{%lx, %d}, ", (unsigned long)arg0->version, arg0->pid);
899 tprintf("{%lx, %lx, %lx}", (unsigned long)arg1->effective,
900 (unsigned long)arg1->permitted, (unsigned long)arg1->inheritable);
901 }
902 return 0;
903}
904
905int
906sys_capset(tcp)
907struct tcb *tcp;
908{
909 cap_user_header_t arg0;
910 cap_user_data_t arg1;
911
912 if(entering(tcp)) {
913 arg0 = (cap_user_header_t)tcp->u_arg[0];
914 arg1 = (cap_user_data_t)tcp->u_arg[1];
915 tprintf("{%lx, %d}, ", (unsigned long)arg0->version, arg0->pid);
916 tprintf("{%lx, %lx, %lx}", (unsigned long)arg1->effective,
917 (unsigned long)arg1->permitted, (unsigned long)arg1->inheritable);
918 }
919 return 0;
920}
921
922#else
923
924int sys_capget(tcp)
925struct tcb *tcp;
926{
927 return printargs(tcp);
928}
929
930int sys_capset(tcp)
931struct tcb *tcp;
932{
933 return printargs(tcp);
934}
935
936#endif
937