Index: include/port.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/port.h,v
retrieving revision 1.69
diff -c -r1.69 port.h
*** include/port.h	6 Jan 2005 00:59:25 -0000	1.69
--- include/port.h	17 Feb 2005 21:20:41 -0000
***************
*** 174,180 ****

  #if defined(WIN32) && !defined(__CYGWIN__)

! /* open() replacement to allow delete of held files */
  #ifndef WIN32_CLIENT_ONLY
  extern int	win32_open(const char *, int,...);

--- 174,181 ----

  #if defined(WIN32) && !defined(__CYGWIN__)

! /* open() replacement to allow delete of held files and passing
!  * of special options. */
  #ifndef WIN32_CLIENT_ONLY
  extern int	win32_open(const char *, int,...);

Index: include/port/win32.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/port/win32.h,v
retrieving revision 1.42
diff -c -r1.42 win32.h
*** include/port/win32.h	26 Dec 2004 19:20:33 -0000	1.42
--- include/port/win32.h	17 Feb 2005 21:19:31 -0000
***************
*** 184,189 ****
--- 184,197 ----
  #define lstat(path, sb)	stat((path), (sb))

  /*
+  * Supplement to <fcntl.h>.
+  * This is the same value as _O_NOINHERIT in the MS header file. This is
+  * to ensure that we don't collide with a future definition. It means
+  * we cannot use _O_NOINHERIT ourselves.
+  */
+ #define O_SYNC 0x0080
+
+ /*
   * Supplement to <errno.h>.
   */
  #undef EAGAIN
Index: port/open.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/port/open.c,v
retrieving revision 1.7
diff -c -r1.7 open.c
*** port/open.c	31 Dec 2004 22:03:53 -0000	1.7
--- port/open.c	17 Feb 2005 21:40:12 -0000
***************
*** 13,18 ****
--- 13,19 ----

  #ifdef WIN32

+ #include <postgres.h>
  #include <windows.h>
  #include <fcntl.h>
  #include <errno.h>
***************
*** 62,68 ****
  	/* Check that we can handle the request */
  	assert((fileFlags & ((O_RDONLY | O_WRONLY | O_RDWR) | O_APPEND |
  						 (O_RANDOM | O_SEQUENTIAL | O_TEMPORARY) |
! 						 _O_SHORT_LIVED |
  	  (O_CREAT | O_TRUNC | O_EXCL) | (O_TEXT | O_BINARY))) == fileFlags);

  	sa.nLength = sizeof(sa);
--- 63,69 ----
  	/* Check that we can handle the request */
  	assert((fileFlags & ((O_RDONLY | O_WRONLY | O_RDWR) | O_APPEND |
  						 (O_RANDOM | O_SEQUENTIAL | O_TEMPORARY) |
! 						 _O_SHORT_LIVED | O_SYNC |
  	  (O_CREAT | O_TRUNC | O_EXCL) | (O_TEXT | O_BINARY))) == fileFlags);

  	sa.nLength = sizeof(sa);
***************
*** 81,87 ****
  				 ((fileFlags & O_RANDOM) ? FILE_FLAG_RANDOM_ACCESS : 0) |
  		   ((fileFlags & O_SEQUENTIAL) ? FILE_FLAG_SEQUENTIAL_SCAN : 0) |
  		  ((fileFlags & _O_SHORT_LIVED) ? FILE_ATTRIBUTE_TEMPORARY : 0) |
! 			 ((fileFlags & O_TEMPORARY) ? FILE_FLAG_DELETE_ON_CLOSE : 0),
  						NULL)) == INVALID_HANDLE_VALUE)
  	{
  		switch (GetLastError())
--- 82,89 ----
  				 ((fileFlags & O_RANDOM) ? FILE_FLAG_RANDOM_ACCESS : 0) |
  		   ((fileFlags & O_SEQUENTIAL) ? FILE_FLAG_SEQUENTIAL_SCAN : 0) |
  		  ((fileFlags & _O_SHORT_LIVED) ? FILE_ATTRIBUTE_TEMPORARY : 0) |
! 			 ((fileFlags & O_TEMPORARY) ? FILE_FLAG_DELETE_ON_CLOSE : 0)|
! 					((fileFlags & O_SYNC) ? FILE_FLAG_WRITE_THROUGH : 0),
  						NULL)) == INVALID_HANDLE_VALUE)
  	{
  		switch (GetLastError())
