Skip to content

Commit 608f947

Browse files
xd009642tgross35
authored andcommitted
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 (backport <#4225>) (cherry picked from commit a34697a)
1 parent 8e728d7 commit 608f947

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
@@ -3065,6 +3065,9 @@ fn test_emscripten(target: &str) {
30653065
// https://github.com/emscripten-core/emscripten/pull/14883
30663066
"SIG_IGN" => true,
30673067

3068+
// Constants present in other linuxes but not emscripten
3069+
"SI_DETHREAD" | "TRAP_PERF" => true,
3070+
30683071
// LFS64 types have been removed in Emscripten 3.1.44
30693072
// https://github.com/emscripten-core/emscripten/pull/19812
30703073
n if n.starts_with("RLIM64") => true,
@@ -4130,6 +4133,9 @@ fn test_linux(target: &str) {
41304133
// FIXME: Not currently available in headers on ARM and musl.
41314134
"NETLINK_GET_STRICT_CHK" if arm => true,
41324135

4136+
// Skip as this signal codes and trap reasons need newer headers
4137+
"SI_DETHREAD" | "TRAP_PERF" => true,
4138+
41334139
// kernel constants not available in uclibc 1.0.34
41344140
| "EXTPROC"
41354141
| "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
@@ -3359,6 +3369,12 @@ TP_STATUS_USER
33593369
TP_STATUS_VLAN_TPID_VALID
33603370
TP_STATUS_VLAN_VALID
33613371
TP_STATUS_WRONG_FORMAT
3372+
TRAP_BRANCH
3373+
TRAP_BRKPT
3374+
TRAP_HWBKPT
3375+
TRAP_PERF
3376+
TRAP_TRACE
3377+
TRAP_UNK
33623378
TUNATTACHFILTER
33633379
TUNDETACHFILTER
33643380
TUNGETFEATURES

src/unix/linux_like/android/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -3568,6 +3568,10 @@ pub const AT_RSEQ_ALIGN: c_ulong = 28;
35683568
pub const AT_EXECFN: c_ulong = 31;
35693569
pub const AT_MINSIGSTKSZ: c_ulong = 51;
35703570

3571+
// siginfo.h
3572+
pub const SI_DETHREAD: c_int = -7;
3573+
pub const TRAP_PERF: c_int = 6;
3574+
35713575
// Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the
35723576
// following are only available on newer Linux versions than the versions
35733577
// 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
@@ -5725,6 +5725,10 @@ pub const EPIOCGPARAMS: Ioctl = 0x80088a02;
57255725
const _IOC_NRBITS: u32 = 8;
57265726
const _IOC_TYPEBITS: u32 = 8;
57275727

5728+
// siginfo.h
5729+
pub const SI_DETHREAD: c_int = -7;
5730+
pub const TRAP_PERF: c_int = 6;
5731+
57285732
// https://github.com/search?q=repo%3Atorvalds%2Flinux+%22%23define+_IOC_NONE%22&type=code
57295733
cfg_if! {
57305734
if #[cfg(any(

src/unix/linux_like/mod.rs

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

12901290
pub const SI_LOAD_SHIFT: c_uint = 16;
12911291

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

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

0 commit comments

Comments
 (0)