Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262029AbVBPOnj (ORCPT ); Wed, 16 Feb 2005 09:43:39 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262031AbVBPOmg (ORCPT ); Wed, 16 Feb 2005 09:42:36 -0500 Received: from thunk.org ([69.25.196.29]:5522 "EHLO thunker.thunk.org") by vger.kernel.org with ESMTP id S262029AbVBPOmN (ORCPT ); Wed, 16 Feb 2005 09:42:13 -0500 Date: Wed, 16 Feb 2005 09:42:03 -0500 From: "Theodore Ts'o" To: Linus Torvalds Cc: Roman Zippel , Andreas Schwab , linux-kernel@vger.kernel.org Subject: Re: Pty is losing bytes Message-ID: <20050216144203.GB7767@thunk.org> Mail-Followup-To: Theodore Ts'o , Linus Torvalds , Roman Zippel , Andreas Schwab , linux-kernel@vger.kernel.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.6+20040907i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1690 Lines: 31 On Tue, Feb 15, 2005 at 08:05:05PM -0800, Linus Torvalds wrote: > Why have that "tty->icanon && !tty->canon_data" test in the first place, I > wonder? Isn't the "left" calculation always correct? That's really how > many bytes free we have in the tty, that "canon_data" thing is just about > how much of it is available for _reading_ as canon, no? (Ie "how many > characters that have seen a finishing end-of-line"). So I don't see why > that canon_data test is relevant to the question of filling the buffer.. The comment above the test explains why that test is there in n_tty_receive_room. If that test isn't there, and we are doing input canonicalization, when the buffer gets full, the low-level driver will either flow control the source (so the ERASE or EOLN characters won't get sent through) or the low-level driver will drop the characters (and the line discpline will never see the ERASE or EOLN characters). So the idea behind this code was to lie to the low-level driver, so that the line discpline would always get the characters, and then the line discpline could process ERASE, WERASE, KILL, or EOL, and drop the rest on the floor. At least, that was the basic idea. Yes, it was a kludge; no I'm not particularly proud of it. The whole structure badly needs to be ripped apart and rewritten, but unfortunately few employers seem to be willing to dedicate their hackers' time to Do This Right. Sigh.... - Ted - 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/