Win32 defines - Mailing list pgsql-patches

From Bruce Momjian
Subject Win32 defines
Date
Msg-id 200304030614.h336Eed15671@candle.pha.pa.us
Whole thread Raw
Responses Re: Win32 defines
Re: Win32 defines
List pgsql-patches
This adds some Win32 defines to cygwin defines --- this isn't all of
them, but it is most.

--
  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: contrib/pgbench/pgbench.c
===================================================================
RCS file: /cvsroot/pgsql-server/contrib/pgbench/pgbench.c,v
retrieving revision 1.22
diff -c -c -r1.22 pgbench.c
*** contrib/pgbench/pgbench.c    20 Oct 2002 19:38:10 -0000    1.22
--- contrib/pgbench/pgbench.c    3 Apr 2003 06:09:21 -0000
***************
*** 695,701 ****
      int            nsocks;            /* return from select(2) */
      int            maxsock;        /* max socket number to be waited */

! #ifndef __CYGWIN__
      struct rlimit rlim;
  #endif

--- 695,701 ----
      int            nsocks;            /* return from select(2) */
      int            maxsock;        /* max socket number to be waited */

! #if !defined(__CYGWIN__) && !defined(WIN32)
      struct rlimit rlim;
  #endif

***************
*** 737,743 ****
                      fprintf(stderr, "invalid number of clients: %d\n", nclients);
                      exit(1);
                  }
! #ifndef __CYGWIN__
  #ifdef RLIMIT_NOFILE            /* most platform uses RLIMIT_NOFILE */
                  if (getrlimit(RLIMIT_NOFILE, &rlim) == -1)
                  {
--- 737,743 ----
                      fprintf(stderr, "invalid number of clients: %d\n", nclients);
                      exit(1);
                  }
! #if !defined(__CYGWIN__) && !defined(WIN32)
  #ifdef RLIMIT_NOFILE            /* most platform uses RLIMIT_NOFILE */
                  if (getrlimit(RLIMIT_NOFILE, &rlim) == -1)
                  {
***************
*** 754,760 ****
                      fprintf(stderr, "Use limit/ulimt to increase the limit before using pgbench.\n");
                      exit(1);
                  }
! #endif   /* #ifndef __CYGWIN__ */
                  break;
              case 'C':
                  is_connect = 1;
--- 754,760 ----
                      fprintf(stderr, "Use limit/ulimt to increase the limit before using pgbench.\n");
                      exit(1);
                  }
! #endif
                  break;
              case 'C':
                  is_connect = 1;
Index: src/backend/access/transam/xlog.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/access/transam/xlog.c,v
retrieving revision 1.112
diff -c -c -r1.112 xlog.c
*** src/backend/access/transam/xlog.c    21 Feb 2003 00:06:22 -0000    1.112
--- src/backend/access/transam/xlog.c    3 Apr 2003 06:09:26 -0000
***************
*** 1507,1513 ****
       * overwrite an existing logfile.  However, there shouldn't be one, so
       * rename() is an acceptable substitute except for the truly paranoid.
       */
! #if !defined(__BEOS__) && !defined(N_PLAT_NLM) && !defined(__CYGWIN__)
      if (link(tmppath, path) < 0)
          elog(PANIC, "link from %s to %s (initialization of log file %u, segment %u) failed: %m",
               tmppath, path, log, seg);
--- 1507,1513 ----
       * overwrite an existing logfile.  However, there shouldn't be one, so
       * rename() is an acceptable substitute except for the truly paranoid.
       */
