pub enum Fd {
ReadPipe,
WritePipe,
Inherit,
ReadNull,
WriteNull,
Fd(Closing),
}Expand description
An enumeration that is used to configure non-stdio file descriptors. It differs from stdio one because we must differentiate from readable and writable file descriptors for things open by the library
The enumeration members might be non-stable, it’s better to use one of the constructors to create an instance
Variants§
ReadPipe
This fd is a reading end of a pipe
WritePipe
This fd is a writing end of a pipe
Inherit
This fd is inherited from parent (current) process
ReadNull
This fd is redirected from /dev/null
WriteNull
This fd is redirected to /dev/null
Fd(Closing)
This is fd passed by application (and closed by unshare)
Implementations§
Source§impl Fd
impl Fd
Sourcepub fn piped_read() -> Fd
pub fn piped_read() -> Fd
Create a pipe so that child can read from it
Sourcepub fn piped_write() -> Fd
pub fn piped_write() -> Fd
Create a pipe so that child can write to it
Sourcepub fn inherit() -> Fd
pub fn inherit() -> Fd
Inherit the child descriptor from parent
Not very useful for custom file descriptors better use from_file()
Sourcepub fn write_null() -> Fd
pub fn write_null() -> Fd
Create a writable pipe that ignores all the input