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