Lines Matching full:other

52  *		other the moment one end closes.
378 static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_connect() argument
384 u_other = unix_sk(other); in unix_dgram_peer_wake_connect()
389 u->peer_wake.private = other; in unix_dgram_peer_wake_connect()
400 struct sock *other) in unix_dgram_peer_wake_disconnect() argument
405 u_other = unix_sk(other); in unix_dgram_peer_wake_disconnect()
408 if (u->peer_wake.private == other) { in unix_dgram_peer_wake_disconnect()
417 struct sock *other) in unix_dgram_peer_wake_disconnect_wakeup() argument
419 unix_dgram_peer_wake_disconnect(sk, other); in unix_dgram_peer_wake_disconnect_wakeup()
427 * - unix_peer(sk) == other
430 static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other) in unix_dgram_peer_wake_me() argument
434 connected = unix_dgram_peer_wake_connect(sk, other); in unix_dgram_peer_wake_me()
436 /* If other is SOCK_DEAD, we want to make sure we signal in unix_dgram_peer_wake_me()
439 * to other and its full, we will hang waiting for POLLOUT. in unix_dgram_peer_wake_me()
441 if (unix_recvq_full(other) && !sock_flag(other, SOCK_DEAD)) in unix_dgram_peer_wake_me()
445 unix_dgram_peer_wake_disconnect(sk, other); in unix_dgram_peer_wake_me()
475 static void unix_dgram_disconnected(struct sock *sk, struct sock *other) in unix_dgram_disconnected() argument
485 if (!sock_flag(other, SOCK_DEAD) && unix_peer(other) == sk) { in unix_dgram_disconnected()
486 other->sk_err = ECONNRESET; in unix_dgram_disconnected()
487 other->sk_error_report(other); in unix_dgram_disconnected()
1131 struct sock *other; in unix_dgram_connect() local
1150 other = unix_find_other(net, sunaddr, alen, sock->type, hash, &err); in unix_dgram_connect()
1151 if (!other) in unix_dgram_connect()
1154 unix_state_double_lock(sk, other); in unix_dgram_connect()
1157 if (sock_flag(other, SOCK_DEAD)) { in unix_dgram_connect()
1158 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1159 sock_put(other); in unix_dgram_connect()
1164 if (!unix_may_send(sk, other)) in unix_dgram_connect()
1167 err = security_unix_may_send(sk->sk_socket, other->sk_socket); in unix_dgram_connect()
1175 other = NULL; in unix_dgram_connect()
1176 unix_state_double_lock(sk, other); in unix_dgram_connect()
1184 unix_peer(sk) = other; in unix_dgram_connect()
1187 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1189 if (other != old_peer) in unix_dgram_connect()
1193 unix_peer(sk) = other; in unix_dgram_connect()
1194 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1199 unix_state_double_unlock(sk, other); in unix_dgram_connect()
1200 sock_put(other); in unix_dgram_connect()
1205 static long unix_wait_for_peer(struct sock *other, long timeo) in unix_wait_for_peer() argument
1206 __releases(&unix_sk(other)->lock) in unix_wait_for_peer()
1208 struct unix_sock *u = unix_sk(other); in unix_wait_for_peer()
1214 sched = !sock_flag(other, SOCK_DEAD) && in unix_wait_for_peer()
1215 !(other->sk_shutdown & RCV_SHUTDOWN) && in unix_wait_for_peer()
1216 unix_recvq_full(other); in unix_wait_for_peer()
1218 unix_state_unlock(other); in unix_wait_for_peer()
1235 struct sock *other = NULL; in unix_stream_connect() local
1272 other = unix_find_other(net, sunaddr, addr_len, sk->sk_type, hash, &err); in unix_stream_connect()
1273 if (!other) in unix_stream_connect()
1277 unix_state_lock(other); in unix_stream_connect()
1280 if (sock_flag(other, SOCK_DEAD)) { in unix_stream_connect()
1281 unix_state_unlock(other); in unix_stream_connect()
1282 sock_put(other); in unix_stream_connect()
1287 if (other->sk_state != TCP_LISTEN) in unix_stream_connect()
1289 if (other->sk_shutdown & RCV_SHUTDOWN) in unix_stream_connect()
1292 if (unix_recvq_full(other)) { in unix_stream_connect()
1297 timeo = unix_wait_for_peer(other, timeo); in unix_stream_connect()
1302 sock_put(other); in unix_stream_connect()
1312 state. other is TCP_LISTEN, if sk is TCP_LISTEN we in unix_stream_connect()
1336 unix_state_unlock(other); in unix_stream_connect()
1337 sock_put(other); in unix_stream_connect()
1341 err = security_unix_stream_connect(sk, other, newsk); in unix_stream_connect()
1356 otheru = unix_sk(other); in unix_stream_connect()
1383 copy_peercred(sk, other); in unix_stream_connect()
1395 spin_lock(&other->sk_receive_queue.lock); in unix_stream_connect()
1396 __skb_queue_tail(&other->sk_receive_queue, skb); in unix_stream_connect()
1397 spin_unlock(&other->sk_receive_queue.lock); in unix_stream_connect()
1398 unix_state_unlock(other); in unix_stream_connect()
1399 other->sk_data_ready(other); in unix_stream_connect()
1400 sock_put(other); in unix_stream_connect()
1404 if (other) in unix_stream_connect()
1405 unix_state_unlock(other); in unix_stream_connect()
1411 if (other) in unix_stream_connect()
1412 sock_put(other); in unix_stream_connect()
1540 const struct sock *other) in unix_passcred_enabled() argument
1543 !other->sk_socket || in unix_passcred_enabled()
1544 test_bit(SOCK_PASSCRED, &other->sk_socket->flags); in unix_passcred_enabled()
1553 const struct sock *other) in maybe_add_creds() argument
1557 if (unix_passcred_enabled(sock, other)) { in maybe_add_creds()
1565 const struct sock *other) in maybe_init_creds() argument
1574 if (unix_passcred_enabled(socket, other)) { in maybe_init_creds()
1621 struct sock *other = NULL; in unix_dgram_sendmsg() local
1648 other = unix_peer_get(sk); in unix_dgram_sendmsg()
1649 if (!other) in unix_dgram_sendmsg()
1690 if (!other) { in unix_dgram_sendmsg()
1695 other = unix_find_other(net, sunaddr, namelen, sk->sk_type, in unix_dgram_sendmsg()
1697 if (other == NULL) in unix_dgram_sendmsg()
1701 if (sk_filter(other, skb) < 0) { in unix_dgram_sendmsg()
1708 unix_state_lock(other); in unix_dgram_sendmsg()
1711 if (!unix_may_send(sk, other)) in unix_dgram_sendmsg()
1714 if (unlikely(sock_flag(other, SOCK_DEAD))) { in unix_dgram_sendmsg()
1719 unix_state_unlock(other); in unix_dgram_sendmsg()
1720 sock_put(other); in unix_dgram_sendmsg()
1726 if (unix_peer(sk) == other) { in unix_dgram_sendmsg()
1728 unix_dgram_peer_wake_disconnect_wakeup(sk, other); in unix_dgram_sendmsg()
1732 unix_dgram_disconnected(sk, other); in unix_dgram_sendmsg()
1733 sock_put(other); in unix_dgram_sendmsg()
1739 other = NULL; in unix_dgram_sendmsg()
1746 if (other->sk_shutdown & RCV_SHUTDOWN) in unix_dgram_sendmsg()
1750 err = security_unix_may_send(sk->sk_socket, other->sk_socket); in unix_dgram_sendmsg()
1755 /* other == sk && unix_peer(other) != sk if in unix_dgram_sendmsg()
1759 if (other != sk && in unix_dgram_sendmsg()
1760 unlikely(unix_peer(other) != sk && in unix_dgram_sendmsg()
1761 unix_recvq_full_lockless(other))) { in unix_dgram_sendmsg()
1763 timeo = unix_wait_for_peer(other, timeo); in unix_dgram_sendmsg()
1773 unix_state_unlock(other); in unix_dgram_sendmsg()
1774 unix_state_double_lock(sk, other); in unix_dgram_sendmsg()
1777 if (unix_peer(sk) != other || in unix_dgram_sendmsg()
1778 unix_dgram_peer_wake_me(sk, other)) { in unix_dgram_sendmsg()
1793 if (sock_flag(other, SOCK_RCVTSTAMP)) in unix_dgram_sendmsg()
1795 maybe_add_creds(skb, sock, other); in unix_dgram_sendmsg()
1796 scm_stat_add(other, skb); in unix_dgram_sendmsg()
1797 skb_queue_tail(&other->sk_receive_queue, skb); in unix_dgram_sendmsg()
1798 unix_state_unlock(other); in unix_dgram_sendmsg()
1799 other->sk_data_ready(other); in unix_dgram_sendmsg()
1800 sock_put(other); in unix_dgram_sendmsg()
1807 unix_state_unlock(other); in unix_dgram_sendmsg()
1811 if (other) in unix_dgram_sendmsg()
1812 sock_put(other); in unix_dgram_sendmsg()
1826 struct sock *other = NULL; in unix_stream_sendmsg() local
1848 other = unix_peer(sk); in unix_stream_sendmsg()
1849 if (!other) in unix_stream_sendmsg()
1892 unix_state_lock(other); in unix_stream_sendmsg()
1894 if (sock_flag(other, SOCK_DEAD) || in unix_stream_sendmsg()
1895 (other->sk_shutdown & RCV_SHUTDOWN)) in unix_stream_sendmsg()
1898 maybe_add_creds(skb, sock, other); in unix_stream_sendmsg()
1899 scm_stat_add(other, skb); in unix_stream_sendmsg()
1900 skb_queue_tail(&other->sk_receive_queue, skb); in unix_stream_sendmsg()
1901 unix_state_unlock(other); in unix_stream_sendmsg()
1902 other->sk_data_ready(other); in unix_stream_sendmsg()
1911 unix_state_unlock(other); in unix_stream_sendmsg()
1929 struct sock *other, *sk = socket->sk; in unix_stream_sendpage() local
1935 other = unix_peer(sk); in unix_stream_sendpage()
1936 if (!other || sk->sk_state != TCP_ESTABLISHED) in unix_stream_sendpage()
1941 unix_state_unlock(other); in unix_stream_sendpage()
1942 mutex_unlock(&unix_sk(other)->iolock); in unix_stream_sendpage()
1952 err = mutex_lock_interruptible(&unix_sk(other)->iolock); in unix_stream_sendpage()
1964 unix_state_lock(other); in unix_stream_sendpage()
1966 if (sock_flag(other, SOCK_DEAD) || in unix_stream_sendpage()
1967 other->sk_shutdown & RCV_SHUTDOWN) { in unix_stream_sendpage()
1974 err = maybe_init_creds(&scm, socket, other); in unix_stream_sendpage()
1980 skb = skb_peek_tail(&other->sk_receive_queue); in unix_stream_sendpage()
2013 spin_lock(&other->sk_receive_queue.lock); in unix_stream_sendpage()
2014 __skb_queue_tail(&other->sk_receive_queue, newskb); in unix_stream_sendpage()
2015 spin_unlock(&other->sk_receive_queue.lock); in unix_stream_sendpage()
2018 unix_state_unlock(other); in unix_stream_sendpage()
2019 mutex_unlock(&unix_sk(other)->iolock); in unix_stream_sendpage()
2021 other->sk_data_ready(other); in unix_stream_sendpage()
2026 unix_state_unlock(other); in unix_stream_sendpage()
2028 mutex_unlock(&unix_sk(other)->iolock); in unix_stream_sendpage()
2502 struct sock *other; in unix_shutdown() local
2515 other = unix_peer(sk); in unix_shutdown()
2516 if (other) in unix_shutdown()
2517 sock_hold(other); in unix_shutdown()
2521 if (other && in unix_shutdown()
2530 unix_state_lock(other); in unix_shutdown()
2531 other->sk_shutdown |= peer_mode; in unix_shutdown()
2532 unix_state_unlock(other); in unix_shutdown()
2533 other->sk_state_change(other); in unix_shutdown()
2535 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_HUP); in unix_shutdown()
2537 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_IN); in unix_shutdown()
2539 if (other) in unix_shutdown()
2540 sock_put(other); in unix_shutdown()
2672 * we set writable also when the other side has shut down the in unix_poll()
2684 struct sock *sk = sock->sk, *other; in unix_dgram_poll() local
2722 other = unix_peer(sk); in unix_dgram_poll()
2723 if (other && unix_peer(other) != sk && in unix_dgram_poll()
2724 unix_recvq_full(other) && in unix_dgram_poll()
2725 unix_dgram_peer_wake_me(sk, other)) in unix_dgram_poll()
2933 /* Earlier than device_initcall() so that other drivers invoking