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>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
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.
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.
35 #define _LINUX_SOCKET_H
38 #define MS_RDONLY 1 /* Mount read-only */
39 #define MS_NOSUID 2 /* Ignore suid and sgid bits */
40 #define MS_NODEV 4 /* Disallow access to device special files */
41 #define MS_NOEXEC 8 /* Disallow program execution */
42 #define MS_SYNCHRONOUS 16 /* Writes are synced at once */
43 #define MS_REMOUNT 32 /* Alter flags of a mounted FS */
44 #define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */
45 #define MS_DIRSYNC 128 /* Directory modifications are synchronous */
46 #define MS_NOATIME 1024 /* Do not update access times. */
47 #define MS_NODIRATIME 2048 /* Do not update directory access times */
51 #define MS_SILENT 32768
52 #define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
53 #define MS_UNBINDABLE (1<<17) /* change to unbindable */
54 #define MS_PRIVATE (1<<18) /* change to private */
55 #define MS_SLAVE (1<<19) /* change to slave */
56 #define MS_SHARED (1<<20) /* change to shared */
57 #define MS_RELATIME (1<<21)
58 #define MS_KERNMOUNT (1<<22)
59 #define MS_I_VERSION (1<<23)
60 #define MS_STRICTATIME (1<<24)
61 #define MS_BORN (1<<29)
62 #define MS_ACTIVE (1<<30)
63 #define MS_NOUSER (1<<31)
64 #define MS_MGC_VAL 0xc0ed0000 /* Magic flag number */
65 #define MS_MGC_MSK 0xffff0000 /* Magic flag mask */
67 #include <sys/socket.h>
68 #include <netinet/in.h>
69 #include <arpa/inet.h>
71 #include <sys/syscall.h>
73 #ifdef HAVE_LINUX_CAPABILITY_H
74 #include <linux/capability.h>
77 #ifdef HAVE_ASM_CACHECTL_H
78 #include <asm/cachectl.h>
81 #ifdef HAVE_LINUX_USTNAME_H
82 #include <linux/utsname.h>
85 #ifdef HAVE_ASM_SYSMIPS_H
86 #include <asm/sysmips.h>
89 #include <linux/sysctl.h>
91 static const struct xlat mount_flags[] = {
92 { MS_MGC_VAL, "MS_MGC_VAL" },
93 { MS_RDONLY, "MS_RDONLY" },
94 { MS_NOSUID, "MS_NOSUID" },
95 { MS_NODEV, "MS_NODEV" },
96 { MS_NOEXEC, "MS_NOEXEC" },
97 { MS_SYNCHRONOUS,"MS_SYNCHRONOUS"},
98 { MS_REMOUNT, "MS_REMOUNT" },
99 { MS_RELATIME, "MS_RELATIME" },
100 { MS_KERNMOUNT, "MS_KERNMOUNT" },
101 { MS_I_VERSION, "MS_I_VERSION" },
102 { MS_STRICTATIME,"MS_STRICTATIME"},
103 { MS_BORN, "MS_BORN" },
104 { MS_MANDLOCK, "MS_MANDLOCK" },
105 { MS_NOATIME, "MS_NOATIME" },
106 { MS_NODIRATIME,"MS_NODIRATIME" },
107 { MS_BIND, "MS_BIND" },
108 { MS_MOVE, "MS_MOVE" },
109 { MS_REC, "MS_REC" },
110 { MS_SILENT, "MS_SILENT" },
111 { MS_POSIXACL, "MS_POSIXACL" },
112 { MS_UNBINDABLE,"MS_UNBINDABLE" },
113 { MS_PRIVATE, "MS_PRIVATE" },
114 { MS_SLAVE, "MS_SLAVE" },
115 { MS_SHARED, "MS_SHARED" },
116 { MS_ACTIVE, "MS_ACTIVE" },
117 { MS_NOUSER, "MS_NOUSER" },
122 sys_mount(struct tcb *tcp)
125 int ignore_type = 0, ignore_data = 0;
126 unsigned long flags = tcp->u_arg[3];
129 if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
130 flags &= ~MS_MGC_MSK;
132 if (flags & MS_REMOUNT)
134 else if (flags & (MS_BIND | MS_MOVE))
135 ignore_type = ignore_data = 1;
137 printpath(tcp, tcp->u_arg[0]);
140 printpath(tcp, tcp->u_arg[1]);
143 if (ignore_type && tcp->u_arg[2])
144 tprintf("%#lx", tcp->u_arg[2]);
146 printstr(tcp, tcp->u_arg[2], -1);
149 printflags(mount_flags, tcp->u_arg[3], "MS_???");
152 if (ignore_data && tcp->u_arg[4])
153 tprintf("%#lx", tcp->u_arg[4]);
155 printstr(tcp, tcp->u_arg[4], -1);
160 #define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */
161 #define MNT_DETACH 0x00000002 /* Just detach from the tree */
162 #define MNT_EXPIRE 0x00000004 /* Mark for expiry */
164 static const struct xlat umount_flags[] = {
165 { MNT_FORCE, "MNT_FORCE" },
166 { MNT_DETACH, "MNT_DETACH" },
167 { MNT_EXPIRE, "MNT_EXPIRE" },
172 sys_umount2(struct tcb *tcp)
175 printstr(tcp, tcp->u_arg[0], -1);
177 printflags(umount_flags, tcp->u_arg[1], "MNT_???");
182 /* These are not macros, but enums. We just copy the values by hand
183 from Linux 2.6.9 here. */
184 static const struct xlat personality_options[] = {
186 { 0x00800000, "PER_LINUX_32BIT"},
187 { 0x04100001, "PER_SVR4" },
188 { 0x05000002, "PER_SVR3" },
189 { 0x07000003, "PER_SCOSVR3" },
190 { 0x06000003, "PER_OSR5" },
191 { 0x05000004, "PER_WYSEV386" },
192 { 0x04000005, "PER_ISCR4" },
193 { 0x00000006, "PER_BSD" },
194 { 0x04000006, "PER_SUNOS" },
195 { 0x05000007, "PER_XENIX" },
196 { 0x00000008, "PER_LINUX32" },
197 { 0x08000008, "PER_LINUX32_3GB"},
198 { 0x04000009, "PER_IRIX32" },
199 { 0x0400000a, "PER_IRIXN32" },
200 { 0x0400000b, "PER_IRIX64" },
201 { 0x0000000c, "PER_RISCOS" },
202 { 0x0400000d, "PER_SOLARIS" },
203 { 0x0410000e, "PER_UW7" },
204 { 0x0000000f, "PER_OSF4" },
205 { 0x00000010, "PER_HPUX" },
210 sys_personality(struct tcb *tcp)
213 printxval(personality_options, tcp->u_arg[0], "PER_???");
218 SYSLOG_ACTION_CLOSE = 0,
221 SYSLOG_ACTION_READ_ALL,
222 SYSLOG_ACTION_READ_CLEAR,
224 SYSLOG_ACTION_CONSOLE_OFF,
225 SYSLOG_ACTION_CONSOLE_ON,
226 SYSLOG_ACTION_CONSOLE_LEVEL,
227 SYSLOG_ACTION_SIZE_UNREAD,
228 SYSLOG_ACTION_SIZE_BUFFER
231 static const struct xlat syslog_action_type[] = {
232 { SYSLOG_ACTION_CLOSE, "SYSLOG_ACTION_CLOSE" },
233 { SYSLOG_ACTION_OPEN, "SYSLOG_ACTION_OPEN" },
234 { SYSLOG_ACTION_READ, "SYSLOG_ACTION_READ" },
235 { SYSLOG_ACTION_READ_ALL, "SYSLOG_ACTION_READ_ALL" },
236 { SYSLOG_ACTION_READ_CLEAR, "SYSLOG_ACTION_READ_CLEAR" },
237 { SYSLOG_ACTION_CLEAR, "SYSLOG_ACTION_CLEAR" },
238 { SYSLOG_ACTION_CONSOLE_OFF, "SYSLOG_ACTION_CONSOLE_OFF" },
239 { SYSLOG_ACTION_CONSOLE_ON, "SYSLOG_ACTION_CONSOLE_ON" },
240 { SYSLOG_ACTION_CONSOLE_LEVEL, "SYSLOG_ACTION_CONSOLE_LEVEL" },
241 { SYSLOG_ACTION_SIZE_UNREAD, "SYSLOG_ACTION_SIZE_UNREAD" },
242 { SYSLOG_ACTION_SIZE_BUFFER, "SYSLOG_ACTION_SIZE_BUFFER" },
247 sys_syslog(struct tcb *tcp)
249 int type = tcp->u_arg[0];
253 printxval(syslog_action_type, type, "SYSLOG_ACTION_???");
258 case SYSLOG_ACTION_READ:
259 case SYSLOG_ACTION_READ_ALL:
260 case SYSLOG_ACTION_READ_CLEAR:
267 tcp->u_arg[1], tcp->u_arg[2]);
274 tprintf("%#lx", tcp->u_arg[1]);
276 printstr(tcp, tcp->u_arg[1], tcp->u_rval);
278 tprintf(", %d", (int) tcp->u_arg[2]);
283 #include <linux/reboot.h>
284 static const struct xlat bootflags1[] = {
285 { LINUX_REBOOT_MAGIC1, "LINUX_REBOOT_MAGIC1" },
289 static const struct xlat bootflags2[] = {
290 { LINUX_REBOOT_MAGIC2, "LINUX_REBOOT_MAGIC2" },
291 { LINUX_REBOOT_MAGIC2A, "LINUX_REBOOT_MAGIC2A" },
292 { LINUX_REBOOT_MAGIC2B, "LINUX_REBOOT_MAGIC2B" },
296 static const struct xlat bootflags3[] = {
297 { LINUX_REBOOT_CMD_CAD_OFF, "LINUX_REBOOT_CMD_CAD_OFF" },
298 { LINUX_REBOOT_CMD_RESTART, "LINUX_REBOOT_CMD_RESTART" },
299 { LINUX_REBOOT_CMD_HALT, "LINUX_REBOOT_CMD_HALT" },
300 { LINUX_REBOOT_CMD_CAD_ON, "LINUX_REBOOT_CMD_CAD_ON" },
301 { LINUX_REBOOT_CMD_POWER_OFF, "LINUX_REBOOT_CMD_POWER_OFF" },
302 { LINUX_REBOOT_CMD_RESTART2, "LINUX_REBOOT_CMD_RESTART2" },
307 sys_reboot(struct tcb *tcp)
310 printflags(bootflags1, tcp->u_arg[0], "LINUX_REBOOT_MAGIC_???");
312 printflags(bootflags2, tcp->u_arg[1], "LINUX_REBOOT_MAGIC_???");
314 printflags(bootflags3, tcp->u_arg[2], "LINUX_REBOOT_CMD_???");
315 if (tcp->u_arg[2] == LINUX_REBOOT_CMD_RESTART2) {
317 printstr(tcp, tcp->u_arg[3], -1);
324 static const struct xlat cacheflush_scope[] = {
325 #ifdef FLUSH_SCOPE_LINE
326 { FLUSH_SCOPE_LINE, "FLUSH_SCOPE_LINE" },
328 #ifdef FLUSH_SCOPE_PAGE
329 { FLUSH_SCOPE_PAGE, "FLUSH_SCOPE_PAGE" },
331 #ifdef FLUSH_SCOPE_ALL
332 { FLUSH_SCOPE_ALL, "FLUSH_SCOPE_ALL" },
337 static const struct xlat cacheflush_flags[] = {
338 #ifdef FLUSH_CACHE_BOTH
339 { FLUSH_CACHE_BOTH, "FLUSH_CACHE_BOTH" },
341 #ifdef FLUSH_CACHE_DATA
342 { FLUSH_CACHE_DATA, "FLUSH_CACHE_DATA" },
344 #ifdef FLUSH_CACHE_INSN
345 { FLUSH_CACHE_INSN, "FLUSH_CACHE_INSN" },
351 sys_cacheflush(struct tcb *tcp)
355 tprintf("%#lx, ", tcp->u_arg[0]);
357 printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
360 printflags(cacheflush_flags, tcp->u_arg[2], "FLUSH_CACHE_???");
362 tprintf(", %lu", tcp->u_arg[3]);
370 #include <bfin_sram.h>
372 static const struct xlat sram_alloc_flags[] = {
373 { L1_INST_SRAM, "L1_INST_SRAM" },
374 { L1_DATA_A_SRAM, "L1_DATA_A_SRAM" },
375 { L1_DATA_B_SRAM, "L1_DATA_B_SRAM" },
376 { L1_DATA_SRAM, "L1_DATA_SRAM" },
377 { L2_SRAM, "L2_SRAM" },
382 sys_sram_alloc(struct tcb *tcp)
386 tprintf("%lu, ", tcp->u_arg[0]);
388 printxval(sram_alloc_flags, tcp->u_arg[1], "???_SRAM");
393 #include <asm/cachectl.h>
395 static const struct xlat cacheflush_flags[] = {
396 { ICACHE, "ICACHE" },
397 { DCACHE, "DCACHE" },
398 { BCACHE, "BCACHE" },
403 sys_cacheflush(struct tcb *tcp)
407 tprintf("%#lx, ", tcp->u_arg[0]);
409 tprintf("%ld, ", tcp->u_arg[1]);
411 printxval(cacheflush_flags, tcp->u_arg[1], "?CACHE");
419 static const struct xlat cacheflush_flags[] = {
420 #ifdef CACHEFLUSH_D_INVAL
421 { CACHEFLUSH_D_INVAL, "CACHEFLUSH_D_INVAL" },
423 #ifdef CACHEFLUSH_D_WB
424 { CACHEFLUSH_D_WB, "CACHEFLUSH_D_WB" },
426 #ifdef CACHEFLUSH_D_PURGE
427 { CACHEFLUSH_D_PURGE, "CACHEFLUSH_D_PURGE" },
430 { CACHEFLUSH_I, "CACHEFLUSH_I" },
436 sys_cacheflush(struct tcb *tcp)
440 tprintf("%#lx, ", tcp->u_arg[0]);
442 tprintf("%lu, ", tcp->u_arg[1]);
444 printflags(cacheflush_flags, tcp->u_arg[2], "CACHEFLUSH_???");
452 static const struct xlat capabilities[] = {
453 { 1<<CAP_CHOWN, "CAP_CHOWN" },
454 { 1<<CAP_DAC_OVERRIDE, "CAP_DAC_OVERRIDE"},
455 { 1<<CAP_DAC_READ_SEARCH,"CAP_DAC_READ_SEARCH"},
456 { 1<<CAP_FOWNER, "CAP_FOWNER" },
457 { 1<<CAP_FSETID, "CAP_FSETID" },
458 { 1<<CAP_KILL, "CAP_KILL" },
459 { 1<<CAP_SETGID, "CAP_SETGID" },
460 { 1<<CAP_SETUID, "CAP_SETUID" },
461 { 1<<CAP_SETPCAP, "CAP_SETPCAP" },
462 { 1<<CAP_LINUX_IMMUTABLE,"CAP_LINUX_IMMUTABLE"},
463 { 1<<CAP_NET_BIND_SERVICE,"CAP_NET_BIND_SERVICE"},
464 { 1<<CAP_NET_BROADCAST, "CAP_NET_BROADCAST"},
465 { 1<<CAP_NET_ADMIN, "CAP_NET_ADMIN" },
466 { 1<<CAP_NET_RAW, "CAP_NET_RAW" },
467 { 1<<CAP_IPC_LOCK, "CAP_IPC_LOCK" },
468 { 1<<CAP_IPC_OWNER, "CAP_IPC_OWNER" },
469 { 1<<CAP_SYS_MODULE, "CAP_SYS_MODULE"},
470 { 1<<CAP_SYS_RAWIO, "CAP_SYS_RAWIO" },
471 { 1<<CAP_SYS_CHROOT, "CAP_SYS_CHROOT"},
472 { 1<<CAP_SYS_PTRACE, "CAP_SYS_PTRACE"},
473 { 1<<CAP_SYS_PACCT, "CAP_SYS_PACCT" },
474 { 1<<CAP_SYS_ADMIN, "CAP_SYS_ADMIN" },
475 { 1<<CAP_SYS_BOOT, "CAP_SYS_BOOT" },
476 { 1<<CAP_SYS_NICE, "CAP_SYS_NICE" },
477 { 1<<CAP_SYS_RESOURCE, "CAP_SYS_RESOURCE"},
478 { 1<<CAP_SYS_TIME, "CAP_SYS_TIME" },
479 { 1<<CAP_SYS_TTY_CONFIG,"CAP_SYS_TTY_CONFIG"},
481 { 1<<CAP_MKNOD, "CAP_MKNOD" },
484 { 1<<CAP_LEASE, "CAP_LEASE" },
486 #ifdef CAP_AUDIT_WRITE
487 { 1<<CAP_AUDIT_WRITE, "CAP_AUDIT_WRITE"},
489 #ifdef CAP_AUDIT_CONTROL
490 { 1<<CAP_AUDIT_CONTROL, "CAP_AUDIT_CONTROL"},
493 { 1<<CAP_SETFCAP, "CAP_SETFCAP" },
499 sys_capget(struct tcb *tcp)
501 /* cap_user_ types are _pointers_ to (small) structs. */
502 /* Structs themselves have no names defined. */
503 /* Have to use ugly hack to place them on stack. */
504 cap_user_header_t arg0;
505 cap_user_data_t arg1;
506 long a0[sizeof(*arg0) / sizeof(long) + 1];
507 long a1[sizeof(*arg1) / sizeof(long) + 1];
508 arg0 = (cap_user_header_t) a0;
509 arg1 = (cap_user_data_t ) a1;
511 if (!entering(tcp)) {
514 else if (!verbose(tcp))
515 tprintf("%#lx", tcp->u_arg[0]);
516 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
519 tprintf("%#x, %d", arg0->version, arg0->pid);
524 else if (!verbose(tcp))
525 tprintf("%#lx", tcp->u_arg[1]);
526 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
530 printflags(capabilities, arg1->effective, "CAP_???");
532 printflags(capabilities, arg1->permitted, "CAP_???");
534 printflags(capabilities, arg1->inheritable, "CAP_???");
542 sys_capset(struct tcb *tcp)
544 cap_user_header_t arg0;
545 cap_user_data_t arg1;
546 long a0[sizeof(*arg0) / sizeof(long) + 1];
547 long a1[sizeof(*arg1) / sizeof(long) + 1];
548 arg0 = (cap_user_header_t) a0;
549 arg1 = (cap_user_data_t ) a1;
554 else if (!verbose(tcp))
555 tprintf("%#lx", tcp->u_arg[0]);
556 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
559 tprintf("%#x, %d", arg0->version, arg0->pid);
564 else if (!verbose(tcp))
565 tprintf("%#lx", tcp->u_arg[1]);
566 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
570 printflags(capabilities, arg1->effective, "CAP_???");
572 printflags(capabilities, arg1->permitted, "CAP_???");
574 printflags(capabilities, arg1->inheritable, "CAP_???");
583 int sys_capget(struct tcb *tcp)
585 return printargs(tcp);
588 int sys_capset(struct tcb *tcp)
590 return printargs(tcp);
595 /* Linux 2.6.18+ headers removed CTL_PROC enum. */
597 # define CTL_CPU 10 /* older headers lack */
598 static const struct xlat sysctl_root[] = {
599 { CTL_KERN, "CTL_KERN" },
600 { CTL_VM, "CTL_VM" },
601 { CTL_NET, "CTL_NET" },
602 { CTL_PROC, "CTL_PROC" },
603 { CTL_FS, "CTL_FS" },
604 { CTL_DEBUG, "CTL_DEBUG" },
605 { CTL_DEV, "CTL_DEV" },
606 { CTL_BUS, "CTL_BUS" },
607 { CTL_ABI, "CTL_ABI" },
608 { CTL_CPU, "CTL_CPU" },
612 static const struct xlat sysctl_kern[] = {
613 { KERN_OSTYPE, "KERN_OSTYPE" },
614 { KERN_OSRELEASE, "KERN_OSRELEASE" },
615 { KERN_OSREV, "KERN_OSREV" },
616 { KERN_VERSION, "KERN_VERSION" },
617 { KERN_SECUREMASK, "KERN_SECUREMASK" },
618 { KERN_PROF, "KERN_PROF" },
619 { KERN_NODENAME, "KERN_NODENAME" },
620 { KERN_DOMAINNAME, "KERN_DOMAINNAME" },
621 #ifdef KERN_SECURELVL
622 { KERN_SECURELVL, "KERN_SECURELVL" },
624 { KERN_PANIC, "KERN_PANIC" },
625 #ifdef KERN_REALROOTDEV
626 { KERN_REALROOTDEV, "KERN_REALROOTDEV" },
628 #ifdef KERN_JAVA_INTERPRETER
629 { KERN_JAVA_INTERPRETER, "KERN_JAVA_INTERPRETER" },
631 #ifdef KERN_JAVA_APPLETVIEWER
632 { KERN_JAVA_APPLETVIEWER, "KERN_JAVA_APPLETVIEWER" },
634 { KERN_SPARC_REBOOT, "KERN_SPARC_REBOOT" },
635 { KERN_CTLALTDEL, "KERN_CTLALTDEL" },
636 { KERN_PRINTK, "KERN_PRINTK" },
637 { KERN_NAMETRANS, "KERN_NAMETRANS" },
638 { KERN_PPC_HTABRECLAIM, "KERN_PPC_HTABRECLAIM" },
639 { KERN_PPC_ZEROPAGED, "KERN_PPC_ZEROPAGED" },
640 { KERN_PPC_POWERSAVE_NAP, "KERN_PPC_POWERSAVE_NAP" },
641 { KERN_MODPROBE, "KERN_MODPROBE" },
642 { KERN_SG_BIG_BUFF, "KERN_SG_BIG_BUFF" },
643 { KERN_ACCT, "KERN_ACCT" },
644 { KERN_PPC_L2CR, "KERN_PPC_L2CR" },
645 { KERN_RTSIGNR, "KERN_RTSIGNR" },
646 { KERN_RTSIGMAX, "KERN_RTSIGMAX" },
647 { KERN_SHMMAX, "KERN_SHMMAX" },
648 { KERN_MSGMAX, "KERN_MSGMAX" },
649 { KERN_MSGMNB, "KERN_MSGMNB" },
650 { KERN_MSGPOOL, "KERN_MSGPOOL" },
654 static const struct xlat sysctl_vm[] = {
656 { VM_SWAPCTL, "VM_SWAPCTL" },
659 { VM_UNUSED1, "VM_UNUSED1" },
662 { VM_SWAPOUT, "VM_SWAPOUT" },
665 { VM_UNUSED2, "VM_UNUSED2" },
668 { VM_FREEPG, "VM_FREEPG" },
671 { VM_UNUSED3, "VM_UNUSED3" },
674 { VM_BDFLUSH, "VM_BDFLUSH" },
677 { VM_UNUSED4, "VM_UNUSED4" },
679 { VM_OVERCOMMIT_MEMORY, "VM_OVERCOMMIT_MEMORY" },
681 { VM_BUFFERMEM, "VM_BUFFERMEM" },
684 { VM_UNUSED5, "VM_UNUSED5" },
687 { VM_PAGECACHE, "VM_PAGECACHE" },
690 { VM_UNUSED7, "VM_UNUSED7" },
692 #ifdef VM_PAGERDAEMON
693 { VM_PAGERDAEMON, "VM_PAGERDAEMON" },
696 { VM_UNUSED8, "VM_UNUSED8" },
699 { VM_PGT_CACHE, "VM_PGT_CACHE" },
702 { VM_UNUSED9, "VM_UNUSED9" },
704 { VM_PAGE_CLUSTER, "VM_PAGE_CLUSTER" },
708 static const struct xlat sysctl_net[] = {
709 { NET_CORE, "NET_CORE" },
710 { NET_ETHER, "NET_ETHER" },
711 { NET_802, "NET_802" },
712 { NET_UNIX, "NET_UNIX" },
713 { NET_IPV4, "NET_IPV4" },
714 { NET_IPX, "NET_IPX" },
715 { NET_ATALK, "NET_ATALK" },
716 { NET_NETROM, "NET_NETROM" },
717 { NET_AX25, "NET_AX25" },
718 { NET_BRIDGE, "NET_BRIDGE" },
719 { NET_ROSE, "NET_ROSE" },
720 { NET_IPV6, "NET_IPV6" },
721 { NET_X25, "NET_X25" },
722 { NET_TR, "NET_TR" },
723 { NET_DECNET, "NET_DECNET" },
727 static const struct xlat sysctl_net_core[] = {
728 { NET_CORE_WMEM_MAX, "NET_CORE_WMEM_MAX" },
729 { NET_CORE_RMEM_MAX, "NET_CORE_RMEM_MAX" },
730 { NET_CORE_WMEM_DEFAULT, "NET_CORE_WMEM_DEFAULT" },
731 { NET_CORE_RMEM_DEFAULT, "NET_CORE_RMEM_DEFAULT" },
732 { NET_CORE_MAX_BACKLOG, "NET_CORE_MAX_BACKLOG" },
733 { NET_CORE_FASTROUTE, "NET_CORE_FASTROUTE" },
734 { NET_CORE_MSG_COST, "NET_CORE_MSG_COST" },
735 { NET_CORE_MSG_BURST, "NET_CORE_MSG_BURST" },
736 { NET_CORE_OPTMEM_MAX, "NET_CORE_OPTMEM_MAX" },
740 static const struct xlat sysctl_net_unix[] = {
741 { NET_UNIX_DESTROY_DELAY, "NET_UNIX_DESTROY_DELAY" },
742 { NET_UNIX_DELETE_DELAY, "NET_UNIX_DELETE_DELAY" },
746 static const struct xlat sysctl_net_ipv4[] = {
747 { NET_IPV4_FORWARD, "NET_IPV4_FORWARD" },
748 { NET_IPV4_DYNADDR, "NET_IPV4_DYNADDR" },
749 { NET_IPV4_CONF, "NET_IPV4_CONF" },
750 { NET_IPV4_NEIGH, "NET_IPV4_NEIGH" },
751 { NET_IPV4_ROUTE, "NET_IPV4_ROUTE" },
752 { NET_IPV4_FIB_HASH, "NET_IPV4_FIB_HASH" },
753 { NET_IPV4_TCP_TIMESTAMPS, "NET_IPV4_TCP_TIMESTAMPS" },
754 { NET_IPV4_TCP_WINDOW_SCALING, "NET_IPV4_TCP_WINDOW_SCALING" },
755 { NET_IPV4_TCP_SACK, "NET_IPV4_TCP_SACK" },
756 { NET_IPV4_TCP_RETRANS_COLLAPSE, "NET_IPV4_TCP_RETRANS_COLLAPSE" },
757 { NET_IPV4_DEFAULT_TTL, "NET_IPV4_DEFAULT_TTL" },
758 { NET_IPV4_AUTOCONFIG, "NET_IPV4_AUTOCONFIG" },
759 { NET_IPV4_NO_PMTU_DISC, "NET_IPV4_NO_PMTU_DISC" },
760 { NET_IPV4_TCP_SYN_RETRIES, "NET_IPV4_TCP_SYN_RETRIES" },
761 { NET_IPV4_IPFRAG_HIGH_THRESH, "NET_IPV4_IPFRAG_HIGH_THRESH" },
762 { NET_IPV4_IPFRAG_LOW_THRESH, "NET_IPV4_IPFRAG_LOW_THRESH" },
763 { NET_IPV4_IPFRAG_TIME, "NET_IPV4_IPFRAG_TIME" },
764 { NET_IPV4_TCP_MAX_KA_PROBES, "NET_IPV4_TCP_MAX_KA_PROBES" },
765 { NET_IPV4_TCP_KEEPALIVE_TIME, "NET_IPV4_TCP_KEEPALIVE_TIME" },
766 { NET_IPV4_TCP_KEEPALIVE_PROBES, "NET_IPV4_TCP_KEEPALIVE_PROBES" },
767 { NET_IPV4_TCP_RETRIES1, "NET_IPV4_TCP_RETRIES1" },
768 { NET_IPV4_TCP_RETRIES2, "NET_IPV4_TCP_RETRIES2" },
769 { NET_IPV4_TCP_FIN_TIMEOUT, "NET_IPV4_TCP_FIN_TIMEOUT" },
770 { NET_IPV4_IP_MASQ_DEBUG, "NET_IPV4_IP_MASQ_DEBUG" },
771 { NET_TCP_SYNCOOKIES, "NET_TCP_SYNCOOKIES" },
772 { NET_TCP_STDURG, "NET_TCP_STDURG" },
773 { NET_TCP_RFC1337, "NET_TCP_RFC1337" },
774 { NET_TCP_SYN_TAILDROP, "NET_TCP_SYN_TAILDROP" },
775 { NET_TCP_MAX_SYN_BACKLOG, "NET_TCP_MAX_SYN_BACKLOG" },
776 { NET_IPV4_LOCAL_PORT_RANGE, "NET_IPV4_LOCAL_PORT_RANGE" },
777 { NET_IPV4_ICMP_ECHO_IGNORE_ALL, "NET_IPV4_ICMP_ECHO_IGNORE_ALL" },
778 { NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS" },
779 { NET_IPV4_ICMP_SOURCEQUENCH_RATE, "NET_IPV4_ICMP_SOURCEQUENCH_RATE" },
780 { NET_IPV4_ICMP_DESTUNREACH_RATE, "NET_IPV4_ICMP_DESTUNREACH_RATE" },
781 { NET_IPV4_ICMP_TIMEEXCEED_RATE, "NET_IPV4_ICMP_TIMEEXCEED_RATE" },
782 { NET_IPV4_ICMP_PARAMPROB_RATE, "NET_IPV4_ICMP_PARAMPROB_RATE" },
783 { NET_IPV4_ICMP_ECHOREPLY_RATE, "NET_IPV4_ICMP_ECHOREPLY_RATE" },
784 { NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES" },
785 { NET_IPV4_IGMP_MAX_MEMBERSHIPS, "NET_IPV4_IGMP_MAX_MEMBERSHIPS" },
789 static const struct xlat sysctl_net_ipv4_route[] = {
790 { NET_IPV4_ROUTE_FLUSH, "NET_IPV4_ROUTE_FLUSH" },
791 { NET_IPV4_ROUTE_MIN_DELAY, "NET_IPV4_ROUTE_MIN_DELAY" },
792 { NET_IPV4_ROUTE_MAX_DELAY, "NET_IPV4_ROUTE_MAX_DELAY" },
793 { NET_IPV4_ROUTE_GC_THRESH, "NET_IPV4_ROUTE_GC_THRESH" },
794 { NET_IPV4_ROUTE_MAX_SIZE, "NET_IPV4_ROUTE_MAX_SIZE" },
795 { NET_IPV4_ROUTE_GC_MIN_INTERVAL, "NET_IPV4_ROUTE_GC_MIN_INTERVAL" },
796 { NET_IPV4_ROUTE_GC_TIMEOUT, "NET_IPV4_ROUTE_GC_TIMEOUT" },
797 { NET_IPV4_ROUTE_GC_INTERVAL, "NET_IPV4_ROUTE_GC_INTERVAL" },
798 { NET_IPV4_ROUTE_REDIRECT_LOAD, "NET_IPV4_ROUTE_REDIRECT_LOAD" },
799 { NET_IPV4_ROUTE_REDIRECT_NUMBER, "NET_IPV4_ROUTE_REDIRECT_NUMBER" },
800 { NET_IPV4_ROUTE_REDIRECT_SILENCE, "NET_IPV4_ROUTE_REDIRECT_SILENCE" },
801 { NET_IPV4_ROUTE_ERROR_COST, "NET_IPV4_ROUTE_ERROR_COST" },
802 { NET_IPV4_ROUTE_ERROR_BURST, "NET_IPV4_ROUTE_ERROR_BURST" },
803 { NET_IPV4_ROUTE_GC_ELASTICITY, "NET_IPV4_ROUTE_GC_ELASTICITY" },
807 static const struct xlat sysctl_net_ipv4_conf[] = {
808 { NET_IPV4_CONF_FORWARDING, "NET_IPV4_CONF_FORWARDING" },
809 { NET_IPV4_CONF_MC_FORWARDING, "NET_IPV4_CONF_MC_FORWARDING" },
810 { NET_IPV4_CONF_PROXY_ARP, "NET_IPV4_CONF_PROXY_ARP" },
811 { NET_IPV4_CONF_ACCEPT_REDIRECTS, "NET_IPV4_CONF_ACCEPT_REDIRECTS" },
812 { NET_IPV4_CONF_SECURE_REDIRECTS, "NET_IPV4_CONF_SECURE_REDIRECTS" },
813 { NET_IPV4_CONF_SEND_REDIRECTS, "NET_IPV4_CONF_SEND_REDIRECTS" },
814 { NET_IPV4_CONF_SHARED_MEDIA, "NET_IPV4_CONF_SHARED_MEDIA" },
815 { NET_IPV4_CONF_RP_FILTER, "NET_IPV4_CONF_RP_FILTER" },
816 { NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, "NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE" },
817 { NET_IPV4_CONF_BOOTP_RELAY, "NET_IPV4_CONF_BOOTP_RELAY" },
818 { NET_IPV4_CONF_LOG_MARTIANS, "NET_IPV4_CONF_LOG_MARTIANS" },
822 static const struct xlat sysctl_net_ipv6[] = {
823 { NET_IPV6_CONF, "NET_IPV6_CONF" },
824 { NET_IPV6_NEIGH, "NET_IPV6_NEIGH" },
825 { NET_IPV6_ROUTE, "NET_IPV6_ROUTE" },
829 static const struct xlat sysctl_net_ipv6_route[] = {
830 { NET_IPV6_ROUTE_FLUSH, "NET_IPV6_ROUTE_FLUSH" },
831 { NET_IPV6_ROUTE_GC_THRESH, "NET_IPV6_ROUTE_GC_THRESH" },
832 { NET_IPV6_ROUTE_MAX_SIZE, "NET_IPV6_ROUTE_MAX_SIZE" },
833 { NET_IPV6_ROUTE_GC_MIN_INTERVAL, "NET_IPV6_ROUTE_GC_MIN_INTERVAL" },
834 { NET_IPV6_ROUTE_GC_TIMEOUT, "NET_IPV6_ROUTE_GC_TIMEOUT" },
835 { NET_IPV6_ROUTE_GC_INTERVAL, "NET_IPV6_ROUTE_GC_INTERVAL" },
836 { NET_IPV6_ROUTE_GC_ELASTICITY, "NET_IPV6_ROUTE_GC_ELASTICITY" },
841 sys_sysctl(struct tcb *tcp)
843 struct __sysctl_args info;
847 if (umove(tcp, tcp->u_arg[0], &info) < 0)
848 return printargs(tcp);
850 size = sizeof(int) * (unsigned long) info.nlen;
851 name = (size / sizeof(int) != info.nlen) ? NULL : malloc(size);
853 umoven(tcp, (unsigned long) info.name, size, (char *) name) < 0) {
856 tprintf("{%p, %d, %p, %p, %p, %Zu}",
857 info.name, info.nlen, info.oldval,
858 info.oldlenp, info.newval, info.newlen);
863 int cnt = 0, max_cnt;
869 printxval(sysctl_root, name[0], "CTL_???");
877 printxval(sysctl_kern, name[1], "KERN_???");
882 printxval(sysctl_vm, name[1], "VM_???");
887 printxval(sysctl_net, name[1], "NET_???");
895 printxval(sysctl_net_core, name[2],
900 printxval(sysctl_net_unix, name[2],
905 printxval(sysctl_net_ipv4, name[2],
913 printxval(sysctl_net_ipv4_route,
915 "NET_IPV4_ROUTE_???");
919 printxval(sysctl_net_ipv4_conf,
921 "NET_IPV4_CONF_???");
929 printxval(sysctl_net_ipv6, name[2],
937 printxval(sysctl_net_ipv6_route,
939 "NET_IPV6_ROUTE_???");
954 if (abbrev(tcp) && max_cnt > max_strlen)
955 max_cnt = max_strlen;
956 while (cnt < max_cnt)
957 tprintf(", %x", name[cnt++]);
960 tprintf("}, %d, ", info.nlen);
963 if (umove(tcp, (size_t)info.oldlenp, &oldlen) >= 0
965 && ((name[0] == CTL_KERN
966 && (name[1] == KERN_OSRELEASE
967 || name[1] == KERN_OSTYPE
968 #ifdef KERN_JAVA_INTERPRETER
969 || name[1] == KERN_JAVA_INTERPRETER
971 #ifdef KERN_JAVA_APPLETVIEWER
972 || name[1] == KERN_JAVA_APPLETVIEWER
975 printpath(tcp, (size_t)info.oldval);
976 tprintf(", %Zu, ", oldlen);
977 if (info.newval == 0)
979 else if (syserror(tcp))
980 tprintf("%p", info.newval);
982 printpath(tcp, (size_t)info.newval);
983 tprintf(", %Zd", info.newlen);
985 tprintf("%p, %Zd, %p, %Zd", info.oldval, oldlen,
986 info.newval, info.newlen);
997 #ifndef __NEW_UTS_LEN
998 #define __NEW_UTS_LEN 64
1001 static const struct xlat sysmips_operations[] = {
1002 { SETNAME, "SETNAME" },
1003 { FLUSH_CACHE, "FLUSH_CACHE" },
1004 { MIPS_FIXADE, "MIPS_FIXADE" },
1005 { MIPS_RDNVRAM, "MIPS_RDNVRAM" },
1006 { MIPS_ATOMIC_SET, "MIPS_ATOMIC_SET" },
1010 int sys_sysmips(struct tcb *tcp)
1012 if (entering(tcp)) {
1013 printxval(sysmips_operations, tcp->u_arg[0], "???");
1014 if (!verbose(tcp)) {
1015 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
1016 } else if (tcp->u_arg[0] == SETNAME) {
1017 char nodename[__NEW_UTS_LEN + 1];
1018 if (umovestr(tcp, tcp->u_arg[1], (__NEW_UTS_LEN + 1), nodename) < 0)
1019 tprintf(", %#lx", tcp->u_arg[1]);
1021 tprintf(", \"%.*s\"", (int)(__NEW_UTS_LEN + 1), nodename);
1022 } else if (tcp->u_arg[0] == MIPS_ATOMIC_SET) {
1023 tprintf(", %#lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
1024 } else if (tcp->u_arg[0] == MIPS_FIXADE) {
1025 tprintf(", 0x%lx", tcp->u_arg[1]);
1027 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);