From: Timo Juhani Lindfors <timo.lindfors@iki.fi>
To: systemtap@sourceware.org
Cc: Timo Juhani Lindfors <timo.lindfors@iki.fi>
Subject: [PATCH] examples: Print PID of peer for unix sockets
Date: Fri, 29 Oct 2010 12:44:00 -0000 [thread overview]
Message-ID: <1288356270-1626-1-git-send-email-timo.lindfors@iki.fi> (raw)
This information is very useful for debugging but is not normally
available to userland since /proc/net/unix does not list it.
---
testsuite/systemtap.examples/process/pfiles.stp | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/testsuite/systemtap.examples/process/pfiles.stp b/testsuite/systemtap.examples/process/pfiles.stp
index 796a4f0..095f1a7 100755
--- a/testsuite/systemtap.examples/process/pfiles.stp
+++ b/testsuite/systemtap.examples/process/pfiles.stp
@@ -620,6 +620,8 @@ function print_unix_socket(sock) {
peername = socket_unix_peername(sock)
printf("%s%s", strlen(sockname) > 0 ? sockname . "\n" : "",
strlen(peername) > 0 ? peername . "\n" : "")
+ printf(" peercred pid: %d\n",
+ @cast(sock, "socket")->sk->sk_peercred->pid);
}
function print_ipv4_socket(sock) {
--
1.7.1
next reply other threads:[~2010-10-29 12:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-29 12:44 Timo Juhani Lindfors [this message]
2010-10-29 12:57 ` Mark Wielaard
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=1288356270-1626-1-git-send-email-timo.lindfors@iki.fi \
--to=timo.lindfors@iki.fi \
--cc=systemtap@sourceware.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).