Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 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> |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 5 | * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl> |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 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 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 35 | #define _LINUX_SOCKET_H |
Wichert Akkerman | 14cd9f0 | 1999-07-09 18:56:34 +0000 | [diff] [blame] | 36 | #define _LINUX_FS_H |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 37 | |
Roland McGrath | cbd3358 | 2005-02-02 04:36:11 +0000 | [diff] [blame] | 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 */ |
| 48 | #define MS_BIND 4096 |
| 49 | #define MS_MOVE 8192 |
| 50 | #define MS_REC 16384 |
Dmitry V. Levin | 817b708 | 2007-01-16 15:10:07 +0000 | [diff] [blame] | 51 | #define MS_SILENT 32768 |
Roland McGrath | cbd3358 | 2005-02-02 04:36:11 +0000 | [diff] [blame] | 52 | #define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ |
Dmitry V. Levin | 817b708 | 2007-01-16 15:10:07 +0000 | [diff] [blame] | 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 */ |
Mike Frysinger | 22485b7 | 2011-02-21 23:04:30 -0500 | [diff] [blame] | 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) |
Roland McGrath | cbd3358 | 2005-02-02 04:36:11 +0000 | [diff] [blame] | 62 | #define MS_ACTIVE (1<<30) |
| 63 | #define MS_NOUSER (1<<31) |
Roland McGrath | 6af3748 | 2006-01-12 21:21:06 +0000 | [diff] [blame] | 64 | #define MS_MGC_VAL 0xc0ed0000 /* Magic flag number */ |
Dmitry V. Levin | 817b708 | 2007-01-16 15:10:07 +0000 | [diff] [blame] | 65 | #define MS_MGC_MSK 0xffff0000 /* Magic flag mask */ |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 66 | |
| 67 | #include <sys/socket.h> |
| 68 | #include <netinet/in.h> |
| 69 | #include <arpa/inet.h> |
| 70 | |
Nate Sammons | 8d5860c | 1999-07-03 18:53:05 +0000 | [diff] [blame] | 71 | #include <sys/syscall.h> |
| 72 | |
Dmitry V. Levin | f48df6c | 2009-06-01 09:59:11 +0000 | [diff] [blame] | 73 | #ifdef HAVE_LINUX_CAPABILITY_H |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 74 | #include <linux/capability.h> |
| 75 | #endif |
| 76 | |
Dmitry V. Levin | f48df6c | 2009-06-01 09:59:11 +0000 | [diff] [blame] | 77 | #ifdef HAVE_ASM_CACHECTL_H |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 78 | #include <asm/cachectl.h> |
| 79 | #endif |
| 80 | |
Wichert Akkerman | d6b9249 | 2001-04-07 21:37:12 +0000 | [diff] [blame] | 81 | #ifdef HAVE_LINUX_USTNAME_H |
| 82 | #include <linux/utsname.h> |
| 83 | #endif |
| 84 | |
Dmitry V. Levin | f48df6c | 2009-06-01 09:59:11 +0000 | [diff] [blame] | 85 | #ifdef HAVE_ASM_SYSMIPS_H |
Wichert Akkerman | d6b9249 | 2001-04-07 21:37:12 +0000 | [diff] [blame] | 86 | #include <asm/sysmips.h> |
| 87 | #endif |
| 88 | |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 89 | #include <linux/sysctl.h> |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 90 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 91 | static const struct xlat mount_flags[] = { |
Roland McGrath | 6af3748 | 2006-01-12 21:21:06 +0000 | [diff] [blame] | 92 | { MS_MGC_VAL, "MS_MGC_VAL" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 93 | { MS_RDONLY, "MS_RDONLY" }, |
| 94 | { MS_NOSUID, "MS_NOSUID" }, |
| 95 | { MS_NODEV, "MS_NODEV" }, |
| 96 | { MS_NOEXEC, "MS_NOEXEC" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 97 | { MS_SYNCHRONOUS,"MS_SYNCHRONOUS"}, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 98 | { MS_REMOUNT, "MS_REMOUNT" }, |
Mike Frysinger | 22485b7 | 2011-02-21 23:04:30 -0500 | [diff] [blame] | 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" }, |
Roland McGrath | cbd3358 | 2005-02-02 04:36:11 +0000 | [diff] [blame] | 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" }, |
Dmitry V. Levin | 817b708 | 2007-01-16 15:10:07 +0000 | [diff] [blame] | 110 | { MS_SILENT, "MS_SILENT" }, |
Roland McGrath | cbd3358 | 2005-02-02 04:36:11 +0000 | [diff] [blame] | 111 | { MS_POSIXACL, "MS_POSIXACL" }, |
Dmitry V. Levin | 817b708 | 2007-01-16 15:10:07 +0000 | [diff] [blame] | 112 | { MS_UNBINDABLE,"MS_UNBINDABLE" }, |
| 113 | { MS_PRIVATE, "MS_PRIVATE" }, |
| 114 | { MS_SLAVE, "MS_SLAVE" }, |
| 115 | { MS_SHARED, "MS_SHARED" }, |
Roland McGrath | cbd3358 | 2005-02-02 04:36:11 +0000 | [diff] [blame] | 116 | { MS_ACTIVE, "MS_ACTIVE" }, |
| 117 | { MS_NOUSER, "MS_NOUSER" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 118 | { 0, NULL }, |
| 119 | }; |
| 120 | |
| 121 | int |
Dmitry V. Levin | 817b708 | 2007-01-16 15:10:07 +0000 | [diff] [blame] | 122 | sys_mount(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 123 | { |
| 124 | if (entering(tcp)) { |
Dmitry V. Levin | 817b708 | 2007-01-16 15:10:07 +0000 | [diff] [blame] | 125 | int ignore_type = 0, ignore_data = 0; |
| 126 | unsigned long flags = tcp->u_arg[3]; |
| 127 | |
| 128 | /* Discard magic */ |
| 129 | if ((flags & MS_MGC_MSK) == MS_MGC_VAL) |
| 130 | flags &= ~MS_MGC_MSK; |
| 131 | |
| 132 | if (flags & MS_REMOUNT) |
| 133 | ignore_type = 1; |
| 134 | else if (flags & (MS_BIND | MS_MOVE)) |
| 135 | ignore_type = ignore_data = 1; |
| 136 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 137 | printpath(tcp, tcp->u_arg[0]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 138 | tprints(", "); |
Dmitry V. Levin | 817b708 | 2007-01-16 15:10:07 +0000 | [diff] [blame] | 139 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 140 | printpath(tcp, tcp->u_arg[1]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 141 | tprints(", "); |
Dmitry V. Levin | 817b708 | 2007-01-16 15:10:07 +0000 | [diff] [blame] | 142 | |
| 143 | if (ignore_type && tcp->u_arg[2]) |
Roland McGrath | cbd3358 | 2005-02-02 04:36:11 +0000 | [diff] [blame] | 144 | tprintf("%#lx", tcp->u_arg[2]); |
Dmitry V. Levin | 817b708 | 2007-01-16 15:10:07 +0000 | [diff] [blame] | 145 | else |
| 146 | printstr(tcp, tcp->u_arg[2], -1); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 147 | tprints(", "); |
Dmitry V. Levin | 817b708 | 2007-01-16 15:10:07 +0000 | [diff] [blame] | 148 | |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 149 | printflags(mount_flags, tcp->u_arg[3], "MS_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 150 | tprints(", "); |
Dmitry V. Levin | 817b708 | 2007-01-16 15:10:07 +0000 | [diff] [blame] | 151 | |
| 152 | if (ignore_data && tcp->u_arg[4]) |
Roland McGrath | 6af3748 | 2006-01-12 21:21:06 +0000 | [diff] [blame] | 153 | tprintf("%#lx", tcp->u_arg[4]); |
Dmitry V. Levin | 817b708 | 2007-01-16 15:10:07 +0000 | [diff] [blame] | 154 | else |
| 155 | printstr(tcp, tcp->u_arg[4], -1); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 156 | } |
| 157 | return 0; |
| 158 | } |
| 159 | |
Dmitry V. Levin | 5c7ad8c | 2007-01-13 11:15:48 +0000 | [diff] [blame] | 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 */ |
| 163 | |
| 164 | static const struct xlat umount_flags[] = { |
| 165 | { MNT_FORCE, "MNT_FORCE" }, |
| 166 | { MNT_DETACH, "MNT_DETACH" }, |
| 167 | { MNT_EXPIRE, "MNT_EXPIRE" }, |
| 168 | { 0, NULL }, |
| 169 | }; |
| 170 | |
Wichert Akkerman | dacfb6e | 1999-06-03 14:21:07 +0000 | [diff] [blame] | 171 | int |
Dmitry V. Levin | 5c7ad8c | 2007-01-13 11:15:48 +0000 | [diff] [blame] | 172 | sys_umount2(struct tcb *tcp) |
Wichert Akkerman | dacfb6e | 1999-06-03 14:21:07 +0000 | [diff] [blame] | 173 | { |
| 174 | if (entering(tcp)) { |
| 175 | printstr(tcp, tcp->u_arg[0], -1); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 176 | tprints(", "); |
Dmitry V. Levin | 5c7ad8c | 2007-01-13 11:15:48 +0000 | [diff] [blame] | 177 | printflags(umount_flags, tcp->u_arg[1], "MNT_???"); |
Wichert Akkerman | dacfb6e | 1999-06-03 14:21:07 +0000 | [diff] [blame] | 178 | } |
| 179 | return 0; |
| 180 | } |
| 181 | |
Roland McGrath | ced50da | 2004-08-31 06:48:46 +0000 | [diff] [blame] | 182 | /* These are not macros, but enums. We just copy the values by hand |
| 183 | from Linux 2.6.9 here. */ |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 184 | static const struct xlat personality_options[] = { |
Roland McGrath | ced50da | 2004-08-31 06:48:46 +0000 | [diff] [blame] | 185 | { 0, "PER_LINUX" }, |
| 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" }, |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 206 | { 0, NULL }, |
| 207 | }; |
| 208 | |
| 209 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 210 | sys_personality(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 211 | { |
| 212 | if (entering(tcp)) |
| 213 | printxval(personality_options, tcp->u_arg[0], "PER_???"); |
| 214 | return 0; |
| 215 | } |
| 216 | |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 217 | #include <linux/reboot.h> |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 218 | static const struct xlat bootflags1[] = { |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 219 | { LINUX_REBOOT_MAGIC1, "LINUX_REBOOT_MAGIC1" }, |
| 220 | { 0, NULL }, |
| 221 | }; |
| 222 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 223 | static const struct xlat bootflags2[] = { |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 224 | { LINUX_REBOOT_MAGIC2, "LINUX_REBOOT_MAGIC2" }, |
| 225 | { LINUX_REBOOT_MAGIC2A, "LINUX_REBOOT_MAGIC2A" }, |
| 226 | { LINUX_REBOOT_MAGIC2B, "LINUX_REBOOT_MAGIC2B" }, |
| 227 | { 0, NULL }, |
| 228 | }; |
| 229 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 230 | static const struct xlat bootflags3[] = { |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 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" }, |
| 237 | { 0, NULL }, |
| 238 | }; |
| 239 | |
| 240 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 241 | sys_reboot(struct tcb *tcp) |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 242 | { |
| 243 | if (entering(tcp)) { |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 244 | printflags(bootflags1, tcp->u_arg[0], "LINUX_REBOOT_MAGIC_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 245 | tprints(", "); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 246 | printflags(bootflags2, tcp->u_arg[1], "LINUX_REBOOT_MAGIC_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 247 | tprints(", "); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 248 | printflags(bootflags3, tcp->u_arg[2], "LINUX_REBOOT_CMD_???"); |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 249 | if (tcp->u_arg[2] == LINUX_REBOOT_CMD_RESTART2) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 250 | tprints(", "); |
Wichert Akkerman | 5ae21ea | 2000-05-01 01:53:59 +0000 | [diff] [blame] | 251 | printstr(tcp, tcp->u_arg[3], -1); |
| 252 | } |
| 253 | } |
| 254 | return 0; |
| 255 | } |
| 256 | |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 257 | #ifdef M68K |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 258 | static const struct xlat cacheflush_scope[] = { |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 259 | #ifdef FLUSH_SCOPE_LINE |
| 260 | { FLUSH_SCOPE_LINE, "FLUSH_SCOPE_LINE" }, |
| 261 | #endif |
| 262 | #ifdef FLUSH_SCOPE_PAGE |
| 263 | { FLUSH_SCOPE_PAGE, "FLUSH_SCOPE_PAGE" }, |
| 264 | #endif |
| 265 | #ifdef FLUSH_SCOPE_ALL |
| 266 | { FLUSH_SCOPE_ALL, "FLUSH_SCOPE_ALL" }, |
| 267 | #endif |
| 268 | { 0, NULL }, |
| 269 | }; |
| 270 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 271 | static const struct xlat cacheflush_flags[] = { |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 272 | #ifdef FLUSH_CACHE_BOTH |
| 273 | { FLUSH_CACHE_BOTH, "FLUSH_CACHE_BOTH" }, |
| 274 | #endif |
| 275 | #ifdef FLUSH_CACHE_DATA |
| 276 | { FLUSH_CACHE_DATA, "FLUSH_CACHE_DATA" }, |
| 277 | #endif |
| 278 | #ifdef FLUSH_CACHE_INSN |
| 279 | { FLUSH_CACHE_INSN, "FLUSH_CACHE_INSN" }, |
| 280 | #endif |
| 281 | { 0, NULL }, |
| 282 | }; |
| 283 | |
| 284 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 285 | sys_cacheflush(struct tcb *tcp) |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 286 | { |
| 287 | if (entering(tcp)) { |
| 288 | /* addr */ |
| 289 | tprintf("%#lx, ", tcp->u_arg[0]); |
| 290 | /* scope */ |
| 291 | printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 292 | tprints(", "); |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 293 | /* flags */ |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 294 | printflags(cacheflush_flags, tcp->u_arg[2], "FLUSH_CACHE_???"); |
Wichert Akkerman | 2e2553a | 1999-05-09 00:29:58 +0000 | [diff] [blame] | 295 | /* len */ |
| 296 | tprintf(", %lu", tcp->u_arg[3]); |
| 297 | } |
| 298 | return 0; |
| 299 | } |
| 300 | #endif /* M68K */ |
| 301 | |
Dmitry V. Levin | 87ea1f4 | 2008-11-10 22:21:41 +0000 | [diff] [blame] | 302 | #ifdef BFIN |
| 303 | |
| 304 | #include <bfin_sram.h> |
| 305 | |
| 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" }, |
Denys Vlasenko | 132c52a | 2009-03-23 13:12:46 +0000 | [diff] [blame] | 311 | { L2_SRAM, "L2_SRAM" }, |
Dmitry V. Levin | 87ea1f4 | 2008-11-10 22:21:41 +0000 | [diff] [blame] | 312 | { 0, NULL }, |
| 313 | }; |
| 314 | |
| 315 | int |
Denys Vlasenko | 132c52a | 2009-03-23 13:12:46 +0000 | [diff] [blame] | 316 | sys_sram_alloc(struct tcb *tcp) |
Dmitry V. Levin | 87ea1f4 | 2008-11-10 22:21:41 +0000 | [diff] [blame] | 317 | { |
| 318 | if (entering(tcp)) { |
| 319 | /* size */ |
Denys Vlasenko | 132c52a | 2009-03-23 13:12:46 +0000 | [diff] [blame] | 320 | tprintf("%lu, ", tcp->u_arg[0]); |
Dmitry V. Levin | 87ea1f4 | 2008-11-10 22:21:41 +0000 | [diff] [blame] | 321 | /* flags */ |
Denys Vlasenko | 132c52a | 2009-03-23 13:12:46 +0000 | [diff] [blame] | 322 | printxval(sram_alloc_flags, tcp->u_arg[1], "???_SRAM"); |
Dmitry V. Levin | 87ea1f4 | 2008-11-10 22:21:41 +0000 | [diff] [blame] | 323 | } |
| 324 | return 1; |
| 325 | } |
| 326 | |
Mike Frysinger | 260e571 | 2010-09-11 15:04:18 -0400 | [diff] [blame] | 327 | #include <asm/cachectl.h> |
| 328 | |
| 329 | static const struct xlat cacheflush_flags[] = { |
| 330 | { ICACHE, "ICACHE" }, |
| 331 | { DCACHE, "DCACHE" }, |
| 332 | { BCACHE, "BCACHE" }, |
| 333 | { 0, NULL }, |
| 334 | }; |
| 335 | |
| 336 | int |
| 337 | sys_cacheflush(struct tcb *tcp) |
| 338 | { |
| 339 | if (entering(tcp)) { |
| 340 | /* start addr */ |
| 341 | tprintf("%#lx, ", tcp->u_arg[0]); |
| 342 | /* length */ |
| 343 | tprintf("%ld, ", tcp->u_arg[1]); |
| 344 | /* flags */ |
| 345 | printxval(cacheflush_flags, tcp->u_arg[1], "?CACHE"); |
| 346 | } |
| 347 | return 0; |
| 348 | } |
| 349 | |
Dmitry V. Levin | 87ea1f4 | 2008-11-10 22:21:41 +0000 | [diff] [blame] | 350 | #endif |
| 351 | |
Carmelo AMOROSO | f8e5650 | 2010-12-01 14:27:07 +0100 | [diff] [blame] | 352 | #ifdef SH |
| 353 | static const struct xlat cacheflush_flags[] = { |
| 354 | #ifdef CACHEFLUSH_D_INVAL |
| 355 | { CACHEFLUSH_D_INVAL, "CACHEFLUSH_D_INVAL" }, |
| 356 | #endif |
| 357 | #ifdef CACHEFLUSH_D_WB |
| 358 | { CACHEFLUSH_D_WB, "CACHEFLUSH_D_WB" }, |
| 359 | #endif |
| 360 | #ifdef CACHEFLUSH_D_PURGE |
| 361 | { CACHEFLUSH_D_PURGE, "CACHEFLUSH_D_PURGE" }, |
| 362 | #endif |
| 363 | #ifdef CACHEFLUSH_I |
| 364 | { CACHEFLUSH_I, "CACHEFLUSH_I" }, |
| 365 | #endif |
| 366 | { 0, NULL }, |
| 367 | }; |
| 368 | |
| 369 | int |
| 370 | sys_cacheflush(struct tcb *tcp) |
| 371 | { |
| 372 | if (entering(tcp)) { |
| 373 | /* addr */ |
| 374 | tprintf("%#lx, ", tcp->u_arg[0]); |
| 375 | /* len */ |
| 376 | tprintf("%lu, ", tcp->u_arg[1]); |
| 377 | /* flags */ |
| 378 | printflags(cacheflush_flags, tcp->u_arg[2], "CACHEFLUSH_???"); |
| 379 | } |
| 380 | return 0; |
| 381 | } |
| 382 | #endif /* SH */ |
| 383 | |
Nate Sammons | 8d5860c | 1999-07-03 18:53:05 +0000 | [diff] [blame] | 384 | #ifdef SYS_capget |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 385 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 386 | static const struct xlat capabilities[] = { |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 387 | { 1<<CAP_CHOWN, "CAP_CHOWN" }, |
| 388 | { 1<<CAP_DAC_OVERRIDE, "CAP_DAC_OVERRIDE"}, |
| 389 | { 1<<CAP_DAC_READ_SEARCH,"CAP_DAC_READ_SEARCH"}, |
| 390 | { 1<<CAP_FOWNER, "CAP_FOWNER" }, |
| 391 | { 1<<CAP_FSETID, "CAP_FSETID" }, |
| 392 | { 1<<CAP_KILL, "CAP_KILL" }, |
| 393 | { 1<<CAP_SETGID, "CAP_SETGID" }, |
| 394 | { 1<<CAP_SETUID, "CAP_SETUID" }, |
| 395 | { 1<<CAP_SETPCAP, "CAP_SETPCAP" }, |
| 396 | { 1<<CAP_LINUX_IMMUTABLE,"CAP_LINUX_IMMUTABLE"}, |
| 397 | { 1<<CAP_NET_BIND_SERVICE,"CAP_NET_BIND_SERVICE"}, |
| 398 | { 1<<CAP_NET_BROADCAST, "CAP_NET_BROADCAST"}, |
| 399 | { 1<<CAP_NET_ADMIN, "CAP_NET_ADMIN" }, |
| 400 | { 1<<CAP_NET_RAW, "CAP_NET_RAW" }, |
| 401 | { 1<<CAP_IPC_LOCK, "CAP_IPC_LOCK" }, |
| 402 | { 1<<CAP_IPC_OWNER, "CAP_IPC_OWNER" }, |
| 403 | { 1<<CAP_SYS_MODULE, "CAP_SYS_MODULE"}, |
| 404 | { 1<<CAP_SYS_RAWIO, "CAP_SYS_RAWIO" }, |
| 405 | { 1<<CAP_SYS_CHROOT, "CAP_SYS_CHROOT"}, |
| 406 | { 1<<CAP_SYS_PTRACE, "CAP_SYS_PTRACE"}, |
| 407 | { 1<<CAP_SYS_PACCT, "CAP_SYS_PACCT" }, |
| 408 | { 1<<CAP_SYS_ADMIN, "CAP_SYS_ADMIN" }, |
| 409 | { 1<<CAP_SYS_BOOT, "CAP_SYS_BOOT" }, |
| 410 | { 1<<CAP_SYS_NICE, "CAP_SYS_NICE" }, |
| 411 | { 1<<CAP_SYS_RESOURCE, "CAP_SYS_RESOURCE"}, |
| 412 | { 1<<CAP_SYS_TIME, "CAP_SYS_TIME" }, |
| 413 | { 1<<CAP_SYS_TTY_CONFIG,"CAP_SYS_TTY_CONFIG"}, |
Dmitry V. Levin | 949f451 | 2008-11-11 00:21:09 +0000 | [diff] [blame] | 414 | #ifdef CAP_MKNOD |
| 415 | { 1<<CAP_MKNOD, "CAP_MKNOD" }, |
| 416 | #endif |
| 417 | #ifdef CAP_LEASE |
| 418 | { 1<<CAP_LEASE, "CAP_LEASE" }, |
| 419 | #endif |
| 420 | #ifdef CAP_AUDIT_WRITE |
| 421 | { 1<<CAP_AUDIT_WRITE, "CAP_AUDIT_WRITE"}, |
| 422 | #endif |
| 423 | #ifdef CAP_AUDIT_CONTROL |
| 424 | { 1<<CAP_AUDIT_CONTROL, "CAP_AUDIT_CONTROL"}, |
| 425 | #endif |
| 426 | #ifdef CAP_SETFCAP |
| 427 | { 1<<CAP_SETFCAP, "CAP_SETFCAP" }, |
| 428 | #endif |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 429 | { 0, NULL }, |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 430 | }; |
| 431 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 432 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 433 | sys_capget(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 434 | { |
Denys Vlasenko | b0bafbb | 2011-06-23 13:10:28 +0200 | [diff] [blame] | 435 | /* cap_user_ types are _pointers_ to (small) structs. */ |
| 436 | /* Structs themselves have no names defined. */ |
| 437 | /* Have to use ugly hack to place them on stack. */ |
| 438 | cap_user_header_t arg0; |
| 439 | cap_user_data_t arg1; |
| 440 | long a0[sizeof(*arg0) / sizeof(long) + 1]; |
| 441 | long a1[sizeof(*arg1) / sizeof(long) + 1]; |
Dmitry V. Levin | 1c706b3 | 2011-06-23 13:25:09 +0000 | [diff] [blame] | 442 | arg0 = (cap_user_header_t) a0; |
| 443 | arg1 = (cap_user_data_t ) a1; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 444 | |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 445 | if (!entering(tcp)) { |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 446 | if (!tcp->u_arg[0]) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 447 | tprints("NULL"); |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 448 | else if (!verbose(tcp)) |
| 449 | tprintf("%#lx", tcp->u_arg[0]); |
| 450 | else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 451 | tprints("???"); |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 452 | else { |
| 453 | tprintf("%#x, %d", arg0->version, arg0->pid); |
| 454 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 455 | tprints(", "); |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 456 | if (!tcp->u_arg[1]) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 457 | tprints("NULL"); |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 458 | else if (!verbose(tcp)) |
| 459 | tprintf("%#lx", tcp->u_arg[1]); |
| 460 | else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 461 | tprints("???"); |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 462 | else { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 463 | tprints("{"); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 464 | printflags(capabilities, arg1->effective, "CAP_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 465 | tprints(", "); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 466 | printflags(capabilities, arg1->permitted, "CAP_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 467 | tprints(", "); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 468 | printflags(capabilities, arg1->inheritable, "CAP_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 469 | tprints("}"); |
Roland McGrath | ced50da | 2004-08-31 06:48:46 +0000 | [diff] [blame] | 470 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 471 | } |
| 472 | return 0; |
| 473 | } |
| 474 | |
| 475 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 476 | sys_capset(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 477 | { |
Denys Vlasenko | b0bafbb | 2011-06-23 13:10:28 +0200 | [diff] [blame] | 478 | cap_user_header_t arg0; |
| 479 | cap_user_data_t arg1; |
| 480 | long a0[sizeof(*arg0) / sizeof(long) + 1]; |
| 481 | long a1[sizeof(*arg1) / sizeof(long) + 1]; |
Dmitry V. Levin | 1c706b3 | 2011-06-23 13:25:09 +0000 | [diff] [blame] | 482 | arg0 = (cap_user_header_t) a0; |
| 483 | arg1 = (cap_user_data_t ) a1; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 484 | |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 485 | if (entering(tcp)) { |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 486 | if (!tcp->u_arg[0]) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 487 | tprints("NULL"); |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 488 | else if (!verbose(tcp)) |
| 489 | tprintf("%#lx", tcp->u_arg[0]); |
| 490 | else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 491 | tprints("???"); |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 492 | else { |
| 493 | tprintf("%#x, %d", arg0->version, arg0->pid); |
| 494 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 495 | tprints(", "); |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 496 | if (!tcp->u_arg[1]) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 497 | tprints("NULL"); |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 498 | else if (!verbose(tcp)) |
| 499 | tprintf("%#lx", tcp->u_arg[1]); |
| 500 | else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 501 | tprints("???"); |
Wichert Akkerman | c792698 | 2000-04-10 22:22:31 +0000 | [diff] [blame] | 502 | else { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 503 | tprints("{"); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 504 | printflags(capabilities, arg1->effective, "CAP_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 505 | tprints(", "); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 506 | printflags(capabilities, arg1->permitted, "CAP_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 507 | tprints(", "); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 508 | printflags(capabilities, arg1->inheritable, "CAP_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 509 | tprints("}"); |
Roland McGrath | ced50da | 2004-08-31 06:48:46 +0000 | [diff] [blame] | 510 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 511 | } |
| 512 | return 0; |
| 513 | } |
| 514 | |
| 515 | #else |
| 516 | |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 517 | int sys_capget(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 518 | { |
| 519 | return printargs(tcp); |
| 520 | } |
| 521 | |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 522 | int sys_capset(struct tcb *tcp) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 523 | { |
| 524 | return printargs(tcp); |
| 525 | } |
| 526 | |
| 527 | #endif |
| 528 | |
Dmitry V. Levin | 35a5578 | 2006-12-04 13:48:10 +0000 | [diff] [blame] | 529 | /* Linux 2.6.18+ headers removed CTL_PROC enum. */ |
| 530 | # define CTL_PROC 4 |
Roland McGrath | 5eb1aa5 | 2007-01-11 22:48:39 +0000 | [diff] [blame] | 531 | # define CTL_CPU 10 /* older headers lack */ |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 532 | static const struct xlat sysctl_root[] = { |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 533 | { CTL_KERN, "CTL_KERN" }, |
| 534 | { CTL_VM, "CTL_VM" }, |
| 535 | { CTL_NET, "CTL_NET" }, |
| 536 | { CTL_PROC, "CTL_PROC" }, |
| 537 | { CTL_FS, "CTL_FS" }, |
| 538 | { CTL_DEBUG, "CTL_DEBUG" }, |
| 539 | { CTL_DEV, "CTL_DEV" }, |
Dmitry V. Levin | 35a5578 | 2006-12-04 13:48:10 +0000 | [diff] [blame] | 540 | { CTL_BUS, "CTL_BUS" }, |
| 541 | { CTL_ABI, "CTL_ABI" }, |
| 542 | { CTL_CPU, "CTL_CPU" }, |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 543 | { 0, NULL } |
| 544 | }; |
| 545 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 546 | static const struct xlat sysctl_kern[] = { |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 547 | { KERN_OSTYPE, "KERN_OSTYPE" }, |
| 548 | { KERN_OSRELEASE, "KERN_OSRELEASE" }, |
| 549 | { KERN_OSREV, "KERN_OSREV" }, |
| 550 | { KERN_VERSION, "KERN_VERSION" }, |
| 551 | { KERN_SECUREMASK, "KERN_SECUREMASK" }, |
| 552 | { KERN_PROF, "KERN_PROF" }, |
| 553 | { KERN_NODENAME, "KERN_NODENAME" }, |
| 554 | { KERN_DOMAINNAME, "KERN_DOMAINNAME" }, |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 555 | #ifdef KERN_SECURELVL |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 556 | { KERN_SECURELVL, "KERN_SECURELVL" }, |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 557 | #endif |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 558 | { KERN_PANIC, "KERN_PANIC" }, |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 559 | #ifdef KERN_REALROOTDEV |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 560 | { KERN_REALROOTDEV, "KERN_REALROOTDEV" }, |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 561 | #endif |
| 562 | #ifdef KERN_JAVA_INTERPRETER |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 563 | { KERN_JAVA_INTERPRETER, "KERN_JAVA_INTERPRETER" }, |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 564 | #endif |
| 565 | #ifdef KERN_JAVA_APPLETVIEWER |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 566 | { KERN_JAVA_APPLETVIEWER, "KERN_JAVA_APPLETVIEWER" }, |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 567 | #endif |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 568 | { KERN_SPARC_REBOOT, "KERN_SPARC_REBOOT" }, |
| 569 | { KERN_CTLALTDEL, "KERN_CTLALTDEL" }, |
| 570 | { KERN_PRINTK, "KERN_PRINTK" }, |
| 571 | { KERN_NAMETRANS, "KERN_NAMETRANS" }, |
| 572 | { KERN_PPC_HTABRECLAIM, "KERN_PPC_HTABRECLAIM" }, |
| 573 | { KERN_PPC_ZEROPAGED, "KERN_PPC_ZEROPAGED" }, |
| 574 | { KERN_PPC_POWERSAVE_NAP, "KERN_PPC_POWERSAVE_NAP" }, |
| 575 | { KERN_MODPROBE, "KERN_MODPROBE" }, |
| 576 | { KERN_SG_BIG_BUFF, "KERN_SG_BIG_BUFF" }, |
| 577 | { KERN_ACCT, "KERN_ACCT" }, |
| 578 | { KERN_PPC_L2CR, "KERN_PPC_L2CR" }, |
| 579 | { KERN_RTSIGNR, "KERN_RTSIGNR" }, |
| 580 | { KERN_RTSIGMAX, "KERN_RTSIGMAX" }, |
| 581 | { KERN_SHMMAX, "KERN_SHMMAX" }, |
| 582 | { KERN_MSGMAX, "KERN_MSGMAX" }, |
| 583 | { KERN_MSGMNB, "KERN_MSGMNB" }, |
| 584 | { KERN_MSGPOOL, "KERN_MSGPOOL" }, |
| 585 | { 0, NULL } |
| 586 | }; |
| 587 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 588 | static const struct xlat sysctl_vm[] = { |
Roland McGrath | a796fd0 | 2004-03-01 22:10:54 +0000 | [diff] [blame] | 589 | #ifdef VM_SWAPCTL |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 590 | { VM_SWAPCTL, "VM_SWAPCTL" }, |
Roland McGrath | a796fd0 | 2004-03-01 22:10:54 +0000 | [diff] [blame] | 591 | #endif |
| 592 | #ifdef VM_UNUSED1 |
| 593 | { VM_UNUSED1, "VM_UNUSED1" }, |
| 594 | #endif |
| 595 | #ifdef VM_SWAPOUT |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 596 | { VM_SWAPOUT, "VM_SWAPOUT" }, |
Roland McGrath | a796fd0 | 2004-03-01 22:10:54 +0000 | [diff] [blame] | 597 | #endif |
| 598 | #ifdef VM_UNUSED2 |
| 599 | { VM_UNUSED2, "VM_UNUSED2" }, |
| 600 | #endif |
| 601 | #ifdef VM_FREEPG |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 602 | { VM_FREEPG, "VM_FREEPG" }, |
Roland McGrath | a796fd0 | 2004-03-01 22:10:54 +0000 | [diff] [blame] | 603 | #endif |
| 604 | #ifdef VM_UNUSED3 |
| 605 | { VM_UNUSED3, "VM_UNUSED3" }, |
| 606 | #endif |
| 607 | #ifdef VM_BDFLUSH |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 608 | { VM_BDFLUSH, "VM_BDFLUSH" }, |
Roland McGrath | a796fd0 | 2004-03-01 22:10:54 +0000 | [diff] [blame] | 609 | #endif |
| 610 | #ifdef VM_UNUSED4 |
| 611 | { VM_UNUSED4, "VM_UNUSED4" }, |
| 612 | #endif |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 613 | { VM_OVERCOMMIT_MEMORY, "VM_OVERCOMMIT_MEMORY" }, |
Roland McGrath | a796fd0 | 2004-03-01 22:10:54 +0000 | [diff] [blame] | 614 | #ifdef VM_BUFFERMEM |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 615 | { VM_BUFFERMEM, "VM_BUFFERMEM" }, |
Roland McGrath | a796fd0 | 2004-03-01 22:10:54 +0000 | [diff] [blame] | 616 | #endif |
| 617 | #ifdef VM_UNUSED5 |
| 618 | { VM_UNUSED5, "VM_UNUSED5" }, |
| 619 | #endif |
| 620 | #ifdef VM_PAGECACHE |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 621 | { VM_PAGECACHE, "VM_PAGECACHE" }, |
Roland McGrath | a796fd0 | 2004-03-01 22:10:54 +0000 | [diff] [blame] | 622 | #endif |
| 623 | #ifdef VM_UNUSED7 |
| 624 | { VM_UNUSED7, "VM_UNUSED7" }, |
| 625 | #endif |
| 626 | #ifdef VM_PAGERDAEMON |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 627 | { VM_PAGERDAEMON, "VM_PAGERDAEMON" }, |
Roland McGrath | a796fd0 | 2004-03-01 22:10:54 +0000 | [diff] [blame] | 628 | #endif |
| 629 | #ifdef VM_UNUSED8 |
| 630 | { VM_UNUSED8, "VM_UNUSED8" }, |
| 631 | #endif |
| 632 | #ifdef VM_PGT_CACHE |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 633 | { VM_PGT_CACHE, "VM_PGT_CACHE" }, |
Roland McGrath | a796fd0 | 2004-03-01 22:10:54 +0000 | [diff] [blame] | 634 | #endif |
| 635 | #ifdef VM_UNUSED9 |
| 636 | { VM_UNUSED9, "VM_UNUSED9" }, |
| 637 | #endif |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 638 | { VM_PAGE_CLUSTER, "VM_PAGE_CLUSTER" }, |
| 639 | { 0, NULL }, |
| 640 | }; |
| 641 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 642 | static const struct xlat sysctl_net[] = { |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 643 | { NET_CORE, "NET_CORE" }, |
| 644 | { NET_ETHER, "NET_ETHER" }, |
| 645 | { NET_802, "NET_802" }, |
| 646 | { NET_UNIX, "NET_UNIX" }, |
| 647 | { NET_IPV4, "NET_IPV4" }, |
| 648 | { NET_IPX, "NET_IPX" }, |
| 649 | { NET_ATALK, "NET_ATALK" }, |
| 650 | { NET_NETROM, "NET_NETROM" }, |
| 651 | { NET_AX25, "NET_AX25" }, |
| 652 | { NET_BRIDGE, "NET_BRIDGE" }, |
| 653 | { NET_ROSE, "NET_ROSE" }, |
| 654 | { NET_IPV6, "NET_IPV6" }, |
| 655 | { NET_X25, "NET_X25" }, |
| 656 | { NET_TR, "NET_TR" }, |
| 657 | { NET_DECNET, "NET_DECNET" }, |
| 658 | { 0, NULL } |
| 659 | }; |
| 660 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 661 | static const struct xlat sysctl_net_core[] = { |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 662 | { NET_CORE_WMEM_MAX, "NET_CORE_WMEM_MAX" }, |
| 663 | { NET_CORE_RMEM_MAX, "NET_CORE_RMEM_MAX" }, |
| 664 | { NET_CORE_WMEM_DEFAULT, "NET_CORE_WMEM_DEFAULT" }, |
| 665 | { NET_CORE_RMEM_DEFAULT, "NET_CORE_RMEM_DEFAULT" }, |
| 666 | { NET_CORE_MAX_BACKLOG, "NET_CORE_MAX_BACKLOG" }, |
| 667 | { NET_CORE_FASTROUTE, "NET_CORE_FASTROUTE" }, |
| 668 | { NET_CORE_MSG_COST, "NET_CORE_MSG_COST" }, |
| 669 | { NET_CORE_MSG_BURST, "NET_CORE_MSG_BURST" }, |
| 670 | { NET_CORE_OPTMEM_MAX, "NET_CORE_OPTMEM_MAX" }, |
| 671 | { 0, NULL } |
| 672 | }; |
| 673 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 674 | static const struct xlat sysctl_net_unix[] = { |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 675 | { NET_UNIX_DESTROY_DELAY, "NET_UNIX_DESTROY_DELAY" }, |
| 676 | { NET_UNIX_DELETE_DELAY, "NET_UNIX_DELETE_DELAY" }, |
| 677 | { 0, NULL } |
| 678 | }; |
| 679 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 680 | static const struct xlat sysctl_net_ipv4[] = { |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 681 | { NET_IPV4_FORWARD, "NET_IPV4_FORWARD" }, |
| 682 | { NET_IPV4_DYNADDR, "NET_IPV4_DYNADDR" }, |
| 683 | { NET_IPV4_CONF, "NET_IPV4_CONF" }, |
| 684 | { NET_IPV4_NEIGH, "NET_IPV4_NEIGH" }, |
| 685 | { NET_IPV4_ROUTE, "NET_IPV4_ROUTE" }, |
| 686 | { NET_IPV4_FIB_HASH, "NET_IPV4_FIB_HASH" }, |
| 687 | { NET_IPV4_TCP_TIMESTAMPS, "NET_IPV4_TCP_TIMESTAMPS" }, |
| 688 | { NET_IPV4_TCP_WINDOW_SCALING, "NET_IPV4_TCP_WINDOW_SCALING" }, |
| 689 | { NET_IPV4_TCP_SACK, "NET_IPV4_TCP_SACK" }, |
| 690 | { NET_IPV4_TCP_RETRANS_COLLAPSE, "NET_IPV4_TCP_RETRANS_COLLAPSE" }, |
| 691 | { NET_IPV4_DEFAULT_TTL, "NET_IPV4_DEFAULT_TTL" }, |
| 692 | { NET_IPV4_AUTOCONFIG, "NET_IPV4_AUTOCONFIG" }, |
| 693 | { NET_IPV4_NO_PMTU_DISC, "NET_IPV4_NO_PMTU_DISC" }, |
| 694 | { NET_IPV4_TCP_SYN_RETRIES, "NET_IPV4_TCP_SYN_RETRIES" }, |
| 695 | { NET_IPV4_IPFRAG_HIGH_THRESH, "NET_IPV4_IPFRAG_HIGH_THRESH" }, |
| 696 | { NET_IPV4_IPFRAG_LOW_THRESH, "NET_IPV4_IPFRAG_LOW_THRESH" }, |
| 697 | { NET_IPV4_IPFRAG_TIME, "NET_IPV4_IPFRAG_TIME" }, |
| 698 | { NET_IPV4_TCP_MAX_KA_PROBES, "NET_IPV4_TCP_MAX_KA_PROBES" }, |
| 699 | { NET_IPV4_TCP_KEEPALIVE_TIME, "NET_IPV4_TCP_KEEPALIVE_TIME" }, |
| 700 | { NET_IPV4_TCP_KEEPALIVE_PROBES, "NET_IPV4_TCP_KEEPALIVE_PROBES" }, |
| 701 | { NET_IPV4_TCP_RETRIES1, "NET_IPV4_TCP_RETRIES1" }, |
| 702 | { NET_IPV4_TCP_RETRIES2, "NET_IPV4_TCP_RETRIES2" }, |
| 703 | { NET_IPV4_TCP_FIN_TIMEOUT, "NET_IPV4_TCP_FIN_TIMEOUT" }, |
| 704 | { NET_IPV4_IP_MASQ_DEBUG, "NET_IPV4_IP_MASQ_DEBUG" }, |
| 705 | { NET_TCP_SYNCOOKIES, "NET_TCP_SYNCOOKIES" }, |
| 706 | { NET_TCP_STDURG, "NET_TCP_STDURG" }, |
| 707 | { NET_TCP_RFC1337, "NET_TCP_RFC1337" }, |
| 708 | { NET_TCP_SYN_TAILDROP, "NET_TCP_SYN_TAILDROP" }, |
| 709 | { NET_TCP_MAX_SYN_BACKLOG, "NET_TCP_MAX_SYN_BACKLOG" }, |
| 710 | { NET_IPV4_LOCAL_PORT_RANGE, "NET_IPV4_LOCAL_PORT_RANGE" }, |
| 711 | { NET_IPV4_ICMP_ECHO_IGNORE_ALL, "NET_IPV4_ICMP_ECHO_IGNORE_ALL" }, |
| 712 | { NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS" }, |
| 713 | { NET_IPV4_ICMP_SOURCEQUENCH_RATE, "NET_IPV4_ICMP_SOURCEQUENCH_RATE" }, |
| 714 | { NET_IPV4_ICMP_DESTUNREACH_RATE, "NET_IPV4_ICMP_DESTUNREACH_RATE" }, |
| 715 | { NET_IPV4_ICMP_TIMEEXCEED_RATE, "NET_IPV4_ICMP_TIMEEXCEED_RATE" }, |
| 716 | { NET_IPV4_ICMP_PARAMPROB_RATE, "NET_IPV4_ICMP_PARAMPROB_RATE" }, |
| 717 | { NET_IPV4_ICMP_ECHOREPLY_RATE, "NET_IPV4_ICMP_ECHOREPLY_RATE" }, |
| 718 | { NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES" }, |
| 719 | { NET_IPV4_IGMP_MAX_MEMBERSHIPS, "NET_IPV4_IGMP_MAX_MEMBERSHIPS" }, |
| 720 | { 0, NULL } |
| 721 | }; |
| 722 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 723 | static const struct xlat sysctl_net_ipv4_route[] = { |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 724 | { NET_IPV4_ROUTE_FLUSH, "NET_IPV4_ROUTE_FLUSH" }, |
| 725 | { NET_IPV4_ROUTE_MIN_DELAY, "NET_IPV4_ROUTE_MIN_DELAY" }, |
| 726 | { NET_IPV4_ROUTE_MAX_DELAY, "NET_IPV4_ROUTE_MAX_DELAY" }, |
| 727 | { NET_IPV4_ROUTE_GC_THRESH, "NET_IPV4_ROUTE_GC_THRESH" }, |
| 728 | { NET_IPV4_ROUTE_MAX_SIZE, "NET_IPV4_ROUTE_MAX_SIZE" }, |
| 729 | { NET_IPV4_ROUTE_GC_MIN_INTERVAL, "NET_IPV4_ROUTE_GC_MIN_INTERVAL" }, |
| 730 | { NET_IPV4_ROUTE_GC_TIMEOUT, "NET_IPV4_ROUTE_GC_TIMEOUT" }, |
| 731 | { NET_IPV4_ROUTE_GC_INTERVAL, "NET_IPV4_ROUTE_GC_INTERVAL" }, |
| 732 | { NET_IPV4_ROUTE_REDIRECT_LOAD, "NET_IPV4_ROUTE_REDIRECT_LOAD" }, |
| 733 | { NET_IPV4_ROUTE_REDIRECT_NUMBER, "NET_IPV4_ROUTE_REDIRECT_NUMBER" }, |
| 734 | { NET_IPV4_ROUTE_REDIRECT_SILENCE, "NET_IPV4_ROUTE_REDIRECT_SILENCE" }, |
| 735 | { NET_IPV4_ROUTE_ERROR_COST, "NET_IPV4_ROUTE_ERROR_COST" }, |
| 736 | { NET_IPV4_ROUTE_ERROR_BURST, "NET_IPV4_ROUTE_ERROR_BURST" }, |
| 737 | { NET_IPV4_ROUTE_GC_ELASTICITY, "NET_IPV4_ROUTE_GC_ELASTICITY" }, |
| 738 | { 0, NULL } |
| 739 | }; |
| 740 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 741 | static const struct xlat sysctl_net_ipv4_conf[] = { |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 742 | { NET_IPV4_CONF_FORWARDING, "NET_IPV4_CONF_FORWARDING" }, |
| 743 | { NET_IPV4_CONF_MC_FORWARDING, "NET_IPV4_CONF_MC_FORWARDING" }, |
| 744 | { NET_IPV4_CONF_PROXY_ARP, "NET_IPV4_CONF_PROXY_ARP" }, |
| 745 | { NET_IPV4_CONF_ACCEPT_REDIRECTS, "NET_IPV4_CONF_ACCEPT_REDIRECTS" }, |
| 746 | { NET_IPV4_CONF_SECURE_REDIRECTS, "NET_IPV4_CONF_SECURE_REDIRECTS" }, |
| 747 | { NET_IPV4_CONF_SEND_REDIRECTS, "NET_IPV4_CONF_SEND_REDIRECTS" }, |
| 748 | { NET_IPV4_CONF_SHARED_MEDIA, "NET_IPV4_CONF_SHARED_MEDIA" }, |
| 749 | { NET_IPV4_CONF_RP_FILTER, "NET_IPV4_CONF_RP_FILTER" }, |
| 750 | { NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, "NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE" }, |
| 751 | { NET_IPV4_CONF_BOOTP_RELAY, "NET_IPV4_CONF_BOOTP_RELAY" }, |
| 752 | { NET_IPV4_CONF_LOG_MARTIANS, "NET_IPV4_CONF_LOG_MARTIANS" }, |
| 753 | { 0, NULL } |
| 754 | }; |
| 755 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 756 | static const struct xlat sysctl_net_ipv6[] = { |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 757 | { NET_IPV6_CONF, "NET_IPV6_CONF" }, |
| 758 | { NET_IPV6_NEIGH, "NET_IPV6_NEIGH" }, |
| 759 | { NET_IPV6_ROUTE, "NET_IPV6_ROUTE" }, |
| 760 | { 0, NULL } |
| 761 | }; |
| 762 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 763 | static const struct xlat sysctl_net_ipv6_route[] = { |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 764 | { NET_IPV6_ROUTE_FLUSH, "NET_IPV6_ROUTE_FLUSH" }, |
| 765 | { NET_IPV6_ROUTE_GC_THRESH, "NET_IPV6_ROUTE_GC_THRESH" }, |
| 766 | { NET_IPV6_ROUTE_MAX_SIZE, "NET_IPV6_ROUTE_MAX_SIZE" }, |
| 767 | { NET_IPV6_ROUTE_GC_MIN_INTERVAL, "NET_IPV6_ROUTE_GC_MIN_INTERVAL" }, |
| 768 | { NET_IPV6_ROUTE_GC_TIMEOUT, "NET_IPV6_ROUTE_GC_TIMEOUT" }, |
| 769 | { NET_IPV6_ROUTE_GC_INTERVAL, "NET_IPV6_ROUTE_GC_INTERVAL" }, |
| 770 | { NET_IPV6_ROUTE_GC_ELASTICITY, "NET_IPV6_ROUTE_GC_ELASTICITY" }, |
| 771 | { 0, NULL } |
| 772 | }; |
| 773 | |
| 774 | int |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 775 | sys_sysctl(struct tcb *tcp) |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 776 | { |
| 777 | struct __sysctl_args info; |
| 778 | int *name; |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 779 | unsigned long size; |
| 780 | |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 781 | if (umove(tcp, tcp->u_arg[0], &info) < 0) |
Roland McGrath | 2cbe44e | 2005-05-26 23:21:09 +0000 | [diff] [blame] | 782 | return printargs(tcp); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 783 | |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 784 | size = sizeof(int) * (unsigned long) info.nlen; |
| 785 | name = (size / sizeof(int) != info.nlen) ? NULL : malloc(size); |
Roland McGrath | 2cbe44e | 2005-05-26 23:21:09 +0000 | [diff] [blame] | 786 | if (name == NULL || |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 787 | umoven(tcp, (unsigned long) info.name, size, (char *) name) < 0) { |
| 788 | free(name); |
| 789 | if (entering(tcp)) |
| 790 | tprintf("{%p, %d, %p, %p, %p, %Zu}", |
| 791 | info.name, info.nlen, info.oldval, |
| 792 | info.oldlenp, info.newval, info.newlen); |
Roland McGrath | 2cbe44e | 2005-05-26 23:21:09 +0000 | [diff] [blame] | 793 | return 0; |
| 794 | } |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 795 | |
| 796 | if (entering(tcp)) { |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 797 | int cnt = 0, max_cnt; |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 798 | |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 799 | tprints("{{"); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 800 | |
| 801 | if (info.nlen == 0) |
| 802 | goto out; |
| 803 | printxval(sysctl_root, name[0], "CTL_???"); |
| 804 | ++cnt; |
| 805 | |
| 806 | if (info.nlen == 1) |
| 807 | goto out; |
| 808 | switch (name[0]) { |
| 809 | case CTL_KERN: |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 810 | tprints(", "); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 811 | printxval(sysctl_kern, name[1], "KERN_???"); |
| 812 | ++cnt; |
| 813 | break; |
| 814 | case CTL_VM: |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 815 | tprints(", "); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 816 | printxval(sysctl_vm, name[1], "VM_???"); |
| 817 | ++cnt; |
| 818 | break; |
| 819 | case CTL_NET: |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 820 | tprints(", "); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 821 | printxval(sysctl_net, name[1], "NET_???"); |
| 822 | ++cnt; |
| 823 | |
| 824 | if (info.nlen == 2) |
| 825 | goto out; |
| 826 | switch (name[1]) { |
| 827 | case NET_CORE: |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 828 | tprints(", "); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 829 | printxval(sysctl_net_core, name[2], |
| 830 | "NET_CORE_???"); |
| 831 | break; |
| 832 | case NET_UNIX: |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 833 | tprints(", "); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 834 | printxval(sysctl_net_unix, name[2], |
| 835 | "NET_UNIX_???"); |
| 836 | break; |
| 837 | case NET_IPV4: |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 838 | tprints(", "); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 839 | printxval(sysctl_net_ipv4, name[2], |
| 840 | "NET_IPV4_???"); |
| 841 | |
| 842 | if (info.nlen == 3) |
| 843 | goto out; |
| 844 | switch (name[2]) { |
| 845 | case NET_IPV4_ROUTE: |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 846 | tprints(", "); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 847 | printxval(sysctl_net_ipv4_route, |
| 848 | name[3], |
| 849 | "NET_IPV4_ROUTE_???"); |
| 850 | break; |
| 851 | case NET_IPV4_CONF: |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 852 | tprints(", "); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 853 | printxval(sysctl_net_ipv4_conf, |
| 854 | name[3], |
| 855 | "NET_IPV4_CONF_???"); |
| 856 | break; |
| 857 | default: |
| 858 | goto out; |
| 859 | } |
| 860 | break; |
| 861 | case NET_IPV6: |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 862 | tprints(", "); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 863 | printxval(sysctl_net_ipv6, name[2], |
| 864 | "NET_IPV6_???"); |
| 865 | |
| 866 | if (info.nlen == 3) |
| 867 | goto out; |
| 868 | switch (name[2]) { |
| 869 | case NET_IPV6_ROUTE: |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 870 | tprints(", "); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 871 | printxval(sysctl_net_ipv6_route, |
| 872 | name[3], |
| 873 | "NET_IPV6_ROUTE_???"); |
| 874 | break; |
| 875 | default: |
| 876 | goto out; |
| 877 | } |
| 878 | break; |
| 879 | default: |
| 880 | goto out; |
| 881 | } |
| 882 | break; |
| 883 | default: |
| 884 | goto out; |
| 885 | } |
| 886 | out: |
Roland McGrath | 8e4a3e6 | 2006-01-12 11:03:46 +0000 | [diff] [blame] | 887 | max_cnt = info.nlen; |
| 888 | if (abbrev(tcp) && max_cnt > max_strlen) |
| 889 | max_cnt = max_strlen; |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 890 | while (cnt < max_cnt) |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 891 | tprintf(", %x", name[cnt++]); |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 892 | if (cnt < info.nlen) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 893 | tprints(", ..."); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 894 | tprintf("}, %d, ", info.nlen); |
| 895 | } else { |
| 896 | size_t oldlen; |
Roland McGrath | aa524c8 | 2005-06-01 19:22:06 +0000 | [diff] [blame] | 897 | if (umove(tcp, (size_t)info.oldlenp, &oldlen) >= 0 |
| 898 | && info.nlen >= 2 |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 899 | && ((name[0] == CTL_KERN |
| 900 | && (name[1] == KERN_OSRELEASE |
| 901 | || name[1] == KERN_OSTYPE |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 902 | #ifdef KERN_JAVA_INTERPRETER |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 903 | || name[1] == KERN_JAVA_INTERPRETER |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 904 | #endif |
| 905 | #ifdef KERN_JAVA_APPLETVIEWER |
| 906 | || name[1] == KERN_JAVA_APPLETVIEWER |
| 907 | #endif |
| 908 | )))) { |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 909 | printpath(tcp, (size_t)info.oldval); |
Wichert Akkerman | 8b1b40c | 2000-02-03 21:58:30 +0000 | [diff] [blame] | 910 | tprintf(", %Zu, ", oldlen); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 911 | if (info.newval == 0) |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 912 | tprints("NULL"); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 913 | else if (syserror(tcp)) |
| 914 | tprintf("%p", info.newval); |
| 915 | else |
| 916 | printpath(tcp, (size_t)info.newval); |
| 917 | tprintf(", %Zd", info.newlen); |
| 918 | } else { |
Wichert Akkerman | 8b1b40c | 2000-02-03 21:58:30 +0000 | [diff] [blame] | 919 | tprintf("%p, %Zd, %p, %Zd", info.oldval, oldlen, |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 920 | info.newval, info.newlen); |
| 921 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 922 | tprints("}"); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 923 | } |
Roland McGrath | 2cbe44e | 2005-05-26 23:21:09 +0000 | [diff] [blame] | 924 | |
| 925 | free(name); |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 926 | return 0; |
| 927 | } |
Wichert Akkerman | 22fe9d2 | 1999-05-27 12:00:57 +0000 | [diff] [blame] | 928 | |
Wichert Akkerman | 0cbfb32 | 2001-02-19 13:35:53 +0000 | [diff] [blame] | 929 | #ifdef MIPS |
| 930 | |
Wichert Akkerman | d6b9249 | 2001-04-07 21:37:12 +0000 | [diff] [blame] | 931 | #ifndef __NEW_UTS_LEN |
| 932 | #define __NEW_UTS_LEN 64 |
| 933 | #endif |
| 934 | |
Roland McGrath | d9f816f | 2004-09-04 03:39:20 +0000 | [diff] [blame] | 935 | static const struct xlat sysmips_operations[] = { |
Wichert Akkerman | 0cbfb32 | 2001-02-19 13:35:53 +0000 | [diff] [blame] | 936 | { SETNAME, "SETNAME" }, |
| 937 | { FLUSH_CACHE, "FLUSH_CACHE" }, |
| 938 | { MIPS_FIXADE, "MIPS_FIXADE" }, |
| 939 | { MIPS_RDNVRAM, "MIPS_RDNVRAM" }, |
| 940 | { MIPS_ATOMIC_SET, "MIPS_ATOMIC_SET" }, |
| 941 | { 0, NULL } |
| 942 | }; |
| 943 | |
Denys Vlasenko | 1201426 | 2011-05-30 14:00:14 +0200 | [diff] [blame] | 944 | int sys_sysmips(struct tcb *tcp) |
Wichert Akkerman | 0cbfb32 | 2001-02-19 13:35:53 +0000 | [diff] [blame] | 945 | { |
| 946 | if (entering(tcp)) { |
Wichert Akkerman | 3472dd5 | 2001-04-10 10:27:52 +0000 | [diff] [blame] | 947 | printxval(sysmips_operations, tcp->u_arg[0], "???"); |
Wichert Akkerman | 0cbfb32 | 2001-02-19 13:35:53 +0000 | [diff] [blame] | 948 | if (!verbose(tcp)) { |
Wichert Akkerman | 3472dd5 | 2001-04-10 10:27:52 +0000 | [diff] [blame] | 949 | tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]); |
Denys Vlasenko | b63256e | 2011-06-07 12:13:24 +0200 | [diff] [blame] | 950 | } else if (tcp->u_arg[0] == SETNAME) { |
Wichert Akkerman | 3472dd5 | 2001-04-10 10:27:52 +0000 | [diff] [blame] | 951 | char nodename[__NEW_UTS_LEN + 1]; |
| 952 | if (umovestr(tcp, tcp->u_arg[1], (__NEW_UTS_LEN + 1), nodename) < 0) |
Wichert Akkerman | 0cbfb32 | 2001-02-19 13:35:53 +0000 | [diff] [blame] | 953 | tprintf(", %#lx", tcp->u_arg[1]); |
| 954 | else |
Denys Vlasenko | a17e55c | 2012-01-20 11:52:12 +0100 | [diff] [blame] | 955 | tprintf(", \"%.*s\"", (int)(__NEW_UTS_LEN + 1), nodename); |
Wichert Akkerman | 3472dd5 | 2001-04-10 10:27:52 +0000 | [diff] [blame] | 956 | } else if (tcp->u_arg[0] == MIPS_ATOMIC_SET) { |
| 957 | tprintf(", %#lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]); |
| 958 | } else if (tcp->u_arg[0] == MIPS_FIXADE) { |
| 959 | tprintf(", 0x%lx", tcp->u_arg[1]); |
Wichert Akkerman | 0cbfb32 | 2001-02-19 13:35:53 +0000 | [diff] [blame] | 960 | } else { |
Wichert Akkerman | 3472dd5 | 2001-04-10 10:27:52 +0000 | [diff] [blame] | 961 | tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]); |
Wichert Akkerman | 0cbfb32 | 2001-02-19 13:35:53 +0000 | [diff] [blame] | 962 | } |
| 963 | } |
| 964 | |
| 965 | return 0; |
| 966 | } |
| 967 | |
| 968 | #endif /* MIPS */ |