Article View: net.bugs.2bsd
Article #201broken flow control in 2.9.1 tty code
From: eric j. haug
Date: Thu, 07 Feb 1985 01:21
Date: Thu, 07 Feb 1985 01:21
70 lines
3037 bytes
3037 bytes
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
Technical Details
Message-ID:
<112@slu70.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!mgnetp!we53!busch!wucs!slu70!ejhShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site slu70.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbosgd!ihnp4!mgnetp!we53!busch!wucs!slu70!ejh From: ejh@slu70.UUCP (eric j. haug) Newsgroups: net.bugs.2bsd Subject: broken flow control in 2.9.1 tty code Message-ID: <112@slu70.UUCP> Date: Wed, 6-Feb-85 20:21:10 EST Article-I.D.: slu70.112 Posted: Wed Feb 6 20:21:10 1985 Date-Received: Sat, 9-Feb-85 05:51:46 EST Distribution: net Organization: Saint Louis Univ.,St. L.,MO. Lines: 70