Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 55274be

Browse files
committedApr 12, 2019
Expose si_addr on siginfo_t. Refs #716
1 parent 363ba93 commit 55274be

File tree

1 file changed

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

1 file changed

+34
-1
lines changed
 

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

+34-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
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+
10+
#[repr(C, packed)]
11+
pub union sifields_t {
12+
_pad: [::c_int; 29],
13+
sigfault: sigfault_t,
14+
}
15+
}
16+
317
s! {
418
pub struct aiocb {
519
pub aio_fildes: ::c_int,
@@ -44,11 +58,24 @@ s! {
4458
pub ss_size: ::size_t
4559
}
4660

61+
pub struct addr_bnd_t {
62+
lower: *mut ::c_void,
63+
upper: *mut ::c_void,
64+
}
65+
66+
pub struct sigfault_t {
67+
addr: *mut ::c_void,
68+
#[cfg(target_arch = "sparc")]
69+
trapno: ::c_int,
70+
addr_lsb: ::c_short,
71+
xxx_name_unclear: XXX_not_sure_what_to_call_this
72+
}
73+
4774
pub struct siginfo_t {
4875
pub si_signo: ::c_int,
4976
pub si_errno: ::c_int,
5077
pub si_code: ::c_int,
51-
pub _pad: [::c_int; 29],
78+
sifields: sifields_t,
5279
#[cfg(target_arch = "x86_64")]
5380
_align: [u64; 0],
5481
#[cfg(not(target_arch = "x86_64"))]
@@ -232,6 +259,12 @@ s_no_extra_traits! {
232259
}
233260
}
234261

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

0 commit comments

Comments
 (0)
Please sign in to comment.