[−][src]Trait linux::fd::FdContainer
Objects that are file descriptor wrappers.
Required methods
fn is_owned(&self) -> bool
Returns whether the object owns the file descriptor, i.e., whether it closes it when it goes out of scope.
fn borrow(&self) -> c_int
Returns the contained file descriptor.
fn from_owned(fd: c_int) -> Self
Creates a new owned object from a file descriptor.
[argument, fd] The value of the file descriptor.
= Remarks
Not all objects support owned file descriptors. Check with is_owned
if this
matters.
fn from_borrowed(fd: c_int) -> Self
Creates a new borrowed object from a file descriptor.
[argument, fd] The value of the file descriptor.
Provided methods
ⓘImportant traits for FdIofn as_fdio(&self) -> FdIo
Borrows the file descriptor as an FdIo
.
fn is_close_on_exec(&self) -> Result<bool>
Retrieves the status of the close on exec
flag.
[return_value]
Returns whether the close on exec
flag is set.
= See also
- link:man:fcntl(2) and the description of
F_GETFD
therein. - link:lrs::fd::FdContainer::set_close_on_exec
fn set_close_on_exec(&self, val: bool) -> Result
Enables or disables the close on exec
flag.
[argument, val] Whether the flag is set.
= See also
- link:man:fcntl(2) and the description of
F_SETFD
therein. - link:lrs::file::File::io_close_on_exec
fn description_flags(&self) -> Result<DescriptionFlags>
Retrieves the file description flags.
[return_value] Returns the description flags.
= See also
- link:man:fcntl(2) and the description of
F_GETFL
therein. - link:lrs::fd::FdContainer::set_description_flags
fn set_description_flags(&self, flags: DescriptionFlags) -> Result
Sets the file description flags.
[argument, flags] The modified flags.
= See also
- link:man:fcntl(2) and the description of
F_SETFL
therein. - link:lrs::fd::FdContainer::description_flags
fn duplicate(&self) -> Result<Self> where
Self: Sized,
Self: Sized,
Duplicates the file descriptor.
= Remarks
The close on exec
flag will automatically be set on the new file descriptor.
= See also
- link:lrs::fd::FdContainer::duplicate_min
fn duplicate_min(&self, min: c_int) -> Result<Self> where
Self: Sized,
Self: Sized,
Duplicates the file descriptor so that the duplicated one has a minimum value.
[argument, min] The minimum value of the new file descriptor.
= Remarks
The close on exec
flag will automatically be set on the new file descriptor.
= See also
- link:lrs::fd::FdContainer::duplicate
- link:man:fcntl(2) and F_DUPFD_CLOEXEC therein
fn duplicate_as(&self, new: c_int) -> Result<Self> where
Self: Sized,
Self: Sized,
Duplicates the file descriptor, replacing an existing one.
[argument, new] The file descriptor to replace.
= Remarks
The new
argument can refer to an open file descriptor but does not have to. In
this case, new
will be atomically closed and replaced by a duplicate of this
file descriptor.
= See also
- link:man:dup3(2)
Implementors
impl FdContainer for FdIo
[src]
fn is_owned(&self) -> bool
[src]
fn borrow(&self) -> c_int
[src]
ⓘImportant traits for FdIofn from_owned(fd: c_int) -> FdIo
[src]
ⓘImportant traits for FdIofn from_borrowed(fd: c_int) -> FdIo
[src]
ⓘImportant traits for FdIofn as_fdio(&self) -> FdIo
[src]
fn is_close_on_exec(&self) -> Result<bool>
[src]
fn set_close_on_exec(&self, val: bool) -> Result
[src]
fn description_flags(&self) -> Result<DescriptionFlags>
[src]
fn set_description_flags(&self, flags: DescriptionFlags) -> Result
[src]
fn duplicate(&self) -> Result<Self> where
Self: Sized,
[src]
Self: Sized,
fn duplicate_min(&self, min: c_int) -> Result<Self> where
Self: Sized,
[src]
Self: Sized,
fn duplicate_as(&self, new: c_int) -> Result<Self> where
Self: Sized,
[src]
Self: Sized,
impl FdContainer for Timer
[src]
fn is_owned(&self) -> bool
[src]
fn borrow(&self) -> c_int
[src]
fn from_owned(fd: c_int) -> Timer
[src]
fn from_borrowed(fd: c_int) -> Timer
[src]
ⓘImportant traits for FdIofn as_fdio(&self) -> FdIo
[src]
fn is_close_on_exec(&self) -> Result<bool>
[src]
fn set_close_on_exec(&self, val: bool) -> Result
[src]
fn description_flags(&self) -> Result<DescriptionFlags>
[src]
fn set_description_flags(&self, flags: DescriptionFlags) -> Result
[src]
fn duplicate(&self) -> Result<Self> where
Self: Sized,
[src]
Self: Sized,
fn duplicate_min(&self, min: c_int) -> Result<Self> where
Self: Sized,
[src]
Self: Sized,
fn duplicate_as(&self, new: c_int) -> Result<Self> where
Self: Sized,
[src]
Self: Sized,
impl FdContainer for c_int
[src]
fn is_owned(&self) -> bool
[src]
fn borrow(&self) -> c_int
[src]
fn from_owned(fd: c_int) -> c_int
[src]
fn from_borrowed(fd: c_int) -> c_int
[src]
ⓘImportant traits for FdIofn as_fdio(&self) -> FdIo
[src]
fn is_close_on_exec(&self) -> Result<bool>
[src]
fn set_close_on_exec(&self, val: bool) -> Result
[src]
fn description_flags(&self) -> Result<DescriptionFlags>
[src]
fn set_description_flags(&self, flags: DescriptionFlags) -> Result
[src]
fn duplicate(&self) -> Result<Self> where
Self: Sized,
[src]
Self: Sized,
fn duplicate_min(&self, min: c_int) -> Result<Self> where
Self: Sized,
[src]
Self: Sized,
fn duplicate_as(&self, new: c_int) -> Result<Self> where
Self: Sized,
[src]
Self: Sized,