From 66f1f32ac22736da9b6592fe498a9f329cef144c Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Thu, 11 May 2023 12:06:53 -0600 Subject: [PATCH] Pad RlctAttr for 32-bit systems --- src/header/bits_pthread/mod.rs | 4 ++-- src/header/pthread/attr.rs | 4 +++- src/header/pthread/mod.rs | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/header/bits_pthread/mod.rs b/src/header/bits_pthread/mod.rs index 7c852a4a0d..af4d166b03 100644 --- a/src/header/bits_pthread/mod.rs +++ b/src/header/bits_pthread/mod.rs @@ -16,7 +16,7 @@ use core::sync::atomic::{AtomicU32 as AtomicUint, AtomicI32 as AtomicInt}; #[repr(C)] pub union pthread_attr_t { __relibc_internal_size: [c_uchar; 32], - __relibc_internal_align: c_long, + __relibc_internal_align: size_t, } #[repr(C)] pub union pthread_rwlockattr_t { @@ -88,7 +88,7 @@ macro_rules! assert_equal_size( #[cfg(all(target_os = "redox", feature = "check_against_libc_crate"))] const _: () = unsafe { let export = $export { __relibc_internal_align: 0 }; - let _: libc::$export = core::mem::transmute(export.__relibc_internal_size); + let _: libc::$export = core::mem::transmute(export.__relibc_internal_size); let a = [0_u8; core::mem::align_of::<$export>()]; let b: [u8; core::mem::align_of::()] = core::mem::transmute(a); diff --git a/src/header/pthread/attr.rs b/src/header/pthread/attr.rs index 481a7c1704..732704f332 100644 --- a/src/header/pthread/attr.rs +++ b/src/header/pthread/attr.rs @@ -22,7 +22,9 @@ impl Default for RlctAttr { param: sched_param { // TODO sched_priority: 0, - } + }, + #[cfg(target_pointer_width = "32")] + _pad: [0; 12], } } } diff --git a/src/header/pthread/mod.rs b/src/header/pthread/mod.rs index afad09fdc8..08e77dfa4d 100644 --- a/src/header/pthread/mod.rs +++ b/src/header/pthread/mod.rs @@ -24,6 +24,8 @@ pub(crate) struct RlctAttr { pub stacksize: size_t, pub stack: size_t, pub param: sched_param, + #[cfg(target_pointer_width = "32")] + _pad: [u8; 12], } pub const PTHREAD_BARRIER_SERIAL_THREAD: c_int = -1;