From: Hua Zhong <hzhong@cisco.com>
To: torvalds@transmeta.com, sapan@corewars.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [2.5] Non-blocking write can block
Date: Wed, 4 Jun 2003 13:09:16 -0700 [thread overview]
Message-ID: <03060413091600.22968@hzhong-lnx.cisco.com> (raw)
In-Reply-To: <03060412360802.22925@hzhong-lnx.cisco.com>
There is a missing piece in the previous mail. The complete patch is as
follows. I just googled it and the author is Sapan Bhatia .Cc-ed.
diff -urN linux-old/drivers/char/CVS/Entries linux/drivers/char/CVS/Entries
--- linux-old/drivers/char/CVS/Entries 2003-06-04 12:57:32.000000000 -0700
+++ linux/drivers/char/CVS/Entries 2003-06-04 13:01:35.000000000 -0700
@@ -194,5 +194,5 @@
D/pcmcia////
D/rio////
/tty_io.c/1.3/Wed Jun 4 19:28:08 2003//
-/pty.c/1.1/Wed Jun 4 19:57:20 2003//T1.1
-/n_tty.c/1.1/Wed Jun 4 19:57:32 2003//T1.1
+/n_tty.c/1.2/Wed Jun 4 20:01:32 2003//
+/pty.c/1.2/Wed Jun 4 20:01:32 2003//
diff -urN linux-old/drivers/char/n_tty.c linux/drivers/char/n_tty.c
--- linux-old/drivers/char/n_tty.c 2003-06-04 13:00:51.000000000 -0700
+++ linux/drivers/char/n_tty.c 2003-06-04 13:01:32.000000000 -0700
@@ -711,6 +711,23 @@
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 +1174,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 +1255,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 */
};
diff -urN linux-old/drivers/char/pty.c linux/drivers/char/pty.c
--- linux-old/drivers/char/pty.c 2003-06-04 13:01:04.000000000 -0700
+++ linux/drivers/char/pty.c 2003-06-04 13:01:32.000000000 -0700
@@ -331,6 +331,7 @@
clear_bit(TTY_OTHER_CLOSED, &tty->link->flags);
wake_up_interruptible(&pty->open_wait);
set_bit(TTY_THROTTLED, &tty->flags);
+ set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
/* Register a slave for the master */
if (tty->driver.major == PTY_MASTER_MAJOR)
tty_register_devfs(&tty->link->driver,
\x1fà@
next prev parent reply other threads:[~2003-06-04 19:56 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-04 19:36 Hua Zhong
2003-06-04 20:09 ` Hua Zhong [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-06-06 12:13 Nicholas Berry
2003-06-05 0:04 Ed Vance
2003-06-05 0:19 ` Davide Libenzi
2003-06-05 18:34 ` Mike Fedyk
2003-06-05 19:15 ` Richard B. Johnson
2003-06-05 21:46 ` Joe Korty
2003-06-06 0:13 ` Davide Libenzi
[not found] <20030604172026$296c@gated-at.bofh.it>
[not found] ` <20030604175013$3a4d@gated-at.bofh.it>
2003-06-04 19:13 ` Ben Pfaff
2003-06-04 0:58 P. Benie
2003-06-04 5:53 ` Christoph Hellwig
2003-06-04 14:35 ` Linus Torvalds
2003-06-04 14:58 ` P. Benie
2003-06-04 16:47 ` Alan Cox
2003-06-04 17:57 ` Linus Torvalds
2003-06-04 19:46 ` P. Benie
2003-06-04 19:56 ` Linus Torvalds
2003-06-04 20:48 ` P. Benie
2003-06-11 0:19 ` Robert White
2003-06-04 20:43 ` Hua Zhong
2003-06-04 23:42 ` Russell King
2003-06-04 23:47 ` Davide Libenzi
2003-06-04 21:29 ` Alan Cox
2003-06-04 17:14 ` Hua Zhong
2003-06-04 17:41 ` Linus Torvalds
2003-06-04 18:44 ` Hua Zhong
2003-06-04 18:47 ` P. Benie
2003-06-04 19:23 ` P. Benie
2003-06-04 19:20 ` Linus Torvalds
2003-06-04 17:53 ` Mike Dresser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=03060413091600.22968@hzhong-lnx.cisco.com \
--to=hzhong@cisco.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sapan@corewars.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®