diff options
author | ru <ru@FreeBSD.org> | 2006-11-28 12:46:02 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2006-11-28 12:46:02 +0000 |
commit | 3b8270a3d54536f75863cb20eeed53f240d24ba5 (patch) | |
tree | 54a4571abbdb6a65f55daa94a9fdb8f8253b31fb /usr.bin/vmstat | |
parent | dec1d110aeb2a55ab4ada2307d9fe7440425153d (diff) | |
download | FreeBSD-src-3b8270a3d54536f75863cb20eeed53f240d24ba5.zip FreeBSD-src-3b8270a3d54536f75863cb20eeed53f240d24ba5.tar.gz |
- Revert signedness type changes to "struct vmtotal"; by making
them unsigned I made the possible overflows hard to detect,
and it only saved 1 bit which isn't principal, even less now
that the underlying issue with the total of virtual memory has
been fixed. (For the record, it will overflow with >=2T of
VM total, with 32-bit ints used to keep counters in pages.)
- While here, fix printing of other "struct vmtotal" members
such as t_rq, t_dw, t_pw, and t_sw as they are also signed.
Reviewed by: bde
MFC after: 3 days
Diffstat (limited to 'usr.bin/vmstat')
-rw-r--r-- | usr.bin/vmstat/vmstat.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index ef5ba8a..efd5b79 100644 --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include <devstat.h> #include <err.h> #include <errno.h> -#include <inttypes.h> #include <kvm.h> #include <limits.h> #include <memstat.h> @@ -575,11 +574,11 @@ dovmstat(unsigned int interval, int reps) fill_vmmeter(&sum); fill_vmtotal(&total); - (void)printf("%2u %1u %1u", + (void)printf("%2d %1d %1d", total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw); -#define vmstat_pgtok(a) ((uintmax_t)(a) * (sum.v_page_size >> 10)) +#define vmstat_pgtok(a) ((a) * (sum.v_page_size >> 10)) #define rate(x) (((x) + halfuptime) / uptime) /* round */ - (void)printf(" %7ju %6ju ", vmstat_pgtok(total.t_avm), + (void)printf(" %7d %6d ", vmstat_pgtok(total.t_avm), vmstat_pgtok(total.t_free)); (void)printf("%5lu ", (unsigned long)rate(sum.v_vm_faults - osum.v_vm_faults)); |