scotte/nicstat

Solaris nicstat does not handle a single kstat wrap during sample interval

Closed this issue · 4 comments

Submitting for consideration if anybody still maintains this project -
6 --- nicstat.c 2014-01-27 15:04:11.000000000 +0000
7 +++ ../../nicstat-1.95/nicstat.c 2018-04-02 03:22:44.930544867 +0000
8 @@ -1811,8 +1811,18 @@
9 (void) strftime(g_timestr, sizeof (g_timestr), "%H:%M:%S", tm);
10 }
11
12 -#define TCPSTAT(field) (g_tcp_new->field - g_tcp_old->field)
13 -#define UDPSTAT(field) (g_udp_new->field - g_udp_old->field)
14 +static uint32_t
15 +tcpudpstat(uint32_t new, uint32_t old)
16 +{
17 + if (new < old)
18 + return((UINT32_MAX - old) + new);
19 + else
20 + return(new - old);
21 +}
22 +
23 +#define TCPSTAT(field) tcpudpstat(((g_tcp_new)->field), ((g_tcp_old)->field))
24 +
25 +#define UDPSTAT(field) tcpudpstat(((g_udp_new)->field), ((g_udp_old)->field))
26
27 static void
28 print_tcp()

If you create a pull request, ifdef'd as appropriate for anything solaris vs linux specific, I'm happy to merge it to this repository - I don't have any way to test it in solaris though.

Thank you George!