net: socket: add do_sys_recvmmsg() helper; remove in-kernel call to syscall

Using the net-internal helper do_sys_recvmmsg() allows us to avoid the
internal calls to the sys_getsockopt() syscall.

This patch is part of a series which removes in-kernel calls to syscalls.
On this basis, the syscall entry path can be streamlined. For details, see
http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net

Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
Dominik Brodowski 2018-03-13 20:44:21 +01:00
parent 13a2d70e2b
commit 1255e26906
1 changed files with 12 additions and 5 deletions

View File

@ -2445,9 +2445,9 @@ out_put:
return datagrams; return datagrams;
} }
SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg, static int do_sys_recvmmsg(int fd, struct mmsghdr __user *mmsg,
unsigned int, vlen, unsigned int, flags, unsigned int vlen, unsigned int flags,
struct timespec __user *, timeout) struct timespec __user *timeout)
{ {
int datagrams; int datagrams;
struct timespec timeout_sys; struct timespec timeout_sys;
@ -2470,6 +2470,13 @@ SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg,
return datagrams; return datagrams;
} }
SYSCALL_DEFINE5(recvmmsg, int, fd, struct mmsghdr __user *, mmsg,
unsigned int, vlen, unsigned int, flags,
struct timespec __user *, timeout)
{
return do_sys_recvmmsg(fd, mmsg, vlen, flags, timeout);
}
#ifdef __ARCH_WANT_SYS_SOCKETCALL #ifdef __ARCH_WANT_SYS_SOCKETCALL
/* Argument list sizes for sys_socketcall */ /* Argument list sizes for sys_socketcall */
#define AL(x) ((x) * sizeof(unsigned long)) #define AL(x) ((x) * sizeof(unsigned long))
@ -2582,8 +2589,8 @@ SYSCALL_DEFINE2(socketcall, int, call, unsigned long __user *, args)
err = sys_recvmsg(a0, (struct user_msghdr __user *)a1, a[2]); err = sys_recvmsg(a0, (struct user_msghdr __user *)a1, a[2]);
break; break;
case SYS_RECVMMSG: case SYS_RECVMMSG:
err = sys_recvmmsg(a0, (struct mmsghdr __user *)a1, a[2], a[3], err = do_sys_recvmmsg(a0, (struct mmsghdr __user *)a1, a[2],
(struct timespec __user *)a[4]); a[3], (struct timespec __user *)a[4]);
break; break;
case SYS_ACCEPT4: case SYS_ACCEPT4:
err = __sys_accept4(a0, (struct sockaddr __user *)a1, err = __sys_accept4(a0, (struct sockaddr __user *)a1,