Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 Fluke 1/4/84; site fluke.UUCP Path: utzoo!watmath!clyde!floyd!harpo!ihnp4!zehntel!hplabs!tektronix!uw-beaver!ssc-vax!fluke!jeff From: jeff@fluke.UUCP (Jeff Stearns) Newsgroups: net.unix-wizards Subject: ioctl(~CRMOD) mungs last character in queue Message-ID: <1523@vax4.fluke.UUCP> Date: Tue, 10-Apr-84 17:15:28 EST Article-I.D.: vax4.1523 Posted: Tue Apr 10 17:15:28 1984 Date-Received: Fri, 13-Apr-84 07:54:08 EST Organization: John Fluke Mfg. Co., Everett, WA Lines: 46 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