This is the mail archive of the cygwin@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]

Re: [ANNOUNCEMENT] Updated: cygrunsrv-0.94-1


On Mon, Jul 16, 2001 at 10:04:17AM -0400, Jason Tishler wrote:
> What about trying to tackle this from another point of view?  I'm not
> sure if this is doable or acceptable, but what about adding logic to the
> Cygwin DLL so that it does not send SIGHUP (to itself) when the process is
> running under cygrunsrv?  If this is deemed accepted, does anyone have any
> ideas on what is the best way to determine when running under cygrunsrv?

That solution would be fine by me.  In fact, I would prefer it since
PostgreSQL would then not require _any_ source code changes to allow
operation as a win32 service.

I wonder if Cygwin should generate SIGHUP in this situation for any
process, not just cygrunsrv.  The ctrl_c_handler() function in
exceptions.cc sends SIGHUP to its own process when handling the
CTRL_CLOSE_EVENT and CTRL_SHUTDOWN_EVENT signals from the system.
According to MSDN [1], CTRL_SHUTDOWN_EVENT will only be received by
service processes.  Unix-based daemons don't expect to be associated
with a terminal (except for debugging modes of operation) and, if they
handle SIGHUP at all, use SIGHUP as a manually-invoked signal to
trigger administrative operations, not a signal indicating system
shutdown.  So what good is it for Cygwin to send SIGHUP in the event
of CTRL_SHUTDOWN_EVENT?

I don't have time to rebuild and test the Cygwin DLL right now, but
what I'm suggesting is represented by the attached patch.

[1] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/hh/winbase/conchar_5zz9.asp

-- 
Fred Yankowski           fred@OntoSys.com      tel: +1.630.879.1312
Principal Consultant     www.OntoSys.com       fax: +1.630.879.1370
OntoSys, Inc             38W242 Deerpath Rd, Batavia, IL 60510, USA

--
Index: exceptions.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/exceptions.cc,v
retrieving revision 1.91
diff -u -p -r1.91 exceptions.cc
--- exceptions.cc       2001/06/28 02:19:57     1.91
+++ exceptions.cc       2001/07/16 16:22:11
@@ -900,7 +900,8 @@ ctrl_c_handler (DWORD type)
        for each Cygwin process window that's open when the computer
        is shut down or console window is closed. */
     {
-      sig_send (NULL, SIGHUP);
+      if (type == CTRL_CLOSE_EVENT)
+       sig_send (NULL, SIGHUP);
       return FALSE;
     }
   tty_min *t = cygwin_shared->tty.get_tty (myself->ctty);

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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