Use `target_vendor = "apple"` instead of `target_os = "..."`

This commit is contained in:
Mads Marquart 2024-04-28 18:22:37 +02:00
parent cb49406457
commit d9c0eb8084
18 changed files with 74 additions and 336 deletions

View File

@ -1657,23 +1657,9 @@ fn test_file_times() {
let accessed = SystemTime::UNIX_EPOCH + Duration::from_secs(12345);
let modified = SystemTime::UNIX_EPOCH + Duration::from_secs(54321);
times = times.set_accessed(accessed).set_modified(modified);
#[cfg(any(
windows,
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "visionos",
target_os = "tvos",
))]
#[cfg(any(windows, target_vendor = "apple"))]
let created = SystemTime::UNIX_EPOCH + Duration::from_secs(32123);
#[cfg(any(
windows,
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "visionos",
target_os = "tvos",
))]
#[cfg(any(windows, target_vendor = "apple"))]
{
times = times.set_created(created);
}
@ -1698,27 +1684,14 @@ fn test_file_times() {
let metadata = file.metadata().unwrap();
assert_eq!(metadata.accessed().unwrap(), accessed);
assert_eq!(metadata.modified().unwrap(), modified);
#[cfg(any(
windows,
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "visionos",
target_os = "tvos",
))]
#[cfg(any(windows, target_vendor = "apple"))]
{
assert_eq!(metadata.created().unwrap(), created);
}
}
#[test]
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos"
))]
#[cfg(target_vendor = "apple")]
fn test_file_times_pre_epoch_with_nanos() {
#[cfg(target_os = "ios")]
use crate::os::ios::fs::FileTimesExt;

View File

@ -17,14 +17,10 @@ mod tests;
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "nto",
target_vendor = "apple",
))]
mod ucred;
@ -44,14 +40,10 @@ pub use self::stream::*;
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "nto",
target_vendor = "apple",
))]
#[unstable(feature = "peer_credentials_unix_socket", issue = "42839", reason = "unstable")]
pub use self::ucred::*;

View File

