I'm writing a small script to parse /proc/net/tcp. It works properly for most part except for entries with inode values set to 0. My question is, how do you map such inodes to their respective pids?
For example, this gets processed just fine, I take the inode number, search through /proc/pid/fd/* to see which fd is a symlink to 'socket:[inode]' and split that path to return the pid
Code:
sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode
00000000:1AE1 00000000:0000 0A 00000000:00000000 00:00000000 00000000 1000 0 112028 1 0000000000000000 100 0 0 10 0
But I'm unsure of how to process entries like this:
Code:
sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode
2: 0301A8C0:A07C FA1D1F5E:01BB 06 00000000:00000000 03:00000979 00000000 0 0 0 3 0000000000000000
5: 0301A8C0:B9FC CDA27E4B:01BB 06 00000000:00000000 03:0000097E 00000000 0 0 0 3 0000000000000000
Any help is appreciated