Article View: comp.os.xinu
Article #320Xinu v6 bug
From: sdo
Date: Thu, 30 Mar 1989 19:20
Date: Thu, 30 Mar 1989 19:20
72 lines
2545 bytes
2545 bytes
We just received a bug report from David Schulz:
David Schulz
AT&T Bell Laboratories
att!iexist!schulz
He found a bug in the ttywrite.c routine. There is an error in that
routine in the V6 code, but not in V7, as the routine is slightly
different there. The bug is as follows (see added line ==>):
ttywrite(devptr, buff, count)
struct devsw *devptr;
char *buff;
int count;
{
register struct tty *ttyp;
int avail;
if (count < 0)
return(SYSERR);
if (count == 0)
return(OK);
disable();
ttyp = &tty[devptr->dvminor];
if ( (avail=scount(ttyp->osem)) >= count) {
writcopy(buff, ttyp, count);
sluenable(ttyp);
} else {
if (avail > 0) {
writcopy(buff, ttyp, avail);
buff += avail;
count -= avail;
==> sluenable(ttyp); /* BUG FIX -- DES */
}
for (; count>0 ; count--)
ttyputc(devptr, *buff++);
}
restore();
return(OK);
This code is for the Sun version, but it also occurs in the original
LSI version with slightly different but obvious syntax. The routine
sluenable() informs the serial chip that it should interrupt when it
is finished writing characters. It is disabled when the output buffer
is empty, and re-enabled when it has work to do. When disabled, the
low level tty routine will not know that it should hand characters to
the chip, and ttywrite() blocks forever. This bug ONLY occurs when:
1) Output interrupts are disabled, (which implies that the output
buffer is empty).
2) You call ttywrite() with a buffer size larger than the circular
output buffer.
Adding the call to sluenable() fixes the problem, and you should
probably patch it in your v6 code. In non-Sun3 versions of the code,
the new line should be the same as the last line in the "then" portion
of the "if" clause.
If you have problems, please let me know.
Once again, thanks to Mr. Schulz for keeping us all in touch with his
bug fixes.
Shawn
-----------------------------------------------------------------------------
Shawn Ostermann ARPA: sdo@cs.purdue.edu UUCP: ...!purdue!sdo
-----------------------------------------------------------------------------
Technical Details
Message-ID:
<8903301920.AA19812@gwen.cs.purdue.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!CS.PURDUE.EDU!sdoShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!CS.PURDUE.EDU!sdo From: sdo@CS.PURDUE.EDU Newsgroups: comp.os.xinu Subject: Xinu v6 bug Message-ID: <8903301920.AA19812@gwen.cs.purdue.edu> Date: 30 Mar 89 19:20:35 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 72