From cf8dc9a98edc16fcf44e06989b2dce551c1213e0 Mon Sep 17 00:00:00 2001 From: Al Hoang <3811822-hoanga@users.noreply.gitlab.com> Date: Sat, 24 Sep 2022 09:56:40 +0000 Subject: [PATCH 1/2] haiku support --- src/backend/libc/fs/mod.rs | 1 + src/backend/libc/fs/syscalls.rs | 13 ++++++ src/backend/libc/fs/types.rs | 11 +++++ src/backend/libc/io/errno.rs | 65 ++++++++++++++++++++++++---- src/backend/libc/io/syscalls.rs | 16 ++++--- src/backend/libc/io/types.rs | 2 + src/backend/libc/offset.rs | 6 +++ src/backend/libc/process/syscalls.rs | 10 ++--- src/backend/libc/process/types.rs | 8 +++- src/fs/fd.rs | 5 +++ src/fs/mod.rs | 7 +++ src/io/ioctl.rs | 4 +- src/io/mod.rs | 7 +-- src/io/pipe.rs | 3 +- src/io/read_write.rs | 4 +- src/process/mod.rs | 4 +- 16 files changed, 135 insertions(+), 31 deletions(-) diff --git a/src/backend/libc/fs/mod.rs b/src/backend/libc/fs/mod.rs index b0a5ab6f2..90a48ee45 100644 --- a/src/backend/libc/fs/mod.rs +++ b/src/backend/libc/fs/mod.rs @@ -3,6 +3,7 @@ pub(crate) mod dir; #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "freebsd", target_os = "illumos", target_os = "ios", diff --git a/src/backend/libc/fs/syscalls.rs b/src/backend/libc/fs/syscalls.rs index 2fc635a6d..188a22b7d 100644 --- a/src/backend/libc/fs/syscalls.rs +++ b/src/backend/libc/fs/syscalls.rs @@ -10,6 +10,7 @@ use super::super::conv::{syscall_ret, syscall_ret_owned_fd, syscall_ret_ssize_t} use super::super::offset::libc_fallocate; #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -35,6 +36,7 @@ use super::super::offset::libc_posix_fadvise; use super::super::offset::libc_posix_fallocate; use super::super::offset::{libc_fstat, libc_fstatat, libc_ftruncate, libc_lseek, libc_off_t}; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", @@ -43,6 +45,7 @@ use super::super::offset::{libc_fstat, libc_fstatat, libc_ftruncate, libc_lseek, )))] use super::super::offset::{libc_fstatfs, libc_statfs}; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", @@ -64,6 +67,7 @@ use crate::ffi::CString; use crate::fs::Access; #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -94,6 +98,7 @@ use crate::fs::MemfdFlags; ))] use crate::fs::SealFlags; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", @@ -112,6 +117,7 @@ use crate::fs::{cwd, RenameFlags, ResolveFlags, Statx, StatxFlags}; use crate::fs::{Dev, FileType}; use crate::fs::{FdFlags, Mode, OFlags, Stat, Timestamps}; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", @@ -215,6 +221,7 @@ pub(crate) fn openat( } #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", @@ -231,6 +238,7 @@ pub(crate) fn statfs(filename: &CStr) -> io::Result { } #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", @@ -797,6 +805,7 @@ pub(crate) fn copy_file_range( #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -984,6 +993,7 @@ fn fstat_old(fd: BorrowedFd<'_>) -> io::Result { } #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", @@ -999,6 +1009,7 @@ pub(crate) fn fstatfs(fd: BorrowedFd<'_>) -> io::Result { } #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", @@ -1013,6 +1024,7 @@ pub(crate) fn fstatvfs(fd: BorrowedFd<'_>) -> io::Result { } #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", @@ -1209,6 +1221,7 @@ pub(crate) fn fsync(fd: BorrowedFd<'_>) -> io::Result<()> { #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "redox", diff --git a/src/backend/libc/fs/types.rs b/src/backend/libc/fs/types.rs index 1769f7282..031a22bd1 100644 --- a/src/backend/libc/fs/types.rs +++ b/src/backend/libc/fs/types.rs @@ -461,6 +461,7 @@ impl FileType { /// [`fadvise`]: crate::fs::fadvise #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -697,6 +698,7 @@ bitflags! { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -708,6 +710,7 @@ bitflags! { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -719,6 +722,7 @@ bitflags! { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos", @@ -733,6 +737,7 @@ bitflags! { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -745,6 +750,7 @@ bitflags! { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -757,6 +763,7 @@ bitflags! { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -769,6 +776,7 @@ bitflags! { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -781,6 +789,7 @@ bitflags! { } #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", @@ -912,6 +921,7 @@ pub struct Stat { #[cfg(not(any( target_os = "android", target_os = "emscripten", + target_os = "haiku", target_os = "illumos", target_os = "linux", target_os = "l4re", @@ -940,6 +950,7 @@ pub type StatFs = c::statfs64; /// [`statvfs`]: crate::fs::statvfs /// [`fstatvfs`]: crate::fs::fstatvfs #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", diff --git a/src/backend/libc/io/errno.rs b/src/backend/libc/io/errno.rs index 7a37f5c11..ac5bc33bd 100644 --- a/src/backend/libc/io/errno.rs +++ b/src/backend/libc/io/errno.rs @@ -28,6 +28,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -56,6 +57,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -70,6 +72,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -85,6 +88,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -107,6 +111,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -119,6 +124,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -131,6 +137,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -154,6 +161,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -166,6 +174,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -188,6 +197,7 @@ impl Errno { target_os = "android", target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -211,6 +221,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -252,6 +263,7 @@ impl Errno { target_os = "android", target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -298,6 +310,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -312,6 +325,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -326,6 +340,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -340,6 +355,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -354,6 +370,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -366,6 +383,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -378,6 +396,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -390,6 +409,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -402,6 +422,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -414,6 +435,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -426,6 +448,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -438,6 +461,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -450,6 +474,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -462,6 +487,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -476,6 +502,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -502,6 +529,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -535,6 +563,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -546,6 +575,7 @@ impl Errno { #[cfg(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -559,6 +589,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -571,6 +602,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "openbsd", target_os = "wasi", )))] @@ -589,6 +621,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -609,6 +642,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -632,6 +666,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -644,6 +679,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -661,6 +697,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "openbsd", target_os = "wasi", )))] @@ -670,6 +707,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "openbsd", target_os = "wasi", )))] @@ -678,7 +716,7 @@ impl Errno { #[cfg(not(windows))] pub const NOSYS: Self = Self(c::ENOSYS); /// `ENOTBLK` - #[cfg(not(any(windows, target_os = "wasi")))] + #[cfg(not(any(windows, target_os = "haiku", target_os = "wasi")))] pub const NOTBLK: Self = Self(c::ENOTBLK); /// `ENOTCAPABLE` #[cfg(any(target_os = "freebsd", target_os = "wasi"))] @@ -695,6 +733,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -705,12 +744,12 @@ impl Errno { )))] pub const NOTNAM: Self = Self(c::ENOTNAM); /// `ENOTRECOVERABLE` - #[cfg(not(any(windows, target_os = "dragonfly", target_os = "netbsd")))] + #[cfg(not(any(windows, target_os = "dragonfly", target_os = "haiku", target_os = "netbsd")))] pub const NOTRECOVERABLE: Self = Self(c::ENOTRECOVERABLE); /// `ENOTSOCK` pub const NOTSOCK: Self = Self(c::ENOTSOCK); /// `ENOTSUP` - #[cfg(not(any(windows, target_os = "redox")))] + #[cfg(not(any(windows, target_os = "haiku", target_os = "redox")))] pub const NOTSUP: Self = Self(c::ENOTSUP); /// `ENOTTY` #[cfg(not(windows))] @@ -720,6 +759,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -736,7 +776,7 @@ impl Errno { #[cfg(not(windows))] pub const OVERFLOW: Self = Self(c::EOVERFLOW); /// `EOWNERDEAD` - #[cfg(not(any(windows, target_os = "dragonfly", target_os = "netbsd")))] + #[cfg(not(any(windows, target_os = "haiku", target_os = "dragonfly", target_os = "netbsd")))] pub const OWNERDEAD: Self = Self(c::EOWNERDEAD); /// `EPERM` #[cfg(not(windows))] @@ -808,6 +848,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -816,13 +857,14 @@ impl Errno { )))] pub const REMCHG: Self = Self(c::EREMCHG); /// `EREMOTE` - #[cfg(not(target_os = "wasi"))] + #[cfg(not(any(target_os = "haiku", target_os = "wasi")))] pub const REMOTE: Self = Self(c::EREMOTE); /// `EREMOTEIO` #[cfg(not(any( windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -837,6 +879,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -850,6 +893,7 @@ impl Errno { target_os = "android", target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -877,7 +921,7 @@ impl Errno { #[cfg(not(target_os = "wasi"))] pub const SHUTDOWN: Self = Self(c::ESHUTDOWN); /// `ESOCKTNOSUPPORT` - #[cfg(not(target_os = "wasi"))] + #[cfg(not(any(target_os = "haiku", target_os = "wasi")))] pub const SOCKTNOSUPPORT: Self = Self(c::ESOCKTNOSUPPORT); /// `ESPIPE` #[cfg(not(windows))] @@ -890,6 +934,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -904,6 +949,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -927,7 +973,7 @@ impl Errno { #[doc(alias = "2BIG")] pub const TOOBIG: Self = Self(c::E2BIG); /// `ETOOMANYREFS` - #[cfg(not(target_os = "wasi"))] + #[cfg(not(any(target_os = "haiku", target_os = "wasi")))] pub const TOOMANYREFS: Self = Self(c::ETOOMANYREFS); /// `ETXTBSY` #[cfg(not(windows))] @@ -937,6 +983,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -951,6 +998,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -959,7 +1007,7 @@ impl Errno { )))] pub const UNATCH: Self = Self(c::EUNATCH); /// `EUSERS` - #[cfg(not(target_os = "wasi"))] + #[cfg(not(any(target_os = "haiku", target_os = "wasi")))] pub const USERS: Self = Self(c::EUSERS); /// `EWOULDBLOCK` pub const WOULDBLOCK: Self = Self(c::EWOULDBLOCK); @@ -971,6 +1019,7 @@ impl Errno { windows, target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", diff --git a/src/backend/libc/io/syscalls.rs b/src/backend/libc/io/syscalls.rs index 9d1981e99..d937c51ff 100644 --- a/src/backend/libc/io/syscalls.rs +++ b/src/backend/libc/io/syscalls.rs @@ -7,14 +7,14 @@ use super::super::conv::{ borrowed_fd, ret, ret_c_int, ret_discarded_fd, ret_owned_fd, ret_ssize_t, }; use super::super::offset::{libc_pread, libc_pwrite}; -#[cfg(not(any(target_os = "redox", target_os = "solaris")))] +#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))] use super::super::offset::{libc_preadv, libc_pwritev}; #[cfg(all(target_os = "linux", target_env = "gnu"))] use super::super::offset::{libc_preadv2, libc_pwritev2}; use crate::fd::{AsFd, BorrowedFd, OwnedFd, RawFd}; #[cfg(not(target_os = "wasi"))] use crate::io::DupFlags; -#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))] +#[cfg(not(any(target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "wasi")))] use crate::io::PipeFlags; use crate::io::{self, IoSlice, IoSliceMut, PollFd}; #[cfg(any(target_os = "android", target_os = "linux"))] @@ -103,7 +103,7 @@ pub(crate) fn writev(fd: BorrowedFd<'_>, bufs: &[IoSlice]) -> io::Result Ok(nwritten as usize) } -#[cfg(not(any(target_os = "redox", target_os = "solaris")))] +#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))] pub(crate) fn preadv( fd: BorrowedFd<'_>, bufs: &mut [IoSliceMut], @@ -122,7 +122,7 @@ pub(crate) fn preadv( Ok(nread as usize) } -#[cfg(not(any(target_os = "redox", target_os = "solaris")))] +#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))] pub(crate) fn pwritev(fd: BorrowedFd<'_>, bufs: &[IoSlice], offset: u64) -> io::Result { // Silently cast; we'll get `EINVAL` if the value is negative. let offset = offset as i64; @@ -379,6 +379,7 @@ pub(crate) fn dup2(fd: BorrowedFd<'_>, new: &mut OwnedFd) -> io::Result<()> { #[cfg(not(any( target_os = "android", target_os = "dragonfly", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "redox", @@ -397,6 +398,7 @@ pub(crate) fn dup3(fd: BorrowedFd<'_>, new: &mut OwnedFd, flags: DupFlags) -> io #[cfg(any( target_os = "android", target_os = "dragonfly", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "redox", @@ -414,12 +416,12 @@ pub(crate) fn ioctl_fioclex(fd: BorrowedFd<'_>) -> io::Result<()> { unsafe { ret(c::ioctl(borrowed_fd(fd), c::FIOCLEX)) } } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))] pub(crate) fn ioctl_tiocexcl(fd: BorrowedFd) -> io::Result<()> { unsafe { ret(c::ioctl(borrowed_fd(fd), c::TIOCEXCL as _)) } } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))] pub(crate) fn ioctl_tiocnxcl(fd: BorrowedFd) -> io::Result<()> { unsafe { ret(c::ioctl(borrowed_fd(fd), c::TIOCNXCL as _)) } } @@ -434,7 +436,7 @@ pub(crate) fn pipe() -> io::Result<(OwnedFd, OwnedFd)> { } } -#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))] +#[cfg(not(any(target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "wasi")))] pub(crate) fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> { unsafe { let mut result = MaybeUninit::<[OwnedFd; 2]>::uninit(); diff --git a/src/backend/libc/io/types.rs b/src/backend/libc/io/types.rs index ada610471..6e0213f38 100644 --- a/src/backend/libc/io/types.rs +++ b/src/backend/libc/io/types.rs @@ -54,6 +54,7 @@ bitflags! { const CLOEXEC = c::O_CLOEXEC; /// `O_DIRECT` #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "openbsd", target_os = "redox", @@ -82,6 +83,7 @@ bitflags! { /// `PIPE_BUF`—The maximum size of a write to a pipe guaranteed to be atomic. #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", diff --git a/src/backend/libc/offset.rs b/src/backend/libc/offset.rs index 028cb9939..f0e78dae2 100644 --- a/src/backend/libc/offset.rs +++ b/src/backend/libc/offset.rs @@ -43,6 +43,7 @@ pub(super) use c::mmap as libc_mmap; target_os = "linux", target_os = "emscripten", target_os = "fuchsia", + target_os = "haiku", target_os = "l4re", target_os = "redox", target_os = "wasi", @@ -54,6 +55,7 @@ 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", @@ -168,6 +170,7 @@ pub(super) use c::fallocate64 as libc_fallocate; target_os = "android", target_os = "dragonfly", target_os = "emscripten", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "linux", @@ -289,6 +292,7 @@ mod readwrite_pv64 { windows, target_os = "android", target_os = "emscripten", + target_os = "haiku", target_os = "ios", target_os = "linux", target_os = "macos", @@ -346,6 +350,7 @@ pub(super) use c::posix_fallocate64 as libc_posix_fallocate; windows, target_os = "android", target_os = "emscripten", + target_os = "haiku", target_os = "illumos", target_os = "linux", target_os = "l4re", @@ -359,6 +364,7 @@ pub(super) use {c::fstatfs as libc_fstatfs, c::statfs as libc_statfs}; windows, target_os = "android", target_os = "emscripten", + target_os = "haiku", target_os = "illumos", target_os = "linux", target_os = "l4re", diff --git a/src/backend/libc/process/syscalls.rs b/src/backend/libc/process/syscalls.rs index 3f6598bd0..f2b7fff9b 100644 --- a/src/backend/libc/process/syscalls.rs +++ b/src/backend/libc/process/syscalls.rs @@ -20,7 +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 = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "fuchsia", target_os = "haiku", target_os = "redox", target_os = "wasi")))] use { super::super::conv::ret_infallible, super::super::offset::{libc_getrlimit, libc_rlimit, libc_setrlimit, LIBC_RLIM_INFINITY}, @@ -298,7 +298,7 @@ pub(crate) fn setpriority_process(pid: Option, priority: i32) -> io::Result } } -#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "fuchsia", target_os = "haiku", target_os = "redox", target_os = "wasi")))] #[inline] pub(crate) fn getrlimit(limit: Resource) -> Rlimit { let mut result = MaybeUninit::::uninit(); @@ -308,7 +308,7 @@ pub(crate) fn getrlimit(limit: Resource) -> Rlimit { } } -#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "fuchsia", target_os = "haiku", target_os = "redox", target_os = "wasi")))] #[inline] pub(crate) fn setrlimit(limit: Resource, new: Rlimit) -> io::Result<()> { let lim = rlimit_to_libc(new)?; @@ -332,7 +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 = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "fuchsia", target_os = "haiku", target_os = "redox", target_os = "wasi")))] fn rlimit_from_libc(lim: libc_rlimit) -> Rlimit { let current = if lim.rlim_cur == LIBC_RLIM_INFINITY { None @@ -348,7 +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 = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "fuchsia", target_os = "haiku", 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 e9055c03a..16ba74018 100644 --- a/src/backend/libc/process/types.rs +++ b/src/backend/libc/process/types.rs @@ -41,7 +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 = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "fuchsia", target_os = "haiku", target_os = "redox", target_os = "wasi")))] #[derive(Copy, Clone, Debug, Eq, PartialEq)] #[repr(i32)] pub enum Resource { @@ -203,6 +203,7 @@ pub enum Signal { /// `SIGSTKFLT` #[cfg(not(any( target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -243,10 +244,12 @@ pub enum Signal { Winch = c::SIGWINCH, /// `SIGIO`, aka `SIGPOLL` #[doc(alias = "Poll")] + #[cfg(not(target_os = "haiku"))] Io = c::SIGIO, /// `SIGPWR` #[cfg(not(any( target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", @@ -281,6 +284,7 @@ impl Signal { c::SIGTERM => Some(Self::Term), #[cfg(not(any( target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -305,9 +309,11 @@ impl Signal { c::SIGVTALRM => Some(Self::Vtalarm), c::SIGPROF => Some(Self::Prof), c::SIGWINCH => Some(Self::Winch), + #[cfg(not(target_os = "haiku"))] c::SIGIO => Some(Self::Io), #[cfg(not(any( target_os = "freebsd", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "netbsd", diff --git a/src/fs/fd.rs b/src/fs/fd.rs index 08f99cdf7..d53033488 100644 --- a/src/fs/fd.rs +++ b/src/fs/fd.rs @@ -24,6 +24,7 @@ pub use backend::fs::types::FallocateFlags; pub use backend::fs::types::Stat; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", @@ -33,6 +34,7 @@ pub use backend::fs::types::Stat; pub use backend::fs::types::StatFs; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", @@ -164,6 +166,7 @@ pub fn fstat(fd: Fd) -> io::Result { /// /// [Linux]: https://man7.org/linux/man-pages/man2/fstatfs.2.html #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", @@ -190,6 +193,7 @@ pub fn fstatfs(fd: Fd) -> io::Result { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fstatvfs.html /// [Linux]: https://man7.org/linux/man-pages/man2/fstatvfs.2.html #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", @@ -306,6 +310,7 @@ pub fn fsync(fd: Fd) -> io::Result<()> { /// [Linux]: https://man7.org/linux/man-pages/man2/fdatasync.2.html #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "redox", diff --git a/src/fs/mod.rs b/src/fs/mod.rs index 54aa0ea73..328e44316 100644 --- a/src/fs/mod.rs +++ b/src/fs/mod.rs @@ -22,6 +22,7 @@ mod cwd; mod dir; #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -43,6 +44,7 @@ mod getpath; #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -134,6 +136,7 @@ pub use cwd::cwd; pub use dir::{Dir, DirEntry}; #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", @@ -162,6 +165,7 @@ pub use fcopyfile::{ }; #[cfg(not(any( target_os = "dragonfly", + target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "redox", @@ -182,6 +186,7 @@ pub use fd::{fchmod, fchown}; pub use fd::{flock, FlockOperation}; pub use fd::{fstat, fsync, ftruncate, futimens, is_file_read_write, seek, tell, Stat, Timestamps}; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "netbsd", target_os = "redox", @@ -190,6 +195,7 @@ pub use fd::{fstat, fsync, ftruncate, futimens, is_file_read_write, seek, tell, )))] pub use fd::{fstatfs, StatFs}; #[cfg(not(any( + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", @@ -204,6 +210,7 @@ pub use getpath::getpath; #[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/io/ioctl.rs b/src/io/ioctl.rs index 120bd82a3..01ded2e12 100644 --- a/src/io/ioctl.rs +++ b/src/io/ioctl.rs @@ -12,7 +12,7 @@ use backend::fd::AsFd; /// - [Linux] /// /// [Linux]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html -#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "wasi")))] #[inline] #[doc(alias = "TIOCEXCL")] pub fn ioctl_tiocexcl(fd: Fd) -> io::Result<()> { @@ -25,7 +25,7 @@ pub fn ioctl_tiocexcl(fd: Fd) -> io::Result<()> { /// - [Linux] /// /// [Linux]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html -#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "wasi")))] #[inline] #[doc(alias = "TIOCNXCL")] pub fn ioctl_tiocnxcl(fd: Fd) -> io::Result<()> { diff --git a/src/io/mod.rs b/src/io/mod.rs index 4d182226b..fda085be1 100644 --- a/src/io/mod.rs +++ b/src/io/mod.rs @@ -39,7 +39,7 @@ pub use ioctl::ioctl_fionbio; pub use ioctl::ioctl_fionread; #[cfg(any(target_os = "android", target_os = "linux"))] pub use ioctl::{ioctl_blkpbszget, ioctl_blksszget}; -#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "wasi")))] pub use ioctl::{ioctl_tiocexcl, ioctl_tiocnxcl}; #[cfg(not(any(windows, target_os = "redox")))] #[cfg(feature = "net")] @@ -48,20 +48,21 @@ pub use is_read_write::is_read_write; pub use pipe::pipe; #[cfg(not(any( windows, + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", target_os = "wasi", )))] pub use pipe::PIPE_BUF; -#[cfg(not(any(windows, target_os = "ios", target_os = "macos", target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "wasi")))] pub use pipe::{pipe_with, PipeFlags}; pub use poll::{poll, PollFd, PollFlags}; #[cfg(all(feature = "procfs", any(target_os = "android", target_os = "linux")))] pub use procfs::{proc_self_fd, proc_self_fdinfo_fd, proc_self_maps, proc_self_pagemap}; #[cfg(not(windows))] pub use read_write::{pread, pwrite, read, readv, write, writev, IoSlice, IoSliceMut}; -#[cfg(not(any(windows, target_os = "redox", target_os = "solaris")))] +#[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "solaris")))] pub use read_write::{preadv, pwritev}; #[cfg(any(target_os = "android", target_os = "linux"))] pub use read_write::{preadv2, pwritev2, ReadWriteFlags}; diff --git a/src/io/pipe.rs b/src/io/pipe.rs index b87550162..2b94056d3 100644 --- a/src/io/pipe.rs +++ b/src/io/pipe.rs @@ -15,6 +15,7 @@ pub use backend::io::types::PipeFlags; /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html #[cfg(not(any( windows, + target_os = "haiku", target_os = "illumos", target_os = "redox", target_os = "solaris", @@ -47,7 +48,7 @@ pub fn pipe() -> io::Result<(OwnedFd, OwnedFd)> { /// - [Linux] /// /// [Linux]: https://man7.org/linux/man-pages/man2/pipe2.2.html -#[cfg(not(any(target_os = "ios", target_os = "macos")))] +#[cfg(not(any(target_os = "haiku", target_os = "ios", target_os = "macos")))] #[inline] #[doc(alias = "pipe2")] pub fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> { diff --git a/src/io/read_write.rs b/src/io/read_write.rs index aa2840fc6..1a4d37b65 100644 --- a/src/io/read_write.rs +++ b/src/io/read_write.rs @@ -112,7 +112,7 @@ pub fn writev(fd: Fd, bufs: &[IoSlice<'_>]) -> io::Result { /// - [Linux] /// /// [Linux]: https://man7.org/linux/man-pages/man2/preadv.2.html -#[cfg(not(any(target_os = "redox", target_os = "solaris")))] +#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))] #[inline] pub fn preadv(fd: Fd, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io::Result { backend::io::syscalls::preadv(fd.as_fd(), bufs, offset) @@ -125,7 +125,7 @@ pub fn preadv(fd: Fd, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io: /// - [Linux] /// /// [Linux]: https://man7.org/linux/man-pages/man2/pwritev.2.html -#[cfg(not(any(target_os = "redox", target_os = "solaris")))] +#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))] #[inline] pub fn pwritev(fd: Fd, bufs: &[IoSlice<'_>], offset: u64) -> io::Result { backend::io::syscalls::pwritev(fd.as_fd(), bufs, offset) diff --git a/src/process/mod.rs b/src/process/mod.rs index 8b517961a..1570feaa7 100644 --- a/src/process/mod.rs +++ b/src/process/mod.rs @@ -13,7 +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 = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "fuchsia", target_os = "haiku", target_os = "redox", target_os = "wasi")))] mod rlimit; #[cfg(any( target_os = "android", @@ -61,7 +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 = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "fuchsia", target_os = "haiku", target_os = "redox", target_os = "wasi")))] pub use rlimit::{getrlimit, setrlimit, Resource, Rlimit}; #[cfg(any( target_os = "android", From c09211c43f749271ebff3bbe1adc7274e72f50dd Mon Sep 17 00:00:00 2001 From: Al Hoang <3811822-hoanga@users.noreply.gitlab.com> Date: Sat, 24 Sep 2022 10:03:55 +0000 Subject: [PATCH 2/2] cargo format --- src/backend/libc/io/errno.rs | 14 +++++++++-- src/backend/libc/io/syscalls.rs | 14 +++++++++-- src/backend/libc/process/syscalls.rs | 35 ++++++++++++++++++++++++---- src/backend/libc/process/types.rs | 7 +++++- src/io/mod.rs | 15 ++++++++++-- src/process/mod.rs | 14 +++++++++-- 6 files changed, 85 insertions(+), 14 deletions(-) diff --git a/src/backend/libc/io/errno.rs b/src/backend/libc/io/errno.rs index ac5bc33bd..e3b0b2309 100644 --- a/src/backend/libc/io/errno.rs +++ b/src/backend/libc/io/errno.rs @@ -744,7 +744,12 @@ impl Errno { )))] pub const NOTNAM: Self = Self(c::ENOTNAM); /// `ENOTRECOVERABLE` - #[cfg(not(any(windows, target_os = "dragonfly", target_os = "haiku", target_os = "netbsd")))] + #[cfg(not(any( + windows, + target_os = "dragonfly", + target_os = "haiku", + target_os = "netbsd" + )))] pub const NOTRECOVERABLE: Self = Self(c::ENOTRECOVERABLE); /// `ENOTSOCK` pub const NOTSOCK: Self = Self(c::ENOTSOCK); @@ -776,7 +781,12 @@ impl Errno { #[cfg(not(windows))] pub const OVERFLOW: Self = Self(c::EOVERFLOW); /// `EOWNERDEAD` - #[cfg(not(any(windows, target_os = "haiku", target_os = "dragonfly", target_os = "netbsd")))] + #[cfg(not(any( + windows, + target_os = "haiku", + target_os = "dragonfly", + target_os = "netbsd" + )))] pub const OWNERDEAD: Self = Self(c::EOWNERDEAD); /// `EPERM` #[cfg(not(windows))] diff --git a/src/backend/libc/io/syscalls.rs b/src/backend/libc/io/syscalls.rs index d937c51ff..305ad4dd6 100644 --- a/src/backend/libc/io/syscalls.rs +++ b/src/backend/libc/io/syscalls.rs @@ -14,7 +14,12 @@ use super::super::offset::{libc_preadv2, libc_pwritev2}; use crate::fd::{AsFd, BorrowedFd, OwnedFd, RawFd}; #[cfg(not(target_os = "wasi"))] use crate::io::DupFlags; -#[cfg(not(any(target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "wasi")))] +#[cfg(not(any( + target_os = "haiku", + target_os = "ios", + target_os = "macos", + target_os = "wasi" +)))] use crate::io::PipeFlags; use crate::io::{self, IoSlice, IoSliceMut, PollFd}; #[cfg(any(target_os = "android", target_os = "linux"))] @@ -436,7 +441,12 @@ pub(crate) fn pipe() -> io::Result<(OwnedFd, OwnedFd)> { } } -#[cfg(not(any(target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "wasi")))] +#[cfg(not(any( + target_os = "haiku", + target_os = "ios", + target_os = "macos", + target_os = "wasi" +)))] pub(crate) fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> { unsafe { let mut result = MaybeUninit::<[OwnedFd; 2]>::uninit(); diff --git a/src/backend/libc/process/syscalls.rs b/src/backend/libc/process/syscalls.rs index f2b7fff9b..fdbf05d39 100644 --- a/src/backend/libc/process/syscalls.rs +++ b/src/backend/libc/process/syscalls.rs @@ -20,7 +20,12 @@ 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 = "haiku", + target_os = "redox", + target_os = "wasi" +)))] use { super::super::conv::ret_infallible, super::super::offset::{libc_getrlimit, libc_rlimit, libc_setrlimit, LIBC_RLIM_INFINITY}, @@ -298,7 +303,12 @@ 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 = "haiku", + target_os = "redox", + target_os = "wasi" +)))] #[inline] pub(crate) fn getrlimit(limit: Resource) -> Rlimit { let mut result = MaybeUninit::::uninit(); @@ -308,7 +318,12 @@ 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 = "haiku", + target_os = "redox", + target_os = "wasi" +)))] #[inline] pub(crate) fn setrlimit(limit: Resource, new: Rlimit) -> io::Result<()> { let lim = rlimit_to_libc(new)?; @@ -332,7 +347,12 @@ 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 = "haiku", + target_os = "redox", + target_os = "wasi" +)))] fn rlimit_from_libc(lim: libc_rlimit) -> Rlimit { let current = if lim.rlim_cur == LIBC_RLIM_INFINITY { None @@ -348,7 +368,12 @@ 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 = "haiku", + 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 16ba74018..108d466de 100644 --- a/src/backend/libc/process/types.rs +++ b/src/backend/libc/process/types.rs @@ -41,7 +41,12 @@ 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 = "haiku", + target_os = "redox", + target_os = "wasi" +)))] #[derive(Copy, Clone, Debug, Eq, PartialEq)] #[repr(i32)] pub enum Resource { diff --git a/src/io/mod.rs b/src/io/mod.rs index fda085be1..1c2f327d2 100644 --- a/src/io/mod.rs +++ b/src/io/mod.rs @@ -55,14 +55,25 @@ pub use pipe::pipe; target_os = "wasi", )))] pub use pipe::PIPE_BUF; -#[cfg(not(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos", target_os = "wasi")))] +#[cfg(not(any( + windows, + target_os = "haiku", + target_os = "ios", + target_os = "macos", + target_os = "wasi" +)))] pub use pipe::{pipe_with, PipeFlags}; pub use poll::{poll, PollFd, PollFlags}; #[cfg(all(feature = "procfs", any(target_os = "android", target_os = "linux")))] pub use procfs::{proc_self_fd, proc_self_fdinfo_fd, proc_self_maps, proc_self_pagemap}; #[cfg(not(windows))] pub use read_write::{pread, pwrite, read, readv, write, writev, IoSlice, IoSliceMut}; -#[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "solaris")))] +#[cfg(not(any( + windows, + target_os = "haiku", + target_os = "redox", + target_os = "solaris" +)))] pub use read_write::{preadv, pwritev}; #[cfg(any(target_os = "android", target_os = "linux"))] pub use read_write::{preadv2, pwritev2, ReadWriteFlags}; diff --git a/src/process/mod.rs b/src/process/mod.rs index 1570feaa7..277c14dfe 100644 --- a/src/process/mod.rs +++ b/src/process/mod.rs @@ -13,7 +13,12 @@ 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 = "haiku", + target_os = "redox", + target_os = "wasi" +)))] mod rlimit; #[cfg(any( target_os = "android", @@ -61,7 +66,12 @@ 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 = "haiku", + target_os = "redox", + target_os = "wasi" +)))] pub use rlimit::{getrlimit, setrlimit, Resource, Rlimit}; #[cfg(any( target_os = "android",