Skip to content

Commit

Permalink
adding KERNEL_VERSION macro for linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Dec 20, 2022
1 parent 6a5c07f commit 3e5c258
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions libc-test/semver/linux.txt
Expand Up @@ -1146,6 +1146,7 @@ J1939_PGN_ADDRESS_COMMANDED
J1939_PGN_MAX
J1939_PGN_PDU1_MAX
J1939_PGN_REQUEST
KERNEL_VERSION
KEYCTL_ASSUME_AUTHORITY
KEYCTL_CHOWN
KEYCTL_CLEAR
Expand Down
7 changes: 7 additions & 0 deletions src/unix/linux_like/mod.rs
Expand Up @@ -1615,6 +1615,13 @@ safe_f! {
pub {const} fn IPTOS_ECN(x: u8) -> u8 {
x & ::IPTOS_ECN_MASK
}

pub {const} fn KERNEL_VERSION(a: u32, b: u32, c: u32) -> u32 {
((a << 16) + (b << 8)) + match c {
0 ..= 255 => c,
_ => 255,
}
}
}

extern "C" {
Expand Down

0 comments on commit 3e5c258

Please sign in to comment.