aboutsummaryrefslogtreecommitdiff
path: root/libc/src/unix/bsd/apple/b32.rs
diff options
context:
space:
mode:
Diffstat (limited to 'libc/src/unix/bsd/apple/b32.rs')
-rw-r--r--libc/src/unix/bsd/apple/b32.rs41
1 files changed, 36 insertions, 5 deletions
diff --git a/libc/src/unix/bsd/apple/b32.rs b/libc/src/unix/bsd/apple/b32.rs
index 907ab02..13b1a0b 100644
--- a/libc/src/unix/bsd/apple/b32.rs
+++ b/libc/src/unix/bsd/apple/b32.rs
@@ -5,11 +5,6 @@ pub type c_ulong = u32;
pub type boolean_t = ::c_int;
s! {
- pub struct pthread_attr_t {
- __sig: c_long,
- __opaque: [::c_char; 36]
- }
-
pub struct if_data {
pub ifi_type: ::c_uchar,
pub ifi_typelen: ::c_uchar,
@@ -50,6 +45,42 @@ s! {
}
}
+s_no_extra_traits!{
+ pub struct pthread_attr_t {
+ __sig: c_long,
+ __opaque: [::c_char; 36]
+ }
+}
+
+cfg_if! {
+ if #[cfg(feature = "extra_traits")] {
+ impl PartialEq for pthread_attr_t {
+ fn eq(&self, other: &pthread_attr_t) -> bool {
+ self.__sig == other.__sig
+ && self.__opaque
+ .iter()
+ .zip(other.__opaque.iter())
+ .all(|(a,b)| a == b)
+ }
+ }
+ impl Eq for pthread_attr_t {}
+ impl ::fmt::Debug for pthread_attr_t {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("pthread_attr_t")
+ .field("__sig", &self.__sig)
+ // FIXME: .field("__opaque", &self.__opaque)
+ .finish()
+ }
+ }
+ impl ::hash::Hash for pthread_attr_t {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.__sig.hash(state);
+ self.__opaque.hash(state);
+ }
+ }
+ }
+}
+
pub const __PTHREAD_MUTEX_SIZE__: usize = 40;
pub const __PTHREAD_COND_SIZE__: usize = 24;
pub const __PTHREAD_CONDATTR_SIZE__: usize = 4;