$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 +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include @@ -10,6 +14,9 @@ #include #include #include +#ifdef HAVE_SYS_STATVFS_H +#include +#endif #include #include @@ -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 }