Skip to contentSkip to conversation

unix_diag: Report ack backlog info for listen sockets

PATCH In review Pavel Emelyanov 1 participant 1 message Dec 28, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

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?

---
 net/unix/diag.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
net/unix/diag.c +8 -2
index dbae8a4..ebec5fc 100644
@@ -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;
 
Signature · 1 line
1.5.5.6