Re: APR 1.0 released - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: APR 1.0 released
Date
Msg-id 200409090058.i890whO25412@candle.pha.pa.us
Whole thread Raw
In response to Re: APR 1.0 released  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: APR 1.0 released  ("Andrew Dunstan" <andrew@dunslane.net>)
List pgsql-hackers
Andrew Dunstan wrote:
>
>
> Reini Urban wrote:
>
> >
> >
> > FYI: WIN32 is also defined because <windows.h> is included.
> > (/usr/incluse/w32api/windef.h)
> > If you want this or that, do proper nesting, and use #else.
> >
> >
>
> Ugh, yes. A little experimentation shows that __WIN32__ is defined for
> MinGW only, but WIN32 is for both. I wonder how we missed that in
> various places. Maybe we need a little audit of the use of WIN32.

Done, and patch attached and applied.  Hopefully at least Cygwin will
compile dirmod.c now.  (Most of the patch is consistency
reorganization.)  We still need a review of that file.

--
  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: src/backend/libpq/be-secure.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/libpq/be-secure.c,v
retrieving revision 1.48
diff -c -c -r1.48 be-secure.c
*** src/backend/libpq/be-secure.c    29 Aug 2004 05:06:43 -0000    1.48
--- src/backend/libpq/be-secure.c    9 Sep 2004 00:49:26 -0000
***************
*** 659,665 ****
           * think of a reasonable check to apply on Windows.  (See also the
           * data directory permission check in postmaster.c)
           */
