Skip to content

Commit a545eac

Browse files
committed
make siginfo_si_addr() returns a usize
`siginfo_si_addr()` function is used once, and the returned value is casted to `usize`. So make the function returns a `usize`. it simplifies OpenBSD case, where the return type wouldn't be a `*mut libc::c_void` but a `*mut libc::c_char`.
1 parent 4689595 commit a545eac

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/libstd/sys/unix/stack_overflow.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,19 @@ mod imp {
5959
static mut PAGE_SIZE: usize = 0;
6060

6161
#[cfg(any(target_os = "linux", target_os = "android"))]
62-
unsafe fn siginfo_si_addr(info: *mut libc::siginfo_t) -> *mut libc::c_void {
62+
unsafe fn siginfo_si_addr(info: *mut libc::siginfo_t) -> usize {
6363
#[repr(C)]
6464
struct siginfo_t {
6565
a: [libc::c_int; 3], // si_signo, si_code, si_errno,
6666
si_addr: *mut libc::c_void,
6767
}
6868

69-
(*(info as *const siginfo_t)).si_addr
69+
(*(info as *const siginfo_t)).si_addr as usize
7070
}
7171

7272
#[cfg(not(any(target_os = "linux", target_os = "android")))]
73-
unsafe fn siginfo_si_addr(info: *mut libc::siginfo_t) -> *mut libc::c_void {
74-
(*info).si_addr
73+
unsafe fn siginfo_si_addr(info: *mut libc::siginfo_t) -> usize {
74+
(*info).si_addr as usize
7575
}
7676

7777
// Signal handler for the SIGSEGV and SIGBUS handlers. We've got guard pages
@@ -98,7 +98,7 @@ mod imp {
9898
use sys_common::util::report_overflow;
9999

100100
let guard = thread_info::stack_guard().unwrap_or(0);
101-
let addr = siginfo_si_addr(info) as usize;
101+
let addr = siginfo_si_addr(info);
102102

103103
// If the faulting address is within the guard page, then we print a
104104
// message saying so.

0 commit comments

Comments
 (0)