Skip to content

Commit ed7381b

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 ed7381b

20 files changed

+757
-112
lines changed

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: 13 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",
@@ -225,7 +227,9 @@ impl Entry {
225227
/// See platform `readdir(3)` or `dirent(5)` manpage for when the file type is known;
226228
/// notably, some Linux filesystems don't implement this. The caller should use `stat` or
227229
/// `fstat` if this returns `None`.
230+
#[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
228231
pub fn file_type(&self) -> Option<Type> {
232+
#[cfg(not(target_os = "illumos"))]
229233
match self.0.d_type {
230234
libc::DT_FIFO => Some(Type::Fifo),
231235
libc::DT_CHR => Some(Type::CharacterDevice),
@@ -236,5 +240,14 @@ impl Entry {
236240
libc::DT_SOCK => Some(Type::Socket),
237241
/* libc::DT_UNKNOWN | */ _ => None,
238242
}
243+
244+
// illumos systems do not have the d_type member at all:
245+
#[cfg(target_os = "illumos")]
246+
None
247+
}
248+
249+
#[cfg(any(target_os = "illumos", target_os = "solaris"))]
250+
pub fn file_type(&self) -> Option<Type> {
251+
None
239252
}
240253
}

0 commit comments

Comments
 (0)