Skip to contentSkip to conversation

/proc/net/tcp && udp formats

DISCUSSION monkeyiq 1 participant 1 message Sep 4, 2001

lore
Share & tools
lore

monkeyiq

author
#0 lore raw

Hi,
Is the format of these two files fixed? I think there
was talk on the files in /proc on the list a while ago, but there seemed to be no resolution as to that format was going to be sought in the future.

I ask because in ferris I parse these files to get a "directory" of sockets, from which soon one will be able to "create" a new socket.

Also, where is the 'st' state enum defined for this file? I'd like to look it up and provide EA for it too.

...

Also as an RFC on any ideas for improvements that others may have, I take the following

$ head -2 /proc/net/tcp
  sl  local_address rem_address   st tx_queue rx_queue \
tr tm->when retrnsmt   uid  timeout inode                                                     
   0: 6300A8C0:008B 00000000:0000 0A 00000000:00000000 \
00:00000000 00000000     0        0 2571091 1 c90db7e0 300 0 0 2 -1 

And generate a context with EA in ferris:

./ls --root-context-class=socket \
--show-columns="name,local_address,local-ip,local-port,remote-ip,remote-port,path,local-hostname,ea-names" \
--ferris-logging-off /tcp

name local_address local-ip local-port \
remote-ip remote-port path local-hostname ea-names

0 6300A8C0:008B 192.168.0.99 139 \
0.0.0.0 0 /tcp/0 myhost attribute-count,dss,dss1,ea-names,head,head-radix,inode,local-hostname,local-ip,local-port,local_address,md2,md4,md5,mdc2,name,path,rem_address,remote-hostname,remote-ip,remote-port,retrnsmt,ripemd160,rx_queue,sha,sha1,sl,st,subcontext-count,timeout,tm->when,tr,tx_queue,uid,

where ea-names are all the attributes for this fake file. I basically take every line and make a fake file for it, and add new EA for ip, reverse lookups, and port in decimal. Sorry about the formatting...
I could maybe send CSV for future posts :|

-------------------------------------------
is that you ferrese?
http://witme.sourceforge.net/libferris.web/