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