Article View: net.bugs.usg
Article #25S3 TTY Driver
From: Jack Waugh
Date: Sat, 05 Nov 1983 23:45
Date: Sat, 05 Nov 1983 23:45
64 lines
2695 bytes
2695 bytes
According to rlgvax!jds:
The System III tty driver uses a coding convention to associate
flag bits with flag words. If shown the flag bit "OPOST", you
immediately know that it pertains to the "t_oflag" flag word of
the tty structure. This is just great except that the convention
is not used 100% of the time.
The following is the example of what can happen if you come up
with a nice little coding convention but don't stick to it:
tttimeo(tp)
register struct tty *tp;
{
tp->t_state &= ~TACT;
if (tp->t_iflag&ICANON || tp->t_cc[VTIME] == 0)
return;
if (tp->t_rawq.c_cc == 0)
return;
if (tp->t_state&RTO) {
tp->t_delct = 1;
if (tp->t_state&IASLP) {
tp->t_state &= ~IASLP;
wakeup((caddr_t)&tp->t_rawq);
}
} else {
tp->t_state |= RTO|TACT;
timeout(tttimeo, tp, tp->t_cc[VTIME]*(HZ/10));
}
}
When you see the "ICANON" flag word, you immediately assume (as
did person who wrote the above function) that it belongs to the
"t_iflag" word.
Thus, if you want to check for canonicalization of the input
stream, you simply do the following:
if (tp->t_iflag&ICANON)
/*
* We're processing input characters.
*/
Wrong! The "ICANON" flag is one of those little exceptions -- it
is a flag bit for "t_lflag". Thus, the above is equivalent to:
if (tp->t_iflag&BRKINT)
/*
* We're processing input characters.
*/
Which is not what you want to do at all!
The upshot of this is that when you do a:
stty -icanon brkint min '^f' time '^b'
It isn't going to work like the book tells you it will.
This is a bug in Bell's S3, meaning it is probably a bug in
EVERYONE's port of S3.
It has been fixed in System 5.
Technical Details
Message-ID:
<1361@rlgvax.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!linus!decvax!harpo!seismo!rlgvax!jackShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1a 7/7/83; site rlgvax.UUCP Path: arc1-ca.pugleaf.net!utzoo!linus!decvax!harpo!seismo!rlgvax!jack From: jack@rlgvax.UUCP (Jack Waugh) Newsgroups: net.bugs.usg Subject: S3 TTY Driver Message-ID: <1361@rlgvax.UUCP> Date: Sat, 5-Nov-83 18:45:47 EST Article-I.D.: rlgvax.1361 Posted: Sat Nov 5 18:45:47 1983 Date-Received: Mon, 7-Nov-83 04:56:15 EST Organization: Computer Consoles Lines: 64