Sync usage with man page.
[netbsd-mini2440.git] / sys / compat / linux / common / linux_socketcall.h
blob31e4d7baf0d321781d19de1017f8ab9f448f055f
1 /* $NetBSD: linux_socketcall.h,v 1.15 2008/04/28 20:23:44 martin Exp $ */
3 /*-
4 * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Frank van der Linden and Eric Haszlakiewicz.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
33 * Copyright (c) 1995 Frank van der Linden
34 * All rights reserved.
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 * 3. All advertising materials mentioning features or use of this software
45 * must display the following acknowledgement:
46 * This product includes software developed for the NetBSD Project
47 * by Frank van der Linden
48 * 4. The name of the author may not be used to endorse or promote products
49 * derived from this software without specific prior written permission
51 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
52 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
53 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
54 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
55 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
56 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
60 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 #ifndef _LINUX_SOCKETCALL_H
64 #define _LINUX_SOCKETCALL_H
66 /* Alpha does not use the socketcall multiplexer */
67 #if !defined(__alpha__) && !defined(__amd64__) && !defined(COMPAT_LINUX32)
68 /* Used on: arm, i386, m68k, mips, ppc, sparc, sparc64 */
69 /* Used for COMPAT_LINUX32 on amd64 */
70 /* Not used on: alpha */
73 * Values passed to the Linux socketcall() syscall, determining the actual
74 * action to take.
77 #define LINUX_SYS_socket 1
78 #define LINUX_SYS_bind 2
79 #define LINUX_SYS_connect 3
80 #define LINUX_SYS_listen 4
81 #define LINUX_SYS_accept 5
82 #define LINUX_SYS_getsockname 6
83 #define LINUX_SYS_getpeername 7
84 #define LINUX_SYS_socketpair 8
85 #define LINUX_SYS_send 9
86 #define LINUX_SYS_recv 10
87 #define LINUX_SYS_sendto 11
88 #define LINUX_SYS_recvfrom 12
89 #define LINUX_SYS_shutdown 13
90 #define LINUX_SYS_setsockopt 14
91 #define LINUX_SYS_getsockopt 15
92 #define LINUX_SYS_sendmsg 16
93 #define LINUX_SYS_recvmsg 17
95 #define LINUX_MAX_SOCKETCALL 17
99 * Structures for the arguments of the different system calls. This looks
100 * a little better than copyin() of all values one by one.
103 /* !!!: This should be at least as large as any other struct here. */
104 struct linux_socketcall_dummy_args {
105 int dummy_ints[4]; /* Max 4 ints */
106 void *dummy_ptrs[3]; /* Max 3 pointers */
109 struct linux_sys_socket_args {
110 syscallarg(int) domain;
111 syscallarg(int) type;
112 syscallarg(int) protocol;
115 struct linux_sys_socketpair_args {
116 syscallarg(int) domain;
117 syscallarg(int) type;
118 syscallarg(int) protocol;
119 syscallarg(int *) rsv;
122 struct linux_sys_sendto_args {
123 syscallarg(int) s;
124 syscallarg(void *) msg;
125 syscallarg(int) len;
126 syscallarg(int) flags;
127 syscallarg(struct osockaddr *) to;
128 syscallarg(int) tolen;
131 struct linux_sys_recvfrom_args {
132 syscallarg(int) s;
133 syscallarg(void *) buf;
134 syscallarg(int) len;
135 syscallarg(int) flags;
136 syscallarg(struct osockaddr *) from;
137 syscallarg(int *) fromlenaddr;
140 struct linux_sys_setsockopt_args {
141 syscallarg(int) s;
142 syscallarg(int) level;
143 syscallarg(int) optname;
144 syscallarg(void *) optval;
145 syscallarg(int) optlen;
148 struct linux_sys_getsockopt_args {
149 syscallarg(int) s;
150 syscallarg(int) level;
151 syscallarg(int) optname;
152 syscallarg(void *) optval;
153 syscallarg(int *) optlen;
156 struct linux_sys_bind_args {
157 syscallarg(int) s;
158 syscallarg(struct osockaddr *) name;
159 syscallarg(int) namelen;
162 struct linux_sys_connect_args {
163 syscallarg(int) s;
164 syscallarg(struct osockaddr *) name;
165 syscallarg(int) namelen;
168 struct linux_sys_accept_args {
169 syscallarg(int) s;
170 syscallarg(struct osockaddr *) name;
171 syscallarg(int *) anamelen;
174 struct linux_sys_getsockname_args {
175 syscallarg(int) fdes;
176 syscallarg(struct osockaddr *) asa;
177 syscallarg(int *) alen;
180 struct linux_sys_getpeername_args {
181 syscallarg(int) fdes;
182 syscallarg(struct osockaddr *) asa;
183 syscallarg(int *) alen;
186 struct linux_sys_sendmsg_args {
187 syscallarg(int) s;
188 syscallarg(struct linux_msghdr *) msg;
189 syscallarg(u_int) flags;
192 struct linux_sys_recvmsg_args {
193 syscallarg(int) s;
194 syscallarg(struct linux_msghdr *) msg;
195 syscallarg(u_int) flags;
198 struct linux_sys_send_args {
199 syscallarg(int) s;
200 syscallarg(void *) buf;
201 syscallarg(int) len;
202 syscallarg(int) flags;
205 struct linux_sys_recv_args {
206 syscallarg(int) s;
207 syscallarg(void *) buf;
208 syscallarg(int) len;
209 syscallarg(int) flags;
212 /* These are only used for their size: */
214 struct linux_sys_listen_args {
215 syscallarg(int) s;
216 syscallarg(int) backlog;
219 struct linux_sys_shutdown_args {
220 syscallarg(int) s;
221 syscallarg(int) how;
224 # ifdef _KERNEL
225 __BEGIN_DECLS
226 #define SYS_DEF(foo) int foo(struct lwp *, const struct foo##_args *, register_t *);
227 SYS_DEF(linux_sys_socket)
228 SYS_DEF(linux_sys_socketpair)
229 SYS_DEF(linux_sys_sendto)
230 SYS_DEF(linux_sys_recvfrom)
231 SYS_DEF(linux_sys_setsockopt)
232 SYS_DEF(linux_sys_getsockopt)
233 SYS_DEF(linux_sys_connect)
234 SYS_DEF(linux_sys_bind)
235 SYS_DEF(linux_sys_getsockname)
236 SYS_DEF(linux_sys_getpeername)
237 SYS_DEF(linux_sys_sendmsg)
238 SYS_DEF(linux_sys_recvmsg)
239 SYS_DEF(linux_sys_recv)
240 SYS_DEF(linux_sys_send)
241 SYS_DEF(linux_sys_accept)
242 #undef SYS_DEF
243 __END_DECLS
244 # endif /* !_KERNEL */
246 # endif
248 #endif /* !_LINUX_SOCKETCALL_H */