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 /*
23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #include <errno.h>
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <strings.h>
31 #include <unistd.h>
32 #include <sys/auxv.h>
33 #include <sys/bitmap.h>
34 #include <sys/brand.h>
35 #include <sys/inttypes.h>
36 #include <sys/lwp.h>
37 #include <sys/syscall.h>
38 #include <sys/systm.h>
39 #include <sys/utsname.h>
40 #include <fcntl.h>
41 
42 #include <sn1_brand.h>
43 #include <sn1_misc.h>
44 
45 /*
46  * Principles of emulation 101.
47  *
48  *
49  * *** Setting errno
50  *
51  * Just don't do it.  This emulation library is loaded onto a
52  * seperate link map from the application who's address space we're
53  * running in.  We have our own private copy of libc, so there for,
54  * the errno value accessible from here is is also private and changing
55  * it will not affect any errno value that the processes who's address
56  * space we are running in will see.  To return an error condition we
57  * should return the negated errno value we'd like the system to return.
58  * For more information about this see the comment in sn1_handler().
59  * Basically, when we return to the caller that initiated the system
60  * call it's their responsibility to set errno.
61  *
62  *
63  * *** Recursion Considerations
64  *
65  * When emulating system calls we need to be very careful about what
66  * library calls we invoke.  Library calls should be kept to a minimum.
67  * One issue is that library calls can invoke system calls, so if we're
68  * emulating a system call and we invoke a library call that depends on
69  * that system call we will probably enter a recursive loop, which would
70  * be bad.
71  *
72  *
73  * *** Return Values.
74  *
75  * When declaring new syscall emulation functions, it is very important
76  * to to set the proper RV_* flags in the sn1_sysent_table.  Upon failure,
77  * syscall emulation fuctions should return an errno value.  Upon success
78  * syscall emulation functions should return 0 and set the sysret_t return
79  * value parameters accordingly.
80  *
81  *
82  * *** Agent lwp considerations
83  *
84  * It is currently impossible to do any emulation for these system call
85  * when they are being invoked on behalf of an agent lwp.  To understand why
86  * it's impossible you have to understand how agent lwp syscalls work.
87  *
88  * The agent lwp syscall process works as follows:
89  *   1  The controlling process stops the target.
90  *   2  The controlling process injects an agent lwp which is also stopped.
91  *      This agent lwp assumes the userland stack and register values
92  *      of another stopped lwp in the current process.
93  *   3  The controlling process configures the agent lwp to start
94  *      executing the requested system call.
95  *   4  The controlling process configure /proc to stop the agent lwp when
96  *      it enters the requested system call.
97  *   5  The controlling processes allows the agent lwp to start executing.
98  *   6  The agent lwp traps into the kernel to perform the requested system
99  *      call and immediately stop.
100  *   7  The controlling process copies all the arguments for the requested
101  *      system call onto the agent lwp's stack.
102  *   8  The controlling process configures /proc to stop the agent lwp
103  *      when it completes the requested system call.
104  *   9  The controlling processes allows the agent lwp to start executing.
105  *  10  The agent lwp executes the system call and then stop before returning
106  *      to userland.
107  *  11  The controlling process copies the return value and return arguments
108  *      back from the agent lwps stack.
109  *  12  The controlling process destroys the agent lwp and restarts
110  *      the target process.
111  *
112  * The fundamental problem is that when the agent executes the request
113  * system call in step 5, if we're emulating that system call then the
114  * lwp is redirected back to our emulation layer without blocking
115  * in the kernel.  But our emulation layer can't access the arguments
116  * for the system call because they haven't been copied to the stack
117  * yet and they still only exist in the controlling processes address
118  * space.  This prevents us from being able to do any emulation of
119  * agent lwp system calls.  Hence, currently our brand trap interposition
120  * callback (sn1_brand_syscall_callback_common) will detect if a system
121  * call is being made by an agent lwp, and if this is the case it will
122  * never redirect the system call to this emulation library.
123  *
124  * In the future, if this proves to be a problem the the easiest solution
125  * would probably be to replace the branded versions of these application
126  * with their native counterparts.  Ie,  truss, plimit, and pfiles could be
127  * replace with wrapper scripts that execute the native versions of these
128  * applications.  In the case of plimit and pfiles this should be pretty
129  * strait forward.  Truss would probably be more tricky since it can
130  * execute applications which would be branded applications, so in that
131  * case it might be necessary to create a loadable library which could
132  * be LD_PRELOADed into truss and this library would interpose on the
133  * exec() system call to allow truss to correctly execute branded
134  * processes.  It should be pointed out that this solution could work
135  * because "native agent lwps" (ie, agent lwps created by native
136  * processes) can be treated differently from "branded aged lwps" (ie,
137  * agent lwps created by branded processes), since native agent lwps
138  * would presumably be making native system calls and hence not need
139  * any interposition.
140  *
141  *
142  * *** sn1 brand emulation scope considerations
143  *
144  * One of the differences between the lx brand and the s8 and s9
145  * brands, is that the s8 and s9 brands only interpose on syscalls
146  * that need some kind of emulation, where as the lx brand interposes
147  * on _all_ system calls.  Lx branded system calls that don't need
148  * any emulation are then redirected back to the kernel from the
149  * userland library via the IN_KERNEL_SYSCALL macro.  The lx-syscall
150  * dtrace provider depends on this behavior.
151  *
152  * Given that the sn1 brand exists for testing purposes, it should
153  * eventually be enhanced to redirect all system calls through the
154  * brand emulation library.  This will ensure the maximum testing
155  * exposure for the brandz infrastructure.  Some other options to
156  * consider for improving brandz test exposure are:
157  * - Folding the sn1 brand into the native brand and only enabling
158  *   it on DEBUG builds.
159  * - Modifying the zones test suite to use sn1 branded zones by default,
160  *   any adapting functional test harnesses to use sn1 branded zones
161  *   by default instead of native zones.
162  */
163 
164 #define	EMULATE(cb, args)	{ (sysent_cb_t)(cb), (args) }
165 #define	NOSYS			EMULATE(sn1_unimpl, (0 | RV_DEFAULT))
166 
167 typedef long (*sysent_cb_t)();
168 typedef struct sn1_sysent_table {
169 	sysent_cb_t	st_callc;
170 	uintptr_t	st_args;
171 } sn1_sysent_table_t;
172 sn1_sysent_table_t sn1_sysent_table[];
173 
174 /*LINTED: static unused*/
175 static volatile int		sn1_abort_err;
176 /*LINTED: static unused*/
177 static volatile const char	*sn1_abort_msg;
178 /*LINTED: static unused*/
179 static volatile const char	*sn1_abort_file;
180 /*LINTED: static unused*/
181 static volatile int		sn1_abort_line;
182 
183 extern int errno;
184 
185 /*ARGSUSED*/
186 void
187 _sn1_abort(int err, const char *msg, const char *file, int line)
188 {
189 	sysret_t rval;
190 
191 	/* Save the error message into convenient globals */
192 	sn1_abort_err = err;
193 	sn1_abort_msg = msg;
194 	sn1_abort_file = file;
195 	sn1_abort_line = line;
196 
197 	/* kill ourselves */
198 	abort();
199 
200 	/* If abort() didn't work, try something stronger. */
201 	(void) __systemcall(&rval, SYS_lwp_kill + 1024, _lwp_self(), SIGKILL);
202 }
203 
204 /*
205  * This function is defined to be NOSYS but it won't be called from the
206  * the kernel since the NOSYS system calls are not enabled in the kernel.
207  * Thus, the only time this function is called is directly from within the
208  * indirect system call path.
209  */
210 /*ARGSUSED*/
211 static long
212 sn1_unimpl(sysret_t *rv, uintptr_t p1)
213 {
214 	sysret_t rval;
215 
216 	/*
217 	 * We'd like to print out some kind of error message here like
218 	 * "unsupported syscall", but we can't because it's not safe to
219 	 * assume that stderr or STDERR_FILENO actually points to something
220 	 * that is a terminal, and if we wrote to those files we could
221 	 * inadvertantly write to some applications open files, which would
222 	 * be bad.
223 	 *
224 	 * Normally, if an application calls an invalid system call
225 	 * it get a SIGSYS sent to it.  So we'll just go ahead and send
226 	 * ourselves a signal here.  Note that this is far from ideal since
227 	 * if the application has registered a signal handler, that signal
228 	 * handler may recieve a ucontext_t as the third parameter to
229 	 * indicate the context of the process when the signal was
230 	 * generated, and in this case that context will not be what the
231 	 * application is expecting.  Hence, we should probably create a
232 	 * brandsys() kernel function that can deliver the signal to us
233 	 * with the correct ucontext_t.
234 	 */
235 	(void) __systemcall(&rval, SYS_lwp_kill + 1024, _lwp_self(), SIGSYS);
236 	return (ENOSYS);
237 }
238 
239 #if defined(__sparc) && !defined(__sparcv9)
240 /*
241  * Yuck.  For 32-bit sparc applications, handle indirect system calls.
242  * Note that we declare this interface to use the maximum number of
243  * system call arguments.  If we recieve a system call that uses less
244  * arguments, then the additional arguments will be garbage, but they
245  * will also be ignored so that should be ok.
246  */
247 static long
248 sn1_indir(sysret_t *rv, int code,
249     uintptr_t a0, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4,
250     uintptr_t a5, uintptr_t a6, uintptr_t a7)
251 {
252 	sn1_sysent_table_t *sst = &(sn1_sysent_table[code]);
253 
254 	sn1_assert(code < NSYSCALL);
255 	switch (sst->st_args & NARGS_MASK) {
256 	case 0:
257 		return ((sst->st_callc)(rv));
258 	case 1:
259 		return ((sst->st_callc)(rv, a0));
260 	case 2:
261 		return ((sst->st_callc)(rv, a0, a1));
262 	case 3:
263 		return ((sst->st_callc)(rv, a0, a1, a2));
264 	case 4:
265 		return ((sst->st_callc)(rv, a0, a1, a2, a3));
266 	case 5:
267 		return ((sst->st_callc)(rv, a0, a1, a2, a3, a4));
268 	case 6:
269 		return ((sst->st_callc)(rv, rv, a0, a1, a2, a3, a4, a5));
270 	case 7:
271 		return ((sst->st_callc)(rv, a0, a1, a2, a3, a4, a5, a6));
272 	case 8:
273 		return ((sst->st_callc)(rv, a0, a1, a2, a3, a4, a5, a6, a7));
274 	}
275 	sn1_abort(0, "invalid entry in sn1_sysent_table");
276 	return (EINVAL);
277 }
278 #endif /* __sparc && !__sparcv9 */
279 
280 static long
281 sn1_uname(sysret_t *rv, uintptr_t p1)
282 {
283 	struct utsname	un, *unp = (struct utsname *)p1;
284 	int		rev, err;
285 
286 	if ((err = __systemcall(rv, SYS_uname + 1024, &un)) != 0)
287 		return (err);
288 
289 	rev = atoi(&un.release[2]);
290 	sn1_assert(rev >= 10);
291 	(void) sprintf(un.release, "5.%d", rev - 1);
292 
293 	if (uucopy(&un, unp, sizeof (un)) != 0)
294 		return (EFAULT);
295 	return (0);
296 }
297 
298 /*
299  * Close a libc file handle, but don't actually close the underlying
300  * file descriptor.
301  */
302 static void
303 sn1_close_fh(FILE *file)
304 {
305 	int fd, fd_new;
306 
307 	if (file == NULL)
308 		return;
309 
310 	if ((fd = fileno(file)) < 0)
311 		return;
312 
313 	/*
314 	 * While we could use dup() since we're linked with the native libc,
315 	 * the dup() syscall itself no longer exists so this would be
316 	 * problematic for any brands built from sn1.
317 	 */
318 	fd_new = fcntl(fd, F_DUPFD, 0);
319 	if (fd_new == -1)
320 		return;
321 
322 	(void) fclose(file);
323 	(void) dup2(fd_new, fd);
324 	(void) close(fd_new);
325 }
326 
327 /*ARGSUSED*/
328 int
329 sn1_init(int argc, char *argv[], char *envp[])
330 {
331 	sysret_t		rval;
332 	sn1_brand_reg_t		reg;
333 	sn1_elf_data_t		sed;
334 	auxv_t			*ap;
335 	uintptr_t		*p;
336 	int			i, err;
337 
338 	/* Sanity check our translation table return value codes */
339 	for (i = 0; i < NSYSCALL; i++) {
340 		sn1_sysent_table_t *est = &(sn1_sysent_table[i]);
341 		sn1_assert(BIT_ONLYONESET(est->st_args & RV_MASK));
342 	}
343 
344 	/*
345 	 * We need to shutdown all libc stdio.  libc stdio normally goes to
346 	 * file descriptors, but since we're actually part of a another
347 	 * process we don't own these file descriptors and we can't make
348 	 * any assumptions about their state.
349 	 */
350 	sn1_close_fh(stdin);
351 	sn1_close_fh(stdout);
352 	sn1_close_fh(stderr);
353 
354 	/*
355 	 * Register our syscall emulation table with the kernel.
356 	 * Note that we don't have to do invoke (syscall_number + 1024)
357 	 * until we've actually establised a syscall emulation callback
358 	 * handler address, which is what we're doing with this brand
359 	 * syscall.
360 	 */
361 	reg.sbr_version = SN1_VERSION;
362 #ifdef	__x86
363 	reg.sbr_handler = (caddr_t)sn1_handler_table;
364 #else	/* !__x86 */
365 	reg.sbr_handler = (caddr_t)sn1_handler;
366 #endif	/* !__x86 */
367 	if ((err = __systemcall(&rval, SYS_brand, B_REGISTER, &reg)) != 0) {
368 		sn1_abort(err, "Failed to brand current process");
369 		/*NOTREACHED*/
370 	}
371 
372 	/* Get data about the executable we're running from the kernel. */
373 	if ((err = __systemcall(&rval, SYS_brand + 1024,
374 	    B_ELFDATA, (void *)&sed)) != 0) {
375 		sn1_abort(err,
376 		    "Failed to get required brand ELF data from the kernel");
377 		/*NOTREACHED*/
378 	}
379 
380 	/*
381 	 * Find the aux vector on the stack.
382 	 */
383 	p = (uintptr_t *)envp;
384 	while (*p != NULL)
385 		p++;
386 
387 	/*
388 	 * p is now pointing at the 0 word after the environ pointers.
389 	 * After that is the aux vectors.
390 	 *
391 	 * The aux vectors are currently pointing to the brand emulation
392 	 * library and associated linker.  We're going to change them to
393 	 * point to the brand executable and associated linker (or to no
394 	 * linker for static binaries).  This matches the process data
395 	 * stored within the kernel and visible from /proc, which was
396 	 * all setup in sn1_elfexec().  We do this so that when a debugger
397 	 * attaches to the process it sees the process as a normal solaris
398 	 * process, this brand emulation library and everything on it's
399 	 * link map will not be visible, unless our librtld_db plugin
400 	 * is used.  Note that this is very different from how Linux
401 	 * branded processes are implemented within lx branded zones.
402 	 * In that situation, the primary linkmap of the process is the
403 	 * brand emulation libraries linkmap, not the Linux applications
404 	 * linkmap.
405 	 *
406 	 * We also need to clear the AF_SUN_NOPLM flag from the AT_SUN_AUXFLAGS
407 	 * aux vector.  This flag told our linker that we don't have a
408 	 * primary link map.  Now that our linker is done initializing, we
409 	 * want to clear this flag before we transfer control to the
410 	 * applications copy of the linker, since we want that linker to have
411 	 * a primary link map which will be the link map for the application
412 	 * we're running.
413 	 */
414 	p++;
415 	for (ap = (auxv_t *)p; ap->a_type != AT_NULL; ap++) {
416 		switch (ap->a_type) {
417 			case AT_BASE:
418 				/* Hide AT_BASE if static binary */
419 				if (sed.sed_base == NULL) {
420 					ap->a_type = AT_IGNORE;
421 					ap->a_un.a_val = NULL;
422 				} else {
423 					ap->a_un.a_val = sed.sed_base;
424 				}
425 				break;
426 			case AT_ENTRY:
427 				ap->a_un.a_val = sed.sed_entry;
428 				break;
429 			case AT_PHDR:
430 				ap->a_un.a_val = sed.sed_phdr;
431 				break;
432 			case AT_PHENT:
433 				ap->a_un.a_val = sed.sed_phent;
434 				break;
435 			case AT_PHNUM:
436 				ap->a_un.a_val = sed.sed_phnum;
437 				break;
438 			case AT_SUN_AUXFLAGS:
439 				ap->a_un.a_val &= ~AF_SUN_NOPLM;
440 				break;
441 			case AT_SUN_EMULATOR:
442 				/*
443 				 * ld.so.1 inspects AT_SUN_EMULATOR to see if
444 				 * if it is the linker for the brand emulation
445 				 * library.  Hide AT_SUN_EMULATOR, as the
446 				 * linker we are about to jump to is the linker
447 				 * for the binary.
448 				 */
449 				ap->a_type = AT_IGNORE;
450 				ap->a_un.a_val = NULL;
451 				break;
452 			case AT_SUN_LDDATA:
453 				/* Hide AT_SUN_LDDATA if static binary */
454 				if (sed.sed_lddata == NULL) {
455 					ap->a_type = AT_IGNORE;
456 					ap->a_un.a_val = NULL;
457 				} else {
458 					ap->a_un.a_val = sed.sed_lddata;
459 				}
460 				break;
461 			default:
462 				break;
463 		}
464 	}
465 
466 	sn1_runexe(argv, sed.sed_ldentry);
467 	/*NOTREACHED*/
468 	sn1_abort(0, "sn1_runexe() returned");
469 	return (-1);
470 }
471 
472 #define	IN_KERNEL_SYSCALL(name, num)					\
473 static long								\
474 sn1_##name(sysret_t *rv,						\
475     uintptr_t a0, uintptr_t a1, uintptr_t a2, uintptr_t a3,		\
476     uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7)		\
477 {									\
478 	return (__systemcall(rv, num + 1024,				\
479 	    a0, a1, a2, a3, a4, a5, a6, a7));				\
480 }
481 
482 /*
483  * These are branded system calls, which have been redirected to this
484  * userland emulation library, and are emulated by passing them strait
485  * on to the kernel as native system calls.
486  */
487 IN_KERNEL_SYSCALL(read,		SYS_read)		/*   3 */
488 IN_KERNEL_SYSCALL(write,	SYS_write)		/*   4 */
489 IN_KERNEL_SYSCALL(time,		SYS_time)		/*  13 */
490 IN_KERNEL_SYSCALL(getpid,	SYS_getpid)		/*  20 */
491 IN_KERNEL_SYSCALL(mount,	SYS_mount)		/*  21 */
492 IN_KERNEL_SYSCALL(getuid,	SYS_getuid)		/*  24 */
493 IN_KERNEL_SYSCALL(times,	SYS_times)		/*  43 */
494 IN_KERNEL_SYSCALL(getgid,	SYS_getgid)		/*  47 */
495 IN_KERNEL_SYSCALL(utssys,	SYS_utssys)		/*  57 */
496 IN_KERNEL_SYSCALL(readlink,	SYS_readlink)		/*  90 */
497 IN_KERNEL_SYSCALL(waitid,	SYS_waitid)		/* 107 */
498 
499 /*
500  * This table must have at least NSYSCALL entries in it.
501  *
502  * The second parameter of each entry in the sn1_sysent_table
503  * contains the number of parameters and flags that describe the
504  * syscall return value encoding.  See the block comments at the
505  * top of this file for more information about the syscall return
506  * value flags and when they should be used.
507  */
508 sn1_sysent_table_t sn1_sysent_table[] = {
509 #if defined(__sparc) && !defined(__sparcv9)
510 	EMULATE(sn1_indir, 9 | RV_64RVAL),	/*  0 */
511 #else /* !__sparc || __sparcv9 */
512 	NOSYS,					/*  0 */
513 #endif /* !__sparc || __sparcv9 */
514 	NOSYS,					/*   1 */
515 	NOSYS,					/*   2 */
516 	EMULATE(sn1_read, 3 | RV_DEFAULT),	/*   3 */
517 	EMULATE(sn1_write, 3 | RV_DEFAULT),	/*   4 */
518 	NOSYS,					/*   5 */
519 	NOSYS,					/*   6 */
520 	NOSYS,					/*   7 */
521 	NOSYS,					/*   8 */
522 	NOSYS,					/*   9 */
523 	NOSYS,					/*  10 */
524 	NOSYS,					/*  11 */
525 	NOSYS,					/*  12 */
526 	EMULATE(sn1_time, 0 | RV_DEFAULT),	/*  13 */
527 	NOSYS,					/*  14 */
528 	NOSYS,					/*  15 */
529 	NOSYS,					/*  16 */
530 	NOSYS,					/*  17 */
531 	NOSYS,					/*  18 */
532 	NOSYS,					/*  19 */
533 	EMULATE(sn1_getpid, 0 | RV_32RVAL2),	/*  20 */
534 	EMULATE(sn1_mount, 8 | RV_DEFAULT),	/*  21 */
535 	NOSYS,					/*  22 */
536 	NOSYS,					/*  23 */
537 	EMULATE(sn1_getuid, 0 | RV_32RVAL2),	/*  24 */
538 	NOSYS,					/*  25 */
539 	NOSYS,					/*  26 */
540 	NOSYS,					/*  27 */
541 	NOSYS,					/*  28 */
542 	NOSYS,					/*  29 */
543 	NOSYS,					/*  30 */
544 	NOSYS,					/*  31 */
545 	NOSYS,					/*  32 */
546 	NOSYS,					/*  33 */
547 	NOSYS,					/*  34 */
548 	NOSYS,					/*  35 */
549 	NOSYS,					/*  36 */
550 	NOSYS,					/*  37 */
551 	NOSYS,					/*  38 */
552 	NOSYS,					/*  39 */
553 	NOSYS,					/*  40 */
554 	NOSYS,					/*  41 */
555 	NOSYS,					/*  42 */
556 	EMULATE(sn1_times, 1 | RV_DEFAULT),	/*  43 */
557 	NOSYS,					/*  44 */
558 	NOSYS,					/*  45 */
559 	NOSYS,					/*  46 */
560 	EMULATE(sn1_getgid, 0 | RV_32RVAL2),	/*  47 */
561 	NOSYS,					/*  48 */
562 	NOSYS,					/*  49 */
563 	NOSYS,					/*  50 */
564 	NOSYS,					/*  51 */
565 	NOSYS,					/*  52 */
566 	NOSYS,					/*  53 */
567 	NOSYS,					/*  54 */
568 	NOSYS,					/*  55 */
569 	NOSYS,					/*  56 */
570 	EMULATE(sn1_utssys, 4 | RV_32RVAL2),	/*  57 */
571 	NOSYS,					/*  58 */
572 	NOSYS,					/*  59 */
573 	NOSYS,					/*  60 */
574 	NOSYS,					/*  61 */
575 	NOSYS,					/*  62 */
576 	NOSYS,					/*  63 */
577 	NOSYS,					/*  64 */
578 	NOSYS,					/*  65 */
579 	NOSYS,					/*  66 */
580 	NOSYS,					/*  67 */
581 	NOSYS,					/*  68 */
582 	NOSYS,					/*  69 */
583 	NOSYS,					/*  70 */
584 	NOSYS,					/*  71 */
585 	NOSYS,					/*  72 */
586 	NOSYS,					/*  73 */
587 	NOSYS,					/*  74 */
588 	NOSYS,					/*  75 */
589 	NOSYS,					/*  76 */
590 	NOSYS,					/*  77 */
591 	NOSYS,					/*  78 */
592 	NOSYS,					/*  79 */
593 	NOSYS,					/*  80 */
594 	NOSYS,					/*  81 */
595 	NOSYS,					/*  82 */
596 	NOSYS,					/*  83 */
597 	NOSYS,					/*  84 */
598 	NOSYS,					/*  85 */
599 	NOSYS,					/*  86 */
600 	NOSYS,					/*  87 */
601 	NOSYS,					/*  88 */
602 	NOSYS,					/*  89 */
603 	EMULATE(sn1_readlink, 3 | RV_DEFAULT),	/*  90 */
604 	NOSYS,					/*  91 */
605 	NOSYS,					/*  92 */
606 	NOSYS,					/*  93 */
607 	NOSYS,					/*  94 */
608 	NOSYS,					/*  95 */
609 	NOSYS,					/*  96 */
610 	NOSYS,					/*  97 */
611 	NOSYS,					/*  98 */
612 	NOSYS,					/*  99 */
613 	NOSYS,					/* 100 */
614 	NOSYS,					/* 101 */
615 	NOSYS,					/* 102 */
616 	NOSYS,					/* 103 */
617 	NOSYS,					/* 104 */
618 	NOSYS,					/* 105 */
619 	NOSYS,					/* 106 */
620 	EMULATE(sn1_waitid, 4 | RV_DEFAULT),	/* 107 */
621 	NOSYS,					/* 108 */
622 	NOSYS,					/* 109 */
623 	NOSYS,					/* 110 */
624 	NOSYS,					/* 111 */
625 	NOSYS,					/* 112 */
626 	NOSYS,					/* 113 */
627 	NOSYS,					/* 114 */
628 	NOSYS,					/* 115 */
629 	NOSYS,					/* 116 */
630 	NOSYS,					/* 117 */
631 	NOSYS,					/* 118 */
632 	NOSYS,					/* 119 */
633 	NOSYS,					/* 120 */
634 	NOSYS,					/* 121 */
635 	NOSYS,					/* 122 */
636 	NOSYS,					/* 123 */
637 	NOSYS,					/* 124 */
638 	NOSYS,					/* 125 */
639 	NOSYS,					/* 126 */
640 	NOSYS,					/* 127 */
641 	NOSYS,					/* 128 */
642 	NOSYS,					/* 129 */
643 	NOSYS,					/* 130 */
644 	NOSYS,					/* 131 */
645 	NOSYS,					/* 132 */
646 	NOSYS,					/* 133 */
647 	NOSYS,					/* 134 */
648 	EMULATE(sn1_uname, 1 | RV_DEFAULT),	/* 135 */
649 	NOSYS,					/* 136 */
650 	NOSYS,					/* 137 */
651 	NOSYS,					/* 138 */
652 	NOSYS,					/* 139 */
653 	NOSYS,					/* 140 */
654 	NOSYS,					/* 141 */
655 	NOSYS,					/* 142 */
656 	NOSYS,					/* 143 */
657 	NOSYS,					/* 144 */
658 	NOSYS,					/* 145 */
659 	NOSYS,					/* 146 */
660 	NOSYS,					/* 147 */
661 	NOSYS,					/* 148 */
662 	NOSYS,					/* 149 */
663 	NOSYS,					/* 150 */
664 	NOSYS,					/* 151 */
665 	NOSYS,					/* 152 */
666 	NOSYS,					/* 153 */
667 	NOSYS,					/* 154 */
668 	NOSYS,					/* 155 */
669 	NOSYS,					/* 156 */
670 	NOSYS,					/* 157 */
671 	NOSYS,					/* 158 */
672 	NOSYS,					/* 159 */
673 	NOSYS,					/* 160 */
674 	NOSYS,					/* 161 */
675 	NOSYS,					/* 162 */
676 	NOSYS,					/* 163 */
677 	NOSYS,					/* 164 */
678 	NOSYS,					/* 165 */
679 	NOSYS,					/* 166 */
680 	NOSYS,					/* 167 */
681 	NOSYS,					/* 168 */
682 	NOSYS,					/* 169 */
683 	NOSYS,					/* 170 */
684 	NOSYS,					/* 171 */
685 	NOSYS,					/* 172 */
686 	NOSYS,					/* 173 */
687 	NOSYS,					/* 174 */
688 	NOSYS,					/* 175 */
689 	NOSYS,					/* 176 */
690 	NOSYS,					/* 177 */
691 	NOSYS,					/* 178 */
692 	NOSYS,					/* 179 */
693 	NOSYS,					/* 180 */
694 	NOSYS,					/* 181 */
695 	NOSYS,					/* 182 */
696 	NOSYS,					/* 183 */
697 	NOSYS,					/* 184 */
698 	NOSYS,					/* 185 */
699 	NOSYS,					/* 186 */
700 	NOSYS,					/* 187 */
701 	NOSYS,					/* 188 */
702 	NOSYS,					/* 189 */
703 	NOSYS,					/* 190 */
704 	NOSYS,					/* 191 */
705 	NOSYS,					/* 192 */
706 	NOSYS,					/* 193 */
707 	NOSYS,					/* 194 */
708 	NOSYS,					/* 195 */
709 	NOSYS,					/* 196 */
710 	NOSYS,					/* 197 */
711 	NOSYS,					/* 198 */
712 	NOSYS,					/* 199 */
713 	NOSYS,					/* 200 */
714 	NOSYS,					/* 201 */
715 	NOSYS,					/* 202 */
716 	NOSYS,					/* 203 */
717 	NOSYS,					/* 204 */
718 	NOSYS,					/* 205 */
719 	NOSYS,					/* 206 */
720 	NOSYS,					/* 207 */
721 	NOSYS,					/* 208 */
722 	NOSYS,					/* 209 */
723 	NOSYS,					/* 210 */
724 	NOSYS,					/* 211 */
725 	NOSYS,					/* 212 */
726 	NOSYS,					/* 213 */
727 	NOSYS,					/* 214 */
728 	NOSYS,					/* 215 */
729 	NOSYS,					/* 216 */
730 	NOSYS,					/* 217 */
731 	NOSYS,					/* 218 */
732 	NOSYS,					/* 219 */
733 	NOSYS,					/* 220 */
734 	NOSYS,					/* 221 */
735 	NOSYS,					/* 222 */
736 	NOSYS,					/* 223 */
737 	NOSYS,					/* 224 */
738 	NOSYS,					/* 225 */
739 	NOSYS,					/* 226 */
740 	NOSYS,					/* 227 */
741 	NOSYS,					/* 228 */
742 	NOSYS,					/* 229 */
743 	NOSYS,					/* 230 */
744 	NOSYS,					/* 231 */
745 	NOSYS,					/* 232 */
746 	NOSYS,					/* 233 */
747 	NOSYS,					/* 234 */
748 	NOSYS,					/* 235 */
749 	NOSYS,					/* 236 */
750 	NOSYS,					/* 237 */
751 	NOSYS,					/* 238 */
752 	NOSYS,					/* 239 */
753 	NOSYS,					/* 240 */
754 	NOSYS,					/* 241 */
755 	NOSYS,					/* 242 */
756 	NOSYS,					/* 243 */
757 	NOSYS,					/* 244 */
758 	NOSYS,					/* 245 */
759 	NOSYS,					/* 246 */
760 	NOSYS,					/* 247 */
761 	NOSYS,					/* 248 */
762 	NOSYS,					/* 249 */
763 	NOSYS,					/* 250 */
764 	NOSYS,					/* 251 */
765 	NOSYS,					/* 252 */
766 	NOSYS,					/* 253 */
767 	NOSYS,					/* 254 */
768 	NOSYS					/* 255 */
769 };
770