Subject: [PATCH 5/5] unix_diag: Report ack backlog info for listen sockets

From: Pavel Emelyanov <[email-masked]>
Date: Wed, 28 Dec 2011 17:40:24 +0400

I propose to reuse the MEMINFO bit and message for this, since it's

a) also 2 values
b) symmetrical to how inet diag reports the length

Is it OK, or is it better to introduce separate bit and message?

Signed-off-by: Pavel Emelyanov <[email-masked]>

---
 net/unix/diag.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/unix/diag.c b/net/unix/diag.c
index dbae8a4..ebec5fc 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -113,8 +113,14 @@ static int sk_diag_show_meminfo(struct sock *sk, struct sk_buff *nlskb)
 	struct unix_diag_meminfo *mi;
 
 	mi = UNIX_DIAG_PUT(nlskb, UNIX_DIAG_MEMINFO, sizeof(*mi));
-	mi->udiag_len = sk_wmem_alloc_get(sk);
-	mi->udiag_limit = sk->sk_sndbuf;
+
+	if (sk->sk_state == TCP_LISTEN) {
+		mi->udiag_len = sk->sk_receive_queue.qlen;
+		mi->udiag_limit = sk->sk_max_ack_backlog;
+	} else {
+		mi->udiag_len = sk_wmem_alloc_get(sk);
+		mi->udiag_limit = sk->sk_sndbuf;
+	}
 
 	return 0;
 
-- 
1.5.5.6