[net.unix-wizards] System III tty driver bug fix

sch@MITRE-BEDFORD@sri-unix (08/06/82)

Date: Mon Jul 19 08:41:04 1982
Here is the fix for the NDELAY bug in the System 3 terminal handler.

In the file /usr/src/uts/pdp11/io/tty.c, remove old check for NDELAY (lines
489-491).

	 /* if(u.u_fmode& FNDELAY)
		    return;
	    else  */
		canon(tp);
Put the check for NDELAY in canon by changing line 404:
Before:         if ((tp->t_state&CARR_ON))==0) {
After:          if ((tp->t_state&CARR_ON)==0 || u.u_fmode&FNDELAY) {

Recompile (make -f io.mk) and make a new unix, and your all set.

WARNING:  Programs which leave the terminal in NDELAY mode will cause the
	shell to read EOF and log you out, so always reset it.  Better yet,
	change modes before and after the read which needs to use it.

Example:
	fcntl(0, F_SETFD, (oldflags = fcntl(0, F_GETFD, 0))|O_NDELAY);
	n = read(0, mybuf, sizeof( mybuf ));
	fcntl(0, F_SETFD, oldflags);

Aside: Why can't fcntl and ioctl have the same syntax???

	Steve
	Mitre-Bedford