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