fix undefined behavior due to incorrect packing on macosx

This commit is contained in:
gnzlbg 2018-04-15 14:45:26 +02:00
parent 28b4d16309
commit dc1956e2ef
2 changed files with 2 additions and 5 deletions

View file

@ -416,9 +416,6 @@ fn main() {
// which is absent in glibc, has to be defined.
"__timeval" if linux => true,
// The alignment of this is 4 on 64-bit OSX...
"kevent" | "shmid_ds" if apple && x86_64 => true,
// This is actually a union, not a struct
"sigval" => true,

View file

@ -245,7 +245,7 @@ s! {
pub f_reserved: [::uint32_t; 8],
}
// FIXME: this should have align 4 but it's got align 8 on 64-bit
#[repr(packed(4))]
pub struct kevent {
pub ident: ::uintptr_t,
pub filter: ::int16_t,
@ -524,7 +524,7 @@ s! {
pub _key: ::key_t,
}
// FIXME: this should have align 4 but it's got align 8 on 64-bit
#[repr(packed(4))]
pub struct shmid_ds {
pub shm_perm: ipc_perm,
pub shm_segsz: ::size_t,