Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

illumos and Solaris support #1394

Merged
merged 1 commit into from
Mar 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,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