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