linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Richard B. Johnson" <root@chaos.analogic.com>
To: Jogchem de Groot <bighawk@kryptology.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: poll() incompatability with POSIX.1-2001
Date: Mon, 14 Oct 2002 11:14:01 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.3.95.1021014110505.12302A-100000@chaos.analogic.com> (raw)
In-Reply-To: <20021014145726.DFKF19708.mail8-sh.home.nl@there>

On Mon, 14 Oct 2002, Jogchem de Groot wrote:

> Hello,
> 
> There's an incompatability with the poll() implementation in the
> linux-2.4 kernel. (Tried 2.4.18).
> 
> According to the POSIX.1-2001 standard select() and poll() should
> return writability (POLLOUT) when connect() initated on a non-blocking
> socket asynchronously completes.
> 
> http://www.opengroup.org/onlinepubs/007904975/functions/connect.html
> 
> "If the connection cannot be established immediately and O_NONBLOCK is set
> for the file descriptor for the socket, connect() shall fail and set errno to
> [EINPROGRESS], but the connection request shall not be aborted, and the
> connection shall be established asynchronously. Subsequent calls to connect()
> for the same socket, before the connection is established, shall fail and set
> errno to [EALREADY].
> 
> When the connection has been established asynchronously, select() and poll()
> shall indicate that the file descriptor for the socket is ready for writing."
> 
> On linux-2.4 i noticed the following behaviour:
> 
> On connect() success select() returns writability for the socket.
> On connect() failure select() returns readability and writability for the
> socket.
> 
> This behaviour is according to the specification.
> 
> However with poll() (with events=POLLIN|POLLOUT) i get the following
> behaviour:
> 
> On connect() success poll() returns POLLOUT in revents.
> On connect() failure poll() returns POLLIN|POLLHUP|POLLERR in revents.
> 
> It does not set the POLLOUT bit here..

This is a failure to connect! The socket is therefore not ready for
writing  or reading -ever. This behavior may not be correct, not
because of a failure to set the POLLOUT bit, but because the POLLIN
bit is set. Check if this is really true. I can't duplicate this
on 2.4.18 here because it's hard to get a deferred connect with my
setup.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
The US military has given us many words, FUBAR, SNAFU, now ENRON.
Yes, top management were graduates of West Point and Annapolis.


  reply	other threads:[~2002-10-14 15:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-14 14:58 poll() incompatability with POSIX.1-2001 Jogchem de Groot
2002-10-14 15:14 ` Richard B. Johnson [this message]
2002-10-14 17:13   ` Jogchem de Groot
2002-10-15  3:36   ` Geoffrey Lee
2002-10-15  7:47     ` Jogchem de Groot
2002-10-15 13:53       ` Geoffrey Lee

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=Pine.LNX.3.95.1021014110505.12302A-100000@chaos.analogic.com \
    --to=root@chaos.analogic.com \
    --cc=bighawk@kryptology.org \
    --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;
as well as URLs for NNTP newsgroup(s).