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 _,