Skip to content

Commit f908b78

Browse files
tgross35AkhilTThomas
authored andcommitted
Merge pull request rust-lang#3968 from tgross35/backport-asparagus
[0.2] Backports
2 parents ca97836 + 9135c78 commit f908b78

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

src/unix/bsd/apple/b32/mod.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ s_no_extra_traits! {
6767
pub struct max_align_t {
6868
priv_: [f64; 2],
6969
}
70+
71+
pub struct pthread_once_t {
72+
__sig: c_long,
73+
__opaque: [::c_char; ::__PTHREAD_ONCE_SIZE__],
74+
}
7075
}
7176

7277
cfg_if! {
@@ -120,6 +125,29 @@ cfg_if! {
120125
self.__opaque.hash(state);
121126
}
122127
}
128+
impl PartialEq for pthread_once_t {
129+
fn eq(&self, other: &pthread_once_t) -> bool {
130+
self.__sig == other.__sig
131+
&& self.__opaque
132+
.iter()
133+
.zip(other.__opaque.iter())
134+
.all(|(a,b)| a == b)
135+
}
136+
}
137+
impl Eq for pthread_once_t {}
138+
impl ::fmt::Debug for pthread_once_t {
139+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
140+
f.debug_struct("pthread_once_t")
141+
.field("__sig", &self.__sig)
142+
.finish()
143+
}
144+
}
145+
impl ::hash::Hash for pthread_once_t {
146+
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
147+
self.__sig.hash(state);
148+
self.__opaque.hash(state);
149+
}
150+
}
123151
}
124152
}
125153

@@ -148,6 +176,12 @@ pub const PTHREAD_ONCE_INIT: crate::pthread_once_t = crate::pthread_once_t {
148176
__opaque: [0; 4],
149177
};
150178

179+
const _PTHREAD_ONCE_SIG_INIT: c_long = 0x30B1BCBA;
180+
pub const PTHREAD_ONCE_INIT: ::pthread_once_t = ::pthread_once_t {
181+
__sig: _PTHREAD_ONCE_SIG_INIT,
182+
__opaque: [0; 4],
183+
};
184+
151185
extern "C" {
152186
pub fn exchangedata(path1: *const c_char, path2: *const c_char, options: c_ulong) -> c_int;
153187
}

src/unix/bsd/apple/b64/mod.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ s_no_extra_traits! {
6161
__sig: c_long,
6262
__opaque: [c_char; __PTHREAD_ONCE_SIZE__],
6363
}
64+
65+
pub struct pthread_once_t {
66+
__sig: c_long,
67+
__opaque: [::c_char; __PTHREAD_ONCE_SIZE__],
68+
}
6469
}
6570

6671
cfg_if! {
@@ -114,6 +119,29 @@ cfg_if! {
114119
self.__opaque.hash(state);
115120
}
116121
}
122+
impl PartialEq for pthread_once_t {
123+
fn eq(&self, other: &pthread_once_t) -> bool {
124+
self.__sig == other.__sig
125+
&& self.__opaque
126+
.iter()
127+
.zip(other.__opaque.iter())
128+
.all(|(a,b)| a == b)
129+
}
130+
}
131+
impl Eq for pthread_once_t {}
132+
impl ::fmt::Debug for pthread_once_t {
133+
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
134+
f.debug_struct("pthread_once_t")
135+
.field("__sig", &self.__sig)
136+
.finish()
137+
}
138+
}
139+
impl ::hash::Hash for pthread_once_t {
140+
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
141+
self.__sig.hash(state);
142+
self.__opaque.hash(state);
143+
}
144+
}
117145
}
118146
}
119147

@@ -142,6 +170,12 @@ pub const PTHREAD_ONCE_INIT: crate::pthread_once_t = crate::pthread_once_t {
142170
__opaque: [0; 8],
143171
};
144172

173+
const _PTHREAD_ONCE_SIG_INIT: c_long = 0x30B1BCBA;
174+
pub const PTHREAD_ONCE_INIT: ::pthread_once_t = ::pthread_once_t {
175+
__sig: _PTHREAD_ONCE_SIG_INIT,
176+
__opaque: [0; 8],
177+
};
178+
145179
extern "C" {
146180
pub fn exchangedata(path1: *const c_char, path2: *const c_char, options: c_uint) -> c_int;
147181
}

0 commit comments

Comments
 (0)