* Re: [BUG] drivers/tty: read() on a noncanonical blocking tty randomly fails when VMIN > received >= buf
[not found] ` <572A80C0.4080704@hurleysoftware.com>
@ 2016-05-04 23:27 ` Julio Guerra
2016-05-05 0:50 ` Peter Hurley
0 siblings, 1 reply; 2+ messages in thread
From: Julio Guerra @ 2016-05-04 23:27 UTC (permalink / raw)
To: Peter Hurley; +Cc: linux-serial, linux-kernel
>> When a tty (here a slave pty) is set in noncanonical input and blocking read modes, a read() randomly blocks when:
>> "VMIN > kernel received >= user buffer size > 0".
>>
>> The standard says that read() should block until VMIN bytes are received [1][2]. Whether this is an implementation defined case not really specified by POSIX or not, it should not behave randomly (otherwise it really should be documented in termios manpage).
>
> This is not a bug.
>
> From the termios(3) man page:
>
> * MIN > 0; TIME == 0: read(2) blocks until the lesser of MIN bytes or the number of bytes requested are avail‐
> able, and returns the lesser of these two values.
>
This does not appear in my man...
Anyway, how do you explain the random behavior then?
--
Julio Guerra
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [BUG] drivers/tty: read() on a noncanonical blocking tty randomly fails when VMIN > received >= buf
2016-05-04 23:27 ` [BUG] drivers/tty: read() on a noncanonical blocking tty randomly fails when VMIN > received >= buf Julio Guerra
@ 2016-05-05 0:50 ` Peter Hurley
0 siblings, 0 replies; 2+ messages in thread
From: Peter Hurley @ 2016-05-05 0:50 UTC (permalink / raw)
To: Julio Guerra; +Cc: linux-serial, linux-kernel
On 05/04/2016 04:27 PM, Julio Guerra wrote:
>>> When a tty (here a slave pty) is set in noncanonical input and blocking read modes, a read() randomly blocks when:
>>> "VMIN > kernel received >= user buffer size > 0".
>>>
>>> The standard says that read() should block until VMIN bytes are received [1][2]. Whether this is an implementation defined case not really specified by POSIX or not, it should not behave randomly (otherwise it really should be documented in termios manpage).
>>
>> This is not a bug.
>>
>> From the termios(3) man page:
>>
>> * MIN > 0; TIME == 0: read(2) blocks until the lesser of MIN bytes or the number of bytes requested are avail‐
>> able, and returns the lesser of these two values.
>>
>
> This does not appear in my man...
>
> Anyway, how do you explain the random behavior then?
A long standing bug in this read mode allows the asynchronous input
processing thread to race with the read() thread and become confused
about how much data remains.
I fixed this in 4.6; when I run your test on 4.6, it consistently
returns the full user buffer.
Regards,
Peter Hurley
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-05 0:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <16504442-9e91-aaab-1f2b-9b4aa9c219f5@farjump.io>
[not found] ` <572A80C0.4080704@hurleysoftware.com>
2016-05-04 23:27 ` [BUG] drivers/tty: read() on a noncanonical blocking tty randomly fails when VMIN > received >= buf Julio Guerra
2016-05-05 0:50 ` Peter Hurley
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 NNTP newsgroup(s).