diff options
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
| -rw-r--r-- | src/libstd/sys/unix/stack_overflow.rs | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs index 2b5ced5085b..3512fa36eb3 100644 --- a/src/libstd/sys/unix/stack_overflow.rs +++ b/src/libstd/sys/unix/stack_overflow.rs @@ -32,7 +32,9 @@ impl Drop for Handler { } } -#[cfg(any(target_os = "linux", target_os = "macos"))] +#[cfg(any(target_os = "linux", + target_os = "macos", + target_os = "openbsd"))] mod imp { use core::prelude::*; use sys_common::stack; @@ -162,7 +164,7 @@ mod imp { pub static SIGSTKSZ: libc::size_t = 8192; - pub const SIG_DFL: sighandler_t = 0i as sighandler_t; + pub const SIG_DFL: sighandler_t = 0 as sighandler_t; // This definition is not as accurate as it could be, {si_addr} is // actually a giant union. Currently we're only interested in that field, @@ -203,7 +205,7 @@ mod imp { } - #[cfg(target_os = "macos")] + #[cfg(any(target_os = "macos", target_os = "openbsd"))] mod signal { use libc; use super::sighandler_t; @@ -212,14 +214,18 @@ mod imp { pub const SA_SIGINFO: libc::c_int = 0x0040; pub const SIGBUS: libc::c_int = 10; + #[cfg(target_os = "macos")] pub const SIGSTKSZ: libc::size_t = 131072; + #[cfg(target_os = "openbsd")] + pub const SIGSTKSZ: libc::size_t = 40960; - pub const SIG_DFL: sighandler_t = 0i as sighandler_t; + pub const SIG_DFL: sighandler_t = 0 as sighandler_t; pub type sigset_t = u32; // This structure has more fields, but we're not all that interested in // them. + #[cfg(target_os = "macos")] #[repr(C)] pub struct siginfo { pub si_signo: libc::c_int, @@ -231,6 +237,16 @@ mod imp { pub si_addr: *mut libc::c_void } + #[cfg(target_os = "openbsd")] + #[repr(C)] + pub struct siginfo { + pub si_signo: libc::c_int, + pub si_code: libc::c_int, + pub si_errno: libc::c_int, + // union + pub si_addr: *mut libc::c_void, + } + #[repr(C)] pub struct sigaltstack { pub ss_sp: *mut libc::c_void, @@ -260,7 +276,8 @@ mod imp { } #[cfg(not(any(target_os = "linux", - target_os = "macos")))] + target_os = "macos", + target_os = "openbsd")))] mod imp { use libc; @@ -271,7 +288,7 @@ mod imp { } pub unsafe fn make_handler() -> super::Handler { - super::Handler { _data: 0i as *mut libc::c_void } + super::Handler { _data: 0 as *mut libc::c_void } } pub unsafe fn drop_handler(_handler: &mut super::Handler) { |
