From 7957b1168ea9f51855a9d959e3d91fe7a48f318b Mon Sep 17 00:00:00 2001 From: deuce <> Date: Thu, 20 Apr 2006 18:18:50 +0000 Subject: [PATCH] NetBSD 3.0 has depreciated statfs() in favour of statvfs(). --- src/xpdev/dirwrap.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/xpdev/dirwrap.c b/src/xpdev/dirwrap.c index be581a7d4a..a5d42c5b46 100644 --- a/src/xpdev/dirwrap.c +++ b/src/xpdev/dirwrap.c @@ -51,9 +51,12 @@ #if defined(BSD) #include <sys/mount.h> + #endif #if defined(__FreeBSD__) #include <sys/kbio.h> #endif + #if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 300000000 /* NetBSD 3.0 */) + #include <sys/statvfs.h> #endif #include <sys/ioctl.h> /* ioctl */ @@ -737,23 +740,23 @@ ulong DLLCALL getfreediskspace(const char* path, ulong unit) return(NumberOfFreeClusters*SectorsPerCluster*BytesPerSector); -/* statfs is also used under FreeBSD */ -#elif defined(__GLIBC__) || defined(BSD) +#elif defined(__solaris__) || (defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 300000000 /* NetBSD 3.0 */)) - struct statfs fs; + struct statvfs fs; - if (statfs(path, &fs) < 0) + if (statvfs(path, &fs) < 0) return 0; if(unit>1) fs.f_bavail/=unit; return fs.f_bsize * fs.f_bavail; -#elif defined(__solaris__) +/* statfs is also used under FreeBSD (Though it *supports* statvfs() now too) */ +#elif defined(__GLIBC__) || defined(BSD) - struct statvfs fs; + struct statfs fs; - if (statvfs(path, &fs) < 0) + if (statfs(path, &fs) < 0) return 0; if(unit>1) -- GitLab