@ -3,14 +3,10 @@
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "ios",
target_os = "tvos",
target_os = "macos",
target_os = "watchos",
target_os = "visionos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "nto"
target_os = "nto",
target_vendor = "apple",
))]
use super::{peer_cred, UCred};
#[cfg(any(doc, target_os = "android", target_os = "linux"))]
@ -231,14 +227,10 @@ impl UnixStream {
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "ios",
target_os = "tvos",
target_os = "macos",
target_os = "watchos",
target_os = "visionos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "nto"
target_os = "nto",
target_vendor = "apple",
))]
pub fn peer_cred(&self) -> io::Result<UCred> {
peer_cred(self)

View File

@ -35,14 +35,8 @@ pub(super) use self::impl_linux::peer_cred;
))]
pub(super) use self::impl_bsd::peer_cred;
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos"
))]
pub(super) use self::impl_mac::peer_cred;
#[cfg(target_vendor = "apple")]
pub(super) use self::impl_apple::peer_cred;
#[cfg(any(target_os = "linux", target_os = "android"))]
mod impl_linux {
@ -103,14 +97,8 @@ mod impl_bsd {
}
}
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos"
))]
mod impl_mac {
#[cfg(target_vendor = "apple")]
mod impl_apple {
use super::UCred;
use crate::os::unix::io::AsRawFd;
use crate::os::unix::net::UnixStream;

View File

@ -7,12 +7,8 @@ use libc::{getegid, geteuid, getpid};
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "ios",
target_os = "tvos",
target_os = "macos",
target_os = "watchos",
target_os = "visionos",
target_os = "openbsd"
target_os = "openbsd",
target_vendor = "apple",
))]
fn test_socket_pair() {
// Create two connected sockets and get their peer credentials. They should be equal.
@ -28,14 +24,7 @@ fn test_socket_pair() {
}
#[test]
#[cfg(any(
target_os = "linux",
target_os = "ios",
target_os = "macos",
target_os = "watchos",
target_os = "visionos",
target_os = "tvos",
))]
#[cfg(any(target_os = "linux", target_vendor = "apple"))]
fn test_socket_pair_pids(arg: Type) -> RetType {
// Create two connected sockets and get their peer credentials.
let (sock_a, sock_b) = UnixStream::pair().unwrap();

View File

@ -168,13 +168,7 @@ mod imp {
}
}
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "visionos",
target_os = "tvos"
))]
#[cfg(target_vendor = "apple")]
mod imp {
use super::Args;
use crate::ffi::CStr;
@ -215,12 +209,7 @@ mod imp {
// for i in (0..[args count])
// res.push([args objectAtIndex:i])
// res
#[cfg(any(
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos"
))]
#[cfg(not(target_os = "macos"))]
pub fn args() -> Args {
use crate::ffi::{c_char, c_void, OsString};
use crate::mem;

View File

@ -20,14 +20,7 @@ use crate::sys::time::SystemTime;
use crate::sys::{cvt, cvt_r};
use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};
#[cfg(any(
all(target_os = "linux", target_env = "gnu"),
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
))]
#[cfg(any(all(target_os = "linux", target_env = "gnu"), target_vendor = "apple"))]
use crate::sys::weak::syscall;
#[cfg(any(target_os = "android", target_os = "macos", target_os = "solaris"))]
use crate::sys::weak::weak;
@ -35,13 +28,9 @@ use crate::sys::weak::weak;
use libc::{c_int, mode_t};
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "solaris",
all(target_os = "linux", target_env = "gnu")
all(target_os = "linux", target_env = "gnu"),
target_vendor = "apple",
))]
use libc::c_char;
#[cfg(any(
@ -375,13 +364,7 @@ pub struct FilePermissions {
pub struct FileTimes {
accessed: Option<SystemTime>,
modified: Option<SystemTime>,
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "visionos",
target_os = "tvos"
))]
#[cfg(target_vendor = "apple")]
created: Option<SystemTime>,
}
@ -554,15 +537,7 @@ impl FileAttr {
SystemTime::new(self.stat.st_atim.tv_sec as i64, self.stat.st_atim.tv_nsec as i64)
}
#[cfg(any(
target_os = "freebsd",
target_os = "openbsd",
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
))]
#[cfg(any(target_os = "freebsd", target_os = "openbsd", target_vendor = "apple"))]
pub fn created(&self) -> io::Result<SystemTime> {
SystemTime::new(self.stat.st_birthtime as i64, self.stat.st_birthtime_nsec as i64)
}
@ -570,12 +545,8 @@ impl FileAttr {
#[cfg(not(any(
target_os = "freebsd",
target_os = "openbsd",
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "vita",
target_vendor = "apple",
)))]
pub fn created(&self) -> io::Result<SystemTime> {
cfg_has_statx! {
@ -655,13 +626,7 @@ impl FileTimes {
self.modified = Some(t);
}
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "visionos",
target_os = "tvos"
))]
#[cfg(target_vendor = "apple")]
pub fn set_created(&mut self, t: SystemTime) {
self.created = Some(t);
}
@ -994,11 +959,6 @@ impl DirEntry {
}
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "linux",
target_os = "emscripten",
target_os = "android",
@ -1015,6 +975,7 @@ impl DirEntry {
target_os = "aix",
target_os = "nto",
target_os = "hurd",
target_vendor = "apple",
))]
pub fn ino(&self) -> u64 {
self.entry.d_ino as u64
@ -1031,15 +992,11 @@ impl DirEntry {
}
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "freebsd",
target_os = "dragonfly"
target_os = "dragonfly",
target_vendor = "apple",
))]
fn name_bytes(&self) -> &[u8] {
use crate::slice;
@ -1051,15 +1008,11 @@ impl DirEntry {
}
}
#[cfg(not(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "freebsd",
target_os = "dragonfly"
target_os = "dragonfly",
target_vendor = "apple",
)))]
fn name_bytes(&self) -> &[u8] {
self.name_cstr().to_bytes()
@ -1237,23 +1190,11 @@ impl File {
cvt_r(|| unsafe { os_fsync(self.as_raw_fd()) })?;
return Ok(());
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
))]
#[cfg(target_vendor = "apple")]
unsafe fn os_fsync(fd: c_int) -> c_int {
libc::fcntl(fd, libc::F_FULLFSYNC)
}
#[cfg(not(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
)))]
#[cfg(not(target_vendor = "apple"))]
unsafe fn os_fsync(fd: c_int) -> c_int {
libc::fsync(fd)
}
@ -1263,13 +1204,7 @@ impl File {
cvt_r(|| unsafe { os_datasync(self.as_raw_fd()) })?;
return Ok(());
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
))]
#[cfg(target_vendor = "apple")]
unsafe fn os_datasync(fd: c_int) -> c_int {
libc::fcntl(fd, libc::F_FULLFSYNC)
}
@ -1288,16 +1223,12 @@ impl File {
#[cfg(not(any(
target_os = "android",
target_os = "freebsd",
target_os = "ios",
target_os = "tvos",
target_os = "linux",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "watchos",
target_os = "visionos",
target_os = "nto",
target_os = "hurd",
target_vendor = "apple",
)))]
unsafe fn os_datasync(fd: c_int) -> c_int {
libc::fsync(fd)
@ -1406,7 +1337,7 @@ impl File {
io::ErrorKind::Unsupported,
"setting file times not supported",
))
} else if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))] {
} else if #[cfg(target_vendor = "apple")] {
let mut buf = [mem::MaybeUninit::<libc::timespec>::uninit(); 3];
let mut num_times = 0;
let mut attrlist: libc::attrlist = unsafe { mem::zeroed() };
@ -1938,15 +1869,7 @@ fn open_to_and_set_permissions(
Ok((writer, writer_metadata))
}
#[cfg(not(any(
target_os = "linux",
target_os = "android",
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
)))]
#[cfg(not(any(target_os = "linux", target_os = "android", target_vendor = "apple")))]
pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
let (mut reader, reader_metadata) = open_from(from)?;
let (mut writer, _) = open_to_and_set_permissions(to, reader_metadata)?;
@ -1972,13 +1895,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
}
}
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "visionos",
target_os = "tvos"
))]
#[cfg(target_vendor = "apple")]
pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
use crate::sync::atomic::{AtomicBool, Ordering};

