$NetBSD: patch-ad,v 1.4 2006/06/06 22:11:57 minskim Exp $

--- sysdeps/freebsd/fsusage.c.orig	2005-12-12 10:09:39.000000000 +0000
+++ sysdeps/freebsd/fsusage.c
@@ -1,4 +1,8 @@
 #include <config.h>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <glibtop.h>
 #include <glibtop/error.h>
 #include <glibtop/fsusage.h>
@@ -10,6 +14,9 @@
 #include <unistd.h>
 #include <sys/param.h>
 #include <sys/mount.h>
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
 
 #include <stdio.h>
 #include <string.h>
@@ -27,16 +34,26 @@ _glibtop_freebsd_get_fsusage_read_write(
 				      const char *path)
 {
 	int result;
+#ifdef STAT_STATVFS
+	struct statvfs sfs;
+
+	result = statvfs (path, &sfs);
+#else
 	struct statfs sfs;
 
 	result = statfs (path, &sfs);
+#endif
 
 	if (result == -1) {
 		return;
 	}
 
+#ifdef HAVE_STATVFS_READS_COUNT
 	buf->read = sfs.f_syncreads + sfs.f_asyncreads;
+	buf->flags |= (1 << GLIBTOP_FSUSAGE_READ);
+#endif
+#ifdef HAVE_STATVFS_WRITES_COUNT
 	buf->write = sfs.f_syncwrites + sfs.f_asyncwrites;
-
-	buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE);
+	buf->flags |= (1 << GLIBTOP_FSUSAGE_WRITE);
+#endif
 }
