summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml19
-rw-r--r--Cargo.toml1
-rw-r--r--README.md10
-rw-r--r--ci/ios/deploy_and_run_on_ios_simulator.rs1
-rwxr-xr-xci/run.sh6
-rw-r--r--libc-test/Cargo.toml1
-rw-r--r--libc-test/build.rs67
-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/bsd/apple/b64.rs2
-rw-r--r--src/unix/bsd/apple/mod.rs19
-rw-r--r--src/unix/mod.rs3
-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
31 files changed, 966 insertions, 544 deletions
diff --git a/.travis.yml b/.travis.yml
index da3124db08..b6a73f00c2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -41,10 +41,10 @@ matrix:
- env: TARGET=i686-unknown-linux-gnu
- os: osx
env: TARGET=x86_64-apple-darwin NO_ADD=1
- osx_image: xcode8.3
+ osx_image: xcode9.4
- os: osx
env: TARGET=i686-apple-darwin
- osx_image: xcode8.3
+ osx_image: xcode9.4
- env: TARGET=arm-linux-androideabi
- env: TARGET=aarch64-linux-android
# FIXME(#826) should reenable
@@ -59,14 +59,14 @@ matrix:
# FIXME(#856)
rust: 1.22.1
- os: osx
- osx_image: xcode8.2
+ osx_image: xcode9.4
env: TARGET=i386-apple-ios
CARGO_TARGET_I386_APPLE_IOS_RUNNER=$HOME/runtest
RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
before_install:
rustc ./ci/ios/deploy_and_run_on_ios_simulator.rs -o $HOME/runtest
- os: osx
- osx_image: xcode8.2
+ osx_image: xcode9.4
env: TARGET=x86_64-apple-ios
CARGO_TARGET_X86_64_APPLE_IOS_RUNNER=$HOME/runtest
RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
@@ -91,7 +91,7 @@ matrix:
rust: beta
- os: osx
env: TARGET=x86_64-apple-darwin NO_ADD=1
- osx_image: xcode8.3
+ osx_image: xcode9.4
rust: beta
# nightly
@@ -99,7 +99,7 @@ matrix:
rust: nightly
- os: osx
env: TARGET=x86_64-apple-darwin NO_ADD=1
- osx_image: xcode8.3
+ osx_image: xcode9.4
rust: nightly
# not available on stable
# without --release the build fails
@@ -109,6 +109,13 @@ matrix:
# QEMU based targets that compile in an emulator
- env: TARGET=x86_64-unknown-freebsd
+ allow_failures:
+ - env: TARGET=i386-apple-ios
+ CARGO_TARGET_I386_APPLE_IOS_RUNNER=$HOME/runtest
+ RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
+ - env: TARGET=x86_64-apple-ios
+ CARGO_TARGET_X86_64_APPLE_IOS_RUNNER=$HOME/runtest
+ RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
notifications:
email:
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/ios/deploy_and_run_on_ios_simulator.rs b/ci/ios/deploy_and_run_on_ios_simulator.rs
index b14615036d..95df52d76d 100644
--- a/ci/ios/deploy_and_run_on_ios_simulator.rs
+++ b/ci/ios/deploy_and_run_on_ios_simulator.rs
@@ -123,6 +123,7 @@ fn run_app_on_simulator() {
.arg("com.rust.unittests")
.output());
+ println!("status: {}", output.status);
println!("stdout --\n{}\n", String::from_utf8_lossy(&output.stdout));
println!("stderr --\n{}\n", String::from_utf8_lossy(&output.stderr));
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/libc-test/build.rs b/libc-test/build.rs
index 6c2ac5496e..d46372b44b 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -15,6 +15,7 @@ fn main() {
let linux = target.contains("unknown-linux");
let android = target.contains("android");
let apple = target.contains("apple");
+ let ios = target.contains("apple-ios");
let emscripten = target.contains("asm");
let musl = target.contains("musl") || emscripten;
let uclibc = target.contains("uclibc");
@@ -84,8 +85,10 @@ fn main() {
cfg.header("sys/socket.h");
}
cfg.header("net/if.h");
- cfg.header("net/route.h");
- cfg.header("net/if_arp.h");
+ if !ios {
+ cfg.header("net/route.h");
+ cfg.header("net/if_arp.h");
+ }
cfg.header("netdb.h");
cfg.header("netinet/in.h");
cfg.header("netinet/ip.h");
@@ -113,7 +116,7 @@ fn main() {
cfg.header("pwd.h");
cfg.header("grp.h");
cfg.header("sys/utsname.h");
- if !solaris {
+ if !solaris && !ios {
cfg.header("sys/ptrace.h");
}
cfg.header("sys/mount.h");
@@ -175,19 +178,22 @@ fn main() {
cfg.header("util.h");
cfg.header("xlocale.h");
cfg.header("sys/xattr.h");
- cfg.header("sys/sys_domain.h");
- cfg.header("net/if_utun.h");
- cfg.header("net/bpf.h");
- if target.starts_with("x86") {
+ if target.starts_with("x86") && !ios {
cfg.header("crt_externs.h");
}
- cfg.header("net/route.h");
- cfg.header("netinet/if_ether.h");
cfg.header("netinet/in.h");
- cfg.header("sys/proc_info.h");
- cfg.header("sys/kern_control.h");
cfg.header("sys/ipc.h");
cfg.header("sys/shm.h");
+
+ if !ios {
+ cfg.header("sys/sys_domain.h");
+ cfg.header("net/if_utun.h");
+ cfg.header("net/bpf.h");
+ cfg.header("net/route.h");
+ cfg.header("netinet/if_ether.h");
+ cfg.header("sys/proc_info.h");
+ cfg.header("sys/kern_control.h");
+ }
}
if bsdlike {
@@ -449,6 +455,17 @@ fn main() {
// header conflicts when including them with all the other structs.
"termios2" => true,
+ // Present on historical versions of iOS but missing in more recent
+ // SDKs
+ "bpf_hdr" |
+ "proc_taskinfo" |
+ "proc_taskallinfo" |
+ "proc_bsdinfo" |
+ "proc_threadinfo" |
+ "sockaddr_inarp" |
+ "sockaddr_ctl" |
+ "arphdr" if ios => true,
+
_ => false
}
});
@@ -594,6 +611,30 @@ fn main() {
// shouldn't be used in code anyway...
"AF_MAX" | "PF_MAX" => true,
+ // Present on historical versions of iOS, but now removed in more
+ // recent SDKs
+ "ARPOP_REQUEST" |
+ "ARPOP_REPLY" |
+ "ATF_COM" |
+ "ATF_PERM" |
+ "ATF_PUBL" |
+ "ATF_USETRAILERS" |
+ "AF_SYS_CONTROL" |
+ "SYSPROTO_EVENT" |
+ "PROC_PIDTASKALLINFO" |
+ "PROC_PIDTASKINFO" |
+ "PROC_PIDTHREADINFO" |
+ "UTUN_OPT_FLAGS" |
+ "UTUN_OPT_IFNAME" |
+ "BPF_ALIGNMENT" |
+ "SYSPROTO_CONTROL" if ios => true,
+ s if ios && s.starts_with("RTF_") => true,
+ s if ios && s.starts_with("RTM_") => true,
+ s if ios && s.starts_with("RTA_") => true,
+ s if ios && s.starts_with("RTAX_") => true,
+ s if ios && s.starts_with("RTV_") => true,
+ s if ios && s.starts_with("DLT_") => true,
+
_ => false,
}
});
@@ -736,6 +777,10 @@ fn main() {
// FIXME: mincore is defined with caddr_t on Solaris.
"mincore" if solaris => true,
+ // These were all included in historical versions of iOS but appear
+ // to be removed now
+ "system" | "ptrace" if ios => true,
+
_ => false,
}
});
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/bsd/apple/b64.rs b/src/unix/bsd/apple/b64.rs
index 2b34f85345..ca98f20952 100644
--- a/src/unix/bsd/apple/b64.rs
+++ b/src/unix/bsd/apple/b64.rs
@@ -63,5 +63,3 @@ pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 16;
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40107458;
-
-pub const FIONREAD: ::c_ulong = 0x4004667f;
diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index ffa626926a..cf48528b4a 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -765,16 +765,8 @@ pub const VM_FLAGS_SUPERPAGE_MASK: ::c_int = 0x70000;
pub const VM_FLAGS_RETURN_DATA_ADDR: ::c_int = 0x100000;
pub const VM_FLAGS_RETURN_4K_DATA_ADDR: ::c_int = 0x800000;
pub const VM_FLAGS_ALIAS_MASK: ::c_int = 0xFF000000;
-pub const VM_FLAGS_USER_ALLOCATE: ::c_int = VM_FLAGS_FIXED | VM_FLAGS_ANYWHERE |
- VM_FLAGS_PURGABLE |
- VM_FLAGS_RANDOM_ADDR |
- VM_FLAGS_NO_CACHE |
- VM_FLAGS_OVERWRITE |
- VM_FLAGS_SUPERPAGE_MASK |
- VM_FLAGS_ALIAS_MASK;
-pub const VM_FLAGS_USER_MAP: ::c_int = VM_FLAGS_USER_ALLOCATE |
- VM_FLAGS_RETURN_4K_DATA_ADDR |
- VM_FLAGS_RETURN_DATA_ADDR;
+pub const VM_FLAGS_USER_ALLOCATE: ::c_int = 0xff07401b;
+pub const VM_FLAGS_USER_MAP: ::c_int = 0xff97401b;
pub const VM_FLAGS_USER_REMAP: ::c_int = VM_FLAGS_FIXED | VM_FLAGS_ANYWHERE |
VM_FLAGS_RANDOM_ADDR |
VM_FLAGS_OVERWRITE |
@@ -1085,6 +1077,13 @@ pub const TIOCPTYGRANT: ::c_uint = 0x20007454;
pub const TIOCPTYGNAME: ::c_uint = 0x40807453;
pub const TIOCPTYUNLK: ::c_uint = 0x20007452;
+pub const FIONCLEX: ::c_uint = 0x20006602;
+pub const FIONREAD: ::c_ulong = 0x4004667f;
+pub const FIOASYNC: ::c_ulong = 0x8004667d;
+pub const FIOSETOWN: ::c_ulong = 0x8004667c;
+pub const FIOGETOWN: ::c_ulong = 0x4004667b;
+pub const FIODTYPE: ::c_ulong = 0x4004667a;
+
pub const B0: speed_t = 0;
pub const B50: speed_t = 50;
pub const B75: speed_t = 75;
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index 04b60f2714..9c68178ad1 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],
}
@@ -934,6 +936,7 @@ extern {
pub fn openlog(ident: *const ::c_char, logopt: ::c_int, facility: ::c_int);
pub fn closelog();
pub fn setlogmask(maskpri: ::c_int) -> ::c_int;
+ #[cfg_attr(target_os = "macos", link_name = "syslog$DARWIN_EXTSN")]
pub fn syslog(priority: ::c_int, message: *const ::c_char, ...);
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "nice$UNIX2003")]
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],