diff --git a/examples/stdio.rs b/examples/stdio.rs index 7fe8a9334..932a934e4 100644 --- a/examples/stdio.rs +++ b/examples/stdio.rs @@ -123,6 +123,7 @@ fn show(fd: Fd) -> io::Result<()> { target_os = "aix", target_os = "emscripten", target_os = "haiku", + target_os = "hurd", target_os = "redox", )))] if term.input_modes.contains(InputModes::IUTF8) { @@ -217,6 +218,7 @@ fn show(fd: Fd) -> io::Result<()> { solarish, target_os = "emscripten", target_os = "haiku", + target_os = "hurd", target_os = "redox", )))] if term.control_modes.contains(ControlModes::CMSPAR) { @@ -297,6 +299,7 @@ fn show(fd: Fd) -> io::Result<()> { solarish, target_os = "aix", target_os = "haiku", + target_os = "hurd", target_os = "nto", )))] println!( diff --git a/src/backend/libc/c.rs b/src/backend/libc/c.rs index eb89fa43a..802d638de 100644 --- a/src/backend/libc/c.rs +++ b/src/backend/libc/c.rs @@ -109,7 +109,12 @@ pub(super) use libc::fallocate64 as fallocate; #[cfg(not(any(target_arch = "aarch64", target_arch = "riscv64")))] #[cfg(any(linux_like, target_os = "aix"))] pub(super) use libc::open64 as open; -#[cfg(any(linux_kernel, target_os = "aix", target_os = "l4re"))] +#[cfg(any( + linux_kernel, + target_os = "aix", + target_os = "hurd", + target_os = "l4re" +))] pub(super) use libc::posix_fallocate64 as posix_fallocate; #[cfg(any(all(linux_like, not(target_os = "android")), target_os = "aix"))] pub(super) use libc::{blkcnt64_t as blkcnt_t, rlim64_t as rlim_t}; @@ -123,7 +128,7 @@ pub(super) use libc::{ rlimit64 as rlimit, setrlimit64 as setrlimit, statfs64 as statfs, statvfs64 as statvfs, RLIM_INFINITY, }; -#[cfg(linux_like)] +#[cfg(any(linux_like, target_os = "hurd"))] pub(super) use libc::{ fstat64 as fstat, fstatat64 as fstatat, fstatfs64 as fstatfs, fstatvfs64 as fstatvfs, ftruncate64 as ftruncate, getrlimit64 as getrlimit, ino64_t as ino_t, lseek64 as lseek, @@ -144,11 +149,16 @@ pub(super) use libc::{ target_arch = "mips64r6" ) )))] -#[cfg(any(linux_like, target_os = "aix"))] +#[cfg(any(linux_like, target_os = "aix", target_os = "hurd"))] pub(super) use libc::{lstat64 as lstat, stat64 as stat}; -#[cfg(any(linux_kernel, target_os = "aix", target_os = "emscripten"))] +#[cfg(any( + linux_kernel, + target_os = "aix", + target_os = "hurd", + target_os = "emscripten" +))] pub(super) use libc::{pread64 as pread, pwrite64 as pwrite}; -#[cfg(any(target_os = "linux", target_os = "emscripten"))] +#[cfg(any(target_os = "linux", target_os = "hurd", target_os = "emscripten"))] pub(super) use libc::{preadv64 as preadv, pwritev64 as pwritev}; #[cfg(all(target_os = "linux", target_env = "gnu"))] diff --git a/src/backend/libc/fs/dir.rs b/src/backend/libc/fs/dir.rs index 6cfeb242b..91b06e17f 100644 --- a/src/backend/libc/fs/dir.rs +++ b/src/backend/libc/fs/dir.rs @@ -21,9 +21,9 @@ use crate::io; #[cfg(feature = "process")] use crate::process::fchdir; use alloc::borrow::ToOwned; -#[cfg(not(linux_like))] +#[cfg(not(any(linux_like, target_os = "hurd")))] use c::readdir as libc_readdir; -#[cfg(linux_like)] +#[cfg(any(linux_like, target_os = "hurd"))] use c::readdir64 as libc_readdir; use core::fmt; use core::ptr::NonNull; diff --git a/src/backend/libc/fs/syscalls.rs b/src/backend/libc/fs/syscalls.rs index 5df25daa9..99ed571c1 100644 --- a/src/backend/libc/fs/syscalls.rs +++ b/src/backend/libc/fs/syscalls.rs @@ -125,7 +125,7 @@ fn open_via_syscall(path: &CStr, oflags: OFlags, mode: Mode) -> io::Result io::Result { // Work around . // glibc versions before 2.25 don't handle `O_TMPFILE` correctly. - #[cfg(all(unix, target_env = "gnu"))] + #[cfg(all(unix, target_env = "gnu", not(target_os = "hurd")))] if oflags.contains(OFlags::TMPFILE) && crate::backend::if_glibc_is_less_than_2_25() { return open_via_syscall(path, oflags, mode); } @@ -153,7 +153,7 @@ pub(crate) fn open(path: &CStr, oflags: OFlags, mode: Mode) -> io::Result, path: &CStr, @@ -188,7 +188,7 @@ pub(crate) fn openat( ) -> io::Result { // Work around . // glibc versions before 2.25 don't handle `O_TMPFILE` correctly. - #[cfg(all(unix, target_env = "gnu"))] + #[cfg(all(unix, target_env = "gnu", not(target_os = "hurd")))] if oflags.contains(OFlags::TMPFILE) && crate::backend::if_glibc_is_less_than_2_25() { return openat_via_syscall(dirfd, path, oflags, mode); } diff --git a/src/backend/libc/fs/types.rs b/src/backend/libc/fs/types.rs index cf86861dc..29180042d 100644 --- a/src/backend/libc/fs/types.rs +++ b/src/backend/libc/fs/types.rs @@ -797,6 +797,7 @@ bitflags! { bsd, target_os = "aix", target_os = "haiku", + target_os = "hurd", target_os = "wasi", )))] const KEEP_SIZE = bitcast!(c::FALLOC_FL_KEEP_SIZE); @@ -805,6 +806,7 @@ bitflags! { bsd, target_os = "aix", target_os = "haiku", + target_os = "hurd", target_os = "wasi", )))] const PUNCH_HOLE = bitcast!(c::FALLOC_FL_PUNCH_HOLE); @@ -815,6 +817,7 @@ bitflags! { target_os = "emscripten", target_os = "fuchsia", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "linux", target_os = "wasi", @@ -825,6 +828,7 @@ bitflags! { bsd, target_os = "aix", target_os = "haiku", + target_os = "hurd", target_os = "emscripten", target_os = "wasi", )))] @@ -834,6 +838,7 @@ bitflags! { bsd, target_os = "aix", target_os = "haiku", + target_os = "hurd", target_os = "emscripten", target_os = "wasi", )))] @@ -843,6 +848,7 @@ bitflags! { bsd, target_os = "aix", target_os = "haiku", + target_os = "hurd", target_os = "emscripten", target_os = "wasi", )))] @@ -852,6 +858,7 @@ bitflags! { bsd, target_os = "aix", target_os = "haiku", + target_os = "hurd", target_os = "emscripten", target_os = "wasi", )))] @@ -940,7 +947,7 @@ pub enum FlockOperation { /// /// [`statat`]: crate::fs::statat /// [`fstat`]: crate::fs::fstat -#[cfg(not(linux_like))] +#[cfg(not(any(linux_like, target_os = "hurd")))] pub type Stat = c::stat; /// `struct stat` for use with [`statat`] and [`fstat`]. @@ -949,6 +956,7 @@ pub type Stat = c::stat; /// [`fstat`]: crate::fs::fstat #[cfg(any( all(linux_kernel, target_pointer_width = "64"), + target_os = "hurd", target_os = "emscripten", target_os = "l4re", ))] diff --git a/src/backend/libc/io/errno.rs b/src/backend/libc/io/errno.rs index 1448fe7bd..a1aada1b3 100644 --- a/src/backend/libc/io/errno.rs +++ b/src/backend/libc/io/errno.rs @@ -52,6 +52,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -74,6 +75,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -87,6 +89,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -101,6 +104,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -115,6 +119,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -126,6 +131,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -137,6 +143,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -159,6 +166,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi" )))] @@ -170,6 +178,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -191,6 +200,7 @@ impl Errno { target_os = "android", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "wasi", )))] pub const DEADLOCK: Self = Self(c::EDEADLOCK); @@ -214,6 +224,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "nto", target_os = "wasi", @@ -246,6 +257,7 @@ impl Errno { target_os = "android", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "nto", target_os = "redox", @@ -293,6 +305,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "nto", target_os = "wasi", @@ -306,6 +319,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "nto", target_os = "wasi", @@ -319,6 +333,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "nto", target_os = "wasi", @@ -332,6 +347,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "nto", target_os = "wasi", @@ -343,6 +359,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi" )))] @@ -353,6 +370,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi" )))] @@ -363,6 +381,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi" )))] @@ -373,6 +392,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi" )))] @@ -384,6 +404,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -395,6 +416,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -417,6 +439,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -428,6 +451,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -438,6 +462,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi" )))] @@ -452,6 +477,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "nto", target_os = "wasi", @@ -478,6 +504,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "nto", target_os = "wasi", @@ -503,6 +530,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -519,6 +547,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi" )))] @@ -549,6 +578,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "nto", target_os = "wasi", @@ -568,6 +598,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "nto", target_os = "wasi", @@ -589,6 +620,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -600,6 +632,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -654,6 +687,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "nto", target_os = "wasi", @@ -684,6 +718,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -751,6 +786,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -771,6 +807,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "nto", target_os = "wasi", @@ -782,6 +819,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi" )))] @@ -795,6 +833,7 @@ impl Errno { target_os = "android", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "nto", target_os = "redox", @@ -831,6 +870,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -844,6 +884,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] @@ -877,6 +918,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "nto", target_os = "wasi", @@ -888,6 +930,7 @@ impl Errno { windows, target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi" )))] @@ -912,6 +955,7 @@ impl Errno { target_os = "aix", target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "l4re", target_os = "wasi", )))] diff --git a/src/backend/libc/process/types.rs b/src/backend/libc/process/types.rs index 26bae3498..96b2886ea 100644 --- a/src/backend/libc/process/types.rs +++ b/src/backend/libc/process/types.rs @@ -82,6 +82,7 @@ pub enum Resource { solarish, target_os = "aix", target_os = "haiku", + target_os = "hurd", target_os = "nto" )))] Locks = bitcast!(c::RLIMIT_LOCKS), @@ -91,6 +92,7 @@ pub enum Resource { solarish, target_os = "aix", target_os = "haiku", + target_os = "hurd", target_os = "nto" )))] Sigpending = bitcast!(c::RLIMIT_SIGPENDING), @@ -100,6 +102,7 @@ pub enum Resource { solarish, target_os = "aix", target_os = "haiku", + target_os = "hurd", target_os = "nto" )))] Msgqueue = bitcast!(c::RLIMIT_MSGQUEUE), @@ -109,6 +112,7 @@ pub enum Resource { solarish, target_os = "aix", target_os = "haiku", + target_os = "hurd", target_os = "nto" )))] Nice = bitcast!(c::RLIMIT_NICE), @@ -118,6 +122,7 @@ pub enum Resource { solarish, target_os = "aix", target_os = "haiku", + target_os = "hurd", target_os = "nto" )))] Rtprio = bitcast!(c::RLIMIT_RTPRIO), @@ -129,6 +134,7 @@ pub enum Resource { target_os = "android", target_os = "emscripten", target_os = "haiku", + target_os = "hurd", target_os = "nto", )))] Rttime = bitcast!(c::RLIMIT_RTTIME), diff --git a/src/ioctl/mod.rs b/src/ioctl/mod.rs index bf2215ab6..e5742138d 100644 --- a/src/ioctl/mod.rs +++ b/src/ioctl/mod.rs @@ -314,8 +314,8 @@ type _RawOpcode = c::c_int; #[cfg(all(not(linux_raw), target_os = "android"))] type _RawOpcode = c::c_int; -// BSD, Haiku, and Redox use `unsigned long`. -#[cfg(any(bsd, target_os = "redox", target_os = "haiku"))] +// BSD, Haiku, Hurd, and Redox use `unsigned long`. +#[cfg(any(bsd, target_os = "redox", target_os = "haiku", target_os = "hurd"))] type _RawOpcode = c::c_ulong; // AIX, Emscripten, Fuchsia, Solaris, and WASI use a `int`. diff --git a/src/pipe.rs b/src/pipe.rs index 2a45b7a9d..1a3f20a65 100644 --- a/src/pipe.rs +++ b/src/pipe.rs @@ -39,6 +39,7 @@ pub use backend::pipe::types::{IoSliceRaw, SpliceFlags}; windows, target_os = "espidf", target_os = "haiku", + target_os = "hurd", target_os = "redox", target_os = "wasi", )))] diff --git a/src/termios/types.rs b/src/termios/types.rs index 11ab4a366..33a73767a 100644 --- a/src/termios/types.rs +++ b/src/termios/types.rs @@ -289,6 +289,7 @@ bitflags! { target_os = "aix", target_os = "emscripten", target_os = "haiku", + target_os = "hurd", target_os = "redox", )))] const IUTF8 = c::IUTF8; @@ -566,6 +567,7 @@ bitflags! { target_os = "aix", target_os = "emscripten", target_os = "haiku", + target_os = "hurd", target_os = "nto", target_os = "redox", )))] @@ -1142,6 +1144,7 @@ impl SpecialCodeIndex { solarish, target_os = "aix", target_os = "haiku", + target_os = "hurd", target_os = "nto", )))] pub const VSWTC: Self = Self(c::VSWTC as usize);