-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unix::init
: Also fall back from poll
on ENOSYS
#113358
Conversation
Operating systems like [Unikraft] may return [`ENOSYS`] (Function not implemented (POSIX.1-2001)) on certain syscalls. Falling back from using `poll` at runtime initialization allows starting Rust applications on such systems. [Unikraft]: https://unikraft.org/ [`ENOSYS`]: https://www.man7.org/linux/man-pages/man3/errno.3.html
(rustbot has picked a reviewer for you, use r? to override) |
Is unikraft a separate out of tree target or does it pretend to be linux-compatible? If it wants to be linux then imo it should support poll, since that's a pretty essential system call. |
Unikraft is currently out of tree, but I'll start a PR to properly add it soon.
At the same time, Unikraft pretends to be exactly Linux with musl. As a modular libOS, components of Unikraft can be enabled at will and a module which provides the whole Nevertheless, it would be preferable if a minimal Unikraft configuration can at least start a minimal Rust application. I think falling back from using |
It can still do that by opting out of the poll-based code path and going directly for the fcntl one. The goal of deciding at compile-time is to minimize the amount of syscalls made at program startup. |
I agree. Either you support the syscalls we expect or we should not have to pretend you qualify as |
Note that POSIX says the expected errors for poll.h are EAGAIN, EINTR, and EINVAL, and while ENOSYS is implied for any functionality not supported by the OS, poll.h is now part of the Base as of Issue 7 (IEEE Std 1003.1™-2017). We have a specific Linux kernel minimum that we support, too, so invoking POSIX here doesn't necessarily suggest we should support all versions of POSIX equally, either, nevermind on a path optimized for certain OS which meet certain expectations. |
Thank you so much for your replies! :) I had thought, this was an easy fix that doesn't hurt anybody. This is the only Rust-sided incompatibility for starting applications on Unikraft. The Unikraft target is very configurable and may or may not support If you insist, I'll include the suggested |
Note that other "operating system frameworks" and the like also use cfgs to similar "handle that this may not be enabled"... Maybe we should have some sort of cfg that is easier to opt-in to when defining a target's capabilities in its |
Interesting idea, though that is probably out of scope for my work on Unikraft. Closing this, then, since there appears to be no one in favor of this PR's approach. |
If this wasn't the code path that Actual-Factual-Linux uses, it would be much more sensible. Please feel free to open an issue regarding this as a problem, not necessarily specific to Unikraft, because "problems with how Ask for @rustbot label: +A-technical-debt |
Operating systems like Unikraft may return
ENOSYS
(Function not implemented (POSIX.1-2001)) on certain syscalls.Falling back from using
poll
at runtime initialization allows starting Rust applications on such systems.Closes unikraft/lib-musl#58.