Bug 278532 - vmstat percentages wrong on 32 bit systems
Summary: vmstat percentages wrong on 32 bit systems
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 14.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-22 19:15 UTC by John F. Carr
Modified: 2024-11-14 23:22 UTC (History)
2 users (show)

See Also:


Attachments
Fix xo_emit format string for percentages (625 bytes, patch)
2024-04-22 19:15 UTC, John F. Carr
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John F. Carr 2024-04-22 19:15:15 UTC
Created attachment 250161 [details]
Fix xo_emit format string for percentages

When (long) and (long long) are different sizes vmstat reports garbage for the CPU percentage columns.  From arm.armv7 running FreeBSD 14:

# vmstat
 procs    memory    page                      disks       faults       cpu
 r  b  w  avm  fre  flt  re  pi  po   fr   sr mmc0  da0   in   sy   cs us sy id
 4  0  0 494M 1.2G  278   0   1   0  351   22    0    0 1.7k  603  279 3499288 538751558161 538751558161

The call to xo_emit in usr.bin/vmstat/vmstat.c function percent() passes " {:user/%2lld/%lld}" as the format string but (long) as the argument type.  Changing "lld" to "ld" fixes the bug.
Comment 1 John F. Carr 2024-07-24 09:39:35 UTC
https://github.com/freebsd/freebsd-src/pull/1344
Comment 2 CaroleWCollins 2024-11-14 07:46:29 UTC
MARKED AS SPAM