Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Jul 2003 18:33:15 +0100 (BST)
From:      Bruce M Simpson <bms@spc.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/55124: [PATCH] request total incorrectly reported by vmstat(8)
Message-ID:  <20030731173315.980BE53F@saboteur.dek.spc.org>
Resent-Message-ID: <200307311740.h6VHeBSS094467@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         55124
>Category:       bin
>Synopsis:       [PATCH] request total incorrectly reported by vmstat(8)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 31 10:40:10 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Bruce M Simpson
>Release:        FreeBSD 4.8-RELEASE i386
>Organization:
>Environment:
System: FreeBSD arginine.spc.org 4.8-RELEASE FreeBSD 4.8-RELEASE #0: Tue Jul  8 15:15:51 BST 2003     root@arginine.spc.org:/usr/src/sys/compile/ARGININE  i386

	
>Description:
	Under RELENG_4, the running total of requests for each subsystem
	client of the vm (vmstat -m) is incorrectly reported due to the use
	of a signed (vs unsigned) integer.
	
>How-To-Repeat:
	
>Fix:

	Please apply the patch below to correct the problem,
	in /usr/src/usr.bin/vmstat.

--- vmstat_totreq.patch begins here ---
--- vmstat.c.orig	Thu Jul 31 18:26:36 2003
+++ vmstat.c	Thu Jul 31 18:27:00 2003
@@ -758,7 +758,8 @@
 	register struct malloc_type *ks;
 	register int i, j;
 	int len, size, first, nkms;
-	long totuse = 0, totfree = 0, totreq = 0;
+	long totuse = 0, totfree = 0;
+	unsigned long totreq = 0;
 	const char *name;
 	struct malloc_type kmemstats[MAX_KMSTATS], *kmsp;
 	char buf[1024];
@@ -862,7 +863,7 @@
 		totreq += ks->ks_calls;
 	}
 	(void)printf("\nMemory Totals:  In Use    Free    Requests\n");
-	(void)printf("              %7ldK %6ldK    %8ld\n",
+	(void)printf("              %7ldK %6ldK    %8lu\n",
 	     (totuse + 1023) / 1024, (totfree + 1023) / 1024, totreq);
 }
 
--- vmstat_totreq.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030731173315.980BE53F>