Struct std::os::linux::process::PidFd[][src]

pub struct PidFd {
    inner: FileDesc,
}
🔬 This is a nightly-only experimental API. (linux_pidfd #82971)
This is supported on Linux only.
Expand description

This type represents a file descriptor that refers to a process.

A PidFd can be obtained by setting the corresponding option on Command with create_pidfd. Subsequently, the created pidfd can be retrieved from the Child by calling pidfd or take_pidfd.

Example:

#![feature(linux_pidfd)]
use std::os::linux::process::{CommandExt, ChildExt};
use std::process::Command;

let mut child = Command::new("echo")
    .create_pidfd(true)
    .spawn()
    .expect("Failed to spawn child");

let pidfd = child
    .take_pidfd()
    .expect("Failed to retrieve pidfd");

// The file descriptor will be closed when `pidfd` is dropped.
Run

Refer to the man page of pidfd_open(2) for further details.

Fields

inner: FileDesc
🔬 This is a nightly-only experimental API. (linux_pidfd #82971)

Trait Implementations

🔬 This is a nightly-only experimental API. (io_safety #87074)
This is supported on Unix only.

Borrows the file descriptor. Read more

This is supported on Unix only.

Extracts the raw file descriptor. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

This is supported on Unix only.

Constructs a new instance of Self from the given raw file descriptor. Read more

This is supported on Unix only.

Consumes this object, returning the raw underlying file descriptor. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.