[php-src] PR #23805: Map epoll_ctl() errors through php_poll_errno_to_error()
| From: | nicolas-grekas | Date: | Sun, 20 Sep 2026 20:06:48 +0000 |
| Subject: | [php-src] PR #23805: Map epoll_ctl() errors through php_poll_errno_to_error() | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38643@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23805
Author: nicolas-grekas
The epoll backend reports everything but
EEXIST and ENOENT as
ERR_SYSTEM, so a caller cannot tell "this handle cannot be polled" from
"polling is broken". The kqueue backend already maps errno through
php_poll_errno_to_error(), this makes epoll do the same.
EPERM gets its own case: epoll_ctl() returns it for files that do not
implement polling, which means Context::add() fails for regular files,
php://temp and /dev/null while Backend::Poll accepts them
all:
```
Auto (epoll) Poll
regular file FailedHandleAddException added ok
/dev/null FailedHandleAddException added ok
php://temp FailedHandleAddException added ok
pipe added ok added ok
socketpair added ok added ok
```
That is expected from epoll, and kqueue does not have the problem since it takes regular files. But
an event loop has to deal with it, since STDIN is /dev/null in most CI
runs and a plain file whenever it is redirected, and today the only way to detect the case is to try
the handle again on a Backend::Poll context. With ERROR_NOSUPPORT it can
fall back on the spot.
/cc @bukka