That ("Internet socket") is lsof-specific definition.


well, not really - sockets occupy a file descriptor like ordinary files do,
so in effect it's seen as a file to a process - have a look in
/proc/<pid>/fd/ to see what file descriptors sockets occupy

How are you defining "file"?


Would "something that can be named using a UNIX path and can be opened
with
open(2)" (i.e. not directories) satisfy you?



I would say something that you read() and write() to



UNIX-domain sockets, which are usually uninteresting, indeed occupy
> i-nodes
> > on filesystems, but I'm not aware of a standard way to map network
> sockets (
> > e.g. TCP/UDP sockets) to filesystem names.Do you? (maybe there is some
> > specialized linux filesystem which does this, but I don't see one on
my
> > system right now.



already mentioned, but /proc/net/[tcp,udp] have this - you can use this file
to translate the socket id from *the name of the file*
/proc/<pid>/fd/socket[<id>] into a tcp/udp connection.. interestingly by
using the inode field as the id :)
The IPs and ports are written in hex, but you can decode them fairly easy
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to