Skip to content

Commit 54aaff5

Browse files
committed
---
yaml --- r: 234815 b: refs/heads/tmp c: 428bb16 h: refs/heads/master i: 234813: c40ed76 234811: 0febeee 234807: 130a21f 234799: bb1e1f7 234783: 09ef606 234751: ab616c5 v: v3
1 parent cd8ffff commit 54aaff5

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: d2e13e822a73e0ea46ae9e21afdd3155fc997f6d
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: 318cd843d1103579291a9f6c9eab8aacce7e9f82
28+
refs/heads/tmp: 428bb164f33951e561a1eed8e636077ad6ce2506
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: ab792abf1fcc28afbd315426213f6428da25c085
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/src/libstd/sys/unix/sync.rs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -254,53 +254,61 @@ mod os {
254254
mod os {
255255
use libc;
256256

257-
// size of the type minus width of the magic int field
257+
// size of the type minus width of the magic and alignment field
258258
#[cfg(target_arch = "x86_64")]
259-
const __PTHREAD_MUTEX_SIZE__: usize = 48 - 4;
259+
const __PTHREAD_MUTEX_SIZE__: usize = 48 - 4 - 8;
260260

261261
#[cfg(target_arch = "x86_64")]
262-
const __PTHREAD_COND_SIZE__: usize = 40 - 4;
262+
const __PTHREAD_MUTEXATTR_SIZE__: usize = 16 - 8; // no magic field
263263

264264
#[cfg(target_arch = "x86_64")]
265-
const __PTHREAD_RWLOCK_SIZE__: usize = 64 - 4;
265+
const __PTHREAD_COND_SIZE__: usize = 40 - 4 - 8;
266+
267+
#[cfg(target_arch = "x86_64")]
268+
const __PTHREAD_RWLOCK_SIZE__: usize = 64 - 4 - 8;
266269

267270
const _PTHREAD_MUTEX_MAGIC_INIT: libc::c_uint = 0x33330003;
268271
const _PTHREAD_COND_MAGIC_INIT: libc::c_uint = 0x55550005;
269272
const _PTHREAD_RWLOCK_MAGIC_INIT: libc::c_uint = 0x99990009;
270273

271-
// note the actual structs are smaller
272-
273-
#[repr(C, packed)]
274+
#[repr(C)]
274275
pub struct pthread_mutex_t {
275276
__magic: libc::c_uint,
276277
__opaque: [u8; __PTHREAD_MUTEX_SIZE__],
278+
__align: libc::c_longlong,
277279
}
278-
#[repr(C, packed)]
280+
#[repr(C)]
279281
pub struct pthread_mutexattr_t {
280-
__opaque: [u8; 16],
282+
__opaque: [u8; __PTHREAD_MUTEXATTR_SIZE__],
283+
__align: libc::c_longlong,
281284
}
282-
#[repr(C, packed)]
285+
#[repr(C)]
283286
pub struct pthread_cond_t {
284287
__magic: libc::c_uint,
285288
__opaque: [u8; __PTHREAD_COND_SIZE__],
289+
__align: libc::c_longlong,
286290
}
287-
#[repr(C, packed)]
291+
#[repr(C)]
288292
pub struct pthread_rwlock_t {
289293
__magic: libc::c_uint,
290294
__opaque: [u8; __PTHREAD_RWLOCK_SIZE__],
295+
__align: libc::c_longlong,
291296
}
292297

293298
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
294299
__magic: _PTHREAD_MUTEX_MAGIC_INIT,
295300
__opaque: [0; __PTHREAD_MUTEX_SIZE__],
301+
__align: 0,
296302
};
297303
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
298304
__magic: _PTHREAD_COND_MAGIC_INIT,
299305
__opaque: [0; __PTHREAD_COND_SIZE__],
306+
__align: 0,
300307
};
301308
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
302309
__magic: _PTHREAD_RWLOCK_MAGIC_INIT,
303310
__opaque: [0; __PTHREAD_RWLOCK_SIZE__],
311+
__align: 0,
304312
};
305313

306314
pub const PTHREAD_MUTEX_RECURSIVE: libc::c_int = 2;

0 commit comments

Comments
 (0)