View File

@ -78,16 +78,12 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) {
target_os = "emscripten",
target_os = "fuchsia",
target_os = "vxworks",
// The poll on Darwin doesn't set POLLNVAL for closed fds.
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "redox",
target_os = "l4re",
target_os = "horizon",
target_os = "vita",
// The poll on Darwin doesn't set POLLNVAL for closed fds.
target_vendor = "apple",
)))]
'poll: {
use crate::sys::os::errno;
@ -406,7 +402,7 @@ cfg_if::cfg_if! {
} else if #[cfg(target_os = "macos")] {
#[link(name = "System")]
extern "C" {}
} else if #[cfg(any(target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))] {
} else if #[cfg(all(target_vendor = "apple", not(target_os = "macos")))] {
#[link(name = "System")]
#[link(name = "objc")]
#[link(name = "Foundation", kind = "framework")]

View File

@ -63,17 +63,7 @@ extern "C" {
)]
#[cfg_attr(any(target_os = "solaris", target_os = "illumos"), link_name = "___errno")]
#[cfg_attr(target_os = "nto", link_name = "__get_errno_ptr")]
#[cfg_attr(
any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "freebsd",
target_os = "watchos",
target_os = "visionos",
),
link_name = "__error"
)]
#[cfg_attr(any(target_os = "freebsd", target_vendor = "apple"), link_name = "__error")]
#[cfg_attr(target_os = "haiku", link_name = "_errnop")]
#[cfg_attr(target_os = "aix", link_name = "_Errno")]
fn errno_location() -> *mut c_int;
@ -431,13 +421,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
Ok(PathBuf::from(OsString::from_vec(e)))
}
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "visionos",
target_os = "tvos"
))]
#[cfg(target_vendor = "apple")]
pub fn current_exe() -> io::Result<PathBuf> {
unsafe {
let mut sz: u32 = 0;
@ -703,32 +687,26 @@ pub fn home_dir() -> Option<PathBuf> {
#[cfg(any(
target_os = "android",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "emscripten",
target_os = "redox",
target_os = "vxworks",
target_os = "espidf",
target_os = "horizon",
target_os = "vita",
all(target_vendor = "apple", not(target_os = "macos")),
))]
unsafe fn fallback() -> Option<OsString> {
None
}
#[cfg(not(any(
target_os = "android",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "emscripten",
target_os = "redox",
target_os = "vxworks",
target_os = "espidf",
target_os = "horizon",
target_os = "vita",
all(target_vendor = "apple", not(target_os = "macos")),
)))]
unsafe fn fallback() -> Option<OsString> {
let amt = match libc::sysconf(libc::_SC_GETPW_R_SIZE_MAX) {

View File

@ -12,11 +12,6 @@ pub fn hashmap_random_keys() -> (u64, u64) {
#[cfg(all(
unix,
not(target_os = "macos"),
not(target_os = "ios"),
not(target_os = "tvos"),
not(target_os = "watchos"),
not(target_os = "visionos"),
not(target_os = "openbsd"),
not(target_os = "netbsd"),
not(target_os = "fuchsia"),
@ -24,6 +19,7 @@ pub fn hashmap_random_keys() -> (u64, u64) {
not(target_os = "vxworks"),
not(target_os = "emscripten"),
not(target_os = "vita"),
not(target_vendor = "apple"),
))]
mod imp {
use crate::fs::File;

View File

@ -150,13 +150,7 @@ impl Thread {
}
}
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "visionos",
target_os = "tvos"
))]
#[cfg(target_vendor = "apple")]
pub fn set_name(name: &CStr) {
unsafe {
let name = truncate_cstr::<{ libc::MAXTHREADNAMESIZE }>(name);
@ -301,14 +295,10 @@ impl Drop for Thread {
#[cfg(any(
target_os = "linux",
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "nto",
target_os = "solaris",
target_os = "illumos",
target_vendor = "apple",
))]
fn truncate_cstr<const MAX_WITH_NUL: usize>(cstr: &CStr) -> [libc::c_char; MAX_WITH_NUL] {
let mut result = [0; MAX_WITH_NUL];

View File

@ -76,13 +76,7 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
// workaround below is to register, via _tlv_atexit, a custom DTOR list once per
// thread. thread_local dtors are pushed to the DTOR list without calling
// _tlv_atexit.
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "visionos",
target_os = "tvos"
))]
#[cfg(target_vendor = "apple")]
pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
use crate::cell::{Cell, RefCell};
use crate::ptr;

