Index: configure.in =================================================================== RCS file: /projects/cvsroot/pgsql-server/configure.in,v retrieving revision 1.322 diff -c -r1.322 configure.in *** configure.in 24 Mar 2004 03:54:16 -0000 1.322 --- configure.in 27 Mar 2004 04:53:32 -0000 *************** *** 909,914 **** --- 909,915 ---- AC_LIBOBJ(gettimeofday) AC_LIBOBJ(open) AC_LIBOBJ(pipe) + AC_LIBOBJ(socket) AC_LIBOBJ(rand) ;; esac --- 143,148 ---- Index: src/backend/postmaster/postmaster.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/postmaster/postmaster.c,v retrieving revision 1.379 diff -c -r1.379 postmaster.c *** src/backend/postmaster/postmaster.c 24 Mar 2004 15:20:54 -0000 1.379 --- src/backend/postmaster/postmaster.c 27 Mar 2004 04:53:38 -0000 *************** *** 2017,2051 **** } - #ifdef WIN32 - /* - * On WIN32, we cannot use socket functions inside - * an APC (signal handler). If we do, select() will return - * with incorrect return values, causing the postmaster to - * enter a blocking accept(). We work around this by - * running it on a separate thread. We still block the main - * thread until it is done, so we don't scribble over any - * data from the wrong thread (pgstat functions aqre not - * thread safe). - */ - static DWORD WINAPI win32_pgstat_beterm_thread(LPVOID param) - { - pgstat_beterm((int)param); - return 0; - } - - static void win32_pgstat_beterm(int pid) { - HANDLE beterm_thread = CreateThread(NULL, 64*1024, win32_pgstat_beterm_thread, (LPVOID)pid, 0, NULL); - if (!beterm_thread) - ereport(FATAL, - (errmsg_internal("failed to create beterm sender thread: %i", (int)GetLastError()))); - if (WaitForSingleObject(beterm_thread,INFINITE) != WAIT_OBJECT_0) - ereport(FATAL, - (errmsg_internal("failed to wait for beterm sender thread: %i", (int)GetLastError()))); - CloseHandle(beterm_thread); - } - #endif - /* * CleanupProc -- cleanup after terminated backend. * --- 2017,2022 ---- *************** *** 2099,2109 **** else if (pid == BgWriterPID) BgWriterPID = 0; else - #ifndef WIN32 pgstat_beterm(pid); - #else - win32_pgstat_beterm(pid); - #endif return; } Index: src/include/port.h =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/include/port.h,v retrieving revision 1.23 diff -c -r1.23 port.h *** src/include/port.h 24 Mar 2004 03:54:16 -0000 1.23 --- src/include/port.h 27 Mar 2004 04:53:40 -0000 *************** *** 57,62 **** --- 57,70 ---- extern int copydir(char *fromdir, char *todir); + /* socket wrappers to handle APC/socket bug */ + #define recv(a,b,c,d) pg_recv(a,b,c,d) + #define send(a,b,c,d) pg_send(a,b,c,d) + #define select(a,b,c,d,e) pg_select(a,b,c,d,e) + extern int pg_recv(int s, void *buf, size_t len, int flags); + extern int pg_send(int s, const void *msg, size_t len, int flags); + extern int pg_select(int n, fd_set* read_mask, fd_set* write_mask, fd_set* except_mask, const struct timeval* timeout); + /* Missing rand functions */ extern long lrand48(void); extern void srand48(long seed); Index: src/interfaces/libpq/Makefile =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/interfaces/libpq/Makefile,v retrieving revision 1.100 diff -c -r1.100 Makefile *** src/interfaces/libpq/Makefile 24 Mar 2004 03:54:16 -0000 1.100 --- src/interfaces/libpq/Makefile 27 Mar 2004 04:53:43 -0000 *************** *** 23,29 **** OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \ fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o \ dllist.o md5.o ip.o wchar.o encnames.o \ ! $(filter crypt.o getaddrinfo.o inet_aton.o noblock.o snprintf.o strerror.o open.o path.o thread.o, $(LIBOBJS)) ifeq ($(PORTNAME), win32) OBJS+=win32.o endif --- 23,29 ---- OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \ fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o \ dllist.o md5.o ip.o wchar.o encnames.o \ ! $(filter crypt.o getaddrinfo.o inet_aton.o noblock.o snprintf.o strerror.o open.o path.o socket.o thread.o, $(LIBOBJS)) ifeq ($(PORTNAME), win32) OBJS+=win32.o endif *************** *** 52,58 **** # For port modules, this only happens if configure decides the module # is needed (see filter hack in OBJS, above). ! crypt.c getaddrinfo.c inet_aton.c noblock.c snprintf.c strerror.c open.c path.c thread.c: % : $(top_srcdir)/src/port/% rm -f $@ && $(LN_S) $< . md5.c ip.c: % : $(backend_src)/libpq/% --- 52,58 ---- # For port modules, this only happens if configure decides the module # is needed (see filter hack in OBJS, above). ! crypt.c getaddrinfo.c inet_aton.c noblock.c snprintf.c strerror.c open.c path.c socket.c thread.c: % : $(top_srcdir)/src/port/% rm -f $@ && $(LN_S) $< . md5.c ip.c: % : $(backend_src)/libpq/% *************** *** 78,81 **** rm -f $(DESTDIR)$(includedir)/libpq-fe.h $(DESTDIR)$(includedir_internal)/libpq-int.h $(DESTDIR)$(includedir_internal)/pqexpbuffer.h clean distclean maintainer-clean: clean-lib ! rm -f $(OBJS) crypt.c getaddrinfo.c inet_aton.c noblock.c snprintf.c strerror.c path.c thread.c dllist.c md5.c ip.c encnames.c wchar.c --- 78,81 ---- rm -f $(DESTDIR)$(includedir)/libpq-fe.h $(DESTDIR)$(includedir_internal)/libpq-int.h $(DESTDIR)$(includedir_internal)/pqexpbuffer.h clean distclean maintainer-clean: clean-lib ! rm -f $(OBJS) crypt.c getaddrinfo.c inet_aton.c noblock.c snprintf.c strerror.c open.c path.c socket.c thread.c dllist.c md5.c ip.c encnames.c wchar.c