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