Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Nov 2017 19:10:09 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326139 - head/usr.bin/vmstat
Message-ID:  <201711231910.vANJA9gl060002@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Thu Nov 23 19:10:09 2017
New Revision: 326139
URL: https://svnweb.freebsd.org/changeset/base/326139

Log:
  vmstat: use 64-bit counters from struct vmtotal.
  
  Consistently print counters using unsigned intmax type.
  
  Submitted by:	Pawel Biernacki <pawel.biernacki@gmail.com>
  Sponsored by:	Mysterious Code Ltd.
  Differential revision:	https://reviews.freebsd.org/D13199

Modified:
  head/usr.bin/vmstat/vmstat.c

Modified: head/usr.bin/vmstat/vmstat.c
==============================================================================
--- head/usr.bin/vmstat/vmstat.c	Thu Nov 23 19:06:44 2017	(r326138)
+++ head/usr.bin/vmstat/vmstat.c	Thu Nov 23 19:10:09 2017	(r326139)
@@ -817,7 +817,7 @@ dovmstat(unsigned int interval, int reps)
 		    total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw);
 		xo_close_container("processes");
 		xo_open_container("memory");
-#define vmstat_pgtok(a) ((a) * (sum.v_page_size >> 10))
+#define vmstat_pgtok(a) ((uintmax_t)(a) * (sum.v_page_size >> 10))
 #define	rate(x)	(((x) * rate_adj + halfuptime) / uptime)	/* round */
 		if (hflag) {
 			xo_emit("");
@@ -829,10 +829,10 @@ dovmstat(unsigned int interval, int reps)
 			xo_emit(" ");
 		} else {
 			xo_emit(" ");
-			xo_emit("{:available-memory/%7d}",
+			xo_emit("{:available-memory/%7ju}",
 			        vmstat_pgtok(total.t_avm));
 			xo_emit(" ");
-			xo_emit("{:free-memory/%7d}",
+			xo_emit("{:free-memory/%7ju}",
 			        vmstat_pgtok(total.t_free));
 			xo_emit(" ");
 		}
@@ -1555,9 +1555,9 @@ display_object(struct kinfo_vmobject *kvo)
 	const char *str;
 
 	xo_open_instance("object");
-        xo_emit("{:resident/%5jd} ", (uintmax_t)kvo->kvo_resident);
-	xo_emit("{:active/%5jd} ", (uintmax_t)kvo->kvo_active);
-	xo_emit("{:inactive/%5jd} ", (uintmax_t)kvo->kvo_inactive);
+	xo_emit("{:resident/%5ju} ", (uintmax_t)kvo->kvo_resident);
+	xo_emit("{:active/%5ju} ", (uintmax_t)kvo->kvo_active);
+	xo_emit("{:inactive/%5ju} ", (uintmax_t)kvo->kvo_inactive);
 	xo_emit("{:refcount/%3d} ", kvo->kvo_ref_count);
 	xo_emit("{:shadowcount/%3d} ", kvo->kvo_shadow_count);
 	switch (kvo->kvo_memattr) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711231910.vANJA9gl060002>