Skip to content

Commit 53591a6

Browse files
committed
Implement si_addr
1 parent 7c2f669 commit 53591a6

File tree

1 file changed

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

1 file changed

+19
-1
lines changed

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,32 @@ s! {
4848
pub si_signo: ::c_int,
4949
pub si_errno: ::c_int,
5050
pub si_code: ::c_int,
51-
#[deprecated(since="0.2.54", note="Please leave a comment on https://github.com/rust-lang/libc/pull/1316 if you're using this field")]
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+
)]
5257
pub _pad: [::c_int; 29],
5358
#[cfg(target_arch = "x86_64")]
5459
_align: [u64; 0],
5560
#[cfg(not(target_arch = "x86_64"))]
5661
_align: [usize; 0],
5762
}
5863

64+
impl siginfo_t {
65+
pub unsafe fn si_addr(&self) -> *mut ::c_void {
66+
#[repr(C)]
67+
struct siginfo_sigfault {
68+
_si_signo: ::c_int,
69+
_si_errno: ::c_int,
70+
_si_code: ::c_int,
71+
si_addr: *mut ::c_void
72+
}
73+
(*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr
74+
}
75+
}
76+
5977
pub struct glob64_t {
6078
pub gl_pathc: ::size_t,
6179
pub gl_pathv: *mut *mut ::c_char,

0 commit comments

Comments
 (0)