#[non_exhaustive]
pub struct Origin { pub signal: c_int, pub process: Option<Process>, pub cause: Cause, }
Available on crate feature extended-siginfo-raw only.
Expand description

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)§

This struct is marked as 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§

source§

impl Origin

source

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

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§

source§

impl Clone for Origin

source§

fn clone(&self) -> Origin

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Origin

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> FmtResult

Formats the value using the given formatter. Read more
source§

impl PartialEq<Origin> for Origin

source§

fn eq(&self, other: &Origin) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Origin

source§

impl StructuralEq for Origin

source§

impl StructuralPartialEq for Origin

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.