Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Dec 2011 19:22:24 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r228654 - head/usr.bin/vmstat
Message-ID:  <201112171922.pBHJMOq8073242@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Sat Dec 17 19:22:24 2011
New Revision: 228654
URL: http://svn.freebsd.org/changeset/base/228654

Log:
  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.
  
  MFC after:	1 week

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

Modified: head/usr.bin/vmstat/vmstat.c
==============================================================================
--- head/usr.bin/vmstat/vmstat.c	Sat Dec 17 19:21:40 2011	(r228653)
+++ head/usr.bin/vmstat/vmstat.c	Sat Dec 17 19:22:24 2011	(r228654)
@@ -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?201112171922.pBHJMOq8073242>