All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tobias Klauser <tklauser@distanz.ch>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, Kirill Tkhai <ktkhai@virtuozzo.com>,
	Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH net v1] unix: define and set show_fdinfo only if procfs is enabled
Date: Thu, 27 Feb 2020 14:34:42 +0100	[thread overview]
Message-ID: <20200227133442.18728-1-tklauser@distanz.ch> (raw)
In-Reply-To: <20200226172953.16471-1-tklauser@distanz.ch>

Follow the pattern used with other *_show_fdinfo functions and only
define unix_show_fdinfo and set it in proto_ops if CONFIG_PROC_FS
is set.

Fixes: 3c32da19a858 ("unix: Show number of pending scm files of receive queue in fdinfo")
Reviewed-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
v1:
 - s/CONFIG_PROCFS/CONFIG_PROC_FS/

 net/unix/af_unix.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 62c12cb5763e..68debcb28fa4 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -682,6 +682,7 @@ static int unix_set_peek_off(struct sock *sk, int val)
 	return 0;
 }
 
+#ifdef CONFIG_PROC_FS
 static void unix_show_fdinfo(struct seq_file *m, struct socket *sock)
 {
 	struct sock *sk = sock->sk;
@@ -692,6 +693,9 @@ static void unix_show_fdinfo(struct seq_file *m, struct socket *sock)
 		seq_printf(m, "scm_fds: %u\n", READ_ONCE(u->scm_stat.nr_fds));
 	}
 }
+#else
+#define unix_show_fdinfo NULL
+#endif
 
 static const struct proto_ops unix_stream_ops = {
 	.family =	PF_UNIX,
-- 
2.25.0


  parent reply	other threads:[~2020-02-27 13:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26 17:29 [PATCH] unix: define and set show_fdinfo only if procfs is enabled Tobias Klauser
2020-02-27  8:50 ` Kirill Tkhai
2020-02-27 13:34 ` Tobias Klauser [this message]
2020-02-27 19:54   ` [PATCH net v1] " David Miller
2020-02-27 19:12 ` [PATCH] " 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=20200227133442.18728-1-tklauser@distanz.ch \
    --to=tklauser@distanz.ch \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=ktkhai@virtuozzo.com \
    --cc=kuba@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.