qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/6] Fix incorrect check for fdatasync() in conf


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH 1/6] Fix incorrect check for fdatasync() in configure
Date: Sun, 29 May 2011 16:50:07 +0200

Am 27.05.2011 um 19:22 schrieb Alexandre Raymond:

For some reason, darwin provides a symbol for fdatasync(), but
doesn't officially support it.

The manpage for fdatasync on Linux states the following:

"On POSIX  systems  on  which fdatasync() is available,
_POSIX_SYNCHRONIZED_IO is defined in <unistd.h> to a value greater than 0."

The Open Group Base Specification Issue 7 says this on fdatasync():

"The functionality shall be equivalent to fsync() with the symbol _POSIX_SYNCHRONIZED_IO defined, with the exception that all I/O operations shall be completed as defined for synchronized I/O data integrity completion."

On unistd.h it goes on to say:

"_POSIX_SYNCHRONIZED_IO
[SIO]
The implementation supports the Synchronized Input and Output option. If this symbol is defined in <unistd.h>, it shall be defined to be -1, 0, or 200809L."

The change history has nothing on that define and its value -1, so I'm not convinced that this really is The Right Way to check.

In fact, unistd.h defines this value to "-1", at least on OSX 10.6.7.

Add this check to the configure file.

Signed-off-by: Alexandre Raymond <address@hidden>

Andreas

---
configure |    8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index a318d37..b21ef75 100755
--- a/configure
+++ b/configure
@@ -2477,7 +2477,13 @@ fi
fdatasync=no
cat > $TMPC << EOF
#include <unistd.h>
-int main(void) { return fdatasync(0); }
+int main(void) {
+#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
+return fdatasync(0);
+#else
+#abort Not supported
+#endif
+}
EOF
if compile_prog "" "" ; then
    fdatasync=yes
--
1.7.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]