Date: Mon, 29 Sep 2014 17:38:51 +0000 (UTC) From: Ryan Stone <rstone@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272284 - head/usr.bin/systat Message-ID: <201409291738.s8THcpxo038996@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rstone Date: Mon Sep 29 17:38:50 2014 New Revision: 272284 URL: http://svnweb.freebsd.org/changeset/base/272284 Log: Fix integer truncation in affecting systat -ifstat The "systat -ifstat" command was using a u_int to store byte counters. With a 10Gbps or faster interface, this overflows within the default 5 second refresh period. Switch to using a uint64_t across the board, which matches the size used for all counters as of r263102. PR: 182448 MFC after: 1 week Sponsored by: Sandvine Inc Modified: head/usr.bin/systat/ifstat.c Modified: head/usr.bin/systat/ifstat.c ============================================================================== --- head/usr.bin/systat/ifstat.c Mon Sep 29 16:24:48 2014 (r272283) +++ head/usr.bin/systat/ifstat.c Mon Sep 29 17:38:50 2014 (r272284) @@ -68,14 +68,14 @@ struct if_stat { struct ifmibdata if_mib; struct timeval tv; struct timeval tv_lastchanged; - u_long if_in_curtraffic; - u_long if_out_curtraffic; - u_long if_in_traffic_peak; - u_long if_out_traffic_peak; - u_long if_in_curpps; - u_long if_out_curpps; - u_long if_in_pps_peak; - u_long if_out_pps_peak; + uint64_t if_in_curtraffic; + uint64_t if_out_curtraffic; + uint64_t if_in_traffic_peak; + uint64_t if_out_traffic_peak; + uint64_t if_in_curpps; + uint64_t if_out_curpps; + uint64_t if_in_pps_peak; + uint64_t if_out_pps_peak; u_int if_row; /* Index into ifmib sysctl */ int if_ypos; /* -1 if not being displayed */ u_int display; @@ -269,8 +269,8 @@ fetchifstat(void) struct if_stat *ifp = NULL; struct timeval tv, new_tv, old_tv; double elapsed = 0.0; - u_int new_inb, new_outb, old_inb, old_outb = 0; - u_int new_inp, new_outp, old_inp, old_outp = 0; + uint64_t new_inb, new_outb, old_inb, old_outb = 0; + uint64_t new_inp, new_outp, old_inp, old_outp = 0; SLIST_FOREACH(ifp, &curlist, link) { /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409291738.s8THcpxo038996>