Skip to content

Commit

Permalink
Expose si_addr on siginfo_t. Refs #716
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Apr 12, 2019
1 parent 363ba93 commit de3e509
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion src/unix/notbsd/linux/other/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
pub type __priority_which_t = ::c_uint;

s_no_extra_traits! {
pub union XXX_not_sure_what_to_call_this {
addr_bnd: addr_bnd_t,
pkey: u32,
}

#[repr(C, packed)]
pub union sifields_t {
_pad: [::c_int; 29],
sigfault: sigfault_t,
}
}

s! {
pub struct aiocb {
pub aio_fildes: ::c_int,
Expand Down Expand Up @@ -44,11 +57,24 @@ s! {
pub ss_size: ::size_t
}

pub struct addr_bnd_t {
lower: *mut ::c_void,
upper: *mut ::c_void,
}

pub struct sigfault_t {
addr: *mut ::c_void,
#[cfg(target_arch = "sparc")]
trapno: ::c_int,
addr_lsb: ::c_short,
xxx_name_unclear: XXX_not_sure_what_to_call_this
}

pub struct siginfo_t {
pub si_signo: ::c_int,
pub si_errno: ::c_int,
pub si_code: ::c_int,
pub _pad: [::c_int; 29],
sifields: sifields_t,
#[cfg(target_arch = "x86_64")]
_align: [u64; 0],
#[cfg(not(target_arch = "x86_64"))]
Expand Down Expand Up @@ -232,6 +258,12 @@ s_no_extra_traits! {
}
}

impl siginfo_t {
pub unsafe fn si_addr(&self) -> *mut ::c_void {
self.sifields.sigfault.addr
}
}

cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for utmpx {
Expand Down

0 comments on commit de3e509

Please sign in to comment.