lkml.org 
[lkml]   [2003]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: 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;
}
\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.018 / U:0.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site