aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Walbran <qwandor@google.com>2023-11-20 17:38:06 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-11-20 17:38:06 +0000
commit55759f886349ea1fcf6ba3218db6646a2695be00 (patch)
tree1707de6ffbe29164fee77ce01c1fae648153a41c
parent325f90937be9659255278a51ef6ad3613055e1ff (diff)
parente39862cf04bdca7a6dbb67a1843ee90504e13145 (diff)
downloadlibc-55759f886349ea1fcf6ba3218db6646a2695be00.tar.gz
Upgrade libc to 0.2.150 am: e39862cf04
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/libc/+/2828318 Change-Id: If1fb2f0af30fdce3c01b2eeddc456feaec850b45 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp2
-rw-r--r--Cargo.toml112
-rw-r--r--Cargo.toml.orig112
-rw-r--r--METADATA10
-rw-r--r--README.md3
-rw-r--r--build.rs53
-rw-r--r--cargo2rulesmk.json1
-rw-r--r--patches/trusty.patch4
-rw-r--r--rules.mk2
-rw-r--r--src/fuchsia/mod.rs88
-rw-r--r--src/hermit/mod.rs5
-rw-r--r--src/lib.rs10
-rw-r--r--src/teeos/mod.rs1379
-rw-r--r--src/unix/aix/mod.rs13
-rw-r--r--src/unix/bsd/apple/b64/aarch64/align.rs1
-rw-r--r--src/unix/bsd/apple/mod.rs371
-rw-r--r--src/unix/bsd/freebsdlike/dragonfly/mod.rs6
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/mod.rs66
-rw-r--r--src/unix/bsd/freebsdlike/mod.rs18
-rw-r--r--src/unix/bsd/netbsdlike/mod.rs5
-rw-r--r--src/unix/bsd/netbsdlike/netbsd/mips.rs21
-rw-r--r--src/unix/bsd/netbsdlike/netbsd/mod.rs84
-rw-r--r--src/unix/bsd/netbsdlike/netbsd/riscv64.rs21
-rw-r--r--src/unix/bsd/netbsdlike/openbsd/mod.rs145
-rw-r--r--src/unix/haiku/mod.rs10
-rw-r--r--src/unix/hermit/aarch64.rs2
-rw-r--r--src/unix/hermit/mod.rs1023
-rw-r--r--src/unix/hermit/x86_64.rs2
-rw-r--r--src/unix/hurd/align.rs1
-rw-r--r--src/unix/hurd/b32.rs91
-rw-r--r--src/unix/hurd/b64.rs93
-rw-r--r--src/unix/hurd/mod.rs3107
-rw-r--r--src/unix/hurd/no_align.rs1
-rw-r--r--src/unix/linux_like/android/b64/aarch64/mod.rs3
-rw-r--r--src/unix/linux_like/android/mod.rs169
-rw-r--r--src/unix/linux_like/emscripten/lfs64.rs213
-rw-r--r--src/unix/linux_like/emscripten/mod.rs150
-rw-r--r--src/unix/linux_like/linux/align.rs13
-rw-r--r--src/unix/linux_like/linux/arch/generic/mod.rs9
-rw-r--r--src/unix/linux_like/linux/arch/mips/mod.rs11
-rw-r--r--src/unix/linux_like/linux/arch/mod.rs5
-rw-r--r--src/unix/linux_like/linux/arch/powerpc/mod.rs6
-rw-r--r--src/unix/linux_like/linux/arch/sparc/mod.rs3
-rw-r--r--src/unix/linux_like/linux/gnu/b32/arm/mod.rs1
-rw-r--r--src/unix/linux_like/linux/gnu/b32/csky/align.rs7
-rw-r--r--src/unix/linux_like/linux/gnu/b32/csky/mod.rs746
-rw-r--r--src/unix/linux_like/linux/gnu/b32/m68k/mod.rs1
-rw-r--r--src/unix/linux_like/linux/gnu/b32/mips/mod.rs1
-rw-r--r--src/unix/linux_like/linux/gnu/b32/mod.rs41
-rw-r--r--src/unix/linux_like/linux/gnu/b32/powerpc.rs1
-rw-r--r--src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs1
-rw-r--r--src/unix/linux_like/linux/gnu/b32/sparc/mod.rs1
-rw-r--r--src/unix/linux_like/linux/gnu/b32/x86/mod.rs1
-rw-r--r--src/unix/linux_like/linux/gnu/b64/aarch64/align.rs7
-rw-r--r--src/unix/linux_like/linux/gnu/b64/aarch64/fallback.rs8
-rw-r--r--src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs9
-rw-r--r--src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs15
-rw-r--r--src/unix/linux_like/linux/gnu/b64/mips64/mod.rs1
-rw-r--r--src/unix/linux_like/linux/gnu/b64/mod.rs4
-rw-r--r--src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs1
-rw-r--r--src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs1
-rw-r--r--src/unix/linux_like/linux/gnu/b64/s390x.rs1
-rw-r--r--src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs1
-rw-r--r--src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs1
-rw-r--r--src/unix/linux_like/linux/gnu/mod.rs63
-rw-r--r--src/unix/linux_like/linux/mod.rs116
-rw-r--r--src/unix/linux_like/linux/musl/b32/arm/mod.rs7
-rw-r--r--src/unix/linux_like/linux/musl/b32/hexagon.rs6
-rw-r--r--src/unix/linux_like/linux/musl/b32/mips/mod.rs7
-rw-r--r--src/unix/linux_like/linux/musl/b32/powerpc.rs9
-rw-r--r--src/unix/linux_like/linux/musl/b32/riscv32/mod.rs8
-rw-r--r--src/unix/linux_like/linux/musl/b32/x86/mod.rs7
-rw-r--r--src/unix/linux_like/linux/musl/b64/aarch64/mod.rs4
-rw-r--r--src/unix/linux_like/linux/musl/b64/mips64.rs4
-rw-r--r--src/unix/linux_like/linux/musl/b64/mod.rs4
-rw-r--r--src/unix/linux_like/linux/musl/b64/powerpc64.rs4
-rw-r--r--src/unix/linux_like/linux/musl/b64/riscv64/mod.rs7
-rw-r--r--src/unix/linux_like/linux/musl/b64/s390x.rs4
-rw-r--r--src/unix/linux_like/linux/musl/b64/x86_64/mod.rs4
-rw-r--r--src/unix/linux_like/linux/musl/mod.rs13
-rw-r--r--src/unix/linux_like/linux/no_align.rs14
-rw-r--r--src/unix/linux_like/linux/uclibc/mod.rs6
-rw-r--r--src/unix/linux_like/mod.rs8
-rw-r--r--src/unix/mod.rs21
-rw-r--r--src/unix/newlib/aarch64/mod.rs2
-rw-r--r--src/unix/newlib/arm/mod.rs2
-rw-r--r--src/unix/newlib/espidf/mod.rs2
-rw-r--r--src/unix/newlib/generic.rs6
-rw-r--r--src/unix/newlib/horizon/mod.rs2
-rw-r--r--src/unix/newlib/mod.rs63
-rw-r--r--src/unix/newlib/powerpc/mod.rs2
-rw-r--r--src/unix/newlib/vita/mod.rs37
-rw-r--r--src/unix/nto/mod.rs283
-rw-r--r--src/unix/nto/neutrino.rs20
-rw-r--r--src/unix/redox/mod.rs93
-rw-r--r--src/unix/solarish/mod.rs2
-rw-r--r--src/vxworks/mod.rs27
-rw-r--r--src/windows/mod.rs1
99 files changed, 7737 insertions, 1417 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 7ce66a13..40638b26 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,6 +1,6 @@
{
"git": {
- "sha1": "f171596308a616876d518b3491af716bd1629608"
+ "sha1": "4d2b98141ec1abb0a0f7497a9edd06416830514d"
},
"path_in_vcs": ""
} \ No newline at end of file
diff --git a/Android.bp b/Android.bp
index 049a22dd..80c9d709 100644
--- a/Android.bp
+++ b/Android.bp
@@ -42,7 +42,7 @@ rust_library {
host_supported: true,
crate_name: "libc",
cargo_env_compat: true,
- cargo_pkg_version: "0.2.146",
+ cargo_pkg_version: "0.2.150",
srcs: ["src/lib.rs"],
edition: "2015",
features: [
diff --git a/Cargo.toml b/Cargo.toml
index 4f114eee..f03bd33b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,7 +11,7 @@
[package]
name = "libc"
-version = "0.2.146"
+version = "0.2.150"
authors = ["The Rust Project Developers"]
build = "build.rs"
exclude = [
@@ -42,10 +42,120 @@ license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/libc"
[package.metadata.docs.rs]
+cargo-args = ["-Zbuild-std=core"]
+default-target = "x86_64-unknown-linux-gnu"
features = [
"const-extern-fn",
"extra_traits",
]
+targets = [
+ "aarch64-apple-ios",
+ "aarch64-linux-android",
+ "aarch64-pc-windows-msvc",
+ "aarch64-unknown-freebsd",
+ "aarch64-unknown-fuchsia",
+ "aarch64-unknown-hermit",
+ "aarch64-unknown-linux-gnu",
+ "aarch64-unknown-linux-musl",
+ "aarch64-unknown-netbsd",
+ "aarch64-unknown-openbsd",
+ "aarch64-wrs-vxworks",
+ "arm-linux-androideabi",
+ "arm-unknown-linux-gnueabi",
+ "arm-unknown-linux-gnueabihf",
+ "arm-unknown-linux-musleabi",
+ "arm-unknown-linux-musleabihf",
+ "armebv7r-none-eabi",
+ "armebv7r-none-eabihf",
+ "armv5te-unknown-linux-gnueabi",
+ "armv5te-unknown-linux-musleabi",
+ "armv7-linux-androideabi",
+ "armv7-unknown-linux-gnueabihf",
+ "armv7-unknown-linux-musleabihf",
+ "armv7-wrs-vxworks-eabihf",
+ "armv7r-none-eabi",
+ "armv7r-none-eabihf",
+ "hexagon-unknown-linux-musl",
+ "i586-pc-windows-msvc",
+ "i586-unknown-linux-gnu",
+ "i586-unknown-linux-musl",
+ "i686-linux-android",
+ "i686-pc-windows-gnu",
+ "i686-pc-windows-msvc",
+ "i686-pc-windows-msvc",
+ "i686-unknown-freebsd",
+ "i686-unknown-haiku",
+ "i686-unknown-linux-gnu",
+ "i686-unknown-linux-musl",
+ "i686-unknown-netbsd",
+ "i686-unknown-openbsd",
+ "i686-wrs-vxworks",
+ "mips-unknown-linux-gnu",
+ "mips-unknown-linux-musl",
+ "mips64-unknown-linux-gnuabi64",
+ "mips64-unknown-linux-muslabi64",
+ "mips64el-unknown-linux-gnuabi64",
+ "mips64el-unknown-linux-muslabi64",
+ "mipsel-sony-psp",
+ "mipsel-unknown-linux-gnu",
+ "mipsel-unknown-linux-musl",
+ "nvptx64-nvidia-cuda",
+ "powerpc-unknown-linux-gnu",
+ "powerpc-unknown-linux-gnuspe",
+ "powerpc-unknown-netbsd",
+ "powerpc-wrs-vxworks",
+ "powerpc-wrs-vxworks-spe",
+ "powerpc64-unknown-freebsd",
+ "powerpc64-unknown-linux-gnu",
+ "powerpc64-wrs-vxworks",
+ "powerpc64le-unknown-linux-gnu",
+ "riscv32gc-unknown-linux-gnu",
+ "riscv32i-unknown-none-elf",
+ "riscv32imac-unknown-none-elf",
+ "riscv32imc-unknown-none-elf",
+ "riscv64gc-unknown-freebsd",
+ "riscv64gc-unknown-hermit",
+ "riscv64gc-unknown-linux-gnu",
+ "riscv64gc-unknown-linux-musl",
+ "riscv64gc-unknown-none-elf",
+ "riscv64imac-unknown-none-elf",
+ "s390x-unknown-linux-gnu",
+ "s390x-unknown-linux-musl",
+ "sparc-unknown-linux-gnu",
+ "sparc64-unknown-linux-gnu",
+ "sparc64-unknown-netbsd",
+ "sparcv9-sun-solaris",
+ "thumbv6m-none-eabi",
+ "thumbv7em-none-eabi",
+ "thumbv7em-none-eabihf",
+ "thumbv7m-none-eabi",
+ "thumbv7neon-linux-androideabi",
+ "thumbv7neon-unknown-linux-gnueabihf",
+ "wasm32-unknown-emscripten",
+ "wasm32-unknown-unknown",
+ "wasm32-wasi",
+ "x86_64-apple-darwin",
+ "x86_64-apple-ios",
+ "x86_64-fortanix-unknown-sgx",
+ "x86_64-linux-android",
+ "x86_64-pc-solaris",
+ "x86_64-pc-windows-gnu",
+ "x86_64-pc-windows-msvc",
+ "x86_64-unknown-dragonfly",
+ "x86_64-unknown-freebsd",
+ "x86_64-unknown-fuchsia",
+ "x86_64-unknown-haiku",
+ "x86_64-unknown-hermit",
+ "x86_64-unknown-illumos",
+ "x86_64-unknown-l4re-uclibc",
+ "x86_64-unknown-linux-gnu",
+ "x86_64-unknown-linux-gnux32",
+ "x86_64-unknown-linux-musl",
+ "x86_64-unknown-netbsd",
+ "x86_64-unknown-openbsd",
+ "x86_64-unknown-redox",
+ "x86_64-wrs-vxworks",
+]
[dependencies.rustc-std-workspace-core]
version = "1.0.0"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index c2c51b30..b70de560 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "libc"
-version = "0.2.146"
+version = "0.2.150"
authors = ["The Rust Project Developers"]
license = "MIT OR Apache-2.0"
readme = "README.md"
@@ -17,6 +17,116 @@ Raw FFI bindings to platform libraries like libc.
[package.metadata.docs.rs]
features = ["const-extern-fn", "extra_traits"]
+default-target = "x86_64-unknown-linux-gnu"
+targets = [
+ "aarch64-apple-ios",
+ "aarch64-linux-android",
+ "aarch64-pc-windows-msvc",
+ "aarch64-unknown-freebsd",
+ "aarch64-unknown-fuchsia",
+ "aarch64-unknown-hermit",
+ "aarch64-unknown-linux-gnu",
+ "aarch64-unknown-linux-musl",
+ "aarch64-unknown-netbsd",
+ "aarch64-unknown-openbsd",
+ "aarch64-wrs-vxworks",
+ "arm-linux-androideabi",
+ "arm-unknown-linux-gnueabi",
+ "arm-unknown-linux-gnueabihf",
+ "arm-unknown-linux-musleabi",
+ "arm-unknown-linux-musleabihf",
+ "armebv7r-none-eabi",
+ "armebv7r-none-eabihf",
+ "armv5te-unknown-linux-gnueabi",
+ "armv5te-unknown-linux-musleabi",
+ "armv7-linux-androideabi",
+ "armv7-unknown-linux-gnueabihf",
+ "armv7-unknown-linux-musleabihf",
+ "armv7-wrs-vxworks-eabihf",
+ "armv7r-none-eabi",
+ "armv7r-none-eabihf",
+ "hexagon-unknown-linux-musl",
+ "i586-pc-windows-msvc",
+ "i586-unknown-linux-gnu",
+ "i586-unknown-linux-musl",
+ "i686-linux-android",
+ "i686-pc-windows-gnu",
+ "i686-pc-windows-msvc",
+ "i686-pc-windows-msvc",
+ "i686-unknown-freebsd",
+ "i686-unknown-haiku",
+ "i686-unknown-linux-gnu",
+ "i686-unknown-linux-musl",
+ "i686-unknown-netbsd",
+ "i686-unknown-openbsd",
+ "i686-wrs-vxworks",
+ "mips-unknown-linux-gnu",
+ "mips-unknown-linux-musl",
+ "mips64-unknown-linux-gnuabi64",
+ "mips64-unknown-linux-muslabi64",
+ "mips64el-unknown-linux-gnuabi64",
+ "mips64el-unknown-linux-muslabi64",
+ "mipsel-sony-psp",
+ "mipsel-unknown-linux-gnu",
+ "mipsel-unknown-linux-musl",
+ "nvptx64-nvidia-cuda",
+ "powerpc-unknown-linux-gnu",
+ "powerpc-unknown-linux-gnuspe",
+ "powerpc-unknown-netbsd",
+ "powerpc-wrs-vxworks",
+ "powerpc-wrs-vxworks-spe",
+ "powerpc64-unknown-freebsd",
+ "powerpc64-unknown-linux-gnu",
+ "powerpc64-wrs-vxworks",
+ "powerpc64le-unknown-linux-gnu",
+ "riscv32gc-unknown-linux-gnu",
+ "riscv32i-unknown-none-elf",
+ "riscv32imac-unknown-none-elf",
+ "riscv32imc-unknown-none-elf",
+ "riscv64gc-unknown-freebsd",
+ "riscv64gc-unknown-hermit",
+ "riscv64gc-unknown-linux-gnu",
+ "riscv64gc-unknown-linux-musl",
+ "riscv64gc-unknown-none-elf",
+ "riscv64imac-unknown-none-elf",
+ "s390x-unknown-linux-gnu",
+ "s390x-unknown-linux-musl",
+ "sparc-unknown-linux-gnu",
+ "sparc64-unknown-linux-gnu",
+ "sparc64-unknown-netbsd",
+ "sparcv9-sun-solaris",
+ "thumbv6m-none-eabi",
+ "thumbv7em-none-eabi",
+ "thumbv7em-none-eabihf",
+ "thumbv7m-none-eabi",
+ "thumbv7neon-linux-androideabi",
+ "thumbv7neon-unknown-linux-gnueabihf",
+ "wasm32-unknown-emscripten",
+ "wasm32-unknown-unknown",
+ "wasm32-wasi",
+ "x86_64-apple-darwin",
+ "x86_64-apple-ios",
+ "x86_64-fortanix-unknown-sgx",
+ "x86_64-linux-android",
+ "x86_64-pc-solaris",
+ "x86_64-pc-windows-gnu",
+ "x86_64-pc-windows-msvc",
+ "x86_64-unknown-dragonfly",
+ "x86_64-unknown-freebsd",
+ "x86_64-unknown-fuchsia",
+ "x86_64-unknown-haiku",
+ "x86_64-unknown-hermit",
+ "x86_64-unknown-illumos",
+ "x86_64-unknown-l4re-uclibc",
+ "x86_64-unknown-linux-gnu",
+ "x86_64-unknown-linux-gnux32",
+ "x86_64-unknown-linux-musl",
+ "x86_64-unknown-netbsd",
+ "x86_64-unknown-openbsd",
+ "x86_64-unknown-redox",
+ "x86_64-wrs-vxworks"
+]
+cargo-args = ["-Zbuild-std=core"]
[dependencies]
rustc-std-workspace-core = { version = "1.0.0", optional = true }
diff --git a/METADATA b/METADATA
index e9566c15..0af5b273 100644
--- a/METADATA
+++ b/METADATA
@@ -1,6 +1,6 @@
# This project was upgraded with external_updater.
# Usage: tools/external_updater/updater.sh update rust/crates/libc
-# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
+# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md
name: "libc"
description: "()"
@@ -11,13 +11,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/libc/libc-0.2.146.crate"
+ value: "https://static.crates.io/crates/libc/libc-0.2.150.crate"
}
- version: "0.2.146"
+ version: "0.2.150"
license_type: NOTICE
last_upgrade_date {
year: 2023
- month: 6
- day: 9
+ month: 11
+ day: 14
}
}
diff --git a/README.md b/README.md
index 43d706d0..29d2a4b6 100644
--- a/README.md
+++ b/README.md
@@ -60,7 +60,7 @@ newer Rust features are only available on newer Rust toolchains:
## Platform support
-[Platform-specific documentation (HEAD)][docs.head].
+You can see the platform(target)-specific docs on [docs.rs], select a platform you want to see.
See
[`ci/build.sh`](https://github.com/rust-lang/libc/blob/HEAD/ci/build.sh)
@@ -107,4 +107,3 @@ dual licensed as above, without any additional terms or conditions.
[Documentation]: https://docs.rs/libc/badge.svg
[docs.rs]: https://docs.rs/libc
[License]: https://img.shields.io/crates/l/libc.svg
-[docs.head]: https://rust-lang.github.io/libc/#platform-specific-documentation
diff --git a/build.rs b/build.rs
index 79bec0ea..d7a9b7f7 100644
--- a/build.rs
+++ b/build.rs
@@ -7,6 +7,7 @@ use std::string::String;
// need to know all the possible cfgs that this script will set. If you need to set another cfg
// make sure to add it to this list as well.
const ALLOWED_CFGS: &'static [&'static str] = &[
+ "emscripten_new_stat_abi",
"freebsd10",
"freebsd11",
"freebsd12",
@@ -32,9 +33,12 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
// Extra values to allow for check-cfg.
const CHECK_CFG_EXTRA: &'static [(&'static str, &'static [&'static str])] = &[
- ("target_os", &["switch", "aix", "ohos"]),
+ ("target_os", &["switch", "aix", "ohos", "hurd"]),
("target_env", &["illumos", "wasi", "aix", "ohos"]),
- ("target_arch", &["loongarch64"]),
+ (
+ "target_arch",
+ &["loongarch64", "mips32r6", "mips64r6", "csky"],
+ ),
];
fn main() {
@@ -69,6 +73,12 @@ fn main() {
Some(_) | None => set_cfg("freebsd11"),
}
+ match emcc_version_code() {
+ Some(v) if (v >= 30142) => set_cfg("emscripten_new_stat_abi"),
+ // Non-Emscripten or version < 3.1.42.
+ Some(_) | None => (),
+ }
+
// On CI: deny all warnings
if libc_ci {
set_cfg("libc_deny_warnings");
@@ -157,11 +167,19 @@ fn main() {
// https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg
if libc_check_cfg {
for cfg in ALLOWED_CFGS {
- println!("cargo:rustc-check-cfg=values({})", cfg);
+ if rustc_minor_ver >= 75 {
+ println!("cargo:rustc-check-cfg=cfg({})", cfg);
+ } else {
+ println!("cargo:rustc-check-cfg=values({})", cfg);
+ }
}
for &(name, values) in CHECK_CFG_EXTRA {
let values = values.join("\",\"");
- println!("cargo:rustc-check-cfg=values({},\"{}\")", name, values);
+ if rustc_minor_ver >= 75 {
+ println!("cargo:rustc-check-cfg=cfg({},values(\"{}\"))", name, values);
+ } else {
+ println!("cargo:rustc-check-cfg=values({},\"{}\")", name, values);
+ }
}
}
}
@@ -238,6 +256,33 @@ fn which_freebsd() -> Option<i32> {
}
}
+fn emcc_version_code() -> Option<u64> {
+ let output = std::process::Command::new("emcc")
+ .arg("-dumpversion")
+ .output()
+ .ok();
+ if output.is_none() {
+ return None;
+ }
+ let output = output.unwrap();
+ if !output.status.success() {
+ return None;
+ }
+
+ let stdout = String::from_utf8(output.stdout).ok();
+ if stdout.is_none() {
+ return None;
+ }
+ let version = stdout.unwrap();
+ let mut pieces = version.trim().split('.');
+
+ let major = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
+ let minor = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
+ let patch = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
+
+ Some(major * 10000 + minor * 100 + patch)
+}
+
fn set_cfg(cfg: &str) {
if !ALLOWED_CFGS.contains(&cfg) {
panic!("trying to set cfg {}, but it is not in ALLOWED_CFGS", cfg);
diff --git a/cargo2rulesmk.json b/cargo2rulesmk.json
index cce930ee..ce1cb57c 100644
--- a/cargo2rulesmk.json
+++ b/cargo2rulesmk.json
@@ -1,4 +1,5 @@
{
+ "features": "",
"patch": "patches/rules.mk.diff",
"module_add_implicit_deps": false
}
diff --git a/patches/trusty.patch b/patches/trusty.patch
index afd0df26..d73429be 100644
--- a/patches/trusty.patch
+++ b/patches/trusty.patch
@@ -4,8 +4,8 @@ index 62748d279..4d8822ec2 100644
+++ a/src/lib.rs
@@ -143,6 +143,12 @@ cfg_if! {
- mod hermit;
- pub use hermit::*;
+ mod teeos;
+ pub use teeos::*;
+ } else if #[cfg(target_os = "trusty")] {
+ mod fixed_width_ints;
+ pub use fixed_width_ints::*;
diff --git a/rules.mk b/rules.mk
index 08cf2d6c..008e09d2 100644
--- a/rules.mk
+++ b/rules.mk
@@ -1,4 +1,4 @@
-# This file is generated by cargo2rulesmk.py --run --config cargo2rulesmk.json --features .
+# This file is generated by cargo2rulesmk.py --run --config cargo2rulesmk.json.
# Do not modify this file as changes will be overridden on upgrade.
LOCAL_DIR := $(GET_LOCAL_DIR)
diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs
index 3e922e76..bf1a5436 100644
--- a/src/fuchsia/mod.rs
+++ b/src/fuchsia/mod.rs
@@ -2679,7 +2679,87 @@ pub const PT_GNU_STACK: u32 = 0x6474e551;
pub const PT_GNU_RELRO: u32 = 0x6474e552;
// Ethernet protocol IDs.
+pub const ETH_P_LOOP: ::c_int = 0x0060;
+pub const ETH_P_PUP: ::c_int = 0x0200;
+pub const ETH_P_PUPAT: ::c_int = 0x0201;
pub const ETH_P_IP: ::c_int = 0x0800;
+pub const ETH_P_X25: ::c_int = 0x0805;
+pub const ETH_P_ARP: ::c_int = 0x0806;
+pub const ETH_P_BPQ: ::c_int = 0x08FF;
+pub const ETH_P_IEEEPUP: ::c_int = 0x0a00;
+pub const ETH_P_IEEEPUPAT: ::c_int = 0x0a01;
+pub const ETH_P_BATMAN: ::c_int = 0x4305;
+pub const ETH_P_DEC: ::c_int = 0x6000;
+pub const ETH_P_DNA_DL: ::c_int = 0x6001;
+pub const ETH_P_DNA_RC: ::c_int = 0x6002;
+pub const ETH_P_DNA_RT: ::c_int = 0x6003;
+pub const ETH_P_LAT: ::c_int = 0x6004;
+pub const ETH_P_DIAG: ::c_int = 0x6005;
+pub const ETH_P_CUST: ::c_int = 0x6006;
+pub const ETH_P_SCA: ::c_int = 0x6007;
+pub const ETH_P_TEB: ::c_int = 0x6558;
+pub const ETH_P_RARP: ::c_int = 0x8035;
+pub const ETH_P_ATALK: ::c_int = 0x809B;
+pub const ETH_P_AARP: ::c_int = 0x80F3;
+pub const ETH_P_8021Q: ::c_int = 0x8100;
+pub const ETH_P_IPX: ::c_int = 0x8137;
+pub const ETH_P_IPV6: ::c_int = 0x86DD;
+pub const ETH_P_PAUSE: ::c_int = 0x8808;
+pub const ETH_P_SLOW: ::c_int = 0x8809;
+pub const ETH_P_WCCP: ::c_int = 0x883E;
+pub const ETH_P_MPLS_UC: ::c_int = 0x8847;
+pub const ETH_P_MPLS_MC: ::c_int = 0x8848;
+pub const ETH_P_ATMMPOA: ::c_int = 0x884c;
+pub const ETH_P_PPP_DISC: ::c_int = 0x8863;
+pub const ETH_P_PPP_SES: ::c_int = 0x8864;
+pub const ETH_P_LINK_CTL: ::c_int = 0x886c;
+pub const ETH_P_ATMFATE: ::c_int = 0x8884;
+pub const ETH_P_PAE: ::c_int = 0x888E;
+pub const ETH_P_AOE: ::c_int = 0x88A2;
+pub const ETH_P_8021AD: ::c_int = 0x88A8;
+pub const ETH_P_802_EX1: ::c_int = 0x88B5;
+pub const ETH_P_TIPC: ::c_int = 0x88CA;
+pub const ETH_P_8021AH: ::c_int = 0x88E7;
+pub const ETH_P_MVRP: ::c_int = 0x88F5;
+pub const ETH_P_1588: ::c_int = 0x88F7;
+pub const ETH_P_PRP: ::c_int = 0x88FB;
+pub const ETH_P_FCOE: ::c_int = 0x8906;
+pub const ETH_P_TDLS: ::c_int = 0x890D;
+pub const ETH_P_FIP: ::c_int = 0x8914;
+pub const ETH_P_80221: ::c_int = 0x8917;
+pub const ETH_P_LOOPBACK: ::c_int = 0x9000;
+pub const ETH_P_QINQ1: ::c_int = 0x9100;
+pub const ETH_P_QINQ2: ::c_int = 0x9200;
+pub const ETH_P_QINQ3: ::c_int = 0x9300;
+pub const ETH_P_EDSA: ::c_int = 0xDADA;
+pub const ETH_P_AF_IUCV: ::c_int = 0xFBFB;
+
+pub const ETH_P_802_3_MIN: ::c_int = 0x0600;
+
+pub const ETH_P_802_3: ::c_int = 0x0001;
+pub const ETH_P_AX25: ::c_int = 0x0002;
+pub const ETH_P_ALL: ::c_int = 0x0003;
+pub const ETH_P_802_2: ::c_int = 0x0004;
+pub const ETH_P_SNAP: ::c_int = 0x0005;
+pub const ETH_P_DDCMP: ::c_int = 0x0006;
+pub const ETH_P_WAN_PPP: ::c_int = 0x0007;
+pub const ETH_P_PPP_MP: ::c_int = 0x0008;
+pub const ETH_P_LOCALTALK: ::c_int = 0x0009;
+pub const ETH_P_CAN: ::c_int = 0x000C;
+pub const ETH_P_CANFD: ::c_int = 0x000D;
+pub const ETH_P_PPPTALK: ::c_int = 0x0010;
+pub const ETH_P_TR_802_2: ::c_int = 0x0011;
+pub const ETH_P_MOBITEX: ::c_int = 0x0015;
+pub const ETH_P_CONTROL: ::c_int = 0x0016;
+pub const ETH_P_IRDA: ::c_int = 0x0017;
+pub const ETH_P_ECONET: ::c_int = 0x0018;
+pub const ETH_P_HDLC: ::c_int = 0x0019;
+pub const ETH_P_ARCNET: ::c_int = 0x001A;
+pub const ETH_P_DSA: ::c_int = 0x001B;
+pub const ETH_P_TRAILER: ::c_int = 0x001C;
+pub const ETH_P_PHONET: ::c_int = 0x00F5;
+pub const ETH_P_IEEE802154: ::c_int = 0x00F6;
+pub const ETH_P_CAIF: ::c_int = 0x00F7;
pub const SFD_CLOEXEC: ::c_int = 0x080000;
@@ -2731,7 +2811,10 @@ pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const RLIM_INFINITY: ::rlim_t = !0;
pub const RLIMIT_RTTIME: ::c_int = 15;
+#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIMIT_NLIMITS: ::c_int = 16;
+#[allow(deprecated)]
+#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::c_int = RLIMIT_NLIMITS;
pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
@@ -3687,6 +3770,10 @@ extern "C" {
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;
+ pub fn pthread_attr_getstacksize(
+ attr: *const ::pthread_attr_t,
+ stacksize: *mut ::size_t,
+ ) -> ::c_int;
pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t, stack_size: ::size_t) -> ::c_int;
pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, state: ::c_int) -> ::c_int;
pub fn pthread_detach(thread: ::pthread_t) -> ::c_int;
@@ -4161,6 +4248,7 @@ extern "C" {
attr: *const ::pthread_attr_t,
guardsize: *mut ::size_t,
) -> ::c_int;
+ pub fn pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::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 umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int;
diff --git a/src/hermit/mod.rs b/src/hermit/mod.rs
index bffcefdd..7543c825 100644
--- a/src/hermit/mod.rs
+++ b/src/hermit/mod.rs
@@ -1,7 +1,4 @@
-// libc port for HermitCore (https://hermitcore.org)
-//
-// Ported by Colin Fink <colin.finck@rwth-aachen.de>
-// and Stefan Lankes <slankes@eonerc.rwth-aachen.de>
+//! Hermit C types definition
pub type c_schar = i8;
pub type c_uchar = u8;
diff --git a/src/lib.rs b/src/lib.rs
index 4d8822ec..a0a0372d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,8 +1,4 @@
//! libc - Raw FFI bindings to platforms' system libraries
-//!
-//! [Documentation for other platforms][pd].
-//!
-//! [pd]: https://rust-lang.github.io/libc/#platform-specific-documentation
#![crate_name = "libc"]
#![crate_type = "rlib"]
#![allow(
@@ -143,6 +139,12 @@ cfg_if! {
mod hermit;
pub use hermit::*;
+ } else if #[cfg(target_os = "teeos")] {
+ mod fixed_width_ints;
+ pub use fixed_width_ints::*;
+
+ mod teeos;
+ pub use teeos::*;
} else if #[cfg(target_os = "trusty")] {
mod fixed_width_ints;
pub use fixed_width_ints::*;
diff --git a/src/teeos/mod.rs b/src/teeos/mod.rs
new file mode 100644
index 00000000..cffe0419
--- /dev/null
+++ b/src/teeos/mod.rs
@@ -0,0 +1,1379 @@
+//! Libc bindings for teeos
+//!
+//! Apparently the loader just dynamically links it anyway, but fails
+//! when linking is explicitly requested.
+#![allow(non_camel_case_types)]
+#![allow(non_snake_case)]
+
+// only supported on Rust > 1.59, so we can directly reexport c_void from core.
+pub use core::ffi::c_void;
+
+use Option;
+
+pub type c_schar = i8;
+
+pub type c_uchar = u8;
+
+pub type c_short = i16;
+
+pub type c_ushort = u16;
+
+pub type c_int = i32;
+
+pub type c_uint = u32;
+
+pub type c_bool = i32;
+
+pub type c_float = f32;
+
+pub type c_double = f64;
+
+pub type c_longlong = i64;
+
+pub type c_ulonglong = u64;
+
+pub type intmax_t = i64;
+
+pub type uintmax_t = u64;
+
+pub type size_t = usize;
+
+pub type ptrdiff_t = isize;
+
+pub type intptr_t = isize;
+
+pub type uintptr_t = usize;
+
+pub type ssize_t = isize;
+
+pub type pid_t = c_int;
+
+// aarch64 specifc
+pub type c_char = u8;
+
+pub type wchar_t = u32;
+
+pub type c_long = i64;
+
+pub type c_ulong = u64;
+
+#[repr(align(16))]
+pub struct _CLongDouble(pub u128);
+
+// long double in C means A float point value, which has 128bit length.
+// but some bit maybe not used, so the really length of long double could be 80(x86) or 128(power pc/IEEE)
+// this is different from f128(not stable and not inculded default) in Rust, so we use u128 for FFI(Rust to C).
+// this is unstable and will couse to memfault/data abort.
+pub type c_longdouble = _CLongDouble;
+
+pub type pthread_t = c_ulong;
+
+pub type pthread_key_t = c_uint;
+
+pub type pthread_spinlock_t = c_int;
+
+pub type off_t = i64;
+
+pub type time_t = c_long;
+
+pub type clock_t = c_long;
+
+pub type clockid_t = c_int;
+
+pub type suseconds_t = c_long;
+
+pub type once_fn = extern "C" fn() -> c_void;
+
+pub type pthread_once_t = c_int;
+
+pub type va_list = *mut c_char;
+
+pub type wint_t = c_uint;
+
+pub type wctype_t = c_ulong;
+
+pub type cmpfunc = extern "C" fn(x: *const c_void, y: *const c_void) -> c_int;
+
+#[repr(align(8))]
+#[repr(C)]
+pub struct pthread_cond_t {
+ #[doc(hidden)]
+ size: [u8; __SIZEOF_PTHREAD_COND_T],
+}
+
+#[repr(align(8))]
+#[repr(C)]
+pub struct pthread_mutex_t {
+ #[doc(hidden)]
+ size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
+}
+
+#[repr(align(4))]
+#[repr(C)]
+pub struct pthread_mutexattr_t {
+ #[doc(hidden)]
+ size: [u8; __SIZEOF_PTHREAD_MUTEXATTR_T],
+}
+
+#[repr(align(4))]
+#[repr(C)]
+pub struct pthread_condattr_t {
+ #[doc(hidden)]
+ size: [u8; __SIZEOF_PTHREAD_CONDATTR_T],
+}
+
+#[repr(C)]
+pub struct pthread_attr_t {
+ __size: [u64; 7],
+}
+
+#[repr(C)]
+pub struct cpu_set_t {
+ bits: [c_ulong; 128 / core::mem::size_of::<c_ulong>()],
+}
+
+#[repr(C)]
+pub struct timespec {
+ pub tv_sec: time_t,
+ pub tv_nsec: c_long,
+}
+
+#[repr(C)]
+pub struct timeval {
+ pub tv_sec: time_t,
+ pub tv_usec: suseconds_t,
+}
+
+#[repr(C)]
+pub struct tm {
+ pub tm_sec: c_int,
+ pub tm_min: c_int,
+ pub tm_hour: c_int,
+ pub tm_mday: c_int,
+ pub tm_mon: c_int,
+ pub tm_year: c_int,
+ pub tm_wday: c_int,
+ pub tm_yday: c_int,
+ pub tm_isdst: c_int,
+ pub __tm_gmtoff: c_long,
+ pub __tm_zone: *const c_char,
+}
+
+#[repr(C)]
+pub struct mbstate_t {
+ pub __opaque1: c_uint,
+ pub __opaque2: c_uint,
+}
+
+#[repr(C)]
+pub struct sem_t {
+ pub __val: [c_int; 4 * core::mem::size_of::<c_long>() / core::mem::size_of::<c_int>()],
+}
+
+#[repr(C)]
+pub struct div_t {
+ pub quot: c_int,
+ pub rem: c_int,
+}
+
+// fcntl
+pub const O_CREAT: u32 = 0100;
+
+pub const O_EXCL: u32 = 0200;
+
+pub const O_NOCTTY: u32 = 0400;
+
+pub const O_TRUNC: u32 = 01000;
+
+pub const O_APPEND: u32 = 02000;
+
+pub const O_NONBLOCK: u32 = 04000;
+
+pub const O_DSYNC: u32 = 010000;
+
+pub const O_SYNC: u32 = 04010000;
+
+pub const O_RSYNC: u32 = 04010000;
+
+pub const O_DIRECTORY: u32 = 0200000;
+
+pub const O_NOFOLLOW: u32 = 0400000;
+
+pub const O_CLOEXEC: u32 = 02000000;
+
+pub const O_ASYNC: u32 = 020000;
+
+pub const O_DIRECT: u32 = 040000;
+
+pub const O_LARGEFILE: u32 = 0100000;
+
+pub const O_NOATIME: u32 = 01000000;
+
+pub const O_PATH: u32 = 010000000;
+
+pub const O_TMPFILE: u32 = 020200000;
+
+pub const O_NDELAY: u32 = O_NONBLOCK;
+
+pub const F_DUPFD: u32 = 0;
+
+pub const F_GETFD: u32 = 1;
+
+pub const F_SETFD: u32 = 2;
+
+pub const F_GETFL: u32 = 3;
+
+pub const F_SETFL: u32 = 4;
+
+pub const F_SETOWN: u32 = 8;
+
+pub const F_GETOWN: u32 = 9;
+
+pub const F_SETSIG: u32 = 10;
+
+pub const F_GETSIG: u32 = 11;
+
+pub const F_GETLK: u32 = 12;
+
+pub const F_SETLK: u32 = 13;
+
+pub const F_SETLKW: u32 = 14;
+
+pub const F_SETOWN_EX: u32 = 15;
+
+pub const F_GETOWN_EX: u32 = 16;
+
+pub const F_GETOWNER_UIDS: u32 = 17;
+
+// mman
+pub const MAP_FAILED: u64 = 0xffffffffffffffff;
+
+pub const MAP_FIXED_NOREPLACE: u32 = 0x100000;
+
+pub const MAP_SHARED_VALIDATE: u32 = 0x03;
+
+pub const MAP_SHARED: u32 = 0x01;
+
+pub const MAP_PRIVATE: u32 = 0x02;
+
+pub const MAP_TYPE: u32 = 0x0f;
+
+pub const MAP_FIXED: u32 = 0x10;
+
+pub const MAP_ANON: u32 = 0x20;
+
+pub const MAP_ANONYMOUS: u32 = MAP_ANON;
+
+pub const MAP_NORESERVE: u32 = 0x4000;
+
+pub const MAP_GROWSDOWN: u32 = 0x0100;
+
+pub const MAP_DENYWRITE: u32 = 0x0800;
+
+pub const MAP_EXECUTABLE: u32 = 0x1000;
+
+pub const MAP_LOCKED: u32 = 0x2000;
+
+pub const MAP_POPULATE: u32 = 0x8000;
+
+pub const MAP_NONBLOCK: u32 = 0x10000;
+
+pub const MAP_STACK: u32 = 0x20000;
+
+pub const MAP_HUGETLB: u32 = 0x40000;
+
+pub const MAP_SYNC: u32 = 0x80000;
+
+pub const MAP_FILE: u32 = 0;
+
+pub const MAP_HUGE_SHIFT: u32 = 26;
+
+pub const MAP_HUGE_MASK: u32 = 0x3f;
+
+pub const MAP_HUGE_16KB: u32 = 14 << 26;
+
+pub const MAP_HUGE_64KB: u32 = 16 << 26;
+
+pub const MAP_HUGE_512KB: u32 = 19 << 26;
+
+pub const MAP_HUGE_1MB: u32 = 20 << 26;
+
+pub const MAP_HUGE_2MB: u32 = 21 << 26;
+
+pub const MAP_HUGE_8MB: u32 = 23 << 26;
+
+pub const MAP_HUGE_16MB: u32 = 24 << 26;
+
+pub const MAP_HUGE_32MB: u32 = 25 << 26;
+
+pub const MAP_HUGE_256MB: u32 = 28 << 26;
+
+pub const MAP_HUGE_512MB: u32 = 29 << 26;
+
+pub const MAP_HUGE_1GB: u32 = 30 << 26;
+
+pub const MAP_HUGE_2GB: u32 = 31 << 26;
+
+pub const MAP_HUGE_16GB: u32 = 34u32 << 26;
+
+pub const PROT_NONE: u32 = 0;
+
+pub const PROT_READ: u32 = 1;
+
+pub const PROT_WRITE: u32 = 2;
+
+pub const PROT_EXEC: u32 = 4;
+
+pub const PROT_GROWSDOWN: u32 = 0x01000000;
+
+pub const PROT_GROWSUP: u32 = 0x02000000;
+
+pub const MS_ASYNC: u32 = 1;
+
+pub const MS_INVALIDATE: u32 = 2;
+
+pub const MS_SYNC: u32 = 4;
+
+pub const MCL_CURRENT: u32 = 1;
+
+pub const MCL_FUTURE: u32 = 2;
+
+pub const MCL_ONFAULT: u32 = 4;
+
+pub const POSIX_MADV_NORMAL: u32 = 0;
+
+pub const POSIX_MADV_RANDOM: u32 = 1;
+
+pub const POSIX_MADV_SEQUENTIAL: u32 = 2;
+
+pub const POSIX_MADV_WILLNEED: u32 = 3;
+
+pub const POSIX_MADV_DONTNEED: u32 = 4;
+
+// wctype
+pub const WCTYPE_ALNUM: u64 = 1;
+
+pub const WCTYPE_ALPHA: u64 = 2;
+
+pub const WCTYPE_BLANK: u64 = 3;
+
+pub const WCTYPE_CNTRL: u64 = 4;
+
+pub const WCTYPE_DIGIT: u64 = 5;
+
+pub const WCTYPE_GRAPH: u64 = 6;
+
+pub const WCTYPE_LOWER: u64 = 7;
+
+pub const WCTYPE_PRINT: u64 = 8;
+
+pub const WCTYPE_PUNCT: u64 = 9;
+
+pub const WCTYPE_SPACE: u64 = 10;
+
+pub const WCTYPE_UPPER: u64 = 11;
+
+pub const WCTYPE_XDIGIT: u64 = 12;
+
+// locale
+pub const LC_CTYPE: i32 = 0;
+
+pub const LC_NUMERIC: i32 = 1;
+
+pub const LC_TIME: i32 = 2;
+
+pub const LC_COLLATE: i32 = 3;
+
+pub const LC_MONETARY: i32 = 4;
+
+pub const LC_MESSAGES: i32 = 5;
+
+pub const LC_ALL: i32 = 6;
+
+// pthread
+pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
+
+pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
+
+pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+
+// errno.h
+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 ENOTBLK: c_int = 15;
+
+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 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 EWOULDBLOCK: c_int = EAGAIN;
+
+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 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 EMULTIHOP: c_int = 72;
+
+pub const EDOTDOT: c_int = 73;
+
+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 EPROTONOSUPPOR: c_int = 93;
+
+pub const ESOCKTNOSUPPOR: 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;
+
+// pthread_attr.h
+pub const TEESMP_THREAD_ATTR_CA_WILDCARD: c_int = 0;
+
+pub const TEESMP_THREAD_ATTR_CA_INHERIT: c_int = -1;
+
+pub const TEESMP_THREAD_ATTR_TASK_ID_INHERIT: c_int = -1;
+
+pub const TEESMP_THREAD_ATTR_HAS_SHADOW: c_int = 0x1;
+
+pub const TEESMP_THREAD_ATTR_NO_SHADOW: c_int = 0x0;
+
+// unistd.h
+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_PAGE_SIZE: c_int = 30;
+
+pub const _SC_PAGESIZE: c_int = 30; /* !! */
+
+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;
+
+// limits.h
+pub const PTHREAD_KEYS_MAX: c_int = 128;
+
+pub const PTHREAD_STACK_MIN: c_int = 2048;
+
+pub const PTHREAD_DESTRUCTOR_ITERATIONS: c_int = 4;
+
+pub const SEM_VALUE_MAX: c_int = 0x7fffffff;
+
+pub const SEM_NSEMS_MAX: c_int = 256;
+
+pub const DELAYTIMER_MAX: c_int = 0x7fffffff;
+
+pub const MQ_PRIO_MAX: c_int = 32768;
+
+pub const LOGIN_NAME_MAX: c_int = 256;
+
+// time.h
+pub const CLOCK_REALTIME: clockid_t = 0;
+
+pub const CLOCK_MONOTONIC: clockid_t = 1;
+
+pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
+ size: [0; __SIZEOF_PTHREAD_MUTEX_T],
+};
+
+pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
+ size: [0; __SIZEOF_PTHREAD_COND_T],
+};
+
+pub const PTHREAD_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_MUTEX_STALLED: c_int = 0;
+
+pub const PTHREAD_MUTEX_ROBUST: c_int = 1;
+
+extern "C" {
+ // ---- ALLOC -----------------------------------------------------------------------------
+ pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
+
+ pub fn malloc(size: size_t) -> *mut c_void;
+
+ pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
+
+ pub fn aligned_alloc(align: size_t, len: size_t) -> *mut c_void;
+
+ pub fn free(p: *mut c_void);
+
+ pub fn posix_memalign(memptr: *mut *mut c_void, align: size_t, size: size_t) -> c_int;
+
+ pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
+
+ pub fn wmemchr(cx: *const wchar_t, c: wchar_t, n: size_t) -> *mut wchar_t;
+
+ pub fn memcmp(cx: *const c_void, ct: *const c_void, n: size_t) -> c_int;
+
+ pub fn memcpy(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
+
+ pub fn memmove(dest: *mut c_void, src: *const c_void, n: size_t) -> *mut c_void;
+
+ pub fn memset(dest: *mut c_void, c: c_int, n: size_t) -> *mut c_void;
+
+ // ----- PTHREAD ---------------------------------------------------------------------------
+ pub fn pthread_self() -> pthread_t;
+
+ pub fn pthread_join(native: pthread_t, value: *mut *mut c_void) -> c_int;
+
+ // detach or pthread_attr_setdetachstate must not be called!
+ //pub fn pthread_detach(thread: pthread_t) -> 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;
+
+ pub fn pthread_attr_getstack(
+ attr: *const pthread_attr_t,
+ stackaddr: *mut *mut c_void,
+ stacksize: *mut size_t,
+ ) -> c_int;
+
+ pub fn pthread_attr_setstacksize(attr: *mut pthread_attr_t, stack_size: size_t) -> c_int;
+
+ pub fn pthread_attr_getstacksize(attr: *const pthread_attr_t, size: *mut size_t) -> c_int;
+
+ pub fn pthread_attr_settee(
+ attr: *mut pthread_attr_t,
+ ca: c_int,
+ task_id: c_int,
+ shadow: c_int,
+ ) -> c_int;
+
+ // C-TA API do not include this interface, but TA can use.
+ pub fn sched_yield() -> c_int;
+
+ pub fn pthread_key_create(
+ key: *mut pthread_key_t,
+ dtor: Option<unsafe extern "C" fn(*mut c_void)>,
+ ) -> c_int;
+
+ pub fn pthread_key_delete(key: pthread_key_t) -> c_int;
+
+ pub fn pthread_getspecific(key: pthread_key_t) -> *mut c_void;
+
+ pub fn pthread_setspecific(key: pthread_key_t, value: *const c_void) -> c_int;
+
+ pub fn pthread_mutex_destroy(lock: *mut pthread_mutex_t) -> c_int;
+
+ pub fn pthread_mutex_init(
+ lock: *mut pthread_mutex_t,
+ attr: *const pthread_mutexattr_t,
+ ) -> c_int;
+
+ pub fn pthread_mutex_lock(lock: *mut pthread_mutex_t) -> c_int;
+
+ pub fn pthread_mutex_trylock(lock: *mut pthread_mutex_t) -> c_int;
+
+ pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> c_int;
+
+ pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> c_int;
+
+ pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> c_int;
+
+ pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: c_int) -> c_int;
+
+ pub fn pthread_mutexattr_setpshared(attr: *mut pthread_mutexattr_t, pshared: c_int) -> c_int;
+
+ pub fn pthread_cond_broadcast(cond: *mut pthread_cond_t) -> c_int;
+
+ pub fn pthread_cond_destroy(cond: *mut pthread_cond_t) -> c_int;
+
+ pub fn pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t) -> c_int;
+
+ pub fn pthread_cond_signal(cond: *mut pthread_cond_t) -> c_int;
+
+ pub fn pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> c_int;
+
+ pub fn pthread_mutexattr_setrobust(attr: *mut pthread_mutexattr_t, robustness: c_int) -> c_int;
+
+ pub fn pthread_create(
+ native: *mut pthread_t,
+ attr: *const pthread_attr_t,
+ f: extern "C" fn(*mut c_void) -> *mut c_void,
+ value: *mut c_void,
+ ) -> c_int;
+
+ pub fn pthread_spin_init(lock: *mut pthread_spinlock_t, pshared: c_int) -> c_int;
+
+ pub fn pthread_spin_destroy(lock: *mut pthread_spinlock_t) -> c_int;
+
+ pub fn pthread_spin_lock(lock: *mut pthread_spinlock_t) -> c_int;
+
+ pub fn pthread_spin_trylock(lock: *mut pthread_spinlock_t) -> c_int;
+
+ pub fn pthread_spin_unlock(lock: *mut pthread_spinlock_t) -> c_int;
+
+ pub fn pthread_setschedprio(native: pthread_t, priority: c_int) -> c_int;
+
+ pub fn pthread_once(pot: *mut pthread_once_t, f: Option<once_fn>) -> c_int;
+
+ pub fn pthread_equal(p1: pthread_t, p2: pthread_t) -> c_int;
+
+ pub fn pthread_mutexattr_setprotocol(a: *mut pthread_mutexattr_t, protocol: c_int) -> c_int;
+
+ pub fn pthread_attr_setstack(
+ attr: *mut pthread_attr_t,
+ stack: *mut c_void,
+ size: size_t,
+ ) -> c_int;
+
+ pub fn pthread_setaffinity_np(td: pthread_t, size: size_t, set: *const cpu_set_t) -> c_int;
+
+ pub fn pthread_getaffinity_np(td: pthread_t, size: size_t, set: *mut cpu_set_t) -> c_int;
+
+ // stdio.h
+ pub fn printf(fmt: *const c_char, ...) -> c_int;
+
+ pub fn scanf(fmt: *const c_char, ...) -> c_int;
+
+ pub fn snprintf(s: *mut c_char, n: size_t, fmt: *const c_char, ...) -> c_int;
+
+ pub fn sprintf(s: *mut c_char, fmt: *const c_char, ...) -> c_int;
+
+ pub fn vsnprintf(s: *mut c_char, n: size_t, fmt: *const c_char, ap: va_list) -> c_int;
+
+ pub fn vsprintf(s: *mut c_char, fmt: *const c_char, ap: va_list) -> c_int;
+
+ // Not available.
+ //pub fn pthread_setname_np(thread: pthread_t, name: *const c_char) -> c_int;
+
+ pub fn abort() -> !;
+
+ // Not available.
+ //pub fn prctl(op: 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;
+
+ // sysconf is currently only implemented as a stub.
+ pub fn sysconf(name: c_int) -> c_long;
+
+ // mman.h
+ pub fn mmap(
+ addr: *mut c_void,
+ len: size_t,
+ prot: c_int,
+ flags: c_int,
+ fd: c_int,
+ offset: off_t,
+ ) -> *mut c_void;
+ pub fn munmap(addr: *mut c_void, len: size_t) -> c_int;
+
+ // errno.h
+ pub fn __errno_location() -> *mut c_int;
+
+ pub fn strerror(e: c_int) -> *mut c_char;
+
+ // time.h
+ pub fn clock_gettime(clock_id: clockid_t, tp: *mut timespec) -> c_int;
+
+ // unistd
+ pub fn getpid() -> pid_t;
+
+ // time
+ pub fn gettimeofday(tv: *mut timeval, tz: *mut c_void) -> c_int;
+
+ pub fn strftime(
+ restrict: *mut c_char,
+ sz: size_t,
+ _restrict: *const c_char,
+ __restrict: *const tm,
+ ) -> size_t;
+
+ pub fn time(t: *mut time_t) -> time_t;
+
+ // sem
+ pub fn sem_close(sem: *mut sem_t) -> c_int;
+
+ pub fn sem_destroy(sem: *mut sem_t) -> c_int;
+
+ pub fn sem_getvalue(sem: *mut sem_t, valp: *mut c_int) -> c_int;
+
+ pub fn sem_init(sem: *mut sem_t, pshared: c_int, value: c_uint) -> c_int;
+
+ pub fn sem_open(name: *const c_char, flags: c_int, ...) -> *mut sem_t;
+
+ pub fn sem_post(sem: *mut sem_t) -> c_int;
+
+ pub fn sem_unlink(name: *const c_char) -> c_int;
+
+ pub fn sem_wait(sem: *mut sem_t) -> c_int;
+
+ // locale
+ pub fn setlocale(cat: c_int, name: *const c_char) -> *mut c_char;
+
+ pub fn strcoll(l: *const c_char, r: *const c_char) -> c_int;
+
+ pub fn strxfrm(dest: *mut c_char, src: *const c_char, n: size_t) -> size_t;
+
+ pub fn strtod(s: *const c_char, p: *mut *mut c_char) -> c_double;
+
+ // multibyte
+ pub fn mbrtowc(wc: *mut wchar_t, src: *const c_char, n: size_t, st: *mut mbstate_t) -> size_t;
+
+ pub fn wcrtomb(s: *mut c_char, wc: wchar_t, st: *mut mbstate_t) -> size_t;
+
+ pub fn wctob(c: wint_t) -> c_int;
+
+ // prng
+ pub fn srandom(seed: c_uint);
+
+ pub fn initstate(seed: c_uint, state: *mut c_char, size: size_t) -> *mut c_char;
+
+ pub fn setstate(state: *mut c_char) -> *mut c_char;
+
+ pub fn random() -> c_long;
+
+ // string
+ pub fn strchr(s: *const c_char, c: c_int) -> *mut c_char;
+
+ pub fn strlen(cs: *const c_char) -> size_t;
+
+ pub fn strcmp(l: *const c_char, r: *const c_char) -> c_int;
+
+ pub fn strcpy(dest: *mut c_char, src: *const c_char) -> *mut c_char;
+
+ pub fn strncmp(_l: *const c_char, r: *const c_char, n: size_t) -> c_int;
+
+ pub fn strncpy(dest: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
+
+ pub fn strnlen(cs: *const c_char, n: size_t) -> size_t;
+
+ pub fn strrchr(s: *const c_char, c: c_int) -> *mut c_char;
+
+ pub fn strstr(h: *const c_char, n: *const c_char) -> *mut c_char;
+
+ pub fn wcschr(s: *const wchar_t, c: wchar_t) -> *mut wchar_t;
+
+ pub fn wcslen(s: *const wchar_t) -> size_t;
+
+ // ctype
+ pub fn isalpha(c: c_int) -> c_int;
+
+ pub fn isascii(c: c_int) -> c_int;
+
+ pub fn isdigit(c: c_int) -> c_int;
+
+ pub fn islower(c: c_int) -> c_int;
+
+ pub fn isprint(c: c_int) -> c_int;
+
+ pub fn isspace(c: c_int) -> c_int;
+
+ pub fn iswctype(wc: wint_t, ttype: wctype_t) -> c_int;
+
+ pub fn iswdigit(wc: wint_t) -> c_int;
+
+ pub fn iswlower(wc: wint_t) -> c_int;
+
+ pub fn iswspace(wc: wint_t) -> c_int;
+
+ pub fn iswupper(wc: wint_t) -> c_int;
+
+ pub fn towupper(wc: wint_t) -> wint_t;
+
+ pub fn towlower(wc: wint_t) -> wint_t;
+
+ // cmath
+ pub fn atan(x: c_double) -> c_double;
+
+ pub fn ceil(x: c_double) -> c_double;
+
+ pub fn ceilf(x: c_float) -> c_float;
+
+ pub fn exp(x: c_double) -> c_double;
+
+ pub fn fabs(x: c_double) -> c_double;
+
+ pub fn floor(x: c_double) -> c_double;
+
+ pub fn frexp(x: c_double, e: *mut c_int) -> c_double;
+
+ pub fn log(x: c_double) -> c_double;
+
+ pub fn log2(x: c_double) -> c_double;
+
+ pub fn pow(x: c_double, y: c_double) -> c_double;
+
+ pub fn roundf(x: c_float) -> c_float;
+
+ pub fn scalbn(x: c_double, n: c_int) -> c_double;
+
+ pub fn sqrt(x: c_double) -> c_double;
+
+ // stdlib
+ pub fn abs(x: c_int) -> c_int;
+
+ pub fn atof(s: *const c_char) -> c_double;
+
+ pub fn atoi(s: *const c_char) -> c_int;
+
+ pub fn atol(s: *const c_char) -> c_long;
+
+ pub fn atoll(s: *const c_char) -> c_longlong;
+
+ pub fn bsearch(
+ key: *const c_void,
+ base: *const c_void,
+ nel: size_t,
+ width: size_t,
+ cmp: cmpfunc,
+ ) -> *mut c_void;
+
+ pub fn div(num: c_int, den: c_int) -> div_t;
+
+ pub fn ecvt(x: c_double, n: c_int, dp: *mut c_int, sign: *mut c_int) -> *mut c_char;
+
+ pub fn imaxabs(a: intmax_t) -> intmax_t;
+
+ pub fn llabs(a: c_longlong) -> c_longlong;
+
+ pub fn qsort(base: *mut c_void, nel: size_t, width: size_t, cmp: cmpfunc);
+
+ pub fn strtoul(s: *const c_char, p: *mut *mut c_char, base: c_int) -> c_ulong;
+
+ pub fn strtol(s: *const c_char, p: *mut *mut c_char, base: c_int) -> c_long;
+
+ pub fn wcstod(s: *const wchar_t, p: *mut *mut wchar_t) -> c_double;
+}
+
+pub fn errno() -> c_int {
+ unsafe { *__errno_location() }
+}
+
+pub fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> c_int {
+ let mut s: u32 = 0;
+ let size_of_mask = core::mem::size_of_val(&cpuset.bits[0]);
+
+ for i in cpuset.bits[..(size / size_of_mask)].iter() {
+ s += i.count_ones();
+ }
+ s as c_int
+}
+
+pub fn CPU_COUNT(cpuset: &cpu_set_t) -> c_int {
+ CPU_COUNT_S(core::mem::size_of::<cpu_set_t>(), cpuset)
+}
diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs
index 325d7d65..0d7c2ed1 100644
--- a/src/unix/aix/mod.rs
+++ b/src/unix/aix/mod.rs
@@ -1,7 +1,6 @@
pub type c_char = i8;
pub type caddr_t = *mut ::c_char;
-// FIXME: clockid_t must be c_long, but time.rs accepts only i32
-pub type clockid_t = ::c_int;
+pub type clockid_t = ::c_longlong;
pub type blkcnt_t = ::c_long;
pub type clock_t = ::c_int;
pub type daddr_t = ::c_long;
@@ -1762,6 +1761,7 @@ pub const PRIO_USER: ::c_int = 2;
pub const RUSAGE_THREAD: ::c_int = 1;
pub const RLIM_SAVED_MAX: ::c_ulong = RLIM_INFINITY - 1;
pub const RLIM_SAVED_CUR: ::c_ulong = RLIM_INFINITY - 2;
+#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::c_int = 10;
// sys/sched.h
@@ -2669,6 +2669,7 @@ extern "C" {
attr: *const ::pthread_attr_t,
guardsize: *mut ::size_t,
) -> ::c_int;
+ pub fn pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::size_t) -> ::c_int;
pub fn pthread_attr_getschedparam(
attr: *const ::pthread_attr_t,
param: *mut sched_param,
@@ -3273,7 +3274,13 @@ extern "C" {
pub fn splice(socket1: ::c_int, socket2: ::c_int, flags: ::c_int) -> ::c_int;
pub fn srand(seed: ::c_uint);
pub fn srand48(seed: ::c_long);
- pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
+ pub fn stat64(path: *const ::c_char, buf: *mut stat64) -> ::c_int;
+ pub fn stat64at(
+ dirfd: ::c_int,
+ path: *const ::c_char,
+ buf: *mut stat64,
+ flags: ::c_int,
+ ) -> ::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 statvfs64(path: *const ::c_char, buf: *mut statvfs64) -> ::c_int;
diff --git a/src/unix/bsd/apple/b64/aarch64/align.rs b/src/unix/bsd/apple/b64/aarch64/align.rs
index 29db97ec..131e15b6 100644
--- a/src/unix/bsd/apple/b64/aarch64/align.rs
+++ b/src/unix/bsd/apple/b64/aarch64/align.rs
@@ -15,7 +15,6 @@ s! {
pub uc_link: *mut ::ucontext_t,
pub uc_mcsize: usize,
pub uc_mcontext: mcontext_t,
- __mcontext_data: __darwin_mcontext64,
}
pub struct __darwin_mcontext64 {
diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index c6f254ea..21efb23e 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -145,6 +145,16 @@ pub type CCRNGStatus = ::CCCryptorStatus;
pub type copyfile_state_t = *mut ::c_void;
pub type copyfile_flags_t = u32;
+pub type copyfile_callback_t = ::Option<
+ extern "C" fn(
+ ::c_int,
+ ::c_int,
+ copyfile_state_t,
+ *const ::c_char,
+ *const ::c_char,
+ *mut ::c_void,
+ ) -> ::c_int,
+>;
pub type attrgroup_t = u32;
pub type vol_capabilities_set_t = [u32; 4];
@@ -368,6 +378,25 @@ s! {
pub fst_bytesalloc: ::off_t,
}
+ pub struct fpunchhole_t {
+ pub fp_flags: ::c_uint, /* unused */
+ pub reserved: ::c_uint, /* (to maintain 8-byte alignment) */
+ pub fp_offset: ::off_t, /* IN: start of the region */
+ pub fp_length: ::off_t, /* IN: size of the region */
+ }
+
+ pub struct ftrimactivefile_t {
+ pub fta_offset: ::off_t,
+ pub fta_length: ::off_t,
+ }
+
+ pub struct fspecread_t {
+ pub fsr_flags: ::c_uint,
+ pub reserved: ::c_uint,
+ pub fsr_offset: ::off_t,
+ pub fsr_length: ::off_t,
+ }
+
pub struct radvisory {
pub ra_offset: ::off_t,
pub ra_count: ::c_int,
@@ -768,7 +797,7 @@ s! {
pub struct sockaddr_ndrv {
pub snd_len: ::c_uchar,
pub snd_family: ::c_uchar,
- pub snd_name: [::c_uchar; 16] // IFNAMSIZ from if.h
+ pub snd_name: [::c_uchar; ::IFNAMSIZ],
}
// sys/socket.h
@@ -1100,6 +1129,15 @@ s! {
pub validattr: attribute_set_t,
pub nativeattr: attribute_set_t,
}
+
+ #[cfg_attr(libc_packedN, repr(packed(4)))]
+ pub struct ifconf {
+ pub ifc_len: ::c_int,
+ #[cfg(libc_union)]
+ pub ifc_ifcu: __c_anonymous_ifc_ifcu,
+ #[cfg(not(libc_union))]
+ pub ifc_ifcu: *mut ifreq,
+ }
}
s_no_extra_traits! {
@@ -1390,6 +1428,60 @@ s_no_extra_traits! {
pub svm_port: ::c_uint,
pub svm_cid: ::c_uint,
}
+
+ pub struct ifdevmtu {
+ pub ifdm_current: ::c_int,
+ pub ifdm_min: ::c_int,
+ pub ifdm_max: ::c_int,
+ }
+
+ #[cfg(libc_union)]
+ pub union __c_anonymous_ifk_data {
+ pub ifk_ptr: *mut ::c_void,
+ pub ifk_value: ::c_int,
+ }
+
+ #[cfg_attr(libc_packedN, repr(packed(4)))]
+ pub struct ifkpi {
+ pub ifk_module_id: ::c_uint,
+ pub ifk_type: ::c_uint,
+ #[cfg(libc_union)]
+ pub ifk_data: __c_anonymous_ifk_data,
+ }
+
+ #[cfg(libc_union)]
+ pub union __c_anonymous_ifr_ifru {
+ pub ifru_addr: ::sockaddr,
+ pub ifru_dstaddr: ::sockaddr,
+ pub ifru_broadaddr: ::sockaddr,
+ pub ifru_flags: ::c_short,
+ pub ifru_metrics: ::c_int,
+ pub ifru_mtu: ::c_int,
+ pub ifru_phys: ::c_int,
+ pub ifru_media: ::c_int,
+ pub ifru_intval: ::c_int,
+ pub ifru_data: *mut ::c_char,
+ pub ifru_devmtu: ifdevmtu,
+ pub ifru_kpi: ifkpi,
+ pub ifru_wake_flags: u32,
+ pub ifru_route_refcnt: u32,
+ pub ifru_cap: [::c_int; 2],
+ pub ifru_functional_type: u32,
+ }
+
+ pub struct ifreq {
+ pub ifr_name: [::c_char; ::IFNAMSIZ],
+ #[cfg(libc_union)]
+ pub ifr_ifru: __c_anonymous_ifr_ifru,
+ #[cfg(not(libc_union))]
+ pub ifr_ifru: ::sockaddr,
+ }
+
+ #[cfg(libc_union)]
+ pub union __c_anonymous_ifc_ifcu {
+ pub ifcu_buf: *mut ::c_char,
+ pub ifcu_req: *mut ifreq,
+ }
}
impl siginfo_t {
@@ -2738,6 +2830,222 @@ cfg_if! {
svm_cid.hash(state);
}
}
+
+ impl PartialEq for ifdevmtu {
+ fn eq(&self, other: &ifdevmtu) -> bool {
+ self.ifdm_current == other.ifdm_current
+ && self.ifdm_min == other.ifdm_min
+ && self.ifdm_max == other.ifdm_max
+ }
+ }
+
+ impl Eq for ifdevmtu {}
+
+ impl ::fmt::Debug for ifdevmtu {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("ifdevmtu")
+ .field("ifdm_current", &self.ifdm_current)
+ .field("ifdm_min", &self.ifdm_min)
+ .field("ifdm_max", &self.ifdm_max)
+ .finish()
+ }
+ }
+
+ impl ::hash::Hash for ifdevmtu {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.ifdm_current.hash(state);
+ self.ifdm_min.hash(state);
+ self.ifdm_max.hash(state);
+ }
+ }
+
+ #[cfg(libc_union)]
+ impl PartialEq for __c_anonymous_ifk_data {
+ fn eq(&self, other: &__c_anonymous_ifk_data) -> bool {
+ unsafe {
+ self.ifk_ptr == other.ifk_ptr
+ && self.ifk_value == other.ifk_value
+ }
+ }
+ }
+
+ #[cfg(libc_union)]
+ impl Eq for __c_anonymous_ifk_data {}
+
+ #[cfg(libc_union)]
+ impl ::fmt::Debug for __c_anonymous_ifk_data {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("__c_anonymous_ifk_data")
+ .field("ifk_ptr", unsafe { &self.ifk_ptr })
+ .field("ifk_value", unsafe { &self.ifk_value })
+ .finish()
+ }
+ }
+ #[cfg(libc_union)]
+ impl ::hash::Hash for __c_anonymous_ifk_data {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ unsafe {
+ self.ifk_ptr.hash(state);
+ self.ifk_value.hash(state);
+ }
+ }
+ }
+
+ impl PartialEq for ifkpi {
+ fn eq(&self, other: &ifkpi) -> bool {
+ self.ifk_module_id == other.ifk_module_id
+ && self.ifk_type == other.ifk_type
+ }
+ }
+
+ impl Eq for ifkpi {}
+
+ impl ::fmt::Debug for ifkpi {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("ifkpi")
+ .field("ifk_module_id", &self.ifk_module_id)
+ .field("ifk_type", &self.ifk_type)
+ .finish()
+ }
+ }
+
+ impl ::hash::Hash for ifkpi {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.ifk_module_id.hash(state);
+ self.ifk_type.hash(state);
+ }
+ }
+
+ #[cfg(libc_union)]
+ impl PartialEq for __c_anonymous_ifr_ifru {
+ fn eq(&self, other: &__c_anonymous_ifr_ifru) -> bool {
+ unsafe {
+ self.ifru_addr == other.ifru_addr
+ && self.ifru_dstaddr == other.ifru_dstaddr
+ && self.ifru_broadaddr == other.ifru_broadaddr
+ && self.ifru_flags == other.ifru_flags
+ && self.ifru_metrics == other.ifru_metrics
+ && self.ifru_mtu == other.ifru_mtu
+ && self.ifru_phys == other.ifru_phys
+ && self.ifru_media == other.ifru_media
+ && self.ifru_intval == other.ifru_intval
+ && self.ifru_data == other.ifru_data
+ && self.ifru_devmtu == other.ifru_devmtu
+ && self.ifru_kpi == other.ifru_kpi
+ && self.ifru_wake_flags == other.ifru_wake_flags
+ && self.ifru_route_refcnt == other.ifru_route_refcnt
+ && self.ifru_cap.iter().zip(other.ifru_cap.iter()).all(|(a,b)| a == b)
+ && self.ifru_functional_type == other.ifru_functional_type
+ }
+ }
+ }
+
+ #[cfg(libc_union)]
+ impl Eq for __c_anonymous_ifr_ifru {}
+
+ #[cfg(libc_union)]
+ impl ::fmt::Debug for __c_anonymous_ifr_ifru {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("__c_anonymous_ifr_ifru")
+ .field("ifru_addr", unsafe { &self.ifru_addr })
+ .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr })
+ .field("ifru_broadaddr", unsafe { &self.ifru_broadaddr })
+ .field("ifru_flags", unsafe { &self.ifru_flags })
+ .field("ifru_metrics", unsafe { &self.ifru_metrics })
+ .field("ifru_mtu", unsafe { &self.ifru_mtu })
+ .field("ifru_phys", unsafe { &self.ifru_phys })
+ .field("ifru_media", unsafe { &self.ifru_media })
+ .field("ifru_intval", unsafe { &self.ifru_intval })
+ .field("ifru_data", unsafe { &self.ifru_data })
+ .field("ifru_devmtu", unsafe { &self.ifru_devmtu })
+ .field("ifru_kpi", unsafe { &self.ifru_kpi })
+ .field("ifru_wake_flags", unsafe { &self.ifru_wake_flags })
+ .field("ifru_route_refcnt", unsafe { &self.ifru_route_refcnt })
+ .field("ifru_cap", unsafe { &self.ifru_cap })
+ .field("ifru_functional_type", unsafe { &self.ifru_functional_type })
+ .finish()
+ }
+ }
+
+ #[cfg(libc_union)]
+ impl ::hash::Hash for __c_anonymous_ifr_ifru {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ unsafe {
+ self.ifru_addr.hash(state);
+ self.ifru_dstaddr.hash(state);
+ self.ifru_broadaddr.hash(state);
+ self.ifru_flags.hash(state);
+ self.ifru_metrics.hash(state);
+ self.ifru_mtu.hash(state);
+ self.ifru_phys.hash(state);
+ self.ifru_media.hash(state);
+ self.ifru_intval.hash(state);
+ self.ifru_data.hash(state);
+ self.ifru_devmtu.hash(state);
+ self.ifru_kpi.hash(state);
+ self.ifru_wake_flags.hash(state);
+ self.ifru_route_refcnt.hash(state);
+ self.ifru_cap.hash(state);
+ self.ifru_functional_type.hash(state);
+ }
+ }
+ }
+
+ impl PartialEq for ifreq {
+ fn eq(&self, other: &ifreq) -> bool {
+ self.ifr_name == other.ifr_name
+ && self.ifr_ifru == other.ifr_ifru
+ }
+ }
+
+ impl Eq for ifreq {}
+
+ impl ::fmt::Debug for ifreq {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("ifreq")
+ .field("ifr_name", &self.ifr_name)
+ .field("ifr_ifru", &self.ifr_ifru)
+ .finish()
+ }
+ }
+
+ impl ::hash::Hash for ifreq {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.ifr_name.hash(state);
+ self.ifr_ifru.hash(state);
+ }
+ }
+
+ #[cfg(libc_union)]
+ impl Eq for __c_anonymous_ifc_ifcu {}
+
+ #[cfg(libc_union)]
+ impl PartialEq for __c_anonymous_ifc_ifcu {
+ fn eq(&self, other: &__c_anonymous_ifc_ifcu) -> bool {
+ unsafe {
+ self.ifcu_buf == other.ifcu_buf &&
+ self.ifcu_req == other.ifcu_req
+ }
+ }
+ }
+
+ #[cfg(libc_union)]
+ impl ::fmt::Debug for __c_anonymous_ifc_ifcu {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("ifc_ifcu")
+ .field("ifcu_buf", unsafe { &self.ifcu_buf })
+ .field("ifcu_req", unsafe { &self.ifcu_req })
+ .finish()
+ }
+ }
+
+ #[cfg(libc_union)]
+ impl ::hash::Hash for __c_anonymous_ifc_ifcu {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ unsafe { self.ifcu_buf.hash(state) };
+ unsafe { self.ifcu_req.hash(state) };
+ }
+ }
}
}
@@ -3231,6 +3539,9 @@ pub const F_GLOBAL_NOCACHE: ::c_int = 55;
pub const F_NODIRECT: ::c_int = 62;
pub const F_LOG2PHYS_EXT: ::c_int = 65;
pub const F_BARRIERFSYNC: ::c_int = 85;
+pub const F_PUNCHHOLE: ::c_int = 99;
+pub const F_TRIM_ACTIVE_FILE: ::c_int = 100;
+pub const F_SPECULATIVE_READ: ::c_int = 101;
pub const F_GETPATH_NOFIRMLINK: ::c_int = 102;
pub const F_ALLOCATECONTIG: ::c_uint = 0x02;
@@ -4189,6 +4500,7 @@ pub const RTLD_FIRST: ::c_int = 0x100;
pub const RTLD_NODELETE: ::c_int = 0x80;
pub const RTLD_NOLOAD: ::c_int = 0x10;
pub const RTLD_GLOBAL: ::c_int = 0x8;
+pub const RTLD_MAIN_ONLY: *mut ::c_void = -5isize as *mut ::c_void;
pub const _WSTOPPED: ::c_int = 0o177;
@@ -4686,12 +4998,12 @@ pub const MNT_SNAPSHOT: ::c_int = 0x40000000;
pub const MNT_NOBLOCK: ::c_int = 0x00020000;
// sys/spawn.h:
-pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
-pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
-pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x04;
-pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x08;
-pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x40;
-pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x80;
+pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x0001;
+pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x0002;
+pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x0004;
+pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x0008;
+pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x0040;
+pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x0080;
pub const POSIX_SPAWN_CLOEXEC_DEFAULT: ::c_int = 0x4000;
// sys/ipc.h:
@@ -4910,6 +5222,19 @@ pub const COPYFILE_PROGRESS: ::c_int = 4;
pub const COPYFILE_CONTINUE: ::c_int = 0;
pub const COPYFILE_SKIP: ::c_int = 1;
pub const COPYFILE_QUIT: ::c_int = 2;
+pub const COPYFILE_STATE_SRC_FD: ::c_int = 1;
+pub const COPYFILE_STATE_SRC_FILENAME: ::c_int = 2;
+pub const COPYFILE_STATE_DST_FD: ::c_int = 3;
+pub const COPYFILE_STATE_DST_FILENAME: ::c_int = 4;
+pub const COPYFILE_STATE_QUARANTINE: ::c_int = 5;
+pub const COPYFILE_STATE_STATUS_CB: ::c_int = 6;
+pub const COPYFILE_STATE_STATUS_CTX: ::c_int = 7;
+pub const COPYFILE_STATE_COPIED: ::c_int = 8;
+pub const COPYFILE_STATE_XATTRNAME: ::c_int = 9;
+pub const COPYFILE_STATE_WAS_CLONED: ::c_int = 10;
+pub const COPYFILE_STATE_SRC_BSIZE: ::c_int = 11;
+pub const COPYFILE_STATE_DST_BSIZE: ::c_int = 12;
+pub const COPYFILE_STATE_BSIZE: ::c_int = 13;
// <sys/attr.h>
pub const ATTR_BIT_MAP_COUNT: ::c_ushort = 5;
@@ -5733,6 +6058,18 @@ extern "C" {
subpref: *mut ::cpu_subtype_t,
ocount: *mut ::size_t,
) -> ::c_int;
+ pub fn posix_spawnattr_getbinpref_np(
+ attr: *const posix_spawnattr_t,
+ count: ::size_t,
+ pref: *mut ::cpu_type_t,
+ ocount: *mut ::size_t,
+ ) -> ::c_int;
+ pub fn posix_spawnattr_setbinpref_np(
+ attr: *mut posix_spawnattr_t,
+ count: ::size_t,
+ pref: *mut ::cpu_type_t,
+ ocount: *mut ::size_t,
+ ) -> ::c_int;
pub fn posix_spawnattr_set_qos_class_np(
attr: *mut posix_spawnattr_t,
qos_class: ::qos_class_t,
@@ -5818,6 +6155,10 @@ extern "C" {
state: copyfile_state_t,
flags: copyfile_flags_t,
) -> ::c_int;
+ pub fn copyfile_state_free(s: copyfile_state_t) -> ::c_int;
+ pub fn copyfile_state_alloc() -> copyfile_state_t;
+ pub fn copyfile_state_get(s: copyfile_state_t, flags: u32, dst: *mut ::c_void) -> ::c_int;
+ pub fn copyfile_state_set(s: copyfile_state_t, flags: u32, src: *const ::c_void) -> ::c_int;
// Added in macOS 10.13
// ISO/IEC 9899:2011 ("ISO C11") K.3.7.4.1
@@ -6058,6 +6399,20 @@ extern "C" {
pub fn dirname(path: *mut ::c_char) -> *mut ::c_char;
pub fn basename(path: *mut ::c_char) -> *mut ::c_char;
+
+ pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int;
+ pub fn mknodat(
+ dirfd: ::c_int,
+ pathname: *const ::c_char,
+ mode: ::mode_t,
+ dev: dev_t,
+ ) -> ::c_int;
+ pub fn freadlink(fd: ::c_int, buf: *mut ::c_char, size: ::size_t) -> ::c_int;
+ pub fn execvP(
+ file: *const ::c_char,
+ search_path: *const ::c_char,
+ argv: *const *mut ::c_char,
+ ) -> ::c_int;
}
pub unsafe fn mach_task_self() -> ::mach_port_t {
@@ -6072,7 +6427,7 @@ cfg_if! {
}
}
cfg_if! {
- if #[cfg(any(target_os = "macos", target_os = "ios"))] {
+ if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))] {
extern "C" {
pub fn memmem(
haystack: *const ::c_void,
diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
index b3a5be44..6ade7949 100644
--- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -1678,6 +1678,12 @@ extern "C" {
pub fn dirname(path: *mut ::c_char) -> *mut ::c_char;
pub fn basename(path: *mut ::c_char) -> *mut ::c_char;
+ pub fn getmntinfo(mntbufp: *mut *mut ::statfs, flags: ::c_int) -> ::c_int;
+ pub fn getmntvinfo(
+ mntbufp: *mut *mut ::statfs,
+ mntvbufp: *mut *mut ::statvfs,
+ flags: ::c_int,
+ ) -> ::c_int;
}
#[link(name = "rt")]
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index 4138af57..c654ae42 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -365,9 +365,13 @@ s! {
}
pub struct cpuset_t {
- #[cfg(target_pointer_width = "64")]
+ #[cfg(all(freebsd14, target_pointer_width = "64"))]
+ __bits: [::c_long; 16],
+ #[cfg(all(freebsd14, target_pointer_width = "32"))]
+ __bits: [::c_long; 32],
+ #[cfg(all(not(freebsd14), target_pointer_width = "64"))]
__bits: [::c_long; 4],
- #[cfg(target_pointer_width = "32")]
+ #[cfg(all(not(freebsd14), target_pointer_width = "32"))]
__bits: [::c_long; 8],
}
@@ -967,6 +971,8 @@ s! {
pub ifc_len: ::c_int,
#[cfg(libc_union)]
pub ifc_ifcu: __c_anonymous_ifc_ifcu,
+ #[cfg(not(libc_union))]
+ pub ifc_ifcu: *mut ifreq,
}
pub struct au_mask_t {
@@ -996,6 +1002,8 @@ s! {
pub pcbcnt: u32,
}
+ // Note: this structure will change in a backwards-incompatible way in
+ // FreeBSD 15.
pub struct tcp_info {
pub tcpi_state: u8,
pub __tcpi_ca_state: u8,
@@ -1053,7 +1061,21 @@ s! {
#[cfg(freebsd14)]
pub __tcpi_received_ce_bytes: u32,
#[cfg(freebsd14)]
- pub __tcpi_pad: [u32; 19],
+ pub tcpi_total_tlp: u32,
+ #[cfg(freebsd14)]
+ pub tcpi_total_tlp_bytes: u64,
+ #[cfg(freebsd14)]
+ pub tcpi_snd_una: u32,
+ #[cfg(freebsd14)]
+ pub tcpi_snd_max: u32,
+ #[cfg(freebsd14)]
+ pub tcpi_rcv_numsacks: u32,
+ #[cfg(freebsd14)]
+ pub tcpi_rcv_adv: u32,
+ #[cfg(freebsd14)]
+ pub tcpi_dupacks: u32,
+ #[cfg(freebsd14)]
+ pub __tcpi_pad: [u32; 10],
#[cfg(not(freebsd14))]
pub __tcpi_pad: [u32; 26],
}
@@ -2597,7 +2619,13 @@ pub const DEVSTAT_N_TRANS_FLAGS: ::c_int = 4;
pub const DEVSTAT_NAME_LEN: ::c_int = 16;
// sys/cpuset.h
-pub const CPU_SETSIZE: ::c_int = 256;
+cfg_if! {
+ if #[cfg(freebsd14)] {
+ pub const CPU_SETSIZE: ::c_int = 1024;
+ } else {
+ pub const CPU_SETSIZE: ::c_int = 256;
+ }
+}
pub const SIGEV_THREAD_ID: ::c_int = 4;
@@ -2664,7 +2692,9 @@ pub const Q_SETQUOTA: ::c_int = 0x800;
pub const MAP_GUARD: ::c_int = 0x00002000;
pub const MAP_EXCL: ::c_int = 0x00004000;
pub const MAP_PREFAULT_READ: ::c_int = 0x00040000;
-pub const MAP_ALIGNED_SUPER: ::c_int = 1 << 24;
+pub const MAP_ALIGNMENT_SHIFT: ::c_int = 24;
+pub const MAP_ALIGNMENT_MASK: ::c_int = 0xff << MAP_ALIGNMENT_SHIFT;
+pub const MAP_ALIGNED_SUPER: ::c_int = 1 << MAP_ALIGNMENT_SHIFT;
pub const POSIX_FADV_NORMAL: ::c_int = 0;
pub const POSIX_FADV_RANDOM: ::c_int = 1;
@@ -3168,6 +3198,7 @@ pub const IFF_LOOPBACK: ::c_int = 0x8;
/// (i) is a point-to-point link
pub const IFF_POINTOPOINT: ::c_int = 0x10;
/// (i) calls if_input in net epoch
+#[deprecated(since = "0.2.149", note = "Removed in FreeBSD 14")]
pub const IFF_KNOWSEPOCH: ::c_int = 0x20;
/// (d) resources allocated
pub const IFF_RUNNING: ::c_int = 0x40;
@@ -3215,6 +3246,7 @@ pub const IFF_DYING: ::c_int = 0x200000;
/// (n) interface is being renamed
pub const IFF_RENAMING: ::c_int = 0x400000;
/// interface is not part of any groups
+#[deprecated(since = "0.2.149", note = "Removed in FreeBSD 14")]
pub const IFF_NOGROUP: ::c_int = 0x800000;
/// link invalid/unknown
@@ -4693,6 +4725,11 @@ pub const RB_POWERCYCLE: ::c_int = 0x400000;
pub const RB_PROBE: ::c_int = 0x10000000;
pub const RB_MULTIPLE: ::c_int = 0x20000000;
+// sys/timerfd.h
+
+pub const TFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
+pub const TFD_CLOEXEC: ::c_int = O_CLOEXEC;
+
cfg_if! {
if #[cfg(libc_const_extern_fn)] {
pub const fn MAP_ALIGNED(a: ::c_int) -> ::c_int {
@@ -4820,6 +4857,14 @@ f! {
};
::mem::size_of::<sockcred2>() + ::mem::size_of::<::gid_t>() * ngrps
}
+
+ pub fn PROT_MAX(x: ::c_int) -> ::c_int {
+ x << 16
+ }
+
+ pub fn PROT_MAX_EXTRACT(x: ::c_int) -> ::c_int {
+ (x >> 16) & (::PROT_READ | ::PROT_WRITE | ::PROT_EXEC)
+ }
}
safe_f! {
@@ -5406,6 +5451,17 @@ extern "C" {
infotype: *mut ::c_uint,
flags: *mut ::c_int,
) -> ::ssize_t;
+
+ pub fn timerfd_create(clockid: ::c_int, flags: ::c_int) -> ::c_int;
+ pub fn timerfd_gettime(fd: ::c_int, curr_value: *mut itimerspec) -> ::c_int;
+ pub fn timerfd_settime(
+ fd: ::c_int,
+ flags: ::c_int,
+ new_value: *const itimerspec,
+ old_value: *mut itimerspec,
+ ) -> ::c_int;
+ pub fn closefrom(lowfd: ::c_int);
+ pub fn close_range(lowfd: ::c_uint, highfd: ::c_uint, flags: ::c_int) -> ::c_int;
}
#[link(name = "memstat")]
diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs
index fe69ca42..d2cd7794 100644
--- a/src/unix/bsd/freebsdlike/mod.rs
+++ b/src/unix/bsd/freebsdlike/mod.rs
@@ -1590,6 +1590,7 @@ extern "C" {
attr: *const ::pthread_attr_t,
guardsize: *mut ::size_t,
) -> ::c_int;
+ pub fn pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::size_t) -> ::c_int;
pub fn pthread_attr_getstack(
attr: *const ::pthread_attr_t,
stackaddr: *mut *mut ::c_void,
@@ -1645,6 +1646,12 @@ extern "C" {
pub fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> ::c_int;
pub fn pthread_get_name_np(tid: ::pthread_t, name: *mut ::c_char, len: ::size_t);
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
+ pub fn pthread_getname_np(
+ thread: ::pthread_t,
+ buffer: *mut ::c_char,
+ length: ::size_t,
+ ) -> ::c_int;
+ pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;
pub fn pthread_setschedparam(
native: ::pthread_t,
policy: ::c_int,
@@ -1771,6 +1778,17 @@ extern "C" {
len: ::c_int,
) -> ::c_int;
pub fn reboot(howto: ::c_int) -> ::c_int;
+
+ pub fn exect(
+ path: *const ::c_char,
+ argv: *const *mut ::c_char,
+ envp: *const *mut ::c_char,
+ ) -> ::c_int;
+ pub fn execvP(
+ file: *const ::c_char,
+ search_path: *const ::c_char,
+ argv: *const *mut ::c_char,
+ ) -> ::c_int;
}
#[link(name = "rt")]
diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs
index c43a4b9e..a787ac6d 100644
--- a/src/unix/bsd/netbsdlike/mod.rs
+++ b/src/unix/bsd/netbsdlike/mod.rs
@@ -736,6 +736,11 @@ extern "C" {
pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void;
pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
pub fn shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
+ pub fn execvpe(
+ file: *const ::c_char,
+ argv: *const *const ::c_char,
+ envp: *const *const ::c_char,
+ ) -> ::c_int;
}
extern "C" {
diff --git a/src/unix/bsd/netbsdlike/netbsd/mips.rs b/src/unix/bsd/netbsdlike/netbsd/mips.rs
new file mode 100644
index 00000000..a536254c
--- /dev/null
+++ b/src/unix/bsd/netbsdlike/netbsd/mips.rs
@@ -0,0 +1,21 @@
+use PT_FIRSTMACH;
+
+pub type c_long = i32;
+pub type c_ulong = u32;
+pub type c_char = i8;
+pub type __cpu_simple_lock_nv_t = ::c_int;
+
+cfg_if! {
+ if #[cfg(libc_const_size_of)] {
+ #[doc(hidden)]
+ pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
+ } else {
+ #[doc(hidden)]
+ pub const _ALIGNBYTES: usize = 8 - 1;
+ }
+}
+
+pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
+pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;
+pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3;
+pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4;
diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
index 46035df3..c612689a 100644
--- a/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -10,7 +10,7 @@ type __pthread_spin_t = __cpu_simple_lock_nv_t;
pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time
pub type lwpid_t = ::c_uint;
pub type shmatt_t = ::c_uint;
-pub type cpuid_t = u64;
+pub type cpuid_t = ::c_ulong;
pub type cpuset_t = _cpuset;
pub type pthread_spin_t = ::c_uchar;
pub type timer_t = ::c_int;
@@ -60,6 +60,39 @@ impl siginfo_t {
self.si_addr
}
+ pub unsafe fn si_code(&self) -> ::c_int {
+ self.si_code
+ }
+
+ pub unsafe fn si_errno(&self) -> ::c_int {
+ self.si_errno
+ }
+
+ pub unsafe fn si_pid(&self) -> ::pid_t {
+ #[repr(C)]
+ struct siginfo_timer {
+ _si_signo: ::c_int,
+ _si_errno: ::c_int,
+ _si_code: ::c_int,
+ __pad1: ::c_int,
+ _pid: ::pid_t,
+ }
+ (*(self as *const siginfo_t as *const siginfo_timer))._pid
+ }
+
+ pub unsafe fn si_uid(&self) -> ::uid_t {
+ #[repr(C)]
+ struct siginfo_timer {
+ _si_signo: ::c_int,
+ _si_errno: ::c_int,
+ _si_code: ::c_int,
+ __pad1: ::c_int,
+ _pid: ::pid_t,
+ _uid: ::uid_t,
+ }
+ (*(self as *const siginfo_t as *const siginfo_timer))._uid
+ }
+
pub unsafe fn si_value(&self) -> ::sigval {
#[repr(C)]
struct siginfo_timer {
@@ -1527,6 +1560,7 @@ pub const SOCK_FLAGS_MASK: ::c_int = 0xf0000000;
pub const SO_SNDTIMEO: ::c_int = 0x100b;
pub const SO_RCVTIMEO: ::c_int = 0x100c;
+pub const SO_NOSIGPIPE: ::c_int = 0x0800;
pub const SO_ACCEPTFILTER: ::c_int = 0x1000;
pub const SO_TIMESTAMP: ::c_int = 0x2000;
pub const SO_OVERFLOWED: ::c_int = 0x1009;
@@ -1852,6 +1886,9 @@ pub const MNT_NODEVMTIME: ::c_int = 0x40000000;
pub const MNT_SOFTDEP: ::c_int = 0x80000000;
pub const MNT_POSIX1EACLS: ::c_int = 0x00000800;
pub const MNT_ACLS: ::c_int = MNT_POSIX1EACLS;
+pub const MNT_WAIT: ::c_int = 1;
+pub const MNT_NOWAIT: ::c_int = 2;
+pub const MNT_LAZY: ::c_int = 3;
//<sys/timex.h>
pub const NTP_API: ::c_int = 4;
@@ -2529,12 +2566,6 @@ extern "C" {
pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int;
pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
- pub fn execvpe(
- file: *const ::c_char,
- argv: *const *const ::c_char,
- envp: *const *const ::c_char,
- ) -> ::c_int;
-
pub fn extattr_list_fd(
fd: ::c_int,
attrnamespace: ::c_int,
@@ -2727,6 +2758,7 @@ extern "C" {
attr: *const ::pthread_attr_t,
guardsize: *mut ::size_t,
) -> ::c_int;
+ pub fn pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::size_t) -> ::c_int;
pub fn pthread_attr_getstack(
attr: *const ::pthread_attr_t,
stackaddr: *mut *mut ::c_void,
@@ -3153,6 +3185,38 @@ extern "C" {
pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry;
}
+#[link(name = "execinfo")]
+extern "C" {
+ pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
+ pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
+ pub fn backtrace_symbols_fd(
+ addrlist: *const *mut ::c_void,
+ len: ::size_t,
+ fd: ::c_int,
+ ) -> ::c_int;
+ pub fn backtrace_symbols_fmt(
+ addrlist: *const *mut ::c_void,
+ len: ::size_t,
+ fmt: *const ::c_char,
+ ) -> *mut *mut ::c_char;
+ pub fn backtrace_symbols_fd_fmt(
+ addrlist: *const *mut ::c_void,
+ len: ::size_t,
+ fd: ::c_int,
+ fmt: *const ::c_char,
+ ) -> ::c_int;
+}
+
+cfg_if! {
+ if #[cfg(libc_union)] {
+ extern {
+ // these functions use statvfs:
+ pub fn getmntinfo(mntbufp: *mut *mut ::statvfs, flags: ::c_int) -> ::c_int;
+ pub fn getvfsstat(buf: *mut statvfs, bufsize: ::size_t, flags: ::c_int) -> ::c_int;
+ }
+ }
+}
+
cfg_if! {
if #[cfg(target_arch = "aarch64")] {
mod aarch64;
@@ -3172,6 +3236,12 @@ cfg_if! {
} else if #[cfg(target_arch = "x86")] {
mod x86;
pub use self::x86::*;
+ } else if #[cfg(target_arch = "mips")] {
+ mod mips;
+ pub use self::mips::*;
+ } else if #[cfg(target_arch = "riscv64")] {
+ mod riscv64;
+ pub use self::riscv64::*;
} else {
// Unknown target_arch
}
diff --git a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs
new file mode 100644
index 00000000..bc09149e
--- /dev/null
+++ b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs
@@ -0,0 +1,21 @@
+use PT_FIRSTMACH;
+
+pub type c_long = i64;
+pub type c_ulong = u64;
+pub type c_char = u8;
+pub type __cpu_simple_lock_nv_t = ::c_int;
+
+cfg_if! {
+ if #[cfg(libc_const_size_of)] {
+ #[doc(hidden)]
+ pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
+ } else {
+ #[doc(hidden)]
+ pub const _ALIGNBYTES: usize = 8 - 1;
+ }
+}
+
+pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0;
+pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1;
+pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2;
+pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3;
diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs
index 7fe81b3a..ea90ba78 100644
--- a/src/unix/bsd/netbsdlike/openbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs
@@ -533,6 +533,14 @@ s! {
pub key: *mut ::c_char,
pub data: *mut ::c_void,
}
+
+ pub struct ifreq {
+ pub ifr_name: [::c_char; ::IFNAMSIZ],
+ #[cfg(libc_union)]
+ pub ifr_ifru: __c_anonymous_ifr_ifru,
+ #[cfg(not(libc_union))]
+ pub ifr_ifru: ::sockaddr,
+ }
}
impl siginfo_t {
@@ -540,12 +548,46 @@ impl siginfo_t {
self.si_addr
}
- pub unsafe fn si_value(&self) -> ::sigval {
+ pub unsafe fn si_code(&self) -> ::c_int {
+ self.si_code
+ }
+
+ pub unsafe fn si_errno(&self) -> ::c_int {
+ self.si_errno
+ }
+
+ pub unsafe fn si_pid(&self) -> ::pid_t {
+ #[repr(C)]
+ struct siginfo_timer {
+ _si_signo: ::c_int,
+ _si_code: ::c_int,
+ _si_errno: ::c_int,
+ _pad: [::c_int; SI_PAD],
+ _pid: ::pid_t,
+ }
+ (*(self as *const siginfo_t as *const siginfo_timer))._pid
+ }
+
+ pub unsafe fn si_uid(&self) -> ::uid_t {
#[repr(C)]
struct siginfo_timer {
_si_signo: ::c_int,
+ _si_code: ::c_int,
_si_errno: ::c_int,
+ _pad: [::c_int; SI_PAD],
+ _pid: ::pid_t,
+ _uid: ::uid_t,
+ }
+ (*(self as *const siginfo_t as *const siginfo_timer))._uid
+ }
+
+ pub unsafe fn si_value(&self) -> ::sigval {
+ #[repr(C)]
+ struct siginfo_timer {
+ _si_signo: ::c_int,
_si_code: ::c_int,
+ _si_errno: ::c_int,
+ _pad: [::c_int; SI_PAD],
_pid: ::pid_t,
_uid: ::uid_t,
value: ::sigval,
@@ -608,6 +650,18 @@ s_no_extra_traits! {
align: [::c_char; 160],
}
+ #[cfg(libc_union)]
+ pub union __c_anonymous_ifr_ifru {
+ pub ifru_addr: ::sockaddr,
+ pub ifru_dstaddr: ::sockaddr,
+ pub ifru_broadaddr: ::sockaddr,
+ pub ifru_flags: ::c_short,
+ pub ifru_metric: ::c_int,
+ pub ifru_vnetid: i64,
+ pub ifru_media: u64,
+ pub ifru_data: *mut ::c_char,
+ pub ifru_index: ::c_uint,
+ }
}
cfg_if! {
@@ -814,6 +868,60 @@ cfg_if! {
unsafe { self.align.hash(state) };
}
}
+
+ #[cfg(libc_union)]
+ impl PartialEq for __c_anonymous_ifr_ifru {
+ fn eq(&self, other: &__c_anonymous_ifr_ifru) -> bool {
+ unsafe {
+ self.ifru_addr == other.ifru_addr
+ && self.ifru_dstaddr == other.ifru_dstaddr
+ && self.ifru_broadaddr == other.ifru_broadaddr
+ && self.ifru_flags == other.ifru_flags
+ && self.ifru_metric == other.ifru_metric
+ && self.ifru_vnetid == other.ifru_vnetid
+ && self.ifru_media == other.ifru_media
+ && self.ifru_data == other.ifru_data
+ && self.ifru_index == other.ifru_index
+ }
+ }
+ }
+
+ #[cfg(libc_union)]
+ impl Eq for __c_anonymous_ifr_ifru {}
+
+ #[cfg(libc_union)]
+ impl ::fmt::Debug for __c_anonymous_ifr_ifru {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("__c_anonymous_ifr_ifru")
+ .field("ifru_addr", unsafe { &self.ifru_addr })
+ .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr })
+ .field("ifru_broadaddr", unsafe { &self.ifru_broadaddr })
+ .field("ifru_flags", unsafe { &self.ifru_flags })
+ .field("ifru_metric", unsafe { &self.ifru_metric })
+ .field("ifru_vnetid", unsafe { &self.ifru_vnetid })
+ .field("ifru_media", unsafe { &self.ifru_media })
+ .field("ifru_data", unsafe { &self.ifru_data })
+ .field("ifru_index", unsafe { &self.ifru_index })
+ .finish()
+ }
+ }
+
+ #[cfg(libc_union)]
+ impl ::hash::Hash for __c_anonymous_ifr_ifru {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ unsafe {
+ self.ifru_addr.hash(state);
+ self.ifru_dstaddr.hash(state);
+ self.ifru_broadaddr.hash(state);
+ self.ifru_flags.hash(state);
+ self.ifru_metric.hash(state);
+ self.ifru_vnetid.hash(state);
+ self.ifru_media.hash(state);
+ self.ifru_data.hash(state);
+ self.ifru_index.hash(state);
+ }
+ }
+ }
}
}
@@ -999,6 +1107,8 @@ pub const SO_NETPROC: ::c_int = 0x1020;
pub const SO_RTABLE: ::c_int = 0x1021;
pub const SO_PEERCRED: ::c_int = 0x1022;
pub const SO_SPLICE: ::c_int = 0x1023;
+pub const SO_DOMAIN: ::c_int = 0x1024;
+pub const SO_PROTOCOL: ::c_int = 0x1025;
// sys/netinet/in.h
// Protocols (RFC 1700)
@@ -1576,6 +1686,9 @@ pub const NTFS_MFLAG_ALLNAMES: ::c_int = 0x2;
pub const TMPFS_ARGS_VERSION: ::c_int = 1;
+const SI_MAXSZ: ::size_t = 128;
+const SI_PAD: ::size_t = (SI_MAXSZ / ::mem::size_of::<::c_int>()) - 3;
+
pub const MAP_STACK: ::c_int = 0x4000;
pub const MAP_CONCEAL: ::c_int = 0x8000;
@@ -1655,6 +1768,30 @@ pub const SF_ARCHIVED: ::c_uint = 0x00010000;
pub const SF_IMMUTABLE: ::c_uint = 0x00020000;
pub const SF_APPEND: ::c_uint = 0x00040000;
+// sys/exec_elf.h - Legal values for p_type (segment type).
+pub const PT_NULL: u32 = 0;
+pub const PT_LOAD: u32 = 1;
+pub const PT_DYNAMIC: u32 = 2;
+pub const PT_INTERP: u32 = 3;
+pub const PT_NOTE: u32 = 4;
+pub const PT_SHLIB: u32 = 5;
+pub const PT_PHDR: u32 = 6;
+pub const PT_TLS: u32 = 7;
+pub const PT_LOOS: u32 = 0x60000000;
+pub const PT_HIOS: u32 = 0x6fffffff;
+pub const PT_LOPROC: u32 = 0x70000000;
+pub const PT_HIPROC: u32 = 0x7fffffff;
+
+pub const PT_GNU_EH_FRAME: u32 = 0x6474e550;
+pub const PT_GNU_RELRO: u32 = 0x6474e552;
+
+// sys/exec_elf.h - Legal values for p_flags (segment flags).
+pub const PF_X: u32 = 0x1;
+pub const PF_W: u32 = 0x2;
+pub const PF_R: u32 = 0x4;
+pub const PF_MASKOS: u32 = 0x0ff00000;
+pub const PF_MASKPROC: u32 = 0xf0000000;
+
// sys/mount.h
pub const MNT_NOPERM: ::c_int = 0x00000020;
pub const MNT_WXALLOWED: ::c_int = 0x00000800;
@@ -1777,11 +1914,6 @@ safe_f! {
extern "C" {
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
pub fn settimeofday(tp: *const ::timeval, tz: *const ::timezone) -> ::c_int;
- pub fn execvpe(
- file: *const ::c_char,
- argv: *const *const ::c_char,
- envp: *const *const ::c_char,
- ) -> ::c_int;
pub fn pledge(promises: *const ::c_char, execpromises: *const ::c_char) -> ::c_int;
pub fn unveil(path: *const ::c_char, permissions: *const ::c_char) -> ::c_int;
pub fn strtonum(
@@ -1825,6 +1957,7 @@ extern "C" {
attr: *const ::pthread_attr_t,
guardsize: *mut ::size_t,
) -> ::c_int;
+ pub fn pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::size_t) -> ::c_int;
pub fn pthread_attr_getstack(
attr: *const ::pthread_attr_t,
stackaddr: *mut *mut ::c_void,
diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs
index 24aa599c..00e9523c 100644
--- a/src/unix/haiku/mod.rs
+++ b/src/unix/haiku/mod.rs
@@ -741,6 +741,7 @@ pub const RLIMIT_AS: ::c_int = 6;
pub const RLIM_INFINITY: ::rlim_t = 0xffffffff;
// Haiku specific
pub const RLIMIT_NOVMON: ::c_int = 7;
+#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::c_int = 8;
pub const RUSAGE_SELF: ::c_int = 0;
@@ -1679,6 +1680,7 @@ extern "C" {
attr: *const ::pthread_attr_t,
guardsize: *mut ::size_t,
) -> ::c_int;
+ pub fn pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::size_t) -> ::c_int;
pub fn pthread_attr_getstack(
attr: *const ::pthread_attr_t,
stackaddr: *mut *mut ::c_void,
@@ -2063,6 +2065,14 @@ extern "C" {
search: *const ::c_void,
searchLength: ::size_t,
) -> *mut ::c_void;
+
+ pub fn pthread_getattr_np(thread: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int;
+ pub fn pthread_getname_np(
+ thread: ::pthread_t,
+ buffer: *mut ::c_char,
+ length: ::size_t,
+ ) -> ::c_int;
+ pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;
}
cfg_if! {
diff --git a/src/unix/hermit/aarch64.rs b/src/unix/hermit/aarch64.rs
deleted file mode 100644
index 1a92e3b4..00000000
--- a/src/unix/hermit/aarch64.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-pub type c_char = u8;
-pub type wchar_t = u32;
diff --git a/src/unix/hermit/mod.rs b/src/unix/hermit/mod.rs
deleted file mode 100644
index 6a656a85..00000000
--- a/src/unix/hermit/mod.rs
+++ /dev/null
@@ -1,1023 +0,0 @@
-// liblibc port for HermitCore (https://hermitcore.org)
-// HermitCore is a unikernel based on lwIP, newlib, and
-// pthread-embedded.
-// Consider these definitions when porting liblibc to another
-// lwIP/newlib/pte-based target.
-//
-// Ported by Colin Finck <colin.finck@rwth-aachen.de>
-
-pub type c_long = i64;
-pub type c_ulong = u64;
-
-pub type speed_t = ::c_uint;
-pub type mode_t = u32;
-pub type dev_t = i16;
-pub type nfds_t = ::c_ulong;
-pub type socklen_t = u32;
-pub type sa_family_t = u8;
-pub type clock_t = c_ulong;
-pub type time_t = c_long;
-pub type suseconds_t = c_long;
-pub type off_t = i64;
-pub type rlim_t = ::c_ulonglong;
-pub type sigset_t = ::c_ulong;
-pub type ino_t = u16;
-pub type nlink_t = u16;
-pub type blksize_t = c_long;
-pub type blkcnt_t = c_long;
-pub type stat64 = stat;
-pub type clockid_t = c_ulong;
-pub type pthread_t = pte_handle_t;
-pub type pthread_attr_t = usize;
-pub type pthread_cond_t = usize;
-pub type pthread_condattr_t = usize;
-pub type pthread_key_t = usize;
-pub type pthread_mutex_t = usize;
-pub type pthread_mutexattr_t = usize;
-pub type pthread_rwlock_t = usize;
-pub type pthread_rwlockattr_t = usize;
-
-s_no_extra_traits! {
- pub struct dirent {
- pub d_ino: ::c_long,
- pub d_off: off_t,
- pub d_reclen: u16,
- pub d_name: [::c_char; 256],
- }
-
- // Dummy
- pub struct sockaddr_un {
- pub sun_family: sa_family_t,
- pub sun_path: [::c_char; 108],
- }
-
- pub struct sockaddr {
- pub sa_len: u8,
- pub sa_family: sa_family_t,
- pub sa_data: [::c_char; 14],
- }
-
- pub struct sockaddr_in {
- pub sin_len: u8,
- pub sin_family: sa_family_t,
- pub sin_port: ::in_port_t,
- pub sin_addr: ::in_addr,
- pub sin_zero: [::c_char; 8],
- }
-
- pub struct fd_set {
- fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE],
- }
-
- pub struct sockaddr_storage {
- pub s2_len: u8,
- pub ss_family: sa_family_t,
- pub s2_data1: [::c_char; 2],
- pub s2_data2: [u32; 3],
- pub s2_data3: [u32; 3],
- }
-
- 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_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_blksize: blksize_t,
- pub st_blocks: blkcnt_t,
- pub st_spare4: [::c_long; 2],
- }
-}
-
-cfg_if! {
- if #[cfg(feature = "extra_traits")] {
- impl PartialEq for dirent {
- fn eq(&self, other: &dirent) -> bool {
- self.d_ino == other.d_ino
- && self.d_off == other.d_off
- && self.d_reclen == other.d_reclen
- && self
- .d_name
- .iter()
- .zip(other.d_name.iter())
- .all(|(a,b)| a == b)
- }
- }
- impl Eq for dirent {}
- impl ::fmt::Debug for dirent {
- fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
- f.debug_struct("dirent")
- .field("d_ino", &self.d_ino)
- .field("d_off", &self.d_off)
- .field("d_reclen", &self.d_reclen)
- // FIXME: .field("d_name", &self.d_name)
- .finish()
- }
- }
- impl ::hash::Hash for dirent {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- self.d_ino.hash(state);
- self.d_off.hash(state);
- self.d_reclen.hash(state);
- self.d_name.hash(state);
- }
- }
-
- impl PartialEq for sockaddr_un {
- fn eq(&self, other: &sockaddr_un) -> bool {
- self.sun_family == other.sun_family
- && self
- .sun_path
- .iter()
- .zip(other.sun_path.iter())
- .all(|(a,b)| a == b)
- }
- }
- impl Eq for sockaddr_un {}
- impl ::fmt::Debug for sockaddr_un {
- fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
- f.debug_struct("sockaddr_un")
- .field("sun_family", &self.sun_family)
- // FIXME: .field("sun_path", &self.sun_path)
- .finish()
- }
- }
- impl ::hash::Hash for sockaddr_un {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- self.sun_family.hash(state);
- self.sun_path.hash(state);
- }
- }
-
- impl PartialEq for sockaddr {
- fn eq(&self, other: &sockaddr) -> bool {
- self.sa_len == other.sa_len
- && self.sa_family == other.sa_family
- && self
- .sa_data
- .iter()
- .zip(other.sa_data.iter())
- .all(|(a,b)| a == b)
- }
- }
- impl Eq for sockaddr {}
- impl ::fmt::Debug for sockaddr {
- fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
- f.debug_struct("sockaddr")
- .field("sa_len", &self.sa_len)
- .field("sa_family", &self.sa_family)
- // FIXME: .field("sa_data", &self.sa_data)
- .finish()
- }
- }
- impl ::hash::Hash for sockaddr {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- self.sa_len.hash(state);
- self.sa_family.hash(state);
- self.sa_data.hash(state);
- }
- }
-
- impl PartialEq for sockaddr_in {
- fn eq(&self, other: &sockaddr_in) -> bool {
- self.sin_len == other.sin_len
- && self.sin_family == other.sin_family
- && self.sin_port == other.sin_port
- && self.sin_addr == other.sin_addr
- && self
- .sin_zero
- .iter()
- .zip(other.sin_zero.iter())
- .all(|(a,b)| a == b)
- }
- }
- impl Eq for sockaddr_in {}
- impl ::fmt::Debug for sockaddr_in {
- fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
- f.debug_struct("sockaddr_in")
- .field("sin_len", &self.sin_len)
- .field("sin_family", &self.sin_family)
- .field("sin_port", &self.sin_port)
- .field("sin_addr", &self.sin_addr)
- // FIXME: .field("sin_zero", &self.sin_zero)
- .finish()
- }
- }
- impl ::hash::Hash for sockaddr_in {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- self.sin_len.hash(state);
- self.sin_family.hash(state);
- self.sin_port.hash(state);
- self.sin_addr.hash(state);
- self.sin_zero.hash(state);
- }
- }
-
- impl PartialEq for fd_set {
- fn eq(&self, other: &fd_set) -> bool {
- self.fds_bits
- .iter()
- .zip(other.fds_bits.iter())
- .all(|(a,b)| a == b)
- }
- }
- impl Eq for fd_set {}
- impl ::fmt::Debug for fd_set {
- fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
- f.debug_struct("fd_set")
- // FIXME: .field("fds_bits", &self.fds_bits)
- .finish()
- }
- }
- impl ::hash::Hash for fd_set {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- self.fds_bits.hash(state);
- }
- }
-
- impl PartialEq for sockaddr_storage {
- fn eq(&self, other: &sockaddr_storage) -> bool {
- self.s2_len == other.s2_len
- && self.ss_family == other.ss_family
- && self.s2_data1
- .iter()
- .zip(other.s2_data1.iter())
- .all(|(a,b)| a == b)
- && self.s2_data2
- .iter()
- .zip(other.s2_data2.iter())
- .all(|(a,b)| a == b)
- && self.s2_data3
- .iter()
- .zip(other.s2_data3.iter())
- .all(|(a,b)| a == b)
- }
- }
- impl Eq for sockaddr_storage {}
- impl ::fmt::Debug for sockaddr_storage {
- fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
- f.debug_struct("sockaddr_storage")
- .field("s2_len", &self.s2_len)
- .field("ss_family", &self.ss_family)
- // FIXME: .field("s2_data1", &self.s2_data1)
- // FIXME: .field("s2_data2", &self.s2_data2)
- // FIXME: .field("s2_data3", &self.s2_data3)
- .finish()
- }
- }
- impl ::hash::Hash for sockaddr_storage {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- self.s2_len.hash(state);
- self.ss_family.hash(state);
- self.s2_data1.hash(state);
- self.s2_data2.hash(state);
- self.s2_data3.hash(state);
- }
- }
-
- impl PartialEq for stat {
- fn eq(&self, other: &stat) -> bool {
- self.st_dev == other.st_dev
- && self.st_ino == other.st_ino
- && self.st_mode == other.st_mode
- && self.st_nlink == other.st_nlink
- && self.st_uid == other.st_uid
- && self.st_gid == other.st_gid
- && self.st_rdev == other.st_rdev
- && self.st_size == other.st_size
- && self.st_atime == other.st_atime
- && self.st_atime_nsec == other.st_atime_nsec
- && self.st_mtime == other.st_mtime
- && self.st_mtime_nsec == other.st_mtime_nsec
- && self.st_ctime == other.st_ctime
- && self.st_ctime_nsec == other.st_ctime_nsec
- && self.st_blksize == other.st_blksize
- && self.st_blocks == other.st_blocks
- && self
- .st_spare4
- .iter()
- .zip(other.st_spare4.iter())
- .all(|(a,b)| a == b)
- }
- }
- impl Eq for stat {}
- impl ::fmt::Debug for stat {
- fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
- f.debug_struct("stat")
- .field("st_dev", &self.st_dev)
- .field("st_ino", &self.st_ino)
- .field("st_mode", &self.st_mode)
- .field("st_nlink", &self.st_nlink)
- .field("st_uid", &self.st_uid)
- .field("st_gid", &self.st_gid)
- .field("st_rdev", &self.st_rdev)
- .field("st_size", &self.st_size)
- .field("st_atime", &self.st_atime)
- .field("st_atime_nsec", &self.st_atime_nsec)
- .field("st_mtime", &self.st_mtime)
- .field("st_mtime_nsec", &self.st_mtime_nsec)
- .field("st_ctime", &self.st_ctime)
- .field("st_ctime_nsec", &self.st_ctime_nsec)
- .field("st_blksize", &self.st_blksize)
- .field("st_blocks", &self.st_blocks)
- // FIXME: .field("st_spare4", &self.st_spare4)
- .finish()
- }
- }
- impl ::hash::Hash for stat {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- self.st_dev.hash(state);
- self.st_ino.hash(state);
- self.st_mode.hash(state);
- self.st_nlink.hash(state);
- self.st_uid.hash(state);
- self.st_gid.hash(state);
- self.st_rdev.hash(state);
- self.st_size.hash(state);
- self.st_atime.hash(state);
- self.st_atime_nsec.hash(state);
- self.st_mtime.hash(state);
- self.st_mtime_nsec.hash(state);
- self.st_ctime.hash(state);
- self.st_ctime_nsec.hash(state);
- self.st_blksize.hash(state);
- self.st_blocks.hash(state);
- self.st_spare4.hash(state);
- }
- }
- }
-}
-
-s! {
- pub struct in_addr {
- pub s_addr: ::in_addr_t,
- }
-
- pub struct ip_mreq {
- pub imr_multiaddr: in_addr,
- pub imr_interface: in_addr,
- }
-
- 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_addr: *mut ::sockaddr,
- pub ai_canonname: *mut c_char,
- pub ai_next: *mut addrinfo,
- }
-
- pub struct Dl_info {}
-
- pub struct lconv {
- pub decimal_point: *mut ::c_char,
- pub thousands_sep: *mut ::c_char,
- pub grouping: *mut ::c_char,
- pub int_curr_symbol: *mut ::c_char,
- pub currency_symbol: *mut ::c_char,
- pub mon_decimal_point: *mut ::c_char,
- pub mon_thousands_sep: *mut ::c_char,
- pub mon_grouping: *mut ::c_char,
- pub positive_sign: *mut ::c_char,
- pub negative_sign: *mut ::c_char,
- pub int_frac_digits: ::c_char,
- pub frac_digits: ::c_char,
- pub p_cs_precedes: ::c_char,
- pub p_sep_by_space: ::c_char,
- pub n_cs_precedes: ::c_char,
- pub n_sep_by_space: ::c_char,
- pub p_sign_posn: ::c_char,
- pub n_sign_posn: ::c_char,
- pub int_p_cs_precedes: ::c_char,
- pub int_p_sep_by_space: ::c_char,
- pub int_n_cs_precedes: ::c_char,
- pub int_n_sep_by_space: ::c_char,
- pub int_p_sign_posn: ::c_char,
- pub int_n_sign_posn: ::c_char,
- }
-
- pub struct 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 pte_handle_t {
- pub p: usize,
- pub x: ::c_uint,
- }
-
- pub struct sched_param {
- pub sched_priority: ::c_int,
- }
-
- pub struct sem_t {
- pub value: i32,
- pub lock: usize,
- pub sem: usize,
- }
-
- pub struct sigaction {
- pub sa_flags: ::c_int,
- pub sa_mask: sigset_t,
- pub sa_handler: usize,
- }
-
- pub struct sockaddr_in6 {
- pub sin6_len: u8,
- pub sin6_family: sa_family_t,
- pub sin6_port: ::in_port_t,
- pub sin6_flowinfo: u32,
- pub sin6_addr: ::in6_addr,
- pub sin6_scope_id: u32,
- }
-
- pub struct statvfs {}
-
- 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 tms {
- pub tms_utime: ::clock_t,
- pub tms_stime: ::clock_t,
- pub tms_cutime: ::clock_t,
- pub tms_cstime: ::clock_t,
- }
-
- pub struct termios {}
-
- pub struct utsname {}
-}
-
-pub const AF_UNSPEC: ::c_int = 0;
-pub const AF_INET: ::c_int = 2;
-pub const AF_INET6: ::c_int = 10;
-
-// Dummy
-pub const AF_UNIX: ::c_int = 1;
-
-pub const CLOCK_REALTIME: ::clockid_t = 1;
-pub const CLOCK_MONOTONIC: ::clockid_t = 4;
-
-// Dummy
-pub const EAI_SYSTEM: ::c_int = -11;
-
-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 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 EWOULDBLOCK: ::c_int = EAGAIN;
-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 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 EMULTIHOP: ::c_int = 72;
-pub const EDOTDOT: ::c_int = 73;
-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 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 EXIT_FAILURE: ::c_int = 1;
-pub const EXIT_SUCCESS: ::c_int = 0;
-
-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 FD_SETSIZE: usize = 1024;
-
-// Dummy
-pub const FIOCLEX: ::c_int = 0x5451;
-
-pub const FIONBIO: ::c_int = 0x8004667e;
-pub const FIONREAD: ::c_int = 0x4004667f;
-
-pub const IP_ADD_MEMBERSHIP: ::c_int = 3;
-pub const IP_DROP_MEMBERSHIP: ::c_int = 4;
-
-pub const IP_TOS: ::c_int = 1;
-pub const IP_TTL: ::c_int = 2;
-
-pub const IP_MULTICAST_TTL: ::c_int = 5;
-pub const IP_MULTICAST_IF: ::c_int = 6;
-pub const IP_MULTICAST_LOOP: ::c_int = 7;
-
-pub const IPV6_JOIN_GROUP: ::c_int = 12;
-pub const IPV6_ADD_MEMBERSHIP: ::c_int = 12;
-pub const IPV6_LEAVE_GROUP: ::c_int = 13;
-pub const IPV6_DROP_MEMBERSHIP: ::c_int = 13;
-pub const IPV6_V6ONLY: ::c_int = 27;
-
-// Dummy
-pub const IPV6_MULTICAST_LOOP: ::c_int = 7;
-
-pub const MSG_PEEK: ::c_int = 0x01;
-pub const MSG_WAITALL: ::c_int = 0x02;
-pub const MSG_OOB: ::c_int = 0x04;
-pub const MSG_DONTWAIT: ::c_int = 0x08;
-pub const MSG_MORE: ::c_int = 0x10;
-
-pub const O_ACCMODE: ::c_int = 3;
-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 = 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_TRUNC: ::c_int = 512;
-pub const O_CLOEXEC: ::c_int = 524288;
-
-pub const POLLIN: ::c_short = 0x1;
-pub const POLLPRI: ::c_short = 0x2;
-pub const POLLOUT: ::c_short = 0x4;
-pub const POLLERR: ::c_short = 0x8;
-pub const POLLHUP: ::c_short = 0x10;
-pub const POLLNVAL: ::c_short = 0x20;
-
-pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = usize::max_value();
-pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = usize::max_value();
-pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = usize::max_value();
-
-pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
-pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
-pub const PTHREAD_STACK_MIN: ::size_t = 0;
-
-// Dummy
-pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
-
-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_JOB_CONTROL: ::c_int = 5;
-pub const _SC_SAVED_IDS: ::c_int = 6;
-pub const _SC_VERSION: ::c_int = 7;
-pub const _SC_PAGESIZE: ::c_int = 8;
-pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
-pub const _SC_NPROCESSORS_CONF: ::c_int = 9;
-pub const _SC_NPROCESSORS_ONLN: ::c_int = 10;
-pub const _SC_PHYS_PAGES: ::c_int = 11;
-pub const _SC_AVPHYS_PAGES: ::c_int = 12;
-pub const _SC_MQ_OPEN_MAX: ::c_int = 13;
-pub const _SC_MQ_PRIO_MAX: ::c_int = 14;
-pub const _SC_RTSIG_MAX: ::c_int = 15;
-pub const _SC_SEM_NSEMS_MAX: ::c_int = 16;
-pub const _SC_SEM_VALUE_MAX: ::c_int = 17;
-pub const _SC_SIGQUEUE_MAX: ::c_int = 18;
-pub const _SC_TIMER_MAX: ::c_int = 19;
-pub const _SC_TZNAME_MAX: ::c_int = 20;
-pub const _SC_ASYNCHRONOUS_IO: ::c_int = 21;
-pub const _SC_FSYNC: ::c_int = 22;
-pub const _SC_MAPPED_FILES: ::c_int = 23;
-pub const _SC_MEMLOCK: ::c_int = 24;
-pub const _SC_MEMLOCK_RANGE: ::c_int = 25;
-pub const _SC_MEMORY_PROTECTION: ::c_int = 26;
-pub const _SC_MESSAGE_PASSING: ::c_int = 27;
-pub const _SC_PRIORITIZED_IO: ::c_int = 28;
-pub const _SC_REALTIME_SIGNALS: ::c_int = 29;
-pub const _SC_SEMAPHORES: ::c_int = 30;
-pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 31;
-pub const _SC_SYNCHRONIZED_IO: ::c_int = 32;
-pub const _SC_TIMERS: ::c_int = 33;
-pub const _SC_AIO_LISTIO_MAX: ::c_int = 34;
-pub const _SC_AIO_MAX: ::c_int = 35;
-pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 36;
-pub const _SC_DELAYTIMER_MAX: ::c_int = 37;
-pub const _SC_THREAD_KEYS_MAX: ::c_int = 38;
-pub const _SC_THREAD_STACK_MIN: ::c_int = 39;
-pub const _SC_THREAD_THREADS_MAX: ::c_int = 40;
-pub const _SC_TTY_NAME_MAX: ::c_int = 41;
-pub const _SC_THREADS: ::c_int = 42;
-pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 43;
-pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 44;
-pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 45;
-pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 46;
-pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 47;
-pub const _SC_THREAD_PRIO_CEILING: ::c_int = _SC_THREAD_PRIO_PROTECT;
-pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 48;
-pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 49;
-pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 50;
-pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 51;
-pub const _SC_LOGIN_NAME_MAX: ::c_int = 52;
-pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 53;
-pub const _SC_ADVISORY_INFO: ::c_int = 54;
-pub const _SC_ATEXIT_MAX: ::c_int = 55;
-pub const _SC_BARRIERS: ::c_int = 56;
-pub const _SC_BC_BASE_MAX: ::c_int = 57;
-pub const _SC_BC_DIM_MAX: ::c_int = 58;
-pub const _SC_BC_SCALE_MAX: ::c_int = 59;
-pub const _SC_BC_STRING_MAX: ::c_int = 60;
-pub const _SC_CLOCK_SELECTION: ::c_int = 61;
-pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 62;
-pub const _SC_CPUTIME: ::c_int = 63;
-pub const _SC_EXPR_NEST_MAX: ::c_int = 64;
-pub const _SC_HOST_NAME_MAX: ::c_int = 65;
-pub const _SC_IOV_MAX: ::c_int = 66;
-pub const _SC_IPV6: ::c_int = 67;
-pub const _SC_LINE_MAX: ::c_int = 68;
-pub const _SC_MONOTONIC_CLOCK: ::c_int = 69;
-pub const _SC_RAW_SOCKETS: ::c_int = 70;
-pub const _SC_READER_WRITER_LOCKS: ::c_int = 71;
-pub const _SC_REGEXP: ::c_int = 72;
-pub const _SC_RE_DUP_MAX: ::c_int = 73;
-pub const _SC_SHELL: ::c_int = 74;
-pub const _SC_SPAWN: ::c_int = 75;
-pub const _SC_SPIN_LOCKS: ::c_int = 76;
-pub const _SC_SPORADIC_SERVER: ::c_int = 77;
-pub const _SC_SS_REPL_MAX: ::c_int = 78;
-pub const _SC_SYMLOOP_MAX: ::c_int = 79;
-pub const _SC_THREAD_CPUTIME: ::c_int = 80;
-pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 81;
-pub const _SC_TIMEOUTS: ::c_int = 82;
-pub const _SC_TRACE: ::c_int = 83;
-pub const _SC_TRACE_EVENT_FILTER: ::c_int = 84;
-pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 85;
-pub const _SC_TRACE_INHERIT: ::c_int = 86;
-pub const _SC_TRACE_LOG: ::c_int = 87;
-pub const _SC_TRACE_NAME_MAX: ::c_int = 88;
-pub const _SC_TRACE_SYS_MAX: ::c_int = 89;
-pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 90;
-pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 91;
-pub const _SC_V7_ILP32_OFF32: ::c_int = 92;
-pub const _SC_V6_ILP32_OFF32: ::c_int = _SC_V7_ILP32_OFF32;
-pub const _SC_XBS5_ILP32_OFF32: ::c_int = _SC_V7_ILP32_OFF32;
-pub const _SC_V7_ILP32_OFFBIG: ::c_int = 93;
-pub const _SC_V6_ILP32_OFFBIG: ::c_int = _SC_V7_ILP32_OFFBIG;
-pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = _SC_V7_ILP32_OFFBIG;
-pub const _SC_V7_LP64_OFF64: ::c_int = 94;
-pub const _SC_V6_LP64_OFF64: ::c_int = _SC_V7_LP64_OFF64;
-pub const _SC_XBS5_LP64_OFF64: ::c_int = _SC_V7_LP64_OFF64;
-pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 95;
-pub const _SC_V6_LPBIG_OFFBIG: ::c_int = _SC_V7_LPBIG_OFFBIG;
-pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = _SC_V7_LPBIG_OFFBIG;
-pub const _SC_XOPEN_CRYPT: ::c_int = 96;
-pub const _SC_XOPEN_ENH_I18N: ::c_int = 97;
-pub const _SC_XOPEN_LEGACY: ::c_int = 98;
-pub const _SC_XOPEN_REALTIME: ::c_int = 99;
-pub const _SC_STREAM_MAX: ::c_int = 100;
-pub const _SC_PRIORITY_SCHEDULING: ::c_int = 101;
-pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 102;
-pub const _SC_XOPEN_SHM: ::c_int = 103;
-pub const _SC_XOPEN_STREAMS: ::c_int = 104;
-pub const _SC_XOPEN_UNIX: ::c_int = 105;
-pub const _SC_XOPEN_VERSION: ::c_int = 106;
-pub const _SC_2_CHAR_TERM: ::c_int = 107;
-pub const _SC_2_C_BIND: ::c_int = 108;
-pub const _SC_2_C_DEV: ::c_int = 109;
-pub const _SC_2_FORT_DEV: ::c_int = 110;
-pub const _SC_2_FORT_RUN: ::c_int = 111;
-pub const _SC_2_LOCALEDEF: ::c_int = 112;
-pub const _SC_2_PBS: ::c_int = 113;
-pub const _SC_2_PBS_ACCOUNTING: ::c_int = 114;
-pub const _SC_2_PBS_CHECKPOINT: ::c_int = 115;
-pub const _SC_2_PBS_LOCATE: ::c_int = 116;
-pub const _SC_2_PBS_MESSAGE: ::c_int = 117;
-pub const _SC_2_PBS_TRACK: ::c_int = 118;
-pub const _SC_2_SW_DEV: ::c_int = 119;
-pub const _SC_2_UPE: ::c_int = 120;
-pub const _SC_2_VERSION: ::c_int = 121;
-pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 122;
-pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 123;
-pub const _SC_XOPEN_UUCP: ::c_int = 124;
-pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 125;
-pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 126;
-pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 127;
-pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 128;
-pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 129;
-pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 130;
-pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 131;
-pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 132;
-pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 133;
-pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 134;
-pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 135;
-pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 136;
-pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 137;
-pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 138;
-pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 139;
-
-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 SEEK_SET: ::c_int = 0;
-pub const SEEK_CUR: ::c_int = 1;
-pub const SEEK_END: ::c_int = 2;
-
-pub const SHUT_RD: ::c_int = 0;
-pub const SHUT_WR: ::c_int = 1;
-pub const SHUT_RDWR: ::c_int = 2;
-
-pub const SIG_SETMASK: ::c_int = 0;
-
-pub const SIGHUP: ::c_int = 1;
-pub const SIGINT: ::c_int = 2;
-pub const SIGQUIT: ::c_int = 3;
-pub const SIGILL: ::c_int = 4;
-pub const SIGABRT: ::c_int = 6;
-pub const SIGEMT: ::c_int = 7;
-pub const SIGFPE: ::c_int = 8;
-pub const SIGKILL: ::c_int = 9;
-pub const SIGSEGV: ::c_int = 11;
-pub const SIGPIPE: ::c_int = 13;
-pub const SIGALRM: ::c_int = 14;
-pub const SIGTERM: ::c_int = 15;
-
-pub const SO_DEBUG: ::c_int = 0x0001;
-pub const SO_ACCEPTCONN: ::c_int = 0x0002;
-pub const SO_REUSEADDR: ::c_int = 0x0004;
-pub const SO_KEEPALIVE: ::c_int = 0x0008;
-pub const SO_DONTROUTE: ::c_int = 0x0010;
-pub const SO_BROADCAST: ::c_int = 0x0020;
-pub const SO_USELOOPBACK: ::c_int = 0x0040;
-pub const SO_LINGER: ::c_int = 0x0080;
-pub const SO_OOBINLINE: ::c_int = 0x0100;
-pub const SO_REUSEPORT: ::c_int = 0x0200;
-pub const SO_SNDBUF: ::c_int = 0x1001;
-pub const SO_RCVBUF: ::c_int = 0x1002;
-pub const SO_SNDLOWAT: ::c_int = 0x1003;
-pub const SO_RCVLOWAT: ::c_int = 0x1004;
-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_CONTIMEO: ::c_int = 0x1009;
-pub const SO_NO_CHECK: ::c_int = 0x100a;
-
-pub const SOCK_STREAM: ::c_int = 1;
-pub const SOCK_DGRAM: ::c_int = 2;
-pub const SOCK_RAW: ::c_int = 3;
-
-pub const SOL_SOCKET: ::c_int = 0xfff;
-
-pub const STDIN_FILENO: ::c_int = 0;
-pub const STDOUT_FILENO: ::c_int = 1;
-pub const STDERR_FILENO: ::c_int = 2;
-
-pub const TCP_NODELAY: ::c_int = 0x01;
-pub const TCP_KEEPALIVE: ::c_int = 0x02;
-pub const TCP_KEEPIDLE: ::c_int = 0x03;
-pub const TCP_KEEPINTVL: ::c_int = 0x04;
-pub const TCP_KEEPCNT: ::c_int = 0x05;
-
-const ULONG_SIZE: usize = 64;
-
-pub const WNOHANG: ::c_int = 0x00000001;
-
-pub const PRIO_PROCESS: ::c_int = 0;
-pub const PRIO_PGRP: ::c_int = 1;
-pub const PRIO_USER: ::c_int = 2;
-
-safe_f! {
- pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int {
- (status >> 8) & 0xff
- }
-
- pub {const} fn WIFEXITED(status: ::c_int) -> bool {
- (status & 0xff) == 0
- }
-
- pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
- status & 0x7f
- }
-}
-
-extern "C" {
- pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
- pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int;
- pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
-
- pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
- pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int;
-
- pub fn abs(i: ::c_int) -> ::c_int;
- pub fn labs(i: ::c_long) -> ::c_long;
- pub fn rand() -> ::c_int;
- pub fn srand(seed: ::c_uint);
-
- pub fn bind(s: ::c_int, name: *const ::sockaddr, namelen: ::socklen_t) -> ::c_int;
-
- pub fn clock_gettime(clock_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
-
- pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::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;
-
- // Dummy
- pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
-
- pub fn memalign(align: ::size_t, nbytes: ::size_t) -> *mut ::c_void;
-
- pub fn pthread_create(
- tid: *mut ::pthread_t,
- attr: *const ::pthread_attr_t,
- start: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
- arg: *mut ::c_void,
- ) -> ::c_int;
-
- pub fn pthread_sigmask(how: ::c_int, set: *const ::sigset_t, oset: *mut ::sigset_t) -> ::c_int;
-
- pub fn recvfrom(
- s: ::c_int,
- mem: *mut ::c_void,
- len: ::size_t,
- flags: ::c_int,
- from: *mut ::sockaddr,
- fromlen: *mut ::socklen_t,
- ) -> ::c_int;
-
- pub fn setgroups(ngroups: ::c_int, grouplist: *const ::gid_t) -> ::c_int;
- pub fn uname(buf: *mut ::utsname) -> ::c_int;
-}
-
-cfg_if! {
- if #[cfg(target_arch = "aarch64")] {
- mod aarch64;
- pub use self::aarch64::*;
- } else if #[cfg(target_arch = "x86_64")] {
- mod x86_64;
- pub use self::x86_64::*;
- } else {
- // Unknown target_arch
- }
-}
diff --git a/src/unix/hermit/x86_64.rs b/src/unix/hermit/x86_64.rs
deleted file mode 100644
index 76ec3ce8..00000000
--- a/src/unix/hermit/x86_64.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-pub type c_char = i8;
-pub type wchar_t = i32;
diff --git a/src/unix/hurd/align.rs b/src/unix/hurd/align.rs
new file mode 100644
index 00000000..1dd7d8e5
--- /dev/null
+++ b/src/unix/hurd/align.rs
@@ -0,0 +1 @@
+// Placeholder file
diff --git a/src/unix/hurd/b32.rs b/src/unix/hurd/b32.rs
new file mode 100644
index 00000000..7e83ed93
--- /dev/null
+++ b/src/unix/hurd/b32.rs
@@ -0,0 +1,91 @@
+pub type c_long = i32;
+pub type c_ulong = u32;
+
+pub type __int64_t = ::c_longlong;
+pub type __uint64_t = ::c_ulonglong;
+
+pub type int_fast16_t = ::c_int;
+pub type int_fast32_t = ::c_int;
+pub type int_fast64_t = ::c_longlong;
+pub type uint_fast16_t = ::c_uint;
+pub type uint_fast32_t = ::c_uint;
+pub type uint_fast64_t = ::c_ulonglong;
+
+pub type __quad_t = ::c_longlong;
+pub type __u_quad_t = ::c_ulonglong;
+pub type __intmax_t = ::c_longlong;
+pub type __uintmax_t = ::c_ulonglong;
+
+pub type __squad_type = ::__int64_t;
+pub type __uquad_type = ::__uint64_t;
+pub type __sword_type = ::c_int;
+pub type __uword_type = ::c_uint;
+pub type __slong32_type = ::c_long;
+pub type __ulong32_type = ::c_ulong;
+pub type __s64_type = ::__int64_t;
+pub type __u64_type = ::__uint64_t;
+
+pub type Elf32_Half = u16;
+pub type Elf32_Word = u32;
+pub type Elf32_Off = u32;
+pub type Elf32_Addr = u32;
+pub type Elf32_Section = u16;
+
+pub type Elf_Addr = ::Elf32_Addr;
+pub type Elf_Half = ::Elf32_Half;
+pub type Elf_Ehdr = ::Elf32_Ehdr;
+pub type Elf_Phdr = ::Elf32_Phdr;
+pub type Elf_Shdr = ::Elf32_Shdr;
+pub type Elf_Sym = ::Elf32_Sym;
+
+s! {
+ pub struct Elf32_Ehdr {
+ pub e_ident: [::c_uchar; 16],
+ pub e_type: Elf32_Half,
+ pub e_machine: Elf32_Half,
+ pub e_version: Elf32_Word,
+ pub e_entry: Elf32_Addr,
+ pub e_phoff: Elf32_Off,
+ pub e_shoff: Elf32_Off,
+ pub e_flags: Elf32_Word,
+ pub e_ehsize: Elf32_Half,
+ pub e_phentsize: Elf32_Half,
+ pub e_phnum: Elf32_Half,
+ pub e_shentsize: Elf32_Half,
+ pub e_shnum: Elf32_Half,
+ pub e_shstrndx: Elf32_Half,
+ }
+
+ pub struct Elf32_Shdr {
+ pub sh_name: Elf32_Word,
+ pub sh_type: Elf32_Word,
+ pub sh_flags: Elf32_Word,
+ pub sh_addr: Elf32_Addr,
+ pub sh_offset: Elf32_Off,
+ pub sh_size: Elf32_Word,
+ pub sh_link: Elf32_Word,
+ pub sh_info: Elf32_Word,
+ pub sh_addralign: Elf32_Word,
+ pub sh_entsize: Elf32_Word,
+ }
+
+ pub struct Elf32_Sym {
+ pub st_name: Elf32_Word,
+ pub st_value: Elf32_Addr,
+ pub st_size: Elf32_Word,
+ pub st_info: ::c_uchar,
+ pub st_other: ::c_uchar,
+ pub st_shndx: Elf32_Section,
+ }
+
+ pub struct Elf32_Phdr {
+ pub p_type: ::Elf32_Word,
+ pub p_offset: ::Elf32_Off,
+ pub p_vaddr: ::Elf32_Addr,
+ pub p_paddr: ::Elf32_Addr,
+ pub p_filesz: ::Elf32_Word,
+ pub p_memsz: ::Elf32_Word,
+ pub p_flags: ::Elf32_Word,
+ pub p_align: ::Elf32_Word,
+ }
+}
diff --git a/src/unix/hurd/b64.rs b/src/unix/hurd/b64.rs
new file mode 100644
index 00000000..3b171f10
--- /dev/null
+++ b/src/unix/hurd/b64.rs
@@ -0,0 +1,93 @@
+pub type c_long = i64;
+pub type c_ulong = u64;
+
+pub type __int64_t = ::c_long;
+pub type __uint64_t = ::c_ulong;
+
+pub type int_fast16_t = ::c_long;
+pub type int_fast32_t = ::c_long;
+pub type int_fast64_t = ::c_long;
+pub type uint_fast16_t = ::c_ulong;
+pub type uint_fast32_t = ::c_ulong;
+pub type uint_fast64_t = ::c_ulong;
+
+pub type __quad_t = ::c_long;
+pub type __u_quad_t = ::c_ulong;
+pub type __intmax_t = ::c_long;
+pub type __uintmax_t = ::c_ulong;
+
+pub type __squad_type = ::c_long;
+pub type __uquad_type = ::c_ulong;
+pub type __sword_type = ::c_long;
+pub type __uword_type = ::c_ulong;
+pub type __slong32_type = ::c_int;
+pub type __ulong32_type = ::c_uint;
+pub type __s64_type = ::c_long;
+pub type __u64_type = ::c_ulong;
+
+pub type Elf64_Half = u16;
+pub type Elf64_Word = u32;
+pub type Elf64_Off = u64;
+pub type Elf64_Addr = u64;
+pub type Elf64_Xword = u64;
+pub type Elf64_Sxword = i64;
+pub type Elf64_Section = u16;
+
+pub type Elf_Addr = ::Elf64_Addr;
+pub type Elf_Half = ::Elf64_Half;
+pub type Elf_Ehdr = ::Elf64_Ehdr;
+pub type Elf_Phdr = ::Elf64_Phdr;
+pub type Elf_Shdr = ::Elf64_Shdr;
+pub type Elf_Sym = ::Elf64_Sym;
+
+s! {
+ pub struct Elf64_Ehdr {
+ pub e_ident: [::c_uchar; 16],
+ pub e_type: Elf64_Half,
+ pub e_machine: Elf64_Half,
+ pub e_version: Elf64_Word,
+ pub e_entry: Elf64_Addr,
+ pub e_phoff: Elf64_Off,
+ pub e_shoff: Elf64_Off,
+ pub e_flags: Elf64_Word,
+ pub e_ehsize: Elf64_Half,
+ pub e_phentsize: Elf64_Half,
+ pub e_phnum: Elf64_Half,
+ pub e_shentsize: Elf64_Half,
+ pub e_shnum: Elf64_Half,
+ pub e_shstrndx: Elf64_Half,
+ }
+
+ pub struct Elf64_Shdr {
+ pub sh_name: Elf64_Word,
+ pub sh_type: Elf64_Word,
+ pub sh_flags: Elf64_Xword,
+ pub sh_addr: Elf64_Addr,
+ pub sh_offset: Elf64_Off,
+ pub sh_size: Elf64_Xword,
+ pub sh_link: Elf64_Word,
+ pub sh_info: Elf64_Word,
+ pub sh_addralign: Elf64_Xword,
+ pub sh_entsize: Elf64_Xword,
+ }
+
+ pub struct Elf64_Sym {
+ pub st_name: Elf64_Word,
+ pub st_info: ::c_uchar,
+ pub st_other: ::c_uchar,
+ pub st_shndx: Elf64_Section,
+ pub st_value: Elf64_Addr,
+ pub st_size: Elf64_Xword,
+ }
+
+ pub struct Elf64_Phdr {
+ pub p_type: ::Elf64_Word,
+ pub p_flags: ::Elf64_Word,
+ pub p_offset: ::Elf64_Off,
+ pub p_vaddr: ::Elf64_Addr,
+ pub p_paddr: ::Elf64_Addr,
+ pub p_filesz: ::Elf64_Xword,
+ pub p_memsz: ::Elf64_Xword,
+ pub p_align: ::Elf64_Xword,
+ }
+}
diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs
new file mode 100644
index 00000000..05d75851
--- /dev/null
+++ b/src/unix/hurd/mod.rs
@@ -0,0 +1,3107 @@
+#![allow(dead_code)]
+
+// types
+pub type c_char = i8;
+
+pub type __s16_type = ::c_short;
+pub type __u16_type = ::c_ushort;
+pub type __s32_type = ::c_int;
+pub type __u32_type = ::c_uint;
+pub type __slongword_type = ::c_long;
+pub type __ulongword_type = ::c_ulong;
+
+pub type __u_char = ::c_uchar;
+pub type __u_short = ::c_ushort;
+pub type __u_int = ::c_uint;
+pub type __u_long = ::c_ulong;
+pub type __int8_t = ::c_schar;
+pub type __uint8_t = ::c_uchar;
+pub type __int16_t = ::c_short;
+pub type __uint16_t = ::c_ushort;
+pub type __int32_t = ::c_int;
+pub type __uint32_t = ::c_uint;
+pub type __int_least8_t = __int8_t;
+pub type __uint_least8_t = __uint8_t;
+pub type __int_least16_t = __int16_t;
+pub type __uint_least16_t = __uint16_t;
+pub type __int_least32_t = __int32_t;
+pub type __uint_least32_t = __uint32_t;
+pub type __int_least64_t = __int64_t;
+pub type __uint_least64_t = __uint64_t;
+
+pub type __dev_t = __uword_type;
+pub type __uid_t = __u32_type;
+pub type __gid_t = __u32_type;
+pub type __ino_t = __ulongword_type;
+pub type __ino64_t = __uquad_type;
+pub type __mode_t = __u32_type;
+pub type __nlink_t = __uword_type;
+pub type __off_t = __slongword_type;
+pub type __off64_t = __squad_type;
+pub type __pid_t = __s32_type;
+pub type __rlim_t = __ulongword_type;
+pub type __rlim64_t = __uquad_type;
+pub type __blkcnt_t = __slongword_type;
+pub type __blkcnt64_t = __squad_type;
+pub type __fsblkcnt_t = __ulongword_type;
+pub type __fsblkcnt64_t = __uquad_type;
+pub type __fsfilcnt_t = __ulongword_type;
+pub type __fsfilcnt64_t = __uquad_type;
+pub type __fsword_t = __sword_type;
+pub type __id_t = __u32_type;
+pub type __clock_t = __slongword_type;
+pub type __time_t = __slongword_type;
+pub type __useconds_t = __u32_type;
+pub type __suseconds_t = __slongword_type;
+pub type __suseconds64_t = __squad_type;
+pub type __daddr_t = __s32_type;
+pub type __key_t = __s32_type;
+pub type __clockid_t = __s32_type;
+pub type __timer_t = __uword_type;
+pub type __blksize_t = __slongword_type;
+pub type __fsid_t = __uquad_type;
+pub type __ssize_t = __sword_type;
+pub type __syscall_slong_t = __slongword_type;
+pub type __syscall_ulong_t = __ulongword_type;
+pub type __cpu_mask = __ulongword_type;
+
+pub type __loff_t = __off64_t;
+pub type __caddr_t = *mut ::c_char;
+pub type __intptr_t = __sword_type;
+pub type __ptrdiff_t = __sword_type;
+pub type __socklen_t = __u32_type;
+pub type __sig_atomic_t = ::c_int;
+pub type __time64_t = __int64_t;
+pub type ssize_t = __ssize_t;
+pub type size_t = ::c_ulong;
+pub type wchar_t = ::c_int;
+pub type wint_t = ::c_uint;
+pub type gid_t = __gid_t;
+pub type uid_t = __uid_t;
+pub type off_t = __off_t;
+pub type off64_t = __off64_t;
+pub type useconds_t = __useconds_t;
+pub type pid_t = __pid_t;
+pub type socklen_t = __socklen_t;
+
+pub type in_addr_t = u32;
+
+pub type _Float32 = f32;
+pub type _Float64 = f64;
+pub type _Float32x = f64;
+pub type _Float64x = f64;
+
+pub type __locale_t = *mut __locale_struct;
+pub type locale_t = __locale_t;
+
+pub type u_char = __u_char;
+pub type u_short = __u_short;
+pub type u_int = __u_int;
+pub type u_long = __u_long;
+pub type quad_t = __quad_t;
+pub type u_quad_t = __u_quad_t;
+pub type fsid_t = __fsid_t;
+pub type loff_t = __loff_t;
+pub type ino_t = __ino_t;
+pub type ino64_t = __ino64_t;
+pub type dev_t = __dev_t;
+pub type mode_t = __mode_t;
+pub type nlink_t = __nlink_t;
+pub type id_t = __id_t;
+pub type daddr_t = __daddr_t;
+pub type caddr_t = __caddr_t;
+pub type key_t = __key_t;
+pub type clock_t = __clock_t;
+pub type clockid_t = __clockid_t;
+pub type time_t = __time_t;
+pub type timer_t = __timer_t;
+pub type suseconds_t = __suseconds_t;
+pub type ulong = ::c_ulong;
+pub type ushort = ::c_ushort;
+pub type uint = ::c_uint;
+pub type u_int8_t = __uint8_t;
+pub type u_int16_t = __uint16_t;
+pub type u_int32_t = __uint32_t;
+pub type u_int64_t = __uint64_t;
+pub type register_t = ::c_int;
+pub type __sigset_t = ::c_ulong;
+pub type sigset_t = __sigset_t;
+
+pub type __fd_mask = ::c_long;
+pub type fd_mask = __fd_mask;
+pub type blksize_t = __blksize_t;
+pub type blkcnt_t = __blkcnt_t;
+pub type fsblkcnt_t = __fsblkcnt_t;
+pub type fsfilcnt_t = __fsfilcnt_t;
+pub type blkcnt64_t = __blkcnt64_t;
+pub type fsblkcnt64_t = __fsblkcnt64_t;
+pub type fsfilcnt64_t = __fsfilcnt64_t;
+
+pub type __pthread_spinlock_t = ::c_int;
+pub type __tss_t = ::c_int;
+pub type __thrd_t = ::c_long;
+pub type __pthread_t = ::c_long;
+pub type pthread_t = __pthread_t;
+pub type __pthread_process_shared = ::c_uint;
+pub type __pthread_inheritsched = ::c_uint;
+pub type __pthread_contentionscope = ::c_uint;
+pub type __pthread_detachstate = ::c_uint;
+pub type pthread_attr_t = __pthread_attr;
+pub type __pthread_mutex_protocol = ::c_uint;
+pub type __pthread_mutex_type = ::c_uint;
+pub type __pthread_mutex_robustness = ::c_uint;
+pub type pthread_mutexattr_t = __pthread_mutexattr;
+pub type pthread_mutex_t = __pthread_mutex;
+pub type pthread_condattr_t = __pthread_condattr;
+pub type pthread_cond_t = __pthread_cond;
+pub type pthread_spinlock_t = __pthread_spinlock_t;
+pub type pthread_rwlockattr_t = __pthread_rwlockattr;
+pub type pthread_rwlock_t = __pthread_rwlock;
+pub type pthread_barrierattr_t = __pthread_barrierattr;
+pub type pthread_barrier_t = __pthread_barrier;
+pub type __pthread_key = ::c_int;
+pub type pthread_key_t = __pthread_key;
+pub type pthread_once_t = __pthread_once;
+
+pub type __rlimit_resource = ::c_uint;
+pub type rlim_t = __rlim_t;
+pub type rlim64_t = __rlim64_t;
+
+pub type __rusage_who = ::c_int;
+
+pub type __priority_which = ::c_uint;
+
+pub type sa_family_t = ::c_uchar;
+
+pub type in_port_t = u16;
+
+pub type __sigval_t = ::sigval;
+
+pub type sigevent_t = sigevent;
+
+pub type nfds_t = ::c_ulong;
+
+pub type tcflag_t = ::c_uint;
+pub type cc_t = ::c_uchar;
+pub type speed_t = ::c_int;
+
+pub type sigval_t = ::sigval;
+
+pub type greg_t = ::c_int;
+pub type gregset_t = [greg_t; 19usize];
+
+pub type __ioctl_dir = ::c_uint;
+
+pub type __ioctl_datum = ::c_uint;
+
+pub type __error_t_codes = ::c_int;
+
+pub type int_least8_t = __int_least8_t;
+pub type int_least16_t = __int_least16_t;
+pub type int_least32_t = __int_least32_t;
+pub type int_least64_t = __int_least64_t;
+pub type uint_least8_t = __uint_least8_t;
+pub type uint_least16_t = __uint_least16_t;
+pub type uint_least32_t = __uint_least32_t;
+pub type uint_least64_t = __uint_least64_t;
+pub type int_fast8_t = ::c_schar;
+pub type uint_fast8_t = ::c_uchar;
+pub type intmax_t = __intmax_t;
+pub type uintmax_t = __uintmax_t;
+
+pub type tcp_seq = u32;
+
+pub type tcp_ca_state = ::c_uint;
+
+pub type idtype_t = ::c_uint;
+
+// structs
+s! {
+ pub struct ip_mreq {
+ pub imr_multiaddr: in_addr,
+ pub imr_interface: in_addr,
+ }
+
+ pub struct ip_mreqn {
+ pub imr_multiaddr: in_addr,
+ pub imr_address: in_addr,
+ pub imr_ifindex: ::c_int,
+ }
+
+ pub struct sockaddr {
+ pub sa_len: ::c_uchar,
+ pub sa_family: sa_family_t,
+ pub sa_data: [::c_char; 14usize],
+ }
+
+ pub struct in_addr {
+ pub s_addr: in_addr_t,
+ }
+
+ pub struct sockaddr_in {
+ pub sin_len: ::c_uchar,
+ pub sin_family: sa_family_t,
+ pub sin_port: in_port_t,
+ pub sin_addr: ::in_addr,
+ pub sin_zero: [::c_uchar; 8usize],
+ }
+
+ pub struct sockaddr_in6 {
+ pub sin6_len: ::c_uchar,
+ pub sin6_family: sa_family_t,
+ pub sin6_port: in_port_t,
+ pub sin6_flowinfo: u32,
+ pub sin6_addr: ::in6_addr,
+ pub sin6_scope_id: u32,
+ }
+
+ pub struct sockaddr_un {
+ pub sun_len: ::c_uchar,
+ pub sun_family: sa_family_t,
+ pub sun_path: [::c_char; 108usize],
+ }
+
+ pub struct sockaddr_storage {
+ pub ss_len: ::c_uchar,
+ pub ss_family: sa_family_t,
+ pub __ss_padding: [::c_char; 122usize],
+ pub __ss_align: __uint32_t,
+ }
+
+ pub struct sockaddr_at {
+ pub _address: u8,
+ }
+
+ pub struct sockaddr_ax25 {
+ pub _address: u8,
+ }
+
+ pub struct sockaddr_x25 {
+ pub _address: u8,
+ }
+
+ pub struct sockaddr_dl {
+ pub _address: u8,
+ }
+ pub struct sockaddr_eon {
+ pub _address: u8,
+ }
+ pub struct sockaddr_inarp {
+ pub _address: u8,
+ }
+
+ pub struct sockaddr_ipx {
+ pub _address: u8,
+ }
+ pub struct sockaddr_iso {
+ pub _address: u8,
+ }
+
+ pub struct sockaddr_ns {
+ pub _address: u8,
+ }
+
+ 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_addr: *mut sockaddr,
+ pub ai_canonname: *mut ::c_char,
+ pub ai_next: *mut addrinfo,
+ }
+
+ 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 dirent {
+ pub d_ino: __ino_t,
+ pub d_reclen: ::c_ushort,
+ pub d_type: ::c_uchar,
+ pub d_namlen: ::c_uchar,
+ pub d_name: [::c_char; 1usize],
+ }
+
+ pub struct dirent64 {
+ pub d_ino: __ino64_t,
+ pub d_reclen: ::c_ushort,
+ pub d_type: ::c_uchar,
+ pub d_namlen: ::c_uchar,
+ pub d_name: [::c_char; 1usize],
+ }
+
+ pub struct fd_set {
+ pub fds_bits: [__fd_mask; 8usize],
+ }
+
+ 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_cc: [cc_t; 20usize],
+ pub __ispeed: speed_t,
+ pub __ospeed: speed_t,
+ }
+
+ pub struct sigaction {
+ pub sa_sigaction: ::sighandler_t,
+ pub sa_mask: __sigset_t,
+ pub sa_flags: ::c_int,
+ }
+
+ pub struct sigevent {
+ pub sigev_value: ::sigval,
+ pub sigev_signo: ::c_int,
+ pub sigev_notify: ::c_int,
+ __unused1: *mut ::c_void, //actually a function pointer
+ pub sigev_notify_attributes: *mut pthread_attr_t,
+ }
+
+ pub struct siginfo_t {
+ pub si_signo: ::c_int,
+ pub si_errno: ::c_int,
+ pub si_code: ::c_int,
+ pub si_pid: __pid_t,
+ pub si_uid: __uid_t,
+ pub si_addr: *mut ::c_void,
+ pub si_status: ::c_int,
+ pub si_band: ::c_long,
+ pub si_value: ::sigval,
+ }
+
+ pub struct timespec {
+ pub tv_sec: __time_t,
+ pub tv_nsec: __syscall_slong_t,
+ }
+
+ pub struct __locale_data {
+ pub _address: u8,
+ }
+
+ pub struct stat {
+ pub st_fstype: ::c_int,
+ pub st_fsid: __fsid_t,
+ pub st_ino: __ino_t,
+ pub st_gen: ::c_uint,
+ pub st_rdev: __dev_t,
+ pub st_mode: __mode_t,
+ pub st_nlink: __nlink_t,
+ pub st_uid: __uid_t,
+ pub st_gid: __gid_t,
+ pub st_size: __off_t,
+ pub st_atim: ::timespec,
+ pub st_mtim: ::timespec,
+ pub st_ctim: ::timespec,
+ pub st_blksize: __blksize_t,
+ pub st_blocks: __blkcnt_t,
+ pub st_author: __uid_t,
+ pub st_flags: ::c_uint,
+ pub st_spare: [::c_int; 11usize],
+ }
+
+ pub struct stat64 {
+ pub st_fstype: ::c_int,
+ pub st_fsid: __fsid_t,
+ pub st_ino: __ino64_t,
+ pub st_gen: ::c_uint,
+ pub st_rdev: __dev_t,
+ pub st_mode: __mode_t,
+ pub st_nlink: __nlink_t,
+ pub st_uid: __uid_t,
+ pub st_gid: __gid_t,
+ pub st_size: __off64_t,
+ pub st_atim: ::timespec,
+ pub st_mtim: ::timespec,
+ pub st_ctim: ::timespec,
+ pub st_blksize: __blksize_t,
+ pub st_blocks: __blkcnt64_t,
+ pub st_author: __uid_t,
+ pub st_flags: ::c_uint,
+ pub st_spare: [::c_int; 8usize],
+ }
+
+ pub struct statfs {
+ pub f_type: ::c_uint,
+ pub f_bsize: ::c_ulong,
+ pub f_blocks: __fsblkcnt_t,
+ pub f_bfree: __fsblkcnt_t,
+ pub f_bavail: __fsblkcnt_t,
+ pub f_files: __fsblkcnt_t,
+ pub f_ffree: __fsblkcnt_t,
+ pub f_fsid: __fsid_t,
+ pub f_namelen: ::c_ulong,
+ pub f_favail: __fsfilcnt_t,
+ pub f_frsize: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_spare: [::c_uint; 3usize],
+ }
+
+ pub struct statfs64 {
+ pub f_type: ::c_uint,
+ pub f_bsize: ::c_ulong,
+ pub f_blocks: __fsblkcnt64_t,
+ pub f_bfree: __fsblkcnt64_t,
+ pub f_bavail: __fsblkcnt64_t,
+ pub f_files: __fsblkcnt64_t,
+ pub f_ffree: __fsblkcnt64_t,
+ pub f_fsid: __fsid_t,
+ pub f_namelen: ::c_ulong,
+ pub f_favail: __fsfilcnt64_t,
+ pub f_frsize: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_spare: [::c_uint ; 3usize],
+ }
+
+ pub struct statvfs {
+ pub __f_type: ::c_uint,
+ 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_namemax: ::c_ulong,
+ pub f_favail: __fsfilcnt_t,
+ pub f_frsize: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_spare: [::c_uint; 3usize],
+ }
+
+ pub struct statvfs64 {
+ pub __f_type: ::c_uint,
+ pub f_bsize: ::c_ulong,
+ pub f_blocks: __fsblkcnt64_t,
+ pub f_bfree: __fsblkcnt64_t,
+ pub f_bavail: __fsblkcnt64_t,
+ pub f_files: __fsfilcnt64_t,
+ pub f_ffree: __fsfilcnt64_t,
+ pub f_fsid: __fsid_t,
+ pub f_namemax: ::c_ulong,
+ pub f_favail: __fsfilcnt64_t,
+ pub f_frsize: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_spare: [::c_uint; 3usize],
+ }
+
+ #[cfg_attr(target_pointer_width = "32",
+ repr(align(4)))]
+ #[cfg_attr(target_pointer_width = "64",
+ repr(align(8)))]
+ pub struct sem_t {
+ __size: [::c_char; 20usize],
+ }
+
+ pub struct __pthread {
+ pub _address: u8,
+ }
+
+ pub struct __pthread_mutexattr {
+ pub __prioceiling: ::c_int,
+ pub __protocol: __pthread_mutex_protocol,
+ pub __pshared: __pthread_process_shared,
+ pub __mutex_type: __pthread_mutex_type,
+ }
+ pub struct __pthread_mutex {
+ pub __lock: ::c_uint,
+ pub __owner_id: ::c_uint,
+ pub __cnt: ::c_uint,
+ pub __shpid: ::c_int,
+ pub __type: ::c_int,
+ pub __flags: ::c_int,
+ pub __reserved1: ::c_uint,
+ pub __reserved2: ::c_uint,
+ }
+
+ pub struct __pthread_condattr {
+ pub __pshared: __pthread_process_shared,
+ pub __clock: __clockid_t,
+ }
+
+ pub struct __pthread_rwlockattr {
+ pub __pshared: __pthread_process_shared,
+ }
+
+ pub struct __pthread_barrierattr {
+ pub __pshared: __pthread_process_shared,
+ }
+
+ pub struct __pthread_once {
+ pub __run: ::c_int,
+ pub __lock: __pthread_spinlock_t,
+ }
+
+ pub struct __pthread_cond {
+ pub __lock: __pthread_spinlock_t,
+ pub __queue: *mut __pthread,
+ pub __attr: *mut __pthread_condattr,
+ pub __wrefs: ::c_uint,
+ pub __data: *mut ::c_void,
+ }
+
+ pub struct __pthread_attr {
+ pub __schedparam: __sched_param,
+ pub __stackaddr: *mut ::c_void,
+ pub __stacksize: size_t,
+ pub __guardsize: size_t,
+ pub __detachstate: __pthread_detachstate,
+ pub __inheritsched: __pthread_inheritsched,
+ pub __contentionscope: __pthread_contentionscope,
+ pub __schedpolicy: ::c_int,
+ }
+
+ pub struct __pthread_rwlock {
+ pub __held: __pthread_spinlock_t,
+ pub __lock: __pthread_spinlock_t,
+ pub __readers: ::c_int,
+ pub __readerqueue: *mut __pthread,
+ pub __writerqueue: *mut __pthread,
+ pub __attr: *mut __pthread_rwlockattr,
+ pub __data: *mut ::c_void,
+ }
+
+ pub struct __pthread_barrier {
+ pub __lock: __pthread_spinlock_t,
+ pub __queue: *mut __pthread,
+ pub __pending: ::c_uint,
+ pub __count: ::c_uint,
+ pub __attr: *mut __pthread_barrierattr,
+ pub __data: *mut ::c_void,
+ }
+
+ pub struct _IO_FILE {
+ _unused: [u8; 0],
+ }
+
+ pub struct __sched_param {
+ pub __sched_priority: ::c_int,
+ }
+
+ pub struct iovec {
+ pub iov_base: *mut ::c_void,
+ pub iov_len: size_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 tm {
+ pub tm_sec: ::c_int,
+ pub tm_min: ::c_int,
+ pub tm_hour: ::c_int,
+ pub tm_mday: ::c_int,
+ pub tm_mon: ::c_int,
+ pub tm_year: ::c_int,
+ pub tm_wday: ::c_int,
+ pub tm_yday: ::c_int,
+ pub tm_isdst: ::c_int,
+ pub tm_gmtoff: ::c_long,
+ pub tm_zone: *const ::c_char,
+ }
+
+ pub struct lconv {
+ pub decimal_point: *mut ::c_char,
+ pub thousands_sep: *mut ::c_char,
+ pub grouping: *mut ::c_char,
+ pub int_curr_symbol: *mut ::c_char,
+ pub currency_symbol: *mut ::c_char,
+ pub mon_decimal_point: *mut ::c_char,
+ pub mon_thousands_sep: *mut ::c_char,
+ pub mon_grouping: *mut ::c_char,
+ pub positive_sign: *mut ::c_char,
+ pub negative_sign: *mut ::c_char,
+ pub int_frac_digits: ::c_char,
+ pub frac_digits: ::c_char,
+ pub p_cs_precedes: ::c_char,
+ pub p_sep_by_space: ::c_char,
+ pub n_cs_precedes: ::c_char,
+ pub n_sep_by_space: ::c_char,
+ pub p_sign_posn: ::c_char,
+ pub n_sign_posn: ::c_char,
+ pub int_p_cs_precedes: ::c_char,
+ pub int_p_sep_by_space: ::c_char,
+ pub int_n_cs_precedes: ::c_char,
+ pub int_n_sep_by_space: ::c_char,
+ pub int_p_sign_posn: ::c_char,
+ pub int_n_sign_posn: ::c_char,
+ }
+
+ pub struct Dl_info {
+ pub dli_fname: *const ::c_char,
+ pub dli_fbase: *mut ::c_void,
+ pub dli_sname: *const ::c_char,
+ pub dli_saddr: *mut ::c_void,
+ }
+
+ pub struct __locale_struct {
+ pub __locales: [*mut __locale_data; 13usize],
+ pub __ctype_b: *const ::c_ushort,
+ pub __ctype_tolower: *const ::c_int,
+ pub __ctype_toupper: *const ::c_int,
+ pub __names: [*const ::c_char; 13usize],
+ }
+
+ pub struct utsname {
+ 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 rlimit64 {
+ pub rlim_cur: rlim64_t,
+ pub rlim_max: rlim64_t,
+ }
+
+ pub struct stack_t {
+ pub ss_sp: * mut ::c_void,
+ pub ss_size: ::size_t,
+ pub ss_flags: ::c_int,
+ }
+
+ pub struct dl_phdr_info {
+ pub dlpi_addr: Elf_Addr,
+ pub dlpi_name: *const ::c_char,
+ pub dlpi_phdr: *const Elf_Phdr,
+ pub dlpi_phnum: Elf_Half,
+ pub dlpi_adds: ::c_ulonglong,
+ pub dlpi_subs: ::c_ulonglong,
+ pub dlpi_tls_modid: ::size_t,
+ pub dlpi_tls_data: *mut ::c_void,
+ }
+
+ pub struct flock {
+ #[cfg(target_pointer_width = "32")]
+ pub l_type : ::c_int,
+ #[cfg(target_pointer_width = "32")]
+ pub l_whence : ::c_int,
+ #[cfg(target_pointer_width = "64")]
+ pub l_type : ::c_short,
+ #[cfg(target_pointer_width = "64")]
+ pub l_whence : ::c_short,
+ pub l_start : __off_t,
+ pub l_len : __off_t,
+ pub l_pid : __pid_t,
+ }
+
+ pub struct flock64 {
+ #[cfg(target_pointer_width = "32")]
+ pub l_type : ::c_int,
+ #[cfg(target_pointer_width = "32")]
+ pub l_whence : ::c_int,
+ #[cfg(target_pointer_width = "64")]
+ pub l_type : ::c_short,
+ #[cfg(target_pointer_width = "64")]
+ pub l_whence : ::c_short,
+ pub l_start : __off_t,
+ pub l_len : __off64_t,
+ pub l_pid : __pid_t,
+ }
+}
+
+impl siginfo_t {
+ pub unsafe fn si_addr(&self) -> *mut ::c_void {
+ self.si_addr
+ }
+
+ pub unsafe fn si_value(&self) -> ::sigval {
+ self.si_value
+ }
+
+ pub unsafe fn si_pid(&self) -> ::pid_t {
+ self.si_pid
+ }
+
+ pub unsafe fn si_uid(&self) -> ::uid_t {
+ self.si_uid
+ }
+
+ pub unsafe fn si_status(&self) -> ::c_int {
+ self.si_status
+ }
+}
+
+// const
+pub const IPOPT_COPY: u8 = 0x80;
+pub const IPOPT_NUMBER_MASK: u8 = 0x1f;
+pub const IPOPT_CLASS_MASK: u8 = 0x60;
+pub const IPTOS_ECN_MASK: u8 = 0x03;
+pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
+
+// unistd.h
+pub const STDIN_FILENO: c_long = 0;
+pub const STDOUT_FILENO: c_long = 1;
+pub const STDERR_FILENO: c_long = 2;
+pub const __FD_SETSIZE: usize = 256;
+pub const R_OK: ::c_int = 4;
+pub const W_OK: ::c_int = 2;
+pub const X_OK: ::c_int = 1;
+pub const F_OK: ::c_int = 0;
+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 L_SET: ::c_int = 0;
+pub const L_INCR: ::c_int = 1;
+pub const L_XTND: ::c_int = 2;
+pub const F_ULOCK: ::c_int = 0;
+pub const F_LOCK: ::c_int = 1;
+pub const F_TLOCK: ::c_int = 2;
+pub const F_TEST: ::c_int = 3;
+pub const CLOSE_RANGE_CLOEXEC: ::c_int = 4;
+
+// stdlib.h
+pub const WNOHANG: ::c_int = 1;
+pub const WUNTRACED: ::c_int = 2;
+pub const WSTOPPED: ::c_int = 2;
+pub const WCONTINUED: ::c_int = 4;
+pub const WNOWAIT: ::c_int = 8;
+pub const WEXITED: ::c_int = 16;
+pub const __W_CONTINUED: ::c_int = 65535;
+pub const __WCOREFLAG: ::c_int = 128;
+pub const RAND_MAX: ::c_int = 2147483647;
+pub const EXIT_FAILURE: ::c_int = 1;
+pub const EXIT_SUCCESS: ::c_int = 0;
+pub const __LITTLE_ENDIAN: usize = 1234;
+pub const __BIG_ENDIAN: usize = 4321;
+pub const __PDP_ENDIAN: usize = 3412;
+pub const __BYTE_ORDER: usize = 1234;
+pub const __FLOAT_WORD_ORDER: usize = 1234;
+pub const LITTLE_ENDIAN: usize = 1234;
+pub const BIG_ENDIAN: usize = 4321;
+pub const PDP_ENDIAN: usize = 3412;
+pub const BYTE_ORDER: usize = 1234;
+
+// sys/select.h
+pub const FD_SETSIZE: usize = 256;
+pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 32;
+pub const __SIZEOF_PTHREAD_ATTR_T: usize = 32;
+pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 28;
+pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 24;
+pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 16;
+pub const __SIZEOF_PTHREAD_COND_T: usize = 20;
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 8;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_BARRIERATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_ONCE_T: usize = 8;
+pub const __PTHREAD_SPIN_LOCK_INITIALIZER: ::c_int = 0;
+pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
+
+// sys/resource.h
+pub const RLIM_INFINITY: ::rlim_t = 2147483647;
+pub const RLIM64_INFINITY: ::rlim64_t = 9223372036854775807;
+pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY;
+pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY;
+pub const PRIO_MIN: ::c_int = -20;
+pub const PRIO_MAX: ::c_int = 20;
+
+// pwd.h
+pub const NSS_BUFLEN_PASSWD: usize = 1024;
+
+// sys/socket.h
+pub const SOCK_TYPE_MASK: usize = 15;
+pub const PF_UNSPEC: ::c_int = 0;
+pub const PF_LOCAL: ::c_int = 1;
+pub const PF_UNIX: ::c_int = 1;
+pub const PF_FILE: ::c_int = 1;
+pub const PF_INET: ::c_int = 2;
+pub const PF_IMPLINK: ::c_int = 3;
+pub const PF_PUP: ::c_int = 4;
+pub const PF_CHAOS: ::c_int = 5;
+pub const PF_NS: ::c_int = 6;
+pub const PF_ISO: ::c_int = 7;
+pub const PF_OSI: ::c_int = 7;
+pub const PF_ECMA: ::c_int = 8;
+pub const PF_DATAKIT: ::c_int = 9;
+pub const PF_CCITT: ::c_int = 10;
+pub const PF_SNA: ::c_int = 11;
+pub const PF_DECnet: ::c_int = 12;
+pub const PF_DLI: ::c_int = 13;
+pub const PF_LAT: ::c_int = 14;
+pub const PF_HYLINK: ::c_int = 15;
+pub const PF_APPLETALK: ::c_int = 16;
+pub const PF_ROUTE: ::c_int = 17;
+pub const PF_XTP: ::c_int = 19;
+pub const PF_COIP: ::c_int = 20;
+pub const PF_CNT: ::c_int = 21;
+pub const PF_RTIP: ::c_int = 22;
+pub const PF_IPX: ::c_int = 23;
+pub const PF_SIP: ::c_int = 24;
+pub const PF_PIP: ::c_int = 25;
+pub const PF_INET6: ::c_int = 26;
+pub const PF_MAX: ::c_int = 27;
+pub const AF_UNSPEC: ::c_int = 0;
+pub const AF_LOCAL: ::c_int = 1;
+pub const AF_UNIX: ::c_int = 1;
+pub const AF_FILE: ::c_int = 1;
+pub const AF_INET: ::c_int = 2;
+pub const AF_IMPLINK: ::c_int = 3;
+pub const AF_PUP: ::c_int = 4;
+pub const AF_CHAOS: ::c_int = 5;
+pub const AF_NS: ::c_int = 6;
+pub const AF_ISO: ::c_int = 7;
+pub const AF_OSI: ::c_int = 7;
+pub const AF_ECMA: ::c_int = 8;
+pub const AF_DATAKIT: ::c_int = 9;
+pub const AF_CCITT: ::c_int = 10;
+pub const AF_SNA: ::c_int = 11;
+pub const AF_DECnet: ::c_int = 12;
+pub const AF_DLI: ::c_int = 13;
+pub const AF_LAT: ::c_int = 14;
+pub const AF_HYLINK: ::c_int = 15;
+pub const AF_APPLETALK: ::c_int = 16;
+pub const AF_ROUTE: ::c_int = 17;
+pub const pseudo_AF_XTP: ::c_int = 19;
+pub const AF_COIP: ::c_int = 20;
+pub const AF_CNT: ::c_int = 21;
+pub const pseudo_AF_RTIP: ::c_int = 22;
+pub const AF_IPX: ::c_int = 23;
+pub const AF_SIP: ::c_int = 24;
+pub const pseudo_AF_PIP: ::c_int = 25;
+pub const AF_INET6: ::c_int = 26;
+pub const AF_MAX: ::c_int = 27;
+pub const SOMAXCONN: ::c_int = 4096;
+pub const _SS_SIZE: usize = 128;
+pub const CMGROUP_MAX: usize = 16;
+pub const SOL_SOCKET: ::c_int = 65535;
+
+// netinet/in.h
+pub const SOL_IP: ::c_int = 0;
+pub const IP_OPTIONS: ::c_int = 1;
+pub const IP_HDRINCL: ::c_int = 2;
+pub const IP_TOS: ::c_int = 3;
+pub const IP_TTL: ::c_int = 4;
+pub const IP_RECVOPTS: ::c_int = 5;
+pub const IP_RECVRETOPTS: ::c_int = 6;
+pub const IP_RECVDSTADDR: ::c_int = 7;
+pub const IP_RETOPTS: ::c_int = 8;
+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 IP_ADD_MEMBERSHIP: ::c_int = 12;
+pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
+pub const SOL_IPV6: ::c_int = 41;
+pub const SOL_ICMPV6: ::c_int = 58;
+pub const IPV6_ADDRFORM: ::c_int = 1;
+pub const IPV6_2292PKTINFO: ::c_int = 2;
+pub const IPV6_2292HOPOPTS: ::c_int = 3;
+pub const IPV6_2292DSTOPTS: ::c_int = 4;
+pub const IPV6_2292RTHDR: ::c_int = 5;
+pub const IPV6_2292PKTOPTIONS: ::c_int = 6;
+pub const IPV6_CHECKSUM: ::c_int = 7;
+pub const IPV6_2292HOPLIMIT: ::c_int = 8;
+pub const IPV6_RXINFO: ::c_int = 2;
+pub const IPV6_TXINFO: ::c_int = 2;
+pub const SCM_SRCINFO: ::c_int = 2;
+pub const IPV6_UNICAST_HOPS: ::c_int = 16;
+pub const IPV6_MULTICAST_IF: ::c_int = 17;
+pub const IPV6_MULTICAST_HOPS: ::c_int = 18;
+pub const IPV6_MULTICAST_LOOP: ::c_int = 19;
+pub const IPV6_JOIN_GROUP: ::c_int = 20;
+pub const IPV6_LEAVE_GROUP: ::c_int = 21;
+pub const IPV6_ROUTER_ALERT: ::c_int = 22;
+pub const IPV6_MTU_DISCOVER: ::c_int = 23;
+pub const IPV6_MTU: ::c_int = 24;
+pub const IPV6_RECVERR: ::c_int = 25;
+pub const IPV6_V6ONLY: ::c_int = 26;
+pub const IPV6_JOIN_ANYCAST: ::c_int = 27;
+pub const IPV6_LEAVE_ANYCAST: ::c_int = 28;
+pub const IPV6_RECVPKTINFO: ::c_int = 49;
+pub const IPV6_PKTINFO: ::c_int = 50;
+pub const IPV6_RECVHOPLIMIT: ::c_int = 51;
+pub const IPV6_HOPLIMIT: ::c_int = 52;
+pub const IPV6_RECVHOPOPTS: ::c_int = 53;
+pub const IPV6_HOPOPTS: ::c_int = 54;
+pub const IPV6_RTHDRDSTOPTS: ::c_int = 55;
+pub const IPV6_RECVRTHDR: ::c_int = 56;
+pub const IPV6_RTHDR: ::c_int = 57;
+pub const IPV6_RECVDSTOPTS: ::c_int = 58;
+pub const IPV6_DSTOPTS: ::c_int = 59;
+pub const IPV6_RECVPATHMTU: ::c_int = 60;
+pub const IPV6_PATHMTU: ::c_int = 61;
+pub const IPV6_DONTFRAG: ::c_int = 62;
+pub const IPV6_RECVTCLASS: ::c_int = 66;
+pub const IPV6_TCLASS: ::c_int = 67;
+pub const IPV6_ADDR_PREFERENCES: ::c_int = 72;
+pub const IPV6_MINHOPCOUNT: ::c_int = 73;
+pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20;
+pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21;
+pub const IPV6_RXHOPOPTS: ::c_int = 3;
+pub const IPV6_RXDSTOPTS: ::c_int = 4;
+pub const IPV6_RTHDR_LOOSE: ::c_int = 0;
+pub const IPV6_RTHDR_STRICT: ::c_int = 1;
+pub const IPV6_RTHDR_TYPE_0: ::c_int = 0;
+pub const IN_CLASSA_NET: u32 = 4278190080;
+pub const IN_CLASSA_NSHIFT: usize = 24;
+pub const IN_CLASSA_HOST: u32 = 16777215;
+pub const IN_CLASSA_MAX: u32 = 128;
+pub const IN_CLASSB_NET: u32 = 4294901760;
+pub const IN_CLASSB_NSHIFT: usize = 16;
+pub const IN_CLASSB_HOST: u32 = 65535;
+pub const IN_CLASSB_MAX: u32 = 65536;
+pub const IN_CLASSC_NET: u32 = 4294967040;
+pub const IN_CLASSC_NSHIFT: usize = 8;
+pub const IN_CLASSC_HOST: u32 = 255;
+pub const IN_LOOPBACKNET: u32 = 127;
+pub const INET_ADDRSTRLEN: usize = 16;
+pub const INET6_ADDRSTRLEN: usize = 46;
+
+// bits/posix1_lim.h
+pub const _POSIX_AIO_LISTIO_MAX: usize = 2;
+pub const _POSIX_AIO_MAX: usize = 1;
+pub const _POSIX_ARG_MAX: usize = 4096;
+pub const _POSIX_CHILD_MAX: usize = 25;
+pub const _POSIX_DELAYTIMER_MAX: usize = 32;
+pub const _POSIX_HOST_NAME_MAX: usize = 255;
+pub const _POSIX_LINK_MAX: usize = 8;
+pub const _POSIX_LOGIN_NAME_MAX: usize = 9;
+pub const _POSIX_MAX_CANON: usize = 255;
+pub const _POSIX_MAX_INPUT: usize = 255;
+pub const _POSIX_MQ_OPEN_MAX: usize = 8;
+pub const _POSIX_MQ_PRIO_MAX: usize = 32;
+pub const _POSIX_NAME_MAX: usize = 14;
+pub const _POSIX_NGROUPS_MAX: usize = 8;
+pub const _POSIX_OPEN_MAX: usize = 20;
+pub const _POSIX_FD_SETSIZE: usize = 20;
+pub const _POSIX_PATH_MAX: usize = 256;
+pub const _POSIX_PIPE_BUF: usize = 512;
+pub const _POSIX_RE_DUP_MAX: usize = 255;
+pub const _POSIX_RTSIG_MAX: usize = 8;
+pub const _POSIX_SEM_NSEMS_MAX: usize = 256;
+pub const _POSIX_SEM_VALUE_MAX: usize = 32767;
+pub const _POSIX_SIGQUEUE_MAX: usize = 32;
+pub const _POSIX_SSIZE_MAX: usize = 32767;
+pub const _POSIX_STREAM_MAX: usize = 8;
+pub const _POSIX_SYMLINK_MAX: usize = 255;
+pub const _POSIX_SYMLOOP_MAX: usize = 8;
+pub const _POSIX_TIMER_MAX: usize = 32;
+pub const _POSIX_TTY_NAME_MAX: usize = 9;
+pub const _POSIX_TZNAME_MAX: usize = 6;
+pub const _POSIX_QLIMIT: usize = 1;
+pub const _POSIX_HIWAT: usize = 512;
+pub const _POSIX_UIO_MAXIOV: usize = 16;
+pub const _POSIX_CLOCKRES_MIN: usize = 20000000;
+pub const NAME_MAX: usize = 255;
+pub const NGROUPS_MAX: usize = 256;
+pub const _POSIX_THREAD_KEYS_MAX: usize = 128;
+pub const _POSIX_THREAD_DESTRUCTOR_ITERATIONS: usize = 4;
+pub const _POSIX_THREAD_THREADS_MAX: usize = 64;
+pub const SEM_VALUE_MAX: ::c_int = 2147483647;
+pub const MAXNAMLEN: usize = 255;
+
+// netdb.h
+pub const _PATH_HEQUIV: &'static [u8; 17usize] = b"/etc/hosts.equiv\0";
+pub const _PATH_HOSTS: &'static [u8; 11usize] = b"/etc/hosts\0";
+pub const _PATH_NETWORKS: &'static [u8; 14usize] = b"/etc/networks\0";
+pub const _PATH_NSSWITCH_CONF: &'static [u8; 19usize] = b"/etc/nsswitch.conf\0";
+pub const _PATH_PROTOCOLS: &'static [u8; 15usize] = b"/etc/protocols\0";
+pub const _PATH_SERVICES: &'static [u8; 14usize] = b"/etc/services\0";
+pub const HOST_NOT_FOUND: ::c_int = 1;
+pub const TRY_AGAIN: ::c_int = 2;
+pub const NO_RECOVERY: ::c_int = 3;
+pub const NO_DATA: ::c_int = 4;
+pub const NETDB_INTERNAL: ::c_int = -1;
+pub const NETDB_SUCCESS: ::c_int = 0;
+pub const NO_ADDRESS: ::c_int = 4;
+pub const IPPORT_RESERVED: ::c_int = 1024;
+pub const SCOPE_DELIMITER: u8 = 37u8;
+pub const GAI_WAIT: ::c_int = 0;
+pub const GAI_NOWAIT: ::c_int = 1;
+pub const AI_PASSIVE: ::c_int = 1;
+pub const AI_CANONNAME: ::c_int = 2;
+pub const AI_NUMERICHOST: ::c_int = 4;
+pub const AI_V4MAPPED: ::c_int = 8;
+pub const AI_ALL: ::c_int = 16;
+pub const AI_ADDRCONFIG: ::c_int = 32;
+pub const AI_IDN: ::c_int = 64;
+pub const AI_CANONIDN: ::c_int = 128;
+pub const AI_NUMERICSERV: ::c_int = 1024;
+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_SYSTEM: ::c_int = -11;
+pub const EAI_OVERFLOW: ::c_int = -12;
+pub const EAI_NODATA: ::c_int = -5;
+pub const EAI_ADDRFAMILY: ::c_int = -9;
+pub const EAI_INPROGRESS: ::c_int = -100;
+pub const EAI_CANCELED: ::c_int = -101;
+pub const EAI_NOTCANCELED: ::c_int = -102;
+pub const EAI_ALLDONE: ::c_int = -103;
+pub const EAI_INTR: ::c_int = -104;
+pub const EAI_IDN_ENCODE: ::c_int = -105;
+pub const NI_MAXHOST: usize = 1025;
+pub const NI_MAXSERV: usize = 32;
+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 NI_IDN: ::c_int = 32;
+
+// time.h
+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 TIMER_ABSTIME: ::c_int = 1;
+pub const TIME_UTC: ::c_int = 1;
+
+// sys/poll.h
+pub const POLLIN: i16 = 1;
+pub const POLLPRI: i16 = 2;
+pub const POLLOUT: i16 = 4;
+pub const POLLRDNORM: i16 = 1;
+pub const POLLRDBAND: i16 = 2;
+pub const POLLWRNORM: i16 = 4;
+pub const POLLWRBAND: i16 = 4;
+pub const POLLERR: i16 = 8;
+pub const POLLHUP: i16 = 16;
+pub const POLLNVAL: i16 = 32;
+
+// locale.h
+pub const __LC_CTYPE: usize = 0;
+pub const __LC_NUMERIC: usize = 1;
+pub const __LC_TIME: usize = 2;
+pub const __LC_COLLATE: usize = 3;
+pub const __LC_MONETARY: usize = 4;
+pub const __LC_MESSAGES: usize = 5;
+pub const __LC_ALL: usize = 6;
+pub const __LC_PAPER: usize = 7;
+pub const __LC_NAME: usize = 8;
+pub const __LC_ADDRESS: usize = 9;
+pub const __LC_TELEPHONE: usize = 10;
+pub const __LC_MEASUREMENT: usize = 11;
+pub const __LC_IDENTIFICATION: usize = 12;
+pub const LC_CTYPE: ::c_int = 0;
+pub const LC_NUMERIC: ::c_int = 1;
+pub const LC_TIME: ::c_int = 2;
+pub const LC_COLLATE: ::c_int = 3;
+pub const LC_MONETARY: ::c_int = 4;
+pub const LC_MESSAGES: ::c_int = 5;
+pub const LC_ALL: ::c_int = 6;
+pub const LC_PAPER: ::c_int = 7;
+pub const LC_NAME: ::c_int = 8;
+pub const LC_ADDRESS: ::c_int = 9;
+pub const LC_TELEPHONE: ::c_int = 10;
+pub const LC_MEASUREMENT: ::c_int = 11;
+pub const LC_IDENTIFICATION: ::c_int = 12;
+pub const LC_CTYPE_MASK: ::c_int = 1;
+pub const LC_NUMERIC_MASK: ::c_int = 2;
+pub const LC_TIME_MASK: ::c_int = 4;
+pub const LC_COLLATE_MASK: ::c_int = 8;
+pub const LC_MONETARY_MASK: ::c_int = 16;
+pub const LC_MESSAGES_MASK: ::c_int = 32;
+pub const LC_PAPER_MASK: ::c_int = 128;
+pub const LC_NAME_MASK: ::c_int = 256;
+pub const LC_ADDRESS_MASK: ::c_int = 512;
+pub const LC_TELEPHONE_MASK: ::c_int = 1024;
+pub const LC_MEASUREMENT_MASK: ::c_int = 2048;
+pub const LC_IDENTIFICATION_MASK: ::c_int = 4096;
+pub const LC_ALL_MASK: ::c_int = 8127;
+
+// semaphore.h
+pub const __SIZEOF_SEM_T: usize = 20;
+
+// termios.h
+pub const IGNBRK: tcflag_t = 1;
+pub const BRKINT: tcflag_t = 2;
+pub const IGNPAR: tcflag_t = 4;
+pub const PARMRK: tcflag_t = 8;
+pub const INPCK: tcflag_t = 16;
+pub const ISTRIP: tcflag_t = 32;
+pub const INLCR: tcflag_t = 64;
+pub const IGNCR: tcflag_t = 128;
+pub const ICRNL: tcflag_t = 256;
+pub const IXON: tcflag_t = 512;
+pub const IXOFF: tcflag_t = 1024;
+pub const IXANY: tcflag_t = 2048;
+pub const IMAXBEL: tcflag_t = 8192;
+pub const IUCLC: tcflag_t = 16384;
+pub const OPOST: tcflag_t = 1;
+pub const ONLCR: tcflag_t = 2;
+pub const ONOEOT: tcflag_t = 8;
+pub const OCRNL: tcflag_t = 16;
+pub const ONOCR: tcflag_t = 32;
+pub const ONLRET: tcflag_t = 64;
+pub const NLDLY: tcflag_t = 768;
+pub const NL0: tcflag_t = 0;
+pub const NL1: tcflag_t = 256;
+pub const TABDLY: tcflag_t = 3076;
+pub const TAB0: tcflag_t = 0;
+pub const TAB1: tcflag_t = 1024;
+pub const TAB2: tcflag_t = 2048;
+pub const TAB3: tcflag_t = 4;
+pub const CRDLY: tcflag_t = 12288;
+pub const CR0: tcflag_t = 0;
+pub const CR1: tcflag_t = 4096;
+pub const CR2: tcflag_t = 8192;
+pub const CR3: tcflag_t = 12288;
+pub const FFDLY: tcflag_t = 16384;
+pub const FF0: tcflag_t = 0;
+pub const FF1: tcflag_t = 16384;
+pub const BSDLY: tcflag_t = 32768;
+pub const BS0: tcflag_t = 0;
+pub const BS1: tcflag_t = 32768;
+pub const VTDLY: tcflag_t = 65536;
+pub const VT0: tcflag_t = 0;
+pub const VT1: tcflag_t = 65536;
+pub const OLCUC: tcflag_t = 131072;
+pub const OFILL: tcflag_t = 262144;
+pub const OFDEL: tcflag_t = 524288;
+pub const CIGNORE: tcflag_t = 1;
+pub const CSIZE: tcflag_t = 768;
+pub const CS5: tcflag_t = 0;
+pub const CS6: tcflag_t = 256;
+pub const CS7: tcflag_t = 512;
+pub const CS8: tcflag_t = 768;
+pub const CSTOPB: tcflag_t = 1024;
+pub const CREAD: tcflag_t = 2048;
+pub const PARENB: tcflag_t = 4096;
+pub const PARODD: tcflag_t = 8192;
+pub const HUPCL: tcflag_t = 16384;
+pub const CLOCAL: tcflag_t = 32768;
+pub const CRTSCTS: tcflag_t = 65536;
+pub const CRTS_IFLOW: tcflag_t = 65536;
+pub const CCTS_OFLOW: tcflag_t = 65536;
+pub const CDTRCTS: tcflag_t = 131072;
+pub const MDMBUF: tcflag_t = 1048576;
+pub const CHWFLOW: tcflag_t = 1245184;
+pub const ECHOKE: tcflag_t = 1;
+pub const _ECHOE: tcflag_t = 2;
+pub const ECHOE: tcflag_t = 2;
+pub const _ECHOK: tcflag_t = 4;
+pub const ECHOK: tcflag_t = 4;
+pub const _ECHO: tcflag_t = 8;
+pub const ECHO: tcflag_t = 8;
+pub const _ECHONL: tcflag_t = 16;
+pub const ECHONL: tcflag_t = 16;
+pub const ECHOPRT: tcflag_t = 32;
+pub const ECHOCTL: tcflag_t = 64;
+pub const _ISIG: tcflag_t = 128;
+pub const ISIG: tcflag_t = 128;
+pub const _ICANON: tcflag_t = 256;
+pub const ICANON: tcflag_t = 256;
+pub const ALTWERASE: tcflag_t = 512;
+pub const _IEXTEN: tcflag_t = 1024;
+pub const IEXTEN: tcflag_t = 1024;
+pub const EXTPROC: tcflag_t = 2048;
+pub const _TOSTOP: tcflag_t = 4194304;
+pub const TOSTOP: tcflag_t = 4194304;
+pub const FLUSHO: tcflag_t = 8388608;
+pub const NOKERNINFO: tcflag_t = 33554432;
+pub const PENDIN: tcflag_t = 536870912;
+pub const _NOFLSH: tcflag_t = 2147483648;
+pub const NOFLSH: tcflag_t = 2147483648;
+pub const VEOF: cc_t = 0;
+pub const VEOL: cc_t = 1;
+pub const VEOL2: cc_t = 2;
+pub const VERASE: cc_t = 3;
+pub const VWERASE: cc_t = 4;
+pub const VKILL: cc_t = 5;
+pub const VREPRINT: cc_t = 6;
+pub const VINTR: cc_t = 8;
+pub const VQUIT: cc_t = 9;
+pub const VSUSP: cc_t = 10;
+pub const VDSUSP: cc_t = 11;
+pub const VSTART: cc_t = 12;
+pub const VSTOP: cc_t = 13;
+pub const VLNEXT: cc_t = 14;
+pub const VDISCARD: cc_t = 15;
+pub const VMIN: cc_t = 16;
+pub const VTIME: cc_t = 17;
+pub const VSTATUS: cc_t = 18;
+pub const NCCS: usize = 20;
+pub const B0: speed_t = 0;
+pub const B50: speed_t = 50;
+pub const B75: speed_t = 75;
+pub const B110: speed_t = 110;
+pub const B134: speed_t = 134;
+pub const B150: speed_t = 150;
+pub const B200: speed_t = 200;
+pub const B300: speed_t = 300;
+pub const B600: speed_t = 600;
+pub const B1200: speed_t = 1200;
+pub const B1800: speed_t = 1800;
+pub const B2400: speed_t = 2400;
+pub const B4800: speed_t = 4800;
+pub const B9600: speed_t = 9600;
+pub const B7200: speed_t = 7200;
+pub const B14400: speed_t = 14400;
+pub const B19200: speed_t = 19200;
+pub const B28800: speed_t = 28800;
+pub const B38400: speed_t = 38400;
+pub const EXTA: speed_t = 19200;
+pub const EXTB: speed_t = 38400;
+pub const B57600: speed_t = 57600;
+pub const B76800: speed_t = 76800;
+pub const B115200: speed_t = 115200;
+pub const B230400: speed_t = 230400;
+pub const B460800: speed_t = 460800;
+pub const B500000: speed_t = 500000;
+pub const B576000: speed_t = 576000;
+pub const B921600: speed_t = 921600;
+pub const B1000000: speed_t = 1000000;
+pub const B1152000: speed_t = 1152000;
+pub const B1500000: speed_t = 1500000;
+pub const B2000000: speed_t = 2000000;
+pub const B2500000: speed_t = 2500000;
+pub const B3000000: speed_t = 3000000;
+pub const B3500000: speed_t = 3500000;
+pub const B4000000: speed_t = 4000000;
+pub const TCSANOW: ::c_int = 0;
+pub const TCSADRAIN: ::c_int = 1;
+pub const TCSAFLUSH: ::c_int = 2;
+pub const TCSASOFT: ::c_int = 16;
+pub const TCIFLUSH: ::c_int = 1;
+pub const TCOFLUSH: ::c_int = 2;
+pub const TCIOFLUSH: ::c_int = 3;
+pub const TCOOFF: ::c_int = 1;
+pub const TCOON: ::c_int = 2;
+pub const TCIOFF: ::c_int = 3;
+pub const TCION: ::c_int = 4;
+pub const TTYDEF_IFLAG: tcflag_t = 11042;
+pub const TTYDEF_LFLAG: tcflag_t = 1483;
+pub const TTYDEF_CFLAG: tcflag_t = 23040;
+pub const TTYDEF_SPEED: tcflag_t = 9600;
+pub const CEOL: u8 = 0u8;
+pub const CERASE: u8 = 127;
+pub const CMIN: u8 = 1;
+pub const CQUIT: u8 = 28;
+pub const CTIME: u8 = 0;
+pub const CBRK: u8 = 0u8;
+
+// dlfcn.h
+pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
+pub const RTLD_LAZY: ::c_int = 1;
+pub const RTLD_NOW: ::c_int = 2;
+pub const RTLD_BINDING_MASK: ::c_int = 3;
+pub const RTLD_NOLOAD: ::c_int = 4;
+pub const RTLD_DEEPBIND: ::c_int = 8;
+pub const RTLD_GLOBAL: ::c_int = 256;
+pub const RTLD_LOCAL: ::c_int = 0;
+pub const RTLD_NODELETE: ::c_int = 4096;
+pub const DLFO_STRUCT_HAS_EH_DBASE: usize = 1;
+pub const DLFO_STRUCT_HAS_EH_COUNT: usize = 0;
+pub const LM_ID_BASE: c_long = 0;
+pub const LM_ID_NEWLM: c_long = -1;
+
+// bits/signum_generic.h
+pub const SIGINT: ::c_int = 2;
+pub const SIGILL: ::c_int = 4;
+pub const SIGABRT: ::c_int = 6;
+pub const SIGFPE: ::c_int = 8;
+pub const SIGSEGV: ::c_int = 11;
+pub const SIGTERM: ::c_int = 15;
+pub const SIGHUP: ::c_int = 1;
+pub const SIGQUIT: ::c_int = 3;
+pub const SIGTRAP: ::c_int = 5;
+pub const SIGKILL: ::c_int = 9;
+pub const SIGPIPE: ::c_int = 13;
+pub const SIGALRM: ::c_int = 14;
+pub const SIGIOT: ::c_int = 6;
+pub const SIGBUS: ::c_int = 10;
+pub const SIGSYS: ::c_int = 12;
+pub const SIGEMT: ::c_int = 7;
+pub const SIGINFO: ::c_int = 29;
+pub const SIGLOST: ::c_int = 32;
+pub const SIGURG: ::c_int = 16;
+pub const SIGSTOP: ::c_int = 17;
+pub const SIGTSTP: ::c_int = 18;
+pub const SIGCONT: ::c_int = 19;
+pub const SIGCHLD: ::c_int = 20;
+pub const SIGTTIN: ::c_int = 21;
+pub const SIGTTOU: ::c_int = 22;
+pub const SIGPOLL: ::c_int = 23;
+pub const SIGXCPU: ::c_int = 24;
+pub const SIGVTALRM: ::c_int = 26;
+pub const SIGPROF: ::c_int = 27;
+pub const SIGXFSZ: ::c_int = 25;
+pub const SIGUSR1: ::c_int = 30;
+pub const SIGUSR2: ::c_int = 31;
+pub const SIGWINCH: ::c_int = 28;
+pub const SIGIO: ::c_int = 23;
+pub const SIGCLD: ::c_int = 20;
+pub const __SIGRTMIN: usize = 32;
+pub const __SIGRTMAX: usize = 32;
+pub const _NSIG: usize = 33;
+pub const NSIG: usize = 33;
+
+// bits/sigaction.h
+pub const SA_ONSTACK: ::c_int = 1;
+pub const SA_RESTART: ::c_int = 2;
+pub const SA_NODEFER: ::c_int = 16;
+pub const SA_RESETHAND: ::c_int = 4;
+pub const SA_NOCLDSTOP: ::c_int = 8;
+pub const SA_SIGINFO: ::c_int = 64;
+pub const SA_INTERRUPT: ::c_int = 0;
+pub const SA_NOMASK: ::c_int = 16;
+pub const SA_ONESHOT: ::c_int = 4;
+pub const SA_STACK: ::c_int = 1;
+pub const SIG_BLOCK: ::c_int = 1;
+pub const SIG_UNBLOCK: ::c_int = 2;
+pub const SIG_SETMASK: ::c_int = 3;
+
+// bits/sigcontext.h
+pub const FPC_IE: u16 = 1;
+pub const FPC_IM: u16 = 1;
+pub const FPC_DE: u16 = 2;
+pub const FPC_DM: u16 = 2;
+pub const FPC_ZE: u16 = 4;
+pub const FPC_ZM: u16 = 4;
+pub const FPC_OE: u16 = 8;
+pub const FPC_OM: u16 = 8;
+pub const FPC_UE: u16 = 16;
+pub const FPC_PE: u16 = 32;
+pub const FPC_PC: u16 = 768;
+pub const FPC_PC_24: u16 = 0;
+pub const FPC_PC_53: u16 = 512;
+pub const FPC_PC_64: u16 = 768;
+pub const FPC_RC: u16 = 3072;
+pub const FPC_RC_RN: u16 = 0;
+pub const FPC_RC_RD: u16 = 1024;
+pub const FPC_RC_RU: u16 = 2048;
+pub const FPC_RC_CHOP: u16 = 3072;
+pub const FPC_IC: u16 = 4096;
+pub const FPC_IC_PROJ: u16 = 0;
+pub const FPC_IC_AFF: u16 = 4096;
+pub const FPS_IE: u16 = 1;
+pub const FPS_DE: u16 = 2;
+pub const FPS_ZE: u16 = 4;
+pub const FPS_OE: u16 = 8;
+pub const FPS_UE: u16 = 16;
+pub const FPS_PE: u16 = 32;
+pub const FPS_SF: u16 = 64;
+pub const FPS_ES: u16 = 128;
+pub const FPS_C0: u16 = 256;
+pub const FPS_C1: u16 = 512;
+pub const FPS_C2: u16 = 1024;
+pub const FPS_TOS: u16 = 14336;
+pub const FPS_TOS_SHIFT: u16 = 11;
+pub const FPS_C3: u16 = 16384;
+pub const FPS_BUSY: u16 = 32768;
+pub const FPE_INTOVF_TRAP: ::c_int = 1;
+pub const FPE_INTDIV_FAULT: ::c_int = 2;
+pub const FPE_FLTOVF_FAULT: ::c_int = 3;
+pub const FPE_FLTDIV_FAULT: ::c_int = 4;
+pub const FPE_FLTUND_FAULT: ::c_int = 5;
+pub const FPE_SUBRNG_FAULT: ::c_int = 7;
+pub const FPE_FLTDNR_FAULT: ::c_int = 8;
+pub const FPE_FLTINX_FAULT: ::c_int = 9;
+pub const FPE_EMERR_FAULT: ::c_int = 10;
+pub const FPE_EMBND_FAULT: ::c_int = 11;
+pub const ILL_INVOPR_FAULT: ::c_int = 1;
+pub const ILL_STACK_FAULT: ::c_int = 2;
+pub const ILL_FPEOPR_FAULT: ::c_int = 3;
+pub const DBG_SINGLE_TRAP: ::c_int = 1;
+pub const DBG_BRKPNT_FAULT: ::c_int = 2;
+pub const __NGREG: usize = 19;
+pub const NGREG: usize = 19;
+
+// bits/sigstack.h
+pub const MINSIGSTKSZ: usize = 8192;
+pub const SIGSTKSZ: usize = 40960;
+
+// sys/stat.h
+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_ISUID: mode_t = 2048;
+pub const __S_ISGID: mode_t = 1024;
+pub const __S_ISVTX: mode_t = 512;
+pub const __S_IREAD: mode_t = 256;
+pub const __S_IWRITE: mode_t = 128;
+pub const __S_IEXEC: mode_t = 64;
+pub const S_INOCACHE: mode_t = 65536;
+pub const S_IUSEUNK: mode_t = 131072;
+pub const S_IUNKNOWN: mode_t = 1835008;
+pub const S_IUNKSHIFT: mode_t = 12;
+pub const S_IPTRANS: mode_t = 2097152;
+pub const S_IATRANS: mode_t = 4194304;
+pub const S_IROOT: mode_t = 8388608;
+pub const S_ITRANS: mode_t = 14680064;
+pub const S_IMMAP0: mode_t = 16777216;
+pub const CMASK: mode_t = 18;
+pub const UF_SETTABLE: ::c_uint = 65535;
+pub const UF_NODUMP: ::c_uint = 1;
+pub const UF_IMMUTABLE: ::c_uint = 2;
+pub const UF_APPEND: ::c_uint = 4;
+pub const UF_OPAQUE: ::c_uint = 8;
+pub const UF_NOUNLINK: ::c_uint = 16;
+pub const SF_SETTABLE: ::c_uint = 4294901760;
+pub const SF_ARCHIVED: ::c_uint = 65536;
+pub const SF_IMMUTABLE: ::c_uint = 131072;
+pub const SF_APPEND: ::c_uint = 262144;
+pub const SF_NOUNLINK: ::c_uint = 1048576;
+pub const SF_SNAPSHOT: ::c_uint = 2097152;
+pub const UTIME_NOW: ::c_long = -1;
+pub const UTIME_OMIT: ::c_long = -2;
+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_IFIFO: mode_t = 4096;
+pub const S_IFLNK: mode_t = 40960;
+pub const S_IFSOCK: mode_t = 49152;
+pub const S_ISUID: mode_t = 2048;
+pub const S_ISGID: mode_t = 1024;
+pub const S_ISVTX: mode_t = 512;
+pub const S_IRUSR: mode_t = 256;
+pub const S_IWUSR: mode_t = 128;
+pub const S_IXUSR: mode_t = 64;
+pub const S_IRWXU: mode_t = 448;
+pub const S_IREAD: mode_t = 256;
+pub const S_IWRITE: mode_t = 128;
+pub const S_IEXEC: 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_IRWXG: mode_t = 56;
+pub const S_IROTH: mode_t = 4;
+pub const S_IWOTH: mode_t = 2;
+pub const S_IXOTH: mode_t = 1;
+pub const S_IRWXO: mode_t = 7;
+pub const ACCESSPERMS: mode_t = 511;
+pub const ALLPERMS: mode_t = 4095;
+pub const DEFFILEMODE: mode_t = 438;
+pub const S_BLKSIZE: usize = 512;
+pub const STATX_TYPE: ::c_uint = 1;
+pub const STATX_MODE: ::c_uint = 2;
+pub const STATX_NLINK: ::c_uint = 4;
+pub const STATX_UID: ::c_uint = 8;
+pub const STATX_GID: ::c_uint = 16;
+pub const STATX_ATIME: ::c_uint = 32;
+pub const STATX_MTIME: ::c_uint = 64;
+pub const STATX_CTIME: ::c_uint = 128;
+pub const STATX_INO: ::c_uint = 256;
+pub const STATX_SIZE: ::c_uint = 512;
+pub const STATX_BLOCKS: ::c_uint = 1024;
+pub const STATX_BASIC_STATS: ::c_uint = 2047;
+pub const STATX_ALL: ::c_uint = 4095;
+pub const STATX_BTIME: ::c_uint = 2048;
+pub const STATX_MNT_ID: ::c_uint = 4096;
+pub const STATX_DIOALIGN: ::c_uint = 8192;
+pub const STATX__RESERVED: ::c_uint = 2147483648;
+pub const STATX_ATTR_COMPRESSED: ::c_uint = 4;
+pub const STATX_ATTR_IMMUTABLE: ::c_uint = 16;
+pub const STATX_ATTR_APPEND: ::c_uint = 32;
+pub const STATX_ATTR_NODUMP: ::c_uint = 64;
+pub const STATX_ATTR_ENCRYPTED: ::c_uint = 2048;
+pub const STATX_ATTR_AUTOMOUNT: ::c_uint = 4096;
+pub const STATX_ATTR_MOUNT_ROOT: ::c_uint = 8192;
+pub const STATX_ATTR_VERITY: ::c_uint = 1048576;
+pub const STATX_ATTR_DAX: ::c_uint = 2097152;
+
+// sys/ioctl.h
+pub const TIOCM_LE: ::c_int = 1;
+pub const TIOCM_DTR: ::c_int = 2;
+pub const TIOCM_RTS: ::c_int = 4;
+pub const TIOCM_ST: ::c_int = 8;
+pub const TIOCM_SR: ::c_int = 16;
+pub const TIOCM_CTS: ::c_int = 32;
+pub const TIOCM_CAR: ::c_int = 64;
+pub const TIOCM_CD: ::c_int = 64;
+pub const TIOCM_RNG: ::c_int = 128;
+pub const TIOCM_RI: ::c_int = 128;
+pub const TIOCM_DSR: ::c_int = 256;
+pub const TIOCPKT_DATA: ::c_int = 0;
+pub const TIOCPKT_FLUSHREAD: ::c_int = 1;
+pub const TIOCPKT_FLUSHWRITE: ::c_int = 2;
+pub const TIOCPKT_STOP: ::c_int = 4;
+pub const TIOCPKT_START: ::c_int = 8;
+pub const TIOCPKT_NOSTOP: ::c_int = 16;
+pub const TIOCPKT_DOSTOP: ::c_int = 32;
+pub const TIOCPKT_IOCTL: ::c_int = 64;
+pub const TTYDISC: ::c_int = 0;
+pub const TABLDISC: ::c_int = 3;
+pub const SLIPDISC: ::c_int = 4;
+pub const TANDEM: tcflag_t = 1;
+pub const CBREAK: tcflag_t = 2;
+pub const LCASE: tcflag_t = 4;
+pub const CRMOD: tcflag_t = 16;
+pub const RAW: tcflag_t = 32;
+pub const ODDP: tcflag_t = 64;
+pub const EVENP: tcflag_t = 128;
+pub const ANYP: tcflag_t = 192;
+pub const NLDELAY: tcflag_t = 768;
+pub const NL2: tcflag_t = 512;
+pub const NL3: tcflag_t = 768;
+pub const TBDELAY: tcflag_t = 3072;
+pub const XTABS: tcflag_t = 3072;
+pub const CRDELAY: tcflag_t = 12288;
+pub const VTDELAY: tcflag_t = 16384;
+pub const BSDELAY: tcflag_t = 32768;
+pub const ALLDELAY: tcflag_t = 65280;
+pub const CRTBS: tcflag_t = 65536;
+pub const PRTERA: tcflag_t = 131072;
+pub const CRTERA: tcflag_t = 262144;
+pub const TILDE: tcflag_t = 524288;
+pub const LITOUT: tcflag_t = 2097152;
+pub const NOHANG: tcflag_t = 16777216;
+pub const L001000: tcflag_t = 33554432;
+pub const CRTKIL: tcflag_t = 67108864;
+pub const PASS8: tcflag_t = 134217728;
+pub const CTLECH: tcflag_t = 268435456;
+pub const DECCTQ: tcflag_t = 1073741824;
+
+pub const FIONBIO: ::c_ulong = 0xa008007e;
+pub const FIONREAD: ::c_ulong = 0x6008007f;
+pub const TIOCSWINSZ: ::c_ulong = 0x90200767;
+pub const TIOCGWINSZ: ::c_ulong = 0x50200768;
+pub const TIOCEXCL: ::c_ulong = 0x70d;
+pub const TIOCNXCL: ::c_ulong = 0x70e;
+pub const TIOCSCTTY: ::c_ulong = 0x761;
+
+pub const FIOCLEX: ::c_ulong = 1;
+
+// fcntl.h
+pub const O_EXEC: ::c_int = 4;
+pub const O_NORW: ::c_int = 0;
+pub const O_RDONLY: ::c_int = 1;
+pub const O_WRONLY: ::c_int = 2;
+pub const O_RDWR: ::c_int = 3;
+pub const O_ACCMODE: ::c_int = 3;
+pub const O_LARGEFILE: ::c_int = 0;
+pub const O_CREAT: ::c_int = 16;
+pub const O_EXCL: ::c_int = 32;
+pub const O_NOLINK: ::c_int = 64;
+pub const O_NOTRANS: ::c_int = 128;
+pub const O_NOFOLLOW: ::c_int = 1048576;
+pub const O_DIRECTORY: ::c_int = 2097152;
+pub const O_APPEND: ::c_int = 256;
+pub const O_ASYNC: ::c_int = 512;
+pub const O_FSYNC: ::c_int = 1024;
+pub const O_SYNC: ::c_int = 1024;
+pub const O_NOATIME: ::c_int = 2048;
+pub const O_SHLOCK: ::c_int = 131072;
+pub const O_EXLOCK: ::c_int = 262144;
+pub const O_DSYNC: ::c_int = 1024;
+pub const O_RSYNC: ::c_int = 1024;
+pub const O_NONBLOCK: ::c_int = 8;
+pub const O_NDELAY: ::c_int = 8;
+pub const O_HURD: ::c_int = 458751;
+pub const O_TRUNC: ::c_int = 65536;
+pub const O_CLOEXEC: ::c_int = 4194304;
+pub const O_IGNORE_CTTY: ::c_int = 524288;
+pub const O_TMPFILE: ::c_int = 8388608;
+pub const O_NOCTTY: ::c_int = 0;
+pub const FREAD: ::c_int = 1;
+pub const FWRITE: ::c_int = 2;
+pub const FASYNC: ::c_int = 512;
+pub const FCREAT: ::c_int = 16;
+pub const FEXCL: ::c_int = 32;
+pub const FTRUNC: ::c_int = 65536;
+pub const FNOCTTY: ::c_int = 0;
+pub const FFSYNC: ::c_int = 1024;
+pub const FSYNC: ::c_int = 1024;
+pub const FAPPEND: ::c_int = 256;
+pub const FNONBLOCK: ::c_int = 8;
+pub const FNDELAY: ::c_int = 8;
+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_GETLK64: ::c_int = 10;
+pub const F_SETLK64: ::c_int = 11;
+pub const F_SETLKW64: ::c_int = 12;
+pub const F_DUPFD_CLOEXEC: ::c_int = 1030;
+pub const FD_CLOEXEC: ::c_int = 1;
+pub const F_RDLCK: ::c_int = 1;
+pub const F_WRLCK: ::c_int = 2;
+pub const F_UNLCK: ::c_int = 3;
+pub const POSIX_FADV_NORMAL: ::c_int = 0;
+pub const POSIX_FADV_RANDOM: ::c_int = 1;
+pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
+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 AT_FDCWD: ::c_int = -100;
+pub const AT_SYMLINK_NOFOLLOW: ::c_int = 256;
+pub const AT_REMOVEDIR: ::c_int = 512;
+pub const AT_SYMLINK_FOLLOW: ::c_int = 1024;
+pub const AT_NO_AUTOMOUNT: ::c_int = 2048;
+pub const AT_EMPTY_PATH: ::c_int = 4096;
+pub const AT_STATX_SYNC_TYPE: ::c_int = 24576;
+pub const AT_STATX_SYNC_AS_STAT: ::c_int = 0;
+pub const AT_STATX_FORCE_SYNC: ::c_int = 8192;
+pub const AT_STATX_DONT_SYNC: ::c_int = 16384;
+pub const AT_RECURSIVE: ::c_int = 32768;
+pub const AT_EACCESS: ::c_int = 512;
+
+// sys/uio.h
+pub const RWF_HIPRI: ::c_int = 1;
+pub const RWF_DSYNC: ::c_int = 2;
+pub const RWF_SYNC: ::c_int = 4;
+pub const RWF_NOWAIT: ::c_int = 8;
+pub const RWF_APPEND: ::c_int = 16;
+
+// errno.h
+pub const EPERM: ::c_int = 1073741825;
+pub const ENOENT: ::c_int = 1073741826;
+pub const ESRCH: ::c_int = 1073741827;
+pub const EINTR: ::c_int = 1073741828;
+pub const EIO: ::c_int = 1073741829;
+pub const ENXIO: ::c_int = 1073741830;
+pub const E2BIG: ::c_int = 1073741831;
+pub const ENOEXEC: ::c_int = 1073741832;
+pub const EBADF: ::c_int = 1073741833;
+pub const ECHILD: ::c_int = 1073741834;
+pub const EDEADLK: ::c_int = 1073741835;
+pub const ENOMEM: ::c_int = 1073741836;
+pub const EACCES: ::c_int = 1073741837;
+pub const EFAULT: ::c_int = 1073741838;
+pub const ENOTBLK: ::c_int = 1073741839;
+pub const EBUSY: ::c_int = 1073741840;
+pub const EEXIST: ::c_int = 1073741841;
+pub const EXDEV: ::c_int = 1073741842;
+pub const ENODEV: ::c_int = 1073741843;
+pub const ENOTDIR: ::c_int = 1073741844;
+pub const EISDIR: ::c_int = 1073741845;
+pub const EINVAL: ::c_int = 1073741846;
+pub const EMFILE: ::c_int = 1073741848;
+pub const ENFILE: ::c_int = 1073741847;
+pub const ENOTTY: ::c_int = 1073741849;
+pub const ETXTBSY: ::c_int = 1073741850;
+pub const EFBIG: ::c_int = 1073741851;
+pub const ENOSPC: ::c_int = 1073741852;
+pub const ESPIPE: ::c_int = 1073741853;
+pub const EROFS: ::c_int = 1073741854;
+pub const EMLINK: ::c_int = 1073741855;
+pub const EPIPE: ::c_int = 1073741856;
+pub const EDOM: ::c_int = 1073741857;
+pub const ERANGE: ::c_int = 1073741858;
+pub const EAGAIN: ::c_int = 1073741859;
+pub const EWOULDBLOCK: ::c_int = 1073741859;
+pub const EINPROGRESS: ::c_int = 1073741860;
+pub const EALREADY: ::c_int = 1073741861;
+pub const ENOTSOCK: ::c_int = 1073741862;
+pub const EMSGSIZE: ::c_int = 1073741864;
+pub const EPROTOTYPE: ::c_int = 1073741865;
+pub const ENOPROTOOPT: ::c_int = 1073741866;
+pub const EPROTONOSUPPORT: ::c_int = 1073741867;
+pub const ESOCKTNOSUPPORT: ::c_int = 1073741868;
+pub const EOPNOTSUPP: ::c_int = 1073741869;
+pub const EPFNOSUPPORT: ::c_int = 1073741870;
+pub const EAFNOSUPPORT: ::c_int = 1073741871;
+pub const EADDRINUSE: ::c_int = 1073741872;
+pub const EADDRNOTAVAIL: ::c_int = 1073741873;
+pub const ENETDOWN: ::c_int = 1073741874;
+pub const ENETUNREACH: ::c_int = 1073741875;
+pub const ENETRESET: ::c_int = 1073741876;
+pub const ECONNABORTED: ::c_int = 1073741877;
+pub const ECONNRESET: ::c_int = 1073741878;
+pub const ENOBUFS: ::c_int = 1073741879;
+pub const EISCONN: ::c_int = 1073741880;
+pub const ENOTCONN: ::c_int = 1073741881;
+pub const EDESTADDRREQ: ::c_int = 1073741863;
+pub const ESHUTDOWN: ::c_int = 1073741882;
+pub const ETOOMANYREFS: ::c_int = 1073741883;
+pub const ETIMEDOUT: ::c_int = 1073741884;
+pub const ECONNREFUSED: ::c_int = 1073741885;
+pub const ELOOP: ::c_int = 1073741886;
+pub const ENAMETOOLONG: ::c_int = 1073741887;
+pub const EHOSTDOWN: ::c_int = 1073741888;
+pub const EHOSTUNREACH: ::c_int = 1073741889;
+pub const ENOTEMPTY: ::c_int = 1073741890;
+pub const EPROCLIM: ::c_int = 1073741891;
+pub const EUSERS: ::c_int = 1073741892;
+pub const EDQUOT: ::c_int = 1073741893;
+pub const ESTALE: ::c_int = 1073741894;
+pub const EREMOTE: ::c_int = 1073741895;
+pub const EBADRPC: ::c_int = 1073741896;
+pub const ERPCMISMATCH: ::c_int = 1073741897;
+pub const EPROGUNAVAIL: ::c_int = 1073741898;
+pub const EPROGMISMATCH: ::c_int = 1073741899;
+pub const EPROCUNAVAIL: ::c_int = 1073741900;
+pub const ENOLCK: ::c_int = 1073741901;
+pub const EFTYPE: ::c_int = 1073741903;
+pub const EAUTH: ::c_int = 1073741904;
+pub const ENEEDAUTH: ::c_int = 1073741905;
+pub const ENOSYS: ::c_int = 1073741902;
+pub const ELIBEXEC: ::c_int = 1073741907;
+pub const ENOTSUP: ::c_int = 1073741942;
+pub const EILSEQ: ::c_int = 1073741930;
+pub const EBACKGROUND: ::c_int = 1073741924;
+pub const EDIED: ::c_int = 1073741925;
+pub const EGREGIOUS: ::c_int = 1073741927;
+pub const EIEIO: ::c_int = 1073741928;
+pub const EGRATUITOUS: ::c_int = 1073741929;
+pub const EBADMSG: ::c_int = 1073741931;
+pub const EIDRM: ::c_int = 1073741932;
+pub const EMULTIHOP: ::c_int = 1073741933;
+pub const ENODATA: ::c_int = 1073741934;
+pub const ENOLINK: ::c_int = 1073741935;
+pub const ENOMSG: ::c_int = 1073741936;
+pub const ENOSR: ::c_int = 1073741937;
+pub const ENOSTR: ::c_int = 1073741938;
+pub const EOVERFLOW: ::c_int = 1073741939;
+pub const EPROTO: ::c_int = 1073741940;
+pub const ETIME: ::c_int = 1073741941;
+pub const ECANCELED: ::c_int = 1073741943;
+pub const EOWNERDEAD: ::c_int = 1073741944;
+pub const ENOTRECOVERABLE: ::c_int = 1073741945;
+pub const EMACH_SEND_IN_PROGRESS: ::c_int = 268435457;
+pub const EMACH_SEND_INVALID_DATA: ::c_int = 268435458;
+pub const EMACH_SEND_INVALID_DEST: ::c_int = 268435459;
+pub const EMACH_SEND_TIMED_OUT: ::c_int = 268435460;
+pub const EMACH_SEND_WILL_NOTIFY: ::c_int = 268435461;
+pub const EMACH_SEND_NOTIFY_IN_PROGRESS: ::c_int = 268435462;
+pub const EMACH_SEND_INTERRUPTED: ::c_int = 268435463;
+pub const EMACH_SEND_MSG_TOO_SMALL: ::c_int = 268435464;
+pub const EMACH_SEND_INVALID_REPLY: ::c_int = 268435465;
+pub const EMACH_SEND_INVALID_RIGHT: ::c_int = 268435466;
+pub const EMACH_SEND_INVALID_NOTIFY: ::c_int = 268435467;
+pub const EMACH_SEND_INVALID_MEMORY: ::c_int = 268435468;
+pub const EMACH_SEND_NO_BUFFER: ::c_int = 268435469;
+pub const EMACH_SEND_NO_NOTIFY: ::c_int = 268435470;
+pub const EMACH_SEND_INVALID_TYPE: ::c_int = 268435471;
+pub const EMACH_SEND_INVALID_HEADER: ::c_int = 268435472;
+pub const EMACH_RCV_IN_PROGRESS: ::c_int = 268451841;
+pub const EMACH_RCV_INVALID_NAME: ::c_int = 268451842;
+pub const EMACH_RCV_TIMED_OUT: ::c_int = 268451843;
+pub const EMACH_RCV_TOO_LARGE: ::c_int = 268451844;
+pub const EMACH_RCV_INTERRUPTED: ::c_int = 268451845;
+pub const EMACH_RCV_PORT_CHANGED: ::c_int = 268451846;
+pub const EMACH_RCV_INVALID_NOTIFY: ::c_int = 268451847;
+pub const EMACH_RCV_INVALID_DATA: ::c_int = 268451848;
+pub const EMACH_RCV_PORT_DIED: ::c_int = 268451849;
+pub const EMACH_RCV_IN_SET: ::c_int = 268451850;
+pub const EMACH_RCV_HEADER_ERROR: ::c_int = 268451851;
+pub const EMACH_RCV_BODY_ERROR: ::c_int = 268451852;
+pub const EKERN_INVALID_ADDRESS: ::c_int = 1;
+pub const EKERN_PROTECTION_FAILURE: ::c_int = 2;
+pub const EKERN_NO_SPACE: ::c_int = 3;
+pub const EKERN_INVALID_ARGUMENT: ::c_int = 4;
+pub const EKERN_FAILURE: ::c_int = 5;
+pub const EKERN_RESOURCE_SHORTAGE: ::c_int = 6;
+pub const EKERN_NOT_RECEIVER: ::c_int = 7;
+pub const EKERN_NO_ACCESS: ::c_int = 8;
+pub const EKERN_MEMORY_FAILURE: ::c_int = 9;
+pub const EKERN_MEMORY_ERROR: ::c_int = 10;
+pub const EKERN_NOT_IN_SET: ::c_int = 12;
+pub const EKERN_NAME_EXISTS: ::c_int = 13;
+pub const EKERN_ABORTED: ::c_int = 14;
+pub const EKERN_INVALID_NAME: ::c_int = 15;
+pub const EKERN_INVALID_TASK: ::c_int = 16;
+pub const EKERN_INVALID_RIGHT: ::c_int = 17;
+pub const EKERN_INVALID_VALUE: ::c_int = 18;
+pub const EKERN_UREFS_OVERFLOW: ::c_int = 19;
+pub const EKERN_INVALID_CAPABILITY: ::c_int = 20;
+pub const EKERN_RIGHT_EXISTS: ::c_int = 21;
+pub const EKERN_INVALID_HOST: ::c_int = 22;
+pub const EKERN_MEMORY_PRESENT: ::c_int = 23;
+pub const EKERN_WRITE_PROTECTION_FAILURE: ::c_int = 24;
+pub const EKERN_TERMINATED: ::c_int = 26;
+pub const EKERN_TIMEDOUT: ::c_int = 27;
+pub const EKERN_INTERRUPTED: ::c_int = 28;
+pub const EMIG_TYPE_ERROR: ::c_int = -300;
+pub const EMIG_REPLY_MISMATCH: ::c_int = -301;
+pub const EMIG_REMOTE_ERROR: ::c_int = -302;
+pub const EMIG_BAD_ID: ::c_int = -303;
+pub const EMIG_BAD_ARGUMENTS: ::c_int = -304;
+pub const EMIG_NO_REPLY: ::c_int = -305;
+pub const EMIG_EXCEPTION: ::c_int = -306;
+pub const EMIG_ARRAY_TOO_LARGE: ::c_int = -307;
+pub const EMIG_SERVER_DIED: ::c_int = -308;
+pub const EMIG_DESTROY_REQUEST: ::c_int = -309;
+pub const ED_IO_ERROR: ::c_int = 2500;
+pub const ED_WOULD_BLOCK: ::c_int = 2501;
+pub const ED_NO_SUCH_DEVICE: ::c_int = 2502;
+pub const ED_ALREADY_OPEN: ::c_int = 2503;
+pub const ED_DEVICE_DOWN: ::c_int = 2504;
+pub const ED_INVALID_OPERATION: ::c_int = 2505;
+pub const ED_INVALID_RECNUM: ::c_int = 2506;
+pub const ED_INVALID_SIZE: ::c_int = 2507;
+pub const ED_NO_MEMORY: ::c_int = 2508;
+pub const ED_READ_ONLY: ::c_int = 2509;
+pub const _HURD_ERRNOS: usize = 122;
+
+// sched.h
+pub const SCHED_OTHER: ::c_int = 0;
+pub const SCHED_FIFO: ::c_int = 1;
+pub const SCHED_RR: ::c_int = 2;
+pub const _BITS_TYPES_STRUCT_SCHED_PARAM: usize = 1;
+pub const __CPU_SETSIZE: usize = 1024;
+pub const CPU_SETSIZE: usize = 1024;
+
+// pthread.h
+pub const PTHREAD_SPINLOCK_INITIALIZER: ::c_int = 0;
+pub const PTHREAD_CANCEL_DISABLE: ::c_int = 0;
+pub const PTHREAD_CANCEL_ENABLE: ::c_int = 1;
+pub const PTHREAD_CANCEL_DEFERRED: ::c_int = 0;
+pub const PTHREAD_CANCEL_ASYNCHRONOUS: ::c_int = 1;
+pub const PTHREAD_BARRIER_SERIAL_THREAD: ::c_int = -1;
+
+// netinet/tcp.h
+pub const TCP_NODELAY: ::c_int = 1;
+pub const TCP_MAXSEG: ::c_int = 2;
+pub const TCP_CORK: ::c_int = 3;
+pub const TCP_KEEPIDLE: ::c_int = 4;
+pub const TCP_KEEPINTVL: ::c_int = 5;
+pub const TCP_KEEPCNT: ::c_int = 6;
+pub const TCP_SYNCNT: ::c_int = 7;
+pub const TCP_LINGER2: ::c_int = 8;
+pub const TCP_DEFER_ACCEPT: ::c_int = 9;
+pub const TCP_WINDOW_CLAMP: ::c_int = 10;
+pub const TCP_INFO: ::c_int = 11;
+pub const TCP_QUICKACK: ::c_int = 12;
+pub const TCP_CONGESTION: ::c_int = 13;
+pub const TCP_MD5SIG: ::c_int = 14;
+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 TCP_NOTSENT_LOWAT: ::c_int = 25;
+pub const TCP_CC_INFO: ::c_int = 26;
+pub const TCP_SAVE_SYN: ::c_int = 27;
+pub const TCP_SAVED_SYN: ::c_int = 28;
+pub const TCP_REPAIR_WINDOW: ::c_int = 29;
+pub const TCP_FASTOPEN_CONNECT: ::c_int = 30;
+pub const TCP_ULP: ::c_int = 31;
+pub const TCP_MD5SIG_EXT: ::c_int = 32;
+pub const TCP_FASTOPEN_KEY: ::c_int = 33;
+pub const TCP_FASTOPEN_NO_COOKIE: ::c_int = 34;
+pub const TCP_ZEROCOPY_RECEIVE: ::c_int = 35;
+pub const TCP_INQ: ::c_int = 36;
+pub const TCP_CM_INQ: ::c_int = 36;
+pub const TCP_TX_DELAY: ::c_int = 37;
+pub const TCP_REPAIR_ON: ::c_int = 1;
+pub const TCP_REPAIR_OFF: ::c_int = 0;
+pub const TCP_REPAIR_OFF_NO_WP: ::c_int = -1;
+
+// stdint.h
+pub const INT8_MIN: i8 = -128;
+pub const INT16_MIN: i16 = -32768;
+pub const INT32_MIN: i32 = -2147483648;
+pub const INT8_MAX: i8 = 127;
+pub const INT16_MAX: i16 = 32767;
+pub const INT32_MAX: i32 = 2147483647;
+pub const UINT8_MAX: u8 = 255;
+pub const UINT16_MAX: u16 = 65535;
+pub const UINT32_MAX: u32 = 4294967295;
+pub const INT_LEAST8_MIN: int_least8_t = -128;
+pub const INT_LEAST16_MIN: int_least16_t = -32768;
+pub const INT_LEAST32_MIN: int_least32_t = -2147483648;
+pub const INT_LEAST8_MAX: int_least8_t = 127;
+pub const INT_LEAST16_MAX: int_least16_t = 32767;
+pub const INT_LEAST32_MAX: int_least32_t = 2147483647;
+pub const UINT_LEAST8_MAX: uint_least8_t = 255;
+pub const UINT_LEAST16_MAX: uint_least16_t = 65535;
+pub const UINT_LEAST32_MAX: uint_least32_t = 4294967295;
+pub const INT_FAST8_MIN: int_fast8_t = -128;
+pub const INT_FAST16_MIN: int_fast16_t = -2147483648;
+pub const INT_FAST32_MIN: int_fast32_t = -2147483648;
+pub const INT_FAST8_MAX: int_fast8_t = 127;
+pub const INT_FAST16_MAX: int_fast16_t = 2147483647;
+pub const INT_FAST32_MAX: int_fast32_t = 2147483647;
+pub const UINT_FAST8_MAX: uint_fast8_t = 255;
+pub const UINT_FAST16_MAX: uint_fast16_t = 4294967295;
+pub const UINT_FAST32_MAX: uint_fast32_t = 4294967295;
+pub const INTPTR_MIN: __intptr_t = -2147483648;
+pub const INTPTR_MAX: __intptr_t = 2147483647;
+pub const UINTPTR_MAX: usize = 4294967295;
+pub const PTRDIFF_MIN: __ptrdiff_t = -2147483648;
+pub const PTRDIFF_MAX: __ptrdiff_t = 2147483647;
+pub const SIG_ATOMIC_MIN: __sig_atomic_t = -2147483648;
+pub const SIG_ATOMIC_MAX: __sig_atomic_t = 2147483647;
+pub const SIZE_MAX: usize = 4294967295;
+pub const WINT_MIN: wint_t = 0;
+pub const WINT_MAX: wint_t = 4294967295;
+pub const INT8_WIDTH: usize = 8;
+pub const UINT8_WIDTH: usize = 8;
+pub const INT16_WIDTH: usize = 16;
+pub const UINT16_WIDTH: usize = 16;
+pub const INT32_WIDTH: usize = 32;
+pub const UINT32_WIDTH: usize = 32;
+pub const INT64_WIDTH: usize = 64;
+pub const UINT64_WIDTH: usize = 64;
+pub const INT_LEAST8_WIDTH: usize = 8;
+pub const UINT_LEAST8_WIDTH: usize = 8;
+pub const INT_LEAST16_WIDTH: usize = 16;
+pub const UINT_LEAST16_WIDTH: usize = 16;
+pub const INT_LEAST32_WIDTH: usize = 32;
+pub const UINT_LEAST32_WIDTH: usize = 32;
+pub const INT_LEAST64_WIDTH: usize = 64;
+pub const UINT_LEAST64_WIDTH: usize = 64;
+pub const INT_FAST8_WIDTH: usize = 8;
+pub const UINT_FAST8_WIDTH: usize = 8;
+pub const INT_FAST16_WIDTH: usize = 32;
+pub const UINT_FAST16_WIDTH: usize = 32;
+pub const INT_FAST32_WIDTH: usize = 32;
+pub const UINT_FAST32_WIDTH: usize = 32;
+pub const INT_FAST64_WIDTH: usize = 64;
+pub const UINT_FAST64_WIDTH: usize = 64;
+pub const INTPTR_WIDTH: usize = 32;
+pub const UINTPTR_WIDTH: usize = 32;
+pub const INTMAX_WIDTH: usize = 64;
+pub const UINTMAX_WIDTH: usize = 64;
+pub const PTRDIFF_WIDTH: usize = 32;
+pub const SIG_ATOMIC_WIDTH: usize = 32;
+pub const SIZE_WIDTH: usize = 32;
+pub const WCHAR_WIDTH: usize = 32;
+pub const WINT_WIDTH: usize = 32;
+
+pub const TH_FIN: u8 = 1;
+pub const TH_SYN: u8 = 2;
+pub const TH_RST: u8 = 4;
+pub const TH_PUSH: u8 = 8;
+pub const TH_ACK: u8 = 16;
+pub const TH_URG: u8 = 32;
+pub const TCPOPT_EOL: u8 = 0;
+pub const TCPOPT_NOP: u8 = 1;
+pub const TCPOPT_MAXSEG: u8 = 2;
+pub const TCPOLEN_MAXSEG: u8 = 4;
+pub const TCPOPT_WINDOW: u8 = 3;
+pub const TCPOLEN_WINDOW: u8 = 3;
+pub const TCPOPT_SACK_PERMITTED: u8 = 4;
+pub const TCPOLEN_SACK_PERMITTED: u8 = 2;
+pub const TCPOPT_SACK: u8 = 5;
+pub const TCPOPT_TIMESTAMP: u8 = 8;
+pub const TCPOLEN_TIMESTAMP: u8 = 10;
+pub const TCPOLEN_TSTAMP_APPA: u8 = 12;
+pub const TCPOPT_TSTAMP_HDR: u32 = 16844810;
+pub const TCP_MSS: usize = 512;
+pub const TCP_MAXWIN: usize = 65535;
+pub const TCP_MAX_WINSHIFT: usize = 14;
+pub const SOL_TCP: ::c_int = 6;
+pub const TCPI_OPT_TIMESTAMPS: u8 = 1;
+pub const TCPI_OPT_SACK: u8 = 2;
+pub const TCPI_OPT_WSCALE: u8 = 4;
+pub const TCPI_OPT_ECN: u8 = 8;
+pub const TCPI_OPT_ECN_SEEN: u8 = 16;
+pub const TCPI_OPT_SYN_DATA: u8 = 32;
+pub const TCP_MD5SIG_MAXKEYLEN: usize = 80;
+pub const TCP_MD5SIG_FLAG_PREFIX: usize = 1;
+pub const TCP_COOKIE_MIN: usize = 8;
+pub const TCP_COOKIE_MAX: usize = 16;
+pub const TCP_COOKIE_PAIR_SIZE: usize = 32;
+pub const TCP_COOKIE_IN_ALWAYS: ::c_int = 1;
+pub const TCP_COOKIE_OUT_NEVER: ::c_int = 2;
+pub const TCP_S_DATA_IN: ::c_int = 4;
+pub const TCP_S_DATA_OUT: ::c_int = 8;
+pub const TCP_MSS_DEFAULT: usize = 536;
+pub const TCP_MSS_DESIRED: usize = 1220;
+
+// sys/wait.h
+pub const WCOREFLAG: ::c_int = 128;
+pub const WAIT_ANY: pid_t = -1;
+pub const WAIT_MYPGRP: pid_t = 0;
+
+// sys/file.h
+pub const LOCK_SH: ::c_int = 1;
+pub const LOCK_EX: ::c_int = 2;
+pub const LOCK_UN: ::c_int = 8;
+pub const LOCK_NB: ::c_int = 4;
+
+// sys/mman.h
+pub const PROT_NONE: ::c_int = 0;
+pub const PROT_READ: ::c_int = 4;
+pub const PROT_WRITE: ::c_int = 2;
+pub const PROT_EXEC: ::c_int = 1;
+pub const MAP_PRIVATE: ::c_int = 0;
+pub const MAP_FILE: ::c_int = 1;
+pub const MAP_ANON: ::c_int = 2;
+pub const MAP_SHARED: ::c_int = 16;
+pub const MAP_COPY: ::c_int = 32;
+pub const MAP_FIXED: ::c_int = 256;
+pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
+pub const MS_SYNC: ::c_int = 0;
+pub const MS_ASYNC: ::c_int = 1;
+pub const MS_INVALIDATE: ::c_int = 2;
+pub const MADV_NORMAL: ::c_int = 0;
+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;
+
+// random.h
+pub const GRND_NONBLOCK: ::c_uint = 1;
+pub const GRND_RANDOM: ::c_uint = 2;
+pub const GRND_INSECURE: ::c_uint = 4;
+
+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 = 30;
+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_EQUIV_CLASS_MAX: ::c_int = 41;
+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_CHARCLASS_NAME_MAX: ::c_int = 45;
+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_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_UIO_MAXIOV: ::c_int = 60;
+pub const _SC_IOV_MAX: ::c_int = 60;
+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_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_C_VERSION: ::c_int = 96;
+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_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_NZERO: ::c_int = 109;
+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_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_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_CLOCK_SELECTION: ::c_int = 137;
+pub const _SC_CPUTIME: ::c_int = 138;
+pub const _SC_THREAD_CPUTIME: ::c_int = 139;
+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_MONOTONIC_CLOCK: ::c_int = 149;
+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_READER_WRITER_LOCKS: ::c_int = 153;
+pub const _SC_SPIN_LOCKS: ::c_int = 154;
+pub const _SC_REGEXP: ::c_int = 155;
+pub const _SC_REGEX_VERSION: ::c_int = 156;
+pub const _SC_SHELL: ::c_int = 157;
+pub const _SC_SIGNALS: ::c_int = 158;
+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_SYSTEM_DATABASE: ::c_int = 162;
+pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163;
+pub const _SC_TIMEOUTS: ::c_int = 164;
+pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 165;
+pub const _SC_USER_GROUPS: ::c_int = 166;
+pub const _SC_USER_GROUPS_R: ::c_int = 167;
+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_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 _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 _SC_MINSIGSTKSZ: ::c_int = 249;
+pub const _SC_SIGSTKSZ: ::c_int = 250;
+
+pub const _CS_PATH: ::c_int = 0;
+pub const _CS_V6_WIDTH_RESTRICTED_ENVS: ::c_int = 1;
+pub const _CS_GNU_LIBC_VERSION: ::c_int = 2;
+pub const _CS_GNU_LIBPTHREAD_VERSION: ::c_int = 3;
+pub const _CS_V5_WIDTH_RESTRICTED_ENVS: ::c_int = 4;
+pub const _CS_V7_WIDTH_RESTRICTED_ENVS: ::c_int = 5;
+pub const _CS_LFS_CFLAGS: ::c_int = 1000;
+pub const _CS_LFS_LDFLAGS: ::c_int = 1001;
+pub const _CS_LFS_LIBS: ::c_int = 1002;
+pub const _CS_LFS_LINTFLAGS: ::c_int = 1003;
+pub const _CS_LFS64_CFLAGS: ::c_int = 1004;
+pub const _CS_LFS64_LDFLAGS: ::c_int = 1005;
+pub const _CS_LFS64_LIBS: ::c_int = 1006;
+pub const _CS_LFS64_LINTFLAGS: ::c_int = 1007;
+pub const _CS_XBS5_ILP32_OFF32_CFLAGS: ::c_int = 1100;
+pub const _CS_XBS5_ILP32_OFF32_LDFLAGS: ::c_int = 1101;
+pub const _CS_XBS5_ILP32_OFF32_LIBS: ::c_int = 1102;
+pub const _CS_XBS5_ILP32_OFF32_LINTFLAGS: ::c_int = 1103;
+pub const _CS_XBS5_ILP32_OFFBIG_CFLAGS: ::c_int = 1104;
+pub const _CS_XBS5_ILP32_OFFBIG_LDFLAGS: ::c_int = 1105;
+pub const _CS_XBS5_ILP32_OFFBIG_LIBS: ::c_int = 1106;
+pub const _CS_XBS5_ILP32_OFFBIG_LINTFLAGS: ::c_int = 1107;
+pub const _CS_XBS5_LP64_OFF64_CFLAGS: ::c_int = 1108;
+pub const _CS_XBS5_LP64_OFF64_LDFLAGS: ::c_int = 1109;
+pub const _CS_XBS5_LP64_OFF64_LIBS: ::c_int = 1110;
+pub const _CS_XBS5_LP64_OFF64_LINTFLAGS: ::c_int = 1111;
+pub const _CS_XBS5_LPBIG_OFFBIG_CFLAGS: ::c_int = 1112;
+pub const _CS_XBS5_LPBIG_OFFBIG_LDFLAGS: ::c_int = 1113;
+pub const _CS_XBS5_LPBIG_OFFBIG_LIBS: ::c_int = 1114;
+pub const _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS: ::c_int = 1115;
+pub const _CS_POSIX_V6_ILP32_OFF32_CFLAGS: ::c_int = 1116;
+pub const _CS_POSIX_V6_ILP32_OFF32_LDFLAGS: ::c_int = 1117;
+pub const _CS_POSIX_V6_ILP32_OFF32_LIBS: ::c_int = 1118;
+pub const _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS: ::c_int = 1119;
+pub const _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS: ::c_int = 1120;
+pub const _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS: ::c_int = 1121;
+pub const _CS_POSIX_V6_ILP32_OFFBIG_LIBS: ::c_int = 1122;
+pub const _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS: ::c_int = 1123;
+pub const _CS_POSIX_V6_LP64_OFF64_CFLAGS: ::c_int = 1124;
+pub const _CS_POSIX_V6_LP64_OFF64_LDFLAGS: ::c_int = 1125;
+pub const _CS_POSIX_V6_LP64_OFF64_LIBS: ::c_int = 1126;
+pub const _CS_POSIX_V6_LP64_OFF64_LINTFLAGS: ::c_int = 1127;
+pub const _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS: ::c_int = 1128;
+pub const _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS: ::c_int = 1129;
+pub const _CS_POSIX_V6_LPBIG_OFFBIG_LIBS: ::c_int = 1130;
+pub const _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS: ::c_int = 1131;
+pub const _CS_POSIX_V7_ILP32_OFF32_CFLAGS: ::c_int = 1132;
+pub const _CS_POSIX_V7_ILP32_OFF32_LDFLAGS: ::c_int = 1133;
+pub const _CS_POSIX_V7_ILP32_OFF32_LIBS: ::c_int = 1134;
+pub const _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS: ::c_int = 1135;
+pub const _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS: ::c_int = 1136;
+pub const _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS: ::c_int = 1137;
+pub const _CS_POSIX_V7_ILP32_OFFBIG_LIBS: ::c_int = 1138;
+pub const _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS: ::c_int = 1139;
+pub const _CS_POSIX_V7_LP64_OFF64_CFLAGS: ::c_int = 1140;
+pub const _CS_POSIX_V7_LP64_OFF64_LDFLAGS: ::c_int = 1141;
+pub const _CS_POSIX_V7_LP64_OFF64_LIBS: ::c_int = 1142;
+pub const _CS_POSIX_V7_LP64_OFF64_LINTFLAGS: ::c_int = 1143;
+pub const _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS: ::c_int = 1144;
+pub const _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS: ::c_int = 1145;
+pub const _CS_POSIX_V7_LPBIG_OFFBIG_LIBS: ::c_int = 1146;
+pub const _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS: ::c_int = 1147;
+pub const _CS_V6_ENV: ::c_int = 1148;
+pub const _CS_V7_ENV: ::c_int = 1149;
+
+pub const PTHREAD_PROCESS_PRIVATE: __pthread_process_shared = 0;
+pub const PTHREAD_PROCESS_SHARED: __pthread_process_shared = 1;
+
+pub const PTHREAD_EXPLICIT_SCHED: __pthread_inheritsched = 0;
+pub const PTHREAD_INHERIT_SCHED: __pthread_inheritsched = 1;
+
+pub const PTHREAD_SCOPE_SYSTEM: __pthread_contentionscope = 0;
+pub const PTHREAD_SCOPE_PROCESS: __pthread_contentionscope = 1;
+
+pub const PTHREAD_CREATE_JOINABLE: __pthread_detachstate = 0;
+pub const PTHREAD_CREATE_DETACHED: __pthread_detachstate = 1;
+
+pub const PTHREAD_PRIO_NONE: __pthread_mutex_protocol = 0;
+pub const PTHREAD_PRIO_INHERIT: __pthread_mutex_protocol = 1;
+pub const PTHREAD_PRIO_PROTECT: __pthread_mutex_protocol = 2;
+
+pub const PTHREAD_MUTEX_TIMED: __pthread_mutex_type = 0;
+pub const PTHREAD_MUTEX_ERRORCHECK: __pthread_mutex_type = 1;
+pub const PTHREAD_MUTEX_RECURSIVE: __pthread_mutex_type = 2;
+
+pub const PTHREAD_MUTEX_STALLED: __pthread_mutex_robustness = 0;
+pub const PTHREAD_MUTEX_ROBUST: __pthread_mutex_robustness = 256;
+
+pub const RLIMIT_CPU: __rlimit_resource = 0;
+pub const RLIMIT_FSIZE: __rlimit_resource = 1;
+pub const RLIMIT_DATA: __rlimit_resource = 2;
+pub const RLIMIT_STACK: __rlimit_resource = 3;
+pub const RLIMIT_CORE: __rlimit_resource = 4;
+pub const RLIMIT_RSS: __rlimit_resource = 5;
+pub const RLIMIT_MEMLOCK: __rlimit_resource = 6;
+pub const RLIMIT_NPROC: __rlimit_resource = 7;
+pub const RLIMIT_OFILE: __rlimit_resource = 8;
+pub const RLIMIT_NOFILE: __rlimit_resource = 8;
+pub const RLIMIT_SBSIZE: __rlimit_resource = 9;
+pub const RLIMIT_AS: __rlimit_resource = 10;
+pub const RLIMIT_VMEM: __rlimit_resource = 10;
+pub const RLIMIT_NLIMITS: __rlimit_resource = 11;
+pub const RLIM_NLIMITS: __rlimit_resource = 11;
+
+pub const RUSAGE_SELF: __rusage_who = 0;
+pub const RUSAGE_CHILDREN: __rusage_who = -1;
+
+pub const PRIO_PROCESS: __priority_which = 0;
+pub const PRIO_PGRP: __priority_which = 1;
+pub const PRIO_USER: __priority_which = 2;
+
+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 SOCK_CLOEXEC: ::c_int = 4194304;
+pub const SOCK_NONBLOCK: ::c_int = 2048;
+
+pub const MSG_OOB: ::c_int = 1;
+pub const MSG_PEEK: ::c_int = 2;
+pub const MSG_DONTROUTE: ::c_int = 4;
+pub const MSG_EOR: ::c_int = 8;
+pub const MSG_TRUNC: ::c_int = 16;
+pub const MSG_CTRUNC: ::c_int = 32;
+pub const MSG_WAITALL: ::c_int = 64;
+pub const MSG_DONTWAIT: ::c_int = 128;
+pub const MSG_NOSIGNAL: ::c_int = 1024;
+
+pub const SCM_RIGHTS: ::c_int = 1;
+pub const SCM_TIMESTAMP: ::c_int = 2;
+pub const SCM_CREDS: ::c_int = 3;
+
+pub const SO_DEBUG: ::c_int = 1;
+pub const SO_ACCEPTCONN: ::c_int = 2;
+pub const SO_REUSEADDR: ::c_int = 4;
+pub const SO_KEEPALIVE: ::c_int = 8;
+pub const SO_DONTROUTE: ::c_int = 16;
+pub const SO_BROADCAST: ::c_int = 32;
+pub const SO_USELOOPBACK: ::c_int = 64;
+pub const SO_LINGER: ::c_int = 128;
+pub const SO_OOBINLINE: ::c_int = 256;
+pub const SO_REUSEPORT: ::c_int = 512;
+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_SNDTIMEO: ::c_int = 4101;
+pub const SO_RCVTIMEO: ::c_int = 4102;
+pub const SO_ERROR: ::c_int = 4103;
+pub const SO_STYLE: ::c_int = 4104;
+pub const SO_TYPE: ::c_int = 4104;
+
+pub const IPPROTO_IP: ::c_int = 0;
+pub const IPPROTO_ICMP: ::c_int = 1;
+pub const IPPROTO_IGMP: ::c_int = 2;
+pub const IPPROTO_IPIP: ::c_int = 4;
+pub const IPPROTO_TCP: ::c_int = 6;
+pub const IPPROTO_EGP: ::c_int = 8;
+pub const IPPROTO_PUP: ::c_int = 12;
+pub const IPPROTO_UDP: ::c_int = 17;
+pub const IPPROTO_IDP: ::c_int = 22;
+pub const IPPROTO_TP: ::c_int = 29;
+pub const IPPROTO_DCCP: ::c_int = 33;
+pub const IPPROTO_IPV6: ::c_int = 41;
+pub const IPPROTO_RSVP: ::c_int = 46;
+pub const IPPROTO_GRE: ::c_int = 47;
+pub const IPPROTO_ESP: ::c_int = 50;
+pub const IPPROTO_AH: ::c_int = 51;
+pub const IPPROTO_MTP: ::c_int = 92;
+pub const IPPROTO_BEETPH: ::c_int = 94;
+pub const IPPROTO_ENCAP: ::c_int = 98;
+pub const IPPROTO_PIM: ::c_int = 103;
+pub const IPPROTO_COMP: ::c_int = 108;
+pub const IPPROTO_L2TP: ::c_int = 115;
+pub const IPPROTO_SCTP: ::c_int = 132;
+pub const IPPROTO_UDPLITE: ::c_int = 136;
+pub const IPPROTO_MPLS: ::c_int = 137;
+pub const IPPROTO_ETHERNET: ::c_int = 143;
+pub const IPPROTO_RAW: ::c_int = 255;
+pub const IPPROTO_MPTCP: ::c_int = 262;
+pub const IPPROTO_MAX: ::c_int = 263;
+
+pub const IPPROTO_HOPOPTS: ::c_int = 0;
+pub const IPPROTO_ROUTING: ::c_int = 43;
+pub const IPPROTO_FRAGMENT: ::c_int = 44;
+pub const IPPROTO_ICMPV6: ::c_int = 58;
+pub const IPPROTO_NONE: ::c_int = 59;
+pub const IPPROTO_DSTOPTS: ::c_int = 60;
+pub const IPPROTO_MH: ::c_int = 135;
+
+pub const IPPORT_ECHO: in_port_t = 7;
+pub const IPPORT_DISCARD: in_port_t = 9;
+pub const IPPORT_SYSTAT: in_port_t = 11;
+pub const IPPORT_DAYTIME: in_port_t = 13;
+pub const IPPORT_NETSTAT: in_port_t = 15;
+pub const IPPORT_FTP: in_port_t = 21;
+pub const IPPORT_TELNET: in_port_t = 23;
+pub const IPPORT_SMTP: in_port_t = 25;
+pub const IPPORT_TIMESERVER: in_port_t = 37;
+pub const IPPORT_NAMESERVER: in_port_t = 42;
+pub const IPPORT_WHOIS: in_port_t = 43;
+pub const IPPORT_MTP: in_port_t = 57;
+pub const IPPORT_TFTP: in_port_t = 69;
+pub const IPPORT_RJE: in_port_t = 77;
+pub const IPPORT_FINGER: in_port_t = 79;
+pub const IPPORT_TTYLINK: in_port_t = 87;
+pub const IPPORT_SUPDUP: in_port_t = 95;
+pub const IPPORT_EXECSERVER: in_port_t = 512;
+pub const IPPORT_LOGINSERVER: in_port_t = 513;
+pub const IPPORT_CMDSERVER: in_port_t = 514;
+pub const IPPORT_EFSSERVER: in_port_t = 520;
+pub const IPPORT_BIFFUDP: in_port_t = 512;
+pub const IPPORT_WHOSERVER: in_port_t = 513;
+pub const IPPORT_ROUTESERVER: in_port_t = 520;
+pub const IPPORT_USERRESERVED: in_port_t = 5000;
+
+pub const DT_UNKNOWN: ::c_uchar = 0;
+pub const DT_FIFO: ::c_uchar = 1;
+pub const DT_CHR: ::c_uchar = 2;
+pub const DT_DIR: ::c_uchar = 4;
+pub const DT_BLK: ::c_uchar = 6;
+pub const DT_REG: ::c_uchar = 8;
+pub const DT_LNK: ::c_uchar = 10;
+pub const DT_SOCK: ::c_uchar = 12;
+pub const DT_WHT: ::c_uchar = 14;
+
+pub const ST_RDONLY: ::c_ulong = 1;
+pub const ST_NOSUID: ::c_ulong = 2;
+pub const ST_NOEXEC: ::c_ulong = 8;
+pub const ST_SYNCHRONOUS: ::c_ulong = 16;
+pub const ST_NOATIME: ::c_ulong = 32;
+pub const ST_RELATIME: ::c_ulong = 64;
+
+pub const RTLD_DI_LMID: ::c_int = 1;
+pub const RTLD_DI_LINKMAP: ::c_int = 2;
+pub const RTLD_DI_CONFIGADDR: ::c_int = 3;
+pub const RTLD_DI_SERINFO: ::c_int = 4;
+pub const RTLD_DI_SERINFOSIZE: ::c_int = 5;
+pub const RTLD_DI_ORIGIN: ::c_int = 6;
+pub const RTLD_DI_PROFILENAME: ::c_int = 7;
+pub const RTLD_DI_PROFILEOUT: ::c_int = 8;
+pub const RTLD_DI_TLS_MODID: ::c_int = 9;
+pub const RTLD_DI_TLS_DATA: ::c_int = 10;
+pub const RTLD_DI_PHDR: ::c_int = 11;
+pub const RTLD_DI_MAX: ::c_int = 11;
+
+pub const SI_ASYNCIO: ::c_int = -4;
+pub const SI_MESGQ: ::c_int = -3;
+pub const SI_TIMER: ::c_int = -2;
+pub const SI_QUEUE: ::c_int = -1;
+pub const SI_USER: ::c_int = 0;
+
+pub const ILL_ILLOPC: ::c_int = 1;
+pub const ILL_ILLOPN: ::c_int = 2;
+pub const ILL_ILLADR: ::c_int = 3;
+pub const ILL_ILLTRP: ::c_int = 4;
+pub const ILL_PRVOPC: ::c_int = 5;
+pub const ILL_PRVREG: ::c_int = 6;
+pub const ILL_COPROC: ::c_int = 7;
+pub const ILL_BADSTK: ::c_int = 8;
+
+pub const FPE_INTDIV: ::c_int = 1;
+pub const FPE_INTOVF: ::c_int = 2;
+pub const FPE_FLTDIV: ::c_int = 3;
+pub const FPE_FLTOVF: ::c_int = 4;
+pub const FPE_FLTUND: ::c_int = 5;
+pub const FPE_FLTRES: ::c_int = 6;
+pub const FPE_FLTINV: ::c_int = 7;
+pub const FPE_FLTSUB: ::c_int = 8;
+
+pub const SEGV_MAPERR: ::c_int = 1;
+pub const SEGV_ACCERR: ::c_int = 2;
+
+pub const BUS_ADRALN: ::c_int = 1;
+pub const BUS_ADRERR: ::c_int = 2;
+pub const BUS_OBJERR: ::c_int = 3;
+
+pub const TRAP_BRKPT: ::c_int = 1;
+pub const TRAP_TRACE: ::c_int = 2;
+
+pub const CLD_EXITED: ::c_int = 1;
+pub const CLD_KILLED: ::c_int = 2;
+pub const CLD_DUMPED: ::c_int = 3;
+pub const CLD_TRAPPED: ::c_int = 4;
+pub const CLD_STOPPED: ::c_int = 5;
+pub const CLD_CONTINUED: ::c_int = 6;
+
+pub const POLL_IN: ::c_int = 1;
+pub const POLL_OUT: ::c_int = 2;
+pub const POLL_MSG: ::c_int = 3;
+pub const POLL_ERR: ::c_int = 4;
+pub const POLL_PRI: ::c_int = 5;
+pub const POLL_HUP: ::c_int = 6;
+
+pub const SIGEV_SIGNAL: ::c_int = 0;
+pub const SIGEV_NONE: ::c_int = 1;
+pub const SIGEV_THREAD: ::c_int = 2;
+
+pub const REG_GS: ::c_uint = 0;
+pub const REG_FS: ::c_uint = 1;
+pub const REG_ES: ::c_uint = 2;
+pub const REG_DS: ::c_uint = 3;
+pub const REG_EDI: ::c_uint = 4;
+pub const REG_ESI: ::c_uint = 5;
+pub const REG_EBP: ::c_uint = 6;
+pub const REG_ESP: ::c_uint = 7;
+pub const REG_EBX: ::c_uint = 8;
+pub const REG_EDX: ::c_uint = 9;
+pub const REG_ECX: ::c_uint = 10;
+pub const REG_EAX: ::c_uint = 11;
+pub const REG_TRAPNO: ::c_uint = 12;
+pub const REG_ERR: ::c_uint = 13;
+pub const REG_EIP: ::c_uint = 14;
+pub const REG_CS: ::c_uint = 15;
+pub const REG_EFL: ::c_uint = 16;
+pub const REG_UESP: ::c_uint = 17;
+pub const REG_SS: ::c_uint = 18;
+
+pub const IOC_VOID: __ioctl_dir = 0;
+pub const IOC_OUT: __ioctl_dir = 1;
+pub const IOC_IN: __ioctl_dir = 2;
+pub const IOC_INOUT: __ioctl_dir = 3;
+
+pub const IOC_8: __ioctl_datum = 0;
+pub const IOC_16: __ioctl_datum = 1;
+pub const IOC_32: __ioctl_datum = 2;
+pub const IOC_64: __ioctl_datum = 3;
+
+pub const TCP_ESTABLISHED: ::c_uint = 1;
+pub const TCP_SYN_SENT: ::c_uint = 2;
+pub const TCP_SYN_RECV: ::c_uint = 3;
+pub const TCP_FIN_WAIT1: ::c_uint = 4;
+pub const TCP_FIN_WAIT2: ::c_uint = 5;
+pub const TCP_TIME_WAIT: ::c_uint = 6;
+pub const TCP_CLOSE: ::c_uint = 7;
+pub const TCP_CLOSE_WAIT: ::c_uint = 8;
+pub const TCP_LAST_ACK: ::c_uint = 9;
+pub const TCP_LISTEN: ::c_uint = 10;
+pub const TCP_CLOSING: ::c_uint = 11;
+
+pub const TCP_CA_Open: tcp_ca_state = 0;
+pub const TCP_CA_Disorder: tcp_ca_state = 1;
+pub const TCP_CA_CWR: tcp_ca_state = 2;
+pub const TCP_CA_Recovery: tcp_ca_state = 3;
+pub const TCP_CA_Loss: tcp_ca_state = 4;
+
+pub const TCP_NO_QUEUE: ::c_uint = 0;
+pub const TCP_RECV_QUEUE: ::c_uint = 1;
+pub const TCP_SEND_QUEUE: ::c_uint = 2;
+pub const TCP_QUEUES_NR: ::c_uint = 3;
+
+pub const P_ALL: idtype_t = 0;
+pub const P_PID: idtype_t = 1;
+pub const P_PGID: idtype_t = 2;
+
+pub const SS_ONSTACK: ::c_int = 1;
+pub const SS_DISABLE: ::c_int = 4;
+
+pub const SHUT_RD: ::c_int = 0;
+pub const SHUT_WR: ::c_int = 1;
+pub const SHUT_RDWR: ::c_int = 2;
+pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
+ __lock: 0,
+ __owner_id: 0,
+ __cnt: 0,
+ __shpid: 0,
+ __type: PTHREAD_MUTEX_TIMED as ::c_int,
+ __flags: 0,
+ __reserved1: 0,
+ __reserved2: 0,
+};
+pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
+ __lock: __PTHREAD_SPIN_LOCK_INITIALIZER,
+ __queue: 0i64 as *mut __pthread,
+ __attr: 0i64 as *mut __pthread_condattr,
+ __wrefs: 0,
+ __data: 0i64 as *mut ::c_void,
+};
+pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
+ __held: __PTHREAD_SPIN_LOCK_INITIALIZER,
+ __lock: __PTHREAD_SPIN_LOCK_INITIALIZER,
+ __readers: 0,
+ __readerqueue: 0i64 as *mut __pthread,
+ __writerqueue: 0i64 as *mut __pthread,
+ __attr: 0i64 as *mut __pthread_rwlockattr,
+ __data: 0i64 as *mut ::c_void,
+};
+pub const PTHREAD_STACK_MIN: ::size_t = 0;
+
+// functions
+f! {
+ pub fn major(dev: ::dev_t) -> ::c_uint {
+ ((dev >> 8) & 0xff) as ::c_uint
+ }
+
+ pub fn minor(dev: ::dev_t) -> ::c_uint {
+ (dev & 0xffff00ff) as ::c_uint
+ }
+
+ pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
+ let fd = fd as usize;
+ let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
+ (*set).fds_bits[fd / size] &= !(1 << (fd % size));
+ return
+ }
+
+ pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
+ let fd = fd as usize;
+ let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
+ return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
+ }
+
+ pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
+ let fd = fd as usize;
+ let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
+ (*set).fds_bits[fd / size] |= 1 << (fd % size);
+ return
+ }
+
+ pub fn FD_ZERO(set: *mut fd_set) -> () {
+ for slot in (*set).fds_bits.iter_mut() {
+ *slot = 0;
+ }
+ }
+}
+
+extern "C" {
+ pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
+
+ pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int;
+ pub fn futimens(__fd: ::c_int, __times: *const ::timespec) -> ::c_int;
+
+ pub fn utimensat(
+ dirfd: ::c_int,
+ path: *const ::c_char,
+ times: *const ::timespec,
+ flag: ::c_int,
+ ) -> ::c_int;
+
+ pub fn mkfifoat(__fd: ::c_int, __path: *const ::c_char, __mode: __mode_t) -> ::c_int;
+
+ pub fn mknodat(
+ dirfd: ::c_int,
+ pathname: *const ::c_char,
+ mode: ::mode_t,
+ dev: dev_t,
+ ) -> ::c_int;
+
+ pub fn __libc_current_sigrtmin() -> ::c_int;
+
+ pub fn __libc_current_sigrtmax() -> ::c_int;
+
+ pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int)
+ -> ::c_int;
+
+ pub fn sigwait(__set: *const sigset_t, __sig: *mut ::c_int) -> ::c_int;
+
+ pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
+
+ pub fn ioctl(__fd: ::c_int, __request: ::c_ulong, ...) -> ::c_int;
+
+ pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
+
+ pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
+
+ pub fn pread64(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off64_t) -> ::ssize_t;
+ pub fn pwrite64(
+ fd: ::c_int,
+ buf: *const ::c_void,
+ count: ::size_t,
+ offset: off64_t,
+ ) -> ::ssize_t;
+
+ pub fn readv(__fd: ::c_int, __iovec: *const ::iovec, __count: ::c_int) -> ::ssize_t;
+ pub fn writev(__fd: ::c_int, __iovec: *const ::iovec, __count: ::c_int) -> ::ssize_t;
+
+ pub fn preadv(
+ __fd: ::c_int,
+ __iovec: *const ::iovec,
+ __count: ::c_int,
+ __offset: __off_t,
+ ) -> ssize_t;
+ pub fn pwritev(
+ __fd: ::c_int,
+ __iovec: *const ::iovec,
+ __count: ::c_int,
+ __offset: __off_t,
+ ) -> ssize_t;
+
+ pub fn preadv64(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off64_t,
+ ) -> ::ssize_t;
+ pub fn pwritev64(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off64_t,
+ ) -> ::ssize_t;
+
+ pub fn lseek64(__fd: ::c_int, __offset: __off64_t, __whence: ::c_int) -> __off64_t;
+
+ pub fn lseek(__fd: ::c_int, __offset: __off_t, __whence: ::c_int) -> __off_t;
+
+ pub fn bind(__fd: ::c_int, __addr: *const sockaddr, __len: socklen_t) -> ::c_int;
+
+ pub fn accept4(
+ fd: ::c_int,
+ addr: *mut ::sockaddr,
+ len: *mut ::socklen_t,
+ flg: ::c_int,
+ ) -> ::c_int;
+
+ pub fn recvmsg(__fd: ::c_int, __message: *mut msghdr, __flags: ::c_int) -> ::ssize_t;
+
+ pub fn sendmsg(__fd: ::c_int, __message: *const msghdr, __flags: ::c_int) -> ssize_t;
+
+ 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 shutdown(__fd: ::c_int, __how: ::c_int) -> ::c_int;
+
+ pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
+
+ pub fn uname(buf: *mut ::utsname) -> ::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 setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int;
+
+ pub fn pthread_create(
+ native: *mut ::pthread_t,
+ attr: *const ::pthread_attr_t,
+ f: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
+ value: *mut ::c_void,
+ ) -> ::c_int;
+ pub fn pthread_kill(__threadid: pthread_t, __signo: ::c_int) -> ::c_int;
+ pub fn __pthread_equal(__t1: __pthread_t, __t2: __pthread_t) -> ::c_int;
+
+ pub fn pthread_getattr_np(__thr: 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 pthread_condattr_setclock(
+ __attr: *mut pthread_condattr_t,
+ __clock_id: __clockid_t,
+ ) -> ::c_int;
+
+ pub fn pthread_atfork(
+ prepare: ::Option<unsafe extern "C" fn()>,
+ parent: ::Option<unsafe extern "C" fn()>,
+ child: ::Option<unsafe extern "C" fn()>,
+ ) -> ::c_int;
+
+ pub fn pthread_sigmask(
+ __how: ::c_int,
+ __newmask: *const __sigset_t,
+ __oldmask: *mut __sigset_t,
+ ) -> ::c_int;
+
+ pub fn clock_getres(__clock_id: clockid_t, __res: *mut ::timespec) -> ::c_int;
+ pub fn clock_gettime(__clock_id: clockid_t, __tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_settime(__clock_id: clockid_t, __tp: *const ::timespec) -> ::c_int;
+
+ pub fn fstat(__fd: ::c_int, __buf: *mut stat) -> ::c_int;
+ pub fn fstat64(__fd: ::c_int, __buf: *mut stat64) -> ::c_int;
+
+ pub fn fstatat(
+ __fd: ::c_int,
+ __file: *const ::c_char,
+ __buf: *mut stat,
+ __flag: ::c_int,
+ ) -> ::c_int;
+ pub fn fstatat64(
+ __fd: ::c_int,
+ __file: *const ::c_char,
+ __buf: *mut stat64,
+ __flag: ::c_int,
+ ) -> ::c_int;
+
+ pub fn ftruncate(__fd: ::c_int, __length: __off_t) -> ::c_int;
+ pub fn ftruncate64(__fd: ::c_int, __length: __off64_t) -> ::c_int;
+ pub fn truncate64(__file: *const ::c_char, __length: __off64_t) -> ::c_int;
+
+ pub fn lstat(__file: *const ::c_char, __buf: *mut stat) -> ::c_int;
+ pub fn lstat64(__file: *const ::c_char, __buf: *mut stat64) -> ::c_int;
+
+ pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
+ pub fn statfs64(__file: *const ::c_char, __buf: *mut statfs64) -> ::c_int;
+ pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
+ pub fn fstatfs64(__fildes: ::c_int, __buf: *mut statfs64) -> ::c_int;
+
+ pub fn statvfs(__file: *const ::c_char, __buf: *mut statvfs) -> ::c_int;
+ pub fn statvfs64(__file: *const ::c_char, __buf: *mut statvfs64) -> ::c_int;
+ pub fn fstatvfs(__fildes: ::c_int, __buf: *mut statvfs) -> ::c_int;
+ pub fn fstatvfs64(__fildes: ::c_int, __buf: *mut statvfs64) -> ::c_int;
+
+ pub fn open(__file: *const ::c_char, __oflag: ::c_int, ...) -> ::c_int;
+ pub fn open64(__file: *const ::c_char, __oflag: ::c_int, ...) -> ::c_int;
+
+ pub fn openat(__fd: ::c_int, __file: *const ::c_char, __oflag: ::c_int, ...) -> ::c_int;
+ pub fn openat64(__fd: ::c_int, __file: *const ::c_char, __oflag: ::c_int, ...) -> ::c_int;
+
+ pub fn faccessat(
+ dirfd: ::c_int,
+ pathname: *const ::c_char,
+ mode: ::c_int,
+ flags: ::c_int,
+ ) -> ::c_int;
+
+ pub fn stat(__file: *const ::c_char, __buf: *mut stat) -> ::c_int;
+ pub fn stat64(__file: *const ::c_char, __buf: *mut stat64) -> ::c_int;
+
+ pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent;
+ pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64;
+ pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, result: *mut *mut ::dirent)
+ -> ::c_int;
+
+ pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
+
+ #[link_name = "__xpg_strerror_r"]
+ pub fn strerror_r(__errnum: ::c_int, __buf: *mut ::c_char, __buflen: ::size_t) -> ::c_int;
+
+ pub fn __errno_location() -> *mut ::c_int;
+
+ pub fn mmap64(
+ __addr: *mut ::c_void,
+ __len: size_t,
+ __prot: ::c_int,
+ __flags: ::c_int,
+ __fd: ::c_int,
+ __offset: __off64_t,
+ ) -> *mut ::c_void;
+
+ pub fn mprotect(__addr: *mut ::c_void, __len: ::size_t, __prot: ::c_int) -> ::c_int;
+
+ pub fn msync(__addr: *mut ::c_void, __len: ::size_t, __flags: ::c_int) -> ::c_int;
+ pub fn sync();
+ pub fn syncfs(fd: ::c_int) -> ::c_int;
+ pub fn fdatasync(fd: ::c_int) -> ::c_int;
+
+ pub fn fallocate64(fd: ::c_int, mode: ::c_int, offset: ::off64_t, len: ::off64_t) -> ::c_int;
+ pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int;
+ pub fn posix_fallocate64(fd: ::c_int, offset: ::off64_t, len: ::off64_t) -> ::c_int;
+
+ pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advise: ::c_int) -> ::c_int;
+
+ pub fn posix_fadvise64(
+ fd: ::c_int,
+ offset: ::off64_t,
+ len: ::off64_t,
+ advise: ::c_int,
+ ) -> ::c_int;
+
+ pub fn madvise(__addr: *mut ::c_void, __len: ::size_t, __advice: ::c_int) -> ::c_int;
+
+ pub fn getrlimit(resource: ::__rlimit_resource, rlim: *mut ::rlimit) -> ::c_int;
+ pub fn getrlimit64(resource: ::__rlimit_resource, rlim: *mut ::rlimit64) -> ::c_int;
+ pub fn setrlimit(resource: ::__rlimit_resource, rlim: *const ::rlimit) -> ::c_int;
+ pub fn setrlimit64(resource: ::__rlimit_resource, rlim: *const ::rlimit64) -> ::c_int;
+
+ pub fn getpriority(which: ::__priority_which, who: ::id_t) -> ::c_int;
+ pub fn setpriority(which: ::__priority_which, who: ::id_t, prio: ::c_int) -> ::c_int;
+
+ pub fn getrandom(__buffer: *mut ::c_void, __length: ::size_t, __flags: ::c_uint) -> ::ssize_t;
+ pub fn getentropy(__buffer: *mut ::c_void, __length: ::size_t) -> ::c_int;
+
+ pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int;
+ pub fn dl_iterate_phdr(
+ callback: ::Option<
+ unsafe extern "C" fn(
+ info: *mut ::dl_phdr_info,
+ size: ::size_t,
+ data: *mut ::c_void,
+ ) -> ::c_int,
+ >,
+ data: *mut ::c_void,
+ ) -> ::c_int;
+}
+
+safe_f! {
+ pub {const} 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 << 8;
+ dev |= minor;
+ dev
+ }
+
+ pub fn SIGRTMAX() -> ::c_int {
+ unsafe { __libc_current_sigrtmax() }
+ }
+
+ pub fn SIGRTMIN() -> ::c_int {
+ unsafe { __libc_current_sigrtmin() }
+ }
+
+ pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
+ (status & 0xff) == 0x7f
+ }
+
+ pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
+ (status >> 8) & 0xff
+ }
+
+ pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
+ status == 0xffff
+ }
+
+ pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
+ ((status & 0x7f) + 1) as i8 >= 2
+ }
+
+ pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
+ status & 0x7f
+ }
+
+ pub {const} fn WIFEXITED(status: ::c_int) -> bool {
+ (status & 0x7f) == 0
+ }
+
+ pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int {
+ (status >> 8) & 0xff
+ }
+
+ pub {const} fn WCOREDUMP(status: ::c_int) -> bool {
+ (status & 0x80) != 0
+ }
+
+ pub {const} fn W_EXITCODE(ret: ::c_int, sig: ::c_int) -> ::c_int {
+ (ret << 8) | sig
+ }
+
+ pub {const} fn W_STOPCODE(sig: ::c_int) -> ::c_int {
+ (sig << 8) | 0x7f
+ }
+
+ pub {const} fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
+ (cmd << 8) | (type_ & 0x00ff)
+ }
+
+ pub {const} fn IPOPT_COPIED(o: u8) -> u8 {
+ o & IPOPT_COPY
+ }
+
+ pub {const} fn IPOPT_CLASS(o: u8) -> u8 {
+ o & IPOPT_CLASS_MASK
+ }
+
+ pub {const} fn IPOPT_NUMBER(o: u8) -> u8 {
+ o & IPOPT_NUMBER_MASK
+ }
+
+ pub {const} fn IPTOS_ECN(x: u8) -> u8 {
+ x & ::IPTOS_ECN_MASK
+ }
+}
+
+cfg_if! {
+ if #[cfg(libc_align)] {
+ mod align;
+ pub use self::align::*;
+ } else {
+ mod no_align;
+ pub use self::no_align::*;
+ }
+}
+
+cfg_if! {
+ if #[cfg(target_pointer_width = "64")] {
+ mod b64;
+ pub use self::b64::*;
+ } else {
+ mod b32;
+ pub use self::b32::*;
+ }
+}
diff --git a/src/unix/hurd/no_align.rs b/src/unix/hurd/no_align.rs
new file mode 100644
index 00000000..1dd7d8e5
--- /dev/null
+++ b/src/unix/hurd/no_align.rs
@@ -0,0 +1 @@
+// Placeholder file
diff --git a/src/unix/linux_like/android/b64/aarch64/mod.rs b/src/unix/linux_like/android/b64/aarch64/mod.rs
index e7247fbb..ac67fdda 100644
--- a/src/unix/linux_like/android/b64/aarch64/mod.rs
+++ b/src/unix/linux_like/android/b64/aarch64/mod.rs
@@ -412,6 +412,9 @@ pub const SYS_fsmount: ::c_long = 432;
pub const SYS_fspick: ::c_long = 433;
pub const SYS_syscalls: ::c_long = 436;
+pub const PROT_BTI: ::c_int = 0x10;
+pub const PROT_MTE: ::c_int = 0x20;
+
cfg_if! {
if #[cfg(libc_align)] {
mod align;
diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs
index f3622fdb..98a9d9b2 100644
--- a/src/unix/linux_like/android/mod.rs
+++ b/src/unix/linux_like/android/mod.rs
@@ -350,6 +350,11 @@ s! {
pub args: [::__u64; 6],
}
+ pub struct seccomp_metadata {
+ pub filter_off: ::__u64,
+ pub flags: ::__u64,
+ }
+
pub struct ptrace_peeksiginfo_args {
pub off: ::__u64,
pub flags: ::__u32,
@@ -1219,6 +1224,9 @@ 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_EXPLICIT_SCHED: ::c_int = 0;
+pub const PTHREAD_INHERIT_SCHED: ::c_int = 1;
+
// stdio.h
pub const RENAME_NOREPLACE: ::c_int = 1;
pub const RENAME_EXCHANGE: ::c_int = 2;
@@ -1441,12 +1449,26 @@ pub const SO_PEERSEC: ::c_int = 31;
pub const SO_SNDBUFFORCE: ::c_int = 32;
pub const SO_RCVBUFFORCE: ::c_int = 33;
pub const SO_PASSSEC: ::c_int = 34;
+pub const SO_TIMESTAMPNS: ::c_int = 35;
+// pub const SO_TIMESTAMPNS_OLD: ::c_int = 35;
pub const SO_MARK: ::c_int = 36;
+pub const SO_TIMESTAMPING: ::c_int = 37;
+// pub const SO_TIMESTAMPING_OLD: ::c_int = 37;
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 SCM_TIMESTAMPING_OPT_STATS: ::c_int = 54;
+pub const SCM_TIMESTAMPING_PKTINFO: ::c_int = 58;
+pub const SO_TIMESTAMP_NEW: ::c_int = 63;
+pub const SO_TIMESTAMPNS_NEW: ::c_int = 64;
+pub const SO_TIMESTAMPING_NEW: ::c_int = 65;
+
+// Defined in unix/linux_like/mod.rs
+// pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
+pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
+pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;
pub const IPTOS_ECN_NOTECT: u8 = 0x00;
@@ -1508,6 +1530,7 @@ 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_SECCOMP_GET_METADATA: ::c_int = 0x420d;
pub const PTRACE_EVENT_STOP: ::c_int = 128;
@@ -1539,6 +1562,7 @@ pub const RLIMIT_MSGQUEUE: ::c_int = 12;
pub const RLIMIT_NICE: ::c_int = 13;
pub const RLIMIT_RTPRIO: ::c_int = 14;
+#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::c_int = 16;
pub const RLIM_INFINITY: ::rlim_t = !0;
@@ -1683,6 +1707,7 @@ pub const REG_BACKR: ::c_int = 1024;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const CBAUD: ::tcflag_t = 0o0010017;
pub const TAB1: ::tcflag_t = 0x00000800;
@@ -1817,6 +1842,7 @@ pub const NLM_F_MULTI: ::c_int = 2;
pub const NLM_F_ACK: ::c_int = 4;
pub const NLM_F_ECHO: ::c_int = 8;
pub const NLM_F_DUMP_INTR: ::c_int = 16;
+pub const NLM_F_DUMP_FILTERED: ::c_int = 32;
pub const NLM_F_ROOT: ::c_int = 0x100;
pub const NLM_F_MATCH: ::c_int = 0x200;
@@ -2566,6 +2592,88 @@ pub const ETH_P_XDSA: ::c_int = 0x00F8;
/* see rust-lang/libc#924 pub const ETH_P_MAP: ::c_int = 0x00F9;*/
// end android/platform/bionic/libc/kernel/uapi/linux/if_ether.h
+// start android/platform/bionic/libc/kernel/uapi/linux/neighbour.h
+pub const NDA_UNSPEC: ::c_ushort = 0;
+pub const NDA_DST: ::c_ushort = 1;
+pub const NDA_LLADDR: ::c_ushort = 2;
+pub const NDA_CACHEINFO: ::c_ushort = 3;
+pub const NDA_PROBES: ::c_ushort = 4;
+pub const NDA_VLAN: ::c_ushort = 5;
+pub const NDA_PORT: ::c_ushort = 6;
+pub const NDA_VNI: ::c_ushort = 7;
+pub const NDA_IFINDEX: ::c_ushort = 8;
+pub const NDA_MASTER: ::c_ushort = 9;
+pub const NDA_LINK_NETNSID: ::c_ushort = 10;
+pub const NDA_SRC_VNI: ::c_ushort = 11;
+pub const NDA_PROTOCOL: ::c_ushort = 12;
+pub const NDA_NH_ID: ::c_ushort = 13;
+pub const NDA_FDB_EXT_ATTRS: ::c_ushort = 14;
+pub const NDA_FLAGS_EXT: ::c_ushort = 15;
+pub const NDA_NDM_STATE_MASK: ::c_ushort = 16;
+pub const NDA_NDM_FLAGS_MASK: ::c_ushort = 17;
+
+pub const NTF_USE: u8 = 0x01;
+pub const NTF_SELF: u8 = 0x02;
+pub const NTF_MASTER: u8 = 0x04;
+pub const NTF_PROXY: u8 = 0x08;
+pub const NTF_EXT_LEARNED: u8 = 0x10;
+pub const NTF_OFFLOADED: u8 = 0x20;
+pub const NTF_STICKY: u8 = 0x40;
+pub const NTF_ROUTER: u8 = 0x80;
+
+pub const NTF_EXT_MANAGED: u8 = 0x01;
+pub const NTF_EXT_LOCKED: u8 = 0x02;
+
+pub const NUD_NONE: u16 = 0x00;
+pub const NUD_INCOMPLETE: u16 = 0x01;
+pub const NUD_REACHABLE: u16 = 0x02;
+pub const NUD_STALE: u16 = 0x04;
+pub const NUD_DELAY: u16 = 0x08;
+pub const NUD_PROBE: u16 = 0x10;
+pub const NUD_FAILED: u16 = 0x20;
+pub const NUD_NOARP: u16 = 0x40;
+pub const NUD_PERMANENT: u16 = 0x80;
+
+pub const NDTPA_UNSPEC: ::c_ushort = 0;
+pub const NDTPA_IFINDEX: ::c_ushort = 1;
+pub const NDTPA_REFCNT: ::c_ushort = 2;
+pub const NDTPA_REACHABLE_TIME: ::c_ushort = 3;
+pub const NDTPA_BASE_REACHABLE_TIME: ::c_ushort = 4;
+pub const NDTPA_RETRANS_TIME: ::c_ushort = 5;
+pub const NDTPA_GC_STALETIME: ::c_ushort = 6;
+pub const NDTPA_DELAY_PROBE_TIME: ::c_ushort = 7;
+pub const NDTPA_QUEUE_LEN: ::c_ushort = 8;
+pub const NDTPA_APP_PROBES: ::c_ushort = 9;
+pub const NDTPA_UCAST_PROBES: ::c_ushort = 10;
+pub const NDTPA_MCAST_PROBES: ::c_ushort = 11;
+pub const NDTPA_ANYCAST_DELAY: ::c_ushort = 12;
+pub const NDTPA_PROXY_DELAY: ::c_ushort = 13;
+pub const NDTPA_PROXY_QLEN: ::c_ushort = 14;
+pub const NDTPA_LOCKTIME: ::c_ushort = 15;
+pub const NDTPA_QUEUE_LENBYTES: ::c_ushort = 16;
+pub const NDTPA_MCAST_REPROBES: ::c_ushort = 17;
+pub const NDTPA_PAD: ::c_ushort = 18;
+pub const NDTPA_INTERVAL_PROBE_TIME_MS: ::c_ushort = 19;
+
+pub const NDTA_UNSPEC: ::c_ushort = 0;
+pub const NDTA_NAME: ::c_ushort = 1;
+pub const NDTA_THRESH1: ::c_ushort = 2;
+pub const NDTA_THRESH2: ::c_ushort = 3;
+pub const NDTA_THRESH3: ::c_ushort = 4;
+pub const NDTA_CONFIG: ::c_ushort = 5;
+pub const NDTA_PARMS: ::c_ushort = 6;
+pub const NDTA_STATS: ::c_ushort = 7;
+pub const NDTA_GC_INTERVAL: ::c_ushort = 8;
+pub const NDTA_PAD: ::c_ushort = 9;
+
+pub const FDB_NOTIFY_BIT: u16 = 0x01;
+pub const FDB_NOTIFY_INACTIVE_BIT: u16 = 0x02;
+
+pub const NFEA_UNSPEC: ::c_ushort = 0;
+pub const NFEA_ACTIVITY_NOTIFY: ::c_ushort = 1;
+pub const NFEA_DONT_REFRESH: ::c_ushort = 2;
+// end android/platform/bionic/libc/kernel/uapi/linux/neighbour.h
+
pub const SIOCADDRT: ::c_ulong = 0x0000890B;
pub const SIOCDELRT: ::c_ulong = 0x0000890C;
pub const SIOCGIFNAME: ::c_ulong = 0x00008910;
@@ -2608,6 +2716,23 @@ pub const SIOCSIFMAP: ::c_ulong = 0x00008971;
pub const MODULE_INIT_IGNORE_MODVERSIONS: ::c_uint = 0x0001;
pub const MODULE_INIT_IGNORE_VERMAGIC: ::c_uint = 0x0002;
+// linux/net_tstamp.h
+pub const SOF_TIMESTAMPING_TX_HARDWARE: ::c_uint = 1 << 0;
+pub const SOF_TIMESTAMPING_TX_SOFTWARE: ::c_uint = 1 << 1;
+pub const SOF_TIMESTAMPING_RX_HARDWARE: ::c_uint = 1 << 2;
+pub const SOF_TIMESTAMPING_RX_SOFTWARE: ::c_uint = 1 << 3;
+pub const SOF_TIMESTAMPING_SOFTWARE: ::c_uint = 1 << 4;
+pub const SOF_TIMESTAMPING_SYS_HARDWARE: ::c_uint = 1 << 5;
+pub const SOF_TIMESTAMPING_RAW_HARDWARE: ::c_uint = 1 << 6;
+pub const SOF_TIMESTAMPING_OPT_ID: ::c_uint = 1 << 7;
+pub const SOF_TIMESTAMPING_TX_SCHED: ::c_uint = 1 << 8;
+pub const SOF_TIMESTAMPING_TX_ACK: ::c_uint = 1 << 9;
+pub const SOF_TIMESTAMPING_OPT_CMSG: ::c_uint = 1 << 10;
+pub const SOF_TIMESTAMPING_OPT_TSONLY: ::c_uint = 1 << 11;
+pub const SOF_TIMESTAMPING_OPT_STATS: ::c_uint = 1 << 12;
+pub const SOF_TIMESTAMPING_OPT_PKTINFO: ::c_uint = 1 << 13;
+pub const SOF_TIMESTAMPING_OPT_TX_SWHW: ::c_uint = 1 << 14;
+
#[deprecated(
since = "0.2.55",
note = "ENOATTR is not available on Android; use ENODATA instead"
@@ -2620,6 +2745,7 @@ pub const ALG_SET_IV: ::c_int = 2;
pub const ALG_SET_OP: ::c_int = 3;
pub const ALG_SET_AEAD_ASSOCLEN: ::c_int = 4;
pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5;
+pub const ALG_SET_DRBG_ENTROPY: ::c_int = 6;
pub const ALG_OP_DECRYPT: ::c_int = 0;
pub const ALG_OP_ENCRYPT: ::c_int = 1;
@@ -2886,6 +3012,19 @@ pub const IFLA_CARRIER_DOWN_COUNT: ::c_ushort = 48;
pub const IFLA_NEW_IFINDEX: ::c_ushort = 49;
pub const IFLA_MIN_MTU: ::c_ushort = 50;
pub const IFLA_MAX_MTU: ::c_ushort = 51;
+pub const IFLA_PROP_LIST: ::c_ushort = 52;
+pub const IFLA_ALT_IFNAME: ::c_ushort = 53;
+pub const IFLA_PERM_ADDRESS: ::c_ushort = 54;
+pub const IFLA_PROTO_DOWN_REASON: ::c_ushort = 55;
+pub const IFLA_PARENT_DEV_NAME: ::c_ushort = 56;
+pub const IFLA_PARENT_DEV_BUS_NAME: ::c_ushort = 57;
+pub const IFLA_GRO_MAX_SIZE: ::c_ushort = 58;
+pub const IFLA_TSO_MAX_SIZE: ::c_ushort = 59;
+pub const IFLA_TSO_MAX_SEGS: ::c_ushort = 60;
+pub const IFLA_ALLMULTI: ::c_ushort = 61;
+pub const IFLA_DEVLINK_PORT: ::c_ushort = 62;
+pub const IFLA_GSO_IPV4_MAX_SIZE: ::c_ushort = 63;
+pub const IFLA_GRO_IPV4_MAX_SIZE: ::c_ushort = 64;
pub const IFLA_INFO_UNSPEC: ::c_ushort = 0;
pub const IFLA_INFO_KIND: ::c_ushort = 1;
@@ -3361,6 +3500,12 @@ extern "C" {
attr: *const ::pthread_attr_t,
guardsize: *mut ::size_t,
) -> ::c_int;
+ pub fn pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::size_t) -> ::c_int;
+ pub fn pthread_attr_getinheritsched(
+ attr: *const ::pthread_attr_t,
+ flag: *mut ::c_int,
+ ) -> ::c_int;
+ pub fn pthread_attr_setinheritsched(attr: *mut ::pthread_attr_t, flag: ::c_int) -> ::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(
@@ -3383,7 +3528,13 @@ extern "C" {
pub fn sendfile(
out_fd: ::c_int,
in_fd: ::c_int,
- offset: *mut off_t,
+ offset: *mut ::off_t,
+ count: ::size_t,
+ ) -> ::ssize_t;
+ pub fn sendfile64(
+ out_fd: ::c_int,
+ in_fd: ::c_int,
+ offset: *mut ::off64_t,
count: ::size_t,
) -> ::ssize_t;
pub fn setfsgid(gid: ::gid_t) -> ::c_int;
@@ -3503,7 +3654,9 @@ extern "C" {
pub fn gettid() -> ::pid_t;
+ /// Only available in API Version 28+
pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
+ pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;
@@ -3556,6 +3709,20 @@ extern "C" {
needle: *const ::c_void,
needlelen: ::size_t,
) -> *mut ::c_void;
+ pub fn fread_unlocked(
+ buf: *mut ::c_void,
+ size: ::size_t,
+ nobj: ::size_t,
+ stream: *mut ::FILE,
+ ) -> ::size_t;
+ pub fn fwrite_unlocked(
+ buf: *const ::c_void,
+ size: ::size_t,
+ nobj: ::size_t,
+ stream: *mut ::FILE,
+ ) -> ::size_t;
+ pub fn fflush_unlocked(stream: *mut ::FILE) -> ::c_int;
+ pub fn fgets_unlocked(buf: *mut ::c_char, size: ::c_int, stream: *mut ::FILE) -> *mut ::c_char;
}
cfg_if! {
diff --git a/src/unix/linux_like/emscripten/lfs64.rs b/src/unix/linux_like/emscripten/lfs64.rs
new file mode 100644
index 00000000..1616cc90
--- /dev/null
+++ b/src/unix/linux_like/emscripten/lfs64.rs
@@ -0,0 +1,213 @@
+// In-sync with ../linux/musl/lfs64.rs except for fallocate64, prlimit64 and sendfile64
+
+#[inline]
+pub unsafe extern "C" fn creat64(path: *const ::c_char, mode: ::mode_t) -> ::c_int {
+ ::creat(path, mode)
+}
+
+#[inline]
+pub unsafe extern "C" fn fgetpos64(stream: *mut ::FILE, pos: *mut ::fpos64_t) -> ::c_int {
+ ::fgetpos(stream, pos as *mut _)
+}
+
+#[inline]
+pub unsafe extern "C" fn fopen64(pathname: *const ::c_char, mode: *const ::c_char) -> *mut ::FILE {
+ ::fopen(pathname, mode)
+}
+
+#[inline]
+pub unsafe extern "C" fn freopen64(
+ pathname: *const ::c_char,
+ mode: *const ::c_char,
+ stream: *mut ::FILE,
+) -> *mut ::FILE {
+ ::freopen(pathname, mode, stream)
+}
+
+#[inline]
+pub unsafe extern "C" fn fseeko64(
+ stream: *mut ::FILE,
+ offset: ::off64_t,
+ whence: ::c_int,
+) -> ::c_int {
+ ::fseeko(stream, offset, whence)
+}
+
+#[inline]
+pub unsafe extern "C" fn fsetpos64(stream: *mut ::FILE, pos: *const ::fpos64_t) -> ::c_int {
+ ::fsetpos(stream, pos as *mut _)
+}
+
+#[inline]
+pub unsafe extern "C" fn fstat64(fildes: ::c_int, buf: *mut ::stat64) -> ::c_int {
+ ::fstat(fildes, buf as *mut _)
+}
+
+#[inline]
+pub unsafe extern "C" fn fstatat64(
+ fd: ::c_int,
+ path: *const ::c_char,
+ buf: *mut ::stat64,
+ flag: ::c_int,
+) -> ::c_int {
+ ::fstatat(fd, path, buf as *mut _, flag)
+}
+
+#[inline]
+pub unsafe extern "C" fn fstatfs64(fd: ::c_int, buf: *mut ::statfs64) -> ::c_int {
+ ::fstatfs(fd, buf as *mut _)
+}
+
+#[inline]
+pub unsafe extern "C" fn fstatvfs64(fd: ::c_int, buf: *mut ::statvfs64) -> ::c_int {
+ ::fstatvfs(fd, buf as *mut _)
+}
+
+#[inline]
+pub unsafe extern "C" fn ftello64(stream: *mut ::FILE) -> ::off64_t {
+ ::ftello(stream)
+}
+
+#[inline]
+pub unsafe extern "C" fn ftruncate64(fd: ::c_int, length: ::off64_t) -> ::c_int {
+ ::ftruncate(fd, length)
+}
+
+#[inline]
+pub unsafe extern "C" fn getrlimit64(resource: ::c_int, rlim: *mut ::rlimit64) -> ::c_int {
+ ::getrlimit(resource, rlim as *mut _)
+}
+
+#[inline]
+pub unsafe extern "C" fn lseek64(fd: ::c_int, offset: ::off64_t, whence: ::c_int) -> ::off64_t {
+ ::lseek(fd, offset, whence)
+}
+
+#[inline]
+pub unsafe extern "C" fn lstat64(path: *const ::c_char, buf: *mut ::stat64) -> ::c_int {
+ ::lstat(path, buf as *mut _)
+}
+
+#[inline]
+pub unsafe extern "C" fn mmap64(
+ addr: *mut ::c_void,
+ length: ::size_t,
+ prot: ::c_int,
+ flags: ::c_int,
+ fd: ::c_int,
+ offset: ::off64_t,
+) -> *mut ::c_void {
+ ::mmap(addr, length, prot, flags, fd, offset)
+}
+
+// These functions are variadic in the C ABI since the `mode` argument is "optional". Variadic
+// `extern "C"` functions are unstable in Rust so we cannot write a shim function for these
+// entrypoints. See https://github.com/rust-lang/rust/issues/44930.
+//
+// These aliases are mostly fine though, neither function takes a LFS64-namespaced type as an
+// argument, nor do their names clash with any declared types.
+pub use open as open64;
+pub use openat as openat64;
+
+#[inline]
+pub unsafe extern "C" fn posix_fadvise64(
+ fd: ::c_int,
+ offset: ::off64_t,
+ len: ::off64_t,
+ advice: ::c_int,
+) -> ::c_int {
+ ::posix_fadvise(fd, offset, len, advice)
+}
+
+#[inline]
+pub unsafe extern "C" fn posix_fallocate64(
+ fd: ::c_int,
+ offset: ::off64_t,
+ len: ::off64_t,
+) -> ::c_int {
+ ::posix_fallocate(fd, offset, len)
+}
+
+#[inline]
+pub unsafe extern "C" fn pread64(
+ fd: ::c_int,
+ buf: *mut ::c_void,
+ count: ::size_t,
+ offset: ::off64_t,
+) -> ::ssize_t {
+ ::pread(fd, buf, count, offset)
+}
+
+#[inline]
+pub unsafe extern "C" fn preadv64(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off64_t,
+) -> ::ssize_t {
+ ::preadv(fd, iov, iovcnt, offset)
+}
+
+#[inline]
+pub unsafe extern "C" fn pwrite64(
+ fd: ::c_int,
+ buf: *const ::c_void,
+ count: ::size_t,
+ offset: ::off64_t,
+) -> ::ssize_t {
+ ::pwrite(fd, buf, count, offset)
+}
+
+#[inline]
+pub unsafe extern "C" fn pwritev64(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off64_t,
+) -> ::ssize_t {
+ ::pwritev(fd, iov, iovcnt, offset)
+}
+
+#[inline]
+pub unsafe extern "C" fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64 {
+ ::readdir(dirp) as *mut _
+}
+
+#[inline]
+pub unsafe extern "C" fn readdir64_r(
+ dirp: *mut ::DIR,
+ entry: *mut ::dirent64,
+ result: *mut *mut ::dirent64,
+) -> ::c_int {
+ ::readdir_r(dirp, entry as *mut _, result as *mut _)
+}
+
+#[inline]
+pub unsafe extern "C" fn setrlimit64(resource: ::c_int, rlim: *const ::rlimit64) -> ::c_int {
+ ::setrlimit(resource, rlim as *mut _)
+}
+
+#[inline]
+pub unsafe extern "C" fn stat64(pathname: *const ::c_char, statbuf: *mut ::stat64) -> ::c_int {
+ ::stat(pathname, statbuf as *mut _)
+}
+
+#[inline]
+pub unsafe extern "C" fn statfs64(pathname: *const ::c_char, buf: *mut ::statfs64) -> ::c_int {
+ ::statfs(pathname, buf as *mut _)
+}
+
+#[inline]
+pub unsafe extern "C" fn statvfs64(path: *const ::c_char, buf: *mut ::statvfs64) -> ::c_int {
+ ::statvfs(path, buf as *mut _)
+}
+
+#[inline]
+pub unsafe extern "C" fn tmpfile64() -> *mut ::FILE {
+ ::tmpfile()
+}
+
+#[inline]
+pub unsafe extern "C" fn truncate64(path: *const ::c_char, length: ::off64_t) -> ::c_int {
+ ::truncate(path, length)
+}
diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs
index 5b947b63..1c9e4e6f 100644
--- a/src/unix/linux_like/emscripten/mod.rs
+++ b/src/unix/linux_like/emscripten/mod.rs
@@ -5,10 +5,6 @@ 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 = u64;
-pub type off64_t = i64;
-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;
@@ -29,11 +25,23 @@ 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 rlim_t = u64;
pub type c_long = i32;
pub type c_ulong = u32;
pub type nlink_t = u32;
+pub type ino64_t = ::ino_t;
+pub type off64_t = ::off_t;
+pub type blkcnt64_t = ::blkcnt_t;
+pub type rlim64_t = ::rlim_t;
+
+pub type rlimit64 = ::rlimit;
+pub type flock64 = ::flock;
+pub type stat64 = ::stat;
+pub type statfs64 = ::statfs;
+pub type statvfs64 = ::statvfs;
+pub type dirent64 = ::dirent;
+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum fpos64_t {} // FIXME: fill this out with a struct
impl ::Copy for fpos64_t {}
@@ -44,11 +52,6 @@ impl ::Clone for fpos64_t {
}
s! {
- 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,
@@ -223,14 +226,6 @@ s! {
pub l_pid: ::pid_t,
}
- pub struct flock64 {
- pub l_type: ::c_short,
- pub l_whence: ::c_short,
- pub l_start: ::off64_t,
- pub l_len: ::off64_t,
- pub l_pid: ::pid_t,
- }
-
pub struct pthread_attr_t {
__size: [u32; 11]
}
@@ -260,35 +255,16 @@ s! {
}
pub struct stat {
pub st_dev: ::dev_t,
+ #[cfg(not(emscripten_new_stat_abi))]
__st_dev_padding: ::c_int,
+ #[cfg(not(emscripten_new_stat_abi))]
__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,
+ #[cfg(not(emscripten_new_stat_abi))]
__st_rdev_padding: ::c_int,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
@@ -364,37 +340,6 @@ s! {
_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 struct arpd_request {
pub req: ::c_ushort,
pub ip: u32,
@@ -414,14 +359,6 @@ s_no_extra_traits! {
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 sysinfo {
pub uptime: ::c_ulong,
pub loads: [::c_ulong; 3],
@@ -485,41 +422,6 @@ cfg_if! {
}
}
- impl PartialEq for dirent64 {
- fn eq(&self, other: &dirent64) -> bool {
- self.d_ino == other.d_ino
- && self.d_off == other.d_off
- && self.d_reclen == other.d_reclen
- && self.d_type == other.d_type
- && self
- .d_name
- .iter()
- .zip(other.d_name.iter())
- .all(|(a,b)| a == b)
- }
- }
- impl Eq for dirent64 {}
- impl ::fmt::Debug for dirent64 {
- fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
- f.debug_struct("dirent64")
- .field("d_ino", &self.d_ino)
- .field("d_off", &self.d_off)
- .field("d_reclen", &self.d_reclen)
- .field("d_type", &self.d_type)
- // FIXME: .field("d_name", &self.d_name)
- .finish()
- }
- }
- impl ::hash::Hash for dirent64 {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- self.d_ino.hash(state);
- self.d_off.hash(state);
- self.d_reclen.hash(state);
- self.d_type.hash(state);
- self.d_name.hash(state);
- }
- }
-
impl PartialEq for sysinfo {
fn eq(&self, other: &sysinfo) -> bool {
self.uptime == other.uptime
@@ -1328,7 +1230,10 @@ pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const POSIX_MADV_DONTNEED: ::c_int = 0;
pub const RLIM_INFINITY: ::rlim_t = !0;
+#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIMIT_NLIMITS: ::c_int = 15;
+#[allow(deprecated)]
+#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::c_int = RLIMIT_NLIMITS;
pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
@@ -1757,8 +1662,6 @@ safe_f! {
}
extern "C" {
- pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int;
- pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int;
pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int;
pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
@@ -1779,17 +1682,6 @@ extern "C" {
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;
@@ -1886,6 +1778,10 @@ extern "C" {
pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
}
+// Alias <foo> to <foo>64 to mimic glibc's LFS64 support
+mod lfs64;
+pub use self::lfs64::*;
+
cfg_if! {
if #[cfg(libc_align)] {
#[macro_use]
diff --git a/src/unix/linux_like/linux/align.rs b/src/unix/linux_like/linux/align.rs
index 97f811da..1036e23d 100644
--- a/src/unix/linux_like/linux/align.rs
+++ b/src/unix/linux_like/linux/align.rs
@@ -5,6 +5,7 @@ macro_rules! expand_align {
target_arch = "x86_64",
target_arch = "powerpc64",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "s390x",
target_arch = "sparc64",
target_arch = "aarch64",
@@ -16,6 +17,7 @@ macro_rules! expand_align {
target_arch = "x86_64",
target_arch = "powerpc64",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "s390x",
target_arch = "sparc64",
target_arch = "aarch64",
@@ -83,9 +85,11 @@ macro_rules! expand_align {
#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "m68k",
+ target_arch = "csky",
target_arch = "powerpc",
target_arch = "sparc",
target_arch = "x86_64",
@@ -93,9 +97,11 @@ macro_rules! expand_align {
repr(align(4)))]
#[cfg_attr(any(target_pointer_width = "64",
not(any(target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "m68k",
+ target_arch = "csky",
target_arch = "powerpc",
target_arch = "sparc",
target_arch = "x86_64",
@@ -108,9 +114,11 @@ macro_rules! expand_align {
#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "m68k",
+ target_arch = "csky",
target_arch = "powerpc",
target_arch = "sparc",
target_arch = "x86_64",
@@ -118,6 +126,7 @@ macro_rules! expand_align {
repr(align(4)))]
#[cfg_attr(any(target_pointer_width = "64",
not(any(target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "m68k",
@@ -132,9 +141,11 @@ macro_rules! expand_align {
#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "m68k",
+ target_arch = "csky",
target_arch = "powerpc",
target_arch = "sparc",
target_arch = "x86_64",
@@ -142,9 +153,11 @@ macro_rules! expand_align {
repr(align(4)))]
#[cfg_attr(any(target_pointer_width = "64",
not(any(target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "m68k",
+ target_arch = "csky",
target_arch = "powerpc",
target_arch = "sparc",
target_arch = "x86_64",
diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs
index 7bc94c6f..10e1fcca 100644
--- a/src/unix/linux_like/linux/arch/generic/mod.rs
+++ b/src/unix/linux_like/linux/arch/generic/mod.rs
@@ -95,6 +95,7 @@ cfg_if! {
if #[cfg(all(any(target_arch = "x86",
target_arch = "x86_64",
target_arch = "aarch64",
+ target_arch = "csky",
target_arch = "loongarch64"),
not(any(target_env = "musl", target_env = "ohos"))))] {
pub const SO_TIMESTAMP_NEW: ::c_int = 63;
@@ -115,6 +116,7 @@ cfg_if! {
target_arch = "aarch64",
target_arch = "riscv64",
target_arch = "s390x",
+ target_arch = "csky",
target_arch = "loongarch64"))] {
pub const FICLONE: ::c_ulong = 0x40049409;
pub const FICLONERANGE: ::c_ulong = 0x4020940D;
@@ -255,6 +257,8 @@ cfg_if! {
pub const RLIMIT_NICE: ::__rlimit_resource_t = 13;
pub const RLIMIT_RTPRIO: ::__rlimit_resource_t = 14;
pub const RLIMIT_RTTIME: ::__rlimit_resource_t = 15;
+ #[allow(deprecated)]
+ #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = RLIM_NLIMITS;
} else if #[cfg(any(target_env = "musl", target_env = "ohos"))] {
@@ -275,16 +279,21 @@ cfg_if! {
pub const RLIMIT_NICE: ::c_int = 13;
pub const RLIMIT_RTPRIO: ::c_int = 14;
pub const RLIMIT_RTTIME: ::c_int = 15;
+ #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::c_int = 15;
+ #[allow(deprecated)]
+ #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIMIT_NLIMITS: ::c_int = RLIM_NLIMITS;
}
}
cfg_if! {
if #[cfg(target_env = "gnu")] {
+ #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::__rlimit_resource_t = 16;
}
else if #[cfg(target_env = "uclibc")] {
+ #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::__rlimit_resource_t = 15;
}
}
diff --git a/src/unix/linux_like/linux/arch/mips/mod.rs b/src/unix/linux_like/linux/arch/mips/mod.rs
index 34c00a29..6c0aecf8 100644
--- a/src/unix/linux_like/linux/arch/mips/mod.rs
+++ b/src/unix/linux_like/linux/arch/mips/mod.rs
@@ -237,6 +237,8 @@ cfg_if! {
pub const RLIMIT_NICE: ::__rlimit_resource_t = 13;
pub const RLIMIT_RTPRIO: ::__rlimit_resource_t = 14;
pub const RLIMIT_RTTIME: ::__rlimit_resource_t = 15;
+ #[allow(deprecated)]
+ #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = RLIM_NLIMITS;
} else if #[cfg(target_env = "musl")] {
@@ -257,7 +259,10 @@ cfg_if! {
pub const RLIMIT_NICE: ::c_int = 13;
pub const RLIMIT_RTPRIO: ::c_int = 14;
pub const RLIMIT_RTTIME: ::c_int = 15;
+ #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::c_int = 15;
+ #[allow(deprecated)]
+ #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIMIT_NLIMITS: ::c_int = RLIM_NLIMITS;
pub const RLIM_INFINITY: ::rlim_t = !0;
}
@@ -265,14 +270,16 @@ cfg_if! {
cfg_if! {
if #[cfg(target_env = "gnu")] {
+ #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::__rlimit_resource_t = 16;
} else if #[cfg(target_env = "uclibc")] {
+ #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::__rlimit_resource_t = 15;
}
}
cfg_if! {
- if #[cfg(target_arch = "mips64",
+ if #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"),
any(target_env = "gnu",
target_env = "uclibc"))] {
pub const RLIM_INFINITY: ::rlim_t = !0;
@@ -280,7 +287,7 @@ cfg_if! {
}
cfg_if! {
- if #[cfg(target_arch = "mips",
+ if #[cfg(any(target_arch = "mips", target_arch = "mips32r6"),
any(target_env = "gnu",
target_env = "uclibc"))] {
pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff;
diff --git a/src/unix/linux_like/linux/arch/mod.rs b/src/unix/linux_like/linux/arch/mod.rs
index c1528f59..7f6ddc5a 100644
--- a/src/unix/linux_like/linux/arch/mod.rs
+++ b/src/unix/linux_like/linux/arch/mod.rs
@@ -1,5 +1,8 @@
cfg_if! {
- if #[cfg(any(target_arch = "mips", target_arch = "mips64"))] {
+ if #[cfg(any(target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "mips64",
+ target_arch = "mips64r6"))] {
mod mips;
pub use self::mips::*;
} else if #[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))] {
diff --git a/src/unix/linux_like/linux/arch/powerpc/mod.rs b/src/unix/linux_like/linux/arch/powerpc/mod.rs
index 64c3eaab..584be5b6 100644
--- a/src/unix/linux_like/linux/arch/powerpc/mod.rs
+++ b/src/unix/linux_like/linux/arch/powerpc/mod.rs
@@ -215,7 +215,10 @@ cfg_if! {
pub const RLIMIT_NICE: ::__rlimit_resource_t = 13;
pub const RLIMIT_RTPRIO: ::__rlimit_resource_t = 14;
pub const RLIMIT_RTTIME: ::__rlimit_resource_t = 15;
+ #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::__rlimit_resource_t = 16;
+ #[allow(deprecated)]
+ #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = RLIM_NLIMITS;
} else if #[cfg(target_env = "musl")] {
@@ -236,7 +239,10 @@ cfg_if! {
pub const RLIMIT_NICE: ::c_int = 13;
pub const RLIMIT_RTPRIO: ::c_int = 14;
pub const RLIMIT_RTTIME: ::c_int = 15;
+ #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::c_int = 15;
+ #[allow(deprecated)]
+ #[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIMIT_NLIMITS: ::c_int = RLIM_NLIMITS;
}
}
diff --git a/src/unix/linux_like/linux/arch/sparc/mod.rs b/src/unix/linux_like/linux/arch/sparc/mod.rs
index da3e388e..c7813aa4 100644
--- a/src/unix/linux_like/linux/arch/sparc/mod.rs
+++ b/src/unix/linux_like/linux/arch/sparc/mod.rs
@@ -216,7 +216,10 @@ pub const RLIMIT_MSGQUEUE: ::__rlimit_resource_t = 12;
pub const RLIMIT_NICE: ::__rlimit_resource_t = 13;
pub const RLIMIT_RTPRIO: ::__rlimit_resource_t = 14;
pub const RLIMIT_RTTIME: ::__rlimit_resource_t = 15;
+#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::__rlimit_resource_t = 16;
+#[allow(deprecated)]
+#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = RLIM_NLIMITS;
cfg_if! {
diff --git a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs
index fd690a17..9b3a2ff8 100644
--- a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs
@@ -341,6 +341,7 @@ pub const SOCK_DGRAM: ::c_int = 2;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const POLLWRNORM: ::c_short = 0x100;
pub const POLLWRBAND: ::c_short = 0x200;
diff --git a/src/unix/linux_like/linux/gnu/b32/csky/align.rs b/src/unix/linux_like/linux/gnu/b32/csky/align.rs
new file mode 100644
index 00000000..825546be
--- /dev/null
+++ b/src/unix/linux_like/linux/gnu/b32/csky/align.rs
@@ -0,0 +1,7 @@
+s_no_extra_traits! {
+ #[allow(missing_debug_implementations)]
+ #[repr(align(8))]
+ pub struct max_align_t {
+ priv_: [i64; 2]
+ }
+}
diff --git a/src/unix/linux_like/linux/gnu/b32/csky/mod.rs b/src/unix/linux_like/linux/gnu/b32/csky/mod.rs
new file mode 100644
index 00000000..9807cea8
--- /dev/null
+++ b/src/unix/linux_like/linux/gnu/b32/csky/mod.rs
@@ -0,0 +1,746 @@
+pub type c_char = u8;
+pub type wchar_t = u32;
+
+s! {
+ pub struct sigaction {
+ pub sa_sigaction: ::sighandler_t,
+ pub sa_mask: ::sigset_t,
+ pub sa_flags: ::c_int,
+ pub sa_restorer: ::Option<extern fn()>,
+ }
+
+ pub struct statfs {
+ 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 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 flock64 {
+ pub l_type: ::c_short,
+ pub l_whence: ::c_short,
+ pub l_start: ::off64_t,
+ pub l_len: ::off64_t,
+ pub l_pid: ::pid_t,
+ }
+
+ 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,
+ __pad1: ::c_ushort,
+ pub __seq: ::c_ushort,
+ __pad2: ::c_ushort,
+ __unused1: ::c_ulong,
+ __unused2: ::c_ulong
+ }
+
+ pub struct stat64 {
+ pub st_dev: ::dev_t,
+ __pad1: ::c_uint,
+ __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,
+ __pad2: ::c_uint,
+ pub st_size: ::off64_t,
+ pub st_blksize: ::blksize_t,
+ pub st_blocks: ::blkcnt64_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: ::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,
+ pub shm_atime: ::time_t,
+ __unused1: ::c_ulong,
+ pub shm_dtime: ::time_t,
+ __unused2: ::c_ulong,
+ pub shm_ctime: ::time_t,
+ __unused3: ::c_ulong,
+ pub shm_cpid: ::pid_t,
+ pub shm_lpid: ::pid_t,
+ pub shm_nattch: ::shmatt_t,
+ __unused4: ::c_ulong,
+ __unused5: ::c_ulong
+ }
+
+ pub struct msqid_ds {
+ pub msg_perm: ::ipc_perm,
+ pub msg_stime: ::time_t,
+ __glibc_reserved1: ::c_ulong,
+ pub msg_rtime: ::time_t,
+ __glibc_reserved2: ::c_ulong,
+ pub msg_ctime: ::time_t,
+ __glibc_reserved3: ::c_ulong,
+ __msg_cbytes: ::c_ulong,
+ pub msg_qnum: ::msgqnum_t,
+ pub msg_qbytes: ::msglen_t,
+ pub msg_lspid: ::pid_t,
+ pub msg_lrpid: ::pid_t,
+ __glibc_reserved4: ::c_ulong,
+ __glibc_reserved5: ::c_ulong,
+ }
+
+ pub struct siginfo_t {
+ pub si_signo: ::c_int,
+ pub si_errno: ::c_int,
+ pub si_code: ::c_int,
+ #[doc(hidden)]
+ #[deprecated(
+ since="0.2.54",
+ note="Please leave a comment on \
+ https://github.com/rust-lang/libc/pull/1316 if you're using \
+ this field"
+ )]
+ pub _pad: [::c_int; 29],
+ _align: [usize; 0],
+ }
+
+ pub struct stack_t {
+ pub ss_sp: *mut ::c_void,
+ pub ss_flags: ::c_int,
+ pub ss_size: ::size_t
+ }
+}
+
+pub const VEOF: usize = 4;
+pub const RTLD_DEEPBIND: ::c_int = 0x8;
+pub const RTLD_GLOBAL: ::c_int = 0x100;
+pub const RTLD_NOLOAD: ::c_int = 0x4;
+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 = 0o100000;
+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 O_FSYNC: ::c_int = 0x101000;
+pub const O_ASYNC: ::c_int = 0x2000;
+pub const O_NDELAY: ::c_int = 0x800;
+
+pub const MADV_SOFT_OFFLINE: ::c_int = 101;
+pub const MAP_LOCKED: ::c_int = 0x02000;
+pub const MAP_NORESERVE: ::c_int = 0x04000;
+pub const MAP_ANON: ::c_int = 0x0020;
+pub const MAP_ANONYMOUS: ::c_int = 0x0020;
+pub const MAP_DENYWRITE: ::c_int = 0x0800;
+pub const MAP_EXECUTABLE: ::c_int = 0x01000;
+pub const MAP_POPULATE: ::c_int = 0x08000;
+pub const MAP_NONBLOCK: ::c_int = 0x010000;
+pub const MAP_STACK: ::c_int = 0x020000;
+pub const MAP_HUGETLB: ::c_int = 0x040000;
+pub const MAP_GROWSDOWN: ::c_int = 0x0100;
+pub const MAP_SYNC: ::c_int = 0x080000;
+
+pub const EDEADLOCK: ::c_int = 35;
+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 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 EMULTIHOP: ::c_int = 72;
+pub const EOVERFLOW: ::c_int = 75;
+pub const ENOTUNIQ: ::c_int = 76;
+pub const EBADFD: ::c_int = 77;
+pub const EBADMSG: ::c_int = 74;
+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 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 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 EHWPOISON: ::c_int = 133;
+pub const ERFKILL: ::c_int = 132;
+
+pub const SA_SIGINFO: ::c_int = 0x00000004;
+pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
+
+pub const SOCK_STREAM: ::c_int = 1;
+pub const SOCK_DGRAM: ::c_int = 2;
+
+pub const MCL_CURRENT: ::c_int = 0x0001;
+pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
+
+pub const POLLWRNORM: ::c_short = 0x100;
+pub const POLLWRBAND: ::c_short = 0x200;
+
+pub const F_GETLK: ::c_int = 5;
+pub const F_GETOWN: ::c_int = 9;
+pub const F_SETOWN: ::c_int = 8;
+
+pub const EFD_NONBLOCK: ::c_int = 0x800;
+pub const SFD_NONBLOCK: ::c_int = 0x0800;
+
+pub const SIGCHLD: ::c_int = 17;
+pub const SIGBUS: ::c_int = 7;
+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;
+#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")]
+pub const SIGUNUSED: ::c_int = 31;
+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 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 SIGSTKSZ: ::size_t = 8192;
+pub const MINSIGSTKSZ: ::size_t = 2048;
+pub const CBAUD: ::tcflag_t = 0o0010017;
+pub const TAB1: ::tcflag_t = 0x00000800;
+pub const TAB2: ::tcflag_t = 0x00001000;
+pub const TAB3: ::tcflag_t = 0x00001800;
+pub const CR1: ::tcflag_t = 0x00000200;
+pub const CR2: ::tcflag_t = 0x00000400;
+pub const CR3: ::tcflag_t = 0x00000600;
+pub const FF1: ::tcflag_t = 0x00008000;
+pub const BS1: ::tcflag_t = 0x00002000;
+pub const VT1: ::tcflag_t = 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 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;
+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 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 SECCOMP_SET_MODE_STRICT: ::c_uint = 0;
+pub const SECCOMP_SET_MODE_FILTER: ::c_uint = 1;
+pub const SECCOMP_GET_ACTION_AVAIL: ::c_uint = 2;
+pub const SECCOMP_GET_NOTIF_SIZES: ::c_uint = 3;
+
+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 EXTPROC: ::tcflag_t = 0x00010000;
+
+pub const TCSANOW: ::c_int = 0;
+pub const TCSADRAIN: ::c_int = 1;
+pub const TCSAFLUSH: ::c_int = 2;
+
+// Syscall table
+pub const SYS_read: ::c_long = 63;
+pub const SYS_write: ::c_long = 64;
+pub const SYS_close: ::c_long = 57;
+pub const SYS_fstat: ::c_long = 80;
+pub const SYS_lseek: ::c_long = 62;
+pub const SYS_mmap: ::c_long = 222;
+pub const SYS_mprotect: ::c_long = 226;
+pub const SYS_munmap: ::c_long = 215;
+pub const SYS_brk: ::c_long = 214;
+pub const SYS_rt_sigaction: ::c_long = 134;
+pub const SYS_rt_sigprocmask: ::c_long = 135;
+pub const SYS_rt_sigreturn: ::c_long = 139;
+pub const SYS_ioctl: ::c_long = 29;
+pub const SYS_pread64: ::c_long = 67;
+pub const SYS_pwrite64: ::c_long = 68;
+pub const SYS_readv: ::c_long = 65;
+pub const SYS_writev: ::c_long = 66;
+pub const SYS_sched_yield: ::c_long = 124;
+pub const SYS_mremap: ::c_long = 216;
+pub const SYS_msync: ::c_long = 227;
+pub const SYS_mincore: ::c_long = 232;
+pub const SYS_madvise: ::c_long = 233;
+pub const SYS_shmget: ::c_long = 194;
+pub const SYS_shmat: ::c_long = 196;
+pub const SYS_shmctl: ::c_long = 195;
+pub const SYS_dup: ::c_long = 23;
+pub const SYS_nanosleep: ::c_long = 101;
+pub const SYS_getitimer: ::c_long = 102;
+pub const SYS_setitimer: ::c_long = 103;
+pub const SYS_getpid: ::c_long = 172;
+pub const SYS_sendfile: ::c_long = 71;
+pub const SYS_socket: ::c_long = 198;
+pub const SYS_connect: ::c_long = 203;
+pub const SYS_accept: ::c_long = 202;
+pub const SYS_sendto: ::c_long = 206;
+pub const SYS_recvfrom: ::c_long = 207;
+pub const SYS_sendmsg: ::c_long = 211;
+pub const SYS_recvmsg: ::c_long = 212;
+pub const SYS_shutdown: ::c_long = 210;
+pub const SYS_bind: ::c_long = 200;
+pub const SYS_listen: ::c_long = 201;
+pub const SYS_getsockname: ::c_long = 204;
+pub const SYS_getpeername: ::c_long = 205;
+pub const SYS_socketpair: ::c_long = 199;
+pub const SYS_setsockopt: ::c_long = 208;
+pub const SYS_getsockopt: ::c_long = 209;
+pub const SYS_clone: ::c_long = 220;
+pub const SYS_execve: ::c_long = 221;
+pub const SYS_exit: ::c_long = 93;
+pub const SYS_wait4: ::c_long = 260;
+pub const SYS_kill: ::c_long = 129;
+pub const SYS_uname: ::c_long = 160;
+pub const SYS_semget: ::c_long = 190;
+pub const SYS_semop: ::c_long = 193;
+pub const SYS_semctl: ::c_long = 191;
+pub const SYS_shmdt: ::c_long = 197;
+pub const SYS_msgget: ::c_long = 186;
+pub const SYS_msgsnd: ::c_long = 189;
+pub const SYS_msgrcv: ::c_long = 188;
+pub const SYS_msgctl: ::c_long = 187;
+pub const SYS_fcntl: ::c_long = 25;
+pub const SYS_flock: ::c_long = 32;
+pub const SYS_fsync: ::c_long = 82;
+pub const SYS_fdatasync: ::c_long = 83;
+pub const SYS_truncate: ::c_long = 45;
+pub const SYS_ftruncate: ::c_long = 46;
+pub const SYS_getcwd: ::c_long = 17;
+pub const SYS_chdir: ::c_long = 49;
+pub const SYS_fchdir: ::c_long = 50;
+pub const SYS_fchmod: ::c_long = 52;
+pub const SYS_fchown: ::c_long = 55;
+pub const SYS_umask: ::c_long = 166;
+pub const SYS_gettimeofday: ::c_long = 169;
+pub const SYS_getrlimit: ::c_long = 163;
+pub const SYS_getrusage: ::c_long = 165;
+pub const SYS_sysinfo: ::c_long = 179;
+pub const SYS_times: ::c_long = 153;
+pub const SYS_ptrace: ::c_long = 117;
+pub const SYS_getuid: ::c_long = 174;
+pub const SYS_syslog: ::c_long = 116;
+pub const SYS_getgid: ::c_long = 176;
+pub const SYS_setuid: ::c_long = 146;
+pub const SYS_setgid: ::c_long = 144;
+pub const SYS_geteuid: ::c_long = 175;
+pub const SYS_getegid: ::c_long = 177;
+pub const SYS_setpgid: ::c_long = 154;
+pub const SYS_getppid: ::c_long = 173;
+pub const SYS_setsid: ::c_long = 157;
+pub const SYS_setreuid: ::c_long = 145;
+pub const SYS_setregid: ::c_long = 143;
+pub const SYS_getgroups: ::c_long = 158;
+pub const SYS_setgroups: ::c_long = 159;
+pub const SYS_setresuid: ::c_long = 147;
+pub const SYS_getresuid: ::c_long = 148;
+pub const SYS_setresgid: ::c_long = 149;
+pub const SYS_getresgid: ::c_long = 150;
+pub const SYS_getpgid: ::c_long = 155;
+pub const SYS_setfsuid: ::c_long = 151;
+pub const SYS_setfsgid: ::c_long = 152;
+pub const SYS_getsid: ::c_long = 156;
+pub const SYS_capget: ::c_long = 90;
+pub const SYS_capset: ::c_long = 91;
+pub const SYS_rt_sigpending: ::c_long = 136;
+pub const SYS_rt_sigtimedwait: ::c_long = 137;
+pub const SYS_rt_sigqueueinfo: ::c_long = 138;
+pub const SYS_rt_sigsuspend: ::c_long = 133;
+pub const SYS_sigaltstack: ::c_long = 132;
+pub const SYS_personality: ::c_long = 92;
+pub const SYS_statfs: ::c_long = 43;
+pub const SYS_fstatfs: ::c_long = 44;
+pub const SYS_getpriority: ::c_long = 141;
+pub const SYS_setpriority: ::c_long = 140;
+pub const SYS_sched_setparam: ::c_long = 118;
+pub const SYS_sched_getparam: ::c_long = 121;
+pub const SYS_sched_setscheduler: ::c_long = 119;
+pub const SYS_sched_getscheduler: ::c_long = 120;
+pub const SYS_sched_get_priority_max: ::c_long = 125;
+pub const SYS_sched_get_priority_min: ::c_long = 126;
+pub const SYS_sched_rr_get_interval: ::c_long = 127;
+pub const SYS_mlock: ::c_long = 228;
+pub const SYS_munlock: ::c_long = 229;
+pub const SYS_mlockall: ::c_long = 230;
+pub const SYS_munlockall: ::c_long = 231;
+pub const SYS_vhangup: ::c_long = 58;
+pub const SYS_pivot_root: ::c_long = 41;
+pub const SYS_prctl: ::c_long = 167;
+pub const SYS_adjtimex: ::c_long = 171;
+pub const SYS_setrlimit: ::c_long = 164;
+pub const SYS_chroot: ::c_long = 51;
+pub const SYS_sync: ::c_long = 81;
+pub const SYS_acct: ::c_long = 89;
+pub const SYS_settimeofday: ::c_long = 170;
+pub const SYS_mount: ::c_long = 40;
+pub const SYS_umount2: ::c_long = 39;
+pub const SYS_swapon: ::c_long = 224;
+pub const SYS_swapoff: ::c_long = 225;
+pub const SYS_reboot: ::c_long = 142;
+pub const SYS_sethostname: ::c_long = 161;
+pub const SYS_setdomainname: ::c_long = 162;
+pub const SYS_init_module: ::c_long = 105;
+pub const SYS_delete_module: ::c_long = 106;
+pub const SYS_quotactl: ::c_long = 60;
+pub const SYS_nfsservctl: ::c_long = 42;
+pub const SYS_gettid: ::c_long = 178;
+pub const SYS_readahead: ::c_long = 213;
+pub const SYS_setxattr: ::c_long = 5;
+pub const SYS_lsetxattr: ::c_long = 6;
+pub const SYS_fsetxattr: ::c_long = 7;
+pub const SYS_getxattr: ::c_long = 8;
+pub const SYS_lgetxattr: ::c_long = 9;
+pub const SYS_fgetxattr: ::c_long = 10;
+pub const SYS_listxattr: ::c_long = 11;
+pub const SYS_llistxattr: ::c_long = 12;
+pub const SYS_flistxattr: ::c_long = 13;
+pub const SYS_removexattr: ::c_long = 14;
+pub const SYS_lremovexattr: ::c_long = 15;
+pub const SYS_fremovexattr: ::c_long = 16;
+pub const SYS_tkill: ::c_long = 130;
+pub const SYS_futex: ::c_long = 98;
+pub const SYS_sched_setaffinity: ::c_long = 122;
+pub const SYS_sched_getaffinity: ::c_long = 123;
+pub const SYS_io_setup: ::c_long = 0;
+pub const SYS_io_destroy: ::c_long = 1;
+pub const SYS_io_getevents: ::c_long = 4;
+pub const SYS_io_submit: ::c_long = 2;
+pub const SYS_io_cancel: ::c_long = 3;
+pub const SYS_lookup_dcookie: ::c_long = 18;
+pub const SYS_remap_file_pages: ::c_long = 234;
+pub const SYS_getdents64: ::c_long = 61;
+pub const SYS_set_tid_address: ::c_long = 96;
+pub const SYS_restart_syscall: ::c_long = 128;
+pub const SYS_semtimedop: ::c_long = 192;
+pub const SYS_fadvise64: ::c_long = 223;
+pub const SYS_timer_create: ::c_long = 107;
+pub const SYS_timer_settime: ::c_long = 110;
+pub const SYS_timer_gettime: ::c_long = 108;
+pub const SYS_timer_getoverrun: ::c_long = 109;
+pub const SYS_timer_delete: ::c_long = 111;
+pub const SYS_clock_settime: ::c_long = 112;
+pub const SYS_clock_gettime: ::c_long = 113;
+pub const SYS_clock_getres: ::c_long = 114;
+pub const SYS_clock_nanosleep: ::c_long = 115;
+pub const SYS_exit_group: ::c_long = 94;
+pub const SYS_epoll_ctl: ::c_long = 21;
+pub const SYS_tgkill: ::c_long = 131;
+pub const SYS_mbind: ::c_long = 235;
+pub const SYS_set_mempolicy: ::c_long = 237;
+pub const SYS_get_mempolicy: ::c_long = 236;
+pub const SYS_mq_open: ::c_long = 180;
+pub const SYS_mq_unlink: ::c_long = 181;
+pub const SYS_mq_timedsend: ::c_long = 182;
+pub const SYS_mq_timedreceive: ::c_long = 183;
+pub const SYS_mq_notify: ::c_long = 184;
+pub const SYS_mq_getsetattr: ::c_long = 185;
+pub const SYS_kexec_load: ::c_long = 104;
+pub const SYS_waitid: ::c_long = 95;
+pub const SYS_add_key: ::c_long = 217;
+pub const SYS_request_key: ::c_long = 218;
+pub const SYS_keyctl: ::c_long = 219;
+pub const SYS_ioprio_set: ::c_long = 30;
+pub const SYS_ioprio_get: ::c_long = 31;
+pub const SYS_inotify_add_watch: ::c_long = 27;
+pub const SYS_inotify_rm_watch: ::c_long = 28;
+pub const SYS_migrate_pages: ::c_long = 238;
+pub const SYS_openat: ::c_long = 56;
+pub const SYS_mkdirat: ::c_long = 34;
+pub const SYS_mknodat: ::c_long = 33;
+pub const SYS_fchownat: ::c_long = 54;
+pub const SYS_newfstatat: ::c_long = 79;
+pub const SYS_unlinkat: ::c_long = 35;
+pub const SYS_linkat: ::c_long = 37;
+pub const SYS_symlinkat: ::c_long = 36;
+pub const SYS_readlinkat: ::c_long = 78;
+pub const SYS_fchmodat: ::c_long = 53;
+pub const SYS_faccessat: ::c_long = 48;
+pub const SYS_pselect6: ::c_long = 72;
+pub const SYS_ppoll: ::c_long = 73;
+pub const SYS_unshare: ::c_long = 97;
+pub const SYS_set_robust_list: ::c_long = 99;
+pub const SYS_get_robust_list: ::c_long = 100;
+pub const SYS_splice: ::c_long = 76;
+pub const SYS_tee: ::c_long = 77;
+pub const SYS_sync_file_range: ::c_long = 84;
+pub const SYS_vmsplice: ::c_long = 75;
+pub const SYS_move_pages: ::c_long = 239;
+pub const SYS_utimensat: ::c_long = 88;
+pub const SYS_epoll_pwait: ::c_long = 22;
+pub const SYS_timerfd_create: ::c_long = 85;
+pub const SYS_fallocate: ::c_long = 47;
+pub const SYS_timerfd_settime: ::c_long = 86;
+pub const SYS_timerfd_gettime: ::c_long = 87;
+pub const SYS_accept4: ::c_long = 242;
+pub const SYS_signalfd4: ::c_long = 74;
+pub const SYS_eventfd2: ::c_long = 19;
+pub const SYS_epoll_create1: ::c_long = 20;
+pub const SYS_dup3: ::c_long = 24;
+pub const SYS_pipe2: ::c_long = 59;
+pub const SYS_inotify_init1: ::c_long = 26;
+pub const SYS_preadv: ::c_long = 69;
+pub const SYS_pwritev: ::c_long = 70;
+pub const SYS_rt_tgsigqueueinfo: ::c_long = 240;
+pub const SYS_perf_event_open: ::c_long = 241;
+pub const SYS_recvmmsg: ::c_long = 243;
+pub const SYS_fanotify_init: ::c_long = 262;
+pub const SYS_fanotify_mark: ::c_long = 263;
+pub const SYS_prlimit64: ::c_long = 261;
+pub const SYS_name_to_handle_at: ::c_long = 264;
+pub const SYS_open_by_handle_at: ::c_long = 265;
+pub const SYS_clock_adjtime: ::c_long = 266;
+pub const SYS_syncfs: ::c_long = 267;
+pub const SYS_sendmmsg: ::c_long = 269;
+pub const SYS_setns: ::c_long = 268;
+pub const SYS_getcpu: ::c_long = 168;
+pub const SYS_process_vm_readv: ::c_long = 270;
+pub const SYS_process_vm_writev: ::c_long = 271;
+pub const SYS_kcmp: ::c_long = 272;
+pub const SYS_finit_module: ::c_long = 273;
+pub const SYS_sched_setattr: ::c_long = 274;
+pub const SYS_sched_getattr: ::c_long = 275;
+pub const SYS_renameat2: ::c_long = 276;
+pub const SYS_seccomp: ::c_long = 277;
+pub const SYS_getrandom: ::c_long = 278;
+pub const SYS_memfd_create: ::c_long = 279;
+pub const SYS_bpf: ::c_long = 280;
+pub const SYS_execveat: ::c_long = 281;
+pub const SYS_userfaultfd: ::c_long = 282;
+pub const SYS_membarrier: ::c_long = 283;
+pub const SYS_mlock2: ::c_long = 284;
+pub const SYS_copy_file_range: ::c_long = 285;
+pub const SYS_preadv2: ::c_long = 286;
+pub const SYS_pwritev2: ::c_long = 287;
+pub const SYS_pkey_mprotect: ::c_long = 288;
+pub const SYS_pkey_alloc: ::c_long = 289;
+pub const SYS_pkey_free: ::c_long = 290;
+pub const SYS_statx: ::c_long = 291;
+pub const SYS_rseq: ::c_long = 293;
+pub const SYS_syscall: ::c_long = 294;
+pub const SYS_pidfd_send_signal: ::c_long = 424;
+pub const SYS_io_uring_setup: ::c_long = 425;
+pub const SYS_io_uring_enter: ::c_long = 426;
+pub const SYS_io_uring_register: ::c_long = 427;
+pub const SYS_open_tree: ::c_long = 428;
+pub const SYS_move_mount: ::c_long = 429;
+pub const SYS_fsopen: ::c_long = 430;
+pub const SYS_fsconfig: ::c_long = 431;
+pub const SYS_fsmount: ::c_long = 432;
+pub const SYS_fspick: ::c_long = 433;
+pub const SYS_pidfd_open: ::c_long = 434;
+pub const SYS_clone3: ::c_long = 435;
+pub const SYS_close_range: ::c_long = 436;
+pub const SYS_openat2: ::c_long = 437;
+pub const SYS_pidfd_getfd: ::c_long = 438;
+pub const SYS_faccessat2: ::c_long = 439;
+pub const SYS_process_madvise: ::c_long = 440;
+pub const SYS_epoll_pwait2: ::c_long = 441;
+pub const SYS_mount_setattr: ::c_long = 442;
+pub const SYS_quotactl_fd: ::c_long = 443;
+pub const SYS_landlock_create_ruleset: ::c_long = 444;
+pub const SYS_landlock_add_rule: ::c_long = 445;
+pub const SYS_landlock_restrict_self: ::c_long = 446;
+pub const SYS_memfd_secret: ::c_long = 447;
+pub const SYS_process_mrelease: ::c_long = 448;
+pub const SYS_futex_waitv: ::c_long = 449;
+pub const SYS_set_mempolicy_home_node: ::c_long = 450;
+
+cfg_if! {
+ if #[cfg(libc_align)] {
+ mod align;
+ pub use self::align::*;
+ }
+}
diff --git a/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs b/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs
index 69725ee7..8ca7d3d2 100644
--- a/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs
@@ -293,6 +293,7 @@ pub const PTRACE_SYSEMU_SINGLESTEP: ::c_uint = 32;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const POLLWRNORM: ::c_short = 0x100;
pub const POLLWRBAND: ::c_short = 0x200;
diff --git a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs
index 6a03f0ba..fa270750 100644
--- a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs
@@ -719,6 +719,7 @@ pub const RTLD_NOLOAD: ::c_int = 0x8;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const SIGSTKSZ: ::size_t = 8192;
pub const MINSIGSTKSZ: ::size_t = 2048;
diff --git a/src/unix/linux_like/linux/gnu/b32/mod.rs b/src/unix/linux_like/linux/gnu/b32/mod.rs
index 66d1d016..d5b11347 100644
--- a/src/unix/linux_like/linux/gnu/b32/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b32/mod.rs
@@ -43,34 +43,34 @@ cfg_if! {
s! {
pub struct stat {
- #[cfg(not(target_arch = "mips"))]
+ #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))]
pub st_dev: ::dev_t,
- #[cfg(target_arch = "mips")]
+ #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
pub st_dev: ::c_ulong,
- #[cfg(not(target_arch = "mips"))]
+ #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))]
__pad1: ::c_short,
- #[cfg(target_arch = "mips")]
+ #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
st_pad1: [::c_long; 3],
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,
- #[cfg(not(target_arch = "mips"))]
+ #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))]
pub st_rdev: ::dev_t,
- #[cfg(target_arch = "mips")]
+ #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
pub st_rdev: ::c_ulong,
- #[cfg(not(target_arch = "mips"))]
+ #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))]
__pad2: ::c_short,
- #[cfg(target_arch = "mips")]
+ #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
st_pad2: [::c_long; 2],
pub st_size: ::off_t,
- #[cfg(target_arch = "mips")]
+ #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
st_pad3: ::c_long,
- #[cfg(not(target_arch = "mips"))]
+ #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))]
pub st_blksize: ::blksize_t,
- #[cfg(not(target_arch = "mips"))]
+ #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))]
pub st_blocks: ::blkcnt_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
@@ -78,15 +78,15 @@ s! {
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
- #[cfg(not(target_arch = "mips"))]
+ #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))]
__unused4: ::c_long,
- #[cfg(not(target_arch = "mips"))]
+ #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6")))]
__unused5: ::c_long,
- #[cfg(target_arch = "mips")]
+ #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
pub st_blksize: ::blksize_t,
- #[cfg(target_arch = "mips")]
+ #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
pub st_blocks: ::blkcnt_t,
- #[cfg(target_arch = "mips")]
+ #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))]
st_pad5: [::c_long; 14],
}
@@ -140,12 +140,12 @@ s! {
#[cfg(target_arch = "powerpc")]
__reserved: ::__syscall_ulong_t,
pub sem_otime: ::time_t,
- #[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))]
+ #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6", target_arch = "powerpc")))]
__reserved: ::__syscall_ulong_t,
#[cfg(target_arch = "powerpc")]
__reserved2: ::__syscall_ulong_t,
pub sem_ctime: ::time_t,
- #[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))]
+ #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6", target_arch = "powerpc")))]
__reserved2: ::__syscall_ulong_t,
pub sem_nsems: ::__syscall_ulong_t,
__glibc_reserved3: ::__syscall_ulong_t,
@@ -337,7 +337,7 @@ cfg_if! {
} else if #[cfg(target_arch = "arm")] {
mod arm;
pub use self::arm::*;
- } else if #[cfg(target_arch = "mips")] {
+ } else if #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] {
mod mips;
pub use self::mips::*;
} else if #[cfg(target_arch = "m68k")] {
@@ -352,6 +352,9 @@ cfg_if! {
} else if #[cfg(target_arch = "riscv32")] {
mod riscv32;
pub use self::riscv32::*;
+ } else if #[cfg(target_arch = "csky")] {
+ mod csky;
+ pub use self::csky::*;
} else {
// Unknown target_arch
}
diff --git a/src/unix/linux_like/linux/gnu/b32/powerpc.rs b/src/unix/linux_like/linux/gnu/b32/powerpc.rs
index e70b216b..dd5732e0 100644
--- a/src/unix/linux_like/linux/gnu/b32/powerpc.rs
+++ b/src/unix/linux_like/linux/gnu/b32/powerpc.rs
@@ -293,6 +293,7 @@ pub const SOCK_DGRAM: ::c_int = 2;
pub const MCL_CURRENT: ::c_int = 0x2000;
pub const MCL_FUTURE: ::c_int = 0x4000;
+pub const MCL_ONFAULT: ::c_int = 0x8000;
pub const POLLWRNORM: ::c_short = 0x100;
pub const POLLWRBAND: ::c_short = 0x200;
diff --git a/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs b/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs
index f3b130cb..65b7aaa7 100644
--- a/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs
@@ -393,6 +393,7 @@ pub const EISNAM: ::c_int = 120;
pub const EREMOTEIO: ::c_int = 121;
pub const MCL_CURRENT: ::c_int = 1;
pub const MCL_FUTURE: ::c_int = 2;
+pub const MCL_ONFAULT: ::c_int = 4;
pub const SIGSTKSZ: ::size_t = 8192;
pub const MINSIGSTKSZ: ::size_t = 2048;
pub const CBAUD: ::tcflag_t = 4111;
diff --git a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs
index 57ad9fe8..da9cf29c 100644
--- a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs
@@ -363,6 +363,7 @@ pub const EREMOTEIO: ::c_int = 121;
pub const MCL_CURRENT: ::c_int = 0x2000;
pub const MCL_FUTURE: ::c_int = 0x4000;
+pub const MCL_ONFAULT: ::c_int = 0x8000;
pub const SIGSTKSZ: ::size_t = 16384;
pub const MINSIGSTKSZ: ::size_t = 4096;
diff --git a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs
index 93622387..a3531c14 100644
--- a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs
@@ -507,6 +507,7 @@ pub const PTRACE_SYSEMU_SINGLESTEP: ::c_uint = 32;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const POLLWRNORM: ::c_short = 0x100;
pub const POLLWRBAND: ::c_short = 0x200;
diff --git a/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs b/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs
index 06173be6..a035773c 100644
--- a/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs
+++ b/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs
@@ -27,13 +27,6 @@ s! {
__reserved: [[u64; 32]; 16],
}
- #[repr(align(16))]
- pub struct user_fpsimd_struct {
- pub vregs: [[u64; 2]; 32],
- pub fpsr: ::c_uint,
- pub fpcr: ::c_uint,
- }
-
#[repr(align(8))]
pub struct clone_args {
pub flags: ::c_ulonglong,
diff --git a/src/unix/linux_like/linux/gnu/b64/aarch64/fallback.rs b/src/unix/linux_like/linux/gnu/b64/aarch64/fallback.rs
new file mode 100644
index 00000000..398fbb53
--- /dev/null
+++ b/src/unix/linux_like/linux/gnu/b64/aarch64/fallback.rs
@@ -0,0 +1,8 @@
+s! {
+ #[repr(align(16))]
+ pub struct user_fpsimd_struct {
+ pub vregs: [[u64; 2]; 32],
+ pub fpsr: ::c_uint,
+ pub fpcr: ::c_uint,
+ }
+}
diff --git a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs
index f46ea941..206283e2 100644
--- a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs
@@ -423,6 +423,7 @@ pub const EDEADLOCK: ::c_int = 35;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const SIGSTKSZ: ::size_t = 16384;
pub const MINSIGSTKSZ: ::size_t = 5120;
@@ -902,6 +903,9 @@ pub const SYS_process_mrelease: ::c_long = 448;
pub const SYS_futex_waitv: ::c_long = 449;
pub const SYS_set_mempolicy_home_node: ::c_long = 450;
+pub const PROT_BTI: ::c_int = 0x10;
+pub const PROT_MTE: ::c_int = 0x20;
+
extern "C" {
pub fn sysctl(
name: *mut ::c_int,
@@ -928,11 +932,16 @@ cfg_if! {
mod align;
pub use self::align::*;
}
+
+
}
cfg_if! {
if #[cfg(libc_int128)] {
mod int128;
pub use self::int128::*;
+ } else if #[cfg(libc_align)] {
+ mod fallback;
+ pub use self::fallback::*;
}
}
diff --git a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs
index ea59181b..3e1719a7 100644
--- a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs
@@ -264,6 +264,21 @@ align_const! {
};
}
+pub const HWCAP_CPUCFG: ::c_ulong = 1 << 0;
+pub const HWCAP_LAM: ::c_ulong = 1 << 1;
+pub const HWCAP_UAL: ::c_ulong = 1 << 2;
+pub const HWCAP_FPU: ::c_ulong = 1 << 3;
+pub const HWCAP_LSX: ::c_ulong = 1 << 4;
+pub const HWCAP_LASX: ::c_ulong = 1 << 5;
+pub const HWCAP_CRC32: ::c_ulong = 1 << 6;
+pub const HWCAP_COMPLEX: ::c_ulong = 1 << 7;
+pub const HWCAP_CRYPTO: ::c_ulong = 1 << 8;
+pub const HWCAP_LVZ: ::c_ulong = 1 << 9;
+pub const HWCAP_LBT_X86: ::c_ulong = 1 << 10;
+pub const HWCAP_LBT_ARM: ::c_ulong = 1 << 11;
+pub const HWCAP_LBT_MIPS: ::c_ulong = 1 << 12;
+pub const HWCAP_PTW: ::c_ulong = 1 << 13;
+
pub const SYS_io_setup: ::c_long = 0;
pub const SYS_io_destroy: ::c_long = 1;
pub const SYS_io_submit: ::c_long = 2;
diff --git a/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs b/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs
index 66b29a8a..f7b52be8 100644
--- a/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs
@@ -823,6 +823,7 @@ pub const RTLD_NOLOAD: ::c_int = 0x8;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const SIGSTKSZ: ::size_t = 8192;
pub const MINSIGSTKSZ: ::size_t = 2048;
diff --git a/src/unix/linux_like/linux/gnu/b64/mod.rs b/src/unix/linux_like/linux/gnu/b64/mod.rs
index 443958cf..ff394e33 100644
--- a/src/unix/linux_like/linux/gnu/b64/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b64/mod.rs
@@ -72,6 +72,7 @@ s! {
target_arch = "aarch64",
target_arch = "loongarch64",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "powerpc64",
target_arch = "riscv64",
target_arch = "sparc64")))]
@@ -81,6 +82,7 @@ s! {
target_arch = "aarch64",
target_arch = "loongarch64",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "powerpc64",
target_arch = "riscv64",
target_arch = "sparc64")))]
@@ -105,7 +107,7 @@ cfg_if! {
} else if #[cfg(any(target_arch = "sparc64"))] {
mod sparc64;
pub use self::sparc64::*;
- } else if #[cfg(any(target_arch = "mips64"))] {
+ } else if #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))] {
mod mips64;
pub use self::mips64::*;
} else if #[cfg(any(target_arch = "s390x"))] {
diff --git a/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs b/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs
index 2b225e48..3088c25a 100644
--- a/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs
@@ -473,6 +473,7 @@ pub const EREMOTEIO: ::c_int = 121;
pub const MCL_CURRENT: ::c_int = 0x2000;
pub const MCL_FUTURE: ::c_int = 0x4000;
+pub const MCL_ONFAULT: ::c_int = 0x8000;
pub const SIGSTKSZ: ::size_t = 0x4000;
pub const MINSIGSTKSZ: ::size_t = 4096;
diff --git a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs
index c65a562a..8e06a135 100644
--- a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs
@@ -432,6 +432,7 @@ pub const PTRACE_GETREGS: ::c_uint = 12;
pub const PTRACE_SETREGS: ::c_uint = 13;
pub const MCL_CURRENT: ::c_int = 1;
pub const MCL_FUTURE: ::c_int = 2;
+pub const MCL_ONFAULT: ::c_int = 4;
pub const SIGSTKSZ: ::size_t = 8192;
pub const MINSIGSTKSZ: ::size_t = 2048;
pub const CBAUD: ::tcflag_t = 4111;
diff --git a/src/unix/linux_like/linux/gnu/b64/s390x.rs b/src/unix/linux_like/linux/gnu/b64/s390x.rs
index c2c4f31c..61ee2dcc 100644
--- a/src/unix/linux_like/linux/gnu/b64/s390x.rs
+++ b/src/unix/linux_like/linux/gnu/b64/s390x.rs
@@ -481,6 +481,7 @@ pub const PTRACE_DETACH: ::c_uint = 17;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const EFD_NONBLOCK: ::c_int = 0x800;
diff --git a/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs b/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs
index 2427c7a0..de2f0d6e 100644
--- a/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs
@@ -444,6 +444,7 @@ pub const EREMOTEIO: ::c_int = 121;
pub const MCL_CURRENT: ::c_int = 0x2000;
pub const MCL_FUTURE: ::c_int = 0x4000;
+pub const MCL_ONFAULT: ::c_int = 0x8000;
pub const SIGSTKSZ: ::size_t = 16384;
pub const MINSIGSTKSZ: ::size_t = 4096;
diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs
index e6307e28..9b2aac5c 100644
--- a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs
@@ -651,6 +651,7 @@ pub const PR_SPEC_INDIRECT_BRANCH: ::c_int = 1;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const SIGSTKSZ: ::size_t = 8192;
pub const MINSIGSTKSZ: ::size_t = 2048;
diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs
index ba4664bf..377b9f12 100644
--- a/src/unix/linux_like/linux/gnu/mod.rs
+++ b/src/unix/linux_like/linux/gnu/mod.rs
@@ -116,13 +116,17 @@ s! {
target_arch = "sparc",
target_arch = "sparc64",
target_arch = "mips",
- target_arch = "mips64")))]
+ target_arch = "mips32r6",
+ target_arch = "mips64",
+ target_arch = "mips64r6")))]
pub c_ispeed: ::speed_t,
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
target_arch = "mips",
- target_arch = "mips64")))]
+ target_arch = "mips32r6",
+ target_arch = "mips64",
+ target_arch = "mips64r6")))]
pub c_ospeed: ::speed_t,
}
@@ -714,11 +718,6 @@ pub const SOCK_SEQPACKET: ::c_int = 5;
pub const SOCK_DCCP: ::c_int = 6;
pub const SOCK_PACKET: ::c_int = 10;
-pub const FAN_MARK_INODE: ::c_uint = 0x0000_0000;
-pub const FAN_MARK_MOUNT: ::c_uint = 0x0000_0010;
-// NOTE: FAN_MARK_FILESYSTEM requires Linux Kernel >= 4.20.0
-pub const FAN_MARK_FILESYSTEM: ::c_uint = 0x0000_0100;
-
pub const AF_IB: ::c_int = 27;
pub const AF_MPLS: ::c_int = 28;
pub const AF_NFC: ::c_int = 39;
@@ -853,6 +852,8 @@ pub const PTRACE_SEIZE: ::c_uint = 0x4206;
pub const PTRACE_INTERRUPT: ::c_uint = 0x4207;
pub const PTRACE_LISTEN: ::c_uint = 0x4208;
pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209;
+pub const PTRACE_GETSIGMASK: ::c_uint = 0x420a;
+pub const PTRACE_SETSIGMASK: ::c_uint = 0x420b;
pub const PTRACE_GET_SYSCALL_INFO: ::c_uint = 0x420e;
pub const PTRACE_SYSCALL_INFO_NONE: ::__u8 = 0;
pub const PTRACE_SYSCALL_INFO_ENTRY: ::__u8 = 1;
@@ -940,6 +941,11 @@ pub const NT_PRFPXREG: ::c_int = 20;
pub const ELFOSABI_ARM_AEABI: u8 = 64;
+// linux/sched.h
+pub const CLONE_NEWTIME: ::c_int = 0x80;
+pub const CLONE_CLEAR_SIGHAND: ::c_int = 0x100000000;
+pub const CLONE_INTO_CGROUP: ::c_int = 0x200000000;
+
// linux/keyctl.h
pub const KEYCTL_DH_COMPUTE: u32 = 23;
pub const KEYCTL_PKEY_QUERY: u32 = 24;
@@ -954,7 +960,10 @@ pub const KEYCTL_SUPPORTS_DECRYPT: u32 = 0x02;
pub const KEYCTL_SUPPORTS_SIGN: u32 = 0x04;
pub const KEYCTL_SUPPORTS_VERIFY: u32 = 0x08;
cfg_if! {
- if #[cfg(not(any(target_arch="mips", target_arch="mips64")))] {
+ if #[cfg(not(any(target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "mips64",
+ target_arch = "mips64r6")))] {
pub const KEYCTL_MOVE: u32 = 30;
pub const KEYCTL_CAPABILITIES: u32 = 31;
@@ -1017,7 +1026,17 @@ pub const STATX_ATTR_DAX: ::c_int = 0x00200000;
pub const SOMAXCONN: ::c_int = 4096;
-//sys/timex.h
+// linux/mount.h
+pub const MOVE_MOUNT_F_SYMLINKS: ::c_uint = 0x00000001;
+pub const MOVE_MOUNT_F_AUTOMOUNTS: ::c_uint = 0x00000002;
+pub const MOVE_MOUNT_F_EMPTY_PATH: ::c_uint = 0x00000004;
+pub const MOVE_MOUNT_T_SYMLINKS: ::c_uint = 0x00000010;
+pub const MOVE_MOUNT_T_AUTOMOUNTS: ::c_uint = 0x00000020;
+pub const MOVE_MOUNT_T_EMPTY_PATH: ::c_uint = 0x00000040;
+pub const MOVE_MOUNT_SET_GROUP: ::c_uint = 0x00000100;
+pub const MOVE_MOUNT_BENEATH: ::c_uint = 0x00000200;
+
+// sys/timex.h
pub const ADJ_OFFSET: ::c_uint = 0x0001;
pub const ADJ_FREQUENCY: ::c_uint = 0x0002;
pub const ADJ_MAXERROR: ::c_uint = 0x0004;
@@ -1076,6 +1095,18 @@ pub const TIME_ERROR: ::c_int = 5;
pub const TIME_BAD: ::c_int = TIME_ERROR;
pub const MAXTC: ::c_long = 6;
+// Portable GLOB_* flags are defined at the `linux_like` level.
+// The following are GNU extensions.
+pub const GLOB_PERIOD: ::c_int = 1 << 7;
+pub const GLOB_ALTDIRFUNC: ::c_int = 1 << 9;
+pub const GLOB_BRACE: ::c_int = 1 << 10;
+pub const GLOB_NOMAGIC: ::c_int = 1 << 11;
+pub const GLOB_TILDE: ::c_int = 1 << 12;
+pub const GLOB_ONLYDIR: ::c_int = 1 << 13;
+pub const GLOB_TILDE_CHECK: ::c_int = 1 << 14;
+
+pub const MADV_COLLAPSE: ::c_int = 25;
+
cfg_if! {
if #[cfg(any(
target_arch = "arm",
@@ -1372,13 +1403,26 @@ extern "C" {
buf: *mut ::c_char,
buflen: ::c_int,
) -> *mut ::mntent;
+
+ pub fn execveat(
+ dirfd: ::c_int,
+ pathname: *const ::c_char,
+ argv: *const *mut c_char,
+ envp: *const *mut c_char,
+ flags: ::c_int,
+ ) -> ::c_int;
+
+ // Added in `glibc` 2.34
+ pub fn close_range(first: ::c_uint, last: ::c_uint, flags: ::c_int) -> ::c_int;
}
cfg_if! {
if #[cfg(any(target_arch = "x86",
target_arch = "arm",
target_arch = "m68k",
+ target_arch = "csky",
target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "powerpc",
target_arch = "sparc",
target_arch = "riscv32"))] {
@@ -1388,6 +1432,7 @@ cfg_if! {
target_arch = "aarch64",
target_arch = "powerpc64",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "s390x",
target_arch = "sparc64",
target_arch = "riscv64",
diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs
index e52b3d3a..224300a6 100644
--- a/src/unix/linux_like/linux/mod.rs
+++ b/src/unix/linux_like/linux/mod.rs
@@ -14,6 +14,7 @@ pub type nl_item = ::c_int;
pub type idtype_t = ::c_uint;
pub type loff_t = ::c_longlong;
pub type pthread_key_t = ::c_uint;
+pub type pthread_once_t = ::c_int;
pub type pthread_spinlock_t = ::c_int;
pub type __u8 = ::c_uchar;
@@ -791,6 +792,23 @@ s_no_extra_traits! {
pub ifr_ifru: ::sockaddr,
}
+ #[cfg(libc_union)]
+ pub union __c_anonymous_ifc_ifcu {
+ pub ifcu_buf: *mut ::c_char,
+ pub ifcu_req: *mut ::ifreq,
+ }
+
+ /* Structure used in SIOCGIFCONF request. Used to retrieve interface
+ configuration for machine (useful for programs which must know all
+ networks accessible). */
+ pub struct ifconf {
+ pub ifc_len: ::c_int, /* Size of buffer. */
+ #[cfg(libc_union)]
+ pub ifc_ifcu: __c_anonymous_ifc_ifcu,
+ #[cfg(not(libc_union))]
+ pub ifc_ifcu: *mut ::ifreq,
+ }
+
pub struct hwtstamp_config {
pub flags: ::c_int,
pub tx_type: ::c_int,
@@ -1228,6 +1246,23 @@ cfg_if! {
}
}
+ #[cfg(libc_union)]
+ impl ::fmt::Debug for __c_anonymous_ifc_ifcu {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("ifr_ifru")
+ .field("ifcu_buf", unsafe { &self.ifcu_buf })
+ .field("ifcu_req", unsafe { &self.ifcu_req })
+ .finish()
+ }
+ }
+ impl ::fmt::Debug for ifconf {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("ifconf")
+ .field("ifc_len", &self.ifc_len)
+ .field("ifc_ifcu", &self.ifc_ifcu)
+ .finish()
+ }
+ }
impl ::fmt::Debug for hwtstamp_config {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("hwtstamp_config")
@@ -1829,6 +1864,8 @@ pub const IFLA_INFO_SLAVE_DATA: ::c_ushort = 5;
// linux/if_tun.h
pub const IFF_TUN: ::c_int = 0x0001;
pub const IFF_TAP: ::c_int = 0x0002;
+pub const IFF_NAPI: ::c_int = 0x0010;
+pub const IFF_NAPI_FRAGS: ::c_int = 0x0020;
pub const IFF_NO_PI: ::c_int = 0x1000;
// Read queue size
pub const TUN_READQ_SIZE: ::c_short = 500;
@@ -1846,6 +1883,18 @@ pub const IFF_DETACH_QUEUE: ::c_int = 0x0400;
// read-only flag
pub const IFF_PERSIST: ::c_int = 0x0800;
pub const IFF_NOFILTER: ::c_int = 0x1000;
+// Socket options
+pub const TUN_TX_TIMESTAMP: ::c_int = 1;
+// Features for GSO (TUNSETOFFLOAD)
+pub const TUN_F_CSUM: ::c_ushort = 0x01; /* You can hand me unchecksummed packets. */
+pub const TUN_F_TSO4: ::c_ushort = 0x02; /* I can handle TSO for IPv4 packets */
+pub const TUN_F_TSO6: ::c_ushort = 0x04; /* I can handle TSO for IPv6 packets */
+pub const TUN_F_TSO_ECN: ::c_ushort = 0x08; /* I can handle TSO with ECN bits. */
+pub const TUN_F_UFO: ::c_ushort = 0x10; /* I can handle UFO packets */
+// Protocol info prepended to the packets (when IFF_NO_PI is not set)
+pub const TUN_PKT_STRIP: ::c_int = 0x0001;
+// Accept all multicast packets
+pub const TUN_FLT_ALLMULTI: ::c_int = 0x0001;
// Since Linux 3.1
pub const SEEK_DATA: ::c_int = 3;
@@ -1903,6 +1952,7 @@ align_const! {
size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
};
}
+pub const PTHREAD_ONCE_INIT: pthread_once_t = 0;
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
@@ -2766,6 +2816,7 @@ pub const SIOCGIFMEM: ::c_ulong = 0x0000891F;
pub const SIOCSIFMEM: ::c_ulong = 0x00008920;
pub const SIOCGIFMTU: ::c_ulong = 0x00008921;
pub const SIOCSIFMTU: ::c_ulong = 0x00008922;
+pub const SIOCSIFNAME: ::c_ulong = 0x00008923;
pub const SIOCSIFHWADDR: ::c_ulong = 0x00008924;
pub const SIOCGIFENCAP: ::c_ulong = 0x00008925;
pub const SIOCSIFENCAP: ::c_ulong = 0x00008926;
@@ -3182,12 +3233,19 @@ pub const HWTSTAMP_FILTER_PTP_V2_SYNC: ::c_uint = 13;
pub const HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: ::c_uint = 14;
pub const HWTSTAMP_FILTER_NTP_ALL: ::c_uint = 15;
+// linux/tls.h
+pub const TLS_GET_RECORD_TYPE: ::c_int = 2;
+
+pub const SOL_TLS: ::c_int = 282;
+
// linux/if_alg.h
pub const ALG_SET_KEY: ::c_int = 1;
pub const ALG_SET_IV: ::c_int = 2;
pub const ALG_SET_OP: ::c_int = 3;
pub const ALG_SET_AEAD_ASSOCLEN: ::c_int = 4;
pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5;
+pub const ALG_SET_DRBG_ENTROPY: ::c_int = 6;
+pub const ALG_SET_KEY_BY_KEY_SERIAL: ::c_int = 7;
pub const ALG_OP_DECRYPT: ::c_int = 0;
pub const ALG_OP_ENCRYPT: ::c_int = 1;
@@ -3544,20 +3602,33 @@ pub const UINPUT_MAX_NAME_SIZE: usize = 80;
// uapi/linux/fanotify.h
pub const FAN_ACCESS: u64 = 0x0000_0001;
pub const FAN_MODIFY: u64 = 0x0000_0002;
+pub const FAN_ATTRIB: u64 = 0x0000_0004;
pub const FAN_CLOSE_WRITE: u64 = 0x0000_0008;
pub const FAN_CLOSE_NOWRITE: u64 = 0x0000_0010;
pub const FAN_OPEN: u64 = 0x0000_0020;
+pub const FAN_MOVED_FROM: u64 = 0x0000_0040;
+pub const FAN_MOVED_TO: u64 = 0x0000_0080;
+pub const FAN_CREATE: u64 = 0x0000_0100;
+pub const FAN_DELETE: u64 = 0x0000_0200;
+pub const FAN_DELETE_SELF: u64 = 0x0000_0400;
+pub const FAN_MOVE_SELF: u64 = 0x0000_0800;
+pub const FAN_OPEN_EXEC: u64 = 0x0000_1000;
pub const FAN_Q_OVERFLOW: u64 = 0x0000_4000;
+pub const FAN_FS_ERROR: u64 = 0x0000_8000;
pub const FAN_OPEN_PERM: u64 = 0x0001_0000;
pub const FAN_ACCESS_PERM: u64 = 0x0002_0000;
-
-pub const FAN_ONDIR: u64 = 0x4000_0000;
+pub const FAN_OPEN_EXEC_PERM: u64 = 0x0004_0000;
pub const FAN_EVENT_ON_CHILD: u64 = 0x0800_0000;
+pub const FAN_RENAME: u64 = 0x1000_0000;
+
+pub const FAN_ONDIR: u64 = 0x4000_0000;
+
pub const FAN_CLOSE: u64 = FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE;
+pub const FAN_MOVE: u64 = FAN_MOVED_FROM | FAN_MOVED_TO;
pub const FAN_CLOEXEC: ::c_uint = 0x0000_0001;
pub const FAN_NONBLOCK: ::c_uint = 0x0000_0002;
@@ -3568,6 +3639,18 @@ pub const FAN_CLASS_PRE_CONTENT: ::c_uint = 0x0000_0008;
pub const FAN_UNLIMITED_QUEUE: ::c_uint = 0x0000_0010;
pub const FAN_UNLIMITED_MARKS: ::c_uint = 0x0000_0020;
+pub const FAN_ENABLE_AUDIT: ::c_uint = 0x0000_0040;
+
+pub const FAN_REPORT_PIDFD: ::c_uint = 0x0000_0080;
+pub const FAN_REPORT_TID: ::c_uint = 0x0000_0100;
+pub const FAN_REPORT_FID: ::c_uint = 0x0000_0200;
+pub const FAN_REPORT_DIR_FID: ::c_uint = 0x0000_0400;
+pub const FAN_REPORT_NAME: ::c_uint = 0x0000_0800;
+pub const FAN_REPORT_TARGET_FID: ::c_uint = 0x0000_1000;
+
+pub const FAN_REPORT_DFID_NAME: ::c_uint = FAN_REPORT_DIR_FID | FAN_REPORT_NAME;
+pub const FAN_REPORT_DFID_NAME_TARGET: ::c_uint =
+ FAN_REPORT_DFID_NAME | FAN_REPORT_FID | FAN_REPORT_TARGET_FID;
pub const FAN_MARK_ADD: ::c_uint = 0x0000_0001;
pub const FAN_MARK_REMOVE: ::c_uint = 0x0000_0002;
@@ -3576,13 +3659,37 @@ pub const FAN_MARK_ONLYDIR: ::c_uint = 0x0000_0008;
pub const FAN_MARK_IGNORED_MASK: ::c_uint = 0x0000_0020;
pub const FAN_MARK_IGNORED_SURV_MODIFY: ::c_uint = 0x0000_0040;
pub const FAN_MARK_FLUSH: ::c_uint = 0x0000_0080;
+pub const FAN_MARK_EVICTABLE: ::c_uint = 0x0000_0200;
+pub const FAN_MARK_IGNORE: ::c_uint = 0x0000_0100;
+
+pub const FAN_MARK_INODE: ::c_uint = 0x0000_0000;
+pub const FAN_MARK_MOUNT: ::c_uint = 0x0000_0010;
+pub const FAN_MARK_FILESYSTEM: ::c_uint = 0x0000_0100;
+
+pub const FAN_MARK_IGNORE_SURV: ::c_uint = FAN_MARK_IGNORE | FAN_MARK_IGNORED_SURV_MODIFY;
pub const FANOTIFY_METADATA_VERSION: u8 = 3;
+pub const FAN_EVENT_INFO_TYPE_FID: u8 = 1;
+pub const FAN_EVENT_INFO_TYPE_DFID_NAME: u8 = 2;
+pub const FAN_EVENT_INFO_TYPE_DFID: u8 = 3;
+pub const FAN_EVENT_INFO_TYPE_PIDFD: u8 = 4;
+pub const FAN_EVENT_INFO_TYPE_ERROR: u8 = 5;
+
+pub const FAN_EVENT_INFO_TYPE_OLD_DFID_NAME: u8 = 10;
+pub const FAN_EVENT_INFO_TYPE_NEW_DFID_NAME: u8 = 12;
+
+pub const FAN_RESPONSE_INFO_NONE: u8 = 0;
+pub const FAN_RESPONSE_INFO_AUDIT_RULE: u8 = 1;
+
pub const FAN_ALLOW: u32 = 0x01;
pub const FAN_DENY: u32 = 0x02;
+pub const FAN_AUDIT: u32 = 0x10;
+pub const FAN_INFO: u32 = 0x20;
pub const FAN_NOFD: ::c_int = -1;
+pub const FAN_NOPIDFD: ::c_int = FAN_NOFD;
+pub const FAN_EPIDFD: ::c_int = -2;
pub const FUTEX_WAIT: ::c_int = 0;
pub const FUTEX_WAKE: ::c_int = 1;
@@ -4576,6 +4683,7 @@ extern "C" {
attr: *const ::pthread_attr_t,
guardsize: *mut ::size_t,
) -> ::c_int;
+ pub fn pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::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(
@@ -4764,7 +4872,7 @@ extern "C" {
newfd: ::c_int,
) -> ::c_int;
pub fn fread_unlocked(
- ptr: *mut ::c_void,
+ buf: *mut ::c_void,
size: ::size_t,
nobj: ::size_t,
stream: *mut ::FILE,
@@ -4842,6 +4950,8 @@ extern "C" {
longindex: *mut ::c_int,
) -> ::c_int;
+ pub fn pthread_once(control: *mut pthread_once_t, routine: extern "C" fn()) -> ::c_int;
+
pub fn copy_file_range(
fd_in: ::c_int,
off_in: *mut ::off64_t,
diff --git a/src/unix/linux_like/linux/musl/b32/arm/mod.rs b/src/unix/linux_like/linux/musl/b32/arm/mod.rs
index c47fa2c4..8225f26a 100644
--- a/src/unix/linux_like/linux/musl/b32/arm/mod.rs
+++ b/src/unix/linux_like/linux/musl/b32/arm/mod.rs
@@ -235,6 +235,7 @@ pub const O_LARGEFILE: ::c_int = 0o400000;
pub const MADV_SOFT_OFFLINE: ::c_int = 101;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const CBAUD: ::tcflag_t = 0o0010017;
pub const TAB1: ::c_int = 0x00000800;
pub const TAB2: ::c_int = 0x00001000;
@@ -311,8 +312,6 @@ 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;
@@ -326,7 +325,6 @@ pub const MAP_SYNC: ::c_int = 0x080000;
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
-pub const SOCK_SEQPACKET: ::c_int = 5;
pub const EDEADLK: ::c_int = 35;
pub const ENAMETOOLONG: ::c_int = 36;
@@ -451,9 +449,6 @@ 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 F_OFD_GETLK: ::c_int = 36;
-pub const F_OFD_SETLK: ::c_int = 37;
-pub const F_OFD_SETLKW: ::c_int = 38;
pub const VEOF: usize = 4;
pub const VEOL: usize = 11;
diff --git a/src/unix/linux_like/linux/musl/b32/hexagon.rs b/src/unix/linux_like/linux/musl/b32/hexagon.rs
index f83d208d..089c06f8 100644
--- a/src/unix/linux_like/linux/musl/b32/hexagon.rs
+++ b/src/unix/linux_like/linux/musl/b32/hexagon.rs
@@ -225,9 +225,6 @@ pub const F_GETOWN_EX: ::c_int = 16;
pub const F_GETSIG: ::c_int = 11;
pub const F_LINUX_SPECIFIC_BASE: ::c_int = 1024;
pub const FLUSHO: ::c_int = 4096;
-pub const F_OFD_GETLK: ::c_int = 36;
-pub const F_OFD_SETLK: ::c_int = 37;
-pub const F_OFD_SETLKW: ::c_int = 38;
pub const F_OWNER_PGRP: ::c_int = 2;
pub const F_OWNER_PID: ::c_int = 1;
pub const F_OWNER_TID: ::c_int = 0;
@@ -265,7 +262,6 @@ pub const PF_FILE: ::c_int = 1;
pub const PF_KCM: ::c_int = 41;
pub const PF_MAX: ::c_int = 43;
pub const PF_QIPCRTR: ::c_int = 42;
-#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const SA_ONSTACK: ::c_int = 0x08000000;
pub const SA_SIGINFO: ::c_int = 0x00000004;
pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
@@ -295,8 +291,6 @@ pub const SIG_SETMASK: ::c_int = 2; // FIXME check these
pub const SIG_BLOCK: ::c_int = 0x000000;
pub const SIG_UNBLOCK: ::c_int = 0x01;
pub const SOCK_DGRAM: ::c_int = 2;
-pub const SOCK_NONBLOCK: ::c_int = 2048;
-pub const SOCK_SEQPACKET: ::c_int = 5;
pub const SOCK_STREAM: ::c_int = 1;
pub const SOL_CAIF: ::c_int = 278;
pub const SOL_IUCV: ::c_int = 277;
diff --git a/src/unix/linux_like/linux/musl/b32/mips/mod.rs b/src/unix/linux_like/linux/musl/b32/mips/mod.rs
index d09b8278..2fb405bb 100644
--- a/src/unix/linux_like/linux/musl/b32/mips/mod.rs
+++ b/src/unix/linux_like/linux/musl/b32/mips/mod.rs
@@ -174,6 +174,7 @@ pub const O_LARGEFILE: ::c_int = 0x2000;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const CBAUD: ::tcflag_t = 0o0010017;
pub const TAB1: ::c_int = 0x00000800;
pub const TAB2: ::c_int = 0x00001000;
@@ -250,8 +251,6 @@ pub const O_SYNC: ::c_int = 0o40020;
pub const O_RSYNC: ::c_int = 0o40020;
pub const O_DSYNC: ::c_int = 0o020;
-pub const SOCK_NONBLOCK: ::c_int = 0o200;
-
pub const MAP_ANON: ::c_int = 0x800;
pub const MAP_GROWSDOWN: ::c_int = 0x1000;
pub const MAP_DENYWRITE: ::c_int = 0x2000;
@@ -351,7 +350,6 @@ pub const ERFKILL: ::c_int = 167;
pub const SOCK_STREAM: ::c_int = 2;
pub const SOCK_DGRAM: ::c_int = 1;
-pub const SOCK_SEQPACKET: ::c_int = 5;
pub const SA_ONSTACK: ::c_int = 0x08000000;
pub const SA_SIGINFO: ::c_int = 8;
@@ -388,9 +386,6 @@ pub const F_GETOWN: ::c_int = 23;
pub const F_SETLK: ::c_int = 34;
pub const F_SETLKW: ::c_int = 35;
pub const F_SETOWN: ::c_int = 24;
-pub const F_OFD_GETLK: ::c_int = 36;
-pub const F_OFD_SETLK: ::c_int = 37;
-pub const F_OFD_SETLKW: ::c_int = 38;
pub const VEOF: usize = 16;
pub const VEOL: usize = 17;
diff --git a/src/unix/linux_like/linux/musl/b32/powerpc.rs b/src/unix/linux_like/linux/musl/b32/powerpc.rs
index b1669ade..bdf25455 100644
--- a/src/unix/linux_like/linux/musl/b32/powerpc.rs
+++ b/src/unix/linux_like/linux/musl/b32/powerpc.rs
@@ -167,6 +167,7 @@ pub const O_LARGEFILE: ::c_int = 0x10000;
pub const MCL_CURRENT: ::c_int = 0x2000;
pub const MCL_FUTURE: ::c_int = 0x4000;
+pub const MCL_ONFAULT: ::c_int = 0x8000;
pub const CBAUD: ::tcflag_t = 0o0000377;
pub const TAB1: ::c_int = 0x00000400;
pub const TAB2: ::c_int = 0x00000800;
@@ -243,8 +244,6 @@ 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;
@@ -262,7 +261,6 @@ pub const PTRACE_SYSEMU_SINGLESTEP: ::c_int = 0x1e;
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
-pub const SOCK_SEQPACKET: ::c_int = 5;
pub const EDEADLK: ::c_int = 35;
pub const ENAMETOOLONG: ::c_int = 36;
@@ -380,16 +378,11 @@ pub const SIG_UNBLOCK: ::c_int = 0x01;
pub const EXTPROC: ::tcflag_t = 0x10000000;
-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 F_OFD_GETLK: ::c_int = 36;
-pub const F_OFD_SETLK: ::c_int = 37;
-pub const F_OFD_SETLKW: ::c_int = 38;
pub const VEOF: usize = 4;
pub const VEOL: usize = 6;
diff --git a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs
index bf7a4f59..f963f645 100644
--- a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs
+++ b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs
@@ -323,9 +323,11 @@ pub const POLLWRBAND: ::c_short = 512;
pub const O_ASYNC: ::c_int = 8192;
pub const O_NDELAY: ::c_int = 2048;
pub const EFD_NONBLOCK: ::c_int = 2048;
-pub const F_GETLK: ::c_int = 5;
-pub const F_GETOWN: ::c_int = 9;
pub const F_SETOWN: ::c_int = 8;
+pub const F_GETOWN: ::c_int = 9;
+pub const F_GETLK: ::c_int = 12;
+pub const F_SETLK: ::c_int = 13;
+pub const F_SETLKW: ::c_int = 14;
pub const SFD_NONBLOCK: ::c_int = 2048;
pub const TCSANOW: ::c_int = 0;
pub const TCSADRAIN: ::c_int = 1;
@@ -353,6 +355,7 @@ pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_BARRIERATTR_T: usize = 4;
pub const O_DIRECT: ::c_int = 16384;
pub const O_DIRECTORY: ::c_int = 65536;
+pub const O_LARGEFILE: ::c_int = 0o0100000;
pub const O_NOFOLLOW: ::c_int = 131072;
pub const MAP_HUGETLB: ::c_int = 262144;
pub const MAP_LOCKED: ::c_int = 8192;
@@ -376,6 +379,7 @@ pub const FIONCLEX: ::c_int = 21584;
pub const FIONBIO: ::c_int = 21537;
pub const MCL_CURRENT: ::c_int = 1;
pub const MCL_FUTURE: ::c_int = 2;
+pub const MCL_ONFAULT: ::c_int = 4;
pub const SIGSTKSZ: ::size_t = 8192;
pub const MINSIGSTKSZ: ::size_t = 2048;
pub const CBAUD: ::tcflag_t = 4111;
diff --git a/src/unix/linux_like/linux/musl/b32/x86/mod.rs b/src/unix/linux_like/linux/musl/b32/x86/mod.rs
index aaca917f..944d6e78 100644
--- a/src/unix/linux_like/linux/musl/b32/x86/mod.rs
+++ b/src/unix/linux_like/linux/musl/b32/x86/mod.rs
@@ -224,6 +224,7 @@ pub const O_LARGEFILE: ::c_int = 0o0100000;
pub const MADV_SOFT_OFFLINE: ::c_int = 101;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const CBAUD: ::tcflag_t = 0o0010017;
pub const TAB1: ::c_int = 0x00000800;
pub const TAB2: ::c_int = 0x00001000;
@@ -300,8 +301,6 @@ 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;
@@ -315,7 +314,6 @@ pub const MAP_SYNC: ::c_int = 0x080000;
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
-pub const SOCK_SEQPACKET: ::c_int = 5;
pub const EDEADLK: ::c_int = 35;
pub const ENAMETOOLONG: ::c_int = 36;
@@ -441,9 +439,6 @@ 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 F_OFD_GETLK: ::c_int = 36;
-pub const F_OFD_SETLK: ::c_int = 37;
-pub const F_OFD_SETLKW: ::c_int = 38;
pub const VEOF: usize = 4;
pub const VEOL: usize = 11;
diff --git a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs
index 14b4bc6d..54e072b3 100644
--- a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs
+++ b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs
@@ -250,9 +250,6 @@ pub const F_GETOWN: ::c_int = 9;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
pub const F_SETOWN: ::c_int = 8;
-pub const F_OFD_GETLK: ::c_int = 36;
-pub const F_OFD_SETLK: ::c_int = 37;
-pub const F_OFD_SETLKW: ::c_int = 38;
pub const VEOF: usize = 4;
@@ -567,6 +564,7 @@ pub const SYS_set_mempolicy_home_node: ::c_long = 450;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const CBAUD: ::tcflag_t = 0o0010017;
pub const TAB1: ::c_int = 0x00000800;
pub const TAB2: ::c_int = 0x00001000;
diff --git a/src/unix/linux_like/linux/musl/b64/mips64.rs b/src/unix/linux_like/linux/musl/b64/mips64.rs
index 22ac9169..18fa6c66 100644
--- a/src/unix/linux_like/linux/musl/b64/mips64.rs
+++ b/src/unix/linux_like/linux/musl/b64/mips64.rs
@@ -612,12 +612,10 @@ pub const F_GETOWN: ::c_int = 23;
pub const F_SETOWN: ::c_int = 24;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
-pub const F_OFD_GETLK: ::c_int = 36;
-pub const F_OFD_SETLK: ::c_int = 37;
-pub const F_OFD_SETLKW: ::c_int = 38;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const CBAUD: ::tcflag_t = 0o0010017;
pub const TAB1: ::tcflag_t = 0x00000800;
diff --git a/src/unix/linux_like/linux/musl/b64/mod.rs b/src/unix/linux_like/linux/musl/b64/mod.rs
index f437355d..05586cdb 100644
--- a/src/unix/linux_like/linux/musl/b64/mod.rs
+++ b/src/unix/linux_like/linux/musl/b64/mod.rs
@@ -134,10 +134,6 @@ pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 32;
-pub const SOCK_NONBLOCK: ::c_int = 2048;
-
-pub const SOCK_SEQPACKET: ::c_int = 5;
-
extern "C" {
pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
}
diff --git a/src/unix/linux_like/linux/musl/b64/powerpc64.rs b/src/unix/linux_like/linux/musl/b64/powerpc64.rs
index c9bd9413..202abe87 100644
--- a/src/unix/linux_like/linux/musl/b64/powerpc64.rs
+++ b/src/unix/linux_like/linux/musl/b64/powerpc64.rs
@@ -212,9 +212,6 @@ pub const F_GETOWN: ::c_int = 9;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
pub const F_SETOWN: ::c_int = 8;
-pub const F_OFD_GETLK: ::c_int = 36;
-pub const F_OFD_SETLK: ::c_int = 37;
-pub const F_OFD_SETLKW: ::c_int = 38;
pub const VEOF: usize = 4;
@@ -626,6 +623,7 @@ pub const FLUSHO: ::tcflag_t = 0x00800000;
pub const MCL_CURRENT: ::c_int = 0x2000;
pub const MCL_FUTURE: ::c_int = 0x4000;
+pub const MCL_ONFAULT: ::c_int = 0x8000;
pub const CBAUD: ::tcflag_t = 0xff;
pub const TAB1: ::c_int = 0x400;
pub const TAB2: ::c_int = 0x800;
diff --git a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs
index 9e9dbf6c..393f54d3 100644
--- a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs
+++ b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs
@@ -469,6 +469,9 @@ pub const SYS_faccessat2: ::c_long = 439;
pub const SYS_process_madvise: ::c_long = 440;
pub const SYS_epoll_pwait2: ::c_long = 441;
pub const SYS_mount_setattr: ::c_long = 442;
+pub const SYS_landlock_create_ruleset: ::c_long = 444;
+pub const SYS_landlock_add_rule: ::c_long = 445;
+pub const SYS_landlock_restrict_self: ::c_long = 446;
pub const O_APPEND: ::c_int = 1024;
pub const O_DIRECT: ::c_int = 0x4000;
@@ -604,9 +607,6 @@ pub const F_GETOWN: ::c_int = 9;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
pub const F_SETOWN: ::c_int = 8;
-pub const F_OFD_GETLK: ::c_int = 36;
-pub const F_OFD_SETLK: ::c_int = 37;
-pub const F_OFD_SETLKW: ::c_int = 38;
pub const VEOF: usize = 4;
@@ -630,6 +630,7 @@ pub const MAP_SYNC: ::c_int = 0x080000;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const CBAUD: ::tcflag_t = 0o0010017;
pub const TAB1: ::c_int = 0x00000800;
pub const TAB2: ::c_int = 0x00001000;
diff --git a/src/unix/linux_like/linux/musl/b64/s390x.rs b/src/unix/linux_like/linux/musl/b64/s390x.rs
index f338dcc5..aa4cbf87 100644
--- a/src/unix/linux_like/linux/musl/b64/s390x.rs
+++ b/src/unix/linux_like/linux/musl/b64/s390x.rs
@@ -290,15 +290,13 @@ pub const EXTPROC: ::tcflag_t = 0x00010000;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const F_GETLK: ::c_int = 5;
pub const F_GETOWN: ::c_int = 9;
pub const F_SETOWN: ::c_int = 8;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
-pub const F_OFD_GETLK: ::c_int = 36;
-pub const F_OFD_SETLK: ::c_int = 37;
-pub const F_OFD_SETLKW: ::c_int = 38;
pub const VTIME: usize = 5;
pub const VSWTC: usize = 7;
diff --git a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs
index 9decf91b..4d178680 100644
--- a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs
+++ b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs
@@ -805,9 +805,6 @@ pub const F_GETOWN: ::c_int = 9;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
pub const F_SETOWN: ::c_int = 8;
-pub const F_OFD_GETLK: ::c_int = 36;
-pub const F_OFD_SETLK: ::c_int = 37;
-pub const F_OFD_SETLKW: ::c_int = 38;
pub const VEOF: usize = 4;
@@ -831,6 +828,7 @@ pub const MAP_SYNC: ::c_int = 0x080000;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const CBAUD: ::tcflag_t = 0o0010017;
pub const TAB1: ::c_int = 0x00000800;
pub const TAB2: ::c_int = 0x00001000;
diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs
index 5f742a5f..e70d0dad 100644
--- a/src/unix/linux_like/linux/musl/mod.rs
+++ b/src/unix/linux_like/linux/musl/mod.rs
@@ -512,6 +512,10 @@ pub const ECOMM: ::c_int = 70;
pub const EPROTO: ::c_int = 71;
pub const EDOTDOT: ::c_int = 73;
+pub const F_OFD_GETLK: ::c_int = 36;
+pub const F_OFD_SETLK: ::c_int = 37;
+pub const F_OFD_SETLKW: ::c_int = 38;
+
pub const F_RDLCK: ::c_int = 0;
pub const F_WRLCK: ::c_int = 1;
pub const F_UNLCK: ::c_int = 2;
@@ -541,7 +545,9 @@ pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
+pub const SOCK_SEQPACKET: ::c_int = 5;
pub const SOCK_DCCP: ::c_int = 6;
+pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK;
pub const SOCK_PACKET: ::c_int = 10;
pub const SOMAXCONN: ::c_int = 128;
@@ -585,11 +591,8 @@ 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 FAN_MARK_INODE: ::c_uint = 0x0000_0000;
-pub const FAN_MARK_MOUNT: ::c_uint = 0x0000_0010;
-// NOTE: FAN_MARK_FILESYSTEM requires Linux Kernel >= 4.20.0
-pub const FAN_MARK_FILESYSTEM: ::c_uint = 0x0000_0100;
+pub const PTRACE_GETSIGMASK: ::c_uint = 0x420a;
+pub const PTRACE_SETSIGMASK: ::c_uint = 0x420b;
pub const AF_IB: ::c_int = 27;
pub const AF_MPLS: ::c_int = 28;
diff --git a/src/unix/linux_like/linux/no_align.rs b/src/unix/linux_like/linux/no_align.rs
index 6f5f2f7c..328a5cc4 100644
--- a/src/unix/linux_like/linux/no_align.rs
+++ b/src/unix/linux_like/linux/no_align.rs
@@ -5,6 +5,7 @@ macro_rules! expand_align {
#[cfg(any(target_arch = "x86_64",
target_arch = "powerpc64",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "s390x",
target_arch = "sparc64",
target_arch = "riscv64",
@@ -16,6 +17,7 @@ macro_rules! expand_align {
#[cfg(not(any(target_arch = "x86_64",
target_arch = "powerpc64",
target_arch = "mips64",
+ target_arch = "mips64r6",
target_arch = "s390x",
target_arch = "sparc64",
target_arch = "riscv64",
@@ -68,16 +70,20 @@ macro_rules! expand_align {
pub struct pthread_mutex_t {
#[cfg(any(target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "arm",
target_arch = "m68k",
+ target_arch = "csky",
target_arch = "powerpc",
target_arch = "sparc",
all(target_arch = "x86_64",
target_pointer_width = "32")))]
__align: [::c_long; 0],
#[cfg(not(any(target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "arm",
target_arch = "m68k",
+ target_arch = "csky",
target_arch = "powerpc",
target_arch = "sparc",
all(target_arch = "x86_64",
@@ -88,16 +94,20 @@ macro_rules! expand_align {
pub struct pthread_rwlock_t {
#[cfg(any(target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "arm",
target_arch = "m68k",
+ target_arch = "csky",
target_arch = "powerpc",
target_arch = "sparc",
all(target_arch = "x86_64",
target_pointer_width = "32")))]
__align: [::c_long; 0],
#[cfg(not(any(target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "arm",
target_arch = "m68k",
+ target_arch = "csky",
target_arch = "powerpc",
target_arch = "sparc",
all(target_arch = "x86_64",
@@ -108,16 +118,20 @@ macro_rules! expand_align {
pub struct pthread_barrier_t {
#[cfg(any(target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "arm",
target_arch = "m68k",
+ target_arch = "csky",
target_arch = "powerpc",
target_arch = "sparc",
all(target_arch = "x86_64",
target_pointer_width = "32")))]
__align: [::c_long; 0],
#[cfg(not(any(target_arch = "mips",
+ target_arch = "mips32r6",
target_arch = "arm",
target_arch = "m68k",
+ target_arch = "csky",
target_arch = "powerpc",
target_arch = "sparc",
all(target_arch = "x86_64",
diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs
index 4a01e0cd..4afb98e9 100644
--- a/src/unix/linux_like/linux/uclibc/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/mod.rs
@@ -109,6 +109,7 @@ impl siginfo_t {
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
+pub const MCL_ONFAULT: ::c_int = 0x0004;
pub const SIGEV_THREAD_ID: ::c_int = 4;
@@ -245,9 +246,6 @@ pub const EDEADLOCK: ::c_int = EDEADLK;
pub const EXTA: ::c_uint = B19200;
pub const EXTB: ::c_uint = B38400;
pub const EXTPROC: ::tcflag_t = 0200000;
-pub const FAN_MARK_FILESYSTEM: ::c_int = 0x00000100;
-pub const FAN_MARK_INODE: ::c_int = 0x00000000;
-pub const FAN_MARK_MOUNT: ::c_int = 0x10;
pub const FOPEN_MAX: ::c_int = 16;
pub const F_GETOWN: ::c_int = 9;
pub const F_OFD_GETLK: ::c_int = 36;
@@ -282,7 +280,9 @@ pub const PF_NFC: ::c_int = 39;
pub const PF_VSOCK: ::c_int = 40;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const PTRACE_EVENT_STOP: ::c_int = 128;
+pub const PTRACE_GETSIGMASK: ::c_uint = 0x420a;
pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
+pub const PTRACE_SETSIGMASK: ::c_uint = 0x420b;
pub const RTLD_NOLOAD: ::c_int = 0x00004;
pub const RUSAGE_THREAD: ::c_int = 1;
pub const SHM_EXEC: ::c_int = 0100000;
diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs
index 764f3ae7..26fd68de 100644
--- a/src/unix/linux_like/mod.rs
+++ b/src/unix/linux_like/mod.rs
@@ -918,6 +918,8 @@ pub const IPPROTO_BEETPH: ::c_int = 94;
pub const IPPROTO_MPLS: ::c_int = 137;
/// Multipath TCP
pub const IPPROTO_MPTCP: ::c_int = 262;
+/// Ethernet-within-IPv6 encapsulation.
+pub const IPPROTO_ETHERNET: ::c_int = 143;
pub const MCAST_EXCLUDE: ::c_int = 0;
pub const MCAST_INCLUDE: ::c_int = 1;
@@ -1781,10 +1783,10 @@ extern "C" {
// LFS64 extensions
//
-// * musl has 64-bit versions only so aliases the LFS64 symbols to the standard ones
+// * musl and Emscripten has 64-bit versions only so aliases the LFS64 symbols to the standard ones
// * ulibc doesn't have preadv64/pwritev64
cfg_if! {
- if #[cfg(not(target_env = "musl"))] {
+ if #[cfg(not(any(target_env = "musl", target_os = "emscripten")))] {
extern "C" {
pub fn fstatfs64(fd: ::c_int, buf: *mut statfs64) -> ::c_int;
pub fn statvfs64(path: *const ::c_char, buf: *mut statvfs64) -> ::c_int;
@@ -1842,7 +1844,7 @@ cfg_if! {
}
cfg_if! {
- if #[cfg(not(any(target_env = "uclibc", target_env = "musl")))] {
+ if #[cfg(not(any(target_env = "uclibc", target_env = "musl", target_os = "emscripten")))] {
extern "C" {
pub fn preadv64(
fd: ::c_int,
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index 762470a7..9daebcaa 100644
--- a/src/unix/mod.rs
+++ b/src/unix/mod.rs
@@ -388,11 +388,6 @@ cfg_if! {
#[link(name = "c")]
#[link(name = "m")]
extern {}
- } else if #[cfg(target_os = "hermit")] {
- // no_default_libraries is set to false for HermitCore, so only a link
- // to "pthread" needs to be added.
- #[link(name = "pthread")]
- extern {}
} else if #[cfg(target_env = "illumos")] {
#[link(name = "c")]
#[link(name = "m")]
@@ -1081,6 +1076,10 @@ extern "C" {
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;
+ pub fn pthread_attr_getstacksize(
+ attr: *const ::pthread_attr_t,
+ stacksize: *mut ::size_t,
+ ) -> ::c_int;
pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t, stack_size: ::size_t) -> ::c_int;
pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, state: ::c_int) -> ::c_int;
pub fn pthread_detach(thread: ::pthread_t) -> ::c_int;
@@ -1413,6 +1412,7 @@ extern "C" {
pub fn lockf(fd: ::c_int, cmd: ::c_int, len: ::off_t) -> ::c_int;
}
+
cfg_if! {
if #[cfg(not(any(target_os = "emscripten",
target_os = "android",
@@ -1499,6 +1499,11 @@ cfg_if! {
timeout: *mut timespec,
sigmask: *const sigset_t,
) -> ::c_int;
+ pub fn sigaction(
+ signum: ::c_int,
+ act: *const sigaction,
+ oldact: *mut sigaction
+ ) -> ::c_int;
}
} else {
extern {
@@ -1577,9 +1582,6 @@ cfg_if! {
} else if #[cfg(target_os = "haiku")] {
mod haiku;
pub use self::haiku::*;
- } else if #[cfg(target_os = "hermit")] {
- mod hermit;
- pub use self::hermit::*;
} else if #[cfg(target_os = "redox")] {
mod redox;
pub use self::redox::*;
@@ -1589,6 +1591,9 @@ cfg_if! {
} else if #[cfg(target_os = "aix")] {
mod aix;
pub use self::aix::*;
+ } else if #[cfg(target_os = "hurd")] {
+ mod hurd;
+ pub use self::hurd::*;
} else {
// Unknown target_os
}
diff --git a/src/unix/newlib/aarch64/mod.rs b/src/unix/newlib/aarch64/mod.rs
index d686b369..2b4713c9 100644
--- a/src/unix/newlib/aarch64/mod.rs
+++ b/src/unix/newlib/aarch64/mod.rs
@@ -51,4 +51,4 @@ pub const MSG_WAITALL: ::c_int = 0;
pub const MSG_MORE: ::c_int = 0;
pub const MSG_NOSIGNAL: ::c_int = 0;
-pub use crate::unix::newlib::generic::{sigset_t, stat};
+pub use crate::unix::newlib::generic::{dirent, sigset_t, stat};
diff --git a/src/unix/newlib/arm/mod.rs b/src/unix/newlib/arm/mod.rs
index f644349c..23b75977 100644
--- a/src/unix/newlib/arm/mod.rs
+++ b/src/unix/newlib/arm/mod.rs
@@ -53,4 +53,4 @@ pub const MSG_WAITALL: ::c_int = 0;
pub const MSG_MORE: ::c_int = 0;
pub const MSG_NOSIGNAL: ::c_int = 0;
-pub use crate::unix::newlib::generic::{sigset_t, stat};
+pub use crate::unix::newlib::generic::{dirent, sigset_t, stat};
diff --git a/src/unix/newlib/espidf/mod.rs b/src/unix/newlib/espidf/mod.rs
index 804cd664..409d7ad9 100644
--- a/src/unix/newlib/espidf/mod.rs
+++ b/src/unix/newlib/espidf/mod.rs
@@ -107,4 +107,4 @@ extern "C" {
pub fn eventfd(initval: ::c_uint, flags: ::c_int) -> ::c_int;
}
-pub use crate::unix::newlib::generic::{sigset_t, stat};
+pub use crate::unix::newlib::generic::{dirent, sigset_t, stat};
diff --git a/src/unix/newlib/generic.rs b/src/unix/newlib/generic.rs
index db7797f1..e45413a7 100644
--- a/src/unix/newlib/generic.rs
+++ b/src/unix/newlib/generic.rs
@@ -24,4 +24,10 @@ s! {
pub st_blocks: ::blkcnt_t,
pub st_spare4: [::c_long; 2usize],
}
+
+ pub struct dirent {
+ pub d_ino: ::ino_t,
+ pub d_type: ::c_uchar,
+ pub d_name: [::c_char; 256usize],
+ }
}
diff --git a/src/unix/newlib/horizon/mod.rs b/src/unix/newlib/horizon/mod.rs
index bcb93ad9..9c70f7b0 100644
--- a/src/unix/newlib/horizon/mod.rs
+++ b/src/unix/newlib/horizon/mod.rs
@@ -266,3 +266,5 @@ extern "C" {
pub fn gethostid() -> ::c_long;
}
+
+pub use crate::unix::newlib::generic::dirent;
diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs
index ce84f142..a572cc38 100644
--- a/src/unix/newlib/mod.rs
+++ b/src/unix/newlib/mod.rs
@@ -1,13 +1,7 @@
pub type blkcnt_t = i32;
pub type blksize_t = i32;
-cfg_if! {
- if #[cfg(target_os = "vita")] {
- pub type clockid_t = ::c_uint;
- } else {
- pub type clockid_t = ::c_ulong;
- }
-}
+pub type clockid_t = ::c_ulong;
cfg_if! {
if #[cfg(any(target_os = "espidf"))] {
@@ -170,16 +164,6 @@ s! {
pub sa_flags: ::c_int,
}
- pub struct dirent {
- #[cfg(not(target_os = "vita"))]
- pub d_ino: ino_t,
- #[cfg(not(target_os = "vita"))]
- pub d_type: ::c_uchar,
- #[cfg(target_os = "vita")]
- __offset: [u8; 88],
- pub d_name: [::c_char; 256usize],
- }
-
pub struct stack_t {
pub ss_sp: *mut ::c_void,
pub ss_flags: ::c_int,
@@ -546,8 +530,16 @@ pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection
pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
-pub const TCP_NODELAY: ::c_int = 8193;
-pub const TCP_MAXSEG: ::c_int = 8194;
+cfg_if! {
+ if #[cfg(target_os = "vita")] {
+ pub const TCP_NODELAY: ::c_int = 1;
+ pub const TCP_MAXSEG: ::c_int = 2;
+ } else {
+ pub const TCP_NODELAY: ::c_int = 8193;
+ pub const TCP_MAXSEG: ::c_int = 8194;
+ }
+}
+
pub const TCP_NOPUSH: ::c_int = 4;
pub const TCP_NOOPT: ::c_int = 8;
pub const TCP_KEEPIDLE: ::c_int = 256;
@@ -561,13 +553,25 @@ cfg_if! {
pub const IP_TOS: ::c_int = 3;
}
}
-pub const IP_TTL: ::c_int = 8;
+cfg_if! {
+ if #[cfg(target_os = "vita")] {
+ pub const IP_TTL: ::c_int = 4;
+ } else {
+ pub const IP_TTL: ::c_int = 8;
+ }
+}
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 IP_ADD_MEMBERSHIP: ::c_int = 11;
-pub const IP_DROP_MEMBERSHIP: ::c_int = 12;
-
+cfg_if! {
+ if #[cfg(target_os = "vita")] {
+ pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
+ pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
+ } else {
+ pub const IP_ADD_MEMBERSHIP: ::c_int = 11;
+ pub const IP_DROP_MEMBERSHIP: ::c_int = 12;
+ }
+}
pub const IPV6_UNICAST_HOPS: ::c_int = 4;
pub const IPV6_MULTICAST_IF: ::c_int = 9;
pub const IPV6_MULTICAST_HOPS: ::c_int = 10;
@@ -598,10 +602,15 @@ 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;
+cfg_if! {
+ // Defined in vita/mod.rs for "vita"
+ if #[cfg(not(target_os = "vita"))] {
+ 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;
+ }
+}
pub const EXIT_SUCCESS: ::c_int = 0;
pub const EXIT_FAILURE: ::c_int = 1;
diff --git a/src/unix/newlib/powerpc/mod.rs b/src/unix/newlib/powerpc/mod.rs
index 6bed1ce2..10faadbd 100644
--- a/src/unix/newlib/powerpc/mod.rs
+++ b/src/unix/newlib/powerpc/mod.rs
@@ -5,7 +5,7 @@ pub type wchar_t = ::c_int;
pub type c_long = i32;
pub type c_ulong = u32;
-pub use crate::unix::newlib::generic::{sigset_t, stat};
+pub use crate::unix::newlib::generic::{dirent, sigset_t, stat};
// the newlib shipped with devkitPPC does not support the following components:
// - sockaddr
diff --git a/src/unix/newlib/vita/mod.rs b/src/unix/newlib/vita/mod.rs
index 6e2e4d3e..e80f061e 100644
--- a/src/unix/newlib/vita/mod.rs
+++ b/src/unix/newlib/vita/mod.rs
@@ -9,6 +9,16 @@ pub type c_ulong = u32;
pub type sigset_t = ::c_ulong;
s! {
+ 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 sockaddr {
pub sa_len: u8,
pub sa_family: ::sa_family_t,
@@ -35,6 +45,7 @@ s! {
}
pub struct sockaddr_un {
+ pub ss_len: u8,
pub sun_family: ::sa_family_t,
pub sun_path: [::c_char; 108usize],
}
@@ -42,9 +53,9 @@ s! {
pub struct sockaddr_storage {
pub ss_len: u8,
pub ss_family: ::sa_family_t,
- pub __ss_pad1: [u8; 4],
+ pub __ss_pad1: [u8; 2],
pub __ss_align: i64,
- pub __ss_pad2: [u8; 4],
+ pub __ss_pad2: [u8; 116],
}
pub struct sched_param {
@@ -67,16 +78,31 @@ s! {
pub st_blocks: ::blkcnt_t,
pub st_spare4: [::c_long; 2usize],
}
+
+ #[repr(align(8))]
+ pub struct dirent {
+ __offset: [u8; 88],
+ pub d_name: [::c_char; 256usize],
+ __pad: [u8; 8],
+ }
}
pub const AF_UNIX: ::c_int = 1;
pub const AF_INET6: ::c_int = 24;
+pub const SOCK_RAW: ::c_int = 3;
+pub const SOCK_RDM: ::c_int = 4;
+pub const SOCK_SEQPACKET: ::c_int = 5;
+
pub const FIONBIO: ::c_ulong = 1;
pub const POLLIN: ::c_short = 0x0001;
pub const POLLPRI: ::c_short = POLLIN;
pub const POLLOUT: ::c_short = 0x0004;
+pub const POLLRDNORM: ::c_short = POLLIN;
+pub const POLLRDBAND: ::c_short = POLLIN;
+pub const POLLWRNORM: ::c_short = POLLOUT;
+pub const POLLWRBAND: ::c_short = POLLOUT;
pub const POLLERR: ::c_short = 0x0008;
pub const POLLHUP: ::c_short = 0x0010;
pub const POLLNVAL: ::c_short = 0x0020;
@@ -141,11 +167,16 @@ pub const _SC_PAGESIZE: ::c_int = 8;
pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 51;
pub const PTHREAD_STACK_MIN: ::size_t = 32 * 1024;
+pub const IP_HDRINCL: ::c_int = 2;
+
extern "C" {
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::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(s: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t;
+ pub fn recvmsg(s: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t;
+
pub fn pthread_create(
native: *mut ::pthread_t,
attr: *const ::pthread_attr_t,
@@ -198,4 +229,6 @@ extern "C" {
pub fn pthread_getprocessorid_np() -> ::c_int;
pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
+
+ pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
}
diff --git a/src/unix/nto/mod.rs b/src/unix/nto/mod.rs
index 5d13568e..91e531ff 100644
--- a/src/unix/nto/mod.rs
+++ b/src/unix/nto/mod.rs
@@ -80,6 +80,33 @@ impl ::Clone for timezone {
}
s! {
+ pub struct dirent_extra {
+ pub d_datalen: u16,
+ pub d_type: u16,
+ pub d_reserved: u32,
+ }
+
+ pub struct stat {
+ pub st_ino: ::ino_t,
+ pub st_size: ::off_t,
+ pub st_dev: ::dev_t,
+ pub st_rdev: ::dev_t,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ pub __old_st_mtime: ::_Time32t,
+ pub __old_st_atime: ::_Time32t,
+ pub __old_st_ctime: ::_Time32t,
+ pub st_mode: ::mode_t,
+ pub st_nlink: ::nlink_t,
+ pub st_blocksize: ::blksize_t,
+ pub st_nblocks: i32,
+ pub st_blksize: ::blksize_t,
+ pub st_blocks: ::blkcnt_t,
+ pub st_mtim: ::timespec,
+ pub st_atim: ::timespec,
+ pub st_ctim: ::timespec,
+ }
+
pub struct ip_mreq {
pub imr_multiaddr: in_addr,
pub imr_interface: in_addr,
@@ -641,7 +668,9 @@ s_no_extra_traits! {
pub struct sigevent {
pub sigev_notify: ::c_int,
- __sigev_un1: usize, // union
+ pub __padding1: ::c_int,
+ pub sigev_signo: ::c_int, // union
+ pub __padding2: ::c_int,
pub sigev_value: ::sigval,
__sigev_un2: usize, // union
@@ -654,33 +683,6 @@ s_no_extra_traits! {
pub d_name: [::c_char; 1], // flex array
}
- pub struct dirent_extra {
- pub d_datalen: u16,
- pub d_type: u16,
- pub d_reserved: u32,
- }
-
- pub struct stat {
- pub st_ino: ::ino_t,
- pub st_size: ::off_t,
- pub st_dev: ::dev_t,
- pub st_rdev: ::dev_t,
- pub st_uid: ::uid_t,
- pub st_gid: ::gid_t,
- pub __old_st_mtime: ::_Time32t,
- pub __old_st_atime: ::_Time32t,
- pub __old_st_ctime: ::_Time32t,
- pub st_mode: ::mode_t,
- pub st_nlink: ::nlink_t,
- pub st_blocksize: ::blksize_t,
- pub st_nblocks: i32,
- pub st_blksize: ::blksize_t,
- pub st_blocks: ::blkcnt_t,
- pub st_mtim: ::timespec,
- pub st_atim: ::timespec,
- pub st_ctim: ::timespec,
- }
-
pub struct sigset_t {
__val: [u32; 2],
}
@@ -756,6 +758,37 @@ s_no_extra_traits! {
cfg_if! {
if #[cfg(feature = "extra_traits")] {
+ // sigevent
+ impl PartialEq for sigevent {
+ fn eq(&self, other: &sigevent) -> bool {
+ self.sigev_notify == other.sigev_notify
+ && self.sigev_signo == other.sigev_signo
+ && self.sigev_value == other.sigev_value
+ && self.__sigev_un2
+ == other.__sigev_un2
+ }
+ }
+ impl Eq for sigevent {}
+ impl ::fmt::Debug for sigevent {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("sigevent")
+ .field("sigev_notify", &self.sigev_notify)
+ .field("sigev_signo", &self.sigev_signo)
+ .field("sigev_value", &self.sigev_value)
+ .field("__sigev_un2",
+ &self.__sigev_un2)
+ .finish()
+ }
+ }
+ impl ::hash::Hash for sigevent {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.sigev_notify.hash(state);
+ self.sigev_signo.hash(state);
+ self.sigev_value.hash(state);
+ self.__sigev_un2.hash(state);
+ }
+ }
+
impl PartialEq for sockaddr_un {
fn eq(&self, other: &sockaddr_un) -> bool {
self.sun_len == other.sun_len
@@ -767,9 +800,7 @@ cfg_if! {
.all(|(a,b)| a == b)
}
}
-
impl Eq for sockaddr_un {}
-
impl ::fmt::Debug for sockaddr_un {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("sockaddr_un")
@@ -788,6 +819,168 @@ cfg_if! {
}
}
+ // sigset_t
+ impl PartialEq for sigset_t {
+ fn eq(&self, other: &sigset_t) -> bool {
+ self.__val == other.__val
+ }
+ }
+ impl Eq for sigset_t {}
+ impl ::fmt::Debug for sigset_t {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("sigset_t")
+ .field("__val", &self.__val)
+ .finish()
+ }
+ }
+ impl ::hash::Hash for sigset_t {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.__val.hash(state);
+ }
+ }
+
+ // msg
+ impl ::fmt::Debug for msg {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("msg")
+ .field("msg_next", &self.msg_next)
+ .field("msg_type", &self.msg_type)
+ .field("msg_ts", &self.msg_ts)
+ .field("msg_spot", &self.msg_spot)
+ .finish()
+ }
+ }
+
+ // msqid_ds
+ impl ::fmt::Debug for msqid_ds {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("msqid_ds")
+ .field("msg_perm", &self.msg_perm)
+ .field("msg_first", &self.msg_first)
+ .field("msg_cbytes", &self.msg_cbytes)
+ .field("msg_qnum", &self.msg_qnum)
+ .field("msg_qbytes", &self.msg_qbytes)
+ .field("msg_lspid", &self.msg_lspid)
+ .field("msg_lrpid", &self.msg_lrpid)
+ .field("msg_stime", &self.msg_stime)
+ .field("msg_rtime", &self.msg_rtime)
+ .field("msg_ctime", &self.msg_ctime)
+ .finish()
+ }
+ }
+
+ // sockaddr_dl
+ impl ::fmt::Debug for sockaddr_dl {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("sockaddr_dl")
+ .field("sdl_len", &self.sdl_len)
+ .field("sdl_family", &self.sdl_family)
+ .field("sdl_index", &self.sdl_index)
+ .field("sdl_type", &self.sdl_type)
+ .field("sdl_nlen", &self.sdl_nlen)
+ .field("sdl_alen", &self.sdl_alen)
+ .field("sdl_slen", &self.sdl_slen)
+ .field("sdl_data", &self.sdl_data)
+ .finish()
+ }
+ }
+ impl PartialEq for sockaddr_dl {
+ fn eq(&self, other: &sockaddr_dl) -> bool {
+ self.sdl_len == other.sdl_len
+ && self.sdl_family == other.sdl_family
+ && self.sdl_index == other.sdl_index
+ && self.sdl_type == other.sdl_type
+ && self.sdl_nlen == other.sdl_nlen
+ && self.sdl_alen == other.sdl_alen
+ && self.sdl_slen == other.sdl_slen
+ && self
+ .sdl_data
+ .iter()
+ .zip(other.sdl_data.iter())
+ .all(|(a,b)| a == b)
+ }
+ }
+ impl Eq for sockaddr_dl {}
+ impl ::hash::Hash for sockaddr_dl {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.sdl_len.hash(state);
+ self.sdl_family.hash(state);
+ self.sdl_index.hash(state);
+ self.sdl_type.hash(state);
+ self.sdl_nlen.hash(state);
+ self.sdl_alen.hash(state);
+ self.sdl_slen.hash(state);
+ self.sdl_data.hash(state);
+ }
+ }
+
+ // sync_t
+ impl ::fmt::Debug for sync_t {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("sync_t")
+ .field("__owner", &self.__owner)
+ .field("__u", &self.__u)
+ .finish()
+ }
+ }
+
+ // pthread_barrier_t
+ impl ::fmt::Debug for pthread_barrier_t {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("pthread_barrier_t")
+ .field("__pad", &self.__pad)
+ .finish()
+ }
+ }
+
+ // pthread_rwlock_t
+ impl ::fmt::Debug for pthread_rwlock_t {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("pthread_rwlock_t")
+ .field("__active", &self.__active)
+ .field("__blockedwriters", &self.__blockedwriters)
+ .field("__blockedreaders", &self.__blockedreaders)
+ .field("__heavy", &self.__heavy)
+ .field("__lock", &self.__lock)
+ .field("__rcond", &self.__rcond)
+ .field("__wcond", &self.__wcond)
+ .field("__owner", &self.__owner)
+ .field("__spare", &self.__spare)
+ .finish()
+ }
+ }
+
+ // syspage_entry
+ impl ::fmt::Debug for syspage_entry {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("syspage_entry")
+ .field("size", &self.size)
+ .field("total_size", &self.total_size)
+ .field("type_", &self.type_)
+ .field("num_cpu", &self.num_cpu)
+ .field("system_private", &self.system_private)
+ .field("old_asinfo", &self.old_asinfo)
+ .field("hwinfo", &self.hwinfo)
+ .field("old_cpuinfo", &self.old_cpuinfo)
+ .field("old_cacheattr", &self.old_cacheattr)
+ .field("qtime", &self.qtime)
+ .field("callout", &self.callout)
+ .field("callin", &self.callin)
+ .field("typed_strings", &self.typed_strings)
+ .field("strings", &self.strings)
+ .field("old_intrinfo", &self.old_intrinfo)
+ .field("smp", &self.smp)
+ .field("pminfo", &self.pminfo)
+ .field("old_mdriver", &self.old_mdriver)
+ .field("new_asinfo", &self.new_asinfo)
+ .field("new_cpuinfo", &self.new_cpuinfo)
+ .field("new_cacheattr", &self.new_cacheattr)
+ .field("new_intrinfo", &self.new_intrinfo)
+ .field("new_mdriver", &self.new_mdriver)
+ .finish()
+ }
+ }
+
impl PartialEq for utsname {
fn eq(&self, other: &utsname) -> bool {
self.sysname
@@ -868,6 +1061,16 @@ cfg_if! {
.finish()
}
}
+ impl ::hash::Hash for mq_attr {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.mq_maxmsg.hash(state);
+ self.mq_msgsize.hash(state);
+ self.mq_flags.hash(state);
+ self.mq_curmsgs.hash(state);
+ self.mq_sendwait.hash(state);
+ self.mq_recvwait.hash(state);
+ }
+ }
impl PartialEq for sockaddr_storage {
fn eq(&self, other: &sockaddr_storage) -> bool {
@@ -2354,6 +2557,7 @@ pub const RLIMIT_NPROC: ::c_int = 8;
pub const RLIMIT_RSS: ::c_int = 6;
pub const RLIMIT_STACK: ::c_int = 3;
pub const RLIMIT_VMEM: ::c_int = 6;
+#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::c_int = 14;
pub const SCHED_ADJTOHEAD: ::c_int = 5;
@@ -2606,6 +2810,14 @@ f! {
};
::mem::size_of::<sockcred>() + ::mem::size_of::<::gid_t>() * ngrps
}
+
+ pub fn major(dev: ::dev_t) -> ::c_uint {
+ ((dev as ::c_uint) >> 10) & 0x3f
+ }
+
+ pub fn minor(dev: ::dev_t) -> ::c_uint {
+ (dev as ::c_uint) & 0x3ff
+ }
}
safe_f! {
@@ -2644,6 +2856,10 @@ safe_f! {
pub {const} fn IPTOS_ECN(x: u8) -> u8 {
x & ::IPTOS_ECN_MASK
}
+
+ pub {const} fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
+ ((major << 10) | (minor)) as ::dev_t
+ }
}
// Network related functions are provided by libsocket and regex
@@ -2658,6 +2874,12 @@ extern "C" {
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 mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int;
+ pub fn mknodat(
+ __fd: ::c_int,
+ pathname: *const ::c_char,
+ mode: ::mode_t,
+ dev: ::dev_t,
+ ) -> ::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;
@@ -2871,6 +3093,7 @@ extern "C" {
attr: *const ::pthread_attr_t,
guardsize: *mut ::size_t,
) -> ::c_int;
+ pub fn pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::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(
diff --git a/src/unix/nto/neutrino.rs b/src/unix/nto/neutrino.rs
index cedd2165..1a6f7da9 100644
--- a/src/unix/nto/neutrino.rs
+++ b/src/unix/nto/neutrino.rs
@@ -1,6 +1,16 @@
pub type nto_job_t = ::sync_t;
s! {
+ pub struct syspage_entry_info {
+ pub entry_off: u16,
+ pub entry_size: u16,
+ }
+ pub struct syspage_array_info {
+ entry_off: u16,
+ entry_size: u16,
+ element_size: u16,
+ }
+
pub struct intrspin {
pub value: ::c_uint, // volatile
}
@@ -202,16 +212,6 @@ s! {
}
s_no_extra_traits! {
- pub struct syspage_entry_info {
- pub entry_off: u16,
- pub entry_size: u16,
- }
-
- pub struct syspage_array_info {
- entry_off: u16,
- entry_size: u16,
- element_size: u16,
- }
#[repr(align(8))]
pub struct syspage_entry {
diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs
index 5003cda0..cd219a77 100644
--- a/src/unix/redox/mod.rs
+++ b/src/unix/redox/mod.rs
@@ -28,20 +28,13 @@ pub type nfds_t = ::c_ulong;
pub type nlink_t = ::c_ulong;
pub type off_t = ::c_longlong;
pub type pthread_t = *mut ::c_void;
-pub type pthread_attr_t = *mut ::c_void;
-pub type pthread_cond_t = *mut ::c_void;
-pub type pthread_condattr_t = *mut ::c_void;
// Must be usize due to libstd/sys_common/thread_local.rs,
// should technically be *mut ::c_void
pub type pthread_key_t = usize;
-pub type pthread_mutex_t = *mut ::c_void;
-pub type pthread_mutexattr_t = *mut ::c_void;
-pub type pthread_rwlock_t = *mut ::c_void;
-pub type pthread_rwlockattr_t = *mut ::c_void;
pub type rlim_t = ::c_ulonglong;
pub type sa_family_t = u16;
pub type sem_t = *mut ::c_void;
-pub type sigset_t = ::c_ulong;
+pub type sigset_t = ::c_ulonglong;
pub type socklen_t = u32;
pub type speed_t = u32;
pub type suseconds_t = ::c_int;
@@ -265,7 +258,74 @@ s! {
pub uid: uid_t,
pub gid: gid_t,
}
+
+ #[cfg_attr(target_pointer_width = "32", repr(C, align(4)))]
+ #[cfg_attr(target_pointer_width = "64", repr(C, align(8)))]
+ pub struct pthread_attr_t {
+ bytes: [u8; _PTHREAD_ATTR_SIZE],
+ }
+ #[repr(C)]
+ #[repr(align(4))]
+ pub struct pthread_barrier_t {
+ bytes: [u8; _PTHREAD_BARRIER_SIZE],
+ }
+ #[repr(C)]
+ #[repr(align(4))]
+ pub struct pthread_barrierattr_t {
+ bytes: [u8; _PTHREAD_BARRIERATTR_SIZE],
+ }
+ #[repr(C)]
+ #[repr(align(4))]
+ pub struct pthread_mutex_t {
+ bytes: [u8; _PTHREAD_MUTEX_SIZE],
+ }
+ #[repr(C)]
+ #[repr(align(4))]
+ pub struct pthread_rwlock_t {
+ bytes: [u8; _PTHREAD_RWLOCK_SIZE],
+ }
+ #[repr(C)]
+ #[repr(align(4))]
+ pub struct pthread_mutexattr_t {
+ bytes: [u8; _PTHREAD_MUTEXATTR_SIZE],
+ }
+ #[repr(C)]
+ #[repr(align(1))]
+ pub struct pthread_rwlockattr_t {
+ bytes: [u8; _PTHREAD_RWLOCKATTR_SIZE],
+ }
+ #[repr(C)]
+ #[repr(align(4))]
+ pub struct pthread_cond_t {
+ bytes: [u8; _PTHREAD_COND_SIZE],
+ }
+ #[repr(C)]
+ #[repr(align(4))]
+ pub struct pthread_condattr_t {
+ bytes: [u8; _PTHREAD_CONDATTR_SIZE],
+ }
+ #[repr(C)]
+ #[repr(align(4))]
+ pub struct pthread_once_t {
+ bytes: [u8; _PTHREAD_ONCE_SIZE],
+ }
+ #[repr(C)]
+ #[repr(align(4))]
+ pub struct pthread_spinlock_t {
+ bytes: [u8; _PTHREAD_SPINLOCK_SIZE],
+ }
}
+const _PTHREAD_ATTR_SIZE: usize = 32;
+const _PTHREAD_RWLOCKATTR_SIZE: usize = 1;
+const _PTHREAD_RWLOCK_SIZE: usize = 4;
+const _PTHREAD_BARRIER_SIZE: usize = 24;
+const _PTHREAD_BARRIERATTR_SIZE: usize = 4;
+const _PTHREAD_CONDATTR_SIZE: usize = 8;
+const _PTHREAD_COND_SIZE: usize = 8;
+const _PTHREAD_MUTEX_SIZE: usize = 12;
+const _PTHREAD_MUTEXATTR_SIZE: usize = 20;
+const _PTHREAD_ONCE_SIZE: usize = 4;
+const _PTHREAD_SPINLOCK_SIZE: usize = 4;
pub const UTSLENGTH: usize = 65;
@@ -549,9 +609,15 @@ pub const POLLWRBAND: ::c_short = 0x200;
// pthread.h
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
-pub const PTHREAD_MUTEX_INITIALIZER: ::pthread_mutex_t = -1isize as *mut _;
-pub const PTHREAD_COND_INITIALIZER: ::pthread_cond_t = -1isize as *mut _;
-pub const PTHREAD_RWLOCK_INITIALIZER: ::pthread_rwlock_t = -1isize as *mut _;
+pub const PTHREAD_MUTEX_INITIALIZER: ::pthread_mutex_t = ::pthread_mutex_t {
+ bytes: [0; _PTHREAD_MUTEX_SIZE],
+};
+pub const PTHREAD_COND_INITIALIZER: ::pthread_cond_t = ::pthread_cond_t {
+ bytes: [0; _PTHREAD_COND_SIZE],
+};
+pub const PTHREAD_RWLOCK_INITIALIZER: ::pthread_rwlock_t = ::pthread_rwlock_t {
+ bytes: [0; _PTHREAD_RWLOCK_SIZE],
+};
pub const PTHREAD_STACK_MIN: ::size_t = 4096;
// signal.h
@@ -1014,6 +1080,10 @@ extern "C" {
pub fn getdtablesize() -> ::c_int;
// grp.h
+ pub fn getgrent() -> *mut ::group;
+ pub fn setgrent();
+ pub fn endgrent();
+ pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
pub fn getgrgid_r(
gid: ::gid_t,
grp: *mut ::group,
@@ -1021,6 +1091,7 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut ::group,
) -> ::c_int;
+ pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
pub fn getgrnam_r(
name: *const ::c_char,
grp: *mut ::group,
diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs
index 400de8a2..a3fa56a6 100644
--- a/src/unix/solarish/mod.rs
+++ b/src/unix/solarish/mod.rs
@@ -1825,6 +1825,8 @@ 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_PROTOTYPE: ::c_int = 0x1009;
+pub const SO_DOMAIN: ::c_int = 0x100c;
pub const SO_TIMESTAMP: ::c_int = 0x1013;
pub const SCM_RIGHTS: ::c_int = 0x1010;
diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs
index c337a827..21d33a4e 100644
--- a/src/vxworks/mod.rs
+++ b/src/vxworks/mod.rs
@@ -1018,6 +1018,21 @@ pub const O_WRONLY: ::c_int = 0x0001;
pub const O_RDONLY: ::c_int = 0;
pub const O_NONBLOCK: ::c_int = 0x4000;
+// mman.h
+pub const PROT_NONE: ::c_int = 0x0000;
+pub const PROT_READ: ::c_int = 0x0001;
+pub const PROT_WRITE: ::c_int = 0x0002;
+pub const PROT_EXEC: ::c_int = 0x0004;
+
+pub const MAP_SHARED: ::c_int = 0x0001;
+pub const MAP_PRIVATE: ::c_int = 0x0002;
+pub const MAP_ANON: ::c_int = 0x0004;
+pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
+pub const MAP_FIXED: ::c_int = 0x0010;
+pub const MAP_CONTIG: ::c_int = 0x0020;
+
+pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum FILE {}
impl ::Copy for FILE {}
@@ -1218,6 +1233,8 @@ extern "C" {
) -> *mut ::c_void;
pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
pub fn truncate(path: *const c_char, length: off_t) -> ::c_int;
+ pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) -> ::c_int;
+ pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
pub fn pthread_exit(value: *mut ::c_void) -> !;
@@ -1909,19 +1926,19 @@ cfg_if! {
if #[cfg(target_arch = "aarch64")] {
mod aarch64;
pub use self::aarch64::*;
- } else if #[cfg(any(target_arch = "arm"))] {
+ } else if #[cfg(target_arch = "arm")] {
mod arm;
pub use self::arm::*;
- } else if #[cfg(any(target_arch = "x86"))] {
+ } else if #[cfg(target_arch = "x86")] {
mod x86;
pub use self::x86::*;
- } else if #[cfg(any(target_arch = "x86_64"))] {
+ } else if #[cfg(target_arch = "x86_64")] {
mod x86_64;
pub use self::x86_64::*;
- } else if #[cfg(any(target_arch = "powerpc"))] {
+ } else if #[cfg(target_arch = "powerpc")] {
mod powerpc;
pub use self::powerpc::*;
- } else if #[cfg(any(target_arch = "powerpc64"))] {
+ } else if #[cfg(target_arch = "powerpc64")] {
mod powerpc64;
pub use self::powerpc64::*;
} else {
diff --git a/src/windows/mod.rs b/src/windows/mod.rs
index 26bff7f7..196f1f2e 100644
--- a/src/windows/mod.rs
+++ b/src/windows/mod.rs
@@ -345,6 +345,7 @@ extern "C" {
pub fn strtoull(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulonglong;
pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
pub fn malloc(size: size_t) -> *mut c_void;
+ pub fn _msize(p: *mut c_void) -> size_t;
pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
pub fn free(p: *mut c_void);
pub fn abort() -> !;