xref: /titanic_41/usr/src/lib/libbc/libc/sys/common/syscall.c (revision 223f6c28404c8d330c123e98936160b8da9a26b2)
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 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #include <errno.h>
30 #include <stdio.h>
31 #include <stdarg.h>
32 #include <sys/syscall.h>
33 #include "xsyscall.h"
34 
35 /*
36  * Array of SVR4 system call numbers. The 4.1 numbers are mapped
37  * to their SVR4/5.0 equivalents before trapping into the kernel.
38  */
39 
40 int syscallnum[190] = {	SYS_syscall,	SYS_exit,	SYS_fork1,
41 	SYS_read,	SYS_write,	SYS_open,	SYS_close,
42         -1,		SYS_creat,	SYS_link,	SYS_unlink,
43 	-1,		SYS_chdir,	0,		SYS_mknod,
44         SYS_chmod,	SYS_lchown,	0,		0,
45         SYS_lseek,	SYS_getpid,	0,		0,
46 	0,		SYS_getuid,	0,		0,
47 	0,		0,		0,		0,
48 	0,		0,		SYS_access, 	0,
49 	0,		SYS_sync,	SYS_kill,	SYS_stat,
50 	0,		SYS_lstat,	SYS_dup,	SYS_pipe,
51 	0,		SYS_profil,	0,		0,
52 	SYS_getgid,	0,		0,		0,
53 	SYS_acct,	0,		-1,		SYS_ioctl,
54 	-1 /*reboot*/,	0,		SYS_symlink,	SYS_readlink,
55 	SYS_execve,	SYS_umask,	SYS_chroot,	SYS_fstat,
56 	0,		-1/*getpagesize*/,-1,		0,
57 	0,		0,		-1,		-1,
58 	SYS_mmap,	-1,		SYS_munmap,	SYS_mprotect,
59 	-1 /*advise*/,	SYS_vhangup,	0,		SYS_mincore,
60 	SYS_getgroups,	SYS_setgroups,	-1 /*getpgrp*/,	-1 /*setpgrp*/,
61 	SYS_setitimer,	0,		-1 /*swapon*/,	SYS_getitimer,
62 	-1/*gethostname*/,-1/*sethostname*/,-1/*getdtablesize*/,-1/*dup2*/,
63 	-1/*getdopt*/,	SYS_fcntl,	-1 /*select*/,	-1 /*setdopt*/,
64 	SYS_fdsync,	-1 /*setprio*/,	-1 /*socket*/,	-1 /*connect*/,
65 	-1 /*accept*/,	-1 /*getprio*/,	-1 /*send*/,	-1 /*recv*/,
66 	0,		-1 /*bind*/,	-1 /*setsockopt*/,-1 /*listen*/,
67 	0,		-1 /*sigvec*/,	-1 /*sigblock*/, -1 /*sigsetmask*/,
68 	-1 /*sigpause*/, -1 /*sigstack*/, -1 /*recvmsg*/, -1 /*sendmsg*/,
69 	-1 /*vtrace*/,	SYS_gettimeofday, -1 /*getrusage*/, -1 /*getsockopt*/,
70 	0,		SYS_readv,	SYS_writev,	-1 /*settimeofday*/,
71 	SYS_fchown,	SYS_fchmod,	-1 /*recvfrom*/, -1 /*setreuid*/,
72 	-1 /*getregid*/, SYS_rename,	-1 /*truncate*/, -1 /*ftruncate*/,
73 	-1 /*flock*/,	0,		-1 /*sendto*/,	-1 /*shutdown*/,
74 	-1 /*socketpair*/,SYS_mkdir,	SYS_rmdir,	SYS_utimes,
75 	0,		SYS_adjtime,	-1 /*getpeername*/,-1 /*gethostid*/,
76 	0,		SYS_getrlimit,	SYS_setrlimit,	-1 /*killpg*/,
77 	0,		0,		0,		-1/*getsockname*/,
78 	SYS_getmsg,	SYS_putmsg,	SYS_poll,	0,
79 	-1/*nfssvc*/,	-1 /*getdirentries*/, SYS_statfs, SYS_fstatfs,
80 	SYS_umount,	-1 /*async_daemmon*/ -1 /*getfh*/, -1/*getdomain*/,
81 	-1/*setdomain*/, 0,		-1 /*quotactl*/, -1 /*exportfs*/,
82 	SYS_mount,	-1/*ustat*/,	SYS_semsys,	SYS_msgsys,
83 	SYS_shmsys,	-1 /*auditsys*/, -1 /*rfsys*/,	SYS_getdents,
84 	-1 /*setsid*/,	SYS_fchdir,	SYS_fchroot,	-1 /*vpixsys*/,
85 	-1 /*aioread*/,	-1 /*aiowrite*/, -1 /*aiocancel*/, SYS_sigpending,
86 	0,		-1 /*setpgid*/, SYS_pathconf,	SYS_uname,
87 };
88 
89 int
90 syscall(int sysnum, ...)
91 {
92 	va_list ap;
93 	int i1, i2, i3, i4;
94 	char *c1, *c2, *c3, *c4;
95 	int	ret_val;
96 
97 	va_start(ap, sysnum);
98 	switch(sysnum) {
99 		case XSYS_read:
100 			i1 = va_arg(ap, int);
101 			c1 = va_arg(ap, char *);
102 			i2 = va_arg(ap, int);
103 			va_end(ap);
104 			return (bc_read(i1, c1, i2));
105 		case XSYS_write:
106 			i1 = va_arg(ap, int);
107 			c1 = va_arg(ap, char *);
108 			i2 = va_arg(ap, int);
109 			va_end(ap);
110 			return (bc_write(i1, c1, i2));
111 		case XSYS_readv:
112 			i1 = va_arg(ap, int);
113 			c1 = va_arg(ap, char *);
114 			i2 = va_arg(ap, int);
115 			va_end(ap);
116 			return (bc_readv(i1, c1, i2));
117 		case XSYS_writev:
118 			i1 = va_arg(ap, int);
119 			c1 = va_arg(ap, char *);
120 			i2 = va_arg(ap, int);
121 			va_end(ap);
122 			return (bc_writev(i1, c1, i2));
123 		case XSYS_open:
124 			c1 = va_arg(ap, char *);
125 			i1 = va_arg(ap, int);
126 			i2 = va_arg(ap, int);
127 			va_end(ap);
128 			if (i2)
129 				return (bc_open(c1, i1, i2));
130 			else
131 				return (bc_open(c1, i1));
132 		case XSYS_close:
133 			i1 = va_arg(ap, int);
134 			va_end(ap);
135 			return (bc_close(i1));
136 		case XSYS_fcntl:
137 			i1 = va_arg(ap, int);
138 			i2 = va_arg(ap, int);
139 			i3 = va_arg(ap, int);
140 			va_end(ap);
141 			return (bc_fcntl(i1, i2, i3));
142 		case XSYS_select:
143 			i1 = va_arg(ap, int);
144 			c1 = va_arg(ap, char *);
145 			c2 = va_arg(ap, char *);
146 			c3 = va_arg(ap, char *);
147 			c4 = va_arg(ap, char *);
148 			va_end(ap);
149 			return (_select(i1, c1, c2, c3, c4));
150 		case XSYS_ioctl :
151 			i1 = va_arg(ap, int);
152 			i2 = va_arg(ap, int);
153 			c1 = va_arg(ap, char *);
154 			va_end(ap);
155 			return (bc_ioctl(i1, i2, c1));
156 		case XSYS_stat:
157 			c1 = va_arg(ap, char *);
158 			c2 = va_arg(ap, char *);
159 			va_end(ap);
160 			return (bc_stat(c1, c2));
161 		case XSYS_lstat:
162 			c1 = va_arg(ap, char *);
163 			c2 = va_arg(ap, char *);
164 			va_end(ap);
165 			return (bc_lstat(c1, c2));
166 		case XSYS_fstat:
167 			i1 = va_arg(ap, int);
168 			c1 = va_arg(ap, char *);
169 			va_end(ap);
170 			return (bc_fstat(i1, c1));
171         	case XSYS_getdents:
172 			i1 = va_arg(ap, int);
173 			c1 = va_arg(ap, char *);
174 			i2 = va_arg(ap, int);
175 			va_end(ap);
176 			return (bc_getdents(i1, c1, i2));
177 		case XSYS_kill:
178 			i1 = va_arg(ap, int);
179 			i2 = va_arg(ap, int);
180 			va_end(ap);
181 			return (bc_kill(i1, i2));
182 		case XSYS_mount:
183 			c1 = va_arg(ap, char *);
184 			c2 = va_arg(ap, char *);
185 			i1 = va_arg(ap, int);
186 			c3 = va_arg(ap, char *);
187 			va_end(ap);
188 			return (mount(c1, c2, i1, c3));
189 		case XSYS_getrlimit:
190 			i1 = va_arg(ap, int);
191 			c1 = va_arg(ap, char *);
192 			va_end(ap);
193 			return (bc_getrlimit(i1, c1));
194 		case XSYS_setrlimit:
195 			i1 = va_arg(ap, int);
196 			c1 = va_arg(ap, char *);
197 			va_end(ap);
198 			return (bc_setrlimit(i1, c1));
199 		case XSYS_uname:
200 			c1 = va_arg(ap, char *);
201 			va_end(ap);
202 			return (bc_uname(c1));
203 		case XSYS_creat:
204 			c1 = va_arg(ap, char *);
205 			i1 = va_arg(ap, int);
206 			va_end(ap);
207 			return (creat(c1, i1));
208 		case XSYS_unmount:
209 			c1 = va_arg(ap, char *);
210 			va_end(ap);
211 			return (umount(c1));
212 		case XSYS_link:
213 			c1 = va_arg(ap, char *);
214 			c2 = va_arg(ap, char *);
215 			va_end(ap);
216 			return (link(c1, c2));
217 		case XSYS_unlink:
218 			c1 = va_arg(ap, char *);
219 			va_end(ap);
220 			return (unlink(c1));
221 		case XSYS_chdir:
222 			c1 = va_arg(ap, char *);
223 			va_end(ap);
224 			return (chdir(c1));
225 		case XSYS_mknod:
226 			c1 = va_arg(ap, char *);
227 			i1 = va_arg(ap, int);
228 			i2 = va_arg(ap, int);
229 			va_end(ap);
230 			return (mknod(c1, i1, i2));
231 		case XSYS_chmod:
232 			c1 = va_arg(ap, char *);
233 			i1 = va_arg(ap, int);
234 			va_end(ap);
235 			return (chmod(c1, i1));
236 		case XSYS_chown:
237 			c1 = va_arg(ap, char *);
238 			i1 = va_arg(ap, int);
239 			i2 = va_arg(ap, int);
240 			va_end(ap);
241 			return (chown(c1, i1, i2));
242 		case XSYS_lseek:
243 			i1 = va_arg(ap, int);
244 			i2 = va_arg(ap, int);
245 			i3 = va_arg(ap, int);
246 			va_end(ap);
247 			return (lseek(i1, i2, i3));
248 		case XSYS_access:
249 			c1 = va_arg(ap, char *);
250 			i1 = va_arg(ap, int);
251 			va_end(ap);
252 			return (access(c1, i1));
253         	case XSYS_dup:
254 			i1 = va_arg(ap, int);
255 			va_end(ap);
256 			return (dup(i1));
257 		case XSYS_dup2:
258 			i1 = va_arg(ap, int);
259 			i2 = va_arg(ap, int);
260 			va_end(ap);
261 			return (dup(i1, i2));
262 		case XSYS_pipe:
263 			c1 = (char *)va_arg(ap, int *);
264 			va_end(ap);
265 			return (pipe(c1));
266 		case XSYS_symlink:
267 			c1 = va_arg(ap, char *);
268 			c2 = va_arg(ap, char *);
269 			va_end(ap);
270 			return (symlink(c1, c2));
271 		case XSYS_readlink:
272 			c1 = va_arg(ap, char *);
273 			c2 = va_arg(ap, char *);
274 			i1 = va_arg(ap, int);
275 			va_end(ap);
276 			return (readlink(c1, c2, i1));
277 		case XSYS_execve:
278 			c1 = va_arg(ap, char *);
279 			c2 = (char *)va_arg(ap, char **);
280 			c3 = (char *)va_arg(ap, char **);
281 			va_end(ap);
282 			return (execve(c1, c2, c3));
283 		case XSYS_chroot:
284 			c1 = va_arg(ap, char *);
285 			va_end(ap);
286 			return (chroot(c1));
287 		case XSYS_getgroups:
288 			i1 = va_arg(ap, int);
289 			c1 = (char *)va_arg(ap, int *);
290 			va_end(ap);
291 			return (getgroups(i1, c1));
292 		case XSYS_setgroups:
293 			i1 = va_arg(ap, int);
294 			c1 = (char *)va_arg(ap, int *);
295 			va_end(ap);
296 			return (setgroups(i1, c1));
297 		case XSYS_fsync:
298 			i1 = va_arg(ap, int);
299 			va_end(ap);
300 			return (fsync(i1));
301 		case XSYS_gettimeofday:
302 			c1 = va_arg(ap, char *);
303 			c2 = va_arg(ap, char *);
304 			va_end(ap);
305 			return (gettimeofday(c1, c2));
306 		case XSYS_settimeofday:
307 			c1 = va_arg(ap, char *);
308 			c2 = va_arg(ap, char *);
309 			va_end(ap);
310 			return (settimeofday(c1, c2));
311 		case XSYS_rename:
312 			c1 = va_arg(ap, char *);
313 			c2 = va_arg(ap, char *);
314 			va_end(ap);
315 			return (rename(c1, c2));
316 		case XSYS_mkdir:
317 			c1 = va_arg(ap, char *);
318 			i1 = va_arg(ap, int);
319 			va_end(ap);
320 			return (mkdir(c1, i1));
321 		case XSYS_rmdir:
322 			c1 = va_arg(ap, char *);
323 			va_end(ap);
324 			return (rmdir(c1));
325         	case XSYS_statfs:
326 			c1 = va_arg(ap, char *);
327 			c2 = va_arg(ap, char *);
328 			va_end(ap);
329 			return (statfs(c1, c2));
330 		case XSYS_fstatfs:
331 			i1 = va_arg(ap, int);
332 			c1 = va_arg(ap, char *);
333 			va_end(ap);
334 			return (fstatfs(i1, c1));
335 		case XSYS_getpagesize:
336 			va_end(ap);
337 			return (getpagesize());
338 		case XSYS_gethostid:
339 			va_end(ap);
340 			return (gethostid());
341 		case XSYS_getdtablesize:
342 			va_end(ap);
343 			return (getdtablesize());
344 		case XSYS_pathconf:
345 			c1 = va_arg(ap, char *);
346 			i1 = va_arg(ap, int);
347 			va_end(ap);
348 			return (pathconf(c1, i1));
349 		case XSYS_gethostname:
350 			c1 = va_arg(ap, char *);
351 			i1 = va_arg(ap, int);
352 			va_end(ap);
353 			return (gethostname(c1, i1));
354 		case XSYS_sethostname:
355 			c1 = va_arg(ap, char *);
356 			i1 = va_arg(ap, int);
357 			va_end(ap);
358 			return (sethostname(c1, i1));
359 		case XSYS_setreuid:
360 			i1 = va_arg(ap, int);
361 			i2 = va_arg(ap, int);
362 			va_end(ap);
363 			return (setreuid(i1, i2));
364 		case XSYS_setregid:
365 			i1 = va_arg(ap, int);
366 			i2 = va_arg(ap, int);
367 			va_end(ap);
368 			return (setregid(i1, i2));
369 		case XSYS_getpriority:
370 			i1 = va_arg(ap, int);
371 			i2 = va_arg(ap, int);
372 			va_end(ap);
373 			return (getpriority(i1, i2));
374 		case XSYS_setpriority:
375 			i1 = va_arg(ap, int);
376 			i2 = va_arg(ap, int);
377 			i3 = va_arg(ap, int);
378 			va_end(ap);
379 			return (setpriority(i1, i2, i3));
380 		case XSYS_sigvec:
381 			i1 = va_arg(ap, int);
382 			c1 = va_arg(ap, char *);
383 			c2 = va_arg(ap, char *);
384 			va_end(ap);
385 			return (sigvec(i1, c1, c2));
386 		case XSYS_sigblock:
387 			i1 = va_arg(ap, int);
388 			va_end(ap);
389 			return (sigblock(i1));
390 		case XSYS_sigpending:
391 			c1 = va_arg(ap, char *);
392 			va_end(ap);
393 			return (sigpending(c1));
394 		case XSYS_sigsetmask:
395 			i1 = va_arg(ap, int);
396 			va_end(ap);
397 			return (sigsetmask(i1));
398 		case XSYS_sigpause:
399 			c1 = va_arg(ap, char *);
400 			va_end(ap);
401 			return (sigpause(c1));
402 		case XSYS_sigstack:
403 			c1 = va_arg(ap, char *);
404 			c2 = va_arg(ap, char *);
405 			va_end(ap);
406 			return (sigstack(c1, c2));
407 		case XSYS_truncate:
408 			c1 = va_arg(ap, char *);
409 			i1 = va_arg(ap, int);
410 			va_end(ap);
411 			return (truncate(c1, i1));
412 		case XSYS_ftruncate:
413 			i1 = va_arg(ap, int);
414 			i2 = va_arg(ap, int);
415 			va_end(ap);
416 			return (ftruncate(i1, i2));
417 		case XSYS_killpg:
418 			i1 = va_arg(ap, int);
419 			i2 = va_arg(ap, int);
420 			va_end(ap);
421 			return (killpg(i1, i2));
422 		case XSYS_setpgid:
423 			i1 = va_arg(ap, int);
424 			i2 = va_arg(ap, int);
425 			va_end(ap);
426 			return (setpgid(i1, i2));
427 		case XSYS_ptrace:
428 			i1 = va_arg(ap, int);
429 			i2 = va_arg(ap, int);
430 			i3 = va_arg(ap, int);
431 			c1 = va_arg(ap, char *);
432 			i4 = va_arg(ap, int);
433 			c2 = va_arg(ap, char *);
434 			va_end(ap);
435 			return (ptrace(i1, i2, i3, c1, i4, c2));
436 #ifdef S5EMUL
437 		case XSYS_getpgrp:
438 			va_end(ap);
439 			return (getpgrp());
440 		case XSYS_setpgrp:
441 			va_end(ap);
442 			return (setpgrp());
443 #else
444 		case XSYS_getpgrp:
445 			i1 = va_arg(ap, int);
446 			va_end(ap);
447 			return (getpgrp(i1));
448 		case XSYS_setpgrp:
449 			i1 = va_arg(ap, int);
450 			i2 = va_arg(ap, int);
451 			va_end(ap);
452 			return (setpgrp(i1, i2));
453 #endif
454 		case XSYS_getrusage:
455 			i1 = va_arg(ap, int);
456 			c1 = va_arg(ap, char *);
457 			va_end(ap);
458 			return (getrusage(i1, c1));
459 		case XSYS_setsid:
460 			va_end(ap);
461 			return (setsid());
462 
463 		case XSYS_flock:
464 			i1 = va_arg(ap, int);
465 			i2 = va_arg(ap, int);
466 			va_end(ap);
467 			return (flock(i1, i2));
468 
469 		/* the following system calls are now implemented in
470 		 * libsocket */
471 		case XSYS_accept:
472 			i1 = va_arg(ap, int);
473 			c1 = va_arg(ap, char *);
474 			c2 = (char *)va_arg(ap, int *);
475 			va_end(ap);
476 			return (_accept(i1, c1, c2));
477 		case XSYS_bind:
478 			i1 = va_arg(ap, int);
479 			c1 = va_arg(ap, char *);
480 			i2 = va_arg(ap, int);
481 			va_end(ap);
482 			return (_bind(i1, c1, i2));
483 		case XSYS_connect:
484 			i1 = va_arg(ap, int);
485 			c1 = va_arg(ap, char *);
486 			i2 = va_arg(ap, int);
487 			va_end(ap);
488 			return (_connect(i1, c1, i2));
489 		case XSYS_getsockopt:
490 			i1 = va_arg(ap, int);
491 			i2 = va_arg(ap, int);
492 			i3 = va_arg(ap, int);
493 			c1 = va_arg(ap, char *);
494 			c2 = va_arg(ap, char *);
495 			va_end(ap);
496 			return (_getsockopt(i1, i2, i3, c1, c2));
497 		case XSYS_getpeername:
498 			i1 = va_arg(ap, int);
499 			c1 = va_arg(ap, char *);
500 			c2 = va_arg(ap, char *);
501 			va_end(ap);
502 			return (_getpeername(i1, c1, c2));
503 		case XSYS_getsockname:
504 			i1 = va_arg(ap, int);
505 			c1 = va_arg(ap, char *);
506 			c2 = va_arg(ap, char *);
507 			va_end(ap);
508 			return (_getsockname(i1, c1, c2));
509 		case XSYS_getdomainname:
510 			c1 = va_arg(ap, char *);
511 			i1 = va_arg(ap, int);
512 			va_end(ap);
513 			return (getdomainname(c1, i1));
514 		case XSYS_listen:
515 			i1 = va_arg(ap, int);
516 			i2 = va_arg(ap, int);
517 			va_end(ap);
518 			return (_listen(i1, i2));
519 		case XSYS_recv:
520 			i1 = va_arg(ap, int);
521 			c1 = va_arg(ap, char *);
522 			i2 = va_arg(ap, int);
523 			i3 = va_arg(ap, int);
524 			va_end(ap);
525 			return (_recv(i1, c1, i2, i3));
526 		case XSYS_recvfrom:
527 			i1 = va_arg(ap, int);
528 			c1 = va_arg(ap, char *);
529 			i2 = va_arg(ap, int);
530 			i3 = va_arg(ap, int);
531 			c2 = va_arg(ap, char *);
532 			c3 = va_arg(ap, char *);
533 			va_end(ap);
534 			return (_recvfrom(i1, c1, i2, i3, c2, c3));
535 		case XSYS_recvmsg:
536 			i1 = va_arg(ap, int);
537 			c1 = va_arg(ap, char *);
538 			i2 = va_arg(ap, int);
539 			va_end(ap);
540 			return (_recvmsg(i1, c1, i2));
541 		case XSYS_send:
542 			i1 = va_arg(ap, int);
543 			c1 = va_arg(ap, char *);
544 			i2 = va_arg(ap, int);
545 			i3 = va_arg(ap, int);
546 			va_end(ap);
547 			return (_send(i1, c1, i2, i3));
548 		case XSYS_sendto:
549 			i1 = va_arg(ap, int);
550 			c1 = va_arg(ap, char *);
551 			i2 = va_arg(ap, int);
552 			i3 = va_arg(ap, int);
553 			c2 = va_arg(ap, char *);
554 			i4 = va_arg(ap, int);
555 			va_end(ap);
556 			return (_sendto(i1, c1, i2, i3, c2, i4));
557 		case XSYS_sendmsg:
558 			i1 = va_arg(ap, int);
559 			c1 = va_arg(ap, char *);
560 			i2 = va_arg(ap, int);
561 			va_end(ap);
562 			return (_sendmsg(i1, c1, i2));
563 		case XSYS_setdomainname:
564 			c1 = va_arg(ap, char *);
565 			i1 = va_arg(ap, int);
566 			va_end(ap);
567 			return (setdomainname(c1 ,i1));
568 		case XSYS_setsockopt:
569 			i1 = va_arg(ap, int);
570 			i2 = va_arg(ap, int);
571 			i3 = va_arg(ap, int);
572 			c1 = va_arg(ap, char *);
573 			i4 = va_arg(ap, int);
574 			va_end(ap);
575 			return (_setsockopt(i1, i2, i3, c1, i4));
576 		case XSYS_shutdown:
577 			i1 = va_arg(ap, int);
578 			i2 = va_arg(ap, int);
579 			va_end(ap);
580 			return (_shutdown(i1, i2));
581 		case XSYS_socket:
582 			i1 = va_arg(ap, int);
583 			i2 = va_arg(ap, int);
584 			i3 = va_arg(ap, int);
585 			va_end(ap);
586 			return (_socket(i1, i2, i3));
587 		case XSYS_socketpair:
588 			i1 = va_arg(ap, int);
589 			i2 = va_arg(ap, int);
590 			i3 = va_arg(ap, int);
591 			c1 = va_arg(ap, char *);
592 			va_end(ap);
593 			return (_socketpair(i1, i2, i3, c1));
594 
595 
596 		/* The following can directly go through syscall */
597 		case XSYS_acct:
598 		case XSYS_adjtime:
599 		case XSYS_exit:
600 		case XSYS_fchdir:
601 		case XSYS_fchmod:
602 		case XSYS_fchown:
603 		case XSYS_fchroot:
604 		case XSYS_fork:
605 		case XSYS_getgid:
606 		case XSYS_getitimer:
607 		case XSYS_getmsg:
608 		case XSYS_getpid:
609 		case XSYS_getuid:
610 		case XSYS_mincore:
611 		case XSYS_mprotect:
612 		case XSYS_munmap:
613 		case XSYS_putmsg:
614 		case XSYS_poll:
615 		case XSYS_profil:
616 		case XSYS_setitimer:
617 		case XSYS_sync:
618 		case XSYS_umask:
619 		case XSYS_utimes:
620 		case XSYS_semsys:
621 		case XSYS_msgsys:
622 		case XSYS_shmsys:
623 		case XSYS_mmap:
624 		case XSYS_vhangup:
625 			ret_val = _syscall(syscallnum[sysnum], ap);
626 			va_end(ap);
627 			return (ret_val);
628 
629 		case XSYS_aioread:
630 		case XSYS_aiowrite:
631 		case XSYS_aiocancel:
632 		case XSYS_swapon:
633 		case XSYS_async_daemon:
634 		case XSYS_getfh:
635 		case XSYS_nfssvc:
636 		case XSYS_exportfs:
637 		case XSYS_auditsys:
638         	case XSYS_vpixsys:
639 		case XSYS_quotactl:
640 		case XSYS_getdopt:
641 		case XSYS_setdopt:
642 		case XSYS_ustat:
643 		case XSYS_vtrace:
644 		case XSYS_reboot:
645 		case XSYS_madvise:
646 		case XSYS_vadvise:
647 		case XSYS_getdirentries:
648 			va_end(ap);
649 			fprintf(stderr,"system call not supported\n");
650 			return(-1);
651 	}
652 	va_end(ap);
653 	return (-1);
654 }
655