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