! #if !defined(__CYGWIN__) && !defined(WIN32)
          if (!S_ISREG(buf.st_mode) || (buf.st_mode & (S_IRWXG | S_IRWXO)) ||
              buf.st_uid != getuid())
              ereport(FATAL,
--- 659,665 ----
           * think of a reasonable check to apply on Windows.  (See also the
           * data directory permission check in postmaster.c)
           */
! #if !defined(WIN32) && !defined(__CYGWIN__)
          if (!S_ISREG(buf.st_mode) || (buf.st_mode & (S_IRWXG | S_IRWXO)) ||
              buf.st_uid != getuid())
              ereport(FATAL,
Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/postmaster/postmaster.c,v
retrieving revision 1.424
diff -c -c -r1.424 postmaster.c
*** src/backend/postmaster/postmaster.c    29 Aug 2004 05:06:46 -0000    1.424
--- src/backend/postmaster/postmaster.c    9 Sep 2004 00:49:34 -0000
***************
*** 976,982 ****
       * be proper support for Unix-y file permissions.  Need to think of a
       * reasonable check to apply on Windows.
       */
! #if !defined(__CYGWIN__) && !defined(WIN32)
      if (stat_buf.st_mode & (S_IRWXG | S_IRWXO))
          ereport(FATAL,
                  (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
--- 976,982 ----
       * be proper support for Unix-y file permissions.  Need to think of a
       * reasonable check to apply on Windows.
       */
! #if !defined(WIN32) && !defined(__CYGWIN__)
      if (stat_buf.st_mode & (S_IRWXG | S_IRWXO))
          ereport(FATAL,
                  (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
Index: src/include/c.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/c.h,v
retrieving revision 1.168
diff -c -c -r1.168 c.h
*** src/include/c.h    29 Aug 2004 05:06:55 -0000    1.168
--- src/include/c.h    9 Sep 2004 00:49:38 -0000
***************
*** 68,74 ****
  #include <sys/types.h>

  #include <errno.h>
! #if defined(__CYGWIN__) || defined(WIN32)
  #include <fcntl.h>                /* ensure O_BINARY is available */
  #endif
  #ifdef HAVE_SUPPORTDEFS_H
--- 68,74 ----
  #include <sys/types.h>

  #include <errno.h>
! #if defined(WIN32) || defined(__CYGWIN__)
  #include <fcntl.h>                /* ensure O_BINARY is available */
  #endif
  #ifdef HAVE_SUPPORTDEFS_H
***************
*** 680,686 ****
   *    literal control-Z.    The other affect is that we see CRLF, but
   *    that is OK because we can already handle those cleanly.
   */
! #if defined(__CYGWIN__) || defined(WIN32)
  #define PG_BINARY    O_BINARY
  #define PG_BINARY_R "rb"
  #define PG_BINARY_W "wb"
--- 680,686 ----
   *    literal control-Z.    The other affect is that we see CRLF, but
   *    that is OK because we can already handle those cleanly.
   */
! #if defined(WIN32) || defined(__CYGWIN__)
  #define PG_BINARY    O_BINARY
  #define PG_BINARY_R "rb"
  #define PG_BINARY_W "wb"
Index: src/include/port.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/port.h,v
retrieving revision 1.59
diff -c -c -r1.59 port.h
*** src/include/port.h    9 Sep 2004 00:24:10 -0000    1.59
--- src/include/port.h    9 Sep 2004 00:49:38 -0000
***************
*** 181,187 ****
  #endif

  /* Global variable holding time zone information. */
! #if !defined(__CYGWIN__)
  #define TIMEZONE_GLOBAL timezone
  #define TZNAME_GLOBAL tzname
  #else
--- 181,187 ----
  #endif

  /* Global variable holding time zone information. */
! #ifndef __CYGWIN__
  #define TIMEZONE_GLOBAL timezone
  #define TZNAME_GLOBAL tzname
  #else
Index: src/include/port/win32.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/port/win32.h,v
retrieving revision 1.31
diff -c -c -r1.31 win32.h
*** src/include/port/win32.h    31 Aug 2004 11:29:56 -0000    1.31
--- src/include/port/win32.h    9 Sep 2004 00:49:40 -0000
***************
*** 19,25 ****
  #define USES_WINSOCK

  /* defines for dynamic linking on Win32 platform */
! #if defined(__CYGWIN__) || defined(__MINGW32__)

  #if __GNUC__ && ! defined (__declspec)
  #error You need egcs 1.1 or newer for compiling!
--- 19,25 ----
  #define USES_WINSOCK

  /* defines for dynamic linking on Win32 platform */
! #if defined(__MINGW32__) || defined(__CYGWIN__)

  #if __GNUC__ && ! defined (__declspec)
  #error You need egcs 1.1 or newer for compiling!
Index: src/interfaces/ecpg/include/sqlca.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/interfaces/ecpg/include/sqlca.h,v
retrieving revision 1.26
diff -c -c -r1.26 sqlca.h
*** src/interfaces/ecpg/include/sqlca.h    4 Aug 2003 00:43:32 -0000    1.26
--- src/interfaces/ecpg/include/sqlca.h    9 Sep 2004 00:49:40 -0000
***************
*** 2,8 ****
  #define POSTGRES_SQLCA_H

  #ifndef DLLIMPORT
! #if defined(__CYGWIN__) || defined(WIN32)
  #define DLLIMPORT __declspec (dllimport)
  #else
  #define DLLIMPORT
--- 2,8 ----
  #define POSTGRES_SQLCA_H

  #ifndef DLLIMPORT
! #if  defined(WIN32) || defined(__CYGWIN__)
  #define DLLIMPORT __declspec (dllimport)
  #else
  #define DLLIMPORT
Index: src/port/dirmod.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/port/dirmod.c,v
retrieving revision 1.22
diff -c -c -r1.22 dirmod.c
*** src/port/dirmod.c    29 Aug 2004 05:07:02 -0000    1.22
--- src/port/dirmod.c    9 Sep 2004 00:49:42 -0000
***************
*** 66,79 ****
  {
      int            loops = 0;

! #ifdef WIN32
      while (!MoveFileEx(from, to, MOVEFILE_REPLACE_EXISTING))
  #endif
  #ifdef __CYGWIN__
          while (rename(from, to) < 0)
  #endif
          {
! #ifdef WIN32
              if (GetLastError() != ERROR_ACCESS_DENIED)
  #endif
  #ifdef __CYGWIN__
--- 66,79 ----
  {
      int            loops = 0;

! #if defined(WIN32) && !defined(__CYGWIN__)
      while (!MoveFileEx(from, to, MOVEFILE_REPLACE_EXISTING))
  #endif
  #ifdef __CYGWIN__
          while (rename(from, to) < 0)
  #endif
          {
! #if defined(WIN32) && !defined(__CYGWIN__)
              if (GetLastError() != ERROR_ACCESS_DENIED)
  #endif
  #ifdef __CYGWIN__

pgsql-hackers by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: Geometry regression test failure, CVS HEAD, Mac OS/X
Next
From: Tom Lane
Date:
Subject: TRIGGER_DEFERRED_HAS_BEFORE ?