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_???");
217 #include <linux/reboot.h>
218 static const struct xlat bootflags1[] = {
219 { LINUX_REBOOT_MAGIC1, "LINUX_REBOOT_MAGIC1" },
223 static const struct xlat bootflags2[] = {
224 { LINUX_REBOOT_MAGIC2, "LINUX_REBOOT_MAGIC2" },
225 { LINUX_REBOOT_MAGIC2A, "LINUX_REBOOT_MAGIC2A" },
226 { LINUX_REBOOT_MAGIC2B, "LINUX_REBOOT_MAGIC2B" },
230 static const struct xlat bootflags3[] = {
231 { LINUX_REBOOT_CMD_CAD_OFF, "LINUX_REBOOT_CMD_CAD_OFF" },
232 { LINUX_REBOOT_CMD_RESTART, "LINUX_REBOOT_CMD_RESTART" },
233 { LINUX_REBOOT_CMD_HALT, "LINUX_REBOOT_CMD_HALT" },
234 { LINUX_REBOOT_CMD_CAD_ON, "LINUX_REBOOT_CMD_CAD_ON" },
235 { LINUX_REBOOT_CMD_POWER_OFF, "LINUX_REBOOT_CMD_POWER_OFF" },
236 { LINUX_REBOOT_CMD_RESTART2, "LINUX_REBOOT_CMD_RESTART2" },
241 sys_reboot(struct tcb *tcp)
244 printflags(bootflags1, tcp->u_arg[0], "LINUX_REBOOT_MAGIC_???");
246 printflags(bootflags2, tcp->u_arg[1], "LINUX_REBOOT_MAGIC_???");
248 printflags(bootflags3, tcp->u_arg[2], "LINUX_REBOOT_CMD_???");
249 if (tcp->u_arg[2] == LINUX_REBOOT_CMD_RESTART2) {
251 printstr(tcp, tcp->u_arg[3], -1);
258 static const struct xlat cacheflush_scope[] = {
259 #ifdef FLUSH_SCOPE_LINE
260 { FLUSH_SCOPE_LINE, "FLUSH_SCOPE_LINE" },
262 #ifdef FLUSH_SCOPE_PAGE
263 { FLUSH_SCOPE_PAGE, "FLUSH_SCOPE_PAGE" },
265 #ifdef FLUSH_SCOPE_ALL
266 { FLUSH_SCOPE_ALL, "FLUSH_SCOPE_ALL" },
271 static const struct xlat cacheflush_flags[] = {
272 #ifdef FLUSH_CACHE_BOTH
273 { FLUSH_CACHE_BOTH, "FLUSH_CACHE_BOTH" },
275 #ifdef FLUSH_CACHE_DATA
276 { FLUSH_CACHE_DATA, "FLUSH_CACHE_DATA" },
278 #ifdef FLUSH_CACHE_INSN
279 { FLUSH_CACHE_INSN, "FLUSH_CACHE_INSN" },
285 sys_cacheflush(struct tcb *tcp)
289 tprintf("%#lx, ", tcp->u_arg[0]);
291 printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
294 printflags(cacheflush_flags, tcp->u_arg[2], "FLUSH_CACHE_???");
296 tprintf(", %lu", tcp->u_arg[3]);
304 #include <bfin_sram.h>
306 static const struct xlat sram_alloc_flags[] = {
307 { L1_INST_SRAM, "L1_INST_SRAM" },
308 { L1_DATA_A_SRAM, "L1_DATA_A_SRAM" },
309 { L1_DATA_B_SRAM, "L1_DATA_B_SRAM" },
310 { L1_DATA_SRAM, "L1_DATA_SRAM" },
311 { L2_SRAM, "L2_SRAM" },
316 sys_sram_alloc(struct tcb *tcp)
320 tprintf("%lu, ", tcp->u_arg[0]);
322 printxval(sram_alloc_flags, tcp->u_arg[1], "???_SRAM");
327 #include <asm/cachectl.h>
329 static const struct xlat cacheflush_flags[] = {
330 { ICACHE, "ICACHE" },
331 { DCACHE, "DCACHE" },
332 { BCACHE, "BCACHE" },
337 sys_cacheflush(struct tcb *tcp)
341 tprintf("%#lx, ", tcp->u_arg[0]);
343 tprintf("%ld, ", tcp->u_arg[1]);
345 printxval(cacheflush_flags, tcp->u_arg[1], "?CACHE");
353 static const struct xlat cacheflush_flags[] = {
354 #ifdef CACHEFLUSH_D_INVAL
355 { CACHEFLUSH_D_INVAL, "CACHEFLUSH_D_INVAL" },
357 #ifdef CACHEFLUSH_D_WB
358 { CACHEFLUSH_D_WB, "CACHEFLUSH_D_WB" },
360 #ifdef CACHEFLUSH_D_PURGE
361 { CACHEFLUSH_D_PURGE, "CACHEFLUSH_D_PURGE" },
364 { CACHEFLUSH_I, "CACHEFLUSH_I" },
370 sys_cacheflush(struct tcb *tcp)
374 tprintf("%#lx, ", tcp->u_arg[0]);
376 tprintf("%lu, ", tcp->u_arg[1]);
378 printflags(cacheflush_flags, tcp->u_arg[2], "CACHEFLUSH_???");
390 static const struct xlat capabilities[] = {
391 { 1<<CAP_CHOWN, "CAP_CHOWN" },
392 { 1<<CAP_DAC_OVERRIDE, "CAP_DAC_OVERRIDE"},
393 { 1<<CAP_DAC_READ_SEARCH,"CAP_DAC_READ_SEARCH"},
394 { 1<<CAP_FOWNER, "CAP_FOWNER" },
395 { 1<<CAP_FSETID, "CAP_FSETID" },
396 { 1<<CAP_KILL, "CAP_KILL" },
397 { 1<<CAP_SETGID, "CAP_SETGID" },
398 { 1<<CAP_SETUID, "CAP_SETUID" },
399 { 1<<CAP_SETPCAP, "CAP_SETPCAP" },
400 { 1<<CAP_LINUX_IMMUTABLE,"CAP_LINUX_IMMUTABLE"},
401 { 1<<CAP_NET_BIND_SERVICE,"CAP_NET_BIND_SERVICE"},
402 { 1<<CAP_NET_BROADCAST, "CAP_NET_BROADCAST"},
403 { 1<<CAP_NET_ADMIN, "CAP_NET_ADMIN" },
404 { 1<<CAP_NET_RAW, "CAP_NET_RAW" },
405 { 1<<CAP_IPC_LOCK, "CAP_IPC_LOCK" },
406 { 1<<CAP_IPC_OWNER, "CAP_IPC_OWNER" },
407 { 1<<CAP_SYS_MODULE, "CAP_SYS_MODULE"},
408 { 1<<CAP_SYS_RAWIO, "CAP_SYS_RAWIO" },
409 { 1<<CAP_SYS_CHROOT, "CAP_SYS_CHROOT"},
410 { 1<<CAP_SYS_PTRACE, "CAP_SYS_PTRACE"},
411 { 1<<CAP_SYS_PACCT, "CAP_SYS_PACCT" },
412 { 1<<CAP_SYS_ADMIN, "CAP_SYS_ADMIN" },
413 { 1<<CAP_SYS_BOOT, "CAP_SYS_BOOT" },
414 { 1<<CAP_SYS_NICE, "CAP_SYS_NICE" },
415 { 1<<CAP_SYS_RESOURCE, "CAP_SYS_RESOURCE"},
416 { 1<<CAP_SYS_TIME, "CAP_SYS_TIME" },
417 { 1<<CAP_SYS_TTY_CONFIG,"CAP_SYS_TTY_CONFIG"},
419 { 1<<CAP_MKNOD, "CAP_MKNOD" },
422 { 1<<CAP_LEASE, "CAP_LEASE" },
424 #ifdef CAP_AUDIT_WRITE
425 { 1<<CAP_AUDIT_WRITE, "CAP_AUDIT_WRITE"},
427 #ifdef CAP_AUDIT_CONTROL
428 { 1<<CAP_AUDIT_CONTROL, "CAP_AUDIT_CONTROL"},
431 { 1<<CAP_SETFCAP, "CAP_SETFCAP" },
438 sys_capget(struct tcb *tcp)
440 /* cap_user_ types are _pointers_ to (small) structs. */
441 /* Structs themselves have no names defined. */
442 /* Have to use ugly hack to place them on stack. */
443 cap_user_header_t arg0;
444 cap_user_data_t arg1;
445 long a0[sizeof(*arg0) / sizeof(long) + 1];
446 long a1[sizeof(*arg1) / sizeof(long) + 1];
447 arg0 = (cap_user_header_t) a0;
448 arg1 = (cap_user_data_t ) a1;
450 if (!entering(tcp)) {
453 else if (!verbose(tcp))
454 tprintf("%#lx", tcp->u_arg[0]);
455 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
458 tprintf("%#x, %d", arg0->version, arg0->pid);
463 else if (!verbose(tcp))
464 tprintf("%#lx", tcp->u_arg[1]);
465 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
469 printflags(capabilities, arg1->effective, "CAP_???");
471 printflags(capabilities, arg1->permitted, "CAP_???");
473 printflags(capabilities, arg1->inheritable, "CAP_???");
481 sys_capset(struct tcb *tcp)
483 cap_user_header_t arg0;
484 cap_user_data_t arg1;
485 long a0[sizeof(*arg0) / sizeof(long) + 1];
486 long a1[sizeof(*arg1) / sizeof(long) + 1];
487 arg0 = (cap_user_header_t) a0;
488 arg1 = (cap_user_data_t ) a1;
493 else if (!verbose(tcp))
494 tprintf("%#lx", tcp->u_arg[0]);
495 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
498 tprintf("%#x, %d", arg0->version, arg0->pid);
503 else if (!verbose(tcp))
504 tprintf("%#lx", tcp->u_arg[1]);
505 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
509 printflags(capabilities, arg1->effective, "CAP_???");
511 printflags(capabilities, arg1->permitted, "CAP_???");
513 printflags(capabilities, arg1->inheritable, "CAP_???");
522 int sys_capget(struct tcb *tcp)
524 return printargs(tcp);
527 int sys_capset(struct tcb *tcp)
529 return printargs(tcp);
534 /* Linux 2.6.18+ headers removed CTL_PROC enum. */
536 # define CTL_CPU 10 /* older headers lack */
537 static const struct xlat sysctl_root[] = {
538 { CTL_KERN, "CTL_KERN" },
539 { CTL_VM, "CTL_VM" },
540 { CTL_NET, "CTL_NET" },
541 { CTL_PROC, "CTL_PROC" },
542 { CTL_FS, "CTL_FS" },
543 { CTL_DEBUG, "CTL_DEBUG" },
544 { CTL_DEV, "CTL_DEV" },
545 { CTL_BUS, "CTL_BUS" },
546 { CTL_ABI, "CTL_ABI" },
547 { CTL_CPU, "CTL_CPU" },
551 static const struct xlat sysctl_kern[] = {
552 { KERN_OSTYPE, "KERN_OSTYPE" },
553 { KERN_OSRELEASE, "KERN_OSRELEASE" },
554 { KERN_OSREV, "KERN_OSREV" },
555 { KERN_VERSION, "KERN_VERSION" },
556 { KERN_SECUREMASK, "KERN_SECUREMASK" },
557 { KERN_PROF, "KERN_PROF" },
558 { KERN_NODENAME, "KERN_NODENAME" },
559 { KERN_DOMAINNAME, "KERN_DOMAINNAME" },
560 #ifdef KERN_SECURELVL
561 { KERN_SECURELVL, "KERN_SECURELVL" },
563 { KERN_PANIC, "KERN_PANIC" },
564 #ifdef KERN_REALROOTDEV
565 { KERN_REALROOTDEV, "KERN_REALROOTDEV" },
567 #ifdef KERN_JAVA_INTERPRETER
568 { KERN_JAVA_INTERPRETER, "KERN_JAVA_INTERPRETER" },
570 #ifdef KERN_JAVA_APPLETVIEWER
571 { KERN_JAVA_APPLETVIEWER, "KERN_JAVA_APPLETVIEWER" },
573 { KERN_SPARC_REBOOT, "KERN_SPARC_REBOOT" },
574 { KERN_CTLALTDEL, "KERN_CTLALTDEL" },
575 { KERN_PRINTK, "KERN_PRINTK" },
576 { KERN_NAMETRANS, "KERN_NAMETRANS" },
577 { KERN_PPC_HTABRECLAIM, "KERN_PPC_HTABRECLAIM" },
578 { KERN_PPC_ZEROPAGED, "KERN_PPC_ZEROPAGED" },
579 { KERN_PPC_POWERSAVE_NAP, "KERN_PPC_POWERSAVE_NAP" },
580 { KERN_MODPROBE, "KERN_MODPROBE" },
581 { KERN_SG_BIG_BUFF, "KERN_SG_BIG_BUFF" },
582 { KERN_ACCT, "KERN_ACCT" },
583 { KERN_PPC_L2CR, "KERN_PPC_L2CR" },
584 { KERN_RTSIGNR, "KERN_RTSIGNR" },
585 { KERN_RTSIGMAX, "KERN_RTSIGMAX" },
586 { KERN_SHMMAX, "KERN_SHMMAX" },
587 { KERN_MSGMAX, "KERN_MSGMAX" },
588 { KERN_MSGMNB, "KERN_MSGMNB" },
589 { KERN_MSGPOOL, "KERN_MSGPOOL" },
593 static const struct xlat sysctl_vm[] = {
595 { VM_SWAPCTL, "VM_SWAPCTL" },
598 { VM_UNUSED1, "VM_UNUSED1" },
601 { VM_SWAPOUT, "VM_SWAPOUT" },
604 { VM_UNUSED2, "VM_UNUSED2" },
607 { VM_FREEPG, "VM_FREEPG" },
610 { VM_UNUSED3, "VM_UNUSED3" },
613 { VM_BDFLUSH, "VM_BDFLUSH" },
616 { VM_UNUSED4, "VM_UNUSED4" },
618 { VM_OVERCOMMIT_MEMORY, "VM_OVERCOMMIT_MEMORY" },
620 { VM_BUFFERMEM, "VM_BUFFERMEM" },
623 { VM_UNUSED5, "VM_UNUSED5" },
626 { VM_PAGECACHE, "VM_PAGECACHE" },
629 { VM_UNUSED7, "VM_UNUSED7" },
631 #ifdef VM_PAGERDAEMON
632 { VM_PAGERDAEMON, "VM_PAGERDAEMON" },
635 { VM_UNUSED8, "VM_UNUSED8" },
638 { VM_PGT_CACHE, "VM_PGT_CACHE" },
641 { VM_UNUSED9, "VM_UNUSED9" },
643 { VM_PAGE_CLUSTER, "VM_PAGE_CLUSTER" },
647 static const struct xlat sysctl_net[] = {
648 { NET_CORE, "NET_CORE" },
649 { NET_ETHER, "NET_ETHER" },
650 { NET_802, "NET_802" },
651 { NET_UNIX, "NET_UNIX" },
652 { NET_IPV4, "NET_IPV4" },
653 { NET_IPX, "NET_IPX" },
654 { NET_ATALK, "NET_ATALK" },
655 { NET_NETROM, "NET_NETROM" },
656 { NET_AX25, "NET_AX25" },
657 { NET_BRIDGE, "NET_BRIDGE" },
658 { NET_ROSE, "NET_ROSE" },
659 { NET_IPV6, "NET_IPV6" },
660 { NET_X25, "NET_X25" },
661 { NET_TR, "NET_TR" },
662 { NET_DECNET, "NET_DECNET" },
666 static const struct xlat sysctl_net_core[] = {
667 { NET_CORE_WMEM_MAX, "NET_CORE_WMEM_MAX" },
668 { NET_CORE_RMEM_MAX, "NET_CORE_RMEM_MAX" },
669 { NET_CORE_WMEM_DEFAULT, "NET_CORE_WMEM_DEFAULT" },
670 { NET_CORE_RMEM_DEFAULT, "NET_CORE_RMEM_DEFAULT" },
671 { NET_CORE_MAX_BACKLOG, "NET_CORE_MAX_BACKLOG" },
672 { NET_CORE_FASTROUTE, "NET_CORE_FASTROUTE" },
673 { NET_CORE_MSG_COST, "NET_CORE_MSG_COST" },
674 { NET_CORE_MSG_BURST, "NET_CORE_MSG_BURST" },
675 { NET_CORE_OPTMEM_MAX, "NET_CORE_OPTMEM_MAX" },
679 static const struct xlat sysctl_net_unix[] = {
680 { NET_UNIX_DESTROY_DELAY, "NET_UNIX_DESTROY_DELAY" },
681 { NET_UNIX_DELETE_DELAY, "NET_UNIX_DELETE_DELAY" },
685 static const struct xlat sysctl_net_ipv4[] = {
686 { NET_IPV4_FORWARD, "NET_IPV4_FORWARD" },
687 { NET_IPV4_DYNADDR, "NET_IPV4_DYNADDR" },
688 { NET_IPV4_CONF, "NET_IPV4_CONF" },
689 { NET_IPV4_NEIGH, "NET_IPV4_NEIGH" },
690 { NET_IPV4_ROUTE, "NET_IPV4_ROUTE" },
691 { NET_IPV4_FIB_HASH, "NET_IPV4_FIB_HASH" },
692 { NET_IPV4_TCP_TIMESTAMPS, "NET_IPV4_TCP_TIMESTAMPS" },
693 { NET_IPV4_TCP_WINDOW_SCALING, "NET_IPV4_TCP_WINDOW_SCALING" },
694 { NET_IPV4_TCP_SACK, "NET_IPV4_TCP_SACK" },
695 { NET_IPV4_TCP_RETRANS_COLLAPSE, "NET_IPV4_TCP_RETRANS_COLLAPSE" },
696 { NET_IPV4_DEFAULT_TTL, "NET_IPV4_DEFAULT_TTL" },
697 { NET_IPV4_AUTOCONFIG, "NET_IPV4_AUTOCONFIG" },
698 { NET_IPV4_NO_PMTU_DISC, "NET_IPV4_NO_PMTU_DISC" },
699 { NET_IPV4_TCP_SYN_RETRIES, "NET_IPV4_TCP_SYN_RETRIES" },
700 { NET_IPV4_IPFRAG_HIGH_THRESH, "NET_IPV4_IPFRAG_HIGH_THRESH" },
701 { NET_IPV4_IPFRAG_LOW_THRESH, "NET_IPV4_IPFRAG_LOW_THRESH" },
702 { NET_IPV4_IPFRAG_TIME, "NET_IPV4_IPFRAG_TIME" },
703 { NET_IPV4_TCP_MAX_KA_PROBES, "NET_IPV4_TCP_MAX_KA_PROBES" },
704 { NET_IPV4_TCP_KEEPALIVE_TIME, "NET_IPV4_TCP_KEEPALIVE_TIME" },
705 { NET_IPV4_TCP_KEEPALIVE_PROBES, "NET_IPV4_TCP_KEEPALIVE_PROBES" },
706 { NET_IPV4_TCP_RETRIES1, "NET_IPV4_TCP_RETRIES1" },
707 { NET_IPV4_TCP_RETRIES2, "NET_IPV4_TCP_RETRIES2" },
708 { NET_IPV4_TCP_FIN_TIMEOUT, "NET_IPV4_TCP_FIN_TIMEOUT" },
709 { NET_IPV4_IP_MASQ_DEBUG, "NET_IPV4_IP_MASQ_DEBUG" },
710 { NET_TCP_SYNCOOKIES, "NET_TCP_SYNCOOKIES" },
711 { NET_TCP_STDURG, "NET_TCP_STDURG" },
712 { NET_TCP_RFC1337, "NET_TCP_RFC1337" },
713 { NET_TCP_SYN_TAILDROP, "NET_TCP_SYN_TAILDROP" },
714 { NET_TCP_MAX_SYN_BACKLOG, "NET_TCP_MAX_SYN_BACKLOG" },
715 { NET_IPV4_LOCAL_PORT_RANGE, "NET_IPV4_LOCAL_PORT_RANGE" },
716 { NET_IPV4_ICMP_ECHO_IGNORE_ALL, "NET_IPV4_ICMP_ECHO_IGNORE_ALL" },
717 { NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS" },
718 { NET_IPV4_ICMP_SOURCEQUENCH_RATE, "NET_IPV4_ICMP_SOURCEQUENCH_RATE" },
719 { NET_IPV4_ICMP_DESTUNREACH_RATE, "NET_IPV4_ICMP_DESTUNREACH_RATE" },
720 { NET_IPV4_ICMP_TIMEEXCEED_RATE, "NET_IPV4_ICMP_TIMEEXCEED_RATE" },
721 { NET_IPV4_ICMP_PARAMPROB_RATE, "NET_IPV4_ICMP_PARAMPROB_RATE" },
722 { NET_IPV4_ICMP_ECHOREPLY_RATE, "NET_IPV4_ICMP_ECHOREPLY_RATE" },
723 { NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES" },
724 { NET_IPV4_IGMP_MAX_MEMBERSHIPS, "NET_IPV4_IGMP_MAX_MEMBERSHIPS" },
728 static const struct xlat sysctl_net_ipv4_route[] = {
729 { NET_IPV4_ROUTE_FLUSH, "NET_IPV4_ROUTE_FLUSH" },
730 { NET_IPV4_ROUTE_MIN_DELAY, "NET_IPV4_ROUTE_MIN_DELAY" },
731 { NET_IPV4_ROUTE_MAX_DELAY, "NET_IPV4_ROUTE_MAX_DELAY" },
732 { NET_IPV4_ROUTE_GC_THRESH, "NET_IPV4_ROUTE_GC_THRESH" },
733 { NET_IPV4_ROUTE_MAX_SIZE, "NET_IPV4_ROUTE_MAX_SIZE" },
734 { NET_IPV4_ROUTE_GC_MIN_INTERVAL, "NET_IPV4_ROUTE_GC_MIN_INTERVAL" },
735 { NET_IPV4_ROUTE_GC_TIMEOUT, "NET_IPV4_ROUTE_GC_TIMEOUT" },
736 { NET_IPV4_ROUTE_GC_INTERVAL, "NET_IPV4_ROUTE_GC_INTERVAL" },
737 { NET_IPV4_ROUTE_REDIRECT_LOAD, "NET_IPV4_ROUTE_REDIRECT_LOAD" },
738 { NET_IPV4_ROUTE_REDIRECT_NUMBER, "NET_IPV4_ROUTE_REDIRECT_NUMBER" },
739 { NET_IPV4_ROUTE_REDIRECT_SILENCE, "NET_IPV4_ROUTE_REDIRECT_SILENCE" },
740 { NET_IPV4_ROUTE_ERROR_COST, "NET_IPV4_ROUTE_ERROR_COST" },
741 { NET_IPV4_ROUTE_ERROR_BURST, "NET_IPV4_ROUTE_ERROR_BURST" },
742 { NET_IPV4_ROUTE_GC_ELASTICITY, "NET_IPV4_ROUTE_GC_ELASTICITY" },
746 static const struct xlat sysctl_net_ipv4_conf[] = {
747 { NET_IPV4_CONF_FORWARDING, "NET_IPV4_CONF_FORWARDING" },
748 { NET_IPV4_CONF_MC_FORWARDING, "NET_IPV4_CONF_MC_FORWARDING" },
749 { NET_IPV4_CONF_PROXY_ARP, "NET_IPV4_CONF_PROXY_ARP" },
750 { NET_IPV4_CONF_ACCEPT_REDIRECTS, "NET_IPV4_CONF_ACCEPT_REDIRECTS" },
751 { NET_IPV4_CONF_SECURE_REDIRECTS, "NET_IPV4_CONF_SECURE_REDIRECTS" },
752 { NET_IPV4_CONF_SEND_REDIRECTS, "NET_IPV4_CONF_SEND_REDIRECTS" },
753 { NET_IPV4_CONF_SHARED_MEDIA, "NET_IPV4_CONF_SHARED_MEDIA" },
754 { NET_IPV4_CONF_RP_FILTER, "NET_IPV4_CONF_RP_FILTER" },
755 { NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, "NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE" },
756 { NET_IPV4_CONF_BOOTP_RELAY, "NET_IPV4_CONF_BOOTP_RELAY" },
757 { NET_IPV4_CONF_LOG_MARTIANS, "NET_IPV4_CONF_LOG_MARTIANS" },
761 static const struct xlat sysctl_net_ipv6[] = {
762 { NET_IPV6_CONF, "NET_IPV6_CONF" },
763 { NET_IPV6_NEIGH, "NET_IPV6_NEIGH" },
764 { NET_IPV6_ROUTE, "NET_IPV6_ROUTE" },
768 static const struct xlat sysctl_net_ipv6_route[] = {
769 { NET_IPV6_ROUTE_FLUSH, "NET_IPV6_ROUTE_FLUSH" },
770 { NET_IPV6_ROUTE_GC_THRESH, "NET_IPV6_ROUTE_GC_THRESH" },
771 { NET_IPV6_ROUTE_MAX_SIZE, "NET_IPV6_ROUTE_MAX_SIZE" },
772 { NET_IPV6_ROUTE_GC_MIN_INTERVAL, "NET_IPV6_ROUTE_GC_MIN_INTERVAL" },
773 { NET_IPV6_ROUTE_GC_TIMEOUT, "NET_IPV6_ROUTE_GC_TIMEOUT" },
774 { NET_IPV6_ROUTE_GC_INTERVAL, "NET_IPV6_ROUTE_GC_INTERVAL" },
775 { NET_IPV6_ROUTE_GC_ELASTICITY, "NET_IPV6_ROUTE_GC_ELASTICITY" },
780 sys_sysctl(struct tcb *tcp)
782 struct __sysctl_args info;
786 if (umove(tcp, tcp->u_arg[0], &info) < 0)
787 return printargs(tcp);
789 size = sizeof(int) * (unsigned long) info.nlen;
790 name = (size / sizeof(int) != info.nlen) ? NULL : malloc(size);
792 umoven(tcp, (unsigned long) info.name, size, (char *) name) < 0) {
795 tprintf("{%p, %d, %p, %p, %p, %Zu}",
796 info.name, info.nlen, info.oldval,
797 info.oldlenp, info.newval, info.newlen);
802 int cnt = 0, max_cnt;
808 printxval(sysctl_root, name[0], "CTL_???");
816 printxval(sysctl_kern, name[1], "KERN_???");
821 printxval(sysctl_vm, name[1], "VM_???");
826 printxval(sysctl_net, name[1], "NET_???");
834 printxval(sysctl_net_core, name[2],
839 printxval(sysctl_net_unix, name[2],
844 printxval(sysctl_net_ipv4, name[2],
852 printxval(sysctl_net_ipv4_route,
854 "NET_IPV4_ROUTE_???");
858 printxval(sysctl_net_ipv4_conf,
860 "NET_IPV4_CONF_???");
868 printxval(sysctl_net_ipv6, name[2],
876 printxval(sysctl_net_ipv6_route,
878 "NET_IPV6_ROUTE_???");
893 if (abbrev(tcp) && max_cnt > max_strlen)
894 max_cnt = max_strlen;
895 while (cnt < max_cnt)
896 tprintf(", %x", name[cnt++]);
899 tprintf("}, %d, ", info.nlen);
902 if (umove(tcp, (size_t)info.oldlenp, &oldlen) >= 0
904 && ((name[0] == CTL_KERN
905 && (name[1] == KERN_OSRELEASE
906 || name[1] == KERN_OSTYPE
907 #ifdef KERN_JAVA_INTERPRETER
908 || name[1] == KERN_JAVA_INTERPRETER
910 #ifdef KERN_JAVA_APPLETVIEWER
911 || name[1] == KERN_JAVA_APPLETVIEWER
914 printpath(tcp, (size_t)info.oldval);
915 tprintf(", %Zu, ", oldlen);
916 if (info.newval == 0)
918 else if (syserror(tcp))
919 tprintf("%p", info.newval);
921 printpath(tcp, (size_t)info.newval);
922 tprintf(", %Zd", info.newlen);
924 tprintf("%p, %Zd, %p, %Zd", info.oldval, oldlen,
925 info.newval, info.newlen);
938 #ifndef __NEW_UTS_LEN
939 #define __NEW_UTS_LEN 64
942 static const struct xlat sysmips_operations[] = {
943 { SETNAME, "SETNAME" },
944 { FLUSH_CACHE, "FLUSH_CACHE" },
945 { MIPS_FIXADE, "MIPS_FIXADE" },
946 { MIPS_RDNVRAM, "MIPS_RDNVRAM" },
947 { MIPS_ATOMIC_SET, "MIPS_ATOMIC_SET" },
951 int sys_sysmips(struct tcb *tcp)
954 printxval(sysmips_operations, tcp->u_arg[0], "???");
956 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
957 } else if (tcp->u_arg[0] == SETNAME) {
958 char nodename[__NEW_UTS_LEN + 1];
959 if (umovestr(tcp, tcp->u_arg[1], (__NEW_UTS_LEN + 1), nodename) < 0)
960 tprintf(", %#lx", tcp->u_arg[1]);
962 tprintf(", \"%.*s\"", (int)(__NEW_UTS_LEN + 1), nodename);
963 } else if (tcp->u_arg[0] == MIPS_ATOMIC_SET) {
964 tprintf(", %#lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
965 } else if (tcp->u_arg[0] == MIPS_FIXADE) {
966 tprintf(", 0x%lx", tcp->u_arg[1]);
968 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);