From e2cf520799de1aa7cd52333651faf4e0cb0c14f1 Mon Sep 17 00:00:00 2001 From: Jeroen Ruigrok van der Werven Date: Sat, 13 Apr 2002 10:32:36 +0000 Subject: [PATCH] Fix a missed conversion of lld to llu for the uint64_t ks_calls and cast to unsigned long long. Don't be too overzealous with the printing of ks_calls in the total statistics, cut back from 20 to 13 positions to print (which should last a couple of years easily (20 digits is enough for 3168 years of calls at a measly billion (10^9) calls per second.)). Submitted by: bde --- usr.bin/vmstat/vmstat.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index cc312c61840..9b7edf5b475 100644 --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -787,11 +787,12 @@ domem() for (i = 0, ks = &kmemstats[0]; i < nkms; i++, ks++) { if (ks->ks_calls == 0) continue; - (void)printf("%13s%6ld%6ldK%7ldK%6ldK%9lld%5u%6u", + (void)printf("%13s%6ld%6ldK%7ldK%6ldK%9llu%5u%6u", ks->ks_shortdesc, ks->ks_inuse, (ks->ks_memuse + 1023) / 1024, (ks->ks_maxused + 1023) / 1024, - (ks->ks_limit + 1023) / 1024, (long long)ks->ks_calls, + (ks->ks_limit + 1023) / 1024, + (unsigned long long)ks->ks_calls, ks->ks_limblocks, ks->ks_mapblocks); first = 1; for (j = 1 << MINBUCKET; j < 1 << (MINBUCKET + 16); j <<= 1) { @@ -811,10 +812,10 @@ domem() totuse += ks->ks_memuse; totreq += ks->ks_calls; } - (void)printf("\nMemory Totals: In Use Free Requests\n"); - (void)printf(" %7ldK %6ldK %20llu\n", - (totuse + 1023) / 1024, - (totfree + 1023) / 1024, (unsigned long long)totreq); + (void)printf("\nMemory Totals: In Use Free Requests\n"); + (void)printf(" %7ldK %6ldK %13llu\n", + (totuse + 1023) / 1024, (totfree + 1023) / 1024, + (unsigned long long)totreq); } void