diff options
author | bors <bors@rust-lang.org> | 2022-12-21 12:54:30 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2022-12-21 12:54:30 +0000 |
commit | c59ca735304319dd4face349f49fb77f2164b544 (patch) | |
tree | d3e0cae2f2f21b4caf17e19d52b39e69967c724c /src | |
parent | 45b431a79ec7f72c245fb0631f2d05a9f16ca5a8 (diff) | |
parent | 88d6a1fd9b4b62729bd55a76e727f5f1d0aeef20 (diff) | |
download | rust-libc-c59ca735304319dd4face349f49fb77f2164b544.tar.gz |
Auto merge of #3041 - devnexen:linux_kernel_version, r=JohnTitor
adding KERNEL_VERSION macro for linux.
Diffstat (limited to 'src')
-rw-r--r-- | src/unix/linux_like/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 8e738d87b8..e2e73b3300 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1615,6 +1615,14 @@ safe_f! { pub {const} fn IPTOS_ECN(x: u8) -> u8 { x & ::IPTOS_ECN_MASK } + + #[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, + } + } } extern "C" { |