ports/sysutils/xosview/files/patch-kernel.cc
David E. O'Brien c9e00131ca 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?)
2001-08-21 18:33:51 +00:00

72 lines
2.4 KiB
C++

--- bsd/kernel.cc.orig Mon Jul 5 21:09:30 1999
+++ 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))
/*errx (-1, "kvm_nlist() lookup failed for symbol '%s'.", nlp->n_name);*/
+#if defined(XOSVIEW_FREEBSD) && defined(__alpha__)
+ /* XXX: this should be properly fixed. */
+ ;
+#else
warnx ("kvm_nlist() lookup failed for symbol '%s'.", nlp->n_name);
+#endif
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 -
nlst[INTRCNT_SYM_INDEX].n_value) / sizeof(int);
-#ifdef XOSVIEW_FREEBSD
- /* I'm not sure exactly how FreeBSD does things, but just do
+#if defined(i386)
+# if defined(XOSVIEW_FREEBSD)
+ /* I'm not sure exactly how FreeBSD/i386 does things, but just do
* 16 for now. bgrayson */
return 16;
-#else
-# if defined(i386)
+# else
/* On the 386 platform, we count stray interrupts between
* intrct and eintrcnt, also, but we don't want to show these. */
return nintr/2;
-# else
- return nintr;
# endif
+#else
+ return nintr;
#endif
}
#endif /* XOSVIEW_OPENBSD */
void
BSDGetIntrStats (unsigned long intrCount[NUM_INTR]) {
-#ifdef XOSVIEW_FREEBSD
+#if defined(XOSVIEW_FREEBSD) && defined(__i386__)
/* FreeBSD has an array of interrupt counts, indexed by device number.
These are also indirected by IRQ num with intr_countp: */
safe_kvm_read (nlst[INTRCOUNTP_SYM_INDEX].n_value,
@@ -839,10 +844,10 @@
intrCount[i] = kvm_intrptrs[i];
#endif /* _BSDI_VERSION */
-#else /* XOSVIEW_FREEBSD */
- // NetBSD/OpenBSD version, based on vmstat.c. Note that the pc532
- // platform does support intrcnt and eintrcnt, but vmstat uses
- // the more advanced event counters to provide software
+#else /* XOSVIEW_FREEBSD & i386 */
+ // NetBSD/OpenBSD & FreeBSD/Alpha version, based on vmstat.c.
+ // Note that the pc532 platform does support intrcnt and eintrcnt, but
+ // vmstat uses the more advanced event counters to provide software
// counts. We'll just use the intrcnt array here. If anyone
// has problems, please mail me. bgrayson
{