aboutsummaryrefslogtreecommitdiff
path: root/net/core
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-04-29 20:30:35 -0700
committerDavid S. Miller <davem@davemloft.net>2009-04-29 20:30:35 -0700
commitaba7453037c3a90714caae77a622dceaf1173786 (patch)
treebf07f9f432b0d8e9db9486f1f32ad065c0aa7c5c /net/core
parenta4fe91ee711f4e955ea85ab05b092cfe384b073e (diff)
parent93af7aca44f0e82e67bda10a0fb73d383edcc8bd (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: Documentation/isdn/00-INDEX drivers/net/wireless/iwlwifi/iwl-scan.c drivers/net/wireless/rndis_wlan.c net/mac80211/main.c
Diffstat (limited to 'net/core')
-rw-r--r--net/core/datagram.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/net/core/datagram.c b/net/core/datagram.c
index 914d5fa773b..22ea437c502 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -64,13 +64,25 @@ static inline int connection_based(struct sock *sk)
return sk->sk_type == SOCK_SEQPACKET || sk->sk_type == SOCK_STREAM;
}
+static int receiver_wake_function(wait_queue_t *wait, unsigned mode, int sync,
+ void *key)
+{
+ unsigned long bits = (unsigned long)key;
+
+ /*
+ * Avoid a wakeup if event not interesting for us
+ */
+ if (bits && !(bits & (POLLIN | POLLERR)))
+ return 0;
+ return autoremove_wake_function(wait, mode, sync, key);
+}
/*
* Wait for a packet..
*/
static int wait_for_packet(struct sock *sk, int *err, long *timeo_p)
{
int error;
- DEFINE_WAIT(wait);
+ DEFINE_WAIT_FUNC(wait, receiver_wake_function);
prepare_to_wait_exclusive(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);