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