Map epoll_ctl() errors through php_poll_errno_to_error() - #23805
Merged
Merged
Conversation
The epoll backend reported everything but EEXIST and ENOENT as ERR_SYSTEM, so a caller could not tell that epoll refuses the handle from a real failure. The kqueue backend already maps errno, this makes epoll do the same, with EPERM reported as ERR_NOSUPPORT: that is what epoll_ctl() returns for files that do not implement polling, such as regular files and /dev/null.
Member
|
The CI failures seemed unrelated btw. |
Contributor
Author
|
Cool, thanks for merging my PRs ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The epoll backend reports everything but
EEXISTandENOENTasERR_SYSTEM, so a caller cannot tell "this handle cannot be polled" from "polling is broken". The kqueue backend already maps errno throughphp_poll_errno_to_error(), this makes epoll do the same.EPERMgets its own case:epoll_ctl()returns it for files that do not implement polling, which meansContext::add()fails for regular files,php://tempand/dev/nullwhileBackend::Pollaccepts them all: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
STDINis/dev/nullin 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 aBackend::Pollcontext. WithERROR_NOSUPPORTit can fall back on the spot./cc @bukka