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) 1988, 2010, Oracle and/or its affiliates. All rights reserved. 24 * Copyright 2012 Milan Jurik. All rights reserved. 25 * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. 26 * Copyright (c) 2018, Joyent, Inc. 27 * Copyright 2020 Oxide Computer Company 28 */ 29 30 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 31 /* All Rights Reserved */ 32 33 #include <sys/param.h> 34 #include <sys/types.h> 35 #include <sys/systm.h> 36 #include <sys/systrace.h> 37 #include <sys/procfs.h> 38 #include <sys/mman.h> 39 #include <sys/int_types.h> 40 #include <c2/audit.h> 41 #include <sys/stat.h> 42 #include <sys/times.h> 43 #include <sys/statfs.h> 44 #include <sys/stropts.h> 45 #include <sys/statvfs.h> 46 #include <sys/utsname.h> 47 #include <sys/timex.h> 48 #include <sys/socket.h> 49 #include <sys/sendfile.h> 50 51 struct hrtsysa; 52 struct mmaplf32a; 53 54 /* 55 * This table is the switch used to transfer to the appropriate 56 * routine for processing a system call. Each row contains the 57 * number of arguments expected, a switch that tells systrap() 58 * in trap.c whether a setjmp() is not necessary, and a pointer 59 * to the routine. 60 */ 61 62 int access(char *, int); 63 int alarm(int); 64 int auditsys(struct auditcalls *, rval_t *); 65 int64_t brandsys(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, 66 uintptr_t); 67 intptr_t brk(caddr_t); 68 int chdir(char *); 69 int chmod(char *, int); 70 int chown(char *, uid_t, gid_t); 71 int chroot(char *); 72 int cladm(int, int, void *); 73 int close(int); 74 int exece(const char *, const char **, const char **); 75 int faccessat(int, char *, int, int); 76 int fchmodat(int, char *, int, int); 77 int fchownat(int, char *, uid_t, gid_t, int); 78 int fcntl(int, int, intptr_t); 79 int64_t vfork(); 80 int64_t forksys(int, int); 81 int fstat(int, struct stat *); 82 int fdsync(int, int); 83 int64_t getgid(); 84 int ucredsys(int, int, void *); 85 int64_t getpid(); 86 int64_t getuid(); 87 time_t gtime(); 88 int getloadavg(int *, int); 89 int rusagesys(int, void *, void *, void *, void *); 90 int getpagesizes(int, size_t *, int); 91 int gtty(int, intptr_t); 92 #if defined(__i386) || defined(__amd64) 93 int hrtsys(struct hrtsysa *, rval_t *); 94 #endif /* __i386 || __amd64 */ 95 int ioctl(int, int, intptr_t); 96 int kill(); 97 int labelsys(int, void *, void *, void *, void *, void *); 98 int link(char *, char *); 99 int linkat(int, char *, int, char *, int); 100 off32_t lseek32(int32_t, off32_t, int32_t); 101 off_t lseek64(int, off_t, int); 102 int lgrpsys(int, long, void *); 103 int mmapobjsys(int, uint_t, mmapobj_result_t *, uint_t *, void *); 104 int mknod(char *, mode_t, dev_t); 105 int mknodat(int, char *, mode_t, dev_t); 106 int mount(long *, rval_t *); 107 int nice(int); 108 int nullsys(); 109 int open(char *, int, int); 110 int openat(int, char *, int, int); 111 int pause(); 112 long pcsample(void *, long); 113 int privsys(int, priv_op_t, priv_ptype_t, void *, size_t, int); 114 int profil(unsigned short *, size_t, ulong_t, uint_t); 115 ssize_t pread(int, void *, size_t, off_t); 116 int psecflags(procset_t *, psecflagwhich_t, secflagdelta_t *); 117 ssize_t pwrite(int, void *, size_t, off_t); 118 ssize_t read(int, void *, size_t); 119 int rename(char *, char *); 120 int renameat(int, char *, int, char *); 121 void rexit(int); 122 int semsys(); 123 int setgid(gid_t); 124 int setpgrp(int, int, int); 125 int setuid(uid_t); 126 uintptr_t shmsys(); 127 uint64_t sidsys(int, int, int, int); 128 int sigprocmask(int, sigset_t *, sigset_t *); 129 int sigsuspend(sigset_t); 130 int sigaltstack(struct sigaltstack *, struct sigaltstack *); 131 int sigaction(int, struct sigaction *, struct sigaction *); 132 int sigpending(int, sigset_t *); 133 int sigresend(int, siginfo_t *, sigset_t *); 134 int sigtimedwait(sigset_t *, siginfo_t *, timespec_t *); 135 int getsetcontext(int, void *); 136 int stat(char *, struct stat *); 137 int fstatat(int, char *, struct stat *, int); 138 int stime(time_t); 139 int stty(int, intptr_t); 140 int syssync(); 141 int sysacct(char *); 142 clock_t times(struct tms *); 143 long ulimit(int, long); 144 int getrlimit32(int, struct rlimit32 *); 145 int setrlimit32(int, struct rlimit32 *); 146 int umask(int); 147 int umount2(char *, int); 148 int unlink(char *); 149 int unlinkat(int, char *, int); 150 int utimesys(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t); 151 int64_t utssys32(void *, int, int, void *); 152 int64_t utssys64(void *, long, int, void *); 153 int uucopy(const void *, void *, size_t); 154 ssize_t uucopystr(const char *, char *, size_t); 155 ssize_t write(int, void *, size_t); 156 ssize_t readv(int, struct iovec *, int); 157 ssize_t writev(int, struct iovec *, int); 158 ssize_t preadv(int, struct iovec *, int, off_t, off_t); 159 ssize_t pwritev(int, struct iovec *, int, off_t, off_t); 160 int syslwp_park(int, uintptr_t, uintptr_t); 161 int rmdir(char *); 162 int mkdir(char *, int); 163 int mkdirat(int, char *, int); 164 int getdents32(int, void *, size_t); 165 int statfs32(char *, struct statfs32 *, int32_t, int32_t); 166 int fstatfs32(int32_t, struct statfs32 *, int32_t, int32_t); 167 int sysfs(int, long, long); 168 int getmsg(int, struct strbuf *, struct strbuf *, int *); 169 int pollsys(pollfd_t *, nfds_t, timespec_t *, sigset_t *); 170 int putmsg(int, struct strbuf *, struct strbuf *, int); 171 int uadmin(); 172 int lstat(char *, struct stat *); 173 int symlink(char *, char *); 174 int symlinkat(char *, int, char *); 175 ssize_t readlink(char *, char *, size_t); 176 ssize_t readlinkat(int, char *, char *, size_t); 177 int resolvepath(char *, char *, size_t); 178 int setgroups(int, gid_t *); 179 int getgroups(int, gid_t *); 180 int fchdir(int); 181 int fchown(int, uid_t, uid_t); 182 int fchmod(int, int); 183 int getcwd(char *, size_t); 184 int statvfs(char *, struct statvfs *); 185 int fstatvfs(int, struct statvfs *); 186 offset_t llseek32(int32_t, uint32_t, uint32_t, int); 187 188 #if (defined(__i386) && !defined(__amd64)) || defined(__i386_COMPAT) 189 int sysi86(short, uintptr_t, uintptr_t, uintptr_t); 190 #endif 191 192 int acl(const char *, int, int, void *); 193 int facl(int, int, int, void *); 194 long priocntlsys(int, procset_t *, int, caddr_t, caddr_t); 195 int waitsys(idtype_t, id_t, siginfo_t *, int); 196 int sigsendsys(procset_t *, int); 197 int mincore(caddr_t, size_t, char *); 198 caddr_t smmap64(caddr_t, size_t, int, int, int, off_t); 199 caddr_t smmap32(caddr32_t, size32_t, int, int, int, off32_t); 200 int smmaplf32(struct mmaplf32a *, rval_t *); 201 int mprotect(caddr_t, size_t, int); 202 int munmap(caddr_t, size_t); 203 int uname(struct utsname *); 204 int lchown(char *, uid_t, gid_t); 205 int getpmsg(int, struct strbuf *, struct strbuf *, int *, int *); 206 int putpmsg(int, struct strbuf *, struct strbuf *, int, int); 207 int memcntl(caddr_t, size_t, int, caddr_t, int, int); 208 long sysconfig(int); 209 int adjtime(struct timeval *, struct timeval *); 210 long systeminfo(int, char *, long); 211 int setegid(gid_t); 212 int seteuid(uid_t); 213 214 int setreuid(uid_t, uid_t); 215 int setregid(gid_t, gid_t); 216 int install_utrap(utrap_entry_t type, utrap_handler_t, utrap_handler_t *); 217 #ifdef __sparc 218 int sparc_utrap_install(utrap_entry_t type, utrap_handler_t, 219 utrap_handler_t, utrap_handler_t *, utrap_handler_t *); 220 #endif 221 222 int syslwp_create(ucontext_t *, int, id_t *); 223 void syslwp_exit(); 224 int syslwp_suspend(id_t); 225 int syslwp_continue(id_t); 226 int syslwp_private(int, int, uintptr_t); 227 int lwp_detach(id_t); 228 int lwp_info(timestruc_t *); 229 int lwp_kill(id_t, int); 230 int lwp_self(); 231 int64_t lwp_sigmask(int, uint_t, uint_t, uint_t, uint_t); 232 int yield(); 233 int lwp_wait(id_t, id_t *); 234 int lwp_mutex_timedlock(lwp_mutex_t *, timespec_t *, uintptr_t); 235 int lwp_mutex_wakeup(lwp_mutex_t *, int); 236 int lwp_mutex_unlock(lwp_mutex_t *); 237 int lwp_mutex_trylock(lwp_mutex_t *, uintptr_t); 238 int lwp_mutex_register(lwp_mutex_t *, caddr_t); 239 int lwp_rwlock_sys(int, lwp_rwlock_t *, timespec_t *); 240 int lwp_sema_post(lwp_sema_t *); 241 int lwp_sema_timedwait(lwp_sema_t *, timespec_t *, int); 242 int lwp_sema_trywait(lwp_sema_t *); 243 int lwp_cond_wait(lwp_cond_t *, lwp_mutex_t *, timespec_t *, int); 244 int lwp_cond_signal(lwp_cond_t *); 245 int lwp_cond_broadcast(lwp_cond_t *); 246 caddr_t schedctl(); 247 248 long pathconf(char *, int); 249 long fpathconf(int, int); 250 int processor_bind(idtype_t, id_t, processorid_t, processorid_t *); 251 int processor_info(processorid_t, processor_info_t *); 252 int p_online(processorid_t, int); 253 254 /* 255 * POSIX .4 system calls * 256 */ 257 int clock_gettime(clockid_t, timespec_t *); 258 int clock_settime(clockid_t, timespec_t *); 259 int clock_getres(clockid_t, timespec_t *); 260 int timer_create(clockid_t, struct sigevent *, timer_t *); 261 int timer_delete(timer_t); 262 int timer_settime(timer_t, int, itimerspec_t *, itimerspec_t *); 263 int timer_gettime(timer_t, itimerspec_t *); 264 int timer_getoverrun(timer_t); 265 int nanosleep(timespec_t *, timespec_t *); 266 int sigqueue(pid_t, int, void *, int, int); 267 int signotify(int, siginfo_t *, signotify_id_t *); 268 269 int getdents64(int, void *, size_t); 270 int stat64(char *, struct stat64 *); 271 int lstat64(char *, struct stat64 *); 272 int fstatat64(int, char *, struct stat64 *, int); 273 int fstat64(int, struct stat64 *); 274 int statvfs64(char *, struct statvfs64 *); 275 int fstatvfs64(int, struct statvfs64 *); 276 int setrlimit64(int, struct rlimit64 *); 277 int getrlimit64(int, struct rlimit64 *); 278 int pread64(int, void *, size32_t, uint32_t, uint32_t); 279 int pwrite64(int, void *, size32_t, uint32_t, uint32_t); 280 int open64(char *, int, int); 281 int openat64(int, char *, int, int); 282 283 /* 284 * NTP syscalls 285 */ 286 287 int ntp_gettime(struct ntptimeval *); 288 int ntp_adjtime(struct timex *); 289 290 /* 291 * ++++++++++++++++++++++++ 292 * ++ SunOS4.1 Buyback ++ 293 * ++++++++++++++++++++++++ 294 * 295 * fchroot, vhangup, gettimeofday 296 */ 297 298 int fchroot(int); 299 int vhangup(); 300 int gettimeofday(struct timeval *); 301 int getitimer(uint_t, struct itimerval *); 302 int setitimer(uint_t, struct itimerval *, struct itimerval *); 303 304 int corectl(int, uintptr_t, uintptr_t, uintptr_t); 305 int modctl(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); 306 int64_t loadable_syscall(); 307 int64_t indir(); 308 309 long tasksys(int, projid_t, uint_t, void *, size_t); 310 long rctlsys(int, char *, void *, void *, size_t, int); 311 312 long zone(); 313 314 int so_socket(int, int, int, char *, int); 315 int so_socketpair(int[2]); 316 int bind(int, struct sockaddr *, socklen_t, int); 317 int listen(int, int, int); 318 int accept(int, struct sockaddr *, socklen_t *, int, int); 319 int connect(int, struct sockaddr *, socklen_t, int); 320 int shutdown(int, int, int); 321 ssize_t recv(int, void *, size_t, int); 322 ssize_t recvfrom(int, void *, size_t, int, struct sockaddr *, socklen_t *); 323 ssize_t recvmsg(int, struct nmsghdr *, int); 324 ssize_t send(int, void *, size_t, int); 325 ssize_t sendmsg(int, struct nmsghdr *, int); 326 ssize_t sendto(int, void *, size_t, int, struct sockaddr *, socklen_t); 327 int getpeername(int, struct sockaddr *, socklen_t *, int); 328 int getsockname(int, struct sockaddr *, socklen_t *, int); 329 int getsockopt(int, int, int, void *, socklen_t *, int); 330 int setsockopt(int, int, int, void *, socklen_t *, int); 331 int sockconfig(int, void *, void *, void *, void *); 332 ssize_t sendfilev(int, int, const struct sendfilevec *, int, size_t *); 333 ssize_t getrandom(void *, size_t, unsigned int); 334 void upanic(void *, size_t); 335 336 typedef int64_t (*llfcn_t)(); /* for casting one-word returns */ 337 338 /* 339 * Sysent initialization macros. 340 * These take the name string of the system call even though that isn't 341 * currently used in the sysent entry. This might be useful someday. 342 * 343 * Initialization macro for system calls which take their args in the C style. 344 * These system calls return the longlong_t return value and must call 345 * set_errno() to return an error. For SPARC, narg must be at most six. 346 * For more args, use the SYSENT_AP() routine. 347 * 348 * We are able to return two distinct values to userland via the rval_t. 349 * At this time, that corresponds to one 64-bit quantity, or two 32-bit 350 * quantities. The kernel does not currently need to return two 64-bit 351 * values, or one 128 bit value(!), but we may do one day, so the calling 352 * sequence between userland and the kernel should permit it. 353 * 354 * The interpretation of rval_t is provided by the sy_flags field 355 * which is used to determine how to arrange the results in registers 356 * (or on the stack) for return userland. 357 */ 358 /* returns a 64-bit quantity for both ABIs */ 359 #define SYSENT_C(name, call, narg) \ 360 { (narg), SE_64RVAL, NULL, NULL, (llfcn_t)(uintptr_t)(call) } 361 362 /* returns one 32-bit value for both ABIs: r_val1 */ 363 #define SYSENT_CI(name, call, narg) \ 364 { (narg), SE_32RVAL1, NULL, NULL, (llfcn_t)(uintptr_t)(call) } 365 366 /* returns 2 32-bit values: r_val1 & r_val2 */ 367 #define SYSENT_2CI(name, call, narg) \ 368 { (narg), SE_32RVAL1|SE_32RVAL2, NULL, NULL, (llfcn_t)(call) } 369 370 /* 371 * Initialization macro for system calls which take their args in the standard 372 * Unix style of a pointer to the arg structure and a pointer to the rval_t. 373 * 374 * Deprecated wherever possible (slower on some architectures, and trickier 375 * to maintain two flavours). 376 */ 377 #define SYSENT_AP(name, call, narg) \ 378 { (narg), SE_64RVAL, (call), NULL, syscall_ap } 379 380 /* 381 * Conditional constructors to build the tables without #ifdef clutter 382 */ 383 #if defined(_LP64) 384 #define IF_LP64(true, false) true 385 #else 386 #define IF_LP64(true, false) false 387 #endif 388 389 #if defined(__sparc) 390 #define IF_sparc(true, false) true 391 #else 392 #define IF_sparc(true, false) false 393 #endif 394 395 #if defined(__i386) && !defined(__amd64) 396 #define IF_i386(true, false) true 397 #else 398 #define IF_i386(true, false) false 399 #endif 400 401 #if defined(__i386) || defined(__amd64) 402 #define IF_x86(true, false) true 403 #else 404 #define IF_x86(true, false) false 405 #endif 406 407 #if (defined(__i386) && !defined(__amd64)) || defined(__i386_COMPAT) 408 #define IF_386_ABI(true, false) true 409 #else 410 #define IF_386_ABI(true, false) false 411 #endif 412 413 /* 414 * Define system calls that return a native 'long' quantity i.e. a 32-bit 415 * or 64-bit integer - depending on how the kernel is itself compiled 416 * e.g. read(2) returns 'ssize_t' in the kernel and in userland. 417 */ 418 #define SYSENT_CL(name, call, narg) \ 419 IF_LP64(SYSENT_C(name, call, narg), SYSENT_CI(name, call, narg)) 420 421 /* 422 * Initialization macro for loadable native system calls. 423 */ 424 #define SYSENT_LOADABLE() \ 425 { 0, SE_LOADABLE, nosys32, NULL, loadable_syscall } 426 427 /* 428 * Initialization macro for loadable 32-bit compatibility system calls. 429 */ 430 #define SYSENT_LOADABLE32() SYSENT_LOADABLE() 431 432 #define SYSENT_NOSYS() SYSENT_C("nosys", nosys, 0) 433 434 struct sysent nosys_ent = SYSENT_NOSYS(); 435 436 /* 437 * Native sysent table. 438 */ 439 struct sysent sysent[NSYSCALL] = 440 { 441 /* 0 */ IF_LP64( 442 SYSENT_NOSYS(), 443 SYSENT_C("indir", indir, 1)), 444 /* 1 */ SYSENT_CI("exit", rexit, 1), 445 /* 2 */ SYSENT_CI("psecflags", psecflags, 3), 446 /* 3 */ SYSENT_CL("read", read, 3), 447 /* 4 */ SYSENT_CL("write", write, 3), 448 /* 5 */ SYSENT_CI("open", open, 3), 449 /* 6 */ SYSENT_CI("close", close, 1), 450 /* 7 */ SYSENT_CI("linkat", linkat, 5), 451 /* 8 */ SYSENT_LOADABLE(), /* (was creat) */ 452 /* 9 */ SYSENT_CI("link", link, 2), 453 /* 10 */ SYSENT_CI("unlink", unlink, 1), 454 /* 11 */ SYSENT_CI("symlinkat", symlinkat, 3), 455 /* 12 */ SYSENT_CI("chdir", chdir, 1), 456 /* 13 */ SYSENT_CL("time", gtime, 0), 457 /* 14 */ SYSENT_CI("mknod", mknod, 3), 458 /* 15 */ SYSENT_CI("chmod", chmod, 2), 459 /* 16 */ SYSENT_CI("chown", chown, 3), 460 /* 17 */ SYSENT_CI("brk", brk, 1), 461 /* 18 */ SYSENT_CI("stat", stat, 2), 462 /* 19 */ IF_LP64( 463 SYSENT_CL("lseek", lseek64, 3), 464 SYSENT_CL("lseek", lseek32, 3)), 465 /* 20 */ SYSENT_2CI("getpid", getpid, 0), 466 /* 21 */ SYSENT_AP("mount", mount, 8), 467 /* 22 */ SYSENT_CL("readlinkat", readlinkat, 4), 468 /* 23 */ SYSENT_CI("setuid", setuid, 1), 469 /* 24 */ SYSENT_2CI("getuid", getuid, 0), 470 /* 25 */ SYSENT_CI("stime", stime, 1), 471 /* 26 */ SYSENT_CL("pcsample", pcsample, 2), 472 /* 27 */ SYSENT_CI("alarm", alarm, 1), 473 /* 28 */ SYSENT_CI("fstat", fstat, 2), 474 /* 29 */ SYSENT_CI("pause", pause, 0), 475 /* 30 */ SYSENT_LOADABLE(), /* (was utime) */ 476 /* 31 */ SYSENT_CI("stty", stty, 2), 477 /* 32 */ SYSENT_CI("gtty", gtty, 2), 478 /* 33 */ SYSENT_CI("access", access, 2), 479 /* 34 */ SYSENT_CI("nice", nice, 1), 480 /* 35 */ IF_LP64( 481 SYSENT_NOSYS(), 482 SYSENT_CI("statfs", statfs32, 4)), 483 /* 36 */ SYSENT_CI("sync", syssync, 0), 484 /* 37 */ SYSENT_CI("kill", kill, 2), 485 /* 38 */ IF_LP64( 486 SYSENT_NOSYS(), 487 SYSENT_CI("fstatfs", fstatfs32, 4)), 488 /* 39 */ SYSENT_CI("setpgrp", setpgrp, 3), 489 /* 40 */ SYSENT_CI("uucopystr", uucopystr, 3), 490 /* 41 */ SYSENT_LOADABLE(), /* (was dup) */ 491 /* 42 */ SYSENT_LOADABLE(), /* pipe */ 492 /* 43 */ SYSENT_CL("times", times, 1), 493 /* 44 */ SYSENT_CI("prof", profil, 4), 494 /* 45 */ SYSENT_CI("faccessat", faccessat, 4), 495 /* 46 */ SYSENT_CI("setgid", setgid, 1), 496 /* 47 */ SYSENT_2CI("getgid", getgid, 0), 497 /* 48 */ SYSENT_CI("mknodat", mknodat, 4), 498 /* 49 */ SYSENT_LOADABLE(), /* msgsys */ 499 /* 50 */ IF_x86( 500 SYSENT_CI("sysi86", sysi86, 4), 501 SYSENT_LOADABLE()), /* (was sys3b) */ 502 /* 51 */ SYSENT_LOADABLE(), /* sysacct */ 503 /* 52 */ SYSENT_LOADABLE(), /* shmsys */ 504 /* 53 */ SYSENT_LOADABLE(), /* semsys */ 505 /* 54 */ SYSENT_CI("ioctl", ioctl, 3), 506 /* 55 */ SYSENT_CI("uadmin", uadmin, 3), 507 /* 56 */ SYSENT_CI("fchownat", fchownat, 5), 508 /* 57 */ IF_LP64( 509 SYSENT_2CI("utssys", utssys64, 4), 510 SYSENT_2CI("utssys", utssys32, 4)), 511 /* 58 */ SYSENT_CI("fdsync", fdsync, 2), 512 /* 59 */ SYSENT_CI("exece", exece, 3), 513 /* 60 */ SYSENT_CI("umask", umask, 1), 514 /* 61 */ SYSENT_CI("chroot", chroot, 1), 515 /* 62 */ SYSENT_CI("fcntl", fcntl, 3), 516 /* 63 */ SYSENT_CI("ulimit", ulimit, 2), 517 /* 64 */ SYSENT_CI("renameat", renameat, 4), 518 /* 65 */ SYSENT_CI("unlinkat", unlinkat, 3), 519 /* 66 */ SYSENT_CI("fstatat", fstatat, 4), 520 /* 67 */ IF_LP64( 521 SYSENT_NOSYS(), 522 SYSENT_CI("fstatat64", fstatat64, 4)), 523 /* 68 */ SYSENT_CI("openat", openat, 4), 524 /* 69 */ IF_LP64( 525 SYSENT_NOSYS(), 526 SYSENT_CI("openat64", openat64, 4)), 527 /* 70 */ SYSENT_CI("tasksys", tasksys, 5), 528 /* 71 */ SYSENT_LOADABLE(), /* acctctl */ 529 /* 72 */ SYSENT_LOADABLE(), /* exacct */ 530 /* 73 */ SYSENT_CI("getpagesizes", getpagesizes, 3), 531 /* 74 */ SYSENT_CI("rctlsys", rctlsys, 6), 532 /* 75 */ SYSENT_2CI("sidsys", sidsys, 4), 533 /* 76 */ SYSENT_LOADABLE(), /* (was fsat) */ 534 /* 77 */ SYSENT_CI("lwp_park", syslwp_park, 3), 535 /* 78 */ SYSENT_CL("sendfilev", sendfilev, 5), 536 /* 79 */ SYSENT_CI("rmdir", rmdir, 1), 537 /* 80 */ SYSENT_CI("mkdir", mkdir, 2), 538 /* 81 */ IF_LP64( 539 SYSENT_CI("getdents", getdents64, 3), 540 SYSENT_CI("getdents", getdents32, 3)), 541 /* 82 */ SYSENT_CI("privsys", privsys, 6), 542 /* 83 */ SYSENT_CI("ucredsys", ucredsys, 3), 543 /* 84 */ SYSENT_CI("sysfs", sysfs, 3), 544 /* 85 */ SYSENT_CI("getmsg", getmsg, 4), 545 /* 86 */ SYSENT_CI("putmsg", putmsg, 4), 546 /* 87 */ SYSENT_LOADABLE(), /* (was poll) */ 547 /* 88 */ SYSENT_CI("lstat", lstat, 2), 548 /* 89 */ SYSENT_CI("symlink", symlink, 2), 549 /* 90 */ SYSENT_CL("readlink", readlink, 3), 550 /* 91 */ SYSENT_CI("setgroups", setgroups, 2), 551 /* 92 */ SYSENT_CI("getgroups", getgroups, 2), 552 /* 93 */ SYSENT_CI("fchmod", fchmod, 2), 553 /* 94 */ SYSENT_CI("fchown", fchown, 3), 554 /* 95 */ SYSENT_CI("sigprocmask", sigprocmask, 3), 555 /* 96 */ SYSENT_CI("sigsuspend", sigsuspend, 1), 556 /* 97 */ SYSENT_CI("sigaltstack", sigaltstack, 2), 557 /* 98 */ SYSENT_CI("sigaction", sigaction, 3), 558 /* 99 */ SYSENT_CI("sigpending", sigpending, 2), 559 /* 100 */ SYSENT_CI("getsetcontext", getsetcontext, 2), 560 /* 101 */ SYSENT_CI("fchmodat", fchmodat, 4), 561 /* 102 */ SYSENT_CI("mkdirat", mkdirat, 3), 562 /* 103 */ SYSENT_CI("statvfs", statvfs, 2), 563 /* 104 */ SYSENT_CI("fstatvfs", fstatvfs, 2), 564 /* 105 */ SYSENT_CI("getloadavg", getloadavg, 2), 565 /* 106 */ SYSENT_LOADABLE(), /* nfssys */ 566 /* 107 */ SYSENT_CI("waitsys", waitsys, 4), 567 /* 108 */ SYSENT_CI("sigsendset", sigsendsys, 2), 568 /* 109 */ IF_x86( 569 SYSENT_AP("hrtsys", hrtsys, 5), 570 SYSENT_LOADABLE()), 571 /* 110 */ SYSENT_CI("utimesys", utimesys, 5), 572 /* 111 */ SYSENT_CI("sigresend", sigresend, 3), 573 /* 112 */ SYSENT_CL("priocntlsys", priocntlsys, 5), 574 /* 113 */ SYSENT_CL("pathconf", pathconf, 2), 575 /* 114 */ SYSENT_CI("mincore", mincore, 3), 576 /* 115 */ IF_LP64( 577 SYSENT_CL("mmap", smmap64, 6), 578 SYSENT_CL("mmap", smmap32, 6)), 579 /* 116 */ SYSENT_CI("mprotect", mprotect, 3), 580 /* 117 */ SYSENT_CI("munmap", munmap, 2), 581 /* 118 */ SYSENT_CL("fpathconf", fpathconf, 2), 582 /* 119 */ SYSENT_2CI("vfork", vfork, 0), 583 /* 120 */ SYSENT_CI("fchdir", fchdir, 1), 584 /* 121 */ SYSENT_CL("readv", readv, 3), 585 /* 122 */ SYSENT_CL("writev", writev, 3), 586 /* 123 */ SYSENT_CL("preadv", preadv, 5), 587 /* 124 */ SYSENT_CL("pwritev", pwritev, 5), 588 /* 125 */ SYSENT_CI("upanic", upanic, 2), 589 /* 126 */ SYSENT_CL("getrandom", getrandom, 3), 590 /* 127 */ SYSENT_CI("mmapobj", mmapobjsys, 5), 591 /* 128 */ IF_LP64( 592 SYSENT_CI("setrlimit", setrlimit64, 2), 593 SYSENT_CI("setrlimit", setrlimit32, 2)), 594 /* 129 */ IF_LP64( 595 SYSENT_CI("getrlimit", getrlimit64, 2), 596 SYSENT_CI("getrlimit", getrlimit32, 2)), 597 /* 130 */ SYSENT_CI("lchown", lchown, 3), 598 /* 131 */ SYSENT_CI("memcntl", memcntl, 6), 599 /* 132 */ SYSENT_CI("getpmsg", getpmsg, 5), 600 /* 133 */ SYSENT_CI("putpmsg", putpmsg, 5), 601 /* 134 */ SYSENT_CI("rename", rename, 2), 602 /* 135 */ SYSENT_CI("uname", uname, 1), 603 /* 136 */ SYSENT_CI("setegid", setegid, 1), 604 /* 137 */ SYSENT_CL("sysconfig", sysconfig, 1), 605 /* 138 */ SYSENT_CI("adjtime", adjtime, 2), 606 /* 139 */ SYSENT_CL("systeminfo", systeminfo, 3), 607 /* 140 */ SYSENT_LOADABLE(), /* sharefs */ 608 /* 141 */ SYSENT_CI("seteuid", seteuid, 1), 609 /* 142 */ SYSENT_2CI("forksys", forksys, 2), 610 /* 143 */ SYSENT_LOADABLE(), /* (was fork1) */ 611 /* 144 */ SYSENT_CI("sigtimedwait", sigtimedwait, 3), 612 /* 145 */ SYSENT_CI("lwp_info", lwp_info, 1), 613 /* 146 */ SYSENT_CI("yield", yield, 0), 614 /* 147 */ SYSENT_LOADABLE(), /* (was lwp_sema_wait) */ 615 /* 148 */ SYSENT_CI("lwp_sema_post", lwp_sema_post, 1), 616 /* 149 */ SYSENT_CI("lwp_sema_trywait", lwp_sema_trywait, 1), 617 /* 150 */ SYSENT_CI("lwp_detach", lwp_detach, 1), 618 /* 151 */ SYSENT_CI("corectl", corectl, 4), 619 /* 152 */ SYSENT_CI("modctl", modctl, 6), 620 /* 153 */ SYSENT_CI("fchroot", fchroot, 1), 621 /* 154 */ SYSENT_LOADABLE(), /* (was utimes) */ 622 /* 155 */ SYSENT_CI("vhangup", vhangup, 0), 623 /* 156 */ SYSENT_CI("gettimeofday", gettimeofday, 1), 624 /* 157 */ SYSENT_CI("getitimer", getitimer, 2), 625 /* 158 */ SYSENT_CI("setitimer", setitimer, 3), 626 /* 159 */ SYSENT_CI("lwp_create", syslwp_create, 3), 627 /* 160 */ SYSENT_CI("lwp_exit", syslwp_exit, 0), 628 /* 161 */ SYSENT_CI("lwp_suspend", syslwp_suspend, 1), 629 /* 162 */ SYSENT_CI("lwp_continue", syslwp_continue, 1), 630 /* 163 */ SYSENT_CI("lwp_kill", lwp_kill, 2), 631 /* 164 */ SYSENT_CI("lwp_self", lwp_self, 0), 632 /* 165 */ SYSENT_2CI("lwp_sigmask", lwp_sigmask, 5), 633 /* 166 */ IF_x86( 634 SYSENT_CI("lwp_private", syslwp_private, 3), 635 SYSENT_NOSYS()), 636 /* 167 */ SYSENT_CI("lwp_wait", lwp_wait, 2), 637 /* 168 */ SYSENT_CI("lwp_mutex_wakeup", lwp_mutex_wakeup, 2), 638 /* 169 */ SYSENT_LOADABLE(), /* (was lwp_mutex_lock) */ 639 /* 170 */ SYSENT_CI("lwp_cond_wait", lwp_cond_wait, 4), 640 /* 171 */ SYSENT_CI("lwp_cond_signal", lwp_cond_signal, 1), 641 /* 172 */ SYSENT_CI("lwp_cond_broadcast", lwp_cond_broadcast, 1), 642 /* 173 */ SYSENT_CL("pread", pread, 4), 643 /* 174 */ SYSENT_CL("pwrite ", pwrite, 4), 644 /* 645 * The 64-bit C library maps llseek() to lseek(), so this 646 * is needed as a native syscall only on the 32-bit kernel. 647 */ 648 /* 175 */ IF_LP64( 649 SYSENT_NOSYS(), 650 SYSENT_C("llseek", llseek32, 4)), 651 /* 176 */ SYSENT_LOADABLE(), /* inst_sync */ 652 /* 177 */ SYSENT_CI("brandsys", brandsys, 6), 653 /* 178 */ SYSENT_LOADABLE(), /* kaio */ 654 /* 179 */ SYSENT_LOADABLE(), /* cpc */ 655 /* 180 */ SYSENT_CI("lgrpsys", lgrpsys, 3), 656 /* 181 */ SYSENT_CI("rusagesys", rusagesys, 5), 657 /* 182 */ SYSENT_LOADABLE(), /* portfs */ 658 /* 183 */ SYSENT_CI("pollsys", pollsys, 4), 659 /* 184 */ SYSENT_CI("labelsys", labelsys, 5), 660 /* 185 */ SYSENT_CI("acl", acl, 4), 661 /* 186 */ SYSENT_AP("auditsys", auditsys, 6), 662 /* 187 */ SYSENT_CI("processor_bind", processor_bind, 4), 663 /* 188 */ SYSENT_CI("processor_info", processor_info, 2), 664 /* 189 */ SYSENT_CI("p_online", p_online, 2), 665 /* 190 */ SYSENT_CI("sigqueue", sigqueue, 5), 666 /* 191 */ SYSENT_CI("clock_gettime", clock_gettime, 2), 667 /* 192 */ SYSENT_CI("clock_settime", clock_settime, 2), 668 /* 193 */ SYSENT_CI("clock_getres", clock_getres, 2), 669 /* 194 */ SYSENT_CI("timer_create", timer_create, 3), 670 /* 195 */ SYSENT_CI("timer_delete", timer_delete, 1), 671 /* 196 */ SYSENT_CI("timer_settime", timer_settime, 4), 672 /* 197 */ SYSENT_CI("timer_gettime", timer_gettime, 2), 673 /* 198 */ SYSENT_CI("timer_getoverrun", timer_getoverrun, 1), 674 /* 199 */ SYSENT_CI("nanosleep", nanosleep, 2), 675 /* 200 */ SYSENT_CI("facl", facl, 4), 676 /* 201 */ SYSENT_LOADABLE(), /* door */ 677 /* 202 */ SYSENT_CI("setreuid", setreuid, 2), 678 /* 203 */ SYSENT_CI("setregid", setregid, 2), 679 /* 204 */ SYSENT_CI("install_utrap", install_utrap, 3), 680 /* 205 */ SYSENT_CI("signotify", signotify, 3), 681 /* 206 */ SYSENT_CL("schedctl", schedctl, 0), 682 /* 207 */ SYSENT_LOADABLE(), /* pset */ 683 /* 208 */ IF_sparc( 684 SYSENT_CI("sparc_utrap_install", sparc_utrap_install, 5), 685 SYSENT_NOSYS()), 686 /* 209 */ SYSENT_CI("resolvepath", resolvepath, 3), 687 /* 210 */ SYSENT_CI("lwp_mutex_timedlock", lwp_mutex_timedlock, 3), 688 /* 211 */ SYSENT_CI("lwp_sema_timedwait", lwp_sema_timedwait, 3), 689 /* 212 */ SYSENT_CI("lwp_rwlock_sys", lwp_rwlock_sys, 3), 690 /* 691 * Syscalls 213-225: 32-bit system call support for large files. 692 * 693 * (The 64-bit C library transparently maps these system calls 694 * back to their native versions, so almost all of them are only 695 * needed as native syscalls on the 32-bit kernel). 696 */ 697 /* 213 */ IF_LP64( 698 SYSENT_NOSYS(), 699 SYSENT_CI("getdents64", getdents64, 3)), 700 /* 214 */ IF_LP64( 701 SYSENT_NOSYS(), 702 SYSENT_AP("smmaplf32", smmaplf32, 7)), 703 /* 215 */ IF_LP64( 704 SYSENT_NOSYS(), 705 SYSENT_CI("stat64", stat64, 2)), 706 /* 216 */ IF_LP64( 707 SYSENT_NOSYS(), 708 SYSENT_CI("lstat64", lstat64, 2)), 709 /* 217 */ IF_LP64( 710 SYSENT_NOSYS(), 711 SYSENT_CI("fstat64", fstat64, 2)), 712 /* 218 */ IF_LP64( 713 SYSENT_NOSYS(), 714 SYSENT_CI("statvfs64", statvfs64, 2)), 715 /* 219 */ IF_LP64( 716 SYSENT_NOSYS(), 717 SYSENT_CI("fstatvfs64", fstatvfs64, 2)), 718 /* 220 */ IF_LP64( 719 SYSENT_NOSYS(), 720 SYSENT_CI("setrlimit64", setrlimit64, 2)), 721 /* 221 */ IF_LP64( 722 SYSENT_NOSYS(), 723 SYSENT_CI("getrlimit64", getrlimit64, 2)), 724 /* 222 */ IF_LP64( 725 SYSENT_NOSYS(), 726 SYSENT_CI("pread64", pread64, 5)), 727 /* 223 */ IF_LP64( 728 SYSENT_NOSYS(), 729 SYSENT_CI("pwrite64", pwrite64, 5)), 730 /* 224 */ SYSENT_LOADABLE(), /* (was creat64) */ 731 /* 225 */ IF_LP64( 732 SYSENT_NOSYS(), 733 SYSENT_CI("open64", open64, 3)), 734 /* 226 */ SYSENT_LOADABLE(), /* rpcsys */ 735 /* 227 */ SYSENT_CL("zone", zone, 5), 736 /* 228 */ SYSENT_LOADABLE(), /* autofssys */ 737 /* 229 */ SYSENT_CI("getcwd", getcwd, 2), 738 /* 230 */ SYSENT_CI("so_socket", so_socket, 5), 739 /* 231 */ SYSENT_CI("so_socketpair", so_socketpair, 1), 740 /* 232 */ SYSENT_CI("bind", bind, 4), 741 /* 233 */ SYSENT_CI("listen", listen, 3), 742 /* 234 */ SYSENT_CI("accept", accept, 5), 743 /* 235 */ SYSENT_CI("connect", connect, 4), 744 /* 236 */ SYSENT_CI("shutdown", shutdown, 3), 745 /* 237 */ SYSENT_CL("recv", recv, 4), 746 /* 238 */ SYSENT_CL("recvfrom", recvfrom, 6), 747 /* 239 */ SYSENT_CL("recvmsg", recvmsg, 3), 748 /* 240 */ SYSENT_CL("send", send, 4), 749 /* 241 */ SYSENT_CL("sendmsg", sendmsg, 3), 750 /* 242 */ SYSENT_CL("sendto", sendto, 6), 751 /* 243 */ SYSENT_CI("getpeername", getpeername, 4), 752 /* 244 */ SYSENT_CI("getsockname", getsockname, 4), 753 /* 245 */ SYSENT_CI("getsockopt", getsockopt, 6), 754 /* 246 */ SYSENT_CI("setsockopt", setsockopt, 6), 755 /* 247 */ SYSENT_CI("sockconfig", sockconfig, 5), 756 /* 248 */ SYSENT_CI("ntp_gettime", ntp_gettime, 1), 757 /* 249 */ SYSENT_CI("ntp_adjtime", ntp_adjtime, 1), 758 /* 250 */ SYSENT_CI("lwp_mutex_unlock", lwp_mutex_unlock, 1), 759 /* 251 */ SYSENT_CI("lwp_mutex_trylock", lwp_mutex_trylock, 2), 760 /* 252 */ SYSENT_CI("lwp_mutex_register", lwp_mutex_register, 2), 761 /* 253 */ SYSENT_CI("cladm", cladm, 3), 762 /* 254 */ SYSENT_CI("uucopy", uucopy, 3), 763 /* 255 */ SYSENT_CI("umount2", umount2, 2) 764 }; 765 766 767 #ifdef _SYSCALL32_IMPL 768 769 extern int ulimit32(int, int); 770 extern ssize_t read32(int32_t, caddr32_t, size32_t); 771 extern ssize_t write32(int32_t, caddr32_t, size32_t); 772 extern ssize_t pread32(int32_t, caddr32_t, size32_t, off32_t); 773 extern ssize_t pwrite32(int32_t, caddr32_t, size32_t, off32_t); 774 extern ssize_t readv32(int32_t, caddr32_t, int32_t); 775 extern ssize_t writev32(int32_t, caddr32_t, int32_t); 776 extern ssize_t readlink32(caddr32_t, caddr32_t, size32_t); 777 extern ssize_t readlinkat32(int, caddr32_t, caddr32_t, size32_t); 778 extern int open32(char *, int, int); 779 extern int openat32(int, char *, int, int); 780 extern int stat32(char *, struct stat32 *); 781 extern int fstatat32(int, char *, struct stat32 *, int); 782 extern int lstat32(char *, struct stat32 *); 783 extern int fstat32(int, struct stat32 *); 784 extern int fstatat64_32(int, char *, struct stat64_32 *, int); 785 extern int stat64_32(char *, struct stat64_32 *); 786 extern int lstat64_32(char *, struct stat64_32 *); 787 extern int fstat64_32(int, struct stat64_32 *); 788 extern int getmsg32(int, struct strbuf32 *, struct strbuf32 *, int32_t *); 789 extern int putmsg32(int, struct strbuf32 *, struct strbuf32 *, int32_t *); 790 extern int getpmsg32(int, struct strbuf32 *, struct strbuf32 *, int32_t *, 791 int32_t *); 792 extern int putpmsg32(int, struct strbuf32 *, struct strbuf32 *, int32_t, 793 int32_t); 794 extern int getsetcontext32(int, void *); 795 extern int statvfs32(char *, struct statvfs32 *); 796 extern int fstatvfs32(int, struct statvfs32 *); 797 extern int statvfs64_32(char *, struct statvfs64_32 *); 798 extern int fstatvfs64_32(int, struct statvfs64_32 *); 799 extern int sigaction32(int, struct sigaction32 *, struct sigaction32 *); 800 extern clock32_t times32(struct tms32 *); 801 extern int stime32(time32_t); 802 extern int getpagesizes32(int, size32_t *, int); 803 extern int sigaltstack32(struct sigaltstack32 *, struct sigaltstack32 *); 804 extern int sigqueue32(pid_t, int, caddr32_t, int, int); 805 extern offset_t llseek32(int32_t, uint32_t, uint32_t, int); 806 extern int waitsys32(idtype_t, id_t, siginfo_t *, int); 807 808 extern ssize_t recv32(int32_t, caddr32_t, size32_t, int32_t); 809 extern ssize_t recvfrom32(int32_t, caddr32_t, size32_t, int32_t, caddr32_t, 810 caddr32_t); 811 extern ssize_t send32(int32_t, caddr32_t, size32_t, int32_t); 812 extern ssize_t sendto32(int32_t, caddr32_t, size32_t, int32_t, caddr32_t, 813 socklen_t); 814 815 extern int privsys32(int, priv_op_t, priv_ptype_t, caddr32_t, size32_t, int); 816 extern int ucredsys32(int, int, caddr32_t); 817 818 /* 819 * sysent table for ILP32 processes running on 820 * a LP64 kernel. 821 */ 822 struct sysent sysent32[NSYSCALL] = 823 { 824 /* 0 */ SYSENT_C("indir", indir, 1), 825 /* 1 */ SYSENT_CI("exit", rexit, 1), 826 /* 2 */ SYSENT_CI("psecflags", psecflags, 3), 827 /* 3 */ SYSENT_CI("read", read32, 3), 828 /* 4 */ SYSENT_CI("write", write32, 3), 829 /* 5 */ SYSENT_CI("open", open32, 3), 830 /* 6 */ SYSENT_CI("close", close, 1), 831 /* 7 */ SYSENT_CI("linkat", linkat, 5), 832 /* 8 */ SYSENT_LOADABLE32(), /* (was creat32) */ 833 /* 9 */ SYSENT_CI("link", link, 2), 834 /* 10 */ SYSENT_CI("unlink", unlink, 1), 835 /* 11 */ SYSENT_CI("symlinkat", symlinkat, 3), 836 /* 12 */ SYSENT_CI("chdir", chdir, 1), 837 /* 13 */ SYSENT_CI("time", gtime, 0), 838 /* 14 */ SYSENT_CI("mknod", mknod, 3), 839 /* 15 */ SYSENT_CI("chmod", chmod, 2), 840 /* 16 */ SYSENT_CI("chown", chown, 3), 841 /* 17 */ SYSENT_CI("brk", brk, 1), 842 /* 18 */ SYSENT_CI("stat", stat32, 2), 843 /* 19 */ SYSENT_CI("lseek", lseek32, 3), 844 /* 20 */ SYSENT_2CI("getpid", getpid, 0), 845 /* 21 */ SYSENT_AP("mount", mount, 8), 846 /* 22 */ SYSENT_CI("readlinkat", readlinkat32, 4), 847 /* 23 */ SYSENT_CI("setuid", setuid, 1), 848 /* 24 */ SYSENT_2CI("getuid", getuid, 0), 849 /* 25 */ SYSENT_CI("stime", stime32, 1), 850 /* 26 */ SYSENT_CI("pcsample", pcsample, 2), 851 /* 27 */ SYSENT_CI("alarm", alarm, 1), 852 /* 28 */ SYSENT_CI("fstat", fstat32, 2), 853 /* 29 */ SYSENT_CI("pause", pause, 0), 854 /* 30 */ SYSENT_LOADABLE32(), /* (was utime) */ 855 /* 31 */ SYSENT_CI("stty", stty, 2), 856 /* 32 */ SYSENT_CI("gtty", gtty, 2), 857 /* 33 */ SYSENT_CI("access", access, 2), 858 /* 34 */ SYSENT_CI("nice", nice, 1), 859 /* 35 */ SYSENT_CI("statfs", statfs32, 4), 860 /* 36 */ SYSENT_CI("sync", syssync, 0), 861 /* 37 */ SYSENT_CI("kill", kill, 2), 862 /* 38 */ SYSENT_CI("fstatfs", fstatfs32, 4), 863 /* 39 */ SYSENT_CI("setpgrp", setpgrp, 3), 864 /* 40 */ SYSENT_CI("uucopystr", uucopystr, 3), 865 /* 41 */ SYSENT_LOADABLE32(), /* (was dup) */ 866 /* 42 */ SYSENT_LOADABLE32(), /* pipe */ 867 /* 43 */ SYSENT_CI("times", times32, 1), 868 /* 44 */ SYSENT_CI("prof", profil, 4), 869 /* 45 */ SYSENT_CI("faccessat", faccessat, 4), 870 /* 46 */ SYSENT_CI("setgid", setgid, 1), 871 /* 47 */ SYSENT_2CI("getgid", getgid, 0), 872 /* 48 */ SYSENT_CI("mknodat", mknodat, 4), 873 /* 49 */ SYSENT_LOADABLE32(), /* msgsys */ 874 /* 50 */ IF_386_ABI( 875 SYSENT_CI("sysi86", sysi86, 4), 876 SYSENT_LOADABLE32()), /* (was sys3b) */ 877 /* 51 */ SYSENT_LOADABLE32(), /* sysacct */ 878 /* 52 */ SYSENT_LOADABLE32(), /* shmsys */ 879 /* 53 */ SYSENT_LOADABLE32(), /* semsys */ 880 /* 54 */ SYSENT_CI("ioctl", ioctl, 3), 881 /* 55 */ SYSENT_CI("uadmin", uadmin, 3), 882 /* 56 */ SYSENT_CI("fchownat", fchownat, 5), 883 /* 57 */ SYSENT_2CI("utssys", utssys32, 4), 884 /* 58 */ SYSENT_CI("fdsync", fdsync, 2), 885 /* 59 */ SYSENT_CI("exece", exece, 3), 886 /* 60 */ SYSENT_CI("umask", umask, 1), 887 /* 61 */ SYSENT_CI("chroot", chroot, 1), 888 /* 62 */ SYSENT_CI("fcntl", fcntl, 3), 889 /* 63 */ SYSENT_CI("ulimit", ulimit32, 2), 890 /* 64 */ SYSENT_CI("renameat", renameat, 4), 891 /* 65 */ SYSENT_CI("unlinkat", unlinkat, 3), 892 /* 66 */ SYSENT_CI("fstatat", fstatat32, 4), 893 /* 67 */ SYSENT_CI("fstatat64", fstatat64_32, 4), 894 /* 68 */ SYSENT_CI("openat", openat32, 4), 895 /* 69 */ SYSENT_CI("openat64", openat64, 4), 896 /* 70 */ SYSENT_CI("tasksys", tasksys, 5), 897 /* 71 */ SYSENT_LOADABLE32(), /* acctctl */ 898 /* 72 */ SYSENT_LOADABLE32(), /* exacct */ 899 /* 73 */ SYSENT_CI("getpagesizes", getpagesizes32, 3), 900 /* 74 */ SYSENT_CI("rctlsys", rctlsys, 6), 901 /* 75 */ SYSENT_2CI("sidsys", sidsys, 4), 902 /* 76 */ SYSENT_LOADABLE32(), /* (was fsat) */ 903 /* 77 */ SYSENT_CI("lwp_park", syslwp_park, 3), 904 /* 78 */ SYSENT_CI("sendfilev", sendfilev, 5), 905 /* 79 */ SYSENT_CI("rmdir", rmdir, 1), 906 /* 80 */ SYSENT_CI("mkdir", mkdir, 2), 907 /* 81 */ SYSENT_CI("getdents", getdents32, 3), 908 /* 82 */ SYSENT_CI("privsys", privsys32, 6), 909 /* 83 */ SYSENT_CI("ucredsys", ucredsys32, 3), 910 /* 84 */ SYSENT_CI("sysfs", sysfs, 3), 911 /* 85 */ SYSENT_CI("getmsg", getmsg32, 4), 912 /* 86 */ SYSENT_CI("putmsg", putmsg32, 4), 913 /* 87 */ SYSENT_LOADABLE32(), /* (was poll) */ 914 /* 88 */ SYSENT_CI("lstat", lstat32, 2), 915 /* 89 */ SYSENT_CI("symlink", symlink, 2), 916 /* 90 */ SYSENT_CI("readlink", readlink32, 3), 917 /* 91 */ SYSENT_CI("setgroups", setgroups, 2), 918 /* 92 */ SYSENT_CI("getgroups", getgroups, 2), 919 /* 93 */ SYSENT_CI("fchmod", fchmod, 2), 920 /* 94 */ SYSENT_CI("fchown", fchown, 3), 921 /* 95 */ SYSENT_CI("sigprocmask", sigprocmask, 3), 922 /* 96 */ SYSENT_CI("sigsuspend", sigsuspend, 1), 923 /* 97 */ SYSENT_CI("sigaltstack", sigaltstack32, 2), 924 /* 98 */ SYSENT_CI("sigaction", sigaction32, 3), 925 /* 99 */ SYSENT_CI("sigpending", sigpending, 2), 926 /* 100 */ SYSENT_CI("getsetcontext", getsetcontext32, 2), 927 /* 101 */ SYSENT_CI("fchmodat", fchmodat, 4), 928 /* 102 */ SYSENT_CI("mkdirat", mkdirat, 3), 929 /* 103 */ SYSENT_CI("statvfs", statvfs32, 2), 930 /* 104 */ SYSENT_CI("fstatvfs", fstatvfs32, 2), 931 /* 105 */ SYSENT_CI("getloadavg", getloadavg, 2), 932 /* 106 */ SYSENT_LOADABLE32(), /* nfssys */ 933 /* 107 */ SYSENT_CI("waitsys", waitsys32, 4), 934 /* 108 */ SYSENT_CI("sigsendset", sigsendsys, 2), 935 /* 109 */ IF_x86( 936 SYSENT_AP("hrtsys", hrtsys, 5), 937 SYSENT_LOADABLE32()), 938 /* 110 */ SYSENT_CI("utimesys", utimesys, 5), 939 /* 111 */ SYSENT_CI("sigresend", sigresend, 3), 940 /* 112 */ SYSENT_CI("priocntlsys", priocntlsys, 5), 941 /* 113 */ SYSENT_CI("pathconf", pathconf, 2), 942 /* 114 */ SYSENT_CI("mincore", mincore, 3), 943 /* 115 */ SYSENT_CI("mmap", smmap32, 6), 944 /* 116 */ SYSENT_CI("mprotect", mprotect, 3), 945 /* 117 */ SYSENT_CI("munmap", munmap, 2), 946 /* 118 */ SYSENT_CI("fpathconf", fpathconf, 2), 947 /* 119 */ SYSENT_2CI("vfork", vfork, 0), 948 /* 120 */ SYSENT_CI("fchdir", fchdir, 1), 949 /* 121 */ SYSENT_CI("readv", readv32, 3), 950 /* 122 */ SYSENT_CI("writev", writev32, 3), 951 /* 123 */ SYSENT_CI("preadv", preadv, 5), 952 /* 124 */ SYSENT_CI("pwritev", pwritev, 5), 953 /* 125 */ SYSENT_CI("upanic", upanic, 2), 954 /* 126 */ SYSENT_CI("getrandom", getrandom, 3), 955 /* 127 */ SYSENT_CI("mmapobj", mmapobjsys, 5), 956 /* 128 */ SYSENT_CI("setrlimit", setrlimit32, 2), 957 /* 129 */ SYSENT_CI("getrlimit", getrlimit32, 2), 958 /* 130 */ SYSENT_CI("lchown", lchown, 3), 959 /* 131 */ SYSENT_CI("memcntl", memcntl, 6), 960 /* 132 */ SYSENT_CI("getpmsg", getpmsg32, 5), 961 /* 133 */ SYSENT_CI("putpmsg", putpmsg32, 5), 962 /* 134 */ SYSENT_CI("rename", rename, 2), 963 /* 135 */ SYSENT_CI("uname", uname, 1), 964 /* 136 */ SYSENT_CI("setegid", setegid, 1), 965 /* 137 */ SYSENT_CI("sysconfig", sysconfig, 1), 966 /* 138 */ SYSENT_CI("adjtime", adjtime, 2), 967 /* 139 */ SYSENT_CI("systeminfo", systeminfo, 3), 968 /* 140 */ SYSENT_LOADABLE32(), /* sharefs */ 969 /* 141 */ SYSENT_CI("seteuid", seteuid, 1), 970 /* 142 */ SYSENT_2CI("forksys", forksys, 2), 971 /* 143 */ SYSENT_LOADABLE32(), /* (was fork1) */ 972 /* 144 */ SYSENT_CI("sigtimedwait", sigtimedwait, 3), 973 /* 145 */ SYSENT_CI("lwp_info", lwp_info, 1), 974 /* 146 */ SYSENT_CI("yield", yield, 0), 975 /* 147 */ SYSENT_LOADABLE32(), /* (was lwp_sema_wait) */ 976 /* 148 */ SYSENT_CI("lwp_sema_post", lwp_sema_post, 1), 977 /* 149 */ SYSENT_CI("lwp_sema_trywait", lwp_sema_trywait, 1), 978 /* 150 */ SYSENT_CI("lwp_detach", lwp_detach, 1), 979 /* 151 */ SYSENT_CI("corectl", corectl, 4), 980 /* 152 */ SYSENT_CI("modctl", modctl, 6), 981 /* 153 */ SYSENT_CI("fchroot", fchroot, 1), 982 /* 154 */ SYSENT_LOADABLE32(), /* (was utimes) */ 983 /* 155 */ SYSENT_CI("vhangup", vhangup, 0), 984 /* 156 */ SYSENT_CI("gettimeofday", gettimeofday, 1), 985 /* 157 */ SYSENT_CI("getitimer", getitimer, 2), 986 /* 158 */ SYSENT_CI("setitimer", setitimer, 3), 987 /* 159 */ SYSENT_CI("lwp_create", syslwp_create, 3), 988 /* 160 */ SYSENT_CI("lwp_exit", syslwp_exit, 0), 989 /* 161 */ SYSENT_CI("lwp_suspend", syslwp_suspend, 1), 990 /* 162 */ SYSENT_CI("lwp_continue", syslwp_continue, 1), 991 /* 163 */ SYSENT_CI("lwp_kill", lwp_kill, 2), 992 /* 164 */ SYSENT_CI("lwp_self", lwp_self, 0), 993 /* 165 */ SYSENT_2CI("lwp_sigmask", lwp_sigmask, 5), 994 /* 166 */ IF_x86( 995 SYSENT_CI("lwp_private", syslwp_private, 3), 996 SYSENT_NOSYS()), 997 /* 167 */ SYSENT_CI("lwp_wait", lwp_wait, 2), 998 /* 168 */ SYSENT_CI("lwp_mutex_wakeup", lwp_mutex_wakeup, 2), 999 /* 169 */ SYSENT_LOADABLE32(), /* (was lwp_mutex_lock) */ 1000 /* 170 */ SYSENT_CI("lwp_cond_wait", lwp_cond_wait, 4), 1001 /* 171 */ SYSENT_CI("lwp_cond_signal", lwp_cond_signal, 1), 1002 /* 172 */ SYSENT_CI("lwp_cond_broadcast", lwp_cond_broadcast, 1), 1003 /* 173 */ SYSENT_CI("pread", pread32, 4), 1004 /* 174 */ SYSENT_CI("pwrite", pwrite32, 4), 1005 /* 175 */ SYSENT_C("llseek", llseek32, 4), 1006 /* 176 */ SYSENT_LOADABLE32(), /* inst_sync */ 1007 /* 177 */ SYSENT_CI("brandsys", brandsys, 6), 1008 /* 178 */ SYSENT_LOADABLE32(), /* kaio */ 1009 /* 179 */ SYSENT_LOADABLE32(), /* cpc */ 1010 /* 180 */ SYSENT_CI("lgrpsys", lgrpsys, 3), 1011 /* 181 */ SYSENT_CI("rusagesys", rusagesys, 5), 1012 /* 182 */ SYSENT_LOADABLE32(), /* portfs */ 1013 /* 183 */ SYSENT_CI("pollsys", pollsys, 4), 1014 /* 184 */ SYSENT_CI("labelsys", labelsys, 5), 1015 /* 185 */ SYSENT_CI("acl", acl, 4), 1016 /* 186 */ SYSENT_AP("auditsys", auditsys, 6), 1017 /* 187 */ SYSENT_CI("processor_bind", processor_bind, 4), 1018 /* 188 */ SYSENT_CI("processor_info", processor_info, 2), 1019 /* 189 */ SYSENT_CI("p_online", p_online, 2), 1020 /* 190 */ SYSENT_CI("sigqueue", sigqueue32, 5), 1021 /* 191 */ SYSENT_CI("clock_gettime", clock_gettime, 2), 1022 /* 192 */ SYSENT_CI("clock_settime", clock_settime, 2), 1023 /* 193 */ SYSENT_CI("clock_getres", clock_getres, 2), 1024 /* 194 */ SYSENT_CI("timer_create", timer_create, 3), 1025 /* 195 */ SYSENT_CI("timer_delete", timer_delete, 1), 1026 /* 196 */ SYSENT_CI("timer_settime", timer_settime, 4), 1027 /* 197 */ SYSENT_CI("timer_gettime", timer_gettime, 2), 1028 /* 198 */ SYSENT_CI("timer_getoverrun", timer_getoverrun, 1), 1029 /* 199 */ SYSENT_CI("nanosleep", nanosleep, 2), 1030 /* 200 */ SYSENT_CI("facl", facl, 4), 1031 /* 201 */ SYSENT_LOADABLE32(), /* door */ 1032 /* 202 */ SYSENT_CI("setreuid", setreuid, 2), 1033 /* 203 */ SYSENT_CI("setregid", setregid, 2), 1034 /* 204 */ SYSENT_CI("install_utrap", install_utrap, 3), 1035 /* 205 */ SYSENT_CI("signotify", signotify, 3), 1036 /* 206 */ SYSENT_CI("schedctl", schedctl, 0), 1037 /* 207 */ SYSENT_LOADABLE32(), /* pset */ 1038 /* 208 */ SYSENT_LOADABLE32(), 1039 /* 209 */ SYSENT_CI("resolvepath", resolvepath, 3), 1040 /* 210 */ SYSENT_CI("lwp_mutex_timedlock", lwp_mutex_timedlock, 3), 1041 /* 211 */ SYSENT_CI("lwp_sema_timedwait", lwp_sema_timedwait, 3), 1042 /* 212 */ SYSENT_CI("lwp_rwlock_sys", lwp_rwlock_sys, 3), 1043 /* 1044 * Syscalls 213-225: 32-bit system call support for large files. 1045 */ 1046 /* 213 */ SYSENT_CI("getdents64", getdents64, 3), 1047 /* 214 */ SYSENT_AP("smmaplf32", smmaplf32, 7), 1048 /* 215 */ SYSENT_CI("stat64", stat64_32, 2), 1049 /* 216 */ SYSENT_CI("lstat64", lstat64_32, 2), 1050 /* 217 */ SYSENT_CI("fstat64", fstat64_32, 2), 1051 /* 218 */ SYSENT_CI("statvfs64", statvfs64_32, 2), 1052 /* 219 */ SYSENT_CI("fstatvfs64", fstatvfs64_32, 2), 1053 /* 220 */ SYSENT_CI("setrlimit64", setrlimit64, 2), 1054 /* 221 */ SYSENT_CI("getrlimit64", getrlimit64, 2), 1055 /* 222 */ SYSENT_CI("pread64", pread64, 5), 1056 /* 223 */ SYSENT_CI("pwrite64", pwrite64, 5), 1057 /* 224 */ SYSENT_LOADABLE32(), /* (was creat64) */ 1058 /* 225 */ SYSENT_CI("open64", open64, 3), 1059 /* 226 */ SYSENT_LOADABLE32(), /* rpcsys */ 1060 /* 227 */ SYSENT_CI("zone", zone, 6), 1061 /* 228 */ SYSENT_LOADABLE32(), /* autofssys */ 1062 /* 229 */ SYSENT_CI("getcwd", getcwd, 2), 1063 /* 230 */ SYSENT_CI("so_socket", so_socket, 5), 1064 /* 231 */ SYSENT_CI("so_socketpair", so_socketpair, 1), 1065 /* 232 */ SYSENT_CI("bind", bind, 4), 1066 /* 233 */ SYSENT_CI("listen", listen, 3), 1067 /* 234 */ SYSENT_CI("accept", accept, 5), 1068 /* 235 */ SYSENT_CI("connect", connect, 4), 1069 /* 236 */ SYSENT_CI("shutdown", shutdown, 3), 1070 /* 237 */ SYSENT_CI("recv", recv32, 4), 1071 /* 238 */ SYSENT_CI("recvfrom", recvfrom32, 6), 1072 /* 239 */ SYSENT_CI("recvmsg", recvmsg, 3), 1073 /* 240 */ SYSENT_CI("send", send32, 4), 1074 /* 241 */ SYSENT_CI("sendmsg", sendmsg, 3), 1075 /* 242 */ SYSENT_CI("sendto", sendto32, 6), 1076 /* 243 */ SYSENT_CI("getpeername", getpeername, 4), 1077 /* 244 */ SYSENT_CI("getsockname", getsockname, 4), 1078 /* 245 */ SYSENT_CI("getsockopt", getsockopt, 6), 1079 /* 246 */ SYSENT_CI("setsockopt", setsockopt, 6), 1080 /* 247 */ SYSENT_CI("sockconfig", sockconfig, 5), 1081 /* 248 */ SYSENT_CI("ntp_gettime", ntp_gettime, 1), 1082 /* 249 */ SYSENT_CI("ntp_adjtime", ntp_adjtime, 1), 1083 /* 250 */ SYSENT_CI("lwp_mutex_unlock", lwp_mutex_unlock, 1), 1084 /* 251 */ SYSENT_CI("lwp_mutex_trylock", lwp_mutex_trylock, 2), 1085 /* 252 */ SYSENT_CI("lwp_mutex_register", lwp_mutex_register, 2), 1086 /* 253 */ SYSENT_CI("cladm", cladm, 3), 1087 /* 254 */ SYSENT_CI("uucopy", uucopy, 3), 1088 /* 255 */ SYSENT_CI("umount2", umount2, 2) 1089 }; 1090 #endif /* _SYSCALL32_IMPL */ 1091 1092 /* 1093 * Space allocated and initialized in init_syscallnames(). 1094 */ 1095 char **syscallnames; 1096 1097 systrace_sysent_t *systrace_sysent; 1098 void (*systrace_probe)(dtrace_id_t, uintptr_t, uintptr_t, 1099 uintptr_t, uintptr_t, uintptr_t, uintptr_t); 1100 1101 /*ARGSUSED*/ 1102 void 1103 systrace_stub(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1, 1104 uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5) 1105 {} 1106 1107 /*ARGSUSED*/ 1108 int64_t 1109 dtrace_systrace_syscall(uintptr_t arg0, uintptr_t arg1, uintptr_t arg2, 1110 uintptr_t arg3, uintptr_t arg4, uintptr_t arg5) 1111 { 1112 systrace_sysent_t *sy = &systrace_sysent[curthread->t_sysnum]; 1113 dtrace_id_t id; 1114 int64_t rval; 1115 proc_t *p; 1116 1117 if ((id = sy->stsy_entry) != DTRACE_IDNONE) 1118 (*systrace_probe)(id, arg0, arg1, arg2, arg3, arg4, arg5); 1119 1120 /* 1121 * We want to explicitly allow DTrace consumers to stop a process 1122 * before it actually executes the meat of the syscall. 1123 */ 1124 p = ttoproc(curthread); 1125 mutex_enter(&p->p_lock); 1126 if (curthread->t_dtrace_stop && !curthread->t_lwp->lwp_nostop) { 1127 curthread->t_dtrace_stop = 0; 1128 stop(PR_REQUESTED, 0); 1129 } 1130 mutex_exit(&p->p_lock); 1131 1132 rval = (*sy->stsy_underlying)(arg0, arg1, arg2, arg3, arg4, arg5); 1133 1134 if (ttolwp(curthread)->lwp_errno != 0) 1135 rval = -1; 1136 1137 if ((id = sy->stsy_return) != DTRACE_IDNONE) 1138 (*systrace_probe)(id, (uintptr_t)rval, (uintptr_t)rval, 1139 (uintptr_t)((int64_t)rval >> 32), 0, 0, 0); 1140 1141 return (rval); 1142 } 1143 1144 #ifdef _SYSCALL32_IMPL 1145 1146 systrace_sysent_t *systrace_sysent32; 1147 1148 /*ARGSUSED*/ 1149 int64_t 1150 dtrace_systrace_syscall32(uintptr_t arg0, uintptr_t arg1, uintptr_t arg2, 1151 uintptr_t arg3, uintptr_t arg4, uintptr_t arg5) 1152 { 1153 systrace_sysent_t *sy = &systrace_sysent32[curthread->t_sysnum]; 1154 dtrace_id_t id; 1155 int64_t rval; 1156 proc_t *p; 1157 1158 if ((id = sy->stsy_entry) != DTRACE_IDNONE) 1159 (*systrace_probe)(id, arg0, arg1, arg2, arg3, arg4, arg5); 1160 1161 /* 1162 * We want to explicitly allow DTrace consumers to stop a process 1163 * before it actually executes the meat of the syscall. 1164 */ 1165 p = ttoproc(curthread); 1166 mutex_enter(&p->p_lock); 1167 if (curthread->t_dtrace_stop && !curthread->t_lwp->lwp_nostop) { 1168 curthread->t_dtrace_stop = 0; 1169 stop(PR_REQUESTED, 0); 1170 } 1171 mutex_exit(&p->p_lock); 1172 1173 rval = (*sy->stsy_underlying)(arg0, arg1, arg2, arg3, arg4, arg5); 1174 1175 if (ttolwp(curthread)->lwp_errno != 0) 1176 rval = -1; 1177 1178 if ((id = sy->stsy_return) != DTRACE_IDNONE) 1179 (*systrace_probe)(id, (uintptr_t)rval, (uintptr_t)rval, 1180 (uintptr_t)((uint64_t)rval >> 32), 0, 0, 0); 1181 1182 return (rval); 1183 } 1184 1185 #endif 1186 1187 void 1188 dtrace_systrace_rtt(void) 1189 { 1190 systrace_sysent_t *sy; 1191 dtrace_id_t id; 1192 1193 if (get_udatamodel() == DATAMODEL_NATIVE) { 1194 if (systrace_sysent == NULL) 1195 return; 1196 1197 sy = &systrace_sysent[curthread->t_sysnum]; 1198 #ifdef _SYSCALL32_IMPL 1199 } else { 1200 if (systrace_sysent32 == NULL) 1201 return; 1202 1203 sy = &systrace_sysent32[curthread->t_sysnum]; 1204 #endif 1205 } 1206 1207 if ((id = sy->stsy_return) != DTRACE_IDNONE) 1208 (*systrace_probe)(id, 0, 0, 0, 0, 0, 0); 1209 } 1210