From 65ee1e9f17828b5e80a0a016951814f149e9bb89 Mon Sep 17 00:00:00 2001 From: christos Date: Mon, 5 Jun 2006 02:35:30 +0000 Subject: [PATCH] Make this compile again. --- sysutils/xosview/distinfo | 3 +- sysutils/xosview/patches/patch-aa | 75 +++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 sysutils/xosview/patches/patch-aa diff --git a/sysutils/xosview/distinfo b/sysutils/xosview/distinfo index 4b21623522ba..a6e8504f29af 100644 --- a/sysutils/xosview/distinfo +++ b/sysutils/xosview/distinfo @@ -1,5 +1,6 @@ -$NetBSD: distinfo,v 1.16 2006/03/14 15:48:01 rillig Exp $ +$NetBSD: distinfo,v 1.17 2006/06/05 02:35:30 christos Exp $ SHA1 (xosview-1.8.3.tar.gz) = 420fd0620ff9fb9ba83fc833eeb8b872414e377e RMD160 (xosview-1.8.3.tar.gz) = 595e812dee686ccaa5d95eb537782679d752271b Size (xosview-1.8.3.tar.gz) = 259793 bytes +SHA1 (patch-aa) = 094b0fc6e27b8ea92bcd0e0040e7d211395ed97e diff --git a/sysutils/xosview/patches/patch-aa b/sysutils/xosview/patches/patch-aa new file mode 100644 index 000000000000..b7b27988890d --- /dev/null +++ b/sysutils/xosview/patches/patch-aa @@ -0,0 +1,75 @@ +$NetBSD: patch-aa,v 1.13 2006/06/05 02:35:30 christos Exp $ + +--- bsd/kernel.cc.orig 2006-06-04 22:19:00.000000000 -0400 ++++ bsd/kernel.cc 2006-06-04 22:31:47.000000000 -0400 +@@ -21,6 +21,8 @@ + /* NetBSD pulls in stdio.h via one of the other includes, but + * the other BSDs don't. */ + # include ++#else ++# define UVM + #endif + + #include +@@ -115,6 +117,13 @@ + // in __NetBSD_Version__ for us if needed. + #if defined(XOSVIEW_NETBSD) && defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 106010000) + #define NETBSD_1_6A ++#ifdef HW_DISKSTATS ++static int dmib[3] = {CTL_HW, HW_DISKSTATS, sizeof(struct disk_sysctl)}; ++#endif ++#ifdef HW_IOSTATS ++static int dmib[3] = {CTL_HW, HW_IOSTATS, sizeof(struct io_sysctl)}; ++#include ++#endif + #endif + + #include "general.h" +@@ -773,13 +782,12 @@ + #ifdef NETBSD_1_6A + // Do a sysctl with a NULL data pointer to get the size that would + // have been returned, and use that to figure out # drives. +- int mib[3] = {CTL_HW, HW_DISKSTATS, sizeof(struct disk_sysctl)}; + size_t size; +- if (sysctl(mib, 3, NULL, &size, NULL, 0) < 0) { ++ if (sysctl(dmib, 3, NULL, &size, NULL, 0) < 0) { + warnx("!!! The DiskMeter sysctl failed. Disabling DiskMeter."); + return 0; + } +- NetBSD_N_Drives = size / sizeof(struct disk_sysctl); ++ NetBSD_N_Drives = size / dmib[2]; + return 1; + #endif + return ValidSymbol(DISKLIST_SYM_INDEX); +@@ -816,19 +824,28 @@ + #else + #if defined(NETBSD_1_6A) + // Use the new sysctl to do this for us. +- int mib[3] = {CTL_HW, HW_DISKSTATS, sizeof(struct disk_sysctl)}; +- size_t sysctl_sz = NetBSD_N_Drives * sizeof(struct disk_sysctl); ++ size_t sysctl_sz = NetBSD_N_Drives * dmib[2]; ++#ifdef HW_DISKSTATS + struct disk_sysctl drive_stats[NetBSD_N_Drives]; ++#endif ++#ifdef HW_IOSTATS ++ struct io_sysctl drive_stats[NetBSD_N_Drives]; ++#endif + + // Do the sysctl. +- if (sysctl(mib, 3, drive_stats, &sysctl_sz, NULL, 0) < 0) { ++ if (sysctl(dmib, 3, drive_stats, &sysctl_sz, NULL, 0) < 0) { + err(1, "sysctl hw.diskstats failed"); + } + + // Now accumulate the total. + unsigned long long xferred = 0; + for (unsigned int i = 0; i < NetBSD_N_Drives; i++) { ++#ifdef HW_DISKSTATS + xferred += drive_stats[i].dk_rbytes + drive_stats[i].dk_wbytes; ++#endif ++#ifdef HW_IOSTATS ++ xferred += drive_stats[i].rbytes + drive_stats[i].wbytes; ++#endif + } + *bytesXferred = xferred; + #else