Skip to content

Commit edb1ba1

Browse files
committed
Better document win32_open and its ability to allow concurrent
unlink/rename().
1 parent 1311667 commit edb1ba1

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/port/dirmod.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Win32 (NT, Win2k, XP). replace() doesn't work on Win95/98/Me.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/port/dirmod.c,v 1.29 2004/10/17 23:39:22 momjian Exp $
13+
* $PostgreSQL: pgsql/src/port/dirmod.c,v 1.30 2004/10/17 23:53:30 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -68,7 +68,7 @@ pgrename(const char *from, const char *to)
6868
{
6969
int loops = 0;
7070

71-
/* Is this loop even necessary? */
71+
/* Is this loop even necessary now that we have win32_open()? */
7272
#if defined(WIN32) && !defined(__CYGWIN__)
7373
while (!MoveFileEx(from, to, MOVEFILE_REPLACE_EXISTING))
7474
#endif
@@ -114,7 +114,7 @@ pgunlink(const char *path)
114114
{
115115
int loops = 0;
116116

117-
/* Is this loop even necessary? */
117+
/* Is this loop even necessary now that we have win32_open()? */
118118
while (unlink(path))
119119
{
120120
if (errno != EACCES)

src/port/open.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
88
*
9-
* $PostgreSQL: pgsql/src/port/open.c,v 1.4 2004/08/29 05:07:02 momjian Exp $
9+
* $PostgreSQL: pgsql/src/port/open.c,v 1.5 2004/10/17 23:53:30 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -71,6 +71,7 @@ win32_open(const char *fileName, int fileFlags,...)
7171
/* cannot use O_RDONLY, as it == 0 */
7272
(fileFlags & O_RDWR) ? (GENERIC_WRITE | GENERIC_READ) :
7373
((fileFlags & O_WRONLY) ? GENERIC_WRITE : GENERIC_READ),
74+
/* These flags allow concurrent rename/unlink */
7475
(FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE),
7576
&sa,
7677
openFlagsToCreateFileFlags(fileFlags),

0 commit comments

Comments
 (0)