-
Notifications
You must be signed in to change notification settings - Fork 676
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
Added FreeBSD's SCM_REALTIME and SCM_MONOTONIC into sys::socket::ControlMessageOwned #2187
Conversation
Regarding the changelog entry, I noticed there isn't a section for upcoming changes. Should I create one? |
Yep, a changelog entry is needed, but we don't edit that |
This looks good @recatek . Would it be possible to add a test too? |
…imestamp control messages for FreeBSD
Added tests for the new enum and the two new control messages. |
Not sure what happened there in that |
Well, that CI error does not seem to be related to this PR
I can reproduce it on my Linux host: $ cargo +nightly -v
cargo 1.76.0-nightly (71cd3a926 2023-11-20)
$ cargo new hello
$ cd hello
$ cargo +nightly b -Zbuild-std --target armv7-unknown-linux-uclibceabihf
Compiling compiler_builtins v0.1.103
Compiling core v0.0.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
Compiling libc v0.2.150
Compiling memchr v2.5.0
Compiling std v0.0.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std)
Compiling rustc-std-workspace-core v1.99.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
Compiling alloc v0.0.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc)
Compiling cfg-if v1.0.0
Compiling adler v1.0.2
Compiling rustc-demangle v0.1.23
Compiling unwind v0.0.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/unwind)
Compiling rustc-std-workspace-alloc v1.99.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-alloc)
Compiling panic_abort v0.0.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_abort)
Compiling panic_unwind v0.0.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_unwind)
Compiling gimli v0.28.0
Compiling hashbrown v0.14.2
Compiling object v0.32.1
Compiling std_detect v0.1.5 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/stdarch/crates/std_detect)
Compiling miniz_oxide v0.7.1
Compiling addr2line v0.21.0
error[E0599]: no method named `si_pid` found for struct `siginfo_t` in the current scope
--> /home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/process/process_unix.rs:879:33
|
879 | if unsafe { siginfo.si_pid() } == 0 {
| ^^^^^^ method not found in `siginfo_t`
error[E0599]: no method named `si_status` found for struct `siginfo_t` in the current scope
--> /home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/process/process_unix.rs:917:39
|
917 | let status = unsafe { siginfo.si_status() };
| ^^^^^^^^^ method not found in `siginfo_t`
For more information about this error, try `rustc --explain E0599`.
error: could not compile `std` (lib) due to 2 previous errors Though I can not reproduce it if I choose the target to be $ cargo +nightly b -Zbuild-std --target x86_64-unknown-linux-gnu
Compiling compiler_builtins v0.1.103
Compiling core v0.0.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
Compiling libc v0.2.150
Compiling memchr v2.5.0
Compiling std v0.0.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std)
Compiling rustc-std-workspace-core v1.99.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
Compiling alloc v0.0.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc)
Compiling cfg-if v1.0.0
Compiling adler v1.0.2
Compiling rustc-demangle v0.1.23
Compiling unwind v0.0.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/unwind)
Compiling rustc-std-workspace-alloc v1.99.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-alloc)
Compiling panic_abort v0.0.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_abort)
Compiling panic_unwind v0.0.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/panic_unwind)
Compiling gimli v0.28.0
Compiling std_detect v0.1.5 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/stdarch/crates/std_detect)
Compiling miniz_oxide v0.7.1
Compiling object v0.32.1
Compiling hashbrown v0.14.2
Compiling addr2line v0.21.0
Compiling proc_macro v0.0.0 (/home/steve/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/proc_macro)
Compiling hello v0.1.0 (/tmp/hello)
Finished dev [unoptimized + debuginfo] target(s) in 8.37s |
Hi @recatek, you need to handle that CI failure, wrap unsafe functions in unsafe blocks. Though it does confuse me why the check for this PR actually passed then it failed in the merge queue |
Looks like we're good now. Got caught up in upstream changes. |
What does this PR do
Adds FreeBSD's SCM_REALTIME and SCM_MONOTONIC into sys::socket::ControlMessageOwned to read socket control messages after setting SO_TS_CLOCK to either SO_TS_REALTIME or SO_TS_MONOTONIC. Note that this does not also support SO_TS_BINTIME yet as that requires a new data structure. See man setsockopt for FreeBSD for more info on these settings.
Also adds a proper enum as a parameter to sockopt::TsClock for choosing which clock to timestamp with. Previously this took a raw i32 and required libc as a dependency to properly configure.
Resolves #2186.
Checklist:
CONTRIBUTING.md