From c63a4b4bb59092c4bc8f3dd361d7f57afd02b53a Mon Sep 17 00:00:00 2001 From: "Joshua M. Clulow" Date: Mon, 13 Apr 2020 22:31:15 -0700 Subject: [PATCH] add illumos support Previously, illumos systems used the "x86_64-sun-solaris" host triple. Now that we're getting an "x86_64-unknown-illumos" triple, we need to add new target_os conditionals for illumos. --- 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 023ff1c..ed49b67 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -65,7 +65,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..0059596 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)));