From 745e79021f915f8e0844568d94bf2fe690272cc1 Mon Sep 17 00:00:00 2001 From: obrien Date: Tue, 21 Aug 2001 18:33:51 +0000 Subject: Use longs vs. ints in calculating the amount of swap. This fixed getting negative swap values on an Alpha with 2GB swap. I should probably use `long long' for large swap x86 machines. (anybody want to help test?) --- sysutils/xosview/files/patch-kernel.cc | 11 ++++++++++- sysutils/xosview/files/patch-kernel.h | 11 ++++++++++- sysutils/xosview/files/patch-swapinternal.cc | 24 ++++++++++++++++++++++++ sysutils/xosview/files/patch-swapinternal.h | 12 ++++++++++++ sysutils/xosview/files/patch-swapmeter.cc | 7 +++++++ 5 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 sysutils/xosview/files/patch-swapinternal.cc create mode 100644 sysutils/xosview/files/patch-swapinternal.h create mode 100644 sysutils/xosview/files/patch-swapmeter.cc diff --git a/sysutils/xosview/files/patch-kernel.cc b/sysutils/xosview/files/patch-kernel.cc index 7cf6989..0639463 100644 --- a/sysutils/xosview/files/patch-kernel.cc +++ b/sysutils/xosview/files/patch-kernel.cc @@ -1,5 +1,5 @@ --- bsd/kernel.cc.orig Mon Jul 5 21:09:30 1999 -+++ bsd/kernel.cc Sat Jun 10 14:25:05 2000 ++++ bsd/kernel.cc Tue Aug 21 10:49:26 2001 @@ -284,7 +284,12 @@ while (nlp && nlp->n_name) { if ((nlp->n_type == 0) || (nlp->n_value == 0)) @@ -13,6 +13,15 @@ nlp++; } #ifdef HAVE_DEVSTAT +@@ -457,7 +462,7 @@ + // + + void +-BSDGetSwapCtlInfo(int *totalp, int *freep) { ++BSDGetSwapCtlInfo(long *totalp, long *freep) { + int totalinuse, totalsize; + int rnswap, nswap = swapctl(SWAP_NSWAP, 0, 0); + struct swapent *swapiter; @@ -792,25 +797,25 @@ OpenKDIfNeeded(); nintr = (nlst[EINTRCNT_SYM_INDEX].n_value - diff --git a/sysutils/xosview/files/patch-kernel.h b/sysutils/xosview/files/patch-kernel.h index 183fbbf..bd90af3 100644 --- a/sysutils/xosview/files/patch-kernel.h +++ b/sysutils/xosview/files/patch-kernel.h @@ -1,5 +1,14 @@ --- bsd/kernel.h.orig Fri May 29 14:21:36 1998 -+++ bsd/kernel.h Sat Jun 10 14:18:22 2000 ++++ bsd/kernel.h Tue Aug 21 10:50:17 2001 +@@ -52,7 +52,7 @@ + + #ifdef HAVE_SWAPCTL + void +-BSDGetSwapCtlInfo(int* total, int* free); ++BSDGetSwapCtlInfo(long* total, long* free); + #endif + + int @@ -67,7 +67,11 @@ #endif diff --git a/sysutils/xosview/files/patch-swapinternal.cc b/sysutils/xosview/files/patch-swapinternal.cc new file mode 100644 index 0000000..17d6fe9 --- /dev/null +++ b/sysutils/xosview/files/patch-swapinternal.cc @@ -0,0 +1,24 @@ +--- bsd/swapinternal.cc.orig Tue Nov 16 23:16:20 1999 ++++ bsd/swapinternal.cc Tue Aug 21 11:27:26 2001 +@@ -437,16 +437,17 @@ + #endif /* XOSVIEW_FREEBSD */ + + void +-BSDGetSwapInfo(int* total, int* free) ++BSDGetSwapInfo(long* total, long* free) + { +- int i, avail, npfree, used=0, xsize, xfree; ++ int i, npfree, xsize, xfree; ++ long avail, used=0; + + fetchswap(); + #ifdef USE_KVM_GETSWAPINFO + avail = used = 0; + if (kvnsw == 0) { +- avail += pagesize * kvmsw[0].ksw_total; +- used += pagesize * kvmsw[0].ksw_used; ++ avail += pagesize * (long)kvmsw[0].ksw_total; ++ used += pagesize * (long)kvmsw[0].ksw_used; + } + *total = avail; + *free = avail - used; diff --git a/sysutils/xosview/files/patch-swapinternal.h b/sysutils/xosview/files/patch-swapinternal.h new file mode 100644 index 0000000..1490023 --- /dev/null +++ b/sysutils/xosview/files/patch-swapinternal.h @@ -0,0 +1,12 @@ +--- bsd/swapinternal.h.orig Wed Feb 11 21:04:07 1998 ++++ bsd/swapinternal.h Tue Aug 21 10:51:00 2001 +@@ -12,7 +12,7 @@ + BSDInitSwapInfo(); + + void +-BSDGetSwapInfo(int* total, int* free); ++BSDGetSwapInfo(long* total, long* free); + + void +-BSDGetSwapCtlInfo(int* total, int* free); ++BSDGetSwapCtlInfo(long* total, long* free); diff --git a/sysutils/xosview/files/patch-swapmeter.cc b/sysutils/xosview/files/patch-swapmeter.cc new file mode 100644 index 0000000..e1a9316 --- /dev/null +++ b/sysutils/xosview/files/patch-swapmeter.cc @@ -0,0 +1,7 @@ +--- bsd/swapmeter.cc.orig Tue Aug 21 10:52:35 2001 ++++ bsd/swapmeter.cc Tue Aug 21 10:53:02 2001 +@@ -76,3 +76,3 @@ + void SwapMeter::getswapinfo( void ){ +- int total_int, free_int; ++ long total_int, free_int; + -- cgit v1.1