From 562a666ce0ac9a6d3ffad1a6040cf8c9424628df Mon Sep 17 00:00:00 2001 From: bde Date: Sun, 7 May 1995 06:32:28 +0000 Subject: Test the correct nonblocking flag in ttylclose(). IO_NDELAY is only valid in read() and write(). FNONBLOCK is valid in ioctl() and close(). The bug caused hung ptys when a process talked to itself using nonblocking i/o and exited while the slave pty had output to flush. ttywait() was called and hung. Signals didn't work because the process was exiting. `comcontrol /dev/ttyp0 drainwait 1' worked to terminate the wait. This shows that comcontrol is not limited to hardware control. It has no i386 or driver dependencies and doesn't belong in src/sbin/i386. Bruce --- sys/kern/tty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sys') diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 94a4770..11c0a3f 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)tty.c 8.8 (Berkeley) 1/21/94 - * $Id: tty.c,v 1.41 1995/03/29 19:24:46 ache Exp $ + * $Id: tty.c,v 1.42 1995/04/15 21:04:58 bde Exp $ */ #include "snp.h" @@ -1196,7 +1196,7 @@ ttylclose(tp, flag) int flag; { - if ((flag & IO_NDELAY) || ttywflush(tp)) + if (flag & FNONBLOCK || ttywflush(tp)) ttyflush(tp, FREAD | FWRITE); return (0); } -- cgit v1.1