X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:to:subject:message-id:in-reply-to
	:references:mime-version:content-type:content-transfer-encoding;
	 q=dns; s=default; b=hl6QkuSarrKtk8+SH3ll+RoZ7At+DHBYDunpEdS9Cm0
	N7K+nnof2AFRvBPAUQZwcXPkIyN1UaT27BvEjrNVZ+hb0xFxjYvhBV8eGy/uJkXP
	/9B1cyrp9sX6Nz/4EQ5COv0E9UsXnA+VW8QfcraWyj8oQWfM5ZpOaKpdFz+zHKCQ
	=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:to:subject:message-id:in-reply-to
	:references:mime-version:content-type:content-transfer-encoding;
	 s=default; bh=9AUfp5Z5/ARmtBJ0Bdm2hSwHKLA=; b=FOmFWHPF2N6BI9D9/
	bEen+ucYJiR3Og097mRJLokYvTBtLHcQZBfuhZ1+mFacwqMJJNLklIN+kek6SL9H
	V9KTjpscwhZJ9BV3/mNfIBNlxt82YQU104nJzCKV154RFZVqckNZGJUE1v/PFLZd
	PCkG59AEXGc34dA/BI2QL/khxI=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-HELO: condef008-v.nifty.com
X-Nifty-SrcIP: [121.93.68.199]
Date: Thu, 12 Mar 2015 20:03:43 +0900
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: Re: PTY dies when master in parent process is closed.
Message-Id: <20150312200343.deab52b09e3126d9cd80ab9c@nifty.ne.jp>
In-Reply-To: <20150311164829.GJ5732@calimero.vinschen.de>
References: <20150305215323.760df4752fdbd6f19a931851@nifty.ne.jp>	<20150305133100.GY3213@calimero.vinschen.de>	<20150305135839.GZ3213@calimero.vinschen.de>	<20150306200710.1264a46aa8dd633943e56212@nifty.ne.jp>	<20150308163759.9d3eacd5f3b168a1515a6bc2@nifty.ne.jp>	<20150311164829.GJ5732@calimero.vinschen.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

On Wed, 11 Mar 2015 17:48:29 +0100
Corinna Vinschen <corinna-cygwin@cygwin.com> wrote:

> I'm inclined to apply this patch.  I think using PeekNamedPipe this way
> is pretty nice, albeit it's not atomic.  It might be a good idea to add
> an acquire/release_output_mutex bracket, even if that doesn't help for
> cases in which a process holding a master fd crashes hard.
> 
> Since you suggested it, do you have another idea?

Nothing in particular.

> Off the top of my head what we could do:
> 
> - Either just set input_available_event always, unconditionally.  But
>   that probably requires to change fhandler_pty_slave::read as well.

The modification of fhandler_pty_slave::read() will be
probably not so small. To use PeekNamedPipe() or NtQueryObject()
is better, I suppose.
 
> - Or, use NtQueryObject to fetch the handle count of from_master (see
>   flock.cc function get_obj_handle_count()).  If the handle count is
>   one, we're the last process holding the handle and then we set
>   input_available_event.  But I'm not sure if it's really worth it.  The
>   PeekNamedPipe usage looks rather ok to me.

When NtQueryObject() is used, aim is clearer than using
PeekNamedPipe(). However, either is OK. Please choose one
which you like.

> Oh, btw.  Please always add the ChangeLog entries as plain text, not as
> diff.  ChangeLog diffs usually don't apply without manual intervention.

Thank you for your advice. Next time, I will do so.

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

