No empty .Rs/.Re
[netbsd-mini2440.git] / sys / compat / ibcs2 / ibcs2_socksys.c
blobc5303dbb195300e2e8c028351117750898ef1041
1 /* $NetBSD: ibcs2_socksys.c,v 1.18.8.1 2008/03/29 20:46:58 christos Exp $ */
3 /*
4 * Copyright (c) 1994, 1995 Scott Bartram
5 * Copyright (c) 1994 Arne H Juul
6 * All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #include <sys/cdefs.h>
29 __KERNEL_RCSID(0, "$NetBSD: ibcs2_socksys.c,v 1.18.8.1 2008/03/29 20:46:58 christos Exp $");
31 #include <sys/param.h>
32 #include <sys/systm.h>
33 #include <sys/proc.h>
34 #include <sys/file.h>
35 #include <sys/filedesc.h>
36 #include <sys/ioctl.h>
37 #include <sys/termios.h>
38 #include <sys/tty.h>
39 #include <sys/socket.h>
40 #include <sys/mount.h>
41 #include <net/if.h>
44 #include <sys/syscallargs.h>
46 #include <compat/ibcs2/ibcs2_socksys.h>
47 #include <compat/ibcs2/ibcs2_util.h>
50 * iBCS2 socksys calls.
53 int
54 ibcs2_socksys(struct lwp *l, const struct ibcs2_socksys_args *uap, register_t *retval)
56 int error;
57 int realargs[7]; /* 1 for command, 6 for recvfrom */
60 * SOCKET should only be legal on /dev/socksys.
61 * GETIPDOMAINNAME should only be legal on /dev/socksys ?
62 * The others are (and should be) only legal on sockets.
65 error = copyin(uap->argsp, (void *)realargs, sizeof(realargs));
66 if (error)
67 return error;
68 DPRINTF(("ibcs2_socksys: %08x %08x %08x %08x %08x %08x %08x\n",
69 realargs[0], realargs[1], realargs[2], realargs[3],
70 realargs[4], realargs[5], realargs[6]));
71 switch (realargs[0]) {
72 case SOCKSYS_ACCEPT:
73 return sys_accept(l, (const void *)(realargs + 1), retval);
74 case SOCKSYS_BIND:
75 return sys_bind(l, (const void *)(realargs + 1), retval);
76 case SOCKSYS_CONNECT:
77 return sys_connect(l, (const void *)(realargs + 1), retval);
78 case SOCKSYS_GETPEERNAME:
79 return sys_getpeername(l, (const void *)(realargs + 1), retval);
80 case SOCKSYS_GETSOCKNAME:
81 return sys_getsockname(l, (const void *)(realargs + 1), retval);
82 case SOCKSYS_GETSOCKOPT:
83 return sys_getsockopt(l, (const void *)(realargs + 1), retval);
84 case SOCKSYS_LISTEN:
85 return sys_listen(l, (const void *)(realargs + 1), retval);
86 case SOCKSYS_RECV:
87 realargs[5] = realargs[6] = 0;
88 /* FALLTHROUGH */
89 case SOCKSYS_RECVFROM:
90 return sys_recvfrom(l, (const void *)(realargs + 1), retval);
91 case SOCKSYS_SEND:
92 realargs[5] = realargs[6] = 0;
93 /* FALLTHROUGH */
94 case SOCKSYS_SENDTO:
95 return sys_sendto(l, (const void *)(realargs + 1), retval);
96 case SOCKSYS_SETSOCKOPT:
97 return sys_setsockopt(l, (const void *)(realargs + 1), retval);
98 case SOCKSYS_SHUTDOWN:
99 return sys_shutdown(l, (const void *)(realargs + 1), retval);
100 case SOCKSYS_SOCKET:
101 return compat_30_sys_socket(l, (const void *)(realargs + 1), retval);
102 case SOCKSYS_SELECT:
103 return compat_50_sys_select(l, (const void *)(realargs + 1), retval);
104 case SOCKSYS_GETIPDOMAIN:
105 return compat_09_sys_getdomainname(l, (const void *)(realargs + 1), retval);
106 case SOCKSYS_SETIPDOMAIN:
107 return compat_09_sys_setdomainname(l, (const void *)(realargs + 1), retval);
108 case SOCKSYS_ADJTIME:
109 return compat_50_sys_adjtime(l, (const void *)(realargs + 1), retval);
110 case SOCKSYS_SETREUID:
111 return sys_setreuid(l, (const void *)(realargs + 1), retval);
112 case SOCKSYS_SETREGID:
113 return sys_setregid(l, (const void *)(realargs + 1), retval);
114 case SOCKSYS_GETTIME:
115 return compat_50_sys_gettimeofday(l, (const void *)(realargs + 1), retval);
116 case SOCKSYS_SETTIME:
117 return compat_50_sys_settimeofday(l, (const void *)(realargs + 1), retval);
118 case SOCKSYS_GETITIMER:
119 return compat_50_sys_getitimer(l, (const void *)(realargs + 1), retval);
120 case SOCKSYS_SETITIMER:
121 return compat_50_sys_setitimer(l, (const void *)(realargs + 1), retval);
123 default:
124 printf("socksys unknown %08x %08x %08x %08x %08x %08x %08x\n",
125 realargs[0], realargs[1], realargs[2], realargs[3],
126 realargs[4], realargs[5], realargs[6]);
127 return EINVAL;
129 /* NOTREACHED */