Skip to content

Commit

Permalink
Use SIGEV_PAD_SIZE in __c_anonymous_sigev_un on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
asomers committed Nov 25, 2024
1 parent af57295 commit c7d713d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/unix/linux_like/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,7 @@ s_no_extra_traits! {
// Can't correctly impl Debug for unions
#[allow(missing_debug_implementations)]
pub union __c_anonymous_sigev_un {
#[cfg(target_pointer_width = "64")]
_pad: [::c_int; (64 - 2 * 4 - 8) / 4],
#[cfg(target_pointer_width = "32")]
_pad: [::c_int; (64 - 2 * 4 - 4) / 4],
_pad: [::c_int; SIGEV_PAD_SIZE],
pub _tid: ::c_int,
pub _sigev_thread: __c_anonymous_sigev_thread,
}
Expand Down Expand Up @@ -576,6 +573,13 @@ pub const SIGPIPE: ::c_int = 13;
pub const SIGALRM: ::c_int = 14;
pub const SIGTERM: ::c_int = 15;

const SIGEV_MAX_SIZE: usize = 64;
#[cfg(target_pointer_width = "64")]
const __ARCH_SIGEV_PREAMBLE_SIZE: usize = 4 * 2 + 8;
#[cfg(target_pointer_width = "32")]
const __ARCH_SIGEV_PREAMBLE_SIZE: usize = 4 * 2 + 4;
const SIGEV_PAD_SIZE: usize = (SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) / 4;

pub const PROT_NONE: ::c_int = 0;
pub const PROT_READ: ::c_int = 1;
pub const PROT_WRITE: ::c_int = 2;
Expand Down

0 comments on commit c7d713d

Please sign in to comment.