lkml.org 
[lkml]   [2003]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] select fix
Andries.Brouwer@cwi.nl wrote:
>
> Recently people complained on lk about a problem: one sees
>
> select(2, NULL, [1], NULL, NULL) = 1 (out [1])
> write(1, "hi\n", 3) = -1 EAGAIN (Resource temporarily unavailable)
>
> for a stopped tty opened with O_NONBLOCK. This violates POSIX,
> and the 100% CPU use in a select loop does not look pretty either.
> The below fixes this.
> ...
>
> - if (tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS)
> + if (!tty->stopped && tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS)
> mask |= POLLOUT | POLLWRNORM;

Manfred sent a patch through esterday which addresses it this way:

- if (tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS)
+ if (tty->driver->chars_in_buffer(tty) < WAKEUP_CHARS &&
+ tty->driver->write_room(tty) > 0)

Any preferences?

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.084 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site