Skip to content

uucore: replace unsafe libc calls with safe nix crate wrappers#11156

Merged
sylvestre merged 1 commit intouutils:mainfrom
mattsu2020:process.rs
Feb 28, 2026
Merged

uucore: replace unsafe libc calls with safe nix crate wrappers#11156
sylvestre merged 1 commit intouutils:mainfrom
mattsu2020:process.rs

Conversation

@mattsu2020
Copy link
Contributor

Replace direct unsafe libc function calls with safe nix crate wrappers for process management functions.
This improves code safety and maintainability by leveraging nix's type-safe abstractions for system calls like geteuid, getpgrp, getsid, and signal handling.
The changes maintain identical functionality while eliminating unsafe code blocks and providing better error handling.

Replace direct unsafe libc function calls with safe nix crate wrappers for process management functions. This improves code safety and maintainability by leveraging nix's type-safe abstractions for system calls like geteuid, getpgrp, getsid, and signal handling. The changes maintain identical functionality while eliminating unsafe code blocks and providing better error handling.
@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/tail/follow-name (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)
Skipping an intermittent issue tests/date/resolution (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/printf/printf-surprise is now being skipped but was previously passing.
Congrats! The gnu test tests/expand/bounded-memory is now passing!
Note: The gnu test tests/env/env-signal-handler was skipped on 'main' but is now failing.

@oech3
Copy link
Contributor

oech3 commented Feb 28, 2026

@mattsu2020 Are you inrerested in replacing nix and libc deps with rustix at least on Linux?

@mattsu2020
Copy link
Contributor Author

@mattsu2020 Are you inrerested in replacing nix and libc deps with rustix at least on Linux?

I thought nix was the standard, but it seems rustix is also in use.
Since rustix is newer, replacing it with that seems like a good idea.

@oech3
Copy link
Contributor

oech3 commented Feb 28, 2026

I think rustix is wrapping libc at many case, but using syscall directry at Linux for perf.

@sylvestre
Copy link
Contributor

having less unsafe is ideal :)

@sylvestre sylvestre merged commit 6100aee into uutils:main Feb 28, 2026
159 checks passed
@mattsu2020 mattsu2020 deleted the process.rs branch February 28, 2026 12:54
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