*BSD News Article 34978


Return to BSD News archive

Xref: sserve comp.unix.sys5.r4:8218 comp.unix.bsd:14724 comp.unix.aix:43127 comp.sys.hp.hpux:11084 comp.protocols.tcp-ip:31294
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!agate!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!netline-fddi.jpl.nasa.gov!nntp-server.caltech.edu!news.cerf.net!news
From: escneto@ .cerfnet.com
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: Fri, 26 Aug 94 11:02:29 PDT
Organization: CERFnet
Lines: 24
Message-ID: <33lbs7$5r@news.cerf.net>
References: <33k9uq$31g@u.cc.utah.edu>
NNTP-Posting-Host: default5.sdsc.cerfnet.com
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Newsreader: NEWTNews & Chameleon -- TCP/IP for MS Windows from NetManage


In article <33k9uq$31g@u.cc.utah.edu>, <terry@cs.weber.edu> writes:
> 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 *)?
> 

Appreciate the response.  The situation is this.  I have access to the global
kernel file table (this is AIX 3.2 by the way).  In the file struct there is
a _vnode/_data union.  For sockets this struct appears to be a pointer to a 
struct socket.  Given the 'socket pointer' I now need to find various pieces
of info.  It is not evident what the process id is from either the file
struct or the socket struct.  There is a pointer to a stat function in the
file struct, but I would like to be able to access the pid in an in
memory data struct rather than using a function call.

I will ftp the file you mentioned and take a look see.  thanks again.