fix(rvlite): use platform-specific errno on macOS/BSD (fixes #174)

rvlite's writer_lease.rs used __errno_location (Linux libc) under a
generic #[cfg(unix)] guard, causing link failures on macOS where the
equivalent is __error. Split the extern and wrapper into separate
#[cfg(target_os)] blocks matching the pattern already used in
rvf-runtime/src/locking.rs.

Closes #174

Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
rUv 2026-02-20 21:38:48 +00:00
parent b720b380f7
commit 7c5acceda5

View file

@ -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::*;