public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: Ben Mansell <ben@zeus.com>, Steven Dake <sdake@mvista.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Is POLLHUP an input-only or bidirectional condition? (was: epoll reporting events when it hasn't been asked to)
Date: Sat, 3 Apr 2004 23:35:41 +0100	[thread overview]
Message-ID: <20040403223541.GB6122@mail.shareable.org> (raw)
In-Reply-To: <Pine.LNX.4.44.0404031334440.2122-100000@bigblue.dev.mdolabs.com>

Davide Libenzi wrote:
> Looking at poll(2) though, it seems that it does the same thing if
> you set the event mask to 0. So epoll is coherent with poll(2) in this.

Yes.  SUSv3 says POLLHUP, POLLERR and POLLNVAL are always reported
even if not requested.

> I personally believe that an application should handle those
> exceptional events in any case, by simply removing the fd from the
> epoll set (and lazily freeing the associated userspace data structures).

Take a look at the new subject line :)

Linux select() treats it as an input-only condition, implying that
there might be useful things you can do with output to a file
descriptor that's reporting POLLHUP, including waiting for output.

However, SUSv3 says "This event [POLLHUP]and POLLOUT are mutually
exclusive; a stream can never be writable if a hangup has occurred",
implying that Linux select() is the oddity.

> So, if no big argouments will come against this, I'd rather prefer to keep 
> such behaviour. OTOH the patch would be trivial (one or two lines) , so 
> there will be no design problems in doing this.

I agree, in fact I'd argue specifically against changing it.

Programmers familiar with poll() know that you don't have to set
POLLHUP in the input mask -- because SUSv3 says so ("This flag
[POLLHUP] is only valid in the revents bitmask; it is ignored in the
events member").  They'd not be likely to notice a difference that
subtle for epoll, when they convert application code, so it's good
that there isn't a difference.

Btw, I notice epoll never reports POLLNVAL.  Is that correct?

-- Jamie

  reply	other threads:[~2004-04-03 22:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-01 18:25 epoll reporting events when it hasn't been asked to Ben Mansell
2004-04-01 19:28 ` Davide Libenzi
2004-04-01 23:29   ` Steven Dake
2004-04-02  9:04     ` Ben Mansell
2004-04-02 15:22       ` Davide Libenzi
2004-04-02 18:40         ` Is POLLHUP an input-only or bidirectional condition? (was: epoll reporting events when it hasn't been asked to) Jamie Lokier
2004-04-03 12:19           ` Is POLLHUP an input-only or bidirectional condition? Richard Kettlewell
2004-04-03 21:44           ` Is POLLHUP an input-only or bidirectional condition? (was: epoll reporting events when it hasn't been asked to) Davide Libenzi
2004-04-03 22:35             ` Jamie Lokier [this message]
2004-04-04  1:28               ` Davide Libenzi
2004-04-04  2:08                 ` Jamie Lokier
2004-04-04  2:49                   ` Davide Libenzi
2004-04-04 18:51               ` Ben Mansell
2004-04-04 19:41                 ` Davide Libenzi
2004-04-04 20:24                 ` Jamie Lokier
2004-04-14 17:59         ` epoll reporting events when it hasn't been asked to Dirk Morris
2004-04-14 19:39           ` Jamie Lokier
2004-04-14 20:21             ` Dirk Morris
2004-04-14 21:48               ` Jamie Lokier

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=20040403223541.GB6122@mail.shareable.org \
    --to=jamie@shareable.org \
    --cc=ben@zeus.com \
    --cc=davidel@xmailserver.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sdake@mvista.com \
    /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