delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/03/12/07:18:58

X-Recipient: archive-cygwin AT delorie DOT 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 AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT 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 DOT yano AT nifty DOT ne DOT jp>
To: cygwin AT cygwin DOT 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 DOT 760df4752fdbd6f19a931851 AT nifty DOT ne DOT jp> <20150305133100 DOT GY3213 AT calimero DOT vinschen DOT de> <20150305135839 DOT GZ3213 AT calimero DOT vinschen DOT de> <20150306200710 DOT 1264a46aa8dd633943e56212 AT nifty DOT ne DOT jp> <20150308163759 DOT 9d3eacd5f3b168a1515a6bc2 AT nifty DOT ne DOT jp> <20150311164829 DOT GJ5732 AT calimero DOT vinschen DOT de>
Mime-Version: 1.0
X-IsSubscribed: yes

On Wed, 11 Mar 2015 17:48:29 +0100
Corinna Vinschen <corinna-cygwin AT cygwin DOT 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 DOT yano AT nifty DOT ne DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019