Lines Matching full:other
57 * other the moment one end closes.
383 static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_connect() argument
389 u_other = unix_sk(other); in unix_dgram_peer_wake_connect()
394 u->peer_wake.private = other; in unix_dgram_peer_wake_connect()
405 struct sock *other) in unix_dgram_peer_wake_disconnect() argument
410 u_other = unix_sk(other); in unix_dgram_peer_wake_disconnect()
413 if (u->peer_wake.private == other) { in unix_dgram_peer_wake_disconnect()
422 struct sock *other) in unix_dgram_peer_wake_disconnect_wakeup() argument
424 unix_dgram_peer_wake_disconnect(sk, other); in unix_dgram_peer_wake_disconnect_wakeup()
432 * - unix_peer(sk) == other
435 static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_me() argument
439 connected = unix_dgram_peer_wake_connect(sk, other); in unix_dgram_peer_wake_me()
441 /* If other is SOCK_DEAD, we want to make sure we signal in unix_dgram_peer_wake_me()
444 * to other and its full, we will hang waiting for POLLOUT. in unix_dgram_peer_wake_me()
446 if (unix_recvq_full(other) && !sock_flag(other, SOCK_DEAD)) in unix_dgram_peer_wake_me()
450 unix_dgram_peer_wake_disconnect(sk, other); in unix_dgram_peer_wake_me()
480 static void unix_dgram_disconnected(struct sock *sk, struct sock *other) in unix_dgram_disconnected() argument
490 if (!sock_flag(other, SOCK_DEAD) && unix_peer(other) == sk) { in unix_dgram_disconnected()
491 other->sk_err = ECONNRESET; in unix_dgram_disconnected()
492 other->sk_error_report(other); in unix_dgram_disconnected()
1126 struct sock *other; in unix_dgram_connect() local
1145 other = unix_find_other(net, sunaddr, alen, sock->type, hash, &err); in unix_dgram_connect()
1146 if (!other) in unix_dgram_connect()
1149 unix_state_double_lock(sk, other); in unix_dgram_connect()
1152 if (sock_flag(other, SOCK_DEAD)) { in unix_dgram_connect()
1153 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1154 sock_put(other); in unix_dgram_connect()
1159 if (!unix_may_send(sk, other)) in unix_dgram_connect()
1162 err = security_unix_may_send(sk->sk_socket, other->sk_socket); in unix_dgram_connect()
1170 other = NULL; in unix_dgram_connect()
1171 unix_state_double_lock(sk, other); in unix_dgram_connect()
1179 unix_peer(sk) = other; in unix_dgram_connect()
1182 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1184 if (other != old_peer) in unix_dgram_connect()
1188 unix_peer(sk) = other; in unix_dgram_connect()
1189 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1194 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1195 sock_put(other); in unix_dgram_connect()
1200 static long unix_wait_for_peer(struct sock *other, long timeo) in unix_wait_for_peer() argument
1202 struct unix_sock *u = unix_sk(other); in unix_wait_for_peer()
1208 sched = !sock_flag(other, SOCK_DEAD) && in unix_wait_for_peer()
1209 !(other->sk_shutdown & RCV_SHUTDOWN) && in unix_wait_for_peer()
1210 unix_recvq_full(other); in unix_wait_for_peer()
1212 unix_state_unlock(other); in unix_wait_for_peer()
1229 struct sock *other = NULL; in unix_stream_connect() local
1266 other = unix_find_other(net, sunaddr, addr_len, sk->sk_type, hash, &err); in unix_stream_connect()
1267 if (!other) in unix_stream_connect()
1271 unix_state_lock(other); in unix_stream_connect()
1274 if (sock_flag(other, SOCK_DEAD)) { in unix_stream_connect()
1275 unix_state_unlock(other); in unix_stream_connect()
1276 sock_put(other); in unix_stream_connect()
1281 if (other->sk_state != TCP_LISTEN) in unix_stream_connect()
1283 if (other->sk_shutdown & RCV_SHUTDOWN) in unix_stream_connect()
1286 if (unix_recvq_full(other)) { in unix_stream_connect()
1291 timeo = unix_wait_for_peer(other, timeo); in unix_stream_connect()
1296 sock_put(other); in unix_stream_connect()
1306 state. other is TCP_LISTEN, if sk is TCP_LISTEN we in unix_stream_connect()
1330 unix_state_unlock(other); in unix_stream_connect()
1331 sock_put(other); in unix_stream_connect()
1335 err = security_unix_stream_connect(sk, other, newsk); in unix_stream_connect()
1350 otheru = unix_sk(other); in unix_stream_connect()
1377 copy_peercred(sk, other); in unix_stream_connect()
1389 spin_lock(&other->sk_receive_queue.lock); in unix_stream_connect()
1390 __skb_queue_tail(&other->sk_receive_queue, skb); in unix_stream_connect()
1391 spin_unlock(&other->sk_receive_queue.lock); in unix_stream_connect()
1392 unix_state_unlock(other); in unix_stream_connect()
1393 other->sk_data_ready(other); in unix_stream_connect()
1394 sock_put(other); in unix_stream_connect()
1398 if (other) in unix_stream_connect()
1399 unix_state_unlock(other); in unix_stream_connect()
1405 if (other) in unix_stream_connect()
1406 sock_put(other); in unix_stream_connect()
1595 const struct sock *other) in unix_passcred_enabled() argument
1598 !other->sk_socket || in unix_passcred_enabled()
1599 test_bit(SOCK_PASSCRED, &other->sk_socket->flags); in unix_passcred_enabled()
1608 const struct sock *other) in maybe_add_creds() argument
1612 if (unix_passcred_enabled(sock, other)) { in maybe_add_creds()
1620 const struct sock *other) in maybe_init_creds() argument
1629 if (unix_passcred_enabled(socket, other)) { in maybe_init_creds()
1658 struct sock *other = NULL; in unix_dgram_sendmsg() local
1685 other = unix_peer_get(sk); in unix_dgram_sendmsg()
1686 if (!other) in unix_dgram_sendmsg()
1727 if (!other) { in unix_dgram_sendmsg()
1732 other = unix_find_other(net, sunaddr, namelen, sk->sk_type, in unix_dgram_sendmsg()
1734 if (other == NULL) in unix_dgram_sendmsg()
1738 if (sk_filter(other, skb) < 0) { in unix_dgram_sendmsg()
1745 unix_state_lock(other); in unix_dgram_sendmsg()
1748 if (!unix_may_send(sk, other)) in unix_dgram_sendmsg()
1751 if (unlikely(sock_flag(other, SOCK_DEAD))) { in unix_dgram_sendmsg()
1756 unix_state_unlock(other); in unix_dgram_sendmsg()
1757 sock_put(other); in unix_dgram_sendmsg()
1763 if (unix_peer(sk) == other) { in unix_dgram_sendmsg()
1765 unix_dgram_peer_wake_disconnect_wakeup(sk, other); in unix_dgram_sendmsg()
1769 unix_dgram_disconnected(sk, other); in unix_dgram_sendmsg()
1770 sock_put(other); in unix_dgram_sendmsg()
1776 other = NULL; in unix_dgram_sendmsg()
1783 if (other->sk_shutdown & RCV_SHUTDOWN) in unix_dgram_sendmsg()
1787 err = security_unix_may_send(sk->sk_socket, other->sk_socket); in unix_dgram_sendmsg()
1792 /* other == sk && unix_peer(other) != sk if in unix_dgram_sendmsg()
1796 if (other != sk && in unix_dgram_sendmsg()
1797 unlikely(unix_peer(other) != sk && in unix_dgram_sendmsg()
1798 unix_recvq_full_lockless(other))) { in unix_dgram_sendmsg()
1800 timeo = unix_wait_for_peer(other, timeo); in unix_dgram_sendmsg()
1810 unix_state_unlock(other); in unix_dgram_sendmsg()
1811 unix_state_double_lock(sk, other); in unix_dgram_sendmsg()
1814 if (unix_peer(sk) != other || in unix_dgram_sendmsg()
1815 unix_dgram_peer_wake_me(sk, other)) { in unix_dgram_sendmsg()
1830 if (sock_flag(other, SOCK_RCVTSTAMP)) in unix_dgram_sendmsg()
1832 maybe_add_creds(skb, sock, other); in unix_dgram_sendmsg()
1833 skb_queue_tail(&other->sk_receive_queue, skb); in unix_dgram_sendmsg()
1834 unix_state_unlock(other); in unix_dgram_sendmsg()
1835 other->sk_data_ready(other); in unix_dgram_sendmsg()
1836 sock_put(other); in unix_dgram_sendmsg()
1843 unix_state_unlock(other); in unix_dgram_sendmsg()
1847 if (other) in unix_dgram_sendmsg()
1848 sock_put(other); in unix_dgram_sendmsg()
1862 struct sock *other = NULL; in unix_stream_sendmsg() local
1884 other = unix_peer(sk); in unix_stream_sendmsg()
1885 if (!other) in unix_stream_sendmsg()
1928 unix_state_lock(other); in unix_stream_sendmsg()
1930 if (sock_flag(other, SOCK_DEAD) || in unix_stream_sendmsg()
1931 (other->sk_shutdown & RCV_SHUTDOWN)) in unix_stream_sendmsg()
1934 maybe_add_creds(skb, sock, other); in unix_stream_sendmsg()
1935 skb_queue_tail(&other->sk_receive_queue, skb); in unix_stream_sendmsg()
1936 unix_state_unlock(other); in unix_stream_sendmsg()
1937 other->sk_data_ready(other); in unix_stream_sendmsg()
1946 unix_state_unlock(other); in unix_stream_sendmsg()
1964 struct sock *other, *sk = socket->sk; in unix_stream_sendpage() local
1970 other = unix_peer(sk); in unix_stream_sendpage()
1971 if (!other || sk->sk_state != TCP_ESTABLISHED) in unix_stream_sendpage()
1976 unix_state_unlock(other); in unix_stream_sendpage()
1977 mutex_unlock(&unix_sk(other)->iolock); in unix_stream_sendpage()
1987 err = mutex_lock_interruptible(&unix_sk(other)->iolock); in unix_stream_sendpage()
1999 unix_state_lock(other); in unix_stream_sendpage()
2001 if (sock_flag(other, SOCK_DEAD) || in unix_stream_sendpage()
2002 other->sk_shutdown & RCV_SHUTDOWN) { in unix_stream_sendpage()
2009 err = maybe_init_creds(&scm, socket, other); in unix_stream_sendpage()
2015 skb = skb_peek_tail(&other->sk_receive_queue); in unix_stream_sendpage()
2048 spin_lock(&other->sk_receive_queue.lock); in unix_stream_sendpage()
2049 __skb_queue_tail(&other->sk_receive_queue, newskb); in unix_stream_sendpage()
2050 spin_unlock(&other->sk_receive_queue.lock); in unix_stream_sendpage()
2053 unix_state_unlock(other); in unix_stream_sendpage()
2054 mutex_unlock(&unix_sk(other)->iolock); in unix_stream_sendpage()
2056 other->sk_data_ready(other); in unix_stream_sendpage()
2061 unix_state_unlock(other); in unix_stream_sendpage()
2063 mutex_unlock(&unix_sk(other)->iolock); in unix_stream_sendpage()
2531 struct sock *other; in unix_shutdown() local
2544 other = unix_peer(sk); in unix_shutdown()
2545 if (other) in unix_shutdown()
2546 sock_hold(other); in unix_shutdown()
2550 if (other && in unix_shutdown()
2559 unix_state_lock(other); in unix_shutdown()
2560 other->sk_shutdown |= peer_mode; in unix_shutdown()
2561 unix_state_unlock(other); in unix_shutdown()
2562 other->sk_state_change(other); in unix_shutdown()
2564 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_HUP); in unix_shutdown()
2566 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_IN); in unix_shutdown()
2568 if (other) in unix_shutdown()
2569 sock_put(other); in unix_shutdown()
2701 * we set writable also when the other side has shut down the in unix_poll()
2713 struct sock *sk = sock->sk, *other; in unix_dgram_poll() local
2751 other = unix_peer(sk); in unix_dgram_poll()
2752 if (other && unix_peer(other) != sk && in unix_dgram_poll()
2753 unix_recvq_full(other) && in unix_dgram_poll()
2754 unix_dgram_peer_wake_me(sk, other)) in unix_dgram_poll()
2962 /* Earlier than device_initcall() so that other drivers invoking