1 /* $NetBSD: linux32_socketcall.h,v 1.2 2007/12/04 18:40:19 dsl Exp $ */
4 * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed by Emmanuel Dreyfus
17 * 4. The name of the author may not be used to endorse or promote
18 * products derived from this software without specific prior written
21 * THIS SOFTWARE IS PROVIDED BY THE THE AUTHOR AND CONTRIBUTORS ``AS IS''
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
33 #ifndef _LINUX32_SOCKETCALL_H
34 #define _LINUX32_SOCKETCALL_H
36 #define LINUX32_MAX_SOCKETCALL 17
42 #define syscallarg(x) \
46 struct { x datum; } le; \
47 struct { /* LINTED zero array dimension */ \
48 int8_t pad[ /* CONSTCOND */ \
49 (sizeof (register32_t) < sizeof (x)) \
51 : sizeof (register32_t) - sizeof (x)]; \
56 struct linux32_sys_socket_args
{
57 syscallarg(int) domain
;
59 syscallarg(int) protocol
;
62 struct linux32_sys_socketpair_args
{
63 syscallarg(int) domain
;
65 syscallarg(int) protocol
;
66 syscallarg(netbsd32_intp
) rsv
;
69 struct linux32_sys_sendto_args
{
71 syscallarg(netbsd32_voidp
) msg
;
73 syscallarg(int) flags
;
74 syscallarg(netbsd32_sockaddrp_t
) to
;
75 syscallarg(int) tolen
;
78 struct linux32_sys_recvfrom_args
{
80 syscallarg(netbsd32_voidp
) buf
;
81 syscallarg(netbsd32_size_t
) len
;
82 syscallarg(int) flags
;
83 syscallarg(netbsd32_osockaddrp_t
) from
;
84 syscallarg(netbsd32_intp
) fromlenaddr
;
87 struct linux32_sys_setsockopt_args
{
89 syscallarg(int) level
;
90 syscallarg(int) optname
;
91 syscallarg(netbsd32_voidp
) optval
;
92 syscallarg(int) optlen
;
95 struct linux32_sys_getsockopt_args
{
97 syscallarg(int) level
;
98 syscallarg(int) optname
;
99 syscallarg(netbsd32_voidp
) optval
;
100 syscallarg(netbsd32_intp
) optlen
;
103 struct linux32_sys_bind_args
{
105 syscallarg(netbsd32_osockaddrp_t
) name
;
106 syscallarg(int) namelen
;
109 struct linux32_sys_connect_args
{
111 syscallarg(netbsd32_osockaddrp_t
) name
;
112 syscallarg(int) namelen
;
115 struct linux32_sys_accept_args
{
117 syscallarg(netbsd32_osockaddrp_t
) name
;
118 syscallarg(netbsd32_intp
) anamelen
;
121 struct linux32_sys_getsockname_args
{
122 syscallarg(int) fdec
;
123 syscallarg(netbsd32_charp
) asa
;
124 syscallarg(netbsd32_intp
) alen
;
127 struct linux32_sys_getpeername_args
{
128 syscallarg(int) fdes
;
129 syscallarg(netbsd32_sockaddrp_t
) asa
;
130 syscallarg(netbsd32_intp
) alen
;
133 struct linux32_sys_sendmsg_args
{
135 syscallarg(netbsd32_msghdrp_t
) msg
;
136 syscallarg(int) flags
;
139 struct linux32_sys_recvmsg_args
{
141 syscallarg(netbsd32_msghdrp_t
) msg
;
142 syscallarg(int) flags
;
145 struct linux32_sys_send_args
{
147 syscallarg(netbsd32_voidp
) buf
;
149 syscallarg(int) flags
;
152 struct linux32_sys_recv_args
{
154 syscallarg(netbsd32_voidp
) buf
;
156 syscallarg(int) flags
;
159 union linux32_socketcall_args
{
160 struct linux_sys_socket_args socket_args
;
161 struct linux32_sys_bind_args bind_args
;
162 struct linux32_sys_connect_args connect_args
;
163 struct sys_listen_args listen_args
;
164 struct linux32_sys_accept_args accept_args
;
165 struct linux32_sys_getsockname_args getsockname_args
;
166 struct linux32_sys_getpeername_args getpeername_args
;
167 struct linux32_sys_socketpair_args socketpair_args
;
168 struct linux32_sys_send_args send_args
;
169 struct linux32_sys_recv_args recv_args
;
170 struct linux32_sys_sendto_args sendto_args
;
171 struct linux32_sys_recvfrom_args recvfrom_args
;
172 struct sys_shutdown_args shutdown_args
;
173 struct linux32_sys_setsockopt_args setsockopt_args
;
174 struct linux32_sys_getsockopt_args getsockopt_args
;
175 struct linux32_sys_sendmsg_args sendmsg_args
;
176 struct linux32_sys_recvmsg_args recvmsg_args
;
181 #define SYS_DEF(foo) struct foo##_args; \
182 int foo(struct lwp *, const struct foo##_args *, register_t *)
183 SYS_DEF(linux32_sys_socketpair
);
184 SYS_DEF(linux32_sys_sendto
);
185 SYS_DEF(linux32_sys_recvfrom
);
186 SYS_DEF(linux32_sys_setsockopt
);
187 SYS_DEF(linux32_sys_getsockopt
);
188 SYS_DEF(linux32_sys_connect
);
189 SYS_DEF(linux32_sys_socket
);
190 SYS_DEF(linux32_sys_bind
);
191 SYS_DEF(linux32_sys_getsockname
);
192 SYS_DEF(linux32_sys_getpeername
);
193 SYS_DEF(linux32_sys_sendmsg
);
194 SYS_DEF(linux32_sys_recvmsg
);
195 SYS_DEF(linux32_sys_recv
);
196 SYS_DEF(linux32_sys_send
);
197 SYS_DEF(linux32_sys_accept
);
200 # endif /* !_KERNEL */
202 #endif /* !_LINUX32_SOCKETCALL_H */