public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Åke Rehnman" <ake.rehnman@gmail.com>
To: cygwin@cygwin.com
Subject: Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file
Date: Tue, 17 Mar 2020 16:54:35 +0100	[thread overview]
Message-ID: <ac1d31f7-a945-5a0f-2fa0-1e9646b14bcc@gmail.com> (raw)
In-Reply-To: <20200317121603.GI512788@calimero.vinschen.de>


On 2020-03-17 13:16, Corinna Vinschen wrote:
> Hi Åke,
>
> On Mar 16 10:35, Corinna Vinschen wrote:
>> On Mar 14 11:36, Åke Rehnman via Cygwin wrote:
>>> On 2020-03-14 11:23, Åke Rehnman wrote:
>>>>>> BTW there is a gremlin in the "else if (ev)" line....
>>>>> A gremlin?  Would you mind to explain?  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==0.
>> 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.
>>
>> 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.
>>
>> However, I have a sinking feeling that the function needs a rewrite
>> anyway.
>>
>> 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.
>>
>> It should return 4 in this case, and only the next run of
>> fhandler_serial::raw_read *might* return -1.
>>
>> 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?

Sure, bring it on!

/Ake



      reply	other threads:[~2020-03-17 15:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1473.1583981776.15804.cygwin@cygwin.com>
2020-03-11 20:48 ` Åke Rehnman
2020-03-11 21:55   ` Brian Inglis
2020-03-12  1:01     ` Norton Allen
2020-03-12  1:04     ` Åke Rehnman
2020-03-12  1:08       ` Norton Allen
2020-03-12  1:39         ` Åke Rehnman
2020-03-12  8:05   ` Thomas Dickey
2020-03-12 11:01     ` Åke Rehnman
2020-03-12 19:48     ` Achim Gratz
2020-03-12 11:40   ` Corinna Vinschen
2020-03-12 13:32     ` Åke Rehnman
2020-03-12 14:13       ` Corinna Vinschen
2020-03-12 16:42         ` Åke Rehnman
2020-03-13 10:02           ` Corinna Vinschen
2020-03-12 14:20     ` Åke Rehnman
2020-03-12 14:44       ` Corinna Vinschen
2020-03-12 15:08         ` Corinna Vinschen
2020-03-12 17:04           ` Åke Rehnman
2020-03-13 10:12             ` Corinna Vinschen
2020-03-14 10:23               ` Åke Rehnman
2020-03-14 10:36                 ` Åke Rehnman
2020-03-16  9:35                   ` Corinna Vinschen
2020-03-17 12:16                     ` Corinna Vinschen
2020-03-17 15:54                       ` Åke Rehnman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ac1d31f7-a945-5a0f-2fa0-1e9646b14bcc@gmail.com \
    --to=ake.rehnman@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).