Struct signal_hook::low_level::siginfo::Origin
source · #[non_exhaustive]pub struct Origin {
pub signal: c_int,
pub process: Option<Process>,
pub cause: Cause,
}
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
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
impl Origin
sourcepub unsafe fn extract(info: &siginfo_t) -> Self
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.