For example, in /proc/net/sockstat , does a TCP socket in CLOSE_WAIT get counted as 'inuse' or 'alloc' ?
In the kernel source net/ipv4/proc.c I see that sockstat_seq_show is called when getting the info from /proc/net/sockstat.
However I cannot see what differentiates a socket from being allocated (alloc) opposed to 'inuse'
[me@myhostname ~]$ cat /proc/net/sockstat
sockets: used 481
TCP: inuse 52 orphan 1 tw 66 alloc 62 mem 12
UDP: inuse 11 mem 5
UDPLITE: inuse 0
RAW: inuse 0
FRAG: inuse 0 memory 0
In net/tcp_states.h the possible states are enumerated as such
enum {
TCP_ESTABLISHED = 1,
TCP_SYN_SENT,
TCP_SYN_RECV,
TCP_FIN_WAIT1,
TCP_FIN_WAIT2,
TCP_TIME_WAIT,
TCP_CLOSE,
TCP_CLOSE_WAIT,
TCP_LAST_ACK,
TCP_LISTEN,
TCP_CLOSING, /* Now a valid state */
TCP_NEW_SYN_RECV,
TCP_MAX_STATES /* Leave at the end! */
};
Which of the above count as 'inuse' and which count as 'alloc' ?