public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@parallels•com>
To: David Miller <davem@davemloft•net>,
	Linux Netdev List <netdev@vger•kernel.org>
Subject: [PATCH 5/5] unix_diag: Report ack backlog info for listen sockets
Date: Wed, 28 Dec 2011 17:40:24 +0400	[thread overview]
Message-ID: <4EFB1C48.7060407@parallels.com> (raw)

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 <xemul@parallels•com>

---
 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

                 reply	other threads:[~2011-12-28 13:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EFB1C48.7060407@parallels.com \
    --to=xemul@parallels$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox