public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] examples: Print PID of peer for unix sockets
@ 2010-10-29 12:44 Timo Juhani Lindfors
  2010-10-29 12:57 ` Mark Wielaard
  0 siblings, 1 reply; 2+ messages in thread
From: Timo Juhani Lindfors @ 2010-10-29 12:44 UTC (permalink / raw)
  To: systemtap; +Cc: Timo Juhani Lindfors

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] examples: Print PID of peer for unix sockets
  2010-10-29 12:44 [PATCH] examples: Print PID of peer for unix sockets Timo Juhani Lindfors
@ 2010-10-29 12:57 ` Mark Wielaard
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Wielaard @ 2010-10-29 12:57 UTC (permalink / raw)
  To: Timo Juhani Lindfors; +Cc: systemtap

On Fri, 2010-10-29 at 15:44 +0300, Timo Juhani Lindfors wrote:
> This information is very useful for debugging but is not normally
> available to userland since /proc/net/unix does not list it.

Indeed, very useful and a nice addition to the example. Pushed.

Would be nice to see if we could remove some more embedded-c stuff with
the use of @cast. Although I doubt we can do without -g completely for
pfiles.

Thanks,

Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-10-29 12:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-29 12:44 [PATCH] examples: Print PID of peer for unix sockets Timo Juhani Lindfors
2010-10-29 12:57 ` Mark Wielaard

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).