diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index 7b11ad7c66ebd..07ac437f6d10b 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -1786,6 +1786,7 @@ __PTHREAD_RWLOCKATTR_SIZE__ __PTHREAD_RWLOCK_SIZE__ __darwin_mcontext64 __error +_opaque_pthread_t abs acct aio_cancel diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 37ef0f0d81ed1..80da4896f3c13 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -5,7 +5,21 @@ pub type useconds_t = u32; pub type blkcnt_t = i64; pub type socklen_t = u32; pub type sa_family_t = u8; -pub type pthread_t = crate::uintptr_t; + +cfg_if! { + if #[cfg(target_vendor = "apple")] { + extern_ty! { + pub enum _opaque_pthread_t {} + } + + type __darwin_pthread_t = *mut _opaque_pthread_t; + pub type pthread_t = __darwin_pthread_t; + } else { + // FIXME(1.0): verify other BSDs? Glancing around, other BSDs also look like a pointer + pub type pthread_t = crate::uintptr_t; + } +} + pub type nfds_t = c_uint; pub type regoff_t = off_t;