Return to BSD News archive
Xref: sserve comp.unix.sys5.r4:8288 comp.unix.bsd:14846 comp.unix.aix:43752 comp.sys.hp.hpux:11398 comp.protocols.tcp-ip:31533 Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!cs.utexas.edu!news.cs.utah.edu!u.cc.utah.edu!cs.weber.edu!terry From: terry@cs.weber.edu (Terry Lambert) Newsgroups: comp.unix.sys5.r4,comp.unix.bsd,comp.unix.aix,comp.sys.hp.hpux,comp.protocols.tcp-ip Subject: Re: sock to proc? Date: 26 Aug 1994 08:43:06 GMT Organization: Weber State University, Ogden, UT Lines: 37 Message-ID: <33k9uq$31g@u.cc.utah.edu> References: <33jc7q$3gk@news.cerf.net> NNTP-Posting-Host: cs.weber.edu In article <33jc7q$3gk@news.cerf.net> escneto@cerfnet.com writes: ] Question. Given a pointer to a socket in the kernels address space, how ] can I go about finding the process which owns the socket? What do you mean "a pointer to a socket in the kernels address space". A vnode? A system open file table entry (struct file)? A per process open file table entry (struct file *)? Generally, there will be a method of determining which vnode is associated with it, unless you have traversed your records too far. Typical usage is to traverse the system open file table looking for the struct file * and getting the PID that has it open that way. If the system open file table isn't exported, you will have to traverse the active processes in the system, peeking at their per process open file tables to find out which one it is. Look at the sources for identd, which does this. It should be available both on its own and as part of the TCPWrappers package. The only place I know of to get this off the top of my head is the CERT site. You could archie for both of them otherwise. Terry Lambert terry@cs.weber.edu --- Any opinions in this posting are my own and not those of my present or previous employers.