public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Schwartz <davids@webmaster.com>
To: <cohen@rafb.net>, <linux-kernel@vger.kernel.org>
Subject: Re: kernel 2.4.18 - select() returning strange value
Date: Sat, 8 Jun 2002 18:57:49 -0700	[thread overview]
Message-ID: <20020609015751.AAA13941@shell.webmaster.com@whenever> (raw)
In-Reply-To: <12812896964.20020607130905@rafb.net>


On Fri, 7 Jun 2002 13:09:05 -0700, Jacob Cohen wrote:

>Summary: when calling select() on a set of file descriptors containing
>only the descriptor of a non-connected stream socket, select() returns
>1 and marks the FD set as if data were waiting on the socket.

	This seems correct to me. A read or write will not block and there is 
nothing to wait for.

>According to what I've read in the man pages for select() and
>socket(), a nonconnected socket should be unreadable, and therefore
>select() should timeout and return 0. I cannot figure out why it is
>returning 1.

	Because the socket is ready for read. If a read were attempted immediately, 
it would not block. If a read would result in an error other than 
'EWOULDBLOCK', the socket is ready to be read.

>Has something changed in the kernel or the way the select() syscall
>behaves on a nonconnected socket that I should be aware of? I cannot
>find anything relevant in the recent change logs, but I am probably
>missing something.

	I'm guessing the previous erroneous behavior was fixed. When you 'select' on 
an unconnected socket, what do you expect 'select' to wait for?

	DS



  reply	other threads:[~2002-06-09  1:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-07 20:09 kernel 2.4.18 - select() returning strange value Jacob Cohen
2002-06-09  1:57 ` David Schwartz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-06-10  6:22 Borsenkow Andrej

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=20020609015751.AAA13941@shell.webmaster.com@whenever \
    --to=davids@webmaster.com \
    --cc=cohen@rafb.net \
    --cc=linux-kernel@vger.kernel.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