Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com X-Authentication-Warning: shell-2.enteract.com: fcy set sender to fred AT ontosys DOT com using -f Date: Mon, 16 Jul 2001 11:34:16 -0500 From: Fred Yankowski To: cygwin AT cygwin DOT com, pgsql-cygwin AT postgresql DOT org Subject: Re: [ANNOUNCEMENT] Updated: cygrunsrv-0.94-1 Message-ID: <20010716113416.A68159@enteract.com> References: <20010712114208 DOT A11408 AT enteract DOT com> <20010716100417 DOT D561 AT dothill DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010716100417.D561@dothill.com>; from Jason.Tishler@dothill.com on Mon, Jul 16, 2001 at 10:04:17AM -0400 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 AT OntoSys DOT 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/