Skip to content

Add pidfd-based implementation of tokio::process #4016

Closed
@Aaron1011

Description

@Aaron1011

Is your feature request related to a problem? Please describe.
The current unix implementation of tokio::process relies on handling SIGCHLD signals. This requires that the corresponding signal handler be properly set up - if another library in the process modifies it, it will be impossible to properly wait on child processes.

Describe the solution you'd like
On recent versions of Linux, it's possible to use pidfds to avoid this problem. Using the recently merged libstd support (rust-lang/rust#81825), we can create a pidfd at the same time that a child is spawned. The pidfd can then be waited on using epoll or select (with an optional timeout).

If the running kernel version does not support pidfds, we can fall back to the existing unix implementation.

Describe alternatives you've considered
Do nothing, and continue to use the unix implementation in all cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tokioArea: The main tokio crateC-feature-requestCategory: A feature request.M-processModule: tokio/process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions