829b59d5cd
read counts (f_syncreads and f_asyncreads) in statfs nor statvfs. Also do the same for write counts for consistency. Problem reported by Leonard Schmidt <lems at gmx.net> in tech-pkg@.
51 lines
1.1 KiB
Text
51 lines
1.1 KiB
Text
$NetBSD: patch-ad,v 1.2 2005/03/27 11:18:37 jmmv Exp $
|
|
|
|
--- sysdeps/freebsd/fsusage.c.orig 2005-02-28 09:54:41.000000000 +0100
|
|
+++ sysdeps/freebsd/fsusage.c
|
|
@@ -1,3 +1,7 @@
|
|
+#ifdef HAVE_CONFIG_H
|
|
+#include <config.h>
|
|
+#endif
|
|
+
|
|
#include <glibtop.h>
|
|
#include <glibtop/error.h>
|
|
#include <glibtop/fsusage.h>
|
|
@@ -9,6 +13,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>
|
|
@@ -26,16 +33,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
|
|
}
|