Skip to content

Commit a34697a

Browse files
committed
Adds in SI and TRAP signal codes
Impacts linux and android adding in (when applicable): * SI_ASYNCIO * SI_ASYNCNL * SI_DETHREAD * SI_KERNEL * SI_MESGQ * SI_QUEUE * SI_SIGIO * SI_TIMER * SI_TKILL * SI_USER And also: * TRAP_BRANCH * TRAP_BRKPT * TRAP_HWBKPT * TRAP_PERF * TRAP_TRACE * TRAP_UNK
1 parent 478f19d commit a34697a

File tree

5 files changed

+48
-0
lines changed

5 files changed

+48
-0
lines changed

libc-test/build.rs

+6
Original file line numberDiff line numberDiff line change
@@ -2994,6 +2994,9 @@ fn test_emscripten(target: &str) {
29942994
// https://github.com/emscripten-core/emscripten/pull/14883
29952995
"SIG_IGN" => true,
29962996

2997+
// Constants present in other linuxes but not emscripten
2998+
"SI_DETHREAD" | "TRAP_PERF" => true,
2999+
29973000
// LFS64 types have been removed in Emscripten 3.1.44
29983001
// https://github.com/emscripten-core/emscripten/pull/19812
29993002
n if n.starts_with("RLIM64") => true,
@@ -4055,6 +4058,9 @@ fn test_linux(target: &str) {
40554058
// FIXME(linux): Not currently available in headers on ARM and musl.
40564059
"NETLINK_GET_STRICT_CHK" if arm => true,
40574060

4061+
// Skip as this signal codes and trap reasons need newer headers
4062+
"SI_DETHREAD" | "TRAP_PERF" => true,
4063+
40584064
// kernel constants not available in uclibc 1.0.34
40594065
| "EXTPROC"
40604066
| "IPPROTO_BEETPH"

libc-test/semver/linux.txt

+16
Original file line numberDiff line numberDiff line change
@@ -2879,7 +2879,17 @@ SIOCSMIIREG
28792879
SIOCSRARP
28802880
SIOCWANDEV
28812881
SIOGIFINDEX
2882+
SI_ASYNCIO
2883+
SI_ASYNCNL
2884+
SI_DETHREAD
2885+
SI_KERNEL
28822886
SI_LOAD_SHIFT
2887+
SI_MESGQ
2888+
SI_QUEUE
2889+
SI_SIGIO
2890+
SI_TIMER
2891+
SI_TKILL
2892+
SI_USER
28832893
SND_CNT
28842894
SND_MAX
28852895
SOCK_CLOEXEC
@@ -3360,6 +3370,12 @@ TP_STATUS_USER
33603370
TP_STATUS_VLAN_TPID_VALID
33613371
TP_STATUS_VLAN_VALID
33623372
TP_STATUS_WRONG_FORMAT
3373+
TRAP_BRANCH
3374+
TRAP_BRKPT
3375+
TRAP_HWBKPT
3376+
TRAP_PERF
3377+
TRAP_TRACE
3378+
TRAP_UNK
33633379
TUNATTACHFILTER
33643380
TUNDETACHFILTER
33653381
TUNGETFEATURES

src/unix/linux_like/android/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -3526,6 +3526,10 @@ pub const AT_RSEQ_ALIGN: c_ulong = 28;
35263526
pub const AT_EXECFN: c_ulong = 31;
35273527
pub const AT_MINSIGSTKSZ: c_ulong = 51;
35283528

3529+
// siginfo.h
3530+
pub const SI_DETHREAD: c_int = -7;
3531+
pub const TRAP_PERF: c_int = 6;
3532+
35293533
// Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the
35303534
// following are only available on newer Linux versions than the versions
35313535
// currently used in CI in some configurations, so we define them here.

src/unix/linux_like/linux/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -5798,6 +5798,10 @@ pub const EPIOCGPARAMS: Ioctl = 0x80088a02;
57985798
const _IOC_NRBITS: u32 = 8;
57995799
const _IOC_TYPEBITS: u32 = 8;
58005800

5801+
// siginfo.h
5802+
pub const SI_DETHREAD: c_int = -7;
5803+
pub const TRAP_PERF: c_int = 6;
5804+
58015805
// https://github.com/search?q=repo%3Atorvalds%2Flinux+%22%23define+_IOC_NONE%22&type=code
58025806
cfg_if! {
58035807
if #[cfg(any(

src/unix/linux_like/mod.rs

+18
Original file line numberDiff line numberDiff line change
@@ -1288,6 +1288,17 @@ pub const PIPE_BUF: usize = 4096;
12881288

12891289
pub const SI_LOAD_SHIFT: c_uint = 16;
12901290

1291+
// si_code values
1292+
pub const SI_USER: c_int = 0;
1293+
pub const SI_KERNEL: c_int = 0x80;
1294+
pub const SI_QUEUE: c_int = -1;
1295+
pub const SI_TIMER: c_int = -2;
1296+
pub const SI_MESGQ: c_int = -3;
1297+
pub const SI_ASYNCIO: c_int = -4;
1298+
pub const SI_SIGIO: c_int = -5;
1299+
pub const SI_TKILL: c_int = -6;
1300+
pub const SI_ASYNCNL: c_int = -60;
1301+
12911302
// si_code values for SIGBUS signal
12921303
pub const BUS_ADRALN: c_int = 1;
12931304
pub const BUS_ADRERR: c_int = 2;
@@ -1296,6 +1307,13 @@ pub const BUS_OBJERR: c_int = 3;
12961307
pub const BUS_MCEERR_AR: c_int = 4;
12971308
pub const BUS_MCEERR_AO: c_int = 5;
12981309

1310+
// si_code values for SIGTRAP
1311+
pub const TRAP_BRKPT: c_int = 1;
1312+
pub const TRAP_TRACE: c_int = 2;
1313+
pub const TRAP_BRANCH: c_int = 3;
1314+
pub const TRAP_HWBKPT: c_int = 4;
1315+
pub const TRAP_UNK: c_int = 5;
1316+
12991317
// si_code values for SIGCHLD signal
13001318
pub const CLD_EXITED: c_int = 1;
13011319
pub const CLD_KILLED: c_int = 2;

0 commit comments

Comments
 (0)