epoll_create1 should toss EINVAL for invalid flags
While compiling Python 3.5 and running test suite, one test in test_epoll.py fails (
if hasattr(select, "EPOLL_CLOEXEC"): select.epoll(select.EPOLL_CLOEXEC).close() self.assertRaises(OSError, select.epoll, flags=12356)
When digging into the issue, I tried to run the code on both Linux and illumos (fresh OpenIndiana):
When stracing on Linux, I see:
epoll_create1(EPOLL_CLOEXEC|0x1e240) = -1 EINVAL (Invalid argument)
but nothing similar happens on illumos.
Digging deeper in the source code, we are missing a check for flags arguments as in Linux:
Our man pages also states:
The epoll_create() and epoll_create1() functions will fail if: EINVAL Either the size is zero (epoll_create()) or the flags are invalid (epoll_create1()).
However, the reality is that epoll_create1 doesn't return EINVAL.
Our epoll_create should just behave the same as on Linux.
Updated by Electric Monk almost 3 years ago
- Status changed from New to Closed
commit a192d1c0eb1d05a03ead3c7f898e864e4bf0399c Author: Patrick Mooney <firstname.lastname@example.org> Date: 2016-11-17T15:12:22.000Z 7506 epoll_create1 should toss EINVAL for invalid flags Reviewed by: Jerry Jelinek <email@example.com> Reviewed by: Robert Mustacchi <firstname.lastname@example.org> Approved by: Dan McDonald <email@example.com>