aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2005-08-24 00:52:58 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-08-29 19:05:32 -0400
commitdc40c7bc76054f5e4382835ca2bafb895b993a8a (patch)
tree70951f8d97dc191df3c772c830b667ad7af6dfd9
parent2babe1f6fea717c36c008c878fe095d1ca5696c1 (diff)
[ICSK]: Generalise tcp_listen_poll
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/inet_connection_sock.h10
-rw-r--r--net/ipv4/tcp.c11
2 files changed, 11 insertions, 10 deletions
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index 4d7e708c07d1..8a87a3a4f107 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -260,6 +260,16 @@ extern void inet_csk_reqsk_queue_prune(struct sock *parent,
260 const unsigned long max_rto); 260 const unsigned long max_rto);
261 261
262extern void inet_csk_destroy_sock(struct sock *sk); 262extern void inet_csk_destroy_sock(struct sock *sk);
263
264/*
265 * LISTEN is a special case for poll..
266 */
267static inline unsigned int inet_csk_listen_poll(const struct sock *sk)
268{
269 return !reqsk_queue_empty(&inet_csk(sk)->icsk_accept_queue) ?
270 (POLLIN | POLLRDNORM) : 0;
271}
272
263extern int inet_csk_listen_start(struct sock *sk, const int nr_table_entries); 273extern int inet_csk_listen_start(struct sock *sk, const int nr_table_entries);
264extern void inet_csk_listen_stop(struct sock *sk); 274extern void inet_csk_listen_stop(struct sock *sk);
265 275
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 02848e72e9c1..68626de6d69c 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -310,15 +310,6 @@ void tcp_enter_memory_pressure(void)
310EXPORT_SYMBOL(tcp_enter_memory_pressure); 310EXPORT_SYMBOL(tcp_enter_memory_pressure);
311 311
312/* 312/*
313 * LISTEN is a special case for poll..
314 */
315static __inline__ unsigned int tcp_listen_poll(struct sock *sk,
316 poll_table *wait)
317{
318 return !reqsk_queue_empty(&inet_csk(sk)->icsk_accept_queue) ? (POLLIN | POLLRDNORM) : 0;
319}
320
321/*
322 * Wait for a TCP event. 313 * Wait for a TCP event.
323 * 314 *
324 * Note that we don't need to lock the socket, as the upper poll layers 315 * Note that we don't need to lock the socket, as the upper poll layers
@@ -333,7 +324,7 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
333 324
334 poll_wait(file, sk->sk_sleep, wait); 325 poll_wait(file, sk->sk_sleep, wait);
335 if (sk->sk_state == TCP_LISTEN) 326 if (sk->sk_state == TCP_LISTEN)
336 return tcp_listen_poll(sk, wait); 327 return inet_csk_listen_poll(sk);
337 328
338 /* Socket is not locked. We are protected from async events 329 /* Socket is not locked. We are protected from async events
339 by poll logic and correct handling of state changes 330 by poll logic and correct handling of state changes