system.c revision 949f451bfa2956218af8ce827332df2f55f78bc8
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#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 52#define MS_SILENT 32768 53#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ 54#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 */ 58#define MS_ACTIVE (1<<30) 59#define MS_NOUSER (1<<31) 60#define MS_MGC_VAL 0xc0ed0000 /* Magic flag number */ 61#define MS_MGC_MSK 0xffff0000 /* Magic flag mask */ 62 63#include <sys/socket.h> 64#include <netinet/in.h> 65#include <arpa/inet.h> 66 67#include <sys/syscall.h> 68 69#ifdef SYS_capget 70#include <linux/capability.h> 71#endif 72 73#ifdef SYS_cacheflush 74#include <asm/cachectl.h> 75#endif 76 77#ifdef HAVE_LINUX_USTNAME_H 78#include <linux/utsname.h> 79#endif 80 81#ifdef MIPS 82#include <asm/sysmips.h> 83#endif 84 85#include <linux/sysctl.h> 86 87static const struct xlat mount_flags[] = { 88 { MS_MGC_VAL, "MS_MGC_VAL" }, 89 { MS_RDONLY, "MS_RDONLY" }, 90 { MS_NOSUID, "MS_NOSUID" }, 91 { MS_NODEV, "MS_NODEV" }, 92 { MS_NOEXEC, "MS_NOEXEC" }, 93 { MS_SYNCHRONOUS,"MS_SYNCHRONOUS"}, 94 { MS_REMOUNT, "MS_REMOUNT" }, 95 { 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" }, 101 { MS_SILENT, "MS_SILENT" }, 102 { MS_POSIXACL, "MS_POSIXACL" }, 103 { MS_UNBINDABLE,"MS_UNBINDABLE" }, 104 { MS_PRIVATE, "MS_PRIVATE" }, 105 { MS_SLAVE, "MS_SLAVE" }, 106 { MS_SHARED, "MS_SHARED" }, 107 { MS_ACTIVE, "MS_ACTIVE" }, 108 { MS_NOUSER, "MS_NOUSER" }, 109 { 0, NULL }, 110}; 111 112int 113sys_mount(struct tcb *tcp) 114{ 115 if (entering(tcp)) { 116 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 128 printpath(tcp, tcp->u_arg[0]); 129 tprintf(", "); 130 131 printpath(tcp, tcp->u_arg[1]); 132 tprintf(", "); 133 134 if (ignore_type && tcp->u_arg[2]) 135 tprintf("%#lx", tcp->u_arg[2]); 136 else 137 printstr(tcp, tcp->u_arg[2], -1); 138 tprintf(", "); 139 140 printflags(mount_flags, tcp->u_arg[3], "MS_???"); 141 tprintf(", "); 142 143 if (ignore_data && tcp->u_arg[4]) 144 tprintf("%#lx", tcp->u_arg[4]); 145 else 146 printstr(tcp, tcp->u_arg[4], -1); 147 } 148 return 0; 149} 150 151#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 162int 163sys_umount2(struct tcb *tcp) 164{ 165 if (entering(tcp)) { 166 printstr(tcp, tcp->u_arg[0], -1); 167 tprintf(", "); 168 printflags(umount_flags, tcp->u_arg[1], "MNT_???"); 169 } 170 return 0; 171} 172 173/* These are not macros, but enums. We just copy the values by hand 174 from Linux 2.6.9 here. */ 175static const struct xlat personality_options[] = { 176 { 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" }, 197 { 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 209#include <linux/reboot.h> 210static const struct xlat bootflags1[] = { 211 { LINUX_REBOOT_MAGIC1, "LINUX_REBOOT_MAGIC1" }, 212 { 0, NULL }, 213}; 214 215static const struct xlat bootflags2[] = { 216 { 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 222static const struct xlat bootflags3[] = { 223 { 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)) { 237 printflags(bootflags1, tcp->u_arg[0], "LINUX_REBOOT_MAGIC_???"); 238 tprintf(", "); 239 printflags(bootflags2, tcp->u_arg[1], "LINUX_REBOOT_MAGIC_???"); 240 tprintf(", "); 241 printflags(bootflags3, tcp->u_arg[2], "LINUX_REBOOT_CMD_???"); 242 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 250#ifdef M68K 251static const struct xlat cacheflush_scope[] = { 252#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 264static const struct xlat cacheflush_flags[] = { 265#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 */ 288 printflags(cacheflush_flags, tcp->u_arg[2], "FLUSH_CACHE_???"); 289 /* len */ 290 tprintf(", %lu", tcp->u_arg[3]); 291 } 292 return 0; 293} 294#endif /* M68K */ 295 296#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 323#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 346static const struct xlat bootflags[] = { 347 { 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)) { 366 printflags(bootflags, tcp->u_arg[0], "RB_???"); 367 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 404static const struct xlat mountflags[] = { 405 { 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 424static const struct xlat nfsflags[] = { 425 { 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(", "); 464 printflags(mountflags, tcp->u_arg[2] & ~M_NEWTYPE, "M_???"); 465 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(", "); 484 printflags(nfsflags, a.flags, "NFSMNT_???"); 485 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 543static const struct xlat ex_auth_flags[] = { 544 { 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 589static const struct xlat sysconflimits[] = { 590#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 617int 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) 630static const struct xlat pathconflimits[] = { 631#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 661 662int 663sys_pathconf(tcp) 664struct tcb *tcp; 665{ 666 if (entering(tcp)) { 667 printstr(tcp, tcp->u_arg[0], -1); 668 tprintf(", "); 669 printxval(pathconflimits, tcp->u_arg[1], "_PC_???"); 670 } 671 return 0; 672} 673 674int 675sys_fpathconf(tcp) 676struct tcb *tcp; 677{ 678 if (entering(tcp)) { 679 tprintf("%lu, ", tcp->u_arg[0]); 680 printxval(pathconflimits, tcp->u_arg[1], "_PC_???"); 681 } 682 return 0; 683} 684 685#endif /* SUNOS4 || FREEBSD */ 686 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 697static const struct xlat sysconfig_options[] = { 698#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 785static const struct xlat sysinfo_options[] = { 786 { 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 833static const struct xlat syssgi_options[] = { 834 { SGI_SYSID, "SGI_SYSID" }, 835#ifdef SGI_RDUBLK 836 { SGI_RDUBLK, "SGI_RDUBLK" }, 837#endif 838 { 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" }, 894#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 915 { 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 925#ifdef SGI_SET_FP_PRECISE 926 { SGI_SET_FP_PRECISE, "SGI_SET_FP_PRECISE" }, 927#endif 928 { SGI_TOSSTSAVE, "SGI_TOSSTSAVE" }, 929 { SGI_FDHI, "SGI_FDHI" }, 930#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 936 { SGI_MINRSS, "SGI_MINRSS" }, 937#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 949#ifdef SGI_GET_CONFIG_SMM 950 { SGI_GET_CONFIG_SMM, "SGI_GET_CONFIG_SMM" }, 951#endif 952#ifdef SGI_FP_IMPRECISE_SUPP 953 { SGI_FP_IMPRECISE_SUPP,"SGI_FP_IMPRECISE_SUPP" }, 954#endif 955#ifdef SGI_CONFIG_NSMM_SUPP 956 { SGI_CONFIG_NSMM_SUPP, "SGI_CONFIG_NSMM_SUPP" }, 957#endif 958#ifdef SGI_RT_TSTAMP_CREATE 959 { SGI_RT_TSTAMP_CREATE, "SGI_RT_TSTAMP_CREATE" }, 960#endif 961#ifdef SGI_RT_TSTAMP_DELETE 962 { SGI_RT_TSTAMP_DELETE, "SGI_RT_TSTAMP_DELETE" }, 963#endif 964#ifdef SGI_RT_TSTAMP_START 965 { SGI_RT_TSTAMP_START, "SGI_RT_TSTAMP_START" }, 966#endif 967#ifdef SGI_RT_TSTAMP_STOP 968 { SGI_RT_TSTAMP_STOP, "SGI_RT_TSTAMP_STOP" }, 969#endif 970#ifdef SGI_RT_TSTAMP_ADDR 971 { SGI_RT_TSTAMP_ADDR, "SGI_RT_TSTAMP_ADDR" }, 972#endif 973#ifdef SGI_RT_TSTAMP_MASK 974 { SGI_RT_TSTAMP_MASK, "SGI_RT_TSTAMP_MASK" }, 975#endif 976#ifdef SGI_RT_TSTAMP_EOB_MODE 977 { SGI_RT_TSTAMP_EOB_MODE,"SGI_RT_TSTAMP_EOB_MODE"}, 978#endif 979#ifdef SGI_USE_FP_BCOPY 980 { SGI_USE_FP_BCOPY, "SGI_USE_FP_BCOPY" }, 981#endif 982#ifdef SGI_GET_UST 983 { SGI_GET_UST, "SGI_GET_UST" }, 984#endif 985#ifdef SGI_SPECULATIVE_EXEC 986 { SGI_SPECULATIVE_EXEC, "SGI_SPECULATIVE_EXEC" }, 987#endif 988#ifdef SGI_XLV_NEXT_RQST 989 { SGI_XLV_NEXT_RQST, "SGI_XLV_NEXT_RQST" }, 990#endif 991#ifdef SGI_XLV_ATTR_CURSOR 992 { SGI_XLV_ATTR_CURSOR, "SGI_XLV_ATTR_CURSOR" }, 993#endif 994#ifdef SGI_XLV_ATTR_GET 995 { SGI_XLV_ATTR_GET, "SGI_XLV_ATTR_GET" }, 996#endif 997#ifdef SGI_XLV_ATTR_SET 998 { SGI_XLV_ATTR_SET, "SGI_XLV_ATTR_SET" }, 999#endif 1000#ifdef SGI_BTOOLSIZE 1001 { SGI_BTOOLSIZE, "SGI_BTOOLSIZE" }, 1002#endif 1003#ifdef SGI_BTOOLGET 1004 { SGI_BTOOLGET, "SGI_BTOOLGET" }, 1005#endif 1006#ifdef SGI_BTOOLREINIT 1007 { SGI_BTOOLREINIT, "SGI_BTOOLREINIT" }, 1008#endif 1009#ifdef SGI_CREATE_UUID 1010 { SGI_CREATE_UUID, "SGI_CREATE_UUID" }, 1011#endif 1012#ifdef SGI_NOFPE 1013 { SGI_NOFPE, "SGI_NOFPE" }, 1014#endif 1015#ifdef SGI_OLD_SOFTFP 1016 { SGI_OLD_SOFTFP, "SGI_OLD_SOFTFP" }, 1017#endif 1018#ifdef SGI_FS_INUMBERS 1019 { SGI_FS_INUMBERS, "SGI_FS_INUMBERS" }, 1020#endif 1021#ifdef SGI_FS_BULKSTAT 1022 { SGI_FS_BULKSTAT, "SGI_FS_BULKSTAT" }, 1023#endif 1024#ifdef SGI_RT_TSTAMP_WAIT 1025 { SGI_RT_TSTAMP_WAIT, "SGI_RT_TSTAMP_WAIT" }, 1026#endif 1027#ifdef SGI_RT_TSTAMP_UPDATE 1028 { SGI_RT_TSTAMP_UPDATE, "SGI_RT_TSTAMP_UPDATE" }, 1029#endif 1030#ifdef SGI_PATH_TO_HANDLE 1031 { SGI_PATH_TO_HANDLE, "SGI_PATH_TO_HANDLE" }, 1032#endif 1033#ifdef SGI_PATH_TO_FSHANDLE 1034 { SGI_PATH_TO_FSHANDLE, "SGI_PATH_TO_FSHANDLE" }, 1035#endif 1036#ifdef SGI_FD_TO_HANDLE 1037 { SGI_FD_TO_HANDLE, "SGI_FD_TO_HANDLE" }, 1038#endif 1039#ifdef SGI_OPEN_BY_HANDLE 1040 { SGI_OPEN_BY_HANDLE, "SGI_OPEN_BY_HANDLE" }, 1041#endif 1042#ifdef SGI_READLINK_BY_HANDLE 1043 { SGI_READLINK_BY_HANDLE,"SGI_READLINK_BY_HANDLE"}, 1044#endif 1045#ifdef SGI_READ_DANGID 1046 { SGI_READ_DANGID, "SGI_READ_DANGID" }, 1047#endif 1048#ifdef SGI_CONST 1049 { SGI_CONST, "SGI_CONST" }, 1050#endif 1051#ifdef SGI_XFS_FSOPERATIONS 1052 { SGI_XFS_FSOPERATIONS, "SGI_XFS_FSOPERATIONS" }, 1053#endif 1054#ifdef SGI_SETASH 1055 { SGI_SETASH, "SGI_SETASH" }, 1056#endif 1057#ifdef SGI_GETASH 1058 { SGI_GETASH, "SGI_GETASH" }, 1059#endif 1060#ifdef SGI_SETPRID 1061 { SGI_SETPRID, "SGI_SETPRID" }, 1062#endif 1063#ifdef SGI_GETPRID 1064 { SGI_GETPRID, "SGI_GETPRID" }, 1065#endif 1066#ifdef SGI_SETSPINFO 1067 { SGI_SETSPINFO, "SGI_SETSPINFO" }, 1068#endif 1069#ifdef SGI_GETSPINFO 1070 { SGI_GETSPINFO, "SGI_GETSPINFO" }, 1071#endif 1072#ifdef SGI_SHAREII 1073 { SGI_SHAREII, "SGI_SHAREII" }, 1074#endif 1075#ifdef SGI_NEWARRAYSESS 1076 { SGI_NEWARRAYSESS, "SGI_NEWARRAYSESS" }, 1077#endif 1078#ifdef SGI_GETDFLTPRID 1079 { SGI_GETDFLTPRID, "SGI_GETDFLTPRID" }, 1080#endif 1081#ifdef SGI_SET_DISMISSED_EXC_CNT 1082 { SGI_SET_DISMISSED_EXC_CNT,"SGI_SET_DISMISSED_EXC_CNT" }, 1083#endif 1084#ifdef SGI_GET_DISMISSED_EXC_CNT 1085 { SGI_GET_DISMISSED_EXC_CNT,"SGI_GET_DISMISSED_EXC_CNT" }, 1086#endif 1087#ifdef SGI_CYCLECNTR_SIZE 1088 { SGI_CYCLECNTR_SIZE, "SGI_CYCLECNTR_SIZE" }, 1089#endif 1090#ifdef SGI_QUERY_FASTTIMER 1091 { SGI_QUERY_FASTTIMER, "SGI_QUERY_FASTTIMER" }, 1092#endif 1093#ifdef SGI_PIDSINASH 1094 { SGI_PIDSINASH, "SGI_PIDSINASH" }, 1095#endif 1096#ifdef SGI_ULI 1097 { SGI_ULI, "SGI_ULI" }, 1098#endif 1099#ifdef SGI_LPG_SHMGET 1100 { SGI_LPG_SHMGET, "SGI_LPG_SHMGET" }, 1101#endif 1102#ifdef SGI_LPG_MAP 1103 { SGI_LPG_MAP, "SGI_LPG_MAP" }, 1104#endif 1105#ifdef SGI_CACHEFS_SYS 1106 { SGI_CACHEFS_SYS, "SGI_CACHEFS_SYS" }, 1107#endif 1108#ifdef SGI_NFSNOTIFY 1109 { SGI_NFSNOTIFY, "SGI_NFSNOTIFY" }, 1110#endif 1111#ifdef SGI_LOCKDSYS 1112 { SGI_LOCKDSYS, "SGI_LOCKDSYS" }, 1113#endif 1114#ifdef SGI_EVENTCTR 1115 { SGI_EVENTCTR, "SGI_EVENTCTR" }, 1116#endif 1117#ifdef SGI_GETPRUSAGE 1118 { SGI_GETPRUSAGE, "SGI_GETPRUSAGE" }, 1119#endif 1120#ifdef SGI_PROCMASK_LOCATION 1121 { SGI_PROCMASK_LOCATION,"SGI_PROCMASK_LOCATION" }, 1122#endif 1123#ifdef SGI_UNUSED 1124 { SGI_UNUSED, "SGI_UNUSED" }, 1125#endif 1126#ifdef SGI_CKPT_SYS 1127 { SGI_CKPT_SYS, "SGI_CKPT_SYS" }, 1128#endif 1129#ifdef SGI_CKPT_SYS 1130 { SGI_CKPT_SYS, "SGI_CKPT_SYS" }, 1131#endif 1132#ifdef SGI_GETGRPPID 1133 { SGI_GETGRPPID, "SGI_GETGRPPID" }, 1134#endif 1135#ifdef SGI_GETSESPID 1136 { SGI_GETSESPID, "SGI_GETSESPID" }, 1137#endif 1138#ifdef SGI_ENUMASHS 1139 { SGI_ENUMASHS, "SGI_ENUMASHS" }, 1140#endif 1141#ifdef SGI_SETASMACHID 1142 { SGI_SETASMACHID, "SGI_SETASMACHID" }, 1143#endif 1144#ifdef SGI_GETASMACHID 1145 { SGI_GETASMACHID, "SGI_GETASMACHID" }, 1146#endif 1147#ifdef SGI_GETARSESS 1148 { SGI_GETARSESS, "SGI_GETARSESS" }, 1149#endif 1150#ifdef SGI_JOINARRAYSESS 1151 { SGI_JOINARRAYSESS, "SGI_JOINARRAYSESS" }, 1152#endif 1153#ifdef SGI_SPROC_KILL 1154 { SGI_SPROC_KILL, "SGI_SPROC_KILL" }, 1155#endif 1156#ifdef SGI_DBA_CONFIG 1157 { SGI_DBA_CONFIG, "SGI_DBA_CONFIG" }, 1158#endif 1159#ifdef SGI_RELEASE_NAME 1160 { SGI_RELEASE_NAME, "SGI_RELEASE_NAME" }, 1161#endif 1162#ifdef SGI_SYNCH_CACHE_HANDLER 1163 { SGI_SYNCH_CACHE_HANDLER,"SGI_SYNCH_CACHE_HANDLER"}, 1164#endif 1165#ifdef SGI_SWASH_INIT 1166 { SGI_SWASH_INIT, "SGI_SWASH_INIT" }, 1167#endif 1168#ifdef SGI_NUMA_MIGR_PAGE 1169 { SGI_NUMA_MIGR_PAGE, "SGI_NUMA_MIGR_PAGE" }, 1170#endif 1171#ifdef SGI_NUMA_MIGR_PAGE_ALT 1172 { SGI_NUMA_MIGR_PAGE_ALT,"SGI_NUMA_MIGR_PAGE_ALT"}, 1173#endif 1174#ifdef SGI_KAIO_USERINIT 1175 { SGI_KAIO_USERINIT, "SGI_KAIO_USERINIT" }, 1176#endif 1177#ifdef SGI_KAIO_READ 1178 { SGI_KAIO_READ, "SGI_KAIO_READ" }, 1179#endif 1180#ifdef SGI_KAIO_WRITE 1181 { SGI_KAIO_WRITE, "SGI_KAIO_WRITE" }, 1182#endif 1183#ifdef SGI_KAIO_SUSPEND 1184 { SGI_KAIO_SUSPEND, "SGI_KAIO_SUSPEND" }, 1185#endif 1186#ifdef SGI_KAIO_STATS 1187 { SGI_KAIO_STATS, "SGI_KAIO_STATS" }, 1188#endif 1189#ifdef SGI_INITIAL_PT_SPROC 1190 { SGI_INITIAL_PT_SPROC, "SGI_INITIAL_PT_SPROC" }, 1191#endif 1192 { 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 1222static const struct xlat mount_flags[] = { 1223 { 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 1236static const struct xlat nfs_flags[] = { 1237 { 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" }, 1243#ifdef NFSMNT_NOINT /* IRIX 6 */ 1244 { NFSMNT_NOINT, "NFSMNT_NOINT" }, 1245#endif 1246#ifdef NFSMNT_INT /* IRIX 5 */ 1247 { NFSMNT_INT, "NFSMNT_INT" }, 1248#endif 1249 { 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" }, 1259#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 1265 { 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(", "); 1277 printflags(mount_flags, tcp->u_arg[2], "MS_???"); 1278 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="); 1294 printflags(nfs_flags, args.flags, "NFSMNT_???"); 1295 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 1310#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 1322static const struct xlat mount_flags[] = { 1323 { 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 1336static const struct xlat vxfs_flags[] = { 1337 { 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 1358static const struct xlat nfs_flags[] = { 1359 { 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(", "); 1389 printflags(mount_flags, tcp->u_arg[2], "MS_???"); 1390 /* 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="); 1413 printflags(vxfs_flags, args.mflags, "VX_MS_???"); 1414 if (args.mflags & VX_MS_SNAPSHOT) { 1415 tprintf (", snapof="); 1416 printstr (tcp, 1417 (long) args.primaryspec, 1418 -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="); 1446 printflags(nfs_flags, args.flags, "NFSMNT_???"); 1447 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 1462int 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} 1474#endif /* !UNIXWARE */ 1475 1476#endif /* !MIPS */ 1477 1478#endif /* SVR4 */ 1479 1480#ifdef SYS_capget 1481 1482static const struct xlat capabilities[] = { 1483 { 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#ifdef CAP_MKNOD 1511 { 1<<CAP_MKNOD, "CAP_MKNOD" }, 1512#endif 1513#ifdef CAP_LEASE 1514 { 1<<CAP_LEASE, "CAP_LEASE" }, 1515#endif 1516#ifdef CAP_AUDIT_WRITE 1517 { 1<<CAP_AUDIT_WRITE, "CAP_AUDIT_WRITE"}, 1518#endif 1519#ifdef CAP_AUDIT_CONTROL 1520 { 1<<CAP_AUDIT_CONTROL, "CAP_AUDIT_CONTROL"}, 1521#endif 1522#ifdef CAP_SETFCAP 1523 { 1<<CAP_SETFCAP, "CAP_SETFCAP" }, 1524#endif 1525 { 0, NULL }, 1526}; 1527 1528 1529int 1530sys_capget(tcp) 1531struct tcb *tcp; 1532{ 1533 static cap_user_header_t arg0 = NULL; 1534 static cap_user_data_t arg1 = NULL; 1535 1536 if(!entering(tcp)) { 1537 if (!arg0) { 1538 if ((arg0 = malloc(sizeof(*arg0))) == NULL) { 1539 fprintf(stderr, "out of memory\n"); 1540 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]); 1541 return -1; 1542 } 1543 } 1544 if (!arg1) { 1545 if ((arg1 = malloc(sizeof(*arg1))) == NULL) { 1546 fprintf(stderr, "out of memory\n"); 1547 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]); 1548 return -1; 1549 } 1550 } 1551 1552 if (!tcp->u_arg[0]) 1553 tprintf("NULL"); 1554 else if (!verbose(tcp)) 1555 tprintf("%#lx", tcp->u_arg[0]); 1556 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0) 1557 tprintf("???"); 1558 else { 1559 tprintf("%#x, %d", arg0->version, arg0->pid); 1560 } 1561 tprintf(", "); 1562 if (!tcp->u_arg[1]) 1563 tprintf("NULL"); 1564 else if (!verbose(tcp)) 1565 tprintf("%#lx", tcp->u_arg[1]); 1566 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0) 1567 tprintf("???"); 1568 else { 1569 tprintf("{"); 1570 printflags(capabilities, arg1->effective, "CAP_???"); 1571 tprintf(", "); 1572 printflags(capabilities, arg1->permitted, "CAP_???"); 1573 tprintf(", "); 1574 printflags(capabilities, arg1->inheritable, "CAP_???"); 1575 tprintf("}"); 1576 } 1577 } 1578 return 0; 1579} 1580 1581int 1582sys_capset(tcp) 1583struct tcb *tcp; 1584{ 1585 static cap_user_header_t arg0 = NULL; 1586 static cap_user_data_t arg1 = NULL; 1587 1588 if(entering(tcp)) { 1589 if (!arg0) { 1590 if ((arg0 = malloc(sizeof(*arg0))) == NULL) { 1591 fprintf(stderr, "out of memory\n"); 1592 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]); 1593 return -1; 1594 } 1595 } 1596 if (!arg1) { 1597 if ((arg1 = malloc(sizeof(*arg1))) == NULL) { 1598 fprintf(stderr, "out of memory\n"); 1599 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]); 1600 return -1; 1601 } 1602 } 1603 1604 if (!tcp->u_arg[0]) 1605 tprintf("NULL"); 1606 else if (!verbose(tcp)) 1607 tprintf("%#lx", tcp->u_arg[0]); 1608 else if (umoven(tcp, tcp->u_arg[0], sizeof(*arg0), (char *) arg0) < 0) 1609 tprintf("???"); 1610 else { 1611 tprintf("%#x, %d", arg0->version, arg0->pid); 1612 } 1613 tprintf(", "); 1614 if (!tcp->u_arg[1]) 1615 tprintf("NULL"); 1616 else if (!verbose(tcp)) 1617 tprintf("%#lx", tcp->u_arg[1]); 1618 else if (umoven(tcp, tcp->u_arg[1], sizeof(*arg1), (char *) arg1) < 0) 1619 tprintf("???"); 1620 else { 1621 tprintf("{"); 1622 printflags(capabilities, arg1->effective, "CAP_???"); 1623 tprintf(", "); 1624 printflags(capabilities, arg1->permitted, "CAP_???"); 1625 tprintf(", "); 1626 printflags(capabilities, arg1->inheritable, "CAP_???"); 1627 tprintf("}"); 1628 } 1629 } 1630 return 0; 1631} 1632 1633#else 1634 1635int sys_capget(tcp) 1636struct tcb *tcp; 1637{ 1638 return printargs(tcp); 1639} 1640 1641int sys_capset(tcp) 1642struct tcb *tcp; 1643{ 1644 return printargs(tcp); 1645} 1646 1647#endif 1648 1649#ifdef LINUX 1650/* Linux 2.6.18+ headers removed CTL_PROC enum. */ 1651# define CTL_PROC 4 1652# define CTL_CPU 10 /* older headers lack */ 1653static const struct xlat sysctl_root[] = { 1654 { CTL_KERN, "CTL_KERN" }, 1655 { CTL_VM, "CTL_VM" }, 1656 { CTL_NET, "CTL_NET" }, 1657 { CTL_PROC, "CTL_PROC" }, 1658 { CTL_FS, "CTL_FS" }, 1659 { CTL_DEBUG, "CTL_DEBUG" }, 1660 { CTL_DEV, "CTL_DEV" }, 1661 { CTL_BUS, "CTL_BUS" }, 1662 { CTL_ABI, "CTL_ABI" }, 1663 { CTL_CPU, "CTL_CPU" }, 1664 { 0, NULL } 1665}; 1666 1667static const struct xlat sysctl_kern[] = { 1668 { KERN_OSTYPE, "KERN_OSTYPE" }, 1669 { KERN_OSRELEASE, "KERN_OSRELEASE" }, 1670 { KERN_OSREV, "KERN_OSREV" }, 1671 { KERN_VERSION, "KERN_VERSION" }, 1672 { KERN_SECUREMASK, "KERN_SECUREMASK" }, 1673 { KERN_PROF, "KERN_PROF" }, 1674 { KERN_NODENAME, "KERN_NODENAME" }, 1675 { KERN_DOMAINNAME, "KERN_DOMAINNAME" }, 1676#ifdef KERN_SECURELVL 1677 { KERN_SECURELVL, "KERN_SECURELVL" }, 1678#endif 1679 { KERN_PANIC, "KERN_PANIC" }, 1680#ifdef KERN_REALROOTDEV 1681 { KERN_REALROOTDEV, "KERN_REALROOTDEV" }, 1682#endif 1683#ifdef KERN_JAVA_INTERPRETER 1684 { KERN_JAVA_INTERPRETER, "KERN_JAVA_INTERPRETER" }, 1685#endif 1686#ifdef KERN_JAVA_APPLETVIEWER 1687 { KERN_JAVA_APPLETVIEWER, "KERN_JAVA_APPLETVIEWER" }, 1688#endif 1689 { KERN_SPARC_REBOOT, "KERN_SPARC_REBOOT" }, 1690 { KERN_CTLALTDEL, "KERN_CTLALTDEL" }, 1691 { KERN_PRINTK, "KERN_PRINTK" }, 1692 { KERN_NAMETRANS, "KERN_NAMETRANS" }, 1693 { KERN_PPC_HTABRECLAIM, "KERN_PPC_HTABRECLAIM" }, 1694 { KERN_PPC_ZEROPAGED, "KERN_PPC_ZEROPAGED" }, 1695 { KERN_PPC_POWERSAVE_NAP, "KERN_PPC_POWERSAVE_NAP" }, 1696 { KERN_MODPROBE, "KERN_MODPROBE" }, 1697 { KERN_SG_BIG_BUFF, "KERN_SG_BIG_BUFF" }, 1698 { KERN_ACCT, "KERN_ACCT" }, 1699 { KERN_PPC_L2CR, "KERN_PPC_L2CR" }, 1700 { KERN_RTSIGNR, "KERN_RTSIGNR" }, 1701 { KERN_RTSIGMAX, "KERN_RTSIGMAX" }, 1702 { KERN_SHMMAX, "KERN_SHMMAX" }, 1703 { KERN_MSGMAX, "KERN_MSGMAX" }, 1704 { KERN_MSGMNB, "KERN_MSGMNB" }, 1705 { KERN_MSGPOOL, "KERN_MSGPOOL" }, 1706 { 0, NULL } 1707}; 1708 1709static const struct xlat sysctl_vm[] = { 1710#ifdef VM_SWAPCTL 1711 { VM_SWAPCTL, "VM_SWAPCTL" }, 1712#endif 1713#ifdef VM_UNUSED1 1714 { VM_UNUSED1, "VM_UNUSED1" }, 1715#endif 1716#ifdef VM_SWAPOUT 1717 { VM_SWAPOUT, "VM_SWAPOUT" }, 1718#endif 1719#ifdef VM_UNUSED2 1720 { VM_UNUSED2, "VM_UNUSED2" }, 1721#endif 1722#ifdef VM_FREEPG 1723 { VM_FREEPG, "VM_FREEPG" }, 1724#endif 1725#ifdef VM_UNUSED3 1726 { VM_UNUSED3, "VM_UNUSED3" }, 1727#endif 1728#ifdef VM_BDFLUSH 1729 { VM_BDFLUSH, "VM_BDFLUSH" }, 1730#endif 1731#ifdef VM_UNUSED4 1732 { VM_UNUSED4, "VM_UNUSED4" }, 1733#endif 1734 { VM_OVERCOMMIT_MEMORY, "VM_OVERCOMMIT_MEMORY" }, 1735#ifdef VM_BUFFERMEM 1736 { VM_BUFFERMEM, "VM_BUFFERMEM" }, 1737#endif 1738#ifdef VM_UNUSED5 1739 { VM_UNUSED5, "VM_UNUSED5" }, 1740#endif 1741#ifdef VM_PAGECACHE 1742 { VM_PAGECACHE, "VM_PAGECACHE" }, 1743#endif 1744#ifdef VM_UNUSED7 1745 { VM_UNUSED7, "VM_UNUSED7" }, 1746#endif 1747#ifdef VM_PAGERDAEMON 1748 { VM_PAGERDAEMON, "VM_PAGERDAEMON" }, 1749#endif 1750#ifdef VM_UNUSED8 1751 { VM_UNUSED8, "VM_UNUSED8" }, 1752#endif 1753#ifdef VM_PGT_CACHE 1754 { VM_PGT_CACHE, "VM_PGT_CACHE" }, 1755#endif 1756#ifdef VM_UNUSED9 1757 { VM_UNUSED9, "VM_UNUSED9" }, 1758#endif 1759 { VM_PAGE_CLUSTER, "VM_PAGE_CLUSTER" }, 1760 { 0, NULL }, 1761}; 1762 1763static const struct xlat sysctl_net[] = { 1764 { NET_CORE, "NET_CORE" }, 1765 { NET_ETHER, "NET_ETHER" }, 1766 { NET_802, "NET_802" }, 1767 { NET_UNIX, "NET_UNIX" }, 1768 { NET_IPV4, "NET_IPV4" }, 1769 { NET_IPX, "NET_IPX" }, 1770 { NET_ATALK, "NET_ATALK" }, 1771 { NET_NETROM, "NET_NETROM" }, 1772 { NET_AX25, "NET_AX25" }, 1773 { NET_BRIDGE, "NET_BRIDGE" }, 1774 { NET_ROSE, "NET_ROSE" }, 1775 { NET_IPV6, "NET_IPV6" }, 1776 { NET_X25, "NET_X25" }, 1777 { NET_TR, "NET_TR" }, 1778 { NET_DECNET, "NET_DECNET" }, 1779 { 0, NULL } 1780}; 1781 1782static const struct xlat sysctl_net_core[] = { 1783 { NET_CORE_WMEM_MAX, "NET_CORE_WMEM_MAX" }, 1784 { NET_CORE_RMEM_MAX, "NET_CORE_RMEM_MAX" }, 1785 { NET_CORE_WMEM_DEFAULT, "NET_CORE_WMEM_DEFAULT" }, 1786 { NET_CORE_RMEM_DEFAULT, "NET_CORE_RMEM_DEFAULT" }, 1787 { NET_CORE_MAX_BACKLOG, "NET_CORE_MAX_BACKLOG" }, 1788 { NET_CORE_FASTROUTE, "NET_CORE_FASTROUTE" }, 1789 { NET_CORE_MSG_COST, "NET_CORE_MSG_COST" }, 1790 { NET_CORE_MSG_BURST, "NET_CORE_MSG_BURST" }, 1791 { NET_CORE_OPTMEM_MAX, "NET_CORE_OPTMEM_MAX" }, 1792 { 0, NULL } 1793}; 1794 1795static const struct xlat sysctl_net_unix[] = { 1796 { NET_UNIX_DESTROY_DELAY, "NET_UNIX_DESTROY_DELAY" }, 1797 { NET_UNIX_DELETE_DELAY, "NET_UNIX_DELETE_DELAY" }, 1798 { 0, NULL } 1799}; 1800 1801static const struct xlat sysctl_net_ipv4[] = { 1802 { NET_IPV4_FORWARD, "NET_IPV4_FORWARD" }, 1803 { NET_IPV4_DYNADDR, "NET_IPV4_DYNADDR" }, 1804 { NET_IPV4_CONF, "NET_IPV4_CONF" }, 1805 { NET_IPV4_NEIGH, "NET_IPV4_NEIGH" }, 1806 { NET_IPV4_ROUTE, "NET_IPV4_ROUTE" }, 1807 { NET_IPV4_FIB_HASH, "NET_IPV4_FIB_HASH" }, 1808 { NET_IPV4_TCP_TIMESTAMPS, "NET_IPV4_TCP_TIMESTAMPS" }, 1809 { NET_IPV4_TCP_WINDOW_SCALING, "NET_IPV4_TCP_WINDOW_SCALING" }, 1810 { NET_IPV4_TCP_SACK, "NET_IPV4_TCP_SACK" }, 1811 { NET_IPV4_TCP_RETRANS_COLLAPSE, "NET_IPV4_TCP_RETRANS_COLLAPSE" }, 1812 { NET_IPV4_DEFAULT_TTL, "NET_IPV4_DEFAULT_TTL" }, 1813 { NET_IPV4_AUTOCONFIG, "NET_IPV4_AUTOCONFIG" }, 1814 { NET_IPV4_NO_PMTU_DISC, "NET_IPV4_NO_PMTU_DISC" }, 1815 { NET_IPV4_TCP_SYN_RETRIES, "NET_IPV4_TCP_SYN_RETRIES" }, 1816 { NET_IPV4_IPFRAG_HIGH_THRESH, "NET_IPV4_IPFRAG_HIGH_THRESH" }, 1817 { NET_IPV4_IPFRAG_LOW_THRESH, "NET_IPV4_IPFRAG_LOW_THRESH" }, 1818 { NET_IPV4_IPFRAG_TIME, "NET_IPV4_IPFRAG_TIME" }, 1819 { NET_IPV4_TCP_MAX_KA_PROBES, "NET_IPV4_TCP_MAX_KA_PROBES" }, 1820 { NET_IPV4_TCP_KEEPALIVE_TIME, "NET_IPV4_TCP_KEEPALIVE_TIME" }, 1821 { NET_IPV4_TCP_KEEPALIVE_PROBES, "NET_IPV4_TCP_KEEPALIVE_PROBES" }, 1822 { NET_IPV4_TCP_RETRIES1, "NET_IPV4_TCP_RETRIES1" }, 1823 { NET_IPV4_TCP_RETRIES2, "NET_IPV4_TCP_RETRIES2" }, 1824 { NET_IPV4_TCP_FIN_TIMEOUT, "NET_IPV4_TCP_FIN_TIMEOUT" }, 1825 { NET_IPV4_IP_MASQ_DEBUG, "NET_IPV4_IP_MASQ_DEBUG" }, 1826 { NET_TCP_SYNCOOKIES, "NET_TCP_SYNCOOKIES" }, 1827 { NET_TCP_STDURG, "NET_TCP_STDURG" }, 1828 { NET_TCP_RFC1337, "NET_TCP_RFC1337" }, 1829 { NET_TCP_SYN_TAILDROP, "NET_TCP_SYN_TAILDROP" }, 1830 { NET_TCP_MAX_SYN_BACKLOG, "NET_TCP_MAX_SYN_BACKLOG" }, 1831 { NET_IPV4_LOCAL_PORT_RANGE, "NET_IPV4_LOCAL_PORT_RANGE" }, 1832 { NET_IPV4_ICMP_ECHO_IGNORE_ALL, "NET_IPV4_ICMP_ECHO_IGNORE_ALL" }, 1833 { NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS, "NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS" }, 1834 { NET_IPV4_ICMP_SOURCEQUENCH_RATE, "NET_IPV4_ICMP_SOURCEQUENCH_RATE" }, 1835 { NET_IPV4_ICMP_DESTUNREACH_RATE, "NET_IPV4_ICMP_DESTUNREACH_RATE" }, 1836 { NET_IPV4_ICMP_TIMEEXCEED_RATE, "NET_IPV4_ICMP_TIMEEXCEED_RATE" }, 1837 { NET_IPV4_ICMP_PARAMPROB_RATE, "NET_IPV4_ICMP_PARAMPROB_RATE" }, 1838 { NET_IPV4_ICMP_ECHOREPLY_RATE, "NET_IPV4_ICMP_ECHOREPLY_RATE" }, 1839 { NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES, "NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES" }, 1840 { NET_IPV4_IGMP_MAX_MEMBERSHIPS, "NET_IPV4_IGMP_MAX_MEMBERSHIPS" }, 1841 { 0, NULL } 1842}; 1843 1844static const struct xlat sysctl_net_ipv4_route[] = { 1845 { NET_IPV4_ROUTE_FLUSH, "NET_IPV4_ROUTE_FLUSH" }, 1846 { NET_IPV4_ROUTE_MIN_DELAY, "NET_IPV4_ROUTE_MIN_DELAY" }, 1847 { NET_IPV4_ROUTE_MAX_DELAY, "NET_IPV4_ROUTE_MAX_DELAY" }, 1848 { NET_IPV4_ROUTE_GC_THRESH, "NET_IPV4_ROUTE_GC_THRESH" }, 1849 { NET_IPV4_ROUTE_MAX_SIZE, "NET_IPV4_ROUTE_MAX_SIZE" }, 1850 { NET_IPV4_ROUTE_GC_MIN_INTERVAL, "NET_IPV4_ROUTE_GC_MIN_INTERVAL" }, 1851 { NET_IPV4_ROUTE_GC_TIMEOUT, "NET_IPV4_ROUTE_GC_TIMEOUT" }, 1852 { NET_IPV4_ROUTE_GC_INTERVAL, "NET_IPV4_ROUTE_GC_INTERVAL" }, 1853 { NET_IPV4_ROUTE_REDIRECT_LOAD, "NET_IPV4_ROUTE_REDIRECT_LOAD" }, 1854 { NET_IPV4_ROUTE_REDIRECT_NUMBER, "NET_IPV4_ROUTE_REDIRECT_NUMBER" }, 1855 { NET_IPV4_ROUTE_REDIRECT_SILENCE, "NET_IPV4_ROUTE_REDIRECT_SILENCE" }, 1856 { NET_IPV4_ROUTE_ERROR_COST, "NET_IPV4_ROUTE_ERROR_COST" }, 1857 { NET_IPV4_ROUTE_ERROR_BURST, "NET_IPV4_ROUTE_ERROR_BURST" }, 1858 { NET_IPV4_ROUTE_GC_ELASTICITY, "NET_IPV4_ROUTE_GC_ELASTICITY" }, 1859 { 0, NULL } 1860}; 1861 1862static const struct xlat sysctl_net_ipv4_conf[] = { 1863 { NET_IPV4_CONF_FORWARDING, "NET_IPV4_CONF_FORWARDING" }, 1864 { NET_IPV4_CONF_MC_FORWARDING, "NET_IPV4_CONF_MC_FORWARDING" }, 1865 { NET_IPV4_CONF_PROXY_ARP, "NET_IPV4_CONF_PROXY_ARP" }, 1866 { NET_IPV4_CONF_ACCEPT_REDIRECTS, "NET_IPV4_CONF_ACCEPT_REDIRECTS" }, 1867 { NET_IPV4_CONF_SECURE_REDIRECTS, "NET_IPV4_CONF_SECURE_REDIRECTS" }, 1868 { NET_IPV4_CONF_SEND_REDIRECTS, "NET_IPV4_CONF_SEND_REDIRECTS" }, 1869 { NET_IPV4_CONF_SHARED_MEDIA, "NET_IPV4_CONF_SHARED_MEDIA" }, 1870 { NET_IPV4_CONF_RP_FILTER, "NET_IPV4_CONF_RP_FILTER" }, 1871 { NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE, "NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE" }, 1872 { NET_IPV4_CONF_BOOTP_RELAY, "NET_IPV4_CONF_BOOTP_RELAY" }, 1873 { NET_IPV4_CONF_LOG_MARTIANS, "NET_IPV4_CONF_LOG_MARTIANS" }, 1874 { 0, NULL } 1875}; 1876 1877static const struct xlat sysctl_net_ipv6[] = { 1878 { NET_IPV6_CONF, "NET_IPV6_CONF" }, 1879 { NET_IPV6_NEIGH, "NET_IPV6_NEIGH" }, 1880 { NET_IPV6_ROUTE, "NET_IPV6_ROUTE" }, 1881 { 0, NULL } 1882}; 1883 1884static const struct xlat sysctl_net_ipv6_route[] = { 1885 { NET_IPV6_ROUTE_FLUSH, "NET_IPV6_ROUTE_FLUSH" }, 1886 { NET_IPV6_ROUTE_GC_THRESH, "NET_IPV6_ROUTE_GC_THRESH" }, 1887 { NET_IPV6_ROUTE_MAX_SIZE, "NET_IPV6_ROUTE_MAX_SIZE" }, 1888 { NET_IPV6_ROUTE_GC_MIN_INTERVAL, "NET_IPV6_ROUTE_GC_MIN_INTERVAL" }, 1889 { NET_IPV6_ROUTE_GC_TIMEOUT, "NET_IPV6_ROUTE_GC_TIMEOUT" }, 1890 { NET_IPV6_ROUTE_GC_INTERVAL, "NET_IPV6_ROUTE_GC_INTERVAL" }, 1891 { NET_IPV6_ROUTE_GC_ELASTICITY, "NET_IPV6_ROUTE_GC_ELASTICITY" }, 1892 { 0, NULL } 1893}; 1894 1895int 1896sys_sysctl(tcp) 1897struct tcb *tcp; 1898{ 1899 struct __sysctl_args info; 1900 int *name; 1901 unsigned long size; 1902 1903 if (umove (tcp, tcp->u_arg[0], &info) < 0) 1904 return printargs(tcp); 1905 1906 size = sizeof (int) * (unsigned long) info.nlen; 1907 name = (size / sizeof (int) != info.nlen) ? NULL : malloc (size); 1908 if (name == NULL || 1909 umoven(tcp, (unsigned long) info.name, size, (char *) name) < 0) { 1910 free(name); 1911 if (entering(tcp)) 1912 tprintf("{%p, %d, %p, %p, %p, %Zu}", 1913 info.name, info.nlen, info.oldval, 1914 info.oldlenp, info.newval, info.newlen); 1915 return 0; 1916 } 1917 1918 if (entering(tcp)) { 1919 int cnt = 0, max_cnt; 1920 1921 tprintf("{{"); 1922 1923 if (info.nlen == 0) 1924 goto out; 1925 printxval(sysctl_root, name[0], "CTL_???"); 1926 ++cnt; 1927 1928 if (info.nlen == 1) 1929 goto out; 1930 switch (name[0]) { 1931 case CTL_KERN: 1932 tprintf(", "); 1933 printxval(sysctl_kern, name[1], "KERN_???"); 1934 ++cnt; 1935 break; 1936 case CTL_VM: 1937 tprintf(", "); 1938 printxval(sysctl_vm, name[1], "VM_???"); 1939 ++cnt; 1940 break; 1941 case CTL_NET: 1942 tprintf(", "); 1943 printxval(sysctl_net, name[1], "NET_???"); 1944 ++cnt; 1945 1946 if (info.nlen == 2) 1947 goto out; 1948 switch (name[1]) { 1949 case NET_CORE: 1950 tprintf(", "); 1951 printxval(sysctl_net_core, name[2], 1952 "NET_CORE_???"); 1953 break; 1954 case NET_UNIX: 1955 tprintf(", "); 1956 printxval(sysctl_net_unix, name[2], 1957 "NET_UNIX_???"); 1958 break; 1959 case NET_IPV4: 1960 tprintf(", "); 1961 printxval(sysctl_net_ipv4, name[2], 1962 "NET_IPV4_???"); 1963 1964 if (info.nlen == 3) 1965 goto out; 1966 switch (name[2]) { 1967 case NET_IPV4_ROUTE: 1968 tprintf(", "); 1969 printxval(sysctl_net_ipv4_route, 1970 name[3], 1971 "NET_IPV4_ROUTE_???"); 1972 break; 1973 case NET_IPV4_CONF: 1974 tprintf(", "); 1975 printxval(sysctl_net_ipv4_conf, 1976 name[3], 1977 "NET_IPV4_CONF_???"); 1978 break; 1979 default: 1980 goto out; 1981 } 1982 break; 1983 case NET_IPV6: 1984 tprintf(", "); 1985 printxval(sysctl_net_ipv6, name[2], 1986 "NET_IPV6_???"); 1987 1988 if (info.nlen == 3) 1989 goto out; 1990 switch (name[2]) { 1991 case NET_IPV6_ROUTE: 1992 tprintf(", "); 1993 printxval(sysctl_net_ipv6_route, 1994 name[3], 1995 "NET_IPV6_ROUTE_???"); 1996 break; 1997 default: 1998 goto out; 1999 } 2000 break; 2001 default: 2002 goto out; 2003 } 2004 break; 2005 default: 2006 goto out; 2007 } 2008 out: 2009 max_cnt = info.nlen; 2010 if (abbrev(tcp) && max_cnt > max_strlen) 2011 max_cnt = max_strlen; 2012 while (cnt < max_cnt) 2013 tprintf(", %x", name[cnt++]); 2014 if (cnt < info.nlen) 2015 tprintf(", ..."); 2016 tprintf("}, %d, ", info.nlen); 2017 } else { 2018 size_t oldlen; 2019 if (umove(tcp, (size_t)info.oldlenp, &oldlen) >= 0 2020 && info.nlen >= 2 2021 && ((name[0] == CTL_KERN 2022 && (name[1] == KERN_OSRELEASE 2023 || name[1] == KERN_OSTYPE 2024#ifdef KERN_JAVA_INTERPRETER 2025 || name[1] == KERN_JAVA_INTERPRETER 2026#endif 2027#ifdef KERN_JAVA_APPLETVIEWER 2028 || name[1] == KERN_JAVA_APPLETVIEWER 2029#endif 2030 )))) { 2031 printpath(tcp, (size_t)info.oldval); 2032 tprintf(", %Zu, ", oldlen); 2033 if (info.newval == 0) 2034 tprintf("NULL"); 2035 else if (syserror(tcp)) 2036 tprintf("%p", info.newval); 2037 else 2038 printpath(tcp, (size_t)info.newval); 2039 tprintf(", %Zd", info.newlen); 2040 } else { 2041 tprintf("%p, %Zd, %p, %Zd", info.oldval, oldlen, 2042 info.newval, info.newlen); 2043 } 2044 tprintf("}"); 2045 } 2046 2047 free(name); 2048 return 0; 2049} 2050#else 2051int sys_sysctl(tcp) 2052struct tcb *tcp; 2053{ 2054 return printargs(tcp); 2055} 2056#endif 2057 2058#ifdef FREEBSD 2059#include <sys/sysctl.h> 2060 2061int sys___sysctl(tcp) 2062struct tcb *tcp; 2063{ 2064 int qoid[CTL_MAXNAME+2]; 2065 char ctl[1024]; 2066 size_t len; 2067 int i, numeric; 2068 2069 if (entering(tcp)) { 2070 if (tcp->u_arg[1] < 0 || tcp->u_arg[1] > CTL_MAXNAME || 2071 (umoven(tcp, tcp->u_arg[0], tcp->u_arg[1] * sizeof(int), 2072 (char *) (qoid + 2)) < 0)) 2073 tprintf("[...], "); 2074 else { 2075 /* Use sysctl to ask the name of the current MIB 2076 This uses the undocumented "Staff-functions" used 2077 by the sysctl program. See kern_sysctl.c for 2078 details. */ 2079 qoid[0] = 0; /* sysctl */ 2080 qoid[1] = 1; /* name */ 2081 i = sizeof(ctl); 2082 tprintf("["); 2083 if (sysctl(qoid, tcp->u_arg[1] + 2, ctl, &i, 0, 0) >= 0) { 2084 numeric = !abbrev(tcp); 2085 tprintf("%s%s", ctl, numeric ? ", " : ""); 2086 } else 2087 numeric = 1; 2088 if (numeric) { 2089 for (i = 0; i < tcp->u_arg[1]; i++) 2090 tprintf("%s%d", i ? "." : "", qoid[i + 2]); 2091 } 2092 tprintf("], "); 2093 tprintf("%lu, ", tcp->u_arg[1]); 2094 } 2095 } else { 2096 if (!syserror(tcp) && (umove(tcp, tcp->u_arg[3], &len) >= 0)) { 2097 printstr(tcp, tcp->u_arg[2], len); 2098 tprintf(", [%u], ", len); 2099 } else 2100 tprintf("%#lx, %#lx, ", tcp->u_arg[2], tcp->u_arg[3]); 2101 printstr(tcp, tcp->u_arg[4], tcp->u_arg[5]); 2102 tprintf(", %lu", tcp->u_arg[5]); 2103 } 2104 return 0; 2105} 2106#endif 2107 2108#if UNIXWARE >= 2 2109 2110#include <sys/ksym.h> 2111#include <sys/elf.h> 2112 2113static const struct xlat ksym_flags[] = { 2114 { STT_NOTYPE, "STT_NOTYPE" }, 2115 { STT_FUNC, "STT_FUNC" }, 2116 { STT_OBJECT, "STT_OBJECT" }, 2117 { 0, NULL }, 2118}; 2119 2120int 2121sys_getksym(tcp) 2122struct tcb *tcp; 2123{ 2124 if (entering (tcp)) { 2125 printstr(tcp, tcp->u_arg[0], -1); 2126 tprintf(", "); 2127 } 2128 else { 2129 if (syserror(tcp)) { 2130 tprintf("%#lx, %#lx", 2131 tcp->u_arg[1], tcp->u_arg[2]); 2132 } 2133 else { 2134 int val; 2135 printnum (tcp, tcp->u_arg[1], "%#lx"); 2136 tprintf(", "); 2137 if (umove(tcp, tcp->u_arg[2], &val) < 0) { 2138 tprintf("%#lx", tcp->u_arg[2]); 2139 } 2140 else { 2141 tprintf("["); 2142 printxval (ksym_flags, val, "STT_???"); 2143 tprintf("]"); 2144 } 2145 } 2146 } 2147 2148 return 0; 2149} 2150 2151#ifdef HAVE_SYS_NSCSYS_H 2152 2153struct cred; 2154#include <sys/nscsys.h> 2155 2156static const struct xlat ssi_cmd [] = { 2157 { SSISYS_BADOP, "SSISYS_BADOP" }, 2158 { SSISYS_LDLVL_INIT,"SSISYS_LDLVL_INIT"}, 2159 { SSISYS_LDLVL_GETVEC,"SSISYS_LDLVL_GETVEC"}, 2160 { SSISYS_LDLVL_PUTVEC,"SSISYS_LDLVL_PUTVEC"}, 2161 { SSISYS_LDLVL_PUTRCMDS,"SSISYS_LDLVL_PUTRCMDS"}, 2162 { SSISYS_LDLVL_SETREXEC,"SSISYS_LDLVL_SETREXEC"}, 2163 { SSISYS_CMS_CLUSTERID,"SSISYS_CMS_CLUSTERID"}, 2164 { SSISYS_CFS_STATVFS,"SSISYS_CFS_STATVFS"}, 2165 { SSISYS_NODE_GETNUM,"SSISYS_NODE_GETNUM"}, 2166 { SSISYS_NODE_TABLE,"SSISYS_NODE_TABLE"}, 2167 { SSISYS_NODE_DOWN,"SSISYS_NODE_DOWN"}, 2168 { SSISYS_RECLAIM_CHILD,"SSISYS_RECLAIM_CHILD"}, 2169 { SSISYS_IPC_GETINFO,"SSISYS_IPC_GETINFO"}, 2170 { SSISYS_ICS_TEST,"SSISYS_ICS_TEST"}, 2171 { SSISYS_NODE_PID,"SSISYS_NODE_PID"}, 2172 { SSISYS_ISLOCAL,"SSISYS_ISLOCAL"}, 2173 { SSISYS_CFS_ISSTACKED,"SSISYS_CFS_ISSTACKED"}, 2174 { SSISYS_DNET_SYNC,"SSISYS_DNET_SYNC"}, 2175 { SSISYS_CFS_WAIT_MODE,"SSISYS_CFS_WAIT_MODE"}, 2176 { SSISYS_CFS_UMOUNT,"SSISYS_CFS_UMOUNT"}, 2177 { SSISYS_LLSTAT,"SSISYS_LLSTAT" }, 2178 { SSISYS_LTS_PERFTEST,"SSISYS_LTS_PERFTEST"}, 2179 { SSISYS_LTS_CONFIG,"SSISYS_LTS_CONFIG"}, 2180 { SSISYS_SNET_PERFTEST,"SSISYS_SNET_PERFTEST"}, 2181 { SSISYS_IGNORE_HALFUP,"SSISYS_IGNORE_HALFUP"}, 2182 { SSISYS_NODE_ROOTDEV,"SSISYS_NODE_ROOTDEV"}, 2183 { SSISYS_GET_PRIMARY,"SSISYS_GET_PRIMARY"}, 2184 { SSISYS_GET_SECONDARY,"SSISYS_GET_SECONDARY"}, 2185 { SSISYS_GET_ROOTDISK,"SSISYS_GET_ROOTDISK"}, 2186 { SSISYS_CLUSTERNODE_NUM,"SSISYS_CLUSTERNODE_NUM"}, 2187 { SSISYS_CLUSTER_MEMBERSHIP,"SSISYS_CLUSTER_MEMBERSHIP"}, 2188 { SSISYS_CLUSTER_DETAILEDTRANS,"SSISYS_CLUSTER_DETAILEDTRANS"}, 2189 { SSISYS_CLUSTERNODE_INFO,"SSISYS_CLUSTERNODE_INFO"}, 2190 { SSISYS_CLUSTERNODE_SETINFO,"SSISYS_CLUSTERNODE_SETINFO"}, 2191 { SSISYS_CLUSTERNODE_AVAIL,"SSISYS_CLUSTERNODE_AVAIL"}, 2192 { SSISYS_CLUSTER_MAXNODES,"SSISYS_CLUSTER_MAXNODES"}, 2193 { SSISYS_SET_MEMPRIO,"SSISYS_SET_MEMPRIO"}, 2194 { SSISYS_GET_USERS,"SSISYS_GET_USERS"}, 2195 { SSISYS_FORCE_ROOT_NODE,"SSISYS_FORCE_ROOT_NODE"}, 2196 { SSISYS_CVIP_SET,"SSISYS_CVIP_SET"}, 2197 { SSISYS_CVIP_GET,"SSISYS_CVIP_GET"}, 2198 { SSISYS_GET_NODE_COUNTS,"SSISYS_GET_NODE_COUNTS"}, 2199 { SSISYS_GET_TRANSPORT,"SSISYS_GET_TRANSPORT"}, 2200 { 0, NULL }, 2201}; 2202 2203int sys_ssisys (tcp) 2204struct tcb *tcp; 2205{ 2206 struct ssisys_iovec iov; 2207 cls_nodeinfo_args_t cni; 2208 clusternode_info_t info; 2209 2210 if (entering (tcp)) { 2211 ts_reclaim_child_inargs_t trc; 2212 if (tcp->u_arg[1] != sizeof iov || 2213 umove (tcp, tcp->u_arg[0], &iov) < 0) 2214 { 2215 tprintf ("%#lx, %ld", tcp->u_arg[0], tcp->u_arg[1]); 2216 return 0; 2217 } 2218 tprintf ("{id="); 2219 printxval(ssi_cmd, iov.tio_id.id_cmd, "SSISYS_???"); 2220 tprintf (":%d", iov.tio_id.id_ver); 2221 switch (iov.tio_id.id_cmd) { 2222 case SSISYS_RECLAIM_CHILD: 2223 if (iov.tio_udatainlen != sizeof trc || 2224 umove (tcp, (long) iov.tio_udatain, &trc) < 0) 2225 goto bad; 2226 tprintf (", in={pid=%ld, start=%ld}", 2227 trc.trc_pid, trc.trc_start); 2228 break; 2229 case SSISYS_CLUSTERNODE_INFO: 2230 if (iov.tio_udatainlen != sizeof cni || 2231 umove (tcp, (long) iov.tio_udatain, &cni) < 0) 2232 goto bad; 2233 tprintf (", in={node=%ld, len=%d}", 2234 cni.nodenum, cni.info_len); 2235 break; 2236 default: 2237 bad: 2238 if (iov.tio_udatainlen) { 2239 tprintf (", in=[/* %d bytes */]", 2240 iov.tio_udatainlen); 2241 } 2242 } 2243 } 2244 else { 2245 if (tcp->u_arg[1] != sizeof iov || 2246 umove (tcp, tcp->u_arg[0], &iov) < 0) 2247 goto done; 2248 switch (iov.tio_id.id_cmd) { 2249 case SSISYS_CLUSTERNODE_INFO: 2250 if (iov.tio_udatainlen != sizeof cni || 2251 umove (tcp, (long) iov.tio_udatain, &cni) < 0) 2252 goto bad_out; 2253 if (cni.info_len != sizeof info || 2254 iov.tio_udataoutlen != sizeof &info || 2255 umove (tcp, (long) iov.tio_udataout, &info) < 0) 2256 goto bad_out; 2257 tprintf (", out={node=%ld, cpus=%d, online=%d}", 2258 info.node_num, info.node_totalcpus, 2259 info.node_onlinecpus); 2260 break; 2261 2262 default: 2263 bad_out: 2264 if (iov.tio_udataoutlen) { 2265 tprintf (", out=[/* %d bytes */]", 2266 iov.tio_udataoutlen); 2267 } 2268 } 2269 done: 2270 tprintf ("}, %ld", tcp->u_arg[1]); 2271 } 2272 return 0; 2273} 2274 2275#endif 2276 2277#endif /* UNIXWARE > 2 */ 2278 2279#ifdef MIPS 2280 2281#ifndef __NEW_UTS_LEN 2282#define __NEW_UTS_LEN 64 2283#endif 2284 2285static const struct xlat sysmips_operations[] = { 2286 { SETNAME, "SETNAME" }, 2287 { FLUSH_CACHE, "FLUSH_CACHE" }, 2288 { MIPS_FIXADE, "MIPS_FIXADE" }, 2289 { MIPS_RDNVRAM, "MIPS_RDNVRAM" }, 2290 { MIPS_ATOMIC_SET, "MIPS_ATOMIC_SET" }, 2291 { 0, NULL } 2292}; 2293 2294int sys_sysmips(tcp) 2295struct tcb *tcp; 2296{ 2297 if (entering(tcp)) { 2298 printxval(sysmips_operations, tcp->u_arg[0], "???"); 2299 if (!verbose(tcp)) { 2300 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]); 2301 } else if (tcp->u_arg[0]==SETNAME) { 2302 char nodename[__NEW_UTS_LEN + 1]; 2303 if (umovestr(tcp, tcp->u_arg[1], (__NEW_UTS_LEN + 1), nodename) < 0) 2304 tprintf(", %#lx", tcp->u_arg[1]); 2305 else 2306 tprintf(", \"%s\"", nodename); 2307 } else if (tcp->u_arg[0] == MIPS_ATOMIC_SET) { 2308 tprintf(", %#lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]); 2309 } else if (tcp->u_arg[0] == MIPS_FIXADE) { 2310 tprintf(", 0x%lx", tcp->u_arg[1]); 2311 } else { 2312 tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]); 2313 } 2314 } 2315 2316 return 0; 2317} 2318 2319#endif /* MIPS */ 2320