ss: Get rid of single-fielded struct snmpstat
A struct with only a single field does not make much sense. Besides that, it was used by print_summary() only. Signed-off-by: Phil Sutter <phil@nwl.cc>
This commit is contained in:
parent
6b224dad23
commit
2f938ce1fa
10
misc/ss.c
10
misc/ss.c
|
|
@ -3704,10 +3704,6 @@ static int handle_follow_request(struct filter *f)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct snmpstat {
|
|
||||||
int tcp_estab;
|
|
||||||
};
|
|
||||||
|
|
||||||
static int get_snmp_int(char *proto, char *key, int *result)
|
static int get_snmp_int(char *proto, char *key, int *result)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
@ -3828,11 +3824,11 @@ static int get_sockstat(struct ssummary *s)
|
||||||
static int print_summary(void)
|
static int print_summary(void)
|
||||||
{
|
{
|
||||||
struct ssummary s;
|
struct ssummary s;
|
||||||
struct snmpstat sn;
|
int tcp_estab;
|
||||||
|
|
||||||
if (get_sockstat(&s) < 0)
|
if (get_sockstat(&s) < 0)
|
||||||
perror("ss: get_sockstat");
|
perror("ss: get_sockstat");
|
||||||
if (get_snmp_int("Tcp:", "CurrEstab", &sn.tcp_estab) < 0)
|
if (get_snmp_int("Tcp:", "CurrEstab", &tcp_estab) < 0)
|
||||||
perror("ss: get_snmpstat");
|
perror("ss: get_snmpstat");
|
||||||
|
|
||||||
get_slabstat(&slabstat);
|
get_slabstat(&slabstat);
|
||||||
|
|
@ -3841,7 +3837,7 @@ static int print_summary(void)
|
||||||
|
|
||||||
printf("TCP: %d (estab %d, closed %d, orphaned %d, synrecv %d, timewait %d/%d), ports %d\n",
|
printf("TCP: %d (estab %d, closed %d, orphaned %d, synrecv %d, timewait %d/%d), ports %d\n",
|
||||||
s.tcp_total + slabstat.tcp_syns + s.tcp_tws,
|
s.tcp_total + slabstat.tcp_syns + s.tcp_tws,
|
||||||
sn.tcp_estab,
|
tcp_estab,
|
||||||
s.tcp_total - (s.tcp4_hashed+s.tcp6_hashed-s.tcp_tws),
|
s.tcp_total - (s.tcp4_hashed+s.tcp6_hashed-s.tcp_tws),
|
||||||
s.tcp_orphans,
|
s.tcp_orphans,
|
||||||
slabstat.tcp_syns,
|
slabstat.tcp_syns,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue