From 4b481484a4d3db76f4d4aef9085c923bbcbe1f9a Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 22 Sep 2023 00:14:32 +0200 Subject: [PATCH] Add GNU/Hurd support --- .github/workflows/ci.yml | 1 + src/errno.rs | 333 +++++++++++++++++++++++++++++++++++---- src/fcntl.rs | 8 +- src/sys/signal.rs | 1 + src/sys/statvfs.rs | 6 + src/unistd.rs | 13 +- test/test_unistd.rs | 9 +- 7 files changed, 334 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ff0afe5af..1ea8122c6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -267,6 +267,7 @@ jobs: - target: x86_64-unknown-openbsd - target: armv7-unknown-linux-uclibceabihf - target: x86_64-unknown-haiku + - target: i686-unknown-hurd-gnu steps: - name: checkout uses: actions/checkout@v4 diff --git a/src/errno.rs b/src/errno.rs index 50b35248f8..8d677379f2 100644 --- a/src/errno.rs +++ b/src/errno.rs @@ -22,7 +22,8 @@ cfg_if! { } else if #[cfg(any(target_os = "linux", target_os = "redox", target_os = "dragonfly", - target_os = "fuchsia"))] { + target_os = "fuchsia", + target_os = "hurd"))] { unsafe fn errno_location() -> *mut c_int { libc::__errno_location() } @@ -436,7 +437,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "aix", target_os = "illumos", target_os = "solaris", - target_os = "fuchsia" + target_os = "fuchsia", + target_os = "hurd" ))] ENOLINK => "Link has been severed", @@ -490,7 +492,8 @@ fn desc(errno: Errno) -> &'static str { #[cfg(any( target_os = "linux", target_os = "android", - target_os = "fuchsia" + target_os = "fuchsia", + target_os = "hurd" ))] EDOTDOT => "RFS specific error", @@ -510,7 +513,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "android", target_os = "aix", target_os = "fuchsia", - target_os = "haiku" + target_os = "haiku", + target_os = "hurd" ))] EOVERFLOW => "Value too large for defined data type", @@ -582,7 +586,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "android", target_os = "illumos", target_os = "solaris", - target_os = "fuchsia" + target_os = "fuchsia", + target_os = "hurd" ))] ELIBEXEC => "Cannot exec a shared library directly", @@ -593,7 +598,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "illumos", target_os = "solaris", target_os = "fuchsia", - target_os = "openbsd" + target_os = "openbsd", + target_os = "hurd" ))] EILSEQ => "Illegal byte sequence", @@ -630,7 +636,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "android", target_os = "fuchsia", target_os = "netbsd", - target_os = "redox" + target_os = "redox", + target_os = "hurd", ))] EOPNOTSUPP => "Operation not supported on transport endpoint", @@ -679,7 +686,8 @@ fn desc(errno: Errno) -> &'static str { #[cfg(any( target_os = "linux", target_os = "android", - target_os = "fuchsia" + target_os = "fuchsia", + target_os = "hurd" ))] EDQUOT => "Quota exceeded", @@ -706,7 +714,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "illumos", target_os = "solaris", target_os = "fuchsia", - target_os = "haiku" + target_os = "haiku", + target_os = "hurd" ))] ECANCELED => "Operation canceled", @@ -742,7 +751,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "linux", target_os = "android", target_os = "aix", - target_os = "fuchsia" + target_os = "fuchsia", + target_os = "hurd" ))] EOWNERDEAD => "Owner died", @@ -753,7 +763,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "linux", target_os = "android", target_os = "aix", - target_os = "fuchsia" + target_os = "fuchsia", + target_os = "hurd" ))] ENOTRECOVERABLE => "State not recoverable", @@ -778,7 +789,8 @@ fn desc(errno: Errno) -> &'static str { #[cfg(any( target_os = "freebsd", target_os = "dragonfly", - target_os = "redox" + target_os = "redox", + target_os = "hurd" ))] EMULTIHOP => "Multihop attempted", @@ -801,7 +813,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "dragonfly", target_os = "ios", target_os = "openbsd", - target_os = "netbsd" + target_os = "netbsd", + target_os = "hurd" ))] ENEEDAUTH => "Need authenticator", @@ -860,7 +873,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "openbsd", target_os = "netbsd", target_os = "redox", - target_os = "haiku" + target_os = "haiku", + target_os = "hurd" ))] EPROTO => "Protocol error", @@ -892,7 +906,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "aix", target_os = "illumos", target_os = "solaris", - target_os = "haiku" + target_os = "haiku", + target_os = "hurd" ))] ENOTSUP => "Operation not supported", @@ -903,7 +918,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "ios", target_os = "aix", target_os = "openbsd", - target_os = "netbsd" + target_os = "netbsd", + target_os = "hurd" ))] EPROCLIM => "Too many processes", @@ -915,7 +931,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "aix", target_os = "openbsd", target_os = "netbsd", - target_os = "redox" + target_os = "redox", + target_os = "hurd" ))] EUSERS => "Too many users", @@ -945,7 +962,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "aix", target_os = "illumos", target_os = "solaris", - target_os = "haiku" + target_os = "haiku", + target_os = "hurd" ))] ESTALE => "Stale NFS file handle", @@ -957,7 +975,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "aix", target_os = "openbsd", target_os = "netbsd", - target_os = "redox" + target_os = "redox", + target_os = "hurd" ))] EREMOTE => "Too many levels of remote in path", @@ -967,7 +986,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "dragonfly", target_os = "ios", target_os = "openbsd", - target_os = "netbsd" + target_os = "netbsd", + target_os = "hurd" ))] EBADRPC => "RPC struct is bad", @@ -977,7 +997,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "dragonfly", target_os = "ios", target_os = "openbsd", - target_os = "netbsd" + target_os = "netbsd", + target_os = "hurd" ))] ERPCMISMATCH => "RPC version wrong", @@ -987,7 +1008,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "dragonfly", target_os = "ios", target_os = "openbsd", - target_os = "netbsd" + target_os = "netbsd", + target_os = "hurd" ))] EPROGUNAVAIL => "RPC prog. not avail", @@ -997,7 +1019,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "dragonfly", target_os = "ios", target_os = "openbsd", - target_os = "netbsd" + target_os = "netbsd", + target_os = "hurd" ))] EPROGMISMATCH => "Program version wrong", @@ -1007,7 +1030,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "dragonfly", target_os = "ios", target_os = "openbsd", - target_os = "netbsd" + target_os = "netbsd", + target_os = "hurd" ))] EPROCUNAVAIL => "Bad procedure for program", @@ -1017,7 +1041,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "dragonfly", target_os = "ios", target_os = "openbsd", - target_os = "netbsd" + target_os = "netbsd", + target_os = "hurd" ))] EFTYPE => "Inappropriate file type or format", @@ -1027,7 +1052,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "dragonfly", target_os = "ios", target_os = "openbsd", - target_os = "netbsd" + target_os = "netbsd", + target_os = "hurd" ))] EAUTH => "Authentication error", @@ -1074,7 +1100,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "ios", target_os = "aix", target_os = "netbsd", - target_os = "redox" + target_os = "redox", + target_os = "hurd" ))] ENODATA => "No message available on STREAM", @@ -1091,7 +1118,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "ios", target_os = "aix", target_os = "netbsd", - target_os = "redox" + target_os = "redox", + target_os = "hurd" ))] ENOSR => "No STREAM resources", @@ -1100,7 +1128,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "ios", target_os = "aix", target_os = "netbsd", - target_os = "redox" + target_os = "redox", + target_os = "hurd" ))] ENOSTR => "Not a STREAM", @@ -1109,7 +1138,8 @@ fn desc(errno: Errno) -> &'static str { target_os = "ios", target_os = "aix", target_os = "netbsd", - target_os = "redox" + target_os = "redox", + target_os = "hurd" ))] ETIME => "STREAM ioctl timeout", @@ -1145,6 +1175,21 @@ fn desc(errno: Errno) -> &'static str { #[cfg(any(target_os = "illumos", target_os = "solaris"))] ENOTACTIVE => "Facility is not active", + + #[cfg(target_os = "hurd")] + EBACKGROUND => "Inappropriate operation for background process", + + #[cfg(target_os = "hurd")] + EDIED => "Translator died", + + #[cfg(target_os = "hurd")] + EGREGIOUS => "You really blew it this time", + + #[cfg(target_os = "hurd")] + EIEIO => "Computer bought the farm", + + #[cfg(target_os = "hurd")] + EGRATUITOUS => "Gratuitous error", } } @@ -3378,3 +3423,231 @@ mod consts { } } } + +#[cfg(target_os = "hurd")] +mod consts { + #[derive(Clone, Copy, Debug, Eq, PartialEq)] + #[repr(i32)] + #[non_exhaustive] + pub enum Errno { + UnknownErrno = 0, + EPERM = libc::EPERM, + ENOENT = libc::ENOENT, + ESRCH = libc::ESRCH, + EINTR = libc::EINTR, + EIO = libc::EIO, + ENXIO = libc::ENXIO, + E2BIG = libc::E2BIG, + ENOEXEC = libc::ENOEXEC, + EBADF = libc::EBADF, + ECHILD = libc::ECHILD, + EDEADLK = libc::EDEADLK, + ENOMEM = libc::ENOMEM, + EACCES = libc::EACCES, + EFAULT = libc::EFAULT, + ENOTBLK = libc::ENOTBLK, + EBUSY = libc::EBUSY, + EEXIST = libc::EEXIST, + EXDEV = libc::EXDEV, + ENODEV = libc::ENODEV, + ENOTDIR = libc::ENOTDIR, + EISDIR = libc::EISDIR, + EINVAL = libc::EINVAL, + EMFILE = libc::EMFILE, + ENFILE = libc::ENFILE, + ENOTTY = libc::ENOTTY, + ETXTBSY = libc::ETXTBSY, + EFBIG = libc::EFBIG, + ENOSPC = libc::ENOSPC, + ESPIPE = libc::ESPIPE, + EROFS = libc::EROFS, + EMLINK = libc::EMLINK, + EPIPE = libc::EPIPE, + EDOM = libc::EDOM, + ERANGE = libc::ERANGE, + EAGAIN = libc::EAGAIN, + EINPROGRESS = libc::EINPROGRESS, + EALREADY = libc::EALREADY, + ENOTSOCK = libc::ENOTSOCK, + EMSGSIZE = libc::EMSGSIZE, + EPROTOTYPE = libc::EPROTOTYPE, + ENOPROTOOPT = libc::ENOPROTOOPT, + EPROTONOSUPPORT = libc::EPROTONOSUPPORT, + ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT, + EOPNOTSUPP = libc::EOPNOTSUPP, + EPFNOSUPPORT = libc::EPFNOSUPPORT, + EAFNOSUPPORT = libc::EAFNOSUPPORT, + EADDRINUSE = libc::EADDRINUSE, + EADDRNOTAVAIL = libc::EADDRNOTAVAIL, + ENETDOWN = libc::ENETDOWN, + ENETUNREACH = libc::ENETUNREACH, + ENETRESET = libc::ENETRESET, + ECONNABORTED = libc::ECONNABORTED, + ECONNRESET = libc::ECONNRESET, + ENOBUFS = libc::ENOBUFS, + EISCONN = libc::EISCONN, + ENOTCONN = libc::ENOTCONN, + EDESTADDRREQ = libc::EDESTADDRREQ, + ESHUTDOWN = libc::ESHUTDOWN, + ETOOMANYREFS = libc::ETOOMANYREFS, + ETIMEDOUT = libc::ETIMEDOUT, + ECONNREFUSED = libc::ECONNREFUSED, + ELOOP = libc::ELOOP, + ENAMETOOLONG = libc::ENAMETOOLONG, + EHOSTDOWN = libc::EHOSTDOWN, + EHOSTUNREACH = libc::EHOSTUNREACH, + ENOTEMPTY = libc::ENOTEMPTY, + EPROCLIM = libc::EPROCLIM, + EUSERS = libc::EUSERS, + EDQUOT = libc::EDQUOT, + ESTALE = libc::ESTALE, + EREMOTE = libc::EREMOTE, + EBADRPC = libc::EBADRPC, + ERPCMISMATCH = libc::ERPCMISMATCH, + EPROGUNAVAIL = libc::EPROGUNAVAIL, + EPROGMISMATCH = libc::EPROGMISMATCH, + EPROCUNAVAIL = libc::EPROCUNAVAIL, + ENOLCK = libc::ENOLCK, + EFTYPE = libc::EFTYPE, + EAUTH = libc::EAUTH, + ENEEDAUTH = libc::ENEEDAUTH, + ENOSYS = libc::ENOSYS, + ELIBEXEC = libc::ELIBEXEC, + ENOTSUP = libc::ENOTSUP, + EILSEQ = libc::EILSEQ, + EBACKGROUND = libc::EBACKGROUND, + EDIED = libc::EDIED, + EGREGIOUS = libc::EGREGIOUS, + EIEIO = libc::EIEIO, + EGRATUITOUS = libc::EGRATUITOUS, + EBADMSG = libc::EBADMSG, + EIDRM = libc::EIDRM, + EMULTIHOP = libc::EMULTIHOP, + ENODATA = libc::ENODATA, + ENOLINK = libc::ENOLINK, + ENOMSG = libc::ENOMSG, + ENOSR = libc::ENOSR, + ENOSTR = libc::ENOSTR, + EOVERFLOW = libc::EOVERFLOW, + EPROTO = libc::EPROTO, + ETIME = libc::ETIME, + ECANCELED = libc::ECANCELED, + EOWNERDEAD = libc::EOWNERDEAD, + ENOTRECOVERABLE = libc::ENOTRECOVERABLE, + } + + impl Errno { + pub const EWOULDBLOCK: Errno = Errno::EAGAIN; + } + + pub const fn from_i32(e: i32) -> Errno { + use self::Errno::*; + + match e { + libc::EPERM => EPERM, + libc::ENOENT => ENOENT, + libc::ESRCH => ESRCH, + libc::EINTR => EINTR, + libc::EIO => EIO, + libc::ENXIO => ENXIO, + libc::E2BIG => E2BIG, + libc::ENOEXEC => ENOEXEC, + libc::EBADF => EBADF, + libc::ECHILD => ECHILD, + libc::EDEADLK => EDEADLK, + libc::ENOMEM => ENOMEM, + libc::EACCES => EACCES, + libc::EFAULT => EFAULT, + libc::ENOTBLK => ENOTBLK, + libc::EBUSY => EBUSY, + libc::EEXIST => EEXIST, + libc::EXDEV => EXDEV, + libc::ENODEV => ENODEV, + libc::ENOTDIR => ENOTDIR, + libc::EISDIR => EISDIR, + libc::EINVAL => EINVAL, + libc::EMFILE => EMFILE, + libc::ENFILE => ENFILE, + libc::ENOTTY => ENOTTY, + libc::ETXTBSY => ETXTBSY, + libc::EFBIG => EFBIG, + libc::ENOSPC => ENOSPC, + libc::ESPIPE => ESPIPE, + libc::EROFS => EROFS, + libc::EMLINK => EMLINK, + libc::EPIPE => EPIPE, + libc::EDOM => EDOM, + libc::ERANGE => ERANGE, + libc::EAGAIN => EAGAIN, + libc::EINPROGRESS => EINPROGRESS, + libc::EALREADY => EALREADY, + libc::ENOTSOCK => ENOTSOCK, + libc::EMSGSIZE => EMSGSIZE, + libc::EPROTOTYPE => EPROTOTYPE, + libc::ENOPROTOOPT => ENOPROTOOPT, + libc::EPROTONOSUPPORT => EPROTONOSUPPORT, + libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT, + libc::EOPNOTSUPP => EOPNOTSUPP, + libc::EPFNOSUPPORT => EPFNOSUPPORT, + libc::EAFNOSUPPORT => EAFNOSUPPORT, + libc::EADDRINUSE => EADDRINUSE, + libc::EADDRNOTAVAIL => EADDRNOTAVAIL, + libc::ENETDOWN => ENETDOWN, + libc::ENETUNREACH => ENETUNREACH, + libc::ENETRESET => ENETRESET, + libc::ECONNABORTED => ECONNABORTED, + libc::ECONNRESET => ECONNRESET, + libc::ENOBUFS => ENOBUFS, + libc::EISCONN => EISCONN, + libc::ENOTCONN => ENOTCONN, + libc::EDESTADDRREQ => EDESTADDRREQ, + libc::ESHUTDOWN => ESHUTDOWN, + libc::ETOOMANYREFS => ETOOMANYREFS, + libc::ETIMEDOUT => ETIMEDOUT, + libc::ECONNREFUSED => ECONNREFUSED, + libc::ELOOP => ELOOP, + libc::ENAMETOOLONG => ENAMETOOLONG, + libc::EHOSTDOWN => EHOSTDOWN, + libc::EHOSTUNREACH => EHOSTUNREACH, + libc::ENOTEMPTY => ENOTEMPTY, + libc::EPROCLIM => EPROCLIM, + libc::EUSERS => EUSERS, + libc::EDQUOT => EDQUOT, + libc::ESTALE => ESTALE, + libc::EREMOTE => EREMOTE, + libc::EBADRPC => EBADRPC, + libc::ERPCMISMATCH => ERPCMISMATCH, + libc::EPROGUNAVAIL => EPROGUNAVAIL, + libc::EPROGMISMATCH => EPROGMISMATCH, + libc::EPROCUNAVAIL => EPROCUNAVAIL, + libc::ENOLCK => ENOLCK, + libc::EFTYPE => EFTYPE, + libc::EAUTH => EAUTH, + libc::ENEEDAUTH => ENEEDAUTH, + libc::ENOSYS => ENOSYS, + libc::ELIBEXEC => ELIBEXEC, + libc::ENOTSUP => ENOTSUP, + libc::EILSEQ => EILSEQ, + libc::EBACKGROUND => EBACKGROUND, + libc::EDIED => EDIED, + libc::EGREGIOUS => EGREGIOUS, + libc::EIEIO => EIEIO, + libc::EGRATUITOUS => EGRATUITOUS, + libc::EBADMSG => EBADMSG, + libc::EIDRM => EIDRM, + libc::EMULTIHOP => EMULTIHOP, + libc::ENODATA => ENODATA, + libc::ENOLINK => ENOLINK, + libc::ENOMSG => ENOMSG, + libc::ENOSR => ENOSR, + libc::ENOSTR => ENOSTR, + libc::EOVERFLOW => EOVERFLOW, + libc::EPROTO => EPROTO, + libc::ETIME => ETIME, + libc::ECANCELED => ECANCELED, + libc::EOWNERDEAD => EOWNERDEAD, + libc::ENOTRECOVERABLE => ENOTRECOVERABLE, + _ => UnknownErrno, + } + } +} diff --git a/src/fcntl.rs b/src/fcntl.rs index 2ecd0735c6..43334ec03e 100644 --- a/src/fcntl.rs +++ b/src/fcntl.rs @@ -349,7 +349,11 @@ fn inner_readlink( dirfd: Option, path: &P, ) -> Result { - let mut v = Vec::with_capacity(libc::PATH_MAX as usize); + #[cfg(not(target_os = "hurd"))] + const PATH_MAX: usize = libc::PATH_MAX as usize; + #[cfg(target_os = "hurd")] + const PATH_MAX: usize = 1024; + let mut v = Vec::with_capacity(PATH_MAX); { // simple case: result is strictly less than `PATH_MAX` @@ -402,7 +406,7 @@ fn inner_readlink( } else { // If lstat doesn't cooperate, or reports an error, be a little less // precise. - (libc::PATH_MAX as usize).max(128) << 1 + PATH_MAX.max(128) << 1 } }; diff --git a/src/sys/signal.rs b/src/sys/signal.rs index e3274f27e9..2941c00911 100644 --- a/src/sys/signal.rs +++ b/src/sys/signal.rs @@ -441,6 +441,7 @@ libc_bitflags! { SA_NOCLDSTOP; /// When catching a [`Signal::SIGCHLD`] signal, the system will not /// create zombie processes when children of the calling process exit. + #[cfg(not(target_os = "hurd"))] SA_NOCLDWAIT; /// Further occurrences of the delivered signal are not masked during /// the execution of the handler. diff --git a/src/sys/statvfs.rs b/src/sys/statvfs.rs index 35424e5e27..86436eb2bd 100644 --- a/src/sys/statvfs.rs +++ b/src/sys/statvfs.rs @@ -114,9 +114,15 @@ impl Statvfs { } /// Get the file system id + #[cfg(not(target_os = "hurd"))] pub fn filesystem_id(&self) -> c_ulong { self.0.f_fsid } + /// Get the file system id + #[cfg(target_os = "hurd")] + pub fn filesystem_id(&self) -> u64 { + self.0.f_fsid + } /// Get the mount flags #[cfg(not(target_os = "redox"))] diff --git a/src/unistd.rs b/src/unistd.rs index 69dd83d6f9..f167f62026 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -32,7 +32,7 @@ use crate::{Error, NixPath, Result}; use cfg_if::cfg_if; use libc::{ self, c_char, c_int, c_long, c_uint, gid_t, mode_t, off_t, pid_t, size_t, - uid_t, PATH_MAX, + uid_t, }; use std::convert::Infallible; #[cfg(not(target_os = "redox"))] @@ -692,8 +692,13 @@ pub fn getcwd() -> Result { } } + #[cfg(not(target_os = "hurd"))] + const PATH_MAX: usize = libc::PATH_MAX as usize; + #[cfg(target_os = "hurd")] + const PATH_MAX: usize = 1024; + // Trigger the internal buffer resizing logic. - reserve_double_buffer_size(&mut buf, PATH_MAX as usize)?; + reserve_double_buffer_size(&mut buf, PATH_MAX)?; } } } @@ -1232,6 +1237,7 @@ feature! { target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "hurd", target_os = "illumos", target_os = "linux", target_os = "redox", @@ -3924,7 +3930,10 @@ feature! { /// (see [`ttyname(3)`](https://man7.org/linux/man-pages/man3/ttyname.3.html)). #[cfg(not(target_os = "fuchsia"))] pub fn ttyname(fd: F) -> Result { + #[cfg(not(target_os = "hurd"))] const PATH_MAX: usize = libc::PATH_MAX as usize; + #[cfg(target_os = "hurd")] + const PATH_MAX: usize = 1024; let mut buf = vec![0_u8; PATH_MAX]; let c_buf = buf.as_mut_ptr().cast(); diff --git a/test/test_unistd.rs b/test/test_unistd.rs index 1378a15ced..ac5c792995 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -632,10 +632,11 @@ fn test_acct() { acct::disable().unwrap(); } +#[cfg(not(target_os = "hurd"))] #[test] fn test_fpathconf_limited() { let f = tempfile().unwrap(); - // AFAIK, PATH_MAX is limited on all platforms, so it makes a good test + // PATH_MAX is limited on most platforms, so it makes a good test let path_max = fpathconf(f, PathconfVar::PATH_MAX); assert!( path_max @@ -645,9 +646,10 @@ fn test_fpathconf_limited() { ); } +#[cfg(not(target_os = "hurd"))] #[test] fn test_pathconf_limited() { - // AFAIK, PATH_MAX is limited on all platforms, so it makes a good test + // PATH_MAX is limited on most platforms, so it makes a good test let path_max = pathconf("/", PathconfVar::PATH_MAX); assert!( path_max @@ -657,9 +659,10 @@ fn test_pathconf_limited() { ); } +#[cfg(not(target_os = "hurd"))] #[test] fn test_sysconf_limited() { - // AFAIK, OPEN_MAX is limited on all platforms, so it makes a good test + // OPEN_MAX is limited on most platforms, so it makes a good test let open_max = sysconf(SysconfVar::OPEN_MAX); assert!( open_max