Skip to content

Commit 89a485e

Browse files
authored
Fix compilation on armv7-unknown-freebsd (#518)
* Fix compilation on armv7-unknown-freebsd Use `time_t::MAX` to avoid depending on the relationship between `time_t` and `c_long`. * Silence the deprecation warning about `time_t`.
1 parent a5a090c commit 89a485e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ jobs:
203203
- run: cargo check -Z build-std --target mips64-openwrt-linux-musl --all-targets --features=all-apis
204204
- run: cargo check -Z build-std --target x86_64-unknown-dragonfly --all-targets --features=all-apis
205205
- run: cargo check -Z build-std --target sparc-unknown-linux-gnu --all-targets --features=all-apis
206+
- run: cargo check -Z build-std --target armv7-unknown-freebsd --all-targets --features=all-apis
206207
# Omit --all-targets on haiku because not all the tests build yet.
207208
- run: cargo check -Z build-std --target x86_64-unknown-haiku --features=all-apis
208209
# x86_64-uwp-windows-msvc isn't currently working.

src/backend/libc/net/syscalls.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -555,11 +555,12 @@ pub(crate) mod sockopt {
555555
return Err(io::Errno::INVAL);
556556
}
557557

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

564565
// `subsec_micros` rounds down, so we use `subsec_nanos` and
565566
// manually round up.

0 commit comments

Comments
 (0)