Skip to content

Commit 0aed20a

Browse files
pfmooneyThomasdezeeuw
authored andcommitted
Add support for illumos target
1 parent a169a60 commit 0aed20a

File tree

4 files changed

+69
-18
lines changed

4 files changed

+69
-18
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fuchsia-zircon = "0.3.2"
3838
fuchsia-zircon-sys = "0.3.2"
3939

4040
[target.'cfg(unix)'.dependencies]
41-
libc = "0.2.42"
41+
libc = "0.2.54"
4242

4343
[target.'cfg(windows)'.dependencies]
4444
winapi = "0.2.6"

src/sys/unix/mod.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,20 @@ use libc::{self, c_int};
33
#[macro_use]
44
pub mod dlsym;
55

6-
#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris"))]
6+
#[cfg(any(
7+
target_os = "android",
8+
target_os = "illumos",
9+
target_os = "linux",
10+
target_os = "solaris"
11+
))]
712
mod epoll;
813

9-
#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris"))]
14+
#[cfg(any(
15+
target_os = "android",
16+
target_os = "illumos",
17+
target_os = "linux",
18+
target_os = "solaris"
19+
))]
1020
pub use self::epoll::{Events, Selector};
1121

1222
#[cfg(any(target_os = "bitrig", target_os = "dragonfly",

src/sys/unix/ready.rs

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,20 @@ const LIO: usize = 0b10_0000;
109109
#[cfg(not(any(target_os = "freebsd")))]
110110
const LIO: usize = 0b00_0000;
111111

112-
#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris"))]
112+
#[cfg(any(
113+
target_os = "android",
114+
target_os = "illumos",
115+
target_os = "linux",
116+
target_os = "solaris"
117+
))]
113118
const PRI: usize = 0b100_0000;
114119

115-
#[cfg(not(any(target_os = "linux", target_os = "android", target_os = "solaris")))]
120+
#[cfg(not(any(
121+
target_os = "android",
122+
target_os = "illumos",
123+
target_os = "linux",
124+
target_os = "solaris"
125+
)))]
116126
const PRI: usize = 0;
117127

118128
// Export to support `Ready::all`
@@ -129,7 +139,12 @@ fn test_ready_all() {
129139
);
130140

131141
// Issue #896.
132-
#[cfg(any(target_os = "linux", target_os = "android", target_os = "solaris"))]
142+
#[cfg(any(
143+
target_os = "android",
144+
target_os = "illumos",
145+
target_os = "linux",
146+
target_os = "solaris"
147+
))]
133148
assert!(!Ready::from(UnixReady::priority()).is_writable());
134149
}
135150

@@ -258,8 +273,12 @@ impl UnixReady {
258273
///
259274
/// [`Poll`]: struct.Poll.html
260275
#[inline]
261-
#[cfg(any(target_os = "linux",
262-
target_os = "android", target_os = "solaris"))]
276+
#[cfg(any(
277+
target_os = "android",
278+
target_os = "illumos",
279+
target_os = "linux",
280+
target_os = "solaris"
281+
))]
263282
pub fn priority() -> UnixReady {
264283
UnixReady(ready_from_usize(PRI))
265284
}
@@ -385,8 +404,12 @@ impl UnixReady {
385404
///
386405
/// [`Poll`]: struct.Poll.html
387406
#[inline]
388-
#[cfg(any(target_os = "linux",
389-
target_os = "android", target_os = "solaris"))]
407+
#[cfg(any(
408+
target_os = "android",
409+
target_os = "illumos",
410+
target_os = "linux",
411+
target_os = "solaris"
412+
))]
390413
pub fn is_priority(&self) -> bool {
391414
self.contains(ready_from_usize(PRI))
392415
}
@@ -476,8 +499,12 @@ impl fmt::Debug for UnixReady {
476499
(UnixReady::hup(), "Hup"),
477500
#[allow(deprecated)]
478501
(UnixReady::aio(), "Aio"),
479-
#[cfg(any(target_os = "linux",
480-
target_os = "android", target_os = "solaris"))]
502+
#[cfg(any(
503+
target_os = "android",
504+
target_os = "illumos",
505+
target_os = "linux",
506+
target_os = "solaris"
507+
))]
481508
(UnixReady::priority(), "Priority"),
482509
];
483510

test/test_tcp_shutdown.rs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,16 @@ fn test_graceful_shutdown() {
200200
drop(socket);
201201

202202
assert_ready!(poll, Token(0), Ready::readable());
203-
#[cfg(not(any(target_os = "bitrig", target_os = "dragonfly",
204-
target_os = "freebsd", target_os = "ios", target_os = "macos",
205-
target_os = "netbsd", target_os = "openbsd")))]
203+
#[cfg(not(any(
204+
target_os = "bitrig",
205+
target_os = "dragonfly",
206+
target_os = "freebsd",
207+
target_os = "illumos",
208+
target_os = "ios",
209+
target_os = "macos",
210+
target_os = "netbsd",
211+
target_os = "openbsd"
212+
)))]
206213
assert_hup_ready!(poll);
207214

208215
let mut buf = [0; 1024];
@@ -236,9 +243,16 @@ fn test_abrupt_shutdown() {
236243

237244
drop(socket);
238245

239-
#[cfg(not(any(target_os = "bitrig", target_os = "dragonfly",
240-
target_os = "freebsd", target_os = "ios", target_os = "macos",
241-
target_os = "netbsd", target_os = "openbsd")))]
246+
#[cfg(not(any(
247+
target_os = "bitrig",
248+
target_os = "dragonfly",
249+
target_os = "freebsd",
250+
target_os = "illumos",
251+
target_os = "ios",
252+
target_os = "macos",
253+
target_os = "netbsd",
254+
target_os = "openbsd"
255+
)))]
242256
assert_hup_ready!(poll);
243257
assert_ready!(poll, Token(0), Ready::writable());
244258
assert_ready!(poll, Token(0), Ready::readable());

0 commit comments

Comments
 (0)