aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorKirill Tkhai <ktkhai@virtuozzo.com>2019-12-09 13:03:46 +0300
committerDavid S. Miller <davem@davemloft.net>2019-12-12 17:04:55 -0800
commit3c32da19a858fb1ae8a76bf899160be49f338506 (patch)
treee7a0f84416fbb8b900c24d2d063a2eac6be9513f /include/net
parentnet: Allow to show socket-specific information in /proc/[pid]/fdinfo/[fd] (diff)
downloadlinux-dev-3c32da19a858fb1ae8a76bf899160be49f338506.tar.xz
linux-dev-3c32da19a858fb1ae8a76bf899160be49f338506.zip
unix: Show number of pending scm files of receive queue in fdinfo
Unix sockets like a block box. You never know what is stored there: there may be a file descriptor holding a mount or a block device, or there may be whole universes with namespaces, sockets with receive queues full of sockets etc. The patch adds a little debug and accounts number of files (not recursive), which is in receive queue of a unix socket. Sometimes this is useful to determine, that socket should be investigated or which task should be killed to put reference counter on a resourse. v2: Pass correct argument to lockdep Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/af_unix.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/net/af_unix.h b/include/net/af_unix.h
index 3426d6dacc45..17e10fba2152 100644
--- a/include/net/af_unix.h
+++ b/include/net/af_unix.h
@@ -41,6 +41,10 @@ struct unix_skb_parms {
u32 consumed;
} __randomize_layout;
+struct scm_stat {
+ u32 nr_fds;
+};
+
#define UNIXCB(skb) (*(struct unix_skb_parms *)&((skb)->cb))
#define unix_state_lock(s) spin_lock(&unix_sk(s)->lock)
@@ -65,6 +69,7 @@ struct unix_sock {
#define UNIX_GC_MAYBE_CYCLE 1
struct socket_wq peer_wq;
wait_queue_entry_t peer_wake;
+ struct scm_stat scm_stat;
};
static inline struct unix_sock *unix_sk(const struct sock *sk)