scc@jenny.UUCP (Stephen Crawley) (09/12/85)
Index: usr.bin/tip/tip.c 4.2BSD
Description:
Tip does not do flow control properly on the remote terminal when
the "tandem" variable is set. Someone forgot that setting a tty
into RAW mode on 4.2 overrides TANDEM.
Repeat-By:
Start up tip to somewhere, set "tandem", and look at the state
of the "remote" terminal (as root) with the command
stty everything >/dev/ttynn
^^^^^^^^^^
substitute appropriate device file
Notice that both raw and tandem are indicated
If you have a slow device which uses Xon-Xoff protocol to exert
backpressure (a CAMTEC X25 pad will do), start up tip through
this device, try to write a file and watch it drop characters.
Fix:
The fix is to use CBREAK mode rather than RAW mode on the remote
tty. Below are the diffs for tip.c. I apologise if they don't
quite line up with your sources.
--------------------------------------------------------------------------
RCS file: RCS/tip.c,v
retrieving revision 1.2
diff -c -r1.2 tip.c
*** /tmp/,RCSt1019726 Wed Sep 11 21:43:08 1985
--- tip.c Mon Sep 9 22:15:40 1985
***************
*** 414,419
int speed;
{
unsigned bits = LDECCTQ;
arg.sg_ispeed = arg.sg_ospeed = speed;
arg.sg_flags = RAW;
--- 414,421 -----
int speed;
{
unsigned bits = LDECCTQ;
+ struct ltchars rmltchars;
+ struct tchars rmtchars;
rmtchars.t_intrc = rmtchars.t_quitc = -1;
rmtchars.t_eofc = rmtchars.t_brkc = -1;
***************
*** 415,420
{
unsigned bits = LDECCTQ;
arg.sg_ispeed = arg.sg_ospeed = speed;
arg.sg_flags = RAW;
if (boolean(value(TAND)))
--- 417,429 -----
struct ltchars rmltchars;
struct tchars rmtchars;
+ rmtchars.t_intrc = rmtchars.t_quitc = -1;
+ rmtchars.t_eofc = rmtchars.t_brkc = -1;
+ rmtchars.t_startc = '\021';
+ rmtchars.t_stopc = '\023';
+ rmltchars.t_suspc = rmltchars.t_dsuspc = rmltchars.t_rprntc = -1;
+ rmltchars.t_flushc = rmltchars.t_werasc = rmltchars.t_lnextc = -1;
+
arg.sg_ispeed = arg.sg_ospeed = speed;
arg.sg_flags = ANYP | CBREAK;
if (boolean(value(TAND)))
***************
*** 416,422
unsigned bits = LDECCTQ;
arg.sg_ispeed = arg.sg_ospeed = speed;
! arg.sg_flags = RAW;
if (boolean(value(TAND)))
arg.sg_flags |= TANDEM;
ioctl(FD, TIOCSETP, (char *)&arg);
--- 425,431 -----
rmltchars.t_flushc = rmltchars.t_werasc = rmltchars.t_lnextc = -1;
arg.sg_ispeed = arg.sg_ospeed = speed;
! arg.sg_flags = ANYP | CBREAK;
if (boolean(value(TAND)))
arg.sg_flags |= TANDEM;
ioctl(FD, TIOCSETP, (char *)&arg);
***************
*** 421,426
arg.sg_flags |= TANDEM;
ioctl(FD, TIOCSETP, (char *)&arg);
ioctl(FD, TIOCLBIS, (char *)&bits);
}
/*
--- 430,437 -----
arg.sg_flags |= TANDEM;
ioctl(FD, TIOCSETP, (char *)&arg);
ioctl(FD, TIOCLBIS, (char *)&bits);
+ ioctl(FD, TIOCSETC, (char *)&rmtchars);
+ ioctl(FD, TIOCSLTC, (char *)&rmltchars);
}
/*
--------------------------------------------------------------------------
Stephen C. Crawley
ARPA: scc%cl.cam.ac.uk@ucl-cs.ARPA SMail: Cambridge Univ. Computer Lab.,
JANET: scc@uk.ac.cam.cl Corn Exchange Street,
UUCP: {ukc,kcl-cs}!cl-jenny!scc Cambridge CB2 3QG,
PHONE: +44 223 352 435 England.scc@jenny.UUCP (Stephen Crawley) (09/19/85)
In <8509160749.AA01327@utah-gr.ARPA> Spencer Thomas writes :- >====== > You misunderstand TANDEM mode. TANDEM has NOTHING to do with what the > host does on receipt of ^S/^Q. If TANDEM is set, the host will GENERATE > ^S when its internal tty queue gets too full, and will GENERATE ^Q when > the queue empties somewhat. This is completely independent of ^S/^Q > flow control received from the host. You are correct that the host will > not respond to ^S/^Q in RAW mode, but TANDEM works perfectly well in > RAW. >====== You are of course right, my explanation was incorrect. However, the bug fix is still (I believe) correct, and necessary if you are tipping over a line which uses X-ON/X-OFF flow control. -- Steve