Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add illumos support #101

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 5 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
html_root_url = "https://doc.rust-lang.org/net2-rs")]
#![deny(missing_docs, warnings)]

// Allow the use of the deprecated try! macro so that this still builds on newer
// Rust compilers for now:
#![allow(deprecated)]

#![cfg_attr(target_os = "wasi", feature(wasi_ext))]

#[cfg(any(target_os = "redox", target_os = "wasi", unix))] extern crate libc;
Expand All @@ -65,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