Skip to content

Commit

Permalink
Add support for Haiku
Browse files Browse the repository at this point in the history
  • Loading branch information
nielx committed Aug 18, 2020
1 parent 1e91530 commit eeeab13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use socket;
cfg_if! {
if #[cfg(any(target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
Expand Down Expand Up @@ -667,7 +668,7 @@ impl<T: AsRawSocket> AsSock for T {
cfg_if! {
if #[cfg(any(target_os = "macos", target_os = "ios"))] {
use libc::TCP_KEEPALIVE as KEEPALIVE_OPTION;
} else if #[cfg(any(target_os = "openbsd", target_os = "netbsd"))] {
} else if #[cfg(any(target_os = "haiku", target_os = "netbsd", target_os = "openbsd"))] {
use libc::SO_KEEPALIVE as KEEPALIVE_OPTION;
} else if #[cfg(unix)] {
use libc::TCP_KEEPIDLE as KEEPALIVE_OPTION;
Expand Down
6 changes: 3 additions & 3 deletions src/sys/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::mem;
use std::net::{TcpListener, TcpStream, UdpSocket};
use std::os::unix::io::FromRawFd;
use libc::{self, c_int};
#[cfg(not(any(target_os = "solaris", target_os = "illumos", target_os = "emscripten")))]
#[cfg(not(any(target_os = "emscripten", target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
use libc::{ioctl, FIOCLEX};

mod impls;
Expand All @@ -36,7 +36,7 @@ pub struct Socket {
}

impl Socket {
#[cfg(not(any(target_os = "solaris", target_os = "illumos", target_os = "emscripten")))]
#[cfg(not(any(target_os = "emscripten", target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
pub fn new(family: c_int, ty: c_int) -> io::Result<Socket> {
unsafe {
// Linux >2.6.26 overloads the type argument to accept SOCK_CLOEXEC,
Expand All @@ -58,7 +58,7 @@ impl Socket {

// ioctl(FIOCLEX) is not supported by Solaris/illumos or emscripten,
// use fcntl(FD_CLOEXEC) instead
#[cfg(any(target_os = "solaris", target_os = "illumos", target_os = "emscripten"))]
#[cfg(any(target_os = "emscripten", target_os = "haiku", target_os = "illumos", target_os = "solaris"))]
pub fn new(family: c_int, ty: c_int) -> io::Result<Socket> {
unsafe {
let fd = try!(::cvt(libc::socket(family, ty, 0)));
Expand Down

0 comments on commit eeeab13

Please sign in to comment.