xref: /netbsd-src/sys/compat/linux/common/linux_socketcall.h (revision 2a399c6883d870daece976daec6ffa7bb7f934ce)
1 /*	$NetBSD: linux_socketcall.h,v 1.1 1995/02/28 23:26:05 fvdl Exp $	*/
2 
3 /*
4  * Copyright (c) 1995 Frank van der Linden
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *      This product includes software developed for the NetBSD Project
18  *      by Frank van der Linden
19  * 4. The name of the author may not be used to endorse or promote products
20  *    derived from this software without specific prior written permission
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef _LINUX_SOCKETCALL_H
35 #define _LINUX_SOCKETCALL_H
36 
37 /*
38  * Values passed to the Linux socketcall() syscall, determining the actual
39  * action to take.
40  */
41 #define LINUX_SYS_socket	1
42 #define LINUX_SYS_bind		2
43 #define LINUX_SYS_connect	3
44 #define LINUX_SYS_listen	4
45 #define LINUX_SYS_accept	5
46 #define LINUX_SYS_getsockname	6
47 #define LINUX_SYS_getpeername	7
48 #define LINUX_SYS_socketpair	8
49 #define LINUX_SYS_send		9
50 #define LINUX_SYS_recv		10
51 #define LINUX_SYS_sendto	11
52 #define LINUX_SYS_recvfrom	12
53 #define LINUX_SYS_shutdown	13
54 #define LINUX_SYS_setsockopt	14
55 #define LINUX_SYS_getsockopt	15
56 
57 /*
58  * Structures for the arguments of the different system calls. This looks
59  * a little better than copyin() of all values one by one.
60  */
61 struct linux_socket_args {
62 	int domain;
63 	int type;
64 	int protocol;
65 };
66 
67 struct linux_bind_args {
68 	int s;
69 	struct sockaddr *name;
70 	int namelen;
71 };
72 
73 struct linux_connect_args {
74 	int s;
75 	struct sockaddr *name;
76 	int namelen;
77 };
78 
79 struct linux_listen_args {
80 	int s;
81 	int backlog;
82 };
83 
84 struct linux_accept_args {
85 	int s;
86 	struct sockaddr *addr;
87 	int *namelen;
88 };
89 
90 struct linux_getsockname_args {
91 	int s;
92 	struct sockaddr *addr;
93 	int *namelen;
94 };
95 
96 struct linux_getpeername_args {
97 	int s;
98 	struct sockaddr *addr;
99 	int *namelen;
100 };
101 
102 struct linux_socketpair_args {
103 	int domain;
104 	int type;
105 	int protocol;
106 	int *rsv;
107 };
108 
109 struct linux_send_args {
110 	int s;
111 	void *msg;
112 	int len;
113 	int flags;
114 };
115 
116 struct linux_recv_args {
117 	int s;
118 	void *msg;
119 	int len;
120 	int flags;
121 };
122 
123 struct linux_sendto_args {
124 	int s;
125 	void *msg;
126 	int len;
127 	int flags;
128 	struct sockaddr *to;
129 	int tolen;
130 };
131 
132 struct linux_recvfrom_args {
133 	int s;
134 	void *buf;
135 	int len;
136 	int flags;
137 	struct sockaddr *from;
138 	int *fromlen;
139 };
140 
141 struct linux_shutdown_args {
142 	int s;
143 	int how;
144 };
145 
146 struct linux_getsockopt_args {
147 	int s;
148 	int level;
149 	int optname;
150 	void *optval;
151 	int *optlen;
152 };
153 
154 struct linux_setsockopt_args {
155 	int s;
156 	int level;
157 	int optname;
158 	void *optval;
159 	int optlen;
160 };
161 
162 #endif /* _LINUX_SOCKETCALL_H */
163