diff --git a/.github/workflows/build-rvf-node.yml b/.github/workflows/build-rvf-node.yml index ac6be839..f833e68f 100644 --- a/.github/workflows/build-rvf-node.yml +++ b/.github/workflows/build-rvf-node.yml @@ -72,10 +72,20 @@ jobs: run: npm install -g @napi-rs/cli@^2.18.0 - name: Build rvf-node native module + shell: bash working-directory: crates/rvf/rvf-node - run: napi build --platform --release --target ${{ matrix.settings.target }} + run: | + napi build --platform --release --target ${{ matrix.settings.target }} + # NAPI CLI may output as index..node; rename to rvf-node..node + BUILT=$(ls -1 *.*.node 2>/dev/null | head -1) + EXPECTED="rvf-node.${{ matrix.settings.platform }}.node" + if [ -n "$BUILT" ] && [ "$BUILT" != "$EXPECTED" ]; then + mv -v "$BUILT" "$EXPECTED" + fi env: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc + CARGO_TARGET_AARCH64_APPLE_DARWIN_RUSTFLAGS: "-C link-arg=-undefined -C link-arg=dynamic_lookup" + CARGO_TARGET_X86_64_APPLE_DARWIN_RUSTFLAGS: "-C link-arg=-undefined -C link-arg=dynamic_lookup" - name: List built artifacts shell: bash diff --git a/crates/rvf/rvf-runtime/src/locking.rs b/crates/rvf/rvf-runtime/src/locking.rs index eca03b2f..0e882159 100644 --- a/crates/rvf/rvf-runtime/src/locking.rs +++ b/crates/rvf/rvf-runtime/src/locking.rs @@ -276,9 +276,18 @@ 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; +} + /// Permission denied errno -- process exists but belongs to another user. #[cfg(unix)] const EPERM: i32 = 1; @@ -289,11 +298,17 @@ fn libc_kill(pid: i32, sig: i32) -> i32 { } /// Get a pointer to the thread-local errno value. -#[cfg(unix)] +#[cfg(any(target_os = "linux", target_os = "android"))] fn libc_errno() -> *mut i32 { unsafe { __errno_location() } } +/// Get a pointer to the thread-local errno value (macOS/BSD). +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))] +fn libc_errno() -> *mut i32 { + unsafe { __error() } +} + /// Simple CRC32 (not CRC32C) for lock file checksumming. fn simple_crc32(data: &[u8]) -> u32 { let mut crc: u32 = 0xFFFFFFFF;