Skip to content

Commit

Permalink
add illumos support
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jclulow committed Apr 15, 2020
1 parent a55d399 commit 5598eeb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,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;
Expand Down
8 changes: 4 additions & 4 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 = "emscripten")))]
#[cfg(not(any(target_os = "solaris", target_os = "illumos", target_os = "emscripten")))]
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 = "emscripten")))]
#[cfg(not(any(target_os = "solaris", target_os = "illumos", target_os = "emscripten")))]
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 @@ -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<Socket> {
unsafe {
let fd = try!(::cvt(libc::socket(family, ty, 0)));
Expand Down

0 comments on commit 5598eeb

Please sign in to comment.