bin/60440: systat vmstat SysCal field can overflow

"[email protected] via gnats" <[email protected]>
Newsgroups gmane.os.netbsd.bugs
Message-ID <[email protected]>
>Number:         60440
>Category:       bin
>Synopsis:       systat vmstat SysCal field can overflow
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 11 13:30:01 +0000 2026
>Originator:     Havard Eidnes
>Release:        NetBSD 10.1
>Organization:
	I try...
>Environment:
System: NetBSD castor.urc.uninett.no 10.1 NetBSD 10.1 (GENERIC) #0: Mon Dec 16 13:08:11 UTC 2024  [email protected]:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
	The display of number of syscalls (per second?) in "systat
	vm" output can overflow, resulting in a display containing e.g.

Proc:r  d  s        Csw  Traps SysCal  Intr   Soft  Fault     PAGING   SWAPPING
    11  2 20        623   1637 ******   269    457   1637     in  out   in  out

	I would much prefer that the value is shown, scaled, e.g.

Proc:r  d  s        Csw  Traps SysCal  Intr   Soft  Fault     PAGING   SWAPPING
    10  2 16        654    210  3804K    63    453    210     in  out   in  out
	
>How-To-Repeat:
	Run "systat vm" on a reasonably high-end amd64 system, loaded
	with activity (e.g. a rust build with high MAKE_JOBS setting).
	This is especially visible during periods when rust-installer is run.
>Fix:
	It turns out this is fixable by removing code.

	Why the "time-based" values are not scaled?  Don't know,
	but it looks like the code was made this way conciously.

	Is this a reasonable change?

Index: vmstat.c
===================================================================
RCS file: /cvsroot/src/usr.bin/systat/vmstat.c,v
retrieving revision 1.92
diff -u -r1.92 vmstat.c
--- vmstat.c    28 Mar 2023 00:00:30 -0000      1.92
+++ vmstat.c    11 Jul 2026 13:14:24 -0000
@@ -783,10 +783,7 @@
        }
        (void)snprintf(b, sizeof b, "%*d", w, n);
        if ((int)strlen(b) > w) {
-               if (display_mode == TIME)
-                       hline('*', w);
-               else
-                       puthumanint(n, l, c, w);
+               puthumanint(n, l, c, w);
                return;
        }
        addstr(b);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.