diff --git a/configure.ac b/configure.ac index a7086c16..e5c747a1 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ AC_HEADER_DIRENT AC_HEADER_TIME AC_CHECK_HEADERS([fcntl.h stddef.h stdint.h stdlib.h string.h limits.h]) AC_CHECK_HEADERS([unistd.h getopt.h fnmatch.h io.h inttypes.h byteswap.h]) -AC_CHECK_HEADERS([sys/time.h sys/file.h sys/ioctl.h sys/vfs.h sys/statfs.h]) +AC_CHECK_HEADERS([sys/time.h sys/file.h sys/ioctl.h sys/vfs.h sys/statfs.h sys/param.h sys/mount.h]) AC_CHECK_HEADERS([linux/fiemap.h linux/fs.h]) dnl Checks for typedefs, structures, and compiler characteristics. @@ -52,6 +52,12 @@ AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec, struct stat.st_mtimensec, struct #endif ]]) AC_CHECK_MEMBERS([struct statfs.f_type], [], [], [[ +#if HAVE_SYS_PARAM_H +#include +#endif +#if HAVE_SYS_MOUNT_H +#include +#endif #if HAVE_SYS_VFS_H #include #endif diff --git a/portable.h b/portable.h index b5e96b14..4922d2f0 100644 --- a/portable.h +++ b/portable.h @@ -31,7 +31,44 @@ #include #endif -/* Include some standard headers */ +/** + * Includes some platform specific headers. + */ +#if HAVE_SYS_PARAM_H +#include +#endif + +#if HAVE_SYS_MOUNT_H +#include +#endif + +#if HAVE_SYS_VFS_H +#include +#endif + +#if HAVE_SYS_STATFS_H +#include +#endif + +#if HAVE_SYS_FILE_H +#include +#endif + +#if HAVE_SYS_IOCTL_H +#include +#endif + +#if HAVE_LINUX_FS_H +#include +#endif + +#if HAVE_LINUX_FIEMAP_H +#include +#endif + +/** + * Includes some standard headers. + */ #include #include /* On many systems (e.g., Darwin), `stdio.h' is a prerequisite. */ #include @@ -66,22 +103,6 @@ #endif #endif -#if HAVE_SYS_FILE_H -#include -#endif - -#if HAVE_SYS_IOCTL_H -#include -#endif - -#if HAVE_LINUX_FS_H -#include -#endif - -#if HAVE_LINUX_FIEMAP_H -#include -#endif - #if HAVE_DIRENT_H #include #define NAMLEN(dirent) strlen((dirent)->d_name) @@ -107,14 +128,6 @@ #include #endif -#if HAVE_SYS_VFS_H -#include -#endif - -#if HAVE_SYS_STATFS_H -#include -#endif - #if HAVE_GETOPT_H #include #endif @@ -145,7 +158,7 @@ #endif /** - * Enable lock file support. + * Enables lock file support. */ #if HAVE_FLOCK && HAVE_FTRUNCATE #define HAVE_LOCKFILE 1 diff --git a/unix.c b/unix.c index beb2a401..3418c1f0 100644 --- a/unix.c +++ b/unix.c @@ -170,9 +170,7 @@ int filephy(const char* path, struct stat* st, uint64_t* physical) int fsinfo(const char* path, int* has_persistent_inode) { -/* statfs() is really not portable, and to limit possible incompatibility we limit it to Linux */ -/* for example, Solaris doesn't have the f_type field, BSD has it as "short" */ -#if HAVE_STATFS && HAVE_STRUCT_STATFS_F_TYPE && defined(__linux__) +#if HAVE_STATFS && HAVE_STRUCT_STATFS_F_TYPE struct statfs st; if (statfs(path, &st) != 0)