delorie.com/archives/browse.cgi | search |
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:reply-to | |
:references:mime-version:content-type:in-reply-to; q=dns; s= | |
default; b=NbLZ6EIgDMYXCRU4X1fVngtkZtvNNLYtjL/hUqehF66jTyVqZ2Yqh | |
X6wS3l1Np4wIJ9x0iId88EBwwgpY+ACopok0NGqyK4lppf38f6cQWzjH03aVSn0d | |
WqAPqJfi6TG6qgigp9hlLgHO6vXbezmkAFcMyFKu9nog31I2Wiy+2c= | |
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:reply-to | |
:references:mime-version:content-type:in-reply-to; s=default; | |
bh=NlOFRbDxzeja4dexWFvPMxbyKF0=; b=I+aMdQn2eKJw1g0156Xqg6JDR3cZ | |
S/U/uDsYDBL8IG22onRe+y6oGeKfg2sr9qg61bKgN9eALxF8YzmFAWXb3wIePrLk | |
TnOsjzmAVI3B0WKGpt4AqtRL+rrEHnwYiqFH042mZcVBiX35LtcKXFh8+cVNK2aj | |
gX8su0gEwGFWXQI= | |
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-Spam-SWARE-Status: | No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 |
X-HELO: | calimero.vinschen.de |
Date: | Thu, 12 Mar 2015 15:54:23 +0100 |
From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: PTY dies when master in parent process is closed. |
Message-ID: | <20150312145423.GT5732@calimero.vinschen.de> |
Reply-To: | cygwin AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
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> <20150312200343 DOT deab52b09e3126d9cd80ab9c AT nifty DOT ne DOT jp> |
MIME-Version: | 1.0 |
In-Reply-To: | <20150312200343.deab52b09e3126d9cd80ab9c@nifty.ne.jp> |
User-Agent: | Mutt/1.5.23 (2014-03-12) |
--8RJ6MkOGpKElHlfH Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mar 12 20:03, Takashi Yano wrote: > On Wed, 11 Mar 2015 17:48:29 +0100 > Corinna Vinschen <corinna-cygwin AT cygwin DOT com> wrote: >=20 > > 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. > >=20 > > Since you suggested it, do you have another idea? >=20 > Nothing in particular. >=20 > > Off the top of my head what we could do: > >=20 > > - Either just set input_available_event always, unconditionally. But > > that probably requires to change fhandler_pty_slave::read as well. >=20 > The modification of fhandler_pty_slave::read() will be > probably not so small. To use PeekNamedPipe() or NtQueryObject() > is better, I suppose. >=20=20 > > - 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. >=20 > When NtQueryObject() is used, aim is clearer than using > PeekNamedPipe(). However, either is OK. Please choose one > which you like. On second thought, using NtQueryObject introduces a potential new race condition. Since for this test to make sense you have to check the output handle before closing it, the test-and-close action would have to be made atomically with all other ways to duplicate the handle. Using PeekNamedPipe after closing the handle is certainly the better approach. Patch applied with an additional preceeding comment so we know why PeekNamedPipe is called here. Thanks, Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --8RJ6MkOGpKElHlfH Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVAaifAAoJEPU2Bp2uRE+gL/YQAIY5u73sL+BV34uehsXGrrxt eYeqmHAE9P5U5Gw31VtnfOfpTwU47kP4MMXxvIm2MLTmB+mKLUjK9pfksNpjximv CxuYJ55OLJ8bO/uPu9zjdYZESZkVHJP34CAZGfOMJ9tsJwk1UanxX7Nw3F/vY7iT zVCxrm0Tfn9Y4FrHf7Jr3kVeQDfTm1AIh3M10JsSwJnzD+q6xLt9a63LnrQ+GiLc yGGQmiDe0I12Nynt3K3JoeykqEbgncuWQo1d7nMBB1e2H7XD5R8HCnZA0hQSW09r sRI5Z0a8WQYQazS6GuMyy/sKCfzgPPK+6j6InhZNxXfpVdfLTYfFnmdVmegRBEd1 AgycxUnXmEph/MbcaykN0MLHXmeeILQcopOHqjF853iCj1BFFAnhwTeCkU+/O24G rr6SGUUWU/m0J8ndC51mmbeJ8BJwB9v4N3JV1CVGwcKMYXDqOi8BueYqSEgov8sB wtNsn/3PefY5VaMlc19+pYOdqUql3xbw0c7rURJKYiRwYCBImjg1Eayg99ByfuDe sTFZvMYGW0lIgZixiaDdncFOtKVF6Um12/L6OLJ1HF0LJuspQY7Jj3eWzBrGsHVM 3rSjjTbDny37lTpQCAZf1Os9uNE8Ktl93yhp1kv6Uv6o8d8HyKtlubXHSj8MjGc7 /WUD01WW5HghvmnvXW7q =DBQm -----END PGP SIGNATURE----- --8RJ6MkOGpKElHlfH--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |