* given a struct sock, how to find pid of process that owns it?
@ 2003-09-03 17:17 Chris Friesen
2003-09-03 19:00 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Chris Friesen @ 2003-09-03 17:17 UTC (permalink / raw)
To: Linux Kernel Mailing List, netdev
I'm working on a small app similar to netstat that only cares about unix
sockets.
I can easily walk /proc/net/unix, but to find the owner of the socket I
need to scan /proc, which gets expensive.
Accordingly, I'd like to extend /proc/net/unix to also dump out the pid
of the process that owns the socket. The only thing is, I can't seem to
figure out how to find the pid of the socket owner given a pointer to
the socket struct.
Any tips? Is it even there?
Thanks,
Chris
--
Chris Friesen | MailStop: 043/33/F10
Nortel Networks | work: (613) 765-0557
3500 Carling Avenue | fax: (613) 765-2986
Nepean, ON K2H 8E9 Canada | email: cfriesen@nortelnetworks.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: given a struct sock, how to find pid of process that owns it?
2003-09-03 17:17 given a struct sock, how to find pid of process that owns it? Chris Friesen
@ 2003-09-03 19:00 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2003-09-03 19:00 UTC (permalink / raw)
To: linux-kernel
On Wed, 03 Sep 2003 13:17:25 -0400
Chris Friesen <cfriesen@nortelnetworks.com> wrote:
>
> I'm working on a small app similar to netstat that only cares about unix
> sockets.
>
> I can easily walk /proc/net/unix, but to find the owner of the socket I
> need to scan /proc, which gets expensive.
>
> Accordingly, I'd like to extend /proc/net/unix to also dump out the pid
> of the process that owns the socket. The only thing is, I can't seem to
> figure out how to find the pid of the socket owner given a pointer to
> the socket struct.
>
There is a N to 1 relationship, you will end up needing the scan.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-09-03 19:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-03 17:17 given a struct sock, how to find pid of process that owns it? Chris Friesen
2003-09-03 19:00 ` Stephen Hemminger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.