finding what processes owns a socket

William Roberts liam at cs.qmw.ac.uk
Tue Dec 4 21:58:36 AEST 1990


In <1990Nov30.150350.10483 at maverick.ksu.ksu.edu> brtmac at maverick.ksu.ksu.edu 
(Brett McCoy) writes:


>I need to find what processes owns a given socket.  Specificially, given
>the output from netstat how do I find what processes owns each of the
>sockets shown.  I am running SunOS 4.0.3.  Pointers to the correct kernal
>structures and header files would be good.  Actual code would be great.

There is a utility called "ofiles", which we obtained from Vic Abell, 
abe at mace.cc.purdue.edu in March 1989, that does this. Specifically, it can 
take the output of "netstat -A" and use the PCB addresses given to tell you 
which process owns each TCP connection. I recently hacked this on our Sequent 
Balance machine, so that the PCB value printed for UDP sockets is interpreted 
as the address of the inpcb structure; this is true for Dynix but not for BSD 
4.2.
--

William Roberts                 ARPA: liam at cs.qmw.ac.uk
Queen Mary & Westfield College  UUCP: liam at qmw-cs.UUCP
Mile End Road                   AppleLink: UK0087
LONDON, E1 4NS, UK              Tel:  071-975 5250 (Fax: 081-980 6533)



More information about the Comp.unix.internals mailing list