Re: [PATCHES] postgresql 8.0 with cygwin - success - Mailing list pgsql-cygwin
From | Bruce Momjian |
---|---|
Subject | Re: [PATCHES] postgresql 8.0 with cygwin - success |
Date | |
Msg-id | 200410160331.i9G3Vie17324@candle.pha.pa.us Whole thread Raw |
In response to | Re: postgresql 8.0 with cygwin - success (Reini Urban <rurban@x-ray.at>) |
Responses |
Re: [PATCHES] postgresql 8.0 with cygwin - success
|
List | pgsql-cygwin |
I did things a little differently. I #undef WIN32 after including windows.h on Cygwin and kept the defines the same except for the use of START. This makes things more consistent. Applied. --------------------------------------------------------------------------- Reini Urban wrote: > Marek Lewczuk schrieb: > > Reini Urban wrote: > >> Bruce Momjian schrieb: > >>> Great. Thanks. I was getting conflicting reports of Cygwin problems > >>> before. > >> > >> Not for me: > >> I found a problem with my pg_ctl patch (WIN32 is always defined in > >> cygwin when windows.h is included, and the START /B postmaster cmdline > >> doesn't work on cygwin). Patch will be posted soon. > > > > Right. pg_ctl is not working - I didn't noticed that, because I use > > postmaster instead pg_ctl. Below pg_ctl error: > > $ pg_ctl start > > START: not found > > pg_ctl: could not start postmaster: exit code was 32512 > > Bruce: > > was wondering about that use of START. What I think we will do > >is to add a comment that including windows.h in that file defines WIN32 > >and have an #ifndef __CYGWIN__ in places that need it --- just let me > >know. > > Attached is my improved version: (just as you said) > > * Fix previous pg_ctl patch (WIN32 is always defined in cygwin when > windows.h is included, and the START /B postmaster cmdline doesn't > work on cygwin. > > You can safely ignore the patches of other two files, but these are my > remaining issues. (cygpg.dll just for overall conformancy). > > I still have to test how it interacts with the eventlog if started as > service. (under different users) > However it should be better than the 7.x versions, which had lotta > problems with logfile file-permissions, because services are run as the > SYSTEM user. > > >> But I finished now the plperl.sql regression tests and wait for > >> a clean regression suite to run through. > > > > It would be great - I've just tried to run some plperl function, but no > > luck (postgresql crashed). > > :( as with 7.x > > But first I have to find the SUBST problem (errno 140). > Then I will do some heavy IPC debugging with plperl. > (src/backend/port/ipc_test.c has to be fixed for old-style elog handling) > Then I have to do the mbregress tests (multibyte on cygwin? maybe newlib > has some remaining issues) > -- > Reini Urban > --- postgresql-8.0.0cvs/src/bin/pg_ctl/pg_ctl.c.orig 2004-10-15 13:35:42.000000000 +0200 > +++ postgresql-8.0.0cvs/src/bin/pg_ctl/pg_ctl.c 2004-10-15 18:17:30.093750000 +0200 > @@ -23,6 +23,9 @@ > > #if defined(__CYGWIN__) > #include <windows.h> > +#ifndef WIN32 > +#define WIN32 > +#endif > #endif > > #ifndef HAVE_OPTRESET > @@ -99,7 +102,7 @@ > static void do_status(void); > static void do_kill(pgpid_t pid); > > -#if defined(WIN32) || defined(__CYGWIN__) > +#if defined(WIN32) > static bool pgwin32_IsInstalled(SC_HANDLE); > static char *pgwin32_CommandLine(bool); > static void pgwin32_doRegister(); > @@ -120,7 +123,7 @@ > static char conf_file[MAXPGPATH]; > > > -#if defined(WIN32) || defined(__CYGWIN__) > +#if defined(WIN32) > static void > write_eventlog(int level, const char *line) > { > @@ -158,7 +161,7 @@ > va_list ap; > > va_start(ap, fmt); > -#if !defined(WIN32) && !defined(__CYGWIN__) > +#if !defined(WIN32) > /* On Unix, we just fprintf to stderr */ > vfprintf(stderr, fmt, ap); > #else > @@ -322,7 +325,7 @@ > * http://dev.remotenetworktechnology.com/cmd/cmdfaq.htm > */ > if (log_file != NULL) > -#if !defined(WIN32) && !defined(__CYGWIN__) > +#if !defined(WIN32) || defined(__CYGWIN__) > snprintf(cmd, MAXPGPATH, "%s\"%s\" %s%s < \"%s\" >> \"%s\" 2>&1 &%s", > #else > snprintf(cmd, MAXPGPATH, "%sSTART /B \"\" \"%s\" %s%s < \"%s\" >> \"%s\" 2>&1%s", > @@ -330,7 +333,7 @@ > SYSTEMQUOTE, postgres_path, pgdata_opt, post_opts, > DEVNULL, log_file, SYSTEMQUOTE); > else > -#if !defined(WIN32) && !defined(__CYGWIN__) > +#if !defined(WIN32) || defined(__CYGWIN__) > snprintf(cmd, MAXPGPATH, "%s\"%s\" %s%s < \"%s\" 2>&1 &%s", > #else > snprintf(cmd, MAXPGPATH, "%sSTART /B \"\" \"%s\" %s%s < \"%s\" 2>&1%s", > @@ -811,7 +814,7 @@ > } > } > > -#if defined(WIN32) || defined(__CYGWIN__) > +#if defined(WIN32) > > static bool > pgwin32_IsInstalled(SC_HANDLE hSCM) > @@ -1089,14 +1092,14 @@ > printf(_(" %s reload [-D DATADIR] [-s]\n"), progname); > printf(_(" %s status [-D DATADIR]\n"), progname); > printf(_(" %s kill SIGNALNAME PROCESSID\n"), progname); > -#if defined(WIN32) || defined(__CYGWIN__) > +#if defined(WIN32) > printf(_(" %s register [-N SERVICENAME] [-U USERNAME] [-P PASSWORD] [-D DATADIR] [-w] [-o \"OPTIONS\"]\n"), progname); > printf(_(" %s unregister [-N SERVICENAME]\n"), progname); > #endif > printf(_("Common options:\n")); > printf(_(" -D, --pgdata DATADIR location of the database storage area\n")); > printf(_(" -s, --silent only print errors, no informational messages\n")); > -#if defined(WIN32) || defined(__CYGWIN__) > +#if defined(WIN32) > printf(_(" -N service name with which to register PostgreSQL server\n")); > printf(_(" -P password of account to register PostgreSQL server\n")); > printf(_(" -U user name of account to register PostgreSQL server\n")); > @@ -1205,7 +1208,7 @@ > int c; > pgpid_t killproc = 0; > > -#if defined(WIN32) || defined(__CYGWIN__) > +#if defined(WIN32) > setvbuf(stderr, NULL, _IONBF, 0); > #endif > > @@ -1352,7 +1355,7 @@ > set_sig(argv[++optind]); > killproc = atol(argv[++optind]); > } > -#if defined(WIN32) || defined(__CYGWIN__) > +#if defined(WIN32) > else if (strcmp(argv[optind], "register") == 0) > ctl_command = REGISTER_COMMAND; > else if (strcmp(argv[optind], "unregister") == 0) > @@ -1442,8 +1445,8 @@ > case KILL_COMMAND: > do_kill(killproc); > break; > -#if defined(WIN32) || defined(__CYGWIN__) > +#if defined(WIN32) > case REGISTER_COMMAND: > pgwin32_doRegister(); > break; > --- postgresql-8.0.0cvs/contrib/spi/Makefile.orig 2004-08-20 22:13:08.000000000 +0200 > +++ postgresql-8.0.0cvs/contrib/spi/Makefile 2004-10-04 12:50:55.000000000 +0200 > @@ -17,4 +17,6 @@ > include $(top_builddir)/src/Makefile.global > include $(top_srcdir)/contrib/contrib-global.mk > endif > + > +SHLIB_LINK += -L$(top_builddir)/src/port -lpgport > --- postgresql-8.0.0cvs/src/interfaces/libpq/Makefile.orig 2004-10-15 13:35:50.000000000 +0200 > +++ postgresql-8.0.0cvs/src/interfaces/libpq/Makefile 2004-10-15 13:39:05.000000000 +0200 > @@ -30,6 +30,10 @@ > dllist.o md5.o ip.o wchar.o encnames.o noblock.o pgstrcasecmp.o thread.o \ > $(filter crypt.o getaddrinfo.o inet_aton.o open.o snprintf.o strerror.o, $(LIBOBJS)) > > +ifeq ($(PORTNAME), cygwin) > +override shlib = cyg$(NAME)$(DLSUFFIX) > +endif > + > ifeq ($(PORTNAME), win32) > OBJS += win32.o libpqrc.o > libpqrc.o : libpq.rc > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073 Index: src/bin/pg_ctl/pg_ctl.c =================================================================== RCS file: /cvsroot/pgsql/src/bin/pg_ctl/pg_ctl.c,v retrieving revision 1.39 diff -c -c -r1.39 pg_ctl.c *** src/bin/pg_ctl/pg_ctl.c 16 Oct 2004 03:10:14 -0000 1.39 --- src/bin/pg_ctl/pg_ctl.c 16 Oct 2004 03:29:22 -0000 *************** *** 23,28 **** --- 23,30 ---- #if defined(__CYGWIN__) #include <windows.h> + /* Cygwin defines WIN32 in windows.h, but we don't want it. */ + #undef WIN32 #endif #ifndef HAVE_OPTRESET *************** *** 333,339 **** * http://dev.remotenetworktechnology.com/cmd/cmdfaq.htm */ if (log_file != NULL) ! #if !defined(WIN32) && !defined(__CYGWIN__) snprintf(cmd, MAXPGPATH, "%s\"%s\" %s%s < \"%s\" >> \"%s\" 2>&1 &%s", #else snprintf(cmd, MAXPGPATH, "%sSTART /B \"\" \"%s\" %s%s < \"%s\" >> \"%s\" 2>&1%s", --- 335,341 ---- * http://dev.remotenetworktechnology.com/cmd/cmdfaq.htm */ if (log_file != NULL) ! #if !defined(WIN32) /* Cygwin doesn't have START */ snprintf(cmd, MAXPGPATH, "%s\"%s\" %s%s < \"%s\" >> \"%s\" 2>&1 &%s", #else snprintf(cmd, MAXPGPATH, "%sSTART /B \"\" \"%s\" %s%s < \"%s\" >> \"%s\" 2>&1%s", *************** *** 341,347 **** SYSTEMQUOTE, postgres_path, pgdata_opt, post_opts, DEVNULL, log_file, SYSTEMQUOTE); else ! #if !defined(WIN32) && !defined(__CYGWIN__) snprintf(cmd, MAXPGPATH, "%s\"%s\" %s%s < \"%s\" 2>&1 &%s", #else snprintf(cmd, MAXPGPATH, "%sSTART /B \"\" \"%s\" %s%s < \"%s\" 2>&1%s", --- 343,349 ---- SYSTEMQUOTE, postgres_path, pgdata_opt, post_opts, DEVNULL, log_file, SYSTEMQUOTE); else ! #if !defined(WIN32) /* Cygwin doesn't have START */ snprintf(cmd, MAXPGPATH, "%s\"%s\" %s%s < \"%s\" 2>&1 &%s", #else snprintf(cmd, MAXPGPATH, "%sSTART /B \"\" \"%s\" %s%s < \"%s\" 2>&1%s",
pgsql-cygwin by date: