Re: [PATCH] termios.3: Document line length in canonical mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/15/2016 07:28 AM, Michael Kerrisk (man-pages) wrote:
> Hello Tobias,
> 
> On 02/15/2016 02:26 PM, Dr. Tobias Quathamer wrote:
>> See https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/tty/n_tty.c#n1673
>> See https://bugs.debian.org/797479
>> ---
>>  man3/termios.3 | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/man3/termios.3 b/man3/termios.3
>> index 7d738d4..3f57607 100644
>> --- a/man3/termios.3
>> +++ b/man3/termios.3
>> @@ -728,11 +728,20 @@ requested fewer bytes than are available in the current line of input,
>>  then only as many bytes as requested are read,
>>  and the remaining characters will be available for a future
>>  .BR read (2).
>> +.IP * 2
>> +The maximum line length is 4096 chars (including the line termination
>> +char); lines longer than 4096 chars are truncated. After 4095 chars,
>> +input data is still processed but not stored. Overflow processing
>> +ensures the tty can always receive more input until at least one
>> +line can be read.
>>  .PP
>>  In noncanonical mode input is available immediately (without
>>  the user having to type a line-delimiter character),
>>  no input processing is performed,
>>  and line editing is disabled.
>> +The read buffer will only accept 4095 chars; this provides the
>> +necessary space for a newline char if the input mode is switched
>> +to canonical.
>>  The settings of MIN
>>  .RI ( c_cc[VMIN] )
>>  and TIME
> 
> Thanks for crafting this. I've applied, and tweaked a little to clarify
> some details:
> 
>        * The maximum line length is 4096 chars (including the  terminating
>          newline  character);  lines longer than 4096 chars are truncated.
>          After 4095 characters, input data up (but not including) any ter‐
>          minating  newline  is  discarded.  This ensures that the terminal
>          can always receive more input until at  least  one  line  can  be
>          read.

Hmm. Neither description is accurate of the observable behavior from userspace.
For example, it's entirely possible to retrieve > 4096 bytes in non-canonical
mode, at least since 3.12

And input processing continues on the input, even past 4096 bytes.
Line editing, ISIG, ECHOxx processing still occurs.

It is true that it is not possible to retrieve > 4096 char line in canonical
mode, and I don't see that ever changing via read() because userspace may
assume it has received a terminated line in 4096-byte read buffer.

However, the noncanonical mode input buffer size may change in the near
future.

Regards,
Peter Hurley
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux