From 390096112da2a5793f3a17ccabf1df7ca335b244 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Sun, 25 Sep 2022 14:40:50 -0700 Subject: [PATCH] Fix various compilation errors on haiku. This builds on top of #407! --- examples/process.rs | 13 ++++- examples/stdio.rs | 18 ++++-- src/backend/libc/fs/dir.rs | 35 ++++++++++-- src/backend/libc/fs/types.rs | 7 ++- src/backend/libc/mm/types.rs | 31 +++++++---- src/backend/libc/net/addr.rs | 10 ++++ src/backend/libc/net/ext.rs | 2 + src/backend/libc/net/read_sockaddr.rs | 6 ++ src/backend/libc/net/send_recv.rs | 5 +- src/backend/libc/net/syscalls.rs | 6 +- src/backend/libc/net/types.rs | 76 +++++++++++++++++++------- src/backend/libc/net/write_sockaddr.rs | 6 ++ src/backend/libc/offset.rs | 10 ++-- src/backend/libc/process/syscalls.rs | 35 ++---------- src/backend/libc/process/types.rs | 19 ++++--- src/backend/libc/termios/types.rs | 39 ++++++++++++- src/backend/libc/thread/syscalls.rs | 7 ++- src/fs/abs.rs | 4 ++ src/fs/mod.rs | 2 + src/process/mod.rs | 14 +---- src/termios/constants.rs | 53 ++++++++++++++++-- src/termios/mod.rs | 41 ++++++++++++-- src/thread/clock.rs | 2 + src/thread/mod.rs | 1 + tests/fs/file.rs | 3 + tests/fs/invalid_offset.rs | 1 + tests/fs/main.rs | 2 + tests/io/read_write.rs | 1 + tests/process/rlimit.rs | 5 +- tests/thread/clocks.rs | 5 ++ 30 files changed, 344 insertions(+), 115 deletions(-) diff --git a/examples/process.rs b/examples/process.rs index 485394242..76e05139f 100644 --- a/examples/process.rs +++ b/examples/process.rs @@ -41,20 +41,22 @@ fn main() -> io::Result<()> { println!("Fsize Limit: {:?}", getrlimit(Resource::Fsize)); println!("Data Limit: {:?}", getrlimit(Resource::Data)); println!("Stack Limit: {:?}", getrlimit(Resource::Stack)); + #[cfg(not(target_os = "haiku"))] println!("Core Limit: {:?}", getrlimit(Resource::Core)); - #[cfg(not(target_os = "solaris"))] + #[cfg(not(any(target_os = "haiku", target_os = "solaris")))] println!("Rss Limit: {:?}", getrlimit(Resource::Rss)); - #[cfg(not(target_os = "solaris"))] + #[cfg(not(any(target_os = "haiku", target_os = "solaris")))] println!("Nproc Limit: {:?}", getrlimit(Resource::Nproc)); #[cfg(not(target_os = "solaris"))] println!("Nofile Limit: {:?}", getrlimit(Resource::Nofile)); - #[cfg(not(target_os = "solaris"))] + #[cfg(not(any(target_os = "haiku", target_os = "solaris")))] println!("Memlock Limit: {:?}", getrlimit(Resource::Memlock)); #[cfg(not(target_os = "openbsd"))] println!("As Limit: {:?}", getrlimit(Resource::As)); #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -65,6 +67,7 @@ fn main() -> io::Result<()> { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -75,6 +78,7 @@ fn main() -> io::Result<()> { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -85,6 +89,7 @@ fn main() -> io::Result<()> { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -95,6 +100,7 @@ fn main() -> io::Result<()> { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -107,6 +113,7 @@ fn main() -> io::Result<()> { target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", diff --git a/examples/stdio.rs b/examples/stdio.rs index 6d17c985a..e75b9f1c0 100644 --- a/examples/stdio.rs +++ b/examples/stdio.rs @@ -111,13 +111,14 @@ fn show(fd: Fd) -> io::Result<()> { if (term.c_iflag & IXOFF) != 0 { print!(" IXOFF"); } - #[cfg(not(any(target_os = "ios", target_os = "macos")))] + #[cfg(not(any(target_os = "haiku", target_os = "ios", target_os = "macos")))] if (term.c_iflag & IMAXBEL) != 0 { print!(" IMAXBEL"); } #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -276,6 +277,7 @@ fn show(fd: Fd) -> io::Result<()> { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -288,6 +290,7 @@ fn show(fd: Fd) -> io::Result<()> { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -330,6 +333,7 @@ fn show(fd: Fd) -> io::Result<()> { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -342,6 +346,7 @@ fn show(fd: Fd) -> io::Result<()> { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -432,20 +437,25 @@ fn show(fd: Fd) -> io::Result<()> { term.c_cc[VMIN] ); println!( - " START={} STOP={} SUSP={} EOL={} REPRINT={} DISCARD={}", + " START={} STOP={} SUSP={} EOL={}", key(term.c_cc[VSTART]), key(term.c_cc[VSTOP]), key(term.c_cc[VSUSP]), key(term.c_cc[VEOL]), + ); + #[cfg(not(target_os = "haiku"))] + println!( + " REPRINT={} DISCARD={}", key(term.c_cc[VREPRINT]), key(term.c_cc[VDISCARD]) ); + #[cfg(not(target_os = "haiku"))] println!( - " WERASE={} LNEXT={} EOL2={}", + " WERASE={} VLNEXT={}", key(term.c_cc[VWERASE]), key(term.c_cc[VLNEXT]), - key(term.c_cc[VEOL2]) ); + println!(" EOL2={}", key(term.c_cc[VEOL2])); } } else { println!(" - is not a tty"); diff --git a/src/backend/libc/fs/dir.rs b/src/backend/libc/fs/dir.rs index 7a05a4206..caa203bc6 100644 --- a/src/backend/libc/fs/dir.rs +++ b/src/backend/libc/fs/dir.rs @@ -1,6 +1,6 @@ use super::super::c; use super::super::conv::owned_fd; -#[cfg(not(any(target_os = "illumos", target_os = "solaris")))] +#[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))] use super::types::FileType; use crate::fd::{AsFd, BorrowedFd}; use crate::ffi::CStr; @@ -8,6 +8,7 @@ use crate::ffi::CStr; use crate::ffi::CString; use crate::fs::{fcntl_getfl, fstat, openat, Mode, OFlags, Stat}; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", @@ -16,6 +17,7 @@ use crate::fs::{fcntl_getfl, fstat, openat, Mode, OFlags, Stat}; )))] use crate::fs::{fstatfs, StatFs}; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", @@ -137,6 +139,7 @@ impl Dir { /// `fstatfs(self)` #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", @@ -150,6 +153,7 @@ impl Dir { /// `fstatvfs(self)` #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", @@ -172,12 +176,13 @@ impl Dir { // struct, as the name is NUL-terminated and memory may not be allocated for // the full extent of the struct. Copy the fields one at a time. unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent { - #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))] let d_type = input.d_type; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -217,16 +222,24 @@ unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent { #[cfg(any(target_os = "ios", target_os = "macos"))] let d_seekoff = input.d_seekoff; + #[cfg(target_os = "haiku")] + let d_dev = input.d_dev; + #[cfg(target_os = "haiku")] + let d_pdev = input.d_pdev; + #[cfg(target_os = "haiku")] + let d_pino = input.d_pino; + // Construct the input. Rust will give us an error if any OS has a input // with a field that we missed here. And we can avoid blindly copying the // whole `d_name` field, which may not be entirely allocated. #[cfg_attr(target_os = "wasi", allow(unused_mut))] #[cfg(not(target_os = "dragonfly"))] let mut dirent = libc_dirent { - #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))] d_type, #[cfg(not(any( target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -261,7 +274,19 @@ unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent { d_name: zeroed(), #[cfg(target_os = "openbsd")] __d_padding: zeroed(), + #[cfg(target_os = "haiku")] + d_dev, + #[cfg(target_os = "haiku")] + d_pdev, + #[cfg(target_os = "haiku")] + d_pino, }; + /* + pub d_ino: ino_t, + pub d_pino: i64, + pub d_reclen: ::c_ushort, + pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX + // */ // On dragonfly, `dirent` has some non-public padding fields so we can't // directly initialize it. @@ -339,7 +364,7 @@ impl DirEntry { } /// Returns the type of this directory entry. - #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))] #[inline] pub fn file_type(&self) -> FileType { FileType::from_dirent_d_type(self.dirent.d_type) @@ -354,7 +379,7 @@ impl DirEntry { )))] #[inline] pub fn ino(&self) -> u64 { - self.dirent.d_ino + self.dirent.d_ino as u64 } /// Return the inode number of this directory entry. diff --git a/src/backend/libc/fs/types.rs b/src/backend/libc/fs/types.rs index 031a22bd1..fe1355094 100644 --- a/src/backend/libc/fs/types.rs +++ b/src/backend/libc/fs/types.rs @@ -438,7 +438,12 @@ impl FileType { } /// Construct a `FileType` from the `d_type` field of a `c::dirent`. - #[cfg(not(any(target_os = "illumos", target_os = "redox", target_os = "solaris")))] + #[cfg(not(any( + target_os = "haiku", + target_os = "illumos", + target_os = "redox", + target_os = "solaris" + )))] pub(crate) const fn from_dirent_d_type(d_type: u8) -> Self { match d_type { c::DT_REG => Self::RegularFile, diff --git a/src/backend/libc/mm/types.rs b/src/backend/libc/mm/types.rs index 620298f35..379b915fd 100644 --- a/src/backend/libc/mm/types.rs +++ b/src/backend/libc/mm/types.rs @@ -56,6 +56,7 @@ bitflags! { target_os = "emscripten", target_os = "freebsd", target_os = "fuchsia", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -71,6 +72,7 @@ bitflags! { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -89,6 +91,7 @@ bitflags! { target_os = "emscripten", target_os = "freebsd", target_os = "fuchsia", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -102,6 +105,7 @@ bitflags! { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -115,6 +119,7 @@ bitflags! { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -131,6 +136,7 @@ bitflags! { target_os = "emscripten", target_os = "freebsd", target_os = "fuchsia", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -147,6 +153,7 @@ bitflags! { target_os = "emscripten", target_os = "freebsd", target_os = "fuchsia", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -160,6 +167,7 @@ bitflags! { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -176,6 +184,7 @@ bitflags! { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -188,6 +197,7 @@ bitflags! { /// `MAP_STACK` #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -203,6 +213,7 @@ bitflags! { target_os = "emscripten", target_os = "freebsd", target_os = "fuchsia", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -273,43 +284,43 @@ bitflags! { #[non_exhaustive] pub enum Advice { /// `POSIX_MADV_NORMAL` - #[cfg(not(target_os = "android"))] + #[cfg(not(any(target_os = "android", target_os = "haiku")))] Normal = c::POSIX_MADV_NORMAL, /// `POSIX_MADV_NORMAL` - #[cfg(target_os = "android")] + #[cfg(any(target_os = "android", target_os = "haiku"))] Normal = c::MADV_NORMAL, /// `POSIX_MADV_SEQUENTIAL` - #[cfg(not(target_os = "android"))] + #[cfg(not(any(target_os = "android", target_os = "haiku")))] Sequential = c::POSIX_MADV_SEQUENTIAL, /// `POSIX_MADV_SEQUENTIAL` - #[cfg(target_os = "android")] + #[cfg(any(target_os = "android", target_os = "haiku"))] Sequential = c::MADV_SEQUENTIAL, /// `POSIX_MADV_RANDOM` - #[cfg(not(target_os = "android"))] + #[cfg(not(any(target_os = "android", target_os = "haiku")))] Random = c::POSIX_MADV_RANDOM, /// `POSIX_MADV_RANDOM` - #[cfg(target_os = "android")] + #[cfg(any(target_os = "android", target_os = "haiku"))] Random = c::MADV_RANDOM, /// `POSIX_MADV_WILLNEED` - #[cfg(not(target_os = "android"))] + #[cfg(not(any(target_os = "android", target_os = "haiku")))] WillNeed = c::POSIX_MADV_WILLNEED, /// `POSIX_MADV_WILLNEED` - #[cfg(target_os = "android")] + #[cfg(any(target_os = "android", target_os = "haiku"))] WillNeed = c::MADV_WILLNEED, /// `POSIX_MADV_DONTNEED` - #[cfg(not(any(target_os = "android", target_os = "emscripten")))] + #[cfg(not(any(target_os = "android", target_os = "emscripten", target_os = "haiku")))] DontNeed = c::POSIX_MADV_DONTNEED, /// `POSIX_MADV_DONTNEED` - #[cfg(target_os = "android")] + #[cfg(any(target_os = "android", target_os = "haiku"))] DontNeed = i32::MAX - 1, /// `MADV_DONTNEED` diff --git a/src/backend/libc/net/addr.rs b/src/backend/libc/net/addr.rs index 1aeda5e5d..ba64ed279 100644 --- a/src/backend/libc/net/addr.rs +++ b/src/backend/libc/net/addr.rs @@ -109,6 +109,7 @@ impl SocketAddrUnix { #[cfg(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -128,12 +129,15 @@ impl SocketAddrUnix { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd", )))] sun_path: [0; 108], + #[cfg(target_os = "haiku")] + sun_path: [0; 126], } } @@ -273,6 +277,7 @@ pub(crate) fn offsetof_sun_path() -> usize { #[cfg(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -282,6 +287,7 @@ pub(crate) fn offsetof_sun_path() -> usize { #[cfg(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -291,6 +297,7 @@ pub(crate) fn offsetof_sun_path() -> usize { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -309,12 +316,15 @@ pub(crate) fn offsetof_sun_path() -> usize { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd", )))] sun_path: [0; 108], + #[cfg(target_os = "haiku")] + sun_path: [0; 126], }; (crate::utils::as_ptr(&z.sun_path) as usize) - (crate::utils::as_ptr(&z) as usize) } diff --git a/src/backend/libc/net/ext.rs b/src/backend/libc/net/ext.rs index 804a7544c..35a1b9bd2 100644 --- a/src/backend/libc/net/ext.rs +++ b/src/backend/libc/net/ext.rs @@ -148,6 +148,7 @@ pub(crate) const fn sockaddr_in6_new( #[cfg(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -164,6 +165,7 @@ pub(crate) const fn sockaddr_in6_new( #[cfg(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", diff --git a/src/backend/libc/net/read_sockaddr.rs b/src/backend/libc/net/read_sockaddr.rs index cb76b296c..5a946fbeb 100644 --- a/src/backend/libc/net/read_sockaddr.rs +++ b/src/backend/libc/net/read_sockaddr.rs @@ -49,6 +49,7 @@ unsafe fn read_ss_family(storage: *const c::sockaddr_storage) -> u16 { #[cfg(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -58,6 +59,7 @@ unsafe fn read_ss_family(storage: *const c::sockaddr_storage) -> u16 { #[cfg(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -67,13 +69,17 @@ unsafe fn read_ss_family(storage: *const c::sockaddr_storage) -> u16 { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd", )))] sa_family: 0_u16, + #[cfg(not(target_os = "haiku"))] sa_data: [0; 14], + #[cfg(target_os = "haiku")] + sa_data: [0; 30], }; (*storage.cast::()).ss_family.into() diff --git a/src/backend/libc/net/send_recv.rs b/src/backend/libc/net/send_recv.rs index 91ed9be77..8d1cc8ab7 100644 --- a/src/backend/libc/net/send_recv.rs +++ b/src/backend/libc/net/send_recv.rs @@ -9,6 +9,7 @@ bitflags! { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -30,6 +31,7 @@ bitflags! { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -49,7 +51,7 @@ bitflags! { bitflags! { /// `MSG_*` pub struct RecvFlags: i32 { - #[cfg(not(any(windows, target_os = "illumos", target_os = "ios", target_os = "macos", target_os = "solaris")))] + #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", target_os = "solaris")))] /// `MSG_CMSG_CLOEXEC` const CMSG_CLOEXEC = c::MSG_CMSG_CLOEXEC; /// `MSG_DONTWAIT` @@ -60,6 +62,7 @@ bitflags! { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", diff --git a/src/backend/libc/net/syscalls.rs b/src/backend/libc/net/syscalls.rs index 183f6dae4..95559ab05 100644 --- a/src/backend/libc/net/syscalls.rs +++ b/src/backend/libc/net/syscalls.rs @@ -252,6 +252,7 @@ pub(crate) fn accept(sockfd: BorrowedFd<'_>) -> io::Result { #[cfg(not(any( windows, + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "redox", @@ -288,6 +289,7 @@ pub(crate) fn acceptfrom(sockfd: BorrowedFd<'_>) -> io::Result<(OwnedFd, Option< #[cfg(not(any( windows, + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "redox", @@ -315,14 +317,14 @@ pub(crate) fn acceptfrom_with( /// Darwin lacks `accept4`, but does have `accept`. We define /// `AcceptFlags` to have no flags, so we can discard it here. -#[cfg(any(windows, target_os = "ios", target_os = "macos"))] +#[cfg(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos"))] pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, _flags: AcceptFlags) -> io::Result { accept(sockfd) } /// Darwin lacks `accept4`, but does have `accept`. We define /// `AcceptFlags` to have no flags, so we can discard it here. -#[cfg(any(windows, target_os = "ios", target_os = "macos"))] +#[cfg(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos"))] pub(crate) fn acceptfrom_with( sockfd: BorrowedFd<'_>, _flags: AcceptFlags, diff --git a/src/backend/libc/net/types.rs b/src/backend/libc/net/types.rs index 53f1af3d9..19d97e7c7 100644 --- a/src/backend/libc/net/types.rs +++ b/src/backend/libc/net/types.rs @@ -27,6 +27,7 @@ impl SocketType { pub const RAW: Self = Self(c::SOCK_RAW as u32); /// `SOCK_RDM` + #[cfg(not(target_os = "haiku"))] pub const RDM: Self = Self(c::SOCK_RDM as u32); /// Constructs a `SocketType` from a raw integer. @@ -64,6 +65,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -80,6 +82,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -97,6 +100,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -110,6 +114,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -123,6 +128,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -136,6 +142,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -147,6 +154,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -157,12 +165,14 @@ impl AddressFamily { pub const ROSE: Self = Self(c::AF_ROSE as _); /// `AF_DECnet` #[allow(non_upper_case_globals)] + #[cfg(not(target_os = "haiku"))] pub const DECnet: Self = Self(c::AF_DECnet as _); /// `AF_NETBEUI` #[cfg(not(any( windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -176,6 +186,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -189,6 +200,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -200,6 +212,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -211,6 +224,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -224,6 +238,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -237,6 +252,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -250,6 +266,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -259,11 +276,13 @@ impl AddressFamily { )))] pub const RDS: Self = Self(c::AF_RDS as _); /// `AF_SNA` + #[cfg(not(target_os = "haiku"))] pub const SNA: Self = Self(c::AF_SNA as _); /// `AF_IRDA` #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -277,6 +296,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -290,6 +310,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -303,6 +324,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -316,6 +338,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -329,6 +352,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -345,6 +369,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -358,6 +383,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -367,13 +393,14 @@ impl AddressFamily { )))] pub const RXRPC: Self = Self(c::AF_RXRPC as _); /// `AF_ISDN` - #[cfg(not(any(windows, target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))] pub const ISDN: Self = Self(c::AF_ISDN as _); /// `AF_PHONET` #[cfg(not(any( windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -387,6 +414,7 @@ impl AddressFamily { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -425,31 +453,32 @@ impl Protocol { /// `IPPROTO_ICMP` pub const ICMP: Self = Self(c::IPPROTO_ICMP as _); /// `IPPROTO_IGMP` - #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))] pub const IGMP: Self = Self(c::IPPROTO_IGMP as _); /// `IPPROTO_IPIP` - #[cfg(not(any(windows, target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))] pub const IPIP: Self = Self(c::IPPROTO_IPIP as _); /// `IPPROTO_TCP` pub const TCP: Self = Self(c::IPPROTO_TCP as _); /// `IPPROTO_EGP` - #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))] pub const EGP: Self = Self(c::IPPROTO_EGP as _); /// `IPPROTO_PUP` - #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))] pub const PUP: Self = Self(c::IPPROTO_PUP as _); /// `IPPROTO_UDP` pub const UDP: Self = Self(c::IPPROTO_UDP as _); /// `IPPROTO_IDP` - #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))] pub const IDP: Self = Self(c::IPPROTO_IDP as _); /// `IPPROTO_TP` - #[cfg(not(any(windows, target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))] pub const TP: Self = Self(c::IPPROTO_TP as _); /// `IPPROTO_DCCP` #[cfg(not(any( windows, target_os = "dragonfly", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -460,20 +489,21 @@ impl Protocol { /// `IPPROTO_IPV6` pub const IPV6: Self = Self(c::IPPROTO_IPV6 as _); /// `IPPROTO_RSVP` - #[cfg(not(any(windows, target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))] pub const RSVP: Self = Self(c::IPPROTO_RSVP as _); /// `IPPROTO_GRE` - #[cfg(not(any(windows, target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))] pub const GRE: Self = Self(c::IPPROTO_GRE as _); /// `IPPROTO_ESP` - #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))] pub const ESP: Self = Self(c::IPPROTO_ESP as _); /// `IPPROTO_AH` - #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))] pub const AH: Self = Self(c::IPPROTO_AH as _); /// `IPPROTO_MTP` #[cfg(not(any( windows, + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "openbsd", @@ -485,6 +515,7 @@ impl Protocol { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -494,16 +525,17 @@ impl Protocol { )))] pub const BEETPH: Self = Self(c::IPPROTO_BEETPH as _); /// `IPPROTO_ENCAP` - #[cfg(not(any(windows, target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))] pub const ENCAP: Self = Self(c::IPPROTO_ENCAP as _); /// `IPPROTO_PIM` - #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))] pub const PIM: Self = Self(c::IPPROTO_PIM as _); /// `IPPROTO_COMP` #[cfg(not(any( windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -513,12 +545,13 @@ impl Protocol { )))] pub const COMP: Self = Self(c::IPPROTO_COMP as _); /// `IPPROTO_SCTP` - #[cfg(not(any(target_os = "dragonfly", target_os = "illumos", target_os = "openbsd", target_os = "solaris")))] + #[cfg(not(any(target_os = "dragonfly", target_os = "haiku", target_os = "illumos", target_os = "openbsd", target_os = "solaris")))] pub const SCTP: Self = Self(c::IPPROTO_SCTP as _); /// `IPPROTO_UDPLITE` #[cfg(not(any( windows, target_os = "dragonfly", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -531,6 +564,7 @@ impl Protocol { #[cfg(not(any( windows, target_os = "dragonfly", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -548,6 +582,7 @@ impl Protocol { target_os = "emscripten", target_os = "freebsd", target_os = "fuchsia", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -557,7 +592,7 @@ impl Protocol { )))] pub const MPTCP: Self = Self(c::IPPROTO_MPTCP as _); /// `IPPROTO_FRAGMENT` - #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))] pub const FRAGMENT: Self = Self(c::IPPROTO_FRAGMENT as _); /// `IPPROTO_ICMPV6` pub const ICMPV6: Self = Self(c::IPPROTO_ICMPV6 as _); @@ -565,6 +600,7 @@ impl Protocol { #[cfg(not(any( windows, target_os = "dragonfly", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -574,7 +610,7 @@ impl Protocol { )))] pub const MH: Self = Self(c::IPPROTO_MH as _); /// `IPPROTO_ROUTING` - #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))] pub const ROUTING: Self = Self(c::IPPROTO_ROUTING as _); /// Constructs a `Protocol` from a raw integer. @@ -611,11 +647,11 @@ bitflags! { /// [`acceptfrom_with`]: crate::net::acceptfrom_with pub struct AcceptFlags: c::c_int { /// `SOCK_NONBLOCK` - #[cfg(not(any(windows, target_os = "ios", target_os = "macos")))] + #[cfg(not(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos")))] const NONBLOCK = c::SOCK_NONBLOCK; /// `SOCK_CLOEXEC` - #[cfg(not(any(windows, target_os = "ios", target_os = "macos")))] + #[cfg(not(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos")))] const CLOEXEC = c::SOCK_CLOEXEC; } } @@ -626,11 +662,11 @@ bitflags! { /// [`socket`]: crate::net::socket pub struct SocketFlags: c::c_int { /// `SOCK_NONBLOCK` - #[cfg(not(any(windows, target_os = "ios", target_os = "macos")))] + #[cfg(not(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos")))] const NONBLOCK = c::SOCK_NONBLOCK; /// `SOCK_CLOEXEC` - #[cfg(not(any(windows, target_os = "ios", target_os = "macos")))] + #[cfg(not(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos")))] const CLOEXEC = c::SOCK_CLOEXEC; } } diff --git a/src/backend/libc/net/write_sockaddr.rs b/src/backend/libc/net/write_sockaddr.rs index adbf7255d..f44284a0b 100644 --- a/src/backend/libc/net/write_sockaddr.rs +++ b/src/backend/libc/net/write_sockaddr.rs @@ -26,6 +26,7 @@ pub(crate) unsafe fn encode_sockaddr_v4(v4: &SocketAddrV4) -> c::sockaddr_in { #[cfg(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -35,7 +36,10 @@ pub(crate) unsafe fn encode_sockaddr_v4(v4: &SocketAddrV4) -> c::sockaddr_in { sin_family: c::AF_INET as _, sin_port: u16::to_be(v4.port()), sin_addr: in_addr_new(u32::from_ne_bytes(v4.ip().octets())), + #[cfg(not(target_os = "haiku"))] sin_zero: [0; 8_usize], + #[cfg(target_os = "haiku")] + sin_zero: [0; 24_usize], } } @@ -49,6 +53,7 @@ pub(crate) unsafe fn encode_sockaddr_v6(v6: &SocketAddrV6) -> c::sockaddr_in6 { #[cfg(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -67,6 +72,7 @@ pub(crate) unsafe fn encode_sockaddr_v6(v6: &SocketAddrV6) -> c::sockaddr_in6 { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", diff --git a/src/backend/libc/offset.rs b/src/backend/libc/offset.rs index f0e78dae2..11cd82105 100644 --- a/src/backend/libc/offset.rs +++ b/src/backend/libc/offset.rs @@ -6,9 +6,9 @@ use super::c; #[cfg(not(any( windows, target_os = "android", - target_os = "linux", target_os = "emscripten", target_os = "l4re", + target_os = "linux", )))] pub(super) use c::{ fstat as libc_fstat, fstatat as libc_fstatat, ftruncate as libc_ftruncate, lseek as libc_lseek, @@ -17,9 +17,9 @@ pub(super) use c::{ #[cfg(any( target_os = "android", - target_os = "linux", target_os = "emscripten", target_os = "l4re", + target_os = "linux", ))] pub(super) use c::{ fstat64 as libc_fstat, fstatat64 as libc_fstatat, ftruncate64 as libc_ftruncate, @@ -29,9 +29,9 @@ pub(super) use c::{ #[cfg(not(any( windows, target_os = "android", - target_os = "linux", target_os = "emscripten", target_os = "l4re", + target_os = "linux", target_os = "wasi", )))] #[cfg(feature = "mm")] @@ -40,11 +40,10 @@ pub(super) use c::mmap as libc_mmap; #[cfg(not(any( windows, target_os = "android", - target_os = "linux", target_os = "emscripten", target_os = "fuchsia", - target_os = "haiku", target_os = "l4re", + target_os = "linux", target_os = "redox", target_os = "wasi", )))] @@ -55,7 +54,6 @@ pub(super) use c::{rlimit as libc_rlimit, RLIM_INFINITY as LIBC_RLIM_INFINITY}; target_os = "android", target_os = "fuchsia", target_os = "emscripten", - target_os = "haiku", target_os = "l4re", target_os = "linux", target_os = "wasi", diff --git a/src/backend/libc/process/syscalls.rs b/src/backend/libc/process/syscalls.rs index fdbf05d39..3f6598bd0 100644 --- a/src/backend/libc/process/syscalls.rs +++ b/src/backend/libc/process/syscalls.rs @@ -20,12 +20,7 @@ use crate::fd::BorrowedFd; use crate::ffi::CStr; use crate::io; use core::mem::MaybeUninit; -#[cfg(not(any( - target_os = "fuchsia", - target_os = "haiku", - target_os = "redox", - target_os = "wasi" -)))] +#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] use { super::super::conv::ret_infallible, super::super::offset::{libc_getrlimit, libc_rlimit, libc_setrlimit, LIBC_RLIM_INFINITY}, @@ -303,12 +298,7 @@ pub(crate) fn setpriority_process(pid: Option, priority: i32) -> io::Result } } -#[cfg(not(any( - target_os = "fuchsia", - target_os = "haiku", - target_os = "redox", - target_os = "wasi" -)))] +#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] #[inline] pub(crate) fn getrlimit(limit: Resource) -> Rlimit { let mut result = MaybeUninit::::uninit(); @@ -318,12 +308,7 @@ pub(crate) fn getrlimit(limit: Resource) -> Rlimit { } } -#[cfg(not(any( - target_os = "fuchsia", - target_os = "haiku", - target_os = "redox", - target_os = "wasi" -)))] +#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] #[inline] pub(crate) fn setrlimit(limit: Resource, new: Rlimit) -> io::Result<()> { let lim = rlimit_to_libc(new)?; @@ -347,12 +332,7 @@ pub(crate) fn prlimit(pid: Option, limit: Resource, new: Rlimit) -> io::Res } /// Convert a Rust [`Rlimit`] to a C `libc_rlimit`. -#[cfg(not(any( - target_os = "fuchsia", - target_os = "haiku", - target_os = "redox", - target_os = "wasi" -)))] +#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] fn rlimit_from_libc(lim: libc_rlimit) -> Rlimit { let current = if lim.rlim_cur == LIBC_RLIM_INFINITY { None @@ -368,12 +348,7 @@ fn rlimit_from_libc(lim: libc_rlimit) -> Rlimit { } /// Convert a C `libc_rlimit` to a Rust `Rlimit`. -#[cfg(not(any( - target_os = "fuchsia", - target_os = "haiku", - target_os = "redox", - target_os = "wasi" -)))] +#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] fn rlimit_to_libc(lim: Rlimit) -> io::Result { let Rlimit { current, maximum } = lim; let rlim_cur = match current { diff --git a/src/backend/libc/process/types.rs b/src/backend/libc/process/types.rs index c5749e689..125a4fe94 100644 --- a/src/backend/libc/process/types.rs +++ b/src/backend/libc/process/types.rs @@ -41,12 +41,7 @@ pub enum MembarrierCommand { /// [`getrlimit`]: crate::process::getrlimit /// [`setrlimit`]: crate::process::setrlimit /// [`prlimit`]: crate::process::prlimit -#[cfg(not(any( - target_os = "fuchsia", - target_os = "haiku", - target_os = "redox", - target_os = "wasi" -)))] +#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] #[derive(Copy, Clone, Debug, Eq, PartialEq)] #[repr(i32)] pub enum Resource { @@ -59,9 +54,11 @@ pub enum Resource { /// `RLIMIT_STACK` Stack = c::RLIMIT_STACK as c::c_int, /// `RLIMIT_CORE` + #[cfg(not(target_os = "haiku"))] Core = c::RLIMIT_CORE as c::c_int, /// `RLIMIT_RSS` #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -69,12 +66,12 @@ pub enum Resource { )))] Rss = c::RLIMIT_RSS as c::c_int, /// `RLIMIT_NPROC` - #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))] Nproc = c::RLIMIT_NPROC as c::c_int, /// `RLIMIT_NOFILE` Nofile = c::RLIMIT_NOFILE as c::c_int, /// `RLIMIT_MEMLOCK` - #[cfg(not(any(target_os = "illumos", target_os = "solaris")))] + #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))] Memlock = c::RLIMIT_MEMLOCK as c::c_int, /// `RLIMIT_AS` #[cfg(not(target_os = "openbsd"))] @@ -83,6 +80,7 @@ pub enum Resource { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -95,6 +93,7 @@ pub enum Resource { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -107,6 +106,7 @@ pub enum Resource { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -119,6 +119,7 @@ pub enum Resource { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -131,6 +132,7 @@ pub enum Resource { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -145,6 +147,7 @@ pub enum Resource { target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", diff --git a/src/backend/libc/termios/types.rs b/src/backend/libc/termios/types.rs index 5b510c66f..a2e121658 100644 --- a/src/backend/libc/termios/types.rs +++ b/src/backend/libc/termios/types.rs @@ -95,6 +95,7 @@ pub const VMIN: usize = c::VMIN as usize; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -117,15 +118,19 @@ pub const VSUSP: usize = c::VSUSP as usize; pub const VEOL: usize = c::VEOL as usize; /// `VREPRINT` +#[cfg(not(target_os = "haiku"))] pub const VREPRINT: usize = c::VREPRINT as usize; /// `VDISCARD` +#[cfg(not(target_os = "haiku"))] pub const VDISCARD: usize = c::VDISCARD as usize; /// `VWERASE` +#[cfg(not(target_os = "haiku"))] pub const VWERASE: usize = c::VWERASE as usize; /// `VLNEXT` +#[cfg(not(target_os = "haiku"))] pub const VLNEXT: usize = c::VLNEXT as usize; /// `VEOL2` @@ -184,7 +189,12 @@ pub const IXANY: c::c_uint = c::IXANY; pub const IXOFF: c::c_uint = c::IXOFF; /// `IMAXBEL` -#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))] +#[cfg(not(any( + target_os = "haiku", + target_os = "ios", + target_os = "macos", + target_os = "redox" +)))] pub const IMAXBEL: c::c_uint = c::IMAXBEL; /// `IUTF8` @@ -192,6 +202,7 @@ pub const IMAXBEL: c::c_uint = c::IMAXBEL; target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -656,6 +667,7 @@ pub const B230400: Speed = c::B230400; /// `B460800` #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd" @@ -666,6 +678,7 @@ pub const B460800: Speed = c::B460800; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -679,6 +692,7 @@ pub const B500000: Speed = c::B500000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -691,6 +705,7 @@ pub const B576000: Speed = c::B576000; /// `B921600` #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd" @@ -701,6 +716,7 @@ pub const B921600: Speed = c::B921600; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -713,6 +729,7 @@ pub const B1000000: Speed = c::B1000000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -725,6 +742,7 @@ pub const B1152000: Speed = c::B1152000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -737,6 +755,7 @@ pub const B1500000: Speed = c::B1500000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -749,6 +768,7 @@ pub const B2000000: Speed = c::B2000000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -761,6 +781,7 @@ pub const B2500000: Speed = c::B2500000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -773,6 +794,7 @@ pub const B3000000: Speed = c::B3000000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -785,6 +807,7 @@ pub const B3500000: Speed = c::B3500000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -876,6 +899,7 @@ pub const IEXTEN: c::c_uint = c::IEXTEN; /// `EXTA` #[cfg(not(any( target_os = "emscripten", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -887,6 +911,7 @@ pub const EXTA: c::c_uint = c::EXTA; /// `EXTB` #[cfg(not(any( target_os = "emscripten", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -899,6 +924,7 @@ pub const EXTB: c::c_uint = c::EXTB; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -911,6 +937,7 @@ pub const CBAUD: c::c_uint = c::CBAUD; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -926,6 +953,7 @@ pub const CBAUDEX: c::c_uint = c::CBAUDEX; target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -946,6 +974,7 @@ pub const CIBAUD: c::tcflag_t = 0o77600000; target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -985,13 +1014,19 @@ pub const FLUSHO: c::c_uint = c::FLUSHO; pub const PENDIN: c::c_uint = c::PENDIN; /// `EXTPROC` -#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))] +#[cfg(not(any( + target_os = "haiku", + target_os = "ios", + target_os = "macos", + target_os = "redox" +)))] pub const EXTPROC: c::c_uint = c::EXTPROC; /// `XTABS` #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", diff --git a/src/backend/libc/thread/syscalls.rs b/src/backend/libc/thread/syscalls.rs index 7933f30e1..0709fbb19 100644 --- a/src/backend/libc/thread/syscalls.rs +++ b/src/backend/libc/thread/syscalls.rs @@ -15,8 +15,9 @@ use crate::thread::{NanosleepRelativeResult, Timespec}; use core::mem::MaybeUninit; #[cfg(not(any( target_os = "dragonfly", - target_os = "freebsd", target_os = "emscripten", + target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd", @@ -40,6 +41,7 @@ weak!(fn __nanosleep64(*const LibcTimespec, *mut LibcTimespec) -> c::c_int); target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11. + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd", @@ -131,8 +133,9 @@ unsafe fn clock_nanosleep_relative_old(id: ClockId, request: &Timespec) -> Nanos #[cfg(not(any( target_os = "dragonfly", - target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11. target_os = "emscripten", + target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11. + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd", diff --git a/src/fs/abs.rs b/src/fs/abs.rs index d624e4344..a0d6cdecb 100644 --- a/src/fs/abs.rs +++ b/src/fs/abs.rs @@ -1,6 +1,7 @@ //! POSIX-style filesystem functions which operate on bare paths. #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", @@ -9,6 +10,7 @@ )))] use crate::fs::StatFs; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", @@ -29,6 +31,7 @@ use { /// /// [Linux]: https://man7.org/linux/man-pages/man2/statfs.2.html #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", @@ -54,6 +57,7 @@ pub fn statfs(path: P) -> io::Result { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/statvfs.html /// [Linux]: https://man7.org/linux/man-pages/man2/statvfs.2.html #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", diff --git a/src/fs/mod.rs b/src/fs/mod.rs index 2d4a6f8e2..3282489f3 100644 --- a/src/fs/mod.rs +++ b/src/fs/mod.rs @@ -66,6 +66,7 @@ mod sendfile; mod statx; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", @@ -75,6 +76,7 @@ mod statx; #[cfg(feature = "fs")] pub use abs::statfs; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", diff --git a/src/process/mod.rs b/src/process/mod.rs index 277c14dfe..8b517961a 100644 --- a/src/process/mod.rs +++ b/src/process/mod.rs @@ -13,12 +13,7 @@ mod membarrier; mod prctl; #[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] // WASI doesn't have [gs]etpriority. mod priority; -#[cfg(not(any( - target_os = "fuchsia", - target_os = "haiku", - target_os = "redox", - target_os = "wasi" -)))] +#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] mod rlimit; #[cfg(any( target_os = "android", @@ -66,12 +61,7 @@ pub use priority::{ }; #[cfg(any(target_os = "android", target_os = "linux"))] pub use rlimit::prlimit; -#[cfg(not(any( - target_os = "fuchsia", - target_os = "haiku", - target_os = "redox", - target_os = "wasi" -)))] +#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] pub use rlimit::{getrlimit, setrlimit, Resource, Rlimit}; #[cfg(any( target_os = "android", diff --git a/src/termios/constants.rs b/src/termios/constants.rs index 9e5c9b904..c3db04905 100644 --- a/src/termios/constants.rs +++ b/src/termios/constants.rs @@ -2,6 +2,7 @@ use crate::backend; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -12,6 +13,7 @@ pub use backend::termios::types::B1000000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -22,6 +24,7 @@ pub use backend::termios::types::B1152000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -32,6 +35,7 @@ pub use backend::termios::types::B1500000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -42,6 +46,7 @@ pub use backend::termios::types::B2000000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -52,6 +57,7 @@ pub use backend::termios::types::B2500000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -62,6 +68,7 @@ pub use backend::termios::types::B3000000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -72,6 +79,7 @@ pub use backend::termios::types::B3500000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -81,6 +89,7 @@ pub use backend::termios::types::B3500000; pub use backend::termios::types::B4000000; #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd" @@ -89,6 +98,7 @@ pub use backend::termios::types::B460800; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -100,6 +110,7 @@ pub use backend::termios::types::B500000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -110,6 +121,7 @@ pub use backend::termios::types::B500000; pub use backend::termios::types::B576000; #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd" @@ -160,6 +172,7 @@ pub use backend::termios::types::BSDLY; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -170,6 +183,7 @@ pub use backend::termios::types::CBAUD; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -183,6 +197,7 @@ pub use backend::termios::types::CBAUDEX; target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -196,6 +211,7 @@ pub use backend::termios::types::CLOCAL; target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -307,6 +323,7 @@ pub use backend::termios::types::ECHONL; pub use backend::termios::types::ECHOPRT; #[cfg(not(any( target_os = "emscripten", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -316,6 +333,7 @@ pub use backend::termios::types::ECHOPRT; pub use backend::termios::types::EXTA; #[cfg(not(any( target_os = "emscripten", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -323,7 +341,12 @@ pub use backend::termios::types::EXTA; target_os = "solaris", )))] pub use backend::termios::types::EXTB; -#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))] +#[cfg(not(any( + target_os = "haiku", + target_os = "ios", + target_os = "macos", + target_os = "redox" +)))] pub use backend::termios::types::EXTPROC; #[cfg(not(any( target_os = "dragonfly", @@ -380,7 +403,12 @@ pub use backend::termios::types::IGNBRK; pub use backend::termios::types::IGNCR; #[cfg(not(any(target_os = "ios", target_os = "macos")))] pub use backend::termios::types::IGNPAR; -#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))] +#[cfg(not(any( + target_os = "haiku", + target_os = "ios", + target_os = "macos", + target_os = "redox" +)))] pub use backend::termios::types::IMAXBEL; #[cfg(not(any(target_os = "ios", target_os = "macos")))] pub use backend::termios::types::INLCR; @@ -402,6 +430,7 @@ pub use backend::termios::types::IUCLC; target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -574,6 +603,7 @@ pub use backend::termios::types::TOSTOP; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -628,6 +658,7 @@ pub use backend::termios::types::XCASE; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -639,9 +670,11 @@ pub use backend::termios::types::XCASE; pub use backend::termios::types::XTABS; pub use backend::termios::types::{ B0, B110, B115200, B1200, B134, B150, B1800, B19200, B200, B230400, B2400, B300, B38400, B4800, - B50, B57600, B600, B75, B9600, ICANON, VDISCARD, VEOF, VEOL, VEOL2, VERASE, VINTR, VKILL, - VLNEXT, VMIN, VQUIT, VREPRINT, VSTART, VSTOP, VSUSP, VTIME, VWERASE, + B50, B57600, B600, B75, B9600, ICANON, VEOF, VEOL, VEOL2, VERASE, VINTR, VKILL, VMIN, VQUIT, + VSTART, VSTOP, VSUSP, VTIME, }; +#[cfg(not(target_os = "haiku"))] +pub use backend::termios::types::{VDISCARD, VLNEXT, VREPRINT, VWERASE}; /// Translate from a `Speed` code to a speed value `u32`. /// @@ -672,6 +705,7 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option { backend::termios::types::B230400 => Some(230_400), #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd" @@ -680,6 +714,7 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -691,6 +726,7 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -701,6 +737,7 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option { backend::termios::types::B576000 => Some(576_000), #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd" @@ -709,6 +746,7 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -719,6 +757,7 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -729,6 +768,7 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -739,6 +779,7 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -749,6 +790,7 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -759,6 +801,7 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -769,6 +812,7 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -779,6 +823,7 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", diff --git a/src/termios/mod.rs b/src/termios/mod.rs index 63cf3d892..8702992f8 100644 --- a/src/termios/mod.rs +++ b/src/termios/mod.rs @@ -10,6 +10,7 @@ pub use cf::{cfgetispeed, cfgetospeed, cfmakeraw, cfsetispeed, cfsetospeed, cfse #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -20,6 +21,7 @@ pub use constants::B1000000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -30,6 +32,7 @@ pub use constants::B1152000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -40,6 +43,7 @@ pub use constants::B1500000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -50,6 +54,7 @@ pub use constants::B2000000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -60,6 +65,7 @@ pub use constants::B2500000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -70,6 +76,7 @@ pub use constants::B3000000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -80,6 +87,7 @@ pub use constants::B3500000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -89,6 +97,7 @@ pub use constants::B3500000; pub use constants::B4000000; #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd" @@ -97,6 +106,7 @@ pub use constants::B460800; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -108,6 +118,7 @@ pub use constants::B500000; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -118,6 +129,7 @@ pub use constants::B500000; pub use constants::B576000; #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd" @@ -168,6 +180,7 @@ pub use constants::BSDLY; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -178,6 +191,7 @@ pub use constants::CBAUD; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -191,6 +205,7 @@ pub use constants::CBAUDEX; target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -204,6 +219,7 @@ pub use constants::CLOCAL; target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -315,6 +331,7 @@ pub use constants::ECHONL; pub use constants::ECHOPRT; #[cfg(not(any( target_os = "emscripten", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -324,6 +341,7 @@ pub use constants::ECHOPRT; pub use constants::EXTA; #[cfg(not(any( target_os = "emscripten", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -331,7 +349,12 @@ pub use constants::EXTA; target_os = "solaris", )))] pub use constants::EXTB; -#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))] +#[cfg(not(any( + target_os = "haiku", + target_os = "ios", + target_os = "macos", + target_os = "redox" +)))] pub use constants::EXTPROC; #[cfg(not(any( target_os = "dragonfly", @@ -388,7 +411,12 @@ pub use constants::IGNBRK; pub use constants::IGNCR; #[cfg(not(any(target_os = "ios", target_os = "macos")))] pub use constants::IGNPAR; -#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))] +#[cfg(not(any( + target_os = "haiku", + target_os = "ios", + target_os = "macos", + target_os = "redox" +)))] pub use constants::IMAXBEL; #[cfg(not(any(target_os = "ios", target_os = "macos")))] pub use constants::INLCR; @@ -410,6 +438,7 @@ pub use constants::IUCLC; target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -582,6 +611,7 @@ pub use constants::TOSTOP; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -636,6 +666,7 @@ pub use constants::XCASE; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -647,9 +678,11 @@ pub use constants::XCASE; pub use constants::XTABS; pub use constants::{ speed_value, B0, B110, B115200, B1200, B134, B150, B1800, B19200, B200, B230400, B2400, B300, - B38400, B4800, B50, B57600, B600, B75, B9600, ICANON, VDISCARD, VEOF, VEOL, VEOL2, VERASE, - VINTR, VKILL, VLNEXT, VMIN, VQUIT, VREPRINT, VSTART, VSTOP, VSUSP, VTIME, VWERASE, + B38400, B4800, B50, B57600, B600, B75, B9600, ICANON, VEOF, VEOL, VEOL2, VERASE, VINTR, VKILL, + VMIN, VQUIT, VSTART, VSTOP, VSUSP, VTIME, }; +#[cfg(not(target_os = "haiku"))] +pub use constants::{VDISCARD, VLNEXT, VREPRINT, VWERASE}; pub use tc::{ tcdrain, tcflow, tcflush, tcgetattr, tcgetpgrp, tcgetsid, tcgetwinsize, tcsendbreak, tcsetattr, tcsetpgrp, tcsetwinsize, Action, OptionalActions, QueueSelector, Speed, Tcflag, Termios, diff --git a/src/thread/clock.rs b/src/thread/clock.rs index 2b660b890..57672fa17 100644 --- a/src/thread/clock.rs +++ b/src/thread/clock.rs @@ -30,6 +30,7 @@ pub use backend::time::types::ClockId; target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11. + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd", @@ -57,6 +58,7 @@ pub fn clock_nanosleep_relative(id: ClockId, request: &Timespec) -> NanosleepRel target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11. + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd", diff --git a/src/thread/mod.rs b/src/thread/mod.rs index de5c9d828..b1dc849d9 100644 --- a/src/thread/mod.rs +++ b/src/thread/mod.rs @@ -15,6 +15,7 @@ mod setns; target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd", diff --git a/tests/fs/file.rs b/tests/fs/file.rs index d7cc29ede..f94a9362d 100644 --- a/tests/fs/file.rs +++ b/tests/fs/file.rs @@ -42,6 +42,7 @@ fn test_file() { #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -66,6 +67,7 @@ fn test_file() { assert!(stat.st_blocks > 0); #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", @@ -78,6 +80,7 @@ fn test_file() { } #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", diff --git a/tests/fs/invalid_offset.rs b/tests/fs/invalid_offset.rs index fc10734e6..a6e0a0cbf 100644 --- a/tests/fs/invalid_offset.rs +++ b/tests/fs/invalid_offset.rs @@ -61,6 +61,7 @@ fn invalid_offset_fallocate() { #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", diff --git a/tests/fs/main.rs b/tests/fs/main.rs index a0ac6e586..98d3c013b 100644 --- a/tests/fs/main.rs +++ b/tests/fs/main.rs @@ -18,6 +18,7 @@ mod long_paths; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -37,6 +38,7 @@ mod openat2; mod readdir; mod renameat; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", diff --git a/tests/io/read_write.rs b/tests/io/read_write.rs index f1835a396..b5b343aa9 100644 --- a/tests/io/read_write.rs +++ b/tests/io/read_write.rs @@ -3,6 +3,7 @@ use std::io::{IoSlice, IoSliceMut}; #[cfg(feature = "fs")] #[cfg(not(target_os = "solaris"))] // no preadv/pwritev +#[cfg(not(target_os = "haiku"))] // no preadv/pwritev #[test] fn test_readwrite_pv() { use rustix::fs::{cwd, openat, Mode, OFlags}; diff --git a/tests/process/rlimit.rs b/tests/process/rlimit.rs index bbb9ec552..1e1e6a23d 100644 --- a/tests/process/rlimit.rs +++ b/tests/process/rlimit.rs @@ -1,4 +1,6 @@ -use rustix::process::{Resource, Rlimit}; +use rustix::process::Resource; +#[cfg(not(target_os = "haiku"))] // No `Core` on Haiku. +use rustix::process::Rlimit; #[test] fn test_getrlimit() { @@ -7,6 +9,7 @@ fn test_getrlimit() { assert_ne!(lim.maximum, Some(0)); } +#[cfg(not(target_os = "haiku"))] // No `Core` on Haiku. #[test] fn test_setrlimit() { let old = rustix::process::getrlimit(Resource::Core); diff --git a/tests/thread/clocks.rs b/tests/thread/clocks.rs index 2c803f074..56b5557eb 100644 --- a/tests/thread/clocks.rs +++ b/tests/thread/clocks.rs @@ -2,6 +2,7 @@ target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd", @@ -52,6 +53,7 @@ fn test_invalid_nanosleep() { target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd", @@ -106,6 +108,7 @@ fn test_invalid_nanosleep_absolute() { target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd", @@ -172,6 +175,7 @@ fn test_zero_nanosleep() { target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd", @@ -196,6 +200,7 @@ fn test_zero_nanosleep_absolute() { target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "openbsd",