[][src]Struct signal_hook::low_level::siginfo::Origin

#[non_exhaustive]pub struct Origin {
    pub signal: c_int,
    pub process: Option<Process>,
    pub cause: Cause,
}

Information about a signal and its origin.

This is produced by the [WithOrigin] exfiltrator (or can be extracted from siginfo_t by hand).

Fields (Non-exhaustive)

Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
signal: c_int

The signal that happened.

process: Option<Process>

Information about the process that caused the signal.

Note that not all signals are caused by a specific process or have the information available („fault“ signals like SIGBUS don't have, any signal may be sent by the kernel instead of a specific process).

This is filled in whenever available. For most signals, this is the process that sent the signal (by kill or similar), for SIGCHLD it is the child that caused the signal.

cause: Cause

How the signal happened.

This is a best-effort value. In particular, some systems may have causes not known to this library. Some other systems (MacOS) does not fill the value in so there's no way to know. In all these cases, this will contain Cause::Unknown.

Some values are platform specific and not available on other systems.

Future versions may enrich the enum by further values.

Implementations

impl Origin[src]

pub unsafe fn extract(info: &siginfo_t) -> Self[src]

Extracts the Origin from a raw siginfo_t structure.

This function is async-signal-safe, can be called inside a signal handler.

Safety

On systems where the structure is backed by an union on the C side, this requires the si_code and si_signo fields must be set properly according to what fields are available.

The value passed by kernel satisfies this, care must be taken only when constructed manually.

Trait Implementations

impl Clone for Origin[src]

impl Debug for Origin[src]

impl Eq for Origin[src]

impl PartialEq<Origin> for Origin[src]

impl StructuralEq for Origin[src]

impl StructuralPartialEq for Origin[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.