Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!convex!convex.COM From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.unix.internals Subject: Re: finding what processes owns a socket Message-ID: <109854@convex.convex.com> Date: 5 Dec 90 05:43:16 GMT References: <1990Nov30.150350.10483@maverick.ksu.ksu.edu> <2784@redstar.cs.qmw.ac.uk> Sender: usenet@convex.com Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 29 In article <2784@redstar.cs.qmw.ac.uk> liam@cs.qmw.ac.uk (William Roberts) writes: >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, I also received a copy of fstat, a standard BSD release utility, from Vic Abell, that he made work for Sun file systems. It's nicer than ofiles. I use it all the time. It doesn't give very good information on rnodes. I modified it to chase these down by following kernel pointers and print out the same device as stat would give you, and to find the right inum as well. Unfortunately, my kernel looks different on the inside, so my changes won't help anyone else much, unless they're on a Convex, in which case they should already have fstat. It's a worthwhile exercise for someone who wants to learn about how vnodes, inodes, snodes, and rnodes are all connected. --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "With a kernel dive, all things are possible, but it sure makes it hard to look at yourself in the mirror the next morning." -me