xon/xoff, signals, hangup
Guy Harris
guy at auspex.UUCP
Thu Nov 17 08:35:54 AEST 1988
>When you close the line (e.g., at exit from SIGHUP), the kernel
>(correctly) waits for the output to drain. It *should* give up
>after a `reasonable' timeout, on the assumption that output never
>will drain.
Define "reasonable". What if the line is going to a printer, and it
runs out of paper? It could be a while before those last few characters
get transmitted....
>A number of kernels get this wrong, various BSD implementations
>included. Note, though, that `giving up' will put some terminals
>into a confused state.
The S5R3 streams code "gets it right" in the sense that it will time out
eventually; unfortunately, in addition to flushing data queued for a
streams module when it gets tired of waiting for that module to drain
its queue, it also gets rid of the module - which means that unless the
driver handles XON/XOFF, you lose flow control at some point, which
will, indeed, put some terminals in a confused state.
The line discipline-based S5 tty drivers don't time out, but they will
un-stop XOFFed output when the line is closed; this will also put some
terminals in a confused state....
Unfortunately, I'm not sure there's a single way of getting it right.
Printers, plotters, etc. should be prepared to wait forever; terminals
on which people are logged in, or dial-out lines, should perhaps give up
eventually (although perhaps carrier going away could be the signal for
this).
More information about the Comp.unix.wizards
mailing list