summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-07-30 17:52:17 +0000
committerbors <bors@rust-lang.org>2018-07-30 17:52:17 +0000
commit8565755356f23baf6b2df933ff734ce2f00c8d9b (patch)
tree418cda7a24e650c766c0459580ad1f2583ac95a3
parent7d262c091e9a839304ba23a0615f376917d066fd (diff)
parente167a73564f513e68d6c35dfa940bc7baefb9554 (diff)
downloadrust-libc-8565755356f23baf6b2df933ff734ce2f00c8d9b.tar.gz
Auto merge of #1044 - faern:modern-alignment, r=alexcrichton
Add alignment feature and use #[repr(align(x))] Trying to solve #1042. Here I introduce the discussed feature that will allow going from struct alignment with a private `__align` field to using `#[repr(align(x))]`. However, I have not implemented it for all structs that require alignment yet, only `in6_addr`. This because I did not want to spend too much time before we have discussed and solved the remaining questions regarding this. One thing to discuss is testing. I have so far not done anything to the CI scripts. So currently they will still test the crate only with the `align` feature disabled. Thus they will make sure the `__align` fields are still correct. But no automatic tests make sure everything is correct when the `align` feature is turned on. What do we want to do about that? Can we insert another `cargo test` with `--features align` to make all the Travis jobs run the test suite twice, or will that slow things down too much? I have tried using this version of libc in rustc and the standard library. And successfully changed `Ipv6Addr::new` to not use any `unsafe` and to become a `const fn`. Whether or not we want that is out of scope for this PR, but my point was that the changes introduced with this PR allow much more flexible usage of the libc structs that have alignment.
-rw-r--r--Cargo.toml1
-rw-r--r--README.md10
-rwxr-xr-xci/run.sh6
-rw-r--r--libc-test/Cargo.toml1
-rw-r--r--src/fuchsia/mod.rs148
-rw-r--r--src/macros.rs17
-rw-r--r--src/redox/net.rs2
-rw-r--r--src/unix/mod.rs2
-rw-r--r--src/unix/newlib/mod.rs95
-rw-r--r--src/unix/notbsd/emscripten.rs39
-rw-r--r--src/unix/notbsd/linux/mips/mips32.rs106
-rw-r--r--src/unix/notbsd/linux/mips/mips64.rs106
-rw-r--r--src/unix/notbsd/linux/mips/mod.rs5
-rw-r--r--src/unix/notbsd/linux/mod.rs150
-rw-r--r--src/unix/notbsd/linux/other/b32/mod.rs106
-rw-r--r--src/unix/notbsd/linux/other/b64/aarch64.rs55
-rw-r--r--src/unix/notbsd/linux/other/b64/not_x32.rs106
-rw-r--r--src/unix/notbsd/linux/other/b64/powerpc64.rs106
-rw-r--r--src/unix/notbsd/linux/other/b64/sparc64.rs49
-rw-r--r--src/unix/notbsd/linux/other/b64/x32.rs49
-rw-r--r--src/unix/notbsd/linux/other/mod.rs5
-rw-r--r--src/unix/notbsd/linux/s390x.rs54
-rw-r--r--src/unix/uclibc/mips/mips32.rs5
-rw-r--r--src/unix/uclibc/mips/mips64.rs5
-rw-r--r--src/unix/uclibc/mod.rs95
-rw-r--r--src/unix/uclibc/x86_64/mod.rs78
26 files changed, 886 insertions, 515 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 662d0ad657..c1ff5da233 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,6 +20,7 @@ appveyor = { repository = "rust-lang/libc", project_name = "rust-lang-libs/libc"
[features]
default = ["use_std"]
use_std = []
+align = []
[workspace]
members = ["libc-test"]
diff --git a/README.md b/README.md
index 5c25923281..a19a56ee0f 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,16 @@ this via:
libc = { version = "0.2", default-features = false }
```
+By default libc uses private fields in structs in order to enforce a certain
+memory alignment on them. These structs can be hard to instantiate outside of
+libc. To make libc use `#[repr(align(x))]`, instead of the private fields,
+activate the *align* feature. This requires Rust 1.25 or newer:
+
+```toml
+[dependencies]
+libc = { version = "0.2", features = ["align"] }
+```
+
## What is libc?
The primary purpose of this crate is to provide all of the definitions necessary
diff --git a/ci/run.sh b/ci/run.sh
index ffcd042186..27ffc054a0 100755
--- a/ci/run.sh
+++ b/ci/run.sh
@@ -79,7 +79,7 @@ if [ "$QEMU" != "" ]; then
exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log
fi
-# FIXME: x86_64-unknown-linux-gnux32 fail to compile wihout --release
+# FIXME: x86_64-unknown-linux-gnux32 fail to compile without --release
# See https://github.com/rust-lang/rust/issues/45417
opt=
if [ "$TARGET" = "x86_64-unknown-linux-gnux32" ]; then
@@ -91,4 +91,8 @@ fi
if [ "$TARGET" != "x86_64-rumprun-netbsd" ]; then
cargo test $opt --no-default-features --manifest-path libc-test/Cargo.toml --target $TARGET
fi
+# Test the #[repr(align(x))] feature if this is building on Rust >= 1.25
+if [ $(rustc --version | sed -E 's/^rustc 1\.([0-9]*)\..*/\1/') -ge 25 ]; then
+ cargo test $opt --features align --manifest-path libc-test/Cargo.toml --target $TARGET
+fi
exec cargo test $opt --manifest-path libc-test/Cargo.toml --target $TARGET
diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml
index 8d0f9d34e6..c6950d6ea3 100644
--- a/libc-test/Cargo.toml
+++ b/libc-test/Cargo.toml
@@ -14,6 +14,7 @@ ctest = { git = "https://github.com/alexcrichton/ctest" }
[features]
default = [ "use_std" ]
use_std = [ "libc/use_std" ]
+align = [ "libc/align" ]
[[test]]
name = "main"
diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs
index 0aac98531a..e103292979 100644
--- a/src/fuchsia/mod.rs
+++ b/src/fuchsia/mod.rs
@@ -166,8 +166,10 @@ s! {
pub s_addr: in_addr_t,
}
+ #[cfg_attr(feature = "align", repr(align(4)))]
pub struct in6_addr {
pub s6_addr: [u8; 16],
+ #[cfg(not(feature = "align"))]
__align: [u32; 0],
}
@@ -518,14 +520,30 @@ s! {
pub ifa_data: *mut ::c_void
}
+ #[cfg_attr(all(feature = "align",
+ target_pointer_width = "32",
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc",
+ target_arch = "x86_64")),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ any(target_pointer_width = "64",
+ not(any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc",
+ target_arch = "x86_64")))),
+ repr(align(8)))]
pub struct pthread_mutex_t {
- #[cfg(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc",
- all(target_arch = "x86_64",
- target_pointer_width = "32")))]
+ #[cfg(all(not(feature = "align"),
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc",
+ all(target_arch = "x86_64",
+ target_pointer_width = "32"))))]
__align: [::c_long; 0],
- #[cfg(not(any(target_arch = "mips",
+ #[cfg(not(any(feature = "align",
+ target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc",
all(target_arch = "x86_64",
@@ -534,14 +552,30 @@ s! {
size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
}
+ #[cfg_attr(all(feature = "align",
+ target_pointer_width = "32",
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc",
+ target_arch = "x86_64")),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ any(target_pointer_width = "64",
+ not(any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc",
+ target_arch = "x86_64")))),
+ repr(align(8)))]
pub struct pthread_rwlock_t {
- #[cfg(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc",
- all(target_arch = "x86_64",
- target_pointer_width = "32")))]
+ #[cfg(all(not(feature = "align"),
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc",
+ all(target_arch = "x86_64",
+ target_pointer_width = "32"))))]
__align: [::c_long; 0],
- #[cfg(not(any(target_arch = "mips",
+ #[cfg(not(any(feature = "align",
+ target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc",
all(target_arch = "x86_64",
@@ -550,39 +584,78 @@ s! {
size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
}
+ #[cfg_attr(all(feature = "align",
+ any(target_pointer_width = "32",
+ target_arch = "x86_64", target_arch = "powerpc64",
+ target_arch = "mips64", target_arch = "s390x",
+ target_arch = "sparc64",
+ all(target_arch = "aarch64", target_env = "musl"))),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ not(any(target_pointer_width = "32",
+ target_arch = "x86_64", target_arch = "powerpc64",
+ target_arch = "mips64", target_arch = "s390x",
+ target_arch = "sparc64",
+ all(target_arch = "aarch64", target_env = "musl")))),
+ repr(align(8)))]
pub struct pthread_mutexattr_t {
- #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
- target_arch = "mips64", target_arch = "s390x",
- target_arch = "sparc64"))]
- __align: [::c_int; 0],
- #[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
+ #[cfg(all(not(features = "align"),
+ any(target_arch = "x86_64", target_arch = "powerpc64",
target_arch = "mips64", target_arch = "s390x",
- target_arch = "sparc64", target_arch = "aarch64")))]
- __align: [::c_long; 0],
- #[cfg(all(target_arch = "aarch64", target_env = "gnu"))]
- __align: [::c_long; 0],
- #[cfg(all(target_arch = "aarch64", target_env = "musl"))]
+ target_arch = "sparc64",
+ all(target_arch = "aarch64", target_env = "musl"))))]
__align: [::c_int; 0],
+ #[cfg(all(not(features = "align"),
+ not(any(target_arch = "x86_64", target_arch = "powerpc64",
+ target_arch = "mips64", target_arch = "s390x",
+ target_arch = "sparc64",
+ all(target_arch = "aarch64", target_env = "musl")))))]
+ __align: [::c_long; 0],
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
}
+ #[cfg_attr(all(feature = "align",
+ any(target_env = "musl", target_pointer_width = "32")),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ not(target_env = "musl"),
+ target_pointer_width = "64"),
+ repr(align(8)))]
pub struct pthread_rwlockattr_t {
- #[cfg(any(target_env = "musl"))]
+ #[cfg(all(not(feature = "align"), target_env = "musl"))]
__align: [::c_int; 0],
- #[cfg(not(any(target_env = "musl")))]
+ #[cfg(all(not(feature = "align"), not(target_env = "musl")))]
__align: [::c_long; 0],
size: [u8; __SIZEOF_PTHREAD_RWLOCKATTR_T],
}
+ #[cfg_attr(all(feature = "align",
+ target_env = "musl",
+ target_pointer_width = "32"),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ target_env = "musl",
+ target_pointer_width = "64"),
+ repr(align(8)))]
+ #[cfg_attr(all(feature = "align",
+ not(target_env = "musl"),
+ target_arch = "x86"),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ not(target_env = "musl"),
+ not(target_arch = "x86")),
+ repr(align(8)))]
pub struct pthread_cond_t {
- #[cfg(any(target_env = "musl"))]
+ #[cfg(all(not(feature = "align"), target_env = "musl"))]
__align: [*const ::c_void; 0],
- #[cfg(not(any(target_env = "musl")))]
+ #[cfg(not(any(feature = "align", target_env = "musl")))]
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_COND_T],
}
+ #[cfg_attr(feature = "align", repr(align(4)))]
pub struct pthread_condattr_t {
+ #[cfg(not(feature = "align"))]
__align: [::c_int; 0],
size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
}
@@ -2004,18 +2077,17 @@ pub const RTLD_NOW: ::c_int = 0x2;
pub const TCP_MD5SIG: ::c_int = 14;
-pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
- __align: [],
- size: [0; __SIZEOF_PTHREAD_MUTEX_T],
-};
-pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
- __align: [],
- size: [0; __SIZEOF_PTHREAD_COND_T],
-};
-pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
- __align: [],
- size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
-};
+align_const! {
+ pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
+ size: [0; __SIZEOF_PTHREAD_MUTEX_T],
+ };
+ pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
+ size: [0; __SIZEOF_PTHREAD_COND_T],
+ };
+ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
+ size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
+ };
+}
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
diff --git a/src/macros.rs b/src/macros.rs
index 2abab5002f..f48ad45941 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -69,3 +69,20 @@ macro_rules! f {
macro_rules! __item {
($i:item) => ($i)
}
+
+#[allow(unused_macros)]
+macro_rules! align_const {
+ ($($(#[$attr:meta])* pub const $name:ident : $t1:ty = $t2:ident { $($field:tt)* };)*) => ($(
+ #[cfg(feature = "align")]
+ $(#[$attr])*
+ pub const $name : $t1 = $t2 {
+ $($field)*
+ };
+ #[cfg(not(feature = "align"))]
+ $(#[$attr])*
+ pub const $name : $t1 = $t2 {
+ $($field)*
+ __align: [],
+ };
+ )*)
+}
diff --git a/src/redox/net.rs b/src/redox/net.rs
index a545ba4795..fcbb181c32 100644
--- a/src/redox/net.rs
+++ b/src/redox/net.rs
@@ -9,8 +9,10 @@ s! {
pub s_addr: in_addr_t,
}
+ #[cfg_attr(feature = "align", repr(align(4)))]
pub struct in6_addr {
pub s6_addr: [u8; 16],
+ #[cfg(not(feature = "align"))]
__align: [u32; 0],
}
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index 89cc1e3348..d0e054cc27 100644
--- a/src/unix/mod.rs
+++ b/src/unix/mod.rs
@@ -104,8 +104,10 @@ s! {
pub s_addr: in_addr_t,
}
+ #[cfg_attr(feature = "align", repr(align(4)))]
pub struct in6_addr {
pub s6_addr: [u8; 16],
+ #[cfg(not(feature = "align"))]
__align: [u32; 0],
}
diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs
index 6cf8633e6b..9968d36685 100644
--- a/src/unix/newlib/mod.rs
+++ b/src/unix/newlib/mod.rs
@@ -238,34 +238,80 @@ s! {
__size: [u64; 7]
}
+ #[cfg_attr(all(feature = "align",
+ target_pointer_width = "32",
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc")),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ 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
- #[cfg(any(target_arch = "mips", target_arch = "arm",
- target_arch = "powerpc"))]
+ #[cfg(all(not(feature = "align"),
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc")))]
__align: [::c_long; 0],
- #[cfg(not(any(target_arch = "mips", target_arch = "arm",
+ #[cfg(not(any(feature = "align",
+ target_arch = "mips",
+ target_arch = "arm",
target_arch = "powerpc")))]
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
}
+ #[cfg_attr(all(feature = "align",
+ target_pointer_width = "32",
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc")),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ 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
- #[cfg(any(target_arch = "mips", target_arch = "arm",
- target_arch = "powerpc"))]
+ #[cfg(all(not(feature = "align"),
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc")))]
__align: [::c_long; 0],
- #[cfg(not(any(target_arch = "mips", target_arch = "arm",
+ #[cfg(not(any(feature = "align",
+ target_arch = "mips",
+ target_arch = "arm",
target_arch = "powerpc")))]
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
}
+ #[cfg_attr(all(feature = "align",
+ 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(all(feature = "align",
+ 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
- #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
- target_arch = "mips64", target_arch = "s390x",
- target_arch = "sparc64"))]
- __align: [::c_int; 0],
- #[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
+ #[cfg(all(not(feature = "align"),
+ any(target_arch = "x86_64", target_arch = "powerpc64",
target_arch = "mips64", target_arch = "s390x",
target_arch = "sparc64")))]
+ __align: [::c_int; 0],
+ #[cfg(all(not(feature = "align"),
+ not(any(target_arch = "x86_64", target_arch = "powerpc64",
+ target_arch = "mips64", target_arch = "s390x",
+ target_arch = "sparc64"))))]
__align: [::c_long; 0],
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
}
@@ -275,12 +321,16 @@ s! {
__pshared: ::c_int,
}
+ #[cfg_attr(feature = "align", repr(align(8)))]
pub struct pthread_cond_t { // Unverified
+ #[cfg(not(feature = "align"))]
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_COND_T],
}
+ #[cfg_attr(feature = "align", repr(align(4)))]
pub struct pthread_condattr_t { // Unverified
+ #[cfg(not(feature = "align"))]
__align: [::c_int; 0],
size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
}
@@ -288,18 +338,17 @@ s! {
}
// unverified constants
-pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
- __align: [],
- size: [0; __SIZEOF_PTHREAD_MUTEX_T],
-};
-pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
- __align: [],
- size: [0; __SIZEOF_PTHREAD_COND_T],
-};
-pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
- __align: [],
- size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
-};
+align_const! {
+ pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
+ size: [0; __SIZEOF_PTHREAD_MUTEX_T],
+ };
+ pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
+ size: [0; __SIZEOF_PTHREAD_COND_T],
+ };
+ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
+ size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
+ };
+}
pub const NCCS: usize = 32;
pub const __SIZEOF_PTHREAD_ATTR_T: usize = 56;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
diff --git a/src/unix/notbsd/emscripten.rs b/src/unix/notbsd/emscripten.rs
index 6216947ee5..b30fee3232 100644
--- a/src/unix/notbsd/emscripten.rs
+++ b/src/unix/notbsd/emscripten.rs
@@ -72,32 +72,47 @@ s! {
__unused5: *mut ::c_void,
}
+ #[cfg_attr(feature = "align", repr(align(4)))]
pub struct pthread_mutex_t {
+ #[cfg(not(feature = "align"))]
__align: [::c_long; 0],
size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
}
+ #[cfg_attr(feature = "align", repr(align(4)))]
pub struct pthread_rwlock_t {
+ #[cfg(not(feature = "align"))]
__align: [::c_long; 0],
size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
}
+ #[cfg_attr(feature = "align", repr(align(4)))]
pub struct pthread_mutexattr_t {
+ #[cfg(not(feature = "align"))]
__align: [::c_int; 0],
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
}
+ #[cfg_attr(feature = "align", repr(align(4)))]
pub struct pthread_rwlockattr_t {
+ #[cfg(not(feature = "align"))]
__align: [::c_int; 0],
size: [u8; __SIZEOF_PTHREAD_RWLOCKATTR_T],
}
+ #[cfg_attr(all(feature = "align", target_pointer_width = "32"),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align", target_pointer_width = "64"),
+ repr(align(8)))]
pub struct pthread_cond_t {
+ #[cfg(not(feature = "align"))]
__align: [*const ::c_void; 0],
size: [u8; __SIZEOF_PTHREAD_COND_T],
}
+ #[cfg_attr(feature = "align", repr(align(4)))]
pub struct pthread_condattr_t {
+ #[cfg(not(feature = "align"))]
__align: [::c_int; 0],
size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
}
@@ -747,18 +762,18 @@ pub const RTLD_NOW: ::c_int = 0x2;
pub const TCP_MD5SIG: ::c_int = 14;
-pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
- __align: [],
- size: [0; __SIZEOF_PTHREAD_MUTEX_T],
-};
-pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
- __align: [],
- size: [0; __SIZEOF_PTHREAD_COND_T],
-};
-pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
- __align: [],
- size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
-};
+align_const! {
+ pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
+ size: [0; __SIZEOF_PTHREAD_MUTEX_T],
+ };
+ pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
+ size: [0; __SIZEOF_PTHREAD_COND_T],
+ };
+ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
+ size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
+ };
+}
+
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
diff --git a/src/unix/notbsd/linux/mips/mips32.rs b/src/unix/notbsd/linux/mips/mips32.rs
index d9d5035bf2..a6c08a5ad7 100644
--- a/src/unix/notbsd/linux/mips/mips32.rs
+++ b/src/unix/notbsd/linux/mips/mips32.rs
@@ -1,3 +1,5 @@
+use pthread_mutex_t;
+
pub type c_char = i8;
pub type c_long = i32;
pub type c_ulong = u32;
@@ -278,60 +280,56 @@ pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
-#[cfg(target_endian = "little")]
-pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,
- ],
- };
-#[cfg(target_endian = "little")]
-pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,
- ],
- };
-#[cfg(target_endian = "little")]
-pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,
- ],
- };
-#[cfg(target_endian = "big")]
-pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0,
- ],
- };
-#[cfg(target_endian = "big")]
-pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
- 0, 0,
- ],
- };
-#[cfg(target_endian = "big")]
-pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
- 0, 0,
- ],
- };
+align_const! {
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 0,
+ ],
+ };
+}
pub const O_LARGEFILE: ::c_int = 0x2000;
diff --git a/src/unix/notbsd/linux/mips/mips64.rs b/src/unix/notbsd/linux/mips/mips64.rs
index 747b97bd0b..e8b02a36b0 100644
--- a/src/unix/notbsd/linux/mips/mips64.rs
+++ b/src/unix/notbsd/linux/mips/mips64.rs
@@ -1,3 +1,5 @@
+use pthread_mutex_t;
+
pub type blkcnt_t = i64;
pub type blksize_t = i64;
pub type c_char = i8;
@@ -262,60 +264,56 @@ pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
-#[cfg(target_endian = "little")]
-pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-#[cfg(target_endian = "little")]
-pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-#[cfg(target_endian = "little")]
-pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-#[cfg(target_endian = "big")]
-pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-#[cfg(target_endian = "big")]
-pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-#[cfg(target_endian = "big")]
-pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
+align_const! {
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+}
pub const O_LARGEFILE: ::c_int = 0;
diff --git a/src/unix/notbsd/linux/mips/mod.rs b/src/unix/notbsd/linux/mips/mod.rs
index 833a3210cc..4c14d12ebc 100644
--- a/src/unix/notbsd/linux/mips/mod.rs
+++ b/src/unix/notbsd/linux/mips/mod.rs
@@ -21,11 +21,16 @@ s! {
}
// FIXME this is actually a union
+ #[cfg_attr(all(feature = "align", target_pointer_width = "32"),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align", 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],
+ #[cfg(not(feature = "align"))]
__align: [::c_long; 0],
}
diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs
index e1e3503906..6bc7db191c 100644
--- a/src/unix/notbsd/linux/mod.rs
+++ b/src/unix/notbsd/linux/mod.rs
@@ -71,14 +71,32 @@ s! {
__unused5: *mut ::c_void,
}
+ #[cfg_attr(all(feature = "align",
+ target_pointer_width = "32",
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc",
+ target_arch = "x86_64",
+ target_arch = "x86")),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ any(target_pointer_width = "64",
+ not(any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc",
+ target_arch = "x86_64",
+ target_arch = "x86")))),
+ repr(align(8)))]
pub struct pthread_mutex_t {
- #[cfg(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc",
- all(target_arch = "x86_64",
- target_pointer_width = "32")))]
+ #[cfg(all(not(feature = "align"),
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc",
+ all(target_arch = "x86_64",
+ target_pointer_width = "32"))))]
__align: [::c_long; 0],
- #[cfg(not(any(target_arch = "mips",
+ #[cfg(not(any(feature = "align",
+ target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc",
all(target_arch = "x86_64",
@@ -87,14 +105,32 @@ s! {
size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
}
+ #[cfg_attr(all(feature = "align",
+ target_pointer_width = "32",
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc",
+ target_arch = "x86_64",
+ target_arch = "x86")),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ any(target_pointer_width = "64",
+ not(any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc",
+ target_arch = "x86_64",
+ target_arch = "x86")))),
+ repr(align(8)))]
pub struct pthread_rwlock_t {
- #[cfg(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc",
- all(target_arch = "x86_64",
- target_pointer_width = "32")))]
+ #[cfg(all(not(feature = "align"),
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc",
+ all(target_arch = "x86_64",
+ target_pointer_width = "32"))))]
__align: [::c_long; 0],
- #[cfg(not(any(target_arch = "mips",
+ #[cfg(not(any(feature = "align",
+ target_arch = "mips",
target_arch = "arm",
target_arch = "powerpc",
all(target_arch = "x86_64",
@@ -103,39 +139,78 @@ s! {
size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
}
+ #[cfg_attr(all(feature = "align",
+ any(target_pointer_width = "32",
+ target_arch = "x86_64", target_arch = "powerpc64",
+ target_arch = "mips64", target_arch = "s390x",
+ target_arch = "sparc64",
+ all(target_arch = "aarch64", target_env = "musl"))),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ not(any(target_pointer_width = "32",
+ target_arch = "x86_64", target_arch = "powerpc64",
+ target_arch = "mips64", target_arch = "s390x",
+ target_arch = "sparc64",
+ all(target_arch = "aarch64", target_env = "musl")))),
+ repr(align(8)))]
pub struct pthread_mutexattr_t {
- #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
- target_arch = "mips64", target_arch = "s390x",
- target_arch = "sparc64"))]
- __align: [::c_int; 0],
- #[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
+ #[cfg(all(not(features = "align"),
+ any(target_arch = "x86_64", target_arch = "powerpc64",
target_arch = "mips64", target_arch = "s390x",
- target_arch = "sparc64", target_arch = "aarch64")))]
- __align: [::c_long; 0],
- #[cfg(all(target_arch = "aarch64", target_env = "gnu"))]
- __align: [::c_long; 0],
- #[cfg(all(target_arch = "aarch64", target_env = "musl"))]
+ target_arch = "sparc64",
+ all(target_arch = "aarch64", target_env = "musl"))))]
__align: [::c_int; 0],
+ #[cfg(all(not(features = "align"),
+ not(any(target_arch = "x86_64", target_arch = "powerpc64",
+ target_arch = "mips64", target_arch = "s390x",
+ target_arch = "sparc64",
+ all(target_arch = "aarch64", target_env = "musl")))))]
+ __align: [::c_long; 0],
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
}
+ #[cfg_attr(all(feature = "align",
+ any(target_env = "musl", target_pointer_width = "32")),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ not(target_env = "musl"),
+ target_pointer_width = "64"),
+ repr(align(8)))]
pub struct pthread_rwlockattr_t {
- #[cfg(any(target_env = "musl"))]
+ #[cfg(all(not(feature = "align"), target_env = "musl"))]
__align: [::c_int; 0],
- #[cfg(not(any(target_env = "musl")))]
+ #[cfg(all(not(feature = "align"), not(target_env = "musl")))]
__align: [::c_long; 0],
size: [u8; __SIZEOF_PTHREAD_RWLOCKATTR_T],
}
+ #[cfg_attr(all(feature = "align",
+ target_env = "musl",
+ target_pointer_width = "32"),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ target_env = "musl",
+ target_pointer_width = "64"),
+ repr(align(8)))]
+ #[cfg_attr(all(feature = "align",
+ not(target_env = "musl"),
+ target_arch = "x86"),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ not(target_env = "musl"),
+ not(target_arch = "x86")),
+ repr(align(8)))]
pub struct pthread_cond_t {
- #[cfg(any(target_env = "musl"))]
+ #[cfg(all(not(feature = "align"), target_env = "musl"))]
__align: [*const ::c_void; 0],
- #[cfg(not(any(target_env = "musl")))]
+ #[cfg(not(any(feature = "align", target_env = "musl")))]
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_COND_T],
}
+ #[cfg_attr(feature = "align", repr(align(4)))]
pub struct pthread_condattr_t {
+ #[cfg(not(feature = "align"))]
__align: [::c_int; 0],
size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
}
@@ -792,18 +867,17 @@ pub const RTLD_NOW: ::c_int = 0x2;
pub const TCP_MD5SIG: ::c_int = 14;
-pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
- __align: [],
- size: [0; __SIZEOF_PTHREAD_MUTEX_T],
-};
-pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
- __align: [],
- size: [0; __SIZEOF_PTHREAD_COND_T],
-};
-pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
- __align: [],
- size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
-};
+align_const! {
+ pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
+ size: [0; __SIZEOF_PTHREAD_MUTEX_T],
+ };
+ pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
+ size: [0; __SIZEOF_PTHREAD_COND_T],
+ };
+ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
+ size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
+ };
+}
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
diff --git a/src/unix/notbsd/linux/other/b32/mod.rs b/src/unix/notbsd/linux/other/b32/mod.rs
index 88a5d6cc6c..5b0142ab89 100644
--- a/src/unix/notbsd/linux/other/b32/mod.rs
+++ b/src/unix/notbsd/linux/other/b32/mod.rs
@@ -1,5 +1,7 @@
//! 32-bit specific definitions for linux-like values
+use pthread_mutex_t;
+
pub type c_long = i32;
pub type c_ulong = u32;
pub type clock_t = i32;
@@ -299,60 +301,56 @@ pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
-#[cfg(target_endian = "little")]
-pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,
- ],
- };
-#[cfg(target_endian = "little")]
-pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,
- ],
- };
-#[cfg(target_endian = "little")]
-pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,
- ],
- };
-#[cfg(target_endian = "big")]
-pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0,
- ],
- };
-#[cfg(target_endian = "big")]
-pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0,
- 0, 0,
- ],
- };
-#[cfg(target_endian = "big")]
-pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
- 0, 0,
- ],
- };
+align_const! {
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 0,
+ ],
+ };
+}
pub const PTRACE_GETFPREGS: ::c_uint = 14;
pub const PTRACE_SETFPREGS: ::c_uint = 15;
diff --git a/src/unix/notbsd/linux/other/b64/aarch64.rs b/src/unix/notbsd/linux/other/b64/aarch64.rs
index cfa8592b20..2ba27a72b8 100644
--- a/src/unix/notbsd/linux/other/b64/aarch64.rs
+++ b/src/unix/notbsd/linux/other/b64/aarch64.rs
@@ -1,5 +1,7 @@
//! AArch64-specific definitions for 64-bit linux-like values
+use pthread_mutex_t;
+
pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = u8;
@@ -386,33 +388,32 @@ pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 8;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 48;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 8;
-pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,
- ],
- };
-pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,
- ],
- };
-pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0,
- ],
- };
+align_const! {
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ ],
+ };
+}
pub const O_DIRECT: ::c_int = 0x10000;
pub const O_DIRECTORY: ::c_int = 0x4000;
diff --git a/src/unix/notbsd/linux/other/b64/not_x32.rs b/src/unix/notbsd/linux/other/b64/not_x32.rs
index 7f42125e56..e3e449807f 100644
--- a/src/unix/notbsd/linux/other/b64/not_x32.rs
+++ b/src/unix/notbsd/linux/other/b64/not_x32.rs
@@ -1,3 +1,5 @@
+use pthread_mutex_t;
+
pub type c_long = i64;
pub type c_ulong = u64;
@@ -21,60 +23,56 @@ s! {
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
-#[cfg(target_endian = "little")]
-pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-#[cfg(target_endian = "little")]
-pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-#[cfg(target_endian = "little")]
-pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-#[cfg(target_endian = "big")]
-pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-#[cfg(target_endian = "big")]
-pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-#[cfg(target_endian = "big")]
-pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
+align_const! {
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+}
// Syscall table
diff --git a/src/unix/notbsd/linux/other/b64/powerpc64.rs b/src/unix/notbsd/linux/other/b64/powerpc64.rs
index 858aa243d9..9dd91f0fdd 100644
--- a/src/unix/notbsd/linux/other/b64/powerpc64.rs
+++ b/src/unix/notbsd/linux/other/b64/powerpc64.rs
@@ -1,5 +1,7 @@
//! PowerPC64-specific definitions for 64-bit linux-like values
+use pthread_mutex_t;
+
pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = u8;
@@ -373,60 +375,56 @@ pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
-#[cfg(target_endian = "little")]
-pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-#[cfg(target_endian = "little")]
-pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-#[cfg(target_endian = "little")]
-pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-#[cfg(target_endian = "big")]
-pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-#[cfg(target_endian = "big")]
-pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-#[cfg(target_endian = "big")]
-pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
+align_const! {
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+}
pub const O_DIRECTORY: ::c_int = 0x4000;
pub const O_NOFOLLOW: ::c_int = 0x8000;
diff --git a/src/unix/notbsd/linux/other/b64/sparc64.rs b/src/unix/notbsd/linux/other/b64/sparc64.rs
index 8deef063cb..34438a7353 100644
--- a/src/unix/notbsd/linux/other/b64/sparc64.rs
+++ b/src/unix/notbsd/linux/other/b64/sparc64.rs
@@ -1,5 +1,7 @@
//! SPARC64-specific definitions for 64-bit linux-like values
+use pthread_mutex_t;
+
pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = i8;
@@ -349,30 +351,29 @@ pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
-pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
+align_const! {
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+}
pub const O_DIRECTORY: ::c_int = 0o200000;
pub const O_NOFOLLOW: ::c_int = 0o400000;
diff --git a/src/unix/notbsd/linux/other/b64/x32.rs b/src/unix/notbsd/linux/other/b64/x32.rs
index 9eb30c84b7..d88dbafed8 100644
--- a/src/unix/notbsd/linux/other/b64/x32.rs
+++ b/src/unix/notbsd/linux/other/b64/x32.rs
@@ -1,3 +1,5 @@
+use pthread_mutex_t;
+
pub type c_long = i32;
pub type c_ulong = u32;
@@ -21,30 +23,29 @@ s! {
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 32;
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 44;
-pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
+align_const! {
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+}
// Syscall table
diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs
index 6a326dd20e..93b710b8df 100644
--- a/src/unix/notbsd/linux/other/mod.rs
+++ b/src/unix/notbsd/linux/other/mod.rs
@@ -158,11 +158,16 @@ s! {
}
// FIXME this is actually a union
+ #[cfg_attr(all(feature = "align", target_pointer_width = "32"),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align", 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],
+ #[cfg(not(feature = "align"))]
__align: [::c_long; 0],
}
diff --git a/src/unix/notbsd/linux/s390x.rs b/src/unix/notbsd/linux/s390x.rs
index 61745a36cf..9196f88b45 100644
--- a/src/unix/notbsd/linux/s390x.rs
+++ b/src/unix/notbsd/linux/s390x.rs
@@ -1,3 +1,5 @@
+use pthread_mutex_t;
+
pub type blkcnt_t = i64;
pub type blksize_t = i64;
pub type c_char = u8;
@@ -245,8 +247,13 @@ s! {
}
// FIXME this is actually a union
+ #[cfg_attr(all(feature = "align", target_pointer_width = "32"),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align", target_pointer_width = "64"),
+ repr(align(8)))]
pub struct sem_t {
__size: [::c_char; 32],
+ #[cfg(not(feature = "align"))]
__align: [::c_long; 0],
}
@@ -371,30 +378,29 @@ pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
-pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
-pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- ::pthread_mutex_t {
- __align: [],
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- ],
- };
+align_const! {
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+}
pub const EADDRINUSE: ::c_int = 98;
pub const EADDRNOTAVAIL: ::c_int = 99;
diff --git a/src/unix/uclibc/mips/mips32.rs b/src/unix/uclibc/mips/mips32.rs
index 7ad547c0ae..dcbfcf8ff2 100644
--- a/src/unix/uclibc/mips/mips32.rs
+++ b/src/unix/uclibc/mips/mips32.rs
@@ -222,11 +222,16 @@ s! {
}
// FIXME this is actually a union
+ #[cfg_attr(all(feature = "align", target_pointer_width = "32"),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align", 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],
+ #[cfg(not(feature = "align"))]
__align: [::c_long; 0],
}
}
diff --git a/src/unix/uclibc/mips/mips64.rs b/src/unix/uclibc/mips/mips64.rs
index 79bac1fa8a..e35938b1fc 100644
--- a/src/unix/uclibc/mips/mips64.rs
+++ b/src/unix/uclibc/mips/mips64.rs
@@ -188,8 +188,13 @@ s! {
}
// FIXME this is actually a union
+ #[cfg_attr(all(feature = "align", target_pointer_width = "32"),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align", target_pointer_width = "64"),
+ repr(align(8)))]
pub struct sem_t {
__size: [::c_char; 32],
+ #[cfg(not(feature = "align"))]
__align: [::c_long; 0],
}
}
diff --git a/src/unix/uclibc/mod.rs b/src/unix/uclibc/mod.rs
index e9c1f21e9e..e3606c2266 100644
--- a/src/unix/uclibc/mod.rs
+++ b/src/unix/uclibc/mod.rs
@@ -224,34 +224,80 @@ s! {
pub ifa_data: *mut ::c_void
}
+ #[cfg_attr(all(feature = "align",
+ target_pointer_width = "32",
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc")),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ any(target_pointer_width = "64",
+ not(any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc")))),
+ repr(align(8)))]
pub struct pthread_mutex_t {
- #[cfg(any(target_arch = "mips", target_arch = "arm",
- target_arch = "powerpc"))]
+ #[cfg(all(not(feature = "align"),
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc")))]
__align: [::c_long; 0],
- #[cfg(not(any(target_arch = "mips", target_arch = "arm",
+ #[cfg(not(any(feature = "align",
+ target_arch = "mips",
+ target_arch = "arm",
target_arch = "powerpc")))]
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
}
+ #[cfg_attr(all(feature = "align",
+ target_pointer_width = "32",
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc")),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ any(target_pointer_width = "64",
+ not(any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc")))),
+ repr(align(8)))]
pub struct pthread_rwlock_t {
- #[cfg(any(target_arch = "mips", target_arch = "arm",
- target_arch = "powerpc"))]
+ #[cfg(all(not(feature = "align"),
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc")))]
__align: [::c_long; 0],
- #[cfg(not(any(target_arch = "mips", target_arch = "arm",
+ #[cfg(not(any(feature = "align",
+ target_arch = "mips",
+ target_arch = "arm",
target_arch = "powerpc")))]
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
}
+ #[cfg_attr(all(feature = "align",
+ 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(all(feature = "align",
+ 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 {
- #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
- target_arch = "mips64", target_arch = "s390x",
- target_arch = "sparc64"))]
- __align: [::c_int; 0],
- #[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
+ #[cfg(all(not(feature = "align"),
+ any(target_arch = "x86_64", target_arch = "powerpc64",
target_arch = "mips64", target_arch = "s390x",
target_arch = "sparc64")))]
+ __align: [::c_int; 0],
+ #[cfg(all(not(feature = "align"),
+ not(any(target_arch = "x86_64", target_arch = "powerpc64",
+ target_arch = "mips64", target_arch = "s390x",
+ target_arch = "sparc64"))))]
__align: [::c_long; 0],
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
}
@@ -261,12 +307,16 @@ s! {
__pshared: ::c_int,
}
+ #[cfg_attr(feature = "align", repr(align(8)))]
pub struct pthread_cond_t {
+ #[cfg(not(feature = "align"))]
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_COND_T],
}
+ #[cfg_attr(feature = "align", repr(align(4)))]
pub struct pthread_condattr_t {
+ #[cfg(not(feature = "align"))]
__align: [::c_int; 0],
size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
}
@@ -1116,18 +1166,17 @@ pub const RTLD_NOW: ::c_int = 0x2;
pub const TCP_MD5SIG: ::c_int = 14;
-pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
- __align: [],
- size: [0; __SIZEOF_PTHREAD_MUTEX_T],
-};
-pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
- __align: [],
- size: [0; __SIZEOF_PTHREAD_COND_T],
-};
-pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
- __align: [],
- size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
-};
+align_const! {
+ pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
+ size: [0; __SIZEOF_PTHREAD_MUTEX_T],
+ };
+ pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
+ size: [0; __SIZEOF_PTHREAD_COND_T],
+ };
+ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
+ size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
+ };
+}
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
diff --git a/src/unix/uclibc/x86_64/mod.rs b/src/unix/uclibc/x86_64/mod.rs
index bfd46447fd..bc6571aff9 100644
--- a/src/unix/uclibc/x86_64/mod.rs
+++ b/src/unix/uclibc/x86_64/mod.rs
@@ -133,6 +133,7 @@ s! {
//
// pub struct in6_addr {
// pub s6_addr: [u8; 16],
+// #[cfg(not(feature = "align"))]
// __align: [u32; 0],
// }
@@ -204,51 +205,106 @@ s! {
pub c_cc: [::cc_t; ::NCCS],
}
+ #[cfg_attr(all(feature = "align", target_pointer_width = "32"),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align", target_pointer_width = "64"),
+ repr(align(8)))]
pub struct sem_t { // ToDo
#[cfg(target_pointer_width = "32")]
__size: [::c_char; 16],
#[cfg(target_pointer_width = "64")]
__size: [::c_char; 32],
+ #[cfg(not(feature = "align"))]
__align: [::c_long; 0],
}
+ #[cfg_attr(all(feature = "align",
+ target_pointer_width = "32",
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc")),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ any(target_pointer_width = "64",
+ not(any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc")))),
+ repr(align(8)))]
pub struct pthread_mutex_t { // ToDo
- #[cfg(any(target_arch = "mips", target_arch = "arm",
- target_arch = "powerpc"))]
+ #[cfg(all(not(feature = "align"),
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc")))]
__align: [::c_long; 0],
- #[cfg(not(any(target_arch = "mips", target_arch = "arm",
+ #[cfg(not(any(feature = "align",
+ target_arch = "mips",
+ target_arch = "arm",
target_arch = "powerpc")))]
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
}
+ #[cfg_attr(all(feature = "align",
+ 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(all(feature = "align",
+ 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 { // ToDo
- #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
- target_arch = "mips64", target_arch = "s390x",
- target_arch = "sparc64"))]
- __align: [::c_int; 0],
- #[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
+ #[cfg(all(not(feature = "align"),
+ any(target_arch = "x86_64", target_arch = "powerpc64",
target_arch = "mips64", target_arch = "s390x",
target_arch = "sparc64")))]
+ __align: [::c_int; 0],
+ #[cfg(all(not(feature = "align"),
+ not(any(target_arch = "x86_64", target_arch = "powerpc64",
+ target_arch = "mips64", target_arch = "s390x",
+ target_arch = "sparc64"))))]
__align: [::c_long; 0],
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
}
+ #[cfg_attr(feature = "align", repr(align(8)))]
pub struct pthread_cond_t { // ToDo
+ #[cfg(not(feature = "align"))]
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_COND_T],
}
+ #[cfg_attr(feature = "align", repr(align(4)))]
pub struct pthread_condattr_t { // ToDo
+ #[cfg(not(feature = "align"))]
__align: [::c_int; 0],
size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
}
+ #[cfg_attr(all(feature = "align",
+ target_pointer_width = "32",
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc")),
+ repr(align(4)))]
+ #[cfg_attr(all(feature = "align",
+ any(target_pointer_width = "64",
+ not(any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc")))),
+ repr(align(8)))]
pub struct pthread_rwlock_t { // ToDo
- #[cfg(any(target_arch = "mips", target_arch = "arm",
- target_arch = "powerpc"))]
+ #[cfg(all(not(feature = "align"),
+ any(target_arch = "mips",
+ target_arch = "arm",
+ target_arch = "powerpc")))]
__align: [::c_long; 0],
- #[cfg(not(any(target_arch = "mips", target_arch = "arm",
+ #[cfg(not(any(feature = "align",
+ target_arch = "mips",
+ target_arch = "arm",
target_arch = "powerpc")))]
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],