Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitafbc30e

Browse files
committed
Allow Win32 to support the O_SYNC open flag as an wal_sync_method method.
Magnus Hagander
1 parent234d508 commitafbc30e

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

‎src/include/port.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/port.h,v 1.69 2005/01/06 00:59:25 tgl Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.70 2005/02/27 00:53:29 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -174,7 +174,8 @@ extern bool rmtree(char *path, bool rmtopdir);
174174

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

177-
/* open() replacement to allow delete of held files */
177+
/* open() replacement to allow delete of held files and passing
178+
* of special options. */
178179
#ifndefWIN32_CLIENT_ONLY
179180
externintwin32_open(constchar*,int,...);
180181

‎src/include/port/win32.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.42 2004/12/26 19:20:33 tgl Exp $ */
1+
/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.43 2005/02/27 00:53:29 momjian Exp $ */
22

33
/* undefine and redefine after #include */
44
#undef mkdir
@@ -183,6 +183,14 @@ typedef int pid_t;
183183
*/
184184
#definelstat(path,sb)stat((path), (sb))
185185

186+
/*
187+
* Supplement to <fcntl.h>.
188+
* This is the same value as _O_NOINHERIT in the MS header file. This is
189+
* to ensure that we don't collide with a future definition. It means
190+
* we cannot use _O_NOINHERIT ourselves.
191+
*/
192+
#defineO_SYNC 0x0080
193+
186194
/*
187195
* Supplement to <errno.h>.
188196
*/

‎src/port/open.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
*
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
*
9-
* $PostgreSQL: pgsql/src/port/open.c,v 1.7 2004/12/31 22:03:53 pgsql Exp $
9+
* $PostgreSQL: pgsql/src/port/open.c,v 1.8 2005/02/27 00:53:29 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
1313

1414
#ifdefWIN32
1515

16+
#include<postgres.h>
1617
#include<windows.h>
1718
#include<fcntl.h>
1819
#include<errno.h>
@@ -62,7 +63,7 @@ win32_open(const char *fileName, int fileFlags,...)
6263
/* Check that we can handle the request */
6364
assert((fileFlags& ((O_RDONLY |O_WRONLY |O_RDWR) |O_APPEND |
6465
(O_RANDOM |O_SEQUENTIAL |O_TEMPORARY) |
65-
_O_SHORT_LIVED |
66+
_O_SHORT_LIVED |O_SYNC |
6667
(O_CREAT |O_TRUNC |O_EXCL) | (O_TEXT |O_BINARY)))==fileFlags);
6768

6869
sa.nLength=sizeof(sa);
@@ -81,7 +82,8 @@ win32_open(const char *fileName, int fileFlags,...)
8182
((fileFlags&O_RANDOM) ?FILE_FLAG_RANDOM_ACCESS :0) |
8283
((fileFlags&O_SEQUENTIAL) ?FILE_FLAG_SEQUENTIAL_SCAN :0) |
8384
((fileFlags&_O_SHORT_LIVED) ?FILE_ATTRIBUTE_TEMPORARY :0) |
84-
((fileFlags&O_TEMPORARY) ?FILE_FLAG_DELETE_ON_CLOSE :0),
85+
((fileFlags&O_TEMPORARY) ?FILE_FLAG_DELETE_ON_CLOSE :0)|
86+
((fileFlags&O_SYNC) ?FILE_FLAG_WRITE_THROUGH :0),
8587
NULL))==INVALID_HANDLE_VALUE)
8688
{
8789
switch (GetLastError())

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp