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 * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
28 */
29
30 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
31 /* All Rights Reserved */
32
33 /* ONC_PLUS EXTRACT END */
34
35 #include <sys/param.h>
36 #include <sys/types.h>
37 #include <sys/systm.h>
38 #include <sys/systrace.h>
39 #include <sys/procfs.h>
40 #include <sys/mman.h>
41 #include <sys/int_types.h>
42 #include <c2/audit.h>
43 #include <sys/stat.h>
44 #include <sys/times.h>
45 #include <sys/statfs.h>
46 #include <sys/stropts.h>
47 #include <sys/statvfs.h>
48 #include <sys/utsname.h>
49 #include <sys/timex.h>
50 #include <sys/socket.h>
51 #include <sys/sendfile.h>
52
53 struct hrtsysa;
54 struct mmaplf32a;
55
56 /* ONC_PLUS EXTRACT START */
57 /*
58 * This table is the switch used to transfer to the appropriate
59 * routine for processing a system call. Each row contains the
60 * number of arguments expected, a switch that tells systrap()
61 * in trap.c whether a setjmp() is not necessary, and a pointer
62 * to the routine.
63 */
64 /* ONC_PLUS EXTRACT END */
65
66 int access(char *, int);
67 int alarm(int);
68 int auditsys(struct auditcalls *, rval_t *);
69 int64_t brandsys(int, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t,
70 uintptr_t);
71 int brk(caddr_t);
72 int chdir(char *);
73 int chmod(char *, int);
74 int chown(char *, uid_t, gid_t);
75 int chroot(char *);
76 int cladm(int, int, void *);
77 int close(int);
78 int exece(const char *, const char **, const char **);
79 int faccessat(int, char *, int, int);
80 int fchmodat(int, char *, int, int);
81 int fchownat(int, char *, uid_t, gid_t, int);
82 int fcntl(int, int, intptr_t);
83 int64_t vfork();
84 int64_t forksys(int, int);
405
406 #if (defined(__i386) && !defined(__amd64)) || defined(__i386_COMPAT)
407 #define IF_386_ABI(true, false) true
408 #else
409 #define IF_386_ABI(true, false) false
410 #endif
411
412 /*
413 * Define system calls that return a native 'long' quantity i.e. a 32-bit
414 * or 64-bit integer - depending on how the kernel is itself compiled
415 * e.g. read(2) returns 'ssize_t' in the kernel and in userland.
416 */
417 #define SYSENT_CL(name, call, narg) \
418 IF_LP64(SYSENT_C(name, call, narg), SYSENT_CI(name, call, narg))
419
420 /*
421 * Initialization macro for loadable native system calls.
422 */
423 #define SYSENT_LOADABLE() \
424 { 0, SE_LOADABLE, (int (*)())nosys, NULL, loadable_syscall }
425 /* ONC_PLUS EXTRACT END */
426
427 /*
428 * Initialization macro for loadable 32-bit compatibility system calls.
429 */
430 #define SYSENT_LOADABLE32() SYSENT_LOADABLE()
431
432 #define SYSENT_NOSYS() SYSENT_C("nosys", nosys, 0)
433
434 struct sysent nosys_ent = SYSENT_NOSYS();
435
436 /* ONC_PLUS EXTRACT START */
437 /*
438 * Native sysent table.
439 */
440 struct sysent sysent[NSYSCALL] =
441 {
442 /* ONC_PLUS EXTRACT END */
443 /* 0 */ IF_LP64(
444 SYSENT_NOSYS(),
445 SYSENT_C("indir", indir, 1)),
446 /* 1 */ SYSENT_CI("exit", rexit, 1),
447 /* 2 */ SYSENT_LOADABLE(), /* (was forkall) */
448 /* 3 */ SYSENT_CL("read", read, 3),
449 /* 4 */ SYSENT_CL("write", write, 3),
450 /* 5 */ SYSENT_CI("open", open, 3),
451 /* 6 */ SYSENT_CI("close", close, 1),
452 /* 7 */ SYSENT_CI("linkat", linkat, 5),
453 /* 8 */ SYSENT_LOADABLE(), /* (was creat) */
454 /* 9 */ SYSENT_CI("link", link, 2),
455 /* 10 */ SYSENT_CI("unlink", unlink, 1),
456 /* 11 */ SYSENT_CI("symlinkat", symlinkat, 3),
457 /* 12 */ SYSENT_CI("chdir", chdir, 1),
458 /* 13 */ SYSENT_CL("time", gtime, 0),
459 /* 14 */ SYSENT_CI("mknod", mknod, 3),
460 /* 15 */ SYSENT_CI("chmod", chmod, 2),
461 /* 16 */ SYSENT_CI("chown", chown, 3),
462 /* 17 */ SYSENT_CI("brk", brk, 1),
547 /* 86 */ SYSENT_CI("putmsg", putmsg, 4),
548 /* 87 */ SYSENT_LOADABLE(), /* (was poll) */
549 /* 88 */ SYSENT_CI("lstat", lstat, 2),
550 /* 89 */ SYSENT_CI("symlink", symlink, 2),
551 /* 90 */ SYSENT_CL("readlink", readlink, 3),
552 /* 91 */ SYSENT_CI("setgroups", setgroups, 2),
553 /* 92 */ SYSENT_CI("getgroups", getgroups, 2),
554 /* 93 */ SYSENT_CI("fchmod", fchmod, 2),
555 /* 94 */ SYSENT_CI("fchown", fchown, 3),
556 /* 95 */ SYSENT_CI("sigprocmask", sigprocmask, 3),
557 /* 96 */ SYSENT_CI("sigsuspend", sigsuspend, 1),
558 /* 97 */ SYSENT_CI("sigaltstack", sigaltstack, 2),
559 /* 98 */ SYSENT_CI("sigaction", sigaction, 3),
560 /* 99 */ SYSENT_CI("sigpending", sigpending, 2),
561 /* 100 */ SYSENT_CI("getsetcontext", getsetcontext, 2),
562 /* 101 */ SYSENT_CI("fchmodat", fchmodat, 4),
563 /* 102 */ SYSENT_CI("mkdirat", mkdirat, 3),
564 /* 103 */ SYSENT_CI("statvfs", statvfs, 2),
565 /* 104 */ SYSENT_CI("fstatvfs", fstatvfs, 2),
566 /* 105 */ SYSENT_CI("getloadavg", getloadavg, 2),
567 /* ONC_PLUS EXTRACT START */
568 /* 106 */ SYSENT_LOADABLE(), /* nfssys */
569 /* ONC_PLUS EXTRACT END */
570 /* 107 */ SYSENT_CI("waitsys", waitsys, 4),
571 /* 108 */ SYSENT_CI("sigsendset", sigsendsys, 2),
572 /* 109 */ IF_x86(
573 SYSENT_AP("hrtsys", hrtsys, 5),
574 SYSENT_LOADABLE()),
575 /* 110 */ SYSENT_CI("utimesys", utimesys, 5),
576 /* 111 */ SYSENT_CI("sigresend", sigresend, 3),
577 /* 112 */ SYSENT_CL("priocntlsys", priocntlsys, 5),
578 /* 113 */ SYSENT_CL("pathconf", pathconf, 2),
579 /* 114 */ SYSENT_CI("mincore", mincore, 3),
580 /* 115 */ IF_LP64(
581 SYSENT_CL("mmap", smmap64, 6),
582 SYSENT_CL("mmap", smmap32, 6)),
583 /* 116 */ SYSENT_CI("mprotect", mprotect, 3),
584 /* 117 */ SYSENT_CI("munmap", munmap, 2),
585 /* 118 */ SYSENT_CL("fpathconf", fpathconf, 2),
586 /* 119 */ SYSENT_2CI("vfork", vfork, 0),
587 /* 120 */ SYSENT_CI("fchdir", fchdir, 1),
588 /* 121 */ SYSENT_CL("readv", readv, 3),
589 /* 122 */ SYSENT_CL("writev", writev, 3),
748 /* 236 */ SYSENT_CI("shutdown", shutdown, 3),
749 /* 237 */ SYSENT_CL("recv", recv, 4),
750 /* 238 */ SYSENT_CL("recvfrom", recvfrom, 6),
751 /* 239 */ SYSENT_CL("recvmsg", recvmsg, 3),
752 /* 240 */ SYSENT_CL("send", send, 4),
753 /* 241 */ SYSENT_CL("sendmsg", sendmsg, 3),
754 /* 242 */ SYSENT_CL("sendto", sendto, 6),
755 /* 243 */ SYSENT_CI("getpeername", getpeername, 4),
756 /* 244 */ SYSENT_CI("getsockname", getsockname, 4),
757 /* 245 */ SYSENT_CI("getsockopt", getsockopt, 6),
758 /* 246 */ SYSENT_CI("setsockopt", setsockopt, 6),
759 /* 247 */ SYSENT_CI("sockconfig", sockconfig, 5),
760 /* 248 */ SYSENT_CI("ntp_gettime", ntp_gettime, 1),
761 /* 249 */ SYSENT_CI("ntp_adjtime", ntp_adjtime, 1),
762 /* 250 */ SYSENT_CI("lwp_mutex_unlock", lwp_mutex_unlock, 1),
763 /* 251 */ SYSENT_CI("lwp_mutex_trylock", lwp_mutex_trylock, 2),
764 /* 252 */ SYSENT_CI("lwp_mutex_register", lwp_mutex_register, 2),
765 /* 253 */ SYSENT_CI("cladm", cladm, 3),
766 /* 254 */ SYSENT_CI("uucopy", uucopy, 3),
767 /* 255 */ SYSENT_CI("umount2", umount2, 2)
768 /* ONC_PLUS EXTRACT START */
769 };
770 /* ONC_PLUS EXTRACT END */
771
772
773 #ifdef _SYSCALL32_IMPL
774
775 extern int ulimit32(int, int);
776 extern ssize_t read32(int32_t, caddr32_t, size32_t);
777 extern ssize_t write32(int32_t, caddr32_t, size32_t);
778 extern ssize_t pread32(int32_t, caddr32_t, size32_t, off32_t);
779 extern ssize_t pwrite32(int32_t, caddr32_t, size32_t, off32_t);
780 extern ssize_t readv32(int32_t, caddr32_t, int32_t);
781 extern ssize_t writev32(int32_t, caddr32_t, int32_t);
782 extern ssize_t readlink32(caddr32_t, caddr32_t, size32_t);
783 extern ssize_t readlinkat32(int, caddr32_t, caddr32_t, size32_t);
784 extern int open32(char *, int, int);
785 extern int openat32(int, char *, int, int);
786 extern int stat32(char *, struct stat32 *);
787 extern int fstatat32(int, char *, struct stat32 *, int);
788 extern int lstat32(char *, struct stat32 *);
789 extern int fstat32(int, struct stat32 *);
790 extern int fstatat64_32(int, char *, struct stat64_32 *, int);
804 extern int fstatvfs64_32(int, struct statvfs64_32 *);
805 extern int sigaction32(int, struct sigaction32 *, struct sigaction32 *);
806 extern clock32_t times32(struct tms32 *);
807 extern int stime32(time32_t);
808 extern int getpagesizes32(int, size32_t *, int);
809 extern int sigaltstack32(struct sigaltstack32 *, struct sigaltstack32 *);
810 extern int sigqueue32(pid_t, int, caddr32_t, int, int);
811 extern offset_t llseek32(int32_t, uint32_t, uint32_t, int);
812 extern int waitsys32(idtype_t, id_t, siginfo_t *, int);
813
814 extern ssize_t recv32(int32_t, caddr32_t, size32_t, int32_t);
815 extern ssize_t recvfrom32(int32_t, caddr32_t, size32_t, int32_t, caddr32_t,
816 caddr32_t);
817 extern ssize_t send32(int32_t, caddr32_t, size32_t, int32_t);
818 extern ssize_t sendto32(int32_t, caddr32_t, size32_t, int32_t, caddr32_t,
819 socklen_t);
820
821 extern int privsys32(int, priv_op_t, priv_ptype_t, caddr32_t, size32_t, int);
822 extern int ucredsys32(int, int, caddr32_t);
823
824 /* ONC_PLUS EXTRACT START */
825 /*
826 * sysent table for ILP32 processes running on
827 * a LP64 kernel.
828 */
829 struct sysent sysent32[NSYSCALL] =
830 {
831 /* ONC_PLUS EXTRACT END */
832 /* 0 */ SYSENT_C("indir", indir, 1),
833 /* 1 */ SYSENT_CI("exit", (int (*)())rexit, 1),
834 /* 2 */ SYSENT_LOADABLE32(), /* (was forkall) */
835 /* 3 */ SYSENT_CI("read", read32, 3),
836 /* 4 */ SYSENT_CI("write", write32, 3),
837 /* 5 */ SYSENT_CI("open", open32, 3),
838 /* 6 */ SYSENT_CI("close", close, 1),
839 /* 7 */ SYSENT_CI("linkat", linkat, 5),
840 /* 8 */ SYSENT_LOADABLE32(), /* (was creat32) */
841 /* 9 */ SYSENT_CI("link", link, 2),
842 /* 10 */ SYSENT_CI("unlink", unlink, 1),
843 /* 11 */ SYSENT_CI("symlinkat", symlinkat, 3),
844 /* 12 */ SYSENT_CI("chdir", chdir, 1),
845 /* 13 */ SYSENT_CI("time", gtime, 0),
846 /* 14 */ SYSENT_CI("mknod", mknod, 3),
847 /* 15 */ SYSENT_CI("chmod", chmod, 2),
848 /* 16 */ SYSENT_CI("chown", chown, 3),
849 /* 17 */ SYSENT_CI("brk", brk, 1),
850 /* 18 */ SYSENT_CI("stat", stat32, 2),
851 /* 19 */ SYSENT_CI("lseek", lseek32, 3),
920 /* 86 */ SYSENT_CI("putmsg", putmsg32, 4),
921 /* 87 */ SYSENT_LOADABLE32(), /* (was poll) */
922 /* 88 */ SYSENT_CI("lstat", lstat32, 2),
923 /* 89 */ SYSENT_CI("symlink", symlink, 2),
924 /* 90 */ SYSENT_CI("readlink", readlink32, 3),
925 /* 91 */ SYSENT_CI("setgroups", setgroups, 2),
926 /* 92 */ SYSENT_CI("getgroups", getgroups, 2),
927 /* 93 */ SYSENT_CI("fchmod", fchmod, 2),
928 /* 94 */ SYSENT_CI("fchown", fchown, 3),
929 /* 95 */ SYSENT_CI("sigprocmask", sigprocmask, 3),
930 /* 96 */ SYSENT_CI("sigsuspend", sigsuspend, 1),
931 /* 97 */ SYSENT_CI("sigaltstack", sigaltstack32, 2),
932 /* 98 */ SYSENT_CI("sigaction", sigaction32, 3),
933 /* 99 */ SYSENT_CI("sigpending", sigpending, 2),
934 /* 100 */ SYSENT_CI("getsetcontext", getsetcontext32, 2),
935 /* 101 */ SYSENT_CI("fchmodat", fchmodat, 4),
936 /* 102 */ SYSENT_CI("mkdirat", mkdirat, 3),
937 /* 103 */ SYSENT_CI("statvfs", statvfs32, 2),
938 /* 104 */ SYSENT_CI("fstatvfs", fstatvfs32, 2),
939 /* 105 */ SYSENT_CI("getloadavg", getloadavg, 2),
940 /* ONC_PLUS EXTRACT START */
941 /* 106 */ SYSENT_LOADABLE32(), /* nfssys */
942 /* ONC_PLUS EXTRACT END */
943 /* 107 */ SYSENT_CI("waitsys", waitsys32, 4),
944 /* 108 */ SYSENT_CI("sigsendset", sigsendsys, 2),
945 /* 109 */ IF_x86(
946 SYSENT_AP("hrtsys", hrtsys, 5),
947 SYSENT_LOADABLE32()),
948 /* 110 */ SYSENT_CI("utimesys", utimesys, 5),
949 /* 111 */ SYSENT_CI("sigresend", sigresend, 3),
950 /* 112 */ SYSENT_CI("priocntlsys", priocntlsys, 5),
951 /* 113 */ SYSENT_CI("pathconf", pathconf, 2),
952 /* 114 */ SYSENT_CI("mincore", mincore, 3),
953 /* 115 */ SYSENT_CI("mmap", smmap32, 6),
954 /* 116 */ SYSENT_CI("mprotect", mprotect, 3),
955 /* 117 */ SYSENT_CI("munmap", munmap, 2),
956 /* 118 */ SYSENT_CI("fpathconf", fpathconf, 2),
957 /* 119 */ SYSENT_2CI("vfork", vfork, 0),
958 /* 120 */ SYSENT_CI("fchdir", fchdir, 1),
959 /* 121 */ SYSENT_CI("readv", readv32, 3),
960 /* 122 */ SYSENT_CI("writev", writev32, 3),
961 /* 123 */ SYSENT_LOADABLE32(), /* was xstat32 */
962 /* 124 */ SYSENT_LOADABLE32(), /* was lxstat32 */
1079 /* 236 */ SYSENT_CI("shutdown", shutdown, 3),
1080 /* 237 */ SYSENT_CI("recv", recv32, 4),
1081 /* 238 */ SYSENT_CI("recvfrom", recvfrom32, 6),
1082 /* 239 */ SYSENT_CI("recvmsg", recvmsg, 3),
1083 /* 240 */ SYSENT_CI("send", send32, 4),
1084 /* 241 */ SYSENT_CI("sendmsg", sendmsg, 3),
1085 /* 242 */ SYSENT_CI("sendto", sendto32, 6),
1086 /* 243 */ SYSENT_CI("getpeername", getpeername, 4),
1087 /* 244 */ SYSENT_CI("getsockname", getsockname, 4),
1088 /* 245 */ SYSENT_CI("getsockopt", getsockopt, 6),
1089 /* 246 */ SYSENT_CI("setsockopt", setsockopt, 6),
1090 /* 247 */ SYSENT_CI("sockconfig", sockconfig, 5),
1091 /* 248 */ SYSENT_CI("ntp_gettime", ntp_gettime, 1),
1092 /* 249 */ SYSENT_CI("ntp_adjtime", ntp_adjtime, 1),
1093 /* 250 */ SYSENT_CI("lwp_mutex_unlock", lwp_mutex_unlock, 1),
1094 /* 251 */ SYSENT_CI("lwp_mutex_trylock", lwp_mutex_trylock, 2),
1095 /* 252 */ SYSENT_CI("lwp_mutex_register", lwp_mutex_register, 2),
1096 /* 253 */ SYSENT_CI("cladm", cladm, 3),
1097 /* 254 */ SYSENT_CI("uucopy", uucopy, 3),
1098 /* 255 */ SYSENT_CI("umount2", umount2, 2)
1099 /* ONC_PLUS EXTRACT START */
1100 };
1101 /* ONC_PLUS EXTRACT END */
1102 #endif /* _SYSCALL32_IMPL */
1103
1104 /*
1105 * Space allocated and initialized in init_syscallnames().
1106 */
1107 char **syscallnames;
1108
1109 systrace_sysent_t *systrace_sysent;
1110 void (*systrace_probe)(dtrace_id_t, uintptr_t, uintptr_t,
1111 uintptr_t, uintptr_t, uintptr_t, uintptr_t);
1112
1113 /*ARGSUSED*/
1114 void
1115 systrace_stub(dtrace_id_t id, uintptr_t arg0, uintptr_t arg1,
1116 uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5)
1117 {}
1118
1119 /*ARGSUSED*/
1120 int64_t
1121 dtrace_systrace_syscall(uintptr_t arg0, uintptr_t arg1, uintptr_t arg2,
|
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);
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),
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),
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);
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),
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 */
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,
|