From 24f41cbb7368a47a7c536cd8ec0667ad98aef301 Mon Sep 17 00:00:00 2001 From: Patrick Mooney Date: Tue, 14 Apr 2020 02:54:20 +0000 Subject: [PATCH] Add support for illumos target --- src/ext.rs | 1 + src/lib.rs | 2 +- src/sys/unix/mod.rs | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ext.rs b/src/ext.rs index 2cc18e0..e788601 100644 --- a/src/ext.rs +++ b/src/ext.rs @@ -28,6 +28,7 @@ cfg_if! { target_os = "netbsd", target_os = "openbsd", target_os = "solaris", + target_os = "illumos", target_env = "uclibc"))] { use libc::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP; use libc::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP; diff --git a/src/lib.rs b/src/lib.rs index f62325b..fcbb7b4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -68,7 +68,7 @@ mod utils; #[cfg(unix)] #[path = "sys/unix/mod.rs"] mod sys; #[cfg(windows)] #[path = "sys/windows/mod.rs"] mod sys; #[cfg(target_os = "wasi")] #[path = "sys/wasi/mod.rs"] mod sys; -#[cfg(all(unix, not(any(target_os = "solaris"))))] pub mod unix; +#[cfg(all(unix, not(any(target_os = "solaris", target_os = "illumos"))))] pub mod unix; pub use tcp::TcpBuilder; pub use udp::UdpBuilder; diff --git a/src/sys/unix/mod.rs b/src/sys/unix/mod.rs index e13f97c..3351356 100644 --- a/src/sys/unix/mod.rs +++ b/src/sys/unix/mod.rs @@ -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 = "emscripten")))] +#[cfg(not(any(target_os = "solaris", target_os = "illumos", target_os = "emscripten")))] use libc::{ioctl, FIOCLEX}; mod impls; @@ -36,7 +36,7 @@ pub struct Socket { } impl Socket { - #[cfg(not(any(target_os = "solaris", target_os = "emscripten")))] + #[cfg(not(any(target_os = "solaris", target_os = "illumos", target_os = "emscripten")))] pub fn new(family: c_int, ty: c_int) -> io::Result { unsafe { // Linux >2.6.26 overloads the type argument to accept SOCK_CLOEXEC, @@ -56,9 +56,9 @@ impl Socket { } } - // ioctl(FIOCLEX) is not supported by Solaris/Illumos or emscripten, + // ioctl(FIOCLEX) is not supported by Solaris/illumos or emscripten, // use fcntl(FD_CLOEXEC) instead - #[cfg(any(target_os = "solaris", target_os = "emscripten"))] + #[cfg(any(target_os = "solaris", target_os = "illumos", target_os = "emscripten"))] pub fn new(family: c_int, ty: c_int) -> io::Result { unsafe { let fd = try!(::cvt(libc::socket(family, ty, 0)));