af_unix.c (aef7b83c92dd0b7e994805440655d1d64147287b) af_unix.c (b03efcfb2180289718991bb984044ce6c5b7d1b0)
1/*
2 * NET4: Implementation of BSD Unix domain sockets.
3 *
4 * Authors: Alan Cox, <alan.cox@linux.org>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

--- 288 unchanged lines hidden (view full) ---

297}
298
299/* When dgram socket disconnects (or changes its peer), we clear its receive
300 * queue of packets arrived from previous peer. First, it allows to do
301 * flow control based only on wmem_alloc; second, sk connected to peer
302 * may receive messages only from that peer. */
303static void unix_dgram_disconnected(struct sock *sk, struct sock *other)
304{
1/*
2 * NET4: Implementation of BSD Unix domain sockets.
3 *
4 * Authors: Alan Cox, <alan.cox@linux.org>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version

--- 288 unchanged lines hidden (view full) ---

297}
298
299/* When dgram socket disconnects (or changes its peer), we clear its receive
300 * queue of packets arrived from previous peer. First, it allows to do
301 * flow control based only on wmem_alloc; second, sk connected to peer
302 * may receive messages only from that peer. */
303static void unix_dgram_disconnected(struct sock *sk, struct sock *other)
304{
305 if (skb_queue_len(&sk->sk_receive_queue)) {
305 if (!skb_queue_empty(&sk->sk_receive_queue)) {
306 skb_queue_purge(&sk->sk_receive_queue);
307 wake_up_interruptible_all(&unix_sk(sk)->peer_wait);
308
309 /* If one link of bidirectional dgram pipe is disconnected,
310 * we signal error. Messages are lost. Do not make this,
311 * when peer was not connected to us.
312 */
313 if (!sock_flag(other, SOCK_DEAD) && unix_peer(other) == sk) {

--- 1300 unchanged lines hidden (view full) ---

1614{
1615 DEFINE_WAIT(wait);
1616
1617 unix_state_rlock(sk);
1618
1619 for (;;) {
1620 prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
1621
306 skb_queue_purge(&sk->sk_receive_queue);
307 wake_up_interruptible_all(&unix_sk(sk)->peer_wait);
308
309 /* If one link of bidirectional dgram pipe is disconnected,
310 * we signal error. Messages are lost. Do not make this,
311 * when peer was not connected to us.
312 */
313 if (!sock_flag(other, SOCK_DEAD) && unix_peer(other) == sk) {

--- 1300 unchanged lines hidden (view full) ---

1614{
1615 DEFINE_WAIT(wait);
1616
1617 unix_state_rlock(sk);
1618
1619 for (;;) {
1620 prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
1621
1622 if (skb_queue_len(&sk->sk_receive_queue) ||
1622 if (!skb_queue_empty(&sk->sk_receive_queue) ||
1623 sk->sk_err ||
1624 (sk->sk_shutdown & RCV_SHUTDOWN) ||
1625 signal_pending(current) ||
1626 !timeo)
1627 break;
1628
1629 set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
1630 unix_state_runlock(sk);

--- 445 unchanged lines hidden ---
1623 sk->sk_err ||
1624 (sk->sk_shutdown & RCV_SHUTDOWN) ||
1625 signal_pending(current) ||
1626 !timeo)
1627 break;
1628
1629 set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags);
1630 unix_state_runlock(sk);

--- 445 unchanged lines hidden ---