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