Andreas Pflug pgadmin
Fri Mar 25 13:20:21 PST 2005
Darcy Buskermolen wrote:

>I've made chages in -HEAD to address your signal()/sigaction() request, 
>but I lack a win32 development environment to test on.  If you could check 
>this under cvs -HEAD and report your findings.
>  
>

See attached some fixes to the current CVS HEAD.
Apparently, you took CYGWIN as macro name to distinguish the signal code 
paths. I'm not using CYGWIN, but MINGW, so the macro WIN32 is predefined 
and can be used. After these changes, xxid and slony1_funcs compile ok.

slon.c won't compile until
    #include "libpq/pqsignal.h"
is included because sighandler isn't defined.

After that, linkage fails from alarm, fork, pipe, wait, getppid symbols.

alarm isn't surprising, it failed from that in the 1.0.5 branch too. 
This has to be implemented differently in win32, which wouldn't be too 
complicated.

Unfortunately, the latest invention of the fork code is much more 
incompatible. Not only that fork() isn't available, the communication 
stuff is implemented in a unix only way (pipes are files in win32, not 
sockets).

Actually, all stuff that handles with processes and signals should be 
implemented for win32 in a completely different way. Currently, this is 
not easily done because the config/worker code is interwoven with 
process/signal code. I'd propose to separate these sections, so a win32 
specific implementation can be added later (V1.1.1?).

FYI:
In win32, I wouldn't implement a watchdog at all. The slon process would 
be under control of the win32 service manager, which handles this. Same 
for SIGHUP and SIGALRM.

Regards,
Andreas

-------------- next part --------------
Index: configure
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/configure,v
retrieving revision 1.45
diff -u -r1.45 configure
--- configure	23 Mar 2005 22:59:22 -0000	1.45
+++ configure	25 Mar 2005 12:52:35 -0000
@@ -5996,7 +5996,7 @@
 
     HAVE_POSIX_SIGNALS=$slonac_cv_func_posix_signals
   else
-    if x"$template" = xwin ; then
+    if test $template = win ; then
       echo "$as_me:$LINENO: result: \"Skipping Error on win32\"" >&5
 echo "${ECHO_T}\"Skipping Error on win32\"" >&6
     else

Index: makefiles/Makefile.win
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/makefiles/Makefile.win,v
retrieving revision 1.5
diff -u -r1.5 Makefile.win
--- makefiles/Makefile.win	23 Mar 2005 22:59:23 -0000	1.5
+++ makefiles/Makefile.win	25 Mar 2005 12:45:59 -0000
@@ -2,7 +2,7 @@
 LDFLAGS+= -g
 DLLTOOL= dlltool
 DLLWRAP= dllwrap
-DLLLIBS= -lcygipc -lcrypt -lpostgres
+DLLLIBS= -L$(pgpkglibdir) -lpostgres
 BE_DLLLIBS=-lpostgres
 MK_NO_LORDER=true
 MAKE_DLL=true
@@ -14,7 +14,8 @@
 AROPT = crs
 DLSUFFIX = .dll
 CFLAGS_SL =
-override CFLAGS += -DCYGWIN=1
+override CFLAGS += $(CPPFLAGS) -DCYGWIN=1
+override LDFLAGS += $(DLLLIBS) -lpthread
 
 %.dll: %.o
 	$(DLLTOOL) --export-all --output-def $*.def $<
Index: src/slon/misc.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/misc.c,v
retrieving revision 1.17
diff -u -r1.17 misc.c
--- src/slon/misc.c	18 Feb 2005 00:15:57 -0000	1.17
+++ src/slon/misc.c	25 Mar 2005 12:46:00 -0000
@@ -23,8 +23,9 @@
 #include <signal.h>
 #include <sys/time.h>
 #include <sys/types.h>
-
+#ifndef WIN32
 #include <syslog.h>
+#endif
 #include <stdarg.h>
 
 #include "libpq-fe.h"
Index: src/slon/scheduler.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/scheduler.c,v
retrieving revision 1.20
diff -u -r1.20 scheduler.c
--- src/slon/scheduler.c	23 Mar 2005 23:06:50 -0000	1.20
+++ src/slon/scheduler.c	25 Mar 2005 12:46:01 -0000
@@ -21,8 +21,9 @@
 #include <errno.h>
 #include <sys/time.h>
 #include <sys/types.h>
+#ifndef WIN32
 #include <sys/socket.h>
-
+#endif
 #include "libpq-fe.h"
 #include "c.h"
 
Index: slon.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/slon.c,v
retrieving revision 1.49
diff -u -r1.49 slon.c
--- slon.c	23 Mar 2005 23:06:50 -0000	1.49
+++ slon.c	25 Mar 2005 12:49:42 -0000
@@ -673,7 +673,7 @@
 		
 		slon_log(SLON_DEBUG2, "slon: begin signal handler setup\n");
 
-#ifndef (CYGWIN)
+#ifndef CYGWIN
 		act.sa_handler = &sighandler; 
 		sigemptyset(&act.sa_mask);
 		act.sa_flags = SA_NODEFER;



More information about the Slony1-general mailing list