Lines Matching +full:wait +full:- +full:queue
1 // SPDX-License-Identifier: GPL-2.0
6 * protocols. Even IP. Tonight 8-).
13 * Alan Cox <alan@lxorguk.ukuu.org.uk> (Borrowed comments 8-))
21 #include <linux/wait.h>
25 * sk_stream_write_space - stream socket write_space callback.
32 struct socket *sock = sk->sk_socket; in sk_stream_write_space()
36 clear_bit(SOCK_NOSPACE, &sock->flags); in sk_stream_write_space()
39 wq = rcu_dereference(sk->sk_wq); in sk_stream_write_space()
41 wake_up_interruptible_poll(&wq->wait, EPOLLOUT | in sk_stream_write_space()
43 if (wq && wq->fasync_list && !(sk->sk_shutdown & SEND_SHUTDOWN)) in sk_stream_write_space()
50 * sk_stream_wait_connect - Wait for a socket to get into the connected state
51 * @sk: sock to wait on
52 * @timeo_p: for how long to wait
58 DEFINE_WAIT_FUNC(wait, woken_wake_function); in sk_stream_wait_connect()
66 if ((1 << sk->sk_state) & ~(TCPF_SYN_SENT | TCPF_SYN_RECV)) in sk_stream_wait_connect()
67 return -EPIPE; in sk_stream_wait_connect()
69 return -EAGAIN; in sk_stream_wait_connect()
73 add_wait_queue(sk_sleep(sk), &wait); in sk_stream_wait_connect()
74 sk->sk_write_pending++; in sk_stream_wait_connect()
76 !READ_ONCE(sk->sk_err) && in sk_stream_wait_connect()
77 !((1 << READ_ONCE(sk->sk_state)) & in sk_stream_wait_connect()
78 ~(TCPF_ESTABLISHED | TCPF_CLOSE_WAIT)), &wait); in sk_stream_wait_connect()
79 remove_wait_queue(sk_sleep(sk), &wait); in sk_stream_wait_connect()
80 sk->sk_write_pending--; in sk_stream_wait_connect()
87 * sk_stream_closing - Return 1 if we still have things to send in our buffers.
92 return (1 << READ_ONCE(sk->sk_state)) & in sk_stream_closing()
99 DEFINE_WAIT_FUNC(wait, woken_wake_function); in sk_stream_wait_close()
101 add_wait_queue(sk_sleep(sk), &wait); in sk_stream_wait_close()
104 if (sk_wait_event(sk, &timeout, !sk_stream_closing(sk), &wait)) in sk_stream_wait_close()
108 remove_wait_queue(sk_sleep(sk), &wait); in sk_stream_wait_close()
114 * sk_stream_wait_memory - Wait for more memory for a socket
115 * @sk: socket to wait for memory
123 DEFINE_WAIT_FUNC(wait, woken_wake_function); in sk_stream_wait_memory()
128 add_wait_queue(sk_sleep(sk), &wait); in sk_stream_wait_memory()
133 if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN)) in sk_stream_wait_memory()
143 set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); in sk_stream_wait_memory()
144 sk->sk_write_pending++; in sk_stream_wait_memory()
145 ret = sk_wait_event(sk, ¤t_timeo, READ_ONCE(sk->sk_err) || in sk_stream_wait_memory()
146 (READ_ONCE(sk->sk_shutdown) & SEND_SHUTDOWN) || in sk_stream_wait_memory()
148 &wait); in sk_stream_wait_memory()
149 sk->sk_write_pending--; in sk_stream_wait_memory()
154 vm_wait -= current_timeo; in sk_stream_wait_memory()
157 (current_timeo -= vm_wait) < 0) in sk_stream_wait_memory()
165 remove_wait_queue(sk_sleep(sk), &wait); in sk_stream_wait_memory()
169 err = -EPIPE; in sk_stream_wait_memory()
177 set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); in sk_stream_wait_memory()
178 err = -EAGAIN; in sk_stream_wait_memory()
188 if (err == -EPIPE) in sk_stream_error()
189 err = sock_error(sk) ? : -EPIPE; in sk_stream_error()
190 if (err == -EPIPE && !(flags & MSG_NOSIGNAL)) in sk_stream_error()
199 __skb_queue_purge(&sk->sk_receive_queue); in sk_stream_kill_queues()
201 /* Next, the error queue. in sk_stream_kill_queues()
202 * We need to use queue lock, because other threads might in sk_stream_kill_queues()
203 * add packets to the queue without socket lock being held. in sk_stream_kill_queues()
205 skb_queue_purge(&sk->sk_error_queue); in sk_stream_kill_queues()
207 /* Next, the write queue. */ in sk_stream_kill_queues()
208 WARN_ON_ONCE(!skb_queue_empty(&sk->sk_write_queue)); in sk_stream_kill_queues()
213 WARN_ON_ONCE(sk->sk_wmem_queued); in sk_stream_kill_queues()