View File

@ -11,16 +11,7 @@
)))]
cfg_if::cfg_if! {
if #[cfg(all(
any(
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "visionos",
target_os = "tvos",
),
not(miri),
))] {
if #[cfg(all(target_vendor = "apple", not(miri)))] {
mod darwin;
pub use darwin::Parker;
} else if #[cfg(target_os = "netbsd")] {

View File

@ -43,15 +43,7 @@ unsafe fn wait_timeout(
) {
// Use the system clock on systems that do not support pthread_condattr_setclock.
// This unfortunately results in problems when the system time changes.
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "espidf",
target_os = "horizon",
))]
#[cfg(any(target_os = "espidf", target_os = "horizon", target_vendor = "apple"))]
let (now, dur) = {
use crate::cmp::min;
use crate::sys::time::SystemTime;
@ -72,15 +64,7 @@ unsafe fn wait_timeout(
(now, dur)
};
// Use the monotonic clock on other systems.
#[cfg(not(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "espidf",
target_os = "horizon",
)))]
#[cfg(not(any(target_os = "espidf", target_os = "horizon", target_vendor = "apple")))]
let (now, dur) = {
use crate::sys::time::Timespec;
@ -122,15 +106,11 @@ impl Parker {
cfg_if::cfg_if! {
if #[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "l4re",
target_os = "android",
target_os = "redox",
target_os = "vita",
target_vendor = "apple",
))] {
addr_of_mut!((*parker).cvar).write(UnsafeCell::new(libc::PTHREAD_COND_INITIALIZER));
} else if #[cfg(any(target_os = "espidf", target_os = "horizon"))] {

