Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: Linux Netdev List <netdev@vger.kernel.org>
Subject: [PATCH] net: af_unix can make unix_nr_socks visbile in /proc
Date: Mon, 17 Nov 2008 08:58:05 +0100	[thread overview]
Message-ID: <4921240D.9000409@cosmosbay.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 528 bytes --]

Currently, /proc/net/protocols displays socket counts only for TCP/TCPv6
protocols

We can provide unix_nr_socks for free here, this counter being
already maintained in af_unix

Before patch :

# grep UNIX /proc/net/protocols
UNIX       428     -1      -1   NI       0   yes  kernel

After patch :

# grep UNIX /proc/net/protocols
UNIX       428     98      -1   NI       0   yes  kernel

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
---
 net/unix/af_unix.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

[-- Attachment #2: af_unix_sockets_allocated.patch --]
[-- Type: text/plain, Size: 471 bytes --]

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 58db2a2..a1eb596 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -566,9 +566,10 @@ static const struct proto_ops unix_seqpacket_ops = {
 };
 
 static struct proto unix_proto = {
-	.name	  = "UNIX",
-	.owner	  = THIS_MODULE,
-	.obj_size = sizeof(struct unix_sock),
+	.name			= "UNIX",
+	.owner			= THIS_MODULE,
+	.sockets_allocated	= &unix_nr_socks,
+	.obj_size		= sizeof(struct unix_sock),
 };
 
 /*

             reply	other threads:[~2008-11-17  7:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-17  7:58 Eric Dumazet [this message]
2008-11-17  8:01 ` [PATCH] net: af_unix can make unix_nr_socks visbile in /proc David Miller

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=4921240D.9000409@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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