From 7001b0d29790e58891d1f5c989b5a396a9ec277d Mon Sep 17 00:00:00 2001 From: christos Date: Fri, 18 Aug 2000 22:43:53 +0000 Subject: Fix cp_time shit that broke post 1.4Z Fix uvm -> vm conversion lossage that broke post 1.5B Works with 1.5E and earlier. --- sysutils/xosview/patches/patch-ad | 53 ++++++++++++++++++++++++++++++++++++--- sysutils/xosview/patches/patch-af | 16 ++++++++++++ 2 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 sysutils/xosview/patches/patch-af diff --git a/sysutils/xosview/patches/patch-ad b/sysutils/xosview/patches/patch-ad index eadda40b4b8..b3c1f256b17 100644 --- a/sysutils/xosview/patches/patch-ad +++ b/sysutils/xosview/patches/patch-ad @@ -1,7 +1,7 @@ -$NetBSD: patch-ad,v 1.4 2000/06/27 08:15:51 tron Exp $ +$NetBSD: patch-ad,v 1.5 2000/08/18 22:43:53 christos Exp $ ---- bsd/kernel.cc.orig Tue Feb 16 15:09:21 1999 -+++ bsd/kernel.cc Tue Jun 27 10:13:23 2000 +--- bsd/kernel.cc.orig Tue Feb 16 09:09:21 1999 ++++ bsd/kernel.cc Fri Aug 18 18:36:14 2000 @@ -30,6 +30,10 @@ #include #include /* For CPUSTATES, which tells us how @@ -13,7 +13,18 @@ $NetBSD: patch-ad,v 1.4 2000/06/27 08:15:51 tron Exp $ #ifndef XOSVIEW_FREEBSD #include /* For disk statistics. */ #endif -@@ -67,7 +71,11 @@ +@@ -60,14 +64,22 @@ + #include + #include + #include ++#if defined(__NetBSD_Version__) && __NetBSD_Version__ > 105010000 /* > 1.5A */ ++#include ++#else + #include /* XXX Is this needed? */ ++#endif + #else + #include /* For struct vmmeter. */ + #endif #ifdef HAVE_SWAPCTL #include /* For swapctl proto. */ @@ -26,3 +37,37 @@ $NetBSD: patch-ad,v 1.4 2000/06/27 08:15:51 tron Exp $ #include /* For malloc(), free(). */ #endif +@@ -85,7 +97,11 @@ + // This struct has the list of all the symbols we want from the kernel. + static struct nlist nlst[] = + { ++#if defined(__NetBSD_Version__) && __NetBSD_Version__ > 104260000 /* > 1.4Z */ ++{ "_ifnet" }, /* XXX: LZ! Don't renumber */ ++#else + { "_cp_time" }, ++#endif + #define CP_TIME_SYM_INDEX 0 + { "_ifnet" }, + #define IFNET_SYM_INDEX 1 +@@ -293,7 +309,21 @@ + if (!timeArray) errx (-1, "BSDGetCPUTimes(): passed pointer was null!\n"); + if (CPUSTATES != 5) + errx (-1, "Error: xosview for *BSD expects 5 cpu states!\n"); ++#if defined(__NetBSD_Version__) && __NetBSD_Version__ > 104260000 /* > 1.4Z */ ++ int mib[2]; ++ struct schedstate_percpu ssp; ++ size_t size = sizeof(ssp.spc_cp_time); ++ mib[0] = CTL_KERN; ++ mib[1] = KERN_CP_TIME; ++ if (sysctl(mib, 2, ssp.spc_cp_time, &size, NULL, 0) < 0) { ++ printf("can't get schedstate_percpu: %s\n", strerror(errno)); ++ memset(&ssp, 0, sizeof(ssp)); ++ } ++ for (size = 0; size < CPUSTATES; size++) ++ timeArray[size] = (long) ssp.spc_cp_time[size]; ++#else + safe_kvm_read_symbol (CP_TIME_SYM_INDEX, timeArray, sizeof (long) * CPUSTATES); ++#endif + } + + diff --git a/sysutils/xosview/patches/patch-af b/sysutils/xosview/patches/patch-af new file mode 100644 index 00000000000..c21efde10d1 --- /dev/null +++ b/sysutils/xosview/patches/patch-af @@ -0,0 +1,16 @@ +$NetBSD: patch-af,v 1.1 2000/08/18 22:43:53 christos Exp $ + +--- bsd/pagemeter.h.orig Fri Aug 18 18:40:08 2000 ++++ bsd/pagemeter.h Fri Aug 18 18:22:28 2000 +@@ -22,7 +22,11 @@ + #include "fieldmetergraph.h" + #if defined(UVM) + #include ++#if defined(__NetBSD_Version__) && __NetBSD_Version__ > 105010000 /* > 1.5A */ ++#include ++#else + #include ++#endif + #include + #else + #include -- cgit v1.2.3