rjk@mrstve.UUCP (04/23/87)
I came across what looks like a bug in the console driver on the 3b2/400 running System 5.3. I've been trying to install Scheme (thanks Bob), and had severe problems with garbage on the screen (an AT&T 610 terminal). I thought it was either a problem with the way Scheme controled the terminal or a bad terminfo description, until I happened to try it on a 610 on a different port and it worked perfectly. After some tom-foolery we needn't go into now, I came up with the following: For messages to the console, Scheme does (essentialy) this: printf("message, no newline"); fflush(stdout); which seems to work perfectly on anything except the console. It works perfectly (so far) on the console if I add ioctl(fileno(stdout), TCSBRK, 1); /* wait for output to drain */ after the fflush(). Has anyone seen this before? As in, is it a 3b2 problem or System 5 problem? -- Rich Kuhns {ihnp4, decvax, etc...}!pur-ee!pur-phy!mrstve!rjk
gwyn@brl-smoke.ARPA (Doug Gwyn ) (04/26/87)
In article <681@mrstve.UUCP> rjk@mrstve.UUCP (Richard Kuhns) writes: >printf("message, no newline"); >fflush(stdout); >which seems to work perfectly on anything except the console. >It works perfectly (so far) on the console if I add >ioctl(fileno(stdout), TCSBRK, 1); /* wait for output to drain */ >after the fflush(). Has anyone seen this before? As in, is it a 3b2 >problem or System 5 problem? The only thing printf and fflush do is a series of write(2) system calls to put characters into the kernel character queue for the device. Without the fflush the characters would remain buffered in the user space until a newline were output. Write(2) is too generic to blame for this kind of problem. It sounds to me like a problem with the Scheme software. My guess is that a subsequent ioctl() is doing a TCSETA instead of a TCSETAW; this can cause pending output to be mangled or discarded.