Skip to content

Commit

Permalink
Add siginfo accessors for uclibc
Browse files Browse the repository at this point in the history
  • Loading branch information
pfmooney committed Apr 11, 2022
1 parent a0e4f9d commit da00f55
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/unix/linux_like/linux/uclibc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,32 @@ s! {
}
}

impl siginfo_t {
pub unsafe fn si_addr(&self) -> *mut ::c_void {
#[repr(C)]
struct siginfo_sigfault {
_si_signo: ::c_int,
_si_errno: ::c_int,
_si_code: ::c_int,
si_addr: *mut ::c_void,
}
(*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr
}

pub unsafe fn si_value(&self) -> ::sigval {
#[repr(C)]
struct siginfo_si_value {
_si_signo: ::c_int,
_si_errno: ::c_int,
_si_code: ::c_int,
_si_timerid: ::c_int,
_si_overrun: ::c_int,
si_value: ::sigval,
}
(*(self as *const siginfo_t as *const siginfo_si_value)).si_value
}
}

pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;

Expand Down

0 comments on commit da00f55

Please sign in to comment.