For Win32, in order to emulate fsync() we will need to call
FlushFileBuffers():
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/
base/flushfilebuffers.asp

Mon, 3 Feb 2003 12:15:02 -0800
"Dann Corbit" <DCorbit@connx.com>
Win32 and fsync()
I'm having difficulty digging up the reference, but I think I recall seeing
something that said, roughly, on W32 there are 2 sets of buffers - those in
the user level library and those in the kernel level driver, and
FlushFileBuffers drains the first, while _commit drains both (it includes a
call to FlushFileBuffers).

I'm also fairly sure I saw something like
    #define fsync _commit
in the Berkeley DB sources the other day, which might be a clue.

I'll be happy to be corrected, though.

cheers

andrew


----- Original Message -----
From: "Dann Corbit" <DCorbit@connx.com>
To: "PostgreSQL Hackers" <pgsql-hackers@postgresql.org>
Sent: Monday, February 03, 2003 3:15 PM
Subject: [HACKERS] Win32 and fsync()


> For Win32, in order to emulate fsync() we will need to call
> FlushFileBuffers():
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/
> base/flushfilebuffers.asp
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org


Mon, 3 Feb 2003 17:47:17 -0500
"Andrew Dunstan" <andrew@dunslane.net>
Re: Win32 and fsync()
On Mon, 3 Feb 2003, Andrew Dunstan wrote:

> I'm also fairly sure I saw something like
>     #define fsync _commit
> in the Berkeley DB sources the other day, which might be a clue.
> 
> I'll be happy to be corrected, though.

You'd be right:

/*
 * Win32 has fsync, getcwd, snprintf and vsnprintf, but under different names.
 */
#define fsync(fd)       _commit(fd)

Funny Win32-ism

Still not sure if it has the same semantics as Unix fsync() but sleepycat
(Berkeley) DB seems to think so.

Gavin


Tue, 4 Feb 2003 10:03:46 +1100 (EST)
Gavin Sherry <swm@linuxworld.com.au>
Re: Win32 and fsync()