Finishing clone3 clean up
This commit is contained in:
parent
1ee773e242
commit
df0c9c37c1
@ -149,8 +149,7 @@ pub trait CommandExt: Sealed {
|
|||||||
/// The pidfd can be retrieved from the child with [`pidfd`] or [`take_pidfd`].
|
/// The pidfd can be retrieved from the child with [`pidfd`] or [`take_pidfd`].
|
||||||
///
|
///
|
||||||
/// A pidfd will only be created if it is possible to do so
|
/// A pidfd will only be created if it is possible to do so
|
||||||
/// in a guaranteed race-free manner (e.g. if the `clone3` system call
|
/// in a guaranteed race-free manner. Otherwise, [`pidfd`] will return an error.
|
||||||
/// is supported). Otherwise, [`pidfd`] will return an error.
|
|
||||||
///
|
///
|
||||||
/// If a pidfd has been successfully created and not been taken from the `Child`
|
/// If a pidfd has been successfully created and not been taken from the `Child`
|
||||||
/// then calls to `kill()`, `wait()` and `try_wait()` will use the pidfd
|
/// then calls to `kill()`, `wait()` and `try_wait()` will use the pidfd
|
||||||
|
@ -147,8 +147,7 @@ impl Command {
|
|||||||
#[cfg(not(target_os = "linux"))]
|
#[cfg(not(target_os = "linux"))]
|
||||||
let pidfd = -1;
|
let pidfd = -1;
|
||||||
|
|
||||||
// Safety: We obtained the pidfd from calling `clone3` with
|
// Safety: We obtained the pidfd (on Linux) using SOCK_SEQPACKET, so it's valid.
|
||||||
// `CLONE_PIDFD` so it's valid an otherwise unowned.
|
|
||||||
let mut p = unsafe { Process::new(pid, pidfd) };
|
let mut p = unsafe { Process::new(pid, pidfd) };
|
||||||
let mut bytes = [0; 8];
|
let mut bytes = [0; 8];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user