#include /* Although FreeBSD ships with statvfs it seems incomplete, so prefer statfs */ #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) #undef HAVE_SYS_STATVFS_H #undef STAT_STATVFS #endif #include #include #include #include #include #include #include #if defined (HAVE_SYS_STATVFS_H) #include #else #include #endif #include #include #include void _glibtop_bsd_get_fsusage_read_write(glibtop *server, glibtop_fsusage *buf, const char *path); void _glibtop_bsd_get_fsusage_read_write(glibtop *server, glibtop_fsusage *buf, const char *path) { int result; #if defined (STAT_STATVFS) struct statvfs sfs; #else struct statfs sfs; #endif #if defined (STAT_STATVFS) result = statvfs (path, &sfs); #else result = statfs (path, &sfs); #endif if (result == -1) { return; } #if !defined(__OpenBSD__) buf->read = sfs.f_syncreads + sfs.f_asyncreads; #endif buf->write = sfs.f_syncwrites + sfs.f_asyncwrites; buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE); }