Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-17 Thread Åke Rehnman via Cygwin
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 fin

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-17 Thread Corinna Vinschen
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,

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-16 Thread Corinna Vinschen
On Mar 14 11:36, Åke Rehnman via Cygwin wrote: > On 2020-03-14 11:23, Åke Rehnman wrote: > > Your patch works (for my test case and screen). Question is if we have > > to consider the case where ulen==0 ... Thanks for testing! > > > > BTW there is a gremlin in the "else if (ev)" line > > > A

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-14 Thread Åke Rehnman via Cygwin
On 2020-03-14 11:23, Åke Rehnman wrote: On 2020-03-13 11:12, Corinna Vinschen wrote: On Mar 12 18:04, Åke Rehnman via Cygwin wrote: On 2020-03-12 16:08, Corinna Vinschen wrote: On Mar 12 15:44, Corinna Vinschen wrote: On Mar 12 15:20, Åke Rehnman via Cygwin wrote: I think the problem is if

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-14 Thread Åke Rehnman via Cygwin
On 2020-03-13 11:12, Corinna Vinschen wrote: On Mar 12 18:04, Åke Rehnman via Cygwin wrote: On 2020-03-12 16:08, Corinna Vinschen wrote: On Mar 12 15:44, Corinna Vinschen wrote: On Mar 12 15:20, Åke Rehnman via Cygwin wrote: I think the problem is if the number of bytes requested are more t

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-13 Thread Corinna Vinschen
On Mar 12 18:04, Åke Rehnman via Cygwin wrote: > > On 2020-03-12 16:08, Corinna Vinschen wrote: > > On Mar 12 15:44, Corinna Vinschen wrote: > > > On Mar 12 15:20, Åke Rehnman via Cygwin wrote: > > > > I think the problem is if the number of bytes requested are more than > > > > what > > > To cla

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-13 Thread Corinna Vinschen
On Mar 12 17:42, Åke Rehnman via Cygwin wrote: > > On 2020-03-12 15:13, Corinna Vinschen wrote: > > On Mar 12 14:32, Åke Rehnman via Cygwin wrote: > > > On 2020-03-12 12:40, Corinna Vinschen wrote: > > > > For a start, can you please strace the problem with a simple > > > > testcase,like this: > >

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-12 Thread Achim Gratz
Thomas Dickey writes: > It's either recently-broken, or just coincidence :-) I've looke and it's been introduced into newlib around four years ago, so I'd tend to favor the coincidence camp. :-) Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ SD adaptat

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-12 Thread Åke Rehnman via Cygwin
On 2020-03-12 16:08, Corinna Vinschen wrote: On Mar 12 15:44, Corinna Vinschen wrote: On Mar 12 15:20, Åke Rehnman via Cygwin wrote: I think the problem is if the number of bytes requested are more than what To clarify: number of bytes == VMIN? no number of bytes requested from ReadFile(). A

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-12 Thread Åke Rehnman via Cygwin
On 2020-03-12 15:13, Corinna Vinschen wrote: On Mar 12 14:32, Åke Rehnman via Cygwin wrote: On 2020-03-12 12:40, Corinna Vinschen wrote: For a start, can you please strace the problem with a simple testcase,like this: $ strace -o serio.trace and send the source of your testcase as well

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-12 Thread Corinna Vinschen
On Mar 12 15:44, Corinna Vinschen wrote: > On Mar 12 15:20, Åke Rehnman via Cygwin wrote: > > I think the problem is if the number of bytes requested are more than what > > To clarify: number of bytes == VMIN? > > > is in the buffer it is going to overlap the read function (because of VTIME) > >

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-12 Thread Corinna Vinschen
On Mar 12 15:20, Åke Rehnman via Cygwin wrote: > > On 2020-03-12 12:40, Corinna Vinschen wrote: > > > > I inspected the serial I/O read function and I only see a subtil > > difference in terms of VMIN/VTIME which doesn't seem to be the culprit > > at first glance. In O_NONBLOCK mode, the underly

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-12 Thread Åke Rehnman via Cygwin
On 2020-03-12 12:40, Corinna Vinschen wrote: I inspected the serial I/O read function and I only see a subtil difference in terms of VMIN/VTIME which doesn't seem to be the culprit at first glance. In O_NONBLOCK mode, the underlying Windows function ReadFile is called unconditionally. My cur

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-12 Thread Corinna Vinschen
On Mar 12 14:32, Åke Rehnman via Cygwin wrote: > > On 2020-03-12 12:40, Corinna Vinschen wrote: > > > > For a start, can you please strace the problem with a simple > > testcase,like this: > > > >$ strace -o serio.trace > > > > and send the source of your testcase as well as the serio.trac

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-12 Thread Åke Rehnman via Cygwin
On 2020-03-12 12:40, Corinna Vinschen wrote: For a start, can you please strace the problem with a simple testcase,like this: $ strace -o serio.trace and send the source of your testcase as well as the serio.trace file here? It may show at which point the error code is generated. Shou

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-12 Thread Corinna Vinschen
Hi Åke, On Mar 11 21:48, Åke Rehnman via Cygwin wrote: > Hello all, > > opening a file (serial port) with O_NONBLOCK and subsequently setting > termios VMIN and VTIME > 0 makes read() never ever return any data (returns > EAGAIN indefinitely). > > Don't ask my why one would want to do something

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-12 Thread Åke Rehnman via Cygwin
On 2020-03-12 09:05, Thomas Dickey wrote: If not "correct", it's certainly inconsistent with all other systems. I noticed it recently: https://invisible-island.net/ncurses/tack/CHANGES.html#t20200220 https://github.com/cygwinports/tack/issues/1 It's either recently-broken, or just coincidence

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-12 Thread Thomas Dickey
- Original Message - | From: "Åke Rehnman" | To: "cygwin" | Sent: Wednesday, March 11, 2020 4:48:05 PM | Subject: Setting termios VMIN > 0 and VTIME > 0 on non blocking file | Hello all, | | opening a file (serial port) with O_NONBLOCK and subsequently settin

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-11 Thread Åke Rehnman via Cygwin
On 2020-03-12 02:08, Norton Allen wrote: Correct me if I am wrong, but O_NDELAY is not the same as O_NONBLOCK At least for cygwin those two are exactly the same... I think... #define _FNONBLOCK  0x4000  /* non blocking I/O (POSIX style) */ #define _FNDELAY    _FNONBLOCK  /* non blo

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-11 Thread Norton Allen
On 3/11/2020 9:04 PM, Åke Rehnman via Cygwin wrote: On 2020-03-11 22:55, Brian Inglis wrote: VMIN > 0 || VTIME > 0 implies blocking; O_NONBLOCK implies SIGIO delivery; see: https://www.tldp.org/HOWTO/pdf/Serial-Programming-HOWTO.pdf https://www.cmrr.umn.edu/~strupp/serial.html htt

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-11 Thread Åke Rehnman via Cygwin
On 2020-03-11 22:55, Brian Inglis wrote: VMIN > 0 || VTIME > 0 implies blocking; O_NONBLOCK implies SIGIO delivery; see: https://www.tldp.org/HOWTO/pdf/Serial-Programming-HOWTO.pdf https://www.cmrr.umn.edu/~strupp/serial.html https://en.wikibooks.org/wiki/Serial_Program

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-11 Thread Norton Allen
On 3/11/2020 5:55 PM, Brian Inglis wrote: VMIN > 0 || VTIME > 0 implies blocking; O_NONBLOCK implies SIGIO delivery; see: While I agree with everything else you said there, I don't believe either of these are true, unless by 'implies' you mean that's how you usually do it. I have done a lot o

Re: Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-11 Thread Brian Inglis
On 2020-03-11 14:48, Åke Rehnman via Cygwin wrote: > opening a file (serial port) with O_NONBLOCK and subsequently setting termios > VMIN and VTIME > 0 makes read() never ever return any data (returns EAGAIN > indefinitely). > Don't ask my why one would want to do something like this but apparently

Setting termios VMIN > 0 and VTIME > 0 on non blocking file

2020-03-11 Thread Åke Rehnman via Cygwin
Hello all, opening a file (serial port) with O_NONBLOCK and subsequently setting termios VMIN and VTIME > 0 makes read() never ever return any data (returns EAGAIN indefinitely). Don't ask my why one would want to do something like this but apparently the "screen" program think this is a goo