From: Manfred Spraul <manfred@colorfullife.com>
To: Eli Barzilay <eli@barzilay.org>, linux-kernel@vger.kernel.org
Cc: viro@parcelfarce.linux.theplanet.co.uk
Subject: Re: Repost: Bug with select?
Date: Sun, 27 Jul 2003 21:29:57 +0200 [thread overview]
Message-ID: <3F242835.9060001@colorfullife.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 553 bytes --]
Hi Eli,
The problem is normal_poll in drivers/char/n_tty.c:
> if (tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS)
> mask |= POLLOUT | POLLWRNORM;
It assumes that a following write will succeed if less than 256 bytes
are in the write buffer right now. This assumption is wrong for
con_write_room: if the console is stopped, it returns 0 bytes buffer
size (con_write_room()). Dito for pty_write_room.
The attached patch fixes your test case, but I don't understand tty
devices good enough to guarantee anything.
--
Manfred
[-- Attachment #2: patch-tty-fix --]
[-- Type: text/plain, Size: 403 bytes --]
--- 2.5/drivers/char/n_tty.c 2003-07-05 09:13:01.000000000 +0200
+++ build-2.5/drivers/char/n_tty.c 2003-07-27 20:44:58.000000000 +0200
@@ -1251,7 +1251,8 @@
else
tty->minimum_to_wake = 1;
}
- if (tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS)
+ if (tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS &&
+ tty->driver->write_room(tty) > 0)
mask |= POLLOUT | POLLWRNORM;
return mask;
}
next reply other threads:[~2003-07-28 2:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-27 19:29 Manfred Spraul [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-06-18 8:49 Problem with select? Eli Barzilay
2003-07-24 5:28 ` Repost: Bug " Eli Barzilay
2003-07-25 13:41 ` Marco Roeland
2003-07-26 0:20 ` Ben Greear
2003-07-26 9:05 ` Marco Roeland
2003-07-26 0:35 ` Philippe Troin
2003-07-26 14:29 ` Eli Barzilay
2003-07-26 14:25 ` Eli Barzilay
2003-07-26 15:37 ` Marco Roeland
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=3F242835.9060001@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=eli@barzilay.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/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;
as well as URLs for NNTP newsgroup(s).