From jc@irbs.com  Wed Jan 19 07:54:26 2000
Return-Path: <jc@irbs.com>
Received: from irbs.irbs.com (irbs.irbs.com [209.36.62.129])
	by hub.freebsd.org (Postfix) with ESMTP id A2574152BE
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 19 Jan 2000 07:54:21 -0800 (PST)
	(envelope-from jc@irbs.com)
Received: (from jc@localhost)
	by irbs.irbs.com (8.8.5/8.8.5) id KAA05077;
	Wed, 19 Jan 2000 10:54:10 -0500 (EST)
Message-Id: <200001191554.KAA05077@irbs.irbs.com>
Date: Wed, 19 Jan 2000 10:54:10 -0500 (EST)
From: John Capo <jc@irbs.com>
Reply-To: jc@irbs.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: PATCH: vmstat column alignment, %ll not supported in -stable
X-Send-Pr-Version: 3.2

>Number:         16206
>Category:       bin
>Synopsis:       PATCH: vmstat column alignment, %ll not supported in -stable
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    schweikh
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 19 08:00:01 PST 2000
>Closed-Date:    Tue Jun 26 11:49:22 PDT 2001
>Last-Modified:  Tue Jun 26 11:50:11 PDT 2001
>Originator:     John Capo
>Release:        FreeBSD 3.4-STABLE i386
>Organization:
IRBS Engineering
>Environment:

3.4 system with high interrupt rate

>Description:

3.4 with latest vmstat.c MFC:

interrupt      total      rate
clk0 irq0    88009614       99
rtc0 irq8    112654001      127
pci irq12    1681736896     1910
pci irq15    824752586      937
pci irq10    1645044289     1869
pci irq11    206810620      234
fdc0 irq6           1        0
wdc0 irq14     149002        0
Total        264189713        1

Bogus column alignment and Total printed as 32 bit value.

With included patch:

interrupt         total     rate
clk0 irq0      88010165       99
rtc0 irq8     112654707      127
pci irq12    1681747863     1910
pci irq15     824757776      937
pci irq10    1645055676     1869
pci irq11     206811727      234
fdc0 irq6             1        0
wdc0 irq14       149004        0
Total        4559186919     5180


>How-To-Repeat:

Generate a bunch of interrupts, run vmstat -i

>Fix:

Index: vmstat.c
===================================================================
RCS file: /usr/cvs/src/usr.bin/vmstat/vmstat.c,v
retrieving revision 1.29.2.3
diff -u -r1.29.2.3 vmstat.c
--- vmstat.c	2000/01/18 17:39:38	1.29.2.3
+++ vmstat.c	2000/01/19 15:43:43
@@ -774,18 +774,18 @@
 		errx(1, "malloc");
 	kread(X_INTRCNT, intrcnt, (size_t)nintr);
 	kread(X_INTRNAMES, intrname, (size_t)inamlen);
-	(void)printf("interrupt      total      rate\n");
+	(void)printf("interrupt         total     rate\n");
 	inttotal = 0;
 	nintr /= sizeof(long);
 	while (--nintr >= 0) {
 		if (*intrcnt)
-			(void)printf("%-12s %8lu %8lu\n", intrname,
+			(void)printf("%-12s %10lu %8lu\n", intrname,
 			    *intrcnt, *intrcnt / uptime);
 		intrname += strlen(intrname) + 1;
 		inttotal += *intrcnt++;
 	}
-	(void)printf("Total        %8llu %8llu\n", inttotal,
-			inttotal / (u_int64_t) uptime);
+	(void)printf("Total        %10qu %8qu\n", inttotal,
+			inttotal / uptime);
 }
 
 void


>Release-Note:
>Audit-Trail:

From: John Capo <jc@irbs.com>
To: FreeBSD-gnats-submit@FreeBSD.ORG
Cc:  
Subject: Re: bin/16206: PATCH: vmstat column alignment, %ll not supported in -stable
Date: Wed, 19 Jan 2000 11:17:52 -0500

 Quoting John Capo (jc@irbs.com):
 > +	(void)printf("Total        %10qu %8qu\n", inttotal,
 > +			inttotal / uptime);
 
 I should have made the Total field width larger, perhaps very large.
 
         (void)printf("Total%18qu %8qu\n", inttotal,
 
 A field width of 10 overflows on several of my machines.
 
 
 
Responsible-Changed-From-To: freebsd-bugs->schweikh 
Responsible-Changed-By: mikeh 
Responsible-Changed-When: Sat Jun 23 21:59:11 PDT 2001 
Responsible-Changed-Why:  
Jens been doing some work with columns widths in vmstat. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=16206 
State-Changed-From-To: open->closed 
State-Changed-By: schweikh 
State-Changed-When: Tue Jun 26 11:49:22 PDT 2001 
State-Changed-Why:  
Fixed in -current. Thanks a bunch, John! 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=16206 
>Unformatted:
