Skip to content

Conversation

@asomers
Copy link
Contributor

@asomers asomers commented Jan 8, 2026

FreeBSD's procdesc(4)1 is a file-descriptor-oriented interface to process signalling and control. It's a race-free replacement for fork() and kill(), and it's compatible with capsicum2.

Its drawbacks are that there isn't yet a way to use it with posix_spawn, and there's no capsicum-compatible way to use it with wait(). But it's still sufficient for the linux_pidfd feature.

r? @the8472
Issue #82971

Footnotes

  1. https://man.freebsd.org/cgi/man.cgi?query=procdesc

  2. https://man.freebsd.org/cgi/man.cgi?query=capsicum

@rustbot rustbot added O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 8, 2026
@asomers
Copy link
Contributor Author

asomers commented Jan 8, 2026

I have two concerns with this PR:

  • The contents are library/std/src/os/freebsd/process.rs and library/std/src/os/linux/process.rs are completely identical except for a few documentation bits. Is there a way to share that code rather than duplicate it? Maybe library/std/src/os/procdesc/process.rs?
  • There is one behavioral difference. If you wait() on the same child multiple times, on Linux 6.15+ it will return the status each time. On FreeBSD and older Linux, second and subsequent calls will return ECHILD.

@rust-log-analyzer

This comment has been minimized.

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 14, 2026

☔ The latest upstream changes (presumably #151107) made this pull request unmergeable. Please resolve the merge conflicts.

FreeBSD's procdesc(4)[^1] is a file-descriptor-oriented interface to
process signalling and control.  It's a race-free replacement for fork()
and kill(), and it's compatible with capsicum[^2].

Its drawbacks are that there isn't yet a way to use it with posix_spawn,
and there's no capsicum-compatible way to use it with wait().  But it's
still sufficient for the linux_pidfd feature.

[^1]: https://man.freebsd.org/cgi/man.cgi?query=procdesc
[^2]: https://man.freebsd.org/cgi/man.cgi?query=capsicum
@rustbot
Copy link
Collaborator

rustbot commented Jan 14, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-unix Operating system: Unix-like S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants