std: implement sleep_until for Fuchsia - #152617
Conversation
|
Hey friends of Fuchsia! This issue could use some guidance on how this should be |
|
r? @ibraheemdev rustbot has assigned @ibraheemdev. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
|
Sorry for the delay here. I was on vacation, then out sick for a bit. The implementation looks correct to me. Thank you for updating the One nit on the commit comment: while most usages of |
2e608fb to
8e4293c
Compare
This comment has been minimized.
This comment has been minimized.
8e4293c to
a31064a
Compare
|
@rustbot reroll |
|
I don't suppose there's any fuschia runner to allow us to add a test? shame. the job for it seems to have been disabled for a while as well 🫠 i suppose it's at least worth a rebase and check build if you have a local fuchsia machine this can run on, since it is a tier 2 target |
|
dug into this a bit - seems like fuchsia ci is just ... a lost cause for now & google does their own internal testing if they care? either way, not something that should be libs' task to fix, and it seems like you did your due diligence here. ill wait for a rebase just in case and then r=me |
|
Oh shucks I forgot we had the fuchsia ci turned off. I’ll try to get it back on. I’m the meantime I’ll run this code by our time folks to make sure this implementation is correct. |
| /// | Hurd | [`clock_nanosleep`] (Monotonic Clock) | | ||
| /// | Vxworks | [`clock_nanosleep`] (Monotonic Clock) | | ||
| /// | Apple | `mach_wait_until` | | ||
| /// | Fuchsia | [`zx_nanosleep`] | |
There was a problem hiding this comment.
zx_nanosleep is also using our monotonic clock, so this should be:
/// | Fuchsia | [`zx_nanosleep`] (Monotonic Clock)
There was a problem hiding this comment.
The "(Monotonic Clock)" comment is only relevant for clock_nanosleep since it can also be used with CLOCK_REALTIME. The situation on the Apple platforms – where there is no comment – is the same as on Fuchsia, the API only supports one clock.
|
This looks correct, other than the one comment. Thanks so much for implementing this for us! |
a31064a to
1c0a0d9
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
std: implement `sleep_until` for Fuchsia Tracking issue: rust-lang#113752 Unfortunately Fuchsia's `clock_nanosleep` is [only a stub](https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/third_party/ulib/musl/src/time/clock_nanosleep.c;l=4;drc=26e68e7948a6cc4a1c4a0c8eb19b7e4a2dc27153). The kernel's `zx_nanosleep` syscall however does exactly what's needed. I've done a few drive-by changes in the two outer commits, our uses of `zx_time_t` use the `zx_instant_mono_t` alias nowadays and the syscall table in the `sleep_until` documentation didn't mark the function names as code. @rustbot ping fuchsia
std: implement `sleep_until` for Fuchsia Tracking issue: rust-lang#113752 Unfortunately Fuchsia's `clock_nanosleep` is [only a stub](https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/third_party/ulib/musl/src/time/clock_nanosleep.c;l=4;drc=26e68e7948a6cc4a1c4a0c8eb19b7e4a2dc27153). The kernel's `zx_nanosleep` syscall however does exactly what's needed. I've done a few drive-by changes in the two outer commits, our uses of `zx_time_t` use the `zx_instant_mono_t` alias nowadays and the syscall table in the `sleep_until` documentation didn't mark the function names as code. @rustbot ping fuchsia
std: implement `sleep_until` for Fuchsia Tracking issue: rust-lang#113752 Unfortunately Fuchsia's `clock_nanosleep` is [only a stub](https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/third_party/ulib/musl/src/time/clock_nanosleep.c;l=4;drc=26e68e7948a6cc4a1c4a0c8eb19b7e4a2dc27153). The kernel's `zx_nanosleep` syscall however does exactly what's needed. I've done a few drive-by changes in the two outer commits, our uses of `zx_time_t` use the `zx_instant_mono_t` alias nowadays and the syscall table in the `sleep_until` documentation didn't mark the function names as code. @rustbot ping fuchsia
std: implement `sleep_until` for Fuchsia Tracking issue: rust-lang#113752 Unfortunately Fuchsia's `clock_nanosleep` is [only a stub](https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/third_party/ulib/musl/src/time/clock_nanosleep.c;l=4;drc=26e68e7948a6cc4a1c4a0c8eb19b7e4a2dc27153). The kernel's `zx_nanosleep` syscall however does exactly what's needed. I've done a few drive-by changes in the two outer commits, our uses of `zx_time_t` use the `zx_instant_mono_t` alias nowadays and the syscall table in the `sleep_until` documentation didn't mark the function names as code. @rustbot ping fuchsia
…uwer Rollup of 20 pull requests Successful merges: - #152617 (std: implement `sleep_until` for Fuchsia) - #158934 (diagnostics: fix `let x: vec![]` suggestion pointing into stdlib) - #161277 (bootstrap: Move all non-module items out of the crate root) - #161295 (std: don't panic on long-elapsed deadlines for `sleep_until`) - #161368 (Double-word align `_Unwind_Exception`) - #161370 (Uplift rustfmt macro formatting fix) - #161378 (`FlowSensitiveAnalysis` cleanups) - #158032 (Offload expose device selection) - #158855 (Add `desktop` method to `CommandExt`) - #161199 (Add regression test for non lifetime binders) - #161302 (Add regression test for inconsistent import resolution from issue 147208) - #161329 (Add regression tests for a few fixed issues with E-needs-test) - #161330 (Add regression test for nested RPIT not an iterator ICE) - #161351 (Cleanup: Move impl of `#[rustc_dump_object_lifetime_defaults]`) - #161355 (Add file path to some archive build errors) - #161373 (Allow running EC2 jobs locally) - #161393 (Configure LLM policy URL for triagebot) - #161409 (Add back `tests/rustdoc-gui/notable-trait.goml` test) - #161410 (Fix rustdoc remapping `documentation` scope documentation) - #161415 (Update expect messages in path docs to better follow guidelines)
Rollup of 25 pull requests Successful merges: - #152617 (std: implement `sleep_until` for Fuchsia) - #158934 (diagnostics: fix `let x: vec![]` suggestion pointing into stdlib) - #160995 (Tiny readability cleanups for initialization dataflow analyses) - #161277 (bootstrap: Move all non-module items out of the crate root) - #161295 (std: don't panic on long-elapsed deadlines for `sleep_until`) - #161368 (Double-word align `_Unwind_Exception`) - #161370 (Uplift rustfmt macro formatting fix) - #161378 (`FlowSensitiveAnalysis` cleanups) - #161420 (Bump wasm-component-ld to 0.5.30) - #161429 (Tighten allocator `Send`/`Sync` requirements for `Arc` in preparation for refactor) - #158032 (Offload expose device selection) - #158855 (Add `desktop` method to `CommandExt`) - #160299 (Stabilize `bool::toggle`) - #160842 (Apply `&[T]` visualizer to `*const [T]`, `*mut [T]` and `Box<[T]>`) - #160981 (Partially support building and locating wasm proc-macros) - #161199 (Add regression test for non lifetime binders) - #161212 (rust-installer/install-template.sh: catch cp(1) error when installing…) - #161302 (Add regression test for inconsistent import resolution from issue 147208) - #161329 (Add regression tests for a few fixed issues with E-needs-test) - #161330 (Add regression test for nested RPIT not an iterator ICE) - #161331 (Bitset simplifications) - #161340 (rustdoc: enable scrolling only on table/code) - #161351 (Cleanup: Move impl of `#[rustc_dump_object_lifetime_defaults]`) - #161355 (Add file path to some archive build errors) - #161373 (Allow running EC2 jobs locally)
Rollup of 25 pull requests Successful merges: - #152617 (std: implement `sleep_until` for Fuchsia) - #158934 (diagnostics: fix `let x: vec![]` suggestion pointing into stdlib) - #160995 (Tiny readability cleanups for initialization dataflow analyses) - #161277 (bootstrap: Move all non-module items out of the crate root) - #161295 (std: don't panic on long-elapsed deadlines for `sleep_until`) - #161368 (Double-word align `_Unwind_Exception`) - #161370 (Uplift rustfmt macro formatting fix) - #161378 (`FlowSensitiveAnalysis` cleanups) - #161420 (Bump wasm-component-ld to 0.5.30) - #161429 (Tighten allocator `Send`/`Sync` requirements for `Arc` in preparation for refactor) - #158032 (Offload expose device selection) - #158855 (Add `desktop` method to `CommandExt`) - #160299 (Stabilize `bool::toggle`) - #160842 (Apply `&[T]` visualizer to `*const [T]`, `*mut [T]` and `Box<[T]>`) - #160981 (Partially support building and locating wasm proc-macros) - #161199 (Add regression test for non lifetime binders) - #161212 (rust-installer/install-template.sh: catch cp(1) error when installing…) - #161302 (Add regression test for inconsistent import resolution from issue 147208) - #161329 (Add regression tests for a few fixed issues with E-needs-test) - #161330 (Add regression test for nested RPIT not an iterator ICE) - #161331 (Bitset simplifications) - #161340 (rustdoc: enable scrolling only on table/code) - #161351 (Cleanup: Move impl of `#[rustc_dump_object_lifetime_defaults]`) - #161355 (Add file path to some archive build errors) - #161373 (Allow running EC2 jobs locally)
Rollup merge of #152617 - joboet:fuchsia_sleep_until, r=nia-e std: implement `sleep_until` for Fuchsia Tracking issue: #113752 Unfortunately Fuchsia's `clock_nanosleep` is [only a stub](https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/third_party/ulib/musl/src/time/clock_nanosleep.c;l=4;drc=26e68e7948a6cc4a1c4a0c8eb19b7e4a2dc27153). The kernel's `zx_nanosleep` syscall however does exactly what's needed. I've done a few drive-by changes in the two outer commits, our uses of `zx_time_t` use the `zx_instant_mono_t` alias nowadays and the syscall table in the `sleep_until` documentation didn't mark the function names as code. @rustbot ping fuchsia
Tracking issue: #113752
Unfortunately Fuchsia's
clock_nanosleepis only a stub. The kernel'szx_nanosleepsyscall however does exactly what's needed.I've done a few drive-by changes in the two outer commits, our uses of
zx_time_tuse thezx_instant_mono_talias nowadays and the syscall table in thesleep_untildocumentation didn't mark the function names as code.@rustbot ping fuchsia