summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordebris <marek.kotewicz@gmail.com>2018-08-01 10:29:38 +0200
committerdebris <marek.kotewicz@gmail.com>2018-08-01 10:29:38 +0200
commit019f429ee9b67278ef46520343b31b54961ae75a (patch)
tree824a25d578dff276ff1c5c6d6afa70f29c854f9e
parent41475bdedf3eff8a489771253c8ff1e62d2f0896 (diff)
parente1ebfafc2f011216287c61ce8ff492f57dddee36 (diff)
downloadrust-libc-019f429ee9b67278ef46520343b31b54961ae75a.tar.gz
Merge branch 'master' into exchangedata
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml1
-rw-r--r--README.md10
-rw-r--r--ci/docker/aarch64-unknown-linux-musl/Dockerfile12
-rw-r--r--ci/docker/arm-unknown-linux-musleabihf/Dockerfile12
-rw-r--r--ci/docker/i686-unknown-linux-musl/Dockerfile13
-rw-r--r--ci/docker/sparc64-unknown-linux-gnu/Dockerfile5
-rw-r--r--ci/docker/x86_64-unknown-linux-musl/Dockerfile12
-rwxr-xr-xci/run.sh12
-rw-r--r--libc-test/Cargo.toml1
-rw-r--r--libc-test/build.rs16
-rw-r--r--src/fuchsia/mod.rs148
-rw-r--r--src/macros.rs21
-rw-r--r--src/redox/net.rs2
-rw-r--r--src/unix/bsd/apple/b64.rs2
-rw-r--r--src/unix/bsd/apple/mod.rs11
-rw-r--r--src/unix/bsd/freebsdlike/dragonfly/mod.rs24
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/mod.rs28
-rw-r--r--src/unix/bsd/netbsdlike/mod.rs13
-rw-r--r--src/unix/bsd/netbsdlike/netbsd/mod.rs14
-rw-r--r--src/unix/bsd/netbsdlike/openbsdlike/mod.rs12
-rw-r--r--src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs204
-rw-r--r--src/unix/mod.rs6
-rw-r--r--src/unix/newlib/mod.rs95
-rw-r--r--src/unix/notbsd/android/mod.rs4
-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.rs170
-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
42 files changed, 1248 insertions, 571 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 5c02a4eabf..2a62e2b449 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -21,7 +21,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "ctest"
version = "0.1.7"
-source = "git+https://github.com/alexcrichton/ctest#482c7f0643942174a802d89ad7d460e89b576ed3"
+source = "git+https://github.com/alexcrichton/ctest#bf780a0e62caf4fb4747bd683713864b444bd6fb"
dependencies = [
"cc 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex_syntax 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)",
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/docker/aarch64-unknown-linux-musl/Dockerfile b/ci/docker/aarch64-unknown-linux-musl/Dockerfile
index e86c4c0ae3..caec1572cb 100644
--- a/ci/docker/aarch64-unknown-linux-musl/Dockerfile
+++ b/ci/docker/aarch64-unknown-linux-musl/Dockerfile
@@ -3,21 +3,21 @@ FROM ubuntu:17.10
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc make libc6-dev git curl ca-certificates \
gcc-aarch64-linux-gnu qemu-user
-RUN curl https://www.musl-libc.org/releases/musl-1.1.16.tar.gz | \
+RUN curl https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | \
tar xzf - && \
- cd musl-1.1.16 && \
+ cd musl-1.1.19 && \
CC=aarch64-linux-gnu-gcc \
./configure --prefix=/musl-aarch64 --enable-wrapper=yes && \
make install -j4 && \
cd .. && \
- rm -rf musl-1.1.16 && \
+ rm -rf musl-1.1.19
# Install linux kernel headers sanitized for use with musl
- curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
+RUN curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
tar xzf - && \
- cd kernel-headers-3.12.6-5 && \
+ cd kernel-headers-3.12.6-6 && \
make ARCH=arm64 prefix=/musl-aarch64 install -j4 && \
cd .. && \
- rm -rf kernel-headers-3.12.6-5
+ rm -rf kernel-headers-3.12.6-6
# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in libstd?
ENV PATH=$PATH:/musl-aarch64/bin:/rust/bin \
diff --git a/ci/docker/arm-unknown-linux-musleabihf/Dockerfile b/ci/docker/arm-unknown-linux-musleabihf/Dockerfile
index 130730b997..86304130fe 100644
--- a/ci/docker/arm-unknown-linux-musleabihf/Dockerfile
+++ b/ci/docker/arm-unknown-linux-musleabihf/Dockerfile
@@ -4,21 +4,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gcc make libc6-dev git curl ca-certificates \
gcc-arm-linux-gnueabihf qemu-user
-RUN curl https://www.musl-libc.org/releases/musl-1.1.16.tar.gz | tar xzf -
-WORKDIR /musl-1.1.16
+RUN curl https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | tar xzf -
+WORKDIR /musl-1.1.19
RUN CC=arm-linux-gnueabihf-gcc \
CFLAGS="-march=armv6 -marm" \
./configure --prefix=/musl-arm --enable-wrapper=yes
RUN make install -j4
# Install linux kernel headers sanitized for use with musl
-RUN \
- curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
+RUN curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
tar xzf - && \
- cd kernel-headers-3.12.6-5 && \
+ cd kernel-headers-3.12.6-6 && \
make ARCH=arm prefix=/musl-arm install -j4 && \
cd .. && \
- rm -rf kernel-headers-3.12.6-5
+ rm -rf kernel-headers-3.12.6-6
+
ENV PATH=$PATH:/musl-arm/bin:/rust/bin \
CC_arm_unknown_linux_musleabihf=musl-gcc \
CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_LINKER=musl-gcc \
diff --git a/ci/docker/i686-unknown-linux-musl/Dockerfile b/ci/docker/i686-unknown-linux-musl/Dockerfile
index 3adb920040..49f37d70f2 100644
--- a/ci/docker/i686-unknown-linux-musl/Dockerfile
+++ b/ci/docker/i686-unknown-linux-musl/Dockerfile
@@ -12,19 +12,20 @@ RUN apt-get install -y --no-install-recommends \
# since otherwise the script will fail to find a compiler.
# * We manually unset CROSS_COMPILE when running make; otherwise the makefile
# will call the non-existent binary 'i686-ar'.
-RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \
+RUN curl https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | \
tar xzf - && \
- cd musl-1.1.15 && \
+ cd musl-1.1.19 && \
CC=gcc CFLAGS=-m32 ./configure --prefix=/musl-i686 --disable-shared --target=i686 && \
make CROSS_COMPILE= install -j4 && \
cd .. && \
- rm -rf musl-1.1.15 && \
+ rm -rf musl-1.1.19
# Install linux kernel headers sanitized for use with musl
- curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
+RUN curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
tar xzf - && \
- cd kernel-headers-3.12.6-5 && \
+ cd kernel-headers-3.12.6-6 && \
make ARCH=i386 prefix=/musl-i686 install -j4 && \
cd .. && \
- rm -rf kernel-headers-3.12.6-5
+ rm -rf kernel-headers-3.12.6-6
+
ENV PATH=$PATH:/musl-i686/bin:/rust/bin \
CC_i686_unknown_linux_musl=musl-gcc
diff --git a/ci/docker/sparc64-unknown-linux-gnu/Dockerfile b/ci/docker/sparc64-unknown-linux-gnu/Dockerfile
index 90b5ea9bda..d9edaab426 100644
--- a/ci/docker/sparc64-unknown-linux-gnu/Dockerfile
+++ b/ci/docker/sparc64-unknown-linux-gnu/Dockerfile
@@ -5,7 +5,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev \
gcc-sparc64-linux-gnu libc6-dev-sparc64-cross \
qemu-system-sparc64 openbios-sparc seabios ipxe-qemu \
- p7zip-full cpio
+ p7zip-full cpio linux-libc-dev-sparc64-cross linux-headers-4.9.0-3-common
+
+# Put linux/module.h into the right spot as it is not shipped by debian
+RUN cp /usr/src/linux-headers-4.9.0-3-common/include/uapi/linux/module.h /usr/sparc64-linux-gnu/include/linux/
COPY linux-sparc64.sh /
RUN bash /linux-sparc64.sh
diff --git a/ci/docker/x86_64-unknown-linux-musl/Dockerfile b/ci/docker/x86_64-unknown-linux-musl/Dockerfile
index d9d6511386..6e2b7d9e5e 100644
--- a/ci/docker/x86_64-unknown-linux-musl/Dockerfile
+++ b/ci/docker/x86_64-unknown-linux-musl/Dockerfile
@@ -3,18 +3,18 @@ FROM ubuntu:17.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc make libc6-dev git curl ca-certificates
-RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \
+RUN curl https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | \
tar xzf - && \
- cd musl-1.1.15 && \
+ cd musl-1.1.19 && \
./configure --prefix=/musl-x86_64 && \
make install -j4 && \
cd .. && \
- rm -rf musl-1.1.15 && \
+ rm -rf musl-1.1.19
# Install linux kernel headers sanitized for use with musl
- curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \
+RUN curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \
tar xzf - && \
- cd kernel-headers-3.12.6-5 && \
+ cd kernel-headers-3.12.6-6 && \
make ARCH=x86_64 prefix=/musl-x86_64 install -j4 && \
cd .. && \
- rm -rf kernel-headers-3.12.6-5
+ rm -rf kernel-headers-3.12.6-6
ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin
diff --git a/ci/run.sh b/ci/run.sh
index ff74899cbb..27ffc054a0 100755
--- a/ci/run.sh
+++ b/ci/run.sh
@@ -79,12 +79,20 @@ 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
opt="--release"
fi
-cargo test $opt --no-default-features --manifest-path libc-test/Cargo.toml --target $TARGET
+# Building with --no-default-features is currently broken on rumprun because we
+# need cfg(target_vendor), which is currently unstable.
+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 29e43f6d14..6c2ac5496e 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -272,6 +272,7 @@ fn main() {
if linux || android {
cfg.header("sys/fsuid.h");
+ cfg.header("linux/module.h");
cfg.header("linux/seccomp.h");
cfg.header("linux/if_ether.h");
cfg.header("linux/if_tun.h");
@@ -343,7 +344,7 @@ fn main() {
}
}
- cfg.type_name(move |ty, is_struct| {
+ cfg.type_name(move |ty, is_struct, is_union| {
match ty {
// Just pass all these through, no need for a "struct" prefix
"FILE" |
@@ -360,6 +361,10 @@ fn main() {
// OSX calls this something else
"sighandler_t" if bsdlike => "sig_t".to_string(),
+ t if is_union => {
+ format!("union {}", t)
+ }
+
t if t.ends_with("_t") => t.to_string(),
// Windows uppercase structs don't have `struct` in front, there's a
@@ -538,12 +543,6 @@ fn main() {
"KERN_USERMOUNT" |
"KERN_ARND" if openbsd => true,
- // These constants were added in OpenBSD 6.2
- "EV_RECEIPT" | "EV_DISPATCH" if openbsd => true,
-
- // These constants were added in OpenBSD 6.3
- "MAP_STACK" if openbsd => true,
-
// These are either unimplemented or optionally built into uClibc
"LC_CTYPE_MASK" | "LC_NUMERIC_MASK" | "LC_TIME_MASK" | "LC_COLLATE_MASK" | "LC_MONETARY_MASK" | "LC_MESSAGES_MASK" |
"MADV_MERGEABLE" | "MADV_UNMERGEABLE" | "MADV_HWPOISON" | "IPV6_ADD_MEMBERSHIP" | "IPV6_DROP_MEMBERSHIP" | "IPV6_MULTICAST_LOOP" | "IPV6_V6ONLY" |
@@ -822,9 +821,10 @@ fn main() {
cfg.skip_struct(|s| {
s != "termios2"
});
- cfg.type_name(move |ty, is_struct| {
+ cfg.type_name(move |ty, is_struct, is_union| {
match ty {
t if is_struct => format!("struct {}", t),
+ t if is_union => format!("union {}", t),
t => t.to_string(),
}
});
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 0e13bfcf46..f48ad45941 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -35,11 +35,11 @@ macro_rules! __cfg_if_apply {
}
macro_rules! s {
- ($($(#[$attr:meta])* pub struct $i:ident { $($field:tt)* })*) => ($(
+ ($($(#[$attr:meta])* pub $t:ident $i:ident { $($field:tt)* })*) => ($(
__item! {
#[repr(C)]
$(#[$attr])*
- pub struct $i { $($field)* }
+ pub $t $i { $($field)* }
}
impl ::dox::Copy for $i {}
impl ::dox::Clone for $i {
@@ -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 4abe466a0e..4849d7f0f5 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -1085,6 +1085,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;
@@ -2253,10 +2260,14 @@ pub const DLT_LOOP: ::c_uint = 108;
// sizeof(int32_t)
pub const BPF_ALIGNMENT: ::c_int = 4;
+// sys/spawn.h:
pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x04;
pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x08;
+pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x40;
+pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x80;
+pub const POSIX_SPAWN_CLOEXEC_DEFAULT: ::c_int = 0x4000;
// sys/ipc.h:
pub const IPC_CREAT: ::c_int = 0x200;
diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
index f399f27ccb..9e1082e53b 100644
--- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -115,6 +115,27 @@ s! {
pub f_uid_uuid: ::uuid_t,
}
+ pub struct statfs {
+ pub f_bsize: ::c_long,
+ pub f_iosize: ::c_long,
+ pub f_blocks: ::c_long,
+ pub f_bfree: ::c_long,
+ pub f_bavail: ::c_long,
+ pub f_files: ::c_long,
+ pub f_ffree: ::c_long,
+ pub f_fsid: ::fsid_t,
+ pub f_owner: ::uid_t,
+ pub f_type: ::int32_t,
+ pub f_flags: ::int32_t,
+ pub f_syncwrites: ::c_long,
+ pub f_asyncwrites: ::c_long,
+ pub f_fstypename: [::c_char; 16],
+ pub f_mntonname: [::c_char; 90],
+ pub f_syncreads: ::c_long,
+ pub f_asyncreads: ::c_long,
+ pub f_mntfromname: [::c_char; 90],
+ }
+
pub struct stat {
pub st_ino: ::ino_t,
pub st_nlink: ::nlink_t,
@@ -760,4 +781,7 @@ extern {
pub fn lwp_rtprio(function: ::c_int, pid: ::pid_t, lwpid: lwpid_t,
rtp: *mut super::rtprio) -> ::c_int;
+
+ pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
+ pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
}
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index def81dfe2e..a64dbc468f 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -99,6 +99,31 @@ s! {
pub f_namemax: ::c_ulong,
}
+ pub struct statfs {
+ pub f_version: ::uint32_t,
+ pub f_type: ::uint32_t,
+ pub f_flags: ::uint64_t,
+ pub f_bsize: ::uint64_t,
+ pub f_iosize: ::uint64_t,
+ pub f_blocks: ::uint64_t,
+ pub f_bfree: ::uint64_t,
+ pub f_bavail: ::int64_t,
+ pub f_files: ::uint64_t,
+ pub f_ffree: ::int64_t,
+ pub f_syncwrites: ::uint64_t,
+ pub f_asyncwrites: ::uint64_t,
+ pub f_syncreads: ::uint64_t,
+ pub f_asyncreads: ::uint64_t,
+ f_spare: [::uint64_t; 10],
+ pub f_namemax: ::uint32_t,
+ pub f_owner: ::uid_t,
+ pub f_fsid: ::fsid_t,
+ f_charspare: [::c_char; 80],
+ pub f_fstypename: [::c_char; 16],
+ pub f_mntfromname: [::c_char; 88],
+ pub f_mntonname: [::c_char; 88],
+ }
+
// internal structure has changed over time
pub struct _sem {
data: [u32; 4],
@@ -994,6 +1019,9 @@ extern {
fd: ::c_int,
newfd: ::c_int,
) -> ::c_int;
+
+ pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
+ pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
}
cfg_if! {
diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs
index 1b7576e768..6384a29f8c 100644
--- a/src/unix/bsd/netbsdlike/mod.rs
+++ b/src/unix/bsd/netbsdlike/mod.rs
@@ -57,15 +57,6 @@ s! {
pub l_type: ::c_short,
pub l_whence: ::c_short,
}
-
- #[repr(packed)]
- pub struct arphdr {
- pub ar_hrd: u16,
- pub ar_pro: u16,
- pub ar_hln: u8,
- pub ar_pln: u8,
- pub ar_op: u16,
- }
}
pub const D_T_FMT: ::nl_item = 0;
@@ -430,10 +421,6 @@ pub const IPV6_RECVPKTINFO: ::c_int = 36;
pub const IPV6_PKTINFO: ::c_int = 46;
pub const TCP_NODELAY: ::c_int = 0x01;
-pub const TCP_KEEPIDLE: ::c_int = 3;
-pub const TCP_KEEPINTVL: ::c_int = 5;
-pub const TCP_KEEPCNT: ::c_int = 6;
-pub const TCP_KEEPINIT: ::c_int = 7;
pub const SOL_SOCKET: ::c_int = 0xffff;
pub const SO_DEBUG: ::c_int = 0x01;
diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
index 01dd188495..065f6bd36a 100644
--- a/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -318,6 +318,15 @@ s! {
pub ipi_addr: ::in_addr,
pub ipi_ifindex: ::c_uint,
}
+
+ #[repr(packed)]
+ pub struct arphdr {
+ pub ar_hrd: u16,
+ pub ar_pro: u16,
+ pub ar_hln: u8,
+ pub ar_pln: u8,
+ pub ar_op: u16,
+ }
}
pub const AT_FDCWD: ::c_int = -100;
@@ -381,6 +390,11 @@ pub const IP_RECVPKTINFO: ::c_int = 26;
pub const IPV6_JOIN_GROUP: ::c_int = 12;
pub const IPV6_LEAVE_GROUP: ::c_int = 13;
+pub const TCP_KEEPIDLE: ::c_int = 3;
+pub const TCP_KEEPINTVL: ::c_int = 5;
+pub const TCP_KEEPCNT: ::c_int = 6;
+pub const TCP_KEEPINIT: ::c_int = 7;
+
pub const SOCK_CONN_DGRAM: ::c_int = 6;
pub const SOCK_DCCP: ::c_int = SOCK_CONN_DGRAM;
pub const SOCK_NOSIGPIPE: ::c_int = 0x40000000;
diff --git a/src/unix/bsd/netbsdlike/openbsdlike/mod.rs b/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
index e44bfca61c..bf5ddd2e7a 100644
--- a/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
+++ b/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
@@ -193,6 +193,14 @@ s! {
pub gid: ::gid_t,
pub pid: ::pid_t,
}
+
+ pub struct arphdr {
+ pub ar_hrd: u16,
+ pub ar_pro: u16,
+ pub ar_hln: u8,
+ pub ar_pln: u8,
+ pub ar_op: u16,
+ }
}
pub const UT_NAMESIZE: usize = 32;
@@ -579,6 +587,7 @@ pub const CTL_MACHDEP: ::c_int = 7;
pub const CTL_DDB: ::c_int = 9;
pub const CTL_VFS: ::c_int = 10;
pub const CTL_MAXID: ::c_int = 11;
+pub const HW_NCPUONLINE: ::c_int = 25;
pub const KERN_OSTYPE: ::c_int = 1;
pub const KERN_OSRELEASE: ::c_int = 2;
pub const KERN_OSREV: ::c_int = 3;
@@ -653,7 +662,8 @@ pub const KERN_PROC_VMMAP: ::c_int = 80;
pub const KERN_GLOBAL_PTRACE: ::c_int = 81;
pub const KERN_CONSBUFSIZE: ::c_int = 82;
pub const KERN_CONSBUF: ::c_int = 83;
-pub const KERN_MAXID: ::c_int = 84;
+pub const KERN_AUDIO: ::c_int = 84;
+pub const KERN_MAXID: ::c_int = 85;
pub const KERN_PROC_ALL: ::c_int = 0;
pub const KERN_PROC_PID: ::c_int = 1;
pub const KERN_PROC_PGRP: ::c_int = 2;
diff --git a/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs
index cca8a47ae0..5e6948115f 100644
--- a/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs
@@ -25,8 +25,207 @@ s! {
pub int_p_sign_posn: ::c_char,
pub int_n_sign_posn: ::c_char,
}
+
+ pub struct statfs {
+ pub f_flags: ::uint32_t,
+ pub f_bsize: ::uint32_t,
+ pub f_iosize: ::uint32_t,
+ pub f_blocks: ::uint64_t,
+ pub f_bfree: ::uint64_t,
+ pub f_bavail: ::int64_t,
+ pub f_files: ::uint64_t,
+ pub f_ffree: ::uint64_t,
+ pub f_favail: ::int64_t,
+ pub f_syncwrites: ::uint64_t,
+ pub f_syncreads: ::uint64_t,
+ pub f_asyncwrites: ::uint64_t,
+ pub f_asyncreads: ::uint64_t,
+ pub f_fsid: ::fsid_t,
+ pub f_namemax: ::uint32_t,
+ pub f_owner: ::uid_t,
+ pub f_ctime: ::uint64_t,
+ pub f_fstypename: [::c_char; 16],
+ pub f_mntonname: [::c_char; 90],
+ pub f_mntfromname: [::c_char; 90],
+ pub f_mntfromspec: [::c_char; 90],
+ pub mount_info: mount_info,
+ }
+
+ pub union mount_info {
+ pub ufs_args: ufs_args,
+ pub mfs_args: mfs_args,
+ pub nfs_args: nfs_args,
+ pub iso_args: iso_args,
+ pub msdosfs_args: msdosfs_args,
+ pub ntfs_args: ntfs_args,
+ pub tmpfs_args: tmpfs_args,
+ align: [::c_char; 160],
+ }
+
+ pub struct ufs_args {
+ pub fspec: *mut ::c_char,
+ pub export_info: export_args,
+ }
+
+ pub struct mfs_args {
+ pub fspec: *mut ::c_char,
+ pub export_info: export_args,
+ // https://github.com/openbsd/src/blob/master/sys/sys/types.h#L134
+ pub base: *mut ::c_char,
+ pub size: ::c_ulong,
+ }
+
+ pub struct iso_args {
+ pub fspec: *mut ::c_char,
+ pub export_info: export_args,
+ pub flags: ::c_int,
+ pub sess: ::c_int,
+ }
+
+ pub struct nfs_args {
+ pub version: ::c_int,
+ pub addr: *mut ::sockaddr,
+ pub addrlen: ::c_int,
+ pub sotype: ::c_int,
+ pub proto: ::c_int,
+ pub fh: *mut ::c_uchar,
+ pub fhsize: ::c_int,
+ pub flags: ::c_int,
+ pub wsize: ::c_int,
+ pub rsize: ::c_int,
+ pub readdirsize: ::c_int,
+ pub timeo: ::c_int,
+ pub retrans: ::c_int,
+ pub maxgrouplist: ::c_int,
+ pub readahead: ::c_int,
+ pub leaseterm: ::c_int,
+ pub deadthresh: ::c_int,
+ pub hostname: *mut ::c_char,
+ pub acregmin: ::c_int,
+ pub acregmax: ::c_int,
+ pub acdirmin: ::c_int,
+ pub acdirmax: ::c_int,
+ }
+
+ pub struct msdosfs_args {
+ pub fspec: *mut ::c_char,
+ pub export_info: export_args,
+ pub uid: ::uid_t,
+ pub gid: ::gid_t,
+ pub mask: ::mode_t,
+ pub flags: ::c_int,
+ }
+
+ pub struct ntfs_args {
+ pub fspec: *mut ::c_char,
+ pub export_info: export_args,
+ pub uid: ::uid_t,
+ pub gid: ::gid_t,
+ pub mode: ::mode_t,
+ pub flag: ::c_ulong,
+ }
+
+ pub struct udf_args {
+ pub fspec: *mut ::c_char,
+ pub lastblock: ::uint32_t,
+ }
+
+ pub struct tmpfs_args {
+ pub ta_version: ::c_int,
+ pub ta_nodes_max: ::ino_t,
+ pub ta_size_max: ::off_t,
+ pub ta_root_uid: ::uid_t,
+ pub ta_root_gid: ::gid_t,
+ pub ta_root_mode: ::mode_t,
+ }
+
+ pub struct fusefs_args {
+ pub name: *mut ::c_char,
+ pub fd: ::c_int,
+ pub max_read: ::c_int,
+ pub allow_other: ::c_int,
+ }
+
+ pub struct xucred {
+ pub cr_uid: ::uid_t,
+ pub cr_gid: ::gid_t,
+ pub cr_ngroups: ::c_short,
+ //https://github.com/openbsd/src/blob/master/sys/sys/syslimits.h#L44
+ pub cr_groups: [::gid_t; 16],
+ }
+
+ pub struct export_args {
+ pub ex_flags: ::c_int,
+ pub ex_root: ::uid_t,
+ pub ex_anon: xucred,
+ pub ex_addr: *mut ::sockaddr,
+ pub ex_addrlen: ::c_int,
+ pub ex_mask: *mut ::sockaddr,
+ pub ex_masklen: ::c_int,
+ }
}
+//https://github.com/openbsd/src/blob/master/sys/sys/mount.h
+pub const ISOFSMNT_NORRIP: ::c_int = 0x1; // disable Rock Ridge Ext
+pub const ISOFSMNT_GENS: ::c_int = 0x2; // enable generation numbers
+pub const ISOFSMNT_EXTATT: ::c_int = 0x4; // enable extended attr
+pub const ISOFSMNT_NOJOLIET: ::c_int = 0x8; // disable Joliet Ext
+pub const ISOFSMNT_SESS: ::c_int = 0x10; // use iso_args.sess
+
+pub const NFS_ARGSVERSION: ::c_int = 4; // change when nfs_args changes
+
+pub const NFSMNT_RESVPORT: ::c_int = 0; // always use reserved ports
+pub const NFSMNT_SOFT: ::c_int = 0x1; // soft mount (hard is default)
+pub const NFSMNT_WSIZE: ::c_int = 0x2; // set write size
+pub const NFSMNT_RSIZE: ::c_int = 0x4; // set read size
+pub const NFSMNT_TIMEO: ::c_int = 0x8; // set initial timeout
+pub const NFSMNT_RETRANS: ::c_int = 0x10; // set number of request retries
+pub const NFSMNT_MAXGRPS: ::c_int = 0x20; // set maximum grouplist size
+pub const NFSMNT_INT: ::c_int = 0x40; // allow interrupts on hard mount
+pub const NFSMNT_NOCONN: ::c_int = 0x80; // Don't Connect the socket
+pub const NFSMNT_NQNFS: ::c_int = 0x100; // Use Nqnfs protocol
+pub const NFSMNT_NFSV3: ::c_int = 0x200; // Use NFS Version 3 protocol
+pub const NFSMNT_KERB: ::c_int = 0x400; // Use Kerberos authentication
+pub const NFSMNT_DUMBTIMR: ::c_int = 0x800; // Don't estimate rtt dynamically
+pub const NFSMNT_LEASETERM: ::c_int = 0x1000; // set lease term (nqnfs)
+pub const NFSMNT_READAHEAD: ::c_int = 0x2000; // set read ahead
+pub const NFSMNT_DEADTHRESH: ::c_int = 0x4000; // set dead server retry thresh
+pub const NFSMNT_NOAC: ::c_int = 0x8000; // disable attribute cache
+pub const NFSMNT_RDIRPLUS: ::c_int = 0x10000; // Use Readdirplus for V3
+pub const NFSMNT_READDIRSIZE: ::c_int = 0x20000; // Set readdir size
+
+/* Flags valid only in mount syscall arguments */
+pub const NFSMNT_ACREGMIN: ::c_int = 0x40000; // acregmin field valid
+pub const NFSMNT_ACREGMAX: ::c_int = 0x80000; // acregmax field valid
+pub const NFSMNT_ACDIRMIN: ::c_int = 0x100000; // acdirmin field valid
+pub const NFSMNT_ACDIRMAX: ::c_int = 0x200000; // acdirmax field valid
+
+/* Flags valid only in kernel */
+pub const NFSMNT_INTERNAL: ::c_int = 0xfffc0000; // Bits set internally
+pub const NFSMNT_HASWRITEVERF: ::c_int = 0x40000; // Has write verifier for V3
+pub const NFSMNT_GOTPATHCONF: ::c_int = 0x80000; // Got the V3 pathconf info
+pub const NFSMNT_GOTFSINFO: ::c_int = 0x100000; // Got the V3 fsinfo
+pub const NFSMNT_MNTD: ::c_int = 0x200000; // Mnt server for mnt point
+pub const NFSMNT_DISMINPROG: ::c_int = 0x400000; // Dismount in progress
+pub const NFSMNT_DISMNT: ::c_int = 0x800000; // Dismounted
+pub const NFSMNT_SNDLOCK: ::c_int = 0x1000000; // Send socket lock
+pub const NFSMNT_WANTSND: ::c_int = 0x2000000; // Want above
+pub const NFSMNT_RCVLOCK: ::c_int = 0x4000000; // Rcv socket lock
+pub const NFSMNT_WANTRCV: ::c_int = 0x8000000; // Want above
+pub const NFSMNT_WAITAUTH: ::c_int = 0x10000000; // Wait for authentication
+pub const NFSMNT_HASAUTH: ::c_int = 0x20000000; // Has authenticator
+pub const NFSMNT_WANTAUTH: ::c_int = 0x40000000; // Wants an authenticator
+pub const NFSMNT_AUTHERR: ::c_int = 0x80000000; // Authentication error
+
+pub const MSDOSFSMNT_SHORTNAME: ::c_int = 0x1; // Force old DOS short names only
+pub const MSDOSFSMNT_LONGNAME: ::c_int = 0x2; // Force Win'95 long names
+pub const MSDOSFSMNT_NOWIN95: ::c_int = 0x4; // Completely ignore Win95 entries
+
+pub const NTFS_MFLAG_CASEINS: ::c_int = 0x1;
+pub const NTFS_MFLAG_ALLNAMES: ::c_int = 0x2;
+
+pub const TMPFS_ARGS_VERSION: ::c_int = 1;
+
pub const MAP_STACK : ::c_int = 0x4000;
// https://github.com/openbsd/src/blob/master/sys/net/if.h#L187
@@ -47,7 +246,7 @@ pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
-pub const SIGSTKSZ : ::size_t = 24576;
+pub const SIGSTKSZ : ::size_t = 28672;
extern {
pub fn accept4(s: ::c_int, addr: *mut ::sockaddr,
@@ -59,6 +258,9 @@ extern {
pub fn strtonum(nptr: *const ::c_char, minval: ::c_longlong,
maxval: ::c_longlong,
errstr: *mut *const ::c_char) -> ::c_longlong;
+
+ pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
+ pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
}
cfg_if! {
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index 15c7821fa1..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],
}
@@ -294,11 +296,11 @@ cfg_if! {
} else if #[cfg(target_os = "emscripten")] {
#[link(name = "c")]
extern {}
- } else if #[cfg(all(target_os = "netbsd"))] {
+ } else if #[cfg(all(target_os = "netbsd",
+ feature = "stdbuild", target_vendor = "rumprun"))] {
// Since we don't use -nodefaultlibs on Rumprun, libc is always pulled
// in automatically by the linker. We avoid passing it explicitly, as it
// causes some versions of binutils to crash with an assertion failure.
- #[cfg_attr(feature = "stdbuild", target_vendor = "rumprun")]
#[link(name = "m")]
extern {}
} else if #[cfg(any(target_os = "macos",
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/android/mod.rs b/src/unix/notbsd/android/mod.rs
index 55adc5c8d6..3e10acd505 100644
--- a/src/unix/notbsd/android/mod.rs
+++ b/src/unix/notbsd/android/mod.rs
@@ -1458,6 +1458,10 @@ pub const SIOCSRARP: ::c_ulong = 0x00008962;
pub const SIOCGIFMAP: ::c_ulong = 0x00008970;
pub const SIOCSIFMAP: ::c_ulong = 0x00008971;
+// linux/module.h
+pub const MODULE_INIT_IGNORE_MODVERSIONS: ::c_uint = 0x0001;
+pub const MODULE_INIT_IGNORE_VERMAGIC: ::c_uint = 0x0002;
+
// Similarity to Linux it's not used but defined for compatibility.
pub const ENOATTR: ::c_int = ::ENODATA;
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 fdd26f8409..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],
}
@@ -229,6 +304,13 @@ s! {
pad: [::c_long; 4],
}
+ pub struct packet_mreq {
+ pub mr_ifindex: ::c_int,
+ pub mr_type: ::c_ushort,
+ pub mr_alen: ::c_ushort,
+ pub mr_address: [::c_uchar; 8],
+ }
+
pub struct cpu_set_t {
#[cfg(all(target_pointer_width = "32",
not(target_arch = "x86_64")))]
@@ -785,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;
@@ -1300,6 +1381,15 @@ pub const CTRL_ATTR_MCAST_GRP_UNSPEC: ::c_int = 0;
pub const CTRL_ATTR_MCAST_GRP_NAME: ::c_int = 1;
pub const CTRL_ATTR_MCAST_GRP_ID: ::c_int = 2;
+// linux/if_packet.h
+pub const PACKET_ADD_MEMBERSHIP: ::c_int = 1;
+pub const PACKET_DROP_MEMBERSHIP: ::c_int = 2;
+
+pub const PACKET_MR_MULTICAST: ::c_int = 0;
+pub const PACKET_MR_PROMISC: ::c_int = 1;
+pub const PACKET_MR_ALLMULTI: ::c_int = 2;
+pub const PACKET_MR_UNICAST: ::c_int = 3;
+
// linux/netfilter.h
pub const NF_DROP: ::c_int = 0;
pub const NF_ACCEPT: ::c_int = 1;
@@ -1482,6 +1572,10 @@ pub const ARPD_LOOKUP: ::c_ushort = 0x02;
pub const ARPD_FLUSH: ::c_ushort = 0x03;
pub const ATF_MAGIC: ::c_int = 0x80;
+// linux/module.h
+pub const MODULE_INIT_IGNORE_MODVERSIONS: ::c_uint = 0x0001;
+pub const MODULE_INIT_IGNORE_VERMAGIC: ::c_uint = 0x0002;
+
f! {
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
for slot in cpuset.bits.iter_mut() {
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],