View all comments
Feature gate: #![feature(linux_pidfd)]
This is a tracking issue for Linux-specific extension methods allowing to obtain process file descriptors for processes spawned with the standard Command API.
Public API
// std::os::linux::process
pub struct PidFd;
impl PidFd {
pub fn kill(&self) -> Result<()> {...}
pub fn wait(&self) -> Result<ExitStatus> {...}
pub fn try_wait(&self) -> Result<Option<ExitStatus>> {...}
}
impl AsRawFd for PidFd {}
impl FromRawFd for PidFd {}
impl IntoRawFd for PidFd {}
// sealed trait, implemented for std::process::Child
pub trait ChildExt {
fn pidfd(&self) -> Result<&PidFd>;
fn into_pidfd(self) -> Result<PidFd, Self>;
}
// sealed trait, implemented for std::process::Command
pub trait CommandExt {
fn create_pidfd(&mut self, val: bool) -> &mut process::Command;
}
Steps / History
Unresolved Questions
View all comments
Feature gate:
#![feature(linux_pidfd)]This is a tracking issue for Linux-specific extension methods allowing to obtain process file descriptors for processes spawned with the standard Command API.
Public API
Steps / History
Unresolved Questions
clone3means we can't safely call libc in the child: cargo 1.56 beta hang when run inside Gentoo's sandbox #89522 (comment)pidfd_openmay work, but it has conditions on avoiding pid-recycling races.Child::pidfd(&self)be removed? It can lead toChild::waitreturning errors instead of a saved exit status ifPidFd::waitobtains the exit status first, which may be surprising behavior.