1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. 24 * Copyright (c) 2015, Joyent, Inc. All rights reserved. 25 * Copyright 2020 Oxide Computer Company 26 */ 27 28 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 29 /* All Rights Reserved */ 30 31 /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */ 32 33 #include <stdio.h> 34 #include <stdlib.h> 35 #include <fcntl.h> 36 #include <unistd.h> 37 #include <string.h> 38 #include <signal.h> 39 #include <sys/types.h> 40 #include <libproc.h> 41 #include <sys/aio.h> 42 #include <sys/port_impl.h> 43 #include "ramdata.h" 44 #include "systable.h" 45 #include "print.h" 46 #include "proto.h" 47 48 /* 49 * Tables of information about system calls - read-only data. 50 */ 51 52 const char *const errcode[] = { /* error code names */ 53 NULL, /* 0 */ 54 "EPERM", /* 1 */ 55 "ENOENT", /* 2 */ 56 "ESRCH", /* 3 */ 57 "EINTR", /* 4 */ 58 "EIO", /* 5 */ 59 "ENXIO", /* 6 */ 60 "E2BIG", /* 7 */ 61 "ENOEXEC", /* 8 */ 62 "EBADF", /* 9 */ 63 "ECHILD", /* 10 */ 64 "EAGAIN", /* 11 */ 65 "ENOMEM", /* 12 */ 66 "EACCES", /* 13 */ 67 "EFAULT", /* 14 */ 68 "ENOTBLK", /* 15 */ 69 "EBUSY", /* 16 */ 70 "EEXIST", /* 17 */ 71 "EXDEV", /* 18 */ 72 "ENODEV", /* 19 */ 73 "ENOTDIR", /* 20 */ 74 "EISDIR", /* 21 */ 75 "EINVAL", /* 22 */ 76 "ENFILE", /* 23 */ 77 "EMFILE", /* 24 */ 78 "ENOTTY", /* 25 */ 79 "ETXTBSY", /* 26 */ 80 "EFBIG", /* 27 */ 81 "ENOSPC", /* 28 */ 82 "ESPIPE", /* 29 */ 83 "EROFS", /* 30 */ 84 "EMLINK", /* 31 */ 85 "EPIPE", /* 32 */ 86 "EDOM", /* 33 */ 87 "ERANGE", /* 34 */ 88 "ENOMSG", /* 35 */ 89 "EIDRM", /* 36 */ 90 "ECHRNG", /* 37 */ 91 "EL2NSYNC", /* 38 */ 92 "EL3HLT", /* 39 */ 93 "EL3RST", /* 40 */ 94 "ELNRNG", /* 41 */ 95 "EUNATCH", /* 42 */ 96 "ENOCSI", /* 43 */ 97 "EL2HLT", /* 44 */ 98 "EDEADLK", /* 45 */ 99 "ENOLCK", /* 46 */ 100 "ECANCELED", /* 47 */ 101 "ENOTSUP", /* 48 */ 102 "EDQUOT", /* 49 */ 103 "EBADE", /* 50 */ 104 "EBADR", /* 51 */ 105 "EXFULL", /* 52 */ 106 "ENOANO", /* 53 */ 107 "EBADRQC", /* 54 */ 108 "EBADSLT", /* 55 */ 109 "EDEADLOCK", /* 56 */ 110 "EBFONT", /* 57 */ 111 "EOWNERDEAD", /* 58 */ 112 "ENOTRECOVERABLE", /* 59 */ 113 "ENOSTR", /* 60 */ 114 "ENODATA", /* 61 */ 115 "ETIME", /* 62 */ 116 "ENOSR", /* 63 */ 117 "ENONET", /* 64 */ 118 "ENOPKG", /* 65 */ 119 "EREMOTE", /* 66 */ 120 "ENOLINK", /* 67 */ 121 "EADV", /* 68 */ 122 "ESRMNT", /* 69 */ 123 "ECOMM", /* 70 */ 124 "EPROTO", /* 71 */ 125 "ELOCKUNMAPPED", /* 72 */ 126 "ENOTACTIVE", /* 73 */ 127 "EMULTIHOP", /* 74 */ 128 NULL, /* 75 */ 129 NULL, /* 76 */ 130 "EBADMSG", /* 77 */ 131 "ENAMETOOLONG", /* 78 */ 132 "EOVERFLOW", /* 79 */ 133 "ENOTUNIQ", /* 80 */ 134 "EBADFD", /* 81 */ 135 "EREMCHG", /* 82 */ 136 "ELIBACC", /* 83 */ 137 "ELIBBAD", /* 84 */ 138 "ELIBSCN", /* 85 */ 139 "ELIBMAX", /* 86 */ 140 "ELIBEXEC", /* 87 */ 141 "EILSEQ", /* 88 */ 142 "ENOSYS", /* 89 */ 143 "ELOOP", /* 90 */ 144 "ERESTART", /* 91 */ 145 "ESTRPIPE", /* 92 */ 146 "ENOTEMPTY", /* 93 */ 147 "EUSERS", /* 94 */ 148 "ENOTSOCK", /* 95 */ 149 "EDESTADDRREQ", /* 96 */ 150 "EMSGSIZE", /* 97 */ 151 "EPROTOTYPE", /* 98 */ 152 "ENOPROTOOPT", /* 99 */ 153 NULL, /* 100 */ 154 NULL, /* 101 */ 155 NULL, /* 102 */ 156 NULL, /* 103 */ 157 NULL, /* 104 */ 158 NULL, /* 105 */ 159 NULL, /* 106 */ 160 NULL, /* 107 */ 161 NULL, /* 108 */ 162 NULL, /* 109 */ 163 NULL, /* 110 */ 164 NULL, /* 111 */ 165 NULL, /* 112 */ 166 NULL, /* 113 */ 167 NULL, /* 114 */ 168 NULL, /* 115 */ 169 NULL, /* 116 */ 170 NULL, /* 117 */ 171 NULL, /* 118 */ 172 NULL, /* 119 */ 173 "EPROTONOSUPPORT", /* 120 */ 174 "ESOCKTNOSUPPORT", /* 121 */ 175 "EOPNOTSUPP", /* 122 */ 176 "EPFNOSUPPORT", /* 123 */ 177 "EAFNOSUPPORT", /* 124 */ 178 "EADDRINUSE", /* 125 */ 179 "EADDRNOTAVAIL", /* 126 */ 180 "ENETDOWN", /* 127 */ 181 "ENETUNREACH", /* 128 */ 182 "ENETRESET", /* 129 */ 183 "ECONNABORTED", /* 130 */ 184 "ECONNRESET", /* 131 */ 185 "ENOBUFS", /* 132 */ 186 "EISCONN", /* 133 */ 187 "ENOTCONN", /* 134 */ 188 NULL, /* 135 */ 189 NULL, /* 136 */ 190 NULL, /* 137 */ 191 NULL, /* 138 */ 192 NULL, /* 139 */ 193 NULL, /* 140 */ 194 NULL, /* 141 */ 195 NULL, /* 142 */ 196 "ESHUTDOWN", /* 143 */ 197 "ETOOMANYREFS", /* 144 */ 198 "ETIMEDOUT", /* 145 */ 199 "ECONNREFUSED", /* 146 */ 200 "EHOSTDOWN", /* 147 */ 201 "EHOSTUNREACH", /* 148 */ 202 "EALREADY", /* 149 */ 203 "EINPROGRESS", /* 150 */ 204 "ESTALE" /* 151 */ 205 }; 206 207 #define NERRCODE (sizeof (errcode) / sizeof (char *)) 208 209 210 const char * 211 errname(int err) /* return the error code name (NULL if none) */ 212 { 213 const char *ename = NULL; 214 215 if (err >= 0 && err < NERRCODE) 216 ename = errcode[err]; 217 218 return (ename); 219 } 220 221 222 const struct systable systable[] = { 223 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, 224 {"_exit", 1, DEC, NOV, DEC}, /* 1 */ 225 {"psecflags", 3, DEC, NOV, HEX, PSFW, PSDLT}, /* 2 */ 226 {"read", 3, DEC, NOV, DEC, IOB, UNS}, /* 3 */ 227 {"write", 3, DEC, NOV, DEC, IOB, UNS}, /* 4 */ 228 {"open", 3, DEC, NOV, STG, OPN, OCT}, /* 5 */ 229 {"close", 1, DEC, NOV, DEC}, /* 6 */ 230 {"linkat", 5, DEC, NOV, ATC, STG, ATC, STG, SNF}, /* 7 */ 231 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, 232 {"link", 2, DEC, NOV, STG, STG}, /* 9 */ 233 {"unlink", 1, DEC, NOV, STG}, /* 10 */ 234 {"symlinkat", 3, DEC, NOV, STG, ATC, STG}, /* 11 */ 235 {"chdir", 1, DEC, NOV, STG}, /* 12 */ 236 {"time", 0, DEC, NOV}, /* 13 */ 237 {"mknod", 3, DEC, NOV, STG, OCT, HEX}, /* 14 */ 238 {"chmod", 2, DEC, NOV, STG, OCT}, /* 15 */ 239 {"chown", 3, DEC, NOV, STG, DEC, DEC}, /* 16 */ 240 {"brk", 1, DEC, NOV, HEX}, /* 17 */ 241 {"stat", 2, DEC, NOV, STG, HEX}, /* 18 */ 242 {"lseek", 3, DEC, NOV, DEC, DEX, WHN}, /* 19 */ 243 {"getpid", 0, DEC, DEC}, /* 20 */ 244 {"mount", 8, DEC, NOV, STG, STG, MTF, MFT, HEX, DEC, HEX, DEC}, /* 21 */ 245 {"readlinkat", 4, DEC, NOV, ATC, STG, RLK, UNS}, /* 22 */ 246 {"setuid", 1, DEC, NOV, UNS}, /* 23 */ 247 {"getuid", 0, UNS, UNS}, /* 24 */ 248 {"stime", 1, DEC, NOV, DEC}, /* 25 */ 249 {"pcsample", 2, DEC, NOV, HEX, DEC}, /* 26 */ 250 {"alarm", 1, DEC, NOV, UNS}, /* 27 */ 251 {"fstat", 2, DEC, NOV, DEC, HEX}, /* 28 */ 252 {"pause", 0, DEC, NOV}, /* 29 */ 253 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, 254 {"stty", 2, DEC, NOV, DEC, DEC}, /* 31 */ 255 {"gtty", 2, DEC, NOV, DEC, DEC}, /* 32 */ 256 {"access", 2, DEC, NOV, STG, ACC}, /* 33 */ 257 {"nice", 1, DEC, NOV, DEC}, /* 34 */ 258 {"statfs", 4, DEC, NOV, STG, HEX, DEC, DEC}, /* 35 */ 259 {"sync", 0, DEC, NOV}, /* 36 */ 260 {"kill", 2, DEC, NOV, DEC, SIG}, /* 37 */ 261 {"fstatfs", 4, DEC, NOV, DEC, HEX, DEC, DEC}, /* 38 */ 262 {"pgrpsys", 3, DEC, NOV, DEC, DEC, DEC}, /* 39 */ 263 {"uucopystr", 3, DEC, NOV, STG, RST, UNS}, /* 40 */ 264 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, 265 {"pipe", 2, DEC, NOV, PFD, PIP}, /* 42 */ 266 {"times", 1, DEC, NOV, HEX}, /* 43 */ 267 {"profil", 4, DEC, NOV, HEX, UNS, HEX, OCT}, /* 44 */ 268 {"faccessat", 4, DEC, NOV, ATC, STG, ACC, FAT}, /* 45 */ 269 {"setgid", 1, DEC, NOV, UNS}, /* 46 */ 270 {"getgid", 0, UNS, UNS}, /* 47 */ 271 {"mknodat", 4, DEC, NOV, ATC, STG, OCT, HEX}, /* 48 */ 272 {"msgsys", 6, DEC, NOV, DEC, DEC, DEC, DEC, DEC, DEC}, /* 49 */ 273 {"sysi86", 4, HEX, NOV, S86, HEX, HEX, HEX, DEC, DEC}, /* 50 */ 274 {"acct", 1, DEC, NOV, STG}, /* 51 */ 275 {"shmsys", 4, DEC, NOV, DEC, HEX, HEX, HEX}, /* 52 */ 276 {"semsys", 5, DEC, NOV, DEC, HEX, HEX, HEX, HEX}, /* 53 */ 277 {"ioctl", 3, DEC, NOV, DEC, IOC, IOA}, /* 54 */ 278 {"uadmin", 3, DEC, NOV, DEC, DEC, DEC}, /* 55 */ 279 {"fchownat", 5, DEC, NOV, ATC, STG, DEC, DEC, SNF}, /* 56 */ 280 {"utssys", 4, DEC, NOV, HEX, DEC, UTS, HEX}, /* 57 */ 281 {"fdsync", 2, DEC, NOV, DEC, FFG}, /* 58 */ 282 {"execvex", 4, DEC, NOV, STG, HEX, HEX, EXC}, /* 59 */ 283 {"umask", 1, OCT, NOV, OCT}, /* 60 */ 284 {"chroot", 1, DEC, NOV, STG}, /* 61 */ 285 {"fcntl", 3, DEC, NOV, DEC, FCN, HEX}, /* 62 */ 286 {"ulimit", 2, DEX, NOV, ULM, DEC}, /* 63 */ 287 {"renameat", 4, DEC, NOV, ATC, STG, ATC, STG}, /* 64 */ 288 {"unlinkat", 3, DEC, NOV, ATC, STG, UAT}, /* 65 */ 289 {"fstatat", 4, DEC, NOV, ATC, STG, HEX, SNF}, /* 66 */ 290 {"fstatat64", 4, DEC, NOV, ATC, STG, HEX, SNF}, /* 67 */ 291 {"openat", 4, DEC, NOV, ATC, STG, OPN, OCT}, /* 68 */ 292 {"openat64", 4, DEC, NOV, ATC, STG, OPN, OCT}, /* 69 */ 293 {"tasksys", 5, DEC, NOV, DEC, DEC, DEC, HEX, DEC}, /* 70 */ 294 {"acctctl", 3, DEC, NOV, HEX, HEX, UNS}, /* 71 */ 295 {"exacctsys", 6, DEC, NOV, DEC, IDT, DEC, HEX, DEC, HEX}, /* 72 */ 296 {"getpagesizes", 2, DEC, NOV, HEX, DEC}, /* 73 */ 297 {"rctlsys", 6, DEC, NOV, RSC, STG, HEX, HEX, DEC, DEC}, /* 74 */ 298 {"sidsys", 4, UNS, UNS, DEC, DEC, DEC, DEC}, /* 75 */ 299 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, 300 {"lwp_park", 3, DEC, NOV, DEC, HEX, DEC}, /* 77 */ 301 {"sendfilev", 5, DEC, NOV, DEC, DEC, HEX, DEC, HEX}, /* 78 */ 302 {"rmdir", 1, DEC, NOV, STG}, /* 79 */ 303 {"mkdir", 2, DEC, NOV, STG, OCT}, /* 80 */ 304 {"getdents", 3, DEC, NOV, DEC, HEX, UNS}, /* 81 */ 305 {"privsys", 5, HEX, NOV, DEC, DEC, DEC, HEX, DEC}, /* 82 */ 306 {"ucredsys", 3, DEC, NOV, DEC, DEC, HEX}, /* 83 */ 307 {"sysfs", 3, DEC, NOV, SFS, DEX, DEX}, /* 84 */ 308 {"getmsg", 4, DEC, NOV, DEC, HEX, HEX, HEX}, /* 85 */ 309 {"putmsg", 4, DEC, NOV, DEC, HEX, HEX, SMF}, /* 86 */ 310 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, 311 {"lstat", 2, DEC, NOV, STG, HEX}, /* 88 */ 312 {"symlink", 2, DEC, NOV, STG, STG}, /* 89 */ 313 {"readlink", 3, DEC, NOV, STG, RLK, UNS}, /* 90 */ 314 {"setgroups", 2, DEC, NOV, DEC, HEX}, /* 91 */ 315 {"getgroups", 2, DEC, NOV, DEC, HEX}, /* 92 */ 316 {"fchmod", 2, DEC, NOV, DEC, OCT}, /* 93 */ 317 {"fchown", 3, DEC, NOV, DEC, DEC, DEC}, /* 94 */ 318 {"sigprocmask", 3, DEC, NOV, SPM, HEX, HEX}, /* 95 */ 319 {"sigsuspend", 1, DEC, NOV, HEX}, /* 96 */ 320 {"sigaltstack", 2, DEC, NOV, HEX, HEX}, /* 97 */ 321 {"sigaction", 3, DEC, NOV, SIG, HEX, HEX}, /* 98 */ 322 {"sigpendsys", 2, DEC, NOV, DEC, HEX}, /* 99 */ 323 {"context", 2, DEC, NOV, DEC, HEX}, /* 100 */ 324 {"fchmodat", 4, DEC, NOV, ATC, STG, OCT, SNF}, /* 101 */ 325 {"mkdirat", 3, DEC, NOV, ATC, STG, OCT}, /* 102 */ 326 {"statvfs", 2, DEC, NOV, STG, HEX}, /* 103 */ 327 {"fstatvfs", 2, DEC, NOV, DEC, HEX}, /* 104 */ 328 {"getloadavg", 2, DEC, NOV, HEX, DEC}, /* 105 */ 329 {"nfssys", 2, DEC, NOV, DEC, HEX}, /* 106 */ 330 {"waitid", 4, DEC, NOV, IDT, DEC, HEX, WOP}, /* 107 */ 331 {"sigsendsys", 2, DEC, NOV, HEX, SIG}, /* 108 */ 332 {"hrtsys", 5, DEC, NOV, DEC, HEX, HEX, HEX, HEX}, /* 109 */ 333 {"utimesys", 5, DEC, NOV, DEC, HEX, HEX, HEX, HEX}, /* 110 */ 334 {"sigresend", 3, DEC, NOV, SIG, HEX, HEX}, /* 111 */ 335 {"priocntlsys", 5, DEC, NOV, DEC, HEX, DEC, PC4, PC5}, /* 112 */ 336 {"pathconf", 2, DEC, NOV, STG, PTC}, /* 113 */ 337 {"mincore", 3, DEC, NOV, HEX, UNS, HEX}, /* 114 */ 338 {"mmap", 6, HEX, NOV, HEX, UNS, MPR, MTY, DEC, DEC}, /* 115 */ 339 {"mprotect", 3, DEC, NOV, HEX, UNS, MPR}, /* 116 */ 340 {"munmap", 2, DEC, NOV, HEX, UNS}, /* 117 */ 341 {"fpathconf", 2, DEC, NOV, DEC, PTC}, /* 118 */ 342 {"vfork", 0, DEC, NOV}, /* 119 */ 343 {"fchdir", 1, DEC, NOV, DEC}, /* 120 */ 344 {"readv", 3, DEC, NOV, DEC, HEX, DEC}, /* 121 */ 345 {"writev", 3, DEC, NOV, DEC, HEX, DEC}, /* 122 */ 346 {"preadv", 4, DEC, NOV, DEC, HEX, DEC, DEC}, /* 123 */ 347 {"pwritev", 4, DEC, NOV, DEC, HEX, DEC, DEC}, /* 124 */ 348 {"upanic", 2, DEC, NOV, HEX, DEC}, /* 125 */ 349 {"getrandom", 3, DEC, NOV, IOB, UNS, GRF}, /* 126 */ 350 {"mmapobj", 5, DEC, NOV, DEC, MOB, HEX, HEX, HEX}, /* 127 */ 351 {"setrlimit", 2, DEC, NOV, RLM, HEX}, /* 128 */ 352 {"getrlimit", 2, DEC, NOV, RLM, HEX}, /* 129 */ 353 {"lchown", 3, DEC, NOV, STG, DEC, DEC}, /* 130 */ 354 {"memcntl", 6, DEC, NOV, HEX, UNS, MCF, MC4, MC5, DEC}, /* 131 */ 355 {"getpmsg", 5, DEC, NOV, DEC, HEX, HEX, HEX, HEX}, /* 132 */ 356 {"putpmsg", 5, DEC, NOV, DEC, HEX, HEX, DEC, HHX}, /* 133 */ 357 {"rename", 2, DEC, NOV, STG, STG}, /* 134 */ 358 {"uname", 1, DEC, NOV, HEX}, /* 135 */ 359 {"setegid", 1, DEC, NOV, UNS}, /* 136 */ 360 {"sysconfig", 1, DEC, NOV, CNF}, /* 137 */ 361 {"adjtime", 2, DEC, NOV, HEX, HEX}, /* 138 */ 362 {"sysinfo", 3, DEC, NOV, INF, RST, DEC}, /* 139 */ 363 {"sharefs", 3, DEC, NOV, DEC, HEX, DEC}, /* 140 */ 364 {"seteuid", 1, DEC, NOV, UNS}, /* 141 */ 365 {"forksys", 2, DEC, NOV, DEC, HHX}, /* 142 */ 366 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, 367 {"sigtimedwait", 3, DEC, NOV, HEX, HEX, HEX}, /* 144 */ 368 {"lwp_info", 1, DEC, NOV, HEX}, /* 145 */ 369 {"yield", 0, DEC, NOV}, /* 146 */ 370 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, 371 {"lwp_sema_post", 1, DEC, NOV, HEX}, /* 148 */ 372 {"lwp_sema_trywait", 1, DEC, NOV, HEX}, /* 149 */ 373 {"lwp_detach", 1, DEC, NOV, DEC}, /* 150 */ 374 {"corectl", 4, DEC, NOV, DEC, HEX, HEX, HEX}, /* 151 */ 375 {"modctl", 5, DEC, NOV, MOD, HEX, HEX, HEX, HEX}, /* 152 */ 376 {"fchroot", 1, DEC, NOV, DEC}, /* 153 */ 377 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, 378 {"vhangup", 0, DEC, NOV}, /* 155 */ 379 {"gettimeofday", 1, DEC, NOV, HEX}, /* 156 */ 380 {"getitimer", 2, DEC, NOV, ITM, HEX}, /* 157 */ 381 {"setitimer", 3, DEC, NOV, ITM, HEX, HEX}, /* 158 */ 382 {"lwp_create", 3, DEC, NOV, HEX, LWF, HEX}, /* 159 */ 383 {"lwp_exit", 0, DEC, NOV}, /* 160 */ 384 {"lwp_suspend", 1, DEC, NOV, DEC}, /* 161 */ 385 {"lwp_continue", 1, DEC, NOV, DEC}, /* 162 */ 386 {"lwp_kill", 2, DEC, NOV, DEC, SIG}, /* 163 */ 387 {"lwp_self", 0, DEC, NOV}, /* 164 */ 388 {"lwp_sigmask", 5, HEX, HEX, SPM, HEX, HEX, HEX, HEX}, /* 165 */ 389 {"lwp_private", 3, HEX, NOV, DEC, DEC, HEX}, /* 166 */ 390 {"lwp_wait", 2, DEC, NOV, DEC, HEX}, /* 167 */ 391 {"lwp_mutex_wakeup", 2, DEC, NOV, HEX, DEC}, /* 168 */ 392 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, 393 {"lwp_cond_wait", 4, DEC, NOV, HEX, HEX, HEX, DEC}, /* 170 */ 394 {"lwp_cond_signal", 1, DEC, NOV, HEX}, /* 171 */ 395 {"lwp_cond_broadcast", 1, DEC, NOV, HEX}, /* 172 */ 396 {"pread", 4, DEC, NOV, DEC, IOB, UNS, DEX}, /* 173 */ 397 {"pwrite", 4, DEC, NOV, DEC, IOB, UNS, DEX}, /* 174 */ 398 {"llseek", 4, LLO, NOV, DEC, LLO, HID, WHN}, /* 175 */ 399 {"inst_sync", 2, DEC, NOV, STG, DEC}, /* 176 */ 400 {"brand", 6, DEC, NOV, DEC, HEX, HEX, HEX, HEX, HEX}, /* 177 */ 401 {"kaio", 7, DEC, NOV, AIO, HEX, HEX, HEX, HEX, HEX, HEX}, /* 178 */ 402 {"cpc", 5, DEC, NOV, CPC, DEC, HEX, HEX, HEX}, /* 179 */ 403 {"lgrpsys", 3, DEC, NOV, DEC, DEC, HEX}, /* 180 */ 404 {"rusagesys", 5, DEC, NOV, DEC, HEX, DEC, HEX, HEX}, /* 181 */ 405 {"portfs", 6, HEX, HEX, DEC, HEX, HEX, HEX, HEX, HEX}, /* 182 */ 406 {"pollsys", 4, DEC, NOV, HEX, DEC, HEX, HEX}, /* 183 */ 407 {"labelsys", 2, DEC, NOV, DEC, HEX}, /* 184 */ 408 {"acl", 4, DEC, NOV, STG, ACL, DEC, HEX}, /* 185 */ 409 {"auditsys", 4, DEC, NOV, AUD, HEX, HEX, HEX}, /* 186 */ 410 {"processor_bind", 4, DEC, NOV, IDT, DEC, DEC, HEX}, /* 187 */ 411 {"processor_info", 2, DEC, NOV, DEC, HEX}, /* 188 */ 412 {"p_online", 2, DEC, NOV, DEC, DEC}, /* 189 */ 413 {"sigqueue", 5, DEC, NOV, DEC, SIG, HEX, SQC, DEC}, /* 190 */ 414 {"clock_gettime", 2, DEC, NOV, DEC, HEX}, /* 191 */ 415 {"clock_settime", 2, DEC, NOV, DEC, HEX}, /* 192 */ 416 {"clock_getres", 2, DEC, NOV, DEC, HEX}, /* 193 */ 417 {"timer_create", 3, DEC, NOV, DEC, HEX, HEX}, /* 194 */ 418 {"timer_delete", 1, DEC, NOV, DEC}, /* 195 */ 419 {"timer_settime", 4, DEC, NOV, DEC, DEC, HEX, HEX}, /* 196 */ 420 {"timer_gettime", 2, DEC, NOV, DEC, HEX}, /* 197 */ 421 {"timer_getoverrun", 1, DEC, NOV, DEC}, /* 198 */ 422 {"nanosleep", 2, DEC, NOV, HEX, HEX}, /* 199 */ 423 {"facl", 4, DEC, NOV, DEC, ACL, DEC, HEX}, /* 200 */ 424 {"door", 6, DEC, NOV, DEC, HEX, HEX, HEX, HEX, DEC}, /* 201 */ 425 {"setreuid", 2, DEC, NOV, UN1, UN1}, /* 202 */ 426 {"setregid", 2, DEC, NOV, UN1, UN1}, /* 203 */ 427 {"install_utrap", 3, DEC, NOV, DEC, HEX, HEX}, /* 204 */ 428 {"signotify", 3, DEC, NOV, DEC, HEX, HEX}, /* 205 */ 429 {"schedctl", 0, HEX, NOV}, /* 206 */ 430 {"pset", 5, DEC, NOV, DEC, HEX, HEX, HEX, HEX}, /* 207 */ 431 {"sparc_utrap_install", 5, DEC, NOV, UTT, UTH, UTH, HEX, HEX}, /* 208 */ 432 {"resolvepath", 3, DEC, NOV, STG, RLK, DEC}, /* 209 */ 433 {"lwp_mutex_timedlock", 3, DEC, NOV, HEX, HEX, HEX}, /* 210 */ 434 {"lwp_sema_timedwait", 3, DEC, NOV, HEX, HEX, DEC}, /* 211 */ 435 {"lwp_rwlock_sys", 3, DEC, NOV, DEC, HEX, HEX}, /* 212 */ 436 {"getdents64", 3, DEC, NOV, DEC, HEX, UNS}, /* 213 */ 437 {"mmap64", 7, HEX, NOV, HEX, UNS, MPR, MTY, DEC, LLO, HID}, /* 214 */ 438 {"stat64", 2, DEC, NOV, STG, HEX}, /* 215 */ 439 {"lstat64", 2, DEC, NOV, STG, HEX}, /* 216 */ 440 {"fstat64", 2, DEC, NOV, DEC, HEX}, /* 217 */ 441 {"statvfs64", 2, DEC, NOV, STG, HEX}, /* 218 */ 442 {"fstatvfs64", 2, DEC, NOV, DEC, HEX}, /* 219 */ 443 {"setrlimit64", 2, DEC, NOV, RLM, HEX}, /* 220 */ 444 {"getrlimit64", 2, DEC, NOV, RLM, HEX}, /* 221 */ 445 {"pread64", 5, DEC, NOV, DEC, IOB, UNS, LLO, HID}, /* 222 */ 446 {"pwrite64", 5, DEC, NOV, DEC, IOB, UNS, LLO, HID}, /* 223 */ 447 { NULL, 8, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX, HEX}, 448 {"open64", 3, DEC, NOV, STG, OPN, OCT}, /* 225 */ 449 {"rpcmod", 3, DEC, NOV, DEC, HEX}, /* 226 */ 450 {"zone", 5, DEC, NOV, DEC, HEX, HEX, HEX, HEX}, /* 227 */ 451 {"autofssys", 2, DEC, NOV, DEC, HEX}, /* 228 */ 452 {"getcwd", 3, DEC, NOV, RST, DEC}, /* 229 */ 453 {"so_socket", 5, DEC, NOV, PFM, SKT, SKP, STG, SKV}, /* 230 */ 454 {"so_socketpair", 1, DEC, NOV, HEX}, /* 231 */ 455 {"bind", 4, DEC, NOV, DEC, HEX, DEC, SKV}, /* 232 */ 456 {"listen", 3, DEC, NOV, DEC, DEC, SKV}, /* 233 */ 457 {"accept", 5, DEC, NOV, DEC, HEX, HEX, SKV, ACF}, /* 234 */ 458 {"connect", 4, DEC, NOV, DEC, HEX, DEC, SKV}, /* 235 */ 459 {"shutdown", 3, DEC, NOV, DEC, SHT, SKV}, /* 236 */ 460 {"recv", 4, DEC, NOV, DEC, IOB, DEC, DEC}, /* 237 */ 461 {"recvfrom", 6, DEC, NOV, DEC, IOB, DEC, DEC, HEX, HEX}, /* 238 */ 462 {"recvmsg", 3, DEC, NOV, DEC, HEX, DEC}, /* 239 */ 463 {"send", 4, DEC, NOV, DEC, IOB, DEC, DEC}, /* 240 */ 464 {"sendmsg", 3, DEC, NOV, DEC, HEX, DEC}, /* 241 */ 465 {"sendto", 6, DEC, NOV, DEC, IOB, DEC, DEC, HEX, DEC}, /* 242 */ 466 {"getpeername", 4, DEC, NOV, DEC, HEX, HEX, SKV}, /* 243 */ 467 {"getsockname", 4, DEC, NOV, DEC, HEX, HEX, SKV}, /* 244 */ 468 {"getsockopt", 6, DEC, NOV, DEC, SOL, SON, HEX, HEX, SKV}, /* 245 */ 469 {"setsockopt", 6, DEC, NOV, DEC, SOL, SON, HEX, DEC, SKV}, /* 246 */ 470 {"sockconfig", 5, DEC, NOV, DEC, HEX, HEX, HEX, HEX}, /* 247 */ 471 {"ntp_gettime", 1, DEC, NOV, HEX}, /* 248 */ 472 {"ntp_adjtime", 1, DEC, NOV, HEX}, /* 249 */ 473 {"lwp_mutex_unlock", 1, DEC, NOV, HEX}, /* 250 */ 474 {"lwp_mutex_trylock", 2, DEC, NOV, HEX, HEX}, /* 251 */ 475 {"lwp_mutex_register", 2, DEC, NOV, HEX, HEX}, /* 252 */ 476 {"cladm", 3, DEC, NOV, CLC, CLF, HEX}, /* 253 */ 477 {"uucopy", 3, DEC, NOV, HEX, HEX, UNS}, /* 254 */ 478 {"umount2", 2, DEC, NOV, STG, MTF}, /* 255 */ 479 { NULL, -1, DEC, NOV}, 480 }; 481 482 /* SYSEND == max syscall number + 1 */ 483 #define SYSEND ((sizeof (systable) / sizeof (struct systable))-1) 484 485 486 /* 487 * The following are for interpreting syscalls with sub-codes. 488 */ 489 490 const struct systable faccessattable[] = { 491 {"faccessat", 4, DEC, NOV, ATC, STG, ACC, FAT}, /* 0 */ 492 {"access", 3, DEC, NOV, HID, STG, ACC}, /* 1 */ 493 }; 494 #define NACCESSCODE (sizeof (faccessattable) / sizeof (struct systable)) 495 496 const struct systable fchmodattable[] = { 497 {"fchmodat", 4, DEC, NOV, ATC, STG, OCT, SNF}, /* 0 */ 498 {"chmod", 3, DEC, NOV, HID, STG, OCT}, /* 1 */ 499 {"fchmodat", 4, DEC, NOV, ATC, STG, OCT, SNF}, /* 2 */ 500 {"fchmod", 3, DEC, NOV, DEC, HID, OCT}, /* 3 */ 501 }; 502 #define NCHMODCODE (sizeof (fchmodattable) / sizeof (struct systable)) 503 504 const struct systable fchownattable[] = { 505 {"fchownat", 5, DEC, NOV, ATC, STG, DEC, DEC, SNF}, /* 0 */ 506 {"chown", 4, DEC, NOV, HID, STG, DEC, DEC}, /* 1 */ 507 {"lchown", 4, DEC, NOV, HID, STG, DEC, DEC}, /* 2 */ 508 {"fchown", 4, DEC, NOV, DEC, HID, DEC, DEC}, /* 3 */ 509 }; 510 #define NCHOWNCODE (sizeof (fchownattable) / sizeof (struct systable)) 511 512 const struct systable mkdiratattable[] = { 513 {"mkdirat", 3, DEC, NOV, ATC, STG, OCT}, /* 0 */ 514 {"mkdir", 3, DEC, NOV, HID, STG, OCT}, /* 1 */ 515 }; 516 #define NMKDIRCODE (sizeof (mkdiratattable) / sizeof (struct systable)) 517 518 const struct systable mknodatattable[] = { 519 {"mknodat", 4, DEC, NOV, ATC, STG, OCT, HEX}, /* 0 */ 520 {"mknod", 4, DEC, NOV, HID, STG, OCT, HEX}, /* 1 */ 521 }; 522 #define NMKMODCODE (sizeof (mknodatattable) / sizeof (struct systable)) 523 524 const struct systable renameattable[] = { 525 {"renameat", 4, DEC, NOV, ATC, STG, ATC, STG}, /* 0 */ 526 {"rename", 4, DEC, NOV, HID, STG, HID, STG}, /* 1 */ 527 }; 528 #define NRENAMECODE (sizeof (renameattable) / sizeof (struct systable)) 529 530 const struct systable linkattable[] = { 531 {"linkat", 5, DEC, NOV, ATC, STG, ATC, STG, SNF}, /* 0 */ 532 {"link", 4, DEC, NOV, HID, STG, HID, STG}, /* 1 */ 533 }; 534 #define NLINKATCODE (sizeof (linkattable) / sizeof (struct systable)) 535 536 const struct systable unlinkattable[] = { 537 {"unlinkat", 3, DEC, NOV, ATC, STG, UAT}, /* 0 */ 538 {"unlink", 2, DEC, NOV, HID, STG}, /* 1 */ 539 {"rmdir", 2, DEC, NOV, HID, STG}, /* 2 */ 540 }; 541 #define NUNLINKCODE (sizeof (unlinkattable) / sizeof (struct systable)) 542 543 const struct systable symlinkattable[] = { 544 {"symlinkat", 3, DEC, NOV, STG, ATC, STG}, /* 0 */ 545 {"symlink", 3, DEC, NOV, STG, HID, STG}, /* 1 */ 546 }; 547 #define NSYMLINKCODE (sizeof (symlinkattable) / sizeof (struct systable)) 548 549 const struct systable readlinkattable[] = { 550 {"readlinkat", 4, DEC, NOV, ATC, STG, RLK, UNS}, /* 0 */ 551 {"readlink", 4, DEC, NOV, HID, STG, RLK, UNS}, /* 1 */ 552 }; 553 #define NREADLINKCODE (sizeof (readlinkattable) / sizeof (struct systable)) 554 555 const struct systable fstatattable[] = { 556 {"fstatat", 4, DEC, NOV, ATC, STG, HEX, SNF}, /* 0 */ 557 {"stat", 3, DEC, NOV, HID, STG, HEX}, /* 1 */ 558 {"lstat", 3, DEC, NOV, HID, STG, HEX}, /* 2 */ 559 {"fstat", 3, DEC, NOV, DEC, HID, HEX}, /* 3 */ 560 }; 561 #define NSTATCODE (sizeof (fstatattable) / sizeof (struct systable)) 562 563 const struct systable fstatat64table[] = { 564 {"fstatat64", 4, DEC, NOV, ATC, STG, HEX, SNF}, /* 0 */ 565 {"stat64", 3, DEC, NOV, HID, STG, HEX}, /* 1 */ 566 {"lstat64", 3, DEC, NOV, HID, STG, HEX}, /* 2 */ 567 {"fstat64", 3, DEC, NOV, DEC, HID, HEX}, /* 3 */ 568 }; 569 #define NSTAT64CODE (sizeof (fstatat64table) / sizeof (struct systable)) 570 571 const struct systable openattable[] = { 572 {"openat", 3, DEC, NOV, ATC, STG, OPN}, /* 0 */ 573 {"openat", 4, DEC, NOV, ATC, STG, OPN, OCT}, /* 1 */ 574 {"open", 3, DEC, NOV, HID, STG, OPN}, /* 2 */ 575 {"open", 4, DEC, NOV, HID, STG, OPN, OCT}, /* 3 */ 576 }; 577 #define NOPENATCODE (sizeof (openattable) / sizeof (struct systable)) 578 579 const struct systable openat64table[] = { 580 {"openat64", 3, DEC, NOV, ATC, STG, OPN}, /* 0 */ 581 {"openat64", 4, DEC, NOV, ATC, STG, OPN, OCT}, /* 1 */ 582 {"open64", 3, DEC, NOV, HID, STG, OPN}, /* 2 */ 583 {"open64", 4, DEC, NOV, HID, STG, OPN, OCT}, /* 3 */ 584 }; 585 #define NOPENAT64CODE (sizeof (openat64table) / sizeof (struct systable)) 586 587 const struct systable opentable[] = { 588 {"open", 2, DEC, NOV, STG, OPN}, /* 0 */ 589 {"open", 3, DEC, NOV, STG, OPN, OCT}, /* 1 */ 590 }; 591 #define NOPENCODE (sizeof (opentable) / sizeof (struct systable)) 592 593 const struct systable open64table[] = { 594 {"open64", 2, DEC, NOV, STG, OPN}, /* 0 */ 595 {"open64", 3, DEC, NOV, STG, OPN, OCT}, /* 1 */ 596 }; 597 #define NOPEN64CODE (sizeof (open64table) / sizeof (struct systable)) 598 599 const struct systable fcntltable[] = { 600 {"fcntl", 3, DEC, NOV, DEC, FCN, HEX}, /* 0: default */ 601 {"fcntl", 2, DEC, NOV, DEC, FCN}, /* 1: no arg */ 602 {"fcntl", 3, DEC, NOV, DEC, FCN, FFG}, /* 2: F_SETFL */ 603 }; 604 #define NFCNTLCODE (sizeof (fcntltable) / sizeof (struct systable)) 605 606 const struct systable msgtable[] = { 607 {"msgget", 3, DEC, NOV, HID, KEY, MSF}, /* 0 */ 608 {"msgctl", 4, DEC, NOV, HID, DEC, MSC, HEX}, /* 1 */ 609 {"msgrcv", 6, DEC, NOV, HID, DEC, HEX, UNS, DEC, MSF}, /* 2 */ 610 {"msgsnd", 5, DEC, NOV, HID, DEC, HEX, UNS, MSF}, /* 3 */ 611 {"msgids", 4, DEC, NOV, HID, HEX, UNS, HEX}, /* 4 */ 612 {"msgsnap", 5, DEC, NOV, HID, DEC, HEX, UNS, DEC}, /* 5 */ 613 }; 614 #define NMSGCODE (sizeof (msgtable) / sizeof (struct systable)) 615 616 const struct systable semtable[] = { 617 {"semctl", 5, DEC, NOV, HID, DEC, DEC, SMC, DEX}, /* 0 */ 618 {"semget", 4, DEC, NOV, HID, KEY, DEC, SEF}, /* 1 */ 619 {"semop", 4, DEC, NOV, HID, DEC, HEX, UNS}, /* 2 */ 620 {"semids", 4, DEC, NOV, HID, HEX, UNS, HEX}, /* 3 */ 621 {"semtimedop", 5, DEC, NOV, HID, DEC, HEX, UNS, HEX}, /* 4 */ 622 }; 623 #define NSEMCODE (sizeof (semtable) / sizeof (struct systable)) 624 625 const struct systable shmtable[] = { 626 {"shmat", 4, HEX, NOV, HID, DEC, DEX, SHF}, /* 0 */ 627 {"shmctl", 4, DEC, NOV, HID, DEC, SHC, DEX}, /* 1 */ 628 {"shmdt", 2, DEC, NOV, HID, HEX}, /* 2 */ 629 {"shmget", 4, DEC, NOV, HID, KEY, UNS, SHF}, /* 3 */ 630 {"shmids", 4, DEC, NOV, HID, HEX, UNS, HEX}, /* 4 */ 631 }; 632 #define NSHMCODE (sizeof (shmtable) / sizeof (struct systable)) 633 634 const struct systable pidtable[] = { 635 {"getpgrp", 1, DEC, NOV, HID}, /* 0 */ 636 {"setpgrp", 1, DEC, NOV, HID}, /* 1 */ 637 {"getsid", 2, DEC, NOV, HID, DEC}, /* 2 */ 638 {"setsid", 1, DEC, NOV, HID}, /* 3 */ 639 {"getpgid", 2, DEC, NOV, HID, DEC}, /* 4 */ 640 {"setpgid", 3, DEC, NOV, HID, DEC, DEC}, /* 5 */ 641 }; 642 #define NPIDCODE (sizeof (pidtable) / sizeof (struct systable)) 643 644 const struct systable sfstable[] = { 645 {"sysfs", 3, DEC, NOV, SFS, DEX, DEX}, /* 0 */ 646 {"sysfs", 2, DEC, NOV, SFS, STG}, /* 1 */ 647 {"sysfs", 3, DEC, NOV, SFS, DEC, RST}, /* 2 */ 648 {"sysfs", 1, DEC, NOV, SFS}, /* 3 */ 649 }; 650 #define NSFSCODE (sizeof (sfstable) / sizeof (struct systable)) 651 652 const struct systable utstable[] = { 653 {"utssys", 3, DEC, NOV, HEX, DEC, UTS}, /* 0 */ 654 {"utssys", 4, DEC, NOV, HEX, HEX, HEX, HEX}, /* err */ 655 {"utssys", 3, DEC, NOV, HEX, HHX, UTS}, /* 2 */ 656 {"utssys", 4, DEC, NOV, STG, FUI, UTS, HEX} /* 3 */ 657 }; 658 #define NUTSCODE (sizeof (utstable) / sizeof (struct systable)) 659 660 const struct systable rctltable[] = { 661 {"getrctl", 6, DEC, NOV, HID, STG, HEX, HEX, HID, RGF}, /* 0 */ 662 {"setrctl", 6, DEC, NOV, HID, STG, HEX, HEX, HID, RSF}, /* 1 */ 663 {"rctlsys_lst", 6, DEC, NOV, HID, HID, HEX, HID, HEX, HID}, /* 2 */ 664 {"rctlsys_ctl", 6, DEC, NOV, HID, STG, HEX, HID, HID, RCF}, /* 3 */ 665 {"setprojrctl", 6, DEC, NOV, HID, STG, HID, HEX, HEX, SPF}, /* 4 */ 666 }; 667 #define NRCTLCODE (sizeof (rctltable) / sizeof (struct systable)) 668 669 const struct systable sgptable[] = { 670 {"sigpendsys", 2, DEC, NOV, DEC, HEX}, /* err */ 671 {"sigpending", 2, DEC, NOV, HID, HEX}, /* 1 */ 672 {"sigfillset", 2, DEC, NOV, HID, HEX}, /* 2 */ 673 }; 674 #define NSGPCODE (sizeof (sgptable) / sizeof (struct systable)) 675 676 const struct systable ctxtable[] = { 677 {"getcontext", 2, DEC, NOV, HID, HEX}, /* 0 */ 678 {"setcontext", 2, DEC, NOV, HID, HEX}, /* 1 */ 679 {"getustack", 2, DEC, NOV, HID, HEX}, /* 2 */ 680 {"setustack", 2, DEC, NOV, HID, HEX}, /* 3 */ 681 {"getcontext_extd", 2, DEC, NOV, HID, HEX}, /* 4 */ 682 }; 683 #define NCTXCODE (sizeof (ctxtable) / sizeof (struct systable)) 684 685 const struct systable hrttable[] = { 686 {"hrtcntl", 5, DEC, NOV, HID, DEC, DEC, HEX, HEX}, /* 0 */ 687 {"hrtalarm", 3, DEC, NOV, HID, HEX, DEC}, /* 1 */ 688 {"hrtsleep", 2, DEC, NOV, HID, HEX}, /* 2 */ 689 {"hrtcancel", 3, DEC, NOV, HID, HEX, DEC}, /* 3 */ 690 }; 691 #define NHRTCODE (sizeof (hrttable) / sizeof (struct systable)) 692 693 const struct systable cortable[] = { 694 {"corectl", 4, DEC, NOV, COR, HEX, HEX, HEX}, /* 0 */ 695 {"corectl", 2, DEC, NOV, COR, CCO}, /* 1 */ 696 {"corectl", 1, HHX, NOV, COR}, /* 2 */ 697 {"corectl", 3, DEC, NOV, COR, STG, DEC}, /* 3 */ 698 {"corectl", 3, DEC, NOV, COR, RST, DEC}, /* 4 */ 699 {"corectl", 4, DEC, NOV, COR, STG, DEC, DEC}, /* 5 */ 700 {"corectl", 4, DEC, NOV, COR, RST, DEC, DEC}, /* 6 */ 701 {"corectl", 2, DEC, NOV, COR, CCC}, /* 7 */ 702 {"corectl", 2, DEC, NOV, COR, RCC}, /* 8 */ 703 {"corectl", 3, DEC, NOV, COR, CCC, DEC}, /* 9 */ 704 {"corectl", 3, DEC, NOV, COR, RCC, DEC}, /* 10 */ 705 {"corectl", 3, DEC, NOV, COR, STG, DEC}, /* 11 */ 706 {"corectl", 3, DEC, NOV, COR, RST, DEC}, /* 12 */ 707 {"corectl", 2, DEC, NOV, COR, CCC}, /* 13 */ 708 {"corectl", 2, DEC, NOV, COR, RCC}, /* 14 */ 709 }; 710 #define NCORCODE (sizeof (cortable) / sizeof (struct systable)) 711 712 const struct systable aiotable[] = { 713 {"kaio", 7, DEC, NOV, AIO, DEC, HEX, DEC, LLO, HID, HEX}, /* 0 */ 714 {"kaio", 7, DEC, NOV, AIO, DEC, HEX, DEC, LLO, HID, HEX}, /* 1 */ 715 {"kaio", 3, DEC, NOV, AIO, HEX, DEC}, /* 2 */ 716 {"kaio", 3, DEC, NOV, AIO, DEC, HEX}, /* 3 */ 717 {"kaio", 1, DEC, NOV, AIO}, /* 4 */ 718 {"kaio", 1, DEC, NOV, AIO}, /* 5 */ 719 {"kaio", 1, DEC, NOV, AIO}, /* 6 */ 720 {"kaio", 5, DEC, NOV, AIO, LIO, HEX, DEC, HEX}, /* 7 */ 721 {"kaio", 5, DEC, NOV, AIO, HEX, DEC, HEX, DEC}, /* 8 */ 722 {"kaio", 2, DEC, NOV, AIO, HEX}, /* 9 */ 723 {"kaio", 5, DEC, NOV, AIO, LIO, HEX, DEC, HEX}, /* 10 */ 724 {"kaio", 2, DEC, NOV, AIO, HEX}, /* 11 */ 725 {"kaio", 2, DEC, NOV, AIO, HEX}, /* 12 */ 726 {"kaio", 5, DEC, NOV, AIO, LIO, HEX, DEC, HEX}, /* 13 */ 727 {"kaio", 5, DEC, NOV, AIO, HEX, DEC, HEX, DEC}, /* 14 */ 728 {"kaio", 2, DEC, NOV, AIO, HEX}, /* 15 */ 729 {"kaio", 5, DEC, NOV, AIO, LIO, HEX, DEC, HEX}, /* 16 */ 730 {"kaio", 2, DEC, NOV, AIO, HEX}, /* 17 */ 731 {"kaio", 2, DEC, NOV, AIO, HEX}, /* 18 */ 732 {"kaio", 3, DEC, NOV, AIO, DEC, HEX}, /* 19 */ 733 {"kaio", 1, DEC, NOV, AIO}, /* 20 */ 734 {"kaio", 5, DEC, NOV, AIO, HEX, DEC, HEX, HEX}, /* 21 */ 735 }; 736 #define NAIOCODE (sizeof (aiotable) / sizeof (struct systable)) 737 738 const struct systable doortable[] = { 739 {"door_create", 3, DEC, NOV, HEX, HEX, DFL}, /* 0 */ 740 {"door_revoke", 1, DEC, NOV, DEC}, /* 1 */ 741 {"door_info", 2, DEC, NOV, DEC, HEX}, /* 2 */ 742 {"door_call", 2, DEC, NOV, DEC, HEX}, /* 3 */ 743 {"door_return", 4, DEC, NOV, HEX, DEC, HEX, DEC}, /* 4 (old) */ 744 {"door_cred", 1, DEC, NOV, HEX}, /* 5 (old) */ 745 {"door_bind", 1, DEC, NOV, DEC}, /* 6 */ 746 {"door_unbind", 0, DEC, NOV}, /* 7 */ 747 {"door_unref", 0, DEC, NOV}, /* 8 */ 748 {"door_ucred", 1, DEC, NOV, HEX}, /* 9 */ 749 {"door_return", 5, DEC, NOV, HEX, DEC, HEX, HEX, DEC}, /* 10 */ 750 {"door_getparam", 3, DEC, NOV, DEC, DPM, HEX}, /* 11 */ 751 {"door_setparam", 3, DEC, NOV, DEC, DPM, DEC}, /* 12 */ 752 }; 753 #define NDOORCODE (sizeof (doortable) / sizeof (struct systable)) 754 755 const struct systable psettable[] = { 756 {"pset_create", 2, DEC, NOV, HID, HEX}, /* 0 */ 757 {"pset_destroy", 2, DEC, NOV, HID, PST}, /* 1 */ 758 {"pset_assign", 4, DEC, NOV, HID, PST, DEC, HEX}, /* 2 */ 759 {"pset_info", 5, DEC, NOV, HID, PST, HEX, HEX, HEX}, /* 3 */ 760 {"pset_bind", 5, DEC, NOV, HID, PST, IDT, DEC, HEX}, /* 4 */ 761 {"pset_getloadavg", 4, DEC, NOV, HID, PST, HEX, DEC}, /* 5 */ 762 {"pset_list", 3, DEC, NOV, HID, HEX, HEX}, /* 6 */ 763 {"pset_setattr", 3, DEC, NOV, HID, PST, HEX}, /* 7 */ 764 {"pset_getattr", 3, DEC, NOV, HID, PST, HEX}, /* 8 */ 765 {"pset_assign_forced", 4, DEC, NOV, HID, PST, DEC, HEX}, /* 9 */ 766 }; 767 #define NPSETCODE (sizeof (psettable) / sizeof (struct systable)) 768 769 const struct systable lwpcreatetable[] = { 770 {"lwp_create", 3, DEC, NOV, HEX, LWF, HEX}, /* 0 */ 771 {"lwp_create", 0, DEC, NOV}, /* 1 */ 772 }; 773 #define NLWPCREATECODE (sizeof (lwpcreatetable) / sizeof (struct systable)) 774 775 static const struct systable tasksystable[] = { 776 {"settaskid", 3, DEC, NOV, HID, DEC, HEX}, /* 0 */ 777 {"gettaskid", 1, DEC, NOV, HID}, /* 1 */ 778 {"getprojid", 1, DEC, NOV, HID}, /* 2 */ 779 }; 780 #define NTASKSYSCODE (sizeof (tasksystable) / sizeof (struct systable)) 781 782 static const struct systable privsystable[] = { 783 {"setppriv", 4, DEC, NOV, HID, PRO, PRN, PRS}, /* 0 */ 784 {"getppriv", 4, DEC, NOV, HID, HID, PRN, PRS}, /* 1 */ 785 {"getprivimplinfo", 5, DEC, NOV, HID, HID, HID, HEX, DEC}, /* 2 */ 786 {"setpflags", 3, DEC, NOV, HID, PFL, DEC}, /* 3 */ 787 {"getpflags", 2, DEC, NOV, HID, PFL}, /* 4 */ 788 {"issetugid", 0, DEC, NOV, HID}, /* 5 */ 789 }; 790 #define NPRIVSYSCODE (sizeof (privsystable) / sizeof (struct systable)) 791 792 static const struct systable exacctsystable[] = { 793 {"getacct", 5, DEC, NOV, HID, IDT, DEC, HEX, UNS}, /* 0 */ 794 {"putacct", 6, DEC, NOV, HID, IDT, DEC, HEX, UNS, HEX}, /* 1 */ 795 {"wracct", 4, DEC, NOV, HID, IDT, DEC, HEX}, /* 2 */ 796 }; 797 #define NEXACCTSYSCODE (sizeof (exacctsystable) / sizeof (struct systable)) 798 799 static const struct systable lwpparktable[] = { 800 {"lwp_park", 3, DEC, NOV, HID, HEX, DEC}, /* 0 */ 801 {"lwp_unpark", 2, DEC, NOV, HID, DEC}, /* 1 */ 802 {"lwp_unpark_all", 3, DEC, NOV, HID, HEX, DEC}, /* 2 */ 803 {"lwp_unpark_cancel", 2, DEC, NOV, HID, DEC}, /* 3 */ 804 {"lwp_set_park", 3, DEC, NOV, HID, HEX, DEC}, /* 4 */ 805 }; 806 #define NLWPPARKCODE (sizeof (lwpparktable) / sizeof (struct systable)) 807 808 static const struct systable lwprwlocktable[] = { 809 {"lwp_rwlock_rdlock", 3, DEC, NOV, HID, HEX, HEX}, /* 0 */ 810 {"lwp_rwlock_wrlock", 3, DEC, NOV, HID, HEX, HEX}, /* 1 */ 811 {"lwp_rwlock_tryrdlock", 2, DEC, NOV, HID, HEX}, /* 2 */ 812 {"lwp_rwlock_trywrlock", 2, DEC, NOV, HID, HEX}, /* 3 */ 813 {"lwp_rwlock_unlock", 2, DEC, NOV, HID, HEX}, /* 4 */ 814 }; 815 #define NLWPRWLOCKCODE (sizeof (lwprwlocktable) / sizeof (struct systable)) 816 817 static const struct systable sendfilevsystable[] = { 818 {"sendfilev", 5, DEC, NOV, DEC, DEC, HEX, DEC, HEX}, /* 0 */ 819 {"sendfilev64", 5, DEC, NOV, DEC, DEC, HEX, DEC, HEX}, /* 1 */ 820 }; 821 #define NSENDFILESYSCODE \ 822 (sizeof (sendfilevsystable) / sizeof (struct systable)) 823 824 static const struct systable lgrpsystable[] = { 825 {"meminfo", 3, DEC, NOV, HID, NOV, MIF}, /* 0 */ 826 {"_lgrpsys", 3, DEC, NOV, DEC, DEC, NOV}, /* 1 */ 827 {"lgrp_version", 3, DEC, NOV, HID, DEC, NOV}, /* 2 */ 828 {"_lgrpsys", 3, DEC, NOV, DEC, HEX, HEX}, /* 3 */ 829 {"lgrp_affinity_get", 3, DEC, NOV, HID, NOV, LAF}, /* 4 */ 830 {"lgrp_affinity_set", 3, DEC, NOV, HID, NOV, LAF}, /* 5 */ 831 {"lgrp_latency", 3, DEC, NOV, HID, DEC, DEC}, /* 6 */ 832 }; 833 #define NLGRPSYSCODE (sizeof (lgrpsystable) / sizeof (struct systable)) 834 835 static const struct systable rusagesystable[] = { 836 {"getrusage", 2, DEC, NOV, HID, HEX}, /* 0 */ 837 {"getrusage_chld", 2, DEC, NOV, HID, HEX}, /* 1 */ 838 {"getrusage_lwp", 2, DEC, NOV, HID, HEX}, /* 2 */ 839 {"getvmusage", 5, DEC, NOV, HID, HEX, DEC, HEX, HEX}, /* 3 */ 840 }; 841 #define NRUSAGESYSCODE \ 842 (sizeof (rusagesystable) / sizeof (struct systable)) 843 844 static const struct systable ucredsystable[] = { 845 {"ucred_get", 3, DEC, NOV, HID, DEC, HEX}, 846 {"getpeerucred", 3, DEC, NOV, HID, DEC, HEX}, 847 }; 848 #define NUCREDSYSCODE \ 849 (sizeof (ucredsystable) / sizeof (struct systable)) 850 851 const struct systable portfstable[] = { 852 {"port_create", 2, DEC, NOV, HID, DEC}, /* 0 */ 853 {"port_associate", 6, DEC, NOV, HID, DEC, DEC, HEX, HEX, HEX}, /* 1 */ 854 {"port_dissociate", 4, DEC, NOV, HID, DEC, DEC, HEX}, /* 2 */ 855 {"port_send", 4, DEC, NOV, HID, DEC, HEX, HEX}, /* 3 */ 856 {"port_sendn", 6, DEC, DEC, HID, HEX, HEX, DEC, HEX, HEX}, /* 4 */ 857 {"port_get", 4, DEC, NOV, HID, DEC, HEX, HEX}, /* 5 */ 858 {"port_getn", 6, DEC, DEC, HID, DEC, HEX, DEC, DEC, HEX}, /* 6 */ 859 {"port_alert", 5, DEC, NOV, HID, DEC, HEX, HEX, HEX}, /* 7 */ 860 {"port_dispatch", 6, DEC, NOV, HID, DEC, DEC, HEX, HEX, HEX}, /* 8 */ 861 }; 862 #define NPORTCODE (sizeof (portfstable) / sizeof (struct systable)) 863 864 static const struct systable zonetable[] = { 865 {"zone_create", 2, DEC, NOV, HID, HEX}, /* 0 */ 866 {"zone_destroy", 2, DEC, NOV, HID, DEC}, /* 1 */ 867 {"zone_getattr", 5, DEC, NOV, HID, DEC, ZGA, HEX, DEC}, /* 2 */ 868 {"zone_enter", 2, DEC, NOV, HID, DEC}, /* 3 */ 869 {"zone_list", 3, DEC, NOV, HID, HEX, HEX}, /* 4 */ 870 {"zone_shutdown", 2, DEC, NOV, HID, DEC}, /* 5 */ 871 {"zone_lookup", 2, DEC, NOV, HID, STG}, /* 6 */ 872 {"zone_boot", 2, DEC, NOV, HID, DEC}, /* 7 */ 873 {"zone_version", 2, HEX, NOV, HID, DEC}, /* 8 */ 874 {"zone_setattr", 5, DEC, NOV, HID, DEC, ZGA, HEX, DEC}, /* 9 */ 875 {"zone_add_datalink", 3, DEC, NOV, HID, DEC, STG}, /* 10 */ 876 {"zone_remove_datalink", 3, DEC, NOV, HID, DEC, STG}, /* 11 */ 877 {"zone_check_datalink", 3, DEC, NOV, HID, HEX, STG}, /* 12 */ 878 {"zone_list_datalink", 4, DEC, NOV, HID, DEC, HEX, HEX}, /* 13 */ 879 }; 880 #define NZONECODE (sizeof (zonetable) / sizeof (struct systable)) 881 882 static const struct systable labeltable[] = { 883 {"labelsys", 3, DEC, NOV, HID, HEX, HEX}, /* 0 */ 884 {"is_system_labeled", 1, DEC, NOV, HID}, /* 1 */ 885 {"tnrh", 3, DEC, NOV, HID, TND, HEX}, /* 2 */ 886 {"tnrhtp", 3, DEC, NOV, HID, TND, HEX}, /* 3 */ 887 {"tnmlp", 3, DEC, NOV, HID, TND, HEX}, /* 4 */ 888 {"getlabel", 3, DEC, NOV, HID, STG, HEX}, /* 5 */ 889 {"fgetlabel", 3, DEC, NOV, HID, DEC, HEX}, /* 6 */ 890 }; 891 #define NLABELCODE (sizeof (labeltable) / sizeof (struct systable)) 892 893 const struct systable forktable[] = { 894 /* parent codes */ 895 {"forkx", 2, DEC, NOV, HID, FXF}, /* 0 */ 896 {"forkallx", 2, DEC, NOV, HID, FXF}, /* 1 */ 897 {"vforkx", 2, DEC, NOV, HID, FXF}, /* 2 */ 898 /* child codes */ 899 {"forkx", 0, DEC, NOV}, /* 3 */ 900 {"forkallx", 0, DEC, NOV}, /* 4 */ 901 {"vforkx", 0, DEC, NOV}, /* 5 */ 902 }; 903 #define NFORKCODE (sizeof (forktable) / sizeof (struct systable)) 904 905 const struct systable sidsystable[] = { 906 {"allocids", 4, UNS, UNS, HID, DEC, DEC, DEC}, /* 0 */ 907 {"idmap_reg", 2, DEC, NOV, HID, DEC}, /* 1 */ 908 {"idmap_unreg", 2, DEC, NOV, HID, DEC}, /* 2 */ 909 }; 910 #define NSIDSYSCODE (sizeof (sidsystable) / sizeof (struct systable)) 911 912 const struct systable utimesystable[] = { 913 {"futimens", 3, DEC, NOV, HID, DEC, HEX}, /* 0 */ 914 {"utimensat", 5, DEC, NOV, HID, ATC, STG, HEX, SNF}, /* 1 */ 915 }; 916 #define NUTIMESYSCODE (sizeof (utimesystable) / sizeof (struct systable)) 917 918 const struct systable sockconfigtable[] = { 919 {"sockconfig", 5, DEC, NOV, SKC, DEC, DEC, DEC, STG}, /* 0 */ 920 {"sockconfig", 4, DEC, NOV, SKC, DEC, DEC, DEC}, /* 1 */ 921 {"sockconfig", 3, DEC, NOV, SKC, STG, HEX }, /* 2 */ 922 {"sockconfig", 2, DEC, NOV, SKC, STG }, /* 3 */ 923 }; 924 #define NSOCKCONFIGCODE (sizeof (sockconfigtable) / sizeof (struct systable)) 925 926 const struct sysalias sysalias[] = { 927 { "exit", SYS_exit }, 928 { "fork", SYS_forksys }, 929 { "fork1", SYS_forksys }, 930 { "forkall", SYS_forksys }, 931 { "forkx", SYS_forksys }, 932 { "forkallx", SYS_forksys }, 933 { "vforkx", SYS_forksys }, 934 { "sbrk", SYS_brk }, 935 { "getppid", SYS_getpid }, 936 { "geteuid", SYS_getuid }, 937 { "getpgrp", SYS_pgrpsys }, 938 { "setpgrp", SYS_pgrpsys }, 939 { "getsid", SYS_pgrpsys }, 940 { "setsid", SYS_pgrpsys }, 941 { "getpgid", SYS_pgrpsys }, 942 { "setpgid", SYS_pgrpsys }, 943 { "getegid", SYS_getgid }, 944 { "msgget", SYS_msgsys }, 945 { "msgctl", SYS_msgsys }, 946 { "msgctl64", SYS_msgsys }, 947 { "msgrcv", SYS_msgsys }, 948 { "msgsnd", SYS_msgsys }, 949 { "msgids", SYS_msgsys }, 950 { "msgsnap", SYS_msgsys }, 951 { "msgop", SYS_msgsys }, 952 { "shmat", SYS_shmsys }, 953 { "shmctl", SYS_shmsys }, 954 { "shmctl64", SYS_shmsys }, 955 { "shmdt", SYS_shmsys }, 956 { "shmget", SYS_shmsys }, 957 { "shmids", SYS_shmsys }, 958 { "shmop", SYS_shmsys }, 959 { "semctl", SYS_semsys }, 960 { "semctl64", SYS_semsys }, 961 { "semget", SYS_semsys }, 962 { "semids", SYS_semsys }, 963 { "semop", SYS_semsys }, 964 { "semtimedop", SYS_semsys }, 965 { "uname", SYS_utssys }, 966 { "ustat", SYS_utssys }, 967 { "fusers", SYS_utssys }, 968 { "exec", SYS_execve }, 969 { "execl", SYS_execve }, 970 { "execv", SYS_execve }, 971 { "execle", SYS_execve }, 972 { "execlp", SYS_execve }, 973 { "execve", SYS_execve }, 974 { "execvp", SYS_execve }, 975 { "fexecve", SYS_execve }, 976 { "sigfillset", SYS_sigpending }, 977 { "getcontext", SYS_context }, 978 { "setcontext", SYS_context }, 979 { "getustack", SYS_context }, 980 { "setustack", SYS_context }, 981 { "hrtcntl", SYS_hrtsys }, 982 { "hrtalarm", SYS_hrtsys }, 983 { "hrtsleep", SYS_hrtsys }, 984 { "hrtcancel", SYS_hrtsys }, 985 { "aioread", SYS_kaio }, 986 { "aiowrite", SYS_kaio }, 987 { "aiowait", SYS_kaio }, 988 { "aiocancel", SYS_kaio }, 989 { "aionotify", SYS_kaio }, 990 { "audit", SYS_auditsys }, 991 { "door_create", SYS_door }, 992 { "door_revoke", SYS_door }, 993 { "door_info", SYS_door }, 994 { "door_call", SYS_door }, 995 { "door_return", SYS_door }, 996 { "door_bind", SYS_door }, 997 { "door_unbind", SYS_door }, 998 { "door_unref", SYS_door }, 999 { "door_ucred", SYS_door }, 1000 { "door_getparam", SYS_door }, 1001 { "door_setparam", SYS_door }, 1002 { "pset_create", SYS_pset }, 1003 { "pset_destroy", SYS_pset }, 1004 { "pset_assign", SYS_pset }, 1005 { "pset_info", SYS_pset }, 1006 { "pset_bind", SYS_pset }, 1007 { "pset_getloadavg", SYS_pset }, 1008 { "pset_list", SYS_pset }, 1009 { "pset_setattr", SYS_pset }, 1010 { "pset_getattr", SYS_pset }, 1011 { "pset_assign_forced", SYS_pset }, 1012 { "settaskid", SYS_tasksys }, 1013 { "gettaskid", SYS_tasksys }, 1014 { "getprojid", SYS_tasksys }, 1015 { "setppriv", SYS_privsys }, 1016 { "getppriv", SYS_privsys }, 1017 { "getprivimplinfo", SYS_privsys }, 1018 { "setpflags", SYS_privsys }, 1019 { "getpflags", SYS_privsys }, 1020 { "getacct", SYS_exacctsys }, 1021 { "putacct", SYS_exacctsys }, 1022 { "wracct", SYS_exacctsys }, 1023 { "lwp_cond_timedwait", SYS_lwp_cond_wait }, 1024 { "lwp_sema_wait", SYS_lwp_sema_timedwait }, 1025 { "lwp_park", SYS_lwp_park }, 1026 { "lwp_unpark", SYS_lwp_park }, 1027 { "lwp_unpark_all", SYS_lwp_park }, 1028 { "lwp_rwlock_rdlock", SYS_lwp_rwlock_sys }, 1029 { "lwp_rwlock_wrlock", SYS_lwp_rwlock_sys }, 1030 { "lwp_rwlock_tryrdlock", SYS_lwp_rwlock_sys }, 1031 { "lwp_rwlock_trywrlock", SYS_lwp_rwlock_sys }, 1032 { "lwp_rwlock_unlock", SYS_lwp_rwlock_sys }, 1033 { "lwp_mutex_lock", SYS_lwp_mutex_timedlock }, 1034 { "sendfilev64", SYS_sendfilev }, 1035 { "creat", SYS_open }, 1036 { "creat64", SYS_open64 }, 1037 { "openattrdirat", SYS_openat }, 1038 { "lgrpsys", SYS_lgrpsys }, 1039 { "getrusage", SYS_rusagesys }, 1040 { "getrusage_chld", SYS_rusagesys }, 1041 { "getrusage_lwp", SYS_rusagesys }, 1042 { "getvmusage", SYS_rusagesys }, 1043 { "getpeerucred", SYS_ucredsys }, 1044 { "ucred_get", SYS_ucredsys }, 1045 { "port_create", SYS_port }, 1046 { "port_associate", SYS_port }, 1047 { "port_dissociate", SYS_port }, 1048 { "port_send", SYS_port }, 1049 { "port_sendn", SYS_port }, 1050 { "port_get", SYS_port }, 1051 { "port_getn", SYS_port }, 1052 { "port_alert", SYS_port }, 1053 { "port_dispatch", SYS_port }, 1054 { "zone_create", SYS_zone }, 1055 { "zone_destroy", SYS_zone }, 1056 { "zone_getattr", SYS_zone }, 1057 { "zone_setattr", SYS_zone }, 1058 { "zone_enter", SYS_zone }, 1059 { "getzoneid", SYS_zone }, 1060 { "zone_list", SYS_zone }, 1061 { "zone_shutdown", SYS_zone }, 1062 { "zone_add_datalink", SYS_zone }, 1063 { "zone_remove_datalink", SYS_zone }, 1064 { "zone_check_datalink", SYS_zone }, 1065 { "zone_list_datalink", SYS_zone }, 1066 { "is_system_labeled", SYS_labelsys }, 1067 { "tnrh", SYS_labelsys }, 1068 { "tnrhtp", SYS_labelsys }, 1069 { "tnmlp", SYS_labelsys }, 1070 { "getlabel", SYS_labelsys }, 1071 { "fgetlabel", SYS_labelsys }, 1072 { "getrctl", SYS_rctlsys }, 1073 { "setrctl", SYS_rctlsys }, 1074 { "rctlsys_lst", SYS_rctlsys }, 1075 { "rctlsys_ctl", SYS_rctlsys }, 1076 { "allocids", SYS_sidsys }, 1077 { "futimens", SYS_utimesys }, 1078 { "utimensat", SYS_utimesys }, 1079 { "poll", SYS_pollsys }, 1080 { "umount", SYS_umount2 }, 1081 { "wait", SYS_waitid }, 1082 { NULL, 0 } /* end-of-list */ 1083 }; 1084 1085 /* 1086 * Return structure to interpret system call with sub-codes. 1087 */ 1088 const struct systable * 1089 subsys(int syscall, int subcode) 1090 { 1091 const struct systable *stp = NULL; 1092 1093 if (subcode != -1) { 1094 switch (syscall) { 1095 case SYS_faccessat: 1096 if ((unsigned)subcode < NACCESSCODE) 1097 stp = &faccessattable[subcode]; 1098 break; 1099 case SYS_fchmodat: 1100 if ((unsigned)subcode < NCHMODCODE) 1101 stp = &fchmodattable[subcode]; 1102 break; 1103 case SYS_fchownat: 1104 if ((unsigned)subcode < NCHOWNCODE) 1105 stp = &fchownattable[subcode]; 1106 break; 1107 case SYS_mkdirat: 1108 if ((unsigned)subcode < NMKDIRCODE) 1109 stp = &mkdiratattable[subcode]; 1110 break; 1111 case SYS_mknodat: 1112 if ((unsigned)subcode < NMKMODCODE) 1113 stp = &mknodatattable[subcode]; 1114 break; 1115 case SYS_renameat: 1116 if ((unsigned)subcode < NRENAMECODE) 1117 stp = &renameattable[subcode]; 1118 break; 1119 case SYS_linkat: 1120 if ((unsigned)subcode < NLINKATCODE) 1121 stp = &linkattable[subcode]; 1122 break; 1123 case SYS_unlinkat: 1124 if ((unsigned)subcode < NUNLINKCODE) 1125 stp = &unlinkattable[subcode]; 1126 break; 1127 case SYS_symlinkat: 1128 if ((unsigned)subcode < NSYMLINKCODE) 1129 stp = &symlinkattable[subcode]; 1130 break; 1131 case SYS_readlinkat: 1132 if ((unsigned)subcode < NREADLINKCODE) 1133 stp = &readlinkattable[subcode]; 1134 break; 1135 case SYS_fstatat: 1136 if ((unsigned)subcode < NSTATCODE) 1137 stp = &fstatattable[subcode]; 1138 break; 1139 case SYS_fstatat64: 1140 if ((unsigned)subcode < NSTAT64CODE) 1141 stp = &fstatat64table[subcode]; 1142 break; 1143 case SYS_openat: 1144 if ((unsigned)subcode < NOPENATCODE) 1145 stp = &openattable[subcode]; 1146 break; 1147 case SYS_openat64: 1148 if ((unsigned)subcode < NOPENAT64CODE) 1149 stp = &openat64table[subcode]; 1150 break; 1151 case SYS_open: 1152 if ((unsigned)subcode < NOPENCODE) 1153 stp = &opentable[subcode]; 1154 break; 1155 case SYS_open64: 1156 if ((unsigned)subcode < NOPEN64CODE) 1157 stp = &open64table[subcode]; 1158 break; 1159 case SYS_msgsys: /* msgsys() */ 1160 if ((unsigned)subcode < NMSGCODE) 1161 stp = &msgtable[subcode]; 1162 break; 1163 case SYS_semsys: /* semsys() */ 1164 if ((unsigned)subcode < NSEMCODE) 1165 stp = &semtable[subcode]; 1166 break; 1167 case SYS_shmsys: /* shmsys() */ 1168 if ((unsigned)subcode < NSHMCODE) 1169 stp = &shmtable[subcode]; 1170 break; 1171 case SYS_pgrpsys: /* pgrpsys() */ 1172 if ((unsigned)subcode < NPIDCODE) 1173 stp = &pidtable[subcode]; 1174 break; 1175 case SYS_utssys: /* utssys() */ 1176 if ((unsigned)subcode < NUTSCODE) 1177 stp = &utstable[subcode]; 1178 break; 1179 case SYS_sysfs: /* sysfs() */ 1180 if ((unsigned)subcode < NSFSCODE) 1181 stp = &sfstable[subcode]; 1182 break; 1183 case SYS_sigpending: /* sigpending()/sigfillset() */ 1184 if ((unsigned)subcode < NSGPCODE) 1185 stp = &sgptable[subcode]; 1186 break; 1187 case SYS_context: /* [get|set]context() */ 1188 if ((unsigned)subcode < NCTXCODE) 1189 stp = &ctxtable[subcode]; 1190 break; 1191 case SYS_hrtsys: /* hrtsys() */ 1192 if ((unsigned)subcode < NHRTCODE) 1193 stp = &hrttable[subcode]; 1194 break; 1195 case SYS_corectl: /* corectl() */ 1196 if ((unsigned)subcode < NCORCODE) 1197 stp = &cortable[subcode]; 1198 break; 1199 case SYS_kaio: /* kaio() */ 1200 if ((unsigned)subcode < NAIOCODE) 1201 stp = &aiotable[subcode]; 1202 break; 1203 case SYS_door: /* doors */ 1204 if ((unsigned)subcode < NDOORCODE) 1205 stp = &doortable[subcode]; 1206 break; 1207 case SYS_pset: /* pset() */ 1208 if ((unsigned)subcode < NPSETCODE) 1209 stp = &psettable[subcode]; 1210 break; 1211 case SYS_lwp_create: /* lwp_create() */ 1212 if ((unsigned)subcode < NLWPCREATECODE) 1213 stp = &lwpcreatetable[subcode]; 1214 break; 1215 case SYS_tasksys: /* tasks */ 1216 if ((unsigned)subcode < NTASKSYSCODE) 1217 stp = &tasksystable[subcode]; 1218 break; 1219 case SYS_exacctsys: /* exacct */ 1220 if ((unsigned)subcode < NEXACCTSYSCODE) 1221 stp = &exacctsystable[subcode]; 1222 break; 1223 case SYS_privsys: /* privileges */ 1224 if ((unsigned)subcode < NPRIVSYSCODE) 1225 stp = &privsystable[subcode]; 1226 break; 1227 case SYS_lwp_park: /* lwp_park */ 1228 if ((unsigned)subcode < NLWPPARKCODE) 1229 stp = &lwpparktable[subcode]; 1230 break; 1231 case SYS_lwp_rwlock_sys: 1232 if ((unsigned)subcode < NLWPRWLOCKCODE) 1233 stp = &lwprwlocktable[subcode]; 1234 break; 1235 case SYS_sendfilev: /* sendfilev */ 1236 if ((unsigned)subcode < NSENDFILESYSCODE) 1237 stp = &sendfilevsystable[subcode]; 1238 break; 1239 case SYS_lgrpsys: /* lgrpsys */ 1240 if ((unsigned)subcode < NLGRPSYSCODE) 1241 stp = &lgrpsystable[subcode]; 1242 break; 1243 case SYS_rusagesys: /* rusagesys */ 1244 if ((unsigned)subcode < NRUSAGESYSCODE) 1245 stp = &rusagesystable[subcode]; 1246 break; 1247 case SYS_fcntl: /* fcntl */ 1248 if ((unsigned)subcode < NFCNTLCODE) 1249 stp = &fcntltable[subcode]; 1250 break; 1251 case SYS_ucredsys: 1252 if ((unsigned)subcode < NUCREDSYSCODE) 1253 stp = &ucredsystable[subcode]; 1254 break; 1255 case SYS_port: /* portfs */ 1256 if ((unsigned)subcode < NPORTCODE) 1257 stp = &portfstable[subcode]; 1258 break; 1259 case SYS_zone: /* zone family */ 1260 if ((unsigned)subcode < NZONECODE) 1261 stp = &zonetable[subcode]; 1262 break; 1263 case SYS_labelsys: /* label family */ 1264 if ((unsigned)subcode < NLABELCODE) 1265 stp = &labeltable[subcode]; 1266 break; 1267 case SYS_rctlsys: /* rctl family */ 1268 if ((unsigned)subcode < NRCTLCODE) 1269 stp = &rctltable[subcode]; 1270 break; 1271 case SYS_forksys: /* fork family */ 1272 if ((unsigned)subcode < NFORKCODE) 1273 stp = &forktable[subcode]; 1274 break; 1275 case SYS_sidsys: /* SID family */ 1276 if ((unsigned)subcode < NSIDSYSCODE) 1277 stp = &sidsystable[subcode]; 1278 break; 1279 case SYS_utimesys: /* utime family */ 1280 if ((unsigned)subcode < NUTIMESYSCODE) 1281 stp = &utimesystable[subcode]; 1282 break; 1283 case SYS_sockconfig: /* sockconfig family */ 1284 if ((unsigned)subcode < NSOCKCONFIGCODE) 1285 stp = &sockconfigtable[subcode]; 1286 break; 1287 } 1288 } 1289 1290 if (stp == NULL) 1291 stp = &systable[((unsigned)syscall < SYSEND)? syscall : 0]; 1292 1293 return (stp); 1294 } 1295 1296 /* 1297 * Return the name of the system call. 1298 */ 1299 const char * 1300 sysname(private_t *pri, int syscall, int subcode) 1301 { 1302 const struct systable *stp = subsys(syscall, subcode); 1303 const char *name = stp->name; /* may be NULL */ 1304 1305 if (name == NULL) { /* manufacture a name */ 1306 (void) sprintf(pri->sys_name, "sys#%d", syscall); 1307 name = pri->sys_name; 1308 } 1309 1310 return (name); 1311 } 1312 1313 /* 1314 * Return the name of the signal. 1315 * Return NULL if unknown signal. 1316 */ 1317 const char * 1318 rawsigname(private_t *pri, int sig) 1319 { 1320 /* 1321 * The C library function sig2str() omits the leading "SIG". 1322 */ 1323 (void) strcpy(pri->raw_sig_name, "SIG"); 1324 1325 if (sig > 0 && sig2str(sig, pri->raw_sig_name+3) == 0) 1326 return (pri->raw_sig_name); 1327 return (NULL); 1328 } 1329 1330 /* 1331 * Return the name of the signal. 1332 * Manufacture a name for unknown signal. 1333 */ 1334 const char * 1335 signame(private_t *pri, int sig) 1336 { 1337 const char *name = rawsigname(pri, sig); 1338 1339 if (name == NULL) { /* manufacture a name */ 1340 (void) sprintf(pri->sig_name, "SIG#%d", sig); 1341 name = pri->sig_name; 1342 } 1343 1344 return (name); 1345 } 1346 1347 /* 1348 * Determine the subcode for this syscall, if any. 1349 */ 1350 int 1351 getsubcode(private_t *pri) 1352 { 1353 const lwpstatus_t *Lsp = pri->lwpstat; 1354 int syscall = Lsp->pr_syscall; 1355 int nsysarg = Lsp->pr_nsysarg; 1356 int subcode = -1; 1357 int arg0; 1358 1359 if (syscall > 0 && nsysarg > 0 && !prismember(&rawout, syscall)) { 1360 arg0 = Lsp->pr_sysarg[0]; 1361 switch (syscall) { 1362 case SYS_utssys: /* utssys() */ 1363 if (nsysarg > 2) 1364 subcode = Lsp->pr_sysarg[2]; 1365 break; 1366 case SYS_faccessat: 1367 if (nsysarg > 3) 1368 subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD && 1369 Lsp->pr_sysarg[3] == 0)? 1 : 0; 1370 break; 1371 case SYS_fchmodat: 1372 if (nsysarg > 1 && Lsp->pr_sysarg[1] == 0) { 1373 subcode = 3; 1374 break; 1375 } 1376 if (nsysarg > 0 && (int)Lsp->pr_sysarg[0] != AT_FDCWD) { 1377 subcode = 0; 1378 break; 1379 } 1380 if (nsysarg > 3) 1381 subcode = (Lsp->pr_sysarg[3] == 0)? 1 : 1382 (Lsp->pr_sysarg[3] == AT_SYMLINK_NOFOLLOW)? 1383 2 : 0; 1384 break; 1385 case SYS_fchownat: 1386 if (nsysarg > 1 && Lsp->pr_sysarg[1] == 0) { 1387 subcode = 3; 1388 break; 1389 } 1390 if (nsysarg > 0 && (int)Lsp->pr_sysarg[0] != AT_FDCWD) { 1391 subcode = 0; 1392 break; 1393 } 1394 if (nsysarg > 4) 1395 subcode = (Lsp->pr_sysarg[4] == 0)? 1 : 1396 (Lsp->pr_sysarg[4] == AT_SYMLINK_NOFOLLOW)? 1397 2 : 0; 1398 break; 1399 case SYS_mkdirat: 1400 case SYS_mknodat: 1401 case SYS_readlinkat: 1402 if (nsysarg > 0) 1403 subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD)? 1404 1 : 0; 1405 break; 1406 case SYS_renameat: 1407 if (nsysarg > 2) 1408 subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD && 1409 (int)Lsp->pr_sysarg[2] == AT_FDCWD)? 1 : 0; 1410 break; 1411 case SYS_linkat: 1412 if (nsysarg > 4) 1413 subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD && 1414 (int)Lsp->pr_sysarg[2] == AT_FDCWD && 1415 Lsp->pr_sysarg[4] == 0)? 1 : 0; 1416 break; 1417 case SYS_unlinkat: 1418 if (nsysarg > 2) 1419 subcode = 1420 ((int)Lsp->pr_sysarg[0] != AT_FDCWD)? 0 : 1421 (Lsp->pr_sysarg[2] == AT_REMOVEDIR)? 2 : 1422 (Lsp->pr_sysarg[2] == 0)? 1 : 0; 1423 break; 1424 case SYS_symlinkat: 1425 if (nsysarg > 1) 1426 subcode = ((int)Lsp->pr_sysarg[1] == AT_FDCWD)? 1427 1 : 0; 1428 break; 1429 case SYS_fstatat: 1430 case SYS_fstatat64: 1431 if (nsysarg > 1 && Lsp->pr_sysarg[1] == 0) { 1432 subcode = 3; 1433 break; 1434 } 1435 if (nsysarg > 0 && (int)Lsp->pr_sysarg[0] != AT_FDCWD) { 1436 subcode = 0; 1437 break; 1438 } 1439 if (nsysarg > 3) 1440 subcode = (Lsp->pr_sysarg[3] == 0)? 1 : 1441 (Lsp->pr_sysarg[3] == AT_SYMLINK_NOFOLLOW)? 1442 2 : 0; 1443 break; 1444 case SYS_openat: /* openat() w/ and w/o AT_FDCWD */ 1445 case SYS_openat64: /* and with and w/o O_CREAT */ 1446 if (nsysarg > 2) 1447 subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD)? 1448 ((Lsp->pr_sysarg[2] & O_CREAT)? 3 : 2) : 1449 ((Lsp->pr_sysarg[2] & O_CREAT)? 1 : 0); 1450 break; 1451 case SYS_open: /* open() w/ and w/o O_CREAT */ 1452 case SYS_open64: 1453 if (nsysarg > 1) 1454 subcode = (Lsp->pr_sysarg[1] & O_CREAT)? 1 : 0; 1455 break; 1456 case SYS_kaio: /* kaio() */ 1457 subcode = arg0 & ~AIO_POLL_BIT; 1458 break; 1459 case SYS_door: /* doors */ 1460 if (nsysarg > 5) 1461 subcode = Lsp->pr_sysarg[5]; 1462 break; 1463 case SYS_lwp_create: /* lwp_create() */ 1464 subcode = /* 0 for parent, 1 for child */ 1465 (Lsp->pr_why == PR_SYSEXIT && Lsp->pr_errno == 0 && 1466 Lsp->pr_rval1 == 0); 1467 break; 1468 case SYS_forksys: /* forksys */ 1469 subcode = arg0; 1470 if (Lsp->pr_why == PR_SYSEXIT && Lsp->pr_errno == 0 && 1471 pri->Rval2 != 0) /* this is the child */ 1472 subcode += 3; 1473 break; 1474 case SYS_msgsys: /* msgsys() */ 1475 case SYS_semsys: /* semsys() */ 1476 case SYS_shmsys: /* shmsys() */ 1477 case SYS_pgrpsys: /* pgrpsys() */ 1478 case SYS_sysfs: /* sysfs() */ 1479 case SYS_sigpending: /* sigpending()/sigfillset() */ 1480 case SYS_context: /* [get|set]context() */ 1481 case SYS_hrtsys: /* hrtsys() */ 1482 case SYS_corectl: /* corectl() */ 1483 case SYS_pset: /* pset() */ 1484 case SYS_tasksys: /* tasks */ 1485 case SYS_privsys: /* privileges */ 1486 case SYS_exacctsys: /* exacct */ 1487 case SYS_lwp_park: /* lwp_park */ 1488 case SYS_lwp_rwlock_sys: /* lwp_rwlock_*() */ 1489 case SYS_sendfilev: /* sendfilev */ 1490 case SYS_lgrpsys: /* lgrpsys */ 1491 case SYS_rusagesys: /* rusagesys */ 1492 case SYS_ucredsys: /* ucredsys */ 1493 case SYS_zone: /* zone */ 1494 case SYS_labelsys: /* labelsys */ 1495 case SYS_rctlsys: /* rctlsys */ 1496 case SYS_sidsys: /* sidsys */ 1497 case SYS_utimesys: /* utimesys */ 1498 case SYS_sockconfig: /* sockconfig */ 1499 subcode = arg0; 1500 break; 1501 case SYS_fcntl: /* fcntl() */ 1502 if (nsysarg > 2) { 1503 switch (Lsp->pr_sysarg[1]) { 1504 default: subcode = 0; break; 1505 case F_GETFL: 1506 case F_GETOWN: 1507 case F_GETXFL: subcode = 1; break; 1508 case F_SETFL: subcode = 2; break; 1509 } 1510 } 1511 break; 1512 case SYS_port: /* portfs */ 1513 subcode = arg0 & PORT_CODE_MASK; 1514 break; 1515 } 1516 } 1517 1518 return (subcode); 1519 } 1520 1521 /* 1522 * Return the maximum number of system calls, counting 1523 * all system calls with subcodes as separate calls. 1524 */ 1525 int 1526 maxsyscalls() 1527 { 1528 return (PRMAXSYS + 1 1529 + NACCESSCODE - 1 1530 + NCHMODCODE - 1 1531 + NCHOWNCODE - 1 1532 + NMKDIRCODE - 1 1533 + NMKMODCODE - 1 1534 + NRENAMECODE - 1 1535 + NLINKATCODE - 1 1536 + NUNLINKCODE - 1 1537 + NSYMLINKCODE - 1 1538 + NREADLINKCODE - 1 1539 + NSTATCODE - 1 1540 + NSTAT64CODE - 1 1541 + NOPENATCODE - 1 1542 + NOPENAT64CODE - 1 1543 + NOPENCODE - 1 1544 + NOPEN64CODE - 1 1545 + NMSGCODE - 1 1546 + NSEMCODE - 1 1547 + NSHMCODE - 1 1548 + NPIDCODE - 1 1549 + NSFSCODE - 1 1550 + NUTSCODE - 1 1551 + NSGPCODE - 1 1552 + NCTXCODE - 1 1553 + NHRTCODE - 1 1554 + NCORCODE - 1 1555 + NAIOCODE - 1 1556 + NDOORCODE - 1 1557 + NPSETCODE - 1 1558 + NLWPCREATECODE - 1 1559 + NTASKSYSCODE - 1 1560 + NEXACCTSYSCODE - 1 1561 + NLWPPARKCODE - 1 1562 + NLWPRWLOCKCODE - 1 1563 + NSENDFILESYSCODE - 1 1564 + NLGRPSYSCODE - 1 1565 + NRUSAGESYSCODE - 1 1566 + NFCNTLCODE - 1 1567 + NPRIVSYSCODE - 1 1568 + NUCREDSYSCODE - 1 1569 + NPORTCODE - 1 1570 + NZONECODE - 1 1571 + NLABELCODE - 1 1572 + NRCTLCODE - 1 1573 + NFORKCODE - 1 1574 + NSIDSYSCODE - 1 1575 + NUTIMESYSCODE - 1 1576 + NSOCKCONFIGCODE - 1); 1577 } 1578 1579 /* 1580 * Return the number of subcodes for the specified system call number. 1581 */ 1582 int 1583 nsubcodes(int syscall) 1584 { 1585 switch (syscall) { 1586 case SYS_faccessat: 1587 return (NACCESSCODE); 1588 case SYS_fchmodat: 1589 return (NCHMODCODE); 1590 case SYS_fchownat: 1591 return (NCHOWNCODE); 1592 case SYS_mkdirat: 1593 return (NMKDIRCODE); 1594 case SYS_mknodat: 1595 return (NMKMODCODE); 1596 case SYS_renameat: 1597 return (NRENAMECODE); 1598 case SYS_linkat: 1599 return (NLINKATCODE); 1600 case SYS_unlinkat: 1601 return (NUNLINKCODE); 1602 case SYS_symlinkat: 1603 return (NSYMLINKCODE); 1604 case SYS_readlinkat: 1605 return (NREADLINKCODE); 1606 case SYS_fstatat: 1607 return (NSTATCODE); 1608 case SYS_fstatat64: 1609 return (NSTAT64CODE); 1610 case SYS_openat: 1611 return (NOPENATCODE); 1612 case SYS_openat64: 1613 return (NOPENAT64CODE); 1614 case SYS_open: 1615 return (NOPENCODE); 1616 case SYS_open64: 1617 return (NOPEN64CODE); 1618 case SYS_msgsys: 1619 return (NMSGCODE); 1620 case SYS_semsys: 1621 return (NSEMCODE); 1622 case SYS_shmsys: 1623 return (NSHMCODE); 1624 case SYS_pgrpsys: 1625 return (NPIDCODE); 1626 case SYS_utssys: 1627 return (NUTSCODE); 1628 case SYS_sysfs: 1629 return (NSFSCODE); 1630 case SYS_sigpending: 1631 return (NSGPCODE); 1632 case SYS_context: 1633 return (NCTXCODE); 1634 case SYS_hrtsys: 1635 return (NHRTCODE); 1636 case SYS_corectl: 1637 return (NCORCODE); 1638 case SYS_kaio: 1639 return (NAIOCODE); 1640 case SYS_door: 1641 return (NDOORCODE); 1642 case SYS_pset: 1643 return (NPSETCODE); 1644 case SYS_lwp_create: 1645 return (NLWPCREATECODE); 1646 case SYS_tasksys: 1647 return (NTASKSYSCODE); 1648 case SYS_exacctsys: 1649 return (NEXACCTSYSCODE); 1650 case SYS_privsys: 1651 return (NPRIVSYSCODE); 1652 case SYS_lwp_park: 1653 return (NLWPPARKCODE); 1654 case SYS_lwp_rwlock_sys: 1655 return (NLWPRWLOCKCODE); 1656 case SYS_sendfilev: 1657 return (NSENDFILESYSCODE); 1658 case SYS_lgrpsys: 1659 return (NLGRPSYSCODE); 1660 case SYS_rusagesys: 1661 return (NRUSAGESYSCODE); 1662 case SYS_fcntl: 1663 return (NFCNTLCODE); 1664 case SYS_ucredsys: 1665 return (NUCREDSYSCODE); 1666 case SYS_port: 1667 return (NPORTCODE); 1668 case SYS_zone: 1669 return (NZONECODE); 1670 case SYS_labelsys: 1671 return (NLABELCODE); 1672 case SYS_rctlsys: 1673 return (NRCTLCODE); 1674 case SYS_forksys: 1675 return (NFORKCODE); 1676 case SYS_sidsys: 1677 return (NSIDSYSCODE); 1678 case SYS_utimesys: 1679 return (NUTIMESYSCODE); 1680 case SYS_sockconfig: 1681 return (NSOCKCONFIGCODE); 1682 default: 1683 return (1); 1684 } 1685 } 1686 1687 1688 1689 /* Socket address families (and protocol families) */ 1690 const char * const afcodes[] = { 1691 "UNSPEC", /* 0 */ 1692 "UNIX", /* 1 */ 1693 "INET", /* 2 */ 1694 "IMPLINK", /* 3 */ 1695 "PUP", /* 4 */ 1696 "CHAOS", /* 5 */ 1697 "NS", /* 6 */ 1698 "NBS", /* 7 */ 1699 "ECMA", /* 8 */ 1700 "DATAKIT", /* 9 */ 1701 "CCITT", /* 10 */ 1702 "SNA", /* 11 */ 1703 "DECnet", /* 12 */ 1704 "DLI", /* 13 */ 1705 "LAT", /* 14 */ 1706 "HYLINK", /* 15 */ 1707 "APPLETALK", /* 16 */ 1708 "NIT", /* 17 */ 1709 "802", /* 18 */ 1710 "OSI", /* 19 */ 1711 "X25", /* 20 */ 1712 "OSINET", /* 21 */ 1713 "GOSIP", /* 22 */ 1714 "IPX", /* 23 */ 1715 "ROUTE", /* 24 */ 1716 "LINK", /* 25 */ 1717 "INET6", /* 26 */ 1718 "KEY", /* 27 */ 1719 "NCA", /* 28 */ 1720 "POLICY", /* 29 */ 1721 "RDS", /* 30 */ 1722 "TRILL", /* 31 */ 1723 "PACKET" /* 32 */ 1724 }; 1725 #if MAX_AFCODES != 33 1726 #error Need to update address-family table 1727 #endif 1728 1729 1730 const char * const socktype_codes[] = { /* cf socket.h */ 1731 NULL, 1732 "SOCK_DGRAM", /* 1 */ 1733 "SOCK_STREAM", /* 2 */ 1734 NULL, 1735 "SOCK_RAW", /* 4 */ 1736 "SOCK_RDM", /* 5 */ 1737 "SOCK_SEQPACKET" /* 6 */ 1738 }; 1739 #if MAX_SOCKTYPES != 7 1740 #error Need to update socket-type table 1741 #endif 1742