Skip to content

Commit

Permalink
illumos and Solaris support
Browse files Browse the repository at this point in the history
Co-authored-by: Dominik Hassler <[email protected]>
Co-authored-by: Joshua M. Clulow <[email protected]>
  • Loading branch information
3 people committed Mar 6, 2021
1 parent b728663 commit 936b100
Show file tree
Hide file tree
Showing 20 changed files with 671 additions and 111 deletions.
14 changes: 14 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,20 @@ task:
# they don't build on all platforms.
before_cache_script: rm -rf $CARGO_HOME/registry/index

# illumos toolchain isn't available via rustup until 1.50
task:
name: illumos
env:
TARGET: x86_64-unknown-illumos
container:
image: rust:1.50
setup_script:
- rustup target add $TARGET
script:
- cargo +$TOOLCHAIN check --target $TARGET
- cargo +$TOOLCHAIN check --target $TARGET --release
before_cache_script: rm -rf $CARGO_HOME/registry/index

# Redoxer is too unreliable, so we'll do a cross-build only
# See also:
# https://github.com/nix-rust/nix/issues/1258
Expand Down
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ targets = [
"x86_64-unknown-netbsd",
"x86_64-unknown-dragonfly",
"x86_64-fuchsia",
"x86_64-unknown-redox"
"x86_64-unknown-redox",
"x86_64-unknown-illumos"
]

[dependencies]
Expand Down
7 changes: 7 additions & 0 deletions src/dir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ impl Entry {
target_os = "emscripten",
target_os = "fuchsia",
target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "l4re",
target_os = "linux",
Expand All @@ -206,6 +207,7 @@ impl Entry {
target_os = "emscripten",
target_os = "fuchsia",
target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "l4re",
target_os = "linux",
Expand All @@ -226,6 +228,7 @@ impl Entry {
/// notably, some Linux filesystems don't implement this. The caller should use `stat` or
/// `fstat` if this returns `None`.
pub fn file_type(&self) -> Option<Type> {
#[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
match self.0.d_type {
libc::DT_FIFO => Some(Type::Fifo),
libc::DT_CHR => Some(Type::CharacterDevice),
Expand All @@ -236,5 +239,9 @@ impl Entry {
libc::DT_SOCK => Some(Type::Socket),
/* libc::DT_UNKNOWN | */ _ => None,
}

// illumos and Solaris systems do not have the d_type member at all:
#[cfg(any(target_os = "illumos", target_os = "solaris"))]
None
}
}
Loading

0 comments on commit 936b100

Please sign in to comment.