From ea3bcabcc2cd9a9339b97c5842888414ee620ea9 Mon Sep 17 00:00:00 2001 From: alexpeshkoff Date: Thu, 25 Nov 2010 15:50:13 +0000 Subject: [PATCH] Check for presence of sync functions --- configure.in | 1 + src/burp/burp.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/configure.in b/configure.in index 0dc4cf8771..5183ad7f5f 100644 --- a/configure.in +++ b/configure.in @@ -785,6 +785,7 @@ AC_CHECK_FUNCS(fchmod) AC_CHECK_FUNCS(semtimedop) AC_CHECK_FUNCS(fegetenv) AC_CHECK_FUNCS(strerror_r) +AC_CHECK_FUNCS(fdatasync fsync) dnl AC_CHECK_FUNCS(AO_compare_and_swap_full) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[AO_T x; AO_compare_and_swap_full(&x, 0, 0); return 0;]])], diff --git a/src/burp/burp.h b/src/burp/burp.h index 96260e7273..20b10e917a 100644 --- a/src/burp/burp.h +++ b/src/burp/burp.h @@ -724,7 +724,11 @@ inline static void unlink_platf(const TEXT* file_name) inline static void flush_platf(DESC file) { +#if defined(HAVE_FDATASYNC) fdatasync(file); +#elif defined(HAVE_FSYNC) + fsync(file); +#endif } #endif // WIN_NT