ss: Make struct tcpstat fields 'timer' and 'timeout' unsigned
Both 'timer' and 'timeout' variables of struct tcpstat are either
scanned as unsigned values from /proc/net/tcp{,6} or copied from
'idiag_timer' and 'idiag_expries' fields of struct inet_diag_msg, which
itself are unsigned. Therefore they may be unsigned as well, which
eliminates the need to check for negative values.
Signed-off-by: Phil Sutter <phil@nwl.cc>
This commit is contained in:
parent
0b5eadc54f
commit
4cbf5224f2
|
|
@ -697,8 +697,8 @@ struct dctcpstat {
|
||||||
|
|
||||||
struct tcpstat {
|
struct tcpstat {
|
||||||
struct sockstat ss;
|
struct sockstat ss;
|
||||||
int timer;
|
unsigned int timer;
|
||||||
int timeout;
|
unsigned int timeout;
|
||||||
int probes;
|
int probes;
|
||||||
char cong_alg[16];
|
char cong_alg[16];
|
||||||
double rto, ato, rtt, rttvar;
|
double rto, ato, rtt, rttvar;
|
||||||
|
|
@ -869,13 +869,11 @@ static void sock_addr_print(const char *addr, char *delim, const char *port,
|
||||||
sock_addr_print_width(addr_width, addr, delim, serv_width, port, ifname);
|
sock_addr_print_width(addr_width, addr, delim, serv_width, port, ifname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *print_ms_timer(int timeout)
|
static const char *print_ms_timer(unsigned int timeout)
|
||||||
{
|
{
|
||||||
static char buf[64];
|
static char buf[64];
|
||||||
int secs, msecs, minutes;
|
int secs, msecs, minutes;
|
||||||
|
|
||||||
if (timeout < 0)
|
|
||||||
timeout = 0;
|
|
||||||
secs = timeout/1000;
|
secs = timeout/1000;
|
||||||
minutes = secs/60;
|
minutes = secs/60;
|
||||||
secs = secs%60;
|
secs = secs%60;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue