broken flow control in 2.9.1 tty code
eric j. haug
ejh at slu70.UUCP
Thu Feb 7 11:21:10 AEST 1985
Subject: Flow control in cooked,tandem mode broken
Index: <src/sys/dev>/<tty.c, ttyold.c, ttynew.c> 2.9bsd
Description:
The cooked with tandem mode turned on tty code is broken.
Repeat-By:
Login to a 2.9 system through a computer of some sort. Start up:
(stty tandem;cat > tmpfile;stty -tandem) and feed the tty line
at a fast rate. Eventually a ^S will be sent, but a ^Q will never
be sent.
Fix:
It is not obvious what the author of the changed code had in mind.
And there is a conflict between the ttyold and ttynew code.
The t_delct is never set in the ttynew code.
NOTE the commented code in the WORKING section, it does not work
It is left for comment.
add to tty.c
#ifdef WORKING_CODE
/* using TTHIWAT(tp) as limit breaks something else
if ((tp->t_flags&(CBREAK|RAW) ? tp->t_rawq.c_cc : tp->t_canq.c_cc) > TTYHOG/2) {
the above seems like a good idea but fails somehow */
if ( x >= TTYHOG/2 ) {
#else
/*
* Block further input iff:
* Current input > threshold AND input is available to user program
*/
if (x >= TTYHOG/2 && (tp->t_delct>0 || (tp->t_flags&(RAW|CBREAK)))) {
#endif
add to ttyold.c
#ifdef WORKING_CODE
/* see notes in tty.c ttyblock()
if (tp->t_state&TBLOCK)
if ((tp->t_flags&(CBREAK|RAW) ? tp->t_rawq.c_cc : tp->t_canq.c_cc)<TTYHOG/5) {
the above seemed like a good idea but fails*/
if ( tp->t_state & TBLOCK &&(tp->t_rawq.c_cc < TTYHOG/5
|| ((tp->t_flags&(CBREAK|RAW)==0) && tp->t_canq.c_cc==0))) {
#else
/* Unblock output iff:
* is blocked
* AND (input < threshold OR (cooked mode AND delim_count == 0))
* This makes tandem mode usable for line-mode input.
*/
if (tp->t_state&TBLOCK && ((tp->t_rawq.c_cc < TTYHOG/5) ||
(tp->t_delct==0 && ((tp->t_flags&(CBREAK|RAW)) == 0)))) {
#endif
add to ttynew.c
#ifdef WORKING_CODE
/* see notes in ttyblock() tty.c
if (tp->t_state&TBLOCK)
if ((tp->t_flags&(CBREAK|RAW) ? tp->t_rawq.c_cc : tp->t_canq.c_cc)<TTYHOG/5) {
the above seemed like a good idea but fails somehow */
if ( tp->t_state & TBLOCK &&(tp->t_rawq.c_cc < TTYHOG/5
|| ((tp->t_flags&(CBREAK|RAW)==0) && tp->t_canq.c_cc==0))) {
#else
/*
* Resume output iff:
* is blocked
* AND (input < threshold OR (cooked mode AND delim_count == 0))
* This makes tandem mode usable for line-mode input.
*/
if (tp->t_state&TBLOCK && ((tp->t_rawq.c_cc < TTYHOG/5) ||
(tp->t_delct==0 && ((tp->t_flags&(CBREAK|RAW)) == 0)))) {
#endif
More information about the Comp.bugs.2bsd
mailing list