From owner-freebsd-bugs Fri Dec 29 23:10:04 1995 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id XAA03938 for bugs-outgoing; Fri, 29 Dec 1995 23:10:04 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id XAA03929 Fri, 29 Dec 1995 23:10:02 -0800 (PST) Date: Fri, 29 Dec 1995 23:10:02 -0800 (PST) Message-Id: <199512300710.XAA03929@freefall.freebsd.org> To: freebsd-bugs Cc: From: Bruce Evans Subject: Re: kern/920: sio output looses chars in fifo on close() Reply-To: Bruce Evans Sender: owner-bugs@FreeBSD.ORG Precedence: bulk The following reply was made to PR kern/920; it has been noted by GNATS. From: Bruce Evans To: FreeBSD-gnats-submit@FreeBSD.ORG, smp@csn.net Cc: Subject: Re: kern/920: sio output looses chars in fifo on close() Date: Sat, 30 Dec 1995 17:57:39 +1100 > The sio driver disables the fifo (of 16550 class chips) in > sioclose() -> comhardclose(). This appears to 'loose' characters > currently in the uart. If the port is open by another process > ( as in "cat > /dev/ttyd4" ) the problem doesn't occur. ttywait() is supposed to have waited until output has completed (except in non-blocking mode). However, it doesn't because TS_BUSY is cleared too early (when all output has been written to the fifo, not when output is complete). This isn't easy to handle correctly since there is no interrupt for output-complete. Output would also be lost or garbled when the line state is changed, except comparam() waits for output to complete because some UARTs lock up if their speed is changed while they are active. Some internal modems are reported to loop endlessly in the wait in comparam(). This may be because they don't [correctly] implement the LSR_TSRE (transmitter shift register empty) bit that must be polled to to decide when to clear TS_BUSY. Bruce