stty nohang bug in 4.1BSD DH/DM driver

utzoo!decvax!cca!wales at UCLA-Security utzoo!decvax!cca!wales at UCLA-Security
Sat Apr 24 21:10:07 AEST 1982


From: wales at UCLA-Security (Rich Wales)
Near the end of the "dmintr" routine in dev/dh.c is the following line:

		    tp->t_state &= ~CARR_ON;

This statement should not be executed if LNOHANG is set in tp->t_local.
If it is, then "stty nohang" doesn't work on DH/DM lines.

The reason for this has to do with code in "ntread" and "ntwrite" (in
dev/ttynew.c) which terminates I/O on a line when CARR_ON is off.

If you look at the DZ driver (whose carrier logic is quite different
because there are no modem-control interrupts on a DZ), you will note
that it doesn't turn off CARR_ON when LNOHANG is set.

I fixed this one by putting "if ((tp->t_local&LNOHANG) == 0)" before
the line in question.  You could probably just move the offending line
into the block just above -- I didn't do this because I didn't want to
risk messing up the WOPEN (wait for carrier before opening) logic.

-- Rich Wales




More information about the Comp.unix.wizards mailing list