Struct linux_api::signal::siginfo_t

source ·
pub struct siginfo_t(/* private fields */);
Expand description

Wrapper around linux_siginfo_t.

§Invariants

The following invariants in the internal linux_siginfo_t are ensured when constructed through safe constructors:

  • lsi_code, lsi_signo, and lsi_errno are initialized.
  • The parts of the l_sifields union are initialized that sigaction(2) specifies are initialized for the given lsi_code and lsi_signo.

When constructing via one of the unsafe constructors that takes some form of linux_siginfo_t or the pieces of one, the above must also hold. However, it is sufficient for all bytes to be initialized; any bit pattern is acceptable as long as it is an initialized one. (Initializing from garbage data may result in garbage pointers, but the safe methods of this type will never dereference those itself). For example, unsafe { SigInfo::wrap_assume_initd(core::mem::zeroed()) } is sound.

Implementations§

source§

impl siginfo_t

source

pub unsafe fn wrap_assume_initd(si: linux_siginfo_t) -> Self

Analogous to bytemuck::TransparentWrapper::wrap, but unsafe.

§Safety

See siginfo_t Invariants.

source

pub unsafe fn wrap_ref_assume_initd(si: &linux_siginfo_t) -> &Self

Analogous to bytemuck::TransparentWrapper::wrap_ref, but unsafe.

§Safety

See siginfo_t Invariants.

source

pub unsafe fn wrap_mut_assume_initd(si: &mut linux_siginfo_t) -> &mut Self

Analogous to bytemuck::TransparentWrapper::wrap_mut, but unsafe.

§Safety

See siginfo_t Invariants.

source

pub unsafe fn peel(si: Self) -> linux_siginfo_t

§Safety

Pointers are safe to dereference iff those used to construct si are.

source

pub fn signal(&self) -> Result<Signal, SignalFromI32Error>

source

pub fn code(&self) -> Result<SigInfoCode, SigInfoCodeFromRawError>

source

pub unsafe fn details(&self) -> Option<SigInfoDetails>

§Safety

Pointers are safe to dereference iff those used to construct self (or set via mutable methods) are.

source

pub fn new_for_kill(signal: Signal, sender_pid: i32, sender_uid: u32) -> Self

source

pub fn new_for_tkill(signal: Signal, sender_pid: i32, sender_uid: u32) -> Self

source

pub fn new_for_timer(signal: Signal, timer_id: i32, overrun: i32) -> Self

source

pub fn new_for_mq( signal: Signal, sender_pid: i32, sender_uid: u32, sigval: linux_sigval, ) -> Self

source

pub fn new_for_sigchld_exited( exit_signal: Signal, child_pid: i32, child_uid: u32, child_exit_status: i32, child_utime: i64, child_stime: i64, ) -> Self

source

pub fn new_for_sigchld_killed( exit_signal: Signal, child_pid: i32, child_uid: u32, fatal_signal: Signal, child_utime: i64, child_stime: i64, ) -> Self

source

pub fn new_for_sigchld_dumped( exit_signal: Signal, child_pid: i32, child_uid: u32, fatal_signal: Signal, child_utime: i64, child_stime: i64, ) -> Self

source

pub fn new_for_sigchld_trapped( exit_signal: Signal, child_pid: i32, child_uid: u32, child_utime: i64, child_stime: i64, ) -> Self

source

pub fn new_for_sigchld_stopped( exit_signal: Signal, child_pid: i32, child_uid: u32, child_utime: i64, child_stime: i64, ) -> Self

source

pub fn new_for_sigchld_continued( exit_signal: Signal, child_pid: i32, child_uid: u32, child_utime: i64, child_stime: i64, ) -> Self

Trait Implementations§

source§

impl Clone for siginfo_t

source§

fn clone(&self) -> siginfo_t

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 siginfo_t

source§

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

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

impl Default for siginfo_t

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Copy for siginfo_t

source§

impl Pod for siginfo_t

source§

impl Send for siginfo_t

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> 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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

source§

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 T
where U: Into<T>,

source§

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>,

source§

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.