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 dependency with rustix in the kill utility, continuing the ongoing effort to migrate away from nix (see chore(deps): update rust crate clap to v4.5.30 #7317)
  • Use rustix's explicitly typed per-case kill APIs (kill_process, kill_process_group, kill_current_process_group) and their test_kill_* variants for signal 0 (EXIT), instead of nix's single signal::kill(pid, Option<Signal>) function
  • Dispatch based on pid sign (>0 process, <0 process group, =0 current process group) and signal value (=0 uses test_kill_* variants)
  • 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

Test plan

  • All 33 existing kill integration tests pass (cargo test -p coreutils --test tests --features kill -- test_kill_)
  • Build passes with no warnings (cargo build -p uu_kill)

Replace nix dependency with rustix in the kill utility. The migration
uses rustix's explicitly typed per-case kill APIs (kill_process,
kill_process_group, kill_current_process_group) and their test_kill_*
variants for signal 0 (EXIT), instead of nix's single signal::kill
function with Option<Signal>.

Key changes:
- Dispatch based on pid sign (>0 process, <0 process group, =0 current
  process group) and signal value (=0 uses test_kill_* variants)
- Use Pid::from_raw (safe) instead of Pid::from_raw_unchecked
- Guard against i32::MIN overflow with checked_neg()
- Use Signal::from_raw_unchecked only for validated signal numbers
@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/misc/tty-eof. tests/misc/tty-eof is passing on 'main'. Maybe you have to rebase?
Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/retry (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/cp/link-heap is now being skipped but was previously passing.
Congrats! The gnu test tests/pr/bounded-memory is now passing!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 16, 2026

Merging this PR will improve performance by 13.71%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
✅ 315 untouched benchmarks
⏩ 46 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory cp_recursive_deep_tree[(120, 4)] 699.2 KB 562.5 KB +24.31%
Simulation ls_recursive_balanced_tree[(6, 4, 15)] 50.9 ms 48.9 ms +4.01%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing mattsu2020:kill_rustix (22377dc) with main (d09f351)

Open in CodSpeed

Footnotes

  1. 46 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