Skip to content

Commit 11f30a8

Browse files
committed
Auto merge of #1329 - alex:patch-1, r=gnzlbg
Deprecate _pad field on siginfo_t As discussed in #1316
2 parents e2bf06c + 9b43ade commit 11f30a8

File tree

1 file changed

+19
-0
lines changed
  • src/unix/notbsd/linux/other

1 file changed

+19
-0
lines changed

src/unix/notbsd/linux/other/mod.rs

+19
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ s! {
4848
pub si_signo: ::c_int,
4949
pub si_errno: ::c_int,
5050
pub si_code: ::c_int,
51+
#[deprecated(
52+
since="0.2.54",
53+
note="Please leave a comment on \
54+
https://github.com/rust-lang/libc/pull/1316 if you're using \
55+
this field"
56+
)]
5157
pub _pad: [::c_int; 29],
5258
#[cfg(target_arch = "x86_64")]
5359
_align: [u64; 0],
@@ -194,6 +200,19 @@ s! {
194200
}
195201
}
196202

203+
impl siginfo_t {
204+
pub unsafe fn si_addr(&self) -> *mut ::c_void {
205+
#[repr(C)]
206+
struct siginfo_sigfault {
207+
_si_signo: ::c_int,
208+
_si_errno: ::c_int,
209+
_si_code: ::c_int,
210+
si_addr: *mut ::c_void
211+
}
212+
(*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr
213+
}
214+
}
215+
197216
s_no_extra_traits! {
198217
pub struct utmpx {
199218
pub ut_type: ::c_short,

0 commit comments

Comments
 (0)