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