Re: pg_ctl start broken on windows

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-hackers-win32 <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Re: pg_ctl start broken on windows
Date: 2004-06-10 21:41:07
Message-ID: 40C8D573.5030100@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers-win32

Gary Doades wrote:

>On 10 Jun 2004 at 10:45, Andrew Dunstan wrote:
>
>
>>Thanks. The file to patch is src/bin/pg_ctl/pg_ctl.c
>>
>>We'll need to do a bit more work than this, though. We have 2 cases -
>>one where there's a logfile parameter and one where there isn't. Both
>>cases need stdin to be the null device (is that the default if you say
>>no handle inheritance?). If there is no logfile parameter then the
>>process's stdout and stderr handles need to be those of the calling
>>process (i.e. pg_ctl). If there is such a param then the postmaster's
>>stdout and stderr both need to be a handle on that file, opened in
>>append mode. I believe this needs to be set up in the STARTUPINFO
>>(reading MSDN makes my brain hurt).
>>
>>Not sure of any other wrinkles.
>>
>>cheers
>>
>>andrew
>>
>>
>
>Hmm, I have managed to look at the pg_ctl.c code and I can't find any code in there for
>the service manager. If pg_ctl is to be run as a true service then there is a *lot* more
>work to do on this.
>
>I have used CreateProcess many times, but not redirecting the standard filestreams, I
>would have to think about that and do some experimentation. I thought that it might just
>be a case of dropping the CreateProcess code in and I could have done that with no
>probs.
>
>I believe at first glance that what you want can be done, but I don't think it is trivial.
>MSDN can be a real brain killer. Try taking a look at the service code. This is the code
>that would need to be put into pg_ctl to respond to the service manager
>(SERVICE_CONTROL_STOP, SERVICE_CONTROL_INTERROGATE,
>SERVICE_CONTROL_SHUTDOWN at a minimum) This also inherently would make
>pg_ctl multi threaded.
>
>Unfortunately I just don't have the few days that I would expect it to take to knock this
>into proper shape for a service with full redirection of the filestreams. I don't currently
>have anything set up for compiling postgres on my PC. I might be able to have a go at
>something next week or I could throw things around with another Windows person.
>
>
>

We don't have the service code yet. Right now we are wrestling with
getting pg_ctl to start the postmaster when called from the command line.

cheers

andrew

In response to

Responses

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Gary Doades 2004-06-10 21:47:45 Re: pg_ctl start broken on windows
Previous Message Gary Doades 2004-06-10 21:35:38 Re: pg_ctl start broken on windows