Struct tracing_core::stdlib::os::linux::process::PidFd

source ยท
pub struct PidFd {
    inner: FileDesc,
}
๐Ÿ”ฌThis is a nightly-only experimental API. (linux_pidfd #82971)
Available 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.

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ยง

sourceยง

impl AsFd for PidFd

sourceยง

fn as_fd(&self) -> BorrowedFd<'_>

Borrows the file descriptor. Read more
sourceยง

impl AsRawFd for PidFd

sourceยง

fn as_raw_fd(&self) -> i32

Extracts the raw file descriptor. Read more
sourceยง

impl Debug for PidFd

sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
sourceยง

impl From<OwnedFd> for PidFd

sourceยง

fn from(fd: OwnedFd) -> PidFd

Converts to this type from the input type.
sourceยง

impl From<PidFd> for OwnedFd

sourceยง

fn from(pid_fd: PidFd) -> OwnedFd

Converts to this type from the input type.
sourceยง

impl FromRawFd for PidFd

sourceยง

unsafe fn from_raw_fd(fd: i32) -> PidFd

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

impl IntoRawFd for PidFd

sourceยง

fn into_raw_fd(self) -> i32

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

Auto Trait Implementationsยง

Blanket Implementationsยง

sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
sourceยง

impl<T> From<T> for T

sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

ยง

type Error = Infallible

The type returned in the event of a conversion error.
sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

ยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.