Skip to content

Commit dfc6649

Browse files
committed
Add Win32 versions of unlink and rename --- loop until success.
1 parent 5ed27e3 commit dfc6649

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

configure

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11145,8 +11145,13 @@ ac_cv_func_fseeko=yes
1114511145
esac
1114611146
1114711147
# Solaris has a very slow qsort in certain cases, so we replace it.
11148-
case $host_os in
11149-
solaris*) LIBOBJS="$LIBOBJS qsort.$ac_objext" ;;
11148+
case $host_os in solaris*)
11149+
LIBOBJS="$LIBOBJS qsort.$ac_objext" ;;
11150+
esac
11151+
11152+
# Win32 can't to rename or unlink on an open file
11153+
case $host_os in win32*)
11154+
LIBOBJS="$LIBOBJS dirmod.$ac_objext" ;;
1115011155
esac
1115111156
1115211157
# On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;

configure.in

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $Header: /cvsroot/pgsql/configure.in,v 1.242 2003/04/06 22:45:22 petere Exp $
2+
dnl $Header: /cvsroot/pgsql/configure.in,v 1.243 2003/04/22 02:18:09 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -856,8 +856,13 @@ ac_cv_func_fseeko=yes
856856
esac
857857

858858
# Solaris has a very slow qsort in certain cases, so we replace it.
859-
case $host_os in
860-
solaris*) AC_LIBOBJ(qsort) ;;
859+
case $host_os in solaris*)
860+
AC_LIBOBJ(qsort) ;;
861+
esac
862+
863+
# Win32 can't to rename or unlink on an open file
864+
case $host_os in win32*)
865+
AC_LIBOBJ(dirmod) ;;
861866
esac
862867

863868
# On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a;

src/include/c.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $Id: c.h,v 1.138 2003/04/18 01:03:42 momjian Exp $
15+
* $Id: c.h,v 1.139 2003/04/22 02:18:09 momjian Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -711,6 +711,17 @@ int fseeko(FILE *stream, off_t offset, int whence);
711711
off_t ftello(FILE *stream);
712712
#endif
713713

714+
/*
715+
* Win32 doesn't have reliable rename/unlink during concurrent access
716+
*/
717+
#ifdef WIN32
718+
int pgrename(const char *from, const char *to);
719+
int pgunlink(const char *path);
720+
#define rename(path) pgrename(path)
721+
#define unlink(from, to) pgunlink(from, to)
722+
#endif
723+
724+
714725
/* These are for things that are one way on Unix and another on NT */
715726
#define NULL_DEV "/dev/null"
716727

0 commit comments

Comments
 (0)