diff options
author | Sridhar Samudrala <sri@us.ibm.com> | 2006-06-27 16:29:00 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-06-29 19:57:57 -0400 |
commit | 47da8ee681d04e68ca1b1812c10e28162150d453 (patch) | |
tree | 05b9abc2438abe0e9ecef1b6632a9b114e6cb55b /net/ipv4/tcp_diag.c | |
parent | c7bdb545d23026b18be53289fd866d1ac07f5f8c (diff) |
[TCP]: Export accept queue len of a TCP listening socket via rx_queue
While debugging a TCP server hang issue, we noticed that currently there is
no way for a user to get the acceptq backlog value for a TCP listen socket.
All the standard networking utilities that display socket info like netstat,
ss and /proc/net/tcp have 2 fields called rx_queue and tx_queue. These
fields do not mean much for listening sockets. This patch uses one of these
unused fields(rx_queue) to export the accept queue len for listening sockets.
Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_diag.c')
-rw-r--r-- | net/ipv4/tcp_diag.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c index c148c1081880..b56399c7cc12 100644 --- a/net/ipv4/tcp_diag.c +++ b/net/ipv4/tcp_diag.c | |||
@@ -26,7 +26,10 @@ static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r, | |||
26 | const struct tcp_sock *tp = tcp_sk(sk); | 26 | const struct tcp_sock *tp = tcp_sk(sk); |
27 | struct tcp_info *info = _info; | 27 | struct tcp_info *info = _info; |
28 | 28 | ||
29 | r->idiag_rqueue = tp->rcv_nxt - tp->copied_seq; | 29 | if (sk->sk_state == TCP_LISTEN) |
30 | r->idiag_rqueue = sk->sk_ack_backlog; | ||
31 | else | ||
32 | r->idiag_rqueue = tp->rcv_nxt - tp->copied_seq; | ||
30 | r->idiag_wqueue = tp->write_seq - tp->snd_una; | 33 | r->idiag_wqueue = tp->write_seq - tp->snd_una; |
31 | if (info != NULL) | 34 | if (info != NULL) |
32 | tcp_get_info(sk, info); | 35 | tcp_get_info(sk, info); |