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