aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorBrandon L Black <blblack@gmail.com>2010-03-26 12:18:03 -0400
committerDavid S. Miller <davem@davemloft.net>2010-03-27 11:29:01 -0400
commit71c5c1595c04852d6fbf3c4882b47b30b61a4d32 (patch)
treed95c64c5b752d37e7d1235e52f0c1fceb816c2ec /net
parentf49c57e141c7f53353e4265a31dc2324e6215037 (diff)
net: Add MSG_WAITFORONE flag to recvmmsg
Add new flag MSG_WAITFORONE for the recvmmsg() syscall. When this flag is specified for a blocking socket, recvmmsg() will only block until at least 1 packet is available. The default behavior is to block until all vlen packets are available. This flag has no effect on non-blocking sockets or when used in combination with MSG_DONTWAIT. Signed-off-by: Brandon L Black <blblack@gmail.com> Acked-by: Ulrich Drepper <drepper@redhat.com> Acked-by: Eric Dumazet <eric.dumazet@gmail.com> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/socket.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c
index 769c386bd428..f55ffe9f8c87 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -2135,6 +2135,10 @@ int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen,
2135 break; 2135 break;
2136 ++datagrams; 2136 ++datagrams;
2137 2137
2138 /* MSG_WAITFORONE turns on MSG_DONTWAIT after one packet */
2139 if (flags & MSG_WAITFORONE)
2140 flags |= MSG_DONTWAIT;
2141
2138 if (timeout) { 2142 if (timeout) {
2139 ktime_get_ts(timeout); 2143 ktime_get_ts(timeout);
2140 *timeout = timespec_sub(end_time, *timeout); 2144 *timeout = timespec_sub(end_time, *timeout);