Re: Pty is losing bytes

Linus Torvalds
2005-02-15T19:08:13Z

On Tue, 15 Feb 2005, Andreas Schwab wrote:
>
> Recent kernel are losing bytes on a pty.

Great catch.

I think it may be a n_tty line discipline bug, brought on by the fact that
the PTY buffering is now 4kB rather than 2kB. 4kB is also the
N_TTY_BUF_SIZE, and if n_tty has some off-by-one error, that would explain
it.

Does the problem go away if you change the default value of "chunk" (in
drivers/char/tty_io.c:do_tty_write) from 4096 to 2048? If so, that means
that the pty code has _claimed_ to have written 4kB, and only ever wrote
4kB-1 bytes. That in turn implies that "ldisc.receive_room()" disagrees
with "ldisc.receive_buf()".

Linus