1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Allow Win32 to compile under MinGW. Major changes are:

Win32 port is now called 'win32' rather than 'win'
        add -lwsock32 on Win32
        make gethostname() be only used when kerberos4 is enabled
        use /port/getopt.c
        new /port/opendir.c routines
        disable GUC unix_socket_group on Win32
        convert some keywords.c symbols to KEYWORD_P to prevent conflict
        create new FCNTL_NONBLOCK macro to turn off socket blocking
        create new /include/port.h file that has /port prototypes, move
          out of c.h
        new /include/port/win32_include dir to hold missing include files
        work around ERROR being defined in Win32 includes
This commit is contained in:
Bruce Momjian
2003-05-15 16:35:30 +00:00
parent 2c0556068f
commit 12c9423832
39 changed files with 488 additions and 360 deletions

View File

@@ -13,7 +13,7 @@
# be converted to Method 2.
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/port/Makefile,v 1.18 2002/07/27 20:10:05 petere Exp $
# $Header: /cvsroot/pgsql/src/backend/port/Makefile,v 1.19 2003/05/15 16:35:29 momjian Exp $
#
#-------------------------------------------------------------------------
@@ -26,7 +26,7 @@ OBJS+=dynloader.o pg_sema.o pg_shmem.o
OBJS+=$(TAS)
ifeq ($(PORTNAME), qnx4)
OBJS+=getrusage.o qnx4/SUBSYS.o
OBJS+=qnx4/SUBSYS.o
endif
ifeq ($(PORTNAME), beos)
OBJS+=beos/SUBSYS.o
@@ -34,6 +34,9 @@ endif
ifeq ($(PORTNAME), darwin)
OBJS+=darwin/SUBSYS.o
endif
ifeq ($(PORTNAME), win32)
OBJS+=win32/SUBSYS.o
endif
all: SUBSYS.o
@@ -55,6 +58,11 @@ darwin/SUBSYS.o: darwin.dir
darwin.dir:
$(MAKE) -C darwin all
win32/SUBSYS.o: win32.dir
win32.dir:
$(MAKE) -C win32 all
tas.o: tas.s
$(CC) $(CFLAGS) -c $<
@@ -67,3 +75,5 @@ distclean clean:
$(MAKE) -C beos clean
$(MAKE) -C darwin clean
$(MAKE) -C qnx4 clean
$(MAKE) -C win32 clean

View File

@@ -1,4 +1,4 @@
/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/win.c,v 1.2 2003/03/21 17:18:34 petere Exp $ */
/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/win32.c,v 1.1 2003/05/15 16:35:29 momjian Exp $ */
#include <windows.h>

View File

@@ -10,7 +10,6 @@
#include "postgres.h"
#include "storage/shmem.h"
#include "sema.h"
#include <errno.h>
@@ -131,7 +130,8 @@ semget(int semKey, int semNum, int flags)
Size sem_set_size = sizeof(win32_sem_set_hdr) + semNum * (sizeof(HANDLE) + sizeof(int));
HANDLE *sem_handles = NULL;
int *sem_counts = NULL;
int i;
sec_attrs.nLength = sizeof(sec_attrs);
sec_attrs.lpSecurityDescriptor = NULL;
sec_attrs.bInheritHandle = TRUE;
@@ -158,7 +158,7 @@ semget(int semKey, int semNum, int flags)
sem_handles = (HANDLE *) ((off_t) new_set + new_set->m_semaphoreHandles);
sem_counts = (int *) ((off_t) new_set + new_set->m_semaphoreCounts);
for (int i = 0; i < semNum && ans; ++i)
for (i = 0; i < semNum && ans; ++i)
{
strcpy(num_part, _itoa(i, cur_num, 10));
@@ -186,8 +186,9 @@ semget(int semKey, int semNum, int flags)
return MAKE_OFFSET(new_set);
else
{
int i;
/* Blow away what we've got right now... */
for (int i = 0; i < semNum; ++i)
for (i = 0; i < semNum; ++i)
{
if (sem_handles[i])
CloseHandle(sem_handles[i]);