handle accept4 for i386

This commit is contained in:
christos 2017-02-03 13:08:08 +00:00
parent d3c441585a
commit 7c6b0dd313
3 changed files with 21 additions and 9 deletions

View File

@ -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 <sys/cdefs.h>
__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

View File

@ -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 <sys/cdefs.h>
__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 <sys/param.h>
#include <sys/kernel.h>
@ -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;

View File

@ -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 */