diff --git a/Cargo.toml b/Cargo.toml index 8456ad7c48..35af931388 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ exclude = [ ] [dependencies] -libc = { version = "0.2.73", features = [ "extra_traits" ] } +libc = { version = "0.2.74", features = [ "extra_traits" ] } bitflags = "1.1" cfg-if = "0.1.10" diff --git a/src/errno.rs b/src/errno.rs index eda097d883..f39834fe0e 100644 --- a/src/errno.rs +++ b/src/errno.rs @@ -38,7 +38,8 @@ cfg_if! { unsafe fn errno_location() -> *mut c_int { libc::__errno() } - } else if #[cfg(any(target_os = "linux", target_os = "redox"))] { + } else if #[cfg(any(target_os = "linux", target_os = "redox", + target_os = "fuchsia"))] { unsafe fn errno_location() -> *mut c_int { libc::__errno_location() } @@ -206,192 +207,254 @@ fn desc(errno: Errno) -> &'static str { EHOSTDOWN => "Host is down", EHOSTUNREACH => "No route to host", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ECHRNG => "Channel number out of range", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EL2NSYNC => "Level 2 not synchronized", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EL3HLT => "Level 3 halted", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EL3RST => "Level 3 reset", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ELNRNG => "Link number out of range", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EUNATCH => "Protocol driver not attached", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ENOCSI => "No CSI structure available", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EL2HLT => "Level 2 halted", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EBADE => "Invalid exchange", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EBADR => "Invalid request descriptor", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EXFULL => "Exchange full", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ENOANO => "No anode", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EBADRQC => "Invalid request code", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EBADSLT => "Invalid slot", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EBFONT => "Bad font file format", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ENOSTR => "Device not a stream", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ENODATA => "No data available", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ETIME => "Timer expired", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ENOSR => "Out of streams resources", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ENONET => "Machine is not on the network", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ENOPKG => "Package not installed", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EREMOTE => "Object is remote", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ENOLINK => "Link has been severed", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EADV => "Advertise error", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ESRMNT => "Srmount error", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ECOMM => "Communication error on send", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EPROTO => "Protocol error", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EMULTIHOP => "Multihop attempted", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EDOTDOT => "RFS specific error", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EBADMSG => "Not a data message", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EOVERFLOW => "Value too large for defined data type", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ENOTUNIQ => "Name not unique on network", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EBADFD => "File descriptor in bad state", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EREMCHG => "Remote address changed", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ELIBACC => "Can not access a needed shared library", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ELIBBAD => "Accessing a corrupted shared library", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ELIBSCN => ".lib section in a.out corrupted", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ELIBMAX => "Attempting to link in too many shared libraries", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ELIBEXEC => "Cannot exec a shared library directly", - #[cfg(any(target_os = "linux", target_os = "android", target_os = "openbsd"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia", target_os = "openbsd"))] EILSEQ => "Illegal byte sequence", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ERESTART => "Interrupted system call should be restarted", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ESTRPIPE => "Streams pipe error", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EUSERS => "Too many users", #[cfg(any(target_os = "linux", target_os = "android", - target_os = "netbsd", target_os = "redox"))] + target_os = "fuchsia", target_os = "netbsd", + target_os = "redox"))] EOPNOTSUPP => "Operation not supported on transport endpoint", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ESTALE => "Stale file handle", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EUCLEAN => "Structure needs cleaning", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ENOTNAM => "Not a XENIX named type file", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ENAVAIL => "No XENIX semaphores available", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EISNAM => "Is a named type file", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EREMOTEIO => "Remote I/O error", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EDQUOT => "Quota exceeded", #[cfg(any(target_os = "linux", target_os = "android", - target_os = "openbsd", target_os = "dragonfly"))] + target_os = "fuchsia", target_os = "openbsd", + target_os = "dragonfly"))] ENOMEDIUM => "No medium found", - #[cfg(any(target_os = "linux", target_os = "android", target_os = "openbsd"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia", target_os = "openbsd"))] EMEDIUMTYPE => "Wrong medium type", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ECANCELED => "Operation canceled", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ENOKEY => "Required key not available", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EKEYEXPIRED => "Key has expired", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EKEYREVOKED => "Key has been revoked", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EKEYREJECTED => "Key was rejected by service", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] EOWNERDEAD => "Owner died", - #[cfg(any(target_os = "linux", target_os = "android"))] + #[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] ENOTRECOVERABLE => "State not recoverable", - #[cfg(all(target_os = "linux", not(target_arch="mips")))] + #[cfg(any(all(target_os = "linux", not(target_arch="mips")), + target_os = "fuchsia"))] ERFKILL => "Operation not possible due to RF-kill", - #[cfg(all(target_os = "linux", not(target_arch="mips")))] + #[cfg(any(all(target_os = "linux", not(target_arch="mips")), + target_os = "fuchsia"))] EHWPOISON => "Memory page has hardware error", #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] @@ -585,7 +648,8 @@ fn desc(errno: Errno) -> &'static str { } } -#[cfg(any(target_os = "linux", target_os = "android"))] +#[cfg(any(target_os = "linux", target_os = "android", + target_os = "fuchsia"))] mod consts { #[derive(Clone, Copy, Debug, Eq, PartialEq)] #[repr(i32)] diff --git a/src/features.rs b/src/features.rs index c3a53fbfd2..6b1cff5dee 100644 --- a/src/features.rs +++ b/src/features.rs @@ -97,7 +97,7 @@ mod os { #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "ios", target_os = "openbsd", target_os = "netbsd", - target_os = "redox"))] + target_os = "redox", target_os = "fuchsia"))] mod os { /// Check if the OS supports atomic close-on-exec for sockets pub fn socket_atomic_cloexec() -> bool { diff --git a/src/pty.rs b/src/pty.rs index 3a6a9232f4..27522ea4d6 100644 --- a/src/pty.rs +++ b/src/pty.rs @@ -29,6 +29,7 @@ pub struct OpenptyResult { /// /// This is returned by `forkpty`. Note that this type does *not* implement `Drop`, so the user /// must manually close the file descriptors. +#[cfg(not(target_os = "fuchsia"))] #[derive(Clone, Copy, Debug)] pub struct ForkptyResult { /// The master port in a virtual pty pair @@ -302,6 +303,7 @@ pub fn openpty<'a, 'b, T: Into>, U: Into /// If `winsize` is not `None`, the window size of the slave will be set to /// the values in `winsize`. If `termios` is not `None`, the pseudoterminal's /// terminal settings of the slave will be set to the values in `termios`. +#[cfg(not(target_os = "fuchsia"))] pub fn forkpty<'a, 'b, T: Into>, U: Into>>( winsize: T, termios: U, diff --git a/src/sys/signal.rs b/src/sys/signal.rs index 710e65f53b..64f18614d0 100644 --- a/src/sys/signal.rs +++ b/src/sys/signal.rs @@ -39,8 +39,10 @@ libc_enum!{ SIGPIPE, SIGALRM, SIGTERM, - #[cfg(all(any(target_os = "android", target_os = "emscripten", target_os = "linux"), - not(any(target_arch = "mips", target_arch = "mips64", target_arch = "sparc64"))))] + #[cfg(all(any(target_os = "android", target_os = "emscripten", + target_os = "fuchsia", target_os = "linux"), + not(any(target_arch = "mips", target_arch = "mips64", + target_arch = "sparc64"))))] SIGSTKFLT, SIGCHLD, SIGCONT, @@ -55,14 +57,17 @@ libc_enum!{ SIGPROF, SIGWINCH, SIGIO, - #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "emscripten", + target_os = "fuchsia", target_os = "linux"))] SIGPWR, SIGSYS, #[cfg(not(any(target_os = "android", target_os = "emscripten", - target_os = "linux", target_os = "redox")))] + target_os = "fuchsia", target_os = "linux", + target_os = "redox")))] SIGEMT, #[cfg(not(any(target_os = "android", target_os = "emscripten", - target_os = "linux", target_os = "redox")))] + target_os = "fuchsia", target_os = "linux", + target_os = "redox")))] SIGINFO, } } @@ -86,8 +91,10 @@ impl FromStr for Signal { "SIGPIPE" => Signal::SIGPIPE, "SIGALRM" => Signal::SIGALRM, "SIGTERM" => Signal::SIGTERM, - #[cfg(all(any(target_os = "android", target_os = "emscripten", target_os = "linux"), - not(any(target_arch = "mips", target_arch = "mips64", target_arch = "sparc64"))))] + #[cfg(all(any(target_os = "android", target_os = "emscripten", + target_os = "fuchsia", target_os = "linux"), + not(any(target_arch = "mips", target_arch = "mips64", + target_arch = "sparc64"))))] "SIGSTKFLT" => Signal::SIGSTKFLT, "SIGCHLD" => Signal::SIGCHLD, "SIGCONT" => Signal::SIGCONT, @@ -102,14 +109,17 @@ impl FromStr for Signal { "SIGPROF" => Signal::SIGPROF, "SIGWINCH" => Signal::SIGWINCH, "SIGIO" => Signal::SIGIO, - #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "emscripten", + target_os = "fuchsia", target_os = "linux"))] "SIGPWR" => Signal::SIGPWR, "SIGSYS" => Signal::SIGSYS, #[cfg(not(any(target_os = "android", target_os = "emscripten", - target_os = "linux", target_os = "redox")))] + target_os = "fuchsia", target_os = "linux", + target_os = "redox")))] "SIGEMT" => Signal::SIGEMT, #[cfg(not(any(target_os = "android", target_os = "emscripten", - target_os = "linux", target_os = "redox")))] + target_os = "fuchsia", target_os = "linux", + target_os = "redox")))] "SIGINFO" => Signal::SIGINFO, _ => return Err(Error::invalid_argument()), }) @@ -139,7 +149,8 @@ impl Signal { Signal::SIGPIPE => "SIGPIPE", Signal::SIGALRM => "SIGALRM", Signal::SIGTERM => "SIGTERM", - #[cfg(all(any(target_os = "android", target_os = "emscripten", target_os = "linux"), + #[cfg(all(any(target_os = "android", target_os = "emscripten", + target_os = "fuchsia", target_os = "linux"), not(any(target_arch = "mips", target_arch = "mips64", target_arch = "sparc64"))))] Signal::SIGSTKFLT => "SIGSTKFLT", Signal::SIGCHLD => "SIGCHLD", @@ -155,14 +166,17 @@ impl Signal { Signal::SIGPROF => "SIGPROF", Signal::SIGWINCH => "SIGWINCH", Signal::SIGIO => "SIGIO", - #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "emscripten", + target_os = "fuchsia", target_os = "linux"))] Signal::SIGPWR => "SIGPWR", Signal::SIGSYS => "SIGSYS", #[cfg(not(any(target_os = "android", target_os = "emscripten", - target_os = "linux", target_os = "redox")))] + target_os = "fuchsia", target_os = "linux", + target_os = "redox")))] Signal::SIGEMT => "SIGEMT", #[cfg(not(any(target_os = "android", target_os = "emscripten", - target_os = "linux", target_os = "redox")))] + target_os = "fuchsia", target_os = "linux", + target_os = "redox")))] Signal::SIGINFO => "SIGINFO", } } @@ -213,7 +227,10 @@ const SIGNALS: [Signal; 29] = [ SIGWINCH, SIGIO, SIGSYS]; -#[cfg(all(any(target_os = "linux", target_os = "android", target_os = "emscripten"), not(any(target_arch = "mips", target_arch = "mips64", target_arch = "sparc64"))))] +#[cfg(all(any(target_os = "linux", target_os = "android", + target_os = "emscripten", target_os = "fuchsia"), + not(any(target_arch = "mips", target_arch = "mips64", + target_arch = "sparc64"))))] const SIGNALS: [Signal; 31] = [ SIGHUP, SIGINT, @@ -246,7 +263,10 @@ const SIGNALS: [Signal; 31] = [ SIGIO, SIGPWR, SIGSYS]; -#[cfg(all(any(target_os = "linux", target_os = "android", target_os = "emscripten"), any(target_arch = "mips", target_arch = "mips64", target_arch = "sparc64")))] +#[cfg(all(any(target_os = "linux", target_os = "android", + target_os = "emscripten", target_os = "fuchsia"), + any(target_arch = "mips", target_arch = "mips64", + target_arch = "sparc64")))] const SIGNALS: [Signal; 30] = [ SIGHUP, SIGINT, @@ -279,7 +299,8 @@ const SIGNALS: [Signal; 30] = [ SIGPWR, SIGSYS]; #[cfg(not(any(target_os = "linux", target_os = "android", - target_os = "emscripten", target_os = "redox")))] + target_os = "fuchsia", target_os = "emscripten", + target_os = "redox")))] const SIGNALS: [Signal; 31] = [ SIGHUP, SIGINT, @@ -749,6 +770,7 @@ pub fn kill>>(pid: Pid, signal: T) -> Result<()> { /// If `pgrp` less then or equal 1, the behavior is platform-specific. /// If `signal` is `None`, `killpg` will only preform error checking and won't /// send any signal. +#[cfg(not(target_os = "fuchsia"))] pub fn killpg>>(pgrp: Pid, signal: T) -> Result<()> { let res = unsafe { libc::killpg(pgrp.into(), match signal.into() { diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index 24b2310270..a8e50f9d3e 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -21,7 +21,8 @@ use crate::sys::socket::addr::sys_control::SysControlAddr; target_os = "linux", target_os = "macos", target_os = "netbsd", - target_os = "openbsd"))] + target_os = "openbsd", + target_os = "fuchsia"))] pub use self::datalink::LinkAddr; #[cfg(target_os = "linux")] pub use self::vsock::VsockAddr; @@ -41,7 +42,7 @@ pub enum AddressFamily { #[cfg(any(target_os = "android", target_os = "linux"))] Netlink = libc::AF_NETLINK, /// Low level packet interface (see [`packet(7)`](http://man7.org/linux/man-pages/man7/packet.7.html)) - #[cfg(any(target_os = "android", target_os = "linux"))] + #[cfg(any(target_os = "android", target_os = "linux", target_os = "fuchsia"))] Packet = libc::AF_PACKET, /// KEXT Controls and Notifications #[cfg(any(target_os = "ios", target_os = "macos"))] @@ -1045,7 +1046,7 @@ pub mod sys_control { } -#[cfg(any(target_os = "android", target_os = "linux"))] +#[cfg(any(target_os = "android", target_os = "linux", target_os = "fuchsia"))] mod datalink { use super::{fmt, AddressFamily}; diff --git a/src/unistd.rs b/src/unistd.rs index d53b438cbd..897592e879 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -426,6 +426,7 @@ pub fn chdir(path: &P) -> Result<()> { /// This function may fail in a number of different scenarios. See the man /// pages for additional details on possible failure cases. #[inline] +#[cfg(not(target_os = "fuchsia"))] pub fn fchdir(dirfd: RawFd) -> Result<()> { let res = unsafe { libc::fchdir(dirfd) }; @@ -1101,7 +1102,7 @@ pub fn pipe2(flags: OFlag) -> Result<(RawFd, RawFd)> { /// /// See also /// [truncate(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html) -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "redox", target_os = "fuchsia")))] pub fn truncate(path: &P, len: off_t) -> Result<()> { let res = path.with_nix_path(|cstr| { unsafe { @@ -1238,6 +1239,7 @@ pub fn unlinkat( #[inline] +#[cfg(not(target_os = "fuchsia"))] pub fn chroot(path: &P) -> Result<()> { let res = path.with_nix_path(|cstr| { unsafe { libc::chroot(cstr.as_ptr()) } @@ -2542,13 +2544,16 @@ pub struct User { /// Path to shell pub shell: PathBuf, /// Login class - #[cfg(not(any(target_os = "android", target_os = "linux")))] + #[cfg(not(any(target_os = "android", target_os = "fuchsia", + target_os = "linux")))] pub class: CString, /// Last password change - #[cfg(not(any(target_os = "android", target_os = "linux")))] + #[cfg(not(any(target_os = "android", target_os = "fuchsia", + target_os = "linux")))] pub change: libc::time_t, /// Expiration time of account - #[cfg(not(any(target_os = "android", target_os = "linux")))] + #[cfg(not(any(target_os = "android", target_os = "fuchsia", + target_os = "linux")))] pub expire: libc::time_t } @@ -2565,11 +2570,14 @@ impl From<&libc::passwd> for User { shell: PathBuf::from(OsStr::from_bytes(CStr::from_ptr((*pw).pw_shell).to_bytes())), uid: Uid::from_raw((*pw).pw_uid), gid: Gid::from_raw((*pw).pw_gid), - #[cfg(not(any(target_os = "android", target_os = "linux")))] + #[cfg(not(any(target_os = "android", target_os = "fuchsia", + target_os = "linux")))] class: CString::new(CStr::from_ptr((*pw).pw_class).to_bytes()).unwrap(), - #[cfg(not(any(target_os = "android", target_os = "linux")))] + #[cfg(not(any(target_os = "android", target_os = "fuchsia", + target_os = "linux")))] change: (*pw).pw_change, - #[cfg(not(any(target_os = "android", target_os = "linux")))] + #[cfg(not(any(target_os = "android", target_os = "fuchsia", + target_os = "linux")))] expire: (*pw).pw_expire } } diff --git a/test/sys/test_signal.rs b/test/sys/test_signal.rs index 5e0b276225..ae22527fde 100644 --- a/test/sys/test_signal.rs +++ b/test/sys/test_signal.rs @@ -12,6 +12,7 @@ fn test_kill_none() { } #[test] +#[cfg(not(target_os = "fuchsia"))] fn test_killpg_none() { killpg(getpgrp(), None) .expect("Should be able to send signal to my process group."); diff --git a/test/test.rs b/test/test.rs index 2d43196c87..bc0e26f5f3 100644 --- a/test/test.rs +++ b/test/test.rs @@ -49,7 +49,7 @@ macro_rules! skip_if_jailed { } } -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "redox", target_os = "fuchsia")))] macro_rules! skip_if_not_root { ($name:expr) => { use nix::unistd::Uid; diff --git a/test/test_unistd.rs b/test/test_unistd.rs index 8fe1d432f2..f2427b4607 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -356,6 +356,7 @@ cfg_if!{ } #[test] +#[cfg(not(target_os = "fuchsia"))] fn test_fchdir() { // fchdir changes the process's cwd let _dr = crate::DirRestore::new(); @@ -601,7 +602,7 @@ fn test_pipe2() { } #[test] -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "redox", target_os = "fuchsia")))] fn test_truncate() { let tempdir = tempdir().unwrap(); let path = tempdir.path().join("file");