patch-2.4.19 linux-2.4.19/drivers/char/n_tty.c
Next file: linux-2.4.19/drivers/char/nvram.c
Previous file: linux-2.4.19/drivers/char/mxser.c
Back to the patch index
Back to the overall index
- Lines: 52
- Date:
Fri Aug 2 17:39:43 2002
- Orig file:
linux-2.4.18/drivers/char/n_tty.c
- Orig date:
Fri Apr 6 10:42:55 2001
diff -urN linux-2.4.18/drivers/char/n_tty.c linux-2.4.19/drivers/char/n_tty.c
@@ -23,6 +23,11 @@
* 2000/01/20 Fixed SMP locking on put_tty_queue using bits of
* the patch by Andrew J. Kroll <ag784@freenet.buffalo.edu>
* who actually finally proved there really was a race.
+ *
+ * 2002/03/18 Implemented n_tty_wakeup to send SIGIO POLL_OUTs to
+ * waiting writing processes-Sapan Bhatia <sapan@corewars.org>.
+ * Also fixed a bug in BLOCKING mode where write_chan returns
+ * EAGAIN
*/
#include <linux/types.h>
@@ -711,6 +716,22 @@
return 0;
}
+/*
+ * Required for the ptys, serial driver etc. since processes
+ * that attach themselves to the master and rely on ASYNC
+ * IO must be woken up
+ */
+
+static void n_tty_write_wakeup(struct tty_struct *tty)
+{
+ if (tty->fasync)
+ {
+ set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
+ kill_fasync(&tty->fasync, SIGIO, POLL_OUT);
+ }
+ return;
+}
+
static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
char *fp, int count)
{
@@ -1157,6 +1178,8 @@
while (nr > 0) {
ssize_t num = opost_block(tty, b, nr);
if (num < 0) {
+ if (num == -EAGAIN)
+ break;
retval = num;
goto break_out;
}
@@ -1236,6 +1259,6 @@
normal_poll, /* poll */
n_tty_receive_buf, /* receive_buf */
n_tty_receive_room, /* receive_room */
- 0 /* write_wakeup */
+ n_tty_write_wakeup /* write_wakeup */
};
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)