From 4d4953fc4187567f73e7e5ccd6678d19a156c240 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Fri, 18 Apr 2003 01:03:42 +0000 Subject: Make Win32 tests to match existing Cygwin tests, where appropriate. --- src/include/c.h | 16 ++++++++---- src/include/pg_config_manual.h | 18 ++++++++++++- src/include/port/cygwin.h | 7 +++--- src/include/port/win32.h | 57 ++++++++++++++++++++++++++++++++++++++++++ src/include/utils/datetime.h | 9 +------ 5 files changed, 89 insertions(+), 18 deletions(-) (limited to 'src/include') diff --git a/src/include/c.h b/src/include/c.h index 89d8012ba64..8b92a98793a 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.137 2003/04/06 22:45:23 petere Exp $ + * $Id: c.h,v 1.138 2003/04/18 01:03:42 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -51,7 +51,7 @@ */ #include "pg_config.h" -#include "pg_config_manual.h" +#include "pg_config_manual.h" /* must be after pg_config.h */ #include "pg_config_os.h" #include "postgres_ext.h" @@ -65,10 +65,8 @@ #endif #include -#ifdef __CYGWIN__ #include #include /* ensure O_BINARY is available */ -#endif #ifdef HAVE_SUPPORTDEFS_H #include #endif @@ -321,6 +319,14 @@ typedef unsigned long int uint64; #define HAVE_INT64_TIMESTAMP #endif +/* Global variable holding time zone information. */ +#ifndef HAVE_UNDERSCORE_TIMEZONE +#define TIMEZONE_GLOBAL timezone +#else +#define TIMEZONE_GLOBAL _timezone +#define tzname _tzname /* should be in time.h? */ +#endif + /* sig_atomic_t is required by ANSI C, but may be missing on old platforms */ #ifndef HAVE_SIG_ATOMIC_T typedef int sig_atomic_t; @@ -680,7 +686,7 @@ typedef NameData *Name; * ---------------------------------------------------------------- */ -#ifdef __CYGWIN__ +#if defined(__CYGWIN__) || defined(WIN32) #define PG_BINARY O_BINARY #define PG_BINARY_R "rb" #define PG_BINARY_W "wb" diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h index 1629638ebed..27493956703 100644 --- a/src/include/pg_config_manual.h +++ b/src/include/pg_config_manual.h @@ -6,7 +6,7 @@ * for developers. If you edit any of these, be sure to do a *full* * rebuild (and an initdb if noted). * - * $Id: pg_config_manual.h,v 1.1 2003/04/06 22:45:23 petere Exp $ + * $Id: pg_config_manual.h,v 1.2 2003/04/18 01:03:42 momjian Exp $ *------------------------------------------------------------------------ */ @@ -134,6 +134,22 @@ # define HAVE_UNIX_SOCKETS 1 #endif +/* + * Define this if your operating system supports link() + */ +#if !defined(__QNX__) && !defined(__BEOS__) && \ + !defined(__CYGWIN__) && !defined(WIN32) +# define HAVE_WORKING_LINK 1 +#endif + +/* + * Define this if your operating system has _timezone rather than timezone + */ +#if defined(__CYGWIN__) || defined(WIN32) +# define HAVE_INT_TIMEZONE /* has int _timezone */ +# define HAVE_UNDERSCORE_TIMEZONE 1 +#endif + /* * This is the default directory in which AF_UNIX socket files are * placed. Caution: changing this risks breaking your existing client diff --git a/src/include/port/cygwin.h b/src/include/port/cygwin.h index cb6d6ecc080..d3ae74b1bf5 100644 --- a/src/include/port/cygwin.h +++ b/src/include/port/cygwin.h @@ -1,11 +1,10 @@ -/* $Header: /cvsroot/pgsql/src/include/port/cygwin.h,v 1.1 2003/03/21 17:18:34 petere Exp $ */ +/* $Header: /cvsroot/pgsql/src/include/port/cygwin.h,v 1.2 2003/04/18 01:03:42 momjian Exp $ */ + +#include #define HAS_TEST_AND_SET typedef unsigned char slock_t; -#define tzname _tzname /* should be in time.h? */ -#define HAVE_INT_TIMEZONE /* has int _timezone */ - #include /* diff --git a/src/include/port/win32.h b/src/include/port/win32.h index b9ef739e9ce..a117be863af 100644 --- a/src/include/port/win32.h +++ b/src/include/port/win32.h @@ -1,3 +1,7 @@ +/* $Header: /cvsroot/pgsql/src/include/port/win32.h,v 1.7 2003/04/18 01:03:42 momjian Exp $ */ + +#include + #define USES_WINSOCK #define NOFILE 100 @@ -27,3 +31,56 @@ #define DLLIMPORT #endif + +/* + * Supplement to . + */ +#define uid_t int +#define gid_t int +#define pid_t unsigned long +#define ssize_t int +#define mode_t int +#define key_t long +#define ushort unsigned short + +/* + * Supplement to . + */ +#define lstat slat + +#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR) +#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG) + +#define S_IRUSR _S_IREAD +#define S_IWUSR _S_IWRITE +#define S_IXUSR _S_IEXEC +#define S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) + +/* + * Supplement to . + */ +#include +#undef EAGAIN +#undef EINTR +#define EINTR WSAEINTR +#define EAGAIN WSAEWOULDBLOCK +#define EMSGSIZE WSAEMSGSIZE +#define EAFNOSUPPORT WSAEAFNOSUPPORT +#define EWOULDBLOCK WSAEWOULDBLOCK +#define ECONNRESET WSAECONNRESET +#define EINPROGRESS WSAEINPROGRESS + +/* + * Supplement to . + */ +#define isnan _isnan +#define finite _finite +extern double rint(double x); + +/* + * Supplement to . + */ +#define snprintf _snprintf +#define vsnprintf _vsnprintf + + diff --git a/src/include/utils/datetime.h b/src/include/utils/datetime.h index 3a419615489..1f43ffbceaf 100644 --- a/src/include/utils/datetime.h +++ b/src/include/utils/datetime.h @@ -9,7 +9,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: datetime.h,v 1.37 2003/04/04 04:50:44 tgl Exp $ + * $Id: datetime.h,v 1.38 2003/04/18 01:03:42 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -216,13 +216,6 @@ do { \ } while(0) #endif -/* Global variable holding time zone information. */ -#if defined(__CYGWIN__) || defined(N_PLAT_NLM) -#define TIMEZONE_GLOBAL _timezone -#else -#define TIMEZONE_GLOBAL timezone -#endif - /* * Date/time validation * Include check for leap year. -- cgit v1.2.3