Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ targets = [
"armv7r-none-eabihf",
# FIXME(hexagon): excluded due to duplicate symbol errors
# "hexagon-unknown-linux-musl",
"i586-pc-windows-msvc",
"i586-unknown-linux-gnu",
"i586-unknown-linux-musl",
"i686-linux-android",
Expand Down
1 change: 0 additions & 1 deletion ci/verify-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ armebv7r-none-eabihf \
armv7-wrs-vxworks-eabihf \
armv7r-none-eabi \
armv7r-none-eabihf \
i586-pc-windows-msvc \
i686-pc-windows-msvc \
i686-unknown-haiku \
i686-unknown-netbsd \
Expand Down
13 changes: 7 additions & 6 deletions libc-test/test/linux_kernel_version.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
//! Compare libc's KERNEL_VERSION macro against a specific kernel version.

#[cfg(
target_os = "linux",
)]
#[cfg(target_os = "linux")]
mod t {
use libc;

#[test]
fn test_kernel_version() {
unsafe {
assert_eq!(libc::KERNEL_VERSION(6, 0, 0), 393216);
}
assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, 0) }, 393216);
// Check that the patch level saturates
assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, 255) }, 393471);
assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, 256) }, 393471);
assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, 300) }, 393471);
assert_eq!(unsafe { libc::KERNEL_VERSION(6, 0, u32::MAX) }, 393471);
}
}
6 changes: 1 addition & 5 deletions src/unix/linux_like/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1755,11 +1755,7 @@ safe_f! {

#[allow(ellipsis_inclusive_range_patterns)]
pub {const} fn KERNEL_VERSION(a: u32, b: u32, c: u32) -> u32 {
((a << 16) + (b << 8))
+ match c {
0..=255 => c,
_ => 255,
}
((a << 16) + (b << 8)) + if c > 255 { 255 } else { c }
}
}

Expand Down
Loading