]> granicus.if.org Git - strace/blob - system.c
update config.guess
[strace] / system.c
1 /*
2  * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3  * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4  * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
5  * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. The name of the author may not be used to endorse or promote products
17  *    derived from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  *
30  *      $Id$
31  */
32
33 #include "defs.h"
34
35 #ifdef LINUX
36 #define _LINUX_SOCKET_H
37 #define _LINUX_FS_H
38
39 #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
46 #include <sys/socket.h>
47 #include <netinet/in.h>
48 #include <arpa/inet.h>
49
50 #include <sys/syscall.h>
51
52 #ifdef SYS_personality
53 /* Workaround for kernel namespace pollution. */
54 #define _LINUX_PTRACE_H
55 /* Yuck yuck yuck.  We can't include linux/ptrace.h, but personality.h
56    makes a declaration with struct pt_regs, which is defined there. */
57 struct pt_regs;
58 #define sys_personality kernel_sys_personality
59 #include <linux/personality.h>
60 #undef sys_personality
61 #endif /* SYS_personality */
62
63 #ifdef SYS_capget
64 #include <linux/capability.h>
65 #endif
66
67 #ifdef SYS_cacheflush
68 #include <asm/cachectl.h>
69 #endif
70
71 #include <linux/sysctl.h>
72
73 static struct xlat mount_flags[] = {
74         { MS_RDONLY,    "MS_RDONLY"     },
75         { MS_NOSUID,    "MS_NOSUID"     },
76         { MS_NODEV,     "MS_NODEV"      },
77         { MS_NOEXEC,    "MS_NOEXEC"     },
78 #ifdef MS_SYNCHRONOUS
79         { MS_SYNCHRONOUS,"MS_SYNCHRONOUS"},
80 #else
81         { MS_SYNC,      "MS_SYNC"       },
82 #endif
83         { MS_REMOUNT,   "MS_REMOUNT"    },
84         { 0,            NULL            },
85 };
86
87 int
88 sys_mount(tcp)
89 struct tcb *tcp;
90 {
91         if (entering(tcp)) {
92                 printpath(tcp, tcp->u_arg[0]);
93                 tprintf(", ");
94                 printpath(tcp, tcp->u_arg[1]);
95                 tprintf(", ");
96                 printpath(tcp, tcp->u_arg[2]);
97                 tprintf(", ");
98                 printflags(mount_flags, tcp->u_arg[3]);
99                 tprintf(", %#lx", tcp->u_arg[4]);
100         }
101         return 0;
102 }
103
104 int
105 sys_umount2(tcp)
106 struct tcb *tcp;
107 {
108         if (entering(tcp)) {
109                 printstr(tcp, tcp->u_arg[0], -1);
110                 tprintf(", ");
111                 if (tcp->u_arg[1] & 1)
112                         tprintf("MNT_FORCE");
113                 else
114                         tprintf("0");
115         }
116         return 0;
117 }
118
119 static struct xlat personality_options[] = {
120 #ifdef PER_LINUX
121         { PER_LINUX,    "PER_LINUX"     },
122 #endif
123 #ifdef PER_LINUX_32BIT
124         { PER_LINUX_32BIT,      "PER_LINUX"     },
125 #endif
126 #ifdef PER_SVR4
127         { PER_SVR4,     "PER_SVR4"      },
128 #endif
129 #ifdef PER_SVR3
130         { PER_SVR3,     "PER_SVR3"      },
131 #endif
132 #ifdef PER_SCOSVR3
133         { PER_SCOSVR3,  "PER_SCOSVR3"   },
134 #endif
135 #ifdef PER_WYSEV386
136         { PER_WYSEV386, "PER_WYSEV386"  },
137 #endif
138 #ifdef PER_ISCR4
139         { PER_ISCR4,    "PER_ISCR4"     },
140 #endif
141 #ifdef PER_BSD
142         { PER_BSD,      "PER_BSD"       },
143 #endif
144 #ifdef PER_XENIX
145         { PER_XENIX,    "PER_XENIX"     },
146 #endif
147         { 0,            NULL            },
148 };
149
150 int
151 sys_personality(tcp)
152 struct tcb *tcp;
153 {
154         if (entering(tcp))
155                 printxval(personality_options, tcp->u_arg[0], "PER_???");
156         return 0;
157 }
158
159 #include <linux/reboot.h>
160 static struct xlat bootflags1[] = {
161         { LINUX_REBOOT_MAGIC1,  "LINUX_REBOOT_MAGIC1"   },
162         { 0,                    NULL                    },
163 };
164
165 static struct xlat bootflags2[] = {
166         { LINUX_REBOOT_MAGIC2,  "LINUX_REBOOT_MAGIC2"   },
167         { LINUX_REBOOT_MAGIC2A, "LINUX_REBOOT_MAGIC2A"  },
168         { LINUX_REBOOT_MAGIC2B, "LINUX_REBOOT_MAGIC2B"  },
169         { 0,                    NULL                    },
170 };
171
172 static struct xlat bootflags3[] = {
173         { LINUX_REBOOT_CMD_CAD_OFF,     "LINUX_REBOOT_CMD_CAD_OFF"      },
174         { LINUX_REBOOT_CMD_RESTART,     "LINUX_REBOOT_CMD_RESTART"      },
175         { LINUX_REBOOT_CMD_HALT,        "LINUX_REBOOT_CMD_HALT"         },
176         { LINUX_REBOOT_CMD_CAD_ON,      "LINUX_REBOOT_CMD_CAD_ON"       },
177         { LINUX_REBOOT_CMD_POWER_OFF,   "LINUX_REBOOT_CMD_POWER_OFF"    },
178         { LINUX_REBOOT_CMD_RESTART2,    "LINUX_REBOOT_CMD_RESTART2"     },
179         { 0,                            NULL                            },
180 };
181
182 int
183 sys_reboot(tcp)
184 struct tcb *tcp;
185 {
186         if (entering(tcp)) {
187                 if (!printflags(bootflags1, tcp->u_arg[0]))
188                         tprintf("LINUX_REBOOT_MAGIC???");
189                 tprintf(", ");
190                 if (!printflags(bootflags2, tcp->u_arg[1]))
191                         tprintf("LINUX_REBOOT_MAGIC???");
192                 tprintf(", ");
193                 if (!printflags(bootflags3, tcp->u_arg[2]))
194                         tprintf("LINUX_REBOOT_CMD_???");
195                 if (tcp->u_arg[2] == LINUX_REBOOT_CMD_RESTART2) {
196                         tprintf(", ");
197                         printstr(tcp, tcp->u_arg[3], -1);
198                 }
199         }
200         return 0;
201 }
202
203 #ifdef M68K
204 static struct xlat cacheflush_scope[] = {
205 #ifdef FLUSH_SCOPE_LINE
206         { FLUSH_SCOPE_LINE,     "FLUSH_SCOPE_LINE" },
207 #endif
208 #ifdef FLUSH_SCOPE_PAGE
209         { FLUSH_SCOPE_PAGE,     "FLUSH_SCOPE_PAGE" },
210 #endif
211 #ifdef FLUSH_SCOPE_ALL
212         { FLUSH_SCOPE_ALL,      "FLUSH_SCOPE_ALL" },
213 #endif
214         { 0,                    NULL },
215 };
216
217 static struct xlat cacheflush_flags[] = {
218 #ifdef FLUSH_CACHE_BOTH
219         { FLUSH_CACHE_BOTH,     "FLUSH_CACHE_BOTH" },
220 #endif
221 #ifdef FLUSH_CACHE_DATA
222         { FLUSH_CACHE_DATA,     "FLUSH_CACHE_DATA" },
223 #endif
224 #ifdef FLUSH_CACHE_INSN
225         { FLUSH_CACHE_INSN,     "FLUSH_CACHE_INSN" },
226 #endif
227         { 0,                    NULL },
228 };
229
230 int
231 sys_cacheflush(tcp)
232 struct tcb *tcp;
233 {
234         if (entering(tcp)) {
235                 /* addr */
236                 tprintf("%#lx, ", tcp->u_arg[0]);
237                 /* scope */
238                 printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
239                 tprintf(", ");
240                 /* flags */
241                 printflags(cacheflush_flags, tcp->u_arg[2]);
242                 /* len */
243                 tprintf(", %lu", tcp->u_arg[3]);
244         }
245         return 0;
246 }
247 #endif /* M68K */
248
249 #endif /* LINUX */
250
251 #ifdef SUNOS4
252
253 #include <sys/reboot.h>
254 #define NFSCLIENT
255 #define LOFS
256 #define RFS
257 #define PCFS
258 #include <sys/mount.h>
259 #include <sys/socket.h>
260 #include <nfs/export.h>
261 #include <rpc/types.h>
262 #include <rpc/auth.h>
263
264 /*ARGSUSED*/
265 int
266 sys_sync(tcp)
267 struct tcb *tcp;
268 {
269         return 0;
270 }
271
272 static struct xlat bootflags[] = {
273         { RB_AUTOBOOT,  "RB_AUTOBOOT"   },      /* for system auto-booting itself */
274         { RB_ASKNAME,   "RB_ASKNAME"    },      /* ask for file name to reboot from */
275         { RB_SINGLE,    "RB_SINGLE"     },      /* reboot to single user only */
276         { RB_NOSYNC,    "RB_NOSYNC"     },      /* dont sync before reboot */
277         { RB_HALT,      "RB_HALT"       },      /* don't reboot, just halt */
278         { RB_INITNAME,  "RB_INITNAME"   },      /* name given for /etc/init */
279         { RB_NOBOOTRC,  "RB_NOBOOTRC"   },      /* don't run /etc/rc.boot */
280         { RB_DEBUG,     "RB_DEBUG"      },      /* being run under debugger */
281         { RB_DUMP,      "RB_DUMP"       },      /* dump system core */
282         { RB_WRITABLE,  "RB_WRITABLE"   },      /* mount root read/write */
283         { RB_STRING,    "RB_STRING"     },      /* pass boot args to prom monitor */
284         { 0,            NULL            },
285 };
286
287 int
288 sys_reboot(tcp)
289 struct tcb *tcp;
290 {
291         if (entering(tcp)) {
292                 if (!printflags(bootflags, tcp->u_arg[0]))
293                         tprintf("RB_???");
294                 if (tcp->u_arg[0] & RB_STRING) {
295                         printstr(tcp, tcp->u_arg[1], -1);
296                 }
297         }
298         return 0;
299 }
300
301 int
302 sys_sysacct(tcp)
303 struct tcb *tcp;
304 {
305         if (entering(tcp)) {
306                 printstr(tcp, tcp->u_arg[0], -1);
307         }
308         return 0;
309 }
310
311 int
312 sys_swapon(tcp)
313 struct tcb *tcp;
314 {
315         if (entering(tcp)) {
316                 printstr(tcp, tcp->u_arg[0], -1);
317         }
318         return 0;
319 }
320
321 int
322 sys_nfs_svc(tcp)
323 struct tcb *tcp;
324 {
325         if (entering(tcp)) {
326                 printsock(tcp, tcp->u_arg[0]);
327         }
328         return 0;
329 }
330
331 static struct xlat mountflags[] = {
332         { M_RDONLY,     "M_RDONLY"      },
333         { M_NOSUID,     "M_NOSUID"      },
334         { M_NEWTYPE,    "M_NEWTYPE"     },
335         { M_GRPID,      "M_GRPID"       },
336 #ifdef  M_REMOUNT
337         { M_REMOUNT,    "M_REMOUNT"     },
338 #endif
339 #ifdef  M_NOSUB
340         { M_NOSUB,      "M_NOSUB"       },
341 #endif
342 #ifdef  M_MULTI
343         { M_MULTI,      "M_MULTI"       },
344 #endif
345 #ifdef  M_SYS5
346         { M_SYS5,       "M_SYS5"        },
347 #endif
348         { 0,            NULL            },
349 };
350
351 static struct xlat nfsflags[] = {
352         { NFSMNT_SOFT,          "NFSMNT_SOFT"           },
353         { NFSMNT_WSIZE,         "NFSMNT_WSIZE"          },
354         { NFSMNT_RSIZE,         "NFSMNT_RSIZE"          },
355         { NFSMNT_TIMEO,         "NFSMNT_TIMEO"          },
356         { NFSMNT_RETRANS,       "NFSMNT_RETRANS"        },
357         { NFSMNT_HOSTNAME,      "NFSMNT_HOSTNAME"       },
358         { NFSMNT_INT,           "NFSMNT_INT"            },
359         { NFSMNT_NOAC,          "NFSMNT_NOAC"           },
360         { NFSMNT_ACREGMIN,      "NFSMNT_ACREGMIN"       },
361         { NFSMNT_ACREGMAX,      "NFSMNT_ACREGMAX"       },
362         { NFSMNT_ACDIRMIN,      "NFSMNT_ACDIRMIN"       },
363         { NFSMNT_ACDIRMAX,      "NFSMNT_ACDIRMAX"       },
364 #ifdef  NFSMNT_SECURE
365         { NFSMNT_SECURE,        "NFSMNT_SECURE"         },
366 #endif
367 #ifdef  NFSMNT_NOCTO
368         { NFSMNT_NOCTO,         "NFSMNT_NOCTO"          },
369 #endif
370 #ifdef  NFSMNT_POSIX
371         { NFSMNT_POSIX,         "NFSMNT_POSIX"          },
372 #endif
373         { 0,                    NULL                    },
374 };
375
376 int
377 sys_mount(tcp)
378 struct tcb *tcp;
379 {
380         char type[4];
381
382         if (entering(tcp)) {
383                 if (!(tcp->u_arg[2] & M_NEWTYPE) || umovestr(tcp,
384                                 tcp->u_arg[0],  sizeof type, type) < 0) {
385                         tprintf("OLDTYPE:#%lx", tcp->u_arg[0]);
386                 } else {
387                         tprintf("\"%s\", ", type);
388                 }
389                 printstr(tcp, tcp->u_arg[1], -1);
390                 tprintf(", ");
391                 if (!printflags(mountflags, tcp->u_arg[2] & ~M_NEWTYPE))
392                         tprintf("0");
393                 tprintf(", ");
394
395                 if (strcmp(type, "4.2") == 0) {
396                         struct ufs_args a;
397                         if (umove(tcp, tcp->u_arg[3], &a) < 0)
398                                 return 0;
399                         printstr(tcp, (int)a.fspec, -1);
400                 } else if (strcmp(type, "lo") == 0) {
401                         struct lo_args a;
402                         if (umove(tcp, tcp->u_arg[3], &a) < 0)
403                                 return 0;
404                         printstr(tcp, (int)a.fsdir, -1);
405                 } else if (strcmp(type, "nfs") == 0) {
406                         struct nfs_args a;
407                         if (umove(tcp, tcp->u_arg[3], &a) < 0)
408                                 return 0;
409                         tprintf("[");
410                         printsock(tcp, (int) a.addr);
411                         tprintf(", ");
412                         if (!printflags(nfsflags, a.flags))
413                                 tprintf("NFSMNT_???");
414                         tprintf(", ws:%u,rs:%u,to:%u,re:%u,",
415                                 a.wsize, a.rsize, a.timeo, a.retrans);
416                         if (a.flags & NFSMNT_HOSTNAME && a.hostname)
417                                 printstr(tcp, (int)a.hostname, -1);
418                         else
419                                 tprintf("%#lx", (unsigned long) a.hostname);
420                         tprintf(",reg-min:%u,max:%u,dir-min:%u,max:%u,",
421                                 a.acregmin, a.acregmax, a.acdirmin, a.acdirmax);
422                         if ((a.flags & NFSMNT_SECURE) && a.netname)
423                                 printstr(tcp, (int) a.netname, -1);
424                         else
425                                 tprintf("%#lx", (unsigned long) a.netname);
426                         tprintf("]");
427                 } else if (strcmp(type, "rfs") == 0) {
428                         struct rfs_args a;
429                         struct token t;
430                         if (umove(tcp, tcp->u_arg[3], &a) < 0)
431                                 return 0;
432                         tprintf("[");
433                         printstr(tcp, (int)a.rmtfs, -1);
434                         if (umove(tcp, (int)a.token, &t) < 0)
435                                 return 0;
436                         tprintf(", %u, %s]", t.t_id, t.t_uname);
437                 } else if (strcmp(type, "pcfs") == 0) {
438                         struct pc_args a;
439                         if (umove(tcp, tcp->u_arg[3], &a) < 0)
440                                 return 0;
441                         printstr(tcp, (int)a.fspec, -1);
442                 }
443         }
444         return 0;
445 }
446
447 int
448 sys_unmount(tcp)
449 struct tcb *tcp;
450 {
451         if (entering(tcp)) {
452                 printstr(tcp, tcp->u_arg[0], -1);
453         }
454         return 0;
455 }
456
457 int
458 sys_umount(tcp)
459 struct tcb *tcp;
460 {
461         return sys_unmount(tcp);
462 }
463
464 int
465 sys_auditsys(tcp)
466 struct tcb *tcp;
467 {
468         /* XXX - no information available */
469         return printargs(tcp);
470 }
471
472 static struct xlat ex_auth_flags[] = {
473         { AUTH_UNIX,    "AUTH_UNIX"     },
474         { AUTH_DES,     "AUTH_DES"      },
475         { 0,            NULL            },
476 };
477
478 int
479 sys_exportfs(tcp)
480 struct tcb *tcp;
481 {
482         struct export e;
483         int i;
484
485         if (entering(tcp)) {
486                 printstr(tcp, tcp->u_arg[0], -1);
487                 if (umove(tcp, tcp->u_arg[1], &e) < 0) {
488                         tprintf("%#lx", tcp->u_arg[1]);
489                         return 0;
490                 }
491                 tprintf("{fl:%u, anon:%u, ", e.ex_flags, e.ex_anon);
492                 printxval(ex_auth_flags, e.ex_auth, "AUTH_???");
493                 tprintf(", roots:[");
494                 if (e.ex_auth == AUTH_UNIX) {
495                         for (i=0; i<e.ex_u.exunix.rootaddrs.naddrs; i++) {
496                                 printsock(tcp,
497                                         (int)&e.ex_u.exunix.rootaddrs.addrvec[i]);
498                         }
499                         tprintf("], writers:[");
500                         for (i=0; i<e.ex_writeaddrs.naddrs; i++) {
501                                 printsock(tcp,
502                                         (int)&e.ex_writeaddrs.addrvec[i]);
503                         }
504                         tprintf("]");
505                 } else {
506                         for (i=0; i<e.ex_u.exdes.nnames; i++) {
507                                 printsock(tcp,
508                                         (int)&e.ex_u.exdes.rootnames[i]);
509                                 tprintf(", ");
510                         }
511                         tprintf("], window:%u", e.ex_u.exdes.window);
512                 }
513                 tprintf("}");
514         }
515         return 0;
516 }
517
518 static struct xlat sysconflimits[] = {
519 #ifdef  _SC_ARG_MAX
520         { _SC_ARG_MAX,  "_SC_ARG_MAX"   },      /* space for argv & envp */
521 #endif
522 #ifdef  _SC_CHILD_MAX
523         { _SC_CHILD_MAX,        "_SC_CHILD_MAX" },      /* maximum children per process??? */
524 #endif
525 #ifdef  _SC_CLK_TCK
526         { _SC_CLK_TCK,  "_SC_CLK_TCK"   },      /* clock ticks/sec */
527 #endif
528 #ifdef  _SC_NGROUPS_MAX
529         { _SC_NGROUPS_MAX,      "_SC_NGROUPS_MAX"       },      /* number of groups if multple supp. */
530 #endif
531 #ifdef  _SC_OPEN_MAX
532         { _SC_OPEN_MAX, "_SC_OPEN_MAX"  },      /* max open files per process */
533 #endif
534 #ifdef  _SC_JOB_CONTROL
535         { _SC_JOB_CONTROL,      "_SC_JOB_CONTROL"       },      /* do we have job control */
536 #endif
537 #ifdef  _SC_SAVED_IDS
538         { _SC_SAVED_IDS,        "_SC_SAVED_IDS" },      /* do we have saved uid/gids */
539 #endif
540 #ifdef  _SC_VERSION
541         { _SC_VERSION,  "_SC_VERSION"   },      /* POSIX version supported */
542 #endif
543         { 0,            NULL            },
544 };
545
546 int
547 sys_sysconf(tcp)
548 struct tcb *tcp;
549 {
550         if (entering(tcp)) {
551                 printxval(sysconflimits, tcp->u_arg[0], "_SC_???");
552         }
553         return 0;
554 }
555
556 #endif /* SUNOS4 */
557
558 #if defined(SUNOS4) || defined(FREEBSD)
559 static struct xlat pathconflimits[] = {
560 #ifdef  _PC_LINK_MAX
561         { _PC_LINK_MAX, "_PC_LINK_MAX"  },      /* max links to file/dir */
562 #endif
563 #ifdef  _PC_MAX_CANON
564         { _PC_MAX_CANON,        "_PC_MAX_CANON" },      /* max line length */
565 #endif
566 #ifdef  _PC_MAX_INPUT
567         { _PC_MAX_INPUT,        "_PC_MAX_INPUT" },      /* max "packet" to a tty device */
568 #endif
569 #ifdef  _PC_NAME_MAX
570         { _PC_NAME_MAX, "_PC_NAME_MAX"  },      /* max pathname component length */
571 #endif
572 #ifdef  _PC_PATH_MAX
573         { _PC_PATH_MAX, "_PC_PATH_MAX"  },      /* max pathname length */
574 #endif
575 #ifdef  _PC_PIPE_BUF
576         { _PC_PIPE_BUF, "_PC_PIPE_BUF"  },      /* size of a pipe */
577 #endif
578 #ifdef  _PC_CHOWN_RESTRICTED
579         { _PC_CHOWN_RESTRICTED, "_PC_CHOWN_RESTRICTED"  },      /* can we give away files */
580 #endif
581 #ifdef  _PC_NO_TRUNC
582         { _PC_NO_TRUNC, "_PC_NO_TRUNC"  },      /* trunc or error on >NAME_MAX */
583 #endif
584 #ifdef  _PC_VDISABLE
585         { _PC_VDISABLE, "_PC_VDISABLE"  },      /* best char to shut off tty c_cc */
586 #endif
587         { 0,            NULL            },
588 };
589
590
591 int
592 sys_pathconf(tcp)
593 struct tcb *tcp;
594 {
595         if (entering(tcp)) {
596                 printstr(tcp, tcp->u_arg[0], -1);
597                 tprintf(", ");
598                 printxval(pathconflimits, tcp->u_arg[1], "_PC_???");
599         }
600         return 0;
601 }
602
603 int
604 sys_fpathconf(tcp)
605 struct tcb *tcp;
606 {
607         if (entering(tcp)) {
608                 tprintf("%lu, ", tcp->u_arg[0]);
609                 printxval(pathconflimits, tcp->u_arg[1], "_PC_???");
610         }
611         return 0;
612 }
613
614 #endif /* SUNOS4 || FREEBSD */
615
616 #ifdef SVR4
617
618 #ifdef HAVE_SYS_SYSCONFIG_H
619 #include <sys/sysconfig.h>
620 #endif /* HAVE_SYS_SYSCONFIG_H */
621
622 #include <sys/mount.h>
623 #include <sys/systeminfo.h>
624 #include <sys/utsname.h>
625
626 static struct xlat sysconfig_options[] = {
627 #ifdef _CONFIG_NGROUPS
628         { _CONFIG_NGROUPS,              "_CONFIG_NGROUPS"               },
629 #endif
630 #ifdef _CONFIG_CHILD_MAX
631         { _CONFIG_CHILD_MAX,            "_CONFIG_CHILD_MAX"             },
632 #endif
633 #ifdef _CONFIG_OPEN_FILES
634         { _CONFIG_OPEN_FILES,           "_CONFIG_OPEN_FILES"            },
635 #endif
636 #ifdef _CONFIG_POSIX_VER
637         { _CONFIG_POSIX_VER,            "_CONFIG_POSIX_VER"             },
638 #endif
639 #ifdef _CONFIG_PAGESIZE
640         { _CONFIG_PAGESIZE,             "_CONFIG_PAGESIZE"              },
641 #endif
642 #ifdef _CONFIG_CLK_TCK
643         { _CONFIG_CLK_TCK,              "_CONFIG_CLK_TCK"               },
644 #endif
645 #ifdef _CONFIG_XOPEN_VER
646         { _CONFIG_XOPEN_VER,            "_CONFIG_XOPEN_VER"             },
647 #endif
648 #ifdef _CONFIG_PROF_TCK
649         { _CONFIG_PROF_TCK,             "_CONFIG_PROF_TCK"              },
650 #endif
651 #ifdef _CONFIG_NPROC_CONF
652         { _CONFIG_NPROC_CONF,           "_CONFIG_NPROC_CONF"            },
653 #endif
654 #ifdef _CONFIG_NPROC_ONLN
655         { _CONFIG_NPROC_ONLN,           "_CONFIG_NPROC_ONLN"            },
656 #endif
657 #ifdef _CONFIG_AIO_LISTIO_MAX
658         { _CONFIG_AIO_LISTIO_MAX,       "_CONFIG_AIO_LISTIO_MAX"        },
659 #endif
660 #ifdef _CONFIG_AIO_MAX
661         { _CONFIG_AIO_MAX,              "_CONFIG_AIO_MAX"               },
662 #endif
663 #ifdef _CONFIG_AIO_PRIO_DELTA_MAX
664         { _CONFIG_AIO_PRIO_DELTA_MAX,   "_CONFIG_AIO_PRIO_DELTA_MAX"    },
665 #endif
666 #ifdef _CONFIG_CONFIG_DELAYTIMER_MAX
667         { _CONFIG_DELAYTIMER_MAX,       "_CONFIG_DELAYTIMER_MAX"        },
668 #endif
669 #ifdef _CONFIG_MQ_OPEN_MAX
670         { _CONFIG_MQ_OPEN_MAX,          "_CONFIG_MQ_OPEN_MAX"           },
671 #endif
672 #ifdef _CONFIG_MQ_PRIO_MAX
673         { _CONFIG_MQ_PRIO_MAX,          "_CONFIG_MQ_PRIO_MAX"           },
674 #endif
675 #ifdef _CONFIG_RTSIG_MAX
676         { _CONFIG_RTSIG_MAX,            "_CONFIG_RTSIG_MAX"             },
677 #endif
678 #ifdef _CONFIG_SEM_NSEMS_MAX
679         { _CONFIG_SEM_NSEMS_MAX,        "_CONFIG_SEM_NSEMS_MAX"         },
680 #endif
681 #ifdef _CONFIG_SEM_VALUE_MAX
682         { _CONFIG_SEM_VALUE_MAX,        "_CONFIG_SEM_VALUE_MAX"         },
683 #endif
684 #ifdef _CONFIG_SIGQUEUE_MAX
685         { _CONFIG_SIGQUEUE_MAX,         "_CONFIG_SIGQUEUE_MAX"          },
686 #endif
687 #ifdef _CONFIG_SIGRT_MIN
688         { _CONFIG_SIGRT_MIN,            "_CONFIG_SIGRT_MIN"             },
689 #endif
690 #ifdef _CONFIG_SIGRT_MAX
691         { _CONFIG_SIGRT_MAX,            "_CONFIG_SIGRT_MAX"             },
692 #endif
693 #ifdef _CONFIG_TIMER_MAX
694         { _CONFIG_TIMER_MAX,            "_CONFIG_TIMER_MAX"             },
695 #endif
696 #ifdef _CONFIG_CONFIG_PHYS_PAGES
697         { _CONFIG_PHYS_PAGES,           "_CONFIG_PHYS_PAGES"            },
698 #endif
699 #ifdef _CONFIG_AVPHYS_PAGES
700         { _CONFIG_AVPHYS_PAGES,         "_CONFIG_AVPHYS_PAGES"          },
701 #endif
702         { 0,                            NULL                            },
703 };
704
705 int
706 sys_sysconfig(tcp)
707 struct tcb *tcp;
708 {
709         if (entering(tcp))
710                 printxval(sysconfig_options, tcp->u_arg[0], "_CONFIG_???");
711         return 0;
712 }
713
714 static struct xlat sysinfo_options[] = {
715         { SI_SYSNAME,           "SI_SYSNAME"            },
716         { SI_HOSTNAME,          "SI_HOSTNAME"           },
717         { SI_RELEASE,           "SI_RELEASE"            },
718         { SI_VERSION,           "SI_VERSION"            },
719         { SI_MACHINE,           "SI_MACHINE"            },
720         { SI_ARCHITECTURE,      "SI_ARCHITECTURE"       },
721         { SI_HW_SERIAL,         "SI_HW_SERIAL"          },
722         { SI_HW_PROVIDER,       "SI_HW_PROVIDER"        },
723         { SI_SRPC_DOMAIN,       "SI_SRPC_DOMAIN"        },
724 #ifdef SI_SET_HOSTNAME
725         { SI_SET_HOSTNAME,      "SI_SET_HOSTNAME"       },
726 #endif
727 #ifdef SI_SET_SRPC_DOMAIN
728         { SI_SET_SRPC_DOMAIN,   "SI_SET_SRPC_DOMAIN"    },
729 #endif
730 #ifdef SI_SET_KERB_REALM
731         { SI_SET_KERB_REALM,    "SI_SET_KERB_REALM"     },
732 #endif
733 #ifdef  SI_KERB_REALM
734         { SI_KERB_REALM,        "SI_KERB_REALM"         },
735 #endif
736         { 0,                    NULL                    },
737 };
738
739 int
740 sys_sysinfo(tcp)
741 struct tcb *tcp;
742 {
743         if (entering(tcp)) {
744                 printxval(sysinfo_options, tcp->u_arg[0], "SI_???");
745                 tprintf(", ");
746         }
747         else {
748                 /* Technically some calls write values.  So what. */
749                 if (syserror(tcp))
750                         tprintf("%#lx", tcp->u_arg[1]);
751                 else
752                         printpath(tcp, tcp->u_arg[1]);
753                 tprintf(", %lu", tcp->u_arg[2]);
754         }
755         return 0;
756 }
757
758 #ifdef MIPS
759
760 #include <sys/syssgi.h>
761
762 static struct xlat syssgi_options[] = {
763         { SGI_SYSID,            "SGI_SYSID"             },
764 #ifdef SGI_RDUBLK
765         { SGI_RDUBLK,           "SGI_RDUBLK"            },
766 #endif
767         { SGI_TUNE,             "SGI_TUNE"              },
768         { SGI_IDBG,             "SGI_IDBG"              },
769         { SGI_INVENT,           "SGI_INVENT"            },
770         { SGI_RDNAME,           "SGI_RDNAME"            },
771         { SGI_SETLED,           "SGI_SETLED"            },
772         { SGI_SETNVRAM,         "SGI_SETNVRAM"          },
773         { SGI_GETNVRAM,         "SGI_GETNVRAM"          },
774         { SGI_QUERY_FTIMER,     "SGI_QUERY_FTIMER"      },
775         { SGI_QUERY_CYCLECNTR,  "SGI_QUERY_CYCLECNTR"   },
776         { SGI_PROCSZ,           "SGI_PROCSZ"            },
777         { SGI_SIGACTION,        "SGI_SIGACTION"         },
778         { SGI_SIGPENDING,       "SGI_SIGPENDING"        },
779         { SGI_SIGPROCMASK,      "SGI_SIGPROCMASK"       },
780         { SGI_SIGSUSPEND,       "SGI_SIGSUSPEND"        },
781         { SGI_SETSID,           "SGI_SETSID"            },
782         { SGI_SETPGID,          "SGI_SETPGID"           },
783         { SGI_SYSCONF,          "SGI_SYSCONF"           },
784         { SGI_WAIT4,            "SGI_WAIT4"             },
785         { SGI_PATHCONF,         "SGI_PATHCONF"          },
786         { SGI_READB,            "SGI_READB"             },
787         { SGI_WRITEB,           "SGI_WRITEB"            },
788         { SGI_SETGROUPS,        "SGI_SETGROUPS"         },
789         { SGI_GETGROUPS,        "SGI_GETGROUPS"         },
790         { SGI_SETTIMEOFDAY,     "SGI_SETTIMEOFDAY"      },
791         { SGI_SETTIMETRIM,      "SGI_SETTIMETRIM"       },
792         { SGI_GETTIMETRIM,      "SGI_GETTIMETRIM"       },
793         { SGI_SPROFIL,          "SGI_SPROFIL"           },
794         { SGI_RUSAGE,           "SGI_RUSAGE"            },
795         { SGI_SIGSTACK,         "SGI_SIGSTACK"          },
796         { SGI_SIGSTATUS,        "SGI_SIGSTATUS"         },
797         { SGI_NETPROC,          "SGI_NETPROC"           },
798         { SGI_SIGALTSTACK,      "SGI_SIGALTSTACK"       },
799         { SGI_BDFLUSHCNT,       "SGI_BDFLUSHCNT"        },
800         { SGI_SSYNC,            "SGI_SSYNC"             },
801         { SGI_NFSCNVT,          "SGI_NFSCNVT"           },
802         { SGI_GETPGID,          "SGI_GETPGID"           },
803         { SGI_GETSID,           "SGI_GETSID"            },
804         { SGI_IOPROBE,          "SGI_IOPROBE"           },
805         { SGI_CONFIG,           "SGI_CONFIG"            },
806         { SGI_ELFMAP,           "SGI_ELFMAP"            },
807         { SGI_MCONFIG,          "SGI_MCONFIG"           },
808         { SGI_GETPLABEL,        "SGI_GETPLABEL"         },
809         { SGI_SETPLABEL,        "SGI_SETPLABEL"         },
810         { SGI_GETLABEL,         "SGI_GETLABEL"          },
811         { SGI_SETLABEL,         "SGI_SETLABEL"          },
812         { SGI_SATREAD,          "SGI_SATREAD"           },
813         { SGI_SATWRITE,         "SGI_SATWRITE"          },
814         { SGI_SATCTL,           "SGI_SATCTL"            },
815         { SGI_LOADATTR,         "SGI_LOADATTR"          },
816         { SGI_UNLOADATTR,       "SGI_UNLOADATTR"        },
817 #ifdef SGI_RECVLMSG
818         { SGI_RECVLMSG,         "SGI_RECVLMSG"          },
819 #endif
820         { SGI_PLANGMOUNT,       "SGI_PLANGMOUNT"        },
821         { SGI_GETPSOACL,        "SGI_GETPSOACL"         },
822         { SGI_SETPSOACL,        "SGI_SETPSOACL"         },
823 #ifdef SGI_EAG_GET_ATTR
824         { SGI_EAG_GET_ATTR,     "SGI_EAG_GET_ATTR"      },
825 #endif
826 #ifdef SGI_EAG_SET_ATTR
827         { SGI_EAG_SET_ATTR,     "SGI_EAG_SET_ATTR"      },
828 #endif
829 #ifdef SGI_EAG_GET_PROCATTR
830         { SGI_EAG_GET_PROCATTR, "SGI_EAG_GET_PROCATTR"  },
831 #endif
832 #ifdef SGI_EAG_SET_PROCATTR
833         { SGI_EAG_SET_PROCATTR, "SGI_EAG_SET_PROCATTR"  },
834 #endif
835 #ifdef SGI_FREVOKE
836         { SGI_FREVOKE,          "SGI_FREVOKE"           },
837 #endif
838 #ifdef SGI_SBE_GET_INFO
839         { SGI_SBE_GET_INFO,     "SGI_SBE_GET_INFO"      },
840 #endif
841 #ifdef SGI_SBE_CLR_INFO
842         { SGI_SBE_CLR_INFO,     "SGI_SBE_CLR_INFO"      },
843 #endif
844         { SGI_RMI_FIXECC,       "SGI_RMI_FIXECC"        },
845         { SGI_R4K_CERRS,        "SGI_R4K_CERRS"         },
846         { SGI_GET_EVCONF,       "SGI_GET_EVCONF"        },
847         { SGI_MPCWAROFF,        "SGI_MPCWAROFF"         },
848         { SGI_SET_AUTOPWRON,    "SGI_SET_AUTOPWRON"     },
849         { SGI_SPIPE,            "SGI_SPIPE"             },
850         { SGI_SYMTAB,           "SGI_SYMTAB"            },
851 #ifdef SGI_SET_FPDEBUG
852         { SGI_SET_FPDEBUG,      "SGI_SET_FPDEBUG"       },
853 #endif
854 #ifdef SGI_SET_FP_PRECISE
855         { SGI_SET_FP_PRECISE,   "SGI_SET_FP_PRECISE"    },
856 #endif
857         { SGI_TOSSTSAVE,        "SGI_TOSSTSAVE"         },
858         { SGI_FDHI,             "SGI_FDHI"              },
859 #ifdef SGI_SET_CONFIG_SMM
860         { SGI_SET_CONFIG_SMM,   "SGI_SET_CONFIG_SMM"    },
861 #endif
862 #ifdef SGI_SET_FP_PRESERVE
863         { SGI_SET_FP_PRESERVE,  "SGI_SET_FP_PRESERVE"   },
864 #endif
865         { SGI_MINRSS,           "SGI_MINRSS"            },
866 #ifdef SGI_GRIO
867         { SGI_GRIO,             "SGI_GRIO"              },
868 #endif
869 #ifdef SGI_XLV_SET_TAB
870         { SGI_XLV_SET_TAB,      "SGI_XLV_SET_TAB"       },
871 #endif
872 #ifdef SGI_XLV_GET_TAB
873         { SGI_XLV_GET_TAB,      "SGI_XLV_GET_TAB"       },
874 #endif
875 #ifdef SGI_GET_FP_PRECISE
876         { SGI_GET_FP_PRECISE,   "SGI_GET_FP_PRECISE"    },
877 #endif
878 #ifdef SGI_GET_CONFIG_SMM       
879         { SGI_GET_CONFIG_SMM,   "SGI_GET_CONFIG_SMM"    },
880 #endif
881 #ifdef SGI_FP_IMPRECISE_SUPP    
882         { SGI_FP_IMPRECISE_SUPP,"SGI_FP_IMPRECISE_SUPP" },
883 #endif
884 #ifdef SGI_CONFIG_NSMM_SUPP     
885         { SGI_CONFIG_NSMM_SUPP, "SGI_CONFIG_NSMM_SUPP"  },
886 #endif
887 #ifdef SGI_RT_TSTAMP_CREATE    
888         { SGI_RT_TSTAMP_CREATE, "SGI_RT_TSTAMP_CREATE"  },
889 #endif
890 #ifdef SGI_RT_TSTAMP_DELETE    
891         { SGI_RT_TSTAMP_DELETE, "SGI_RT_TSTAMP_DELETE"  },
892 #endif
893 #ifdef SGI_RT_TSTAMP_START     
894         { SGI_RT_TSTAMP_START,  "SGI_RT_TSTAMP_START"   },
895 #endif
896 #ifdef SGI_RT_TSTAMP_STOP      
897         { SGI_RT_TSTAMP_STOP,   "SGI_RT_TSTAMP_STOP"    },
898 #endif
899 #ifdef SGI_RT_TSTAMP_ADDR      
900         { SGI_RT_TSTAMP_ADDR,   "SGI_RT_TSTAMP_ADDR"    },
901 #endif
902 #ifdef SGI_RT_TSTAMP_MASK      
903         { SGI_RT_TSTAMP_MASK,   "SGI_RT_TSTAMP_MASK"    },
904 #endif
905 #ifdef SGI_RT_TSTAMP_EOB_MODE  
906         { SGI_RT_TSTAMP_EOB_MODE,"SGI_RT_TSTAMP_EOB_MODE"},
907 #endif
908 #ifdef SGI_USE_FP_BCOPY 
909         { SGI_USE_FP_BCOPY,     "SGI_USE_FP_BCOPY"      },
910 #endif
911 #ifdef SGI_GET_UST              
912         { SGI_GET_UST,          "SGI_GET_UST"           },
913 #endif
914 #ifdef SGI_SPECULATIVE_EXEC     
915         { SGI_SPECULATIVE_EXEC, "SGI_SPECULATIVE_EXEC"  },
916 #endif
917 #ifdef SGI_XLV_NEXT_RQST        
918         { SGI_XLV_NEXT_RQST,    "SGI_XLV_NEXT_RQST"     },
919 #endif
920 #ifdef SGI_XLV_ATTR_CURSOR      
921         { SGI_XLV_ATTR_CURSOR,  "SGI_XLV_ATTR_CURSOR"   },
922 #endif
923 #ifdef SGI_XLV_ATTR_GET 
924         { SGI_XLV_ATTR_GET,     "SGI_XLV_ATTR_GET"      },
925 #endif
926 #ifdef SGI_XLV_ATTR_SET 
927         { SGI_XLV_ATTR_SET,     "SGI_XLV_ATTR_SET"      },
928 #endif
929 #ifdef SGI_BTOOLSIZE
930         { SGI_BTOOLSIZE,        "SGI_BTOOLSIZE"         },
931 #endif
932 #ifdef SGI_BTOOLGET             
933         { SGI_BTOOLGET,         "SGI_BTOOLGET"          },
934 #endif
935 #ifdef SGI_BTOOLREINIT          
936         { SGI_BTOOLREINIT,      "SGI_BTOOLREINIT"       },
937 #endif
938 #ifdef SGI_CREATE_UUID          
939         { SGI_CREATE_UUID,      "SGI_CREATE_UUID"       },
940 #endif
941 #ifdef SGI_NOFPE                
942         { SGI_NOFPE,            "SGI_NOFPE"             },
943 #endif
944 #ifdef SGI_OLD_SOFTFP           
945         { SGI_OLD_SOFTFP,       "SGI_OLD_SOFTFP"        },
946 #endif
947 #ifdef SGI_FS_INUMBERS          
948         { SGI_FS_INUMBERS,      "SGI_FS_INUMBERS"       },
949 #endif
950 #ifdef SGI_FS_BULKSTAT          
951         { SGI_FS_BULKSTAT,      "SGI_FS_BULKSTAT"       },
952 #endif
953 #ifdef SGI_RT_TSTAMP_WAIT       
954         { SGI_RT_TSTAMP_WAIT,   "SGI_RT_TSTAMP_WAIT"    },
955 #endif
956 #ifdef SGI_RT_TSTAMP_UPDATE    
957         { SGI_RT_TSTAMP_UPDATE, "SGI_RT_TSTAMP_UPDATE"  },
958 #endif
959 #ifdef SGI_PATH_TO_HANDLE       
960         { SGI_PATH_TO_HANDLE,   "SGI_PATH_TO_HANDLE"    },
961 #endif
962 #ifdef SGI_PATH_TO_FSHANDLE     
963         { SGI_PATH_TO_FSHANDLE, "SGI_PATH_TO_FSHANDLE"  },
964 #endif
965 #ifdef SGI_FD_TO_HANDLE 
966         { SGI_FD_TO_HANDLE,     "SGI_FD_TO_HANDLE"      },
967 #endif
968 #ifdef SGI_OPEN_BY_HANDLE       
969         { SGI_OPEN_BY_HANDLE,   "SGI_OPEN_BY_HANDLE"    },
970 #endif
971 #ifdef SGI_READLINK_BY_HANDLE   
972         { SGI_READLINK_BY_HANDLE,"SGI_READLINK_BY_HANDLE"},
973 #endif
974 #ifdef SGI_READ_DANGID          
975         { SGI_READ_DANGID,      "SGI_READ_DANGID"       },
976 #endif
977 #ifdef SGI_CONST                
978         { SGI_CONST,            "SGI_CONST"             },
979 #endif
980 #ifdef SGI_XFS_FSOPERATIONS     
981         { SGI_XFS_FSOPERATIONS, "SGI_XFS_FSOPERATIONS"  },
982 #endif
983 #ifdef SGI_SETASH               
984         { SGI_SETASH,           "SGI_SETASH"            },
985 #endif
986 #ifdef SGI_GETASH               
987         { SGI_GETASH,           "SGI_GETASH"            },
988 #endif
989 #ifdef SGI_SETPRID              
990         { SGI_SETPRID,          "SGI_SETPRID"           },
991 #endif
992 #ifdef SGI_GETPRID              
993         { SGI_GETPRID,          "SGI_GETPRID"           },
994 #endif
995 #ifdef SGI_SETSPINFO            
996         { SGI_SETSPINFO,        "SGI_SETSPINFO"         },
997 #endif
998 #ifdef SGI_GETSPINFO            
999         { SGI_GETSPINFO,        "SGI_GETSPINFO"         },
1000 #endif
1001 #ifdef SGI_SHAREII              
1002         { SGI_SHAREII,          "SGI_SHAREII"           },
1003 #endif
1004 #ifdef SGI_NEWARRAYSESS 
1005         { SGI_NEWARRAYSESS,     "SGI_NEWARRAYSESS"      },
1006 #endif
1007 #ifdef SGI_GETDFLTPRID          
1008         { SGI_GETDFLTPRID,      "SGI_GETDFLTPRID"       },
1009 #endif
1010 #ifdef SGI_SET_DISMISSED_EXC_CNT 
1011         { SGI_SET_DISMISSED_EXC_CNT,"SGI_SET_DISMISSED_EXC_CNT" },
1012 #endif
1013 #ifdef SGI_GET_DISMISSED_EXC_CNT 
1014         { SGI_GET_DISMISSED_EXC_CNT,"SGI_GET_DISMISSED_EXC_CNT" },
1015 #endif
1016 #ifdef SGI_CYCLECNTR_SIZE       
1017         { SGI_CYCLECNTR_SIZE,   "SGI_CYCLECNTR_SIZE"    },
1018 #endif
1019 #ifdef SGI_QUERY_FASTTIMER      
1020         { SGI_QUERY_FASTTIMER,  "SGI_QUERY_FASTTIMER"   },
1021 #endif
1022 #ifdef SGI_PIDSINASH            
1023         { SGI_PIDSINASH,        "SGI_PIDSINASH"         },
1024 #endif
1025 #ifdef SGI_ULI                  
1026         { SGI_ULI,              "SGI_ULI"               },
1027 #endif
1028 #ifdef SGI_LPG_SHMGET          
1029         { SGI_LPG_SHMGET,       "SGI_LPG_SHMGET"        },
1030 #endif
1031 #ifdef SGI_LPG_MAP             
1032         { SGI_LPG_MAP,          "SGI_LPG_MAP"           },
1033 #endif
1034 #ifdef SGI_CACHEFS_SYS          
1035         { SGI_CACHEFS_SYS,      "SGI_CACHEFS_SYS"       },
1036 #endif
1037 #ifdef SGI_NFSNOTIFY            
1038         { SGI_NFSNOTIFY,        "SGI_NFSNOTIFY"         },
1039 #endif
1040 #ifdef SGI_LOCKDSYS             
1041         { SGI_LOCKDSYS,         "SGI_LOCKDSYS"          },
1042 #endif
1043 #ifdef SGI_EVENTCTR            
1044         { SGI_EVENTCTR,         "SGI_EVENTCTR"          },
1045 #endif
1046 #ifdef SGI_GETPRUSAGE          
1047         { SGI_GETPRUSAGE,       "SGI_GETPRUSAGE"        },
1048 #endif
1049 #ifdef SGI_PROCMASK_LOCATION    
1050         { SGI_PROCMASK_LOCATION,"SGI_PROCMASK_LOCATION" },
1051 #endif
1052 #ifdef SGI_UNUSED               
1053         { SGI_UNUSED,           "SGI_UNUSED"            },
1054 #endif
1055 #ifdef SGI_CKPT_SYS             
1056         { SGI_CKPT_SYS,         "SGI_CKPT_SYS"          },
1057 #endif
1058 #ifdef SGI_CKPT_SYS             
1059         { SGI_CKPT_SYS,         "SGI_CKPT_SYS"          },
1060 #endif
1061 #ifdef SGI_GETGRPPID            
1062         { SGI_GETGRPPID,        "SGI_GETGRPPID"         },
1063 #endif
1064 #ifdef SGI_GETSESPID            
1065         { SGI_GETSESPID,        "SGI_GETSESPID"         },
1066 #endif
1067 #ifdef SGI_ENUMASHS             
1068         { SGI_ENUMASHS,         "SGI_ENUMASHS"          },
1069 #endif
1070 #ifdef SGI_SETASMACHID          
1071         { SGI_SETASMACHID,      "SGI_SETASMACHID"       },
1072 #endif
1073 #ifdef SGI_GETASMACHID          
1074         { SGI_GETASMACHID,      "SGI_GETASMACHID"       },
1075 #endif
1076 #ifdef SGI_GETARSESS            
1077         { SGI_GETARSESS,        "SGI_GETARSESS"         },
1078 #endif
1079 #ifdef SGI_JOINARRAYSESS        
1080         { SGI_JOINARRAYSESS,    "SGI_JOINARRAYSESS"     },
1081 #endif
1082 #ifdef SGI_SPROC_KILL           
1083         { SGI_SPROC_KILL,       "SGI_SPROC_KILL"        },
1084 #endif
1085 #ifdef SGI_DBA_CONFIG           
1086         { SGI_DBA_CONFIG,       "SGI_DBA_CONFIG"        },
1087 #endif
1088 #ifdef SGI_RELEASE_NAME 
1089         { SGI_RELEASE_NAME,     "SGI_RELEASE_NAME"      },
1090 #endif
1091 #ifdef SGI_SYNCH_CACHE_HANDLER 
1092         { SGI_SYNCH_CACHE_HANDLER,"SGI_SYNCH_CACHE_HANDLER"},
1093 #endif
1094 #ifdef SGI_SWASH_INIT           
1095         { SGI_SWASH_INIT,       "SGI_SWASH_INIT"        },
1096 #endif
1097 #ifdef SGI_NUMA_MIGR_PAGE       
1098         { SGI_NUMA_MIGR_PAGE,   "SGI_NUMA_MIGR_PAGE"    },
1099 #endif
1100 #ifdef SGI_NUMA_MIGR_PAGE_ALT   
1101         { SGI_NUMA_MIGR_PAGE_ALT,"SGI_NUMA_MIGR_PAGE_ALT"},
1102 #endif
1103 #ifdef SGI_KAIO_USERINIT        
1104         { SGI_KAIO_USERINIT,    "SGI_KAIO_USERINIT"     },
1105 #endif
1106 #ifdef SGI_KAIO_READ            
1107         { SGI_KAIO_READ,        "SGI_KAIO_READ"         },
1108 #endif
1109 #ifdef SGI_KAIO_WRITE           
1110         { SGI_KAIO_WRITE,       "SGI_KAIO_WRITE"        },
1111 #endif
1112 #ifdef SGI_KAIO_SUSPEND 
1113         { SGI_KAIO_SUSPEND,     "SGI_KAIO_SUSPEND"      },
1114 #endif
1115 #ifdef SGI_KAIO_STATS           
1116         { SGI_KAIO_STATS,       "SGI_KAIO_STATS"        },
1117 #endif
1118 #ifdef SGI_INITIAL_PT_SPROC     
1119         { SGI_INITIAL_PT_SPROC, "SGI_INITIAL_PT_SPROC"  },
1120 #endif
1121         { 0,                    NULL                    },
1122 };
1123
1124 int
1125 sys_syssgi(tcp)
1126 struct tcb *tcp;
1127 {
1128         int i;
1129
1130         if (entering(tcp)) {
1131                 printxval(syssgi_options, tcp->u_arg[0], "SGI_???");
1132                 switch (tcp->u_arg[0]) {
1133                 default:
1134                         for (i = 1; i < tcp->u_nargs; i++)
1135                                 tprintf(", %#lx", tcp->u_arg[i]);
1136                         break;
1137                 }
1138         }
1139         return 0;
1140 }
1141
1142 #include <sys/types.h>
1143 #include <rpc/rpc.h>
1144 struct cred;
1145 struct uio;
1146 #include <sys/fsid.h>
1147 #include <sys/vnode.h>
1148 #include <sys/fs/nfs.h>
1149 #include <sys/fs/nfs_clnt.h>
1150
1151 static struct xlat mount_flags[] = {
1152         { MS_RDONLY,    "MS_RDONLY"     },
1153         { MS_FSS,       "MS_FSS"        },
1154         { MS_DATA,      "MS_DATA"       },
1155         { MS_NOSUID,    "MS_NOSUID"     },
1156         { MS_REMOUNT,   "MS_REMOUNT"    },
1157         { MS_NOTRUNC,   "MS_NOTRUNC"    },
1158         { MS_GRPID,     "MS_GRPID"      },
1159         { MS_NODEV,     "MS_NODEV"      },
1160         { MS_BEFORE,    "MS_BEFORE"     },
1161         { MS_AFTER,     "MS_AFTER"      },
1162         { 0,            NULL            },
1163 };
1164
1165 static struct xlat nfs_flags[] = {
1166         { NFSMNT_SOFT,          "NFSMNT_SOFT"           },
1167         { NFSMNT_WSIZE,         "NFSMNT_WSIZE"          },
1168         { NFSMNT_RSIZE,         "NFSMNT_RSIZE"          },
1169         { NFSMNT_TIMEO,         "NFSMNT_TIMEO"          },
1170         { NFSMNT_RETRANS,       "NFSMNT_RETRANS"        },
1171         { NFSMNT_HOSTNAME,      "NFSMNT_HOSTNAME"       },
1172 #ifdef NFSMNT_NOINT     /* IRIX 6 */
1173         { NFSMNT_NOINT,         "NFSMNT_NOINT"          },
1174 #endif
1175 #ifdef NFSMNT_INT       /* IRIX 5 */
1176         { NFSMNT_INT,           "NFSMNT_INT"            },
1177 #endif
1178         { NFSMNT_NOAC,          "NFSMNT_NOAC"           },
1179         { NFSMNT_ACREGMIN,      "NFSMNT_ACREGMIN"       },
1180         { NFSMNT_ACREGMAX,      "NFSMNT_ACREGMAX"       },
1181         { NFSMNT_ACDIRMIN,      "NFSMNT_ACDIRMIN"       },
1182         { NFSMNT_ACDIRMAX,      "NFSMNT_ACDIRMAX"       },
1183         { NFSMNT_PRIVATE,       "NFSMNT_PRIVATE"        },
1184         { NFSMNT_SYMTTL,        "NFSMNT_SYMTTL"         },
1185         { NFSMNT_LOOPBACK,      "NFSMNT_LOOPBACK"       },
1186         { NFSMNT_BASETYPE,      "NFSMNT_BASETYPE"       },
1187         { NFSMNT_NAMEMAX,       "NFSMNT_NAMEMAX"        },
1188 #ifdef NFSMNT_SHORTUID  /* IRIX 6 */
1189         { NFSMNT_SHORTUID,      "NFSMNT_SHORTUID"       },
1190 #endif
1191 #ifdef NFSMNT_ASYNCNLM  /* IRIX 6 */
1192         { NFSMNT_ASYNCNLM,      "NFSMNT_ASYNCNLM"       },
1193 #endif
1194         { 0,                    NULL                    },
1195 };
1196
1197 int
1198 sys_mount(tcp)
1199 struct tcb *tcp;
1200 {
1201         if (entering(tcp)) {
1202                 printpath(tcp, tcp->u_arg[0]);
1203                 tprintf(", ");
1204                 printpath(tcp, tcp->u_arg[1]);
1205                 tprintf(", ");
1206                 printflags(mount_flags, tcp->u_arg[2]);
1207                 if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
1208                         tprintf(", ");
1209                         tprintf("%ld", tcp->u_arg[3]);
1210                 }
1211                 if (tcp->u_arg[2] & MS_DATA) {
1212                         int nfs_type = sysfs(GETFSIND, FSID_NFS);
1213
1214                         tprintf(", ");
1215                         if (tcp->u_arg[3] == nfs_type) {
1216                                 struct nfs_args args;
1217                                 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1218                                         tprintf("%#lx", tcp->u_arg[4]);
1219                                 else {
1220                                         tprintf("addr=");
1221                                         printsock(tcp, (int) args.addr);
1222                                         tprintf(", flags=");
1223                                         if (!printflags(nfs_flags, args.flags))
1224                                                 tprintf("NFSMNT_???");
1225                                         tprintf(", hostname=");
1226                                         printstr(tcp, (int) args.hostname, -1);
1227                                         tprintf(", ...}");
1228                                 }
1229                         }
1230                         else
1231                                 tprintf("%#lx", tcp->u_arg[4]);
1232                         tprintf(", %ld", tcp->u_arg[5]);
1233                 }
1234         }
1235         return 0;
1236 }
1237
1238 #else /* !MIPS */
1239
1240 #if UNIXWARE
1241
1242 #include <sys/types.h>
1243 #include <sys/fstyp.h>
1244 #include <sys/mount.h>
1245 #include <sys/xti.h>
1246
1247 #define NFSCLIENT       1
1248 #include <nfs/mount.h>
1249
1250 #include <sys/fs/vx_ioctl.h>
1251
1252 static struct xlat mount_flags[] = {
1253         { MS_RDONLY,    "MS_RDONLY"     },
1254         { MS_FSS,       "MS_FSS"        },
1255         { MS_DATA,      "MS_DATA"       },
1256         { MS_HADBAD,    "MS_HADBAD"     },
1257         { MS_NOSUID,    "MS_NOSUID"     },
1258         { MS_REMOUNT,   "MS_REMOUNT"    },
1259         { MS_NOTRUNC,   "MS_NOTRUNC"    },
1260         { MS_SOFTMNT,   "MS_SOFTMNT"    },
1261         { MS_SYSSPACE,  "MS_SYSSPACE"   },
1262         { 0,            NULL            },
1263 };
1264
1265 #ifdef VX_MS_MASK
1266 static struct xlat vxfs_flags[] = {
1267         { VX_MS_NOLOG,          "VX_MS_NOLOG"           },
1268         { VX_MS_BLKCLEAR,       "VX_MS_BLKCLEAR"        },
1269         { VX_MS_SNAPSHOT,       "VX_MS_SNAPSHOT"        },
1270         { VX_MS_NODATAINLOG,    "VX_MS_NODATAINLOG"     },
1271         { VX_MS_DELAYLOG,       "VX_MS_DELAYLOG"        },
1272         { VX_MS_TMPLOG,         "VX_MS_TMPLOG"          },
1273         { VX_MS_FILESET,        "VX_MS_FILESET"         },
1274
1275         { VX_MS_CACHE_DIRECT,   "VX_MS_CACHE_DIRECT"    },
1276         { VX_MS_CACHE_DSYNC,    "VX_MS_CACHE_DSYNC"     },
1277         { VX_MS_CACHE_CLOSESYNC,"VX_MS_CACHE_CLOSESYNC" },
1278         { VX_MS_CACHE_TMPCACHE, "VX_MS_CACHE_TMPCACHE"  },
1279
1280         { VX_MS_OSYNC_DIRECT,   "VX_MS_OSYNC_DIRECT"    },
1281         { VX_MS_OSYNC_DSYNC,    "VX_MS_OSYNC_DSYNC"     },
1282         { VX_MS_OSYNC_CLOSESYNC,"VX_MS_OSYNC_CLOSESYNC" },
1283         { VX_MS_OSYNC_DELAY,    "VX_MS_OSYNC_DELAY"     },
1284         { 0,                    NULL,                   },
1285 };
1286 #endif
1287
1288 static struct xlat nfs_flags[] = {
1289         { NFSMNT_SOFT,          "NFSMNT_SOFT"           },
1290         { NFSMNT_WSIZE,         "NFSMNT_WSIZE"          },
1291         { NFSMNT_RSIZE,         "NFSMNT_RSIZE"          },
1292         { NFSMNT_TIMEO,         "NFSMNT_TIMEO"          },
1293         { NFSMNT_RETRANS,       "NFSMNT_RETRANS"        },
1294         { NFSMNT_HOSTNAME,      "NFSMNT_HOSTNAME"       },
1295         { NFSMNT_INT,           "NFSMNT_INT"            },
1296         { NFSMNT_NOAC,          "NFSMNT_NOAC"           },
1297         { NFSMNT_ACREGMIN,      "NFSMNT_ACREGMIN"       },
1298         { NFSMNT_ACREGMAX,      "NFSMNT_ACREGMAX"       },
1299         { NFSMNT_ACDIRMIN,      "NFSMNT_ACDIRMIN"       },
1300         { NFSMNT_ACDIRMAX,      "NFSMNT_ACDIRMAX"       },
1301         { NFSMNT_SECURE,        "NFSMNT_SECURE"         },
1302         { NFSMNT_NOCTO,         "NFSMNT_NOCTO"          },
1303         { NFSMNT_GRPID,         "NFSMNT_GRPID"          },
1304         { NFSMNT_RPCTIMESYNC,   "NFSMNT_RPCTIMESYNC"    },
1305         { NFSMNT_LWPSMAX,       "NFSMNT_LWPSMAX"        },
1306         { 0,                    NULL                    },
1307 };
1308
1309 int
1310 sys_mount(tcp)
1311 struct tcb *tcp;
1312 {
1313         if (entering(tcp)) {
1314                 char fstyp [FSTYPSZ];
1315                 printpath(tcp, tcp->u_arg[0]);
1316                 tprintf(", ");
1317                 printpath(tcp, tcp->u_arg[1]);
1318                 tprintf(", ");
1319                 printflags(mount_flags, tcp->u_arg[2]);
1320                 /* The doc sez that the file system type is given as a
1321                    fsindex, and we should use sysfs to work out the name.
1322                    This appears to be untrue for UW.  Maybe it's untrue
1323                    for all SVR4's? */
1324                 if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
1325                         if (umovestr(tcp, tcp->u_arg[3], FSTYPSZ, fstyp) < 0) {
1326                                 *fstyp = 0;
1327                                 tprintf(", %ld", tcp->u_arg[3]);
1328                         }
1329                         else
1330                                 tprintf(", \"%s\"", fstyp);
1331                 }
1332                 if (tcp->u_arg[2] & MS_DATA) {
1333                         tprintf(", ");
1334 #ifdef VX_MS_MASK
1335                         /* On UW7 they don't give us the defines and structs
1336                            we need to see what is going on.  Bummer. */
1337                         if (strcmp (fstyp, "vxfs") == 0) {
1338                                 struct vx_mountargs5 args;
1339                                 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1340                                         tprintf("%#lx", tcp->u_arg[4]);
1341                                 else {
1342                                         tprintf("{ flags=");
1343                                         if (!printflags(vxfs_flags, args.mflags))
1344                                                 tprintf("0x%08x", args.mflags);
1345                                         if (args.mflags & VX_MS_SNAPSHOT) {
1346                                                 tprintf (", snapof=");
1347                                                 printstr (tcp,
1348                                                           (long) args.primaryspec, 
1349                                                           -1);
1350                                                 if (args.snapsize > 0)
1351                                                         tprintf (", snapsize=%ld", args.snapsize);
1352                                         }
1353                                         tprintf(" }");
1354                                 }
1355                         }
1356                         else
1357 #endif
1358                         if (strcmp (fstyp, "specfs") == 0) {
1359                                 tprintf ("dev=");
1360                                 printstr (tcp, tcp->u_arg[4], -1);
1361                         }
1362                         else
1363                         if (strcmp (fstyp, "nfs") == 0) {
1364                                 struct nfs_args args;
1365                                 if (umove(tcp, tcp->u_arg[4], &args) < 0)
1366                                         tprintf("%#lx", tcp->u_arg[4]);
1367                                 else {
1368                                         struct netbuf addr;
1369                                         tprintf("{ addr=");
1370                                         if (umove (tcp, (int) args.addr, &addr) < 0) {
1371                                                 tprintf ("%#lx", (long) args.addr);
1372                                         }
1373                                         else {
1374                                                 printsock(tcp, (int) addr.buf, addr.len);
1375                                         }
1376                                         tprintf(", flags=");
1377                                         if (!printflags(nfs_flags, args.flags))
1378                                                 tprintf("NFSMNT_???");
1379                                         tprintf(", hostname=");
1380                                         printstr(tcp, (int) args.hostname, -1);
1381                                         tprintf(", ...}");
1382                                 }
1383                         }
1384                         else
1385                                 tprintf("%#lx", tcp->u_arg[4]);
1386                         tprintf(", %ld", tcp->u_arg[5]);
1387                 }
1388         }
1389         return 0;
1390 }
1391
1392 #else /* !UNIXWARE */
1393
1394 int
1395 sys_mount(tcp)
1396 struct tcb *tcp;
1397 {
1398         if (entering(tcp)) {
1399                 printpath(tcp, tcp->u_arg[0]);
1400                 tprintf(", ");
1401                 printpath(tcp, tcp->u_arg[1]);
1402                 tprintf(", ...");
1403         }
1404         return 0;
1405 }
1406 #endif /* !UNIXWARE */
1407
1408 #endif /* !MIPS */
1409
1410 #endif /* SVR4 */
1411
1412 #ifdef SYS_capget
1413
1414 static struct xlat capabilities[] = {
1415         { 1<<CAP_CHOWN,         "CAP_CHOWN"     },
1416         { 1<<CAP_DAC_OVERRIDE,  "CAP_DAC_OVERRIDE"},
1417         { 1<<CAP_DAC_READ_SEARCH,"CAP_DAC_READ_SEARCH"},
1418         { 1<<CAP_FOWNER,        "CAP_FOWNER"    },
1419         { 1<<CAP_FSETID,        "CAP_FSETID"    },
1420         { 1<<CAP_KILL,          "CAP_KILL"      },
1421         { 1<<CAP_SETGID,        "CAP_SETGID"    },
1422         { 1<<CAP_SETUID,        "CAP_SETUID"    },
1423         { 1<<CAP_SETPCAP,       "CAP_SETPCAP"   },
1424         { 1<<CAP_LINUX_IMMUTABLE,"CAP_LINUX_IMMUTABLE"},
1425         { 1<<CAP_NET_BIND_SERVICE,"CAP_NET_BIND_SERVICE"},
1426         { 1<<CAP_NET_BROADCAST, "CAP_NET_BROADCAST"},
1427         { 1<<CAP_NET_ADMIN,     "CAP_NET_ADMIN" },
1428         { 1<<CAP_NET_RAW,       "CAP_NET_RAW"   },
1429         { 1<<CAP_IPC_LOCK,      "CAP_IPC_LOCK"  },
1430         { 1<<CAP_IPC_OWNER,     "CAP_IPC_OWNER" },
1431         { 1<<CAP_SYS_MODULE,    "CAP_SYS_MODULE"},
1432         { 1<<CAP_SYS_RAWIO,     "CAP_SYS_RAWIO" },
1433         { 1<<CAP_SYS_CHROOT,    "CAP_SYS_CHROOT"},
1434         { 1<<CAP_SYS_PTRACE,    "CAP_SYS_PTRACE"},
1435         { 1<<CAP_SYS_PACCT,     "CAP_SYS_PACCT" },
1436         { 1<<CAP_SYS_ADMIN,     "CAP_SYS_ADMIN" },
1437         { 1<<CAP_SYS_BOOT,      "CAP_SYS_BOOT"  },
1438         { 1<<CAP_SYS_NICE,      "CAP_SYS_NICE"  },
1439         { 1<<CAP_SYS_RESOURCE,  "CAP_SYS_RESOURCE"},
1440         { 1<<CAP_SYS_TIME,      "CAP_SYS_TIME"  },
1441         { 1<<CAP_SYS_TTY_CONFIG,"CAP_SYS_TTY_CONFIG"},
1442         { 0,                    NULL            },
1443 };
1444
1445
1446 int
1447 sys_capget(tcp)
1448 struct tcb *tcp;
1449 {
1450         static cap_user_header_t       arg0 = NULL;
1451         static cap_user_data_t         arg1 = NULL;
1452
1453         if(!entering(tcp)) {
1454                 if (!arg0) {
1455                         if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
1456                                 fprintf(stderr, "sys_capget: no memory\n");
1457                                 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
1458                                 return -1;
1459                         }
1460                 }
1461                 if (!arg1) {
1462                         if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
1463                                 fprintf(stderr, "sys_capget: no memory\n");
1464                                 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
1465                                 return -1;
1466                         }
1467                 }
1468
1469                 if (!tcp->u_arg[0])
1470                         tprintf("NULL");
1471                 else if (!verbose(tcp))
1472                         tprintf("%#lx", tcp->u_arg[0]);
1473                 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
1474                         tprintf("???");
1475                 else {
1476                         tprintf("%#x, %d", arg0->version, arg0->pid);
1477                 }
1478                 tprintf(", ");
1479                 if (!tcp->u_arg[1])
1480                         tprintf("NULL");
1481                 else if (!verbose(tcp))
1482                         tprintf("%#lx", tcp->u_arg[1]);
1483                 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
1484                         tprintf("???");
1485                 else {
1486                         tprintf("{");
1487                         printflags(capabilities, arg1->effective);
1488                         tprintf(", ");
1489                         printflags(capabilities, arg1->permitted);
1490                         tprintf(", ");
1491                         printflags(capabilities, arg1->inheritable);
1492                         tprintf("}");
1493                 } 
1494         }
1495         return 0;
1496 }
1497
1498 int
1499 sys_capset(tcp)
1500 struct tcb *tcp;
1501 {
1502         static cap_user_header_t       arg0 = NULL;
1503         static cap_user_data_t         arg1 = NULL;
1504
1505         if(entering(tcp)) {
1506                 if (!arg0) {
1507                         if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
1508                                 fprintf(stderr, "sys_capset: no memory\n");
1509                                 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
1510                                 return -1;
1511                         }
1512                 }
1513                 if (!arg1) {
1514                         if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
1515                                 fprintf(stderr, "sys_capset: no memory\n");
1516                                 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
1517                                 return -1;
1518                         }
1519                 }
1520
1521                 if (!tcp->u_arg[0])
1522                         tprintf("NULL");
1523                 else if (!verbose(tcp))
1524                         tprintf("%#lx", tcp->u_arg[0]);
1525                 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0)
1526                         tprintf("???");
1527                 else {
1528                         tprintf("%#x, %d", arg0->version, arg0->pid);
1529                 }
1530                 tprintf(", ");
1531                 if (!tcp->u_arg[1])
1532                         tprintf("NULL");
1533                 else if (!verbose(tcp))
1534                         tprintf("%#lx", tcp->u_arg[1]);
1535                 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0)
1536                         tprintf("???");
1537                 else {
1538                         tprintf("{");
1539                         printflags(capabilities, arg1->effective);
1540                         tprintf(", ");
1541                         printflags(capabilities, arg1->permitted);
1542                         tprintf(", ");
1543                         printflags(capabilities, arg1->inheritable);
1544                         tprintf("}");
1545                 } 
1546         }
1547         return 0;
1548 }
1549
1550 #else
1551
1552 int sys_capget(tcp)
1553 struct tcb *tcp;
1554 {
1555         return printargs(tcp);
1556 }
1557
1558 int sys_capset(tcp)
1559 struct tcb *tcp;
1560 {
1561         return printargs(tcp);
1562 }
1563
1564 #endif
1565
1566 #ifdef LINUX
1567 static struct xlat sysctl_root[] = {
1568         { CTL_KERN, "CTL_KERN" },
1569         { CTL_VM, "CTL_VM" },
1570         { CTL_NET, "CTL_NET" },
1571         { CTL_PROC, "CTL_PROC" },
1572         { CTL_FS, "CTL_FS" },
1573         { CTL_DEBUG, "CTL_DEBUG" },
1574         { CTL_DEV, "CTL_DEV" },
1575         { 0, NULL }
1576 };
1577
1578 static struct xlat sysctl_kern[] = {
1579         { KERN_OSTYPE, "KERN_OSTYPE" },
1580         { KERN_OSRELEASE, "KERN_OSRELEASE" },
1581         { KERN_OSREV, "KERN_OSREV" },
1582         { KERN_VERSION, "KERN_VERSION" },
1583         { KERN_SECUREMASK, "KERN_SECUREMASK" },
1584         { KERN_PROF, "KERN_PROF" },
1585         { KERN_NODENAME, "KERN_NODENAME" },
1586         { KERN_DOMAINNAME, "KERN_DOMAINNAME" },
1587 #ifdef KERN_SECURELVL
1588         { KERN_SECURELVL, "KERN_SECURELVL" },
1589 #endif
1590         { KERN_PANIC, "KERN_PANIC" },
1591 #ifdef KERN_REALROOTDEV
1592         { KERN_REALROOTDEV, "KERN_REALROOTDEV" },
1593 #endif
1594 #ifdef KERN_JAVA_INTERPRETER
1595         { KERN_JAVA_INTERPRETER, "KERN_JAVA_INTERPRETER" },
1596 #endif
1597 #ifdef KERN_JAVA_APPLETVIEWER
1598         { KERN_JAVA_APPLETVIEWER, "KERN_JAVA_APPLETVIEWER" },
1599 #endif
1600         { KERN_SPARC_REBOOT, "KERN_SPARC_REBOOT" },
1601         { KERN_CTLALTDEL, "KERN_CTLALTDEL" },
1602         { KERN_PRINTK, "KERN_PRINTK" },
1603         { KERN_NAMETRANS, "KERN_NAMETRANS" },
1604         { KERN_PPC_HTABRECLAIM, "KERN_PPC_HTABRECLAIM" },
1605         { KERN_PPC_ZEROPAGED, "KERN_PPC_ZEROPAGED" },
1606         { KERN_PPC_POWERSAVE_NAP, "KERN_PPC_POWERSAVE_NAP" },
1607         { KERN_MODPROBE, "KERN_MODPROBE" },
1608         { KERN_SG_BIG_BUFF, "KERN_SG_BIG_BUFF" },
1609         { KERN_ACCT, "KERN_ACCT" },
1610         { KERN_PPC_L2CR, "KERN_PPC_L2CR" },
1611         { KERN_RTSIGNR, "KERN_RTSIGNR" },
1612         { KERN_RTSIGMAX, "KERN_RTSIGMAX" },
1613         { KERN_SHMMAX, "KERN_SHMMAX" },
1614         { KERN_MSGMAX, "KERN_MSGMAX" },
1615         { KERN_MSGMNB, "KERN_MSGMNB" },
1616         { KERN_MSGPOOL, "KERN_MSGPOOL" },
1617         { 0, NULL }
1618 };
1619
1620 static struct xlat sysctl_vm[] = {
1621         { VM_SWAPCTL, "VM_SWAPCTL" },
1622         { VM_SWAPOUT, "VM_SWAPOUT" },
1623         { VM_FREEPG, "VM_FREEPG" },
1624         { VM_BDFLUSH, "VM_BDFLUSH" },
1625         { VM_OVERCOMMIT_MEMORY, "VM_OVERCOMMIT_MEMORY" },
1626         { VM_BUFFERMEM, "VM_BUFFERMEM" },
1627         { VM_PAGECACHE, "VM_PAGECACHE" },
1628         { VM_PAGERDAEMON, "VM_PAGERDAEMON" },
1629         { VM_PGT_CACHE, "VM_PGT_CACHE" },
1630         { VM_PAGE_CLUSTER, "VM_PAGE_CLUSTER" },
1631         { 0, NULL },
1632 };
1633
1634 static struct xlat sysctl_net[] = {
1635         { NET_CORE, "NET_CORE" },
1636         { NET_ETHER, "NET_ETHER" },
1637         { NET_802, "NET_802" },
1638         { NET_UNIX, "NET_UNIX" },
1639         { NET_IPV4, "NET_IPV4" },
1640         { NET_IPX, "NET_IPX" },
1641         { NET_ATALK, "NET_ATALK" },
1642         { NET_NETROM, "NET_NETROM" },
1643         { NET_AX25, "NET_AX25" },
1644         { NET_BRIDGE, "NET_BRIDGE" },
1645         { NET_ROSE, "NET_ROSE" },
1646         { NET_IPV6, "NET_IPV6" },
1647         { NET_X25, "NET_X25" },
1648         { NET_TR, "NET_TR" },
1649         { NET_DECNET, "NET_DECNET" },
1650         { 0, NULL }
1651 };
1652
1653 static struct xlat sysctl_net_core[] = {
1654         { NET_CORE_WMEM_MAX, "NET_CORE_WMEM_MAX" },
1655         { NET_CORE_RMEM_MAX, "NET_CORE_RMEM_MAX" },
1656         { NET_CORE_WMEM_DEFAULT, "NET_CORE_WMEM_DEFAULT" },
1657         { NET_CORE_RMEM_DEFAULT, "NET_CORE_RMEM_DEFAULT" },
1658         { NET_CORE_MAX_BACKLOG, "NET_CORE_MAX_BACKLOG" },
1659         { NET_CORE_FASTROUTE, "NET_CORE_FASTROUTE" },
1660         { NET_CORE_MSG_COST, "NET_CORE_MSG_COST" },
1661         { NET_CORE_MSG_BURST, "NET_CORE_MSG_BURST" },
1662         { NET_CORE_OPTMEM_MAX, "NET_CORE_OPTMEM_MAX" },
1663         { 0, NULL }
1664 };
1665
1666 static struct xlat sysctl_net_unix[] = {
1667         { NET_UNIX_DESTROY_DELAY, "NET_UNIX_DESTROY_DELAY" },
1668         { NET_UNIX_DELETE_DELAY, "NET_UNIX_DELETE_DELAY" },
1669         { 0, NULL }
1670 };
1671
1672 static struct xlat sysctl_net_ipv4[] = {
1673         { NET_IPV4_FORWARD, "NET_IPV4_FORWARD" },
1674         { NET_IPV4_DYNADDR, "NET_IPV4_DYNADDR" },
1675         { NET_IPV4_CONF, "NET_IPV4_CONF" },
1676         { NET_IPV4_NEIGH, "NET_IPV4_NEIGH" },
1677         { NET_IPV4_ROUTE, "NET_IPV4_ROUTE" },
1678         { NET_IPV4_FIB_HASH, "NET_IPV4_FIB_HASH" },
1679         { NET_IPV4_TCP_TIMESTAMPS, "NET_IPV4_TCP_TIMESTAMPS" },
1680         { NET_IPV4_TCP_WINDOW_SCALING, "NET_IPV4_TCP_WINDOW_SCALING" },
1681         { NET_IPV4_TCP_SACK, "NET_IPV4_TCP_SACK" },
1682         { NET_IPV4_TCP_RETRANS_COLLAPSE, "NET_IPV4_TCP_RETRANS_COLLAPSE" },
1683         { NET_IPV4_DEFAULT_TTL, "NET_IPV4_DEFAULT_TTL" },
1684         { NET_IPV4_AUTOCONFIG, "NET_IPV4_AUTOCONFIG" },
1685         { NET_IPV4_NO_PMTU_DISC, "NET_IPV4_NO_PMTU_DISC" },
1686         { NET_IPV4_TCP_SYN_RETRIES, "NET_IPV4_TCP_SYN_RETRIES" },
1687         { NET_IPV4_IPFRAG_HIGH_THRESH, "NET_IPV4_IPFRAG_HIGH_THRESH" },
1688         { NET_IPV4_IPFRAG_LOW_THRESH, "NET_IPV4_IPFRAG_LOW_THRESH" },
1689         { NET_IPV4_IPFRAG_TIME, "NET_IPV4_IPFRAG_TIME" },
1690         { NET_IPV4_TCP_MAX_KA_PROBES, "NET_IPV4_TCP_MAX_KA_PROBES" },
1691         { NET_IPV4_TCP_KEEPALIVE_TIME, "NET_IPV4_TCP_KEEPALIVE_TIME" },
1692         { NET_IPV4_TCP_KEEPALIVE_PROBES, "NET_IPV4_TCP_KEEPALIVE_PROBES" },
1693         { NET_IPV4_TCP_RETRIES1, "NET_IPV4_TCP_RETRIES1" },
1694         { NET_IPV4_TCP_RETRIES2, "NET_IPV4_TCP_RETRIES2" },
1695         { NET_IPV4_TCP_FIN_TIMEOUT, "NET_IPV4_TCP_FIN_TIMEOUT" },
1696         { NET_IPV4_IP_MASQ_DEBUG, "NET_IPV4_IP_MASQ_DEBUG" },
1697         { NET_TCP_SYNCOOKIES, "NET_TCP_SYNCOOKIES" },
1698         { NET_TCP_STDURG, "NET_TCP_STDURG" },
1699         { NET_TCP_RFC1337, "NET_TCP_RFC1337" },
1700         { NET_TCP_SYN_TAILDROP, "NET_TCP_SYN_TAILDROP" },
1701         { NET_TCP_MAX_SYN_BACKLOG, "NET_TCP_MAX_SYN_BACKLOG" },
1702         { NET_IPV4_LOCAL_PORT_RANGE, "NET_IPV4_LOCAL_PORT_RANGE" },
1703         { NET_IPV4_ICMP_ECHO_IGNORE_ALL, "NET_IPV4_ICMP_ECHO_IGNORE_ALL" },
1704         { NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS" },
1705         { NET_IPV4_ICMP_SOURCEQUENCH_RATE, "NET_IPV4_ICMP_SOURCEQUENCH_RATE" },
1706         { NET_IPV4_ICMP_DESTUNREACH_RATE, "NET_IPV4_ICMP_DESTUNREACH_RATE" },
1707         { NET_IPV4_ICMP_TIMEEXCEED_RATE, "NET_IPV4_ICMP_TIMEEXCEED_RATE" },
1708         { NET_IPV4_ICMP_PARAMPROB_RATE, "NET_IPV4_ICMP_PARAMPROB_RATE" },
1709         { NET_IPV4_ICMP_ECHOREPLY_RATE, "NET_IPV4_ICMP_ECHOREPLY_RATE" },
1710         { NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES" },
1711         { NET_IPV4_IGMP_MAX_MEMBERSHIPS, "NET_IPV4_IGMP_MAX_MEMBERSHIPS" },
1712         {  0, NULL }
1713 };
1714
1715 static struct xlat sysctl_net_ipv4_route[] = {
1716         { NET_IPV4_ROUTE_FLUSH, "NET_IPV4_ROUTE_FLUSH" },
1717         { NET_IPV4_ROUTE_MIN_DELAY, "NET_IPV4_ROUTE_MIN_DELAY" },
1718         { NET_IPV4_ROUTE_MAX_DELAY, "NET_IPV4_ROUTE_MAX_DELAY" },
1719         { NET_IPV4_ROUTE_GC_THRESH, "NET_IPV4_ROUTE_GC_THRESH" },
1720         { NET_IPV4_ROUTE_MAX_SIZE, "NET_IPV4_ROUTE_MAX_SIZE" },
1721         { NET_IPV4_ROUTE_GC_MIN_INTERVAL, "NET_IPV4_ROUTE_GC_MIN_INTERVAL" },
1722         { NET_IPV4_ROUTE_GC_TIMEOUT, "NET_IPV4_ROUTE_GC_TIMEOUT" },
1723         { NET_IPV4_ROUTE_GC_INTERVAL, "NET_IPV4_ROUTE_GC_INTERVAL" },
1724         { NET_IPV4_ROUTE_REDIRECT_LOAD, "NET_IPV4_ROUTE_REDIRECT_LOAD" },
1725         { NET_IPV4_ROUTE_REDIRECT_NUMBER, "NET_IPV4_ROUTE_REDIRECT_NUMBER" },
1726         { NET_IPV4_ROUTE_REDIRECT_SILENCE, "NET_IPV4_ROUTE_REDIRECT_SILENCE" },
1727         { NET_IPV4_ROUTE_ERROR_COST, "NET_IPV4_ROUTE_ERROR_COST" },
1728         { NET_IPV4_ROUTE_ERROR_BURST, "NET_IPV4_ROUTE_ERROR_BURST" },
1729         { NET_IPV4_ROUTE_GC_ELASTICITY, "NET_IPV4_ROUTE_GC_ELASTICITY" },
1730         { 0, NULL }
1731 };
1732
1733 static struct xlat sysctl_net_ipv4_conf[] = {
1734         { NET_IPV4_CONF_FORWARDING, "NET_IPV4_CONF_FORWARDING" },
1735         { NET_IPV4_CONF_MC_FORWARDING, "NET_IPV4_CONF_MC_FORWARDING" },
1736         { NET_IPV4_CONF_PROXY_ARP, "NET_IPV4_CONF_PROXY_ARP" },
1737         { NET_IPV4_CONF_ACCEPT_REDIRECTS, "NET_IPV4_CONF_ACCEPT_REDIRECTS" },
1738         { NET_IPV4_CONF_SECURE_REDIRECTS, "NET_IPV4_CONF_SECURE_REDIRECTS" },
1739         { NET_IPV4_CONF_SEND_REDIRECTS, "NET_IPV4_CONF_SEND_REDIRECTS" },
1740         { NET_IPV4_CONF_SHARED_MEDIA, "NET_IPV4_CONF_SHARED_MEDIA" },
1741         { NET_IPV4_CONF_RP_FILTER, "NET_IPV4_CONF_RP_FILTER" },
1742         { NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, "NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE" },
1743         { NET_IPV4_CONF_BOOTP_RELAY, "NET_IPV4_CONF_BOOTP_RELAY" },
1744         { NET_IPV4_CONF_LOG_MARTIANS, "NET_IPV4_CONF_LOG_MARTIANS" },
1745         { 0, NULL }
1746 };
1747
1748 static struct xlat sysctl_net_ipv6[] = {
1749         { NET_IPV6_CONF, "NET_IPV6_CONF" },
1750         { NET_IPV6_NEIGH, "NET_IPV6_NEIGH" },
1751         { NET_IPV6_ROUTE, "NET_IPV6_ROUTE" },
1752         { 0, NULL }
1753 };
1754
1755 static struct xlat sysctl_net_ipv6_route[] = {
1756         { NET_IPV6_ROUTE_FLUSH, "NET_IPV6_ROUTE_FLUSH" },
1757         { NET_IPV6_ROUTE_GC_THRESH, "NET_IPV6_ROUTE_GC_THRESH" },
1758         { NET_IPV6_ROUTE_MAX_SIZE, "NET_IPV6_ROUTE_MAX_SIZE" },
1759         { NET_IPV6_ROUTE_GC_MIN_INTERVAL, "NET_IPV6_ROUTE_GC_MIN_INTERVAL" },
1760         { NET_IPV6_ROUTE_GC_TIMEOUT, "NET_IPV6_ROUTE_GC_TIMEOUT" },
1761         { NET_IPV6_ROUTE_GC_INTERVAL, "NET_IPV6_ROUTE_GC_INTERVAL" },
1762         { NET_IPV6_ROUTE_GC_ELASTICITY, "NET_IPV6_ROUTE_GC_ELASTICITY" },
1763         { 0, NULL }
1764 };
1765
1766 int
1767 sys_sysctl(tcp)
1768 struct tcb *tcp;
1769 {
1770         struct __sysctl_args info;
1771         int *name;
1772         umove (tcp, tcp->u_arg[0], &info);
1773
1774         name = alloca (sizeof (int) * info.nlen);
1775         umoven(tcp, (size_t) info.name, sizeof (int) * info.nlen, (char *) name);
1776
1777         if (entering(tcp)) {
1778                 int cnt = 0;
1779
1780                 tprintf("{{");
1781
1782                 if (info.nlen == 0)
1783                         goto out;
1784                 printxval(sysctl_root, name[0], "CTL_???");
1785                 ++cnt;
1786
1787                 if (info.nlen == 1)
1788                         goto out;
1789                 switch (name[0]) {
1790                 case CTL_KERN:
1791                         tprintf(", ");
1792                         printxval(sysctl_kern, name[1], "KERN_???");
1793                         ++cnt;
1794                         break;
1795                 case CTL_VM:
1796                         tprintf(", ");
1797                         printxval(sysctl_vm, name[1], "VM_???");
1798                         ++cnt;
1799                         break;
1800                 case CTL_NET:
1801                         tprintf(", ");
1802                         printxval(sysctl_net, name[1], "NET_???");
1803                         ++cnt;
1804
1805                         if (info.nlen == 2)
1806                                 goto out;
1807                         switch (name[1]) {
1808                         case NET_CORE:
1809                                 tprintf(", ");
1810                                 printxval(sysctl_net_core, name[2],
1811                                           "NET_CORE_???");
1812                                 break;
1813                         case NET_UNIX:
1814                                 tprintf(", ");
1815                                 printxval(sysctl_net_unix, name[2],
1816                                           "NET_UNIX_???");
1817                                 break;
1818                         case NET_IPV4:
1819                                 tprintf(", ");
1820                                 printxval(sysctl_net_ipv4, name[2],
1821                                           "NET_IPV4_???");
1822
1823                                 if (info.nlen == 3)
1824                                         goto out;
1825                                 switch (name[2]) {
1826                                 case NET_IPV4_ROUTE:
1827                                         tprintf(", ");
1828                                         printxval(sysctl_net_ipv4_route,
1829                                                   name[3],
1830                                                   "NET_IPV4_ROUTE_???");
1831                                         break;
1832                                 case NET_IPV4_CONF:
1833                                         tprintf(", ");
1834                                         printxval(sysctl_net_ipv4_conf,
1835                                                   name[3],
1836                                                   "NET_IPV4_CONF_???");
1837                                         break;
1838                                 default:
1839                                         goto out;
1840                                 }
1841                                 break;
1842                         case NET_IPV6:
1843                                 tprintf(", ");
1844                                 printxval(sysctl_net_ipv6, name[2],
1845                                           "NET_IPV6_???");
1846
1847                                 if (info.nlen == 3)
1848                                         goto out;
1849                                 switch (name[2]) {
1850                                 case NET_IPV6_ROUTE:
1851                                         tprintf(", ");
1852                                         printxval(sysctl_net_ipv6_route,
1853                                                   name[3],
1854                                                   "NET_IPV6_ROUTE_???");
1855                                         break;
1856                                 default:
1857                                         goto out;
1858                                 }
1859                                 break;
1860                         default:
1861                                 goto out;
1862                         }
1863                         break;
1864                 default:
1865                         goto out;
1866                 }
1867         out:
1868                 while (cnt < info.nlen)
1869                         tprintf(", %x", name[cnt++]);
1870                 tprintf("}, %d, ", info.nlen);
1871         } else {
1872                 size_t oldlen;
1873                 umove(tcp, (size_t)info.oldlenp, &oldlen);
1874                 if (info.nlen >= 2
1875                     && ((name[0] == CTL_KERN
1876                          && (name[1] == KERN_OSRELEASE
1877                              || name[1] == KERN_OSTYPE
1878 #ifdef KERN_JAVA_INTERPRETER
1879                              || name[1] == KERN_JAVA_INTERPRETER
1880 #endif
1881 #ifdef KERN_JAVA_APPLETVIEWER
1882                              || name[1] == KERN_JAVA_APPLETVIEWER
1883 #endif
1884                                  )))) {
1885                         printpath(tcp, (size_t)info.oldval);
1886                         tprintf(", %Zu, ", oldlen);
1887                         if (info.newval == 0)
1888                                 tprintf("NULL");
1889                         else if (syserror(tcp))
1890                                 tprintf("%p", info.newval);
1891                         else
1892                                 printpath(tcp, (size_t)info.newval);
1893                         tprintf(", %Zd", info.newlen);
1894                 } else {
1895                         tprintf("%p, %Zd, %p, %Zd", info.oldval, oldlen,
1896                                 info.newval, info.newlen);
1897                 }
1898                 tprintf("}");
1899         }
1900         return 0;
1901 }
1902 #else
1903 int sys_sysctl(tcp)
1904 struct tcb *tcp;
1905 {
1906         return printargs(tcp);
1907 }
1908 #endif
1909
1910 #ifdef FREEBSD
1911 #include <sys/sysctl.h>
1912
1913 int sys___sysctl(tcp)
1914 struct tcb *tcp;
1915 {
1916         int qoid[CTL_MAXNAME+2];
1917         char ctl[1024];
1918         size_t len;
1919         int i, numeric;
1920         
1921         if (entering(tcp)) {
1922                 if (tcp->u_arg[1] < 0 || tcp->u_arg[1] > CTL_MAXNAME ||
1923                     (umoven(tcp, tcp->u_arg[0], tcp->u_arg[1] * sizeof(int),
1924                             (char *) (qoid + 2)) < 0))
1925                         tprintf("[...], ");
1926                 else {
1927                         /* Use sysctl to ask the name of the current MIB
1928                            This uses the undocumented "Staff-functions" used
1929                            by the sysctl program. See kern_sysctl.c for
1930                            details. */
1931                         qoid[0] = 0; /* sysctl */
1932                         qoid[1] = 1; /* name */
1933                         i = sizeof(ctl);
1934                         tprintf("[");
1935                         if (sysctl(qoid, tcp->u_arg[1] + 2, ctl, &i, 0, 0) >= 0) {
1936                                 numeric = !abbrev(tcp);
1937                                 tprintf("%s%s", ctl, numeric ? ", " : "");
1938                         } else
1939                                 numeric = 1;
1940                         if (numeric) {
1941                                 for (i = 0; i < tcp->u_arg[1]; i++)
1942                                         tprintf("%s%d", i ? "." : "", qoid[i + 2]);
1943                         }
1944                         tprintf("], ");
1945                         tprintf("%lu, ", tcp->u_arg[1]);
1946                 }
1947         } else {
1948                 if (!syserror(tcp) && (umove(tcp, tcp->u_arg[3], &len) >= 0)) {
1949                         printstr(tcp, tcp->u_arg[2], len);
1950                         tprintf(", [%u], ", len);
1951                 } else 
1952                         tprintf("%#lx, %#lx, ", tcp->u_arg[2], tcp->u_arg[3]);
1953                 printstr(tcp, tcp->u_arg[4], tcp->u_arg[5]);
1954                 tprintf(", %lu", tcp->u_arg[5]);
1955         }
1956         return 0;
1957 }
1958 #endif
1959
1960 #if UNIXWARE >= 2
1961
1962 #include <sys/ksym.h>
1963 #include <sys/elf.h>
1964
1965 static struct xlat ksym_flags[] = {
1966         { STT_NOTYPE,   "STT_NOTYPE"    },      
1967         { STT_FUNC,     "STT_FUNC"      },      
1968         { STT_OBJECT,   "STT_OBJECT"    },      
1969         { 0,            NULL            },
1970 };
1971
1972 int
1973 sys_getksym(tcp)
1974 struct tcb *tcp;
1975 {
1976         if (entering (tcp)) {
1977                 printstr(tcp, tcp->u_arg[0], -1);
1978                 tprintf(", ");
1979         }
1980         else {
1981                 if (syserror(tcp)) {
1982                         tprintf("%#lx, %#lx",
1983                                 tcp->u_arg[1], tcp->u_arg[2]);
1984                 }
1985                 else {
1986                         int val;
1987                         printnum (tcp, tcp->u_arg[1], "%#lx");
1988                         tprintf(", ");
1989                         if (umove(tcp, tcp->u_arg[2], &val) < 0) {
1990                                 tprintf("%#lx", tcp->u_arg[2]);
1991                         }
1992                         else {
1993                                 tprintf("[");
1994                                 printxval (ksym_flags, val, "STT_???");
1995                                 tprintf("]");
1996                         }
1997                 }
1998         }
1999
2000         return 0;
2001 }
2002
2003 #endif /* UNIXWARE > 2 */
2004
2005 #ifdef MIPS
2006
2007 static struct xlat_sysmips[] = {
2008         { SETNAME,              "SETNAME"       },
2009         { FLUSH_CACHE,          "FLUSH_CACHE"   },
2010         { MIPS_FIXADE,          "MIPS_FIXADE"   },
2011         { MIPS_RDNVRAM,         "MIPS_RDNVRAM"  },
2012         { MIPS_ATOMIC_SET,      "MIPS_ATOMIC_SET"       },
2013         { 0, NULL }
2014 };
2015
2016 int sys_sysmips(tcp)
2017 struct tcb *tcp;
2018 {
2019         if (entering(tcp)) {
2020                 printxval(xlat_sysmips, tcp->u_arg[0], "???");
2021                 tprintf(", ");
2022                 if (!verbose(tcp)) {
2023                         tprintf("%d, %d, %d", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2024                 } else if (tcp->u_arg[0]==SETNAME) {
2025                         char nodename[__NEW_UTS_LEN_1];
2026                         if (umovestr(tcp, tcp->u_arg[1], (__NEW_UTS_LEN_1), nodename) < 0)
2027                                 tprintf(", %#lx", tcp->u_arg[1]);
2028                         else
2029                                 tprintf(", \"%s\"", nodename);
2030                 } else if (tcp->u_arg[0]==MIPS_ATOMIC_SET) {
2031                         tprintf(", %#lx, 0x%x", tcp->u_arg[1], tcp->u_arg[2]);
2032                 } else if (tcp->u_arg[0]==MIPS_FIXADE) {
2033                         tprintf(", 0x%x", tcp->u_arg[1]);
2034                 } else {
2035                         tprintf("%d, %d, %d", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2036                 }
2037         }
2038
2039         return 0;
2040 }
2041
2042 #endif /* MIPS */