Skip to content

fix(unix): avoid Linux-only errno symbol in process liveness check#1

Merged
one-bit merged 1 commit intoone-bit:mainfrom
ramarivera:codex/fix-darwin-errno
Feb 26, 2026
Merged

fix(unix): avoid Linux-only errno symbol in process liveness check#1
one-bit merged 1 commit intoone-bit:mainfrom
ramarivera:codex/fix-darwin-errno

Conversation

@ramarivera
Copy link
Contributor

Summary

This fixes a macOS compile/install failure caused by using a Linux-specific libc symbol in the Unix process liveness path.

Problem

is_process_alive used:

  • libc::__errno_location()

That symbol is Linux-specific and is unavailable on Darwin, causing install/build failure on macOS with:

  • error[E0425]: cannot find function __errno_location in crate libc

Fix

Use a portable errno read on Unix:

  • std::io::Error::last_os_error().raw_os_error() == Some(libc::EPERM)

Behavior is unchanged: if kill(pid, 0) fails with EPERM, process is treated as alive.

Validation

Ran locally on macOS (aarch64-apple-darwin):

  1. cargo test (25 tests + doc tests): pass
  2. cargo install --path . --root <temp>: pass
  3. Installed binary executes: mnemoria --version returns mnemoria 0.3.3

🤖 This content was generated with AI assistance using GPT-5 Codex.

- replace Linux-only libc::__errno_location usage

- use std::io::Error::last_os_error for EPERM detection on Unix
Copilot AI review requested due to automatic review settings February 22, 2026 10:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a macOS compilation failure by replacing a Linux-specific errno access function with a portable alternative. The is_process_alive function used libc::__errno_location(), which is only available on Linux and caused build failures on macOS with the error "cannot find function __errno_location in crate libc".

Changes:

  • Replaced Linux-specific libc::__errno_location() with portable std::io::Error::last_os_error().raw_os_error() for errno checking after kill(pid, 0) system call

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@one-bit
Copy link
Owner

one-bit commented Feb 26, 2026

Hi @ramarivera thank you for your PR. I'll test this on my mac and I'll merge it asap.

@one-bit one-bit merged commit b2c87e3 into one-bit:main Feb 26, 2026
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants