about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorSébastien Marie <semarie@users.noreply.github.com>2015-01-29 08:19:28 +0100
committerSébastien Marie <semarie@users.noreply.github.com>2015-02-01 14:41:38 +0100
commitfcb30a0b67b1bd4acbc3422ff74fac5d031ae1ae (patch)
tree055fbf1fe9f0b9bd89481f29105fef90370d7789 /src/libstd/sys/unix/stack_overflow.rs
parentf1f9cb705df95171fce4e575374c959509e58dea (diff)
downloadrust-fcb30a0b67b1bd4acbc3422ff74fac5d031ae1ae.tar.gz
rust-fcb30a0b67b1bd4acbc3422ff74fac5d031ae1ae.zip
openbsd support
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
-rw-r--r--src/libstd/sys/unix/stack_overflow.rs23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/libstd/sys/unix/stack_overflow.rs b/src/libstd/sys/unix/stack_overflow.rs
index a526f3393f2..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;
@@ -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,7 +214,10 @@ 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 = 0 as sighandler_t;
 
@@ -220,6 +225,7 @@ mod imp {
 
         // 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;