[PATCH] examples: Print PID of peer for unix sockets
Timo Juhani Lindfors
timo.lindfors@iki.fi
Fri Oct 29 12:44:00 GMT 2010
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
More information about the Systemtap
mailing list