Re: [pgsql-hackers-win32] Proposed dirmod.c fix for Win32 - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: [pgsql-hackers-win32] Proposed dirmod.c fix for Win32
Date
Msg-id 200402022203.i12M3op20202@candle.pha.pa.us
Whole thread Raw
In response to Re: [pgsql-hackers-win32] Proposed dirmod.c fix for Win32  (Claudio Natoli <claudio.natoli@memetrics.com>)
List pgsql-patches
Claudio Natoli wrote:
>
> For application to HEAD, pending community review (rationale provided below
> in previous message; no responses hopefully indicates agreement :-)
>
> Following application, dirmod.c must be moved to src/backend/port/win32 (ie.
> add to src/backend/port/win32, and remove from src/port).
>
> [changes to configure.in are essentially only the removal of
> AC_LIBOBJ(dirmod); other changes to configure.in appear in a previous patch
> and yet to be applied]

I made more adjustments to configure/configure.in, attached, that should
have this working fine now.

> Please note that dirmod.c has recently been changed to work under cygwin,
> along side of the existing win32/mingw implementation, however does not
> currently appear, afaics, to be included during a cygwin build. This patch
> does not address this deficiency.

OK, I have addressed the cygwin issue in this patch.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: configure
===================================================================
RCS file: /cvsroot/pgsql-server/configure,v
retrieving revision 1.323
diff -c -c -r1.323 configure
*** configure    2 Feb 2004 04:07:18 -0000    1.323
--- configure    2 Feb 2004 22:00:30 -0000
***************
*** 2502,2508 ****

  # We already have this in Makefile.win32, but configure needs it too
  if test "$PORTNAME" = "win32"; then
!   CPPFLAGS="$CPPFLAGS -I$srcdir/src/include/port/win32"
  fi

  # Check if the compiler still works with the template settings
--- 2502,2508 ----

  # We already have this in Makefile.win32, but configure needs it too
  if test "$PORTNAME" = "win32"; then
!   CPPFLAGS="$CPPFLAGS -I$srcdir/src/include/port/win32 -DEXEC_BACKEND"
  fi

  # Check if the compiler still works with the template settings
***************
*** 12077,12086 ****

  # Win32 can't to rename or unlink on an open file
  case $host_os in mingw*)
- LIBOBJS="$LIBOBJS dirmod.$ac_objext"
  LIBOBJS="$LIBOBJS copydir.$ac_objext"
  LIBOBJS="$LIBOBJS gettimeofday.$ac_objext"
! LIBOBJS="$LIBOBJS pipe.$ac_objext" ;;
  esac

  if test "$with_readline" = yes; then
--- 12077,12090 ----

  # Win32 can't to rename or unlink on an open file
  case $host_os in mingw*)
  LIBOBJS="$LIBOBJS copydir.$ac_objext"
  LIBOBJS="$LIBOBJS gettimeofday.$ac_objext"
! LIBOBJS="$LIBOBJS pipe.$ac_objext"
! LIBOBJS="$LIBOBJS rand.$ac_objext" ;;
! esac
!
! case $host_os in mingw*|cygwin*)
! LIBOBJS="$LIBOBJS dirmod.$ac_objext" ;;
  esac

  if test "$with_readline" = yes; then
Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql-server/configure.in,v
retrieving revision 1.312
diff -c -c -r1.312 configure.in
*** configure.in    2 Feb 2004 16:00:49 -0000    1.312
--- configure.in    2 Feb 2004 22:00:32 -0000
***************
*** 906,915 ****
  # Win32 can't to rename or unlink on an open file
  case $host_os in mingw*)
  AC_LIBOBJ(copydir)
- AC_LIBOBJ(dirmod)
  AC_LIBOBJ(gettimeofday)
  AC_LIBOBJ(pipe)
  AC_LIBOBJ(rand) ;;
  esac

  if test "$with_readline" = yes; then
--- 906,918 ----
  # Win32 can't to rename or unlink on an open file
  case $host_os in mingw*)
  AC_LIBOBJ(copydir)
  AC_LIBOBJ(gettimeofday)
  AC_LIBOBJ(pipe)
  AC_LIBOBJ(rand) ;;
+ esac
+
+ case $host_os in mingw*|cygwin*)
+ AC_LIBOBJ(dirmod) ;;
  esac

  if test "$with_readline" = yes; then
Index: src/include/port.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/port.h,v
retrieving revision 1.17
diff -c -c -r1.17 port.h
*** src/include/port.h    2 Feb 2004 00:17:23 -0000    1.17
--- src/include/port.h    2 Feb 2004 22:00:34 -0000
***************
*** 30,36 ****
  extern off_t ftello(FILE *stream);
  #endif

! #if !defined(FRONTEND) && (defined(WIN32) || defined(CYGWIN))
  /*
   * Win32 doesn't have reliable rename/unlink during concurrent access
   */
--- 30,36 ----
  extern off_t ftello(FILE *stream);
  #endif

! #if defined(WIN32) || defined(CYGWIN)
  /*
   * Win32 doesn't have reliable rename/unlink during concurrent access
   */
Index: src/port/dirmod.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/port/dirmod.c,v
retrieving revision 1.9
diff -c -c -r1.9 dirmod.c
*** src/port/dirmod.c    2 Feb 2004 00:17:23 -0000    1.9
--- src/port/dirmod.c    2 Feb 2004 22:00:35 -0000
***************
*** 17,23 ****
--- 17,29 ----

  #ifndef TEST_VERSION

+ #if defined(WIN32) || defined(CYGWIN)
+
+ #ifndef FRONTEND
  #include "postgres.h"
+ #else
+ #include "postgres_fe.h"
+ #endif

  #undef rename
  #undef unlink
***************
*** 95,100 ****
--- 101,107 ----
      return 0;
  }

+ #endif

  #else


pgsql-patches by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: fix memcpy() overlap
Next
From: Bruce Momjian
Date:
Subject: Re: [pgsql-hackers-win32] Proposed dirmod.c fix for Win32