Lines Matching refs:other

52  *		other the moment one end closes.
378 static int unix_dgram_peer_wake_connect(struct sock *sk, struct sock *other)
384 u_other = unix_sk(other);
389 u->peer_wake.private = other;
400 struct sock *other)
405 u_other = unix_sk(other);
408 if (u->peer_wake.private == other) {
417 struct sock *other)
419 unix_dgram_peer_wake_disconnect(sk, other);
427 * - unix_peer(sk) == other
430 static int unix_dgram_peer_wake_me(struct sock *sk, struct sock *other)
434 connected = unix_dgram_peer_wake_connect(sk, other);
436 /* If other is SOCK_DEAD, we want to make sure we signal
439 * to other and its full, we will hang waiting for POLLOUT.
441 if (unix_recvq_full_lockless(other) && !sock_flag(other, SOCK_DEAD))
445 unix_dgram_peer_wake_disconnect(sk, other);
475 static void unix_dgram_disconnected(struct sock *sk, struct sock *other)
485 if (!sock_flag(other, SOCK_DEAD) && unix_peer(other) == sk) {
486 other->sk_err = ECONNRESET;
487 other->sk_error_report(other);
1152 struct sock *other;
1171 other = unix_find_other(net, sunaddr, alen, sock->type, hash, &err);
1172 if (!other)
1175 unix_state_double_lock(sk, other);
1178 if (sock_flag(other, SOCK_DEAD)) {
1179 unix_state_double_unlock(sk, other);
1180 sock_put(other);
1185 if (!unix_may_send(sk, other))
1188 err = security_unix_may_send(sk->sk_socket, other->sk_socket);
1196 other = NULL;
1197 unix_state_double_lock(sk, other);
1205 unix_peer(sk) = other;
1208 unix_state_double_unlock(sk, other);
1210 if (other != old_peer)
1214 unix_peer(sk) = other;
1215 unix_state_double_unlock(sk, other);
1220 unix_state_double_unlock(sk, other);
1221 sock_put(other);
1226 static long unix_wait_for_peer(struct sock *other, long timeo)
1227 __releases(&unix_sk(other)->lock)
1229 struct unix_sock *u = unix_sk(other);
1235 sched = !sock_flag(other, SOCK_DEAD) &&
1236 !(other->sk_shutdown & RCV_SHUTDOWN) &&
1237 unix_recvq_full_lockless(other);
1239 unix_state_unlock(other);
1256 struct sock *other = NULL;
1293 other = unix_find_other(net, sunaddr, addr_len, sk->sk_type, hash, &err);
1294 if (!other)
1298 unix_state_lock(other);
1301 if (sock_flag(other, SOCK_DEAD)) {
1302 unix_state_unlock(other);
1303 sock_put(other);
1308 if (other->sk_state != TCP_LISTEN)
1310 if (other->sk_shutdown & RCV_SHUTDOWN)
1313 if (unix_recvq_full(other)) {
1318 timeo = unix_wait_for_peer(other, timeo);
1323 sock_put(other);
1333 state. other is TCP_LISTEN, if sk is TCP_LISTEN we
1357 unix_state_unlock(other);
1358 sock_put(other);
1362 err = security_unix_stream_connect(sk, other, newsk);
1377 otheru = unix_sk(other);
1404 copy_peercred(sk, other);
1416 spin_lock(&other->sk_receive_queue.lock);
1417 __skb_queue_tail(&other->sk_receive_queue, skb);
1418 spin_unlock(&other->sk_receive_queue.lock);
1419 unix_state_unlock(other);
1420 other->sk_data_ready(other);
1421 sock_put(other);
1425 if (other)
1426 unix_state_unlock(other);
1432 if (other)
1433 sock_put(other);
1608 const struct sock *other)
1611 !other->sk_socket ||
1612 test_bit(SOCK_PASSCRED, &other->sk_socket->flags);
1621 const struct sock *other)
1625 if (unix_passcred_enabled(sock, other)) {
1633 const struct sock *other)
1642 if (unix_passcred_enabled(socket, other)) {
1689 struct sock *other = NULL;
1716 other = unix_peer_get(sk);
1717 if (!other)
1758 if (!other) {
1763 other = unix_find_other(net, sunaddr, namelen, sk->sk_type,
1765 if (other == NULL)
1769 if (sk_filter(other, skb) < 0) {
1776 unix_state_lock(other);
1779 if (!unix_may_send(sk, other))
1782 if (unlikely(sock_flag(other, SOCK_DEAD))) {
1787 unix_state_unlock(other);
1788 sock_put(other);
1794 if (unix_peer(sk) == other) {
1796 unix_dgram_peer_wake_disconnect_wakeup(sk, other);
1800 unix_dgram_disconnected(sk, other);
1801 sock_put(other);
1807 other = NULL;
1814 if (other->sk_shutdown & RCV_SHUTDOWN)
1818 err = security_unix_may_send(sk->sk_socket, other->sk_socket);
1823 /* other == sk && unix_peer(other) != sk if
1827 if (other != sk &&
1828 unlikely(unix_peer(other) != sk &&
1829 unix_recvq_full_lockless(other))) {
1831 timeo = unix_wait_for_peer(other, timeo);
1841 unix_state_unlock(other);
1842 unix_state_double_lock(sk, other);
1845 if (unix_peer(sk) != other ||
1846 unix_dgram_peer_wake_me(sk, other)) {
1861 if (sock_flag(other, SOCK_RCVTSTAMP))
1863 maybe_add_creds(skb, sock, other);
1864 scm_stat_add(other, skb);
1865 skb_queue_tail(&other->sk_receive_queue, skb);
1866 unix_state_unlock(other);
1867 other->sk_data_ready(other);
1868 sock_put(other);
1875 unix_state_unlock(other);
1879 if (other)
1880 sock_put(other);
1894 struct sock *other = NULL;
1916 other = unix_peer(sk);
1917 if (!other)
1960 unix_state_lock(other);
1962 if (sock_flag(other, SOCK_DEAD) ||
1963 (other->sk_shutdown & RCV_SHUTDOWN))
1966 maybe_add_creds(skb, sock, other);
1967 scm_stat_add(other, skb);
1968 skb_queue_tail(&other->sk_receive_queue, skb);
1969 unix_state_unlock(other);
1970 other->sk_data_ready(other);
1979 unix_state_unlock(other);
1997 struct sock *other, *sk = socket->sk;
2003 other = unix_peer(sk);
2004 if (!other || sk->sk_state != TCP_ESTABLISHED)
2009 spin_unlock(&other->sk_receive_queue.lock);
2010 unix_state_unlock(other);
2011 mutex_unlock(&unix_sk(other)->iolock);
2021 err = mutex_lock_interruptible(&unix_sk(other)->iolock);
2033 unix_state_lock(other);
2035 if (sock_flag(other, SOCK_DEAD) ||
2036 other->sk_shutdown & RCV_SHUTDOWN) {
2043 err = maybe_init_creds(&scm, socket, other);
2049 spin_lock(&other->sk_receive_queue.lock);
2050 skb = skb_peek_tail(&other->sk_receive_queue);
2081 __skb_queue_tail(&other->sk_receive_queue, newskb);
2084 spin_unlock(&other->sk_receive_queue.lock);
2085 unix_state_unlock(other);
2086 mutex_unlock(&unix_sk(other)->iolock);
2088 other->sk_data_ready(other);
2093 unix_state_unlock(other);
2095 mutex_unlock(&unix_sk(other)->iolock);
2569 struct sock *other;
2582 other = unix_peer(sk);
2583 if (other)
2584 sock_hold(other);
2588 if (other &&
2597 unix_state_lock(other);
2598 WRITE_ONCE(other->sk_shutdown, other->sk_shutdown | peer_mode);
2599 unix_state_unlock(other);
2600 other->sk_state_change(other);
2602 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_HUP);
2604 sk_wake_async(other, SOCK_WAKE_WAITD, POLL_IN);
2606 if (other)
2607 sock_put(other);
2741 * we set writable also when the other side has shut down the
2753 struct sock *sk = sock->sk, *other;
2793 other = unix_peer(sk);
2794 if (other && unix_peer(other) != sk &&
2795 unix_recvq_full_lockless(other) &&
2796 unix_dgram_peer_wake_me(sk, other))
3004 /* Earlier than device_initcall() so that other drivers invoking