blob: f21dca79f3139dfddd9f1d0a03b3d85541edb373 [file] [log] [blame]
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001/*
2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
Wichert Akkerman4dc8a2a1999-12-23 14:20:14 +00005 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00006 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 * $Id$
31 */
32
33#include "defs.h"
34
35#ifdef LINUX
36#define _LINUX_SOCKET_H
Wichert Akkerman14cd9f01999-07-09 18:56:34 +000037#define _LINUX_FS_H
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000038
Roland McGrathcbd33582005-02-02 04:36:11 +000039#define MS_RDONLY 1 /* Mount read-only */
40#define MS_NOSUID 2 /* Ignore suid and sgid bits */
41#define MS_NODEV 4 /* Disallow access to device special files */
42#define MS_NOEXEC 8 /* Disallow program execution */
43#define MS_SYNCHRONOUS 16 /* Writes are synced at once */
44#define MS_REMOUNT 32 /* Alter flags of a mounted FS */
45#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */
46#define MS_DIRSYNC 128 /* Directory modifications are synchronous */
47#define MS_NOATIME 1024 /* Do not update access times. */
48#define MS_NODIRATIME 2048 /* Do not update directory access times */
49#define MS_BIND 4096
50#define MS_MOVE 8192
51#define MS_REC 16384
Dmitry V. Levin817b7082007-01-16 15:10:07 +000052#define MS_SILENT 32768
Roland McGrathcbd33582005-02-02 04:36:11 +000053#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
Dmitry V. Levin817b7082007-01-16 15:10:07 +000054#define MS_UNBINDABLE (1<<17) /* change to unbindable */
55#define MS_PRIVATE (1<<18) /* change to private */
56#define MS_SLAVE (1<<19) /* change to slave */
57#define MS_SHARED (1<<20) /* change to shared */
Roland McGrathcbd33582005-02-02 04:36:11 +000058#define MS_ACTIVE (1<<30)
59#define MS_NOUSER (1<<31)
Roland McGrath6af37482006-01-12 21:21:06 +000060#define MS_MGC_VAL 0xc0ed0000 /* Magic flag number */
Dmitry V. Levin817b7082007-01-16 15:10:07 +000061#define MS_MGC_MSK 0xffff0000 /* Magic flag mask */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000062
63#include <sys/socket.h>
64#include <netinet/in.h>
65#include <arpa/inet.h>
66
Nate Sammons8d5860c1999-07-03 18:53:05 +000067#include <sys/syscall.h>
68
Nate Sammons8d5860c1999-07-03 18:53:05 +000069#ifdef SYS_capget
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000070#include <linux/capability.h>
71#endif
72
Nate Sammons8d5860c1999-07-03 18:53:05 +000073#ifdef SYS_cacheflush
Wichert Akkerman2e2553a1999-05-09 00:29:58 +000074#include <asm/cachectl.h>
75#endif
76
Wichert Akkermand6b92492001-04-07 21:37:12 +000077#ifdef HAVE_LINUX_USTNAME_H
78#include <linux/utsname.h>
79#endif
80
Michal Ludvig39c0e942002-11-06 14:00:12 +000081#ifdef MIPS
Wichert Akkermand6b92492001-04-07 21:37:12 +000082#include <asm/sysmips.h>
83#endif
84
Wichert Akkerman22fe9d21999-05-27 12:00:57 +000085#include <linux/sysctl.h>
Wichert Akkerman22fe9d21999-05-27 12:00:57 +000086
Roland McGrathd9f816f2004-09-04 03:39:20 +000087static const struct xlat mount_flags[] = {
Roland McGrath6af37482006-01-12 21:21:06 +000088 { MS_MGC_VAL, "MS_MGC_VAL" },
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000089 { MS_RDONLY, "MS_RDONLY" },
90 { MS_NOSUID, "MS_NOSUID" },
91 { MS_NODEV, "MS_NODEV" },
92 { MS_NOEXEC, "MS_NOEXEC" },
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000093 { MS_SYNCHRONOUS,"MS_SYNCHRONOUS"},
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000094 { MS_REMOUNT, "MS_REMOUNT" },
Roland McGrathcbd33582005-02-02 04:36:11 +000095 { MS_MANDLOCK, "MS_MANDLOCK" },
96 { MS_NOATIME, "MS_NOATIME" },
97 { MS_NODIRATIME,"MS_NODIRATIME" },
98 { MS_BIND, "MS_BIND" },
99 { MS_MOVE, "MS_MOVE" },
100 { MS_REC, "MS_REC" },
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000101 { MS_SILENT, "MS_SILENT" },
Roland McGrathcbd33582005-02-02 04:36:11 +0000102 { MS_POSIXACL, "MS_POSIXACL" },
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000103 { MS_UNBINDABLE,"MS_UNBINDABLE" },
104 { MS_PRIVATE, "MS_PRIVATE" },
105 { MS_SLAVE, "MS_SLAVE" },
106 { MS_SHARED, "MS_SHARED" },
Roland McGrathcbd33582005-02-02 04:36:11 +0000107 { MS_ACTIVE, "MS_ACTIVE" },
108 { MS_NOUSER, "MS_NOUSER" },
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000109 { 0, NULL },
110};
111
112int
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000113sys_mount(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000114{
115 if (entering(tcp)) {
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000116 int ignore_type = 0, ignore_data = 0;
117 unsigned long flags = tcp->u_arg[3];
118
119 /* Discard magic */
120 if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
121 flags &= ~MS_MGC_MSK;
122
123 if (flags & MS_REMOUNT)
124 ignore_type = 1;
125 else if (flags & (MS_BIND | MS_MOVE))
126 ignore_type = ignore_data = 1;
127
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000128 printpath(tcp, tcp->u_arg[0]);
129 tprintf(", ");
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000130
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000131 printpath(tcp, tcp->u_arg[1]);
132 tprintf(", ");
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000133
134 if (ignore_type && tcp->u_arg[2])
Roland McGrathcbd33582005-02-02 04:36:11 +0000135 tprintf("%#lx", tcp->u_arg[2]);
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000136 else
137 printstr(tcp, tcp->u_arg[2], -1);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000138 tprintf(", ");
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000139
Roland McGrathb2dee132005-06-01 19:02:36 +0000140 printflags(mount_flags, tcp->u_arg[3], "MS_???");
Roland McGrath6af37482006-01-12 21:21:06 +0000141 tprintf(", ");
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000142
143 if (ignore_data && tcp->u_arg[4])
Roland McGrath6af37482006-01-12 21:21:06 +0000144 tprintf("%#lx", tcp->u_arg[4]);
Dmitry V. Levin817b7082007-01-16 15:10:07 +0000145 else
146 printstr(tcp, tcp->u_arg[4], -1);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000147 }
148 return 0;
149}
150
Dmitry V. Levin5c7ad8c2007-01-13 11:15:48 +0000151#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */
152#define MNT_DETACH 0x00000002 /* Just detach from the tree */
153#define MNT_EXPIRE 0x00000004 /* Mark for expiry */
154
155static const struct xlat umount_flags[] = {
156 { MNT_FORCE, "MNT_FORCE" },
157 { MNT_DETACH, "MNT_DETACH" },
158 { MNT_EXPIRE, "MNT_EXPIRE" },
159 { 0, NULL },
160};
161
Wichert Akkermandacfb6e1999-06-03 14:21:07 +0000162int
Dmitry V. Levin5c7ad8c2007-01-13 11:15:48 +0000163sys_umount2(struct tcb *tcp)
Wichert Akkermandacfb6e1999-06-03 14:21:07 +0000164{
165 if (entering(tcp)) {
166 printstr(tcp, tcp->u_arg[0], -1);
167 tprintf(", ");
Dmitry V. Levin5c7ad8c2007-01-13 11:15:48 +0000168 printflags(umount_flags, tcp->u_arg[1], "MNT_???");
Wichert Akkermandacfb6e1999-06-03 14:21:07 +0000169 }
170 return 0;
171}
172
Roland McGrathced50da2004-08-31 06:48:46 +0000173/* These are not macros, but enums. We just copy the values by hand
174 from Linux 2.6.9 here. */
Roland McGrathd9f816f2004-09-04 03:39:20 +0000175static const struct xlat personality_options[] = {
Roland McGrathced50da2004-08-31 06:48:46 +0000176 { 0, "PER_LINUX" },
177 { 0x00800000, "PER_LINUX_32BIT"},
178 { 0x04100001, "PER_SVR4" },
179 { 0x05000002, "PER_SVR3" },
180 { 0x07000003, "PER_SCOSVR3" },
181 { 0x06000003, "PER_OSR5" },
182 { 0x05000004, "PER_WYSEV386" },
183 { 0x04000005, "PER_ISCR4" },
184 { 0x00000006, "PER_BSD" },
185 { 0x04000006, "PER_SUNOS" },
186 { 0x05000007, "PER_XENIX" },
187 { 0x00000008, "PER_LINUX32" },
188 { 0x08000008, "PER_LINUX32_3GB"},
189 { 0x04000009, "PER_IRIX32" },
190 { 0x0400000a, "PER_IRIXN32" },
191 { 0x0400000b, "PER_IRIX64" },
192 { 0x0000000c, "PER_RISCOS" },
193 { 0x0400000d, "PER_SOLARIS" },
194 { 0x0410000e, "PER_UW7" },
195 { 0x0000000f, "PER_OSF4" },
196 { 0x00000010, "PER_HPUX" },
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000197 { 0, NULL },
198};
199
200int
201sys_personality(tcp)
202struct tcb *tcp;
203{
204 if (entering(tcp))
205 printxval(personality_options, tcp->u_arg[0], "PER_???");
206 return 0;
207}
208
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000209#include <linux/reboot.h>
Roland McGrathd9f816f2004-09-04 03:39:20 +0000210static const struct xlat bootflags1[] = {
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000211 { LINUX_REBOOT_MAGIC1, "LINUX_REBOOT_MAGIC1" },
212 { 0, NULL },
213};
214
Roland McGrathd9f816f2004-09-04 03:39:20 +0000215static const struct xlat bootflags2[] = {
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000216 { LINUX_REBOOT_MAGIC2, "LINUX_REBOOT_MAGIC2" },
217 { LINUX_REBOOT_MAGIC2A, "LINUX_REBOOT_MAGIC2A" },
218 { LINUX_REBOOT_MAGIC2B, "LINUX_REBOOT_MAGIC2B" },
219 { 0, NULL },
220};
221
Roland McGrathd9f816f2004-09-04 03:39:20 +0000222static const struct xlat bootflags3[] = {
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000223 { LINUX_REBOOT_CMD_CAD_OFF, "LINUX_REBOOT_CMD_CAD_OFF" },
224 { LINUX_REBOOT_CMD_RESTART, "LINUX_REBOOT_CMD_RESTART" },
225 { LINUX_REBOOT_CMD_HALT, "LINUX_REBOOT_CMD_HALT" },
226 { LINUX_REBOOT_CMD_CAD_ON, "LINUX_REBOOT_CMD_CAD_ON" },
227 { LINUX_REBOOT_CMD_POWER_OFF, "LINUX_REBOOT_CMD_POWER_OFF" },
228 { LINUX_REBOOT_CMD_RESTART2, "LINUX_REBOOT_CMD_RESTART2" },
229 { 0, NULL },
230};
231
232int
233sys_reboot(tcp)
234struct tcb *tcp;
235{
236 if (entering(tcp)) {
Roland McGrathb2dee132005-06-01 19:02:36 +0000237 printflags(bootflags1, tcp->u_arg[0], "LINUX_REBOOT_MAGIC_???");
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000238 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000239 printflags(bootflags2, tcp->u_arg[1], "LINUX_REBOOT_MAGIC_???");
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000240 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000241 printflags(bootflags3, tcp->u_arg[2], "LINUX_REBOOT_CMD_???");
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +0000242 if (tcp->u_arg[2] == LINUX_REBOOT_CMD_RESTART2) {
243 tprintf(", ");
244 printstr(tcp, tcp->u_arg[3], -1);
245 }
246 }
247 return 0;
248}
249
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000250#ifdef M68K
Roland McGrathd9f816f2004-09-04 03:39:20 +0000251static const struct xlat cacheflush_scope[] = {
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000252#ifdef FLUSH_SCOPE_LINE
253 { FLUSH_SCOPE_LINE, "FLUSH_SCOPE_LINE" },
254#endif
255#ifdef FLUSH_SCOPE_PAGE
256 { FLUSH_SCOPE_PAGE, "FLUSH_SCOPE_PAGE" },
257#endif
258#ifdef FLUSH_SCOPE_ALL
259 { FLUSH_SCOPE_ALL, "FLUSH_SCOPE_ALL" },
260#endif
261 { 0, NULL },
262};
263
Roland McGrathd9f816f2004-09-04 03:39:20 +0000264static const struct xlat cacheflush_flags[] = {
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000265#ifdef FLUSH_CACHE_BOTH
266 { FLUSH_CACHE_BOTH, "FLUSH_CACHE_BOTH" },
267#endif
268#ifdef FLUSH_CACHE_DATA
269 { FLUSH_CACHE_DATA, "FLUSH_CACHE_DATA" },
270#endif
271#ifdef FLUSH_CACHE_INSN
272 { FLUSH_CACHE_INSN, "FLUSH_CACHE_INSN" },
273#endif
274 { 0, NULL },
275};
276
277int
278sys_cacheflush(tcp)
279struct tcb *tcp;
280{
281 if (entering(tcp)) {
282 /* addr */
283 tprintf("%#lx, ", tcp->u_arg[0]);
284 /* scope */
285 printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
286 tprintf(", ");
287 /* flags */
Roland McGrathb2dee132005-06-01 19:02:36 +0000288 printflags(cacheflush_flags, tcp->u_arg[2], "FLUSH_CACHE_???");
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000289 /* len */
290 tprintf(", %lu", tcp->u_arg[3]);
291 }
292 return 0;
293}
294#endif /* M68K */
295
Dmitry V. Levin87ea1f42008-11-10 22:21:41 +0000296#ifdef BFIN
297
298#include <bfin_sram.h>
299
300static const struct xlat sram_alloc_flags[] = {
301 { L1_INST_SRAM, "L1_INST_SRAM" },
302 { L1_DATA_A_SRAM, "L1_DATA_A_SRAM" },
303 { L1_DATA_B_SRAM, "L1_DATA_B_SRAM" },
304 { L1_DATA_SRAM, "L1_DATA_SRAM" },
Denys Vlasenko132c52a2009-03-23 13:12:46 +0000305 { L2_SRAM, "L2_SRAM" },
Dmitry V. Levin87ea1f42008-11-10 22:21:41 +0000306 { 0, NULL },
307};
308
309int
Denys Vlasenko132c52a2009-03-23 13:12:46 +0000310sys_sram_alloc(struct tcb *tcp)
Dmitry V. Levin87ea1f42008-11-10 22:21:41 +0000311{
312 if (entering(tcp)) {
313 /* size */
Denys Vlasenko132c52a2009-03-23 13:12:46 +0000314 tprintf("%lu, ", tcp->u_arg[0]);
Dmitry V. Levin87ea1f42008-11-10 22:21:41 +0000315 /* flags */
Denys Vlasenko132c52a2009-03-23 13:12:46 +0000316 printxval(sram_alloc_flags, tcp->u_arg[1], "???_SRAM");
Dmitry V. Levin87ea1f42008-11-10 22:21:41 +0000317 }
318 return 1;
319}
320
321#endif
322
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000323#endif /* LINUX */
324
325#ifdef SUNOS4
326
327#include <sys/reboot.h>
328#define NFSCLIENT
329#define LOFS
330#define RFS
331#define PCFS
332#include <sys/mount.h>
333#include <sys/socket.h>
334#include <nfs/export.h>
335#include <rpc/types.h>
336#include <rpc/auth.h>
337
338/*ARGSUSED*/
339int
340sys_sync(tcp)
341struct tcb *tcp;
342{
343 return 0;
344}
345
Roland McGrathd9f816f2004-09-04 03:39:20 +0000346static const struct xlat bootflags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000347 { RB_AUTOBOOT, "RB_AUTOBOOT" }, /* for system auto-booting itself */
348 { RB_ASKNAME, "RB_ASKNAME" }, /* ask for file name to reboot from */
349 { RB_SINGLE, "RB_SINGLE" }, /* reboot to single user only */
350 { RB_NOSYNC, "RB_NOSYNC" }, /* dont sync before reboot */
351 { RB_HALT, "RB_HALT" }, /* don't reboot, just halt */
352 { RB_INITNAME, "RB_INITNAME" }, /* name given for /etc/init */
353 { RB_NOBOOTRC, "RB_NOBOOTRC" }, /* don't run /etc/rc.boot */
354 { RB_DEBUG, "RB_DEBUG" }, /* being run under debugger */
355 { RB_DUMP, "RB_DUMP" }, /* dump system core */
356 { RB_WRITABLE, "RB_WRITABLE" }, /* mount root read/write */
357 { RB_STRING, "RB_STRING" }, /* pass boot args to prom monitor */
358 { 0, NULL },
359};
360
361int
362sys_reboot(tcp)
363struct tcb *tcp;
364{
365 if (entering(tcp)) {
Roland McGrathb2dee132005-06-01 19:02:36 +0000366 printflags(bootflags, tcp->u_arg[0], "RB_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000367 if (tcp->u_arg[0] & RB_STRING) {
368 printstr(tcp, tcp->u_arg[1], -1);
369 }
370 }
371 return 0;
372}
373
374int
375sys_sysacct(tcp)
376struct tcb *tcp;
377{
378 if (entering(tcp)) {
379 printstr(tcp, tcp->u_arg[0], -1);
380 }
381 return 0;
382}
383
384int
385sys_swapon(tcp)
386struct tcb *tcp;
387{
388 if (entering(tcp)) {
389 printstr(tcp, tcp->u_arg[0], -1);
390 }
391 return 0;
392}
393
394int
395sys_nfs_svc(tcp)
396struct tcb *tcp;
397{
398 if (entering(tcp)) {
399 printsock(tcp, tcp->u_arg[0]);
400 }
401 return 0;
402}
403
Roland McGrathd9f816f2004-09-04 03:39:20 +0000404static const struct xlat mountflags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000405 { M_RDONLY, "M_RDONLY" },
406 { M_NOSUID, "M_NOSUID" },
407 { M_NEWTYPE, "M_NEWTYPE" },
408 { M_GRPID, "M_GRPID" },
409#ifdef M_REMOUNT
410 { M_REMOUNT, "M_REMOUNT" },
411#endif
412#ifdef M_NOSUB
413 { M_NOSUB, "M_NOSUB" },
414#endif
415#ifdef M_MULTI
416 { M_MULTI, "M_MULTI" },
417#endif
418#ifdef M_SYS5
419 { M_SYS5, "M_SYS5" },
420#endif
421 { 0, NULL },
422};
423
Roland McGrathd9f816f2004-09-04 03:39:20 +0000424static const struct xlat nfsflags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000425 { NFSMNT_SOFT, "NFSMNT_SOFT" },
426 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
427 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
428 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
429 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
430 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
431 { NFSMNT_INT, "NFSMNT_INT" },
432 { NFSMNT_NOAC, "NFSMNT_NOAC" },
433 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
434 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
435 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
436 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
437#ifdef NFSMNT_SECURE
438 { NFSMNT_SECURE, "NFSMNT_SECURE" },
439#endif
440#ifdef NFSMNT_NOCTO
441 { NFSMNT_NOCTO, "NFSMNT_NOCTO" },
442#endif
443#ifdef NFSMNT_POSIX
444 { NFSMNT_POSIX, "NFSMNT_POSIX" },
445#endif
446 { 0, NULL },
447};
448
449int
450sys_mount(tcp)
451struct tcb *tcp;
452{
453 char type[4];
454
455 if (entering(tcp)) {
456 if (!(tcp->u_arg[2] & M_NEWTYPE) || umovestr(tcp,
457 tcp->u_arg[0], sizeof type, type) < 0) {
458 tprintf("OLDTYPE:#%lx", tcp->u_arg[0]);
459 } else {
460 tprintf("\"%s\", ", type);
461 }
462 printstr(tcp, tcp->u_arg[1], -1);
463 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000464 printflags(mountflags, tcp->u_arg[2] & ~M_NEWTYPE, "M_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000465 tprintf(", ");
466
467 if (strcmp(type, "4.2") == 0) {
468 struct ufs_args a;
469 if (umove(tcp, tcp->u_arg[3], &a) < 0)
470 return 0;
471 printstr(tcp, (int)a.fspec, -1);
472 } else if (strcmp(type, "lo") == 0) {
473 struct lo_args a;
474 if (umove(tcp, tcp->u_arg[3], &a) < 0)
475 return 0;
476 printstr(tcp, (int)a.fsdir, -1);
477 } else if (strcmp(type, "nfs") == 0) {
478 struct nfs_args a;
479 if (umove(tcp, tcp->u_arg[3], &a) < 0)
480 return 0;
481 tprintf("[");
482 printsock(tcp, (int) a.addr);
483 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000484 printflags(nfsflags, a.flags, "NFSMNT_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000485 tprintf(", ws:%u,rs:%u,to:%u,re:%u,",
486 a.wsize, a.rsize, a.timeo, a.retrans);
487 if (a.flags & NFSMNT_HOSTNAME && a.hostname)
488 printstr(tcp, (int)a.hostname, -1);
489 else
490 tprintf("%#lx", (unsigned long) a.hostname);
491 tprintf(",reg-min:%u,max:%u,dir-min:%u,max:%u,",
492 a.acregmin, a.acregmax, a.acdirmin, a.acdirmax);
493 if ((a.flags & NFSMNT_SECURE) && a.netname)
494 printstr(tcp, (int) a.netname, -1);
495 else
496 tprintf("%#lx", (unsigned long) a.netname);
497 tprintf("]");
498 } else if (strcmp(type, "rfs") == 0) {
499 struct rfs_args a;
500 struct token t;
501 if (umove(tcp, tcp->u_arg[3], &a) < 0)
502 return 0;
503 tprintf("[");
504 printstr(tcp, (int)a.rmtfs, -1);
505 if (umove(tcp, (int)a.token, &t) < 0)
506 return 0;
507 tprintf(", %u, %s]", t.t_id, t.t_uname);
508 } else if (strcmp(type, "pcfs") == 0) {
509 struct pc_args a;
510 if (umove(tcp, tcp->u_arg[3], &a) < 0)
511 return 0;
512 printstr(tcp, (int)a.fspec, -1);
513 }
514 }
515 return 0;
516}
517
518int
519sys_unmount(tcp)
520struct tcb *tcp;
521{
522 if (entering(tcp)) {
523 printstr(tcp, tcp->u_arg[0], -1);
524 }
525 return 0;
526}
527
528int
529sys_umount(tcp)
530struct tcb *tcp;
531{
532 return sys_unmount(tcp);
533}
534
535int
536sys_auditsys(tcp)
537struct tcb *tcp;
538{
539 /* XXX - no information available */
540 return printargs(tcp);
541}
542
Roland McGrathd9f816f2004-09-04 03:39:20 +0000543static const struct xlat ex_auth_flags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000544 { AUTH_UNIX, "AUTH_UNIX" },
545 { AUTH_DES, "AUTH_DES" },
546 { 0, NULL },
547};
548
549int
550sys_exportfs(tcp)
551struct tcb *tcp;
552{
553 struct export e;
554 int i;
555
556 if (entering(tcp)) {
557 printstr(tcp, tcp->u_arg[0], -1);
558 if (umove(tcp, tcp->u_arg[1], &e) < 0) {
559 tprintf("%#lx", tcp->u_arg[1]);
560 return 0;
561 }
562 tprintf("{fl:%u, anon:%u, ", e.ex_flags, e.ex_anon);
563 printxval(ex_auth_flags, e.ex_auth, "AUTH_???");
564 tprintf(", roots:[");
565 if (e.ex_auth == AUTH_UNIX) {
566 for (i=0; i<e.ex_u.exunix.rootaddrs.naddrs; i++) {
567 printsock(tcp,
568 (int)&e.ex_u.exunix.rootaddrs.addrvec[i]);
569 }
570 tprintf("], writers:[");
571 for (i=0; i<e.ex_writeaddrs.naddrs; i++) {
572 printsock(tcp,
573 (int)&e.ex_writeaddrs.addrvec[i]);
574 }
575 tprintf("]");
576 } else {
577 for (i=0; i<e.ex_u.exdes.nnames; i++) {
578 printsock(tcp,
579 (int)&e.ex_u.exdes.rootnames[i]);
580 tprintf(", ");
581 }
582 tprintf("], window:%u", e.ex_u.exdes.window);
583 }
584 tprintf("}");
585 }
586 return 0;
587}
588
Roland McGrathd9f816f2004-09-04 03:39:20 +0000589static const struct xlat sysconflimits[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000590#ifdef _SC_ARG_MAX
591 { _SC_ARG_MAX, "_SC_ARG_MAX" }, /* space for argv & envp */
592#endif
593#ifdef _SC_CHILD_MAX
594 { _SC_CHILD_MAX, "_SC_CHILD_MAX" }, /* maximum children per process??? */
595#endif
596#ifdef _SC_CLK_TCK
597 { _SC_CLK_TCK, "_SC_CLK_TCK" }, /* clock ticks/sec */
598#endif
599#ifdef _SC_NGROUPS_MAX
600 { _SC_NGROUPS_MAX, "_SC_NGROUPS_MAX" }, /* number of groups if multple supp. */
601#endif
602#ifdef _SC_OPEN_MAX
603 { _SC_OPEN_MAX, "_SC_OPEN_MAX" }, /* max open files per process */
604#endif
605#ifdef _SC_JOB_CONTROL
606 { _SC_JOB_CONTROL, "_SC_JOB_CONTROL" }, /* do we have job control */
607#endif
608#ifdef _SC_SAVED_IDS
609 { _SC_SAVED_IDS, "_SC_SAVED_IDS" }, /* do we have saved uid/gids */
610#endif
611#ifdef _SC_VERSION
612 { _SC_VERSION, "_SC_VERSION" }, /* POSIX version supported */
613#endif
614 { 0, NULL },
615};
616
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000617int
618sys_sysconf(tcp)
619struct tcb *tcp;
620{
621 if (entering(tcp)) {
622 printxval(sysconflimits, tcp->u_arg[0], "_SC_???");
623 }
624 return 0;
625}
626
627#endif /* SUNOS4 */
628
629#if defined(SUNOS4) || defined(FREEBSD)
Roland McGrathd9f816f2004-09-04 03:39:20 +0000630static const struct xlat pathconflimits[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000631#ifdef _PC_LINK_MAX
632 { _PC_LINK_MAX, "_PC_LINK_MAX" }, /* max links to file/dir */
633#endif
634#ifdef _PC_MAX_CANON
635 { _PC_MAX_CANON, "_PC_MAX_CANON" }, /* max line length */
636#endif
637#ifdef _PC_MAX_INPUT
638 { _PC_MAX_INPUT, "_PC_MAX_INPUT" }, /* max "packet" to a tty device */
639#endif
640#ifdef _PC_NAME_MAX
641 { _PC_NAME_MAX, "_PC_NAME_MAX" }, /* max pathname component length */
642#endif
643#ifdef _PC_PATH_MAX
644 { _PC_PATH_MAX, "_PC_PATH_MAX" }, /* max pathname length */
645#endif
646#ifdef _PC_PIPE_BUF
647 { _PC_PIPE_BUF, "_PC_PIPE_BUF" }, /* size of a pipe */
648#endif
649#ifdef _PC_CHOWN_RESTRICTED
650 { _PC_CHOWN_RESTRICTED, "_PC_CHOWN_RESTRICTED" }, /* can we give away files */
651#endif
652#ifdef _PC_NO_TRUNC
653 { _PC_NO_TRUNC, "_PC_NO_TRUNC" }, /* trunc or error on >NAME_MAX */
654#endif
655#ifdef _PC_VDISABLE
656 { _PC_VDISABLE, "_PC_VDISABLE" }, /* best char to shut off tty c_cc */
657#endif
658 { 0, NULL },
659};
660
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000661
662int
663sys_pathconf(tcp)
664struct tcb *tcp;
665{
666 if (entering(tcp)) {
667 printstr(tcp, tcp->u_arg[0], -1);
668 tprintf(", ");
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000669 printxval(pathconflimits, tcp->u_arg[1], "_PC_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000670 }
671 return 0;
672}
673
674int
675sys_fpathconf(tcp)
676struct tcb *tcp;
677{
678 if (entering(tcp)) {
679 tprintf("%lu, ", tcp->u_arg[0]);
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000680 printxval(pathconflimits, tcp->u_arg[1], "_PC_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000681 }
682 return 0;
683}
684
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +0000685#endif /* SUNOS4 || FREEBSD */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000686
687#ifdef SVR4
688
689#ifdef HAVE_SYS_SYSCONFIG_H
690#include <sys/sysconfig.h>
691#endif /* HAVE_SYS_SYSCONFIG_H */
692
693#include <sys/mount.h>
694#include <sys/systeminfo.h>
695#include <sys/utsname.h>
696
Roland McGrathd9f816f2004-09-04 03:39:20 +0000697static const struct xlat sysconfig_options[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000698#ifdef _CONFIG_NGROUPS
699 { _CONFIG_NGROUPS, "_CONFIG_NGROUPS" },
700#endif
701#ifdef _CONFIG_CHILD_MAX
702 { _CONFIG_CHILD_MAX, "_CONFIG_CHILD_MAX" },
703#endif
704#ifdef _CONFIG_OPEN_FILES
705 { _CONFIG_OPEN_FILES, "_CONFIG_OPEN_FILES" },
706#endif
707#ifdef _CONFIG_POSIX_VER
708 { _CONFIG_POSIX_VER, "_CONFIG_POSIX_VER" },
709#endif
710#ifdef _CONFIG_PAGESIZE
711 { _CONFIG_PAGESIZE, "_CONFIG_PAGESIZE" },
712#endif
713#ifdef _CONFIG_CLK_TCK
714 { _CONFIG_CLK_TCK, "_CONFIG_CLK_TCK" },
715#endif
716#ifdef _CONFIG_XOPEN_VER
717 { _CONFIG_XOPEN_VER, "_CONFIG_XOPEN_VER" },
718#endif
719#ifdef _CONFIG_PROF_TCK
720 { _CONFIG_PROF_TCK, "_CONFIG_PROF_TCK" },
721#endif
722#ifdef _CONFIG_NPROC_CONF
723 { _CONFIG_NPROC_CONF, "_CONFIG_NPROC_CONF" },
724#endif
725#ifdef _CONFIG_NPROC_ONLN
726 { _CONFIG_NPROC_ONLN, "_CONFIG_NPROC_ONLN" },
727#endif
728#ifdef _CONFIG_AIO_LISTIO_MAX
729 { _CONFIG_AIO_LISTIO_MAX, "_CONFIG_AIO_LISTIO_MAX" },
730#endif
731#ifdef _CONFIG_AIO_MAX
732 { _CONFIG_AIO_MAX, "_CONFIG_AIO_MAX" },
733#endif
734#ifdef _CONFIG_AIO_PRIO_DELTA_MAX
735 { _CONFIG_AIO_PRIO_DELTA_MAX, "_CONFIG_AIO_PRIO_DELTA_MAX" },
736#endif
737#ifdef _CONFIG_CONFIG_DELAYTIMER_MAX
738 { _CONFIG_DELAYTIMER_MAX, "_CONFIG_DELAYTIMER_MAX" },
739#endif
740#ifdef _CONFIG_MQ_OPEN_MAX
741 { _CONFIG_MQ_OPEN_MAX, "_CONFIG_MQ_OPEN_MAX" },
742#endif
743#ifdef _CONFIG_MQ_PRIO_MAX
744 { _CONFIG_MQ_PRIO_MAX, "_CONFIG_MQ_PRIO_MAX" },
745#endif
746#ifdef _CONFIG_RTSIG_MAX
747 { _CONFIG_RTSIG_MAX, "_CONFIG_RTSIG_MAX" },
748#endif
749#ifdef _CONFIG_SEM_NSEMS_MAX
750 { _CONFIG_SEM_NSEMS_MAX, "_CONFIG_SEM_NSEMS_MAX" },
751#endif
752#ifdef _CONFIG_SEM_VALUE_MAX
753 { _CONFIG_SEM_VALUE_MAX, "_CONFIG_SEM_VALUE_MAX" },
754#endif
755#ifdef _CONFIG_SIGQUEUE_MAX
756 { _CONFIG_SIGQUEUE_MAX, "_CONFIG_SIGQUEUE_MAX" },
757#endif
758#ifdef _CONFIG_SIGRT_MIN
759 { _CONFIG_SIGRT_MIN, "_CONFIG_SIGRT_MIN" },
760#endif
761#ifdef _CONFIG_SIGRT_MAX
762 { _CONFIG_SIGRT_MAX, "_CONFIG_SIGRT_MAX" },
763#endif
764#ifdef _CONFIG_TIMER_MAX
765 { _CONFIG_TIMER_MAX, "_CONFIG_TIMER_MAX" },
766#endif
767#ifdef _CONFIG_CONFIG_PHYS_PAGES
768 { _CONFIG_PHYS_PAGES, "_CONFIG_PHYS_PAGES" },
769#endif
770#ifdef _CONFIG_AVPHYS_PAGES
771 { _CONFIG_AVPHYS_PAGES, "_CONFIG_AVPHYS_PAGES" },
772#endif
773 { 0, NULL },
774};
775
776int
777sys_sysconfig(tcp)
778struct tcb *tcp;
779{
780 if (entering(tcp))
781 printxval(sysconfig_options, tcp->u_arg[0], "_CONFIG_???");
782 return 0;
783}
784
Roland McGrathd9f816f2004-09-04 03:39:20 +0000785static const struct xlat sysinfo_options[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000786 { SI_SYSNAME, "SI_SYSNAME" },
787 { SI_HOSTNAME, "SI_HOSTNAME" },
788 { SI_RELEASE, "SI_RELEASE" },
789 { SI_VERSION, "SI_VERSION" },
790 { SI_MACHINE, "SI_MACHINE" },
791 { SI_ARCHITECTURE, "SI_ARCHITECTURE" },
792 { SI_HW_SERIAL, "SI_HW_SERIAL" },
793 { SI_HW_PROVIDER, "SI_HW_PROVIDER" },
794 { SI_SRPC_DOMAIN, "SI_SRPC_DOMAIN" },
795#ifdef SI_SET_HOSTNAME
796 { SI_SET_HOSTNAME, "SI_SET_HOSTNAME" },
797#endif
798#ifdef SI_SET_SRPC_DOMAIN
799 { SI_SET_SRPC_DOMAIN, "SI_SET_SRPC_DOMAIN" },
800#endif
801#ifdef SI_SET_KERB_REALM
802 { SI_SET_KERB_REALM, "SI_SET_KERB_REALM" },
803#endif
804#ifdef SI_KERB_REALM
805 { SI_KERB_REALM, "SI_KERB_REALM" },
806#endif
807 { 0, NULL },
808};
809
810int
811sys_sysinfo(tcp)
812struct tcb *tcp;
813{
814 if (entering(tcp)) {
815 printxval(sysinfo_options, tcp->u_arg[0], "SI_???");
816 tprintf(", ");
817 }
818 else {
819 /* Technically some calls write values. So what. */
820 if (syserror(tcp))
821 tprintf("%#lx", tcp->u_arg[1]);
822 else
823 printpath(tcp, tcp->u_arg[1]);
824 tprintf(", %lu", tcp->u_arg[2]);
825 }
826 return 0;
827}
828
829#ifdef MIPS
830
831#include <sys/syssgi.h>
832
Roland McGrathd9f816f2004-09-04 03:39:20 +0000833static const struct xlat syssgi_options[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000834 { SGI_SYSID, "SGI_SYSID" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000835#ifdef SGI_RDUBLK
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000836 { SGI_RDUBLK, "SGI_RDUBLK" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000837#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000838 { SGI_TUNE, "SGI_TUNE" },
839 { SGI_IDBG, "SGI_IDBG" },
840 { SGI_INVENT, "SGI_INVENT" },
841 { SGI_RDNAME, "SGI_RDNAME" },
842 { SGI_SETLED, "SGI_SETLED" },
843 { SGI_SETNVRAM, "SGI_SETNVRAM" },
844 { SGI_GETNVRAM, "SGI_GETNVRAM" },
845 { SGI_QUERY_FTIMER, "SGI_QUERY_FTIMER" },
846 { SGI_QUERY_CYCLECNTR, "SGI_QUERY_CYCLECNTR" },
847 { SGI_PROCSZ, "SGI_PROCSZ" },
848 { SGI_SIGACTION, "SGI_SIGACTION" },
849 { SGI_SIGPENDING, "SGI_SIGPENDING" },
850 { SGI_SIGPROCMASK, "SGI_SIGPROCMASK" },
851 { SGI_SIGSUSPEND, "SGI_SIGSUSPEND" },
852 { SGI_SETSID, "SGI_SETSID" },
853 { SGI_SETPGID, "SGI_SETPGID" },
854 { SGI_SYSCONF, "SGI_SYSCONF" },
855 { SGI_WAIT4, "SGI_WAIT4" },
856 { SGI_PATHCONF, "SGI_PATHCONF" },
857 { SGI_READB, "SGI_READB" },
858 { SGI_WRITEB, "SGI_WRITEB" },
859 { SGI_SETGROUPS, "SGI_SETGROUPS" },
860 { SGI_GETGROUPS, "SGI_GETGROUPS" },
861 { SGI_SETTIMEOFDAY, "SGI_SETTIMEOFDAY" },
862 { SGI_SETTIMETRIM, "SGI_SETTIMETRIM" },
863 { SGI_GETTIMETRIM, "SGI_GETTIMETRIM" },
864 { SGI_SPROFIL, "SGI_SPROFIL" },
865 { SGI_RUSAGE, "SGI_RUSAGE" },
866 { SGI_SIGSTACK, "SGI_SIGSTACK" },
867 { SGI_SIGSTATUS, "SGI_SIGSTATUS" },
868 { SGI_NETPROC, "SGI_NETPROC" },
869 { SGI_SIGALTSTACK, "SGI_SIGALTSTACK" },
870 { SGI_BDFLUSHCNT, "SGI_BDFLUSHCNT" },
871 { SGI_SSYNC, "SGI_SSYNC" },
872 { SGI_NFSCNVT, "SGI_NFSCNVT" },
873 { SGI_GETPGID, "SGI_GETPGID" },
874 { SGI_GETSID, "SGI_GETSID" },
875 { SGI_IOPROBE, "SGI_IOPROBE" },
876 { SGI_CONFIG, "SGI_CONFIG" },
877 { SGI_ELFMAP, "SGI_ELFMAP" },
878 { SGI_MCONFIG, "SGI_MCONFIG" },
879 { SGI_GETPLABEL, "SGI_GETPLABEL" },
880 { SGI_SETPLABEL, "SGI_SETPLABEL" },
881 { SGI_GETLABEL, "SGI_GETLABEL" },
882 { SGI_SETLABEL, "SGI_SETLABEL" },
883 { SGI_SATREAD, "SGI_SATREAD" },
884 { SGI_SATWRITE, "SGI_SATWRITE" },
885 { SGI_SATCTL, "SGI_SATCTL" },
886 { SGI_LOADATTR, "SGI_LOADATTR" },
887 { SGI_UNLOADATTR, "SGI_UNLOADATTR" },
888#ifdef SGI_RECVLMSG
889 { SGI_RECVLMSG, "SGI_RECVLMSG" },
890#endif
891 { SGI_PLANGMOUNT, "SGI_PLANGMOUNT" },
892 { SGI_GETPSOACL, "SGI_GETPSOACL" },
893 { SGI_SETPSOACL, "SGI_SETPSOACL" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000894#ifdef SGI_EAG_GET_ATTR
895 { SGI_EAG_GET_ATTR, "SGI_EAG_GET_ATTR" },
896#endif
897#ifdef SGI_EAG_SET_ATTR
898 { SGI_EAG_SET_ATTR, "SGI_EAG_SET_ATTR" },
899#endif
900#ifdef SGI_EAG_GET_PROCATTR
901 { SGI_EAG_GET_PROCATTR, "SGI_EAG_GET_PROCATTR" },
902#endif
903#ifdef SGI_EAG_SET_PROCATTR
904 { SGI_EAG_SET_PROCATTR, "SGI_EAG_SET_PROCATTR" },
905#endif
906#ifdef SGI_FREVOKE
907 { SGI_FREVOKE, "SGI_FREVOKE" },
908#endif
909#ifdef SGI_SBE_GET_INFO
910 { SGI_SBE_GET_INFO, "SGI_SBE_GET_INFO" },
911#endif
912#ifdef SGI_SBE_CLR_INFO
913 { SGI_SBE_CLR_INFO, "SGI_SBE_CLR_INFO" },
914#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000915 { SGI_RMI_FIXECC, "SGI_RMI_FIXECC" },
916 { SGI_R4K_CERRS, "SGI_R4K_CERRS" },
917 { SGI_GET_EVCONF, "SGI_GET_EVCONF" },
918 { SGI_MPCWAROFF, "SGI_MPCWAROFF" },
919 { SGI_SET_AUTOPWRON, "SGI_SET_AUTOPWRON" },
920 { SGI_SPIPE, "SGI_SPIPE" },
921 { SGI_SYMTAB, "SGI_SYMTAB" },
922#ifdef SGI_SET_FPDEBUG
923 { SGI_SET_FPDEBUG, "SGI_SET_FPDEBUG" },
924#endif
Wichert Akkerman8829a551999-06-11 13:18:40 +0000925#ifdef SGI_SET_FP_PRECISE
926 { SGI_SET_FP_PRECISE, "SGI_SET_FP_PRECISE" },
927#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000928 { SGI_TOSSTSAVE, "SGI_TOSSTSAVE" },
929 { SGI_FDHI, "SGI_FDHI" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000930#ifdef SGI_SET_CONFIG_SMM
931 { SGI_SET_CONFIG_SMM, "SGI_SET_CONFIG_SMM" },
932#endif
933#ifdef SGI_SET_FP_PRESERVE
934 { SGI_SET_FP_PRESERVE, "SGI_SET_FP_PRESERVE" },
935#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000936 { SGI_MINRSS, "SGI_MINRSS" },
Wichert Akkerman8829a551999-06-11 13:18:40 +0000937#ifdef SGI_GRIO
938 { SGI_GRIO, "SGI_GRIO" },
939#endif
940#ifdef SGI_XLV_SET_TAB
941 { SGI_XLV_SET_TAB, "SGI_XLV_SET_TAB" },
942#endif
943#ifdef SGI_XLV_GET_TAB
944 { SGI_XLV_GET_TAB, "SGI_XLV_GET_TAB" },
945#endif
946#ifdef SGI_GET_FP_PRECISE
947 { SGI_GET_FP_PRECISE, "SGI_GET_FP_PRECISE" },
948#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000949#ifdef SGI_GET_CONFIG_SMM
Wichert Akkerman8829a551999-06-11 13:18:40 +0000950 { SGI_GET_CONFIG_SMM, "SGI_GET_CONFIG_SMM" },
951#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000952#ifdef SGI_FP_IMPRECISE_SUPP
Wichert Akkerman8829a551999-06-11 13:18:40 +0000953 { SGI_FP_IMPRECISE_SUPP,"SGI_FP_IMPRECISE_SUPP" },
954#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000955#ifdef SGI_CONFIG_NSMM_SUPP
Wichert Akkerman8829a551999-06-11 13:18:40 +0000956 { SGI_CONFIG_NSMM_SUPP, "SGI_CONFIG_NSMM_SUPP" },
957#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000958#ifdef SGI_RT_TSTAMP_CREATE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000959 { SGI_RT_TSTAMP_CREATE, "SGI_RT_TSTAMP_CREATE" },
960#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000961#ifdef SGI_RT_TSTAMP_DELETE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000962 { SGI_RT_TSTAMP_DELETE, "SGI_RT_TSTAMP_DELETE" },
963#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000964#ifdef SGI_RT_TSTAMP_START
Wichert Akkerman8829a551999-06-11 13:18:40 +0000965 { SGI_RT_TSTAMP_START, "SGI_RT_TSTAMP_START" },
966#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000967#ifdef SGI_RT_TSTAMP_STOP
Wichert Akkerman8829a551999-06-11 13:18:40 +0000968 { SGI_RT_TSTAMP_STOP, "SGI_RT_TSTAMP_STOP" },
969#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000970#ifdef SGI_RT_TSTAMP_ADDR
Wichert Akkerman8829a551999-06-11 13:18:40 +0000971 { SGI_RT_TSTAMP_ADDR, "SGI_RT_TSTAMP_ADDR" },
972#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000973#ifdef SGI_RT_TSTAMP_MASK
Wichert Akkerman8829a551999-06-11 13:18:40 +0000974 { SGI_RT_TSTAMP_MASK, "SGI_RT_TSTAMP_MASK" },
975#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000976#ifdef SGI_RT_TSTAMP_EOB_MODE
Wichert Akkerman8829a551999-06-11 13:18:40 +0000977 { SGI_RT_TSTAMP_EOB_MODE,"SGI_RT_TSTAMP_EOB_MODE"},
978#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000979#ifdef SGI_USE_FP_BCOPY
Wichert Akkerman8829a551999-06-11 13:18:40 +0000980 { SGI_USE_FP_BCOPY, "SGI_USE_FP_BCOPY" },
981#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000982#ifdef SGI_GET_UST
Wichert Akkerman8829a551999-06-11 13:18:40 +0000983 { SGI_GET_UST, "SGI_GET_UST" },
984#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000985#ifdef SGI_SPECULATIVE_EXEC
Wichert Akkerman8829a551999-06-11 13:18:40 +0000986 { SGI_SPECULATIVE_EXEC, "SGI_SPECULATIVE_EXEC" },
987#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000988#ifdef SGI_XLV_NEXT_RQST
Wichert Akkerman8829a551999-06-11 13:18:40 +0000989 { SGI_XLV_NEXT_RQST, "SGI_XLV_NEXT_RQST" },
990#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000991#ifdef SGI_XLV_ATTR_CURSOR
Wichert Akkerman8829a551999-06-11 13:18:40 +0000992 { SGI_XLV_ATTR_CURSOR, "SGI_XLV_ATTR_CURSOR" },
993#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000994#ifdef SGI_XLV_ATTR_GET
Wichert Akkerman8829a551999-06-11 13:18:40 +0000995 { SGI_XLV_ATTR_GET, "SGI_XLV_ATTR_GET" },
996#endif
Roland McGrathced50da2004-08-31 06:48:46 +0000997#ifdef SGI_XLV_ATTR_SET
Wichert Akkerman8829a551999-06-11 13:18:40 +0000998 { SGI_XLV_ATTR_SET, "SGI_XLV_ATTR_SET" },
999#endif
1000#ifdef SGI_BTOOLSIZE
1001 { SGI_BTOOLSIZE, "SGI_BTOOLSIZE" },
1002#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001003#ifdef SGI_BTOOLGET
Wichert Akkerman8829a551999-06-11 13:18:40 +00001004 { SGI_BTOOLGET, "SGI_BTOOLGET" },
1005#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001006#ifdef SGI_BTOOLREINIT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001007 { SGI_BTOOLREINIT, "SGI_BTOOLREINIT" },
1008#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001009#ifdef SGI_CREATE_UUID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001010 { SGI_CREATE_UUID, "SGI_CREATE_UUID" },
1011#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001012#ifdef SGI_NOFPE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001013 { SGI_NOFPE, "SGI_NOFPE" },
1014#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001015#ifdef SGI_OLD_SOFTFP
Wichert Akkerman8829a551999-06-11 13:18:40 +00001016 { SGI_OLD_SOFTFP, "SGI_OLD_SOFTFP" },
1017#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001018#ifdef SGI_FS_INUMBERS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001019 { SGI_FS_INUMBERS, "SGI_FS_INUMBERS" },
1020#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001021#ifdef SGI_FS_BULKSTAT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001022 { SGI_FS_BULKSTAT, "SGI_FS_BULKSTAT" },
1023#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001024#ifdef SGI_RT_TSTAMP_WAIT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001025 { SGI_RT_TSTAMP_WAIT, "SGI_RT_TSTAMP_WAIT" },
1026#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001027#ifdef SGI_RT_TSTAMP_UPDATE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001028 { SGI_RT_TSTAMP_UPDATE, "SGI_RT_TSTAMP_UPDATE" },
1029#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001030#ifdef SGI_PATH_TO_HANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001031 { SGI_PATH_TO_HANDLE, "SGI_PATH_TO_HANDLE" },
1032#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001033#ifdef SGI_PATH_TO_FSHANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001034 { SGI_PATH_TO_FSHANDLE, "SGI_PATH_TO_FSHANDLE" },
1035#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001036#ifdef SGI_FD_TO_HANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001037 { SGI_FD_TO_HANDLE, "SGI_FD_TO_HANDLE" },
1038#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001039#ifdef SGI_OPEN_BY_HANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001040 { SGI_OPEN_BY_HANDLE, "SGI_OPEN_BY_HANDLE" },
1041#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001042#ifdef SGI_READLINK_BY_HANDLE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001043 { SGI_READLINK_BY_HANDLE,"SGI_READLINK_BY_HANDLE"},
1044#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001045#ifdef SGI_READ_DANGID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001046 { SGI_READ_DANGID, "SGI_READ_DANGID" },
1047#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001048#ifdef SGI_CONST
Wichert Akkerman8829a551999-06-11 13:18:40 +00001049 { SGI_CONST, "SGI_CONST" },
1050#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001051#ifdef SGI_XFS_FSOPERATIONS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001052 { SGI_XFS_FSOPERATIONS, "SGI_XFS_FSOPERATIONS" },
1053#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001054#ifdef SGI_SETASH
Wichert Akkerman8829a551999-06-11 13:18:40 +00001055 { SGI_SETASH, "SGI_SETASH" },
1056#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001057#ifdef SGI_GETASH
Wichert Akkerman8829a551999-06-11 13:18:40 +00001058 { SGI_GETASH, "SGI_GETASH" },
1059#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001060#ifdef SGI_SETPRID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001061 { SGI_SETPRID, "SGI_SETPRID" },
1062#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001063#ifdef SGI_GETPRID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001064 { SGI_GETPRID, "SGI_GETPRID" },
1065#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001066#ifdef SGI_SETSPINFO
Wichert Akkerman8829a551999-06-11 13:18:40 +00001067 { SGI_SETSPINFO, "SGI_SETSPINFO" },
1068#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001069#ifdef SGI_GETSPINFO
Wichert Akkerman8829a551999-06-11 13:18:40 +00001070 { SGI_GETSPINFO, "SGI_GETSPINFO" },
1071#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001072#ifdef SGI_SHAREII
Wichert Akkerman8829a551999-06-11 13:18:40 +00001073 { SGI_SHAREII, "SGI_SHAREII" },
1074#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001075#ifdef SGI_NEWARRAYSESS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001076 { SGI_NEWARRAYSESS, "SGI_NEWARRAYSESS" },
1077#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001078#ifdef SGI_GETDFLTPRID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001079 { SGI_GETDFLTPRID, "SGI_GETDFLTPRID" },
1080#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001081#ifdef SGI_SET_DISMISSED_EXC_CNT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001082 { SGI_SET_DISMISSED_EXC_CNT,"SGI_SET_DISMISSED_EXC_CNT" },
1083#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001084#ifdef SGI_GET_DISMISSED_EXC_CNT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001085 { SGI_GET_DISMISSED_EXC_CNT,"SGI_GET_DISMISSED_EXC_CNT" },
1086#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001087#ifdef SGI_CYCLECNTR_SIZE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001088 { SGI_CYCLECNTR_SIZE, "SGI_CYCLECNTR_SIZE" },
1089#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001090#ifdef SGI_QUERY_FASTTIMER
Wichert Akkerman8829a551999-06-11 13:18:40 +00001091 { SGI_QUERY_FASTTIMER, "SGI_QUERY_FASTTIMER" },
1092#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001093#ifdef SGI_PIDSINASH
Wichert Akkerman8829a551999-06-11 13:18:40 +00001094 { SGI_PIDSINASH, "SGI_PIDSINASH" },
1095#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001096#ifdef SGI_ULI
Wichert Akkerman8829a551999-06-11 13:18:40 +00001097 { SGI_ULI, "SGI_ULI" },
1098#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001099#ifdef SGI_LPG_SHMGET
Wichert Akkerman8829a551999-06-11 13:18:40 +00001100 { SGI_LPG_SHMGET, "SGI_LPG_SHMGET" },
1101#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001102#ifdef SGI_LPG_MAP
Wichert Akkerman8829a551999-06-11 13:18:40 +00001103 { SGI_LPG_MAP, "SGI_LPG_MAP" },
1104#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001105#ifdef SGI_CACHEFS_SYS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001106 { SGI_CACHEFS_SYS, "SGI_CACHEFS_SYS" },
1107#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001108#ifdef SGI_NFSNOTIFY
Wichert Akkerman8829a551999-06-11 13:18:40 +00001109 { SGI_NFSNOTIFY, "SGI_NFSNOTIFY" },
1110#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001111#ifdef SGI_LOCKDSYS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001112 { SGI_LOCKDSYS, "SGI_LOCKDSYS" },
1113#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001114#ifdef SGI_EVENTCTR
Wichert Akkerman8829a551999-06-11 13:18:40 +00001115 { SGI_EVENTCTR, "SGI_EVENTCTR" },
1116#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001117#ifdef SGI_GETPRUSAGE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001118 { SGI_GETPRUSAGE, "SGI_GETPRUSAGE" },
1119#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001120#ifdef SGI_PROCMASK_LOCATION
Wichert Akkerman8829a551999-06-11 13:18:40 +00001121 { SGI_PROCMASK_LOCATION,"SGI_PROCMASK_LOCATION" },
1122#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001123#ifdef SGI_UNUSED
Wichert Akkerman8829a551999-06-11 13:18:40 +00001124 { SGI_UNUSED, "SGI_UNUSED" },
1125#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001126#ifdef SGI_CKPT_SYS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001127 { SGI_CKPT_SYS, "SGI_CKPT_SYS" },
1128#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001129#ifdef SGI_CKPT_SYS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001130 { SGI_CKPT_SYS, "SGI_CKPT_SYS" },
1131#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001132#ifdef SGI_GETGRPPID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001133 { SGI_GETGRPPID, "SGI_GETGRPPID" },
1134#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001135#ifdef SGI_GETSESPID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001136 { SGI_GETSESPID, "SGI_GETSESPID" },
1137#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001138#ifdef SGI_ENUMASHS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001139 { SGI_ENUMASHS, "SGI_ENUMASHS" },
1140#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001141#ifdef SGI_SETASMACHID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001142 { SGI_SETASMACHID, "SGI_SETASMACHID" },
1143#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001144#ifdef SGI_GETASMACHID
Wichert Akkerman8829a551999-06-11 13:18:40 +00001145 { SGI_GETASMACHID, "SGI_GETASMACHID" },
1146#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001147#ifdef SGI_GETARSESS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001148 { SGI_GETARSESS, "SGI_GETARSESS" },
1149#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001150#ifdef SGI_JOINARRAYSESS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001151 { SGI_JOINARRAYSESS, "SGI_JOINARRAYSESS" },
1152#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001153#ifdef SGI_SPROC_KILL
Wichert Akkerman8829a551999-06-11 13:18:40 +00001154 { SGI_SPROC_KILL, "SGI_SPROC_KILL" },
1155#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001156#ifdef SGI_DBA_CONFIG
Wichert Akkerman8829a551999-06-11 13:18:40 +00001157 { SGI_DBA_CONFIG, "SGI_DBA_CONFIG" },
1158#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001159#ifdef SGI_RELEASE_NAME
Wichert Akkerman8829a551999-06-11 13:18:40 +00001160 { SGI_RELEASE_NAME, "SGI_RELEASE_NAME" },
1161#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001162#ifdef SGI_SYNCH_CACHE_HANDLER
Wichert Akkerman8829a551999-06-11 13:18:40 +00001163 { SGI_SYNCH_CACHE_HANDLER,"SGI_SYNCH_CACHE_HANDLER"},
1164#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001165#ifdef SGI_SWASH_INIT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001166 { SGI_SWASH_INIT, "SGI_SWASH_INIT" },
1167#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001168#ifdef SGI_NUMA_MIGR_PAGE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001169 { SGI_NUMA_MIGR_PAGE, "SGI_NUMA_MIGR_PAGE" },
1170#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001171#ifdef SGI_NUMA_MIGR_PAGE_ALT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001172 { SGI_NUMA_MIGR_PAGE_ALT,"SGI_NUMA_MIGR_PAGE_ALT"},
1173#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001174#ifdef SGI_KAIO_USERINIT
Wichert Akkerman8829a551999-06-11 13:18:40 +00001175 { SGI_KAIO_USERINIT, "SGI_KAIO_USERINIT" },
1176#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001177#ifdef SGI_KAIO_READ
Wichert Akkerman8829a551999-06-11 13:18:40 +00001178 { SGI_KAIO_READ, "SGI_KAIO_READ" },
1179#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001180#ifdef SGI_KAIO_WRITE
Wichert Akkerman8829a551999-06-11 13:18:40 +00001181 { SGI_KAIO_WRITE, "SGI_KAIO_WRITE" },
1182#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001183#ifdef SGI_KAIO_SUSPEND
Wichert Akkerman8829a551999-06-11 13:18:40 +00001184 { SGI_KAIO_SUSPEND, "SGI_KAIO_SUSPEND" },
1185#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001186#ifdef SGI_KAIO_STATS
Wichert Akkerman8829a551999-06-11 13:18:40 +00001187 { SGI_KAIO_STATS, "SGI_KAIO_STATS" },
1188#endif
Roland McGrathced50da2004-08-31 06:48:46 +00001189#ifdef SGI_INITIAL_PT_SPROC
Wichert Akkerman8829a551999-06-11 13:18:40 +00001190 { SGI_INITIAL_PT_SPROC, "SGI_INITIAL_PT_SPROC" },
1191#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001192 { 0, NULL },
1193};
1194
1195int
1196sys_syssgi(tcp)
1197struct tcb *tcp;
1198{
1199 int i;
1200
1201 if (entering(tcp)) {
1202 printxval(syssgi_options, tcp->u_arg[0], "SGI_???");
1203 switch (tcp->u_arg[0]) {
1204 default:
1205 for (i = 1; i < tcp->u_nargs; i++)
1206 tprintf(", %#lx", tcp->u_arg[i]);
1207 break;
1208 }
1209 }
1210 return 0;
1211}
1212
1213#include <sys/types.h>
1214#include <rpc/rpc.h>
1215struct cred;
1216struct uio;
1217#include <sys/fsid.h>
1218#include <sys/vnode.h>
1219#include <sys/fs/nfs.h>
1220#include <sys/fs/nfs_clnt.h>
1221
Roland McGrathd9f816f2004-09-04 03:39:20 +00001222static const struct xlat mount_flags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001223 { MS_RDONLY, "MS_RDONLY" },
1224 { MS_FSS, "MS_FSS" },
1225 { MS_DATA, "MS_DATA" },
1226 { MS_NOSUID, "MS_NOSUID" },
1227 { MS_REMOUNT, "MS_REMOUNT" },
1228 { MS_NOTRUNC, "MS_NOTRUNC" },
1229 { MS_GRPID, "MS_GRPID" },
1230 { MS_NODEV, "MS_NODEV" },
1231 { MS_BEFORE, "MS_BEFORE" },
1232 { MS_AFTER, "MS_AFTER" },
1233 { 0, NULL },
1234};
1235
Roland McGrathd9f816f2004-09-04 03:39:20 +00001236static const struct xlat nfs_flags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001237 { NFSMNT_SOFT, "NFSMNT_SOFT" },
1238 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
1239 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
1240 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
1241 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
1242 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001243#ifdef NFSMNT_NOINT /* IRIX 6 */
1244 { NFSMNT_NOINT, "NFSMNT_NOINT" },
1245#endif
1246#ifdef NFSMNT_INT /* IRIX 5 */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001247 { NFSMNT_INT, "NFSMNT_INT" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001248#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001249 { NFSMNT_NOAC, "NFSMNT_NOAC" },
1250 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
1251 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
1252 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
1253 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
1254 { NFSMNT_PRIVATE, "NFSMNT_PRIVATE" },
1255 { NFSMNT_SYMTTL, "NFSMNT_SYMTTL" },
1256 { NFSMNT_LOOPBACK, "NFSMNT_LOOPBACK" },
1257 { NFSMNT_BASETYPE, "NFSMNT_BASETYPE" },
1258 { NFSMNT_NAMEMAX, "NFSMNT_NAMEMAX" },
Wichert Akkerman8829a551999-06-11 13:18:40 +00001259#ifdef NFSMNT_SHORTUID /* IRIX 6 */
1260 { NFSMNT_SHORTUID, "NFSMNT_SHORTUID" },
1261#endif
1262#ifdef NFSMNT_ASYNCNLM /* IRIX 6 */
1263 { NFSMNT_ASYNCNLM, "NFSMNT_ASYNCNLM" },
1264#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001265 { 0, NULL },
1266};
1267
1268int
1269sys_mount(tcp)
1270struct tcb *tcp;
1271{
1272 if (entering(tcp)) {
1273 printpath(tcp, tcp->u_arg[0]);
1274 tprintf(", ");
1275 printpath(tcp, tcp->u_arg[1]);
1276 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001277 printflags(mount_flags, tcp->u_arg[2], "MS_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001278 if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
1279 tprintf(", ");
1280 tprintf("%ld", tcp->u_arg[3]);
1281 }
1282 if (tcp->u_arg[2] & MS_DATA) {
1283 int nfs_type = sysfs(GETFSIND, FSID_NFS);
1284
1285 tprintf(", ");
1286 if (tcp->u_arg[3] == nfs_type) {
1287 struct nfs_args args;
1288 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1289 tprintf("%#lx", tcp->u_arg[4]);
1290 else {
1291 tprintf("addr=");
1292 printsock(tcp, (int) args.addr);
1293 tprintf(", flags=");
Roland McGrathb2dee132005-06-01 19:02:36 +00001294 printflags(nfs_flags, args.flags, "NFSMNT_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001295 tprintf(", hostname=");
1296 printstr(tcp, (int) args.hostname, -1);
1297 tprintf(", ...}");
1298 }
1299 }
1300 else
1301 tprintf("%#lx", tcp->u_arg[4]);
1302 tprintf(", %ld", tcp->u_arg[5]);
1303 }
1304 }
1305 return 0;
1306}
1307
1308#else /* !MIPS */
1309
Wichert Akkerman3377df71999-11-26 13:14:41 +00001310#if UNIXWARE
1311
1312#include <sys/types.h>
1313#include <sys/fstyp.h>
1314#include <sys/mount.h>
1315#include <sys/xti.h>
1316
1317#define NFSCLIENT 1
1318#include <nfs/mount.h>
1319
1320#include <sys/fs/vx_ioctl.h>
1321
Roland McGrathd9f816f2004-09-04 03:39:20 +00001322static const struct xlat mount_flags[] = {
Wichert Akkerman3377df71999-11-26 13:14:41 +00001323 { MS_RDONLY, "MS_RDONLY" },
1324 { MS_FSS, "MS_FSS" },
1325 { MS_DATA, "MS_DATA" },
1326 { MS_HADBAD, "MS_HADBAD" },
1327 { MS_NOSUID, "MS_NOSUID" },
1328 { MS_REMOUNT, "MS_REMOUNT" },
1329 { MS_NOTRUNC, "MS_NOTRUNC" },
1330 { MS_SOFTMNT, "MS_SOFTMNT" },
1331 { MS_SYSSPACE, "MS_SYSSPACE" },
1332 { 0, NULL },
1333};
1334
1335#ifdef VX_MS_MASK
Roland McGrathd9f816f2004-09-04 03:39:20 +00001336static const struct xlat vxfs_flags[] = {
Wichert Akkerman3377df71999-11-26 13:14:41 +00001337 { VX_MS_NOLOG, "VX_MS_NOLOG" },
1338 { VX_MS_BLKCLEAR, "VX_MS_BLKCLEAR" },
1339 { VX_MS_SNAPSHOT, "VX_MS_SNAPSHOT" },
1340 { VX_MS_NODATAINLOG, "VX_MS_NODATAINLOG" },
1341 { VX_MS_DELAYLOG, "VX_MS_DELAYLOG" },
1342 { VX_MS_TMPLOG, "VX_MS_TMPLOG" },
1343 { VX_MS_FILESET, "VX_MS_FILESET" },
1344
1345 { VX_MS_CACHE_DIRECT, "VX_MS_CACHE_DIRECT" },
1346 { VX_MS_CACHE_DSYNC, "VX_MS_CACHE_DSYNC" },
1347 { VX_MS_CACHE_CLOSESYNC,"VX_MS_CACHE_CLOSESYNC" },
1348 { VX_MS_CACHE_TMPCACHE, "VX_MS_CACHE_TMPCACHE" },
1349
1350 { VX_MS_OSYNC_DIRECT, "VX_MS_OSYNC_DIRECT" },
1351 { VX_MS_OSYNC_DSYNC, "VX_MS_OSYNC_DSYNC" },
1352 { VX_MS_OSYNC_CLOSESYNC,"VX_MS_OSYNC_CLOSESYNC" },
1353 { VX_MS_OSYNC_DELAY, "VX_MS_OSYNC_DELAY" },
1354 { 0, NULL, },
1355};
1356#endif
1357
Roland McGrathd9f816f2004-09-04 03:39:20 +00001358static const struct xlat nfs_flags[] = {
Wichert Akkerman3377df71999-11-26 13:14:41 +00001359 { NFSMNT_SOFT, "NFSMNT_SOFT" },
1360 { NFSMNT_WSIZE, "NFSMNT_WSIZE" },
1361 { NFSMNT_RSIZE, "NFSMNT_RSIZE" },
1362 { NFSMNT_TIMEO, "NFSMNT_TIMEO" },
1363 { NFSMNT_RETRANS, "NFSMNT_RETRANS" },
1364 { NFSMNT_HOSTNAME, "NFSMNT_HOSTNAME" },
1365 { NFSMNT_INT, "NFSMNT_INT" },
1366 { NFSMNT_NOAC, "NFSMNT_NOAC" },
1367 { NFSMNT_ACREGMIN, "NFSMNT_ACREGMIN" },
1368 { NFSMNT_ACREGMAX, "NFSMNT_ACREGMAX" },
1369 { NFSMNT_ACDIRMIN, "NFSMNT_ACDIRMIN" },
1370 { NFSMNT_ACDIRMAX, "NFSMNT_ACDIRMAX" },
1371 { NFSMNT_SECURE, "NFSMNT_SECURE" },
1372 { NFSMNT_NOCTO, "NFSMNT_NOCTO" },
1373 { NFSMNT_GRPID, "NFSMNT_GRPID" },
1374 { NFSMNT_RPCTIMESYNC, "NFSMNT_RPCTIMESYNC" },
1375 { NFSMNT_LWPSMAX, "NFSMNT_LWPSMAX" },
1376 { 0, NULL },
1377};
1378
1379int
1380sys_mount(tcp)
1381struct tcb *tcp;
1382{
1383 if (entering(tcp)) {
1384 char fstyp [FSTYPSZ];
1385 printpath(tcp, tcp->u_arg[0]);
1386 tprintf(", ");
1387 printpath(tcp, tcp->u_arg[1]);
1388 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001389 printflags(mount_flags, tcp->u_arg[2], "MS_???");
Wichert Akkerman3377df71999-11-26 13:14:41 +00001390 /* The doc sez that the file system type is given as a
1391 fsindex, and we should use sysfs to work out the name.
1392 This appears to be untrue for UW. Maybe it's untrue
1393 for all SVR4's? */
1394 if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
1395 if (umovestr(tcp, tcp->u_arg[3], FSTYPSZ, fstyp) < 0) {
1396 *fstyp = 0;
1397 tprintf(", %ld", tcp->u_arg[3]);
1398 }
1399 else
1400 tprintf(", \"%s\"", fstyp);
1401 }
1402 if (tcp->u_arg[2] & MS_DATA) {
1403 tprintf(", ");
1404#ifdef VX_MS_MASK
1405 /* On UW7 they don't give us the defines and structs
1406 we need to see what is going on. Bummer. */
1407 if (strcmp (fstyp, "vxfs") == 0) {
1408 struct vx_mountargs5 args;
1409 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1410 tprintf("%#lx", tcp->u_arg[4]);
1411 else {
1412 tprintf("{ flags=");
Roland McGrathb2dee132005-06-01 19:02:36 +00001413 printflags(vxfs_flags, args.mflags, "VX_MS_???");
Wichert Akkerman3377df71999-11-26 13:14:41 +00001414 if (args.mflags & VX_MS_SNAPSHOT) {
1415 tprintf (", snapof=");
1416 printstr (tcp,
Roland McGrathced50da2004-08-31 06:48:46 +00001417 (long) args.primaryspec,
Wichert Akkerman3377df71999-11-26 13:14:41 +00001418 -1);
1419 if (args.snapsize > 0)
1420 tprintf (", snapsize=%ld", args.snapsize);
1421 }
1422 tprintf(" }");
1423 }
1424 }
1425 else
1426#endif
1427 if (strcmp (fstyp, "specfs") == 0) {
1428 tprintf ("dev=");
1429 printstr (tcp, tcp->u_arg[4], -1);
1430 }
1431 else
1432 if (strcmp (fstyp, "nfs") == 0) {
1433 struct nfs_args args;
1434 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1435 tprintf("%#lx", tcp->u_arg[4]);
1436 else {
1437 struct netbuf addr;
1438 tprintf("{ addr=");
1439 if (umove (tcp, (int) args.addr, &addr) < 0) {
1440 tprintf ("%#lx", (long) args.addr);
1441 }
1442 else {
1443 printsock(tcp, (int) addr.buf, addr.len);
1444 }
1445 tprintf(", flags=");
Roland McGrathb2dee132005-06-01 19:02:36 +00001446 printflags(nfs_flags, args.flags, "NFSMNT_???");
Wichert Akkerman3377df71999-11-26 13:14:41 +00001447 tprintf(", hostname=");
1448 printstr(tcp, (int) args.hostname, -1);
1449 tprintf(", ...}");
1450 }
1451 }
1452 else
1453 tprintf("%#lx", tcp->u_arg[4]);
1454 tprintf(", %ld", tcp->u_arg[5]);
1455 }
1456 }
1457 return 0;
1458}
1459
1460#else /* !UNIXWARE */
1461
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001462int
1463sys_mount(tcp)
1464struct tcb *tcp;
1465{
1466 if (entering(tcp)) {
1467 printpath(tcp, tcp->u_arg[0]);
1468 tprintf(", ");
1469 printpath(tcp, tcp->u_arg[1]);
1470 tprintf(", ...");
1471 }
1472 return 0;
1473}
Wichert Akkermanea78f0f1999-11-29 15:34:02 +00001474#endif /* !UNIXWARE */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001475
1476#endif /* !MIPS */
1477
1478#endif /* SVR4 */
1479
Nate Sammons8d5860c1999-07-03 18:53:05 +00001480#ifdef SYS_capget
Wichert Akkermanc7926982000-04-10 22:22:31 +00001481
Roland McGrathd9f816f2004-09-04 03:39:20 +00001482static const struct xlat capabilities[] = {
Wichert Akkermanc7926982000-04-10 22:22:31 +00001483 { 1<<CAP_CHOWN, "CAP_CHOWN" },
1484 { 1<<CAP_DAC_OVERRIDE, "CAP_DAC_OVERRIDE"},
1485 { 1<<CAP_DAC_READ_SEARCH,"CAP_DAC_READ_SEARCH"},
1486 { 1<<CAP_FOWNER, "CAP_FOWNER" },
1487 { 1<<CAP_FSETID, "CAP_FSETID" },
1488 { 1<<CAP_KILL, "CAP_KILL" },
1489 { 1<<CAP_SETGID, "CAP_SETGID" },
1490 { 1<<CAP_SETUID, "CAP_SETUID" },
1491 { 1<<CAP_SETPCAP, "CAP_SETPCAP" },
1492 { 1<<CAP_LINUX_IMMUTABLE,"CAP_LINUX_IMMUTABLE"},
1493 { 1<<CAP_NET_BIND_SERVICE,"CAP_NET_BIND_SERVICE"},
1494 { 1<<CAP_NET_BROADCAST, "CAP_NET_BROADCAST"},
1495 { 1<<CAP_NET_ADMIN, "CAP_NET_ADMIN" },
1496 { 1<<CAP_NET_RAW, "CAP_NET_RAW" },
1497 { 1<<CAP_IPC_LOCK, "CAP_IPC_LOCK" },
1498 { 1<<CAP_IPC_OWNER, "CAP_IPC_OWNER" },
1499 { 1<<CAP_SYS_MODULE, "CAP_SYS_MODULE"},
1500 { 1<<CAP_SYS_RAWIO, "CAP_SYS_RAWIO" },
1501 { 1<<CAP_SYS_CHROOT, "CAP_SYS_CHROOT"},
1502 { 1<<CAP_SYS_PTRACE, "CAP_SYS_PTRACE"},
1503 { 1<<CAP_SYS_PACCT, "CAP_SYS_PACCT" },
1504 { 1<<CAP_SYS_ADMIN, "CAP_SYS_ADMIN" },
1505 { 1<<CAP_SYS_BOOT, "CAP_SYS_BOOT" },
1506 { 1<<CAP_SYS_NICE, "CAP_SYS_NICE" },
1507 { 1<<CAP_SYS_RESOURCE, "CAP_SYS_RESOURCE"},
1508 { 1<<CAP_SYS_TIME, "CAP_SYS_TIME" },
1509 { 1<<CAP_SYS_TTY_CONFIG,"CAP_SYS_TTY_CONFIG"},
Dmitry V. Levin949f4512008-11-11 00:21:09 +00001510#ifdef CAP_MKNOD
1511 { 1<<CAP_MKNOD, "CAP_MKNOD" },
1512#endif
1513#ifdef CAP_LEASE
1514 { 1<<CAP_LEASE, "CAP_LEASE" },
1515#endif
1516#ifdef CAP_AUDIT_WRITE
1517 { 1<<CAP_AUDIT_WRITE, "CAP_AUDIT_WRITE"},
1518#endif
1519#ifdef CAP_AUDIT_CONTROL
1520 { 1<<CAP_AUDIT_CONTROL, "CAP_AUDIT_CONTROL"},
1521#endif
1522#ifdef CAP_SETFCAP
1523 { 1<<CAP_SETFCAP, "CAP_SETFCAP" },
1524#endif
Wichert Akkermanc7926982000-04-10 22:22:31 +00001525 { 0, NULL },
1526};
1527
1528
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001529int
1530sys_capget(tcp)
1531struct tcb *tcp;
1532{
Wichert Akkermanc7926982000-04-10 22:22:31 +00001533 static cap_user_header_t arg0 = NULL;
1534 static cap_user_data_t arg1 = NULL;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001535
1536 if(!entering(tcp)) {
Wichert Akkermanc7926982000-04-10 22:22:31 +00001537 if (!arg0) {
1538 if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001539 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001540 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001541 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001542 }
1543 }
1544 if (!arg1) {
1545 if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001546 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001547 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001548 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001549 }
1550 }
1551
1552 if (!tcp->u_arg[0])
1553 tprintf("NULL");
1554 else if (!verbose(tcp))
1555 tprintf("%#lx", tcp->u_arg[0]);
1556 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
1557 tprintf("???");
1558 else {
1559 tprintf("%#x, %d", arg0->version, arg0->pid);
1560 }
1561 tprintf(", ");
1562 if (!tcp->u_arg[1])
1563 tprintf("NULL");
1564 else if (!verbose(tcp))
1565 tprintf("%#lx", tcp->u_arg[1]);
1566 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
1567 tprintf("???");
1568 else {
1569 tprintf("{");
Roland McGrathb2dee132005-06-01 19:02:36 +00001570 printflags(capabilities, arg1->effective, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001571 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001572 printflags(capabilities, arg1->permitted, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001573 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001574 printflags(capabilities, arg1->inheritable, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001575 tprintf("}");
Roland McGrathced50da2004-08-31 06:48:46 +00001576 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001577 }
1578 return 0;
1579}
1580
1581int
1582sys_capset(tcp)
1583struct tcb *tcp;
1584{
Wichert Akkermanc7926982000-04-10 22:22:31 +00001585 static cap_user_header_t arg0 = NULL;
1586 static cap_user_data_t arg1 = NULL;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001587
Wichert Akkermanc7926982000-04-10 22:22:31 +00001588 if(entering(tcp)) {
1589 if (!arg0) {
1590 if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001591 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001592 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001593 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001594 }
1595 }
1596 if (!arg1) {
1597 if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001598 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001599 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001600 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001601 }
1602 }
1603
1604 if (!tcp->u_arg[0])
1605 tprintf("NULL");
1606 else if (!verbose(tcp))
1607 tprintf("%#lx", tcp->u_arg[0]);
1608 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
1609 tprintf("???");
1610 else {
1611 tprintf("%#x, %d", arg0->version, arg0->pid);
1612 }
1613 tprintf(", ");
1614 if (!tcp->u_arg[1])
1615 tprintf("NULL");
1616 else if (!verbose(tcp))
1617 tprintf("%#lx", tcp->u_arg[1]);
1618 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
1619 tprintf("???");
1620 else {
1621 tprintf("{");
Roland McGrathb2dee132005-06-01 19:02:36 +00001622 printflags(capabilities, arg1->effective, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001623 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001624 printflags(capabilities, arg1->permitted, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001625 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001626 printflags(capabilities, arg1->inheritable, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001627 tprintf("}");
Roland McGrathced50da2004-08-31 06:48:46 +00001628 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001629 }
1630 return 0;
1631}
1632
1633#else
1634
1635int sys_capget(tcp)
1636struct tcb *tcp;
1637{
1638 return printargs(tcp);
1639}
1640
1641int sys_capset(tcp)
1642struct tcb *tcp;
1643{
1644 return printargs(tcp);
1645}
1646
1647#endif
1648
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001649#ifdef LINUX
Dmitry V. Levin35a55782006-12-04 13:48:10 +00001650/* Linux 2.6.18+ headers removed CTL_PROC enum. */
1651# define CTL_PROC 4
Roland McGrath5eb1aa52007-01-11 22:48:39 +00001652# define CTL_CPU 10 /* older headers lack */
Roland McGrathd9f816f2004-09-04 03:39:20 +00001653static const struct xlat sysctl_root[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001654 { CTL_KERN, "CTL_KERN" },
1655 { CTL_VM, "CTL_VM" },
1656 { CTL_NET, "CTL_NET" },
1657 { CTL_PROC, "CTL_PROC" },
1658 { CTL_FS, "CTL_FS" },
1659 { CTL_DEBUG, "CTL_DEBUG" },
1660 { CTL_DEV, "CTL_DEV" },
Dmitry V. Levin35a55782006-12-04 13:48:10 +00001661 { CTL_BUS, "CTL_BUS" },
1662 { CTL_ABI, "CTL_ABI" },
1663 { CTL_CPU, "CTL_CPU" },
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001664 { 0, NULL }
1665};
1666
Roland McGrathd9f816f2004-09-04 03:39:20 +00001667static const struct xlat sysctl_kern[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001668 { KERN_OSTYPE, "KERN_OSTYPE" },
1669 { KERN_OSRELEASE, "KERN_OSRELEASE" },
1670 { KERN_OSREV, "KERN_OSREV" },
1671 { KERN_VERSION, "KERN_VERSION" },
1672 { KERN_SECUREMASK, "KERN_SECUREMASK" },
1673 { KERN_PROF, "KERN_PROF" },
1674 { KERN_NODENAME, "KERN_NODENAME" },
1675 { KERN_DOMAINNAME, "KERN_DOMAINNAME" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001676#ifdef KERN_SECURELVL
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001677 { KERN_SECURELVL, "KERN_SECURELVL" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001678#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001679 { KERN_PANIC, "KERN_PANIC" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001680#ifdef KERN_REALROOTDEV
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001681 { KERN_REALROOTDEV, "KERN_REALROOTDEV" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001682#endif
1683#ifdef KERN_JAVA_INTERPRETER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001684 { KERN_JAVA_INTERPRETER, "KERN_JAVA_INTERPRETER" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001685#endif
1686#ifdef KERN_JAVA_APPLETVIEWER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001687 { KERN_JAVA_APPLETVIEWER, "KERN_JAVA_APPLETVIEWER" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001688#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001689 { KERN_SPARC_REBOOT, "KERN_SPARC_REBOOT" },
1690 { KERN_CTLALTDEL, "KERN_CTLALTDEL" },
1691 { KERN_PRINTK, "KERN_PRINTK" },
1692 { KERN_NAMETRANS, "KERN_NAMETRANS" },
1693 { KERN_PPC_HTABRECLAIM, "KERN_PPC_HTABRECLAIM" },
1694 { KERN_PPC_ZEROPAGED, "KERN_PPC_ZEROPAGED" },
1695 { KERN_PPC_POWERSAVE_NAP, "KERN_PPC_POWERSAVE_NAP" },
1696 { KERN_MODPROBE, "KERN_MODPROBE" },
1697 { KERN_SG_BIG_BUFF, "KERN_SG_BIG_BUFF" },
1698 { KERN_ACCT, "KERN_ACCT" },
1699 { KERN_PPC_L2CR, "KERN_PPC_L2CR" },
1700 { KERN_RTSIGNR, "KERN_RTSIGNR" },
1701 { KERN_RTSIGMAX, "KERN_RTSIGMAX" },
1702 { KERN_SHMMAX, "KERN_SHMMAX" },
1703 { KERN_MSGMAX, "KERN_MSGMAX" },
1704 { KERN_MSGMNB, "KERN_MSGMNB" },
1705 { KERN_MSGPOOL, "KERN_MSGPOOL" },
1706 { 0, NULL }
1707};
1708
Roland McGrathd9f816f2004-09-04 03:39:20 +00001709static const struct xlat sysctl_vm[] = {
Roland McGratha796fd02004-03-01 22:10:54 +00001710#ifdef VM_SWAPCTL
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001711 { VM_SWAPCTL, "VM_SWAPCTL" },
Roland McGratha796fd02004-03-01 22:10:54 +00001712#endif
1713#ifdef VM_UNUSED1
1714 { VM_UNUSED1, "VM_UNUSED1" },
1715#endif
1716#ifdef VM_SWAPOUT
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001717 { VM_SWAPOUT, "VM_SWAPOUT" },
Roland McGratha796fd02004-03-01 22:10:54 +00001718#endif
1719#ifdef VM_UNUSED2
1720 { VM_UNUSED2, "VM_UNUSED2" },
1721#endif
1722#ifdef VM_FREEPG
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001723 { VM_FREEPG, "VM_FREEPG" },
Roland McGratha796fd02004-03-01 22:10:54 +00001724#endif
1725#ifdef VM_UNUSED3
1726 { VM_UNUSED3, "VM_UNUSED3" },
1727#endif
1728#ifdef VM_BDFLUSH
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001729 { VM_BDFLUSH, "VM_BDFLUSH" },
Roland McGratha796fd02004-03-01 22:10:54 +00001730#endif
1731#ifdef VM_UNUSED4
1732 { VM_UNUSED4, "VM_UNUSED4" },
1733#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001734 { VM_OVERCOMMIT_MEMORY, "VM_OVERCOMMIT_MEMORY" },
Roland McGratha796fd02004-03-01 22:10:54 +00001735#ifdef VM_BUFFERMEM
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001736 { VM_BUFFERMEM, "VM_BUFFERMEM" },
Roland McGratha796fd02004-03-01 22:10:54 +00001737#endif
1738#ifdef VM_UNUSED5
1739 { VM_UNUSED5, "VM_UNUSED5" },
1740#endif
1741#ifdef VM_PAGECACHE
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001742 { VM_PAGECACHE, "VM_PAGECACHE" },
Roland McGratha796fd02004-03-01 22:10:54 +00001743#endif
1744#ifdef VM_UNUSED7
1745 { VM_UNUSED7, "VM_UNUSED7" },
1746#endif
1747#ifdef VM_PAGERDAEMON
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001748 { VM_PAGERDAEMON, "VM_PAGERDAEMON" },
Roland McGratha796fd02004-03-01 22:10:54 +00001749#endif
1750#ifdef VM_UNUSED8
1751 { VM_UNUSED8, "VM_UNUSED8" },
1752#endif
1753#ifdef VM_PGT_CACHE
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001754 { VM_PGT_CACHE, "VM_PGT_CACHE" },
Roland McGratha796fd02004-03-01 22:10:54 +00001755#endif
1756#ifdef VM_UNUSED9
1757 { VM_UNUSED9, "VM_UNUSED9" },
1758#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001759 { VM_PAGE_CLUSTER, "VM_PAGE_CLUSTER" },
1760 { 0, NULL },
1761};
1762
Roland McGrathd9f816f2004-09-04 03:39:20 +00001763static const struct xlat sysctl_net[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001764 { NET_CORE, "NET_CORE" },
1765 { NET_ETHER, "NET_ETHER" },
1766 { NET_802, "NET_802" },
1767 { NET_UNIX, "NET_UNIX" },
1768 { NET_IPV4, "NET_IPV4" },
1769 { NET_IPX, "NET_IPX" },
1770 { NET_ATALK, "NET_ATALK" },
1771 { NET_NETROM, "NET_NETROM" },
1772 { NET_AX25, "NET_AX25" },
1773 { NET_BRIDGE, "NET_BRIDGE" },
1774 { NET_ROSE, "NET_ROSE" },
1775 { NET_IPV6, "NET_IPV6" },
1776 { NET_X25, "NET_X25" },
1777 { NET_TR, "NET_TR" },
1778 { NET_DECNET, "NET_DECNET" },
1779 { 0, NULL }
1780};
1781
Roland McGrathd9f816f2004-09-04 03:39:20 +00001782static const struct xlat sysctl_net_core[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001783 { NET_CORE_WMEM_MAX, "NET_CORE_WMEM_MAX" },
1784 { NET_CORE_RMEM_MAX, "NET_CORE_RMEM_MAX" },
1785 { NET_CORE_WMEM_DEFAULT, "NET_CORE_WMEM_DEFAULT" },
1786 { NET_CORE_RMEM_DEFAULT, "NET_CORE_RMEM_DEFAULT" },
1787 { NET_CORE_MAX_BACKLOG, "NET_CORE_MAX_BACKLOG" },
1788 { NET_CORE_FASTROUTE, "NET_CORE_FASTROUTE" },
1789 { NET_CORE_MSG_COST, "NET_CORE_MSG_COST" },
1790 { NET_CORE_MSG_BURST, "NET_CORE_MSG_BURST" },
1791 { NET_CORE_OPTMEM_MAX, "NET_CORE_OPTMEM_MAX" },
1792 { 0, NULL }
1793};
1794
Roland McGrathd9f816f2004-09-04 03:39:20 +00001795static const struct xlat sysctl_net_unix[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001796 { NET_UNIX_DESTROY_DELAY, "NET_UNIX_DESTROY_DELAY" },
1797 { NET_UNIX_DELETE_DELAY, "NET_UNIX_DELETE_DELAY" },
1798 { 0, NULL }
1799};
1800
Roland McGrathd9f816f2004-09-04 03:39:20 +00001801static const struct xlat sysctl_net_ipv4[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001802 { NET_IPV4_FORWARD, "NET_IPV4_FORWARD" },
1803 { NET_IPV4_DYNADDR, "NET_IPV4_DYNADDR" },
1804 { NET_IPV4_CONF, "NET_IPV4_CONF" },
1805 { NET_IPV4_NEIGH, "NET_IPV4_NEIGH" },
1806 { NET_IPV4_ROUTE, "NET_IPV4_ROUTE" },
1807 { NET_IPV4_FIB_HASH, "NET_IPV4_FIB_HASH" },
1808 { NET_IPV4_TCP_TIMESTAMPS, "NET_IPV4_TCP_TIMESTAMPS" },
1809 { NET_IPV4_TCP_WINDOW_SCALING, "NET_IPV4_TCP_WINDOW_SCALING" },
1810 { NET_IPV4_TCP_SACK, "NET_IPV4_TCP_SACK" },
1811 { NET_IPV4_TCP_RETRANS_COLLAPSE, "NET_IPV4_TCP_RETRANS_COLLAPSE" },
1812 { NET_IPV4_DEFAULT_TTL, "NET_IPV4_DEFAULT_TTL" },
1813 { NET_IPV4_AUTOCONFIG, "NET_IPV4_AUTOCONFIG" },
1814 { NET_IPV4_NO_PMTU_DISC, "NET_IPV4_NO_PMTU_DISC" },
1815 { NET_IPV4_TCP_SYN_RETRIES, "NET_IPV4_TCP_SYN_RETRIES" },
1816 { NET_IPV4_IPFRAG_HIGH_THRESH, "NET_IPV4_IPFRAG_HIGH_THRESH" },
1817 { NET_IPV4_IPFRAG_LOW_THRESH, "NET_IPV4_IPFRAG_LOW_THRESH" },
1818 { NET_IPV4_IPFRAG_TIME, "NET_IPV4_IPFRAG_TIME" },
1819 { NET_IPV4_TCP_MAX_KA_PROBES, "NET_IPV4_TCP_MAX_KA_PROBES" },
1820 { NET_IPV4_TCP_KEEPALIVE_TIME, "NET_IPV4_TCP_KEEPALIVE_TIME" },
1821 { NET_IPV4_TCP_KEEPALIVE_PROBES, "NET_IPV4_TCP_KEEPALIVE_PROBES" },
1822 { NET_IPV4_TCP_RETRIES1, "NET_IPV4_TCP_RETRIES1" },
1823 { NET_IPV4_TCP_RETRIES2, "NET_IPV4_TCP_RETRIES2" },
1824 { NET_IPV4_TCP_FIN_TIMEOUT, "NET_IPV4_TCP_FIN_TIMEOUT" },
1825 { NET_IPV4_IP_MASQ_DEBUG, "NET_IPV4_IP_MASQ_DEBUG" },
1826 { NET_TCP_SYNCOOKIES, "NET_TCP_SYNCOOKIES" },
1827 { NET_TCP_STDURG, "NET_TCP_STDURG" },
1828 { NET_TCP_RFC1337, "NET_TCP_RFC1337" },
1829 { NET_TCP_SYN_TAILDROP, "NET_TCP_SYN_TAILDROP" },
1830 { NET_TCP_MAX_SYN_BACKLOG, "NET_TCP_MAX_SYN_BACKLOG" },
1831 { NET_IPV4_LOCAL_PORT_RANGE, "NET_IPV4_LOCAL_PORT_RANGE" },
1832 { NET_IPV4_ICMP_ECHO_IGNORE_ALL, "NET_IPV4_ICMP_ECHO_IGNORE_ALL" },
1833 { NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS" },
1834 { NET_IPV4_ICMP_SOURCEQUENCH_RATE, "NET_IPV4_ICMP_SOURCEQUENCH_RATE" },
1835 { NET_IPV4_ICMP_DESTUNREACH_RATE, "NET_IPV4_ICMP_DESTUNREACH_RATE" },
1836 { NET_IPV4_ICMP_TIMEEXCEED_RATE, "NET_IPV4_ICMP_TIMEEXCEED_RATE" },
1837 { NET_IPV4_ICMP_PARAMPROB_RATE, "NET_IPV4_ICMP_PARAMPROB_RATE" },
1838 { NET_IPV4_ICMP_ECHOREPLY_RATE, "NET_IPV4_ICMP_ECHOREPLY_RATE" },
1839 { NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES" },
1840 { NET_IPV4_IGMP_MAX_MEMBERSHIPS, "NET_IPV4_IGMP_MAX_MEMBERSHIPS" },
1841 { 0, NULL }
1842};
1843
Roland McGrathd9f816f2004-09-04 03:39:20 +00001844static const struct xlat sysctl_net_ipv4_route[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001845 { NET_IPV4_ROUTE_FLUSH, "NET_IPV4_ROUTE_FLUSH" },
1846 { NET_IPV4_ROUTE_MIN_DELAY, "NET_IPV4_ROUTE_MIN_DELAY" },
1847 { NET_IPV4_ROUTE_MAX_DELAY, "NET_IPV4_ROUTE_MAX_DELAY" },
1848 { NET_IPV4_ROUTE_GC_THRESH, "NET_IPV4_ROUTE_GC_THRESH" },
1849 { NET_IPV4_ROUTE_MAX_SIZE, "NET_IPV4_ROUTE_MAX_SIZE" },
1850 { NET_IPV4_ROUTE_GC_MIN_INTERVAL, "NET_IPV4_ROUTE_GC_MIN_INTERVAL" },
1851 { NET_IPV4_ROUTE_GC_TIMEOUT, "NET_IPV4_ROUTE_GC_TIMEOUT" },
1852 { NET_IPV4_ROUTE_GC_INTERVAL, "NET_IPV4_ROUTE_GC_INTERVAL" },
1853 { NET_IPV4_ROUTE_REDIRECT_LOAD, "NET_IPV4_ROUTE_REDIRECT_LOAD" },
1854 { NET_IPV4_ROUTE_REDIRECT_NUMBER, "NET_IPV4_ROUTE_REDIRECT_NUMBER" },
1855 { NET_IPV4_ROUTE_REDIRECT_SILENCE, "NET_IPV4_ROUTE_REDIRECT_SILENCE" },
1856 { NET_IPV4_ROUTE_ERROR_COST, "NET_IPV4_ROUTE_ERROR_COST" },
1857 { NET_IPV4_ROUTE_ERROR_BURST, "NET_IPV4_ROUTE_ERROR_BURST" },
1858 { NET_IPV4_ROUTE_GC_ELASTICITY, "NET_IPV4_ROUTE_GC_ELASTICITY" },
1859 { 0, NULL }
1860};
1861
Roland McGrathd9f816f2004-09-04 03:39:20 +00001862static const struct xlat sysctl_net_ipv4_conf[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001863 { NET_IPV4_CONF_FORWARDING, "NET_IPV4_CONF_FORWARDING" },
1864 { NET_IPV4_CONF_MC_FORWARDING, "NET_IPV4_CONF_MC_FORWARDING" },
1865 { NET_IPV4_CONF_PROXY_ARP, "NET_IPV4_CONF_PROXY_ARP" },
1866 { NET_IPV4_CONF_ACCEPT_REDIRECTS, "NET_IPV4_CONF_ACCEPT_REDIRECTS" },
1867 { NET_IPV4_CONF_SECURE_REDIRECTS, "NET_IPV4_CONF_SECURE_REDIRECTS" },
1868 { NET_IPV4_CONF_SEND_REDIRECTS, "NET_IPV4_CONF_SEND_REDIRECTS" },
1869 { NET_IPV4_CONF_SHARED_MEDIA, "NET_IPV4_CONF_SHARED_MEDIA" },
1870 { NET_IPV4_CONF_RP_FILTER, "NET_IPV4_CONF_RP_FILTER" },
1871 { NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, "NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE" },
1872 { NET_IPV4_CONF_BOOTP_RELAY, "NET_IPV4_CONF_BOOTP_RELAY" },
1873 { NET_IPV4_CONF_LOG_MARTIANS, "NET_IPV4_CONF_LOG_MARTIANS" },
1874 { 0, NULL }
1875};
1876
Roland McGrathd9f816f2004-09-04 03:39:20 +00001877static const struct xlat sysctl_net_ipv6[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001878 { NET_IPV6_CONF, "NET_IPV6_CONF" },
1879 { NET_IPV6_NEIGH, "NET_IPV6_NEIGH" },
1880 { NET_IPV6_ROUTE, "NET_IPV6_ROUTE" },
1881 { 0, NULL }
1882};
1883
Roland McGrathd9f816f2004-09-04 03:39:20 +00001884static const struct xlat sysctl_net_ipv6_route[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001885 { NET_IPV6_ROUTE_FLUSH, "NET_IPV6_ROUTE_FLUSH" },
1886 { NET_IPV6_ROUTE_GC_THRESH, "NET_IPV6_ROUTE_GC_THRESH" },
1887 { NET_IPV6_ROUTE_MAX_SIZE, "NET_IPV6_ROUTE_MAX_SIZE" },
1888 { NET_IPV6_ROUTE_GC_MIN_INTERVAL, "NET_IPV6_ROUTE_GC_MIN_INTERVAL" },
1889 { NET_IPV6_ROUTE_GC_TIMEOUT, "NET_IPV6_ROUTE_GC_TIMEOUT" },
1890 { NET_IPV6_ROUTE_GC_INTERVAL, "NET_IPV6_ROUTE_GC_INTERVAL" },
1891 { NET_IPV6_ROUTE_GC_ELASTICITY, "NET_IPV6_ROUTE_GC_ELASTICITY" },
1892 { 0, NULL }
1893};
1894
1895int
1896sys_sysctl(tcp)
1897struct tcb *tcp;
1898{
1899 struct __sysctl_args info;
1900 int *name;
Roland McGrathaa524c82005-06-01 19:22:06 +00001901 unsigned long size;
1902
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001903 if (umove (tcp, tcp->u_arg[0], &info) < 0)
1904 return printargs(tcp);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001905
Roland McGrathaa524c82005-06-01 19:22:06 +00001906 size = sizeof (int) * (unsigned long) info.nlen;
1907 name = (size / sizeof (int) != info.nlen) ? NULL : malloc (size);
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001908 if (name == NULL ||
Roland McGrathaa524c82005-06-01 19:22:06 +00001909 umoven(tcp, (unsigned long) info.name, size, (char *) name) < 0) {
1910 free(name);
1911 if (entering(tcp))
1912 tprintf("{%p, %d, %p, %p, %p, %Zu}",
1913 info.name, info.nlen, info.oldval,
1914 info.oldlenp, info.newval, info.newlen);
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001915 return 0;
1916 }
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001917
1918 if (entering(tcp)) {
Roland McGrathaa524c82005-06-01 19:22:06 +00001919 int cnt = 0, max_cnt;
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001920
1921 tprintf("{{");
1922
1923 if (info.nlen == 0)
1924 goto out;
1925 printxval(sysctl_root, name[0], "CTL_???");
1926 ++cnt;
1927
1928 if (info.nlen == 1)
1929 goto out;
1930 switch (name[0]) {
1931 case CTL_KERN:
1932 tprintf(", ");
1933 printxval(sysctl_kern, name[1], "KERN_???");
1934 ++cnt;
1935 break;
1936 case CTL_VM:
1937 tprintf(", ");
1938 printxval(sysctl_vm, name[1], "VM_???");
1939 ++cnt;
1940 break;
1941 case CTL_NET:
1942 tprintf(", ");
1943 printxval(sysctl_net, name[1], "NET_???");
1944 ++cnt;
1945
1946 if (info.nlen == 2)
1947 goto out;
1948 switch (name[1]) {
1949 case NET_CORE:
1950 tprintf(", ");
1951 printxval(sysctl_net_core, name[2],
1952 "NET_CORE_???");
1953 break;
1954 case NET_UNIX:
1955 tprintf(", ");
1956 printxval(sysctl_net_unix, name[2],
1957 "NET_UNIX_???");
1958 break;
1959 case NET_IPV4:
1960 tprintf(", ");
1961 printxval(sysctl_net_ipv4, name[2],
1962 "NET_IPV4_???");
1963
1964 if (info.nlen == 3)
1965 goto out;
1966 switch (name[2]) {
1967 case NET_IPV4_ROUTE:
1968 tprintf(", ");
1969 printxval(sysctl_net_ipv4_route,
1970 name[3],
1971 "NET_IPV4_ROUTE_???");
1972 break;
1973 case NET_IPV4_CONF:
1974 tprintf(", ");
1975 printxval(sysctl_net_ipv4_conf,
1976 name[3],
1977 "NET_IPV4_CONF_???");
1978 break;
1979 default:
1980 goto out;
1981 }
1982 break;
1983 case NET_IPV6:
1984 tprintf(", ");
1985 printxval(sysctl_net_ipv6, name[2],
1986 "NET_IPV6_???");
1987
1988 if (info.nlen == 3)
1989 goto out;
1990 switch (name[2]) {
1991 case NET_IPV6_ROUTE:
1992 tprintf(", ");
1993 printxval(sysctl_net_ipv6_route,
1994 name[3],
1995 "NET_IPV6_ROUTE_???");
1996 break;
1997 default:
1998 goto out;
1999 }
2000 break;
2001 default:
2002 goto out;
2003 }
2004 break;
2005 default:
2006 goto out;
2007 }
2008 out:
Roland McGrath8e4a3e62006-01-12 11:03:46 +00002009 max_cnt = info.nlen;
2010 if (abbrev(tcp) && max_cnt > max_strlen)
2011 max_cnt = max_strlen;
Roland McGrathaa524c82005-06-01 19:22:06 +00002012 while (cnt < max_cnt)
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002013 tprintf(", %x", name[cnt++]);
Roland McGrathaa524c82005-06-01 19:22:06 +00002014 if (cnt < info.nlen)
2015 tprintf(", ...");
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002016 tprintf("}, %d, ", info.nlen);
2017 } else {
2018 size_t oldlen;
Roland McGrathaa524c82005-06-01 19:22:06 +00002019 if (umove(tcp, (size_t)info.oldlenp, &oldlen) >= 0
2020 && info.nlen >= 2
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002021 && ((name[0] == CTL_KERN
2022 && (name[1] == KERN_OSRELEASE
2023 || name[1] == KERN_OSTYPE
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00002024#ifdef KERN_JAVA_INTERPRETER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002025 || name[1] == KERN_JAVA_INTERPRETER
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00002026#endif
2027#ifdef KERN_JAVA_APPLETVIEWER
2028 || name[1] == KERN_JAVA_APPLETVIEWER
2029#endif
2030 )))) {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002031 printpath(tcp, (size_t)info.oldval);
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00002032 tprintf(", %Zu, ", oldlen);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002033 if (info.newval == 0)
2034 tprintf("NULL");
2035 else if (syserror(tcp))
2036 tprintf("%p", info.newval);
2037 else
2038 printpath(tcp, (size_t)info.newval);
2039 tprintf(", %Zd", info.newlen);
2040 } else {
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00002041 tprintf("%p, %Zd, %p, %Zd", info.oldval, oldlen,
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002042 info.newval, info.newlen);
2043 }
2044 tprintf("}");
2045 }
Roland McGrath2cbe44e2005-05-26 23:21:09 +00002046
2047 free(name);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002048 return 0;
2049}
2050#else
2051int sys_sysctl(tcp)
2052struct tcb *tcp;
2053{
2054 return printargs(tcp);
2055}
2056#endif
2057
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00002058#ifdef FREEBSD
2059#include <sys/sysctl.h>
2060
2061int sys___sysctl(tcp)
2062struct tcb *tcp;
2063{
2064 int qoid[CTL_MAXNAME+2];
2065 char ctl[1024];
2066 size_t len;
2067 int i, numeric;
Roland McGrathced50da2004-08-31 06:48:46 +00002068
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00002069 if (entering(tcp)) {
2070 if (tcp->u_arg[1] < 0 || tcp->u_arg[1] > CTL_MAXNAME ||
2071 (umoven(tcp, tcp->u_arg[0], tcp->u_arg[1] * sizeof(int),
2072 (char *) (qoid + 2)) < 0))
2073 tprintf("[...], ");
2074 else {
2075 /* Use sysctl to ask the name of the current MIB
2076 This uses the undocumented "Staff-functions" used
2077 by the sysctl program. See kern_sysctl.c for
2078 details. */
2079 qoid[0] = 0; /* sysctl */
2080 qoid[1] = 1; /* name */
2081 i = sizeof(ctl);
2082 tprintf("[");
2083 if (sysctl(qoid, tcp->u_arg[1] + 2, ctl, &i, 0, 0) >= 0) {
2084 numeric = !abbrev(tcp);
2085 tprintf("%s%s", ctl, numeric ? ", " : "");
2086 } else
2087 numeric = 1;
2088 if (numeric) {
2089 for (i = 0; i < tcp->u_arg[1]; i++)
2090 tprintf("%s%d", i ? "." : "", qoid[i + 2]);
2091 }
2092 tprintf("], ");
2093 tprintf("%lu, ", tcp->u_arg[1]);
2094 }
2095 } else {
2096 if (!syserror(tcp) && (umove(tcp, tcp->u_arg[3], &len) >= 0)) {
2097 printstr(tcp, tcp->u_arg[2], len);
2098 tprintf(", [%u], ", len);
Roland McGrathced50da2004-08-31 06:48:46 +00002099 } else
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00002100 tprintf("%#lx, %#lx, ", tcp->u_arg[2], tcp->u_arg[3]);
2101 printstr(tcp, tcp->u_arg[4], tcp->u_arg[5]);
2102 tprintf(", %lu", tcp->u_arg[5]);
2103 }
2104 return 0;
2105}
2106#endif
Wichert Akkerman16a03d22000-08-10 02:14:04 +00002107
2108#if UNIXWARE >= 2
2109
2110#include <sys/ksym.h>
2111#include <sys/elf.h>
2112
Roland McGrathd9f816f2004-09-04 03:39:20 +00002113static const struct xlat ksym_flags[] = {
Roland McGrathced50da2004-08-31 06:48:46 +00002114 { STT_NOTYPE, "STT_NOTYPE" },
2115 { STT_FUNC, "STT_FUNC" },
2116 { STT_OBJECT, "STT_OBJECT" },
Wichert Akkerman16a03d22000-08-10 02:14:04 +00002117 { 0, NULL },
2118};
2119
2120int
2121sys_getksym(tcp)
2122struct tcb *tcp;
2123{
2124 if (entering (tcp)) {
2125 printstr(tcp, tcp->u_arg[0], -1);
2126 tprintf(", ");
2127 }
2128 else {
2129 if (syserror(tcp)) {
2130 tprintf("%#lx, %#lx",
2131 tcp->u_arg[1], tcp->u_arg[2]);
2132 }
2133 else {
2134 int val;
2135 printnum (tcp, tcp->u_arg[1], "%#lx");
2136 tprintf(", ");
2137 if (umove(tcp, tcp->u_arg[2], &val) < 0) {
2138 tprintf("%#lx", tcp->u_arg[2]);
2139 }
2140 else {
2141 tprintf("[");
2142 printxval (ksym_flags, val, "STT_???");
2143 tprintf("]");
2144 }
2145 }
2146 }
2147
2148 return 0;
2149}
2150
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002151#ifdef HAVE_SYS_NSCSYS_H
John Hughes4e36a812001-04-18 15:11:51 +00002152
John Hughes0aadba42001-10-16 18:19:52 +00002153struct cred;
John Hughes4e36a812001-04-18 15:11:51 +00002154#include <sys/nscsys.h>
2155
Roland McGrathd9f816f2004-09-04 03:39:20 +00002156static const struct xlat ssi_cmd [] = {
John Hughes4e36a812001-04-18 15:11:51 +00002157 { SSISYS_BADOP, "SSISYS_BADOP" },
2158 { SSISYS_LDLVL_INIT,"SSISYS_LDLVL_INIT"},
2159 { SSISYS_LDLVL_GETVEC,"SSISYS_LDLVL_GETVEC"},
2160 { SSISYS_LDLVL_PUTVEC,"SSISYS_LDLVL_PUTVEC"},
2161 { SSISYS_LDLVL_PUTRCMDS,"SSISYS_LDLVL_PUTRCMDS"},
2162 { SSISYS_LDLVL_SETREXEC,"SSISYS_LDLVL_SETREXEC"},
2163 { SSISYS_CMS_CLUSTERID,"SSISYS_CMS_CLUSTERID"},
2164 { SSISYS_CFS_STATVFS,"SSISYS_CFS_STATVFS"},
2165 { SSISYS_NODE_GETNUM,"SSISYS_NODE_GETNUM"},
2166 { SSISYS_NODE_TABLE,"SSISYS_NODE_TABLE"},
2167 { SSISYS_NODE_DOWN,"SSISYS_NODE_DOWN"},
2168 { SSISYS_RECLAIM_CHILD,"SSISYS_RECLAIM_CHILD"},
2169 { SSISYS_IPC_GETINFO,"SSISYS_IPC_GETINFO"},
2170 { SSISYS_ICS_TEST,"SSISYS_ICS_TEST"},
2171 { SSISYS_NODE_PID,"SSISYS_NODE_PID"},
2172 { SSISYS_ISLOCAL,"SSISYS_ISLOCAL"},
2173 { SSISYS_CFS_ISSTACKED,"SSISYS_CFS_ISSTACKED"},
2174 { SSISYS_DNET_SYNC,"SSISYS_DNET_SYNC"},
2175 { SSISYS_CFS_WAIT_MODE,"SSISYS_CFS_WAIT_MODE"},
2176 { SSISYS_CFS_UMOUNT,"SSISYS_CFS_UMOUNT"},
2177 { SSISYS_LLSTAT,"SSISYS_LLSTAT" },
2178 { SSISYS_LTS_PERFTEST,"SSISYS_LTS_PERFTEST"},
2179 { SSISYS_LTS_CONFIG,"SSISYS_LTS_CONFIG"},
2180 { SSISYS_SNET_PERFTEST,"SSISYS_SNET_PERFTEST"},
2181 { SSISYS_IGNORE_HALFUP,"SSISYS_IGNORE_HALFUP"},
2182 { SSISYS_NODE_ROOTDEV,"SSISYS_NODE_ROOTDEV"},
2183 { SSISYS_GET_PRIMARY,"SSISYS_GET_PRIMARY"},
2184 { SSISYS_GET_SECONDARY,"SSISYS_GET_SECONDARY"},
2185 { SSISYS_GET_ROOTDISK,"SSISYS_GET_ROOTDISK"},
2186 { SSISYS_CLUSTERNODE_NUM,"SSISYS_CLUSTERNODE_NUM"},
2187 { SSISYS_CLUSTER_MEMBERSHIP,"SSISYS_CLUSTER_MEMBERSHIP"},
2188 { SSISYS_CLUSTER_DETAILEDTRANS,"SSISYS_CLUSTER_DETAILEDTRANS"},
2189 { SSISYS_CLUSTERNODE_INFO,"SSISYS_CLUSTERNODE_INFO"},
2190 { SSISYS_CLUSTERNODE_SETINFO,"SSISYS_CLUSTERNODE_SETINFO"},
2191 { SSISYS_CLUSTERNODE_AVAIL,"SSISYS_CLUSTERNODE_AVAIL"},
2192 { SSISYS_CLUSTER_MAXNODES,"SSISYS_CLUSTER_MAXNODES"},
2193 { SSISYS_SET_MEMPRIO,"SSISYS_SET_MEMPRIO"},
2194 { SSISYS_GET_USERS,"SSISYS_GET_USERS"},
2195 { SSISYS_FORCE_ROOT_NODE,"SSISYS_FORCE_ROOT_NODE"},
2196 { SSISYS_CVIP_SET,"SSISYS_CVIP_SET"},
2197 { SSISYS_CVIP_GET,"SSISYS_CVIP_GET"},
2198 { SSISYS_GET_NODE_COUNTS,"SSISYS_GET_NODE_COUNTS"},
2199 { SSISYS_GET_TRANSPORT,"SSISYS_GET_TRANSPORT"},
2200 { 0, NULL },
2201};
2202
2203int sys_ssisys (tcp)
2204struct tcb *tcp;
2205{
2206 struct ssisys_iovec iov;
John Hughes2d8b2c52001-10-18 14:52:24 +00002207 cls_nodeinfo_args_t cni;
2208 clusternode_info_t info;
2209
John Hughes4e36a812001-04-18 15:11:51 +00002210 if (entering (tcp)) {
John Hughes0aadba42001-10-16 18:19:52 +00002211 ts_reclaim_child_inargs_t trc;
John Hughes4e36a812001-04-18 15:11:51 +00002212 if (tcp->u_arg[1] != sizeof iov ||
2213 umove (tcp, tcp->u_arg[0], &iov) < 0)
2214 {
2215 tprintf ("%#lx, %ld", tcp->u_arg[0], tcp->u_arg[1]);
2216 return 0;
2217 }
2218 tprintf ("{id=");
2219 printxval(ssi_cmd, iov.tio_id.id_cmd, "SSISYS_???");
2220 tprintf (":%d", iov.tio_id.id_ver);
2221 switch (iov.tio_id.id_cmd) {
John Hughes0aadba42001-10-16 18:19:52 +00002222 case SSISYS_RECLAIM_CHILD:
2223 if (iov.tio_udatainlen != sizeof trc ||
2224 umove (tcp, (long) iov.tio_udatain, &trc) < 0)
2225 goto bad;
2226 tprintf (", in={pid=%ld, start=%ld}",
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002227 trc.trc_pid, trc.trc_start);
John Hughes0aadba42001-10-16 18:19:52 +00002228 break;
2229 case SSISYS_CLUSTERNODE_INFO:
2230 if (iov.tio_udatainlen != sizeof cni ||
2231 umove (tcp, (long) iov.tio_udatain, &cni) < 0)
2232 goto bad;
2233 tprintf (", in={node=%ld, len=%d}",
2234 cni.nodenum, cni.info_len);
2235 break;
John Hughes4e36a812001-04-18 15:11:51 +00002236 default:
John Hughes0aadba42001-10-16 18:19:52 +00002237 bad:
John Hughes4e36a812001-04-18 15:11:51 +00002238 if (iov.tio_udatainlen) {
2239 tprintf (", in=[/* %d bytes */]",
2240 iov.tio_udatainlen);
2241 }
2242 }
2243 }
2244 else {
John Hughes2d8b2c52001-10-18 14:52:24 +00002245 if (tcp->u_arg[1] != sizeof iov ||
2246 umove (tcp, tcp->u_arg[0], &iov) < 0)
2247 goto done;
John Hughes4e36a812001-04-18 15:11:51 +00002248 switch (iov.tio_id.id_cmd) {
John Hughes2d8b2c52001-10-18 14:52:24 +00002249 case SSISYS_CLUSTERNODE_INFO:
2250 if (iov.tio_udatainlen != sizeof cni ||
2251 umove (tcp, (long) iov.tio_udatain, &cni) < 0)
2252 goto bad_out;
Roland McGrathced50da2004-08-31 06:48:46 +00002253 if (cni.info_len != sizeof info ||
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002254 iov.tio_udataoutlen != sizeof &info ||
John Hughes2d8b2c52001-10-18 14:52:24 +00002255 umove (tcp, (long) iov.tio_udataout, &info) < 0)
2256 goto bad_out;
2257 tprintf (", out={node=%ld, cpus=%d, online=%d}",
2258 info.node_num, info.node_totalcpus,
2259 info.node_onlinecpus);
2260 break;
Roland McGrathced50da2004-08-31 06:48:46 +00002261
John Hughes4e36a812001-04-18 15:11:51 +00002262 default:
John Hughes2d8b2c52001-10-18 14:52:24 +00002263 bad_out:
John Hughes4e36a812001-04-18 15:11:51 +00002264 if (iov.tio_udataoutlen) {
2265 tprintf (", out=[/* %d bytes */]",
2266 iov.tio_udataoutlen);
2267 }
2268 }
John Hughes2d8b2c52001-10-18 14:52:24 +00002269 done:
John Hughes4e36a812001-04-18 15:11:51 +00002270 tprintf ("}, %ld", tcp->u_arg[1]);
2271 }
2272 return 0;
2273}
2274
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002275#endif
John Hughes4e36a812001-04-18 15:11:51 +00002276
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002277#endif /* UNIXWARE > 2 */
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002278
2279#ifdef MIPS
2280
Wichert Akkermand6b92492001-04-07 21:37:12 +00002281#ifndef __NEW_UTS_LEN
2282#define __NEW_UTS_LEN 64
2283#endif
2284
Roland McGrathd9f816f2004-09-04 03:39:20 +00002285static const struct xlat sysmips_operations[] = {
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002286 { SETNAME, "SETNAME" },
2287 { FLUSH_CACHE, "FLUSH_CACHE" },
2288 { MIPS_FIXADE, "MIPS_FIXADE" },
2289 { MIPS_RDNVRAM, "MIPS_RDNVRAM" },
2290 { MIPS_ATOMIC_SET, "MIPS_ATOMIC_SET" },
2291 { 0, NULL }
2292};
2293
2294int sys_sysmips(tcp)
2295struct tcb *tcp;
2296{
2297 if (entering(tcp)) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002298 printxval(sysmips_operations, tcp->u_arg[0], "???");
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002299 if (!verbose(tcp)) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002300 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002301 } else if (tcp->u_arg[0]==SETNAME) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002302 char nodename[__NEW_UTS_LEN + 1];
2303 if (umovestr(tcp, tcp->u_arg[1], (__NEW_UTS_LEN + 1), nodename) < 0)
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002304 tprintf(", %#lx", tcp->u_arg[1]);
2305 else
2306 tprintf(", \"%s\"", nodename);
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002307 } else if (tcp->u_arg[0] == MIPS_ATOMIC_SET) {
2308 tprintf(", %#lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
2309 } else if (tcp->u_arg[0] == MIPS_FIXADE) {
2310 tprintf(", 0x%lx", tcp->u_arg[1]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002311 } else {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002312 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002313 }
2314 }
2315
2316 return 0;
2317}
2318
2319#endif /* MIPS */