Hi all,
So solaris 11.0 "netstat" lacks the ability to show process id.
I would like to write some code with this ability.
I opened the gnu netstat and saw they go to /proc/processId/fd/
read each file descriptor, check if socket and then create the mapping.
How can i view the content of /proc/processId/fd/ in solaris ? To get the data.
what does pfiles do behind the scenes?
e.g:
root@solaris11:~# ptree 13290
471 /usr/lib/ssh/sshd
13288 /usr/lib/ssh/sshd
13289 /usr/lib/ssh/sshd
13290 -bash
13297 ptree 13290
root@solaris11:~# pfiles 13289
and then i see:
4: S_IFSOCK mode:0666 dev:543,0 ino:46230 uid:0 gid:0 size:0
O_RDWR|O_NONBLOCK
SOCK_STREAM
SO_REUSEADDR,SO_KEEPALIVE,SO_SNDBUF(49152),SO_RCVBUF(128480)
sockname: AF_INET6 ::ffff:10.10.50.28 port: 22
peername: AF_INET6 ::ffff:10.16.6.150 port: 55330
congestion control: newreno
this mean that
/proc/13289/fd/4 is what im looking for, but i cant cat it, how can i do it via code ?