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