diff options
| author | Sébastien Marie <semarie@users.noreply.github.com> | 2015-12-23 11:32:02 +0100 |
|---|---|---|
| committer | Sébastien Marie <semarie@users.noreply.github.com> | 2016-01-12 08:43:52 +0100 |
| commit | a545eac593b0ff3a6ad6c2d8390de51c30712089 (patch) | |
| tree | 9d008d3815e5aee7a14726eaf49f184f33306f8f /src/libstd/sys/unix/stack_overflow.rs | |
| parent | 468959580ae9bef5996ae1d43fc9d730e4977999 (diff) | |
| download | rust-a545eac593b0ff3a6ad6c2d8390de51c30712089.tar.gz rust-a545eac593b0ff3a6ad6c2d8390de51c30712089.zip | |
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`.
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
| -rw-r--r-- | src/libstd/sys/unix/stack_overflow.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs index 776acd20b06..fc49f4257be 100644 --- a/src/libstd/sys/unix/stack_overflow.rs +++ b/src/libstd/sys/unix/stack_overflow.rs @@ -59,19 +59,19 @@ mod imp { static mut PAGE_SIZE: usize = 0; #[cfg(any(target_os = "linux", target_os = "android"))] - unsafe fn siginfo_si_addr(info: *mut libc::siginfo_t) -> *mut libc::c_void { + unsafe fn siginfo_si_addr(info: *mut libc::siginfo_t) -> usize { #[repr(C)] struct siginfo_t { a: [libc::c_int; 3], // si_signo, si_code, si_errno, si_addr: *mut libc::c_void, } - (*(info as *const siginfo_t)).si_addr + (*(info as *const siginfo_t)).si_addr as usize } #[cfg(not(any(target_os = "linux", target_os = "android")))] - unsafe fn siginfo_si_addr(info: *mut libc::siginfo_t) -> *mut libc::c_void { - (*info).si_addr + unsafe fn siginfo_si_addr(info: *mut libc::siginfo_t) -> usize { + (*info).si_addr as usize } // Signal handler for the SIGSEGV and SIGBUS handlers. We've got guard pages @@ -98,7 +98,7 @@ mod imp { use sys_common::util::report_overflow; let guard = thread_info::stack_guard().unwrap_or(0); - let addr = siginfo_si_addr(info) as usize; + let addr = siginfo_si_addr(info); // If the faulting address is within the guard page, then we print a // message saying so. |
