ioctl(~CRMOD) mungs last character in queue
Jeff Stearns
jeff at fluke.UUCP
Wed Apr 11 08:15:28 AEST 1984
Anybody out there in Netville seen this one?
The 4.2BSD line printer daemon is having a bit of True Trauma trying to talk
to our NEC spinwriters (ugh). The problem manifests itself in a wondrous way...
Lpd forks off children as needed to print a job. The child daemon prints the
banner page, then forks again to set up a filter chain for printing the body of
the file. In our situation, the filter process must make some minor
adjustments to the tty mode bits before printing the file. In particular, the
filter process must disable CRMOD. [1]
Now the interesting part of this tale follows...
- The spinwriter is slow. It has a small input buffer.
- Therefore, the filter gets set up and tries to disable CRMOD while banner
characters are still dribbling into the spinwriter.
- Now this ought not to be a problem, because the ioctl(~CRMOD) should delay
until this pending output has drained.
Well, the ioctl causes the last character to be *obliterated*! The formfeed
character gets transmitted in such a way that it has a framing error. [2]
(Remember that the last character in the buffer before the ioctl is a formfeed.)
Naturally, the spinwriters panic at the smell of a framing error, so they start
beeping. Now the users get upset when the spinwriters are beeping, so they
start complaining...
I have ugly techniques for skirting the problem - a sleep(20) after printing the
banner page will cure it. But really... it's so, uhm, crude...
I am seeking philosophical enlightenment. Why does the formfeed character get
munged? Excuse me, but is this a feature?
------------
[1] For the interested reader, these spinwriters use escape sequences
which contain the LF character, and CRMOD will mung such sequences.
[2] You may not believe this. Then again, you may not have a Dyna-Test 1100
Serial Line Analyzer sitting on top of your terminal, either. Or a
Tektronix 833 line analyzer. Or a Sony/Tek 308 Data Analyzer. So there.
[3] We are running UNIX 4.2BSD on both vax 11/780's and on SUN's. The problem
manifests itself on *both* machines. The vaxen have dz-11's. The SUN's use
on-board Zilog uarts.
--
Jeff Stearns (206) 356-5064
John Fluke Mfg. Co.
P.O. Box C9090 Everett WA 98043
{uw-beaver,decvax!microsof,ucbvax!lbl-csam,allegra,ssc-vax}!fluke!jeff
More information about the Comp.unix.wizards
mailing list