Skip to content

fix: don't fail exceptfds with ENOSYS, just zero them' - #127

Closed
kilyanni wants to merge 1 commit into
mainfrom
fix/select-expectfds
Closed

fix: don't fail exceptfds with ENOSYS, just zero them'#127
kilyanni wants to merge 1 commit into
mainfrom
fix/select-expectfds

Conversation

@kilyanni

Copy link
Copy Markdown

pselect returned ENOSYS whenever errorfds held any descriptors, since wasix poll_oneoff has no exceptional-condition (POLLPRI) event type.
This breaks the common idiom of passing all three fd sets defensively and treating only EBADF as fatal (e.g. rsync, whose select loop spins on the ENOSYS).

Exceptional conditions are unobservable on wasix anyway, so report that no descriptor is exceptional (FD_ZERO(errorfds)) and proceed on read/write instead of failing the call. Also fixes select(), which forwards to pselect().

@kilyanni

Copy link
Copy Markdown
Author

Conclusion: try implementing this properly via a new syscall that does report errors

@Arshia001 Arshia001 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This introduces a potential deviation from applications' expectations, where an app that actually depends on checking for errors through select will just never see any errors and assume everything is going well. The proper fix would be to introduce proper support for reporting errors through select, which probably requires a new syscall.

@Arshia001 Arshia001 closed this Jul 24, 2026
@kilyanni kilyanni reopened this Jul 30, 2026
@kilyanni

kilyanni commented Jul 30, 2026

Copy link
Copy Markdown
Author

Thinking about it for a bit, I now think this is actually the right approach.

exceptfds does not actually report errors, it reports exceptional data, aka POLLPRI, which we globally define to be equal to POLLIN. So this is not really something this codebase is set up for. It is also incredibly niche to be using POLLPRI nowadays.

There are some edge cases in Linux where exceptional condtions may occur (procfs, sysfs, cgroup stuff) all of which don't exist inside wasix. The only real case would be TCP OOB which is generally discouraged, and we do not produce it anywhere at the moment.

TL;DR: this is not fully correct, but it breaks way fewer consumers than the status quo. Full OOB handling could be done in a follow up but does not unblock any consumer I know of, so low prio

@kilyanni

kilyanni commented Aug 4, 2026

Copy link
Copy Markdown
Author

nevermind, implementing TCP OOB is quite reasonably doable, gonna do that

@kilyanni kilyanni closed this Aug 4, 2026
@kilyanni
kilyanni deleted the fix/select-expectfds branch August 5, 2026 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants