Re: A question on PTY

H.J. Lu (hjl@lucon.org)
Wed, 9 Dec 1998 21:06:53 -0800 (PST)


>
> From: hjl@lucon.org (H.J. Lu)
> Date: Wed, 9 Dec 1998 08:09:12 -0800 (PST)
>
> I got 2 failures in the POSIX test on PTY. One is the STOP char
> is not sent when the PTY is full. Although write blocks, read on
> the blocked PTY doesn't return the STOP char. The other one is
> when the PTY is put in back ground, output doesn't generate
> SIGTTOU. I can provide testcases if necessary.
>
> HJ,
>
> Can you provide test cases? Both of these cases are
> handled by the high-level tty code, and the last time I checked using
> the serial driver (which granted was a while ago), neither of these
> cases were a problem. So test cases would be most helpful. Thanks!!
>

Looking through the code in drivers/char, I believe XOFF/XON, SIGTTOU,
tcdrain, tcflush and tcflow are not fully supported on PTY. I believe
the patch below fixes SIGTTOU for tcdrain and others on PTY. Please
take a look. If it is correct, I will provide a testcase for others.

Thanks.

-- 
H.J. Lu (hjl@gnu.org)
---
Index: tty_io.c
===================================================================
RCS file: /home/work/cvs/linux/linux/drivers/char/tty_io.c,v
retrieving revision 1.1.1.36
diff -u -p -r1.1.1.36 tty_io.c
--- tty_io.c	1998/12/03 22:05:20	1.1.1.36
+++ tty_io.c	1998/12/10 05:06:07
@@ -1671,14 +1671,21 @@ int tty_ioctl(struct inode * inode, stru
 		switch(cmd) {
 		case TIOCSBRK:
 		case TIOCCBRK:
-			if (tty->driver.ioctl)
+			if (tty->driver.ioctl) {
+				retval = tty_check_change(tty);
+				if (retval)
+					return retval;
 				return tty->driver.ioctl(tty, file, cmd, arg);
+			}
 			return -EINVAL;
 			
 		/* These two ioctl's always return success; even if */
 		/* the driver doesn't support them. */
 		case TCSBRK:
 		case TCSBRKP:
+			retval = tty_check_change(tty);
+			if (retval)
+				return retval;
 			if (!tty->driver.ioctl)
 				return 0;
 			retval = tty->driver.ioctl(tty, file, cmd, arg);

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/