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