Skip to content
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

Fix compilation on armv7-unknown-freebsd #518

Merged
merged 2 commits into from Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Expand Up @@ -203,6 +203,7 @@ jobs:
- run: cargo check -Z build-std --target mips64-openwrt-linux-musl --all-targets --features=all-apis
- run: cargo check -Z build-std --target x86_64-unknown-dragonfly --all-targets --features=all-apis
- run: cargo check -Z build-std --target sparc-unknown-linux-gnu --all-targets --features=all-apis
- run: cargo check -Z build-std --target armv7-unknown-freebsd --all-targets --features=all-apis
# Omit --all-targets on haiku because not all the tests build yet.
- run: cargo check -Z build-std --target x86_64-unknown-haiku --features=all-apis
# x86_64-uwp-windows-msvc isn't currently working.
Expand Down
11 changes: 6 additions & 5 deletions src/backend/libc/net/syscalls.rs
Expand Up @@ -555,11 +555,12 @@ pub(crate) mod sockopt {
return Err(io::Errno::INVAL);
}

let tv_sec = timeout.as_secs().try_into();
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
let tv_sec = tv_sec.unwrap_or(c::c_long::MAX);
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
let tv_sec = tv_sec.unwrap_or(i64::MAX);
// Rust's musl libc bindings deprecated `time_t` while they
// transition to 64-bit `time_t`. What we want here is just
// "whatever type `timeval`'s `tv_sec` is", so we're ok using
// the deprecated type.
#[allow(deprecated)]
let tv_sec = timeout.as_secs().try_into().unwrap_or(c::time_t::MAX);

// `subsec_micros` rounds down, so we use `subsec_nanos` and
// manually round up.
Expand Down