From fa2aabbf0e33b1d6f91d101dd2327e7a06bd82a8 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sun, 3 Dec 2023 16:45:25 +0000 Subject: [PATCH] fix, mostly, solaris build. With few exceptions as newer interfaces like preadv/pwritev unsupported only on solaris. --- changelog/2248.fixed.md | 1 + src/ifaddrs.rs | 4 +- src/lib.rs | 2 +- src/net/if_.rs | 119 +++++++++++++++++++++------------------- src/sys/ioctl/bsd.rs | 4 +- src/sys/ioctl/mod.rs | 4 +- src/sys/mod.rs | 6 +- src/sys/socket/addr.rs | 38 ++++++------- src/sys/socket/mod.rs | 9 ++- src/sys/time.rs | 4 +- src/sys/uio.rs | 4 +- src/unistd.rs | 6 +- test/sys/test_uio.rs | 12 +++- test/test.rs | 2 +- test/test_dir.rs | 4 +- test/test_pty.rs | 2 +- test/test_resource.rs | 4 +- test/test_stat.rs | 2 +- test/test_unistd.rs | 6 +- 19 files changed, 126 insertions(+), 107 deletions(-) create mode 100644 changelog/2248.fixed.md diff --git a/changelog/2248.fixed.md b/changelog/2248.fixed.md new file mode 100644 index 0000000000..3115e7ef90 --- /dev/null +++ b/changelog/2248.fixed.md @@ -0,0 +1 @@ +Fixed solaris build globally. diff --git a/src/ifaddrs.rs b/src/ifaddrs.rs index 58cbfec9eb..b3de64b01a 100644 --- a/src/ifaddrs.rs +++ b/src/ifaddrs.rs @@ -94,7 +94,9 @@ impl InterfaceAddress { unsafe { SockaddrStorage::from_raw(info.ifa_netmask, None) }; let mut addr = InterfaceAddress { interface_name: ifname.to_string_lossy().to_string(), - flags: InterfaceFlags::from_bits_truncate(info.ifa_flags as i32), + flags: InterfaceFlags::from_bits_truncate( + info.ifa_flags as IflagsType, + ), address, netmask, broadcast: None, diff --git a/src/lib.rs b/src/lib.rs index 0d4416926f..aaf1c2d4c8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -125,7 +125,7 @@ feature! { #[cfg(any(linux_android, bsd, - target_os = "illumos"))] + solarish))] #[deny(missing_docs)] pub mod ifaddrs; #[cfg(not(target_os = "redox"))] diff --git a/src/net/if_.rs b/src/net/if_.rs index 4e59fc15da..c66b5dc0b3 100644 --- a/src/net/if_.rs +++ b/src/net/if_.rs @@ -7,6 +7,13 @@ use std::fmt; use crate::{Error, NixPath, Result}; use libc::c_uint; +#[cfg(not(solarish))] +/// type alias for InterfaceFlags +pub type IflagsType = libc::c_int; +#[cfg(solarish)] +/// type alias for InterfaceFlags +pub type IflagsType = libc::c_longlong; + /// Resolve an interface into a interface number. pub fn if_nametoindex(name: &P) -> Result { let if_index = name @@ -21,23 +28,24 @@ pub fn if_nametoindex(name: &P) -> Result { libc_bitflags!( /// Standard interface flags, used by `getifaddrs` - pub struct InterfaceFlags: libc::c_int { + pub struct InterfaceFlags: IflagsType { + /// Interface is running. (see /// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html)) - IFF_UP; + IFF_UP as IflagsType; /// Valid broadcast address set. (see /// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html)) - IFF_BROADCAST; + IFF_BROADCAST as IflagsType; /// Internal debugging flag. (see /// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html)) #[cfg(not(target_os = "haiku"))] - IFF_DEBUG; + IFF_DEBUG as IflagsType; /// Interface is a loopback interface. (see /// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html)) - IFF_LOOPBACK; + IFF_LOOPBACK as IflagsType; /// Interface is a point-to-point link. (see /// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html)) - IFF_POINTOPOINT; + IFF_POINTOPOINT as IflagsType; /// Avoid use of trailers. (see /// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html)) #[cfg(any( @@ -46,10 +54,10 @@ libc_bitflags!( apple_targets, target_os = "fuchsia", target_os = "netbsd"))] - IFF_NOTRAILERS; + IFF_NOTRAILERS as IflagsType; /// Interface manages own routes. #[cfg(any(target_os = "dragonfly"))] - IFF_SMART; + IFF_SMART as IflagsType; /// Resources allocated. (see /// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html)) #[cfg(any( @@ -57,16 +65,16 @@ libc_bitflags!( bsd, solarish, target_os = "fuchsia"))] - IFF_RUNNING; + IFF_RUNNING as IflagsType; /// No arp protocol, L2 destination address not set. (see /// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html)) - IFF_NOARP; + IFF_NOARP as IflagsType; /// Interface is in promiscuous mode. (see /// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html)) - IFF_PROMISC; + IFF_PROMISC as IflagsType; /// Receive all multicast packets. (see /// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html)) - IFF_ALLMULTI; + IFF_ALLMULTI as IflagsType; /// Master of a load balancing bundle. (see /// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html)) #[cfg(any(linux_android, target_os = "fuchsia"))] @@ -76,7 +84,7 @@ libc_bitflags!( IFF_OACTIVE; /// Protocol code on board. #[cfg(solarish)] - IFF_INTELLIGENT; + IFF_INTELLIGENT as IflagsType; /// Slave of a load balancing bundle. (see /// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html)) #[cfg(any(linux_android, target_os = "fuchsia"))] @@ -86,13 +94,13 @@ libc_bitflags!( IFF_SIMPLEX; /// Supports multicast. (see /// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html)) - IFF_MULTICAST; + IFF_MULTICAST as IflagsType; /// Per link layer defined bit. #[cfg(bsd)] IFF_LINK0; /// Multicast using broadcast. #[cfg(solarish)] - IFF_MULTI_BCAST; + IFF_MULTI_BCAST as IflagsType; /// Is able to select media type via ifmap. (see /// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html)) #[cfg(any(linux_android, target_os = "fuchsia"))] @@ -102,7 +110,7 @@ libc_bitflags!( IFF_LINK1; /// Non-unique address. #[cfg(solarish)] - IFF_UNNUMBERED; + IFF_UNNUMBERED as IflagsType; /// Auto media selection active. (see /// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html)) #[cfg(any(linux_android, target_os = "fuchsia"))] @@ -115,14 +123,14 @@ libc_bitflags!( IFF_ALTPHYS; /// DHCP controls interface. #[cfg(solarish)] - IFF_DHCPRUNNING; + IFF_DHCPRUNNING as IflagsType; /// The addresses are lost when the interface goes down. (see /// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html)) #[cfg(any(linux_android, target_os = "fuchsia"))] IFF_DYNAMIC; /// Do not advertise. #[cfg(solarish)] - IFF_PRIVATE; + IFF_PRIVATE as IflagsType; /// Driver signals L1 up. Volatile. #[cfg(any(target_os = "fuchsia", target_os = "linux"))] IFF_LOWER_UP; @@ -134,7 +142,7 @@ libc_bitflags!( IFF_CANTCONFIG; /// Do not transmit packets. #[cfg(solarish)] - IFF_NOXMIT; + IFF_NOXMIT as IflagsType; /// Driver signals dormant. Volatile. #[cfg(any(target_os = "fuchsia", target_os = "linux"))] IFF_DORMANT; @@ -143,7 +151,7 @@ libc_bitflags!( IFF_PPROMISC; /// Just on-link subnet. #[cfg(solarish)] - IFF_NOLOCAL; + IFF_NOLOCAL as IflagsType; /// Echo sent packets. Volatile. #[cfg(any(target_os = "fuchsia", target_os = "linux"))] IFF_ECHO; @@ -152,19 +160,19 @@ libc_bitflags!( IFF_MONITOR; /// Address is deprecated. #[cfg(solarish)] - IFF_DEPRECATED; + IFF_DEPRECATED as IflagsType; /// Static ARP. #[cfg(freebsdlike)] IFF_STATICARP; /// Address from stateless addrconf. #[cfg(solarish)] - IFF_ADDRCONF; + IFF_ADDRCONF as IflagsType; /// Interface is in polling mode. #[cfg(any(target_os = "dragonfly"))] IFF_NPOLLING; /// Router on interface. #[cfg(solarish)] - IFF_ROUTER; + IFF_ROUTER as IflagsType; /// Interface is in polling mode. #[cfg(any(target_os = "dragonfly"))] IFF_IDIRECT; @@ -173,66 +181,67 @@ libc_bitflags!( IFF_DYING; /// No NUD on interface. #[cfg(solarish)] - IFF_NONUD; + IFF_NONUD as IflagsType; /// Interface is being renamed #[cfg(any(target_os = "freebsd"))] IFF_RENAMING; /// Anycast address. #[cfg(solarish)] - IFF_ANYCAST; + IFF_ANYCAST as IflagsType; /// Don't exchange routing info. #[cfg(solarish)] - IFF_NORTEXCH; + IFF_NORTEXCH as IflagsType; /// Do not provide packet information #[cfg(any(linux_android, target_os = "fuchsia"))] - IFF_NO_PI as libc::c_int; + IFF_NO_PI as IflagsType; /// TUN device (no Ethernet headers) #[cfg(any(linux_android, target_os = "fuchsia"))] - IFF_TUN as libc::c_int; + IFF_TUN as IflagsType; /// TAP device #[cfg(any(linux_android, target_os = "fuchsia"))] - IFF_TAP as libc::c_int; + IFF_TAP as IflagsType; /// IPv4 interface. #[cfg(solarish)] - IFF_IPV4; + IFF_IPV4 as IflagsType; /// IPv6 interface. #[cfg(solarish)] - IFF_IPV6; + IFF_IPV6 as IflagsType; /// in.mpathd test address #[cfg(solarish)] - IFF_NOFAILOVER; + IFF_NOFAILOVER as IflagsType; /// Interface has failed #[cfg(solarish)] - IFF_FAILED; + IFF_FAILED as IflagsType; /// Interface is a hot-spare #[cfg(solarish)] - IFF_STANDBY; + IFF_STANDBY as IflagsType; /// Functioning but not used #[cfg(solarish)] - IFF_INACTIVE; + IFF_INACTIVE as IflagsType; /// Interface is offline #[cfg(solarish)] - IFF_OFFLINE; - #[cfg(target_os = "solaris")] - IFF_COS_ENABLED; - /// Prefer as source addr. - #[cfg(target_os = "solaris")] - IFF_PREFERRED; + IFF_OFFLINE as IflagsType; + /// Has CoS marking supported + #[cfg(solarish)] + IFF_COS_ENABLED as IflagsType; + /// Prefer as source addr + #[cfg(solarish)] + IFF_PREFERRED as IflagsType; /// RFC3041 - #[cfg(target_os = "solaris")] - IFF_TEMPORARY; - /// MTU set with SIOCSLIFMTU - #[cfg(target_os = "solaris")] - IFF_FIXEDMTU; - /// Cannot send / receive packets - #[cfg(target_os = "solaris")] - IFF_VIRTUAL; + #[cfg(solarish)] + IFF_TEMPORARY as IflagsType; + /// MTU set + #[cfg(solarish)] + IFF_FIXEDMTU as IflagsType; + /// Cannot send/receive packets + #[cfg(solarish)] + IFF_VIRTUAL as IflagsType; /// Local address in use - #[cfg(target_os = "solaris")] - IFF_DUPLICATE; + #[cfg(solarish)] + IFF_DUPLICATE as IflagsType; /// IPMP IP interface - #[cfg(target_os = "solaris")] - IFF_IPMP; + #[cfg(solarish)] + IFF_IPMP as IflagsType; } ); @@ -247,7 +256,7 @@ impl fmt::Display for InterfaceFlags { bsd, target_os = "fuchsia", target_os = "linux", - target_os = "illumos", + solarish, ))] mod if_nameindex { use super::*; @@ -374,6 +383,6 @@ mod if_nameindex { bsd, target_os = "fuchsia", target_os = "linux", - target_os = "illumos", + solarish, ))] pub use if_nameindex::*; diff --git a/src/sys/ioctl/bsd.rs b/src/sys/ioctl/bsd.rs index 307994cb96..cedc8e63fe 100644 --- a/src/sys/ioctl/bsd.rs +++ b/src/sys/ioctl/bsd.rs @@ -1,10 +1,10 @@ /// The datatype used for the ioctl number #[doc(hidden)] -#[cfg(not(target_os = "illumos"))] +#[cfg(not(solarish))] pub type ioctl_num_type = ::libc::c_ulong; #[doc(hidden)] -#[cfg(target_os = "illumos")] +#[cfg(solarish)] pub type ioctl_num_type = ::libc::c_int; /// The datatype used for the 3rd argument diff --git a/src/sys/ioctl/mod.rs b/src/sys/ioctl/mod.rs index df222ec86c..e1e808f19e 100644 --- a/src/sys/ioctl/mod.rs +++ b/src/sys/ioctl/mod.rs @@ -234,11 +234,11 @@ mod linux; #[cfg(any(linux_android, target_os = "redox"))] pub use self::linux::*; -#[cfg(any(bsd, target_os = "illumos", target_os = "haiku",))] +#[cfg(any(bsd, solarish, target_os = "haiku",))] #[macro_use] mod bsd; -#[cfg(any(bsd, target_os = "illumos", target_os = "haiku",))] +#[cfg(any(bsd, solarish, target_os = "haiku",))] pub use self::bsd::*; /// Convert raw ioctl return value to a Nix result diff --git a/src/sys/mod.rs b/src/sys/mod.rs index 94302484fb..60700ad8a2 100644 --- a/src/sys/mod.rs +++ b/src/sys/mod.rs @@ -31,7 +31,7 @@ feature! { pub mod fanotify; } -#[cfg(any(bsd, linux_android, target_os = "redox", target_os = "illumos"))] +#[cfg(any(bsd, linux_android, target_os = "redox", solarish))] #[cfg(feature = "ioctl")] #[cfg_attr(docsrs, doc(cfg(feature = "ioctl")))] #[macro_use] @@ -88,7 +88,7 @@ feature! { #[cfg(not(any( target_os = "redox", target_os = "fuchsia", - target_os = "illumos", + solarish, target_os = "haiku" )))] feature! { @@ -182,7 +182,7 @@ feature! { #[cfg(all( any( target_os = "freebsd", - target_os = "illumos", + solarish, target_os = "linux", target_os = "netbsd" ), diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index eb1944bb99..608a6e5cc1 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -1,7 +1,7 @@ #[cfg(any( bsd, linux_android, - target_os = "illumos", + solarish, target_os = "haiku", target_os = "fuchsia", target_os = "aix", @@ -230,7 +230,7 @@ pub enum AddressFamily { #[cfg(bsd)] Hylink = libc::AF_HYLINK, /// Link layer interface - #[cfg(any(bsd, target_os = "illumos"))] + #[cfg(any(bsd, solarish))] Link = libc::AF_LINK, /// connection-oriented IP, aka ST II #[cfg(bsd)] @@ -265,7 +265,7 @@ impl AddressFamily { libc::PF_ROUTE => Some(AddressFamily::Route), #[cfg(linux_android)] libc::AF_PACKET => Some(AddressFamily::Packet), - #[cfg(any(bsd, target_os = "illumos"))] + #[cfg(any(bsd, solarish))] libc::AF_LINK => Some(AddressFamily::Link), #[cfg(any(linux_android, apple_targets))] libc::AF_VSOCK => Some(AddressFamily::Vsock), @@ -506,7 +506,7 @@ impl UnixAddr { cfg_if! { if #[cfg(any(linux_android, target_os = "fuchsia", - target_os = "illumos", + solarish, target_os = "redox", ))] { @@ -547,7 +547,7 @@ impl SockaddrLike for UnixAddr { cfg_if! { if #[cfg(any(linux_android, target_os = "fuchsia", - target_os = "illumos", + solarish, target_os = "redox", ))] { let su_len = len.unwrap_or( @@ -577,7 +577,7 @@ impl SockaddrLike for UnixAddr { cfg_if! { if #[cfg(any(linux_android, target_os = "fuchsia", - target_os = "illumos", + solarish, target_os = "redox", ))] { self.sun_len = new_length as u8; @@ -1101,7 +1101,7 @@ impl SockaddrLike for SockaddrStorage { #[cfg(any( linux_android, target_os = "fuchsia", - target_os = "illumos", + solarish, ))] if i32::from(ss.ss_family) == libc::AF_UNIX { // Safe because we UnixAddr is strictly smaller than @@ -1131,7 +1131,7 @@ impl SockaddrLike for SockaddrStorage { libc::AF_INET6 => unsafe { SockaddrIn6::from_raw(addr, l).map(|sin6| Self { sin6 }) }, - #[cfg(any(bsd, target_os = "illumos", target_os = "haiku"))] + #[cfg(any(bsd, solarish, target_os = "haiku"))] #[cfg(feature = "net")] libc::AF_LINK => unsafe { LinkAddr::from_raw(addr, l).map(|dl| Self { dl }) @@ -1158,7 +1158,7 @@ impl SockaddrLike for SockaddrStorage { } } - #[cfg(any(linux_android, target_os = "fuchsia", target_os = "illumos"))] + #[cfg(any(linux_android, target_os = "fuchsia", solarish))] fn len(&self) -> libc::socklen_t { match self.as_unix_addr() { // The UnixAddr type knows its own length @@ -1219,7 +1219,7 @@ impl SockaddrStorage { cfg_if! { if #[cfg(any(linux_android, target_os = "fuchsia", - target_os = "illumos", + solarish, ))] { let p = unsafe{ &self.ss as *const libc::sockaddr_storage }; @@ -1248,7 +1248,7 @@ impl SockaddrStorage { cfg_if! { if #[cfg(any(linux_android, target_os = "fuchsia", - target_os = "illumos", + solarish, ))] { let p = unsafe{ &self.ss as *const libc::sockaddr_storage }; @@ -1282,7 +1282,7 @@ impl SockaddrStorage { as_link_addr, as_link_addr_mut, LinkAddr, AddressFamily::Packet, libc::sockaddr_ll, dl} - #[cfg(any(bsd, target_os = "illumos"))] + #[cfg(any(bsd, solarish))] #[cfg(feature = "net")] accessors! { as_link_addr, as_link_addr_mut, LinkAddr, @@ -1332,7 +1332,7 @@ impl fmt::Display for SockaddrStorage { libc::AF_INET => self.sin.fmt(f), #[cfg(feature = "net")] libc::AF_INET6 => self.sin6.fmt(f), - #[cfg(any(bsd, target_os = "illumos"))] + #[cfg(any(bsd, solarish))] #[cfg(feature = "net")] libc::AF_LINK => self.dl.fmt(f), #[cfg(linux_android)] @@ -1394,7 +1394,7 @@ impl Hash for SockaddrStorage { libc::AF_INET => self.sin.hash(s), #[cfg(feature = "net")] libc::AF_INET6 => self.sin6.hash(s), - #[cfg(any(bsd, target_os = "illumos"))] + #[cfg(any(bsd, solarish))] #[cfg(feature = "net")] libc::AF_LINK => self.dl.hash(s), #[cfg(linux_android)] @@ -1424,7 +1424,7 @@ impl PartialEq for SockaddrStorage { (libc::AF_INET, libc::AF_INET) => self.sin == other.sin, #[cfg(feature = "net")] (libc::AF_INET6, libc::AF_INET6) => self.sin6 == other.sin6, - #[cfg(any(bsd, target_os = "illumos"))] + #[cfg(any(bsd, solarish))] #[cfg(feature = "net")] (libc::AF_LINK, libc::AF_LINK) => self.dl == other.dl, #[cfg(linux_android)] @@ -1854,7 +1854,7 @@ mod datalink { } } -#[cfg(any(bsd, target_os = "illumos", target_os = "haiku", target_os = "aix"))] +#[cfg(any(bsd, solarish, target_os = "haiku", target_os = "aix"))] mod datalink { feature! { #![feature = "net"] @@ -2128,7 +2128,7 @@ mod tests { mod link { #![allow(clippy::cast_ptr_alignment)] - #[cfg(any(apple_targets, target_os = "illumos"))] + #[cfg(any(apple_targets, solarish))] use super::super::super::socklen_t; use super::*; @@ -2215,9 +2215,9 @@ mod tests { } } - #[cfg(target_os = "illumos")] + #[cfg(solarish)] #[test] - fn illumos_tap() { + fn solarish_tap() { let bytes = [25u8, 0, 0, 0, 6, 0, 6, 0, 24, 101, 144, 221, 76, 176]; let ptr = bytes.as_ptr(); let sa = ptr as *const libc::sockaddr; diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs index a37e123616..85dac2cabc 100644 --- a/src/sys/socket/mod.rs +++ b/src/sys/socket/mod.rs @@ -256,13 +256,13 @@ libc_bitflags! { #[cfg(any(linux_android, freebsdlike, netbsdlike, - target_os = "illumos"))] + solarish))] SOCK_NONBLOCK; /// Set close-on-exec on the new descriptor #[cfg(any(linux_android, freebsdlike, netbsdlike, - target_os = "illumos"))] + solarish))] SOCK_CLOEXEC; /// Return `EPIPE` instead of raising `SIGPIPE` #[cfg(target_os = "netbsd")] @@ -343,8 +343,7 @@ libc_bitflags! { #[cfg(any(linux_android, netbsdlike, target_os = "fuchsia", - target_os = "freebsd", - target_os = "solaris"))] + target_os = "freebsd"))] MSG_WAITFORONE; } } @@ -2156,7 +2155,7 @@ pub fn accept(sockfd: RawFd) -> Result { netbsdlike, target_os = "emscripten", target_os = "fuchsia", - target_os = "illumos", + solarish, target_os = "linux", ))] pub fn accept4(sockfd: RawFd, flags: SockFlag) -> Result { diff --git a/src/sys/time.rs b/src/sys/time.rs index d5e9f3a6b2..ac13de419c 100644 --- a/src/sys/time.rs +++ b/src/sys/time.rs @@ -18,7 +18,7 @@ const fn zero_init_timespec() -> timespec { all( any( target_os = "freebsd", - target_os = "illumos", + solarish, target_os = "linux", target_os = "netbsd" ), @@ -97,7 +97,7 @@ pub(crate) mod timer { const TFD_TIMER_CANCEL_ON_SET = libc::TFD_TIMER_CANCEL_ON_SET; } } - #[cfg(any(freebsdlike, target_os = "netbsd", target_os = "illumos"))] + #[cfg(any(freebsdlike, target_os = "netbsd", solarish))] bitflags! { /// Flags that are used for arming the timer. #[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] diff --git a/src/sys/uio.rs b/src/sys/uio.rs index 29e3647b35..cdf380dd11 100644 --- a/src/sys/uio.rs +++ b/src/sys/uio.rs @@ -53,7 +53,7 @@ pub fn readv(fd: Fd, iov: &mut [IoSliceMut<'_>]) -> Result { /// or an error occurs. The file offset is not changed. /// /// See also: [`writev`](fn.writev.html) and [`pwrite`](fn.pwrite.html) -#[cfg(not(any(target_os = "redox", target_os = "haiku")))] +#[cfg(not(any(target_os = "redox", target_os = "haiku", target_os = "solaris")))] pub fn pwritev( fd: Fd, iov: &[IoSlice<'_>], @@ -82,7 +82,7 @@ pub fn pwritev( /// changed. /// /// See also: [`readv`](fn.readv.html) and [`pread`](fn.pread.html) -#[cfg(not(any(target_os = "redox", target_os = "haiku")))] +#[cfg(not(any(target_os = "redox", target_os = "haiku", target_os = "solaris")))] // Clippy doesn't know that we need to pass iov mutably only because the // mutation happens after converting iov to a pointer #[allow(clippy::needless_pass_by_ref_mut)] diff --git a/src/unistd.rs b/src/unistd.rs index a9d8b0aaf2..a86f54c504 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -1647,7 +1647,7 @@ pub fn setgroups(groups: &[Gid]) -> Result<()> { /// will only ever return the complete list or else an error. #[cfg(not(any( target_os = "aix", - target_os = "illumos", + solarish, apple_targets, target_os = "redox" )))] @@ -3200,9 +3200,9 @@ impl From for libc::passwd { target_os = "haiku", )))] pw_expire: u.expire, - #[cfg(target_os = "illumos")] + #[cfg(solarish)] pw_age: CString::new("").unwrap().into_raw(), - #[cfg(target_os = "illumos")] + #[cfg(solarish)] pw_comment: CString::new("").unwrap().into_raw(), #[cfg(freebsdlike)] pw_fields: 0, diff --git a/test/sys/test_uio.rs b/test/sys/test_uio.rs index fe0a3bde07..d035a7bb04 100644 --- a/test/sys/test_uio.rs +++ b/test/sys/test_uio.rs @@ -140,7 +140,11 @@ fn test_pread() { } #[test] -#[cfg(not(any(target_os = "redox", target_os = "haiku")))] +#[cfg(not(any( + target_os = "redox", + target_os = "haiku", + target_os = "solaris" +)))] fn test_pwritev() { use std::io::Read; @@ -175,7 +179,11 @@ fn test_pwritev() { } #[test] -#[cfg(not(any(target_os = "redox", target_os = "haiku")))] +#[cfg(not(any( + target_os = "redox", + target_os = "haiku", + target_os = "solaris" +)))] fn test_preadv() { use std::io::Write; diff --git a/test/test.rs b/test/test.rs index eed532c194..388a0a42e8 100644 --- a/test/test.rs +++ b/test/test.rs @@ -52,7 +52,7 @@ mod test_time; #[cfg(all( any( target_os = "freebsd", - target_os = "illumos", + solarish, target_os = "linux", target_os = "netbsd" ), diff --git a/test/test_dir.rs b/test/test_dir.rs index 2af4aa5c0a..24ecd6963e 100644 --- a/test/test_dir.rs +++ b/test/test_dir.rs @@ -6,10 +6,10 @@ use tempfile::tempdir; #[cfg(test)] fn flags() -> OFlag { - #[cfg(target_os = "illumos")] + #[cfg(solarish)] let f = OFlag::O_RDONLY | OFlag::O_CLOEXEC; - #[cfg(not(target_os = "illumos"))] + #[cfg(not(solarish))] let f = OFlag::O_RDONLY | OFlag::O_CLOEXEC | OFlag::O_DIRECTORY; f diff --git a/test/test_pty.rs b/test/test_pty.rs index ae4127e481..368ec129b0 100644 --- a/test/test_pty.rs +++ b/test/test_pty.rs @@ -96,7 +96,7 @@ fn open_ptty_pair() -> (PtyMaster, File) { open(Path::new(&slave_name), OFlag::O_RDWR, stat::Mode::empty()) .unwrap(); - #[cfg(target_os = "illumos")] + #[cfg(solarish)] // TODO: rewrite using ioctl! #[allow(clippy::comparison_chain)] { diff --git a/test/test_resource.rs b/test/test_resource.rs index 2ab581ba29..beae01c4c8 100644 --- a/test/test_resource.rs +++ b/test/test_resource.rs @@ -1,7 +1,7 @@ #[cfg(not(any( target_os = "redox", target_os = "fuchsia", - target_os = "illumos", + solarish, target_os = "haiku" )))] use nix::sys::resource::{getrlimit, setrlimit, Resource}; @@ -18,7 +18,7 @@ use nix::sys::resource::{getrlimit, setrlimit, Resource}; #[cfg(not(any( target_os = "redox", target_os = "fuchsia", - target_os = "illumos", + solarish, target_os = "haiku" )))] pub fn test_resource_limits_nofile() { diff --git a/test/test_stat.rs b/test/test_stat.rs index 6bae35e188..58238249d9 100644 --- a/test/test_stat.rs +++ b/test/test_stat.rs @@ -383,7 +383,7 @@ fn test_mknod() { #[cfg(not(any( target_os = "dragonfly", target_os = "freebsd", - target_os = "illumos", + solarish, apple_targets, target_os = "haiku", target_os = "redox" diff --git a/test/test_unistd.rs b/test/test_unistd.rs index 0a841df060..6e9e4f65c5 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -294,7 +294,7 @@ fn test_setgroups() { target_os = "redox", target_os = "fuchsia", target_os = "haiku", - target_os = "illumos" + solarish )))] fn test_initgroups() { // Skip this test when not run as root as `initgroups()` and `setgroups()` @@ -437,7 +437,7 @@ cfg_if! { // https://github.com/nix-rust/nix/issues/555 execve_test_factory!(test_execve, execve, CString::new("/bin/sh").unwrap().as_c_str()); execve_test_factory!(test_fexecve, fexecve, File::open("/bin/sh").unwrap().into_raw_fd()); - } else if #[cfg(any(target_os = "illumos", + } else if #[cfg(any(solarish, apple_targets, target_os = "netbsd", target_os = "openbsd", @@ -756,7 +756,7 @@ fn test_pipe() { target_os = "dragonfly", target_os = "emscripten", target_os = "freebsd", - target_os = "illumos", + solarish, target_os = "linux", target_os = "netbsd", target_os = "openbsd",