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 {"execve", 3, DEC, NOV, STG, HEX, HEX}, /* 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 { "execvp", SYS_execve }, 974 { "sigfillset", SYS_sigpending }, 975 { "getcontext", SYS_context }, 976 { "setcontext", SYS_context }, 977 { "getustack", SYS_context }, 978 { "setustack", SYS_context }, 979 { "hrtcntl", SYS_hrtsys }, 980 { "hrtalarm", SYS_hrtsys }, 981 { "hrtsleep", SYS_hrtsys }, 982 { "hrtcancel", SYS_hrtsys }, 983 { "aioread", SYS_kaio }, 984 { "aiowrite", SYS_kaio }, 985 { "aiowait", SYS_kaio }, 986 { "aiocancel", SYS_kaio }, 987 { "aionotify", SYS_kaio }, 988 { "audit", SYS_auditsys }, 989 { "door_create", SYS_door }, 990 { "door_revoke", SYS_door }, 991 { "door_info", SYS_door }, 992 { "door_call", SYS_door }, 993 { "door_return", SYS_door }, 994 { "door_bind", SYS_door }, 995 { "door_unbind", SYS_door }, 996 { "door_unref", SYS_door }, 997 { "door_ucred", SYS_door }, 998 { "door_getparam", SYS_door }, 999 { "door_setparam", SYS_door }, 1000 { "pset_create", SYS_pset }, 1001 { "pset_destroy", SYS_pset }, 1002 { "pset_assign", SYS_pset }, 1003 { "pset_info", SYS_pset }, 1004 { "pset_bind", SYS_pset }, 1005 { "pset_getloadavg", SYS_pset }, 1006 { "pset_list", SYS_pset }, 1007 { "pset_setattr", SYS_pset }, 1008 { "pset_getattr", SYS_pset }, 1009 { "pset_assign_forced", SYS_pset }, 1010 { "settaskid", SYS_tasksys }, 1011 { "gettaskid", SYS_tasksys }, 1012 { "getprojid", SYS_tasksys }, 1013 { "setppriv", SYS_privsys }, 1014 { "getppriv", SYS_privsys }, 1015 { "getprivimplinfo", SYS_privsys }, 1016 { "setpflags", SYS_privsys }, 1017 { "getpflags", SYS_privsys }, 1018 { "getacct", SYS_exacctsys }, 1019 { "putacct", SYS_exacctsys }, 1020 { "wracct", SYS_exacctsys }, 1021 { "lwp_cond_timedwait", SYS_lwp_cond_wait }, 1022 { "lwp_sema_wait", SYS_lwp_sema_timedwait }, 1023 { "lwp_park", SYS_lwp_park }, 1024 { "lwp_unpark", SYS_lwp_park }, 1025 { "lwp_unpark_all", SYS_lwp_park }, 1026 { "lwp_rwlock_rdlock", SYS_lwp_rwlock_sys }, 1027 { "lwp_rwlock_wrlock", SYS_lwp_rwlock_sys }, 1028 { "lwp_rwlock_tryrdlock", SYS_lwp_rwlock_sys }, 1029 { "lwp_rwlock_trywrlock", SYS_lwp_rwlock_sys }, 1030 { "lwp_rwlock_unlock", SYS_lwp_rwlock_sys }, 1031 { "lwp_mutex_lock", SYS_lwp_mutex_timedlock }, 1032 { "sendfilev64", SYS_sendfilev }, 1033 { "creat", SYS_open }, 1034 { "creat64", SYS_open64 }, 1035 { "openattrdirat", SYS_openat }, 1036 { "lgrpsys", SYS_lgrpsys }, 1037 { "getrusage", SYS_rusagesys }, 1038 { "getrusage_chld", SYS_rusagesys }, 1039 { "getrusage_lwp", SYS_rusagesys }, 1040 { "getvmusage", SYS_rusagesys }, 1041 { "getpeerucred", SYS_ucredsys }, 1042 { "ucred_get", SYS_ucredsys }, 1043 { "port_create", SYS_port }, 1044 { "port_associate", SYS_port }, 1045 { "port_dissociate", SYS_port }, 1046 { "port_send", SYS_port }, 1047 { "port_sendn", SYS_port }, 1048 { "port_get", SYS_port }, 1049 { "port_getn", SYS_port }, 1050 { "port_alert", SYS_port }, 1051 { "port_dispatch", SYS_port }, 1052 { "zone_create", SYS_zone }, 1053 { "zone_destroy", SYS_zone }, 1054 { "zone_getattr", SYS_zone }, 1055 { "zone_setattr", SYS_zone }, 1056 { "zone_enter", SYS_zone }, 1057 { "getzoneid", SYS_zone }, 1058 { "zone_list", SYS_zone }, 1059 { "zone_shutdown", SYS_zone }, 1060 { "zone_add_datalink", SYS_zone }, 1061 { "zone_remove_datalink", SYS_zone }, 1062 { "zone_check_datalink", SYS_zone }, 1063 { "zone_list_datalink", SYS_zone }, 1064 { "is_system_labeled", SYS_labelsys }, 1065 { "tnrh", SYS_labelsys }, 1066 { "tnrhtp", SYS_labelsys }, 1067 { "tnmlp", SYS_labelsys }, 1068 { "getlabel", SYS_labelsys }, 1069 { "fgetlabel", SYS_labelsys }, 1070 { "getrctl", SYS_rctlsys }, 1071 { "setrctl", SYS_rctlsys }, 1072 { "rctlsys_lst", SYS_rctlsys }, 1073 { "rctlsys_ctl", SYS_rctlsys }, 1074 { "allocids", SYS_sidsys }, 1075 { "futimens", SYS_utimesys }, 1076 { "utimensat", SYS_utimesys }, 1077 { "poll", SYS_pollsys }, 1078 { "umount", SYS_umount2 }, 1079 { "wait", SYS_waitid }, 1080 { NULL, 0 } /* end-of-list */ 1081 }; 1082 1083 /* 1084 * Return structure to interpret system call with sub-codes. 1085 */ 1086 const struct systable * 1087 subsys(int syscall, int subcode) 1088 { 1089 const struct systable *stp = NULL; 1090 1091 if (subcode != -1) { 1092 switch (syscall) { 1093 case SYS_faccessat: 1094 if ((unsigned)subcode < NACCESSCODE) 1095 stp = &faccessattable[subcode]; 1096 break; 1097 case SYS_fchmodat: 1098 if ((unsigned)subcode < NCHMODCODE) 1099 stp = &fchmodattable[subcode]; 1100 break; 1101 case SYS_fchownat: 1102 if ((unsigned)subcode < NCHOWNCODE) 1103 stp = &fchownattable[subcode]; 1104 break; 1105 case SYS_mkdirat: 1106 if ((unsigned)subcode < NMKDIRCODE) 1107 stp = &mkdiratattable[subcode]; 1108 break; 1109 case SYS_mknodat: 1110 if ((unsigned)subcode < NMKMODCODE) 1111 stp = &mknodatattable[subcode]; 1112 break; 1113 case SYS_renameat: 1114 if ((unsigned)subcode < NRENAMECODE) 1115 stp = &renameattable[subcode]; 1116 break; 1117 case SYS_linkat: 1118 if ((unsigned)subcode < NLINKATCODE) 1119 stp = &linkattable[subcode]; 1120 break; 1121 case SYS_unlinkat: 1122 if ((unsigned)subcode < NUNLINKCODE) 1123 stp = &unlinkattable[subcode]; 1124 break; 1125 case SYS_symlinkat: 1126 if ((unsigned)subcode < NSYMLINKCODE) 1127 stp = &symlinkattable[subcode]; 1128 break; 1129 case SYS_readlinkat: 1130 if ((unsigned)subcode < NREADLINKCODE) 1131 stp = &readlinkattable[subcode]; 1132 break; 1133 case SYS_fstatat: 1134 if ((unsigned)subcode < NSTATCODE) 1135 stp = &fstatattable[subcode]; 1136 break; 1137 case SYS_fstatat64: 1138 if ((unsigned)subcode < NSTAT64CODE) 1139 stp = &fstatat64table[subcode]; 1140 break; 1141 case SYS_openat: 1142 if ((unsigned)subcode < NOPENATCODE) 1143 stp = &openattable[subcode]; 1144 break; 1145 case SYS_openat64: 1146 if ((unsigned)subcode < NOPENAT64CODE) 1147 stp = &openat64table[subcode]; 1148 break; 1149 case SYS_open: 1150 if ((unsigned)subcode < NOPENCODE) 1151 stp = &opentable[subcode]; 1152 break; 1153 case SYS_open64: 1154 if ((unsigned)subcode < NOPEN64CODE) 1155 stp = &open64table[subcode]; 1156 break; 1157 case SYS_msgsys: /* msgsys() */ 1158 if ((unsigned)subcode < NMSGCODE) 1159 stp = &msgtable[subcode]; 1160 break; 1161 case SYS_semsys: /* semsys() */ 1162 if ((unsigned)subcode < NSEMCODE) 1163 stp = &semtable[subcode]; 1164 break; 1165 case SYS_shmsys: /* shmsys() */ 1166 if ((unsigned)subcode < NSHMCODE) 1167 stp = &shmtable[subcode]; 1168 break; 1169 case SYS_pgrpsys: /* pgrpsys() */ 1170 if ((unsigned)subcode < NPIDCODE) 1171 stp = &pidtable[subcode]; 1172 break; 1173 case SYS_utssys: /* utssys() */ 1174 if ((unsigned)subcode < NUTSCODE) 1175 stp = &utstable[subcode]; 1176 break; 1177 case SYS_sysfs: /* sysfs() */ 1178 if ((unsigned)subcode < NSFSCODE) 1179 stp = &sfstable[subcode]; 1180 break; 1181 case SYS_sigpending: /* sigpending()/sigfillset() */ 1182 if ((unsigned)subcode < NSGPCODE) 1183 stp = &sgptable[subcode]; 1184 break; 1185 case SYS_context: /* [get|set]context() */ 1186 if ((unsigned)subcode < NCTXCODE) 1187 stp = &ctxtable[subcode]; 1188 break; 1189 case SYS_hrtsys: /* hrtsys() */ 1190 if ((unsigned)subcode < NHRTCODE) 1191 stp = &hrttable[subcode]; 1192 break; 1193 case SYS_corectl: /* corectl() */ 1194 if ((unsigned)subcode < NCORCODE) 1195 stp = &cortable[subcode]; 1196 break; 1197 case SYS_kaio: /* kaio() */ 1198 if ((unsigned)subcode < NAIOCODE) 1199 stp = &aiotable[subcode]; 1200 break; 1201 case SYS_door: /* doors */ 1202 if ((unsigned)subcode < NDOORCODE) 1203 stp = &doortable[subcode]; 1204 break; 1205 case SYS_pset: /* pset() */ 1206 if ((unsigned)subcode < NPSETCODE) 1207 stp = &psettable[subcode]; 1208 break; 1209 case SYS_lwp_create: /* lwp_create() */ 1210 if ((unsigned)subcode < NLWPCREATECODE) 1211 stp = &lwpcreatetable[subcode]; 1212 break; 1213 case SYS_tasksys: /* tasks */ 1214 if ((unsigned)subcode < NTASKSYSCODE) 1215 stp = &tasksystable[subcode]; 1216 break; 1217 case SYS_exacctsys: /* exacct */ 1218 if ((unsigned)subcode < NEXACCTSYSCODE) 1219 stp = &exacctsystable[subcode]; 1220 break; 1221 case SYS_privsys: /* privileges */ 1222 if ((unsigned)subcode < NPRIVSYSCODE) 1223 stp = &privsystable[subcode]; 1224 break; 1225 case SYS_lwp_park: /* lwp_park */ 1226 if ((unsigned)subcode < NLWPPARKCODE) 1227 stp = &lwpparktable[subcode]; 1228 break; 1229 case SYS_lwp_rwlock_sys: 1230 if ((unsigned)subcode < NLWPRWLOCKCODE) 1231 stp = &lwprwlocktable[subcode]; 1232 break; 1233 case SYS_sendfilev: /* sendfilev */ 1234 if ((unsigned)subcode < NSENDFILESYSCODE) 1235 stp = &sendfilevsystable[subcode]; 1236 break; 1237 case SYS_lgrpsys: /* lgrpsys */ 1238 if ((unsigned)subcode < NLGRPSYSCODE) 1239 stp = &lgrpsystable[subcode]; 1240 break; 1241 case SYS_rusagesys: /* rusagesys */ 1242 if ((unsigned)subcode < NRUSAGESYSCODE) 1243 stp = &rusagesystable[subcode]; 1244 break; 1245 case SYS_fcntl: /* fcntl */ 1246 if ((unsigned)subcode < NFCNTLCODE) 1247 stp = &fcntltable[subcode]; 1248 break; 1249 case SYS_ucredsys: 1250 if ((unsigned)subcode < NUCREDSYSCODE) 1251 stp = &ucredsystable[subcode]; 1252 break; 1253 case SYS_port: /* portfs */ 1254 if ((unsigned)subcode < NPORTCODE) 1255 stp = &portfstable[subcode]; 1256 break; 1257 case SYS_zone: /* zone family */ 1258 if ((unsigned)subcode < NZONECODE) 1259 stp = &zonetable[subcode]; 1260 break; 1261 case SYS_labelsys: /* label family */ 1262 if ((unsigned)subcode < NLABELCODE) 1263 stp = &labeltable[subcode]; 1264 break; 1265 case SYS_rctlsys: /* rctl family */ 1266 if ((unsigned)subcode < NRCTLCODE) 1267 stp = &rctltable[subcode]; 1268 break; 1269 case SYS_forksys: /* fork family */ 1270 if ((unsigned)subcode < NFORKCODE) 1271 stp = &forktable[subcode]; 1272 break; 1273 case SYS_sidsys: /* SID family */ 1274 if ((unsigned)subcode < NSIDSYSCODE) 1275 stp = &sidsystable[subcode]; 1276 break; 1277 case SYS_utimesys: /* utime family */ 1278 if ((unsigned)subcode < NUTIMESYSCODE) 1279 stp = &utimesystable[subcode]; 1280 break; 1281 case SYS_sockconfig: /* sockconfig family */ 1282 if ((unsigned)subcode < NSOCKCONFIGCODE) 1283 stp = &sockconfigtable[subcode]; 1284 break; 1285 } 1286 } 1287 1288 if (stp == NULL) 1289 stp = &systable[((unsigned)syscall < SYSEND)? syscall : 0]; 1290 1291 return (stp); 1292 } 1293 1294 /* 1295 * Return the name of the system call. 1296 */ 1297 const char * 1298 sysname(private_t *pri, int syscall, int subcode) 1299 { 1300 const struct systable *stp = subsys(syscall, subcode); 1301 const char *name = stp->name; /* may be NULL */ 1302 1303 if (name == NULL) { /* manufacture a name */ 1304 (void) sprintf(pri->sys_name, "sys#%d", syscall); 1305 name = pri->sys_name; 1306 } 1307 1308 return (name); 1309 } 1310 1311 /* 1312 * Return the name of the signal. 1313 * Return NULL if unknown signal. 1314 */ 1315 const char * 1316 rawsigname(private_t *pri, int sig) 1317 { 1318 /* 1319 * The C library function sig2str() omits the leading "SIG". 1320 */ 1321 (void) strcpy(pri->raw_sig_name, "SIG"); 1322 1323 if (sig > 0 && sig2str(sig, pri->raw_sig_name+3) == 0) 1324 return (pri->raw_sig_name); 1325 return (NULL); 1326 } 1327 1328 /* 1329 * Return the name of the signal. 1330 * Manufacture a name for unknown signal. 1331 */ 1332 const char * 1333 signame(private_t *pri, int sig) 1334 { 1335 const char *name = rawsigname(pri, sig); 1336 1337 if (name == NULL) { /* manufacture a name */ 1338 (void) sprintf(pri->sig_name, "SIG#%d", sig); 1339 name = pri->sig_name; 1340 } 1341 1342 return (name); 1343 } 1344 1345 /* 1346 * Determine the subcode for this syscall, if any. 1347 */ 1348 int 1349 getsubcode(private_t *pri) 1350 { 1351 const lwpstatus_t *Lsp = pri->lwpstat; 1352 int syscall = Lsp->pr_syscall; 1353 int nsysarg = Lsp->pr_nsysarg; 1354 int subcode = -1; 1355 int arg0; 1356 1357 if (syscall > 0 && nsysarg > 0 && !prismember(&rawout, syscall)) { 1358 arg0 = Lsp->pr_sysarg[0]; 1359 switch (syscall) { 1360 case SYS_utssys: /* utssys() */ 1361 if (nsysarg > 2) 1362 subcode = Lsp->pr_sysarg[2]; 1363 break; 1364 case SYS_faccessat: 1365 if (nsysarg > 3) 1366 subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD && 1367 Lsp->pr_sysarg[3] == 0)? 1 : 0; 1368 break; 1369 case SYS_fchmodat: 1370 if (nsysarg > 1 && Lsp->pr_sysarg[1] == 0) { 1371 subcode = 3; 1372 break; 1373 } 1374 if (nsysarg > 0 && (int)Lsp->pr_sysarg[0] != AT_FDCWD) { 1375 subcode = 0; 1376 break; 1377 } 1378 if (nsysarg > 3) 1379 subcode = (Lsp->pr_sysarg[3] == 0)? 1 : 1380 (Lsp->pr_sysarg[3] == AT_SYMLINK_NOFOLLOW)? 1381 2 : 0; 1382 break; 1383 case SYS_fchownat: 1384 if (nsysarg > 1 && Lsp->pr_sysarg[1] == 0) { 1385 subcode = 3; 1386 break; 1387 } 1388 if (nsysarg > 0 && (int)Lsp->pr_sysarg[0] != AT_FDCWD) { 1389 subcode = 0; 1390 break; 1391 } 1392 if (nsysarg > 4) 1393 subcode = (Lsp->pr_sysarg[4] == 0)? 1 : 1394 (Lsp->pr_sysarg[4] == AT_SYMLINK_NOFOLLOW)? 1395 2 : 0; 1396 break; 1397 case SYS_mkdirat: 1398 case SYS_mknodat: 1399 case SYS_readlinkat: 1400 if (nsysarg > 0) 1401 subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD)? 1402 1 : 0; 1403 break; 1404 case SYS_renameat: 1405 if (nsysarg > 2) 1406 subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD && 1407 (int)Lsp->pr_sysarg[2] == AT_FDCWD)? 1 : 0; 1408 break; 1409 case SYS_linkat: 1410 if (nsysarg > 4) 1411 subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD && 1412 (int)Lsp->pr_sysarg[2] == AT_FDCWD && 1413 Lsp->pr_sysarg[4] == 0)? 1 : 0; 1414 break; 1415 case SYS_unlinkat: 1416 if (nsysarg > 2) 1417 subcode = 1418 ((int)Lsp->pr_sysarg[0] != AT_FDCWD)? 0 : 1419 (Lsp->pr_sysarg[2] == AT_REMOVEDIR)? 2 : 1420 (Lsp->pr_sysarg[2] == 0)? 1 : 0; 1421 break; 1422 case SYS_symlinkat: 1423 if (nsysarg > 1) 1424 subcode = ((int)Lsp->pr_sysarg[1] == AT_FDCWD)? 1425 1 : 0; 1426 break; 1427 case SYS_fstatat: 1428 case SYS_fstatat64: 1429 if (nsysarg > 1 && Lsp->pr_sysarg[1] == 0) { 1430 subcode = 3; 1431 break; 1432 } 1433 if (nsysarg > 0 && (int)Lsp->pr_sysarg[0] != AT_FDCWD) { 1434 subcode = 0; 1435 break; 1436 } 1437 if (nsysarg > 3) 1438 subcode = (Lsp->pr_sysarg[3] == 0)? 1 : 1439 (Lsp->pr_sysarg[3] == AT_SYMLINK_NOFOLLOW)? 1440 2 : 0; 1441 break; 1442 case SYS_openat: /* openat() w/ and w/o AT_FDCWD */ 1443 case SYS_openat64: /* and with and w/o O_CREAT */ 1444 if (nsysarg > 2) 1445 subcode = ((int)Lsp->pr_sysarg[0] == AT_FDCWD)? 1446 ((Lsp->pr_sysarg[2] & O_CREAT)? 3 : 2) : 1447 ((Lsp->pr_sysarg[2] & O_CREAT)? 1 : 0); 1448 break; 1449 case SYS_open: /* open() w/ and w/o O_CREAT */ 1450 case SYS_open64: 1451 if (nsysarg > 1) 1452 subcode = (Lsp->pr_sysarg[1] & O_CREAT)? 1 : 0; 1453 break; 1454 case SYS_kaio: /* kaio() */ 1455 subcode = arg0 & ~AIO_POLL_BIT; 1456 break; 1457 case SYS_door: /* doors */ 1458 if (nsysarg > 5) 1459 subcode = Lsp->pr_sysarg[5]; 1460 break; 1461 case SYS_lwp_create: /* lwp_create() */ 1462 subcode = /* 0 for parent, 1 for child */ 1463 (Lsp->pr_why == PR_SYSEXIT && Lsp->pr_errno == 0 && 1464 Lsp->pr_rval1 == 0); 1465 break; 1466 case SYS_forksys: /* forksys */ 1467 subcode = arg0; 1468 if (Lsp->pr_why == PR_SYSEXIT && Lsp->pr_errno == 0 && 1469 pri->Rval2 != 0) /* this is the child */ 1470 subcode += 3; 1471 break; 1472 case SYS_msgsys: /* msgsys() */ 1473 case SYS_semsys: /* semsys() */ 1474 case SYS_shmsys: /* shmsys() */ 1475 case SYS_pgrpsys: /* pgrpsys() */ 1476 case SYS_sysfs: /* sysfs() */ 1477 case SYS_sigpending: /* sigpending()/sigfillset() */ 1478 case SYS_context: /* [get|set]context() */ 1479 case SYS_hrtsys: /* hrtsys() */ 1480 case SYS_corectl: /* corectl() */ 1481 case SYS_pset: /* pset() */ 1482 case SYS_tasksys: /* tasks */ 1483 case SYS_privsys: /* privileges */ 1484 case SYS_exacctsys: /* exacct */ 1485 case SYS_lwp_park: /* lwp_park */ 1486 case SYS_lwp_rwlock_sys: /* lwp_rwlock_*() */ 1487 case SYS_sendfilev: /* sendfilev */ 1488 case SYS_lgrpsys: /* lgrpsys */ 1489 case SYS_rusagesys: /* rusagesys */ 1490 case SYS_ucredsys: /* ucredsys */ 1491 case SYS_zone: /* zone */ 1492 case SYS_labelsys: /* labelsys */ 1493 case SYS_rctlsys: /* rctlsys */ 1494 case SYS_sidsys: /* sidsys */ 1495 case SYS_utimesys: /* utimesys */ 1496 case SYS_sockconfig: /* sockconfig */ 1497 subcode = arg0; 1498 break; 1499 case SYS_fcntl: /* fcntl() */ 1500 if (nsysarg > 2) { 1501 switch (Lsp->pr_sysarg[1]) { 1502 default: subcode = 0; break; 1503 case F_GETFL: 1504 case F_GETOWN: 1505 case F_GETXFL: subcode = 1; break; 1506 case F_SETFL: subcode = 2; break; 1507 } 1508 } 1509 break; 1510 case SYS_port: /* portfs */ 1511 subcode = arg0 & PORT_CODE_MASK; 1512 break; 1513 } 1514 } 1515 1516 return (subcode); 1517 } 1518 1519 /* 1520 * Return the maximum number of system calls, counting 1521 * all system calls with subcodes as separate calls. 1522 */ 1523 int 1524 maxsyscalls() 1525 { 1526 return (PRMAXSYS + 1 1527 + NACCESSCODE - 1 1528 + NCHMODCODE - 1 1529 + NCHOWNCODE - 1 1530 + NMKDIRCODE - 1 1531 + NMKMODCODE - 1 1532 + NRENAMECODE - 1 1533 + NLINKATCODE - 1 1534 + NUNLINKCODE - 1 1535 + NSYMLINKCODE - 1 1536 + NREADLINKCODE - 1 1537 + NSTATCODE - 1 1538 + NSTAT64CODE - 1 1539 + NOPENATCODE - 1 1540 + NOPENAT64CODE - 1 1541 + NOPENCODE - 1 1542 + NOPEN64CODE - 1 1543 + NMSGCODE - 1 1544 + NSEMCODE - 1 1545 + NSHMCODE - 1 1546 + NPIDCODE - 1 1547 + NSFSCODE - 1 1548 + NUTSCODE - 1 1549 + NSGPCODE - 1 1550 + NCTXCODE - 1 1551 + NHRTCODE - 1 1552 + NCORCODE - 1 1553 + NAIOCODE - 1 1554 + NDOORCODE - 1 1555 + NPSETCODE - 1 1556 + NLWPCREATECODE - 1 1557 + NTASKSYSCODE - 1 1558 + NEXACCTSYSCODE - 1 1559 + NLWPPARKCODE - 1 1560 + NLWPRWLOCKCODE - 1 1561 + NSENDFILESYSCODE - 1 1562 + NLGRPSYSCODE - 1 1563 + NRUSAGESYSCODE - 1 1564 + NFCNTLCODE - 1 1565 + NPRIVSYSCODE - 1 1566 + NUCREDSYSCODE - 1 1567 + NPORTCODE - 1 1568 + NZONECODE - 1 1569 + NLABELCODE - 1 1570 + NRCTLCODE - 1 1571 + NFORKCODE - 1 1572 + NSIDSYSCODE - 1 1573 + NUTIMESYSCODE - 1 1574 + NSOCKCONFIGCODE - 1); 1575 } 1576 1577 /* 1578 * Return the number of subcodes for the specified system call number. 1579 */ 1580 int 1581 nsubcodes(int syscall) 1582 { 1583 switch (syscall) { 1584 case SYS_faccessat: 1585 return (NACCESSCODE); 1586 case SYS_fchmodat: 1587 return (NCHMODCODE); 1588 case SYS_fchownat: 1589 return (NCHOWNCODE); 1590 case SYS_mkdirat: 1591 return (NMKDIRCODE); 1592 case SYS_mknodat: 1593 return (NMKMODCODE); 1594 case SYS_renameat: 1595 return (NRENAMECODE); 1596 case SYS_linkat: 1597 return (NLINKATCODE); 1598 case SYS_unlinkat: 1599 return (NUNLINKCODE); 1600 case SYS_symlinkat: 1601 return (NSYMLINKCODE); 1602 case SYS_readlinkat: 1603 return (NREADLINKCODE); 1604 case SYS_fstatat: 1605 return (NSTATCODE); 1606 case SYS_fstatat64: 1607 return (NSTAT64CODE); 1608 case SYS_openat: 1609 return (NOPENATCODE); 1610 case SYS_openat64: 1611 return (NOPENAT64CODE); 1612 case SYS_open: 1613 return (NOPENCODE); 1614 case SYS_open64: 1615 return (NOPEN64CODE); 1616 case SYS_msgsys: 1617 return (NMSGCODE); 1618 case SYS_semsys: 1619 return (NSEMCODE); 1620 case SYS_shmsys: 1621 return (NSHMCODE); 1622 case SYS_pgrpsys: 1623 return (NPIDCODE); 1624 case SYS_utssys: 1625 return (NUTSCODE); 1626 case SYS_sysfs: 1627 return (NSFSCODE); 1628 case SYS_sigpending: 1629 return (NSGPCODE); 1630 case SYS_context: 1631 return (NCTXCODE); 1632 case SYS_hrtsys: 1633 return (NHRTCODE); 1634 case SYS_corectl: 1635 return (NCORCODE); 1636 case SYS_kaio: 1637 return (NAIOCODE); 1638 case SYS_door: 1639 return (NDOORCODE); 1640 case SYS_pset: 1641 return (NPSETCODE); 1642 case SYS_lwp_create: 1643 return (NLWPCREATECODE); 1644 case SYS_tasksys: 1645 return (NTASKSYSCODE); 1646 case SYS_exacctsys: 1647 return (NEXACCTSYSCODE); 1648 case SYS_privsys: 1649 return (NPRIVSYSCODE); 1650 case SYS_lwp_park: 1651 return (NLWPPARKCODE); 1652 case SYS_lwp_rwlock_sys: 1653 return (NLWPRWLOCKCODE); 1654 case SYS_sendfilev: 1655 return (NSENDFILESYSCODE); 1656 case SYS_lgrpsys: 1657 return (NLGRPSYSCODE); 1658 case SYS_rusagesys: 1659 return (NRUSAGESYSCODE); 1660 case SYS_fcntl: 1661 return (NFCNTLCODE); 1662 case SYS_ucredsys: 1663 return (NUCREDSYSCODE); 1664 case SYS_port: 1665 return (NPORTCODE); 1666 case SYS_zone: 1667 return (NZONECODE); 1668 case SYS_labelsys: 1669 return (NLABELCODE); 1670 case SYS_rctlsys: 1671 return (NRCTLCODE); 1672 case SYS_forksys: 1673 return (NFORKCODE); 1674 case SYS_sidsys: 1675 return (NSIDSYSCODE); 1676 case SYS_utimesys: 1677 return (NUTIMESYSCODE); 1678 case SYS_sockconfig: 1679 return (NSOCKCONFIGCODE); 1680 default: 1681 return (1); 1682 } 1683 } 1684 1685 1686 1687 /* Socket address families (and protocol families) */ 1688 const char * const afcodes[] = { 1689 "UNSPEC", /* 0 */ 1690 "UNIX", /* 1 */ 1691 "INET", /* 2 */ 1692 "IMPLINK", /* 3 */ 1693 "PUP", /* 4 */ 1694 "CHAOS", /* 5 */ 1695 "NS", /* 6 */ 1696 "NBS", /* 7 */ 1697 "ECMA", /* 8 */ 1698 "DATAKIT", /* 9 */ 1699 "CCITT", /* 10 */ 1700 "SNA", /* 11 */ 1701 "DECnet", /* 12 */ 1702 "DLI", /* 13 */ 1703 "LAT", /* 14 */ 1704 "HYLINK", /* 15 */ 1705 "APPLETALK", /* 16 */ 1706 "NIT", /* 17 */ 1707 "802", /* 18 */ 1708 "OSI", /* 19 */ 1709 "X25", /* 20 */ 1710 "OSINET", /* 21 */ 1711 "GOSIP", /* 22 */ 1712 "IPX", /* 23 */ 1713 "ROUTE", /* 24 */ 1714 "LINK", /* 25 */ 1715 "INET6", /* 26 */ 1716 "KEY", /* 27 */ 1717 "NCA", /* 28 */ 1718 "POLICY", /* 29 */ 1719 "RDS", /* 30 */ 1720 "TRILL", /* 31 */ 1721 "PACKET" /* 32 */ 1722 }; 1723 #if MAX_AFCODES != 33 1724 #error Need to update address-family table 1725 #endif 1726 1727 1728 const char * const socktype_codes[] = { /* cf socket.h */ 1729 NULL, 1730 "SOCK_DGRAM", /* 1 */ 1731 "SOCK_STREAM", /* 2 */ 1732 NULL, 1733 "SOCK_RAW", /* 4 */ 1734 "SOCK_RDM", /* 5 */ 1735 "SOCK_SEQPACKET" /* 6 */ 1736 }; 1737 #if MAX_SOCKTYPES != 7 1738 #error Need to update socket-type table 1739 #endif 1740