Struct base::sys::linux::signalfd::SignalFd

source ·
pub struct SignalFd {
    signalfd: File,
    signal: c_int,
}
Expand description

A safe wrapper around a Linux signalfd (man 2 signalfd).

A signalfd can be used for non-synchronous signals (such as SIGCHLD) so that signals can be processed without the use of a signal handler.

Fields§

§signalfd: File§signal: c_int

Implementations§

source§

impl SignalFd

source

pub fn new(signal: c_int) -> Result<SignalFd, Error>

Creates a new SignalFd for the given signal, blocking the normal handler for the signal as well. Since we mask out the normal handler, this is a risky operation - signal masking will persist across fork and even exec so the user of SignalFd should think long and hard about when to mask signals.

source

pub fn read(&self) -> Result<Option<signalfd_siginfo>, Error>

Read a siginfo struct from the signalfd, if available.

Trait Implementations§

source§

impl AsRawDescriptor for SignalFd

source§

fn as_raw_descriptor(&self) -> RawDescriptor

Returns the underlying raw descriptor. Read more
source§

impl AsRawFd for SignalFd

source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
source§

impl Drop for SignalFd

source§

fn drop(&mut self)

Executes the destructor for this type. 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> AsRawDescriptors for T
where T: AsRawDescriptor,

source§

fn as_raw_descriptors(&self) -> Vec<i32>

Returns the underlying raw descriptors. 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.