Fix an overflow when calculating the number of kilobytes from the

number of pages.

Obtained from:	Yahoo!
This commit is contained in:
Paul Saab 2005-02-21 14:35:00 +00:00
parent c364c823d0
commit 043da612df
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=142175
2 changed files with 2 additions and 2 deletions

View File

@ -472,7 +472,7 @@ showkre()
putfloat(avenrun[1], STATROW, STATCOL + 23, 6, 2, 0);
putfloat(avenrun[2], STATROW, STATCOL + 29, 6, 2, 0);
mvaddstr(STATROW, STATCOL + 53, buf);
#define pgtokb(pg) ((pg) * s.v_page_size / 1024)
#define pgtokb(pg) ((pg) * (s.v_page_size / 1024))
putint(pgtokb(total.t_arm), MEMROW + 2, MEMCOL + 3, 8);
putint(pgtokb(total.t_armshr), MEMROW + 2, MEMCOL + 11, 8);
putint(pgtokb(total.t_avm), MEMROW + 2, MEMCOL + 19, 9);

View File

@ -588,7 +588,7 @@ dovmstat(unsigned int interval, int reps)
fill_vmtotal(&total);
(void)printf("%2d %1d %1d",
total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw);
#define vmstat_pgtok(a) ((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(" %7ld %6ld ", (long)vmstat_pgtok(total.t_avm),
(long)vmstat_pgtok(total.t_free));