Struct axsignal::action::SigAction

source ·
#[repr(C)]
pub struct SigAction { pub sa_handler: usize, pub sa_flags: SigActionFlags, pub restorer: usize, pub sa_mask: usize, }
Expand description

The structure of the signal action

Fields§

§sa_handler: usize

信号处理函数的地址

  1. 如果是上述特殊值 SIG_DFL 或 SIG_IGN,则按描述处理
  2. 若flags没有指定SA_SIGINFO,则函数原型为 fn(sig: SignalNo) -> (),对应C语言原型为 void (*sa_handler)(int)
  3. 若flags指定了SA_SIGINFO,则函数原型为 fn(sig: SignalNo, info: &SigInfo, ucontext: &mut UContext) -> (), 对应C语言原型为 void (*sa_sigaction)(int, siginfo_t *, void *)。

其中,SigInfo和SignalNo的定义见siginfo.rs和signal_no.rs。 UContext即是处理信号时内核保存的用户态上下文,它存储在用户地址空间,会在调用sig_return时被恢复,定义见ucontext.rs。

§sa_flags: SigActionFlags

信号处理的flags

§restorer: usize

信号处理的跳板页地址,存储了sig_return的函数处理地址 仅在SA_RESTORER标志被设置时有效

§sa_mask: usize

该信号处理函数的信号掩码

Implementations§

source§

impl SigAction

source

pub fn get_storer(&self) -> Option<usize>

get the restorer address of the signal action

When the SA_RESTORER flag is set, the restorer address is valid

or it will return None, and the core will set the restore address as the signal trampoline

Trait Implementations§

source§

impl Clone for SigAction

source§

fn clone(&self) -> SigAction

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 SigAction

source§

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

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

impl Copy for SigAction

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