Enum SignalNum

Source
#[repr(u8)]
pub enum SignalNum {
Show 64 variants HUP = 1, INT = 2, QUIT = 3, ILL = 4, TRAP = 5, ABRT = 6, BUS = 7, FPE = 8, KILL = 9, USR1 = 10, SEGV = 11, USR2 = 12, PIPE = 13, ALRM = 14, TERM = 15, STKFLT = 16, CHLD = 17, CONT = 18, STOP = 19, TSTP = 20, TTIN = 21, TTOU = 22, URG = 23, XCPU = 24, XFSZ = 25, VTALRM = 26, PROF = 27, WINCH = 28, IO = 29, PWR = 30, SYS = 31, TIMER = 32, CANCEL = 33, SYNCCALL = 34, RT3 = 35, RT4 = 36, RT5 = 37, RT6 = 38, RT7 = 39, RT8 = 40, RT9 = 41, RT10 = 42, RT11 = 43, RT12 = 44, RT13 = 45, RT14 = 46, RT15 = 47, RT16 = 48, RT17 = 49, RT18 = 50, RT19 = 51, RT20 = 52, RT21 = 53, RT22 = 54, RT23 = 55, RT24 = 56, RT25 = 57, RT26 = 58, RT27 = 59, RT28 = 60, RT29 = 61, RT30 = 62, RT31 = 63, RTMAX = 64,
}
Expand description

POSIX 标准、线程扩展与实时信号枚举定义(信号编号从 1 开始) MUSL: https://github.com/bminor/musl/blob/c47ad25ea3b484e10326f933e927c0bc8cded3da/arch/aarch64/bits/signal.h#L118

Variants§

§

HUP = 1

终端挂起(Hangup)

§

INT = 2

交互式中断(Interrupt)

§

QUIT = 3

退出(Quit)

§

ILL = 4

非法指令(Illegal instruction)

§

TRAP = 5

断点(Trace/breakpoint trap)

§

ABRT = 6

异常终止(Abort)

§

BUS = 7

总线错误(Bus error)

§

FPE = 8

浮点异常(Floating-point exception)

§

KILL = 9

强制终止(Kill,不可被捕获或忽略)

§

USR1 = 10

用户定义信号 1

§

SEGV = 11

段错误(Segmentation fault)

§

USR2 = 12

用户定义信号 2

§

PIPE = 13

管道破裂(Broken pipe)

§

ALRM = 14

报警时钟(Alarm clock)

§

TERM = 15

终止请求(Termination)

§

STKFLT = 16

协处理器堆栈故障(栈浮点错误,仅部分平台支持)

§

CHLD = 17

子进程终止或状态变化(Child)

§

CONT = 18

继续执行(Continue)

§

STOP = 19

停止进程(不可忽略)

§

TSTP = 20

终端停止(来自 TTY 的 Ctrl+Z)

§

TTIN = 21

后台读取控制终端

§

TTOU = 22

后台写入控制终端

§

URG = 23

紧急条件(Urgent socket)

§

XCPU = 24

超过 CPU 时间限制

§

XFSZ = 25

超过文件大小限制

§

VTALRM = 26

虚拟计时器到期(Virtual alarm)

§

PROF = 27

性能分析计时器到期(Profiling alarm)

§

WINCH = 28

窗口大小改变(Window size change)

§

IO = 29

异步 I/O(I/O now possible)

§

PWR = 30

电源失败(Power failure)

§

SYS = 31

非法系统调用(Bad syscall)

§

TIMER = 32

POSIX 线程:定时器信号

§

CANCEL = 33

POSIX 线程:取消信号

§

SYNCCALL = 34

POSIX 线程:同步调用信号

§

RT3 = 35

实时信号 3(Real-time signal 3)

§

RT4 = 36

实时信号 4

§

RT5 = 37

实时信号 5

§

RT6 = 38

实时信号 6

§

RT7 = 39

实时信号 7

§

RT8 = 40

实时信号 8

§

RT9 = 41

实时信号 9

§

RT10 = 42

实时信号 10

§

RT11 = 43

实时信号 11

§

RT12 = 44

实时信号 12

§

RT13 = 45

实时信号 13

§

RT14 = 46

实时信号 14

§

RT15 = 47

实时信号 15

§

RT16 = 48

实时信号 16

§

RT17 = 49

实时信号 17

§

RT18 = 50

实时信号 18

§

RT19 = 51

实时信号 19

§

RT20 = 52

实时信号 20

§

RT21 = 53

实时信号 21

§

RT22 = 54

实时信号 22

§

RT23 = 55

实时信号 23

§

RT24 = 56

实时信号 24

§

RT25 = 57

实时信号 25

§

RT26 = 58

实时信号 26

§

RT27 = 59

实时信号 27

§

RT28 = 60

实时信号 28

§

RT29 = 61

实时信号 29

§

RT30 = 62

实时信号 30

§

RT31 = 63

实时信号 31

§

RTMAX = 64

最大实时信号(Real-time signal max)

Implementations§

Source§

impl SignalNum

Source

pub fn from_num(num: usize) -> Option<SignalNum>

从数字构造 SignalNum 枚举,如果超出合法范围则返回 None

Source

pub const fn num(&self) -> usize

获取信号的编号(number)。

Source

pub const fn is_rt(&self) -> bool

判断是否为实时信号(Real-time Signal)。

实时信号从编号 REAL_TIME_SIGNAL_NUM 开始。

Source

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

如果是实时信号,则返回其在实时信号表中的索引(从 1 开始)。

例如,编号为 REAL_TIME_SIGNAL_NUM 的信号返回 1

Source

pub const fn mask(&self) -> u64

获取信号的位掩码(bit mask)。

信号编号从 1 开始,因此返回值为 1 << (num - 1)

Trait Implementations§

Source§

impl Clone for SignalNum

Source§

fn clone(&self) -> SignalNum

Returns a copy of the value. Read more
1.0.0§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SignalNum

Source§

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

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

impl PartialEq for SignalNum

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<u8> for SignalNum

Source§

type Error = TryFromPrimitiveError<SignalNum>

The type returned in the event of a conversion error.
Source§

fn try_from(number: u8) -> Result<Self, TryFromPrimitiveError<Self>>

Performs the conversion.
Source§

impl TryFromPrimitive for SignalNum

Source§

const NAME: &'static str = "SignalNum"

Source§

type Primitive = u8

Source§

type Error = TryFromPrimitiveError<SignalNum>

Source§

fn try_from_primitive( number: Self::Primitive, ) -> Result<Self, TryFromPrimitiveError<Self>>

Source§

impl Copy for SignalNum

Source§

impl Eq for SignalNum

Source§

impl StructuralPartialEq for SignalNum

Auto Trait Implementations§

§

impl Freeze for SignalNum

§

impl RefUnwindSafe for SignalNum

§

impl Send for SignalNum

§

impl Sync for SignalNum

§

impl Unpin for SignalNum

§

impl UnwindSafe for SignalNum

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

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

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

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.