Subject: bin/29505: Csw value overflow in "systat vmstat"
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <njoly@pasteur.fr>
List: netbsd-bugs
Date: 02/22/2005 13:51:00
>Number: 29505
>Category: bin
>Synopsis: Csw value overflow in "systat vmstat"
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Feb 22 13:51:00 +0000 2005
>Originator: Nicolas Joly
>Release: NetBSD 2.99.16
>Organization:
Institut Pasteur, Paris.
>Environment:
System: NetBSD lanfeust.sis.pasteur.fr 2.99.16 NetBSD 2.99.16 (LANFEUST) #9: Fri Feb 18 16:10:29 CET 2005 njoly@lanfeust.sis.pasteur.fr:/local/src/NetBSD/obj/amd64/sys/arch/amd64/compile/LANFEUST amd64
Architecture: x86_64
Machine: amd64
>Description:
I noticed that Csw field in `systat vmstat' display sometimes overflow the
4 characters limit; by exmaple, while running some xscreensaver GL hacks:
Proc:r d s w Csw Trp Sys Int Sof Flt PAGING SWAPPING
1 13 **** 15424 22861 17 7614 7942 in out in out
Increasing the field to allow 5 characters give better result:
Proc:r d s w Csw Trp Sys Int Sof Flt PAGING SWAPPING
1 13 12927 13154 19840 5 6609 6677 in out in out
>How-To-Repeat:
>Fix:
Index: usr.bin/systat/vmstat.c
===================================================================
RCS file: /cvsroot/src/usr.bin/systat/vmstat.c,v
retrieving revision 1.57
diff -u -r1.57 vmstat.c
--- usr.bin/systat/vmstat.c 3 Feb 2005 16:16:00 -0000 1.57
+++ usr.bin/systat/vmstat.c 22 Feb 2005 13:37:43 -0000
@@ -142,7 +142,7 @@
#define PROCSROW 2 /* uses 2 rows and 20 cols */
#define PROCSCOL 0
#define GENSTATROW 2 /* uses 2 rows and 30 cols */
-#define GENSTATCOL 18
+#define GENSTATCOL 17
#define VMSTATROW 7 /* uses 17 rows and 15 cols */
#define VMSTATCOL 64
#define GRAPHROW 5 /* uses 3 rows and 51 cols */
@@ -355,7 +355,7 @@
if (LINES - 1 > VMSTATROW + 16)
mvprintw(VMSTATROW + 16, VMSTATCOL + 10, "pdscn");
- mvprintw(GENSTATROW, GENSTATCOL, " Csw Trp Sys Int Sof Flt");
+ mvprintw(GENSTATROW, GENSTATCOL, " Csw Trp Sys Int Sof Flt");
mvprintw(GRAPHROW, GRAPHCOL,
" . %% Sy . %% Us . %% Ni . %% In . %% Id");
@@ -540,12 +540,12 @@
PUTRATE(uvmexp.pgswapin, PAGEROW + 3, PAGECOL + 5, 5);
PUTRATE(uvmexp.pgswapout, PAGEROW + 3, PAGECOL + 10, 5);
- PUTRATE(uvmexp.swtch, GENSTATROW + 1, GENSTATCOL, 4);
- PUTRATE(uvmexp.traps, GENSTATROW + 1, GENSTATCOL + 4, 6);
- PUTRATE(uvmexp.syscalls, GENSTATROW + 1, GENSTATCOL + 10, 6);
- PUTRATE(uvmexp.intrs, GENSTATROW + 1, GENSTATCOL + 16, 5);
- PUTRATE(uvmexp.softs, GENSTATROW + 1, GENSTATCOL + 21, 5);
- PUTRATE(uvmexp.faults, GENSTATROW + 1, GENSTATCOL + 26, 6);
+ PUTRATE(uvmexp.swtch, GENSTATROW + 1, GENSTATCOL, 5);
+ PUTRATE(uvmexp.traps, GENSTATROW + 1, GENSTATCOL + 5, 6);
+ PUTRATE(uvmexp.syscalls, GENSTATROW + 1, GENSTATCOL + 11, 6);
+ PUTRATE(uvmexp.intrs, GENSTATROW + 1, GENSTATCOL + 17, 5);
+ PUTRATE(uvmexp.softs, GENSTATROW + 1, GENSTATCOL + 22, 5);
+ PUTRATE(uvmexp.faults, GENSTATROW + 1, GENSTATCOL + 27, 6);
for (l = 0, i = 0, r = DISKROW, c = DISKCOL; i < dk_ndrive; i++) {
if (!dk_select[i])
continue;