mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David Schwartz" <davids@webmaster.com>
To: <netbeans@gatworks.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: RE: SELECT() returns 1 But FIONREAD says (Input/output error)
Date: Fri, 1 Jun 2007 09:43:04 -0700	[thread overview]
Message-ID: <MDEHLPKNGKAHNMBLJOLKCEBGEEAC.davids@webmaster.com> (raw)
In-Reply-To: <465F7C2A.5020702@gatworks.com>


> David Schwartz wrote:

> > Nope. An errored connection is always ready for read/write -- there is
> > nothing to wait for as far as the kernel is concerned. Your code keeps
> > asking the kernel if something interesting has happened, the
> > kernel keeps
> > telling it yes, and it refuses to do anything about it.

> The select() returns because i pulled the USB cable from hub. Seems
> reasonable.

Good. Then there is nothing further to discuss.

> The next select() found what? to be interesting in order to prematurely
> terminate the select-wait? As far as I can tell, nothing interesting has
> happened since the previous select(). In this case the select() is only
> looking at read()'s.

You have a very serious misunderstanding of what 'select' does. The 'select'
function is level triggered and state based, not edge triggered or event
based. The situation was the same as before, and so the same result is
required.

The kernel assumes that either you handled the error condition or you aren't
going to handle the error condition. In either case, the correct thing to do
is to again inform you of the error.

Suppose the first 'select' comes from code that is just curious how many
sockets are ready but has no intention of handling the events. Not reporting
the error on the next call to 'select' would be disastrous.

DS




  reply	other threads:[~2007-06-01 16:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-31 18:17 Uncle George
2007-06-01  1:01 ` David Schwartz
2007-06-01  1:53   ` Uncle George
2007-06-01 16:43     ` David Schwartz [this message]
2007-06-01 17:07       ` Uncle George
2007-06-01 17:33         ` David Schwartz
2007-06-01 20:04           ` Uncle George
2007-06-01 22:03             ` David Schwartz
2007-06-01 12:01   ` Uncle George
     [not found] <fa.qaWJQn9l1jDV+N9wFv9WqATf44U@ifi.uio.no>
     [not found] ` <fa.pq45zUHWQMSHoRGL/M4uTPfFWHg@ifi.uio.no>
2007-06-01  2:48   ` Robert Hancock
2007-06-02  0:02     ` Uncle George
     [not found] <8qXzx-jY-31@gated-at.bofh.it>
2007-06-01 12:19 ` Bodo Eggert

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=MDEHLPKNGKAHNMBLJOLKCEBGEEAC.davids@webmaster.com \
    --to=davids@webmaster.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netbeans@gatworks.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

all inboxes | Powered by JetHome®