patch-2.2.15 linux/drivers/char/tty_io.c

Next file: linux/drivers/char/tty_ioctl.c
Previous file: linux/drivers/char/sysrq.c
Back to the patch index
Back to the overall index

diff -u --new-file --recursive --exclude-from ../../exclude v2.2.14/drivers/char/tty_io.c linux/drivers/char/tty_io.c
@@ -434,6 +434,7 @@
 
 	wake_up_interruptible(&tty->write_wait);
 	wake_up_interruptible(&tty->read_wait);
+	wake_up_interruptible(&tty->poll_wait);
 
 	/*
 	 * Shutdown the current line discipline, and reset it to
@@ -574,6 +575,7 @@
 		tty->ctrl_status &= ~TIOCPKT_START;
 		tty->ctrl_status |= TIOCPKT_STOP;
 		wake_up_interruptible(&tty->link->read_wait);
+		wake_up_interruptible(&tty->link->poll_wait);
 	}
 	if (tty->driver.stop)
 		(tty->driver.stop)(tty);
@@ -588,6 +590,7 @@
 		tty->ctrl_status &= ~TIOCPKT_STOP;
 		tty->ctrl_status |= TIOCPKT_START;
 		wake_up_interruptible(&tty->link->read_wait);
+		wake_up_interruptible(&tty->link->poll_wait);
 	}
 	if (tty->driver.start)
 		(tty->driver.start)(tty);
@@ -595,6 +598,7 @@
 	    tty->ldisc.write_wakeup)
 		(tty->ldisc.write_wakeup)(tty);
 	wake_up_interruptible(&tty->write_wait);
+	wake_up_interruptible(&tty->poll_wait);
 }
 
 static ssize_t tty_read(struct file * file, char * buf, size_t count, 
@@ -1106,6 +1110,10 @@
 				wake_up(&tty->read_wait);
 				do_sleep++;
 			}
+			if (waitqueue_active(&tty->poll_wait)) {
+				wake_up(&tty->poll_wait);
+				do_sleep++;
+			}
 			if (waitqueue_active(&tty->write_wait)) {
 				wake_up(&tty->write_wait);
 				do_sleep++;
@@ -1120,6 +1128,10 @@
 				wake_up(&o_tty->write_wait);
 				do_sleep++;
 			}
+			if (waitqueue_active(&o_tty->poll_wait)) {
+				wake_up(&o_tty->poll_wait);
+				do_sleep++;
+			}
 		}
 		if (!do_sleep)
 			break;
@@ -1448,7 +1460,7 @@
 		return retval;
 
 	if (on) {
-		if (!waitqueue_active(&tty->read_wait))
+		if (!waitqueue_active(&tty->read_wait) && !waitqueue_active(&tty->poll_wait))
 			tty->minimum_to_wake = 1;
 		if (filp->f_owner.pid == 0) {
 			filp->f_owner.pid = (-tty->pgrp) ? : current->pid;
@@ -1456,7 +1468,7 @@
 			filp->f_owner.euid = current->euid;
 		}
 	} else {
-		if (!tty->fasync && !waitqueue_active(&tty->read_wait))
+		if (!tty->fasync && !waitqueue_active(&tty->read_wait) && !waitqueue_active(&tty->poll_wait))
 			tty->minimum_to_wake = N_TTY_BUF_SIZE;
 	}
 	return 0;
@@ -1943,6 +1955,7 @@
 	tty->tq_hangup.data = tty;
 	sema_init(&tty->atomic_read, 1);
 	sema_init(&tty->atomic_write, 1);
+	spin_lock_init(&tty->read_lock);
 }
 
 /*
@@ -2204,6 +2217,9 @@
 #endif
 #ifdef CONFIG_SX
 	sx_init();
+#endif
+#ifdef CONFIG_RIO
+	rio_init();
 #endif
 #ifdef CONFIG_8xx
         rs_8xx_init();

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)