From 3e30c8b865b800c720b0666a42d6b3835229738a Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Mon, 11 Jul 2022 20:21:45 -0700 Subject: [PATCH] Require rust >= 1.25 and drop libc_align conditional This is mostly taken from Josh's work at [1], I just updated to account for conflicts and new uses of `libc_align`. [1]: https://github.com/rust-lang/libc/pull/2845 Co-authored-by: Josh Triplett (apply to `main`) (cherry picked from commit b5b553d0ee7de0d4781432a9a9a0a6445dd7f34f) As part of this update, drop the `align` feature from Cargo.toml and libc-test. --- Cargo.toml | 3 +- libc-test/Cargo.toml | 1 - src/fuchsia/align.rs | 142 ------------ src/fuchsia/mod.rs | 140 +++++++++++- src/unix/align.rs | 6 - src/unix/bsd/apple/b32/align.rs | 7 - src/unix/bsd/apple/b32/mod.rs | 9 +- src/unix/bsd/apple/b64/aarch64/align.rs | 47 ---- src/unix/bsd/apple/b64/aarch64/mod.rs | 46 +++- src/unix/bsd/apple/b64/align.rs | 7 - src/unix/bsd/apple/b64/mod.rs | 6 + src/unix/bsd/apple/b64/x86_64/align.rs | 7 - src/unix/bsd/apple/b64/x86_64/mod.rs | 9 +- .../bsd/freebsdlike/freebsd/x86_64/align.rs | 186 ---------------- .../bsd/freebsdlike/freebsd/x86_64/mod.rs | 183 +++++++++++++++- src/unix/linux_like/android/b32/x86/align.rs | 7 - src/unix/linux_like/android/b32/x86/mod.rs | 9 +- .../linux_like/android/b64/aarch64/align.rs | 30 --- .../linux_like/android/b64/aarch64/mod.rs | 31 ++- .../linux_like/android/b64/riscv64/align.rs | 7 - .../linux_like/android/b64/riscv64/mod.rs | 11 +- .../linux_like/android/b64/x86_64/align.rs | 7 - src/unix/linux_like/android/b64/x86_64/mod.rs | 9 +- src/unix/linux_like/android/mod.rs | 2 +- src/unix/linux_like/emscripten/align.rs | 74 ------- src/unix/linux_like/emscripten/mod.rs | 66 +++++- src/unix/linux_like/linux/align.rs | 205 ------------------ src/unix/linux_like/linux/gnu/align.rs | 13 -- .../linux_like/linux/gnu/b32/arm/align.rs | 53 ----- src/unix/linux_like/linux/gnu/b32/arm/mod.rs | 57 ++++- .../linux_like/linux/gnu/b32/csky/align.rs | 7 - src/unix/linux_like/linux/gnu/b32/csky/mod.rs | 11 +- .../linux_like/linux/gnu/b32/m68k/align.rs | 7 - src/unix/linux_like/linux/gnu/b32/m68k/mod.rs | 8 + .../linux_like/linux/gnu/b32/mips/align.rs | 7 - src/unix/linux_like/linux/gnu/b32/mips/mod.rs | 11 +- .../linux_like/linux/gnu/b32/riscv32/align.rs | 44 ---- .../linux_like/linux/gnu/b32/riscv32/mod.rs | 48 +++- .../linux_like/linux/gnu/b32/sparc/align.rs | 7 - .../linux_like/linux/gnu/b32/sparc/mod.rs | 11 +- .../linux_like/linux/gnu/b32/x86/align.rs | 7 - src/unix/linux_like/linux/gnu/b32/x86/mod.rs | 9 +- .../linux_like/linux/gnu/b64/aarch64/align.rs | 51 ----- .../linux_like/linux/gnu/b64/aarch64/mod.rs | 50 ++++- .../linux/gnu/b64/loongarch64/align.rs | 40 ---- .../linux/gnu/b64/loongarch64/mod.rs | 42 +++- .../linux_like/linux/gnu/b64/mips64/align.rs | 7 - .../linux_like/linux/gnu/b64/mips64/mod.rs | 11 +- .../linux/gnu/b64/powerpc64/align.rs | 7 - .../linux_like/linux/gnu/b64/powerpc64/mod.rs | 11 +- .../linux_like/linux/gnu/b64/riscv64/align.rs | 61 ------ .../linux_like/linux/gnu/b64/riscv64/mod.rs | 63 +++++- .../linux_like/linux/gnu/b64/sparc64/align.rs | 7 - .../linux_like/linux/gnu/b64/sparc64/mod.rs | 11 +- .../linux_like/linux/gnu/b64/x86_64/align.rs | 24 -- .../linux_like/linux/gnu/b64/x86_64/mod.rs | 24 +- src/unix/linux_like/linux/gnu/mod.rs | 15 +- src/unix/linux_like/linux/mod.rs | 203 ++++++++++++++++- .../linux_like/linux/musl/b32/arm/align.rs | 7 - src/unix/linux_like/linux/musl/b32/arm/mod.rs | 9 +- .../linux_like/linux/musl/b32/mips/align.rs | 7 - .../linux_like/linux/musl/b32/mips/mod.rs | 11 +- .../linux/musl/b32/riscv32/align.rs | 7 - .../linux_like/linux/musl/b32/riscv32/mod.rs | 11 +- .../linux_like/linux/musl/b32/x86/align.rs | 7 - src/unix/linux_like/linux/musl/b32/x86/mod.rs | 9 +- .../linux/musl/b64/aarch64/align.rs | 42 ---- .../linux_like/linux/musl/b64/aarch64/mod.rs | 44 +++- .../linux/musl/b64/loongarch64/align.rs | 40 ---- .../linux/musl/b64/loongarch64/mod.rs | 46 +++- .../linux/musl/b64/riscv64/align.rs | 61 ------ .../linux_like/linux/musl/b64/riscv64/mod.rs | 63 +++++- .../linux_like/linux/musl/b64/x86_64/align.rs | 25 --- .../linux_like/linux/musl/b64/x86_64/mod.rs | 24 +- src/unix/linux_like/linux/uclibc/align.rs | 28 --- src/unix/linux_like/linux/uclibc/arm/align.rs | 13 -- src/unix/linux_like/linux/uclibc/arm/mod.rs | 15 +- .../linux/uclibc/mips/mips32/align.rs | 13 -- .../linux/uclibc/mips/mips32/mod.rs | 15 +- .../linux/uclibc/mips/mips64/align.rs | 10 - .../linux/uclibc/mips/mips64/mod.rs | 12 +- src/unix/linux_like/linux/uclibc/mod.rs | 23 ++ .../linux_like/linux/uclibc/x86_64/mod.rs | 2 +- src/unix/mod.rs | 9 +- src/unix/newlib/align.rs | 61 ------ src/unix/newlib/mod.rs | 60 ++++- src/windows/gnu/align.rs | 19 -- src/windows/gnu/mod.rs | 23 +- 88 files changed, 1354 insertions(+), 1546 deletions(-) delete mode 100644 src/fuchsia/align.rs delete mode 100644 src/unix/align.rs delete mode 100644 src/unix/bsd/apple/b32/align.rs delete mode 100644 src/unix/bsd/apple/b64/aarch64/align.rs delete mode 100644 src/unix/bsd/apple/b64/align.rs delete mode 100644 src/unix/bsd/apple/b64/x86_64/align.rs delete mode 100644 src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs delete mode 100644 src/unix/linux_like/android/b32/x86/align.rs delete mode 100644 src/unix/linux_like/android/b64/aarch64/align.rs delete mode 100644 src/unix/linux_like/android/b64/riscv64/align.rs delete mode 100644 src/unix/linux_like/android/b64/x86_64/align.rs delete mode 100644 src/unix/linux_like/emscripten/align.rs delete mode 100644 src/unix/linux_like/linux/align.rs delete mode 100644 src/unix/linux_like/linux/gnu/align.rs delete mode 100644 src/unix/linux_like/linux/gnu/b32/arm/align.rs delete mode 100644 src/unix/linux_like/linux/gnu/b32/csky/align.rs delete mode 100644 src/unix/linux_like/linux/gnu/b32/m68k/align.rs delete mode 100644 src/unix/linux_like/linux/gnu/b32/mips/align.rs delete mode 100644 src/unix/linux_like/linux/gnu/b32/riscv32/align.rs delete mode 100644 src/unix/linux_like/linux/gnu/b32/sparc/align.rs delete mode 100644 src/unix/linux_like/linux/gnu/b32/x86/align.rs delete mode 100644 src/unix/linux_like/linux/gnu/b64/aarch64/align.rs delete mode 100644 src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs delete mode 100644 src/unix/linux_like/linux/gnu/b64/mips64/align.rs delete mode 100644 src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs delete mode 100644 src/unix/linux_like/linux/gnu/b64/riscv64/align.rs delete mode 100644 src/unix/linux_like/linux/gnu/b64/sparc64/align.rs delete mode 100644 src/unix/linux_like/linux/gnu/b64/x86_64/align.rs delete mode 100644 src/unix/linux_like/linux/musl/b32/arm/align.rs delete mode 100644 src/unix/linux_like/linux/musl/b32/mips/align.rs delete mode 100644 src/unix/linux_like/linux/musl/b32/riscv32/align.rs delete mode 100644 src/unix/linux_like/linux/musl/b32/x86/align.rs delete mode 100644 src/unix/linux_like/linux/musl/b64/aarch64/align.rs delete mode 100644 src/unix/linux_like/linux/musl/b64/loongarch64/align.rs delete mode 100644 src/unix/linux_like/linux/musl/b64/riscv64/align.rs delete mode 100644 src/unix/linux_like/linux/musl/b64/x86_64/align.rs delete mode 100644 src/unix/linux_like/linux/uclibc/align.rs delete mode 100644 src/unix/linux_like/linux/uclibc/arm/align.rs delete mode 100644 src/unix/linux_like/linux/uclibc/mips/mips32/align.rs delete mode 100644 src/unix/linux_like/linux/uclibc/mips/mips64/align.rs delete mode 100644 src/unix/newlib/align.rs delete mode 100644 src/windows/gnu/align.rs diff --git a/Cargo.toml b/Cargo.toml index 48488b42ba31d..a707e9b74de8d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -139,8 +139,7 @@ rustc-std-workspace-core = { version = "1.0.0", optional = true } [features] default = ["std"] std = [] -align = [] -rustc-dep-of-std = ['align', 'rustc-std-workspace-core'] +rustc-dep-of-std = ["rustc-std-workspace-core"] extra_traits = [] const-extern-fn = [] diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml index 883dc3d43d8e9..6a92569f8101d 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -24,7 +24,6 @@ ctest2 = "0.4.3" [features] default = ["std"] std = ["libc/std"] -align = ["libc/align"] extra_traits = ["libc/extra_traits"] [[test]] diff --git a/src/fuchsia/align.rs b/src/fuchsia/align.rs deleted file mode 100644 index 3409bf0c61955..0000000000000 --- a/src/fuchsia/align.rs +++ /dev/null @@ -1,142 +0,0 @@ -macro_rules! expand_align { - () => { - s! { - #[cfg_attr( - any( - target_pointer_width = "32", - target_arch = "x86_64" - ), - repr(align(4)))] - #[cfg_attr( - not(any( - target_pointer_width = "32", - target_arch = "x86_64" - )), - repr(align(8)))] - pub struct pthread_mutexattr_t { - size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], - } - - #[cfg_attr(target_pointer_width = "32", - repr(align(4)))] - #[cfg_attr(target_pointer_width = "64", - repr(align(8)))] - pub struct pthread_rwlockattr_t { - size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T], - } - - #[repr(align(4))] - pub struct pthread_condattr_t { - size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], - } - } - - s_no_extra_traits! { - #[cfg_attr(all(target_pointer_width = "32", - any(target_arch = "arm", - target_arch = "x86_64")), - repr(align(4)))] - #[cfg_attr(any(target_pointer_width = "64", - not(any(target_arch = "arm", - target_arch = "x86_64"))), - repr(align(8)))] - pub struct pthread_mutex_t { - size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], - } - - #[cfg_attr(all(target_pointer_width = "32", - any(target_arch = "arm", - target_arch = "x86_64")), - repr(align(4)))] - #[cfg_attr(any(target_pointer_width = "64", - not(any(target_arch = "arm", - target_arch = "x86_64"))), - repr(align(8)))] - pub struct pthread_rwlock_t { - size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], - } - - #[cfg_attr(target_pointer_width = "32", - repr(align(4)))] - #[cfg_attr(target_pointer_width = "64", - repr(align(8)))] - #[cfg_attr(target_arch = "x86", - repr(align(4)))] - #[cfg_attr(not(target_arch = "x86"), - repr(align(8)))] - pub struct pthread_cond_t { - size: [u8; ::__SIZEOF_PTHREAD_COND_T], - } - } - - cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for pthread_cond_t { - fn eq(&self, other: &pthread_cond_t) -> bool { - self.size - .iter() - .zip(other.size.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for pthread_cond_t {} - impl ::fmt::Debug for pthread_cond_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_cond_t") - // FIXME: .field("size", &self.size) - .finish() - } - } - impl ::hash::Hash for pthread_cond_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - - impl PartialEq for pthread_mutex_t { - fn eq(&self, other: &pthread_mutex_t) -> bool { - self.size - .iter() - .zip(other.size.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for pthread_mutex_t {} - impl ::fmt::Debug for pthread_mutex_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_mutex_t") - // FIXME: .field("size", &self.size) - .finish() - } - } - impl ::hash::Hash for pthread_mutex_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - - impl PartialEq for pthread_rwlock_t { - fn eq(&self, other: &pthread_rwlock_t) -> bool { - self.size - .iter() - .zip(other.size.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for pthread_rwlock_t {} - impl ::fmt::Debug for pthread_rwlock_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_rwlock_t") - // FIXME: .field("size", &self.size) - .finish() - } - } - impl ::hash::Hash for pthread_rwlock_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - } - } - }; -} diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index bf4250c974106..c7ad35bc1f455 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -697,7 +697,7 @@ s! { pub direction: ::__u16, pub trigger: ff_trigger, pub replay: ff_replay, - // FIXME this is actually a union + // FIXME(1.0): this is actually a union #[cfg(target_pointer_width = "64")] pub u: [u64; 4], #[cfg(target_pointer_width = "32")] @@ -882,6 +882,35 @@ s! { pub ipi6_addr: ::in6_addr, pub ipi6_ifindex: ::c_uint, } + + #[cfg_attr( + any( + target_pointer_width = "32", + target_arch = "x86_64" + ), + repr(align(4)))] + #[cfg_attr( + not(any( + target_pointer_width = "32", + target_arch = "x86_64" + )), + repr(align(8)))] + pub struct pthread_mutexattr_t { + size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], + } + + #[cfg_attr(target_pointer_width = "32", + repr(align(4)))] + #[cfg_attr(target_pointer_width = "64", + repr(align(8)))] + pub struct pthread_rwlockattr_t { + size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T], + } + + #[repr(align(4))] + pub struct pthread_condattr_t { + size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], + } } s_no_extra_traits! { @@ -979,6 +1008,42 @@ s_no_extra_traits! { pub sigev_notify_attributes: *mut pthread_attr_t, pub __pad: [::c_char; 56 - 3 * 8 /* 8 == sizeof(long) */], } + + #[cfg_attr(all(target_pointer_width = "32", + any(target_arch = "arm", + target_arch = "x86_64")), + repr(align(4)))] + #[cfg_attr(any(target_pointer_width = "64", + not(any(target_arch = "arm", + target_arch = "x86_64"))), + repr(align(8)))] + pub struct pthread_mutex_t { + size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], + } + + #[cfg_attr(all(target_pointer_width = "32", + any(target_arch = "arm", + target_arch = "x86_64")), + repr(align(4)))] + #[cfg_attr(any(target_pointer_width = "64", + not(any(target_arch = "arm", + target_arch = "x86_64"))), + repr(align(8)))] + pub struct pthread_rwlock_t { + size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], + } + + #[cfg_attr(target_pointer_width = "32", + repr(align(4)))] + #[cfg_attr(target_pointer_width = "64", + repr(align(8)))] + #[cfg_attr(target_arch = "x86", + repr(align(4)))] + #[cfg_attr(not(target_arch = "x86"), + repr(align(8)))] + pub struct pthread_cond_t { + size: [u8; ::__SIZEOF_PTHREAD_COND_T], + } } cfg_if! { @@ -1306,6 +1371,72 @@ cfg_if! { self.sigev_notify_attributes.hash(state); } } + + impl PartialEq for pthread_cond_t { + fn eq(&self, other: &pthread_cond_t) -> bool { + self.size + .iter() + .zip(other.size.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for pthread_cond_t {} + impl ::fmt::Debug for pthread_cond_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("pthread_cond_t") + // FIXME: .field("size", &self.size) + .finish() + } + } + impl ::hash::Hash for pthread_cond_t { + fn hash(&self, state: &mut H) { + self.size.hash(state); + } + } + + impl PartialEq for pthread_mutex_t { + fn eq(&self, other: &pthread_mutex_t) -> bool { + self.size + .iter() + .zip(other.size.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for pthread_mutex_t {} + impl ::fmt::Debug for pthread_mutex_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("pthread_mutex_t") + // FIXME: .field("size", &self.size) + .finish() + } + } + impl ::hash::Hash for pthread_mutex_t { + fn hash(&self, state: &mut H) { + self.size.hash(state); + } + } + + impl PartialEq for pthread_rwlock_t { + fn eq(&self, other: &pthread_rwlock_t) -> bool { + self.size + .iter() + .zip(other.size.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for pthread_rwlock_t {} + impl ::fmt::Debug for pthread_rwlock_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("pthread_rwlock_t") + // FIXME: .field("size", &self.size) + .finish() + } + } + impl ::hash::Hash for pthread_rwlock_t { + fn hash(&self, state: &mut H) { + self.size.hash(state); + } + } } } @@ -4355,10 +4486,3 @@ cfg_if! { // Unknown target_arch } } - -#[macro_use] -mod align; - -expand_align!(); - -pub use ffi::c_void; diff --git a/src/unix/align.rs b/src/unix/align.rs deleted file mode 100644 index 4fdba9a6aba69..0000000000000 --- a/src/unix/align.rs +++ /dev/null @@ -1,6 +0,0 @@ -s! { - #[repr(align(4))] - pub struct in6_addr { - pub s6_addr: [u8; 16], - } -} diff --git a/src/unix/bsd/apple/b32/align.rs b/src/unix/bsd/apple/b32/align.rs deleted file mode 100644 index ca1fe1ce29944..0000000000000 --- a/src/unix/bsd/apple/b32/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f64; 2] - } -} diff --git a/src/unix/bsd/apple/b32/mod.rs b/src/unix/bsd/apple/b32/mod.rs index c28ad931b4c3c..a340b0f1350ab 100644 --- a/src/unix/bsd/apple/b32/mod.rs +++ b/src/unix/bsd/apple/b32/mod.rs @@ -59,6 +59,12 @@ s_no_extra_traits! { __sig: c_long, __opaque: [::c_char; ::__PTHREAD_ONCE_SIZE__], } + + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f64; 2] + } } cfg_if! { @@ -145,6 +151,3 @@ extern "C" { options: ::c_ulong, ) -> ::c_int; } - -mod align; -pub use self::align::*; diff --git a/src/unix/bsd/apple/b64/aarch64/align.rs b/src/unix/bsd/apple/b64/aarch64/align.rs deleted file mode 100644 index 7f86a134649cf..0000000000000 --- a/src/unix/bsd/apple/b64/aarch64/align.rs +++ /dev/null @@ -1,47 +0,0 @@ -pub type mcontext_t = *mut __darwin_mcontext64; - -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - pub struct max_align_t { - priv_: f64 - } -} - -s! { - pub struct ucontext_t { - pub uc_onstack: ::c_int, - pub uc_sigmask: ::sigset_t, - pub uc_stack: ::stack_t, - pub uc_link: *mut ::ucontext_t, - pub uc_mcsize: usize, - pub uc_mcontext: mcontext_t, - } - - pub struct __darwin_mcontext64 { - pub __es: __darwin_arm_exception_state64, - pub __ss: __darwin_arm_thread_state64, - pub __ns: __darwin_arm_neon_state64, - } - - pub struct __darwin_arm_exception_state64 { - pub __far: u64, - pub __esr: u32, - pub __exception: u32, - } - - pub struct __darwin_arm_thread_state64 { - pub __x: [u64; 29], - pub __fp: u64, - pub __lr: u64, - pub __sp: u64, - pub __pc: u64, - pub __cpsr: u32, - pub __pad: u32, - } - - pub struct __darwin_arm_neon_state64 { - pub __v: [::__uint128_t; 32], - pub __fpsr: u32, - pub __fpcr: u32, - } -} diff --git a/src/unix/bsd/apple/b64/aarch64/mod.rs b/src/unix/bsd/apple/b64/aarch64/mod.rs index a32abf17008fd..ce34e78c87ca7 100644 --- a/src/unix/bsd/apple/b64/aarch64/mod.rs +++ b/src/unix/bsd/apple/b64/aarch64/mod.rs @@ -1,10 +1,52 @@ pub type boolean_t = ::c_int; +pub type mcontext_t = *mut __darwin_mcontext64; s! { pub struct malloc_zone_t { __private: [::uintptr_t; 18], // FIXME: needs arm64 auth pointers support } + + pub struct ucontext_t { + pub uc_onstack: ::c_int, + pub uc_sigmask: ::sigset_t, + pub uc_stack: ::stack_t, + pub uc_link: *mut ::ucontext_t, + pub uc_mcsize: usize, + pub uc_mcontext: mcontext_t, + } + + pub struct __darwin_mcontext64 { + pub __es: __darwin_arm_exception_state64, + pub __ss: __darwin_arm_thread_state64, + pub __ns: __darwin_arm_neon_state64, + } + + pub struct __darwin_arm_exception_state64 { + pub __far: u64, + pub __esr: u32, + pub __exception: u32, + } + + pub struct __darwin_arm_thread_state64 { + pub __x: [u64; 29], + pub __fp: u64, + pub __lr: u64, + pub __sp: u64, + pub __pc: u64, + pub __cpsr: u32, + pub __pad: u32, + } + + pub struct __darwin_arm_neon_state64 { + pub __v: [::__uint128_t; 32], + pub __fpsr: u32, + pub __fpcr: u32, + } } -mod align; -pub use self::align::*; +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + pub struct max_align_t { + priv_: f64 + } +} diff --git a/src/unix/bsd/apple/b64/align.rs b/src/unix/bsd/apple/b64/align.rs deleted file mode 100644 index ca1fe1ce29944..0000000000000 --- a/src/unix/bsd/apple/b64/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f64; 2] - } -} diff --git a/src/unix/bsd/apple/b64/mod.rs b/src/unix/bsd/apple/b64/mod.rs index 2206210da5575..88bc3aabdfca6 100644 --- a/src/unix/bsd/apple/b64/mod.rs +++ b/src/unix/bsd/apple/b64/mod.rs @@ -59,6 +59,12 @@ s_no_extra_traits! { __sig: c_long, __opaque: [::c_char; __PTHREAD_ONCE_SIZE__], } + + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f64; 2] + } } cfg_if! { diff --git a/src/unix/bsd/apple/b64/x86_64/align.rs b/src/unix/bsd/apple/b64/x86_64/align.rs deleted file mode 100644 index ca1fe1ce29944..0000000000000 --- a/src/unix/bsd/apple/b64/x86_64/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f64; 2] - } -} diff --git a/src/unix/bsd/apple/b64/x86_64/mod.rs b/src/unix/bsd/apple/b64/x86_64/mod.rs index a15d6cfe47c31..a613ccb389e45 100644 --- a/src/unix/bsd/apple/b64/x86_64/mod.rs +++ b/src/unix/bsd/apple/b64/x86_64/mod.rs @@ -172,5 +172,10 @@ s! { } } -mod align; -pub use self::align::*; +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f64; 2] + } +} diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs deleted file mode 100644 index 208e7f2c90c0a..0000000000000 --- a/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs +++ /dev/null @@ -1,186 +0,0 @@ -use {c_long, register_t}; - -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f64; 4] - } - - #[repr(align(16))] - pub struct mcontext_t { - pub mc_onstack: register_t, - pub mc_rdi: register_t, - pub mc_rsi: register_t, - pub mc_rdx: register_t, - pub mc_rcx: register_t, - pub mc_r8: register_t, - pub mc_r9: register_t, - pub mc_rax: register_t, - pub mc_rbx: register_t, - pub mc_rbp: register_t, - pub mc_r10: register_t, - pub mc_r11: register_t, - pub mc_r12: register_t, - pub mc_r13: register_t, - pub mc_r14: register_t, - pub mc_r15: register_t, - pub mc_trapno: u32, - pub mc_fs: u16, - pub mc_gs: u16, - pub mc_addr: register_t, - pub mc_flags: u32, - pub mc_es: u16, - pub mc_ds: u16, - pub mc_err: register_t, - pub mc_rip: register_t, - pub mc_cs: register_t, - pub mc_rflags: register_t, - pub mc_rsp: register_t, - pub mc_ss: register_t, - pub mc_len: c_long, - pub mc_fpformat: c_long, - pub mc_ownedfp: c_long, - pub mc_fpstate: [c_long; 64], - pub mc_fsbase: register_t, - pub mc_gsbase: register_t, - pub mc_xfpustate: register_t, - pub mc_xfpustate_len: register_t, - pub mc_spare: [c_long; 4], - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for mcontext_t { - fn eq(&self, other: &mcontext_t) -> bool { - self.mc_onstack == other.mc_onstack && - self.mc_rdi == other.mc_rdi && - self.mc_rsi == other.mc_rsi && - self.mc_rdx == other.mc_rdx && - self.mc_rcx == other.mc_rcx && - self.mc_r8 == other.mc_r8 && - self.mc_r9 == other.mc_r9 && - self.mc_rax == other.mc_rax && - self.mc_rbx == other.mc_rbx && - self.mc_rbp == other.mc_rbp && - self.mc_r10 == other.mc_r10 && - self.mc_r11 == other.mc_r11 && - self.mc_r12 == other.mc_r12 && - self.mc_r13 == other.mc_r13 && - self.mc_r14 == other.mc_r14 && - self.mc_r15 == other.mc_r15 && - self.mc_trapno == other.mc_trapno && - self.mc_fs == other.mc_fs && - self.mc_gs == other.mc_gs && - self.mc_addr == other.mc_addr && - self.mc_flags == other.mc_flags && - self.mc_es == other.mc_es && - self.mc_ds == other.mc_ds && - self.mc_err == other.mc_err && - self.mc_rip == other.mc_rip && - self.mc_cs == other.mc_cs && - self.mc_rflags == other.mc_rflags && - self.mc_rsp == other.mc_rsp && - self.mc_ss == other.mc_ss && - self.mc_len == other.mc_len && - self.mc_fpformat == other.mc_fpformat && - self.mc_ownedfp == other.mc_ownedfp && - self.mc_fpstate.iter().zip(other.mc_fpstate.iter()) - .all(|(a, b)| a == b) && - self.mc_fsbase == other.mc_fsbase && - self.mc_gsbase == other.mc_gsbase && - self.mc_xfpustate == other.mc_xfpustate && - self.mc_xfpustate_len == other.mc_xfpustate_len && - self.mc_spare == other.mc_spare - } - } - impl Eq for mcontext_t {} - impl ::fmt::Debug for mcontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("mcontext_t") - .field("mc_onstack", &self.mc_onstack) - .field("mc_rdi", &self.mc_rdi) - .field("mc_rsi", &self.mc_rsi) - .field("mc_rdx", &self.mc_rdx) - .field("mc_rcx", &self.mc_rcx) - .field("mc_r8", &self.mc_r8) - .field("mc_r9", &self.mc_r9) - .field("mc_rax", &self.mc_rax) - .field("mc_rbx", &self.mc_rbx) - .field("mc_rbp", &self.mc_rbp) - .field("mc_r10", &self.mc_r10) - .field("mc_r11", &self.mc_r11) - .field("mc_r12", &self.mc_r12) - .field("mc_r13", &self.mc_r13) - .field("mc_r14", &self.mc_r14) - .field("mc_r15", &self.mc_r15) - .field("mc_trapno", &self.mc_trapno) - .field("mc_fs", &self.mc_fs) - .field("mc_gs", &self.mc_gs) - .field("mc_addr", &self.mc_addr) - .field("mc_flags", &self.mc_flags) - .field("mc_es", &self.mc_es) - .field("mc_ds", &self.mc_ds) - .field("mc_err", &self.mc_err) - .field("mc_rip", &self.mc_rip) - .field("mc_cs", &self.mc_cs) - .field("mc_rflags", &self.mc_rflags) - .field("mc_rsp", &self.mc_rsp) - .field("mc_ss", &self.mc_ss) - .field("mc_len", &self.mc_len) - .field("mc_fpformat", &self.mc_fpformat) - .field("mc_ownedfp", &self.mc_ownedfp) - // FIXME: .field("mc_fpstate", &self.mc_fpstate) - .field("mc_fsbase", &self.mc_fsbase) - .field("mc_gsbase", &self.mc_gsbase) - .field("mc_xfpustate", &self.mc_xfpustate) - .field("mc_xfpustate_len", &self.mc_xfpustate_len) - .field("mc_spare", &self.mc_spare) - .finish() - } - } - impl ::hash::Hash for mcontext_t { - fn hash(&self, state: &mut H) { - self.mc_onstack.hash(state); - self.mc_rdi.hash(state); - self.mc_rsi.hash(state); - self.mc_rdx.hash(state); - self.mc_rcx.hash(state); - self.mc_r8.hash(state); - self.mc_r9.hash(state); - self.mc_rax.hash(state); - self.mc_rbx.hash(state); - self.mc_rbp.hash(state); - self.mc_r10.hash(state); - self.mc_r11.hash(state); - self.mc_r12.hash(state); - self.mc_r13.hash(state); - self.mc_r14.hash(state); - self.mc_r15.hash(state); - self.mc_trapno.hash(state); - self.mc_fs.hash(state); - self.mc_gs.hash(state); - self.mc_addr.hash(state); - self.mc_flags.hash(state); - self.mc_es.hash(state); - self.mc_ds.hash(state); - self.mc_err.hash(state); - self.mc_rip.hash(state); - self.mc_cs.hash(state); - self.mc_rflags.hash(state); - self.mc_rsp.hash(state); - self.mc_ss.hash(state); - self.mc_len.hash(state); - self.mc_fpformat.hash(state); - self.mc_ownedfp.hash(state); - self.mc_fpstate.hash(state); - self.mc_fsbase.hash(state); - self.mc_gsbase.hash(state); - self.mc_xfpustate.hash(state); - self.mc_xfpustate_len.hash(state); - self.mc_spare.hash(state); - } - } - } -} diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs index 4ff9469086cb6..1e61db61c7cd3 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs @@ -92,6 +92,54 @@ s_no_extra_traits! { pub a_type: ::c_long, pub a_un: __c_anonymous_elf64_auxv_union, } + + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f64; 4] + } + + #[repr(align(16))] + pub struct mcontext_t { + pub mc_onstack: register_t, + pub mc_rdi: register_t, + pub mc_rsi: register_t, + pub mc_rdx: register_t, + pub mc_rcx: register_t, + pub mc_r8: register_t, + pub mc_r9: register_t, + pub mc_rax: register_t, + pub mc_rbx: register_t, + pub mc_rbp: register_t, + pub mc_r10: register_t, + pub mc_r11: register_t, + pub mc_r12: register_t, + pub mc_r13: register_t, + pub mc_r14: register_t, + pub mc_r15: register_t, + pub mc_trapno: u32, + pub mc_fs: u16, + pub mc_gs: u16, + pub mc_addr: register_t, + pub mc_flags: u32, + pub mc_es: u16, + pub mc_ds: u16, + pub mc_err: register_t, + pub mc_rip: register_t, + pub mc_cs: register_t, + pub mc_rflags: register_t, + pub mc_rsp: register_t, + pub mc_ss: register_t, + pub mc_len: c_long, + pub mc_fpformat: c_long, + pub mc_ownedfp: c_long, + pub mc_fpstate: [c_long; 64], + pub mc_fsbase: register_t, + pub mc_gsbase: register_t, + pub mc_xfpustate: register_t, + pub mc_xfpustate_len: register_t, + pub mc_spare: [c_long; 4], + } } cfg_if! { @@ -216,6 +264,138 @@ cfg_if! { .finish() } } + + + impl PartialEq for mcontext_t { + fn eq(&self, other: &mcontext_t) -> bool { + self.mc_onstack == other.mc_onstack && + self.mc_rdi == other.mc_rdi && + self.mc_rsi == other.mc_rsi && + self.mc_rdx == other.mc_rdx && + self.mc_rcx == other.mc_rcx && + self.mc_r8 == other.mc_r8 && + self.mc_r9 == other.mc_r9 && + self.mc_rax == other.mc_rax && + self.mc_rbx == other.mc_rbx && + self.mc_rbp == other.mc_rbp && + self.mc_r10 == other.mc_r10 && + self.mc_r11 == other.mc_r11 && + self.mc_r12 == other.mc_r12 && + self.mc_r13 == other.mc_r13 && + self.mc_r14 == other.mc_r14 && + self.mc_r15 == other.mc_r15 && + self.mc_trapno == other.mc_trapno && + self.mc_fs == other.mc_fs && + self.mc_gs == other.mc_gs && + self.mc_addr == other.mc_addr && + self.mc_flags == other.mc_flags && + self.mc_es == other.mc_es && + self.mc_ds == other.mc_ds && + self.mc_err == other.mc_err && + self.mc_rip == other.mc_rip && + self.mc_cs == other.mc_cs && + self.mc_rflags == other.mc_rflags && + self.mc_rsp == other.mc_rsp && + self.mc_ss == other.mc_ss && + self.mc_len == other.mc_len && + self.mc_fpformat == other.mc_fpformat && + self.mc_ownedfp == other.mc_ownedfp && + self.mc_fpstate.iter().zip(other.mc_fpstate.iter()) + .all(|(a, b)| a == b) && + self.mc_fsbase == other.mc_fsbase && + self.mc_gsbase == other.mc_gsbase && + self.mc_xfpustate == other.mc_xfpustate && + self.mc_xfpustate_len == other.mc_xfpustate_len && + self.mc_spare == other.mc_spare + } + } + impl Eq for mcontext_t {} + impl ::fmt::Debug for mcontext_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("mcontext_t") + .field("mc_onstack", &self.mc_onstack) + .field("mc_rdi", &self.mc_rdi) + .field("mc_rsi", &self.mc_rsi) + .field("mc_rdx", &self.mc_rdx) + .field("mc_rcx", &self.mc_rcx) + .field("mc_r8", &self.mc_r8) + .field("mc_r9", &self.mc_r9) + .field("mc_rax", &self.mc_rax) + .field("mc_rbx", &self.mc_rbx) + .field("mc_rbp", &self.mc_rbp) + .field("mc_r10", &self.mc_r10) + .field("mc_r11", &self.mc_r11) + .field("mc_r12", &self.mc_r12) + .field("mc_r13", &self.mc_r13) + .field("mc_r14", &self.mc_r14) + .field("mc_r15", &self.mc_r15) + .field("mc_trapno", &self.mc_trapno) + .field("mc_fs", &self.mc_fs) + .field("mc_gs", &self.mc_gs) + .field("mc_addr", &self.mc_addr) + .field("mc_flags", &self.mc_flags) + .field("mc_es", &self.mc_es) + .field("mc_ds", &self.mc_ds) + .field("mc_err", &self.mc_err) + .field("mc_rip", &self.mc_rip) + .field("mc_cs", &self.mc_cs) + .field("mc_rflags", &self.mc_rflags) + .field("mc_rsp", &self.mc_rsp) + .field("mc_ss", &self.mc_ss) + .field("mc_len", &self.mc_len) + .field("mc_fpformat", &self.mc_fpformat) + .field("mc_ownedfp", &self.mc_ownedfp) + // FIXME: .field("mc_fpstate", &self.mc_fpstate) + .field("mc_fsbase", &self.mc_fsbase) + .field("mc_gsbase", &self.mc_gsbase) + .field("mc_xfpustate", &self.mc_xfpustate) + .field("mc_xfpustate_len", &self.mc_xfpustate_len) + .field("mc_spare", &self.mc_spare) + .finish() + } + } + impl ::hash::Hash for mcontext_t { + fn hash(&self, state: &mut H) { + self.mc_onstack.hash(state); + self.mc_rdi.hash(state); + self.mc_rsi.hash(state); + self.mc_rdx.hash(state); + self.mc_rcx.hash(state); + self.mc_r8.hash(state); + self.mc_r9.hash(state); + self.mc_rax.hash(state); + self.mc_rbx.hash(state); + self.mc_rbp.hash(state); + self.mc_r10.hash(state); + self.mc_r11.hash(state); + self.mc_r12.hash(state); + self.mc_r13.hash(state); + self.mc_r14.hash(state); + self.mc_r15.hash(state); + self.mc_trapno.hash(state); + self.mc_fs.hash(state); + self.mc_gs.hash(state); + self.mc_addr.hash(state); + self.mc_flags.hash(state); + self.mc_es.hash(state); + self.mc_ds.hash(state); + self.mc_err.hash(state); + self.mc_rip.hash(state); + self.mc_cs.hash(state); + self.mc_rflags.hash(state); + self.mc_rsp.hash(state); + self.mc_ss.hash(state); + self.mc_len.hash(state); + self.mc_fpformat.hash(state); + self.mc_ownedfp.hash(state); + self.mc_fpstate.hash(state); + self.mc_fsbase.hash(state); + self.mc_gsbase.hash(state); + self.mc_xfpustate.hash(state); + self.mc_xfpustate_len.hash(state); + self.mc_spare.hash(state); + } + } } } @@ -241,6 +421,3 @@ pub const _MC_FPOWNED_PCB: c_long = 0x20002; pub const KINFO_FILE_SIZE: ::c_int = 1392; pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459; - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/android/b32/x86/align.rs b/src/unix/linux_like/android/b32/x86/align.rs deleted file mode 100644 index 04df4a05d19b7..0000000000000 --- a/src/unix/linux_like/android/b32/x86/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(8))] - pub struct max_align_t { - priv_: [f64; 2] - } -} diff --git a/src/unix/linux_like/android/b32/x86/mod.rs b/src/unix/linux_like/android/b32/x86/mod.rs index 2ec6093f488d6..902016fda3ec8 100644 --- a/src/unix/linux_like/android/b32/x86/mod.rs +++ b/src/unix/linux_like/android/b32/x86/mod.rs @@ -49,6 +49,12 @@ s_no_extra_traits! { __padding_rt_sigset: u32, __fpregs_mem: _libc_fpstate, } + + #[allow(missing_debug_implementations)] + #[repr(align(8))] + pub struct max_align_t { + priv_: [f64; 2] + } } cfg_if! { @@ -631,6 +637,3 @@ f! { ::syscall(SYS_socketcall, SYS_ACCEPT4, args[..].as_mut_ptr()) } } - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/android/b64/aarch64/align.rs b/src/unix/linux_like/android/b64/aarch64/align.rs deleted file mode 100644 index 6891c14e90fa0..0000000000000 --- a/src/unix/linux_like/android/b64/aarch64/align.rs +++ /dev/null @@ -1,30 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f32; 8] - } -} - -s! { - pub struct ucontext_t { - pub uc_flags: ::c_ulong, - pub uc_link: *mut ucontext_t, - pub uc_stack: ::stack_t, - pub uc_sigmask: ::sigset_t, - pub __pad: [u8; 1024 / 8 - core::mem::size_of::<::sigset_t>()], - pub uc_mcontext: mcontext_t, - } - - #[repr(align(16))] - pub struct mcontext_t { - pub fault_address: ::c_ulonglong, - pub regs: [::c_ulonglong; 31], - pub sp: ::c_ulonglong, - pub pc: ::c_ulonglong, - pub pstate: ::c_ulonglong, - // nested arrays to get the right size/length while being able to - // auto-derive traits like Debug - __reserved: [[u64; 32]; 16], - } -} diff --git a/src/unix/linux_like/android/b64/aarch64/mod.rs b/src/unix/linux_like/android/b64/aarch64/mod.rs index 718bf779bb908..6fdcca6fe1b1b 100644 --- a/src/unix/linux_like/android/b64/aarch64/mod.rs +++ b/src/unix/linux_like/android/b64/aarch64/mod.rs @@ -56,6 +56,34 @@ s! { pub pc: u64, pub pstate: u64, } + + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_sigmask: ::sigset_t, + pub uc_mcontext: mcontext_t, + } + + #[repr(align(16))] + pub struct mcontext_t { + pub fault_address: ::c_ulonglong, + pub regs: [::c_ulonglong; 31], + pub sp: ::c_ulonglong, + pub pc: ::c_ulonglong, + pub pstate: ::c_ulonglong, + // nested arrays to get the right size/length while being able to + // auto-derive traits like Debug + __reserved: [[u64; 32]; 16], + } +} + +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f32; 8] + } } pub const O_DIRECT: ::c_int = 0x10000; @@ -439,8 +467,5 @@ pub const PROT_MTE: ::c_int = 0x20; pub const AT_SYSINFO_EHDR: ::c_ulong = 33; pub const AT_VECTOR_SIZE_ARCH: ::c_ulong = 2; -mod align; -pub use self::align::*; - mod int128; pub use self::int128::*; diff --git a/src/unix/linux_like/android/b64/riscv64/align.rs b/src/unix/linux_like/android/b64/riscv64/align.rs deleted file mode 100644 index 8e949963a637f..0000000000000 --- a/src/unix/linux_like/android/b64/riscv64/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f32; 8] - } -} diff --git a/src/unix/linux_like/android/b64/riscv64/mod.rs b/src/unix/linux_like/android/b64/riscv64/mod.rs index bf4c8988fae93..82a3aa62f51a5 100644 --- a/src/unix/linux_like/android/b64/riscv64/mod.rs +++ b/src/unix/linux_like/android/b64/riscv64/mod.rs @@ -52,6 +52,14 @@ s! { } } +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f32; 8] + } +} + pub const O_DIRECT: ::c_int = 0x40000; pub const O_DIRECTORY: ::c_int = 0x200000; pub const O_NOFOLLOW: ::c_int = 0x400000; @@ -373,6 +381,3 @@ pub const AT_L2_CACHEGEOMETRY: ::c_ulong = 45; pub const AT_L3_CACHESIZE: ::c_ulong = 46; pub const AT_L3_CACHEGEOMETRY: ::c_ulong = 47; pub const AT_VECTOR_SIZE_ARCH: ::c_ulong = 9; - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/android/b64/x86_64/align.rs b/src/unix/linux_like/android/b64/x86_64/align.rs deleted file mode 100644 index 7ca870fd02b71..0000000000000 --- a/src/unix/linux_like/android/b64/x86_64/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f64; 4] - } -} diff --git a/src/unix/linux_like/android/b64/x86_64/mod.rs b/src/unix/linux_like/android/b64/x86_64/mod.rs index 780dae6103491..57a41a224fe2c 100644 --- a/src/unix/linux_like/android/b64/x86_64/mod.rs +++ b/src/unix/linux_like/android/b64/x86_64/mod.rs @@ -110,6 +110,12 @@ s_no_extra_traits! { uc_sigmask: ::sigset_t, uc_sigmask64: ::sigset64_t, } + + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f64; 4] + } } cfg_if! { @@ -811,6 +817,3 @@ pub const REG_CR2: ::c_int = 22; // From NDK's asm/auxvec.h pub const AT_SYSINFO_EHDR: ::c_ulong = 33; pub const AT_VECTOR_SIZE_ARCH: ::c_ulong = 3; - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index b367a22f3ed89..4dbd25d2b214b 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -468,7 +468,7 @@ s! { pub direction: ::__u16, pub trigger: ff_trigger, pub replay: ff_replay, - // FIXME this is actually a union + // FIXME(1.0): this is actually a union #[cfg(target_pointer_width = "64")] pub u: [u64; 4], #[cfg(target_pointer_width = "32")] diff --git a/src/unix/linux_like/emscripten/align.rs b/src/unix/linux_like/emscripten/align.rs deleted file mode 100644 index 015690eedae45..0000000000000 --- a/src/unix/linux_like/emscripten/align.rs +++ /dev/null @@ -1,74 +0,0 @@ -macro_rules! expand_align { - () => { - s! { - #[allow(missing_debug_implementations)] - #[repr(align(4))] - pub struct pthread_mutex_t { - size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], - } - - #[repr(align(4))] - pub struct pthread_rwlock_t { - size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], - } - - #[repr(align(4))] - pub struct pthread_mutexattr_t { - size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], - } - - #[repr(align(4))] - pub struct pthread_rwlockattr_t { - size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T], - } - - #[repr(align(4))] - pub struct pthread_condattr_t { - size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], - } - } - - s_no_extra_traits! { - #[cfg_attr(target_pointer_width = "32", - repr(align(4)))] - #[cfg_attr(target_pointer_width = "64", - repr(align(8)))] - pub struct pthread_cond_t { - size: [u8; ::__SIZEOF_PTHREAD_COND_T], - } - - #[allow(missing_debug_implementations)] - #[repr(align(8))] - pub struct max_align_t { - priv_: [f64; 3] - } - - } - - cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for pthread_cond_t { - fn eq(&self, other: &pthread_cond_t) -> bool { - self.size - .iter() - .zip(other.size.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for pthread_cond_t {} - impl ::fmt::Debug for pthread_cond_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("pthread_cond_t") - // FIXME: .field("size", &self.size) - .finish() - } - } - impl ::hash::Hash for pthread_cond_t { - fn hash(&self, state: &mut H) { - self.size.hash(state); - } - } - } - } - }; -} diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs index 9207999b6b1e1..6049dff3787d5 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -313,6 +313,32 @@ s! { pub updated: ::c_ulong, pub ha: [::c_uchar; ::MAX_ADDR_LEN], } + + #[allow(missing_debug_implementations)] + #[repr(align(4))] + pub struct pthread_mutex_t { + size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], + } + + #[repr(align(4))] + pub struct pthread_rwlock_t { + size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], + } + + #[repr(align(4))] + pub struct pthread_mutexattr_t { + size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], + } + + #[repr(align(4))] + pub struct pthread_rwlockattr_t { + size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T], + } + + #[repr(align(4))] + pub struct pthread_condattr_t { + size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], + } } s_no_extra_traits! { @@ -348,6 +374,20 @@ s_no_extra_traits! { pub mq_curmsgs: ::c_long, pad: [::c_long; 4] } + + #[cfg_attr(target_pointer_width = "32", + repr(align(4)))] + #[cfg_attr(target_pointer_width = "64", + repr(align(8)))] + pub struct pthread_cond_t { + size: [u8; ::__SIZEOF_PTHREAD_COND_T], + } + + #[allow(missing_debug_implementations)] + #[repr(align(8))] + pub struct max_align_t { + priv_: [f64; 3] + } } cfg_if! { @@ -476,6 +516,28 @@ cfg_if! { self.mq_curmsgs.hash(state); } } + + impl PartialEq for pthread_cond_t { + fn eq(&self, other: &pthread_cond_t) -> bool { + self.size + .iter() + .zip(other.size.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for pthread_cond_t {} + impl ::fmt::Debug for pthread_cond_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("pthread_cond_t") + // FIXME: .field("size", &self.size) + .finish() + } + } + impl ::hash::Hash for pthread_cond_t { + fn hash(&self, state: &mut H) { + self.size.hash(state); + } + } } } @@ -1590,7 +1652,3 @@ extern "C" { // Alias to 64 to mimic glibc's LFS64 support mod lfs64; pub use self::lfs64::*; - -#[macro_use] -mod align; -expand_align!(); diff --git a/src/unix/linux_like/linux/align.rs b/src/unix/linux_like/linux/align.rs deleted file mode 100644 index 1036e23dc8f09..0000000000000 --- a/src/unix/linux_like/linux/align.rs +++ /dev/null @@ -1,205 +0,0 @@ -macro_rules! expand_align { - () => { - s! { - #[cfg_attr(any(target_pointer_width = "32", - target_arch = "x86_64", - target_arch = "powerpc64", - target_arch = "mips64", - target_arch = "mips64r6", - target_arch = "s390x", - target_arch = "sparc64", - target_arch = "aarch64", - target_arch = "riscv64", - target_arch = "riscv32", - target_arch = "loongarch64"), - repr(align(4)))] - #[cfg_attr(not(any(target_pointer_width = "32", - target_arch = "x86_64", - target_arch = "powerpc64", - target_arch = "mips64", - target_arch = "mips64r6", - target_arch = "s390x", - target_arch = "sparc64", - target_arch = "aarch64", - target_arch = "riscv64", - target_arch = "riscv32", - target_arch = "loongarch64")), - repr(align(8)))] - pub struct pthread_mutexattr_t { - #[doc(hidden)] - size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], - } - - #[cfg_attr(any(target_env = "musl", target_env = "ohos", target_pointer_width = "32"), - repr(align(4)))] - #[cfg_attr(all(not(target_env = "musl"), - not(target_env = "ohos"), - target_pointer_width = "64"), - repr(align(8)))] - pub struct pthread_rwlockattr_t { - #[doc(hidden)] - size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T], - } - - #[repr(align(4))] - pub struct pthread_condattr_t { - #[doc(hidden)] - size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], - } - - #[repr(align(4))] - pub struct pthread_barrierattr_t { - #[doc(hidden)] - size: [u8; ::__SIZEOF_PTHREAD_BARRIERATTR_T], - } - - #[repr(align(8))] - pub struct fanotify_event_metadata { - pub event_len: __u32, - pub vers: __u8, - pub reserved: __u8, - pub metadata_len: __u16, - pub mask: __u64, - pub fd: ::c_int, - pub pid: ::c_int, - } - } - - s_no_extra_traits! { - #[cfg_attr(all(any(target_env = "musl", target_env = "ohos"), - target_pointer_width = "32"), - repr(align(4)))] - #[cfg_attr(all(any(target_env = "musl", target_env = "ohos"), - target_pointer_width = "64"), - repr(align(8)))] - #[cfg_attr(all(not(any(target_env = "musl", target_env = "ohos")), - target_arch = "x86"), - repr(align(4)))] - #[cfg_attr(all(not(any(target_env = "musl", target_env = "ohos")), - not(target_arch = "x86")), - repr(align(8)))] - pub struct pthread_cond_t { - #[doc(hidden)] - size: [u8; ::__SIZEOF_PTHREAD_COND_T], - } - - #[cfg_attr(all(target_pointer_width = "32", - any(target_arch = "mips", - target_arch = "mips32r6", - target_arch = "arm", - target_arch = "hexagon", - target_arch = "m68k", - target_arch = "csky", - target_arch = "powerpc", - target_arch = "sparc", - target_arch = "x86_64", - target_arch = "x86")), - repr(align(4)))] - #[cfg_attr(any(target_pointer_width = "64", - not(any(target_arch = "mips", - target_arch = "mips32r6", - target_arch = "arm", - target_arch = "hexagon", - target_arch = "m68k", - target_arch = "csky", - target_arch = "powerpc", - target_arch = "sparc", - target_arch = "x86_64", - target_arch = "x86"))), - repr(align(8)))] - pub struct pthread_mutex_t { - #[doc(hidden)] - size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], - } - - #[cfg_attr(all(target_pointer_width = "32", - any(target_arch = "mips", - target_arch = "mips32r6", - target_arch = "arm", - target_arch = "hexagon", - target_arch = "m68k", - target_arch = "csky", - target_arch = "powerpc", - target_arch = "sparc", - target_arch = "x86_64", - target_arch = "x86")), - repr(align(4)))] - #[cfg_attr(any(target_pointer_width = "64", - not(any(target_arch = "mips", - target_arch = "mips32r6", - target_arch = "arm", - target_arch = "hexagon", - target_arch = "m68k", - target_arch = "powerpc", - target_arch = "sparc", - target_arch = "x86_64", - target_arch = "x86"))), - repr(align(8)))] - pub struct pthread_rwlock_t { - size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], - } - - #[cfg_attr(all(target_pointer_width = "32", - any(target_arch = "mips", - target_arch = "mips32r6", - target_arch = "arm", - target_arch = "hexagon", - target_arch = "m68k", - target_arch = "csky", - target_arch = "powerpc", - target_arch = "sparc", - target_arch = "x86_64", - target_arch = "x86")), - repr(align(4)))] - #[cfg_attr(any(target_pointer_width = "64", - not(any(target_arch = "mips", - target_arch = "mips32r6", - target_arch = "arm", - target_arch = "hexagon", - target_arch = "m68k", - target_arch = "csky", - target_arch = "powerpc", - target_arch = "sparc", - target_arch = "x86_64", - target_arch = "x86"))), - repr(align(8)))] - pub struct pthread_barrier_t { - size: [u8; ::__SIZEOF_PTHREAD_BARRIER_T], - } - - // linux/can.h - #[repr(align(8))] - #[allow(missing_debug_implementations)] - pub struct can_frame { - pub can_id: canid_t, - pub can_dlc: u8, - __pad: u8, - __res0: u8, - __res1: u8, - pub data: [u8; CAN_MAX_DLEN], - } - - #[repr(align(8))] - #[allow(missing_debug_implementations)] - pub struct canfd_frame { - pub can_id: canid_t, - pub len: u8, - pub flags: u8, - __res0: u8, - __res1: u8, - pub data: [u8; CANFD_MAX_DLEN], - } - - #[repr(align(8))] - #[allow(missing_debug_implementations)] - pub struct canxl_frame { - pub prio: canid_t, - pub flags: u8, - pub sdt: u8, - pub len: u16, - pub af: u32, - pub data: [u8; CANXL_MAX_DLEN], - } - } - }; -} diff --git a/src/unix/linux_like/linux/gnu/align.rs b/src/unix/linux_like/linux/gnu/align.rs deleted file mode 100644 index 4a0e07460ebb1..0000000000000 --- a/src/unix/linux_like/linux/gnu/align.rs +++ /dev/null @@ -1,13 +0,0 @@ -s! { - // FIXME this is actually a union - #[cfg_attr(target_pointer_width = "32", - repr(align(4)))] - #[cfg_attr(target_pointer_width = "64", - repr(align(8)))] - pub struct sem_t { - #[cfg(target_pointer_width = "32")] - __size: [::c_char; 16], - #[cfg(target_pointer_width = "64")] - __size: [::c_char; 32], - } -} diff --git a/src/unix/linux_like/linux/gnu/b32/arm/align.rs b/src/unix/linux_like/linux/gnu/b32/arm/align.rs deleted file mode 100644 index 2645ec4c3d4f1..0000000000000 --- a/src/unix/linux_like/linux/gnu/b32/arm/align.rs +++ /dev/null @@ -1,53 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(8))] - pub struct max_align_t { - priv_: [i64; 2] - } - - #[allow(missing_debug_implementations)] - #[repr(align(8))] - pub struct ucontext_t { - pub uc_flags: ::c_ulong, - pub uc_link: *mut ucontext_t, - pub uc_stack: ::stack_t, - pub uc_mcontext: ::mcontext_t, - pub uc_sigmask: ::sigset_t, - pub uc_regspace: [::c_ulong; 128], - } -} - -cfg_if! { - if #[cfg(feature = "extra_traits")] { - impl PartialEq for ucontext_t { - fn eq(&self, other: &ucontext_t) -> bool { - self.uc_flags == other.uc_flags - && self.uc_link == other.uc_link - && self.uc_stack == other.uc_stack - && self.uc_mcontext == other.uc_mcontext - && self.uc_sigmask == other.uc_sigmask - } - } - impl Eq for ucontext_t {} - impl ::fmt::Debug for ucontext_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("ucontext_t") - .field("uc_flags", &self.uc_link) - .field("uc_link", &self.uc_link) - .field("uc_stack", &self.uc_stack) - .field("uc_mcontext", &self.uc_mcontext) - .field("uc_sigmask", &self.uc_sigmask) - .finish() - } - } - impl ::hash::Hash for ucontext_t { - fn hash(&self, state: &mut H) { - self.uc_flags.hash(state); - self.uc_link.hash(state); - self.uc_stack.hash(state); - self.uc_mcontext.hash(state); - self.uc_sigmask.hash(state); - } - } - } -} diff --git a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs index 947384f76e557..c58dd6d45b690 100644 --- a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs @@ -209,6 +209,60 @@ s! { } } +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(8))] + pub struct max_align_t { + priv_: [i64; 2] + } + + #[allow(missing_debug_implementations)] + #[repr(align(8))] + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_mcontext: ::mcontext_t, + pub uc_sigmask: ::sigset_t, + pub uc_regspace: [::c_ulong; 128], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for ucontext_t { + fn eq(&self, other: &ucontext_t) -> bool { + self.uc_flags == other.uc_flags + && self.uc_link == other.uc_link + && self.uc_stack == other.uc_stack + && self.uc_mcontext == other.uc_mcontext + && self.uc_sigmask == other.uc_sigmask + } + } + impl Eq for ucontext_t {} + impl ::fmt::Debug for ucontext_t { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ucontext_t") + .field("uc_flags", &self.uc_link) + .field("uc_link", &self.uc_link) + .field("uc_stack", &self.uc_stack) + .field("uc_mcontext", &self.uc_mcontext) + .field("uc_sigmask", &self.uc_sigmask) + .finish() + } + } + impl ::hash::Hash for ucontext_t { + fn hash(&self, state: &mut H) { + self.uc_flags.hash(state); + self.uc_link.hash(state); + self.uc_stack.hash(state); + self.uc_mcontext.hash(state); + self.uc_sigmask.hash(state); + } + } + } +} + pub const VEOF: usize = 4; pub const RTLD_DEEPBIND: ::c_int = 0x8; pub const RTLD_GLOBAL: ::c_int = 0x100; @@ -857,6 +911,3 @@ pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; pub const SYS_mseal: ::c_long = 462; - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/gnu/b32/csky/align.rs b/src/unix/linux_like/linux/gnu/b32/csky/align.rs deleted file mode 100644 index 825546be90a91..0000000000000 --- a/src/unix/linux_like/linux/gnu/b32/csky/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(8))] - pub struct max_align_t { - priv_: [i64; 2] - } -} diff --git a/src/unix/linux_like/linux/gnu/b32/csky/mod.rs b/src/unix/linux_like/linux/gnu/b32/csky/mod.rs index 16b2f9b84034e..feaef00803dc0 100644 --- a/src/unix/linux_like/linux/gnu/b32/csky/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/csky/mod.rs @@ -163,6 +163,14 @@ s! { } } +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(8))] + pub struct max_align_t { + priv_: [i64; 2] + } +} + pub const VEOF: usize = 4; pub const RTLD_DEEPBIND: ::c_int = 0x8; pub const RTLD_GLOBAL: ::c_int = 0x100; @@ -732,6 +740,3 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/gnu/b32/m68k/align.rs b/src/unix/linux_like/linux/gnu/b32/m68k/align.rs deleted file mode 100644 index 639394a309e3a..0000000000000 --- a/src/unix/linux_like/linux/gnu/b32/m68k/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(2))] - pub struct max_align_t { - priv_: [i8; 20] - } -} diff --git a/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs b/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs index 8ca7d3d214094..9b7c8d92e9a0e 100644 --- a/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs @@ -156,6 +156,14 @@ s! { } } +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(2))] + pub struct max_align_t { + priv_: [i8; 20] + } +} + pub const VEOF: usize = 4; pub const RTLD_DEEPBIND: ::c_int = 0x8; pub const RTLD_GLOBAL: ::c_int = 0x100; diff --git a/src/unix/linux_like/linux/gnu/b32/mips/align.rs b/src/unix/linux_like/linux/gnu/b32/mips/align.rs deleted file mode 100644 index 8c228ebab72ce..0000000000000 --- a/src/unix/linux_like/linux/gnu/b32/mips/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(8))] - pub struct max_align_t { - priv_: [f32; 4] - } -} diff --git a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs index 6f9560334c164..6655fc9c4faf4 100644 --- a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs @@ -156,6 +156,14 @@ s! { } } +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(8))] + pub struct max_align_t { + priv_: [f32; 4] + } +} + pub const O_LARGEFILE: ::c_int = 0x2000; pub const SYS_syscall: ::c_long = 4000 + 0; @@ -811,6 +819,3 @@ pub const B3500000: ::speed_t = 0o010016; pub const B4000000: ::speed_t = 0o010017; pub const EHWPOISON: ::c_int = 168; - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/gnu/b32/riscv32/align.rs b/src/unix/linux_like/linux/gnu/b32/riscv32/align.rs deleted file mode 100644 index 48d152a5721ec..0000000000000 --- a/src/unix/linux_like/linux/gnu/b32/riscv32/align.rs +++ /dev/null @@ -1,44 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - pub struct ucontext_t { - pub __uc_flags: ::c_ulong, - pub uc_link: *mut ucontext_t, - pub uc_stack: ::stack_t, - pub uc_sigmask: ::sigset_t, - pub uc_mcontext: mcontext_t, - } - - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct mcontext_t { - pub __gregs: [::c_ulong; 32], - pub __fpregs: __riscv_mc_fp_state, - } - - #[allow(missing_debug_implementations)] - pub union __riscv_mc_fp_state { - pub __f: __riscv_mc_f_ext_state, - pub __d: __riscv_mc_d_ext_state, - pub __q: __riscv_mc_q_ext_state, - } - - #[allow(missing_debug_implementations)] - pub struct __riscv_mc_f_ext_state { - pub __f: [::c_uint; 32], - pub __fcsr: ::c_uint, - } - - #[allow(missing_debug_implementations)] - pub struct __riscv_mc_d_ext_state { - pub __f: [::c_ulonglong; 32], - pub __fcsr: ::c_uint, - } - - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct __riscv_mc_q_ext_state { - pub __f: [::c_ulonglong; 64], - pub __fcsr: ::c_uint, - pub __glibc_reserved: [::c_uint; 3], - } -} diff --git a/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs b/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs index 8a75e6d42b32b..ad50112543fcd 100644 --- a/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs @@ -233,6 +233,51 @@ s! { } } +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + pub struct ucontext_t { + pub __uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_sigmask: ::sigset_t, + pub uc_mcontext: mcontext_t, + } + + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct mcontext_t { + pub __gregs: [::c_ulong; 32], + pub __fpregs: __riscv_mc_fp_state, + } + + #[allow(missing_debug_implementations)] + pub union __riscv_mc_fp_state { + pub __f: __riscv_mc_f_ext_state, + pub __d: __riscv_mc_d_ext_state, + pub __q: __riscv_mc_q_ext_state, + } + + #[allow(missing_debug_implementations)] + pub struct __riscv_mc_f_ext_state { + pub __f: [::c_uint; 32], + pub __fcsr: ::c_uint, + } + + #[allow(missing_debug_implementations)] + pub struct __riscv_mc_d_ext_state { + pub __f: [::c_ulonglong; 32], + pub __fcsr: ::c_uint, + } + + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct __riscv_mc_q_ext_state { + pub __f: [::c_ulonglong; 64], + pub __fcsr: ::c_uint, + pub __glibc_reserved: [::c_uint; 3], + } +} + pub const O_LARGEFILE: ::c_int = 0; pub const VEOF: usize = 4; pub const RTLD_DEEPBIND: ::c_int = 0x8; @@ -804,6 +849,3 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/gnu/b32/sparc/align.rs b/src/unix/linux_like/linux/gnu/b32/sparc/align.rs deleted file mode 100644 index 98fda883cd374..0000000000000 --- a/src/unix/linux_like/linux/gnu/b32/sparc/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(8))] - pub struct max_align_t { - priv_: [i64; 3] - } -} diff --git a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs index 16b836f7e6128..702d1e03224ee 100644 --- a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs @@ -193,6 +193,14 @@ s! { } } +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(8))] + pub struct max_align_t { + priv_: [i64; 3] + } +} + pub const VEOF: usize = 4; pub const RTLD_DEEPBIND: ::c_int = 0x8; pub const RTLD_GLOBAL: ::c_int = 0x100; @@ -848,6 +856,3 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/gnu/b32/x86/align.rs b/src/unix/linux_like/linux/gnu/b32/x86/align.rs deleted file mode 100644 index 96634749f53b2..0000000000000 --- a/src/unix/linux_like/linux/gnu/b32/x86/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f64; 6] - } -} diff --git a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs index 9c54fb5a2e5f7..4592013b8ddcb 100644 --- a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs @@ -265,6 +265,12 @@ s_no_extra_traits! { __private: [u8; 112], __ssp: [::c_ulong; 4], } + + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f64; 6] + } } cfg_if! { @@ -1094,6 +1100,3 @@ extern "C" { pub fn makecontext(ucp: *mut ucontext_t, func: extern "C" fn(), argc: ::c_int, ...); pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> ::c_int; } - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs b/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs deleted file mode 100644 index a035773c716fe..0000000000000 --- a/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs +++ /dev/null @@ -1,51 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f32; 8] - } -} - -s! { - pub struct ucontext_t { - pub uc_flags: ::c_ulong, - pub uc_link: *mut ucontext_t, - pub uc_stack: ::stack_t, - pub uc_sigmask: ::sigset_t, - pub uc_mcontext: mcontext_t, - } - - #[repr(align(16))] - pub struct mcontext_t { - pub fault_address: ::c_ulonglong, - pub regs: [::c_ulonglong; 31], - pub sp: ::c_ulonglong, - pub pc: ::c_ulonglong, - pub pstate: ::c_ulonglong, - // nested arrays to get the right size/length while being able to - // auto-derive traits like Debug - __reserved: [[u64; 32]; 16], - } - - #[repr(align(8))] - pub struct clone_args { - pub flags: ::c_ulonglong, - pub pidfd: ::c_ulonglong, - pub child_tid: ::c_ulonglong, - pub parent_tid: ::c_ulonglong, - pub exit_signal: ::c_ulonglong, - pub stack: ::c_ulonglong, - pub stack_size: ::c_ulonglong, - pub tls: ::c_ulonglong, - pub set_tid: ::c_ulonglong, - pub set_tid_size: ::c_ulonglong, - pub cgroup: ::c_ulonglong, - } -} - -extern "C" { - pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int; - pub fn setcontext(ucp: *const ucontext_t) -> ::c_int; - pub fn makecontext(ucp: *mut ucontext_t, func: extern "C" fn(), argc: ::c_int, ...); - pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> ::c_int; -} diff --git a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs index 96b5b532f74d2..1e6e768de2852 100644 --- a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs @@ -197,6 +197,48 @@ s! { pub ss_size: ::size_t } + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_sigmask: ::sigset_t, + pub uc_mcontext: mcontext_t, + } + + #[repr(align(16))] + pub struct mcontext_t { + pub fault_address: ::c_ulonglong, + pub regs: [::c_ulonglong; 31], + pub sp: ::c_ulonglong, + pub pc: ::c_ulonglong, + pub pstate: ::c_ulonglong, + // nested arrays to get the right size/length while being able to + // auto-derive traits like Debug + __reserved: [[u64; 32]; 16], + } + + #[repr(align(8))] + pub struct clone_args { + pub flags: ::c_ulonglong, + pub pidfd: ::c_ulonglong, + pub child_tid: ::c_ulonglong, + pub parent_tid: ::c_ulonglong, + pub exit_signal: ::c_ulonglong, + pub stack: ::c_ulonglong, + pub stack_size: ::c_ulonglong, + pub tls: ::c_ulonglong, + pub set_tid: ::c_ulonglong, + pub set_tid_size: ::c_ulonglong, + pub cgroup: ::c_ulonglong, + } +} + +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f32; 8] + } } pub const VEOF: usize = 4; @@ -906,6 +948,11 @@ extern "C" { newp: *mut ::c_void, newlen: ::size_t, ) -> ::c_int; + + pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int; + pub fn setcontext(ucp: *const ucontext_t) -> ::c_int; + pub fn makecontext(ucp: *mut ucontext_t, func: extern "C" fn(), argc: ::c_int, ...); + pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> ::c_int; } cfg_if! { @@ -918,8 +965,5 @@ cfg_if! { } } -mod align; -pub use self::align::*; - mod int128; pub use self::int128::*; diff --git a/src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs b/src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs deleted file mode 100644 index dc191f51fdb1c..0000000000000 --- a/src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs +++ /dev/null @@ -1,40 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f64; 4] - } -} - -s! { - pub struct ucontext_t { - pub uc_flags: ::c_ulong, - pub uc_link: *mut ucontext_t, - pub uc_stack: ::stack_t, - pub uc_sigmask: ::sigset_t, - pub uc_mcontext: mcontext_t, - } - - #[repr(align(16))] - pub struct mcontext_t { - pub __pc: ::c_ulonglong, - pub __gregs: [::c_ulonglong; 32], - pub __flags: ::c_uint, - pub __extcontext: [::c_ulonglong; 0], - } - - #[repr(align(8))] - pub struct clone_args { - pub flags: ::c_ulonglong, - pub pidfd: ::c_ulonglong, - pub child_tid: ::c_ulonglong, - pub parent_tid: ::c_ulonglong, - pub exit_signal: ::c_ulonglong, - pub stack: ::c_ulonglong, - pub stack_size: ::c_ulonglong, - pub tls: ::c_ulonglong, - pub set_tid: ::c_ulonglong, - pub set_tid_size: ::c_ulonglong, - pub cgroup: ::c_ulonglong, - } -} diff --git a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs index eccbeff79f6c6..29d40cc91bc39 100644 --- a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs @@ -204,6 +204,45 @@ s! { pub fcc: u64, pub fcsr: u32, } + + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_sigmask: ::sigset_t, + pub uc_mcontext: mcontext_t, + } + + #[repr(align(16))] + pub struct mcontext_t { + pub __pc: ::c_ulonglong, + pub __gregs: [::c_ulonglong; 32], + pub __flags: ::c_uint, + pub __extcontext: [::c_ulonglong; 0], + } + + #[repr(align(8))] + pub struct clone_args { + pub flags: ::c_ulonglong, + pub pidfd: ::c_ulonglong, + pub child_tid: ::c_ulonglong, + pub parent_tid: ::c_ulonglong, + pub exit_signal: ::c_ulonglong, + pub stack: ::c_ulonglong, + pub stack_size: ::c_ulonglong, + pub tls: ::c_ulonglong, + pub set_tid: ::c_ulonglong, + pub set_tid_size: ::c_ulonglong, + pub cgroup: ::c_ulonglong, + } +} + +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f64; 4] + } } pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; @@ -883,6 +922,3 @@ pub const EPOLL_CLOEXEC: ::c_int = 0x80000; pub const EFD_CLOEXEC: ::c_int = 0x80000; pub const EFD_NONBLOCK: ::c_int = 0x800; - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/gnu/b64/mips64/align.rs b/src/unix/linux_like/linux/gnu/b64/mips64/align.rs deleted file mode 100644 index 7ca870fd02b71..0000000000000 --- a/src/unix/linux_like/linux/gnu/b64/mips64/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f64; 4] - } -} diff --git a/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs b/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs index ac4d205c7f7a2..e1e2be19bc3ba 100644 --- a/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs @@ -186,6 +186,14 @@ s! { } } +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f64; 4] + } +} + pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; pub const __SIZEOF_PTHREAD_BARRIERATTR_T: usize = 4; @@ -917,6 +925,3 @@ extern "C" { newlen: ::size_t, ) -> ::c_int; } - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs b/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs deleted file mode 100644 index 29d1e1c7b8a55..0000000000000 --- a/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [i64; 4] - } -} diff --git a/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs b/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs index 3a06d26143a2b..495c0b37e16c0 100644 --- a/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs @@ -193,6 +193,14 @@ s! { } } +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [i64; 4] + } +} + pub const POSIX_FADV_DONTNEED: ::c_int = 4; pub const POSIX_FADV_NOREUSE: ::c_int = 5; @@ -962,6 +970,3 @@ extern "C" { newlen: ::size_t, ) -> ::c_int; } - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs b/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs deleted file mode 100644 index 5b33f2375d39c..0000000000000 --- a/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs +++ /dev/null @@ -1,61 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - pub struct ucontext_t { - pub __uc_flags: ::c_ulong, - pub uc_link: *mut ucontext_t, - pub uc_stack: ::stack_t, - pub uc_sigmask: ::sigset_t, - pub uc_mcontext: mcontext_t, - } - - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct mcontext_t { - pub __gregs: [::c_ulong; 32], - pub __fpregs: __riscv_mc_fp_state, - } - - #[allow(missing_debug_implementations)] - pub union __riscv_mc_fp_state { - pub __f: __riscv_mc_f_ext_state, - pub __d: __riscv_mc_d_ext_state, - pub __q: __riscv_mc_q_ext_state, - } - - #[allow(missing_debug_implementations)] - pub struct __riscv_mc_f_ext_state { - pub __f: [::c_uint; 32], - pub __fcsr: ::c_uint, - } - - #[allow(missing_debug_implementations)] - pub struct __riscv_mc_d_ext_state { - pub __f: [::c_ulonglong; 32], - pub __fcsr: ::c_uint, - } - - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct __riscv_mc_q_ext_state { - pub __f: [::c_ulonglong; 64], - pub __fcsr: ::c_uint, - pub __glibc_reserved: [::c_uint; 3], - } -} - -s! { - #[repr(align(8))] - pub struct clone_args { - pub flags: ::c_ulonglong, - pub pidfd: ::c_ulonglong, - pub child_tid: ::c_ulonglong, - pub parent_tid: ::c_ulonglong, - pub exit_signal: ::c_ulonglong, - pub stack: ::c_ulonglong, - pub stack_size: ::c_ulonglong, - pub tls: ::c_ulonglong, - pub set_tid: ::c_ulonglong, - pub set_tid_size: ::c_ulonglong, - pub cgroup: ::c_ulonglong, - } -} diff --git a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs index 750ee8f8436e8..ff001a86ff800 100644 --- a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs @@ -227,6 +227,66 @@ s! { pub t5: ::c_ulong, pub t6: ::c_ulong, } + + #[repr(align(8))] + pub struct clone_args { + pub flags: ::c_ulonglong, + pub pidfd: ::c_ulonglong, + pub child_tid: ::c_ulonglong, + pub parent_tid: ::c_ulonglong, + pub exit_signal: ::c_ulonglong, + pub stack: ::c_ulonglong, + pub stack_size: ::c_ulonglong, + pub tls: ::c_ulonglong, + pub set_tid: ::c_ulonglong, + pub set_tid_size: ::c_ulonglong, + pub cgroup: ::c_ulonglong, + } +} + +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + pub struct ucontext_t { + pub __uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_sigmask: ::sigset_t, + pub uc_mcontext: mcontext_t, + } + + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct mcontext_t { + pub __gregs: [::c_ulong; 32], + pub __fpregs: __riscv_mc_fp_state, + } + + #[allow(missing_debug_implementations)] + pub union __riscv_mc_fp_state { + pub __f: __riscv_mc_f_ext_state, + pub __d: __riscv_mc_d_ext_state, + pub __q: __riscv_mc_q_ext_state, + } + + #[allow(missing_debug_implementations)] + pub struct __riscv_mc_f_ext_state { + pub __f: [::c_uint; 32], + pub __fcsr: ::c_uint, + } + + #[allow(missing_debug_implementations)] + pub struct __riscv_mc_d_ext_state { + pub __f: [::c_ulonglong; 32], + pub __fcsr: ::c_uint, + } + + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct __riscv_mc_q_ext_state { + pub __f: [::c_ulonglong; 64], + pub __fcsr: ::c_uint, + pub __glibc_reserved: [::c_uint; 3], + } } pub const POSIX_FADV_DONTNEED: ::c_int = 4; @@ -851,6 +911,3 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs b/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs deleted file mode 100644 index 29d1e1c7b8a55..0000000000000 --- a/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [i64; 4] - } -} diff --git a/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs b/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs index 4ea00510f0aa1..5d1f5e47415b2 100644 --- a/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs @@ -196,6 +196,14 @@ s! { } } +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [i64; 4] + } +} + pub const POSIX_FADV_DONTNEED: ::c_int = 4; pub const POSIX_FADV_NOREUSE: ::c_int = 5; @@ -917,6 +925,3 @@ extern "C" { newlen: ::size_t, ) -> ::c_int; } - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs deleted file mode 100644 index ba3075edd7e36..0000000000000 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs +++ /dev/null @@ -1,24 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f64; 4] - } -} - -s! { - #[repr(align(8))] - pub struct clone_args { - pub flags: ::c_ulonglong, - pub pidfd: ::c_ulonglong, - pub child_tid: ::c_ulonglong, - pub parent_tid: ::c_ulonglong, - pub exit_signal: ::c_ulonglong, - pub stack: ::c_ulonglong, - pub stack_size: ::c_ulonglong, - pub tls: ::c_ulonglong, - pub set_tid: ::c_ulonglong, - pub set_tid_size: ::c_ulonglong, - pub cgroup: ::c_ulonglong, - } -} diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs index 88d70d7deb5da..eda6d2c2caba3 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs @@ -267,6 +267,21 @@ s! { pub flags: ::__u32, pub pad: ::__u32, } + + #[repr(align(8))] + pub struct clone_args { + pub flags: ::c_ulonglong, + pub pidfd: ::c_ulonglong, + pub child_tid: ::c_ulonglong, + pub parent_tid: ::c_ulonglong, + pub exit_signal: ::c_ulonglong, + pub stack: ::c_ulonglong, + pub stack_size: ::c_ulonglong, + pub tls: ::c_ulonglong, + pub set_tid: ::c_ulonglong, + pub set_tid_size: ::c_ulonglong, + pub cgroup: ::c_ulonglong, + } } s_no_extra_traits! { @@ -297,6 +312,12 @@ s_no_extra_traits! { // // __ssp: [::c_ulonglong; 4], } + + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f64; 4] + } } cfg_if! { @@ -813,6 +834,3 @@ cfg_if! { pub use self::not_x32::*; } } - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index f68efbe85bbf5..6c2d95593155f 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -502,6 +502,18 @@ s! { pub error: ::__s32, pub error_count: ::__u32, } + + // FIXME(1.0) this is actually a union + #[cfg_attr(target_pointer_width = "32", + repr(align(4)))] + #[cfg_attr(target_pointer_width = "64", + repr(align(8)))] + pub struct sem_t { + #[cfg(target_pointer_width = "32")] + __size: [::c_char; 16], + #[cfg(target_pointer_width = "64")] + __size: [::c_char; 32], + } } impl siginfo_t { @@ -1624,6 +1636,3 @@ cfg_if! { // Unknown target_arch } } - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 9401949b4f124..d03cf2c3bd9ed 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -1045,6 +1045,69 @@ s! { pub prefer_busy_poll: u8, pub __pad: u8, // Must be zero } + + #[cfg_attr(any(target_pointer_width = "32", + target_arch = "x86_64", + target_arch = "powerpc64", + target_arch = "mips64", + target_arch = "mips64r6", + target_arch = "s390x", + target_arch = "sparc64", + target_arch = "aarch64", + target_arch = "riscv64", + target_arch = "riscv32", + target_arch = "loongarch64"), + repr(align(4)))] + #[cfg_attr(not(any(target_pointer_width = "32", + target_arch = "x86_64", + target_arch = "powerpc64", + target_arch = "mips64", + target_arch = "mips64r6", + target_arch = "s390x", + target_arch = "sparc64", + target_arch = "aarch64", + target_arch = "riscv64", + target_arch = "riscv32", + target_arch = "loongarch64")), + repr(align(8)))] + pub struct pthread_mutexattr_t { + #[doc(hidden)] + size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], + } + + #[cfg_attr(any(target_env = "musl", target_env = "ohos", target_pointer_width = "32"), + repr(align(4)))] + #[cfg_attr(all(not(target_env = "musl"), + not(target_env = "ohos"), + target_pointer_width = "64"), + repr(align(8)))] + pub struct pthread_rwlockattr_t { + #[doc(hidden)] + size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T], + } + + #[repr(align(4))] + pub struct pthread_condattr_t { + #[doc(hidden)] + size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], + } + + #[repr(align(4))] + pub struct pthread_barrierattr_t { + #[doc(hidden)] + size: [u8; ::__SIZEOF_PTHREAD_BARRIERATTR_T], + } + + #[repr(align(8))] + pub struct fanotify_event_metadata { + pub event_len: __u32, + pub vers: __u8, + pub reserved: __u8, + pub metadata_len: __u16, + pub mask: __u64, + pub fd: ::c_int, + pub pid: ::c_int, + } } cfg_if! { @@ -1080,6 +1143,7 @@ cfg_if! { } } } + s_no_extra_traits! { pub struct sockaddr_nl { pub nl_family: ::sa_family_t, @@ -1226,6 +1290,141 @@ s_no_extra_traits! { pub offset_to_priv: ::__u32, pub hdr: ::tpacket_bd_header_u, } + + #[cfg_attr(all(any(target_env = "musl", target_env = "ohos"), + target_pointer_width = "32"), + repr(align(4)))] + #[cfg_attr(all(any(target_env = "musl", target_env = "ohos"), + target_pointer_width = "64"), + repr(align(8)))] + #[cfg_attr(all(not(any(target_env = "musl", target_env = "ohos")), + target_arch = "x86"), + repr(align(4)))] + #[cfg_attr(all(not(any(target_env = "musl", target_env = "ohos")), + not(target_arch = "x86")), + repr(align(8)))] + pub struct pthread_cond_t { + #[doc(hidden)] + size: [u8; ::__SIZEOF_PTHREAD_COND_T], + } + + #[cfg_attr(all(target_pointer_width = "32", + any(target_arch = "mips", + target_arch = "mips32r6", + target_arch = "arm", + target_arch = "hexagon", + target_arch = "m68k", + target_arch = "csky", + target_arch = "powerpc", + target_arch = "sparc", + target_arch = "x86_64", + target_arch = "x86")), + repr(align(4)))] + #[cfg_attr(any(target_pointer_width = "64", + not(any(target_arch = "mips", + target_arch = "mips32r6", + target_arch = "arm", + target_arch = "hexagon", + target_arch = "m68k", + target_arch = "csky", + target_arch = "powerpc", + target_arch = "sparc", + target_arch = "x86_64", + target_arch = "x86"))), + repr(align(8)))] + pub struct pthread_mutex_t { + #[doc(hidden)] + size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], + } + + #[cfg_attr(all(target_pointer_width = "32", + any(target_arch = "mips", + target_arch = "mips32r6", + target_arch = "arm", + target_arch = "hexagon", + target_arch = "m68k", + target_arch = "csky", + target_arch = "powerpc", + target_arch = "sparc", + target_arch = "x86_64", + target_arch = "x86")), + repr(align(4)))] + #[cfg_attr(any(target_pointer_width = "64", + not(any(target_arch = "mips", + target_arch = "mips32r6", + target_arch = "arm", + target_arch = "hexagon", + target_arch = "m68k", + target_arch = "powerpc", + target_arch = "sparc", + target_arch = "x86_64", + target_arch = "x86"))), + repr(align(8)))] + pub struct pthread_rwlock_t { + size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], + } + + #[cfg_attr(all(target_pointer_width = "32", + any(target_arch = "mips", + target_arch = "mips32r6", + target_arch = "arm", + target_arch = "hexagon", + target_arch = "m68k", + target_arch = "csky", + target_arch = "powerpc", + target_arch = "sparc", + target_arch = "x86_64", + target_arch = "x86")), + repr(align(4)))] + #[cfg_attr(any(target_pointer_width = "64", + not(any(target_arch = "mips", + target_arch = "mips32r6", + target_arch = "arm", + target_arch = "hexagon", + target_arch = "m68k", + target_arch = "csky", + target_arch = "powerpc", + target_arch = "sparc", + target_arch = "x86_64", + target_arch = "x86"))), + repr(align(8)))] + pub struct pthread_barrier_t { + size: [u8; ::__SIZEOF_PTHREAD_BARRIER_T], + } + + // linux/can.h + #[repr(align(8))] + #[allow(missing_debug_implementations)] + pub struct can_frame { + pub can_id: canid_t, + pub can_dlc: u8, + __pad: u8, + __res0: u8, + __res1: u8, + pub data: [u8; CAN_MAX_DLEN], + } + + #[repr(align(8))] + #[allow(missing_debug_implementations)] + pub struct canfd_frame { + pub can_id: canid_t, + pub len: u8, + pub flags: u8, + __res0: u8, + __res1: u8, + pub data: [u8; CANFD_MAX_DLEN], + } + + #[repr(align(8))] + #[allow(missing_debug_implementations)] + pub struct canxl_frame { + pub prio: canid_t, + pub flags: u8, + pub sdt: u8, + pub len: u16, + pub af: u32, + pub data: [u8; CANXL_MAX_DLEN], + } } s_no_extra_traits! { @@ -6263,9 +6462,5 @@ cfg_if! { mod arch; pub use self::arch::*; -#[macro_use] -mod align; -expand_align!(); - mod non_exhaustive; pub use self::non_exhaustive::*; diff --git a/src/unix/linux_like/linux/musl/b32/arm/align.rs b/src/unix/linux_like/linux/musl/b32/arm/align.rs deleted file mode 100644 index aedbf7a99eb1b..0000000000000 --- a/src/unix/linux_like/linux/musl/b32/arm/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(8))] - pub struct max_align_t { - priv_: (i64, i64) - } -} diff --git a/src/unix/linux_like/linux/musl/b32/arm/mod.rs b/src/unix/linux_like/linux/musl/b32/arm/mod.rs index 58097f1434015..115f1085704b4 100644 --- a/src/unix/linux_like/linux/musl/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/arm/mod.rs @@ -186,6 +186,12 @@ s_no_extra_traits! { pub uc_sigmask: ::sigset_t, pub uc_regspace: [::c_ulonglong; 64], } + + #[allow(missing_debug_implementations)] + #[repr(align(8))] + pub struct max_align_t { + priv_: (i64, i64) + } } cfg_if! { @@ -845,6 +851,3 @@ pub const SYS_mseal: ::c_long = 462; extern "C" { pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; } - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/musl/b32/mips/align.rs b/src/unix/linux_like/linux/musl/b32/mips/align.rs deleted file mode 100644 index 8c228ebab72ce..0000000000000 --- a/src/unix/linux_like/linux/musl/b32/mips/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(8))] - pub struct max_align_t { - priv_: [f32; 4] - } -} diff --git a/src/unix/linux_like/linux/musl/b32/mips/mod.rs b/src/unix/linux_like/linux/musl/b32/mips/mod.rs index ab7a55b754c5e..a67fff7cfc728 100644 --- a/src/unix/linux_like/linux/musl/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/mips/mod.rs @@ -163,6 +163,14 @@ s! { } } +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(8))] + pub struct max_align_t { + priv_: [f32; 4] + } +} + pub const SIGSTKSZ: ::size_t = 8192; pub const MINSIGSTKSZ: ::size_t = 2048; @@ -779,6 +787,3 @@ pub const SYS_memfd_secret: ::c_long = 4000 + 447; pub const SYS_process_mrelease: ::c_long = 4000 + 448; pub const SYS_futex_waitv: ::c_long = 4000 + 449; pub const SYS_set_mempolicy_home_node: ::c_long = 4000 + 450; - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/musl/b32/riscv32/align.rs b/src/unix/linux_like/linux/musl/b32/riscv32/align.rs deleted file mode 100644 index 048268c96b7a7..0000000000000 --- a/src/unix/linux_like/linux/musl/b32/riscv32/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(8))] - pub struct max_align_t { - priv_: (i64, f64) - } -} diff --git a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs index 8568f2f338094..c71cc61584860 100644 --- a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs @@ -186,6 +186,14 @@ s! { } } +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(8))] + pub struct max_align_t { + priv_: (i64, f64) + } +} + //pub const RLIM_INFINITY: ::rlim_t = !0; pub const VEOF: usize = 4; pub const RTLD_DEEPBIND: ::c_int = 0x8; @@ -789,6 +797,3 @@ pub const SYS_faccessat2: ::c_long = 439; pub const SYS_process_madvise: ::c_long = 440; pub const SYS_epoll_pwait2: ::c_long = 441; pub const SYS_mount_setattr: ::c_long = 442; - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/musl/b32/x86/align.rs b/src/unix/linux_like/linux/musl/b32/x86/align.rs deleted file mode 100644 index 79544176a88c9..0000000000000 --- a/src/unix/linux_like/linux/musl/b32/x86/align.rs +++ /dev/null @@ -1,7 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(8))] - pub struct max_align_t { - priv_: [f64; 3] - } -} diff --git a/src/unix/linux_like/linux/musl/b32/x86/mod.rs b/src/unix/linux_like/linux/musl/b32/x86/mod.rs index f43c7ea60f8c7..f8bf2694f4b4c 100644 --- a/src/unix/linux_like/linux/musl/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/x86/mod.rs @@ -181,6 +181,12 @@ s_no_extra_traits! { pub uc_sigmask: ::sigset_t, __private: [u8; 112], } + + #[allow(missing_debug_implementations)] + #[repr(align(8))] + pub struct max_align_t { + priv_: [f64; 3] + } } cfg_if! { @@ -960,6 +966,3 @@ pub const SS: ::c_int = 16; extern "C" { pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; } - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/musl/b64/aarch64/align.rs b/src/unix/linux_like/linux/musl/b64/aarch64/align.rs deleted file mode 100644 index a4bf9bff4f147..0000000000000 --- a/src/unix/linux_like/linux/musl/b64/aarch64/align.rs +++ /dev/null @@ -1,42 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f32; 8] - } -} - -s! { - pub struct ucontext_t { - pub uc_flags: ::c_ulong, - pub uc_link: *mut ucontext_t, - pub uc_stack: ::stack_t, - pub uc_sigmask: ::sigset_t, - pub uc_mcontext: mcontext_t, - } - - #[repr(align(16))] - pub struct mcontext_t { - pub fault_address: ::c_ulong, - pub regs: [::c_ulong; 31], - pub sp: ::c_ulong, - pub pc: ::c_ulong, - pub pstate: ::c_ulong, - __reserved: [[u64; 32]; 16], - } - - #[repr(align(8))] - pub struct clone_args { - pub flags: ::c_ulonglong, - pub pidfd: ::c_ulonglong, - pub child_tid: ::c_ulonglong, - pub parent_tid: ::c_ulonglong, - pub exit_signal: ::c_ulonglong, - pub stack: ::c_ulonglong, - pub stack_size: ::c_ulonglong, - pub tls: ::c_ulonglong, - pub set_tid: ::c_ulonglong, - pub set_tid_size: ::c_ulonglong, - pub cgroup: ::c_ulonglong, - } -} diff --git a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs index a052b56bdcf6e..4a85e6f771ee0 100644 --- a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs @@ -68,6 +68,47 @@ s! { __unused1: ::c_ulong, __unused2: ::c_ulong, } + + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_sigmask: ::sigset_t, + pub uc_mcontext: mcontext_t, + } + + #[repr(align(16))] + pub struct mcontext_t { + pub fault_address: ::c_ulong, + pub regs: [::c_ulong; 31], + pub sp: ::c_ulong, + pub pc: ::c_ulong, + pub pstate: ::c_ulong, + __reserved: [[u64; 32]; 16], + } + + #[repr(align(8))] + pub struct clone_args { + pub flags: ::c_ulonglong, + pub pidfd: ::c_ulonglong, + pub child_tid: ::c_ulonglong, + pub parent_tid: ::c_ulonglong, + pub exit_signal: ::c_ulonglong, + pub stack: ::c_ulonglong, + pub stack_size: ::c_ulonglong, + pub tls: ::c_ulonglong, + pub set_tid: ::c_ulonglong, + pub set_tid_size: ::c_ulonglong, + pub cgroup: ::c_ulonglong, + } +} + +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f32; 8] + } } pub const O_APPEND: ::c_int = 1024; @@ -646,8 +687,5 @@ pub const IEXTEN: ::tcflag_t = 0x00008000; pub const TOSTOP: ::tcflag_t = 0x00000100; pub const FLUSHO: ::tcflag_t = 0x00001000; -mod align; -pub use self::align::*; - mod int128; pub use self::int128::*; diff --git a/src/unix/linux_like/linux/musl/b64/loongarch64/align.rs b/src/unix/linux_like/linux/musl/b64/loongarch64/align.rs deleted file mode 100644 index dc191f51fdb1c..0000000000000 --- a/src/unix/linux_like/linux/musl/b64/loongarch64/align.rs +++ /dev/null @@ -1,40 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f64; 4] - } -} - -s! { - pub struct ucontext_t { - pub uc_flags: ::c_ulong, - pub uc_link: *mut ucontext_t, - pub uc_stack: ::stack_t, - pub uc_sigmask: ::sigset_t, - pub uc_mcontext: mcontext_t, - } - - #[repr(align(16))] - pub struct mcontext_t { - pub __pc: ::c_ulonglong, - pub __gregs: [::c_ulonglong; 32], - pub __flags: ::c_uint, - pub __extcontext: [::c_ulonglong; 0], - } - - #[repr(align(8))] - pub struct clone_args { - pub flags: ::c_ulonglong, - pub pidfd: ::c_ulonglong, - pub child_tid: ::c_ulonglong, - pub parent_tid: ::c_ulonglong, - pub exit_signal: ::c_ulonglong, - pub stack: ::c_ulonglong, - pub stack_size: ::c_ulonglong, - pub tls: ::c_ulonglong, - pub set_tid: ::c_ulonglong, - pub set_tid_size: ::c_ulonglong, - pub cgroup: ::c_ulonglong, - } -} diff --git a/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs b/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs index 59a824b237306..ac02803640e30 100644 --- a/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs @@ -116,6 +116,45 @@ s! { pub fcc: u64, pub fcsr: u32, } + + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_sigmask: ::sigset_t, + pub uc_mcontext: mcontext_t, + } + + #[repr(align(16))] + pub struct mcontext_t { + pub __pc: ::c_ulonglong, + pub __gregs: [::c_ulonglong; 32], + pub __flags: ::c_uint, + pub __extcontext: [::c_ulonglong; 0], + } + + #[repr(align(8))] + pub struct clone_args { + pub flags: ::c_ulonglong, + pub pidfd: ::c_ulonglong, + pub child_tid: ::c_ulonglong, + pub parent_tid: ::c_ulonglong, + pub exit_signal: ::c_ulonglong, + pub stack: ::c_ulonglong, + pub stack_size: ::c_ulonglong, + pub tls: ::c_ulonglong, + pub set_tid: ::c_ulonglong, + pub set_tid_size: ::c_ulonglong, + pub cgroup: ::c_ulonglong, + } +} + +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f64; 4] + } } pub const SYS_io_setup: ::c_long = 0; @@ -660,10 +699,3 @@ pub const VMIN: usize = 6; pub const IEXTEN: ::tcflag_t = 0x00008000; pub const TOSTOP: ::tcflag_t = 0x00000100; pub const FLUSHO: ::tcflag_t = 0x00001000; - -cfg_if! { - if #[cfg(libc_align)] { - mod align; - pub use self::align::*; - } -} diff --git a/src/unix/linux_like/linux/musl/b64/riscv64/align.rs b/src/unix/linux_like/linux/musl/b64/riscv64/align.rs deleted file mode 100644 index 5b33f2375d39c..0000000000000 --- a/src/unix/linux_like/linux/musl/b64/riscv64/align.rs +++ /dev/null @@ -1,61 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - pub struct ucontext_t { - pub __uc_flags: ::c_ulong, - pub uc_link: *mut ucontext_t, - pub uc_stack: ::stack_t, - pub uc_sigmask: ::sigset_t, - pub uc_mcontext: mcontext_t, - } - - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct mcontext_t { - pub __gregs: [::c_ulong; 32], - pub __fpregs: __riscv_mc_fp_state, - } - - #[allow(missing_debug_implementations)] - pub union __riscv_mc_fp_state { - pub __f: __riscv_mc_f_ext_state, - pub __d: __riscv_mc_d_ext_state, - pub __q: __riscv_mc_q_ext_state, - } - - #[allow(missing_debug_implementations)] - pub struct __riscv_mc_f_ext_state { - pub __f: [::c_uint; 32], - pub __fcsr: ::c_uint, - } - - #[allow(missing_debug_implementations)] - pub struct __riscv_mc_d_ext_state { - pub __f: [::c_ulonglong; 32], - pub __fcsr: ::c_uint, - } - - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct __riscv_mc_q_ext_state { - pub __f: [::c_ulonglong; 64], - pub __fcsr: ::c_uint, - pub __glibc_reserved: [::c_uint; 3], - } -} - -s! { - #[repr(align(8))] - pub struct clone_args { - pub flags: ::c_ulonglong, - pub pidfd: ::c_ulonglong, - pub child_tid: ::c_ulonglong, - pub parent_tid: ::c_ulonglong, - pub exit_signal: ::c_ulonglong, - pub stack: ::c_ulonglong, - pub stack_size: ::c_ulonglong, - pub tls: ::c_ulonglong, - pub set_tid: ::c_ulonglong, - pub set_tid_size: ::c_ulonglong, - pub cgroup: ::c_ulonglong, - } -} diff --git a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs index a84d33409d19d..b48f7ac56b095 100644 --- a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs @@ -173,6 +173,66 @@ s! { __unused5: ::c_ulong, __unused6: ::c_ulong, } + + #[repr(align(8))] + pub struct clone_args { + pub flags: ::c_ulonglong, + pub pidfd: ::c_ulonglong, + pub child_tid: ::c_ulonglong, + pub parent_tid: ::c_ulonglong, + pub exit_signal: ::c_ulonglong, + pub stack: ::c_ulonglong, + pub stack_size: ::c_ulonglong, + pub tls: ::c_ulonglong, + pub set_tid: ::c_ulonglong, + pub set_tid_size: ::c_ulonglong, + pub cgroup: ::c_ulonglong, + } +} + +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + pub struct ucontext_t { + pub __uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_sigmask: ::sigset_t, + pub uc_mcontext: mcontext_t, + } + + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct mcontext_t { + pub __gregs: [::c_ulong; 32], + pub __fpregs: __riscv_mc_fp_state, + } + + #[allow(missing_debug_implementations)] + pub union __riscv_mc_fp_state { + pub __f: __riscv_mc_f_ext_state, + pub __d: __riscv_mc_d_ext_state, + pub __q: __riscv_mc_q_ext_state, + } + + #[allow(missing_debug_implementations)] + pub struct __riscv_mc_f_ext_state { + pub __f: [::c_uint; 32], + pub __fcsr: ::c_uint, + } + + #[allow(missing_debug_implementations)] + pub struct __riscv_mc_d_ext_state { + pub __f: [::c_ulonglong; 32], + pub __fcsr: ::c_uint, + } + + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct __riscv_mc_q_ext_state { + pub __f: [::c_ulonglong; 64], + pub __fcsr: ::c_uint, + pub __glibc_reserved: [::c_uint; 3], + } } pub const SYS_read: ::c_long = 63; @@ -720,6 +780,3 @@ pub const REG_S1: usize = 9; pub const REG_A0: usize = 10; pub const REG_S2: usize = 18; pub const REG_NARGS: usize = 8; - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/musl/b64/x86_64/align.rs b/src/unix/linux_like/linux/musl/b64/x86_64/align.rs deleted file mode 100644 index 94391a01a727e..0000000000000 --- a/src/unix/linux_like/linux/musl/b64/x86_64/align.rs +++ /dev/null @@ -1,25 +0,0 @@ -s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f64; 4] - } - -} - -s! { - #[repr(align(8))] - pub struct clone_args { - pub flags: ::c_ulonglong, - pub pidfd: ::c_ulonglong, - pub child_tid: ::c_ulonglong, - pub parent_tid: ::c_ulonglong, - pub exit_signal: ::c_ulonglong, - pub stack: ::c_ulonglong, - pub stack_size: ::c_ulonglong, - pub tls: ::c_ulonglong, - pub set_tid: ::c_ulonglong, - pub set_tid_size: ::c_ulonglong, - pub cgroup: ::c_ulonglong, - } -} diff --git a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs index 5da3038a1855c..81c9772cdbb44 100644 --- a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs @@ -120,6 +120,21 @@ s! { __unused1: ::c_long, __unused2: ::c_long } + + #[repr(align(8))] + pub struct clone_args { + pub flags: ::c_ulonglong, + pub pidfd: ::c_ulonglong, + pub child_tid: ::c_ulonglong, + pub parent_tid: ::c_ulonglong, + pub exit_signal: ::c_ulonglong, + pub stack: ::c_ulonglong, + pub stack_size: ::c_ulonglong, + pub tls: ::c_ulonglong, + pub set_tid: ::c_ulonglong, + pub set_tid_size: ::c_ulonglong, + pub cgroup: ::c_ulonglong, + } } s_no_extra_traits! { @@ -145,6 +160,12 @@ s_no_extra_traits! { pub uc_sigmask: ::sigset_t, __private: [u8; 512], } + + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f64; 4] + } } cfg_if! { @@ -910,6 +931,3 @@ pub const VMIN: usize = 6; pub const IEXTEN: ::tcflag_t = 0x00008000; pub const TOSTOP: ::tcflag_t = 0x00000100; pub const FLUSHO: ::tcflag_t = 0x00001000; - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/uclibc/align.rs b/src/unix/linux_like/linux/uclibc/align.rs deleted file mode 100644 index e6610bb7b985c..0000000000000 --- a/src/unix/linux_like/linux/uclibc/align.rs +++ /dev/null @@ -1,28 +0,0 @@ -macro_rules! expand_align { - () => { - s! { - #[cfg_attr(any(target_pointer_width = "32", - target_arch = "x86_64", - target_arch = "powerpc64", - target_arch = "mips64", - target_arch = "s390x", - target_arch = "sparc64"), - repr(align(4)))] - #[cfg_attr(not(any(target_pointer_width = "32", - target_arch = "x86_64", - target_arch = "powerpc64", - target_arch = "mips64", - target_arch = "s390x", - target_arch = "sparc64")), - repr(align(8)))] - pub struct pthread_mutexattr_t { - size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], - } - - #[repr(align(4))] - pub struct pthread_condattr_t { - size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], - } - } - }; -} diff --git a/src/unix/linux_like/linux/uclibc/arm/align.rs b/src/unix/linux_like/linux/uclibc/arm/align.rs deleted file mode 100644 index 4a0e07460ebb1..0000000000000 --- a/src/unix/linux_like/linux/uclibc/arm/align.rs +++ /dev/null @@ -1,13 +0,0 @@ -s! { - // FIXME this is actually a union - #[cfg_attr(target_pointer_width = "32", - repr(align(4)))] - #[cfg_attr(target_pointer_width = "64", - repr(align(8)))] - pub struct sem_t { - #[cfg(target_pointer_width = "32")] - __size: [::c_char; 16], - #[cfg(target_pointer_width = "64")] - __size: [::c_char; 32], - } -} diff --git a/src/unix/linux_like/linux/uclibc/arm/mod.rs b/src/unix/linux_like/linux/uclibc/arm/mod.rs index 69187670587d6..70b890d3eeab0 100644 --- a/src/unix/linux_like/linux/uclibc/arm/mod.rs +++ b/src/unix/linux_like/linux/uclibc/arm/mod.rs @@ -241,6 +241,18 @@ s! { __unused4: ::c_ulong, __unused5: ::c_ulong, } + + // FIXME(1.0) this is actually a union + #[cfg_attr(target_pointer_width = "32", + repr(align(4)))] + #[cfg_attr(target_pointer_width = "64", + repr(align(8)))] + pub struct sem_t { + #[cfg(target_pointer_width = "32")] + __size: [::c_char; 16], + #[cfg(target_pointer_width = "64")] + __size: [::c_char; 32], + } } pub const O_CLOEXEC: ::c_int = 0o2000000; @@ -913,6 +925,3 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/uclibc/mips/mips32/align.rs b/src/unix/linux_like/linux/uclibc/mips/mips32/align.rs deleted file mode 100644 index 4a0e07460ebb1..0000000000000 --- a/src/unix/linux_like/linux/uclibc/mips/mips32/align.rs +++ /dev/null @@ -1,13 +0,0 @@ -s! { - // FIXME this is actually a union - #[cfg_attr(target_pointer_width = "32", - repr(align(4)))] - #[cfg_attr(target_pointer_width = "64", - repr(align(8)))] - pub struct sem_t { - #[cfg(target_pointer_width = "32")] - __size: [::c_char; 16], - #[cfg(target_pointer_width = "64")] - __size: [::c_char; 32], - } -} diff --git a/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs index 9e5765e9568f1..0052ddb3d9597 100644 --- a/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs @@ -254,6 +254,18 @@ s! { pub mem_unit: ::c_uint, pub _f: [::c_char; 8], } + + // FIXME(1.0): this is actually a union + #[cfg_attr(target_pointer_width = "32", + repr(align(4)))] + #[cfg_attr(target_pointer_width = "64", + repr(align(8)))] + pub struct sem_t { + #[cfg(target_pointer_width = "32")] + __size: [::c_char; 16], + #[cfg(target_pointer_width = "64")] + __size: [::c_char; 32], + } } pub const __SIZEOF_PTHREAD_ATTR_T: usize = 36; @@ -680,6 +692,3 @@ extern "C" { cpuset: *const ::cpu_set_t, ) -> ::c_int; } - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/uclibc/mips/mips64/align.rs b/src/unix/linux_like/linux/uclibc/mips/mips64/align.rs deleted file mode 100644 index 21e21907d4a70..0000000000000 --- a/src/unix/linux_like/linux/uclibc/mips/mips64/align.rs +++ /dev/null @@ -1,10 +0,0 @@ -s! { - // FIXME this is actually a union - #[cfg_attr(target_pointer_width = "32", - repr(align(4)))] - #[cfg_attr(target_pointer_width = "64", - repr(align(8)))] - pub struct sem_t { - __size: [::c_char; 32], - } -} diff --git a/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs index 4ac13f5c77866..458dce029cd59 100644 --- a/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs @@ -185,6 +185,15 @@ s! { pub mem_unit: ::c_uint, pub _f: [::c_char; 0], } + + // FIXME(1.0): this is actually a union + #[cfg_attr(target_pointer_width = "32", + repr(align(4)))] + #[cfg_attr(target_pointer_width = "64", + repr(align(8)))] + pub struct sem_t { + __size: [::c_char; 32], + } } pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; @@ -195,6 +204,3 @@ pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 32; pub const SYS_gettid: ::c_long = 5178; // Valid for n64 - -mod align; -pub use self::align::*; diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs index 32c65545a8905..07bf7833720d1 100644 --- a/src/unix/linux_like/linux/uclibc/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mod.rs @@ -79,6 +79,29 @@ s! { pub flags: ::__u32, pub nr: ::__s32, } + + #[cfg_attr(any(target_pointer_width = "32", + target_arch = "x86_64", + target_arch = "powerpc64", + target_arch = "mips64", + target_arch = "s390x", + target_arch = "sparc64"), + repr(align(4)))] + #[cfg_attr(not(any(target_pointer_width = "32", + target_arch = "x86_64", + target_arch = "powerpc64", + target_arch = "mips64", + target_arch = "s390x", + target_arch = "sparc64")), + repr(align(8)))] + pub struct pthread_mutexattr_t { + size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], + } + + #[repr(align(4))] + pub struct pthread_condattr_t { + size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], + } } impl siginfo_t { diff --git a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs index fe657b70542ab..a52711d0243a3 100644 --- a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs +++ b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs @@ -252,7 +252,7 @@ s! { __val: [::c_int; 2], } - // FIXME this is actually a union + // FIXME(1.0): this is actually a union pub struct sem_t { #[cfg(target_pointer_width = "32")] __size: [::c_char; 16], diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 3ade3f50f16a3..6b2df6bcee381 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -200,6 +200,11 @@ s! { pub p_aliases: *mut *mut ::c_char, pub p_proto: ::c_int, } + + #[repr(align(4))] + pub struct in6_addr { + pub s6_addr: [u8; 16], + } } pub const INT_MIN: c_int = -2147483648; @@ -208,6 +213,7 @@ pub const INT_MAX: c_int = 2147483647; pub const SIG_DFL: sighandler_t = 0 as sighandler_t; pub const SIG_IGN: sighandler_t = 1 as sighandler_t; pub const SIG_ERR: sighandler_t = !0 as sighandler_t; + cfg_if! { if #[cfg(not(target_os = "nto"))] { pub const DT_UNKNOWN: u8 = 0; @@ -1684,6 +1690,3 @@ cfg_if! { } pub use ffi::c_void; - -mod align; -pub use self::align::*; diff --git a/src/unix/newlib/align.rs b/src/unix/newlib/align.rs deleted file mode 100644 index db9beb83523c2..0000000000000 --- a/src/unix/newlib/align.rs +++ /dev/null @@ -1,61 +0,0 @@ -macro_rules! expand_align { - () => { - s! { - #[cfg_attr(all(target_pointer_width = "32", - any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc")), - repr(align(4)))] - #[cfg_attr(any(target_pointer_width = "64", - not(any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc"))), - repr(align(8)))] - pub struct pthread_mutex_t { // Unverified - size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], - } - - #[cfg_attr(all(target_pointer_width = "32", - any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc")), - repr(align(4)))] - #[cfg_attr(any(target_pointer_width = "64", - not(any(target_arch = "mips", - target_arch = "arm", - target_arch = "powerpc"))), - repr(align(8)))] - pub struct pthread_rwlock_t { // Unverified - size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], - } - - #[cfg_attr(any(target_pointer_width = "32", - target_arch = "x86_64", - target_arch = "powerpc64", - target_arch = "mips64", - target_arch = "s390x", - target_arch = "sparc64"), - repr(align(4)))] - #[cfg_attr(not(any(target_pointer_width = "32", - target_arch = "x86_64", - target_arch = "powerpc64", - target_arch = "mips64", - target_arch = "s390x", - target_arch = "sparc64")), - repr(align(8)))] - pub struct pthread_mutexattr_t { // Unverified - size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], - } - - #[repr(align(8))] - pub struct pthread_cond_t { // Unverified - size: [u8; ::__SIZEOF_PTHREAD_COND_T], - } - - #[repr(align(4))] - pub struct pthread_condattr_t { // Unverified - size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], - } - } - }; -} diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index e52361f56bdf6..e3440e485771c 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -257,6 +257,62 @@ s! { pub struct pthread_rwlockattr_t { // Unverified __size: [u8; __SIZEOF_PTHREAD_RWLOCKATTR_T] } + + #[cfg_attr(all(target_pointer_width = "32", + any(target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc")), + repr(align(4)))] + #[cfg_attr(any(target_pointer_width = "64", + not(any(target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc"))), + repr(align(8)))] + pub struct pthread_mutex_t { // Unverified + size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T], + } + + #[cfg_attr(all(target_pointer_width = "32", + any(target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc")), + repr(align(4)))] + #[cfg_attr(any(target_pointer_width = "64", + not(any(target_arch = "mips", + target_arch = "arm", + target_arch = "powerpc"))), + repr(align(8)))] + pub struct pthread_rwlock_t { // Unverified + size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T], + } + + #[cfg_attr(any(target_pointer_width = "32", + target_arch = "x86_64", + target_arch = "powerpc64", + target_arch = "mips64", + target_arch = "s390x", + target_arch = "sparc64"), + repr(align(4)))] + #[cfg_attr(not(any(target_pointer_width = "32", + target_arch = "x86_64", + target_arch = "powerpc64", + target_arch = "mips64", + target_arch = "s390x", + target_arch = "sparc64")), + repr(align(8)))] + pub struct pthread_mutexattr_t { // Unverified + size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T], + } + + #[repr(align(8))] + pub struct pthread_cond_t { // Unverified + size: [u8; ::__SIZEOF_PTHREAD_COND_T], + } + + #[repr(align(4))] + pub struct pthread_condattr_t { // Unverified + size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T], + } } pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { @@ -900,7 +956,3 @@ cfg_if! { pub use self::rtems::*; } } - -#[macro_use] -mod align; -expand_align!(); diff --git a/src/windows/gnu/align.rs b/src/windows/gnu/align.rs deleted file mode 100644 index 3af99e3ca149b..0000000000000 --- a/src/windows/gnu/align.rs +++ /dev/null @@ -1,19 +0,0 @@ -cfg_if! { - if #[cfg(target_pointer_width = "64")] { - s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [f64; 4] - } - } - } else if #[cfg(target_pointer_width = "32")] { - s_no_extra_traits! { - #[allow(missing_debug_implementations)] - #[repr(align(16))] - pub struct max_align_t { - priv_: [i64; 6] - } - } - } -} diff --git a/src/windows/gnu/mod.rs b/src/windows/gnu/mod.rs index 8923a531e7512..740ea3fa548f3 100644 --- a/src/windows/gnu/mod.rs +++ b/src/windows/gnu/mod.rs @@ -1,3 +1,23 @@ +cfg_if! { + if #[cfg(target_pointer_width = "64")] { + s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f64; 4] + } + } + } else if #[cfg(target_pointer_width = "32")] { + s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [i64; 6] + } + } + } +} + pub const L_tmpnam: ::c_uint = 14; pub const TMP_MAX: ::c_uint = 0x7fff; @@ -14,6 +34,3 @@ extern "C" { // header file. We cannot find a way to link to that symbol from Rust. pub fn wmemchr(cx: *const ::wchar_t, c: ::wchar_t, n: ::size_t) -> *mut ::wchar_t; } - -mod align; -pub use self::align::*;