diff --git a/crates/rvlite/src/storage/writer_lease.rs b/crates/rvlite/src/storage/writer_lease.rs index 87bb6a93a..e3c7f4cab 100644 --- a/crates/rvlite/src/storage/writer_lease.rs +++ b/crates/rvlite/src/storage/writer_lease.rs @@ -322,19 +322,33 @@ fn is_pid_alive(pid: u32) -> bool { #[cfg(unix)] extern "C" { fn kill(pid: i32, sig: i32) -> i32; +} + +#[cfg(any(target_os = "linux", target_os = "android"))] +extern "C" { fn __errno_location() -> *mut i32; } +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))] +extern "C" { + fn __error() -> *mut i32; +} + #[cfg(unix)] unsafe fn libc_kill(pid: i32, sig: i32) -> i32 { unsafe { kill(pid, sig) } } -#[cfg(unix)] +#[cfg(any(target_os = "linux", target_os = "android"))] unsafe fn errno_location() -> *mut i32 { unsafe { __errno_location() } } +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))] +unsafe fn errno_location() -> *mut i32 { + unsafe { __error() } +} + #[cfg(test)] mod tests { use super::*;