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