[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

poll() return value problems according to POSIX(?)

From: Michael Banck
Subject: poll() return value problems according to POSIX(?)
Date: Thu, 28 Jun 2007 17:57:47 +0200

(sorry if that is a FAQ, but google didn't find prior discussion)


python2.5 introduced a configure check for a broken poll(), which is
positive on GNU/Hurd (thus HAVE_BROKEN_POLL is defined), but not Linux.

The code of the check is as follows:

#include <poll.h>

int main (void)
    struct pollfd poll_struct = { 42, POLLIN|POLLPRI|POLLOUT, 0 };

    close (42);

    int poll_test = poll (&poll_struct, 1, 0);

    if (poll_test < 0)

on Linux, poll_test is 1 and errno is set to EBADF.  On GNU/Hurd,
poll_test is -1 and errno is set to EBADF.  This makes the test return
`0' and python define HAVE_BROKEN_POLL, which later on leads to build
errors in [python]/Modules/selectmodule.c.

According to POSIX[1] as I (and some people who pointed me to it) read
it, only EAGAIN, EINTR and EINVAL are valid errors, poll() should not
fail on others (like EBADF), but POLLNVAL should be set
accordingly in revents instead. 

Are we at fail here, is this python test bogus or am I just confused?



[1] http://www.opengroup.org/onlinepubs/009695399/functions/poll.html

reply via email to

[Prev in Thread] Current Thread [Next in Thread]