delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/05/27/11:17:53

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=dHkEDPZZ3Bvb/CeXiKP0QkvkIVt/9oNffTRDUNRaOVHxQQR94F2E1
BHKflNFe9xqyLEurDQ16DKc3jJqldj2hHQJoZUZ6yRjeMmXxtXvgyurODDUhed/R
fT20JgCVGgrB7X0t9a9mo2ldT/esubMYDy9HWXe9UxdyQ+6RPpHrpI=
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=QXNkB6qGM3PdVX6kCoI0SDpN70U=; b=dYCUAuG8iKC2oiikk5dpyaZo0N2E
EWLlENm6S+B+pu4vzu8+WtojvCFgZ+i06WjxsLX6f/l4UdDIoHFBwIXl1k19/9v0
gGVQxzICC2n5wmgDctW7lEqjKz0UTMf74gC/BljqgQbbirQ1aVHhkPOOFp++5vgz
X9fnnPKRhS5Gitw=
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=-4.1 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2
X-HELO: calimero.vinschen.de
Date: Wed, 27 May 2015 17:17:34 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: cygwin-2 process handling
Message-ID: <20150527151734.GM16927@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <1573487218 DOT 1490468 DOT 1431969356192 DOT JavaMail DOT yahoo AT mail DOT yahoo DOT com> <555B6F71 DOT 4040906 AT cornell DOT edu> <555B7E03 DOT 40404 AT cornell DOT edu> <20150521205357 DOT 2c125b3bcaf877d0843b52b1 AT nifty DOT ne DOT jp> <20150527122312 DOT GF16927 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <20150527122312.GF16927@calimero.vinschen.de>
User-Agent: Mutt/1.5.23 (2014-03-12)

--hdW7zL/qDS6RXdAL
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On May 27 14:23, Corinna Vinschen wrote:
> Hi Takashi,
>=20
> On May 21 20:53, Takashi Yano wrote:
> > [...]
> > +  if (output_handle_local)
> > +    {
> > +      OBJECT_BASIC_INFORMATION obi;
> > +      NTSTATUS status;
> > +      ULONG hdl_cnt =3D 0;
> > +
> > +      status =3D NtQueryObject (output_handle_local, ObjectBasicInform=
ation,
> > +	  &obi, sizeof obi, NULL);
> > +      if (!NT_SUCCESS (status))
> > +	debug_printf ("NtQueryObject: %y", status);
> > +      else
> > +	hdl_cnt =3D obi.HandleCount;
> > +      termios_printf("HandleCount: %d", hdl_cnt);
> > +      if (hdl_cnt =3D=3D 1)
> > +	SetEvent (input_available_event);
> > +      CloseHandle (output_handle_local);
> > +    }
>=20=20
> Isn't that racy?  Consider two processes doing that at the same time.
> Both calls to NtQueryObject could come up with hdl_cnt =3D=3D 2 and the
> problem persists.
>=20
> Wouldn't it be safer to call SetEvent(input_available_event) all the
> time from here?

We discussed this already in March and only briefly talked about a
change like this requiring changes to fhandler_pty_slave::read.
However, I don't see this.  The read code already takes 0 bytes input
and broken pipe scenarios into account.  Do you see something needing
a change I don't?


Thanks,
Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--hdW7zL/qDS6RXdAL
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJVZeAOAAoJEPU2Bp2uRE+geyoP/Rxti8mZ57aXl3C5JrIRTnLp
AMPbryqH/M+fc/vxZdR8nsac6DJSARkCVbYGmKt5BJTFusTovHWkdXTVevLrl/CV
aC8iJEzOGd7C1enBj3pESZxQv/S/oX820E51CPW9HA9gfbYbUxooHV0UKonhRFxv
lazT2Jk03xZ66t4+9tvZo/QNbqRGimvoh3b1FMebFB195FMTi+h8ter0VVy5YCIk
D+OVVIkSTOCMcP0ArsSiAJOagJy5t45LDjTXzdVxDwT+k9NS5FGhIKyFFuJSvhxG
RoyYlUNYJL/KCx5BqmpYOH0k6cW6ScNW3iMjl5KIQ0HZMsQ5H9Mm92WerUdiitXr
IMrquAkmJzOAtRAF8d1PLNY2kCFB4ANAkZUD4dtvi0qy28TE3Yah5l5+Zhqhee3z
k5ThQjP3JmxWyBkZcfj55KmM++0zWud8QDgtVA/kiNG7TEoRTJB0evEWCTolKeMt
XP1/eWQTP26323gMlNFscue8aI7bADK85SG+Rkpytq0eORAs1D0hFjMcECk36pGS
7rAaTcSTSh2PvkybGiyfozmCM45HOFPr7O1pRpFBGag7UbRK5a3dFcgPwAUzHkNA
FLcgQ4qpATksgpNKhgkmeUFnaW0m7DkKh2sNzpHsEKaM2H/+C9ab8SnggxPttWpt
OMNuOtV4jelN35cV/GaV
=ug1o
-----END PGP SIGNATURE-----

--hdW7zL/qDS6RXdAL--

- Raw text -


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