! #if !defined(__BEOS__) && !defined(N_PLAT_NLM) && !defined(__CYGWIN__) && !defined(WIN32)
      if (link(tmppath, path) < 0)
          elog(PANIC, "link from %s to %s (initialization of log file %u, segment %u) failed: %m",
               tmppath, path, log, seg);
Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/postmaster/postmaster.c,v
retrieving revision 1.309
diff -c -c -r1.309 postmaster.c
*** src/backend/postmaster/postmaster.c    24 Mar 2003 22:40:14 -0000    1.309
--- src/backend/postmaster/postmaster.c    3 Apr 2003 06:09:32 -0000
***************
*** 300,307 ****
  {
      char        path[MAXPGPATH];
      FILE       *fp;
!
! #ifndef __CYGWIN__
      struct stat stat_buf;
  #endif

--- 300,307 ----
  {
      char        path[MAXPGPATH];
      FILE       *fp;
!
! #if !defined(__CYGWIN__) && !defined(WIN32)
      struct stat stat_buf;
  #endif

***************
*** 323,330 ****
       * be proper support for Unix-y file permissions.  Need to think of a
       * reasonable check to apply on Windows.
       */
! #ifndef __CYGWIN__
!
      if (stat(checkdir, &stat_buf) == -1)
      {
          if (errno == ENOENT)
--- 323,329 ----
       * 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(checkdir, &stat_buf) == -1)
      {
          if (errno == ENOENT)
***************
*** 337,343 ****
      if (stat_buf.st_mode & (S_IRWXG | S_IRWXO))
          elog(FATAL, "data directory %s has group or world access; permissions should be u=rwx (0700)",
               checkdir);
! #endif   /* !__CYGWIN__ */

      /* Look for PG_VERSION before looking for pg_control */
      ValidatePgVersion(checkdir);
--- 336,342 ----
      if (stat_buf.st_mode & (S_IRWXG | S_IRWXO))
          elog(FATAL, "data directory %s has group or world access; permissions should be u=rwx (0700)",
               checkdir);
! #endif

      /* Look for PG_VERSION before looking for pg_control */
      ValidatePgVersion(checkdir);
Index: src/include/c.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/c.h,v
retrieving revision 1.135
diff -c -c -r1.135 c.h
*** src/include/c.h    9 Jan 2003 18:00:24 -0000    1.135
--- src/include/c.h    3 Apr 2003 06:09:40 -0000
***************
*** 63,69 ****
  #endif
  #include <sys/types.h>

! #ifdef __CYGWIN__
  #include <errno.h>
  #include <sys/fcntl.h>            /* ensure O_BINARY is available */
  #endif
--- 63,69 ----
  #endif
  #include <sys/types.h>

! #if defined(__CYGWIN__) || defined(WIN32)
  #include <errno.h>
  #include <sys/fcntl.h>            /* ensure O_BINARY is available */
  #endif
***************
*** 678,684 ****
   * ----------------------------------------------------------------
   */

! #ifdef __CYGWIN__
  #define PG_BINARY    O_BINARY
  #define PG_BINARY_R "rb"
  #define PG_BINARY_W "wb"
--- 678,684 ----
   * ----------------------------------------------------------------
   */

! #if defined(__CYGWIN__) || defined(WIN32)
  #define PG_BINARY    O_BINARY
  #define PG_BINARY_R "rb"
  #define PG_BINARY_W "wb"
Index: src/include/utils/datetime.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/utils/datetime.h,v
retrieving revision 1.36
diff -c -c -r1.36 datetime.h
*** src/include/utils/datetime.h    20 Feb 2003 05:24:55 -0000    1.36
--- src/include/utils/datetime.h    3 Apr 2003 06:09:41 -0000
***************
*** 217,223 ****
  #endif

  /* Global variable holding time zone information. */
! #if defined(__CYGWIN__) || defined(N_PLAT_NLM)
  #define TIMEZONE_GLOBAL _timezone
  #else
  #define TIMEZONE_GLOBAL timezone
--- 217,223 ----
  #endif

  /* Global variable holding time zone information. */
! #if defined(__CYGWIN__) || defined(WIN32) || defined(N_PLAT_NLM)
  #define TIMEZONE_GLOBAL _timezone
  #else
  #define TIMEZONE_GLOBAL timezone
Index: src/interfaces/ecpg/pgtypeslib/dt.h
===================================================================
RCS file: /cvsroot/pgsql-server/src/interfaces/ecpg/pgtypeslib/dt.h,v
retrieving revision 1.3
diff -c -c -r1.3 dt.h
*** src/interfaces/ecpg/pgtypeslib/dt.h    1 Apr 2003 14:37:25 -0000    1.3
--- src/interfaces/ecpg/pgtypeslib/dt.h    3 Apr 2003 06:09:41 -0000
***************
*** 216,222 ****
  #endif

  /* Global variable holding time zone information. */
! #if defined(__CYGWIN__) || defined(N_PLAT_NLM)
  #define TIMEZONE_GLOBAL _timezone
  #else
  #define TIMEZONE_GLOBAL timezone
--- 216,222 ----
  #endif

  /* Global variable holding time zone information. */
! #if defined(__CYGWIN__) || defined(WIN32) || defined(N_PLAT_NLM)
  #define TIMEZONE_GLOBAL _timezone
  #else
  #define TIMEZONE_GLOBAL timezone
Index: src/tools/entab/entab.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/tools/entab/entab.c,v
retrieving revision 1.11
diff -c -c -r1.11 entab.c
*** src/tools/entab/entab.c    9 Jan 2002 18:21:46 -0000    1.11
--- src/tools/entab/entab.c    3 Apr 2003 06:09:44 -0000
***************
*** 94,100 ****
              in_file = stdin;
          else
          {
! #ifndef __CYGWIN__
              if ((in_file = fopen(*argv, "r")) == NULL)
  #else
              if ((in_file = fopen(*argv, "rb")) == NULL)
--- 94,100 ----
              in_file = stdin;
          else
          {
! #if defined(__CYGWIN__) || defined(WIN32)
              if ((in_file = fopen(*argv, "r")) == NULL)
  #else
              if ((in_file = fopen(*argv, "rb")) == NULL)

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: system() patch for Win32
Next
From: Tom Lane
Date:
Subject: Re: system() patch for Win32