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