Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Jan 2012 21:12:30 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r229208 - stable/9/usr.bin/vmstat
Message-ID:  <201201012112.q01LCUj3031083@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Sun Jan  1 21:12:29 2012
New Revision: 229208
URL: http://svn.freebsd.org/changeset/base/229208

Log:
  MFC r228654:
  
  In usr.bin/vmstat/vmstat.c, cast several printf field widths to int, and
  use printf format specifiers from inttypes.h for uint64_t's.

Modified:
  stable/9/usr.bin/vmstat/vmstat.c
Directory Properties:
  stable/9/usr.bin/vmstat/   (props changed)

Modified: stable/9/usr.bin/vmstat/vmstat.c
==============================================================================
--- stable/9/usr.bin/vmstat/vmstat.c	Sun Jan  1 21:06:07 2012	(r229207)
+++ stable/9/usr.bin/vmstat/vmstat.c	Sun Jan  1 21:12:29 2012	(r229208)
@@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$");
 #include <devstat.h>
 #include <err.h>
 #include <errno.h>
+#include <inttypes.h>
 #include <kvm.h>
 #include <limits.h>
 #include <memstat.h>
@@ -1185,18 +1186,18 @@ dointr(void)
 			istrnamlen = clen;
 		tintrname += clen + 1;
 	}
-	(void)printf("%-*s %20s %10s\n", istrnamlen, "interrupt", "total",
+	(void)printf("%-*s %20s %10s\n", (int)istrnamlen, "interrupt", "total",
 	    "rate");
 	inttotal = 0;
 	for (i = 0; i < nintr; i++) {
 		if (intrname[0] != '\0' && (*intrcnt != 0 || aflag))
-			(void)printf("%-*s %20lu %10lu\n", istrnamlen, intrname,
-			    *intrcnt, *intrcnt / uptime);
+			(void)printf("%-*s %20lu %10lu\n", (int)istrnamlen,
+			    intrname, *intrcnt, *intrcnt / uptime);
 		intrname += strlen(intrname) + 1;
 		inttotal += *intrcnt++;
 	}
-	(void)printf("%-*s %20llu %10llu\n", istrnamlen, "Total",
-	    (long long)inttotal, (long long)(inttotal / uptime));
+	(void)printf("%-*s %20" PRIu64 " %10" PRIu64 "\n", (int)istrnamlen,
+	    "Total", inttotal, inttotal / uptime);
 }
 
 static void
@@ -1235,9 +1236,9 @@ domemstat_malloc(void)
 		if (memstat_get_numallocs(mtp) == 0 &&
 		    memstat_get_count(mtp) == 0)
 			continue;
-		printf("%13s %5lld %5lldK %7s %8lld  ",
+		printf("%13s %5" PRIu64 " %5" PRIu64 "K %7s %8" PRIu64 "  ",
 		    memstat_get_name(mtp), memstat_get_count(mtp),
-		    ((int64_t)memstat_get_bytes(mtp) + 1023) / 1024, "-",
+		    (memstat_get_bytes(mtp) + 1023) / 1024, "-",
 		    memstat_get_numallocs(mtp));
 		first = 1;
 		for (i = 0; i < 32; i++) {
@@ -1289,7 +1290,8 @@ domemstat_zone(void)
 	    mtp = memstat_mtl_next(mtp)) {
 		strlcpy(name, memstat_get_name(mtp), MEMTYPE_MAXNAME);
 		strcat(name, ":");
-		printf("%-20s %6llu, %6llu,%8llu,%8llu,%8llu,%4llu,%4llu\n",name,
+		printf("%-20s %6" PRIu64 ", %6" PRIu64 ",%8" PRIu64 ",%8" PRIu64
+		    ",%8" PRIu64 ",%4" PRIu64 ",%4" PRIu64 "\n", name,
 		    memstat_get_size(mtp), memstat_get_countlimit(mtp),
 		    memstat_get_count(mtp), memstat_get_free(mtp),
 		    memstat_get_numallocs(mtp), memstat_get_failures(mtp),



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