From ce51d6e41c8fd09658319c67a1836e14013bdd5d Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 3 Jan 2026 17:22:10 +0100 Subject: [PATCH] hurd: Fix l_type and l_whence types on hurd x86, they are set to int types: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/mach/hurd/i386/bits/types/struct_flock.h --- src/process/types.rs | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/process/types.rs b/src/process/types.rs index 0adb47ec6..8b3241908 100644 --- a/src/process/types.rs +++ b/src/process/types.rs @@ -30,12 +30,25 @@ pub struct Flock { #[cfg(not(target_os = "horizon"))] impl Flock { pub(crate) const unsafe fn from_raw_unchecked(raw_fl: c::flock) -> Self { - Self { - start: raw_fl.l_start as _, - length: raw_fl.l_len as _, - pid: Pid::from_raw(raw_fl.l_pid), - typ: transmute::(raw_fl.l_type), - offset_type: transmute::(raw_fl.l_whence), + #[cfg(not(all(target_os = "hurd", target_arch = "x86")))] + { + Self { + start: raw_fl.l_start as _, + length: raw_fl.l_len as _, + pid: Pid::from_raw(raw_fl.l_pid), + typ: transmute::(raw_fl.l_type), + offset_type: transmute::(raw_fl.l_whence), + } + } + #[cfg(all(target_os = "hurd", target_arch = "x86"))] + { + Self { + start: raw_fl.l_start as _, + length: raw_fl.l_len as _, + pid: Pid::from_raw(raw_fl.l_pid), + typ: transmute::(raw_fl.l_type), + offset_type: transmute::(raw_fl.l_whence), + } } } @@ -68,7 +81,8 @@ impl From for Flock { /// [`fcntl_getlk`]: crate::process::fcntl_getlk() #[cfg(not(target_os = "horizon"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] -#[repr(i16)] +#[cfg_attr(not(all(target_os = "hurd", target_arch = "x86")), repr(i16))] +#[cfg_attr(all(target_os = "hurd", target_arch = "x86"), repr(i32))] pub enum FlockType { /// `F_RDLCK` ReadLock = c::F_RDLCK as _, @@ -83,7 +97,8 @@ pub enum FlockType { /// [`fcntl_getlk`]: crate::process::fcntl_getlk() #[cfg(not(target_os = "horizon"))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] -#[repr(i16)] +#[cfg_attr(not(all(target_os = "hurd", target_arch = "x86")), repr(i16))] +#[cfg_attr(all(target_os = "hurd", target_arch = "x86"), repr(i32))] pub enum FlockOffsetType { /// `F_SEEK_SET` Set = c::SEEK_SET as _,