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 [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/