Kurt Roeckx wrote:
> On Sat, Feb 01, 2003 at 08:15:17AM -0800, Kevin Brown wrote:
> > Kurt Roeckx wrote:
> > > [SIO] [Option Start] If _POSIX_SYNCHRONIZED_IO is defined, the
> > > fsync() function shall force all currently queued I/O operations
> > > associated with the file indicated by file descriptor fildes to the
> > > synchronized I/O completion state. All I/O operations shall be
> > > completed as defined for synchronized I/O file integrity
> > > completion. [Option End]
> >
> > Hmmm....so if I consistently want these semantics out of fsync() I
> > have to #define _POSIX_SYNCHRONIZED_IO? Or does the above mean that
> > you'll get those semantics if and only if the OS defines the above for
> > you?
>
> It's something that will be defined in unistd.h. Depending on
> the value you know if the system supports it always, you can turn
> it on per application, or it's always on.
>
> You know that this standard is freely available on internet?
> (http://www.unix-systems.org/version3/online.html)
>
> There are other comments in about the usage of it.
>
> Note that there also is a function call fdatasync() in the
> Synchronized IO extention.
Ah, excellent, thank you. Yes, fdatasync() is *exactly* what we need,
since it's defined thusly: "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".
Looks to me like we have a winner. Question is, can we bank on its
existence and, if so, is it properly implemented on all platforms that
support it?
Since we've been talking about porting to rather different platforms
(win32 in particular), it seems logical to build a PGFileSync()
function or something (perhaps a single PGSync() which synchronizes
all relevant PG files to disk, with sync() if necessary) and which
would thus use fdatasync() or its equivalent.
--
Kevin Brown kevin@sysexperts.com