diff --git a/src/dir.rs b/src/dir.rs index 6dec1525d5..b42321f1f8 100644 --- a/src/dir.rs +++ b/src/dir.rs @@ -225,15 +225,13 @@ impl Entry { pub fn ino(&self) -> u64 { cfg_if! { if #[cfg(any(target_os = "aix", - target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "haiku", - target_os = "illumos", + solarish, + linux_android, apple_targets, - target_os = "l4re", - target_os = "linux", - target_os = "solaris"))] { + target_os = "l4re"))] { self.0.d_ino as u64 } else { u64::from(self.0.d_fileno) @@ -252,12 +250,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 { - #[cfg(not(any( - target_os = "aix", - target_os = "illumos", - target_os = "solaris", - target_os = "haiku" - )))] + #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))] match self.0.d_type { libc::DT_FIFO => Some(Type::Fifo), libc::DT_CHR => Some(Type::CharacterDevice), @@ -270,12 +263,7 @@ impl Entry { } // illumos, Solaris, and Haiku systems do not have the d_type member at all: - #[cfg(any( - target_os = "aix", - target_os = "illumos", - target_os = "solaris", - target_os = "haiku" - ))] + #[cfg(any(solarish, target_os = "aix", target_os = "haiku"))] None } } diff --git a/src/env.rs b/src/env.rs index e4ad0a628a..510bbb0924 100644 --- a/src/env.rs +++ b/src/env.rs @@ -40,11 +40,10 @@ impl std::error::Error for ClearEnvError {} /// thread safety must still be upheld. pub unsafe fn clearenv() -> std::result::Result<(), ClearEnvError> { cfg_if! { - if #[cfg(any(target_os = "fuchsia", + if #[cfg(any(linux_android, + target_os = "fuchsia", target_os = "wasi", target_env = "uclibc", - target_os = "linux", - target_os = "android", target_os = "emscripten"))] { let ret = unsafe { libc::clearenv() }; } else { diff --git a/src/errno.rs b/src/errno.rs index f4f982e23d..555c07bacd 100644 --- a/src/errno.rs +++ b/src/errno.rs @@ -224,467 +224,239 @@ fn desc(errno: Errno) -> &'static str { EHOSTUNREACH => "No route to host", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, + solarish, target_os = "aix", - target_os = "illumos", - target_os = "solaris", target_os = "fuchsia" ))] ECHRNG => "Channel number out of range", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, + solarish, target_os = "aix", - target_os = "illumos", - target_os = "solaris", target_os = "fuchsia" ))] EL2NSYNC => "Level 2 not synchronized", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, + solarish, target_os = "aix", - target_os = "illumos", - target_os = "solaris", target_os = "fuchsia" ))] EL3HLT => "Level 3 halted", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, + solarish, target_os = "aix", - target_os = "illumos", - target_os = "solaris", target_os = "fuchsia" ))] EL3RST => "Level 3 reset", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, + solarish, target_os = "aix", - target_os = "illumos", - target_os = "solaris", target_os = "fuchsia" ))] ELNRNG => "Link number out of range", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, + solarish, target_os = "aix", - target_os = "illumos", - target_os = "solaris", target_os = "fuchsia" ))] EUNATCH => "Protocol driver not attached", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, + solarish, target_os = "aix", - target_os = "illumos", - target_os = "solaris", target_os = "fuchsia" ))] ENOCSI => "No CSI structure available", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, + solarish, target_os = "aix", - target_os = "illumos", - target_os = "solaris", target_os = "fuchsia" ))] EL2HLT => "Level 2 halted", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] EBADE => "Invalid exchange", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] EBADR => "Invalid request descriptor", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] EXFULL => "Exchange full", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] ENOANO => "No anode", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] EBADRQC => "Invalid request code", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] EBADSLT => "Invalid slot", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] EBFONT => "Bad font file format", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] ENOSTR => "Device not a stream", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] ENODATA => "No data available", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] ETIME => "Timer expired", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] ENOSR => "Out of streams resources", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] ENONET => "Machine is not on the network", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] ENOPKG => "Package not installed", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] EREMOTE => "Object is remote", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, + solarish, target_os = "aix", - target_os = "illumos", - target_os = "solaris", target_os = "fuchsia" ))] ENOLINK => "Link has been severed", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] EADV => "Advertise error", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] ESRMNT => "Srmount error", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] ECOMM => "Communication error on send", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, + solarish, target_os = "aix", - target_os = "illumos", - target_os = "solaris", target_os = "fuchsia" ))] EPROTO => "Protocol error", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, + solarish, target_os = "aix", - target_os = "illumos", - target_os = "solaris", target_os = "fuchsia" ))] EMULTIHOP => "Multihop attempted", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, target_os = "fuchsia"))] EDOTDOT => "RFS specific error", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "aix", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, target_os = "aix", target_os = "fuchsia"))] EBADMSG => "Not a data message", #[cfg(solarish)] EBADMSG => "Trying to read unreadable message", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, target_os = "aix", target_os = "fuchsia", target_os = "haiku" ))] EOVERFLOW => "Value too large for defined data type", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] ENOTUNIQ => "Name not unique on network", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] EBADFD => "File descriptor in bad state", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] EREMCHG => "Remote address changed", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] ELIBACC => "Can not access a needed shared library", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] ELIBBAD => "Accessing a corrupted shared library", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] ELIBSCN => ".lib section in a.out corrupted", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] ELIBMAX => "Attempting to link in too many shared libraries", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] ELIBEXEC => "Cannot exec a shared library directly", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, + solarish, target_os = "aix", - target_os = "illumos", - target_os = "solaris", target_os = "fuchsia", target_os = "openbsd" ))] EILSEQ => "Illegal byte sequence", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, + solarish, target_os = "aix", - target_os = "illumos", - target_os = "solaris", target_os = "fuchsia" ))] ERESTART => "Interrupted system call should be restarted", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] ESTRPIPE => "Streams pipe error", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, solarish, target_os = "fuchsia"))] EUSERS => "Too many users", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, target_os = "fuchsia", target_os = "netbsd", target_os = "redox" ))] EOPNOTSUPP => "Operation not supported on transport endpoint", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, target_os = "fuchsia"))] ESTALE => "Stale file handle", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, target_os = "fuchsia"))] EUCLEAN => "Structure needs cleaning", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, target_os = "fuchsia"))] ENOTNAM => "Not a XENIX named type file", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, target_os = "fuchsia"))] ENAVAIL => "No XENIX semaphores available", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, target_os = "fuchsia"))] EISNAM => "Is a named type file", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, target_os = "fuchsia"))] EREMOTEIO => "Remote I/O error", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, target_os = "fuchsia"))] EDQUOT => "Quota exceeded", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, target_os = "fuchsia", target_os = "openbsd", target_os = "dragonfly" @@ -692,68 +464,39 @@ fn desc(errno: Errno) -> &'static str { ENOMEDIUM => "No medium found", #[cfg(any( - target_os = "linux", - target_os = "android", + linux_android, target_os = "fuchsia", target_os = "openbsd" ))] EMEDIUMTYPE => "Wrong medium type", #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "illumos", - target_os = "solaris", + linux_android, + solarish, target_os = "fuchsia", target_os = "haiku" ))] ECANCELED => "Operation canceled", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, target_os = "fuchsia"))] ENOKEY => "Required key not available", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, target_os = "fuchsia"))] EKEYEXPIRED => "Key has expired", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, target_os = "fuchsia"))] EKEYREVOKED => "Key has been revoked", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, target_os = "fuchsia"))] EKEYREJECTED => "Key was rejected by service", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "aix", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, target_os = "aix", target_os = "fuchsia"))] EOWNERDEAD => "Owner died", #[cfg(solarish)] EOWNERDEAD => "Process died with lock", - #[cfg(any( - target_os = "linux", - target_os = "android", - target_os = "aix", - target_os = "fuchsia" - ))] + #[cfg(any(linux_android, target_os = "aix", target_os = "fuchsia"))] ENOTRECOVERABLE => "State not recoverable", #[cfg(solarish)] @@ -771,21 +514,13 @@ fn desc(errno: Errno) -> &'static str { ))] EHWPOISON => "Memory page has hardware error", - #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] + #[cfg(freebsdlike)] EDOOFUS => "Programming error", - #[cfg(any( - target_os = "freebsd", - target_os = "dragonfly", - target_os = "redox" - ))] + #[cfg(any(freebsdlike, target_os = "redox"))] EMULTIHOP => "Multihop attempted", - #[cfg(any( - target_os = "freebsd", - target_os = "dragonfly", - target_os = "redox" - ))] + #[cfg(any(freebsdlike, target_os = "redox"))] ENOLINK => "Link has been severed", #[cfg(target_os = "freebsd")] @@ -801,8 +536,7 @@ fn desc(errno: Errno) -> &'static str { EOVERFLOW => "Value too large to be stored in data type", #[cfg(any( - target_os = "freebsd", - target_os = "dragonfly", + freebsdlike, apple_targets, target_os = "netbsd", target_os = "redox", @@ -819,20 +553,10 @@ fn desc(errno: Errno) -> &'static str { #[cfg(any(bsd, target_os = "redox", target_os = "haiku"))] EPROTO => "Protocol error", - #[cfg(any( - target_os = "freebsd", - target_os = "dragonfly", - apple_targets, - target_os = "openbsd" - ))] + #[cfg(any(freebsdlike, apple_targets, target_os = "openbsd"))] ENOTRECOVERABLE => "State not recoverable", - #[cfg(any( - target_os = "freebsd", - target_os = "dragonfly", - apple_targets, - target_os = "openbsd" - ))] + #[cfg(any(freebsdlike, apple_targets, target_os = "openbsd"))] EOWNERDEAD => "Previous owner died", #[cfg(any(bsd, target_os = "aix", solarish, target_os = "haiku"))] @@ -846,20 +570,18 @@ fn desc(errno: Errno) -> &'static str { #[cfg(any( bsd, + solarish, target_os = "redox", target_os = "aix", - target_os = "illumos", - target_os = "solaris", target_os = "haiku" ))] EDQUOT => "Disc quota exceeded", #[cfg(any( bsd, + solarish, target_os = "redox", target_os = "aix", - target_os = "illumos", - target_os = "solaris", target_os = "haiku" ))] ESTALE => "Stale NFS file handle", @@ -947,12 +669,7 @@ fn desc(errno: Errno) -> &'static str { ))] ETIME => "STREAM ioctl timeout", - #[cfg(any( - apple_targets, - target_os = "aix", - target_os = "illumos", - target_os = "solaris" - ))] + #[cfg(any(apple_targets, solarish, target_os = "aix"))] EOPNOTSUPP => "Operation not supported on socket", #[cfg(apple_targets)] @@ -981,7 +698,7 @@ fn desc(errno: Errno) -> &'static str { } } -#[cfg(any(target_os = "linux", target_os = "android", target_os = "fuchsia"))] +#[cfg(any(linux_android, target_os = "fuchsia"))] mod consts { #[derive(Clone, Copy, Debug, Eq, PartialEq)] #[repr(i32)]