This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: what's left for 1.5.0


On Mon, Jun 09, 2003 at 09:39:33AM -0400, Christopher Faylor wrote:
> On Mon, Jun 09, 2003 at 09:17:44AM -0400, Jason Tishler wrote:
> >I share the above concern too.  However, only services can rely on this
> >behavior.  Additionally, it is likely only services that have been
> >ported to be true NT services (i.e., do not run under cygrunsrv) could
> >be affected.  The set of such services is most likely very small --
> >possibly only containing inetd.
> 
> It's possible to run any raw cygwin app as a service, right?

Well, not really.  They can be started by cygrunsrv but in that case
cygrunsrv is the service and only the service itself gets the
CTRL_SHUTDOWN_EVENT.  However, cygrunsrv is handling the shutdown
event in the service_handler which then sends the "right" signal
to the inferior application.  Inetd only handles SERVICE_CONTROL_STOP
so far, not SERVICE_CONTROL_SHUTDOWN but that's ok since inetd has
no cleanup tasks to perform.

I discussed this with Chris already back in July 2001 and he refused
to remove that code with the rationale that a daemon shouldn't have a
console associated with the process and so the problem isn't how to
handle CTRL_SHUTDOWN_EVENT but how to completely disassociate the daemon
from a console window, which has its point.

Why does postgreSQL run a service process which isn't disassociated from
the console?  Well, that's probably because cygrunsrv calls AllocConsole()
when running under NT.  This should be not needed beginning with 1.5.0
but it is important up to 1.3.22 to allow output from native Windows
child processes.

Another problem is this:  A service application (regardless whether
started from cygrunsrv or by any other method) may run inside of a
console window purposely.  That's the point of having the "Allow
service to interact with desktop" setting in SCM.

After all I think it's better to remove the CTRL_SHUTDOWN_EVENT handling
from ctrl_c_handler().   It's not correct to send SIGTERM from inside
Cygwin to the service process since all services are getting the
SERVICE_CONTROL_SHUTDOWN message anyway and especially in cygrunsrv
it's handled so that the inferior process gets the signal it needs
to shutdown properly.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]