Skip to content

Commit 230d413

Browse files
authored
Add support for illumos target (#54)
1 parent 8a55a00 commit 230d413

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

src/socket.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,11 @@ impl Socket {
709709
///
710710
/// This function is only available on Unix when the `reuseport` feature is
711711
/// enabled.
712-
#[cfg(all(unix, not(target_os = "solaris"), feature = "reuseport"))]
712+
#[cfg(all(
713+
unix,
714+
not(any(target_os = "solaris", target_os = "illumos")),
715+
feature = "reuseport"
716+
))]
713717
pub fn reuse_port(&self) -> io::Result<bool> {
714718
self.inner.reuse_port()
715719
}
@@ -722,7 +726,11 @@ impl Socket {
722726
///
723727
/// This function is only available on Unix when the `reuseport` feature is
724728
/// enabled.
725-
#[cfg(all(unix, not(target_os = "solaris"), feature = "reuseport"))]
729+
#[cfg(all(
730+
unix,
731+
not(any(target_os = "solaris", target_os = "illumos")),
732+
feature = "reuseport"
733+
))]
726734
pub fn set_reuse_port(&self, reuse: bool) -> io::Result<()> {
727735
self.inner.set_reuse_port(reuse)
728736
}

src/sys/unix.rs

+12-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ cfg_if::cfg_if! {
2828
if #[cfg(any(target_os = "dragonfly", target_os = "freebsd",
2929
target_os = "ios", target_os = "macos",
3030
target_os = "openbsd", target_os = "netbsd",
31-
target_os = "solaris", target_os = "haiku"))] {
31+
target_os = "solaris", target_os = "illumos",
32+
target_os = "haiku"))] {
3233
use libc::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP;
3334
use libc::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP;
3435
} else {
@@ -727,15 +728,23 @@ impl Socket {
727728
}
728729
}
729730

730-
#[cfg(all(unix, not(target_os = "solaris"), feature = "reuseport"))]
731+
#[cfg(all(
732+
unix,
733+
not(any(target_os = "solaris", target_os = "illumos")),
734+
feature = "reuseport"
735+
))]
731736
pub fn reuse_port(&self) -> io::Result<bool> {
732737
unsafe {
733738
let raw: c_int = self.getsockopt(libc::SOL_SOCKET, libc::SO_REUSEPORT)?;
734739
Ok(raw != 0)
735740
}
736741
}
737742

738-
#[cfg(all(unix, not(target_os = "solaris"), feature = "reuseport"))]
743+
#[cfg(all(
744+
unix,
745+
not(any(target_os = "solaris", target_os = "illumos")),
746+
feature = "reuseport"
747+
))]
739748
pub fn set_reuse_port(&self, reuse: bool) -> io::Result<()> {
740749
unsafe { self.setsockopt(libc::SOL_SOCKET, libc::SO_REUSEPORT, reuse as c_int) }
741750
}

0 commit comments

Comments
 (0)