diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-10-13 02:40:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-13 02:40:10 -0400 |
commit | a2e2725541fad72416326798c2d7fa4dafb7d337 (patch) | |
tree | 6174be11da607e83eb8efb3775114ad4d6e0ca3a /include/net | |
parent | c05e85a06e376f6b6d59e71e5333d707e956d78b (diff) |
net: Introduce recvmmsg socket syscall
Meaning receive multiple messages, reducing the number of syscalls and
net stack entry/exit operations.
Next patches will introduce mechanisms where protocols that want to
optimize this operation will provide an unlocked_recvmsg operation.
This takes into account comments made by:
. Paul Moore: sock_recvmsg is called only for the first datagram,
sock_recvmsg_nosec is used for the rest.
. Caitlin Bestler: recvmmsg now has a struct timespec timeout, that
works in the same fashion as the ppoll one.
If the underlying protocol returns a datagram with MSG_OOB set, this
will make recvmmsg return right away with as many datagrams (+ the OOB
one) it has received so far.
. RĂ©mi Denis-Courmont & Steven Whitehouse: If we receive N < vlen
datagrams and then recvmsg returns an error, recvmmsg will return
the successfully received datagrams, store the error and return it
in the next call.
This paves the way for a subsequent optimization, sk_prot->unlocked_recvmsg,
where we will be able to acquire the lock only at batch start and end, not at
every underlying recvmsg call.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/compat.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/net/compat.h b/include/net/compat.h index 7c3002832d05..9679f05e9896 100644 --- a/include/net/compat.h +++ b/include/net/compat.h | |||
@@ -18,6 +18,11 @@ struct compat_msghdr { | |||
18 | compat_uint_t msg_flags; | 18 | compat_uint_t msg_flags; |
19 | }; | 19 | }; |
20 | 20 | ||
21 | struct compat_mmsghdr { | ||
22 | struct compat_msghdr msg_hdr; | ||
23 | compat_uint_t msg_len; | ||
24 | }; | ||
25 | |||
21 | struct compat_cmsghdr { | 26 | struct compat_cmsghdr { |
22 | compat_size_t cmsg_len; | 27 | compat_size_t cmsg_len; |
23 | compat_int_t cmsg_level; | 28 | compat_int_t cmsg_level; |
@@ -35,6 +40,9 @@ extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); | |||
35 | extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr *, int); | 40 | extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr *, int); |
36 | extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned); | 41 | extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned); |
37 | extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); | 42 | extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); |
43 | extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *, | ||
44 | unsigned, unsigned, | ||
45 | struct timespec __user *); | ||
38 | extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); | 46 | extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); |
39 | extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); | 47 | extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); |
40 | 48 | ||