Lines Matching defs:sk

15 static int unix_msg_wait_data(struct sock *sk, struct sk_psock *psock,
19 struct unix_sock *u = unix_sk(sk);
22 if (sk->sk_shutdown & RCV_SHUTDOWN)
28 add_wait_queue(sk_sleep(sk), &wait);
29 sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk);
30 if (!unix_sk_has_data(sk, psock)) {
34 ret = unix_sk_has_data(sk, psock);
36 sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk);
37 remove_wait_queue(sk_sleep(sk), &wait);
41 static int __unix_recvmsg(struct sock *sk, struct msghdr *msg,
44 if (sk->sk_type == SOCK_DGRAM)
45 return __unix_dgram_recvmsg(sk, msg, len, flags);
47 return __unix_stream_recvmsg(sk, msg, len, flags);
50 static int unix_bpf_recvmsg(struct sock *sk, struct msghdr *msg,
53 struct unix_sock *u = unix_sk(sk);
60 psock = sk_psock_get(sk);
62 return __unix_recvmsg(sk, msg, len, flags);
65 if (!skb_queue_empty(&sk->sk_receive_queue) &&
68 sk_psock_put(sk, psock);
69 return __unix_recvmsg(sk, msg, len, flags);
73 copied = sk_msg_recvmsg(sk, psock, msg, len, flags);
78 timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);
79 data = unix_msg_wait_data(sk, psock, timeo);
84 sk_psock_put(sk, psock);
85 return __unix_recvmsg(sk, msg, len, flags);
90 sk_psock_put(sk, psock);
144 int unix_dgram_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore)
146 if (sk->sk_type != SOCK_DGRAM)
150 sk->sk_write_space = psock->saved_write_space;
151 sock_replace_proto(sk, psock->sk_proto);
156 sock_replace_proto(sk, &unix_dgram_bpf_prot);
160 int unix_stream_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore)
169 sk->sk_write_space = psock->saved_write_space;
170 sock_replace_proto(sk, psock->sk_proto);
183 sk_pair = unix_peer(sk);
189 sock_replace_proto(sk, &unix_stream_bpf_prot);