From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Masatake YAMATO <yamato@redhat.com>, netdev@vger.kernel.org
Subject: Re: [PATCH] unix: show socket peer if no addr is given in /proc/net/unix
Date: Thu, 09 Jan 2014 01:19:06 +0300 [thread overview]
Message-ID: <52CDCEDA.2080609@cogentembedded.com> (raw)
In-Reply-To: <1389158288-2855-1-git-send-email-yamato@redhat.com>
Hello.
On 01/08/2014 08:18 AM, Masatake YAMATO wrote:
> Path field of /proc/net/unix is empty if an address is not given
> to a socket. Typical way to create such socket is calling
> socketpair. The empty fields make it difficult to understand the
> communication between processes. e.g. lsof cannot resolve the role of
> file descriptors well.
> This patch fills the empty fields with unix_peer.
> Signed-off-by: Masatake YAMATO <yamato@redhat.com>
> ---
> net/unix/af_unix.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index 800ca61..1700133 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -2340,7 +2340,9 @@ static int unix_seq_show(struct seq_file *seq, void *v)
> else {
> struct sock *s = v;
> struct unix_sock *u = unix_sk(s);
> + struct sock *s_peer;
> unix_state_lock(s);
> + s_peer = unix_peer(s);
>
> seq_printf(seq, "%pK: %08X %08X %08X %04X %02X %5lu",
> s,
> @@ -2367,7 +2369,8 @@ static int unix_seq_show(struct seq_file *seq, void *v)
> }
> for ( ; i < len; i++)
> seq_putc(seq, u->addr->name->sun_path[i]);
> - }
> + } else if (s_peer)
> + seq_printf(seq, " #%pK", s_peer);
According to Documentation/CodingStyle, both arms of the *if* statement
should have {} if one has it.
WBR, Sergei
prev parent reply other threads:[~2014-01-08 21:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-08 5:18 [PATCH] unix: show socket peer if no addr is given in /proc/net/unix Masatake YAMATO
2014-01-08 6:00 ` David Miller
2014-01-08 6:50 ` Masatake YAMATO
2014-01-08 22:19 ` Sergei Shtylyov [this message]
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=52CDCEDA.2080609@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=netdev@vger.kernel.org \
--cc=yamato@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).