On Fri, 5 Dec 2003, Frank Seesink wrote:
> Corinna Vinschen wrote:
> > Cygrunsrv has no idea about child processes
> > started from it's inferior process. It's the responsibility of that
> > process to care for its children. This is different from the situation
> > in the shell where a Ctrl-C results in a SIGINT sent to all processes
> > not detached from the console. A process started with spawn(_P_NOWAIT)
> > is not detached from the console.
> >
> BINGO! This is EXACTLY the reason then. So my statement stands. There
> most definitely IS a difference between running a Cygwin app under a
> shell vs. via cygrunsrv. And you just pointed it out.
>
> This is what I wanted to know. Now the question is, is there any way to
> get similar behavior to what you get with a shell like BASH? I've tried
> having cygrunsrv run a shell within which to launch Jabberd, but all I
> end up is the shell dying and BOTH jabberd.exe and jabadns.exe left
> behind. So I'm guessing that sending a SIGINT from cygrunsrv to a BASH
> shell is also different than doing it manually, as it does not propogate
> (or whatever technical term you wish to throw at it). The BASH shell
> does NOT react the same way under cygrunsrv as it does normally.
>
Actually, it does. What you did was send the bash process a signal. If
you did that "normally", you would see the same behavior. However, you
sent the signal via a key stroke interpreted by bash. That is the difference.
> I realize one way is to modify the source to have the main process kill
> the child, but that's a bit of code change.
>
> I was wondering, how hard would it be to have cygrunsrv provide the same
> functionality as a full shell? That is, this issue does not occur under
> Linux, even when Jabberd is run as a daemon on startup, so it's
> definitely a Cygwin/cygrunsrv-specific issue. Are there any plans to
> offer such functionality? Just curious.
>
What do you define as the equivalent of "net stop jaberd" on Linux?
Anyway, the attached patch to cygrunsrv seems like a good idea and should
accomplish this, I think.
2003-12-05 Brian Ford <[EMAIL PROTECTED]>
* cygrunsrv.cc (terminate_child): Send the signal to the whole
processes group.
--
Brian Ford
Senior Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
Phone: 314-551-8460
Fax: 314-551-8444
--- cygrunsrv.cc 2003-12-05 17:48:26.250000000 -0600
+++ cygrunsrv.cc.orig 2003-12-05 17:48:13.520000000 -0600
@@ -978,7 +978,7 @@ terminate_child ()
sleep (1);
else
{
- kill (-server_pid, termsig);
+ kill (server_pid, termsig);
report_service_status ();
return 0;
}
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/