blob: 80b105bccf1f1a14ba37be6dbe831e6cf995e309 [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" },
305 { 0, NULL },
306};
307
308int
309sys_sram_alloc(tcp)
310struct tcb *tcp;
311{
312 if (entering(tcp)) {
313 /* size */
314 tprintf("%zu, ", tcp->u_arg[0]);
315 /* flags */
316 printxval(sram_alloc_flags, tcp->u_arg[1], "L1_???_SRAM");
317 }
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"},
1510 { 0, NULL },
1511};
1512
1513
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001514int
1515sys_capget(tcp)
1516struct tcb *tcp;
1517{
Wichert Akkermanc7926982000-04-10 22:22:31 +00001518 static cap_user_header_t arg0 = NULL;
1519 static cap_user_data_t arg1 = NULL;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001520
1521 if(!entering(tcp)) {
Wichert Akkermanc7926982000-04-10 22:22:31 +00001522 if (!arg0) {
1523 if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001524 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001525 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001526 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001527 }
1528 }
1529 if (!arg1) {
1530 if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001531 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001532 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001533 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001534 }
1535 }
1536
1537 if (!tcp->u_arg[0])
1538 tprintf("NULL");
1539 else if (!verbose(tcp))
1540 tprintf("%#lx", tcp->u_arg[0]);
1541 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
1542 tprintf("???");
1543 else {
1544 tprintf("%#x, %d", arg0->version, arg0->pid);
1545 }
1546 tprintf(", ");
1547 if (!tcp->u_arg[1])
1548 tprintf("NULL");
1549 else if (!verbose(tcp))
1550 tprintf("%#lx", tcp->u_arg[1]);
1551 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
1552 tprintf("???");
1553 else {
1554 tprintf("{");
Roland McGrathb2dee132005-06-01 19:02:36 +00001555 printflags(capabilities, arg1->effective, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001556 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001557 printflags(capabilities, arg1->permitted, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001558 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001559 printflags(capabilities, arg1->inheritable, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001560 tprintf("}");
Roland McGrathced50da2004-08-31 06:48:46 +00001561 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001562 }
1563 return 0;
1564}
1565
1566int
1567sys_capset(tcp)
1568struct tcb *tcp;
1569{
Wichert Akkermanc7926982000-04-10 22:22:31 +00001570 static cap_user_header_t arg0 = NULL;
1571 static cap_user_data_t arg1 = NULL;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001572
Wichert Akkermanc7926982000-04-10 22:22:31 +00001573 if(entering(tcp)) {
1574 if (!arg0) {
1575 if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001576 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001577 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001578 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001579 }
1580 }
1581 if (!arg1) {
1582 if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
Roland McGrath46100d02005-06-01 18:55:42 +00001583 fprintf(stderr, "out of memory\n");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001584 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman5ae21ea2000-05-01 01:53:59 +00001585 return -1;
Wichert Akkermanc7926982000-04-10 22:22:31 +00001586 }
1587 }
1588
1589 if (!tcp->u_arg[0])
1590 tprintf("NULL");
1591 else if (!verbose(tcp))
1592 tprintf("%#lx", tcp->u_arg[0]);
1593 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
1594 tprintf("???");
1595 else {
1596 tprintf("%#x, %d", arg0->version, arg0->pid);
1597 }
1598 tprintf(", ");
1599 if (!tcp->u_arg[1])
1600 tprintf("NULL");
1601 else if (!verbose(tcp))
1602 tprintf("%#lx", tcp->u_arg[1]);
1603 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
1604 tprintf("???");
1605 else {
1606 tprintf("{");
Roland McGrathb2dee132005-06-01 19:02:36 +00001607 printflags(capabilities, arg1->effective, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001608 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001609 printflags(capabilities, arg1->permitted, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001610 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +00001611 printflags(capabilities, arg1->inheritable, "CAP_???");
Wichert Akkermanc7926982000-04-10 22:22:31 +00001612 tprintf("}");
Roland McGrathced50da2004-08-31 06:48:46 +00001613 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001614 }
1615 return 0;
1616}
1617
1618#else
1619
1620int sys_capget(tcp)
1621struct tcb *tcp;
1622{
1623 return printargs(tcp);
1624}
1625
1626int sys_capset(tcp)
1627struct tcb *tcp;
1628{
1629 return printargs(tcp);
1630}
1631
1632#endif
1633
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001634#ifdef LINUX
Dmitry V. Levin35a55782006-12-04 13:48:10 +00001635/* Linux 2.6.18+ headers removed CTL_PROC enum. */
1636# define CTL_PROC 4
Roland McGrath5eb1aa52007-01-11 22:48:39 +00001637# define CTL_CPU 10 /* older headers lack */
Roland McGrathd9f816f2004-09-04 03:39:20 +00001638static const struct xlat sysctl_root[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001639 { CTL_KERN, "CTL_KERN" },
1640 { CTL_VM, "CTL_VM" },
1641 { CTL_NET, "CTL_NET" },
1642 { CTL_PROC, "CTL_PROC" },
1643 { CTL_FS, "CTL_FS" },
1644 { CTL_DEBUG, "CTL_DEBUG" },
1645 { CTL_DEV, "CTL_DEV" },
Dmitry V. Levin35a55782006-12-04 13:48:10 +00001646 { CTL_BUS, "CTL_BUS" },
1647 { CTL_ABI, "CTL_ABI" },
1648 { CTL_CPU, "CTL_CPU" },
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001649 { 0, NULL }
1650};
1651
Roland McGrathd9f816f2004-09-04 03:39:20 +00001652static const struct xlat sysctl_kern[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001653 { KERN_OSTYPE, "KERN_OSTYPE" },
1654 { KERN_OSRELEASE, "KERN_OSRELEASE" },
1655 { KERN_OSREV, "KERN_OSREV" },
1656 { KERN_VERSION, "KERN_VERSION" },
1657 { KERN_SECUREMASK, "KERN_SECUREMASK" },
1658 { KERN_PROF, "KERN_PROF" },
1659 { KERN_NODENAME, "KERN_NODENAME" },
1660 { KERN_DOMAINNAME, "KERN_DOMAINNAME" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001661#ifdef KERN_SECURELVL
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001662 { KERN_SECURELVL, "KERN_SECURELVL" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001663#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001664 { KERN_PANIC, "KERN_PANIC" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001665#ifdef KERN_REALROOTDEV
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001666 { KERN_REALROOTDEV, "KERN_REALROOTDEV" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001667#endif
1668#ifdef KERN_JAVA_INTERPRETER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001669 { KERN_JAVA_INTERPRETER, "KERN_JAVA_INTERPRETER" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001670#endif
1671#ifdef KERN_JAVA_APPLETVIEWER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001672 { KERN_JAVA_APPLETVIEWER, "KERN_JAVA_APPLETVIEWER" },
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00001673#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001674 { KERN_SPARC_REBOOT, "KERN_SPARC_REBOOT" },
1675 { KERN_CTLALTDEL, "KERN_CTLALTDEL" },
1676 { KERN_PRINTK, "KERN_PRINTK" },
1677 { KERN_NAMETRANS, "KERN_NAMETRANS" },
1678 { KERN_PPC_HTABRECLAIM, "KERN_PPC_HTABRECLAIM" },
1679 { KERN_PPC_ZEROPAGED, "KERN_PPC_ZEROPAGED" },
1680 { KERN_PPC_POWERSAVE_NAP, "KERN_PPC_POWERSAVE_NAP" },
1681 { KERN_MODPROBE, "KERN_MODPROBE" },
1682 { KERN_SG_BIG_BUFF, "KERN_SG_BIG_BUFF" },
1683 { KERN_ACCT, "KERN_ACCT" },
1684 { KERN_PPC_L2CR, "KERN_PPC_L2CR" },
1685 { KERN_RTSIGNR, "KERN_RTSIGNR" },
1686 { KERN_RTSIGMAX, "KERN_RTSIGMAX" },
1687 { KERN_SHMMAX, "KERN_SHMMAX" },
1688 { KERN_MSGMAX, "KERN_MSGMAX" },
1689 { KERN_MSGMNB, "KERN_MSGMNB" },
1690 { KERN_MSGPOOL, "KERN_MSGPOOL" },
1691 { 0, NULL }
1692};
1693
Roland McGrathd9f816f2004-09-04 03:39:20 +00001694static const struct xlat sysctl_vm[] = {
Roland McGratha796fd02004-03-01 22:10:54 +00001695#ifdef VM_SWAPCTL
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001696 { VM_SWAPCTL, "VM_SWAPCTL" },
Roland McGratha796fd02004-03-01 22:10:54 +00001697#endif
1698#ifdef VM_UNUSED1
1699 { VM_UNUSED1, "VM_UNUSED1" },
1700#endif
1701#ifdef VM_SWAPOUT
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001702 { VM_SWAPOUT, "VM_SWAPOUT" },
Roland McGratha796fd02004-03-01 22:10:54 +00001703#endif
1704#ifdef VM_UNUSED2
1705 { VM_UNUSED2, "VM_UNUSED2" },
1706#endif
1707#ifdef VM_FREEPG
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001708 { VM_FREEPG, "VM_FREEPG" },
Roland McGratha796fd02004-03-01 22:10:54 +00001709#endif
1710#ifdef VM_UNUSED3
1711 { VM_UNUSED3, "VM_UNUSED3" },
1712#endif
1713#ifdef VM_BDFLUSH
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001714 { VM_BDFLUSH, "VM_BDFLUSH" },
Roland McGratha796fd02004-03-01 22:10:54 +00001715#endif
1716#ifdef VM_UNUSED4
1717 { VM_UNUSED4, "VM_UNUSED4" },
1718#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001719 { VM_OVERCOMMIT_MEMORY, "VM_OVERCOMMIT_MEMORY" },
Roland McGratha796fd02004-03-01 22:10:54 +00001720#ifdef VM_BUFFERMEM
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001721 { VM_BUFFERMEM, "VM_BUFFERMEM" },
Roland McGratha796fd02004-03-01 22:10:54 +00001722#endif
1723#ifdef VM_UNUSED5
1724 { VM_UNUSED5, "VM_UNUSED5" },
1725#endif
1726#ifdef VM_PAGECACHE
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001727 { VM_PAGECACHE, "VM_PAGECACHE" },
Roland McGratha796fd02004-03-01 22:10:54 +00001728#endif
1729#ifdef VM_UNUSED7
1730 { VM_UNUSED7, "VM_UNUSED7" },
1731#endif
1732#ifdef VM_PAGERDAEMON
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001733 { VM_PAGERDAEMON, "VM_PAGERDAEMON" },
Roland McGratha796fd02004-03-01 22:10:54 +00001734#endif
1735#ifdef VM_UNUSED8
1736 { VM_UNUSED8, "VM_UNUSED8" },
1737#endif
1738#ifdef VM_PGT_CACHE
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001739 { VM_PGT_CACHE, "VM_PGT_CACHE" },
Roland McGratha796fd02004-03-01 22:10:54 +00001740#endif
1741#ifdef VM_UNUSED9
1742 { VM_UNUSED9, "VM_UNUSED9" },
1743#endif
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001744 { VM_PAGE_CLUSTER, "VM_PAGE_CLUSTER" },
1745 { 0, NULL },
1746};
1747
Roland McGrathd9f816f2004-09-04 03:39:20 +00001748static const struct xlat sysctl_net[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001749 { NET_CORE, "NET_CORE" },
1750 { NET_ETHER, "NET_ETHER" },
1751 { NET_802, "NET_802" },
1752 { NET_UNIX, "NET_UNIX" },
1753 { NET_IPV4, "NET_IPV4" },
1754 { NET_IPX, "NET_IPX" },
1755 { NET_ATALK, "NET_ATALK" },
1756 { NET_NETROM, "NET_NETROM" },
1757 { NET_AX25, "NET_AX25" },
1758 { NET_BRIDGE, "NET_BRIDGE" },
1759 { NET_ROSE, "NET_ROSE" },
1760 { NET_IPV6, "NET_IPV6" },
1761 { NET_X25, "NET_X25" },
1762 { NET_TR, "NET_TR" },
1763 { NET_DECNET, "NET_DECNET" },
1764 { 0, NULL }
1765};
1766
Roland McGrathd9f816f2004-09-04 03:39:20 +00001767static const struct xlat sysctl_net_core[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001768 { NET_CORE_WMEM_MAX, "NET_CORE_WMEM_MAX" },
1769 { NET_CORE_RMEM_MAX, "NET_CORE_RMEM_MAX" },
1770 { NET_CORE_WMEM_DEFAULT, "NET_CORE_WMEM_DEFAULT" },
1771 { NET_CORE_RMEM_DEFAULT, "NET_CORE_RMEM_DEFAULT" },
1772 { NET_CORE_MAX_BACKLOG, "NET_CORE_MAX_BACKLOG" },
1773 { NET_CORE_FASTROUTE, "NET_CORE_FASTROUTE" },
1774 { NET_CORE_MSG_COST, "NET_CORE_MSG_COST" },
1775 { NET_CORE_MSG_BURST, "NET_CORE_MSG_BURST" },
1776 { NET_CORE_OPTMEM_MAX, "NET_CORE_OPTMEM_MAX" },
1777 { 0, NULL }
1778};
1779
Roland McGrathd9f816f2004-09-04 03:39:20 +00001780static const struct xlat sysctl_net_unix[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001781 { NET_UNIX_DESTROY_DELAY, "NET_UNIX_DESTROY_DELAY" },
1782 { NET_UNIX_DELETE_DELAY, "NET_UNIX_DELETE_DELAY" },
1783 { 0, NULL }
1784};
1785
Roland McGrathd9f816f2004-09-04 03:39:20 +00001786static const struct xlat sysctl_net_ipv4[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001787 { NET_IPV4_FORWARD, "NET_IPV4_FORWARD" },
1788 { NET_IPV4_DYNADDR, "NET_IPV4_DYNADDR" },
1789 { NET_IPV4_CONF, "NET_IPV4_CONF" },
1790 { NET_IPV4_NEIGH, "NET_IPV4_NEIGH" },
1791 { NET_IPV4_ROUTE, "NET_IPV4_ROUTE" },
1792 { NET_IPV4_FIB_HASH, "NET_IPV4_FIB_HASH" },
1793 { NET_IPV4_TCP_TIMESTAMPS, "NET_IPV4_TCP_TIMESTAMPS" },
1794 { NET_IPV4_TCP_WINDOW_SCALING, "NET_IPV4_TCP_WINDOW_SCALING" },
1795 { NET_IPV4_TCP_SACK, "NET_IPV4_TCP_SACK" },
1796 { NET_IPV4_TCP_RETRANS_COLLAPSE, "NET_IPV4_TCP_RETRANS_COLLAPSE" },
1797 { NET_IPV4_DEFAULT_TTL, "NET_IPV4_DEFAULT_TTL" },
1798 { NET_IPV4_AUTOCONFIG, "NET_IPV4_AUTOCONFIG" },
1799 { NET_IPV4_NO_PMTU_DISC, "NET_IPV4_NO_PMTU_DISC" },
1800 { NET_IPV4_TCP_SYN_RETRIES, "NET_IPV4_TCP_SYN_RETRIES" },
1801 { NET_IPV4_IPFRAG_HIGH_THRESH, "NET_IPV4_IPFRAG_HIGH_THRESH" },
1802 { NET_IPV4_IPFRAG_LOW_THRESH, "NET_IPV4_IPFRAG_LOW_THRESH" },
1803 { NET_IPV4_IPFRAG_TIME, "NET_IPV4_IPFRAG_TIME" },
1804 { NET_IPV4_TCP_MAX_KA_PROBES, "NET_IPV4_TCP_MAX_KA_PROBES" },
1805 { NET_IPV4_TCP_KEEPALIVE_TIME, "NET_IPV4_TCP_KEEPALIVE_TIME" },
1806 { NET_IPV4_TCP_KEEPALIVE_PROBES, "NET_IPV4_TCP_KEEPALIVE_PROBES" },
1807 { NET_IPV4_TCP_RETRIES1, "NET_IPV4_TCP_RETRIES1" },
1808 { NET_IPV4_TCP_RETRIES2, "NET_IPV4_TCP_RETRIES2" },
1809 { NET_IPV4_TCP_FIN_TIMEOUT, "NET_IPV4_TCP_FIN_TIMEOUT" },
1810 { NET_IPV4_IP_MASQ_DEBUG, "NET_IPV4_IP_MASQ_DEBUG" },
1811 { NET_TCP_SYNCOOKIES, "NET_TCP_SYNCOOKIES" },
1812 { NET_TCP_STDURG, "NET_TCP_STDURG" },
1813 { NET_TCP_RFC1337, "NET_TCP_RFC1337" },
1814 { NET_TCP_SYN_TAILDROP, "NET_TCP_SYN_TAILDROP" },
1815 { NET_TCP_MAX_SYN_BACKLOG, "NET_TCP_MAX_SYN_BACKLOG" },
1816 { NET_IPV4_LOCAL_PORT_RANGE, "NET_IPV4_LOCAL_PORT_RANGE" },
1817 { NET_IPV4_ICMP_ECHO_IGNORE_ALL, "NET_IPV4_ICMP_ECHO_IGNORE_ALL" },
1818 { NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS" },
1819 { NET_IPV4_ICMP_SOURCEQUENCH_RATE, "NET_IPV4_ICMP_SOURCEQUENCH_RATE" },
1820 { NET_IPV4_ICMP_DESTUNREACH_RATE, "NET_IPV4_ICMP_DESTUNREACH_RATE" },
1821 { NET_IPV4_ICMP_TIMEEXCEED_RATE, "NET_IPV4_ICMP_TIMEEXCEED_RATE" },
1822 { NET_IPV4_ICMP_PARAMPROB_RATE, "NET_IPV4_ICMP_PARAMPROB_RATE" },
1823 { NET_IPV4_ICMP_ECHOREPLY_RATE, "NET_IPV4_ICMP_ECHOREPLY_RATE" },
1824 { NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES" },
1825 { NET_IPV4_IGMP_MAX_MEMBERSHIPS, "NET_IPV4_IGMP_MAX_MEMBERSHIPS" },
1826 { 0, NULL }
1827};
1828
Roland McGrathd9f816f2004-09-04 03:39:20 +00001829static const struct xlat sysctl_net_ipv4_route[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001830 { NET_IPV4_ROUTE_FLUSH, "NET_IPV4_ROUTE_FLUSH" },
1831 { NET_IPV4_ROUTE_MIN_DELAY, "NET_IPV4_ROUTE_MIN_DELAY" },
1832 { NET_IPV4_ROUTE_MAX_DELAY, "NET_IPV4_ROUTE_MAX_DELAY" },
1833 { NET_IPV4_ROUTE_GC_THRESH, "NET_IPV4_ROUTE_GC_THRESH" },
1834 { NET_IPV4_ROUTE_MAX_SIZE, "NET_IPV4_ROUTE_MAX_SIZE" },
1835 { NET_IPV4_ROUTE_GC_MIN_INTERVAL, "NET_IPV4_ROUTE_GC_MIN_INTERVAL" },
1836 { NET_IPV4_ROUTE_GC_TIMEOUT, "NET_IPV4_ROUTE_GC_TIMEOUT" },
1837 { NET_IPV4_ROUTE_GC_INTERVAL, "NET_IPV4_ROUTE_GC_INTERVAL" },
1838 { NET_IPV4_ROUTE_REDIRECT_LOAD, "NET_IPV4_ROUTE_REDIRECT_LOAD" },
1839 { NET_IPV4_ROUTE_REDIRECT_NUMBER, "NET_IPV4_ROUTE_REDIRECT_NUMBER" },
1840 { NET_IPV4_ROUTE_REDIRECT_SILENCE, "NET_IPV4_ROUTE_REDIRECT_SILENCE" },
1841 { NET_IPV4_ROUTE_ERROR_COST, "NET_IPV4_ROUTE_ERROR_COST" },
1842 { NET_IPV4_ROUTE_ERROR_BURST, "NET_IPV4_ROUTE_ERROR_BURST" },
1843 { NET_IPV4_ROUTE_GC_ELASTICITY, "NET_IPV4_ROUTE_GC_ELASTICITY" },
1844 { 0, NULL }
1845};
1846
Roland McGrathd9f816f2004-09-04 03:39:20 +00001847static const struct xlat sysctl_net_ipv4_conf[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001848 { NET_IPV4_CONF_FORWARDING, "NET_IPV4_CONF_FORWARDING" },
1849 { NET_IPV4_CONF_MC_FORWARDING, "NET_IPV4_CONF_MC_FORWARDING" },
1850 { NET_IPV4_CONF_PROXY_ARP, "NET_IPV4_CONF_PROXY_ARP" },
1851 { NET_IPV4_CONF_ACCEPT_REDIRECTS, "NET_IPV4_CONF_ACCEPT_REDIRECTS" },
1852 { NET_IPV4_CONF_SECURE_REDIRECTS, "NET_IPV4_CONF_SECURE_REDIRECTS" },
1853 { NET_IPV4_CONF_SEND_REDIRECTS, "NET_IPV4_CONF_SEND_REDIRECTS" },
1854 { NET_IPV4_CONF_SHARED_MEDIA, "NET_IPV4_CONF_SHARED_MEDIA" },
1855 { NET_IPV4_CONF_RP_FILTER, "NET_IPV4_CONF_RP_FILTER" },
1856 { NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, "NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE" },
1857 { NET_IPV4_CONF_BOOTP_RELAY, "NET_IPV4_CONF_BOOTP_RELAY" },
1858 { NET_IPV4_CONF_LOG_MARTIANS, "NET_IPV4_CONF_LOG_MARTIANS" },
1859 { 0, NULL }
1860};
1861
Roland McGrathd9f816f2004-09-04 03:39:20 +00001862static const struct xlat sysctl_net_ipv6[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001863 { NET_IPV6_CONF, "NET_IPV6_CONF" },
1864 { NET_IPV6_NEIGH, "NET_IPV6_NEIGH" },
1865 { NET_IPV6_ROUTE, "NET_IPV6_ROUTE" },
1866 { 0, NULL }
1867};
1868
Roland McGrathd9f816f2004-09-04 03:39:20 +00001869static const struct xlat sysctl_net_ipv6_route[] = {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001870 { NET_IPV6_ROUTE_FLUSH, "NET_IPV6_ROUTE_FLUSH" },
1871 { NET_IPV6_ROUTE_GC_THRESH, "NET_IPV6_ROUTE_GC_THRESH" },
1872 { NET_IPV6_ROUTE_MAX_SIZE, "NET_IPV6_ROUTE_MAX_SIZE" },
1873 { NET_IPV6_ROUTE_GC_MIN_INTERVAL, "NET_IPV6_ROUTE_GC_MIN_INTERVAL" },
1874 { NET_IPV6_ROUTE_GC_TIMEOUT, "NET_IPV6_ROUTE_GC_TIMEOUT" },
1875 { NET_IPV6_ROUTE_GC_INTERVAL, "NET_IPV6_ROUTE_GC_INTERVAL" },
1876 { NET_IPV6_ROUTE_GC_ELASTICITY, "NET_IPV6_ROUTE_GC_ELASTICITY" },
1877 { 0, NULL }
1878};
1879
1880int
1881sys_sysctl(tcp)
1882struct tcb *tcp;
1883{
1884 struct __sysctl_args info;
1885 int *name;
Roland McGrathaa524c82005-06-01 19:22:06 +00001886 unsigned long size;
1887
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001888 if (umove (tcp, tcp->u_arg[0], &info) < 0)
1889 return printargs(tcp);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001890
Roland McGrathaa524c82005-06-01 19:22:06 +00001891 size = sizeof (int) * (unsigned long) info.nlen;
1892 name = (size / sizeof (int) != info.nlen) ? NULL : malloc (size);
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001893 if (name == NULL ||
Roland McGrathaa524c82005-06-01 19:22:06 +00001894 umoven(tcp, (unsigned long) info.name, size, (char *) name) < 0) {
1895 free(name);
1896 if (entering(tcp))
1897 tprintf("{%p, %d, %p, %p, %p, %Zu}",
1898 info.name, info.nlen, info.oldval,
1899 info.oldlenp, info.newval, info.newlen);
Roland McGrath2cbe44e2005-05-26 23:21:09 +00001900 return 0;
1901 }
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001902
1903 if (entering(tcp)) {
Roland McGrathaa524c82005-06-01 19:22:06 +00001904 int cnt = 0, max_cnt;
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001905
1906 tprintf("{{");
1907
1908 if (info.nlen == 0)
1909 goto out;
1910 printxval(sysctl_root, name[0], "CTL_???");
1911 ++cnt;
1912
1913 if (info.nlen == 1)
1914 goto out;
1915 switch (name[0]) {
1916 case CTL_KERN:
1917 tprintf(", ");
1918 printxval(sysctl_kern, name[1], "KERN_???");
1919 ++cnt;
1920 break;
1921 case CTL_VM:
1922 tprintf(", ");
1923 printxval(sysctl_vm, name[1], "VM_???");
1924 ++cnt;
1925 break;
1926 case CTL_NET:
1927 tprintf(", ");
1928 printxval(sysctl_net, name[1], "NET_???");
1929 ++cnt;
1930
1931 if (info.nlen == 2)
1932 goto out;
1933 switch (name[1]) {
1934 case NET_CORE:
1935 tprintf(", ");
1936 printxval(sysctl_net_core, name[2],
1937 "NET_CORE_???");
1938 break;
1939 case NET_UNIX:
1940 tprintf(", ");
1941 printxval(sysctl_net_unix, name[2],
1942 "NET_UNIX_???");
1943 break;
1944 case NET_IPV4:
1945 tprintf(", ");
1946 printxval(sysctl_net_ipv4, name[2],
1947 "NET_IPV4_???");
1948
1949 if (info.nlen == 3)
1950 goto out;
1951 switch (name[2]) {
1952 case NET_IPV4_ROUTE:
1953 tprintf(", ");
1954 printxval(sysctl_net_ipv4_route,
1955 name[3],
1956 "NET_IPV4_ROUTE_???");
1957 break;
1958 case NET_IPV4_CONF:
1959 tprintf(", ");
1960 printxval(sysctl_net_ipv4_conf,
1961 name[3],
1962 "NET_IPV4_CONF_???");
1963 break;
1964 default:
1965 goto out;
1966 }
1967 break;
1968 case NET_IPV6:
1969 tprintf(", ");
1970 printxval(sysctl_net_ipv6, name[2],
1971 "NET_IPV6_???");
1972
1973 if (info.nlen == 3)
1974 goto out;
1975 switch (name[2]) {
1976 case NET_IPV6_ROUTE:
1977 tprintf(", ");
1978 printxval(sysctl_net_ipv6_route,
1979 name[3],
1980 "NET_IPV6_ROUTE_???");
1981 break;
1982 default:
1983 goto out;
1984 }
1985 break;
1986 default:
1987 goto out;
1988 }
1989 break;
1990 default:
1991 goto out;
1992 }
1993 out:
Roland McGrath8e4a3e62006-01-12 11:03:46 +00001994 max_cnt = info.nlen;
1995 if (abbrev(tcp) && max_cnt > max_strlen)
1996 max_cnt = max_strlen;
Roland McGrathaa524c82005-06-01 19:22:06 +00001997 while (cnt < max_cnt)
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00001998 tprintf(", %x", name[cnt++]);
Roland McGrathaa524c82005-06-01 19:22:06 +00001999 if (cnt < info.nlen)
2000 tprintf(", ...");
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002001 tprintf("}, %d, ", info.nlen);
2002 } else {
2003 size_t oldlen;
Roland McGrathaa524c82005-06-01 19:22:06 +00002004 if (umove(tcp, (size_t)info.oldlenp, &oldlen) >= 0
2005 && info.nlen >= 2
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002006 && ((name[0] == CTL_KERN
2007 && (name[1] == KERN_OSRELEASE
2008 || name[1] == KERN_OSTYPE
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00002009#ifdef KERN_JAVA_INTERPRETER
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002010 || name[1] == KERN_JAVA_INTERPRETER
Wichert Akkerman9ce1a631999-08-29 23:15:07 +00002011#endif
2012#ifdef KERN_JAVA_APPLETVIEWER
2013 || name[1] == KERN_JAVA_APPLETVIEWER
2014#endif
2015 )))) {
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002016 printpath(tcp, (size_t)info.oldval);
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00002017 tprintf(", %Zu, ", oldlen);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002018 if (info.newval == 0)
2019 tprintf("NULL");
2020 else if (syserror(tcp))
2021 tprintf("%p", info.newval);
2022 else
2023 printpath(tcp, (size_t)info.newval);
2024 tprintf(", %Zd", info.newlen);
2025 } else {
Wichert Akkerman8b1b40c2000-02-03 21:58:30 +00002026 tprintf("%p, %Zd, %p, %Zd", info.oldval, oldlen,
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002027 info.newval, info.newlen);
2028 }
2029 tprintf("}");
2030 }
Roland McGrath2cbe44e2005-05-26 23:21:09 +00002031
2032 free(name);
Wichert Akkerman22fe9d21999-05-27 12:00:57 +00002033 return 0;
2034}
2035#else
2036int sys_sysctl(tcp)
2037struct tcb *tcp;
2038{
2039 return printargs(tcp);
2040}
2041#endif
2042
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00002043#ifdef FREEBSD
2044#include <sys/sysctl.h>
2045
2046int sys___sysctl(tcp)
2047struct tcb *tcp;
2048{
2049 int qoid[CTL_MAXNAME+2];
2050 char ctl[1024];
2051 size_t len;
2052 int i, numeric;
Roland McGrathced50da2004-08-31 06:48:46 +00002053
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00002054 if (entering(tcp)) {
2055 if (tcp->u_arg[1] < 0 || tcp->u_arg[1] > CTL_MAXNAME ||
2056 (umoven(tcp, tcp->u_arg[0], tcp->u_arg[1] * sizeof(int),
2057 (char *) (qoid + 2)) < 0))
2058 tprintf("[...], ");
2059 else {
2060 /* Use sysctl to ask the name of the current MIB
2061 This uses the undocumented "Staff-functions" used
2062 by the sysctl program. See kern_sysctl.c for
2063 details. */
2064 qoid[0] = 0; /* sysctl */
2065 qoid[1] = 1; /* name */
2066 i = sizeof(ctl);
2067 tprintf("[");
2068 if (sysctl(qoid, tcp->u_arg[1] + 2, ctl, &i, 0, 0) >= 0) {
2069 numeric = !abbrev(tcp);
2070 tprintf("%s%s", ctl, numeric ? ", " : "");
2071 } else
2072 numeric = 1;
2073 if (numeric) {
2074 for (i = 0; i < tcp->u_arg[1]; i++)
2075 tprintf("%s%d", i ? "." : "", qoid[i + 2]);
2076 }
2077 tprintf("], ");
2078 tprintf("%lu, ", tcp->u_arg[1]);
2079 }
2080 } else {
2081 if (!syserror(tcp) && (umove(tcp, tcp->u_arg[3], &len) >= 0)) {
2082 printstr(tcp, tcp->u_arg[2], len);
2083 tprintf(", [%u], ", len);
Roland McGrathced50da2004-08-31 06:48:46 +00002084 } else
Wichert Akkermanbf79f2e2000-09-01 21:03:06 +00002085 tprintf("%#lx, %#lx, ", tcp->u_arg[2], tcp->u_arg[3]);
2086 printstr(tcp, tcp->u_arg[4], tcp->u_arg[5]);
2087 tprintf(", %lu", tcp->u_arg[5]);
2088 }
2089 return 0;
2090}
2091#endif
Wichert Akkerman16a03d22000-08-10 02:14:04 +00002092
2093#if UNIXWARE >= 2
2094
2095#include <sys/ksym.h>
2096#include <sys/elf.h>
2097
Roland McGrathd9f816f2004-09-04 03:39:20 +00002098static const struct xlat ksym_flags[] = {
Roland McGrathced50da2004-08-31 06:48:46 +00002099 { STT_NOTYPE, "STT_NOTYPE" },
2100 { STT_FUNC, "STT_FUNC" },
2101 { STT_OBJECT, "STT_OBJECT" },
Wichert Akkerman16a03d22000-08-10 02:14:04 +00002102 { 0, NULL },
2103};
2104
2105int
2106sys_getksym(tcp)
2107struct tcb *tcp;
2108{
2109 if (entering (tcp)) {
2110 printstr(tcp, tcp->u_arg[0], -1);
2111 tprintf(", ");
2112 }
2113 else {
2114 if (syserror(tcp)) {
2115 tprintf("%#lx, %#lx",
2116 tcp->u_arg[1], tcp->u_arg[2]);
2117 }
2118 else {
2119 int val;
2120 printnum (tcp, tcp->u_arg[1], "%#lx");
2121 tprintf(", ");
2122 if (umove(tcp, tcp->u_arg[2], &val) < 0) {
2123 tprintf("%#lx", tcp->u_arg[2]);
2124 }
2125 else {
2126 tprintf("[");
2127 printxval (ksym_flags, val, "STT_???");
2128 tprintf("]");
2129 }
2130 }
2131 }
2132
2133 return 0;
2134}
2135
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002136#ifdef HAVE_SYS_NSCSYS_H
John Hughes4e36a812001-04-18 15:11:51 +00002137
John Hughes0aadba42001-10-16 18:19:52 +00002138struct cred;
John Hughes4e36a812001-04-18 15:11:51 +00002139#include <sys/nscsys.h>
2140
Roland McGrathd9f816f2004-09-04 03:39:20 +00002141static const struct xlat ssi_cmd [] = {
John Hughes4e36a812001-04-18 15:11:51 +00002142 { SSISYS_BADOP, "SSISYS_BADOP" },
2143 { SSISYS_LDLVL_INIT,"SSISYS_LDLVL_INIT"},
2144 { SSISYS_LDLVL_GETVEC,"SSISYS_LDLVL_GETVEC"},
2145 { SSISYS_LDLVL_PUTVEC,"SSISYS_LDLVL_PUTVEC"},
2146 { SSISYS_LDLVL_PUTRCMDS,"SSISYS_LDLVL_PUTRCMDS"},
2147 { SSISYS_LDLVL_SETREXEC,"SSISYS_LDLVL_SETREXEC"},
2148 { SSISYS_CMS_CLUSTERID,"SSISYS_CMS_CLUSTERID"},
2149 { SSISYS_CFS_STATVFS,"SSISYS_CFS_STATVFS"},
2150 { SSISYS_NODE_GETNUM,"SSISYS_NODE_GETNUM"},
2151 { SSISYS_NODE_TABLE,"SSISYS_NODE_TABLE"},
2152 { SSISYS_NODE_DOWN,"SSISYS_NODE_DOWN"},
2153 { SSISYS_RECLAIM_CHILD,"SSISYS_RECLAIM_CHILD"},
2154 { SSISYS_IPC_GETINFO,"SSISYS_IPC_GETINFO"},
2155 { SSISYS_ICS_TEST,"SSISYS_ICS_TEST"},
2156 { SSISYS_NODE_PID,"SSISYS_NODE_PID"},
2157 { SSISYS_ISLOCAL,"SSISYS_ISLOCAL"},
2158 { SSISYS_CFS_ISSTACKED,"SSISYS_CFS_ISSTACKED"},
2159 { SSISYS_DNET_SYNC,"SSISYS_DNET_SYNC"},
2160 { SSISYS_CFS_WAIT_MODE,"SSISYS_CFS_WAIT_MODE"},
2161 { SSISYS_CFS_UMOUNT,"SSISYS_CFS_UMOUNT"},
2162 { SSISYS_LLSTAT,"SSISYS_LLSTAT" },
2163 { SSISYS_LTS_PERFTEST,"SSISYS_LTS_PERFTEST"},
2164 { SSISYS_LTS_CONFIG,"SSISYS_LTS_CONFIG"},
2165 { SSISYS_SNET_PERFTEST,"SSISYS_SNET_PERFTEST"},
2166 { SSISYS_IGNORE_HALFUP,"SSISYS_IGNORE_HALFUP"},
2167 { SSISYS_NODE_ROOTDEV,"SSISYS_NODE_ROOTDEV"},
2168 { SSISYS_GET_PRIMARY,"SSISYS_GET_PRIMARY"},
2169 { SSISYS_GET_SECONDARY,"SSISYS_GET_SECONDARY"},
2170 { SSISYS_GET_ROOTDISK,"SSISYS_GET_ROOTDISK"},
2171 { SSISYS_CLUSTERNODE_NUM,"SSISYS_CLUSTERNODE_NUM"},
2172 { SSISYS_CLUSTER_MEMBERSHIP,"SSISYS_CLUSTER_MEMBERSHIP"},
2173 { SSISYS_CLUSTER_DETAILEDTRANS,"SSISYS_CLUSTER_DETAILEDTRANS"},
2174 { SSISYS_CLUSTERNODE_INFO,"SSISYS_CLUSTERNODE_INFO"},
2175 { SSISYS_CLUSTERNODE_SETINFO,"SSISYS_CLUSTERNODE_SETINFO"},
2176 { SSISYS_CLUSTERNODE_AVAIL,"SSISYS_CLUSTERNODE_AVAIL"},
2177 { SSISYS_CLUSTER_MAXNODES,"SSISYS_CLUSTER_MAXNODES"},
2178 { SSISYS_SET_MEMPRIO,"SSISYS_SET_MEMPRIO"},
2179 { SSISYS_GET_USERS,"SSISYS_GET_USERS"},
2180 { SSISYS_FORCE_ROOT_NODE,"SSISYS_FORCE_ROOT_NODE"},
2181 { SSISYS_CVIP_SET,"SSISYS_CVIP_SET"},
2182 { SSISYS_CVIP_GET,"SSISYS_CVIP_GET"},
2183 { SSISYS_GET_NODE_COUNTS,"SSISYS_GET_NODE_COUNTS"},
2184 { SSISYS_GET_TRANSPORT,"SSISYS_GET_TRANSPORT"},
2185 { 0, NULL },
2186};
2187
2188int sys_ssisys (tcp)
2189struct tcb *tcp;
2190{
2191 struct ssisys_iovec iov;
John Hughes2d8b2c52001-10-18 14:52:24 +00002192 cls_nodeinfo_args_t cni;
2193 clusternode_info_t info;
2194
John Hughes4e36a812001-04-18 15:11:51 +00002195 if (entering (tcp)) {
John Hughes0aadba42001-10-16 18:19:52 +00002196 ts_reclaim_child_inargs_t trc;
John Hughes4e36a812001-04-18 15:11:51 +00002197 if (tcp->u_arg[1] != sizeof iov ||
2198 umove (tcp, tcp->u_arg[0], &iov) < 0)
2199 {
2200 tprintf ("%#lx, %ld", tcp->u_arg[0], tcp->u_arg[1]);
2201 return 0;
2202 }
2203 tprintf ("{id=");
2204 printxval(ssi_cmd, iov.tio_id.id_cmd, "SSISYS_???");
2205 tprintf (":%d", iov.tio_id.id_ver);
2206 switch (iov.tio_id.id_cmd) {
John Hughes0aadba42001-10-16 18:19:52 +00002207 case SSISYS_RECLAIM_CHILD:
2208 if (iov.tio_udatainlen != sizeof trc ||
2209 umove (tcp, (long) iov.tio_udatain, &trc) < 0)
2210 goto bad;
2211 tprintf (", in={pid=%ld, start=%ld}",
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002212 trc.trc_pid, trc.trc_start);
John Hughes0aadba42001-10-16 18:19:52 +00002213 break;
2214 case SSISYS_CLUSTERNODE_INFO:
2215 if (iov.tio_udatainlen != sizeof cni ||
2216 umove (tcp, (long) iov.tio_udatain, &cni) < 0)
2217 goto bad;
2218 tprintf (", in={node=%ld, len=%d}",
2219 cni.nodenum, cni.info_len);
2220 break;
John Hughes4e36a812001-04-18 15:11:51 +00002221 default:
John Hughes0aadba42001-10-16 18:19:52 +00002222 bad:
John Hughes4e36a812001-04-18 15:11:51 +00002223 if (iov.tio_udatainlen) {
2224 tprintf (", in=[/* %d bytes */]",
2225 iov.tio_udatainlen);
2226 }
2227 }
2228 }
2229 else {
John Hughes2d8b2c52001-10-18 14:52:24 +00002230 if (tcp->u_arg[1] != sizeof iov ||
2231 umove (tcp, tcp->u_arg[0], &iov) < 0)
2232 goto done;
John Hughes4e36a812001-04-18 15:11:51 +00002233 switch (iov.tio_id.id_cmd) {
John Hughes2d8b2c52001-10-18 14:52:24 +00002234 case SSISYS_CLUSTERNODE_INFO:
2235 if (iov.tio_udatainlen != sizeof cni ||
2236 umove (tcp, (long) iov.tio_udatain, &cni) < 0)
2237 goto bad_out;
Roland McGrathced50da2004-08-31 06:48:46 +00002238 if (cni.info_len != sizeof info ||
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002239 iov.tio_udataoutlen != sizeof &info ||
John Hughes2d8b2c52001-10-18 14:52:24 +00002240 umove (tcp, (long) iov.tio_udataout, &info) < 0)
2241 goto bad_out;
2242 tprintf (", out={node=%ld, cpus=%d, online=%d}",
2243 info.node_num, info.node_totalcpus,
2244 info.node_onlinecpus);
2245 break;
Roland McGrathced50da2004-08-31 06:48:46 +00002246
John Hughes4e36a812001-04-18 15:11:51 +00002247 default:
John Hughes2d8b2c52001-10-18 14:52:24 +00002248 bad_out:
John Hughes4e36a812001-04-18 15:11:51 +00002249 if (iov.tio_udataoutlen) {
2250 tprintf (", out=[/* %d bytes */]",
2251 iov.tio_udataoutlen);
2252 }
2253 }
John Hughes2d8b2c52001-10-18 14:52:24 +00002254 done:
John Hughes4e36a812001-04-18 15:11:51 +00002255 tprintf ("}, %ld", tcp->u_arg[1]);
2256 }
2257 return 0;
2258}
2259
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002260#endif
John Hughes4e36a812001-04-18 15:11:51 +00002261
Roland McGrath5ef24ab2004-02-20 02:22:35 +00002262#endif /* UNIXWARE > 2 */
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002263
2264#ifdef MIPS
2265
Wichert Akkermand6b92492001-04-07 21:37:12 +00002266#ifndef __NEW_UTS_LEN
2267#define __NEW_UTS_LEN 64
2268#endif
2269
Roland McGrathd9f816f2004-09-04 03:39:20 +00002270static const struct xlat sysmips_operations[] = {
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002271 { SETNAME, "SETNAME" },
2272 { FLUSH_CACHE, "FLUSH_CACHE" },
2273 { MIPS_FIXADE, "MIPS_FIXADE" },
2274 { MIPS_RDNVRAM, "MIPS_RDNVRAM" },
2275 { MIPS_ATOMIC_SET, "MIPS_ATOMIC_SET" },
2276 { 0, NULL }
2277};
2278
2279int sys_sysmips(tcp)
2280struct tcb *tcp;
2281{
2282 if (entering(tcp)) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002283 printxval(sysmips_operations, tcp->u_arg[0], "???");
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002284 if (!verbose(tcp)) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002285 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002286 } else if (tcp->u_arg[0]==SETNAME) {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002287 char nodename[__NEW_UTS_LEN + 1];
2288 if (umovestr(tcp, tcp->u_arg[1], (__NEW_UTS_LEN + 1), nodename) < 0)
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002289 tprintf(", %#lx", tcp->u_arg[1]);
2290 else
2291 tprintf(", \"%s\"", nodename);
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002292 } else if (tcp->u_arg[0] == MIPS_ATOMIC_SET) {
2293 tprintf(", %#lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
2294 } else if (tcp->u_arg[0] == MIPS_FIXADE) {
2295 tprintf(", 0x%lx", tcp->u_arg[1]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002296 } else {
Wichert Akkerman3472dd52001-04-10 10:27:52 +00002297 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
Wichert Akkerman0cbfb322001-02-19 13:35:53 +00002298 }
2299 }
2300
2301 return 0;
2302}
2303
2304#endif /* MIPS */