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