pkgsrc/devel/libstatgrab/patches/patch-ac
sno 32d4ea2988 Updating devel/libstatgrab from 0.16 to 0.17
shared library version changed from 6.2.2 to 6.2.3 - I assume no revbump
needed

Upstream changes:
libstatgrab 0.17 (21 February 2010)
 * Provide iowait cpu information on Linux version 2.5.41 or later.
 * Display data for ZFS on Solaris.
 * Dynamically get list of valid filesystems on FreeBSD.
     (Thanks to Baptiste Daroussin)
 * Support FreeBSD 9.
 * Use utmpx when available (required for FreeBSD 9).
     (Thanks to Ed Schouten)
 * Support larger amounts of memory on FreeBSD.
     (Thanks to Tom Bird)
2010-08-24 06:33:10 +00:00

87 lines
2.1 KiB
Text

$NetBSD: patch-ac,v 1.3 2010/08/24 06:33:11 sno Exp $
--- src/libstatgrab/disk_stats.c.orig 2009-12-04 22:09:30.000000000 +0000
+++ src/libstatgrab/disk_stats.c
@@ -64,7 +64,9 @@
#include <sys/mount.h>
#endif
#if defined(FREEBSD) || defined(DFBSD)
+#if !defined(DFBSD)
#include <sys/dkstat.h>
+#endif
#include <devstat.h>
#include <sys/param.h>
#include <sys/mount.h>
@@ -457,7 +459,11 @@ sg_disk_io_stats *sg_get_disk_io_stats(i
struct devstat *dev_ptr;
#endif
#ifdef NETBSD
+#ifdef HW_DISKSTATS
struct disk_sysctl *stats;
+#else
+ struct io_sysctl *stats;
+#endif
#endif
#ifdef OPENBSD
int diskcount;
@@ -604,9 +610,15 @@ sg_disk_io_stats *sg_get_disk_io_stats(i
#if defined(NETBSD) || defined(OPENBSD)
mib[0] = CTL_HW;
+#ifdef HW_DISKSTATS
mib[1] = HW_DISKSTATS;
+#endif
#ifdef NETBSD
+#ifdef HW_DISKSTATS
mib[2] = sizeof(struct disk_sysctl);
+#else
+ mib[2] = sizeof(struct io_sysctl);
+#endif
#endif
if (sysctl(mib, MIBSIZE, NULL, &size, NULL, 0) < 0) {
@@ -615,8 +627,12 @@ sg_disk_io_stats *sg_get_disk_io_stats(i
}
#ifdef NETBSD
+#ifdef HW_DISKSTATS
num_disks = size / sizeof(struct disk_sysctl);
#else
+ num_disks = size / sizeof(struct io_sysctl);
+#endif
+#else
num_disks = size / sizeof(struct diskstats);
#endif
@@ -635,6 +651,7 @@ sg_disk_io_stats *sg_get_disk_io_stats(i
u_int64_t rbytes, wbytes;
#ifdef NETBSD
+#ifdef HW_DISKSTATS
#ifdef HAVE_DK_RBYTES
rbytes = stats[i].dk_rbytes;
wbytes = stats[i].dk_wbytes;
@@ -643,6 +660,10 @@ sg_disk_io_stats *sg_get_disk_io_stats(i
rbytes = wbytes = stats[i].dk_bytes;
#endif
#else
+ rbytes = stats[i].rbytes;
+ wbytes = stats[i].wbytes;
+#endif
+#else
#ifdef HAVE_DS_RBYTES
rbytes = stats[i].ds_rbytes;
wbytes = stats[i].ds_wbytes;
@@ -665,8 +686,12 @@ sg_disk_io_stats *sg_get_disk_io_stats(i
diskio_stats_ptr->read_bytes = rbytes;
diskio_stats_ptr->write_bytes = wbytes;
#ifdef NETBSD
+#ifdef HAVE_DISKSTATS
name = stats[i].dk_name;
#else
+ name = stats[i].name;
+#endif
+#else
name = dk_name[i];
#endif
if (sg_update_string(&diskio_stats_ptr->disk_name, name) < 0) {