public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Andries.Brouwer@cwi.nl
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org,
	Manfred Spraul <manfred@colorfullife.com>
Subject: Re: [PATCH] select fix
Date: Tue, 29 Jul 2003 10:36:30 -0700	[thread overview]
Message-ID: <20030729103630.7fb415cb.akpm@osdl.org> (raw)
In-Reply-To: <UTC200307291412.h6TECwA17034.aeb@smtp.cwi.nl>

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?


  reply	other threads:[~2003-07-29 17:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-29 14:12 [PATCH] select fix Andries.Brouwer
2003-07-29 17:36 ` Andrew Morton [this message]
2003-07-29 17:48   ` Valdis.Kletnieks
2003-07-29 18:09     ` Manfred Spraul
2003-07-29 17:57   ` Manfred Spraul
  -- strict thread matches above, loose matches on Subject: below --
2003-07-29 19:58 Andries.Brouwer
2003-07-29 20:18 Andries.Brouwer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030729103630.7fb415cb.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=Andries.Brouwer@cwi.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox