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