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

pub struct PidFd { /* fields omitted */ }
🔬 This is a nightly-only experimental API. (linux_pidfd #82971)
This is supported on Linux only.
Expand description

此类型表示引用进程的文件描述符。

PidFd 可以通过设置 Commandcreate_pidfd 上的相应选项来获得。随后,可以通过调用 pidfdtake_pidfdChild 中检索创建的 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");

// 当 `pidfd` 关闭时,文件描述符将被关闭。
Run

有关详细信息,请参见 pidfd_open(2) 的手册页。

Trait Implementations

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

借用文件描述符。 Read more

This is supported on Unix only.

提取原始文件描述符。 Read more

使用给定的格式化程序格式化该值。 Read more

执行转换。

执行转换。

This is supported on Unix only.

根据给定的原始文件描述符构造 Self 的新实例。 Read more

This is supported on Unix only.

消费这个对象,返回原始的底层文件描述符。 Read more

Auto Trait Implementations

Blanket Implementations

获取 selfTypeIdRead more

从拥有的值中一成不变地借用。 Read more

从拥有的值中借用。 Read more

执行转换。

执行转换。

发生转换错误时返回的类型。

执行转换。

发生转换错误时返回的类型。

执行转换。