/* $OpenBSD: fsusage.c,v 1.4 2011/05/31 19:25:31 jasper Exp $ */ #include /* * statvfs is lacking various members which are present in statfs, * like f_(a)syncreads and f_(a)syncwrites. So eventhough we have * statvfs, undef it here untill those members are added. */ #undef HAVE_SYS_STATVFS_H #undef STAT_STATVFS #include #include #include #include #include #include #include #if defined (HAVE_SYS_STATVFS_H) #include #else #include #endif #include #include #include void _glibtop_openbsd_get_fsusage_read_write(glibtop *server, glibtop_fsusage *buf, const char *path); void _glibtop_openbsd_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; } buf->read = sfs.f_syncreads + sfs.f_asyncreads; buf->write = sfs.f_syncwrites + sfs.f_asyncwrites; buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE); }