diff options
author | Laurence Tratt <laurie@tratt.net> | 2015-05-29 16:32:54 +0059 |
---|---|---|
committer | Laurence Tratt <laurie@tratt.net> | 2015-05-29 16:32:54 +0059 |
commit | 30d02b88a033cf0e9bb0fd1adb4d81c5c8dc3437 (patch) | |
tree | 5f3e4d345f796ef9df55f3c4b7f3b262878214e5 /src/sys | |
parent | e2b08fad9c3334e2791aebc28fa1d71d0f76112b (diff) | |
download | nix-30d02b88a033cf0e9bb0fd1adb4d81c5c8dc3437.zip |
Basic OpenBSD support.
Some of the tests are currently unrunnable, but the basic library is at least
buildable.
Diffstat (limited to 'src/sys')
-rw-r--r-- | src/sys/ioctl.rs | 1 | ||||
-rw-r--r-- | src/sys/mman.rs | 2 | ||||
-rw-r--r-- | src/sys/mod.rs | 2 | ||||
-rw-r--r-- | src/sys/signal.rs | 10 | ||||
-rw-r--r-- | src/sys/socket/consts.rs | 2 | ||||
-rw-r--r-- | src/sys/termios.rs | 4 |
6 files changed, 15 insertions, 6 deletions
diff --git a/src/sys/ioctl.rs b/src/sys/ioctl.rs index d295d08d..0a2a3451 100644 --- a/src/sys/ioctl.rs +++ b/src/sys/ioctl.rs @@ -82,6 +82,7 @@ pub type ioctl_op_t = c_ulong; #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", + target_os = "openbsd", target_os = "dragonfly"))] type os_ioctl_op_t = c_ulong; diff --git a/src/sys/mman.rs b/src/sys/mman.rs index 0815b618..54f256b2 100644 --- a/src/sys/mman.rs +++ b/src/sys/mman.rs @@ -113,7 +113,7 @@ mod consts { pub const MAP_FAILED: isize = -1; } -#[cfg(target_os = "freebsd")] +#[cfg(any(target_os = "freebsd", target_os = "openbsd"))] mod consts { use libc::c_int; diff --git a/src/sys/mod.rs b/src/sys/mod.rs index f0fda20a..ac9d6216 100644 --- a/src/sys/mod.rs +++ b/src/sys/mod.rs @@ -2,7 +2,7 @@ #[cfg(any(target_os = "linux", target_os = "android"))] pub mod epoll; -#[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd"))] +#[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", target_os = "openbsd"))] pub mod event; // TODO: switch from feature flags to conditional builds diff --git a/src/sys/signal.rs b/src/sys/signal.rs index 8f3ecdcf..f777841b 100644 --- a/src/sys/signal.rs +++ b/src/sys/signal.rs @@ -201,6 +201,7 @@ pub mod signal { #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", + target_os = "openbsd", target_os = "dragonfly"))] pub mod signal { use libc; @@ -238,7 +239,7 @@ pub mod signal { pub const SIGUSR1: libc::c_int = 30; pub const SIGUSR2: libc::c_int = 31; - #[cfg(any(target_os = "macos", target_os = "ios"))] + #[cfg(any(target_os = "macos", target_os = "ios", target_os = "openbsd"))] pub type sigset_t = u32; #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] #[repr(C)] @@ -278,6 +279,13 @@ pub mod signal { pub sa_mask: sigset_t, } + #[cfg(target_os = "openbsd")] + #[repr(C)] + pub struct sigaction { + pub sa_handler: extern fn(libc::c_int), + pub sa_mask: sigset_t, + pub sa_flags: SockFlag, + } } mod ffi { diff --git a/src/sys/socket/consts.rs b/src/sys/socket/consts.rs index caa06fff..a716b1ab 100644 --- a/src/sys/socket/consts.rs +++ b/src/sys/socket/consts.rs @@ -96,7 +96,7 @@ mod os { } // Not all of these constants exist on freebsd -#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "ios"))] +#[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "ios", target_os = "openbsd"))] mod os { use libc::{c_int, uint8_t}; diff --git a/src/sys/termios.rs b/src/sys/termios.rs index 7473eab4..4050e7d5 100644 --- a/src/sys/termios.rs +++ b/src/sys/termios.rs @@ -17,7 +17,7 @@ mod ffi { // `Termios` contains bitflags which are not considered // `foreign-function-safe` by the compiler. #[allow(improper_ctypes)] - #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "linux"))] + #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd", target_os = "linux"))] extern { pub fn cfgetispeed(termios: *const Termios) -> speed_t; pub fn cfgetospeed(termios: *const Termios) -> speed_t; @@ -89,7 +89,7 @@ mod ffi { pub use self::android::*; - #[cfg(any(target_os = "macos", target_os = "freebsd"))] + #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "openbsd"))] pub mod consts { use libc::{c_int, c_ulong, c_uchar}; |