diff --git a/Cargo.toml b/Cargo.toml index 1b21e3659..4c8971685 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -269,4 +269,5 @@ check-cfg = [ 'cfg(wasi_ext)', 'cfg(wasip2)', 'cfg(target_arch, values("xtensa"))', + 'cfg(target_os, values("cygwin"))', ] diff --git a/src/backend/libc/fs/types.rs b/src/backend/libc/fs/types.rs index 865db5465..05c30cba6 100644 --- a/src/backend/libc/fs/types.rs +++ b/src/backend/libc/fs/types.rs @@ -381,6 +381,7 @@ bitflags! { target_os = "horizon", target_os = "wasi", target_os = "vita", + target_os = "cygwin", solarish )))] const ASYNC = bitcast!(c::O_ASYNC); @@ -788,6 +789,7 @@ bitflags! { target_os = "l4re", target_os = "linux", target_os = "wasi", + target_os = "cygwin", )))] const NO_HIDE_STALE = bitcast!(c::FALLOC_FL_NO_HIDE_STALE); /// `FALLOC_FL_COLLAPSE_RANGE` @@ -1063,7 +1065,8 @@ pub type StatFs = c::statfs64; target_os = "nto", target_os = "redox", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "cygwin" )))] pub type Fsid = c::fsid_t; diff --git a/src/backend/libc/io/errno.rs b/src/backend/libc/io/errno.rs index 0312eaf44..e065f9db6 100644 --- a/src/backend/libc/io/errno.rs +++ b/src/backend/libc/io/errno.rs @@ -285,6 +285,7 @@ impl Errno { target_os = "redox", target_os = "vita", target_os = "wasi", + target_os = "cygwin", )))] pub const HWPOISON: Self = Self(c::EHWPOISON); /// `EIDRM` @@ -334,6 +335,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "cygwin", )))] pub const ISNAM: Self = Self(c::EISNAM); /// `EKEYEXPIRED` @@ -350,6 +352,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "cygwin", )))] pub const KEYEXPIRED: Self = Self(c::EKEYEXPIRED); /// `EKEYREJECTED` @@ -366,6 +369,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "cygwin", )))] pub const KEYREJECTED: Self = Self(c::EKEYREJECTED); /// `EKEYREVOKED` @@ -382,6 +386,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "cygwin", )))] pub const KEYREVOKED: Self = Self(c::EKEYREVOKED); /// `EL2HLT` @@ -534,6 +539,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "cygwin", )))] pub const MEDIUMTYPE: Self = Self(c::EMEDIUMTYPE); /// `EMFILE` @@ -563,6 +569,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "cygwin", )))] pub const NAVAIL: Self = Self(c::ENAVAIL); /// `ENEEDAUTH` @@ -643,6 +650,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "cygwin", )))] pub const NOKEY: Self = Self(c::ENOKEY); /// `ENOLCK` @@ -767,6 +775,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "cygwin", )))] pub const NOTNAM: Self = Self(c::ENOTNAM); /// `ENOTRECOVERABLE` @@ -895,6 +904,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "cygwin", )))] pub const REMOTEIO: Self = Self(c::EREMOTEIO); /// `ERESTART` @@ -907,7 +917,8 @@ impl Errno { target_os = "hurd", target_os = "l4re", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "cygwin", )))] pub const RESTART: Self = Self(c::ERESTART); /// `ERFKILL` @@ -926,6 +937,7 @@ impl Errno { target_os = "redox", target_os = "vita", target_os = "wasi", + target_os = "cygwin", )))] pub const RFKILL: Self = Self(c::ERFKILL); /// `EROFS` @@ -1024,6 +1036,7 @@ impl Errno { target_os = "nto", target_os = "vita", target_os = "wasi", + target_os = "cygwin", )))] pub const UCLEAN: Self = Self(c::EUCLEAN); /// `EUNATCH` diff --git a/src/backend/libc/io/syscalls.rs b/src/backend/libc/io/syscalls.rs index 7ade984dd..1a794ebd0 100644 --- a/src/backend/libc/io/syscalls.rs +++ b/src/backend/libc/io/syscalls.rs @@ -101,7 +101,8 @@ pub(crate) fn writev(fd: BorrowedFd<'_>, bufs: &[IoSlice<'_>]) -> io::Result, @@ -127,7 +128,8 @@ pub(crate) fn preadv( target_os = "horizon", target_os = "redox", target_os = "solaris", - target_os = "vita" + target_os = "vita", + target_os = "cygwin", )))] pub(crate) fn pwritev(fd: BorrowedFd<'_>, bufs: &[IoSlice<'_>], offset: u64) -> io::Result { // Silently cast; we'll get `EINVAL` if the value is negative. diff --git a/src/backend/libc/mm/types.rs b/src/backend/libc/mm/types.rs index c25b8d094..850dff8aa 100644 --- a/src/backend/libc/mm/types.rs +++ b/src/backend/libc/mm/types.rs @@ -88,6 +88,7 @@ bitflags! { target_os = "hurd", target_os = "nto", target_os = "redox", + target_os = "cygwin", )))] const SHARED_VALIDATE = bitcast!(c::MAP_SHARED_VALIDATE); /// `MAP_PRIVATE` @@ -101,6 +102,7 @@ bitflags! { target_os = "hurd", target_os = "nto", target_os = "redox", + target_os = "cygwin", )))] const DENYWRITE = bitcast!(c::MAP_DENYWRITE); /// `MAP_FIXED` @@ -117,6 +119,7 @@ bitflags! { target_os = "hurd", target_os = "nto", target_os = "redox", + target_os = "cygwin", )))] const FIXED_NOREPLACE = bitcast!(c::MAP_FIXED_NOREPLACE); /// `MAP_GROWSDOWN` @@ -128,6 +131,7 @@ bitflags! { target_os = "hurd", target_os = "nto", target_os = "redox", + target_os = "cygwin", )))] const GROWSDOWN = bitcast!(c::MAP_GROWSDOWN); /// `MAP_HUGETLB` @@ -139,6 +143,7 @@ bitflags! { target_os = "hurd", target_os = "nto", target_os = "redox", + target_os = "cygwin", )))] const HUGETLB = bitcast!(c::MAP_HUGETLB); /// `MAP_HUGE_2MB` @@ -153,6 +158,7 @@ bitflags! { target_os = "hurd", target_os = "nto", target_os = "redox", + target_os = "cygwin", )))] const HUGE_2MB = bitcast!(c::MAP_HUGE_2MB); /// `MAP_HUGE_1GB` @@ -167,6 +173,7 @@ bitflags! { target_os = "hurd", target_os = "nto", target_os = "redox", + target_os = "cygwin", )))] const HUGE_1GB = bitcast!(c::MAP_HUGE_1GB); /// `MAP_LOCKED` @@ -178,6 +185,7 @@ bitflags! { target_os = "hurd", target_os = "nto", target_os = "redox", + target_os = "cygwin", )))] const LOCKED = bitcast!(c::MAP_LOCKED); /// `MAP_NOCORE` @@ -204,6 +212,7 @@ bitflags! { target_os = "hurd", target_os = "nto", target_os = "redox", + target_os = "cygwin", )))] const POPULATE = bitcast!(c::MAP_POPULATE); /// `MAP_STACK` @@ -214,6 +223,7 @@ bitflags! { target_os = "haiku", target_os = "hurd", target_os = "redox", + target_os = "cygwin", )))] const STACK = bitcast!(c::MAP_STACK); /// `MAP_PREFAULT_READ` @@ -234,7 +244,8 @@ bitflags! { all( linux_kernel, any(target_arch = "mips", target_arch = "mips32r6", target_arch = "mips64", target_arch = "mips64r6"), - ) + ), + target_os = "cygwin", )))] const SYNC = bitcast!(c::MAP_SYNC); /// `MAP_UNINITIALIZED` diff --git a/src/backend/libc/net/msghdr.rs b/src/backend/libc/net/msghdr.rs index 174cc16ba..a004f82b6 100644 --- a/src/backend/libc/net/msghdr.rs +++ b/src/backend/libc/net/msghdr.rs @@ -62,6 +62,7 @@ fn msg_iov_len(len: usize) -> c::c_int { target_os = "haiku", target_os = "hurd", target_os = "nto", + target_os = "cygwin", ))] #[inline] fn msg_control_len(len: usize) -> c::socklen_t { @@ -84,6 +85,7 @@ fn msg_control_len(len: usize) -> c::socklen_t { target_os = "redox", target_os = "vita", target_os = "wasi", + target_os = "cygwin", )))] #[inline] fn msg_control_len(len: usize) -> c::size_t { diff --git a/src/backend/libc/net/send_recv.rs b/src/backend/libc/net/send_recv.rs index 921c858be..809c19d96 100644 --- a/src/backend/libc/net/send_recv.rs +++ b/src/backend/libc/net/send_recv.rs @@ -23,6 +23,7 @@ bitflags! { target_os = "hurd", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] const CONFIRM = bitcast!(c::MSG_CONFIRM); /// `MSG_DONTROUTE` @@ -44,6 +45,7 @@ bitflags! { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] const MORE = bitcast!(c::MSG_MORE); #[cfg(not(any(apple, windows, target_os = "redox", target_os = "vita")))] @@ -96,6 +98,7 @@ bitflags! { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] const ERRQUEUE = bitcast!(c::MSG_ERRQUEUE); /// `MSG_OOB` diff --git a/src/backend/libc/net/sockopt.rs b/src/backend/libc/net/sockopt.rs index 1251c7f70..57af6e690 100644 --- a/src/backend/libc/net/sockopt.rs +++ b/src/backend/libc/net/sockopt.rs @@ -27,6 +27,7 @@ use crate::net::xdp::{XdpMmapOffsets, XdpOptionsFlags, XdpRingOffset, XdpStatist target_os = "netbsd", target_os = "nto", target_os = "vita", + target_os = "cygwin", )))] use crate::net::AddressFamily; #[cfg(any( @@ -388,6 +389,7 @@ pub(crate) fn socket_send_buffer_size(fd: BorrowedFd<'_>) -> io::Result { target_os = "netbsd", target_os = "nto", target_os = "vita", + target_os = "cygwin", )))] pub(crate) fn socket_domain(fd: BorrowedFd<'_>) -> io::Result { let domain: c::c_int = getsockopt(fd, c::SOL_SOCKET, c::SO_DOMAIN)?; @@ -412,13 +414,13 @@ pub(crate) fn socket_oobinline(fd: BorrowedFd<'_>) -> io::Result { getsockopt(fd, c::SOL_SOCKET, c::SO_OOBINLINE).map(to_bool) } -#[cfg(not(any(solarish, windows)))] +#[cfg(not(any(solarish, windows, target_os = "cygwin")))] #[inline] pub(crate) fn set_socket_reuseport(fd: BorrowedFd<'_>, value: bool) -> io::Result<()> { setsockopt(fd, c::SOL_SOCKET, c::SO_REUSEPORT, from_bool(value)) } -#[cfg(not(any(solarish, windows)))] +#[cfg(not(any(solarish, windows, target_os = "cygwin")))] #[inline] pub(crate) fn socket_reuseport(fd: BorrowedFd<'_>) -> io::Result { getsockopt(fd, c::SOL_SOCKET, c::SO_REUSEPORT).map(to_bool) diff --git a/src/backend/libc/process/syscalls.rs b/src/backend/libc/process/syscalls.rs index d288f7016..7338cd75f 100644 --- a/src/backend/libc/process/syscalls.rs +++ b/src/backend/libc/process/syscalls.rs @@ -69,7 +69,8 @@ use crate::process::{Resource, Rlimit}; target_os = "openbsd", target_os = "redox", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "cygwin" )))] use crate::process::{WaitId, WaitIdOptions, WaitIdStatus}; use core::mem::MaybeUninit; @@ -389,7 +390,8 @@ pub(crate) fn _waitpid( target_os = "openbsd", target_os = "redox", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "cygwin" )))] #[inline] pub(crate) fn waitid(id: WaitId<'_>, options: WaitIdOptions) -> io::Result> { @@ -411,7 +413,8 @@ pub(crate) fn waitid(id: WaitId<'_>, options: WaitIdOptions) -> io::Result io::Result> { @@ -436,7 +439,8 @@ fn _waitid_all(options: WaitIdOptions) -> io::Result> { target_os = "openbsd", target_os = "redox", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "cygwin" )))] #[inline] fn _waitid_pid(pid: Pid, options: WaitIdOptions) -> io::Result> { @@ -461,7 +465,8 @@ fn _waitid_pid(pid: Pid, options: WaitIdOptions) -> io::Result, options: WaitIdOptions) -> io::Result> { @@ -510,7 +515,8 @@ fn _waitid_pidfd(fd: BorrowedFd<'_>, options: WaitIdOptions) -> io::Result) -> Option { diff --git a/src/backend/libc/process/types.rs b/src/backend/libc/process/types.rs index ab006e3d6..18ee5ca4f 100644 --- a/src/backend/libc/process/types.rs +++ b/src/backend/libc/process/types.rs @@ -39,15 +39,21 @@ pub enum Resource { Core = bitcast!(c::RLIMIT_CORE), /// `RLIMIT_RSS` // "nto" has `RLIMIT_RSS`, but it has the same value as `RLIMIT_AS`. - #[cfg(not(any(apple, solarish, target_os = "haiku", target_os = "nto")))] + #[cfg(not(any( + apple, + solarish, + target_os = "haiku", + target_os = "nto", + target_os = "cygwin", + )))] Rss = bitcast!(c::RLIMIT_RSS), /// `RLIMIT_NPROC` - #[cfg(not(any(solarish, target_os = "haiku")))] + #[cfg(not(any(solarish, target_os = "haiku", target_os = "cygwin")))] Nproc = bitcast!(c::RLIMIT_NPROC), /// `RLIMIT_NOFILE` Nofile = bitcast!(c::RLIMIT_NOFILE), /// `RLIMIT_MEMLOCK` - #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))] + #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku", target_os = "cygwin")))] Memlock = bitcast!(c::RLIMIT_MEMLOCK), /// `RLIMIT_AS` #[cfg(not(target_os = "openbsd"))] @@ -59,7 +65,8 @@ pub enum Resource { target_os = "aix", target_os = "haiku", target_os = "hurd", - target_os = "nto" + target_os = "nto", + target_os = "cygwin" )))] Locks = bitcast!(c::RLIMIT_LOCKS), /// `RLIMIT_SIGPENDING` @@ -69,7 +76,8 @@ pub enum Resource { target_os = "aix", target_os = "haiku", target_os = "hurd", - target_os = "nto" + target_os = "nto", + target_os = "cygwin" )))] Sigpending = bitcast!(c::RLIMIT_SIGPENDING), /// `RLIMIT_MSGQUEUE` @@ -79,7 +87,8 @@ pub enum Resource { target_os = "aix", target_os = "haiku", target_os = "hurd", - target_os = "nto" + target_os = "nto", + target_os = "cygwin" )))] Msgqueue = bitcast!(c::RLIMIT_MSGQUEUE), /// `RLIMIT_NICE` @@ -89,7 +98,8 @@ pub enum Resource { target_os = "aix", target_os = "haiku", target_os = "hurd", - target_os = "nto" + target_os = "nto", + target_os = "cygwin" )))] Nice = bitcast!(c::RLIMIT_NICE), /// `RLIMIT_RTPRIO` @@ -99,7 +109,8 @@ pub enum Resource { target_os = "aix", target_os = "haiku", target_os = "hurd", - target_os = "nto" + target_os = "nto", + target_os = "cygwin" )))] Rtprio = bitcast!(c::RLIMIT_RTPRIO), /// `RLIMIT_RTTIME` @@ -112,6 +123,7 @@ pub enum Resource { target_os = "haiku", target_os = "hurd", target_os = "nto", + target_os = "cygwin", )))] Rttime = bitcast!(c::RLIMIT_RTTIME), } diff --git a/src/backend/libc/process/wait.rs b/src/backend/libc/process/wait.rs index 54c4d404b..5b3e10097 100644 --- a/src/backend/libc/process/wait.rs +++ b/src/backend/libc/process/wait.rs @@ -11,6 +11,7 @@ pub(crate) use c::{WCONTINUED, WUNTRACED}; target_os = "horizon", target_os = "openbsd", target_os = "redox", - target_os = "wasi" + target_os = "wasi", + target_os = "cygwin" )))] pub(crate) use c::{WEXITED, WNOWAIT, WSTOPPED}; diff --git a/src/backend/libc/system/syscalls.rs b/src/backend/libc/system/syscalls.rs index a45ed5fc2..2ddfeddbf 100644 --- a/src/backend/libc/system/syscalls.rs +++ b/src/backend/libc/system/syscalls.rs @@ -74,7 +74,8 @@ pub(crate) fn sethostname(name: &[u8]) -> io::Result<()> { target_os = "redox", target_os = "solaris", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "cygwin" )))] pub(crate) fn setdomainname(name: &[u8]) -> io::Result<()> { unsafe { diff --git a/src/clockid.rs b/src/clockid.rs index b63ad0da1..3b63ac501 100644 --- a/src/clockid.rs +++ b/src/clockid.rs @@ -11,8 +11,11 @@ use crate::fd::BorrowedFd; /// [`clock_gettime`]: crate::time::clock_gettime #[cfg(not(any(apple, target_os = "wasi")))] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] -#[cfg_attr(not(any(target_os = "aix", target_os = "dragonfly")), repr(i32))] -#[cfg_attr(target_os = "dragonfly", repr(u64))] +#[cfg_attr( + not(any(target_os = "aix", target_os = "dragonfly", target_os = "cygwin")), + repr(i32) +)] +#[cfg_attr(any(target_os = "dragonfly", target_os = "cygwin"), repr(u64))] #[cfg_attr(target_os = "aix", repr(i64))] #[non_exhaustive] pub enum ClockId { diff --git a/src/fs/constants.rs b/src/fs/constants.rs index d5c3821f4..258d5cc20 100644 --- a/src/fs/constants.rs +++ b/src/fs/constants.rs @@ -272,7 +272,8 @@ mod tests { target_os = "haiku", target_os = "nto", target_os = "redox", - target_os = "wasi" + target_os = "wasi", + target_os = "cygwin" )))] { check_renamed_type!(Fsid, fsid_t); diff --git a/src/io/read_write.rs b/src/io/read_write.rs index ba5dd2912..7a57460cd 100644 --- a/src/io/read_write.rs +++ b/src/io/read_write.rs @@ -220,7 +220,8 @@ pub fn writev(fd: Fd, bufs: &[IoSlice<'_>]) -> io::Result { target_os = "nto", target_os = "redox", target_os = "solaris", - target_os = "vita" + target_os = "vita", + target_os = "cygwin" )))] #[inline] pub fn preadv(fd: Fd, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io::Result { @@ -258,7 +259,8 @@ pub fn preadv(fd: Fd, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io: target_os = "nto", target_os = "redox", target_os = "solaris", - target_os = "vita" + target_os = "vita", + target_os = "cygwin" )))] #[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 0a9d7a86e..e9e37aeb3 100644 --- a/src/ioctl/mod.rs +++ b/src/ioctl/mod.rs @@ -331,7 +331,8 @@ type _Opcode = c::c_ulong; target_os = "fuchsia", target_os = "emscripten", target_os = "nto", - target_os = "wasi" + target_os = "wasi", + target_os = "cygwin" ))] type _Opcode = c::c_int; diff --git a/src/net/sockopt.rs b/src/net/sockopt.rs index 20ed3e72d..f7ed74dc3 100644 --- a/src/net/sockopt.rs +++ b/src/net/sockopt.rs @@ -156,6 +156,7 @@ use crate::net::xdp::{XdpMmapOffsets, XdpOptionsFlags, XdpStatistics, XdpUmemReg target_os = "netbsd", target_os = "nto", target_os = "vita", + target_os = "cygwin", )))] use crate::net::AddressFamily; #[cfg(any( @@ -471,6 +472,7 @@ pub fn socket_send_buffer_size(fd: Fd) -> io::Result { target_os = "netbsd", target_os = "nto", target_os = "vita", + target_os = "cygwin", )))] #[inline] #[doc(alias = "SO_DOMAIN")] @@ -517,7 +519,7 @@ pub fn socket_oobinline(fd: Fd) -> io::Result { /// See the [module-level documentation] for more. /// /// [module-level documentation]: self#references-for-get_socket_-and-set_socket_-functions -#[cfg(not(any(solarish, windows)))] +#[cfg(not(any(solarish, windows, target_os = "cygwin")))] #[cfg(not(windows))] #[inline] #[doc(alias = "SO_REUSEPORT")] @@ -530,7 +532,7 @@ pub fn set_socket_reuseport(fd: Fd, value: bool) -> io::Result<()> { /// See the [module-level documentation] for more. /// /// [module-level documentation]: self#references-for-get_socket_-and-set_socket_-functions -#[cfg(not(any(solarish, windows)))] +#[cfg(not(any(solarish, windows, target_os = "cygwin")))] #[inline] #[doc(alias = "SO_REUSEPORT")] pub fn socket_reuseport(fd: Fd) -> io::Result { diff --git a/src/net/types.rs b/src/net/types.rs index 660c40887..faee71bca 100644 --- a/src/net/types.rs +++ b/src/net/types.rs @@ -102,6 +102,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const NETLINK: Self = Self(c::AF_NETLINK as _); /// `AF_UNIX`, aka `AF_LOCAL` @@ -120,6 +121,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const AX25: Self = Self(c::AF_AX25 as _); /// `AF_IPX` @@ -129,6 +131,7 @@ impl AddressFamily { target_os = "horizon", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const IPX: Self = Self(c::AF_IPX as _); /// `AF_APPLETALK` @@ -152,6 +155,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const NETROM: Self = Self(c::AF_NETROM as _); /// `AF_BRIDGE` @@ -167,6 +171,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const BRIDGE: Self = Self(c::AF_BRIDGE as _); /// `AF_ATMPVC` @@ -182,6 +187,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const ATMPVC: Self = Self(c::AF_ATMPVC as _); /// `AF_X25` @@ -196,6 +202,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const X25: Self = Self(c::AF_X25 as _); /// `AF_ROSE` @@ -211,6 +218,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const ROSE: Self = Self(c::AF_ROSE as _); /// `AF_DECnet` @@ -235,6 +243,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const NETBEUI: Self = Self(c::AF_NETBEUI as _); /// `AF_SECURITY` @@ -250,6 +259,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const SECURITY: Self = Self(c::AF_SECURITY as _); /// `AF_KEY` @@ -264,6 +274,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const KEY: Self = Self(c::AF_KEY as _); /// `AF_PACKET` @@ -283,6 +294,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const PACKET: Self = Self(c::AF_PACKET as _); /// `AF_ASH` @@ -298,6 +310,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const ASH: Self = Self(c::AF_ASH as _); /// `AF_ECONET` @@ -313,6 +326,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const ECONET: Self = Self(c::AF_ECONET as _); /// `AF_ATMSVC` @@ -328,6 +342,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const ATMSVC: Self = Self(c::AF_ATMSVC as _); /// `AF_RDS` @@ -343,6 +358,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const RDS: Self = Self(c::AF_RDS as _); /// `AF_SNA` @@ -366,6 +382,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const IRDA: Self = Self(c::AF_IRDA as _); /// `AF_PPPOX` @@ -381,6 +398,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const PPPOX: Self = Self(c::AF_PPPOX as _); /// `AF_WANPIPE` @@ -396,6 +414,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const WANPIPE: Self = Self(c::AF_WANPIPE as _); /// `AF_LLC` @@ -411,6 +430,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const LLC: Self = Self(c::AF_LLC as _); /// `AF_CAN` @@ -426,6 +446,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const CAN: Self = Self(c::AF_CAN as _); /// `AF_TIPC` @@ -441,6 +462,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const TIPC: Self = Self(c::AF_TIPC as _); /// `AF_BLUETOOTH` @@ -454,6 +476,7 @@ impl AddressFamily { target_os = "hurd", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const BLUETOOTH: Self = Self(c::AF_BLUETOOTH as _); /// `AF_IUCV` @@ -469,6 +492,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const IUCV: Self = Self(c::AF_IUCV as _); /// `AF_RXRPC` @@ -484,6 +508,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const RXRPC: Self = Self(c::AF_RXRPC as _); /// `AF_ISDN` @@ -497,6 +522,7 @@ impl AddressFamily { target_os = "hurd", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const ISDN: Self = Self(c::AF_ISDN as _); /// `AF_PHONET` @@ -512,6 +538,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const PHONET: Self = Self(c::AF_PHONET as _); /// `AF_IEEE802154` @@ -527,6 +554,7 @@ impl AddressFamily { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const IEEE802154: Self = Self(c::AF_IEEE802154 as _); /// `AF_802` @@ -840,7 +868,8 @@ pub mod ipproto { target_os = "haiku", target_os = "horizon", target_os = "redox", - target_os = "vita" + target_os = "vita", + target_os = "cygwin", )))] pub const TP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_TP as _)); /// `IPPROTO_DCCP` @@ -857,6 +886,7 @@ pub mod ipproto { target_os = "openbsd", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const DCCP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_DCCP as _)); /// `IPPROTO_IPV6` @@ -869,7 +899,8 @@ pub mod ipproto { target_os = "haiku", target_os = "horizon", target_os = "redox", - target_os = "vita" + target_os = "vita", + target_os = "cygwin", )))] pub const RSVP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_RSVP as _)); /// `IPPROTO_GRE` @@ -880,7 +911,8 @@ pub mod ipproto { target_os = "haiku", target_os = "horizon", target_os = "redox", - target_os = "vita" + target_os = "vita", + target_os = "cygwin", )))] pub const GRE: Protocol = Protocol(new_raw_protocol(c::IPPROTO_GRE as _)); /// `IPPROTO_ESP` @@ -915,6 +947,7 @@ pub mod ipproto { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const MTP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_MTP as _)); /// `IPPROTO_BEETPH` @@ -929,6 +962,7 @@ pub mod ipproto { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const BEETPH: Protocol = Protocol(new_raw_protocol(c::IPPROTO_BEETPH as _)); /// `IPPROTO_ENCAP` @@ -941,6 +975,7 @@ pub mod ipproto { target_os = "horizon", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const ENCAP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_ENCAP as _)); /// `IPPROTO_PIM` @@ -951,7 +986,8 @@ pub mod ipproto { target_os = "haiku", target_os = "horizon", target_os = "redox", - target_os = "vita" + target_os = "vita", + target_os = "cygwin", )))] pub const PIM: Protocol = Protocol(new_raw_protocol(c::IPPROTO_PIM as _)); /// `IPPROTO_COMP` @@ -966,6 +1002,7 @@ pub mod ipproto { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const COMP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_COMP as _)); /// `IPPROTO_SCTP` @@ -978,6 +1015,7 @@ pub mod ipproto { target_os = "openbsd", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const SCTP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_SCTP as _)); /// `IPPROTO_UDPLITE` @@ -994,6 +1032,7 @@ pub mod ipproto { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const UDPLITE: Protocol = Protocol(new_raw_protocol(c::IPPROTO_UDPLITE as _)); /// `IPPROTO_MPLS` @@ -1010,6 +1049,7 @@ pub mod ipproto { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const MPLS: Protocol = Protocol(new_raw_protocol(c::IPPROTO_MPLS as _)); /// `IPPROTO_ETHERNET` @@ -1032,6 +1072,7 @@ pub mod ipproto { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const MPTCP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_MPTCP as _)); /// `IPPROTO_FRAGMENT` @@ -1059,6 +1100,7 @@ pub mod ipproto { target_os = "nto", target_os = "redox", target_os = "vita", + target_os = "cygwin", )))] pub const MH: Protocol = Protocol(new_raw_protocol(c::IPPROTO_MH as _)); /// `IPPROTO_ROUTING` diff --git a/src/process/wait.rs b/src/process/wait.rs index 5381cd042..4dee1d17c 100644 --- a/src/process/wait.rs +++ b/src/process/wait.rs @@ -60,10 +60,13 @@ bitflags! { /// [`Signal::Cont`]: crate::process::Signal::Cont const CONTINUED = bitcast!(backend::process::wait::WCONTINUED); /// Wait for processed that have exited. + #[cfg(not(target_os = "cygwin"))] const EXITED = bitcast!(backend::process::wait::WEXITED); /// Keep processed in a waitable state. + #[cfg(not(target_os = "cygwin"))] const NOWAIT = bitcast!(backend::process::wait::WNOWAIT); /// Wait for processes that have been stopped. + #[cfg(not(target_os = "cygwin"))] const STOPPED = bitcast!(backend::process::wait::WSTOPPED); /// @@ -485,7 +488,8 @@ pub fn wait(waitopts: WaitOptions) -> io::Result> { target_os = "horizon", target_os = "openbsd", target_os = "redox", - target_os = "wasi" + target_os = "wasi", + target_os = "cygwin" )))] #[inline] pub fn waitid<'a, Id: Into>>( diff --git a/src/signal.rs b/src/signal.rs index 33026e350..e3eaaa153 100644 --- a/src/signal.rs +++ b/src/signal.rs @@ -105,7 +105,8 @@ impl Signal { target_arch = "sparc", target_arch = "sparc64" ), - ) + ), + target_os = "cygwin", )))] pub const STKFLT: Self = Self(unsafe { NonZeroI32::new_unchecked(c::SIGSTKFLT) }); /// `SIGCHLD` @@ -295,7 +296,8 @@ impl fmt::Debug for Signal { target_arch = "sparc", target_arch = "sparc64" ), - ) + ), + target_os = "cygwin", )))] Self::STKFLT => "Signal::STKFLT".fmt(f), #[cfg(not(target_os = "vita"))] diff --git a/src/system.rs b/src/system.rs index bfb212f3b..a5a3a7b55 100644 --- a/src/system.rs +++ b/src/system.rs @@ -182,7 +182,8 @@ pub fn sethostname(name: &[u8]) -> io::Result<()> { target_os = "redox", target_os = "solaris", target_os = "vita", - target_os = "wasi" + target_os = "wasi", + target_os = "cygwin" )))] #[inline] pub fn setdomainname(name: &[u8]) -> io::Result<()> { diff --git a/src/termios/mod.rs b/src/termios/mod.rs index e6b7c9171..ff6f56fb4 100644 --- a/src/termios/mod.rs +++ b/src/termios/mod.rs @@ -9,7 +9,12 @@ //! [`Termios::set_output_speed`], and they will simply fail if the speed is //! not supported by the platform or the device. -#[cfg(not(any(target_os = "espidf", target_os = "haiku", target_os = "wasi")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "haiku", + target_os = "wasi", + target_os = "cygwin" +)))] mod ioctl; #[cfg(not(target_os = "wasi"))] mod tc; @@ -18,7 +23,12 @@ mod tty; #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] mod types; -#[cfg(not(any(target_os = "espidf", target_os = "haiku", target_os = "wasi")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "haiku", + target_os = "wasi", + target_os = "cygwin" +)))] pub use ioctl::*; #[cfg(not(target_os = "wasi"))] pub use tc::*; diff --git a/src/termios/types.rs b/src/termios/types.rs index 5b1d68770..88e5068fa 100644 --- a/src/termios/types.rs +++ b/src/termios/types.rs @@ -605,7 +605,7 @@ bitflags! { const ECHOCTL = c::ECHOCTL; /// `ECHOPRT` - #[cfg(not(any(target_os = "nto", target_os = "redox")))] + #[cfg(not(any(target_os = "nto", target_os = "redox", target_os = "cygwin")))] const ECHOPRT = c::ECHOPRT; /// `ECHOKE` @@ -617,11 +617,17 @@ bitflags! { const FLUSHO = c::FLUSHO; /// `PENDIN` - #[cfg(not(any(target_os = "nto", target_os = "redox")))] + #[cfg(not(any(target_os = "nto", target_os = "redox", target_os = "cygwin")))] const PENDIN = c::PENDIN; /// `EXTPROC` - #[cfg(not(any(target_os = "aix", target_os = "haiku", target_os = "nto", target_os = "redox")))] + #[cfg(not(any( + target_os = "aix", + target_os = "haiku", + target_os = "nto", + target_os = "redox", + target_os = "cygwin", + )))] const EXTPROC = c::EXTPROC; /// `ISIG` @@ -953,6 +959,7 @@ pub mod speed { target_os = "haiku", target_os = "nto", target_os = "solaris", + target_os = "cygwin", )))] c::B3500000 => Some(3_500_000), #[cfg(not(any( @@ -963,6 +970,7 @@ pub mod speed { target_os = "haiku", target_os = "nto", target_os = "solaris", + target_os = "cygwin", )))] c::B4000000 => Some(4_000_000), _ => None, @@ -1090,6 +1098,7 @@ pub mod speed { target_os = "haiku", target_os = "nto", target_os = "solaris", + target_os = "cygwin", )))] 3_500_000 => Some(c::B3500000), #[cfg(not(any( @@ -1100,6 +1109,7 @@ pub mod speed { target_os = "haiku", target_os = "nto", target_os = "solaris", + target_os = "cygwin", )))] 4_000_000 => Some(c::B4000000), _ => None, diff --git a/tests/fs/chmodat.rs b/tests/fs/chmodat.rs index 8d990932a..6bc399998 100644 --- a/tests/fs/chmodat.rs +++ b/tests/fs/chmodat.rs @@ -1,4 +1,4 @@ -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "wasi", target_os = "cygwin")))] #[test] fn test_chmod() { use rustix::fs::{chmod, open, stat, symlink, Mode, OFlags}; diff --git a/tests/fs/dir.rs b/tests/fs/dir.rs index b3a754c9e..195898ecd 100644 --- a/tests/fs/dir.rs +++ b/tests/fs/dir.rs @@ -227,7 +227,7 @@ 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), ignore)] +#[cfg_attr(any(apple, freebsdlike, target_os = "cygwin"), 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/file.rs b/tests/fs/file.rs index 2e4b62309..cd30696bd 100644 --- a/tests/fs/file.rs +++ b/tests/fs/file.rs @@ -102,6 +102,7 @@ fn test_file() { )))] rustix::fs::fadvise(&file, 0, NonZeroU64::new(10), rustix::fs::Advice::Normal).unwrap(); + #[cfg(not(target_os = "cygwin"))] rustix::fs::fsync(&file).unwrap(); #[cfg(not(any( @@ -109,6 +110,7 @@ fn test_file() { target_os = "dragonfly", target_os = "espidf", target_os = "haiku", + target_os = "cygwin", )))] rustix::fs::fdatasync(&file).unwrap(); @@ -156,6 +158,7 @@ fn test_file() { assert!(statvfs.f_frsize > 0); } + #[cfg(not(target_os = "cygwin"))] assert_ne!(rustix::io::ioctl_fionread(&file).unwrap(), 0); } diff --git a/tests/fs/invalid_offset.rs b/tests/fs/invalid_offset.rs index be5f04717..5143622d3 100644 --- a/tests/fs/invalid_offset.rs +++ b/tests/fs/invalid_offset.rs @@ -64,6 +64,7 @@ fn invalid_offset_fallocate() { target_os = "dragonfly", target_os = "haiku", target_os = "redox", + target_os = "cygwin", )))] #[test] fn invalid_offset_fadvise() { @@ -158,7 +159,7 @@ fn invalid_offset_pread() { pread(&file, &mut buf, i64::MAX as u64 + 1).unwrap_err(); } -#[cfg(not(apple))] +#[cfg(not(any(apple, target_os = "cygwin")))] #[test] fn invalid_offset_pwrite() { use rustix::fs::{openat, Mode, OFlags, CWD}; diff --git a/tests/fs/makedev.rs b/tests/fs/makedev.rs index ba9f9c53d..dfbd8ab07 100644 --- a/tests/fs/makedev.rs +++ b/tests/fs/makedev.rs @@ -10,7 +10,9 @@ fn makedev_roundtrip() { let (maj, min) = (0x0000_0026, 0x0064_6361); #[cfg(target_os = "netbsd")] let (maj, min) = (0x0000_0026, 0x0000_0061); - #[cfg(not(any(apple, freebsdlike, target_os = "netbsd")))] + #[cfg(target_os = "cygwin")] + let (maj, min) = (0x0000_2526, 0x0000_6361); + #[cfg(not(any(apple, freebsdlike, target_os = "netbsd", target_os = "cygwin")))] let (maj, min) = (0x2324_2526, 0x6564_6361); let dev = makedev(maj, min); diff --git a/tests/fs/negative_timestamp.rs b/tests/fs/negative_timestamp.rs index 3f5532c89..b367fbb30 100644 --- a/tests/fs/negative_timestamp.rs +++ b/tests/fs/negative_timestamp.rs @@ -1,4 +1,5 @@ #[cfg(not(target_os = "redox"))] +#[cfg(not(target_os = "cygwin"))] #[test] fn negative_file_timestamp() { use rustix::fs::{ diff --git a/tests/fs/y2038.rs b/tests/fs/y2038.rs index 6b49a823c..749dd043f 100644 --- a/tests/fs/y2038.rs +++ b/tests/fs/y2038.rs @@ -6,6 +6,7 @@ #[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"))] #[test] fn test_y2038_with_utimensat() { use rustix::fs::{ @@ -81,6 +82,7 @@ fn test_y2038_with_utimensat() { #[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"))] #[test] fn test_y2038_with_futimens() { use rustix::fs::{ @@ -155,6 +157,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"))] #[test] fn test_y2038_with_futimens_and_stat() { use rustix::fs::{fstat, futimens, open, stat, Mode, OFlags, Timespec, Timestamps}; diff --git a/tests/io/read_write.rs b/tests/io/read_write.rs index 4ddd89164..6d6daa93a 100644 --- a/tests/io/read_write.rs +++ b/tests/io/read_write.rs @@ -5,6 +5,7 @@ use std::io::{IoSlice, IoSliceMut}; #[cfg(not(target_os = "espidf"))] // no preadv/pwritev #[cfg(not(target_os = "solaris"))] // no preadv/pwritev #[cfg(not(target_os = "haiku"))] // no preadv/pwritev +#[cfg(not(target_os = "cygwin"))] // no preadv/pwritev #[test] fn test_readwrite_pv() { use rustix::fs::{openat, Mode, OFlags, CWD};