openbsd support

This commit is contained in:
Sébastien Marie
2015-01-29 08:19:28 +01:00
parent f1f9cb705d
commit fcb30a0b67
43 changed files with 1036 additions and 72 deletions

View File

@@ -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;