aboutsummaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2017-09-16 08:42:30 -0700
committerDaniel Mueller <deso@posteo.net>2017-09-16 08:42:30 -0700
commitbcaabae7c22d27fdbb07ea6009a6f4a9c3672fa2 (patch)
treee7470179e1bfb3fff279450e402ddcaf038ae086 /libc
parentab3c2a935b1ba655de2f3fec35da2c14b69966dc (diff)
downloadnitrocli-bcaabae7c22d27fdbb07ea6009a6f4a9c3672fa2.tar.gz
nitrocli-bcaabae7c22d27fdbb07ea6009a6f4a9c3672fa2.tar.bz2
Update libc crate to 0.2.30
Import subrepo libc/:libc at 3520512a8c9cb55661910318a6fb169a75c02a59
Diffstat (limited to 'libc')
-rw-r--r--libc/.travis.yml106
-rw-r--r--libc/Cargo.lock260
-rw-r--r--libc/Cargo.toml8
-rw-r--r--libc/README.md2
-rw-r--r--libc/appveyor.yml8
-rw-r--r--libc/ci/android-install-ndk.sh9
-rw-r--r--libc/ci/docker/aarch64-linux-android/Dockerfile13
-rw-r--r--libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile6
-rw-r--r--libc/ci/docker/arm-linux-androideabi/Dockerfile13
-rw-r--r--libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile6
-rw-r--r--libc/ci/docker/asmjs-unknown-emscripten/Dockerfile20
-rw-r--r--libc/ci/docker/i686-linux-android/Dockerfile13
-rw-r--r--libc/ci/docker/i686-unknown-linux-gnu/Dockerfile2
-rw-r--r--libc/ci/docker/i686-unknown-linux-musl/Dockerfile11
-rw-r--r--libc/ci/docker/mips-unknown-linux-gnu/Dockerfile6
-rw-r--r--libc/ci/docker/mips-unknown-linux-musl/Dockerfile8
-rw-r--r--libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile6
-rw-r--r--libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile8
-rw-r--r--libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile6
-rw-r--r--libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile6
-rw-r--r--libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile12
-rw-r--r--libc/ci/docker/wasm32-unknown-emscripten/Dockerfile21
-rwxr-xr-xlibc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh11
-rw-r--r--libc/ci/docker/x86_64-linux-android/Dockerfile2
-rw-r--r--libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile6
-rw-r--r--libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs54
-rw-r--r--libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile2
-rw-r--r--libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile11
-rw-r--r--libc/ci/docker/x86_64-unknown-openbsd/Dockerfile8
-rwxr-xr-xlibc/ci/emscripten-entry.sh19
-rw-r--r--libc/ci/emscripten.sh54
-rwxr-xr-x[-rw-r--r--]libc/ci/run-docker.sh2
-rwxr-xr-xlibc/ci/run.sh123
-rw-r--r--libc/ci/runtest-android.rs41
-rw-r--r--libc/libc-test/Cargo.toml12
-rw-r--r--libc/libc-test/build-generated.rs16
-rw-r--r--libc/libc-test/build.rs136
-rw-r--r--libc/libc-test/generate-files/Cargo.toml16
-rw-r--r--libc/libc-test/run-generated-Cargo.toml19
-rw-r--r--libc/libc-test/src/main-generated.rs9
-rw-r--r--libc/libc-test/test/linux_fcntl.rs7
-rw-r--r--libc/libc-test/test/main.rs (renamed from libc/libc-test/src/main.rs)2
-rw-r--r--libc/src/dox.rs3
-rw-r--r--libc/src/lib.rs6
-rw-r--r--libc/src/macros.rs37
-rw-r--r--libc/src/redox.rs41
-rw-r--r--libc/src/unix/bsd/apple/b32.rs34
-rw-r--r--libc/src/unix/bsd/apple/b64.rs39
-rw-r--r--libc/src/unix/bsd/apple/mod.rs169
-rw-r--r--libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs94
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs2
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/mod.rs54
-rw-r--r--libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs2
-rw-r--r--libc/src/unix/bsd/freebsdlike/mod.rs196
-rw-r--r--libc/src/unix/bsd/mod.rs112
-rw-r--r--libc/src/unix/bsd/netbsdlike/mod.rs70
-rw-r--r--libc/src/unix/bsd/netbsdlike/netbsd/mod.rs165
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs198
-rw-r--r--libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs2
-rw-r--r--libc/src/unix/haiku/mod.rs151
-rw-r--r--libc/src/unix/mod.rs95
-rw-r--r--libc/src/unix/newlib/arm/mod.rs5
-rw-r--r--libc/src/unix/newlib/mod.rs658
-rw-r--r--libc/src/unix/notbsd/android/b32/arm.rs6
-rw-r--r--libc/src/unix/notbsd/android/b32/mod.rs33
-rw-r--r--libc/src/unix/notbsd/android/b32/x86.rs409
-rw-r--r--libc/src/unix/notbsd/android/b64/aarch64.rs7
-rw-r--r--libc/src/unix/notbsd/android/b64/mod.rs30
-rw-r--r--libc/src/unix/notbsd/android/b64/x86_64.rs370
-rw-r--r--libc/src/unix/notbsd/android/mod.rs291
-rw-r--r--libc/src/unix/notbsd/emscripten.rs1667
-rw-r--r--libc/src/unix/notbsd/linux/mips/mips32.rs97
-rw-r--r--libc/src/unix/notbsd/linux/mips/mips64.rs62
-rw-r--r--libc/src/unix/notbsd/linux/mips/mod.rs173
-rw-r--r--libc/src/unix/notbsd/linux/mod.rs402
-rw-r--r--libc/src/unix/notbsd/linux/musl/b32/arm.rs46
-rw-r--r--libc/src/unix/notbsd/linux/musl/b32/asmjs.rs336
-rw-r--r--libc/src/unix/notbsd/linux/musl/b32/mips.rs54
-rw-r--r--libc/src/unix/notbsd/linux/musl/b32/mod.rs6
-rw-r--r--libc/src/unix/notbsd/linux/musl/b32/x86.rs444
-rw-r--r--libc/src/unix/notbsd/linux/musl/b64/aarch64.rs4
-rw-r--r--libc/src/unix/notbsd/linux/musl/b64/mod.rs43
-rw-r--r--libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs4
-rw-r--r--libc/src/unix/notbsd/linux/musl/b64/x86_64.rs362
-rw-r--r--libc/src/unix/notbsd/linux/musl/mod.rs62
-rw-r--r--libc/src/unix/notbsd/linux/other/b32/arm.rs48
-rw-r--r--libc/src/unix/notbsd/linux/other/b32/mod.rs15
-rw-r--r--libc/src/unix/notbsd/linux/other/b32/powerpc.rs45
-rw-r--r--libc/src/unix/notbsd/linux/other/b32/x86.rs513
-rw-r--r--libc/src/unix/notbsd/linux/other/b64/aarch64.rs49
-rw-r--r--libc/src/unix/notbsd/linux/other/b64/mod.rs3
-rw-r--r--libc/src/unix/notbsd/linux/other/b64/powerpc64.rs47
-rw-r--r--libc/src/unix/notbsd/linux/other/b64/sparc64.rs21
-rw-r--r--libc/src/unix/notbsd/linux/other/b64/x86_64.rs489
-rw-r--r--libc/src/unix/notbsd/linux/other/mod.rs101
-rw-r--r--libc/src/unix/notbsd/linux/s390x.rs241
-rw-r--r--libc/src/unix/notbsd/mod.rs232
-rw-r--r--libc/src/unix/solaris/mod.rs305
-rw-r--r--libc/src/unix/uclibc/mod.rs121
-rw-r--r--libc/src/unix/uclibc/x86_64/l4re.rs46
-rw-r--r--libc/src/unix/uclibc/x86_64/mod.rs349
-rw-r--r--libc/src/windows.rs12
102 files changed, 9352 insertions, 1426 deletions
diff --git a/libc/.travis.yml b/libc/.travis.yml
index b7721b5..650ce3f 100644
--- a/libc/.travis.yml
+++ b/libc/.travis.yml
@@ -1,4 +1,5 @@
language: rust
+rust: stable
sudo: required
dist: trusty
services:
@@ -22,111 +23,72 @@ env:
matrix:
include:
# 1.0.0 compat
- - os: linux
- env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
+ - env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
rust: 1.0.0
script: cargo build
install:
# build documentation
- - os: linux
- env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
+ - env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
rust: nightly
script: sh ci/dox.sh
# stable compat
- - os: linux
- env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
- rust: stable
- - os: linux
- env: TARGET=i686-unknown-linux-gnu
- rust: stable
+ - env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
+ - env: TARGET=i686-unknown-linux-gnu
- os: osx
env: TARGET=x86_64-apple-darwin NO_ADD=1
- rust: stable
- os: osx
env: TARGET=i686-apple-darwin
- rust: stable
- - os: linux
- env: TARGET=arm-linux-androideabi
- rust: stable
- - os: linux
- env: TARGET=aarch64-linux-android
- rust: stable
- - os: linux
- env: TARGET=i686-linux-android
- rust: stable
- # as of 2017/05/03 x86_64-linux-android are not on stable
- - os: linux
- env: TARGET=x86_64-linux-android
- rust: beta
- - os: linux
- env: TARGET=x86_64-unknown-linux-musl
- rust: stable
- - os: linux
- env: TARGET=i686-unknown-linux-musl
- rust: stable
- - os: linux
- env: TARGET=arm-unknown-linux-gnueabihf
- rust: stable
- - os: linux
- env: TARGET=aarch64-unknown-linux-gnu
- rust: stable
+ - env: TARGET=arm-linux-androideabi
+ - env: TARGET=aarch64-linux-android
+ - env: TARGET=i686-linux-android
+ - env: TARGET=x86_64-linux-android
+ - env: TARGET=x86_64-unknown-linux-musl
+ - env: TARGET=i686-unknown-linux-musl
+ - env: TARGET=arm-unknown-linux-gnueabihf
+ - env: TARGET=aarch64-unknown-linux-gnu
- os: osx
osx_image: xcode8.2
env: TARGET=i386-apple-ios
- rust: stable
+ CARGO_TARGET_I386_APPLE_IOS_RUNNER=$HOME/runtest
+ RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
+ before_install:
+ rustc ./ci/ios/deploy_and_run_on_ios_simulator.rs -o $HOME/runtest
- os: osx
osx_image: xcode8.2
env: TARGET=x86_64-apple-ios
- rust: stable
- - os: linux
- env: TARGET=x86_64-rumprun-netbsd
- rust: stable
- - os: linux
- env: TARGET=powerpc-unknown-linux-gnu
- 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: beta
- - os: linux
- env: TARGET=mips-unknown-linux-gnu
- rust: beta
+ CARGO_TARGET_X86_64_APPLE_IOS_RUNNER=$HOME/runtest
+ RUSTFLAGS=-Clink-arg=-mios-simulator-version-min=7.0
+ before_install:
+ rustc ./ci/ios/deploy_and_run_on_ios_simulator.rs -o $HOME/runtest
+ - env: TARGET=x86_64-rumprun-netbsd
+ - env: TARGET=powerpc-unknown-linux-gnu
+ - env: TARGET=powerpc64-unknown-linux-gnu
+ - env: TARGET=mips-unknown-linux-musl
+ - env: TARGET=mipsel-unknown-linux-musl
+ - env: TARGET=mips64-unknown-linux-gnuabi64
+ - env: TARGET=mips-unknown-linux-gnu
+ - env: TARGET=s390x-unknown-linux-gnu
+ - env: TARGET=asmjs-unknown-emscripten
+ - env: TARGET=wasm32-unknown-emscripten
# beta
- - os: linux
- env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
+ - env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
rust: beta
- os: osx
env: TARGET=x86_64-apple-darwin NO_ADD=1
rust: beta
# nightly
- - os: linux
- env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
+ - env: TARGET=x86_64-unknown-linux-gnu NO_ADD=1
rust: nightly
- os: osx
env: TARGET=x86_64-apple-darwin NO_ADD=1
rust: nightly
# QEMU based targets that compile in an emulator
- - os: linux
- env: TARGET=x86_64-unknown-freebsd
- rust: stable
- - os: linux
- env: TARGET=x86_64-unknown-openbsd QEMU=openbsd.qcow2
- rust: stable
- script: sh ci/run-docker.sh $TARGET
- install:
+ - env: TARGET=x86_64-unknown-freebsd
cache: cargo
diff --git a/libc/Cargo.lock b/libc/Cargo.lock
index 19d2108..bfaa454 100644
--- a/libc/Cargo.lock
+++ b/libc/Cargo.lock
@@ -2,37 +2,69 @@
name = "libc-test"
version = "0.1.0"
dependencies = [
- "ctest 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.23",
+ "ctest 0.1.4 (git+https://github.com/alexcrichton/ctest?branch=long)",
+ "libc 0.2.30",
]
[[package]]
name = "bitflags"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "bitflags"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "conv"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
+]
[[package]]
name = "ctest"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
+version = "0.1.4"
+source = "git+https://github.com/alexcrichton/ctest?branch=long#b739b61093f516e8b720d572b31457f9467a4f95"
dependencies = [
- "gcc 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)",
- "syntex_syntax 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syntex_syntax 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
-name = "gcc"
-version = "0.3.46"
+name = "custom_derive"
+version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
-name = "generate-files"
-version = "0.1.0"
+name = "dtoa"
+version = "0.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "extprim"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "ctest 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
+name = "gcc"
+version = "0.3.53"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "itoa"
+version = "0.3.2"
+source = "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"
@@ -43,39 +75,172 @@ dependencies = [
[[package]]
name = "libc"
-version = "0.1.12"
+version = "0.2.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "libc"
-version = "0.2.23"
+version = "0.2.30"
[[package]]
name = "log"
-version = "0.3.7"
+version = "0.3.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "magenta"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "magenta-sys"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "num-traits"
+version = "0.1.40"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "quote"
+version = "0.3.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "rand"
+version = "0.3.16"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
+ "magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "rustc_version"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "semver"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "semver-parser"
+version = "0.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "serde"
+version = "1.0.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "serde_derive"
+version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive_internals 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
+]
[[package]]
-name = "rustc-serialize"
-version = "0.3.24"
+name = "serde_derive_internals"
+version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "serde_json"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "itoa 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "syn"
+version = "0.11.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
+ "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "synom"
+version = "0.11.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "syntex_errors"
+version = "0.59.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "syntex_pos"
+version = "0.59.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
+]
[[package]]
name = "syntex_syntax"
-version = "0.19.1"
+version = "0.59.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.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "rustc-serialize 0.3.24 (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)",
+ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "extprim 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "term"
-version = "0.2.14"
+version = "0.4.6"
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)",
@@ -84,7 +249,12 @@ dependencies = [
[[package]]
name = "unicode-xid"
-version = "0.0.3"
+version = "0.0.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "unicode-xid"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -98,15 +268,37 @@ 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.1 (registry+https://github.com/rust-lang/crates.io-index)" = "156b2ddc97c727423b94749e91562244a093e345a575fe1b6b589ab194e09a72"
-"checksum gcc 0.3.46 (registry+https://github.com/rust-lang/crates.io-index)" = "181e3cebba1d663bd92eb90e2da787e10597e027eb00de8d742b260a7850948f"
+"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
+"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
+"checksum conv 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "78ff10625fd0ac447827aa30ea8b861fead473bb60aeb73af6c1c58caf0d1299"
+"checksum ctest 0.1.4 (git+https://github.com/alexcrichton/ctest?branch=long)" = "<none>"
+"checksum custom_derive 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "ef8ae57c4978a2acd8b869ce6b9ca1dfe817bff704c220209fdef2c0b75a01b9"
+"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
+"checksum extprim 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1de79797db68eb235c616cc3ad1a2793fa94a2245594cb6f81d602e62ed951c5"
+"checksum gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)" = "e8310f7e9c890398b0e80e301c4f474e9918d2b27fca8f48486ca775fa9ffc5a"
+"checksum itoa 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f74cf6ca1bdbc28496a2b9798ab7fccc2ca5a42cace95bb2b219577216a5fb90"
"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.7 (registry+https://github.com/rust-lang/crates.io-index)" = "5141eca02775a762cc6cd564d8d2c50f67c0ea3a372cbf1c51592b3e029e10ad"
-"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
-"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 libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)" = "8a014d9226c2cc402676fbe9ea2e15dd5222cd1dd57f576b5b283178c944a264"
+"checksum log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "880f77541efa6e5cc74e76910c9884d9859683118839d6a1dc3b11e63512565b"
+"checksum magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf0336886480e671965f794bc9b6fce88503563013d1bfb7a502c81fe3ac527"
+"checksum magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40d014c7011ac470ae28e2f76a02bfea4a8480f73e701353b49ad7a8d75f4699"
+"checksum num-traits 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "99843c856d68d8b4313b03a17e33c4bb42ae8f6610ea81b28abe076ac721b9b0"
+"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
+"checksum rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "eb250fd207a4729c976794d03db689c9be1d634ab5a1c9da9492a13d8fecbcdf"
+"checksum rustc_version 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9743a7670d88d5d52950408ecdb7c71d8986251ab604d4689dd2ca25c9bca69"
+"checksum semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537"
+"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
+"checksum serde 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f7726f29ddf9731b17ff113c461e362c381d9d69433f79de4f3dd572488823e9"
+"checksum serde_derive 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cf823e706be268e73e7747b147aa31c8f633ab4ba31f115efb57e5047c3a76dd"
+"checksum serde_derive_internals 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "37aee4e0da52d801acfbc0cc219eb1eda7142112339726e427926a6f6ee65d3a"
+"checksum serde_json 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "48b04779552e92037212c3615370f6bd57a40ebba7f20e554ff9f55e41a69a7b"
+"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
+"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
+"checksum syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3133289179676c9f5c5b2845bf5a2e127769f4889fcbada43035ef6bd662605e"
+"checksum syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "30ab669fa003d208c681f874bbc76d91cc3d32550d16b5d9d2087cf477316470"
+"checksum syntex_syntax 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03815b9f04d95828770d9c974aa39c6e1f6ef3114eb77a3ce09008a0d15dd142"
+"checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1"
+"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
+"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
"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/libc/Cargo.toml b/libc/Cargo.toml
index 3914fd6..8bffe2d 100644
--- a/libc/Cargo.toml
+++ b/libc/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "libc"
-version = "0.2.23"
+version = "0.2.30"
authors = ["The Rust Project Developers"]
license = "MIT/Apache-2.0"
readme = "README.md"
@@ -13,9 +13,13 @@ A library for types and bindings to native C functions often found in libc or
other common platform libraries.
"""
+[badges]
+travis-ci = { repository = "rust-lang/libc" }
+appveyor = { repository = "rust-lang-libs/libc" }
+
[features]
default = ["use_std"]
use_std = []
[workspace]
-members = ["libc-test", "libc-test/generate-files"]
+members = ["libc-test"]
diff --git a/libc/README.md b/libc/README.md
index 67535d2..7b2d778 100644
--- a/libc/README.md
+++ b/libc/README.md
@@ -93,7 +93,7 @@ With that in mind, the steps for adding a new API are:
We have two automated tests running on [Travis](https://travis-ci.org/rust-lang/libc):
1. [`libc-test`](https://github.com/alexcrichton/ctest)
- - `cd libc-test && cargo run`
+ - `cd libc-test && cargo test`
- Use the `skip_*()` functions in `build.rs` if you really need a workaround.
2. Style checker
- `rustc ci/style.rs && ./style src`
diff --git a/libc/appveyor.yml b/libc/appveyor.yml
index b6c666c..3121825 100644
--- a/libc/appveyor.yml
+++ b/libc/appveyor.yml
@@ -1,4 +1,10 @@
environment:
+ # When this was added there were revocation check failures when using the
+ # libcurl backend as libcurl checks by default, but rustup doesn't provide the
+ # switch to turn this off. Switch to Hyper which looks to not check for
+ # revocation by default like libcurl does.
+ RUSTUP_USE_HYPER: 1
+ CARGO_HTTP_CHECK_REVOKE: false
matrix:
- TARGET: x86_64-pc-windows-gnu
MSYS2_BITS: 64
@@ -18,7 +24,7 @@ build: false
test_script:
- cargo test --target %TARGET%
- - cargo run --manifest-path libc-test/Cargo.toml --target %TARGET%
+ - cargo test --manifest-path libc-test/Cargo.toml --target %TARGET%
cache:
- target
diff --git a/libc/ci/android-install-ndk.sh b/libc/ci/android-install-ndk.sh
index 75bcd20..873f6c5 100644
--- a/libc/ci/android-install-ndk.sh
+++ b/libc/ci/android-install-ndk.sh
@@ -11,8 +11,8 @@
set -ex
-curl -O https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip
-unzip -q android-ndk-r13b-linux-x86_64.zip
+curl -O https://dl.google.com/android/repository/android-ndk-r15b-linux-x86_64.zip
+unzip -q android-ndk-r15b-linux-x86_64.zip
case "$1" in
aarch64)
@@ -28,9 +28,10 @@ case "$1" in
;;
esac;
-android-ndk-r13b/build/tools/make_standalone_toolchain.py \
+android-ndk-r15b/build/tools/make_standalone_toolchain.py \
+ --unified-headers \
--install-dir /android/ndk-$1 \
--arch $arch \
--api 24
-rm -rf ./android-ndk-r13b-linux-x86_64.zip ./android-ndk-r13b
+rm -rf ./android-ndk-r15b-linux-x86_64.zip ./android-ndk-r15b
diff --git a/libc/ci/docker/aarch64-linux-android/Dockerfile b/libc/ci/docker/aarch64-linux-android/Dockerfile
index 7ad8492..345540a 100644
--- a/libc/ci/docker/aarch64-linux-android/Dockerfile
+++ b/libc/ci/docker/aarch64-linux-android/Dockerfile
@@ -29,4 +29,17 @@ RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \
+ CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=/tmp/runtest \
HOME=/tmp
+
+ADD runtest-android.rs /tmp/runtest.rs
+ENTRYPOINT [ \
+ "bash", \
+ "-c", \
+ # set SHELL so android can detect a 64bits system, see
+ # http://stackoverflow.com/a/41789144
+ "SHELL=/bin/dash emulator @aarch64 -no-window & \
+ rustc /tmp/runtest.rs -o /tmp/runtest && \
+ exec \"$@\"", \
+ "--" \
+]
diff --git a/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile b/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile
index 2ba69e1..18214a3 100644
--- a/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile
+++ b/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile
@@ -1,7 +1,7 @@
-FROM ubuntu:16.10
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
+FROM ubuntu:17.10
+RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates \
gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
+ CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -L /usr/aarch64-linux-gnu" \
PATH=$PATH:/rust/bin
diff --git a/libc/ci/docker/arm-linux-androideabi/Dockerfile b/libc/ci/docker/arm-linux-androideabi/Dockerfile
index 0549414..554f078 100644
--- a/libc/ci/docker/arm-linux-androideabi/Dockerfile
+++ b/libc/ci/docker/arm-linux-androideabi/Dockerfile
@@ -29,4 +29,17 @@ RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
+ CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \
HOME=/tmp
+
+ADD runtest-android.rs /tmp/runtest.rs
+ENTRYPOINT [ \
+ "bash", \
+ "-c", \
+ # set SHELL so android can detect a 64bits system, see
+ # http://stackoverflow.com/a/41789144
+ "SHELL=/bin/dash emulator @arm -no-window & \
+ rustc /tmp/runtest.rs -o /tmp/runtest && \
+ exec \"$@\"", \
+ "--" \
+]
diff --git a/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile b/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
index 3824c04..9fe71dc 100644
--- a/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
+++ b/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile
@@ -1,7 +1,7 @@
-FROM ubuntu:16.10
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
+FROM ubuntu:17.10
+RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates \
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user
ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \
+ CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER="qemu-arm -L /usr/arm-linux-gnueabihf" \
PATH=$PATH:/rust/bin
diff --git a/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile b/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile
new file mode 100644
index 0000000..3088fc5
--- /dev/null
+++ b/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile
@@ -0,0 +1,20 @@
+FROM ubuntu:16.04
+
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends \
+ ca-certificates \
+ curl \
+ gcc \
+ git \
+ libc6-dev \
+ python \
+ xz-utils
+
+COPY emscripten.sh /
+RUN bash /emscripten.sh
+
+ENV PATH=$PATH:/rust/bin \
+ CARGO_TARGET_ASMJS_UNKNOWN_EMSCRIPTEN_RUNNER=node
+
+COPY emscripten-entry.sh /
+ENTRYPOINT ["/emscripten-entry.sh"]
diff --git a/libc/ci/docker/i686-linux-android/Dockerfile b/libc/ci/docker/i686-linux-android/Dockerfile
index bee9043..7671f78 100644
--- a/libc/ci/docker/i686-linux-android/Dockerfile
+++ b/libc/ci/docker/i686-linux-android/Dockerfile
@@ -29,4 +29,17 @@ RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \
+ CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=/tmp/runtest \
HOME=/tmp
+
+ADD runtest-android.rs /tmp/runtest.rs
+ENTRYPOINT [ \
+ "bash", \
+ "-c", \
+ # set SHELL so android can detect a 64bits system, see
+ # http://stackoverflow.com/a/41789144
+ "SHELL=/bin/dash emulator @i686 -no-window -no-accel & \
+ rustc /tmp/runtest.rs -o /tmp/runtest && \
+ exec \"$@\"", \
+ "--" \
+]
diff --git a/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile b/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile
index c149d84..a5a4b8e 100644
--- a/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile
+++ b/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc-multilib libc6-dev ca-certificates
diff --git a/libc/ci/docker/i686-unknown-linux-musl/Dockerfile b/libc/ci/docker/i686-unknown-linux-musl/Dockerfile
index bdc2272..3adb920 100644
--- a/libc/ci/docker/i686-unknown-linux-musl/Dockerfile
+++ b/libc/ci/docker/i686-unknown-linux-musl/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
RUN dpkg --add-architecture i386
RUN apt-get update
@@ -18,6 +18,13 @@ RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \
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.15 && \
+# 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 | \
+ tar xzf - && \
+ cd kernel-headers-3.12.6-5 && \
+ make ARCH=i386 prefix=/musl-i686 install -j4 && \
+ cd .. && \
+ rm -rf kernel-headers-3.12.6-5
ENV PATH=$PATH:/musl-i686/bin:/rust/bin \
CC_i686_unknown_linux_musl=musl-gcc
diff --git a/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile b/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile
index eea1f65..c66abd4 100644
--- a/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile
+++ b/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile
@@ -1,10 +1,10 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates \
gcc-mips-linux-gnu libc6-dev-mips-cross \
qemu-system-mips
ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \
+ CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_RUNNER="qemu-mips -L /usr/mips-linux-gnu" \
PATH=$PATH:/rust/bin
diff --git a/libc/ci/docker/mips-unknown-linux-musl/Dockerfile b/libc/ci/docker/mips-unknown-linux-musl/Dockerfile
index cbc41c2..3fb0eeb 100644
--- a/libc/ci/docker/mips-unknown-linux-musl/Dockerfile
+++ b/libc/ci/docker/mips-unknown-linux-musl/Dockerfile
@@ -1,7 +1,6 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \
bzip2
@@ -14,4 +13,5 @@ RUN curl -L https://s3.amazonaws.com/rust-lang-ci/libc/OpenWrt-SDK-ar71xx-generi
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
+ CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-gcc \
+ CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15"
diff --git a/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile b/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile
index 2eb5de2..b9921fc 100644
--- a/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile
+++ b/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile
@@ -1,11 +1,11 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get update && 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 \
+ CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_RUNNER="qemu-mips64 -L /usr/mips64-linux-gnuabi64" \
CC_mips64_unknown_linux_gnuabi64=mips64-linux-gnuabi64-gcc \
PATH=$PATH:/rust/bin
diff --git a/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile b/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile
index 4c7ee8b..a2c3bc4 100644
--- a/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile
+++ b/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile
@@ -1,7 +1,6 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \
bzip2
@@ -14,4 +13,5 @@ RUN curl -L https://s3.amazonaws.com/rust-lang-ci/libc/OpenWrt-Toolchain-malta-l
ENV PATH=$PATH:/rust/bin:/toolchain/bin \
CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
- CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-gcc
+ CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-gcc \
+ CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mipsel -L /toolchain"
diff --git a/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile b/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile
index d9d7db0..106ada4 100644
--- a/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile
+++ b/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile
@@ -1,10 +1,10 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates \
gcc-powerpc-linux-gnu libc6-dev-powerpc-cross \
qemu-system-ppc
ENV CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-linux-gnu-gcc \
+ CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc -L /usr/powerpc-linux-gnu" \
PATH=$PATH:/rust/bin
diff --git a/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile b/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
index df0e605..a6ab66a 100644
--- a/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
+++ b/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile
@@ -1,11 +1,11 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
+RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates \
gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross \
qemu-system-ppc
ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \
+ CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64 -L /usr/powerpc64-linux-gnu" \
CC=powerpc64-linux-gnu-gcc \
PATH=$PATH:/rust/bin
diff --git a/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile b/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile
new file mode 100644
index 0000000..49a277d
--- /dev/null
+++ b/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile
@@ -0,0 +1,12 @@
+FROM ubuntu:17.10
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ gcc libc6-dev qemu-user ca-certificates \
+ gcc-s390x-linux-gnu libc6-dev-s390x-cross
+
+ENV CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc \
+ # TODO: in theory we should execute this, but qemu segfaults immediately :(
+ # CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER="qemu-s390x -L /usr/s390x-linux-gnu" \
+ CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER=true \
+ CC_s390x_unknown_linux_gnu=s390x-linux-gnu-gcc \
+ PATH=$PATH:/rust/bin
diff --git a/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile b/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile
new file mode 100644
index 0000000..59bf7d9
--- /dev/null
+++ b/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile
@@ -0,0 +1,21 @@
+FROM ubuntu:16.04
+
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends \
+ ca-certificates \
+ curl \
+ gcc \
+ git \
+ libc6-dev \
+ python \
+ xz-utils
+
+COPY emscripten.sh /
+RUN bash /emscripten.sh
+
+ENV PATH=$PATH:/rust/bin \
+ CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node-wrapper.sh
+
+COPY emscripten-entry.sh /
+COPY docker/wasm32-unknown-emscripten/node-wrapper.sh /usr/local/bin/node-wrapper.sh
+ENTRYPOINT ["/emscripten-entry.sh"]
diff --git a/libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh b/libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh
new file mode 100755
index 0000000..b1936f0
--- /dev/null
+++ b/libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+me=$1
+shift
+dir=$(dirname $me)
+file=$(basename $me)
+
+cd $dir
+exec node $file "$@"
diff --git a/libc/ci/docker/x86_64-linux-android/Dockerfile b/libc/ci/docker/x86_64-linux-android/Dockerfile
index dfc0c83..0cfbc48 100644
--- a/libc/ci/docker/x86_64-linux-android/Dockerfile
+++ b/libc/ci/docker/x86_64-linux-android/Dockerfile
@@ -17,7 +17,7 @@ RUN sh /android/android-install-ndk.sh $ANDROID_ARCH
# We do not run x86_64-linux-android tests on an android emulator.
# See ci/android-sysimage.sh for informations about how tests are run.
COPY android-sysimage.sh /android/
-RUN bash /android/android-sysimage.sh x86_64 x86_64-21_r04.zip
+RUN bash /android/android-sysimage.sh x86_64 x86_64-24_r07.zip
ENV PATH=$PATH:/rust/bin:/android/ndk-$ANDROID_ARCH/bin \
CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android-gcc \
diff --git a/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile b/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile
index 129771e..a486d05 100644
--- a/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile
+++ b/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile
@@ -3,4 +3,8 @@ USER root
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
qemu
-ENV PATH=$PATH:/rust/bin
+ENV PATH=$PATH:/rust/bin \
+ CARGO_TARGET_X86_64_RUMPRUN_NETBSD_RUNNER=/tmp/runtest
+
+ADD docker/x86_64-rumprun-netbsd/runtest.rs /tmp/
+ENTRYPOINT ["sh", "-c", "rustc /tmp/runtest.rs -o /tmp/runtest && exec \"$@\"", "--"]
diff --git a/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs b/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs
new file mode 100644
index 0000000..94b5946
--- /dev/null
+++ b/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs
@@ -0,0 +1,54 @@
+use std::env;
+use std::process::{Command, Stdio};
+use std::sync::mpsc;
+use std::thread;
+use std::time::Duration;
+use std::io::{BufRead, BufReader, Read};
+
+fn main() {
+ assert_eq!(env::args().len(), 2);
+
+ let status = Command::new("rumprun-bake")
+ .arg("hw_virtio")
+ .arg("/tmp/libc-test.img")
+ .arg(env::args().nth(1).unwrap())
+ .status()
+ .expect("failed to run rumprun-bake");
+ assert!(status.success());
+
+ let mut child = Command::new("qemu-system-x86_64")
+ .arg("-nographic")
+ .arg("-vga").arg("none")
+ .arg("-m").arg("64")
+ .arg("-kernel").arg("/tmp/libc-test.img")
+ .stdout(Stdio::piped())
+ .stderr(Stdio::piped())
+ .spawn()
+ .expect("failed to spawn qemu");
+
+ let mut stdout = child.stdout.take().unwrap();
+ let mut stderr = child.stderr.take().unwrap();
+ let (tx, rx) = mpsc::channel();
+ let tx2 = tx.clone();
+ let t1 = thread::spawn(move || find_ok(&mut stdout, tx));
+ let t2 = thread::spawn(move || find_ok(&mut stderr, tx2));
+
+ let res = rx.recv_timeout(Duration::new(5, 0));
+ child.kill().unwrap();
+ t1.join().unwrap();
+ t2.join().unwrap();
+
+ if res.is_err() {
+ panic!("didn't find success");
+ }
+}
+
+fn find_ok(input: &mut Read, tx: mpsc::Sender<()>) {
+ for line in BufReader::new(input).lines() {
+ let line = line.unwrap();
+ println!("{}", line);
+ if line.starts_with("PASSED ") && line.contains(" tests") {
+ tx.send(()).unwrap();
+ }
+ }
+}
diff --git a/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile b/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile
index 4af3f83..ca60ede 100644
--- a/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile
+++ b/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
gcc libc6-dev ca-certificates
diff --git a/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile b/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile
index 9c24999..d9d6511 100644
--- a/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile
+++ b/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:16.10
+FROM ubuntu:17.10
RUN apt-get update
RUN apt-get install -y --no-install-recommends \
@@ -9,5 +9,12 @@ RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \
./configure --prefix=/musl-x86_64 && \
make install -j4 && \
cd .. && \
- rm -rf musl-1.1.15
+ rm -rf musl-1.1.15 && \
+# 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 | \
+ tar xzf - && \
+ cd kernel-headers-3.12.6-5 && \
+ make ARCH=x86_64 prefix=/musl-x86_64 install -j4 && \
+ cd .. && \
+ rm -rf kernel-headers-3.12.6-5
ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin
diff --git a/libc/ci/docker/x86_64-unknown-openbsd/Dockerfile b/libc/ci/docker/x86_64-unknown-openbsd/Dockerfile
deleted file mode 100644
index 518baf8..0000000
--- a/libc/ci/docker/x86_64-unknown-openbsd/Dockerfile
+++ /dev/null
@@ -1,8 +0,0 @@
-FROM ubuntu:16.10
-
-RUN apt-get update
-RUN apt-get install -y --no-install-recommends \
- gcc libc6-dev qemu curl ca-certificates \
- genext2fs
-ENV PATH=$PATH:/rust/bin \
- QEMU=2016-11-06/openbsd-6.0-without-pkgs.qcow2
diff --git a/libc/ci/emscripten-entry.sh b/libc/ci/emscripten-entry.sh
new file mode 100755
index 0000000..acaebfe
--- /dev/null
+++ b/libc/ci/emscripten-entry.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+# file at the top-level directory of this distribution and at
+# http://rust-lang.org/COPYRIGHT.
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+# option. This file may not be copied, modified, or distributed
+# except according to those terms.
+
+set -ex
+
+source /emsdk-portable/emsdk_env.sh &> /dev/null
+
+# emsdk-portable provides a node binary, but we need version 8 to run wasm
+export PATH="/node-v8.0.0-linux-x64/bin:$PATH"
+
+exec "$@"
diff --git a/libc/ci/emscripten.sh b/libc/ci/emscripten.sh
new file mode 100644
index 0000000..d802585
--- /dev/null
+++ b/libc/ci/emscripten.sh
@@ -0,0 +1,54 @@
+# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+# file at the top-level directory of this distribution and at
+# http://rust-lang.org/COPYRIGHT.
+#
+# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+# option. This file may not be copied, modified, or distributed
+# except according to those terms.
+
+set -ex
+
+hide_output() {
+ set +x
+ on_err="
+echo ERROR: An error was encountered with the build.
+cat /tmp/build.log
+exit 1
+"
+ trap "$on_err" ERR
+ bash -c "while true; do sleep 30; echo \$(date) - building ...; done" &
+ PING_LOOP_PID=$!
+ $@ &> /tmp/build.log
+ trap - ERR
+ kill $PING_LOOP_PID
+ rm -f /tmp/build.log
+ set -x
+}
+
+cd /
+curl -L https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \
+ tar -xz
+
+cd /emsdk-portable
+./emsdk update
+hide_output ./emsdk install sdk-1.37.20-64bit
+./emsdk activate sdk-1.37.20-64bit
+
+# Compile and cache libc
+source ./emsdk_env.sh
+echo "main(){}" > a.c
+HOME=/emsdk-portable/ emcc a.c
+HOME=/emsdk-portable/ emcc -s BINARYEN=1 a.c
+rm -f a.*
+
+# Make emsdk usable by any user
+cp /root/.emscripten /emsdk-portable
+chmod a+rxw -R /emsdk-portable
+
+# node 8 is required to run wasm
+cd /
+curl -L https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz | \
+ tar -xJ
+
diff --git a/libc/ci/run-docker.sh b/libc/ci/run-docker.sh
index e963078..662a1d4 100644..100755
--- a/libc/ci/run-docker.sh
+++ b/libc/ci/run-docker.sh
@@ -14,6 +14,7 @@ run() {
docker run \
--user `id -u`:`id -g` \
--rm \
+ --init \
--volume $HOME/.cargo:/cargo \
$kvm \
--env CARGO_HOME=/cargo \
@@ -22,7 +23,6 @@ run() {
--volume `pwd`/target:/checkout/target \
--env CARGO_TARGET_DIR=/checkout/target \
--workdir /checkout \
- --privileged \
libc \
ci/run.sh $1
}
diff --git a/libc/ci/run.sh b/libc/ci/run.sh
index 3ddc7b3..ddf18fd 100755
--- a/libc/ci/run.sh
+++ b/libc/ci/run.sh
@@ -39,36 +39,11 @@ if [ "$QEMU" != "" ]; then
rm -f $tmpdir/libc-test.img
mkdir $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
- # binary.
- #
- # If we don't have a cross-compiler, however, then we need to do some crazy
- # acrobatics to get this to work. Generate all.{c,rs} on the host which will
- # be compiled inside QEMU. Do this here because compiling syntex_syntax in
- # QEMU would time out basically everywhere.
- if [ "$CAN_CROSS" = "1" ]; then
- cargo build --manifest-path libc-test/Cargo.toml --target $TARGET
- cp $CARGO_TARGET_DIR/$TARGET/debug/libc-test $tmpdir/mount/
- echo 'exec $1/libc-test' > $tmpdir/mount/run.sh
- else
- rm -rf $tmpdir/generated
- mkdir -p $tmpdir/generated
- cargo build --manifest-path libc-test/generate-files/Cargo.toml
- (cd libc-test && TARGET=$TARGET OUT_DIR=$tmpdir/generated SKIP_COMPILE=1 \
- $CARGO_TARGET_DIR/debug/generate-files)
-
- # Copy this folder into the mounted image, the `run.sh` entry point, and
- # overwrite the standard libc-test Cargo.toml with the overlay one which will
- # assume the all.{c,rs} test files have already been generated
- mkdir $tmpdir/mount/libc
- cp -r Cargo.* libc-test src ci $tmpdir/mount/libc/
- ln -s libc-test/target $tmpdir/mount/libc/target
- cp ci/run-qemu.sh $tmpdir/mount/run.sh
- echo $TARGET | tee -a $tmpdir/mount/TARGET
- cp $tmpdir/generated/* $tmpdir/mount/libc/libc-test
- cp libc-test/run-generated-Cargo.toml $tmpdir/mount/libc/libc-test/Cargo.toml
- fi
+ # Do the standard rigamarole of cross-compiling an executable and then the
+ # script to run just executes the binary.
+ cargo build --manifest-path libc-test/Cargo.toml --target $TARGET
+ cp $CARGO_TARGET_DIR/$TARGET/debug/libc-test $tmpdir/mount/
+ echo 'exec $1/libc-test' > $tmpdir/mount/run.sh
du -sh $tmpdir/mount
genext2fs \
@@ -93,90 +68,4 @@ if [ "$QEMU" != "" ]; then
exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log
fi
-case "$TARGET" in
- *-apple-ios)
- cargo rustc --manifest-path libc-test/Cargo.toml --target $TARGET -- \
- -C link-args=-mios-simulator-version-min=7.0
- ;;
-
- *)
- cargo build --manifest-path libc-test/Cargo.toml --target $TARGET
- ;;
-esac
-
-case "$TARGET" in
- # Android emulator for x86_64 does not work on travis (missing hardware
- # acceleration). Tests are run on case *). See ci/android-sysimage.sh for
- # informations about how tests are run.
- arm-linux-androideabi | aarch64-linux-android | i686-linux-android)
- # set SHELL so android can detect a 64bits system, see
- # http://stackoverflow.com/a/41789144
- # https://issues.jenkins-ci.org/browse/JENKINS-26930?focusedCommentId=230791&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-230791
- export SHELL=/bin/dash
- arch=$(echo $TARGET | cut -d- -f1)
- accel="-no-accel"
- if emulator -accel-check; then
- accel=""
- fi
- emulator @$arch -no-window $accel &
- adb wait-for-device
- adb push $CARGO_TARGET_DIR/$TARGET/debug/libc-test /data/local/tmp/libc-test
- adb shell /data/local/tmp/libc-test 2>&1 | tee /tmp/out
- grep "^PASSED .* tests" /tmp/out
- ;;
-
- i386-apple-ios)
- rustc -O ./ci/ios/deploy_and_run_on_ios_simulator.rs
- ./deploy_and_run_on_ios_simulator $CARGO_TARGET_DIR/$TARGET/debug/libc-test
- ;;
-
- x86_64-apple-ios)
- rustc -O ./ci/ios/deploy_and_run_on_ios_simulator.rs
- ./deploy_and_run_on_ios_simulator $CARGO_TARGET_DIR/$TARGET/debug/libc-test
- ;;
-
- arm-unknown-linux-gnueabihf)
- qemu-arm -L /usr/arm-linux-gnueabihf $CARGO_TARGET_DIR/$TARGET/debug/libc-test
- ;;
-
- mips-unknown-linux-gnu)
- qemu-mips -L /usr/mips-linux-gnu $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
- ;;
-
- powerpc64-unknown-linux-gnu)
- qemu-ppc64 -L /usr/powerpc64-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/libc-test
- ;;
-
- aarch64-unknown-linux-gnu)
- qemu-aarch64 -L /usr/aarch64-linux-gnu/ $CARGO_TARGET_DIR/$TARGET/debug/libc-test
- ;;
-
- *-rumprun-netbsd)
- rumprun-bake hw_virtio /tmp/libc-test.img $CARGO_TARGET_DIR/$TARGET/debug/libc-test
- qemu-system-x86_64 -nographic -vga none -m 64 \
- -kernel /tmp/libc-test.img 2>&1 | tee /tmp/out &
- sleep 5
- grep "^PASSED .* tests" /tmp/out
- ;;
-
- *)
- $CARGO_TARGET_DIR/$TARGET/debug/libc-test
- ;;
-esac
+exec cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
diff --git a/libc/ci/runtest-android.rs b/libc/ci/runtest-android.rs
new file mode 100644
index 0000000..a8f8db8
--- /dev/null
+++ b/libc/ci/runtest-android.rs
@@ -0,0 +1,41 @@
+use std::env;
+use std::process::Command;
+use std::path::{Path, PathBuf};
+
+fn main() {
+ assert_eq!(env::args_os().len(), 2);
+ let test = PathBuf::from(env::args_os().nth(1).unwrap());
+ let dst = Path::new("/data/local/tmp").join(test.file_name().unwrap());
+
+ let status = Command::new("adb")
+ .arg("wait-for-device")
+ .status()
+ .expect("failed to run rumprun-bake");
+ assert!(status.success());
+
+ let status = Command::new("adb")
+ .arg("push")
+ .arg(&test)
+ .arg(&dst)
+ .status()
+ .expect("failed to run rumprun-bake");
+ assert!(status.success());
+
+ let output = Command::new("adb")
+ .arg("shell")
+ .arg(&dst)
+ .output()
+ .expect("failed to run rumprun-bake");
+ assert!(status.success());
+
+ println!("status: {}\nstdout ---\n{}\nstderr ---\n{}",
+ output.status,
+ String::from_utf8_lossy(&output.stdout),
+ String::from_utf8_lossy(&output.stderr));
+
+ let stdout = String::from_utf8_lossy(&output.stdout);
+ let mut lines = stdout.lines().filter(|l| l.starts_with("PASSED "));
+ if !lines.any(|l| l.contains(" tests")) {
+ panic!("failed to find successful test run");
+ }
+}
diff --git a/libc/libc-test/Cargo.toml b/libc/libc-test/Cargo.toml
index 4e7c884..dbdb632 100644
--- a/libc/libc-test/Cargo.toml
+++ b/libc/libc-test/Cargo.toml
@@ -8,4 +8,14 @@ build = "build.rs"
libc = { path = ".." }
[build-dependencies]
-ctest = "0.1"
+ctest = { git = 'https://github.com/alexcrichton/ctest', branch = 'long' }
+
+[[test]]
+name = "main"
+path = "test/main.rs"
+harness = false
+
+[[test]]
+name = "linux-fcntl"
+path = "test/linux_fcntl.rs"
+harness = false
diff --git a/libc/libc-test/build-generated.rs b/libc/libc-test/build-generated.rs
deleted file mode 100644
index a51c0e3..0000000
--- a/libc/libc-test/build-generated.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// This build script is distinct from the standard build.rs as it is only used
-// for the BSDs which run a stripped down version. The `all.c` file is assumed
-// to have been already generated for this build script.
-
-extern crate gcc;
-
-fn main() {
- gcc::Config::new()
- .file("all.c")
- .flag("-Wall")
- .flag("-Wextra")
- .flag("-Werror")
- .flag("-Wno-deprecated-declarations")
- .flag("-Wno-type-limits")
- .compile("liball.a");
-}
diff --git a/libc/libc-test/build.rs b/libc/libc-test/build.rs
index 8e54c82..ce50812 100644
--- a/libc/libc-test/build.rs
+++ b/libc/libc-test/build.rs
@@ -7,13 +7,15 @@ use std::env;
fn main() {
let target = env::var("TARGET").unwrap();
let aarch64 = target.contains("aarch64");
+ let i686 = target.contains("i686");
let x86_64 = target.contains("x86_64");
let windows = target.contains("windows");
let mingw = target.contains("windows-gnu");
let linux = target.contains("unknown-linux");
let android = target.contains("android");
let apple = target.contains("apple");
- let musl = target.contains("musl");
+ let emscripten = target.contains("asm");
+ let musl = target.contains("musl") || emscripten;
let uclibc = target.contains("uclibc");
let freebsd = target.contains("freebsd");
let dragonfly = target.contains("dragonfly");
@@ -25,7 +27,7 @@ fn main() {
let mut cfg = ctest::TestGenerator::new();
// Pull in extra goodies
- if linux || android {
+ if linux || android || emscripten {
cfg.define("_GNU_SOURCE", None);
} else if netbsd {
cfg.define("_NETBSD_SOURCE", Some("1"));
@@ -78,6 +80,7 @@ fn main() {
cfg.header("netinet/in.h");
cfg.header("netinet/ip.h");
cfg.header("netinet/tcp.h");
+ cfg.header("netinet/udp.h");
cfg.header("resolv.h");
cfg.header("pthread.h");
cfg.header("dlfcn.h");
@@ -105,6 +108,7 @@ fn main() {
cfg.header("syslog.h");
cfg.header("semaphore.h");
cfg.header("sys/statvfs.h");
+ cfg.header("sys/times.h");
}
if android {
@@ -116,6 +120,9 @@ fn main() {
cfg.header("arpa/inet.h");
cfg.header("xlocale.h");
cfg.header("utmp.h");
+ if i686 || x86_64 {
+ cfg.header("sys/reg.h");
+ }
} else if !windows {
cfg.header("glob.h");
cfg.header("ifaddrs.h");
@@ -149,9 +156,13 @@ fn main() {
cfg.header("malloc/malloc.h");
cfg.header("util.h");
cfg.header("sys/xattr.h");
+ cfg.header("sys/sys_domain.h");
if target.starts_with("x86") {
cfg.header("crt_externs.h");
}
+ cfg.header("net/route.h");
+ cfg.header("net/route.h");
+ cfg.header("sys/proc_info.h");
}
if bsdlike {
@@ -164,23 +175,33 @@ fn main() {
}
}
- if linux {
+ if linux || emscripten {
cfg.header("mqueue.h");
cfg.header("ucontext.h");
- cfg.header("sys/signalfd.h");
if !uclibc {
// optionally included in uclibc
cfg.header("sys/xattr.h");
}
cfg.header("sys/ipc.h");
+ cfg.header("sys/sem.h");
cfg.header("sys/msg.h");
cfg.header("sys/shm.h");
+ cfg.header("sys/user.h");
cfg.header("sys/fsuid.h");
- cfg.header("pty.h");
cfg.header("shadow.h");
+ if !emscripten {
+ cfg.header("linux/input.h");
+ cfg.header("linux/falloc.h");
+ }
+ if x86_64 {
+ cfg.header("sys/io.h");
+ }
+ if i686 || x86_64 {
+ cfg.header("sys/reg.h");
+ }
}
- if linux || android {
+ if linux || android || emscripten {
cfg.header("malloc.h");
cfg.header("net/ethernet.h");
cfg.header("netpacket/packet.h");
@@ -189,13 +210,21 @@ fn main() {
cfg.header("sys/eventfd.h");
cfg.header("sys/prctl.h");
cfg.header("sys/sendfile.h");
+ cfg.header("sys/signalfd.h");
cfg.header("sys/vfs.h");
cfg.header("sys/syscall.h");
+ cfg.header("sys/personality.h");
+ cfg.header("sys/swap.h");
+ cfg.header("pty.h");
if !uclibc {
cfg.header("sys/sysinfo.h");
}
cfg.header("sys/reboot.h");
+ if !emscripten {
+ cfg.header("linux/netfilter_ipv4.h");
+ }
if !musl {
+ cfg.header("asm/mman.h");
cfg.header("linux/netlink.h");
cfg.header("linux/magic.h");
cfg.header("linux/reboot.h");
@@ -234,7 +263,7 @@ fn main() {
cfg.header("sys/ioctl_compat.h");
}
- if linux || freebsd || dragonfly || netbsd || apple {
+ if linux || freebsd || dragonfly || netbsd || apple || emscripten {
if !uclibc {
cfg.header("aio.h");
}
@@ -293,6 +322,9 @@ fn main() {
}
}
"u64" if struct_ == "epoll_event" => "data.u64".to_string(),
+ "type_" if linux &&
+ (struct_ == "input_event" || struct_ == "input_mask" ||
+ struct_ == "ff_effect") => "type".to_string(),
s => s.to_string(),
}
});
@@ -321,6 +353,15 @@ fn main() {
// This is actually a union, not a struct
"sigval" => true,
+ // Linux kernel headers used on musl are too old to have this
+ // definition. Because it's tested on other Linux targets, skip it.
+ "input_mask" if musl => true,
+
+ // These structs have changed since unified headers in NDK r14b.
+ // `st_atime` and `st_atime_nsec` have changed sign.
+ // FIXME: unskip it for next major release
+ "stat" | "stat64" if android => true,
+
_ => false
}
});
@@ -399,15 +440,44 @@ fn main() {
"KERN_KDENABLE_BG_TRACE" if apple => true,
"KERN_KDDISABLE_BG_TRACE" if apple => true,
+ // These constants were removed in OpenBSD 6 (https://git.io/v7gBO
+ // https://git.io/v7gBq)
+ "KERN_USERMOUNT" |
+ "KERN_ARND" if openbsd => true,
+
+ // These constats were added in OpenBSD 6.2
+ "EV_RECEIPT" | "EV_DISPATCH" 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" |
"MAP_STACK" | "RTLD_DEEPBIND" | "SOL_IPV6" | "SOL_ICMPV6" if uclibc => true,
+ // Musl uses old, patched kernel headers
+ "FALLOC_FL_COLLAPSE_RANGE" | "FALLOC_FL_ZERO_RANGE" |
+ "FALLOC_FL_INSERT_RANGE" | "FALLOC_FL_UNSHARE_RANGE" if musl => true,
+
// Defined by libattr not libc on linux (hard to test).
// See constant definition for more details.
"ENOATTR" if linux => true,
+ // On mips*-unknown-linux-gnu* CMSPAR cannot be included with the set of headers we
+ // want to use here for testing. It's originally defined in asm/termbits.h, which is
+ // also included by asm/termios.h, but not the standard termios.h. There's no way to
+ // include both asm/termbits.h and termios.h and there's no way to include both
+ // asm/termios.h and ioctl.h (+ some other headers) because of redeclared types.
+ "CMSPAR" if mips && linux && !musl => true,
+
+ // On mips Linux targets, MADV_SOFT_OFFLINE is currently missing, though it's been added but CI has too old
+ // of a Linux version. Since it exists on all other Linux targets, just ignore this for now and remove once
+ // it's been fixed in CI.
+ "MADV_SOFT_OFFLINE" if mips && linux => true,
+
+ // These constants are tested in a separate test program generated below because there
+ // are header conflicts if we try to include the headers that define them here.
+ "F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => true,
+ "F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE" => true,
+
_ => false,
}
});
@@ -418,7 +488,8 @@ fn main() {
"execv" | // crazy stuff with const/mut
"execve" |
"execvp" |
- "execvpe" => true,
+ "execvpe" |
+ "fexecve" => true,
"getrlimit" | "getrlimit64" | // non-int in 1st arg
"setrlimit" | "setrlimit64" | // non-int in 1st arg
@@ -504,7 +575,7 @@ fn main() {
"backtrace" |
"sysinfo" | "newlocale" | "duplocale" | "freelocale" | "uselocale" |
"nl_langinfo_l" | "wcslen" | "wcstombs" if uclibc => true,
-
+
// Apparently res_init exists on Android, but isn't defined in a header:
// https://mail.gnome.org/archives/commits-list/2013-May/msg01329.html
"res_init" if android => true,
@@ -515,6 +586,19 @@ fn main() {
// https://github.com/rust-lang/libc/pull/585#discussion_r114561460
"res_init" if apple => true,
+ // On Mac we don't use the default `close()`, instead using their $NOCANCEL variants.
+ "close" if apple => true,
+
+ // Definition of those functions as changed since unified headers from NDK r14b
+ // These changes imply some API breaking changes but are still ABI compatible.
+ // We can wait for the next major release to be compliant with the new API.
+ // FIXME: unskip these for next major release
+ "strerror_r" | "madvise" | "msync" | "mprotect" | "recvfrom" | "getpriority" |
+ "setpriority" | "personality" if android => true,
+ // In Android 64 bits, these functions have been fixed since unified headers.
+ // Ignore these until next major version.
+ "bind" | "writev" | "readv" | "sendmsg" | "recvmsg" if android && (aarch64 || x86_64) => true,
+
_ => false,
}
});
@@ -540,7 +624,11 @@ fn main() {
// aio_buf is "volatile void*" and Rust doesn't understand volatile
(struct_ == "aiocb" && field == "aio_buf") ||
// stack_t.ss_sp's type changed from FreeBSD 10 to 11 in svn r294930
- (freebsd && struct_ == "stack_t" && field == "ss_sp")
+ (freebsd && struct_ == "stack_t" && field == "ss_sp") ||
+ // type siginfo_t.si_addr changed from OpenBSD 6.0 to 6.1
+ (openbsd && struct_ == "siginfo_t" && field == "si_addr") ||
+ // this one is an anonymous union
+ (linux && struct_ == "ff_effect" && field == "u")
});
cfg.skip_field(move |struct_, field| {
@@ -563,9 +651,31 @@ fn main() {
}
});
- if env::var("SKIP_COMPILE").is_ok() {
- cfg.generate_files("../src/lib.rs", "all.rs");
+ cfg.generate("../src/lib.rs", "main.rs");
+
+ // On Linux or Android also generate another script for testing linux/fcntl declarations.
+ // These cannot be tested normally because including both `linux/fcntl.h` and `fcntl.h`
+ // fails on a lot of platforms.
+ let mut cfg = ctest::TestGenerator::new();
+ cfg.skip_type(|_| true)
+ .skip_struct(|_| true)
+ .skip_fn(|_| true);
+ if android || linux {
+ // musl defines these directly in `fcntl.h`
+ if musl {
+ cfg.header("fcntl.h");
+ } else {
+ cfg.header("linux/fcntl.h");
+ }
+ cfg.skip_const(move |name| {
+ match name {
+ "F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => false,
+ "F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE" => false,
+ _ => true,
+ }
+ });
} else {
- cfg.generate("../src/lib.rs", "all.rs");
+ cfg.skip_const(|_| true);
}
+ cfg.generate("../src/lib.rs", "linux_fcntl.rs");
}
diff --git a/libc/libc-test/generate-files/Cargo.toml b/libc/libc-test/generate-files/Cargo.toml
deleted file mode 100644
index 8c19856..0000000
--- a/libc/libc-test/generate-files/Cargo.toml
+++ /dev/null
@@ -1,16 +0,0 @@
-# Cargo.toml which is used to just generate the all.{c,rs} files used to test
-# some platforms. These files are then combined with the overlay files commented
-# in the above directory as well to assemble a libc-test project which will
-# compile/run all tests.
-
-[package]
-name = "generate-files"
-version = "0.1.0"
-authors = ["Alex Crichton <alex@alexcrichton.com>"]
-
-[[bin]]
-name = "generate-files"
-path = "../build.rs"
-
-[dependencies]
-ctest = "0.1"
diff --git a/libc/libc-test/run-generated-Cargo.toml b/libc/libc-test/run-generated-Cargo.toml
deleted file mode 100644
index 64862a5..0000000
--- a/libc/libc-test/run-generated-Cargo.toml
+++ /dev/null
@@ -1,19 +0,0 @@
-# Note that this Cargo.toml is not used by default, it is only intended to be
-# used on the BSDs where it is too expensive to compile syntex_syntax in a QEMU
-# emulator without KVM. Scripts will move this file into place on the BSD CI.
-
-[package]
-name = "libc-test"
-version = "0.1.0"
-authors = ["Alex Crichton <alex@alexcrichton.com>"]
-build = "build-generated.rs"
-
-[dependencies]
-libc = { path = ".." }
-
-[[bin]]
-name = "libc-test"
-path = "src/main-generated.rs"
-
-[build-dependencies]
-gcc = "0.3"
diff --git a/libc/libc-test/src/main-generated.rs b/libc/libc-test/src/main-generated.rs
deleted file mode 100644
index 608fe4e..0000000
--- a/libc/libc-test/src/main-generated.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-// Note that this main file is meant to mirror `main.rs` but is only used on the
-// BSDs where the generated location of `all.rs` is slightly different
-
-#![allow(bad_style, improper_ctypes)]
-extern crate libc;
-
-use libc::*;
-
-include!("../all.rs");
diff --git a/libc/libc-test/test/linux_fcntl.rs b/libc/libc-test/test/linux_fcntl.rs
new file mode 100644
index 0000000..4c8ad52
--- /dev/null
+++ b/libc/libc-test/test/linux_fcntl.rs
@@ -0,0 +1,7 @@
+#![allow(bad_style, improper_ctypes, unused)]
+
+extern crate libc;
+
+use libc::*;
+
+include!(concat!(env!("OUT_DIR"), "/linux_fcntl.rs"));
diff --git a/libc/libc-test/src/main.rs b/libc/libc-test/test/main.rs
index fff188d..3d33610 100644
--- a/libc/libc-test/src/main.rs
+++ b/libc/libc-test/test/main.rs
@@ -3,4 +3,4 @@ extern crate libc;
use libc::*;
-include!(concat!(env!("OUT_DIR"), "/all.rs"));
+include!(concat!(env!("OUT_DIR"), "/main.rs"));
diff --git a/libc/src/dox.rs b/libc/src/dox.rs
index fbec3f2..41aac38 100644
--- a/libc/src/dox.rs
+++ b/libc/src/dox.rs
@@ -26,6 +26,9 @@ mod imp {
#[lang = "copy"]
pub trait Copy {}
+ #[lang = "freeze"]
+ pub trait Freeze {}
+
#[lang = "sync"]
pub trait Sync {}
impl<T> Sync for T {}
diff --git a/libc/src/lib.rs b/libc/src/lib.rs
index c17a504..acccaeb 100644
--- a/libc/src/lib.rs
+++ b/libc/src/lib.rs
@@ -72,6 +72,12 @@
#![cfg_attr(target_os = "dragonfly", doc(
html_root_url = "https://doc.rust-lang.org/libc/x86_64-unknown-dragonfly"
))]
+#![cfg_attr(all(target_os = "emscripten", target_arch = "asmjs"), doc(
+ html_root_url = "https://doc.rust-lang.org/libc/asmjs-unknown-emscripten"
+))]
+#![cfg_attr(all(target_os = "emscripten", target_arch = "wasm32"), doc(
+ html_root_url = "https://doc.rust-lang.org/libc/wasm32-unknown-emscripten"
+))]
// Attributes needed when building as part of the standard library
#![cfg_attr(stdbuild, feature(no_std, core, core_slice_ext, staged_api, custom_attribute, cfg_target_vendor))]
diff --git a/libc/src/macros.rs b/libc/src/macros.rs
index 5811c84..8429442 100644
--- a/libc/src/macros.rs
+++ b/libc/src/macros.rs
@@ -69,40 +69,3 @@ macro_rules! f {
macro_rules! __item {
($i:item) => ($i)
}
-
-#[cfg(test)]
-mod tests {
- cfg_if! {
- if #[cfg(test)] {
- use std::option::Option as Option2;
- fn works1() -> Option2<u32> { Some(1) }
- } else {
- fn works1() -> Option<u32> { None }
- }
- }
-
- cfg_if! {
- if #[cfg(foo)] {
- fn works2() -> bool { false }
- } else if #[cfg(test)] {
- fn works2() -> bool { true }
- } else {
- fn works2() -> bool { false }
- }
- }
-
- cfg_if! {
- if #[cfg(foo)] {
- fn works3() -> bool { false }
- } else {
- fn works3() -> bool { true }
- }
- }
-
- #[test]
- fn it_works() {
- assert!(works1().is_some());
- assert!(works2());
- assert!(works3());
- }
-}
diff --git a/libc/src/redox.rs b/libc/src/redox.rs
index 3f2ed9c..7ff4ea0 100644
--- a/libc/src/redox.rs
+++ b/libc/src/redox.rs
@@ -4,7 +4,7 @@ pub type c_ulong = u64;
pub type wchar_t = i16;
-pub type off_t = usize;
+pub type off_t = c_long;
pub type mode_t = u16;
pub type time_t = i64;
pub type pid_t = usize;
@@ -48,8 +48,47 @@ s! {
}
}
+pub const STDIN_FILENO: ::c_int = 0;
+pub const STDOUT_FILENO: ::c_int = 1;
+pub const STDERR_FILENO: ::c_int = 2;
+
+pub const EXIT_FAILURE: ::c_int = 1;
+pub const EXIT_SUCCESS: ::c_int = 0;
+
+pub const S_ISUID: ::c_int = 0x800;
+pub const S_ISGID: ::c_int = 0x400;
+pub const S_ISVTX: ::c_int = 0x200;
+
+pub const S_IFIFO: mode_t = 0x1000;
+pub const S_IFCHR: mode_t = 0x2000;
+pub const S_IFBLK: mode_t = 0x6000;
+pub const S_IFDIR: mode_t = 0x4000;
+pub const S_IFREG: mode_t = 0x8000;
+pub const S_IFLNK: mode_t = 0xA000;
+pub const S_IFSOCK: mode_t = 0xC000;
+pub const S_IFMT: mode_t = 0xF000;
+pub const S_IEXEC: mode_t = 0x40;
+pub const S_IWRITE: mode_t = 0x80;
+pub const S_IREAD: mode_t = 0x100;
+pub const S_IRWXU: mode_t = 0x1C0;
+pub const S_IXUSR: mode_t = 0x40;
+pub const S_IWUSR: mode_t = 0x80;
+pub const S_IRUSR: mode_t = 0x100;
+pub const S_IRWXG: mode_t = 0x38;
+pub const S_IXGRP: mode_t = 0x8;
+pub const S_IWGRP: mode_t = 0x10;
+pub const S_IRGRP: mode_t = 0x20;
+pub const S_IRWXO: mode_t = 0x7;
+pub const S_IXOTH: mode_t = 0x1;
+pub const S_IWOTH: mode_t = 0x2;
+pub const S_IROTH: mode_t = 0x4;
+
extern {
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
+ pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t)
+ -> ::ssize_t;
+ pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t)
+ -> ::ssize_t;
}
#[link(name = "c")]
diff --git a/libc/src/unix/bsd/apple/b32.rs b/libc/src/unix/bsd/apple/b32.rs
index 8ca0254..53fc0ae 100644
--- a/libc/src/unix/bsd/apple/b32.rs
+++ b/libc/src/unix/bsd/apple/b32.rs
@@ -2,18 +2,52 @@
pub type c_long = i32;
pub type c_ulong = u32;
+pub type boolean_t = ::c_int;
s! {
pub struct pthread_attr_t {
__sig: c_long,
__opaque: [::c_char; 36]
}
+
+ pub struct if_data {
+ pub ifi_type: ::c_uchar,
+ pub ifi_typelen: ::c_uchar,
+ pub ifi_physical: ::c_uchar,
+ pub ifi_addrlen: ::c_uchar,
+ pub ifi_hdrlen: ::c_uchar,
+ pub ifi_recvquota: ::c_uchar,
+ pub ifi_xmitquota: ::c_uchar,
+ pub ifi_unused1: ::c_uchar,
+ pub ifi_mtu: u32,
+ pub ifi_metric: u32,
+ pub ifi_baudrate: u32,
+ pub ifi_ipackets: u32,
+ pub ifi_ierrors: u32,
+ pub ifi_opackets: u32,
+ pub ifi_oerrors: u32,
+ pub ifi_collisions: u32,
+ pub ifi_ibytes: u32,
+ pub ifi_obytes: u32,
+ pub ifi_imcasts: u32,
+ pub ifi_omcasts: u32,
+ pub ifi_iqdrops: u32,
+ pub ifi_noproto: u32,
+ pub ifi_recvtiming: u32,
+ pub ifi_xmittiming: u32,
+ pub ifi_lastchange: ::timeval,
+ pub ifi_unused2: u32,
+ pub ifi_hwassist: u32,
+ pub ifi_reserved1: u32,
+ pub ifi_reserved2: u32,
+ }
}
pub const __PTHREAD_MUTEX_SIZE__: usize = 40;
pub const __PTHREAD_COND_SIZE__: usize = 24;
pub const __PTHREAD_CONDATTR_SIZE__: usize = 4;
pub const __PTHREAD_RWLOCK_SIZE__: usize = 124;
+pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 12;
pub const TIOCTIMESTAMP: ::c_ulong = 0x40087459;
pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40087458;
diff --git a/libc/src/unix/bsd/apple/b64.rs b/libc/src/unix/bsd/apple/b64.rs
index 3f83230..e4a3981 100644
--- a/libc/src/unix/bsd/apple/b64.rs
+++ b/libc/src/unix/bsd/apple/b64.rs
@@ -2,18 +2,57 @@
pub type c_long = i64;
pub type c_ulong = u64;
+pub type boolean_t = ::c_uint;
s! {
pub struct pthread_attr_t {
__sig: c_long,
__opaque: [::c_char; 56]
}
+
+ pub struct timeval32 {
+ pub tv_sec: i32,
+ pub tv_usec: i32,
+ }
+
+ pub struct if_data {
+ pub ifi_type: ::c_uchar,
+ pub ifi_typelen: ::c_uchar,
+ pub ifi_physical: ::c_uchar,
+ pub ifi_addrlen: ::c_uchar,
+ pub ifi_hdrlen: ::c_uchar,
+ pub ifi_recvquota: ::c_uchar,
+ pub ifi_xmitquota: ::c_uchar,
+ pub ifi_unused1: ::c_uchar,
+ pub ifi_mtu: u32,
+ pub ifi_metric: u32,
+ pub ifi_baudrate: u32,
+ pub ifi_ipackets: u32,
+ pub ifi_ierrors: u32,
+ pub ifi_opackets: u32,
+ pub ifi_oerrors: u32,
+ pub ifi_collisions: u32,
+ pub ifi_ibytes: u32,
+ pub ifi_obytes: u32,
+ pub ifi_imcasts: u32,
+ pub ifi_omcasts: u32,
+ pub ifi_iqdrops: u32,
+ pub ifi_noproto: u32,
+ pub ifi_recvtiming: u32,
+ pub ifi_xmittiming: u32,
+ pub ifi_lastchange: timeval32,
+ pub ifi_unused2: u32,
+ pub ifi_hwassist: u32,
+ pub ifi_reserved1: u32,
+ pub ifi_reserved2: u32,
+ }
}
pub const __PTHREAD_MUTEX_SIZE__: usize = 56;
pub const __PTHREAD_COND_SIZE__: usize = 40;
pub const __PTHREAD_CONDATTR_SIZE__: usize = 8;
pub const __PTHREAD_RWLOCK_SIZE__: usize = 192;
+pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 16;
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40107458;
diff --git a/libc/src/unix/bsd/apple/mod.rs b/libc/src/unix/bsd/apple/mod.rs
index 6f0c55b..2f57592 100644
--- a/libc/src/unix/bsd/apple/mod.rs
+++ b/libc/src/unix/bsd/apple/mod.rs
@@ -146,6 +146,11 @@ s! {
__opaque: [u8; __PTHREAD_RWLOCK_SIZE__],
}
+ pub struct pthread_rwlockattr_t {
+ __sig: ::c_long,
+ __opaque: [u8; __PTHREAD_RWLOCKATTR_SIZE__],
+ }
+
pub struct siginfo_t {
pub si_signo: ::c_int,
pub si_errno: ::c_int,
@@ -263,6 +268,16 @@ s! {
pub dqb_spare: [::uint32_t; 4],
}
+ pub struct if_msghdr {
+ pub ifm_msglen: ::c_ushort,
+ pub ifm_version: ::c_uchar,
+ pub ifm_type: ::c_uchar,
+ pub ifm_addrs: ::c_int,
+ pub ifm_flags: ::c_int,
+ pub ifm_index: ::c_ushort,
+ pub ifm_data: if_data,
+ }
+
pub struct termios {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
@@ -322,6 +337,79 @@ s! {
__unused1: *mut ::c_void, //actually a function pointer
pub sigev_notify_attributes: *mut ::pthread_attr_t
}
+
+ pub struct proc_taskinfo {
+ pub pti_virtual_size: u64,
+ pub pti_resident_size: u64,
+ pub pti_total_user: u64,
+ pub pti_total_system: u64,
+ pub pti_threads_user: u64,
+ pub pti_threads_system: u64,
+ pub pti_policy: i32,
+ pub pti_faults: i32,
+ pub pti_pageins: i32,
+ pub pti_cow_faults: i32,
+ pub pti_messages_sent: i32,
+ pub pti_messages_received: i32,
+ pub pti_syscalls_mach: i32,
+ pub pti_syscalls_unix: i32,
+ pub pti_csw: i32,
+ pub pti_threadnum: i32,
+ pub pti_numrunning: i32,
+ pub pti_priority: i32,
+ }
+
+ pub struct proc_bsdinfo {
+ pub pbi_flags: u32,
+ pub pbi_status: u32,
+ pub pbi_xstatus: u32,
+ pub pbi_pid: u32,
+ pub pbi_ppid: u32,
+ pub pbi_uid: ::uid_t,
+ pub pbi_gid: ::gid_t,
+ pub pbi_ruid: ::uid_t,
+ pub pbi_rgid: ::gid_t,
+ pub pbi_svuid: ::uid_t,
+ pub pbi_svgid: ::gid_t,
+ pub rfu_1: u32,
+ pub pbi_comm: [::c_char; MAXCOMLEN],
+ pub pbi_name: [::c_char; 32], // MAXCOMLEN * 2, but macro isn't happy...
+ pub pbi_nfiles: u32,
+ pub pbi_pgid: u32,
+ pub pbi_pjobc: u32,
+ pub e_tdev: u32,
+ pub e_tpgid: u32,
+ pub pbi_nice: i32,
+ pub pbi_start_tvsec: u64,
+ pub pbi_start_tvusec: u64,
+ }
+
+ pub struct proc_taskallinfo {
+ pub pbsd: proc_bsdinfo,
+ pub ptinfo: proc_taskinfo,
+ }
+
+ pub struct proc_threadinfo {
+ pub pth_user_time: u64,
+ pub pth_system_time: u64,
+ pub pth_cpu_usage: i32,
+ pub pth_policy: i32,
+ pub pth_run_state: i32,
+ pub pth_flags: i32,
+ pub pth_sleep_time: i32,
+ pub pth_curpri: i32,
+ pub pth_priority: i32,
+ pub pth_maxpriority: i32,
+ pub pth_name: [::c_char; MAXTHREADNAMESIZE],
+ }
+
+ pub struct xsw_usage {
+ pub xsu_total: u64,
+ pub xsu_avail: u64,
+ pub xsu_used: u64,
+ pub xsu_pagesize: u32,
+ pub xsu_encrypted: ::boolean_t,
+ }
}
pub const _UTX_USERSIZE: usize = 256;
@@ -448,14 +536,8 @@ pub const _PC_PIPE_BUF: ::c_int = 6;
pub const _PC_CHOWN_RESTRICTED: ::c_int = 7;
pub const _PC_NO_TRUNC: ::c_int = 8;
pub const _PC_VDISABLE: ::c_int = 9;
-pub const O_RDONLY: ::c_int = 0;
-pub const O_WRONLY: ::c_int = 1;
-pub const O_RDWR: ::c_int = 2;
-pub const O_APPEND: ::c_int = 8;
-pub const O_CREAT: ::c_int = 512;
-pub const O_EXCL: ::c_int = 2048;
-pub const O_NOCTTY: ::c_int = 131072;
-pub const O_TRUNC: ::c_int = 1024;
+pub const O_DSYNC: ::c_int = 0x400000;
+pub const O_NOCTTY: ::c_int = 0x20000;
pub const O_CLOEXEC: ::c_int = 0x1000000;
pub const O_DIRECTORY: ::c_int = 0x100000;
pub const S_IFIFO: mode_t = 4096;
@@ -671,8 +753,6 @@ pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x0020;
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x0040;
pub const AT_REMOVEDIR: ::c_int = 0x0080;
-pub const O_ACCMODE: ::c_int = 3;
-
pub const TIOCMODG: ::c_ulong = 0x40047403;
pub const TIOCMODS: ::c_ulong = 0x80047404;
pub const TIOCM_LE: ::c_int = 0x1;
@@ -812,6 +892,8 @@ pub const _SC_XOPEN_UNIX: ::c_int = 115;
pub const _SC_XOPEN_VERSION: ::c_int = 116;
pub const _SC_XOPEN_XCU_VERSION: ::c_int = 121;
+pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 2;
+pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 1;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 2;
pub const PTHREAD_STACK_MIN: ::size_t = 8192;
@@ -890,6 +972,10 @@ pub const AF_PPP: ::c_int = 34;
pub const pseudo_AF_HDRCMPLT: ::c_int = 35;
#[doc(hidden)]
pub const AF_MAX: ::c_int = 40;
+pub const AF_SYS_CONTROL: ::c_int = 2;
+
+pub const SYSPROTO_EVENT: ::c_int = 1;
+pub const SYSPROTO_CONTROL: ::c_int = 2;
pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
pub const PF_LOCAL: ::c_int = AF_LOCAL;
@@ -947,13 +1033,6 @@ pub const SOCK_DGRAM: ::c_int = 2;
pub const SOCK_RAW: ::c_int = 3;
pub const SOCK_RDM: ::c_int = 4;
pub const SOCK_SEQPACKET: ::c_int = 5;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-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;
@@ -976,6 +1055,7 @@ pub const SO_LINGER: ::c_int = 0x0080;
pub const SO_OOBINLINE: ::c_int = 0x0100;
pub const SO_REUSEPORT: ::c_int = 0x0200;
pub const SO_TIMESTAMP: ::c_int = 0x0400;
+pub const SO_TIMESTAMP_MONOTONIC: ::c_int = 0x0800;
pub const SO_DONTTRUNC: ::c_int = 0x2000;
pub const SO_WANTMORE: ::c_int = 0x4000;
pub const SO_WANTOOBFLAG: ::c_int = 0x8000;
@@ -987,11 +1067,17 @@ pub const SO_SNDTIMEO: ::c_int = 0x1005;
pub const SO_RCVTIMEO: ::c_int = 0x1006;
pub const SO_ERROR: ::c_int = 0x1007;
pub const SO_TYPE: ::c_int = 0x1008;
+pub const SO_LABEL: ::c_int = 0x1010;
+pub const SO_PEERLABEL: ::c_int = 0x1011;
pub const SO_NREAD: ::c_int = 0x1020;
pub const SO_NKE: ::c_int = 0x1021;
pub const SO_NOSIGPIPE: ::c_int = 0x1022;
pub const SO_NOADDRERR: ::c_int = 0x1023;
pub const SO_NWRITE: ::c_int = 0x1024;
+pub const SO_REUSESHAREUID: ::c_int = 0x1025;
+pub const SO_NOTIFYCONFLICT: ::c_int = 0x1026;
+pub const SO_RANDOMPORT: ::c_int = 0x1082;
+pub const SO_NP_EXTENSIONS: ::c_int = 0x1083;
pub const MSG_OOB: ::c_int = 0x1;
pub const MSG_PEEK: ::c_int = 0x2;
@@ -1009,7 +1095,6 @@ pub const MSG_HAVEMORE: ::c_int = 0x2000;
pub const MSG_RCVMORE: ::c_int = 0x4000;
// pub const MSG_COMPAT: ::c_int = 0x8000;
-pub const SCM_RIGHTS: ::c_int = 0x01;
pub const SCM_TIMESTAMP: ::c_int = 0x02;
pub const SCM_CREDS: ::c_int = 0x03;
@@ -1024,10 +1109,6 @@ pub const LOCK_EX: ::c_int = 2;
pub const LOCK_NB: ::c_int = 4;
pub const LOCK_UN: ::c_int = 8;
-pub const O_DSYNC: ::c_int = 4194304;
-pub const O_SYNC: ::c_int = 128;
-pub const O_NONBLOCK: ::c_int = 4;
-
pub const MAP_COPY: ::c_int = 0x0002;
pub const MAP_RENAME: ::c_int = 0x0020;
pub const MAP_NORESERVE: ::c_int = 0x0040;
@@ -1238,6 +1319,18 @@ pub const NOTE_TRACK: ::uint32_t = 0x00000001;
pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
pub const NOTE_CHILD: ::uint32_t = 0x00000004;
+pub const OCRNL: ::c_int = 0x00000010;
+pub const ONOCR: ::c_int = 0x00000020;
+pub const ONLRET: ::c_int = 0x00000040;
+pub const OFILL: ::c_int = 0x00000080;
+pub const NLDLY: ::c_int = 0x00000300;
+pub const TABDLY: ::c_int = 0x00000c04;
+pub const CRDLY: ::c_int = 0x00003000;
+pub const FFDLY: ::c_int = 0x00004000;
+pub const BSDLY: ::c_int = 0x00008000;
+pub const VTDLY: ::c_int = 0x00010000;
+pub const OFDEL: ::c_int = 0x00020000;
+
pub const NL0: ::c_int = 0x00000000;
pub const NL1: ::c_int = 0x00000100;
pub const TAB0: ::c_int = 0x00000000;
@@ -1481,11 +1574,6 @@ pub const CTL_DEBUG_NAME: ::c_int = 0;
pub const CTL_DEBUG_VALUE: ::c_int = 1;
pub const CTL_DEBUG_MAXID: ::c_int = 20;
-pub const POLLRDNORM: ::c_short = 0x040;
-pub const POLLWRNORM: ::c_short = 0x004;
-pub const POLLRDBAND: ::c_short = 0x080;
-pub const POLLWRBAND: ::c_short = 0x100;
-
pub const PRIO_DARWIN_THREAD: ::c_int = 3;
pub const PRIO_DARWIN_PROCESS: ::c_int = 4;
pub const PRIO_DARWIN_BG: ::c_int = 0x1000;
@@ -1523,6 +1611,17 @@ pub const XATTR_NOSECURITY: ::c_int = 0x0008;
pub const XATTR_NODEFAULT: ::c_int = 0x0010;
pub const XATTR_SHOWCOMPRESSION: ::c_int = 0x0020;
+pub const NET_RT_IFLIST2: ::c_int = 0x0006;
+pub const RTM_IFINFO2: ::c_int = 0x0012;
+
+pub const KERN_PROCARGS2: ::c_int = 49;
+
+pub const PROC_PIDTASKALLINFO: ::c_int = 2;
+pub const PROC_PIDTASKINFO: ::c_int = 4;
+pub const PROC_PIDTHREADINFO: ::c_int = 5;
+pub const MAXCOMLEN: usize = 16;
+pub const MAXTHREADNAMESIZE: usize = 64;
+
f! {
pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
status >> 8
@@ -1559,6 +1658,8 @@ extern {
pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
nitems: ::c_int, sevp: *mut sigevent) -> ::c_int;
+ pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
+
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
pub fn getutxent() -> *mut utmpx;
@@ -1613,6 +1714,10 @@ extern {
pshared: ::c_int) -> ::c_int;
pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
pshared: *mut ::c_int) -> ::c_int;
+ pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
+ val: *mut ::c_int) -> ::c_int;
+ pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
+ val: ::c_int) -> ::c_int;
pub fn __error() -> *mut ::c_int;
pub fn backtrace(buf: *mut *mut ::c_void,
sz: ::c_int) -> ::c_int;
@@ -1637,7 +1742,7 @@ extern {
target: *const ::c_char,
flags: ::c_int,
data: *mut ::c_void) -> ::c_int;
- pub fn ptrace(requeset: ::c_int,
+ pub fn ptrace(request: ::c_int,
pid: ::pid_t,
addr: *mut ::c_char,
data: ::c_int) -> ::c_int;
@@ -1693,13 +1798,19 @@ extern {
pub fn fremovexattr(filedes: ::c_int, name: *const ::c_char,
flags: ::c_int) -> ::c_int;
+ pub fn getgrouplist(name: *const ::c_char,
+ basegid: ::c_int,
+ groups: *mut ::c_int,
+ ngroups: *mut ::c_int) -> ::c_int;
pub fn initgroups(user: *const ::c_char, basegroup: ::c_int) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "waitid$UNIX2003")]
pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
options: ::c_int) -> ::c_int;
-
+ pub fn brk(addr: *const ::c_void) -> *mut ::c_void;
+ pub fn sbrk(increment: ::c_int) -> *mut ::c_void;
+ pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
}
cfg_if! {
diff --git a/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
index e60825a..038a886 100644
--- a/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -131,13 +131,51 @@ s! {
pub st_qspare1: ::int64_t,
pub st_qspare2: ::int64_t,
}
+
+ pub struct if_data {
+ pub ifi_type: ::c_uchar,
+ pub ifi_physical: ::c_uchar,
+ pub ifi_addrlen: ::c_uchar,
+ pub ifi_hdrlen: ::c_uchar,
+ pub ifi_recvquota: ::c_uchar,
+ pub ifi_xmitquota: ::c_uchar,
+ pub ifi_mtu: ::c_ulong,
+ pub ifi_metric: ::c_ulong,
+ pub ifi_link_state: ::c_ulong,
+ pub ifi_baudrate: u64,
+ pub ifi_ipackets: ::c_ulong,
+ pub ifi_ierrors: ::c_ulong,
+ pub ifi_opackets: ::c_ulong,
+ pub ifi_oerrors: ::c_ulong,
+ pub ifi_collisions: ::c_ulong,
+ pub ifi_ibytes: ::c_ulong,
+ pub ifi_obytes: ::c_ulong,
+ pub ifi_imcasts: ::c_ulong,
+ pub ifi_omcasts: ::c_ulong,
+ pub ifi_iqdrops: ::c_ulong,
+ pub ifi_noproto: ::c_ulong,
+ pub ifi_hwassist: ::c_ulong,
+ pub ifi_oqdrops: ::c_ulong,
+ pub ifi_lastchange: ::timeval,
+ }
+
+ pub struct if_msghdr {
+ pub ifm_msglen: ::c_ushort,
+ pub ifm_version: ::c_uchar,
+ pub ifm_type: ::c_uchar,
+ pub ifm_addrs: ::c_int,
+ pub ifm_flags: ::c_int,
+ pub ifm_index: ::c_ushort,
+ pub ifm_data: if_data,
+ }
}
pub const RAND_MAX: ::c_int = 0x7fff_ffff;
-pub const PTHREAD_STACK_MIN: ::size_t = 1024;
+pub const PTHREAD_STACK_MIN: ::size_t = 16384;
pub const SIGSTKSZ: ::size_t = 40960;
pub const MADV_INVAL: ::c_int = 10;
pub const O_CLOEXEC: ::c_int = 0x00020000;
+pub const O_DIRECTORY: ::c_int = 0x08000000;
pub const F_GETLK: ::c_int = 7;
pub const F_SETLK: ::c_int = 8;
pub const F_SETLKW: ::c_int = 9;
@@ -148,20 +186,20 @@ pub const RLIM_NLIMITS: ::rlim_t = 12;
pub const Q_GETQUOTA: ::c_int = 0x300;
pub const Q_SETQUOTA: ::c_int = 0x400;
-pub const CLOCK_REALTIME: clockid_t = 0;
-pub const CLOCK_VIRTUAL: clockid_t = 1;
-pub const CLOCK_PROF: clockid_t = 2;
-pub const CLOCK_MONOTONIC: clockid_t = 4;
-pub const CLOCK_UPTIME: clockid_t = 5;
-pub const CLOCK_UPTIME_PRECISE: clockid_t = 7;
-pub const CLOCK_UPTIME_FAST: clockid_t = 8;
-pub const CLOCK_REALTIME_PRECISE: clockid_t = 9;
-pub const CLOCK_REALTIME_FAST: clockid_t = 10;
-pub const CLOCK_MONOTONIC_PRECISE: clockid_t = 11;
-pub const CLOCK_MONOTONIC_FAST: clockid_t = 12;
-pub const CLOCK_SECOND: clockid_t = 13;
-pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 14;
-pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 15;
+pub const CLOCK_REALTIME: ::clockid_t = 0;
+pub const CLOCK_VIRTUAL: ::clockid_t = 1;
+pub const CLOCK_PROF: ::clockid_t = 2;
+pub const CLOCK_MONOTONIC: ::clockid_t = 4;
+pub const CLOCK_UPTIME: ::clockid_t = 5;
+pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
+pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
+pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
+pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
+pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
+pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
+pub const CLOCK_SECOND: ::clockid_t = 13;
+pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
+pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
pub const CTL_UNSPEC: ::c_int = 0;
pub const CTL_KERN: ::c_int = 1;
@@ -302,6 +340,7 @@ pub const EVFILT_VNODE: ::int16_t = -4;
pub const EVFILT_PROC: ::int16_t = -5;
pub const EVFILT_SIGNAL: ::int16_t = -6;
pub const EVFILT_TIMER: ::int16_t = -7;
+pub const EVFILT_EXCEPT: ::int16_t = -8;
pub const EVFILT_USER: ::int16_t = -9;
pub const EVFILT_FS: ::int16_t = -10;
@@ -404,12 +443,31 @@ pub const TIOCMODG: ::c_uint = 0x40047403;
pub const TIOCMODS: ::c_ulong = 0x80047404;
pub const TIOCREMOTE: ::c_ulong = 0x80047469;
+// Constants used by "at" family of system calls.
+pub const AT_FDCWD: ::c_int = 0xFFFAFDCD; // invalid file descriptor
+pub const AT_SYMLINK_NOFOLLOW: ::c_int = 1;
+pub const AT_REMOVEDIR: ::c_int = 2;
+pub const AT_EACCESS: ::c_int = 4;
+pub const AT_SYMLINK_FOLLOW: ::c_int = 8;
+
+pub const VCHECKPT: usize = 19;
+
+pub const _PC_2_SYMLINKS: ::c_int = 22;
+pub const _PC_TIMESTAMP_RESOLUTION: ::c_int = 23;
+
+pub const _SC_V7_ILP32_OFF32: ::c_int = 122;
+pub const _SC_V7_ILP32_OFFBIG: ::c_int = 123;
+pub const _SC_V7_LP64_OFF64: ::c_int = 124;
+pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 125;
+pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 126;
+pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 127;
+
extern {
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
- pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_settime(clk_id: clockid_t, tp: *const ::timespec) -> ::c_int;
+ pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
pub fn setutxdb(_type: ::c_uint, file: *mut ::c_char) -> ::c_int;
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
index a2da845..3d61f88 100644
--- a/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
@@ -28,3 +28,5 @@ s! {
pub st_birthtime_nsec: ::c_long,
}
}
+
+pub const MAP_32BIT: ::c_int = 0x00080000;
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs b/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
index fb113de..dbf7fd3 100644
--- a/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -139,6 +139,9 @@ pub const SF_NODISKIO: ::c_int = 0x00000001;
pub const SF_MNOWAIT: ::c_int = 0x00000002;
pub const SF_SYNC: ::c_int = 0x00000004;
pub const O_CLOEXEC: ::c_int = 0x00100000;
+pub const O_DIRECTORY: ::c_int = 0x00020000;
+pub const O_EXEC: ::c_int = 0x00040000;
+pub const O_TTY_INIT: ::c_int = 0x00080000;
pub const F_GETLK: ::c_int = 11;
pub const F_SETLK: ::c_int = 12;
pub const F_SETLKW: ::c_int = 13;
@@ -157,6 +160,8 @@ pub const POSIX_FADV_WILLNEED: ::c_int = 3;
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
+pub const POLLINIGNEOF: ::c_short = 0x2000;
+
pub const EVFILT_READ: ::int16_t = -1;
pub const EVFILT_WRITE: ::int16_t = -2;
pub const EVFILT_AIO: ::int16_t = -3;
@@ -213,20 +218,20 @@ pub const NOTE_NSECONDS: ::uint32_t = 0x00000008;
pub const MADV_PROTECT: ::c_int = 10;
pub const RUSAGE_THREAD: ::c_int = 1;
-pub const CLOCK_REALTIME: clockid_t = 0;
-pub const CLOCK_VIRTUAL: clockid_t = 1;
-pub const CLOCK_PROF: clockid_t = 2;
-pub const CLOCK_MONOTONIC: clockid_t = 4;
-pub const CLOCK_UPTIME: clockid_t = 5;
-pub const CLOCK_UPTIME_PRECISE: clockid_t = 7;
-pub const CLOCK_UPTIME_FAST: clockid_t = 8;
-pub const CLOCK_REALTIME_PRECISE: clockid_t = 9;
-pub const CLOCK_REALTIME_FAST: clockid_t = 10;
-pub const CLOCK_MONOTONIC_PRECISE: clockid_t = 11;
-pub const CLOCK_MONOTONIC_FAST: clockid_t = 12;
-pub const CLOCK_SECOND: clockid_t = 13;
-pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 14;
-pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 15;
+pub const CLOCK_REALTIME: ::clockid_t = 0;
+pub const CLOCK_VIRTUAL: ::clockid_t = 1;
+pub const CLOCK_PROF: ::clockid_t = 2;
+pub const CLOCK_MONOTONIC: ::clockid_t = 4;
+pub const CLOCK_UPTIME: ::clockid_t = 5;
+pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
+pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
+pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
+pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
+pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
+pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
+pub const CLOCK_SECOND: ::clockid_t = 13;
+pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
+pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
pub const CTL_UNSPEC: ::c_int = 0;
pub const CTL_KERN: ::c_int = 1;
@@ -508,15 +513,29 @@ pub const P_ALL: idtype_t = 7;
pub const B460800: ::speed_t = 460800;
pub const B921600: ::speed_t = 921600;
+pub const AT_FDCWD: ::c_int = -100;
+pub const AT_EACCESS: ::c_int = 0x100;
+pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
+pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
+pub const AT_REMOVEDIR: ::c_int = 0x800;
+
+pub const TABDLY: ::tcflag_t = 0x00000004;
+pub const TAB0: ::tcflag_t = 0x00000000;
+pub const TAB3: ::tcflag_t = 0x00000004;
+
+pub const _PC_ACL_NFS4: ::c_int = 64;
+
+pub const _SC_CPUSET_SIZE: ::c_int = 122;
+
extern {
pub fn __error() -> *mut ::c_int;
pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
- pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_settime(clk_id: clockid_t, tp: *const ::timespec) -> ::c_int;
+ pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
pub fn jail(jail: *mut ::jail) -> ::c_int;
pub fn jail_attach(jid: ::c_int) -> ::c_int;
@@ -559,6 +578,7 @@ extern {
msgtyp: ::c_long, msgflg: ::c_int) -> ::c_int;
pub fn msgsnd(msqid: ::c_int, msgp: *const ::c_void, msgsz: ::size_t,
msgflg: ::c_int) -> ::c_int;
+ pub fn cfmakesane(termios: *mut ::termios);
}
cfg_if! {
diff --git a/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs b/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
index a2da845..3d61f88 100644
--- a/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
+++ b/libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs
@@ -28,3 +28,5 @@ s! {
pub st_birthtime_nsec: ::c_long,
}
}
+
+pub const MAP_32BIT: ::c_int = 0x00080000;
diff --git a/libc/src/unix/bsd/freebsdlike/mod.rs b/libc/src/unix/bsd/freebsdlike/mod.rs
index daf3f29..8cc87ce 100644
--- a/libc/src/unix/bsd/freebsdlike/mod.rs
+++ b/libc/src/unix/bsd/freebsdlike/mod.rs
@@ -7,6 +7,7 @@ pub type pthread_mutexattr_t = *mut ::c_void;
pub type pthread_cond_t = *mut ::c_void;
pub type pthread_condattr_t = *mut ::c_void;
pub type pthread_rwlock_t = *mut ::c_void;
+pub type pthread_rwlockattr_t = *mut ::c_void;
pub type pthread_key_t = ::c_int;
pub type tcflag_t = ::c_uint;
pub type speed_t = ::c_uint;
@@ -263,6 +264,8 @@ 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 SEEK_DATA: ::c_int = 3;
+pub const SEEK_HOLE: ::c_int = 4;
pub const _IOFBF: ::c_int = 0;
pub const _IONBF: ::c_int = 2;
pub const _IOLBF: ::c_int = 1;
@@ -272,15 +275,9 @@ pub const FILENAME_MAX: ::c_uint = 1024;
pub const L_tmpnam: ::c_uint = 1024;
pub const TMP_MAX: ::c_uint = 308915776;
-pub const O_RDONLY: ::c_int = 0;
-pub const O_WRONLY: ::c_int = 1;
-pub const O_RDWR: ::c_int = 2;
-pub const O_ACCMODE: ::c_int = 3;
-pub const O_APPEND: ::c_int = 8;
-pub const O_CREAT: ::c_int = 512;
-pub const O_EXCL: ::c_int = 2048;
pub const O_NOCTTY: ::c_int = 32768;
-pub const O_TRUNC: ::c_int = 1024;
+pub const O_DIRECT: ::c_int = 0x00010000;
+
pub const S_IFIFO: mode_t = 4096;
pub const S_IFCHR: mode_t = 8192;
pub const S_IFBLK: mode_t = 24576;
@@ -339,6 +336,7 @@ pub const MAP_SHARED: ::c_int = 0x0001;
pub const MAP_PRIVATE: ::c_int = 0x0002;
pub const MAP_FIXED: ::c_int = 0x0010;
pub const MAP_ANON: ::c_int = 0x1000;
+pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
@@ -444,6 +442,10 @@ pub const EMULTIHOP: ::c_int = 90;
pub const ENOLINK: ::c_int = 91;
pub const EPROTO: ::c_int = 92;
+pub const POLLSTANDARD: ::c_short = ::POLLIN | ::POLLPRI | ::POLLOUT |
+ ::POLLRDNORM | ::POLLRDBAND | ::POLLWRBAND | ::POLLERR |
+ ::POLLHUP | ::POLLNVAL;
+
pub const EAI_SYSTEM: ::c_int = 11;
pub const F_DUPFD: ::c_int = 0;
@@ -452,11 +454,6 @@ pub const F_SETFD: ::c_int = 2;
pub const F_GETFL: ::c_int = 3;
pub const F_SETFL: ::c_int = 4;
-pub const AT_EACCESS: ::c_int = 0x100;
-pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200;
-pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
-pub const AT_REMOVEDIR: ::c_int = 0x800;
-
pub const SIGTRAP: ::c_int = 5;
pub const GLOB_APPEND : ::c_int = 0x0001;
@@ -477,36 +474,8 @@ pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
pub const POSIX_MADV_WILLNEED: ::c_int = 3;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
-pub const _SC_IOV_MAX: ::c_int = 56;
-pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 70;
-pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 71;
-pub const _SC_LOGIN_NAME_MAX: ::c_int = 73;
-pub const _SC_MQ_PRIO_MAX: ::c_int = 75;
-pub const _SC_NPROCESSORS_ONLN: ::c_int = 58;
-pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 82;
-pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 83;
-pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 85;
-pub const _SC_THREAD_KEYS_MAX: ::c_int = 86;
-pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 87;
-pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 88;
-pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 89;
-pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 90;
-pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 91;
-pub const _SC_THREAD_STACK_MIN: ::c_int = 93;
-pub const _SC_THREAD_THREADS_MAX: ::c_int = 94;
-pub const _SC_THREADS: ::c_int = 96;
-pub const _SC_TTY_NAME_MAX: ::c_int = 101;
-pub const _SC_ATEXIT_MAX: ::c_int = 107;
-pub const _SC_XOPEN_CRYPT: ::c_int = 108;
-pub const _SC_XOPEN_ENH_I18N: ::c_int = 109;
-pub const _SC_XOPEN_LEGACY: ::c_int = 110;
-pub const _SC_XOPEN_REALTIME: ::c_int = 111;
-pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 112;
-pub const _SC_XOPEN_SHM: ::c_int = 113;
-pub const _SC_XOPEN_UNIX: ::c_int = 115;
-pub const _SC_XOPEN_VERSION: ::c_int = 116;
-pub const _SC_XOPEN_XCU_VERSION: ::c_int = 117;
-
+pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0;
+pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
@@ -629,6 +598,8 @@ pub const MSG_WAITALL: ::c_int = 0x00000040;
pub const MSG_DONTWAIT: ::c_int = 0x00000080;
pub const MSG_EOF: ::c_int = 0x00000100;
+pub const SCM_TIMESTAMP: ::c_int = 0x02;
+
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
pub const SOCK_RAW: ::c_int = 3;
@@ -637,13 +608,6 @@ pub const SOCK_SEQPACKET: ::c_int = 5;
pub const SOCK_CLOEXEC: ::c_int = 0x10000000;
pub const SOCK_NONBLOCK: ::c_int = 0x20000000;
pub const SOCK_MAXADDRLEN: ::c_int = 255;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-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;
@@ -687,9 +651,6 @@ pub const LOCK_EX: ::c_int = 2;
pub const LOCK_NB: ::c_int = 4;
pub const LOCK_UN: ::c_int = 8;
-pub const O_SYNC: ::c_int = 128;
-pub const O_NONBLOCK: ::c_int = 4;
-
pub const MAP_COPY: ::c_int = 0x0002;
pub const MAP_RENAME: ::c_int = 0x0020;
pub const MAP_NORESERVE: ::c_int = 0x0040;
@@ -700,6 +661,32 @@ pub const MAP_NOCORE: ::c_int = 0x020000;
pub const IPPROTO_RAW: ::c_int = 255;
+pub const _PC_LINK_MAX: ::c_int = 1;
+pub const _PC_MAX_CANON: ::c_int = 2;
+pub const _PC_MAX_INPUT: ::c_int = 3;
+pub const _PC_NAME_MAX: ::c_int = 4;
+pub const _PC_PATH_MAX: ::c_int = 5;
+pub const _PC_PIPE_BUF: ::c_int = 6;
+pub const _PC_CHOWN_RESTRICTED: ::c_int = 7;
+pub const _PC_NO_TRUNC: ::c_int = 8;
+pub const _PC_VDISABLE: ::c_int = 9;
+pub const _PC_ALLOC_SIZE_MIN: ::c_int = 10;
+pub const _PC_FILESIZEBITS: ::c_int = 12;
+pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14;
+pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15;
+pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16;
+pub const _PC_REC_XFER_ALIGN: ::c_int = 17;
+pub const _PC_SYMLINK_MAX: ::c_int = 18;
+pub const _PC_MIN_HOLE_SIZE: ::c_int = 21;
+pub const _PC_ASYNC_IO: ::c_int = 53;
+pub const _PC_PRIO_IO: ::c_int = 54;
+pub const _PC_SYNC_IO: ::c_int = 55;
+pub const _PC_ACL_EXTENDED: ::c_int = 59;
+pub const _PC_ACL_PATH_MAX: ::c_int = 60;
+pub const _PC_CAP_PRESENT: ::c_int = 61;
+pub const _PC_INF_PRESENT: ::c_int = 62;
+pub const _PC_MAC_PRESENT: ::c_int = 63;
+
pub const _SC_ARG_MAX: ::c_int = 1;
pub const _SC_CHILD_MAX: ::c_int = 2;
pub const _SC_CLK_TCK: ::c_int = 3;
@@ -753,7 +740,71 @@ pub const _SC_SEM_NSEMS_MAX: ::c_int = 49;
pub const _SC_SEM_VALUE_MAX: ::c_int = 50;
pub const _SC_SIGQUEUE_MAX: ::c_int = 51;
pub const _SC_TIMER_MAX: ::c_int = 52;
+pub const _SC_IOV_MAX: ::c_int = 56;
+pub const _SC_NPROCESSORS_CONF: ::c_int = 57;
+pub const _SC_2_PBS: ::c_int = 59;
+pub const _SC_2_PBS_ACCOUNTING: ::c_int = 60;
+pub const _SC_2_PBS_CHECKPOINT: ::c_int = 61;
+pub const _SC_2_PBS_LOCATE: ::c_int = 62;
+pub const _SC_2_PBS_MESSAGE: ::c_int = 63;
+pub const _SC_2_PBS_TRACK: ::c_int = 64;
+pub const _SC_ADVISORY_INFO: ::c_int = 65;
+pub const _SC_BARRIERS: ::c_int = 66;
+pub const _SC_CLOCK_SELECTION: ::c_int = 67;
+pub const _SC_CPUTIME: ::c_int = 68;
+pub const _SC_FILE_LOCKING: ::c_int = 69;
+pub const _SC_NPROCESSORS_ONLN: ::c_int = 58;
+pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 70;
+pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 71;
pub const _SC_HOST_NAME_MAX: ::c_int = 72;
+pub const _SC_LOGIN_NAME_MAX: ::c_int = 73;
+pub const _SC_MONOTONIC_CLOCK: ::c_int = 74;
+pub const _SC_MQ_PRIO_MAX: ::c_int = 75;
+pub const _SC_READER_WRITER_LOCKS: ::c_int = 76;
+pub const _SC_REGEXP: ::c_int = 77;
+pub const _SC_SHELL: ::c_int = 78;
+pub const _SC_SPAWN: ::c_int = 79;
+pub const _SC_SPIN_LOCKS: ::c_int = 80;
+pub const _SC_SPORADIC_SERVER: ::c_int = 81;
+pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 82;
+pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 83;
+pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 85;
+pub const _SC_THREAD_KEYS_MAX: ::c_int = 86;
+pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 87;
+pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 88;
+pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 89;
+pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 90;
+pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 91;
+pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 92;
+pub const _SC_THREAD_STACK_MIN: ::c_int = 93;
+pub const _SC_THREAD_THREADS_MAX: ::c_int = 94;
+pub const _SC_TIMEOUTS: ::c_int = 95;
+pub const _SC_THREADS: ::c_int = 96;
+pub const _SC_TRACE: ::c_int = 97;
+pub const _SC_TRACE_EVENT_FILTER: ::c_int = 98;
+pub const _SC_TRACE_INHERIT: ::c_int = 99;
+pub const _SC_TRACE_LOG: ::c_int = 100;
+pub const _SC_TTY_NAME_MAX: ::c_int = 101;
+pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 102;
+pub const _SC_V6_ILP32_OFF32: ::c_int = 103;
+pub const _SC_V6_ILP32_OFFBIG: ::c_int = 104;
+pub const _SC_V6_LP64_OFF64: ::c_int = 105;
+pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 106;
+pub const _SC_ATEXIT_MAX: ::c_int = 107;
+pub const _SC_XOPEN_CRYPT: ::c_int = 108;
+pub const _SC_XOPEN_ENH_I18N: ::c_int = 109;
+pub const _SC_XOPEN_LEGACY: ::c_int = 110;
+pub const _SC_XOPEN_REALTIME: ::c_int = 111;
+pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 112;
+pub const _SC_XOPEN_SHM: ::c_int = 113;
+pub const _SC_XOPEN_STREAMS: ::c_int = 114;
+pub const _SC_XOPEN_UNIX: ::c_int = 115;
+pub const _SC_XOPEN_VERSION: ::c_int = 116;
+pub const _SC_XOPEN_XCU_VERSION: ::c_int = 117;
+pub const _SC_IPV6: ::c_int = 118;
+pub const _SC_RAW_SOCKETS: ::c_int = 119;
+pub const _SC_SYMLOOP_MAX: ::c_int = 120;
+pub const _SC_PHYS_PAGES: ::c_int = 121;
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = 0 as *mut _;
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = 0 as *mut _;
@@ -875,8 +926,15 @@ pub const EXTB: speed_t = 38400;
pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
pub const CRTSCTS: ::tcflag_t = 0x00030000;
-
-pub const AT_FDCWD: ::c_int = -100;
+pub const CCTS_OFLOW: ::tcflag_t = 0x00010000;
+pub const CRTS_IFLOW: ::tcflag_t = 0x00020000;
+pub const CDTR_IFLOW: ::tcflag_t = 0x00040000;
+pub const CDSR_OFLOW: ::tcflag_t = 0x00080000;
+pub const CCAR_OFLOW: ::tcflag_t = 0x00100000;
+pub const VERASE2: usize = 7;
+pub const OCRNL: ::tcflag_t = 0x10;
+pub const ONOCR: ::tcflag_t = 0x20;
+pub const ONLRET: ::tcflag_t = 0x40;
f! {
pub fn WIFCONTINUED(status: ::c_int) -> bool {
@@ -904,6 +962,13 @@ extern {
pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
pub fn setutxent();
+ pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
+ pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
+ pub fn getgrouplist(name: *const ::c_char,
+ basegid: ::gid_t,
+ groups: *mut ::gid_t,
+ ngroups: *mut ::c_int) -> ::c_int;
+ pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
}
#[link(name = "util")]
@@ -918,6 +983,7 @@ extern {
pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb,
nitems: ::c_int, sevp: *mut sigevent) -> ::c_int;
+ pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
host: *mut ::c_char,
@@ -933,6 +999,14 @@ extern {
timeout: *const ::timespec) -> ::c_int;
pub fn mincore(addr: *const ::c_void, len: ::size_t,
vec: *mut ::c_char) -> ::c_int;
+ pub fn pwritev(fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t) -> ::ssize_t;
+ pub fn preadv(fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t) -> ::ssize_t;
pub fn sysctlnametomib(name: *const ::c_char,
mibp: *mut ::c_int,
sizep: *mut ::size_t)
@@ -954,7 +1028,7 @@ extern {
-> ::c_int;
pub fn sched_setscheduler(pid: ::pid_t,
policy: ::c_int,
- param: *const sched_param) -> ::c_int;
+ param: *const ::sched_param) -> ::c_int;
pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
pub fn memrchr(cx: *const ::c_void,
c: ::c_int,
@@ -1005,6 +1079,10 @@ extern {
pshared: ::c_int) -> ::c_int;
pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
pshared: *mut ::c_int) -> ::c_int;
+ pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
+ val: *mut ::c_int) -> ::c_int;
+ pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
+ val: ::c_int) -> ::c_int;
pub fn getpriority(which: ::c_int, who: ::c_int) -> ::c_int;
pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int;
@@ -1017,7 +1095,7 @@ extern {
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;
+ clock_id: ::clockid_t) -> ::c_int;
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;
@@ -1028,6 +1106,10 @@ extern {
nfds: ::nfds_t,
timeout: *const ::timespec,
sigmask: *const sigset_t) -> ::c_int;
+ pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
+ pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
+ envp: *const *const ::c_char)
+ -> ::c_int;
}
cfg_if! {
diff --git a/libc/src/unix/bsd/mod.rs b/libc/src/unix/bsd/mod.rs
index 96b0f22..94b8576 100644
--- a/libc/src/unix/bsd/mod.rs
+++ b/libc/src/unix/bsd/mod.rs
@@ -180,17 +180,35 @@ pub const SIG_SETMASK: ::c_int = 3;
pub const SIG_BLOCK: ::c_int = 0x1;
pub const SIG_UNBLOCK: ::c_int = 0x2;
+pub const IP_MULTICAST_IF: ::c_int = 9;
+pub const IP_MULTICAST_TTL: ::c_int = 10;
+pub const IP_MULTICAST_LOOP: ::c_int = 11;
+
pub const IPV6_MULTICAST_LOOP: ::c_int = 11;
pub const IPV6_V6ONLY: ::c_int = 27;
pub const ST_RDONLY: ::c_ulong = 1;
+pub const SCM_RIGHTS: ::c_int = 0x01;
+
pub const NCCS: usize = 20;
+pub const O_ACCMODE: ::c_int = 0x3;
+pub const O_RDONLY: ::c_int = 0;
+pub const O_WRONLY: ::c_int = 1;
+pub const O_RDWR: ::c_int = 2;
+pub const O_APPEND: ::c_int = 8;
+pub const O_CREAT: ::c_int = 512;
+pub const O_TRUNC: ::c_int = 1024;
+pub const O_EXCL: ::c_int = 2048;
pub const O_ASYNC: ::c_int = 0x40;
-pub const O_FSYNC: ::c_int = 0x80;
-pub const O_NDELAY: ::c_int = 0x4;
+pub const O_SYNC: ::c_int = 0x80;
+pub const O_NONBLOCK: ::c_int = 0x4;
pub const O_NOFOLLOW: ::c_int = 0x100;
+pub const O_SHLOCK: ::c_int = 0x10;
+pub const O_EXLOCK: ::c_int = 0x20;
+pub const O_FSYNC: ::c_int = O_SYNC;
+pub const O_NDELAY: ::c_int = O_NONBLOCK;
pub const F_GETOWN: ::c_int = 5;
pub const F_SETOWN: ::c_int = 6;
@@ -221,12 +239,15 @@ pub const VREPRINT: usize = 6;
pub const VINTR: usize = 8;
pub const VQUIT: usize = 9;
pub const VSUSP: usize = 10;
+pub const VDSUSP: usize = 11;
pub const VSTART: usize = 12;
pub const VSTOP: usize = 13;
pub const VLNEXT: usize = 14;
pub const VDISCARD: usize = 15;
pub const VMIN: usize = 16;
pub const VTIME: usize = 17;
+pub const VSTATUS: usize = 18;
+pub const _POSIX_VDISABLE: ::cc_t = 0xff;
pub const IGNBRK: ::tcflag_t = 0x00000001;
pub const BRKINT: ::tcflag_t = 0x00000002;
pub const IGNPAR: ::tcflag_t = 0x00000004;
@@ -244,6 +265,7 @@ pub const OPOST: ::tcflag_t = 0x1;
pub const ONLCR: ::tcflag_t = 0x2;
pub const OXTABS: ::tcflag_t = 0x4;
pub const ONOEOT: ::tcflag_t = 0x8;
+pub const CIGNORE: ::tcflag_t = 0x00000001;
pub const CSIZE: ::tcflag_t = 0x00000300;
pub const CS5: ::tcflag_t = 0x00000000;
pub const CS6: ::tcflag_t = 0x00000100;
@@ -264,12 +286,15 @@ pub const ECHOPRT: ::tcflag_t = 0x00000020;
pub const ECHOCTL: ::tcflag_t = 0x00000040;
pub const ISIG: ::tcflag_t = 0x00000080;
pub const ICANON: ::tcflag_t = 0x00000100;
+pub const ALTWERASE: ::tcflag_t = 0x00000200;
pub const IEXTEN: ::tcflag_t = 0x00000400;
pub const EXTPROC: ::tcflag_t = 0x00000800;
pub const TOSTOP: ::tcflag_t = 0x00400000;
pub const FLUSHO: ::tcflag_t = 0x00800000;
+pub const NOKERNINFO: ::tcflag_t = 0x02000000;
pub const PENDIN: ::tcflag_t = 0x20000000;
pub const NOFLSH: ::tcflag_t = 0x80000000;
+pub const MDMBUF: ::tcflag_t = 0x00100000;
pub const WNOHANG: ::c_int = 0x00000001;
pub const WUNTRACED: ::c_int = 0x00000002;
@@ -284,8 +309,15 @@ pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
pub const LOG_FTP: ::c_int = 11 << 3;
pub const LOG_PERROR: ::c_int = 0x20;
+pub const TCP_MAXSEG: ::c_int = 2;
+
pub const PIPE_BUF: usize = 512;
+pub const POLLRDNORM: ::c_short = 0x040;
+pub const POLLWRNORM: ::c_short = 0x004;
+pub const POLLRDBAND: ::c_short = 0x080;
+pub const POLLWRBAND: ::c_short = 0x100;
+
f! {
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
@@ -339,21 +371,10 @@ extern {
pub fn kqueue() -> ::c_int;
pub fn unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int;
pub fn syscall(num: ::c_int, ...) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
- pub fn getpwnam_r(name: *const ::c_char,
- pwd: *mut passwd,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut passwd) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
- pub fn getpwuid_r(uid: ::uid_t,
- pwd: *mut passwd,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut passwd) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__getpwent50")]
pub fn getpwent() -> *mut passwd;
pub fn setpwent();
+ pub fn endpwent();
pub fn getprogname() -> *const ::c_char;
pub fn setprogname(name: *const ::c_char);
pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
@@ -432,6 +453,69 @@ extern {
link_name = "recvmsg$UNIX2003")]
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
-> ::ssize_t;
+
+ pub fn sync();
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
+ pub fn getgrgid_r(uid: ::uid_t,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "sigaltstack$UNIX2003")]
+ #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
+ pub fn sigaltstack(ss: *const stack_t,
+ oss: *mut stack_t) -> ::c_int;
+ pub fn sem_close(sem: *mut sem_t) -> ::c_int;
+ pub fn getdtablesize() -> ::c_int;
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
+ pub fn getgrnam_r(name: *const ::c_char,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_sigmask$UNIX2003")]
+ pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
+ oldset: *mut sigset_t) -> ::c_int;
+ pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
+ pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+ pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+ pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
+ pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
+ pub fn getpwnam_r(name: *const ::c_char,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
+ pub fn getpwuid_r(uid: ::uid_t,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
+ link_name = "sigwait$UNIX2003")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+ pub fn sigwait(set: *const sigset_t,
+ sig: *mut ::c_int) -> ::c_int;
+ pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+ parent: Option<unsafe extern fn()>,
+ child: Option<unsafe extern fn()>) -> ::c_int;
+ pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "popen$UNIX2003")]
+ pub fn popen(command: *const c_char,
+ mode: *const c_char) -> *mut ::FILE;
+ pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
+ mode: ::c_int, flags: ::c_int) -> ::c_int;
+ pub fn pthread_create(native: *mut ::pthread_t,
+ attr: *const ::pthread_attr_t,
+ f: extern fn(*mut ::c_void) -> *mut ::c_void,
+ value: *mut ::c_void) -> ::c_int;
}
cfg_if! {
diff --git a/libc/src/unix/bsd/netbsdlike/mod.rs b/libc/src/unix/bsd/netbsdlike/mod.rs
index 1471e6f..e43f2ab 100644
--- a/libc/src/unix/bsd/netbsdlike/mod.rs
+++ b/libc/src/unix/bsd/netbsdlike/mod.rs
@@ -127,16 +127,7 @@ pub const BUFSIZ : ::c_uint = 1024;
pub const FOPEN_MAX : ::c_uint = 20;
pub const FILENAME_MAX : ::c_uint = 1024;
pub const L_tmpnam : ::c_uint = 1024;
-pub const O_RDONLY : ::c_int = 0;
-pub const O_WRONLY : ::c_int = 1;
-pub const O_RDWR : ::c_int = 2;
-pub const O_ACCMODE : ::c_int = 3;
-pub const O_APPEND : ::c_int = 8;
-pub const O_CREAT : ::c_int = 512;
-pub const O_EXCL : ::c_int = 2048;
pub const O_NOCTTY : ::c_int = 32768;
-pub const O_TRUNC : ::c_int = 1024;
-pub const O_SYNC : ::c_int = 128;
pub const S_IFIFO : mode_t = 4096;
pub const S_IFCHR : mode_t = 8192;
pub const S_IFBLK : mode_t = 24576;
@@ -316,8 +307,6 @@ pub const POSIX_MADV_SEQUENTIAL : ::c_int = 2;
pub const POSIX_MADV_WILLNEED : ::c_int = 3;
pub const POSIX_MADV_DONTNEED : ::c_int = 4;
-pub const _SC_XOPEN_SHM : ::c_int = 30;
-
pub const PTHREAD_CREATE_JOINABLE : ::c_int = 0;
pub const PTHREAD_CREATE_DETACHED : ::c_int = 1;
@@ -329,8 +318,8 @@ pub const PTHREAD_CREATE_DETACHED : ::c_int = 1;
// http://netbsd.gw.com/cgi-bin/man-cgi?clock_gettime
// https://github.com/jsonn/src/blob/HEAD/sys/kern/subr_time.c#L222
// Basically the same goes for NetBSD
-pub const CLOCK_REALTIME: clockid_t = 0;
-pub const CLOCK_MONOTONIC: clockid_t = 3;
+pub const CLOCK_REALTIME: ::clockid_t = 0;
+pub const CLOCK_MONOTONIC: ::clockid_t = 3;
pub const RLIMIT_CPU: ::c_int = 0;
pub const RLIMIT_FSIZE: ::c_int = 1;
@@ -418,14 +407,8 @@ pub const PF_NATM: ::c_int = AF_NATM;
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
pub const SOCK_RAW: ::c_int = 3;
+pub const SOCK_RDM: ::c_int = 4;
pub const SOCK_SEQPACKET: ::c_int = 5;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-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;
@@ -465,8 +448,6 @@ pub const MSG_MCAST: ::c_int = 0x200;
pub const MSG_NOSIGNAL: ::c_int = 0x400;
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x800;
-pub const SCM_RIGHTS: ::c_int = 0x01;
-
pub const IFF_LOOPBACK: ::c_int = 0x8;
pub const SHUT_RD: ::c_int = 0;
@@ -478,8 +459,6 @@ pub const LOCK_EX: ::c_int = 2;
pub const LOCK_NB: ::c_int = 4;
pub const LOCK_UN: ::c_int = 8;
-pub const O_NONBLOCK : ::c_int = 4;
-
pub const IPPROTO_RAW : ::c_int = 255;
pub const _SC_ARG_MAX : ::c_int = 1;
@@ -511,6 +490,7 @@ pub const _SC_TZNAME_MAX : ::c_int = 27;
pub const _SC_PAGESIZE : ::c_int = 28;
pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
pub const _SC_FSYNC : ::c_int = 29;
+pub const _SC_XOPEN_SHM : ::c_int = 30;
pub const Q_GETQUOTA: ::c_int = 0x300;
pub const Q_SETQUOTA: ::c_int = 0x400;
@@ -549,6 +529,23 @@ pub const EXTB: speed_t = 38400;
pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
+pub const CRTSCTS: ::tcflag_t = 0x00010000;
+pub const CRTS_IFLOW: ::tcflag_t = CRTSCTS;
+pub const CCTS_OFLOW: ::tcflag_t = CRTSCTS;
+pub const OCRNL: ::tcflag_t = 0x10;
+
+pub const TIOCM_LE: ::c_int = 0o0001;
+pub const TIOCM_DTR: ::c_int = 0o0002;
+pub const TIOCM_RTS: ::c_int = 0o0004;
+pub const TIOCM_ST: ::c_int = 0o0010;
+pub const TIOCM_SR: ::c_int = 0o0020;
+pub const TIOCM_CTS: ::c_int = 0o0040;
+pub const TIOCM_CAR: ::c_int = 0o0100;
+pub const TIOCM_RNG: ::c_int = 0o0200;
+pub const TIOCM_DSR: ::c_int = 0o0400;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+
f! {
pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
status >> 8
@@ -568,11 +565,11 @@ extern {
pub fn mincore(addr: *mut ::c_void, len: ::size_t,
vec: *mut ::c_char) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__clock_getres50")]
- pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__clock_gettime50")]
- pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__clock_settime50")]
- pub fn clock_settime(clk_id: clockid_t, tp: *const ::timespec) -> ::c_int;
+ pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
pub fn __errno() -> *mut ::c_int;
pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t)
-> ::c_int;
@@ -583,6 +580,14 @@ extern {
pub fn mkostemps(template: *mut ::c_char,
suffixlen: ::c_int,
flags: ::c_int) -> ::c_int;
+ pub fn pwritev(fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t) -> ::ssize_t;
+ pub fn preadv(fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t) -> ::ssize_t;
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
pub fn fdatasync(fd: ::c_int) -> ::c_int;
pub fn openpty(amaster: *mut ::c_int,
@@ -606,11 +611,20 @@ extern {
pub fn sem_timedwait(sem: *mut sem_t,
abstime: *const ::timespec) -> ::c_int;
pub fn pthread_condattr_setclock(attr: *mut pthread_condattr_t,
- clock_id: clockid_t) -> ::c_int;
+ 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;
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
+
+ pub fn getgrouplist(name: *const ::c_char,
+ basegid: ::gid_t,
+ groups: *mut ::gid_t,
+ ngroups: *mut ::c_int) -> ::c_int;
+ pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
+ pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
+ envp: *const *const ::c_char)
+ -> ::c_int;
}
cfg_if! {
diff --git a/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs b/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
index ffe8d75..ff6dd24 100644
--- a/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -165,6 +165,11 @@ s! {
ptma_private: *mut ::c_void,
}
+ pub struct pthread_rwlockattr_t {
+ ptra_magic: ::c_uint,
+ ptra_private: *mut ::c_void,
+ }
+
pub struct pthread_cond_t {
ptc_magic: ::c_uint,
ptc_lock: ::c_uchar,
@@ -244,6 +249,38 @@ s! {
pub int_p_sign_posn: ::c_char,
pub int_n_sign_posn: ::c_char,
}
+
+ pub struct if_data {
+ pub ifi_type: ::c_uchar,
+ pub ifi_addrlen: ::c_uchar,
+ pub ifi_hdrlen: ::c_uchar,
+ pub ifi_link_state: ::c_int,
+ pub ifi_mtu: u64,
+ pub ifi_metric: u64,
+ pub ifi_baudrate: u64,
+ pub ifi_ipackets: u64,
+ pub ifi_ierrors: u64,
+ pub ifi_opackets: u64,
+ pub ifi_oerrors: u64,
+ pub ifi_collisions: u64,
+ pub ifi_ibytes: u64,
+ pub ifi_obytes: u64,
+ pub ifi_imcasts: u64,
+ pub ifi_omcasts: u64,
+ pub ifi_iqdrops: u64,
+ pub ifi_noproto: u64,
+ pub ifi_lastchange: ::timespec,
+ }
+
+ pub struct if_msghdr {
+ pub ifm_msglen: ::c_ushort,
+ pub ifm_version: ::c_uchar,
+ pub ifm_type: ::c_uchar,
+ pub ifm_addrs: ::c_int,
+ pub ifm_flags: ::c_int,
+ pub ifm_index: ::c_ushort,
+ pub ifm_data: if_data,
+ }
}
pub const AT_FDCWD: ::c_int = -100;
@@ -270,9 +307,9 @@ pub const O_CLOEXEC: ::c_int = 0x400000;
pub const O_ALT_IO: ::c_int = 0x40000;
pub const O_NOSIGPIPE: ::c_int = 0x1000000;
pub const O_SEARCH: ::c_int = 0x800000;
-pub const O_EXLOCK: ::c_int = 0x20;
-pub const O_SHLOCK: ::c_int = 0x10;
pub const O_DIRECTORY: ::c_int = 0x200000;
+pub const O_DIRECT : ::c_int = 0x00080000;
+pub const O_RSYNC : ::c_int = 0x00020000;
pub const MS_SYNC : ::c_int = 0x4;
pub const MS_INVALIDATE : ::c_int = 0x2;
@@ -349,42 +386,91 @@ pub const MAP_NORESERVE : ::c_int = 0x40;
pub const MAP_HASSEMAPHORE : ::c_int = 0x200;
pub const MAP_WIRED: ::c_int = 0x800;
+pub const _PC_LINK_MAX : ::c_int = 1;
+pub const _PC_MAX_CANON : ::c_int = 2;
+pub const _PC_MAX_INPUT : ::c_int = 3;
+pub const _PC_NAME_MAX : ::c_int = 4;
+pub const _PC_PATH_MAX : ::c_int = 5;
+pub const _PC_PIPE_BUF : ::c_int = 6;
+pub const _PC_CHOWN_RESTRICTED : ::c_int = 7;
+pub const _PC_NO_TRUNC : ::c_int = 8;
+pub const _PC_VDISABLE : ::c_int = 9;
+pub const _PC_SYNC_IO : ::c_int = 10;
+pub const _PC_FILESIZEBITS : ::c_int = 11;
+pub const _PC_SYMLINK_MAX : ::c_int = 12;
+pub const _PC_2_SYMLINKS : ::c_int = 13;
+pub const _PC_ACL_EXTENDED : ::c_int = 14;
+pub const _PC_MIN_HOLE_SIZE : ::c_int = 15;
+
+pub const _SC_SYNCHRONIZED_IO : ::c_int = 31;
pub const _SC_IOV_MAX : ::c_int = 32;
+pub const _SC_MAPPED_FILES : ::c_int = 33;
+pub const _SC_MEMLOCK : ::c_int = 34;
+pub const _SC_MEMLOCK_RANGE : ::c_int = 35;
+pub const _SC_MEMORY_PROTECTION : ::c_int = 36;
+pub const _SC_LOGIN_NAME_MAX : ::c_int = 37;
+pub const _SC_MONOTONIC_CLOCK : ::c_int = 38;
+pub const _SC_CLK_TCK : ::c_int = 39;
+pub const _SC_ATEXIT_MAX : ::c_int = 40;
+pub const _SC_THREADS : ::c_int = 41;
+pub const _SC_SEMAPHORES : ::c_int = 42;
+pub const _SC_BARRIERS : ::c_int = 43;
+pub const _SC_TIMERS : ::c_int = 44;
+pub const _SC_SPIN_LOCKS : ::c_int = 45;
+pub const _SC_READER_WRITER_LOCKS : ::c_int = 46;
pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 47;
pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 48;
-pub const _SC_LOGIN_NAME_MAX : ::c_int = 37;
+pub const _SC_CLOCK_SELECTION : ::c_int = 49;
+pub const _SC_ASYNCHRONOUS_IO : ::c_int = 50;
+pub const _SC_AIO_LISTIO_MAX : ::c_int = 51;
+pub const _SC_AIO_MAX : ::c_int = 52;
+pub const _SC_MESSAGE_PASSING : ::c_int = 53;
+pub const _SC_MQ_OPEN_MAX : ::c_int = 54;
pub const _SC_MQ_PRIO_MAX : ::c_int = 55;
-pub const _SC_NPROCESSORS_ONLN : ::c_int = 1002;
-pub const _SC_THREADS : ::c_int = 41;
-pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 61;
-pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 62;
+pub const _SC_PRIORITY_SCHEDULING : ::c_int = 56;
pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 57;
pub const _SC_THREAD_KEYS_MAX : ::c_int = 58;
+pub const _SC_THREAD_STACK_MIN : ::c_int = 59;
+pub const _SC_THREAD_THREADS_MAX : ::c_int = 60;
+pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 61;
+pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 62;
+pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 63;
pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 64;
pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 65;
-pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 63;
pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 66;
pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 67;
-pub const _SC_THREAD_STACK_MIN : ::c_int = 59;
-pub const _SC_THREAD_THREADS_MAX : ::c_int = 60;
pub const _SC_TTY_NAME_MAX : ::c_int = 68;
-pub const _SC_ATEXIT_MAX : ::c_int = 40;
-pub const _SC_CLK_TCK : ::c_int = 39;
-pub const _SC_AIO_LISTIO_MAX : ::c_int = 51;
-pub const _SC_AIO_MAX : ::c_int = 52;
-pub const _SC_ASYNCHRONOUS_IO : ::c_int = 50;
-pub const _SC_MAPPED_FILES : ::c_int = 33;
-pub const _SC_MEMLOCK : ::c_int = 34;
-pub const _SC_MEMLOCK_RANGE : ::c_int = 35;
-pub const _SC_MEMORY_PROTECTION : ::c_int = 36;
-pub const _SC_MESSAGE_PASSING : ::c_int = 53;
-pub const _SC_MQ_OPEN_MAX : ::c_int = 54;
-pub const _SC_PRIORITY_SCHEDULING : ::c_int = 56;
-pub const _SC_SEMAPHORES : ::c_int = 42;
-pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 87;
-pub const _SC_SYNCHRONIZED_IO : ::c_int = 31;
-pub const _SC_TIMERS : ::c_int = 44;
pub const _SC_HOST_NAME_MAX : ::c_int = 69;
+pub const _SC_PASS_MAX : ::c_int = 70;
+pub const _SC_REGEXP : ::c_int = 71;
+pub const _SC_SHELL : ::c_int = 72;
+pub const _SC_SYMLOOP_MAX : ::c_int = 73;
+pub const _SC_V6_ILP32_OFF32 : ::c_int = 74;
+pub const _SC_V6_ILP32_OFFBIG : ::c_int = 75;
+pub const _SC_V6_LP64_OFF64 : ::c_int = 76;
+pub const _SC_V6_LPBIG_OFFBIG : ::c_int = 77;
+pub const _SC_2_PBS : ::c_int = 80;
+pub const _SC_2_PBS_ACCOUNTING : ::c_int = 81;
+pub const _SC_2_PBS_CHECKPOINT : ::c_int = 82;
+pub const _SC_2_PBS_LOCATE : ::c_int = 83;
+pub const _SC_2_PBS_MESSAGE : ::c_int = 84;
+pub const _SC_2_PBS_TRACK : ::c_int = 85;
+pub const _SC_SPAWN : ::c_int = 86;
+pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 87;
+pub const _SC_TIMER_MAX : ::c_int = 88;
+pub const _SC_SEM_NSEMS_MAX : ::c_int = 89;
+pub const _SC_CPUTIME : ::c_int = 90;
+pub const _SC_THREAD_CPUTIME : ::c_int = 91;
+pub const _SC_DELAYTIMER_MAX : ::c_int = 92;
+// These two variables will be supported in NetBSD 8.0
+// pub const _SC_SIGQUEUE_MAX : ::c_int = 93;
+// pub const _SC_REALTIME_SIGNALS : ::c_int = 94;
+pub const _SC_PHYS_PAGES : ::c_int = 121;
+pub const _SC_NPROCESSORS_CONF : ::c_int = 1001;
+pub const _SC_NPROCESSORS_ONLN : ::c_int = 1002;
+pub const _SC_SCHED_RT_TS : ::c_int = 2001;
+pub const _SC_SCHED_PRI_MIN : ::c_int = 2002;
+pub const _SC_SCHED_PRI_MAX : ::c_int = 2003;
pub const FD_SETSIZE: usize = 0x100;
@@ -463,8 +549,6 @@ pub const NOTE_TRACK: ::uint32_t = 0x00000001;
pub const NOTE_TRACKERR: ::uint32_t = 0x00000002;
pub const NOTE_CHILD: ::uint32_t = 0x00000004;
-pub const CRTSCTS: ::tcflag_t = 0x00010000;
-
pub const TMP_MAX : ::c_uint = 308915776;
pub const NI_MAXHOST: ::socklen_t = 1025;
@@ -644,6 +728,27 @@ pub const P_PGID: idtype_t = 4;
pub const B460800: ::speed_t = 460800;
pub const B921600: ::speed_t = 921600;
+pub const ONOCR: ::tcflag_t = 0x20;
+pub const ONLRET: ::tcflag_t = 0x40;
+pub const CDTRCTS: ::tcflag_t = 0x00020000;
+pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS | ::CDTRCTS;
+
+pub const SOCK_CLOEXEC: ::c_int = 0x10000000;
+pub const SOCK_NONBLOCK: ::c_int = 0x20000000;
+
+// dirfd() is a macro on netbsd to access
+// the first field of the struct where dirp points to:
+// http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36
+f! {
+ pub fn dirfd(dirp: *mut ::DIR) -> ::c_int {
+ unsafe { *(dirp as *const ::c_int) }
+ }
+
+ pub fn WIFCONTINUED(status: ::c_int) -> bool {
+ status == 0xffff
+ }
+}
+
extern {
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
@@ -693,7 +798,7 @@ extern {
flags: ::c_int,
data: *mut ::c_void,
size: ::size_t) -> ::c_int;
- pub fn ptrace(requeset: ::c_int,
+ pub fn ptrace(request: ::c_int,
pid: ::pid_t,
addr: *mut ::c_void,
data: ::c_int) -> ::c_int;
@@ -719,6 +824,8 @@ extern {
pub fn newlocale(mask: ::c_int,
locale: *const ::c_char,
base: ::locale_t) -> ::locale_t;
+ #[link_name = "__settimeofday50"]
+ pub fn settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int;
}
mod other;
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
index b0d8128..37c7708 100644
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
+++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs
@@ -1,3 +1,5 @@
+use unix::bsd::O_SYNC;
+
pub type clock_t = i64;
pub type suseconds_t = ::c_long;
pub type dev_t = i32;
@@ -11,6 +13,7 @@ pub type pthread_mutexattr_t = *mut ::c_void;
pub type pthread_cond_t = *mut ::c_void;
pub type pthread_condattr_t = *mut ::c_void;
pub type pthread_rwlock_t = *mut ::c_void;
+pub type pthread_rwlockattr_t = *mut ::c_void;
s! {
pub struct dirent {
@@ -133,6 +136,46 @@ s! {
pub ut_host: [::c_char; UT_HOSTSIZE],
pub ut_time: ::time_t,
}
+
+ pub struct if_data {
+ pub ifi_type: ::c_uchar,
+ pub ifi_addrlen: ::c_uchar,
+ pub ifi_hdrlen: ::c_uchar,
+ pub ifi_link_state: ::c_uchar,
+ pub ifi_mtu: u32,
+ pub ifi_metric: u32,
+ pub ifi_rdomain: u32,
+ pub ifi_baudrate: u64,
+ pub ifi_ipackets: u64,
+ pub ifi_ierrors: u64,
+ pub ifi_opackets: u64,
+ pub ifi_oerrors: u64,
+ pub ifi_collisions: u64,
+ pub ifi_ibytes: u64,
+ pub ifi_obytes: u64,
+ pub ifi_imcasts: u64,
+ pub ifi_omcasts: u64,
+ pub ifi_iqdrops: u64,
+ pub ifi_oqdrops: u64,
+ pub ifi_noproto: u64,
+ pub ifi_capabilities: u32,
+ pub ifi_lastchange: ::timeval,
+ }
+
+ pub struct if_msghdr {
+ pub ifm_msglen: ::c_ushort,
+ pub ifm_version: ::c_uchar,
+ pub ifm_type: ::c_uchar,
+ pub ifm_hdrlen: ::c_ushort,
+ pub ifm_index: ::c_ushort,
+ pub ifm_tableid: ::c_ushort,
+ pub ifm_pad1: ::c_uchar,
+ pub ifm_pad2: ::c_uchar,
+ pub ifm_addrs: ::c_int,
+ pub ifm_flags: ::c_int,
+ pub ifm_xflags: ::c_int,
+ pub ifm_data: if_data,
+ }
}
pub const UT_NAMESIZE: usize = 32;
@@ -140,12 +183,16 @@ pub const UT_LINESIZE: usize = 8;
pub const UT_HOSTSIZE: usize = 256;
pub const O_CLOEXEC: ::c_int = 0x10000;
+pub const O_DIRECTORY: ::c_int = 0x20000;
+pub const O_RSYNC: ::c_int = O_SYNC;
pub const MS_SYNC : ::c_int = 0x0002;
pub const MS_INVALIDATE : ::c_int = 0x0004;
pub const PTHREAD_STACK_MIN : ::size_t = 2048;
+pub const POLLNORM: ::c_short = ::POLLRDNORM;
+
pub const ENOATTR : ::c_int = 83;
pub const EILSEQ : ::c_int = 84;
pub const EOVERFLOW : ::c_int = 87;
@@ -165,6 +212,7 @@ pub const AT_REMOVEDIR: ::c_int = 0x08;
pub const RLIM_NLIMITS: ::c_int = 9;
+pub const SO_TIMESTAMP: ::c_int = 0x0800;
pub const SO_SNDTIMEO: ::c_int = 0x1005;
pub const SO_RCVTIMEO: ::c_int = 0x1006;
pub const SO_BINDANY: ::c_int = 0x1000;
@@ -232,58 +280,128 @@ pub const RUSAGE_THREAD: ::c_int = 1;
pub const MAP_COPY : ::c_int = 0x0002;
pub const MAP_NOEXTEND : ::c_int = 0x0000;
+pub const _PC_LINK_MAX : ::c_int = 1;
+pub const _PC_MAX_CANON : ::c_int = 2;
+pub const _PC_MAX_INPUT : ::c_int = 3;
+pub const _PC_NAME_MAX : ::c_int = 4;
+pub const _PC_PATH_MAX : ::c_int = 5;
+pub const _PC_PIPE_BUF : ::c_int = 6;
+pub const _PC_CHOWN_RESTRICTED : ::c_int = 7;
+pub const _PC_NO_TRUNC : ::c_int = 8;
+pub const _PC_VDISABLE : ::c_int = 9;
+pub const _PC_2_SYMLINKS : ::c_int = 10;
+pub const _PC_ALLOC_SIZE_MIN : ::c_int = 11;
+pub const _PC_ASYNC_IO : ::c_int = 12;
+pub const _PC_FILESIZEBITS : ::c_int = 13;
+pub const _PC_PRIO_IO : ::c_int = 14;
+pub const _PC_REC_INCR_XFER_SIZE : ::c_int = 15;
+pub const _PC_REC_MAX_XFER_SIZE : ::c_int = 16;
+pub const _PC_REC_MIN_XFER_SIZE : ::c_int = 17;
+pub const _PC_REC_XFER_ALIGN : ::c_int = 18;
+pub const _PC_SYMLINK_MAX : ::c_int = 19;
+pub const _PC_SYNC_IO : ::c_int = 20;
+pub const _PC_TIMESTAMP_RESOLUTION : ::c_int = 21;
+
pub const _SC_CLK_TCK : ::c_int = 3;
-pub const _SC_IOV_MAX : ::c_int = 51;
-pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 100;
-pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 101;
-pub const _SC_LOGIN_NAME_MAX : ::c_int = 102;
-pub const _SC_MQ_PRIO_MAX : ::c_int = 59;
-pub const _SC_NPROCESSORS_ONLN : ::c_int = 503;
-pub const _SC_THREADS : ::c_int = 91;
-pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 77;
-pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 78;
-pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 80;
-pub const _SC_THREAD_KEYS_MAX : ::c_int = 81;
-pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 82;
-pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 83;
-pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 84;
-pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 85;
-pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 103;
-pub const _SC_THREAD_STACK_MIN : ::c_int = 89;
-pub const _SC_THREAD_THREADS_MAX : ::c_int = 90;
-pub const _SC_TTY_NAME_MAX : ::c_int = 107;
-pub const _SC_ATEXIT_MAX : ::c_int = 46;
+pub const _SC_SEM_NSEMS_MAX : ::c_int = 31;
+pub const _SC_SEM_VALUE_MAX : ::c_int = 32;
+pub const _SC_HOST_NAME_MAX : ::c_int = 33;
+pub const _SC_MONOTONIC_CLOCK : ::c_int = 34;
+pub const _SC_2_PBS : ::c_int = 35;
+pub const _SC_2_PBS_ACCOUNTING : ::c_int = 36;
+pub const _SC_2_PBS_CHECKPOINT : ::c_int = 37;
+pub const _SC_2_PBS_LOCATE : ::c_int = 38;
+pub const _SC_2_PBS_MESSAGE : ::c_int = 39;
+pub const _SC_2_PBS_TRACK : ::c_int = 40;
+pub const _SC_ADVISORY_INFO : ::c_int = 41;
pub const _SC_AIO_LISTIO_MAX : ::c_int = 42;
pub const _SC_AIO_MAX : ::c_int = 43;
+pub const _SC_AIO_PRIO_DELTA_MAX : ::c_int = 44;
pub const _SC_ASYNCHRONOUS_IO : ::c_int = 45;
+pub const _SC_ATEXIT_MAX : ::c_int = 46;
+pub const _SC_BARRIERS : ::c_int = 47;
+pub const _SC_CLOCK_SELECTION : ::c_int = 48;
+pub const _SC_CPUTIME : ::c_int = 49;
+pub const _SC_DELAYTIMER_MAX : ::c_int = 50;
+pub const _SC_IOV_MAX : ::c_int = 51;
+pub const _SC_IPV6 : ::c_int = 52;
pub const _SC_MAPPED_FILES : ::c_int = 53;
pub const _SC_MEMLOCK : ::c_int = 54;
pub const _SC_MEMLOCK_RANGE : ::c_int = 55;
pub const _SC_MEMORY_PROTECTION : ::c_int = 56;
pub const _SC_MESSAGE_PASSING : ::c_int = 57;
pub const _SC_MQ_OPEN_MAX : ::c_int = 58;
+pub const _SC_MQ_PRIO_MAX : ::c_int = 59;
+pub const _SC_PRIORITIZED_IO : ::c_int = 60;
pub const _SC_PRIORITY_SCHEDULING : ::c_int = 61;
+pub const _SC_RAW_SOCKETS : ::c_int = 62;
+pub const _SC_READER_WRITER_LOCKS : ::c_int = 63;
+pub const _SC_REALTIME_SIGNALS : ::c_int = 64;
+pub const _SC_REGEXP : ::c_int = 65;
+pub const _SC_RTSIG_MAX : ::c_int = 66;
pub const _SC_SEMAPHORES : ::c_int = 67;
pub const _SC_SHARED_MEMORY_OBJECTS : ::c_int = 68;
+pub const _SC_SHELL : ::c_int = 69;
+pub const _SC_SIGQUEUE_MAX : ::c_int = 70;
+pub const _SC_SPAWN : ::c_int = 71;
+pub const _SC_SPIN_LOCKS : ::c_int = 72;
+pub const _SC_SPORADIC_SERVER : ::c_int = 73;
+pub const _SC_SS_REPL_MAX : ::c_int = 74;
pub const _SC_SYNCHRONIZED_IO : ::c_int = 75;
+pub const _SC_SYMLOOP_MAX : ::c_int = 76;
+pub const _SC_THREAD_ATTR_STACKADDR : ::c_int = 77;
+pub const _SC_THREAD_ATTR_STACKSIZE : ::c_int = 78;
+pub const _SC_THREAD_CPUTIME : ::c_int = 79;
+pub const _SC_THREAD_DESTRUCTOR_ITERATIONS : ::c_int = 80;
+pub const _SC_THREAD_KEYS_MAX : ::c_int = 81;
+pub const _SC_THREAD_PRIO_INHERIT : ::c_int = 82;
+pub const _SC_THREAD_PRIO_PROTECT : ::c_int = 83;
+pub const _SC_THREAD_PRIORITY_SCHEDULING : ::c_int = 84;
+pub const _SC_THREAD_PROCESS_SHARED : ::c_int = 85;
+pub const _SC_THREAD_ROBUST_PRIO_INHERIT : ::c_int = 86;
+pub const _SC_THREAD_ROBUST_PRIO_PROTECT : ::c_int = 87;
+pub const _SC_THREAD_SPORADIC_SERVER : ::c_int = 88;
+pub const _SC_THREAD_STACK_MIN : ::c_int = 89;
+pub const _SC_THREAD_THREADS_MAX : ::c_int = 90;
+pub const _SC_THREADS : ::c_int = 91;
+pub const _SC_TIMEOUTS : ::c_int = 92;
+pub const _SC_TIMER_MAX : ::c_int = 93;
pub const _SC_TIMERS : ::c_int = 94;
+pub const _SC_TRACE : ::c_int = 95;
+pub const _SC_TRACE_EVENT_FILTER : ::c_int = 96;
+pub const _SC_TRACE_EVENT_NAME_MAX : ::c_int = 97;
+pub const _SC_TRACE_INHERIT : ::c_int = 98;
+pub const _SC_TRACE_LOG : ::c_int = 99;
+pub const _SC_GETGR_R_SIZE_MAX : ::c_int = 100;
+pub const _SC_GETPW_R_SIZE_MAX : ::c_int = 101;
+pub const _SC_LOGIN_NAME_MAX : ::c_int = 102;
+pub const _SC_THREAD_SAFE_FUNCTIONS : ::c_int = 103;
+pub const _SC_TRACE_NAME_MAX : ::c_int = 104;
+pub const _SC_TRACE_SYS_MAX : ::c_int = 105;
+pub const _SC_TRACE_USER_EVENT_MAX : ::c_int = 106;
+pub const _SC_TTY_NAME_MAX : ::c_int = 107;
+pub const _SC_TYPED_MEMORY_OBJECTS : ::c_int = 108;
+pub const _SC_V6_ILP32_OFF32 : ::c_int = 109;
+pub const _SC_V6_ILP32_OFFBIG : ::c_int = 110;
+pub const _SC_V6_LP64_OFF64 : ::c_int = 111;
+pub const _SC_V6_LPBIG_OFFBIG : ::c_int = 112;
+pub const _SC_V7_ILP32_OFF32 : ::c_int = 113;
+pub const _SC_V7_ILP32_OFFBIG : ::c_int = 114;
+pub const _SC_V7_LP64_OFF64 : ::c_int = 115;
+pub const _SC_V7_LPBIG_OFFBIG : ::c_int = 116;
pub const _SC_XOPEN_CRYPT : ::c_int = 117;
pub const _SC_XOPEN_ENH_I18N : ::c_int = 118;
pub const _SC_XOPEN_LEGACY : ::c_int = 119;
pub const _SC_XOPEN_REALTIME : ::c_int = 120;
pub const _SC_XOPEN_REALTIME_THREADS : ::c_int = 121;
+pub const _SC_XOPEN_STREAMS : ::c_int = 122;
pub const _SC_XOPEN_UNIX : ::c_int = 123;
+pub const _SC_XOPEN_UUCP : ::c_int = 124;
pub const _SC_XOPEN_VERSION : ::c_int = 125;
-pub const _SC_SEM_NSEMS_MAX : ::c_int = 31;
-pub const _SC_SEM_VALUE_MAX : ::c_int = 32;
-pub const _SC_AIO_PRIO_DELTA_MAX : ::c_int = 44;
-pub const _SC_DELAYTIMER_MAX : ::c_int = 50;
-pub const _SC_PRIORITIZED_IO : ::c_int = 60;
-pub const _SC_REALTIME_SIGNALS : ::c_int = 64;
-pub const _SC_RTSIG_MAX : ::c_int = 66;
-pub const _SC_SIGQUEUE_MAX : ::c_int = 70;
-pub const _SC_TIMER_MAX : ::c_int = 93;
-pub const _SC_HOST_NAME_MAX : ::c_int = 33;
+pub const _SC_PHYS_PAGES : ::c_int = 500;
+pub const _SC_AVPHYS_PAGES : ::c_int = 501;
+pub const _SC_NPROCESSORS_CONF : ::c_int = 502;
+pub const _SC_NPROCESSORS_ONLN : ::c_int = 503;
pub const FD_SETSIZE: usize = 1024;
@@ -313,6 +431,8 @@ pub const EV_ENABLE: ::uint16_t = 0x4;
pub const EV_DISABLE: ::uint16_t = 0x8;
pub const EV_ONESHOT: ::uint16_t = 0x10;
pub const EV_CLEAR: ::uint16_t = 0x20;
+pub const EV_RECEIPT: ::uint16_t = 0x40;
+pub const EV_DISPATCH: ::uint16_t = 0x80;
pub const EV_FLAG1: ::uint16_t = 0x2000;
pub const EV_ERROR: ::uint16_t = 0x4000;
pub const EV_EOF: ::uint16_t = 0x8000;
@@ -456,7 +576,23 @@ pub const KI_WMESGLEN: ::c_int = 8;
pub const KI_MAXLOGNAME: ::c_int = 32;
pub const KI_EMULNAMELEN: ::c_int = 8;
+pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS;
+pub const OLCUC: ::tcflag_t = 0x20;
+pub const ONOCR: ::tcflag_t = 0x40;
+pub const ONLRET: ::tcflag_t = 0x80;
+
+pub const SOCK_CLOEXEC: ::c_int = 0x8000;
+pub const SOCK_NONBLOCK: ::c_int = 0x4000;
+pub const SOCK_DNS: ::c_int = 0x1000;
+
+f! {
+ pub fn WIFCONTINUED(status: ::c_int) -> bool {
+ status & 0o177777 == 0o177777
+ }
+}
+
extern {
+ pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
host: *mut ::c_char,
@@ -486,6 +622,8 @@ extern {
pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
pub fn pledge(promises: *const ::c_char,
paths: *mut *const ::c_char) -> ::c_int;
+ pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
+ pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
}
cfg_if! {
diff --git a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs
index 8b36ee5..5c80447 100644
--- a/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs
+++ b/libc/src/unix/bsd/netbsdlike/openbsdlike/openbsd.rs
@@ -30,4 +30,6 @@ s! {
extern {
pub fn accept4(s: ::c_int, addr: *mut ::sockaddr,
addrlen: *mut ::socklen_t, flags: ::c_int) -> ::c_int;
+ pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char,
+ envp: *const *const ::c_char) -> ::c_int;
}
diff --git a/libc/src/unix/haiku/mod.rs b/libc/src/unix/haiku/mod.rs
index 829c225..a659f73 100644
--- a/libc/src/unix/haiku/mod.rs
+++ b/libc/src/unix/haiku/mod.rs
@@ -23,6 +23,7 @@ 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 pthread_rwlockattr_t = ::uintptr_t;
pub type sigset_t = u64;
pub type fsblkcnt_t = i64;
pub type fsfilcnt_t = i64;
@@ -331,8 +332,6 @@ 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;
@@ -401,17 +400,37 @@ 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 SIGCHLD: ::c_int = 5;
pub const SIGABRT: ::c_int = 6;
+pub const SIGPIPE: ::c_int = 7;
pub const SIGFPE: ::c_int = 8;
pub const SIGKILL: ::c_int = 9;
+pub const SIGSTOP: ::c_int = 10;
pub const SIGSEGV: ::c_int = 11;
-pub const SIGPIPE: ::c_int = 7;
+pub const SIGCONT: ::c_int = 12;
+pub const SIGTSTP: ::c_int = 13;
pub const SIGALRM: ::c_int = 14;
pub const SIGTERM: ::c_int = 15;
+pub const SIGTTIN: ::c_int = 16;
+pub const SIGTTOU: ::c_int = 17;
+pub const SIGUSR1: ::c_int = 18;
+pub const SIGUSR2: ::c_int = 19;
+pub const SIGWINCH: ::c_int = 20;
+pub const SIGKILLTHR: ::c_int = 21;
+pub const SIGTRAP: ::c_int = 22;
+pub const SIGPOLL: ::c_int = 23;
+pub const SIGPROF: ::c_int = 24;
+pub const SIGSYS: ::c_int = 25;
+pub const SIGURG: ::c_int = 26;
+pub const SIGVTALRM: ::c_int = 27;
+pub const SIGXCPU: ::c_int = 28;
+pub const SIGXFSZ: ::c_int = 29;
+pub const SIGBUS: ::c_int = 30;
pub const EAI_SYSTEM: ::c_int = 11;
@@ -536,11 +555,6 @@ 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_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-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;
@@ -642,8 +656,6 @@ 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;
@@ -686,6 +698,60 @@ pub const P_ALL: idtype_t = 0;
pub const P_PID: idtype_t = 1;
pub const P_PGID: idtype_t = 2;
+pub const VINTR: usize = 0;
+pub const VQUIT: usize = 1;
+pub const VERASE: usize = 2;
+pub const VKILL: usize = 3;
+pub const VEOF: usize = 4;
+pub const VEOL: usize = 5;
+pub const VMIN: usize = 4;
+pub const VTIME: usize = 5;
+pub const VEOL2: usize = 6;
+pub const VSWTCH: usize = 7;
+pub const VSTART: usize = 8;
+pub const VSTOP: usize = 9;
+pub const VSUSP: usize = 10;
+pub const OLCUC: ::tcflag_t = 0o000002;
+pub const OCRNL: ::tcflag_t = 0o000010;
+pub const ONOCR: ::tcflag_t = 0o000020;
+pub const ONLRET: ::tcflag_t = 0o000040;
+pub const OFILL: ::tcflag_t = 0o000100;
+pub const OFDEL: ::tcflag_t = 0o000200;
+pub const NLDLY: ::tcflag_t = 0o000400;
+pub const NL0: ::tcflag_t = 0o000000;
+pub const NL1: ::tcflag_t = 0o000400;
+pub const CRDLY: ::tcflag_t = 0o003000;
+pub const CR0: ::tcflag_t = 0o000000;
+pub const CR1: ::tcflag_t = 0o001000;
+pub const CR2: ::tcflag_t = 0o002000;
+pub const CR3: ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const TAB0: ::tcflag_t = 0o000000;
+pub const TAB1: ::tcflag_t = 0o004000;
+pub const TAB2: ::tcflag_t = 0o010000;
+pub const TAB3: ::tcflag_t = 0o014000;
+pub const BSDLY: ::tcflag_t = 0o020000;
+pub const BS0: ::tcflag_t = 0o000000;
+pub const BS1: ::tcflag_t = 0o020000;
+pub const FFDLY: ::tcflag_t = 0o100000;
+pub const FF0: ::tcflag_t = 0o000000;
+pub const FF1: ::tcflag_t = 0o100000;
+pub const VTDLY: ::tcflag_t = 0o040000;
+pub const VT0: ::tcflag_t = 0o000000;
+pub const VT1: ::tcflag_t = 0o040000;
+
+pub const TCGB_CTS: ::c_int = 0x01;
+pub const TCGB_DSR: ::c_int = 0x02;
+pub const TCGB_RI: ::c_int = 0x04;
+pub const TCGB_DCD: ::c_int = 0x08;
+pub const TIOCM_CTS: ::c_int = TCGB_CTS;
+pub const TIOCM_CD: ::c_int = TCGB_DCD;
+pub const TIOCM_CAR: ::c_int = TIOCM_CD;
+pub const TIOCM_RI: ::c_int = TCGB_RI;
+pub const TIOCM_DSR: ::c_int = TCGB_DSR;
+pub const TIOCM_DTR: ::c_int = 0x10;
+pub const TIOCM_RTS: ::c_int = 0x20;
+
f! {
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
let fd = fd as usize;
@@ -737,18 +803,14 @@ extern {
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;
+ 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 dirfd(dirp: *mut ::DIR) -> ::c_int;
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
host: *mut ::c_char,
@@ -804,6 +866,63 @@ extern {
flags: ::c_int) -> ::ssize_t;
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
-> ::ssize_t;
+ pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char,
+ environment: *const *const ::c_char) -> ::c_int;
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
+ pub fn getgrgid_r(uid: ::uid_t,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "sigaltstack$UNIX2003")]
+ #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
+ pub fn sigaltstack(ss: *const stack_t,
+ oss: *mut stack_t) -> ::c_int;
+ pub fn sem_close(sem: *mut sem_t) -> ::c_int;
+ pub fn getdtablesize() -> ::c_int;
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
+ pub fn getgrnam_r(name: *const ::c_char,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_sigmask$UNIX2003")]
+ pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
+ oldset: *mut sigset_t) -> ::c_int;
+ pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
+ pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+ pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+ pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
+ pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
+ pub fn getpwnam_r(name: *const ::c_char,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
+ pub fn getpwuid_r(uid: ::uid_t,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
+ link_name = "sigwait$UNIX2003")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+ pub fn sigwait(set: *const sigset_t,
+ sig: *mut ::c_int) -> ::c_int;
+ pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+ parent: Option<unsafe extern fn()>,
+ child: Option<unsafe extern fn()>) -> ::c_int;
+ pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "popen$UNIX2003")]
+ pub fn popen(command: *const c_char,
+ mode: *const c_char) -> *mut ::FILE;
}
cfg_if! {
diff --git a/libc/src/unix/mod.rs b/libc/src/unix/mod.rs
index c2d1f10..fcbc3eb 100644
--- a/libc/src/unix/mod.rs
+++ b/libc/src/unix/mod.rs
@@ -62,7 +62,7 @@ s! {
pub ru_nvcsw: c_long,
pub ru_nivcsw: c_long,
- #[cfg(any(target_env = "musl"))]
+ #[cfg(any(target_env = "musl", target_os = "emscripten"))]
__reserved: [c_long; 16],
}
@@ -124,6 +124,20 @@ s! {
// Actually a union of an int and a void*
pub sival_ptr: *mut ::c_void
}
+
+ // <sys/time.h>
+ pub struct itimerval {
+ pub it_interval: ::timeval,
+ pub it_value: ::timeval,
+ }
+
+ // <sys/times.h>
+ pub struct tms {
+ pub tms_utime: ::clock_t,
+ pub tms_stime: ::clock_t,
+ pub tms_cutime: ::clock_t,
+ pub tms_cstime: ::clock_t,
+ }
}
pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
@@ -203,9 +217,23 @@ pub const PRIO_USER: ::c_int = 2;
pub const PRIO_MIN: ::c_int = -20;
pub const PRIO_MAX: ::c_int = 20;
+pub const IPPROTO_ICMP: ::c_int = 1;
+pub const IPPROTO_ICMPV6: ::c_int = 58;
+pub const IPPROTO_TCP: ::c_int = 6;
+pub const IPPROTO_UDP: ::c_int = 17;
+pub const IPPROTO_IP: ::c_int = 0;
+pub const IPPROTO_IPV6: ::c_int = 41;
+
+pub const INADDR_LOOPBACK: in_addr_t = 2130706433;
+pub const INADDR_ANY: in_addr_t = 0;
+pub const INADDR_BROADCAST: in_addr_t = 4294967295;
+pub const INADDR_NONE: in_addr_t = 4294967295;
+
cfg_if! {
if #[cfg(dox)] {
// on dox builds don't pull in anything
+ } else if #[cfg(target_os = "l4re")] {
+ // required libraries for L4Re are linked externally, ATM
} else if #[cfg(all(not(stdbuild), feature = "use_std"))] {
// cargo build, don't pull in anything extra as the libstd dep
// already pulls in all libs.
@@ -238,6 +266,10 @@ cfg_if! {
#[link(name = "c")]
#[link(name = "mxio")]
extern {}
+ } else if #[cfg(target_env = "newlib")] {
+ #[link(name = "c")]
+ #[link(name = "m")]
+ extern {}
} else {
#[link(name = "c")]
#[link(name = "m")]
@@ -248,10 +280,6 @@ cfg_if! {
}
extern {
- pub fn getgrnam(name: *const ::c_char) -> *mut group;
- pub fn getgrgid(gid: ::gid_t) -> *mut group;
-
- pub fn endpwent();
#[cfg_attr(target_os = "netbsd", link_name = "__getpwnam50")]
pub fn getpwnam(name: *const ::c_char) -> *mut passwd;
#[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")]
@@ -321,10 +349,6 @@ extern {
#[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "popen$UNIX2003")]
- pub fn popen(command: *const c_char,
- mode: *const c_char) -> *mut ::FILE;
pub fn pclose(stream: *mut ::FILE) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "fdopen$UNIX2003")]
@@ -366,8 +390,6 @@ extern {
pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
flags: ::c_int, ...) -> ::c_int;
- pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
- mode: ::c_int, flags: ::c_int) -> ::c_int;
pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char,
mode: ::mode_t, flags: ::c_int) -> ::c_int;
pub fn fchown(fd: ::c_int,
@@ -405,7 +427,9 @@ extern {
pub fn lchown(path: *const c_char, uid: uid_t,
gid: gid_t) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "close$UNIX2003")]
+ link_name = "close$NOCANCEL$UNIX2003")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
+ link_name = "close$NOCANCEL")]
pub fn close(fd: ::c_int) -> ::c_int;
pub fn dup(fd: ::c_int) -> ::c_int;
pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
@@ -456,6 +480,7 @@ extern {
pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t)
-> ::ssize_t;
pub fn rmdir(path: *const c_char) -> ::c_int;
+ pub fn seteuid(uid: uid_t) -> ::c_int;
pub fn setgid(gid: gid_t) -> ::c_int;
pub fn setpgid(pid: pid_t, pgid: pid_t) -> ::c_int;
pub fn setsid() -> pid_t;
@@ -555,7 +580,6 @@ extern {
#[cfg_attr(target_os = "netbsd", link_name = "__getrusage50")]
pub fn getrusage(resource: ::c_int, usage: *mut rusage) -> ::c_int;
- pub fn getdtablesize() -> ::c_int;
#[cfg_attr(any(target_os = "macos", target_os = "ios"),
link_name = "realpath$DARWIN_EXTSN")]
pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char)
@@ -566,19 +590,14 @@ extern {
#[cfg_attr(target_os = "netbsd", link_name = "__gettimeofday50")]
pub fn gettimeofday(tp: *mut ::timeval,
tz: *mut ::c_void) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__times13")]
+ pub fn times(buf: *mut ::tms) -> ::clock_t;
pub fn pthread_self() -> ::pthread_t;
- pub fn pthread_create(native: *mut ::pthread_t,
- attr: *const ::pthread_attr_t,
- f: extern fn(*mut ::c_void) -> *mut ::c_void,
- value: *mut ::c_void) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "pthread_join$UNIX2003")]
pub fn pthread_join(native: ::pthread_t,
value: *mut *mut ::c_void) -> ::c_int;
- pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
- parent: Option<unsafe extern fn()>,
- child: Option<unsafe extern fn()>) -> ::c_int;
pub fn pthread_exit(value: *mut ::c_void);
pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int;
@@ -629,6 +648,10 @@ extern {
pub fn pthread_condattr_init(attr: *mut pthread_condattr_t) -> ::c_int;
pub fn pthread_condattr_destroy(attr: *mut pthread_condattr_t) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_rwlock_init$UNIX2003")]
+ pub fn pthread_rwlock_init(lock: *mut pthread_rwlock_t,
+ attr: *const pthread_rwlockattr_t) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "pthread_rwlock_destroy$UNIX2003")]
pub fn pthread_rwlock_destroy(lock: *mut pthread_rwlock_t) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
@@ -646,11 +669,9 @@ extern {
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "pthread_rwlock_unlock$UNIX2003")]
pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_sigmask$UNIX2003")]
- pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
- oldset: *mut sigset_t) -> ::c_int;
- pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+ pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int;
+ pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t)
+ -> ::c_int;
#[cfg_attr(all(target_os = "linux", not(target_env = "musl")),
link_name = "__xpg_strerror_r")]
pub fn strerror_r(errnum: ::c_int, buf: *mut c_char,
@@ -666,16 +687,6 @@ extern {
pub fn sigaction(signum: ::c_int,
act: *const sigaction,
oldact: *mut sigaction) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
- link_name = "sigaltstack$UNIX2003")]
- #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
- pub fn sigaltstack(ss: *const stack_t,
- oss: *mut stack_t) -> ::c_int;
- #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
- link_name = "sigwait$UNIX2003")]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
- pub fn sigwait(set: *const sigset_t,
- sig: *mut ::c_int) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
pub fn utimes(filename: *const ::c_char,
@@ -713,14 +724,15 @@ extern {
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 = "__gmtime50")]
+ pub fn gmtime(time_p: *const time_t) -> *mut tm;
#[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
- pub fn localtime(time: *const time_t) -> *mut tm;
+ pub fn localtime(time_p: *const time_t) -> *mut tm;
#[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
pub fn mknod(pathname: *const ::c_char, mode: ::mode_t,
dev: ::dev_t) -> ::c_int;
pub fn uname(buf: *mut ::utsname) -> ::c_int;
- pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
pub fn chroot(name: *const ::c_char) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
@@ -757,9 +769,6 @@ extern {
pub fn localeconv() -> *mut lconv;
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
- pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
- pub fn sem_close(sem: *mut sem_t) -> ::c_int;
- pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
link_name = "sem_wait$UNIX2003")]
pub fn sem_wait(sem: *mut sem_t) -> ::c_int;
@@ -793,6 +802,8 @@ extern {
set: *const sigset_t,
oldset: *mut sigset_t)
-> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
+ pub fn sigpending(set: *mut sigset_t) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
pub fn timegm(tm: *mut ::tm) -> time_t;
@@ -833,6 +844,7 @@ extern {
termios: *const ::termios) -> ::c_int;
pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int;
pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int;
+ pub fn tcgetsid(fd: ::c_int) -> ::pid_t;
pub fn tcsendbreak(fd: ::c_int, duration: ::c_int) -> ::c_int;
pub fn mkstemp(template: *mut ::c_char) -> ::c_int;
pub fn mkdtemp(template: *mut ::c_char) -> *mut ::c_char;
@@ -857,6 +869,9 @@ cfg_if! {
if #[cfg(target_env = "uclibc")] {
mod uclibc;
pub use self::uclibc::*;
+ } else if #[cfg(target_env = "newlib")] {
+ mod newlib;
+ pub use self::newlib::*;
} else if #[cfg(any(target_os = "linux",
target_os = "android",
target_os = "emscripten",
diff --git a/libc/src/unix/newlib/arm/mod.rs b/libc/src/unix/newlib/arm/mod.rs
new file mode 100644
index 0000000..372a48c
--- /dev/null
+++ b/libc/src/unix/newlib/arm/mod.rs
@@ -0,0 +1,5 @@
+pub type c_char = u8;
+pub type wchar_t = u32;
+
+pub type c_long = i32;
+pub type c_ulong = u32;
diff --git a/libc/src/unix/newlib/mod.rs b/libc/src/unix/newlib/mod.rs
new file mode 100644
index 0000000..aec3bca
--- /dev/null
+++ b/libc/src/unix/newlib/mod.rs
@@ -0,0 +1,658 @@
+use dox::mem;
+
+pub type blkcnt_t = i32;
+pub type blksize_t = i32;
+pub type clock_t = i32;
+pub type clockid_t = ::c_ulong;
+pub type dev_t = u32;
+pub type fsblkcnt_t = u64;
+pub type fsfilcnt_t = u32;
+pub type id_t = u32;
+pub type ino_t = u32;
+pub type key_t = ::c_int;
+pub type loff_t = ::c_longlong;
+pub type mode_t = ::c_uint;
+pub type nfds_t = u32;
+pub type nlink_t = ::c_ushort;
+pub type off_t = i64;
+pub type pthread_t = ::c_ulong;
+pub type pthread_key_t = ::c_uint;
+pub type rlim_t = u32;
+pub type sa_family_t = u8;
+pub type socklen_t = u32;
+pub type speed_t = u32;
+pub type suseconds_t = i32;
+pub type tcflag_t = ::c_uint;
+pub type time_t = i32;
+pub type useconds_t = u32;
+
+s! {
+ pub struct sockaddr {
+ pub sa_family: sa_family_t,
+ pub sa_data: [::c_char; 14],
+ }
+
+ pub struct sockaddr_in {
+ pub sin_family: sa_family_t,
+ pub sin_port: ::in_port_t,
+ pub sin_addr: ::in_addr,
+ pub sin_zero: [u8; 8],
+ }
+
+ pub struct sockaddr_in6 { // Unverified
+ 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_storage {
+ pub ss_family: sa_family_t,
+ pub __ss_padding: [u8; 26],
+ }
+
+ 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 ip_mreq {
+ pub imr_multiaddr: in_addr,
+ pub imr_interface: in_addr,
+ }
+
+ pub struct linger {
+ pub l_onoff: ::c_int,
+ pub l_linger: ::c_int,
+ }
+
+ pub struct in_addr {
+ pub s_addr: ::in_addr_t,
+ }
+
+ pub struct hostent {
+ pub h_name: *mut ::c_char,
+ pub h_aliases: *mut *mut ::c_char,
+ pub h_addrtype: ::c_int,
+ pub h_length: ::c_int,
+ pub h_addr_list: *mut *mut ::c_char,
+ pub h_addr: *mut ::c_char,
+ }
+
+ pub struct pollfd {
+ pub fd: ::c_int,
+ pub events: ::c_int,
+ pub revents: ::c_int,
+ }
+
+ 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_n_cs_precedes: ::c_char,
+ pub int_n_sep_by_space: ::c_char,
+ pub int_n_sign_posn: ::c_char,
+ pub int_p_cs_precedes: ::c_char,
+ pub int_p_sep_by_space: ::c_char,
+ pub int_p_sign_posn: ::c_char,
+ }
+
+ 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 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_rdev: dev_t,
+ pub st_size: off_t,
+ pub st_atime: time_t,
+ pub st_spare1: ::c_long,
+ pub st_mtime: time_t,
+ pub st_spare2: ::c_long,
+ pub st_ctime: time_t,
+ pub st_spare3: ::c_long,
+ pub st_blksize: blksize_t,
+ pub st_blocks: blkcnt_t,
+ pub st_spare4: [::c_long; 2usize],
+ }
+
+ 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 sigset_t {
+ __val: [::c_ulong; 16],
+ }
+
+ pub struct sigaction {
+ pub sa_handler: extern fn(arg1: ::c_int),
+ pub sa_mask: sigset_t,
+ pub sa_flags: ::c_int,
+ }
+
+ pub struct dirent {
+ pub d_ino: ino_t,
+ pub d_type: ::c_uchar,
+ pub d_name: [::c_char; 256usize],
+ }
+
+ pub struct stack_t {
+ pub ss_sp: *mut ::c_void,
+ pub ss_flags: ::c_int,
+ pub ss_size: usize,
+ }
+
+ pub struct fd_set { // Unverified
+ fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE],
+ }
+
+ pub struct passwd { // Unverified
+ pub pw_name: *mut ::c_char,
+ pub pw_passwd: *mut ::c_char,
+ pub pw_uid: ::uid_t,
+ pub pw_gid: ::gid_t,
+ pub pw_gecos: *mut ::c_char,
+ pub pw_dir: *mut ::c_char,
+ pub pw_shell: *mut ::c_char,
+ }
+
+ pub struct termios { // Unverified
+ pub c_iflag: ::tcflag_t,
+ pub c_oflag: ::tcflag_t,
+ pub c_cflag: ::tcflag_t,
+ pub c_lflag: ::tcflag_t,
+ pub c_line: ::cc_t,
+ pub c_cc: [::cc_t; ::NCCS],
+ }
+
+ pub struct sem_t { // Unverified
+ __size: [::c_char; 16],
+ }
+
+ pub struct Dl_info { // Unverified
+ 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 utsname { // Unverified
+ pub sysname: [::c_char; 65],
+ pub nodename: [::c_char; 65],
+ pub release: [::c_char; 65],
+ pub version: [::c_char; 65],
+ pub machine: [::c_char; 65],
+ pub domainname: [::c_char; 65]
+ }
+
+ pub struct cpu_set_t { // Unverified
+ bits: [u32; 32],
+ }
+
+ pub struct pthread_attr_t { // Unverified
+ __size: [u64; 7]
+ }
+
+ pub struct pthread_mutex_t { // Unverified
+ #[cfg(any(target_arch = "mips", target_arch = "arm",
+ target_arch = "powerpc"))]
+ __align: [::c_long; 0],
+ #[cfg(not(any(target_arch = "mips", target_arch = "arm",
+ target_arch = "powerpc")))]
+ __align: [::c_longlong; 0],
+ size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
+ }
+
+ pub struct pthread_rwlock_t { // Unverified
+ #[cfg(any(target_arch = "mips", target_arch = "arm",
+ target_arch = "powerpc"))]
+ __align: [::c_long; 0],
+ #[cfg(not(any(target_arch = "mips", target_arch = "arm",
+ target_arch = "powerpc")))]
+ __align: [::c_longlong; 0],
+ size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
+ }
+
+ 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",
+ target_arch = "mips64", target_arch = "s390x",
+ target_arch = "sparc64")))]
+ __align: [::c_long; 0],
+ size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
+ }
+
+ pub struct pthread_rwlockattr_t { // Unverified
+ __lockkind: ::c_int,
+ __pshared: ::c_int,
+ }
+
+ pub struct pthread_cond_t { // Unverified
+ __align: [::c_longlong; 0],
+ size: [u8; __SIZEOF_PTHREAD_COND_T],
+ }
+
+ pub struct pthread_condattr_t { // Unverified
+ __align: [::c_int; 0],
+ size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
+ }
+
+}
+
+// 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],
+};
+pub const NCCS: usize = 32;
+pub const __SIZEOF_PTHREAD_ATTR_T: usize = 56;
+pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
+pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
+pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 32;
+pub const __SIZEOF_PTHREAD_BARRIERATTR_T: usize = 4;
+pub const __PTHREAD_MUTEX_HAVE_PREV: usize = 1;
+pub const __PTHREAD_RWLOCK_INT_FLAGS_SHARED: usize = 1;
+pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
+pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
+pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
+pub const FD_SETSIZE: usize = 1024;
+// intentionally not public, only used for fd_set
+const ULONG_SIZE: usize = 32;
+
+// Other constants
+pub const EPERM: ::c_int = 1;
+pub const ENOENT: ::c_int = 2;
+pub const ESRCH: ::c_int = 3;
+pub const EINTR: ::c_int = 4;
+pub const EIO: ::c_int = 5;
+pub const ENXIO: ::c_int = 6;
+pub const E2BIG: ::c_int = 7;
+pub const ENOEXEC: ::c_int = 8;
+pub const EBADF: ::c_int = 9;
+pub const ECHILD: ::c_int = 10;
+pub const EAGAIN: ::c_int = 11;
+pub const ENOMEM: ::c_int = 12;
+pub const EACCES: ::c_int = 13;
+pub const EFAULT: ::c_int = 14;
+pub const EBUSY: ::c_int = 16;
+pub const EEXIST: ::c_int = 17;
+pub const EXDEV: ::c_int = 18;
+pub const ENODEV: ::c_int = 19;
+pub const ENOTDIR: ::c_int = 20;
+pub const EISDIR: ::c_int = 21;
+pub const EINVAL: ::c_int = 22;
+pub const ENFILE: ::c_int = 23;
+pub const EMFILE: ::c_int = 24;
+pub const ENOTTY: ::c_int = 25;
+pub const ETXTBSY: ::c_int = 26;
+pub const EFBIG: ::c_int = 27;
+pub const ENOSPC: ::c_int = 28;
+pub const ESPIPE: ::c_int = 29;
+pub const EROFS: ::c_int = 30;
+pub const EMLINK: ::c_int = 31;
+pub const EPIPE: ::c_int = 32;
+pub const EDOM: ::c_int = 33;
+pub const ERANGE: ::c_int = 34;
+pub const ENOMSG: ::c_int = 35;
+pub const EIDRM: ::c_int = 36;
+pub const EDEADLK: ::c_int = 45;
+pub const ENOLCK: ::c_int = 46;
+pub const ENOSTR: ::c_int = 60;
+pub const ENODATA: ::c_int = 61;
+pub const ETIME: ::c_int = 62;
+pub const ENOSR: ::c_int = 63;
+pub const ENOLINK: ::c_int = 67;
+pub const EPROTO: ::c_int = 71;
+pub const EMULTIHOP: ::c_int = 74;
+pub const EBADMSG: ::c_int = 77;
+pub const EFTYPE: ::c_int = 79;
+pub const ENOSYS: ::c_int = 88;
+pub const ENOTEMPTY: ::c_int = 90;
+pub const ENAMETOOLONG: ::c_int = 91;
+pub const ELOOP: ::c_int = 92;
+pub const EOPNOTSUPP: ::c_int = 95;
+pub const EPFNOSUPPORT: ::c_int = 96;
+pub const ECONNRESET: ::c_int = 104;
+pub const ENOBUFS: ::c_int = 105;
+pub const EAFNOSUPPORT: ::c_int = 106;
+pub const EPROTOTYPE: ::c_int = 107;
+pub const ENOTSOCK: ::c_int = 108;
+pub const ENOPROTOOPT: ::c_int = 109;
+pub const ECONNREFUSED: ::c_int = 111;
+pub const EADDRINUSE: ::c_int = 112;
+pub const ECONNABORTED: ::c_int = 113;
+pub const ENETUNREACH: ::c_int = 114;
+pub const ENETDOWN: ::c_int = 115;
+pub const ETIMEDOUT: ::c_int = 116;
+pub const EHOSTDOWN: ::c_int = 117;
+pub const EHOSTUNREACH: ::c_int = 118;
+pub const EINPROGRESS: ::c_int = 119;
+pub const EALREADY: ::c_int = 120;
+pub const EDESTADDRREQ: ::c_int = 121;
+pub const EMSGSIZE: ::c_int = 122;
+pub const EPROTONOSUPPORT: ::c_int = 123;
+pub const EADDRNOTAVAIL: ::c_int = 125;
+pub const ENETRESET: ::c_int = 126;
+pub const EISCONN: ::c_int = 127;
+pub const ENOTCONN: ::c_int = 128;
+pub const ETOOMANYREFS: ::c_int = 129;
+pub const EDQUOT: ::c_int = 132;
+pub const ESTALE: ::c_int = 133;
+pub const ENOTSUP: ::c_int = 134;
+pub const EILSEQ: ::c_int = 138;
+pub const EOVERFLOW: ::c_int = 139;
+pub const ECANCELED: ::c_int = 140;
+pub const ENOTRECOVERABLE: ::c_int = 141;
+pub const EOWNERDEAD: ::c_int = 142;
+pub const EWOULDBLOCK: ::c_int = 11;
+
+pub const F_DUPFD: ::c_int = 0;
+pub const F_GETFD: ::c_int = 1;
+pub const F_SETFD: ::c_int = 2;
+pub const F_GETFL: ::c_int = 3;
+pub const F_SETFL: ::c_int = 4;
+pub const F_GETOWN: ::c_int = 5;
+pub const F_SETOWN: ::c_int = 6;
+pub const F_GETLK: ::c_int = 7;
+pub const F_SETLK: ::c_int = 8;
+pub const F_SETLKW: ::c_int = 9;
+pub const F_RGETLK: ::c_int = 10;
+pub const F_RSETLK: ::c_int = 11;
+pub const F_CNVT: ::c_int = 12;
+pub const F_RSETLKW: ::c_int = 13;
+pub const F_DUPFD_CLOEXEC: ::c_int = 14;
+
+pub const O_RDONLY: ::c_int = 0;
+pub const O_WRONLY: ::c_int = 1;
+pub const O_RDWR: ::c_int = 2;
+pub const O_APPEND: ::c_int = 8;
+pub const O_CREAT: ::c_int = 512;
+pub const O_TRUNC: ::c_int = 1024;
+pub const O_EXCL: ::c_int = 2048;
+pub const O_SYNC: ::c_int = 8192;
+pub const O_NONBLOCK: ::c_int = 16384;
+
+pub const O_ACCMODE: ::c_int = 3;
+pub const O_CLOEXEC: ::c_int = 0x80000;
+
+pub const STDIN_FILENO: ::c_int = 0;
+pub const STDOUT_FILENO: ::c_int = 1;
+pub const STDERR_FILENO: ::c_int = 2;
+
+pub const SEEK_SET: ::c_int = 0;
+pub const SEEK_CUR: ::c_int = 1;
+pub const SEEK_END: ::c_int = 2;
+
+pub const FIONBIO: ::c_int = 1;
+
+pub const S_BLKSIZE: ::mode_t = 1024;
+pub const S_IREAD: ::mode_t = 256;
+pub const S_IWRITE: ::mode_t = 128;
+pub const S_IEXEC: ::mode_t = 64;
+pub const S_ENFMT: ::mode_t = 1024;
+pub const S_IFMT: ::mode_t = 61440;
+pub const S_IFDIR: ::mode_t = 16384;
+pub const S_IFCHR: ::mode_t = 8192;
+pub const S_IFBLK: ::mode_t = 24576;
+pub const S_IFREG: ::mode_t = 32768;
+pub const S_IFLNK: ::mode_t = 40960;
+pub const S_IFSOCK: ::mode_t = 49152;
+pub const S_IFIFO: ::mode_t = 4096;
+pub const S_IRUSR: ::mode_t = 256;
+pub const S_IWUSR: ::mode_t = 128;
+pub const S_IXUSR: ::mode_t = 64;
+pub const S_IRGRP: ::mode_t = 32;
+pub const S_IWGRP: ::mode_t = 16;
+pub const S_IXGRP: ::mode_t = 8;
+pub const S_IROTH: ::mode_t = 4;
+pub const S_IWOTH: ::mode_t = 2;
+pub const S_IXOTH: ::mode_t = 1;
+
+pub const SOL_SOCKET: ::c_int = 65535;
+pub const SOL_TCP: ::c_int = 6;
+
+pub const PF_UNSPEC: ::c_int = 0;
+pub const PF_INET: ::c_int = 2;
+pub const PF_INET6: ::c_int = 23;
+
+pub const AF_UNSPEC: ::c_int = 0;
+pub const AF_INET: ::c_int = 2;
+pub const AF_INET6: ::c_int = 23;
+
+pub const SOCK_STREAM: ::c_int = 1;
+pub const SOCK_DGRAM: ::c_int = 2;
+
+pub const MSG_OOB: ::c_int = 1;
+pub const MSG_PEEK: ::c_int = 2;
+pub const MSG_DONTWAIT: ::c_int = 4;
+pub const MSG_DONTROUTE: ::c_int = 0;
+pub const MSG_WAITALL: ::c_int = 0;
+pub const MSG_MORE: ::c_int = 0;
+pub const MSG_NOSIGNAL: ::c_int = 0;
+
+pub const SHUT_RD: ::c_int = 0;
+pub const SHUT_WR: ::c_int = 1;
+pub const SHUT_RDWR: ::c_int = 2;
+
+pub const SO_REUSEADDR: ::c_int = 4;
+pub const SO_LINGER: ::c_int = 128;
+pub const SO_OOBINLINE: ::c_int = 256;
+pub const SO_SNDBUF: ::c_int = 4097;
+pub const SO_RCVBUF: ::c_int = 4098;
+pub const SO_SNDLOWAT: ::c_int = 4099;
+pub const SO_RCVLOWAT: ::c_int = 4100;
+pub const SO_TYPE: ::c_int = 4104;
+pub const SO_ERROR: ::c_int = 4105;
+
+pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
+
+pub const INET_ADDRSTRLEN: ::c_int = 16;
+
+pub const IPPROTO_IP: ::c_int = 0;
+pub const IPPROTO_UDP: ::c_int = 17;
+pub const IPPROTO_TCP: ::c_int = 6;
+
+pub const TCP_NODELAY: ::c_int = 8193;
+pub const TCP_MAXSEG: ::c_int = 8194;
+
+pub const IP_TOS: ::c_int = 7;
+pub const IP_TTL: ::c_int = 8;
+pub const IP_MULTICAST_LOOP: ::c_int = 9;
+pub const IP_MULTICAST_TTL: ::c_int = 10;
+pub const IP_ADD_MEMBERSHIP: ::c_int = 11;
+pub const IP_DROP_MEMBERSHIP: ::c_int = 12;
+
+pub const HOST_NOT_FOUND: ::c_int = 1;
+pub const NO_DATA: ::c_int = 2;
+pub const NO_ADDRESS: ::c_int = 2;
+pub const NO_RECOVERY: ::c_int = 3;
+pub const TRY_AGAIN: ::c_int = 4;
+
+pub const AI_PASSIVE: ::c_int = 1;
+pub const AI_CANONNAME: ::c_int = 2;
+pub const AI_NUMERICHOST: ::c_int = 4;
+pub const AI_NUMERICSERV: ::c_int = 0;
+pub const AI_ADDRCONFIG: ::c_int = 0;
+
+pub const NI_MAXHOST: ::c_int = 1025;
+pub const NI_MAXSERV: ::c_int = 32;
+pub const NI_NOFQDN: ::c_int = 1;
+pub const NI_NUMERICHOST: ::c_int = 2;
+pub const NI_NAMEREQD: ::c_int = 4;
+pub const NI_NUMERICSERV: ::c_int = 0;
+pub const NI_DGRAM: ::c_int = 0;
+
+pub const EAI_FAMILY: ::c_int = -303;
+pub const EAI_MEMORY: ::c_int = -304;
+pub const EAI_NONAME: ::c_int = -305;
+pub const EAI_SOCKTYPE: ::c_int = -307;
+
+f! {
+ pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
+ let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
+ let fd = fd as usize;
+ (*set).fds_bits[fd / bits] &= !(1 << (fd % bits));
+ return
+ }
+
+ pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
+ let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
+ let fd = fd as usize;
+ return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0
+ }
+
+ pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
+ let bits = mem::size_of_val(&(*set).fds_bits[0]) * 8;
+ let fd = fd as usize;
+ (*set).fds_bits[fd / bits] |= 1 << (fd % bits);
+ return
+ }
+
+ pub fn FD_ZERO(set: *mut fd_set) -> () {
+ for slot in (*set).fds_bits.iter_mut() {
+ *slot = 0;
+ }
+ }
+}
+
+extern {
+ pub fn bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t) -> ::c_int;
+ pub fn closesocket(sockfd: ::c_int) -> ::c_int;
+ pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
+ pub fn recvfrom(fd: ::c_int, buf: *mut ::c_void, n: usize, flags: ::c_int,
+ addr: *mut sockaddr, addr_len: *mut socklen_t) -> isize;
+ pub fn getnameinfo(sa: *const sockaddr, salen: socklen_t,
+ host: *mut ::c_char, hostlen: socklen_t,
+ serv: *mut ::c_char, servlen: socklen_t,
+ flags: ::c_int) -> ::c_int;
+ pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
+ pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
+ envp: *const *const ::c_char)
+ -> ::c_int;
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
+ pub fn getgrgid_r(uid: ::uid_t,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "sigaltstack$UNIX2003")]
+ #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
+ pub fn sigaltstack(ss: *const stack_t,
+ oss: *mut stack_t) -> ::c_int;
+ pub fn sem_close(sem: *mut sem_t) -> ::c_int;
+ pub fn getdtablesize() -> ::c_int;
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
+ pub fn getgrnam_r(name: *const ::c_char,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_sigmask$UNIX2003")]
+ pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
+ oldset: *mut sigset_t) -> ::c_int;
+ pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
+ pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+ pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+ pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
+ pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
+ pub fn getpwnam_r(name: *const ::c_char,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
+ pub fn getpwuid_r(uid: ::uid_t,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
+ link_name = "sigwait$UNIX2003")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+ pub fn sigwait(set: *const sigset_t,
+ sig: *mut ::c_int) -> ::c_int;
+ pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+ parent: Option<unsafe extern fn()>,
+ child: Option<unsafe extern fn()>) -> ::c_int;
+ pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "popen$UNIX2003")]
+ pub fn popen(command: *const c_char,
+ mode: *const c_char) -> *mut ::FILE;
+}
+
+cfg_if! {
+ if #[cfg(target_arch = "arm")] {
+ mod arm;
+ pub use self::arm::*;
+ } else {
+ // Only tested on ARM so far. Other platforms might have different
+ // definitions for types and constants.
+ pub use target_arch_not_implemented;
+ }
+}
diff --git a/libc/src/unix/notbsd/android/b32/arm.rs b/libc/src/unix/notbsd/android/b32/arm.rs
index 1c9d033..c38f644 100644
--- a/libc/src/unix/notbsd/android/b32/arm.rs
+++ b/libc/src/unix/notbsd/android/b32/arm.rs
@@ -4,3 +4,9 @@ pub type wchar_t = u32;
pub const O_DIRECT: ::c_int = 0x10000;
pub const O_DIRECTORY: ::c_int = 0x4000;
pub const O_NOFOLLOW: ::c_int = 0x8000;
+pub const O_LARGEFILE: ::c_int = 0o400000;
+
+pub const SYS_pivot_root: ::c_long = 218;
+pub const SYS_gettid: ::c_long = 224;
+pub const SYS_perf_event_open: ::c_long = 364;
+pub const SYS_memfd_create: ::c_long = 385;
diff --git a/libc/src/unix/notbsd/android/b32/mod.rs b/libc/src/unix/notbsd/android/b32/mod.rs
index 32f88e4..99af6d8 100644
--- a/libc/src/unix/notbsd/android/b32/mod.rs
+++ b/libc/src/unix/notbsd/android/b32/mod.rs
@@ -66,6 +66,35 @@ s! {
pub st_ino: ::c_ulonglong,
}
+ pub struct statfs64 {
+ pub f_type: u32,
+ pub f_bsize: u32,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ f_fsid: [u32; 2],
+ pub f_namelen: u32,
+ pub f_frsize: u32,
+ pub f_flags: u32,
+ pub f_spare: [u32; 4],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: ::c_ulong,
+ pub f_bfree: ::c_ulong,
+ pub f_bavail: ::c_ulong,
+ pub f_files: ::c_ulong,
+ pub f_ffree: ::c_ulong,
+ pub f_favail: ::c_ulong,
+ pub f_fsid: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ }
+
pub struct pthread_attr_t {
pub flags: ::uint32_t,
pub stack_base: *mut ::c_void,
@@ -141,7 +170,6 @@ pub const PTRACE_SETFPREGS: ::c_int = 15;
pub const PTRACE_GETREGS: ::c_int = 12;
pub const PTRACE_SETREGS: ::c_int = 13;
-pub const SYS_gettid: ::c_long = 224;
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
value: 0,
};
@@ -166,6 +194,9 @@ pub const UT_LINESIZE: usize = 8;
pub const UT_NAMESIZE: usize = 8;
pub const UT_HOSTSIZE: usize = 16;
+pub const SIGSTKSZ: ::size_t = 8192;
+pub const MINSIGSTKSZ: ::size_t = 2048;
+
extern {
pub fn bind(socket: ::c_int, address: *const ::sockaddr,
address_len: socklen_t) -> ::c_int;
diff --git a/libc/src/unix/notbsd/android/b32/x86.rs b/libc/src/unix/notbsd/android/b32/x86.rs
index c4b8197..a56fa00 100644
--- a/libc/src/unix/notbsd/android/b32/x86.rs
+++ b/libc/src/unix/notbsd/android/b32/x86.rs
@@ -4,3 +4,412 @@ pub type wchar_t = i32;
pub const O_DIRECT: ::c_int = 0x4000;
pub const O_DIRECTORY: ::c_int = 0x10000;
pub const O_NOFOLLOW: ::c_int = 0x20000;
+pub const O_LARGEFILE: ::c_int = 0o0100000;
+
+pub const MAP_32BIT: ::c_int = 0x40;
+
+// Syscall table
+pub const SYS_restart_syscall: ::c_long = 0;
+pub const SYS_exit: ::c_long = 1;
+pub const SYS_fork: ::c_long = 2;
+pub const SYS_read: ::c_long = 3;
+pub const SYS_write: ::c_long = 4;
+pub const SYS_open: ::c_long = 5;
+pub const SYS_close: ::c_long = 6;
+pub const SYS_waitpid: ::c_long = 7;
+pub const SYS_creat: ::c_long = 8;
+pub const SYS_link: ::c_long = 9;
+pub const SYS_unlink: ::c_long = 10;
+pub const SYS_execve: ::c_long = 11;
+pub const SYS_chdir: ::c_long = 12;
+pub const SYS_time: ::c_long = 13;
+pub const SYS_mknod: ::c_long = 14;
+pub const SYS_chmod: ::c_long = 15;
+pub const SYS_lchown: ::c_long = 16;
+pub const SYS_break: ::c_long = 17;
+pub const SYS_oldstat: ::c_long = 18;
+pub const SYS_lseek: ::c_long = 19;
+pub const SYS_getpid: ::c_long = 20;
+pub const SYS_mount: ::c_long = 21;
+pub const SYS_umount: ::c_long = 22;
+pub const SYS_setuid: ::c_long = 23;
+pub const SYS_getuid: ::c_long = 24;
+pub const SYS_stime: ::c_long = 25;
+pub const SYS_ptrace: ::c_long = 26;
+pub const SYS_alarm: ::c_long = 27;
+pub const SYS_oldfstat: ::c_long = 28;
+pub const SYS_pause: ::c_long = 29;
+pub const SYS_utime: ::c_long = 30;
+pub const SYS_stty: ::c_long = 31;
+pub const SYS_gtty: ::c_long = 32;
+pub const SYS_access: ::c_long = 33;
+pub const SYS_nice: ::c_long = 34;
+pub const SYS_ftime: ::c_long = 35;
+pub const SYS_sync: ::c_long = 36;
+pub const SYS_kill: ::c_long = 37;
+pub const SYS_rename: ::c_long = 38;
+pub const SYS_mkdir: ::c_long = 39;
+pub const SYS_rmdir: ::c_long = 40;
+pub const SYS_dup: ::c_long = 41;
+pub const SYS_pipe: ::c_long = 42;
+pub const SYS_times: ::c_long = 43;
+pub const SYS_prof: ::c_long = 44;
+pub const SYS_brk: ::c_long = 45;
+pub const SYS_setgid: ::c_long = 46;
+pub const SYS_getgid: ::c_long = 47;
+pub const SYS_signal: ::c_long = 48;
+pub const SYS_geteuid: ::c_long = 49;
+pub const SYS_getegid: ::c_long = 50;
+pub const SYS_acct: ::c_long = 51;
+pub const SYS_umount2: ::c_long = 52;
+pub const SYS_lock: ::c_long = 53;
+pub const SYS_ioctl: ::c_long = 54;
+pub const SYS_fcntl: ::c_long = 55;
+pub const SYS_mpx: ::c_long = 56;
+pub const SYS_setpgid: ::c_long = 57;
+pub const SYS_ulimit: ::c_long = 58;
+pub const SYS_oldolduname: ::c_long = 59;
+pub const SYS_umask: ::c_long = 60;
+pub const SYS_chroot: ::c_long = 61;
+pub const SYS_ustat: ::c_long = 62;
+pub const SYS_dup2: ::c_long = 63;
+pub const SYS_getppid: ::c_long = 64;
+pub const SYS_getpgrp: ::c_long = 65;
+pub const SYS_setsid: ::c_long = 66;
+pub const SYS_sigaction: ::c_long = 67;
+pub const SYS_sgetmask: ::c_long = 68;
+pub const SYS_ssetmask: ::c_long = 69;
+pub const SYS_setreuid: ::c_long = 70;
+pub const SYS_setregid: ::c_long = 71;
+pub const SYS_sigsuspend: ::c_long = 72;
+pub const SYS_sigpending: ::c_long = 73;
+pub const SYS_sethostname: ::c_long = 74;
+pub const SYS_setrlimit: ::c_long = 75;
+pub const SYS_getrlimit: ::c_long = 76;
+pub const SYS_getrusage: ::c_long = 77;
+pub const SYS_gettimeofday: ::c_long = 78;
+pub const SYS_settimeofday: ::c_long = 79;
+pub const SYS_getgroups: ::c_long = 80;
+pub const SYS_setgroups: ::c_long = 81;
+pub const SYS_select: ::c_long = 82;
+pub const SYS_symlink: ::c_long = 83;
+pub const SYS_oldlstat: ::c_long = 84;
+pub const SYS_readlink: ::c_long = 85;
+pub const SYS_uselib: ::c_long = 86;
+pub const SYS_swapon: ::c_long = 87;
+pub const SYS_reboot: ::c_long = 88;
+pub const SYS_readdir: ::c_long = 89;
+pub const SYS_mmap: ::c_long = 90;
+pub const SYS_munmap: ::c_long = 91;
+pub const SYS_truncate: ::c_long = 92;
+pub const SYS_ftruncate: ::c_long = 93;
+pub const SYS_fchmod: ::c_long = 94;
+pub const SYS_fchown: ::c_long = 95;
+pub const SYS_getpriority: ::c_long = 96;
+pub const SYS_setpriority: ::c_long = 97;
+pub const SYS_profil: ::c_long = 98;
+pub const SYS_statfs: ::c_long = 99;
+pub const SYS_fstatfs: ::c_long = 100;
+pub const SYS_ioperm: ::c_long = 101;
+pub const SYS_socketcall: ::c_long = 102;
+pub const SYS_syslog: ::c_long = 103;
+pub const SYS_setitimer: ::c_long = 104;
+pub const SYS_getitimer: ::c_long = 105;
+pub const SYS_stat: ::c_long = 106;
+pub const SYS_lstat: ::c_long = 107;
+pub const SYS_fstat: ::c_long = 108;
+pub const SYS_olduname: ::c_long = 109;
+pub const SYS_iopl: ::c_long = 110;
+pub const SYS_vhangup: ::c_long = 111;
+pub const SYS_idle: ::c_long = 112;
+pub const SYS_vm86old: ::c_long = 113;
+pub const SYS_wait4: ::c_long = 114;
+pub const SYS_swapoff: ::c_long = 115;
+pub const SYS_sysinfo: ::c_long = 116;
+pub const SYS_ipc: ::c_long = 117;
+pub const SYS_fsync: ::c_long = 118;
+pub const SYS_sigreturn: ::c_long = 119;
+pub const SYS_clone: ::c_long = 120;
+pub const SYS_setdomainname: ::c_long = 121;
+pub const SYS_uname: ::c_long = 122;
+pub const SYS_modify_ldt: ::c_long = 123;
+pub const SYS_adjtimex: ::c_long = 124;
+pub const SYS_mprotect: ::c_long = 125;
+pub const SYS_sigprocmask: ::c_long = 126;
+pub const SYS_create_module: ::c_long = 127;
+pub const SYS_init_module: ::c_long = 128;
+pub const SYS_delete_module: ::c_long = 129;
+pub const SYS_get_kernel_syms: ::c_long = 130;
+pub const SYS_quotactl: ::c_long = 131;
+pub const SYS_getpgid: ::c_long = 132;
+pub const SYS_fchdir: ::c_long = 133;
+pub const SYS_bdflush: ::c_long = 134;
+pub const SYS_sysfs: ::c_long = 135;
+pub const SYS_personality: ::c_long = 136;
+pub const SYS_afs_syscall: ::c_long = 137;
+pub const SYS_setfsuid: ::c_long = 138;
+pub const SYS_setfsgid: ::c_long = 139;
+// FIXME: SYS__llseek is in the NDK sources but for some reason is
+// not available in the tests
+// pub const SYS__llseek: ::c_long = 140;
+pub const SYS_getdents: ::c_long = 141;
+// FIXME: SYS__newselect is in the NDK sources but for some reason is
+// not available in the tests
+// pub const SYS__newselect: ::c_long = 142;
+pub const SYS_flock: ::c_long = 143;
+pub const SYS_msync: ::c_long = 144;
+pub const SYS_readv: ::c_long = 145;
+pub const SYS_writev: ::c_long = 146;
+pub const SYS_getsid: ::c_long = 147;
+pub const SYS_fdatasync: ::c_long = 148;
+// FIXME: SYS__llseek is in the NDK sources but for some reason is
+// not available in the tests
+// pub const SYS__sysctl: ::c_long = 149;
+pub const SYS_mlock: ::c_long = 150;
+pub const SYS_munlock: ::c_long = 151;
+pub const SYS_mlockall: ::c_long = 152;
+pub const SYS_munlockall: ::c_long = 153;
+pub const SYS_sched_setparam: ::c_long = 154;
+pub const SYS_sched_getparam: ::c_long = 155;
+pub const SYS_sched_setscheduler: ::c_long = 156;
+pub const SYS_sched_getscheduler: ::c_long = 157;
+pub const SYS_sched_yield: ::c_long = 158;
+pub const SYS_sched_get_priority_max: ::c_long = 159;
+pub const SYS_sched_get_priority_min: ::c_long = 160;
+pub const SYS_sched_rr_get_interval: ::c_long = 161;
+pub const SYS_nanosleep: ::c_long = 162;
+pub const SYS_mremap: ::c_long = 163;
+pub const SYS_setresuid: ::c_long = 164;
+pub const SYS_getresuid: ::c_long = 165;
+pub const SYS_vm86: ::c_long = 166;
+pub const SYS_query_module: ::c_long = 167;
+pub const SYS_poll: ::c_long = 168;
+pub const SYS_nfsservctl: ::c_long = 169;
+pub const SYS_setresgid: ::c_long = 170;
+pub const SYS_getresgid: ::c_long = 171;
+pub const SYS_prctl: ::c_long = 172;
+pub const SYS_rt_sigreturn: ::c_long = 173;
+pub const SYS_rt_sigaction: ::c_long = 174;
+pub const SYS_rt_sigprocmask: ::c_long = 175;
+pub const SYS_rt_sigpending: ::c_long = 176;
+pub const SYS_rt_sigtimedwait: ::c_long = 177;
+pub const SYS_rt_sigqueueinfo: ::c_long = 178;
+pub const SYS_rt_sigsuspend: ::c_long = 179;
+pub const SYS_pread64: ::c_long = 180;
+pub const SYS_pwrite64: ::c_long = 181;
+pub const SYS_chown: ::c_long = 182;
+pub const SYS_getcwd: ::c_long = 183;
+pub const SYS_capget: ::c_long = 184;
+pub const SYS_capset: ::c_long = 185;
+pub const SYS_sigaltstack: ::c_long = 186;
+pub const SYS_sendfile: ::c_long = 187;
+pub const SYS_getpmsg: ::c_long = 188;
+pub const SYS_putpmsg: ::c_long = 189;
+pub const SYS_vfork: ::c_long = 190;
+pub const SYS_ugetrlimit: ::c_long = 191;
+pub const SYS_mmap2: ::c_long = 192;
+pub const SYS_truncate64: ::c_long = 193;
+pub const SYS_ftruncate64: ::c_long = 194;
+pub const SYS_stat64: ::c_long = 195;
+pub const SYS_lstat64: ::c_long = 196;
+pub const SYS_fstat64: ::c_long = 197;
+pub const SYS_lchown32: ::c_long = 198;
+pub const SYS_getuid32: ::c_long = 199;
+pub const SYS_getgid32: ::c_long = 200;
+pub const SYS_geteuid32: ::c_long = 201;
+pub const SYS_getegid32: ::c_long = 202;
+pub const SYS_setreuid32: ::c_long = 203;
+pub const SYS_setregid32: ::c_long = 204;
+pub const SYS_getgroups32: ::c_long = 205;
+pub const SYS_setgroups32: ::c_long = 206;
+pub const SYS_fchown32: ::c_long = 207;
+pub const SYS_setresuid32: ::c_long = 208;
+pub const SYS_getresuid32: ::c_long = 209;
+pub const SYS_setresgid32: ::c_long = 210;
+pub const SYS_getresgid32: ::c_long = 211;
+pub const SYS_chown32: ::c_long = 212;
+pub const SYS_setuid32: ::c_long = 213;
+pub const SYS_setgid32: ::c_long = 214;
+pub const SYS_setfsuid32: ::c_long = 215;
+pub const SYS_setfsgid32: ::c_long = 216;
+pub const SYS_pivot_root: ::c_long = 217;
+pub const SYS_mincore: ::c_long = 218;
+pub const SYS_madvise: ::c_long = 219;
+pub const SYS_getdents64: ::c_long = 220;
+pub const SYS_fcntl64: ::c_long = 221;
+pub const SYS_gettid: ::c_long = 224;
+pub const SYS_readahead: ::c_long = 225;
+pub const SYS_setxattr: ::c_long = 226;
+pub const SYS_lsetxattr: ::c_long = 227;
+pub const SYS_fsetxattr: ::c_long = 228;
+pub const SYS_getxattr: ::c_long = 229;
+pub const SYS_lgetxattr: ::c_long = 230;
+pub const SYS_fgetxattr: ::c_long = 231;
+pub const SYS_listxattr: ::c_long = 232;
+pub const SYS_llistxattr: ::c_long = 233;
+pub const SYS_flistxattr: ::c_long = 234;
+pub const SYS_removexattr: ::c_long = 235;
+pub const SYS_lremovexattr: ::c_long = 236;
+pub const SYS_fremovexattr: ::c_long = 237;
+pub const SYS_tkill: ::c_long = 238;
+pub const SYS_sendfile64: ::c_long = 239;
+pub const SYS_futex: ::c_long = 240;
+pub const SYS_sched_setaffinity: ::c_long = 241;
+pub const SYS_sched_getaffinity: ::c_long = 242;
+pub const SYS_set_thread_area: ::c_long = 243;
+pub const SYS_get_thread_area: ::c_long = 244;
+pub const SYS_io_setup: ::c_long = 245;
+pub const SYS_io_destroy: ::c_long = 246;
+pub const SYS_io_getevents: ::c_long = 247;
+pub const SYS_io_submit: ::c_long = 248;
+pub const SYS_io_cancel: ::c_long = 249;
+pub const SYS_fadvise64: ::c_long = 250;
+pub const SYS_exit_group: ::c_long = 252;
+pub const SYS_lookup_dcookie: ::c_long = 253;
+pub const SYS_epoll_create: ::c_long = 254;
+pub const SYS_epoll_ctl: ::c_long = 255;
+pub const SYS_epoll_wait: ::c_long = 256;
+pub const SYS_remap_file_pages: ::c_long = 257;
+pub const SYS_set_tid_address: ::c_long = 258;
+pub const SYS_timer_create: ::c_long = 259;
+pub const SYS_timer_settime: ::c_long = 260;
+pub const SYS_timer_gettime: ::c_long = 261;
+pub const SYS_timer_getoverrun: ::c_long = 262;
+pub const SYS_timer_delete: ::c_long = 263;
+pub const SYS_clock_settime: ::c_long = 264;
+pub const SYS_clock_gettime: ::c_long = 265;
+pub const SYS_clock_getres: ::c_long = 266;
+pub const SYS_clock_nanosleep: ::c_long = 267;
+pub const SYS_statfs64: ::c_long = 268;
+pub const SYS_fstatfs64: ::c_long = 269;
+pub const SYS_tgkill: ::c_long = 270;
+pub const SYS_utimes: ::c_long = 271;
+pub const SYS_fadvise64_64: ::c_long = 272;
+pub const SYS_vserver: ::c_long = 273;
+pub const SYS_mbind: ::c_long = 274;
+pub const SYS_get_mempolicy: ::c_long = 275;
+pub const SYS_set_mempolicy: ::c_long = 276;
+pub const SYS_mq_open: ::c_long = 277;
+pub const SYS_mq_unlink: ::c_long = 278;
+pub const SYS_mq_timedsend: ::c_long = 279;
+pub const SYS_mq_timedreceive: ::c_long = 280;
+pub const SYS_mq_notify: ::c_long = 281;
+pub const SYS_mq_getsetattr: ::c_long = 282;
+pub const SYS_kexec_load: ::c_long = 283;
+pub const SYS_waitid: ::c_long = 284;
+pub const SYS_add_key: ::c_long = 286;
+pub const SYS_request_key: ::c_long = 287;
+pub const SYS_keyctl: ::c_long = 288;
+pub const SYS_ioprio_set: ::c_long = 289;
+pub const SYS_ioprio_get: ::c_long = 290;
+pub const SYS_inotify_init: ::c_long = 291;
+pub const SYS_inotify_add_watch: ::c_long = 292;
+pub const SYS_inotify_rm_watch: ::c_long = 293;
+pub const SYS_migrate_pages: ::c_long = 294;
+pub const SYS_openat: ::c_long = 295;
+pub const SYS_mkdirat: ::c_long = 296;
+pub const SYS_mknodat: ::c_long = 297;
+pub const SYS_fchownat: ::c_long = 298;
+pub const SYS_futimesat: ::c_long = 299;
+pub const SYS_fstatat64: ::c_long = 300;
+pub const SYS_unlinkat: ::c_long = 301;
+pub const SYS_renameat: ::c_long = 302;
+pub const SYS_linkat: ::c_long = 303;
+pub const SYS_symlinkat: ::c_long = 304;
+pub const SYS_readlinkat: ::c_long = 305;
+pub const SYS_fchmodat: ::c_long = 306;
+pub const SYS_faccessat: ::c_long = 307;
+pub const SYS_pselect6: ::c_long = 308;
+pub const SYS_ppoll: ::c_long = 309;
+pub const SYS_unshare: ::c_long = 310;
+pub const SYS_set_robust_list: ::c_long = 311;
+pub const SYS_get_robust_list: ::c_long = 312;
+pub const SYS_splice: ::c_long = 313;
+pub const SYS_sync_file_range: ::c_long = 314;
+pub const SYS_tee: ::c_long = 315;
+pub const SYS_vmsplice: ::c_long = 316;
+pub const SYS_move_pages: ::c_long = 317;
+pub const SYS_getcpu: ::c_long = 318;
+pub const SYS_epoll_pwait: ::c_long = 319;
+pub const SYS_utimensat: ::c_long = 320;
+pub const SYS_signalfd: ::c_long = 321;
+pub const SYS_timerfd_create: ::c_long = 322;
+pub const SYS_eventfd: ::c_long = 323;
+pub const SYS_fallocate: ::c_long = 324;
+pub const SYS_timerfd_settime: ::c_long = 325;
+pub const SYS_timerfd_gettime: ::c_long = 326;
+pub const SYS_signalfd4: ::c_long = 327;
+pub const SYS_eventfd2: ::c_long = 328;
+pub const SYS_epoll_create1: ::c_long = 329;
+pub const SYS_dup3: ::c_long = 330;
+pub const SYS_pipe2: ::c_long = 331;
+pub const SYS_inotify_init1: ::c_long = 332;
+pub const SYS_preadv: ::c_long = 333;
+pub const SYS_pwritev: ::c_long = 334;
+pub const SYS_rt_tgsigqueueinfo: ::c_long = 335;
+pub const SYS_perf_event_open: ::c_long = 336;
+pub const SYS_recvmmsg: ::c_long = 337;
+pub const SYS_fanotify_init: ::c_long = 338;
+pub const SYS_fanotify_mark: ::c_long = 339;
+pub const SYS_prlimit64: ::c_long = 340;
+pub const SYS_name_to_handle_at: ::c_long = 341;
+pub const SYS_open_by_handle_at: ::c_long = 342;
+pub const SYS_clock_adjtime: ::c_long = 343;
+pub const SYS_syncfs: ::c_long = 344;
+pub const SYS_sendmmsg: ::c_long = 345;
+pub const SYS_setns: ::c_long = 346;
+pub const SYS_process_vm_readv: ::c_long = 347;
+pub const SYS_process_vm_writev: ::c_long = 348;
+pub const SYS_kcmp: ::c_long = 349;
+pub const SYS_finit_module: ::c_long = 350;
+pub const SYS_sched_setattr: ::c_long = 351;
+pub const SYS_sched_getattr: ::c_long = 352;
+pub const SYS_renameat2: ::c_long = 353;
+pub const SYS_seccomp: ::c_long = 354;
+pub const SYS_getrandom: ::c_long = 355;
+pub const SYS_memfd_create: ::c_long = 356;
+pub const SYS_bpf: ::c_long = 357;
+pub const SYS_execveat: ::c_long = 358;
+pub const SYS_socket: ::c_long = 359;
+pub const SYS_socketpair: ::c_long = 360;
+pub const SYS_bind: ::c_long = 361;
+pub const SYS_connect: ::c_long = 362;
+pub const SYS_listen: ::c_long = 363;
+pub const SYS_accept4: ::c_long = 364;
+pub const SYS_getsockopt: ::c_long = 365;
+pub const SYS_setsockopt: ::c_long = 366;
+pub const SYS_getsockname: ::c_long = 367;
+pub const SYS_getpeername: ::c_long = 368;
+pub const SYS_sendto: ::c_long = 369;
+pub const SYS_sendmsg: ::c_long = 370;
+pub const SYS_recvfrom: ::c_long = 371;
+pub const SYS_recvmsg: ::c_long = 372;
+pub const SYS_shutdown: ::c_long = 373;
+pub const SYS_userfaultfd: ::c_long = 374;
+pub const SYS_membarrier: ::c_long = 375;
+pub const SYS_mlock2: ::c_long = 376;
+pub const SYS_copy_file_range: ::c_long = 377;
+pub const SYS_preadv2: ::c_long = 378;
+pub const SYS_pwritev2: ::c_long = 379;
+pub const SYS_pkey_mprotect: ::c_long = 380;
+pub const SYS_pkey_alloc: ::c_long = 381;
+pub const SYS_pkey_free: ::c_long = 382;
+
+// offsets in user_regs_structs, from sys/reg.h
+pub const EBX: ::c_int = 0;
+pub const ECX: ::c_int = 1;
+pub const EDX: ::c_int = 2;
+pub const ESI: ::c_int = 3;
+pub const EDI: ::c_int = 4;
+pub const EBP: ::c_int = 5;
+pub const EAX: ::c_int = 6;
+pub const DS: ::c_int = 7;
+pub const ES: ::c_int = 8;
+pub const FS: ::c_int = 9;
+pub const GS: ::c_int = 10;
+pub const ORIG_EAX: ::c_int = 11;
+pub const EIP: ::c_int = 12;
+pub const CS: ::c_int = 13;
+pub const EFL: ::c_int = 14;
+pub const UESP: ::c_int = 15;
+pub const SS: ::c_int = 16;
diff --git a/libc/src/unix/notbsd/android/b64/aarch64.rs b/libc/src/unix/notbsd/android/b64/aarch64.rs
index 89c505d..f08f4f1 100644
--- a/libc/src/unix/notbsd/android/b64/aarch64.rs
+++ b/libc/src/unix/notbsd/android/b64/aarch64.rs
@@ -52,5 +52,12 @@ s! {
pub const O_DIRECT: ::c_int = 0x10000;
pub const O_DIRECTORY: ::c_int = 0x4000;
pub const O_NOFOLLOW: ::c_int = 0x8000;
+pub const O_LARGEFILE: ::c_int = 0o400000;
+pub const SYS_pivot_root: ::c_long = 41;
pub const SYS_gettid: ::c_long = 178;
+pub const SYS_perf_event_open: ::c_long = 241;
+pub const SYS_memfd_create: ::c_long = 279;
+
+pub const SIGSTKSZ: ::size_t = 16384;
+pub const MINSIGSTKSZ: ::size_t = 5120;
diff --git a/libc/src/unix/notbsd/android/b64/mod.rs b/libc/src/unix/notbsd/android/b64/mod.rs
index 98a2f39..4aa6997 100644
--- a/libc/src/unix/notbsd/android/b64/mod.rs
+++ b/libc/src/unix/notbsd/android/b64/mod.rs
@@ -94,6 +94,36 @@ s! {
pub mem_unit: ::c_uint,
pub _f: [::c_char; 0],
}
+
+ pub struct statfs64 {
+ pub f_type: u64,
+ pub f_bsize: u64,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ f_fsid: [u32; 2],
+ pub f_namelen: u64,
+ pub f_frsize: u64,
+ pub f_flags: u64,
+ pub f_spare: [u64; 4],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: u64,
+ pub f_fsid: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ __f_spare: [::c_int; 6],
+ }
}
pub const RTLD_GLOBAL: ::c_int = 0x00100;
diff --git a/libc/src/unix/notbsd/android/b64/x86_64.rs b/libc/src/unix/notbsd/android/b64/x86_64.rs
index 58d07e1..c813e7d 100644
--- a/libc/src/unix/notbsd/android/b64/x86_64.rs
+++ b/libc/src/unix/notbsd/android/b64/x86_64.rs
@@ -46,5 +46,375 @@ s! {
pub const O_DIRECT: ::c_int = 0x4000;
pub const O_DIRECTORY: ::c_int = 0x10000;
pub const O_NOFOLLOW: ::c_int = 0x20000;
+pub const O_LARGEFILE: ::c_int = 0o0100000;
+pub const SIGSTKSZ: ::size_t = 8192;
+pub const MINSIGSTKSZ: ::size_t = 2048;
+
+pub const MAP_32BIT: ::c_int = 0x40;
+
+// Syscall table
+
+pub const SYS_read: ::c_long = 0;
+pub const SYS_write: ::c_long = 1;
+pub const SYS_open: ::c_long = 2;
+pub const SYS_close: ::c_long = 3;
+pub const SYS_stat: ::c_long = 4;
+pub const SYS_fstat: ::c_long = 5;
+pub const SYS_lstat: ::c_long = 6;
+pub const SYS_poll: ::c_long = 7;
+pub const SYS_lseek: ::c_long = 8;
+pub const SYS_mmap: ::c_long = 9;
+pub const SYS_mprotect: ::c_long = 10;
+pub const SYS_munmap: ::c_long = 11;
+pub const SYS_brk: ::c_long = 12;
+pub const SYS_rt_sigaction: ::c_long = 13;
+pub const SYS_rt_sigprocmask: ::c_long = 14;
+pub const SYS_rt_sigreturn: ::c_long = 15;
+pub const SYS_ioctl: ::c_long = 16;
+pub const SYS_pread64: ::c_long = 17;
+pub const SYS_pwrite64: ::c_long = 18;
+pub const SYS_readv: ::c_long = 19;
+pub const SYS_writev: ::c_long = 20;
+pub const SYS_access: ::c_long = 21;
+pub const SYS_pipe: ::c_long = 22;
+pub const SYS_select: ::c_long = 23;
+pub const SYS_sched_yield: ::c_long = 24;
+pub const SYS_mremap: ::c_long = 25;
+pub const SYS_msync: ::c_long = 26;
+pub const SYS_mincore: ::c_long = 27;
+pub const SYS_madvise: ::c_long = 28;
+pub const SYS_shmget: ::c_long = 29;
+pub const SYS_shmat: ::c_long = 30;
+pub const SYS_shmctl: ::c_long = 31;
+pub const SYS_dup: ::c_long = 32;
+pub const SYS_dup2: ::c_long = 33;
+pub const SYS_pause: ::c_long = 34;
+pub const SYS_nanosleep: ::c_long = 35;
+pub const SYS_getitimer: ::c_long = 36;
+pub const SYS_alarm: ::c_long = 37;
+pub const SYS_setitimer: ::c_long = 38;
+pub const SYS_getpid: ::c_long = 39;
+pub const SYS_sendfile: ::c_long = 40;
+pub const SYS_socket: ::c_long = 41;
+pub const SYS_connect: ::c_long = 42;
+pub const SYS_accept: ::c_long = 43;
+pub const SYS_sendto: ::c_long = 44;
+pub const SYS_recvfrom: ::c_long = 45;
+pub const SYS_sendmsg: ::c_long = 46;
+pub const SYS_recvmsg: ::c_long = 47;
+pub const SYS_shutdown: ::c_long = 48;
+pub const SYS_bind: ::c_long = 49;
+pub const SYS_listen: ::c_long = 50;
+pub const SYS_getsockname: ::c_long = 51;
+pub const SYS_getpeername: ::c_long = 52;
+pub const SYS_socketpair: ::c_long = 53;
+pub const SYS_setsockopt: ::c_long = 54;
+pub const SYS_getsockopt: ::c_long = 55;
+pub const SYS_clone: ::c_long = 56;
+pub const SYS_fork: ::c_long = 57;
+pub const SYS_vfork: ::c_long = 58;
+pub const SYS_execve: ::c_long = 59;
+pub const SYS_exit: ::c_long = 60;
+pub const SYS_wait4: ::c_long = 61;
+pub const SYS_kill: ::c_long = 62;
+pub const SYS_uname: ::c_long = 63;
+pub const SYS_semget: ::c_long = 64;
+pub const SYS_semop: ::c_long = 65;
+pub const SYS_semctl: ::c_long = 66;
+pub const SYS_shmdt: ::c_long = 67;
+pub const SYS_msgget: ::c_long = 68;
+pub const SYS_msgsnd: ::c_long = 69;
+pub const SYS_msgrcv: ::c_long = 70;
+pub const SYS_msgctl: ::c_long = 71;
+pub const SYS_fcntl: ::c_long = 72;
+pub const SYS_flock: ::c_long = 73;
+pub const SYS_fsync: ::c_long = 74;
+pub const SYS_fdatasync: ::c_long = 75;
+pub const SYS_truncate: ::c_long = 76;
+pub const SYS_ftruncate: ::c_long = 77;
+pub const SYS_getdents: ::c_long = 78;
+pub const SYS_getcwd: ::c_long = 79;
+pub const SYS_chdir: ::c_long = 80;
+pub const SYS_fchdir: ::c_long = 81;
+pub const SYS_rename: ::c_long = 82;
+pub const SYS_mkdir: ::c_long = 83;
+pub const SYS_rmdir: ::c_long = 84;
+pub const SYS_creat: ::c_long = 85;
+pub const SYS_link: ::c_long = 86;
+pub const SYS_unlink: ::c_long = 87;
+pub const SYS_symlink: ::c_long = 88;
+pub const SYS_readlink: ::c_long = 89;
+pub const SYS_chmod: ::c_long = 90;
+pub const SYS_fchmod: ::c_long = 91;
+pub const SYS_chown: ::c_long = 92;
+pub const SYS_fchown: ::c_long = 93;
+pub const SYS_lchown: ::c_long = 94;
+pub const SYS_umask: ::c_long = 95;
+pub const SYS_gettimeofday: ::c_long = 96;
+pub const SYS_getrlimit: ::c_long = 97;
+pub const SYS_getrusage: ::c_long = 98;
+pub const SYS_sysinfo: ::c_long = 99;
+pub const SYS_times: ::c_long = 100;
+pub const SYS_ptrace: ::c_long = 101;
+pub const SYS_getuid: ::c_long = 102;
+pub const SYS_syslog: ::c_long = 103;
+pub const SYS_getgid: ::c_long = 104;
+pub const SYS_setuid: ::c_long = 105;
+pub const SYS_setgid: ::c_long = 106;
+pub const SYS_geteuid: ::c_long = 107;
+pub const SYS_getegid: ::c_long = 108;
+pub const SYS_setpgid: ::c_long = 109;
+pub const SYS_getppid: ::c_long = 110;
+pub const SYS_getpgrp: ::c_long = 111;
+pub const SYS_setsid: ::c_long = 112;
+pub const SYS_setreuid: ::c_long = 113;
+pub const SYS_setregid: ::c_long = 114;
+pub const SYS_getgroups: ::c_long = 115;
+pub const SYS_setgroups: ::c_long = 116;
+pub const SYS_setresuid: ::c_long = 117;
+pub const SYS_getresuid: ::c_long = 118;
+pub const SYS_setresgid: ::c_long = 119;
+pub const SYS_getresgid: ::c_long = 120;
+pub const SYS_getpgid: ::c_long = 121;
+pub const SYS_setfsuid: ::c_long = 122;
+pub const SYS_setfsgid: ::c_long = 123;
+pub const SYS_getsid: ::c_long = 124;
+pub const SYS_capget: ::c_long = 125;
+pub const SYS_capset: ::c_long = 126;
+pub const SYS_rt_sigpending: ::c_long = 127;
+pub const SYS_rt_sigtimedwait: ::c_long = 128;
+pub const SYS_rt_sigqueueinfo: ::c_long = 129;
+pub const SYS_rt_sigsuspend: ::c_long = 130;
+pub const SYS_sigaltstack: ::c_long = 131;
+pub const SYS_utime: ::c_long = 132;
+pub const SYS_mknod: ::c_long = 133;
+pub const SYS_uselib: ::c_long = 134;
+pub const SYS_personality: ::c_long = 135;
+pub const SYS_ustat: ::c_long = 136;
+pub const SYS_statfs: ::c_long = 137;
+pub const SYS_fstatfs: ::c_long = 138;
+pub const SYS_sysfs: ::c_long = 139;
+pub const SYS_getpriority: ::c_long = 140;
+pub const SYS_setpriority: ::c_long = 141;
+pub const SYS_sched_setparam: ::c_long = 142;
+pub const SYS_sched_getparam: ::c_long = 143;
+pub const SYS_sched_setscheduler: ::c_long = 144;
+pub const SYS_sched_getscheduler: ::c_long = 145;
+pub const SYS_sched_get_priority_max: ::c_long = 146;
+pub const SYS_sched_get_priority_min: ::c_long = 147;
+pub const SYS_sched_rr_get_interval: ::c_long = 148;
+pub const SYS_mlock: ::c_long = 149;
+pub const SYS_munlock: ::c_long = 150;
+pub const SYS_mlockall: ::c_long = 151;
+pub const SYS_munlockall: ::c_long = 152;
+pub const SYS_vhangup: ::c_long = 153;
+pub const SYS_modify_ldt: ::c_long = 154;
+pub const SYS_pivot_root: ::c_long = 155;
+// FIXME: SYS__sysctl is in the NDK sources but for some reason is
+// not available in the tests
+// pub const SYS__sysctl: ::c_long = 156;
+pub const SYS_prctl: ::c_long = 157;
+pub const SYS_arch_prctl: ::c_long = 158;
+pub const SYS_adjtimex: ::c_long = 159;
+pub const SYS_setrlimit: ::c_long = 160;
+pub const SYS_chroot: ::c_long = 161;
+pub const SYS_sync: ::c_long = 162;
+pub const SYS_acct: ::c_long = 163;
+pub const SYS_settimeofday: ::c_long = 164;
+pub const SYS_mount: ::c_long = 165;
+pub const SYS_umount2: ::c_long = 166;
+pub const SYS_swapon: ::c_long = 167;
+pub const SYS_swapoff: ::c_long = 168;
+pub const SYS_reboot: ::c_long = 169;
+pub const SYS_sethostname: ::c_long = 170;
+pub const SYS_setdomainname: ::c_long = 171;
+pub const SYS_iopl: ::c_long = 172;
+pub const SYS_ioperm: ::c_long = 173;
+pub const SYS_create_module: ::c_long = 174;
+pub const SYS_init_module: ::c_long = 175;
+pub const SYS_delete_module: ::c_long = 176;
+pub const SYS_get_kernel_syms: ::c_long = 177;
+pub const SYS_query_module: ::c_long = 178;
+pub const SYS_quotactl: ::c_long = 179;
+pub const SYS_nfsservctl: ::c_long = 180;
+pub const SYS_getpmsg: ::c_long = 181;
+pub const SYS_putpmsg: ::c_long = 182;
+pub const SYS_afs_syscall: ::c_long = 183;
+pub const SYS_tuxcall: ::c_long = 184;
+pub const SYS_security: ::c_long = 185;
pub const SYS_gettid: ::c_long = 186;
+pub const SYS_readahead: ::c_long = 187;
+pub const SYS_setxattr: ::c_long = 188;
+pub const SYS_lsetxattr: ::c_long = 189;
+pub const SYS_fsetxattr: ::c_long = 190;
+pub const SYS_getxattr: ::c_long = 191;
+pub const SYS_lgetxattr: ::c_long = 192;
+pub const SYS_fgetxattr: ::c_long = 193;
+pub const SYS_listxattr: ::c_long = 194;
+pub const SYS_llistxattr: ::c_long = 195;
+pub const SYS_flistxattr: ::c_long = 196;
+pub const SYS_removexattr: ::c_long = 197;
+pub const SYS_lremovexattr: ::c_long = 198;
+pub const SYS_fremovexattr: ::c_long = 199;
+pub const SYS_tkill: ::c_long = 200;
+pub const SYS_time: ::c_long = 201;
+pub const SYS_futex: ::c_long = 202;
+pub const SYS_sched_setaffinity: ::c_long = 203;
+pub const SYS_sched_getaffinity: ::c_long = 204;
+pub const SYS_set_thread_area: ::c_long = 205;
+pub const SYS_io_setup: ::c_long = 206;
+pub const SYS_io_destroy: ::c_long = 207;
+pub const SYS_io_getevents: ::c_long = 208;
+pub const SYS_io_submit: ::c_long = 209;
+pub const SYS_io_cancel: ::c_long = 210;
+pub const SYS_get_thread_area: ::c_long = 211;
+pub const SYS_lookup_dcookie: ::c_long = 212;
+pub const SYS_epoll_create: ::c_long = 213;
+pub const SYS_epoll_ctl_old: ::c_long = 214;
+pub const SYS_epoll_wait_old: ::c_long = 215;
+pub const SYS_remap_file_pages: ::c_long = 216;
+pub const SYS_getdents64: ::c_long = 217;
+pub const SYS_set_tid_address: ::c_long = 218;
+pub const SYS_restart_syscall: ::c_long = 219;
+pub const SYS_semtimedop: ::c_long = 220;
+pub const SYS_fadvise64: ::c_long = 221;
+pub const SYS_timer_create: ::c_long = 222;
+pub const SYS_timer_settime: ::c_long = 223;
+pub const SYS_timer_gettime: ::c_long = 224;
+pub const SYS_timer_getoverrun: ::c_long = 225;
+pub const SYS_timer_delete: ::c_long = 226;
+pub const SYS_clock_settime: ::c_long = 227;
+pub const SYS_clock_gettime: ::c_long = 228;
+pub const SYS_clock_getres: ::c_long = 229;
+pub const SYS_clock_nanosleep: ::c_long = 230;
+pub const SYS_exit_group: ::c_long = 231;
+pub const SYS_epoll_wait: ::c_long = 232;
+pub const SYS_epoll_ctl: ::c_long = 233;
+pub const SYS_tgkill: ::c_long = 234;
+pub const SYS_utimes: ::c_long = 235;
+pub const SYS_vserver: ::c_long = 236;
+pub const SYS_mbind: ::c_long = 237;
+pub const SYS_set_mempolicy: ::c_long = 238;
+pub const SYS_get_mempolicy: ::c_long = 239;
+pub const SYS_mq_open: ::c_long = 240;
+pub const SYS_mq_unlink: ::c_long = 241;
+pub const SYS_mq_timedsend: ::c_long = 242;
+pub const SYS_mq_timedreceive: ::c_long = 243;
+pub const SYS_mq_notify: ::c_long = 244;
+pub const SYS_mq_getsetattr: ::c_long = 245;
+pub const SYS_kexec_load: ::c_long = 246;
+pub const SYS_waitid: ::c_long = 247;
+pub const SYS_add_key: ::c_long = 248;
+pub const SYS_request_key: ::c_long = 249;
+pub const SYS_keyctl: ::c_long = 250;
+pub const SYS_ioprio_set: ::c_long = 251;
+pub const SYS_ioprio_get: ::c_long = 252;
+pub const SYS_inotify_init: ::c_long = 253;
+pub const SYS_inotify_add_watch: ::c_long = 254;
+pub const SYS_inotify_rm_watch: ::c_long = 255;
+pub const SYS_migrate_pages: ::c_long = 256;
+pub const SYS_openat: ::c_long = 257;
+pub const SYS_mkdirat: ::c_long = 258;
+pub const SYS_mknodat: ::c_long = 259;
+pub const SYS_fchownat: ::c_long = 260;
+pub const SYS_futimesat: ::c_long = 261;
+pub const SYS_newfstatat: ::c_long = 262;
+pub const SYS_unlinkat: ::c_long = 263;
+pub const SYS_renameat: ::c_long = 264;
+pub const SYS_linkat: ::c_long = 265;
+pub const SYS_symlinkat: ::c_long = 266;
+pub const SYS_readlinkat: ::c_long = 267;
+pub const SYS_fchmodat: ::c_long = 268;
+pub const SYS_faccessat: ::c_long = 269;
+pub const SYS_pselect6: ::c_long = 270;
+pub const SYS_ppoll: ::c_long = 271;
+pub const SYS_unshare: ::c_long = 272;
+pub const SYS_set_robust_list: ::c_long = 273;
+pub const SYS_get_robust_list: ::c_long = 274;
+pub const SYS_splice: ::c_long = 275;
+pub const SYS_tee: ::c_long = 276;
+pub const SYS_sync_file_range: ::c_long = 277;
+pub const SYS_vmsplice: ::c_long = 278;
+pub const SYS_move_pages: ::c_long = 279;
+pub const SYS_utimensat: ::c_long = 280;
+pub const SYS_epoll_pwait: ::c_long = 281;
+pub const SYS_signalfd: ::c_long = 282;
+pub const SYS_timerfd_create: ::c_long = 283;
+pub const SYS_eventfd: ::c_long = 284;
+pub const SYS_fallocate: ::c_long = 285;
+pub const SYS_timerfd_settime: ::c_long = 286;
+pub const SYS_timerfd_gettime: ::c_long = 287;
+pub const SYS_accept4: ::c_long = 288;
+pub const SYS_signalfd4: ::c_long = 289;
+pub const SYS_eventfd2: ::c_long = 290;
+pub const SYS_epoll_create1: ::c_long = 291;
+pub const SYS_dup3: ::c_long = 292;
+pub const SYS_pipe2: ::c_long = 293;
+pub const SYS_inotify_init1: ::c_long = 294;
+pub const SYS_preadv: ::c_long = 295;
+pub const SYS_pwritev: ::c_long = 296;
+pub const SYS_rt_tgsigqueueinfo: ::c_long = 297;
+pub const SYS_perf_event_open: ::c_long = 298;
+pub const SYS_recvmmsg: ::c_long = 299;
+pub const SYS_fanotify_init: ::c_long = 300;
+pub const SYS_fanotify_mark: ::c_long = 301;
+pub const SYS_prlimit64: ::c_long = 302;
+pub const SYS_name_to_handle_at: ::c_long = 303;
+pub const SYS_open_by_handle_at: ::c_long = 304;
+pub const SYS_clock_adjtime: ::c_long = 305;
+pub const SYS_syncfs: ::c_long = 306;
+pub const SYS_sendmmsg: ::c_long = 307;
+pub const SYS_setns: ::c_long = 308;
+pub const SYS_getcpu: ::c_long = 309;
+pub const SYS_process_vm_readv: ::c_long = 310;
+pub const SYS_process_vm_writev: ::c_long = 311;
+pub const SYS_kcmp: ::c_long = 312;
+pub const SYS_finit_module: ::c_long = 313;
+pub const SYS_sched_setattr: ::c_long = 314;
+pub const SYS_sched_getattr: ::c_long = 315;
+pub const SYS_renameat2: ::c_long = 316;
+pub const SYS_seccomp: ::c_long = 317;
+pub const SYS_getrandom: ::c_long = 318;
+pub const SYS_memfd_create: ::c_long = 319;
+pub const SYS_kexec_file_load: ::c_long = 320;
+pub const SYS_bpf: ::c_long = 321;
+pub const SYS_execveat: ::c_long = 322;
+pub const SYS_userfaultfd: ::c_long = 323;
+pub const SYS_membarrier: ::c_long = 324;
+pub const SYS_mlock2: ::c_long = 325;
+pub const SYS_copy_file_range: ::c_long = 326;
+pub const SYS_preadv2: ::c_long = 327;
+pub const SYS_pwritev2: ::c_long = 328;
+pub const SYS_pkey_mprotect: ::c_long = 329;
+pub const SYS_pkey_alloc: ::c_long = 330;
+pub const SYS_pkey_free: ::c_long = 331;
+
+// offsets in user_regs_structs, from sys/reg.h
+pub const R15: ::c_int = 0;
+pub const R14: ::c_int = 1;
+pub const R13: ::c_int = 2;
+pub const R12: ::c_int = 3;
+pub const RBP: ::c_int = 4;
+pub const RBX: ::c_int = 5;
+pub const R11: ::c_int = 6;
+pub const R10: ::c_int = 7;
+pub const R9: ::c_int = 8;
+pub const R8: ::c_int = 9;
+pub const RAX: ::c_int = 10;
+pub const RCX: ::c_int = 11;
+pub const RDX: ::c_int = 12;
+pub const RSI: ::c_int = 13;
+pub const RDI: ::c_int = 14;
+pub const ORIG_RAX: ::c_int = 15;
+pub const RIP: ::c_int = 16;
+pub const CS: ::c_int = 17;
+pub const EFLAGS: ::c_int = 18;
+pub const RSP: ::c_int = 19;
+pub const SS: ::c_int = 20;
+pub const FS_BASE: ::c_int = 21;
+pub const GS_BASE: ::c_int = 22;
+pub const DS: ::c_int = 23;
+pub const ES: ::c_int = 24;
+pub const FS: ::c_int = 25;
+pub const GS: ::c_int = 26;
diff --git a/libc/src/unix/notbsd/android/mod.rs b/libc/src/unix/notbsd/android/mod.rs
index 547d832..d386db9 100644
--- a/libc/src/unix/notbsd/android/mod.rs
+++ b/libc/src/unix/notbsd/android/mod.rs
@@ -1,6 +1,6 @@
//! Android-specific definitions for linux-like values
-use dox::mem;
+use dox::{mem, Option};
pub type clock_t = ::c_long;
pub type time_t = ::c_long;
@@ -12,6 +12,7 @@ pub type nlink_t = u32;
pub type useconds_t = u32;
pub type pthread_t = ::c_long;
pub type pthread_mutexattr_t = ::c_long;
+pub type pthread_rwlockattr_t = ::c_long;
pub type pthread_condattr_t = ::c_long;
pub type fsfilcnt_t = ::c_ulong;
pub type fsblkcnt_t = ::c_ulong;
@@ -21,6 +22,7 @@ pub type dev_t = ::c_ulong;
pub type ino_t = ::c_ulong;
pub type __CPU_BITTYPE = ::c_ulong;
pub type idtype_t = ::c_int;
+pub type loff_t = ::c_longlong;
s! {
pub struct dirent {
@@ -145,11 +147,33 @@ s! {
#[cfg(target_pointer_width = "64")]
__f_reserved: [u32; 6],
}
+
+ pub struct signalfd_siginfo {
+ pub ssi_signo: ::uint32_t,
+ pub ssi_errno: ::int32_t,
+ pub ssi_code: ::int32_t,
+ pub ssi_pid: ::uint32_t,
+ pub ssi_uid: ::uint32_t,
+ pub ssi_fd: ::int32_t,
+ pub ssi_tid: ::uint32_t,
+ pub ssi_band: ::uint32_t,
+ pub ssi_overrun: ::uint32_t,
+ pub ssi_trapno: ::uint32_t,
+ pub ssi_status: ::int32_t,
+ pub ssi_int: ::int32_t,
+ pub ssi_ptr: ::c_ulonglong,
+ pub ssi_utime: ::c_ulonglong,
+ pub ssi_stime: ::c_ulonglong,
+ pub ssi_addr: ::c_ulonglong,
+ pub ssi_addr_lsb: ::uint16_t,
+ _pad: [::uint8_t; 46],
+ }
}
pub const O_TRUNC: ::c_int = 512;
-
pub const O_CLOEXEC: ::c_int = 0x80000;
+pub const O_PATH: ::c_int = 0o10000000;
+pub const O_NOATIME: ::c_int = 0o1000000;
pub const EBFONT: ::c_int = 59;
pub const ENOSTR: ::c_int = 60;
@@ -172,6 +196,9 @@ pub const SA_RESTART: ::c_int = 0x10000000;
pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
+pub const EPOLLONESHOT: ::c_int = 0x40000000;
+pub const EPOLLRDHUP: ::c_int = 0x00002000;
+pub const EPOLLWAKEUP: ::c_int = 0x20000000;
pub const EFD_CLOEXEC: ::c_int = 0x80000;
@@ -190,9 +217,19 @@ pub const _PC_MAX_INPUT: ::c_int = 3;
pub const _PC_NAME_MAX: ::c_int = 4;
pub const _PC_PATH_MAX: ::c_int = 5;
pub const _PC_PIPE_BUF: ::c_int = 6;
+pub const _PC_2_SYMLINKS: ::c_int = 7;
+pub const _PC_ALLOC_SIZE_MIN: ::c_int = 8;
+pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 9;
+pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 10;
+pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 11;
+pub const _PC_REC_XFER_ALIGN: ::c_int = 12;
+pub const _PC_SYMLINK_MAX: ::c_int = 13;
pub const _PC_CHOWN_RESTRICTED: ::c_int = 14;
pub const _PC_NO_TRUNC: ::c_int = 15;
pub const _PC_VDISABLE: ::c_int = 16;
+pub const _PC_ASYNC_IO: ::c_int = 17;
+pub const _PC_PRIO_IO: ::c_int = 18;
+pub const _PC_SYNC_IO: ::c_int = 19;
pub const FIONBIO: ::c_int = 0x5421;
@@ -208,6 +245,7 @@ pub const _SC_EXPR_NEST_MAX: ::c_int = 8;
pub const _SC_LINE_MAX: ::c_int = 9;
pub const _SC_NGROUPS_MAX: ::c_int = 10;
pub const _SC_OPEN_MAX: ::c_int = 11;
+pub const _SC_PASS_MAX: ::c_int = 12;
pub const _SC_2_C_BIND: ::c_int = 13;
pub const _SC_2_C_DEV: ::c_int = 14;
pub const _SC_2_C_VERSION: ::c_int = 15;
@@ -237,7 +275,35 @@ pub const _SC_IOV_MAX: ::c_int = 38;
pub const _SC_PAGESIZE: ::c_int = 39;
pub const _SC_PAGE_SIZE: ::c_int = 40;
pub const _SC_XOPEN_UNIX: ::c_int = 41;
+pub const _SC_XBS5_ILP32_OFF32: ::c_int = 42;
+pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 43;
+pub const _SC_XBS5_LP64_OFF64: ::c_int = 44;
+pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 45;
+pub const _SC_AIO_LISTIO_MAX: ::c_int = 46;
+pub const _SC_AIO_MAX: ::c_int = 47;
+pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 48;
+pub const _SC_DELAYTIMER_MAX: ::c_int = 49;
+pub const _SC_MQ_OPEN_MAX: ::c_int = 50;
pub const _SC_MQ_PRIO_MAX: ::c_int = 51;
+pub const _SC_RTSIG_MAX: ::c_int = 52;
+pub const _SC_SEM_NSEMS_MAX: ::c_int = 53;
+pub const _SC_SEM_VALUE_MAX: ::c_int = 54;
+pub const _SC_SIGQUEUE_MAX: ::c_int = 55;
+pub const _SC_TIMER_MAX: ::c_int = 56;
+pub const _SC_ASYNCHRONOUS_IO: ::c_int = 57;
+pub const _SC_FSYNC: ::c_int = 58;
+pub const _SC_MAPPED_FILES: ::c_int = 59;
+pub const _SC_MEMLOCK: ::c_int = 60;
+pub const _SC_MEMLOCK_RANGE: ::c_int = 61;
+pub const _SC_MEMORY_PROTECTION: ::c_int = 62;
+pub const _SC_MESSAGE_PASSING: ::c_int = 63;
+pub const _SC_PRIORITIZED_IO: ::c_int = 64;
+pub const _SC_PRIORITY_SCHEDULING: ::c_int = 65;
+pub const _SC_REALTIME_SIGNALS: ::c_int = 66;
+pub const _SC_SEMAPHORES: ::c_int = 67;
+pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 68;
+pub const _SC_SYNCHRONIZED_IO: ::c_int = 69;
+pub const _SC_TIMERS: ::c_int = 70;
pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 71;
pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 72;
pub const _SC_LOGIN_NAME_MAX: ::c_int = 73;
@@ -253,7 +319,11 @@ pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 82;
pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 83;
pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 84;
pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 85;
+pub const _SC_NPROCESSORS_CONF: ::c_int = 96;
pub const _SC_NPROCESSORS_ONLN: ::c_int = 97;
+pub const _SC_PHYS_PAGES: ::c_int = 98;
+pub const _SC_AVPHYS_PAGES: ::c_int = 99;
+pub const _SC_MONOTONIC_CLOCK: ::c_int = 100;
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
@@ -417,7 +487,6 @@ pub const SOCK_DGRAM: ::c_int = 2;
pub const SOCK_SEQPACKET: ::c_int = 5;
pub const SOL_SOCKET: ::c_int = 1;
-pub const SOL_UDP: ::c_int = 17;
pub const SOL_SCTP: ::c_int = 132;
pub const SOL_IPX: ::c_int = 256;
pub const SOL_AX25: ::c_int = 257;
@@ -426,7 +495,7 @@ pub const SOL_NETROM: ::c_int = 259;
pub const SOL_ROSE: ::c_int = 260;
#[doc(hidden)]
-pub const AF_MAX: ::c_int = 39;
+pub const AF_MAX: ::c_int = 43;
#[doc(hidden)]
pub const PF_MAX: ::c_int = AF_MAX;
@@ -439,13 +508,27 @@ pub const SO_SNDBUF: ::c_int = 7;
pub const SO_RCVBUF: ::c_int = 8;
pub const SO_KEEPALIVE: ::c_int = 9;
pub const SO_OOBINLINE: ::c_int = 10;
+pub const SO_PRIORITY: ::c_int = 12;
pub const SO_LINGER: ::c_int = 13;
+pub const SO_BSDCOMPAT: ::c_int = 14;
pub const SO_REUSEPORT: ::c_int = 15;
+pub const SO_PASSCRED: ::c_int = 16;
+pub const SO_PEERCRED: ::c_int = 17;
pub const SO_RCVLOWAT: ::c_int = 18;
pub const SO_SNDLOWAT: ::c_int = 19;
pub const SO_RCVTIMEO: ::c_int = 20;
pub const SO_SNDTIMEO: ::c_int = 21;
+pub const SO_BINDTODEVICE: ::c_int = 25;
+pub const SO_TIMESTAMP: ::c_int = 29;
pub const SO_ACCEPTCONN: ::c_int = 30;
+pub const SO_SNDBUFFORCE: ::c_int = 32;
+pub const SO_RCVBUFFORCE: ::c_int = 33;
+pub const SO_MARK: ::c_int = 36;
+pub const SO_PROTOCOL: ::c_int = 38;
+pub const SO_DOMAIN: ::c_int = 39;
+pub const SO_RXQ_OVFL: ::c_int = 40;
+pub const SO_PEEK_OFF: ::c_int = 42;
+pub const SO_BUSY_POLL: ::c_int = 46;
pub const O_ACCMODE: ::c_int = 3;
pub const O_APPEND: ::c_int = 1024;
@@ -456,6 +539,7 @@ pub const O_NONBLOCK: ::c_int = 2048;
pub const O_SYNC: ::c_int = 0x101000;
pub const O_ASYNC: ::c_int = 0x2000;
pub const O_NDELAY: ::c_int = 0x800;
+pub const O_DSYNC: ::c_int = 4096;
pub const NI_MAXHOST: ::size_t = 1025;
@@ -471,6 +555,7 @@ pub const VMIN: usize = 6;
pub const IEXTEN: ::tcflag_t = 0x00008000;
pub const TOSTOP: ::tcflag_t = 0x00000100;
pub const FLUSHO: ::tcflag_t = 0x00001000;
+pub const EXTPROC: ::tcflag_t = 0o200000;
pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
@@ -499,8 +584,6 @@ pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
pub const TMPFS_MAGIC: ::c_long = 0x01021994;
pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
-pub const MADV_HUGEPAGE: ::c_int = 14;
-pub const MADV_NOHUGEPAGE: ::c_int = 15;
pub const MAP_HUGETLB: ::c_int = 0x040000;
pub const PTRACE_TRACEME: ::c_int = 0;
@@ -583,8 +666,6 @@ pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
-pub const SIGSTKSZ: ::size_t = 8192;
-pub const MINSIGSTKSZ: ::size_t = 2048;
pub const CBAUD: ::tcflag_t = 0o0010017;
pub const TAB1: ::c_int = 0x00000800;
pub const TAB2: ::c_int = 0x00001000;
@@ -625,6 +706,15 @@ pub const ISIG: ::tcflag_t = 0x00000001;
pub const ICANON: ::tcflag_t = 0x00000002;
pub const PENDIN: ::tcflag_t = 0x00004000;
pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const VSWTC: usize = 7;
+pub const OLCUC: ::tcflag_t = 0o000002;
+pub const NLDLY: ::tcflag_t = 0o000400;
+pub const CRDLY: ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY: ::tcflag_t = 0o020000;
+pub const FFDLY: ::tcflag_t = 0o100000;
+pub const VTDLY: ::tcflag_t = 0o040000;
+pub const XTABS: ::tcflag_t = 0o014000;
pub const B0: ::speed_t = 0o000000;
pub const B50: ::speed_t = 0o000001;
@@ -723,6 +813,34 @@ pub const NLA_TYPE_MASK: ::c_int = !(NLA_F_NESTED | NLA_F_NET_BYTEORDER);
pub const SIGEV_THREAD_ID: ::c_int = 4;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x008;
+pub const TIOCM_SR: ::c_int = 0x010;
+pub const TIOCM_CTS: ::c_int = 0x020;
+pub const TIOCM_CAR: ::c_int = 0x040;
+pub const TIOCM_RNG: ::c_int = 0x080;
+pub const TIOCM_DSR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+
+pub const POLLWRNORM: ::c_short = 0x100;
+pub const POLLWRBAND: ::c_short = 0x200;
+
+pub const SFD_CLOEXEC: ::c_int = O_CLOEXEC;
+pub const SFD_NONBLOCK: ::c_int = O_NONBLOCK;
+
+pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK;
+
+pub const SO_ORIGINAL_DST: ::c_int = 80;
+pub const IUTF8: ::tcflag_t = 0x00004000;
+pub const CMSPAR: ::tcflag_t = 0o10000000000;
+pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
+
f! {
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
for slot in cpuset.__bits.iter_mut() {
@@ -802,6 +920,163 @@ extern {
pub fn posix_fallocate(fd: ::c_int, offset: ::off_t,
len: ::off_t) -> ::c_int;
+ pub fn signalfd(fd: ::c_int, mask: *const ::sigset_t, flags: ::c_int)
+ -> ::c_int;
+ pub fn syscall(num: ::c_long, ...) -> ::c_long;
+ pub fn sched_getaffinity(pid: ::pid_t,
+ cpusetsize: ::size_t,
+ cpuset: *mut cpu_set_t) -> ::c_int;
+ pub fn sched_setaffinity(pid: ::pid_t,
+ cpusetsize: ::size_t,
+ cpuset: *const cpu_set_t) -> ::c_int;
+ pub fn epoll_create(size: ::c_int) -> ::c_int;
+ pub fn epoll_create1(flags: ::c_int) -> ::c_int;
+ pub fn epoll_wait(epfd: ::c_int,
+ events: *mut ::epoll_event,
+ maxevents: ::c_int,
+ timeout: ::c_int) -> ::c_int;
+ pub fn epoll_ctl(epfd: ::c_int,
+ op: ::c_int,
+ fd: ::c_int,
+ event: *mut ::epoll_event) -> ::c_int;
+ pub fn pthread_getschedparam(native: ::pthread_t,
+ policy: *mut ::c_int,
+ param: *mut ::sched_param) -> ::c_int;
+ pub fn unshare(flags: ::c_int) -> ::c_int;
+ pub fn umount(target: *const ::c_char) -> ::c_int;
+ pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
+ pub fn tee(fd_in: ::c_int,
+ fd_out: ::c_int,
+ len: ::size_t,
+ flags: ::c_uint) -> ::ssize_t;
+ pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
+ pub fn splice(fd_in: ::c_int,
+ off_in: *mut ::loff_t,
+ fd_out: ::c_int,
+ off_out: *mut ::loff_t,
+ len: ::size_t,
+ flags: ::c_uint) -> ::ssize_t;
+ pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
+ pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn sem_timedwait(sem: *mut sem_t,
+ abstime: *const ::timespec) -> ::c_int;
+ pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int;
+ pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int;
+ pub fn swapoff(puath: *const ::c_char) -> ::c_int;
+ pub fn vmsplice(fd: ::c_int,
+ iov: *const ::iovec,
+ nr_segs: ::size_t,
+ flags: ::c_uint) -> ::ssize_t;
+ pub fn mount(src: *const ::c_char,
+ target: *const ::c_char,
+ fstype: *const ::c_char,
+ flags: ::c_ulong,
+ data: *const ::c_void) -> ::c_int;
+ pub fn personality(persona: ::c_ulong) -> ::c_int;
+ pub fn prctl(option: ::c_int, ...) -> ::c_int;
+ pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int;
+ pub fn ppoll(fds: *mut ::pollfd,
+ nfds: nfds_t,
+ timeout: *const ::timespec,
+ sigmask: *const sigset_t) -> ::c_int;
+ pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
+ abstime: *const ::timespec) -> ::c_int;
+ pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int,
+ child_stack: *mut ::c_void,
+ flags: ::c_int,
+ arg: *mut ::c_void, ...) -> ::c_int;
+ pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
+ pub fn clock_nanosleep(clk_id: ::clockid_t,
+ flags: ::c_int,
+ rqtp: *const ::timespec,
+ rmtp: *mut ::timespec) -> ::c_int;
+ pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
+ guardsize: *mut ::size_t) -> ::c_int;
+ pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
+ pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
+ pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
+ pshared: *mut ::c_int) -> ::c_int;
+ pub fn sysinfo(info: *mut ::sysinfo) -> ::c_int;
+ pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int;
+ pub fn pthread_setschedparam(native: ::pthread_t,
+ policy: ::c_int,
+ param: *const ::sched_param) -> ::c_int;
+ pub fn swapon(path: *const ::c_char, swapflags: ::c_int) -> ::c_int;
+ pub fn sched_setscheduler(pid: ::pid_t,
+ policy: ::c_int,
+ param: *const ::sched_param) -> ::c_int;
+ pub fn sendfile(out_fd: ::c_int,
+ in_fd: ::c_int,
+ offset: *mut off_t,
+ count: ::size_t) -> ::ssize_t;
+ pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
+ pub fn getgrgid_r(uid: ::uid_t,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "sigaltstack$UNIX2003")]
+ #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
+ pub fn sigaltstack(ss: *const stack_t,
+ oss: *mut stack_t) -> ::c_int;
+ pub fn sem_close(sem: *mut sem_t) -> ::c_int;
+ pub fn getdtablesize() -> ::c_int;
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
+ pub fn getgrnam_r(name: *const ::c_char,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_sigmask$UNIX2003")]
+ pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
+ oldset: *mut sigset_t) -> ::c_int;
+ pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
+ pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+ pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+ pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
+ pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
+ pub fn getpwnam_r(name: *const ::c_char,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
+ pub fn getpwuid_r(uid: ::uid_t,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
+ link_name = "sigwait$UNIX2003")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+ pub fn sigwait(set: *const sigset_t,
+ sig: *mut ::c_int) -> ::c_int;
+ pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+ parent: Option<unsafe extern fn()>,
+ child: Option<unsafe extern fn()>) -> ::c_int;
+ pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+ pub fn getgrouplist(user: *const ::c_char,
+ group: ::gid_t,
+ groups: *mut ::gid_t,
+ ngroups: *mut ::c_int) -> ::c_int;
+ pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
+ pshared: *mut ::c_int) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "popen$UNIX2003")]
+ pub fn popen(command: *const c_char,
+ mode: *const c_char) -> *mut ::FILE;
+ pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
+ mode: ::c_int, flags: ::c_int) -> ::c_int;
+ pub fn pthread_create(native: *mut ::pthread_t,
+ attr: *const ::pthread_attr_t,
+ f: extern fn(*mut ::c_void) -> *mut ::c_void,
+ value: *mut ::c_void) -> ::c_int;
}
cfg_if! {
diff --git a/libc/src/unix/notbsd/emscripten.rs b/libc/src/unix/notbsd/emscripten.rs
new file mode 100644
index 0000000..90c056c
--- /dev/null
+++ b/libc/src/unix/notbsd/emscripten.rs
@@ -0,0 +1,1667 @@
+use dox::{mem, Option};
+
+pub type c_char = i8;
+pub type wchar_t = i32;
+pub type useconds_t = u32;
+pub type dev_t = u32;
+pub type socklen_t = u32;
+pub type pthread_t = c_ulong;
+pub type mode_t = u32;
+pub type ino64_t = u32;
+pub type off64_t = i32;
+pub type blkcnt64_t = i32;
+pub type rlim64_t = u64;
+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;
+pub type idtype_t = ::c_uint;
+pub type loff_t = i32;
+
+pub type clock_t = c_long;
+pub type time_t = c_long;
+pub type suseconds_t = c_long;
+pub type ino_t = u32;
+pub type off_t = i32;
+pub type blkcnt_t = i32;
+
+pub type blksize_t = c_long;
+pub type fsblkcnt_t = u32;
+pub type fsfilcnt_t = u32;
+pub type rlim_t = ::c_ulonglong;
+pub type c_long = i32;
+pub type c_ulong = u32;
+pub type nlink_t = u32;
+
+pub enum fpos64_t {} // TODO: fill this out with a struct
+
+s! {
+ pub struct dirent {
+ pub d_ino: ::ino_t,
+ pub d_off: ::off_t,
+ pub d_reclen: ::c_ushort,
+ pub d_type: ::c_uchar,
+ pub d_name: [::c_char; 256],
+ }
+
+ pub struct dirent64 {
+ pub d_ino: ::ino64_t,
+ pub d_off: ::off64_t,
+ pub d_reclen: ::c_ushort,
+ pub d_type: ::c_uchar,
+ pub d_name: [::c_char; 256],
+ }
+
+ pub struct rlimit64 {
+ pub rlim_cur: rlim64_t,
+ pub rlim_max: rlim64_t,
+ }
+
+ pub struct glob_t {
+ pub gl_pathc: ::size_t,
+ pub gl_pathv: *mut *mut c_char,
+ pub gl_offs: ::size_t,
+ pub gl_flags: ::c_int,
+
+ __unused1: *mut ::c_void,
+ __unused2: *mut ::c_void,
+ __unused3: *mut ::c_void,
+ __unused4: *mut ::c_void,
+ __unused5: *mut ::c_void,
+ }
+
+ pub struct ifaddrs {
+ pub ifa_next: *mut ifaddrs,
+ pub ifa_name: *mut c_char,
+ pub ifa_flags: ::c_uint,
+ pub ifa_addr: *mut ::sockaddr,
+ pub ifa_netmask: *mut ::sockaddr,
+ pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
+ pub ifa_data: *mut ::c_void
+ }
+
+ pub struct pthread_mutex_t {
+ __align: [::c_long; 0],
+ size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
+ }
+
+ pub struct pthread_rwlock_t {
+ __align: [::c_long; 0],
+ size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
+ }
+
+ pub struct pthread_mutexattr_t {
+ __align: [::c_int; 0],
+ size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
+ }
+
+ pub struct pthread_rwlockattr_t {
+ __align: [::c_int; 0],
+ size: [u8; __SIZEOF_PTHREAD_RWLOCKATTR_T],
+ }
+
+ pub struct pthread_cond_t {
+ __align: [*const ::c_void; 0],
+ size: [u8; __SIZEOF_PTHREAD_COND_T],
+ }
+
+ pub struct pthread_condattr_t {
+ __align: [::c_int; 0],
+ size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
+ }
+
+ 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_gecos: *mut ::c_char,
+ pub pw_dir: *mut ::c_char,
+ 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,
+ 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,
+ __f_unused: ::c_int,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ __f_spare: [::c_int; 6],
+ }
+
+ pub struct dqblk {
+ pub dqb_bhardlimit: ::uint64_t,
+ pub dqb_bsoftlimit: ::uint64_t,
+ pub dqb_curspace: ::uint64_t,
+ pub dqb_ihardlimit: ::uint64_t,
+ pub dqb_isoftlimit: ::uint64_t,
+ pub dqb_curinodes: ::uint64_t,
+ pub dqb_btime: ::uint64_t,
+ pub dqb_itime: ::uint64_t,
+ pub dqb_valid: ::uint32_t,
+ }
+
+ pub struct signalfd_siginfo {
+ pub ssi_signo: ::uint32_t,
+ pub ssi_errno: ::int32_t,
+ pub ssi_code: ::int32_t,
+ pub ssi_pid: ::uint32_t,
+ pub ssi_uid: ::uint32_t,
+ pub ssi_fd: ::int32_t,
+ pub ssi_tid: ::uint32_t,
+ pub ssi_band: ::uint32_t,
+ pub ssi_overrun: ::uint32_t,
+ pub ssi_trapno: ::uint32_t,
+ pub ssi_status: ::int32_t,
+ pub ssi_int: ::int32_t,
+ pub ssi_ptr: ::uint64_t,
+ pub ssi_utime: ::uint64_t,
+ pub ssi_stime: ::uint64_t,
+ pub ssi_addr: ::uint64_t,
+ _pad: [::uint8_t; 48],
+ }
+
+ pub struct fsid_t {
+ __val: [::c_int; 2],
+ }
+
+ pub struct mq_attr {
+ pub mq_flags: ::c_long,
+ pub mq_maxmsg: ::c_long,
+ pub mq_msgsize: ::c_long,
+ pub mq_curmsgs: ::c_long,
+ pad: [::c_long; 4]
+ }
+
+ pub struct cpu_set_t {
+ bits: [u32; 32],
+ }
+
+ pub struct if_nameindex {
+ pub if_index: ::c_uint,
+ 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 struct mmsghdr {
+ pub msg_hdr: ::msghdr,
+ pub msg_len: ::c_uint,
+ }
+
+ pub struct sembuf {
+ pub sem_num: ::c_ushort,
+ pub sem_op: ::c_short,
+ pub sem_flg: ::c_short,
+ }
+
+ pub struct aiocb {
+ pub aio_fildes: ::c_int,
+ pub aio_lio_opcode: ::c_int,
+ pub aio_reqprio: ::c_int,
+ pub aio_buf: *mut ::c_void,
+ pub aio_nbytes: ::size_t,
+ pub aio_sigevent: ::sigevent,
+ __td: *mut ::c_void,
+ __lock: [::c_int; 2],
+ __err: ::c_int,
+ __ret: ::ssize_t,
+ pub aio_offset: off_t,
+ __next: *mut ::c_void,
+ __prev: *mut ::c_void,
+ __dummy4: [::c_char; 24],
+ }
+
+ pub struct sigaction {
+ pub sa_sigaction: ::sighandler_t,
+ pub sa_mask: ::sigset_t,
+ pub sa_flags: ::c_int,
+ pub sa_restorer: ::dox::Option<extern fn()>,
+ }
+
+ pub struct ipc_perm {
+ pub __ipc_perm_key: ::key_t,
+ pub uid: ::uid_t,
+ pub gid: ::gid_t,
+ pub cuid: ::uid_t,
+ pub cgid: ::gid_t,
+ pub mode: ::mode_t,
+ pub __seq: ::c_int,
+ __unused1: ::c_long,
+ __unused2: ::c_long
+ }
+
+ 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: ::cc_t,
+ pub c_cc: [::cc_t; ::NCCS],
+ pub __c_ispeed: ::speed_t,
+ pub __c_ospeed: ::speed_t,
+ }
+
+ pub struct flock {
+ pub l_type: ::c_short,
+ pub l_whence: ::c_short,
+ pub l_start: ::off_t,
+ pub l_len: ::off_t,
+ pub l_pid: ::pid_t,
+ }
+
+ pub struct sysinfo {
+ pub uptime: ::c_ulong,
+ pub loads: [::c_ulong; 3],
+ pub totalram: ::c_ulong,
+ pub freeram: ::c_ulong,
+ pub sharedram: ::c_ulong,
+ pub bufferram: ::c_ulong,
+ pub totalswap: ::c_ulong,
+ pub freeswap: ::c_ulong,
+ pub procs: ::c_ushort,
+ pub pad: ::c_ushort,
+ pub totalhigh: ::c_ulong,
+ pub freehigh: ::c_ulong,
+ pub mem_unit: ::c_uint,
+ pub __reserved: [::c_char; 256],
+ }
+
+ pub struct pthread_attr_t {
+ __size: [u32; 11]
+ }
+
+ pub struct sigset_t {
+ __val: [::c_ulong; 32],
+ }
+
+ 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 cmsghdr {
+ pub cmsg_len: ::socklen_t,
+ pub cmsg_level: ::c_int,
+ pub cmsg_type: ::c_int,
+ }
+
+ pub struct sem_t {
+ __val: [::c_int; 4],
+ }
+ pub struct stat {
+ pub st_dev: ::dev_t,
+ __st_dev_padding: ::c_int,
+ __st_ino_truncated: ::c_long,
+ pub st_mode: ::mode_t,
+ pub st_nlink: ::nlink_t,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub st_rdev: ::dev_t,
+ __st_rdev_padding: ::c_int,
+ pub st_size: ::off_t,
+ pub st_blksize: ::blksize_t,
+ pub st_blocks: ::blkcnt_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_ino: ::ino_t,
+ }
+
+ pub struct stat64 {
+ pub st_dev: ::dev_t,
+ __st_dev_padding: ::c_int,
+ __st_ino_truncated: ::c_long,
+ pub st_mode: ::mode_t,
+ pub st_nlink: ::nlink_t,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub st_rdev: ::dev_t,
+ __st_rdev_padding: ::c_int,
+ pub st_size: ::off_t,
+ pub st_blksize: ::blksize_t,
+ pub st_blocks: ::blkcnt_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_ino: ::ino_t,
+ }
+
+ pub struct stack_t {
+ pub ss_sp: *mut ::c_void,
+ pub ss_flags: ::c_int,
+ pub ss_size: ::size_t
+ }
+
+ pub struct shmid_ds {
+ pub shm_perm: ::ipc_perm,
+ pub shm_segsz: ::size_t,
+ pub shm_atime: ::time_t,
+ __unused1: ::c_int,
+ pub shm_dtime: ::time_t,
+ __unused2: ::c_int,
+ pub shm_ctime: ::time_t,
+ __unused3: ::c_int,
+ pub shm_cpid: ::pid_t,
+ pub shm_lpid: ::pid_t,
+ pub shm_nattch: ::c_ulong,
+ __pad1: ::c_ulong,
+ __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,
+ 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_fsid: ::fsid_t,
+ pub f_namelen: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_flags: ::c_ulong,
+ pub f_spare: [::c_ulong; 4],
+ }
+
+ pub struct siginfo_t {
+ pub si_signo: ::c_int,
+ pub si_errno: ::c_int,
+ pub si_code: ::c_int,
+ pub _pad: [::c_int; 29],
+ _align: [usize; 0],
+ }
+
+ pub struct statfs64 {
+ pub f_type: ::c_ulong,
+ pub f_bsize: ::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_fsid: ::fsid_t,
+ pub f_namelen: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_flags: ::c_ulong,
+ pub f_spare: [::c_ulong; 4],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: u32,
+ pub f_bfree: u32,
+ pub f_bavail: u32,
+ pub f_files: u32,
+ pub f_ffree: u32,
+ pub f_favail: u32,
+ pub f_fsid: ::c_ulong,
+ __f_unused: ::c_int,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ __f_spare: [::c_int; 6],
+ }
+}
+
+pub const ABDAY_1: ::nl_item = 0x20000;
+pub const ABDAY_2: ::nl_item = 0x20001;
+pub const ABDAY_3: ::nl_item = 0x20002;
+pub const ABDAY_4: ::nl_item = 0x20003;
+pub const ABDAY_5: ::nl_item = 0x20004;
+pub const ABDAY_6: ::nl_item = 0x20005;
+pub const ABDAY_7: ::nl_item = 0x20006;
+
+pub const DAY_1: ::nl_item = 0x20007;
+pub const DAY_2: ::nl_item = 0x20008;
+pub const DAY_3: ::nl_item = 0x20009;
+pub const DAY_4: ::nl_item = 0x2000A;
+pub const DAY_5: ::nl_item = 0x2000B;
+pub const DAY_6: ::nl_item = 0x2000C;
+pub const DAY_7: ::nl_item = 0x2000D;
+
+pub const ABMON_1: ::nl_item = 0x2000E;
+pub const ABMON_2: ::nl_item = 0x2000F;
+pub const ABMON_3: ::nl_item = 0x20010;
+pub const ABMON_4: ::nl_item = 0x20011;
+pub const ABMON_5: ::nl_item = 0x20012;
+pub const ABMON_6: ::nl_item = 0x20013;
+pub const ABMON_7: ::nl_item = 0x20014;
+pub const ABMON_8: ::nl_item = 0x20015;
+pub const ABMON_9: ::nl_item = 0x20016;
+pub const ABMON_10: ::nl_item = 0x20017;
+pub const ABMON_11: ::nl_item = 0x20018;
+pub const ABMON_12: ::nl_item = 0x20019;
+
+pub const MON_1: ::nl_item = 0x2001A;
+pub const MON_2: ::nl_item = 0x2001B;
+pub const MON_3: ::nl_item = 0x2001C;
+pub const MON_4: ::nl_item = 0x2001D;
+pub const MON_5: ::nl_item = 0x2001E;
+pub const MON_6: ::nl_item = 0x2001F;
+pub const MON_7: ::nl_item = 0x20020;
+pub const MON_8: ::nl_item = 0x20021;
+pub const MON_9: ::nl_item = 0x20022;
+pub const MON_10: ::nl_item = 0x20023;
+pub const MON_11: ::nl_item = 0x20024;
+pub const MON_12: ::nl_item = 0x20025;
+
+pub const AM_STR: ::nl_item = 0x20026;
+pub const PM_STR: ::nl_item = 0x20027;
+
+pub const D_T_FMT: ::nl_item = 0x20028;
+pub const D_FMT: ::nl_item = 0x20029;
+pub const T_FMT: ::nl_item = 0x2002A;
+pub const T_FMT_AMPM: ::nl_item = 0x2002B;
+
+pub const ERA: ::nl_item = 0x2002C;
+pub const ERA_D_FMT: ::nl_item = 0x2002E;
+pub const ALT_DIGITS: ::nl_item = 0x2002F;
+pub const ERA_D_T_FMT: ::nl_item = 0x20030;
+pub const ERA_T_FMT: ::nl_item = 0x20031;
+
+pub const CODESET: ::nl_item = 14;
+
+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;
+
+pub const YESEXPR: ::nl_item = 0x50000;
+pub const NOEXPR: ::nl_item = 0x50001;
+pub const YESSTR: ::nl_item = 0x50002;
+pub const NOSTR: ::nl_item = 0x50003;
+
+pub const FILENAME_MAX: ::c_uint = 4096;
+pub const L_tmpnam: ::c_uint = 20;
+pub const _PC_LINK_MAX: ::c_int = 0;
+pub const _PC_MAX_CANON: ::c_int = 1;
+pub const _PC_MAX_INPUT: ::c_int = 2;
+pub const _PC_NAME_MAX: ::c_int = 3;
+pub const _PC_PATH_MAX: ::c_int = 4;
+pub const _PC_PIPE_BUF: ::c_int = 5;
+pub const _PC_CHOWN_RESTRICTED: ::c_int = 6;
+pub const _PC_NO_TRUNC: ::c_int = 7;
+pub const _PC_VDISABLE: ::c_int = 8;
+pub const _PC_SYNC_IO: ::c_int = 9;
+pub const _PC_ASYNC_IO: ::c_int = 10;
+pub const _PC_PRIO_IO: ::c_int = 11;
+pub const _PC_SOCK_MAXBUF: ::c_int = 12;
+pub const _PC_FILESIZEBITS: ::c_int = 13;
+pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14;
+pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15;
+pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16;
+pub const _PC_REC_XFER_ALIGN: ::c_int = 17;
+pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18;
+pub const _PC_SYMLINK_MAX: ::c_int = 19;
+pub const _PC_2_SYMLINKS: ::c_int = 20;
+
+pub const _SC_ARG_MAX: ::c_int = 0;
+pub const _SC_CHILD_MAX: ::c_int = 1;
+pub const _SC_CLK_TCK: ::c_int = 2;
+pub const _SC_NGROUPS_MAX: ::c_int = 3;
+pub const _SC_OPEN_MAX: ::c_int = 4;
+pub const _SC_STREAM_MAX: ::c_int = 5;
+pub const _SC_TZNAME_MAX: ::c_int = 6;
+pub const _SC_JOB_CONTROL: ::c_int = 7;
+pub const _SC_SAVED_IDS: ::c_int = 8;
+pub const _SC_REALTIME_SIGNALS: ::c_int = 9;
+pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10;
+pub const _SC_TIMERS: ::c_int = 11;
+pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12;
+pub const _SC_PRIORITIZED_IO: ::c_int = 13;
+pub const _SC_SYNCHRONIZED_IO: ::c_int = 14;
+pub const _SC_FSYNC: ::c_int = 15;
+pub const _SC_MAPPED_FILES: ::c_int = 16;
+pub const _SC_MEMLOCK: ::c_int = 17;
+pub const _SC_MEMLOCK_RANGE: ::c_int = 18;
+pub const _SC_MEMORY_PROTECTION: ::c_int = 19;
+pub const _SC_MESSAGE_PASSING: ::c_int = 20;
+pub const _SC_SEMAPHORES: ::c_int = 21;
+pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22;
+pub const _SC_AIO_LISTIO_MAX: ::c_int = 23;
+pub const _SC_AIO_MAX: ::c_int = 24;
+pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25;
+pub const _SC_DELAYTIMER_MAX: ::c_int = 26;
+pub const _SC_MQ_OPEN_MAX: ::c_int = 27;
+pub const _SC_MQ_PRIO_MAX: ::c_int = 28;
+pub const _SC_VERSION: ::c_int = 29;
+pub const _SC_PAGESIZE: ::c_int = 30;
+pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
+pub const _SC_RTSIG_MAX: ::c_int = 31;
+pub const _SC_SEM_NSEMS_MAX: ::c_int = 32;
+pub const _SC_SEM_VALUE_MAX: ::c_int = 33;
+pub const _SC_SIGQUEUE_MAX: ::c_int = 34;
+pub const _SC_TIMER_MAX: ::c_int = 35;
+pub const _SC_BC_BASE_MAX: ::c_int = 36;
+pub const _SC_BC_DIM_MAX: ::c_int = 37;
+pub const _SC_BC_SCALE_MAX: ::c_int = 38;
+pub const _SC_BC_STRING_MAX: ::c_int = 39;
+pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40;
+pub const _SC_EXPR_NEST_MAX: ::c_int = 42;
+pub const _SC_LINE_MAX: ::c_int = 43;
+pub const _SC_RE_DUP_MAX: ::c_int = 44;
+pub const _SC_2_VERSION: ::c_int = 46;
+pub const _SC_2_C_BIND: ::c_int = 47;
+pub const _SC_2_C_DEV: ::c_int = 48;
+pub const _SC_2_FORT_DEV: ::c_int = 49;
+pub const _SC_2_FORT_RUN: ::c_int = 50;
+pub const _SC_2_SW_DEV: ::c_int = 51;
+pub const _SC_2_LOCALEDEF: ::c_int = 52;
+pub const _SC_UIO_MAXIOV: ::c_int = 60;
+pub const _SC_IOV_MAX: ::c_int = 60;
+pub const _SC_THREADS: ::c_int = 67;
+pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68;
+pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 69;
+pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 70;
+pub const _SC_LOGIN_NAME_MAX: ::c_int = 71;
+pub const _SC_TTY_NAME_MAX: ::c_int = 72;
+pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 73;
+pub const _SC_THREAD_KEYS_MAX: ::c_int = 74;
+pub const _SC_THREAD_STACK_MIN: ::c_int = 75;
+pub const _SC_THREAD_THREADS_MAX: ::c_int = 76;
+pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 77;
+pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78;
+pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79;
+pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80;
+pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81;
+pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 82;
+pub const _SC_NPROCESSORS_CONF: ::c_int = 83;
+pub const _SC_NPROCESSORS_ONLN: ::c_int = 84;
+pub const _SC_PHYS_PAGES: ::c_int = 85;
+pub const _SC_AVPHYS_PAGES: ::c_int = 86;
+pub const _SC_ATEXIT_MAX: ::c_int = 87;
+pub const _SC_PASS_MAX: ::c_int = 88;
+pub const _SC_XOPEN_VERSION: ::c_int = 89;
+pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90;
+pub const _SC_XOPEN_UNIX: ::c_int = 91;
+pub const _SC_XOPEN_CRYPT: ::c_int = 92;
+pub const _SC_XOPEN_ENH_I18N: ::c_int = 93;
+pub const _SC_XOPEN_SHM: ::c_int = 94;
+pub const _SC_2_CHAR_TERM: ::c_int = 95;
+pub const _SC_2_UPE: ::c_int = 97;
+pub const _SC_XOPEN_XPG2: ::c_int = 98;
+pub const _SC_XOPEN_XPG3: ::c_int = 99;
+pub const _SC_XOPEN_XPG4: ::c_int = 100;
+pub const _SC_NZERO: ::c_int = 109;
+pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125;
+pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126;
+pub const _SC_XBS5_LP64_OFF64: ::c_int = 127;
+pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128;
+pub const _SC_XOPEN_LEGACY: ::c_int = 129;
+pub const _SC_XOPEN_REALTIME: ::c_int = 130;
+pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131;
+pub const _SC_ADVISORY_INFO: ::c_int = 132;
+pub const _SC_BARRIERS: ::c_int = 133;
+pub const _SC_CLOCK_SELECTION: ::c_int = 137;
+pub const _SC_CPUTIME: ::c_int = 138;
+pub const _SC_THREAD_CPUTIME: ::c_int = 139;
+pub const _SC_MONOTONIC_CLOCK: ::c_int = 149;
+pub const _SC_READER_WRITER_LOCKS: ::c_int = 153;
+pub const _SC_SPIN_LOCKS: ::c_int = 154;
+pub const _SC_REGEXP: ::c_int = 155;
+pub const _SC_SHELL: ::c_int = 157;
+pub const _SC_SPAWN: ::c_int = 159;
+pub const _SC_SPORADIC_SERVER: ::c_int = 160;
+pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 161;
+pub const _SC_TIMEOUTS: ::c_int = 164;
+pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 165;
+pub const _SC_2_PBS: ::c_int = 168;
+pub const _SC_2_PBS_ACCOUNTING: ::c_int = 169;
+pub const _SC_2_PBS_LOCATE: ::c_int = 170;
+pub const _SC_2_PBS_MESSAGE: ::c_int = 171;
+pub const _SC_2_PBS_TRACK: ::c_int = 172;
+pub const _SC_SYMLOOP_MAX: ::c_int = 173;
+pub const _SC_STREAMS: ::c_int = 174;
+pub const _SC_2_PBS_CHECKPOINT: ::c_int = 175;
+pub const _SC_V6_ILP32_OFF32: ::c_int = 176;
+pub const _SC_V6_ILP32_OFFBIG: ::c_int = 177;
+pub const _SC_V6_LP64_OFF64: ::c_int = 178;
+pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 179;
+pub const _SC_HOST_NAME_MAX: ::c_int = 180;
+pub const _SC_TRACE: ::c_int = 181;
+pub const _SC_TRACE_EVENT_FILTER: ::c_int = 182;
+pub const _SC_TRACE_INHERIT: ::c_int = 183;
+pub const _SC_TRACE_LOG: ::c_int = 184;
+pub const _SC_IPV6: ::c_int = 235;
+pub const _SC_RAW_SOCKETS: ::c_int = 236;
+pub const _SC_V7_ILP32_OFF32: ::c_int = 237;
+pub const _SC_V7_ILP32_OFFBIG: ::c_int = 238;
+pub const _SC_V7_LP64_OFF64: ::c_int = 239;
+pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 240;
+pub const _SC_SS_REPL_MAX: ::c_int = 241;
+pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 242;
+pub const _SC_TRACE_NAME_MAX: ::c_int = 243;
+pub const _SC_TRACE_SYS_MAX: ::c_int = 244;
+pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 245;
+pub const _SC_XOPEN_STREAMS: ::c_int = 246;
+pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 247;
+pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248;
+
+pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY;
+pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY;
+
+pub const GLOB_ERR: ::c_int = 1 << 0;
+pub const GLOB_MARK: ::c_int = 1 << 1;
+pub const GLOB_NOSORT: ::c_int = 1 << 2;
+pub const GLOB_DOOFFS: ::c_int = 1 << 3;
+pub const GLOB_NOCHECK: ::c_int = 1 << 4;
+pub const GLOB_APPEND: ::c_int = 1 << 5;
+pub const GLOB_NOESCAPE: ::c_int = 1 << 6;
+
+pub const GLOB_NOSPACE: ::c_int = 1;
+pub const GLOB_ABORTED: ::c_int = 2;
+pub const GLOB_NOMATCH: ::c_int = 3;
+
+pub const POSIX_MADV_NORMAL: ::c_int = 0;
+pub const POSIX_MADV_RANDOM: ::c_int = 1;
+pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
+pub const POSIX_MADV_WILLNEED: ::c_int = 3;
+
+pub const S_IEXEC: mode_t = 64;
+pub const S_IWRITE: mode_t = 128;
+pub const S_IREAD: mode_t = 256;
+
+pub const F_LOCK: ::c_int = 1;
+pub const F_TEST: ::c_int = 3;
+pub const F_TLOCK: ::c_int = 2;
+pub const F_ULOCK: ::c_int = 0;
+
+pub const ST_RDONLY: ::c_ulong = 1;
+pub const ST_NOSUID: ::c_ulong = 2;
+pub const ST_NODEV: ::c_ulong = 4;
+pub const ST_NOEXEC: ::c_ulong = 8;
+pub const ST_SYNCHRONOUS: ::c_ulong = 16;
+pub const ST_MANDLOCK: ::c_ulong = 64;
+pub const ST_WRITE: ::c_ulong = 128;
+pub const ST_APPEND: ::c_ulong = 256;
+pub const ST_IMMUTABLE: ::c_ulong = 512;
+pub const ST_NOATIME: ::c_ulong = 1024;
+pub const ST_NODIRATIME: ::c_ulong = 2048;
+
+pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void;
+pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
+pub const RTLD_NODELETE: ::c_int = 0x1000;
+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],
+};
+pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
+pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
+pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
+pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
+pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0;
+pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
+pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
+
+pub const SCHED_OTHER: ::c_int = 0;
+pub const SCHED_FIFO: ::c_int = 1;
+pub const SCHED_RR: ::c_int = 2;
+pub const SCHED_BATCH: ::c_int = 3;
+pub const SCHED_IDLE: ::c_int = 5;
+
+pub const AF_IB: ::c_int = 27;
+pub const AF_MPLS: ::c_int = 28;
+pub const AF_NFC: ::c_int = 39;
+pub const AF_VSOCK: ::c_int = 40;
+#[doc(hidden)]
+pub const AF_MAX: ::c_int = 42;
+pub const PF_IB: ::c_int = AF_IB;
+pub const PF_MPLS: ::c_int = AF_MPLS;
+pub const PF_NFC: ::c_int = AF_NFC;
+pub const PF_VSOCK: ::c_int = AF_VSOCK;
+#[doc(hidden)]
+pub const PF_MAX: ::c_int = AF_MAX;
+
+// 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;
+
+pub const IPC_RMID: ::c_int = 0;
+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;
+
+pub const SHM_RDONLY: ::c_int = 0o10000;
+pub const SHM_RND: ::c_int = 0o20000;
+pub const SHM_REMAP: ::c_int = 0o40000;
+pub const SHM_EXEC: ::c_int = 0o100000;
+
+pub const SHM_LOCK: ::c_int = 11;
+pub const SHM_UNLOCK: ::c_int = 12;
+
+pub const SHM_HUGETLB: ::c_int = 0o4000;
+pub const SHM_NORESERVE: ::c_int = 0o10000;
+
+pub const EPOLLRDHUP: ::c_int = 0x2000;
+pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000;
+pub const EPOLLONESHOT: ::c_int = 0x40000000;
+
+pub const QFMT_VFS_OLD: ::c_int = 1;
+pub const QFMT_VFS_V0: ::c_int = 2;
+
+pub const EFD_SEMAPHORE: ::c_int = 0x1;
+
+pub const LOG_NFACILITIES: ::c_int = 24;
+
+pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t;
+
+pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32;
+pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32;
+pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32;
+pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32;
+pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32;
+pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32;
+pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32;
+
+pub const AI_PASSIVE: ::c_int = 0x0001;
+pub const AI_CANONNAME: ::c_int = 0x0002;
+pub const AI_NUMERICHOST: ::c_int = 0x0004;
+pub const AI_V4MAPPED: ::c_int = 0x0008;
+pub const AI_ALL: ::c_int = 0x0010;
+pub const AI_ADDRCONFIG: ::c_int = 0x0020;
+
+pub const AI_NUMERICSERV: ::c_int = 0x0400;
+
+pub const EAI_BADFLAGS: ::c_int = -1;
+pub const EAI_NONAME: ::c_int = -2;
+pub const EAI_AGAIN: ::c_int = -3;
+pub const EAI_FAIL: ::c_int = -4;
+pub const EAI_FAMILY: ::c_int = -6;
+pub const EAI_SOCKTYPE: ::c_int = -7;
+pub const EAI_SERVICE: ::c_int = -8;
+pub const EAI_MEMORY: ::c_int = -10;
+pub const EAI_OVERFLOW: ::c_int = -12;
+
+pub const NI_NUMERICHOST: ::c_int = 1;
+pub const NI_NUMERICSERV: ::c_int = 2;
+pub const NI_NOFQDN: ::c_int = 4;
+pub const NI_NAMEREQD: ::c_int = 8;
+pub const NI_DGRAM: ::c_int = 16;
+
+pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1;
+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;
+
+pub const AIO_CANCELED: ::c_int = 0;
+pub const AIO_NOTCANCELED: ::c_int = 1;
+pub const AIO_ALLDONE: ::c_int = 2;
+pub const LIO_READ: ::c_int = 0;
+pub const LIO_WRITE: ::c_int = 1;
+pub const LIO_NOP: ::c_int = 2;
+pub const LIO_WAIT: ::c_int = 0;
+pub const LIO_NOWAIT: ::c_int = 1;
+
+pub const MREMAP_MAYMOVE: ::c_int = 1;
+pub const MREMAP_FIXED: ::c_int = 2;
+
+pub const PR_SET_PDEATHSIG: ::c_int = 1;
+pub const PR_GET_PDEATHSIG: ::c_int = 2;
+
+pub const PR_GET_DUMPABLE: ::c_int = 3;
+pub const PR_SET_DUMPABLE: ::c_int = 4;
+
+pub const PR_GET_UNALIGN: ::c_int = 5;
+pub const PR_SET_UNALIGN: ::c_int = 6;
+pub const PR_UNALIGN_NOPRINT: ::c_int = 1;
+pub const PR_UNALIGN_SIGBUS: ::c_int = 2;
+
+pub const PR_GET_KEEPCAPS: ::c_int = 7;
+pub const PR_SET_KEEPCAPS: ::c_int = 8;
+
+pub const PR_GET_FPEMU: ::c_int = 9;
+pub const PR_SET_FPEMU: ::c_int = 10;
+pub const PR_FPEMU_NOPRINT: ::c_int = 1;
+pub const PR_FPEMU_SIGFPE: ::c_int = 2;
+
+pub const PR_GET_FPEXC: ::c_int = 11;
+pub const PR_SET_FPEXC: ::c_int = 12;
+pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80;
+pub const PR_FP_EXC_DIV: ::c_int = 0x010000;
+pub const PR_FP_EXC_OVF: ::c_int = 0x020000;
+pub const PR_FP_EXC_UND: ::c_int = 0x040000;
+pub const PR_FP_EXC_RES: ::c_int = 0x080000;
+pub const PR_FP_EXC_INV: ::c_int = 0x100000;
+pub const PR_FP_EXC_DISABLED: ::c_int = 0;
+pub const PR_FP_EXC_NONRECOV: ::c_int = 1;
+pub const PR_FP_EXC_ASYNC: ::c_int = 2;
+pub const PR_FP_EXC_PRECISE: ::c_int = 3;
+
+pub const PR_GET_TIMING: ::c_int = 13;
+pub const PR_SET_TIMING: ::c_int = 14;
+pub const PR_TIMING_STATISTICAL: ::c_int = 0;
+pub const PR_TIMING_TIMESTAMP: ::c_int = 1;
+
+pub const PR_SET_NAME: ::c_int = 15;
+pub const PR_GET_NAME: ::c_int = 16;
+
+pub const PR_GET_ENDIAN: ::c_int = 19;
+pub const PR_SET_ENDIAN: ::c_int = 20;
+pub const PR_ENDIAN_BIG: ::c_int = 0;
+pub const PR_ENDIAN_LITTLE: ::c_int = 1;
+pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2;
+
+pub const PR_GET_SECCOMP: ::c_int = 21;
+pub const PR_SET_SECCOMP: ::c_int = 22;
+
+pub const PR_CAPBSET_READ: ::c_int = 23;
+pub const PR_CAPBSET_DROP: ::c_int = 24;
+
+pub const PR_GET_TSC: ::c_int = 25;
+pub const PR_SET_TSC: ::c_int = 26;
+pub const PR_TSC_ENABLE: ::c_int = 1;
+pub const PR_TSC_SIGSEGV: ::c_int = 2;
+
+pub const PR_GET_SECUREBITS: ::c_int = 27;
+pub const PR_SET_SECUREBITS: ::c_int = 28;
+
+pub const PR_SET_TIMERSLACK: ::c_int = 29;
+pub const PR_GET_TIMERSLACK: ::c_int = 30;
+
+pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31;
+pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32;
+
+pub const PR_MCE_KILL: ::c_int = 33;
+pub const PR_MCE_KILL_CLEAR: ::c_int = 0;
+pub const PR_MCE_KILL_SET: ::c_int = 1;
+
+pub const PR_MCE_KILL_LATE: ::c_int = 0;
+pub const PR_MCE_KILL_EARLY: ::c_int = 1;
+pub const PR_MCE_KILL_DEFAULT: ::c_int = 2;
+
+pub const PR_MCE_KILL_GET: ::c_int = 34;
+
+pub const PR_SET_MM: ::c_int = 35;
+pub const PR_SET_MM_START_CODE: ::c_int = 1;
+pub const PR_SET_MM_END_CODE: ::c_int = 2;
+pub const PR_SET_MM_START_DATA: ::c_int = 3;
+pub const PR_SET_MM_END_DATA: ::c_int = 4;
+pub const PR_SET_MM_START_STACK: ::c_int = 5;
+pub const PR_SET_MM_START_BRK: ::c_int = 6;
+pub const PR_SET_MM_BRK: ::c_int = 7;
+pub const PR_SET_MM_ARG_START: ::c_int = 8;
+pub const PR_SET_MM_ARG_END: ::c_int = 9;
+pub const PR_SET_MM_ENV_START: ::c_int = 10;
+pub const PR_SET_MM_ENV_END: ::c_int = 11;
+pub const PR_SET_MM_AUXV: ::c_int = 12;
+pub const PR_SET_MM_EXE_FILE: ::c_int = 13;
+pub const PR_SET_MM_MAP: ::c_int = 14;
+pub const PR_SET_MM_MAP_SIZE: ::c_int = 15;
+
+pub const PR_SET_PTRACER: ::c_int = 0x59616d61;
+
+pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36;
+pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37;
+
+pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38;
+pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39;
+
+pub const PR_GET_TID_ADDRESS: ::c_int = 40;
+
+pub const PR_SET_THP_DISABLE: ::c_int = 41;
+pub const PR_GET_THP_DISABLE: ::c_int = 42;
+
+pub const PR_MPX_ENABLE_MANAGEMENT: ::c_int = 43;
+pub const PR_MPX_DISABLE_MANAGEMENT: ::c_int = 44;
+
+pub const PR_SET_FP_MODE: ::c_int = 45;
+pub const PR_GET_FP_MODE: ::c_int = 46;
+pub const PR_FP_MODE_FR: ::c_int = 1 << 0;
+pub const PR_FP_MODE_FRE: ::c_int = 1 << 1;
+
+pub const PR_CAP_AMBIENT: ::c_int = 47;
+pub const PR_CAP_AMBIENT_IS_SET: ::c_int = 1;
+pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2;
+pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3;
+pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4;
+
+pub const ITIMER_REAL: ::c_int = 0;
+pub const ITIMER_VIRTUAL: ::c_int = 1;
+pub const ITIMER_PROF: ::c_int = 2;
+
+pub const XATTR_CREATE: ::c_int = 0x1;
+pub const XATTR_REPLACE: ::c_int = 0x2;
+
+pub const _POSIX_VDISABLE: ::cc_t = 0;
+
+pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
+pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
+pub const FALLOC_FL_COLLAPSE_RANGE: ::c_int = 0x08;
+pub const FALLOC_FL_ZERO_RANGE: ::c_int = 0x10;
+pub const FALLOC_FL_INSERT_RANGE: ::c_int = 0x20;
+pub const FALLOC_FL_UNSHARE_RANGE: ::c_int = 0x40;
+
+// On Linux, libc doesn't define this constant, libattr does instead.
+// We still define it for Linux as it's defined by libc on other platforms,
+// and it's mentioned in the man pages for getxattr and setxattr.
+pub const SFD_CLOEXEC: ::c_int = 0x080000;
+
+pub const NCCS: usize = 32;
+
+pub const O_TRUNC: ::c_int = 512;
+pub const O_NOATIME: ::c_int = 0o1000000;
+pub const O_CLOEXEC: ::c_int = 0x80000;
+
+pub const EBFONT: ::c_int = 59;
+pub const ENOSTR: ::c_int = 60;
+pub const ENODATA: ::c_int = 61;
+pub const ETIME: ::c_int = 62;
+pub const ENOSR: ::c_int = 63;
+pub const ENONET: ::c_int = 64;
+pub const ENOPKG: ::c_int = 65;
+pub const EREMOTE: ::c_int = 66;
+pub const ENOLINK: ::c_int = 67;
+pub const EADV: ::c_int = 68;
+pub const ESRMNT: ::c_int = 69;
+pub const ECOMM: ::c_int = 70;
+pub const EPROTO: ::c_int = 71;
+pub const EDOTDOT: ::c_int = 73;
+
+pub const SA_NODEFER: ::c_int = 0x40000000;
+pub const SA_RESETHAND: ::c_int = 0x80000000;
+pub const SA_RESTART: ::c_int = 0x10000000;
+pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
+
+pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
+
+pub const EFD_CLOEXEC: ::c_int = 0x80000;
+
+pub const BUFSIZ: ::c_uint = 1024;
+pub const TMP_MAX: ::c_uint = 10000;
+pub const FOPEN_MAX: ::c_uint = 1000;
+pub const O_PATH: ::c_int = 0o10000000;
+pub const O_EXEC: ::c_int = 0o10000000;
+pub const O_SEARCH: ::c_int = 0o10000000;
+pub const O_ACCMODE: ::c_int = 0o10000003;
+pub const O_NDELAY: ::c_int = O_NONBLOCK;
+pub const NI_MAXHOST: ::socklen_t = 255;
+pub const PTHREAD_STACK_MIN: ::size_t = 2048;
+pub const POSIX_FADV_DONTNEED: ::c_int = 4;
+pub const POSIX_FADV_NOREUSE: ::c_int = 5;
+
+pub const POSIX_MADV_DONTNEED: ::c_int = 0;
+
+pub const RLIM_INFINITY: ::rlim_t = !0;
+pub const RLIMIT_RTTIME: ::c_int = 15;
+pub const RLIMIT_NLIMITS: ::c_int = 16;
+
+pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
+
+pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15;
+pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16;
+pub const TCP_THIN_DUPACK: ::c_int = 17;
+pub const TCP_USER_TIMEOUT: ::c_int = 18;
+pub const TCP_REPAIR: ::c_int = 19;
+pub const TCP_REPAIR_QUEUE: ::c_int = 20;
+pub const TCP_QUEUE_SEQ: ::c_int = 21;
+pub const TCP_REPAIR_OPTIONS: ::c_int = 22;
+pub const TCP_FASTOPEN: ::c_int = 23;
+pub const TCP_TIMESTAMP: ::c_int = 24;
+
+pub const SIGUNUSED: ::c_int = ::SIGSYS;
+
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
+
+pub const CPU_SETSIZE: ::c_int = 128;
+
+pub const QFMT_VFS_V1: ::c_int = 4;
+
+pub const PTRACE_TRACEME: ::c_int = 0;
+pub const PTRACE_PEEKTEXT: ::c_int = 1;
+pub const PTRACE_PEEKDATA: ::c_int = 2;
+pub const PTRACE_PEEKUSER: ::c_int = 3;
+pub const PTRACE_POKETEXT: ::c_int = 4;
+pub const PTRACE_POKEDATA: ::c_int = 5;
+pub const PTRACE_POKEUSER: ::c_int = 6;
+pub const PTRACE_CONT: ::c_int = 7;
+pub const PTRACE_KILL: ::c_int = 8;
+pub const PTRACE_SINGLESTEP: ::c_int = 9;
+pub const PTRACE_ATTACH: ::c_int = 16;
+pub const PTRACE_DETACH: ::c_int = 17;
+pub const PTRACE_SYSCALL: ::c_int = 24;
+pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
+pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
+pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
+pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
+pub const PTRACE_GETREGSET: ::c_int = 0x4204;
+pub const PTRACE_SETREGSET: ::c_int = 0x4205;
+pub const PTRACE_SEIZE: ::c_int = 0x4206;
+pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
+pub const PTRACE_LISTEN: ::c_int = 0x4208;
+pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
+
+pub const EPOLLWAKEUP: ::c_int = 0x20000000;
+
+pub const PTRACE_GETFPREGS: ::c_uint = 14;
+pub const PTRACE_SETFPREGS: ::c_uint = 15;
+pub const PTRACE_GETFPXREGS: ::c_uint = 18;
+pub const PTRACE_SETFPXREGS: ::c_uint = 19;
+pub const PTRACE_GETREGS: ::c_uint = 12;
+pub const PTRACE_SETREGS: ::c_uint = 13;
+
+pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
+
+pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
+
+pub const TCSANOW: ::c_int = 0;
+pub const TCSADRAIN: ::c_int = 1;
+pub const TCSAFLUSH: ::c_int = 2;
+
+pub const TIOCINQ: ::c_int = ::FIONREAD;
+
+pub const RTLD_GLOBAL: ::c_int = 0x100;
+pub const RTLD_NOLOAD: ::c_int = 0x4;
+
+// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux
+// kernel 3.10). See also notbsd/mod.rs
+pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
+pub const CLOCK_TAI: ::clockid_t = 11;
+
+pub const MCL_CURRENT: ::c_int = 0x0001;
+pub const MCL_FUTURE: ::c_int = 0x0002;
+
+pub const SIGSTKSZ: ::size_t = 8192;
+pub const MINSIGSTKSZ: ::size_t = 2048;
+pub const CBAUD: ::tcflag_t = 0o0010017;
+pub const TAB1: ::c_int = 0x00000800;
+pub const TAB2: ::c_int = 0x00001000;
+pub const TAB3: ::c_int = 0x00001800;
+pub const CR1: ::c_int = 0x00000200;
+pub const CR2: ::c_int = 0x00000400;
+pub const CR3: ::c_int = 0x00000600;
+pub const FF1: ::c_int = 0x00008000;
+pub const BS1: ::c_int = 0x00002000;
+pub const VT1: ::c_int = 0x00004000;
+pub const VWERASE: usize = 14;
+pub const VREPRINT: usize = 12;
+pub const VSUSP: usize = 10;
+pub const VSTART: usize = 8;
+pub const VSTOP: usize = 9;
+pub const VDISCARD: usize = 13;
+pub const VTIME: usize = 5;
+pub const IXON: ::tcflag_t = 0x00000400;
+pub const IXOFF: ::tcflag_t = 0x00001000;
+pub const ONLCR: ::tcflag_t = 0x4;
+pub const CSIZE: ::tcflag_t = 0x00000030;
+pub const CS6: ::tcflag_t = 0x00000010;
+pub const CS7: ::tcflag_t = 0x00000020;
+pub const CS8: ::tcflag_t = 0x00000030;
+pub const CSTOPB: ::tcflag_t = 0x00000040;
+pub const CREAD: ::tcflag_t = 0x00000080;
+pub const PARENB: ::tcflag_t = 0x00000100;
+pub const PARODD: ::tcflag_t = 0x00000200;
+pub const HUPCL: ::tcflag_t = 0x00000400;
+pub const CLOCAL: ::tcflag_t = 0x00000800;
+pub const ECHOKE: ::tcflag_t = 0x00000800;
+pub const ECHOE: ::tcflag_t = 0x00000010;
+pub const ECHOK: ::tcflag_t = 0x00000020;
+pub const ECHONL: ::tcflag_t = 0x00000040;
+pub const ECHOPRT: ::tcflag_t = 0x00000400;
+pub const ECHOCTL: ::tcflag_t = 0x00000200;
+pub const ISIG: ::tcflag_t = 0x00000001;
+pub const ICANON: ::tcflag_t = 0x00000002;
+pub const PENDIN: ::tcflag_t = 0x00004000;
+pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const VSWTC: usize = 7;
+pub const OLCUC: ::tcflag_t = 0o000002;
+pub const NLDLY: ::tcflag_t = 0o000400;
+pub const CRDLY: ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY: ::tcflag_t = 0o020000;
+pub const FFDLY: ::tcflag_t = 0o100000;
+pub const VTDLY: ::tcflag_t = 0o040000;
+pub const XTABS: ::tcflag_t = 0o014000;
+
+pub const B0: ::speed_t = 0o000000;
+pub const B50: ::speed_t = 0o000001;
+pub const B75: ::speed_t = 0o000002;
+pub const B110: ::speed_t = 0o000003;
+pub const B134: ::speed_t = 0o000004;
+pub const B150: ::speed_t = 0o000005;
+pub const B200: ::speed_t = 0o000006;
+pub const B300: ::speed_t = 0o000007;
+pub const B600: ::speed_t = 0o000010;
+pub const B1200: ::speed_t = 0o000011;
+pub const B1800: ::speed_t = 0o000012;
+pub const B2400: ::speed_t = 0o000013;
+pub const B4800: ::speed_t = 0o000014;
+pub const B9600: ::speed_t = 0o000015;
+pub const B19200: ::speed_t = 0o000016;
+pub const B38400: ::speed_t = 0o000017;
+pub const B57600: ::speed_t = 0o010001;
+pub const B115200: ::speed_t = 0o010002;
+pub const B230400: ::speed_t = 0o010003;
+pub const B460800: ::speed_t = 0o010004;
+pub const B500000: ::speed_t = 0o010005;
+pub const B576000: ::speed_t = 0o010006;
+pub const B921600: ::speed_t = 0o010007;
+pub const B1000000: ::speed_t = 0o010010;
+pub const B1152000: ::speed_t = 0o010011;
+pub const B1500000: ::speed_t = 0o010012;
+pub const B2000000: ::speed_t = 0o010013;
+pub const B2500000: ::speed_t = 0o010014;
+pub const B3000000: ::speed_t = 0o010015;
+pub const B3500000: ::speed_t = 0o010016;
+pub const B4000000: ::speed_t = 0o010017;
+
+pub const SO_BINDTODEVICE: ::c_int = 25;
+pub const SO_TIMESTAMP: ::c_int = 29;
+pub const SO_MARK: ::c_int = 36;
+pub const SO_RXQ_OVFL: ::c_int = 40;
+pub const SO_PEEK_OFF: ::c_int = 42;
+pub const SO_BUSY_POLL: ::c_int = 46;
+
+pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
+pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 28;
+
+pub const O_DIRECT: ::c_int = 0x4000;
+pub const O_DIRECTORY: ::c_int = 0x10000;
+pub const O_NOFOLLOW: ::c_int = 0x20000;
+pub const O_ASYNC: ::c_int = 0x2000;
+
+pub const FIOCLEX: ::c_int = 0x5451;
+pub const FIONBIO: ::c_int = 0x5421;
+
+pub const RLIMIT_RSS: ::c_int = 5;
+pub const RLIMIT_NOFILE: ::c_int = 7;
+pub const RLIMIT_AS: ::c_int = 9;
+pub const RLIMIT_NPROC: ::c_int = 6;
+pub const RLIMIT_MEMLOCK: ::c_int = 8;
+
+pub const O_APPEND: ::c_int = 1024;
+pub const O_CREAT: ::c_int = 64;
+pub const O_EXCL: ::c_int = 128;
+pub const O_NOCTTY: ::c_int = 256;
+pub const O_NONBLOCK: ::c_int = 2048;
+pub const O_SYNC: ::c_int = 1052672;
+pub const O_RSYNC: ::c_int = 1052672;
+pub const O_DSYNC: ::c_int = 4096;
+
+pub const SOCK_NONBLOCK: ::c_int = 2048;
+
+pub const MAP_ANON: ::c_int = 0x0020;
+pub const MAP_GROWSDOWN: ::c_int = 0x0100;
+pub const MAP_DENYWRITE: ::c_int = 0x0800;
+pub const MAP_EXECUTABLE: ::c_int = 0x01000;
+pub const MAP_LOCKED: ::c_int = 0x02000;
+pub const MAP_NORESERVE: ::c_int = 0x04000;
+pub const MAP_POPULATE: ::c_int = 0x08000;
+pub const MAP_NONBLOCK: ::c_int = 0x010000;
+pub const MAP_STACK: ::c_int = 0x020000;
+
+pub const SOCK_STREAM: ::c_int = 1;
+pub const SOCK_DGRAM: ::c_int = 2;
+pub const SOCK_SEQPACKET: ::c_int = 5;
+
+pub const SOL_SOCKET: ::c_int = 1;
+
+pub const EDEADLK: ::c_int = 35;
+pub const ENAMETOOLONG: ::c_int = 36;
+pub const ENOLCK: ::c_int = 37;
+pub const ENOSYS: ::c_int = 38;
+pub const ENOTEMPTY: ::c_int = 39;
+pub const ELOOP: ::c_int = 40;
+pub const ENOMSG: ::c_int = 42;
+pub const EIDRM: ::c_int = 43;
+pub const ECHRNG: ::c_int = 44;
+pub const EL2NSYNC: ::c_int = 45;
+pub const EL3HLT: ::c_int = 46;
+pub const EL3RST: ::c_int = 47;
+pub const ELNRNG: ::c_int = 48;
+pub const EUNATCH: ::c_int = 49;
+pub const ENOCSI: ::c_int = 50;
+pub const EL2HLT: ::c_int = 51;
+pub const EBADE: ::c_int = 52;
+pub const EBADR: ::c_int = 53;
+pub const EXFULL: ::c_int = 54;
+pub const ENOANO: ::c_int = 55;
+pub const EBADRQC: ::c_int = 56;
+pub const EBADSLT: ::c_int = 57;
+pub const EDEADLOCK: ::c_int = EDEADLK;
+pub const EMULTIHOP: ::c_int = 72;
+pub const EBADMSG: ::c_int = 74;
+pub const EOVERFLOW: ::c_int = 75;
+pub const ENOTUNIQ: ::c_int = 76;
+pub const EBADFD: ::c_int = 77;
+pub const EREMCHG: ::c_int = 78;
+pub const ELIBACC: ::c_int = 79;
+pub const ELIBBAD: ::c_int = 80;
+pub const ELIBSCN: ::c_int = 81;
+pub const ELIBMAX: ::c_int = 82;
+pub const ELIBEXEC: ::c_int = 83;
+pub const EILSEQ: ::c_int = 84;
+pub const ERESTART: ::c_int = 85;
+pub const ESTRPIPE: ::c_int = 86;
+pub const EUSERS: ::c_int = 87;
+pub const ENOTSOCK: ::c_int = 88;
+pub const EDESTADDRREQ: ::c_int = 89;
+pub const EMSGSIZE: ::c_int = 90;
+pub const EPROTOTYPE: ::c_int = 91;
+pub const ENOPROTOOPT: ::c_int = 92;
+pub const EPROTONOSUPPORT: ::c_int = 93;
+pub const ESOCKTNOSUPPORT: ::c_int = 94;
+pub const EOPNOTSUPP: ::c_int = 95;
+pub const ENOTSUP: ::c_int = EOPNOTSUPP;
+pub const EPFNOSUPPORT: ::c_int = 96;
+pub const EAFNOSUPPORT: ::c_int = 97;
+pub const EADDRINUSE: ::c_int = 98;
+pub const EADDRNOTAVAIL: ::c_int = 99;
+pub const ENETDOWN: ::c_int = 100;
+pub const ENETUNREACH: ::c_int = 101;
+pub const ENETRESET: ::c_int = 102;
+pub const ECONNABORTED: ::c_int = 103;
+pub const ECONNRESET: ::c_int = 104;
+pub const ENOBUFS: ::c_int = 105;
+pub const EISCONN: ::c_int = 106;
+pub const ENOTCONN: ::c_int = 107;
+pub const ESHUTDOWN: ::c_int = 108;
+pub const ETOOMANYREFS: ::c_int = 109;
+pub const ETIMEDOUT: ::c_int = 110;
+pub const ECONNREFUSED: ::c_int = 111;
+pub const EHOSTDOWN: ::c_int = 112;
+pub const EHOSTUNREACH: ::c_int = 113;
+pub const EALREADY: ::c_int = 114;
+pub const EINPROGRESS: ::c_int = 115;
+pub const ESTALE: ::c_int = 116;
+pub const EUCLEAN: ::c_int = 117;
+pub const ENOTNAM: ::c_int = 118;
+pub const ENAVAIL: ::c_int = 119;
+pub const EISNAM: ::c_int = 120;
+pub const EREMOTEIO: ::c_int = 121;
+pub const EDQUOT: ::c_int = 122;
+pub const ENOMEDIUM: ::c_int = 123;
+pub const EMEDIUMTYPE: ::c_int = 124;
+pub const ECANCELED: ::c_int = 125;
+pub const ENOKEY: ::c_int = 126;
+pub const EKEYEXPIRED: ::c_int = 127;
+pub const EKEYREVOKED: ::c_int = 128;
+pub const EKEYREJECTED: ::c_int = 129;
+pub const EOWNERDEAD: ::c_int = 130;
+pub const ENOTRECOVERABLE: ::c_int = 131;
+pub const ERFKILL: ::c_int = 132;
+pub const EHWPOISON: ::c_int = 133;
+
+pub const SO_REUSEADDR: ::c_int = 2;
+pub const SO_TYPE: ::c_int = 3;
+pub const SO_ERROR: ::c_int = 4;
+pub const SO_DONTROUTE: ::c_int = 5;
+pub const SO_BROADCAST: ::c_int = 6;
+pub const SO_SNDBUF: ::c_int = 7;
+pub const SO_RCVBUF: ::c_int = 8;
+pub const SO_KEEPALIVE: ::c_int = 9;
+pub const SO_OOBINLINE: ::c_int = 10;
+pub const SO_LINGER: ::c_int = 13;
+pub const SO_REUSEPORT: ::c_int = 15;
+pub const SO_RCVLOWAT: ::c_int = 18;
+pub const SO_SNDLOWAT: ::c_int = 19;
+pub const SO_RCVTIMEO: ::c_int = 20;
+pub const SO_SNDTIMEO: ::c_int = 21;
+pub const SO_ACCEPTCONN: ::c_int = 30;
+
+pub const SA_ONSTACK: ::c_int = 0x08000000;
+pub const SA_SIGINFO: ::c_int = 0x00000004;
+pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
+
+pub const SIGCHLD: ::c_int = 17;
+pub const SIGBUS: ::c_int = 7;
+pub const SIGTTIN: ::c_int = 21;
+pub const SIGTTOU: ::c_int = 22;
+pub const SIGXCPU: ::c_int = 24;
+pub const SIGXFSZ: ::c_int = 25;
+pub const SIGVTALRM: ::c_int = 26;
+pub const SIGPROF: ::c_int = 27;
+pub const SIGWINCH: ::c_int = 28;
+pub const SIGUSR1: ::c_int = 10;
+pub const SIGUSR2: ::c_int = 12;
+pub const SIGCONT: ::c_int = 18;
+pub const SIGSTOP: ::c_int = 19;
+pub const SIGTSTP: ::c_int = 20;
+pub const SIGURG: ::c_int = 23;
+pub const SIGIO: ::c_int = 29;
+pub const SIGSYS: ::c_int = 31;
+pub const SIGSTKFLT: ::c_int = 16;
+pub const SIGPOLL: ::c_int = 29;
+pub const SIGPWR: ::c_int = 30;
+pub const SIG_SETMASK: ::c_int = 2;
+pub const SIG_BLOCK: ::c_int = 0x000000;
+pub const SIG_UNBLOCK: ::c_int = 0x01;
+
+pub const EXTPROC: ::tcflag_t = 0x00010000;
+
+pub const MAP_HUGETLB: ::c_int = 0x040000;
+
+pub const F_GETLK: ::c_int = 12;
+pub const F_GETOWN: ::c_int = 9;
+pub const F_SETLK: ::c_int = 13;
+pub const F_SETLKW: ::c_int = 14;
+pub const F_SETOWN: ::c_int = 8;
+
+pub const VEOF: usize = 4;
+pub const VEOL: usize = 11;
+pub const VEOL2: usize = 16;
+pub const VMIN: usize = 6;
+pub const IEXTEN: ::tcflag_t = 0x00008000;
+pub const TOSTOP: ::tcflag_t = 0x00000100;
+pub const FLUSHO: ::tcflag_t = 0x00001000;
+
+pub const TCGETS: ::c_int = 0x5401;
+pub const TCSETS: ::c_int = 0x5402;
+pub const TCSETSW: ::c_int = 0x5403;
+pub const TCSETSF: ::c_int = 0x5404;
+pub const TCGETA: ::c_int = 0x5405;
+pub const TCSETA: ::c_int = 0x5406;
+pub const TCSETAW: ::c_int = 0x5407;
+pub const TCSETAF: ::c_int = 0x5408;
+pub const TCSBRK: ::c_int = 0x5409;
+pub const TCXONC: ::c_int = 0x540A;
+pub const TCFLSH: ::c_int = 0x540B;
+pub const TIOCGSOFTCAR: ::c_int = 0x5419;
+pub const TIOCSSOFTCAR: ::c_int = 0x541A;
+pub const TIOCLINUX: ::c_int = 0x541C;
+pub const TIOCGSERIAL: ::c_int = 0x541E;
+pub const TIOCEXCL: ::c_int = 0x540C;
+pub const TIOCNXCL: ::c_int = 0x540D;
+pub const TIOCSCTTY: ::c_int = 0x540E;
+pub const TIOCGPGRP: ::c_int = 0x540F;
+pub const TIOCSPGRP: ::c_int = 0x5410;
+pub const TIOCOUTQ: ::c_int = 0x5411;
+pub const TIOCSTI: ::c_int = 0x5412;
+pub const TIOCGWINSZ: ::c_int = 0x5413;
+pub const TIOCSWINSZ: ::c_int = 0x5414;
+pub const TIOCMGET: ::c_int = 0x5415;
+pub const TIOCMBIS: ::c_int = 0x5416;
+pub const TIOCMBIC: ::c_int = 0x5417;
+pub const TIOCMSET: ::c_int = 0x5418;
+pub const FIONREAD: ::c_int = 0x541B;
+pub const TIOCCONS: ::c_int = 0x541D;
+
+pub const SYS_gettid: ::c_long = 224; // Valid for arm (32-bit) and x86 (32-bit)
+
+pub const POLLWRNORM: ::c_short = 0x100;
+pub const POLLWRBAND: ::c_short = 0x200;
+
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x008;
+pub const TIOCM_SR: ::c_int = 0x010;
+pub const TIOCM_CTS: ::c_int = 0x020;
+pub const TIOCM_CAR: ::c_int = 0x040;
+pub const TIOCM_RNG: ::c_int = 0x080;
+pub const TIOCM_DSR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+pub const O_TMPFILE: ::c_int = 0x400000;
+
+f! {
+ pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
+ for slot in cpuset.bits.iter_mut() {
+ *slot = 0;
+ }
+ }
+
+ pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
+ let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
+ let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
+ cpuset.bits[idx] |= 1 << offset;
+ ()
+ }
+
+ pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
+ let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
+ let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
+ cpuset.bits[idx] &= !(1 << offset);
+ ()
+ }
+
+ pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
+ let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]);
+ let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
+ 0 != (cpuset.bits[idx] & (1 << offset))
+ }
+
+ pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
+ set1.bits == set2.bits
+ }
+
+ pub fn major(dev: ::dev_t) -> ::c_uint {
+ // see
+ // https://github.com/kripken/emscripten/blob/
+ // master/system/include/libc/sys/sysmacros.h
+ let mut major = 0;
+ major |= (dev & 0x00000fff) >> 8;
+ major |= (dev & 0xfffff000) >> 31 >> 1;
+ major as ::c_uint
+ }
+
+ pub fn minor(dev: ::dev_t) -> ::c_uint {
+ // see
+ // https://github.com/kripken/emscripten/blob/
+ // master/system/include/libc/sys/sysmacros.h
+ let mut minor = 0;
+ minor |= (dev & 0x000000ff) >> 0;
+ minor |= (dev & 0xffffff00) >> 12;
+ minor as ::c_uint
+ }
+
+ pub fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
+ let major = major as ::dev_t;
+ let minor = minor as ::dev_t;
+ let mut dev = 0;
+ dev |= (major & 0x00000fff) << 8;
+ dev |= (major & 0xfffff000) << 31 << 1;
+ dev |= (minor & 0x000000ff) << 0;
+ dev |= (minor & 0xffffff00) << 12;
+ dev
+ }
+}
+
+extern {
+ pub fn setpwent();
+ pub fn endpwent();
+ pub fn getpwent() -> *mut passwd;
+
+ pub fn shm_open(name: *const c_char, oflag: ::c_int,
+ mode: mode_t) -> ::c_int;
+
+ pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
+ -> ::c_int;
+ pub fn __errno_location() -> *mut ::c_int;
+
+ pub fn fopen64(filename: *const c_char,
+ mode: *const c_char) -> *mut ::FILE;
+ pub fn freopen64(filename: *const c_char, mode: *const c_char,
+ file: *mut ::FILE) -> *mut ::FILE;
+ pub fn tmpfile64() -> *mut ::FILE;
+ pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int;
+ pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int;
+ pub fn fseeko64(stream: *mut ::FILE,
+ offset: ::off64_t,
+ whence: ::c_int) -> ::c_int;
+ pub fn ftello64(stream: *mut ::FILE) -> ::off64_t;
+ pub fn posix_fallocate(fd: ::c_int, offset: ::off_t,
+ len: ::off_t) -> ::c_int;
+ pub fn pwritev(fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t) -> ::ssize_t;
+ pub fn preadv(fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t) -> ::ssize_t;
+ pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
+ pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
+ pub fn mkostemps(template: *mut ::c_char,
+ suffixlen: ::c_int,
+ flags: ::c_int) -> ::c_int;
+ pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
+ pub fn getnameinfo(sa: *const ::sockaddr,
+ salen: ::socklen_t,
+ host: *mut ::c_char,
+ hostlen: ::socklen_t,
+ serv: *mut ::c_char,
+ sevlen: ::socklen_t,
+ flags: ::c_int) -> ::c_int;
+ pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
+
+ // Not available now on Android
+ pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
+ mode: ::mode_t) -> ::c_int;
+ pub fn if_nameindex() -> *mut if_nameindex;
+ pub fn if_freenameindex(ptr: *mut if_nameindex);
+ pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
+ pub fn freeifaddrs(ifa: *mut ::ifaddrs);
+
+ pub fn mremap(addr: *mut ::c_void,
+ len: ::size_t,
+ new_len: ::size_t,
+ flags: ::c_int,
+ ...) -> *mut ::c_void;
+
+ pub fn glob(pattern: *const c_char,
+ flags: ::c_int,
+ errfunc: Option<extern fn(epath: *const c_char,
+ errno: ::c_int) -> ::c_int>,
+ pglob: *mut ::glob_t) -> ::c_int;
+ pub fn globfree(pglob: *mut ::glob_t);
+
+ pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
+ -> ::c_int;
+
+ pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
+
+ pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
+
+ pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
+ pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int)
+ -> ::c_int;
+
+ pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
+
+ pub fn recvfrom(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
+ flags: ::c_int, addr: *mut ::sockaddr,
+ addrlen: *mut ::socklen_t) -> ::ssize_t;
+ pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
+ pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
+
+ pub fn bind(socket: ::c_int, address: *const ::sockaddr,
+ address_len: ::socklen_t) -> ::c_int;
+
+ pub fn writev(fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int) -> ::ssize_t;
+ pub fn readv(fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int) -> ::ssize_t;
+
+ pub fn sendmsg(fd: ::c_int,
+ msg: *const ::msghdr,
+ flags: ::c_int) -> ::ssize_t;
+ pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
+ -> ::ssize_t;
+ pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
+ pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int;
+ pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
+ flags: ::c_int) -> ::c_int;
+ pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
+ flags: ::c_int, timeout: *mut ::timespec) -> ::c_int;
+ pub fn sync();
+ pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
+ pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
+ pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
+ pub fn pthread_create(native: *mut ::pthread_t,
+ attr: *const ::pthread_attr_t,
+ f: extern fn(*mut ::c_void) -> *mut ::c_void,
+ value: *mut ::c_void) -> ::c_int;
+}
diff --git a/libc/src/unix/notbsd/linux/mips/mips32.rs b/libc/src/unix/notbsd/linux/mips/mips32.rs
index 042495e..0bfcc4f 100644
--- a/libc/src/unix/notbsd/linux/mips/mips32.rs
+++ b/libc/src/unix/notbsd/linux/mips/mips32.rs
@@ -10,9 +10,7 @@ pub type ino_t = u32;
pub type blkcnt_t = i32;
pub type blksize_t = i32;
pub type nlink_t = u32;
-pub type fsblkcnt_t = ::c_ulong;
-pub type fsfilcnt_t = ::c_ulong;
-pub type rlim_t = c_ulong;
+pub type __u64 = ::c_ulonglong;
s! {
pub struct aiocb {
@@ -78,6 +76,40 @@ s! {
st_pad5: [::c_long; 14],
}
+ pub struct statfs64 {
+ pub f_type: ::c_long,
+ pub f_bsize: ::c_long,
+ pub f_frsize: ::c_long,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_bavail: u64,
+ pub f_fsid: ::fsid_t,
+ pub f_namelen: ::c_long,
+ pub f_flags: ::c_long,
+ pub f_spare: [::c_long; 5],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: u64,
+ #[cfg(target_endian = "little")]
+ pub f_fsid: ::c_ulong,
+ __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],
+ }
+
pub struct pthread_attr_t {
__size: [u32; 9]
}
@@ -107,19 +139,6 @@ s! {
pub _pad: [::c_int; 29],
}
- pub struct glob64_t {
- pub gl_pathc: ::size_t,
- pub gl_pathv: *mut *mut ::c_char,
- pub gl_offs: ::size_t,
- pub gl_flags: ::c_int,
-
- __unused1: *mut ::c_void,
- __unused2: *mut ::c_void,
- __unused3: *mut ::c_void,
- __unused4: *mut ::c_void,
- __unused5: *mut ::c_void,
- }
-
pub struct ipc_perm {
pub __key: ::key_t,
pub uid: ::uid_t,
@@ -238,50 +257,20 @@ s! {
pub mem_unit: ::c_uint,
pub _f: [::c_char; 8],
}
-
- // FIXME this is actually a union
- pub struct sem_t {
- #[cfg(target_pointer_width = "32")]
- __size: [::c_char; 16],
- #[cfg(target_pointer_width = "64")]
- __size: [::c_char; 32],
- __align: [::c_long; 0],
- }
}
pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
-pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff;
+pub const O_LARGEFILE: ::c_int = 0x2000;
-pub const SYS_gettid: ::c_long = 4222; // Valid for O32
+pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff;
-#[link(name = "util")]
-extern {
- pub fn sysctl(name: *mut ::c_int,
- namelen: ::c_int,
- oldp: *mut ::c_void,
- oldlenp: *mut ::size_t,
- newp: *mut ::c_void,
- newlen: ::size_t)
- -> ::c_int;
- pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
- pub fn backtrace(buf: *mut *mut ::c_void,
- sz: ::c_int) -> ::c_int;
- pub fn glob64(pattern: *const ::c_char,
- flags: ::c_int,
- errfunc: ::dox::Option<extern fn(epath: *const ::c_char,
- errno: ::c_int)
- -> ::c_int>,
- pglob: *mut glob64_t) -> ::c_int;
- pub fn globfree64(pglob: *mut glob64_t);
- pub fn ptrace(request: ::c_uint, ...) -> ::c_long;
- pub fn pthread_attr_getaffinity_np(attr: *const ::pthread_attr_t,
- cpusetsize: ::size_t,
- cpuset: *mut ::cpu_set_t) -> ::c_int;
- pub fn pthread_attr_setaffinity_np(attr: *mut ::pthread_attr_t,
- cpusetsize: ::size_t,
- cpuset: *const ::cpu_set_t) -> ::c_int;
-}
+// Valid for O32
+pub const SYS_pivot_root: ::c_long = 4216;
+pub const SYS_gettid: ::c_long = 4222;
+pub const SYS_perf_event_open: ::c_long = 4333;
+pub const SYS_memfd_create: ::c_long = 4354;
diff --git a/libc/src/unix/notbsd/linux/mips/mips64.rs b/libc/src/unix/notbsd/linux/mips/mips64.rs
index 5b0484a..2de7535 100644
--- a/libc/src/unix/notbsd/linux/mips/mips64.rs
+++ b/libc/src/unix/notbsd/linux/mips/mips64.rs
@@ -3,15 +3,14 @@ pub type blksize_t = i64;
pub type c_char = i8;
pub type c_long = i64;
pub type c_ulong = u64;
-pub type fsblkcnt_t = ::c_ulong;
-pub type fsfilcnt_t = ::c_ulong;
pub type ino_t = u64;
pub type nlink_t = u64;
pub type off_t = i64;
-pub type rlim_t = ::c_ulong;
pub type suseconds_t = i64;
pub type time_t = i64;
pub type wchar_t = i32;
+pub type clock_t = i64;
+pub type __u64 = ::c_ulong;
s! {
pub struct aiocb {
@@ -77,6 +76,36 @@ s! {
st_pad5: [::c_long; 7],
}
+ pub struct statfs64 {
+ pub f_type: ::c_long,
+ pub f_bsize: ::c_long,
+ pub f_frsize: ::c_long,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_bavail: u64,
+ pub f_fsid: ::fsid_t,
+ pub f_namelen: ::c_long,
+ pub f_flags: ::c_long,
+ pub f_spare: [::c_long; 5],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: u64,
+ pub f_fsid: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ __f_spare: [::c_int; 6],
+ }
+
pub struct pthread_attr_t {
__size: [::c_ulong; 7]
}
@@ -186,6 +215,14 @@ s! {
pub c_cc: [::cc_t; ::NCCS],
}
+ pub struct flock {
+ pub l_type: ::c_short,
+ pub l_whence: ::c_short,
+ pub l_start: ::off_t,
+ pub l_len: ::off_t,
+ pub l_pid: ::pid_t,
+ }
+
pub struct sysinfo {
pub uptime: ::c_long,
pub loads: [::c_ulong; 3],
@@ -202,24 +239,19 @@ s! {
pub mem_unit: ::c_uint,
pub _f: [::c_char; 0],
}
-
- // FIXME this is actually a union
- pub struct sem_t {
- __size: [::c_char; 32],
- __align: [::c_long; 0],
- }
}
pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
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 RLIM_INFINITY: ::rlim_t = 0xffff_ffff_ffff_ffff;
+pub const O_LARGEFILE: ::c_int = 0;
-pub const SYS_gettid: ::c_long = 5178; // Valid for n64
+pub const RLIM_INFINITY: ::rlim_t = 0xffff_ffff_ffff_ffff;
-#[link(name = "util")]
-extern {
- pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
-}
+// Valid for n64
+pub const SYS_pivot_root: ::c_long = 5151;
+pub const SYS_gettid: ::c_long = 5178;
+pub const SYS_memfd_create: ::c_long = 5314;
diff --git a/libc/src/unix/notbsd/linux/mips/mod.rs b/libc/src/unix/notbsd/linux/mips/mod.rs
index 7b1c15e..150b607 100644
--- a/libc/src/unix/notbsd/linux/mips/mod.rs
+++ b/libc/src/unix/notbsd/linux/mips/mod.rs
@@ -1,4 +1,31 @@
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
+pub type fsblkcnt_t = ::c_ulong;
+pub type fsfilcnt_t = ::c_ulong;
+pub type rlim_t = c_ulong;
+pub type __priority_which_t = ::c_uint;
+
+s! {
+ pub struct glob64_t {
+ pub gl_pathc: ::size_t,
+ pub gl_pathv: *mut *mut ::c_char,
+ pub gl_offs: ::size_t,
+ pub gl_flags: ::c_int,
+
+ __unused1: *mut ::c_void,
+ __unused2: *mut ::c_void,
+ __unused3: *mut ::c_void,
+ __unused4: *mut ::c_void,
+ __unused5: *mut ::c_void,
+ }
+
+ // FIXME this is actually a union
+ pub struct sem_t {
+ #[cfg(target_pointer_width = "32")]
+ __size: [::c_char; 16],
+ #[cfg(target_pointer_width = "64")]
+ __size: [::c_char; 32],
+ __align: [::c_long; 0],
+ }
+}
pub const SFD_CLOEXEC: ::c_int = 0x080000;
@@ -6,7 +33,9 @@ pub const NCCS: usize = 32;
pub const O_TRUNC: ::c_int = 512;
+pub const O_NOATIME: ::c_int = 0o1000000;
pub const O_CLOEXEC: ::c_int = 0x80000;
+pub const O_PATH: ::c_int = 0o10000000;
pub const EBFONT: ::c_int = 59;
pub const ENOSTR: ::c_int = 60;
@@ -38,7 +67,81 @@ pub const FOPEN_MAX: ::c_uint = 16;
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 _SC_EQUIV_CLASS_MAX: ::c_int = 41;
+pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45;
+pub const _SC_PII: ::c_int = 53;
+pub const _SC_PII_XTI: ::c_int = 54;
+pub const _SC_PII_SOCKET: ::c_int = 55;
+pub const _SC_PII_INTERNET: ::c_int = 56;
+pub const _SC_PII_OSI: ::c_int = 57;
+pub const _SC_POLL: ::c_int = 58;
+pub const _SC_SELECT: ::c_int = 59;
+pub const _SC_PII_INTERNET_STREAM: ::c_int = 61;
+pub const _SC_PII_INTERNET_DGRAM: ::c_int = 62;
+pub const _SC_PII_OSI_COTS: ::c_int = 63;
+pub const _SC_PII_OSI_CLTS: ::c_int = 64;
+pub const _SC_PII_OSI_M: ::c_int = 65;
+pub const _SC_T_IOV_MAX: ::c_int = 66;
pub const _SC_2_C_VERSION: ::c_int = 96;
+pub const _SC_CHAR_BIT: ::c_int = 101;
+pub const _SC_CHAR_MAX: ::c_int = 102;
+pub const _SC_CHAR_MIN: ::c_int = 103;
+pub const _SC_INT_MAX: ::c_int = 104;
+pub const _SC_INT_MIN: ::c_int = 105;
+pub const _SC_LONG_BIT: ::c_int = 106;
+pub const _SC_WORD_BIT: ::c_int = 107;
+pub const _SC_MB_LEN_MAX: ::c_int = 108;
+pub const _SC_SSIZE_MAX: ::c_int = 110;
+pub const _SC_SCHAR_MAX: ::c_int = 111;
+pub const _SC_SCHAR_MIN: ::c_int = 112;
+pub const _SC_SHRT_MAX: ::c_int = 113;
+pub const _SC_SHRT_MIN: ::c_int = 114;
+pub const _SC_UCHAR_MAX: ::c_int = 115;
+pub const _SC_UINT_MAX: ::c_int = 116;
+pub const _SC_ULONG_MAX: ::c_int = 117;
+pub const _SC_USHRT_MAX: ::c_int = 118;
+pub const _SC_NL_ARGMAX: ::c_int = 119;
+pub const _SC_NL_LANGMAX: ::c_int = 120;
+pub const _SC_NL_MSGMAX: ::c_int = 121;
+pub const _SC_NL_NMAX: ::c_int = 122;
+pub const _SC_NL_SETMAX: ::c_int = 123;
+pub const _SC_NL_TEXTMAX: ::c_int = 124;
+pub const _SC_BASE: ::c_int = 134;
+pub const _SC_C_LANG_SUPPORT: ::c_int = 135;
+pub const _SC_C_LANG_SUPPORT_R: ::c_int = 136;
+pub const _SC_DEVICE_IO: ::c_int = 140;
+pub const _SC_DEVICE_SPECIFIC: ::c_int = 141;
+pub const _SC_DEVICE_SPECIFIC_R: ::c_int = 142;
+pub const _SC_FD_MGMT: ::c_int = 143;
+pub const _SC_FIFO: ::c_int = 144;
+pub const _SC_PIPE: ::c_int = 145;
+pub const _SC_FILE_ATTRIBUTES: ::c_int = 146;
+pub const _SC_FILE_LOCKING: ::c_int = 147;
+pub const _SC_FILE_SYSTEM: ::c_int = 148;
+pub const _SC_MULTI_PROCESS: ::c_int = 150;
+pub const _SC_SINGLE_PROCESS: ::c_int = 151;
+pub const _SC_NETWORKING: ::c_int = 152;
+pub const _SC_REGEX_VERSION: ::c_int = 156;
+pub const _SC_SIGNALS: ::c_int = 158;
+pub const _SC_SYSTEM_DATABASE: ::c_int = 162;
+pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163;
+pub const _SC_USER_GROUPS: ::c_int = 166;
+pub const _SC_USER_GROUPS_R: ::c_int = 167;
+pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 185;
+pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 186;
+pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 187;
+pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 188;
+pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 189;
+pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 190;
+pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 191;
+pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 192;
+pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 193;
+pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 194;
+pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 195;
+pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 196;
+pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 197;
+pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 198;
+pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 199;
pub const O_ACCMODE: ::c_int = 3;
pub const O_DIRECT: ::c_int = 0x8000;
pub const O_DIRECTORY: ::c_int = 0x10000;
@@ -227,7 +330,6 @@ pub const SO_DETACH_FILTER: ::c_int = 27;
pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
pub const SO_PEERNAME: ::c_int = 28;
pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
pub const SO_PEERSEC: ::c_int = 30;
pub const SO_SNDBUFFORCE: ::c_int = 31;
pub const SO_RCVBUFFORCE: ::c_int = 33;
@@ -281,9 +383,7 @@ pub const SIG_SETMASK: ::c_int = 3;
pub const SIG_BLOCK: ::c_int = 0x1;
pub const SIG_UNBLOCK: ::c_int = 0x2;
-pub const POLLRDNORM: ::c_short = 0x040;
pub const POLLWRNORM: ::c_short = 0x004;
-pub const POLLRDBAND: ::c_short = 0x080;
pub const POLLWRBAND: ::c_short = 0x100;
pub const PTHREAD_STACK_MIN: ::size_t = 131072;
@@ -461,6 +561,17 @@ pub const ISIG: ::tcflag_t = 0x00000001;
pub const ICANON: ::tcflag_t = 0x00000002;
pub const PENDIN: ::tcflag_t = 0x00004000;
pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const VSWTC: usize = 7;
+pub const OLCUC: ::tcflag_t = 0o000002;
+pub const NLDLY: ::tcflag_t = 0o000400;
+pub const CRDLY: ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY: ::tcflag_t = 0o020000;
+pub const FFDLY: ::tcflag_t = 0o100000;
+pub const VTDLY: ::tcflag_t = 0o040000;
+pub const XTABS: ::tcflag_t = 0o014000;
pub const B0: ::speed_t = 0o000000;
pub const B50: ::speed_t = 0o000001;
@@ -496,6 +607,60 @@ pub const B3000000: ::speed_t = 0o010015;
pub const B3500000: ::speed_t = 0o010016;
pub const B4000000: ::speed_t = 0o010017;
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x010;
+pub const TIOCM_SR: ::c_int = 0x020;
+pub const TIOCM_CTS: ::c_int = 0x040;
+pub const TIOCM_CAR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RNG: ::c_int = 0x200;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+pub const TIOCM_DSR: ::c_int = 0x400;
+
+pub const EHWPOISON: ::c_int = 168;
+pub const SIGEV_THREAD_ID: ::c_int = 4;
+pub const EPOLLWAKEUP: ::c_int = 0x20000000;
+
+#[link(name = "util")]
+extern {
+ pub fn sysctl(name: *mut ::c_int,
+ namelen: ::c_int,
+ oldp: *mut ::c_void,
+ oldlenp: *mut ::size_t,
+ newp: *mut ::c_void,
+ newlen: ::size_t)
+ -> ::c_int;
+ pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
+ pub fn backtrace(buf: *mut *mut ::c_void,
+ sz: ::c_int) -> ::c_int;
+ pub fn glob64(pattern: *const ::c_char,
+ flags: ::c_int,
+ errfunc: ::dox::Option<extern fn(epath: *const ::c_char,
+ errno: ::c_int)
+ -> ::c_int>,
+ pglob: *mut glob64_t) -> ::c_int;
+ pub fn globfree64(pglob: *mut glob64_t);
+ pub fn ptrace(request: ::c_uint, ...) -> ::c_long;
+ pub fn pthread_attr_getaffinity_np(attr: *const ::pthread_attr_t,
+ cpusetsize: ::size_t,
+ cpuset: *mut ::cpu_set_t) -> ::c_int;
+ pub fn pthread_attr_setaffinity_np(attr: *mut ::pthread_attr_t,
+ cpusetsize: ::size_t,
+ cpuset: *const ::cpu_set_t) -> ::c_int;
+ pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int;
+ pub fn setpriority(which: ::__priority_which_t, who: ::id_t,
+ prio: ::c_int) -> ::c_int;
+ pub fn pthread_getaffinity_np(thread: ::pthread_t,
+ cpusetsize: ::size_t,
+ cpuset: *mut ::cpu_set_t) -> ::c_int;
+ pub fn pthread_setaffinity_np(thread: ::pthread_t,
+ cpusetsize: ::size_t,
+ cpuset: *const ::cpu_set_t) -> ::c_int;
+ pub fn sched_getcpu() -> ::c_int;
+}
+
cfg_if! {
if #[cfg(target_arch = "mips")] {
mod mips32;
diff --git a/libc/src/unix/notbsd/linux/mod.rs b/libc/src/unix/notbsd/linux/mod.rs
index b9375a3..89a6211 100644
--- a/libc/src/unix/notbsd/linux/mod.rs
+++ b/libc/src/unix/notbsd/linux/mod.rs
@@ -18,6 +18,13 @@ pub type msglen_t = ::c_ulong;
pub type nfds_t = ::c_ulong;
pub type nl_item = ::c_int;
pub type idtype_t = ::c_uint;
+pub type loff_t = ::c_longlong;
+
+pub type __u8 = ::c_uchar;
+pub type __u16 = ::c_ushort;
+pub type __s16 = ::c_short;
+pub type __u32 = ::c_uint;
+pub type __s32 = ::c_int;
pub enum fpos64_t {} // TODO: fill this out with a struct
@@ -98,6 +105,14 @@ s! {
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
}
+ pub struct pthread_rwlockattr_t {
+ #[cfg(any(target_env = "musl"))]
+ __align: [::c_int; 0],
+ #[cfg(not(any(target_env = "musl")))]
+ __align: [::c_long; 0],
+ size: [u8; __SIZEOF_PTHREAD_RWLOCKATTR_T],
+ }
+
pub struct pthread_cond_t {
#[cfg(any(target_env = "musl"))]
__align: [*const ::c_void; 0],
@@ -225,6 +240,119 @@ s! {
pub msg_hdr: ::msghdr,
pub msg_len: ::c_uint,
}
+
+ pub struct sembuf {
+ pub sem_num: ::c_ushort,
+ pub sem_op: ::c_short,
+ pub sem_flg: ::c_short,
+ }
+
+ pub struct input_event {
+ pub time: ::timeval,
+ pub type_: ::__u16,
+ pub code: ::__u16,
+ pub value: ::__s32,
+ }
+
+ pub struct input_id {
+ pub bustype: ::__u16,
+ pub vendor: ::__u16,
+ pub product: ::__u16,
+ pub version: ::__u16,
+ }
+
+ pub struct input_absinfo {
+ pub value: ::__s32,
+ pub minimum: ::__s32,
+ pub maximum: ::__s32,
+ pub fuzz: ::__s32,
+ pub flat: ::__s32,
+ pub resolution: ::__s32,
+ }
+
+ pub struct input_keymap_entry {
+ pub flags: ::__u8,
+ pub len: ::__u8,
+ pub index: ::__u16,
+ pub keycode: ::__u32,
+ pub scancode: [::__u8; 32],
+ }
+
+ pub struct input_mask {
+ pub type_: ::__u32,
+ pub codes_size: ::__u32,
+ pub codes_ptr: ::__u64,
+ }
+
+ pub struct ff_replay {
+ pub length: ::__u16,
+ pub delay: ::__u16,
+ }
+
+ pub struct ff_trigger {
+ pub button: ::__u16,
+ pub interval: ::__u16,
+ }
+
+ pub struct ff_envelope {
+ pub attack_length: ::__u16,
+ pub attack_level: ::__u16,
+ pub fade_length: ::__u16,
+ pub fade_level: ::__u16,
+ }
+
+ pub struct ff_constant_effect {
+ pub level: ::__s16,
+ pub envelope: ff_envelope,
+ }
+
+ pub struct ff_ramp_effect {
+ pub start_level: ::__s16,
+ pub end_level: ::__s16,
+ pub envelope: ff_envelope,
+ }
+
+ pub struct ff_condition_effect {
+ pub right_saturation: ::__u16,
+ pub left_saturation: ::__u16,
+
+ pub right_coeff: ::__s16,
+ pub left_coeff: ::__s16,
+
+ pub deadband: ::__u16,
+ pub center: ::__s16,
+ }
+
+ pub struct ff_periodic_effect {
+ pub waveform: ::__u16,
+ pub period: ::__u16,
+ pub magnitude: ::__s16,
+ pub offset: ::__s16,
+ pub phase: ::__u16,
+
+ pub envelope: ff_envelope,
+
+ pub custom_len: ::__u32,
+ pub custom_data: *mut ::__s16,
+ }
+
+ pub struct ff_rumble_effect {
+ pub strong_magnitude: ::__u16,
+ pub weak_magnitude: ::__u16,
+ }
+
+ pub struct ff_effect {
+ pub type_: ::__u16,
+ pub id: ::__s16,
+ pub direction: ::__u16,
+ pub trigger: ff_trigger,
+ pub replay: ff_replay,
+ // FIXME this is actually a union
+ #[cfg(target_pointer_width = "64")]
+ pub u: [u64; 4],
+ #[cfg(target_pointer_width = "32")]
+ pub u: [u32; 7],
+ }
}
pub const ABDAY_1: ::nl_item = 0x20000;
@@ -309,6 +437,18 @@ pub const _PC_PIPE_BUF: ::c_int = 5;
pub const _PC_CHOWN_RESTRICTED: ::c_int = 6;
pub const _PC_NO_TRUNC: ::c_int = 7;
pub const _PC_VDISABLE: ::c_int = 8;
+pub const _PC_SYNC_IO: ::c_int = 9;
+pub const _PC_ASYNC_IO: ::c_int = 10;
+pub const _PC_PRIO_IO: ::c_int = 11;
+pub const _PC_SOCK_MAXBUF: ::c_int = 12;
+pub const _PC_FILESIZEBITS: ::c_int = 13;
+pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14;
+pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15;
+pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16;
+pub const _PC_REC_XFER_ALIGN: ::c_int = 17;
+pub const _PC_ALLOC_SIZE_MIN: ::c_int = 18;
+pub const _PC_SYMLINK_MAX: ::c_int = 19;
+pub const _PC_2_SYMLINKS: ::c_int = 20;
pub const _SC_ARG_MAX: ::c_int = 0;
pub const _SC_CHILD_MAX: ::c_int = 1;
@@ -362,6 +502,7 @@ pub const _SC_2_FORT_DEV: ::c_int = 49;
pub const _SC_2_FORT_RUN: ::c_int = 50;
pub const _SC_2_SW_DEV: ::c_int = 51;
pub const _SC_2_LOCALEDEF: ::c_int = 52;
+pub const _SC_UIO_MAXIOV: ::c_int = 60;
pub const _SC_IOV_MAX: ::c_int = 60;
pub const _SC_THREADS: ::c_int = 67;
pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 68;
@@ -378,8 +519,13 @@ pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 78;
pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 79;
pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 80;
pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 81;
+pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 82;
+pub const _SC_NPROCESSORS_CONF: ::c_int = 83;
pub const _SC_NPROCESSORS_ONLN: ::c_int = 84;
+pub const _SC_PHYS_PAGES: ::c_int = 85;
+pub const _SC_AVPHYS_PAGES: ::c_int = 86;
pub const _SC_ATEXIT_MAX: ::c_int = 87;
+pub const _SC_PASS_MAX: ::c_int = 88;
pub const _SC_XOPEN_VERSION: ::c_int = 89;
pub const _SC_XOPEN_XCU_VERSION: ::c_int = 90;
pub const _SC_XOPEN_UNIX: ::c_int = 91;
@@ -388,13 +534,63 @@ pub const _SC_XOPEN_ENH_I18N: ::c_int = 93;
pub const _SC_XOPEN_SHM: ::c_int = 94;
pub const _SC_2_CHAR_TERM: ::c_int = 95;
pub const _SC_2_UPE: ::c_int = 97;
+pub const _SC_XOPEN_XPG2: ::c_int = 98;
+pub const _SC_XOPEN_XPG3: ::c_int = 99;
+pub const _SC_XOPEN_XPG4: ::c_int = 100;
+pub const _SC_NZERO: ::c_int = 109;
pub const _SC_XBS5_ILP32_OFF32: ::c_int = 125;
pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126;
+pub const _SC_XBS5_LP64_OFF64: ::c_int = 127;
pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 128;
pub const _SC_XOPEN_LEGACY: ::c_int = 129;
pub const _SC_XOPEN_REALTIME: ::c_int = 130;
pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 131;
+pub const _SC_ADVISORY_INFO: ::c_int = 132;
+pub const _SC_BARRIERS: ::c_int = 133;
+pub const _SC_CLOCK_SELECTION: ::c_int = 137;
+pub const _SC_CPUTIME: ::c_int = 138;
+pub const _SC_THREAD_CPUTIME: ::c_int = 139;
+pub const _SC_MONOTONIC_CLOCK: ::c_int = 149;
+pub const _SC_READER_WRITER_LOCKS: ::c_int = 153;
+pub const _SC_SPIN_LOCKS: ::c_int = 154;
+pub const _SC_REGEXP: ::c_int = 155;
+pub const _SC_SHELL: ::c_int = 157;
+pub const _SC_SPAWN: ::c_int = 159;
+pub const _SC_SPORADIC_SERVER: ::c_int = 160;
+pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 161;
+pub const _SC_TIMEOUTS: ::c_int = 164;
+pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 165;
+pub const _SC_2_PBS: ::c_int = 168;
+pub const _SC_2_PBS_ACCOUNTING: ::c_int = 169;
+pub const _SC_2_PBS_LOCATE: ::c_int = 170;
+pub const _SC_2_PBS_MESSAGE: ::c_int = 171;
+pub const _SC_2_PBS_TRACK: ::c_int = 172;
+pub const _SC_SYMLOOP_MAX: ::c_int = 173;
+pub const _SC_STREAMS: ::c_int = 174;
+pub const _SC_2_PBS_CHECKPOINT: ::c_int = 175;
+pub const _SC_V6_ILP32_OFF32: ::c_int = 176;
+pub const _SC_V6_ILP32_OFFBIG: ::c_int = 177;
+pub const _SC_V6_LP64_OFF64: ::c_int = 178;
+pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 179;
pub const _SC_HOST_NAME_MAX: ::c_int = 180;
+pub const _SC_TRACE: ::c_int = 181;
+pub const _SC_TRACE_EVENT_FILTER: ::c_int = 182;
+pub const _SC_TRACE_INHERIT: ::c_int = 183;
+pub const _SC_TRACE_LOG: ::c_int = 184;
+pub const _SC_IPV6: ::c_int = 235;
+pub const _SC_RAW_SOCKETS: ::c_int = 236;
+pub const _SC_V7_ILP32_OFF32: ::c_int = 237;
+pub const _SC_V7_ILP32_OFFBIG: ::c_int = 238;
+pub const _SC_V7_LP64_OFF64: ::c_int = 239;
+pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 240;
+pub const _SC_SS_REPL_MAX: ::c_int = 241;
+pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 242;
+pub const _SC_TRACE_NAME_MAX: ::c_int = 243;
+pub const _SC_TRACE_SYS_MAX: ::c_int = 244;
+pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 245;
+pub const _SC_XOPEN_STREAMS: ::c_int = 246;
+pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 247;
+pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248;
pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY;
pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY;
@@ -460,6 +656,8 @@ pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
+pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0;
+pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
pub const SCHED_OTHER: ::c_int = 0;
@@ -697,14 +895,32 @@ pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2;
pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3;
pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4;
+pub const ITIMER_REAL: ::c_int = 0;
+pub const ITIMER_VIRTUAL: ::c_int = 1;
+pub const ITIMER_PROF: ::c_int = 2;
+
pub const XATTR_CREATE: ::c_int = 0x1;
pub const XATTR_REPLACE: ::c_int = 0x2;
+pub const _POSIX_VDISABLE: ::cc_t = 0;
+
+pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
+pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
+pub const FALLOC_FL_COLLAPSE_RANGE: ::c_int = 0x08;
+pub const FALLOC_FL_ZERO_RANGE: ::c_int = 0x10;
+pub const FALLOC_FL_INSERT_RANGE: ::c_int = 0x20;
+pub const FALLOC_FL_UNSHARE_RANGE: ::c_int = 0x40;
+
// On Linux, libc doesn't define this constant, libattr does instead.
// We still define it for Linux as it's defined by libc on other platforms,
// and it's mentioned in the man pages for getxattr and setxattr.
pub const ENOATTR: ::c_int = ::ENODATA;
+pub const SO_ORIGINAL_DST: ::c_int = 80;
+pub const IUTF8: ::tcflag_t = 0x00004000;
+pub const CMSPAR: ::tcflag_t = 0o10000000000;
+pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
+
f! {
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
for slot in cpuset.bits.iter_mut() {
@@ -777,6 +993,7 @@ extern {
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
pub fn setpwent();
+ pub fn endpwent();
pub fn getpwent() -> *mut passwd;
pub fn setspent();
pub fn endspent();
@@ -796,6 +1013,11 @@ extern {
cmd: ::c_int,
buf: *mut ::shmid_ds) -> ::c_int;
pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
+ pub fn semget(key: ::key_t, nsems: ::c_int, semflag: ::c_int) -> ::c_int;
+ pub fn semop(semid: ::c_int,
+ sops: *mut ::sembuf, nsops: ::size_t) -> ::c_int;
+ pub fn semctl(semid: ::c_int,
+ semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int;
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,
@@ -884,7 +1106,6 @@ extern {
timeout: ::c_int,
sigmask: *const ::sigset_t) -> ::c_int;
pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
- pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
pub fn mkostemps(template: *mut ::c_char,
suffixlen: ::c_int,
@@ -894,15 +1115,6 @@ extern {
timeout: *const ::timespec) -> ::c_int;
pub fn sigwaitinfo(set: *const sigset_t,
info: *mut siginfo_t) -> ::c_int;
- pub fn openpty(amaster: *mut ::c_int,
- aslave: *mut ::c_int,
- name: *mut ::c_char,
- termp: *const termios,
- winp: *const ::winsize) -> ::c_int;
- pub fn forkpty(amaster: *mut ::c_int,
- name: *mut ::c_char,
- termp: *const termios,
- winp: *const ::winsize) -> ::pid_t;
pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
@@ -911,6 +1123,8 @@ extern {
serv: *mut ::c_char,
sevlen: ::socklen_t,
flags: ::c_int) -> ::c_int;
+ pub fn pthread_setschedprio(native: ::pthread_t,
+ priority: ::c_int) -> ::c_int;
pub fn prlimit(pid: ::pid_t, resource: ::c_int, new_limit: *const ::rlimit,
old_limit: *mut ::rlimit) -> ::c_int;
pub fn prlimit64(pid: ::pid_t,
@@ -933,8 +1147,6 @@ extern {
pub fn reboot(how_to: ::c_int) -> ::c_int;
pub fn setfsgid(gid: ::gid_t) -> ::c_int;
pub fn setfsuid(uid: ::uid_t) -> ::c_int;
- pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
- pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
// Not available now on Android
pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
@@ -994,19 +1206,173 @@ extern {
flags: ::c_int) -> ::ssize_t;
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
-> ::ssize_t;
-}
-
-extern {
+ pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
+ pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int;
+ pub fn vhangup() -> ::c_int;
pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
flags: ::c_int) -> ::c_int;
pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut mmsghdr, vlen: ::c_uint,
flags: ::c_int, timeout: *mut ::timespec) -> ::c_int;
+ pub fn sync();
+ pub fn syscall(num: ::c_long, ...) -> ::c_long;
+ pub fn sched_getaffinity(pid: ::pid_t,
+ cpusetsize: ::size_t,
+ cpuset: *mut cpu_set_t) -> ::c_int;
+ pub fn sched_setaffinity(pid: ::pid_t,
+ cpusetsize: ::size_t,
+ cpuset: *const cpu_set_t) -> ::c_int;
+ pub fn epoll_create(size: ::c_int) -> ::c_int;
+ pub fn epoll_create1(flags: ::c_int) -> ::c_int;
+ pub fn epoll_wait(epfd: ::c_int,
+ events: *mut ::epoll_event,
+ maxevents: ::c_int,
+ timeout: ::c_int) -> ::c_int;
+ pub fn epoll_ctl(epfd: ::c_int,
+ op: ::c_int,
+ fd: ::c_int,
+ event: *mut ::epoll_event) -> ::c_int;
+ pub fn pthread_getschedparam(native: ::pthread_t,
+ policy: *mut ::c_int,
+ param: *mut ::sched_param) -> ::c_int;
+ pub fn unshare(flags: ::c_int) -> ::c_int;
+ pub fn umount(target: *const ::c_char) -> ::c_int;
+ pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
+ pub fn tee(fd_in: ::c_int,
+ fd_out: ::c_int,
+ len: ::size_t,
+ flags: ::c_uint) -> ::ssize_t;
+ pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
+ pub fn splice(fd_in: ::c_int,
+ off_in: *mut ::loff_t,
+ fd_out: ::c_int,
+ off_out: *mut ::loff_t,
+ len: ::size_t,
+ flags: ::c_uint) -> ::ssize_t;
+ pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
+ pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn sem_timedwait(sem: *mut sem_t,
+ abstime: *const ::timespec) -> ::c_int;
+ pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int;
+ pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int;
+ pub fn swapoff(puath: *const ::c_char) -> ::c_int;
+ pub fn vmsplice(fd: ::c_int,
+ iov: *const ::iovec,
+ nr_segs: ::size_t,
+ flags: ::c_uint) -> ::ssize_t;
+ pub fn mount(src: *const ::c_char,
+ target: *const ::c_char,
+ fstype: *const ::c_char,
+ flags: ::c_ulong,
+ data: *const ::c_void) -> ::c_int;
+ pub fn personality(persona: ::c_ulong) -> ::c_int;
+ pub fn prctl(option: ::c_int, ...) -> ::c_int;
+ pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int;
+ pub fn ppoll(fds: *mut ::pollfd,
+ nfds: nfds_t,
+ timeout: *const ::timespec,
+ sigmask: *const sigset_t) -> ::c_int;
+ pub fn pthread_mutex_timedlock(lock: *mut pthread_mutex_t,
+ abstime: *const ::timespec) -> ::c_int;
+ pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int,
+ child_stack: *mut ::c_void,
+ flags: ::c_int,
+ arg: *mut ::c_void, ...) -> ::c_int;
+ pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
+ pub fn clock_nanosleep(clk_id: ::clockid_t,
+ flags: ::c_int,
+ rqtp: *const ::timespec,
+ rmtp: *mut ::timespec) -> ::c_int;
+ pub fn pthread_attr_getguardsize(attr: *const ::pthread_attr_t,
+ guardsize: *mut ::size_t) -> ::c_int;
+ pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
+ pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
+ pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
+ pshared: *mut ::c_int) -> ::c_int;
+ pub fn sysinfo(info: *mut ::sysinfo) -> ::c_int;
+ pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int;
+ pub fn pthread_setschedparam(native: ::pthread_t,
+ policy: ::c_int,
+ param: *const ::sched_param) -> ::c_int;
+ pub fn swapon(path: *const ::c_char, swapflags: ::c_int) -> ::c_int;
+ pub fn sched_setscheduler(pid: ::pid_t,
+ policy: ::c_int,
+ param: *const ::sched_param) -> ::c_int;
+ pub fn sendfile(out_fd: ::c_int,
+ in_fd: ::c_int,
+ offset: *mut off_t,
+ count: ::size_t) -> ::ssize_t;
+ pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
+ pub fn getgrgid_r(uid: ::uid_t,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "sigaltstack$UNIX2003")]
+ #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
+ pub fn sigaltstack(ss: *const stack_t,
+ oss: *mut stack_t) -> ::c_int;
+ pub fn sem_close(sem: *mut sem_t) -> ::c_int;
+ pub fn getdtablesize() -> ::c_int;
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
+ pub fn getgrnam_r(name: *const ::c_char,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_sigmask$UNIX2003")]
+ pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
+ oldset: *mut sigset_t) -> ::c_int;
+ pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
+ pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+ pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+ pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
+ pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
+ pub fn getpwnam_r(name: *const ::c_char,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
+ pub fn getpwuid_r(uid: ::uid_t,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
+ link_name = "sigwait$UNIX2003")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+ pub fn sigwait(set: *const sigset_t,
+ sig: *mut ::c_int) -> ::c_int;
+ pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+ parent: Option<unsafe extern fn()>,
+ child: Option<unsafe extern fn()>) -> ::c_int;
+ pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+ pub fn getgrouplist(user: *const ::c_char,
+ group: ::gid_t,
+ groups: *mut ::gid_t,
+ ngroups: *mut ::c_int) -> ::c_int;
+ pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
+ pshared: *mut ::c_int) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "popen$UNIX2003")]
+ pub fn popen(command: *const c_char,
+ mode: *const c_char) -> *mut ::FILE;
+ pub fn faccessat(dirfd: ::c_int, pathname: *const ::c_char,
+ mode: ::c_int, flags: ::c_int) -> ::c_int;
+ pub fn pthread_create(native: *mut ::pthread_t,
+ attr: *const ::pthread_attr_t,
+ f: extern fn(*mut ::c_void) -> *mut ::c_void,
+ value: *mut ::c_void) -> ::c_int;
}
cfg_if! {
- if #[cfg(any(target_env = "musl",
- target_os = "fuchsia",
- target_os = "emscripten"))] {
+ if #[cfg(any(target_env = "musl", target_os = "fuchsia"))] {
mod musl;
pub use self::musl::*;
} else if #[cfg(any(target_arch = "mips",
diff --git a/libc/src/unix/notbsd/linux/musl/b32/arm.rs b/libc/src/unix/notbsd/linux/musl/b32/arm.rs
index ce198ac..d0b4660 100644
--- a/libc/src/unix/notbsd/linux/musl/b32/arm.rs
+++ b/libc/src/unix/notbsd/linux/musl/b32/arm.rs
@@ -107,12 +107,44 @@ s! {
pub _pad: [::c_int; 29],
_align: [usize; 0],
}
+
+ pub struct statfs64 {
+ pub f_type: ::c_ulong,
+ pub f_bsize: ::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_fsid: ::fsid_t,
+ pub f_namelen: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_flags: ::c_ulong,
+ pub f_spare: [::c_ulong; 4],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: u64,
+ pub f_fsid: ::c_ulong,
+ __f_unused: ::c_int,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ __f_spare: [::c_int; 6],
+ }
}
pub const O_DIRECT: ::c_int = 0x4000;
pub const O_DIRECTORY: ::c_int = 0x10000;
pub const O_NOFOLLOW: ::c_int = 0x20000;
pub const O_ASYNC: ::c_int = 0x2000;
+pub const O_LARGEFILE: ::c_int = 0o400000;
pub const FIOCLEX: ::c_int = 0x5451;
pub const FIONBIO: ::c_int = 0x5421;
@@ -339,8 +371,22 @@ pub const TIOCMSET: ::c_int = 0x5418;
pub const FIONREAD: ::c_int = 0x541B;
pub const TIOCCONS: ::c_int = 0x541D;
+pub const SYS_pivot_root: ::c_long = 218;
pub const SYS_gettid: ::c_long = 224;
pub const SYS_perf_event_open: ::c_long = 364;
+pub const SYS_memfd_create: ::c_long = 385;
pub const POLLWRNORM: ::c_short = 0x100;
pub const POLLWRBAND: ::c_short = 0x200;
+
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x008;
+pub const TIOCM_SR: ::c_int = 0x010;
+pub const TIOCM_CTS: ::c_int = 0x020;
+pub const TIOCM_CAR: ::c_int = 0x040;
+pub const TIOCM_RNG: ::c_int = 0x080;
+pub const TIOCM_DSR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
diff --git a/libc/src/unix/notbsd/linux/musl/b32/asmjs.rs b/libc/src/unix/notbsd/linux/musl/b32/asmjs.rs
deleted file mode 100644
index e890a34..0000000
--- a/libc/src/unix/notbsd/linux/musl/b32/asmjs.rs
+++ /dev/null
@@ -1,336 +0,0 @@
-pub type c_char = u8;
-pub type wchar_t = u32;
-
-s! {
- pub struct stat {
- pub st_dev: ::dev_t,
- __st_dev_padding: ::c_int,
- __st_ino_truncated: ::c_long,
- pub st_mode: ::mode_t,
- pub st_nlink: ::nlink_t,
- pub st_uid: ::uid_t,
- pub st_gid: ::gid_t,
- pub st_rdev: ::dev_t,
- __st_rdev_padding: ::c_int,
- pub st_size: ::off_t,
- pub st_blksize: ::blksize_t,
- pub st_blocks: ::blkcnt_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_ino: ::ino_t,
- }
-
- pub struct stat64 {
- pub st_dev: ::dev_t,
- __st_dev_padding: ::c_int,
- __st_ino_truncated: ::c_long,
- pub st_mode: ::mode_t,
- pub st_nlink: ::nlink_t,
- pub st_uid: ::uid_t,
- pub st_gid: ::gid_t,
- pub st_rdev: ::dev_t,
- __st_rdev_padding: ::c_int,
- pub st_size: ::off_t,
- pub st_blksize: ::blksize_t,
- pub st_blocks: ::blkcnt_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_ino: ::ino_t,
- }
-
- pub struct stack_t {
- pub ss_sp: *mut ::c_void,
- pub ss_flags: ::c_int,
- pub ss_size: ::size_t
- }
-
- pub struct shmid_ds {
- pub shm_perm: ::ipc_perm,
- pub shm_segsz: ::size_t,
- pub shm_atime: ::time_t,
- __unused1: ::c_int,
- pub shm_dtime: ::time_t,
- __unused2: ::c_int,
- pub shm_ctime: ::time_t,
- __unused3: ::c_int,
- pub shm_cpid: ::pid_t,
- pub shm_lpid: ::pid_t,
- pub shm_nattch: ::c_ulong,
- __pad1: ::c_ulong,
- __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,
- 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_fsid: ::fsid_t,
- pub f_namelen: ::c_ulong,
- pub f_frsize: ::c_ulong,
- pub f_flags: ::c_ulong,
- pub f_spare: [::c_ulong; 4],
- }
-
- pub struct siginfo_t {
- pub si_signo: ::c_int,
- pub si_errno: ::c_int,
- pub si_code: ::c_int,
- pub _pad: [::c_int; 29],
- _align: [usize; 0],
- }
-}
-
-pub const O_DIRECT: ::c_int = 0x4000;
-pub const O_DIRECTORY: ::c_int = 0x10000;
-pub const O_NOFOLLOW: ::c_int = 0x20000;
-pub const O_ASYNC: ::c_int = 0x2000;
-
-pub const FIOCLEX: ::c_int = 0x5451;
-pub const FIONBIO: ::c_int = 0x5421;
-
-pub const RLIMIT_RSS: ::c_int = 5;
-pub const RLIMIT_NOFILE: ::c_int = 7;
-pub const RLIMIT_AS: ::c_int = 9;
-pub const RLIMIT_NPROC: ::c_int = 6;
-pub const RLIMIT_MEMLOCK: ::c_int = 8;
-
-pub const O_APPEND: ::c_int = 1024;
-pub const O_CREAT: ::c_int = 64;
-pub const O_EXCL: ::c_int = 128;
-pub const O_NOCTTY: ::c_int = 256;
-pub const O_NONBLOCK: ::c_int = 2048;
-pub const O_SYNC: ::c_int = 1052672;
-pub const O_RSYNC: ::c_int = 1052672;
-pub const O_DSYNC: ::c_int = 4096;
-
-pub const SOCK_NONBLOCK: ::c_int = 2048;
-
-pub const MAP_ANON: ::c_int = 0x0020;
-pub const MAP_GROWSDOWN: ::c_int = 0x0100;
-pub const MAP_DENYWRITE: ::c_int = 0x0800;
-pub const MAP_EXECUTABLE: ::c_int = 0x01000;
-pub const MAP_LOCKED: ::c_int = 0x02000;
-pub const MAP_NORESERVE: ::c_int = 0x04000;
-pub const MAP_POPULATE: ::c_int = 0x08000;
-pub const MAP_NONBLOCK: ::c_int = 0x010000;
-pub const MAP_STACK: ::c_int = 0x020000;
-
-pub const SOCK_STREAM: ::c_int = 1;
-pub const SOCK_DGRAM: ::c_int = 2;
-pub const SOCK_SEQPACKET: ::c_int = 5;
-
-pub const SOL_SOCKET: ::c_int = 1;
-
-pub const EDEADLK: ::c_int = 35;
-pub const ENAMETOOLONG: ::c_int = 36;
-pub const ENOLCK: ::c_int = 37;
-pub const ENOSYS: ::c_int = 38;
-pub const ENOTEMPTY: ::c_int = 39;
-pub const ELOOP: ::c_int = 40;
-pub const ENOMSG: ::c_int = 42;
-pub const EIDRM: ::c_int = 43;
-pub const ECHRNG: ::c_int = 44;
-pub const EL2NSYNC: ::c_int = 45;
-pub const EL3HLT: ::c_int = 46;
-pub const EL3RST: ::c_int = 47;
-pub const ELNRNG: ::c_int = 48;
-pub const EUNATCH: ::c_int = 49;
-pub const ENOCSI: ::c_int = 50;
-pub const EL2HLT: ::c_int = 51;
-pub const EBADE: ::c_int = 52;
-pub const EBADR: ::c_int = 53;
-pub const EXFULL: ::c_int = 54;
-pub const ENOANO: ::c_int = 55;
-pub const EBADRQC: ::c_int = 56;
-pub const EBADSLT: ::c_int = 57;
-pub const EDEADLOCK: ::c_int = EDEADLK;
-pub const EMULTIHOP: ::c_int = 72;
-pub const EBADMSG: ::c_int = 74;
-pub const EOVERFLOW: ::c_int = 75;
-pub const ENOTUNIQ: ::c_int = 76;
-pub const EBADFD: ::c_int = 77;
-pub const EREMCHG: ::c_int = 78;
-pub const ELIBACC: ::c_int = 79;
-pub const ELIBBAD: ::c_int = 80;
-pub const ELIBSCN: ::c_int = 81;
-pub const ELIBMAX: ::c_int = 82;
-pub const ELIBEXEC: ::c_int = 83;
-pub const EILSEQ: ::c_int = 84;
-pub const ERESTART: ::c_int = 85;
-pub const ESTRPIPE: ::c_int = 86;
-pub const EUSERS: ::c_int = 87;
-pub const ENOTSOCK: ::c_int = 88;
-pub const EDESTADDRREQ: ::c_int = 89;
-pub const EMSGSIZE: ::c_int = 90;
-pub const EPROTOTYPE: ::c_int = 91;
-pub const ENOPROTOOPT: ::c_int = 92;
-pub const EPROTONOSUPPORT: ::c_int = 93;
-pub const ESOCKTNOSUPPORT: ::c_int = 94;
-pub const EOPNOTSUPP: ::c_int = 95;
-pub const ENOTSUP: ::c_int = EOPNOTSUPP;
-pub const EPFNOSUPPORT: ::c_int = 96;
-pub const EAFNOSUPPORT: ::c_int = 97;
-pub const EADDRINUSE: ::c_int = 98;
-pub const EADDRNOTAVAIL: ::c_int = 99;
-pub const ENETDOWN: ::c_int = 100;
-pub const ENETUNREACH: ::c_int = 101;
-pub const ENETRESET: ::c_int = 102;
-pub const ECONNABORTED: ::c_int = 103;
-pub const ECONNRESET: ::c_int = 104;
-pub const ENOBUFS: ::c_int = 105;
-pub const EISCONN: ::c_int = 106;
-pub const ENOTCONN: ::c_int = 107;
-pub const ESHUTDOWN: ::c_int = 108;
-pub const ETOOMANYREFS: ::c_int = 109;
-pub const ETIMEDOUT: ::c_int = 110;
-pub const ECONNREFUSED: ::c_int = 111;
-pub const EHOSTDOWN: ::c_int = 112;
-pub const EHOSTUNREACH: ::c_int = 113;
-pub const EALREADY: ::c_int = 114;
-pub const EINPROGRESS: ::c_int = 115;
-pub const ESTALE: ::c_int = 116;
-pub const EUCLEAN: ::c_int = 117;
-pub const ENOTNAM: ::c_int = 118;
-pub const ENAVAIL: ::c_int = 119;
-pub const EISNAM: ::c_int = 120;
-pub const EREMOTEIO: ::c_int = 121;
-pub const EDQUOT: ::c_int = 122;
-pub const ENOMEDIUM: ::c_int = 123;
-pub const EMEDIUMTYPE: ::c_int = 124;
-pub const ECANCELED: ::c_int = 125;
-pub const ENOKEY: ::c_int = 126;
-pub const EKEYEXPIRED: ::c_int = 127;
-pub const EKEYREVOKED: ::c_int = 128;
-pub const EKEYREJECTED: ::c_int = 129;
-pub const EOWNERDEAD: ::c_int = 130;
-pub const ENOTRECOVERABLE: ::c_int = 131;
-pub const ERFKILL: ::c_int = 132;
-pub const EHWPOISON: ::c_int = 133;
-
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_TYPE: ::c_int = 3;
-pub const SO_ERROR: ::c_int = 4;
-pub const SO_DONTROUTE: ::c_int = 5;
-pub const SO_BROADCAST: ::c_int = 6;
-pub const SO_SNDBUF: ::c_int = 7;
-pub const SO_RCVBUF: ::c_int = 8;
-pub const SO_KEEPALIVE: ::c_int = 9;
-pub const SO_OOBINLINE: ::c_int = 10;
-pub const SO_LINGER: ::c_int = 13;
-pub const SO_REUSEPORT: ::c_int = 15;
-pub const SO_RCVLOWAT: ::c_int = 18;
-pub const SO_SNDLOWAT: ::c_int = 19;
-pub const SO_RCVTIMEO: ::c_int = 20;
-pub const SO_SNDTIMEO: ::c_int = 21;
-pub const SO_ACCEPTCONN: ::c_int = 30;
-
-pub const SA_ONSTACK: ::c_int = 0x08000000;
-pub const SA_SIGINFO: ::c_int = 0x00000004;
-pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
-
-pub const SIGCHLD: ::c_int = 17;
-pub const SIGBUS: ::c_int = 7;
-pub const SIGTTIN: ::c_int = 21;
-pub const SIGTTOU: ::c_int = 22;
-pub const SIGXCPU: ::c_int = 24;
-pub const SIGXFSZ: ::c_int = 25;
-pub const SIGVTALRM: ::c_int = 26;
-pub const SIGPROF: ::c_int = 27;
-pub const SIGWINCH: ::c_int = 28;
-pub const SIGUSR1: ::c_int = 10;
-pub const SIGUSR2: ::c_int = 12;
-pub const SIGCONT: ::c_int = 18;
-pub const SIGSTOP: ::c_int = 19;
-pub const SIGTSTP: ::c_int = 20;
-pub const SIGURG: ::c_int = 23;
-pub const SIGIO: ::c_int = 29;
-pub const SIGSYS: ::c_int = 31;
-pub const SIGSTKFLT: ::c_int = 16;
-pub const SIGPOLL: ::c_int = 29;
-pub const SIGPWR: ::c_int = 30;
-pub const SIG_SETMASK: ::c_int = 2;
-pub const SIG_BLOCK: ::c_int = 0x000000;
-pub const SIG_UNBLOCK: ::c_int = 0x01;
-
-pub const EXTPROC: ::tcflag_t = 0x00010000;
-
-pub const MAP_HUGETLB: ::c_int = 0x040000;
-
-pub const F_GETLK: ::c_int = 12;
-pub const F_GETOWN: ::c_int = 9;
-pub const F_SETLK: ::c_int = 13;
-pub const F_SETLKW: ::c_int = 14;
-pub const F_SETOWN: ::c_int = 8;
-
-pub const VEOF: usize = 4;
-pub const VEOL: usize = 11;
-pub const VEOL2: usize = 16;
-pub const VMIN: usize = 6;
-pub const IEXTEN: ::tcflag_t = 0x00008000;
-pub const TOSTOP: ::tcflag_t = 0x00000100;
-pub const FLUSHO: ::tcflag_t = 0x00001000;
-
-pub const TCGETS: ::c_int = 0x5401;
-pub const TCSETS: ::c_int = 0x5402;
-pub const TCSETSW: ::c_int = 0x5403;
-pub const TCSETSF: ::c_int = 0x5404;
-pub const TCGETA: ::c_int = 0x5405;
-pub const TCSETA: ::c_int = 0x5406;
-pub const TCSETAW: ::c_int = 0x5407;
-pub const TCSETAF: ::c_int = 0x5408;
-pub const TCSBRK: ::c_int = 0x5409;
-pub const TCXONC: ::c_int = 0x540A;
-pub const TCFLSH: ::c_int = 0x540B;
-pub const TIOCGSOFTCAR: ::c_int = 0x5419;
-pub const TIOCSSOFTCAR: ::c_int = 0x541A;
-pub const TIOCLINUX: ::c_int = 0x541C;
-pub const TIOCGSERIAL: ::c_int = 0x541E;
-pub const TIOCEXCL: ::c_int = 0x540C;
-pub const TIOCNXCL: ::c_int = 0x540D;
-pub const TIOCSCTTY: ::c_int = 0x540E;
-pub const TIOCGPGRP: ::c_int = 0x540F;
-pub const TIOCSPGRP: ::c_int = 0x5410;
-pub const TIOCOUTQ: ::c_int = 0x5411;
-pub const TIOCSTI: ::c_int = 0x5412;
-pub const TIOCGWINSZ: ::c_int = 0x5413;
-pub const TIOCSWINSZ: ::c_int = 0x5414;
-pub const TIOCMGET: ::c_int = 0x5415;
-pub const TIOCMBIS: ::c_int = 0x5416;
-pub const TIOCMBIC: ::c_int = 0x5417;
-pub const TIOCMSET: ::c_int = 0x5418;
-pub const FIONREAD: ::c_int = 0x541B;
-pub const TIOCCONS: ::c_int = 0x541D;
-
-pub const SYS_gettid: ::c_long = 224; // Valid for arm (32-bit) and x86 (32-bit)
-
-pub const POLLWRNORM: ::c_short = 0x100;
-pub const POLLWRBAND: ::c_short = 0x200;
diff --git a/libc/src/unix/notbsd/linux/musl/b32/mips.rs b/libc/src/unix/notbsd/linux/musl/b32/mips.rs
index 23c1a26..9403977 100644
--- a/libc/src/unix/notbsd/linux/musl/b32/mips.rs
+++ b/libc/src/unix/notbsd/linux/musl/b32/mips.rs
@@ -115,12 +115,47 @@ s! {
pub _pad: [::c_int; 29],
_align: [usize; 0],
}
+
+ pub struct statfs64 {
+ pub f_type: ::c_ulong,
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: ::fsblkcnt_t,
+ pub f_bfree: ::fsblkcnt_t,
+ pub f_files: ::fsfilcnt_t,
+ pub f_ffree: ::fsfilcnt_t,
+ pub f_bavail: ::fsblkcnt_t,
+ pub f_fsid: ::fsid_t,
+ pub f_namelen: ::c_ulong,
+ pub f_flags: ::c_ulong,
+ pub f_spare: [::c_ulong; 5],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: u64,
+ #[cfg(target_endian = "little")]
+ pub f_fsid: ::c_ulong,
+ __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],
+ }
}
pub const O_DIRECT: ::c_int = 0o100000;
pub const O_DIRECTORY: ::c_int = 0o200000;
pub const O_NOFOLLOW: ::c_int = 0o400000;
pub const O_ASYNC: ::c_int = 0o10000;
+pub const O_LARGEFILE: ::c_int = 0x2000;
pub const FIOCLEX: ::c_int = 0x6601;
pub const FIONBIO: ::c_int = 0x667E;
@@ -347,8 +382,23 @@ pub const TIOCMSET: ::c_int = 0x741A;
pub const FIONREAD: ::c_int = 0x467F;
pub const TIOCCONS: ::c_int = 0x80047478;
-pub const SYS_gettid: ::c_long = 4222; // Valid for O32
-pub const SYS_perf_event_open: ::c_long = 4333; // Valid for O32
+// Valid for O32
+pub const SYS_pivot_root: ::c_long = 4216;
+pub const SYS_gettid: ::c_long = 4222;
+pub const SYS_perf_event_open: ::c_long = 4333;
+pub const SYS_memfd_create: ::c_long = 4354;
pub const POLLWRNORM: ::c_short = 0x4;
pub const POLLWRBAND: ::c_short = 0x100;
+
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x010;
+pub const TIOCM_SR: ::c_int = 0x020;
+pub const TIOCM_CTS: ::c_int = 0x040;
+pub const TIOCM_CAR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RNG: ::c_int = 0x200;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+pub const TIOCM_DSR: ::c_int = 0x400;
diff --git a/libc/src/unix/notbsd/linux/musl/b32/mod.rs b/libc/src/unix/notbsd/linux/musl/b32/mod.rs
index 61eb6db..58c971b 100644
--- a/libc/src/unix/notbsd/linux/musl/b32/mod.rs
+++ b/libc/src/unix/notbsd/linux/musl/b32/mod.rs
@@ -1,6 +1,7 @@
pub type c_long = i32;
pub type c_ulong = u32;
pub type nlink_t = u32;
+pub type __u64 = ::c_ulonglong;
s! {
pub struct pthread_attr_t {
@@ -45,11 +46,6 @@ cfg_if! {
} else if #[cfg(any(target_arch = "arm"))] {
mod arm;
pub use self::arm::*;
- } else if #[cfg(any(target_arch = "asmjs", target_arch = "wasm32"))] {
- // For the time being asmjs and wasm32 are the same, and both
- // backed by identical emscripten runtimes
- mod asmjs;
- pub use self::asmjs::*;
} else {
// Unknown target_arch
}
diff --git a/libc/src/unix/notbsd/linux/musl/b32/x86.rs b/libc/src/unix/notbsd/linux/musl/b32/x86.rs
index 9daeb58..812d743 100644
--- a/libc/src/unix/notbsd/linux/musl/b32/x86.rs
+++ b/libc/src/unix/notbsd/linux/musl/b32/x86.rs
@@ -120,12 +120,44 @@ s! {
pub _pad: [::c_int; 29],
_align: [usize; 0],
}
+
+ pub struct statfs64 {
+ pub f_type: ::c_ulong,
+ pub f_bsize: ::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_fsid: ::fsid_t,
+ pub f_namelen: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_flags: ::c_ulong,
+ pub f_spare: [::c_ulong; 4],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: u64,
+ pub f_fsid: ::c_ulong,
+ __f_unused: ::c_int,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ __f_spare: [::c_int; 6],
+ }
}
pub const O_DIRECT: ::c_int = 0x4000;
pub const O_DIRECTORY: ::c_int = 0x10000;
pub const O_NOFOLLOW: ::c_int = 0x20000;
pub const O_ASYNC: ::c_int = 0x2000;
+pub const O_LARGEFILE: ::c_int = 0o0100000;
pub const FIOCLEX: ::c_int = 0x5451;
pub const FIONBIO: ::c_int = 0x5421;
@@ -353,8 +385,416 @@ pub const TIOCMSET: ::c_int = 0x5418;
pub const FIONREAD: ::c_int = 0x541B;
pub const TIOCCONS: ::c_int = 0x541D;
+pub const POLLWRNORM: ::c_short = 0x100;
+pub const POLLWRBAND: ::c_short = 0x200;
+
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x008;
+pub const TIOCM_SR: ::c_int = 0x010;
+pub const TIOCM_CTS: ::c_int = 0x020;
+pub const TIOCM_CAR: ::c_int = 0x040;
+pub const TIOCM_RNG: ::c_int = 0x080;
+pub const TIOCM_DSR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+
+// Syscall table
+pub const SYS_restart_syscall: ::c_long = 0;
+pub const SYS_exit: ::c_long = 1;
+pub const SYS_fork: ::c_long = 2;
+pub const SYS_read: ::c_long = 3;
+pub const SYS_write: ::c_long = 4;
+pub const SYS_open: ::c_long = 5;
+pub const SYS_close: ::c_long = 6;
+pub const SYS_waitpid: ::c_long = 7;
+pub const SYS_creat: ::c_long = 8;
+pub const SYS_link: ::c_long = 9;
+pub const SYS_unlink: ::c_long = 10;
+pub const SYS_execve: ::c_long = 11;
+pub const SYS_chdir: ::c_long = 12;
+pub const SYS_time: ::c_long = 13;
+pub const SYS_mknod: ::c_long = 14;
+pub const SYS_chmod: ::c_long = 15;
+pub const SYS_lchown: ::c_long = 16;
+pub const SYS_break: ::c_long = 17;
+pub const SYS_oldstat: ::c_long = 18;
+pub const SYS_lseek: ::c_long = 19;
+pub const SYS_getpid: ::c_long = 20;
+pub const SYS_mount: ::c_long = 21;
+pub const SYS_umount: ::c_long = 22;
+pub const SYS_setuid: ::c_long = 23;
+pub const SYS_getuid: ::c_long = 24;
+pub const SYS_stime: ::c_long = 25;
+pub const SYS_ptrace: ::c_long = 26;
+pub const SYS_alarm: ::c_long = 27;
+pub const SYS_oldfstat: ::c_long = 28;
+pub const SYS_pause: ::c_long = 29;
+pub const SYS_utime: ::c_long = 30;
+pub const SYS_stty: ::c_long = 31;
+pub const SYS_gtty: ::c_long = 32;
+pub const SYS_access: ::c_long = 33;
+pub const SYS_nice: ::c_long = 34;
+pub const SYS_ftime: ::c_long = 35;
+pub const SYS_sync: ::c_long = 36;
+pub const SYS_kill: ::c_long = 37;
+pub const SYS_rename: ::c_long = 38;
+pub const SYS_mkdir: ::c_long = 39;
+pub const SYS_rmdir: ::c_long = 40;
+pub const SYS_dup: ::c_long = 41;
+pub const SYS_pipe: ::c_long = 42;
+pub const SYS_times: ::c_long = 43;
+pub const SYS_prof: ::c_long = 44;
+pub const SYS_brk: ::c_long = 45;
+pub const SYS_setgid: ::c_long = 46;
+pub const SYS_getgid: ::c_long = 47;
+pub const SYS_signal: ::c_long = 48;
+pub const SYS_geteuid: ::c_long = 49;
+pub const SYS_getegid: ::c_long = 50;
+pub const SYS_acct: ::c_long = 51;
+pub const SYS_umount2: ::c_long = 52;
+pub const SYS_lock: ::c_long = 53;
+pub const SYS_ioctl: ::c_long = 54;
+pub const SYS_fcntl: ::c_long = 55;
+pub const SYS_mpx: ::c_long = 56;
+pub const SYS_setpgid: ::c_long = 57;
+pub const SYS_ulimit: ::c_long = 58;
+pub const SYS_oldolduname: ::c_long = 59;
+pub const SYS_umask: ::c_long = 60;
+pub const SYS_chroot: ::c_long = 61;
+pub const SYS_ustat: ::c_long = 62;
+pub const SYS_dup2: ::c_long = 63;
+pub const SYS_getppid: ::c_long = 64;
+pub const SYS_getpgrp: ::c_long = 65;
+pub const SYS_setsid: ::c_long = 66;
+pub const SYS_sigaction: ::c_long = 67;
+pub const SYS_sgetmask: ::c_long = 68;
+pub const SYS_ssetmask: ::c_long = 69;
+pub const SYS_setreuid: ::c_long = 70;
+pub const SYS_setregid: ::c_long = 71;
+pub const SYS_sigsuspend: ::c_long = 72;
+pub const SYS_sigpending: ::c_long = 73;
+pub const SYS_sethostname: ::c_long = 74;
+pub const SYS_setrlimit: ::c_long = 75;
+pub const SYS_getrlimit: ::c_long = 76;
+pub const SYS_getrusage: ::c_long = 77;
+pub const SYS_gettimeofday: ::c_long = 78;
+pub const SYS_settimeofday: ::c_long = 79;
+pub const SYS_getgroups: ::c_long = 80;
+pub const SYS_setgroups: ::c_long = 81;
+pub const SYS_select: ::c_long = 82;
+pub const SYS_symlink: ::c_long = 83;
+pub const SYS_oldlstat: ::c_long = 84;
+pub const SYS_readlink: ::c_long = 85;
+pub const SYS_uselib: ::c_long = 86;
+pub const SYS_swapon: ::c_long = 87;
+pub const SYS_reboot: ::c_long = 88;
+pub const SYS_readdir: ::c_long = 89;
+pub const SYS_mmap: ::c_long = 90;
+pub const SYS_munmap: ::c_long = 91;
+pub const SYS_truncate: ::c_long = 92;
+pub const SYS_ftruncate: ::c_long = 93;
+pub const SYS_fchmod: ::c_long = 94;
+pub const SYS_fchown: ::c_long = 95;
+pub const SYS_getpriority: ::c_long = 96;
+pub const SYS_setpriority: ::c_long = 97;
+pub const SYS_profil: ::c_long = 98;
+pub const SYS_statfs: ::c_long = 99;
+pub const SYS_fstatfs: ::c_long = 100;
+pub const SYS_ioperm: ::c_long = 101;
+pub const SYS_socketcall: ::c_long = 102;
+pub const SYS_syslog: ::c_long = 103;
+pub const SYS_setitimer: ::c_long = 104;
+pub const SYS_getitimer: ::c_long = 105;
+pub const SYS_stat: ::c_long = 106;
+pub const SYS_lstat: ::c_long = 107;
+pub const SYS_fstat: ::c_long = 108;
+pub const SYS_olduname: ::c_long = 109;
+pub const SYS_iopl: ::c_long = 110;
+pub const SYS_vhangup: ::c_long = 111;
+pub const SYS_idle: ::c_long = 112;
+pub const SYS_vm86old: ::c_long = 113;
+pub const SYS_wait4: ::c_long = 114;
+pub const SYS_swapoff: ::c_long = 115;
+pub const SYS_sysinfo: ::c_long = 116;
+pub const SYS_ipc: ::c_long = 117;
+pub const SYS_fsync: ::c_long = 118;
+pub const SYS_sigreturn: ::c_long = 119;
+pub const SYS_clone: ::c_long = 120;
+pub const SYS_setdomainname: ::c_long = 121;
+pub const SYS_uname: ::c_long = 122;
+pub const SYS_modify_ldt: ::c_long = 123;
+pub const SYS_adjtimex: ::c_long = 124;
+pub const SYS_mprotect: ::c_long = 125;
+pub const SYS_sigprocmask: ::c_long = 126;
+pub const SYS_create_module: ::c_long = 127;
+pub const SYS_init_module: ::c_long = 128;
+pub const SYS_delete_module: ::c_long = 129;
+pub const SYS_get_kernel_syms: ::c_long = 130;
+pub const SYS_quotactl: ::c_long = 131;
+pub const SYS_getpgid: ::c_long = 132;
+pub const SYS_fchdir: ::c_long = 133;
+pub const SYS_bdflush: ::c_long = 134;
+pub const SYS_sysfs: ::c_long = 135;
+pub const SYS_personality: ::c_long = 136;
+pub const SYS_afs_syscall: ::c_long = 137;
+pub const SYS_setfsuid: ::c_long = 138;
+pub const SYS_setfsgid: ::c_long = 139;
+pub const SYS__llseek: ::c_long = 140;
+pub const SYS_getdents: ::c_long = 141;
+pub const SYS__newselect: ::c_long = 142;
+pub const SYS_flock: ::c_long = 143;
+pub const SYS_msync: ::c_long = 144;
+pub const SYS_readv: ::c_long = 145;
+pub const SYS_writev: ::c_long = 146;
+pub const SYS_getsid: ::c_long = 147;
+pub const SYS_fdatasync: ::c_long = 148;
+pub const SYS__sysctl: ::c_long = 149;
+pub const SYS_mlock: ::c_long = 150;
+pub const SYS_munlock: ::c_long = 151;
+pub const SYS_mlockall: ::c_long = 152;
+pub const SYS_munlockall: ::c_long = 153;
+pub const SYS_sched_setparam: ::c_long = 154;
+pub const SYS_sched_getparam: ::c_long = 155;
+pub const SYS_sched_setscheduler: ::c_long = 156;
+pub const SYS_sched_getscheduler: ::c_long = 157;
+pub const SYS_sched_yield: ::c_long = 158;
+pub const SYS_sched_get_priority_max: ::c_long = 159;
+pub const SYS_sched_get_priority_min: ::c_long = 160;
+pub const SYS_sched_rr_get_interval: ::c_long = 161;
+pub const SYS_nanosleep: ::c_long = 162;
+pub const SYS_mremap: ::c_long = 163;
+pub const SYS_setresuid: ::c_long = 164;
+pub const SYS_getresuid: ::c_long = 165;
+pub const SYS_vm86: ::c_long = 166;
+pub const SYS_query_module: ::c_long = 167;
+pub const SYS_poll: ::c_long = 168;
+pub const SYS_nfsservctl: ::c_long = 169;
+pub const SYS_setresgid: ::c_long = 170;
+pub const SYS_getresgid: ::c_long = 171;
+pub const SYS_prctl: ::c_long = 172;
+pub const SYS_rt_sigreturn: ::c_long = 173;
+pub const SYS_rt_sigaction: ::c_long = 174;
+pub const SYS_rt_sigprocmask: ::c_long = 175;
+pub const SYS_rt_sigpending: ::c_long = 176;
+pub const SYS_rt_sigtimedwait: ::c_long = 177;
+pub const SYS_rt_sigqueueinfo: ::c_long = 178;
+pub const SYS_rt_sigsuspend: ::c_long = 179;
+pub const SYS_pread64: ::c_long = 180;
+pub const SYS_pwrite64: ::c_long = 181;
+pub const SYS_chown: ::c_long = 182;
+pub const SYS_getcwd: ::c_long = 183;
+pub const SYS_capget: ::c_long = 184;
+pub const SYS_capset: ::c_long = 185;
+pub const SYS_sigaltstack: ::c_long = 186;
+pub const SYS_sendfile: ::c_long = 187;
+pub const SYS_getpmsg: ::c_long = 188;
+pub const SYS_putpmsg: ::c_long = 189;
+pub const SYS_vfork: ::c_long = 190;
+pub const SYS_ugetrlimit: ::c_long = 191;
+pub const SYS_mmap2: ::c_long = 192;
+pub const SYS_truncate64: ::c_long = 193;
+pub const SYS_ftruncate64: ::c_long = 194;
+pub const SYS_stat64: ::c_long = 195;
+pub const SYS_lstat64: ::c_long = 196;
+pub const SYS_fstat64: ::c_long = 197;
+pub const SYS_lchown32: ::c_long = 198;
+pub const SYS_getuid32: ::c_long = 199;
+pub const SYS_getgid32: ::c_long = 200;
+pub const SYS_geteuid32: ::c_long = 201;
+pub const SYS_getegid32: ::c_long = 202;
+pub const SYS_setreuid32: ::c_long = 203;
+pub const SYS_setregid32: ::c_long = 204;
+pub const SYS_getgroups32: ::c_long = 205;
+pub const SYS_setgroups32: ::c_long = 206;
+pub const SYS_fchown32: ::c_long = 207;
+pub const SYS_setresuid32: ::c_long = 208;
+pub const SYS_getresuid32: ::c_long = 209;
+pub const SYS_setresgid32: ::c_long = 210;
+pub const SYS_getresgid32: ::c_long = 211;
+pub const SYS_chown32: ::c_long = 212;
+pub const SYS_setuid32: ::c_long = 213;
+pub const SYS_setgid32: ::c_long = 214;
+pub const SYS_setfsuid32: ::c_long = 215;
+pub const SYS_setfsgid32: ::c_long = 216;
+pub const SYS_pivot_root: ::c_long = 217;
+pub const SYS_mincore: ::c_long = 218;
+pub const SYS_madvise: ::c_long = 219;
+pub const SYS_getdents64: ::c_long = 220;
+pub const SYS_fcntl64: ::c_long = 221;
pub const SYS_gettid: ::c_long = 224;
+pub const SYS_readahead: ::c_long = 225;
+pub const SYS_setxattr: ::c_long = 226;
+pub const SYS_lsetxattr: ::c_long = 227;
+pub const SYS_fsetxattr: ::c_long = 228;
+pub const SYS_getxattr: ::c_long = 229;
+pub const SYS_lgetxattr: ::c_long = 230;
+pub const SYS_fgetxattr: ::c_long = 231;
+pub const SYS_listxattr: ::c_long = 232;
+pub const SYS_llistxattr: ::c_long = 233;
+pub const SYS_flistxattr: ::c_long = 234;
+pub const SYS_removexattr: ::c_long = 235;
+pub const SYS_lremovexattr: ::c_long = 236;
+pub const SYS_fremovexattr: ::c_long = 237;
+pub const SYS_tkill: ::c_long = 238;
+pub const SYS_sendfile64: ::c_long = 239;
+pub const SYS_futex: ::c_long = 240;
+pub const SYS_sched_setaffinity: ::c_long = 241;
+pub const SYS_sched_getaffinity: ::c_long = 242;
+pub const SYS_set_thread_area: ::c_long = 243;
+pub const SYS_get_thread_area: ::c_long = 244;
+pub const SYS_io_setup: ::c_long = 245;
+pub const SYS_io_destroy: ::c_long = 246;
+pub const SYS_io_getevents: ::c_long = 247;
+pub const SYS_io_submit: ::c_long = 248;
+pub const SYS_io_cancel: ::c_long = 249;
+pub const SYS_fadvise64: ::c_long = 250;
+pub const SYS_exit_group: ::c_long = 252;
+pub const SYS_lookup_dcookie: ::c_long = 253;
+pub const SYS_epoll_create: ::c_long = 254;
+pub const SYS_epoll_ctl: ::c_long = 255;
+pub const SYS_epoll_wait: ::c_long = 256;
+pub const SYS_remap_file_pages: ::c_long = 257;
+pub const SYS_set_tid_address: ::c_long = 258;
+pub const SYS_timer_create: ::c_long = 259;
+pub const SYS_timer_settime: ::c_long = 260;
+pub const SYS_timer_gettime: ::c_long = 261;
+pub const SYS_timer_getoverrun: ::c_long = 262;
+pub const SYS_timer_delete: ::c_long = 263;
+pub const SYS_clock_settime: ::c_long = 264;
+pub const SYS_clock_gettime: ::c_long = 265;
+pub const SYS_clock_getres: ::c_long = 266;
+pub const SYS_clock_nanosleep: ::c_long = 267;
+pub const SYS_statfs64: ::c_long = 268;
+pub const SYS_fstatfs64: ::c_long = 269;
+pub const SYS_tgkill: ::c_long = 270;
+pub const SYS_utimes: ::c_long = 271;
+pub const SYS_fadvise64_64: ::c_long = 272;
+pub const SYS_vserver: ::c_long = 273;
+pub const SYS_mbind: ::c_long = 274;
+pub const SYS_get_mempolicy: ::c_long = 275;
+pub const SYS_set_mempolicy: ::c_long = 276;
+pub const SYS_mq_open: ::c_long = 277;
+pub const SYS_mq_unlink: ::c_long = 278;
+pub const SYS_mq_timedsend: ::c_long = 279;
+pub const SYS_mq_timedreceive: ::c_long = 280;
+pub const SYS_mq_notify: ::c_long = 281;
+pub const SYS_mq_getsetattr: ::c_long = 282;
+pub const SYS_kexec_load: ::c_long = 283;
+pub const SYS_waitid: ::c_long = 284;
+pub const SYS_add_key: ::c_long = 286;
+pub const SYS_request_key: ::c_long = 287;
+pub const SYS_keyctl: ::c_long = 288;
+pub const SYS_ioprio_set: ::c_long = 289;
+pub const SYS_ioprio_get: ::c_long = 290;
+pub const SYS_inotify_init: ::c_long = 291;
+pub const SYS_inotify_add_watch: ::c_long = 292;
+pub const SYS_inotify_rm_watch: ::c_long = 293;
+pub const SYS_migrate_pages: ::c_long = 294;
+pub const SYS_openat: ::c_long = 295;
+pub const SYS_mkdirat: ::c_long = 296;
+pub const SYS_mknodat: ::c_long = 297;
+pub const SYS_fchownat: ::c_long = 298;
+pub const SYS_futimesat: ::c_long = 299;
+pub const SYS_fstatat64: ::c_long = 300;
+pub const SYS_unlinkat: ::c_long = 301;
+pub const SYS_renameat: ::c_long = 302;
+pub const SYS_linkat: ::c_long = 303;
+pub const SYS_symlinkat: ::c_long = 304;
+pub const SYS_readlinkat: ::c_long = 305;
+pub const SYS_fchmodat: ::c_long = 306;
+pub const SYS_faccessat: ::c_long = 307;
+pub const SYS_pselect6: ::c_long = 308;
+pub const SYS_ppoll: ::c_long = 309;
+pub const SYS_unshare: ::c_long = 310;
+pub const SYS_set_robust_list: ::c_long = 311;
+pub const SYS_get_robust_list: ::c_long = 312;
+pub const SYS_splice: ::c_long = 313;
+pub const SYS_sync_file_range: ::c_long = 314;
+pub const SYS_tee: ::c_long = 315;
+pub const SYS_vmsplice: ::c_long = 316;
+pub const SYS_move_pages: ::c_long = 317;
+pub const SYS_getcpu: ::c_long = 318;
+pub const SYS_epoll_pwait: ::c_long = 319;
+pub const SYS_utimensat: ::c_long = 320;
+pub const SYS_signalfd: ::c_long = 321;
+pub const SYS_timerfd_create: ::c_long = 322;
+pub const SYS_eventfd: ::c_long = 323;
+pub const SYS_fallocate: ::c_long = 324;
+pub const SYS_timerfd_settime: ::c_long = 325;
+pub const SYS_timerfd_gettime: ::c_long = 326;
+pub const SYS_signalfd4: ::c_long = 327;
+pub const SYS_eventfd2: ::c_long = 328;
+pub const SYS_epoll_create1: ::c_long = 329;
+pub const SYS_dup3: ::c_long = 330;
+pub const SYS_pipe2: ::c_long = 331;
+pub const SYS_inotify_init1: ::c_long = 332;
+pub const SYS_preadv: ::c_long = 333;
+pub const SYS_pwritev: ::c_long = 334;
+pub const SYS_rt_tgsigqueueinfo: ::c_long = 335;
pub const SYS_perf_event_open: ::c_long = 336;
+pub const SYS_recvmmsg: ::c_long = 337;
+pub const SYS_fanotify_init: ::c_long = 338;
+pub const SYS_fanotify_mark: ::c_long = 339;
+pub const SYS_prlimit64: ::c_long = 340;
+pub const SYS_name_to_handle_at: ::c_long = 341;
+pub const SYS_open_by_handle_at: ::c_long = 342;
+pub const SYS_clock_adjtime: ::c_long = 343;
+pub const SYS_syncfs: ::c_long = 344;
+pub const SYS_sendmmsg: ::c_long = 345;
+pub const SYS_setns: ::c_long = 346;
+pub const SYS_process_vm_readv: ::c_long = 347;
+pub const SYS_process_vm_writev: ::c_long = 348;
+pub const SYS_kcmp: ::c_long = 349;
+pub const SYS_finit_module: ::c_long = 350;
+pub const SYS_sched_setattr: ::c_long = 351;
+pub const SYS_sched_getattr: ::c_long = 352;
+pub const SYS_renameat2: ::c_long = 353;
+pub const SYS_seccomp: ::c_long = 354;
+pub const SYS_getrandom: ::c_long = 355;
+pub const SYS_memfd_create: ::c_long = 356;
+pub const SYS_bpf: ::c_long = 357;
+pub const SYS_execveat: ::c_long = 358;
+pub const SYS_socket: ::c_long = 359;
+pub const SYS_socketpair: ::c_long = 360;
+pub const SYS_bind: ::c_long = 361;
+pub const SYS_connect: ::c_long = 362;
+pub const SYS_listen: ::c_long = 363;
+pub const SYS_accept4: ::c_long = 364;
+pub const SYS_getsockopt: ::c_long = 365;
+pub const SYS_setsockopt: ::c_long = 366;
+pub const SYS_getsockname: ::c_long = 367;
+pub const SYS_getpeername: ::c_long = 368;
+pub const SYS_sendto: ::c_long = 369;
+pub const SYS_sendmsg: ::c_long = 370;
+pub const SYS_recvfrom: ::c_long = 371;
+pub const SYS_recvmsg: ::c_long = 372;
+pub const SYS_shutdown: ::c_long = 373;
+pub const SYS_userfaultfd: ::c_long = 374;
+pub const SYS_membarrier: ::c_long = 375;
+pub const SYS_mlock2: ::c_long = 376;
+pub const SYS_copy_file_range: ::c_long = 377;
+pub const SYS_preadv2: ::c_long = 378;
+pub const SYS_pwritev2: ::c_long = 379;
+// FIXME syscalls 380-382 have been added in musl 1.16
+// See discussion https://github.com/rust-lang/libc/pull/699
-pub const POLLWRNORM: ::c_short = 0x100;
-pub const POLLWRBAND: ::c_short = 0x200;
+// offsets in user_regs_structs, from sys/reg.h
+pub const EBX: ::c_int = 0;
+pub const ECX: ::c_int = 1;
+pub const EDX: ::c_int = 2;
+pub const ESI: ::c_int = 3;
+pub const EDI: ::c_int = 4;
+pub const EBP: ::c_int = 5;
+pub const EAX: ::c_int = 6;
+pub const DS: ::c_int = 7;
+pub const ES: ::c_int = 8;
+pub const FS: ::c_int = 9;
+pub const GS: ::c_int = 10;
+pub const ORIG_EAX: ::c_int = 11;
+pub const EIP: ::c_int = 12;
+pub const CS: ::c_int = 13;
+pub const EFL: ::c_int = 14;
+pub const UESP: ::c_int = 15;
+pub const SS: ::c_int = 16;
diff --git a/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs b/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs
index 23f7dd3..fa103aa 100644
--- a/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs
+++ b/libc/src/unix/notbsd/linux/musl/b64/aarch64.rs
@@ -1,3 +1,7 @@
pub type c_char = u8;
+pub type __u64 = ::c_ulonglong;
+pub const SYS_pivot_root: ::c_long = 41;
+pub const SYS_gettid: ::c_long = 178;
pub const SYS_perf_event_open: ::c_long = 241;
+pub const SYS_memfd_create: ::c_long = 279;
diff --git a/libc/src/unix/notbsd/linux/musl/b64/mod.rs b/libc/src/unix/notbsd/linux/musl/b64/mod.rs
index fab0b58..cdce288 100644
--- a/libc/src/unix/notbsd/linux/musl/b64/mod.rs
+++ b/libc/src/unix/notbsd/linux/musl/b64/mod.rs
@@ -46,6 +46,36 @@ s! {
__reserved: [::c_long; 3],
}
+ pub struct statfs64 {
+ pub f_type: ::c_ulong,
+ pub f_bsize: ::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_fsid: ::fsid_t,
+ pub f_namelen: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_flags: ::c_ulong,
+ pub f_spare: [::c_ulong; 4],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: u64,
+ pub f_fsid: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ __f_spare: [::c_int; 6],
+ }
+
pub struct stack_t {
pub ss_sp: *mut ::c_void,
pub ss_flags: ::c_int,
@@ -141,6 +171,7 @@ pub const O_DIRECT: ::c_int = 0x4000;
pub const O_DIRECTORY: ::c_int = 0x10000;
pub const O_NOFOLLOW: ::c_int = 0x20000;
pub const O_ASYNC: ::c_int = 0x2000;
+pub const O_LARGEFILE: ::c_int = 0;
pub const FIOCLEX: ::c_int = 0x5451;
pub const FIONBIO: ::c_int = 0x5421;
@@ -371,6 +402,18 @@ pub const TIOCCONS: ::c_int = 0x541D;
pub const POLLWRNORM: ::c_short = 0x100;
pub const POLLWRBAND: ::c_short = 0x200;
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x008;
+pub const TIOCM_SR: ::c_int = 0x010;
+pub const TIOCM_CTS: ::c_int = 0x020;
+pub const TIOCM_CAR: ::c_int = 0x040;
+pub const TIOCM_RNG: ::c_int = 0x080;
+pub const TIOCM_DSR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+
cfg_if! {
if #[cfg(target_arch = "aarch64")] {
mod aarch64;
diff --git a/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs b/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs
index 4b8ca10..4e8b9ad 100644
--- a/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs
+++ b/libc/src/unix/notbsd/linux/musl/b64/powerpc64.rs
@@ -1,3 +1,7 @@
pub type c_char = u8;
+pub type __u64 = ::c_ulong;
+pub const SYS_pivot_root: ::c_long = 203;
+pub const SYS_gettid: ::c_long = 207;
pub const SYS_perf_event_open: ::c_long = 319;
+pub const SYS_memfd_create: ::c_long = 360;
diff --git a/libc/src/unix/notbsd/linux/musl/b64/x86_64.rs b/libc/src/unix/notbsd/linux/musl/b64/x86_64.rs
index 2cfd903..f81efdc 100644
--- a/libc/src/unix/notbsd/linux/musl/b64/x86_64.rs
+++ b/libc/src/unix/notbsd/linux/musl/b64/x86_64.rs
@@ -1,4 +1,5 @@
pub type c_char = i8;
+pub type __u64 = ::c_ulonglong;
s! {
pub struct mcontext_t {
@@ -15,6 +16,365 @@ s! {
}
}
-pub const SYS_gettid: ::c_long = 186;
+// Syscall table
+pub const SYS_read: ::c_long = 0;
+pub const SYS_write: ::c_long = 1;
+pub const SYS_open: ::c_long = 2;
+pub const SYS_close: ::c_long = 3;
+pub const SYS_stat: ::c_long = 4;
+pub const SYS_fstat: ::c_long = 5;
+pub const SYS_lstat: ::c_long = 6;
+pub const SYS_poll: ::c_long = 7;
+pub const SYS_lseek: ::c_long = 8;
+pub const SYS_mmap: ::c_long = 9;
+pub const SYS_mprotect: ::c_long = 10;
+pub const SYS_munmap: ::c_long = 11;
+pub const SYS_brk: ::c_long = 12;
+pub const SYS_rt_sigaction: ::c_long = 13;
+pub const SYS_rt_sigprocmask: ::c_long = 14;
+pub const SYS_rt_sigreturn: ::c_long = 15;
+pub const SYS_ioctl: ::c_long = 16;
+pub const SYS_pread64: ::c_long = 17;
+pub const SYS_pwrite64: ::c_long = 18;
+pub const SYS_readv: ::c_long = 19;
+pub const SYS_writev: ::c_long = 20;
+pub const SYS_access: ::c_long = 21;
+pub const SYS_pipe: ::c_long = 22;
+pub const SYS_select: ::c_long = 23;
+pub const SYS_sched_yield: ::c_long = 24;
+pub const SYS_mremap: ::c_long = 25;
+pub const SYS_msync: ::c_long = 26;
+pub const SYS_mincore: ::c_long = 27;
+pub const SYS_madvise: ::c_long = 28;
+pub const SYS_shmget: ::c_long = 29;
+pub const SYS_shmat: ::c_long = 30;
+pub const SYS_shmctl: ::c_long = 31;
+pub const SYS_dup: ::c_long = 32;
+pub const SYS_dup2: ::c_long = 33;
+pub const SYS_pause: ::c_long = 34;
+pub const SYS_nanosleep: ::c_long = 35;
+pub const SYS_getitimer: ::c_long = 36;
+pub const SYS_alarm: ::c_long = 37;
+pub const SYS_setitimer: ::c_long = 38;
+pub const SYS_getpid: ::c_long = 39;
+pub const SYS_sendfile: ::c_long = 40;
+pub const SYS_socket: ::c_long = 41;
+pub const SYS_connect: ::c_long = 42;
+pub const SYS_accept: ::c_long = 43;
+pub const SYS_sendto: ::c_long = 44;
+pub const SYS_recvfrom: ::c_long = 45;
+pub const SYS_sendmsg: ::c_long = 46;
+pub const SYS_recvmsg: ::c_long = 47;
+pub const SYS_shutdown: ::c_long = 48;
+pub const SYS_bind: ::c_long = 49;
+pub const SYS_listen: ::c_long = 50;
+pub const SYS_getsockname: ::c_long = 51;
+pub const SYS_getpeername: ::c_long = 52;
+pub const SYS_socketpair: ::c_long = 53;
+pub const SYS_setsockopt: ::c_long = 54;
+pub const SYS_getsockopt: ::c_long = 55;
+pub const SYS_clone: ::c_long = 56;
+pub const SYS_fork: ::c_long = 57;
+pub const SYS_vfork: ::c_long = 58;
+pub const SYS_execve: ::c_long = 59;
+pub const SYS_exit: ::c_long = 60;
+pub const SYS_wait4: ::c_long = 61;
+pub const SYS_kill: ::c_long = 62;
+pub const SYS_uname: ::c_long = 63;
+pub const SYS_semget: ::c_long = 64;
+pub const SYS_semop: ::c_long = 65;
+pub const SYS_semctl: ::c_long = 66;
+pub const SYS_shmdt: ::c_long = 67;
+pub const SYS_msgget: ::c_long = 68;
+pub const SYS_msgsnd: ::c_long = 69;
+pub const SYS_msgrcv: ::c_long = 70;
+pub const SYS_msgctl: ::c_long = 71;
+pub const SYS_fcntl: ::c_long = 72;
+pub const SYS_flock: ::c_long = 73;
+pub const SYS_fsync: ::c_long = 74;
+pub const SYS_fdatasync: ::c_long = 75;
+pub const SYS_truncate: ::c_long = 76;
+pub const SYS_ftruncate: ::c_long = 77;
+pub const SYS_getdents: ::c_long = 78;
+pub const SYS_getcwd: ::c_long = 79;
+pub const SYS_chdir: ::c_long = 80;
+pub const SYS_fchdir: ::c_long = 81;
+pub const SYS_rename: ::c_long = 82;
+pub const SYS_mkdir: ::c_long = 83;
+pub const SYS_rmdir: ::c_long = 84;
+pub const SYS_creat: ::c_long = 85;
+pub const SYS_link: ::c_long = 86;
+pub const SYS_unlink: ::c_long = 87;
+pub const SYS_symlink: ::c_long = 88;
+pub const SYS_readlink: ::c_long = 89;
+pub const SYS_chmod: ::c_long = 90;
+pub const SYS_fchmod: ::c_long = 91;
+pub const SYS_chown: ::c_long = 92;
+pub const SYS_fchown: ::c_long = 93;
+pub const SYS_lchown: ::c_long = 94;
+pub const SYS_umask: ::c_long = 95;
+pub const SYS_gettimeofday: ::c_long = 96;
+pub const SYS_getrlimit: ::c_long = 97;
+pub const SYS_getrusage: ::c_long = 98;
+pub const SYS_sysinfo: ::c_long = 99;
+pub const SYS_times: ::c_long = 100;
+pub const SYS_ptrace: ::c_long = 101;
+pub const SYS_getuid: ::c_long = 102;
+pub const SYS_syslog: ::c_long = 103;
+pub const SYS_getgid: ::c_long = 104;
+pub const SYS_setuid: ::c_long = 105;
+pub const SYS_setgid: ::c_long = 106;
+pub const SYS_geteuid: ::c_long = 107;
+pub const SYS_getegid: ::c_long = 108;
+pub const SYS_setpgid: ::c_long = 109;
+pub const SYS_getppid: ::c_long = 110;
+pub const SYS_getpgrp: ::c_long = 111;
+pub const SYS_setsid: ::c_long = 112;
+pub const SYS_setreuid: ::c_long = 113;
+pub const SYS_setregid: ::c_long = 114;
+pub const SYS_getgroups: ::c_long = 115;
+pub const SYS_setgroups: ::c_long = 116;
+pub const SYS_setresuid: ::c_long = 117;
+pub const SYS_getresuid: ::c_long = 118;
+pub const SYS_setresgid: ::c_long = 119;
+pub const SYS_getresgid: ::c_long = 120;
+pub const SYS_getpgid: ::c_long = 121;
+pub const SYS_setfsuid: ::c_long = 122;
+pub const SYS_setfsgid: ::c_long = 123;
+pub const SYS_getsid: ::c_long = 124;
+pub const SYS_capget: ::c_long = 125;
+pub const SYS_capset: ::c_long = 126;
+pub const SYS_rt_sigpending: ::c_long = 127;
+pub const SYS_rt_sigtimedwait: ::c_long = 128;
+pub const SYS_rt_sigqueueinfo: ::c_long = 129;
+pub const SYS_rt_sigsuspend: ::c_long = 130;
+pub const SYS_sigaltstack: ::c_long = 131;
+pub const SYS_utime: ::c_long = 132;
+pub const SYS_mknod: ::c_long = 133;
+pub const SYS_uselib: ::c_long = 134;
+pub const SYS_personality: ::c_long = 135;
+pub const SYS_ustat: ::c_long = 136;
+pub const SYS_statfs: ::c_long = 137;
+pub const SYS_fstatfs: ::c_long = 138;
+pub const SYS_sysfs: ::c_long = 139;
+pub const SYS_getpriority: ::c_long = 140;
+pub const SYS_setpriority: ::c_long = 141;
+pub const SYS_sched_setparam: ::c_long = 142;
+pub const SYS_sched_getparam: ::c_long = 143;
+pub const SYS_sched_setscheduler: ::c_long = 144;
+pub const SYS_sched_getscheduler: ::c_long = 145;
+pub const SYS_sched_get_priority_max: ::c_long = 146;
+pub const SYS_sched_get_priority_min: ::c_long = 147;
+pub const SYS_sched_rr_get_interval: ::c_long = 148;
+pub const SYS_mlock: ::c_long = 149;
+pub const SYS_munlock: ::c_long = 150;
+pub const SYS_mlockall: ::c_long = 151;
+pub const SYS_munlockall: ::c_long = 152;
+pub const SYS_vhangup: ::c_long = 153;
+pub const SYS_modify_ldt: ::c_long = 154;
+pub const SYS_pivot_root: ::c_long = 155;
+pub const SYS__sysctl: ::c_long = 156;
+pub const SYS_prctl: ::c_long = 157;
+pub const SYS_arch_prctl: ::c_long = 158;
+pub const SYS_adjtimex: ::c_long = 159;
+pub const SYS_setrlimit: ::c_long = 160;
+pub const SYS_chroot: ::c_long = 161;
+pub const SYS_sync: ::c_long = 162;
+pub const SYS_acct: ::c_long = 163;
+pub const SYS_settimeofday: ::c_long = 164;
+pub const SYS_mount: ::c_long = 165;
+pub const SYS_umount2: ::c_long = 166;
+pub const SYS_swapon: ::c_long = 167;
+pub const SYS_swapoff: ::c_long = 168;
+pub const SYS_reboot: ::c_long = 169;
+pub const SYS_sethostname: ::c_long = 170;
+pub const SYS_setdomainname: ::c_long = 171;
+pub const SYS_iopl: ::c_long = 172;
+pub const SYS_ioperm: ::c_long = 173;
+pub const SYS_create_module: ::c_long = 174;
+pub const SYS_init_module: ::c_long = 175;
+pub const SYS_delete_module: ::c_long = 176;
+pub const SYS_get_kernel_syms: ::c_long = 177;
+pub const SYS_query_module: ::c_long = 178;
+pub const SYS_quotactl: ::c_long = 179;
+pub const SYS_nfsservctl: ::c_long = 180;
+pub const SYS_getpmsg: ::c_long = 181;
+pub const SYS_putpmsg: ::c_long = 182;
+pub const SYS_afs_syscall: ::c_long = 183;
+pub const SYS_tuxcall: ::c_long = 184;
+pub const SYS_security: ::c_long = 185;
+pub const SYS_gettid: ::c_long = 186;
+pub const SYS_readahead: ::c_long = 187;
+pub const SYS_setxattr: ::c_long = 188;
+pub const SYS_lsetxattr: ::c_long = 189;
+pub const SYS_fsetxattr: ::c_long = 190;
+pub const SYS_getxattr: ::c_long = 191;
+pub const SYS_lgetxattr: ::c_long = 192;
+pub const SYS_fgetxattr: ::c_long = 193;
+pub const SYS_listxattr: ::c_long = 194;
+pub const SYS_llistxattr: ::c_long = 195;
+pub const SYS_flistxattr: ::c_long = 196;
+pub const SYS_removexattr: ::c_long = 197;
+pub const SYS_lremovexattr: ::c_long = 198;
+pub const SYS_fremovexattr: ::c_long = 199;
+pub const SYS_tkill: ::c_long = 200;
+pub const SYS_time: ::c_long = 201;
+pub const SYS_futex: ::c_long = 202;
+pub const SYS_sched_setaffinity: ::c_long = 203;
+pub const SYS_sched_getaffinity: ::c_long = 204;
+pub const SYS_set_thread_area: ::c_long = 205;
+pub const SYS_io_setup: ::c_long = 206;
+pub const SYS_io_destroy: ::c_long = 207;
+pub const SYS_io_getevents: ::c_long = 208;
+pub const SYS_io_submit: ::c_long = 209;
+pub const SYS_io_cancel: ::c_long = 210;
+pub const SYS_get_thread_area: ::c_long = 211;
+pub const SYS_lookup_dcookie: ::c_long = 212;
+pub const SYS_epoll_create: ::c_long = 213;
+pub const SYS_epoll_ctl_old: ::c_long = 214;
+pub const SYS_epoll_wait_old: ::c_long = 215;
+pub const SYS_remap_file_pages: ::c_long = 216;
+pub const SYS_getdents64: ::c_long = 217;
+pub const SYS_set_tid_address: ::c_long = 218;
+pub const SYS_restart_syscall: ::c_long = 219;
+pub const SYS_semtimedop: ::c_long = 220;
+pub const SYS_fadvise64: ::c_long = 221;
+pub const SYS_timer_create: ::c_long = 222;
+pub const SYS_timer_settime: ::c_long = 223;
+pub const SYS_timer_gettime: ::c_long = 224;
+pub const SYS_timer_getoverrun: ::c_long = 225;
+pub const SYS_timer_delete: ::c_long = 226;
+pub const SYS_clock_settime: ::c_long = 227;
+pub const SYS_clock_gettime: ::c_long = 228;
+pub const SYS_clock_getres: ::c_long = 229;
+pub const SYS_clock_nanosleep: ::c_long = 230;
+pub const SYS_exit_group: ::c_long = 231;
+pub const SYS_epoll_wait: ::c_long = 232;
+pub const SYS_epoll_ctl: ::c_long = 233;
+pub const SYS_tgkill: ::c_long = 234;
+pub const SYS_utimes: ::c_long = 235;
+pub const SYS_vserver: ::c_long = 236;
+pub const SYS_mbind: ::c_long = 237;
+pub const SYS_set_mempolicy: ::c_long = 238;
+pub const SYS_get_mempolicy: ::c_long = 239;
+pub const SYS_mq_open: ::c_long = 240;
+pub const SYS_mq_unlink: ::c_long = 241;
+pub const SYS_mq_timedsend: ::c_long = 242;
+pub const SYS_mq_timedreceive: ::c_long = 243;
+pub const SYS_mq_notify: ::c_long = 244;
+pub const SYS_mq_getsetattr: ::c_long = 245;
+pub const SYS_kexec_load: ::c_long = 246;
+pub const SYS_waitid: ::c_long = 247;
+pub const SYS_add_key: ::c_long = 248;
+pub const SYS_request_key: ::c_long = 249;
+pub const SYS_keyctl: ::c_long = 250;
+pub const SYS_ioprio_set: ::c_long = 251;
+pub const SYS_ioprio_get: ::c_long = 252;
+pub const SYS_inotify_init: ::c_long = 253;
+pub const SYS_inotify_add_watch: ::c_long = 254;
+pub const SYS_inotify_rm_watch: ::c_long = 255;
+pub const SYS_migrate_pages: ::c_long = 256;
+pub const SYS_openat: ::c_long = 257;
+pub const SYS_mkdirat: ::c_long = 258;
+pub const SYS_mknodat: ::c_long = 259;
+pub const SYS_fchownat: ::c_long = 260;
+pub const SYS_futimesat: ::c_long = 261;
+pub const SYS_newfstatat: ::c_long = 262;
+pub const SYS_unlinkat: ::c_long = 263;
+pub const SYS_renameat: ::c_long = 264;
+pub const SYS_linkat: ::c_long = 265;
+pub const SYS_symlinkat: ::c_long = 266;
+pub const SYS_readlinkat: ::c_long = 267;
+pub const SYS_fchmodat: ::c_long = 268;
+pub const SYS_faccessat: ::c_long = 269;
+pub const SYS_pselect6: ::c_long = 270;
+pub const SYS_ppoll: ::c_long = 271;
+pub const SYS_unshare: ::c_long = 272;
+pub const SYS_set_robust_list: ::c_long = 273;
+pub const SYS_get_robust_list: ::c_long = 274;
+pub const SYS_splice: ::c_long = 275;
+pub const SYS_tee: ::c_long = 276;
+pub const SYS_sync_file_range: ::c_long = 277;
+pub const SYS_vmsplice: ::c_long = 278;
+pub const SYS_move_pages: ::c_long = 279;
+pub const SYS_utimensat: ::c_long = 280;
+pub const SYS_epoll_pwait: ::c_long = 281;
+pub const SYS_signalfd: ::c_long = 282;
+pub const SYS_timerfd_create: ::c_long = 283;
+pub const SYS_eventfd: ::c_long = 284;
+pub const SYS_fallocate: ::c_long = 285;
+pub const SYS_timerfd_settime: ::c_long = 286;
+pub const SYS_timerfd_gettime: ::c_long = 287;
+pub const SYS_accept4: ::c_long = 288;
+pub const SYS_signalfd4: ::c_long = 289;
+pub const SYS_eventfd2: ::c_long = 290;
+pub const SYS_epoll_create1: ::c_long = 291;
+pub const SYS_dup3: ::c_long = 292;
+pub const SYS_pipe2: ::c_long = 293;
+pub const SYS_inotify_init1: ::c_long = 294;
+pub const SYS_preadv: ::c_long = 295;
+pub const SYS_pwritev: ::c_long = 296;
+pub const SYS_rt_tgsigqueueinfo: ::c_long = 297;
pub const SYS_perf_event_open: ::c_long = 298;
+pub const SYS_recvmmsg: ::c_long = 299;
+pub const SYS_fanotify_init: ::c_long = 300;
+pub const SYS_fanotify_mark: ::c_long = 301;
+pub const SYS_prlimit64: ::c_long = 302;
+pub const SYS_name_to_handle_at: ::c_long = 303;
+pub const SYS_open_by_handle_at: ::c_long = 304;
+pub const SYS_clock_adjtime: ::c_long = 305;
+pub const SYS_syncfs: ::c_long = 306;
+pub const SYS_sendmmsg: ::c_long = 307;
+pub const SYS_setns: ::c_long = 308;
+pub const SYS_getcpu: ::c_long = 309;
+pub const SYS_process_vm_readv: ::c_long = 310;
+pub const SYS_process_vm_writev: ::c_long = 311;
+pub const SYS_kcmp: ::c_long = 312;
+pub const SYS_finit_module: ::c_long = 313;
+pub const SYS_sched_setattr: ::c_long = 314;
+pub const SYS_sched_getattr: ::c_long = 315;
+pub const SYS_renameat2: ::c_long = 316;
+pub const SYS_seccomp: ::c_long = 317;
+pub const SYS_getrandom: ::c_long = 318;
+pub const SYS_memfd_create: ::c_long = 319;
+pub const SYS_kexec_file_load: ::c_long = 320;
+pub const SYS_bpf: ::c_long = 321;
+pub const SYS_execveat: ::c_long = 322;
+pub const SYS_userfaultfd: ::c_long = 323;
+pub const SYS_membarrier: ::c_long = 324;
+pub const SYS_mlock2: ::c_long = 325;
+pub const SYS_copy_file_range: ::c_long = 326;
+pub const SYS_preadv2: ::c_long = 327;
+pub const SYS_pwritev2: ::c_long = 328;
+// FIXME syscalls 329-331 have been added in musl 1.16
+// See discussion https://github.com/rust-lang/libc/pull/699
+
+// offsets in user_regs_structs, from sys/reg.h
+pub const R15: ::c_int = 0;
+pub const R14: ::c_int = 1;
+pub const R13: ::c_int = 2;
+pub const R12: ::c_int = 3;
+pub const RBP: ::c_int = 4;
+pub const RBX: ::c_int = 5;
+pub const R11: ::c_int = 6;
+pub const R10: ::c_int = 7;
+pub const R9: ::c_int = 8;
+pub const R8: ::c_int = 9;
+pub const RAX: ::c_int = 10;
+pub const RCX: ::c_int = 11;
+pub const RDX: ::c_int = 12;
+pub const RSI: ::c_int = 13;
+pub const RDI: ::c_int = 14;
+pub const ORIG_RAX: ::c_int = 15;
+pub const RIP: ::c_int = 16;
+pub const CS: ::c_int = 17;
+pub const EFLAGS: ::c_int = 18;
+pub const RSP: ::c_int = 19;
+pub const SS: ::c_int = 20;
+pub const FS_BASE: ::c_int = 21;
+pub const GS_BASE: ::c_int = 22;
+pub const DS: ::c_int = 23;
+pub const ES: ::c_int = 24;
+pub const FS: ::c_int = 25;
+pub const GS: ::c_int = 26;
diff --git a/libc/src/unix/notbsd/linux/musl/mod.rs b/libc/src/unix/notbsd/linux/musl/mod.rs
index b365028..640e8ab 100644
--- a/libc/src/unix/notbsd/linux/musl/mod.rs
+++ b/libc/src/unix/notbsd/linux/musl/mod.rs
@@ -87,14 +87,12 @@ s! {
}
}
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
-
pub const SFD_CLOEXEC: ::c_int = 0x080000;
pub const NCCS: usize = 32;
pub const O_TRUNC: ::c_int = 512;
-
+pub const O_NOATIME: ::c_int = 0o1000000;
pub const O_CLOEXEC: ::c_int = 0x80000;
pub const EBFONT: ::c_int = 59;
@@ -155,11 +153,9 @@ pub const TCP_TIMESTAMP: ::c_int = 24;
pub const SIGUNUSED: ::c_int = ::SIGSYS;
-pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
-pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
-
pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
pub const CPU_SETSIZE: ::c_int = 128;
@@ -175,8 +171,14 @@ pub const PTRACE_POKEUSER: ::c_int = 6;
pub const PTRACE_CONT: ::c_int = 7;
pub const PTRACE_KILL: ::c_int = 8;
pub const PTRACE_SINGLESTEP: ::c_int = 9;
+pub const PTRACE_GETREGS: ::c_int = 12;
+pub const PTRACE_SETREGS: ::c_int = 13;
+pub const PTRACE_GETFPREGS: ::c_int = 14;
+pub const PTRACE_SETFPREGS: ::c_int = 15;
pub const PTRACE_ATTACH: ::c_int = 16;
pub const PTRACE_DETACH: ::c_int = 17;
+pub const PTRACE_GETFPXREGS: ::c_int = 18;
+pub const PTRACE_SETFPXREGS: ::c_int = 19;
pub const PTRACE_SYSCALL: ::c_int = 24;
pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
@@ -189,34 +191,8 @@ pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
pub const PTRACE_LISTEN: ::c_int = 0x4208;
pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
-pub const PTRACE_O_EXITKILL: ::c_int = 1048576;
-pub const PTRACE_O_TRACECLONE: ::c_int = 8;
-pub const PTRACE_O_TRACEEXEC: ::c_int = 16;
-pub const PTRACE_O_TRACEEXIT: ::c_int = 64;
-pub const PTRACE_O_TRACEFORK: ::c_int = 2;
-pub const PTRACE_O_TRACESYSGOOD: ::c_int = 1;
-pub const PTRACE_O_TRACEVFORK: ::c_int = 4;
-pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 32;
-pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 2097152;
-
-pub const MADV_DODUMP: ::c_int = 17;
-pub const MADV_DONTDUMP: ::c_int = 16;
-
pub const EPOLLWAKEUP: ::c_int = 0x20000000;
-pub const POLLRDNORM: ::c_short = 0x040;
-pub const POLLRDBAND: ::c_short = 0x080;
-
-pub const MADV_HUGEPAGE: ::c_int = 14;
-pub const MADV_NOHUGEPAGE: ::c_int = 15;
-
-pub const PTRACE_GETFPREGS: ::c_uint = 14;
-pub const PTRACE_SETFPREGS: ::c_uint = 15;
-pub const PTRACE_GETFPXREGS: ::c_uint = 18;
-pub const PTRACE_SETFPXREGS: ::c_uint = 19;
-pub const PTRACE_GETREGS: ::c_uint = 12;
-pub const PTRACE_SETREGS: ::c_uint = 13;
-
pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
pub const SFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
@@ -280,6 +256,17 @@ pub const ISIG: ::tcflag_t = 0x00000001;
pub const ICANON: ::tcflag_t = 0x00000002;
pub const PENDIN: ::tcflag_t = 0x00004000;
pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const VSWTC: usize = 7;
+pub const OLCUC: ::tcflag_t = 0o000002;
+pub const NLDLY: ::tcflag_t = 0o000400;
+pub const CRDLY: ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY: ::tcflag_t = 0o020000;
+pub const FFDLY: ::tcflag_t = 0o100000;
+pub const VTDLY: ::tcflag_t = 0o040000;
+pub const XTABS: ::tcflag_t = 0o014000;
pub const B0: ::speed_t = 0o000000;
pub const B50: ::speed_t = 0o000001;
@@ -315,6 +302,13 @@ pub const B3000000: ::speed_t = 0o010015;
pub const B3500000: ::speed_t = 0o010016;
pub const B4000000: ::speed_t = 0o010017;
+pub const SO_BINDTODEVICE: ::c_int = 25;
+pub const SO_TIMESTAMP: ::c_int = 29;
+pub const SO_MARK: ::c_int = 36;
+pub const SO_RXQ_OVFL: ::c_int = 40;
+pub const SO_PEEK_OFF: ::c_int = 42;
+pub const SO_BUSY_POLL: ::c_int = 46;
+
extern {
pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
pub fn ptrace(request: ::c_int, ...) -> ::c_long;
@@ -328,9 +322,7 @@ cfg_if! {
pub use self::b64::*;
} else if #[cfg(any(target_arch = "x86",
target_arch = "mips",
- target_arch = "arm",
- target_arch = "asmjs",
- target_arch = "wasm32"))] {
+ target_arch = "arm"))] {
mod b32;
pub use self::b32::*;
} else { }
diff --git a/libc/src/unix/notbsd/linux/other/b32/arm.rs b/libc/src/unix/notbsd/linux/other/b32/arm.rs
index ee6d674..4de1f32 100644
--- a/libc/src/unix/notbsd/linux/other/b32/arm.rs
+++ b/libc/src/unix/notbsd/linux/other/b32/arm.rs
@@ -38,6 +38,37 @@ s! {
pub st_ino: ::ino64_t,
}
+ pub struct statfs64 {
+ pub f_type: ::__fsword_t,
+ pub f_bsize: ::__fsword_t,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_fsid: ::fsid_t,
+ pub f_namelen: ::__fsword_t,
+ pub f_frsize: ::__fsword_t,
+ pub f_flags: ::__fsword_t,
+ pub f_spare: [::__fsword_t; 4],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: u64,
+ pub f_fsid: ::c_ulong,
+ __f_unused: ::c_int,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ __f_spare: [::c_int; 6],
+ }
+
pub struct shmid_ds {
pub shm_perm: ::ipc_perm,
pub shm_segsz: ::size_t,
@@ -75,23 +106,29 @@ s! {
pub const O_DIRECT: ::c_int = 0x10000;
pub const O_DIRECTORY: ::c_int = 0x4000;
pub const O_NOFOLLOW: ::c_int = 0x8000;
+pub const O_LARGEFILE: ::c_int = 0o400000;
pub const MAP_LOCKED: ::c_int = 0x02000;
pub const MAP_NORESERVE: ::c_int = 0x04000;
pub const EDEADLOCK: ::c_int = 35;
+pub const SO_PASSCRED: ::c_int = 16;
pub const SO_PEERCRED: ::c_int = 17;
pub const SO_RCVLOWAT: ::c_int = 18;
pub const SO_SNDLOWAT: ::c_int = 19;
pub const SO_RCVTIMEO: ::c_int = 20;
pub const SO_SNDTIMEO: ::c_int = 21;
+pub const SO_SNDBUFFORCE: ::c_int = 32;
+pub const SO_RCVBUFFORCE: ::c_int = 33;
pub const FIOCLEX: ::c_ulong = 0x5451;
pub const FIONBIO: ::c_ulong = 0x5421;
+pub const SYS_pivot_root: ::c_long = 218;
pub const SYS_gettid: ::c_long = 224;
pub const SYS_perf_event_open: ::c_long = 364;
+pub const SYS_memfd_create: ::c_long = 385;
pub const PTRACE_GETFPXREGS: ::c_uint = 18;
pub const PTRACE_SETFPXREGS: ::c_uint = 19;
@@ -141,6 +178,17 @@ pub const ISIG: ::tcflag_t = 0x00000001;
pub const ICANON: ::tcflag_t = 0x00000002;
pub const PENDIN: ::tcflag_t = 0x00004000;
pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const VSWTC: usize = 7;
+pub const OLCUC: ::tcflag_t = 0o000002;
+pub const NLDLY: ::tcflag_t = 0o000400;
+pub const CRDLY: ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY: ::tcflag_t = 0o020000;
+pub const FFDLY: ::tcflag_t = 0o100000;
+pub const VTDLY: ::tcflag_t = 0o040000;
+pub const XTABS: ::tcflag_t = 0o014000;
pub const B0: ::speed_t = 0o000000;
pub const B50: ::speed_t = 0o000001;
diff --git a/libc/src/unix/notbsd/linux/other/b32/mod.rs b/libc/src/unix/notbsd/linux/other/b32/mod.rs
index 0f936c7..247f01b 100644
--- a/libc/src/unix/notbsd/linux/other/b32/mod.rs
+++ b/libc/src/unix/notbsd/linux/other/b32/mod.rs
@@ -12,6 +12,7 @@ pub type __fsword_t = i32;
pub type blksize_t = i32;
pub type nlink_t = u32;
+pub type __u64 = ::c_ulonglong;
s! {
pub struct stat {
@@ -78,6 +79,8 @@ pub const O_SYNC: ::c_int = 1052672;
pub const O_RSYNC: ::c_int = 1052672;
pub const O_DSYNC: ::c_int = 4096;
pub const O_FSYNC: ::c_int = 0x101000;
+pub const O_NOATIME: ::c_int = 0o1000000;
+pub const O_PATH: ::c_int = 0o10000000;
pub const MAP_GROWSDOWN: ::c_int = 0x0100;
@@ -171,9 +174,19 @@ pub const SO_SNDBUF: ::c_int = 7;
pub const SO_RCVBUF: ::c_int = 8;
pub const SO_KEEPALIVE: ::c_int = 9;
pub const SO_OOBINLINE: ::c_int = 10;
+pub const SO_PRIORITY: ::c_int = 12;
pub const SO_LINGER: ::c_int = 13;
+pub const SO_BSDCOMPAT: ::c_int = 14;
pub const SO_REUSEPORT: ::c_int = 15;
+pub const SO_BINDTODEVICE: ::c_int = 25;
+pub const SO_TIMESTAMP: ::c_int = 29;
pub const SO_ACCEPTCONN: ::c_int = 30;
+pub const SO_MARK: ::c_int = 36;
+pub const SO_PROTOCOL: ::c_int = 38;
+pub const SO_DOMAIN: ::c_int = 39;
+pub const SO_RXQ_OVFL: ::c_int = 40;
+pub const SO_PEEK_OFF: ::c_int = 42;
+pub const SO_BUSY_POLL: ::c_int = 46;
pub const SA_ONSTACK: ::c_int = 0x08000000;
pub const SA_SIGINFO: ::c_int = 0x00000004;
@@ -224,7 +237,6 @@ pub const TIOCMBIS: ::c_ulong = 0x5416;
pub const TIOCMBIC: ::c_ulong = 0x5417;
pub const TIOCMSET: ::c_ulong = 0x5418;
pub const TIOCCONS: ::c_ulong = 0x541D;
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
pub const SFD_CLOEXEC: ::c_int = 0x080000;
@@ -262,6 +274,7 @@ pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
pub const PTRACE_GETFPREGS: ::c_uint = 14;
pub const PTRACE_SETFPREGS: ::c_uint = 15;
diff --git a/libc/src/unix/notbsd/linux/other/b32/powerpc.rs b/libc/src/unix/notbsd/linux/other/b32/powerpc.rs
index 035bfe1..13646b7 100644
--- a/libc/src/unix/notbsd/linux/other/b32/powerpc.rs
+++ b/libc/src/unix/notbsd/linux/other/b32/powerpc.rs
@@ -37,6 +37,37 @@ s! {
__glibc_reserved5: ::c_ulong,
}
+ pub struct statfs64 {
+ pub f_type: ::__fsword_t,
+ pub f_bsize: ::__fsword_t,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_fsid: ::fsid_t,
+ pub f_namelen: ::__fsword_t,
+ pub f_frsize: ::__fsword_t,
+ pub f_flags: ::__fsword_t,
+ pub f_spare: [::__fsword_t; 4],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: u64,
+ pub f_fsid: ::c_ulong,
+ __f_unused: ::c_int,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ __f_spare: [::c_int; 6],
+ }
+
pub struct shmid_ds {
pub shm_perm: ::ipc_perm,
__glibc_reserved1: ::c_uint,
@@ -75,6 +106,7 @@ s! {
pub const O_DIRECT: ::c_int = 0x20000;
pub const O_DIRECTORY: ::c_int = 0x4000;
pub const O_NOFOLLOW: ::c_int = 0x8000;
+pub const O_LARGEFILE: ::c_int = 0o200000;
pub const MAP_LOCKED: ::c_int = 0x00080;
pub const MAP_NORESERVE: ::c_int = 0x00040;
@@ -84,8 +116,6 @@ pub const EDEADLOCK: ::c_int = 58;
pub const SO_SNDBUFFORCE: ::c_int = 32;
pub const SO_RCVBUFFORCE: ::c_int = 33;
pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_BSDCOMPAT: ::c_int = 14;
pub const SO_RCVLOWAT: ::c_int = 16;
pub const SO_SNDLOWAT: ::c_int = 17;
pub const SO_RCVTIMEO: ::c_int = 18;
@@ -96,8 +126,10 @@ pub const SO_PEERCRED: ::c_int = 21;
pub const FIOCLEX: ::c_ulong = 0x20006601;
pub const FIONBIO: ::c_ulong = 0x8004667e;
+pub const SYS_pivot_root: ::c_long = 203;
pub const SYS_gettid: ::c_long = 207;
pub const SYS_perf_event_open: ::c_long = 319;
+pub const SYS_memfd_create: ::c_long = 360;
pub const MCL_CURRENT: ::c_int = 0x2000;
pub const MCL_FUTURE: ::c_int = 0x4000;
@@ -144,6 +176,15 @@ pub const ISIG: ::tcflag_t = 0x80;
pub const ICANON: ::tcflag_t = 0x100;
pub const PENDIN: ::tcflag_t = 0x20000000;
pub const NOFLSH: ::tcflag_t = 0x80000000;
+pub const VSWTC: usize = 9;
+pub const OLCUC: ::tcflag_t = 0o000004;
+pub const NLDLY: ::tcflag_t = 0o001400;
+pub const CRDLY: ::tcflag_t = 0o030000;
+pub const TABDLY: ::tcflag_t = 0o006000;
+pub const BSDLY: ::tcflag_t = 0o100000;
+pub const FFDLY: ::tcflag_t = 0o040000;
+pub const VTDLY: ::tcflag_t = 0o200000;
+pub const XTABS: ::tcflag_t = 0o006000;
pub const B0: ::speed_t = 0o000000;
pub const B50: ::speed_t = 0o000001;
diff --git a/libc/src/unix/notbsd/linux/other/b32/x86.rs b/libc/src/unix/notbsd/linux/other/b32/x86.rs
index 263e140..1413396 100644
--- a/libc/src/unix/notbsd/linux/other/b32/x86.rs
+++ b/libc/src/unix/notbsd/linux/other/b32/x86.rs
@@ -20,6 +20,71 @@ s! {
pub status: ::c_ulong,
}
+ pub struct user_fpregs_struct {
+ pub cwd: ::c_long,
+ pub swd: ::c_long,
+ pub twd: ::c_long,
+ pub fip: ::c_long,
+ pub fcs: ::c_long,
+ pub foo: ::c_long,
+ pub fos: ::c_long,
+ pub st_space: [::c_long; 20],
+ }
+
+ pub struct user_fpxregs_struct {
+ pub cwd: ::c_ushort,
+ pub swd: ::c_ushort,
+ pub twd: ::c_ushort,
+ pub fop: ::c_ushort,
+ pub fip: ::c_long,
+ pub fcs: ::c_long,
+ pub foo: ::c_long,
+ pub fos: ::c_long,
+ pub mxcsr: ::c_long,
+ __reserved: ::c_long,
+ pub st_space: [::c_long; 32],
+ pub xmm_space: [::c_long; 32],
+ padding: [::c_long; 56],
+ }
+
+ pub struct user_regs_struct {
+ pub ebx: ::c_long,
+ pub ecx: ::c_long,
+ pub edx: ::c_long,
+ pub esi: ::c_long,
+ pub edi: ::c_long,
+ pub ebp: ::c_long,
+ pub eax: ::c_long,
+ pub xds: ::c_long,
+ pub xes: ::c_long,
+ pub xfs: ::c_long,
+ pub xgs: ::c_long,
+ pub orig_eax: ::c_long,
+ pub eip: ::c_long,
+ pub xcs: ::c_long,
+ pub eflags: ::c_long,
+ pub esp: ::c_long,
+ pub xss: ::c_long,
+ }
+
+ pub struct user {
+ pub regs: user_regs_struct,
+ pub u_fpvalid: ::c_int,
+ pub i387: user_fpregs_struct,
+ pub u_tsize: ::c_ulong,
+ pub u_dsize: ::c_ulong,
+ pub u_ssize: ::c_ulong,
+ pub start_code: ::c_ulong,
+ pub start_stack: ::c_ulong,
+ pub signal: ::c_long,
+ __reserved: ::c_int,
+ pub u_ar0: *mut user_regs_struct,
+ pub u_fpstate: *mut user_fpregs_struct,
+ pub magic: ::c_ulong,
+ pub u_comm: [c_char; 32],
+ pub u_debugreg: [::c_int; 8],
+ }
+
pub struct mcontext_t {
pub gregs: [greg_t; 19],
pub fpregs: *mut _libc_fpstate,
@@ -72,6 +137,37 @@ s! {
pub st_ino: ::ino64_t,
}
+ pub struct statfs64 {
+ pub f_type: ::__fsword_t,
+ pub f_bsize: ::__fsword_t,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_fsid: ::fsid_t,
+ pub f_namelen: ::__fsword_t,
+ pub f_frsize: ::__fsword_t,
+ pub f_flags: ::__fsword_t,
+ pub f_spare: [::__fsword_t; 4],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: u64,
+ pub f_fsid: ::c_ulong,
+ __f_unused: ::c_int,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ __f_spare: [::c_int; 6],
+ }
+
pub struct shmid_ds {
pub shm_perm: ::ipc_perm,
pub shm_segsz: ::size_t,
@@ -109,6 +205,7 @@ s! {
pub const O_DIRECT: ::c_int = 0x4000;
pub const O_DIRECTORY: ::c_int = 0x10000;
pub const O_NOFOLLOW: ::c_int = 0x20000;
+pub const O_LARGEFILE: ::c_int = 0o0100000;
pub const MAP_LOCKED: ::c_int = 0x02000;
pub const MAP_NORESERVE: ::c_int = 0x04000;
@@ -119,8 +216,6 @@ pub const EDEADLOCK: ::c_int = 35;
pub const SO_SNDBUFFORCE: ::c_int = 32;
pub const SO_RCVBUFFORCE: ::c_int = 33;
pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_BSDCOMPAT: ::c_int = 14;
pub const SO_PASSCRED: ::c_int = 16;
pub const SO_PEERCRED: ::c_int = 17;
pub const SO_RCVLOWAT: ::c_int = 18;
@@ -131,9 +226,6 @@ pub const SO_SNDTIMEO: ::c_int = 21;
pub const FIOCLEX: ::c_ulong = 0x5451;
pub const FIONBIO: ::c_ulong = 0x5421;
-pub const SYS_gettid: ::c_long = 224;
-pub const SYS_perf_event_open: ::c_long = 336;
-
pub const PTRACE_GETFPXREGS: ::c_uint = 18;
pub const PTRACE_SETFPXREGS: ::c_uint = 19;
@@ -182,6 +274,17 @@ pub const ISIG: ::tcflag_t = 0x00000001;
pub const ICANON: ::tcflag_t = 0x00000002;
pub const PENDIN: ::tcflag_t = 0x00004000;
pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const VSWTC: usize = 7;
+pub const OLCUC: ::tcflag_t = 0o000002;
+pub const NLDLY: ::tcflag_t = 0o000400;
+pub const CRDLY: ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY: ::tcflag_t = 0o020000;
+pub const FFDLY: ::tcflag_t = 0o100000;
+pub const VTDLY: ::tcflag_t = 0o040000;
+pub const XTABS: ::tcflag_t = 0o014000;
pub const B0: ::speed_t = 0o000000;
pub const B50: ::speed_t = 0o000001;
@@ -243,6 +346,406 @@ pub const TIOCGWINSZ: ::c_ulong = 0x5413;
pub const TIOCSWINSZ: ::c_ulong = 0x5414;
pub const FIONREAD: ::c_ulong = 0x541B;
+// Syscall table
+pub const SYS_restart_syscall: ::c_long = 0;
+pub const SYS_exit: ::c_long = 1;
+pub const SYS_fork: ::c_long = 2;
+pub const SYS_read: ::c_long = 3;
+pub const SYS_write: ::c_long = 4;
+pub const SYS_open: ::c_long = 5;
+pub const SYS_close: ::c_long = 6;
+pub const SYS_waitpid: ::c_long = 7;
+pub const SYS_creat: ::c_long = 8;
+pub const SYS_link: ::c_long = 9;
+pub const SYS_unlink: ::c_long = 10;
+pub const SYS_execve: ::c_long = 11;
+pub const SYS_chdir: ::c_long = 12;
+pub const SYS_time: ::c_long = 13;
+pub const SYS_mknod: ::c_long = 14;
+pub const SYS_chmod: ::c_long = 15;
+pub const SYS_lchown: ::c_long = 16;
+pub const SYS_break: ::c_long = 17;
+pub const SYS_oldstat: ::c_long = 18;
+pub const SYS_lseek: ::c_long = 19;
+pub const SYS_getpid: ::c_long = 20;
+pub const SYS_mount: ::c_long = 21;
+pub const SYS_umount: ::c_long = 22;
+pub const SYS_setuid: ::c_long = 23;
+pub const SYS_getuid: ::c_long = 24;
+pub const SYS_stime: ::c_long = 25;
+pub const SYS_ptrace: ::c_long = 26;
+pub const SYS_alarm: ::c_long = 27;
+pub const SYS_oldfstat: ::c_long = 28;
+pub const SYS_pause: ::c_long = 29;
+pub const SYS_utime: ::c_long = 30;
+pub const SYS_stty: ::c_long = 31;
+pub const SYS_gtty: ::c_long = 32;
+pub const SYS_access: ::c_long = 33;
+pub const SYS_nice: ::c_long = 34;
+pub const SYS_ftime: ::c_long = 35;
+pub const SYS_sync: ::c_long = 36;
+pub const SYS_kill: ::c_long = 37;
+pub const SYS_rename: ::c_long = 38;
+pub const SYS_mkdir: ::c_long = 39;
+pub const SYS_rmdir: ::c_long = 40;
+pub const SYS_dup: ::c_long = 41;
+pub const SYS_pipe: ::c_long = 42;
+pub const SYS_times: ::c_long = 43;
+pub const SYS_prof: ::c_long = 44;
+pub const SYS_brk: ::c_long = 45;
+pub const SYS_setgid: ::c_long = 46;
+pub const SYS_getgid: ::c_long = 47;
+pub const SYS_signal: ::c_long = 48;
+pub const SYS_geteuid: ::c_long = 49;
+pub const SYS_getegid: ::c_long = 50;
+pub const SYS_acct: ::c_long = 51;
+pub const SYS_umount2: ::c_long = 52;
+pub const SYS_lock: ::c_long = 53;
+pub const SYS_ioctl: ::c_long = 54;
+pub const SYS_fcntl: ::c_long = 55;
+pub const SYS_mpx: ::c_long = 56;
+pub const SYS_setpgid: ::c_long = 57;
+pub const SYS_ulimit: ::c_long = 58;
+pub const SYS_oldolduname: ::c_long = 59;
+pub const SYS_umask: ::c_long = 60;
+pub const SYS_chroot: ::c_long = 61;
+pub const SYS_ustat: ::c_long = 62;
+pub const SYS_dup2: ::c_long = 63;
+pub const SYS_getppid: ::c_long = 64;
+pub const SYS_getpgrp: ::c_long = 65;
+pub const SYS_setsid: ::c_long = 66;
+pub const SYS_sigaction: ::c_long = 67;
+pub const SYS_sgetmask: ::c_long = 68;
+pub const SYS_ssetmask: ::c_long = 69;
+pub const SYS_setreuid: ::c_long = 70;
+pub const SYS_setregid: ::c_long = 71;
+pub const SYS_sigsuspend: ::c_long = 72;
+pub const SYS_sigpending: ::c_long = 73;
+pub const SYS_sethostname: ::c_long = 74;
+pub const SYS_setrlimit: ::c_long = 75;
+pub const SYS_getrlimit: ::c_long = 76;
+pub const SYS_getrusage: ::c_long = 77;
+pub const SYS_gettimeofday: ::c_long = 78;
+pub const SYS_settimeofday: ::c_long = 79;
+pub const SYS_getgroups: ::c_long = 80;
+pub const SYS_setgroups: ::c_long = 81;
+pub const SYS_select: ::c_long = 82;
+pub const SYS_symlink: ::c_long = 83;
+pub const SYS_oldlstat: ::c_long = 84;
+pub const SYS_readlink: ::c_long = 85;
+pub const SYS_uselib: ::c_long = 86;
+pub const SYS_swapon: ::c_long = 87;
+pub const SYS_reboot: ::c_long = 88;
+pub const SYS_readdir: ::c_long = 89;
+pub const SYS_mmap: ::c_long = 90;
+pub const SYS_munmap: ::c_long = 91;
+pub const SYS_truncate: ::c_long = 92;
+pub const SYS_ftruncate: ::c_long = 93;
+pub const SYS_fchmod: ::c_long = 94;
+pub const SYS_fchown: ::c_long = 95;
+pub const SYS_getpriority: ::c_long = 96;
+pub const SYS_setpriority: ::c_long = 97;
+pub const SYS_profil: ::c_long = 98;
+pub const SYS_statfs: ::c_long = 99;
+pub const SYS_fstatfs: ::c_long = 100;
+pub const SYS_ioperm: ::c_long = 101;
+pub const SYS_socketcall: ::c_long = 102;
+pub const SYS_syslog: ::c_long = 103;
+pub const SYS_setitimer: ::c_long = 104;
+pub const SYS_getitimer: ::c_long = 105;
+pub const SYS_stat: ::c_long = 106;
+pub const SYS_lstat: ::c_long = 107;
+pub const SYS_fstat: ::c_long = 108;
+pub const SYS_olduname: ::c_long = 109;
+pub const SYS_iopl: ::c_long = 110;
+pub const SYS_vhangup: ::c_long = 111;
+pub const SYS_idle: ::c_long = 112;
+pub const SYS_vm86old: ::c_long = 113;
+pub const SYS_wait4: ::c_long = 114;
+pub const SYS_swapoff: ::c_long = 115;
+pub const SYS_sysinfo: ::c_long = 116;
+pub const SYS_ipc: ::c_long = 117;
+pub const SYS_fsync: ::c_long = 118;
+pub const SYS_sigreturn: ::c_long = 119;
+pub const SYS_clone: ::c_long = 120;
+pub const SYS_setdomainname: ::c_long = 121;
+pub const SYS_uname: ::c_long = 122;
+pub const SYS_modify_ldt: ::c_long = 123;
+pub const SYS_adjtimex: ::c_long = 124;
+pub const SYS_mprotect: ::c_long = 125;
+pub const SYS_sigprocmask: ::c_long = 126;
+pub const SYS_create_module: ::c_long = 127;
+pub const SYS_init_module: ::c_long = 128;
+pub const SYS_delete_module: ::c_long = 129;
+pub const SYS_get_kernel_syms: ::c_long = 130;
+pub const SYS_quotactl: ::c_long = 131;
+pub const SYS_getpgid: ::c_long = 132;
+pub const SYS_fchdir: ::c_long = 133;
+pub const SYS_bdflush: ::c_long = 134;
+pub const SYS_sysfs: ::c_long = 135;
+pub const SYS_personality: ::c_long = 136;
+pub const SYS_afs_syscall: ::c_long = 137;
+pub const SYS_setfsuid: ::c_long = 138;
+pub const SYS_setfsgid: ::c_long = 139;
+pub const SYS__llseek: ::c_long = 140;
+pub const SYS_getdents: ::c_long = 141;
+pub const SYS__newselect: ::c_long = 142;
+pub const SYS_flock: ::c_long = 143;
+pub const SYS_msync: ::c_long = 144;
+pub const SYS_readv: ::c_long = 145;
+pub const SYS_writev: ::c_long = 146;
+pub const SYS_getsid: ::c_long = 147;
+pub const SYS_fdatasync: ::c_long = 148;
+pub const SYS__sysctl: ::c_long = 149;
+pub const SYS_mlock: ::c_long = 150;
+pub const SYS_munlock: ::c_long = 151;
+pub const SYS_mlockall: ::c_long = 152;
+pub const SYS_munlockall: ::c_long = 153;
+pub const SYS_sched_setparam: ::c_long = 154;
+pub const SYS_sched_getparam: ::c_long = 155;
+pub const SYS_sched_setscheduler: ::c_long = 156;
+pub const SYS_sched_getscheduler: ::c_long = 157;
+pub const SYS_sched_yield: ::c_long = 158;
+pub const SYS_sched_get_priority_max: ::c_long = 159;
+pub const SYS_sched_get_priority_min: ::c_long = 160;
+pub const SYS_sched_rr_get_interval: ::c_long = 161;
+pub const SYS_nanosleep: ::c_long = 162;
+pub const SYS_mremap: ::c_long = 163;
+pub const SYS_setresuid: ::c_long = 164;
+pub const SYS_getresuid: ::c_long = 165;
+pub const SYS_vm86: ::c_long = 166;
+pub const SYS_query_module: ::c_long = 167;
+pub const SYS_poll: ::c_long = 168;
+pub const SYS_nfsservctl: ::c_long = 169;
+pub const SYS_setresgid: ::c_long = 170;
+pub const SYS_getresgid: ::c_long = 171;
+pub const SYS_prctl: ::c_long = 172;
+pub const SYS_rt_sigreturn: ::c_long = 173;
+pub const SYS_rt_sigaction: ::c_long = 174;
+pub const SYS_rt_sigprocmask: ::c_long = 175;
+pub const SYS_rt_sigpending: ::c_long = 176;
+pub const SYS_rt_sigtimedwait: ::c_long = 177;
+pub const SYS_rt_sigqueueinfo: ::c_long = 178;
+pub const SYS_rt_sigsuspend: ::c_long = 179;
+pub const SYS_pread64: ::c_long = 180;
+pub const SYS_pwrite64: ::c_long = 181;
+pub const SYS_chown: ::c_long = 182;
+pub const SYS_getcwd: ::c_long = 183;
+pub const SYS_capget: ::c_long = 184;
+pub const SYS_capset: ::c_long = 185;
+pub const SYS_sigaltstack: ::c_long = 186;
+pub const SYS_sendfile: ::c_long = 187;
+pub const SYS_getpmsg: ::c_long = 188;
+pub const SYS_putpmsg: ::c_long = 189;
+pub const SYS_vfork: ::c_long = 190;
+pub const SYS_ugetrlimit: ::c_long = 191;
+pub const SYS_mmap2: ::c_long = 192;
+pub const SYS_truncate64: ::c_long = 193;
+pub const SYS_ftruncate64: ::c_long = 194;
+pub const SYS_stat64: ::c_long = 195;
+pub const SYS_lstat64: ::c_long = 196;
+pub const SYS_fstat64: ::c_long = 197;
+pub const SYS_lchown32: ::c_long = 198;
+pub const SYS_getuid32: ::c_long = 199;
+pub const SYS_getgid32: ::c_long = 200;
+pub const SYS_geteuid32: ::c_long = 201;
+pub const SYS_getegid32: ::c_long = 202;
+pub const SYS_setreuid32: ::c_long = 203;
+pub const SYS_setregid32: ::c_long = 204;
+pub const SYS_getgroups32: ::c_long = 205;
+pub const SYS_setgroups32: ::c_long = 206;
+pub const SYS_fchown32: ::c_long = 207;
+pub const SYS_setresuid32: ::c_long = 208;
+pub const SYS_getresuid32: ::c_long = 209;
+pub const SYS_setresgid32: ::c_long = 210;
+pub const SYS_getresgid32: ::c_long = 211;
+pub const SYS_chown32: ::c_long = 212;
+pub const SYS_setuid32: ::c_long = 213;
+pub const SYS_setgid32: ::c_long = 214;
+pub const SYS_setfsuid32: ::c_long = 215;
+pub const SYS_setfsgid32: ::c_long = 216;
+pub const SYS_pivot_root: ::c_long = 217;
+pub const SYS_mincore: ::c_long = 218;
+pub const SYS_madvise: ::c_long = 219;
+pub const SYS_getdents64: ::c_long = 220;
+pub const SYS_fcntl64: ::c_long = 221;
+pub const SYS_gettid: ::c_long = 224;
+pub const SYS_readahead: ::c_long = 225;
+pub const SYS_setxattr: ::c_long = 226;
+pub const SYS_lsetxattr: ::c_long = 227;
+pub const SYS_fsetxattr: ::c_long = 228;
+pub const SYS_getxattr: ::c_long = 229;
+pub const SYS_lgetxattr: ::c_long = 230;
+pub const SYS_fgetxattr: ::c_long = 231;
+pub const SYS_listxattr: ::c_long = 232;
+pub const SYS_llistxattr: ::c_long = 233;
+pub const SYS_flistxattr: ::c_long = 234;
+pub const SYS_removexattr: ::c_long = 235;
+pub const SYS_lremovexattr: ::c_long = 236;
+pub const SYS_fremovexattr: ::c_long = 237;
+pub const SYS_tkill: ::c_long = 238;
+pub const SYS_sendfile64: ::c_long = 239;
+pub const SYS_futex: ::c_long = 240;
+pub const SYS_sched_setaffinity: ::c_long = 241;
+pub const SYS_sched_getaffinity: ::c_long = 242;
+pub const SYS_set_thread_area: ::c_long = 243;
+pub const SYS_get_thread_area: ::c_long = 244;
+pub const SYS_io_setup: ::c_long = 245;
+pub const SYS_io_destroy: ::c_long = 246;
+pub const SYS_io_getevents: ::c_long = 247;
+pub const SYS_io_submit: ::c_long = 248;
+pub const SYS_io_cancel: ::c_long = 249;
+pub const SYS_fadvise64: ::c_long = 250;
+pub const SYS_exit_group: ::c_long = 252;
+pub const SYS_lookup_dcookie: ::c_long = 253;
+pub const SYS_epoll_create: ::c_long = 254;
+pub const SYS_epoll_ctl: ::c_long = 255;
+pub const SYS_epoll_wait: ::c_long = 256;
+pub const SYS_remap_file_pages: ::c_long = 257;
+pub const SYS_set_tid_address: ::c_long = 258;
+pub const SYS_timer_create: ::c_long = 259;
+pub const SYS_timer_settime: ::c_long = 260;
+pub const SYS_timer_gettime: ::c_long = 261;
+pub const SYS_timer_getoverrun: ::c_long = 262;
+pub const SYS_timer_delete: ::c_long = 263;
+pub const SYS_clock_settime: ::c_long = 264;
+pub const SYS_clock_gettime: ::c_long = 265;
+pub const SYS_clock_getres: ::c_long = 266;
+pub const SYS_clock_nanosleep: ::c_long = 267;
+pub const SYS_statfs64: ::c_long = 268;
+pub const SYS_fstatfs64: ::c_long = 269;
+pub const SYS_tgkill: ::c_long = 270;
+pub const SYS_utimes: ::c_long = 271;
+pub const SYS_fadvise64_64: ::c_long = 272;
+pub const SYS_vserver: ::c_long = 273;
+pub const SYS_mbind: ::c_long = 274;
+pub const SYS_get_mempolicy: ::c_long = 275;
+pub const SYS_set_mempolicy: ::c_long = 276;
+pub const SYS_mq_open: ::c_long = 277;
+pub const SYS_mq_unlink: ::c_long = 278;
+pub const SYS_mq_timedsend: ::c_long = 279;
+pub const SYS_mq_timedreceive: ::c_long = 280;
+pub const SYS_mq_notify: ::c_long = 281;
+pub const SYS_mq_getsetattr: ::c_long = 282;
+pub const SYS_kexec_load: ::c_long = 283;
+pub const SYS_waitid: ::c_long = 284;
+pub const SYS_add_key: ::c_long = 286;
+pub const SYS_request_key: ::c_long = 287;
+pub const SYS_keyctl: ::c_long = 288;
+pub const SYS_ioprio_set: ::c_long = 289;
+pub const SYS_ioprio_get: ::c_long = 290;
+pub const SYS_inotify_init: ::c_long = 291;
+pub const SYS_inotify_add_watch: ::c_long = 292;
+pub const SYS_inotify_rm_watch: ::c_long = 293;
+pub const SYS_migrate_pages: ::c_long = 294;
+pub const SYS_openat: ::c_long = 295;
+pub const SYS_mkdirat: ::c_long = 296;
+pub const SYS_mknodat: ::c_long = 297;
+pub const SYS_fchownat: ::c_long = 298;
+pub const SYS_futimesat: ::c_long = 299;
+pub const SYS_fstatat64: ::c_long = 300;
+pub const SYS_unlinkat: ::c_long = 301;
+pub const SYS_renameat: ::c_long = 302;
+pub const SYS_linkat: ::c_long = 303;
+pub const SYS_symlinkat: ::c_long = 304;
+pub const SYS_readlinkat: ::c_long = 305;
+pub const SYS_fchmodat: ::c_long = 306;
+pub const SYS_faccessat: ::c_long = 307;
+pub const SYS_pselect6: ::c_long = 308;
+pub const SYS_ppoll: ::c_long = 309;
+pub const SYS_unshare: ::c_long = 310;
+pub const SYS_set_robust_list: ::c_long = 311;
+pub const SYS_get_robust_list: ::c_long = 312;
+pub const SYS_splice: ::c_long = 313;
+pub const SYS_sync_file_range: ::c_long = 314;
+pub const SYS_tee: ::c_long = 315;
+pub const SYS_vmsplice: ::c_long = 316;
+pub const SYS_move_pages: ::c_long = 317;
+pub const SYS_getcpu: ::c_long = 318;
+pub const SYS_epoll_pwait: ::c_long = 319;
+pub const SYS_utimensat: ::c_long = 320;
+pub const SYS_signalfd: ::c_long = 321;
+pub const SYS_timerfd_create: ::c_long = 322;
+pub const SYS_eventfd: ::c_long = 323;
+pub const SYS_fallocate: ::c_long = 324;
+pub const SYS_timerfd_settime: ::c_long = 325;
+pub const SYS_timerfd_gettime: ::c_long = 326;
+pub const SYS_signalfd4: ::c_long = 327;
+pub const SYS_eventfd2: ::c_long = 328;
+pub const SYS_epoll_create1: ::c_long = 329;
+pub const SYS_dup3: ::c_long = 330;
+pub const SYS_pipe2: ::c_long = 331;
+pub const SYS_inotify_init1: ::c_long = 332;
+pub const SYS_preadv: ::c_long = 333;
+pub const SYS_pwritev: ::c_long = 334;
+pub const SYS_rt_tgsigqueueinfo: ::c_long = 335;
+pub const SYS_perf_event_open: ::c_long = 336;
+pub const SYS_recvmmsg: ::c_long = 337;
+pub const SYS_fanotify_init: ::c_long = 338;
+pub const SYS_fanotify_mark: ::c_long = 339;
+pub const SYS_prlimit64: ::c_long = 340;
+pub const SYS_name_to_handle_at: ::c_long = 341;
+pub const SYS_open_by_handle_at: ::c_long = 342;
+pub const SYS_clock_adjtime: ::c_long = 343;
+pub const SYS_syncfs: ::c_long = 344;
+pub const SYS_sendmmsg: ::c_long = 345;
+pub const SYS_setns: ::c_long = 346;
+pub const SYS_process_vm_readv: ::c_long = 347;
+pub const SYS_process_vm_writev: ::c_long = 348;
+pub const SYS_kcmp: ::c_long = 349;
+pub const SYS_finit_module: ::c_long = 350;
+pub const SYS_sched_setattr: ::c_long = 351;
+pub const SYS_sched_getattr: ::c_long = 352;
+pub const SYS_renameat2: ::c_long = 353;
+pub const SYS_seccomp: ::c_long = 354;
+pub const SYS_getrandom: ::c_long = 355;
+pub const SYS_memfd_create: ::c_long = 356;
+pub const SYS_bpf: ::c_long = 357;
+pub const SYS_execveat: ::c_long = 358;
+pub const SYS_socket: ::c_long = 359;
+pub const SYS_socketpair: ::c_long = 360;
+pub const SYS_bind: ::c_long = 361;
+pub const SYS_connect: ::c_long = 362;
+pub const SYS_listen: ::c_long = 363;
+pub const SYS_accept4: ::c_long = 364;
+pub const SYS_getsockopt: ::c_long = 365;
+pub const SYS_setsockopt: ::c_long = 366;
+pub const SYS_getsockname: ::c_long = 367;
+pub const SYS_getpeername: ::c_long = 368;
+pub const SYS_sendto: ::c_long = 369;
+pub const SYS_sendmsg: ::c_long = 370;
+pub const SYS_recvfrom: ::c_long = 371;
+pub const SYS_recvmsg: ::c_long = 372;
+pub const SYS_shutdown: ::c_long = 373;
+pub const SYS_userfaultfd: ::c_long = 374;
+pub const SYS_membarrier: ::c_long = 375;
+pub const SYS_mlock2: ::c_long = 376;
+pub const SYS_copy_file_range: ::c_long = 377;
+pub const SYS_preadv2: ::c_long = 378;
+pub const SYS_pwritev2: ::c_long = 379;
+pub const SYS_pkey_mprotect: ::c_long = 380;
+pub const SYS_pkey_alloc: ::c_long = 381;
+pub const SYS_pkey_free: ::c_long = 382;
+
+// offsets in user_regs_structs, from sys/reg.h
+pub const EBX: ::c_int = 0;
+pub const ECX: ::c_int = 1;
+pub const EDX: ::c_int = 2;
+pub const ESI: ::c_int = 3;
+pub const EDI: ::c_int = 4;
+pub const EBP: ::c_int = 5;
+pub const EAX: ::c_int = 6;
+pub const DS: ::c_int = 7;
+pub const ES: ::c_int = 8;
+pub const FS: ::c_int = 9;
+pub const GS: ::c_int = 10;
+pub const ORIG_EAX: ::c_int = 11;
+pub const EIP: ::c_int = 12;
+pub const CS: ::c_int = 13;
+pub const EFL: ::c_int = 14;
+pub const UESP: ::c_int = 15;
+pub const SS: ::c_int = 16;
+
extern {
pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;
pub fn setcontext(ucp: *const ucontext_t) -> ::c_int;
diff --git a/libc/src/unix/notbsd/linux/other/b64/aarch64.rs b/libc/src/unix/notbsd/linux/other/b64/aarch64.rs
index 77cee3d..f4583d5 100644
--- a/libc/src/unix/notbsd/linux/other/b64/aarch64.rs
+++ b/libc/src/unix/notbsd/linux/other/b64/aarch64.rs
@@ -5,6 +5,7 @@ pub type wchar_t = u32;
pub type nlink_t = u32;
pub type blksize_t = i32;
pub type suseconds_t = i64;
+pub type __u64 = ::c_ulonglong;
s! {
pub struct stat {
@@ -51,6 +52,36 @@ s! {
__unused: [::c_int; 2],
}
+ pub struct statfs64 {
+ pub f_type: ::__fsword_t,
+ pub f_bsize: ::__fsword_t,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_fsid: ::fsid_t,
+ pub f_namelen: ::__fsword_t,
+ pub f_frsize: ::__fsword_t,
+ pub f_flags: ::__fsword_t,
+ pub f_spare: [::__fsword_t; 4],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: u64,
+ pub f_fsid: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ __f_spare: [::c_int; 6],
+ }
+
pub struct pthread_attr_t {
__size: [u64; 8]
}
@@ -97,6 +128,8 @@ pub const O_SYNC: ::c_int = 1052672;
pub const O_RSYNC: ::c_int = 1052672;
pub const O_DSYNC: ::c_int = 4096;
pub const O_FSYNC: ::c_int = 0x101000;
+pub const O_NOATIME: ::c_int = 0o1000000;
+pub const O_PATH: ::c_int = 0o10000000;
pub const MAP_GROWSDOWN: ::c_int = 0x0100;
@@ -212,7 +245,6 @@ pub const SO_DETACH_FILTER: ::c_int = 27;
pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
pub const SO_PEERNAME: ::c_int = 28;
pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
pub const SO_ACCEPTCONN: ::c_int = 30;
pub const SO_PEERSEC: ::c_int = 31;
pub const SO_PASSSEC: ::c_int = 34;
@@ -287,8 +319,6 @@ pub const TIOCMBIC: ::c_ulong = 0x5417;
pub const TIOCMSET: ::c_ulong = 0x5418;
pub const TIOCCONS: ::c_ulong = 0x541D;
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
-
pub const SFD_CLOEXEC: ::c_int = 0x080000;
pub const NCCS: usize = 32;
@@ -337,8 +367,10 @@ pub const EDEADLOCK: ::c_int = 35;
pub const FIOCLEX: ::c_ulong = 0x5451;
pub const FIONBIO: ::c_ulong = 0x5421;
+pub const SYS_pivot_root: ::c_long = 41;
pub const SYS_gettid: ::c_long = 178;
pub const SYS_perf_event_open: ::c_long = 241;
+pub const SYS_memfd_create: ::c_long = 279;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
@@ -385,6 +417,17 @@ pub const ISIG: ::tcflag_t = 0x00000001;
pub const ICANON: ::tcflag_t = 0x00000002;
pub const PENDIN: ::tcflag_t = 0x00004000;
pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const VSWTC: usize = 7;
+pub const OLCUC: ::tcflag_t = 0o000002;
+pub const NLDLY: ::tcflag_t = 0o000400;
+pub const CRDLY: ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY: ::tcflag_t = 0o020000;
+pub const FFDLY: ::tcflag_t = 0o100000;
+pub const VTDLY: ::tcflag_t = 0o040000;
+pub const XTABS: ::tcflag_t = 0o014000;
pub const B0: ::speed_t = 0o000000;
pub const B50: ::speed_t = 0o000001;
diff --git a/libc/src/unix/notbsd/linux/other/b64/mod.rs b/libc/src/unix/notbsd/linux/other/b64/mod.rs
index 2fcec73..aa0e091 100644
--- a/libc/src/unix/notbsd/linux/other/b64/mod.rs
+++ b/libc/src/unix/notbsd/linux/other/b64/mod.rs
@@ -47,6 +47,9 @@ s! {
}
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
+
+pub const O_LARGEFILE: ::c_int = 0;
cfg_if! {
if #[cfg(target_arch = "aarch64")] {
diff --git a/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs b/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs
index 8c19b07..56a78b0 100644
--- a/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs
+++ b/libc/src/unix/notbsd/linux/other/b64/powerpc64.rs
@@ -5,6 +5,7 @@ pub type wchar_t = i32;
pub type nlink_t = u64;
pub type blksize_t = i64;
pub type suseconds_t = i64;
+pub type __u64 = ::c_ulong;
s! {
pub struct stat {
@@ -49,6 +50,36 @@ s! {
__reserved: [::c_long; 3],
}
+ pub struct statfs64 {
+ pub f_type: ::__fsword_t,
+ pub f_bsize: ::__fsword_t,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_fsid: ::fsid_t,
+ pub f_namelen: ::__fsword_t,
+ pub f_frsize: ::__fsword_t,
+ pub f_flags: ::__fsword_t,
+ pub f_spare: [::__fsword_t; 4],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: u64,
+ pub f_fsid: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ __f_spare: [::c_int; 6],
+ }
+
pub struct pthread_attr_t {
__size: [u64; 7]
}
@@ -95,6 +126,8 @@ pub const O_SYNC: ::c_int = 1052672;
pub const O_RSYNC: ::c_int = 1052672;
pub const O_DSYNC: ::c_int = 4096;
pub const O_FSYNC: ::c_int = 0x101000;
+pub const O_NOATIME: ::c_int = 0o1000000;
+pub const O_PATH: ::c_int = 0o10000000;
pub const MAP_GROWSDOWN: ::c_int = 0x0100;
@@ -210,7 +243,6 @@ pub const SO_DETACH_FILTER: ::c_int = 27;
pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
pub const SO_PEERNAME: ::c_int = 28;
pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
pub const SO_ACCEPTCONN: ::c_int = 30;
pub const SO_PEERSEC: ::c_int = 31;
pub const SO_PASSSEC: ::c_int = 34;
@@ -285,8 +317,6 @@ pub const TIOCMBIC: ::c_ulong = 0x5417;
pub const TIOCMSET: ::c_ulong = 0x5418;
pub const TIOCCONS: ::c_ulong = 0x541D;
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
-
pub const SFD_CLOEXEC: ::c_int = 0x080000;
pub const NCCS: usize = 32;
@@ -335,8 +365,10 @@ pub const EDEADLOCK: ::c_int = 58;
pub const FIOCLEX: ::c_ulong = 0x20006601;
pub const FIONBIO: ::c_ulong = 0x8004667e;
+pub const SYS_pivot_root: ::c_long = 203;
pub const SYS_gettid: ::c_long = 207;
pub const SYS_perf_event_open: ::c_long = 319;
+pub const SYS_memfd_create: ::c_long = 360;
pub const MCL_CURRENT: ::c_int = 0x2000;
pub const MCL_FUTURE: ::c_int = 0x4000;
@@ -383,6 +415,15 @@ pub const ISIG: ::tcflag_t = 0x80;
pub const ICANON: ::tcflag_t = 0x100;
pub const PENDIN: ::tcflag_t = 0x20000000;
pub const NOFLSH: ::tcflag_t = 0x80000000;
+pub const VSWTC: usize = 9;
+pub const OLCUC: ::tcflag_t = 0o000004;
+pub const NLDLY: ::tcflag_t = 0o001400;
+pub const CRDLY: ::tcflag_t = 0o030000;
+pub const TABDLY: ::tcflag_t = 0o006000;
+pub const BSDLY: ::tcflag_t = 0o100000;
+pub const FFDLY: ::tcflag_t = 0o040000;
+pub const VTDLY: ::tcflag_t = 0o200000;
+pub const XTABS: ::tcflag_t = 0o006000;
pub const B0: ::speed_t = 0o000000;
pub const B50: ::speed_t = 0o000001;
diff --git a/libc/src/unix/notbsd/linux/other/b64/sparc64.rs b/libc/src/unix/notbsd/linux/other/b64/sparc64.rs
index 12598e0..487d71b 100644
--- a/libc/src/unix/notbsd/linux/other/b64/sparc64.rs
+++ b/libc/src/unix/notbsd/linux/other/b64/sparc64.rs
@@ -5,6 +5,7 @@ pub type wchar_t = i32;
pub type nlink_t = u32;
pub type blksize_t = i64;
pub type suseconds_t = i32;
+pub type __u64 = ::c_ulonglong;
s! {
pub struct stat {
@@ -97,6 +98,8 @@ pub const O_SYNC: ::c_int = 0x802000;
pub const O_RSYNC: ::c_int = 0x802000;
pub const O_DSYNC: ::c_int = 0x2000;
pub const O_FSYNC: ::c_int = 0x802000;
+pub const O_NOATIME: ::c_int = 0x200000;
+pub const O_PATH: ::c_int = 0x1000000;
pub const MAP_GROWSDOWN: ::c_int = 0x0200;
@@ -182,12 +185,19 @@ pub const ERFKILL: ::c_int = 134;
pub const SOL_SOCKET: ::c_int = 0xffff;
pub const SO_REUSEADDR: ::c_int = 4;
+pub const SO_BINDTODEVICE: ::c_int = 0x000d;
+pub const SO_TIMESTAMP: ::c_int = 0x001d;
+pub const SO_MARK: ::c_int = 0x0022;
+pub const SO_RXQ_OVFL: ::c_int = 0x0024;
+pub const SO_PEEK_OFF: ::c_int = 0x0026;
+pub const SO_BUSY_POLL: ::c_int = 0x0030;
pub const SO_TYPE: ::c_int = 0x1008;
pub const SO_ERROR: ::c_int = 0x1007;
pub const SO_DONTROUTE: ::c_int = 16;
pub const SO_BROADCAST: ::c_int = 32;
pub const SO_SNDBUF: ::c_int = 0x1001;
pub const SO_RCVBUF: ::c_int = 0x1002;
+pub const SO_DOMAIN: ::c_int = 0x1029;
pub const SO_KEEPALIVE: ::c_int = 8;
pub const SO_OOBINLINE: ::c_int = 0x100;
pub const SO_LINGER: ::c_int = 128;
@@ -342,6 +352,17 @@ pub const ISIG: ::tcflag_t = 0x1;
pub const ICANON: ::tcflag_t = 0x2;
pub const PENDIN: ::tcflag_t = 0x4000;
pub const NOFLSH: ::tcflag_t = 0x80;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0x00001000;
+pub const VSWTC: usize = 7;
+pub const OLCUC: ::tcflag_t = 0o000002;
+pub const NLDLY: ::tcflag_t = 0o000400;
+pub const CRDLY: ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY: ::tcflag_t = 0o020000;
+pub const FFDLY: ::tcflag_t = 0o100000;
+pub const VTDLY: ::tcflag_t = 0o040000;
+pub const XTABS: ::tcflag_t = 0o014000;
pub const VEOL: usize = 5;
pub const VEOL2: usize = 6;
diff --git a/libc/src/unix/notbsd/linux/other/b64/x86_64.rs b/libc/src/unix/notbsd/linux/other/b64/x86_64.rs
index b39ccb3..81b2384 100644
--- a/libc/src/unix/notbsd/linux/other/b64/x86_64.rs
+++ b/libc/src/unix/notbsd/linux/other/b64/x86_64.rs
@@ -6,6 +6,7 @@ pub type nlink_t = u64;
pub type blksize_t = i64;
pub type greg_t = i64;
pub type suseconds_t = i64;
+pub type __u64 = ::c_ulonglong;
s! {
pub struct stat {
@@ -50,6 +51,36 @@ s! {
__reserved: [::c_long; 3],
}
+ pub struct statfs64 {
+ pub f_type: ::__fsword_t,
+ pub f_bsize: ::__fsword_t,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_fsid: ::fsid_t,
+ pub f_namelen: ::__fsword_t,
+ pub f_frsize: ::__fsword_t,
+ pub f_flags: ::__fsword_t,
+ pub f_spare: [::__fsword_t; 4],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: u64,
+ pub f_fsid: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ __f_spare: [::c_int; 6],
+ }
+
pub struct pthread_attr_t {
__size: [u64; 7]
}
@@ -78,6 +109,68 @@ s! {
__private: [u64; 12],
}
+ pub struct user_fpregs_struct {
+ pub cwd: ::c_ushort,
+ pub swd: ::c_ushort,
+ pub ftw: ::c_ushort,
+ pub fop: ::c_ushort,
+ pub rip: ::c_ulonglong,
+ pub rdp: ::c_ulonglong,
+ pub mxcsr: ::c_uint,
+ pub mxcr_mask: ::c_uint,
+ pub st_space: [::c_uint; 32],
+ pub xmm_space: [::c_uint; 64],
+ padding: [::c_uint; 24],
+ }
+
+ pub struct user_regs_struct {
+ pub r15: ::c_ulonglong,
+ pub r14: ::c_ulonglong,
+ pub r13: ::c_ulonglong,
+ pub r12: ::c_ulonglong,
+ pub rbp: ::c_ulonglong,
+ pub rbx: ::c_ulonglong,
+ pub r11: ::c_ulonglong,
+ pub r10: ::c_ulonglong,
+ pub r9: ::c_ulonglong,
+ pub r8: ::c_ulonglong,
+ pub rax: ::c_ulonglong,
+ pub rcx: ::c_ulonglong,
+ pub rdx: ::c_ulonglong,
+ pub rsi: ::c_ulonglong,
+ pub rdi: ::c_ulonglong,
+ pub orig_rax: ::c_ulonglong,
+ pub rip: ::c_ulonglong,
+ pub cs: ::c_ulonglong,
+ pub eflags: ::c_ulonglong,
+ pub rsp: ::c_ulonglong,
+ pub ss: ::c_ulonglong,
+ pub fs_base: ::c_ulonglong,
+ pub gs_base: ::c_ulonglong,
+ pub ds: ::c_ulonglong,
+ pub es: ::c_ulonglong,
+ pub fs: ::c_ulonglong,
+ pub gs: ::c_ulonglong,
+ }
+
+ pub struct user {
+ pub regs: user_regs_struct,
+ pub u_fpvalid: ::c_int,
+ pub i387: user_fpregs_struct,
+ pub u_tsize: ::c_ulonglong,
+ pub u_dsize: ::c_ulonglong,
+ pub u_ssize: ::c_ulonglong,
+ pub start_code: ::c_ulonglong,
+ pub start_stack: ::c_ulonglong,
+ pub signal: ::c_longlong,
+ __reserved: ::c_int,
+ pub u_ar0: *mut user_regs_struct,
+ pub u_fpstate: *mut user_fpregs_struct,
+ pub magic: ::c_ulonglong,
+ pub u_comm: [::c_char; 32],
+ pub u_debugreg: [::c_ulonglong; 8],
+ }
+
pub struct mcontext_t {
pub gregs: [greg_t; 23],
pub fpregs: *mut _libc_fpstate,
@@ -136,6 +229,8 @@ pub const O_SYNC: ::c_int = 1052672;
pub const O_RSYNC: ::c_int = 1052672;
pub const O_DSYNC: ::c_int = 4096;
pub const O_FSYNC: ::c_int = 0x101000;
+pub const O_NOATIME: ::c_int = 0o1000000;
+pub const O_PATH: ::c_int = 0o10000000;
pub const MAP_GROWSDOWN: ::c_int = 0x0100;
@@ -251,7 +346,6 @@ pub const SO_DETACH_FILTER: ::c_int = 27;
pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
pub const SO_PEERNAME: ::c_int = 28;
pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
pub const SO_ACCEPTCONN: ::c_int = 30;
pub const SO_PEERSEC: ::c_int = 31;
pub const SO_PASSSEC: ::c_int = 34;
@@ -326,8 +420,6 @@ pub const TIOCMBIC: ::c_ulong = 0x5417;
pub const TIOCMSET: ::c_ulong = 0x5418;
pub const TIOCCONS: ::c_ulong = 0x541D;
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
-
pub const SFD_CLOEXEC: ::c_int = 0x080000;
pub const NCCS: usize = 32;
@@ -383,21 +475,8 @@ pub const PTRACE_GETFPXREGS: ::c_uint = 18;
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;
-
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
@@ -443,6 +522,17 @@ pub const ISIG: ::tcflag_t = 0x00000001;
pub const ICANON: ::tcflag_t = 0x00000002;
pub const PENDIN: ::tcflag_t = 0x00004000;
pub const NOFLSH: ::tcflag_t = 0x00000080;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const VSWTC: usize = 7;
+pub const OLCUC: ::tcflag_t = 0o000002;
+pub const NLDLY: ::tcflag_t = 0o000400;
+pub const CRDLY: ::tcflag_t = 0o003000;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const BSDLY: ::tcflag_t = 0o020000;
+pub const FFDLY: ::tcflag_t = 0o100000;
+pub const VTDLY: ::tcflag_t = 0o040000;
+pub const XTABS: ::tcflag_t = 0o014000;
pub const B0: ::speed_t = 0o000000;
pub const B50: ::speed_t = 0o000001;
@@ -504,6 +594,370 @@ pub const TIOCGWINSZ: ::c_ulong = 0x5413;
pub const TIOCSWINSZ: ::c_ulong = 0x5414;
pub const FIONREAD: ::c_ulong = 0x541B;
+// Syscall table
+
+pub const SYS_read: ::c_long = 0;
+pub const SYS_write: ::c_long = 1;
+pub const SYS_open: ::c_long = 2;
+pub const SYS_close: ::c_long = 3;
+pub const SYS_stat: ::c_long = 4;
+pub const SYS_fstat: ::c_long = 5;
+pub const SYS_lstat: ::c_long = 6;
+pub const SYS_poll: ::c_long = 7;
+pub const SYS_lseek: ::c_long = 8;
+pub const SYS_mmap: ::c_long = 9;
+pub const SYS_mprotect: ::c_long = 10;
+pub const SYS_munmap: ::c_long = 11;
+pub const SYS_brk: ::c_long = 12;
+pub const SYS_rt_sigaction: ::c_long = 13;
+pub const SYS_rt_sigprocmask: ::c_long = 14;
+pub const SYS_rt_sigreturn: ::c_long = 15;
+pub const SYS_ioctl: ::c_long = 16;
+pub const SYS_pread64: ::c_long = 17;
+pub const SYS_pwrite64: ::c_long = 18;
+pub const SYS_readv: ::c_long = 19;
+pub const SYS_writev: ::c_long = 20;
+pub const SYS_access: ::c_long = 21;
+pub const SYS_pipe: ::c_long = 22;
+pub const SYS_select: ::c_long = 23;
+pub const SYS_sched_yield: ::c_long = 24;
+pub const SYS_mremap: ::c_long = 25;
+pub const SYS_msync: ::c_long = 26;
+pub const SYS_mincore: ::c_long = 27;
+pub const SYS_madvise: ::c_long = 28;
+pub const SYS_shmget: ::c_long = 29;
+pub const SYS_shmat: ::c_long = 30;
+pub const SYS_shmctl: ::c_long = 31;
+pub const SYS_dup: ::c_long = 32;
+pub const SYS_dup2: ::c_long = 33;
+pub const SYS_pause: ::c_long = 34;
+pub const SYS_nanosleep: ::c_long = 35;
+pub const SYS_getitimer: ::c_long = 36;
+pub const SYS_alarm: ::c_long = 37;
+pub const SYS_setitimer: ::c_long = 38;
+pub const SYS_getpid: ::c_long = 39;
+pub const SYS_sendfile: ::c_long = 40;
+pub const SYS_socket: ::c_long = 41;
+pub const SYS_connect: ::c_long = 42;
+pub const SYS_accept: ::c_long = 43;
+pub const SYS_sendto: ::c_long = 44;
+pub const SYS_recvfrom: ::c_long = 45;
+pub const SYS_sendmsg: ::c_long = 46;
+pub const SYS_recvmsg: ::c_long = 47;
+pub const SYS_shutdown: ::c_long = 48;
+pub const SYS_bind: ::c_long = 49;
+pub const SYS_listen: ::c_long = 50;
+pub const SYS_getsockname: ::c_long = 51;
+pub const SYS_getpeername: ::c_long = 52;
+pub const SYS_socketpair: ::c_long = 53;
+pub const SYS_setsockopt: ::c_long = 54;
+pub const SYS_getsockopt: ::c_long = 55;
+pub const SYS_clone: ::c_long = 56;
+pub const SYS_fork: ::c_long = 57;
+pub const SYS_vfork: ::c_long = 58;
+pub const SYS_execve: ::c_long = 59;
+pub const SYS_exit: ::c_long = 60;
+pub const SYS_wait4: ::c_long = 61;
+pub const SYS_kill: ::c_long = 62;
+pub const SYS_uname: ::c_long = 63;
+pub const SYS_semget: ::c_long = 64;
+pub const SYS_semop: ::c_long = 65;
+pub const SYS_semctl: ::c_long = 66;
+pub const SYS_shmdt: ::c_long = 67;
+pub const SYS_msgget: ::c_long = 68;
+pub const SYS_msgsnd: ::c_long = 69;
+pub const SYS_msgrcv: ::c_long = 70;
+pub const SYS_msgctl: ::c_long = 71;
+pub const SYS_fcntl: ::c_long = 72;
+pub const SYS_flock: ::c_long = 73;
+pub const SYS_fsync: ::c_long = 74;
+pub const SYS_fdatasync: ::c_long = 75;
+pub const SYS_truncate: ::c_long = 76;
+pub const SYS_ftruncate: ::c_long = 77;
+pub const SYS_getdents: ::c_long = 78;
+pub const SYS_getcwd: ::c_long = 79;
+pub const SYS_chdir: ::c_long = 80;
+pub const SYS_fchdir: ::c_long = 81;
+pub const SYS_rename: ::c_long = 82;
+pub const SYS_mkdir: ::c_long = 83;
+pub const SYS_rmdir: ::c_long = 84;
+pub const SYS_creat: ::c_long = 85;
+pub const SYS_link: ::c_long = 86;
+pub const SYS_unlink: ::c_long = 87;
+pub const SYS_symlink: ::c_long = 88;
+pub const SYS_readlink: ::c_long = 89;
+pub const SYS_chmod: ::c_long = 90;
+pub const SYS_fchmod: ::c_long = 91;
+pub const SYS_chown: ::c_long = 92;
+pub const SYS_fchown: ::c_long = 93;
+pub const SYS_lchown: ::c_long = 94;
+pub const SYS_umask: ::c_long = 95;
+pub const SYS_gettimeofday: ::c_long = 96;
+pub const SYS_getrlimit: ::c_long = 97;
+pub const SYS_getrusage: ::c_long = 98;
+pub const SYS_sysinfo: ::c_long = 99;
+pub const SYS_times: ::c_long = 100;
+pub const SYS_ptrace: ::c_long = 101;
+pub const SYS_getuid: ::c_long = 102;
+pub const SYS_syslog: ::c_long = 103;
+pub const SYS_getgid: ::c_long = 104;
+pub const SYS_setuid: ::c_long = 105;
+pub const SYS_setgid: ::c_long = 106;
+pub const SYS_geteuid: ::c_long = 107;
+pub const SYS_getegid: ::c_long = 108;
+pub const SYS_setpgid: ::c_long = 109;
+pub const SYS_getppid: ::c_long = 110;
+pub const SYS_getpgrp: ::c_long = 111;
+pub const SYS_setsid: ::c_long = 112;
+pub const SYS_setreuid: ::c_long = 113;
+pub const SYS_setregid: ::c_long = 114;
+pub const SYS_getgroups: ::c_long = 115;
+pub const SYS_setgroups: ::c_long = 116;
+pub const SYS_setresuid: ::c_long = 117;
+pub const SYS_getresuid: ::c_long = 118;
+pub const SYS_setresgid: ::c_long = 119;
+pub const SYS_getresgid: ::c_long = 120;
+pub const SYS_getpgid: ::c_long = 121;
+pub const SYS_setfsuid: ::c_long = 122;
+pub const SYS_setfsgid: ::c_long = 123;
+pub const SYS_getsid: ::c_long = 124;
+pub const SYS_capget: ::c_long = 125;
+pub const SYS_capset: ::c_long = 126;
+pub const SYS_rt_sigpending: ::c_long = 127;
+pub const SYS_rt_sigtimedwait: ::c_long = 128;
+pub const SYS_rt_sigqueueinfo: ::c_long = 129;
+pub const SYS_rt_sigsuspend: ::c_long = 130;
+pub const SYS_sigaltstack: ::c_long = 131;
+pub const SYS_utime: ::c_long = 132;
+pub const SYS_mknod: ::c_long = 133;
+pub const SYS_uselib: ::c_long = 134;
+pub const SYS_personality: ::c_long = 135;
+pub const SYS_ustat: ::c_long = 136;
+pub const SYS_statfs: ::c_long = 137;
+pub const SYS_fstatfs: ::c_long = 138;
+pub const SYS_sysfs: ::c_long = 139;
+pub const SYS_getpriority: ::c_long = 140;
+pub const SYS_setpriority: ::c_long = 141;
+pub const SYS_sched_setparam: ::c_long = 142;
+pub const SYS_sched_getparam: ::c_long = 143;
+pub const SYS_sched_setscheduler: ::c_long = 144;
+pub const SYS_sched_getscheduler: ::c_long = 145;
+pub const SYS_sched_get_priority_max: ::c_long = 146;
+pub const SYS_sched_get_priority_min: ::c_long = 147;
+pub const SYS_sched_rr_get_interval: ::c_long = 148;
+pub const SYS_mlock: ::c_long = 149;
+pub const SYS_munlock: ::c_long = 150;
+pub const SYS_mlockall: ::c_long = 151;
+pub const SYS_munlockall: ::c_long = 152;
+pub const SYS_vhangup: ::c_long = 153;
+pub const SYS_modify_ldt: ::c_long = 154;
+pub const SYS_pivot_root: ::c_long = 155;
+pub const SYS__sysctl: ::c_long = 156;
+pub const SYS_prctl: ::c_long = 157;
+pub const SYS_arch_prctl: ::c_long = 158;
+pub const SYS_adjtimex: ::c_long = 159;
+pub const SYS_setrlimit: ::c_long = 160;
+pub const SYS_chroot: ::c_long = 161;
+pub const SYS_sync: ::c_long = 162;
+pub const SYS_acct: ::c_long = 163;
+pub const SYS_settimeofday: ::c_long = 164;
+pub const SYS_mount: ::c_long = 165;
+pub const SYS_umount2: ::c_long = 166;
+pub const SYS_swapon: ::c_long = 167;
+pub const SYS_swapoff: ::c_long = 168;
+pub const SYS_reboot: ::c_long = 169;
+pub const SYS_sethostname: ::c_long = 170;
+pub const SYS_setdomainname: ::c_long = 171;
+pub const SYS_iopl: ::c_long = 172;
+pub const SYS_ioperm: ::c_long = 173;
+pub const SYS_create_module: ::c_long = 174;
+pub const SYS_init_module: ::c_long = 175;
+pub const SYS_delete_module: ::c_long = 176;
+pub const SYS_get_kernel_syms: ::c_long = 177;
+pub const SYS_query_module: ::c_long = 178;
+pub const SYS_quotactl: ::c_long = 179;
+pub const SYS_nfsservctl: ::c_long = 180;
+pub const SYS_getpmsg: ::c_long = 181;
+pub const SYS_putpmsg: ::c_long = 182;
+pub const SYS_afs_syscall: ::c_long = 183;
+pub const SYS_tuxcall: ::c_long = 184;
+pub const SYS_security: ::c_long = 185;
+pub const SYS_gettid: ::c_long = 186;
+pub const SYS_readahead: ::c_long = 187;
+pub const SYS_setxattr: ::c_long = 188;
+pub const SYS_lsetxattr: ::c_long = 189;
+pub const SYS_fsetxattr: ::c_long = 190;
+pub const SYS_getxattr: ::c_long = 191;
+pub const SYS_lgetxattr: ::c_long = 192;
+pub const SYS_fgetxattr: ::c_long = 193;
+pub const SYS_listxattr: ::c_long = 194;
+pub const SYS_llistxattr: ::c_long = 195;
+pub const SYS_flistxattr: ::c_long = 196;
+pub const SYS_removexattr: ::c_long = 197;
+pub const SYS_lremovexattr: ::c_long = 198;
+pub const SYS_fremovexattr: ::c_long = 199;
+pub const SYS_tkill: ::c_long = 200;
+pub const SYS_time: ::c_long = 201;
+pub const SYS_futex: ::c_long = 202;
+pub const SYS_sched_setaffinity: ::c_long = 203;
+pub const SYS_sched_getaffinity: ::c_long = 204;
+pub const SYS_set_thread_area: ::c_long = 205;
+pub const SYS_io_setup: ::c_long = 206;
+pub const SYS_io_destroy: ::c_long = 207;
+pub const SYS_io_getevents: ::c_long = 208;
+pub const SYS_io_submit: ::c_long = 209;
+pub const SYS_io_cancel: ::c_long = 210;
+pub const SYS_get_thread_area: ::c_long = 211;
+pub const SYS_lookup_dcookie: ::c_long = 212;
+pub const SYS_epoll_create: ::c_long = 213;
+pub const SYS_epoll_ctl_old: ::c_long = 214;
+pub const SYS_epoll_wait_old: ::c_long = 215;
+pub const SYS_remap_file_pages: ::c_long = 216;
+pub const SYS_getdents64: ::c_long = 217;
+pub const SYS_set_tid_address: ::c_long = 218;
+pub const SYS_restart_syscall: ::c_long = 219;
+pub const SYS_semtimedop: ::c_long = 220;
+pub const SYS_fadvise64: ::c_long = 221;
+pub const SYS_timer_create: ::c_long = 222;
+pub const SYS_timer_settime: ::c_long = 223;
+pub const SYS_timer_gettime: ::c_long = 224;
+pub const SYS_timer_getoverrun: ::c_long = 225;
+pub const SYS_timer_delete: ::c_long = 226;
+pub const SYS_clock_settime: ::c_long = 227;
+pub const SYS_clock_gettime: ::c_long = 228;
+pub const SYS_clock_getres: ::c_long = 229;
+pub const SYS_clock_nanosleep: ::c_long = 230;
+pub const SYS_exit_group: ::c_long = 231;
+pub const SYS_epoll_wait: ::c_long = 232;
+pub const SYS_epoll_ctl: ::c_long = 233;
+pub const SYS_tgkill: ::c_long = 234;
+pub const SYS_utimes: ::c_long = 235;
+pub const SYS_vserver: ::c_long = 236;
+pub const SYS_mbind: ::c_long = 237;
+pub const SYS_set_mempolicy: ::c_long = 238;
+pub const SYS_get_mempolicy: ::c_long = 239;
+pub const SYS_mq_open: ::c_long = 240;
+pub const SYS_mq_unlink: ::c_long = 241;
+pub const SYS_mq_timedsend: ::c_long = 242;
+pub const SYS_mq_timedreceive: ::c_long = 243;
+pub const SYS_mq_notify: ::c_long = 244;
+pub const SYS_mq_getsetattr: ::c_long = 245;
+pub const SYS_kexec_load: ::c_long = 246;
+pub const SYS_waitid: ::c_long = 247;
+pub const SYS_add_key: ::c_long = 248;
+pub const SYS_request_key: ::c_long = 249;
+pub const SYS_keyctl: ::c_long = 250;
+pub const SYS_ioprio_set: ::c_long = 251;
+pub const SYS_ioprio_get: ::c_long = 252;
+pub const SYS_inotify_init: ::c_long = 253;
+pub const SYS_inotify_add_watch: ::c_long = 254;
+pub const SYS_inotify_rm_watch: ::c_long = 255;
+pub const SYS_migrate_pages: ::c_long = 256;
+pub const SYS_openat: ::c_long = 257;
+pub const SYS_mkdirat: ::c_long = 258;
+pub const SYS_mknodat: ::c_long = 259;
+pub const SYS_fchownat: ::c_long = 260;
+pub const SYS_futimesat: ::c_long = 261;
+pub const SYS_newfstatat: ::c_long = 262;
+pub const SYS_unlinkat: ::c_long = 263;
+pub const SYS_renameat: ::c_long = 264;
+pub const SYS_linkat: ::c_long = 265;
+pub const SYS_symlinkat: ::c_long = 266;
+pub const SYS_readlinkat: ::c_long = 267;
+pub const SYS_fchmodat: ::c_long = 268;
+pub const SYS_faccessat: ::c_long = 269;
+pub const SYS_pselect6: ::c_long = 270;
+pub const SYS_ppoll: ::c_long = 271;
+pub const SYS_unshare: ::c_long = 272;
+pub const SYS_set_robust_list: ::c_long = 273;
+pub const SYS_get_robust_list: ::c_long = 274;
+pub const SYS_splice: ::c_long = 275;
+pub const SYS_tee: ::c_long = 276;
+pub const SYS_sync_file_range: ::c_long = 277;
+pub const SYS_vmsplice: ::c_long = 278;
+pub const SYS_move_pages: ::c_long = 279;
+pub const SYS_utimensat: ::c_long = 280;
+pub const SYS_epoll_pwait: ::c_long = 281;
+pub const SYS_signalfd: ::c_long = 282;
+pub const SYS_timerfd_create: ::c_long = 283;
+pub const SYS_eventfd: ::c_long = 284;
+pub const SYS_fallocate: ::c_long = 285;
+pub const SYS_timerfd_settime: ::c_long = 286;
+pub const SYS_timerfd_gettime: ::c_long = 287;
+pub const SYS_accept4: ::c_long = 288;
+pub const SYS_signalfd4: ::c_long = 289;
+pub const SYS_eventfd2: ::c_long = 290;
+pub const SYS_epoll_create1: ::c_long = 291;
+pub const SYS_dup3: ::c_long = 292;
+pub const SYS_pipe2: ::c_long = 293;
+pub const SYS_inotify_init1: ::c_long = 294;
+pub const SYS_preadv: ::c_long = 295;
+pub const SYS_pwritev: ::c_long = 296;
+pub const SYS_rt_tgsigqueueinfo: ::c_long = 297;
+pub const SYS_perf_event_open: ::c_long = 298;
+pub const SYS_recvmmsg: ::c_long = 299;
+pub const SYS_fanotify_init: ::c_long = 300;
+pub const SYS_fanotify_mark: ::c_long = 301;
+pub const SYS_prlimit64: ::c_long = 302;
+pub const SYS_name_to_handle_at: ::c_long = 303;
+pub const SYS_open_by_handle_at: ::c_long = 304;
+pub const SYS_clock_adjtime: ::c_long = 305;
+pub const SYS_syncfs: ::c_long = 306;
+pub const SYS_sendmmsg: ::c_long = 307;
+pub const SYS_setns: ::c_long = 308;
+pub const SYS_getcpu: ::c_long = 309;
+pub const SYS_process_vm_readv: ::c_long = 310;
+pub const SYS_process_vm_writev: ::c_long = 311;
+pub const SYS_kcmp: ::c_long = 312;
+pub const SYS_finit_module: ::c_long = 313;
+pub const SYS_sched_setattr: ::c_long = 314;
+pub const SYS_sched_getattr: ::c_long = 315;
+pub const SYS_renameat2: ::c_long = 316;
+pub const SYS_seccomp: ::c_long = 317;
+pub const SYS_getrandom: ::c_long = 318;
+pub const SYS_memfd_create: ::c_long = 319;
+pub const SYS_kexec_file_load: ::c_long = 320;
+pub const SYS_bpf: ::c_long = 321;
+pub const SYS_execveat: ::c_long = 322;
+pub const SYS_userfaultfd: ::c_long = 323;
+pub const SYS_membarrier: ::c_long = 324;
+pub const SYS_mlock2: ::c_long = 325;
+pub const SYS_copy_file_range: ::c_long = 326;
+pub const SYS_preadv2: ::c_long = 327;
+pub const SYS_pwritev2: ::c_long = 328;
+pub const SYS_pkey_mprotect: ::c_long = 329;
+pub const SYS_pkey_alloc: ::c_long = 330;
+pub const SYS_pkey_free: ::c_long = 331;
+
+// offsets in user_regs_structs, from sys/reg.h
+pub const R15: ::c_int = 0;
+pub const R14: ::c_int = 1;
+pub const R13: ::c_int = 2;
+pub const R12: ::c_int = 3;
+pub const RBP: ::c_int = 4;
+pub const RBX: ::c_int = 5;
+pub const R11: ::c_int = 6;
+pub const R10: ::c_int = 7;
+pub const R9: ::c_int = 8;
+pub const R8: ::c_int = 9;
+pub const RAX: ::c_int = 10;
+pub const RCX: ::c_int = 11;
+pub const RDX: ::c_int = 12;
+pub const RSI: ::c_int = 13;
+pub const RDI: ::c_int = 14;
+pub const ORIG_RAX: ::c_int = 15;
+pub const RIP: ::c_int = 16;
+pub const CS: ::c_int = 17;
+pub const EFLAGS: ::c_int = 18;
+pub const RSP: ::c_int = 19;
+pub const SS: ::c_int = 20;
+pub const FS_BASE: ::c_int = 21;
+pub const GS_BASE: ::c_int = 22;
+pub const DS: ::c_int = 23;
+pub const ES: ::c_int = 24;
+pub const FS: ::c_int = 25;
+pub const GS: ::c_int = 26;
+
extern {
pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;
pub fn setcontext(ucp: *const ucontext_t) -> ::c_int;
@@ -512,4 +966,7 @@ extern {
argc: ::c_int, ...);
pub fn swapcontext(uocp: *mut ucontext_t,
ucp: *const ucontext_t) -> ::c_int;
+ pub fn iopl(level: ::c_int) -> ::c_int;
+ pub fn ioperm(from: ::c_ulong, num: ::c_ulong,
+ turn_on: ::c_int) -> ::c_int;
}
diff --git a/libc/src/unix/notbsd/linux/other/mod.rs b/libc/src/unix/notbsd/linux/other/mod.rs
index b7a11a8..8b78d32 100644
--- a/libc/src/unix/notbsd/linux/other/mod.rs
+++ b/libc/src/unix/notbsd/linux/other/mod.rs
@@ -269,19 +269,87 @@ pub const SIGWINCH: ::c_int = 28;
pub const SIGEV_THREAD_ID: ::c_int = 4;
-pub const POLLRDNORM: ::c_short = 0x040;
-pub const POLLRDBAND: ::c_short = 0x080;
-
-pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
-pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
-
pub const BUFSIZ: ::c_uint = 8192;
pub const TMP_MAX: ::c_uint = 238328;
pub const FOPEN_MAX: ::c_uint = 16;
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 _SC_EQUIV_CLASS_MAX: ::c_int = 41;
+pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45;
+pub const _SC_PII: ::c_int = 53;
+pub const _SC_PII_XTI: ::c_int = 54;
+pub const _SC_PII_SOCKET: ::c_int = 55;
+pub const _SC_PII_INTERNET: ::c_int = 56;
+pub const _SC_PII_OSI: ::c_int = 57;
+pub const _SC_POLL: ::c_int = 58;
+pub const _SC_SELECT: ::c_int = 59;
+pub const _SC_PII_INTERNET_STREAM: ::c_int = 61;
+pub const _SC_PII_INTERNET_DGRAM: ::c_int = 62;
+pub const _SC_PII_OSI_COTS: ::c_int = 63;
+pub const _SC_PII_OSI_CLTS: ::c_int = 64;
+pub const _SC_PII_OSI_M: ::c_int = 65;
+pub const _SC_T_IOV_MAX: ::c_int = 66;
pub const _SC_2_C_VERSION: ::c_int = 96;
+pub const _SC_CHAR_BIT: ::c_int = 101;
+pub const _SC_CHAR_MAX: ::c_int = 102;
+pub const _SC_CHAR_MIN: ::c_int = 103;
+pub const _SC_INT_MAX: ::c_int = 104;
+pub const _SC_INT_MIN: ::c_int = 105;
+pub const _SC_LONG_BIT: ::c_int = 106;
+pub const _SC_WORD_BIT: ::c_int = 107;
+pub const _SC_MB_LEN_MAX: ::c_int = 108;
+pub const _SC_SSIZE_MAX: ::c_int = 110;
+pub const _SC_SCHAR_MAX: ::c_int = 111;
+pub const _SC_SCHAR_MIN: ::c_int = 112;
+pub const _SC_SHRT_MAX: ::c_int = 113;
+pub const _SC_SHRT_MIN: ::c_int = 114;
+pub const _SC_UCHAR_MAX: ::c_int = 115;
+pub const _SC_UINT_MAX: ::c_int = 116;
+pub const _SC_ULONG_MAX: ::c_int = 117;
+pub const _SC_USHRT_MAX: ::c_int = 118;
+pub const _SC_NL_ARGMAX: ::c_int = 119;
+pub const _SC_NL_LANGMAX: ::c_int = 120;
+pub const _SC_NL_MSGMAX: ::c_int = 121;
+pub const _SC_NL_NMAX: ::c_int = 122;
+pub const _SC_NL_SETMAX: ::c_int = 123;
+pub const _SC_NL_TEXTMAX: ::c_int = 124;
+pub const _SC_BASE: ::c_int = 134;
+pub const _SC_C_LANG_SUPPORT: ::c_int = 135;
+pub const _SC_C_LANG_SUPPORT_R: ::c_int = 136;
+pub const _SC_DEVICE_IO: ::c_int = 140;
+pub const _SC_DEVICE_SPECIFIC: ::c_int = 141;
+pub const _SC_DEVICE_SPECIFIC_R: ::c_int = 142;
+pub const _SC_FD_MGMT: ::c_int = 143;
+pub const _SC_FIFO: ::c_int = 144;
+pub const _SC_PIPE: ::c_int = 145;
+pub const _SC_FILE_ATTRIBUTES: ::c_int = 146;
+pub const _SC_FILE_LOCKING: ::c_int = 147;
+pub const _SC_FILE_SYSTEM: ::c_int = 148;
+pub const _SC_MULTI_PROCESS: ::c_int = 150;
+pub const _SC_SINGLE_PROCESS: ::c_int = 151;
+pub const _SC_NETWORKING: ::c_int = 152;
+pub const _SC_REGEX_VERSION: ::c_int = 156;
+pub const _SC_SIGNALS: ::c_int = 158;
+pub const _SC_SYSTEM_DATABASE: ::c_int = 162;
+pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163;
+pub const _SC_USER_GROUPS: ::c_int = 166;
+pub const _SC_USER_GROUPS_R: ::c_int = 167;
+pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 185;
+pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 186;
+pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 187;
+pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 188;
+pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 189;
+pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 190;
+pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 191;
+pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 192;
+pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 193;
+pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 194;
+pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 195;
+pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 196;
+pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 197;
+pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 198;
+pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 199;
pub const O_ACCMODE: ::c_int = 3;
pub const ST_RELATIME: ::c_ulong = 4096;
pub const NI_MAXHOST: ::socklen_t = 1025;
@@ -342,13 +410,8 @@ pub const PTRACE_INTERRUPT: ::c_uint = 0x4207;
pub const PTRACE_LISTEN: ::c_uint = 0x4208;
pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209;
-pub const MADV_DODUMP: ::c_int = 17;
-pub const MADV_DONTDUMP: ::c_int = 16;
-
pub const EPOLLWAKEUP: ::c_int = 0x20000000;
-pub const MADV_HUGEPAGE: ::c_int = 14;
-pub const MADV_NOHUGEPAGE: ::c_int = 15;
pub const MAP_HUGETLB: ::c_int = 0x040000;
pub const SEEK_DATA: ::c_int = 3;
@@ -443,6 +506,18 @@ 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);
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x008;
+pub const TIOCM_SR: ::c_int = 0x010;
+pub const TIOCM_CTS: ::c_int = 0x020;
+pub const TIOCM_CAR: ::c_int = 0x040;
+pub const TIOCM_RNG: ::c_int = 0x080;
+pub const TIOCM_DSR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+
cfg_if! {
if #[cfg(any(target_arch = "arm", target_arch = "x86",
target_arch = "x86_64"))] {
@@ -500,6 +575,10 @@ extern {
pub fn pthread_setaffinity_np(thread: ::pthread_t,
cpusetsize: ::size_t,
cpuset: *const ::cpu_set_t) -> ::c_int;
+ pub fn pthread_rwlockattr_getkind_np(attr: *const ::pthread_rwlockattr_t,
+ val: *mut ::c_int) -> ::c_int;
+ pub fn pthread_rwlockattr_setkind_np(attr: *mut ::pthread_rwlockattr_t,
+ val: ::c_int) -> ::c_int;
pub fn sched_getcpu() -> ::c_int;
}
diff --git a/libc/src/unix/notbsd/linux/s390x.rs b/libc/src/unix/notbsd/linux/s390x.rs
index 1c0cd56..4f8318a 100644
--- a/libc/src/unix/notbsd/linux/s390x.rs
+++ b/libc/src/unix/notbsd/linux/s390x.rs
@@ -16,6 +16,7 @@ pub type greg_t = u64;
pub type clock_t = i64;
pub type __fsword_t = ::c_long;
pub type __priority_which_t = ::c_uint;
+pub type __u64 = u64;
s! {
pub struct aiocb {
@@ -271,17 +272,47 @@ s! {
__glibc_reserved4: ::c_ulong,
__glibc_reserved5: ::c_ulong,
}
-}
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
+ pub struct statfs64 {
+ pub f_type: ::c_uint,
+ pub f_bsize: ::c_uint,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_fsid: ::fsid_t,
+ pub f_namelen: ::c_uint,
+ pub f_frsize: ::c_uint,
+ pub f_flags: ::c_uint,
+ pub f_spare: [::c_uint; 4],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: u64,
+ pub f_fsid: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ __f_spare: [::c_int; 6],
+ }
+}
pub const SFD_CLOEXEC: ::c_int = 0x080000;
pub const NCCS: usize = 32;
pub const O_TRUNC: ::c_int = 512;
-
+pub const O_LARGEFILE: ::c_int = 0o0100000;
+pub const O_NOATIME: ::c_int = 0o1000000;
pub const O_CLOEXEC: ::c_int = 0x80000;
+pub const O_PATH: ::c_int = 0o10000000;
pub const EBFONT: ::c_int = 59;
pub const ENOSTR: ::c_int = 60;
@@ -314,6 +345,7 @@ pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
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 EADDRINUSE: ::c_int = 98;
pub const EADDRNOTAVAIL: ::c_int = 99;
@@ -349,6 +381,14 @@ pub const SO_ERROR: ::c_int = 4;
pub const SO_RCVTIMEO: ::c_int = 20;
pub const SO_REUSEADDR: ::c_int = 2;
pub const SO_SNDTIMEO: ::c_int = 21;
+pub const SO_BINDTODEVICE: ::c_int = 25;
+pub const SO_TIMESTAMP: ::c_int = 29;
+pub const SO_MARK: ::c_int = 36;
+pub const SO_PROTOCOL: ::c_int = 38;
+pub const SO_DOMAIN: ::c_int = 39;
+pub const SO_RXQ_OVFL: ::c_int = 40;
+pub const SO_PEEK_OFF: ::c_int = 42;
+pub const SO_BUSY_POLL: ::c_int = 46;
pub const RLIMIT_RSS: ::c_int = 5;
pub const RLIMIT_NOFILE: ::c_int = 7;
@@ -489,12 +529,17 @@ pub const SO_SNDBUF: ::c_int = 7;
pub const SO_RCVBUF: ::c_int = 8;
pub const SO_KEEPALIVE: ::c_int = 9;
pub const SO_OOBINLINE: ::c_int = 10;
+pub const SO_PRIORITY: ::c_int = 12;
pub const SO_LINGER: ::c_int = 13;
+pub const SO_BSDCOMPAT: ::c_int = 14;
pub const SO_REUSEPORT: ::c_int = 15;
+pub const SO_PASSCRED: ::c_int = 16;
pub const SO_PEERCRED: ::c_int = 17;
pub const SO_RCVLOWAT: ::c_int = 18;
pub const SO_SNDLOWAT: ::c_int = 19;
pub const SO_ACCEPTCONN: ::c_int = 30;
+pub const SO_SNDBUFFORCE: ::c_int = 32;
+pub const SO_RCVBUFFORCE: ::c_int = 33;
pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15;
pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16;
@@ -530,14 +575,85 @@ pub const SIGPWR: ::c_int = 30;
pub const SIG_BLOCK: ::c_int = 0x000000;
pub const SIG_UNBLOCK: ::c_int = 0x01;
-pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
-pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
-
pub const BUFSIZ: ::c_uint = 8192;
pub const TMP_MAX: ::c_uint = 238328;
pub const FOPEN_MAX: ::c_uint = 16;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
+pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41;
+pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45;
+pub const _SC_PII: ::c_int = 53;
+pub const _SC_PII_XTI: ::c_int = 54;
+pub const _SC_PII_SOCKET: ::c_int = 55;
+pub const _SC_PII_INTERNET: ::c_int = 56;
+pub const _SC_PII_OSI: ::c_int = 57;
+pub const _SC_POLL: ::c_int = 58;
+pub const _SC_SELECT: ::c_int = 59;
+pub const _SC_PII_INTERNET_STREAM: ::c_int = 61;
+pub const _SC_PII_INTERNET_DGRAM: ::c_int = 62;
+pub const _SC_PII_OSI_COTS: ::c_int = 63;
+pub const _SC_PII_OSI_CLTS: ::c_int = 64;
+pub const _SC_PII_OSI_M: ::c_int = 65;
+pub const _SC_T_IOV_MAX: ::c_int = 66;
pub const _SC_2_C_VERSION: ::c_int = 96;
+pub const _SC_CHAR_BIT: ::c_int = 101;
+pub const _SC_CHAR_MAX: ::c_int = 102;
+pub const _SC_CHAR_MIN: ::c_int = 103;
+pub const _SC_INT_MAX: ::c_int = 104;
+pub const _SC_INT_MIN: ::c_int = 105;
+pub const _SC_LONG_BIT: ::c_int = 106;
+pub const _SC_WORD_BIT: ::c_int = 107;
+pub const _SC_MB_LEN_MAX: ::c_int = 108;
+pub const _SC_SSIZE_MAX: ::c_int = 110;
+pub const _SC_SCHAR_MAX: ::c_int = 111;
+pub const _SC_SCHAR_MIN: ::c_int = 112;
+pub const _SC_SHRT_MAX: ::c_int = 113;
+pub const _SC_SHRT_MIN: ::c_int = 114;
+pub const _SC_UCHAR_MAX: ::c_int = 115;
+pub const _SC_UINT_MAX: ::c_int = 116;
+pub const _SC_ULONG_MAX: ::c_int = 117;
+pub const _SC_USHRT_MAX: ::c_int = 118;
+pub const _SC_NL_ARGMAX: ::c_int = 119;
+pub const _SC_NL_LANGMAX: ::c_int = 120;
+pub const _SC_NL_MSGMAX: ::c_int = 121;
+pub const _SC_NL_NMAX: ::c_int = 122;
+pub const _SC_NL_SETMAX: ::c_int = 123;
+pub const _SC_NL_TEXTMAX: ::c_int = 124;
+pub const _SC_BASE: ::c_int = 134;
+pub const _SC_C_LANG_SUPPORT: ::c_int = 135;
+pub const _SC_C_LANG_SUPPORT_R: ::c_int = 136;
+pub const _SC_DEVICE_IO: ::c_int = 140;
+pub const _SC_DEVICE_SPECIFIC: ::c_int = 141;
+pub const _SC_DEVICE_SPECIFIC_R: ::c_int = 142;
+pub const _SC_FD_MGMT: ::c_int = 143;
+pub const _SC_FIFO: ::c_int = 144;
+pub const _SC_PIPE: ::c_int = 145;
+pub const _SC_FILE_ATTRIBUTES: ::c_int = 146;
+pub const _SC_FILE_LOCKING: ::c_int = 147;
+pub const _SC_FILE_SYSTEM: ::c_int = 148;
+pub const _SC_MULTI_PROCESS: ::c_int = 150;
+pub const _SC_SINGLE_PROCESS: ::c_int = 151;
+pub const _SC_NETWORKING: ::c_int = 152;
+pub const _SC_REGEX_VERSION: ::c_int = 156;
+pub const _SC_SIGNALS: ::c_int = 158;
+pub const _SC_SYSTEM_DATABASE: ::c_int = 162;
+pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163;
+pub const _SC_USER_GROUPS: ::c_int = 166;
+pub const _SC_USER_GROUPS_R: ::c_int = 167;
+pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 185;
+pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 186;
+pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 187;
+pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 188;
+pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 189;
+pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 190;
+pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 191;
+pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 192;
+pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 193;
+pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 194;
+pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 195;
+pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 196;
+pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 197;
+pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 198;
+pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 199;
pub const O_ASYNC: ::c_int = 0x2000;
pub const O_NDELAY: ::c_int = 0x800;
pub const ST_RELATIME: ::c_ulong = 4096;
@@ -612,13 +728,8 @@ pub const PTRACE_INTERRUPT: ::c_uint = 0x4207;
pub const PTRACE_LISTEN: ::c_uint = 0x4208;
pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209;
-pub const MADV_DODUMP: ::c_int = 17;
-pub const MADV_DONTDUMP: ::c_int = 16;
-
pub const EPOLLWAKEUP: ::c_int = 0x20000000;
-pub const MADV_HUGEPAGE: ::c_int = 14;
-pub const MADV_NOHUGEPAGE: ::c_int = 15;
pub const MAP_HUGETLB: ::c_int = 0x040000;
pub const EFD_NONBLOCK: ::c_int = 0x800;
@@ -689,8 +800,116 @@ pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4;
pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2;
pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
+pub const SYS_pivot_root: ::c_long = 217;
pub const SYS_gettid: ::c_long = 236;
pub const SYS_perf_event_open: ::c_long = 331;
+pub const SYS_memfd_create: ::c_long = 350;
+
+pub const VTIME: usize = 5;
+pub const VSWTC: usize = 7;
+pub const VSTART: usize = 8;
+pub const VSTOP: usize = 9;
+pub const VSUSP: usize = 10;
+pub const VREPRINT: usize = 12;
+pub const VDISCARD: usize = 13;
+pub const VWERASE: usize = 14;
+pub const OLCUC: ::tcflag_t = 0o000002;
+pub const ONLCR: ::tcflag_t = 0o000004;
+pub const NLDLY: ::tcflag_t = 0o000400;
+pub const CRDLY: ::tcflag_t = 0o003000;
+pub const CR1: ::tcflag_t = 0x00000200;
+pub const CR2: ::tcflag_t = 0x00000400;
+pub const CR3: ::tcflag_t = 0x00000600;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const TAB1: ::tcflag_t = 0x00000800;
+pub const TAB2: ::tcflag_t = 0x00001000;
+pub const TAB3: ::tcflag_t = 0x00001800;
+pub const BSDLY: ::tcflag_t = 0o020000;
+pub const BS1: ::tcflag_t = 0x00002000;
+pub const FFDLY: ::tcflag_t = 0o100000;
+pub const FF1: ::tcflag_t = 0x00008000;
+pub const VTDLY: ::tcflag_t = 0o040000;
+pub const VT1: ::tcflag_t = 0x00004000;
+pub const XTABS: ::tcflag_t = 0o014000;
+
+pub const TIOCM_LE: ::c_int = 0x001;
+pub const TIOCM_DTR: ::c_int = 0x002;
+pub const TIOCM_RTS: ::c_int = 0x004;
+pub const TIOCM_ST: ::c_int = 0x008;
+pub const TIOCM_SR: ::c_int = 0x010;
+pub const TIOCM_CTS: ::c_int = 0x020;
+pub const TIOCM_CAR: ::c_int = 0x040;
+pub const TIOCM_RNG: ::c_int = 0x080;
+pub const TIOCM_DSR: ::c_int = 0x100;
+pub const TIOCM_CD: ::c_int = TIOCM_CAR;
+pub const TIOCM_RI: ::c_int = TIOCM_RNG;
+
+pub const SIGEV_THREAD_ID: ::c_int = 4;
+
+pub const CBAUD: ::speed_t = 0o010017;
+pub const B0: ::speed_t = 0o000000;
+pub const B50: ::speed_t = 0o000001;
+pub const B75: ::speed_t = 0o000002;
+pub const B110: ::speed_t = 0o000003;
+pub const B134: ::speed_t = 0o000004;
+pub const B150: ::speed_t = 0o000005;
+pub const B200: ::speed_t = 0o000006;
+pub const B300: ::speed_t = 0o000007;
+pub const B600: ::speed_t = 0o000010;
+pub const B1200: ::speed_t = 0o000011;
+pub const B1800: ::speed_t = 0o000012;
+pub const B2400: ::speed_t = 0o000013;
+pub const B4800: ::speed_t = 0o000014;
+pub const B9600: ::speed_t = 0o000015;
+pub const B19200: ::speed_t = 0o000016;
+pub const B38400: ::speed_t = 0o000017;
+pub const EXTA: ::speed_t = B19200;
+pub const EXTB: ::speed_t = B38400;
+pub const CSIZE: ::tcflag_t = 0o000060;
+pub const CS6: ::tcflag_t = 0o000020;
+pub const CS7: ::tcflag_t = 0o000040;
+pub const CS8: ::tcflag_t = 0o000060;
+pub const CSTOPB: ::tcflag_t = 0o000100;
+pub const CREAD: ::tcflag_t = 0o000200;
+pub const PARENB: ::tcflag_t = 0o000400;
+pub const PARODD: ::tcflag_t = 0o001000;
+pub const HUPCL: ::tcflag_t = 0o002000;
+pub const CLOCAL: ::tcflag_t = 0o004000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const B57600: ::speed_t = 0o010001;
+pub const B115200: ::speed_t = 0o010002;
+pub const B230400: ::speed_t = 0o010003;
+pub const B460800: ::speed_t = 0o010004;
+pub const B500000: ::speed_t = 0o010005;
+pub const B576000: ::speed_t = 0o010006;
+pub const B921600: ::speed_t = 0o010007;
+pub const B1000000: ::speed_t = 0o010010;
+pub const B1152000: ::speed_t = 0o010011;
+pub const B1500000: ::speed_t = 0o010012;
+pub const B2000000: ::speed_t = 0o010013;
+pub const B2500000: ::speed_t = 0o010014;
+pub const B3000000: ::speed_t = 0o010015;
+pub const B3500000: ::speed_t = 0o010016;
+pub const B4000000: ::speed_t = 0o010017;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+
+pub const ISIG: ::tcflag_t = 0o000001;
+pub const ICANON: ::tcflag_t = 0o000002;
+pub const XCASE: ::tcflag_t = 0o000004;
+pub const ECHOE: ::tcflag_t = 0o000020;
+pub const ECHOK: ::tcflag_t = 0o000040;
+pub const ECHONL: ::tcflag_t = 0o000100;
+pub const NOFLSH: ::tcflag_t = 0o000200;
+pub const ECHOCTL: ::tcflag_t = 0o001000;
+pub const ECHOPRT: ::tcflag_t = 0o002000;
+pub const ECHOKE: ::tcflag_t = 0o004000;
+pub const PENDIN: ::tcflag_t = 0o040000;
+
+pub const POLLWRNORM: ::c_short = 0x004;
+pub const POLLWRBAND: ::c_short = 0x100;
+
+pub const IXON: ::tcflag_t = 0o002000;
+pub const IXOFF: ::tcflag_t = 0o010000;
#[link(name = "util")]
extern {
diff --git a/libc/src/unix/notbsd/mod.rs b/libc/src/unix/notbsd/mod.rs
index b20d043..66437de 100644
--- a/libc/src/unix/notbsd/mod.rs
+++ b/libc/src/unix/notbsd/mod.rs
@@ -4,7 +4,6 @@ pub type sa_family_t = u16;
pub type pthread_key_t = ::c_uint;
pub type speed_t = ::c_uint;
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;
@@ -103,13 +102,13 @@ s! {
pub struct sched_param {
pub sched_priority: ::c_int,
- #[cfg(any(target_env = "musl"))]
+ #[cfg(any(target_env = "musl", target_os = "emscripten"))]
pub sched_ss_low_priority: ::c_int,
- #[cfg(any(target_env = "musl"))]
+ #[cfg(any(target_env = "musl", target_os = "emscripten"))]
pub sched_ss_repl_period: ::timespec,
- #[cfg(any(target_env = "musl"))]
+ #[cfg(any(target_env = "musl", target_os = "emscripten"))]
pub sched_ss_init_budget: ::timespec,
- #[cfg(any(target_env = "musl"))]
+ #[cfg(any(target_env = "musl", target_os = "emscripten"))]
pub sched_ss_max_repl: ::c_int,
}
@@ -212,9 +211,17 @@ pub const F_SETFL: ::c_int = 4;
pub const F_SETLEASE: ::c_int = 1024;
pub const F_GETLEASE: ::c_int = 1025;
pub const F_NOTIFY: ::c_int = 1026;
+pub const F_CANCELLK: ::c_int = 1029;
pub const F_DUPFD_CLOEXEC: ::c_int = 1030;
pub const F_SETPIPE_SZ: ::c_int = 1031;
pub const F_GETPIPE_SZ: ::c_int = 1032;
+pub const F_ADD_SEALS: ::c_int = 1033;
+pub const F_GET_SEALS: ::c_int = 1034;
+
+pub const F_SEAL_SEAL: ::c_int = 0x0001;
+pub const F_SEAL_SHRINK: ::c_int = 0x0002;
+pub const F_SEAL_GROW: ::c_int = 0x0004;
+pub const F_SEAL_WRITE: ::c_int = 0x0008;
// TODO(#235): Include file sealing fcntls once we have a way to verify them.
@@ -223,20 +230,20 @@ pub const SIGTRAP: ::c_int = 5;
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
-pub const CLOCK_REALTIME: clockid_t = 0;
-pub const CLOCK_MONOTONIC: clockid_t = 1;
-pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2;
-pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3;
-pub const CLOCK_MONOTONIC_RAW: clockid_t = 4;
-pub const CLOCK_REALTIME_COARSE: clockid_t = 5;
-pub const CLOCK_MONOTONIC_COARSE: clockid_t = 6;
-pub const CLOCK_BOOTTIME: clockid_t = 7;
-pub const CLOCK_REALTIME_ALARM: clockid_t = 8;
-pub const CLOCK_BOOTTIME_ALARM: clockid_t = 9;
+pub const CLOCK_REALTIME: ::clockid_t = 0;
+pub const CLOCK_MONOTONIC: ::clockid_t = 1;
+pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2;
+pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3;
+pub const CLOCK_MONOTONIC_RAW: ::clockid_t = 4;
+pub const CLOCK_REALTIME_COARSE: ::clockid_t = 5;
+pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6;
+pub const CLOCK_BOOTTIME: ::clockid_t = 7;
+pub const CLOCK_REALTIME_ALARM: ::clockid_t = 8;
+pub const CLOCK_BOOTTIME_ALARM: ::clockid_t = 9;
// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep
// 2014.) See also musl/mod.rs
-// pub const CLOCK_SGI_CYCLE: clockid_t = 10;
-// pub const CLOCK_TAI: clockid_t = 11;
+// pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
+// pub const CLOCK_TAI: ::clockid_t = 11;
pub const TIMER_ABSTIME: ::c_int = 1;
pub const RLIMIT_CPU: ::c_int = 0;
@@ -255,7 +262,6 @@ pub const RUSAGE_SELF: ::c_int = 0;
pub const O_RDONLY: ::c_int = 0;
pub const O_WRONLY: ::c_int = 1;
pub const O_RDWR: ::c_int = 2;
-pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
@@ -411,12 +417,18 @@ pub const MADV_RANDOM: ::c_int = 1;
pub const MADV_SEQUENTIAL: ::c_int = 2;
pub const MADV_WILLNEED: ::c_int = 3;
pub const MADV_DONTNEED: ::c_int = 4;
+pub const MADV_FREE: ::c_int = 8;
pub const MADV_REMOVE: ::c_int = 9;
pub const MADV_DONTFORK: ::c_int = 10;
pub const MADV_DOFORK: ::c_int = 11;
pub const MADV_MERGEABLE: ::c_int = 12;
pub const MADV_UNMERGEABLE: ::c_int = 13;
+pub const MADV_HUGEPAGE: ::c_int = 14;
+pub const MADV_NOHUGEPAGE: ::c_int = 15;
+pub const MADV_DONTDUMP: ::c_int = 16;
+pub const MADV_DODUMP: ::c_int = 17;
pub const MADV_HWPOISON: ::c_int = 100;
+pub const MADV_SOFT_OFFLINE: ::c_int = 101;
pub const IFF_UP: ::c_int = 0x1;
pub const IFF_BROADCAST: ::c_int = 0x2;
@@ -437,6 +449,7 @@ pub const IFF_DYNAMIC: ::c_int = 0x8000;
pub const SOL_IP: ::c_int = 0;
pub const SOL_TCP: ::c_int = 6;
+pub const SOL_UDP: ::c_int = 17;
pub const SOL_IPV6: ::c_int = 41;
pub const SOL_ICMPV6: ::c_int = 58;
pub const SOL_RAW: ::c_int = 255;
@@ -553,12 +566,11 @@ pub const MSG_WAITFORONE: ::c_int = 0x10000;
pub const MSG_FASTOPEN: ::c_int = 0x20000000;
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
+pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
+
pub const SOCK_RAW: ::c_int = 3;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-pub const IPPROTO_TCP: ::c_int = 6;
-pub const IPPROTO_IP: ::c_int = 0;
-pub const IPPROTO_IPV6: ::c_int = 41;
+pub const SOCK_RDM: ::c_int = 4;
+pub const IP_MULTICAST_IF: ::c_int = 32;
pub const IP_MULTICAST_TTL: ::c_int = 33;
pub const IP_MULTICAST_LOOP: ::c_int = 34;
pub const IP_TTL: ::c_int = 2;
@@ -675,11 +687,15 @@ pub const IGNCR: ::tcflag_t = 0x00000080;
pub const ICRNL: ::tcflag_t = 0x00000100;
pub const IXANY: ::tcflag_t = 0x00000800;
pub const IMAXBEL: ::tcflag_t = 0x00002000;
-pub const IUTF8: ::tcflag_t = 0x00004000;
pub const OPOST: ::tcflag_t = 0x1;
pub const CS5: ::tcflag_t = 0x00000000;
pub const CRTSCTS: ::tcflag_t = 0x80000000;
pub const ECHO: ::tcflag_t = 0x00000008;
+pub const OCRNL: ::tcflag_t = 0o000010;
+pub const ONOCR: ::tcflag_t = 0o000020;
+pub const ONLRET: ::tcflag_t = 0o000040;
+pub const OFILL: ::tcflag_t = 0o000100;
+pub const OFDEL: ::tcflag_t = 0o000200;
pub const CLONE_VM: ::c_int = 0x100;
pub const CLONE_FS: ::c_int = 0x200;
@@ -703,6 +719,7 @@ pub const CLONE_NEWUSER: ::c_int = 0x10000000;
pub const CLONE_NEWPID: ::c_int = 0x20000000;
pub const CLONE_NEWNET: ::c_int = 0x40000000;
pub const CLONE_IO: ::c_int = 0x80000000;
+pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
pub const WNOHANG: ::c_int = 0x00000001;
pub const WUNTRACED: ::c_int = 0x00000002;
@@ -711,6 +728,30 @@ pub const WEXITED: ::c_int = 0x00000004;
pub const WCONTINUED: ::c_int = 0x00000008;
pub const WNOWAIT: ::c_int = 0x01000000;
+// Options set using PTRACE_SETOPTIONS.
+pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001;
+pub const PTRACE_O_TRACEFORK: ::c_int = 0x00000002;
+pub const PTRACE_O_TRACEVFORK: ::c_int = 0x00000004;
+pub const PTRACE_O_TRACECLONE: ::c_int = 0x00000008;
+pub const PTRACE_O_TRACEEXEC: ::c_int = 0x00000010;
+pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 0x00000020;
+pub const PTRACE_O_TRACEEXIT: ::c_int = 0x00000040;
+pub const PTRACE_O_TRACESECCOMP: ::c_int = 0x00000080;
+pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000;
+pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000;
+pub const PTRACE_O_MASK: ::c_int = 0x003000ff;
+
+// Wait extended result codes for the above trace options.
+pub const PTRACE_EVENT_FORK: ::c_int = 1;
+pub const PTRACE_EVENT_VFORK: ::c_int = 2;
+pub const PTRACE_EVENT_CLONE: ::c_int = 3;
+pub const PTRACE_EVENT_EXEC: ::c_int = 4;
+pub const PTRACE_EVENT_VFORK_DONE: ::c_int = 5;
+pub const PTRACE_EVENT_EXIT: ::c_int = 6;
+pub const PTRACE_EVENT_SECCOMP: ::c_int = 7;
+// PTRACE_EVENT_STOP was added to glibc in 2.26
+// pub const PTRACE_EVENT_STOP: ::c_int = 128;
+
pub const __WNOTHREAD: ::c_int = 0x20000000;
pub const __WALL: ::c_int = 0x40000000;
pub const __WCLONE: ::c_int = 0x80000000;
@@ -754,6 +795,9 @@ pub const P_PGID: idtype_t = 2;
pub const UTIME_OMIT: c_long = 1073741822;
pub const UTIME_NOW: c_long = 1073741823;
+pub const POLLRDNORM: ::c_short = 0x040;
+pub const POLLRDBAND: ::c_short = 0x080;
+
f! {
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
let fd = fd as usize;
@@ -815,90 +859,32 @@ f! {
}
extern {
- pub fn getpwnam_r(name: *const ::c_char,
- pwd: *mut passwd,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut passwd) -> ::c_int;
- pub fn getpwuid_r(uid: ::uid_t,
- pwd: *mut passwd,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut passwd) -> ::c_int;
pub fn fdatasync(fd: ::c_int) -> ::c_int;
pub fn mincore(addr: *mut ::c_void, len: ::size_t,
vec: *mut ::c_uchar) -> ::c_int;
- pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_nanosleep(clk_id: clockid_t,
- flags: ::c_int,
- rqtp: *const ::timespec,
- rmtp: *mut ::timespec) -> ::c_int;
- pub fn clock_settime(clk_id: clockid_t, tp: *const ::timespec) -> ::c_int;
- pub fn prctl(option: ::c_int, ...) -> ::c_int;
+ pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
+ pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
+
pub fn pthread_getattr_np(native: ::pthread_t,
attr: *mut ::pthread_attr_t) -> ::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 memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
pub fn setgroups(ngroups: ::size_t,
ptr: *const ::gid_t) -> ::c_int;
- pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
- pub fn sched_setscheduler(pid: ::pid_t,
- policy: ::c_int,
- param: *const sched_param) -> ::c_int;
- pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
- pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
- pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
- pub fn epoll_create(size: ::c_int) -> ::c_int;
- pub fn epoll_create1(flags: ::c_int) -> ::c_int;
- pub fn epoll_ctl(epfd: ::c_int,
- op: ::c_int,
- fd: ::c_int,
- event: *mut epoll_event) -> ::c_int;
- pub fn epoll_wait(epfd: ::c_int,
- events: *mut epoll_event,
- maxevents: ::c_int,
- timeout: ::c_int) -> ::c_int;
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
- pub fn mount(src: *const ::c_char,
- target: *const ::c_char,
- fstype: *const ::c_char,
- flags: ::c_ulong,
- data: *const ::c_void) -> ::c_int;
- pub fn umount(target: *const ::c_char) -> ::c_int;
- pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int;
- pub fn clone(cb: extern fn(*mut ::c_void) -> ::c_int,
- child_stack: *mut ::c_void,
- flags: ::c_int,
- arg: *mut ::c_void, ...) -> ::c_int;
pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
+ pub fn statfs64(path: *const ::c_char, buf: *mut statfs64) -> ::c_int;
pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
+ pub fn fstatfs64(fd: ::c_int, buf: *mut statfs64) -> ::c_int;
+ pub fn statvfs64(path: *const ::c_char, buf: *mut statvfs64) -> ::c_int;
+ pub fn fstatvfs64(fd: ::c_int, buf: *mut statvfs64) -> ::c_int;
pub fn memrchr(cx: *const ::c_void,
c: ::c_int,
n: ::size_t) -> *mut ::c_void;
- pub fn syscall(num: ::c_long, ...) -> ::c_long;
- pub fn sendfile(out_fd: ::c_int,
- in_fd: ::c_int,
- offset: *mut off_t,
- count: ::size_t) -> ::ssize_t;
- pub fn splice(fd_in: ::c_int,
- off_in: *mut ::loff_t,
- fd_out: ::c_int,
- off_out: *mut ::loff_t,
- len: ::size_t,
- flags: ::c_uint) -> ::ssize_t;
- pub fn tee(fd_in: ::c_int,
- fd_out: ::c_int,
- len: ::size_t,
- flags: ::c_uint) -> ::ssize_t;
- pub fn vmsplice(fd: ::c_int,
- iov: *const ::iovec,
- nr_segs: ::size_t,
- flags: ::c_uint) -> ::ssize_t;
pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t,
advise: ::c_int) -> ::c_int;
@@ -938,55 +924,62 @@ extern {
pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int;
pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int;
- pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
- pub fn sysinfo (info: *mut ::sysinfo) -> ::c_int;
pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
mode: ::mode_t, dev: dev_t) -> ::c_int;
- pub fn ppoll(fds: *mut ::pollfd,
- nfds: nfds_t,
- timeout: *const ::timespec,
- sigmask: *const sigset_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;
+ clock_id: ::clockid_t) -> ::c_int;
pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
pshared: ::c_int) -> ::c_int;
- pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
- pshared: *mut ::c_int) -> ::c_int;
- pub fn sched_getaffinity(pid: ::pid_t,
- cpusetsize: ::size_t,
- cpuset: *mut cpu_set_t) -> ::c_int;
- pub fn sched_setaffinity(pid: ::pid_t,
- cpusetsize: ::size_t,
- cpuset: *const cpu_set_t) -> ::c_int;
- pub fn unshare(flags: ::c_int) -> ::c_int;
- pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int;
- pub fn sem_timedwait(sem: *mut sem_t,
- 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 pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t,
pshared: ::c_int) -> ::c_int;
- pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
- pshared: *mut ::c_int) -> ::c_int;
+ pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
+ val: *mut ::c_int) -> ::c_int;
+ pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
+ val: ::c_int) -> ::c_int;
pub fn ptsname_r(fd: ::c_int,
buf: *mut ::c_char,
buflen: ::size_t) -> ::c_int;
pub fn clearenv() -> ::c_int;
pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t,
options: ::c_int) -> ::c_int;
+ pub fn setreuid(ruid: ::uid_t, euid: ::uid_t) -> ::c_int;
+ pub fn setregid(rgid: ::gid_t, egid: ::gid_t) -> ::c_int;
+ pub fn getresuid(ruid: *mut ::uid_t, euid: *mut ::uid_t,
+ suid: *mut ::uid_t) -> ::c_int;
+ pub fn getresgid(rgid: *mut ::gid_t, egid: *mut ::gid_t,
+ sgid: *mut ::gid_t) -> ::c_int;
+ pub fn acct(filename: *const ::c_char) -> ::c_int;
+ pub fn brk(addr: *mut ::c_void) -> ::c_int;
+ pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void;
+ pub fn vfork() -> ::pid_t;
+ pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
+ pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
+ pub fn wait4(pid: ::pid_t, status: *mut ::c_int, options: ::c_int,
+ rusage: *mut ::rusage) -> ::pid_t;
+ pub fn openpty(amaster: *mut ::c_int,
+ aslave: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *const termios,
+ winp: *const ::winsize) -> ::c_int;
+ pub fn execvpe(file: *const ::c_char, argv: *const *const ::c_char,
+ envp: *const *const ::c_char) -> ::c_int;
+ pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
+ envp: *const *const ::c_char)
+ -> ::c_int;
}
cfg_if! {
- if #[cfg(any(target_os = "linux",
- target_os = "emscripten",
- target_os = "fuchsia"))] {
+ if #[cfg(target_os = "emscripten")] {
+ mod emscripten;
+ pub use self::emscripten::*;
+ } else if #[cfg(any(target_os = "linux", target_os = "fuchsia"))] {
mod linux;
pub use self::linux::*;
} else if #[cfg(target_os = "android")] {
@@ -996,3 +989,8 @@ cfg_if! {
// Unknown target_os
}
}
+ // pub fn forkpty(amaster: *mut ::c_int,
+ // name: *mut ::c_char,
+ // termp: *const termios,
+ // winp: *const ::winsize) -> ::pid_t;
+ // pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
diff --git a/libc/src/unix/solaris/mod.rs b/libc/src/unix/solaris/mod.rs
index 757d581..4461a79 100644
--- a/libc/src/unix/solaris/mod.rs
+++ b/libc/src/unix/solaris/mod.rs
@@ -169,6 +169,10 @@ s! {
__pthread_rwlock_writercv: ::pthread_cond_t
}
+ pub struct pthread_rwlockattr_t {
+ __pthread_rwlockattrp: *mut ::c_void,
+ }
+
pub struct dirent {
pub d_ino: ::ino_t,
pub d_off: ::off_t,
@@ -204,6 +208,8 @@ s! {
pub ai_family: ::c_int,
pub ai_socktype: ::c_int,
pub ai_protocol: ::c_int,
+ #[cfg(target_arch = "sparc64")]
+ __sparcv9_pad: ::c_int,
pub ai_addrlen: ::socklen_t,
pub ai_canonname: *mut ::c_char,
pub ai_addr: *mut ::sockaddr,
@@ -766,39 +772,10 @@ pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
pub const POSIX_MADV_WILLNEED: ::c_int = 3;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
-pub const _SC_IOV_MAX: ::c_int = 77;
-pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 569;
-pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 570;
-pub const _SC_LOGIN_NAME_MAX: ::c_int = 571;
-pub const _SC_MQ_PRIO_MAX: ::c_int = 30;
-pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 577;
-pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 578;
-pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 568;
-pub const _SC_THREAD_KEYS_MAX: ::c_int = 572;
-pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 580;
-pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 581;
-pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 579;
-pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 582;
-pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 583;
-pub const _SC_THREAD_STACK_MIN: ::c_int = 573;
-pub const _SC_THREAD_THREADS_MAX: ::c_int = 574;
-pub const _SC_THREADS: ::c_int = 576;
-pub const _SC_TTY_NAME_MAX: ::c_int = 575;
-pub const _SC_ATEXIT_MAX: ::c_int = 76;
-pub const _SC_XOPEN_CRYPT: ::c_int = 62;
-pub const _SC_XOPEN_ENH_I18N: ::c_int = 63;
-pub const _SC_XOPEN_LEGACY: ::c_int = 717;
-pub const _SC_XOPEN_REALTIME: ::c_int = 718;
-pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 719;
-pub const _SC_XOPEN_SHM: ::c_int = 64;
-pub const _SC_XOPEN_UNIX: ::c_int = 78;
-pub const _SC_XOPEN_VERSION: ::c_int = 12;
-pub const _SC_XOPEN_XCU_VERSION: ::c_int = 67;
-
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 0x40;
pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
-pub const PTHREAD_PROCESS_PRIVATE: u16 = 0;
+pub const PTHREAD_PROCESS_PRIVATE: ::c_ushort = 0;
pub const PTHREAD_STACK_MIN: ::size_t = 4096;
pub const SIGSTKSZ: ::size_t = 8192;
@@ -813,8 +790,8 @@ pub const SIGSTKSZ: ::size_t = 8192;
// blob/HEAD/usr/src/uts/common/sys/time_impl.h
// Confusing! CLOCK_HIGHRES==CLOCK_MONOTONIC==4
// __CLOCK_REALTIME0==0 is an obsoleted version of CLOCK_REALTIME==3
-pub const CLOCK_REALTIME: clockid_t = 3;
-pub const CLOCK_MONOTONIC: clockid_t = 4;
+pub const CLOCK_REALTIME: ::clockid_t = 3;
+pub const CLOCK_MONOTONIC: ::clockid_t = 4;
pub const TIMER_RELTIME: ::c_int = 0;
pub const TIMER_ABSTIME: ::c_int = 1;
@@ -848,11 +825,6 @@ pub const SOCK_STREAM: ::c_int = 2;
pub const SOCK_RAW: ::c_int = 4;
pub const SOCK_RDM: ::c_int = 5;
pub const SOCK_SEQPACKET: ::c_int = 6;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-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 = 17;
pub const IP_MULTICAST_LOOP: ::c_int = 18;
pub const IP_TTL: ::c_int = 4;
@@ -905,6 +877,37 @@ pub const O_NONBLOCK: ::c_int = 128;
pub const IPPROTO_RAW: ::c_int = 255;
+pub const _PC_LINK_MAX: ::c_int = 1;
+pub const _PC_MAX_CANON: ::c_int = 2;
+pub const _PC_MAX_INPUT: ::c_int = 3;
+pub const _PC_NAME_MAX: ::c_int = 4;
+pub const _PC_PATH_MAX: ::c_int = 5;
+pub const _PC_PIPE_BUF: ::c_int = 6;
+pub const _PC_NO_TRUNC: ::c_int = 7;
+pub const _PC_VDISABLE: ::c_int = 8;
+pub const _PC_CHOWN_RESTRICTED: ::c_int = 9;
+pub const _PC_ASYNC_IO: ::c_int = 10;
+pub const _PC_PRIO_IO: ::c_int = 11;
+pub const _PC_SYNC_IO: ::c_int = 12;
+pub const _PC_ALLOC_SIZE_MIN: ::c_int = 13;
+pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 14;
+pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 15;
+pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 16;
+pub const _PC_REC_XFER_ALIGN: ::c_int = 17;
+pub const _PC_SYMLINK_MAX: ::c_int = 18;
+pub const _PC_2_SYMLINKS: ::c_int = 19;
+pub const _PC_ACL_ENABLED: ::c_int = 20;
+pub const _PC_MIN_HOLE_SIZE: ::c_int = 21;
+pub const _PC_CASE_BEHAVIOR: ::c_int = 22;
+pub const _PC_SATTR_ENABLED: ::c_int = 23;
+pub const _PC_SATTR_EXISTS: ::c_int = 24;
+pub const _PC_ACCESS_FILTERING: ::c_int = 25;
+pub const _PC_TIMESTAMP_RESOLUTION: ::c_int = 26;
+pub const _PC_FILESIZEBITS: ::c_int = 67;
+pub const _PC_XATTR_ENABLED: ::c_int = 100;
+pub const _PC_LAST: ::c_int = 101;
+pub const _PC_XATTR_EXISTS: ::c_int = 101;
+
pub const _SC_ARG_MAX: ::c_int = 1;
pub const _SC_CHILD_MAX: ::c_int = 2;
pub const _SC_CLK_TCK: ::c_int = 3;
@@ -913,52 +916,148 @@ pub const _SC_OPEN_MAX: ::c_int = 5;
pub const _SC_JOB_CONTROL: ::c_int = 6;
pub const _SC_SAVED_IDS: ::c_int = 7;
pub const _SC_VERSION: ::c_int = 8;
+pub const _SC_PASS_MAX: ::c_int = 9;
+pub const _SC_LOGNAME_MAX: ::c_int = 10;
pub const _SC_PAGESIZE: ::c_int = 11;
pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
+pub const _SC_XOPEN_VERSION: ::c_int = 12;
+pub const _SC_NPROCESSORS_CONF: ::c_int = 14;
pub const _SC_NPROCESSORS_ONLN: ::c_int = 15;
pub const _SC_STREAM_MAX: ::c_int = 16;
pub const _SC_TZNAME_MAX: ::c_int = 17;
pub const _SC_AIO_LISTIO_MAX: ::c_int = 18;
pub const _SC_AIO_MAX: ::c_int = 19;
-pub const _SC_BC_BASE_MAX: ::c_int = 54;
-pub const _SC_BC_DIM_MAX: ::c_int = 55;
-pub const _SC_BC_SCALE_MAX: ::c_int = 56;
-pub const _SC_BC_STRING_MAX: ::c_int = 57;
-pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 58;
-pub const _SC_EXPR_NEST_MAX: ::c_int = 59;
-pub const _SC_LINE_MAX: ::c_int = 60;
-pub const _SC_RE_DUP_MAX: ::c_int = 61;
-pub const _SC_2_VERSION: ::c_int = 53;
-pub const _SC_2_C_BIND: ::c_int = 45;
-pub const _SC_2_C_DEV: ::c_int = 46;
-pub const _SC_2_CHAR_TERM: ::c_int = 66;
-pub const _SC_2_FORT_DEV: ::c_int = 48;
-pub const _SC_2_FORT_RUN: ::c_int = 49;
-pub const _SC_2_LOCALEDEF: ::c_int = 50;
-pub const _SC_2_SW_DEV: ::c_int = 51;
-pub const _SC_2_UPE: ::c_int = 52;
+pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 20;
pub const _SC_ASYNCHRONOUS_IO: ::c_int = 21;
+pub const _SC_DELAYTIMER_MAX: ::c_int = 22;
+pub const _SC_FSYNC: ::c_int = 23;
pub const _SC_MAPPED_FILES: ::c_int = 24;
pub const _SC_MEMLOCK: ::c_int = 25;
pub const _SC_MEMLOCK_RANGE: ::c_int = 26;
pub const _SC_MEMORY_PROTECTION: ::c_int = 27;
pub const _SC_MESSAGE_PASSING: ::c_int = 28;
+pub const _SC_MQ_OPEN_MAX: ::c_int = 29;
+pub const _SC_MQ_PRIO_MAX: ::c_int = 30;
pub const _SC_PRIORITIZED_IO: ::c_int = 31;
pub const _SC_PRIORITY_SCHEDULING: ::c_int = 32;
pub const _SC_REALTIME_SIGNALS: ::c_int = 33;
-pub const _SC_SEMAPHORES: ::c_int = 35;
-pub const _SC_FSYNC: ::c_int = 23;
-pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 38;
-pub const _SC_SYNCHRONIZED_IO: ::c_int = 42;
-pub const _SC_TIMERS: ::c_int = 43;
-pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 20;
-pub const _SC_DELAYTIMER_MAX: ::c_int = 22;
-pub const _SC_MQ_OPEN_MAX: ::c_int = 29;
pub const _SC_RTSIG_MAX: ::c_int = 34;
+pub const _SC_SEMAPHORES: ::c_int = 35;
pub const _SC_SEM_NSEMS_MAX: ::c_int = 36;
pub const _SC_SEM_VALUE_MAX: ::c_int = 37;
+pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 38;
pub const _SC_SIGQUEUE_MAX: ::c_int = 39;
+pub const _SC_SIGRT_MIN: ::c_int = 40;
+pub const _SC_SIGRT_MAX: ::c_int = 41;
+pub const _SC_SYNCHRONIZED_IO: ::c_int = 42;
+pub const _SC_TIMERS: ::c_int = 43;
pub const _SC_TIMER_MAX: ::c_int = 44;
+pub const _SC_2_C_BIND: ::c_int = 45;
+pub const _SC_2_C_DEV: ::c_int = 46;
+pub const _SC_2_C_VERSION: ::c_int = 47;
+pub const _SC_2_FORT_DEV: ::c_int = 48;
+pub const _SC_2_FORT_RUN: ::c_int = 49;
+pub const _SC_2_LOCALEDEF: ::c_int = 50;
+pub const _SC_2_SW_DEV: ::c_int = 51;
+pub const _SC_2_UPE: ::c_int = 52;
+pub const _SC_2_VERSION: ::c_int = 53;
+pub const _SC_BC_BASE_MAX: ::c_int = 54;
+pub const _SC_BC_DIM_MAX: ::c_int = 55;
+pub const _SC_BC_SCALE_MAX: ::c_int = 56;
+pub const _SC_BC_STRING_MAX: ::c_int = 57;
+pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 58;
+pub const _SC_EXPR_NEST_MAX: ::c_int = 59;
+pub const _SC_LINE_MAX: ::c_int = 60;
+pub const _SC_RE_DUP_MAX: ::c_int = 61;
+pub const _SC_XOPEN_CRYPT: ::c_int = 62;
+pub const _SC_XOPEN_ENH_I18N: ::c_int = 63;
+pub const _SC_XOPEN_SHM: ::c_int = 64;
+pub const _SC_2_CHAR_TERM: ::c_int = 66;
+pub const _SC_XOPEN_XCU_VERSION: ::c_int = 67;
+pub const _SC_ATEXIT_MAX: ::c_int = 76;
+pub const _SC_IOV_MAX: ::c_int = 77;
+pub const _SC_XOPEN_UNIX: ::c_int = 78;
+pub const _SC_T_IOV_MAX: ::c_int = 79;
+pub const _SC_PHYS_PAGES: ::c_int = 500;
+pub const _SC_AVPHYS_PAGES: ::c_int = 501;
+pub const _SC_COHER_BLKSZ: ::c_int = 503;
+pub const _SC_SPLIT_CACHE: ::c_int = 504;
+pub const _SC_ICACHE_SZ: ::c_int = 505;
+pub const _SC_DCACHE_SZ: ::c_int = 506;
+pub const _SC_ICACHE_LINESZ: ::c_int = 507;
+pub const _SC_DCACHE_LINESZ: ::c_int = 508;
+pub const _SC_ICACHE_BLKSZ: ::c_int = 509;
+pub const _SC_DCACHE_BLKSZ: ::c_int = 510;
+pub const _SC_DCACHE_TBLKSZ: ::c_int = 511;
+pub const _SC_ICACHE_ASSOC: ::c_int = 512;
+pub const _SC_DCACHE_ASSOC: ::c_int = 513;
+pub const _SC_MAXPID: ::c_int = 514;
+pub const _SC_STACK_PROT: ::c_int = 515;
+pub const _SC_NPROCESSORS_MAX: ::c_int = 516;
+pub const _SC_CPUID_MAX: ::c_int = 517;
+pub const _SC_EPHID_MAX: ::c_int = 518;
+pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 568;
+pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 569;
+pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 570;
+pub const _SC_LOGIN_NAME_MAX: ::c_int = 571;
+pub const _SC_THREAD_KEYS_MAX: ::c_int = 572;
+pub const _SC_THREAD_STACK_MIN: ::c_int = 573;
+pub const _SC_THREAD_THREADS_MAX: ::c_int = 574;
+pub const _SC_TTY_NAME_MAX: ::c_int = 575;
+pub const _SC_THREADS: ::c_int = 576;
+pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 577;
+pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 578;
+pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 579;
+pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 580;
+pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 581;
+pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 582;
+pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 583;
+pub const _SC_XOPEN_LEGACY: ::c_int = 717;
+pub const _SC_XOPEN_REALTIME: ::c_int = 718;
+pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 719;
+pub const _SC_XBS5_ILP32_OFF32: ::c_int = 720;
+pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 721;
+pub const _SC_XBS5_LP64_OFF64: ::c_int = 722;
+pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 723;
+pub const _SC_2_PBS: ::c_int = 724;
+pub const _SC_2_PBS_ACCOUNTING: ::c_int = 725;
+pub const _SC_2_PBS_CHECKPOINT: ::c_int = 726;
+pub const _SC_2_PBS_LOCATE: ::c_int = 728;
+pub const _SC_2_PBS_MESSAGE: ::c_int = 729;
+pub const _SC_2_PBS_TRACK: ::c_int = 730;
+pub const _SC_ADVISORY_INFO: ::c_int = 731;
+pub const _SC_BARRIERS: ::c_int = 732;
+pub const _SC_CLOCK_SELECTION: ::c_int = 733;
+pub const _SC_CPUTIME: ::c_int = 734;
+pub const _SC_HOST_NAME_MAX: ::c_int = 735;
+pub const _SC_MONOTONIC_CLOCK: ::c_int = 736;
+pub const _SC_READER_WRITER_LOCKS: ::c_int = 737;
+pub const _SC_REGEXP: ::c_int = 738;
+pub const _SC_SHELL: ::c_int = 739;
+pub const _SC_SPAWN: ::c_int = 740;
+pub const _SC_SPIN_LOCKS: ::c_int = 741;
+pub const _SC_SPORADIC_SERVER: ::c_int = 742;
+pub const _SC_SS_REPL_MAX: ::c_int = 743;
+pub const _SC_SYMLOOP_MAX: ::c_int = 744;
+pub const _SC_THREAD_CPUTIME: ::c_int = 745;
+pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 746;
+pub const _SC_TIMEOUTS: ::c_int = 747;
+pub const _SC_TRACE: ::c_int = 748;
+pub const _SC_TRACE_EVENT_FILTER: ::c_int = 749;
+pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 750;
+pub const _SC_TRACE_INHERIT: ::c_int = 751;
+pub const _SC_TRACE_LOG: ::c_int = 752;
+pub const _SC_TRACE_NAME_MAX: ::c_int = 753;
+pub const _SC_TRACE_SYS_MAX: ::c_int = 754;
+pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 755;
+pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 756;
+pub const _SC_V6_ILP32_OFF32: ::c_int = 757;
+pub const _SC_V6_ILP32_OFFBIG: ::c_int = 758;
+pub const _SC_V6_LP64_OFF64: ::c_int = 759;
+pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 760;
+pub const _SC_XOPEN_STREAMS: ::c_int = 761;
+pub const _SC_IPV6: ::c_int = 762;
+pub const _SC_RAW_SOCKETS: ::c_int = 763;
pub const _MUTEX_MAGIC: u16 = 0x4d58; // MX
pub const _COND_MAGIC: u16 = 0x4356; // CV
@@ -1074,13 +1173,13 @@ extern {
pub fn ioctl(fildes: ::c_int, request: ::c_int, ...) -> ::c_int;
pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int)
-> ::c_int;
- pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_nanosleep(clk_id: clockid_t,
+ pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_nanosleep(clk_id: ::clockid_t,
flags: ::c_int,
rqtp: *const ::timespec,
rmtp: *mut ::timespec) -> ::c_int;
- pub fn clock_settime(clk_id: clockid_t, tp: *const ::timespec) -> ::c_int;
+ pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
pub fn getnameinfo(sa: *const ::sockaddr,
salen: ::socklen_t,
host: *mut ::c_char,
@@ -1088,20 +1187,8 @@ extern {
serv: *mut ::c_char,
sevlen: ::socklen_t,
flags: ::c_int) -> ::c_int;
- #[link_name = "__posix_getpwnam_r"]
- pub fn getpwnam_r(name: *const ::c_char,
- pwd: *mut passwd,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut passwd) -> ::c_int;
-
- #[link_name = "__posix_getpwuid_r"]
- pub fn getpwuid_r(uid: ::uid_t,
- pwd: *mut passwd,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut passwd) -> ::c_int;
pub fn setpwent();
+ pub fn endpwent();
pub fn getpwent() -> *mut passwd;
pub fn fdatasync(fd: ::c_int) -> ::c_int;
pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
@@ -1129,7 +1216,7 @@ extern {
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;
+ 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,
@@ -1191,4 +1278,62 @@ extern {
pub fn port_getn(port: ::c_int, pe_list: *mut port_event, max: ::c_uint,
nget: *mut ::c_uint, timeout: *const ::timespec)
-> ::c_int;
+ pub fn fexecve(fd: ::c_int, argv: *const *const ::c_char,
+ envp: *const *const ::c_char)
+ -> ::c_int;
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
+ pub fn getgrgid_r(uid: ::uid_t,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "sigaltstack$UNIX2003")]
+ #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
+ pub fn sigaltstack(ss: *const stack_t,
+ oss: *mut stack_t) -> ::c_int;
+ pub fn sem_close(sem: *mut sem_t) -> ::c_int;
+ pub fn getdtablesize() -> ::c_int;
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
+ pub fn getgrnam_r(name: *const ::c_char,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_sigmask$UNIX2003")]
+ pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
+ oldset: *mut sigset_t) -> ::c_int;
+ pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
+ pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+ pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+ pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
+ pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
+ pub fn getpwnam_r(name: *const ::c_char,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
+ pub fn getpwuid_r(uid: ::uid_t,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
+ link_name = "sigwait$UNIX2003")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+ pub fn sigwait(set: *const sigset_t,
+ sig: *mut ::c_int) -> ::c_int;
+ pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+ parent: Option<unsafe extern fn()>,
+ child: Option<unsafe extern fn()>) -> ::c_int;
+ pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "popen$UNIX2003")]
+ pub fn popen(command: *const c_char,
+ mode: *const c_char) -> *mut ::FILE;
}
diff --git a/libc/src/unix/uclibc/mod.rs b/libc/src/unix/uclibc/mod.rs
index 076ee41..6d32127 100644
--- a/libc/src/unix/uclibc/mod.rs
+++ b/libc/src/unix/uclibc/mod.rs
@@ -11,7 +11,7 @@ pub type id_t = ::c_uint;
pub type useconds_t = u32;
pub type dev_t = u64;
pub type socklen_t = u32;
-pub type pthread_t = c_ulong;
+pub type pthread_t = ::c_ulong;
pub type mode_t = u32;
pub type ino64_t = u64;
pub type off64_t = i64;
@@ -257,6 +257,11 @@ s! {
size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
}
+ pub struct pthread_rwlockattr_t {
+ __lockkind: ::c_int,
+ __pshared: ::c_int,
+ }
+
pub struct pthread_cond_t {
__align: [::c_longlong; 0],
size: [u8; __SIZEOF_PTHREAD_COND_T],
@@ -418,14 +423,14 @@ pub const SIGTRAP: ::c_int = 5;
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
-pub const CLOCK_REALTIME: clockid_t = 0;
-pub const CLOCK_MONOTONIC: clockid_t = 1;
-pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2;
-pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3;
+pub const CLOCK_REALTIME: ::clockid_t = 0;
+pub const CLOCK_MONOTONIC: ::clockid_t = 1;
+pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2;
+pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3;
// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep
// 2014.) See also musl/mod.rs
-// pub const CLOCK_SGI_CYCLE: clockid_t = 10;
-// pub const CLOCK_TAI: clockid_t = 11;
+// pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
+// pub const CLOCK_TAI: ::clockid_t = 11;
pub const TIMER_ABSTIME: ::c_int = 1;
pub const RLIMIT_CPU: ::c_int = 0;
@@ -720,11 +725,6 @@ pub const MSG_WAITFORONE: ::c_int = 0x10000;
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
pub const SOCK_RAW: ::c_int = 3;
-pub const IPPROTO_ICMP: ::c_int = 1;
-pub const IPPROTO_ICMPV6: ::c_int = 58;
-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 = 33;
pub const IP_MULTICAST_LOOP: ::c_int = 34;
pub const IP_TTL: ::c_int = 2;
@@ -732,6 +732,9 @@ pub const IP_HDRINCL: ::c_int = 3;
pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
+pub const IPV6_JOIN_GROUP: ::c_int = 20;
+pub const IPV6_LEAVE_GROUP: ::c_int = 21;
+
pub const TCP_NODELAY: ::c_int = 1;
pub const TCP_MAXSEG: ::c_int = 2;
pub const TCP_CORK: ::c_int = 3;
@@ -1419,26 +1422,16 @@ f! {
}
extern {
- pub fn getpwnam_r(name: *const ::c_char,
- pwd: *mut passwd,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut passwd) -> ::c_int;
- pub fn getpwuid_r(uid: ::uid_t,
- pwd: *mut passwd,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut passwd) -> ::c_int;
pub fn fdatasync(fd: ::c_int) -> ::c_int;
pub fn mincore(addr: *mut ::c_void, len: ::size_t,
vec: *mut ::c_uchar) -> ::c_int;
- pub fn clock_getres(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_gettime(clk_id: clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_nanosleep(clk_id: clockid_t,
+ pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_nanosleep(clk_id: ::clockid_t,
flags: ::c_int,
rqtp: *const ::timespec,
rmtp: *mut ::timespec) -> ::c_int;
- pub fn clock_settime(clk_id: clockid_t, tp: *const ::timespec) -> ::c_int;
+ pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
pub fn prctl(option: ::c_int, ...) -> ::c_int;
pub fn pthread_getattr_np(native: ::pthread_t,
attr: *mut ::pthread_attr_t) -> ::c_int;
@@ -1453,7 +1446,7 @@ extern {
pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
pub fn sched_setscheduler(pid: ::pid_t,
policy: ::c_int,
- param: *const sched_param) -> ::c_int;
+ param: *const ::sched_param) -> ::c_int;
pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
@@ -1462,9 +1455,9 @@ extern {
pub fn epoll_ctl(epfd: ::c_int,
op: ::c_int,
fd: ::c_int,
- event: *mut epoll_event) -> ::c_int;
+ event: *mut ::epoll_event) -> ::c_int;
pub fn epoll_wait(epfd: ::c_int,
- events: *mut epoll_event,
+ events: *mut ::epoll_event,
maxevents: ::c_int,
timeout: ::c_int) -> ::c_int;
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
@@ -1555,7 +1548,7 @@ extern {
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;
+ clock_id: ::clockid_t) -> ::c_int;
pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t,
pshared: ::c_int) -> ::c_int;
pub fn pthread_condattr_getpshared(attr: *const pthread_condattr_t,
@@ -1577,6 +1570,14 @@ extern {
pshared: ::c_int) -> ::c_int;
pub fn pthread_mutexattr_getpshared(attr: *const pthread_mutexattr_t,
pshared: *mut ::c_int) -> ::c_int;
+ pub fn pthread_rwlockattr_getkind_np(attr: *const pthread_rwlockattr_t,
+ val: *mut ::c_int) -> ::c_int;
+ pub fn pthread_rwlockattr_setkind_np(attr: *mut pthread_rwlockattr_t,
+ val: ::c_int) -> ::c_int;
+ pub fn pthread_rwlockattr_getpshared(attr: *const pthread_rwlockattr_t,
+ val: *mut ::c_int) -> ::c_int;
+ pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t,
+ val: ::c_int) -> ::c_int;
pub fn ptsname_r(fd: ::c_int,
buf: *mut ::c_char,
buflen: ::size_t) -> ::c_int;
@@ -1587,6 +1588,7 @@ extern {
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
pub fn setpwent();
+ pub fn endpwent();
pub fn getpwent() -> *mut passwd;
pub fn setspent();
pub fn endspent();
@@ -1753,14 +1755,71 @@ extern {
flags: ::c_int) -> ::ssize_t;
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int)
-> ::ssize_t;
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
+ pub fn getgrgid_r(uid: ::uid_t,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "sigaltstack$UNIX2003")]
+ #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
+ pub fn sigaltstack(ss: *const stack_t,
+ oss: *mut stack_t) -> ::c_int;
+ pub fn sem_close(sem: *mut sem_t) -> ::c_int;
+ pub fn getdtablesize() -> ::c_int;
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
+ pub fn getgrnam_r(name: *const ::c_char,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "pthread_sigmask$UNIX2003")]
+ pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t,
+ oldset: *mut sigset_t) -> ::c_int;
+ pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
+ pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+ pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
+ pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
+ pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
+ pub fn getpwnam_r(name: *const ::c_char,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
+ pub fn getpwuid_r(uid: ::uid_t,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd) -> ::c_int;
+ #[cfg_attr(all(target_os = "macos", target_arch ="x86"),
+ link_name = "sigwait$UNIX2003")]
+ #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+ pub fn sigwait(set: *const sigset_t,
+ sig: *mut ::c_int) -> ::c_int;
+ pub fn pthread_atfork(prepare: Option<unsafe extern fn()>,
+ parent: Option<unsafe extern fn()>,
+ child: Option<unsafe extern fn()>) -> ::c_int;
+ pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86"),
+ link_name = "popen$UNIX2003")]
+ pub fn popen(command: *const c_char,
+ mode: *const c_char) -> *mut ::FILE;
}
cfg_if! {
if #[cfg(target_arch = "mips")] {
mod mips;
pub use self::mips::*;
+ } else if #[cfg(target_arch = "x86_64")] {
+ mod x86_64;
+ pub use self::x86_64::*;
} else {
pub use unsupported_target;
}
}
-
diff --git a/libc/src/unix/uclibc/x86_64/l4re.rs b/libc/src/unix/uclibc/x86_64/l4re.rs
new file mode 100644
index 0000000..f047a82
--- /dev/null
+++ b/libc/src/unix/uclibc/x86_64/l4re.rs
@@ -0,0 +1,46 @@
+/// L4Re specifics
+/// This module contains definitions required by various L4Re libc backends.
+/// Some of them are formally not part of the libc, but are a dependency of the
+/// libc and hence we should provide them here.
+
+pub type l4_umword_t = ::c_ulong; // Unsigned machine word.
+
+s! {
+ /// CPU sets.
+ pub struct l4_sched_cpu_set_t {
+ // from the L4Re docs
+ /// Combination of granularity and offset.
+ ///
+ /// The granularity defines how many CPUs each bit in map describes.
+ /// The offset is the numer of the first CPU described by the first
+ /// bit in the bitmap.
+ /// offset must be a multiple of 2^graularity.
+ ///
+ /// | MSB | LSB |
+ /// | ---------------- | ------------------- |
+ /// | 8bit granularity | 24bit offset .. |
+ gran_offset: l4_umword_t ,
+ /// Bitmap of CPUs.
+ map: l4_umword_t ,
+ }
+}
+
+#[cfg(target_os = "l4re")]
+pub struct pthread_attr_t {
+ pub __detachstate: ::c_int,
+ pub __schedpolicy: ::c_int,
+ pub __schedparam: super::__sched_param,
+ pub __inheritsched: ::c_int,
+ pub __scope: ::c_int,
+ pub __guardsize: ::size_t,
+ pub __stackaddr_set: ::c_int,
+ pub __stackaddr: *mut ::c_void, // better don't use it
+ pub __stacksize: ::size_t,
+ // L4Re specifics
+ pub affinity: l4_sched_cpu_set_t,
+ pub create_flags: ::c_uint,
+}
+
+// L4Re requires a min stack size of 64k; that isn't defined in uClibc, but
+// somewhere in the core libraries. uClibc wants 16k, but that's not enough.
+pub const PTHREAD_STACK_MIN: usize = 65536;
diff --git a/libc/src/unix/uclibc/x86_64/mod.rs b/libc/src/unix/uclibc/x86_64/mod.rs
new file mode 100644
index 0000000..29cefca
--- /dev/null
+++ b/libc/src/unix/uclibc/x86_64/mod.rs
@@ -0,0 +1,349 @@
+//! Definitions for uclibc on 64bit systems
+//!
+pub type blkcnt_t = i64;
+pub type blksize_t = i64;
+pub type clock_t = i64;
+pub type c_char = u8;
+pub type c_long = i64;
+pub type c_ulong = u64;
+pub type fsblkcnt_t = ::c_ulong;
+pub type fsfilcnt_t = ::c_ulong;
+pub type fsword_t = ::c_long;
+pub type ino_t = ::c_ulong;
+pub type nlink_t = ::c_uint;
+pub type off_t = ::c_long;
+pub type rlim_t = c_ulong;
+pub type rlim64_t = u64;
+// [uClibc docs] Note stat64 has the same shape as stat for x86-64.
+pub type stat64 = stat;
+pub type suseconds_t = ::c_long;
+pub type time_t = ::c_int;
+pub type wchar_t = ::c_int;
+
+pub type nfds_t = ::c_ulong;
+
+s! {
+ pub struct dirent {
+ pub d_ino: ::ino64_t,
+ pub d_off: ::off64_t,
+ pub d_reclen: u16,
+ pub d_type: u8,
+ pub d_name: [::c_char; 256],
+ }
+
+ pub struct dirent64 {
+ pub d_ino: ::ino64_t,
+ pub d_off: ::off64_t,
+ pub d_reclen: u16,
+ pub d_type: u8,
+ pub d_name: [::c_char; 256],
+ }
+
+ pub struct ipc_perm {
+ pub __key: ::key_t,
+ pub uid: ::uid_t,
+ pub gid: ::gid_t,
+ pub cuid: ::uid_t,
+ pub cgid: ::gid_t,
+ pub mode: ::c_ushort, // read / write
+ __pad1: ::c_ushort,
+ pub __seq: ::c_ushort,
+ __pad2: ::c_ushort,
+ __unused1: ::c_ulong,
+ __unused2: ::c_ulong
+ }
+
+ #[cfg(not(target_os = "l4re"))]
+ pub struct pthread_attr_t {
+ __detachstate: ::c_int,
+ __schedpolicy: ::c_int,
+ __schedparam: __sched_param,
+ __inheritsched: ::c_int,
+ __scope: ::c_int,
+ __guardsize: ::size_t,
+ __stackaddr_set: ::c_int,
+ __stackaddr: *mut ::c_void, // better don't use it
+ __stacksize: ::size_t,
+ }
+
+ pub struct __sched_param {
+ __sched_priority: ::c_int,
+ }
+
+ pub struct siginfo_t {
+ si_signo: ::c_int, // signal number
+ si_errno: ::c_int, // if not zero: error value of signal, see errno.h
+ si_code: ::c_int, // signal code
+ pub _pad: [::c_int; 28], // unported union
+ _align: [usize; 0],
+ }
+
+ pub struct shmid_ds {
+ pub shm_perm: ::ipc_perm,
+ pub shm_segsz: ::size_t, // segment size in bytes
+ pub shm_atime: ::time_t, // time of last shmat()
+ pub shm_dtime: ::time_t,
+ pub shm_ctime: ::time_t,
+ pub shm_cpid: ::pid_t,
+ pub shm_lpid: ::pid_t,
+ pub shm_nattch: ::shmatt_t,
+ __unused1: ::c_ulong,
+ __unused2: ::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,
+ __ignored1: ::c_ulong,
+ __ignored2: ::c_ulong,
+ }
+
+ pub struct sockaddr {
+ pub sa_family: ::sa_family_t,
+ pub sa_data: [::c_char; 14],
+ }
+
+ pub struct sockaddr_in {
+ pub sin_family: ::sa_family_t,
+ pub sin_port: ::in_port_t,
+ pub sin_addr: ::in_addr,
+ pub sin_zero: [u8; 8],
+ }
+
+ pub struct sockaddr_in6 {
+ 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,
+ }
+
+ // ------------------------------------------------------------
+ // definitions below are *unverified* and might **break** the software
+// pub struct in_addr {
+// pub s_addr: in_addr_t,
+// }
+//
+// pub struct in6_addr {
+// pub s6_addr: [u8; 16],
+// __align: [u32; 0],
+// }
+
+ pub struct stat {
+ pub st_dev: ::c_ulong,
+ pub st_ino: ::ino_t,
+ // According to uclibc/libc/sysdeps/linux/x86_64/bits/stat.h, order of
+ // nlink and mode are swapped on 64 bit systems.
+ pub st_nlink: ::nlink_t,
+ pub st_mode: ::mode_t,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub st_rdev: ::c_ulong, // dev_t
+ pub st_size: off_t, // file size
+ pub st_blksize: ::blksize_t,
+ pub st_blocks: ::blkcnt_t,
+ pub st_atime: ::time_t,
+ pub st_atime_nsec: ::c_ulong,
+ pub st_mtime: ::time_t,
+ pub st_mtime_nsec: ::c_ulong,
+ pub st_ctime: ::time_t,
+ pub st_ctime_nsec: ::c_ulong,
+ st_pad4: [::c_long; 3]
+ }
+
+ pub struct sigaction {
+ pub sa_handler: ::sighandler_t,
+ pub sa_flags: ::c_ulong,
+ pub sa_restorer: *mut ::c_void,
+ pub sa_mask: ::sigset_t,
+ }
+
+ pub struct stack_t { // ToDo
+ pub ss_sp: *mut ::c_void,
+ pub ss_flags: ::c_int,
+ pub ss_size: ::size_t
+ }
+
+ pub struct statfs { // ToDo
+ pub f_type: fsword_t,
+ pub f_bsize: fsword_t,
+ 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_fsid: ::fsid_t,
+ pub f_namelen: fsword_t,
+ pub f_frsize: fsword_t,
+ f_spare: [fsword_t; 5],
+ }
+
+ pub struct msghdr { // ToDo
+ pub msg_name: *mut ::c_void,
+ pub msg_namelen: ::socklen_t,
+ pub msg_iov: *mut ::iovec,
+ pub msg_iovlen: ::size_t,
+ pub msg_control: *mut ::c_void,
+ pub msg_controllen: ::size_t,
+ pub msg_flags: ::c_int,
+ }
+
+ pub struct termios { // ToDo
+ pub c_iflag: ::tcflag_t,
+ pub c_oflag: ::tcflag_t,
+ pub c_cflag: ::tcflag_t,
+ pub c_lflag: ::tcflag_t,
+ pub c_line: ::cc_t,
+ pub c_cc: [::cc_t; ::NCCS],
+ }
+
+ pub struct sem_t { // ToDo
+ #[cfg(target_pointer_width = "32")]
+ __size: [::c_char; 16],
+ #[cfg(target_pointer_width = "64")]
+ __size: [::c_char; 32],
+ __align: [::c_long; 0],
+ }
+
+ pub struct pthread_mutex_t { // ToDo
+ #[cfg(any(target_arch = "mips", target_arch = "arm",
+ target_arch = "powerpc"))]
+ __align: [::c_long; 0],
+ #[cfg(not(any(target_arch = "mips", target_arch = "arm",
+ target_arch = "powerpc")))]
+ __align: [::c_longlong; 0],
+ size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
+ }
+
+ 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",
+ target_arch = "mips64", target_arch = "s390x",
+ target_arch = "sparc64")))]
+ __align: [::c_long; 0],
+ size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
+ }
+
+ pub struct pthread_cond_t { // ToDo
+ __align: [::c_longlong; 0],
+ size: [u8; __SIZEOF_PTHREAD_COND_T],
+ }
+
+ pub struct pthread_condattr_t { // ToDo
+ __align: [::c_int; 0],
+ size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
+ }
+
+ pub struct pthread_rwlock_t { // ToDo
+ #[cfg(any(target_arch = "mips", target_arch = "arm",
+ target_arch = "powerpc"))]
+ __align: [::c_long; 0],
+ #[cfg(not(any(target_arch = "mips", target_arch = "arm",
+ target_arch = "powerpc")))]
+ __align: [::c_longlong; 0],
+ size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
+ }
+
+ pub struct sigset_t { // ToDo
+ __val: [::c_ulong; 16],
+ }
+
+ pub struct sysinfo { // ToDo
+ pub uptime: ::c_long,
+ pub loads: [::c_ulong; 3],
+ pub totalram: ::c_ulong,
+ pub freeram: ::c_ulong,
+ pub sharedram: ::c_ulong,
+ pub bufferram: ::c_ulong,
+ pub totalswap: ::c_ulong,
+ pub freeswap: ::c_ulong,
+ pub procs: ::c_ushort,
+ pub pad: ::c_ushort,
+ pub totalhigh: ::c_ulong,
+ pub freehigh: ::c_ulong,
+ pub mem_unit: ::c_uint,
+ pub _f: [::c_char; 0],
+ }
+
+ pub struct glob_t { // ToDo
+ pub gl_pathc: ::size_t,
+ pub gl_pathv: *mut *mut c_char,
+ pub gl_offs: ::size_t,
+ pub gl_flags: ::c_int,
+ __unused1: *mut ::c_void,
+ __unused2: *mut ::c_void,
+ __unused3: *mut ::c_void,
+ __unused4: *mut ::c_void,
+ __unused5: *mut ::c_void,
+ }
+
+ pub struct rlimit64 { // ToDo
+ pub rlim_cur: rlim64_t,
+ pub rlim_max: rlim64_t,
+ }
+
+ pub struct cpu_set_t { // ToDo
+ #[cfg(target_pointer_width = "32")]
+ bits: [u32; 32],
+ #[cfg(target_pointer_width = "64")]
+ bits: [u64; 16],
+ }
+
+ pub struct fsid_t { // ToDo
+ __val: [::c_int; 2],
+ }
+}
+
+// constants
+pub const EADDRINUSE: ::c_int = 98; // Address already in use
+pub const EADDRNOTAVAIL: ::c_int = 99; // Cannot assign requested address
+pub const ECONNABORTED: ::c_int = 103; // Software caused connection abort
+pub const ECONNREFUSED: ::c_int = 111; // Connection refused
+pub const ECONNRESET: ::c_int = 104; // Connection reset by peer
+pub const EDEADLK: ::c_int = 35; // Resource deadlock would occur
+pub const ENOSYS: ::c_int = 38; // Function not implemented
+pub const ENOTCONN: ::c_int = 107; // Transport endpoint is not connected
+pub const ETIMEDOUT: ::c_int = 110; // connection timed out
+pub const O_APPEND: ::c_int = 02000;
+pub const O_ACCMODE: ::c_int = 0003;
+pub const O_CLOEXEC: ::c_int = 0x80000;
+pub const O_CREAT: ::c_int = 0100;
+pub const O_DIRECTORY: ::c_int = 0200000;
+pub const O_EXCL: ::c_int = 0200;
+pub const O_NONBLOCK: ::c_int = 04000;
+pub const O_TRUNC: ::c_int = 01000;
+pub const NCCS: usize = 32;
+pub const SIG_SETMASK: ::c_int = 2; // Set the set of blocked signals
+pub const PTHREAD_STACK_MIN: usize = 16384;
+pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
+pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
+pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
+pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
+pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
+pub const RLIM_INFINITY: u64 = 0xffffffffffffffff;
+pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
+
+extern {
+ pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
+}
+
+cfg_if! {
+ if #[cfg(target_os = "l4re")] {
+ mod l4re;
+ pub use self::l4re::*;
+ } else { }
+}
+
diff --git a/libc/src/windows.rs b/libc/src/windows.rs
index 6c8332a..385b667 100644
--- a/libc/src/windows.rs
+++ b/libc/src/windows.rs
@@ -43,6 +43,18 @@ s! {
pub modtime: time64_t,
}
+ pub struct tm {
+ tm_sec: ::c_int,
+ tm_min: ::c_int,
+ tm_hour: ::c_int,
+ tm_mday: ::c_int,
+ tm_mon: ::c_int,
+ tm_year: ::c_int,
+ tm_wday: ::c_int,
+ tm_yday: ::c_int,
+ tm_isdst: ::c_int,
+ }
+
pub struct timeval {
pub tv_sec: c_long,
pub tv_usec: c_long,