Skip to content

kill: replace nix::sys::signal with rustix::process#12326

Open
mattsu2020 wants to merge 2 commits into
uutils:mainfrom
mattsu2020:kill_rustix
Open

kill: replace nix::sys::signal with rustix::process#12326
mattsu2020 wants to merge 2 commits into
uutils:mainfrom
mattsu2020:kill_rustix

Conversation

@mattsu2020
Copy link
Copy Markdown
Contributor

@mattsu2020 mattsu2020 commented May 16, 2026

Summary

  • Replace nix::sys::signal usage in the kill utility with rustix::process APIs as part of the migration away from nix (see chore(deps): update rust crate clap to v4.5.30 #7317)
  • Use rustix's explicit per-case APIs:
    • kill_process for positive PIDs
    • kill_process_group for negative PIDs
    • kill_current_process_group for PID 0
    • test_kill_* variants for signal 0
  • Keep a small raw libc::kill path for libc realtime signals (SIGRTMIN..=SIGRTMAX on Linux/Android), because rustix's Signal contract does not allow libc-reserved realtime signal values to be used for sending signals
  • Guard against i32::MIN overflow with checked_neg() when negating negative PIDs
  • Use safe Pid::from_raw() with expect() instead of Pid::from_raw_unchecked

Tests

  • cargo build -p uu_kill
  • cargo test -p coreutils --test tests --features kill -- test_kill_ (37 passed on macOS)

Note: the realtime signal send test is Linux/Android-only and is therefore not run on macOS.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 16, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/timeout/timeout-group (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 16, 2026

Merging this PR will not alter performance

✅ 268 untouched benchmarks
⏩ 97 skipped benchmarks1


Comparing mattsu2020:kill_rustix (e6ac11c) with main (8e4c21b)

Open in CodSpeed

Footnotes

  1. 97 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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.

1 participant