[net.unix] Uniplus Unix 3 and O_NDELAY IO

FISCHER@RUTGERS.ARPA (02/16/84)

From:  Ron <FISCHER@RUTGERS.ARPA>

We're beginning to develop neato user interfaces with windows and all
that.  These are to run on rather intelligent terminals and talk to
mainframes.  We have seen the BLT.  We're using an Apple Lisa (and a
Monroe 80186 device, but that's another story...)

I want to talk to both keyboard and serial port at the same time using
unix 3, which doesn't have Berkely's neat "interrupt on character
read" feature.

I have tried to do non-waiting IO using O_NDELAY the way that Gary
Moss described for version 5, but on two devices at once: /dev/tty,
and a serial line (with a terminal connected to it for testing).  I
want to poll both of 'em.

I have no luck.  The problem stems from setting O_NDELAY with fcntl;
when I comment out that line of code things work (but synchronously).
When that line of code is in I get no response whatever from either my
terminal or the test terminal connected to the serial line.  BTW, I
figured that perhaps the timeout and "characters in buffer" numbers
(of ICANON fame) might have affected this, but I set those to no
avail, you know: (~avail)(ttmode.c_cc[WAIT])).

1) But seriously, does anyone know why this might not work?

2) Is it true that FIONREAD only works if ICANON enables input
massaging!? (erase and kill processing)

Uniplus is UNISoft's unix 3.  I have the Apple Lisa version.

3) Does anyone have a feel for the quality of Unisoft's ports of Unix?

>From this and some of the behavior the machine has been giving I
suspect that the device drivers are not interrupt driven and can't do
O_NDELAY mode.  Some of what I have been hearing from UNISoft is:
"Version 5 is *almost* ready and much better, sit tight."  I cannot
wait and at this point even something like CPM 68k is starting to look
like a cleaner development environment... if only I could get it for
the Lisa...

Ultimately, out of exasperation, I may just run two processes that
both do waiting IO, one for the keyboard and mouse, one for the serial
port.

Help!

(ron)
-------

gwyn%brl-vld@sri-unix.UUCP (02/16/84)

From:      Doug Gwyn (VLD/VMB) <gwyn@brl-vld>

The only thing that comes to mind is that Unisoft may not have fixed the
System III O_NDELAY bug (fixed in UNIX System V).  This is easy to find
and repair but I don't have the details at hand.

FISCHER@RUTGERS.ARPA (02/16/84)

From:  Ron <FISCHER@RUTGERS.ARPA>

Could anyone please tell me anything that might point me in the
direction of finding the O_NDELAY bug fix for Unix 3?

Tantalized (maybe there's some hope for Unix yet),
(ron)
-------

guy@rlgvax.UUCP (Guy Harris) (02/19/84)

The bug in System III no-delay reads from a terminal is that the system
always claims that there are no characters available to read.  The fix is
to change the lines in "ttread" in "io/tty.c":

	if (tq->c_cc == 0)
		if (u.u_fmode&FNDELAY)
			return;
		else
			canon(tp);

to:

	if (tq->c_cc == 0)
		if (u.u_fmode&FNDELAY && tp->t_rawq.c_cc == 0)
			return;
		else
			canon(tp);

Thanks and a tip of the Hatlo to Warren Montgomery of BTL UNIX EMACS fame,
who discovered this while trying to get EMACS' "look ahead and cancel redrawing"
code to work on System III.

	Guy Harris
	{seismo,ihnp4,allegra}!rlgvax!guy