]> git.hungrycats.org Git - linux/commit
[PATCH] fix select() with an xoffed tty
authorAndrew Morton <akpm@osdl.org>
Fri, 1 Aug 2003 03:09:26 +0000 (20:09 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Fri, 1 Aug 2003 03:09:26 +0000 (20:09 -0700)
commit791c4b044ffcc1576ed5a5790e419e2b4edd9d54
treedcc74c8341e308a25e85ef68629e54d937b8b015
parenta74ccc26cb6bd169b3dca033f2d29afb0d81edae
[PATCH] fix select() with an xoffed tty

From: Manfred Spraul <manfred@colorfullife.com>

Eli Barzilay noticed that select() for tty devices is broken: For
stopped tty devices, select says POLLOUT and write fails with -EAGAIN.

    http://marc.theaimsgroup.com/?l=linux-kernel&m=105902461110282&w=2

I've tracked this back to 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()). Ditto for pty_write_room.
drivers/char/n_tty.c