Fix Win32/Cygwin problems:

After updating to the latest cvs, and also building most of the addons
(like PLs), the following patch is neededf for win32 + Visual C++.

* Switch to use the new win32 semaphore code
* Rename win32_open to pgwin32_open. win32_open collides with symbols
defined in Perl. MingW didn't detect ig, MSVC did. And it's a bit too
generic a name to export globally, imho...
* Python defines some partially broken #pragmas in the headers when
doing a debug build. Workaround.

Magnus Hagander
This commit is contained in:
Bruce Momjian 2006-06-25 00:18:24 +00:00
parent ac7a126d0c
commit d8f75d4131
4 changed files with 19 additions and 8 deletions

View File

@ -628,7 +628,7 @@
/* #undef USE_SSL */
/* Define to select SysV-style semaphores. */
#define USE_SYSV_SEMAPHORES 1
/* #undef USE_SYSV_SEMAPHORES */
/* Define to select SysV-style shared memory. */
#define USE_SYSV_SHARED_MEMORY 1
@ -636,6 +636,9 @@
/* Define to select unnamed POSIX semaphores. */
/* #undef USE_UNNAMED_POSIX_SEMAPHORES */
/* Define to select Win32-style semaphores. */
#define USE_WIN32_SEMAPHORES
/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/port.h,v 1.92 2006/06/07 22:24:45 momjian Exp $
* $PostgreSQL: pgsql/src/include/port.h,v 1.93 2006/06/25 00:18:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -246,10 +246,10 @@ extern bool rmtree(char *path, bool rmtopdir);
/* open() replacement to allow delete of held files and passing
* of special options. */
extern int win32_open(const char *, int,...);
extern int pgwin32_open(const char *, int,...);
#ifndef FRONTEND
#define open(a,b,c) win32_open(a,b,c)
#define open(a,b,c) pgwin32_open(a,b,c)
#endif
#define popen(a,b) _popen(a,b)

View File

@ -1,12 +1,20 @@
/**********************************************************************
* plpython.c - python as a procedural language for PostgreSQL
*
* $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.82 2006/06/16 18:42:23 tgl Exp $
* $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.83 2006/06/25 00:18:24 momjian Exp $
*
*********************************************************************
*/
#if defined(_MSC_VER) && defined(_DEBUG)
/* Python uses #pragma to bring in a non-default libpython on VC++ if
* _DEBUG is defined */
#undef _DEBUG
#include <Python.h>
#define _DEBUG
#else
#include <Python.h>
#endif
#include "postgres.h"
/* system stuff */

View File

@ -6,7 +6,7 @@
*
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/port/open.c,v 1.12 2006/03/05 15:59:10 momjian Exp $
* $PostgreSQL: pgsql/src/port/open.c,v 1.13 2006/06/25 00:18:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -19,7 +19,7 @@
#include <fcntl.h>
#include <assert.h>
int win32_open(const char *fileName, int fileFlags,...);
int pgwin32_open(const char *fileName, int fileFlags,...);
static int
openFlagsToCreateFileFlags(int openFlags)
@ -54,7 +54,7 @@ openFlagsToCreateFileFlags(int openFlags)
* - handle other flags? (eg FILE_FLAG_NO_BUFFERING/FILE_FLAG_WRITE_THROUGH)
*/
int
win32_open(const char *fileName, int fileFlags,...)
pgwin32_open(const char *fileName, int fileFlags,...)
{
int fd;
HANDLE h;