X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A83BE394354B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1584447368; bh=2Ogchnk3RojlpTu83xoYTyWhagHky+KyAoktKmU9DXM=; h=Date:From:To:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To:From; b=PnhwJfzChqzjW+206FCmpR5DZsBCLFT+20W2NiolG0mEtuDv3MwRVdrFjqumTitF4 OpMG5Hpp6u+usb9By825/JnrHjc2S06wbW4j6R7xFOaL1mZbruaNcHlyHbwOmjg4Br an0EafEt8LKt7TdJAqwY+KkNLc+ctqTxaQBA9lig= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com Date: Tue, 17 Mar 2020 13:16:03 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file Message-ID: <20200317121603.GI512788@calimero.vinschen.de> Mail-Followup-To: cygwin AT cygwin DOT com, =?utf-8?Q?=C3=85ke?= Rehnman References: <9e4c6428-59de-df07-9e33-44ba95d5497f AT gmail DOT com> <20200312114041 DOT GJ4042 AT calimero DOT vinschen DOT de> <365dd437-7553-eb4e-3253-aba3bab74895 AT gmail DOT com> <20200312144445 DOT GP4042 AT calimero DOT vinschen DOT de> <20200312150833 DOT GQ4042 AT calimero DOT vinschen DOT de> <9e56e005-660b-373e-d557-9c8bc97c45ba AT gmail DOT com> <20200313101247 DOT GD512788 AT calimero DOT vinschen DOT de> <2156fb6d-cba9-b70e-f8c0-7043ff52ffc3 AT gmail DOT com> <8e0973e2-9554-3e69-fa88-ed51fad5b191 AT gmail DOT com> <20200316093514 DOT GG512788 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 In-Reply-To: <20200316093514.GG512788@calimero.vinschen.de> X-Provags-ID: V03:K1:ktOWNKIZnc6daVrnVD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EAII2139lV26IKdRd6vjRyeLcY8oMyWCC72QxWdlXLe4sdTDIKGtjwDzd5kWibVjFLk 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 AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: cygwin AT cygwin DOT com Content-Type: multipart/mixed; boundary="===============5959460809662064784==" Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" --===============5959460809662064784== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GxcwvYAGnODwn7V8" Content-Disposition: inline --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-- --===============5959460809662064784== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple --===============5959460809662064784==--