Skip to content

Commit 936b100

Browse files
jasonbkinghadfljclulow
committed
illumos and Solaris support
Co-authored-by: Dominik Hassler <[email protected]> Co-authored-by: Joshua M. Clulow <[email protected]>
1 parent b728663 commit 936b100

File tree

20 files changed

+671
-111
lines changed

20 files changed

+671
-111
lines changed

.cirrus.yml

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

188+
# illumos toolchain isn't available via rustup until 1.50
189+
task:
190+
name: illumos
191+
env:
192+
TARGET: x86_64-unknown-illumos
193+
container:
194+
image: rust:1.50
195+
setup_script:
196+
- rustup target add $TARGET
197+
script:
198+
- cargo +$TOOLCHAIN check --target $TARGET
199+
- cargo +$TOOLCHAIN check --target $TARGET --release
200+
before_cache_script: rm -rf $CARGO_HOME/registry/index
201+
188202
# Redoxer is too unreliable, so we'll do a cross-build only
189203
# See also:
190204
# 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)