From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.10]) by sourceware.org (Postfix) with ESMTPS id B52B2394201B for ; Tue, 17 Mar 2020 12:16:05 +0000 (GMT) Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N0X4c-1jSO4e0YLs-00wTEt; Tue, 17 Mar 2020 13:16:04 +0100 Received: by calimero.vinschen.de (Postfix, from userid 500) id 868C0A806F8; Tue, 17 Mar 2020 13:16:03 +0100 (CET) Date: Tue, 17 Mar 2020 13:16:03 +0100 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file Message-ID: <20200317121603.GI512788@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com, =?utf-8?Q?=C3=85ke?= Rehnman References: <9e4c6428-59de-df07-9e33-44ba95d5497f@gmail.com> <20200312114041.GJ4042@calimero.vinschen.de> <365dd437-7553-eb4e-3253-aba3bab74895@gmail.com> <20200312144445.GP4042@calimero.vinschen.de> <20200312150833.GQ4042@calimero.vinschen.de> <9e56e005-660b-373e-d557-9c8bc97c45ba@gmail.com> <20200313101247.GD512788@calimero.vinschen.de> <2156fb6d-cba9-b70e-f8c0-7043ff52ffc3@gmail.com> <8e0973e2-9554-3e69-fa88-ed51fad5b191@gmail.com> <20200316093514.GG512788@calimero.vinschen.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GxcwvYAGnODwn7V8" Content-Disposition: inline In-Reply-To: <20200316093514.GG512788@calimero.vinschen.de> X-Provags-ID: V03:K1:ktOWNKIZnc6daVrnVDVG5vIxpwNuBTbp3UmkmmSB05gt7zfm1pC AOXz2e4KlpHGG2Qz3jy1lNs1KjUcgDs/WADgKTZjpqHKoIIMpWVkXF2Y0xfrgmaNiK++1bx 6PFpyzmPcNS0OWPKG/kllzEyhf5GS2XEU+jFmtMdsZG6qYB2TqPrQbG0d5Sf7+GrAv6dopS ExkdVQPTsqm/ey4E1mP3A== X-UI-Out-Filterresults: notjunk:1;V03:K0:MtXeqDOD9Mw=:9Up/LxwJbyZbtf+/Clfbfc T3zCfb/CiDR2uhxMf3fq6+XztSe6Q/msnRowWc5dllNH6tBG7HhUgQgYqbMBdkGeG/ocygsda M1VzWcjpWxL1LICcPAwGpzf1AEY83vQeXpbBVn+pKQZKXoedo0nt9HbKCBzdDTYBum0VVT5BA A6rOG7B6/4yXanFy+YZgGH86Mwur1zcGytpiuaODbEJLjpIsUCUEcAd6uPGFOkYct+yXJkwcT op0C4f5tErNoGwwUlq7HZaF7liZ85141nFdW09YbL5Y9PO2LTGhfajPJIHPRRXzFe62HODdsP zIP1yHRdIPv374Kk9om5Qvn1cSyrBru0vj+ZwdC+dfqkm61+h4OJQjEZT2w4AL5FqnnNNdBkZ yxkHuir6tgkgbDrHaFkxjr425HKXgpO8+gSy1ChiXAKfGvs+i4ZkoxuuXxVgNoSTpyk/4EW5/ uqRmh3I4sZPltK+dZxL/uXpjrq0J+YwaA8n2TiGrXABazqK8dFRyW0PyMlJYO1bSaqPLs2oZ7 qbnvFs23YDjb1UDSved3aU2QfjwmtlMi5Z0iat4CEo9Qx5vZOvfu9kXVkscfRbYIizijsstKR Y3rfhXwvZZNZTzYBAUHXq26qsNR3ay9G618q7515QdQwQDH7Dr0+nflDGUBgXdZ2GMwMRE9FW cLxz/AasCa+kZsZB/4BT7TW7+93QOG1m7SCrNIXSRDC/3HvrTimMGvBM14pUNy36SoLdrCCnN iiE6U/AEHR4Ch7d3m47UFPx3bA5vC6JSdFm6mv8jMtxAdgbEywIHJr6aIoIPn02E40dkjHXJV Ic57EAII2139lV26IKdRd6vjRyeLcY8oMyWCC72QxWdlXLe4sdTDIKGtjwDzd5kWibVjFLk X-Spam-Status: No, score=-99.0 required=5.0 tests=GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Mar 2020 12:16:07 -0000 --GxcwvYAGnODwn7V8 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi =C3=85ke, On Mar 16 10:35, Corinna Vinschen wrote: > On Mar 14 11:36, =C3=85ke Rehnman via Cygwin wrote: > > On 2020-03-14 11:23, =C3=85ke Rehnman wrote: > > > > > BTW there is a gremlin in the "else if (ev)" line.... > > > > A gremlin?=C2=A0 Would you mind to explain?=C2=A0 Btw., if you find= a bug > > > > in the code, we do take patches :) https://cygwin.com/contrib.html > > > If we have an error event in ev it will make a blocking read even if > > > VTIME=3D=3D0. >=20 > Ah, yeah, I was aware of that, I just ignored it for now since I'm not > sure what the best way to handle that is. >=20 > Two options come to mind, either ignoring these errors entirely, or > returning -1 with errno set to EIO, along the lines of the Linux test > for tty_io_error() at the start of tty_read. >=20 > However, I have a sinking feeling that the function needs a rewrite > anyway. >=20 > For instance, consider reading in blocking mode, which may result in > running the for loop more than once. If the first loop successfully > read 4 bytes, and the second loop runs into an error from > ClearCommError, the function will return -1 with errno set, completely > ignoring the fact that 4 bytes have been read already. >=20 > It should return 4 in this case, and only the next run of > fhandler_serial::raw_read *might* return -1. >=20 > This code really shows its age... I have revamped the fhandler_serial::raw_read function, but I need somebody for testing. Any chance you volunteer for that job? We may need a couple of days to iron out all problems, but I think the code is more sound now than the original function. I even added a couple of comments to the code (*gasp*) so there's stuff to discuss and to see why I did it that way. For a quicker turn around we can also use Freenode IRC, see https://cygwin.com/irc.html Interested? Thanks, Corinna --=20 Corinna Vinschen Cygwin Maintainer --GxcwvYAGnODwn7V8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl5wv4MACgkQ9TYGna5E T6Do+RAAjgmBsLFSUL2IFHz1AvRjSBuAGDjjV/0uXEM0YsH6m0qtE5/bOtsVRCxD UCfrFdzILpzgDsw55jlGG/0QYdn8Z4wAXyf3taeHy5HzZwcAIZcxdw0Enz64xakL k1rYfNecAFdPTQKXtsgXoEnKDcjw9aAq2HR8v6BstrkzSX1SwmZR/IXKc4SHE4IT Gfb3egeI47wecOpa1zJXf3tV/zEMqYZ76i+I39Se2JV+fRvqYSMZMGes/tk3koL9 8/hJbqncMGrWH15ZIaNLiaTqCykZc8WYm0caoswH0aa9/6+lbiNRFCg8GNDZPI5H GKPIO0IeY6HRpF0IC4B7dxQa3cAbmMJ+FjR9Hsff60GKNiU75TflT3E8kQNwFDxS L7uOq4F7ern1UkklppIzQ/eYEqyQKFUqsHY1itJwXvbewF2z93uxyY0kOo0dop2B EB5WSjdYQ+QnTtcjXKHYnYJY3g3yKc7QicpzgeTT5u1kAoK3GH8OhywTWY0CMkaW FKUJ8Hki0ysrFnBRfEg/kQlp0uCTB9XpDxwz1NXmdSnuiaNUXvfhLyUc5zwuSEyj r0MLL7m7THbK+85MC2FPanUfWhfv9LZQqxSjUMuaEHR34LhmU+1g0QpTD+xmHGXg aPIkiMC0QcjJUvg8jaB0MSeqeIZjEuXOsOU3wgo1w99t4nGVa74= =OxK7 -----END PGP SIGNATURE----- --GxcwvYAGnODwn7V8--