netdev
[Top] [All Lists]

given a struct sock, how to find pid of process that owns it?

To: Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, netdev@xxxxxxxxxxx
Subject: given a struct sock, how to find pid of process that owns it?
From: Chris Friesen <cfriesen@xxxxxxxxxxxxxxxxxx>
Date: Wed, 03 Sep 2003 13:17:25 -0400
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020204

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@xxxxxxxxxxxxxxxxxx


<Prev in Thread] Current Thread [Next in Thread>
  • given a struct sock, how to find pid of process that owns it?, Chris Friesen <=