From owner-svn-src-all@freebsd.org Mon Nov 12 13:26:15 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A82F4110617C; Mon, 12 Nov 2018 13:26:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 331DC6EF19; Mon, 12 Nov 2018 13:26:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 156DC214EC; Mon, 12 Nov 2018 13:26:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wACDQEZS026509; Mon, 12 Nov 2018 13:26:14 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wACDQDGt026503; Mon, 12 Nov 2018 13:26:13 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201811121326.wACDQDGt026503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 12 Nov 2018 13:26:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r340361 - head/usr.bin/systat X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/usr.bin/systat X-SVN-Commit-Revision: 340361 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 331DC6EF19 X-Spamd-Result: default: False [-103.05 / 200.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; ALLOW_DOMAIN_WHITELIST(-100.00)[FreeBSD.org]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: mx1.FreeBSD.org]; NEURAL_HAM_SHORT(-0.94)[-0.939,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Nov 2018 13:26:15 -0000 Author: tuexen Date: Mon Nov 12 13:26:13 2018 New Revision: 340361 URL: https://svnweb.freebsd.org/changeset/base/340361 Log: Fix printing of 64-bit counters on 32-bit ppc platforms. Several statistic counters are uint64_t values and are printed by systat using %lu. This results in displaying wrong numbers. Use PRIu64 instead. While there, print variables of size_t using %zd. MFC after:i 3 days Differential Revision: https://reviews.freebsd.org/D17838 Modified: head/usr.bin/systat/fetch.c head/usr.bin/systat/icmp6.c head/usr.bin/systat/ip.c head/usr.bin/systat/ip6.c head/usr.bin/systat/tcp.c head/usr.bin/systat/zarc.c Modified: head/usr.bin/systat/fetch.c ============================================================================== --- head/usr.bin/systat/fetch.c Mon Nov 12 11:20:59 2018 (r340360) +++ head/usr.bin/systat/fetch.c Mon Nov 12 13:26:13 2018 (r340361) @@ -68,9 +68,8 @@ void getsysctl(const char *name, void *ptr, size_t len strerror(errno)); } if (nlen != len) { - error("sysctl(%s...) expected %lu, got %lu", name, - (unsigned long)len, (unsigned long)nlen); - } + error("sysctl(%s...) expected %zu, got %zu", name, len, nlen); + } } /* Modified: head/usr.bin/systat/icmp6.c ============================================================================== --- head/usr.bin/systat/icmp6.c Mon Nov 12 11:20:59 2018 (r340360) +++ head/usr.bin/systat/icmp6.c Mon Nov 12 13:26:13 2018 (r340361) @@ -50,6 +50,7 @@ static char sccsid[] = "@(#)mbufs.c 8.1 (Berkeley) 6/6 #include #include +#include #include #include #include @@ -173,7 +174,7 @@ void showicmp6(void) { struct icmp6stat stats; - u_long totalin, totalout; + uint64_t totalin, totalout; int i; memset(&stats, 0, sizeof stats); @@ -184,11 +185,11 @@ showicmp6(void) } totalin += stats.icp6s_badcode + stats.icp6s_badlen + stats.icp6s_checksum + stats.icp6s_tooshort; - mvwprintw(wnd, 1, 0, "%9lu", totalin); - mvwprintw(wnd, 1, 35, "%9lu", totalout); + mvwprintw(wnd, 1, 0, "%9"PRIu64, totalin); + mvwprintw(wnd, 1, 35, "%9"PRIu64, totalout); #define DO(stat, row, col) \ - mvwprintw(wnd, row, col, "%9lu", stats.stat) + mvwprintw(wnd, row, col, "%9"PRIu64, stats.stat) DO(icp6s_badcode, 2, 0); DO(icp6s_badlen, 3, 0); Modified: head/usr.bin/systat/ip.c ============================================================================== --- head/usr.bin/systat/ip.c Mon Nov 12 11:20:59 2018 (r340360) +++ head/usr.bin/systat/ip.c Mon Nov 12 13:26:13 2018 (r340361) @@ -53,6 +53,7 @@ static const char sccsid[] = "@(#)mbufs.c 8.1 (Berkele #include #include +#include #include #include #include @@ -203,16 +204,16 @@ void showip(void) { struct stat stats; - u_long totalout; + uint64_t totalout; domode(&stats); totalout = stats.i.ips_forward + stats.i.ips_localout; #define DO(stat, row, col) \ - mvwprintw(wnd, row, col, "%9lu", stats.stat) + mvwprintw(wnd, row, col, "%9"PRIu64, stats.stat) DO(i.ips_total, 1, 0); - mvwprintw(wnd, 1, 35, "%9lu", totalout); + mvwprintw(wnd, 1, 35, "%9"PRIu64, totalout); DO(i.ips_badsum, 2, 0); DO(i.ips_localout, 2, 35); DO(i.ips_tooshort, 3, 0); Modified: head/usr.bin/systat/ip6.c ============================================================================== --- head/usr.bin/systat/ip6.c Mon Nov 12 11:20:59 2018 (r340360) +++ head/usr.bin/systat/ip6.c Mon Nov 12 13:26:13 2018 (r340361) @@ -52,6 +52,7 @@ static const char sccsid[] = "@(#)mbufs.c 8.1 (Berkele #include #include +#include #include #include #include @@ -190,16 +191,16 @@ void showip6(void) { struct ip6stat stats; - u_long totalout; + uint64_t totalout; domode(&stats); totalout = stats.ip6s_forward + stats.ip6s_localout; #define DO(stat, row, col) \ - mvwprintw(wnd, row, col, "%9lu", stats.stat) + mvwprintw(wnd, row, col, "%9"PRIu64, stats.stat) DO(ip6s_total, 1, 0); - mvwprintw(wnd, 1, 35, "%9lu", totalout); + mvwprintw(wnd, 1, 35, "%9"PRIu64, totalout); DO(ip6s_tooshort, 2, 0); DO(ip6s_localout, 2, 35); DO(ip6s_toosmall, 3, 0); Modified: head/usr.bin/systat/tcp.c ============================================================================== --- head/usr.bin/systat/tcp.c Mon Nov 12 11:20:59 2018 (r340360) +++ head/usr.bin/systat/tcp.c Mon Nov 12 13:26:13 2018 (r340361) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -237,7 +238,7 @@ showtcp(void) domode(&stats); #define DO(stat, row, col) \ - mvwprintw(wnd, row, col, "%12lu", stats.stat) + mvwprintw(wnd, row, col, "%12"PRIu64, stats.stat) #define L(row, stat) DO(stat, row, 0) #define R(row, stat) DO(stat, row, 38) L(1, tcps_connattempt); R(1, tcps_sndtotal); Modified: head/usr.bin/systat/zarc.c ============================================================================== --- head/usr.bin/systat/zarc.c Mon Nov 12 11:20:59 2018 (r340360) +++ head/usr.bin/systat/zarc.c Mon Nov 12 13:26:13 2018 (r340361) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "systat.h" @@ -139,11 +140,11 @@ showzarc(void) #define DO(stat, row, col, fmt) \ mvwprintw(wnd, row, col, fmt, stat) -#define R(row, stat) DO(rate.hits.stat, row, 31+1, "%3lu") -#define H(row, stat) DO(delta.hits.stat, row, 31+1+5, "%7lu"); \ - DO(curstat.hits.stat, row, 31+1+5+8+8, "%12lu") -#define M(row, stat) DO(delta.misses.stat, row, 31+1+5+8, "%7lu"); \ - DO(curstat.misses.stat, row, 31+1+5+8+8+13, "%12lu") +#define R(row, stat) DO(rate.hits.stat, row, 31+1, "%3"PRIu64) +#define H(row, stat) DO(delta.hits.stat, row, 31+1+5, "%7"PRIu64); \ + DO(curstat.hits.stat, row, 31+1+5+8+8, "%12"PRIu64) +#define M(row, stat) DO(delta.misses.stat, row, 31+1+5+8, "%7"PRIu64); \ + DO(curstat.misses.stat, row, 31+1+5+8+8+13, "%12"PRIu64) #define E(row, stat) R(row, stat); H(row, stat); M(row, stat); E(1, arcstats); E(2, arcstats_demand_data);