problems with TCSETAF and rlogin

Doug McCallum dougm at ico.isc.com
Sun Nov 4 11:46:55 AEST 1990


In article <andy.657571549 at xwkg> andy at xwkg.Icom.Com (Andrew H. Marrinson) writes:
...
>Further investigation revealed that this was due to a bug which was
>exercised whenever nn (or any other program) used TCSETAF under
>rlogin.  The manual page for TCSETAF states that it ``waits for output
>to drain, then flushes the input, then sets the parameters''.
>However, when using rlogin it seems that the output gets flushed as
>well.
...
>I urge everyone maintaining a system with the combination of BSD
>pseudo-ttys and System V/POSIX termio(s) to check their implementation
>for this bug.  

I did a little investigation and the problem is not in the pty driver
but in the generic tty code.  In the tty.c code for TCSETAF, a test
is done to see if it is a TCSETAF and then it calls ttyflush with both
the read and write flush bits set.  Our pty driver doesn't implement the
TCSETAF directly, it depends on the System V one.  A ttywait is done first,
but that only means that the data has been read by the server dealing with
the pty master side.  The next read will see the flush for both read and
write sides.  The additional steps taken in dealing with the network allow
for the flush to catch up with the data and then it is lost.

I would expect this problem to occur on all System V's regardless of the
origin of the pty driver unless the tty code is fixed.  Because of the
ttywait before the flush, this doesn't show up on a real tty.

Doug McCallum
Interactive Systems Corp
dougm at ico.isc.com



More information about the Comp.unix.internals mailing list