From dfc6649c4d849f6252da6c119dfd92e202cb86a8 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 22 Apr 2003 02:18:09 +0000 Subject: [PATCH] Add Win32 versions of unlink and rename --- loop until success. --- configure | 9 +++++++-- configure.in | 11 ++++++++--- src/include/c.h | 13 ++++++++++++- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/configure b/configure index 18daf4e8dc..150c958ca0 100755 --- a/configure +++ b/configure @@ -11145,8 +11145,13 @@ ac_cv_func_fseeko=yes esac # Solaris has a very slow qsort in certain cases, so we replace it. -case $host_os in - solaris*) LIBOBJS="$LIBOBJS qsort.$ac_objext" ;; +case $host_os in solaris*) +LIBOBJS="$LIBOBJS qsort.$ac_objext" ;; +esac + +# Win32 can't to rename or unlink on an open file +case $host_os in win32*) +LIBOBJS="$LIBOBJS dirmod.$ac_objext" ;; esac # On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a; diff --git a/configure.in b/configure.in index b0b8358972..9e50e487c9 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -dnl $Header: /cvsroot/pgsql/configure.in,v 1.242 2003/04/06 22:45:22 petere Exp $ +dnl $Header: /cvsroot/pgsql/configure.in,v 1.243 2003/04/22 02:18:09 momjian Exp $ dnl dnl Developers, please strive to achieve this order: dnl @@ -856,8 +856,13 @@ ac_cv_func_fseeko=yes esac # Solaris has a very slow qsort in certain cases, so we replace it. -case $host_os in - solaris*) AC_LIBOBJ(qsort) ;; +case $host_os in solaris*) +AC_LIBOBJ(qsort) ;; +esac + +# Win32 can't to rename or unlink on an open file +case $host_os in win32*) +AC_LIBOBJ(dirmod) ;; esac # On HPUX 9, rint() is not in regular libm.a but in /lib/pa1.1/libm.a; diff --git a/src/include/c.h b/src/include/c.h index 8b92a98793..833312b9d6 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -12,7 +12,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: c.h,v 1.138 2003/04/18 01:03:42 momjian Exp $ + * $Id: c.h,v 1.139 2003/04/22 02:18:09 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -711,6 +711,17 @@ int fseeko(FILE *stream, off_t offset, int whence); off_t ftello(FILE *stream); #endif +/* + * Win32 doesn't have reliable rename/unlink during concurrent access + */ +#ifdef WIN32 +int pgrename(const char *from, const char *to); +int pgunlink(const char *path); +#define rename(path) pgrename(path) +#define unlink(from, to) pgunlink(from, to) +#endif + + /* These are for things that are one way on Unix and another on NT */ #define NULL_DEV "/dev/null" -- GitLab