Skip to content

Commit

Permalink
Add support for illumos target
Browse files Browse the repository at this point in the history
  • Loading branch information
pfmooney committed May 1, 2020
1 parent 3350e38 commit 24f41cb
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 @@ -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;
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 24f41cb

Please sign in to comment.