This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
[PATCH] examples: Print PID of peer for unix sockets
- From: Timo Juhani Lindfors <timo dot lindfors at iki dot fi>
- To: systemtap at sourceware dot org
- Cc: Timo Juhani Lindfors <timo dot lindfors at iki dot fi>
- Date: Fri, 29 Oct 2010 15:44:30 +0300
- Subject: [PATCH] examples: Print PID of peer for unix sockets
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