Re: poll() incompatability with POSIX.1-2001

From: Jogchem de Groot (bighawk@kryptology.org)
Date: Mon Oct 14 2002 - 12:13:43 EST


Hello,

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.

It's really true:..

Here is some strace output:

Case where connect() succeeds:

connect(3, {sin_family=AF_INET, sin_port=htons(111),
sin_addr=inet_addr("127.0.0.1")}}, 16) = -1 EINPROGRESS (Operation now in
progress)
poll([{fd=3, events=POLLIN|POLLOUT, revents=POLLOUT}], 1, -1) = 1
getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0

As you can see SO_ERROR returns '0', connection succeeded.

Case where connect() fails:

connect(3, {sin_family=AF_INET, sin_port=htons(110),
sin_addr=inet_addr("127.0.0.1")}}, 16) = -1 EINPROGRESS (Operation now in
progress)
poll([{fd=3, events=POLLIN|POLLOUT, revents=POLLIN|POLLERR|POLLHUP}], 1, -1)
= 1
getsockopt(3, SOL_SOCKET, SO_ERROR, [111], [4]) = 0

As you can see SO_ERROR returns '111', connection failed.

   bighawk
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Oct 15 2002 - 22:00:50 EST