From 7c6b0dd313d2f5d35ac39bf37be4ebadacdb8751 Mon Sep 17 00:00:00 2001 From: christos Date: Fri, 3 Feb 2017 13:08:08 +0000 Subject: [PATCH] handle accept4 for i386 --- sys/compat/linux/common/linux_socket.c | 7 ++----- sys/compat/linux/common/linux_socketcall.c | 8 ++++++-- sys/compat/linux/common/linux_socketcall.h | 15 +++++++++++++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/sys/compat/linux/common/linux_socket.c b/sys/compat/linux/common/linux_socket.c index 3dd1032cf267..3a23afd6d72b 100644 --- a/sys/compat/linux/common/linux_socket.c +++ b/sys/compat/linux/common/linux_socket.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_socket.c,v 1.135 2017/02/03 08:43:02 martin Exp $ */ +/* $NetBSD: linux_socket.c,v 1.136 2017/02/03 13:08:08 christos Exp $ */ /*- * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.135 2017/02/03 08:43:02 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.136 2017/02/03 13:08:08 christos Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -1708,7 +1708,6 @@ linux_sys_accept(struct lwp *l, const struct linux_sys_accept_args *uap, registe return (0); } -#ifndef __i386__ /* Linux/i386 does not have this syscall */ int linux_sys_accept4(struct lwp *l, const struct linux_sys_accept4_args *uap, register_t *retval) { @@ -1743,5 +1742,3 @@ linux_sys_accept4(struct lwp *l, const struct linux_sys_accept4_args *uap, regis return 0; } -#endif - diff --git a/sys/compat/linux/common/linux_socketcall.c b/sys/compat/linux/common/linux_socketcall.c index bf07defa14c0..c31d66144a76 100644 --- a/sys/compat/linux/common/linux_socketcall.c +++ b/sys/compat/linux/common/linux_socketcall.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_socketcall.c,v 1.45 2014/11/09 17:48:08 maxv Exp $ */ +/* $NetBSD: linux_socketcall.c,v 1.46 2017/02/03 13:08:08 christos Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.45 2014/11/09 17:48:08 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_socketcall.c,v 1.46 2017/02/03 13:08:08 christos Exp $"); #include #include @@ -107,6 +107,7 @@ static const struct { {L("getsockopt"),sizeof(struct linux_sys_getsockopt_args)}, /* 15 */ {L("sendmsg"), sizeof(struct linux_sys_sendmsg_args)}, /* 16 */ {L("recvmsg"), sizeof(struct linux_sys_recvmsg_args)}, /* 17 */ + {L("accept4"), sizeof(struct linux_sys_accept4_args)}, /* 18 */ #undef L }; @@ -215,6 +216,9 @@ linux_sys_socketcall(struct lwp *l, const struct linux_sys_socketcall_args *uap, case LINUX_SYS_RECVMSG: error = linux_sys_recvmsg(l, (void *)&lda, retval); break; + case LINUX_SYS_ACCEPT4: + error = linux_sys_accept4(l, (void *)&lda, retval); + break; default: error = ENOSYS; break; diff --git a/sys/compat/linux/common/linux_socketcall.h b/sys/compat/linux/common/linux_socketcall.h index ca07599a7dee..a722be206b09 100644 --- a/sys/compat/linux/common/linux_socketcall.h +++ b/sys/compat/linux/common/linux_socketcall.h @@ -1,4 +1,4 @@ -/* $NetBSD: linux_socketcall.h,v 1.17 2013/12/27 15:10:53 njoly Exp $ */ +/* $NetBSD: linux_socketcall.h,v 1.18 2017/02/03 13:08:08 christos Exp $ */ /*- * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. @@ -91,8 +91,11 @@ #define LINUX_SYS_GETSOCKOPT 15 #define LINUX_SYS_SENDMSG 16 #define LINUX_SYS_RECVMSG 17 +#define LINUX_SYS_ACCEPT4 18 +#define LINUX_SYS_RECVMMSG 19 +#define LINUX_SYS_SENDMMSG 20 -#define LINUX_MAX_SOCKETCALL 17 +#define LINUX_MAX_SOCKETCALL 18 /* no send/recv mmsg yet */ /* @@ -221,6 +224,13 @@ struct linux_sys_shutdown_args { syscallarg(int) how; }; +struct linux_sys_accept4_args { + syscallarg(int) s; + syscallarg(struct osockaddr *) name; + syscallarg(int *) anamelen; + syscallarg(int) flags; +}; + # ifdef _KERNEL __BEGIN_DECLS #define SYS_DEF(foo) int foo(struct lwp *, const struct foo##_args *, register_t *); @@ -239,6 +249,7 @@ SYS_DEF(linux_sys_recvmsg) SYS_DEF(linux_sys_recv) SYS_DEF(linux_sys_send) SYS_DEF(linux_sys_accept) +SYS_DEF(linux_sys_accept4) #undef SYS_DEF __END_DECLS # endif /* !_KERNEL */