summaryrefslogtreecommitdiff
path: root/ext/standard
diff options
context:
space:
mode:
authorJon Parise <jon@php.net>2001-05-22 02:45:04 +0000
committerJon Parise <jon@php.net>2001-05-22 02:45:04 +0000
commit311278f273a7d39e07c8b23c028e97a3b11df9e5 (patch)
treed3813c937ecfa92353f7f5f6e71c96a77360e9ba /ext/standard
parent6aafbd6775d115f7e69a371714a80fc646ec2a62 (diff)
downloadphp-git-311278f273a7d39e07c8b23c028e97a3b11df9e5.tar.gz
@ - Fix disk_free_space() and disk_total_space() under FreeBSD. (jon)
FreeBSD defines statfs(2) in <sys/mount.h>. Teach PHP to look for it there.
Diffstat (limited to 'ext/standard')
-rw-r--r--ext/standard/filestat.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index ee19e0ceb2..c700403463 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -43,6 +43,8 @@
# include <sys/statvfs.h>
#elif defined(HAVE_SYS_STATFS_H) && defined(HAVE_STATFS)
# include <sys/statfs.h>
+#elif defined(HAVE_SYS_MOUNT_H) && defined(HAVE_STATFS)
+# include <sys/mount.h>
#endif
#if HAVE_PWD_H
@@ -151,7 +153,7 @@ PHP_FUNCTION(disk_total_space)
#else /* not - WINDOWS */
#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
struct statvfs buf;
-#elif defined(HAVE_SYS_STATFS_H) && defined(HAVE_STATFS)
+#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS)
struct statfs buf;
#endif
double bytestotal = 0;
@@ -215,7 +217,7 @@ PHP_FUNCTION(disk_total_space)
bytestotal = (((double)buf.f_blocks) * ((double)buf.f_bsize));
}
-#elif defined(HAVE_SYS_STATFS_H) && defined(HAVE_STATFS)
+#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS)
if (statfs((*path)->value.str.val,&buf)) RETURN_FALSE;
bytestotal = (((double)buf.f_bsize) * ((double)buf.f_blocks));
#endif
@@ -252,7 +254,7 @@ PHP_FUNCTION(disk_free_space)
#else /* not - WINDOWS */
#if defined(HAVE_SYS_STATVFS_H) && defined(HAVE_STATVFS)
struct statvfs buf;
-#elif defined(HAVE_SYS_STATFS_H) && defined(HAVE_STATFS)
+#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS)
struct statfs buf;
#endif
double bytesfree = 0;
@@ -315,7 +317,7 @@ PHP_FUNCTION(disk_free_space)
} else {
bytesfree = (((double)buf.f_bavail) * ((double)buf.f_bsize));
}
-#elif defined(HAVE_SYS_STATFS_H) && defined(HAVE_STATFS)
+#elif (defined(HAVE_SYS_STATFS_H) || defined(HAVE_SYS_MOUNT_H)) && defined(HAVE_STATFS)
if (statfs((*path)->value.str.val,&buf)) RETURN_FALSE;
bytesfree = (((double)buf.f_bsize) * ((double)buf.f_bavail));
#endif