bob@uxa.cso.uiuc.edu (Bob Foertsch) (07/20/90)
every open socket has some process running but there seems to be no way of getting the pid of a socket or the socket number of a pid. anyone have a 'tool' for this? ideas? -- ------------------------------------------------------------------------------ | Bob Foertsch | Unix Systems Administrator | | | University of Illinois | | bob@uxa.cso.uiuc.edu | 1304 West Springfield | | (217) 333-8033 | Urbana, Illinois 61801 | ------------------------------------------------------------------------------
jik@pit-manager.mit.edu (Jonathan I. Kamens) (07/23/90)
In article <1990Jul20.160919.16955@ux1.cso.uiuc.edu> bob@uxa.cso.uiuc.edu (Bob Foertsch) writes:
every open socket has some process running but there seems to be no way
of getting the pid of a socket or the socket number of a pid. anyone
have a 'tool' for this? ideas?
Check out the "ofiles" program, available in the comp.sources.unix
archives. It can determine open file descriptors for specified
process ID's, or processes which currently have open file descriptors
on any specified device, or processes which have specific files open.
I don't think it can determine a PID given an open network socket,
especially since not all active network sockets are guaranteed to be
associated with a PID (for example, if a program using a socket
terminates prematurely, its socket may hang around for a while before
it goes away).
Jonathan Kamens USnail:
MIT Project Athena 11 Ashford Terrace
jik@Athena.MIT.EDU Allston, MA 02134
Office: 617-253-8495 Home: 617-782-0710