blob: 48d06e286fb2b48737c0904dc025492ac596ce16 [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
75#ifdef HAVE_ASM_SYSMIPS_H
76#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[] = {
1629 { VM_SWAPCTL, "VM_SWAPCTL" },
1630 { VM_SWAPOUT, "VM_SWAPOUT" },
1631 { VM_FREEPG, "VM_FREEPG" },
1632 { VM_BDFLUSH, "VM_BDFLUSH" },
1633 { VM_OVERCOMMIT_MEMORY, "VM_OVERCOMMIT_MEMORY" },
1634 { VM_BUFFERMEM, "VM_BUFFERMEM" },
1635 { VM_PAGECACHE, "VM_PAGECACHE" },
1636 { VM_PAGERDAEMON, "VM_PAGERDAEMON" },
1637 { VM_PGT_CACHE, "VM_PGT_CACHE" },
1638 { VM_PAGE_CLUSTER, "VM_PAGE_CLUSTER" },
1639 { 0, NULL },
1640};
1641
1642static struct xlat sysctl_net[] = {
1643 { NET_CORE, "NET_CORE" },
1644 { NET_ETHER, "NET_ETHER" },
1645 { NET_802, "NET_802" },
1646 { NET_UNIX, "NET_UNIX" },
1647 { NET_IPV4, "NET_IPV4" },
1648 { NET_IPX, "NET_IPX" },
1649 { NET_ATALK, "NET_ATALK" },
1650 { NET_NETROM, "NET_NETROM" },
1651 { NET_AX25, "NET_AX25" },
1652 { NET_BRIDGE, "NET_BRIDGE" },
1653 { NET_ROSE, "NET_ROSE" },
1654 { NET_IPV6, "NET_IPV6" },
1655 { NET_X25, "NET_X25" },
1656 { NET_TR, "NET_TR" },
1657 { NET_DECNET, "NET_DECNET" },
1658 { 0, NULL }
1659};
1660
1661static struct xlat sysctl_net_core[] = {
1662 { NET_CORE_WMEM_MAX, "NET_CORE_WMEM_MAX" },
1663 { NET_CORE_RMEM_MAX, "NET_CORE_RMEM_MAX" },
1664 { NET_CORE_WMEM_DEFAULT, "NET_CORE_WMEM_DEFAULT" },
1665 { NET_CORE_RMEM_DEFAULT, "NET_CORE_RMEM_DEFAULT" },
1666 { NET_CORE_MAX_BACKLOG, "NET_CORE_MAX_BACKLOG" },
1667 { NET_CORE_FASTROUTE, "NET_CORE_FASTROUTE" },
1668 { NET_CORE_MSG_COST, "NET_CORE_MSG_COST" },
1669 { NET_CORE_MSG_BURST, "NET_CORE_MSG_BURST" },
1670 { NET_CORE_OPTMEM_MAX, "NET_CORE_OPTMEM_MAX" },
1671 { 0, NULL }
1672};
1673
1674static struct xlat sysctl_net_unix[] = {
1675 { NET_UNIX_DESTROY_DELAY, "NET_UNIX_DESTROY_DELAY" },
1676 { NET_UNIX_DELETE_DELAY, "NET_UNIX_DELETE_DELAY" },
1677 { 0, NULL }
1678};
1679
1680static struct xlat sysctl_net_ipv4[] = {
1681 { NET_IPV4_FORWARD, "NET_IPV4_FORWARD" },
1682 { NET_IPV4_DYNADDR, "NET_IPV4_DYNADDR" },
1683 { NET_IPV4_CONF, "NET_IPV4_CONF" },
1684 { NET_IPV4_NEIGH, "NET_IPV4_NEIGH" },
1685 { NET_IPV4_ROUTE, "NET_IPV4_ROUTE" },
1686 { NET_IPV4_FIB_HASH, "NET_IPV4_FIB_HASH" },
1687 { NET_IPV4_TCP_TIMESTAMPS, "NET_IPV4_TCP_TIMESTAMPS" },
1688 { NET_IPV4_TCP_WINDOW_SCALING, "NET_IPV4_TCP_WINDOW_SCALING" },
1689 { NET_IPV4_TCP_SACK, "NET_IPV4_TCP_SACK" },
1690 { NET_IPV4_TCP_RETRANS_COLLAPSE, "NET_IPV4_TCP_RETRANS_COLLAPSE" },
1691 { NET_IPV4_DEFAULT_TTL, "NET_IPV4_DEFAULT_TTL" },
1692 { NET_IPV4_AUTOCONFIG, "NET_IPV4_AUTOCONFIG" },
1693 { NET_IPV4_NO_PMTU_DISC, "NET_IPV4_NO_PMTU_DISC" },
1694 { NET_IPV4_TCP_SYN_RETRIES, "NET_IPV4_TCP_SYN_RETRIES" },
1695 { NET_IPV4_IPFRAG_HIGH_THRESH, "NET_IPV4_IPFRAG_HIGH_THRESH" },
1696 { NET_IPV4_IPFRAG_LOW_THRESH, "NET_IPV4_IPFRAG_LOW_THRESH" },
1697 { NET_IPV4_IPFRAG_TIME, "NET_IPV4_IPFRAG_TIME" },
1698 { NET_IPV4_TCP_MAX_KA_PROBES, "NET_IPV4_TCP_MAX_KA_PROBES" },
1699 { NET_IPV4_TCP_KEEPALIVE_TIME, "NET_IPV4_TCP_KEEPALIVE_TIME" },
1700 { NET_IPV4_TCP_KEEPALIVE_PROBES, "NET_IPV4_TCP_KEEPALIVE_PROBES" },
1701 { NET_IPV4_TCP_RETRIES1, "NET_IPV4_TCP_RETRIES1" },
1702 { NET_IPV4_TCP_RETRIES2, "NET_IPV4_TCP_RETRIES2" },
1703 { NET_IPV4_TCP_FIN_TIMEOUT, "NET_IPV4_TCP_FIN_TIMEOUT" },
1704 { NET_IPV4_IP_MASQ_DEBUG, "NET_IPV4_IP_MASQ_DEBUG" },
1705 { NET_TCP_SYNCOOKIES, "NET_TCP_SYNCOOKIES" },
1706 { NET_TCP_STDURG, "NET_TCP_STDURG" },
1707 { NET_TCP_RFC1337, "NET_TCP_RFC1337" },
1708 { NET_TCP_SYN_TAILDROP, "NET_TCP_SYN_TAILDROP" },
1709 { NET_TCP_MAX_SYN_BACKLOG, "NET_TCP_MAX_SYN_BACKLOG" },
1710 { NET_IPV4_LOCAL_PORT_RANGE, "NET_IPV4_LOCAL_PORT_RANGE" },
1711 { NET_IPV4_ICMP_ECHO_IGNORE_ALL, "NET_IPV4_ICMP_ECHO_IGNORE_ALL" },
1712 { NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS" },
1713 { NET_IPV4_ICMP_SOURCEQUENCH_RATE, "NET_IPV4_ICMP_SOURCEQUENCH_RATE" },
1714 { NET_IPV4_ICMP_DESTUNREACH_RATE, "NET_IPV4_ICMP_DESTUNREACH_RATE" },
1715 { NET_IPV4_ICMP_TIMEEXCEED_RATE, "NET_IPV4_ICMP_TIMEEXCEED_RATE" },
1716 { NET_IPV4_ICMP_PARAMPROB_RATE, "NET_IPV4_ICMP_PARAMPROB_RATE" },
1717 { NET_IPV4_ICMP_ECHOREPLY_RATE, "NET_IPV4_ICMP_ECHOREPLY_RATE" },
1718 { NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES" },
1719 { NET_IPV4_IGMP_MAX_MEMBERSHIPS, "NET_IPV4_IGMP_MAX_MEMBERSHIPS" },
1720 { 0, NULL }
1721};
1722
1723static struct xlat sysctl_net_ipv4_route[] = {
1724 { NET_IPV4_ROUTE_FLUSH, "NET_IPV4_ROUTE_FLUSH" },
1725 { NET_IPV4_ROUTE_MIN_DELAY, "NET_IPV4_ROUTE_MIN_DELAY" },
1726 { NET_IPV4_ROUTE_MAX_DELAY, "NET_IPV4_ROUTE_MAX_DELAY" },
1727 { NET_IPV4_ROUTE_GC_THRESH, "NET_IPV4_ROUTE_GC_THRESH" },
1728 { NET_IPV4_ROUTE_MAX_SIZE, "NET_IPV4_ROUTE_MAX_SIZE" },
1729 { NET_IPV4_ROUTE_GC_MIN_INTERVAL, "NET_IPV4_ROUTE_GC_MIN_INTERVAL" },
1730 { NET_IPV4_ROUTE_GC_TIMEOUT, "NET_IPV4_ROUTE_GC_TIMEOUT" },
1731 { NET_IPV4_ROUTE_GC_INTERVAL, "NET_IPV4_ROUTE_GC_INTERVAL" },
1732 { NET_IPV4_ROUTE_REDIRECT_LOAD, "NET_IPV4_ROUTE_REDIRECT_LOAD" },
1733 { NET_IPV4_ROUTE_REDIRECT_NUMBER, "NET_IPV4_ROUTE_REDIRECT_NUMBER" },
1734 { NET_IPV4_ROUTE_REDIRECT_SILENCE, "NET_IPV4_ROUTE_REDIRECT_SILENCE" },
1735 { NET_IPV4_ROUTE_ERROR_COST, "NET_IPV4_ROUTE_ERROR_COST" },
1736 { NET_IPV4_ROUTE_ERROR_BURST, "NET_IPV4_ROUTE_ERROR_BURST" },
1737 { NET_IPV4_ROUTE_GC_ELASTICITY, "NET_IPV4_ROUTE_GC_ELASTICITY" },
1738 { 0, NULL }
1739};
1740
1741static struct xlat sysctl_net_ipv4_conf[] = {
1742 { NET_IPV4_CONF_FORWARDING, "NET_IPV4_CONF_FORWARDING" },
1743 { NET_IPV4_CONF_MC_FORWARDING, "NET_IPV4_CONF_MC_FORWARDING" },
1744 { NET_IPV4_CONF_PROXY_ARP, "NET_IPV4_CONF_PROXY_ARP" },
1745 { NET_IPV4_CONF_ACCEPT_REDIRECTS, "NET_IPV4_CONF_ACCEPT_REDIRECTS" },
1746 { NET_IPV4_CONF_SECURE_REDIRECTS, "NET_IPV4_CONF_SECURE_REDIRECTS" },
1747 { NET_IPV4_CONF_SEND_REDIRECTS, "NET_IPV4_CONF_SEND_REDIRECTS" },
1748 { NET_IPV4_CONF_SHARED_MEDIA, "NET_IPV4_CONF_SHARED_MEDIA" },
1749 { NET_IPV4_CONF_RP_FILTER, "NET_IPV4_CONF_RP_FILTER" },
1750 { NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, "NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE" },
1751 { NET_IPV4_CONF_BOOTP_RELAY, "NET_IPV4_CONF_BOOTP_RELAY" },
1752 { NET_IPV4_CONF_LOG_MARTIANS, "NET_IPV4_CONF_LOG_MARTIANS" },
1753 { 0, NULL }
1754};
1755
1756static struct xlat sysctl_net_ipv6[] = {
1757 { NET_IPV6_CONF, "NET_IPV6_CONF" },
1758 { NET_IPV6_NEIGH, "NET_IPV6_NEIGH" },
1759 { NET_IPV6_ROUTE, "NET_IPV6_ROUTE" },
1760 { 0, NULL }
1761};
1762
1763static struct xlat sysctl_net_ipv6_route[] = {
1764 { NET_IPV6_ROUTE_FLUSH, "NET_IPV6_ROUTE_FLUSH" },
1765 { NET_IPV6_ROUTE_GC_THRESH, "NET_IPV6_ROUTE_GC_THRESH" },
1766 { NET_IPV6_ROUTE_MAX_SIZE, "NET_IPV6_ROUTE_MAX_SIZE" },
1767 { NET_IPV6_ROUTE_GC_MIN_INTERVAL, "NET_IPV6_ROUTE_GC_MIN_INTERVAL" },
1768 { NET_IPV6_ROUTE_GC_TIMEOUT, "NET_IPV6_ROUTE_GC_TIMEOUT" },
1769 { NET_IPV6_ROUTE_GC_INTERVAL, "NET_IPV6_ROUTE_GC_INTERVAL" },
1770 { NET_IPV6_ROUTE_GC_ELASTICITY, "NET_IPV6_ROUTE_GC_ELASTICITY" },
1771 { 0, NULL }
1772};
1773
1774int
1775sys_sysctl(tcp)
1776struct tcb *tcp;
1777{
1778 struct __sysctl_args info;
1779 int *name;
1780 umove (tcp, tcp->u_arg[0], &info);
1781
1782 name = alloca (sizeof (int) * info.nlen);
1783 umoven(tcp, (size_t) info.name, sizeof (int) * info.nlen, (char *) name);
1784
1785 if (entering(tcp)) {
1786 int cnt = 0;
1787
1788 tprintf("{{");
1789
1790 if (info.nlen == 0)
1791 goto out;
1792 printxval(sysctl_root, name[0], "CTL_???");
1793 ++cnt;
1794
1795 if (info.nlen == 1)
1796 goto out;
1797 switch (name[0]) {
1798 case CTL_KERN:
1799 tprintf(", ");
1800 printxval(sysctl_kern, name[1], "KERN_???");
1801 ++cnt;
1802 break;
1803 case CTL_VM:
1804 tprintf(", ");
1805 printxval(sysctl_vm, name[1], "VM_???");
1806 ++cnt;
1807 break;
1808 case CTL_NET:
1809 tprintf(", ");
1810 printxval(sysctl_net, name[1], "NET_???");
1811 ++cnt;
1812
1813 if (info.nlen == 2)
1814 goto out;
1815 switch (name[1]) {
1816 case NET_CORE:
1817 tprintf(", ");
1818 printxval(sysctl_net_core, name[2],
1819 "NET_CORE_???");
1820 break;
1821 case NET_UNIX:
1822 tprintf(", ");
1823 printxval(sysctl_net_unix, name[2],
1824 "NET_UNIX_???");
1825 break;
1826 case NET_IPV4:
1827 tprintf(", ");
1828 printxval(sysctl_net_ipv4, name[2],
1829 "NET_IPV4_???");
1830
1831 if (info.nlen == 3)
1832 goto out;
1833 switch (name[2]) {
1834 case NET_IPV4_ROUTE:
1835 tprintf(", ");
1836 printxval(sysctl_net_ipv4_route,
1837 name[3],
1838 "NET_IPV4_ROUTE_???");
1839 break;
1840 case NET_IPV4_CONF:
1841 tprintf(", ");
1842 printxval(sysctl_net_ipv4_conf,
1843 name[3],
1844 "NET_IPV4_CONF_???");
1845 break;
1846 default:
1847 goto out;
1848 }
1849 break;
1850 case NET_IPV6:
1851 tprintf(", ");
1852 printxval(sysctl_net_ipv6, name[2],
1853 "NET_IPV6_???");
1854
1855 if (info.nlen == 3)
1856 goto out;
1857 switch (name[2]) {
1858 case NET_IPV6_ROUTE:
1859 tprintf(", ");
1860 printxval(sysctl_net_ipv6_route,
1861 name[3],
1862 "NET_IPV6_ROUTE_???");
1863 break;
1864 default:
1865 goto out;
1866 }
1867 break;
1868 default:
1869 goto out;
1870 }
1871 break;
1872 default:
1873 goto out;
1874 }
1875 out:
1876 while (cnt < info.nlen)
1877 tprintf(", %x", name[cnt++]);
1878 tprintf("}, %d, ", info.nlen);
1879 } else {
1880 size_t oldlen;
1881 umove(tcp, (size_t)info.oldlenp, &oldlen);
1882 if (info.nlen >= 2
1883 && ((name[0] == CTL_KERN
1884 && (name[1] == KERN_OSRELEASE
1885 || name[1] == KERN_OSTYPE
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001886#ifdef KERN_JAVA_INTERPRETER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001887 || name[1] == KERN_JAVA_INTERPRETER
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001888#endif
1889#ifdef KERN_JAVA_APPLETVIEWER
1890 || name[1] == KERN_JAVA_APPLETVIEWER
1891#endif
1892 )))) {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001893 printpath(tcp, (size_t)info.oldval);
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001894 tprintf(", %Zu, ", oldlen);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001895 if (info.newval == 0)
1896 tprintf("NULL");
1897 else if (syserror(tcp))
1898 tprintf("%p", info.newval);
1899 else
1900 printpath(tcp, (size_t)info.newval);
1901 tprintf(", %Zd", info.newlen);
1902 } else {
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00001903 tprintf("%p, %Zd, %p, %Zd", info.oldval, oldlen,
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001904 info.newval, info.newlen);
1905 }
1906 tprintf("}");
1907 }
1908 return 0;
1909}
1910#else
1911int sys_sysctl(tcp)
1912struct tcb *tcp;
1913{
1914 return printargs(tcp);
1915}
1916#endif
1917
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00001918#ifdef FREEBSD
1919#include <sys/sysctl.h>
1920
1921int sys___sysctl(tcp)
1922struct tcb *tcp;
1923{
1924 int qoid[CTL_MAXNAME+2];
1925 char ctl[1024];
1926 size_t len;
1927 int i, numeric;
1928
1929 if (entering(tcp)) {
1930 if (tcp->u_arg[1] < 0 || tcp->u_arg[1] > CTL_MAXNAME ||
1931 (umoven(tcp, tcp->u_arg[0], tcp->u_arg[1] * sizeof(int),
1932 (char *) (qoid + 2)) < 0))
1933 tprintf("[...], ");
1934 else {
1935 /* Use sysctl to ask the name of the current MIB
1936 This uses the undocumented "Staff-functions" used
1937 by the sysctl program. See kern_sysctl.c for
1938 details. */
1939 qoid[0] = 0; /* sysctl */
1940 qoid[1] = 1; /* name */
1941 i = sizeof(ctl);
1942 tprintf("[");
1943 if (sysctl(qoid, tcp->u_arg[1] + 2, ctl, &i, 0, 0) >= 0) {
1944 numeric = !abbrev(tcp);
1945 tprintf("%s%s", ctl, numeric ? ", " : "");
1946 } else
1947 numeric = 1;
1948 if (numeric) {
1949 for (i = 0; i < tcp->u_arg[1]; i++)
1950 tprintf("%s%d", i ? "." : "", qoid[i + 2]);
1951 }
1952 tprintf("], ");
1953 tprintf("%lu, ", tcp->u_arg[1]);
1954 }
1955 } else {
1956 if (!syserror(tcp) && (umove(tcp, tcp->u_arg[3], &len) >= 0)) {
1957 printstr(tcp, tcp->u_arg[2], len);
1958 tprintf(", [%u], ", len);
1959 } else
1960 tprintf("%#lx, %#lx, ", tcp->u_arg[2], tcp->u_arg[3]);
1961 printstr(tcp, tcp->u_arg[4], tcp->u_arg[5]);
1962 tprintf(", %lu", tcp->u_arg[5]);
1963 }
1964 return 0;
1965}
1966#endif
Wichert Akkerman16a03d22000-08-10 02:14:04 +00001967
1968#if UNIXWARE >= 2
1969
1970#include <sys/ksym.h>
1971#include <sys/elf.h>
1972
1973static struct xlat ksym_flags[] = {
1974 { STT_NOTYPE, "STT_NOTYPE" },
1975 { STT_FUNC, "STT_FUNC" },
1976 { STT_OBJECT, "STT_OBJECT" },
1977 { 0, NULL },
1978};
1979
1980int
1981sys_getksym(tcp)
1982struct tcb *tcp;
1983{
1984 if (entering (tcp)) {
1985 printstr(tcp, tcp->u_arg[0], -1);
1986 tprintf(", ");
1987 }
1988 else {
1989 if (syserror(tcp)) {
1990 tprintf("%#lx, %#lx",
1991 tcp->u_arg[1], tcp->u_arg[2]);
1992 }
1993 else {
1994 int val;
1995 printnum (tcp, tcp->u_arg[1], "%#lx");
1996 tprintf(", ");
1997 if (umove(tcp, tcp->u_arg[2], &val) < 0) {
1998 tprintf("%#lx", tcp->u_arg[2]);
1999 }
2000 else {
2001 tprintf("[");
2002 printxval (ksym_flags, val, "STT_???");
2003 tprintf("]");
2004 }
2005 }
2006 }
2007
2008 return 0;
2009}
2010
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002011#endif /* UNIXWARE > 2 */
2012
2013#ifdef MIPS
2014
Wichert Akkermand6b92492001-04-07 21:37:12 +00002015#ifndef __NEW_UTS_LEN
2016#define __NEW_UTS_LEN 64
2017#endif
2018
2019static struct xlat xlat_sysmips[] = {
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002020 { SETNAME, "SETNAME" },
2021 { FLUSH_CACHE, "FLUSH_CACHE" },
2022 { MIPS_FIXADE, "MIPS_FIXADE" },
2023 { MIPS_RDNVRAM, "MIPS_RDNVRAM" },
2024 { MIPS_ATOMIC_SET, "MIPS_ATOMIC_SET" },
2025 { 0, NULL }
2026};
2027
2028int sys_sysmips(tcp)
2029struct tcb *tcp;
2030{
2031 if (entering(tcp)) {
2032 printxval(xlat_sysmips, tcp->u_arg[0], "???");
2033 tprintf(", ");
2034 if (!verbose(tcp)) {
2035 tprintf("%d, %d, %d", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2036 } else if (tcp->u_arg[0]==SETNAME) {
2037 char nodename[__NEW_UTS_LEN_1];
2038 if (umovestr(tcp, tcp->u_arg[1], (__NEW_UTS_LEN_1), nodename) < 0)
2039 tprintf(", %#lx", tcp->u_arg[1]);
2040 else
2041 tprintf(", \"%s\"", nodename);
2042 } else if (tcp->u_arg[0]==MIPS_ATOMIC_SET) {
2043 tprintf(", %#lx, 0x%x", tcp->u_arg[1], tcp->u_arg[2]);
2044 } else if (tcp->u_arg[0]==MIPS_FIXADE) {
2045 tprintf(", 0x%x", tcp->u_arg[1]);
2046 } else {
2047 tprintf("%d, %d, %d", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2048 }
2049 }
2050
2051 return 0;
2052}
2053
2054#endif /* MIPS */