diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/tty_io.c linux-2.5/drivers/char/tty_io.c --- bk-linus/drivers/char/tty_io.c 2002-11-21 02:14:02.000000000 +0000 +++ linux-2.5/drivers/char/tty_io.c 2002-11-21 17:57:48.000000000 +0000 @@ -1660,6 +1660,21 @@ static int send_break(struct tty_struct return 0; } +static int tty_generic_brk(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) +{ + if (cmd == TCSBRK && arg) + { + /* tcdrain case */ + int retval = tty_check_change(tty); + if (retval) + return retval; + tty_wait_until_sent(tty, 0); + if (signal_pending(current)) + return -EINTR; + } + return 0; +} + /* * Split this up, as gcc can choke on it otherwise.. */ @@ -1693,11 +1708,12 @@ int tty_ioctl(struct inode * inode, stru /* the driver doesn't support them. */ case TCSBRK: case TCSBRKP: - if (!tty->driver.ioctl) - return 0; - retval = tty->driver.ioctl(tty, file, cmd, arg); + retval = -ENOIOCTLCMD; + if (tty->driver.ioctl) + retval = tty->driver.ioctl(tty, file, cmd, arg); + /* Not driver handled */ if (retval == -ENOIOCTLCMD) - retval = 0; + retval = tty_generic_brk(tty, file, cmd, arg); return retval; } }