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
Add sigsuspend #2279
Add sigsuspend #2279
Conversation
> Since sigsuspend() suspends thread execution indefinitely, there is no > successful completion return value. If a return occurs, -1 shall be > returned and errno set to indicate the error. https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigsuspend.html
This reverts commit c174bd2.
This reverts commit f63e656.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution, generally looks good! I have left some comments
src/sys/signal.rs
Outdated
match Errno::result(res).map(drop) { | ||
Err(Errno::EINTR) => Ok(()), | ||
Err(e) => Err(e), | ||
Ok(_) => unreachable!(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to slightly state why the Ok()
branch is unreachable:
Ok(_) => unreachable!(), | |
Ok(_) => unreachable!("because this syscall always returns -1 if returns"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added reason.
src/sys/signal.rs
Outdated
target_os = "linux", | ||
target_os = "android", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer to use alias if available:
target_os = "linux", | |
target_os = "android", | |
linux_android, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed it.
src/sys/signal.rs
Outdated
target_os = "linux", | ||
target_os = "android", | ||
target_os = "hurd", | ||
target_os = "nto", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this as we are not sure if we should support this target
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed nto
.
test/sys/test_signal.rs
Outdated
target_os = "linux", | ||
target_os = "android", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, use alias please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed it.
test/sys/test_signal.rs
Outdated
target_os = "linux", | ||
target_os = "android", | ||
target_os = "hurd", | ||
target_os = "nto", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed nto
.
Never mind about the CI / tier3 (x86_64-unknown-dragonfly) (pull_request) failure, it is not related to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please wait for rust-lang/libc#3518 to merge. Then update Nix's Cargo.toml to point to the merged revision and enable sigsuspend for the additional platforms.
That PR is merged, @Toru3, you can update our libc dependency and add [dependencies]
-libc = { git = "https://github.com/rust-lang/libc", rev = "cb18b837963c37a8d21732f3ca2c2096f04e6830", features = ["extra_traits"] }
+libc = { git = "https://github.com/rust-lang/libc", rev = "2f93bfb7678e18a9fc5373dec49384bd23f601c3", features = ["extra_traits"] } #[cfg(any(
bsd,
linux_android,
solarish,
target_os = "haiku",
target_os = "hurd",
target_os = "aix",
target_os = "fushsia"
))] |
I updated libc to use below commit which add sigsuspend to more targets. rust-lang/libc@11f7c7b
Never mind, the CI seems to be good |
@asomers I updated libc and added targets to sigsuspend. Please review this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is all good, let's merge this:)
What does this PR do
Add
sigsuspend
asSigSet::suspend()
.Checklist:
CONTRIBUTING.md
Related #1994 #1997