Use statvfs(2) if available instead of statfs(2). The latter was replaced
2006-04-04 Julio M. Merino Vidal <jmmv@NetBSD.org> * sysdeps/freebsd/fsusage.c: Use statvfs(2) if available instead of statfs(2). The latter was replaced by the former and is no longer available under, e.g. NetBSD. Fixes bug #337235.
This commit is contained in:
committed by
Benoît Dejean
parent
26d85d02fb
commit
cead508eae
@@ -9,7 +9,11 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#if defined (HAVE_SYS_STATVFS_H)
|
||||
#include <sys/statvfs.h>
|
||||
#else
|
||||
#include <sys/mount.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -27,9 +31,17 @@ _glibtop_freebsd_get_fsusage_read_write(glibtop *server,
|
||||
const char *path)
|
||||
{
|
||||
int result;
|
||||
#if defined (STAT_STATVFS)
|
||||
struct statvfs sfs;
|
||||
#else
|
||||
struct statfs sfs;
|
||||
#endif
|
||||
|
||||
#if defined (STAT_STATVFS)
|
||||
result = statfs (path, &sfs);
|
||||
#else
|
||||
result = statfs (path, &sfs);
|
||||
#endif
|
||||
|
||||
if (result == -1) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user