From 04b869fe595b84d686d40e0642253cfd76b6c2c9 Mon Sep 17 00:00:00 2001 From: Bhavya Gautam Date: Wed, 18 Mar 2026 11:05:35 +0530 Subject: [PATCH] Adding Support for vxworks in rustix --- src/backend/libc/fs/dir.rs | 11 +++++- src/backend/libc/fs/mod.rs | 3 +- src/backend/libc/fs/syscalls.rs | 47 +++++++++++++++------- src/backend/libc/fs/types.rs | 39 ++++++++++++++---- src/backend/libc/io/errno.rs | 70 +++++++++++++++++++++++++++------ src/backend/libc/io/syscalls.rs | 3 ++ src/buffer.rs | 1 + src/fs/abs.rs | 4 +- src/fs/at.rs | 22 +++++++++-- src/fs/constants.rs | 16 ++++++-- src/fs/fcntl.rs | 2 +- src/fs/fd.rs | 9 +++-- src/fs/mod.rs | 14 +++++-- src/io/dup.rs | 3 +- src/io/read_write.rs | 2 + src/ioctl/mod.rs | 5 ++- src/path/arg.rs | 2 - src/ugid.rs | 19 +++++++++ tests/fs/chmodat.rs | 2 +- tests/fs/dir.rs | 7 +++- tests/fs/fcntl.rs | 2 +- tests/fs/file.rs | 2 +- tests/fs/flock.rs | 2 +- tests/fs/futimens.rs | 2 +- tests/fs/invalid_offset.rs | 4 +- tests/fs/linkat.rs | 2 +- tests/fs/main.rs | 24 ++++++++--- tests/fs/mkdirat.rs | 2 +- tests/fs/seek.rs | 1 + tests/fs/symlinkat.rs | 2 +- tests/fs/utimensat.rs | 2 +- tests/fs/y2038.rs | 8 ++-- tests/io/close.rs | 1 + tests/io/main.rs | 6 +-- tests/io/read_write.rs | 3 ++ 35 files changed, 261 insertions(+), 83 deletions(-) diff --git a/src/backend/libc/fs/dir.rs b/src/backend/libc/fs/dir.rs index 3c4c3896b..e7252fb0f 100644 --- a/src/backend/libc/fs/dir.rs +++ b/src/backend/libc/fs/dir.rs @@ -24,7 +24,12 @@ use crate::fs::{fstat, Stat}; target_os = "wasi", )))] use crate::fs::{fstatfs, StatFs}; -#[cfg(not(any(solarish, target_os = "vita", target_os = "wasi")))] +#[cfg(not(any( + solarish, + target_os = "vita", + target_os = "wasi", + target_os = "vxworks" +)))] use crate::fs::{fstatvfs, StatVfs}; use crate::io; #[cfg(not(any(target_os = "fuchsia", target_os = "vita", target_os = "wasi")))] @@ -159,6 +164,7 @@ impl Dir { /// /// [`libc::seekdir`]: https://docs.rs/libc/*/arm-unknown-linux-gnueabihf/libc/fn.seekdir.html #[cfg(target_pointer_width = "64")] + #[cfg(not(target_os = "vxworks"))] #[cfg_attr(docsrs, doc(cfg(target_pointer_width = "64")))] #[doc(alias = "seekdir")] #[inline] @@ -260,7 +266,8 @@ impl Dir { solarish, target_os = "horizon", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks", )))] #[inline] pub fn statvfs(&self) -> io::Result { diff --git a/src/backend/libc/fs/mod.rs b/src/backend/libc/fs/mod.rs index e5e821ea7..7713a9197 100644 --- a/src/backend/libc/fs/mod.rs +++ b/src/backend/libc/fs/mod.rs @@ -7,7 +7,8 @@ pub mod inotify; target_os = "haiku", target_os = "horizon", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks", )))] pub(crate) mod makedev; #[cfg(not(windows))] diff --git a/src/backend/libc/fs/syscalls.rs b/src/backend/libc/fs/syscalls.rs index 71bc8b0ab..ba43dc918 100644 --- a/src/backend/libc/fs/syscalls.rs +++ b/src/backend/libc/fs/syscalls.rs @@ -22,6 +22,7 @@ use crate::fs::AtFlags; target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "vxworks", )))] use crate::fs::FallocateFlags; #[cfg(not(any( @@ -60,7 +61,7 @@ use crate::fs::Timestamps; )))] use crate::fs::{Dev, FileType}; use crate::fs::{Mode, OFlags, SeekFrom, Stat}; -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "wasi", target_os = "vxworks")))] use crate::fs::{StatVfs, StatVfsMountFlags}; use crate::io; #[cfg(all(target_env = "gnu", fix_y2038))] @@ -85,6 +86,7 @@ use { target_os = "redox", target_os = "solaris", target_os = "vita", + target_os = "vxworks", )))] use {crate::fs::Advice, core::num::NonZeroU64}; #[cfg(any(apple, linux_kernel, target_os = "hurd"))] @@ -103,7 +105,7 @@ weak!(fn __futimens64(c::c_int, *const LibcTimespec) -> c::c_int); /// Use a direct syscall (via libc) for `open`. /// /// This is only currently necessary as a workaround for old glibc; see below. -#[cfg(all(unix, target_env = "gnu"))] +#[cfg(all(not(target_os = "vxworks"), unix, target_env = "gnu"))] fn open_via_syscall(path: &CStr, oflags: OFlags, mode: Mode) -> io::Result { // Linux on aarch64, loongarch64 and riscv64 has no `open` syscall so use // `openat`. @@ -150,7 +152,8 @@ pub(crate) fn open(path: &CStr, oflags: OFlags, mode: Mode) -> io::Result io::Result { } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "wasi", target_os = "vxworks")))] #[inline] pub(crate) fn statvfs(filename: &CStr) -> io::Result { unsafe { @@ -448,6 +452,7 @@ pub(crate) fn rename(old_path: &CStr, new_path: &CStr) -> io::Result<()> { unsafe { ret(c::rename(c_str(old_path), c_str(new_path))) } } +#[cfg(not(target_os = "vxworks"))] pub(crate) fn renameat( old_dirfd: BorrowedFd<'_>, old_path: &CStr, @@ -481,7 +486,7 @@ pub(crate) fn renameat( ret(c::rename(c_str(old_path), c_str(new_path))) } - #[cfg(not(target_os = "macos"))] + #[cfg(not(any(target_os = "macos", target_os = "vxworks")))] unsafe { ret(c::renameat( borrowed_fd(old_dirfd), @@ -729,7 +734,7 @@ pub(crate) fn lstat(path: &CStr) -> io::Result { } } -#[cfg(not(any(target_os = "espidf", target_os = "redox")))] +#[cfg(not(any(target_os = "espidf", target_os = "redox", target_os = "vxworks")))] pub(crate) fn statat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result { // See the comments in `fstat` about using `crate::fs::statx` here. #[cfg(all( @@ -812,7 +817,8 @@ pub(crate) fn access(path: &CStr, access: Access) -> io::Result<()> { target_os = "espidf", target_os = "horizon", target_os = "redox", - target_os = "vita" + target_os = "vita", + target_os = "vxworks", )))] pub(crate) fn accessat( dirfd: BorrowedFd<'_>, @@ -1096,7 +1102,8 @@ pub(crate) fn chmod(path: &CStr, mode: Mode) -> io::Result<()> { linux_kernel, target_os = "espidf", target_os = "redox", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks", )))] pub(crate) fn chmodat( dirfd: BorrowedFd<'_>, @@ -1175,7 +1182,12 @@ pub(crate) fn fclonefileat( } } -#[cfg(not(any(target_os = "espidf", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "redox", + target_os = "wasi", + target_os = "vxworks" +)))] pub(crate) fn chownat( dirfd: BorrowedFd<'_>, path: &CStr, @@ -1201,7 +1213,8 @@ pub(crate) fn chownat( target_os = "horizon", target_os = "redox", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks", )))] pub(crate) fn mknodat( dirfd: BorrowedFd<'_>, @@ -1283,6 +1296,7 @@ pub(crate) fn copy_file_range( target_os = "redox", target_os = "solaris", target_os = "vita", + target_os = "vxworks", )))] pub(crate) fn fadvise( fd: BorrowedFd<'_>, @@ -1494,7 +1508,8 @@ pub(crate) fn fchown(fd: BorrowedFd<'_>, owner: Option, group: Option) target_os = "horizon", target_os = "solaris", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks", )))] pub(crate) fn flock(fd: BorrowedFd<'_>, operation: FlockOperation) -> io::Result<()> { unsafe { ret(c::flock(borrowed_fd(fd), operation as c::c_int)) } @@ -1522,7 +1537,8 @@ pub(crate) fn syncfs(fd: BorrowedFd<'_>) -> io::Result<()> { target_os = "horizon", target_os = "redox", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks", )))] pub(crate) fn sync() { unsafe { c::sync() } @@ -1609,7 +1625,7 @@ pub(crate) fn fstatfs(fd: BorrowedFd<'_>) -> io::Result { } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "wasi", target_os = "vxworks")))] pub(crate) fn fstatvfs(fd: BorrowedFd<'_>) -> io::Result { let mut statvfs = MaybeUninit::::uninit(); unsafe { @@ -1618,7 +1634,7 @@ pub(crate) fn fstatvfs(fd: BorrowedFd<'_>) -> io::Result { } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "wasi", target_os = "vxworks")))] fn libc_statvfs_to_statvfs(from: c::statvfs) -> StatVfs { StatVfs { f_bsize: from.f_bsize as u64, @@ -1744,6 +1760,7 @@ fn futimens_old(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()> { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "vxworks", )))] pub(crate) fn fallocate( fd: BorrowedFd<'_>, diff --git a/src/backend/libc/fs/types.rs b/src/backend/libc/fs/types.rs index b8944ad7c..342debc7c 100644 --- a/src/backend/libc/fs/types.rs +++ b/src/backend/libc/fs/types.rs @@ -41,7 +41,7 @@ bitflags! { const SYMLINK_NOFOLLOW = bitcast!(c::AT_SYMLINK_NOFOLLOW); /// `AT_EACCESS` - #[cfg(not(target_os = "android"))] + #[cfg(not(any(target_os = "android", target_os = "vxworks")))] const EACCESS = bitcast!(c::AT_EACCESS); /// `AT_REMOVEDIR` @@ -259,7 +259,7 @@ bitflags! { const CREATE = bitcast!(c::O_CREAT); /// `O_DIRECTORY` - #[cfg(not(any(target_os = "espidf", target_os = "horizon")))] + #[cfg(not(any(target_os = "espidf", target_os = "horizon", target_os = "vxworks")))] const DIRECTORY = bitcast!(c::O_DIRECTORY); /// `O_DSYNC` @@ -277,7 +277,7 @@ bitflags! { const FSYNC = bitcast!(c::O_FSYNC); /// `O_NOFOLLOW` - #[cfg(not(any(target_os = "espidf", target_os = "horizon")))] + #[cfg(not(any(target_os = "espidf", target_os = "horizon", target_os = "vxworks")))] const NOFOLLOW = bitcast!(c::O_NOFOLLOW); /// `O_NONBLOCK` @@ -295,7 +295,7 @@ bitflags! { const RDWR = bitcast!(c::O_RDWR); /// `O_NOCTTY` - #[cfg(not(any(target_os = "espidf", target_os = "horizon", target_os = "l4re", target_os = "redox", target_os = "vita")))] + #[cfg(not(any(target_os = "espidf", target_os = "horizon", target_os = "l4re", target_os = "redox", target_os = "vita", target_os = "vxworks")))] const NOCTTY = bitcast!(c::O_NOCTTY); /// `O_RSYNC` @@ -654,6 +654,7 @@ impl FileType { target_os = "redox", target_os = "solaris", target_os = "vita", + target_os = "vxworks", )))] #[derive(Debug, Copy, Clone, Eq, PartialEq)] #[repr(u32)] @@ -767,7 +768,8 @@ bitflags! { target_os = "horizon", target_os = "nto", target_os = "redox", - target_os = "vita" + target_os = "vita", + target_os = "vxworks", )))] bitflags! { /// `FALLOC_FL_*` constants for use with [`fallocate`]. @@ -861,7 +863,7 @@ bitflags! { } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "wasi", target_os = "vxworks")))] bitflags! { /// `ST_*` constants for use with [`StatVfs`]. #[repr(transparent)] @@ -924,7 +926,8 @@ bitflags! { target_os = "espidf", target_os = "horizon", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks", )))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] #[repr(u32)] @@ -967,6 +970,26 @@ pub enum FlockOperation { NonBlockingUnlock = bitcast!(8 | 4), } +/// On Vxworks, we do not have flock or the flock enum. +/// So here, we create the enum ourselves +#[cfg(target_os = "vxworks")] +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[repr(i32)] +pub enum FlockOperation { + /// `LOCK_SH` + LockShared = 1, + /// `LOCK_EX` + LockExclusive = 2, + /// `LOCK_UN` + Unlock = 4, + /// `LOCK_SH | LOCK_NB` + NonBlockingLockShared = 1 | 8, + /// `LOCK_EX | LOCK_NB` + NonBlockingLockExclusive = 2 | 8, + /// `LOCK_UN | LOCK_NB` + NonBlockingUnlock = 4 | 8, +} + /// `struct stat` for use with [`statat`] and [`fstat`]. /// /// [`statat`]: crate::fs::statat @@ -1093,7 +1116,7 @@ pub type Fsid = c::fsid_t; /// /// [`statvfs`]: crate::fs::statvfs /// [`fstatvfs`]: crate::fs::fstatvfs -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "wasi", target_os = "vxworks")))] #[allow(missing_docs)] pub struct StatVfs { pub f_bsize: u64, diff --git a/src/backend/libc/io/errno.rs b/src/backend/libc/io/errno.rs index 81f0e4893..0e97fff9b 100644 --- a/src/backend/libc/io/errno.rs +++ b/src/backend/libc/io/errno.rs @@ -56,6 +56,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const ADV: Self = Self(c::EADV); /// `EAFNOSUPPORT` @@ -81,6 +82,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const BADE: Self = Self(c::EBADE); /// `EBADF` @@ -97,6 +99,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const BADFD: Self = Self(c::EBADFD); /// `EBADMSG` @@ -114,6 +117,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const BADR: Self = Self(c::EBADR); /// `EBADRPC` @@ -131,6 +135,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const BADRQC: Self = Self(c::EBADRQC); /// `EBADSLT` @@ -145,6 +150,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const BADSLT: Self = Self(c::EBADSLT); /// `EBFONT` @@ -159,6 +165,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const BFONT: Self = Self(c::EBFONT); /// `EBUSY` @@ -183,7 +190,8 @@ impl Errno { target_os = "hurd", target_os = "l4re", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks" )))] pub const CHRNG: Self = Self(c::ECHRNG); /// `ECOMM` @@ -198,6 +206,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const COMM: Self = Self(c::ECOMM); /// `ECONNABORTED` @@ -221,6 +230,7 @@ impl Errno { target_os = "hurd", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const DEADLOCK: Self = Self(c::EDEADLOCK); /// `EDESTADDRREQ` @@ -249,6 +259,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const DOTDOT: Self = Self(c::EDOTDOT); /// `EDQUOT` @@ -286,6 +297,7 @@ impl Errno { target_os = "redox", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const HWPOISON: Self = Self(c::EHWPOISON); /// `EIDRM` @@ -336,6 +348,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const ISNAM: Self = Self(c::EISNAM); /// `EKEYEXPIRED` @@ -353,6 +366,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const KEYEXPIRED: Self = Self(c::EKEYEXPIRED); /// `EKEYREJECTED` @@ -370,6 +384,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const KEYREJECTED: Self = Self(c::EKEYREJECTED); /// `EKEYREVOKED` @@ -387,6 +402,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const KEYREVOKED: Self = Self(c::EKEYREVOKED); /// `EL2HLT` @@ -399,7 +415,8 @@ impl Errno { target_os = "hurd", target_os = "l4re", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks" )))] pub const L2HLT: Self = Self(c::EL2HLT); /// `EL2NSYNC` @@ -412,7 +429,8 @@ impl Errno { target_os = "hurd", target_os = "l4re", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks" )))] pub const L2NSYNC: Self = Self(c::EL2NSYNC); /// `EL3HLT` @@ -425,7 +443,8 @@ impl Errno { target_os = "hurd", target_os = "l4re", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks" )))] pub const L3HLT: Self = Self(c::EL3HLT); /// `EL3RST` @@ -438,7 +457,8 @@ impl Errno { target_os = "hurd", target_os = "l4re", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks" )))] pub const L3RST: Self = Self(c::EL3RST); /// `ELIBACC` @@ -453,6 +473,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const LIBACC: Self = Self(c::ELIBACC); /// `ELIBBAD` @@ -467,6 +488,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const LIBBAD: Self = Self(c::ELIBBAD); /// `ELIBEXEC` @@ -480,6 +502,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const LIBEXEC: Self = Self(c::ELIBEXEC); /// `ELIBMAX` @@ -494,6 +517,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const LIBMAX: Self = Self(c::ELIBMAX); /// `ELIBSCN` @@ -508,6 +532,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const LIBSCN: Self = Self(c::ELIBSCN); /// `ELNRNG` @@ -520,7 +545,8 @@ impl Errno { target_os = "hurd", target_os = "l4re", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks" )))] pub const LNRNG: Self = Self(c::ELNRNG); /// `ELOOP` @@ -540,6 +566,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const MEDIUMTYPE: Self = Self(c::EMEDIUMTYPE); /// `EMFILE` @@ -570,6 +597,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const NAVAIL: Self = Self(c::ENAVAIL); /// `ENEEDAUTH` @@ -597,6 +625,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const NOANO: Self = Self(c::ENOANO); /// `ENOATTR` @@ -615,7 +644,8 @@ impl Errno { target_os = "hurd", target_os = "l4re", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks" )))] pub const NOCSI: Self = Self(c::ENOCSI); /// `ENODATA` @@ -651,6 +681,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const NOKEY: Self = Self(c::ENOKEY); /// `ENOLCK` @@ -673,6 +704,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const NOMEDIUM: Self = Self(c::ENOMEDIUM); /// `ENOMEM` @@ -696,6 +728,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const NONET: Self = Self(c::ENONET); /// `ENOPKG` @@ -710,6 +743,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const NOPKG: Self = Self(c::ENOPKG); /// `ENOPROTOOPT` @@ -776,6 +810,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const NOTNAM: Self = Self(c::ENOTNAM); /// `ENOTRECOVERABLE` @@ -808,6 +843,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const NOTUNIQ: Self = Self(c::ENOTUNIQ); /// `ENXIO` @@ -878,6 +914,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const REMCHG: Self = Self(c::EREMCHG); /// `EREMOTE` @@ -887,7 +924,8 @@ impl Errno { target_os = "horizon", target_os = "l4re", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks" )))] pub const REMOTE: Self = Self(c::EREMOTE); /// `EREMOTEIO` @@ -905,6 +943,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const REMOTEIO: Self = Self(c::EREMOTEIO); /// `ERESTART` @@ -919,6 +958,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks", )))] pub const RESTART: Self = Self(c::ERESTART); /// `ERFKILL` @@ -938,6 +978,7 @@ impl Errno { target_os = "redox", target_os = "vita", target_os = "wasi", + target_os = "vxworks", )))] pub const RFKILL: Self = Self(c::ERFKILL); /// `EROFS` @@ -952,7 +993,8 @@ impl Errno { target_os = "horizon", target_os = "l4re", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks" )))] pub const SHUTDOWN: Self = Self(c::ESHUTDOWN); /// `ESOCKTNOSUPPORT` @@ -983,6 +1025,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const SRMNT: Self = Self(c::ESRMNT); /// `ESTALE` @@ -999,6 +1042,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks", )))] pub const STRPIPE: Self = Self(c::ESTRPIPE); /// `ETIME` @@ -1037,6 +1081,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const UCLEAN: Self = Self(c::EUCLEAN); /// `EUNATCH` @@ -1049,7 +1094,8 @@ impl Errno { target_os = "hurd", target_os = "l4re", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks", )))] pub const UNATCH: Self = Self(c::EUNATCH); /// `EUSERS` @@ -1059,7 +1105,8 @@ impl Errno { target_os = "horizon", target_os = "l4re", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks", )))] pub const USERS: Self = Self(c::EUSERS); /// `EWOULDBLOCK` @@ -1079,6 +1126,7 @@ impl Errno { target_os = "l4re", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub const XFULL: Self = Self(c::EXFULL); } diff --git a/src/backend/libc/io/syscalls.rs b/src/backend/libc/io/syscalls.rs index d91e983c2..703a4df53 100644 --- a/src/backend/libc/io/syscalls.rs +++ b/src/backend/libc/io/syscalls.rs @@ -101,6 +101,7 @@ pub(crate) fn writev(fd: BorrowedFd<'_>, bufs: &[IoSlice<'_>]) -> io::Result, @@ -132,6 +133,7 @@ pub(crate) fn preadv( target_os = "redox", target_os = "solaris", target_os = "vita", + target_os = "vxworks", )))] pub(crate) fn pwritev(fd: BorrowedFd<'_>, bufs: &[IoSlice<'_>], offset: u64) -> io::Result { // Silently cast; we'll get `EINVAL` if the value is negative. @@ -276,6 +278,7 @@ pub(crate) fn dup2(fd: BorrowedFd<'_>, new: &mut OwnedFd) -> io::Result<()> { target_os = "redox", target_os = "vita", target_os = "wasi", + target_os = "vxworks" )))] pub(crate) fn dup3(fd: BorrowedFd<'_>, new: &mut OwnedFd, flags: DupFlags) -> io::Result<()> { unsafe { diff --git a/src/buffer.rs b/src/buffer.rs index 3584c5b39..63e213a35 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -322,6 +322,7 @@ mod private { } } +#[cfg(not(target_os = "vxworks"))] #[cfg(test)] mod tests { #[allow(unused_imports)] diff --git a/src/fs/abs.rs b/src/fs/abs.rs index 6642fee65..0914ec7ad 100644 --- a/src/fs/abs.rs +++ b/src/fs/abs.rs @@ -15,7 +15,7 @@ use crate::fs::Access; target_os = "wasi", )))] use crate::fs::StatFs; -#[cfg(not(any(target_os = "wasi")))] +#[cfg(not(any(target_os = "wasi", target_os = "vxworks")))] use crate::fs::StatVfs; use crate::fs::{Mode, OFlags, Stat}; #[cfg(not(target_os = "wasi"))] @@ -283,7 +283,7 @@ pub fn statfs(path: P) -> io::Result { /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/statvfs.html /// [Linux]: https://man7.org/linux/man-pages/man2/statvfs.2.html -#[cfg(not(any(target_os = "wasi")))] +#[cfg(not(any(target_os = "wasi", target_os = "vxworks")))] #[inline] pub fn statvfs(path: P) -> io::Result { path.into_with_c_str(backend::fs::syscalls::statvfs) diff --git a/src/fs/at.rs b/src/fs/at.rs index f35ce5aca..2a9fe8141 100644 --- a/src/fs/at.rs +++ b/src/fs/at.rs @@ -260,6 +260,7 @@ pub fn unlinkat(dirfd: Fd, path: P, flags: AtFlags) -> i /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/renameat.html /// [Linux]: https://man7.org/linux/man-pages/man2/renameat.2.html +#[cfg(not(target_os = "vxworks"))] #[inline] pub fn renameat( old_dirfd: PFd, @@ -348,7 +349,7 @@ pub fn symlinkat( /// [Linux]: https://man7.org/linux/man-pages/man2/fstatat.2.html /// [`Mode::from_raw_mode`]: crate::fs::Mode::from_raw_mode /// [`FileType::from_raw_mode`]: crate::fs::FileType::from_raw_mode -#[cfg(not(any(target_os = "espidf", target_os = "redox")))] +#[cfg(not(any(target_os = "espidf", target_os = "redox", target_os = "vxworks")))] #[inline] #[doc(alias = "fstatat")] pub fn statat(dirfd: Fd, path: P, flags: AtFlags) -> io::Result { @@ -375,7 +376,8 @@ pub fn statat(dirfd: Fd, path: P, flags: AtFlags) -> io: target_os = "espidf", target_os = "horizon", target_os = "vita", - target_os = "redox" + target_os = "redox", + target_os = "vxworks", )))] #[inline] #[doc(alias = "faccessat")] @@ -424,7 +426,12 @@ pub fn utimensat( /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/fchmodat.html /// [Linux]: https://man7.org/linux/man-pages/man2/fchmodat.2.html -#[cfg(not(any(target_os = "espidf", target_os = "wasi", target_os = "redox")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "wasi", + target_os = "redox", + target_os = "vxworks" +)))] #[inline] #[doc(alias = "fchmodat")] pub fn chmodat( @@ -470,6 +477,7 @@ pub fn fclonefileat( target_os = "vita", target_os = "wasi", target_os = "redox", + target_os = "vxworks", )))] #[inline] pub fn mknodat( @@ -497,6 +505,7 @@ pub fn mknodat( target_os = "vita", target_os = "wasi", target_os = "redox", + target_os = "vxworks", )))] #[inline] pub fn mkfifoat(dirfd: Fd, path: P, mode: Mode) -> io::Result<()> { @@ -512,7 +521,12 @@ pub fn mkfifoat(dirfd: Fd, path: P, mode: Mode) -> io::R /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/fchownat.html /// [Linux]: https://man7.org/linux/man-pages/man2/fchownat.2.html -#[cfg(not(any(target_os = "espidf", target_os = "wasi", target_os = "redox")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "wasi", + target_os = "redox", + target_os = "vxworks" +)))] #[inline] #[doc(alias = "fchownat")] pub fn chownat( diff --git a/src/fs/constants.rs b/src/fs/constants.rs index a4f8e6e07..62f454871 100644 --- a/src/fs/constants.rs +++ b/src/fs/constants.rs @@ -84,6 +84,7 @@ mod tests { // Ensure that seconds fields are 64-bit on non-y2038-bug platforms, and // on Linux where we use statx. #[cfg(any(linux_kernel, not(fix_y2038)))] + #[cfg(not(target_os = "vxworks"))] { assert_eq!(some_stat.st_atime, 0_i64); assert_eq!(some_stat.st_mtime, 0_i64); @@ -97,7 +98,13 @@ mod tests { assert_eq!(some_stat.st_mode, 0 as RawMode); assert_eq!(some_stat.st_dev, 0 as Dev); assert_eq!(some_stat.st_rdev, 0 as Dev); + #[cfg(not(target_os = "vxworks"))] assert_eq!(some_stat.st_uid, 0 as crate::ugid::RawUid); + #[cfg(not(target_os = "vxworks"))] + assert_eq!(some_stat.st_gid, 0 as crate::ugid::RawGid); + #[cfg(target_os = "vxworks")] + assert_eq!(some_stat.st_uid, 0 as crate::ugid::RawUid); + #[cfg(target_os = "vxworks")] assert_eq!(some_stat.st_gid, 0 as crate::ugid::RawGid); // `Stat` should match `c::stat` or `c::stat64` unless we need y2038 @@ -157,18 +164,21 @@ mod tests { ))] check_renamed_struct_field!(Stat, stat, __pad2); check_renamed_struct_field!(Stat, stat, st_blocks); + #[cfg(not(target_os = "vxworks"))] check_renamed_struct_field!(Stat, stat, st_atime); - #[cfg(not(target_os = "netbsd"))] + #[cfg(not(any(target_os = "netbsd", target_os = "vxworks")))] check_renamed_struct_field!(Stat, stat, st_atime_nsec); #[cfg(target_os = "netbsd")] check_renamed_struct_renamed_field!(Stat, stat, st_atime_nsec, st_atimensec); + #[cfg(not(target_os = "vxworks"))] check_renamed_struct_field!(Stat, stat, st_mtime); - #[cfg(not(target_os = "netbsd"))] + #[cfg(not(any(target_os = "netbsd", target_os = "vxworks")))] check_renamed_struct_field!(Stat, stat, st_mtime_nsec); #[cfg(target_os = "netbsd")] check_renamed_struct_renamed_field!(Stat, stat, st_mtime_nsec, st_mtimensec); + #[cfg(not(target_os = "vxworks"))] check_renamed_struct_field!(Stat, stat, st_ctime); - #[cfg(not(target_os = "netbsd"))] + #[cfg(not(any(target_os = "netbsd", target_os = "vxworks")))] check_renamed_struct_field!(Stat, stat, st_ctime_nsec); #[cfg(target_os = "netbsd")] check_renamed_struct_renamed_field!(Stat, stat, st_ctime_nsec, st_ctimensec); diff --git a/src/fs/fcntl.rs b/src/fs/fcntl.rs index ba5368c86..d2a7c4fe7 100644 --- a/src/fs/fcntl.rs +++ b/src/fs/fcntl.rs @@ -10,7 +10,7 @@ target_os = "horizon", target_os = "redox", target_os = "vita", - target_os = "wasi" + target_os = "wasi", )))] use crate::fs::FlockOperation; use crate::{backend, io}; diff --git a/src/fs/fd.rs b/src/fs/fd.rs index 61cd3f47d..c5e0e42ad 100644 --- a/src/fs/fd.rs +++ b/src/fs/fd.rs @@ -15,6 +15,7 @@ use backend::fd::AsFd; target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "vxworks", )))] use backend::fs::types::FallocateFlags; #[cfg(not(any( @@ -40,7 +41,7 @@ use backend::fs::types::Stat; target_os = "wasi", )))] use backend::fs::types::StatFs; -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "wasi", target_os = "vxworks")))] use backend::fs::types::StatVfs; /// Timestamps used by [`utimensat`] and [`futimens`]. @@ -196,7 +197,7 @@ pub fn fstatfs(fd: Fd) -> io::Result { /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/fstatvfs.html /// [Linux]: https://man7.org/linux/man-pages/man2/fstatvfs.2.html -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "wasi", target_os = "vxworks")))] #[inline] pub fn fstatvfs(fd: Fd) -> io::Result { backend::fs::syscalls::fstatvfs(fd.as_fd()) @@ -239,6 +240,7 @@ pub fn futimens(fd: Fd, times: &Timestamps) -> io::Result<()> { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "vxworks", )))] // not implemented in libc for NetBSD yet #[inline] #[doc(alias = "posix_fallocate")] @@ -311,7 +313,8 @@ pub fn ftruncate(fd: Fd, length: u64) -> io::Result<()> { target_os = "horizon", target_os = "solaris", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks", )))] #[inline] pub fn flock(fd: Fd, operation: FlockOperation) -> io::Result<()> { diff --git a/src/fs/mod.rs b/src/fs/mod.rs index 5dbd7cbb8..a0adc69a4 100644 --- a/src/fs/mod.rs +++ b/src/fs/mod.rs @@ -17,6 +17,7 @@ mod dir; target_os = "redox", target_os = "solaris", target_os = "vita", + target_os = "vxworks", )))] mod fadvise; pub(crate) mod fcntl; @@ -38,7 +39,8 @@ mod ioctl; target_os = "haiku", target_os = "horizon", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks", )))] mod makedev; #[cfg(any(linux_kernel, target_os = "freebsd"))] @@ -59,7 +61,8 @@ mod statx; target_os = "horizon", target_os = "redox", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks", )))] mod sync; #[cfg(any(apple, linux_kernel, target_os = "hurd"))] @@ -82,6 +85,7 @@ pub use dir::{Dir, DirEntry}; target_os = "redox", target_os = "solaris", target_os = "vita", + target_os = "vxworks", )))] pub use fadvise::fadvise; pub use fcntl::*; @@ -101,7 +105,8 @@ pub use ioctl::*; target_os = "haiku", target_os = "horizon", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks", )))] pub use makedev::*; #[cfg(any(linux_kernel, target_os = "freebsd"))] @@ -122,7 +127,8 @@ pub use statx::*; target_os = "horizon", target_os = "redox", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks", )))] pub use sync::sync; #[cfg(any(apple, linux_kernel, target_os = "hurd"))] diff --git a/src/io/dup.rs b/src/io/dup.rs index 1d1a4852d..49757bdd6 100644 --- a/src/io/dup.rs +++ b/src/io/dup.rs @@ -117,7 +117,8 @@ pub fn dup2(fd: Fd, new: &mut OwnedFd) -> io::Result<()> { target_os = "horizon", target_os = "nto", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks" )))] #[inline] pub fn dup3(fd: Fd, new: &mut OwnedFd, flags: DupFlags) -> io::Result<()> { diff --git a/src/io/read_write.rs b/src/io/read_write.rs index 0e0969103..58f64e845 100644 --- a/src/io/read_write.rs +++ b/src/io/read_write.rs @@ -222,6 +222,7 @@ pub fn writev(fd: Fd, bufs: &[IoSlice<'_>]) -> io::Result { target_os = "redox", target_os = "solaris", target_os = "vita", + target_os = "vxworks", )))] #[inline] pub fn preadv(fd: Fd, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io::Result { @@ -261,6 +262,7 @@ pub fn preadv(fd: Fd, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io: target_os = "redox", target_os = "solaris", target_os = "vita", + target_os = "vxworks", )))] #[inline] pub fn pwritev(fd: Fd, bufs: &[IoSlice<'_>], offset: u64) -> io::Result { diff --git a/src/ioctl/mod.rs b/src/ioctl/mod.rs index 70c690530..386cb8352 100644 --- a/src/ioctl/mod.rs +++ b/src/ioctl/mod.rs @@ -305,7 +305,7 @@ type _Opcode = c::c_ulong; not(linux_raw), target_os = "linux", not(target_env = "gnu"), - not(target_env = "uclibc") + not(target_env = "uclibc"), ))] type _Opcode = c::c_int; @@ -324,7 +324,7 @@ type _Opcode = c::c_int; ))] type _Opcode = c::c_ulong; -// AIX, Emscripten, Fuchsia, Solaris, and WASI use a `int`. +// AIX, Emscripten, vxworks, Fuchsia, Solaris, and WASI use a `int`. #[cfg(any( solarish, target_os = "aix", @@ -333,6 +333,7 @@ type _Opcode = c::c_ulong; target_os = "emscripten", target_os = "nto", target_os = "wasi", + target_os = "vxworks", ))] type _Opcode = c::c_int; diff --git a/src/path/arg.rs b/src/path/arg.rs index 851d3a69b..f21ee99d4 100644 --- a/src/path/arg.rs +++ b/src/path/arg.rs @@ -19,8 +19,6 @@ use std::ffi::{OsStr, OsString}; use std::os::hermit::ext::ffi::{OsStrExt, OsStringExt}; #[cfg(all(feature = "std", unix))] use std::os::unix::ffi::{OsStrExt as _, OsStringExt as _}; -#[cfg(all(feature = "std", target_os = "vxworks"))] -use std::os::vxworks::ext::ffi::{OsStrExt, OsStringExt}; #[cfg(all( feature = "std", target_os = "wasi", diff --git a/src/ugid.rs b/src/ugid.rs index 11edb19b3..3ece79e18 100644 --- a/src/ugid.rs +++ b/src/ugid.rs @@ -6,10 +6,19 @@ use crate::backend::c; use crate::ffi; /// A group identifier as a raw integer. +#[cfg(not(target_os = "vxworks"))] pub type RawGid = ffi::c_uint; /// A user identifier as a raw integer. +#[cfg(not(target_os = "vxworks"))] pub type RawUid = ffi::c_uint; +/// A group identifier as a raw integer. +#[cfg(target_os = "vxworks")] +pub type RawGid = ffi::c_ushort; +/// A user identifier as a raw integer. +#[cfg(target_os = "vxworks")] +pub type RawUid = ffi::c_ushort; + /// `uid_t`—A Unix user ID. #[repr(transparent)] #[derive(Copy, Clone, Eq, PartialEq, Debug, Hash)] @@ -183,6 +192,7 @@ pub(crate) fn translate_fchown_args( mod tests { use super::*; + #[cfg(not(target_os = "vxworks"))] #[test] fn test_sizes() { assert_eq_size!(RawUid, u32); @@ -190,4 +200,13 @@ mod tests { assert_eq_size!(RawUid, libc::uid_t); assert_eq_size!(RawGid, libc::gid_t); } + + #[cfg(target_os = "vxworks")] + #[test] + fn test_sizes() { + assert_eq_size!(RawUid, u16); + assert_eq_size!(RawGid, u16); + assert_eq_size!(RawUid, libc::uid_t); + assert_eq_size!(RawGid, libc::gid_t); + } } diff --git a/tests/fs/chmodat.rs b/tests/fs/chmodat.rs index 7567ed7fd..cf955fc8b 100644 --- a/tests/fs/chmodat.rs +++ b/tests/fs/chmodat.rs @@ -27,7 +27,7 @@ fn test_chmod() { assert_ne!(reverted.st_mode as u64 & libc::S_IRWXU as u64, 0); } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "vxworks")))] #[test] fn test_chmodat() { use rustix::fs::{chmodat, openat, statat, symlinkat, AtFlags, Mode, OFlags, CWD}; diff --git a/tests/fs/dir.rs b/tests/fs/dir.rs index 195898ecd..8fa6e01a6 100644 --- a/tests/fs/dir.rs +++ b/tests/fs/dir.rs @@ -1,3 +1,4 @@ +#[cfg(not(target_os = "vxworks"))] #[test] fn test_dir_read_from() { let t = rustix::fs::openat( @@ -138,6 +139,7 @@ fn test_dir_seek() { assert_eq!(entries, entries2); } +#[cfg(not(target_os = "vxworks"))] #[test] fn test_dir_new() { let t = rustix::fs::openat( @@ -227,7 +229,10 @@ fn dir_iterator_handles_dir_removal() { // Like `dir_iterator_handles_dir_removal`, but close the directory after // `Dir::read_from`. -#[cfg_attr(any(apple, freebsdlike, target_os = "cygwin"), ignore)] +#[cfg_attr( + any(apple, freebsdlike, target_os = "cygwin", target_os = "vxworks"), + ignore +)] #[test] fn dir_iterator_handles_dir_removal_after_open() { // create a dir, keep the FD, then delete the dir diff --git a/tests/fs/fcntl.rs b/tests/fs/fcntl.rs index e2c4414b7..4ddbc2287 100644 --- a/tests/fs/fcntl.rs +++ b/tests/fs/fcntl.rs @@ -1,4 +1,4 @@ -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "vxworks")))] #[test] fn test_fcntl_dupfd_cloexec() { use rustix::fd::AsFd as _; diff --git a/tests/fs/file.rs b/tests/fs/file.rs index cb7e0c7fe..313c4c26f 100644 --- a/tests/fs/file.rs +++ b/tests/fs/file.rs @@ -9,7 +9,7 @@ )))] use core::num::NonZeroU64; -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "redox", target_os = "vxworks")))] #[test] fn test_file() { rustix::fs::accessat( diff --git a/tests/fs/flock.rs b/tests/fs/flock.rs index 537059492..bb87bc6e7 100644 --- a/tests/fs/flock.rs +++ b/tests/fs/flock.rs @@ -1,4 +1,4 @@ -#[cfg(not(any(target_os = "redox", target_os = "solaris")))] +#[cfg(not(any(target_os = "redox", target_os = "solaris", target_os = "vxworks")))] #[test] fn test_flock() { use rustix::fs::{flock, openat, FlockOperation, Mode, OFlags, CWD}; diff --git a/tests/fs/futimens.rs b/tests/fs/futimens.rs index 963b57f39..9798e671a 100644 --- a/tests/fs/futimens.rs +++ b/tests/fs/futimens.rs @@ -1,4 +1,4 @@ -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "vxworks")))] #[test] fn test_futimens() { use rustix::fs::{fstat, futimens, openat, Mode, OFlags, Timespec, Timestamps, CWD}; diff --git a/tests/fs/invalid_offset.rs b/tests/fs/invalid_offset.rs index cf84c9912..a3b6e3e08 100644 --- a/tests/fs/invalid_offset.rs +++ b/tests/fs/invalid_offset.rs @@ -36,7 +36,8 @@ fn invalid_offset_seek() { netbsdlike, target_os = "dragonfly", target_os = "nto", - target_os = "redox" + target_os = "redox", + target_os = "vxworks", )))] #[test] fn invalid_offset_fallocate() { @@ -65,6 +66,7 @@ fn invalid_offset_fallocate() { target_os = "haiku", target_os = "redox", target_os = "solaris", + target_os = "vxworks", )))] #[test] fn invalid_offset_fadvise() { diff --git a/tests/fs/linkat.rs b/tests/fs/linkat.rs index 42ad21177..5cfb822f5 100644 --- a/tests/fs/linkat.rs +++ b/tests/fs/linkat.rs @@ -29,7 +29,7 @@ fn test_link() { ); } -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "redox", target_os = "vxworks")))] #[test] fn test_linkat() { use rustix::fs::{linkat, openat, readlinkat, statat, AtFlags, Mode, OFlags, CWD}; diff --git a/tests/fs/main.rs b/tests/fs/main.rs index 84ac2aef3..7448c8039 100644 --- a/tests/fs/main.rs +++ b/tests/fs/main.rs @@ -5,7 +5,7 @@ #![cfg_attr(core_c_str, feature(core_c_str))] mod chmodat; -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "redox", target_os = "vxworks")))] mod dir; mod fcntl; #[cfg(not(any( @@ -13,7 +13,8 @@ mod fcntl; target_os = "fuchsia", target_os = "redox", target_os = "solaris", - target_os = "wasi" + target_os = "wasi", + target_os = "vxworks" )))] mod fcntl_lock; mod file; @@ -26,11 +27,14 @@ mod invalid_offset; #[cfg(not(target_os = "redox"))] mod ioctl; mod linkat; +#[cfg(not(target_os = "vxworks"))] mod long_paths; -#[cfg(not(any(target_os = "haiku", target_os = "wasi")))] +#[cfg(not(any(target_os = "haiku", target_os = "wasi", target_os = "vxworks")))] mod makedev; mod mkdirat; +#[cfg(not(target_os = "vxworks"))] mod mknodat; +#[cfg(not(target_os = "vxworks"))] mod negative_timestamp; #[cfg(linux_kernel)] mod openat; @@ -45,12 +49,22 @@ mod seals; mod seek; mod special; mod stat; -#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + target_os = "haiku", + target_os = "redox", + target_os = "wasi", + target_os = "vxworks" +)))] mod statfs; #[cfg(linux_kernel)] mod statx; mod symlinkat; -#[cfg(not(any(solarish, target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + solarish, + target_os = "redox", + target_os = "wasi", + target_os = "vxworks" +)))] mod sync; mod utimensat; #[cfg(any(apple, linux_kernel))] diff --git a/tests/fs/mkdirat.rs b/tests/fs/mkdirat.rs index f405490b5..dd35bbcb7 100644 --- a/tests/fs/mkdirat.rs +++ b/tests/fs/mkdirat.rs @@ -15,7 +15,7 @@ fn test_mkdir() { rmdir(tmp.path().join("file")).unwrap(); } -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "redox", target_os = "vxworks")))] #[test] fn test_mkdirat() { use rustix::fs::{ diff --git a/tests/fs/seek.rs b/tests/fs/seek.rs index 03d753d1d..b1a3037ac 100644 --- a/tests/fs/seek.rs +++ b/tests/fs/seek.rs @@ -56,6 +56,7 @@ fn test_seek_holes() { ); } +#[cfg(not(target_os = "vxworks"))] #[test] fn test_seek_offsets() { use rustix::fs::{open, seek, Mode, OFlags, SeekFrom}; diff --git a/tests/fs/symlinkat.rs b/tests/fs/symlinkat.rs index 740b9c898..b2ecaff45 100644 --- a/tests/fs/symlinkat.rs +++ b/tests/fs/symlinkat.rs @@ -21,7 +21,7 @@ fn test_symlink() { ); } -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "redox", target_os = "vxworks")))] #[test] fn test_symlinkat() { use rustix::fs::{openat, readlinkat, statat, symlinkat, AtFlags, Mode, OFlags, CWD}; diff --git a/tests/fs/utimensat.rs b/tests/fs/utimensat.rs index 2da161286..f702051ce 100644 --- a/tests/fs/utimensat.rs +++ b/tests/fs/utimensat.rs @@ -1,4 +1,4 @@ -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi", target_os = "vxworks")))] #[test] fn test_utimensat() { use rustix::fs::{openat, statat, utimensat, AtFlags, Mode, OFlags, Timespec, Timestamps, CWD}; diff --git a/tests/fs/y2038.rs b/tests/fs/y2038.rs index 749dd043f..1521c5bf5 100644 --- a/tests/fs/y2038.rs +++ b/tests/fs/y2038.rs @@ -5,8 +5,7 @@ #[cfg(not(all(target_env = "musl", target_pointer_width = "32")))] #[cfg(not(all(target_os = "android", target_pointer_width = "32")))] #[cfg(not(all(target_os = "emscripten", target_pointer_width = "32")))] -#[cfg(not(target_os = "redox"))] -#[cfg(not(target_os = "cygwin"))] +#[cfg(not(any(target_os = "redox", target_os = "cygwin", target_os = "vxworks")))] #[test] fn test_y2038_with_utimensat() { use rustix::fs::{ @@ -81,8 +80,7 @@ fn test_y2038_with_utimensat() { #[cfg(not(all(target_env = "musl", target_pointer_width = "32")))] #[cfg(not(all(target_os = "android", target_pointer_width = "32")))] #[cfg(not(all(target_os = "emscripten", target_pointer_width = "32")))] -#[cfg(not(target_os = "redox"))] -#[cfg(not(target_os = "cygwin"))] +#[cfg(not(any(target_os = "redox", target_os = "cygwin", target_os = "vxworks")))] #[test] fn test_y2038_with_futimens() { use rustix::fs::{ @@ -157,7 +155,7 @@ fn test_y2038_with_futimens() { #[cfg(not(all(target_env = "musl", target_pointer_width = "32")))] #[cfg(not(all(target_os = "android", target_pointer_width = "32")))] #[cfg(not(all(target_os = "emscripten", target_pointer_width = "32")))] -#[cfg(not(target_os = "cygwin"))] +#[cfg(not(any(target_os = "cygwin", target_os = "vxworks")))] #[test] fn test_y2038_with_futimens_and_stat() { use rustix::fs::{fstat, futimens, open, stat, Mode, OFlags, Timespec, Timestamps}; diff --git a/tests/io/close.rs b/tests/io/close.rs index b0cb3e97c..e7e3fbf1b 100644 --- a/tests/io/close.rs +++ b/tests/io/close.rs @@ -1,6 +1,7 @@ use rustix::fd::IntoRawFd as _; #[cfg(any(unix, target_os = "wasi"))] +#[cfg(not(target_os = "vxworks"))] #[test] fn test_close_file() { let file = std::fs::File::open("Cargo.toml").unwrap(); diff --git a/tests/io/main.rs b/tests/io/main.rs index 3fbb55e88..19271f048 100644 --- a/tests/io/main.rs +++ b/tests/io/main.rs @@ -1,12 +1,12 @@ //! Tests for [`rustix::io`]. mod close; -#[cfg(not(windows))] +#[cfg(not(any(windows, target_os = "vxworks")))] mod dup; mod error; -#[cfg(not(windows))] +#[cfg(not(any(windows, target_os = "vxworks")))] mod from_into; -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "redox", target_os = "vxworks")))] mod ioctl; #[cfg(not(windows))] #[cfg(not(target_os = "redox"))] // redox doesn't have cwd/openat diff --git a/tests/io/read_write.rs b/tests/io/read_write.rs index be3b047d5..e418eef86 100644 --- a/tests/io/read_write.rs +++ b/tests/io/read_write.rs @@ -6,6 +6,7 @@ use std::io::{IoSlice, IoSliceMut}; #[cfg(not(target_os = "solaris"))] // no preadv/pwritev #[cfg(not(target_os = "haiku"))] // no preadv/pwritev #[cfg(not(target_os = "cygwin"))] // no preadv/pwritev +#[cfg(not(target_os = "vxworks"))] // no preadv/pwritev #[test] fn test_readwrite_pv() { use rustix::fs::{openat, Mode, OFlags, CWD}; @@ -45,6 +46,7 @@ fn test_readwrite_pv() { } #[cfg(feature = "fs")] +#[cfg(not(target_os = "vxworks"))] // VxWorks doesn't support pwrite #[test] fn test_readwrite_p() { use rustix::fs::{openat, Mode, OFlags, CWD}; @@ -70,6 +72,7 @@ fn test_readwrite_p() { } #[cfg(feature = "fs")] +#[cfg(not(target_os = "vxworks"))] // VxWorks doesn't support pwrite #[test] fn test_readwrite_p_uninit() { use core::mem::MaybeUninit;