net: af_unix can make unix_nr_socks visbile in /proc
Subsystems (3)
PATCH 1/1 net: af_unix can make unix_nr_socks visbile in /proc
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 <[email protected]>
---net/unix/af_unix.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
net/unix/af_unix.c +4 -3
@@ -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 ), };/*
From: Eric Dumazet <[email protected]>
Date: Mon, 17 Nov 2008 08:58:05 +0100
Quoted 11 lines
Currently,
/proc/net/protocolsdisplays socket counts only for TCP/TCPv6 protocolsWe can provide
unix_nr_socksfor free here, this counter being already maintained inaf_unixBefore patch :
# grep UNIX /proc/net/protocols UNIX 428 -1 -1 NI 0 yes kernel
Quoted 6 lines
After patch :
# grep UNIX /proc/net/protocols UNIX 428 98 -1 NI 0 yes kernelSigned-off-by Eric Dumazet <[email protected]>
Applied, thanks a lot Eric.