Index: head/sys/compat/linux/linux_socket.h =================================================================== --- head/sys/compat/linux/linux_socket.h +++ head/sys/compat/linux/linux_socket.h @@ -116,6 +116,133 @@ uint32_t gid; }; +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) + +struct linux_sendto_args { + int s; + l_uintptr_t msg; + int len; + int flags; + l_uintptr_t to; + int tolen; +}; + +struct linux_socket_args { + int domain; + int type; + int protocol; +}; + +struct linux_bind_args { + int s; + l_uintptr_t name; + int namelen; +}; + +struct linux_connect_args { + int s; + l_uintptr_t name; + int namelen; +}; + +struct linux_listen_args { + int s; + int backlog; +}; + +struct linux_accept_args { + int s; + l_uintptr_t addr; + l_uintptr_t namelen; +}; + +struct linux_accept4_args { + int s; + l_uintptr_t addr; + l_uintptr_t namelen; + int flags; +}; + +struct linux_getsockname_args { + int s; + l_uintptr_t addr; + l_uintptr_t namelen; +}; + +struct linux_getpeername_args { + int s; + l_uintptr_t addr; + l_uintptr_t namelen; +}; + +struct linux_socketpair_args { + int domain; + int type; + int protocol; + l_uintptr_t rsv; +}; + +struct linux_recvfrom_args { + int s; + l_uintptr_t buf; + int len; + int flags; + l_uintptr_t from; + l_uintptr_t fromlen; +}; + +struct linux_sendmsg_args { + int s; + l_uintptr_t msg; + int flags; +}; + +struct linux_recvmsg_args { + int s; + l_uintptr_t msg; + int flags; +}; + +struct linux_shutdown_args { + int s; + int how; +}; + +struct linux_setsockopt_args { + int s; + int level; + int optname; + l_uintptr_t optval; + int optlen; +}; + +struct linux_getsockopt_args { + int s; + int level; + int optname; + l_uintptr_t optval; + l_uintptr_t optlen; +}; + +int linux_socket(struct thread *td, struct linux_socket_args *args); +int linux_bind(struct thread *td, struct linux_bind_args *args); +int linux_connect(struct thread *, struct linux_connect_args *); +int linux_listen(struct thread *td, struct linux_listen_args *args); +int linux_accept(struct thread *td, struct linux_accept_args *args); +int linux_accept4(struct thread *td, struct linux_accept4_args *args); +int linux_getsockname(struct thread *td, struct linux_getsockname_args *args); +int linux_getpeername(struct thread *td, struct linux_getpeername_args *args); +int linux_socketpair(struct thread *td, struct linux_socketpair_args *args); +int linux_sendto(struct thread *td, struct linux_sendto_args *args); +int linux_recvfrom(struct thread *td, struct linux_recvfrom_args *args); +int linux_sendmsg(struct thread *td, struct linux_sendmsg_args *args); +int linux_recvmsg(struct thread *td, struct linux_recvmsg_args *args); +int linux_shutdown(struct thread *td, struct linux_shutdown_args *args); +int linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args); +int linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args); + +#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ + /* Operations for socketcall */ #define LINUX_SOCKET 1 Index: head/sys/compat/linux/linux_socket.c =================================================================== --- head/sys/compat/linux/linux_socket.c +++ head/sys/compat/linux/linux_socket.c @@ -585,15 +585,6 @@ return (optval == 0); } -struct linux_sendto_args { - int s; - l_uintptr_t msg; - int len; - int flags; - l_uintptr_t to; - int tolen; -}; - /* * Updated sendto() when IP_HDRINCL is set: * tweak endian-dependent fields in the IP packet. @@ -645,13 +636,7 @@ return (error); } -struct linux_socket_args { - int domain; - int type; - int protocol; -}; - -static int +int linux_socket(struct thread *td, struct linux_socket_args *args) { struct socket_args /* { @@ -715,13 +700,7 @@ return (retval_socket); } -struct linux_bind_args { - int s; - l_uintptr_t name; - int namelen; -}; - -static int +int linux_bind(struct thread *td, struct linux_bind_args *args) { struct sockaddr *sa; @@ -739,13 +718,6 @@ return (error); } -struct linux_connect_args { - int s; - l_uintptr_t name; - int namelen; -}; -int linux_connect(struct thread *, struct linux_connect_args *); - int linux_connect(struct thread *td, struct linux_connect_args *args) { @@ -790,12 +762,7 @@ return (error); } -struct linux_listen_args { - int s; - int backlog; -}; - -static int +int linux_listen(struct thread *td, struct linux_listen_args *args) { struct listen_args /* { @@ -856,13 +823,7 @@ return (error); } -struct linux_accept_args { - int s; - l_uintptr_t addr; - l_uintptr_t namelen; -}; - -static int +int linux_accept(struct thread *td, struct linux_accept_args *args) { @@ -870,14 +831,7 @@ args->namelen, 0)); } -struct linux_accept4_args { - int s; - l_uintptr_t addr; - l_uintptr_t namelen; - int flags; -}; - -static int +int linux_accept4(struct thread *td, struct linux_accept4_args *args) { @@ -885,13 +839,7 @@ args->namelen, args->flags)); } -struct linux_getsockname_args { - int s; - l_uintptr_t addr; - l_uintptr_t namelen; -}; - -static int +int linux_getsockname(struct thread *td, struct linux_getsockname_args *args) { struct getsockname_args /* { @@ -915,13 +863,7 @@ return (0); } -struct linux_getpeername_args { - int s; - l_uintptr_t addr; - l_uintptr_t namelen; -}; - -static int +int linux_getpeername(struct thread *td, struct linux_getpeername_args *args) { struct getpeername_args /* { @@ -944,14 +886,7 @@ return (0); } -struct linux_socketpair_args { - int domain; - int type; - int protocol; - l_uintptr_t rsv; -}; - -static int +int linux_socketpair(struct thread *td, struct linux_socketpair_args *args) { struct socketpair_args /* { @@ -1007,6 +942,7 @@ return (error); } +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) struct linux_send_args { int s; l_uintptr_t msg; @@ -1062,8 +998,9 @@ bsd_args.fromlenaddr = 0; return (sys_recvfrom(td, &bsd_args)); } +#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */ -static int +int linux_sendto(struct thread *td, struct linux_sendto_args *args) { struct msghdr msg; @@ -1087,16 +1024,7 @@ return (error); } -struct linux_recvfrom_args { - int s; - l_uintptr_t buf; - int len; - int flags; - l_uintptr_t from; - l_uintptr_t fromlen; -}; - -static int +int linux_recvfrom(struct thread *td, struct linux_recvfrom_args *args) { struct recvfrom_args /* { @@ -1136,13 +1064,7 @@ return (0); } -struct linux_sendmsg_args { - int s; - l_uintptr_t msg; - int flags; -}; - -static int +int linux_sendmsg(struct thread *td, struct linux_sendmsg_args *args) { struct cmsghdr *cmsg; @@ -1279,13 +1201,7 @@ return (error); } -struct linux_recvmsg_args { - int s; - l_uintptr_t msg; - int flags; -}; - -static int +int linux_recvmsg(struct thread *td, struct linux_recvmsg_args *args) { struct cmsghdr *cm; @@ -1452,12 +1368,7 @@ return (error); } -struct linux_shutdown_args { - int s; - int how; -}; - -static int +int linux_shutdown(struct thread *td, struct linux_shutdown_args *args) { struct shutdown_args /* { @@ -1470,15 +1381,7 @@ return (sys_shutdown(td, &bsd_args)); } -struct linux_setsockopt_args { - int s; - int level; - int optname; - l_uintptr_t optval; - int optlen; -}; - -static int +int linux_setsockopt(struct thread *td, struct linux_setsockopt_args *args) { struct setsockopt_args /* { @@ -1543,15 +1446,7 @@ return (error); } -struct linux_getsockopt_args { - int s; - int level; - int optname; - l_uintptr_t optval; - l_uintptr_t optlen; -}; - -static int +int linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args) { struct getsockopt_args /* { @@ -1654,6 +1549,7 @@ #define LINUX_AL_SIZE sizeof(lxs_args) / sizeof(lxs_args[0]) - 1 +#if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32)) int linux_socketcall(struct thread *td, struct linux_socketcall_args *args) { @@ -1710,3 +1606,4 @@ uprintf("LINUX: 'socket' typ=%d not implemented\n", args->what); return (ENOSYS); } +#endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */