Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!icdoc!qmw-cs!liam From: liam@cs.qmw.ac.uk (William Roberts) Newsgroups: comp.unix.internals Subject: Re: finding what processes owns a socket Message-ID: <2784@redstar.cs.qmw.ac.uk> Date: 4 Dec 90 10:58:36 GMT References: <1990Nov30.150350.10483@maverick.ksu.ksu.edu> Sender: usenet@cs.qmw.ac.uk Lines: 22 Nntp-Posting-Host: whitesand In <1990Nov30.150350.10483@maverick.ksu.ksu.edu> brtmac@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@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@cs.qmw.ac.uk Queen Mary & Westfield College UUCP: liam@qmw-cs.UUCP Mile End Road AppleLink: UK0087 LONDON, E1 4NS, UK Tel: 071-975 5250 (Fax: 081-980 6533)