Subject: pkg/23304: Package xosview shows negative swap
To: None <gnats-bugs@gnats.netbsd.org>
From: None <franklin@elfie.org>
List: netbsd-bugs
Date: 10/29/2003 11:02:42
>Number: 23304
>Category: pkg
>Synopsis: xosview shows negative swap when swap space exceeds 2G
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Oct 29 16:03:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: John Franklin
>Release: NetBSD 1.6ZE
>Organization:
>Environment:
System: NetBSD deathmitten 1.6ZE NetBSD 1.6ZE (GENERIC.MP) #0: Wed Oct 29 02:05:08 EST 2003 franklin@deathmitten:/usr/src/sys/arch/i386/compile/GENERIC.MP i386
Architecture: i386
Machine: i386
>Description:
When there is more than 2G of swap space on the system, the swap meter gets
confused. The swap size is read into ints, which above 2G gets the sign bit
set.
>How-To-Repeat:
Configure a machine with more than 2G of swap, run xosview, use enough
memory to start swapping.
>Fix:
Store the swap used/total/free in unsigned longs.
Apply the following additional patch into work/xosview-1.7.0.b/bsd:
--- swapinternal.cc.orig2 2003-10-29 09:59:25.000000000 -0500
+++ swapinternal.cc 2003-10-29 10:01:24.000000000 -0500
@@ -313,9 +313,9 @@
#endif /* XOSVIEW_FREEBSD */
void
-BSDGetSwapInfo(int* total, int* free)
+BSDGetSwapInfo(unsigned long* total, unsigned long* free)
{
- int i, avail, npfree, used=0, xsize, xfree;
+ unsigned long i, avail, npfree, used=0, xsize, xfree;
fetchswap();
avail = npfree = 0;
--- swapinternal.h.orig2 2003-10-29 09:56:48.000000000 -0500
+++ swapinternal.h 2003-10-29 09:57:05.000000000 -0500
@@ -12,7 +12,7 @@
BSDInitSwapInfo();
void
-BSDGetSwapInfo(int* total, int* free);
+BSDGetSwapInfo(unsigned long* total, unsigned long* free);
void
-BSDGetSwapCtlInfo(int* total, int* free);
+BSDGetSwapCtlInfo(unsigned long* total, unsigned long* free);
--- swapmeter.cc.orig2 2003-10-29 09:56:07.000000000 -0500
+++ swapmeter.cc 2003-10-29 09:56:26.000000000 -0500
@@ -74,7 +74,7 @@
}
void SwapMeter::getswapinfo( void ){
- int total_int, free_int;
+ unsigned long total_int, free_int;
if (doSwap) {
#ifdef HAVE_SWAPCTL
>Release-Note:
>Audit-Trail:
>Unformatted: