fix(unix): avoid Linux-only errno symbol in process liveness check#1
Merged
one-bit merged 1 commit intoone-bit:mainfrom Feb 26, 2026
Merged
Conversation
- replace Linux-only libc::__errno_location usage - use std::io::Error::last_os_error for EPERM detection on Unix
There was a problem hiding this comment.
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 portablestd::io::Error::last_os_error().raw_os_error()for errno checking afterkill(pid, 0)system call
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Owner
|
Hi @ramarivera thank you for your PR. I'll test this on my mac and I'll merge it asap. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_aliveused: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 libcFix
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 withEPERM, process is treated as alive.Validation
Ran locally on macOS (aarch64-apple-darwin):
cargo test(25 tests + doc tests): passcargo install --path . --root <temp>: passmnemoria --versionreturnsmnemoria 0.3.3🤖 This content was generated with AI assistance using GPT-5 Codex.