[Bug 278532] vmstat percentages wrong on 32 bit systems

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 22 Apr 2024 19:15:15 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278532

            Bug ID: 278532
           Summary: vmstat percentages wrong on 32 bit systems
           Product: Base System
           Version: 14.0-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: jfc@mit.edu

Created attachment 250161
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=250161&action=edit
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.

-- 
You are receiving this mail because:
You are the assignee for the bug.