diff options
author | Darren Tucker <dtucker@dtucker.net> | 2018-02-25 11:22:57 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@dtucker.net> | 2018-02-26 00:09:04 +1100 |
commit | 11057564eb6ab8fd987de50c3d7f394c6f6632b7 (patch) | |
tree | 0702d5182bb32de607b84110e36e3a2f167b13a7 | |
parent | e9dede06e5bc582a4aeb5b1cd5a7a640d7de3609 (diff) |
bsd-statvfs: include sys/vfs.h, check for f_flags.
-rw-r--r-- | configure.ac | 18 | ||||
-rw-r--r-- | openbsd-compat/bsd-statvfs.c | 8 | ||||
-rw-r--r-- | openbsd-compat/bsd-statvfs.h | 3 |
3 files changed, 29 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 605844ba..e9762ba6 100644 --- a/configure.ac +++ b/configure.ac @@ -409,6 +409,7 @@ AC_CHECK_HEADERS([ \ sys/sysmacros.h \ sys/time.h \ sys/timers.h \ + sys/vfs.h \ time.h \ tmpdir.h \ ttyent.h \ @@ -3659,6 +3660,23 @@ AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t], , , [ #endif ]) +AC_CHECK_MEMBERS([struct statfs.f_flags], [], [], [[ +#include <sys/types.h> +#ifdef HAVE_SYS_BITYPES_H +#include <sys/bitypes.h> +#endif +#ifdef HAVE_SYS_STATFS_H +#include <sys/statfs.h> +#endif +#ifdef HAVE_SYS_STATVFS_H +#include <sys/statvfs.h> +#endif +#ifdef HAVE_SYS_VFS_H +#include <sys/vfs.h> +#endif +]]) + + AC_CHECK_TYPES([in_addr_t, in_port_t], , , [#include <sys/types.h> #include <netinet/in.h>]) diff --git a/openbsd-compat/bsd-statvfs.c b/openbsd-compat/bsd-statvfs.c index 458dbe89..e3bd87d9 100644 --- a/openbsd-compat/bsd-statvfs.c +++ b/openbsd-compat/bsd-statvfs.c @@ -25,6 +25,10 @@ #include <errno.h> +#ifndef MNAMELEN +# define MNAMELEN 32 +#endif + static void copy_statfs_to_statvfs(struct statvfs *to, struct statfs *from) { @@ -37,7 +41,11 @@ copy_statfs_to_statvfs(struct statvfs *to, struct statfs *from) to->f_ffree = from->f_ffree; to->f_favail = from->f_ffree; /* no exact equivalent */ to->f_fsid = 0; /* XXX fix me */ +#ifdef HAVE_STRUCT_STATFS_F_FLAGS to->f_flag = from->f_flags; +#else + to->f_flag = 0; +#endif to->f_namemax = MNAMELEN; } diff --git a/openbsd-compat/bsd-statvfs.h b/openbsd-compat/bsd-statvfs.h index 815ec03b..e2a4c15f 100644 --- a/openbsd-compat/bsd-statvfs.h +++ b/openbsd-compat/bsd-statvfs.h @@ -26,6 +26,9 @@ #ifdef HAVE_SYS_STATFS_H #include <sys/statfs.h> #endif +#ifdef HAVE_SYS_VFS_H +#include <sys/vfs.h> +#endif #ifndef HAVE_FSBLKCNT_T typedef unsigned long fsblkcnt_t; |