| 1 |
macro_rules! expand_align { |
| 2 |
() => { |
| 3 |
s! { |
| 4 |
#[cfg_attr( |
| 5 |
any( |
| 6 |
target_pointer_width = "32", |
| 7 |
target_arch = "x86_64" |
| 8 |
), |
| 9 |
repr(align(4)))] |
| 10 |
#[cfg_attr( |
| 11 |
not(any( |
| 12 |
target_pointer_width = "32", |
| 13 |
target_arch = "x86_64" |
| 14 |
)), |
| 15 |
repr(align(8)))] |
| 16 |
pub struct pthread_mutexattr_t { |
| 17 |
size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], |
| 18 |
} |
| 19 |
|
| 20 |
#[cfg_attr(target_pointer_width = "32", |
| 21 |
repr(align(4)))] |
| 22 |
#[cfg_attr(target_pointer_width = "64", |
| 23 |
repr(align(8)))] |
| 24 |
pub struct pthread_rwlockattr_t { |
| 25 |
size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T], |
| 26 |
} |
| 27 |
|
| 28 |
#[repr(align(4))] |
| 29 |
pub struct pthread_condattr_t { |
| 30 |
size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
s_no_extra_traits! { |
| 35 |
#[cfg_attr(all(target_pointer_width = "32", |
| 36 |
any(target_arch = "arm", |
| 37 |
target_arch = "x86_64")), |
| 38 |
repr(align(4)))] |
| 39 |
#[cfg_attr(any(target_pointer_width = "64", |
| 40 |
not(any(target_arch = "arm", |
| 41 |
target_arch = "x86_64"))), |
| 42 |
repr(align(8)))] |
| 43 |
pub struct pthread_mutex_t { |
| 44 |
size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], |
| 45 |
} |
| 46 |
|
| 47 |
#[cfg_attr(all(target_pointer_width = "32", |
| 48 |
any(target_arch = "arm", |
| 49 |
target_arch = "x86_64")), |
| 50 |
repr(align(4)))] |
| 51 |
#[cfg_attr(any(target_pointer_width = "64", |
| 52 |
not(any(target_arch = "arm", |
| 53 |
target_arch = "x86_64"))), |
| 54 |
repr(align(8)))] |
| 55 |
pub struct pthread_rwlock_t { |
| 56 |
size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], |
| 57 |
} |
| 58 |
|
| 59 |
#[cfg_attr(target_pointer_width = "32", |
| 60 |
repr(align(4)))] |
| 61 |
#[cfg_attr(target_pointer_width = "64", |
| 62 |
repr(align(8)))] |
| 63 |
#[cfg_attr(target_arch = "x86", |
| 64 |
repr(align(4)))] |
| 65 |
#[cfg_attr(not(target_arch = "x86"), |
| 66 |
repr(align(8)))] |
| 67 |
pub struct pthread_cond_t { |
| 68 |
size: [u8; ::__SIZEOF_PTHREAD_COND_T], |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
cfg_if! { |
| 73 |
if #[cfg(feature = "extra_traits")] { |
| 74 |
impl PartialEq for pthread_cond_t { |
| 75 |
fn eq(&self, other: &pthread_cond_t) -> bool { |
| 76 |
self.size |
| 77 |
.iter() |
| 78 |
.zip(other.size.iter()) |
| 79 |
.all(|(a,b)| a == b) |
| 80 |
} |
| 81 |
} |
| 82 |
impl Eq for pthread_cond_t {} |
| 83 |
impl ::fmt::Debug for pthread_cond_t { |
| 84 |
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { |
| 85 |
f.debug_struct("pthread_cond_t") |
| 86 |
// FIXME: .field("size", &self.size) |
| 87 |
.finish() |
| 88 |
} |
| 89 |
} |
| 90 |
impl ::hash::Hash for pthread_cond_t { |
| 91 |
fn hash<H: ::hash::Hasher>(&self, state: &mut H) { |
| 92 |
self.size.hash(state); |
| 93 |
} |
| 94 |
} |
| 95 |
|
| 96 |
impl PartialEq for pthread_mutex_t { |
| 97 |
fn eq(&self, other: &pthread_mutex_t) -> bool { |
| 98 |
self.size |
| 99 |
.iter() |
| 100 |
.zip(other.size.iter()) |
| 101 |
.all(|(a,b)| a == b) |
| 102 |
} |
| 103 |
} |
| 104 |
impl Eq for pthread_mutex_t {} |
| 105 |
impl ::fmt::Debug for pthread_mutex_t { |
| 106 |
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { |
| 107 |
f.debug_struct("pthread_mutex_t") |
| 108 |
// FIXME: .field("size", &self.size) |
| 109 |
.finish() |
| 110 |
} |
| 111 |
} |
| 112 |
impl ::hash::Hash for pthread_mutex_t { |
| 113 |
fn hash<H: ::hash::Hasher>(&self, state: &mut H) { |
| 114 |
self.size.hash(state); |
| 115 |
} |
| 116 |
} |
| 117 |
|
| 118 |
impl PartialEq for pthread_rwlock_t { |
| 119 |
fn eq(&self, other: &pthread_rwlock_t) -> bool { |
| 120 |
self.size |
| 121 |
.iter() |
| 122 |
.zip(other.size.iter()) |
| 123 |
.all(|(a,b)| a == b) |
| 124 |
} |
| 125 |
} |
| 126 |
impl Eq for pthread_rwlock_t {} |
| 127 |
impl ::fmt::Debug for pthread_rwlock_t { |
| 128 |
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { |
| 129 |
f.debug_struct("pthread_rwlock_t") |
| 130 |
// FIXME: .field("size", &self.size) |
| 131 |
.finish() |
| 132 |
} |
| 133 |
} |
| 134 |
impl ::hash::Hash for pthread_rwlock_t { |
| 135 |
fn hash<H: ::hash::Hasher>(&self, state: &mut H) { |
| 136 |
self.size.hash(state); |
| 137 |
} |
| 138 |
} |
| 139 |
} |
| 140 |
} |
| 141 |
}; |
| 142 |
} |