diff mbox

net: af_unix can make unix_nr_socks visbile in /proc

Message ID 4921240D.9000409@cosmosbay.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet Nov. 17, 2008, 7:58 a.m. UTC
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(-)

Comments

David Miller Nov. 17, 2008, 8:01 a.m. UTC | #1
From: Eric Dumazet <dada1@cosmosbay.com>
Date: Mon, 17 Nov 2008 08:58:05 +0100

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

Applied, thanks a lot Eric.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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),
 };
 
 /*