Skip to content

Commit fde9ebc

Browse files
Merge #1394
1394: illumos and Solaris support r=asomers a=jasonbking Adds support for the illumos target as well as improvements in the existing Solaris support. Co-authored-by: Dominik Hassler <hadfl@omnios.org> Co-authored-by: Joshua M. Clulow <josh@sysmgr.org> Co-authored-by: Jason King <jason.brian.king@gmail.com>
2 parents 7b3129a + d444f1b commit fde9ebc

20 files changed

+671
-111
lines changed

.cirrus.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,20 @@ task:
182182
# they don't build on all platforms.
183183
before_cache_script: rm -rf $CARGO_HOME/registry/index
184184

185+
# illumos toolchain isn't available via rustup until 1.50
186+
task:
187+
name: illumos
188+
env:
189+
TARGET: x86_64-unknown-illumos
190+
container:
191+
image: rust:1.50
192+
setup_script:
193+
- rustup target add $TARGET
194+
script:
195+
- cargo +$TOOLCHAIN check --target $TARGET
196+
- cargo +$TOOLCHAIN check --target $TARGET --release
197+
before_cache_script: rm -rf $CARGO_HOME/registry/index
198+
185199
# Redoxer is too unreliable, so we'll do a cross-build only
186200
# See also:
187201
# https://github.com/nix-rust/nix/issues/1258

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ targets = [
2727
"x86_64-unknown-netbsd",
2828
"x86_64-unknown-dragonfly",
2929
"x86_64-fuchsia",
30-
"x86_64-unknown-redox"
30+
"x86_64-unknown-redox",
31+
"x86_64-unknown-illumos"
3132
]
3233

3334
[dependencies]

src/dir.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ impl Entry {
192192
target_os = "emscripten",
193193
target_os = "fuchsia",
194194
target_os = "haiku",
195+
target_os = "illumos",
195196
target_os = "ios",
196197
target_os = "l4re",
197198
target_os = "linux",
@@ -206,6 +207,7 @@ impl Entry {
206207
target_os = "emscripten",
207208
target_os = "fuchsia",
208209
target_os = "haiku",
210+
target_os = "illumos",
209211
target_os = "ios",
210212
target_os = "l4re",
211213
target_os = "linux",
@@ -226,6 +228,7 @@ impl Entry {
226228
/// notably, some Linux filesystems don't implement this. The caller should use `stat` or
227229
/// `fstat` if this returns `None`.
228230
pub fn file_type(&self) -> Option<Type> {
231+
#[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
229232
match self.0.d_type {
230233
libc::DT_FIFO => Some(Type::Fifo),
231234
libc::DT_CHR => Some(Type::CharacterDevice),
@@ -236,5 +239,9 @@ impl Entry {
236239
libc::DT_SOCK => Some(Type::Socket),
237240
/* libc::DT_UNKNOWN | */ _ => None,
238241
}
242+
243+
// illumos and Solaris systems do not have the d_type member at all:
244+
#[cfg(any(target_os = "illumos", target_os = "solaris"))]
245+
None
239246
}
240247
}

0 commit comments

Comments
 (0)