Re: Repost: Bug with select?

From: Manfred Spraul (manfred@colorfullife.com)
Date: Sun Jul 27 2003 - 14:29:57 EST


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; }

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Jul 31 2003 - 22:00:34 EST