lkml.org 
[lkml]   [2005]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: Pty is losing bytes
Hi,

On Tue, 15 Feb 2005, Linus Torvalds wrote:

> > I've also seen more than one byte missing. For example when sending a big
> > chunk of bytes down the pty via an Emacs *shell* buffer up to 16 bytes are
> > missing somewhere in the middle.
>
> If it's NTTY (and I'm pretty certain it is - the generic tty code looks
> fine, the pty code itself is too simple for words), then I'd actually have
> expected more variability than a simple off-by-one.

The patch below seems to do the trick too.
It seems the initial receive_room() call in pty_write() returns
N_TTY_BUF_SIZE and receive_buf() will happily drop the last byte.

bye, Roman


n_tty.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/char/n_tty.c
===================================================================
--- linux-2.6.orig/drivers/char/n_tty.c 2005-02-16 03:53:53.000000000 +0100
+++ linux-2.6/drivers/char/n_tty.c 2005-02-16 03:56:39.000000000 +0100
@@ -863,7 +863,7 @@ static int n_tty_receive_room(struct tty
* characters will be beeped.
*/
if (tty->icanon && !tty->canon_data)
- return N_TTY_BUF_SIZE;
+ return N_TTY_BUF_SIZE - 1;

if (left > 0)
return left;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:10    [W:0.060 / U:1.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site