I have an idea of how it's done on Linux, they probably go through /proc//fd and to display the sockets used by each process.
Unfortunately, it doesn't look like the /proc//fd entries list sockets on Solaris. Does anyone know how lsof would do it on this system? Or how one would even go about this in general?
Just to restate what exactly it is I need: I need some way to find which processes are listening to which ports (without using lsof of course) on Solaris.
If you're running Solaris 11.2, you can use
netstat -u
. Per the man page:/proc/<pid>/fd
lists all open file descriptors, including those associated with a socket, eg:Here file descriptors
5
,6
and9
are definitely sockets, as shows theirs
file type.Not sure about what
lsof
is doing under the cover but to get socket details,pfiles
is reading the process internal structures. See its dosocket methods.