Operating System - Linux
1758566 Members
2122 Online
108872 Solutions
New Discussion

Regarding meaning for "cat /proc/net/sockstat" results

 
Minoru Asano
Frequent Advisor

Regarding meaning for "cat /proc/net/sockstat" results

Hello,

I would like to know regarding "cat /proc/net/sockstat" results.

[ENVIRONMENT]
RHEL ES 3 update4

[SITUATION]
If we execute "cat /proc/net/sockstat" command, the following results
is appeared:

sockets: used 416
TCP: inuse 78 orphan 0 tw 36 alloc 337 mem 8429
UDP: inese 46
RAW: inuse 0
FRAG: inuse 0 memory 0

[QUESTION]
- What does they mean ?
I guess like following:
inuse : established TCP socket number.
tw : time wait for TCP socket establish ( queuing number )
alloc : all TCP socket number ( for example, ESTABLISH, CLOSE_WAIT, TIME_WAIT, etc)
mem : total memory for TCP socket ( unit is KB ? )

[QUESTION]
- Could you suggest me whether my guess correct or not ?

Thank you for advice.
Best Regards.
/Minoru.Asano


1 REPLY 1
Siert Zijl
Advisor

Re: Regarding meaning for "cat /proc/net/sockstat" results

I read a bit of net/ipv4/proc.c and include/net/tcp.h from a 2.6 kernel. At line 66 the following code:

seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %d\n",fold_prot_inuse(&tcp_prot), atomic_read(&tcp_orphan_count),tcp_tw_count, atomic_read(&tcp_sockets_allocated), atomic_read(&tcp_memory_allocated));

My guess whould be the same as yours:
- TCP in use: total established connections
- Orphan: Orphaned tcp connections (not attached to any user file handle)
- TW: TIME_WAIT connections
- Alloc: TCP sockets allocated (all types)

The kernel uses mostly pages or bytes but if they are in relation with configurable tcp kernel parameters I think the value is in bytes.

If you want to be really sure, you can try to mail the code author (his address is at line 58 of net/ipv4/proc.c in the latest 2.6 kernel).
Linux system administrator