Merge pull request #434 from dgreid/setresuid
Add setresuid/setresgid for linux
diff --git a/.travis.yml b/.travis.yml
index d0e9591..1b05af7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -78,10 +78,16 @@
rust: stable
- os: linux
env: TARGET=powerpc64-unknown-linux-gnu
+ rust: beta
+ - os: linux
+ env: TARGET=mips-unknown-linux-musl
rust: stable
- os: linux
env: TARGET=mipsel-unknown-linux-musl
rust: stable
+ - os: linux
+ env: TARGET=mips64-unknown-linux-gnuabi64
+ rust: nightly
# beta
- os: linux
diff --git a/Cargo.lock b/Cargo.lock
new file mode 100644
index 0000000..5332bf2
--- /dev/null
+++ b/Cargo.lock
@@ -0,0 +1,112 @@
+[root]
+name = "libc-test"
+version = "0.1.0"
+dependencies = [
+ "ctest 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.17",
+]
+
+[[package]]
+name = "bitflags"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "ctest"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "gcc 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syntex_syntax 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "gcc"
+version = "0.3.35"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "generate-files"
+version = "0.1.0"
+dependencies = [
+ "ctest 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "kernel32-sys"
+version = "0.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "libc"
+version = "0.1.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "libc"
+version = "0.2.17"
+
+[[package]]
+name = "log"
+version = "0.3.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "rustc-serialize"
+version = "0.3.19"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "syntex_syntax"
+version = "0.19.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
+ "term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "term"
+version = "0.2.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "unicode-xid"
+version = "0.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "winapi"
+version = "0.2.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "winapi-build"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[metadata]
+"checksum bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "32866f4d103c4e438b1db1158aa1b1a80ee078e5d77a59a2f906fd62a577389c"
+"checksum ctest 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8e8e44b9fb51a835b9193863b4b873dea29756cf4ba5151c0a6cc0f15fbdeb"
+"checksum gcc 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)" = "91ecd03771effb0c968fd6950b37e89476a578aaf1c70297d8e92b6516ec3312"
+"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
+"checksum libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "e32a70cf75e5846d53a673923498228bbec6a8624708a9ea5645f075d6276122"
+"checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054"
+"checksum rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "6159e4e6e559c81bd706afe9c8fd68f547d3e851ce12e76b1de7914bab61691b"
+"checksum syntex_syntax 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8739e1a8b53efe7349917259f8ced15f797c89bf788a86e44f61addc0d1ecf68"
+"checksum term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "f2077e54d38055cf1ca0fd7933a2e00cd3ec8f6fed352b2a377f06dcdaaf3281"
+"checksum unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "36dff09cafb4ec7c8cf0023eb0b686cb6ce65499116a12201c9e11840ca01beb"
+"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
+"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
diff --git a/Cargo.toml b/Cargo.toml
index a863aa6..c08ab3a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "libc"
-version = "0.2.16"
+version = "0.2.17"
authors = ["The Rust Project Developers"]
license = "MIT/Apache-2.0"
readme = "README.md"
@@ -16,3 +16,6 @@
[features]
default = ["use_std"]
use_std = []
+
+[workspace]
+members = ["libc-test", "libc-test/generate-files"]
diff --git a/README.md b/README.md
index 09b9a56..5ea8123 100644
--- a/README.md
+++ b/README.md
@@ -132,4 +132,6 @@
* `i686-unknown-freebsd`
* [`x86_64-unknown-bitrig`](https://doc.rust-lang.org/libc/x86_64-unknown-bitrig/libc/)
* [`x86_64-unknown-dragonfly`](https://doc.rust-lang.org/libc/x86_64-unknown-dragonfly/libc/)
+ * `i686-unknown-haiku`
+ * `x86_64-unknown-haiku`
* [`x86_64-unknown-netbsd`](https://doc.rust-lang.org/libc/x86_64-unknown-netbsd/libc/)
diff --git a/appveyor.yml b/appveyor.yml
index de43884..a851bb8 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -17,5 +17,9 @@
build: false
test_script:
- - cargo test
- - cargo run --manifest-path libc-test/Cargo.toml
+ - cargo test --target %TARGET%
+ - cargo run --manifest-path libc-test/Cargo.toml --target %TARGET%
+
+cache:
+ - target
+ - C:\Users\appveyor\.cargo\registry
diff --git a/ci/docker/aarch64-unknown-linux-gnu/Dockerfile b/ci/docker/aarch64-unknown-linux-gnu/Dockerfile
index b0e980e..2ba69e1 100644
--- a/ci/docker/aarch64-unknown-linux-gnu/Dockerfile
+++ b/ci/docker/aarch64-unknown-linux-gnu/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:16.04
+FROM ubuntu:16.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates \
diff --git a/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile b/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
index 3a858e3..3824c04 100644
--- a/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
+++ b/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:16.04
+FROM ubuntu:16.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates \
diff --git a/ci/docker/i686-unknown-linux-gnu/Dockerfile b/ci/docker/i686-unknown-linux-gnu/Dockerfile
index 63450ff..c149d84 100644
--- a/ci/docker/i686-unknown-linux-gnu/Dockerfile
+++ b/ci/docker/i686-unknown-linux-gnu/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:16.04
+FROM ubuntu:16.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc-multilib libc6-dev ca-certificates
diff --git a/ci/docker/i686-unknown-linux-musl/Dockerfile b/ci/docker/i686-unknown-linux-musl/Dockerfile
index 89d60ff..87459a1 100644
--- a/ci/docker/i686-unknown-linux-musl/Dockerfile
+++ b/ci/docker/i686-unknown-linux-musl/Dockerfile
@@ -1,13 +1,22 @@
-FROM ubuntu:16.04
+FROM ubuntu:16.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.14.tar.gz | \
+# Below we're cross-compiling musl for i686 using the system compiler on an
+# x86_64 system. This is an awkward thing to be doing and so we have to jump
+# through a couple hoops to get musl to be happy. In particular:
+#
+# * We specifically pass -m32 in CFLAGS and override CC when running ./configure,
+# 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 | \
tar xzf - && \
- cd musl-1.1.14 && \
- CFLAGS=-m32 ./configure --prefix=/musl-i686 --disable-shared --target=i686 && \
- make install -j4 && \
+ cd musl-1.1.15 && \
+ CC=gcc CFLAGS=-m32 ./configure --prefix=/musl-i686 --disable-shared --target=i686 && \
+ make CROSS_COMPILE= install -j4 && \
cd .. && \
- rm -rf musl-1.1.14
-ENV PATH=$PATH:/musl-i686/bin:/rust/bin
+ rm -rf musl-1.1.15
+ENV PATH=$PATH:/musl-i686/bin:/rust/bin \
+ CC_i686_unknown_linux_musl=musl-gcc
diff --git a/ci/docker/mips-unknown-linux-gnu/Dockerfile b/ci/docker/mips-unknown-linux-gnu/Dockerfile
index 6194026..eea1f65 100644
--- a/ci/docker/mips-unknown-linux-gnu/Dockerfile
+++ b/ci/docker/mips-unknown-linux-gnu/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:16.04
+FROM ubuntu:16.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
diff --git a/ci/docker/mips-unknown-linux-musl/Dockerfile b/ci/docker/mips-unknown-linux-musl/Dockerfile
new file mode 100644
index 0000000..77c6adb
--- /dev/null
+++ b/ci/docker/mips-unknown-linux-musl/Dockerfile
@@ -0,0 +1,14 @@
+FROM ubuntu:16.10
+
+RUN apt-get update
+RUN apt-get install -y --no-install-recommends \
+ gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \
+ bzip2
+
+RUN mkdir /toolchain
+RUN curl -L https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \
+ tar xjf - -C /toolchain --strip-components=1
+
+ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15/bin \
+ CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \
+ CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-gcc
diff --git a/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile b/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile
new file mode 100644
index 0000000..2eb5de2
--- /dev/null
+++ b/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile
@@ -0,0 +1,11 @@
+FROM ubuntu:16.10
+
+RUN apt-get update
+RUN apt-get install -y --no-install-recommends \
+ gcc libc6-dev qemu-user ca-certificates \
+ gcc-mips64-linux-gnuabi64 libc6-dev-mips64-cross \
+ qemu-system-mips64
+
+ENV CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER=mips64-linux-gnuabi64-gcc \
+ CC_mips64_unknown_linux_gnuabi64=mips64-linux-gnuabi64-gcc \
+ PATH=$PATH:/rust/bin
diff --git a/ci/docker/mipsel-unknown-linux-musl/Dockerfile b/ci/docker/mipsel-unknown-linux-musl/Dockerfile
index bf7b45b..36c4d90 100644
--- a/ci/docker/mipsel-unknown-linux-musl/Dockerfile
+++ b/ci/docker/mipsel-unknown-linux-musl/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:16.04
+FROM ubuntu:16.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
diff --git a/ci/docker/powerpc-unknown-linux-gnu/Dockerfile b/ci/docker/powerpc-unknown-linux-gnu/Dockerfile
index 052db49..d9d7db0 100644
--- a/ci/docker/powerpc-unknown-linux-gnu/Dockerfile
+++ b/ci/docker/powerpc-unknown-linux-gnu/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:16.04
+FROM ubuntu:16.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
diff --git a/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile b/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
index 03ce673..df0e605 100644
--- a/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
+++ b/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:16.04
+FROM ubuntu:16.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
diff --git a/ci/docker/x86_64-unknown-freebsd/Dockerfile b/ci/docker/x86_64-unknown-freebsd/Dockerfile
index 23135e8..b127338 100644
--- a/ci/docker/x86_64-unknown-freebsd/Dockerfile
+++ b/ci/docker/x86_64-unknown-freebsd/Dockerfile
@@ -3,7 +3,7 @@
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
- qemu qemu-kvm kmod cpu-checker
+ qemu genext2fs
ENTRYPOINT ["sh"]
diff --git a/ci/docker/x86_64-unknown-linux-gnu/Dockerfile b/ci/docker/x86_64-unknown-linux-gnu/Dockerfile
index 294a062..4af3f83 100644
--- a/ci/docker/x86_64-unknown-linux-gnu/Dockerfile
+++ b/ci/docker/x86_64-unknown-linux-gnu/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:16.04
+FROM ubuntu:16.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates
diff --git a/ci/docker/x86_64-unknown-linux-musl/Dockerfile b/ci/docker/x86_64-unknown-linux-musl/Dockerfile
index f440038..9c24999 100644
--- a/ci/docker/x86_64-unknown-linux-musl/Dockerfile
+++ b/ci/docker/x86_64-unknown-linux-musl/Dockerfile
@@ -1,13 +1,13 @@
-FROM ubuntu:16.04
+FROM ubuntu:16.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.14.tar.gz | \
+RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \
tar xzf - && \
- cd musl-1.1.14 && \
+ cd musl-1.1.15 && \
./configure --prefix=/musl-x86_64 && \
make install -j4 && \
cd .. && \
- rm -rf musl-1.1.14
+ rm -rf musl-1.1.15
ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin
diff --git a/ci/docker/x86_64-unknown-openbsd/Dockerfile b/ci/docker/x86_64-unknown-openbsd/Dockerfile
index 41edc62..26340a5 100644
--- a/ci/docker/x86_64-unknown-openbsd/Dockerfile
+++ b/ci/docker/x86_64-unknown-openbsd/Dockerfile
@@ -1,7 +1,8 @@
-FROM ubuntu:16.04
+FROM ubuntu:16.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
- gcc libc6-dev qemu qemu-kvm curl ca-certificates kmod cpu-checker
+ gcc libc6-dev qemu curl ca-certificates \
+ genext2fs
ENV PATH=$PATH:/rust/bin \
QEMU=2016-09-07/openbsd-6.0-without-pkgs.qcow2
diff --git a/ci/run-docker.sh b/ci/run-docker.sh
index 5ad9065..e34e65f 100644
--- a/ci/run-docker.sh
+++ b/ci/run-docker.sh
@@ -7,6 +7,7 @@
echo $1
docker build -t libc ci/docker/$1
docker run \
+ --rm \
-v `rustc --print sysroot`:/rust:ro \
-v `pwd`:/checkout:ro \
-e CARGO_TARGET_DIR=/tmp/target \
diff --git a/ci/run.sh b/ci/run.sh
index a4e7117..15721ab 100755
--- a/ci/run.sh
+++ b/ci/run.sh
@@ -37,11 +37,7 @@
# This will have a `run.sh` script will which use the artifacts inside to run
# on the host.
rm -f $tmpdir/libc-test.img
- dd if=/dev/null of=$tmpdir/libc-test.img bs=1M seek=50
- mkfs.ext2 -F $tmpdir/libc-test.img
- rm -rf $tmpdir/mount
mkdir $tmpdir/mount
- mount -t ext2 -o loop $tmpdir/libc-test.img $tmpdir/mount
# If we have a cross compiler, then we just do the standard rigamarole of
# cross-compiling an executable and then the script to run just executes the
@@ -74,22 +70,18 @@
cp libc-test/run-generated-Cargo.toml $tmpdir/mount/libc/libc-test/Cargo.toml
fi
- umount $tmpdir/mount
-
- # If we can use kvm, prefer that, otherwise just fall back to user-space
- # emulation.
- if kvm-ok; then
- program=kvm
- else
- program=qemu-system-x86_64
- fi
+ du -sh $tmpdir/mount
+ genext2fs \
+ --root $tmpdir/mount \
+ --size-in-blocks 100000 \
+ $tmpdir/libc-test.img
# Pass -snapshot to prevent tampering with the disk images, this helps when
# running this script in development. The two drives are then passed next,
# first is the OS and second is the one we just made. Next the network is
# configured to work (I'm not entirely sure how), and then finally we turn off
# graphics and redirect the serial console output to out.log.
- $program \
+ qemu-system-x86_64 \
-m 1024 \
-snapshot \
-drive if=virtio,file=$tmpdir/$qemufile \
@@ -129,10 +121,19 @@
qemu-mips -L /usr/mips-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/libc-test
;;
- mipsel-unknown-linux-musl)
- qemu-mipsel -L /toolchain $CARGO_TARGET_DIR/$TARGET/debug/libc-test
+ mips64-unknown-linux-gnuabi64)
+ qemu-mips64 -L /usr/mips64-linux-gnuabi64 $CARGO_TARGET_DIR/$TARGET/debug/libc-test
;;
+ mips-unknown-linux-musl)
+ qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15 \
+ $CARGO_TARGET_DIR/$TARGET/debug/libc-test
+ ;;
+
+ mipsel-unknown-linux-musl)
+ qemu-mipsel -L /toolchain $CARGO_TARGET_DIR/$TARGET/debug/libc-test
+ ;;
+
powerpc-unknown-linux-gnu)
qemu-ppc -L /usr/powerpc-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/libc-test
;;
diff --git a/libc-test/Cargo.lock b/libc-test/Cargo.lock
deleted file mode 100644
index b186824..0000000
--- a/libc-test/Cargo.lock
+++ /dev/null
@@ -1,97 +0,0 @@
-[root]
-name = "libc-test"
-version = "0.1.0"
-dependencies = [
- "ctest 0.1.0 (git+https://github.com/alexcrichton/ctest)",
- "libc 0.2.16",
-]
-
-[[package]]
-name = "bitflags"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "ctest"
-version = "0.1.0"
-source = "git+https://github.com/alexcrichton/ctest#2839e49847a6adca6e96cc81c46a1f03f8562ac0"
-dependencies = [
- "gcc 0.3.35 (registry+https://github.com/rust-lang/crates.io-index)",
- "syntex_syntax 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "gcc"
-version = "0.3.35"
-source = "git+https://github.com/alexcrichton/gcc-rs#fbb4ef58f028ee5e61307b479b53c8d8070db52c"
-
-[[package]]
-name = "gcc"
-version = "0.3.35"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-replace = "gcc 0.3.35 (git+https://github.com/alexcrichton/gcc-rs)"
-
-[[package]]
-name = "kernel32-sys"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "libc"
-version = "0.1.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "libc"
-version = "0.2.16"
-
-[[package]]
-name = "log"
-version = "0.3.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "rustc-serialize"
-version = "0.3.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "syntex_syntax"
-version = "0.19.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
- "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
- "term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
- "unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "term"
-version = "0.2.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "unicode-xid"
-version = "0.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "winapi"
-version = "0.2.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "winapi-build"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
\ No newline at end of file
diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml
index dfcf127..4e7c884 100644
--- a/libc-test/Cargo.toml
+++ b/libc-test/Cargo.toml
@@ -8,7 +8,4 @@
libc = { path = ".." }
[build-dependencies]
-ctest = { git = "https://github.com/alexcrichton/ctest" }
-
-[replace]
-"gcc:0.3.35" = { git = "https://github.com/alexcrichton/gcc-rs" }
+ctest = "0.1"
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 48a922f..bbd9f8c 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -160,8 +160,10 @@
cfg.header("sys/signalfd.h");
cfg.header("sys/xattr.h");
cfg.header("sys/ipc.h");
+ cfg.header("sys/msg.h");
cfg.header("sys/shm.h");
cfg.header("pty.h");
+ cfg.header("shadow.h");
}
if linux || android {
@@ -332,7 +334,8 @@
// kernel regardless
"RLIMIT_NLIMITS" |
"TCP_COOKIE_TRANSACTIONS" |
- "RLIMIT_RTTIME" if musl => true,
+ "RLIMIT_RTTIME" |
+ "MSG_COPY" if musl => true,
// work around super old mips toolchain
"SCHED_IDLE" | "SHM_NORESERVE" => mips,
diff --git a/libc-test/generate-files/Cargo.lock b/libc-test/generate-files/Cargo.lock
deleted file mode 100644
index 662fe8a..0000000
--- a/libc-test/generate-files/Cargo.lock
+++ /dev/null
@@ -1,108 +0,0 @@
-[root]
-name = "generate-files"
-version = "0.1.0"
-dependencies = [
- "ctest 0.1.0 (git+https://github.com/alexcrichton/ctest)",
-]
-
-[[package]]
-name = "advapi32-sys"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "bitflags"
-version = "0.3.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "ctest"
-version = "0.1.0"
-source = "git+https://github.com/alexcrichton/ctest#a6becb6d7fd23d9863cba86eac31d1ffc4082734"
-dependencies = [
- "gcc 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)",
- "syntex_syntax 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "gcc"
-version = "0.3.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "kernel32-sys"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "libc"
-version = "0.1.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "libc"
-version = "0.2.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "log"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "libc 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "rustc-serialize"
-version = "0.3.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "syntex_syntax"
-version = "0.19.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
- "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
- "term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
- "unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "term"
-version = "0.2.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "unicode-xid"
-version = "0.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "winapi"
-version = "0.2.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
-name = "winapi-build"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
diff --git a/libc-test/generate-files/Cargo.toml b/libc-test/generate-files/Cargo.toml
index 9615a63..8c19856 100644
--- a/libc-test/generate-files/Cargo.toml
+++ b/libc-test/generate-files/Cargo.toml
@@ -13,4 +13,4 @@
path = "../build.rs"
[dependencies]
-ctest = { git = "https://github.com/alexcrichton/ctest" }
+ctest = "0.1"
diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index 72e6dea..aa4d1ac 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -621,6 +621,8 @@
pub const EQFULL: ::c_int = 106;
pub const ELAST: ::c_int = 106;
+pub const EAI_SYSTEM: ::c_int = 11;
+
pub const F_DUPFD: ::c_int = 0;
pub const F_DUPFD_CLOEXEC: ::c_int = 67;
pub const F_GETFD: ::c_int = 1;
diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
index 642dd1f..179cd91 100644
--- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -293,6 +293,8 @@
pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
pub const NOTE_CHILD: ::uint32_t = 0x00000004;
+pub const MSG_NOSIGNAL: ::uint32_t = 0x400;
+
extern {
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index 31188ac..a89440e 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -272,6 +272,8 @@
pub const CTL_P1003_1B_TIMER_MAX: ::c_int = 25;
pub const CTL_P1003_1B_MAXID: ::c_int = 26;
+pub const MSG_NOSIGNAL: ::c_int = 0x20000;
+
extern {
pub fn __error() -> *mut ::c_int;
diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs
index 9cfdf6e..2cfb323 100644
--- a/src/unix/bsd/freebsdlike/mod.rs
+++ b/src/unix/bsd/freebsdlike/mod.rs
@@ -467,6 +467,8 @@
pub const ENOLINK: ::c_int = 91;
pub const EPROTO: ::c_int = 92;
+pub const EAI_SYSTEM: ::c_int = 11;
+
pub const F_DUPFD: ::c_int = 0;
pub const F_GETFD: ::c_int = 1;
pub const F_SETFD: ::c_int = 2;
@@ -860,6 +862,8 @@
pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int;
pub fn sem_timedwait(sem: *mut sem_t,
abstime: *const ::timespec) -> ::c_int;
+ pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
+ abstime: *const ::timespec) -> ::c_int;
}
cfg_if! {
diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs
index d244cd6..0616cd3 100644
--- a/src/unix/bsd/mod.rs
+++ b/src/unix/bsd/mod.rs
@@ -321,6 +321,8 @@
}
extern {
+ pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
+ pub fn freeifaddrs(ifa: *mut ::ifaddrs);
pub fn setgroups(ngroups: ::c_int,
ptr: *const ::gid_t) -> ::c_int;
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs
index 9631f8a..6604ec0 100644
--- a/src/unix/bsd/netbsdlike/mod.rs
+++ b/src/unix/bsd/netbsdlike/mod.rs
@@ -1,5 +1,3 @@
-pub type c_long = i64;
-pub type c_ulong = u64;
pub type time_t = i64;
pub type mode_t = u32;
pub type nlink_t = ::uint32_t;
@@ -394,6 +392,8 @@
pub const SO_ERROR: ::c_int = 0x1007;
pub const SO_TYPE: ::c_int = 0x1008;
+pub const MSG_NOSIGNAL: ::c_int = 0x400;
+
pub const IFF_LOOPBACK: ::c_int = 0x8;
pub const SHUT_RD: ::c_int = 0;
@@ -529,6 +529,9 @@
abstime: *const ::timespec) -> ::c_int;
pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
clock_id: clockid_t) -> ::c_int;
+ pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
+ pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
+ abstime: *const ::timespec) -> ::c_int;
}
cfg_if! {
diff --git a/src/unix/bsd/netbsdlike/netbsd.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
similarity index 99%
rename from src/unix/bsd/netbsdlike/netbsd.rs
rename to src/unix/bsd/netbsdlike/netbsd/mod.rs
index 72101f0..aa46aff 100644
--- a/src/unix/bsd/netbsdlike/netbsd.rs
+++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -547,6 +547,8 @@
pub const KERN_PROC_GID: ::c_int = 7;
pub const KERN_PROC_RGID: ::c_int = 8;
+pub const EAI_SYSTEM: ::c_int = 11;
+
extern {
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
pub fn getnameinfo(sa: *const ::sockaddr,
@@ -588,7 +590,6 @@
pid: ::pid_t,
addr: *mut ::c_void,
data: ::c_int) -> ::c_int;
- pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
pub fn pthread_setname_np(t: ::pthread_t,
name: *const ::c_char,
arg: *mut ::c_void) -> ::c_int;
@@ -612,3 +613,6 @@
locale: *const ::c_char,
base: ::locale_t) -> ::locale_t;
}
+
+mod other;
+pub use self::other::*;
diff --git a/src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs b/src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs
new file mode 100644
index 0000000..9b0b338
--- /dev/null
+++ b/src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs
@@ -0,0 +1,2 @@
+pub type c_long = i32;
+pub type c_ulong = u32;
diff --git a/src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs b/src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs
new file mode 100644
index 0000000..b07c476
--- /dev/null
+++ b/src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs
@@ -0,0 +1,2 @@
+pub type c_long = i64;
+pub type c_ulong = u64;
diff --git a/src/unix/bsd/netbsdlike/netbsd/other/mod.rs b/src/unix/bsd/netbsdlike/netbsd/other/mod.rs
new file mode 100644
index 0000000..f4e7cc4
--- /dev/null
+++ b/src/unix/bsd/netbsdlike/netbsd/other/mod.rs
@@ -0,0 +1,13 @@
+cfg_if! {
+ if #[cfg(target_arch = "x86_64")] {
+ mod b64;
+ pub use self::b64::*;
+ } else if #[cfg(any(target_arch = "arm",
+ target_arch = "powerpc",
+ target_arch = "x86"))] {
+ mod b32;
+ pub use self::b32::*;
+ } else {
+ // Unknown target_arch
+ }
+}
diff --git a/src/unix/bsd/netbsdlike/openbsdlike/mod.rs b/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
index 03ed194..d7afb11 100644
--- a/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
+++ b/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
@@ -1,3 +1,5 @@
+pub type c_long = i64;
+pub type c_ulong = u64;
pub type clock_t = i64;
pub type suseconds_t = i64;
pub type dev_t = i32;
@@ -172,6 +174,8 @@
pub const ENOMEDIUM : ::c_int = 85;
pub const EMEDIUMTYPE : ::c_int = 86;
+pub const EAI_SYSTEM: ::c_int = -11;
+
pub const RUSAGE_THREAD: ::c_int = 1;
pub const MAP_COPY : ::c_int = 0x0002;
diff --git a/src/unix/haiku/b32.rs b/src/unix/haiku/b32.rs
new file mode 100644
index 0000000..9b0b338
--- /dev/null
+++ b/src/unix/haiku/b32.rs
@@ -0,0 +1,2 @@
+pub type c_long = i32;
+pub type c_ulong = u32;
diff --git a/src/unix/haiku/b64.rs b/src/unix/haiku/b64.rs
new file mode 100644
index 0000000..5d63ce9
--- /dev/null
+++ b/src/unix/haiku/b64.rs
@@ -0,0 +1,2 @@
+pub type c_ulong = u64;
+pub type c_long = i64;
diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs
new file mode 100644
index 0000000..a241a02
--- /dev/null
+++ b/src/unix/haiku/mod.rs
@@ -0,0 +1,748 @@
+use dox::mem;
+
+pub type rlim_t = ::uintptr_t;
+pub type sa_family_t = u8;
+pub type pthread_key_t = ::c_int;
+pub type nfds_t = ::c_long;
+pub type tcflag_t = ::c_uint;
+pub type speed_t = ::c_uint;
+pub type c_char = i8;
+pub type clock_t = i32;
+pub type clockid_t = i32;
+pub type time_t = i32;
+pub type suseconds_t = i32;
+pub type wchar_t = i32;
+pub type off_t = i64;
+pub type ino_t = i64;
+pub type blkcnt_t = i64;
+pub type blksize_t = i32;
+pub type dev_t = i32;
+pub type mode_t = u32;
+pub type nlink_t = i32;
+pub type useconds_t = u32;
+pub type socklen_t = u32;
+pub type pthread_t = ::uintptr_t;
+pub type pthread_mutexattr_t = ::uintptr_t;
+pub type sigset_t = u64;
+pub type fsblkcnt_t = i64;
+pub type fsfilcnt_t = i64;
+pub type pthread_attr_t = *mut ::c_void;
+pub type nl_item = ::c_int;
+
+pub enum timezone {}
+
+s! {
+ pub struct sockaddr {
+ pub sa_len: u8,
+ pub sa_family: sa_family_t,
+ pub sa_data: [::c_char; 30],
+ }
+
+ pub struct sockaddr_in {
+ pub sin_len: u8,
+ pub sin_family: sa_family_t,
+ pub sin_port: ::in_port_t,
+ pub sin_addr: ::in_addr,
+ pub sin_zero: [u8; 24],
+ }
+
+ pub struct sockaddr_in6 {
+ pub sin6_len: u8,
+ pub sin6_family: sa_family_t,
+ pub sin6_port: ::in_port_t,
+ pub sin6_flowinfo: u32,
+ pub sin6_addr: ::in6_addr,
+ pub sin6_scope_id: u32,
+ }
+
+ pub struct sockaddr_un {
+ pub sun_len: u8,
+ pub sun_family: sa_family_t,
+ pub sun_path: [::c_char; 126]
+ }
+
+ pub struct sockaddr_storage {
+ pub ss_len: u8,
+ pub ss_family: sa_family_t,
+ __ss_pad1: [u8; 6],
+ __ss_pad2: u64,
+ __ss_pad3: [u8; 112],
+ }
+
+ pub struct addrinfo {
+ pub ai_flags: ::c_int,
+ pub ai_family: ::c_int,
+ pub ai_socktype: ::c_int,
+ pub ai_protocol: ::c_int,
+ pub ai_addrlen: socklen_t,
+ pub ai_canonname: *mut c_char,
+ pub ai_addr: *mut ::sockaddr,
+ pub ai_next: *mut addrinfo,
+ }
+
+ pub struct fd_set {
+ fds_bits: [c_ulong; FD_SETSIZE / ULONG_SIZE],
+ }
+
+ pub struct tm {
+ pub tm_sec: ::c_int,
+ pub tm_min: ::c_int,
+ pub tm_hour: ::c_int,
+ pub tm_mday: ::c_int,
+ pub tm_mon: ::c_int,
+ pub tm_year: ::c_int,
+ pub tm_wday: ::c_int,
+ pub tm_yday: ::c_int,
+ pub tm_isdst: ::c_int,
+ pub tm_gmtoff: ::c_long,
+ pub tm_zone: *const ::c_char,
+ }
+
+ pub struct utsname {
+ pub sysname: [::c_char; 32],
+ pub nodename: [::c_char; 32],
+ pub release: [::c_char; 32],
+ pub version: [::c_char; 32],
+ pub machine: [::c_char; 32],
+ }
+
+ pub struct lconv {
+ pub decimal_point: *mut ::c_char,
+ pub thousands_sep: *mut ::c_char,
+ pub grouping: *mut ::c_char,
+ pub int_curr_symbol: *mut ::c_char,
+ pub currency_symbol: *mut ::c_char,
+ pub mon_decimal_point: *mut ::c_char,
+ pub mon_thousands_sep: *mut ::c_char,
+ pub mon_grouping: *mut ::c_char,
+ pub positive_sign: *mut ::c_char,
+ pub negative_sign: *mut ::c_char,
+ pub int_frac_digits: ::c_char,
+ pub frac_digits: ::c_char,
+ pub p_cs_precedes: ::c_char,
+ pub p_sep_by_space: ::c_char,
+ pub n_cs_precedes: ::c_char,
+ pub n_sep_by_space: ::c_char,
+ pub p_sign_posn: ::c_char,
+ pub n_sign_posn: ::c_char,
+ pub int_p_cs_precedes: ::c_char,
+ pub int_p_sep_by_space: ::c_char,
+ pub int_n_cs_precedes: ::c_char,
+ pub int_n_sep_by_space: ::c_char,
+ pub int_p_sign_posn: ::c_char,
+ pub int_n_sign_posn: ::c_char,
+ }
+
+ pub struct msghdr {
+ pub msg_name: *mut ::c_void,
+ pub msg_namelen: ::socklen_t,
+ pub msg_iov: *mut ::iovec,
+ pub msg_iovlen: ::c_int,
+ pub msg_control: *mut ::c_void,
+ pub msg_controllen: ::socklen_t,
+ pub msg_flags: ::c_int,
+ }
+
+ pub struct Dl_info {
+ pub dli_fname: *const ::c_char,
+ pub dli_fbase: *mut ::c_void,
+ pub dli_sname: *const ::c_char,
+ pub dli_saddr: *mut ::c_void,
+ }
+
+ pub struct termios {
+ pub c_iflag: ::tcflag_t,
+ pub c_oflag: ::tcflag_t,
+ pub c_cflag: ::tcflag_t,
+ pub c_lflag: ::tcflag_t,
+ pub c_line: ::c_char,
+ pub c_ispeed: ::speed_t,
+ pub c_ospeed: ::speed_t,
+ pub c_cc: [::cc_t; ::NCCS],
+ }
+
+ pub struct stat {
+ pub st_dev: dev_t,
+ pub st_ino: ino_t,
+ pub st_mode: mode_t,
+ pub st_nlink: nlink_t,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub st_size: off_t,
+ pub st_rdev: dev_t,
+ pub st_blksize: blksize_t,
+ pub st_atime: time_t,
+ pub st_atime_nsec: c_long,
+ pub st_mtime: time_t,
+ pub st_mtime_nsec: c_long,
+ pub st_ctime: time_t,
+ pub st_ctime_nsec: c_long,
+ pub st_crtime: time_t,
+ pub st_crtime_nsec: c_long,
+ pub st_type: u32,
+ pub st_blocks: blkcnt_t,
+ }
+
+ pub struct dirent {
+ pub d_dev: dev_t,
+ pub d_pdev: dev_t,
+ pub d_ino: ino_t,
+ pub d_pino: i64,
+ pub d_reclen: ::c_ushort,
+ pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX
+ }
+
+ pub struct glob_t {
+ pub gl_pathc: ::size_t,
+ __unused1: ::size_t,
+ pub gl_offs: ::size_t,
+ __unused2: ::size_t,
+ pub gl_pathv: *mut *mut c_char,
+
+ __unused3: *mut ::c_void,
+ __unused4: *mut ::c_void,
+ __unused5: *mut ::c_void,
+ __unused6: *mut ::c_void,
+ __unused7: *mut ::c_void,
+ __unused8: *mut ::c_void,
+ }
+
+ pub struct pthread_mutex_t {
+ flags: u32,
+ lock: i32,
+ unused: i32,
+ owner: i32,
+ owner_count: i32,
+ }
+
+ pub struct pthread_cond_t {
+ flags: u32,
+ unused: i32,
+ mutex: *mut ::c_void,
+ waiter_count: i32,
+ lock: i32,
+ }
+
+ pub struct pthread_rwlock_t {
+ flags: u32,
+ owner: i32,
+ lock_sem: i32, // this is actually a union
+ lock_count: i32,
+ reader_count: i32,
+ writer_count: i32,
+ waiters: [*mut ::c_void; 2],
+ }
+
+ pub struct passwd {
+ pub pw_name: *mut ::c_char,
+ pub pw_passwd: *mut ::c_char,
+ pub pw_uid: ::uid_t,
+ pub pw_gid: ::gid_t,
+ pub pw_dir: *mut ::c_char,
+ pub pw_shell: *mut ::c_char,
+ pub pw_gecos: *mut ::c_char,
+ }
+
+ pub struct statvfs {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: ::fsblkcnt_t,
+ pub f_bfree: ::fsblkcnt_t,
+ pub f_bavail: ::fsblkcnt_t,
+ pub f_files: ::fsfilcnt_t,
+ pub f_ffree: ::fsfilcnt_t,
+ pub f_favail: ::fsfilcnt_t,
+ pub f_fsid: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ }
+
+ pub struct stack_t {
+ pub ss_sp: *mut ::c_void,
+ pub ss_size: ::size_t,
+ pub ss_flags: ::c_int,
+ }
+
+ pub struct siginfo_t {
+ pub si_signo: ::c_int,
+ pub si_code: ::c_int,
+ pub si_errno: ::c_int,
+ pub si_pid: ::pid_t,
+ pub si_uid: ::uid_t,
+ pub si_addr: *mut ::c_void,
+ pub si_status: ::c_int,
+ pub si_band: c_long,
+ pub sigval: *mut ::c_void,
+ }
+
+ pub struct sigaction {
+ pub sa_sigaction: ::sighandler_t,
+ pub sa_mask: ::sigset_t,
+ pub sa_flags: ::c_int,
+ sa_userdata: *mut ::c_void,
+ }
+
+ pub struct sem_t {
+ pub se_type: i32,
+ pub se_named_id: i32, // this is actually a union
+ pub se_unnamed: i32,
+ pub se_padding: [i32; 4],
+ }
+
+ pub struct pthread_condattr_t {
+ pub process_shared: bool,
+ pub clock_id: i32,
+ }
+}
+
+// intentionally not public, only used for fd_set
+cfg_if! {
+ if #[cfg(target_pointer_width = "32")] {
+ const ULONG_SIZE: usize = 32;
+ } else if #[cfg(target_pointer_width = "64")] {
+ const ULONG_SIZE: usize = 64;
+ } else {
+ // Unknown target_pointer_width
+ }
+}
+
+pub const EXIT_FAILURE: ::c_int = 1;
+pub const EXIT_SUCCESS: ::c_int = 0;
+pub const RAND_MAX: ::c_int = 2147483647;
+pub const EOF: ::c_int = -1;
+pub const SEEK_SET: ::c_int = 0;
+pub const SEEK_CUR: ::c_int = 1;
+pub const SEEK_END: ::c_int = 2;
+pub const _IOFBF: ::c_int = 0;
+pub const _IONBF: ::c_int = 2;
+pub const _IOLBF: ::c_int = 1;
+
+pub const F_DUPFD: ::c_int = 0x0001;
+pub const F_GETFD: ::c_int = 0x0002;
+pub const F_SETFD: ::c_int = 0x0004;
+pub const F_GETFL: ::c_int = 0x0008;
+pub const F_SETFL: ::c_int = 0x0010;
+
+pub const SIGTRAP: ::c_int = 22;
+
+pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
+pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
+
+pub const CLOCK_REALTIME: ::c_int = -1;
+pub const CLOCK_MONOTONIC: ::c_int = 0;
+
+pub const RLIMIT_CORE: ::c_int = 0;
+pub const RLIMIT_CPU: ::c_int = 1;
+pub const RLIMIT_DATA: ::c_int = 2;
+pub const RLIMIT_FSIZE: ::c_int = 3;
+pub const RLIMIT_NOFILE: ::c_int = 4;
+pub const RLIMIT_AS: ::c_int = 6;
+// Haiku specific
+pub const RLIMIT_NOVMON: ::c_int = 7;
+pub const RLIMIT_NLIMITS: ::c_int = 8;
+
+pub const RUSAGE_SELF: ::c_int = 0;
+
+pub const NCCS: usize = 11;
+
+pub const O_RDONLY: ::c_int = 0x0000;
+pub const O_WRONLY: ::c_int = 0x0001;
+pub const O_RDWR: ::c_int = 0x0002;
+pub const O_ACCMODE: ::c_int = 0x0003;
+
+pub const O_EXCL: ::c_int = 0x0100;
+pub const O_CREAT: ::c_int = 0x0200;
+pub const O_TRUNC: ::c_int = 0x0400;
+pub const O_NOCTTY: ::c_int = 0x1000;
+pub const O_NOTRAVERSE: ::c_int = 0x2000;
+
+pub const O_CLOEXEC: ::c_int = 0x00000040;
+pub const O_NONBLOCK: ::c_int = 0x00000080;
+pub const O_APPEND: ::c_int = 0x00000800;
+pub const O_SYNC: ::c_int = 0x00010000;
+pub const O_RSYNC: ::c_int = 0x00020000;
+pub const O_DSYNC: ::c_int = 0x00040000;
+pub const O_NOFOLLOW: ::c_int = 0x00080000;
+pub const O_NOCACHE: ::c_int = 0x00100000;
+pub const O_DIRECTORY: ::c_int = 0x00200000;
+
+pub const S_IFIFO: ::mode_t = 61440;
+pub const S_IFCHR: ::mode_t = 49152;
+pub const S_IFBLK: ::mode_t = 24576;
+pub const S_IFDIR: ::mode_t = 16384;
+pub const S_IFREG: ::mode_t = 32768;
+pub const S_IFLNK: ::mode_t = 40960;
+pub const S_IFSOCK: ::mode_t = 49152;
+pub const S_IFMT: ::mode_t = 61440;
+pub const S_IRWXU: ::mode_t = 448;
+pub const S_IXUSR: ::mode_t = 64;
+pub const S_IWUSR: ::mode_t = 128;
+pub const S_IRUSR: ::mode_t = 256;
+pub const S_IRWXG: ::mode_t = 70;
+pub const S_IXGRP: ::mode_t = 10;
+pub const S_IWGRP: ::mode_t = 20;
+pub const S_IRGRP: ::mode_t = 40;
+pub const S_IRWXO: ::mode_t = 7;
+pub const S_IXOTH: ::mode_t = 1;
+pub const S_IWOTH: ::mode_t = 2;
+pub const S_IROTH: ::mode_t = 4;
+pub const F_OK: ::c_int = 0;
+pub const R_OK: ::c_int = 4;
+pub const W_OK: ::c_int = 2;
+pub const X_OK: ::c_int = 1;
+pub const STDIN_FILENO: ::c_int = 0;
+pub const STDOUT_FILENO: ::c_int = 1;
+pub const STDERR_FILENO: ::c_int = 2;
+pub const SIGHUP: ::c_int = 1;
+pub const SIGINT: ::c_int = 2;
+pub const SIGQUIT: ::c_int = 3;
+pub const SIGILL: ::c_int = 4;
+pub const SIGABRT: ::c_int = 6;
+pub const SIGFPE: ::c_int = 8;
+pub const SIGKILL: ::c_int = 9;
+pub const SIGSEGV: ::c_int = 11;
+pub const SIGPIPE: ::c_int = 7;
+pub const SIGALRM: ::c_int = 14;
+pub const SIGTERM: ::c_int = 15;
+
+pub const EAI_SYSTEM: ::c_int = 11;
+
+pub const PROT_NONE: ::c_int = 0;
+pub const PROT_READ: ::c_int = 1;
+pub const PROT_WRITE: ::c_int = 2;
+pub const PROT_EXEC: ::c_int = 4;
+
+pub const LC_ALL: ::c_int = 0;
+pub const LC_COLLATE: ::c_int = 1;
+pub const LC_CTYPE: ::c_int = 2;
+pub const LC_MONETARY: ::c_int = 3;
+pub const LC_NUMERIC: ::c_int = 4;
+pub const LC_TIME: ::c_int = 5;
+pub const LC_MESSAGES: ::c_int = 6;
+
+// TODO: Haiku does not have MAP_FILE, but libstd/os.rs requires it
+pub const MAP_FILE: ::c_int = 0x00;
+pub const MAP_SHARED: ::c_int = 0x01;
+pub const MAP_PRIVATE: ::c_int = 0x02;
+pub const MAP_FIXED: ::c_int = 0x004;
+
+pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
+
+pub const MS_ASYNC: ::c_int = 0x01;
+pub const MS_INVALIDATE: ::c_int = 0x04;
+pub const MS_SYNC: ::c_int = 0x02;
+
+pub const EPERM : ::c_int = -2147483633;
+pub const ENOENT : ::c_int = -2147459069;
+pub const ESRCH : ::c_int = -2147454963;
+pub const EINTR : ::c_int = -2147483638;
+pub const EIO : ::c_int = -2147483647;
+pub const ENXIO : ::c_int = -2147454965;
+pub const E2BIG : ::c_int = -2147454975;
+pub const ENOEXEC : ::c_int = -2147478782;
+pub const EBADF : ::c_int = -2147459072;
+pub const ECHILD : ::c_int = -2147454974;
+pub const EDEADLK : ::c_int = -2147454973;
+pub const ENOMEM : ::c_int = -2147454976;
+pub const EACCES : ::c_int = -2147483646;
+pub const EFAULT : ::c_int = -2147478783;
+// pub const ENOTBLK : ::c_int = 15;
+pub const EBUSY : ::c_int = -2147483634;
+pub const EEXIST : ::c_int = -2147459070;
+pub const EXDEV : ::c_int = -2147459061;
+pub const ENODEV : ::c_int = -2147454969;
+pub const ENOTDIR : ::c_int = -2147459067;
+pub const EISDIR : ::c_int = -2147459063;
+pub const EINVAL : ::c_int = -2147483643;
+pub const ENFILE : ::c_int = -2147454970;
+pub const EMFILE : ::c_int = -2147459062;
+pub const ENOTTY : ::c_int = -2147454966;
+pub const ETXTBSY : ::c_int = -2147454917;
+pub const EFBIG : ::c_int = -2147454972;
+pub const ENOSPC : ::c_int = -2147459065;
+pub const ESPIPE : ::c_int = -2147454964;
+pub const EROFS : ::c_int = -2147459064;
+pub const EMLINK : ::c_int = -2147454971;
+pub const EPIPE : ::c_int = -2147459059;
+pub const EDOM : ::c_int = -2147454960;
+pub const ERANGE : ::c_int = -2147454959;
+pub const EAGAIN : ::c_int = -2147483637;
+pub const EWOULDBLOCK : ::c_int = -2147483637;
+
+pub const EINPROGRESS : ::c_int = -2147454940;
+pub const EALREADY : ::c_int = -2147454939;
+pub const ENOTSOCK : ::c_int = -2147454932;
+pub const EDESTADDRREQ : ::c_int = -2147454928;
+pub const EMSGSIZE : ::c_int = -2147454934;
+pub const EPROTOTYPE : ::c_int = -2147454958;
+pub const ENOPROTOOPT : ::c_int = -2147454942;
+pub const EPROTONOSUPPORT : ::c_int = -2147454957;
+pub const EOPNOTSUPP : ::c_int = -2147454933;
+pub const EPFNOSUPPORT : ::c_int = -2147454956;
+pub const EAFNOSUPPORT : ::c_int = -2147454955;
+pub const EADDRINUSE : ::c_int = -2147454954;
+pub const EADDRNOTAVAIL : ::c_int = -2147454953;
+pub const ENETDOWN : ::c_int = -2147454953;
+pub const ENETUNREACH : ::c_int = -2147454951;
+pub const ENETRESET : ::c_int = -2147454950;
+pub const ECONNABORTED : ::c_int = -2147454949;
+pub const ECONNRESET : ::c_int = -2147454948;
+pub const ENOBUFS : ::c_int = -2147454941;
+pub const EISCONN : ::c_int = -2147454947;
+pub const ENOTCONN : ::c_int = -2147454946;
+pub const ESHUTDOWN : ::c_int = -2147454945;
+pub const ETIMEDOUT : ::c_int = -2147483639;
+pub const ECONNREFUSED : ::c_int = -2147454944;
+pub const ELOOP : ::c_int = -2147459060;
+pub const ENAMETOOLONG : ::c_int = -2147459068;
+pub const EHOSTDOWN : ::c_int = -2147454931;
+pub const EHOSTUNREACH : ::c_int = -2147454943;
+pub const ENOTEMPTY : ::c_int = -2147459066;
+pub const EDQUOT : ::c_int = -2147454927;
+pub const ESTALE : ::c_int = -2147454936;
+pub const ENOLCK : ::c_int = -2147454968;
+pub const ENOSYS : ::c_int = -2147454967;
+pub const EIDRM : ::c_int = -2147454926;
+pub const ENOMSG : ::c_int = -2147454937;
+pub const EOVERFLOW : ::c_int = -2147454935;
+pub const ECANCELED : ::c_int = -2147454929;
+pub const EILSEQ : ::c_int = -2147454938;
+pub const ENOATTR : ::c_int = -2147454916;
+pub const EBADMSG : ::c_int = -2147454930;
+pub const EMULTIHOP : ::c_int = -2147454925;
+pub const ENOLINK : ::c_int = -2147454923;
+pub const EPROTO : ::c_int = -2147454919;
+
+pub const IPPROTO_RAW: ::c_int = 255;
+
+// These are prefixed with POSIX_ on Haiku
+pub const MADV_NORMAL: ::c_int = 1;
+pub const MADV_SEQUENTIAL: ::c_int = 2;
+pub const MADV_RANDOM: ::c_int = 3;
+pub const MADV_WILLNEED: ::c_int = 4;
+pub const MADV_DONTNEED: ::c_int = 5;
+
+pub const IFF_LOOPBACK: ::c_int = 0x0008;
+
+pub const AF_UNIX: ::c_int = 9;
+pub const AF_INET: ::c_int = 1;
+pub const AF_INET6: ::c_int = 6;
+pub const SOCK_RAW: ::c_int = 3;
+pub const IPPROTO_TCP: ::c_int = 6;
+pub const IPPROTO_IP: ::c_int = 0;
+pub const IPPROTO_IPV6: ::c_int = 41;
+pub const IP_MULTICAST_TTL: ::c_int = 10;
+pub const IP_MULTICAST_LOOP: ::c_int = 11;
+pub const IP_TTL: ::c_int = 4;
+pub const IP_HDRINCL: ::c_int = 2;
+pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
+pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
+
+pub const TCP_NODELAY: ::c_int = 0x01;
+pub const TCP_MAXSEG: ::c_int = 0x02;
+pub const TCP_NOPUSH: ::c_int = 0x04;
+pub const TCP_NOOPT: ::c_int = 0x08;
+
+pub const IPV6_MULTICAST_LOOP: ::c_int = 26;
+pub const IPV6_JOIN_GROUP: ::c_int = 28;
+pub const IPV6_LEAVE_GROUP: ::c_int = 29;
+pub const IPV6_V6ONLY: ::c_int = 30;
+
+pub const SO_DEBUG: ::c_int = 0x00000004;
+
+pub const MSG_NOSIGNAL: ::c_int = 0x0800;
+
+pub const SHUT_RD: ::c_int = 0;
+pub const SHUT_WR: ::c_int = 1;
+pub const SHUT_RDWR: ::c_int = 2;
+
+pub const LOCK_SH: ::c_int = 0x01;
+pub const LOCK_EX: ::c_int = 0x02;
+pub const LOCK_NB: ::c_int = 0x04;
+pub const LOCK_UN: ::c_int = 0x08;
+
+pub const SIGSTKSZ: ::size_t = 16384;
+
+pub const SA_NODEFER: ::c_int = 0x08;
+pub const SA_RESETHAND: ::c_int = 0x04;
+pub const SA_RESTART: ::c_int = 0x10;
+pub const SA_NOCLDSTOP: ::c_int = 0x01;
+
+pub const FD_SETSIZE: usize = 1024;
+
+pub const RTLD_NOW: ::c_int = 0x1;
+pub const RTLD_DEFAULT: *mut ::c_void = 0isize as *mut ::c_void;
+
+pub const BUFSIZ: ::c_uint = 8192;
+pub const FILENAME_MAX: ::c_uint = 256;
+pub const FOPEN_MAX: ::c_uint = 128;
+pub const L_tmpnam: ::c_uint = 512;
+pub const TMP_MAX: ::c_uint = 32768;
+pub const _PC_NAME_MAX: ::c_int = 4;
+
+pub const FIONBIO: ::c_int = 0xbe000000;
+
+pub const _SC_IOV_MAX : ::c_int = 32;
+pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 25;
+pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 26;
+pub const _SC_PAGESIZE : ::c_int = 27;
+pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 48;
+pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 49;
+pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 50;
+pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 46;
+pub const _SC_THREAD_STACK_MIN : ::c_int = 47;
+pub const _SC_THREADS : ::c_int = 31;
+pub const _SC_ATEXIT_MAX : ::c_int = 37;
+
+pub const PTHREAD_STACK_MIN: ::size_t = 8192;
+
+pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
+ flags: 0,
+ lock: 0,
+ unused: -42,
+ owner: -1,
+ owner_count: 0,
+};
+pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
+ flags: 0,
+ unused: -42,
+ mutex: 0 as *mut _,
+ waiter_count: 0,
+ lock: 0,
+};
+pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
+ flags: 0,
+ owner: 0,
+ lock_sem: 0,
+ lock_count: 0,
+ reader_count: 0,
+ writer_count: 0,
+ waiters: [0 as *mut _; 2],
+};
+
+pub const PTHREAD_MUTEX_DEFAULT: ::c_int = 0;
+pub const PTHREAD_MUTEX_NORMAL: ::c_int = 1;
+pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
+pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 3;
+
+pub const FIOCLEX: c_ulong = 0; // TODO: does not exist on Haiku!
+
+pub const SA_ONSTACK: c_ulong = 0x20;
+pub const SA_SIGINFO: c_ulong = 0x40;
+pub const SA_NOCLDWAIT: c_ulong = 0x02;
+
+pub const SIGCHLD: ::c_int = 5;
+pub const SIGBUS: ::c_int = 30;
+pub const SIG_SETMASK: ::c_int = 3;
+
+pub const RUSAGE_CHILDREN: ::c_int = -1;
+
+pub const SOCK_STREAM: ::c_int = 1;
+pub const SOCK_DGRAM: ::c_int = 2;
+
+pub const SOL_SOCKET: ::c_int = -1;
+pub const SO_ACCEPTCONN: ::c_int = 0x00000001;
+pub const SO_BROADCAST: ::c_int = 0x00000002;
+pub const SO_DONTROUTE: ::c_int = 0x00000008;
+pub const SO_KEEPALIVE: ::c_int = 0x00000010;
+pub const SO_OOBINLINE: ::c_int = 0x00000020;
+pub const SO_REUSEADDR: ::c_int = 0x00000040;
+pub const SO_REUSEPORT: ::c_int = 0x00000080;
+pub const SO_USELOOPBACK: ::c_int = 0x00000100;
+pub const SO_LINGER: ::c_int = 0x00000200;
+pub const SO_SNDBUF: ::c_int = 0x40000001;
+pub const SO_SNDLOWAT: ::c_int = 0x40000002;
+pub const SO_SNDTIMEO: ::c_int = 0x40000003;
+pub const SO_RCVBUF: ::c_int = 0x40000004;
+pub const SO_RCVLOWAT: ::c_int = 0x40000005;
+pub const SO_RCVTIMEO: ::c_int = 0x40000006;
+pub const SO_ERROR: ::c_int = 0x40000007;
+pub const SO_TYPE: ::c_int = 0x40000008;
+pub const SO_NONBLOCK: ::c_int = 0x40000009;
+pub const SO_BINDTODEVICE: ::c_int = 0x4000000a;
+pub const SO_PEERCRED: ::c_int = 0x4000000b;
+
+pub const NI_MAXHOST: ::size_t = 1025;
+
+f! {
+ pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
+ let fd = fd as usize;
+ let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
+ (*set).fds_bits[fd / size] &= !(1 << (fd % size));
+ return
+ }
+
+ pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
+ let fd = fd as usize;
+ let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
+ return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
+ }
+
+ pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
+ let fd = fd as usize;
+ let size = mem::size_of_val(&(*set).fds_bits[0]) * 8;
+ (*set).fds_bits[fd / size] |= 1 << (fd % size);
+ return
+ }
+
+ pub fn FD_ZERO(set: *mut fd_set) -> () {
+ for slot in (*set).fds_bits.iter_mut() {
+ *slot = 0;
+ }
+ }
+
+ pub fn WIFEXITED(status: ::c_int) -> bool {
+ (status >> 8) == 0
+ }
+
+ pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
+ (status & 0xff)
+ }
+
+ pub fn WTERMSIG(status: ::c_int) -> ::c_int {
+ (status >> 8) & 0xff
+ }
+}
+
+extern {
+ pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int;
+ pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
+ guardsize: *mut ::size_t) -> ::c_int;
+ pub fn pthread_attr_getstack(attr: *const ::pthread_attr_t,
+ stackaddr: *mut *mut ::c_void,
+ stacksize: *mut ::size_t) -> ::c_int;
+ pub fn pthread_condattr_getclock(attr: *const pthread_condattr_t,
+ clock_id: *mut clockid_t) -> ::c_int;
+ pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
+ clock_id: clockid_t) -> ::c_int;
+ pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
+ pub fn setgroups(ngroups: ::size_t,
+ ptr: *const ::gid_t) -> ::c_int;
+ pub fn getpwuid_r(uid: ::uid_t,
+ pwd: *mut passwd,
+ buffer: *mut ::c_char,
+ bufferSize: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
+ pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
+ -> ::c_int;
+ pub fn getnameinfo(sa: *const ::sockaddr,
+ salen: ::socklen_t,
+ host: *mut ::c_char,
+ hostlen: ::size_t,
+ serv: *mut ::c_char,
+ sevlen: ::size_t,
+ flags: ::c_int) -> ::c_int;
+ pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
+ abstime: *const ::timespec) -> ::c_int;
+}
+
+cfg_if! {
+ if #[cfg(target_pointer_width = "64")] {
+ mod b64;
+ pub use self::b64::*;
+ } else {
+ mod b32;
+ pub use self::b32::*;
+ }
+}
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index 648a7aa..3e03eea 100644
--- a/src/unix/mod.rs
+++ b/src/unix/mod.rs
@@ -224,6 +224,14 @@
#[link(name = "c")]
#[link(name = "m")]
extern {}
+ } else if #[cfg(target_os = "haiku")] {
+ #[link(name = "root")]
+ #[link(name = "network")]
+ extern {}
+ } else if #[cfg(target_os = "fuchsia")] {
+ #[link(name = "c")]
+ #[link(name = "mxio")]
+ extern {}
} else {
#[link(name = "c")]
#[link(name = "m")]
@@ -251,6 +259,8 @@
pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int;
+ pub fn getchar_unlocked() -> ::c_int;
+ pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
@@ -643,6 +653,10 @@
link_name = "mktime$UNIX2003")]
#[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
pub fn mktime(tm: *mut tm) -> time_t;
+ #[cfg_attr(target_os = "netbsd", link_name = "__time50")]
+ pub fn time(time: *mut time_t) -> time_t;
+ #[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
+ pub fn localtime(time: *const time_t) -> *mut tm;
#[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
pub fn mknod(pathname: *const ::c_char, mode: ::mode_t,
@@ -720,8 +734,6 @@
// TODO: get rid of this cfg(not(...))
#[cfg(not(target_os = "android"))] // " if " -- appease style checker
extern {
- pub fn getifaddrs(ifap: *mut *mut ifaddrs) -> ::c_int;
- pub fn freeifaddrs(ifa: *mut ifaddrs);
#[cfg_attr(target_os = "macos", link_name = "glob$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__glob30")]
pub fn glob(pattern: *const c_char,
@@ -825,12 +837,18 @@
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "nice$UNIX2003")]
pub fn nice(incr: ::c_int) -> ::c_int;
+
+ pub fn grantpt(fd: ::c_int) -> ::c_int;
+ pub fn posix_openpt(flags: ::c_int) -> ::c_int;
+ pub fn ptsname(fd: ::c_int) -> *mut ::c_char;
+ pub fn unlockpt(fd: ::c_int) -> ::c_int;
}
cfg_if! {
if #[cfg(any(target_os = "linux",
target_os = "android",
- target_os = "emscripten"))] {
+ target_os = "emscripten",
+ target_os = "fuchsia"))] {
mod notbsd;
pub use self::notbsd::*;
} else if #[cfg(any(target_os = "macos",
@@ -845,6 +863,9 @@
} else if #[cfg(target_os = "solaris")] {
mod solaris;
pub use self::solaris::*;
+ } else if #[cfg(target_os = "haiku")] {
+ mod haiku;
+ pub use self::haiku::*;
} else {
// Unknown target_os
}
diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs
index 43e5e5a..efc1368 100644
--- a/src/unix/notbsd/android/mod.rs
+++ b/src/unix/notbsd/android/mod.rs
@@ -580,6 +580,67 @@
pub const PENDIN: ::tcflag_t = 0x00004000;
pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const EAI_SYSTEM: ::c_int = 11;
+
+pub const NETLINK_ROUTE: ::c_int = 0;
+pub const NETLINK_UNUSED: ::c_int = 1;
+pub const NETLINK_USERSOCK: ::c_int = 2;
+pub const NETLINK_FIREWALL: ::c_int = 3;
+pub const NETLINK_SOCK_DIAG: ::c_int = 4;
+pub const NETLINK_NFLOG: ::c_int = 5;
+pub const NETLINK_XFRM: ::c_int = 6;
+pub const NETLINK_SELINUX: ::c_int = 7;
+pub const NETLINK_ISCSI: ::c_int = 8;
+pub const NETLINK_AUDIT: ::c_int = 9;
+pub const NETLINK_FIB_LOOKUP: ::c_int = 10;
+pub const NETLINK_CONNECTOR: ::c_int = 11;
+pub const NETLINK_NETFILTER: ::c_int = 12;
+pub const NETLINK_IP6_FW: ::c_int = 13;
+pub const NETLINK_DNRTMSG: ::c_int = 14;
+pub const NETLINK_KOBJECT_UEVENT: ::c_int = 15;
+pub const NETLINK_GENERIC: ::c_int = 16;
+pub const NETLINK_SCSITRANSPORT: ::c_int = 18;
+pub const NETLINK_ECRYPTFS: ::c_int = 19;
+pub const NETLINK_RDMA: ::c_int = 20;
+pub const NETLINK_CRYPTO: ::c_int = 21;
+pub const NETLINK_INET_DIAG: ::c_int = NETLINK_SOCK_DIAG;
+
+pub const MAX_LINKS: ::c_int = 32;
+
+pub const NLM_F_REQUEST: ::c_int = 1;
+pub const NLM_F_MULTI: ::c_int = 2;
+pub const NLM_F_ACK: ::c_int = 4;
+pub const NLM_F_ECHO: ::c_int = 8;
+pub const NLM_F_DUMP_INTR: ::c_int = 16;
+
+pub const NLM_F_ROOT: ::c_int = 0x100;
+pub const NLM_F_MATCH: ::c_int = 0x200;
+pub const NLM_F_ATOMIC: ::c_int = 0x400;
+pub const NLM_F_DUMP: ::c_int = NLM_F_ROOT | NLM_F_MATCH;
+
+pub const NLM_F_REPLACE: ::c_int = 0x100;
+pub const NLM_F_EXCL: ::c_int = 0x200;
+pub const NLM_F_CREATE: ::c_int = 0x400;
+pub const NLM_F_APPEND: ::c_int = 0x800;
+
+pub const NLMSG_NOOP: ::c_int = 0x1;
+pub const NLMSG_ERROR: ::c_int = 0x2;
+pub const NLMSG_DONE: ::c_int = 0x3;
+pub const NLMSG_OVERRUN: ::c_int = 0x4;
+pub const NLMSG_MIN_TYPE: ::c_int = 0x10;
+
+pub const NETLINK_ADD_MEMBERSHIP: ::c_int = 1;
+pub const NETLINK_DROP_MEMBERSHIP: ::c_int = 2;
+pub const NETLINK_PKTINFO: ::c_int = 3;
+pub const NETLINK_BROADCAST_ERROR: ::c_int = 4;
+pub const NETLINK_NO_ENOBUFS: ::c_int = 5;
+pub const NETLINK_RX_RING: ::c_int = 6;
+pub const NETLINK_TX_RING: ::c_int = 7;
+
+pub const NLA_F_NESTED: ::c_int = 1 << 15;
+pub const NLA_F_NET_BYTEORDER: ::c_int = 1 << 14;
+pub const NLA_TYPE_MASK: ::c_int = !(NLA_F_NESTED | NLA_F_NET_BYTEORDER);
+
f! {
pub fn sigemptyset(set: *mut sigset_t) -> ::c_int {
*set = 0;
diff --git a/src/unix/notbsd/linux/mips.rs b/src/unix/notbsd/linux/mips.rs
index 1f6b2aa..085f2b3 100644
--- a/src/unix/notbsd/linux/mips.rs
+++ b/src/unix/notbsd/linux/mips.rs
@@ -129,6 +129,32 @@
__unused5: ::c_ulong
}
+ pub struct msqid_ds {
+ pub msg_perm: ::ipc_perm,
+ #[cfg(target_endian = "big")]
+ __glibc_reserved1: ::c_ulong,
+ pub msg_stime: ::time_t,
+ #[cfg(target_endian = "little")]
+ __glibc_reserved1: ::c_ulong,
+ #[cfg(target_endian = "big")]
+ __glibc_reserved2: ::c_ulong,
+ pub msg_rtime: ::time_t,
+ #[cfg(target_endian = "little")]
+ __glibc_reserved2: ::c_ulong,
+ #[cfg(target_endian = "big")]
+ __glibc_reserved3: ::c_ulong,
+ pub msg_ctime: ::time_t,
+ #[cfg(target_endian = "little")]
+ __glibc_reserved3: ::c_ulong,
+ __msg_cbytes: ::c_ulong,
+ pub msg_qnum: ::msgqnum_t,
+ pub msg_qbytes: ::msglen_t,
+ pub msg_lspid: ::pid_t,
+ pub msg_lrpid: ::pid_t,
+ __glibc_reserved4: ::c_ulong,
+ __glibc_reserved5: ::c_ulong,
+ }
+
pub struct statfs {
pub f_type: ::c_long,
pub f_bsize: ::c_long,
@@ -207,12 +233,10 @@
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const _SC_2_C_VERSION: ::c_int = 96;
-pub const RUSAGE_THREAD: ::c_int = 1;
pub const O_ACCMODE: ::c_int = 3;
pub const O_DIRECT: ::c_int = 0x8000;
pub const O_DIRECTORY: ::c_int = 0x10000;
pub const O_NOFOLLOW: ::c_int = 0x20000;
-pub const RUSAGE_CHILDREN: ::c_int = -1;
pub const ST_RELATIME: ::c_ulong = 4096;
pub const NI_MAXHOST: ::socklen_t = 1025;
diff --git a/src/unix/notbsd/linux/mips64.rs b/src/unix/notbsd/linux/mips64.rs
index ed1423f..30c336e 100644
--- a/src/unix/notbsd/linux/mips64.rs
+++ b/src/unix/notbsd/linux/mips64.rs
@@ -116,6 +116,20 @@
__unused5: ::c_ulong
}
+ pub struct msqid_ds {
+ pub msg_perm: ::ipc_perm,
+ pub msg_stime: ::time_t,
+ pub msg_rtime: ::time_t,
+ pub msg_ctime: ::time_t,
+ __msg_cbytes: ::c_ulong,
+ pub msg_qnum: ::msgqnum_t,
+ pub msg_qbytes: ::msglen_t,
+ pub msg_lspid: ::pid_t,
+ pub msg_lrpid: ::pid_t,
+ __glibc_reserved4: ::c_ulong,
+ __glibc_reserved5: ::c_ulong,
+ }
+
pub struct statfs {
pub f_type: ::c_long,
pub f_bsize: ::c_long,
@@ -199,10 +213,12 @@
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const PTHREAD_STACK_MIN: ::size_t = 131072;
+pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
pub const RLIM_INFINITY: ::rlim_t = 0xffffffffffffffff;
pub const SA_ONSTACK: ::c_int = 0x08000000;
pub const SA_SIGINFO: ::c_int = 0x00000008;
pub const SIGBUS: ::c_int = 10;
+pub const SIGSYS: ::c_int = 12;
pub const SIGSTKSZ: ::size_t = 0x2000;
pub const SIG_SETMASK: ::c_int = 3;
pub const SOCK_DGRAM: ::c_int = 1;
@@ -213,6 +229,10 @@
pub const SO_RCVTIMEO: ::c_int = 4102;
pub const SO_REUSEADDR: ::c_int = 4;
pub const SO_SNDTIMEO: ::c_int = 4101;
+pub const SO_REUSEPORT: ::c_int = 0x200;
+pub const SO_SNDBUF: ::c_int = 4097;
+pub const SO_RCVBUF: ::c_int = 4098;
+pub const SO_KEEPALIVE: ::c_int = 8;
#[link(name = "util")]
extern {
diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs
index ca9420e..c011b8c 100644
--- a/src/unix/notbsd/linux/mod.rs
+++ b/src/unix/notbsd/linux/mod.rs
@@ -11,9 +11,10 @@
pub type off64_t = i64;
pub type blkcnt64_t = i64;
pub type rlim64_t = u64;
-pub type key_t = ::c_int;
pub type shmatt_t = ::c_ulong;
pub type mqd_t = ::c_int;
+pub type msgqnum_t = ::c_ulong;
+pub type msglen_t = ::c_ulong;
pub type nfds_t = ::c_ulong;
pub type nl_item = ::c_int;
@@ -117,6 +118,18 @@
pub pw_shell: *mut ::c_char,
}
+ pub struct spwd {
+ pub sp_namp: *mut ::c_char,
+ pub sp_pwdp: *mut ::c_char,
+ pub sp_lstchg: ::c_long,
+ pub sp_min: ::c_long,
+ pub sp_max: ::c_long,
+ pub sp_warn: ::c_long,
+ pub sp_inact: ::c_long,
+ pub sp_expire: ::c_long,
+ pub sp_flag: ::c_ulong,
+ }
+
pub struct statvfs {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
@@ -126,9 +139,12 @@
pub f_files: ::fsfilcnt_t,
pub f_ffree: ::fsfilcnt_t,
pub f_favail: ::fsfilcnt_t,
+ #[cfg(target_endian = "little")]
pub f_fsid: ::c_ulong,
#[cfg(target_pointer_width = "32")]
- pub __f_unused: ::c_int,
+ __f_unused: ::c_int,
+ #[cfg(target_endian = "big")]
+ pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
__f_spare: [::c_int; 6],
@@ -190,6 +206,17 @@
pub if_name: *mut ::c_char,
}
+ // System V IPC
+ pub struct msginfo {
+ pub msgpool: ::c_int,
+ pub msgmap: ::c_int,
+ pub msgmax: ::c_int,
+ pub msgmnb: ::c_int,
+ pub msgmni: ::c_int,
+ pub msgssz: ::c_int,
+ pub msgtql: ::c_int,
+ pub msgseg: ::c_ushort,
+ }
}
pub const ABDAY_1: ::nl_item = 0x20000;
@@ -221,6 +248,8 @@
pub const ABMON_11: ::nl_item = 0x20018;
pub const ABMON_12: ::nl_item = 0x20019;
+pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
+
pub const MON_1: ::nl_item = 0x2001A;
pub const MON_2: ::nl_item = 0x2001B;
pub const MON_3: ::nl_item = 0x2001C;
@@ -252,6 +281,9 @@
pub const CRNCYSTR: ::nl_item = 0x4000F;
+pub const RUSAGE_THREAD: ::c_int = 1;
+pub const RUSAGE_CHILDREN: ::c_int = -1;
+
pub const RADIXCHAR: ::nl_item = 0x10000;
pub const THOUSEP: ::nl_item = 0x10001;
@@ -430,6 +462,9 @@
pub const SCHED_BATCH: ::c_int = 3;
pub const SCHED_IDLE: ::c_int = 5;
+// System V IPC
+pub const IPC_PRIVATE: ::key_t = 0;
+
pub const IPC_CREAT: ::c_int = 0o1000;
pub const IPC_EXCL: ::c_int = 0o2000;
pub const IPC_NOWAIT: ::c_int = 0o4000;
@@ -438,6 +473,12 @@
pub const IPC_SET: ::c_int = 1;
pub const IPC_STAT: ::c_int = 2;
pub const IPC_INFO: ::c_int = 3;
+pub const MSG_STAT: ::c_int = 11;
+pub const MSG_INFO: ::c_int = 12;
+
+pub const MSG_NOERROR: ::c_int = 0o10000;
+pub const MSG_EXCEPT: ::c_int = 0o20000;
+pub const MSG_COPY: ::c_int = 0o40000;
pub const SHM_R: ::c_int = 0o400;
pub const SHM_W: ::c_int = 0o200;
@@ -465,8 +506,6 @@
pub const NCCS: usize = 32;
-pub const AF_NETLINK: ::c_int = 16;
-
pub const LOG_NFACILITIES: ::c_int = 24;
pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t;
@@ -483,6 +522,8 @@
pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2;
pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4;
+pub const EAI_SYSTEM: ::c_int = -11;
+
f! {
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
for slot in cpuset.bits.iter_mut() {
@@ -520,8 +561,15 @@
pub fn setpwent();
pub fn getpwent() -> *mut passwd;
+ pub fn setspent();
+ pub fn endspent();
+ pub fn getspent() -> *mut spwd;
+ pub fn getspnam(__name: *const ::c_char) -> *mut spwd;
+
pub fn shm_open(name: *const c_char, oflag: ::c_int,
mode: mode_t) -> ::c_int;
+
+ // System V IPC
pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
pub fn shmat(shmid: ::c_int,
shmaddr: *const ::c_void,
@@ -530,6 +578,14 @@
pub fn shmctl(shmid: ::c_int,
cmd: ::c_int,
buf: *mut ::shmid_ds) -> ::c_int;
+ pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
+ pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int;
+ pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
+ pub fn msgrcv(msqid: ::c_int, msgp: *mut ::c_void, msgsz: ::size_t,
+ msgtyp: ::c_long, msgflg: ::c_int) -> ::ssize_t;
+ pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t,
+ msgflg: ::c_int) -> ::c_int;
+
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
pub fn __errno_location() -> *mut ::c_int;
@@ -668,10 +724,13 @@
pub fn if_freenameindex(ptr: *mut if_nameindex);
pub fn sync_file_range(fd: ::c_int, offset: ::off64_t,
nbytes: ::off64_t, flags: ::c_uint) -> ::c_int;
+ pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
+ pub fn freeifaddrs(ifa: *mut ::ifaddrs);
}
cfg_if! {
if #[cfg(any(target_env = "musl",
+ target_os = "fuchsia",
target_os = "emscripten"))] {
mod musl;
pub use self::musl::*;
diff --git a/src/unix/notbsd/linux/musl/b32/arm.rs b/src/unix/notbsd/linux/musl/b32/arm.rs
index 2f27e31..998580d 100644
--- a/src/unix/notbsd/linux/musl/b32/arm.rs
+++ b/src/unix/notbsd/linux/musl/b32/arm.rs
@@ -68,6 +68,23 @@
__pad2: ::c_ulong,
}
+ pub struct msqid_ds {
+ pub msg_perm: ::ipc_perm,
+ pub msg_stime: ::time_t,
+ __unused1: ::c_int,
+ pub msg_rtime: ::time_t,
+ __unused2: ::c_int,
+ pub msg_ctime: ::time_t,
+ __unused3: ::c_int,
+ __msg_cbytes: ::c_ulong,
+ pub msg_qnum: ::msgqnum_t,
+ pub msg_qbytes: ::msglen_t,
+ pub msg_lspid: ::pid_t,
+ pub msg_lrpid: ::pid_t,
+ __pad1: ::c_ulong,
+ __pad2: ::c_ulong,
+ }
+
pub struct statfs {
pub f_type: ::c_ulong,
pub f_bsize: ::c_ulong,
@@ -315,7 +332,5 @@
pub const SYS_gettid: ::c_long = 224;
pub const SYS_perf_event_open: ::c_long = 364;
-pub const POSIX_MADV_DONTNEED: ::c_int = 0;
-pub const RUSAGE_CHILDREN: ::c_int = 1;
pub const POLLWRNORM: ::c_short = 0x100;
pub const POLLWRBAND: ::c_short = 0x200;
diff --git a/src/unix/notbsd/linux/musl/b32/asmjs.rs b/src/unix/notbsd/linux/musl/b32/asmjs.rs
index 991196c..91a96c1 100644
--- a/src/unix/notbsd/linux/musl/b32/asmjs.rs
+++ b/src/unix/notbsd/linux/musl/b32/asmjs.rs
@@ -68,6 +68,23 @@
__pad2: ::c_ulong,
}
+ pub struct msqid_ds {
+ pub msg_perm: ::ipc_perm,
+ pub msg_stime: ::time_t,
+ __unused1: ::c_int,
+ pub msg_rtime: ::time_t,
+ __unused2: ::c_int,
+ pub msg_ctime: ::time_t,
+ __unused3: ::c_int,
+ __msg_cbytes: ::c_ulong,
+ pub msg_qnum: ::msgqnum_t,
+ pub msg_qbytes: ::msglen_t,
+ pub msg_lspid: ::pid_t,
+ pub msg_lrpid: ::pid_t,
+ __pad1: ::c_ulong,
+ __pad2: ::c_ulong,
+ }
+
pub struct statfs {
pub f_type: ::c_ulong,
pub f_bsize: ::c_ulong,
@@ -314,7 +331,5 @@
pub const SYS_gettid: ::c_long = 224; // Valid for arm (32-bit) and x86 (32-bit)
-pub const POSIX_MADV_DONTNEED: ::c_int = 0;
-pub const RUSAGE_CHILDREN: ::c_int = 1;
pub const POLLWRNORM: ::c_short = 0x100;
pub const POLLWRBAND: ::c_short = 0x200;
diff --git a/src/unix/notbsd/linux/musl/b32/mips.rs b/src/unix/notbsd/linux/musl/b32/mips.rs
index 88542c4..9ebfe4a 100644
--- a/src/unix/notbsd/linux/musl/b32/mips.rs
+++ b/src/unix/notbsd/linux/musl/b32/mips.rs
@@ -67,6 +67,32 @@
__pad2: ::c_ulong,
}
+ pub struct msqid_ds {
+ pub msg_perm: ::ipc_perm,
+ #[cfg(target_endian = "big")]
+ __unused1: ::c_int,
+ pub msg_stime: ::time_t,
+ #[cfg(target_endian = "little")]
+ __unused1: ::c_int,
+ #[cfg(target_endian = "big")]
+ __unused2: ::c_int,
+ pub msg_rtime: ::time_t,
+ #[cfg(target_endian = "little")]
+ __unused2: ::c_int,
+ #[cfg(target_endian = "big")]
+ __unused3: ::c_int,
+ pub msg_ctime: ::time_t,
+ #[cfg(target_endian = "little")]
+ __unused3: ::c_int,
+ __msg_cbytes: ::c_ulong,
+ pub msg_qnum: ::msgqnum_t,
+ pub msg_qbytes: ::msglen_t,
+ pub msg_lspid: ::pid_t,
+ pub msg_lrpid: ::pid_t,
+ __pad1: ::c_ulong,
+ __pad2: ::c_ulong,
+ }
+
pub struct statfs {
pub f_type: ::c_ulong,
pub f_bsize: ::c_ulong,
@@ -314,7 +340,5 @@
pub const SYS_gettid: ::c_long = 4222; // Valid for O32
pub const SYS_perf_event_open: ::c_long = 4333; // Valid for O32
-pub const POSIX_MADV_DONTNEED: ::c_int = 4;
-pub const RUSAGE_CHILDREN: ::c_int = !0;
pub const POLLWRNORM: ::c_short = 0x4;
pub const POLLWRBAND: ::c_short = 0x100;
diff --git a/src/unix/notbsd/linux/musl/b32/x86.rs b/src/unix/notbsd/linux/musl/b32/x86.rs
index 593c37a..194b8fd 100644
--- a/src/unix/notbsd/linux/musl/b32/x86.rs
+++ b/src/unix/notbsd/linux/musl/b32/x86.rs
@@ -68,6 +68,23 @@
__pad2: ::c_ulong,
}
+ pub struct msqid_ds {
+ pub msg_perm: ::ipc_perm,
+ pub msg_stime: ::time_t,
+ __unused1: ::c_int,
+ pub msg_rtime: ::time_t,
+ __unused2: ::c_int,
+ pub msg_ctime: ::time_t,
+ __unused3: ::c_int,
+ __msg_cbytes: ::c_ulong,
+ pub msg_qnum: ::msgqnum_t,
+ pub msg_qbytes: ::msglen_t,
+ pub msg_lspid: ::pid_t,
+ pub msg_lrpid: ::pid_t,
+ __pad1: ::c_ulong,
+ __pad2: ::c_ulong,
+ }
+
pub struct statfs {
pub f_type: ::c_ulong,
pub f_bsize: ::c_ulong,
@@ -329,7 +346,5 @@
pub const SYS_gettid: ::c_long = 224;
pub const SYS_perf_event_open: ::c_long = 336;
-pub const POSIX_MADV_DONTNEED: ::c_int = 0;
-pub const RUSAGE_CHILDREN: ::c_int = 1;
pub const POLLWRNORM: ::c_short = 0x100;
pub const POLLWRBAND: ::c_short = 0x200;
diff --git a/src/unix/notbsd/linux/musl/b64/mod.rs b/src/unix/notbsd/linux/musl/b64/mod.rs
index 227bffa..fdaf52e 100644
--- a/src/unix/notbsd/linux/musl/b64/mod.rs
+++ b/src/unix/notbsd/linux/musl/b64/mod.rs
@@ -73,6 +73,20 @@
__pad2: ::c_ulong,
}
+ pub struct msqid_ds {
+ pub msg_perm: ::ipc_perm,
+ pub msg_stime: ::time_t,
+ pub msg_rtime: ::time_t,
+ pub msg_ctime: ::time_t,
+ __msg_cbytes: ::c_ulong,
+ pub msg_qnum: ::msgqnum_t,
+ pub msg_qbytes: ::msglen_t,
+ pub msg_lspid: ::pid_t,
+ pub msg_lrpid: ::pid_t,
+ __pad1: ::c_ulong,
+ __pad2: ::c_ulong,
+ }
+
pub struct statfs {
pub f_type: ::c_ulong,
pub f_bsize: ::c_ulong,
@@ -337,8 +351,6 @@
pub const FIONREAD: ::c_int = 0x541B;
pub const TIOCCONS: ::c_int = 0x541D;
-pub const POSIX_MADV_DONTNEED: ::c_int = 0;
-pub const RUSAGE_CHILDREN: ::c_int = 1;
pub const POLLWRNORM: ::c_short = 0x100;
pub const POLLWRBAND: ::c_short = 0x200;
diff --git a/src/unix/notbsd/linux/musl/mod.rs b/src/unix/notbsd/linux/musl/mod.rs
index a1672f7..69a85b8 100644
--- a/src/unix/notbsd/linux/musl/mod.rs
+++ b/src/unix/notbsd/linux/musl/mod.rs
@@ -77,6 +77,8 @@
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
+pub const POSIX_MADV_DONTNEED: ::c_int = 4;
+
pub const RLIM_INFINITY: ::rlim_t = !0;
pub const RLIMIT_RTTIME: ::c_int = 15;
pub const RLIMIT_NLIMITS: ::c_int = 16;
diff --git a/src/unix/notbsd/linux/other/b32/arm.rs b/src/unix/notbsd/linux/other/b32/arm.rs
index f3871f3..2c6fbcd 100644
--- a/src/unix/notbsd/linux/other/b32/arm.rs
+++ b/src/unix/notbsd/linux/other/b32/arm.rs
@@ -53,6 +53,23 @@
__unused4: ::c_ulong,
__unused5: ::c_ulong
}
+
+ pub struct msqid_ds {
+ pub msg_perm: ::ipc_perm,
+ pub msg_stime: ::time_t,
+ __glibc_reserved1: ::c_ulong,
+ pub msg_rtime: ::time_t,
+ __glibc_reserved2: ::c_ulong,
+ pub msg_ctime: ::time_t,
+ __glibc_reserved3: ::c_ulong,
+ __msg_cbytes: ::c_ulong,
+ pub msg_qnum: ::msgqnum_t,
+ pub msg_qbytes: ::msglen_t,
+ pub msg_lspid: ::pid_t,
+ pub msg_lrpid: ::pid_t,
+ __glibc_reserved4: ::c_ulong,
+ __glibc_reserved5: ::c_ulong,
+ }
}
pub const O_DIRECT: ::c_int = 0x10000;
diff --git a/src/unix/notbsd/linux/other/b32/powerpc.rs b/src/unix/notbsd/linux/other/b32/powerpc.rs
index ef21eda..3125e9f 100644
--- a/src/unix/notbsd/linux/other/b32/powerpc.rs
+++ b/src/unix/notbsd/linux/other/b32/powerpc.rs
@@ -53,6 +53,23 @@
__glibc_reserved5: ::c_ulong,
__glibc_reserved6: ::c_ulong,
}
+
+ pub struct msqid_ds {
+ pub msg_perm: ::ipc_perm,
+ __glibc_reserved1: ::c_uint,
+ pub msg_stime: ::time_t,
+ __glibc_reserved2: ::c_uint,
+ pub msg_rtime: ::time_t,
+ __glibc_reserved3: ::c_uint,
+ pub msg_ctime: ::time_t,
+ __msg_cbytes: ::c_ulong,
+ pub msg_qnum: ::msgqnum_t,
+ pub msg_qbytes: ::msglen_t,
+ pub msg_lspid: ::pid_t,
+ pub msg_lrpid: ::pid_t,
+ __glibc_reserved4: ::c_ulong,
+ __glibc_reserved5: ::c_ulong,
+ }
}
pub const O_DIRECT: ::c_int = 0x20000;
diff --git a/src/unix/notbsd/linux/other/b32/x86.rs b/src/unix/notbsd/linux/other/b32/x86.rs
index 6f8587a..86abd1e 100644
--- a/src/unix/notbsd/linux/other/b32/x86.rs
+++ b/src/unix/notbsd/linux/other/b32/x86.rs
@@ -87,6 +87,23 @@
__unused4: ::c_ulong,
__unused5: ::c_ulong
}
+
+ pub struct msqid_ds {
+ pub msg_perm: ::ipc_perm,
+ pub msg_stime: ::time_t,
+ __glibc_reserved1: ::c_ulong,
+ pub msg_rtime: ::time_t,
+ __glibc_reserved2: ::c_ulong,
+ pub msg_ctime: ::time_t,
+ __glibc_reserved3: ::c_ulong,
+ __msg_cbytes: ::c_ulong,
+ pub msg_qnum: ::msgqnum_t,
+ pub msg_qbytes: ::msglen_t,
+ pub msg_lspid: ::pid_t,
+ pub msg_lrpid: ::pid_t,
+ __glibc_reserved4: ::c_ulong,
+ __glibc_reserved5: ::c_ulong,
+ }
}
pub const O_DIRECT: ::c_int = 0x4000;
diff --git a/src/unix/notbsd/linux/other/b64/mod.rs b/src/unix/notbsd/linux/other/b64/mod.rs
index ccf9988..352dba8 100644
--- a/src/unix/notbsd/linux/other/b64/mod.rs
+++ b/src/unix/notbsd/linux/other/b64/mod.rs
@@ -31,6 +31,20 @@
pub mem_unit: ::c_uint,
pub _f: [::c_char; 0],
}
+
+ pub struct msqid_ds {
+ pub msg_perm: ::ipc_perm,
+ pub msg_stime: ::time_t,
+ pub msg_rtime: ::time_t,
+ pub msg_ctime: ::time_t,
+ __msg_cbytes: ::c_ulong,
+ pub msg_qnum: ::msgqnum_t,
+ pub msg_qbytes: ::msglen_t,
+ pub msg_lspid: ::pid_t,
+ pub msg_lrpid: ::pid_t,
+ __glibc_reserved4: ::c_ulong,
+ __glibc_reserved5: ::c_ulong,
+ }
}
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
diff --git a/src/unix/notbsd/linux/other/b64/x86_64.rs b/src/unix/notbsd/linux/other/b64/x86_64.rs
index f19a9ff..69295e6 100644
--- a/src/unix/notbsd/linux/other/b64/x86_64.rs
+++ b/src/unix/notbsd/linux/other/b64/x86_64.rs
@@ -149,6 +149,17 @@
pub const PTRACE_SETFPXREGS: ::c_uint = 19;
pub const PTRACE_GETREGS: ::c_uint = 12;
pub const PTRACE_SETREGS: ::c_uint = 13;
+pub const PTRACE_O_EXITKILL: ::c_uint = 1048576;
+pub const PTRACE_O_TRACECLONE: ::c_uint = 8;
+pub const PTRACE_O_TRACEEXEC: ::c_uint = 16;
+pub const PTRACE_O_TRACEEXIT: ::c_uint = 64;
+pub const PTRACE_O_TRACEFORK: ::c_uint = 2;
+pub const PTRACE_O_TRACESYSGOOD: ::c_uint = 1;
+pub const PTRACE_O_TRACEVFORK: ::c_uint = 4;
+pub const PTRACE_O_TRACEVFORKDONE: ::c_uint = 32;
+pub const PTRACE_O_TRACESECCOMP: ::c_uint = 128;
+pub const PTRACE_O_SUSPEND_SECCOMP: ::c_uint = 2097152;
+pub const PTRACE_PEEKSIGINFO_SHARED: ::c_uint = 1;
pub const SYS_gettid: ::c_long = 186;
pub const SYS_perf_event_open: ::c_long = 298;
diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs
index 39bd957..97c28ea 100644
--- a/src/unix/notbsd/linux/other/mod.rs
+++ b/src/unix/notbsd/linux/other/mod.rs
@@ -360,11 +360,9 @@
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const _SC_2_C_VERSION: ::c_int = 96;
-pub const RUSAGE_THREAD: ::c_int = 1;
pub const O_ACCMODE: ::c_int = 3;
pub const O_ASYNC: ::c_int = 0x2000;
pub const O_NDELAY: ::c_int = 0x800;
-pub const RUSAGE_CHILDREN: ::c_int = -1;
pub const ST_RELATIME: ::c_ulong = 4096;
pub const NI_MAXHOST: ::socklen_t = 1025;
@@ -485,6 +483,69 @@
pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2;
pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
+pub const NETLINK_ROUTE: ::c_int = 0;
+pub const NETLINK_UNUSED: ::c_int = 1;
+pub const NETLINK_USERSOCK: ::c_int = 2;
+pub const NETLINK_FIREWALL: ::c_int = 3;
+pub const NETLINK_SOCK_DIAG: ::c_int = 4;
+pub const NETLINK_NFLOG: ::c_int = 5;
+pub const NETLINK_XFRM: ::c_int = 6;
+pub const NETLINK_SELINUX: ::c_int = 7;
+pub const NETLINK_ISCSI: ::c_int = 8;
+pub const NETLINK_AUDIT: ::c_int = 9;
+pub const NETLINK_FIB_LOOKUP: ::c_int = 10;
+pub const NETLINK_CONNECTOR: ::c_int = 11;
+pub const NETLINK_NETFILTER: ::c_int = 12;
+pub const NETLINK_IP6_FW: ::c_int = 13;
+pub const NETLINK_DNRTMSG: ::c_int = 14;
+pub const NETLINK_KOBJECT_UEVENT: ::c_int = 15;
+pub const NETLINK_GENERIC: ::c_int = 16;
+pub const NETLINK_SCSITRANSPORT: ::c_int = 18;
+pub const NETLINK_ECRYPTFS: ::c_int = 19;
+pub const NETLINK_RDMA: ::c_int = 20;
+pub const NETLINK_CRYPTO: ::c_int = 21;
+pub const NETLINK_INET_DIAG: ::c_int = NETLINK_SOCK_DIAG;
+
+pub const MAX_LINKS: ::c_int = 32;
+
+pub const NLM_F_REQUEST: ::c_int = 1;
+pub const NLM_F_MULTI: ::c_int = 2;
+pub const NLM_F_ACK: ::c_int = 4;
+pub const NLM_F_ECHO: ::c_int = 8;
+pub const NLM_F_DUMP_INTR: ::c_int = 16;
+pub const NLM_F_DUMP_FILTERED: ::c_int = 32;
+
+pub const NLM_F_ROOT: ::c_int = 0x100;
+pub const NLM_F_MATCH: ::c_int = 0x200;
+pub const NLM_F_ATOMIC: ::c_int = 0x400;
+pub const NLM_F_DUMP: ::c_int = NLM_F_ROOT | NLM_F_MATCH;
+
+pub const NLM_F_REPLACE: ::c_int = 0x100;
+pub const NLM_F_EXCL: ::c_int = 0x200;
+pub const NLM_F_CREATE: ::c_int = 0x400;
+pub const NLM_F_APPEND: ::c_int = 0x800;
+
+pub const NLMSG_NOOP: ::c_int = 0x1;
+pub const NLMSG_ERROR: ::c_int = 0x2;
+pub const NLMSG_DONE: ::c_int = 0x3;
+pub const NLMSG_OVERRUN: ::c_int = 0x4;
+pub const NLMSG_MIN_TYPE: ::c_int = 0x10;
+
+pub const NETLINK_ADD_MEMBERSHIP: ::c_int = 1;
+pub const NETLINK_DROP_MEMBERSHIP: ::c_int = 2;
+pub const NETLINK_PKTINFO: ::c_int = 3;
+pub const NETLINK_BROADCAST_ERROR: ::c_int = 4;
+pub const NETLINK_NO_ENOBUFS: ::c_int = 5;
+pub const NETLINK_RX_RING: ::c_int = 6;
+pub const NETLINK_TX_RING: ::c_int = 7;
+pub const NETLINK_LISTEN_ALL_NSID: ::c_int = 8;
+pub const NETLINK_LIST_MEMBERSHIPS: ::c_int = 9;
+pub const NETLINK_CAP_ACK: ::c_int = 10;
+
+pub const NLA_F_NESTED: ::c_int = 1 << 15;
+pub const NLA_F_NET_BYTEORDER: ::c_int = 1 << 14;
+pub const NLA_TYPE_MASK: ::c_int = !(NLA_F_NESTED | NLA_F_NET_BYTEORDER);
+
cfg_if! {
if #[cfg(any(target_arch = "arm", target_arch = "x86",
target_arch = "x86_64"))] {
@@ -502,6 +563,7 @@
pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
pub fn setutxent();
pub fn endutxent();
+ pub fn getpt() -> ::c_int;
}
#[link(name = "util")]
diff --git a/src/unix/notbsd/linux/s390x.rs b/src/unix/notbsd/linux/s390x.rs
index d877425..be12d72 100644
--- a/src/unix/notbsd/linux/s390x.rs
+++ b/src/unix/notbsd/linux/s390x.rs
@@ -233,6 +233,20 @@
pub uc_mcontext: mcontext_t,
pub uc_sigmask: ::sigset_t,
}
+
+ pub struct msqid_ds {
+ pub msg_perm: ::ipc_perm,
+ pub msg_stime: ::time_t,
+ pub msg_rtime: ::time_t,
+ pub msg_ctime: ::time_t,
+ __msg_cbytes: ::c_ulong,
+ pub msg_qnum: ::msgqnum_t,
+ pub msg_qbytes: ::msglen_t,
+ pub msg_lspid: ::pid_t,
+ pub msg_lrpid: ::pid_t,
+ __glibc_reserved4: ::c_ulong,
+ __glibc_reserved5: ::c_ulong,
+ }
}
pub const POSIX_FADV_DONTNEED: ::c_int = 6;
@@ -464,10 +478,8 @@
pub const FOPEN_MAX: ::c_uint = 16;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const _SC_2_C_VERSION: ::c_int = 96;
-pub const RUSAGE_THREAD: ::c_int = 1;
pub const O_ASYNC: ::c_int = 0x2000;
pub const O_NDELAY: ::c_int = 0x800;
-pub const RUSAGE_CHILDREN: ::c_int = -1;
pub const ST_RELATIME: ::c_ulong = 4096;
pub const NI_MAXHOST: ::socklen_t = 1025;
diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs
index da2cd9a..d11202b 100644
--- a/src/unix/notbsd/mod.rs
+++ b/src/unix/notbsd/mod.rs
@@ -6,6 +6,7 @@
pub type tcflag_t = ::c_uint;
pub type loff_t = ::c_longlong;
pub type clockid_t = ::c_int;
+pub type key_t = ::c_int;
pub type id_t = ::c_uint;
pub enum timezone {}
@@ -52,7 +53,9 @@
pub ai_protocol: ::c_int,
pub ai_addrlen: socklen_t,
- #[cfg(any(target_os = "linux", target_os = "emscripten"))]
+ #[cfg(any(target_os = "linux",
+ target_os = "emscripten",
+ target_os = "fuchsia"))]
pub ai_addr: *mut ::sockaddr,
pub ai_canonname: *mut c_char,
@@ -434,6 +437,7 @@
pub const AF_UNIX: ::c_int = 1;
pub const AF_INET: ::c_int = 2;
pub const AF_INET6: ::c_int = 10;
+pub const AF_NETLINK: ::c_int = 16;
pub const SOCK_RAW: ::c_int = 3;
pub const IPPROTO_TCP: ::c_int = 6;
pub const IPPROTO_IP: ::c_int = 0;
@@ -467,6 +471,8 @@
pub const SO_DEBUG: ::c_int = 1;
+pub const MSG_NOSIGNAL: ::c_int = 0x4000;
+
pub const SHUT_RD: ::c_int = 0;
pub const SHUT_WR: ::c_int = 1;
pub const SHUT_RDWR: ::c_int = 2;
@@ -845,11 +851,17 @@
abstime: *const ::timespec) -> ::c_int;
pub fn accept4(fd: ::c_int, addr: *mut ::sockaddr, len: *mut ::socklen_t,
flg: ::c_int) -> ::c_int;
+ pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
+ abstime: *const ::timespec) -> ::c_int;
+ pub fn ptsname_r(fd: ::c_int,
+ buf: *mut ::c_char,
+ buflen: ::size_t) -> ::c_int;
}
cfg_if! {
if #[cfg(any(target_os = "linux",
- target_os = "emscripten"))] {
+ target_os = "emscripten",
+ target_os = "fuchsia"))] {
mod linux;
pub use self::linux::*;
} else if #[cfg(target_os = "android")] {
diff --git a/src/unix/solaris/mod.rs b/src/unix/solaris/mod.rs
index 31f67b7..63cd124 100644
--- a/src/unix/solaris/mod.rs
+++ b/src/unix/solaris/mod.rs
@@ -651,6 +651,8 @@
pub const ENOLINK: ::c_int = 67;
pub const EPROTO: ::c_int = 71;
+pub const EAI_SYSTEM: ::c_int = 11;
+
pub const F_DUPFD: ::c_int = 0;
pub const F_GETFD: ::c_int = 1;
pub const F_SETFD: ::c_int = 2;
@@ -953,6 +955,9 @@
}
extern {
+ pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
+ pub fn freeifaddrs(ifa: *mut ::ifaddrs);
+
pub fn stack_getbounds(sp: *mut ::stack_t) -> ::c_int;
pub fn mincore(addr: *const ::c_void, len: ::size_t,
vec: *mut c_char) -> ::c_int;
@@ -1037,4 +1042,6 @@
clock_id: clockid_t) -> ::c_int;
pub fn sem_timedwait(sem: *mut sem_t,
abstime: *const ::timespec) -> ::c_int;
+ pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
+ abstime: *const ::timespec) -> ::c_int;
}