View File

@ -86,13 +86,7 @@ impl Timespec {
// Please note that Apple OS nonetheless accepts the standard unix format when
// setting file times, which makes this compensation round-trippable and generally
// transparent.
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
))]
#[cfg(target_vendor = "apple")]
let (tv_sec, tv_nsec) =
if (tv_sec <= 0 && tv_sec > i64::MIN) && (tv_nsec < 0 && tv_nsec > -1_000_000_000) {
(tv_sec - 1, tv_nsec + 1_000_000_000)
@ -275,21 +269,9 @@ impl Instant {
//
// Instant on macos was historically implemented using mach_absolute_time;
// we preserve this value domain out of an abundance of caution.
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "visionos",
target_os = "tvos"
))]
#[cfg(target_vendor = "apple")]
const clock_id: libc::clockid_t = libc::CLOCK_UPTIME_RAW;
#[cfg(not(any(
target_os = "macos",
target_os = "ios",
target_os = "watchos",
target_os = "visionos",
target_os = "tvos"
)))]
#[cfg(not(target_vendor = "apple"))]
const clock_id: libc::clockid_t = libc::CLOCK_MONOTONIC;
Instant { t: Timespec::now(clock_id) }
}

View File

@ -30,14 +30,10 @@ impl LazyInit for AllocatedCondvar {
cfg_if::cfg_if! {
if #[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "l4re",
target_os = "android",
target_os = "redox"
target_os = "redox",
target_vendor = "apple",
))] {
// `pthread_condattr_setclock` is unfortunately not supported on these platforms.
} else if #[cfg(any(target_os = "espidf", target_os = "horizon"))] {
@ -124,14 +120,10 @@ impl Condvar {
// default system clock). This approach avoids all problems that result
// from changes made to the system time.
#[cfg(not(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "android",
target_os = "espidf",
target_os = "horizon"
target_os = "horizon",
target_vendor = "apple",
)))]
pub unsafe fn wait_timeout(&self, mutex: &Mutex, dur: Duration) -> bool {
use crate::sys::time::Timespec;
@ -160,14 +152,10 @@ impl Condvar {
// https://github.com/llvm-mirror/libcxx/blob/release_35/src/condition_variable.cpp#L46
// https://github.com/llvm-mirror/libcxx/blob/release_35/include/__mutex_base#L367
#[cfg(any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_os = "android",
target_os = "espidf",
target_os = "horizon"
target_os = "horizon",
target_vendor = "apple",
))]
pub unsafe fn wait_timeout(&self, mutex: &Mutex, dur: Duration) -> bool {
use crate::sys::time::SystemTime;

View File

@ -17,10 +17,17 @@ use crate::ffi::{c_int, c_void};
cfg_if::cfg_if! {
if #[cfg(any(
target_os = "dragonfly", target_os = "freebsd",
target_os = "ios", target_os = "tvos", target_os = "macos", target_os = "watchos", target_os = "visionos",
target_os = "openbsd", target_os = "netbsd", target_os = "illumos",
target_os = "solaris", target_os = "haiku", target_os = "l4re", target_os = "nto"))] {
target_os = "dragonfly",
target_os = "freebsd",
target_os = "openbsd",
target_os = "netbsd",
target_os = "illumos",
target_os = "solaris",
target_os = "haiku",
target_os = "l4re",
target_os = "nto",
target_vendor = "apple",
))] {
use crate::sys::net::netc::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP;
use crate::sys::net::netc::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP;
} else {

View File

@ -40,11 +40,7 @@ fn test_named_thread() {
#[cfg(any(
// Note: musl didn't add pthread_getname_np until 1.2.3
all(target_os = "linux", target_env = "gnu"),
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos",
target_vendor = "apple",
))]
#[test]
fn test_named_thread_truncation() {