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