Skip to content

Commit 95aae38

Browse files
committed
Auto merge of #2750 - pfmooney:uclibc-siginfo, r=Amanieu
Add siginfo accessors for uclibc With rust-lang/rust#95688 switching to the libc-provided `si_addr()` accessor on `siginfo_t`, it became apparent that the uclibc target was lacking that implementation (see rust-lang/rust#95866). It would be nice to provide the same accessor in uclibc as the other UNIX-y platforms. CC: `@asomers` `@name1e5s` `@skrap` - If you have a testing env for this, could you try it out?
2 parents 45b7f08 + da00f55 commit 95aae38

File tree

1 file changed

+26
-0
lines changed
  • src/unix/linux_like/linux/uclibc

1 file changed

+26
-0
lines changed

src/unix/linux_like/linux/uclibc/mod.rs

+26
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,32 @@ s! {
8181
}
8282
}
8383

84+
impl siginfo_t {
85+
pub unsafe fn si_addr(&self) -> *mut ::c_void {
86+
#[repr(C)]
87+
struct siginfo_sigfault {
88+
_si_signo: ::c_int,
89+
_si_errno: ::c_int,
90+
_si_code: ::c_int,
91+
si_addr: *mut ::c_void,
92+
}
93+
(*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr
94+
}
95+
96+
pub unsafe fn si_value(&self) -> ::sigval {
97+
#[repr(C)]
98+
struct siginfo_si_value {
99+
_si_signo: ::c_int,
100+
_si_errno: ::c_int,
101+
_si_code: ::c_int,
102+
_si_timerid: ::c_int,
103+
_si_overrun: ::c_int,
104+
si_value: ::sigval,
105+
}
106+
(*(self as *const siginfo_t as *const siginfo_si_value)).si_value
107+
}
108+
}
109+
84110
pub const MCL_CURRENT: ::c_int = 0x0001;
85111
pub const MCL_FUTURE: ::c_int = 0x0002;
86112

0 commit comments

Comments
 (0)