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:
Julio M. Merino Vidal
2006-04-09 10:08:22 +00:00
committed by Benoît Dejean
parent 26d85d02fb
commit cead508eae
2 changed files with 21 additions and 0 deletions

View File

@@ -1,3 +1,12 @@
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.
2006-04-04 Benoît Dejean <benoit@placenet.org>
* sysinfo.c: (init_sysinfo):

View File

@@ -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;