Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 144331
b: refs/heads/master
c: bf368e4
h: refs/heads/master
i:
  144329: 3085a9c
  144327: ab3afc0
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Apr 28, 2009
1 parent e0a9cfa commit 8c447e0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 37b607c5ac3b7c92a6a3624bb29f1cdcdcf7044a
refs/heads/master: bf368e4e70cd4e0f880923c44e95a4273d725ab4
6 changes: 4 additions & 2 deletions trunk/include/linux/wait.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,13 +440,15 @@ void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait,
int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);

#define DEFINE_WAIT(name) \
#define DEFINE_WAIT_FUNC(name, function) \
wait_queue_t name = { \
.private = current, \
.func = autoremove_wake_function, \
.func = function, \
.task_list = LIST_HEAD_INIT((name).task_list), \
}

#define DEFINE_WAIT(name) DEFINE_WAIT_FUNC(name, autoremove_wake_function)

#define DEFINE_WAIT_BIT(name, word, bit) \
struct wait_bit_queue name = { \
.key = __WAIT_BIT_KEY_INITIALIZER(word, bit), \
Expand Down
14 changes: 13 additions & 1 deletion trunk/net/core/datagram.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 8c447e0

Please sign in to comment.