Skip to content

Commit de3e509

Browse files
committed
Expose si_addr on siginfo_t. Refs #716
1 parent 363ba93 commit de3e509

File tree

1 file changed

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

1 file changed

+33
-1
lines changed

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

+33-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
pub type __priority_which_t = ::c_uint;
22

3+
s_no_extra_traits! {
4+
pub union XXX_not_sure_what_to_call_this {
5+
addr_bnd: addr_bnd_t,
6+
pkey: u32,
7+
}
8+
9+
#[repr(C, packed)]
10+
pub union sifields_t {
11+
_pad: [::c_int; 29],
12+
sigfault: sigfault_t,
13+
}
14+
}
15+
316
s! {
417
pub struct aiocb {
518
pub aio_fildes: ::c_int,
@@ -44,11 +57,24 @@ s! {
4457
pub ss_size: ::size_t
4558
}
4659

60+
pub struct addr_bnd_t {
61+
lower: *mut ::c_void,
62+
upper: *mut ::c_void,
63+
}
64+
65+
pub struct sigfault_t {
66+
addr: *mut ::c_void,
67+
#[cfg(target_arch = "sparc")]
68+
trapno: ::c_int,
69+
addr_lsb: ::c_short,
70+
xxx_name_unclear: XXX_not_sure_what_to_call_this
71+
}
72+
4773
pub struct siginfo_t {
4874
pub si_signo: ::c_int,
4975
pub si_errno: ::c_int,
5076
pub si_code: ::c_int,
51-
pub _pad: [::c_int; 29],
77+
sifields: sifields_t,
5278
#[cfg(target_arch = "x86_64")]
5379
_align: [u64; 0],
5480
#[cfg(not(target_arch = "x86_64"))]
@@ -232,6 +258,12 @@ s_no_extra_traits! {
232258
}
233259
}
234260

261+
impl siginfo_t {
262+
pub unsafe fn si_addr(&self) -> *mut ::c_void {
263+
self.sifields.sigfault.addr
264+
}
265+
}
266+
235267
cfg_if! {
236268
if #[cfg(feature = "extra_traits")] {
237269
impl PartialEq for utmpx {

0 commit comments

Comments
 (0)