1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/// Direct `rt_sigaction(2)` syscall — bypasses any libc wrapper.
///
/// Returns the raw kernel return value: `0` on success, negative `-errno` on
/// failure. Callers convert with `io::Error::from_raw_os_error(-ret as i32)`.
///
/// # Safety
/// Caller is responsible for the validity of `act` / `oact` pointers and for
/// ensuring no concurrent thread races on the same signal disposition.
use KernelSigAction;
// ---------------------------------------------------------------------------
// x86_64
// ---------------------------------------------------------------------------
//
// Syscall ABI: number in `rax`; args in `rdi, rsi, rdx, r10`; result in
// `rax` (negative `-errno` on failure, `0` on success). `syscall` clobbers
// `rcx` (saved RIP) and `r11` (saved RFLAGS).
//
// `__NR_rt_sigaction` = 13 (x86_64 native syscall table).
// `sigsetsize` (4th arg) = 8 bytes — one `unsigned long` on 64-bit Linux.
/// Invoke the Linux `rt_sigaction(2)` syscall directly, bypassing any libc wrapper.
///
/// Returns `0` on success or a negative `-errno` value on failure.
///
/// # Safety
/// - `act` must be a valid pointer to an initialised [`KernelSigAction`], or null.
/// - `oact` must be a valid writable pointer to a [`KernelSigAction`]-sized slot, or null.
/// - No concurrent thread may race on the same signal disposition while this call executes.
pub unsafe
// ---------------------------------------------------------------------------
// aarch64
// ---------------------------------------------------------------------------
//
// Syscall ABI: number in `x8`; args in `x0..x5`; result in `x0`.
// `__NR_rt_sigaction` = 134 (generic Linux ABI, same as riscv64).
/// Invoke the Linux `rt_sigaction(2)` syscall directly, bypassing any libc wrapper.
///
/// Returns `0` on success or a negative `-errno` value on failure.
///
/// # Safety
/// - `act` must be a valid pointer to an initialised [`KernelSigAction`], or null.
/// - `oact` must be a valid writable pointer to a [`KernelSigAction`]-sized slot, or null.
/// - No concurrent thread may race on the same signal disposition while this call executes.
pub unsafe
// ---------------------------------------------------------------------------
// riscv64
// ---------------------------------------------------------------------------
//
// Syscall ABI: number in `a7`; args in `a0..a5`; result in `a0`.
// `__NR_rt_sigaction` = 134 (same generic Linux ABI as aarch64).
// References: arch/riscv/include/uapi/asm/unistd.h (via <asm-generic/unistd.h>)
/// Invoke the Linux `rt_sigaction(2)` syscall directly, bypassing any libc wrapper.
///
/// Returns `0` on success or a negative `-errno` value on failure.
///
/// # Safety
/// - `act` must be a valid pointer to an initialised [`KernelSigAction`], or null.
/// - `oact` must be a valid writable pointer to a [`KernelSigAction`]-sized slot, or null.
/// - No concurrent thread may race on the same signal disposition while this call executes.
pub unsafe