X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: Eric Blake <ebb9@byu.net>
Subject:  Re: Bash process remains after I close rxvt in certain ways
Date: Mon, 13 Nov 2006 15:18:56 +0000 (UTC)
Lines: 31
Message-ID:  <loom.20061113T161452-299@post.gmane.org>
References:  <ej7u2n$mgb$1@sea.gmane.org> <45586C29.4050805@byu.net> <45588A58.3080704@cwilson.fastmail.fm>
Mime-Version:  1.0
Content-Type:  text/plain; charset=us-ascii
Content-Transfer-Encoding:  7bit
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Charles Wilson <cygwin <at> cwilson.fastmail.fm> writes:

> Or what *should* be happening.
> 
> So, I think that in src/command.c, right before exit() is called, rxvt 
> ought to kill its children -- except I thought exit() should do that 
> already?

http://www.opengroup.org/onlinepubs/009695399/functions/exit.html:
"Termination of a process does not directly terminate its children. The sending 
of a SIGHUP signal as described below indirectly terminates children in some 
circumstances.
...
"If the process is a controlling process, the SIGHUP signal shall be sent to 
each process in the foreground process group of the controlling terminal 
belonging to the calling process.
"If the process is a controlling process, the controlling terminal associated 
with the session shall be disassociated from the session, allowing it to be 
acquired by a new controlling process.
"If the exit of the process causes a process group to become orphaned, and if 
any member of the newly-orphaned process group is stopped, then a SIGHUP signal 
followed by a SIGCONT signal shall be sent to each process in the newly-
orphaned process group."

Sounds like you are right - rxvt should be a controlling process, so calling 
exit() should automatically cause cygwin to send SIGHUP to the process group, 
and rxvt shouldn't have to do any manual killing.

-- 
Eric Blake



--
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/

