From 44e1eb70843d6a136eb9d08bc26026691bb22353 Mon Sep 17 00:00:00 2001 From: Harald van Dijk Date: Sun, 7 Feb 2021 13:32:04 +0000 Subject: [PATCH] Fix syscall definitions for x86_64-unknown-linux-gnux32. libc::syscall takes a c_long as in x86_64-unknown-linux-gnu [1], but c_long is i32 rather than i64 [2]. The syscall numbers include 0x40000000 as an indicator of the ABI [2]. [1]: rust-lang/libc:src/unix/linux_like/linux/mod.rs [2]: rust-lang/libc:src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs --- src/nr.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/nr.rs b/src/nr.rs index d51de90..488f364 100644 --- a/src/nr.rs +++ b/src/nr.rs @@ -61,11 +61,16 @@ pub const CAPGET: i32 = 184; #[cfg(target_arch = "x86")] pub const CAPSET: i32 = 185; -#[cfg(target_arch = "x86_64")] +#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] pub const CAPGET: i64 = 125; -#[cfg(target_arch = "x86_64")] +#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] pub const CAPSET: i64 = 126; +#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] +pub const CAPGET: i32 = 0x40000000 + 125; +#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] +pub const CAPSET: i32 = 0x40000000 + 126; + #[cfg(target_arch = "aarch64")] pub const CAPGET: i64 = 90; #[cfg(target_arch = "aarch64")]