Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Date | Sun, 27 Jul 2003 21:29:57 +0200 | From | Manfred Spraul <> | Subject | Re: Repost: Bug with select? |
| |
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 --- 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; } | ![\](/images/icornerr.gif) |