From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53735) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQiCk-0001MC-TG for qemu-devel@nongnu.org; Sun, 29 May 2011 11:47:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QQiCj-00019U-Kj for qemu-devel@nongnu.org; Sun, 29 May 2011 11:47:02 -0400 MIME-Version: 1.0 In-Reply-To: References: <1306516951-31105-1-git-send-email-cerbere@gmail.com> <1306516951-31105-2-git-send-email-cerbere@gmail.com> From: Alexandre Raymond Date: Sun, 29 May 2011 11:46:38 -0400 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/6] Fix incorrect check for fdatasync() in configure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Andreas_F=C3=A4rber?= Cc: qemu-trivial@nongnu.org, Stefan Hajnoczi , QEMU Developers Hi Andreas, According to this excerpt from The Open Group Base Specifications Issue 6 (http://pubs.opengroup.org/onlinepubs/009695399/basedefs/unistd.h.h= tml), '>0' indeed means that the functionality is implemented and can be used. ----8<---- The following symbolic constants, if defined in , shall have a value of -1, 0, or greater, unless otherwise specified below. If these are undefined, the fpathconf(), pathconf(), or sysconf() functions can be used to determine whether the option is provided for a particular invocation of the application. If a symbolic constant is defined with the value -1, the option is not supported. Headers, data types, and function interfaces required only for the option need not be supplied. An application that attempts to use anything associated only with the option is considered to be requiring an extension. If a symbolic constant is defined with a value greater than zero, the option shall always be supported when the application is executed. All headers, data types, and functions shall be present and shall operate as specified. If a symbolic constant is defined with the value zero, all headers, data types, and functions shall be present. The application can check at runtime to see whether the option is supported by calling fpathconf(), pathconf(), or sysconf() with the indicated name parameter. ----8<---- Alexandre On Sun, May 29, 2011 at 10:50 AM, Andreas F=C3=A4rber wrote: > 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 =C2=A0systems =C2=A0on =C2=A0which fdatasync() is available, >> _POSIX_SYNCHRONIZED_IO is defined in 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 operation= s > 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 , 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 no= t > 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 > > Andreas > >> --- >> configure | =C2=A0 =C2=A08 +++++++- >> 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=3Dno >> cat > $TMPC << EOF >> #include >> -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 >> =C2=A0 =C2=A0fdatasync=3Dyes >> -- >> 1.7.5 > >