linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* poll() incompatability with POSIX.1-2001
@ 2002-10-14 14:58 Jogchem de Groot
  2002-10-14 15:14 ` Richard B. Johnson
  0 siblings, 1 reply; 6+ messages in thread
From: Jogchem de Groot @ 2002-10-14 14:58 UTC (permalink / raw)
  To: linux-kernel

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..

I hope somebody will take a closer look at this. It doesnt seem to require a
big fix at all..

Thank you,
    bighawk

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-10-15 13:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-14 14:58 poll() incompatability with POSIX.1-2001 Jogchem de Groot
2002-10-14 15:14 ` Richard B. Johnson
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

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).