aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-07-15 00:03:00 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-07-15 00:03:00 +0000
commitdc5e87f8f084395870bdc686eafa6a11958b12f5 (patch)
treeb63bb3578266975d3cce7442325eaa5bdf684362
parentc3ced644b99c79d6a58a4dd4d699d3ef58ea972e (diff)
parent499f0d3705a592b671b4bf436a98c2a072500b76 (diff)
downloadlibc-android12-mainline-wifi-release.tar.gz
Change-Id: If390730b26bb27bfc037473860f6b0ec3f78cd1e
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--.cirrus.yml27
-rw-r--r--.github/issue_template.md24
-rw-r--r--Android.bp143
-rw-r--r--CONTRIBUTING.md45
-rw-r--r--Cargo.toml12
-rw-r--r--Cargo.toml.orig10
l---------LICENSE1
-rw-r--r--LICENSE-MIT2
-rw-r--r--METADATA19
-rw-r--r--MODULE_LICENSE_APACHE20
-rw-r--r--OWNERS1
-rw-r--r--README.md22
-rw-r--r--TEST_MAPPING303
-rw-r--r--build.rs19
-rw-r--r--cargo2android.json13
-rw-r--r--patches/missing.diff78
-rw-r--r--patches/std.diff14
-rw-r--r--rustfmt.toml4
-rw-r--r--src/cloudabi/aarch64.rs4
-rw-r--r--src/cloudabi/arm.rs4
-rw-r--r--src/cloudabi/mod.rs374
-rw-r--r--src/cloudabi/x86.rs4
-rw-r--r--src/cloudabi/x86_64.rs4
-rw-r--r--src/fuchsia/mod.rs764
-rw-r--r--src/hermit/mod.rs10
-rw-r--r--src/lib.rs47
-rw-r--r--src/macros.rs84
-rw-r--r--src/psp.rs4174
-rw-r--r--src/unix/bsd/apple/b64/aarch64/align.rs48
-rw-r--r--src/unix/bsd/apple/b64/aarch64/mod.rs8
-rw-r--r--src/unix/bsd/apple/b64/mod.rs12
-rw-r--r--src/unix/bsd/apple/b64/x86_64/align.rs7
-rw-r--r--src/unix/bsd/apple/b64/x86_64/mod.rs112
-rw-r--r--src/unix/bsd/apple/mod.rs555
-rw-r--r--src/unix/bsd/freebsdlike/dragonfly/errno.rs1
-rw-r--r--src/unix/bsd/freebsdlike/dragonfly/mod.rs115
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/aarch64.rs29
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/arm.rs3
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs (renamed from src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs)0
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs18
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs (renamed from src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs)0
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs48
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs34
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs242
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/mod.rs349
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/powerpc64.rs3
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/x86.rs5
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs190
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs184
-rw-r--r--src/unix/bsd/freebsdlike/mod.rs482
-rw-r--r--src/unix/bsd/mod.rs216
-rw-r--r--src/unix/bsd/netbsdlike/mod.rs91
-rw-r--r--src/unix/bsd/netbsdlike/netbsd/mod.rs319
-rw-r--r--src/unix/bsd/netbsdlike/openbsd/mod.rs145
-rw-r--r--src/unix/haiku/mod.rs391
-rw-r--r--src/unix/haiku/native.rs1043
-rw-r--r--src/unix/hermit/mod.rs51
-rw-r--r--src/unix/linux_like/android/b32/arm.rs184
-rw-r--r--src/unix/linux_like/android/b32/mod.rs26
-rw-r--r--src/unix/linux_like/android/b32/x86/mod.rs191
-rw-r--r--src/unix/linux_like/android/b64/aarch64/align.rs22
-rw-r--r--src/unix/linux_like/android/b64/aarch64/mod.rs47
-rw-r--r--src/unix/linux_like/android/b64/mod.rs59
-rw-r--r--src/unix/linux_like/android/b64/x86_64/mod.rs240
-rw-r--r--src/unix/linux_like/android/mod.rs643
-rw-r--r--src/unix/linux_like/emscripten/align.rs4
-rw-r--r--src/unix/linux_like/emscripten/mod.rs348
-rw-r--r--src/unix/linux_like/linux/align.rs42
-rw-r--r--src/unix/linux_like/linux/arch/generic/mod.rs100
-rw-r--r--src/unix/linux_like/linux/arch/mips/mod.rs96
-rw-r--r--src/unix/linux_like/linux/arch/mod.rs15
-rw-r--r--src/unix/linux_like/linux/arch/powerpc/mod.rs91
-rw-r--r--src/unix/linux_like/linux/arch/sparc/mod.rs88
-rw-r--r--src/unix/linux_like/linux/gnu/b32/arm/mod.rs45
-rw-r--r--src/unix/linux_like/linux/gnu/b32/mips/mod.rs68
-rw-r--r--src/unix/linux_like/linux/gnu/b32/mod.rs192
-rw-r--r--src/unix/linux_like/linux/gnu/b32/powerpc.rs46
-rw-r--r--src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs795
-rw-r--r--src/unix/linux_like/linux/gnu/b32/sparc/mod.rs112
-rw-r--r--src/unix/linux_like/linux/gnu/b32/x86/mod.rs60
-rw-r--r--src/unix/linux_like/linux/gnu/b64/aarch64/align.rs22
-rw-r--r--src/unix/linux_like/linux/gnu/b64/aarch64/ilp32.rs62
-rw-r--r--src/unix/linux_like/linux/gnu/b64/aarch64/lp64.rs71
-rw-r--r--src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs201
-rw-r--r--src/unix/linux_like/linux/gnu/b64/mips64/mod.rs81
-rw-r--r--src/unix/linux_like/linux/gnu/b64/mod.rs14
-rw-r--r--src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs87
-rw-r--r--src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs257
-rw-r--r--src/unix/linux_like/linux/gnu/b64/s390x.rs69
-rw-r--r--src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs66
-rw-r--r--src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs81
-rw-r--r--src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs20
-rw-r--r--src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs19
-rw-r--r--src/unix/linux_like/linux/gnu/mod.rs687
-rw-r--r--src/unix/linux_like/linux/mod.rs1351
-rw-r--r--src/unix/linux_like/linux/musl/b32/arm/mod.rs57
-rw-r--r--src/unix/linux_like/linux/musl/b32/hexagon.rs55
-rw-r--r--src/unix/linux_like/linux/musl/b32/mips/mod.rs50
-rw-r--r--src/unix/linux_like/linux/musl/b32/mod.rs1
-rw-r--r--src/unix/linux_like/linux/musl/b32/powerpc.rs56
-rw-r--r--src/unix/linux_like/linux/musl/b32/x86/mod.rs57
-rw-r--r--src/unix/linux_like/linux/musl/b64/aarch64/align.rs20
-rw-r--r--src/unix/linux_like/linux/musl/b64/aarch64/mod.rs54
-rw-r--r--src/unix/linux_like/linux/musl/b64/mips64.rs133
-rw-r--r--src/unix/linux_like/linux/musl/b64/mod.rs10
-rw-r--r--src/unix/linux_like/linux/musl/b64/powerpc64.rs50
-rw-r--r--src/unix/linux_like/linux/musl/b64/s390x.rs754
-rw-r--r--src/unix/linux_like/linux/musl/b64/x86_64/mod.rs50
-rw-r--r--src/unix/linux_like/linux/musl/mod.rs332
-rw-r--r--src/unix/linux_like/linux/no_align.rs15
-rw-r--r--src/unix/linux_like/linux/uclibc/align.rs28
-rw-r--r--src/unix/linux_like/linux/uclibc/arm/align.rs (renamed from src/unix/uclibc/arm/align.rs)0
-rw-r--r--src/unix/linux_like/linux/uclibc/arm/mod.rs (renamed from src/unix/uclibc/arm/mod.rs)341
-rw-r--r--src/unix/linux_like/linux/uclibc/arm/no_align.rs (renamed from src/unix/uclibc/arm/no_align.rs)0
-rw-r--r--src/unix/linux_like/linux/uclibc/mips/mips32/align.rs (renamed from src/unix/uclibc/mips/mips32/align.rs)0
-rw-r--r--src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs (renamed from src/unix/uclibc/mips/mips32/mod.rs)50
-rw-r--r--src/unix/linux_like/linux/uclibc/mips/mips32/no_align.rs (renamed from src/unix/uclibc/mips/mips32/no_align.rs)0
-rw-r--r--src/unix/linux_like/linux/uclibc/mips/mips64/align.rs (renamed from src/unix/uclibc/mips/mips64/align.rs)0
-rw-r--r--src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs (renamed from src/unix/uclibc/mips/mips64/mod.rs)0
-rw-r--r--src/unix/linux_like/linux/uclibc/mips/mips64/no_align.rs (renamed from src/unix/uclibc/mips/mips64/no_align.rs)0
-rw-r--r--src/unix/linux_like/linux/uclibc/mips/mod.rs (renamed from src/unix/uclibc/mips/mod.rs)133
-rw-r--r--src/unix/linux_like/linux/uclibc/mod.rs303
-rw-r--r--src/unix/linux_like/linux/uclibc/no_align.rs (renamed from src/unix/uclibc/no_align.rs)0
-rw-r--r--src/unix/linux_like/linux/uclibc/x86_64/l4re.rs (renamed from src/unix/uclibc/x86_64/l4re.rs)0
-rw-r--r--src/unix/linux_like/linux/uclibc/x86_64/mod.rs (renamed from src/unix/uclibc/x86_64/mod.rs)104
-rw-r--r--src/unix/linux_like/linux/uclibc/x86_64/other.rs (renamed from src/unix/uclibc/x86_64/other.rs)0
-rw-r--r--src/unix/linux_like/mod.rs508
-rw-r--r--src/unix/mod.rs533
-rw-r--r--src/unix/newlib/aarch64/mod.rs19
-rw-r--r--src/unix/newlib/arm/mod.rs21
-rw-r--r--src/unix/newlib/mod.rs110
-rw-r--r--src/unix/newlib/no_align.rs2
-rw-r--r--src/unix/newlib/powerpc/mod.rs14
-rw-r--r--src/unix/newlib/xtensa/mod.rs93
-rw-r--r--src/unix/redox/mod.rs161
-rw-r--r--src/unix/solarish/compat.rs175
-rw-r--r--src/unix/solarish/illumos.rs40
-rw-r--r--src/unix/solarish/mod.rs738
-rw-r--r--src/unix/solarish/solaris.rs94
-rw-r--r--src/unix/uclibc/align.rs66
-rw-r--r--src/unix/uclibc/mod.rs2295
-rw-r--r--src/unix/uclibc/x86_64/align.rs77
-rw-r--r--src/unix/uclibc/x86_64/no_align.rs59
-rwxr-xr-xsrc/vxworks/mod.rs539
-rw-r--r--src/wasi.rs383
-rw-r--r--src/windows/gnu/mod.rs10
-rw-r--r--src/windows/mod.rs174
-rw-r--r--src/windows/msvc.rs6
149 files changed, 17667 insertions, 8614 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 71b1c6af..94ed93da 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "0e2549387716c156b44a51882e349ad6ca9611c9"
+ "sha1": "3b185efb5ab36d25f4c1f87ce74ccce42ddd4743"
}
}
diff --git a/.cirrus.yml b/.cirrus.yml
deleted file mode 100644
index 47807ab0..00000000
--- a/.cirrus.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-task:
- name: stable x86_64-unknown-freebsd-11
- freebsd_instance:
- image: freebsd-11-2-release-amd64
- setup_script:
- - pkg install -y curl
- - curl https://sh.rustup.rs -sSf --output rustup.sh
- - sh rustup.sh -y
- - . $HOME/.cargo/env
- - rustup default stable
- test_script:
- - . $HOME/.cargo/env
- - sh ci/run.sh x86_64-unknown-freebsd
-
-task:
- name: nightly x86_64-unknown-freebsd-12
- freebsd_instance:
- image: freebsd-12-0-release-amd64
- setup_script:
- - pkg install -y curl
- - curl https://sh.rustup.rs -sSf --output rustup.sh
- - sh rustup.sh --default-toolchain nightly -y
- - . $HOME/.cargo/env
- - rustup default nightly
- test_script:
- - . $HOME/.cargo/env
- - sh ci/run.sh x86_64-unknown-freebsd
diff --git a/.github/issue_template.md b/.github/issue_template.md
deleted file mode 100644
index 435bf35c..00000000
--- a/.github/issue_template.md
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-**Help us help you.**
-
-If you are reporting a bug, include:
-
-* a Minimum Working Example without any dependencies (except libc) that shows
- the issue and ideally reproduces in the Rust playground
-* the target triple - libc supports many targets and many APIs
-* instructions to reproduce, logs (e.g. build logs, links to Travis-CI logs,
- uploads to github gists, etc.).
-
-If you are requesting a new API, include:
-
-* the target triple
-* link to the documentation of the API showing the type signatures, how to use
- it, etc.
-
-In general, just please consider that the people who can help you are all very
-busy, they will be helping you in their free time, there are a lot of people in
-need of help so they need to prioritize to which issues they devote their free
-time, etc. So try to give most of the information upfront, be concise, show
-small self-contained examples (nobody has time to create a new cargo project,
-set up dependencies,...), etc. Help us help you.
--->
diff --git a/Android.bp b/Android.bp
index 0ab8683e..2d649dee 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,6 +1,120 @@
-// This file is generated by cargo2android.py.
+// This file is generated by cargo2android.py --config cargo2android.json.
+// Do not modify this file as changes will be overridden on upgrade.
-rust_library_rlib {
+package {
+ default_applicable_licenses: ["external_rust_crates_libc_license"],
+}
+
+// Added automatically by a large-scale-change that took the approach of
+// 'apply every license found to every target'. While this makes sure we respect
+// every license restriction, it may not be entirely correct.
+//
+// e.g. GPL in an MIT project might only apply to the contrib/ directory.
+//
+// Please consider splitting the single license below into multiple licenses,
+// taking care not to lose any license_kind information, and overriding the
+// default license using the 'licenses: [...]' property on targets as needed.
+//
+// For unused files, consider creating a 'filegroup' with "//visibility:private"
+// to attach the license to, and including a comment whether the files may be
+// used in the current project.
+//
+// large-scale-change included anything that looked like it might be a license
+// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
+//
+// Please consider removing redundant or irrelevant files from 'license_text:'.
+// http://go/android-license-faq
+license {
+ name: "external_rust_crates_libc_license",
+ visibility: [":__subpackages__"],
+ license_kinds: [
+ "SPDX-license-identifier-Apache-2.0",
+ "SPDX-license-identifier-MIT",
+ ],
+ license_text: [
+ "LICENSE-APACHE",
+ "LICENSE-MIT",
+ ],
+}
+
+rust_defaults {
+ name: "rust_libc_defaults",
+ crate_name: "libc",
+ srcs: ["src/lib.rs"],
+ test_suites: ["general-tests"],
+ auto_gen_config: true,
+ edition: "2015",
+ features: [
+ "default",
+ "extra_traits",
+ "std",
+ ],
+ cfgs: [
+ "freebsd11",
+ "libc_align",
+ "libc_cfg_target_vendor",
+ "libc_const_size_of",
+ "libc_core_cvoid",
+ "libc_packedN",
+ "libc_priv_mod_use",
+ "libc_union",
+ ],
+}
+
+rust_test_host {
+ name: "libc_host_test_src_lib",
+ defaults: ["rust_libc_defaults"],
+ test_options: {
+ unit_test: true,
+ },
+}
+
+rust_test {
+ name: "libc_device_test_src_lib",
+ defaults: ["rust_libc_defaults"],
+}
+
+rust_defaults {
+ name: "rust_libc_defaults_const_fn",
+ crate_name: "const_fn",
+ srcs: ["tests/const_fn.rs"],
+ test_suites: ["general-tests"],
+ auto_gen_config: true,
+ edition: "2015",
+ features: [
+ "default",
+ "extra_traits",
+ "std",
+ ],
+ cfgs: [
+ "freebsd11",
+ "libc_align",
+ "libc_cfg_target_vendor",
+ "libc_const_size_of",
+ "libc_core_cvoid",
+ "libc_packedN",
+ "libc_priv_mod_use",
+ "libc_union",
+ ],
+ rustlibs: [
+ "liblibc",
+ ],
+}
+
+rust_test_host {
+ name: "libc_host_test_tests_const_fn",
+ defaults: ["rust_libc_defaults_const_fn"],
+ test_options: {
+ unit_test: true,
+ },
+}
+
+rust_test {
+ name: "libc_device_test_tests_const_fn",
+ defaults: ["rust_libc_defaults_const_fn"],
+}
+
+rust_library {
name: "liblibc",
host_supported: true,
crate_name: "libc",
@@ -8,16 +122,23 @@ rust_library_rlib {
edition: "2015",
features: [
"default",
+ "extra_traits",
"std",
],
- flags: [
- "--cfg freebsd11",
- "--cfg libc_align",
- "--cfg libc_const_size_of",
- "--cfg libc_conts_size_of",
- "--cfg libc_core_cvoid",
- "--cfg libc_packedN",
- "--cfg libc_priv_mod_use",
- "--cfg libc_union",
+ cfgs: [
+ "freebsd11",
+ "libc_align",
+ "libc_cfg_target_vendor",
+ "libc_const_size_of",
+ "libc_core_cvoid",
+ "libc_packedN",
+ "libc_priv_mod_use",
+ "libc_union",
+ ],
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.resolv",
+ "com.android.virt",
],
+ min_sdk_version: "29",
}
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 052777f4..5be6eb9b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -28,17 +28,27 @@ at, fear not! This crate has CI support which tests any binding against all
platforms supported, so you'll see failures if an API is added at the wrong
level or has different signatures across platforms.
+New symbol(s) (i.e. functions, constants etc.) should also be added to the
+symbols list(s) found in the `libc-test/semver` directory. These lists keep
+track of what symbols are public in the libc crate and ensures they remain
+available between changes to the crate. If the new symbol(s) are available on
+all supported Unixes it should be added to `unix.txt` list<sup>1</sup>,
+otherwise they should be added to the OS specific list(s).
+
With that in mind, the steps for adding a new API are:
1. Determine where in the module hierarchy your API should be added.
-2. Add the API.
+2. Add the API, including adding new symbol(s) to the semver lists.
3. Send a PR to this repo.
4. Wait for CI to pass, fixing errors.
5. Wait for a merge!
-### Test before you commit
+<sup>1</sup>: Note that this list has nothing to do with any Unix or Posix
+standard, it's just a list shared between all OSs that declare `#[cfg(unix)]`.
+
+## Test before you commit
-We have two automated tests running on [Azure Pipelines](https://dev.azure.com/rust-lang2/libc/_build?definitionId=1&_a=summary):
+We have two automated tests running on [GitHub Actions](https://github.com/rust-lang/libc/actions):
1. [`libc-test`](https://github.com/gnzlbg/ctest)
- `cd libc-test && cargo test`
@@ -46,21 +56,34 @@ We have two automated tests running on [Azure Pipelines](https://dev.azure.com/r
2. Style checker
- `rustc ci/style.rs && ./style src`
-### Releasing your change to crates.io
+## Breaking change policy
+
+Sometimes an upstream adds a breaking change to their API e.g. removing outdated items,
+changing the type signature, etc. And we probably should follow that change to build the
+`libc` crate successfully. It's annoying to do the equivalent of semver-major versioning
+for each such change. Instead, we mark the item as deprecated and do the actual change
+after a certain period. The steps are:
+
+1. Add `#[deprecated(since = "", note="")]` attribute to the item.
+ - The `since` field should have a next version of `libc`
+ (e.g., if the current version is `0.2.1`, it should be `0.2.2`).
+ - The `note` field should have a reason to deprecate and a tracking issue to call for comments
+ (e.g., "We consider removing this as the upstream removed it.
+ If you're using it, please comment on #XXX").
+2. If we don't see any concerns for a while, do the change actually.
+
+## Releasing your change to crates.io
Now that you've done the amazing job of landing your new API or your new
platform in this crate, the next step is to get that sweet, sweet usage from
crates.io! The only next step is to bump the version of libc and then publish
it. If you'd like to get a release out ASAP you can follow these steps:
-1. Update the version number in `Cargo.toml`, you'll just be bumping the patch
- version number.
-2. Run `cargo update` to regenerate the lockfile to encode your version bump in
- the lock file. You may pull in some other updated dependencies, that's ok.
-3. Send a PR to this repository. It should [look like this][example], but it'd
+1. Increment the patch version number in `Cargo.toml` and `libc-test/Cargo.toml`.
+1. Send a PR to this repository. It should [look like this][example-pr], but it'd
also be nice to fill out the description with a small rationale for the
release (any rationale is ok though!)
-4. Once merged the release will be tagged and published by one of the libc crate
+1. Once merged, the release will be tagged and published by one of the libc crate
maintainers.
-[example]: https://github.com/rust-lang/libc/pull/583
+[example-pr]: https://github.com/rust-lang/libc/pull/2120
diff --git a/Cargo.toml b/Cargo.toml
index 41c07ff4..20b6db46 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,13 +12,13 @@
[package]
name = "libc"
-version = "0.2.66"
+version = "0.2.93"
authors = ["The Rust Project Developers"]
build = "build.rs"
-exclude = ["/ci/*", "/azure-pipelines.yml"]
+exclude = ["/ci/*", "/.github/*", "/.cirrus.yml", "/triagebot.toml"]
description = "Raw FFI bindings to platform libraries like libc.\n"
homepage = "https://github.com/rust-lang/libc"
-documentation = "http://doc.rust-lang.org/libc"
+documentation = "https://docs.rs/libc/"
readme = "README.md"
keywords = ["libc", "ffi", "bindings", "operating", "system"]
categories = ["external-ffi-bindings", "no-std", "os"]
@@ -36,9 +36,3 @@ extra_traits = []
rustc-dep-of-std = ["align", "rustc-std-workspace-core"]
std = []
use_std = ["std"]
-[badges.appveyor]
-project_name = "rust-lang-libs/libc"
-repository = "rust-lang/libc"
-
-[badges.travis-ci]
-repository = "rust-lang/libc"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index c701f41f..84f2d298 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,24 +1,20 @@
[package]
name = "libc"
-version = "0.2.66"
+version = "0.2.93"
authors = ["The Rust Project Developers"]
license = "MIT OR Apache-2.0"
readme = "README.md"
repository = "https://github.com/rust-lang/libc"
homepage = "https://github.com/rust-lang/libc"
-documentation = "http://doc.rust-lang.org/libc"
+documentation = "https://docs.rs/libc/"
keywords = ["libc", "ffi", "bindings", "operating", "system" ]
categories = ["external-ffi-bindings", "no-std", "os"]
build = "build.rs"
-exclude = ["/ci/*", "/azure-pipelines.yml"]
+exclude = ["/ci/*", "/.github/*", "/.cirrus.yml", "/triagebot.toml"]
description = """
Raw FFI bindings to platform libraries like libc.
"""
-[badges]
-travis-ci = { repository = "rust-lang/libc" }
-appveyor = { repository = "rust-lang/libc", project_name = "rust-lang-libs/libc" }
-
[dependencies]
rustc-std-workspace-core = { version = "1.0.0", optional = true }
diff --git a/LICENSE b/LICENSE
new file mode 120000
index 00000000..6b579aae
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1 @@
+LICENSE-APACHE \ No newline at end of file
diff --git a/LICENSE-MIT b/LICENSE-MIT
index 39d4bdb5..78061811 100644
--- a/LICENSE-MIT
+++ b/LICENSE-MIT
@@ -1,4 +1,4 @@
-Copyright (c) 2014 The Rust Project Developers
+Copyright (c) 2014-2020 The Rust Project Developers
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
diff --git a/METADATA b/METADATA
new file mode 100644
index 00000000..5c67a7e6
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,19 @@
+name: "libc"
+description: "Raw FFI bindings to platform libraries like libc."
+third_party {
+ url {
+ type: HOMEPAGE
+ value: "https://crates.io/crates/libc"
+ }
+ url {
+ type: ARCHIVE
+ value: "https://static.crates.io/crates/libc/libc-0.2.93.crate"
+ }
+ version: "0.2.93"
+ license_type: NOTICE
+ last_upgrade_date {
+ year: 2021
+ month: 4
+ day: 8
+ }
+}
diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/MODULE_LICENSE_APACHE2
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 00000000..46fc3031
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1 @@
+include platform/prebuilts/rust:/OWNERS
diff --git a/README.md b/README.md
index 8a36881e..a8a3afd9 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,6 @@
-[![Azure Status]][Azure] [![Cirrus CI Status]][Cirrus CI] [![Latest Version]][crates.io] [![Documentation]][docs.rs] ![License]
+# libc - Raw FFI bindings to platforms' system libraries
-libc - Raw FFI bindings to platforms' system libraries
-====
+[![GHA Status]][GitHub Actions] [![Cirrus CI Status]][Cirrus CI] [![Latest Version]][crates.io] [![Documentation]][docs.rs] ![License]
`libc` provides all of the definitions necessary to easily interoperate with C
code (or "C-like" code) on each of the platforms that Rust supports. This
@@ -29,14 +28,14 @@ libc = "0.2"
## Features
* `std`: by default `libc` links to the standard library. Disable this
- feature remove this dependency and be able to use `libc` in `#![no_std]`
+ feature to remove this dependency and be able to use `libc` in `#![no_std]`
crates.
* `extra_traits`: all `struct`s implemented in `libc` are `Copy` and `Clone`.
This feature derives `Debug`, `Eq`, `Hash`, and `PartialEq`.
* `const-extern-fn`: Changes some `extern fn`s into `const extern fn`s.
- This features requires a nightly rustc
+ This feature requires a nightly rustc.
* **deprecated**: `use_std` is deprecated, and is equivalent to `std`.
@@ -53,6 +52,7 @@ newer Rust features are only available on newer Rust toolchains:
| `extra_traits` | 1.25.0 |
| `core::ffi::c_void` | 1.30.0 |
| `repr(packed(N))` | 1.33.0 |
+| `cfg(target_vendor)` | 1.33.0 |
## Platform support
@@ -61,7 +61,7 @@ newer Rust features are only available on newer Rust toolchains:
See
[`ci/build.sh`](https://github.com/rust-lang/libc/blob/master/ci/build.sh)
for the platforms on which `libc` is guaranteed to build for each Rust
-toolchain. The test-matrix at [Azure] and [Cirrus CI] show the
+toolchain. The test-matrix at [GitHub Actions] and [Cirrus CI] show the
platforms in which `libc` tests are run.
<div class="platform_docs"></div>
@@ -71,10 +71,10 @@ platforms in which `libc` tests are run.
This project is licensed under either of
* [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
- ([LICENSE-APACHE](LICENSE-APACHE))
+ ([LICENSE-APACHE](https://github.com/rust-lang/libc/blob/master/LICENSE-APACHE))
* [MIT License](https://opensource.org/licenses/MIT)
- ([LICENSE-MIT](LICENSE-MIT))
+ ([LICENSE-MIT](https://github.com/rust-lang/libc/blob/master/LICENSE-MIT))
at your option.
@@ -83,7 +83,7 @@ at your option.
We welcome all people who want to contribute. Please see the [contributing
instructions] for more information.
-[contributing instructions]: CONTRIBUTING.md
+[contributing instructions]: https://github.com/rust-lang/libc/blob/master/CONTRIBUTING.md
Contributions in any form (issues, pull requests, etc.) to this project
must adhere to Rust's [Code of Conduct].
@@ -94,8 +94,8 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in `libc` by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.
-[Azure Status]: https://dev.azure.com/rust-lang2/libc/_apis/build/status/rust-lang.libc?branchName=master
-[Azure]: https://dev.azure.com/rust-lang2/libc/_build/latest?definitionId=1&branchName=master
+[GitHub Actions]: https://github.com/rust-lang/libc/actions
+[GHA Status]: https://github.com/rust-lang/libc/workflows/CI/badge.svg
[Cirrus CI]: https://cirrus-ci.com/github/rust-lang/libc
[Cirrus CI Status]: https://api.cirrus-ci.com/github/rust-lang/libc.svg
[crates.io]: https://crates.io/crates/libc
diff --git a/TEST_MAPPING b/TEST_MAPPING
new file mode 100644
index 00000000..b4302fbb
--- /dev/null
+++ b/TEST_MAPPING
@@ -0,0 +1,303 @@
+// Generated by update_crate_tests.py for tests that depend on this crate.
+{
+ "presubmit": [
+ {
+ "name": "ZipFuseTest"
+ },
+ {
+ "name": "anyhow_device_test_src_lib"
+ },
+ {
+ "name": "anyhow_device_test_tests_test_autotrait"
+ },
+ {
+ "name": "anyhow_device_test_tests_test_boxed"
+ },
+ {
+ "name": "anyhow_device_test_tests_test_chain"
+ },
+ {
+ "name": "anyhow_device_test_tests_test_context"
+ },
+ {
+ "name": "anyhow_device_test_tests_test_convert"
+ },
+ {
+ "name": "anyhow_device_test_tests_test_downcast"
+ },
+ {
+ "name": "anyhow_device_test_tests_test_ffi"
+ },
+ {
+ "name": "anyhow_device_test_tests_test_fmt"
+ },
+ {
+ "name": "anyhow_device_test_tests_test_macros"
+ },
+ {
+ "name": "anyhow_device_test_tests_test_repr"
+ },
+ {
+ "name": "anyhow_device_test_tests_test_source"
+ },
+ {
+ "name": "authfs_device_test_src_lib"
+ },
+ {
+ "name": "crossbeam-epoch_device_test_src_lib"
+ },
+ {
+ "name": "crossbeam-epoch_device_test_tests_loom"
+ },
+ {
+ "name": "crossbeam-utils_device_test_src_lib"
+ },
+ {
+ "name": "crossbeam-utils_device_test_tests_atomic_cell"
+ },
+ {
+ "name": "crossbeam-utils_device_test_tests_cache_padded"
+ },
+ {
+ "name": "crossbeam-utils_device_test_tests_parker"
+ },
+ {
+ "name": "crossbeam-utils_device_test_tests_sharded_lock"
+ },
+ {
+ "name": "crossbeam-utils_device_test_tests_thread"
+ },
+ {
+ "name": "crossbeam-utils_device_test_tests_wait_group"
+ },
+ {
+ "name": "doh_unit_test"
+ },
+ {
+ "name": "futures-util_device_test_src_lib"
+ },
+ {
+ "name": "getrandom_device_test_src_lib"
+ },
+ {
+ "name": "getrandom_device_test_tests_custom"
+ },
+ {
+ "name": "getrandom_device_test_tests_normal"
+ },
+ {
+ "name": "getrandom_device_test_tests_rdrand"
+ },
+ {
+ "name": "keystore2_crypto_test_rust"
+ },
+ {
+ "name": "keystore2_km_compat_test"
+ },
+ {
+ "name": "keystore2_test"
+ },
+ {
+ "name": "libbinder_rs-internal_test"
+ },
+ {
+ "name": "libc_device_test_src_lib"
+ },
+ {
+ "name": "libc_device_test_tests_const_fn"
+ },
+ {
+ "name": "libsqlite3-sys_device_test_src_lib"
+ },
+ {
+ "name": "libz-sys_device_test_src_lib"
+ },
+ {
+ "name": "parking_lot_core_device_test_src_lib"
+ },
+ {
+ "name": "quiche_device_test_src_lib"
+ },
+ {
+ "name": "rand_core_device_test_src_lib"
+ },
+ {
+ "name": "rand_xorshift_device_test_src_lib"
+ },
+ {
+ "name": "rand_xorshift_device_test_tests_mod"
+ },
+ {
+ "name": "ring_device_test_src_lib",
+ "options": [
+ {
+ "test-timeout": "100000"
+ }
+ ]
+ },
+ {
+ "name": "ring_device_test_tests_aead_tests"
+ },
+ {
+ "name": "ring_device_test_tests_agreement_tests"
+ },
+ {
+ "name": "ring_device_test_tests_constant_time_tests"
+ },
+ {
+ "name": "ring_device_test_tests_digest_tests",
+ "options": [
+ {
+ "test-timeout": "600000"
+ }
+ ]
+ },
+ {
+ "name": "ring_device_test_tests_ecdsa_tests"
+ },
+ {
+ "name": "ring_device_test_tests_ed25519_tests"
+ },
+ {
+ "name": "ring_device_test_tests_hkdf_tests"
+ },
+ {
+ "name": "ring_device_test_tests_hmac_tests"
+ },
+ {
+ "name": "ring_device_test_tests_pbkdf2_tests"
+ },
+ {
+ "name": "ring_device_test_tests_quic_tests"
+ },
+ {
+ "name": "ring_device_test_tests_rand_tests"
+ },
+ {
+ "name": "ring_device_test_tests_rsa_tests"
+ },
+ {
+ "name": "ring_device_test_tests_signature_tests"
+ },
+ {
+ "name": "rustBinderTest"
+ },
+ {
+ "name": "rustBinderTestService"
+ },
+ {
+ "name": "shared_child_device_test_src_lib"
+ },
+ {
+ "name": "tokio-test_device_test_src_lib"
+ },
+ {
+ "name": "tokio-test_device_test_tests_block_on"
+ },
+ {
+ "name": "tokio-test_device_test_tests_io"
+ },
+ {
+ "name": "tokio-test_device_test_tests_macros"
+ },
+ {
+ "name": "tokio_device_test_tests_buffered"
+ },
+ {
+ "name": "tokio_device_test_tests_io_async_read"
+ },
+ {
+ "name": "tokio_device_test_tests_io_copy_bidirectional"
+ },
+ {
+ "name": "tokio_device_test_tests_io_lines"
+ },
+ {
+ "name": "tokio_device_test_tests_io_mem_stream"
+ },
+ {
+ "name": "tokio_device_test_tests_io_read"
+ },
+ {
+ "name": "tokio_device_test_tests_io_read_buf"
+ },
+ {
+ "name": "tokio_device_test_tests_io_read_to_end"
+ },
+ {
+ "name": "tokio_device_test_tests_io_take"
+ },
+ {
+ "name": "tokio_device_test_tests_io_write"
+ },
+ {
+ "name": "tokio_device_test_tests_io_write_all"
+ },
+ {
+ "name": "tokio_device_test_tests_io_write_buf"
+ },
+ {
+ "name": "tokio_device_test_tests_io_write_int"
+ },
+ {
+ "name": "tokio_device_test_tests_macros_join"
+ },
+ {
+ "name": "tokio_device_test_tests_no_rt"
+ },
+ {
+ "name": "tokio_device_test_tests_rt_basic"
+ },
+ {
+ "name": "tokio_device_test_tests_rt_threaded"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_barrier"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_broadcast"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_errors"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_mpsc"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_mutex_owned"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_rwlock"
+ },
+ {
+ "name": "tokio_device_test_tests_sync_watch"
+ },
+ {
+ "name": "tokio_device_test_tests_task_local"
+ },
+ {
+ "name": "tokio_device_test_tests_task_local_set"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_accept"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_echo"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_into_std"
+ },
+ {
+ "name": "tokio_device_test_tests_tcp_shutdown"
+ },
+ {
+ "name": "tokio_device_test_tests_time_rt"
+ },
+ {
+ "name": "tokio_device_test_tests_uds_split"
+ },
+ {
+ "name": "vpnprofilestore_test"
+ }
+ ]
+}
diff --git a/build.rs b/build.rs
index f447c0ef..9ebb67a8 100644
--- a/build.rs
+++ b/build.rs
@@ -3,13 +3,15 @@ use std::process::Command;
use std::str;
fn main() {
- let (rustc_minor_ver, is_nightly) =
- rustc_minor_nightly().expect("Failed to get rustc version");
+ // Avoid unnecessary re-building.
+ println!("cargo:rerun-if-changed=build.rs");
+
+ let (rustc_minor_ver, is_nightly) = rustc_minor_nightly().expect("Failed to get rustc version");
let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
let align_cargo_feature = env::var("CARGO_FEATURE_ALIGN").is_ok();
- let const_extern_fn_cargo_feature =
- env::var("CARGO_FEATURE_CONST_EXTERN_FN").is_ok();
+ let const_extern_fn_cargo_feature = env::var("CARGO_FEATURE_CONST_EXTERN_FN").is_ok();
let libc_ci = env::var("LIBC_CI").is_ok();
+ let target = env::var("TARGET").unwrap();
if env::var("CARGO_FEATURE_USE_STD").is_ok() {
println!(
@@ -65,9 +67,10 @@ fn main() {
println!("cargo:rustc-cfg=libc_core_cvoid");
}
- // Rust >= 1.33 supports repr(packed(N))
+ // Rust >= 1.33 supports repr(packed(N)) and cfg(target_vendor).
if rustc_minor_ver >= 33 || rustc_dep_of_std {
println!("cargo:rustc-cfg=libc_packedN");
+ println!("cargo:rustc-cfg=libc_cfg_target_vendor");
}
// #[thread_local] is currently unstable
@@ -81,6 +84,12 @@ fn main() {
}
println!("cargo:rustc-cfg=libc_const_extern_fn");
}
+
+ // For unknown reason, libiconv can't be linked by adding #[link(name = iconv)] to
+ // a macOS-specific struct, so we do the linking here.
+ if target.contains("-apple-") {
+ println!("cargo:rustc-link-lib=iconv");
+ }
}
fn rustc_minor_nightly() -> Option<(u32, bool)> {
diff --git a/cargo2android.json b/cargo2android.json
new file mode 100644
index 00000000..c2cbd410
--- /dev/null
+++ b/cargo2android.json
@@ -0,0 +1,13 @@
+{
+ "apex-available": [
+ "//apex_available:platform",
+ "com.android.resolv",
+ "com.android.virt"
+ ],
+ "dependencies": true,
+ "device": true,
+ "features": "default,extra_traits,std",
+ "min-sdk-version": "29",
+ "run": true,
+ "tests": true
+} \ No newline at end of file
diff --git a/patches/missing.diff b/patches/missing.diff
new file mode 100644
index 00000000..2ff68841
--- /dev/null
+++ b/patches/missing.diff
@@ -0,0 +1,78 @@
+diff --git a/src/unix/linux_like/android/b32/arm.rs b/src/unix/linux_like/android/b32/arm.rs
+index 8a53e539..6fd47679 100644
+--- a/src/unix/linux_like/android/b32/arm.rs
++++ b/src/unix/linux_like/android/b32/arm.rs
+@@ -501,6 +501,8 @@ pub const SYS_pwritev2: ::c_long = 393;
+ pub const SYS_pkey_mprotect: ::c_long = 394;
+ pub const SYS_pkey_alloc: ::c_long = 395;
+ pub const SYS_pkey_free: ::c_long = 396;
++pub const SYS_io_uring_setup: ::c_long = 425;
++pub const SYS_io_uring_enter: ::c_long = 426;
+
+ // offsets in mcontext_t.gregs from sys/ucontext.h
+ pub const REG_R0: ::c_int = 0;
+diff --git a/src/unix/linux_like/android/b32/x86/mod.rs b/src/unix/linux_like/android/b32/x86/mod.rs
+index 6507cb4e..ee537fd0 100644
+--- a/src/unix/linux_like/android/b32/x86/mod.rs
++++ b/src/unix/linux_like/android/b32/x86/mod.rs
+@@ -533,6 +533,8 @@ pub const SYS_pwritev2: ::c_long = 379;
+ pub const SYS_pkey_mprotect: ::c_long = 380;
+ pub const SYS_pkey_alloc: ::c_long = 381;
+ pub const SYS_pkey_free: ::c_long = 382;
++pub const SYS_io_uring_setup: ::c_long = 425;
++pub const SYS_io_uring_enter: ::c_long = 426;
+
+ // offsets in user_regs_structs, from sys/reg.h
+ pub const EBX: ::c_int = 0;
+diff --git a/src/unix/linux_like/android/b64/aarch64/mod.rs b/src/unix/linux_like/android/b64/aarch64/mod.rs
+index 5acb328b..316596f5 100644
+--- a/src/unix/linux_like/android/b64/aarch64/mod.rs
++++ b/src/unix/linux_like/android/b64/aarch64/mod.rs
+@@ -365,6 +365,8 @@ 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_io_uring_setup: ::c_long = 425;
++pub const SYS_io_uring_enter: ::c_long = 426;
+ pub const SYS_syscalls: ::c_long = 436;
+
+ cfg_if! {
+diff --git a/src/unix/linux_like/android/b64/x86_64/mod.rs b/src/unix/linux_like/android/b64/x86_64/mod.rs
+index 27fd17b3..5b559dde 100644
+--- a/src/unix/linux_like/android/b64/x86_64/mod.rs
++++ b/src/unix/linux_like/android/b64/x86_64/mod.rs
+@@ -602,6 +602,8 @@ pub const SYS_pwritev2: ::c_long = 328;
+ pub const SYS_pkey_mprotect: ::c_long = 329;
+ pub const SYS_pkey_alloc: ::c_long = 330;
+ pub const SYS_pkey_free: ::c_long = 331;
++pub const SYS_io_uring_setup: ::c_long = 425;
++pub const SYS_io_uring_enter: ::c_long = 426;
+
+ // offsets in user_regs_structs, from sys/reg.h
+ pub const R15: ::c_int = 0;
+diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs
+index d64a365e..541b40f3 100644
+--- a/src/unix/linux_like/android/mod.rs
++++ b/src/unix/linux_like/android/mod.rs
+@@ -2285,6 +2285,10 @@ pub const AF_VSOCK: ::c_int = 40;
+ pub const PF_NFC: ::c_int = AF_NFC;
+ pub const PF_VSOCK: ::c_int = AF_VSOCK;
+
++// sys/prctl.h
++pub const PR_GET_SECUREBITS: ::c_int = 27;
++pub const PR_SET_SECUREBITS: ::c_int = 28;
++
+ f! {
+ pub fn CMSG_NXTHDR(mhdr: *const msghdr,
+ cmsg: *const cmsghdr) -> *mut cmsghdr {
+@@ -2709,6 +2713,10 @@ extern "C" {
+ pub fn android_set_abort_message(msg: *const ::c_char);
+
+ pub fn gettid() -> ::pid_t;
++
++ pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
++
++ pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;
+ }
+
+ cfg_if! {
diff --git a/patches/std.diff b/patches/std.diff
new file mode 100644
index 00000000..f9b599df
--- /dev/null
+++ b/patches/std.diff
@@ -0,0 +1,14 @@
+Index: libc/src/lib.rs
+===================================================================
+--- libc.orig/src/lib.rs
++++ libc/src/lib.rs
+@@ -30,6 +30,9 @@
+ #![cfg_attr(target_os = "redox", feature(static_nobundle))]
+ #![cfg_attr(libc_const_extern_fn, feature(const_extern_fn))]
+
++// ANDROID: Use std to allow building as a dylib.
++extern crate std;
++
+ #[macro_use]
+ mod macros;
+
diff --git a/rustfmt.toml b/rustfmt.toml
index 7ecc610f..dc85c994 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -1,3 +1 @@
-max_width = 79
-comment_width = 79
-error_on_line_overflow = true \ No newline at end of file
+error_on_line_overflow = true
diff --git a/src/cloudabi/aarch64.rs b/src/cloudabi/aarch64.rs
deleted file mode 100644
index 4caa6d7b..00000000
--- a/src/cloudabi/aarch64.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-pub type c_char = u8;
-pub type c_long = i64;
-pub type c_ulong = u64;
-pub type wchar_t = u32;
diff --git a/src/cloudabi/arm.rs b/src/cloudabi/arm.rs
deleted file mode 100644
index eca53607..00000000
--- a/src/cloudabi/arm.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-pub type c_char = u8;
-pub type c_long = i32;
-pub type c_ulong = u32;
-pub type wchar_t = u32;
diff --git a/src/cloudabi/mod.rs b/src/cloudabi/mod.rs
deleted file mode 100644
index b3065d72..00000000
--- a/src/cloudabi/mod.rs
+++ /dev/null
@@ -1,374 +0,0 @@
-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_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 in_addr_t = u32;
-pub type in_port_t = u16;
-pub type pthread_key_t = usize;
-pub type pthread_t = usize;
-pub type sa_family_t = u8;
-pub type socklen_t = usize;
-pub type time_t = i64;
-
-s! {
- 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 in_addr {
- pub s_addr: in_addr_t,
- }
-
- pub struct in6_addr {
- pub s6_addr: [u8; 16],
- }
-
- pub struct pthread_attr_t {
- __detachstate: ::c_int,
- __stacksize: usize,
- }
-
- pub struct sockaddr {
- pub sa_family: sa_family_t,
- pub sa_data: [::c_char; 0],
- }
-
- pub struct sockaddr_in {
- pub sin_family: ::sa_family_t,
- pub sin_port: ::in_port_t,
- pub sin_addr: ::in_addr,
- }
-
- pub struct sockaddr_in6 {
- pub sin6_family: sa_family_t,
- pub sin6_port: ::in_port_t,
- pub sin6_flowinfo: u32,
- pub sin6_addr: ::in6_addr,
- pub sin6_scope_id: u32,
- }
-
- pub struct sockaddr_storage {
- pub ss_family: ::sa_family_t,
- __ss_data: [u8; 32],
- }
-}
-
-pub const INT_MIN: c_int = -2147483648;
-pub const INT_MAX: c_int = 2147483647;
-
-pub const _SC_NPROCESSORS_ONLN: ::c_int = 52;
-pub const _SC_PAGESIZE: ::c_int = 54;
-
-pub const AF_INET: ::c_int = 1;
-pub const AF_INET6: ::c_int = 2;
-
-pub const EACCES: ::c_int = 2;
-pub const EADDRINUSE: ::c_int = 3;
-pub const EADDRNOTAVAIL: ::c_int = 4;
-pub const EAGAIN: ::c_int = 6;
-pub const ECONNABORTED: ::c_int = 13;
-pub const ECONNREFUSED: ::c_int = 14;
-pub const ECONNRESET: ::c_int = 15;
-pub const EEXIST: ::c_int = 20;
-pub const EINTR: ::c_int = 27;
-pub const EINVAL: ::c_int = 28;
-pub const ENOENT: ::c_int = 44;
-pub const ENOTCONN: ::c_int = 53;
-pub const EPERM: ::c_int = 63;
-pub const EPIPE: ::c_int = 64;
-pub const ETIMEDOUT: ::c_int = 73;
-pub const EWOULDBLOCK: ::c_int = EAGAIN;
-
-pub const EAI_SYSTEM: ::c_int = 9;
-
-pub const EXIT_FAILURE: ::c_int = 1;
-pub const EXIT_SUCCESS: ::c_int = 0;
-
-pub const PTHREAD_STACK_MIN: ::size_t = 1024;
-
-pub const SOCK_DGRAM: ::c_int = 128;
-pub const SOCK_STREAM: ::c_int = 130;
-
-#[cfg_attr(feature = "extra_traits", derive(Debug))]
-pub enum FILE {}
-impl ::Copy for FILE {}
-impl ::Clone for FILE {
- fn clone(&self) -> FILE {
- *self
- }
-}
-#[cfg_attr(feature = "extra_traits", derive(Debug))]
-pub enum fpos_t {} // TODO: fill this out with a struct
-impl ::Copy for fpos_t {}
-impl ::Clone for fpos_t {
- fn clone(&self) -> fpos_t {
- *self
- }
-}
-
-extern "C" {
- pub fn isalnum(c: c_int) -> c_int;
- pub fn isalpha(c: c_int) -> c_int;
- pub fn iscntrl(c: c_int) -> c_int;
- pub fn isdigit(c: c_int) -> c_int;
- pub fn isgraph(c: c_int) -> c_int;
- pub fn islower(c: c_int) -> c_int;
- pub fn isprint(c: c_int) -> c_int;
- pub fn ispunct(c: c_int) -> c_int;
- pub fn isspace(c: c_int) -> c_int;
- pub fn isupper(c: c_int) -> c_int;
- pub fn isxdigit(c: c_int) -> c_int;
- pub fn isblank(c: c_int) -> c_int;
- pub fn tolower(c: c_int) -> c_int;
- pub fn toupper(c: c_int) -> c_int;
- pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
- pub fn freopen(
- filename: *const c_char,
- mode: *const c_char,
- file: *mut FILE,
- ) -> *mut FILE;
- pub fn fflush(file: *mut FILE) -> c_int;
- pub fn fclose(file: *mut FILE) -> c_int;
- pub fn remove(filename: *const c_char) -> c_int;
- pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
- pub fn tmpfile() -> *mut FILE;
- pub fn setvbuf(
- stream: *mut FILE,
- buffer: *mut c_char,
- mode: c_int,
- size: size_t,
- ) -> c_int;
- pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
- pub fn getchar() -> c_int;
- pub fn putchar(c: c_int) -> c_int;
- pub fn fgetc(stream: *mut FILE) -> c_int;
- pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
- -> *mut c_char;
- pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
- pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
- pub fn puts(s: *const c_char) -> c_int;
- pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
- pub fn fread(
- ptr: *mut c_void,
- size: size_t,
- nobj: size_t,
- stream: *mut FILE,
- ) -> size_t;
- pub fn fwrite(
- ptr: *const c_void,
- size: size_t,
- nobj: size_t,
- stream: *mut FILE,
- ) -> size_t;
- pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
- pub fn ftell(stream: *mut FILE) -> c_long;
- pub fn rewind(stream: *mut FILE);
- pub fn fgetpos(stream: *mut FILE, ptr: *mut fpos_t) -> c_int;
- pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
- pub fn feof(stream: *mut FILE) -> c_int;
- pub fn ferror(stream: *mut FILE) -> c_int;
- pub fn perror(s: *const c_char);
- pub fn atoi(s: *const c_char) -> c_int;
- pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
- pub fn strtol(
- s: *const c_char,
- endp: *mut *mut c_char,
- base: c_int,
- ) -> c_long;
- pub fn strtoul(
- s: *const c_char,
- endp: *mut *mut c_char,
- base: c_int,
- ) -> c_ulong;
- 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 free(p: *mut c_void);
- pub fn abort() -> !;
- pub fn exit(status: c_int) -> !;
- pub fn _exit(status: c_int) -> !;
- pub fn atexit(cb: extern "C" fn()) -> c_int;
- pub fn system(s: *const c_char) -> c_int;
- pub fn getenv(s: *const c_char) -> *mut c_char;
- pub fn getline(
- lineptr: *mut *mut c_char,
- n: *mut size_t,
- stream: *mut FILE,
- ) -> ssize_t;
-
- pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
- pub fn strncpy(
- dst: *mut c_char,
- src: *const c_char,
- n: size_t,
- ) -> *mut c_char;
- pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
- pub fn strncat(
- s: *mut c_char,
- ct: *const c_char,
- n: size_t,
- ) -> *mut c_char;
- pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
- pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
- pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
- pub fn strchr(cs: *const c_char, c: c_int) -> *mut c_char;
- pub fn strrchr(cs: *const c_char, c: c_int) -> *mut c_char;
- pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
- pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
- pub fn strdup(cs: *const c_char) -> *mut c_char;
- pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char;
- pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
- pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int;
- pub fn strncasecmp(
- s1: *const c_char,
- s2: *const c_char,
- n: size_t,
- ) -> c_int;
- pub fn strlen(cs: *const c_char) -> size_t;
- pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
- pub fn strerror(n: c_int) -> *mut c_char;
- pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
- pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
- pub fn wcslen(buf: *const wchar_t) -> size_t;
- pub fn wcstombs(
- dest: *mut c_char,
- src: *const wchar_t,
- n: size_t,
- ) -> ::size_t;
-
- pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
- 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;
-
- pub fn abs(i: c_int) -> c_int;
- pub fn atof(s: *const c_char) -> c_double;
- pub fn labs(i: c_long) -> c_long;
- pub fn rand() -> c_int;
- pub fn srand(seed: c_uint);
-
- pub fn arc4random_buf(buf: *const ::c_void, len: ::size_t);
- pub fn freeaddrinfo(res: *mut addrinfo);
- pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char;
- pub fn getaddrinfo(
- node: *const c_char,
- service: *const c_char,
- hints: *const addrinfo,
- res: *mut *mut addrinfo,
- ) -> ::c_int;
- pub fn getsockopt(
- sockfd: ::c_int,
- level: ::c_int,
- optname: ::c_int,
- optval: *mut ::c_void,
- optlen: *mut ::socklen_t,
- ) -> ::c_int;
- pub fn posix_memalign(
- memptr: *mut *mut ::c_void,
- align: ::size_t,
- size: ::size_t,
- ) -> ::c_int;
- pub fn pthread_attr_destroy(attr: *mut ::pthread_attr_t) -> ::c_int;
- pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
- pub fn pthread_attr_setstacksize(
- attr: *mut ::pthread_attr_t,
- stack_size: ::size_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_detach(thread: ::pthread_t) -> ::c_int;
- pub fn pthread_getspecific(key: pthread_key_t) -> *mut ::c_void;
- pub fn pthread_join(
- native: ::pthread_t,
- value: *mut *mut ::c_void,
- ) -> ::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_setspecific(
- key: pthread_key_t,
- value: *const ::c_void,
- ) -> ::c_int;
- pub fn send(
- socket: ::c_int,
- buf: *const ::c_void,
- len: ::size_t,
- flags: ::c_int,
- ) -> ::ssize_t;
- pub fn sysconf(name: ::c_int) -> ::c_long;
-}
-
-cfg_if! {
- if #[cfg(target_arch = "aarch64")] {
- mod aarch64;
- pub use self::aarch64::*;
- } else if #[cfg(any(target_arch = "arm"))] {
- mod arm;
- pub use self::arm::*;
- } else if #[cfg(any(target_arch = "x86"))] {
- mod x86;
- pub use self::x86::*;
- } else if #[cfg(any(target_arch = "x86_64"))] {
- mod x86_64;
- pub use self::x86_64::*;
- } else {
- // Unknown target_arch
- }
-}
-
-cfg_if! {
- if #[cfg(libc_core_cvoid)] {
- pub use ::ffi::c_void;
- } else {
- // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
- // enable more optimization opportunities around it recognizing things
- // like malloc/free.
- #[repr(u8)]
- #[allow(missing_copy_implementations)]
- #[allow(missing_debug_implementations)]
- pub enum c_void {
- // Two dummy variants so the #[repr] attribute can be used.
- #[doc(hidden)]
- __variant1,
- #[doc(hidden)]
- __variant2,
- }
- }
-}
diff --git a/src/cloudabi/x86.rs b/src/cloudabi/x86.rs
deleted file mode 100644
index 2f9f39c9..00000000
--- a/src/cloudabi/x86.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-pub type c_char = i8;
-pub type c_long = i32;
-pub type c_ulong = u32;
-pub type wchar_t = i32;
diff --git a/src/cloudabi/x86_64.rs b/src/cloudabi/x86_64.rs
deleted file mode 100644
index bb17624b..00000000
--- a/src/cloudabi/x86_64.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-pub type c_char = i8;
-pub type c_long = i64;
-pub type c_ulong = u64;
-pub type wchar_t = i32;
diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs
index 7d23e671..616655a0 100644
--- a/src/fuchsia/mod.rs
+++ b/src/fuchsia/mod.rs
@@ -109,7 +109,7 @@ impl ::Clone for DIR {
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
-pub enum fpos64_t {} // TODO: fill this out with a struct
+pub enum fpos64_t {} // FIXME: fill this out with a struct
impl ::Copy for fpos64_t {}
impl ::Clone for fpos64_t {
fn clone(&self) -> fpos64_t {
@@ -209,6 +209,12 @@ s! {
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 ipv6_mreq {
pub ipv6mr_multiaddr: in6_addr,
pub ipv6mr_interface: ::c_uint,
@@ -1327,6 +1333,7 @@ pub const S_ISGID: ::c_int = 0x400;
pub const S_ISVTX: ::c_int = 0x200;
pub const IF_NAMESIZE: ::size_t = 16;
+pub const IFNAMSIZ: ::size_t = IF_NAMESIZE;
pub const LOG_EMERG: ::c_int = 0;
pub const LOG_ALERT: ::c_int = 1;
@@ -1416,7 +1423,7 @@ pub const F_SEAL_SHRINK: ::c_int = 0x0002;
pub const F_SEAL_GROW: ::c_int = 0x0004;
pub const F_SEAL_WRITE: ::c_int = 0x0008;
-// TODO(#235): Include file sealing fcntls once we have a way to verify them.
+// FIXME(#235): Include file sealing fcntls once we have a way to verify them.
pub const SIGTRAP: ::c_int = 5;
@@ -1433,10 +1440,8 @@ pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6;
pub const CLOCK_BOOTTIME: ::clockid_t = 7;
pub const CLOCK_REALTIME_ALARM: ::clockid_t = 8;
pub const CLOCK_BOOTTIME_ALARM: ::clockid_t = 9;
-// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep
-// 2014.) See also musl/mod.rs
-// pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
-// pub const CLOCK_TAI: ::clockid_t = 11;
+pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
+pub const CLOCK_TAI: ::clockid_t = 11;
pub const TIMER_ABSTIME: ::c_int = 1;
pub const RLIMIT_CPU: ::c_int = 0;
@@ -1456,8 +1461,6 @@ pub const O_RDONLY: ::c_int = 0;
pub const O_WRONLY: ::c_int = 1;
pub const O_RDWR: ::c_int = 2;
-pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
-
pub const S_IFIFO: ::mode_t = 4096;
pub const S_IFCHR: ::mode_t = 8192;
pub const S_IFBLK: ::mode_t = 24576;
@@ -1509,12 +1512,12 @@ 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_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
-pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
-pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
-pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE);
-pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY);
-pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES);
+pub const LC_CTYPE_MASK: ::c_int = 1 << LC_CTYPE;
+pub const LC_NUMERIC_MASK: ::c_int = 1 << LC_NUMERIC;
+pub const LC_TIME_MASK: ::c_int = 1 << LC_TIME;
+pub const LC_COLLATE_MASK: ::c_int = 1 << LC_COLLATE;
+pub const LC_MONETARY_MASK: ::c_int = 1 << LC_MONETARY;
+pub const LC_MESSAGES_MASK: ::c_int = 1 << LC_MESSAGES;
// LC_ALL_MASK defined per platform
pub const MAP_FILE: ::c_int = 0x0000;
@@ -1764,14 +1767,17 @@ pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
pub const SOCK_RAW: ::c_int = 3;
pub const SOCK_RDM: ::c_int = 4;
+
+pub const IP_TTL: ::c_int = 2;
+pub const IP_HDRINCL: ::c_int = 3;
+pub const IP_FREEBIND: ::c_int = 15;
+pub const IP_TRANSPARENT: ::c_int = 19;
pub const IP_MULTICAST_IF: ::c_int = 32;
pub const IP_MULTICAST_TTL: ::c_int = 33;
pub const IP_MULTICAST_LOOP: ::c_int = 34;
-pub const IP_TTL: ::c_int = 2;
-pub const IP_HDRINCL: ::c_int = 3;
pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
-pub const IP_TRANSPARENT: ::c_int = 19;
+
pub const IPV6_UNICAST_HOPS: ::c_int = 16;
pub const IPV6_MULTICAST_IF: ::c_int = 17;
pub const IPV6_MULTICAST_HOPS: ::c_int = 18;
@@ -1968,6 +1974,7 @@ pub const POSIX_FADV_WILLNEED: ::c_int = 3;
pub const AT_FDCWD: ::c_int = -100;
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100;
pub const AT_REMOVEDIR: ::c_int = 0x200;
+pub const AT_EACCESS: ::c_int = 0x200;
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
pub const AT_NO_AUTOMOUNT: ::c_int = 0x800;
pub const AT_EMPTY_PATH: ::c_int = 0x1000;
@@ -1981,6 +1988,13 @@ pub const PIPE_BUF: usize = 4096;
pub const SI_LOAD_SHIFT: ::c_uint = 16;
+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 SIGEV_SIGNAL: ::c_int = 0;
pub const SIGEV_NONE: ::c_int = 1;
pub const SIGEV_THREAD: ::c_int = 2;
@@ -2691,7 +2705,7 @@ pub const FOPEN_MAX: ::c_uint = 1000;
pub const O_PATH: ::c_int = 0x00400000;
pub const O_EXEC: ::c_int = O_PATH;
pub const O_SEARCH: ::c_int = O_PATH;
-pub const O_ACCMODE: ::c_int = (03 | O_SEARCH);
+pub const O_ACCMODE: ::c_int = 03 | O_SEARCH;
pub const O_NDELAY: ::c_int = O_NONBLOCK;
pub const NI_MAXHOST: ::socklen_t = 255;
pub const PTHREAD_STACK_MIN: ::size_t = 2048;
@@ -2773,11 +2787,6 @@ pub const TIOCINQ: ::c_int = ::FIONREAD;
pub const RTLD_GLOBAL: ::c_int = 0x100;
pub const RTLD_NOLOAD: ::c_int = 0x4;
-// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux
-// kernel 3.10). See also notbsd/mod.rs
-pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
-pub const CLOCK_TAI: ::clockid_t = 11;
-
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
@@ -2893,11 +2902,12 @@ pub const O_CREAT: ::c_int = 0x00010000;
pub const O_EXCL: ::c_int = 0x00020000;
pub const O_NOCTTY: ::c_int = 0x00000200;
pub const O_NONBLOCK: ::c_int = 0x00000010;
-pub const O_SYNC: ::c_int = (0x00000040 | O_DSYNC);
+pub const O_SYNC: ::c_int = 0x00000040 | O_DSYNC;
pub const O_RSYNC: ::c_int = O_SYNC;
pub const O_DSYNC: ::c_int = 0x00000020;
-pub const SOCK_NONBLOCK: ::c_int = 2048;
+pub const SOCK_CLOEXEC: ::c_int = 0o2000000;
+pub const SOCK_NONBLOCK: ::c_int = 0o4000;
pub const MAP_ANON: ::c_int = 0x0020;
pub const MAP_GROWSDOWN: ::c_int = 0x0100;
@@ -3164,42 +3174,6 @@ f! {
}
}
- pub fn WIFSTOPPED(status: ::c_int) -> bool {
- (status & 0xff) == 0x7f
- }
-
- pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
- (status >> 8) & 0xff
- }
-
- pub fn WIFCONTINUED(status: ::c_int) -> bool {
- status == 0xffff
- }
-
- pub fn WIFSIGNALED(status: ::c_int) -> bool {
- ((status & 0x7f) + 1) as i8 >= 2
- }
-
- pub fn WTERMSIG(status: ::c_int) -> ::c_int {
- status & 0x7f
- }
-
- pub fn WIFEXITED(status: ::c_int) -> bool {
- (status & 0x7f) == 0
- }
-
- pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
- (status >> 8) & 0xff
- }
-
- pub fn WCOREDUMP(status: ::c_int) -> bool {
- (status & 0x80) != 0
- }
-
- pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
- (cmd << 8) | (type_ & 0x00ff)
- }
-
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
for slot in cpuset.bits.iter_mut() {
*slot = 0;
@@ -3256,6 +3230,96 @@ f! {
dev |= (minor & 0xffffff00) << 12;
dev
}
+
+ pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar {
+ cmsg.offset(1) as *mut c_uchar
+ }
+
+ pub fn CMSG_NXTHDR(mhdr: *const msghdr, cmsg: *const cmsghdr)
+ -> *mut cmsghdr
+ {
+ if ((*cmsg).cmsg_len as ::size_t) < ::mem::size_of::<cmsghdr>() {
+ 0 as *mut cmsghdr
+ } else if __CMSG_NEXT(cmsg).add(::mem::size_of::<cmsghdr>())
+ >= __MHDR_END(mhdr) {
+ 0 as *mut cmsghdr
+ } else {
+ __CMSG_NEXT(cmsg).cast()
+ }
+ }
+
+ pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
+ if (*mhdr).msg_controllen as ::size_t >= ::mem::size_of::<cmsghdr>() {
+ (*mhdr).msg_control.cast()
+ } else {
+ 0 as *mut cmsghdr
+ }
+ }
+
+ pub {const} fn CMSG_ALIGN(len: ::size_t) -> ::size_t {
+ (len + ::mem::size_of::<::size_t>() - 1)
+ & !(::mem::size_of::<::size_t>() - 1)
+ }
+
+ pub {const} fn CMSG_SPACE(len: ::c_uint) -> ::c_uint {
+ (CMSG_ALIGN(len as ::size_t) + CMSG_ALIGN(::mem::size_of::<cmsghdr>()))
+ as ::c_uint
+ }
+
+ pub fn CMSG_LEN(len: ::c_uint) -> ::c_uint {
+ (CMSG_ALIGN(::mem::size_of::<cmsghdr>()) + len as ::size_t) as ::c_uint
+ }
+}
+
+safe_f! {
+ 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 QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
+ (cmd << 8) | (type_ & 0x00ff)
+ }
+}
+
+fn __CMSG_LEN(cmsg: *const cmsghdr) -> ::ssize_t {
+ ((unsafe { (*cmsg).cmsg_len as ::size_t } + ::mem::size_of::<::c_long>() - 1)
+ & !(::mem::size_of::<::c_long>() - 1)) as ::ssize_t
+}
+
+fn __CMSG_NEXT(cmsg: *const cmsghdr) -> *mut c_uchar {
+ (unsafe { cmsg.offset(__CMSG_LEN(cmsg)) }) as *mut c_uchar
+}
+
+fn __MHDR_END(mhdr: *const msghdr) -> *mut c_uchar {
+ unsafe { (*mhdr).msg_control.offset((*mhdr).msg_controllen as isize) }.cast()
}
// EXTERN_FN
@@ -3273,7 +3337,7 @@ impl ::Clone for FILE {
}
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
-pub enum fpos_t {} // TODO: fill this out with a struct
+pub enum fpos_t {} // FIXME: fill this out with a struct
impl ::Copy for fpos_t {}
impl ::Clone for fpos_t {
fn clone(&self) -> fpos_t {
@@ -3297,44 +3361,24 @@ extern "C" {
pub fn tolower(c: c_int) -> c_int;
pub fn toupper(c: c_int) -> c_int;
pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
- pub fn freopen(
- filename: *const c_char,
- mode: *const c_char,
- file: *mut FILE,
- ) -> *mut FILE;
+ pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE;
pub fn fflush(file: *mut FILE) -> c_int;
pub fn fclose(file: *mut FILE) -> c_int;
pub fn remove(filename: *const c_char) -> c_int;
pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
pub fn tmpfile() -> *mut FILE;
- pub fn setvbuf(
- stream: *mut FILE,
- buffer: *mut c_char,
- mode: c_int,
- size: size_t,
- ) -> c_int;
+ pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int;
pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
pub fn getchar() -> c_int;
pub fn putchar(c: c_int) -> c_int;
pub fn fgetc(stream: *mut FILE) -> c_int;
- pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
- -> *mut c_char;
+ pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
pub fn puts(s: *const c_char) -> c_int;
pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
- pub fn fread(
- ptr: *mut c_void,
- size: size_t,
- nobj: size_t,
- stream: *mut FILE,
- ) -> size_t;
- pub fn fwrite(
- ptr: *const c_void,
- size: size_t,
- nobj: size_t,
- stream: *mut FILE,
- ) -> size_t;
+ pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
+ pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
pub fn ftell(stream: *mut FILE) -> c_long;
pub fn rewind(stream: *mut FILE);
@@ -3345,16 +3389,8 @@ extern "C" {
pub fn perror(s: *const c_char);
pub fn atoi(s: *const c_char) -> c_int;
pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
- pub fn strtol(
- s: *const c_char,
- endp: *mut *mut c_char,
- base: c_int,
- ) -> c_long;
- pub fn strtoul(
- s: *const c_char,
- endp: *mut *mut c_char,
- base: c_int,
- ) -> c_ulong;
+ pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long;
+ pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong;
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;
@@ -3367,17 +3403,9 @@ extern "C" {
pub fn getenv(s: *const c_char) -> *mut c_char;
pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
- pub fn strncpy(
- dst: *mut c_char,
- src: *const c_char,
- n: size_t,
- ) -> *mut c_char;
+ pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
- pub fn strncat(
- s: *mut c_char,
- ct: *const c_char,
- n: size_t,
- ) -> *mut c_char;
+ pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char;
pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
@@ -3394,24 +3422,13 @@ extern "C" {
pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
pub fn wcslen(buf: *const wchar_t) -> size_t;
- pub fn wcstombs(
- dest: *mut c_char,
- src: *const wchar_t,
- n: size_t,
- ) -> ::size_t;
+ pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t;
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 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;
pub fn abs(i: c_int) -> c_int;
@@ -3423,42 +3440,20 @@ extern "C" {
pub fn getpwnam(name: *const ::c_char) -> *mut passwd;
pub fn getpwuid(uid: ::uid_t) -> *mut passwd;
- pub fn fprintf(
- stream: *mut ::FILE,
- format: *const ::c_char,
- ...
- ) -> ::c_int;
+ pub fn fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
pub fn printf(format: *const ::c_char, ...) -> ::c_int;
- pub fn snprintf(
- s: *mut ::c_char,
- n: ::size_t,
- format: *const ::c_char,
- ...
- ) -> ::c_int;
+ pub fn snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int;
pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
- pub fn fscanf(
- stream: *mut ::FILE,
- format: *const ::c_char,
- ...
- ) -> ::c_int;
+ pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
- pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...)
- -> ::c_int;
+ pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int;
pub fn getchar_unlocked() -> ::c_int;
pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
- pub fn connect(
- socket: ::c_int,
- address: *const sockaddr,
- len: socklen_t,
- ) -> ::c_int;
+ pub fn connect(socket: ::c_int, address: *const sockaddr, len: socklen_t) -> ::c_int;
pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
- pub fn accept(
- socket: ::c_int,
- address: *mut sockaddr,
- address_len: *mut socklen_t,
- ) -> ::c_int;
+ pub fn accept(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int;
pub fn getpeername(
socket: ::c_int,
address: *mut sockaddr,
@@ -3511,20 +3506,12 @@ extern "C" {
pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent;
- pub fn readdir_r(
- dirp: *mut ::DIR,
- entry: *mut ::dirent,
- result: *mut *mut ::dirent,
- ) -> ::c_int;
+ pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, result: *mut *mut ::dirent)
+ -> ::c_int;
pub fn closedir(dirp: *mut ::DIR) -> ::c_int;
pub fn rewinddir(dirp: *mut ::DIR);
- pub fn openat(
- dirfd: ::c_int,
- pathname: *const ::c_char,
- flags: ::c_int,
- ...
- ) -> ::c_int;
+ pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int, ...) -> ::c_int;
pub fn fchmodat(
dirfd: ::c_int,
pathname: *const ::c_char,
@@ -3552,11 +3539,7 @@ extern "C" {
newpath: *const ::c_char,
flags: ::c_int,
) -> ::c_int;
- pub fn mkdirat(
- dirfd: ::c_int,
- pathname: *const ::c_char,
- mode: ::mode_t,
- ) -> ::c_int;
+ pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int;
pub fn readlinkat(
dirfd: ::c_int,
pathname: *const ::c_char,
@@ -3574,11 +3557,7 @@ extern "C" {
newdirfd: ::c_int,
linkpath: *const ::c_char,
) -> ::c_int;
- pub fn unlinkat(
- dirfd: ::c_int,
- pathname: *const ::c_char,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int) -> ::c_int;
pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
pub fn alarm(seconds: ::c_uint) -> ::c_uint;
@@ -3589,16 +3568,8 @@ extern "C" {
pub fn dup(fd: ::c_int) -> ::c_int;
pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int;
- pub fn execle(
- path: *const ::c_char,
- arg0: *const ::c_char,
- ...
- ) -> ::c_int;
- pub fn execlp(
- file: *const ::c_char,
- arg0: *const ::c_char,
- ...
- ) -> ::c_int;
+ pub fn execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int;
+ pub fn execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int;
pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int;
pub fn execve(
prog: *const c_char,
@@ -3614,11 +3585,7 @@ extern "C" {
pub fn getgid() -> gid_t;
pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int;
pub fn getlogin() -> *mut c_char;
- pub fn getopt(
- argc: ::c_int,
- argv: *const *mut c_char,
- optstr: *const c_char,
- ) -> ::c_int;
+ pub fn getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int;
pub fn getpgid(pid: pid_t) -> pid_t;
pub fn getpgrp() -> pid_t;
pub fn getpid() -> pid_t;
@@ -3630,13 +3597,8 @@ extern "C" {
pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
pub fn pause() -> ::c_int;
pub fn pipe(fds: *mut ::c_int) -> ::c_int;
- pub fn posix_memalign(
- memptr: *mut *mut ::c_void,
- align: ::size_t,
- size: ::size_t,
- ) -> ::c_int;
- pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t)
- -> ::ssize_t;
+ pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int;
+ pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t;
pub fn rmdir(path: *const c_char) -> ::c_int;
pub fn seteuid(uid: uid_t) -> ::c_int;
pub fn setegid(gid: gid_t) -> ::c_int;
@@ -3651,28 +3613,10 @@ extern "C" {
pub fn ttyname(fd: ::c_int) -> *mut c_char;
pub fn unlink(c: *const c_char) -> ::c_int;
pub fn wait(status: *mut ::c_int) -> pid_t;
- pub fn waitpid(
- pid: pid_t,
- status: *mut ::c_int,
- options: ::c_int,
- ) -> pid_t;
- pub fn write(
- fd: ::c_int,
- buf: *const ::c_void,
- count: ::size_t,
- ) -> ::ssize_t;
- pub fn pread(
- fd: ::c_int,
- buf: *mut ::c_void,
- count: ::size_t,
- offset: off_t,
- ) -> ::ssize_t;
- pub fn pwrite(
- fd: ::c_int,
- buf: *const ::c_void,
- count: ::size_t,
- offset: off_t,
- ) -> ::ssize_t;
+ pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) -> pid_t;
+ pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t;
+ pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t;
+ pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t;
pub fn umask(mask: mode_t) -> mode_t;
pub fn utime(file: *const c_char, buf: *const utimbuf) -> ::c_int;
@@ -3695,20 +3639,13 @@ extern "C" {
pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint;
- pub fn if_indextoname(
- ifindex: ::c_uint,
- ifname: *mut ::c_char,
- ) -> *mut ::c_char;
+ pub fn if_indextoname(ifindex: ::c_uint, ifname: *mut ::c_char) -> *mut ::c_char;
pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
pub fn fsync(fd: ::c_int) -> ::c_int;
- pub fn setenv(
- name: *const c_char,
- val: *const c_char,
- overwrite: ::c_int,
- ) -> ::c_int;
+ pub fn setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int) -> ::c_int;
pub fn unsetenv(name: *const c_char) -> ::c_int;
pub fn symlink(path1: *const c_char, path2: *const c_char) -> ::c_int;
@@ -3717,10 +3654,7 @@ extern "C" {
pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t;
- pub fn realpath(
- pathname: *const ::c_char,
- resolved: *mut ::c_char,
- ) -> *mut ::c_char;
+ pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char;
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
@@ -3728,21 +3662,12 @@ extern "C" {
pub fn times(buf: *mut ::tms) -> ::clock_t;
pub fn pthread_self() -> ::pthread_t;
- pub fn pthread_join(
- native: ::pthread_t,
- value: *mut *mut ::c_void,
- ) -> ::c_int;
+ pub fn pthread_join(native: ::pthread_t, value: *mut *mut ::c_void) -> ::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_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_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;
pub fn sched_yield() -> ::c_int;
pub fn pthread_key_create(
@@ -3751,10 +3676,7 @@ extern "C" {
) -> ::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_setspecific(key: pthread_key_t, value: *const ::c_void) -> ::c_int;
pub fn pthread_mutex_init(
lock: *mut pthread_mutex_t,
attr: *const pthread_mutexattr_t,
@@ -3765,22 +3687,12 @@ extern "C" {
pub fn pthread_mutex_unlock(lock: *mut pthread_mutex_t) -> ::c_int;
pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int;
- pub fn pthread_mutexattr_destroy(
- 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_destroy(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_cond_init(
- cond: *mut pthread_cond_t,
- attr: *const pthread_condattr_t,
- ) -> ::c_int;
- pub fn pthread_cond_wait(
- cond: *mut pthread_cond_t,
- lock: *mut pthread_mutex_t,
- ) -> ::c_int;
+ pub fn pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t)
+ -> ::c_int;
+ pub fn pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> ::c_int;
pub fn pthread_cond_timedwait(
cond: *mut pthread_cond_t,
lock: *mut pthread_mutex_t,
@@ -3801,16 +3713,9 @@ extern "C" {
pub fn pthread_rwlock_wrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
pub fn pthread_rwlock_trywrlock(lock: *mut pthread_rwlock_t) -> ::c_int;
pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
- pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t)
- -> ::c_int;
- pub fn pthread_rwlockattr_destroy(
- attr: *mut pthread_rwlockattr_t,
- ) -> ::c_int;
- pub fn strerror_r(
- errnum: ::c_int,
- buf: *mut c_char,
- buflen: ::size_t,
- ) -> ::c_int;
+ pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int;
+ pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int;
+ pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
pub fn getsockopt(
sockfd: ::c_int,
@@ -3820,22 +3725,12 @@ extern "C" {
optlen: *mut ::socklen_t,
) -> ::c_int;
pub fn raise(signum: ::c_int) -> ::c_int;
- pub fn sigaction(
- signum: ::c_int,
- act: *const sigaction,
- oldact: *mut sigaction,
- ) -> ::c_int;
+ pub fn sigaction(signum: ::c_int, act: *const sigaction, oldact: *mut sigaction) -> ::c_int;
- pub fn utimes(
- filename: *const ::c_char,
- times: *const ::timeval,
- ) -> ::c_int;
+ pub fn utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int;
pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
pub fn dlerror() -> *mut ::c_char;
- pub fn dlsym(
- handle: *mut ::c_void,
- symbol: *const ::c_char,
- ) -> *mut ::c_void;
+ pub fn dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void;
pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int;
@@ -3856,32 +3751,15 @@ extern "C" {
pub fn gmtime(time_p: *const time_t) -> *mut tm;
pub fn localtime(time_p: *const time_t) -> *mut tm;
- pub fn mknod(
- pathname: *const ::c_char,
- mode: ::mode_t,
- dev: ::dev_t,
- ) -> ::c_int;
+ pub fn mknod(pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t) -> ::c_int;
pub fn uname(buf: *mut ::utsname) -> ::c_int;
pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
- pub fn getservbyname(
- name: *const ::c_char,
- proto: *const ::c_char,
- ) -> *mut servent;
+ pub fn getservbyname(name: *const ::c_char, proto: *const ::c_char) -> *mut servent;
pub fn getprotobyname(name: *const ::c_char) -> *mut protoent;
pub fn getprotobynumber(proto: ::c_int) -> *mut protoent;
pub fn usleep(secs: ::c_uint) -> ::c_int;
- pub fn send(
- socket: ::c_int,
- buf: *const ::c_void,
- len: ::size_t,
- flags: ::c_int,
- ) -> ::ssize_t;
- pub fn recv(
- socket: ::c_int,
- buf: *mut ::c_void,
- len: ::size_t,
- flags: ::c_int,
- ) -> ::ssize_t;
+ pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t;
+ pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t;
pub fn putenv(string: *mut c_char) -> ::c_int;
pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
pub fn select(
@@ -3891,29 +3769,18 @@ extern "C" {
errorfds: *mut fd_set,
timeout: *mut timeval,
) -> ::c_int;
- pub fn setlocale(
- category: ::c_int,
- locale: *const ::c_char,
- ) -> *mut ::c_char;
+ pub fn setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char;
pub fn localeconv() -> *mut lconv;
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
pub fn sem_wait(sem: *mut sem_t) -> ::c_int;
pub fn sem_trywait(sem: *mut sem_t) -> ::c_int;
pub fn sem_post(sem: *mut sem_t) -> ::c_int;
- pub fn sem_init(
- sem: *mut sem_t,
- pshared: ::c_int,
- value: ::c_uint,
- ) -> ::c_int;
+ pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int;
pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int;
pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int;
- pub fn readlink(
- path: *const c_char,
- buf: *mut c_char,
- bufsz: ::size_t,
- ) -> ::ssize_t;
+ pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t;
pub fn sigemptyset(set: *mut sigset_t) -> ::c_int;
pub fn sigaddset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
@@ -3921,11 +3788,7 @@ extern "C" {
pub fn sigdelset(set: *mut sigset_t, signum: ::c_int) -> ::c_int;
pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int;
- pub fn sigprocmask(
- how: ::c_int,
- set: *const sigset_t,
- oldset: *mut sigset_t,
- ) -> ::c_int;
+ pub fn sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int;
pub fn sigpending(set: *mut sigset_t) -> ::c_int;
pub fn timegm(tm: *mut ::tm) -> time_t;
@@ -3944,11 +3807,7 @@ extern "C" {
timeout: *const timespec,
sigmask: *const sigset_t,
) -> ::c_int;
- pub fn fseeko(
- stream: *mut ::FILE,
- offset: ::off_t,
- whence: ::c_int,
- ) -> ::c_int;
+ pub fn fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int;
pub fn ftello(stream: *mut ::FILE) -> ::off_t;
pub fn tcdrain(fd: ::c_int) -> ::c_int;
pub fn cfgetispeed(termios: *const ::termios) -> ::speed_t;
@@ -3958,11 +3817,7 @@ extern "C" {
pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
pub fn cfsetspeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int;
- pub fn tcsetattr(
- fd: ::c_int,
- optional_actions: ::c_int,
- termios: *const ::termios,
- ) -> ::c_int;
+ pub fn tcsetattr(fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios) -> ::c_int;
pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int;
pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int;
pub fn tcgetsid(fd: ::c_int) -> ::pid_t;
@@ -3985,16 +3840,10 @@ extern "C" {
pub fn fdatasync(fd: ::c_int) -> ::c_int;
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_settime(
- clk_id: ::clockid_t,
- tp: *const ::timespec,
- ) -> ::c_int;
+ pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
- pub fn pthread_getattr_np(
- native: ::pthread_t,
- attr: *mut ::pthread_attr_t,
- ) -> ::c_int;
+ pub fn pthread_getattr_np(native: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int;
pub fn pthread_attr_getstack(
attr: *const ::pthread_attr_t,
stackaddr: *mut *mut ::c_void,
@@ -4005,18 +3854,9 @@ extern "C" {
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
- pub fn memrchr(
- cx: *const ::c_void,
- c: ::c_int,
- n: ::size_t,
- ) -> *mut ::c_void;
+ pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
- pub fn posix_fadvise(
- fd: ::c_int,
- offset: ::off_t,
- len: ::off_t,
- advise: ::c_int,
- ) -> ::c_int;
+ pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advise: ::c_int) -> ::c_int;
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
pub fn utimensat(
dirfd: ::c_int,
@@ -4026,11 +3866,7 @@ extern "C" {
) -> ::c_int;
pub fn duplocale(base: ::locale_t) -> ::locale_t;
pub fn freelocale(loc: ::locale_t);
- pub fn newlocale(
- mask: ::c_int,
- locale: *const ::c_char,
- base: ::locale_t,
- ) -> ::locale_t;
+ pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t;
pub fn uselocale(loc: ::locale_t) -> ::locale_t;
pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
@@ -4055,30 +3891,14 @@ extern "C" {
len: *mut ::socklen_t,
flg: ::c_int,
) -> ::c_int;
- pub fn ptsname_r(
- fd: ::c_int,
- buf: *mut ::c_char,
- buflen: ::size_t,
- ) -> ::c_int;
+ pub fn ptsname_r(fd: ::c_int, buf: *mut ::c_char, buflen: ::size_t) -> ::c_int;
pub fn clearenv() -> ::c_int;
- pub fn waitid(
- idtype: idtype_t,
- id: id_t,
- infop: *mut ::siginfo_t,
- options: ::c_int,
- ) -> ::c_int;
+ pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int)
+ -> ::c_int;
pub fn setreuid(ruid: ::uid_t, euid: ::uid_t) -> ::c_int;
pub fn setregid(rgid: ::gid_t, egid: ::gid_t) -> ::c_int;
- pub fn getresuid(
- ruid: *mut ::uid_t,
- euid: *mut ::uid_t,
- suid: *mut ::uid_t,
- ) -> ::c_int;
- pub fn getresgid(
- rgid: *mut ::gid_t,
- egid: *mut ::gid_t,
- sgid: *mut ::gid_t,
- ) -> ::c_int;
+ pub fn getresuid(ruid: *mut ::uid_t, euid: *mut ::uid_t, suid: *mut ::uid_t) -> ::c_int;
+ pub fn getresgid(rgid: *mut ::gid_t, egid: *mut ::gid_t, sgid: *mut ::gid_t) -> ::c_int;
pub fn acct(filename: *const ::c_char) -> ::c_int;
pub fn brk(addr: *mut ::c_void) -> ::c_int;
pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
@@ -4109,40 +3929,18 @@ extern "C" {
pub fn endpwent();
pub fn getpwent() -> *mut passwd;
- pub fn shm_open(
- name: *const c_char,
- oflag: ::c_int,
- mode: mode_t,
- ) -> ::c_int;
+ pub fn shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int;
// System V IPC
pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
- pub fn shmat(
- shmid: ::c_int,
- shmaddr: *const ::c_void,
- shmflg: ::c_int,
- ) -> *mut ::c_void;
+ 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 shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
pub fn semget(key: ::key_t, nsems: ::c_int, semflag: ::c_int) -> ::c_int;
- pub fn semop(
- semid: ::c_int,
- sops: *mut ::sembuf,
- nsops: ::size_t,
- ) -> ::c_int;
- pub fn semctl(
- semid: ::c_int,
- semnum: ::c_int,
- cmd: ::c_int,
- ...
- ) -> ::c_int;
- pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds)
- -> ::c_int;
+ pub fn semop(semid: ::c_int, sops: *mut ::sembuf, nsops: ::size_t) -> ::c_int;
+ pub fn semctl(semid: ::c_int, semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int;
+ pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int;
pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
pub fn msgrcv(
msqid: ::c_int,
@@ -4158,57 +3956,24 @@ extern "C" {
msgflg: ::c_int,
) -> ::c_int;
- pub fn mprotect(
- addr: *mut ::c_void,
- len: ::size_t,
- prot: ::c_int,
- ) -> ::c_int;
+ pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
pub fn __errno_location() -> *mut ::c_int;
- pub fn fallocate(
- fd: ::c_int,
- mode: ::c_int,
- offset: ::off_t,
- len: ::off_t,
- ) -> ::c_int;
- pub fn posix_fallocate(
- fd: ::c_int,
- offset: ::off_t,
- len: ::off_t,
- ) -> ::c_int;
- pub fn readahead(
- fd: ::c_int,
- offset: ::off64_t,
- count: ::size_t,
- ) -> ::ssize_t;
- pub fn signalfd(
- fd: ::c_int,
- mask: *const ::sigset_t,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn fallocate(fd: ::c_int, mode: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int;
+ pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int;
+ pub fn readahead(fd: ::c_int, offset: ::off64_t, count: ::size_t) -> ::ssize_t;
+ pub fn signalfd(fd: ::c_int, mask: *const ::sigset_t, flags: ::c_int) -> ::c_int;
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_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 pwritev(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t,
- ) -> ::ssize_t;
- pub fn preadv(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t,
- ) -> ::ssize_t;
+ pub fn pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t)
+ -> ::ssize_t;
+ pub fn preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t;
pub fn quotactl(
cmd: ::c_int,
special: *const ::c_char,
@@ -4217,19 +3982,14 @@ extern "C" {
) -> ::c_int;
pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
- pub fn mkostemps(
- template: *mut ::c_char,
- suffixlen: ::c_int,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int;
pub fn sigtimedwait(
set: *const sigset_t,
info: *mut siginfo_t,
timeout: *const ::timespec,
) -> ::c_int;
pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int;
- pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t)
- -> *mut ::c_char;
+ pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
pub fn getnameinfo(
sa: *const ::sockaddr,
salen: ::socklen_t,
@@ -4244,11 +4004,7 @@ extern "C" {
pub fn setfsuid(uid: ::uid_t) -> ::c_int;
// Not available now on Android
- pub fn mkfifoat(
- dirfd: ::c_int,
- pathname: *const ::c_char,
- mode: ::mode_t,
- ) -> ::c_int;
+ pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int;
pub fn if_nameindex() -> *mut if_nameindex;
pub fn if_freenameindex(ptr: *mut if_nameindex);
pub fn sync_file_range(
@@ -4263,35 +4019,21 @@ extern "C" {
pub fn glob(
pattern: *const c_char,
flags: ::c_int,
- errfunc: ::Option<
- extern "C" fn(epath: *const c_char, errno: ::c_int) -> ::c_int,
- >,
+ errfunc: ::Option<extern "C" fn(epath: *const c_char, errno: ::c_int) -> ::c_int>,
pglob: *mut ::glob_t,
) -> ::c_int;
pub fn globfree(pglob: *mut ::glob_t);
- pub fn posix_madvise(
- addr: *mut ::c_void,
- len: ::size_t,
- advice: ::c_int,
- ) -> ::c_int;
+ pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
- pub fn madvise(
- addr: *mut ::c_void,
- len: ::size_t,
- advice: ::c_int,
- ) -> ::c_int;
+ pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
- pub fn msync(
- addr: *mut ::c_void,
- len: ::size_t,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
pub fn recvfrom(
socket: ::c_int,
@@ -4305,33 +4047,13 @@ extern "C" {
pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int;
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
- pub fn bind(
- socket: ::c_int,
- address: *const ::sockaddr,
- address_len: ::socklen_t,
- ) -> ::c_int;
+ pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int;
- pub fn writev(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- ) -> ::ssize_t;
- pub fn readv(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- ) -> ::ssize_t;
+ pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
+ pub fn readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
- pub fn sendmsg(
- fd: ::c_int,
- msg: *const ::msghdr,
- flags: ::c_int,
- ) -> ::ssize_t;
- pub fn recvmsg(
- fd: ::c_int,
- msg: *mut ::msghdr,
- flags: ::c_int,
- ) -> ::ssize_t;
+ pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t;
+ pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t;
pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int;
pub fn vhangup() -> ::c_int;
@@ -4350,11 +4072,8 @@ extern "C" {
) -> ::c_int;
pub fn sync();
pub fn syscall(num: ::c_long, ...) -> ::c_long;
- pub fn sched_getaffinity(
- pid: ::pid_t,
- cpusetsize: ::size_t,
- cpuset: *mut cpu_set_t,
- ) -> ::c_int;
+ pub fn sched_getaffinity(pid: ::pid_t, cpusetsize: ::size_t, cpuset: *mut cpu_set_t)
+ -> ::c_int;
pub fn sched_setaffinity(
pid: ::pid_t,
cpusetsize: ::size_t,
@@ -4362,16 +4081,8 @@ extern "C" {
) -> ::c_int;
pub fn umount(target: *const ::c_char) -> ::c_int;
pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
- pub fn tee(
- fd_in: ::c_int,
- fd_out: ::c_int,
- len: ::size_t,
- flags: ::c_uint,
- ) -> ::ssize_t;
- pub fn settimeofday(
- tv: *const ::timeval,
- tz: *const ::timezone,
- ) -> ::c_int;
+ pub fn tee(fd_in: ::c_int, fd_out: ::c_int, len: ::size_t, flags: ::c_uint) -> ::ssize_t;
+ pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
pub fn splice(
fd_in: ::c_int,
off_in: *mut ::loff_t,
@@ -4381,17 +4092,10 @@ extern "C" {
flags: ::c_uint,
) -> ::ssize_t;
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
- pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec)
- -> ::c_int;
- pub fn sem_timedwait(
- sem: *mut sem_t,
- abstime: *const ::timespec,
- ) -> ::c_int;
+ pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int;
pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int;
- pub fn sched_setparam(
- pid: ::pid_t,
- param: *const ::sched_param,
- ) -> ::c_int;
+ pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int;
pub fn swapoff(puath: *const ::c_char) -> ::c_int;
pub fn vmsplice(
fd: ::c_int,
@@ -4464,11 +4168,7 @@ extern "C" {
result: *mut *mut ::group,
) -> ::c_int;
pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
- pub fn pthread_sigmask(
- how: ::c_int,
- set: *const sigset_t,
- oldset: *mut sigset_t,
- ) -> ::c_int;
+ pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int;
pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int;
diff --git a/src/hermit/mod.rs b/src/hermit/mod.rs
index 9880b507..bffcefdd 100644
--- a/src/hermit/mod.rs
+++ b/src/hermit/mod.rs
@@ -1,13 +1,3 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
// libc port for HermitCore (https://hermitcore.org)
//
// Ported by Colin Fink <colin.finck@rwth-aachen.de>
diff --git a/src/lib.rs b/src/lib.rs
index 0b1496af..8879b1dc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,12 +1,3 @@
-// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
//! libc - Raw FFI bindings to platforms' system libraries
//!
//! [Documentation for other platforms][pd].
@@ -14,28 +5,34 @@
//! [pd]: https://rust-lang.github.io/libc/#platform-specific-documentation
#![crate_name = "libc"]
#![crate_type = "rlib"]
-#![cfg_attr(libc_deny_warnings, deny(warnings))]
#![allow(
+ renamed_and_removed_lints, // Keep this order.
+ unknown_lints, // Keep this order.
bad_style,
overflowing_literals,
improper_ctypes,
- unknown_lints,
- redundant_semicolon
+ // This lint is renamed but we run CI for old stable rustc so should be here.
+ redundant_semicolon,
+ redundant_semicolons
)]
+#![cfg_attr(libc_deny_warnings, deny(warnings))]
// Attributes needed when building as part of the standard library
-#![cfg_attr(
- feature = "rustc-dep-of-std",
- feature(cfg_target_vendor, link_cfg, no_core)
-)]
+#![cfg_attr(feature = "rustc-dep-of-std", feature(link_cfg, no_core))]
#![cfg_attr(libc_thread_local, feature(thread_local))]
// Enable extra lints:
#![cfg_attr(feature = "extra_traits", deny(missing_debug_implementations))]
#![deny(missing_copy_implementations, safe_packed_borrows)]
-#![no_std]
+#![cfg_attr(not(feature = "rustc-dep-of-std"), no_std)]
#![cfg_attr(feature = "rustc-dep-of-std", no_core)]
-#![cfg_attr(target_os = "redox", feature(static_nobundle))]
+#![cfg_attr(
+ any(feature = "rustc-dep-of-std", target_os = "redox"),
+ feature(static_nobundle)
+)]
#![cfg_attr(libc_const_extern_fn, feature(const_extern_fn))]
+// ANDROID: Use std to allow building as a dylib.
+extern crate std;
+
#[macro_use]
mod macros;
@@ -45,6 +42,8 @@ cfg_if! {
#[allow(unused_imports)]
use core::iter;
#[allow(unused_imports)]
+ use core::ops;
+ #[allow(unused_imports)]
use core::option;
}
}
@@ -103,12 +102,6 @@ cfg_if! {
mod windows;
pub use windows::*;
- } else if #[cfg(target_os = "cloudabi")] {
- mod fixed_width_ints;
- pub use fixed_width_ints::*;
-
- mod cloudabi;
- pub use cloudabi::*;
} else if #[cfg(target_os = "fuchsia")] {
mod fixed_width_ints;
pub use fixed_width_ints::*;
@@ -121,6 +114,12 @@ cfg_if! {
mod switch;
pub use switch::*;
+ } else if #[cfg(target_os = "psp")] {
+ mod fixed_width_ints;
+ pub use fixed_width_ints::*;
+
+ mod psp;
+ pub use psp::*;
} else if #[cfg(target_os = "vxworks")] {
mod fixed_width_ints;
pub use fixed_width_ints::*;
diff --git a/src/macros.rs b/src/macros.rs
index f14bbf55..1871cfaf 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -40,12 +40,12 @@ macro_rules! cfg_if {
// Internal and recursive macro to emit all the items
//
- // Collects all the negated cfgs in a list at the beginning and after the
+ // Collects all the negated `cfg`s in a list at the beginning and after the
// semicolon is all the remaining items
(@__items ($($not:meta,)*) ; ) => {};
(@__items ($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ),
$($rest:tt)*) => {
- // Emit all items within one block, applying an approprate #[cfg]. The
+ // Emit all items within one block, applying an appropriate #[cfg]. The
// #[cfg] will require all `$m` matchers specified and must also negate
// all previous matchers.
cfg_if! { @__apply cfg(all($($m,)* not(any($($not),*)))), $($it)* }
@@ -114,13 +114,45 @@ macro_rules! s_no_extra_traits {
$(#[$attr])*
pub struct $i { $($field)* }
}
+ #[allow(deprecated)]
impl ::Copy for $i {}
+ #[allow(deprecated)]
impl ::Clone for $i {
fn clone(&self) -> $i { *self }
}
);
}
+#[allow(unused_macros)]
+macro_rules! e {
+ ($($(#[$attr:meta])* pub enum $i:ident { $($field:tt)* })*) => ($(
+ __item! {
+ #[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
+ $(#[$attr])*
+ pub enum $i { $($field)* }
+ }
+ impl ::Copy for $i {}
+ impl ::Clone for $i {
+ fn clone(&self) -> $i { *self }
+ }
+ )*);
+}
+
+#[allow(unused_macros)]
+macro_rules! s_paren {
+ ($($(#[$attr:meta])* pub struct $i:ident ( $($field:tt)* ); )* ) => ($(
+ __item! {
+ #[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
+ $(#[$attr])*
+ pub struct $i ( $($field)* );
+ }
+ impl ::Copy for $i {}
+ impl ::Clone for $i {
+ fn clone(&self) -> $i { *self }
+ }
+ )*);
+}
+
// This is a pretty horrible hack to allow us to conditionally mark
// some functions as 'const', without requiring users of this macro
// to care about the "const-extern-fn" feature.
@@ -137,7 +169,7 @@ macro_rules! s_no_extra_traits {
// so we need to avoid emitting it at all of 'const-extern-fn'.
//
// Specifically, moving the 'cfg_if' into the macro body will *not* work.
-// Doing so would cause the '#[cfg(feature = "const-extern-fn")]' to be emiited
+// Doing so would cause the '#[cfg(feature = "const-extern-fn")]' to be emitted
// into user code. The 'cfg' gate will not stop Rust from trying to parse the
// 'pub const unsafe extern fn', so users would get a compiler error even when
// the 'const-extern-fn' feature is disabled
@@ -145,19 +177,20 @@ macro_rules! s_no_extra_traits {
// Note that users of this macro need to place 'const' in a weird position
// (after the closing ')' for the arguments, but before the return type).
// This was the only way I could satisfy the following two requirements:
-// 1. Avoid ambuguity errors from 'macro_rules!' (which happen when writing '$foo:ident fn'
+// 1. Avoid ambiguity errors from 'macro_rules!' (which happen when writing '$foo:ident fn'
// 2. Allow users of this macro to mix 'pub fn foo' and 'pub const fn bar' within the same
// 'f!' block
cfg_if! {
if #[cfg(libc_const_extern_fn)] {
#[allow(unused_macros)]
macro_rules! f {
- ($(pub $({$constness:ident})* fn $i:ident(
+ ($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident(
$($arg:ident: $argty:ty),*
) -> $ret:ty {
$($body:stmt);*
})*) => ($(
#[inline]
+ $(#[$attr])*
pub $($constness)* unsafe extern fn $i($($arg: $argty),*
) -> $ret {
$($body);*
@@ -166,13 +199,30 @@ cfg_if! {
}
#[allow(unused_macros)]
+ macro_rules! safe_f {
+ ($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident(
+ $($arg:ident: $argty:ty),*
+ ) -> $ret:ty {
+ $($body:stmt);*
+ })*) => ($(
+ #[inline]
+ $(#[$attr])*
+ pub $($constness)* extern fn $i($($arg: $argty),*
+ ) -> $ret {
+ $($body);*
+ }
+ )*)
+ }
+
+ #[allow(unused_macros)]
macro_rules! const_fn {
- ($($({$constness:ident})* fn $i:ident(
+ ($($(#[$attr:meta])* $({$constness:ident})* fn $i:ident(
$($arg:ident: $argty:ty),*
) -> $ret:ty {
$($body:stmt);*
})*) => ($(
#[inline]
+ $(#[$attr])*
$($constness)* fn $i($($arg: $argty),*
) -> $ret {
$($body);*
@@ -183,12 +233,13 @@ cfg_if! {
} else {
#[allow(unused_macros)]
macro_rules! f {
- ($(pub $({$constness:ident})* fn $i:ident(
+ ($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident(
$($arg:ident: $argty:ty),*
) -> $ret:ty {
$($body:stmt);*
})*) => ($(
#[inline]
+ $(#[$attr])*
pub unsafe extern fn $i($($arg: $argty),*
) -> $ret {
$($body);*
@@ -197,13 +248,30 @@ cfg_if! {
}
#[allow(unused_macros)]
+ macro_rules! safe_f {
+ ($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident(
+ $($arg:ident: $argty:ty),*
+ ) -> $ret:ty {
+ $($body:stmt);*
+ })*) => ($(
+ #[inline]
+ $(#[$attr])*
+ pub extern fn $i($($arg: $argty),*
+ ) -> $ret {
+ $($body);*
+ }
+ )*)
+ }
+
+ #[allow(unused_macros)]
macro_rules! const_fn {
- ($($({$constness:ident})* fn $i:ident(
+ ($($(#[$attr:meta])* $({$constness:ident})* fn $i:ident(
$($arg:ident: $argty:ty),*
) -> $ret:ty {
$($body:stmt);*
})*) => ($(
#[inline]
+ $(#[$attr])*
fn $i($($arg: $argty),*
) -> $ret {
$($body);*
diff --git a/src/psp.rs b/src/psp.rs
new file mode 100644
index 00000000..575232da
--- /dev/null
+++ b/src/psp.rs
@@ -0,0 +1,4174 @@
+//! PSP C type definitions
+//!
+//! These type declarations are not enough, as they must be ultimately resolved
+//! by the linker. Crates that use these definitions must, somewhere in the
+//! crate graph, include a stub provider crate such as the `psp` crate.
+
+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_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 c_char = u8;
+pub type c_long = i64;
+pub type c_ulong = u64;
+
+cfg_if! {
+ if #[cfg(libc_core_cvoid)] {
+ pub use ::ffi::c_void;
+ } else {
+ // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
+ // enable more optimization opportunities around it recognizing things
+ // like malloc/free.
+ #[repr(u8)]
+ #[allow(missing_copy_implementations)]
+ #[allow(missing_debug_implementations)]
+ pub enum c_void {
+ // Two dummy variants so the #[repr] attribute can be used.
+ #[doc(hidden)]
+ __variant1,
+ #[doc(hidden)]
+ __variant2,
+ }
+ }
+}
+
+pub type SceKernelVTimerHandler = unsafe extern "C" fn(
+ uid: SceUid,
+ arg1: *mut SceKernelSysClock,
+ arg2: *mut SceKernelSysClock,
+ arg3: *mut c_void,
+) -> u32;
+
+pub type SceKernelVTimerHandlerWide =
+ unsafe extern "C" fn(uid: SceUid, arg1: i64, arg2: i64, arg3: *mut c_void) -> u32;
+
+pub type SceKernelThreadEventHandler =
+ unsafe extern "C" fn(mask: i32, thid: SceUid, common: *mut c_void) -> i32;
+
+pub type SceKernelAlarmHandler = unsafe extern "C" fn(common: *mut c_void) -> u32;
+
+pub type SceKernelCallbackFunction =
+ unsafe extern "C" fn(arg1: i32, arg2: i32, arg: *mut c_void) -> i32;
+
+pub type SceKernelThreadEntry = unsafe extern "C" fn(args: usize, argp: *mut c_void) -> i32;
+
+pub type PowerCallback = extern "C" fn(unknown: i32, power_info: i32);
+
+pub type IoPermissions = i32;
+
+pub type UmdCallback = fn(unknown: i32, event: i32) -> i32;
+
+pub type SceMpegRingbufferCb =
+ ::Option<unsafe extern "C" fn(data: *mut c_void, num_packets: i32, param: *mut c_void) -> i32>;
+
+pub type GuCallback = ::Option<extern "C" fn(id: i32, arg: *mut c_void)>;
+pub type GuSwapBuffersCallback =
+ ::Option<extern "C" fn(display: *mut *mut c_void, render: *mut *mut c_void)>;
+
+pub type SceNetAdhocctlHandler =
+ ::Option<unsafe extern "C" fn(flag: i32, error: i32, unknown: *mut c_void)>;
+
+pub type AdhocMatchingCallback = ::Option<
+ unsafe extern "C" fn(
+ matching_id: i32,
+ event: i32,
+ mac: *mut u8,
+ opt_len: i32,
+ opt_data: *mut c_void,
+ ),
+>;
+
+pub type SceNetApctlHandler = ::Option<
+ unsafe extern "C" fn(oldState: i32, newState: i32, event: i32, error: i32, pArg: *mut c_void),
+>;
+
+pub type HttpMallocFunction = ::Option<unsafe extern "C" fn(size: usize) -> *mut c_void>;
+pub type HttpReallocFunction =
+ ::Option<unsafe extern "C" fn(p: *mut c_void, size: usize) -> *mut c_void>;
+pub type HttpFreeFunction = ::Option<unsafe extern "C" fn(p: *mut c_void)>;
+pub type HttpPasswordCB = ::Option<
+ unsafe extern "C" fn(
+ request: i32,
+ auth_type: HttpAuthType,
+ realm: *const u8,
+ username: *mut u8,
+ password: *mut u8,
+ need_entity: i32,
+ entity_body: *mut *mut u8,
+ entity_size: *mut usize,
+ save: *mut i32,
+ ) -> i32,
+>;
+
+pub type socklen_t = u32;
+
+e! {
+ #[repr(u32)]
+ pub enum AudioFormat {
+ Stereo = 0,
+ Mono = 0x10,
+ }
+
+ #[repr(u32)]
+ pub enum DisplayMode {
+ Lcd = 0,
+ }
+
+ #[repr(u32)]
+ pub enum DisplayPixelFormat {
+ Psm5650 = 0,
+ Psm5551 = 1,
+ Psm4444 = 2,
+ Psm8888 = 3,
+ }
+
+ #[repr(u32)]
+ pub enum DisplaySetBufSync {
+ Immediate = 0,
+ NextFrame = 1,
+ }
+
+ #[repr(i32)]
+ pub enum AudioOutputFrequency {
+ Khz48 = 48000,
+ Khz44_1 = 44100,
+ Khz32 = 32000,
+ Khz24 = 24000,
+ Khz22_05 = 22050,
+ Khz16 = 16000,
+ Khz12 = 12000,
+ Khz11_025 = 11025,
+ Khz8 = 8000,
+ }
+
+ #[repr(i32)]
+ pub enum AudioInputFrequency {
+ Khz44_1 = 44100,
+ Khz22_05 = 22050,
+ Khz11_025 = 11025,
+ }
+
+ #[repr(u32)]
+ pub enum CtrlMode {
+ Digital = 0,
+ Analog,
+ }
+
+ #[repr(i32)]
+ pub enum GeMatrixType {
+ Bone0 = 0,
+ Bone1,
+ Bone2,
+ Bone3,
+ Bone4,
+ Bone5,
+ Bone6,
+ Bone7,
+ World,
+ View,
+ Projection,
+ TexGen,
+ }
+
+ #[repr(i32)]
+ pub enum GeListState {
+ Done = 0,
+ Queued,
+ DrawingDone,
+ StallReached,
+ CancelDone,
+ }
+
+ #[repr(u8)]
+ pub enum GeCommand {
+ Nop = 0,
+ Vaddr = 0x1,
+ Iaddr = 0x2,
+ Prim = 0x4,
+ Bezier = 0x5,
+ Spline = 0x6,
+ BoundingBox = 0x7,
+ Jump = 0x8,
+ BJump = 0x9,
+ Call = 0xa,
+ Ret = 0xb,
+ End = 0xc,
+ Signal = 0xe,
+ Finish = 0xf,
+ Base = 0x10,
+ VertexType = 0x12,
+ OffsetAddr = 0x13,
+ Origin = 0x14,
+ Region1 = 0x15,
+ Region2 = 0x16,
+ LightingEnable = 0x17,
+ LightEnable0 = 0x18,
+ LightEnable1 = 0x19,
+ LightEnable2 = 0x1a,
+ LightEnable3 = 0x1b,
+ DepthClampEnable = 0x1c,
+ CullFaceEnable = 0x1d,
+ TextureMapEnable = 0x1e,
+ FogEnable = 0x1f,
+ DitherEnable = 0x20,
+ AlphaBlendEnable = 0x21,
+ AlphaTestEnable = 0x22,
+ ZTestEnable = 0x23,
+ StencilTestEnable = 0x24,
+ AntiAliasEnable = 0x25,
+ PatchCullEnable = 0x26,
+ ColorTestEnable = 0x27,
+ LogicOpEnable = 0x28,
+ BoneMatrixNumber = 0x2a,
+ BoneMatrixData = 0x2b,
+ MorphWeight0 = 0x2c,
+ MorphWeight1 = 0x2d,
+ MorphWeight2 = 0x2e,
+ MorphWeight3 = 0x2f,
+ MorphWeight4 = 0x30,
+ MorphWeight5 = 0x31,
+ MorphWeight6 = 0x32,
+ MorphWeight7 = 0x33,
+ PatchDivision = 0x36,
+ PatchPrimitive = 0x37,
+ PatchFacing = 0x38,
+ WorldMatrixNumber = 0x3a,
+ WorldMatrixData = 0x3b,
+ ViewMatrixNumber = 0x3c,
+ ViewMatrixData = 0x3d,
+ ProjMatrixNumber = 0x3e,
+ ProjMatrixData = 0x3f,
+ TGenMatrixNumber = 0x40,
+ TGenMatrixData = 0x41,
+ ViewportXScale = 0x42,
+ ViewportYScale = 0x43,
+ ViewportZScale = 0x44,
+ ViewportXCenter = 0x45,
+ ViewportYCenter = 0x46,
+ ViewportZCenter = 0x47,
+ TexScaleU = 0x48,
+ TexScaleV = 0x49,
+ TexOffsetU = 0x4a,
+ TexOffsetV = 0x4b,
+ OffsetX = 0x4c,
+ OffsetY = 0x4d,
+ ShadeMode = 0x50,
+ ReverseNormal = 0x51,
+ MaterialUpdate = 0x53,
+ MaterialEmissive = 0x54,
+ MaterialAmbient = 0x55,
+ MaterialDiffuse = 0x56,
+ MaterialSpecular = 0x57,
+ MaterialAlpha = 0x58,
+ MaterialSpecularCoef = 0x5b,
+ AmbientColor = 0x5c,
+ AmbientAlpha = 0x5d,
+ LightMode = 0x5e,
+ LightType0 = 0x5f,
+ LightType1 = 0x60,
+ LightType2 = 0x61,
+ LightType3 = 0x62,
+ Light0X = 0x63,
+ Light0Y,
+ Light0Z,
+ Light1X,
+ Light1Y,
+ Light1Z,
+ Light2X,
+ Light2Y,
+ Light2Z,
+ Light3X,
+ Light3Y,
+ Light3Z,
+ Light0DirectionX = 0x6f,
+ Light0DirectionY,
+ Light0DirectionZ,
+ Light1DirectionX,
+ Light1DirectionY,
+ Light1DirectionZ,
+ Light2DirectionX,
+ Light2DirectionY,
+ Light2DirectionZ,
+ Light3DirectionX,
+ Light3DirectionY,
+ Light3DirectionZ,
+ Light0ConstantAtten = 0x7b,
+ Light0LinearAtten,
+ Light0QuadtraticAtten,
+ Light1ConstantAtten,
+ Light1LinearAtten,
+ Light1QuadtraticAtten,
+ Light2ConstantAtten,
+ Light2LinearAtten,
+ Light2QuadtraticAtten,
+ Light3ConstantAtten,
+ Light3LinearAtten,
+ Light3QuadtraticAtten,
+ Light0ExponentAtten = 0x87,
+ Light1ExponentAtten,
+ Light2ExponentAtten,
+ Light3ExponentAtten,
+ Light0CutoffAtten = 0x8b,
+ Light1CutoffAtten,
+ Light2CutoffAtten,
+ Light3CutoffAtten,
+ Light0Ambient = 0x8f,
+ Light0Diffuse,
+ Light0Specular,
+ Light1Ambient,
+ Light1Diffuse,
+ Light1Specular,
+ Light2Ambient,
+ Light2Diffuse,
+ Light2Specular,
+ Light3Ambient,
+ Light3Diffuse,
+ Light3Specular,
+ Cull = 0x9b,
+ FrameBufPtr = 0x9c,
+ FrameBufWidth = 0x9d,
+ ZBufPtr = 0x9e,
+ ZBufWidth = 0x9f,
+ TexAddr0 = 0xa0,
+ TexAddr1,
+ TexAddr2,
+ TexAddr3,
+ TexAddr4,
+ TexAddr5,
+ TexAddr6,
+ TexAddr7,
+ TexBufWidth0 = 0xa8,
+ TexBufWidth1,
+ TexBufWidth2,
+ TexBufWidth3,
+ TexBufWidth4,
+ TexBufWidth5,
+ TexBufWidth6,
+ TexBufWidth7,
+ ClutAddr = 0xb0,
+ ClutAddrUpper = 0xb1,
+ TransferSrc,
+ TransferSrcW,
+ TransferDst,
+ TransferDstW,
+ TexSize0 = 0xb8,
+ TexSize1,
+ TexSize2,
+ TexSize3,
+ TexSize4,
+ TexSize5,
+ TexSize6,
+ TexSize7,
+ TexMapMode = 0xc0,
+ TexShadeLs = 0xc1,
+ TexMode = 0xc2,
+ TexFormat = 0xc3,
+ LoadClut = 0xc4,
+ ClutFormat = 0xc5,
+ TexFilter = 0xc6,
+ TexWrap = 0xc7,
+ TexLevel = 0xc8,
+ TexFunc = 0xc9,
+ TexEnvColor = 0xca,
+ TexFlush = 0xcb,
+ TexSync = 0xcc,
+ Fog1 = 0xcd,
+ Fog2 = 0xce,
+ FogColor = 0xcf,
+ TexLodSlope = 0xd0,
+ FramebufPixFormat = 0xd2,
+ ClearMode = 0xd3,
+ Scissor1 = 0xd4,
+ Scissor2 = 0xd5,
+ MinZ = 0xd6,
+ MaxZ = 0xd7,
+ ColorTest = 0xd8,
+ ColorRef = 0xd9,
+ ColorTestmask = 0xda,
+ AlphaTest = 0xdb,
+ StencilTest = 0xdc,
+ StencilOp = 0xdd,
+ ZTest = 0xde,
+ BlendMode = 0xdf,
+ BlendFixedA = 0xe0,
+ BlendFixedB = 0xe1,
+ Dith0 = 0xe2,
+ Dith1,
+ Dith2,
+ Dith3,
+ LogicOp = 0xe6,
+ ZWriteDisable = 0xe7,
+ MaskRgb = 0xe8,
+ MaskAlpha = 0xe9,
+ TransferStart = 0xea,
+ TransferSrcPos = 0xeb,
+ TransferDstPos = 0xec,
+ TransferSize = 0xee,
+ Vscx = 0xf0,
+ Vscy = 0xf1,
+ Vscz = 0xf2,
+ Vtcs = 0xf3,
+ Vtct = 0xf4,
+ Vtcq = 0xf5,
+ Vcv = 0xf6,
+ Vap = 0xf7,
+ Vfc = 0xf8,
+ Vscv = 0xf9,
+
+ Unknown03 = 0x03,
+ Unknown0D = 0x0d,
+ Unknown11 = 0x11,
+ Unknown29 = 0x29,
+ Unknown34 = 0x34,
+ Unknown35 = 0x35,
+ Unknown39 = 0x39,
+ Unknown4E = 0x4e,
+ Unknown4F = 0x4f,
+ Unknown52 = 0x52,
+ Unknown59 = 0x59,
+ Unknown5A = 0x5a,
+ UnknownB6 = 0xb6,
+ UnknownB7 = 0xb7,
+ UnknownD1 = 0xd1,
+ UnknownED = 0xed,
+ UnknownEF = 0xef,
+ UnknownFA = 0xfa,
+ UnknownFB = 0xfb,
+ UnknownFC = 0xfc,
+ UnknownFD = 0xfd,
+ UnknownFE = 0xfe,
+ NopFF = 0xff,
+ }
+
+ #[repr(i32)]
+ pub enum SceSysMemPartitionId {
+ SceKernelUnknownPartition = 0,
+ SceKernelPrimaryKernelPartition = 1,
+ SceKernelPrimaryUserPartition = 2,
+ SceKernelOtherKernelPartition1 = 3,
+ SceKernelOtherKernelPartition2 = 4,
+ SceKernelVshellPARTITION = 5,
+ SceKernelScUserPartition = 6,
+ SceKernelMeUserPartition = 7,
+ SceKernelExtendedScKernelPartition = 8,
+ SceKernelExtendedSc2KernelPartition = 9,
+ SceKernelExtendedMeKernelPartition = 10,
+ SceKernelVshellKernelPartition = 11,
+ SceKernelExtendedKernelPartition = 12,
+ }
+
+ #[repr(i32)]
+ pub enum SceSysMemBlockTypes {
+ Low = 0,
+ High,
+ Addr,
+ }
+
+ #[repr(u32)]
+ pub enum Interrupt {
+ Gpio = 4,
+ Ata = 5,
+ Umd = 6,
+ Mscm0 = 7,
+ Wlan = 8,
+ Audio = 10,
+ I2c = 12,
+ Sircs = 14,
+ Systimer0 = 15,
+ Systimer1 = 16,
+ Systimer2 = 17,
+ Systimer3 = 18,
+ Thread0 = 19,
+ Nand = 20,
+ Dmacplus = 21,
+ Dma0 = 22,
+ Dma1 = 23,
+ Memlmd = 24,
+ Ge = 25,
+ Vblank = 30,
+ Mecodec = 31,
+ Hpremote = 36,
+ Mscm1 = 60,
+ Mscm2 = 61,
+ Thread1 = 65,
+ Interrupt = 66,
+ }
+
+ #[repr(u32)]
+ pub enum SubInterrupt {
+ Gpio = Interrupt::Gpio as u32,
+ Ata = Interrupt::Ata as u32,
+ Umd = Interrupt::Umd as u32,
+ Dmacplus = Interrupt::Dmacplus as u32,
+ Ge = Interrupt::Ge as u32,
+ Display = Interrupt::Vblank as u32,
+ }
+
+ #[repr(u32)]
+ pub enum SceKernelIdListType {
+ Thread = 1,
+ Semaphore = 2,
+ EventFlag = 3,
+ Mbox = 4,
+ Vpl = 5,
+ Fpl = 6,
+ Mpipe = 7,
+ Callback = 8,
+ ThreadEventHandler = 9,
+ Alarm = 10,
+ VTimer = 11,
+ SleepThread = 64,
+ DelayThread = 65,
+ SuspendThread = 66,
+ DormantThread = 67,
+ }
+
+ #[repr(i32)]
+ pub enum UsbCamResolution {
+ Px160_120 = 0,
+ Px176_144 = 1,
+ Px320_240 = 2,
+ Px352_288 = 3,
+ Px640_480 = 4,
+ Px1024_768 = 5,
+ Px1280_960 = 6,
+ Px480_272 = 7,
+ Px360_272 = 8,
+ }
+
+ #[repr(i32)]
+ pub enum UsbCamResolutionEx {
+ Px160_120 = 0,
+ Px176_144 = 1,
+ Px320_240 = 2,
+ Px352_288 = 3,
+ Px360_272 = 4,
+ Px480_272 = 5,
+ Px640_480 = 6,
+ Px1024_768 = 7,
+ Px1280_960 = 8,
+ }
+
+ #[repr(i32)]
+ pub enum UsbCamDelay {
+ NoDelay = 0,
+ Delay10Sec = 1,
+ Delay20Sec = 2,
+ Delay30Sec = 3,
+ }
+
+ #[repr(i32)]
+ pub enum UsbCamFrameRate {
+ Fps3_75 = 0,
+ Fps5 = 1,
+ Fps7_5 = 2,
+ Fps10 = 3,
+ Fps15 = 4,
+ Fps20 = 5,
+ Fps30 = 6,
+ Fps60 = 7,
+ }
+
+ #[repr(i32)]
+ pub enum UsbCamWb {
+ Auto = 0,
+ Daylight = 1,
+ Fluorescent = 2,
+ Incadescent = 3,
+ }
+
+ #[repr(i32)]
+ pub enum UsbCamEffectMode {
+ Normal = 0,
+ Negative = 1,
+ Blackwhite = 2,
+ Sepia = 3,
+ Blue = 4,
+ Red = 5,
+ Green = 6,
+ }
+
+ #[repr(i32)]
+ pub enum UsbCamEvLevel {
+ Pos2_0 = 0,
+ Pos1_7 = 1,
+ Pos1_5 = 2,
+ Pos1_3 = 3,
+ Pos1_0 = 4,
+ Pos0_7 = 5,
+ Pos0_5 = 6,
+ Pos0_3 = 7,
+ Zero = 8,
+ Neg0_3,
+ Neg0_5,
+ Neg0_7,
+ Neg1_0,
+ Neg1_3,
+ Neg1_5,
+ Neg1_7,
+ Neg2_0,
+ }
+
+ #[repr(i32)]
+ pub enum RtcCheckValidError {
+ InvalidYear = -1,
+ InvalidMonth = -2,
+ InvalidDay = -3,
+ InvalidHour = -4,
+ InvalidMinutes = -5,
+ InvalidSeconds = -6,
+ InvalidMicroseconds = -7,
+ }
+
+ #[repr(u32)]
+ pub enum PowerTick {
+ All = 0,
+ Suspend = 1,
+ Display = 6,
+ }
+
+ #[repr(u32)]
+ pub enum IoAssignPerms {
+ RdWr = 0,
+ RdOnly = 1,
+ }
+
+ #[repr(u32)]
+ pub enum IoWhence {
+ Set = 0,
+ Cur = 1,
+ End = 2,
+ }
+
+ #[repr(u32)]
+ pub enum UmdType {
+ Game = 0x10,
+ Video = 0x20,
+ Audio = 0x40,
+ }
+
+ #[repr(u32)]
+ pub enum GuPrimitive {
+ Points = 0,
+ Lines = 1,
+ LineStrip = 2,
+ Triangles = 3,
+ TriangleStrip = 4,
+ TriangleFan = 5,
+ Sprites = 6,
+ }
+
+ #[repr(u32)]
+ pub enum PatchPrimitive {
+ Points = 0,
+ LineStrip = 2,
+ TriangleStrip = 4,
+ }
+
+ #[repr(u32)]
+ pub enum GuState {
+ AlphaTest = 0,
+ DepthTest = 1,
+ ScissorTest = 2,
+ StencilTest = 3,
+ Blend = 4,
+ CullFace = 5,
+ Dither = 6,
+ Fog = 7,
+ ClipPlanes = 8,
+ Texture2D = 9,
+ Lighting = 10,
+ Light0 = 11,
+ Light1 = 12,
+ Light2 = 13,
+ Light3 = 14,
+ LineSmooth = 15,
+ PatchCullFace = 16,
+ ColorTest = 17,
+ ColorLogicOp = 18,
+ FaceNormalReverse = 19,
+ PatchFace = 20,
+ Fragment2X = 21,
+ }
+
+ #[repr(u32)]
+ pub enum MatrixMode {
+ Projection = 0,
+ View = 1,
+ Model = 2,
+ Texture = 3,
+ }
+
+ #[repr(u32)]
+ pub enum TexturePixelFormat {
+ Psm5650 = 0,
+ Psm5551 = 1,
+ Psm4444 = 2,
+ Psm8888 = 3,
+ PsmT4 = 4,
+ PsmT8 = 5,
+ PsmT16 = 6,
+ PsmT32 = 7,
+ PsmDxt1 = 8,
+ PsmDxt3 = 9,
+ PsmDxt5 = 10,
+ }
+
+ #[repr(u32)]
+ pub enum SplineMode {
+ FillFill = 0,
+ OpenFill = 1,
+ FillOpen = 2,
+ OpenOpen = 3,
+ }
+
+ #[repr(u32)]
+ pub enum ShadingModel {
+ Flat = 0,
+ Smooth = 1,
+ }
+
+ #[repr(u32)]
+ pub enum LogicalOperation {
+ Clear = 0,
+ And = 1,
+ AndReverse = 2,
+ Copy = 3,
+ AndInverted = 4,
+ Noop = 5,
+ Xor = 6,
+ Or = 7,
+ Nor = 8,
+ Equiv = 9,
+ Inverted = 10,
+ OrReverse = 11,
+ CopyInverted = 12,
+ OrInverted = 13,
+ Nand = 14,
+ Set = 15,
+ }
+
+ #[repr(u32)]
+ pub enum TextureFilter {
+ Nearest = 0,
+ Linear = 1,
+ NearestMipmapNearest = 4,
+ LinearMipmapNearest = 5,
+ NearestMipmapLinear = 6,
+ LinearMipmapLinear = 7,
+ }
+
+ #[repr(u32)]
+ pub enum TextureMapMode {
+ TextureCoords = 0,
+ TextureMatrix = 1,
+ EnvironmentMap = 2,
+ }
+
+ #[repr(u32)]
+ pub enum TextureLevelMode {
+ Auto = 0,
+ Const = 1,
+ Slope = 2,
+ }
+
+ #[repr(u32)]
+ pub enum TextureProjectionMapMode {
+ Position = 0,
+ Uv = 1,
+ NormalizedNormal = 2,
+ Normal = 3,
+ }
+
+ #[repr(u32)]
+ pub enum GuTexWrapMode {
+ Repeat = 0,
+ Clamp = 1,
+ }
+
+ #[repr(u32)]
+ pub enum FrontFaceDirection {
+ Clockwise = 0,
+ CounterClockwise = 1,
+ }
+
+ #[repr(u32)]
+ pub enum AlphaFunc {
+ Never = 0,
+ Always,
+ Equal,
+ NotEqual,
+ Less,
+ LessOrEqual,
+ Greater,
+ GreaterOrEqual,
+ }
+
+ #[repr(u32)]
+ pub enum StencilFunc {
+ Never = 0,
+ Always,
+ Equal,
+ NotEqual,
+ Less,
+ LessOrEqual,
+ Greater,
+ GreaterOrEqual,
+ }
+
+ #[repr(u32)]
+ pub enum ColorFunc {
+ Never = 0,
+ Always,
+ Equal,
+ NotEqual,
+ }
+
+ #[repr(u32)]
+ pub enum DepthFunc {
+ Never = 0,
+ Always,
+ Equal,
+ NotEqual,
+ Less,
+ LessOrEqual,
+ Greater,
+ GreaterOrEqual,
+ }
+
+ #[repr(u32)]
+ pub enum TextureEffect {
+ Modulate = 0,
+ Decal = 1,
+ Blend = 2,
+ Replace = 3,
+ Add = 4,
+ }
+
+ #[repr(u32)]
+ pub enum TextureColorComponent {
+ Rgb = 0,
+ Rgba = 1,
+ }
+
+ #[repr(u32)]
+ pub enum MipmapLevel {
+ None = 0,
+ Level1,
+ Level2,
+ Level3,
+ Level4,
+ Level5,
+ Level6,
+ Level7,
+ }
+
+ #[repr(u32)]
+ pub enum BlendOp {
+ Add = 0,
+ Subtract = 1,
+ ReverseSubtract = 2,
+ Min = 3,
+ Max = 4,
+ Abs = 5,
+ }
+
+ #[repr(u32)]
+ pub enum BlendSrc {
+ SrcColor = 0,
+ OneMinusSrcColor = 1,
+ SrcAlpha = 2,
+ OneMinusSrcAlpha = 3,
+ Fix = 10,
+ }
+
+ #[repr(u32)]
+ pub enum BlendDst {
+ DstColor = 0,
+ OneMinusDstColor = 1,
+ DstAlpha = 4,
+ OneMinusDstAlpha = 5,
+ Fix = 10,
+ }
+
+ #[repr(u32)]
+ pub enum StencilOperation {
+ Keep = 0,
+ Zero = 1,
+ Replace = 2,
+ Invert = 3,
+ Incr = 4,
+ Decr = 5,
+ }
+
+ #[repr(u32)]
+ pub enum LightMode {
+ SingleColor = 0,
+ SeparateSpecularColor = 1,
+ }
+
+ #[repr(u32)]
+ pub enum LightType {
+ Directional = 0,
+ Pointlight = 1,
+ Spotlight = 2,
+ }
+
+ #[repr(u32)]
+ pub enum GuContextType {
+ Direct = 0,
+ Call = 1,
+ Send = 2,
+ }
+
+ #[repr(u32)]
+ pub enum GuQueueMode {
+ Tail = 0,
+ Head = 1,
+ }
+
+ #[repr(u32)]
+ pub enum GuSyncMode {
+ Finish = 0,
+ Signal = 1,
+ Done = 2,
+ List = 3,
+ Send = 4,
+ }
+
+ #[repr(u32)]
+ pub enum GuSyncBehavior {
+ Wait = 0,
+ NoWait = 1,
+ }
+
+ #[repr(u32)]
+ pub enum GuCallbackId {
+ Signal = 1,
+ Finish = 4,
+ }
+
+ #[repr(u32)]
+ pub enum SignalBehavior {
+ Suspend = 1,
+ Continue = 2,
+ }
+
+ #[repr(u32)]
+ pub enum ClutPixelFormat {
+ Psm5650 = 0,
+ Psm5551 = 1,
+ Psm4444 = 2,
+ Psm8888 = 3,
+ }
+
+ #[repr(C)]
+ pub enum KeyType {
+ Directory = 1,
+ Integer = 2,
+ String = 3,
+ Bytes = 4,
+ }
+
+ #[repr(u32)]
+ pub enum UtilityMsgDialogMode {
+ Error,
+ Text,
+ }
+
+ #[repr(u32)]
+ pub enum UtilityMsgDialogPressed {
+ Unknown1,
+ Yes,
+ No,
+ Back,
+ }
+
+ #[repr(u32)]
+ pub enum UtilityDialogButtonAccept {
+ Circle,
+ Cross,
+ }
+
+ #[repr(u32)]
+ pub enum SceUtilityOskInputLanguage {
+ Default,
+ Japanese,
+ English,
+ French,
+ Spanish,
+ German,
+ Italian,
+ Dutch,
+ Portugese,
+ Russian,
+ Korean,
+ }
+
+ #[repr(u32)]
+ pub enum SceUtilityOskInputType {
+ All,
+ LatinDigit,
+ LatinSymbol,
+ LatinLowercase = 4,
+ LatinUppercase = 8,
+ JapaneseDigit = 0x100,
+ JapaneseSymbol = 0x200,
+ JapaneseLowercase = 0x400,
+ JapaneseUppercase = 0x800,
+ JapaneseHiragana = 0x1000,
+ JapaneseHalfWidthKatakana = 0x2000,
+ JapaneseKatakana = 0x4000,
+ JapaneseKanji = 0x8000,
+ RussianLowercase = 0x10000,
+ RussianUppercase = 0x20000,
+ Korean = 0x40000,
+ Url = 0x80000,
+ }
+
+ #[repr(u32)]
+ pub enum SceUtilityOskState {
+ None,
+ Initializing,
+ Initialized,
+ Visible,
+ Quit,
+ Finished,
+ }
+
+ #[repr(u32)]
+ pub enum SceUtilityOskResult {
+ Unchanged,
+ Cancelled,
+ Changed,
+ }
+
+ #[repr(u32)]
+ pub enum SystemParamLanguage {
+ Japanese,
+ English,
+ French,
+ Spanish,
+ German,
+ Italian,
+ Dutch,
+ Portugese,
+ Russian,
+ Korean,
+ ChineseTraditional,
+ ChineseSimplified,
+ }
+
+ #[repr(u32)]
+ pub enum SystemParamId {
+ StringNickname = 1,
+ AdhocChannel,
+ WlanPowerSave,
+ DateFormat,
+ TimeFormat,
+ Timezone,
+ DaylightSavings,
+ Language,
+ Unknown,
+ }
+
+ #[repr(u32)]
+ pub enum SystemParamAdhocChannel {
+ ChannelAutomatic = 0,
+ Channel1 = 1,
+ Channel6 = 6,
+ Channel11 = 11,
+ }
+
+ #[repr(u32)]
+ pub enum SystemParamWlanPowerSaveState {
+ Off,
+ On,
+ }
+
+ #[repr(u32)]
+ pub enum SystemParamDateFormat {
+ YYYYMMDD,
+ MMDDYYYY,
+ DDMMYYYY,
+ }
+
+ #[repr(u32)]
+ pub enum SystemParamTimeFormat {
+ Hour24,
+ Hour12,
+ }
+
+ #[repr(u32)]
+ pub enum SystemParamDaylightSavings {
+ Std,
+ Dst,
+ }
+
+ #[repr(u32)]
+ pub enum AvModule {
+ AvCodec,
+ SasCore,
+ Atrac3Plus,
+ MpegBase,
+ Mp3,
+ Vaudio,
+ Aac,
+ G729,
+ }
+
+ #[repr(u32)]
+ pub enum Module {
+ NetCommon = 0x100,
+ NetAdhoc,
+ NetInet,
+ NetParseUri,
+ NetHttp,
+ NetSsl,
+
+ UsbPspCm = 0x200,
+ UsbMic,
+ UsbCam,
+ UsbGps,
+
+ AvCodec = 0x300,
+ AvSascore,
+ AvAtrac3Plus,
+ AvMpegBase,
+ AvMp3,
+ AvVaudio,
+ AvAac,
+ AvG729,
+
+ NpCommon = 0x400,
+ NpService,
+ NpMatching2,
+ NpDrm = 0x500,
+
+ Irda = 0x600,
+ }
+
+ #[repr(u32)]
+ pub enum NetModule {
+ NetCommon = 1,
+ NetAdhoc,
+ NetInet,
+ NetParseUri,
+ NetHttp,
+ NetSsl,
+ }
+
+ #[repr(u32)]
+ pub enum UsbModule {
+ UsbPspCm = 1,
+ UsbAcc,
+ UsbMic,
+ UsbCam,
+ UsbGps,
+ }
+
+ #[repr(u32)]
+ pub enum NetParam {
+ Name,
+ Ssid,
+ Secure,
+ WepKey,
+ IsStaticIp,
+ Ip,
+ NetMask,
+ Route,
+ ManualDns,
+ PrimaryDns,
+ SecondaryDns,
+ ProxyUser,
+ ProxyPass,
+ UseProxy,
+ ProxyServer,
+ ProxyPort,
+ Unknown1,
+ Unknown2,
+ }
+
+ #[repr(u32)]
+ pub enum UtilityNetconfAction {
+ ConnectAP,
+ DisplayStatus,
+ ConnectAdhoc,
+ }
+
+ #[repr(u32)]
+ pub enum UtilitySavedataMode {
+ AutoLoad,
+ AutoSave,
+ Load,
+ Save,
+ ListLoad,
+ ListSave,
+ ListDelete,
+ Delete,
+ }
+
+ #[repr(u32)]
+ pub enum UtilitySavedataFocus {
+ Unknown1,
+ FirstList,
+ LastList,
+ Latest,
+ Oldest,
+ Unknown2,
+ Unknown3,
+ FirstEmpty,
+ LastEmpty,
+ }
+
+ #[repr(u32)]
+ pub enum UtilityGameSharingMode {
+ Single = 1,
+ Multiple,
+ }
+
+ #[repr(u32)]
+ pub enum UtilityGameSharingDataType {
+ File = 1,
+ Memory,
+ }
+
+ #[repr(u32)]
+ pub enum UtilityHtmlViewerInterfaceMode {
+ Full,
+ Limited,
+ None,
+ }
+
+ #[repr(u32)]
+ pub enum UtilityHtmlViewerCookieMode {
+ Disabled = 0,
+ Enabled,
+ Confirm,
+ Default,
+ }
+
+ #[repr(u32)]
+ pub enum UtilityHtmlViewerTextSize {
+ Large,
+ Normal,
+ Small,
+ }
+
+ #[repr(u32)]
+ pub enum UtilityHtmlViewerDisplayMode {
+ Normal,
+ Fit,
+ SmartFit,
+ }
+
+ #[repr(u32)]
+ pub enum UtilityHtmlViewerConnectMode {
+ Last,
+ ManualOnce,
+ ManualAll,
+ }
+
+ #[repr(u32)]
+ pub enum UtilityHtmlViewerDisconnectMode {
+ Enable,
+ Disable,
+ Confirm,
+ }
+
+ #[repr(u32)]
+ pub enum ScePspnetAdhocPtpState {
+ Closed,
+ Listen,
+ SynSent,
+ SynReceived,
+ Established,
+ }
+
+ #[repr(u32)]
+ pub enum AdhocMatchingMode {
+ Host = 1,
+ Client,
+ Ptp,
+ }
+
+ #[repr(u32)]
+ pub enum ApctlState {
+ Disconnected,
+ Scanning,
+ Joining,
+ GettingIp,
+ GotIp,
+ EapAuth,
+ KeyExchange,
+ }
+
+ #[repr(u32)]
+ pub enum ApctlEvent {
+ ConnectRequest,
+ ScanRequest,
+ ScanComplete,
+ Established,
+ GetIp,
+ DisconnectRequest,
+ Error,
+ Info,
+ EapAuth,
+ KeyExchange,
+ Reconnect,
+ }
+
+ #[repr(u32)]
+ pub enum ApctlInfo {
+ ProfileName,
+ Bssid,
+ Ssid,
+ SsidLength,
+ SecurityType,
+ Strength,
+ Channel,
+ PowerSave,
+ Ip,
+ SubnetMask,
+ Gateway,
+ PrimaryDns,
+ SecondaryDns,
+ UseProxy,
+ ProxyUrl,
+ ProxyPort,
+ EapType,
+ StartBrowser,
+ Wifisp,
+ }
+
+ #[repr(u32)]
+ pub enum ApctlInfoSecurityType {
+ None,
+ Wep,
+ Wpa,
+ }
+
+ #[repr(u32)]
+ pub enum HttpMethod {
+ Get,
+ Post,
+ Head,
+ }
+
+ #[repr(u32)]
+ pub enum HttpAuthType {
+ Basic,
+ Digest,
+ }
+}
+
+s_paren! {
+ #[repr(transparent)]
+ pub struct SceUid(pub i32);
+
+ #[repr(transparent)]
+ pub struct SceMpeg(*mut *mut c_void);
+
+ #[repr(transparent)]
+ pub struct SceMpegStream(*mut c_void);
+
+ #[repr(transparent)]
+ pub struct Mp3Handle(pub i32);
+
+ #[repr(transparent)]
+ pub struct RegHandle(u32);
+}
+
+s! {
+ pub struct sockaddr {
+ pub sa_len: u8,
+ pub sa_family: u8,
+ pub sa_data: [u8;14],
+ }
+
+ pub struct in_addr {
+ pub s_addr: u32,
+ }
+
+ pub struct AudioInputParams {
+ pub unknown1: i32,
+ pub gain: i32,
+ pub unknown2: i32,
+ pub unknown3: i32,
+ pub unknown4: i32,
+ pub unknown5: i32,
+ }
+
+ pub struct Atrac3BufferInfo {
+ pub puc_write_position_first_buf: *mut u8,
+ pub ui_writable_byte_first_buf: u32,
+ pub ui_min_write_byte_first_buf: u32,
+ pub ui_read_position_first_buf: u32,
+ pub puc_write_position_second_buf: *mut u8,
+ pub ui_writable_byte_second_buf: u32,
+ pub ui_min_write_byte_second_buf: u32,
+ pub ui_read_position_second_buf: u32,
+ }
+
+ pub struct SceCtrlData {
+ pub timestamp: u32,
+ pub buttons: i32,
+ pub lx: u8,
+ pub ly: u8,
+ pub rsrv: [u8; 6],
+ }
+
+ pub struct SceCtrlLatch {
+ pub ui_make: u32,
+ pub ui_break: u32,
+ pub ui_press: u32,
+ pub ui_release: u32,
+ }
+
+ pub struct GeStack {
+ pub stack: [u32; 8],
+ }
+
+ pub struct GeCallbackData {
+ pub signal_func: ::Option<extern "C" fn(id: i32, arg: *mut c_void)>,
+ pub signal_arg: *mut c_void,
+ pub finish_func: ::Option<extern "C" fn(id: i32, arg: *mut c_void)>,
+ pub finish_arg: *mut c_void,
+ }
+
+ pub struct GeListArgs {
+ pub size: u32,
+ pub context: *mut GeContext,
+ pub num_stacks: u32,
+ pub stacks: *mut GeStack,
+ }
+
+ pub struct GeBreakParam {
+ pub buf: [u32; 4],
+ }
+
+ pub struct SceKernelLoadExecParam {
+ pub size: usize,
+ pub args: usize,
+ pub argp: *mut c_void,
+ pub key: *const u8,
+ }
+
+ pub struct timeval {
+ pub tv_sec: i32,
+ pub tv_usec: i32,
+ }
+
+ pub struct timezone {
+ pub tz_minutes_west: i32,
+ pub tz_dst_time: i32,
+ }
+
+ pub struct IntrHandlerOptionParam {
+ size: i32,
+ entry: u32,
+ common: u32,
+ gp: u32,
+ intr_code: u16,
+ sub_count: u16,
+ intr_level: u16,
+ enabled: u16,
+ calls: u32,
+ field_1c: u32,
+ total_clock_lo: u32,
+ total_clock_hi: u32,
+ min_clock_lo: u32,
+ min_clock_hi: u32,
+ max_clock_lo: u32,
+ max_clock_hi: u32,
+ }
+
+ pub struct SceKernelLMOption {
+ pub size: usize,
+ pub m_pid_text: SceUid,
+ pub m_pid_data: SceUid,
+ pub flags: u32,
+ pub position: u8,
+ pub access: u8,
+ pub c_reserved: [u8; 2usize],
+ }
+
+ pub struct SceKernelSMOption {
+ pub size: usize,
+ pub m_pid_stack: SceUid,
+ pub stack_size: usize,
+ pub priority: i32,
+ pub attribute: u32,
+ }
+
+ pub struct SceKernelModuleInfo {
+ pub size: usize,
+ pub n_segment: u8,
+ pub reserved: [u8; 3usize],
+ pub segment_addr: [i32; 4usize],
+ pub segment_size: [i32; 4usize],
+ pub entry_addr: u32,
+ pub gp_value: u32,
+ pub text_addr: u32,
+ pub text_size: u32,
+ pub data_size: u32,
+ pub bss_size: u32,
+ pub attribute: u16,
+ pub version: [u8; 2usize],
+ pub name: [u8; 28usize],
+ }
+
+ pub struct DebugProfilerRegs {
+ pub enable: u32,
+ pub systemck: u32,
+ pub cpuck: u32,
+ pub internal: u32,
+ pub memory: u32,
+ pub copz: u32,
+ pub vfpu: u32,
+ pub sleep: u32,
+ pub bus_access: u32,
+ pub uncached_load: u32,
+ pub uncached_store: u32,
+ pub cached_load: u32,
+ pub cached_store: u32,
+ pub i_miss: u32,
+ pub d_miss: u32,
+ pub d_writeback: u32,
+ pub cop0_inst: u32,
+ pub fpu_inst: u32,
+ pub vfpu_inst: u32,
+ pub local_bus: u32,
+ }
+
+ pub struct SceKernelSysClock {
+ pub low: u32,
+ pub hi: u32,
+ }
+
+ pub struct SceKernelThreadOptParam {
+ pub size: usize,
+ pub stack_mpid: SceUid,
+ }
+
+ pub struct SceKernelThreadInfo {
+ pub size: usize,
+ pub name: [u8; 32],
+ pub attr: u32,
+ pub status: i32,
+ pub entry: SceKernelThreadEntry,
+ pub stack: *mut c_void,
+ pub stack_size: i32,
+ pub gp_reg: *mut c_void,
+ pub init_priority: i32,
+ pub current_priority: i32,
+ pub wait_type: i32,
+ pub wait_id: SceUid,
+ pub wakeup_count: i32,
+ pub exit_status: i32,
+ pub run_clocks: SceKernelSysClock,
+ pub intr_preempt_count: u32,
+ pub thread_preempt_count: u32,
+ pub release_count: u32,
+ }
+
+ pub struct SceKernelThreadRunStatus {
+ pub size: usize,
+ pub status: i32,
+ pub current_priority: i32,
+ pub wait_type: i32,
+ pub wait_id: i32,
+ pub wakeup_count: i32,
+ pub run_clocks: SceKernelSysClock,
+ pub intr_preempt_count: u32,
+ pub thread_preempt_count: u32,
+ pub release_count: u32,
+ }
+
+ pub struct SceKernelSemaOptParam {
+ pub size: usize,
+ }
+
+ pub struct SceKernelSemaInfo {
+ pub size: usize,
+ pub name: [u8; 32],
+ pub attr: u32,
+ pub init_count: i32,
+ pub current_count: i32,
+ pub max_count: i32,
+ pub num_wait_threads: i32,
+ }
+
+ pub struct SceKernelEventFlagInfo {
+ pub size: usize,
+ pub name: [u8; 32],
+ pub attr: u32,
+ pub init_pattern: u32,
+ pub current_pattern: u32,
+ pub num_wait_threads: i32,
+ }
+
+ pub struct SceKernelEventFlagOptParam {
+ pub size: usize,
+ }
+
+ pub struct SceKernelMbxOptParam {
+ pub size: usize,
+ }
+
+ pub struct SceKernelMbxInfo {
+ pub size: usize,
+ pub name: [u8; 32usize],
+ pub attr: u32,
+ pub num_wait_threads: i32,
+ pub num_messages: i32,
+ pub first_message: *mut c_void,
+ }
+
+ pub struct SceKernelVTimerInfo {
+ pub size: usize,
+ pub name: [u8; 32],
+ pub active: i32,
+ pub base: SceKernelSysClock,
+ pub current: SceKernelSysClock,
+ pub schedule: SceKernelSysClock,
+ pub handler: SceKernelVTimerHandler,
+ pub common: *mut c_void,
+ }
+
+ pub struct SceKernelThreadEventHandlerInfo {
+ pub size: usize,
+ pub name: [u8; 32],
+ pub thread_id: SceUid,
+ pub mask: i32,
+ pub handler: SceKernelThreadEventHandler,
+ pub common: *mut c_void,
+ }
+
+ pub struct SceKernelAlarmInfo {
+ pub size: usize,
+ pub schedule: SceKernelSysClock,
+ pub handler: SceKernelAlarmHandler,
+ pub common: *mut c_void,
+ }
+
+ pub struct SceKernelSystemStatus {
+ pub size: usize,
+ pub status: u32,
+ pub idle_clocks: SceKernelSysClock,
+ pub comes_out_of_idle_count: u32,
+ pub thread_switch_count: u32,
+ pub vfpu_switch_count: u32,
+ }
+
+ pub struct SceKernelMppInfo {
+ pub size: usize,
+ pub name: [u8; 32],
+ pub attr: u32,
+ pub buf_size: i32,
+ pub free_size: i32,
+ pub num_send_wait_threads: i32,
+ pub num_receive_wait_threads: i32,
+ }
+
+ pub struct SceKernelVplOptParam {
+ pub size: usize,
+ }
+
+ pub struct SceKernelVplInfo {
+ pub size: usize,
+ pub name: [u8; 32],
+ pub attr: u32,
+ pub pool_size: i32,
+ pub free_size: i32,
+ pub num_wait_threads: i32,
+ }
+
+ pub struct SceKernelFplOptParam {
+ pub size: usize,
+ }
+
+ pub struct SceKernelFplInfo {
+ pub size: usize,
+ pub name: [u8; 32usize],
+ pub attr: u32,
+ pub block_size: i32,
+ pub num_blocks: i32,
+ pub free_blocks: i32,
+ pub num_wait_threads: i32,
+ }
+
+ pub struct SceKernelVTimerOptParam {
+ pub size: usize,
+ }
+
+ pub struct SceKernelCallbackInfo {
+ pub size: usize,
+ pub name: [u8; 32usize],
+ pub thread_id: SceUid,
+ pub callback: SceKernelCallbackFunction,
+ pub common: *mut c_void,
+ pub notify_count: i32,
+ pub notify_arg: i32,
+ }
+
+ pub struct UsbCamSetupStillParam {
+ pub size: i32,
+ pub resolution: UsbCamResolution,
+ pub jpeg_size: i32,
+ pub reverse_flags: i32,
+ pub delay: UsbCamDelay,
+ pub comp_level: i32,
+ }
+
+ pub struct UsbCamSetupStillExParam {
+ pub size: i32,
+ pub unk: u32,
+ pub resolution: UsbCamResolutionEx,
+ pub jpeg_size: i32,
+ pub comp_level: i32,
+ pub unk2: u32,
+ pub unk3: u32,
+ pub flip: i32,
+ pub mirror: i32,
+ pub delay: UsbCamDelay,
+ pub unk4: [u32; 5usize],
+ }
+
+ pub struct UsbCamSetupVideoParam {
+ pub size: i32,
+ pub resolution: UsbCamResolution,
+ pub framerate: UsbCamFrameRate,
+ pub white_balance: UsbCamWb,
+ pub saturation: i32,
+ pub brightness: i32,
+ pub contrast: i32,
+ pub sharpness: i32,
+ pub effect_mode: UsbCamEffectMode,
+ pub frame_size: i32,
+ pub unk: u32,
+ pub evl_evel: UsbCamEvLevel,
+ }
+
+ pub struct UsbCamSetupVideoExParam {
+ pub size: i32,
+ pub unk: u32,
+ pub resolution: UsbCamResolutionEx,
+ pub framerate: UsbCamFrameRate,
+ pub unk2: u32,
+ pub unk3: u32,
+ pub white_balance: UsbCamWb,
+ pub saturation: i32,
+ pub brightness: i32,
+ pub contrast: i32,
+ pub sharpness: i32,
+ pub unk4: u32,
+ pub unk5: u32,
+ pub unk6: [u32; 3usize],
+ pub effect_mode: UsbCamEffectMode,
+ pub unk7: u32,
+ pub unk8: u32,
+ pub unk9: u32,
+ pub unk10: u32,
+ pub unk11: u32,
+ pub frame_size: i32,
+ pub unk12: u32,
+ pub ev_level: UsbCamEvLevel,
+ }
+
+ pub struct ScePspDateTime {
+ pub year: u16,
+ pub month: u16,
+ pub day: u16,
+ pub hour: u16,
+ pub minutes: u16,
+ pub seconds: u16,
+ pub microseconds: u32,
+ }
+
+ pub struct SceIoStat {
+ pub st_mode: i32,
+ pub st_attr: i32,
+ pub st_size: i64,
+ pub st_ctime: ScePspDateTime,
+ pub st_atime: ScePspDateTime,
+ pub st_mtime: ScePspDateTime,
+ pub st_private: [u32; 6usize],
+ }
+
+ pub struct UmdInfo {
+ pub size: u32,
+ pub type_: UmdType,
+ }
+
+ pub struct SceMpegRingbuffer {
+ pub packets: i32,
+ pub unk0: u32,
+ pub unk1: u32,
+ pub unk2: u32,
+ pub unk3: u32,
+ pub data: *mut c_void,
+ pub callback: SceMpegRingbufferCb,
+ pub cb_param: *mut c_void,
+ pub unk4: u32,
+ pub unk5: u32,
+ pub sce_mpeg: *mut c_void,
+ }
+
+ pub struct SceMpegAu {
+ pub pts_msb: u32,
+ pub pts: u32,
+ pub dts_msb: u32,
+ pub dts: u32,
+ pub es_buffer: u32,
+ pub au_size: u32,
+ }
+
+ pub struct SceMpegAvcMode {
+ pub unk0: i32,
+ pub pixel_format: super::DisplayPixelFormat,
+ }
+
+ #[repr(align(64))]
+ pub struct SceMpegLLI {
+ pub src: *mut c_void,
+ pub dst: *mut c_void,
+ pub next: *mut c_void,
+ pub size: i32,
+ }
+
+ #[repr(align(64))]
+ pub struct SceMpegYCrCbBuffer {
+ pub frame_buffer_height16: i32,
+ pub frame_buffer_width16: i32,
+ pub unknown: i32,
+ pub unknown2: i32,
+ pub y_buffer: *mut c_void,
+ pub y_buffer2: *mut c_void,
+ pub cr_buffer: *mut c_void,
+ pub cb_buffer: *mut c_void,
+ pub cr_buffer2: *mut c_void,
+ pub cb_buffer2: *mut c_void,
+
+ pub frame_height: i32,
+ pub frame_width: i32,
+ pub frame_buffer_width: i32,
+ pub unknown3: [i32; 11usize],
+ }
+
+ pub struct ScePspSRect {
+ pub x: i16,
+ pub y: i16,
+ pub w: i16,
+ pub h: i16,
+ }
+
+ pub struct ScePspIRect {
+ pub x: i32,
+ pub y: i32,
+ pub w: i32,
+ pub h: i32,
+ }
+
+ pub struct ScePspL64Rect {
+ pub x: u64,
+ pub y: u64,
+ pub w: u64,
+ pub h: u64,
+ }
+
+ pub struct ScePspSVector2 {
+ pub x: i16,
+ pub y: i16,
+ }
+
+ pub struct ScePspIVector2 {
+ pub x: i32,
+ pub y: i32,
+ }
+
+ pub struct ScePspL64Vector2 {
+ pub x: u64,
+ pub y: u64,
+ }
+
+ pub struct ScePspSVector3 {
+ pub x: i16,
+ pub y: i16,
+ pub z: i16,
+ }
+
+ pub struct ScePspIVector3 {
+ pub x: i32,
+ pub y: i32,
+ pub z: i32,
+ }
+
+ pub struct ScePspL64Vector3 {
+ pub x: u64,
+ pub y: u64,
+ pub z: u64,
+ }
+
+ pub struct ScePspSVector4 {
+ pub x: i16,
+ pub y: i16,
+ pub z: i16,
+ pub w: i16,
+ }
+
+ pub struct ScePspIVector4 {
+ pub x: i32,
+ pub y: i32,
+ pub z: i32,
+ pub w: i32,
+ }
+
+ pub struct ScePspL64Vector4 {
+ pub x: u64,
+ pub y: u64,
+ pub z: u64,
+ pub w: u64,
+ }
+
+ pub struct ScePspIMatrix2 {
+ pub x: ScePspIVector2,
+ pub y: ScePspIVector2,
+ }
+
+ pub struct ScePspIMatrix3 {
+ pub x: ScePspIVector3,
+ pub y: ScePspIVector3,
+ pub z: ScePspIVector3,
+ }
+
+ #[repr(align(16))]
+ pub struct ScePspIMatrix4 {
+ pub x: ScePspIVector4,
+ pub y: ScePspIVector4,
+ pub z: ScePspIVector4,
+ pub w: ScePspIVector4,
+ }
+
+ pub struct ScePspIMatrix4Unaligned {
+ pub x: ScePspIVector4,
+ pub y: ScePspIVector4,
+ pub z: ScePspIVector4,
+ pub w: ScePspIVector4,
+ }
+
+ pub struct SceMp3InitArg {
+ pub mp3_stream_start: u32,
+ pub unk1: u32,
+ pub mp3_stream_end: u32,
+ pub unk2: u32,
+ pub mp3_buf: *mut c_void,
+ pub mp3_buf_size: i32,
+ pub pcm_buf: *mut c_void,
+ pub pcm_buf_size: i32,
+ }
+
+ pub struct OpenPSID {
+ pub data: [u8; 16usize],
+ }
+
+ pub struct UtilityDialogCommon {
+ pub size: u32,
+ pub language: SystemParamLanguage,
+ pub button_accept: UtilityDialogButtonAccept,
+ pub graphics_thread: i32,
+ pub access_thread: i32,
+ pub font_thread: i32,
+ pub sound_thread: i32,
+ pub result: i32,
+ pub reserved: [i32; 4usize],
+ }
+
+ pub struct UtilityNetconfAdhoc {
+ pub name: [u8; 8usize],
+ pub timeout: u32,
+ }
+
+ pub struct UtilityNetconfData {
+ pub base: UtilityDialogCommon,
+ pub action: UtilityNetconfAction,
+ pub adhocparam: *mut UtilityNetconfAdhoc,
+ pub hotspot: i32,
+ pub hotspot_connected: i32,
+ pub wifisp: i32,
+ }
+
+ pub struct UtilitySavedataFileData {
+ pub buf: *mut c_void,
+ pub buf_size: usize,
+ pub size: usize,
+ pub unknown: i32,
+ }
+
+ pub struct UtilitySavedataListSaveNewData {
+ pub icon0: UtilitySavedataFileData,
+ pub title: *mut u8,
+ }
+
+ pub struct UtilityGameSharingParams {
+ pub base: UtilityDialogCommon,
+ pub unknown1: i32,
+ pub unknown2: i32,
+ pub name: [u8; 8usize],
+ pub unknown3: i32,
+ pub unknown4: i32,
+ pub unknown5: i32,
+ pub result: i32,
+ pub filepath: *mut u8,
+ pub mode: UtilityGameSharingMode,
+ pub datatype: UtilityGameSharingDataType,
+ pub data: *mut c_void,
+ pub datasize: u32,
+ }
+
+ pub struct UtilityHtmlViewerParam {
+ pub base: UtilityDialogCommon,
+ pub memaddr: *mut c_void,
+ pub memsize: u32,
+ pub unknown1: i32,
+ pub unknown2: i32,
+ pub initialurl: *mut u8,
+ pub numtabs: u32,
+ pub interfacemode: UtilityHtmlViewerInterfaceMode,
+ pub options: i32,
+ pub dldirname: *mut u8,
+ pub dlfilename: *mut u8,
+ pub uldirname: *mut u8,
+ pub ulfilename: *mut u8,
+ pub cookiemode: UtilityHtmlViewerCookieMode,
+ pub unknown3: u32,
+ pub homeurl: *mut u8,
+ pub textsize: UtilityHtmlViewerTextSize,
+ pub displaymode: UtilityHtmlViewerDisplayMode,
+ pub connectmode: UtilityHtmlViewerConnectMode,
+ pub disconnectmode: UtilityHtmlViewerDisconnectMode,
+ pub memused: u32,
+ pub unknown4: [i32; 10usize],
+ }
+
+ pub struct SceUtilityOskData {
+ pub unk_00: i32,
+ pub unk_04: i32,
+ pub language: SceUtilityOskInputLanguage,
+ pub unk_12: i32,
+ pub inputtype: SceUtilityOskInputType,
+ pub lines: i32,
+ pub unk_24: i32,
+ pub desc: *mut u16,
+ pub intext: *mut u16,
+ pub outtextlength: i32,
+ pub outtext: *mut u16,
+ pub result: SceUtilityOskResult,
+ pub outtextlimit: i32,
+ }
+
+ pub struct SceUtilityOskParams {
+ pub base: UtilityDialogCommon,
+ pub datacount: i32,
+ pub data: *mut SceUtilityOskData,
+ pub state: SceUtilityOskState,
+ pub unk_60: i32,
+ }
+
+ pub struct SceNetMallocStat {
+ pub pool: i32,
+ pub maximum: i32,
+ pub free: i32,
+ }
+
+ pub struct SceNetAdhocctlAdhocId {
+ pub unknown: i32,
+ pub adhoc_id: [u8; 9usize],
+ pub unk: [u8; 3usize],
+ }
+
+ pub struct SceNetAdhocctlScanInfo {
+ pub next: *mut SceNetAdhocctlScanInfo,
+ pub channel: i32,
+ pub name: [u8; 8usize],
+ pub bssid: [u8; 6usize],
+ pub unknown: [u8; 2usize],
+ pub unknown2: i32,
+ }
+
+ pub struct SceNetAdhocctlGameModeInfo {
+ pub count: i32,
+ pub macs: [[u8; 6usize]; 16usize],
+ }
+
+ pub struct SceNetAdhocPtpStat {
+ pub next: *mut SceNetAdhocPtpStat,
+ pub ptp_id: i32,
+ pub mac: [u8; 6usize],
+ pub peermac: [u8; 6usize],
+ pub port: u16,
+ pub peerport: u16,
+ pub sent_data: u32,
+ pub rcvd_data: u32,
+ pub state: ScePspnetAdhocPtpState,
+ }
+
+ pub struct SceNetAdhocPdpStat {
+ pub next: *mut SceNetAdhocPdpStat,
+ pub pdp_id: i32,
+ pub mac: [u8; 6usize],
+ pub port: u16,
+ pub rcvd_data: u32,
+ }
+
+ pub struct AdhocPoolStat {
+ pub size: i32,
+ pub maxsize: i32,
+ pub freesize: i32,
+ }
+}
+
+s_no_extra_traits! {
+ #[allow(missing_debug_implementations)]
+ pub struct GeContext {
+ pub context: [u32; 512],
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub struct SceKernelUtilsSha1Context {
+ pub h: [u32; 5usize],
+ pub us_remains: u16,
+ pub us_computed: u16,
+ pub ull_total_len: u64,
+ pub buf: [u8; 64usize],
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub struct SceKernelUtilsMt19937Context {
+ pub count: u32,
+ pub state: [u32; 624usize],
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub struct SceKernelUtilsMd5Context {
+ pub h: [u32; 4usize],
+ pub pad: u32,
+ pub us_remains: u16,
+ pub us_computed: u16,
+ pub ull_total_len: u64,
+ pub buf: [u8; 64usize],
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub struct SceIoDirent {
+ pub d_stat: SceIoStat,
+ pub d_name: [u8; 256usize],
+ pub d_private: *mut c_void,
+ pub dummy: i32,
+ }
+
+ #[cfg_attr(feature = "extra_traits", derive(Debug))]
+ pub struct ScePspFRect {
+ pub x: f32,
+ pub y: f32,
+ pub w: f32,
+ pub h: f32,
+ }
+
+ #[repr(align(16))]
+ #[cfg_attr(feature = "extra_traits", derive(Debug))]
+ pub struct ScePspFVector3 {
+ pub x: f32,
+ pub y: f32,
+ pub z: f32,
+ }
+
+ #[repr(align(16))]
+ #[cfg_attr(feature = "extra_traits", derive(Debug))]
+ pub struct ScePspFVector4 {
+ pub x: f32,
+ pub y: f32,
+ pub z: f32,
+ pub w: f32,
+ }
+
+ #[cfg_attr(feature = "extra_traits", derive(Debug))]
+ pub struct ScePspFVector4Unaligned {
+ pub x: f32,
+ pub y: f32,
+ pub z: f32,
+ pub w: f32,
+ }
+
+ #[cfg_attr(feature = "extra_traits", derive(Debug))]
+ pub struct ScePspFVector2 {
+ pub x: f32,
+ pub y: f32,
+ }
+
+ #[cfg_attr(feature = "extra_traits", derive(Debug))]
+ pub struct ScePspFMatrix2 {
+ pub x: ScePspFVector2,
+ pub y: ScePspFVector2,
+ }
+
+ #[cfg_attr(feature = "extra_traits", derive(Debug))]
+ pub struct ScePspFMatrix3 {
+ pub x: ScePspFVector3,
+ pub y: ScePspFVector3,
+ pub z: ScePspFVector3,
+ }
+
+ #[cfg_attr(feature = "extra_traits", derive(Debug))]
+ #[repr(align(16))]
+ pub struct ScePspFMatrix4 {
+ pub x: ScePspFVector4,
+ pub y: ScePspFVector4,
+ pub z: ScePspFVector4,
+ pub w: ScePspFVector4,
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub struct ScePspFMatrix4Unaligned {
+ pub x: ScePspFVector4,
+ pub y: ScePspFVector4,
+ pub z: ScePspFVector4,
+ pub w: ScePspFVector4,
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub union ScePspVector3 {
+ pub fv: ScePspFVector3,
+ pub iv: ScePspIVector3,
+ pub f: [f32; 3usize],
+ pub i: [i32; 3usize],
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub union ScePspVector4 {
+ pub fv: ScePspFVector4,
+ pub iv: ScePspIVector4,
+ pub qw: u128,
+ pub f: [f32; 4usize],
+ pub i: [i32; 4usize],
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub union ScePspMatrix2 {
+ pub fm: ScePspFMatrix2,
+ pub im: ScePspIMatrix2,
+ pub fv: [ScePspFVector2; 2usize],
+ pub iv: [ScePspIVector2; 2usize],
+ pub v: [ScePspVector2; 2usize],
+ pub f: [[f32; 2usize]; 2usize],
+ pub i: [[i32; 2usize]; 2usize],
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub union ScePspMatrix3 {
+ pub fm: ScePspFMatrix3,
+ pub im: ScePspIMatrix3,
+ pub fv: [ScePspFVector3; 3usize],
+ pub iv: [ScePspIVector3; 3usize],
+ pub v: [ScePspVector3; 3usize],
+ pub f: [[f32; 3usize]; 3usize],
+ pub i: [[i32; 3usize]; 3usize],
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub union ScePspVector2 {
+ pub fv: ScePspFVector2,
+ pub iv: ScePspIVector2,
+ pub f: [f32; 2usize],
+ pub i: [i32; 2usize],
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub union ScePspMatrix4 {
+ pub fm: ScePspFMatrix4,
+ pub im: ScePspIMatrix4,
+ pub fv: [ScePspFVector4; 4usize],
+ pub iv: [ScePspIVector4; 4usize],
+ pub v: [ScePspVector4; 4usize],
+ pub f: [[f32; 4usize]; 4usize],
+ pub i: [[i32; 4usize]; 4usize],
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub struct Key {
+ pub key_type: KeyType,
+ pub name: [u8; 256usize],
+ pub name_len: u32,
+ pub unk2: u32,
+ pub unk3: u32,
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub struct UtilityMsgDialogParams {
+ pub base: UtilityDialogCommon,
+ pub unknown: i32,
+ pub mode: UtilityMsgDialogMode,
+ pub error_value: u32,
+ pub message: [u8; 512usize],
+ pub options: i32,
+ pub button_pressed: UtilityMsgDialogPressed,
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub union UtilityNetData {
+ pub as_uint: u32,
+ pub as_string: [u8; 128usize],
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub struct UtilitySavedataSFOParam {
+ pub title: [u8; 128usize],
+ pub savedata_title: [u8; 128usize],
+ pub detail: [u8; 1024usize],
+ pub parental_level: u8,
+ pub unknown: [u8; 3usize],
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub struct SceUtilitySavedataParam {
+ pub base: UtilityDialogCommon,
+ pub mode: UtilitySavedataMode,
+ pub unknown1: i32,
+ pub overwrite: i32,
+ pub game_name: [u8; 13usize],
+ pub reserved: [u8; 3usize],
+ pub save_name: [u8; 20usize],
+ pub save_name_list: *mut [u8; 20usize],
+ pub file_name: [u8; 13usize],
+ pub reserved1: [u8; 3usize],
+ pub data_buf: *mut c_void,
+ pub data_buf_size: usize,
+ pub data_size: usize,
+ pub sfo_param: UtilitySavedataSFOParam,
+ pub icon0_file_data: UtilitySavedataFileData,
+ pub icon1_file_data: UtilitySavedataFileData,
+ pub pic1_file_data: UtilitySavedataFileData,
+ pub snd0_file_data: UtilitySavedataFileData,
+ pub new_data: *mut UtilitySavedataListSaveNewData,
+ pub focus: UtilitySavedataFocus,
+ pub unknown2: [i32; 4usize],
+ pub key: [u8; 16],
+ pub unknown3: [u8; 20],
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub struct SceNetAdhocctlPeerInfo {
+ pub next: *mut SceNetAdhocctlPeerInfo,
+ pub nickname: [u8; 128usize],
+ pub mac: [u8; 6usize],
+ pub unknown: [u8; 6usize],
+ pub timestamp: u32,
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub struct SceNetAdhocctlParams {
+ pub channel: i32,
+ pub name: [u8; 8usize],
+ pub bssid: [u8; 6usize],
+ pub nickname: [u8; 128usize],
+ }
+
+ #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))]
+ pub union SceNetApctlInfo {
+ pub name: [u8; 64usize],
+ pub bssid: [u8; 6usize],
+ pub ssid: [u8; 32usize],
+ pub ssid_length: u32,
+ pub security_type: u32,
+ pub strength: u8,
+ pub channel: u8,
+ pub power_save: u8,
+ pub ip: [u8; 16usize],
+ pub sub_net_mask: [u8; 16usize],
+ pub gateway: [u8; 16usize],
+ pub primary_dns: [u8; 16usize],
+ pub secondary_dns: [u8; 16usize],
+ pub use_proxy: u32,
+ pub proxy_url: [u8; 128usize],
+ pub proxy_port: u16,
+ pub eap_type: u32,
+ pub start_browser: u32,
+ pub wifisp: u32,
+ }
+}
+
+pub const INT_MIN: c_int = -2147483648;
+pub const INT_MAX: c_int = 2147483647;
+
+pub const AUDIO_VOLUME_MAX: u32 = 0x8000;
+pub const AUDIO_CHANNEL_MAX: u32 = 8;
+pub const AUDIO_NEXT_CHANNEL: i32 = -1;
+pub const AUDIO_SAMPLE_MIN: u32 = 64;
+pub const AUDIO_SAMPLE_MAX: u32 = 65472;
+
+pub const PSP_CTRL_SELECT: i32 = 0x000001;
+pub const PSP_CTRL_START: i32 = 0x000008;
+pub const PSP_CTRL_UP: i32 = 0x000010;
+pub const PSP_CTRL_RIGHT: i32 = 0x000020;
+pub const PSP_CTRL_DOWN: i32 = 0x000040;
+pub const PSP_CTRL_LEFT: i32 = 0x000080;
+pub const PSP_CTRL_LTRIGGER: i32 = 0x000100;
+pub const PSP_CTRL_RTRIGGER: i32 = 0x000200;
+pub const PSP_CTRL_TRIANGLE: i32 = 0x001000;
+pub const PSP_CTRL_CIRCLE: i32 = 0x002000;
+pub const PSP_CTRL_CROSS: i32 = 0x004000;
+pub const PSP_CTRL_SQUARE: i32 = 0x008000;
+pub const PSP_CTRL_HOME: i32 = 0x010000;
+pub const PSP_CTRL_HOLD: i32 = 0x020000;
+pub const PSP_CTRL_NOTE: i32 = 0x800000;
+pub const PSP_CTRL_SCREEN: i32 = 0x400000;
+pub const PSP_CTRL_VOLUP: i32 = 0x100000;
+pub const PSP_CTRL_VOLDOWN: i32 = 0x200000;
+pub const PSP_CTRL_WLAN_UP: i32 = 0x040000;
+pub const PSP_CTRL_REMOTE: i32 = 0x080000;
+pub const PSP_CTRL_DISC: i32 = 0x1000000;
+pub const PSP_CTRL_MS: i32 = 0x2000000;
+
+pub const USB_CAM_PID: i32 = 0x282;
+pub const USB_BUS_DRIVER_NAME: &str = "USBBusDriver";
+pub const USB_CAM_DRIVER_NAME: &str = "USBCamDriver";
+pub const USB_CAM_MIC_DRIVER_NAME: &str = "USBCamMicDriver";
+pub const USB_STOR_DRIVER_NAME: &str = "USBStor_Driver";
+
+pub const ACTIVATED: i32 = 0x200;
+pub const CONNECTED: i32 = 0x020;
+pub const ESTABLISHED: i32 = 0x002;
+
+pub const USB_CAM_FLIP: i32 = 1;
+pub const USB_CAM_MIRROR: i32 = 0x100;
+
+pub const THREAD_ATTR_VFPU: i32 = 0x00004000;
+pub const THREAD_ATTR_USER: i32 = 0x80000000;
+pub const THREAD_ATTR_USBWLAN: i32 = 0xa0000000;
+pub const THREAD_ATTR_VSH: i32 = 0xc0000000;
+pub const THREAD_ATTR_SCRATCH_SRAM: i32 = 0x00008000;
+pub const THREAD_ATTR_NO_FILLSTACK: i32 = 0x00100000;
+pub const THREAD_ATTR_CLEAR_STACK: i32 = 0x00200000;
+
+pub const EVENT_WAIT_MULTIPLE: i32 = 0x200;
+
+pub const EVENT_WAIT_AND: i32 = 0;
+pub const EVENT_WAIT_OR: i32 = 1;
+pub const EVENT_WAIT_CLEAR: i32 = 0x20;
+
+pub const POWER_INFO_POWER_SWITCH: i32 = 0x80000000;
+pub const POWER_INFO_HOLD_SWITCH: i32 = 0x40000000;
+pub const POWER_INFO_STANDBY: i32 = 0x00080000;
+pub const POWER_INFO_RESUME_COMPLETE: i32 = 0x00040000;
+pub const POWER_INFO_RESUMING: i32 = 0x00020000;
+pub const POWER_INFO_SUSPENDING: i32 = 0x00010000;
+pub const POWER_INFO_AC_POWER: i32 = 0x00001000;
+pub const POWER_INFO_BATTERY_LOW: i32 = 0x00000100;
+pub const POWER_INFO_BATTERY_EXIST: i32 = 0x00000080;
+pub const POWER_INFO_BATTERY_POWER: i32 = 0x0000007;
+
+pub const FIO_S_IFLNK: i32 = 0x4000;
+pub const FIO_S_IFDIR: i32 = 0x1000;
+pub const FIO_S_IFREG: i32 = 0x2000;
+pub const FIO_S_ISUID: i32 = 0x0800;
+pub const FIO_S_ISGID: i32 = 0x0400;
+pub const FIO_S_ISVTX: i32 = 0x0200;
+pub const FIO_S_IRUSR: i32 = 0x0100;
+pub const FIO_S_IWUSR: i32 = 0x0080;
+pub const FIO_S_IXUSR: i32 = 0x0040;
+pub const FIO_S_IRGRP: i32 = 0x0020;
+pub const FIO_S_IWGRP: i32 = 0x0010;
+pub const FIO_S_IXGRP: i32 = 0x0008;
+pub const FIO_S_IROTH: i32 = 0x0004;
+pub const FIO_S_IWOTH: i32 = 0x0002;
+pub const FIO_S_IXOTH: i32 = 0x0001;
+
+pub const FIO_SO_IFLNK: i32 = 0x0008;
+pub const FIO_SO_IFDIR: i32 = 0x0010;
+pub const FIO_SO_IFREG: i32 = 0x0020;
+pub const FIO_SO_IROTH: i32 = 0x0004;
+pub const FIO_SO_IWOTH: i32 = 0x0002;
+pub const FIO_SO_IXOTH: i32 = 0x0001;
+
+pub const PSP_O_RD_ONLY: i32 = 0x0001;
+pub const PSP_O_WR_ONLY: i32 = 0x0002;
+pub const PSP_O_RD_WR: i32 = 0x0003;
+pub const PSP_O_NBLOCK: i32 = 0x0004;
+pub const PSP_O_DIR: i32 = 0x0008;
+pub const PSP_O_APPEND: i32 = 0x0100;
+pub const PSP_O_CREAT: i32 = 0x0200;
+pub const PSP_O_TRUNC: i32 = 0x0400;
+pub const PSP_O_EXCL: i32 = 0x0800;
+pub const PSP_O_NO_WAIT: i32 = 0x8000;
+
+pub const UMD_NOT_PRESENT: i32 = 0x01;
+pub const UMD_PRESENT: i32 = 0x02;
+pub const UMD_CHANGED: i32 = 0x04;
+pub const UMD_INITING: i32 = 0x08;
+pub const UMD_INITED: i32 = 0x10;
+pub const UMD_READY: i32 = 0x20;
+
+pub const PLAY_PAUSE: i32 = 0x1;
+pub const FORWARD: i32 = 0x4;
+pub const BACK: i32 = 0x8;
+pub const VOL_UP: i32 = 0x10;
+pub const VOL_DOWN: i32 = 0x20;
+pub const HOLD: i32 = 0x80;
+
+pub const GU_PI: f32 = 3.141593;
+
+pub const GU_TEXTURE_8BIT: i32 = 1;
+pub const GU_TEXTURE_16BIT: i32 = 2;
+pub const GU_TEXTURE_32BITF: i32 = 3;
+pub const GU_COLOR_5650: i32 = 4 << 2;
+pub const GU_COLOR_5551: i32 = 5 << 2;
+pub const GU_COLOR_4444: i32 = 6 << 2;
+pub const GU_COLOR_8888: i32 = 7 << 2;
+pub const GU_NORMAL_8BIT: i32 = 1 << 5;
+pub const GU_NORMAL_16BIT: i32 = 2 << 5;
+pub const GU_NORMAL_32BITF: i32 = 3 << 5;
+pub const GU_VERTEX_8BIT: i32 = 1 << 7;
+pub const GU_VERTEX_16BIT: i32 = 2 << 7;
+pub const GU_VERTEX_32BITF: i32 = 3 << 7;
+pub const GU_WEIGHT_8BIT: i32 = 1 << 9;
+pub const GU_WEIGHT_16BIT: i32 = 2 << 9;
+pub const GU_WEIGHT_32BITF: i32 = 3 << 9;
+pub const GU_INDEX_8BIT: i32 = 1 << 11;
+pub const GU_INDEX_16BIT: i32 = 2 << 11;
+pub const GU_WEIGHTS1: i32 = (((1 - 1) & 7) << 14) as i32;
+pub const GU_WEIGHTS2: i32 = (((2 - 1) & 7) << 14) as i32;
+pub const GU_WEIGHTS3: i32 = (((3 - 1) & 7) << 14) as i32;
+pub const GU_WEIGHTS4: i32 = (((4 - 1) & 7) << 14) as i32;
+pub const GU_WEIGHTS5: i32 = (((5 - 1) & 7) << 14) as i32;
+pub const GU_WEIGHTS6: i32 = (((6 - 1) & 7) << 14) as i32;
+pub const GU_WEIGHTS7: i32 = (((7 - 1) & 7) << 14) as i32;
+pub const GU_WEIGHTS8: i32 = (((8 - 1) & 7) << 14) as i32;
+pub const GU_VERTICES1: i32 = (((1 - 1) & 7) << 18) as i32;
+pub const GU_VERTICES2: i32 = (((2 - 1) & 7) << 18) as i32;
+pub const GU_VERTICES3: i32 = (((3 - 1) & 7) << 18) as i32;
+pub const GU_VERTICES4: i32 = (((4 - 1) & 7) << 18) as i32;
+pub const GU_VERTICES5: i32 = (((5 - 1) & 7) << 18) as i32;
+pub const GU_VERTICES6: i32 = (((6 - 1) & 7) << 18) as i32;
+pub const GU_VERTICES7: i32 = (((7 - 1) & 7) << 18) as i32;
+pub const GU_VERTICES8: i32 = (((8 - 1) & 7) << 18) as i32;
+pub const GU_TRANSFORM_2D: i32 = 1 << 23;
+pub const GU_TRANSFORM_3D: i32 = 0;
+
+pub const GU_COLOR_BUFFER_BIT: i32 = 1;
+pub const GU_STENCIL_BUFFER_BIT: i32 = 2;
+pub const GU_DEPTH_BUFFER_BIT: i32 = 4;
+pub const GU_FAST_CLEAR_BIT: i32 = 16;
+
+pub const GU_AMBIENT: i32 = 1;
+pub const GU_DIFFUSE: i32 = 2;
+pub const GU_SPECULAR: i32 = 4;
+pub const GU_UNKNOWN_LIGHT_COMPONENT: i32 = 8;
+
+pub const SYSTEM_REGISTRY: [u8; 7] = *b"/system";
+pub const REG_KEYNAME_SIZE: u32 = 27;
+
+pub const UTILITY_MSGDIALOG_ERROR: i32 = 0;
+pub const UTILITY_MSGDIALOG_TEXT: i32 = 1;
+pub const UTILITY_MSGDIALOG_YES_NO_BUTTONS: i32 = 0x10;
+pub const UTILITY_MSGDIALOG_DEFAULT_NO: i32 = 0x100;
+
+pub const UTILITY_HTMLVIEWER_OPEN_SCE_START_PAGE: i32 = 0x000001;
+pub const UTILITY_HTMLVIEWER_DISABLE_STARTUP_LIMITS: i32 = 0x000002;
+pub const UTILITY_HTMLVIEWER_DISABLE_EXIT_DIALOG: i32 = 0x000004;
+pub const UTILITY_HTMLVIEWER_DISABLE_CURSOR: i32 = 0x000008;
+pub const UTILITY_HTMLVIEWER_DISABLE_DOWNLOAD_COMPLETE_DIALOG: i32 = 0x000010;
+pub const UTILITY_HTMLVIEWER_DISABLE_DOWNLOAD_START_DIALOG: i32 = 0x000020;
+pub const UTILITY_HTMLVIEWER_DISABLE_DOWNLOAD_DESTINATION_DIALOG: i32 = 0x000040;
+pub const UTILITY_HTMLVIEWER_LOCK_DOWNLOAD_DESTINATION_DIALOG: i32 = 0x000080;
+pub const UTILITY_HTMLVIEWER_DISABLE_TAB_DISPLAY: i32 = 0x000100;
+pub const UTILITY_HTMLVIEWER_ENABLE_ANALOG_HOLD: i32 = 0x000200;
+pub const UTILITY_HTMLVIEWER_ENABLE_FLASH: i32 = 0x000400;
+pub const UTILITY_HTMLVIEWER_DISABLE_LRTRIGGER: i32 = 0x000800;
+
+extern "C" {
+ pub fn sceAudioChReserve(channel: i32, sample_count: i32, format: AudioFormat) -> i32;
+ pub fn sceAudioChRelease(channel: i32) -> i32;
+ pub fn sceAudioOutput(channel: i32, vol: i32, buf: *mut c_void) -> i32;
+ pub fn sceAudioOutputBlocking(channel: i32, vol: i32, buf: *mut c_void) -> i32;
+ pub fn sceAudioOutputPanned(
+ channel: i32,
+ left_vol: i32,
+ right_vol: i32,
+ buf: *mut c_void,
+ ) -> i32;
+ pub fn sceAudioOutputPannedBlocking(
+ channel: i32,
+ left_vol: i32,
+ right_vol: i32,
+ buf: *mut c_void,
+ ) -> i32;
+ pub fn sceAudioGetChannelRestLen(channel: i32) -> i32;
+ pub fn sceAudioGetChannelRestLength(channel: i32) -> i32;
+ pub fn sceAudioSetChannelDataLen(channel: i32, sample_count: i32) -> i32;
+ pub fn sceAudioChangeChannelConfig(channel: i32, format: AudioFormat) -> i32;
+ pub fn sceAudioChangeChannelVolume(channel: i32, left_vol: i32, right_vol: i32) -> i32;
+ pub fn sceAudioOutput2Reserve(sample_count: i32) -> i32;
+ pub fn sceAudioOutput2Release() -> i32;
+ pub fn sceAudioOutput2ChangeLength(sample_count: i32) -> i32;
+ pub fn sceAudioOutput2OutputBlocking(vol: i32, buf: *mut c_void) -> i32;
+ pub fn sceAudioOutput2GetRestSample() -> i32;
+ pub fn sceAudioSRCChReserve(
+ sample_count: i32,
+ freq: AudioOutputFrequency,
+ channels: i32,
+ ) -> i32;
+ pub fn sceAudioSRCChRelease() -> i32;
+ pub fn sceAudioSRCOutputBlocking(vol: i32, buf: *mut c_void) -> i32;
+ pub fn sceAudioInputInit(unknown1: i32, gain: i32, unknown2: i32) -> i32;
+ pub fn sceAudioInputInitEx(params: *mut AudioInputParams) -> i32;
+ pub fn sceAudioInputBlocking(sample_count: i32, freq: AudioInputFrequency, buf: *mut c_void);
+ pub fn sceAudioInput(sample_count: i32, freq: AudioInputFrequency, buf: *mut c_void);
+ pub fn sceAudioGetInputLength() -> i32;
+ pub fn sceAudioWaitInputEnd() -> i32;
+ pub fn sceAudioPollInputEnd() -> i32;
+
+ pub fn sceAtracGetAtracID(ui_codec_type: u32) -> i32;
+ pub fn sceAtracSetDataAndGetID(buf: *mut c_void, bufsize: usize) -> i32;
+ pub fn sceAtracDecodeData(
+ atrac_id: i32,
+ out_samples: *mut u16,
+ out_n: *mut i32,
+ out_end: *mut i32,
+ out_remain_frame: *mut i32,
+ ) -> i32;
+ pub fn sceAtracGetRemainFrame(atrac_id: i32, out_remain_frame: *mut i32) -> i32;
+ pub fn sceAtracGetStreamDataInfo(
+ atrac_id: i32,
+ write_pointer: *mut *mut u8,
+ available_bytes: *mut u32,
+ read_offset: *mut u32,
+ ) -> i32;
+ pub fn sceAtracAddStreamData(atrac_id: i32, bytes_to_add: u32) -> i32;
+ pub fn sceAtracGetBitrate(atrac_id: i32, out_bitrate: *mut i32) -> i32;
+ pub fn sceAtracSetLoopNum(atrac_id: i32, nloops: i32) -> i32;
+ pub fn sceAtracReleaseAtracID(atrac_id: i32) -> i32;
+ pub fn sceAtracGetNextSample(atrac_id: i32, out_n: *mut i32) -> i32;
+ pub fn sceAtracGetMaxSample(atrac_id: i32, out_max: *mut i32) -> i32;
+ pub fn sceAtracGetBufferInfoForReseting(
+ atrac_id: i32,
+ ui_sample: u32,
+ pbuffer_info: *mut Atrac3BufferInfo,
+ ) -> i32;
+ pub fn sceAtracGetChannel(atrac_id: i32, pui_channel: *mut u32) -> i32;
+ pub fn sceAtracGetInternalErrorInfo(atrac_id: i32, pi_result: *mut i32) -> i32;
+ pub fn sceAtracGetLoopStatus(
+ atrac_id: i32,
+ pi_loop_num: *mut i32,
+ pui_loop_status: *mut u32,
+ ) -> i32;
+ pub fn sceAtracGetNextDecodePosition(atrac_id: i32, pui_sample_position: *mut u32) -> i32;
+ pub fn sceAtracGetSecondBufferInfo(
+ atrac_id: i32,
+ pui_position: *mut u32,
+ pui_data_byte: *mut u32,
+ ) -> i32;
+ pub fn sceAtracGetSoundSample(
+ atrac_id: i32,
+ pi_end_sample: *mut i32,
+ pi_loop_start_sample: *mut i32,
+ pi_loop_end_sample: *mut i32,
+ ) -> i32;
+ pub fn sceAtracResetPlayPosition(
+ atrac_id: i32,
+ ui_sample: u32,
+ ui_write_byte_first_buf: u32,
+ ui_write_byte_second_buf: u32,
+ ) -> i32;
+ pub fn sceAtracSetData(atrac_id: i32, puc_buffer_addr: *mut u8, ui_buffer_byte: u32) -> i32;
+ pub fn sceAtracSetHalfwayBuffer(
+ atrac_id: i32,
+ puc_buffer_addr: *mut u8,
+ ui_read_byte: u32,
+ ui_buffer_byte: u32,
+ ) -> i32;
+ pub fn sceAtracSetHalfwayBufferAndGetID(
+ puc_buffer_addr: *mut u8,
+ ui_read_byte: u32,
+ ui_buffer_byte: u32,
+ ) -> i32;
+ pub fn sceAtracSetSecondBuffer(
+ atrac_id: i32,
+ puc_second_buffer_addr: *mut u8,
+ ui_second_buffer_byte: u32,
+ ) -> i32;
+
+ pub fn sceCtrlSetSamplingCycle(cycle: i32) -> i32;
+ pub fn sceCtrlGetSamplingCycle(pcycle: *mut i32) -> i32;
+ pub fn sceCtrlSetSamplingMode(mode: CtrlMode) -> i32;
+ pub fn sceCtrlGetSamplingMode(pmode: *mut i32) -> i32;
+ pub fn sceCtrlPeekBufferPositive(pad_data: *mut SceCtrlData, count: i32) -> i32;
+ pub fn sceCtrlPeekBufferNegative(pad_data: *mut SceCtrlData, count: i32) -> i32;
+ pub fn sceCtrlReadBufferPositive(pad_data: *mut SceCtrlData, count: i32) -> i32;
+ pub fn sceCtrlReadBufferNegative(pad_data: *mut SceCtrlData, count: i32) -> i32;
+ pub fn sceCtrlPeekLatch(latch_data: *mut SceCtrlLatch) -> i32;
+ pub fn sceCtrlReadLatch(latch_data: *mut SceCtrlLatch) -> i32;
+ pub fn sceCtrlSetIdleCancelThreshold(idlereset: i32, idleback: i32) -> i32;
+ pub fn sceCtrlGetIdleCancelThreshold(idlereset: *mut i32, idleback: *mut i32) -> i32;
+
+ pub fn sceDisplaySetMode(mode: DisplayMode, width: usize, height: usize) -> u32;
+ pub fn sceDisplayGetMode(pmode: *mut i32, pwidth: *mut i32, pheight: *mut i32) -> i32;
+ pub fn sceDisplaySetFrameBuf(
+ top_addr: *const u8,
+ buffer_width: usize,
+ pixel_format: DisplayPixelFormat,
+ sync: DisplaySetBufSync,
+ ) -> u32;
+ pub fn sceDisplayGetFrameBuf(
+ top_addr: *mut *mut c_void,
+ buffer_width: *mut usize,
+ pixel_format: *mut DisplayPixelFormat,
+ sync: DisplaySetBufSync,
+ ) -> i32;
+ pub fn sceDisplayGetVcount() -> u32;
+ pub fn sceDisplayWaitVblank() -> i32;
+ pub fn sceDisplayWaitVblankCB() -> i32;
+ pub fn sceDisplayWaitVblankStart() -> i32;
+ pub fn sceDisplayWaitVblankStartCB() -> i32;
+ pub fn sceDisplayGetAccumulatedHcount() -> i32;
+ pub fn sceDisplayGetCurrentHcount() -> i32;
+ pub fn sceDisplayGetFramePerSec() -> f32;
+ pub fn sceDisplayIsForeground() -> i32;
+ pub fn sceDisplayIsVblank() -> i32;
+
+ pub fn sceGeEdramGetSize() -> u32;
+ pub fn sceGeEdramGetAddr() -> *mut u8;
+ pub fn sceGeEdramSetAddrTranslation(width: i32) -> i32;
+ pub fn sceGeGetCmd(cmd: i32) -> u32;
+ pub fn sceGeGetMtx(type_: GeMatrixType, matrix: *mut c_void) -> i32;
+ pub fn sceGeGetStack(stack_id: i32, stack: *mut GeStack) -> i32;
+ pub fn sceGeSaveContext(context: *mut GeContext) -> i32;
+ pub fn sceGeRestoreContext(context: *const GeContext) -> i32;
+ pub fn sceGeListEnQueue(
+ list: *const c_void,
+ stall: *mut c_void,
+ cbid: i32,
+ arg: *mut GeListArgs,
+ ) -> i32;
+ pub fn sceGeListEnQueueHead(
+ list: *const c_void,
+ stall: *mut c_void,
+ cbid: i32,
+ arg: *mut GeListArgs,
+ ) -> i32;
+ pub fn sceGeListDeQueue(qid: i32) -> i32;
+ pub fn sceGeListUpdateStallAddr(qid: i32, stall: *mut c_void) -> i32;
+ pub fn sceGeListSync(qid: i32, sync_type: i32) -> GeListState;
+ pub fn sceGeDrawSync(sync_type: i32) -> GeListState;
+ pub fn sceGeBreak(mode: i32, p_param: *mut GeBreakParam) -> i32;
+ pub fn sceGeContinue() -> i32;
+ pub fn sceGeSetCallback(cb: *mut GeCallbackData) -> i32;
+ pub fn sceGeUnsetCallback(cbid: i32) -> i32;
+
+ pub fn sceKernelExitGame();
+ pub fn sceKernelRegisterExitCallback(id: SceUid) -> i32;
+ pub fn sceKernelLoadExec(file: *const u8, param: *mut SceKernelLoadExecParam) -> i32;
+
+ pub fn sceKernelAllocPartitionMemory(
+ partition: SceSysMemPartitionId,
+ name: *const u8,
+ type_: SceSysMemBlockTypes,
+ size: u32,
+ addr: *mut c_void,
+ ) -> SceUid;
+ pub fn sceKernelGetBlockHeadAddr(blockid: SceUid) -> *mut c_void;
+ pub fn sceKernelFreePartitionMemory(blockid: SceUid) -> i32;
+ pub fn sceKernelTotalFreeMemSize() -> usize;
+ pub fn sceKernelMaxFreeMemSize() -> usize;
+ pub fn sceKernelDevkitVersion() -> u32;
+ pub fn sceKernelSetCompiledSdkVersion(version: u32) -> i32;
+ pub fn sceKernelGetCompiledSdkVersion() -> u32;
+
+ pub fn sceKernelLibcTime(t: *mut i32) -> i32;
+ pub fn sceKernelLibcClock() -> u32;
+ pub fn sceKernelLibcGettimeofday(tp: *mut timeval, tzp: *mut timezone) -> i32;
+ pub fn sceKernelDcacheWritebackAll();
+ pub fn sceKernelDcacheWritebackInvalidateAll();
+ pub fn sceKernelDcacheWritebackRange(p: *const c_void, size: u32);
+ pub fn sceKernelDcacheWritebackInvalidateRange(p: *const c_void, size: u32);
+ pub fn sceKernelDcacheInvalidateRange(p: *const c_void, size: u32);
+ pub fn sceKernelIcacheInvalidateAll();
+ pub fn sceKernelIcacheInvalidateRange(p: *const c_void, size: u32);
+ pub fn sceKernelUtilsMt19937Init(ctx: *mut SceKernelUtilsMt19937Context, seed: u32) -> i32;
+ pub fn sceKernelUtilsMt19937UInt(ctx: *mut SceKernelUtilsMt19937Context) -> u32;
+ pub fn sceKernelUtilsMd5Digest(data: *mut u8, size: u32, digest: *mut u8) -> i32;
+ pub fn sceKernelUtilsMd5BlockInit(ctx: *mut SceKernelUtilsMd5Context) -> i32;
+ pub fn sceKernelUtilsMd5BlockUpdate(
+ ctx: *mut SceKernelUtilsMd5Context,
+ data: *mut u8,
+ size: u32,
+ ) -> i32;
+ pub fn sceKernelUtilsMd5BlockResult(ctx: *mut SceKernelUtilsMd5Context, digest: *mut u8)
+ -> i32;
+ pub fn sceKernelUtilsSha1Digest(data: *mut u8, size: u32, digest: *mut u8) -> i32;
+ pub fn sceKernelUtilsSha1BlockInit(ctx: *mut SceKernelUtilsSha1Context) -> i32;
+ pub fn sceKernelUtilsSha1BlockUpdate(
+ ctx: *mut SceKernelUtilsSha1Context,
+ data: *mut u8,
+ size: u32,
+ ) -> i32;
+ pub fn sceKernelUtilsSha1BlockResult(
+ ctx: *mut SceKernelUtilsSha1Context,
+ digest: *mut u8,
+ ) -> i32;
+
+ pub fn sceKernelRegisterSubIntrHandler(
+ int_no: i32,
+ no: i32,
+ handler: *mut c_void,
+ arg: *mut c_void,
+ ) -> i32;
+ pub fn sceKernelReleaseSubIntrHandler(int_no: i32, no: i32) -> i32;
+ pub fn sceKernelEnableSubIntr(int_no: i32, no: i32) -> i32;
+ pub fn sceKernelDisableSubIntr(int_no: i32, no: i32) -> i32;
+ pub fn QueryIntrHandlerInfo(
+ intr_code: SceUid,
+ sub_intr_code: SceUid,
+ data: *mut IntrHandlerOptionParam,
+ ) -> i32;
+
+ pub fn sceKernelCpuSuspendIntr() -> u32;
+ pub fn sceKernelCpuResumeIntr(flags: u32);
+ pub fn sceKernelCpuResumeIntrWithSync(flags: u32);
+ pub fn sceKernelIsCpuIntrSuspended(flags: u32) -> i32;
+ pub fn sceKernelIsCpuIntrEnable() -> i32;
+
+ pub fn sceKernelLoadModule(
+ path: *const u8,
+ flags: i32,
+ option: *mut SceKernelLMOption,
+ ) -> SceUid;
+ pub fn sceKernelLoadModuleMs(
+ path: *const u8,
+ flags: i32,
+ option: *mut SceKernelLMOption,
+ ) -> SceUid;
+ pub fn sceKernelLoadModuleByID(
+ fid: SceUid,
+ flags: i32,
+ option: *mut SceKernelLMOption,
+ ) -> SceUid;
+ pub fn sceKernelLoadModuleBufferUsbWlan(
+ buf_size: usize,
+ buf: *mut c_void,
+ flags: i32,
+ option: *mut SceKernelLMOption,
+ ) -> SceUid;
+ pub fn sceKernelStartModule(
+ mod_id: SceUid,
+ arg_size: usize,
+ argp: *mut c_void,
+ status: *mut i32,
+ option: *mut SceKernelSMOption,
+ ) -> i32;
+ pub fn sceKernelStopModule(
+ mod_id: SceUid,
+ arg_size: usize,
+ argp: *mut c_void,
+ status: *mut i32,
+ option: *mut SceKernelSMOption,
+ ) -> i32;
+ pub fn sceKernelUnloadModule(mod_id: SceUid) -> i32;
+ pub fn sceKernelSelfStopUnloadModule(unknown: i32, arg_size: usize, argp: *mut c_void) -> i32;
+ pub fn sceKernelStopUnloadSelfModule(
+ arg_size: usize,
+ argp: *mut c_void,
+ status: *mut i32,
+ option: *mut SceKernelSMOption,
+ ) -> i32;
+ pub fn sceKernelQueryModuleInfo(mod_id: SceUid, info: *mut SceKernelModuleInfo) -> i32;
+ pub fn sceKernelGetModuleIdList(
+ read_buf: *mut SceUid,
+ read_buf_size: i32,
+ id_count: *mut i32,
+ ) -> i32;
+
+ pub fn sceKernelVolatileMemLock(unk: i32, ptr: *mut *mut c_void, size: *mut i32) -> i32;
+ pub fn sceKernelVolatileMemTryLock(unk: i32, ptr: *mut *mut c_void, size: *mut i32) -> i32;
+ pub fn sceKernelVolatileMemUnlock(unk: i32) -> i32;
+
+ pub fn sceKernelStdin() -> SceUid;
+ pub fn sceKernelStdout() -> SceUid;
+ pub fn sceKernelStderr() -> SceUid;
+
+ pub fn sceKernelGetThreadmanIdType(uid: SceUid) -> SceKernelIdListType;
+ pub fn sceKernelCreateThread(
+ name: *const u8,
+ entry: SceKernelThreadEntry,
+ init_priority: i32,
+ stack_size: i32,
+ attr: i32,
+ option: *mut SceKernelThreadOptParam,
+ ) -> SceUid;
+ pub fn sceKernelDeleteThread(thid: SceUid) -> i32;
+ pub fn sceKernelStartThread(id: SceUid, arg_len: usize, arg_p: *mut c_void) -> i32;
+ pub fn sceKernelExitThread(status: i32) -> i32;
+ pub fn sceKernelExitDeleteThread(status: i32) -> i32;
+ pub fn sceKernelTerminateThread(thid: SceUid) -> i32;
+ pub fn sceKernelTerminateDeleteThread(thid: SceUid) -> i32;
+ pub fn sceKernelSuspendDispatchThread() -> i32;
+ pub fn sceKernelResumeDispatchThread(state: i32) -> i32;
+ pub fn sceKernelSleepThread() -> i32;
+ pub fn sceKernelSleepThreadCB() -> i32;
+ pub fn sceKernelWakeupThread(thid: SceUid) -> i32;
+ pub fn sceKernelCancelWakeupThread(thid: SceUid) -> i32;
+ pub fn sceKernelSuspendThread(thid: SceUid) -> i32;
+ pub fn sceKernelResumeThread(thid: SceUid) -> i32;
+ pub fn sceKernelWaitThreadEnd(thid: SceUid, timeout: *mut u32) -> i32;
+ pub fn sceKernelWaitThreadEndCB(thid: SceUid, timeout: *mut u32) -> i32;
+ pub fn sceKernelDelayThread(delay: u32) -> i32;
+ pub fn sceKernelDelayThreadCB(delay: u32) -> i32;
+ pub fn sceKernelDelaySysClockThread(delay: *mut SceKernelSysClock) -> i32;
+ pub fn sceKernelDelaySysClockThreadCB(delay: *mut SceKernelSysClock) -> i32;
+ pub fn sceKernelChangeCurrentThreadAttr(unknown: i32, attr: i32) -> i32;
+ pub fn sceKernelChangeThreadPriority(thid: SceUid, priority: i32) -> i32;
+ pub fn sceKernelRotateThreadReadyQueue(priority: i32) -> i32;
+ pub fn sceKernelReleaseWaitThread(thid: SceUid) -> i32;
+ pub fn sceKernelGetThreadId() -> i32;
+ pub fn sceKernelGetThreadCurrentPriority() -> i32;
+ pub fn sceKernelGetThreadExitStatus(thid: SceUid) -> i32;
+ pub fn sceKernelCheckThreadStack() -> i32;
+ pub fn sceKernelGetThreadStackFreeSize(thid: SceUid) -> i32;
+ pub fn sceKernelReferThreadStatus(thid: SceUid, info: *mut SceKernelThreadInfo) -> i32;
+ pub fn sceKernelReferThreadRunStatus(
+ thid: SceUid,
+ status: *mut SceKernelThreadRunStatus,
+ ) -> i32;
+ pub fn sceKernelCreateSema(
+ name: *const u8,
+ attr: u32,
+ init_val: i32,
+ max_val: i32,
+ option: *mut SceKernelSemaOptParam,
+ ) -> SceUid;
+ pub fn sceKernelDeleteSema(sema_id: SceUid) -> i32;
+ pub fn sceKernelSignalSema(sema_id: SceUid, signal: i32) -> i32;
+ pub fn sceKernelWaitSema(sema_id: SceUid, signal: i32, timeout: *mut u32) -> i32;
+ pub fn sceKernelWaitSemaCB(sema_id: SceUid, signal: i32, timeout: *mut u32) -> i32;
+ pub fn sceKernelPollSema(sema_id: SceUid, signal: i32) -> i32;
+ pub fn sceKernelReferSemaStatus(sema_id: SceUid, info: *mut SceKernelSemaInfo) -> i32;
+ pub fn sceKernelCreateEventFlag(
+ name: *const u8,
+ attr: i32,
+ bits: i32,
+ opt: *mut SceKernelEventFlagOptParam,
+ ) -> SceUid;
+ pub fn sceKernelSetEventFlag(ev_id: SceUid, bits: u32) -> i32;
+ pub fn sceKernelClearEventFlag(ev_id: SceUid, bits: u32) -> i32;
+ pub fn sceKernelPollEventFlag(ev_id: SceUid, bits: u32, wait: i32, out_bits: *mut u32) -> i32;
+ pub fn sceKernelWaitEventFlag(
+ ev_id: SceUid,
+ bits: u32,
+ wait: i32,
+ out_bits: *mut u32,
+ timeout: *mut u32,
+ ) -> i32;
+ pub fn sceKernelWaitEventFlagCB(
+ ev_id: SceUid,
+ bits: u32,
+ wait: i32,
+ out_bits: *mut u32,
+ timeout: *mut u32,
+ ) -> i32;
+ pub fn sceKernelDeleteEventFlag(ev_id: SceUid) -> i32;
+ pub fn sceKernelReferEventFlagStatus(event: SceUid, status: *mut SceKernelEventFlagInfo)
+ -> i32;
+ pub fn sceKernelCreateMbx(
+ name: *const u8,
+ attr: u32,
+ option: *mut SceKernelMbxOptParam,
+ ) -> SceUid;
+ pub fn sceKernelDeleteMbx(mbx_id: SceUid) -> i32;
+ pub fn sceKernelSendMbx(mbx_id: SceUid, message: *mut c_void) -> i32;
+ pub fn sceKernelReceiveMbx(mbx_id: SceUid, message: *mut *mut c_void, timeout: *mut u32)
+ -> i32;
+ pub fn sceKernelReceiveMbxCB(
+ mbx_id: SceUid,
+ message: *mut *mut c_void,
+ timeout: *mut u32,
+ ) -> i32;
+ pub fn sceKernelPollMbx(mbx_id: SceUid, pmessage: *mut *mut c_void) -> i32;
+ pub fn sceKernelCancelReceiveMbx(mbx_id: SceUid, num: *mut i32) -> i32;
+ pub fn sceKernelReferMbxStatus(mbx_id: SceUid, info: *mut SceKernelMbxInfo) -> i32;
+ pub fn sceKernelSetAlarm(
+ clock: u32,
+ handler: SceKernelAlarmHandler,
+ common: *mut c_void,
+ ) -> SceUid;
+ pub fn sceKernelSetSysClockAlarm(
+ clock: *mut SceKernelSysClock,
+ handler: *mut SceKernelAlarmHandler,
+ common: *mut c_void,
+ ) -> SceUid;
+ pub fn sceKernelCancelAlarm(alarm_id: SceUid) -> i32;
+ pub fn sceKernelReferAlarmStatus(alarm_id: SceUid, info: *mut SceKernelAlarmInfo) -> i32;
+ pub fn sceKernelCreateCallback(
+ name: *const u8,
+ func: SceKernelCallbackFunction,
+ arg: *mut c_void,
+ ) -> SceUid;
+ pub fn sceKernelReferCallbackStatus(cb: SceUid, status: *mut SceKernelCallbackInfo) -> i32;
+ pub fn sceKernelDeleteCallback(cb: SceUid) -> i32;
+ pub fn sceKernelNotifyCallback(cb: SceUid, arg2: i32) -> i32;
+ pub fn sceKernelCancelCallback(cb: SceUid) -> i32;
+ pub fn sceKernelGetCallbackCount(cb: SceUid) -> i32;
+ pub fn sceKernelCheckCallback() -> i32;
+ pub fn sceKernelGetThreadmanIdList(
+ type_: SceKernelIdListType,
+ read_buf: *mut SceUid,
+ read_buf_size: i32,
+ id_count: *mut i32,
+ ) -> i32;
+ pub fn sceKernelReferSystemStatus(status: *mut SceKernelSystemStatus) -> i32;
+ pub fn sceKernelCreateMsgPipe(
+ name: *const u8,
+ part: i32,
+ attr: i32,
+ unk1: *mut c_void,
+ opt: *mut c_void,
+ ) -> SceUid;
+ pub fn sceKernelDeleteMsgPipe(uid: SceUid) -> i32;
+ pub fn sceKernelSendMsgPipe(
+ uid: SceUid,
+ message: *mut c_void,
+ size: u32,
+ unk1: i32,
+ unk2: *mut c_void,
+ timeout: *mut u32,
+ ) -> i32;
+ pub fn sceKernelSendMsgPipeCB(
+ uid: SceUid,
+ message: *mut c_void,
+ size: u32,
+ unk1: i32,
+ unk2: *mut c_void,
+ timeout: *mut u32,
+ ) -> i32;
+ pub fn sceKernelTrySendMsgPipe(
+ uid: SceUid,
+ message: *mut c_void,
+ size: u32,
+ unk1: i32,
+ unk2: *mut c_void,
+ ) -> i32;
+ pub fn sceKernelReceiveMsgPipe(
+ uid: SceUid,
+ message: *mut c_void,
+ size: u32,
+ unk1: i32,
+ unk2: *mut c_void,
+ timeout: *mut u32,
+ ) -> i32;
+ pub fn sceKernelReceiveMsgPipeCB(
+ uid: SceUid,
+ message: *mut c_void,
+ size: u32,
+ unk1: i32,
+ unk2: *mut c_void,
+ timeout: *mut u32,
+ ) -> i32;
+ pub fn sceKernelTryReceiveMsgPipe(
+ uid: SceUid,
+ message: *mut c_void,
+ size: u32,
+ unk1: i32,
+ unk2: *mut c_void,
+ ) -> i32;
+ pub fn sceKernelCancelMsgPipe(uid: SceUid, send: *mut i32, recv: *mut i32) -> i32;
+ pub fn sceKernelReferMsgPipeStatus(uid: SceUid, info: *mut SceKernelMppInfo) -> i32;
+ pub fn sceKernelCreateVpl(
+ name: *const u8,
+ part: i32,
+ attr: i32,
+ size: u32,
+ opt: *mut SceKernelVplOptParam,
+ ) -> SceUid;
+ pub fn sceKernelDeleteVpl(uid: SceUid) -> i32;
+ pub fn sceKernelAllocateVpl(
+ uid: SceUid,
+ size: u32,
+ data: *mut *mut c_void,
+ timeout: *mut u32,
+ ) -> i32;
+ pub fn sceKernelAllocateVplCB(
+ uid: SceUid,
+ size: u32,
+ data: *mut *mut c_void,
+ timeout: *mut u32,
+ ) -> i32;
+ pub fn sceKernelTryAllocateVpl(uid: SceUid, size: u32, data: *mut *mut c_void) -> i32;
+ pub fn sceKernelFreeVpl(uid: SceUid, data: *mut c_void) -> i32;
+ pub fn sceKernelCancelVpl(uid: SceUid, num: *mut i32) -> i32;
+ pub fn sceKernelReferVplStatus(uid: SceUid, info: *mut SceKernelVplInfo) -> i32;
+ pub fn sceKernelCreateFpl(
+ name: *const u8,
+ part: i32,
+ attr: i32,
+ size: u32,
+ blocks: u32,
+ opt: *mut SceKernelFplOptParam,
+ ) -> i32;
+ pub fn sceKernelDeleteFpl(uid: SceUid) -> i32;
+ pub fn sceKernelAllocateFpl(uid: SceUid, data: *mut *mut c_void, timeout: *mut u32) -> i32;
+ pub fn sceKernelAllocateFplCB(uid: SceUid, data: *mut *mut c_void, timeout: *mut u32) -> i32;
+ pub fn sceKernelTryAllocateFpl(uid: SceUid, data: *mut *mut c_void) -> i32;
+ pub fn sceKernelFreeFpl(uid: SceUid, data: *mut c_void) -> i32;
+ pub fn sceKernelCancelFpl(uid: SceUid, pnum: *mut i32) -> i32;
+ pub fn sceKernelReferFplStatus(uid: SceUid, info: *mut SceKernelFplInfo) -> i32;
+ pub fn sceKernelUSec2SysClock(usec: u32, clock: *mut SceKernelSysClock) -> i32;
+ pub fn sceKernelUSec2SysClockWide(usec: u32) -> i64;
+ pub fn sceKernelSysClock2USec(
+ clock: *mut SceKernelSysClock,
+ low: *mut u32,
+ high: *mut u32,
+ ) -> i32;
+ pub fn sceKernelSysClock2USecWide(clock: i64, low: *mut u32, high: *mut u32) -> i32;
+ pub fn sceKernelGetSystemTime(time: *mut SceKernelSysClock) -> i32;
+ pub fn sceKernelGetSystemTimeWide() -> i64;
+ pub fn sceKernelGetSystemTimeLow() -> u32;
+ pub fn sceKernelCreateVTimer(name: *const u8, opt: *mut SceKernelVTimerOptParam) -> SceUid;
+ pub fn sceKernelDeleteVTimer(uid: SceUid) -> i32;
+ pub fn sceKernelGetVTimerBase(uid: SceUid, base: *mut SceKernelSysClock) -> i32;
+ pub fn sceKernelGetVTimerBaseWide(uid: SceUid) -> i64;
+ pub fn sceKernelGetVTimerTime(uid: SceUid, time: *mut SceKernelSysClock) -> i32;
+ pub fn sceKernelGetVTimerTimeWide(uid: SceUid) -> i64;
+ pub fn sceKernelSetVTimerTime(uid: SceUid, time: *mut SceKernelSysClock) -> i32;
+ pub fn sceKernelSetVTimerTimeWide(uid: SceUid, time: i64) -> i64;
+ pub fn sceKernelStartVTimer(uid: SceUid) -> i32;
+ pub fn sceKernelStopVTimer(uid: SceUid) -> i32;
+ pub fn sceKernelSetVTimerHandler(
+ uid: SceUid,
+ time: *mut SceKernelSysClock,
+ handler: SceKernelVTimerHandler,
+ common: *mut c_void,
+ ) -> i32;
+ pub fn sceKernelSetVTimerHandlerWide(
+ uid: SceUid,
+ time: i64,
+ handler: SceKernelVTimerHandlerWide,
+ common: *mut c_void,
+ ) -> i32;
+ pub fn sceKernelCancelVTimerHandler(uid: SceUid) -> i32;
+ pub fn sceKernelReferVTimerStatus(uid: SceUid, info: *mut SceKernelVTimerInfo) -> i32;
+ pub fn sceKernelRegisterThreadEventHandler(
+ name: *const u8,
+ thread_id: SceUid,
+ mask: i32,
+ handler: SceKernelThreadEventHandler,
+ common: *mut c_void,
+ ) -> SceUid;
+ pub fn sceKernelReleaseThreadEventHandler(uid: SceUid) -> i32;
+ pub fn sceKernelReferThreadEventHandlerStatus(
+ uid: SceUid,
+ info: *mut SceKernelThreadEventHandlerInfo,
+ ) -> i32;
+ pub fn sceKernelReferThreadProfiler() -> *mut DebugProfilerRegs;
+ pub fn sceKernelReferGlobalProfiler() -> *mut DebugProfilerRegs;
+
+ pub fn sceUsbStart(driver_name: *const u8, size: i32, args: *mut c_void) -> i32;
+ pub fn sceUsbStop(driver_name: *const u8, size: i32, args: *mut c_void) -> i32;
+ pub fn sceUsbActivate(pid: u32) -> i32;
+ pub fn sceUsbDeactivate(pid: u32) -> i32;
+ pub fn sceUsbGetState() -> i32;
+ pub fn sceUsbGetDrvState(driver_name: *const u8) -> i32;
+}
+
+extern "C" {
+ pub fn sceUsbCamSetupStill(param: *mut UsbCamSetupStillParam) -> i32;
+ pub fn sceUsbCamSetupStillEx(param: *mut UsbCamSetupStillExParam) -> i32;
+ pub fn sceUsbCamStillInputBlocking(buf: *mut u8, size: usize) -> i32;
+ pub fn sceUsbCamStillInput(buf: *mut u8, size: usize) -> i32;
+ pub fn sceUsbCamStillWaitInputEnd() -> i32;
+ pub fn sceUsbCamStillPollInputEnd() -> i32;
+ pub fn sceUsbCamStillCancelInput() -> i32;
+ pub fn sceUsbCamStillGetInputLength() -> i32;
+ pub fn sceUsbCamSetupVideo(
+ param: *mut UsbCamSetupVideoParam,
+ work_area: *mut c_void,
+ work_area_size: i32,
+ ) -> i32;
+ pub fn sceUsbCamSetupVideoEx(
+ param: *mut UsbCamSetupVideoExParam,
+ work_area: *mut c_void,
+ work_area_size: i32,
+ ) -> i32;
+ pub fn sceUsbCamStartVideo() -> i32;
+ pub fn sceUsbCamStopVideo() -> i32;
+ pub fn sceUsbCamReadVideoFrameBlocking(buf: *mut u8, size: usize) -> i32;
+ pub fn sceUsbCamReadVideoFrame(buf: *mut u8, size: usize) -> i32;
+ pub fn sceUsbCamWaitReadVideoFrameEnd() -> i32;
+ pub fn sceUsbCamPollReadVideoFrameEnd() -> i32;
+ pub fn sceUsbCamGetReadVideoFrameSize() -> i32;
+ pub fn sceUsbCamSetSaturation(saturation: i32) -> i32;
+ pub fn sceUsbCamSetBrightness(brightness: i32) -> i32;
+ pub fn sceUsbCamSetContrast(contrast: i32) -> i32;
+ pub fn sceUsbCamSetSharpness(sharpness: i32) -> i32;
+ pub fn sceUsbCamSetImageEffectMode(effect_mode: UsbCamEffectMode) -> i32;
+ pub fn sceUsbCamSetEvLevel(exposure_level: UsbCamEvLevel) -> i32;
+ pub fn sceUsbCamSetReverseMode(reverse_flags: i32) -> i32;
+ pub fn sceUsbCamSetZoom(zoom: i32) -> i32;
+ pub fn sceUsbCamGetSaturation(saturation: *mut i32) -> i32;
+ pub fn sceUsbCamGetBrightness(brightness: *mut i32) -> i32;
+ pub fn sceUsbCamGetContrast(contrast: *mut i32) -> i32;
+ pub fn sceUsbCamGetSharpness(sharpness: *mut i32) -> i32;
+ pub fn sceUsbCamGetImageEffectMode(effect_mode: *mut UsbCamEffectMode) -> i32;
+ pub fn sceUsbCamGetEvLevel(exposure_level: *mut UsbCamEvLevel) -> i32;
+ pub fn sceUsbCamGetReverseMode(reverse_flags: *mut i32) -> i32;
+ pub fn sceUsbCamGetZoom(zoom: *mut i32) -> i32;
+ pub fn sceUsbCamAutoImageReverseSW(on: i32) -> i32;
+ pub fn sceUsbCamGetAutoImageReverseState() -> i32;
+ pub fn sceUsbCamGetLensDirection() -> i32;
+
+ pub fn sceUsbstorBootRegisterNotify(event_flag: SceUid) -> i32;
+ pub fn sceUsbstorBootUnregisterNotify(event_flag: u32) -> i32;
+ pub fn sceUsbstorBootSetCapacity(size: u32) -> i32;
+
+ pub fn scePowerRegisterCallback(slot: i32, cbid: SceUid) -> i32;
+ pub fn scePowerUnregisterCallback(slot: i32) -> i32;
+ pub fn scePowerIsPowerOnline() -> i32;
+ pub fn scePowerIsBatteryExist() -> i32;
+ pub fn scePowerIsBatteryCharging() -> i32;
+ pub fn scePowerGetBatteryChargingStatus() -> i32;
+ pub fn scePowerIsLowBattery() -> i32;
+ pub fn scePowerGetBatteryLifePercent() -> i32;
+ pub fn scePowerGetBatteryLifeTime() -> i32;
+ pub fn scePowerGetBatteryTemp() -> i32;
+ pub fn scePowerGetBatteryElec() -> i32;
+ pub fn scePowerGetBatteryVolt() -> i32;
+ pub fn scePowerSetCpuClockFrequency(cpufreq: i32) -> i32;
+ pub fn scePowerSetBusClockFrequency(busfreq: i32) -> i32;
+ pub fn scePowerGetCpuClockFrequency() -> i32;
+ pub fn scePowerGetCpuClockFrequencyInt() -> i32;
+ pub fn scePowerGetCpuClockFrequencyFloat() -> f32;
+ pub fn scePowerGetBusClockFrequency() -> i32;
+ pub fn scePowerGetBusClockFrequencyInt() -> i32;
+ pub fn scePowerGetBusClockFrequencyFloat() -> f32;
+ pub fn scePowerSetClockFrequency(pllfreq: i32, cpufreq: i32, busfreq: i32) -> i32;
+ pub fn scePowerLock(unknown: i32) -> i32;
+ pub fn scePowerUnlock(unknown: i32) -> i32;
+ pub fn scePowerTick(t: PowerTick) -> i32;
+ pub fn scePowerGetIdleTimer() -> i32;
+ pub fn scePowerIdleTimerEnable(unknown: i32) -> i32;
+ pub fn scePowerIdleTimerDisable(unknown: i32) -> i32;
+ pub fn scePowerRequestStandby() -> i32;
+ pub fn scePowerRequestSuspend() -> i32;
+
+ pub fn sceWlanDevIsPowerOn() -> i32;
+ pub fn sceWlanGetSwitchState() -> i32;
+ pub fn sceWlanGetEtherAddr(ether_addr: *mut u8) -> i32;
+
+ pub fn sceWlanDevAttach() -> i32;
+ pub fn sceWlanDevDetach() -> i32;
+
+ pub fn sceRtcGetTickResolution() -> u32;
+ pub fn sceRtcGetCurrentTick(tick: *mut u64) -> i32;
+ pub fn sceRtcGetCurrentClock(tm: *mut ScePspDateTime, tz: i32) -> i32;
+ pub fn sceRtcGetCurrentClockLocalTime(tm: *mut ScePspDateTime) -> i32;
+ pub fn sceRtcConvertUtcToLocalTime(tick_utc: *const u64, tick_local: *mut u64) -> i32;
+ pub fn sceRtcConvertLocalTimeToUTC(tick_local: *const u64, tick_utc: *mut u64) -> i32;
+ pub fn sceRtcIsLeapYear(year: i32) -> i32;
+ pub fn sceRtcGetDaysInMonth(year: i32, month: i32) -> i32;
+ pub fn sceRtcGetDayOfWeek(year: i32, month: i32, day: i32) -> i32;
+ pub fn sceRtcCheckValid(date: *const ScePspDateTime) -> i32;
+ pub fn sceRtcSetTick(date: *mut ScePspDateTime, tick: *const u64) -> i32;
+ pub fn sceRtcGetTick(date: *const ScePspDateTime, tick: *mut u64) -> i32;
+ pub fn sceRtcCompareTick(tick1: *const u64, tick2: *const u64) -> i32;
+ pub fn sceRtcTickAddTicks(dest_tick: *mut u64, src_tick: *const u64, num_ticks: u64) -> i32;
+ pub fn sceRtcTickAddMicroseconds(dest_tick: *mut u64, src_tick: *const u64, num_ms: u64)
+ -> i32;
+ pub fn sceRtcTickAddSeconds(dest_tick: *mut u64, src_tick: *const u64, num_seconds: u64)
+ -> i32;
+ pub fn sceRtcTickAddMinutes(dest_tick: *mut u64, src_tick: *const u64, num_minutes: u64)
+ -> i32;
+ pub fn sceRtcTickAddHours(dest_tick: *mut u64, src_tick: *const u64, num_hours: u64) -> i32;
+ pub fn sceRtcTickAddDays(dest_tick: *mut u64, src_tick: *const u64, num_days: u64) -> i32;
+ pub fn sceRtcTickAddWeeks(dest_tick: *mut u64, src_tick: *const u64, num_weeks: u64) -> i32;
+ pub fn sceRtcTickAddMonths(dest_tick: *mut u64, src_tick: *const u64, num_months: u64) -> i32;
+ pub fn sceRtcTickAddYears(dest_tick: *mut u64, src_tick: *const u64, num_years: u64) -> i32;
+ pub fn sceRtcSetTime_t(date: *mut ScePspDateTime, time: u32) -> i32;
+ pub fn sceRtcGetTime_t(date: *const ScePspDateTime, time: *mut u32) -> i32;
+ pub fn sceRtcSetTime64_t(date: *mut ScePspDateTime, time: u64) -> i32;
+ pub fn sceRtcGetTime64_t(date: *const ScePspDateTime, time: *mut u64) -> i32;
+ pub fn sceRtcSetDosTime(date: *mut ScePspDateTime, dos_time: u32) -> i32;
+ pub fn sceRtcGetDosTime(date: *mut ScePspDateTime, dos_time: u32) -> i32;
+ pub fn sceRtcSetWin32FileTime(date: *mut ScePspDateTime, time: *mut u64) -> i32;
+ pub fn sceRtcGetWin32FileTime(date: *mut ScePspDateTime, time: *mut u64) -> i32;
+ pub fn sceRtcParseDateTime(dest_tick: *mut u64, date_string: *const u8) -> i32;
+ pub fn sceRtcFormatRFC3339(
+ psz_date_time: *mut char,
+ p_utc: *const u64,
+ time_zone_minutes: i32,
+ ) -> i32;
+ pub fn sceRtcFormatRFC3339LocalTime(psz_date_time: *mut char, p_utc: *const u64) -> i32;
+ pub fn sceRtcParseRFC3339(p_utc: *mut u64, psz_date_time: *const u8) -> i32;
+ pub fn sceRtcFormatRFC2822(
+ psz_date_time: *mut char,
+ p_utc: *const u64,
+ time_zone_minutes: i32,
+ ) -> i32;
+ pub fn sceRtcFormatRFC2822LocalTime(psz_date_time: *mut char, p_utc: *const u64) -> i32;
+
+ pub fn sceIoOpen(file: *const u8, flags: i32, permissions: IoPermissions) -> SceUid;
+ pub fn sceIoOpenAsync(file: *const u8, flags: i32, permissions: IoPermissions) -> SceUid;
+ pub fn sceIoClose(fd: SceUid) -> i32;
+ pub fn sceIoCloseAsync(fd: SceUid) -> i32;
+ pub fn sceIoRead(fd: SceUid, data: *mut c_void, size: u32) -> i32;
+ pub fn sceIoReadAsync(fd: SceUid, data: *mut c_void, size: u32) -> i32;
+ pub fn sceIoWrite(fd: SceUid, data: *const c_void, size: usize) -> i32;
+ pub fn sceIoWriteAsync(fd: SceUid, data: *const c_void, size: u32) -> i32;
+ pub fn sceIoLseek(fd: SceUid, offset: i64, whence: IoWhence) -> i64;
+ pub fn sceIoLseekAsync(fd: SceUid, offset: i64, whence: IoWhence) -> i32;
+ pub fn sceIoLseek32(fd: SceUid, offset: i32, whence: IoWhence) -> i32;
+ pub fn sceIoLseek32Async(fd: SceUid, offset: i32, whence: IoWhence) -> i32;
+ pub fn sceIoRemove(file: *const u8) -> i32;
+ pub fn sceIoMkdir(dir: *const u8, mode: IoPermissions) -> i32;
+ pub fn sceIoRmdir(path: *const u8) -> i32;
+ pub fn sceIoChdir(path: *const u8) -> i32;
+ pub fn sceIoRename(oldname: *const u8, newname: *const u8) -> i32;
+ pub fn sceIoDopen(dirname: *const u8) -> SceUid;
+ pub fn sceIoDread(fd: SceUid, dir: *mut SceIoDirent) -> i32;
+ pub fn sceIoDclose(fd: SceUid) -> i32;
+ pub fn sceIoDevctl(
+ dev: *const u8,
+ cmd: u32,
+ indata: *mut c_void,
+ inlen: i32,
+ outdata: *mut c_void,
+ outlen: i32,
+ ) -> i32;
+ pub fn sceIoAssign(
+ dev1: *const u8,
+ dev2: *const u8,
+ dev3: *const u8,
+ mode: IoAssignPerms,
+ unk1: *mut c_void,
+ unk2: i32,
+ ) -> i32;
+ pub fn sceIoUnassign(dev: *const u8) -> i32;
+ pub fn sceIoGetstat(file: *const u8, stat: *mut SceIoStat) -> i32;
+ pub fn sceIoChstat(file: *const u8, stat: *mut SceIoStat, bits: i32) -> i32;
+ pub fn sceIoIoctl(
+ fd: SceUid,
+ cmd: u32,
+ indata: *mut c_void,
+ inlen: i32,
+ outdata: *mut c_void,
+ outlen: i32,
+ ) -> i32;
+ pub fn sceIoIoctlAsync(
+ fd: SceUid,
+ cmd: u32,
+ indata: *mut c_void,
+ inlen: i32,
+ outdata: *mut c_void,
+ outlen: i32,
+ ) -> i32;
+ pub fn sceIoSync(device: *const u8, unk: u32) -> i32;
+ pub fn sceIoWaitAsync(fd: SceUid, res: *mut i64) -> i32;
+ pub fn sceIoWaitAsyncCB(fd: SceUid, res: *mut i64) -> i32;
+ pub fn sceIoPollAsync(fd: SceUid, res: *mut i64) -> i32;
+ pub fn sceIoGetAsyncStat(fd: SceUid, poll: i32, res: *mut i64) -> i32;
+ pub fn sceIoCancel(fd: SceUid) -> i32;
+ pub fn sceIoGetDevType(fd: SceUid) -> i32;
+ pub fn sceIoChangeAsyncPriority(fd: SceUid, pri: i32) -> i32;
+ pub fn sceIoSetAsyncCallback(fd: SceUid, cb: SceUid, argp: *mut c_void) -> i32;
+
+ pub fn sceJpegInitMJpeg() -> i32;
+ pub fn sceJpegFinishMJpeg() -> i32;
+ pub fn sceJpegCreateMJpeg(width: i32, height: i32) -> i32;
+ pub fn sceJpegDeleteMJpeg() -> i32;
+ pub fn sceJpegDecodeMJpeg(jpeg_buf: *mut u8, size: usize, rgba: *mut c_void, unk: u32) -> i32;
+
+ pub fn sceUmdCheckMedium() -> i32;
+ pub fn sceUmdGetDiscInfo(info: *mut UmdInfo) -> i32;
+ pub fn sceUmdActivate(unit: i32, drive: *const u8) -> i32;
+ pub fn sceUmdDeactivate(unit: i32, drive: *const u8) -> i32;
+ pub fn sceUmdWaitDriveStat(state: i32) -> i32;
+ pub fn sceUmdWaitDriveStatWithTimer(state: i32, timeout: u32) -> i32;
+ pub fn sceUmdWaitDriveStatCB(state: i32, timeout: u32) -> i32;
+ pub fn sceUmdCancelWaitDriveStat() -> i32;
+ pub fn sceUmdGetDriveStat() -> i32;
+ pub fn sceUmdGetErrorStat() -> i32;
+ pub fn sceUmdRegisterUMDCallBack(cbid: i32) -> i32;
+ pub fn sceUmdUnRegisterUMDCallBack(cbid: i32) -> i32;
+ pub fn sceUmdReplacePermit() -> i32;
+ pub fn sceUmdReplaceProhibit() -> i32;
+
+ pub fn sceMpegInit() -> i32;
+ pub fn sceMpegFinish();
+ pub fn sceMpegRingbufferQueryMemSize(packets: i32) -> i32;
+ pub fn sceMpegRingbufferConstruct(
+ ringbuffer: *mut SceMpegRingbuffer,
+ packets: i32,
+ data: *mut c_void,
+ size: i32,
+ callback: SceMpegRingbufferCb,
+ cb_param: *mut c_void,
+ ) -> i32;
+ pub fn sceMpegRingbufferDestruct(ringbuffer: *mut SceMpegRingbuffer);
+ pub fn sceMpegRingbufferAvailableSize(ringbuffer: *mut SceMpegRingbuffer) -> i32;
+ pub fn sceMpegRingbufferPut(
+ ringbuffer: *mut SceMpegRingbuffer,
+ num_packets: i32,
+ available: i32,
+ ) -> i32;
+ pub fn sceMpegQueryMemSize(unk: i32) -> i32;
+ pub fn sceMpegCreate(
+ handle: SceMpeg,
+ data: *mut c_void,
+ size: i32,
+ ringbuffer: *mut SceMpegRingbuffer,
+ frame_width: i32,
+ unk1: i32,
+ unk2: i32,
+ ) -> i32;
+ pub fn sceMpegDelete(handle: SceMpeg);
+ pub fn sceMpegQueryStreamOffset(handle: SceMpeg, buffer: *mut c_void, offset: *mut i32) -> i32;
+ pub fn sceMpegQueryStreamSize(buffer: *mut c_void, size: *mut i32) -> i32;
+ pub fn sceMpegRegistStream(handle: SceMpeg, stream_id: i32, unk: i32) -> SceMpegStream;
+ pub fn sceMpegUnRegistStream(handle: SceMpeg, stream: SceMpegStream);
+ pub fn sceMpegFlushAllStream(handle: SceMpeg) -> i32;
+ pub fn sceMpegMallocAvcEsBuf(handle: SceMpeg) -> *mut c_void;
+ pub fn sceMpegFreeAvcEsBuf(handle: SceMpeg, buf: *mut c_void);
+ pub fn sceMpegQueryAtracEsSize(handle: SceMpeg, es_size: *mut i32, out_size: *mut i32) -> i32;
+ pub fn sceMpegInitAu(handle: SceMpeg, es_buffer: *mut c_void, au: *mut SceMpegAu) -> i32;
+ pub fn sceMpegGetAvcAu(
+ handle: SceMpeg,
+ stream: SceMpegStream,
+ au: *mut SceMpegAu,
+ unk: *mut i32,
+ ) -> i32;
+ pub fn sceMpegAvcDecodeMode(handle: SceMpeg, mode: *mut SceMpegAvcMode) -> i32;
+ pub fn sceMpegAvcDecode(
+ handle: SceMpeg,
+ au: *mut SceMpegAu,
+ iframe_width: i32,
+ buffer: *mut c_void,
+ init: *mut i32,
+ ) -> i32;
+ pub fn sceMpegAvcDecodeStop(
+ handle: SceMpeg,
+ frame_width: i32,
+ buffer: *mut c_void,
+ status: *mut i32,
+ ) -> i32;
+ pub fn sceMpegGetAtracAu(
+ handle: SceMpeg,
+ stream: SceMpegStream,
+ au: *mut SceMpegAu,
+ unk: *mut c_void,
+ ) -> i32;
+ pub fn sceMpegAtracDecode(
+ handle: SceMpeg,
+ au: *mut SceMpegAu,
+ buffer: *mut c_void,
+ init: i32,
+ ) -> i32;
+
+ pub fn sceMpegBaseYCrCbCopyVme(yuv_buffer: *mut c_void, buffer: *mut i32, type_: i32) -> i32;
+ pub fn sceMpegBaseCscInit(width: i32) -> i32;
+ pub fn sceMpegBaseCscVme(
+ rgb_buffer: *mut c_void,
+ rgb_buffer2: *mut c_void,
+ width: i32,
+ y_cr_cb_buffer: *mut SceMpegYCrCbBuffer,
+ ) -> i32;
+ pub fn sceMpegbase_BEA18F91(lli: *mut SceMpegLLI) -> i32;
+
+ pub fn sceHprmPeekCurrentKey(key: *mut i32) -> i32;
+ pub fn sceHprmPeekLatch(latch: *mut [u32; 4]) -> i32;
+ pub fn sceHprmReadLatch(latch: *mut [u32; 4]) -> i32;
+ pub fn sceHprmIsHeadphoneExist() -> i32;
+ pub fn sceHprmIsRemoteExist() -> i32;
+ pub fn sceHprmIsMicrophoneExist() -> i32;
+
+ pub fn sceGuDepthBuffer(zbp: *mut c_void, zbw: i32);
+ pub fn sceGuDispBuffer(width: i32, height: i32, dispbp: *mut c_void, dispbw: i32);
+ pub fn sceGuDrawBuffer(psm: DisplayPixelFormat, fbp: *mut c_void, fbw: i32);
+ pub fn sceGuDrawBufferList(psm: DisplayPixelFormat, fbp: *mut c_void, fbw: i32);
+ pub fn sceGuDisplay(state: bool) -> bool;
+ pub fn sceGuDepthFunc(function: DepthFunc);
+ pub fn sceGuDepthMask(mask: i32);
+ pub fn sceGuDepthOffset(offset: i32);
+ pub fn sceGuDepthRange(near: i32, far: i32);
+ pub fn sceGuFog(near: f32, far: f32, color: u32);
+ pub fn sceGuInit();
+ pub fn sceGuTerm();
+ pub fn sceGuBreak(mode: i32);
+ pub fn sceGuContinue();
+ pub fn sceGuSetCallback(signal: GuCallbackId, callback: GuCallback) -> GuCallback;
+ pub fn sceGuSignal(behavior: SignalBehavior, signal: i32);
+ pub fn sceGuSendCommandf(cmd: GeCommand, argument: f32);
+ pub fn sceGuSendCommandi(cmd: GeCommand, argument: i32);
+ pub fn sceGuGetMemory(size: i32) -> *mut c_void;
+ pub fn sceGuStart(context_type: GuContextType, list: *mut c_void);
+ pub fn sceGuFinish() -> i32;
+ pub fn sceGuFinishId(id: u32) -> i32;
+ pub fn sceGuCallList(list: *const c_void);
+ pub fn sceGuCallMode(mode: i32);
+ pub fn sceGuCheckList() -> i32;
+ pub fn sceGuSendList(mode: GuQueueMode, list: *const c_void, context: *mut GeContext);
+ pub fn sceGuSwapBuffers() -> *mut c_void;
+ pub fn sceGuSync(mode: GuSyncMode, behavior: GuSyncBehavior) -> GeListState;
+ pub fn sceGuDrawArray(
+ prim: GuPrimitive,
+ vtype: i32,
+ count: i32,
+ indices: *const c_void,
+ vertices: *const c_void,
+ );
+ pub fn sceGuBeginObject(
+ vtype: i32,
+ count: i32,
+ indices: *const c_void,
+ vertices: *const c_void,
+ );
+ pub fn sceGuEndObject();
+ pub fn sceGuSetStatus(state: GuState, status: i32);
+ pub fn sceGuGetStatus(state: GuState) -> bool;
+ pub fn sceGuSetAllStatus(status: i32);
+ pub fn sceGuGetAllStatus() -> i32;
+ pub fn sceGuEnable(state: GuState);
+ pub fn sceGuDisable(state: GuState);
+ pub fn sceGuLight(light: i32, type_: LightType, components: i32, position: &ScePspFVector3);
+ pub fn sceGuLightAtt(light: i32, atten0: f32, atten1: f32, atten2: f32);
+ pub fn sceGuLightColor(light: i32, component: i32, color: u32);
+ pub fn sceGuLightMode(mode: LightMode);
+ pub fn sceGuLightSpot(light: i32, direction: &ScePspFVector3, exponent: f32, cutoff: f32);
+ pub fn sceGuClear(flags: i32);
+ pub fn sceGuClearColor(color: u32);
+ pub fn sceGuClearDepth(depth: u32);
+ pub fn sceGuClearStencil(stencil: u32);
+ pub fn sceGuPixelMask(mask: u32);
+ pub fn sceGuColor(color: u32);
+ pub fn sceGuColorFunc(func: ColorFunc, color: u32, mask: u32);
+ pub fn sceGuColorMaterial(components: i32);
+ pub fn sceGuAlphaFunc(func: AlphaFunc, value: i32, mask: i32);
+ pub fn sceGuAmbient(color: u32);
+ pub fn sceGuAmbientColor(color: u32);
+ pub fn sceGuBlendFunc(op: BlendOp, src: BlendSrc, dest: BlendDst, src_fix: u32, dest_fix: u32);
+ pub fn sceGuMaterial(components: i32, color: u32);
+ pub fn sceGuModelColor(emissive: u32, ambient: u32, diffuse: u32, specular: u32);
+ pub fn sceGuStencilFunc(func: StencilFunc, ref_: i32, mask: i32);
+ pub fn sceGuStencilOp(fail: StencilOperation, zfail: StencilOperation, zpass: StencilOperation);
+ pub fn sceGuSpecular(power: f32);
+ pub fn sceGuFrontFace(order: FrontFaceDirection);
+ pub fn sceGuLogicalOp(op: LogicalOperation);
+ pub fn sceGuSetDither(matrix: &ScePspIMatrix4);
+ pub fn sceGuShadeModel(mode: ShadingModel);
+ pub fn sceGuCopyImage(
+ psm: DisplayPixelFormat,
+ sx: i32,
+ sy: i32,
+ width: i32,
+ height: i32,
+ srcw: i32,
+ src: *mut c_void,
+ dx: i32,
+ dy: i32,
+ destw: i32,
+ dest: *mut c_void,
+ );
+ pub fn sceGuTexEnvColor(color: u32);
+ pub fn sceGuTexFilter(min: TextureFilter, mag: TextureFilter);
+ pub fn sceGuTexFlush();
+ pub fn sceGuTexFunc(tfx: TextureEffect, tcc: TextureColorComponent);
+ pub fn sceGuTexImage(
+ mipmap: MipmapLevel,
+ width: i32,
+ height: i32,
+ tbw: i32,
+ tbp: *const c_void,
+ );
+ pub fn sceGuTexLevelMode(mode: TextureLevelMode, bias: f32);
+ pub fn sceGuTexMapMode(mode: TextureMapMode, a1: u32, a2: u32);
+ pub fn sceGuTexMode(tpsm: TexturePixelFormat, maxmips: i32, a2: i32, swizzle: i32);
+ pub fn sceGuTexOffset(u: f32, v: f32);
+ pub fn sceGuTexProjMapMode(mode: TextureProjectionMapMode);
+ pub fn sceGuTexScale(u: f32, v: f32);
+ pub fn sceGuTexSlope(slope: f32);
+ pub fn sceGuTexSync();
+ pub fn sceGuTexWrap(u: GuTexWrapMode, v: GuTexWrapMode);
+ pub fn sceGuClutLoad(num_blocks: i32, cbp: *const c_void);
+ pub fn sceGuClutMode(cpsm: ClutPixelFormat, shift: u32, mask: u32, a3: u32);
+ pub fn sceGuOffset(x: u32, y: u32);
+ pub fn sceGuScissor(x: i32, y: i32, w: i32, h: i32);
+ pub fn sceGuViewport(cx: i32, cy: i32, width: i32, height: i32);
+ pub fn sceGuDrawBezier(
+ v_type: i32,
+ u_count: i32,
+ v_count: i32,
+ indices: *const c_void,
+ vertices: *const c_void,
+ );
+ pub fn sceGuPatchDivide(ulevel: u32, vlevel: u32);
+ pub fn sceGuPatchFrontFace(a0: u32);
+ pub fn sceGuPatchPrim(prim: PatchPrimitive);
+ pub fn sceGuDrawSpline(
+ v_type: i32,
+ u_count: i32,
+ v_count: i32,
+ u_edge: i32,
+ v_edge: i32,
+ indices: *const c_void,
+ vertices: *const c_void,
+ );
+ pub fn sceGuSetMatrix(type_: MatrixMode, matrix: &ScePspFMatrix4);
+ pub fn sceGuBoneMatrix(index: u32, matrix: &ScePspFMatrix4);
+ pub fn sceGuMorphWeight(index: i32, weight: f32);
+ pub fn sceGuDrawArrayN(
+ primitive_type: GuPrimitive,
+ v_type: i32,
+ count: i32,
+ a3: i32,
+ indices: *const c_void,
+ vertices: *const c_void,
+ );
+
+ pub fn sceGumDrawArray(
+ prim: GuPrimitive,
+ v_type: i32,
+ count: i32,
+ indices: *const c_void,
+ vertices: *const c_void,
+ );
+ pub fn sceGumDrawArrayN(
+ prim: GuPrimitive,
+ v_type: i32,
+ count: i32,
+ a3: i32,
+ indices: *const c_void,
+ vertices: *const c_void,
+ );
+ pub fn sceGumDrawBezier(
+ v_type: i32,
+ u_count: i32,
+ v_count: i32,
+ indices: *const c_void,
+ vertices: *const c_void,
+ );
+ pub fn sceGumDrawSpline(
+ v_type: i32,
+ u_count: i32,
+ v_count: i32,
+ u_edge: i32,
+ v_edge: i32,
+ indices: *const c_void,
+ vertices: *const c_void,
+ );
+ pub fn sceGumFastInverse();
+ pub fn sceGumFullInverse();
+ pub fn sceGumLoadIdentity();
+ pub fn sceGumLoadMatrix(m: &ScePspFMatrix4);
+ pub fn sceGumLookAt(eye: &ScePspFVector3, center: &ScePspFVector3, up: &ScePspFVector3);
+ pub fn sceGumMatrixMode(mode: MatrixMode);
+ pub fn sceGumMultMatrix(m: &ScePspFMatrix4);
+ pub fn sceGumOrtho(left: f32, right: f32, bottom: f32, top: f32, near: f32, far: f32);
+ pub fn sceGumPerspective(fovy: f32, aspect: f32, near: f32, far: f32);
+ pub fn sceGumPopMatrix();
+ pub fn sceGumPushMatrix();
+ pub fn sceGumRotateX(angle: f32);
+ pub fn sceGumRotateY(angle: f32);
+ pub fn sceGumRotateZ(angle: f32);
+ pub fn sceGumRotateXYZ(v: &ScePspFVector3);
+ pub fn sceGumRotateZYX(v: &ScePspFVector3);
+ pub fn sceGumScale(v: &ScePspFVector3);
+ pub fn sceGumStoreMatrix(m: &mut ScePspFMatrix4);
+ pub fn sceGumTranslate(v: &ScePspFVector3);
+ pub fn sceGumUpdateMatrix();
+
+ pub fn sceMp3ReserveMp3Handle(args: *mut SceMp3InitArg) -> i32;
+ pub fn sceMp3ReleaseMp3Handle(handle: Mp3Handle) -> i32;
+ pub fn sceMp3InitResource() -> i32;
+ pub fn sceMp3TermResource() -> i32;
+ pub fn sceMp3Init(handle: Mp3Handle) -> i32;
+ pub fn sceMp3Decode(handle: Mp3Handle, dst: *mut *mut i16) -> i32;
+ pub fn sceMp3GetInfoToAddStreamData(
+ handle: Mp3Handle,
+ dst: *mut *mut u8,
+ to_write: *mut i32,
+ src_pos: *mut i32,
+ ) -> i32;
+ pub fn sceMp3NotifyAddStreamData(handle: Mp3Handle, size: i32) -> i32;
+ pub fn sceMp3CheckStreamDataNeeded(handle: Mp3Handle) -> i32;
+ pub fn sceMp3SetLoopNum(handle: Mp3Handle, loop_: i32) -> i32;
+ pub fn sceMp3GetLoopNum(handle: Mp3Handle) -> i32;
+ pub fn sceMp3GetSumDecodedSample(handle: Mp3Handle) -> i32;
+ pub fn sceMp3GetMaxOutputSample(handle: Mp3Handle) -> i32;
+ pub fn sceMp3GetSamplingRate(handle: Mp3Handle) -> i32;
+ pub fn sceMp3GetBitRate(handle: Mp3Handle) -> i32;
+ pub fn sceMp3GetMp3ChannelNum(handle: Mp3Handle) -> i32;
+ pub fn sceMp3ResetPlayPosition(handle: Mp3Handle) -> i32;
+
+ pub fn sceRegOpenRegistry(reg: *mut Key, mode: i32, handle: *mut RegHandle) -> i32;
+ pub fn sceRegFlushRegistry(handle: RegHandle) -> i32;
+ pub fn sceRegCloseRegistry(handle: RegHandle) -> i32;
+ pub fn sceRegOpenCategory(
+ handle: RegHandle,
+ name: *const u8,
+ mode: i32,
+ dir_handle: *mut RegHandle,
+ ) -> i32;
+ pub fn sceRegRemoveCategory(handle: RegHandle, name: *const u8) -> i32;
+ pub fn sceRegCloseCategory(dir_handle: RegHandle) -> i32;
+ pub fn sceRegFlushCategory(dir_handle: RegHandle) -> i32;
+ pub fn sceRegGetKeyInfo(
+ dir_handle: RegHandle,
+ name: *const u8,
+ key_handle: *mut RegHandle,
+ type_: *mut KeyType,
+ size: *mut usize,
+ ) -> i32;
+ pub fn sceRegGetKeyInfoByName(
+ dir_handle: RegHandle,
+ name: *const u8,
+ type_: *mut KeyType,
+ size: *mut usize,
+ ) -> i32;
+ pub fn sceRegGetKeyValue(
+ dir_handle: RegHandle,
+ key_handle: RegHandle,
+ buf: *mut c_void,
+ size: usize,
+ ) -> i32;
+ pub fn sceRegGetKeyValueByName(
+ dir_handle: RegHandle,
+ name: *const u8,
+ buf: *mut c_void,
+ size: usize,
+ ) -> i32;
+ pub fn sceRegSetKeyValue(
+ dir_handle: RegHandle,
+ name: *const u8,
+ buf: *const c_void,
+ size: usize,
+ ) -> i32;
+ pub fn sceRegGetKeysNum(dir_handle: RegHandle, num: *mut i32) -> i32;
+ pub fn sceRegGetKeys(dir_handle: RegHandle, buf: *mut u8, num: i32) -> i32;
+ pub fn sceRegCreateKey(dir_handle: RegHandle, name: *const u8, type_: i32, size: usize) -> i32;
+ pub fn sceRegRemoveRegistry(key: *mut Key) -> i32;
+
+ pub fn sceOpenPSIDGetOpenPSID(openpsid: *mut OpenPSID) -> i32;
+
+ pub fn sceUtilityMsgDialogInitStart(params: *mut UtilityMsgDialogParams) -> i32;
+ pub fn sceUtilityMsgDialogShutdownStart();
+ pub fn sceUtilityMsgDialogGetStatus() -> i32;
+ pub fn sceUtilityMsgDialogUpdate(n: i32);
+ pub fn sceUtilityMsgDialogAbort() -> i32;
+ pub fn sceUtilityNetconfInitStart(data: *mut UtilityNetconfData) -> i32;
+ pub fn sceUtilityNetconfShutdownStart() -> i32;
+ pub fn sceUtilityNetconfUpdate(unknown: i32) -> i32;
+ pub fn sceUtilityNetconfGetStatus() -> i32;
+ pub fn sceUtilityCheckNetParam(id: i32) -> i32;
+ pub fn sceUtilityGetNetParam(conf: i32, param: NetParam, data: *mut UtilityNetData) -> i32;
+ pub fn sceUtilitySavedataInitStart(params: *mut SceUtilitySavedataParam) -> i32;
+ pub fn sceUtilitySavedataGetStatus() -> i32;
+ pub fn sceUtilitySavedataShutdownStart() -> i32;
+ pub fn sceUtilitySavedataUpdate(unknown: i32);
+ pub fn sceUtilityGameSharingInitStart(params: *mut UtilityGameSharingParams) -> i32;
+ pub fn sceUtilityGameSharingShutdownStart();
+ pub fn sceUtilityGameSharingGetStatus() -> i32;
+ pub fn sceUtilityGameSharingUpdate(n: i32);
+ pub fn sceUtilityHtmlViewerInitStart(params: *mut UtilityHtmlViewerParam) -> i32;
+ pub fn sceUtilityHtmlViewerShutdownStart() -> i32;
+ pub fn sceUtilityHtmlViewerUpdate(n: i32) -> i32;
+ pub fn sceUtilityHtmlViewerGetStatus() -> i32;
+ pub fn sceUtilitySetSystemParamInt(id: SystemParamId, value: i32) -> i32;
+ pub fn sceUtilitySetSystemParamString(id: SystemParamId, str: *const u8) -> i32;
+ pub fn sceUtilityGetSystemParamInt(id: SystemParamId, value: *mut i32) -> i32;
+ pub fn sceUtilityGetSystemParamString(id: SystemParamId, str: *mut u8, len: i32) -> i32;
+ pub fn sceUtilityOskInitStart(params: *mut SceUtilityOskParams) -> i32;
+ pub fn sceUtilityOskShutdownStart() -> i32;
+ pub fn sceUtilityOskUpdate(n: i32) -> i32;
+ pub fn sceUtilityOskGetStatus() -> i32;
+ pub fn sceUtilityLoadNetModule(module: NetModule) -> i32;
+ pub fn sceUtilityUnloadNetModule(module: NetModule) -> i32;
+ pub fn sceUtilityLoadAvModule(module: AvModule) -> i32;
+ pub fn sceUtilityUnloadAvModule(module: AvModule) -> i32;
+ pub fn sceUtilityLoadUsbModule(module: UsbModule) -> i32;
+ pub fn sceUtilityUnloadUsbModule(module: UsbModule) -> i32;
+ pub fn sceUtilityLoadModule(module: Module) -> i32;
+ pub fn sceUtilityUnloadModule(module: Module) -> i32;
+ pub fn sceUtilityCreateNetParam(conf: i32) -> i32;
+ pub fn sceUtilitySetNetParam(param: NetParam, val: *const c_void) -> i32;
+ pub fn sceUtilityCopyNetParam(src: i32, dest: i32) -> i32;
+ pub fn sceUtilityDeleteNetParam(conf: i32) -> i32;
+
+ pub fn sceNetInit(
+ poolsize: i32,
+ calloutprio: i32,
+ calloutstack: i32,
+ netintrprio: i32,
+ netintrstack: i32,
+ ) -> i32;
+ pub fn sceNetTerm() -> i32;
+ pub fn sceNetFreeThreadinfo(thid: i32) -> i32;
+ pub fn sceNetThreadAbort(thid: i32) -> i32;
+ pub fn sceNetEtherStrton(name: *mut u8, mac: *mut u8);
+ pub fn sceNetEtherNtostr(mac: *mut u8, name: *mut u8);
+ pub fn sceNetGetLocalEtherAddr(mac: *mut u8) -> i32;
+ pub fn sceNetGetMallocStat(stat: *mut SceNetMallocStat) -> i32;
+
+ pub fn sceNetAdhocctlInit(
+ stacksize: i32,
+ priority: i32,
+ adhoc_id: *mut SceNetAdhocctlAdhocId,
+ ) -> i32;
+ pub fn sceNetAdhocctlTerm() -> i32;
+ pub fn sceNetAdhocctlConnect(name: *const u8) -> i32;
+ pub fn sceNetAdhocctlDisconnect() -> i32;
+ pub fn sceNetAdhocctlGetState(event: *mut i32) -> i32;
+ pub fn sceNetAdhocctlCreate(name: *const u8) -> i32;
+ pub fn sceNetAdhocctlJoin(scaninfo: *mut SceNetAdhocctlScanInfo) -> i32;
+ pub fn sceNetAdhocctlGetAdhocId(id: *mut SceNetAdhocctlAdhocId) -> i32;
+ pub fn sceNetAdhocctlCreateEnterGameMode(
+ name: *const u8,
+ unknown: i32,
+ num: i32,
+ macs: *mut u8,
+ timeout: u32,
+ unknown2: i32,
+ ) -> i32;
+ pub fn sceNetAdhocctlJoinEnterGameMode(
+ name: *const u8,
+ hostmac: *mut u8,
+ timeout: u32,
+ unknown: i32,
+ ) -> i32;
+ pub fn sceNetAdhocctlGetGameModeInfo(gamemodeinfo: *mut SceNetAdhocctlGameModeInfo) -> i32;
+ pub fn sceNetAdhocctlExitGameMode() -> i32;
+ pub fn sceNetAdhocctlGetPeerList(length: *mut i32, buf: *mut c_void) -> i32;
+ pub fn sceNetAdhocctlGetPeerInfo(
+ mac: *mut u8,
+ size: i32,
+ peerinfo: *mut SceNetAdhocctlPeerInfo,
+ ) -> i32;
+ pub fn sceNetAdhocctlScan() -> i32;
+ pub fn sceNetAdhocctlGetScanInfo(length: *mut i32, buf: *mut c_void) -> i32;
+ pub fn sceNetAdhocctlAddHandler(handler: SceNetAdhocctlHandler, unknown: *mut c_void) -> i32;
+ pub fn sceNetAdhocctlDelHandler(id: i32) -> i32;
+ pub fn sceNetAdhocctlGetNameByAddr(mac: *mut u8, nickname: *mut u8) -> i32;
+ pub fn sceNetAdhocctlGetAddrByName(
+ nickname: *mut u8,
+ length: *mut i32,
+ buf: *mut c_void,
+ ) -> i32;
+ pub fn sceNetAdhocctlGetParameter(params: *mut SceNetAdhocctlParams) -> i32;
+
+ pub fn sceNetAdhocInit() -> i32;
+ pub fn sceNetAdhocTerm() -> i32;
+ pub fn sceNetAdhocPdpCreate(mac: *mut u8, port: u16, buf_size: u32, unk1: i32) -> i32;
+ pub fn sceNetAdhocPdpDelete(id: i32, unk1: i32) -> i32;
+ pub fn sceNetAdhocPdpSend(
+ id: i32,
+ dest_mac_addr: *mut u8,
+ port: u16,
+ data: *mut c_void,
+ len: u32,
+ timeout: u32,
+ nonblock: i32,
+ ) -> i32;
+ pub fn sceNetAdhocPdpRecv(
+ id: i32,
+ src_mac_addr: *mut u8,
+ port: *mut u16,
+ data: *mut c_void,
+ data_length: *mut c_void,
+ timeout: u32,
+ nonblock: i32,
+ ) -> i32;
+ pub fn sceNetAdhocGetPdpStat(size: *mut i32, stat: *mut SceNetAdhocPdpStat) -> i32;
+ pub fn sceNetAdhocGameModeCreateMaster(data: *mut c_void, size: i32) -> i32;
+ pub fn sceNetAdhocGameModeCreateReplica(mac: *mut u8, data: *mut c_void, size: i32) -> i32;
+ pub fn sceNetAdhocGameModeUpdateMaster() -> i32;
+ pub fn sceNetAdhocGameModeUpdateReplica(id: i32, unk1: i32) -> i32;
+ pub fn sceNetAdhocGameModeDeleteMaster() -> i32;
+ pub fn sceNetAdhocGameModeDeleteReplica(id: i32) -> i32;
+ pub fn sceNetAdhocPtpOpen(
+ srcmac: *mut u8,
+ srcport: u16,
+ destmac: *mut u8,
+ destport: u16,
+ buf_size: u32,
+ delay: u32,
+ count: i32,
+ unk1: i32,
+ ) -> i32;
+ pub fn sceNetAdhocPtpConnect(id: i32, timeout: u32, nonblock: i32) -> i32;
+ pub fn sceNetAdhocPtpListen(
+ srcmac: *mut u8,
+ srcport: u16,
+ buf_size: u32,
+ delay: u32,
+ count: i32,
+ queue: i32,
+ unk1: i32,
+ ) -> i32;
+ pub fn sceNetAdhocPtpAccept(
+ id: i32,
+ mac: *mut u8,
+ port: *mut u16,
+ timeout: u32,
+ nonblock: i32,
+ ) -> i32;
+ pub fn sceNetAdhocPtpSend(
+ id: i32,
+ data: *mut c_void,
+ data_size: *mut i32,
+ timeout: u32,
+ nonblock: i32,
+ ) -> i32;
+ pub fn sceNetAdhocPtpRecv(
+ id: i32,
+ data: *mut c_void,
+ data_size: *mut i32,
+ timeout: u32,
+ nonblock: i32,
+ ) -> i32;
+ pub fn sceNetAdhocPtpFlush(id: i32, timeout: u32, nonblock: i32) -> i32;
+ pub fn sceNetAdhocPtpClose(id: i32, unk1: i32) -> i32;
+ pub fn sceNetAdhocGetPtpStat(size: *mut i32, stat: *mut SceNetAdhocPtpStat) -> i32;
+}
+
+extern "C" {
+ pub fn sceNetAdhocMatchingInit(memsize: i32) -> i32;
+ pub fn sceNetAdhocMatchingTerm() -> i32;
+ pub fn sceNetAdhocMatchingCreate(
+ mode: AdhocMatchingMode,
+ max_peers: i32,
+ port: u16,
+ buf_size: i32,
+ hello_delay: u32,
+ ping_delay: u32,
+ init_count: i32,
+ msg_delay: u32,
+ callback: AdhocMatchingCallback,
+ ) -> i32;
+ pub fn sceNetAdhocMatchingDelete(matching_id: i32) -> i32;
+ pub fn sceNetAdhocMatchingStart(
+ matching_id: i32,
+ evth_pri: i32,
+ evth_stack: i32,
+ inth_pri: i32,
+ inth_stack: i32,
+ opt_len: i32,
+ opt_data: *mut c_void,
+ ) -> i32;
+ pub fn sceNetAdhocMatchingStop(matching_id: i32) -> i32;
+ pub fn sceNetAdhocMatchingSelectTarget(
+ matching_id: i32,
+ mac: *mut u8,
+ opt_len: i32,
+ opt_data: *mut c_void,
+ ) -> i32;
+ pub fn sceNetAdhocMatchingCancelTarget(matching_id: i32, mac: *mut u8) -> i32;
+ pub fn sceNetAdhocMatchingCancelTargetWithOpt(
+ matching_id: i32,
+ mac: *mut u8,
+ opt_len: i32,
+ opt_data: *mut c_void,
+ ) -> i32;
+ pub fn sceNetAdhocMatchingSendData(
+ matching_id: i32,
+ mac: *mut u8,
+ data_len: i32,
+ data: *mut c_void,
+ ) -> i32;
+ pub fn sceNetAdhocMatchingAbortSendData(matching_id: i32, mac: *mut u8) -> i32;
+ pub fn sceNetAdhocMatchingSetHelloOpt(
+ matching_id: i32,
+ opt_len: i32,
+ opt_data: *mut c_void,
+ ) -> i32;
+ pub fn sceNetAdhocMatchingGetHelloOpt(
+ matching_id: i32,
+ opt_len: *mut i32,
+ opt_data: *mut c_void,
+ ) -> i32;
+ pub fn sceNetAdhocMatchingGetMembers(
+ matching_id: i32,
+ length: *mut i32,
+ buf: *mut c_void,
+ ) -> i32;
+ pub fn sceNetAdhocMatchingGetPoolMaxAlloc() -> i32;
+ pub fn sceNetAdhocMatchingGetPoolStat(poolstat: *mut AdhocPoolStat) -> i32;
+}
+
+extern "C" {
+ pub fn sceNetApctlInit(stack_size: i32, init_priority: i32) -> i32;
+ pub fn sceNetApctlTerm() -> i32;
+ pub fn sceNetApctlGetInfo(code: ApctlInfo, pinfo: *mut SceNetApctlInfo) -> i32;
+ pub fn sceNetApctlAddHandler(handler: SceNetApctlHandler, parg: *mut c_void) -> i32;
+ pub fn sceNetApctlDelHandler(handler_id: i32) -> i32;
+ pub fn sceNetApctlConnect(conn_index: i32) -> i32;
+ pub fn sceNetApctlDisconnect() -> i32;
+ pub fn sceNetApctlGetState(pstate: *mut ApctlState) -> i32;
+
+ pub fn sceNetInetInit() -> i32;
+ pub fn sceNetInetTerm() -> i32;
+ pub fn sceNetInetAccept(s: i32, addr: *mut sockaddr, addr_len: *mut socklen_t) -> i32;
+ pub fn sceNetInetBind(s: i32, my_addr: *const sockaddr, addr_len: socklen_t) -> i32;
+ pub fn sceNetInetConnect(s: i32, serv_addr: *const sockaddr, addr_len: socklen_t) -> i32;
+ pub fn sceNetInetGetsockopt(
+ s: i32,
+ level: i32,
+ opt_name: i32,
+ opt_val: *mut c_void,
+ optl_en: *mut socklen_t,
+ ) -> i32;
+ pub fn sceNetInetListen(s: i32, backlog: i32) -> i32;
+ pub fn sceNetInetRecv(s: i32, buf: *mut c_void, len: usize, flags: i32) -> usize;
+ pub fn sceNetInetRecvfrom(
+ s: i32,
+ buf: *mut c_void,
+ flags: usize,
+ arg1: i32,
+ from: *mut sockaddr,
+ from_len: *mut socklen_t,
+ ) -> usize;
+ pub fn sceNetInetSend(s: i32, buf: *const c_void, len: usize, flags: i32) -> usize;
+ pub fn sceNetInetSendto(
+ s: i32,
+ buf: *const c_void,
+ len: usize,
+ flags: i32,
+ to: *const sockaddr,
+ to_len: socklen_t,
+ ) -> usize;
+ pub fn sceNetInetSetsockopt(
+ s: i32,
+ level: i32,
+ opt_name: i32,
+ opt_val: *const c_void,
+ opt_len: socklen_t,
+ ) -> i32;
+ pub fn sceNetInetShutdown(s: i32, how: i32) -> i32;
+ pub fn sceNetInetSocket(domain: i32, type_: i32, protocol: i32) -> i32;
+ pub fn sceNetInetClose(s: i32) -> i32;
+ pub fn sceNetInetGetErrno() -> i32;
+
+ pub fn sceSslInit(unknown1: i32) -> i32;
+ pub fn sceSslEnd() -> i32;
+ pub fn sceSslGetUsedMemoryMax(memory: *mut u32) -> i32;
+ pub fn sceSslGetUsedMemoryCurrent(memory: *mut u32) -> i32;
+
+ pub fn sceHttpInit(unknown1: u32) -> i32;
+ pub fn sceHttpEnd() -> i32;
+ pub fn sceHttpCreateTemplate(agent: *mut u8, unknown1: i32, unknown2: i32) -> i32;
+ pub fn sceHttpDeleteTemplate(templateid: i32) -> i32;
+ pub fn sceHttpCreateConnection(
+ templateid: i32,
+ host: *mut u8,
+ unknown1: *mut u8,
+ port: u16,
+ unknown2: i32,
+ ) -> i32;
+ pub fn sceHttpCreateConnectionWithURL(templateid: i32, url: *const u8, unknown1: i32) -> i32;
+ pub fn sceHttpDeleteConnection(connection_id: i32) -> i32;
+ pub fn sceHttpCreateRequest(
+ connection_id: i32,
+ method: HttpMethod,
+ path: *mut u8,
+ content_length: u64,
+ ) -> i32;
+ pub fn sceHttpCreateRequestWithURL(
+ connection_id: i32,
+ method: HttpMethod,
+ url: *mut u8,
+ content_length: u64,
+ ) -> i32;
+ pub fn sceHttpDeleteRequest(request_id: i32) -> i32;
+ pub fn sceHttpSendRequest(request_id: i32, data: *mut c_void, data_size: u32) -> i32;
+ pub fn sceHttpAbortRequest(request_id: i32) -> i32;
+ pub fn sceHttpReadData(request_id: i32, data: *mut c_void, data_size: u32) -> i32;
+ pub fn sceHttpGetContentLength(request_id: i32, content_length: *mut u64) -> i32;
+ pub fn sceHttpGetStatusCode(request_id: i32, status_code: *mut i32) -> i32;
+ pub fn sceHttpSetResolveTimeOut(id: i32, timeout: u32) -> i32;
+ pub fn sceHttpSetResolveRetry(id: i32, count: i32) -> i32;
+ pub fn sceHttpSetConnectTimeOut(id: i32, timeout: u32) -> i32;
+ pub fn sceHttpSetSendTimeOut(id: i32, timeout: u32) -> i32;
+ pub fn sceHttpSetRecvTimeOut(id: i32, timeout: u32) -> i32;
+ pub fn sceHttpEnableKeepAlive(id: i32) -> i32;
+ pub fn sceHttpDisableKeepAlive(id: i32) -> i32;
+ pub fn sceHttpEnableRedirect(id: i32) -> i32;
+ pub fn sceHttpDisableRedirect(id: i32) -> i32;
+ pub fn sceHttpEnableCookie(id: i32) -> i32;
+ pub fn sceHttpDisableCookie(id: i32) -> i32;
+ pub fn sceHttpSaveSystemCookie() -> i32;
+ pub fn sceHttpLoadSystemCookie() -> i32;
+ pub fn sceHttpAddExtraHeader(id: i32, name: *mut u8, value: *mut u8, unknown1: i32) -> i32;
+ pub fn sceHttpDeleteHeader(id: i32, name: *const u8) -> i32;
+ pub fn sceHttpsInit(unknown1: i32, unknown2: i32, unknown3: i32, unknown4: i32) -> i32;
+ pub fn sceHttpsEnd() -> i32;
+ pub fn sceHttpsLoadDefaultCert(unknown1: i32, unknown2: i32) -> i32;
+ pub fn sceHttpDisableAuth(id: i32) -> i32;
+ pub fn sceHttpDisableCache(id: i32) -> i32;
+ pub fn sceHttpEnableAuth(id: i32) -> i32;
+ pub fn sceHttpEnableCache(id: i32) -> i32;
+ pub fn sceHttpEndCache() -> i32;
+ pub fn sceHttpGetAllHeader(request: i32, header: *mut *mut u8, header_size: *mut u32) -> i32;
+ pub fn sceHttpGetNetworkErrno(request: i32, err_num: *mut i32) -> i32;
+ pub fn sceHttpGetProxy(
+ id: i32,
+ activate_flag: *mut i32,
+ mode: *mut i32,
+ proxy_host: *mut u8,
+ len: usize,
+ proxy_port: *mut u16,
+ ) -> i32;
+ pub fn sceHttpInitCache(max_size: usize) -> i32;
+ pub fn sceHttpSetAuthInfoCB(id: i32, cbfunc: HttpPasswordCB) -> i32;
+ pub fn sceHttpSetProxy(
+ id: i32,
+ activate_flag: i32,
+ mode: i32,
+ new_proxy_host: *const u8,
+ new_proxy_port: u16,
+ ) -> i32;
+ pub fn sceHttpSetResHeaderMaxSize(id: i32, header_size: u32) -> i32;
+ pub fn sceHttpSetMallocFunction(
+ malloc_func: HttpMallocFunction,
+ free_func: HttpFreeFunction,
+ realloc_func: HttpReallocFunction,
+ ) -> i32;
+
+ pub fn sceNetResolverInit() -> i32;
+ pub fn sceNetResolverCreate(rid: *mut i32, buf: *mut c_void, buf_length: u32) -> i32;
+ pub fn sceNetResolverDelete(rid: i32) -> i32;
+ pub fn sceNetResolverStartNtoA(
+ rid: i32,
+ hostname: *const u8,
+ addr: *mut in_addr,
+ timeout: u32,
+ retry: i32,
+ ) -> i32;
+ pub fn sceNetResolverStartAtoN(
+ rid: i32,
+ addr: *const in_addr,
+ hostname: *mut u8,
+ hostname_len: u32,
+ timeout: u32,
+ retry: i32,
+ ) -> i32;
+ pub fn sceNetResolverStop(rid: i32) -> i32;
+ pub fn sceNetResolverTerm() -> i32;
+}
diff --git a/src/unix/bsd/apple/b64/aarch64/align.rs b/src/unix/bsd/apple/b64/aarch64/align.rs
new file mode 100644
index 00000000..10d55039
--- /dev/null
+++ b/src/unix/bsd/apple/b64/aarch64/align.rs
@@ -0,0 +1,48 @@
+pub type mcontext_t = *mut __darwin_mcontext64;
+
+s_no_extra_traits! {
+ #[allow(missing_debug_implementations)]
+ pub struct max_align_t {
+ priv_: f64
+ }
+}
+
+s! {
+ pub struct ucontext_t {
+ pub uc_onstack: ::c_int,
+ pub uc_sigmask: ::sigset_t,
+ pub uc_stack: ::stack_t,
+ pub uc_link: *mut ::ucontext_t,
+ pub uc_mcsize: usize,
+ pub uc_mcontext: mcontext_t,
+ }
+
+ pub struct __darwin_mcontext64 {
+ pub __es: __darwin_arm_exception_state64,
+ pub __ss: __darwin_arm_thread_state64,
+ pub __ns: __darwin_arm_neon_state64,
+ }
+
+ pub struct __darwin_arm_exception_state64 {
+ pub __far: u64,
+ pub __esr: u32,
+ pub __exception: u32,
+ }
+
+ pub struct __darwin_arm_thread_state64 {
+ pub __x: [u64; 29],
+ pub __fp: u64,
+ pub __lr: u64,
+ pub __sp: u64,
+ pub __pc: u64,
+ pub __cpsr: u32,
+ pub __pad: u32,
+ }
+
+ #[repr(align(16))]
+ pub struct __darwin_arm_neon_state64 {
+ pub __v: [[u64; 2]; 32],
+ pub __fpsr: u32,
+ pub __fpcr: u32,
+ }
+}
diff --git a/src/unix/bsd/apple/b64/aarch64/mod.rs b/src/unix/bsd/apple/b64/aarch64/mod.rs
new file mode 100644
index 00000000..83b62e97
--- /dev/null
+++ b/src/unix/bsd/apple/b64/aarch64/mod.rs
@@ -0,0 +1,8 @@
+pub type boolean_t = ::c_int;
+
+cfg_if! {
+ if #[cfg(libc_align)] {
+ mod align;
+ pub use self::align::*;
+ }
+}
diff --git a/src/unix/bsd/apple/b64/mod.rs b/src/unix/bsd/apple/b64/mod.rs
index 7f700838..48d94bcd 100644
--- a/src/unix/bsd/apple/b64/mod.rs
+++ b/src/unix/bsd/apple/b64/mod.rs
@@ -2,7 +2,6 @@
pub type c_long = i64;
pub type c_ulong = u64;
-pub type boolean_t = ::c_uint;
s! {
pub struct timeval32 {
@@ -113,8 +112,13 @@ extern "C" {
}
cfg_if! {
- if #[cfg(libc_align)] {
- mod align;
- pub use self::align::*;
+ if #[cfg(target_arch = "x86_64")] {
+ mod x86_64;
+ pub use self::x86_64::*;
+ } else if #[cfg(target_arch = "aarch64")] {
+ mod aarch64;
+ pub use self::aarch64::*;
+ } else {
+ // Unknown target_arch
}
}
diff --git a/src/unix/bsd/apple/b64/x86_64/align.rs b/src/unix/bsd/apple/b64/x86_64/align.rs
new file mode 100644
index 00000000..ca1fe1ce
--- /dev/null
+++ b/src/unix/bsd/apple/b64/x86_64/align.rs
@@ -0,0 +1,7 @@
+s_no_extra_traits! {
+ #[allow(missing_debug_implementations)]
+ #[repr(align(16))]
+ pub struct max_align_t {
+ priv_: [f64; 2]
+ }
+}
diff --git a/src/unix/bsd/apple/b64/x86_64/mod.rs b/src/unix/bsd/apple/b64/x86_64/mod.rs
new file mode 100644
index 00000000..07866665
--- /dev/null
+++ b/src/unix/bsd/apple/b64/x86_64/mod.rs
@@ -0,0 +1,112 @@
+pub type boolean_t = ::c_uint;
+pub type mcontext_t = *mut __darwin_mcontext64;
+
+s! {
+ pub struct ucontext_t {
+ pub uc_onstack: ::c_int,
+ pub uc_sigmask: ::sigset_t,
+ pub uc_stack: ::stack_t,
+ pub uc_link: *mut ::ucontext_t,
+ pub uc_mcsize: usize,
+ pub uc_mcontext: mcontext_t,
+ }
+
+ pub struct __darwin_mcontext64 {
+ pub __es: __darwin_x86_exception_state64,
+ pub __ss: __darwin_x86_thread_state64,
+ pub __fs: __darwin_x86_float_state64,
+ }
+
+ pub struct __darwin_x86_exception_state64 {
+ pub __trapno: u16,
+ pub __cpu: u16,
+ pub __err: u32,
+ pub __faultvaddr: u64,
+ }
+
+ pub struct __darwin_x86_thread_state64 {
+ pub __rax: u64,
+ pub __rbx: u64,
+ pub __rcx: u64,
+ pub __rdx: u64,
+ pub __rdi: u64,
+ pub __rsi: u64,
+ pub __rbp: u64,
+ pub __rsp: u64,
+ pub __r8: u64,
+ pub __r9: u64,
+ pub __r10: u64,
+ pub __r11: u64,
+ pub __r12: u64,
+ pub __r13: u64,
+ pub __r14: u64,
+ pub __r15: u64,
+ pub __rip: u64,
+ pub __rflags: u64,
+ pub __cs: u64,
+ pub __fs: u64,
+ pub __gs: u64,
+ }
+
+ pub struct __darwin_x86_float_state64 {
+ pub __fpu_reserved: [::c_int; 2],
+ __fpu_fcw: ::c_short,
+ __fpu_fsw: ::c_short,
+ pub __fpu_ftw: u8,
+ pub __fpu_rsrv1: u8,
+ pub __fpu_fop: u16,
+ pub __fpu_ip: u32,
+ pub __fpu_cs: u16,
+ pub __fpu_rsrv2: u16,
+ pub __fpu_dp: u32,
+ pub __fpu_ds: u16,
+ pub __fpu_rsrv3: u16,
+ pub __fpu_mxcsr: u32,
+ pub __fpu_mxcsrmask: u32,
+ pub __fpu_stmm0: __darwin_mmst_reg,
+ pub __fpu_stmm1: __darwin_mmst_reg,
+ pub __fpu_stmm2: __darwin_mmst_reg,
+ pub __fpu_stmm3: __darwin_mmst_reg,
+ pub __fpu_stmm4: __darwin_mmst_reg,
+ pub __fpu_stmm5: __darwin_mmst_reg,
+ pub __fpu_stmm6: __darwin_mmst_reg,
+ pub __fpu_stmm7: __darwin_mmst_reg,
+ pub __fpu_xmm0: __darwin_xmm_reg,
+ pub __fpu_xmm1: __darwin_xmm_reg,
+ pub __fpu_xmm2: __darwin_xmm_reg,
+ pub __fpu_xmm3: __darwin_xmm_reg,
+ pub __fpu_xmm4: __darwin_xmm_reg,
+ pub __fpu_xmm5: __darwin_xmm_reg,
+ pub __fpu_xmm6: __darwin_xmm_reg,
+ pub __fpu_xmm7: __darwin_xmm_reg,
+ pub __fpu_xmm8: __darwin_xmm_reg,
+ pub __fpu_xmm9: __darwin_xmm_reg,
+ pub __fpu_xmm10: __darwin_xmm_reg,
+ pub __fpu_xmm11: __darwin_xmm_reg,
+ pub __fpu_xmm12: __darwin_xmm_reg,
+ pub __fpu_xmm13: __darwin_xmm_reg,
+ pub __fpu_xmm14: __darwin_xmm_reg,
+ pub __fpu_xmm15: __darwin_xmm_reg,
+ // this field is actually [u8; 96], but defining it with a bigger type
+ // allows us to auto-implement traits for it since the length of the
+ // array is less than 32
+ __fpu_rsrv4: [u32; 24],
+ pub __fpu_reserved1: ::c_int,
+ }
+
+ pub struct __darwin_mmst_reg {
+ pub __mmst_reg: [::c_char; 10],
+ pub __mmst_rsrv: [::c_char; 6],
+ }
+
+ pub struct __darwin_xmm_reg {
+ pub __xmm_reg: [::c_char; 16],
+ }
+}
+
+cfg_if! {
+ if #[cfg(libc_align)] {
+ mod align;
+ pub use self::align::*;
+ }
+}
diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index aa3cc1ca..6d776924 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -2,6 +2,7 @@
//!
//! This covers *-apple-* triples currently
pub type c_char = i8;
+pub type wchar_t = i32;
pub type clock_t = c_ulong;
pub type time_t = c_long;
pub type suseconds_t = i32;
@@ -25,12 +26,33 @@ pub type idtype_t = ::c_uint;
pub type integer_t = ::c_int;
pub type cpu_type_t = integer_t;
pub type cpu_subtype_t = integer_t;
+pub type natural_t = u32;
+pub type mach_msg_type_number_t = natural_t;
pub type posix_spawnattr_t = *mut ::c_void;
pub type posix_spawn_file_actions_t = *mut ::c_void;
pub type key_t = ::c_int;
pub type shmatt_t = ::c_ushort;
+pub type sae_associd_t = u32;
+pub type sae_connid_t = u32;
+
+pub type mach_port_t = ::c_uint;
+pub type processor_flavor_t = ::c_int;
+
+pub type iconv_t = *mut ::c_void;
+
+pub type processor_cpu_load_info_t = *mut processor_cpu_load_info;
+pub type processor_cpu_load_info_data_t = processor_cpu_load_info;
+pub type processor_basic_info_t = *mut processor_basic_info;
+pub type processor_basic_info_data_t = processor_basic_info;
+pub type processor_set_basic_info_data_t = processor_set_basic_info;
+pub type processor_set_basic_info_t = *mut processor_set_basic_info;
+pub type processor_set_load_info_data_t = processor_set_load_info;
+pub type processor_set_load_info_t = *mut processor_set_load_info;
+pub type processor_info_t = *mut integer_t;
+pub type processor_info_array_t = *mut integer_t;
+
deprecated_mach! {
pub type vm_prot_t = ::c_int;
pub type vm_size_t = ::uintptr_t;
@@ -493,6 +515,44 @@ s! {
pub struct in_addr {
pub s_addr: ::in_addr_t,
}
+
+ // sys/socket.h
+
+ pub struct sa_endpoints_t {
+ pub sae_srcif: ::c_uint, // optional source interface
+ pub sae_srcaddr: *const ::sockaddr, // optional source address
+ pub sae_srcaddrlen: ::socklen_t, // size of source address
+ pub sae_dstaddr: *const ::sockaddr, // destination address
+ pub sae_dstaddrlen: ::socklen_t, // size of destination address
+ }
+
+ pub struct timex {
+ pub modes: ::c_uint,
+ pub offset: ::c_long,
+ pub freq: ::c_long,
+ pub maxerror: ::c_long,
+ pub esterror: ::c_long,
+ pub status: ::c_int,
+ pub constant: ::c_long,
+ pub precision: ::c_long,
+ pub tolerance: ::c_long,
+ pub ppsfreq: ::c_long,
+ pub jitter: ::c_long,
+ pub shift: ::c_int,
+ pub stabil: ::c_long,
+ pub jitcnt: ::c_long,
+ pub calcnt: ::c_long,
+ pub errcnt: ::c_long,
+ pub stbcnt: ::c_long,
+ }
+
+ pub struct ntptimeval {
+ pub time: ::timespec,
+ pub maxerror: ::c_long,
+ pub esterror: ::c_long,
+ pub tai: ::c_long,
+ pub time_state: ::c_int,
+ }
}
s_no_extra_traits! {
@@ -616,6 +676,30 @@ s_no_extra_traits! {
__unused1: *mut ::c_void, //actually a function pointer
pub sigev_notify_attributes: *mut ::pthread_attr_t
}
+
+ pub struct processor_cpu_load_info {
+ pub cpu_ticks: [::c_uint; CPU_STATE_MAX as usize],
+ }
+
+ pub struct processor_basic_info {
+ pub cpu_type: cpu_type_t,
+ pub cpu_subtype: cpu_subtype_t,
+ pub running: ::boolean_t,
+ pub slot_num: ::c_int,
+ pub is_master: ::boolean_t,
+ }
+
+ pub struct processor_set_basic_info {
+ pub processor_count: ::c_int,
+ pub default_policy: ::c_int,
+ }
+
+ pub struct processor_set_load_info {
+ pub task_count: ::c_int,
+ pub thread_count: ::c_int,
+ pub load_average: integer_t,
+ pub mach_factor: integer_t,
+ }
}
impl siginfo_t {
@@ -638,6 +722,18 @@ impl siginfo_t {
(*(self as *const siginfo_t as *const siginfo_timer)).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
+ }
}
cfg_if! {
@@ -1218,6 +1314,106 @@ cfg_if! {
self.sigev_notify_attributes.hash(state);
}
}
+
+ impl PartialEq for processor_cpu_load_info {
+ fn eq(&self, other: &processor_cpu_load_info) -> bool {
+ self.cpu_ticks == other.cpu_ticks
+ }
+ }
+ impl Eq for processor_cpu_load_info {}
+ impl ::fmt::Debug for processor_cpu_load_info {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("processor_cpu_load_info")
+ .field("cpu_ticks", &self.cpu_ticks)
+ .finish()
+ }
+ }
+ impl ::hash::Hash for processor_cpu_load_info {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.cpu_ticks.hash(state);
+ }
+ }
+
+ impl PartialEq for processor_basic_info {
+ fn eq(&self, other: &processor_basic_info) -> bool {
+ self.cpu_type == other.cpu_type
+ && self.cpu_subtype == other.cpu_subtype
+ && self.running == other.running
+ && self.slot_num == other.slot_num
+ && self.is_master == other.is_master
+ }
+ }
+ impl Eq for processor_basic_info {}
+ impl ::fmt::Debug for processor_basic_info {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("processor_basic_info")
+ .field("cpu_type", &self.cpu_type)
+ .field("cpu_subtype", &self.cpu_subtype)
+ .field("running", &self.running)
+ .field("slot_num", &self.slot_num)
+ .field("is_master", &self.is_master)
+ .finish()
+ }
+ }
+ impl ::hash::Hash for processor_basic_info {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.cpu_type.hash(state);
+ self.cpu_subtype.hash(state);
+ self.running.hash(state);
+ self.slot_num.hash(state);
+ self.is_master.hash(state);
+ }
+ }
+
+ impl PartialEq for processor_set_basic_info {
+ fn eq(&self, other: &processor_set_basic_info) -> bool {
+ self.processor_count == other.processor_count
+ && self.default_policy == other.default_policy
+ }
+ }
+ impl Eq for processor_set_basic_info {}
+ impl ::fmt::Debug for processor_set_basic_info {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("processor_set_basic_info")
+ .field("processor_count", &self.processor_count)
+ .field("default_policy", &self.default_policy)
+ .finish()
+ }
+ }
+ impl ::hash::Hash for processor_set_basic_info {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.processor_count.hash(state);
+ self.default_policy.hash(state);
+ }
+ }
+
+ impl PartialEq for processor_set_load_info {
+ fn eq(&self, other: &processor_set_load_info) -> bool {
+ self.task_count == other.task_count
+ && self.thread_count == other.thread_count
+ && self.load_average == other.load_average
+ && self.mach_factor == other.mach_factor
+ }
+ }
+ impl Eq for processor_set_load_info {}
+ impl ::fmt::Debug for processor_set_load_info {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("processor_set_load_info")
+ .field("task_count", &self.task_count)
+ .field("thread_count", &self.thread_count)
+ .field("load_average", &self.load_average)
+ .field("mach_factor", &self.mach_factor)
+ .finish()
+ }
+ }
+ impl ::hash::Hash for processor_set_load_info {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.task_count.hash(state);
+ self.thread_count.hash(state);
+ self.load_average.hash(state);
+ self.mach_factor.hash(state);
+ }
+ }
}
}
@@ -1239,12 +1435,12 @@ pub const ACCOUNTING: ::c_short = 9;
pub const SIGNATURE: ::c_short = 10;
pub const SHUTDOWN_TIME: ::c_short = 11;
-pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
-pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
-pub const LC_MESSAGES_MASK: ::c_int = (1 << 2);
-pub const LC_MONETARY_MASK: ::c_int = (1 << 3);
-pub const LC_NUMERIC_MASK: ::c_int = (1 << 4);
-pub const LC_TIME_MASK: ::c_int = (1 << 5);
+pub const LC_COLLATE_MASK: ::c_int = 1 << 0;
+pub const LC_CTYPE_MASK: ::c_int = 1 << 1;
+pub const LC_MESSAGES_MASK: ::c_int = 1 << 2;
+pub const LC_MONETARY_MASK: ::c_int = 1 << 3;
+pub const LC_NUMERIC_MASK: ::c_int = 1 << 4;
+pub const LC_TIME_MASK: ::c_int = 1 << 5;
pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
| LC_CTYPE_MASK
| LC_MESSAGES_MASK
@@ -1354,6 +1550,7 @@ pub const O_DSYNC: ::c_int = 0x400000;
pub const O_NOCTTY: ::c_int = 0x20000;
pub const O_CLOEXEC: ::c_int = 0x1000000;
pub const O_DIRECTORY: ::c_int = 0x100000;
+pub const O_SYMLINK: ::c_int = 0x200000;
pub const S_IFIFO: mode_t = 4096;
pub const S_IFCHR: mode_t = 8192;
pub const S_IFBLK: mode_t = 24576;
@@ -1436,6 +1633,19 @@ pub const MAP_FIXED: ::c_int = 0x0010;
pub const MAP_ANON: ::c_int = 0x1000;
pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
+pub const CPU_STATE_USER: ::c_int = 0;
+pub const CPU_STATE_SYSTEM: ::c_int = 1;
+pub const CPU_STATE_IDLE: ::c_int = 2;
+pub const CPU_STATE_NICE: ::c_int = 3;
+pub const CPU_STATE_MAX: ::c_int = 4;
+
+pub const PROCESSOR_BASIC_INFO: ::c_int = 1;
+pub const PROCESSOR_CPU_LOAD_INFO: ::c_int = 2;
+pub const PROCESSOR_PM_REGS_INFO: ::c_int = 0x10000001;
+pub const PROCESSOR_TEMPERATURE: ::c_int = 0x10000002;
+pub const PROCESSOR_SET_LOAD_INFO: ::c_int = 4;
+pub const PROCESSOR_SET_BASIC_INFO: ::c_int = 5;
+
deprecated_mach! {
pub const VM_FLAGS_FIXED: ::c_int = 0x0000;
pub const VM_FLAGS_ANYWHERE: ::c_int = 0x0001;
@@ -1719,8 +1929,6 @@ pub const TIOCGETD: ::c_ulong = 0x4004741a;
pub const TIOCSETD: ::c_ulong = 0x8004741b;
pub const TIOCIXON: ::c_uint = 0x20007481;
pub const TIOCIXOFF: ::c_uint = 0x20007480;
-pub const TIOCSBRK: ::c_uint = 0x2000747b;
-pub const TIOCCBRK: ::c_uint = 0x2000747a;
pub const TIOCSDTR: ::c_uint = 0x20007479;
pub const TIOCCDTR: ::c_uint = 0x20007478;
pub const TIOCGPGRP: ::c_ulong = 0x40047477;
@@ -1852,6 +2060,9 @@ pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 2;
pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 1;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 2;
+#[cfg(target_arch = "aarch64")]
+pub const PTHREAD_STACK_MIN: ::size_t = 16384;
+#[cfg(not(target_arch = "aarch64"))]
pub const PTHREAD_STACK_MIN: ::size_t = 8192;
pub const RLIMIT_CPU: ::c_int = 0;
@@ -2208,14 +2419,20 @@ pub const IP_PKTINFO: ::c_int = 26;
pub const IP_RECVTOS: ::c_int = 27;
pub const IPV6_JOIN_GROUP: ::c_int = 12;
pub const IPV6_LEAVE_GROUP: ::c_int = 13;
+pub const IPV6_CHECKSUM: ::c_int = 26;
pub const IPV6_RECVTCLASS: ::c_int = 35;
pub const IPV6_TCLASS: ::c_int = 36;
pub const IPV6_PKTINFO: ::c_int = 46;
+pub const IPV6_HOPLIMIT: ::c_int = 47;
pub const IPV6_RECVPKTINFO: ::c_int = 61;
pub const TCP_NOPUSH: ::c_int = 4;
pub const TCP_NOOPT: ::c_int = 8;
pub const TCP_KEEPALIVE: ::c_int = 0x10;
+pub const TCP_KEEPINTVL: ::c_int = 0x101;
+pub const TCP_KEEPCNT: ::c_int = 0x102;
+/// Enable/Disable TCP Fastopen on this socket
+pub const TCP_FASTOPEN: ::c_int = 0x105;
pub const SOL_LOCAL: ::c_int = 0;
@@ -2259,6 +2476,7 @@ pub const SO_NOADDRERR: ::c_int = 0x1023;
pub const SO_NWRITE: ::c_int = 0x1024;
pub const SO_REUSESHAREUID: ::c_int = 0x1025;
pub const SO_NOTIFYCONFLICT: ::c_int = 0x1026;
+pub const SO_LINGER_SEC: ::c_int = 0x1080;
pub const SO_RANDOMPORT: ::c_int = 0x1082;
pub const SO_NP_EXTENSIONS: ::c_int = 0x1083;
@@ -2304,6 +2522,23 @@ pub const SHUT_RD: ::c_int = 0;
pub const SHUT_WR: ::c_int = 1;
pub const SHUT_RDWR: ::c_int = 2;
+pub const SAE_ASSOCID_ANY: ::sae_associd_t = 0;
+/// ((sae_associd_t)(-1ULL))
+pub const SAE_ASSOCID_ALL: ::sae_associd_t = 0xffffffff;
+
+pub const SAE_CONNID_ANY: ::sae_connid_t = 0;
+/// ((sae_connid_t)(-1ULL))
+pub const SAE_CONNID_ALL: ::sae_connid_t = 0xffffffff;
+
+// connectx() flag parameters
+
+/// resume connect() on read/write
+pub const CONNECT_RESUME_ON_READ_WRITE: ::c_uint = 0x1;
+/// data is idempotent
+pub const CONNECT_DATA_IDEMPOTENT: ::c_uint = 0x2;
+/// data includes security that replaces the TFO-cookie
+pub const CONNECT_DATA_AUTHENTICATED: ::c_uint = 0x4;
+
pub const LOCK_SH: ::c_int = 1;
pub const LOCK_EX: ::c_int = 2;
pub const LOCK_NB: ::c_int = 4;
@@ -2438,6 +2673,7 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
__opaque: [0; __PTHREAD_RWLOCK_SIZE__],
};
+pub const MINSIGSTKSZ: ::size_t = 32768;
pub const SIGSTKSZ: ::size_t = 131072;
pub const FD_SETSIZE: usize = 1024;
@@ -2764,7 +3000,9 @@ pub const HW_L3CACHESIZE: ::c_int = 22;
pub const HW_TB_FREQ: ::c_int = 23;
pub const HW_MEMSIZE: ::c_int = 24;
pub const HW_AVAILCPU: ::c_int = 25;
-pub const HW_MAXID: ::c_int = 26;
+pub const HW_TARGET: ::c_int = 26;
+pub const HW_PRODUCT: ::c_int = 27;
+pub const HW_MAXID: ::c_int = 28;
pub const USER_CS_PATH: ::c_int = 1;
pub const USER_BC_BASE_MAX: ::c_int = 2;
pub const USER_BC_DIM_MAX: ::c_int = 3;
@@ -2801,11 +3039,8 @@ pub const AI_PASSIVE: ::c_int = 0x00000001;
pub const AI_CANONNAME: ::c_int = 0x00000002;
pub const AI_NUMERICHOST: ::c_int = 0x00000004;
pub const AI_NUMERICSERV: ::c_int = 0x00001000;
-pub const AI_MASK: ::c_int = AI_PASSIVE
- | AI_CANONNAME
- | AI_NUMERICHOST
- | AI_NUMERICSERV
- | AI_ADDRCONFIG;
+pub const AI_MASK: ::c_int =
+ AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | AI_ADDRCONFIG;
pub const AI_ALL: ::c_int = 0x00000100;
pub const AI_V4MAPPED_CFG: ::c_int = 0x00000200;
pub const AI_ADDRCONFIG: ::c_int = 0x00000400;
@@ -2976,6 +3211,43 @@ pub const DLT_LOOP: ::c_uint = 108;
// sizeof(i32)
pub const BPF_ALIGNMENT: ::c_int = 4;
+// sys/mount.h
+pub const MNT_RDONLY: ::c_int = 0x00000001;
+pub const MNT_SYNCHRONOUS: ::c_int = 0x00000002;
+pub const MNT_NOEXEC: ::c_int = 0x00000004;
+pub const MNT_NOSUID: ::c_int = 0x00000008;
+pub const MNT_NODEV: ::c_int = 0x00000010;
+pub const MNT_UNION: ::c_int = 0x00000020;
+pub const MNT_ASYNC: ::c_int = 0x00000040;
+pub const MNT_CPROTECT: ::c_int = 0x00000080;
+
+// NFS export related mount flags.
+pub const MNT_EXPORTED: ::c_int = 0x00000100;
+
+// MAC labeled / "quarantined" flag
+pub const MNT_QUARANTINE: ::c_int = 0x00000400;
+
+// Flags set by internal operations.
+pub const MNT_LOCAL: ::c_int = 0x00001000;
+pub const MNT_QUOTA: ::c_int = 0x00002000;
+pub const MNT_ROOTFS: ::c_int = 0x00004000;
+pub const MNT_DOVOLFS: ::c_int = 0x00008000;
+
+pub const MNT_DONTBROWSE: ::c_int = 0x00100000;
+pub const MNT_IGNORE_OWNERSHIP: ::c_int = 0x00200000;
+pub const MNT_AUTOMOUNTED: ::c_int = 0x00400000;
+pub const MNT_JOURNALED: ::c_int = 0x00800000;
+pub const MNT_NOUSERXATTR: ::c_int = 0x01000000;
+pub const MNT_DEFWRITE: ::c_int = 0x02000000;
+pub const MNT_MULTILABEL: ::c_int = 0x04000000;
+pub const MNT_NOATIME: ::c_int = 0x10000000;
+pub const MNT_SNAPSHOT: ::c_int = 0x40000000;
+
+// External filesystem command modifier flags.
+pub const MNT_UPDATE: ::c_int = 0x00010000;
+pub const MNT_NOBLOCK: ::c_int = 0x00020000;
+pub const MNT_RELOAD: ::c_int = 0x00040000;
+
// sys/spawn.h:
pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
@@ -3013,6 +3285,9 @@ pub const SETALL: ::c_int = 9;
// sys/shm.h
pub const SHM_RDONLY: ::c_int = 0x1000;
pub const SHM_RND: ::c_int = 0x2000;
+#[cfg(target_arch = "aarch64")]
+pub const SHMLBA: ::c_int = 16 * 1024;
+#[cfg(not(target_arch = "aarch64"))]
pub const SHMLBA: ::c_int = 4096;
pub const SHM_R: ::c_int = IPC_R;
pub const SHM_W: ::c_int = IPC_W;
@@ -3031,8 +3306,69 @@ pub const SF_IMMUTABLE: ::c_uint = 0x00020000;
pub const SF_APPEND: ::c_uint = 0x00040000;
pub const UF_HIDDEN: ::c_uint = 0x00008000;
+//<sys/timex.h>
+pub const NTP_API: ::c_int = 4;
+pub const MAXPHASE: ::c_long = 500000000;
+pub const MAXFREQ: ::c_long = 500000;
+pub const MINSEC: ::c_int = 256;
+pub const MAXSEC: ::c_int = 2048;
+pub const NANOSECOND: ::c_long = 1000000000;
+pub const SCALE_PPM: ::c_int = 65;
+pub const MAXTC: ::c_int = 10;
+pub const MOD_OFFSET: ::c_uint = 0x0001;
+pub const MOD_FREQUENCY: ::c_uint = 0x0002;
+pub const MOD_MAXERROR: ::c_uint = 0x0004;
+pub const MOD_ESTERROR: ::c_uint = 0x0008;
+pub const MOD_STATUS: ::c_uint = 0x0010;
+pub const MOD_TIMECONST: ::c_uint = 0x0020;
+pub const MOD_PPSMAX: ::c_uint = 0x0040;
+pub const MOD_TAI: ::c_uint = 0x0080;
+pub const MOD_MICRO: ::c_uint = 0x1000;
+pub const MOD_NANO: ::c_uint = 0x2000;
+pub const MOD_CLKB: ::c_uint = 0x4000;
+pub const MOD_CLKA: ::c_uint = 0x8000;
+pub const STA_PLL: ::c_int = 0x0001;
+pub const STA_PPSFREQ: ::c_int = 0x0002;
+pub const STA_PPSTIME: ::c_int = 0x0004;
+pub const STA_FLL: ::c_int = 0x0008;
+pub const STA_INS: ::c_int = 0x0010;
+pub const STA_DEL: ::c_int = 0x0020;
+pub const STA_UNSYNC: ::c_int = 0x0040;
+pub const STA_FREQHOLD: ::c_int = 0x0080;
+pub const STA_PPSSIGNAL: ::c_int = 0x0100;
+pub const STA_PPSJITTER: ::c_int = 0x0200;
+pub const STA_PPSWANDER: ::c_int = 0x0400;
+pub const STA_PPSERROR: ::c_int = 0x0800;
+pub const STA_CLOCKERR: ::c_int = 0x1000;
+pub const STA_NANO: ::c_int = 0x2000;
+pub const STA_MODE: ::c_int = 0x4000;
+pub const STA_CLK: ::c_int = 0x8000;
+pub const STA_RONLY: ::c_int = STA_PPSSIGNAL
+ | STA_PPSJITTER
+ | STA_PPSWANDER
+ | STA_PPSERROR
+ | STA_CLOCKERR
+ | STA_NANO
+ | STA_MODE
+ | STA_CLK;
+pub const TIME_OK: ::c_int = 0;
+pub const TIME_INS: ::c_int = 1;
+pub const TIME_DEL: ::c_int = 2;
+pub const TIME_OOP: ::c_int = 3;
+pub const TIME_WAIT: ::c_int = 4;
+pub const TIME_ERROR: ::c_int = 5;
+
+// <sys/mount.h>
+pub const MNT_WAIT: ::c_int = 1;
+pub const MNT_NOWAIT: ::c_int = 2;
+
cfg_if! {
- if #[cfg(libc_const_size_of)] {
+ if #[cfg(libc_const_extern_fn)] {
+ const fn __DARWIN_ALIGN32(p: usize) -> usize {
+ const __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1;
+ p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
+ }
+ } else if #[cfg(libc_const_size_of)] {
fn __DARWIN_ALIGN32(p: usize) -> usize {
const __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1;
p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32
@@ -3054,7 +3390,7 @@ f! {
let cmsg_len = (*cmsg).cmsg_len as usize;
let next = cmsg as usize + __DARWIN_ALIGN32(cmsg_len as usize);
let max = (*mhdr).msg_control as usize
- + (*mhdr).msg_controllen as usize;
+ + (*mhdr).msg_controllen as usize;
if next + __DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) > max {
0 as *mut ::cmsghdr
} else {
@@ -3067,7 +3403,7 @@ f! {
.offset(__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) as isize)
}
- pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
(__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>())
+ __DARWIN_ALIGN32(length as usize))
as ::c_uint
@@ -3077,24 +3413,26 @@ f! {
(__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) + length as usize)
as ::c_uint
}
+}
- pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
+safe_f! {
+ pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
status >> 8
}
- pub fn _WSTATUS(status: ::c_int) -> ::c_int {
+ pub {const} fn _WSTATUS(status: ::c_int) -> ::c_int {
status & 0x7f
}
- pub fn WIFCONTINUED(status: ::c_int) -> bool {
+ pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
_WSTATUS(status) == _WSTOPPED && WSTOPSIG(status) == 0x13
}
- pub fn WIFSIGNALED(status: ::c_int) -> bool {
+ pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
_WSTATUS(status) != _WSTOPPED && _WSTATUS(status) != 0
}
- pub fn WIFSTOPPED(status: ::c_int) -> bool {
+ pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
_WSTATUS(status) == _WSTOPPED && WSTOPSIG(status) != 0x13
}
}
@@ -3103,18 +3441,14 @@ extern "C" {
pub fn setgrent();
#[doc(hidden)]
#[deprecated(since = "0.2.49", note = "Deprecated in MacOSX 10.5")]
- #[link_name = "daemon$1050"]
+ #[cfg_attr(not(target_arch = "aarch64"), link_name = "daemon$1050")]
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
#[doc(hidden)]
#[deprecated(since = "0.2.49", note = "Deprecated in MacOSX 10.10")]
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
#[doc(hidden)]
#[deprecated(since = "0.2.49", note = "Deprecated in MacOSX 10.10")]
- pub fn sem_init(
- sem: *mut sem_t,
- pshared: ::c_int,
- value: ::c_uint,
- ) -> ::c_int;
+ pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int;
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
@@ -3163,11 +3497,7 @@ extern "C" {
sevlen: ::socklen_t,
flags: ::c_int,
) -> ::c_int;
- pub fn mincore(
- addr: *const ::c_void,
- len: ::size_t,
- vec: *mut ::c_char,
- ) -> ::c_int;
+ pub fn mincore(addr: *const ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int;
pub fn sysctlnametomib(
name: *const ::c_char,
mibp: *mut ::c_int,
@@ -3177,44 +3507,23 @@ extern "C" {
all(target_os = "macos", target_arch = "x86"),
link_name = "mprotect$UNIX2003"
)]
- pub fn mprotect(
- addr: *mut ::c_void,
- len: ::size_t,
- prot: ::c_int,
- ) -> ::c_int;
+ pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
pub fn semget(key: key_t, nsems: ::c_int, semflg: ::c_int) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "semctl$UNIX2003"
)]
- pub fn semctl(
- semid: ::c_int,
- semnum: ::c_int,
- cmd: ::c_int,
- ...
- ) -> ::c_int;
- pub fn semop(
- semid: ::c_int,
- sops: *mut sembuf,
- nsops: ::size_t,
- ) -> ::c_int;
+ pub fn semctl(semid: ::c_int, semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int;
+ pub fn semop(semid: ::c_int, sops: *mut sembuf, nsops: ::size_t) -> ::c_int;
pub fn shm_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::c_int;
pub fn ftok(pathname: *const c_char, proj_id: ::c_int) -> key_t;
- pub fn shmat(
- shmid: ::c_int,
- shmaddr: *const ::c_void,
- shmflg: ::c_int,
- ) -> *mut ::c_void;
+ 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;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "shmctl$UNIX2003"
)]
- pub fn shmctl(
- shmid: ::c_int,
- cmd: ::c_int,
- buf: *mut ::shmid_ds,
- ) -> ::c_int;
+ pub fn shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
pub fn shmget(key: key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
pub fn sysctl(
name: *mut ::c_int,
@@ -3237,17 +3546,11 @@ extern "C" {
#[allow(deprecated)]
pub fn mach_timebase_info(info: *mut ::mach_timebase_info) -> ::c_int;
pub fn pthread_setname_np(name: *const ::c_char) -> ::c_int;
- pub fn pthread_getname_np(
- thread: ::pthread_t,
- name: *mut ::c_char,
- len: ::size_t,
- ) -> ::c_int;
+ pub fn pthread_getname_np(thread: ::pthread_t, name: *mut ::c_char, len: ::size_t) -> ::c_int;
+ pub fn pthread_from_mach_thread_np(port: ::mach_port_t) -> ::pthread_t;
pub fn pthread_get_stackaddr_np(thread: ::pthread_t) -> *mut ::c_void;
pub fn pthread_get_stacksize_np(thread: ::pthread_t) -> ::size_t;
- pub fn pthread_condattr_setpshared(
- attr: *mut pthread_condattr_t,
- pshared: ::c_int,
- ) -> ::c_int;
+ pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: ::c_int) -> ::c_int;
pub fn pthread_condattr_getpshared(
attr: *const pthread_condattr_t,
pshared: *mut ::c_int,
@@ -3264,15 +3567,18 @@ extern "C" {
attr: *const pthread_rwlockattr_t,
val: *mut ::c_int,
) -> ::c_int;
- pub fn pthread_rwlockattr_setpshared(
- attr: *mut pthread_rwlockattr_t,
- val: ::c_int,
- ) -> ::c_int;
+ pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: ::c_int) -> ::c_int;
pub fn __error() -> *mut ::c_int;
pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "statfs$INODE64")]
+ #[cfg_attr(
+ all(target_os = "macos", not(target_arch = "aarch64")),
+ link_name = "statfs$INODE64"
+ )]
pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "fstatfs$INODE64")]
+ #[cfg_attr(
+ all(target_os = "macos", not(target_arch = "aarch64")),
+ link_name = "fstatfs$INODE64"
+ )]
pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
pub fn kevent(
kq: ::c_int,
@@ -3297,12 +3603,7 @@ extern "C" {
flags: ::c_int,
data: *mut ::c_void,
) -> ::c_int;
- pub fn ptrace(
- request: ::c_int,
- pid: ::pid_t,
- addr: *mut ::c_char,
- data: ::c_int,
- ) -> ::c_int;
+ pub fn ptrace(request: ::c_int, pid: ::pid_t, addr: *mut ::c_char, data: ::c_int) -> ::c_int;
pub fn quotactl(
special: *const ::c_char,
cmd: ::c_int,
@@ -3342,17 +3643,16 @@ extern "C" {
pub fn duplocale(base: ::locale_t) -> ::locale_t;
pub fn freelocale(loc: ::locale_t) -> ::c_int;
pub fn localeconv_l(loc: ::locale_t) -> *mut lconv;
- pub fn newlocale(
- mask: ::c_int,
- locale: *const ::c_char,
- base: ::locale_t,
- ) -> ::locale_t;
+ pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t;
pub fn uselocale(loc: ::locale_t) -> ::locale_t;
pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char;
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 getdomainname(name: *mut ::c_char, len: ::c_int) -> ::c_int;
pub fn setdomainname(name: *const ::c_char, len: ::c_int) -> ::c_int;
+ pub fn preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t;
+ pub fn pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t)
+ -> ::ssize_t;
pub fn getxattr(
path: *const ::c_char,
name: *const ::c_char,
@@ -3397,16 +3697,8 @@ extern "C" {
size: ::size_t,
flags: ::c_int,
) -> ::ssize_t;
- pub fn removexattr(
- path: *const ::c_char,
- name: *const ::c_char,
- flags: ::c_int,
- ) -> ::c_int;
- pub fn renamex_np(
- from: *const ::c_char,
- to: *const ::c_char,
- flags: ::c_uint,
- ) -> ::c_int;
+ pub fn removexattr(path: *const ::c_char, name: *const ::c_char, flags: ::c_int) -> ::c_int;
+ pub fn renamex_np(from: *const ::c_char, to: *const ::c_char, flags: ::c_uint) -> ::c_int;
pub fn renameatx_np(
fromfd: ::c_int,
from: *const ::c_char,
@@ -3414,11 +3706,7 @@ extern "C" {
to: *const ::c_char,
flags: ::c_uint,
) -> ::c_int;
- pub fn fremovexattr(
- filedes: ::c_int,
- name: *const ::c_char,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn fremovexattr(filedes: ::c_int, name: *const ::c_char, flags: ::c_int) -> ::c_int;
pub fn getgrouplist(
name: *const ::c_char,
@@ -3432,18 +3720,11 @@ extern "C" {
all(target_os = "macos", target_arch = "x86"),
link_name = "waitid$UNIX2003"
)]
- pub fn waitid(
- idtype: idtype_t,
- id: id_t,
- infop: *mut ::siginfo_t,
- options: ::c_int,
- ) -> ::c_int;
+ pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int)
+ -> ::c_int;
pub fn brk(addr: *const ::c_void) -> *mut ::c_void;
pub fn sbrk(increment: ::c_int) -> *mut ::c_void;
- pub fn settimeofday(
- tv: *const ::timeval,
- tz: *const ::timezone,
- ) -> ::c_int;
+ pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
#[deprecated(since = "0.2.55", note = "Use the mach crate")]
pub fn _dyld_image_count() -> u32;
#[deprecated(since = "0.2.55", note = "Use the mach crate")]
@@ -3492,25 +3773,15 @@ extern "C" {
attr: *const posix_spawnattr_t,
flags: *mut ::c_short,
) -> ::c_int;
- pub fn posix_spawnattr_setflags(
- attr: *mut posix_spawnattr_t,
- flags: ::c_short,
- ) -> ::c_int;
+ pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: ::c_short) -> ::c_int;
pub fn posix_spawnattr_getpgroup(
attr: *const posix_spawnattr_t,
flags: *mut ::pid_t,
) -> ::c_int;
- pub fn posix_spawnattr_setpgroup(
- attr: *mut posix_spawnattr_t,
- flags: ::pid_t,
- ) -> ::c_int;
+ pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: ::pid_t) -> ::c_int;
- pub fn posix_spawn_file_actions_init(
- actions: *mut posix_spawn_file_actions_t,
- ) -> ::c_int;
- pub fn posix_spawn_file_actions_destroy(
- actions: *mut posix_spawn_file_actions_t,
- ) -> ::c_int;
+ pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> ::c_int;
+ pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> ::c_int;
pub fn posix_spawn_file_actions_addopen(
actions: *mut posix_spawn_file_actions_t,
fd: ::c_int,
@@ -3528,6 +3799,42 @@ extern "C" {
newfd: ::c_int,
) -> ::c_int;
pub fn uname(buf: *mut ::utsname) -> ::c_int;
+
+ pub fn connectx(
+ socket: ::c_int,
+ endpoints: *const sa_endpoints_t,
+ associd: sae_associd_t,
+ flags: ::c_uint,
+ iov: *const ::iovec,
+ iovcnt: ::c_uint,
+ len: *mut ::size_t,
+ connid: *mut sae_connid_t,
+ ) -> ::c_int;
+ pub fn disconnectx(socket: ::c_int, associd: sae_associd_t, connid: sae_connid_t) -> ::c_int;
+
+ pub fn ntp_adjtime(buf: *mut timex) -> ::c_int;
+ pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int;
+
+ #[cfg_attr(
+ all(target_os = "macos", not(target_arch = "aarch64")),
+ link_name = "getmntinfo$INODE64"
+ )]
+ pub fn getmntinfo(mntbufp: *mut *mut statfs, flags: ::c_int) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", not(target_arch = "aarch64")),
+ link_name = "getfsstat$INODE64"
+ )]
+ pub fn getfsstat(mntbufp: *mut statfs, bufsize: ::c_int, flags: ::c_int) -> ::c_int;
+
+ pub fn iconv_open(tocode: *const ::c_char, fromcode: *const ::c_char) -> iconv_t;
+ pub fn iconv(
+ cd: iconv_t,
+ inbuf: *mut *mut ::c_char,
+ inbytesleft: *mut ::size_t,
+ outbuf: *mut *mut ::c_char,
+ outbytesleft: *mut ::size_t,
+ ) -> ::size_t;
+ pub fn iconv_close(cd: iconv_t) -> ::c_int;
}
cfg_if! {
diff --git a/src/unix/bsd/freebsdlike/dragonfly/errno.rs b/src/unix/bsd/freebsdlike/dragonfly/errno.rs
index e9ad63b8..5fe6bb89 100644
--- a/src/unix/bsd/freebsdlike/dragonfly/errno.rs
+++ b/src/unix/bsd/freebsdlike/dragonfly/errno.rs
@@ -1,6 +1,7 @@
// DragonFlyBSD's __error function is declared with "static inline", so it must
// be implemented in the libc crate, as a pointer to a static thread_local.
f! {
+ #[deprecated(since = "0.2.77", note = "Use `__errno_location()` instead")]
pub fn __error() -> *mut ::c_int {
&mut errno
}
diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
index 63ca4db0..60ab2188 100644
--- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -1,5 +1,6 @@
pub type dev_t = u32;
pub type c_char = i8;
+pub type wchar_t = i32;
pub type clock_t = u64;
pub type ino_t = u64;
pub type lwpid_t = i32;
@@ -16,6 +17,7 @@ pub type uuid_t = ::uuid;
pub type fsblkcnt_t = u64;
pub type fsfilcnt_t = u64;
+pub type idtype_t = ::c_uint;
pub type mqd_t = ::c_int;
pub type sem_t = *mut sem;
@@ -169,6 +171,14 @@ s! {
pub sdl_route: [::c_ushort; 16],
}
+ pub struct xucred {
+ pub cr_version: ::c_uint,
+ pub cr_uid: ::uid_t,
+ pub cr_ngroups: ::c_short,
+ pub cr_groups: [::gid_t; 16],
+ __cr_unused1: *mut ::c_void,
+ }
+
pub struct stack_t {
pub ss_sp: *mut ::c_char,
pub ss_size: ::size_t,
@@ -236,7 +246,6 @@ s_no_extra_traits! {
pub sigev_value: ::sigval,
__unused3: *mut ::c_void //actually a function pointer
}
-
}
cfg_if! {
@@ -459,21 +468,6 @@ pub const RLIM_NLIMITS: ::rlim_t = 12;
pub const Q_GETQUOTA: ::c_int = 0x300;
pub const Q_SETQUOTA: ::c_int = 0x400;
-pub const CLOCK_REALTIME: ::clockid_t = 0;
-pub const CLOCK_VIRTUAL: ::clockid_t = 1;
-pub const CLOCK_PROF: ::clockid_t = 2;
-pub const CLOCK_MONOTONIC: ::clockid_t = 4;
-pub const CLOCK_UPTIME: ::clockid_t = 5;
-pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
-pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
-pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
-pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
-pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
-pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
-pub const CLOCK_SECOND: ::clockid_t = 13;
-pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
-pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
-
pub const CTL_UNSPEC: ::c_int = 0;
pub const CTL_KERN: ::c_int = 1;
pub const CTL_VM: ::c_int = 2;
@@ -956,12 +950,12 @@ pub const UTX_DB_UTMPX: ::c_uint = 0;
pub const UTX_DB_WTMPX: ::c_uint = 1;
pub const UTX_DB_LASTLOG: ::c_uint = 2;
-pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
-pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
-pub const LC_MONETARY_MASK: ::c_int = (1 << 2);
-pub const LC_NUMERIC_MASK: ::c_int = (1 << 3);
-pub const LC_TIME_MASK: ::c_int = (1 << 4);
-pub const LC_MESSAGES_MASK: ::c_int = (1 << 5);
+pub const LC_COLLATE_MASK: ::c_int = 1 << 0;
+pub const LC_CTYPE_MASK: ::c_int = 1 << 1;
+pub const LC_MONETARY_MASK: ::c_int = 1 << 2;
+pub const LC_NUMERIC_MASK: ::c_int = 1 << 3;
+pub const LC_TIME_MASK: ::c_int = 1 << 4;
+pub const LC_MESSAGES_MASK: ::c_int = 1 << 5;
pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
| LC_CTYPE_MASK
| LC_MESSAGES_MASK
@@ -996,8 +990,17 @@ pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 125;
pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 126;
pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 127;
-pub const WCONTINUED: ::c_int = 4;
-pub const WSTOPPED: ::c_int = 0o177;
+pub const WCONTINUED: ::c_int = 0x4;
+pub const WSTOPPED: ::c_int = 0x2;
+pub const WNOWAIT: ::c_int = 0x8;
+pub const WEXITED: ::c_int = 0x10;
+pub const WTRAPPED: ::c_int = 0x20;
+
+// Similar to FreeBSD, only the standardized ones are exposed.
+// There are more.
+pub const P_PID: idtype_t = 0;
+pub const P_PGID: idtype_t = 2;
+pub const P_ALL: idtype_t = 7;
// Values for struct rtprio (type_ field)
pub const RTP_PRIO_REALTIME: ::c_ushort = 0;
@@ -1017,8 +1020,10 @@ pub const SF_XLINK: ::c_ulong = 0x01000000;
pub const UTIME_OMIT: c_long = -2;
pub const UTIME_NOW: c_long = -1;
-fn _CMSG_ALIGN(n: usize) -> usize {
- (n + 3) & !3
+const_fn! {
+ {const} fn _CMSG_ALIGN(n: usize) -> usize {
+ (n + 3) & !3
+ }
}
f! {
@@ -1047,31 +1052,32 @@ f! {
}
}
- pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
(_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) +
_CMSG_ALIGN(length as usize)) as ::c_uint
}
}
+safe_f! {
+ pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
+ (status & 0o177) != 0o177 && (status & 0o177) != 0
+ }
+}
+
extern "C" {
+ pub fn __errno_location() -> *mut ::c_int;
pub fn setgrent();
- pub fn mprotect(
- addr: *mut ::c_void,
- len: ::size_t,
- prot: ::c_int,
- ) -> ::c_int;
- pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_settime(
- clk_id: ::clockid_t,
- tp: *const ::timespec,
- ) -> ::c_int;
+ pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
pub fn setutxdb(_type: ::c_uint, file: *mut ::c_char) -> ::c_int;
- pub fn aio_waitcomplete(
- iocbp: *mut *mut aiocb,
- timeout: *mut ::timespec,
+ pub fn aio_waitcomplete(iocbp: *mut *mut aiocb, timeout: *mut ::timespec) -> ::c_int;
+
+ pub fn waitid(
+ idtype: idtype_t,
+ id: ::id_t,
+ infop: *mut ::siginfo_t,
+ options: ::c_int,
) -> ::c_int;
pub fn freelocale(loc: ::locale_t);
@@ -1086,6 +1092,33 @@ extern "C" {
pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
pub fn uname(buf: *mut ::utsname) -> ::c_int;
+ pub fn memmem(
+ haystack: *const ::c_void,
+ haystacklen: ::size_t,
+ needle: *const ::c_void,
+ needlelen: ::size_t,
+ ) -> *mut ::c_void;
+}
+
+#[link(name = "rt")]
+extern "C" {
+ pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
+ pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
+ pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
+ pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
+ pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
+ pub fn aio_suspend(
+ aiocb_list: *const *const aiocb,
+ nitems: ::c_int,
+ timeout: *const ::timespec,
+ ) -> ::c_int;
+ pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
+ pub fn lio_listio(
+ mode: ::c_int,
+ aiocb_list: *const *mut aiocb,
+ nitems: ::c_int,
+ sevp: *mut sigevent,
+ ) -> ::c_int;
}
cfg_if! {
diff --git a/src/unix/bsd/freebsdlike/freebsd/aarch64.rs b/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
index 22fd2b84..db0093a5 100644
--- a/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/aarch64.rs
@@ -1,34 +1,10 @@
pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
+pub type wchar_t = u32;
pub type time_t = i64;
pub type suseconds_t = i64;
-
-s! {
- 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_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_size: ::off_t,
- pub st_blocks: ::blkcnt_t,
- pub st_blksize: ::blksize_t,
- pub st_flags: ::fflags_t,
- pub st_gen: u32,
- pub st_lspare: i32,
- pub st_birthtime: ::time_t,
- pub st_birthtime_nsec: ::c_long,
- }
-}
+pub type register_t = i64;
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
@@ -42,3 +18,4 @@ cfg_if! {
}
pub const MAP_32BIT: ::c_int = 0x00080000;
+pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
diff --git a/src/unix/bsd/freebsdlike/freebsd/arm.rs b/src/unix/bsd/freebsdlike/freebsd/arm.rs
index b7480aa7..300b3dd4 100644
--- a/src/unix/bsd/freebsdlike/freebsd/arm.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/arm.rs
@@ -1,8 +1,10 @@
pub type c_char = u8;
pub type c_long = i32;
pub type c_ulong = u32;
+pub type wchar_t = u32;
pub type time_t = i64;
pub type suseconds_t = i32;
+pub type register_t = i32;
s! {
pub struct stat {
@@ -45,3 +47,4 @@ cfg_if! {
}
}
pub const MAP_32BIT: ::c_int = 0x00080000;
+pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs
index f32128f7..f32128f7 100644
--- a/src/unix/bsd/freebsdlike/freebsd/freebsd11/x86_64.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
index 79a152fc..a0b51051 100644
--- a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
@@ -1,4 +1,4 @@
-// APIs that had breaking changes after FreeBSD 11
+// APIs that were changed after FreeBSD 11
// The type of `nlink_t` changed from `u16` to `u64` in FreeBSD 12:
pub type nlink_t = u16;
@@ -190,6 +190,7 @@ cfg_if! {
}
pub const ELAST: ::c_int = 96;
+pub const RAND_MAX: ::c_int = 0x7fff_fffd;
extern "C" {
// Return type ::c_int was removed in FreeBSD 12
@@ -197,11 +198,7 @@ extern "C" {
// Type of `addr` argument changed from `const void*` to `void*`
// in FreeBSD 12
- pub fn mprotect(
- addr: *const ::c_void,
- len: ::size_t,
- prot: ::c_int,
- ) -> ::c_int;
+ pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
// Return type ::c_int was removed in FreeBSD 12
pub fn freelocale(loc: ::locale_t) -> ::c_int;
@@ -214,11 +211,14 @@ extern "C" {
msgtyp: ::c_long,
msgflg: ::c_int,
) -> ::c_int;
+
+ pub fn fdatasync(fd: ::c_int) -> ::c_int;
}
cfg_if! {
- if #[cfg(target_arch = "x86_64")] {
- mod x86_64;
- pub use self::x86_64::*;
+ if #[cfg(any(target_arch = "x86_64",
+ target_arch = "aarch64"))] {
+ mod b64;
+ pub use self::b64::*;
}
}
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs
index 80c6fa16..80c6fa16 100644
--- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
index 6bf7f957..30fc8869 100644
--- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
@@ -1,4 +1,4 @@
-// APIs that changed in FreeBSD12
+// APIs in FreeBSD 12 that have changed since 11.
pub type nlink_t = u64;
pub type dev_t = u64;
@@ -190,22 +190,25 @@ cfg_if! {
}
}
-cfg_if! {
- if #[cfg(not(freebsd13))] {
- pub const ELAST: ::c_int = 96;
- } else {
- pub const EINTEGRITY: ::c_int = 97;
- pub const ELAST: ::c_int = 97;
- }
-}
+pub const F_ADD_SEALS: ::c_int = 19;
+pub const F_GET_SEALS: ::c_int = 20;
+pub const F_SEAL_SEAL: ::c_int = 0x0001;
+pub const F_SEAL_SHRINK: ::c_int = 0x0002;
+pub const F_SEAL_GROW: ::c_int = 0x0004;
+pub const F_SEAL_WRITE: ::c_int = 0x0008;
+
+pub const GRND_NONBLOCK: ::c_uint = 0x1;
+pub const GRND_RANDOM: ::c_uint = 0x2;
+
+pub const RAND_MAX: ::c_int = 0x7fff_fffd;
+
+pub const SO_DOMAIN: ::c_int = 0x1019;
+
+pub const ELAST: ::c_int = 96;
extern "C" {
pub fn setgrent();
- pub fn mprotect(
- addr: *mut ::c_void,
- len: ::size_t,
- prot: ::c_int,
- ) -> ::c_int;
+ pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
pub fn freelocale(loc: ::locale_t);
pub fn msgrcv(
msqid: ::c_int,
@@ -214,11 +217,22 @@ extern "C" {
msgtyp: ::c_long,
msgflg: ::c_int,
) -> ::ssize_t;
+ pub fn clock_nanosleep(
+ clk_id: ::clockid_t,
+ flags: ::c_int,
+ rqtp: *const ::timespec,
+ rmtp: *mut ::timespec,
+ ) -> ::c_int;
+
+ pub fn fdatasync(fd: ::c_int) -> ::c_int;
+
+ pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
}
cfg_if! {
- if #[cfg(target_arch = "x86_64")] {
- mod x86_64;
- pub use self::x86_64::*;
+ if #[cfg(any(target_arch = "x86_64",
+ target_arch = "aarch64"))] {
+ mod b64;
+ pub use self::b64::*;
}
}
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs
new file mode 100644
index 00000000..80c6fa16
--- /dev/null
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs
@@ -0,0 +1,34 @@
+#[repr(C)]
+#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
+pub struct stat {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino_t,
+ pub st_nlink: ::nlink_t,
+ pub st_mode: ::mode_t,
+ st_padding0: i16,
+ pub st_uid: ::uid_t,
+ pub st_gid: ::gid_t,
+ st_padding1: i32,
+ pub st_rdev: ::dev_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_birthtime: ::time_t,
+ pub st_birthtime_nsec: ::c_long,
+ pub st_size: ::off_t,
+ pub st_blocks: ::blkcnt_t,
+ pub st_blksize: ::blksize_t,
+ pub st_flags: ::fflags_t,
+ pub st_gen: u64,
+ pub st_spare: [u64; 10],
+}
+
+impl ::Copy for ::stat {}
+impl ::Clone for ::stat {
+ fn clone(&self) -> ::stat {
+ *self
+ }
+}
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
new file mode 100644
index 00000000..1753583b
--- /dev/null
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
@@ -0,0 +1,242 @@
+// APIs in FreeBSD 13 that have changed since 11.
+
+pub type nlink_t = u64;
+pub type dev_t = u64;
+pub type ino_t = ::c_ulong;
+pub type shmatt_t = ::c_uint;
+
+s! {
+ pub struct shmid_ds {
+ pub shm_perm: ::ipc_perm,
+ pub shm_segsz: ::size_t,
+ pub shm_lpid: ::pid_t,
+ pub shm_cpid: ::pid_t,
+ pub shm_nattch: ::shmatt_t,
+ pub shm_atime: ::time_t,
+ pub shm_dtime: ::time_t,
+ pub shm_ctime: ::time_t,
+ }
+
+ pub struct kevent {
+ pub ident: ::uintptr_t,
+ pub filter: ::c_short,
+ pub flags: ::c_ushort,
+ pub fflags: ::c_uint,
+ pub data: ::intptr_t,
+ pub udata: *mut ::c_void,
+ pub ext: [u64; 4],
+ }
+}
+
+s_no_extra_traits! {
+ pub struct dirent {
+ pub d_fileno: ::ino_t,
+ pub d_off: ::off_t,
+ pub d_reclen: u16,
+ pub d_type: u8,
+ d_pad0: u8,
+ pub d_namlen: u16,
+ d_pad1: u16,
+ pub d_name: [::c_char; 256],
+ }
+
+ pub struct statfs {
+ pub f_version: u32,
+ pub f_type: u32,
+ pub f_flags: u64,
+ pub f_bsize: u64,
+ pub f_iosize: u64,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: i64,
+ pub f_files: u64,
+ pub f_ffree: i64,
+ pub f_syncwrites: u64,
+ pub f_asyncwrites: u64,
+ pub f_syncreads: u64,
+ pub f_asyncreads: u64,
+ f_spare: [u64; 10],
+ pub f_namemax: u32,
+ pub f_owner: ::uid_t,
+ pub f_fsid: ::fsid_t,
+ f_charspare: [::c_char; 80],
+ pub f_fstypename: [::c_char; 16],
+ pub f_mntfromname: [::c_char; 1024],
+ pub f_mntonname: [::c_char; 1024],
+ }
+}
+
+cfg_if! {
+ if #[cfg(feature = "extra_traits")] {
+ impl PartialEq for statfs {
+ fn eq(&self, other: &statfs) -> bool {
+ self.f_version == other.f_version
+ && self.f_type == other.f_type
+ && self.f_flags == other.f_flags
+ && self.f_bsize == other.f_bsize
+ && self.f_iosize == other.f_iosize
+ && self.f_blocks == other.f_blocks
+ && self.f_bfree == other.f_bfree
+ && self.f_bavail == other.f_bavail
+ && self.f_files == other.f_files
+ && self.f_ffree == other.f_ffree
+ && self.f_syncwrites == other.f_syncwrites
+ && self.f_asyncwrites == other.f_asyncwrites
+ && self.f_syncreads == other.f_syncreads
+ && self.f_asyncreads == other.f_asyncreads
+ && self.f_namemax == other.f_namemax
+ && self.f_owner == other.f_owner
+ && self.f_fsid == other.f_fsid
+ && self.f_fstypename == other.f_fstypename
+ && self
+ .f_mntfromname
+ .iter()
+ .zip(other.f_mntfromname.iter())
+ .all(|(a,b)| a == b)
+ && self
+ .f_mntonname
+ .iter()
+ .zip(other.f_mntonname.iter())
+ .all(|(a,b)| a == b)
+ }
+ }
+ impl Eq for statfs {}
+ impl ::fmt::Debug for statfs {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("statfs")
+ .field("f_bsize", &self.f_bsize)
+ .field("f_iosize", &self.f_iosize)
+ .field("f_blocks", &self.f_blocks)
+ .field("f_bfree", &self.f_bfree)
+ .field("f_bavail", &self.f_bavail)
+ .field("f_files", &self.f_files)
+ .field("f_ffree", &self.f_ffree)
+ .field("f_syncwrites", &self.f_syncwrites)
+ .field("f_asyncwrites", &self.f_asyncwrites)
+ .field("f_syncreads", &self.f_syncreads)
+ .field("f_asyncreads", &self.f_asyncreads)
+ .field("f_namemax", &self.f_namemax)
+ .field("f_owner", &self.f_owner)
+ .field("f_fsid", &self.f_fsid)
+ .field("f_fstypename", &self.f_fstypename)
+ .field("f_mntfromname", &&self.f_mntfromname[..])
+ .field("f_mntonname", &&self.f_mntonname[..])
+ .finish()
+ }
+ }
+ impl ::hash::Hash for statfs {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.f_version.hash(state);
+ self.f_type.hash(state);
+ self.f_flags.hash(state);
+ self.f_bsize.hash(state);
+ self.f_iosize.hash(state);
+ self.f_blocks.hash(state);
+ self.f_bfree.hash(state);
+ self.f_bavail.hash(state);
+ self.f_files.hash(state);
+ self.f_ffree.hash(state);
+ self.f_syncwrites.hash(state);
+ self.f_asyncwrites.hash(state);
+ self.f_syncreads.hash(state);
+ self.f_asyncreads.hash(state);
+ self.f_namemax.hash(state);
+ self.f_owner.hash(state);
+ self.f_fsid.hash(state);
+ self.f_charspare.hash(state);
+ self.f_fstypename.hash(state);
+ self.f_mntfromname.hash(state);
+ self.f_mntonname.hash(state);
+ }
+ }
+
+ impl PartialEq for dirent {
+ fn eq(&self, other: &dirent) -> bool {
+ self.d_fileno == other.d_fileno
+ && self.d_off == other.d_off
+ && self.d_reclen == other.d_reclen
+ && self.d_type == other.d_type
+ && self.d_namlen == other.d_namlen
+ && self
+ .d_name[..self.d_namlen as _]
+ .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_fileno", &self.d_fileno)
+ .field("d_off", &self.d_off)
+ .field("d_reclen", &self.d_reclen)
+ .field("d_type", &self.d_type)
+ .field("d_namlen", &self.d_namlen)
+ .field("d_name", &&self.d_name[..self.d_namlen as _])
+ .finish()
+ }
+ }
+ impl ::hash::Hash for dirent {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.d_fileno.hash(state);
+ self.d_off.hash(state);
+ self.d_reclen.hash(state);
+ self.d_type.hash(state);
+ self.d_namlen.hash(state);
+ self.d_name[..self.d_namlen as _].hash(state);
+ }
+ }
+ }
+}
+
+pub const F_ADD_SEALS: ::c_int = 19;
+pub const F_GET_SEALS: ::c_int = 20;
+pub const F_SEAL_SEAL: ::c_int = 0x0001;
+pub const F_SEAL_SHRINK: ::c_int = 0x0002;
+pub const F_SEAL_GROW: ::c_int = 0x0004;
+pub const F_SEAL_WRITE: ::c_int = 0x0008;
+
+pub const GRND_NONBLOCK: ::c_uint = 0x1;
+pub const GRND_RANDOM: ::c_uint = 0x2;
+
+pub const RAND_MAX: ::c_int = 0x7fff_ffff;
+
+pub const SO_DOMAIN: ::c_int = 0x1019;
+
+pub const EINTEGRITY: ::c_int = 97;
+pub const ELAST: ::c_int = 97;
+pub const GRND_INSECURE: ::c_uint = 0x4;
+
+extern "C" {
+ pub fn aio_readv(aiocbp: *mut ::aiocb) -> ::c_int;
+ pub fn aio_writev(aiocbp: *mut ::aiocb) -> ::c_int;
+ pub fn setgrent();
+ pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
+ pub fn freelocale(loc: ::locale_t);
+ pub fn msgrcv(
+ msqid: ::c_int,
+ msgp: *mut ::c_void,
+ msgsz: ::size_t,
+ msgtyp: ::c_long,
+ msgflg: ::c_int,
+ ) -> ::ssize_t;
+ pub fn clock_nanosleep(
+ clk_id: ::clockid_t,
+ flags: ::c_int,
+ rqtp: *const ::timespec,
+ rmtp: *mut ::timespec,
+ ) -> ::c_int;
+
+ pub fn fdatasync(fd: ::c_int) -> ::c_int;
+
+ pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
+}
+
+cfg_if! {
+ if #[cfg(any(target_arch = "x86_64",
+ target_arch = "aarch64"))] {
+ mod b64;
+ pub use self::b64::*;
+ }
+}
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index 980caf22..db495e48 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -89,14 +89,6 @@ s! {
pub msg_ctime: ::time_t,
}
- pub struct xucred {
- pub cr_version: ::c_uint,
- pub cr_uid: ::uid_t,
- pub cr_ngroups: ::c_short,
- pub cr_groups: [::gid_t;16],
- __cr_unused1: *mut ::c_void,
- }
-
pub struct stack_t {
pub ss_sp: *mut ::c_void,
pub ss_size: ::size_t,
@@ -107,6 +99,28 @@ s! {
pub msg_hdr: ::msghdr,
pub msg_len: ::ssize_t,
}
+
+ pub struct sockcred {
+ pub sc_uid: ::uid_t,
+ pub sc_euid: ::uid_t,
+ pub sc_gid: ::gid_t,
+ pub sc_egid: ::gid_t,
+ pub sc_ngroups: ::c_int,
+ pub sc_groups: [::gid_t; 1],
+ }
+
+ pub struct ptrace_vm_entry {
+ pub pve_entry: ::c_int,
+ pub pve_timestamp: ::c_int,
+ pub pve_start: ::c_ulong,
+ pub pve_end: ::c_ulong,
+ pub pve_offset: ::c_ulong,
+ pub pve_prot: ::c_uint,
+ pub pve_pathlen: ::c_uint,
+ pub pve_fileid: ::c_long,
+ pub pve_fsid: u32,
+ pub pve_path: *mut ::c_char,
+ }
}
s_no_extra_traits! {
@@ -121,6 +135,23 @@ s_no_extra_traits! {
pub __ut_spare: [::c_char; 64],
}
+ #[cfg(libc_union)]
+ pub union __c_anonymous_cr_pid {
+ __cr_unused: *mut ::c_void,
+ pub cr_pid: ::pid_t,
+ }
+
+ pub struct xucred {
+ pub cr_version: ::c_uint,
+ pub cr_uid: ::uid_t,
+ pub cr_ngroups: ::c_short,
+ pub cr_groups: [::gid_t; 16],
+ #[cfg(libc_union)]
+ pub cr_pid__c_anonymous_union: __c_anonymous_cr_pid,
+ #[cfg(not(libc_union))]
+ __cr_unused1: *mut ::c_void,
+ }
+
pub struct sockaddr_dl {
pub sdl_len: ::c_uchar,
pub sdl_family: ::c_uchar,
@@ -203,6 +234,73 @@ cfg_if! {
}
}
+ #[cfg(libc_union)]
+ impl PartialEq for __c_anonymous_cr_pid {
+ fn eq(&self, other: &__c_anonymous_cr_pid) -> bool {
+ unsafe { self.cr_pid == other.cr_pid}
+ }
+ }
+ #[cfg(libc_union)]
+ impl Eq for __c_anonymous_cr_pid {}
+ #[cfg(libc_union)]
+ impl ::fmt::Debug for __c_anonymous_cr_pid {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("cr_pid")
+ .field("cr_pid", unsafe { &self.cr_pid })
+ .finish()
+ }
+ }
+ #[cfg(libc_union)]
+ impl ::hash::Hash for __c_anonymous_cr_pid {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ unsafe { self.cr_pid.hash(state) };
+ }
+ }
+
+ impl PartialEq for xucred {
+ fn eq(&self, other: &xucred) -> bool {
+ #[cfg(libc_union)]
+ let equal_cr_pid = self.cr_pid__c_anonymous_union
+ == other.cr_pid__c_anonymous_union;
+ #[cfg(not(libc_union))]
+ let equal_cr_pid = self.__cr_unused1 == other.__cr_unused1;
+
+ self.cr_version == other.cr_version
+ && self.cr_uid == other.cr_uid
+ && self.cr_ngroups == other.cr_ngroups
+ && self.cr_groups == other.cr_groups
+ && equal_cr_pid
+ }
+ }
+ impl Eq for xucred {}
+ impl ::fmt::Debug for xucred {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ let mut struct_formatter = f.debug_struct("xucred");
+ struct_formatter.field("cr_version", &self.cr_version);
+ struct_formatter.field("cr_uid", &self.cr_uid);
+ struct_formatter.field("cr_ngroups", &self.cr_ngroups);
+ struct_formatter.field("cr_groups", &self.cr_groups);
+ #[cfg(libc_union)]
+ struct_formatter.field(
+ "cr_pid__c_anonymous_union",
+ &self.cr_pid__c_anonymous_union
+ );
+ struct_formatter.finish()
+ }
+ }
+ impl ::hash::Hash for xucred {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.cr_version.hash(state);
+ self.cr_uid.hash(state);
+ self.cr_ngroups.hash(state);
+ self.cr_groups.hash(state);
+ #[cfg(libc_union)]
+ self.cr_pid__c_anonymous_union.hash(state);
+ #[cfg(not(libc_union))]
+ self.__cr_unused1.hash(state);
+ }
+ }
+
impl PartialEq for sockaddr_dl {
fn eq(&self, other: &sockaddr_dl) -> bool {
self.sdl_len == other.sdl_len
@@ -313,10 +411,9 @@ pub const EXTATTR_NAMESPACE_EMPTY: ::c_int = 0;
pub const EXTATTR_NAMESPACE_USER: ::c_int = 1;
pub const EXTATTR_NAMESPACE_SYSTEM: ::c_int = 2;
-pub const RAND_MAX: ::c_int = 0x7fff_fffd;
-pub const PTHREAD_STACK_MIN: ::size_t = 2048;
+pub const PTHREAD_STACK_MIN: ::size_t = MINSIGSTKSZ;
pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 4;
-pub const SIGSTKSZ: ::size_t = 34816;
+pub const SIGSTKSZ: ::size_t = MINSIGSTKSZ + 32768;
pub const SF_NODISKIO: ::c_int = 0x00000001;
pub const SF_MNOWAIT: ::c_int = 0x00000002;
pub const SF_SYNC: ::c_int = 0x00000004;
@@ -340,9 +437,18 @@ pub const RLIMIT_UMTXP: ::c_int = 14;
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::rlim_t = 15;
+pub const NI_NOFQDN: ::c_int = 0x00000001;
+pub const NI_NUMERICHOST: ::c_int = 0x00000002;
+pub const NI_NAMEREQD: ::c_int = 0x00000004;
+pub const NI_NUMERICSERV: ::c_int = 0x00000008;
+pub const NI_DGRAM: ::c_int = 0x00000010;
+pub const NI_NUMERICSCOPE: ::c_int = 0x00000020;
+
pub const Q_GETQUOTA: ::c_int = 0x700;
pub const Q_SETQUOTA: ::c_int = 0x800;
+pub const MAP_GUARD: ::c_int = 0x00002000;
+
pub const POSIX_FADV_NORMAL: ::c_int = 0;
pub const POSIX_FADV_RANDOM: ::c_int = 1;
pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
@@ -411,22 +517,13 @@ pub const NOTE_NSECONDS: u32 = 0x00000008;
pub const MADV_PROTECT: ::c_int = 10;
pub const RUSAGE_THREAD: ::c_int = 1;
-pub const CLOCK_REALTIME: ::clockid_t = 0;
-pub const CLOCK_VIRTUAL: ::clockid_t = 1;
-pub const CLOCK_PROF: ::clockid_t = 2;
-pub const CLOCK_MONOTONIC: ::clockid_t = 4;
-pub const CLOCK_UPTIME: ::clockid_t = 5;
-pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
-pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
-pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
-pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
-pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
-pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
-pub const CLOCK_SECOND: ::clockid_t = 13;
-pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
-pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
-
+#[doc(hidden)]
+#[deprecated(
+ since = "0.2.72",
+ note = "CTL_UNSPEC is deprecated. Use CTL_SYSCTL instead"
+)]
pub const CTL_UNSPEC: ::c_int = 0;
+pub const CTL_SYSCTL: ::c_int = 0;
pub const CTL_KERN: ::c_int = 1;
pub const CTL_VM: ::c_int = 2;
pub const CTL_VFS: ::c_int = 3;
@@ -436,6 +533,13 @@ pub const CTL_HW: ::c_int = 6;
pub const CTL_MACHDEP: ::c_int = 7;
pub const CTL_USER: ::c_int = 8;
pub const CTL_P1003_1B: ::c_int = 9;
+pub const CTL_SYSCTL_DEBUG: ::c_int = 0;
+pub const CTL_SYSCTL_NAME: ::c_int = 1;
+pub const CTL_SYSCTL_NEXT: ::c_int = 2;
+pub const CTL_SYSCTL_NAME2OID: ::c_int = 3;
+pub const CTL_SYSCTL_OIDFMT: ::c_int = 4;
+pub const CTL_SYSCTL_OIDDESCR: ::c_int = 5;
+pub const CTL_SYSCTL_OIDLABEL: ::c_int = 6;
pub const KERN_OSTYPE: ::c_int = 1;
pub const KERN_OSRELEASE: ::c_int = 2;
pub const KERN_OSREV: ::c_int = 3;
@@ -603,7 +707,6 @@ pub const SO_PROTOCOL: ::c_int = 0x1016;
pub const SO_PROTOTYPE: ::c_int = SO_PROTOCOL;
pub const SO_VENDOR: ::c_int = 0x80000000;
-pub const LOCAL_PEERCRED: ::c_int = 1;
pub const LOCAL_CREDS: ::c_int = 2;
pub const LOCAL_CONNWAIT: ::c_int = 4;
pub const LOCAL_VENDOR: ::c_int = SO_VENDOR;
@@ -668,10 +771,7 @@ pub const IFF_PROMISC: ::c_int = 0x100; // (n) receive all packets
pub const IFF_ALLMULTI: ::c_int = 0x200; // (n) receive all multicast packets
pub const IFF_OACTIVE: ::c_int = 0x400; // (d) tx hardware queue is full
#[doc(hidden)]
-#[deprecated(
- since = "0.2.54",
- note = "Use the portable `IFF_OACTIVE` instead"
-)]
+#[deprecated(since = "0.2.54", note = "Use the portable `IFF_OACTIVE` instead")]
pub const IFF_DRV_OACTIVE: ::c_int = 0x400;
pub const IFF_SIMPLEX: ::c_int = 0x800; // (i) can't hear own transmissions
pub const IFF_LINK0: ::c_int = 0x1000; // per link layer defined bit
@@ -753,8 +853,14 @@ pub const IPPROTO_BLT: ::c_int = 30;
pub const IPPROTO_NSP: ::c_int = 31;
/// Merit Internodal
pub const IPPROTO_INP: ::c_int = 32;
-/// Sequential Exchange
+#[doc(hidden)]
+#[deprecated(
+ since = "0.2.72",
+ note = "IPPROTO_SEP is deprecated. Use IPPROTO_DCCP instead"
+)]
pub const IPPROTO_SEP: ::c_int = 33;
+/// Datagram Congestion Control Protocol
+pub const IPPROTO_DCCP: ::c_int = 33;
/// Third Party Connect
pub const IPPROTO_3PC: ::c_int = 34;
/// InterDomain Policy Routing
@@ -944,6 +1050,7 @@ pub const IP_RECVORIGDSTADDR: ::c_int = IP_ORIGDSTADDR;
pub const IP_RECVTOS: ::c_int = 68;
+pub const IPV6_BINDANY: ::c_int = 64;
pub const IPV6_ORIGDSTADDR: ::c_int = 72;
pub const IPV6_RECVORIGDSTADDR: ::c_int = IPV6_ORIGDSTADDR;
@@ -1001,6 +1108,7 @@ pub const HW_MAXID: ::c_int = 13;
#[deprecated(since = "0.2.54", note = "Removed in FreeBSD 11")]
pub const USER_MAXID: ::c_int = 21;
#[doc(hidden)]
+#[deprecated(since = "0.2.74", note = "Removed in FreeBSD 13")]
pub const CTL_P1003_1B_MAXID: ::c_int = 26;
pub const MSG_NOTIFICATION: ::c_int = 0x00002000;
@@ -1024,12 +1132,12 @@ pub const UTXDB_ACTIVE: ::c_int = 0;
pub const UTXDB_LASTLOGIN: ::c_int = 1;
pub const UTXDB_LOG: ::c_int = 2;
-pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
-pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
-pub const LC_MONETARY_MASK: ::c_int = (1 << 2);
-pub const LC_NUMERIC_MASK: ::c_int = (1 << 3);
-pub const LC_TIME_MASK: ::c_int = (1 << 4);
-pub const LC_MESSAGES_MASK: ::c_int = (1 << 5);
+pub const LC_COLLATE_MASK: ::c_int = 1 << 0;
+pub const LC_CTYPE_MASK: ::c_int = 1 << 1;
+pub const LC_MONETARY_MASK: ::c_int = 1 << 2;
+pub const LC_NUMERIC_MASK: ::c_int = 1 << 3;
+pub const LC_TIME_MASK: ::c_int = 1 << 4;
+pub const LC_MESSAGES_MASK: ::c_int = 1 << 5;
pub const LC_ALL_MASK: ::c_int = LC_COLLATE_MASK
| LC_CTYPE_MASK
| LC_MESSAGES_MASK
@@ -1069,9 +1177,6 @@ pub const _PC_ACL_NFS4: ::c_int = 64;
pub const _SC_CPUSET_SIZE: ::c_int = 122;
-pub const XU_NGROUPS: ::c_int = 16;
-pub const XUCRED_VERSION: ::c_uint = 0;
-
// Flags which can be passed to pdfork(2)
pub const PD_DAEMON: ::c_int = 0x00000001;
pub const PD_CLOEXEC: ::c_int = 0x00000002;
@@ -1099,8 +1204,19 @@ pub const UF_READONLY: ::c_ulong = 0x00001000;
pub const UF_HIDDEN: ::c_ulong = 0x00008000;
pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
-fn _ALIGN(p: usize) -> usize {
- (p + _ALIGNBYTES) & !_ALIGNBYTES
+pub const F_OGETLK: ::c_int = 7;
+pub const F_OSETLK: ::c_int = 8;
+pub const F_OSETLKW: ::c_int = 9;
+pub const F_DUP2FD: ::c_int = 10;
+pub const F_SETLK_REMOTE: ::c_int = 14;
+pub const F_READAHEAD: ::c_int = 15;
+pub const F_RDAHEAD: ::c_int = 16;
+pub const F_DUP2FD_CLOEXEC: ::c_int = 18;
+
+const_fn! {
+ {const} fn _ALIGN(p: usize) -> usize {
+ (p + _ALIGNBYTES) & !_ALIGNBYTES
+ }
}
f! {
@@ -1131,25 +1247,45 @@ f! {
}
}
- pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
(_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
as ::c_uint
}
+ pub fn SOCKCREDSIZE(ngrps: usize) -> usize {
+ let ngrps = if ngrps > 0 {
+ ngrps - 1
+ } else {
+ 0
+ };
+ ::mem::size_of::<sockcred>() + ::mem::size_of::<::gid_t>() * ngrps
+ }
+
pub fn uname(buf: *mut ::utsname) -> ::c_int {
__xuname(256, buf as *mut ::c_void)
}
}
+safe_f! {
+ pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
+ (status & 0o177) != 0o177 && (status & 0o177) != 0 && status != 0x13
+ }
+}
+
extern "C" {
pub fn __error() -> *mut ::c_int;
- pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_settime(
- clk_id: ::clockid_t,
- tp: *const ::timespec,
+ pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
+ pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
+ pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
+ pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
+ pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
+ pub fn aio_suspend(
+ aiocb_list: *const *const aiocb,
+ nitems: ::c_int,
+ timeout: *const ::timespec,
) -> ::c_int;
+ pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
pub fn extattr_delete_fd(
fd: ::c_int,
@@ -1230,43 +1366,25 @@ extern "C" {
pub fn jail(jail: *mut ::jail) -> ::c_int;
pub fn jail_attach(jid: ::c_int) -> ::c_int;
pub fn jail_remove(jid: ::c_int) -> ::c_int;
- pub fn jail_get(
- iov: *mut ::iovec,
- niov: ::c_uint,
- flags: ::c_int,
- ) -> ::c_int;
- pub fn jail_set(
- iov: *mut ::iovec,
- niov: ::c_uint,
- flags: ::c_int,
+ pub fn jail_get(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) -> ::c_int;
+ pub fn jail_set(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) -> ::c_int;
+
+ pub fn lio_listio(
+ mode: ::c_int,
+ aiocb_list: *const *mut aiocb,
+ nitems: ::c_int,
+ sevp: *mut sigevent,
) -> ::c_int;
- pub fn fdatasync(fd: ::c_int) -> ::c_int;
- pub fn posix_fallocate(
- fd: ::c_int,
- offset: ::off_t,
- len: ::off_t,
- ) -> ::c_int;
- pub fn posix_fadvise(
- fd: ::c_int,
- offset: ::off_t,
- len: ::off_t,
- advise: ::c_int,
- ) -> ::c_int;
+ pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int;
+ pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advise: ::c_int) -> ::c_int;
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
- pub fn mkostemps(
- template: *mut ::c_char,
- suffixlen: ::c_int,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int;
pub fn getutxuser(user: *const ::c_char) -> *mut utmpx;
pub fn setutxdb(_type: ::c_int, file: *const ::c_char) -> ::c_int;
- pub fn aio_waitcomplete(
- iocbp: *mut *mut aiocb,
- timeout: *mut ::timespec,
- ) -> ::ssize_t;
+ pub fn aio_waitcomplete(iocbp: *mut *mut aiocb, timeout: *mut ::timespec) -> ::ssize_t;
pub fn mq_getfd_np(mqd: ::mqd_t) -> ::c_int;
pub fn waitid(
@@ -1278,22 +1396,10 @@ extern "C" {
pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
- pub fn shmat(
- shmid: ::c_int,
- shmaddr: *const ::c_void,
- shmflg: ::c_int,
- ) -> *mut ::c_void;
+ 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 msgctl(
- msqid: ::c_int,
- cmd: ::c_int,
- buf: *mut ::msqid_ds,
- ) -> ::c_int;
+ pub fn shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
+ pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut ::msqid_ds) -> ::c_int;
pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
pub fn msgsnd(
msqid: ::c_int,
@@ -1312,11 +1418,7 @@ extern "C" {
pub fn pdgetpid(fd: ::c_int, pidp: *mut ::pid_t) -> ::c_int;
pub fn pdkill(fd: ::c_int, signum: ::c_int) -> ::c_int;
- pub fn rtprio_thread(
- function: ::c_int,
- lwpid: ::lwpid_t,
- rtp: *mut super::rtprio,
- ) -> ::c_int;
+ pub fn rtprio_thread(function: ::c_int, lwpid: ::lwpid_t, rtp: *mut super::rtprio) -> ::c_int;
pub fn posix_spawn(
pid: *mut ::pid_t,
@@ -1356,26 +1458,17 @@ extern "C" {
attr: *const posix_spawnattr_t,
flags: *mut ::c_short,
) -> ::c_int;
- pub fn posix_spawnattr_setflags(
- attr: *mut posix_spawnattr_t,
- flags: ::c_short,
- ) -> ::c_int;
+ pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: ::c_short) -> ::c_int;
pub fn posix_spawnattr_getpgroup(
attr: *const posix_spawnattr_t,
flags: *mut ::pid_t,
) -> ::c_int;
- pub fn posix_spawnattr_setpgroup(
- attr: *mut posix_spawnattr_t,
- flags: ::pid_t,
- ) -> ::c_int;
+ pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: ::pid_t) -> ::c_int;
pub fn posix_spawnattr_getschedpolicy(
attr: *const posix_spawnattr_t,
flags: *mut ::c_int,
) -> ::c_int;
- pub fn posix_spawnattr_setschedpolicy(
- attr: *mut posix_spawnattr_t,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: ::c_int) -> ::c_int;
pub fn posix_spawnattr_getschedparam(
attr: *const posix_spawnattr_t,
param: *mut ::sched_param,
@@ -1385,12 +1478,8 @@ extern "C" {
param: *const ::sched_param,
) -> ::c_int;
- pub fn posix_spawn_file_actions_init(
- actions: *mut posix_spawn_file_actions_t,
- ) -> ::c_int;
- pub fn posix_spawn_file_actions_destroy(
- actions: *mut posix_spawn_file_actions_t,
- ) -> ::c_int;
+ pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> ::c_int;
+ pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> ::c_int;
pub fn posix_spawn_file_actions_addopen(
actions: *mut posix_spawn_file_actions_t,
fd: ::c_int,
@@ -1408,15 +1497,9 @@ extern "C" {
newfd: ::c_int,
) -> ::c_int;
- #[cfg_attr(
- all(target_os = "freebsd", freebsd11),
- link_name = "statfs@FBSD_1.0"
- )]
+ #[cfg_attr(all(target_os = "freebsd", freebsd11), link_name = "statfs@FBSD_1.0")]
pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
- #[cfg_attr(
- all(target_os = "freebsd", freebsd11),
- link_name = "fstatfs@FBSD_1.0"
- )]
+ #[cfg_attr(all(target_os = "freebsd", freebsd11), link_name = "fstatfs@FBSD_1.0")]
pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int;
@@ -1435,6 +1518,14 @@ extern "C" {
flags: ::c_int,
timeout: *const ::timespec,
) -> ::ssize_t;
+ pub fn memmem(
+ haystack: *const ::c_void,
+ haystacklen: ::size_t,
+ needle: *const ::c_void,
+ needlelen: ::size_t,
+ ) -> *mut ::c_void;
+
+ pub fn nmount(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) -> ::c_int;
}
#[link(name = "util")]
@@ -1450,10 +1541,10 @@ extern "C" {
}
cfg_if! {
- if #[cfg(freebsd12)] {
- mod freebsd12;
- pub use self::freebsd12::*;
- } else if #[cfg(freebsd13)] {
+ if #[cfg(freebsd13)] {
+ mod freebsd13;
+ pub use self::freebsd13::*;
+ } else if #[cfg(freebsd12)] {
mod freebsd12;
pub use self::freebsd12::*;
} else if #[cfg(any(freebsd10, freebsd11))] {
diff --git a/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs b/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs
index 5c0c6e7f..7f5b9752 100644
--- a/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs
@@ -1,8 +1,10 @@
pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
+pub type wchar_t = i32;
pub type time_t = i64;
pub type suseconds_t = i64;
+pub type register_t = i64;
s! {
pub struct stat {
@@ -42,3 +44,4 @@ cfg_if! {
}
pub const MAP_32BIT: ::c_int = 0x00080000;
+pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
diff --git a/src/unix/bsd/freebsdlike/freebsd/x86.rs b/src/unix/bsd/freebsdlike/freebsd/x86.rs
index adec88cb..d3a3f34b 100644
--- a/src/unix/bsd/freebsdlike/freebsd/x86.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/x86.rs
@@ -1,8 +1,10 @@
pub type c_char = i8;
pub type c_long = i32;
pub type c_ulong = u32;
+pub type wchar_t = i32;
pub type time_t = i32;
pub type suseconds_t = i32;
+pub type register_t = i32;
s! {
pub struct stat {
@@ -38,6 +40,7 @@ cfg_if! {
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
} else {
#[doc(hidden)]
- pub const _ALIGNBYTES: usize = 8 - 1;
+ pub const _ALIGNBYTES: usize = 4 - 1;
}
}
+pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs
index 7ca870fd..3a016a05 100644
--- a/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs
@@ -1,7 +1,197 @@
+use {c_long, register_t};
+
s_no_extra_traits! {
#[allow(missing_debug_implementations)]
#[repr(align(16))]
pub struct max_align_t {
priv_: [f64; 4]
}
+
+ #[repr(align(16))]
+ pub struct mcontext_t {
+ pub mc_onstack: register_t,
+ pub mc_rdi: register_t,
+ pub mc_rsi: register_t,
+ pub mc_rdx: register_t,
+ pub mc_rcx: register_t,
+ pub mc_r8: register_t,
+ pub mc_r9: register_t,
+ pub mc_rax: register_t,
+ pub mc_rbx: register_t,
+ pub mc_rbp: register_t,
+ pub mc_r10: register_t,
+ pub mc_r11: register_t,
+ pub mc_r12: register_t,
+ pub mc_r13: register_t,
+ pub mc_r14: register_t,
+ pub mc_r15: register_t,
+ pub mc_trapno: u32,
+ pub mc_fs: u16,
+ pub mc_gs: u16,
+ pub mc_addr: register_t,
+ pub mc_flags: u32,
+ pub mc_es: u16,
+ pub mc_ds: u16,
+ pub mc_err: register_t,
+ pub mc_rip: register_t,
+ pub mc_cs: register_t,
+ pub mc_rflags: register_t,
+ pub mc_rsp: register_t,
+ pub mc_ss: register_t,
+ pub mc_len: c_long,
+ pub mc_fpformat: c_long,
+ pub mc_ownedfp: c_long,
+ pub mc_fpstate: [c_long; 64],
+ pub mc_fsbase: register_t,
+ pub mc_gsbase: register_t,
+ pub mc_xfpustate: register_t,
+ pub mc_xfpustate_len: register_t,
+ pub mc_spare: [c_long; 4],
+ }
+}
+
+cfg_if! {
+ if #[cfg(feature = "extra_traits")] {
+ impl PartialEq for mcontext_t {
+ fn eq(&self, other: &mcontext_t) -> bool {
+ self.mc_onstack == other.mc_onstack &&
+ self.mc_rdi == other.mc_rdi &&
+ self.mc_rsi == other.mc_rsi &&
+ self.mc_rdx == other.mc_rdx &&
+ self.mc_rcx == other.mc_rcx &&
+ self.mc_r8 == other.mc_r8 &&
+ self.mc_r9 == other.mc_r9 &&
+ self.mc_rax == other.mc_rax &&
+ self.mc_rbx == other.mc_rbx &&
+ self.mc_rbp == other.mc_rbp &&
+ self.mc_r10 == other.mc_r10 &&
+ self.mc_r11 == other.mc_r11 &&
+ self.mc_r12 == other.mc_r12 &&
+ self.mc_r13 == other.mc_r13 &&
+ self.mc_r14 == other.mc_r14 &&
+ self.mc_r15 == other.mc_r15 &&
+ self.mc_trapno == other.mc_trapno &&
+ self.mc_fs == other.mc_fs &&
+ self.mc_gs == other.mc_gs &&
+ self.mc_addr == other.mc_addr &&
+ self.mc_flags == other.mc_flags &&
+ self.mc_es == other.mc_es &&
+ self.mc_ds == other.mc_ds &&
+ self.mc_err == other.mc_err &&
+ self.mc_rip == other.mc_rip &&
+ self.mc_cs == other.mc_cs &&
+ self.mc_rflags == other.mc_rflags &&
+ self.mc_rsp == other.mc_rsp &&
+ self.mc_ss == other.mc_ss &&
+ self.mc_len == other.mc_len &&
+ self.mc_fpformat == other.mc_fpformat &&
+ self.mc_ownedfp == other.mc_ownedfp &&
+ self.mc_fpstate.iter().zip(other.mc_fpstate.iter())
+ .all(|(a, b)| a == b) &&
+ self.mc_fsbase == other.mc_fsbase &&
+ self.mc_gsbase == other.mc_gsbase &&
+ self.mc_xfpustate == other.mc_xfpustate &&
+ self.mc_xfpustate_len == other.mc_xfpustate_len &&
+ self.mc_spare == other.mc_spare
+ }
+ }
+ impl Eq for mcontext_t {}
+ impl ::fmt::Debug for mcontext_t {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("mcontext_t")
+ .field("mc_onstack", &self.mc_onstack)
+ .field("mc_rdi", &self.mc_rdi)
+ .field("mc_rsi", &self.mc_rsi)
+ .field("mc_rdx", &self.mc_rdx)
+ .field("mc_rcx", &self.mc_rcx)
+ .field("mc_r8", &self.mc_r8)
+ .field("mc_r9", &self.mc_r9)
+ .field("mc_rax", &self.mc_rax)
+ .field("mc_rbx", &self.mc_rbx)
+ .field("mc_rbp", &self.mc_rbp)
+ .field("mc_r10", &self.mc_r10)
+ .field("mc_r11", &self.mc_r11)
+ .field("mc_r12", &self.mc_r12)
+ .field("mc_r13", &self.mc_r13)
+ .field("mc_r14", &self.mc_r14)
+ .field("mc_r15", &self.mc_r15)
+ .field("mc_trapno", &self.mc_trapno)
+ .field("mc_fs", &self.mc_fs)
+ .field("mc_gs", &self.mc_gs)
+ .field("mc_addr", &self.mc_addr)
+ .field("mc_flags", &self.mc_flags)
+ .field("mc_es", &self.mc_es)
+ .field("mc_ds", &self.mc_ds)
+ .field("mc_err", &self.mc_err)
+ .field("mc_rip", &self.mc_rip)
+ .field("mc_cs", &self.mc_cs)
+ .field("mc_rflags", &self.mc_rflags)
+ .field("mc_rsp", &self.mc_rsp)
+ .field("mc_ss", &self.mc_ss)
+ .field("mc_len", &self.mc_len)
+ .field("mc_fpformat", &self.mc_fpformat)
+ .field("mc_ownedfp", &self.mc_ownedfp)
+ // FIXME: .field("mc_fpstate", &self.mc_fpstate)
+ .field("mc_fsbase", &self.mc_fsbase)
+ .field("mc_gsbase", &self.mc_gsbase)
+ .field("mc_xfpustate", &self.mc_xfpustate)
+ .field("mc_xfpustate_len", &self.mc_xfpustate_len)
+ .field("mc_spare", &self.mc_spare)
+ .finish()
+ }
+ }
+ impl ::hash::Hash for mcontext_t {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.mc_onstack.hash(state);
+ self.mc_rdi.hash(state);
+ self.mc_rsi.hash(state);
+ self.mc_rdx.hash(state);
+ self.mc_rcx.hash(state);
+ self.mc_r8.hash(state);
+ self.mc_r9.hash(state);
+ self.mc_rax.hash(state);
+ self.mc_rbx.hash(state);
+ self.mc_rbp.hash(state);
+ self.mc_r10.hash(state);
+ self.mc_r11.hash(state);
+ self.mc_r12.hash(state);
+ self.mc_r13.hash(state);
+ self.mc_r14.hash(state);
+ self.mc_r15.hash(state);
+ self.mc_trapno.hash(state);
+ self.mc_fs.hash(state);
+ self.mc_gs.hash(state);
+ self.mc_addr.hash(state);
+ self.mc_flags.hash(state);
+ self.mc_es.hash(state);
+ self.mc_ds.hash(state);
+ self.mc_err.hash(state);
+ self.mc_rip.hash(state);
+ self.mc_cs.hash(state);
+ self.mc_rflags.hash(state);
+ self.mc_rsp.hash(state);
+ self.mc_ss.hash(state);
+ self.mc_len.hash(state);
+ self.mc_fpformat.hash(state);
+ self.mc_ownedfp.hash(state);
+ self.mc_fpstate.hash(state);
+ self.mc_fsbase.hash(state);
+ self.mc_gsbase.hash(state);
+ self.mc_xfpustate.hash(state);
+ self.mc_xfpustate_len.hash(state);
+ self.mc_spare.hash(state);
+ }
+ }
+ }
+}
+
+s! {
+ pub struct ucontext_t {
+ pub uc_sigmask: ::sigset_t,
+ pub uc_mcontext: ::mcontext_t,
+ pub uc_link: *mut ::ucontext_t,
+ pub uc_stack: ::stack_t,
+ pub uc_flags: ::c_int,
+ __spare__: [::c_int; 4],
+ }
}
diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs
index 0769a22f..d3333c8b 100644
--- a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs
@@ -1,8 +1,180 @@
pub type c_char = i8;
pub type c_long = i64;
pub type c_ulong = u64;
+pub type wchar_t = i32;
pub type time_t = i64;
pub type suseconds_t = i64;
+pub type register_t = i64;
+
+s! {
+ pub struct reg32 {
+ pub r_fs: u32,
+ pub r_es: u32,
+ pub r_ds: u32,
+ pub r_edi: u32,
+ pub r_esi: u32,
+ pub r_ebp: u32,
+ pub r_isp: u32,
+ pub r_ebx: u32,
+ pub r_edx: u32,
+ pub r_ecx: u32,
+ pub r_eax: u32,
+ pub r_trapno: u32,
+ pub r_err: u32,
+ pub r_eip: u32,
+ pub r_cs: u32,
+ pub r_eflags: u32,
+ pub r_esp: u32,
+ pub r_ss: u32,
+ pub r_gs: u32,
+ }
+
+ pub struct reg {
+ pub r_r15: i64,
+ pub r_r14: i64,
+ pub r_r13: i64,
+ pub r_r12: i64,
+ pub r_r11: i64,
+ pub r_r10: i64,
+ pub r_r9: i64,
+ pub r_r8: i64,
+ pub r_rdi: i64,
+ pub r_rsi: i64,
+ pub r_rbp: i64,
+ pub r_rbx: i64,
+ pub r_rdx: i64,
+ pub r_rcx: i64,
+ pub r_rax: i64,
+ pub r_trapno: u32,
+ pub r_fs: u16,
+ pub r_gs: u16,
+ pub r_err: u32,
+ pub r_es: u16,
+ pub r_ds: u16,
+ pub r_rip: i64,
+ pub r_cs: i64,
+ pub r_rflags: i64,
+ pub r_rsp: i64,
+ pub r_ss: i64,
+ }
+}
+
+s_no_extra_traits! {
+ pub struct fpreg32 {
+ pub fpr_env: [u32; 7],
+ pub fpr_acc: [[u8; 10]; 8],
+ pub fpr_ex_sw: u32,
+ pub fpr_pad: [u8; 64],
+ }
+
+ pub struct fpreg {
+ pub fpr_env: [u64; 4],
+ pub fpr_acc: [[u8; 16]; 8],
+ pub fpr_xacc: [[u8; 16]; 16],
+ pub fpr_spare: [u64; 12],
+ }
+
+ pub struct xmmreg {
+ pub xmm_env: [u32; 8],
+ pub xmm_acc: [[u8; 16]; 8],
+ pub xmm_reg: [[u8; 16]; 8],
+ pub xmm_pad: [u8; 224],
+ }
+}
+
+cfg_if! {
+ if #[cfg(feature = "extra_traits")] {
+ impl PartialEq for fpreg32 {
+ fn eq(&self, other: &fpreg32) -> bool {
+ self.fpr_env == other.fpr_env &&
+ self.fpr_acc == other.fpr_acc &&
+ self.fpr_ex_sw == other.fpr_ex_sw &&
+ self.fpr_pad
+ .iter()
+ .zip(other.fpr_pad.iter())
+ .all(|(a,b)| a == b)
+ }
+ }
+ impl Eq for fpreg32 {}
+ impl ::fmt::Debug for fpreg32 {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("fpreg32")
+ .field("fpr_env", &&self.fpr_env[..])
+ .field("fpr_acc", &self.fpr_acc)
+ .field("fpr_ex_sw", &self.fpr_ex_sw)
+ .field("fpr_pad", &&self.fpr_pad[..])
+ .finish()
+ }
+ }
+ impl ::hash::Hash for fpreg32 {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.fpr_env.hash(state);
+ self.fpr_acc.hash(state);
+ self.fpr_ex_sw.hash(state);
+ self.fpr_pad.hash(state);
+ }
+ }
+
+ impl PartialEq for fpreg {
+ fn eq(&self, other: &fpreg) -> bool {
+ self.fpr_env == other.fpr_env &&
+ self.fpr_acc == other.fpr_acc &&
+ self.fpr_xacc == other.fpr_xacc &&
+ self.fpr_spare == other.fpr_spare
+ }
+ }
+ impl Eq for fpreg {}
+ impl ::fmt::Debug for fpreg {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("fpreg")
+ .field("fpr_env", &self.fpr_env)
+ .field("fpr_acc", &self.fpr_acc)
+ .field("fpr_xacc", &self.fpr_xacc)
+ .field("fpr_spare", &self.fpr_spare)
+ .finish()
+ }
+ }
+ impl ::hash::Hash for fpreg {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.fpr_env.hash(state);
+ self.fpr_acc.hash(state);
+ self.fpr_xacc.hash(state);
+ self.fpr_spare.hash(state);
+ }
+ }
+
+ impl PartialEq for xmmreg {
+ fn eq(&self, other: &xmmreg) -> bool {
+ self.xmm_env == other.xmm_env &&
+ self.xmm_acc == other.xmm_acc &&
+ self.xmm_reg == other.xmm_reg &&
+ self.xmm_pad
+ .iter()
+ .zip(other.xmm_pad.iter())
+ .all(|(a,b)| a == b)
+ }
+ }
+ impl Eq for xmmreg {}
+ impl ::fmt::Debug for xmmreg {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("xmmreg")
+ .field("xmm_env", &self.xmm_env)
+ .field("xmm_acc", &self.xmm_acc)
+ .field("xmm_reg", &self.xmm_reg)
+ .field("xmm_pad", &&self.xmm_pad[..])
+ .finish()
+ }
+ }
+ impl ::hash::Hash for xmmreg {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.xmm_env.hash(state);
+ self.xmm_acc.hash(state);
+ self.xmm_reg.hash(state);
+ self.xmm_pad.hash(state);
+ }
+ }
+ }
+}
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
@@ -15,6 +187,18 @@ cfg_if! {
}
}
pub const MAP_32BIT: ::c_int = 0x00080000;
+pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
+
+pub const _MC_HASSEGS: u32 = 0x1;
+pub const _MC_HASBASES: u32 = 0x2;
+pub const _MC_HASFPXSTATE: u32 = 0x4;
+pub const _MC_FLAG_MASK: u32 = _MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE;
+
+pub const _MC_FPFMT_NODEV: c_long = 0x10000;
+pub const _MC_FPFMT_XMM: c_long = 0x10002;
+pub const _MC_FPOWNED_NONE: c_long = 0x20000;
+pub const _MC_FPOWNED_FPU: c_long = 0x20001;
+pub const _MC_FPOWNED_PCB: c_long = 0x20002;
cfg_if! {
if #[cfg(libc_align)] {
diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs
index 1b7804cb..a40bb3dc 100644
--- a/src/unix/bsd/freebsdlike/mod.rs
+++ b/src/unix/bsd/freebsdlike/mod.rs
@@ -14,6 +14,40 @@ pub type nl_item = ::c_int;
pub type id_t = i64;
pub type vm_size_t = ::uintptr_t;
+// elf.h
+
+pub type Elf32_Addr = u32;
+pub type Elf32_Half = u16;
+pub type Elf32_Lword = u64;
+pub type Elf32_Off = u32;
+pub type Elf32_Sword = i32;
+pub type Elf32_Word = u32;
+
+pub type Elf64_Addr = u64;
+pub type Elf64_Half = u16;
+pub type Elf64_Lword = u64;
+pub type Elf64_Off = u64;
+pub type Elf64_Sword = i32;
+pub type Elf64_Sxword = i64;
+pub type Elf64_Word = u32;
+pub type Elf64_Xword = u64;
+
+pub type iconv_t = *mut ::c_void;
+
+cfg_if! {
+ if #[cfg(target_pointer_width = "64")] {
+ type Elf_Addr = Elf64_Addr;
+ type Elf_Half = Elf64_Half;
+ type Elf_Phdr = Elf64_Phdr;
+ } else if #[cfg(target_pointer_width = "32")] {
+ type Elf_Addr = Elf32_Addr;
+ type Elf_Half = Elf32_Half;
+ type Elf_Phdr = Elf32_Phdr;
+ }
+}
+
+// link.h
+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::Copy for timezone {}
@@ -31,6 +65,18 @@ impl siginfo_t {
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
+ }
}
s! {
@@ -190,6 +236,114 @@ s! {
pub ar_pln: u8,
pub ar_op: u16,
}
+
+ pub struct timex {
+ pub modes: ::c_uint,
+ pub offset: ::c_long,
+ pub freq: ::c_long,
+ pub maxerror: ::c_long,
+ pub esterror: ::c_long,
+ pub status: ::c_int,
+ pub constant: ::c_long,
+ pub precision: ::c_long,
+ pub tolerance: ::c_long,
+ pub ppsfreq: ::c_long,
+ pub jitter: ::c_long,
+ pub shift: ::c_int,
+ pub stabil: ::c_long,
+ pub jitcnt: ::c_long,
+ pub calcnt: ::c_long,
+ pub errcnt: ::c_long,
+ pub stbcnt: ::c_long,
+ }
+
+ pub struct ntptimeval {
+ pub time: ::timespec,
+ pub maxerror: ::c_long,
+ pub esterror: ::c_long,
+ pub tai: ::c_long,
+ pub time_state: ::c_int,
+ }
+
+ pub struct ptrace_io_desc {
+ pub piod_op: ::c_int,
+ pub piod_offs: *mut ::c_void,
+ pub piod_addr: *mut ::c_void,
+ pub piod_len: ::size_t,
+ }
+
+ // bpf.h
+
+ pub struct bpf_program {
+ pub bf_len: ::c_uint,
+ pub bf_insns: *mut bpf_insn,
+ }
+
+ pub struct bpf_stat {
+ pub bs_recv: ::c_uint,
+ pub bs_drop: ::c_uint,
+ }
+
+ pub struct bpf_version {
+ pub bv_major: ::c_ushort,
+ pub bv_minor: ::c_ushort,
+ }
+
+ pub struct bpf_hdr {
+ pub bh_tstamp: ::timeval,
+ pub bh_caplen: u32,
+ pub bh_datalen: u32,
+ pub bh_hdrlen: ::c_ushort,
+ }
+
+ pub struct bpf_insn {
+ pub code: ::c_ushort,
+ pub jt: ::c_uchar,
+ pub jf: ::c_uchar,
+ pub k: u32,
+ }
+
+ pub struct bpf_dltlist {
+ bfl_len: ::c_uint,
+ bfl_list: *mut ::c_uint,
+ }
+
+ // elf.h
+
+ 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,
+ }
+
+ 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,
+ }
+
+ // link.h
+
+ 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: usize,
+ pub dlpi_tls_data: *mut ::c_void,
+ }
}
s_no_extra_traits! {
@@ -241,6 +395,17 @@ cfg_if! {
}
}
+// Non-public helper constant
+cfg_if! {
+ if #[cfg(all(not(libc_const_size_of), target_pointer_width = "32"))] {
+ const SIZEOF_LONG: usize = 4;
+ } else if #[cfg(all(not(libc_const_size_of), target_pointer_width = "64"))] {
+ const SIZEOF_LONG: usize = 8;
+ } else if #[cfg(libc_const_size_of)] {
+ const SIZEOF_LONG: usize = ::mem::size_of::<::c_long>();
+ }
+}
+
#[deprecated(
since = "0.2.64",
note = "Can vary at runtime. Use sysconf(3) instead"
@@ -595,6 +760,21 @@ pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
pub const RUSAGE_SELF: ::c_int = 0;
pub const RUSAGE_CHILDREN: ::c_int = -1;
+pub const CLOCK_REALTIME: ::clockid_t = 0;
+pub const CLOCK_VIRTUAL: ::clockid_t = 1;
+pub const CLOCK_PROF: ::clockid_t = 2;
+pub const CLOCK_MONOTONIC: ::clockid_t = 4;
+pub const CLOCK_UPTIME: ::clockid_t = 5;
+pub const CLOCK_UPTIME_PRECISE: ::clockid_t = 7;
+pub const CLOCK_UPTIME_FAST: ::clockid_t = 8;
+pub const CLOCK_REALTIME_PRECISE: ::clockid_t = 9;
+pub const CLOCK_REALTIME_FAST: ::clockid_t = 10;
+pub const CLOCK_MONOTONIC_PRECISE: ::clockid_t = 11;
+pub const CLOCK_MONOTONIC_FAST: ::clockid_t = 12;
+pub const CLOCK_SECOND: ::clockid_t = 13;
+pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 14;
+pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 15;
+
pub const MADV_NORMAL: ::c_int = 0;
pub const MADV_RANDOM: ::c_int = 1;
pub const MADV_SEQUENTIAL: ::c_int = 2;
@@ -685,6 +865,11 @@ pub const PF_NATM: ::c_int = AF_NATM;
pub const PF_ATM: ::c_int = AF_ATM;
pub const PF_NETGRAPH: ::c_int = AF_NETGRAPH;
+pub const PIOD_READ_D: ::c_int = 1;
+pub const PIOD_WRITE_D: ::c_int = 2;
+pub const PIOD_READ_I: ::c_int = 3;
+pub const PIOD_WRITE_I: ::c_int = 4;
+
pub const PT_TRACE_ME: ::c_int = 0;
pub const PT_READ_I: ::c_int = 1;
pub const PT_READ_D: ::c_int = 2;
@@ -710,6 +895,7 @@ pub const MSG_DONTWAIT: ::c_int = 0x00000080;
pub const MSG_EOF: ::c_int = 0x00000100;
pub const SCM_TIMESTAMP: ::c_int = 0x02;
+pub const SCM_CREDS: ::c_int = 0x03;
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
@@ -728,8 +914,10 @@ pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
pub const IP_RECVIF: ::c_int = 20;
pub const IPV6_JOIN_GROUP: ::c_int = 12;
pub const IPV6_LEAVE_GROUP: ::c_int = 13;
+pub const IPV6_CHECKSUM: ::c_int = 26;
pub const IPV6_RECVPKTINFO: ::c_int = 36;
pub const IPV6_PKTINFO: ::c_int = 46;
+pub const IPV6_HOPLIMIT: ::c_int = 47;
pub const IPV6_RECVTCLASS: ::c_int = 57;
pub const IPV6_TCLASS: ::c_int = 61;
@@ -762,6 +950,8 @@ pub const SO_RCVTIMEO: ::c_int = 0x1006;
pub const SO_ERROR: ::c_int = 0x1007;
pub const SO_TYPE: ::c_int = 0x1008;
+pub const LOCAL_PEERCRED: ::c_int = 1;
+
pub const SHUT_RD: ::c_int = 0;
pub const SHUT_WR: ::c_int = 1;
pub const SHUT_RDWR: ::c_int = 2;
@@ -948,6 +1138,9 @@ pub const ST_NOSUID: ::c_ulong = 2;
pub const NI_MAXHOST: ::size_t = 1025;
+pub const XU_NGROUPS: ::c_int = 16;
+pub const XUCRED_VERSION: ::c_uint = 0;
+
pub const RTLD_LOCAL: ::c_int = 0;
pub const RTLD_NODELETE: ::c_int = 0x1000;
pub const RTLD_NOLOAD: ::c_int = 0x2000;
@@ -1014,8 +1207,6 @@ pub const TIOCSPGRP: ::c_ulong = 0x80047476;
pub const TIOCGPGRP: ::c_uint = 0x40047477;
pub const TIOCCDTR: ::c_uint = 0x20007478;
pub const TIOCSDTR: ::c_uint = 0x20007479;
-pub const TIOCCBRK: ::c_uint = 0x2000747a;
-pub const TIOCSBRK: ::c_uint = 0x2000747b;
pub const TTYDISC: ::c_int = 0x0;
pub const SLIPDISC: ::c_int = 0x4;
pub const PPPDISC: ::c_int = 0x5;
@@ -1077,8 +1268,7 @@ pub const ONLRET: ::tcflag_t = 0x40;
pub const CMGROUP_MAX: usize = 16;
// https://github.com/freebsd/freebsd/blob/master/sys/net/bpf.h
-// sizeof(long)
-pub const BPF_ALIGNMENT: ::c_int = 8;
+pub const BPF_ALIGNMENT: usize = SIZEOF_LONG;
// Values for rtprio struct (prio field) and syscall (function argument)
pub const RTP_PRIO_MIN: ::c_ushort = 0;
@@ -1101,31 +1291,78 @@ pub const SF_NOUNLINK: ::c_ulong = 0x00100000;
pub const TIMER_ABSTIME: ::c_int = 1;
-f! {
- pub fn WIFCONTINUED(status: ::c_int) -> bool {
+//<sys/timex.h>
+pub const NTP_API: ::c_int = 4;
+pub const MAXPHASE: ::c_long = 500000000;
+pub const MAXFREQ: ::c_long = 500000;
+pub const MINSEC: ::c_int = 256;
+pub const MAXSEC: ::c_int = 2048;
+pub const NANOSECOND: ::c_long = 1000000000;
+pub const SCALE_PPM: ::c_int = 65;
+pub const MAXTC: ::c_int = 10;
+pub const MOD_OFFSET: ::c_uint = 0x0001;
+pub const MOD_FREQUENCY: ::c_uint = 0x0002;
+pub const MOD_MAXERROR: ::c_uint = 0x0004;
+pub const MOD_ESTERROR: ::c_uint = 0x0008;
+pub const MOD_STATUS: ::c_uint = 0x0010;
+pub const MOD_TIMECONST: ::c_uint = 0x0020;
+pub const MOD_PPSMAX: ::c_uint = 0x0040;
+pub const MOD_TAI: ::c_uint = 0x0080;
+pub const MOD_MICRO: ::c_uint = 0x1000;
+pub const MOD_NANO: ::c_uint = 0x2000;
+pub const MOD_CLKB: ::c_uint = 0x4000;
+pub const MOD_CLKA: ::c_uint = 0x8000;
+pub const STA_PLL: ::c_int = 0x0001;
+pub const STA_PPSFREQ: ::c_int = 0x0002;
+pub const STA_PPSTIME: ::c_int = 0x0004;
+pub const STA_FLL: ::c_int = 0x0008;
+pub const STA_INS: ::c_int = 0x0010;
+pub const STA_DEL: ::c_int = 0x0020;
+pub const STA_UNSYNC: ::c_int = 0x0040;
+pub const STA_FREQHOLD: ::c_int = 0x0080;
+pub const STA_PPSSIGNAL: ::c_int = 0x0100;
+pub const STA_PPSJITTER: ::c_int = 0x0200;
+pub const STA_PPSWANDER: ::c_int = 0x0400;
+pub const STA_PPSERROR: ::c_int = 0x0800;
+pub const STA_CLOCKERR: ::c_int = 0x1000;
+pub const STA_NANO: ::c_int = 0x2000;
+pub const STA_MODE: ::c_int = 0x4000;
+pub const STA_CLK: ::c_int = 0x8000;
+pub const STA_RONLY: ::c_int = STA_PPSSIGNAL
+ | STA_PPSJITTER
+ | STA_PPSWANDER
+ | STA_PPSERROR
+ | STA_CLOCKERR
+ | STA_NANO
+ | STA_MODE
+ | STA_CLK;
+pub const TIME_OK: ::c_int = 0;
+pub const TIME_INS: ::c_int = 1;
+pub const TIME_DEL: ::c_int = 2;
+pub const TIME_OOP: ::c_int = 3;
+pub const TIME_WAIT: ::c_int = 4;
+pub const TIME_ERROR: ::c_int = 5;
+
+pub const REG_ENOSYS: ::c_int = -1;
+pub const REG_ILLSEQ: ::c_int = 17;
+
+safe_f! {
+ pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
status == 0x13
}
- pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
+ pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
status >> 8
}
- pub fn WIFSIGNALED(status: ::c_int) -> bool {
- (status & 0o177) != 0o177 && (status & 0o177) != 0
- }
-
- pub fn WIFSTOPPED(status: ::c_int) -> bool {
+ pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
(status & 0o177) == 0o177
}
}
extern "C" {
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 sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int;
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
@@ -1135,17 +1372,6 @@ extern "C" {
addrlen: *mut ::socklen_t,
flags: ::c_int,
) -> ::c_int;
- pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
- pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
- pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
- pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
- pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
- pub fn aio_suspend(
- aiocb_list: *const *const aiocb,
- nitems: ::c_int,
- timeout: *const ::timespec,
- ) -> ::c_int;
- pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
pub fn chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
pub fn chflagsat(
fd: ::c_int,
@@ -1153,6 +1379,12 @@ extern "C" {
flags: ::c_ulong,
atflag: ::c_int,
) -> ::c_int;
+
+ pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
+ pub fn clock_getcpuclockid(pid: ::pid_t, clk_id: *mut ::clockid_t) -> ::c_int;
+
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
pub fn duplocale(base: ::locale_t) -> ::locale_t;
pub fn endutxent();
@@ -1165,7 +1397,6 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut ::group,
) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")]
pub fn getpwent_r(
pwd: *mut ::passwd,
buf: *mut ::c_char,
@@ -1205,23 +1436,9 @@ extern "C" {
timeout: *const ::timespec,
) -> ::c_int;
pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
- pub fn lio_listio(
- mode: ::c_int,
- aiocb_list: *const *mut aiocb,
- nitems: ::c_int,
- sevp: *mut sigevent,
- ) -> ::c_int;
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
- pub fn memrchr(
- cx: *const ::c_void,
- c: ::c_int,
- n: ::size_t,
- ) -> *mut ::c_void;
- pub fn mkfifoat(
- dirfd: ::c_int,
- pathname: *const ::c_char,
- mode: ::mode_t,
- ) -> ::c_int;
+ pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
+ pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int;
#[cfg_attr(
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "mknodat@FBSD_1.1"
@@ -1232,55 +1449,9 @@ extern "C" {
mode: ::mode_t,
dev: dev_t,
) -> ::c_int;
- pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
- pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
- pub fn mq_notify(mqd: ::mqd_t, notification: *const ::sigevent)
- -> ::c_int;
- pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
- pub fn mq_receive(
- mqd: ::mqd_t,
- msg_ptr: *mut ::c_char,
- msg_len: ::size_t,
- msg_prio: *mut ::c_uint,
- ) -> ::ssize_t;
- pub fn mq_send(
- mqd: ::mqd_t,
- msg_ptr: *const ::c_char,
- msg_len: ::size_t,
- msg_prio: ::c_uint,
- ) -> ::c_int;
- pub fn mq_setattr(
- mqd: ::mqd_t,
- newattr: *const ::mq_attr,
- oldattr: *mut ::mq_attr,
- ) -> ::c_int;
- pub fn mq_timedreceive(
- mqd: ::mqd_t,
- msg_ptr: *mut ::c_char,
- msg_len: ::size_t,
- msg_prio: *mut ::c_uint,
- abs_timeout: *const ::timespec,
- ) -> ::ssize_t;
- pub fn mq_timedsend(
- mqd: ::mqd_t,
- msg_ptr: *const ::c_char,
- msg_len: ::size_t,
- msg_prio: ::c_uint,
- abs_timeout: *const ::timespec,
- ) -> ::c_int;
- pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
- pub fn mincore(
- addr: *const ::c_void,
- len: ::size_t,
- vec: *mut ::c_char,
- ) -> ::c_int;
- pub fn newlocale(
- mask: ::c_int,
- locale: *const ::c_char,
- base: ::locale_t,
- ) -> ::locale_t;
- pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t)
- -> *mut ::c_char;
+ pub fn mincore(addr: *const ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int;
+ pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t;
+ pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
pub fn ppoll(
fds: *mut ::pollfd,
@@ -1288,16 +1459,8 @@ extern "C" {
timeout: *const ::timespec,
sigmask: *const sigset_t,
) -> ::c_int;
- pub fn preadv(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t,
- ) -> ::ssize_t;
- pub fn pthread_attr_get_np(
- tid: ::pthread_t,
- attr: *mut ::pthread_attr_t,
- ) -> ::c_int;
+ pub fn preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t;
+ pub fn pthread_attr_get_np(tid: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int;
pub fn pthread_attr_getguardsize(
attr: *const ::pthread_attr_t,
guardsize: *mut ::size_t,
@@ -1319,10 +1482,7 @@ extern "C" {
attr: *mut pthread_condattr_t,
clock_id: ::clockid_t,
) -> ::c_int;
- pub fn pthread_condattr_setpshared(
- attr: *mut pthread_condattr_t,
- pshared: ::c_int,
- ) -> ::c_int;
+ pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: ::c_int) -> ::c_int;
pub fn pthread_main_np() -> ::c_int;
pub fn pthread_mutex_timedlock(
lock: *mut pthread_mutex_t,
@@ -1340,30 +1500,14 @@ extern "C" {
attr: *const pthread_rwlockattr_t,
val: *mut ::c_int,
) -> ::c_int;
- pub fn pthread_rwlockattr_setpshared(
- attr: *mut pthread_rwlockattr_t,
- val: ::c_int,
- ) -> ::c_int;
+ pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: ::c_int) -> ::c_int;
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
- pub fn ptrace(
- request: ::c_int,
- pid: ::pid_t,
- addr: *mut ::c_char,
- data: ::c_int,
- ) -> ::c_int;
+ pub fn ptrace(request: ::c_int, pid: ::pid_t, addr: *mut ::c_char, data: ::c_int) -> ::c_int;
pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
- pub fn pwritev(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t,
- ) -> ::ssize_t;
+ pub fn pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t)
+ -> ::ssize_t;
pub fn querylocale(mask: ::c_int, loc: ::locale_t) -> *const ::c_char;
- pub fn rtprio(
- function: ::c_int,
- pid: ::pid_t,
- rtp: *mut rtprio,
- ) -> ::c_int;
+ pub fn rtprio(function: ::c_int, pid: ::pid_t, rtp: *mut rtprio) -> ::c_int;
pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
pub fn sched_setscheduler(
pid: ::pid_t,
@@ -1371,10 +1515,7 @@ extern "C" {
param: *const ::sched_param,
) -> ::c_int;
pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int;
- pub fn sem_timedwait(
- sem: *mut sem_t,
- abstime: *const ::timespec,
- ) -> ::c_int;
+ pub fn sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int;
pub fn sendfile(
fd: ::c_int,
s: ::c_int,
@@ -1386,20 +1527,12 @@ extern "C" {
) -> ::c_int;
pub fn setdomainname(name: *const ::c_char, len: ::c_int) -> ::c_int;
pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int;
- pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int)
- -> ::c_int;
+ pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int;
pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
- pub fn settimeofday(
- tv: *const ::timeval,
- tz: *const ::timezone,
- ) -> ::c_int;
+ pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
pub fn setutxent();
- pub fn shm_open(
- name: *const ::c_char,
- oflag: ::c_int,
- mode: ::mode_t,
- ) -> ::c_int;
+ pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) -> ::c_int;
pub fn sigtimedwait(
set: *const sigset_t,
info: *mut siginfo_t,
@@ -1433,6 +1566,67 @@ extern "C" {
times: *const ::timespec,
flag: ::c_int,
) -> ::c_int;
+
+ pub fn ntp_adjtime(buf: *mut timex) -> ::c_int;
+ pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int;
+
+ // #include <link.h>
+ pub fn dl_iterate_phdr(
+ callback: ::Option<
+ unsafe extern "C" fn(
+ info: *mut dl_phdr_info,
+ size: usize,
+ data: *mut ::c_void,
+ ) -> ::c_int,
+ >,
+ data: *mut ::c_void,
+ ) -> ::c_int;
+
+ pub fn iconv_open(tocode: *const ::c_char, fromcode: *const ::c_char) -> iconv_t;
+ pub fn iconv(
+ cd: iconv_t,
+ inbuf: *mut *mut ::c_char,
+ inbytesleft: *mut ::size_t,
+ outbuf: *mut *mut ::c_char,
+ outbytesleft: *mut ::size_t,
+ ) -> ::size_t;
+ pub fn iconv_close(cd: iconv_t) -> ::c_int;
+}
+
+#[link(name = "rt")]
+extern "C" {
+ pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
+ pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
+ pub fn mq_notify(mqd: ::mqd_t, notification: *const ::sigevent) -> ::c_int;
+ pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
+ pub fn mq_receive(
+ mqd: ::mqd_t,
+ msg_ptr: *mut ::c_char,
+ msg_len: ::size_t,
+ msg_prio: *mut ::c_uint,
+ ) -> ::ssize_t;
+ pub fn mq_send(
+ mqd: ::mqd_t,
+ msg_ptr: *const ::c_char,
+ msg_len: ::size_t,
+ msg_prio: ::c_uint,
+ ) -> ::c_int;
+ pub fn mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int;
+ pub fn mq_timedreceive(
+ mqd: ::mqd_t,
+ msg_ptr: *mut ::c_char,
+ msg_len: ::size_t,
+ msg_prio: *mut ::c_uint,
+ abs_timeout: *const ::timespec,
+ ) -> ::ssize_t;
+ pub fn mq_timedsend(
+ mqd: ::mqd_t,
+ msg_ptr: *const ::c_char,
+ msg_len: ::size_t,
+ msg_prio: ::c_uint,
+ abs_timeout: *const ::timespec,
+ ) -> ::c_int;
+ pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
}
#[link(name = "util")]
diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs
index cf9f59e9..f86a0080 100644
--- a/src/unix/bsd/mod.rs
+++ b/src/unix/bsd/mod.rs
@@ -1,4 +1,3 @@
-pub type wchar_t = i32;
pub type off_t = i64;
pub type useconds_t = u32;
pub type blkcnt_t = i64;
@@ -6,6 +5,7 @@ pub type socklen_t = u32;
pub type sa_family_t = u8;
pub type pthread_t = ::uintptr_t;
pub type nfds_t = ::c_uint;
+pub type regoff_t = off_t;
s! {
pub struct sockaddr {
@@ -101,6 +101,18 @@ s! {
pub if_index: ::c_uint,
pub if_name: *mut ::c_char,
}
+
+ pub struct regex_t {
+ __re_magic: ::c_int,
+ __re_nsub: ::size_t,
+ __re_endp: *const ::c_char,
+ __re_g: *mut ::c_void,
+ }
+
+ pub struct regmatch_t {
+ pub rm_so: regoff_t,
+ pub rm_eo: regoff_t,
+ }
}
s_no_extra_traits! {
@@ -242,6 +254,8 @@ pub const FIOGETOWN: ::c_ulong = 0x4004667b;
pub const PATH_MAX: ::c_int = 1024;
+pub const IOV_MAX: ::c_int = 1024;
+
pub const SA_ONSTACK: ::c_int = 0x0001;
pub const SA_SIGINFO: ::c_int = 0x0040;
pub const SA_RESTART: ::c_int = 0x0002;
@@ -425,6 +439,13 @@ pub const TCP_MAXSEG: ::c_int = 2;
pub const PIPE_BUF: usize = 512;
+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 POLLIN: ::c_short = 0x1;
pub const POLLPRI: ::c_short = 0x2;
pub const POLLOUT: ::c_short = 0x4;
@@ -450,6 +471,52 @@ pub const BIOCGHDRCMPLT: ::c_ulong = 0x40044274;
pub const BIOCSHDRCMPLT: ::c_ulong = 0x80044275;
pub const SIOCGIFADDR: ::c_ulong = 0xc0206921;
+pub const REG_BASIC: ::c_int = 0o0000;
+pub const REG_EXTENDED: ::c_int = 0o0001;
+pub const REG_ICASE: ::c_int = 0o0002;
+pub const REG_NOSUB: ::c_int = 0o0004;
+pub const REG_NEWLINE: ::c_int = 0o0010;
+pub const REG_NOSPEC: ::c_int = 0o0020;
+pub const REG_PEND: ::c_int = 0o0040;
+pub const REG_DUMP: ::c_int = 0o0200;
+
+pub const REG_NOMATCH: ::c_int = 1;
+pub const REG_BADPAT: ::c_int = 2;
+pub const REG_ECOLLATE: ::c_int = 3;
+pub const REG_ECTYPE: ::c_int = 4;
+pub const REG_EESCAPE: ::c_int = 5;
+pub const REG_ESUBREG: ::c_int = 6;
+pub const REG_EBRACK: ::c_int = 7;
+pub const REG_EPAREN: ::c_int = 8;
+pub const REG_EBRACE: ::c_int = 9;
+pub const REG_BADBR: ::c_int = 10;
+pub const REG_ERANGE: ::c_int = 11;
+pub const REG_ESPACE: ::c_int = 12;
+pub const REG_BADRPT: ::c_int = 13;
+pub const REG_EMPTY: ::c_int = 14;
+pub const REG_ASSERT: ::c_int = 15;
+pub const REG_INVARG: ::c_int = 16;
+pub const REG_ATOI: ::c_int = 255;
+pub const REG_ITOA: ::c_int = 0o0400;
+
+pub const REG_NOTBOL: ::c_int = 0o00001;
+pub const REG_NOTEOL: ::c_int = 0o00002;
+pub const REG_STARTEND: ::c_int = 0o00004;
+pub const REG_TRACE: ::c_int = 0o00400;
+pub const REG_LARGE: ::c_int = 0o01000;
+pub const REG_BACKR: ::c_int = 0o02000;
+
+pub const TIOCCBRK: ::c_uint = 0x2000747a;
+pub const TIOCSBRK: ::c_uint = 0x2000747b;
+
+pub const PRIO_PROCESS: ::c_int = 0;
+pub const PRIO_PGRP: ::c_int = 1;
+pub const PRIO_USER: ::c_int = 2;
+
+pub const ITIMER_REAL: ::c_int = 0;
+pub const ITIMER_VIRTUAL: ::c_int = 1;
+pub const ITIMER_PROF: ::c_int = 2;
+
f! {
pub fn CMSG_FIRSTHDR(mhdr: *const ::msghdr) -> *mut ::cmsghdr {
if (*mhdr).msg_controllen as usize >= ::mem::size_of::<::cmsghdr>() {
@@ -484,24 +551,26 @@ f! {
*slot = 0;
}
}
+}
- pub fn WTERMSIG(status: ::c_int) -> ::c_int {
+safe_f! {
+ pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
status & 0o177
}
- pub fn WIFEXITED(status: ::c_int) -> bool {
+ pub {const} fn WIFEXITED(status: ::c_int) -> bool {
(status & 0o177) == 0
}
- pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
+ pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int {
status >> 8
}
- pub fn WCOREDUMP(status: ::c_int) -> bool {
+ pub {const} fn WCOREDUMP(status: ::c_int) -> bool {
(status & 0o200) != 0
}
- pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
+ pub {const} fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
(cmd << 8) | (type_ & 0x00ff)
}
}
@@ -518,15 +587,19 @@ extern "C" {
)]
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 strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
pub fn abs(i: ::c_int) -> ::c_int;
pub fn atof(s: *const ::c_char) -> ::c_double;
pub fn labs(i: ::c_long) -> ::c_long;
+ #[cfg_attr(
+ all(target_os = "freebsd", any(freebsd12, freebsd11, freebsd10)),
+ link_name = "rand@FBSD_1.0"
+ )]
pub fn rand() -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "freebsd", any(freebsd12, freebsd11, freebsd10)),
+ link_name = "srand@FBSD_1.0"
+ )]
pub fn srand(seed: ::c_uint);
pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
@@ -549,13 +622,12 @@ extern "C" {
pub fn if_nameindex() -> *mut if_nameindex;
pub fn if_freenameindex(ptr: *mut if_nameindex);
- pub fn getpeereid(
- socket: ::c_int,
- euid: *mut ::uid_t,
- egid: *mut ::gid_t,
- ) -> ::c_int;
+ pub fn getpeereid(socket: ::c_int, euid: *mut ::uid_t, egid: *mut ::gid_t) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "glob$INODE64")]
+ #[cfg_attr(
+ all(target_os = "macos", not(target_arch = "aarch64")),
+ link_name = "glob$INODE64"
+ )]
#[cfg_attr(target_os = "netbsd", link_name = "__glob30")]
#[cfg_attr(
all(target_os = "freebsd", any(freebsd11, freebsd10)),
@@ -564,9 +636,7 @@ extern "C" {
pub fn glob(
pattern: *const ::c_char,
flags: ::c_int,
- errfunc: ::Option<
- extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int,
- >,
+ errfunc: ::Option<extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>,
pglob: *mut ::glob_t,
) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__globfree30")]
@@ -576,11 +646,7 @@ extern "C" {
)]
pub fn globfree(pglob: *mut ::glob_t);
- pub fn posix_madvise(
- addr: *mut ::c_void,
- len: ::size_t,
- advice: ::c_int,
- ) -> ::c_int;
+ pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
@@ -603,22 +669,14 @@ extern "C" {
link_name = "telldir$INODE64$UNIX2003"
)]
pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
- pub fn madvise(
- addr: *mut ::c_void,
- len: ::size_t,
- advice: ::c_int,
- ) -> ::c_int;
+ pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "msync$UNIX2003"
)]
#[cfg_attr(target_os = "netbsd", link_name = "__msync13")]
- pub fn msync(
- addr: *mut ::c_void,
- len: ::size_t,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
@@ -641,52 +699,31 @@ extern "C" {
all(target_os = "macos", target_arch = "x86"),
link_name = "bind$UNIX2003"
)]
- pub fn bind(
- socket: ::c_int,
- address: *const ::sockaddr,
- address_len: ::socklen_t,
- ) -> ::c_int;
+ pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "writev$UNIX2003"
)]
- pub fn writev(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- ) -> ::ssize_t;
+ pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "readv$UNIX2003"
)]
- pub fn readv(
- 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;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "sendmsg$UNIX2003"
)]
- pub fn sendmsg(
- fd: ::c_int,
- msg: *const ::msghdr,
- flags: ::c_int,
- ) -> ::ssize_t;
+ pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "recvmsg$UNIX2003"
)]
- pub fn recvmsg(
- fd: ::c_int,
- msg: *mut ::msghdr,
- flags: ::c_int,
- ) -> ::ssize_t;
+ pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t;
pub fn sync();
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
pub fn getgrgid_r(
gid: ::gid_t,
grp: *mut ::group,
@@ -702,7 +739,6 @@ extern "C" {
pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
pub fn sem_close(sem: *mut sem_t) -> ::c_int;
pub fn getdtablesize() -> ::c_int;
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
pub fn getgrnam_r(
name: *const ::c_char,
grp: *mut ::group,
@@ -714,11 +750,7 @@ extern "C" {
all(target_os = "macos", target_arch = "x86"),
link_name = "pthread_sigmask$UNIX2003"
)]
- pub fn pthread_sigmask(
- how: ::c_int,
- set: *const sigset_t,
- oldset: *mut sigset_t,
- ) -> ::c_int;
+ pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int;
pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
#[cfg_attr(
@@ -729,7 +761,6 @@ extern "C" {
pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
pub fn getpwnam_r(
name: *const ::c_char,
pwd: *mut passwd,
@@ -738,7 +769,6 @@ extern "C" {
result: *mut *mut passwd,
) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
pub fn getpwuid_r(
uid: ::uid_t,
pwd: *mut passwd,
@@ -750,7 +780,6 @@ extern "C" {
all(target_os = "macos", target_arch = "x86"),
link_name = "sigwait$UNIX2003"
)]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int;
pub fn pthread_atfork(
prepare: ::Option<unsafe extern "C" fn()>,
@@ -776,6 +805,53 @@ extern "C" {
value: *mut ::c_void,
) -> ::c_int;
pub fn acct(filename: *const ::c_char) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "wait4$UNIX2003"
+ )]
+ #[cfg_attr(
+ all(target_os = "freebsd", any(freebsd12, freebsd11, freebsd10)),
+ link_name = "wait4@FBSD_1.0"
+ )]
+ pub fn wait4(
+ pid: ::pid_t,
+ status: *mut ::c_int,
+ options: ::c_int,
+ rusage: *mut ::rusage,
+ ) -> ::pid_t;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "getitimer$UNIX2003"
+ )]
+ pub fn getitimer(which: ::c_int, curr_value: *mut ::itimerval) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "macos", target_arch = "x86"),
+ link_name = "setitimer$UNIX2003"
+ )]
+ pub fn setitimer(
+ which: ::c_int,
+ new_value: *const ::itimerval,
+ old_value: *mut ::itimerval,
+ ) -> ::c_int;
+
+ pub fn regcomp(preg: *mut regex_t, pattern: *const ::c_char, cflags: ::c_int) -> ::c_int;
+
+ pub fn regexec(
+ preg: *const regex_t,
+ input: *const ::c_char,
+ nmatch: ::size_t,
+ pmatch: *mut regmatch_t,
+ eflags: ::c_int,
+ ) -> ::c_int;
+
+ pub fn regerror(
+ errcode: ::c_int,
+ preg: *const regex_t,
+ errbuf: *mut ::c_char,
+ errbuf_size: ::size_t,
+ ) -> ::size_t;
+
+ pub fn regfree(preg: *mut regex_t);
}
cfg_if! {
diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs
index 970cb233..0eab40c0 100644
--- a/src/unix/bsd/netbsdlike/mod.rs
+++ b/src/unix/bsd/netbsdlike/mod.rs
@@ -1,3 +1,4 @@
+pub type wchar_t = i32;
pub type time_t = i64;
pub type mode_t = u32;
pub type nlink_t = u32;
@@ -74,6 +75,13 @@ s! {
pub seq: ::c_ushort,
pub key: ::key_t,
}
+
+ pub struct ptrace_io_desc {
+ pub piod_op: ::c_int,
+ pub piod_offs: *mut ::c_void,
+ pub piod_addr: *mut ::c_void,
+ pub piod_len: ::size_t,
+ }
}
pub const D_T_FMT: ::nl_item = 0;
@@ -342,6 +350,12 @@ pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
+pub const PIOD_READ_D: ::c_int = 1;
+pub const PIOD_WRITE_D: ::c_int = 2;
+pub const PIOD_READ_I: ::c_int = 3;
+pub const PIOD_WRITE_I: ::c_int = 4;
+pub const PIOD_READ_AUXV: ::c_int = 5;
+
pub const PT_TRACE_ME: ::c_int = 0;
pub const PT_READ_I: ::c_int = 1;
pub const PT_READ_D: ::c_int = 2;
@@ -625,56 +639,30 @@ pub const TIMER_ABSTIME: ::c_int = 1;
extern "C" {
pub fn setgrent();
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 sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int;
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
- pub fn mincore(
- addr: *mut ::c_void,
- len: ::size_t,
- vec: *mut ::c_char,
+ pub fn accept4(
+ s: ::c_int,
+ addr: *mut ::sockaddr,
+ addrlen: *mut ::socklen_t,
+ flags: ::c_int,
) -> ::c_int;
+ pub fn mincore(addr: *mut ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__clock_getres50")]
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__clock_gettime50")]
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__clock_settime50")]
- pub fn clock_settime(
- clk_id: ::clockid_t,
- tp: *const ::timespec,
- ) -> ::c_int;
+ pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
pub fn __errno() -> *mut ::c_int;
- pub fn shm_open(
- name: *const ::c_char,
- oflag: ::c_int,
- mode: ::mode_t,
- ) -> ::c_int;
- pub fn memrchr(
- cx: *const ::c_void,
- c: ::c_int,
- n: ::size_t,
- ) -> *mut ::c_void;
+ pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) -> ::c_int;
+ pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
- pub fn mkostemps(
- template: *mut ::c_char,
- suffixlen: ::c_int,
- flags: ::c_int,
- ) -> ::c_int;
- pub fn pwritev(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t,
- ) -> ::ssize_t;
- pub fn preadv(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t,
- ) -> ::ssize_t;
+ pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int;
+ pub fn pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t)
+ -> ::ssize_t;
+ pub fn preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t;
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
pub fn utimensat(
dirfd: ::c_int,
@@ -706,15 +694,8 @@ extern "C" {
mode: ::mode_t,
dev: dev_t,
) -> ::c_int;
- pub fn mkfifoat(
- dirfd: ::c_int,
- pathname: *const ::c_char,
- mode: ::mode_t,
- ) -> ::c_int;
- pub fn sem_timedwait(
- sem: *mut sem_t,
- abstime: *const ::timespec,
- ) -> ::c_int;
+ pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int;
+ pub fn sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int;
pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int;
pub fn pthread_condattr_setclock(
attr: *mut pthread_condattr_t,
@@ -739,17 +720,9 @@ extern "C" {
pub fn uname(buf: *mut ::utsname) -> ::c_int;
pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
- pub fn shmat(
- shmid: ::c_int,
- shmaddr: *const ::c_void,
- shmflg: ::c_int,
- ) -> *mut ::c_void;
+ 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 shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
}
cfg_if! {
diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
index 422539af..ad7381b2 100644
--- a/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -11,6 +11,38 @@ pub type vm_size_t = ::uintptr_t;
pub type lwpid_t = ::c_uint;
pub type shmatt_t = ::c_uint;
+// elf.h
+
+pub type Elf32_Addr = u32;
+pub type Elf32_Half = u16;
+pub type Elf32_Lword = u64;
+pub type Elf32_Off = u32;
+pub type Elf32_Sword = i32;
+pub type Elf32_Word = u32;
+
+pub type Elf64_Addr = u64;
+pub type Elf64_Half = u16;
+pub type Elf64_Lword = u64;
+pub type Elf64_Off = u64;
+pub type Elf64_Sword = i32;
+pub type Elf64_Sxword = i64;
+pub type Elf64_Word = u32;
+pub type Elf64_Xword = u64;
+
+pub type iconv_t = *mut ::c_void;
+
+cfg_if! {
+ if #[cfg(target_pointer_width = "64")] {
+ type Elf_Addr = Elf64_Addr;
+ type Elf_Half = Elf64_Half;
+ type Elf_Phdr = Elf64_Phdr;
+ } else if #[cfg(target_pointer_width = "32")] {
+ type Elf_Addr = Elf32_Addr;
+ type Elf_Half = Elf32_Half;
+ type Elf_Phdr = Elf32_Phdr;
+ }
+}
+
impl siginfo_t {
pub unsafe fn si_value(&self) -> ::sigval {
#[repr(C)]
@@ -92,7 +124,7 @@ s! {
pub st_spare: [u32; 2],
}
- pub struct addrinfo {
+ pub struct addrinfo {
pub ai_flags: ::c_int,
pub ai_family: ::c_int,
pub ai_socktype: ::c_int,
@@ -267,6 +299,12 @@ s! {
pub sc_groups: [::gid_t; 1],
}
+ pub struct unpcbid {
+ pub unp_pid: ::pid_t,
+ pub unp_euid: ::uid_t,
+ pub unp_egid: ::gid_t,
+ }
+
pub struct sockaddr_dl {
pub sdl_len: ::c_uchar,
pub sdl_family: ::c_uchar,
@@ -286,7 +324,7 @@ s! {
pub struct __exit_status {
pub e_termination: u16,
pub e_exit: u16,
- }
+ }
pub struct shmid_ds {
pub shm_perm: ::ipc_perm,
@@ -312,6 +350,71 @@ s! {
pub ll_host: [::c_char; UT_HOSTSIZE],
pub ll_time: ::time_t
}
+
+ pub struct timex {
+ pub modes: ::c_uint,
+ pub offset: ::c_long,
+ pub freq: ::c_long,
+ pub maxerror: ::c_long,
+ pub esterror: ::c_long,
+ pub status: ::c_int,
+ pub constant: ::c_long,
+ pub precision: ::c_long,
+ pub tolerance: ::c_long,
+ pub ppsfreq: ::c_long,
+ pub jitter: ::c_long,
+ pub shift: ::c_int,
+ pub stabil: ::c_long,
+ pub jitcnt: ::c_long,
+ pub calcnt: ::c_long,
+ pub errcnt: ::c_long,
+ pub stbcnt: ::c_long,
+ }
+
+ pub struct ntptimeval {
+ pub time: ::timespec,
+ pub maxerror: ::c_long,
+ pub esterror: ::c_long,
+ pub tai: ::c_long,
+ pub time_state: ::c_int,
+ }
+
+ // elf.h
+
+ 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,
+ }
+
+ 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,
+ }
+
+ // link.h
+
+ 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: usize,
+ pub dlpi_tls_data: *mut ::c_void,
+ }
}
s_no_extra_traits! {
@@ -342,7 +445,6 @@ s_no_extra_traits! {
pub ipi_ifindex: ::c_uint,
}
- #[repr(packed)]
pub struct arphdr {
pub ar_hrd: u16,
pub ar_pro: u16,
@@ -351,7 +453,6 @@ s_no_extra_traits! {
pub ar_op: u16,
}
- #[repr(packed)]
pub struct in_addr {
pub s_addr: ::in_addr_t,
}
@@ -865,12 +966,12 @@ pub const AT_REMOVEDIR: ::c_int = 0x800;
pub const EXTATTR_NAMESPACE_USER: ::c_int = 1;
pub const EXTATTR_NAMESPACE_SYSTEM: ::c_int = 2;
-pub const LC_COLLATE_MASK: ::c_int = (1 << ::LC_COLLATE);
-pub const LC_CTYPE_MASK: ::c_int = (1 << ::LC_CTYPE);
-pub const LC_MONETARY_MASK: ::c_int = (1 << ::LC_MONETARY);
-pub const LC_NUMERIC_MASK: ::c_int = (1 << ::LC_NUMERIC);
-pub const LC_TIME_MASK: ::c_int = (1 << ::LC_TIME);
-pub const LC_MESSAGES_MASK: ::c_int = (1 << ::LC_MESSAGES);
+pub const LC_COLLATE_MASK: ::c_int = 1 << ::LC_COLLATE;
+pub const LC_CTYPE_MASK: ::c_int = 1 << ::LC_CTYPE;
+pub const LC_MONETARY_MASK: ::c_int = 1 << ::LC_MONETARY;
+pub const LC_NUMERIC_MASK: ::c_int = 1 << ::LC_NUMERIC;
+pub const LC_TIME_MASK: ::c_int = 1 << ::LC_TIME;
+pub const LC_MESSAGES_MASK: ::c_int = 1 << ::LC_MESSAGES;
pub const LC_ALL_MASK: ::c_int = !0;
pub const ERA: ::nl_item = 52;
@@ -890,6 +991,12 @@ pub const O_RSYNC: ::c_int = 0x00020000;
pub const MS_SYNC: ::c_int = 0x4;
pub const MS_INVALIDATE: ::c_int = 0x2;
+// Here because they are not present on OpenBSD
+// (https://github.com/openbsd/src/blob/master/sys/sys/resource.h)
+pub const RLIMIT_SBSIZE: ::c_int = 9;
+pub const RLIMIT_AS: ::c_int = 10;
+pub const RLIMIT_NTHR: ::c_int = 11;
+
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: ::c_int = 12;
@@ -944,6 +1051,12 @@ pub const SO_TIMESTAMP: ::c_int = 0x2000;
pub const SO_OVERFLOWED: ::c_int = 0x1009;
pub const SO_NOHEADER: ::c_int = 0x100a;
+// http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys/un.h?annotate
+pub const LOCAL_OCREDS: ::c_int = 0x0001; // pass credentials to receiver
+pub const LOCAL_CONNWAIT: ::c_int = 0x0002; // connects block until accepted
+pub const LOCAL_PEEREID: ::c_int = 0x0003; // get peer identification
+pub const LOCAL_CREDS: ::c_int = 0x0004; // pass credentials to receiver
+
// https://github.com/NetBSD/src/blob/trunk/sys/net/if.h#L373
pub const IFF_UP: ::c_int = 0x0001; // interface is up
pub const IFF_BROADCAST: ::c_int = 0x0002; // broadcast address valid
@@ -1233,6 +1346,58 @@ pub const BIOCSDLT: ::c_ulong = 0x80044278;
pub const BIOCGSEESENT: ::c_ulong = 0x40044276;
pub const BIOCSSEESENT: ::c_ulong = 0x80044277;
+//<sys/timex.h>
+pub const NTP_API: ::c_int = 4;
+pub const MAXPHASE: ::c_long = 500000000;
+pub const MAXFREQ: ::c_long = 500000;
+pub const MINSEC: ::c_int = 256;
+pub const MAXSEC: ::c_int = 2048;
+pub const NANOSECOND: ::c_long = 1000000000;
+pub const SCALE_PPM: ::c_int = 65;
+pub const MAXTC: ::c_int = 10;
+pub const MOD_OFFSET: ::c_uint = 0x0001;
+pub const MOD_FREQUENCY: ::c_uint = 0x0002;
+pub const MOD_MAXERROR: ::c_uint = 0x0004;
+pub const MOD_ESTERROR: ::c_uint = 0x0008;
+pub const MOD_STATUS: ::c_uint = 0x0010;
+pub const MOD_TIMECONST: ::c_uint = 0x0020;
+pub const MOD_PPSMAX: ::c_uint = 0x0040;
+pub const MOD_TAI: ::c_uint = 0x0080;
+pub const MOD_MICRO: ::c_uint = 0x1000;
+pub const MOD_NANO: ::c_uint = 0x2000;
+pub const MOD_CLKB: ::c_uint = 0x4000;
+pub const MOD_CLKA: ::c_uint = 0x8000;
+pub const STA_PLL: ::c_int = 0x0001;
+pub const STA_PPSFREQ: ::c_int = 0x0002;
+pub const STA_PPSTIME: ::c_int = 0x0004;
+pub const STA_FLL: ::c_int = 0x0008;
+pub const STA_INS: ::c_int = 0x0010;
+pub const STA_DEL: ::c_int = 0x0020;
+pub const STA_UNSYNC: ::c_int = 0x0040;
+pub const STA_FREQHOLD: ::c_int = 0x0080;
+pub const STA_PPSSIGNAL: ::c_int = 0x0100;
+pub const STA_PPSJITTER: ::c_int = 0x0200;
+pub const STA_PPSWANDER: ::c_int = 0x0400;
+pub const STA_PPSERROR: ::c_int = 0x0800;
+pub const STA_CLOCKERR: ::c_int = 0x1000;
+pub const STA_NANO: ::c_int = 0x2000;
+pub const STA_MODE: ::c_int = 0x4000;
+pub const STA_CLK: ::c_int = 0x8000;
+pub const STA_RONLY: ::c_int = STA_PPSSIGNAL
+ | STA_PPSJITTER
+ | STA_PPSWANDER
+ | STA_PPSERROR
+ | STA_CLOCKERR
+ | STA_NANO
+ | STA_MODE
+ | STA_CLK;
+pub const TIME_OK: ::c_int = 0;
+pub const TIME_INS: ::c_int = 1;
+pub const TIME_DEL: ::c_int = 2;
+pub const TIME_OOP: ::c_int = 3;
+pub const TIME_WAIT: ::c_int = 4;
+pub const TIME_ERROR: ::c_int = 5;
+
cfg_if! {
if #[cfg(any(target_arch = "sparc", target_arch = "sparc64",
target_arch = "x86", target_arch = "x86_64"))] {
@@ -1565,6 +1730,8 @@ pub const FIBMAP: ::c_ulong = 0xc008667a;
pub const SIGSTKSZ: ::size_t = 40960;
+pub const REG_ENOSYS: ::c_int = 17;
+
pub const PT_DUMPCORE: ::c_int = 12;
pub const PT_LWPINFO: ::c_int = 13;
pub const PT_SYSCALL: ::c_int = 14;
@@ -1579,8 +1746,10 @@ pub const SF_SNAPSHOT: ::c_ulong = 0x00200000;
pub const SF_LOG: ::c_ulong = 0x00400000;
pub const SF_SNAPINVAL: ::c_ulong = 0x00800000;
-fn _ALIGN(p: usize) -> usize {
- (p + _ALIGNBYTES) & !_ALIGNBYTES
+const_fn! {
+ {const} fn _ALIGN(p: usize) -> usize {
+ (p + _ALIGNBYTES) & !_ALIGNBYTES
+ }
}
f! {
@@ -1611,23 +1780,11 @@ f! {
}
}
- pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
(_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
as ::c_uint
}
- pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
- status >> 8
- }
-
- pub fn WIFSIGNALED(status: ::c_int) -> bool {
- (status & 0o177) != 0o177 && (status & 0o177) != 0
- }
-
- pub fn WIFSTOPPED(status: ::c_int) -> bool {
- (status & 0o177) == 0o177
- }
-
// dirfd() is a macro on netbsd to access
// the first field of the struct where dirp points to:
// http://cvsweb.netbsd.org/bsdweb.cgi/src/include/dirent.h?rev=1.36
@@ -1635,10 +1792,6 @@ f! {
*(dirp as *const ::c_int)
}
- pub fn WIFCONTINUED(status: ::c_int) -> bool {
- status == 0xffff
- }
-
pub fn SOCKCREDSIZE(ngrps: usize) -> usize {
let ngrps = if ngrps > 0 {
ngrps - 1
@@ -1649,6 +1802,35 @@ f! {
}
}
+safe_f! {
+ pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
+ status >> 8
+ }
+
+ pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
+ (status & 0o177) != 0o177 && (status & 0o177) != 0
+ }
+
+ pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
+ (status & 0o177) == 0o177
+ }
+
+ pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
+ status == 0xffff
+ }
+}
+
+extern "C" {
+ pub fn ntp_adjtime(buf: *mut timex) -> ::c_int;
+ pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int;
+ pub fn clock_nanosleep(
+ clk_id: ::clockid_t,
+ flags: ::c_int,
+ rqtp: *const ::timespec,
+ rmtp: *mut ::timespec,
+ ) -> ::c_int;
+}
+
#[link(name = "rt")]
extern "C" {
pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
@@ -1755,11 +1937,7 @@ extern "C" {
sevlen: ::socklen_t,
flags: ::c_int,
) -> ::c_int;
- pub fn mprotect(
- addr: *mut ::c_void,
- len: ::size_t,
- prot: ::c_int,
- ) -> ::c_int;
+ pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
pub fn sysctl(
name: *const ::c_int,
namelen: ::c_uint,
@@ -1795,8 +1973,7 @@ extern "C" {
pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
- pub fn mq_notify(mqd: ::mqd_t, notification: *const ::sigevent)
- -> ::c_int;
+ pub fn mq_notify(mqd: ::mqd_t, notification: *const ::sigevent) -> ::c_int;
pub fn mq_receive(
mqd: ::mqd_t,
msg_ptr: *mut ::c_char,
@@ -1809,11 +1986,7 @@ extern "C" {
msg_len: ::size_t,
msg_prio: ::c_uint,
) -> ::c_int;
- pub fn mq_setattr(
- mqd: ::mqd_t,
- newattr: *const ::mq_attr,
- oldattr: *mut ::mq_attr,
- ) -> ::c_int;
+ pub fn mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int;
#[link_name = "__mq_timedreceive50"]
pub fn mq_timedreceive(
mqd: ::mqd_t,
@@ -1831,25 +2004,14 @@ extern "C" {
abs_timeout: *const ::timespec,
) -> ::c_int;
pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
- pub fn ptrace(
- request: ::c_int,
- pid: ::pid_t,
- addr: *mut ::c_void,
- data: ::c_int,
- ) -> ::c_int;
+ pub fn ptrace(request: ::c_int, pid: ::pid_t, addr: *mut ::c_void, data: ::c_int) -> ::c_int;
pub fn pthread_setname_np(
t: ::pthread_t,
name: *const ::c_char,
arg: *const ::c_void,
) -> ::c_int;
- pub fn pthread_attr_get_np(
- thread: ::pthread_t,
- attr: *mut ::pthread_attr_t,
- ) -> ::c_int;
- pub fn pthread_getattr_np(
- native: ::pthread_t,
- attr: *mut ::pthread_attr_t,
- ) -> ::c_int;
+ pub fn pthread_attr_get_np(thread: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int;
+ pub fn pthread_getattr_np(native: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int;
pub fn pthread_attr_getguardsize(
attr: *const ::pthread_attr_t,
guardsize: *mut ::size_t,
@@ -1869,11 +2031,7 @@ extern "C" {
pub fn duplocale(base: ::locale_t) -> ::locale_t;
pub fn freelocale(loc: ::locale_t);
pub fn localeconv_l(loc: ::locale_t) -> *mut lconv;
- pub fn newlocale(
- mask: ::c_int,
- locale: *const ::c_char,
- base: ::locale_t,
- ) -> ::locale_t;
+ pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t;
#[link_name = "__settimeofday50"]
pub fn settimeofday(tv: *const ::timeval, tz: *const ::c_void) -> ::c_int;
@@ -1894,6 +2052,35 @@ extern "C" {
) -> ::c_int;
pub fn _lwp_self() -> lwpid_t;
+ pub fn memmem(
+ haystack: *const ::c_void,
+ haystacklen: ::size_t,
+ needle: *const ::c_void,
+ needlelen: ::size_t,
+ ) -> *mut ::c_void;
+
+ // link.h
+
+ pub fn dl_iterate_phdr(
+ callback: ::Option<
+ unsafe extern "C" fn(
+ info: *mut dl_phdr_info,
+ size: usize,
+ data: *mut ::c_void,
+ ) -> ::c_int,
+ >,
+ data: *mut ::c_void,
+ ) -> ::c_int;
+
+ pub fn iconv_open(tocode: *const ::c_char, fromcode: *const ::c_char) -> iconv_t;
+ pub fn iconv(
+ cd: iconv_t,
+ inbuf: *mut *mut ::c_char,
+ inbytesleft: *mut ::size_t,
+ outbuf: *mut *mut ::c_char,
+ outbytesleft: *mut ::size_t,
+ ) -> ::size_t;
+ pub fn iconv_close(cd: iconv_t) -> ::c_int;
}
#[link(name = "util")]
@@ -1913,16 +2100,8 @@ extern "C" {
) -> ::c_int;
pub fn updwtmpx(file: *const ::c_char, ut: *const utmpx) -> ::c_int;
- pub fn getlastlogx(
- fname: *const ::c_char,
- uid: ::uid_t,
- ll: *mut lastlogx,
- ) -> *mut lastlogx;
- pub fn updlastlogx(
- fname: *const ::c_char,
- uid: ::uid_t,
- ll: *mut lastlogx,
- ) -> ::c_int;
+ pub fn getlastlogx(fname: *const ::c_char, uid: ::uid_t, ll: *mut lastlogx) -> *mut lastlogx;
+ pub fn updlastlogx(fname: *const ::c_char, uid: ::uid_t, ll: *mut lastlogx) -> ::c_int;
pub fn utmpxname(file: *const ::c_char) -> ::c_int;
pub fn getutxent() -> *mut utmpx;
pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs
index 89a3354a..c7a25e28 100644
--- a/src/unix/bsd/netbsdlike/openbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs
@@ -16,6 +16,36 @@ pub type pthread_rwlock_t = *mut ::c_void;
pub type pthread_rwlockattr_t = *mut ::c_void;
pub type caddr_t = *mut ::c_char;
+// elf.h
+
+pub type Elf32_Addr = u32;
+pub type Elf32_Half = u16;
+pub type Elf32_Lword = u64;
+pub type Elf32_Off = u32;
+pub type Elf32_Sword = i32;
+pub type Elf32_Word = u32;
+
+pub type Elf64_Addr = u64;
+pub type Elf64_Half = u16;
+pub type Elf64_Lword = u64;
+pub type Elf64_Off = u64;
+pub type Elf64_Sword = i32;
+pub type Elf64_Sxword = i64;
+pub type Elf64_Word = u32;
+pub type Elf64_Xword = u64;
+
+cfg_if! {
+ if #[cfg(target_pointer_width = "64")] {
+ type Elf_Addr = Elf64_Addr;
+ type Elf_Half = Elf64_Half;
+ type Elf_Phdr = Elf64_Phdr;
+ } else if #[cfg(target_pointer_width = "32")] {
+ type Elf_Addr = Elf32_Addr;
+ type Elf_Half = Elf32_Half;
+ type Elf_Phdr = Elf32_Phdr;
+ }
+}
+
s! {
pub struct glob_t {
pub gl_pathc: ::size_t,
@@ -321,6 +351,38 @@ s! {
__shm_ctimensec: c_long,
pub shm_internal: *mut ::c_void,
}
+
+ // elf.h
+ 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,
+ }
+
+ 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,
+ }
+
+ // link.h
+
+ 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,
+ }
}
impl siginfo_t {
@@ -1150,12 +1212,14 @@ pub const KERN_NTHREADS: ::c_int = 26;
pub const KERN_OSVERSION: ::c_int = 27;
pub const KERN_SOMAXCONN: ::c_int = 28;
pub const KERN_SOMINCONN: ::c_int = 29;
+#[deprecated(since = "0.2.71", note = "Removed in OpenBSD 6.0")]
pub const KERN_USERMOUNT: ::c_int = 30;
pub const KERN_NOSUIDCOREDUMP: ::c_int = 32;
pub const KERN_FSYNC: ::c_int = 33;
pub const KERN_SYSVMSG: ::c_int = 34;
pub const KERN_SYSVSEM: ::c_int = 35;
pub const KERN_SYSVSHM: ::c_int = 36;
+#[deprecated(since = "0.2.71", note = "Removed in OpenBSD 6.0")]
pub const KERN_ARND: ::c_int = 37;
pub const KERN_MSGBUFSIZE: ::c_int = 38;
pub const KERN_MALLOCSTATS: ::c_int = 39;
@@ -1315,8 +1379,8 @@ pub const IFF_LINK1: ::c_int = 0x2000; // per link layer defined bit
pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit
pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
-pub const PTHREAD_STACK_MIN: ::size_t = (1_usize << _MAX_PAGE_SHIFT);
-pub const MINSIGSTKSZ: ::size_t = (3_usize << _MAX_PAGE_SHIFT);
+pub const PTHREAD_STACK_MIN: ::size_t = 1_usize << _MAX_PAGE_SHIFT;
+pub const MINSIGSTKSZ: ::size_t = 3_usize << _MAX_PAGE_SHIFT;
pub const SIGSTKSZ: ::size_t = MINSIGSTKSZ + (1_usize << _MAX_PAGE_SHIFT) * 4;
pub const PT_FIRSTMACH: ::c_int = 32;
@@ -1333,16 +1397,14 @@ pub const PTRACE_FORK: ::c_int = 0x0002;
pub const WCONTINUED: ::c_int = 8;
-fn _ALIGN(p: usize) -> usize {
- (p + _ALIGNBYTES) & !_ALIGNBYTES
+const_fn! {
+ {const} fn _ALIGN(p: usize) -> usize {
+ (p + _ALIGNBYTES) & !_ALIGNBYTES
+ }
}
f! {
- pub fn WIFCONTINUED(status: ::c_int) -> bool {
- status & 0o177777 == 0o177777
- }
-
- pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
+ pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
(cmsg as *mut ::c_uchar)
.offset(_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
}
@@ -1369,45 +1431,39 @@ f! {
}
}
- pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
(_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
as ::c_uint
}
+}
- pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
+safe_f! {
+ pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
status >> 8
}
- pub fn WIFSIGNALED(status: ::c_int) -> bool {
+ pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
(status & 0o177) != 0o177 && (status & 0o177) != 0
}
- pub fn WIFSTOPPED(status: ::c_int) -> bool {
- (status & 0o177) == 0o177
+ pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
+ (status & 0xff) == 0o177
+ }
+
+ pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
+ (status & 0o177777) == 0o177777
}
}
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 accept4(
- s: ::c_int,
- addr: *mut ::sockaddr,
- addrlen: *mut ::socklen_t,
- flags: ::c_int,
- ) -> ::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 pledge(promises: *const ::c_char, execpromises: *const ::c_char) -> ::c_int;
pub fn strtonum(
nptr: *const ::c_char,
minval: ::c_longlong,
@@ -1441,11 +1497,7 @@ extern "C" {
nevents: ::c_int,
timeout: *const ::timespec,
) -> ::c_int;
- pub fn mprotect(
- addr: *mut ::c_void,
- len: ::size_t,
- prot: ::c_int,
- ) -> ::c_int;
+ pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
pub fn pthread_attr_getguardsize(
attr: *const ::pthread_attr_t,
guardsize: *mut ::size_t,
@@ -1457,10 +1509,7 @@ extern "C" {
) -> ::c_int;
pub fn pthread_main_np() -> ::c_int;
pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char);
- pub fn pthread_stackseg_np(
- thread: ::pthread_t,
- sinfo: *mut ::stack_t,
- ) -> ::c_int;
+ pub fn pthread_stackseg_np(thread: ::pthread_t, sinfo: *mut ::stack_t) -> ::c_int;
pub fn sysctl(
name: *const ::c_int,
namelen: ::c_uint,
@@ -1472,11 +1521,23 @@ extern "C" {
pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
- pub fn ptrace(
- request: ::c_int,
- pid: ::pid_t,
- addr: caddr_t,
- data: ::c_int,
+ pub fn ptrace(request: ::c_int, pid: ::pid_t, addr: caddr_t, data: ::c_int) -> ::c_int;
+ pub fn memmem(
+ haystack: *const ::c_void,
+ haystacklen: ::size_t,
+ needle: *const ::c_void,
+ needlelen: ::size_t,
+ ) -> *mut ::c_void;
+ // #include <link.h>
+ pub fn dl_iterate_phdr(
+ callback: ::Option<
+ unsafe extern "C" fn(
+ info: *mut dl_phdr_info,
+ size: usize,
+ data: *mut ::c_void,
+ ) -> ::c_int,
+ >,
+ data: *mut ::c_void,
) -> ::c_int;
}
diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs
index d704a0b6..d88baec6 100644
--- a/src/unix/haiku/mod.rs
+++ b/src/unix/haiku/mod.rs
@@ -1,9 +1,9 @@
pub type rlim_t = ::uintptr_t;
pub type sa_family_t = u8;
pub type pthread_key_t = ::c_int;
-pub type nfds_t = ::c_long;
+pub type nfds_t = ::c_ulong;
pub type tcflag_t = ::c_uint;
-pub type speed_t = ::c_uint;
+pub type speed_t = ::c_uchar;
pub type c_char = i8;
pub type clock_t = i32;
pub type clockid_t = i32;
@@ -19,6 +19,7 @@ pub type nlink_t = i32;
pub type useconds_t = u32;
pub type socklen_t = u32;
pub type pthread_t = ::uintptr_t;
+pub type pthread_condattr_t = ::uintptr_t;
pub type pthread_mutexattr_t = ::uintptr_t;
pub type pthread_rwlockattr_t = ::uintptr_t;
pub type sigset_t = u64;
@@ -28,6 +29,7 @@ pub type pthread_attr_t = *mut ::c_void;
pub type nl_item = ::c_int;
pub type id_t = i32;
pub type idtype_t = ::c_uint;
+pub type fd_mask = u32;
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
@@ -38,6 +40,24 @@ impl ::Clone for timezone {
}
}
+impl siginfo_t {
+ pub unsafe fn si_addr(&self) -> *mut ::c_void {
+ self.si_addr
+ }
+
+ 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
+ }
+}
+
s! {
pub struct in_addr {
pub s_addr: ::in_addr_t,
@@ -51,7 +71,7 @@ s! {
pub struct sockaddr {
pub sa_len: u8,
pub sa_family: sa_family_t,
- pub sa_data: [::c_char; 30],
+ pub sa_data: [u8; 30],
}
pub struct sockaddr_in {
@@ -59,13 +79,13 @@ s! {
pub sin_family: sa_family_t,
pub sin_port: ::in_port_t,
pub sin_addr: ::in_addr,
- pub sin_zero: [u8; 24],
+ pub sin_zero: [i8; 24],
}
pub struct sockaddr_in6 {
pub sin6_len: u8,
- pub sin6_family: sa_family_t,
- pub sin6_port: ::in_port_t,
+ pub sin6_family: u8,
+ pub sin6_port: u16,
pub sin6_flowinfo: u32,
pub sin6_addr: ::in6_addr,
pub sin6_scope_id: u32,
@@ -83,7 +103,8 @@ s! {
}
pub struct fd_set {
- fds_bits: [c_ulong; FD_SETSIZE / ULONG_SIZE],
+ // size for 1024 bits, and a fd_mask with size u32
+ fds_bits: [fd_mask; 32],
}
pub struct tm {
@@ -96,8 +117,8 @@ s! {
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 tm_gmtoff: ::c_int,
+ pub tm_zone: *mut ::c_char,
}
pub struct utsname {
@@ -137,16 +158,16 @@ s! {
pub struct msghdr {
pub msg_name: *mut ::c_void,
- pub msg_namelen: ::socklen_t,
+ 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_controllen: socklen_t,
pub msg_flags: ::c_int,
}
pub struct cmsghdr {
- pub cmsg_len: ::size_t,
+ pub cmsg_len: ::socklen_t,
pub cmsg_level: ::c_int,
pub cmsg_type: ::c_int,
}
@@ -283,22 +304,16 @@ s! {
}
pub struct sigaction {
- pub sa_sigaction: ::sighandler_t,
+ pub sa_sigaction: ::sighandler_t, //actually a union with sa_handler
pub sa_mask: ::sigset_t,
pub sa_flags: ::c_int,
sa_userdata: *mut ::c_void,
}
pub struct sem_t {
- pub se_type: i32,
- pub se_named_id: i32, // this is actually a union
- pub se_unnamed: i32,
- pub se_padding: [i32; 4],
- }
-
- pub struct pthread_condattr_t {
- pub process_shared: bool,
- pub clock_id: i32,
+ pub type_: i32,
+ pub named_sem_id: i32, // actually a union with unnamed_sem (i32)
+ pub padding: [i32; 2],
}
}
@@ -473,17 +488,6 @@ cfg_if! {
}
}
-// intentionally not public, only used for fd_set
-cfg_if! {
- if #[cfg(target_pointer_width = "32")] {
- const ULONG_SIZE: usize = 32;
- } else if #[cfg(target_pointer_width = "64")] {
- const ULONG_SIZE: usize = 64;
- } else {
- // Unknown target_pointer_width
- }
-}
-
pub const EXIT_FAILURE: ::c_int = 1;
pub const EXIT_SUCCESS: ::c_int = 0;
pub const RAND_MAX: ::c_int = 2147483647;
@@ -541,7 +545,7 @@ pub const RLIMIT_STACK: ::c_int = 5;
pub const RLIMIT_AS: ::c_int = 6;
// Haiku specific
pub const RLIMIT_NOVMON: ::c_int = 7;
-pub const RLIMIT_NLIMITS: ::c_int = 8;
+pub const RLIM_NLIMITS: ::c_int = 8;
pub const RUSAGE_SELF: ::c_int = 0;
@@ -578,18 +582,20 @@ pub const S_IFREG: ::mode_t = 32768;
pub const S_IFLNK: ::mode_t = 40960;
pub const S_IFSOCK: ::mode_t = 49152;
pub const S_IFMT: ::mode_t = 61440;
-pub const S_IRWXU: ::mode_t = 448;
-pub const S_IXUSR: ::mode_t = 64;
-pub const S_IWUSR: ::mode_t = 128;
-pub const S_IRUSR: ::mode_t = 256;
-pub const S_IRWXG: ::mode_t = 70;
-pub const S_IXGRP: ::mode_t = 10;
-pub const S_IWGRP: ::mode_t = 20;
-pub const S_IRGRP: ::mode_t = 40;
-pub const S_IRWXO: ::mode_t = 7;
-pub const S_IXOTH: ::mode_t = 1;
-pub const S_IWOTH: ::mode_t = 2;
-pub const S_IROTH: ::mode_t = 4;
+
+pub const S_IRWXU: ::mode_t = 0o00700;
+pub const S_IRUSR: ::mode_t = 0o00400;
+pub const S_IWUSR: ::mode_t = 0o00200;
+pub const S_IXUSR: ::mode_t = 0o00100;
+pub const S_IRWXG: ::mode_t = 0o00070;
+pub const S_IRGRP: ::mode_t = 0o00040;
+pub const S_IWGRP: ::mode_t = 0o00020;
+pub const S_IXGRP: ::mode_t = 0o00010;
+pub const S_IRWXO: ::mode_t = 0o00007;
+pub const S_IROTH: ::mode_t = 0o00004;
+pub const S_IWOTH: ::mode_t = 0o00002;
+pub const S_IXOTH: ::mode_t = 0o00001;
+
pub const F_OK: ::c_int = 0;
pub const R_OK: ::c_int = 4;
pub const W_OK: ::c_int = 2;
@@ -662,7 +668,7 @@ pub const LC_NUMERIC: ::c_int = 4;
pub const LC_TIME: ::c_int = 5;
pub const LC_MESSAGES: ::c_int = 6;
-// TODO: Haiku does not have MAP_FILE, but libstd/os.rs requires it
+// FIXME: Haiku does not have MAP_FILE, but libstd/os.rs requires it
pub const MAP_FILE: ::c_int = 0x00;
pub const MAP_SHARED: ::c_int = 0x01;
pub const MAP_PRIVATE: ::c_int = 0x02;
@@ -689,8 +695,8 @@ pub const ENOTTY: ::c_int = -2147454966;
pub const ENXIO: ::c_int = -2147454965;
pub const ESPIPE: ::c_int = -2147454964;
pub const ESRCH: ::c_int = -2147454963;
-pub const EFPOS: ::c_int = -2147457962;
-pub const ESIGPARM: ::c_int = -2147457961;
+pub const EFPOS: ::c_int = -2147454962;
+pub const ESIGPARM: ::c_int = -2147454961;
pub const EDOM: ::c_int = -2147454960;
pub const ERANGE: ::c_int = -2147454959;
pub const EPROTOTYPE: ::c_int = -2147454958;
@@ -738,7 +744,7 @@ pub const ETXTBSY: ::c_int = -2147454917;
pub const ENOATTR: ::c_int = -2147454916;
// INT_MIN
-pub const ENOMEM: ::c_int = -2147454976;
+pub const ENOMEM: ::c_int = -2147483648;
// POSIX errors that can be mapped to BeOS error codes
pub const EACCES: ::c_int = -2147483646;
@@ -790,7 +796,7 @@ pub const IFF_AUTO_CONFIGURED: ::c_int = 0x2000;
pub const IFF_CONFIGURING: ::c_int = 0x4000;
pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast
-pub const AF_UNSEC: ::c_int = 0;
+pub const AF_UNSPEC: ::c_int = 0;
pub const AF_INET: ::c_int = 1;
pub const AF_APPLETALK: ::c_int = 2;
pub const AF_ROUTE: ::c_int = 3;
@@ -826,6 +832,9 @@ pub const TCP_MAXSEG: ::c_int = 0x02;
pub const TCP_NOPUSH: ::c_int = 0x04;
pub const TCP_NOOPT: ::c_int = 0x08;
+pub const IF_NAMESIZE: ::size_t = 32;
+pub const IFNAMSIZ: ::size_t = IF_NAMESIZE;
+
pub const IPV6_MULTICAST_IF: ::c_int = 24;
pub const IPV6_MULTICAST_HOPS: ::c_int = 25;
pub const IPV6_MULTICAST_LOOP: ::c_int = 26;
@@ -836,7 +845,7 @@ pub const IPV6_V6ONLY: ::c_int = 30;
pub const IPV6_PKTINFO: ::c_int = 31;
pub const IPV6_RECVPKTINFO: ::c_int = 32;
pub const IPV6_HOPLIMIT: ::c_int = 33;
-pub const IPV6_REVCHOPLIMIT: ::c_int = 34;
+pub const IPV6_RECVHOPLIMIT: ::c_int = 34;
pub const IPV6_HOPOPTS: ::c_int = 35;
pub const IPV6_DSTOPTS: ::c_int = 36;
pub const IPV6_RTHDR: ::c_int = 37;
@@ -865,6 +874,7 @@ pub const LOCK_UN: ::c_int = 0x08;
pub const SIGSTKSZ: ::size_t = 16384;
+pub const IOV_MAX: ::c_int = 1024;
pub const PATH_MAX: ::c_int = 1024;
pub const SA_NOCLDSTOP: ::c_int = 0x01;
@@ -915,7 +925,10 @@ pub const _PC_2_SYMLINKS: ::c_int = 37;
pub const _PC_XATTR_EXISTS: ::c_int = 38;
pub const _PC_XATTR_ENABLED: ::c_int = 39;
-pub const FIONBIO: ::c_int = 0xbe000000;
+pub const FIONBIO: ::c_ulong = 0xbe000000;
+pub const FIONREAD: ::c_ulong = 0xbe000001;
+pub const FIOSEEKDATA: ::c_ulong = 0xbe000002;
+pub const FIOSEEKHOLE: ::c_ulong = 0xbe000003;
pub const _SC_ARG_MAX: ::c_int = 15;
pub const _SC_CHILD_MAX: ::c_int = 16;
@@ -962,6 +975,10 @@ pub const _SC_TIMER_MAX: ::c_int = 57;
pub const _SC_TIMERS: ::c_int = 58;
pub const _SC_CPUTIME: ::c_int = 59;
pub const _SC_THREAD_CPUTIME: ::c_int = 60;
+pub const _SC_HOST_NAME_MAX: ::c_int = 61;
+pub const _SC_REGEXP: ::c_int = 62;
+pub const _SC_SYMLOOP_MAX: ::c_int = 63;
+pub const _SC_SHELL: ::c_int = 64;
pub const PTHREAD_STACK_MIN: ::size_t = 8192;
@@ -994,7 +1011,7 @@ pub const PTHREAD_MUTEX_NORMAL: ::c_int = 1;
pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 3;
-pub const FIOCLEX: c_ulong = 0; // TODO: does not exist on Haiku!
+pub const FIOCLEX: c_ulong = 0; // FIXME: does not exist on Haiku!
pub const RUSAGE_CHILDREN: ::c_int = -1;
@@ -1037,6 +1054,13 @@ pub const WEXITED: ::c_int = 0x08;
pub const WSTOPPED: ::c_int = 0x10;
pub const WNOWAIT: ::c_int = 0x20;
+pub const CLD_EXITED: ::c_int = 60;
+pub const CLD_KILLED: ::c_int = 61;
+pub const CLD_DUMPED: ::c_int = 62;
+pub const CLD_TRAPPED: ::c_int = 63;
+pub const CLD_STOPPED: ::c_int = 64;
+pub const CLD_CONTINUED: ::c_int = 65;
+
pub const P_ALL: idtype_t = 0;
pub const P_PID: idtype_t = 1;
pub const P_PGID: idtype_t = 2;
@@ -1181,32 +1205,89 @@ pub const TCIFLUSH: ::c_int = 0x01;
pub const TCOFLUSH: ::c_int = 0x02;
pub const TCIOFLUSH: ::c_int = 0x03;
-pub const TCGETA: ::c_int = 0x8000;
-pub const TCSETA: ::c_int = TCGETA + 1;
-pub const TCSETAF: ::c_int = TCGETA + 2;
-pub const TCSETAW: ::c_int = TCGETA + 3;
-pub const TCWAITEVENT: ::c_int = TCGETA + 4;
-pub const TCSBRK: ::c_int = TCGETA + 5;
-pub const TCFLSH: ::c_int = TCGETA + 6;
-pub const TCXONC: ::c_int = TCGETA + 7;
-pub const TCQUERYCONNECTED: ::c_int = TCGETA + 8;
-pub const TCGETBITS: ::c_int = TCGETA + 9;
-pub const TCSETDTR: ::c_int = TCGETA + 10;
-pub const TCSETRTS: ::c_int = TCGETA + 11;
-pub const TIOCGWINSZ: ::c_int = TCGETA + 12;
-pub const TIOCSWINSZ: ::c_int = TCGETA + 13;
-pub const TCVTIME: ::c_int = TCGETA + 14;
-pub const TIOCGPGRP: ::c_int = TCGETA + 15;
-pub const TIOCSPGRP: ::c_int = TCGETA + 16;
-pub const TIOCSCTTY: ::c_int = TCGETA + 17;
-pub const TIOCMGET: ::c_int = TCGETA + 18;
-pub const TIOCMSET: ::c_int = TCGETA + 19;
-pub const TIOCSBRK: ::c_int = TCGETA + 20;
-pub const TIOCCBRK: ::c_int = TCGETA + 21;
-pub const TIOCMBIS: ::c_int = TCGETA + 22;
-pub const TIOCMBIC: ::c_int = TCGETA + 23;
+pub const TCGETA: ::c_ulong = 0x8000;
+pub const TCSETA: ::c_ulong = TCGETA + 1;
+pub const TCSETAF: ::c_ulong = TCGETA + 2;
+pub const TCSETAW: ::c_ulong = TCGETA + 3;
+pub const TCWAITEVENT: ::c_ulong = TCGETA + 4;
+pub const TCSBRK: ::c_ulong = TCGETA + 5;
+pub const TCFLSH: ::c_ulong = TCGETA + 6;
+pub const TCXONC: ::c_ulong = TCGETA + 7;
+pub const TCQUERYCONNECTED: ::c_ulong = TCGETA + 8;
+pub const TCGETBITS: ::c_ulong = TCGETA + 9;
+pub const TCSETDTR: ::c_ulong = TCGETA + 10;
+pub const TCSETRTS: ::c_ulong = TCGETA + 11;
+pub const TIOCGWINSZ: ::c_ulong = TCGETA + 12;
+pub const TIOCSWINSZ: ::c_ulong = TCGETA + 13;
+pub const TCVTIME: ::c_ulong = TCGETA + 14;
+pub const TIOCGPGRP: ::c_ulong = TCGETA + 15;
+pub const TIOCSPGRP: ::c_ulong = TCGETA + 16;
+pub const TIOCSCTTY: ::c_ulong = TCGETA + 17;
+pub const TIOCMGET: ::c_ulong = TCGETA + 18;
+pub const TIOCMSET: ::c_ulong = TCGETA + 19;
+pub const TIOCSBRK: ::c_ulong = TCGETA + 20;
+pub const TIOCCBRK: ::c_ulong = TCGETA + 21;
+pub const TIOCMBIS: ::c_ulong = TCGETA + 22;
+pub const TIOCMBIC: ::c_ulong = TCGETA + 23;
+
+pub const PRIO_PROCESS: ::c_int = 0;
+pub const PRIO_PGRP: ::c_int = 1;
+pub const PRIO_USER: ::c_int = 2;
+
+pub const LOG_PID: ::c_int = 1 << 12;
+pub const LOG_CONS: ::c_int = 2 << 12;
+pub const LOG_ODELAY: ::c_int = 4 << 12;
+pub const LOG_NDELAY: ::c_int = 8 << 12;
+pub const LOG_SERIAL: ::c_int = 16 << 12;
+pub const LOG_PERROR: ::c_int = 32 << 12;
+pub const LOG_NOWAIT: ::c_int = 64 << 12;
+
+const_fn! {
+ {const} fn CMSG_ALIGN(len: usize) -> usize {
+ len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
+ }
+}
f! {
+ pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
+ if (*mhdr).msg_controllen as usize >= ::mem::size_of::<cmsghdr>() {
+ (*mhdr).msg_control as *mut cmsghdr
+ } else {
+ 0 as *mut cmsghdr
+ }
+ }
+
+ pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
+ (cmsg as *mut ::c_uchar)
+ .offset(CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
+ }
+
+ pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>()))
+ as ::c_uint
+ }
+
+ pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
+ CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length
+ }
+
+ pub fn CMSG_NXTHDR(mhdr: *const msghdr,
+ cmsg: *const cmsghdr) -> *mut cmsghdr {
+ if cmsg.is_null() {
+ return ::CMSG_FIRSTHDR(mhdr);
+ };
+ let next = cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize)
+ + CMSG_ALIGN(::mem::size_of::<::cmsghdr>());
+ let max = (*mhdr).msg_control as usize
+ + (*mhdr).msg_controllen as usize;
+ if next > max {
+ 0 as *mut ::cmsghdr
+ } else {
+ (cmsg as usize + CMSG_ALIGN((*cmsg).cmsg_len as usize))
+ as *mut ::cmsghdr
+ }
+ }
+
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;
@@ -1232,37 +1313,39 @@ f! {
*slot = 0;
}
}
+}
- pub fn WIFEXITED(status: ::c_int) -> bool {
+safe_f! {
+ pub {const} fn WIFEXITED(status: ::c_int) -> bool {
(status & !0xff) == 0
}
- pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
- (status & 0xff)
+ pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int {
+ status & 0xff
}
- pub fn WIFSIGNALED(status: ::c_int) -> bool {
+ pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
((status >> 8) & 0xff) != 0
}
- pub fn WTERMSIG(status: ::c_int) -> ::c_int {
+ pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
(status >> 8) & 0xff
}
- pub fn WIFSTOPPED(status: ::c_int) -> bool {
+ pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
((status >> 16) & 0xff) != 0
}
- pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
+ pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
(status >> 16) & 0xff
}
// actually WIFCORED, but this is used everywhere else
- pub fn WCOREDUMP(status: ::c_int) -> bool {
+ pub {const} fn WCOREDUMP(status: ::c_int) -> bool {
(status & 0x10000) != 0
}
- pub fn WIFCONTINUED(status: ::c_int) -> bool {
+ pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
(status & 0x20000) != 0
}
}
@@ -1270,11 +1353,17 @@ f! {
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,
+ pub fn getpriority(which: ::c_int, who: id_t) -> ::c_int;
+ pub fn setpriority(which: ::c_int, who: id_t, priority: ::c_int) -> ::c_int;
+
+ pub fn utimensat(
+ fd: ::c_int,
+ path: *const ::c_char,
+ times: *const ::timespec,
+ flag: ::c_int,
) -> ::c_int;
+ pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
+ pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
pub fn _errnop() -> *mut ::c_int;
pub fn abs(i: ::c_int) -> ::c_int;
@@ -1287,11 +1376,7 @@ extern "C" {
#[link(name = "bsd")]
extern "C" {
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 sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int;
pub fn clock_gettime(clk_id: ::c_int, tp: *mut ::timespec) -> ::c_int;
pub fn clock_settime(clk_id: ::c_int, tp: *const ::timespec) -> ::c_int;
@@ -1319,71 +1404,45 @@ extern "C" {
clock_id: ::clockid_t,
) -> ::c_int;
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
- pub fn setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int;
- pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
- pub fn mprotect(
- addr: *const ::c_void,
- len: ::size_t,
- prot: ::c_int,
- ) -> ::c_int;
+ pub fn setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int;
+ pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
+ pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
pub fn getnameinfo(
sa: *const ::sockaddr,
salen: ::socklen_t,
host: *mut ::c_char,
- hostlen: ::size_t,
+ hostlen: ::socklen_t,
serv: *mut ::c_char,
- sevlen: ::size_t,
+ sevlen: ::socklen_t,
flags: ::c_int,
) -> ::c_int;
pub fn pthread_mutex_timedlock(
lock: *mut pthread_mutex_t,
abstime: *const ::timespec,
) -> ::c_int;
- pub fn waitid(
- idtype: idtype_t,
- id: id_t,
- infop: *mut ::siginfo_t,
- options: ::c_int,
- ) -> ::c_int;
+ pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int)
+ -> ::c_int;
pub fn glob(
pattern: *const ::c_char,
flags: ::c_int,
- errfunc: ::Option<
- extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int,
- >,
+ errfunc: ::Option<extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>,
pglob: *mut ::glob_t,
) -> ::c_int;
pub fn globfree(pglob: *mut ::glob_t);
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
- pub fn posix_madvise(
- addr: *mut ::c_void,
- len: ::size_t,
- advice: ::c_int,
- ) -> ::c_int;
+ pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
- pub fn shm_open(
- name: *const ::c_char,
- oflag: ::c_int,
- mode: ::mode_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 seekdir(dirp: *mut ::DIR, loc: ::c_long);
pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
- pub fn madvise(
- addr: *mut ::c_void,
- len: ::size_t,
- advice: ::c_int,
- ) -> ::c_int;
+ pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
- pub fn msync(
- addr: *mut ::c_void,
- len: ::size_t,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
pub fn recvfrom(
socket: ::c_int,
@@ -1394,43 +1453,21 @@ extern "C" {
addrlen: *mut ::socklen_t,
) -> ::ssize_t;
pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
- pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int;
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
- pub fn bind(
- socket: ::c_int,
- address: *const ::sockaddr,
- address_len: ::socklen_t,
- ) -> ::c_int;
+ pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int;
- pub fn writev(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- ) -> ::ssize_t;
- pub fn readv(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- ) -> ::ssize_t;
+ pub fn writev(fd: ::c_int, iov: *const ::iovec, count: ::c_int) -> ::ssize_t;
+ pub fn readv(fd: ::c_int, iov: *const ::iovec, count: ::c_int) -> ::ssize_t;
- pub fn sendmsg(
- fd: ::c_int,
- msg: *const ::msghdr,
- flags: ::c_int,
- ) -> ::ssize_t;
- pub fn recvmsg(
- fd: ::c_int,
- msg: *mut ::msghdr,
- flags: ::c_int,
- ) -> ::ssize_t;
+ pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t;
+ pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t;
pub fn execvpe(
file: *const ::c_char,
argv: *const *const ::c_char,
environment: *const *const ::c_char,
) -> ::c_int;
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
pub fn getgrgid_r(
gid: ::gid_t,
grp: *mut ::group,
@@ -1438,15 +1475,9 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut ::group,
) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "sigaltstack$UNIX2003"
- )]
- #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
pub fn sem_close(sem: *mut sem_t) -> ::c_int;
pub fn getdtablesize() -> ::c_int;
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
pub fn getgrnam_r(
name: *const ::c_char,
grp: *mut ::group,
@@ -1454,22 +1485,12 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut ::group,
) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_sigmask$UNIX2003"
- )]
- pub fn pthread_sigmask(
- how: ::c_int,
- set: *const sigset_t,
- oldset: *mut sigset_t,
- ) -> ::c_int;
+ pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int;
pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
pub fn getpwnam_r(
name: *const ::c_char,
pwd: *mut passwd,
@@ -1477,8 +1498,6 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut passwd,
) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
pub fn getpwuid_r(
uid: ::uid_t,
pwd: *mut passwd,
@@ -1486,11 +1505,6 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut passwd,
) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "sigwait$UNIX2003"
- )]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int;
pub fn pthread_atfork(
prepare: ::Option<unsafe extern "C" fn()>,
@@ -1498,10 +1512,6 @@ extern "C" {
child: ::Option<unsafe extern "C" fn()>,
) -> ::c_int;
pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "popen$UNIX2003"
- )]
pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
pub fn openpty(
amaster: *mut ::c_int,
@@ -1529,3 +1539,6 @@ cfg_if! {
pub use self::b32::*;
}
}
+
+mod native;
+pub use self::native::*;
diff --git a/src/unix/haiku/native.rs b/src/unix/haiku/native.rs
new file mode 100644
index 00000000..7d2a60d9
--- /dev/null
+++ b/src/unix/haiku/native.rs
@@ -0,0 +1,1043 @@
+// This module contains bindings to the native Haiku API. The Haiku API
+// originates from BeOS, and it was the original way to perform low level
+// system and IO operations. The POSIX API was in that era was like a
+// compatibility layer. In current Haiku development, both the POSIX API and
+// the Haiku API are considered to be co-equal status. However, they are not
+// integrated like they are on other UNIX platforms, which means that for many
+// low level concepts there are two versions, like processes (POSIX) and
+// teams (Haiku), or pthreads and native threads.
+//
+// Both the POSIX API and the Haiku API live in libroot.so, the library that is
+// linked to any binary by default.
+//
+// This file follows the Haiku API for Haiku R1 beta 2. It is organized by the
+// C/C++ header files in which the concepts can be found, while adhering to the
+// style guide for this crate.
+
+// Helper macro to generate u32 constants. The Haiku API uses (non-standard)
+// multi-character constants (like 'UPDA' or 'MSGM') to represent 32 bit
+// integer constants.
+
+macro_rules! haiku_constant {
+ ($a:tt, $b:tt, $c:tt, $d:tt) => {
+ (($a as u32) << 24) + (($b as u32) << 16) + (($c as u32) << 8) + ($d as u32)
+ };
+}
+
+// support/SupportDefs.h
+pub type status_t = i32;
+pub type bigtime_t = i64;
+pub type nanotime_t = i64;
+pub type type_code = u32;
+pub type perform_code = u32;
+
+// kernel/OS.h
+pub type area_id = i32;
+pub type port_id = i32;
+pub type sem_id = i32;
+pub type team_id = i32;
+pub type thread_id = i32;
+
+pub type thread_func = extern "C" fn(*mut ::c_void) -> status_t;
+
+// kernel/image.h
+pub type image_id = i32;
+
+e! {
+ // kernel/OS.h
+ pub enum thread_state {
+ B_THREAD_RUNNING = 1,
+ B_THREAD_READY,
+ B_THREAD_RECEIVING,
+ B_THREAD_ASLEEP,
+ B_THREAD_SUSPENDED,
+ B_THREAD_WAITING
+ }
+
+ // kernel/image.h
+ pub enum image_type {
+ B_APP_IMAGE = 1,
+ B_LIBRARY_IMAGE,
+ B_ADD_ON_IMAGE,
+ B_SYSTEM_IMAGE
+ }
+}
+
+s! {
+ // kernel/OS.h
+ pub struct area_info {
+ pub area: area_id,
+ pub name: [::c_char; B_OS_NAME_LENGTH],
+ pub size: usize,
+ pub lock: u32,
+ pub protection: u32,
+ pub team: team_id,
+ pub ram_size: u32,
+ pub copy_count: u32,
+ pub in_count: u32,
+ pub out_count: u32,
+ pub address: *mut ::c_void
+ }
+
+ pub struct port_info {
+ pub port: port_id,
+ pub team: team_id,
+ pub name: [::c_char; B_OS_NAME_LENGTH],
+ pub capacity: i32,
+ pub queue_count: i32,
+ pub total_count: i32,
+ }
+
+ pub struct port_message_info {
+ pub size: ::size_t,
+ pub sender: ::uid_t,
+ pub sender_group: ::gid_t,
+ pub sender_team: ::team_id
+ }
+
+ pub struct team_info {
+ team: team_id,
+ thread_count: i32,
+ image_count: i32,
+ area_count: i32,
+ debugger_nub_thread: thread_id,
+ debugger_nub_port: port_id,
+ argc: i32,
+ args: [::c_char; 64],
+ uid: ::uid_t,
+ gid: ::gid_t
+ }
+
+ pub struct sem_info {
+ sem: sem_id,
+ team: team_id,
+ name: [::c_char; B_OS_NAME_LENGTH],
+ count: i32,
+ latest_holder: thread_id
+ }
+
+ pub struct team_usage_info {
+ user_time: bigtime_t,
+ kernel_time: bigtime_t
+ }
+
+ pub struct thread_info {
+ pub thread: thread_id,
+ pub team: team_id,
+ pub name: [::c_char; B_OS_NAME_LENGTH],
+ pub state: thread_state,
+ pub priority: i32,
+ pub sem: sem_id,
+ pub user_time: bigtime_t,
+ pub kernel_time: bigtime_t,
+ pub stack_base: *mut ::c_void,
+ pub stack_end: *mut ::c_void
+ }
+
+ pub struct cpu_info {
+ pub active_time: bigtime_t,
+ pub enabled: bool
+ }
+
+ pub struct system_info {
+ pub boot_time: bigtime_t,
+ pub cpu_count: u32,
+ pub max_pages: u64,
+ pub used_pages: u64,
+ pub cached_pages: u64,
+ pub block_cache_pages: u64,
+ pub ignored_pages: u64,
+ pub needed_memory: u64,
+ pub free_memory: u64,
+ pub max_swap_pages: u64,
+ pub free_swap_pages: u64,
+ pub page_faults: u32,
+ pub max_sems: u32,
+ pub used_sems: u32,
+ pub max_ports: u32,
+ pub used_ports: u32,
+ pub max_threads: u32,
+ pub used_threads: u32,
+ pub max_teams: u32,
+ pub used_teams: u32,
+ pub kernel_name: [::c_char; B_FILE_NAME_LENGTH],
+ pub kernel_build_date: [::c_char; B_OS_NAME_LENGTH],
+ pub kernel_build_time: [::c_char; B_OS_NAME_LENGTH],
+ pub kernel_version: i64,
+ pub abi: u32
+ }
+
+ pub struct object_wait_info {
+ pub object: i32,
+ pub type_: u16,
+ pub events: u16
+ }
+
+ // kernel/fs_attr.h
+ pub struct attr_info {
+ type_: u32,
+ size: ::off_t
+ }
+
+ // kernel/fs_index.h
+ pub struct index_info {
+ type_: u32,
+ size: ::off_t,
+ modification_time: ::time_t,
+ creation_time: ::time_t,
+ uid: ::uid_t,
+ gid: ::gid_t
+ }
+
+ //kernel/fs_info.h
+ pub struct fs_info {
+ dev: ::dev_t,
+ root: ::ino_t,
+ flags: u32,
+ block_size: ::off_t,
+ io_size: ::off_t,
+ total_blocks: ::off_t,
+ free_blocks: ::off_t,
+ total_nodes: ::off_t,
+ free_nodes: ::off_t,
+ device_name: [::c_char; 128],
+ volume_name: [::c_char; B_FILE_NAME_LENGTH],
+ fsh_name: [::c_char; B_OS_NAME_LENGTH]
+ }
+
+ // kernel/image.h
+ pub struct image_info {
+ pub id: image_id,
+ pub image_type: ::c_int,
+ pub sequence: i32,
+ pub init_order: i32,
+ pub init_routine: extern "C" fn(),
+ pub term_routine: extern "C" fn(),
+ pub device: ::dev_t,
+ pub node: ::ino_t,
+ pub name: [::c_char; ::PATH_MAX as usize],
+ pub text: *mut ::c_void,
+ pub data: *mut ::c_void,
+ pub text_size: i32,
+ pub data_size: i32,
+ pub api_version: i32,
+ pub abi: i32
+ }
+}
+
+// kernel/OS.h
+pub const B_OS_NAME_LENGTH: usize = 32;
+pub const B_PAGE_SIZE: usize = 4096;
+pub const B_INFINITE_TIMEOUT: usize = 9223372036854775807;
+
+pub const B_RELATIVE_TIMEOUT: u32 = 0x8;
+pub const B_ABSOLUTE_TIMEOUT: u32 = 0x10;
+pub const B_TIMEOUT_REAL_TIME_BASE: u32 = 0x40;
+pub const B_ABSOLUTE_REAL_TIME_TIMEOUT: u32 = B_ABSOLUTE_TIMEOUT | B_TIMEOUT_REAL_TIME_BASE;
+
+pub const B_NO_LOCK: u32 = 0;
+pub const B_LAZY_LOCK: u32 = 1;
+pub const B_FULL_LOCK: u32 = 2;
+pub const B_CONTIGUOUS: u32 = 3;
+pub const B_LOMEM: u32 = 4;
+pub const B_32_BIT_FULL_LOCK: u32 = 5;
+pub const B_32_BIT_CONTIGUOUS: u32 = 6;
+
+pub const B_ANY_ADDRESS: u32 = 0;
+pub const B_EXACT_ADDRESS: u32 = 1;
+pub const B_BASE_ADDRESS: u32 = 2;
+pub const B_CLONE_ADDRESS: u32 = 3;
+pub const B_ANY_KERNEL_ADDRESS: u32 = 4;
+pub const B_RANDOMIZED_ANY_ADDRESS: u32 = 6;
+pub const B_RANDOMIZED_BASE_ADDRESS: u32 = 7;
+
+pub const B_READ_AREA: u32 = 1 << 0;
+pub const B_WRITE_AREA: u32 = 1 << 1;
+pub const B_EXECUTE_AREA: u32 = 1 << 2;
+pub const B_STACK_AREA: u32 = 1 << 3;
+pub const B_CLONEABLE_AREA: u32 = 1 << 8;
+
+pub const B_CAN_INTERRUPT: u32 = 0x01;
+pub const B_CHECK_PERMISSION: u32 = 0x04;
+pub const B_KILL_CAN_INTERRUPT: u32 = 0x20;
+pub const B_DO_NOT_RESCHEDULE: u32 = 0x02;
+pub const B_RELEASE_ALL: u32 = 0x08;
+pub const B_RELEASE_IF_WAITING_ONLY: u32 = 0x10;
+
+pub const B_CURRENT_TEAM: team_id = 0;
+pub const B_SYSTEM_TEAM: team_id = 1;
+
+pub const B_TEAM_USAGE_SELF: i32 = 0;
+pub const B_TEAM_USAGE_CHILDREN: i32 = -1;
+
+pub const B_IDLE_PRIORITY: i32 = 0;
+pub const B_LOWEST_ACTIVE_PRIORITY: i32 = 1;
+pub const B_LOW_PRIORITY: i32 = 5;
+pub const B_NORMAL_PRIORITY: i32 = 10;
+pub const B_DISPLAY_PRIORITY: i32 = 15;
+pub const B_URGENT_DISPLAY_PRIORITY: i32 = 20;
+pub const B_REAL_TIME_DISPLAY_PRIORITY: i32 = 100;
+pub const B_URGENT_PRIORITY: i32 = 110;
+pub const B_REAL_TIME_PRIORITY: i32 = 120;
+
+pub const B_SYSTEM_TIMEBASE: i32 = 0;
+pub const B_FIRST_REAL_TIME_PRIORITY: i32 = B_REAL_TIME_DISPLAY_PRIORITY;
+
+pub const B_ONE_SHOT_ABSOLUTE_ALARM: u32 = 1;
+pub const B_ONE_SHOT_RELATIVE_ALARM: u32 = 2;
+pub const B_PERIODIC_ALARM: u32 = 3;
+
+pub const B_OBJECT_TYPE_FD: u16 = 0;
+pub const B_OBJECT_TYPE_SEMAPHORE: u16 = 1;
+pub const B_OBJECT_TYPE_PORT: u16 = 2;
+pub const B_OBJECT_TYPE_THREAD: u16 = 3;
+
+pub const B_EVENT_READ: u16 = 0x0001;
+pub const B_EVENT_WRITE: u16 = 0x0002;
+pub const B_EVENT_ERROR: u16 = 0x0004;
+pub const B_EVENT_PRIORITY_READ: u16 = 0x0008;
+pub const B_EVENT_PRIORITY_WRITE: u16 = 0x0010;
+pub const B_EVENT_HIGH_PRIORITY_READ: u16 = 0x0020;
+pub const B_EVENT_HIGH_PRIORITY_WRITE: u16 = 0x0040;
+pub const B_EVENT_DISCONNECTED: u16 = 0x0080;
+pub const B_EVENT_ACQUIRE_SEMAPHORE: u16 = 0x0001;
+pub const B_EVENT_INVALID: u16 = 0x1000;
+
+// kernel/fs_info.h
+pub const B_FS_IS_READONLY: u32 = 0x00000001;
+pub const B_FS_IS_REMOVABLE: u32 = 0x00000002;
+pub const B_FS_IS_PERSISTENT: u32 = 0x00000004;
+pub const B_FS_IS_SHARED: u32 = 0x00000008;
+pub const B_FS_HAS_MIME: u32 = 0x00010000;
+pub const B_FS_HAS_ATTR: u32 = 0x00020000;
+pub const B_FS_HAS_QUERY: u32 = 0x00040000;
+pub const B_FS_HAS_SELF_HEALING_LINKS: u32 = 0x00080000;
+pub const B_FS_HAS_ALIASES: u32 = 0x00100000;
+pub const B_FS_SUPPORTS_NODE_MONITORING: u32 = 0x00200000;
+pub const B_FS_SUPPORTS_MONITOR_CHILDREN: u32 = 0x00400000;
+
+// kernel/fs_query.h
+pub const B_LIVE_QUERY: u32 = 0x00000001;
+pub const B_QUERY_NON_INDEXED: u32 = 0x00000002;
+
+// kernel/fs_volume.h
+pub const B_MOUNT_READ_ONLY: u32 = 1;
+pub const B_MOUNT_VIRTUAL_DEVICE: u32 = 2;
+pub const B_FORCE_UNMOUNT: u32 = 1;
+
+// kernel/image.h
+pub const B_FLUSH_DCACHE: u32 = 0x0001;
+pub const B_FLUSH_ICACHE: u32 = 0x0004;
+pub const B_INVALIDATE_DCACHE: u32 = 0x0002;
+pub const B_INVALIDATE_ICACHE: u32 = 0x0008;
+
+pub const B_SYMBOL_TYPE_DATA: i32 = 0x1;
+pub const B_SYMBOL_TYPE_TEXT: i32 = 0x2;
+pub const B_SYMBOL_TYPE_ANY: i32 = 0x5;
+
+// storage/StorageDefs.h
+pub const B_DEV_NAME_LENGTH: usize = 128;
+pub const B_FILE_NAME_LENGTH: usize = ::FILENAME_MAX as usize;
+pub const B_PATH_NAME_LENGTH: usize = ::PATH_MAX as usize;
+pub const B_ATTR_NAME_LENGTH: usize = B_FILE_NAME_LENGTH - 1;
+pub const B_MIME_TYPE_LENGTH: usize = B_ATTR_NAME_LENGTH - 15;
+pub const B_MAX_SYMLINKS: usize = 16;
+
+// Haiku open modes in BFile are passed as u32
+pub const B_READ_ONLY: u32 = ::O_RDONLY as u32;
+pub const B_WRITE_ONLY: u32 = ::O_WRONLY as u32;
+pub const B_READ_WRITE: u32 = ::O_RDWR as u32;
+
+pub const B_FAIL_IF_EXISTS: u32 = ::O_EXCL as u32;
+pub const B_CREATE_FILE: u32 = ::O_CREAT as u32;
+pub const B_ERASE_FILE: u32 = ::O_TRUNC as u32;
+pub const B_OPEN_AT_END: u32 = ::O_APPEND as u32;
+
+pub const B_FILE_NODE: u32 = 0x01;
+pub const B_SYMLINK_NODE: u32 = 0x02;
+pub const B_DIRECTORY_NODE: u32 = 0x04;
+pub const B_ANY_NODE: u32 = 0x07;
+
+// support/Errors.h
+pub const B_GENERAL_ERROR_BASE: status_t = core::i32::MIN;
+pub const B_OS_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x1000;
+pub const B_APP_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x2000;
+pub const B_INTERFACE_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x3000;
+pub const B_MEDIA_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x4000;
+pub const B_TRANSLATION_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x4800;
+pub const B_MIDI_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x5000;
+pub const B_STORAGE_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x6000;
+pub const B_POSIX_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x7000;
+pub const B_MAIL_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x8000;
+pub const B_PRINT_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0x9000;
+pub const B_DEVICE_ERROR_BASE: status_t = B_GENERAL_ERROR_BASE + 0xa000;
+pub const B_ERRORS_END: status_t = B_GENERAL_ERROR_BASE + 0xffff;
+
+// General errors
+pub const B_NO_MEMORY: status_t = B_GENERAL_ERROR_BASE + 0;
+pub const B_IO_ERROR: status_t = B_GENERAL_ERROR_BASE + 1;
+pub const B_PERMISSION_DENIED: status_t = B_GENERAL_ERROR_BASE + 2;
+pub const B_BAD_INDEX: status_t = B_GENERAL_ERROR_BASE + 3;
+pub const B_BAD_TYPE: status_t = B_GENERAL_ERROR_BASE + 4;
+pub const B_BAD_VALUE: status_t = B_GENERAL_ERROR_BASE + 5;
+pub const B_MISMATCHED_VALUES: status_t = B_GENERAL_ERROR_BASE + 6;
+pub const B_NAME_NOT_FOUND: status_t = B_GENERAL_ERROR_BASE + 7;
+pub const B_NAME_IN_USE: status_t = B_GENERAL_ERROR_BASE + 8;
+pub const B_TIMED_OUT: status_t = B_GENERAL_ERROR_BASE + 9;
+pub const B_INTERRUPTED: status_t = B_GENERAL_ERROR_BASE + 10;
+pub const B_WOULD_BLOCK: status_t = B_GENERAL_ERROR_BASE + 11;
+pub const B_CANCELED: status_t = B_GENERAL_ERROR_BASE + 12;
+pub const B_NO_INIT: status_t = B_GENERAL_ERROR_BASE + 13;
+pub const B_NOT_INITIALIZED: status_t = B_GENERAL_ERROR_BASE + 13;
+pub const B_BUSY: status_t = B_GENERAL_ERROR_BASE + 14;
+pub const B_NOT_ALLOWED: status_t = B_GENERAL_ERROR_BASE + 15;
+pub const B_BAD_DATA: status_t = B_GENERAL_ERROR_BASE + 16;
+pub const B_DONT_DO_THAT: status_t = B_GENERAL_ERROR_BASE + 17;
+
+pub const B_ERROR: status_t = -1;
+pub const B_OK: status_t = 0;
+pub const B_NO_ERROR: status_t = 0;
+
+// Kernel kit errors
+pub const B_BAD_SEM_ID: status_t = B_OS_ERROR_BASE + 0;
+pub const B_NO_MORE_SEMS: status_t = B_OS_ERROR_BASE + 1;
+
+pub const B_BAD_THREAD_ID: status_t = B_OS_ERROR_BASE + 0x100;
+pub const B_NO_MORE_THREADS: status_t = B_OS_ERROR_BASE + 0x101;
+pub const B_BAD_THREAD_STATE: status_t = B_OS_ERROR_BASE + 0x102;
+pub const B_BAD_TEAM_ID: status_t = B_OS_ERROR_BASE + 0x103;
+pub const B_NO_MORE_TEAMS: status_t = B_OS_ERROR_BASE + 0x104;
+
+pub const B_BAD_PORT_ID: status_t = B_OS_ERROR_BASE + 0x200;
+pub const B_NO_MORE_PORTS: status_t = B_OS_ERROR_BASE + 0x201;
+
+pub const B_BAD_IMAGE_ID: status_t = B_OS_ERROR_BASE + 0x300;
+pub const B_BAD_ADDRESS: status_t = B_OS_ERROR_BASE + 0x301;
+pub const B_NOT_AN_EXECUTABLE: status_t = B_OS_ERROR_BASE + 0x302;
+pub const B_MISSING_LIBRARY: status_t = B_OS_ERROR_BASE + 0x303;
+pub const B_MISSING_SYMBOL: status_t = B_OS_ERROR_BASE + 0x304;
+pub const B_UNKNOWN_EXECUTABLE: status_t = B_OS_ERROR_BASE + 0x305;
+pub const B_LEGACY_EXECUTABLE: status_t = B_OS_ERROR_BASE + 0x306;
+
+pub const B_DEBUGGER_ALREADY_INSTALLED: status_t = B_OS_ERROR_BASE + 0x400;
+
+// Application kit errors
+pub const B_BAD_REPLY: status_t = B_APP_ERROR_BASE + 0;
+pub const B_DUPLICATE_REPLY: status_t = B_APP_ERROR_BASE + 1;
+pub const B_MESSAGE_TO_SELF: status_t = B_APP_ERROR_BASE + 2;
+pub const B_BAD_HANDLER: status_t = B_APP_ERROR_BASE + 3;
+pub const B_ALREADY_RUNNING: status_t = B_APP_ERROR_BASE + 4;
+pub const B_LAUNCH_FAILED: status_t = B_APP_ERROR_BASE + 5;
+pub const B_AMBIGUOUS_APP_LAUNCH: status_t = B_APP_ERROR_BASE + 6;
+pub const B_UNKNOWN_MIME_TYPE: status_t = B_APP_ERROR_BASE + 7;
+pub const B_BAD_SCRIPT_SYNTAX: status_t = B_APP_ERROR_BASE + 8;
+pub const B_LAUNCH_FAILED_NO_RESOLVE_LINK: status_t = B_APP_ERROR_BASE + 9;
+pub const B_LAUNCH_FAILED_EXECUTABLE: status_t = B_APP_ERROR_BASE + 10;
+pub const B_LAUNCH_FAILED_APP_NOT_FOUND: status_t = B_APP_ERROR_BASE + 11;
+pub const B_LAUNCH_FAILED_APP_IN_TRASH: status_t = B_APP_ERROR_BASE + 12;
+pub const B_LAUNCH_FAILED_NO_PREFERRED_APP: status_t = B_APP_ERROR_BASE + 13;
+pub const B_LAUNCH_FAILED_FILES_APP_NOT_FOUND: status_t = B_APP_ERROR_BASE + 14;
+pub const B_BAD_MIME_SNIFFER_RULE: status_t = B_APP_ERROR_BASE + 15;
+pub const B_NOT_A_MESSAGE: status_t = B_APP_ERROR_BASE + 16;
+pub const B_SHUTDOWN_CANCELLED: status_t = B_APP_ERROR_BASE + 17;
+pub const B_SHUTTING_DOWN: status_t = B_APP_ERROR_BASE + 18;
+
+// Storage kit errors
+pub const B_FILE_ERROR: status_t = B_STORAGE_ERROR_BASE + 0;
+pub const B_FILE_NOT_FOUND: status_t = B_STORAGE_ERROR_BASE + 1;
+pub const B_FILE_EXISTS: status_t = B_STORAGE_ERROR_BASE + 2;
+pub const B_ENTRY_NOT_FOUND: status_t = B_STORAGE_ERROR_BASE + 3;
+pub const B_NAME_TOO_LONG: status_t = B_STORAGE_ERROR_BASE + 4;
+pub const B_NOT_A_DIRECTORY: status_t = B_STORAGE_ERROR_BASE + 5;
+pub const B_DIRECTORY_NOT_EMPTY: status_t = B_STORAGE_ERROR_BASE + 6;
+pub const B_DEVICE_FULL: status_t = B_STORAGE_ERROR_BASE + 7;
+pub const B_READ_ONLY_DEVICE: status_t = B_STORAGE_ERROR_BASE + 8;
+pub const B_IS_A_DIRECTORY: status_t = B_STORAGE_ERROR_BASE + 9;
+pub const B_NO_MORE_FDS: status_t = B_STORAGE_ERROR_BASE + 10;
+pub const B_CROSS_DEVICE_LINK: status_t = B_STORAGE_ERROR_BASE + 11;
+pub const B_LINK_LIMIT: status_t = B_STORAGE_ERROR_BASE + 12;
+pub const B_BUSTED_PIPE: status_t = B_STORAGE_ERROR_BASE + 13;
+pub const B_UNSUPPORTED: status_t = B_STORAGE_ERROR_BASE + 14;
+pub const B_PARTITION_TOO_SMALL: status_t = B_STORAGE_ERROR_BASE + 15;
+pub const B_PARTIAL_READ: status_t = B_STORAGE_ERROR_BASE + 16;
+pub const B_PARTIAL_WRITE: status_t = B_STORAGE_ERROR_BASE + 17;
+
+// Mapped posix errors
+pub const B_BUFFER_OVERFLOW: status_t = ::EOVERFLOW;
+pub const B_TOO_MANY_ARGS: status_t = ::E2BIG;
+pub const B_FILE_TOO_LARGE: status_t = ::EFBIG;
+pub const B_RESULT_NOT_REPRESENTABLE: status_t = ::ERANGE;
+pub const B_DEVICE_NOT_FOUND: status_t = ::ENODEV;
+pub const B_NOT_SUPPORTED: status_t = ::EOPNOTSUPP;
+
+// Media kit errors
+pub const B_STREAM_NOT_FOUND: status_t = B_MEDIA_ERROR_BASE + 0;
+pub const B_SERVER_NOT_FOUND: status_t = B_MEDIA_ERROR_BASE + 1;
+pub const B_RESOURCE_NOT_FOUND: status_t = B_MEDIA_ERROR_BASE + 2;
+pub const B_RESOURCE_UNAVAILABLE: status_t = B_MEDIA_ERROR_BASE + 3;
+pub const B_BAD_SUBSCRIBER: status_t = B_MEDIA_ERROR_BASE + 4;
+pub const B_SUBSCRIBER_NOT_ENTERED: status_t = B_MEDIA_ERROR_BASE + 5;
+pub const B_BUFFER_NOT_AVAILABLE: status_t = B_MEDIA_ERROR_BASE + 6;
+pub const B_LAST_BUFFER_ERROR: status_t = B_MEDIA_ERROR_BASE + 7;
+
+pub const B_MEDIA_SYSTEM_FAILURE: status_t = B_MEDIA_ERROR_BASE + 100;
+pub const B_MEDIA_BAD_NODE: status_t = B_MEDIA_ERROR_BASE + 101;
+pub const B_MEDIA_NODE_BUSY: status_t = B_MEDIA_ERROR_BASE + 102;
+pub const B_MEDIA_BAD_FORMAT: status_t = B_MEDIA_ERROR_BASE + 103;
+pub const B_MEDIA_BAD_BUFFER: status_t = B_MEDIA_ERROR_BASE + 104;
+pub const B_MEDIA_TOO_MANY_NODES: status_t = B_MEDIA_ERROR_BASE + 105;
+pub const B_MEDIA_TOO_MANY_BUFFERS: status_t = B_MEDIA_ERROR_BASE + 106;
+pub const B_MEDIA_NODE_ALREADY_EXISTS: status_t = B_MEDIA_ERROR_BASE + 107;
+pub const B_MEDIA_BUFFER_ALREADY_EXISTS: status_t = B_MEDIA_ERROR_BASE + 108;
+pub const B_MEDIA_CANNOT_SEEK: status_t = B_MEDIA_ERROR_BASE + 109;
+pub const B_MEDIA_CANNOT_CHANGE_RUN_MODE: status_t = B_MEDIA_ERROR_BASE + 110;
+pub const B_MEDIA_APP_ALREADY_REGISTERED: status_t = B_MEDIA_ERROR_BASE + 111;
+pub const B_MEDIA_APP_NOT_REGISTERED: status_t = B_MEDIA_ERROR_BASE + 112;
+pub const B_MEDIA_CANNOT_RECLAIM_BUFFERS: status_t = B_MEDIA_ERROR_BASE + 113;
+pub const B_MEDIA_BUFFERS_NOT_RECLAIMED: status_t = B_MEDIA_ERROR_BASE + 114;
+pub const B_MEDIA_TIME_SOURCE_STOPPED: status_t = B_MEDIA_ERROR_BASE + 115;
+pub const B_MEDIA_TIME_SOURCE_BUSY: status_t = B_MEDIA_ERROR_BASE + 116;
+pub const B_MEDIA_BAD_SOURCE: status_t = B_MEDIA_ERROR_BASE + 117;
+pub const B_MEDIA_BAD_DESTINATION: status_t = B_MEDIA_ERROR_BASE + 118;
+pub const B_MEDIA_ALREADY_CONNECTED: status_t = B_MEDIA_ERROR_BASE + 119;
+pub const B_MEDIA_NOT_CONNECTED: status_t = B_MEDIA_ERROR_BASE + 120;
+pub const B_MEDIA_BAD_CLIP_FORMAT: status_t = B_MEDIA_ERROR_BASE + 121;
+pub const B_MEDIA_ADDON_FAILED: status_t = B_MEDIA_ERROR_BASE + 122;
+pub const B_MEDIA_ADDON_DISABLED: status_t = B_MEDIA_ERROR_BASE + 123;
+pub const B_MEDIA_CHANGE_IN_PROGRESS: status_t = B_MEDIA_ERROR_BASE + 124;
+pub const B_MEDIA_STALE_CHANGE_COUNT: status_t = B_MEDIA_ERROR_BASE + 125;
+pub const B_MEDIA_ADDON_RESTRICTED: status_t = B_MEDIA_ERROR_BASE + 126;
+pub const B_MEDIA_NO_HANDLER: status_t = B_MEDIA_ERROR_BASE + 127;
+pub const B_MEDIA_DUPLICATE_FORMAT: status_t = B_MEDIA_ERROR_BASE + 128;
+pub const B_MEDIA_REALTIME_DISABLED: status_t = B_MEDIA_ERROR_BASE + 129;
+pub const B_MEDIA_REALTIME_UNAVAILABLE: status_t = B_MEDIA_ERROR_BASE + 130;
+
+// Mail kit errors
+pub const B_MAIL_NO_DAEMON: status_t = B_MAIL_ERROR_BASE + 0;
+pub const B_MAIL_UNKNOWN_USER: status_t = B_MAIL_ERROR_BASE + 1;
+pub const B_MAIL_WRONG_PASSWORD: status_t = B_MAIL_ERROR_BASE + 2;
+pub const B_MAIL_UNKNOWN_HOST: status_t = B_MAIL_ERROR_BASE + 3;
+pub const B_MAIL_ACCESS_ERROR: status_t = B_MAIL_ERROR_BASE + 4;
+pub const B_MAIL_UNKNOWN_FIELD: status_t = B_MAIL_ERROR_BASE + 5;
+pub const B_MAIL_NO_RECIPIENT: status_t = B_MAIL_ERROR_BASE + 6;
+pub const B_MAIL_INVALID_MAIL: status_t = B_MAIL_ERROR_BASE + 7;
+
+// Print kit errors
+pub const B_NO_PRINT_SERVER: status_t = B_PRINT_ERROR_BASE + 0;
+
+// Device kit errors
+pub const B_DEV_INVALID_IOCTL: status_t = B_DEVICE_ERROR_BASE + 0;
+pub const B_DEV_NO_MEMORY: status_t = B_DEVICE_ERROR_BASE + 1;
+pub const B_DEV_BAD_DRIVE_NUM: status_t = B_DEVICE_ERROR_BASE + 2;
+pub const B_DEV_NO_MEDIA: status_t = B_DEVICE_ERROR_BASE + 3;
+pub const B_DEV_UNREADABLE: status_t = B_DEVICE_ERROR_BASE + 4;
+pub const B_DEV_FORMAT_ERROR: status_t = B_DEVICE_ERROR_BASE + 5;
+pub const B_DEV_TIMEOUT: status_t = B_DEVICE_ERROR_BASE + 6;
+pub const B_DEV_RECALIBRATE_ERROR: status_t = B_DEVICE_ERROR_BASE + 7;
+pub const B_DEV_SEEK_ERROR: status_t = B_DEVICE_ERROR_BASE + 8;
+pub const B_DEV_ID_ERROR: status_t = B_DEVICE_ERROR_BASE + 9;
+pub const B_DEV_READ_ERROR: status_t = B_DEVICE_ERROR_BASE + 10;
+pub const B_DEV_WRITE_ERROR: status_t = B_DEVICE_ERROR_BASE + 11;
+pub const B_DEV_NOT_READY: status_t = B_DEVICE_ERROR_BASE + 12;
+pub const B_DEV_MEDIA_CHANGED: status_t = B_DEVICE_ERROR_BASE + 13;
+pub const B_DEV_MEDIA_CHANGE_REQUESTED: status_t = B_DEVICE_ERROR_BASE + 14;
+pub const B_DEV_RESOURCE_CONFLICT: status_t = B_DEVICE_ERROR_BASE + 15;
+pub const B_DEV_CONFIGURATION_ERROR: status_t = B_DEVICE_ERROR_BASE + 16;
+pub const B_DEV_DISABLED_BY_USER: status_t = B_DEVICE_ERROR_BASE + 17;
+pub const B_DEV_DOOR_OPEN: status_t = B_DEVICE_ERROR_BASE + 18;
+
+pub const B_DEV_INVALID_PIPE: status_t = B_DEVICE_ERROR_BASE + 19;
+pub const B_DEV_CRC_ERROR: status_t = B_DEVICE_ERROR_BASE + 20;
+pub const B_DEV_STALLED: status_t = B_DEVICE_ERROR_BASE + 21;
+pub const B_DEV_BAD_PID: status_t = B_DEVICE_ERROR_BASE + 22;
+pub const B_DEV_UNEXPECTED_PID: status_t = B_DEVICE_ERROR_BASE + 23;
+pub const B_DEV_DATA_OVERRUN: status_t = B_DEVICE_ERROR_BASE + 24;
+pub const B_DEV_DATA_UNDERRUN: status_t = B_DEVICE_ERROR_BASE + 25;
+pub const B_DEV_FIFO_OVERRUN: status_t = B_DEVICE_ERROR_BASE + 26;
+pub const B_DEV_FIFO_UNDERRUN: status_t = B_DEVICE_ERROR_BASE + 27;
+pub const B_DEV_PENDING: status_t = B_DEVICE_ERROR_BASE + 28;
+pub const B_DEV_MULTIPLE_ERRORS: status_t = B_DEVICE_ERROR_BASE + 29;
+pub const B_DEV_TOO_LATE: status_t = B_DEVICE_ERROR_BASE + 30;
+
+// translation kit errors
+pub const B_TRANSLATION_BASE_ERROR: status_t = B_TRANSLATION_ERROR_BASE + 0;
+pub const B_NO_TRANSLATOR: status_t = B_TRANSLATION_ERROR_BASE + 1;
+pub const B_ILLEGAL_DATA: status_t = B_TRANSLATION_ERROR_BASE + 2;
+
+// support/TypeConstants.h
+pub const B_AFFINE_TRANSFORM_TYPE: u32 = haiku_constant!('A', 'M', 'T', 'X');
+pub const B_ALIGNMENT_TYPE: u32 = haiku_constant!('A', 'L', 'G', 'N');
+pub const B_ANY_TYPE: u32 = haiku_constant!('A', 'N', 'Y', 'T');
+pub const B_ATOM_TYPE: u32 = haiku_constant!('A', 'T', 'O', 'M');
+pub const B_ATOMREF_TYPE: u32 = haiku_constant!('A', 'T', 'M', 'R');
+pub const B_BOOL_TYPE: u32 = haiku_constant!('B', 'O', 'O', 'L');
+pub const B_CHAR_TYPE: u32 = haiku_constant!('C', 'H', 'A', 'R');
+pub const B_COLOR_8_BIT_TYPE: u32 = haiku_constant!('C', 'L', 'R', 'B');
+pub const B_DOUBLE_TYPE: u32 = haiku_constant!('D', 'B', 'L', 'E');
+pub const B_FLOAT_TYPE: u32 = haiku_constant!('F', 'L', 'O', 'T');
+pub const B_GRAYSCALE_8_BIT_TYPE: u32 = haiku_constant!('G', 'R', 'Y', 'B');
+pub const B_INT16_TYPE: u32 = haiku_constant!('S', 'H', 'R', 'T');
+pub const B_INT32_TYPE: u32 = haiku_constant!('L', 'O', 'N', 'G');
+pub const B_INT64_TYPE: u32 = haiku_constant!('L', 'L', 'N', 'G');
+pub const B_INT8_TYPE: u32 = haiku_constant!('B', 'Y', 'T', 'E');
+pub const B_LARGE_ICON_TYPE: u32 = haiku_constant!('I', 'C', 'O', 'N');
+pub const B_MEDIA_PARAMETER_GROUP_TYPE: u32 = haiku_constant!('B', 'M', 'C', 'G');
+pub const B_MEDIA_PARAMETER_TYPE: u32 = haiku_constant!('B', 'M', 'C', 'T');
+pub const B_MEDIA_PARAMETER_WEB_TYPE: u32 = haiku_constant!('B', 'M', 'C', 'W');
+pub const B_MESSAGE_TYPE: u32 = haiku_constant!('M', 'S', 'G', 'G');
+pub const B_MESSENGER_TYPE: u32 = haiku_constant!('M', 'S', 'N', 'G');
+pub const B_MIME_TYPE: u32 = haiku_constant!('M', 'I', 'M', 'E');
+pub const B_MINI_ICON_TYPE: u32 = haiku_constant!('M', 'I', 'C', 'N');
+pub const B_MONOCHROME_1_BIT_TYPE: u32 = haiku_constant!('M', 'N', 'O', 'B');
+pub const B_OBJECT_TYPE: u32 = haiku_constant!('O', 'P', 'T', 'R');
+pub const B_OFF_T_TYPE: u32 = haiku_constant!('O', 'F', 'F', 'T');
+pub const B_PATTERN_TYPE: u32 = haiku_constant!('P', 'A', 'T', 'N');
+pub const B_POINTER_TYPE: u32 = haiku_constant!('P', 'N', 'T', 'R');
+pub const B_POINT_TYPE: u32 = haiku_constant!('B', 'P', 'N', 'T');
+pub const B_PROPERTY_INFO_TYPE: u32 = haiku_constant!('S', 'C', 'T', 'D');
+pub const B_RAW_TYPE: u32 = haiku_constant!('R', 'A', 'W', 'T');
+pub const B_RECT_TYPE: u32 = haiku_constant!('R', 'E', 'C', 'T');
+pub const B_REF_TYPE: u32 = haiku_constant!('R', 'R', 'E', 'F');
+pub const B_RGB_32_BIT_TYPE: u32 = haiku_constant!('R', 'G', 'B', 'B');
+pub const B_RGB_COLOR_TYPE: u32 = haiku_constant!('R', 'G', 'B', 'C');
+pub const B_SIZE_TYPE: u32 = haiku_constant!('S', 'I', 'Z', 'E');
+pub const B_SIZE_T_TYPE: u32 = haiku_constant!('S', 'I', 'Z', 'T');
+pub const B_SSIZE_T_TYPE: u32 = haiku_constant!('S', 'S', 'Z', 'T');
+pub const B_STRING_TYPE: u32 = haiku_constant!('C', 'S', 'T', 'R');
+pub const B_STRING_LIST_TYPE: u32 = haiku_constant!('S', 'T', 'R', 'L');
+pub const B_TIME_TYPE: u32 = haiku_constant!('T', 'I', 'M', 'E');
+pub const B_UINT16_TYPE: u32 = haiku_constant!('U', 'S', 'H', 'T');
+pub const B_UINT32_TYPE: u32 = haiku_constant!('U', 'L', 'N', 'G');
+pub const B_UINT64_TYPE: u32 = haiku_constant!('U', 'L', 'L', 'G');
+pub const B_UINT8_TYPE: u32 = haiku_constant!('U', 'B', 'Y', 'T');
+pub const B_VECTOR_ICON_TYPE: u32 = haiku_constant!('V', 'I', 'C', 'N');
+pub const B_XATTR_TYPE: u32 = haiku_constant!('X', 'A', 'T', 'R');
+pub const B_NETWORK_ADDRESS_TYPE: u32 = haiku_constant!('N', 'W', 'A', 'D');
+pub const B_MIME_STRING_TYPE: u32 = haiku_constant!('M', 'I', 'M', 'S');
+pub const B_ASCII_TYPE: u32 = haiku_constant!('T', 'E', 'X', 'T');
+
+extern "C" {
+ // kernel/OS.h
+ pub fn create_area(
+ name: *const ::c_char,
+ startAddress: *mut *mut ::c_void,
+ addressSpec: u32,
+ size: usize,
+ lock: u32,
+ protection: u32,
+ ) -> area_id;
+ pub fn clone_area(
+ name: *const ::c_char,
+ destAddress: *mut *mut ::c_void,
+ addressSpec: u32,
+ protection: u32,
+ source: area_id,
+ ) -> area_id;
+ pub fn find_area(name: *const ::c_char) -> area_id;
+ pub fn area_for(address: *mut ::c_void) -> area_id;
+ pub fn delete_area(id: area_id) -> status_t;
+ pub fn resize_area(id: area_id, newSize: usize) -> status_t;
+ pub fn set_area_protection(id: area_id, newProtection: u32) -> status_t;
+ pub fn _get_area_info(id: area_id, areaInfo: *mut area_info, size: usize) -> status_t;
+ pub fn _get_next_area_info(
+ team: team_id,
+ cookie: *mut isize,
+ areaInfo: *mut area_info,
+ size: usize,
+ ) -> status_t;
+
+ pub fn create_port(capacity: i32, name: *const ::c_char) -> port_id;
+ pub fn find_port(name: *const ::c_char) -> port_id;
+ pub fn read_port(
+ port: port_id,
+ code: *mut i32,
+ buffer: *mut ::c_void,
+ bufferSize: ::size_t,
+ ) -> ::ssize_t;
+ pub fn read_port_etc(
+ port: port_id,
+ code: *mut i32,
+ buffer: *mut ::c_void,
+ bufferSize: ::size_t,
+ flags: u32,
+ timeout: bigtime_t,
+ ) -> ::ssize_t;
+ pub fn write_port(
+ port: port_id,
+ code: i32,
+ buffer: *const ::c_void,
+ bufferSize: ::size_t,
+ ) -> status_t;
+ pub fn write_port_etc(
+ port: port_id,
+ code: i32,
+ buffer: *const ::c_void,
+ bufferSize: ::size_t,
+ flags: u32,
+ timeout: bigtime_t,
+ ) -> status_t;
+ pub fn close_port(port: port_id) -> status_t;
+ pub fn delete_port(port: port_id) -> status_t;
+ pub fn port_buffer_size(port: port_id) -> ::ssize_t;
+ pub fn port_buffer_size_etc(port: port_id, flags: u32, timeout: bigtime_t) -> ::ssize_t;
+ pub fn port_count(port: port_id) -> ::ssize_t;
+ pub fn set_port_owner(port: port_id, team: team_id) -> status_t;
+
+ pub fn _get_port_info(port: port_id, buf: *mut port_info, portInfoSize: ::size_t) -> status_t;
+ pub fn _get_next_port_info(
+ port: port_id,
+ cookie: *mut i32,
+ portInfo: *mut port_info,
+ portInfoSize: ::size_t,
+ ) -> status_t;
+ pub fn _get_port_message_info_etc(
+ port: port_id,
+ info: *mut port_message_info,
+ infoSize: ::size_t,
+ flags: u32,
+ timeout: bigtime_t,
+ ) -> status_t;
+
+ pub fn create_sem(count: i32, name: *const ::c_char) -> sem_id;
+ pub fn delete_sem(id: sem_id) -> status_t;
+ pub fn acquire_sem(id: sem_id) -> status_t;
+ pub fn acquire_sem_etc(id: sem_id, count: i32, flags: u32, timeout: bigtime_t) -> status_t;
+ pub fn release_sem(id: sem_id) -> status_t;
+ pub fn release_sem_etc(id: sem_id, count: i32, flags: u32) -> status_t;
+ pub fn switch_sem(semToBeReleased: sem_id, id: sem_id) -> status_t;
+ pub fn switch_sem_etc(
+ semToBeReleased: sem_id,
+ id: sem_id,
+ count: i32,
+ flags: u32,
+ timeout: bigtime_t,
+ ) -> status_t;
+ pub fn get_sem_count(id: sem_id, threadCount: *mut i32) -> status_t;
+ pub fn set_sem_owner(id: sem_id, team: team_id) -> status_t;
+ pub fn _get_sem_info(id: sem_id, info: *mut sem_info, infoSize: ::size_t) -> status_t;
+ pub fn _get_next_sem_info(
+ team: team_id,
+ cookie: *mut i32,
+ info: *mut sem_info,
+ infoSize: ::size_t,
+ ) -> status_t;
+
+ pub fn kill_team(team: team_id) -> status_t;
+ pub fn _get_team_info(team: team_id, info: *mut team_info, size: ::size_t) -> status_t;
+ pub fn _get_next_team_info(cookie: *mut i32, info: *mut team_info, size: ::size_t) -> status_t;
+
+ pub fn spawn_thread(
+ func: thread_func,
+ name: *const ::c_char,
+ priority: i32,
+ data: *mut ::c_void,
+ ) -> thread_id;
+ pub fn kill_thread(thread: thread_id) -> status_t;
+ pub fn resume_thread(thread: thread_id) -> status_t;
+ pub fn suspend_thread(thread: thread_id) -> status_t;
+
+ pub fn rename_thread(thread: thread_id, newName: *const ::c_char) -> status_t;
+ pub fn set_thread_priority(thread: thread_id, newPriority: i32) -> status_t;
+ pub fn exit_thread(status: status_t);
+ pub fn wait_for_thread(thread: thread_id, returnValue: *mut status_t) -> status_t;
+ pub fn on_exit_thread(callback: extern "C" fn(*mut ::c_void), data: *mut ::c_void) -> status_t;
+
+ pub fn find_thread(name: *const ::c_char) -> thread_id;
+
+ pub fn send_data(
+ thread: thread_id,
+ code: i32,
+ buffer: *const ::c_void,
+ bufferSize: ::size_t,
+ ) -> status_t;
+ pub fn receive_data(sender: *mut thread_id, buffer: *mut ::c_void, bufferSize: ::size_t)
+ -> i32;
+ pub fn has_data(thread: thread_id) -> bool;
+
+ pub fn snooze(amount: bigtime_t) -> status_t;
+ pub fn snooze_etc(amount: bigtime_t, timeBase: ::c_int, flags: u32) -> status_t;
+ pub fn snooze_until(time: bigtime_t, timeBase: ::c_int) -> status_t;
+
+ pub fn _get_thread_info(id: thread_id, info: *mut thread_info, size: ::size_t) -> status_t;
+ pub fn _get_next_thread_info(
+ team: team_id,
+ cookie: *mut i32,
+ info: *mut thread_info,
+ size: ::size_t,
+ ) -> status_t;
+
+ pub fn get_pthread_thread_id(thread: ::pthread_t) -> thread_id;
+
+ pub fn _get_team_usage_info(
+ team: team_id,
+ who: i32,
+ info: *mut team_usage_info,
+ size: ::size_t,
+ ) -> status_t;
+
+ pub fn real_time_clock() -> ::c_ulong;
+ pub fn set_real_time_clock(secsSinceJan1st1970: ::c_ulong);
+ pub fn real_time_clock_usecs() -> bigtime_t;
+ pub fn system_time() -> bigtime_t;
+ pub fn system_time_nsecs() -> nanotime_t;
+ // set_timezone() is deprecated and a no-op
+
+ pub fn set_alarm(when: bigtime_t, flags: u32) -> bigtime_t;
+ pub fn debugger(message: *const ::c_char);
+ pub fn disable_debugger(state: ::c_int) -> ::c_int;
+
+ // TODO: cpuid_info struct and the get_cpuid() function
+
+ pub fn get_system_info(info: *mut system_info) -> status_t;
+ pub fn get_cpu_info(firstCPU: u32, cpuCount: u32, info: *mut cpu_info) -> status_t;
+ pub fn is_computer_on() -> i32;
+ pub fn is_computer_on_fire() -> ::c_double;
+ pub fn send_signal(threadID: thread_id, signal: ::c_uint) -> ::c_int;
+ pub fn set_signal_stack(base: *mut ::c_void, size: ::size_t);
+
+ pub fn wait_for_objects(infos: *mut object_wait_info, numInfos: ::c_int) -> ::ssize_t;
+ pub fn wait_for_objects_etc(
+ infos: *mut object_wait_info,
+ numInfos: ::c_int,
+ flags: u32,
+ timeout: bigtime_t,
+ ) -> ::ssize_t;
+
+ // kernel/fs_attr.h
+ pub fn fs_read_attr(
+ fd: ::c_int,
+ attribute: *const ::c_char,
+ type_: u32,
+ pos: ::off_t,
+ buffer: *mut ::c_void,
+ readBytes: ::size_t,
+ ) -> ::ssize_t;
+ pub fn fs_write_attr(
+ fd: ::c_int,
+ attribute: *const ::c_char,
+ type_: u32,
+ pos: ::off_t,
+ buffer: *const ::c_void,
+ writeBytes: ::size_t,
+ ) -> ::ssize_t;
+ pub fn fs_remove_attr(fd: ::c_int, attribute: *const ::c_char) -> ::c_int;
+ pub fn fs_stat_attr(
+ fd: ::c_int,
+ attribute: *const ::c_char,
+ attrInfo: *mut attr_info,
+ ) -> ::c_int;
+
+ pub fn fs_open_attr(
+ path: *const ::c_char,
+ attribute: *const ::c_char,
+ type_: u32,
+ openMode: ::c_int,
+ ) -> ::c_int;
+ pub fn fs_fopen_attr(
+ fd: ::c_int,
+ attribute: *const ::c_char,
+ type_: u32,
+ openMode: ::c_int,
+ ) -> ::c_int;
+ pub fn fs_close_attr(fd: ::c_int) -> ::c_int;
+
+ pub fn fs_open_attr_dir(path: *const ::c_char) -> *mut ::DIR;
+ pub fn fs_lopen_attr_dir(path: *const ::c_char) -> *mut ::DIR;
+ pub fn fs_fopen_attr_dir(fd: ::c_int) -> *mut ::DIR;
+ pub fn fs_close_attr_dir(dir: *mut ::DIR) -> ::c_int;
+ pub fn fs_read_attr_dir(dir: *mut ::DIR) -> *mut ::dirent;
+ pub fn fs_rewind_attr_dir(dir: *mut ::DIR);
+
+ // kernel/fs_image.h
+ pub fn fs_create_index(
+ device: ::dev_t,
+ name: *const ::c_char,
+ type_: u32,
+ flags: u32,
+ ) -> ::c_int;
+ pub fn fs_remove_index(device: ::dev_t, name: *const ::c_char) -> ::c_int;
+ pub fn fs_stat_index(
+ device: ::dev_t,
+ name: *const ::c_char,
+ indexInfo: *mut index_info,
+ ) -> ::c_int;
+
+ pub fn fs_open_index_dir(device: ::dev_t) -> *mut ::DIR;
+ pub fn fs_close_index_dir(indexDirectory: *mut ::DIR) -> ::c_int;
+ pub fn fs_read_index_dir(indexDirectory: *mut ::DIR) -> *mut ::dirent;
+ pub fn fs_rewind_index_dir(indexDirectory: *mut ::DIR);
+
+ // kernel/fs_info.h
+ pub fn dev_for_path(path: *const ::c_char) -> ::dev_t;
+ pub fn next_dev(pos: *mut i32) -> ::dev_t;
+ pub fn fs_stat_dev(dev: ::dev_t, info: *mut fs_info) -> ::c_int;
+
+ // kernel/fs_query.h
+ pub fn fs_open_query(device: ::dev_t, query: *const ::c_char, flags: u32) -> *mut ::DIR;
+ pub fn fs_open_live_query(
+ device: ::dev_t,
+ query: *const ::c_char,
+ flags: u32,
+ port: port_id,
+ token: i32,
+ ) -> *mut ::DIR;
+ pub fn fs_close_query(d: *mut ::DIR) -> ::c_int;
+ pub fn fs_read_query(d: *mut ::DIR) -> *mut ::dirent;
+ pub fn get_path_for_dirent(dent: *mut ::dirent, buf: *mut ::c_char, len: ::size_t) -> status_t;
+
+ // kernel/fs_volume.h
+ pub fn fs_mount_volume(
+ where_: *const ::c_char,
+ device: *const ::c_char,
+ filesystem: *const ::c_char,
+ flags: u32,
+ parameters: *const ::c_char,
+ ) -> ::dev_t;
+ pub fn fs_unmount_volume(path: *const ::c_char, flags: u32) -> status_t;
+
+ // kernel/image.h
+ pub fn load_image(
+ argc: i32,
+ argv: *mut *const ::c_char,
+ environ: *mut *const ::c_char,
+ ) -> thread_id;
+ pub fn load_add_on(path: *const ::c_char) -> image_id;
+ pub fn unload_add_on(image: image_id) -> status_t;
+ pub fn get_image_symbol(
+ image: image_id,
+ name: *const ::c_char,
+ symbolType: i32,
+ symbolLocation: *mut *mut ::c_void,
+ ) -> status_t;
+ pub fn get_nth_image_symbol(
+ image: image_id,
+ n: i32,
+ nameBuffer: *mut ::c_char,
+ nameLength: *mut i32,
+ symbolType: *mut i32,
+ symbolLocation: *mut *mut ::c_void,
+ ) -> status_t;
+ pub fn clear_caches(address: *mut ::c_void, length: ::size_t, flags: u32);
+ pub fn _get_image_info(image: image_id, info: *mut image_info, size: ::size_t) -> status_t;
+ pub fn _get_next_image_info(
+ team: team_id,
+ cookie: *mut i32,
+ info: *mut image_info,
+ size: ::size_t,
+ ) -> status_t;
+}
+
+// The following functions are defined as macros in C/C++
+pub unsafe fn get_area_info(id: area_id, info: *mut area_info) -> status_t {
+ _get_area_info(id, info, core::mem::size_of::<area_info>() as usize)
+}
+
+pub unsafe fn get_next_area_info(
+ team: team_id,
+ cookie: *mut isize,
+ info: *mut area_info,
+) -> status_t {
+ _get_next_area_info(
+ team,
+ cookie,
+ info,
+ core::mem::size_of::<area_info>() as usize,
+ )
+}
+
+pub unsafe fn get_port_info(port: port_id, buf: *mut port_info) -> status_t {
+ _get_port_info(port, buf, core::mem::size_of::<port_info>() as ::size_t)
+}
+
+pub unsafe fn get_next_port_info(
+ port: port_id,
+ cookie: *mut i32,
+ portInfo: *mut port_info,
+) -> status_t {
+ _get_next_port_info(
+ port,
+ cookie,
+ portInfo,
+ core::mem::size_of::<port_info>() as ::size_t,
+ )
+}
+
+pub unsafe fn get_port_message_info_etc(
+ port: port_id,
+ info: *mut port_message_info,
+ flags: u32,
+ timeout: bigtime_t,
+) -> status_t {
+ _get_port_message_info_etc(
+ port,
+ info,
+ core::mem::size_of::<port_message_info>() as ::size_t,
+ flags,
+ timeout,
+ )
+}
+
+pub unsafe fn get_sem_info(id: sem_id, info: *mut sem_info) -> status_t {
+ _get_sem_info(id, info, core::mem::size_of::<sem_info>() as ::size_t)
+}
+
+pub unsafe fn get_next_sem_info(team: team_id, cookie: *mut i32, info: *mut sem_info) -> status_t {
+ _get_next_sem_info(
+ team,
+ cookie,
+ info,
+ core::mem::size_of::<sem_info>() as ::size_t,
+ )
+}
+
+pub unsafe fn get_team_info(team: team_id, info: *mut team_info) -> status_t {
+ _get_team_info(team, info, core::mem::size_of::<team_info>() as ::size_t)
+}
+
+pub unsafe fn get_next_team_info(cookie: *mut i32, info: *mut team_info) -> status_t {
+ _get_next_team_info(cookie, info, core::mem::size_of::<team_info>() as ::size_t)
+}
+
+pub unsafe fn get_team_usage_info(team: team_id, who: i32, info: *mut team_usage_info) -> status_t {
+ _get_team_usage_info(
+ team,
+ who,
+ info,
+ core::mem::size_of::<team_usage_info>() as ::size_t,
+ )
+}
+
+pub unsafe fn get_thread_info(id: thread_id, info: *mut thread_info) -> status_t {
+ _get_thread_info(id, info, core::mem::size_of::<thread_info>() as ::size_t)
+}
+
+pub unsafe fn get_next_thread_info(
+ team: team_id,
+ cookie: *mut i32,
+ info: *mut thread_info,
+) -> status_t {
+ _get_next_thread_info(
+ team,
+ cookie,
+ info,
+ core::mem::size_of::<thread_info>() as ::size_t,
+ )
+}
+
+// kernel/image.h
+pub unsafe fn get_image_info(image: image_id, info: *mut image_info) -> status_t {
+ _get_image_info(image, info, core::mem::size_of::<image_info>() as ::size_t)
+}
+
+pub unsafe fn get_next_image_info(
+ team: team_id,
+ cookie: *mut i32,
+ info: *mut image_info,
+) -> status_t {
+ _get_next_image_info(
+ team,
+ cookie,
+ info,
+ core::mem::size_of::<image_info>() as ::size_t,
+ )
+}
diff --git a/src/unix/hermit/mod.rs b/src/unix/hermit/mod.rs
index 83e064e7..eedfd28a 100644
--- a/src/unix/hermit/mod.rs
+++ b/src/unix/hermit/mod.rs
@@ -1,13 +1,3 @@
-// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
// liblibc port for HermitCore (https://hermitcore.org)
// HermitCore is a unikernel based on lwIP, newlib, and
// pthread-embedded.
@@ -949,16 +939,20 @@ const ULONG_SIZE: usize = 64;
pub const WNOHANG: ::c_int = 0x00000001;
-f! {
- pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
+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 fn WIFEXITED(status: ::c_int) -> bool {
+ pub {const} fn WIFEXITED(status: ::c_int) -> bool {
(status & 0xff) == 0
}
- pub fn WTERMSIG(status: ::c_int) -> ::c_int {
+ pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
status & 0x7f
}
}
@@ -966,18 +960,10 @@ f! {
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 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 sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int;
pub fn abs(i: ::c_int) -> ::c_int;
pub fn atof(s: *const ::c_char) -> ::c_double;
@@ -985,16 +971,9 @@ extern "C" {
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 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 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(
@@ -1017,11 +996,7 @@ extern "C" {
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 pthread_sigmask(how: ::c_int, set: *const ::sigset_t, oset: *mut ::sigset_t) -> ::c_int;
pub fn recvfrom(
s: ::c_int,
diff --git a/src/unix/linux_like/android/b32/arm.rs b/src/unix/linux_like/android/b32/arm.rs
index 1320b16a..6fd47679 100644
--- a/src/unix/linux_like/android/b32/arm.rs
+++ b/src/unix/linux_like/android/b32/arm.rs
@@ -1,5 +1,151 @@
pub type c_char = u8;
pub type wchar_t = u32;
+pub type greg_t = i32;
+pub type mcontext_t = sigcontext;
+
+s! {
+ pub struct sigcontext {
+ pub trap_no: ::c_ulong,
+ pub error_code: ::c_ulong,
+ pub oldmask: ::c_ulong,
+ pub arm_r0: ::c_ulong,
+ pub arm_r1: ::c_ulong,
+ pub arm_r2: ::c_ulong,
+ pub arm_r3: ::c_ulong,
+ pub arm_r4: ::c_ulong,
+ pub arm_r5: ::c_ulong,
+ pub arm_r6: ::c_ulong,
+ pub arm_r7: ::c_ulong,
+ pub arm_r8: ::c_ulong,
+ pub arm_r9: ::c_ulong,
+ pub arm_r10: ::c_ulong,
+ pub arm_fp: ::c_ulong,
+ pub arm_ip: ::c_ulong,
+ pub arm_sp: ::c_ulong,
+ pub arm_lr: ::c_ulong,
+ pub arm_pc: ::c_ulong,
+ pub arm_cpsr: ::c_ulong,
+ pub fault_address: ::c_ulong,
+ }
+}
+
+cfg_if! {
+ if #[cfg(libc_union)] {
+ s_no_extra_traits! {
+ pub struct __c_anonymous_uc_sigmask_with_padding {
+ pub uc_sigmask: ::sigset_t,
+ /* Android has a wrong (smaller) sigset_t on x86. */
+ __padding_rt_sigset: u32,
+ }
+
+ pub union __c_anonymous_uc_sigmask {
+ uc_sigmask: __c_anonymous_uc_sigmask_with_padding,
+ uc_sigmask64: ::sigset64_t,
+ }
+
+ pub struct ucontext_t {
+ pub uc_flags: ::c_ulong,
+ pub uc_link: *mut ucontext_t,
+ pub uc_stack: ::stack_t,
+ pub uc_mcontext: mcontext_t,
+ pub uc_sigmask__c_anonymous_union: __c_anonymous_uc_sigmask,
+ /* The kernel adds extra padding after uc_sigmask to match
+ * glibc sigset_t on ARM. */
+ __padding: [c_char; 120],
+ __align: [::c_longlong; 0],
+ uc_regspace: [::c_ulong; 128],
+ }
+ }
+
+ cfg_if! {
+ if #[cfg(feature = "extra_traits")] {
+ impl PartialEq for __c_anonymous_uc_sigmask_with_padding {
+ fn eq(
+ &self, other: &__c_anonymous_uc_sigmask_with_padding
+ ) -> bool {
+ self.uc_sigmask == other.uc_sigmask
+ // Ignore padding
+ }
+ }
+ impl Eq for __c_anonymous_uc_sigmask_with_padding {}
+ impl ::fmt::Debug for __c_anonymous_uc_sigmask_with_padding {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("uc_sigmask_with_padding")
+ .field("uc_sigmask_with_padding", &self.uc_sigmask)
+ // Ignore padding
+ .finish()
+ }
+ }
+ impl ::hash::Hash for __c_anonymous_uc_sigmask_with_padding {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.uc_sigmask.hash(state)
+ // Ignore padding
+ }
+ }
+
+ impl PartialEq for __c_anonymous_uc_sigmask {
+ fn eq(&self, other: &__c_anonymous_uc_sigmask) -> bool {
+ unsafe { self.uc_sigmask == other.uc_sigmask }
+ }
+ }
+ impl Eq for __c_anonymous_uc_sigmask {}
+ impl ::fmt::Debug for __c_anonymous_uc_sigmask {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("uc_sigmask")
+ .field("uc_sigmask", unsafe { &self.uc_sigmask })
+ .finish()
+ }
+ }
+ impl ::hash::Hash for __c_anonymous_uc_sigmask {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ unsafe { self.uc_sigmask.hash(state) }
+ }
+ }
+
+ impl PartialEq for ucontext_t {
+ fn eq(&self, other: &Self) -> bool {
+ self.uc_flags == other.uc_flags
+ && self.uc_link == other.uc_link
+ && self.uc_stack == other.uc_stack
+ && self.uc_mcontext == other.uc_mcontext
+ && self.uc_sigmask__c_anonymous_union
+ == other.uc_sigmask__c_anonymous_union
+ && &self.uc_regspace[..] == &other.uc_regspace[..]
+ // Ignore padding field
+ }
+ }
+ impl Eq for ucontext_t {}
+ impl ::fmt::Debug for ucontext_t {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("ucontext_t")
+ .field("uc_flags", &self.uc_flags)
+ .field("uc_link", &self.uc_link)
+ .field("uc_stack", &self.uc_stack)
+ .field("uc_mcontext", &self.uc_mcontext)
+ .field(
+ "uc_sigmask__c_anonymous_union",
+ &self.uc_sigmask__c_anonymous_union
+ )
+ .field("uc_regspace", &&self.uc_regspace[..])
+ // Ignore padding field
+ .finish()
+ }
+ }
+ impl ::hash::Hash for ucontext_t {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.uc_flags.hash(state);
+ self.uc_link.hash(state);
+ self.uc_stack.hash(state);
+ self.uc_mcontext.hash(state);
+ self.uc_sigmask__c_anonymous_union.hash(state);
+ &self.uc_regspace[..].hash(state);
+ // Ignore padding field
+ }
+ }
+ }
+ }
+ }
+}
pub const O_DIRECT: ::c_int = 0x10000;
pub const O_DIRECTORY: ::c_int = 0x4000;
@@ -355,3 +501,41 @@ pub const SYS_pwritev2: ::c_long = 393;
pub const SYS_pkey_mprotect: ::c_long = 394;
pub const SYS_pkey_alloc: ::c_long = 395;
pub const SYS_pkey_free: ::c_long = 396;
+pub const SYS_io_uring_setup: ::c_long = 425;
+pub const SYS_io_uring_enter: ::c_long = 426;
+
+// offsets in mcontext_t.gregs from sys/ucontext.h
+pub const REG_R0: ::c_int = 0;
+pub const REG_R1: ::c_int = 1;
+pub const REG_R2: ::c_int = 2;
+pub const REG_R3: ::c_int = 3;
+pub const REG_R4: ::c_int = 4;
+pub const REG_R5: ::c_int = 5;
+pub const REG_R6: ::c_int = 6;
+pub const REG_R7: ::c_int = 7;
+pub const REG_R8: ::c_int = 8;
+pub const REG_R9: ::c_int = 9;
+pub const REG_R10: ::c_int = 10;
+pub const REG_R11: ::c_int = 11;
+pub const REG_R12: ::c_int = 12;
+pub const REG_R13: ::c_int = 13;
+pub const REG_R14: ::c_int = 14;
+pub const REG_R15: ::c_int = 15;
+
+pub const NGREG: ::c_int = 18;
+
+f! {
+ // Sadly, Android before 5.0 (API level 21), the accept4 syscall is not
+ // exposed by the libc. As work-around, we implement it through `syscall`
+ // directly. This workaround can be removed if the minimum version of
+ // Android is bumped. When the workaround is removed, `accept4` can be
+ // moved back to `linux_like/mod.rs`
+ pub fn accept4(
+ fd: ::c_int,
+ addr: *mut ::sockaddr,
+ len: *mut ::socklen_t,
+ flg: ::c_int
+ ) -> ::c_int {
+ ::syscall(SYS_accept4, fd, addr, len, flg) as ::c_int
+ }
+}
diff --git a/src/unix/linux_like/android/b32/mod.rs b/src/unix/linux_like/android/b32/mod.rs
index e5c97e9e..77469070 100644
--- a/src/unix/linux_like/android/b32/mod.rs
+++ b/src/unix/linux_like/android/b32/mod.rs
@@ -74,7 +74,7 @@ s! {
pub f_bavail: u64,
pub f_files: u64,
pub f_ffree: u64,
- f_fsid: [u32; 2],
+ pub f_fsid: ::__fsid_t,
pub f_namelen: u32,
pub f_frsize: u32,
pub f_flags: u32,
@@ -161,6 +161,24 @@ s! {
}
}
+s_no_extra_traits! {
+ pub struct sigset64_t {
+ __bits: [::c_ulong; 2]
+ }
+}
+
+cfg_if! {
+ if #[cfg(feature = "extra_traits")] {
+ impl ::fmt::Debug for sigset64_t {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("sigset64_t")
+ .field("__bits", &self.__bits)
+ .finish()
+ }
+ }
+ }
+}
+
// These constants must be of the same type of sigaction.sa_flags
pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
@@ -179,10 +197,8 @@ pub const PTRACE_SETFPREGS: ::c_int = 15;
pub const PTRACE_GETREGS: ::c_int = 12;
pub const PTRACE_SETREGS: ::c_int = 13;
-pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t =
- pthread_mutex_t { value: 0 };
-pub const PTHREAD_COND_INITIALIZER: pthread_cond_t =
- pthread_cond_t { value: 0 };
+pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { value: 0 };
+pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { value: 0 };
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
lock: PTHREAD_MUTEX_INITIALIZER,
cond: PTHREAD_COND_INITIALIZER,
diff --git a/src/unix/linux_like/android/b32/x86/mod.rs b/src/unix/linux_like/android/b32/x86/mod.rs
index 101bf2d5..ee537fd0 100644
--- a/src/unix/linux_like/android/b32/x86/mod.rs
+++ b/src/unix/linux_like/android/b32/x86/mod.rs
@@ -1,5 +1,144 @@
pub type c_char = i8;
pub type wchar_t = i32;
+pub type greg_t = i32;
+
+s! {
+ pub struct _libc_fpreg {
+ pub significand: [u16; 4],
+ pub exponent: u16,
+ }
+
+ pub struct _libc_fpstate {
+ pub cw: ::c_ulong,
+ pub sw: ::c_ulong,
+ pub tag: ::c_ulong,
+ pub ipoff: ::c_ulong,
+ pub cssel: ::c_ulong,
+ pub dataoff: ::c_ulong,
+ pub datasel: ::c_ulong,
+ pub _st: [_libc_fpreg; 8],
+ pub status: ::c_ulong,
+ }
+
+ pub struct mcontext_t {
+ pub gregs: [greg_t; 19],
+ pub fpregs: *mut _libc_fpstate,
+ pub oldmask: ::c_ulong,
+ pub cr2: ::c_ulong,
+ }
+}
+
+cfg_if! {
+ if #[cfg(libc_union)] {
+ s_no_extra_traits! {
+ pub struct __c_anonymous_uc_sigmask_with_padding {
+ pub uc_sigmask: ::sigset_t,
+ /* Android has a wrong (smaller) sigset_t on x86. */
+ __padding_rt_sigset: u32,
+ }
+
+ pub union __c_anonymous_uc_sigmask {
+ uc_sigmask: __c_anonymous_uc_sigmask_with_padding,
+ uc_sigmask64: ::sigset64_t,
+ }
+
+ pub struct ucontext_t {
+ pub uc_flags: ::c_ulong,
+ pub uc_link: *mut ucontext_t,
+ pub uc_stack: ::stack_t,
+ pub uc_mcontext: mcontext_t,
+ pub uc_sigmask__c_anonymous_union: __c_anonymous_uc_sigmask,
+ __padding_rt_sigset: u32,
+ __fpregs_mem: _libc_fpstate,
+ }
+ }
+
+ cfg_if! {
+ if #[cfg(feature = "extra_traits")] {
+ impl PartialEq for __c_anonymous_uc_sigmask_with_padding {
+ fn eq(
+ &self, other: &__c_anonymous_uc_sigmask_with_padding
+ ) -> bool {
+ self.uc_sigmask == other.uc_sigmask
+ // Ignore padding
+ }
+ }
+ impl Eq for __c_anonymous_uc_sigmask_with_padding {}
+ impl ::fmt::Debug for __c_anonymous_uc_sigmask_with_padding {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("uc_sigmask_with_padding")
+ .field("uc_sigmask_with_padding", &self.uc_sigmask)
+ // Ignore padding
+ .finish()
+ }
+ }
+ impl ::hash::Hash for __c_anonymous_uc_sigmask_with_padding {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.uc_sigmask.hash(state)
+ // Ignore padding
+ }
+ }
+
+ impl PartialEq for __c_anonymous_uc_sigmask {
+ fn eq(&self, other: &__c_anonymous_uc_sigmask) -> bool {
+ unsafe { self.uc_sigmask == other.uc_sigmask }
+ }
+ }
+ impl Eq for __c_anonymous_uc_sigmask {}
+ impl ::fmt::Debug for __c_anonymous_uc_sigmask {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("uc_sigmask")
+ .field("uc_sigmask", unsafe { &self.uc_sigmask })
+ .finish()
+ }
+ }
+ impl ::hash::Hash for __c_anonymous_uc_sigmask {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ unsafe { self.uc_sigmask.hash(state) }
+ }
+ }
+
+ impl PartialEq for ucontext_t {
+ fn eq(&self, other: &Self) -> bool {
+ self.uc_flags == other.uc_flags
+ && self.uc_link == other.uc_link
+ && self.uc_stack == other.uc_stack
+ && self.uc_mcontext == other.uc_mcontext
+ && self.uc_sigmask__c_anonymous_union
+ == other.uc_sigmask__c_anonymous_union
+ // Ignore padding field
+ }
+ }
+ impl Eq for ucontext_t {}
+ impl ::fmt::Debug for ucontext_t {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("ucontext_t")
+ .field("uc_flags", &self.uc_flags)
+ .field("uc_link", &self.uc_link)
+ .field("uc_stack", &self.uc_stack)
+ .field("uc_mcontext", &self.uc_mcontext)
+ .field(
+ "uc_sigmask__c_anonymous_union",
+ &self.uc_sigmask__c_anonymous_union
+ )
+ // Ignore padding field
+ .finish()
+ }
+ }
+ impl ::hash::Hash for ucontext_t {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.uc_flags.hash(state);
+ self.uc_link.hash(state);
+ self.uc_stack.hash(state);
+ self.uc_mcontext.hash(state);
+ self.uc_sigmask__c_anonymous_union.hash(state);
+ // Ignore padding field
+ }
+ }
+ }
+ }
+ }
+}
pub const O_DIRECT: ::c_int = 0x4000;
pub const O_DIRECTORY: ::c_int = 0x10000;
@@ -394,6 +533,8 @@ pub const SYS_pwritev2: ::c_long = 379;
pub const SYS_pkey_mprotect: ::c_long = 380;
pub const SYS_pkey_alloc: ::c_long = 381;
pub const SYS_pkey_free: ::c_long = 382;
+pub const SYS_io_uring_setup: ::c_long = 425;
+pub const SYS_io_uring_enter: ::c_long = 426;
// offsets in user_regs_structs, from sys/reg.h
pub const EBX: ::c_int = 0;
@@ -414,6 +555,56 @@ pub const EFL: ::c_int = 14;
pub const UESP: ::c_int = 15;
pub const SS: ::c_int = 16;
+// offsets in mcontext_t.gregs from sys/ucontext.h
+pub const REG_GS: ::c_int = 0;
+pub const REG_FS: ::c_int = 1;
+pub const REG_ES: ::c_int = 2;
+pub const REG_DS: ::c_int = 3;
+pub const REG_EDI: ::c_int = 4;
+pub const REG_ESI: ::c_int = 5;
+pub const REG_EBP: ::c_int = 6;
+pub const REG_ESP: ::c_int = 7;
+pub const REG_EBX: ::c_int = 8;
+pub const REG_EDX: ::c_int = 9;
+pub const REG_ECX: ::c_int = 10;
+pub const REG_EAX: ::c_int = 11;
+pub const REG_TRAPNO: ::c_int = 12;
+pub const REG_ERR: ::c_int = 13;
+pub const REG_EIP: ::c_int = 14;
+pub const REG_CS: ::c_int = 15;
+pub const REG_EFL: ::c_int = 16;
+pub const REG_UESP: ::c_int = 17;
+pub const REG_SS: ::c_int = 18;
+
+// socketcall values from linux/net.h (only the needed ones, and not public)
+const SYS_ACCEPT4: ::c_int = 18;
+
+f! {
+ // Sadly, Android before 5.0 (API level 21), the accept4 syscall is not
+ // exposed by the libc. As work-around, we implement it as raw syscall.
+ // Note that for x86, the `accept4` syscall is not available either,
+ // and we must use the `socketcall` syscall instead.
+ // This workaround can be removed if the minimum Android version is bumped.
+ // When the workaround is removed, `accept4` can be moved back
+ // to `linux_like/mod.rs`
+ pub fn accept4(
+ fd: ::c_int,
+ addr: *mut ::sockaddr,
+ len: *mut ::socklen_t,
+ flg: ::c_int
+ ) -> ::c_int {
+ // Arguments are passed as array of `long int`
+ // (which is big enough on x86 for a pointer).
+ let mut args = [
+ fd as ::c_long,
+ addr as ::c_long,
+ len as ::c_long,
+ flg as ::c_long,
+ ];
+ ::syscall(SYS_socketcall, SYS_ACCEPT4, args[..].as_mut_ptr())
+ }
+}
+
cfg_if! {
if #[cfg(libc_align)] {
mod align;
diff --git a/src/unix/linux_like/android/b64/aarch64/align.rs b/src/unix/linux_like/android/b64/aarch64/align.rs
index 8e949963..154c2c54 100644
--- a/src/unix/linux_like/android/b64/aarch64/align.rs
+++ b/src/unix/linux_like/android/b64/aarch64/align.rs
@@ -5,3 +5,25 @@ s_no_extra_traits! {
priv_: [f32; 8]
}
}
+
+s! {
+ pub struct ucontext_t {
+ pub uc_flags: ::c_ulong,
+ pub uc_link: *mut ucontext_t,
+ pub uc_stack: ::stack_t,
+ pub uc_sigmask: ::sigset_t,
+ pub uc_mcontext: mcontext_t,
+ }
+
+ #[repr(align(16))]
+ pub struct mcontext_t {
+ pub fault_address: ::c_ulonglong,
+ pub regs: [::c_ulonglong; 31],
+ pub sp: ::c_ulonglong,
+ pub pc: ::c_ulonglong,
+ pub pstate: ::c_ulonglong,
+ // nested arrays to get the right size/length while being able to
+ // auto-derive traits like Debug
+ __reserved: [[u64; 32]; 16],
+ }
+}
diff --git a/src/unix/linux_like/android/b64/aarch64/mod.rs b/src/unix/linux_like/android/b64/aarch64/mod.rs
index b2b91889..316596f5 100644
--- a/src/unix/linux_like/android/b64/aarch64/mod.rs
+++ b/src/unix/linux_like/android/b64/aarch64/mod.rs
@@ -57,6 +57,49 @@ pub const O_LARGEFILE: ::c_int = 0o400000;
pub const SIGSTKSZ: ::size_t = 16384;
pub const MINSIGSTKSZ: ::size_t = 5120;
+// From NDK's asm/hwcap.h
+pub const HWCAP_FP: ::c_ulong = 1 << 0;
+pub const HWCAP_ASIMD: ::c_ulong = 1 << 1;
+pub const HWCAP_EVTSTRM: ::c_ulong = 1 << 2;
+pub const HWCAP_AES: ::c_ulong = 1 << 3;
+pub const HWCAP_PMULL: ::c_ulong = 1 << 4;
+pub const HWCAP_SHA1: ::c_ulong = 1 << 5;
+pub const HWCAP_SHA2: ::c_ulong = 1 << 6;
+pub const HWCAP_CRC32: ::c_ulong = 1 << 7;
+pub const HWCAP_ATOMICS: ::c_ulong = 1 << 8;
+pub const HWCAP_FPHP: ::c_ulong = 1 << 9;
+pub const HWCAP_ASIMDHP: ::c_ulong = 1 << 10;
+pub const HWCAP_CPUID: ::c_ulong = 1 << 11;
+pub const HWCAP_ASIMDRDM: ::c_ulong = 1 << 12;
+pub const HWCAP_JSCVT: ::c_ulong = 1 << 13;
+pub const HWCAP_FCMA: ::c_ulong = 1 << 14;
+pub const HWCAP_LRCPC: ::c_ulong = 1 << 15;
+pub const HWCAP_DCPOP: ::c_ulong = 1 << 16;
+pub const HWCAP_SHA3: ::c_ulong = 1 << 17;
+pub const HWCAP_SM3: ::c_ulong = 1 << 18;
+pub const HWCAP_SM4: ::c_ulong = 1 << 19;
+pub const HWCAP_ASIMDDP: ::c_ulong = 1 << 20;
+pub const HWCAP_SHA512: ::c_ulong = 1 << 21;
+pub const HWCAP_SVE: ::c_ulong = 1 << 22;
+pub const HWCAP_ASIMDFHM: ::c_ulong = 1 << 23;
+pub const HWCAP_DIT: ::c_ulong = 1 << 24;
+pub const HWCAP_USCAT: ::c_ulong = 1 << 25;
+pub const HWCAP_ILRCPC: ::c_ulong = 1 << 26;
+pub const HWCAP_FLAGM: ::c_ulong = 1 << 27;
+pub const HWCAP_SSBS: ::c_ulong = 1 << 28;
+pub const HWCAP_SB: ::c_ulong = 1 << 29;
+pub const HWCAP_PACA: ::c_ulong = 1 << 30;
+pub const HWCAP_PACG: ::c_ulong = 1 << 31;
+pub const HWCAP2_DCPODP: ::c_ulong = 1 << 0;
+pub const HWCAP2_SVE2: ::c_ulong = 1 << 1;
+pub const HWCAP2_SVEAES: ::c_ulong = 1 << 2;
+pub const HWCAP2_SVEPMULL: ::c_ulong = 1 << 3;
+pub const HWCAP2_SVEBITPERM: ::c_ulong = 1 << 4;
+pub const HWCAP2_SVESHA3: ::c_ulong = 1 << 5;
+pub const HWCAP2_SVESM4: ::c_ulong = 1 << 6;
+pub const HWCAP2_FLAGM2: ::c_ulong = 1 << 7;
+pub const HWCAP2_FRINT: ::c_ulong = 1 << 8;
+
pub const SYS_io_setup: ::c_long = 0;
pub const SYS_io_destroy: ::c_long = 1;
pub const SYS_io_submit: ::c_long = 2;
@@ -322,7 +365,9 @@ 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_syscalls: ::c_long = 292;
+pub const SYS_io_uring_setup: ::c_long = 425;
+pub const SYS_io_uring_enter: ::c_long = 426;
+pub const SYS_syscalls: ::c_long = 436;
cfg_if! {
if #[cfg(libc_align)] {
diff --git a/src/unix/linux_like/android/b64/mod.rs b/src/unix/linux_like/android/b64/mod.rs
index 9826bb9e..c23e2dbf 100644
--- a/src/unix/linux_like/android/b64/mod.rs
+++ b/src/unix/linux_like/android/b64/mod.rs
@@ -84,7 +84,7 @@ s! {
pub f_bavail: u64,
pub f_files: u64,
pub f_ffree: u64,
- f_fsid: [u32; 2],
+ pub f_fsid: ::__fsid_t,
pub f_namelen: u64,
pub f_frsize: u64,
pub f_flags: u64,
@@ -126,6 +126,10 @@ s_no_extra_traits! {
attr: i32,
__reserved: [::c_char; 36],
}
+
+ pub struct sigset64_t {
+ __bits: [::c_ulong; 1]
+ }
}
cfg_if! {
@@ -228,6 +232,14 @@ cfg_if! {
self.__reserved.hash(state);
}
}
+
+ impl ::fmt::Debug for sigset64_t {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("sigset64_t")
+ .field("__bits", &self.__bits)
+ .finish()
+ }
+ }
}
}
@@ -244,6 +256,31 @@ pub const RTLD_GLOBAL: ::c_int = 0x00100;
pub const RTLD_NOW: ::c_int = 2;
pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
+// From NDK's linux/auxvec.h
+pub const AT_NULL: ::c_ulong = 0;
+pub const AT_IGNORE: ::c_ulong = 1;
+pub const AT_EXECFD: ::c_ulong = 2;
+pub const AT_PHDR: ::c_ulong = 3;
+pub const AT_PHENT: ::c_ulong = 4;
+pub const AT_PHNUM: ::c_ulong = 5;
+pub const AT_PAGESZ: ::c_ulong = 6;
+pub const AT_BASE: ::c_ulong = 7;
+pub const AT_FLAGS: ::c_ulong = 8;
+pub const AT_ENTRY: ::c_ulong = 9;
+pub const AT_NOTELF: ::c_ulong = 10;
+pub const AT_UID: ::c_ulong = 11;
+pub const AT_EUID: ::c_ulong = 12;
+pub const AT_GID: ::c_ulong = 13;
+pub const AT_EGID: ::c_ulong = 14;
+pub const AT_PLATFORM: ::c_ulong = 15;
+pub const AT_HWCAP: ::c_ulong = 16;
+pub const AT_CLKTCK: ::c_ulong = 17;
+pub const AT_SECURE: ::c_ulong = 23;
+pub const AT_BASE_PLATFORM: ::c_ulong = 24;
+pub const AT_RANDOM: ::c_ulong = 25;
+pub const AT_HWCAP2: ::c_ulong = 26;
+pub const AT_EXECFN: ::c_ulong = 31;
+
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
value: 0,
__reserved: [0; 36],
@@ -268,6 +305,26 @@ pub const UT_LINESIZE: usize = 32;
pub const UT_NAMESIZE: usize = 32;
pub const UT_HOSTSIZE: usize = 256;
+f! {
+ // Sadly, Android before 5.0 (API level 21), the accept4 syscall is not
+ // exposed by the libc. As work-around, we implement it through `syscall`
+ // directly. This workaround can be removed if the minimum version of
+ // Android is bumped. When the workaround is removed, `accept4` can be
+ // moved back to `linux_like/mod.rs`
+ pub fn accept4(
+ fd: ::c_int,
+ addr: *mut ::sockaddr,
+ len: *mut ::socklen_t,
+ flg: ::c_int
+ ) -> ::c_int {
+ ::syscall(SYS_accept4, fd, addr, len, flg) as ::c_int
+ }
+}
+
+extern "C" {
+ pub fn getauxval(type_: ::c_ulong) -> ::c_ulong;
+}
+
cfg_if! {
if #[cfg(target_arch = "x86_64")] {
mod x86_64;
diff --git a/src/unix/linux_like/android/b64/x86_64/mod.rs b/src/unix/linux_like/android/b64/x86_64/mod.rs
index f5b8b16e..5b559dde 100644
--- a/src/unix/linux_like/android/b64/x86_64/mod.rs
+++ b/src/unix/linux_like/android/b64/x86_64/mod.rs
@@ -1,5 +1,6 @@
pub type c_char = i8;
pub type wchar_t = i32;
+pub type greg_t = i64;
s! {
pub struct stat {
@@ -41,6 +42,218 @@ s! {
pub st_ctime_nsec: ::c_long,
__unused: [::c_long; 3],
}
+
+ pub struct _libc_xmmreg {
+ pub element: [u32; 4],
+ }
+}
+
+cfg_if! {
+ if #[cfg(libc_union)] {
+ s_no_extra_traits! {
+ pub union __c_anonymous_uc_sigmask {
+ uc_sigmask: ::sigset_t,
+ uc_sigmask64: ::sigset64_t,
+ }
+ }
+
+ cfg_if! {
+ if #[cfg(feature = "extra_traits")] {
+ impl PartialEq for __c_anonymous_uc_sigmask {
+ fn eq(&self, other: &__c_anonymous_uc_sigmask) -> bool {
+ unsafe { self.uc_sigmask == other.uc_sigmask }
+ }
+ }
+ impl Eq for __c_anonymous_uc_sigmask {}
+ impl ::fmt::Debug for __c_anonymous_uc_sigmask {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("uc_sigmask")
+ .field("uc_sigmask", unsafe { &self.uc_sigmask })
+ .finish()
+ }
+ }
+ impl ::hash::Hash for __c_anonymous_uc_sigmask {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ unsafe { self.uc_sigmask.hash(state) }
+ }
+ }
+ }
+ }
+ }
+}
+
+s_no_extra_traits! {
+ pub struct _libc_fpxreg {
+ pub significand: [u16; 4],
+ pub exponent: u16,
+ __padding: [u16; 3],
+ }
+
+ pub struct _libc_fpstate {
+ pub cwd: u16,
+ pub swd: u16,
+ pub ftw: u16,
+ pub fop: u16,
+ pub rip: u64,
+ pub rdp: u64,
+ pub mxcsr: u32,
+ pub mxcr_mask: u32,
+ pub _st: [_libc_fpxreg; 8],
+ pub _xmm: [_libc_xmmreg; 16],
+ __private: [u32; 24],
+ }
+
+ pub struct mcontext_t {
+ pub gregs: [greg_t; 23],
+ pub fpregs: *mut _libc_fpstate,
+ __private: [u64; 8],
+ }
+
+ pub struct ucontext_t {
+ pub uc_flags: ::c_ulong,
+ pub uc_link: *mut ucontext_t,
+ pub uc_stack: ::stack_t,
+ pub uc_mcontext: mcontext_t,
+ pub uc_sigmask64: __c_anonymous_uc_sigmask,
+ __fpregs_mem: _libc_fpstate,
+ }
+}
+
+cfg_if! {
+ if #[cfg(feature = "extra_traits")] {
+ impl PartialEq for _libc_fpxreg {
+ fn eq(&self, other: &Self) -> bool {
+ self.significand == other.significand
+ && self.exponent == other.exponent
+ // Ignore padding field
+ }
+ }
+ impl Eq for _libc_fpxreg {}
+ impl ::fmt::Debug for _libc_fpxreg {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("_libc_fpxreg")
+ .field("significand", &self.significand)
+ .field("exponent", &self.exponent)
+ // Ignore padding field
+ .finish()
+ }
+ }
+ impl ::hash::Hash for _libc_fpxreg {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.significand.hash(state);
+ self.exponent.hash(state);
+ // Ignore padding field
+ }
+ }
+
+ impl PartialEq for _libc_fpstate {
+ fn eq(&self, other: &Self) -> bool {
+ self.cwd == other.cwd
+ && self.swd == other.swd
+ && self.ftw == other.ftw
+ && self.fop == other.fop
+ && self.rip == other.rip
+ && self.rdp == other.rdp
+ && self.mxcsr == other.mxcsr
+ && self.mxcr_mask == other.mxcr_mask
+ && self._st == other._st
+ && self._xmm == other._xmm
+ // Ignore padding field
+ }
+ }
+ impl Eq for _libc_fpstate {}
+ impl ::fmt::Debug for _libc_fpstate {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("_libc_fpstate")
+ .field("cwd", &self.cwd)
+ .field("swd", &self.swd)
+ .field("ftw", &self.ftw)
+ .field("fop", &self.fop)
+ .field("rip", &self.rip)
+ .field("rdp", &self.rdp)
+ .field("mxcsr", &self.mxcsr)
+ .field("mxcr_mask", &self.mxcr_mask)
+ .field("_st", &self._st)
+ .field("_xmm", &self._xmm)
+ // Ignore padding field
+ .finish()
+ }
+ }
+ impl ::hash::Hash for _libc_fpstate {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.cwd.hash(state);
+ self.swd.hash(state);
+ self.ftw.hash(state);
+ self.fop.hash(state);
+ self.rip.hash(state);
+ self.rdp.hash(state);
+ self.mxcsr.hash(state);
+ self.mxcr_mask.hash(state);
+ self._st.hash(state);
+ self._xmm.hash(state);
+ // Ignore padding field
+ }
+ }
+
+ impl PartialEq for mcontext_t {
+ fn eq(&self, other: &Self) -> bool {
+ self.gregs == other.gregs
+ && self.fpregs == other.fpregs
+ // Ignore padding field
+ }
+ }
+ impl Eq for mcontext_t {}
+ impl ::fmt::Debug for mcontext_t {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("mcontext_t")
+ .field("gregs", &self.gregs)
+ .field("fpregs", &self.fpregs)
+ // Ignore padding field
+ .finish()
+ }
+ }
+ impl ::hash::Hash for mcontext_t {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.gregs.hash(state);
+ self.fpregs.hash(state);
+ // Ignore padding field
+ }
+ }
+
+ impl PartialEq for ucontext_t {
+ fn eq(&self, other: &Self) -> bool {
+ self.uc_flags == other.uc_flags
+ && self.uc_link == other.uc_link
+ && self.uc_stack == other.uc_stack
+ && self.uc_mcontext == other.uc_mcontext
+ && self.uc_sigmask64 == other.uc_sigmask64
+ // Ignore padding field
+ }
+ }
+ impl Eq for ucontext_t {}
+ impl ::fmt::Debug for ucontext_t {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("ucontext_t")
+ .field("uc_flags", &self.uc_flags)
+ .field("uc_link", &self.uc_link)
+ .field("uc_stack", &self.uc_stack)
+ .field("uc_mcontext", &self.uc_mcontext)
+ .field("uc_sigmask64", &self.uc_sigmask64)
+ // Ignore padding field
+ .finish()
+ }
+ }
+ impl ::hash::Hash for ucontext_t {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.uc_flags.hash(state);
+ self.uc_link.hash(state);
+ self.uc_stack.hash(state);
+ self.uc_mcontext.hash(state);
+ self.uc_sigmask64.hash(state);
+ // Ignore padding field
+ }
+ }
+ }
}
pub const O_DIRECT: ::c_int = 0x4000;
@@ -389,6 +602,8 @@ pub const SYS_pwritev2: ::c_long = 328;
pub const SYS_pkey_mprotect: ::c_long = 329;
pub const SYS_pkey_alloc: ::c_long = 330;
pub const SYS_pkey_free: ::c_long = 331;
+pub const SYS_io_uring_setup: ::c_long = 425;
+pub const SYS_io_uring_enter: ::c_long = 426;
// offsets in user_regs_structs, from sys/reg.h
pub const R15: ::c_int = 0;
@@ -419,6 +634,31 @@ pub const ES: ::c_int = 24;
pub const FS: ::c_int = 25;
pub const GS: ::c_int = 26;
+// offsets in mcontext_t.gregs from sys/ucontext.h
+pub const REG_R8: ::c_int = 0;
+pub const REG_R9: ::c_int = 1;
+pub const REG_R10: ::c_int = 2;
+pub const REG_R11: ::c_int = 3;
+pub const REG_R12: ::c_int = 4;
+pub const REG_R13: ::c_int = 5;
+pub const REG_R14: ::c_int = 6;
+pub const REG_R15: ::c_int = 7;
+pub const REG_RDI: ::c_int = 8;
+pub const REG_RSI: ::c_int = 9;
+pub const REG_RBP: ::c_int = 10;
+pub const REG_RBX: ::c_int = 11;
+pub const REG_RDX: ::c_int = 12;
+pub const REG_RAX: ::c_int = 13;
+pub const REG_RCX: ::c_int = 14;
+pub const REG_RSP: ::c_int = 15;
+pub const REG_RIP: ::c_int = 16;
+pub const REG_EFL: ::c_int = 17;
+pub const REG_CSGSFS: ::c_int = 18;
+pub const REG_ERR: ::c_int = 19;
+pub const REG_TRAPNO: ::c_int = 20;
+pub const REG_OLDMASK: ::c_int = 21;
+pub const REG_CR2: ::c_int = 22;
+
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 a40b77e8..541b40f3 100644
--- a/src/unix/linux_like/android/mod.rs
+++ b/src/unix/linux_like/android/mod.rs
@@ -19,6 +19,7 @@ pub type nfds_t = ::c_uint;
pub type rlim_t = ::c_ulong;
pub type dev_t = ::c_ulong;
pub type ino_t = ::c_ulong;
+pub type ino64_t = u64;
pub type __CPU_BITTYPE = ::c_ulong;
pub type idtype_t = ::c_int;
pub type loff_t = ::c_longlong;
@@ -147,6 +148,11 @@ s! {
_pad: [u8; 28],
}
+ pub struct itimerspec {
+ pub it_interval: ::timespec,
+ pub it_value: ::timespec,
+ }
+
pub struct ucred {
pub pid: ::pid_t,
pub uid: ::uid_t,
@@ -208,6 +214,36 @@ s! {
pub cookie: u32,
pub len: u32
}
+
+ pub struct sock_extended_err {
+ pub ee_errno: u32,
+ pub ee_origin: u8,
+ pub ee_type: u8,
+ pub ee_code: u8,
+ pub ee_pad: u8,
+ pub ee_info: u32,
+ pub ee_data: u32,
+ }
+
+ pub struct regex_t {
+ re_magic: ::c_int,
+ re_nsub: ::size_t,
+ re_endp: *const ::c_char,
+ re_guts: *mut ::c_void,
+ }
+
+ pub struct regmatch_t {
+ pub rm_so: ::ssize_t,
+ pub rm_eo: ::ssize_t,
+ }
+
+ pub struct sockaddr_vm {
+ pub svm_family: ::sa_family_t,
+ pub svm_reserved1: ::c_ushort,
+ pub svm_port: ::c_uint,
+ pub svm_cid: ::c_uint,
+ pub svm_zero: [u8; 4]
+ }
}
s_no_extra_traits! {
@@ -270,6 +306,13 @@ s_no_extra_traits! {
pub salg_name: [::c_uchar; 64],
}
+ /// WARNING: The `PartialEq`, `Eq` and `Hash` implementations of this
+ /// type are unsound and will be removed in the future.
+ #[deprecated(
+ note = "this struct has unsafe trait implementations that will be \
+ removed in the future",
+ since = "0.2.80"
+ )]
pub struct af_alg_iv {
pub ivlen: u32,
pub iv: [::c_uchar; 0],
@@ -555,6 +598,7 @@ cfg_if! {
}
}
+ #[allow(deprecated)]
impl af_alg_iv {
fn as_slice(&self) -> &[u8] {
unsafe {
@@ -566,22 +610,26 @@ cfg_if! {
}
}
+ #[allow(deprecated)]
impl PartialEq for af_alg_iv {
fn eq(&self, other: &af_alg_iv) -> bool {
*self.as_slice() == *other.as_slice()
}
}
+ #[allow(deprecated)]
impl Eq for af_alg_iv {}
+ #[allow(deprecated)]
impl ::fmt::Debug for af_alg_iv {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("af_alg_iv")
- .field("iv", &self.as_slice())
+ .field("ivlen", &self.ivlen)
.finish()
}
}
+ #[allow(deprecated)]
impl ::hash::Hash for af_alg_iv {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.as_slice().hash(state);
@@ -619,11 +667,27 @@ pub const EPOLLONESHOT: ::c_int = 0x40000000;
pub const EPOLLRDHUP: ::c_int = 0x00002000;
pub const EPOLLWAKEUP: ::c_int = 0x20000000;
-pub const EFD_CLOEXEC: ::c_int = 0x80000;
+// sys/eventfd.h
+pub const EFD_SEMAPHORE: ::c_int = 0x1;
+pub const EFD_CLOEXEC: ::c_int = O_CLOEXEC;
+pub const EFD_NONBLOCK: ::c_int = O_NONBLOCK;
+
+// sys/timerfd.h
+pub const TFD_CLOEXEC: ::c_int = O_CLOEXEC;
+pub const TFD_NONBLOCK: ::c_int = O_NONBLOCK;
+pub const TFD_TIMER_ABSTIME: ::c_int = 1;
+pub const TFD_TIMER_CANCEL_ON_SET: ::c_int = 2;
pub const USER_PROCESS: ::c_short = 7;
+// linux/falloc.h
+pub const FALLOC_FL_KEEP_SIZE: ::c_int = 0x01;
+pub const FALLOC_FL_PUNCH_HOLE: ::c_int = 0x02;
+pub const FALLOC_FL_NO_HIDE_STALE: ::c_int = 0x04;
pub const FALLOC_FL_COLLAPSE_RANGE: ::c_int = 0x08;
+pub const FALLOC_FL_ZERO_RANGE: ::c_int = 0x10;
+pub const FALLOC_FL_INSERT_RANGE: ::c_int = 0x20;
+pub const FALLOC_FL_UNSHARE_RANGE: ::c_int = 0x40;
pub const BUFSIZ: ::c_uint = 1024;
pub const FILENAME_MAX: ::c_uint = 4096;
@@ -789,11 +853,21 @@ pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 140;
pub const _SC_XOPEN_STREAMS: ::c_int = 141;
pub const _SC_XOPEN_UUCP: ::c_int = 142;
+pub const F_LOCK: ::c_int = 1;
+pub const F_TEST: ::c_int = 3;
+pub const F_TLOCK: ::c_int = 2;
+pub const F_ULOCK: ::c_int = 0;
+
pub const 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;
+// stdio.h
+pub const RENAME_NOREPLACE: ::c_int = 1;
+pub const RENAME_EXCHANGE: ::c_int = 2;
+pub const RENAME_WHITEOUT: ::c_int = 4;
+
pub const FIOCLEX: ::c_int = 0x5451;
pub const FIONCLEX: ::c_int = 0x5450;
@@ -831,12 +905,12 @@ 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_PAPER_MASK: ::c_int = (1 << LC_PAPER);
-pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME);
-pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS);
-pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE);
-pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT);
-pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION);
+pub const LC_PAPER_MASK: ::c_int = 1 << LC_PAPER;
+pub const LC_NAME_MASK: ::c_int = 1 << LC_NAME;
+pub const LC_ADDRESS_MASK: ::c_int = 1 << LC_ADDRESS;
+pub const LC_TELEPHONE_MASK: ::c_int = 1 << LC_TELEPHONE;
+pub const LC_MEASUREMENT_MASK: ::c_int = 1 << LC_MEASUREMENT;
+pub const LC_IDENTIFICATION_MASK: ::c_int = 1 << LC_IDENTIFICATION;
pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK
| ::LC_NUMERIC_MASK
| ::LC_TIME_MASK
@@ -951,6 +1025,8 @@ pub const SOCK_SEQPACKET: ::c_int = 5;
pub const SOCK_DCCP: ::c_int = 6;
pub const SOCK_PACKET: ::c_int = 10;
+pub const IPPROTO_MAX: ::c_int = 256;
+
pub const SOL_SOCKET: ::c_int = 1;
pub const SOL_SCTP: ::c_int = 132;
pub const SOL_IPX: ::c_int = 256;
@@ -1002,8 +1078,10 @@ pub const SO_SNDTIMEO: ::c_int = 21;
pub const SO_BINDTODEVICE: ::c_int = 25;
pub const SO_TIMESTAMP: ::c_int = 29;
pub const SO_ACCEPTCONN: ::c_int = 30;
+pub const SO_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_MARK: ::c_int = 36;
pub const SO_PROTOCOL: ::c_int = 38;
pub const SO_DOMAIN: ::c_int = 39;
@@ -1011,6 +1089,8 @@ 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 TCP_ULP: ::c_int = 31;
+
pub const IPTOS_ECN_NOTECT: u8 = 0x00;
pub const O_ACCMODE: ::c_int = 3;
@@ -1023,8 +1103,16 @@ pub const O_SYNC: ::c_int = 0x101000;
pub const O_ASYNC: ::c_int = 0x2000;
pub const O_NDELAY: ::c_int = 0x800;
pub const O_DSYNC: ::c_int = 4096;
+pub const O_RSYNC: ::c_int = O_SYNC;
pub const NI_MAXHOST: ::size_t = 1025;
+pub const NI_MAXSERV: ::size_t = 32;
+
+pub const NI_NOFQDN: ::c_int = 0x00000001;
+pub const NI_NUMERICHOST: ::c_int = 0x00000002;
+pub const NI_NAMEREQD: ::c_int = 0x00000004;
+pub const NI_NUMERICSERV: ::c_int = 0x00000008;
+pub const NI_DGRAM: ::c_int = 0x00000010;
pub const NCCS: usize = 19;
pub const TCSBRKP: ::c_int = 0x5425;
@@ -1087,7 +1175,7 @@ pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
-pub const EFD_NONBLOCK: ::c_int = 0x800;
+pub const PTRACE_EVENT_STOP: ::c_int = 128;
pub const F_GETLK: ::c_int = 5;
pub const F_GETOWN: ::c_int = 9;
@@ -1097,12 +1185,20 @@ pub const F_SETLKW: ::c_int = 7;
pub const F_RDLCK: ::c_int = 0;
pub const F_WRLCK: ::c_int = 1;
pub const F_UNLCK: ::c_int = 2;
+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 RLIMIT_CPU: ::c_int = 0;
pub const RLIMIT_FSIZE: ::c_int = 1;
pub const RLIMIT_DATA: ::c_int = 2;
pub const RLIMIT_STACK: ::c_int = 3;
pub const RLIMIT_CORE: ::c_int = 4;
+pub const RLIMIT_RSS: ::c_int = 5;
+pub const RLIMIT_NPROC: ::c_int = 6;
+pub const RLIMIT_NOFILE: ::c_int = 7;
+pub const RLIMIT_MEMLOCK: ::c_int = 8;
+pub const RLIMIT_AS: ::c_int = 9;
pub const RLIMIT_LOCKS: ::c_int = 10;
pub const RLIMIT_SIGPENDING: ::c_int = 11;
pub const RLIMIT_MSGQUEUE: ::c_int = 12;
@@ -1142,6 +1238,8 @@ pub const TIOCMBIC: ::c_int = 0x5417;
pub const TIOCMSET: ::c_int = 0x5418;
pub const FIONREAD: ::c_int = 0x541B;
pub const TIOCCONS: ::c_int = 0x541D;
+pub const TIOCSBRK: ::c_int = 0x5427;
+pub const TIOCCBRK: ::c_int = 0x5428;
pub const ST_RDONLY: ::c_ulong = 1;
pub const ST_NOSUID: ::c_ulong = 2;
@@ -1157,6 +1255,18 @@ pub const RTLD_NOLOAD: ::c_int = 0x4;
pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
+pub const AI_PASSIVE: ::c_int = 0x00000001;
+pub const AI_CANONNAME: ::c_int = 0x00000002;
+pub const AI_NUMERICHOST: ::c_int = 0x00000004;
+pub const AI_NUMERICSERV: ::c_int = 0x00000008;
+pub const AI_MASK: ::c_int =
+ AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | AI_ADDRCONFIG;
+pub const AI_ALL: ::c_int = 0x00000100;
+pub const AI_V4MAPPED_CFG: ::c_int = 0x00000200;
+pub const AI_ADDRCONFIG: ::c_int = 0x00000400;
+pub const AI_V4MAPPED: ::c_int = 0x00000800;
+pub const AI_DEFAULT: ::c_int = AI_V4MAPPED_CFG | AI_ADDRCONFIG;
+
pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead;
pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793;
pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278;
@@ -1172,6 +1282,41 @@ pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4;
pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2;
pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
+pub const REG_BASIC: ::c_int = 0;
+pub const REG_EXTENDED: ::c_int = 1;
+pub const REG_ICASE: ::c_int = 2;
+pub const REG_NOSUB: ::c_int = 4;
+pub const REG_NEWLINE: ::c_int = 8;
+pub const REG_NOSPEC: ::c_int = 16;
+pub const REG_PEND: ::c_int = 32;
+pub const REG_DUMP: ::c_int = 128;
+
+pub const REG_NOMATCH: ::c_int = 1;
+pub const REG_BADPAT: ::c_int = 2;
+pub const REG_ECOLLATE: ::c_int = 3;
+pub const REG_ECTYPE: ::c_int = 4;
+pub const REG_EESCAPE: ::c_int = 5;
+pub const REG_ESUBREG: ::c_int = 6;
+pub const REG_EBRACK: ::c_int = 7;
+pub const REG_EPAREN: ::c_int = 8;
+pub const REG_EBRACE: ::c_int = 9;
+pub const REG_BADBR: ::c_int = 10;
+pub const REG_ERANGE: ::c_int = 11;
+pub const REG_ESPACE: ::c_int = 12;
+pub const REG_BADRPT: ::c_int = 13;
+pub const REG_EMPTY: ::c_int = 14;
+pub const REG_ASSERT: ::c_int = 15;
+pub const REG_INVARG: ::c_int = 16;
+pub const REG_ATOI: ::c_int = 255;
+pub const REG_ITOA: ::c_int = 256;
+
+pub const REG_NOTBOL: ::c_int = 1;
+pub const REG_NOTEOL: ::c_int = 2;
+pub const REG_STARTEND: ::c_int = 4;
+pub const REG_TRACE: ::c_int = 256;
+pub const REG_LARGE: ::c_int = 512;
+pub const REG_BACKR: ::c_int = 1024;
+
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
@@ -1396,6 +1541,72 @@ pub const NFULNL_CFG_F_SEQ: ::c_int = 0x0001;
pub const NFULNL_CFG_F_SEQ_GLOBAL: ::c_int = 0x0002;
pub const NFULNL_CFG_F_CONNTRACK: ::c_int = 0x0004;
+// linux/netfilter/nfnetlink_log.h
+pub const NFQNL_MSG_PACKET: ::c_int = 0;
+pub const NFQNL_MSG_VERDICT: ::c_int = 1;
+pub const NFQNL_MSG_CONFIG: ::c_int = 2;
+pub const NFQNL_MSG_VERDICT_BATCH: ::c_int = 3;
+
+pub const NFQA_UNSPEC: ::c_int = 0;
+pub const NFQA_PACKET_HDR: ::c_int = 1;
+pub const NFQA_VERDICT_HDR: ::c_int = 2;
+pub const NFQA_MARK: ::c_int = 3;
+pub const NFQA_TIMESTAMP: ::c_int = 4;
+pub const NFQA_IFINDEX_INDEV: ::c_int = 5;
+pub const NFQA_IFINDEX_OUTDEV: ::c_int = 6;
+pub const NFQA_IFINDEX_PHYSINDEV: ::c_int = 7;
+pub const NFQA_IFINDEX_PHYSOUTDEV: ::c_int = 8;
+pub const NFQA_HWADDR: ::c_int = 9;
+pub const NFQA_PAYLOAD: ::c_int = 10;
+pub const NFQA_CT: ::c_int = 11;
+pub const NFQA_CT_INFO: ::c_int = 12;
+pub const NFQA_CAP_LEN: ::c_int = 13;
+pub const NFQA_SKB_INFO: ::c_int = 14;
+pub const NFQA_EXP: ::c_int = 15;
+pub const NFQA_UID: ::c_int = 16;
+pub const NFQA_GID: ::c_int = 17;
+pub const NFQA_SECCTX: ::c_int = 18;
+/*
+ FIXME: These are not yet available in musl sanitized kernel headers and
+ make the tests fail. Enable them once musl has them.
+
+ See https://github.com/rust-lang/libc/pull/1628 for more details.
+pub const NFQA_VLAN: ::c_int = 19;
+pub const NFQA_L2HDR: ::c_int = 20;
+
+pub const NFQA_VLAN_UNSPEC: ::c_int = 0;
+pub const NFQA_VLAN_PROTO: ::c_int = 1;
+pub const NFQA_VLAN_TCI: ::c_int = 2;
+*/
+
+pub const NFQNL_CFG_CMD_NONE: ::c_int = 0;
+pub const NFQNL_CFG_CMD_BIND: ::c_int = 1;
+pub const NFQNL_CFG_CMD_UNBIND: ::c_int = 2;
+pub const NFQNL_CFG_CMD_PF_BIND: ::c_int = 3;
+pub const NFQNL_CFG_CMD_PF_UNBIND: ::c_int = 4;
+
+pub const NFQNL_COPY_NONE: ::c_int = 0;
+pub const NFQNL_COPY_META: ::c_int = 1;
+pub const NFQNL_COPY_PACKET: ::c_int = 2;
+
+pub const NFQA_CFG_UNSPEC: ::c_int = 0;
+pub const NFQA_CFG_CMD: ::c_int = 1;
+pub const NFQA_CFG_PARAMS: ::c_int = 2;
+pub const NFQA_CFG_QUEUE_MAXLEN: ::c_int = 3;
+pub const NFQA_CFG_MASK: ::c_int = 4;
+pub const NFQA_CFG_FLAGS: ::c_int = 5;
+
+pub const NFQA_CFG_F_FAIL_OPEN: ::c_int = 0x0001;
+pub const NFQA_CFG_F_CONNTRACK: ::c_int = 0x0002;
+pub const NFQA_CFG_F_GSO: ::c_int = 0x0004;
+pub const NFQA_CFG_F_UID_GID: ::c_int = 0x0008;
+pub const NFQA_CFG_F_SECCTX: ::c_int = 0x0010;
+pub const NFQA_CFG_F_MAX: ::c_int = 0x0020;
+
+pub const NFQA_SKB_CSUMNOTREADY: ::c_int = 0x0001;
+pub const NFQA_SKB_GSO: ::c_int = 0x0002;
+pub const NFQA_SKB_CSUM_NOTVERIFIED: ::c_int = 0x0004;
+
pub const GENL_NAMSIZ: ::c_int = 16;
pub const GENL_MIN_ID: ::c_int = NLMSG_MIN_TYPE;
@@ -1486,12 +1697,16 @@ pub const SFD_NONBLOCK: ::c_int = O_NONBLOCK;
pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK;
pub const SO_ORIGINAL_DST: ::c_int = 80;
-pub const IP_ORIGDSTADDR: ::c_int = 20;
-pub const IP_RECVORIGDSTADDR: ::c_int = IP_ORIGDSTADDR;
-pub const IPV6_ORIGDSTADDR: ::c_int = 74;
-pub const IPV6_RECVORIGDSTADDR: ::c_int = IPV6_ORIGDSTADDR;
+
+pub const IP_RECVFRAGSIZE: ::c_int = 25;
+
+pub const IPV6_FLOWINFO: ::c_int = 11;
+pub const IPV6_MULTICAST_ALL: ::c_int = 29;
+pub const IPV6_ROUTER_ALERT_ISOLATE: ::c_int = 30;
pub const IPV6_FLOWLABEL_MGR: ::c_int = 32;
pub const IPV6_FLOWINFO_SEND: ::c_int = 33;
+pub const IPV6_RECVFRAGSIZE: ::c_int = 77;
+pub const IPV6_FREEBIND: ::c_int = 78;
pub const IPV6_FLOWINFO_FLOWLABEL: ::c_int = 0x000fffff;
pub const IPV6_FLOWINFO_PRIORITY: ::c_int = 0x0ff00000;
@@ -1585,6 +1800,9 @@ pub const NF_IP6_PRI_SELINUX_LAST: ::c_int = 225;
pub const NF_IP6_PRI_CONNTRACK_HELPER: ::c_int = 300;
pub const NF_IP6_PRI_LAST: ::c_int = ::INT_MAX;
+// linux/netfilter_ipv6/ip6_tables.h
+pub const IP6T_SO_ORIGINAL_DST: ::c_int = 80;
+
// linux/netfilter/nf_tables.h
pub const NFT_TABLE_MAXNAMELEN: ::c_int = 256;
pub const NFT_CHAIN_MAXNAMELEN: ::c_int = 256;
@@ -1680,12 +1898,12 @@ pub const NFT_CMP_GTE: ::c_int = 5;
pub const NFT_RANGE_EQ: ::c_int = 0;
pub const NFT_RANGE_NEQ: ::c_int = 1;
-pub const NFT_LOOKUP_F_INV: ::c_int = (1 << 0);
+pub const NFT_LOOKUP_F_INV: ::c_int = 1 << 0;
pub const NFT_DYNSET_OP_ADD: ::c_int = 0;
pub const NFT_DYNSET_OP_UPDATE: ::c_int = 1;
-pub const NFT_DYNSET_F_INV: ::c_int = (1 << 0);
+pub const NFT_DYNSET_F_INV: ::c_int = 1 << 0;
pub const NFT_PAYLOAD_LL_HEADER: ::c_int = 0;
pub const NFT_PAYLOAD_NETWORK_HEADER: ::c_int = 1;
@@ -1740,13 +1958,13 @@ pub const NFT_CT_BYTES: ::c_int = 15;
pub const NFT_LIMIT_PKTS: ::c_int = 0;
pub const NFT_LIMIT_PKT_BYTES: ::c_int = 1;
-pub const NFT_LIMIT_F_INV: ::c_int = (1 << 0);
+pub const NFT_LIMIT_F_INV: ::c_int = 1 << 0;
pub const NFT_QUEUE_FLAG_BYPASS: ::c_int = 0x01;
pub const NFT_QUEUE_FLAG_CPU_FANOUT: ::c_int = 0x02;
pub const NFT_QUEUE_FLAG_MASK: ::c_int = 0x03;
-pub const NFT_QUOTA_F_INV: ::c_int = (1 << 0);
+pub const NFT_QUOTA_F_INV: ::c_int = 1 << 0;
pub const NFT_REJECT_ICMP_UNREACH: ::c_int = 0;
pub const NFT_REJECT_TCP_RST: ::c_int = 1;
@@ -1932,17 +2150,24 @@ pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5;
pub const ALG_OP_DECRYPT: ::c_int = 0;
pub const ALG_OP_ENCRYPT: ::c_int = 1;
+// uapi/linux/vm_sockets.h
+pub const VMADDR_CID_ANY: ::c_uint = 0xFFFFFFFF;
+pub const VMADDR_CID_HYPERVISOR: ::c_uint = 0;
+pub const VMADDR_CID_LOCAL: ::c_uint = 1;
+pub const VMADDR_CID_HOST: ::c_uint = 2;
+pub const VMADDR_PORT_ANY: ::c_uint = 0xFFFFFFFF;
+
// uapi/linux/inotify.h
pub const IN_ACCESS: u32 = 0x0000_0001;
pub const IN_MODIFY: u32 = 0x0000_0002;
pub const IN_ATTRIB: u32 = 0x0000_0004;
pub const IN_CLOSE_WRITE: u32 = 0x0000_0008;
pub const IN_CLOSE_NOWRITE: u32 = 0x0000_0010;
-pub const IN_CLOSE: u32 = (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE);
+pub const IN_CLOSE: u32 = IN_CLOSE_WRITE | IN_CLOSE_NOWRITE;
pub const IN_OPEN: u32 = 0x0000_0020;
pub const IN_MOVED_FROM: u32 = 0x0000_0040;
pub const IN_MOVED_TO: u32 = 0x0000_0080;
-pub const IN_MOVE: u32 = (IN_MOVED_FROM | IN_MOVED_TO);
+pub const IN_MOVE: u32 = IN_MOVED_FROM | IN_MOVED_TO;
pub const IN_CREATE: u32 = 0x0000_0100;
pub const IN_DELETE: u32 = 0x0000_0200;
pub const IN_DELETE_SELF: u32 = 0x0000_0400;
@@ -1959,7 +2184,7 @@ pub const IN_DONT_FOLLOW: u32 = 0x0200_0000;
pub const IN_ISDIR: u32 = 0x4000_0000;
pub const IN_ONESHOT: u32 = 0x8000_0000;
-pub const IN_ALL_EVENTS: u32 = (IN_ACCESS
+pub const IN_ALL_EVENTS: u32 = IN_ACCESS
| IN_MODIFY
| IN_ATTRIB
| IN_CLOSE_WRITE
@@ -1970,7 +2195,7 @@ pub const IN_ALL_EVENTS: u32 = (IN_ACCESS
| IN_DELETE
| IN_CREATE
| IN_DELETE_SELF
- | IN_MOVE_SELF);
+ | IN_MOVE_SELF;
pub const IN_CLOEXEC: ::c_int = O_CLOEXEC;
pub const IN_NONBLOCK: ::c_int = O_NONBLOCK;
@@ -1991,8 +2216,78 @@ pub const FUTEX_CMP_REQUEUE_PI: ::c_int = 12;
pub const FUTEX_PRIVATE_FLAG: ::c_int = 128;
pub const FUTEX_CLOCK_REALTIME: ::c_int = 256;
-pub const FUTEX_CMD_MASK: ::c_int =
- !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME);
+pub const FUTEX_CMD_MASK: ::c_int = !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME);
+
+// linux/errqueue.h
+pub const SO_EE_ORIGIN_NONE: u8 = 0;
+pub const SO_EE_ORIGIN_LOCAL: u8 = 1;
+pub const SO_EE_ORIGIN_ICMP: u8 = 2;
+pub const SO_EE_ORIGIN_ICMP6: u8 = 3;
+pub const SO_EE_ORIGIN_TXSTATUS: u8 = 4;
+pub const SO_EE_ORIGIN_TIMESTAMPING: u8 = SO_EE_ORIGIN_TXSTATUS;
+
+// 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 EWOULDBLOCK: ::c_int = EAGAIN;
+
+pub const PRIO_PROCESS: ::c_int = 0;
+pub const PRIO_PGRP: ::c_int = 1;
+pub const PRIO_USER: ::c_int = 2;
+
+// linux/sched.h
+pub const SCHED_NORMAL: ::c_int = 0;
+pub const SCHED_FIFO: ::c_int = 1;
+pub const SCHED_RR: ::c_int = 2;
+pub const SCHED_BATCH: ::c_int = 3;
+pub const SCHED_IDLE: ::c_int = 5;
+pub const SCHED_DEADLINE: ::c_int = 6;
+
+// bits/seek_constants.h
+pub const SEEK_DATA: ::c_int = 3;
+pub const SEEK_HOLE: ::c_int = 4;
+
+// sys/socket.h
+pub const AF_NFC: ::c_int = 39;
+pub const AF_VSOCK: ::c_int = 40;
+pub const PF_NFC: ::c_int = AF_NFC;
+pub const PF_VSOCK: ::c_int = AF_VSOCK;
+
+// sys/prctl.h
+pub const PR_GET_SECUREBITS: ::c_int = 27;
+pub const PR_SET_SECUREBITS: ::c_int = 28;
f! {
pub fn CMSG_NXTHDR(mhdr: *const msghdr,
@@ -2053,6 +2348,10 @@ f! {
pub fn NLA_ALIGN(len: ::c_int) -> ::c_int {
return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1)
}
+
+ pub fn SO_EE_OFFENDER(ee: *const ::sock_extended_err) -> *mut ::sockaddr {
+ ee.offset(1) as *mut ::sockaddr
+ }
}
extern "C" {
@@ -2060,29 +2359,25 @@ extern "C" {
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,
+ pub fn prlimit(
+ pid: ::pid_t,
+ resource: ::c_int,
+ new_limit: *const ::rlimit,
+ old_limit: *mut ::rlimit,
) -> ::c_int;
+ pub fn prlimit64(
+ pid: ::pid_t,
+ resource: ::c_int,
+ new_limit: *const ::rlimit64,
+ old_limit: *mut ::rlimit64,
+ ) -> ::c_int;
+ pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
- pub fn madvise(
- addr: *mut ::c_void,
- len: ::size_t,
- advice: ::c_int,
- ) -> ::c_int;
+ pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
- pub fn msync(
- addr: *mut ::c_void,
- len: ::size_t,
- flags: ::c_int,
- ) -> ::c_int;
- 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 mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
pub fn recvfrom(
socket: ::c_int,
buf: *mut ::c_void,
@@ -2100,37 +2395,99 @@ extern "C" {
sevlen: ::size_t,
flags: ::c_int,
) -> ::c_int;
+ pub fn preadv(fd: ::c_int, iov: *const ::iovec, count: ::c_int, offset: ::off_t) -> ::ssize_t;
+ pub fn pwritev(fd: ::c_int, iov: *const ::iovec, count: ::c_int, offset: ::off_t) -> ::ssize_t;
+ pub fn process_vm_readv(
+ pid: ::pid_t,
+ local_iov: *const ::iovec,
+ local_iov_count: ::c_ulong,
+ remote_iov: *const ::iovec,
+ remote_iov_count: ::c_ulong,
+ flags: ::c_ulong,
+ ) -> ::ssize_t;
+ pub fn process_vm_writev(
+ pid: ::pid_t,
+ local_iov: *const ::iovec,
+ local_iov_count: ::c_ulong,
+ remote_iov: *const ::iovec,
+ remote_iov_count: ::c_ulong,
+ flags: ::c_ulong,
+ ) -> ::ssize_t;
pub fn ptrace(request: ::c_int, ...) -> ::c_long;
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 __sched_cpualloc(count: ::size_t) -> *mut ::cpu_set_t;
pub fn __sched_cpufree(set: *mut ::cpu_set_t);
- pub fn __sched_cpucount(
- setsize: ::size_t,
- set: *const cpu_set_t,
- ) -> ::c_int;
+ pub fn __sched_cpucount(setsize: ::size_t, set: *const cpu_set_t) -> ::c_int;
pub fn sched_getcpu() -> ::c_int;
pub fn utmpname(name: *const ::c_char) -> ::c_int;
pub fn setutent();
pub fn getutent() -> *mut utmp;
- pub fn posix_fallocate(
- fd: ::c_int,
- offset: ::off_t,
- len: ::off_t,
+ pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
+ pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
+ pub fn fallocate(fd: ::c_int, mode: ::c_int, offset: ::off_t, len: ::off_t) -> ::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 getxattr(
+ path: *const c_char,
+ name: *const c_char,
+ value: *mut ::c_void,
+ size: ::size_t,
+ ) -> ::ssize_t;
+ pub fn lgetxattr(
+ path: *const c_char,
+ name: *const c_char,
+ value: *mut ::c_void,
+ size: ::size_t,
+ ) -> ::ssize_t;
+ pub fn fgetxattr(
+ filedes: ::c_int,
+ name: *const c_char,
+ value: *mut ::c_void,
+ size: ::size_t,
+ ) -> ::ssize_t;
+ pub fn setxattr(
+ path: *const c_char,
+ name: *const c_char,
+ value: *const ::c_void,
+ size: ::size_t,
+ flags: ::c_int,
+ ) -> ::c_int;
+ pub fn lsetxattr(
+ path: *const c_char,
+ name: *const c_char,
+ value: *const ::c_void,
+ size: ::size_t,
+ flags: ::c_int,
+ ) -> ::c_int;
+ pub fn fsetxattr(
+ filedes: ::c_int,
+ name: *const c_char,
+ value: *const ::c_void,
+ size: ::size_t,
+ flags: ::c_int,
) -> ::c_int;
- pub fn signalfd(
+ pub fn listxattr(path: *const c_char, list: *mut c_char, size: ::size_t) -> ::ssize_t;
+ pub fn llistxattr(path: *const c_char, list: *mut c_char, size: ::size_t) -> ::ssize_t;
+ pub fn flistxattr(filedes: ::c_int, list: *mut c_char, size: ::size_t) -> ::ssize_t;
+ pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int;
+ pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int;
+ pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int;
+ pub fn signalfd(fd: ::c_int, mask: *const ::sigset_t, flags: ::c_int) -> ::c_int;
+ pub fn timerfd_create(clock: ::clockid_t, flags: ::c_int) -> ::c_int;
+ pub fn timerfd_gettime(fd: ::c_int, current_value: *mut itimerspec) -> ::c_int;
+ pub fn timerfd_settime(
fd: ::c_int,
- mask: *const ::sigset_t,
flags: ::c_int,
+ new_value: *const itimerspec,
+ old_value: *mut itimerspec,
) -> ::c_int;
pub fn syscall(num: ::c_long, ...) -> ::c_long;
- pub fn sched_getaffinity(
- pid: ::pid_t,
- cpusetsize: ::size_t,
- cpuset: *mut cpu_set_t,
- ) -> ::c_int;
+ pub fn sched_getaffinity(pid: ::pid_t, cpusetsize: ::size_t, cpuset: *mut cpu_set_t)
+ -> ::c_int;
pub fn sched_setaffinity(
pid: ::pid_t,
cpusetsize: ::size_t,
@@ -2144,12 +2501,8 @@ extern "C" {
maxevents: ::c_int,
timeout: ::c_int,
) -> ::c_int;
- pub fn epoll_ctl(
- epfd: ::c_int,
- op: ::c_int,
- fd: ::c_int,
- event: *mut ::epoll_event,
- ) -> ::c_int;
+ pub fn epoll_ctl(epfd: ::c_int, op: ::c_int, fd: ::c_int, event: *mut ::epoll_event)
+ -> ::c_int;
pub fn pthread_getschedparam(
native: ::pthread_t,
policy: *mut ::c_int,
@@ -2158,16 +2511,8 @@ extern "C" {
pub fn unshare(flags: ::c_int) -> ::c_int;
pub fn umount(target: *const ::c_char) -> ::c_int;
pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
- pub fn tee(
- fd_in: ::c_int,
- fd_out: ::c_int,
- len: ::size_t,
- flags: ::c_uint,
- ) -> ::ssize_t;
- pub fn settimeofday(
- tv: *const ::timeval,
- tz: *const ::timezone,
- ) -> ::c_int;
+ pub fn tee(fd_in: ::c_int, fd_out: ::c_int, len: ::size_t, flags: ::c_uint) -> ::ssize_t;
+ pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
pub fn splice(
fd_in: ::c_int,
off_in: *mut ::loff_t,
@@ -2177,17 +2522,10 @@ extern "C" {
flags: ::c_uint,
) -> ::ssize_t;
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
- pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec)
- -> ::c_int;
- pub fn sem_timedwait(
- sem: *mut sem_t,
- abstime: *const ::timespec,
- ) -> ::c_int;
+ pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int;
pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int;
- pub fn sched_setparam(
- pid: ::pid_t,
- param: *const ::sched_param,
- ) -> ::c_int;
+ pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int;
pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int;
pub fn swapoff(puath: *const ::c_char) -> ::c_int;
pub fn vmsplice(
@@ -2262,7 +2600,6 @@ extern "C" {
pub fn setfsgid(gid: ::gid_t) -> ::c_int;
pub fn setfsuid(uid: ::uid_t) -> ::c_int;
pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
pub fn getgrgid_r(
gid: ::gid_t,
grp: *mut ::group,
@@ -2270,14 +2607,8 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut ::group,
) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "sigaltstack$UNIX2003"
- )]
- #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
pub fn sem_close(sem: *mut sem_t) -> ::c_int;
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
pub fn getgrnam_r(
name: *const ::c_char,
grp: *mut ::group,
@@ -2285,22 +2616,12 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut ::group,
) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_sigmask$UNIX2003"
- )]
- pub fn pthread_sigmask(
- how: ::c_int,
- set: *const sigset_t,
- oldset: *mut sigset_t,
- ) -> ::c_int;
+ pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int;
pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
pub fn getpwnam_r(
name: *const ::c_char,
pwd: *mut passwd,
@@ -2308,8 +2629,6 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut passwd,
) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
pub fn getpwuid_r(
uid: ::uid_t,
pwd: *mut passwd,
@@ -2317,11 +2636,11 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut passwd,
) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "sigwait$UNIX2003"
- )]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
+ pub fn sigtimedwait(
+ set: *const sigset_t,
+ info: *mut siginfo_t,
+ timeout: *const ::timespec,
+ ) -> ::c_int;
pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int;
pub fn pthread_atfork(
prepare: ::Option<unsafe extern "C" fn()>,
@@ -2340,10 +2659,6 @@ extern "C" {
attr: *const pthread_mutexattr_t,
pshared: *mut ::c_int,
) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "popen$UNIX2003"
- )]
pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
pub fn faccessat(
dirfd: ::c_int,
@@ -2374,11 +2689,34 @@ extern "C" {
) -> ::c_int;
pub fn inotify_init() -> ::c_int;
pub fn inotify_init1(flags: ::c_int) -> ::c_int;
- pub fn inotify_add_watch(
- fd: ::c_int,
- path: *const ::c_char,
- mask: u32,
+ pub fn inotify_add_watch(fd: ::c_int, path: *const ::c_char, mask: u32) -> ::c_int;
+
+ pub fn regcomp(preg: *mut ::regex_t, pattern: *const ::c_char, cflags: ::c_int) -> ::c_int;
+
+ pub fn regexec(
+ preg: *const ::regex_t,
+ input: *const ::c_char,
+ nmatch: ::size_t,
+ pmatch: *mut regmatch_t,
+ eflags: ::c_int,
) -> ::c_int;
+
+ pub fn regerror(
+ errcode: ::c_int,
+ preg: *const ::regex_t,
+ errbuf: *mut ::c_char,
+ errbuf_size: ::size_t,
+ ) -> ::size_t;
+
+ pub fn regfree(preg: *mut ::regex_t);
+
+ pub fn android_set_abort_message(msg: *const ::c_char);
+
+ pub fn gettid() -> ::pid_t;
+
+ pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
+
+ pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;
}
cfg_if! {
@@ -2394,6 +2732,17 @@ cfg_if! {
}
impl siginfo_t {
+ pub unsafe fn si_addr(&self) -> *mut ::c_void {
+ #[repr(C)]
+ struct siginfo_sigfault {
+ _si_signo: ::c_int,
+ _si_errno: ::c_int,
+ _si_code: ::c_int,
+ si_addr: *mut ::c_void,
+ }
+ (*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr
+ }
+
pub unsafe fn si_value(&self) -> ::sigval {
#[repr(C)]
struct siginfo_timer {
@@ -2407,3 +2756,65 @@ impl siginfo_t {
(*(self as *const siginfo_t as *const siginfo_timer)).si_sigval
}
}
+
+cfg_if! {
+ if #[cfg(libc_union)] {
+ // Internal, for casts to access union fields
+ #[repr(C)]
+ struct sifields_sigchld {
+ si_pid: ::pid_t,
+ si_uid: ::uid_t,
+ si_status: ::c_int,
+ si_utime: ::c_long,
+ si_stime: ::c_long,
+ }
+ impl ::Copy for sifields_sigchld {}
+ impl ::Clone for sifields_sigchld {
+ fn clone(&self) -> sifields_sigchld {
+ *self
+ }
+ }
+
+ // Internal, for casts to access union fields
+ #[repr(C)]
+ union sifields {
+ _align_pointer: *mut ::c_void,
+ sigchld: sifields_sigchld,
+ }
+
+ // Internal, for casts to access union fields. Note that some variants
+ // of sifields start with a pointer, which makes the alignment of
+ // sifields vary on 32-bit and 64-bit architectures.
+ #[repr(C)]
+ struct siginfo_f {
+ _siginfo_base: [::c_int; 3],
+ sifields: sifields,
+ }
+
+ impl siginfo_t {
+ unsafe fn sifields(&self) -> &sifields {
+ &(*(self as *const siginfo_t as *const siginfo_f)).sifields
+ }
+
+ pub unsafe fn si_pid(&self) -> ::pid_t {
+ self.sifields().sigchld.si_pid
+ }
+
+ pub unsafe fn si_uid(&self) -> ::uid_t {
+ self.sifields().sigchld.si_uid
+ }
+
+ pub unsafe fn si_status(&self) -> ::c_int {
+ self.sifields().sigchld.si_status
+ }
+
+ pub unsafe fn si_utime(&self) -> ::c_long {
+ self.sifields().sigchld.si_utime
+ }
+
+ pub unsafe fn si_stime(&self) -> ::c_long {
+ self.sifields().sigchld.si_stime
+ }
+ }
+ }
+}
diff --git a/src/unix/linux_like/emscripten/align.rs b/src/unix/linux_like/emscripten/align.rs
index 141570f8..b9ea3f39 100644
--- a/src/unix/linux_like/emscripten/align.rs
+++ b/src/unix/linux_like/emscripten/align.rs
@@ -38,9 +38,9 @@ macro_rules! expand_align {
}
#[allow(missing_debug_implementations)]
- #[repr(align(8))]
+ #[repr(align(16))]
pub struct max_align_t {
- priv_: [f64; 2]
+ priv_: [f64; 4]
}
}
diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs
index 3fc47bb5..ee9d4d4d 100644
--- a/src/unix/linux_like/emscripten/mod.rs
+++ b/src/unix/linux_like/emscripten/mod.rs
@@ -35,7 +35,7 @@ pub type c_ulong = u32;
pub type nlink_t = u32;
#[cfg_attr(feature = "extra_traits", derive(Debug))]
-pub enum fpos64_t {} // TODO: fill this out with a struct
+pub enum fpos64_t {} // FIXME: fill this out with a struct
impl ::Copy for fpos64_t {}
impl ::Clone for fpos64_t {
fn clone(&self) -> fpos64_t {
@@ -1174,20 +1174,142 @@ pub const O_TRUNC: ::c_int = 512;
pub const O_NOATIME: ::c_int = 0o1000000;
pub const O_CLOEXEC: ::c_int = 0x80000;
-pub const EBFONT: ::c_int = 59;
-pub const ENOSTR: ::c_int = 60;
-pub const ENODATA: ::c_int = 61;
-pub const ETIME: ::c_int = 62;
-pub const ENOSR: ::c_int = 63;
-pub const ENONET: ::c_int = 64;
-pub const ENOPKG: ::c_int = 65;
-pub const EREMOTE: ::c_int = 66;
-pub const ENOLINK: ::c_int = 67;
-pub const EADV: ::c_int = 68;
-pub const ESRMNT: ::c_int = 69;
-pub const ECOMM: ::c_int = 70;
-pub const EPROTO: ::c_int = 71;
-pub const EDOTDOT: ::c_int = 73;
+// Defined as wasi value.
+pub const EPERM: ::c_int = 63;
+pub const ENOENT: ::c_int = 44;
+pub const ESRCH: ::c_int = 71;
+pub const EINTR: ::c_int = 27;
+pub const EIO: ::c_int = 29;
+pub const ENXIO: ::c_int = 60;
+pub const E2BIG: ::c_int = 1;
+pub const ENOEXEC: ::c_int = 45;
+pub const EBADF: ::c_int = 8;
+pub const ECHILD: ::c_int = 12;
+pub const EAGAIN: ::c_int = 6;
+pub const ENOMEM: ::c_int = 48;
+pub const EACCES: ::c_int = 2;
+pub const EFAULT: ::c_int = 21;
+pub const ENOTBLK: ::c_int = 105;
+pub const EBUSY: ::c_int = 10;
+pub const EEXIST: ::c_int = 20;
+pub const EXDEV: ::c_int = 75;
+pub const ENODEV: ::c_int = 43;
+pub const ENOTDIR: ::c_int = 54;
+pub const EISDIR: ::c_int = 31;
+pub const EINVAL: ::c_int = 28;
+pub const ENFILE: ::c_int = 41;
+pub const EMFILE: ::c_int = 33;
+pub const ENOTTY: ::c_int = 59;
+pub const ETXTBSY: ::c_int = 74;
+pub const EFBIG: ::c_int = 22;
+pub const ENOSPC: ::c_int = 51;
+pub const ESPIPE: ::c_int = 70;
+pub const EROFS: ::c_int = 69;
+pub const EMLINK: ::c_int = 34;
+pub const EPIPE: ::c_int = 64;
+pub const EDOM: ::c_int = 18;
+pub const ERANGE: ::c_int = 68;
+pub const EWOULDBLOCK: ::c_int = EAGAIN;
+pub const ENOLINK: ::c_int = 47;
+pub const EPROTO: ::c_int = 65;
+pub const EDEADLK: ::c_int = 16;
+pub const EDEADLOCK: ::c_int = EDEADLK;
+pub const ENAMETOOLONG: ::c_int = 37;
+pub const ENOLCK: ::c_int = 46;
+pub const ENOSYS: ::c_int = 52;
+pub const ENOTEMPTY: ::c_int = 55;
+pub const ELOOP: ::c_int = 32;
+pub const ENOMSG: ::c_int = 49;
+pub const EIDRM: ::c_int = 24;
+pub const EMULTIHOP: ::c_int = 36;
+pub const EBADMSG: ::c_int = 9;
+pub const EOVERFLOW: ::c_int = 61;
+pub const EILSEQ: ::c_int = 25;
+pub const ENOTSOCK: ::c_int = 57;
+pub const EDESTADDRREQ: ::c_int = 17;
+pub const EMSGSIZE: ::c_int = 35;
+pub const EPROTOTYPE: ::c_int = 67;
+pub const ENOPROTOOPT: ::c_int = 50;
+pub const EPROTONOSUPPORT: ::c_int = 66;
+pub const EAFNOSUPPORT: ::c_int = 5;
+pub const EADDRINUSE: ::c_int = 3;
+pub const EADDRNOTAVAIL: ::c_int = 4;
+pub const ENETDOWN: ::c_int = 38;
+pub const ENETUNREACH: ::c_int = 40;
+pub const ENETRESET: ::c_int = 39;
+pub const ECONNABORTED: ::c_int = 13;
+pub const ECONNRESET: ::c_int = 15;
+pub const ENOBUFS: ::c_int = 42;
+pub const EISCONN: ::c_int = 30;
+pub const ENOTCONN: ::c_int = 53;
+pub const ETIMEDOUT: ::c_int = 73;
+pub const ECONNREFUSED: ::c_int = 14;
+pub const EHOSTUNREACH: ::c_int = 23;
+pub const EALREADY: ::c_int = 7;
+pub const EINPROGRESS: ::c_int = 26;
+pub const ESTALE: ::c_int = 72;
+pub const EDQUOT: ::c_int = 19;
+pub const ECANCELED: ::c_int = 11;
+pub const EOWNERDEAD: ::c_int = 62;
+pub const ENOTRECOVERABLE: ::c_int = 56;
+
+pub const ENOSTR: ::c_int = 100;
+pub const EBFONT: ::c_int = 101;
+pub const EBADSLT: ::c_int = 102;
+pub const EBADRQC: ::c_int = 103;
+pub const ENOANO: ::c_int = 104;
+pub const ECHRNG: ::c_int = 106;
+pub const EL3HLT: ::c_int = 107;
+pub const EL3RST: ::c_int = 108;
+pub const ELNRNG: ::c_int = 109;
+pub const EUNATCH: ::c_int = 110;
+pub const ENOCSI: ::c_int = 111;
+pub const EL2HLT: ::c_int = 112;
+pub const EBADE: ::c_int = 113;
+pub const EBADR: ::c_int = 114;
+pub const EXFULL: ::c_int = 115;
+pub const ENODATA: ::c_int = 116;
+pub const ETIME: ::c_int = 117;
+pub const ENOSR: ::c_int = 118;
+pub const ENONET: ::c_int = 119;
+pub const ENOPKG: ::c_int = 120;
+pub const EREMOTE: ::c_int = 121;
+pub const EADV: ::c_int = 122;
+pub const ESRMNT: ::c_int = 123;
+pub const ECOMM: ::c_int = 124;
+pub const EDOTDOT: ::c_int = 125;
+pub const ENOTUNIQ: ::c_int = 126;
+pub const EBADFD: ::c_int = 127;
+pub const EREMCHG: ::c_int = 128;
+pub const ELIBACC: ::c_int = 129;
+pub const ELIBBAD: ::c_int = 130;
+pub const ELIBSCN: ::c_int = 131;
+pub const ELIBMAX: ::c_int = 132;
+pub const ELIBEXEC: ::c_int = 133;
+pub const ERESTART: ::c_int = 134;
+pub const ESTRPIPE: ::c_int = 135;
+pub const EUSERS: ::c_int = 136;
+pub const ESOCKTNOSUPPORT: ::c_int = 137;
+pub const EOPNOTSUPP: ::c_int = 138;
+pub const ENOTSUP: ::c_int = EOPNOTSUPP;
+pub const EPFNOSUPPORT: ::c_int = 139;
+pub const ESHUTDOWN: ::c_int = 140;
+pub const ETOOMANYREFS: ::c_int = 141;
+pub const EHOSTDOWN: ::c_int = 142;
+pub const EUCLEAN: ::c_int = 143;
+pub const ENOTNAM: ::c_int = 144;
+pub const ENAVAIL: ::c_int = 145;
+pub const EISNAM: ::c_int = 146;
+pub const EREMOTEIO: ::c_int = 147;
+pub const ENOMEDIUM: ::c_int = 148;
+pub const EMEDIUMTYPE: ::c_int = 149;
+pub const ENOKEY: ::c_int = 150;
+pub const EKEYEXPIRED: ::c_int = 151;
+pub const EKEYREVOKED: ::c_int = 152;
+pub const EKEYREJECTED: ::c_int = 153;
+pub const ERFKILL: ::c_int = 154;
+pub const EHWPOISON: ::c_int = 155;
+pub const EL2NSYNC: ::c_int = 156;
pub const SA_NODEFER: ::c_int = 0x40000000;
pub const SA_RESETHAND: ::c_int = 0x80000000;
@@ -1286,10 +1408,7 @@ pub const TIOCINQ: ::c_int = ::FIONREAD;
pub const RTLD_GLOBAL: ::c_int = 0x100;
pub const RTLD_NOLOAD: ::c_int = 0x4;
-// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux
-// kernel 3.10). See also linux_like/mod.rs
pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
-pub const CLOCK_TAI: ::clockid_t = 11;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
@@ -1438,93 +1557,9 @@ pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
pub const SOCK_SEQPACKET: ::c_int = 5;
-pub const SOL_SOCKET: ::c_int = 1;
+pub const IPPROTO_MAX: ::c_int = 256;
-pub const EDEADLK: ::c_int = 35;
-pub const ENAMETOOLONG: ::c_int = 36;
-pub const ENOLCK: ::c_int = 37;
-pub const ENOSYS: ::c_int = 38;
-pub const ENOTEMPTY: ::c_int = 39;
-pub const ELOOP: ::c_int = 40;
-pub const ENOMSG: ::c_int = 42;
-pub const EIDRM: ::c_int = 43;
-pub const ECHRNG: ::c_int = 44;
-pub const EL2NSYNC: ::c_int = 45;
-pub const EL3HLT: ::c_int = 46;
-pub const EL3RST: ::c_int = 47;
-pub const ELNRNG: ::c_int = 48;
-pub const EUNATCH: ::c_int = 49;
-pub const ENOCSI: ::c_int = 50;
-pub const EL2HLT: ::c_int = 51;
-pub const EBADE: ::c_int = 52;
-pub const EBADR: ::c_int = 53;
-pub const EXFULL: ::c_int = 54;
-pub const ENOANO: ::c_int = 55;
-pub const EBADRQC: ::c_int = 56;
-pub const EBADSLT: ::c_int = 57;
-pub const EDEADLOCK: ::c_int = EDEADLK;
-pub const EMULTIHOP: ::c_int = 72;
-pub const EBADMSG: ::c_int = 74;
-pub const EOVERFLOW: ::c_int = 75;
-pub const ENOTUNIQ: ::c_int = 76;
-pub const EBADFD: ::c_int = 77;
-pub const EREMCHG: ::c_int = 78;
-pub const ELIBACC: ::c_int = 79;
-pub const ELIBBAD: ::c_int = 80;
-pub const ELIBSCN: ::c_int = 81;
-pub const ELIBMAX: ::c_int = 82;
-pub const ELIBEXEC: ::c_int = 83;
-pub const EILSEQ: ::c_int = 84;
-pub const ERESTART: ::c_int = 85;
-pub const ESTRPIPE: ::c_int = 86;
-pub const EUSERS: ::c_int = 87;
-pub const ENOTSOCK: ::c_int = 88;
-pub const EDESTADDRREQ: ::c_int = 89;
-pub const EMSGSIZE: ::c_int = 90;
-pub const EPROTOTYPE: ::c_int = 91;
-pub const ENOPROTOOPT: ::c_int = 92;
-pub const EPROTONOSUPPORT: ::c_int = 93;
-pub const ESOCKTNOSUPPORT: ::c_int = 94;
-pub const EOPNOTSUPP: ::c_int = 95;
-pub const ENOTSUP: ::c_int = EOPNOTSUPP;
-pub const EPFNOSUPPORT: ::c_int = 96;
-pub const EAFNOSUPPORT: ::c_int = 97;
-pub const EADDRINUSE: ::c_int = 98;
-pub const EADDRNOTAVAIL: ::c_int = 99;
-pub const ENETDOWN: ::c_int = 100;
-pub const ENETUNREACH: ::c_int = 101;
-pub const ENETRESET: ::c_int = 102;
-pub const ECONNABORTED: ::c_int = 103;
-pub const ECONNRESET: ::c_int = 104;
-pub const ENOBUFS: ::c_int = 105;
-pub const EISCONN: ::c_int = 106;
-pub const ENOTCONN: ::c_int = 107;
-pub const ESHUTDOWN: ::c_int = 108;
-pub const ETOOMANYREFS: ::c_int = 109;
-pub const ETIMEDOUT: ::c_int = 110;
-pub const ECONNREFUSED: ::c_int = 111;
-pub const EHOSTDOWN: ::c_int = 112;
-pub const EHOSTUNREACH: ::c_int = 113;
-pub const EALREADY: ::c_int = 114;
-pub const EINPROGRESS: ::c_int = 115;
-pub const ESTALE: ::c_int = 116;
-pub const EUCLEAN: ::c_int = 117;
-pub const ENOTNAM: ::c_int = 118;
-pub const ENAVAIL: ::c_int = 119;
-pub const EISNAM: ::c_int = 120;
-pub const EREMOTEIO: ::c_int = 121;
-pub const EDQUOT: ::c_int = 122;
-pub const ENOMEDIUM: ::c_int = 123;
-pub const EMEDIUMTYPE: ::c_int = 124;
-pub const ECANCELED: ::c_int = 125;
-pub const ENOKEY: ::c_int = 126;
-pub const EKEYEXPIRED: ::c_int = 127;
-pub const EKEYREVOKED: ::c_int = 128;
-pub const EKEYREJECTED: ::c_int = 129;
-pub const EOWNERDEAD: ::c_int = 130;
-pub const ENOTRECOVERABLE: ::c_int = 131;
-pub const ERFKILL: ::c_int = 132;
-pub const EHWPOISON: ::c_int = 133;
+pub const SOL_SOCKET: ::c_int = 1;
pub const SO_REUSEADDR: ::c_int = 2;
pub const SO_TYPE: ::c_int = 3;
@@ -1543,6 +1578,9 @@ pub const SO_RCVTIMEO: ::c_int = 20;
pub const SO_SNDTIMEO: ::c_int = 21;
pub const SO_ACCEPTCONN: ::c_int = 30;
+pub const IPV6_RTHDR_LOOSE: ::c_int = 0;
+pub const IPV6_RTHDR_STRICT: ::c_int = 1;
+
pub const SA_ONSTACK: ::c_int = 0x08000000;
pub const SA_SIGINFO: ::c_int = 0x00000004;
pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
@@ -1580,6 +1618,9 @@ 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;
@@ -1644,6 +1685,10 @@ pub const ARPD_LOOKUP: ::c_ushort = 0x02;
pub const ARPD_FLUSH: ::c_ushort = 0x03;
pub const ATF_MAGIC: ::c_int = 0x80;
+pub const PRIO_PROCESS: ::c_int = 0;
+pub const PRIO_PGRP: ::c_int = 1;
+pub const PRIO_USER: ::c_int = 2;
+
f! {
pub fn CMSG_NXTHDR(mhdr: *const msghdr,
cmsg: *const cmsghdr) -> *mut cmsghdr {
@@ -1696,7 +1741,7 @@ f! {
pub fn major(dev: ::dev_t) -> ::c_uint {
// see
- // https://github.com/kripken/emscripten/blob/
+ // https://github.com/emscripten-core/emscripten/blob/
// master/system/include/libc/sys/sysmacros.h
let mut major = 0;
major |= (dev & 0x00000fff) >> 8;
@@ -1706,7 +1751,7 @@ f! {
pub fn minor(dev: ::dev_t) -> ::c_uint {
// see
- // https://github.com/kripken/emscripten/blob/
+ // https://github.com/emscripten-core/emscripten/blob/
// master/system/include/libc/sys/sysmacros.h
let mut minor = 0;
minor |= (dev & 0x000000ff) >> 0;
@@ -1731,11 +1776,7 @@ extern "C" {
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;
+ pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
pub fn abs(i: ::c_int) -> ::c_int;
pub fn atof(s: *const ::c_char) -> ::c_double;
@@ -1749,23 +1790,12 @@ extern "C" {
pub fn endpwent();
pub fn getpwent() -> *mut passwd;
- pub fn shm_open(
- name: *const c_char,
- oflag: ::c_int,
- mode: mode_t,
- ) -> ::c_int;
+ pub fn shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int;
- pub fn mprotect(
- addr: *mut ::c_void,
- len: ::size_t,
- prot: ::c_int,
- ) -> ::c_int;
+ pub fn 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 fopen64(filename: *const c_char, mode: *const c_char) -> *mut ::FILE;
pub fn freopen64(
filename: *const c_char,
mode: *const c_char,
@@ -1774,38 +1804,22 @@ extern "C" {
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 fseeko64(stream: *mut ::FILE, offset: ::off64_t, whence: ::c_int) -> ::c_int;
pub fn ftello64(stream: *mut ::FILE) -> ::off64_t;
- pub fn posix_fallocate(
- fd: ::c_int,
- offset: ::off_t,
- len: ::off_t,
- ) -> ::c_int;
- pub fn pwritev(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t,
- ) -> ::ssize_t;
- pub fn preadv(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t,
- ) -> ::ssize_t;
+ pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int;
+ pub fn pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t)
+ -> ::ssize_t;
+ pub fn preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t;
pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
- pub fn mkostemps(
- template: *mut ::c_char,
- suffixlen: ::c_int,
- flags: ::c_int,
+ pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int;
+ pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
+ pub fn accept4(
+ fd: ::c_int,
+ addr: *mut ::sockaddr,
+ len: *mut ::socklen_t,
+ flg: ::c_int,
) -> ::c_int;
- pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t)
- -> *mut ::c_char;
pub fn getnameinfo(
sa: *const ::sockaddr,
salen: ::socklen_t,
@@ -1818,11 +1832,7 @@ extern "C" {
pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
// Not available now on Android
- pub fn mkfifoat(
- dirfd: ::c_int,
- pathname: *const ::c_char,
- mode: ::mode_t,
- ) -> ::c_int;
+ pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int;
pub fn if_nameindex() -> *mut if_nameindex;
pub fn if_freenameindex(ptr: *mut if_nameindex);
@@ -1837,35 +1847,21 @@ extern "C" {
pub fn glob(
pattern: *const c_char,
flags: ::c_int,
- errfunc: ::Option<
- extern "C" fn(epath: *const c_char, errno: ::c_int) -> ::c_int,
- >,
+ errfunc: ::Option<extern "C" fn(epath: *const c_char, errno: ::c_int) -> ::c_int>,
pglob: *mut ::glob_t,
) -> ::c_int;
pub fn globfree(pglob: *mut ::glob_t);
- pub fn posix_madvise(
- addr: *mut ::c_void,
- len: ::size_t,
- advice: ::c_int,
- ) -> ::c_int;
+ pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
- pub fn madvise(
- addr: *mut ::c_void,
- len: ::size_t,
- advice: ::c_int,
- ) -> ::c_int;
+ pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
- pub fn msync(
- addr: *mut ::c_void,
- len: ::size_t,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
pub fn recvfrom(
socket: ::c_int,
diff --git a/src/unix/linux_like/linux/align.rs b/src/unix/linux_like/linux/align.rs
index 6000b416..11f5504a 100644
--- a/src/unix/linux_like/linux/align.rs
+++ b/src/unix/linux_like/linux/align.rs
@@ -7,7 +7,9 @@ macro_rules! expand_align {
target_arch = "mips64",
target_arch = "s390x",
target_arch = "sparc64",
- target_arch = "aarch64"),
+ target_arch = "aarch64",
+ target_arch = "riscv64",
+ target_arch = "riscv32"),
repr(align(4)))]
#[cfg_attr(not(any(target_pointer_width = "32",
target_arch = "x86_64",
@@ -15,7 +17,9 @@ macro_rules! expand_align {
target_arch = "mips64",
target_arch = "s390x",
target_arch = "sparc64",
- target_arch = "aarch64")),
+ target_arch = "aarch64",
+ target_arch = "riscv64",
+ target_arch = "riscv32")),
repr(align(8)))]
pub struct pthread_mutexattr_t {
#[doc(hidden)]
@@ -37,6 +41,17 @@ macro_rules! expand_align {
#[doc(hidden)]
size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
}
+
+ #[repr(align(8))]
+ pub struct fanotify_event_metadata {
+ pub event_len: __u32,
+ pub vers: __u8,
+ pub reserved: __u8,
+ pub metadata_len: __u16,
+ pub mask: __u64,
+ pub fd: ::c_int,
+ pub pid: ::c_int,
+ }
}
s_no_extra_traits! {
@@ -101,6 +116,29 @@ macro_rules! expand_align {
pub struct pthread_rwlock_t {
size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T],
}
+
+ // linux/can.h
+ #[repr(align(8))]
+ #[allow(missing_debug_implementations)]
+ pub struct can_frame {
+ pub can_id: canid_t,
+ pub can_dlc: u8,
+ __pad: u8,
+ __res0: u8,
+ __res1: u8,
+ pub data: [u8; CAN_MAX_DLEN],
+ }
+
+ #[repr(align(8))]
+ #[allow(missing_debug_implementations)]
+ pub struct canfd_frame {
+ pub can_id: canid_t,
+ pub len: u8,
+ pub flags: u8,
+ __res0: u8,
+ __res1: u8,
+ pub data: [u8; CANFD_MAX_DLEN],
+ }
}
};
}
diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs
new file mode 100644
index 00000000..e3401d4b
--- /dev/null
+++ b/src/unix/linux_like/linux/arch/generic/mod.rs
@@ -0,0 +1,100 @@
+// include/uapi/asm-generic/socket.h
+// arch/alpha/include/uapi/asm/socket.h
+// tools/include/uapi/asm-generic/socket.h
+// arch/mips/include/uapi/asm/socket.h
+pub const SOL_SOCKET: ::c_int = 1;
+
+// Defined in unix/linux_like/mod.rs
+// pub const SO_DEBUG: ::c_int = 1;
+pub const SO_REUSEADDR: ::c_int = 2;
+pub const SO_TYPE: ::c_int = 3;
+pub const SO_ERROR: ::c_int = 4;
+pub const SO_DONTROUTE: ::c_int = 5;
+pub const SO_BROADCAST: ::c_int = 6;
+pub const SO_SNDBUF: ::c_int = 7;
+pub const SO_RCVBUF: ::c_int = 8;
+pub const SO_KEEPALIVE: ::c_int = 9;
+pub const SO_OOBINLINE: ::c_int = 10;
+pub const SO_NO_CHECK: ::c_int = 11;
+pub const SO_PRIORITY: ::c_int = 12;
+pub const SO_LINGER: ::c_int = 13;
+pub const SO_BSDCOMPAT: ::c_int = 14;
+pub const SO_REUSEPORT: ::c_int = 15;
+pub const SO_PASSCRED: ::c_int = 16;
+pub const SO_PEERCRED: ::c_int = 17;
+pub const SO_RCVLOWAT: ::c_int = 18;
+pub const SO_SNDLOWAT: ::c_int = 19;
+pub const SO_RCVTIMEO: ::c_int = 20;
+pub const SO_SNDTIMEO: ::c_int = 21;
+// pub const SO_RCVTIMEO_OLD: ::c_int = 20;
+// pub const SO_SNDTIMEO_OLD: ::c_int = 21;
+pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22;
+pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
+pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
+pub const SO_BINDTODEVICE: ::c_int = 25;
+pub const SO_ATTACH_FILTER: ::c_int = 26;
+pub const SO_DETACH_FILTER: ::c_int = 27;
+pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
+pub const SO_PEERNAME: ::c_int = 28;
+pub const SO_TIMESTAMP: ::c_int = 29;
+// pub const SO_TIMESTAMP_OLD: ::c_int = 29;
+pub const SO_ACCEPTCONN: ::c_int = 30;
+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_WIFI_STATUS: ::c_int = 41;
+pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS;
+pub const SO_PEEK_OFF: ::c_int = 42;
+pub const SO_NOFCS: ::c_int = 43;
+pub const SO_LOCK_FILTER: ::c_int = 44;
+pub const SO_SELECT_ERR_QUEUE: ::c_int = 45;
+pub const SO_BUSY_POLL: ::c_int = 46;
+pub const SO_MAX_PACING_RATE: ::c_int = 47;
+pub const SO_BPF_EXTENSIONS: ::c_int = 48;
+pub const SO_INCOMING_CPU: ::c_int = 49;
+pub const SO_ATTACH_BPF: ::c_int = 50;
+pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER;
+pub const SO_ATTACH_REUSEPORT_CBPF: ::c_int = 51;
+pub const SO_ATTACH_REUSEPORT_EBPF: ::c_int = 52;
+pub const SO_CNX_ADVICE: ::c_int = 53;
+pub const SCM_TIMESTAMPING_OPT_STATS: ::c_int = 54;
+pub const SO_MEMINFO: ::c_int = 55;
+pub const SO_INCOMING_NAPI_ID: ::c_int = 56;
+pub const SO_COOKIE: ::c_int = 57;
+pub const SCM_TIMESTAMPING_PKTINFO: ::c_int = 58;
+pub const SO_PEERGROUPS: ::c_int = 59;
+pub const SO_ZEROCOPY: ::c_int = 60;
+pub const SO_TXTIME: ::c_int = 61;
+pub const SCM_TXTIME: ::c_int = SO_TXTIME;
+pub const SO_BINDTOIFINDEX: ::c_int = 62;
+cfg_if! {
+ // Some of these platforms in CI already have these constants.
+ // But they may still not have those _OLD ones.
+ if #[cfg(all(any(target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "aarch64"),
+ not(target_env = "musl")))] {
+ pub const SO_TIMESTAMP_NEW: ::c_int = 63;
+ pub const SO_TIMESTAMPNS_NEW: ::c_int = 64;
+ pub const SO_TIMESTAMPING_NEW: ::c_int = 65;
+ pub const SO_RCVTIMEO_NEW: ::c_int = 66;
+ pub const SO_SNDTIMEO_NEW: ::c_int = 67;
+ pub const SO_DETACH_REUSEPORT_BPF: ::c_int = 68;
+ }
+}
+// pub const SO_PREFER_BUSY_POLL: ::c_int = 69;
+// pub const SO_BUSY_POLL_BUDGET: ::c_int = 70;
+
+// 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;
diff --git a/src/unix/linux_like/linux/arch/mips/mod.rs b/src/unix/linux_like/linux/arch/mips/mod.rs
new file mode 100644
index 00000000..cdbdca2b
--- /dev/null
+++ b/src/unix/linux_like/linux/arch/mips/mod.rs
@@ -0,0 +1,96 @@
+// arch/mips/include/uapi/asm/socket.h
+pub const SOL_SOCKET: ::c_int = 0xffff;
+
+// Defined in unix/linux_like/mod.rs
+// pub const SO_DEBUG: ::c_int = 0x0001;
+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_LINGER: ::c_int = 0x0080;
+pub const SO_OOBINLINE: ::c_int = 0x0100;
+pub const SO_REUSEPORT: ::c_int = 0x0200;
+pub const SO_TYPE: ::c_int = 0x1008;
+// pub const SO_STYLE: ::c_int = SO_TYPE;
+pub const SO_ERROR: ::c_int = 0x1007;
+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;
+// NOTE: These definitions are now being renamed with _OLD postfix,
+// but CI haven't support them yet.
+// Some related consts could be found in b32.rs and b64.rs
+pub const SO_SNDTIMEO: ::c_int = 0x1005;
+pub const SO_RCVTIMEO: ::c_int = 0x1006;
+// pub const SO_SNDTIMEO_OLD: ::c_int = 0x1005;
+// pub const SO_RCVTIMEO_OLD: ::c_int = 0x1006;
+pub const SO_ACCEPTCONN: ::c_int = 0x1009;
+pub const SO_PROTOCOL: ::c_int = 0x1028;
+pub const SO_DOMAIN: ::c_int = 0x1029;
+
+pub const SO_NO_CHECK: ::c_int = 11;
+pub const SO_PRIORITY: ::c_int = 12;
+pub const SO_BSDCOMPAT: ::c_int = 14;
+pub const SO_PASSCRED: ::c_int = 17;
+pub const SO_PEERCRED: ::c_int = 18;
+pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22;
+pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
+pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
+pub const SO_BINDTODEVICE: ::c_int = 25;
+pub const SO_ATTACH_FILTER: ::c_int = 26;
+pub const SO_DETACH_FILTER: ::c_int = 27;
+pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
+pub const SO_PEERNAME: ::c_int = 28;
+pub const SO_PEERSEC: ::c_int = 30;
+pub const SO_SNDBUFFORCE: ::c_int = 31;
+pub const SO_RCVBUFFORCE: ::c_int = 33;
+pub const SO_PASSSEC: ::c_int = 34;
+pub const SO_MARK: ::c_int = 36;
+pub const SO_RXQ_OVFL: ::c_int = 40;
+pub const SO_WIFI_STATUS: ::c_int = 41;
+pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS;
+pub const SO_PEEK_OFF: ::c_int = 42;
+pub const SO_NOFCS: ::c_int = 43;
+pub const SO_LOCK_FILTER: ::c_int = 44;
+pub const SO_SELECT_ERR_QUEUE: ::c_int = 45;
+pub const SO_BUSY_POLL: ::c_int = 46;
+pub const SO_MAX_PACING_RATE: ::c_int = 47;
+pub const SO_BPF_EXTENSIONS: ::c_int = 48;
+pub const SO_INCOMING_CPU: ::c_int = 49;
+pub const SO_ATTACH_BPF: ::c_int = 50;
+pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER;
+pub const SO_ATTACH_REUSEPORT_CBPF: ::c_int = 51;
+pub const SO_ATTACH_REUSEPORT_EBPF: ::c_int = 52;
+pub const SO_CNX_ADVICE: ::c_int = 53;
+pub const SCM_TIMESTAMPING_OPT_STATS: ::c_int = 54;
+pub const SO_MEMINFO: ::c_int = 55;
+pub const SO_INCOMING_NAPI_ID: ::c_int = 56;
+pub const SO_COOKIE: ::c_int = 57;
+pub const SCM_TIMESTAMPING_PKTINFO: ::c_int = 58;
+pub const SO_PEERGROUPS: ::c_int = 59;
+pub const SO_ZEROCOPY: ::c_int = 60;
+pub const SO_TXTIME: ::c_int = 61;
+pub const SCM_TXTIME: ::c_int = SO_TXTIME;
+pub const SO_BINDTOIFINDEX: ::c_int = 62;
+// NOTE: These definitions are now being renamed with _OLD postfix,
+// but CI haven't support them yet.
+// Some related consts could be found in b32.rs and b64.rs
+pub const SO_TIMESTAMP: ::c_int = 29;
+pub const SO_TIMESTAMPNS: ::c_int = 35;
+pub const SO_TIMESTAMPING: ::c_int = 37;
+// pub const SO_TIMESTAMP_OLD: ::c_int = 29;
+// pub const SO_TIMESTAMPNS_OLD: ::c_int = 35;
+// pub const SO_TIMESTAMPING_OLD: ::c_int = 37;
+// pub const SO_TIMESTAMP_NEW: ::c_int = 63;
+// pub const SO_TIMESTAMPNS_NEW: ::c_int = 64;
+// pub const SO_TIMESTAMPING_NEW: ::c_int = 65;
+// pub const SO_RCVTIMEO_NEW: ::c_int = 66;
+// pub const SO_SNDTIMEO_NEW: ::c_int = 67;
+// pub const SO_DETACH_REUSEPORT_BPF: ::c_int = 68;
+// pub const SO_PREFER_BUSY_POLL: ::c_int = 69;
+// pub const SO_BUSY_POLL_BUDGET: ::c_int = 70;
+
+// 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;
diff --git a/src/unix/linux_like/linux/arch/mod.rs b/src/unix/linux_like/linux/arch/mod.rs
new file mode 100644
index 00000000..c1528f59
--- /dev/null
+++ b/src/unix/linux_like/linux/arch/mod.rs
@@ -0,0 +1,15 @@
+cfg_if! {
+ if #[cfg(any(target_arch = "mips", target_arch = "mips64"))] {
+ mod mips;
+ pub use self::mips::*;
+ } else if #[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))] {
+ mod powerpc;
+ pub use self::powerpc::*;
+ } else if #[cfg(any(target_arch = "sparc", target_arch = "sparc64"))] {
+ mod sparc;
+ pub use self::sparc::*;
+ } else {
+ mod generic;
+ pub use self::generic::*;
+ }
+}
diff --git a/src/unix/linux_like/linux/arch/powerpc/mod.rs b/src/unix/linux_like/linux/arch/powerpc/mod.rs
new file mode 100644
index 00000000..89cc09e3
--- /dev/null
+++ b/src/unix/linux_like/linux/arch/powerpc/mod.rs
@@ -0,0 +1,91 @@
+// arch/powerpc/include/uapi/asm/socket.h
+
+pub const SOL_SOCKET: ::c_int = 1;
+
+// Defined in unix/linux_like/mod.rs
+// pub const SO_DEBUG: ::c_int = 1;
+pub const SO_REUSEADDR: ::c_int = 2;
+pub const SO_TYPE: ::c_int = 3;
+pub const SO_ERROR: ::c_int = 4;
+pub const SO_DONTROUTE: ::c_int = 5;
+pub const SO_BROADCAST: ::c_int = 6;
+pub const SO_SNDBUF: ::c_int = 7;
+pub const SO_RCVBUF: ::c_int = 8;
+pub const SO_KEEPALIVE: ::c_int = 9;
+pub const SO_OOBINLINE: ::c_int = 10;
+pub const SO_NO_CHECK: ::c_int = 11;
+pub const SO_PRIORITY: ::c_int = 12;
+pub const SO_LINGER: ::c_int = 13;
+pub const SO_BSDCOMPAT: ::c_int = 14;
+pub const SO_REUSEPORT: ::c_int = 15;
+// powerpc only differs in these
+pub const SO_RCVLOWAT: ::c_int = 16;
+pub const SO_SNDLOWAT: ::c_int = 17;
+pub const SO_RCVTIMEO: ::c_int = 18;
+pub const SO_SNDTIMEO: ::c_int = 19;
+// pub const SO_RCVTIMEO_OLD: ::c_int = 18;
+// pub const SO_SNDTIMEO_OLD: ::c_int = 19;
+pub const SO_PASSCRED: ::c_int = 20;
+pub const SO_PEERCRED: ::c_int = 21;
+// end
+pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22;
+pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
+pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
+pub const SO_BINDTODEVICE: ::c_int = 25;
+pub const SO_ATTACH_FILTER: ::c_int = 26;
+pub const SO_DETACH_FILTER: ::c_int = 27;
+pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
+pub const SO_PEERNAME: ::c_int = 28;
+pub const SO_TIMESTAMP: ::c_int = 29;
+// pub const SO_TIMESTAMP_OLD: ::c_int = 29;
+pub const SO_ACCEPTCONN: ::c_int = 30;
+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_WIFI_STATUS: ::c_int = 41;
+pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS;
+pub const SO_PEEK_OFF: ::c_int = 42;
+pub const SO_NOFCS: ::c_int = 43;
+pub const SO_LOCK_FILTER: ::c_int = 44;
+pub const SO_SELECT_ERR_QUEUE: ::c_int = 45;
+pub const SO_BUSY_POLL: ::c_int = 46;
+pub const SO_MAX_PACING_RATE: ::c_int = 47;
+pub const SO_BPF_EXTENSIONS: ::c_int = 48;
+pub const SO_INCOMING_CPU: ::c_int = 49;
+pub const SO_ATTACH_BPF: ::c_int = 50;
+pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER;
+pub const SO_ATTACH_REUSEPORT_CBPF: ::c_int = 51;
+pub const SO_ATTACH_REUSEPORT_EBPF: ::c_int = 52;
+pub const SO_CNX_ADVICE: ::c_int = 53;
+pub const SCM_TIMESTAMPING_OPT_STATS: ::c_int = 54;
+pub const SO_MEMINFO: ::c_int = 55;
+pub const SO_INCOMING_NAPI_ID: ::c_int = 56;
+pub const SO_COOKIE: ::c_int = 57;
+pub const SCM_TIMESTAMPING_PKTINFO: ::c_int = 58;
+pub const SO_PEERGROUPS: ::c_int = 59;
+pub const SO_ZEROCOPY: ::c_int = 60;
+pub const SO_TXTIME: ::c_int = 61;
+pub const SCM_TXTIME: ::c_int = SO_TXTIME;
+pub const SO_BINDTOIFINDEX: ::c_int = 62;
+// pub const SO_TIMESTAMP_NEW: ::c_int = 63;
+// pub const SO_TIMESTAMPNS_NEW: ::c_int = 64;
+// pub const SO_TIMESTAMPING_NEW: ::c_int = 65;
+// pub const SO_RCVTIMEO_NEW: ::c_int = 66;
+// pub const SO_SNDTIMEO_NEW: ::c_int = 67;
+// pub const SO_DETACH_REUSEPORT_BPF: ::c_int = 68;
+// pub const SO_PREFER_BUSY_POLL: ::c_int = 69;
+// pub const SO_BUSY_POLL_BUDGET: ::c_int = 70;
+
+// 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;
diff --git a/src/unix/linux_like/linux/arch/sparc/mod.rs b/src/unix/linux_like/linux/arch/sparc/mod.rs
new file mode 100644
index 00000000..d4f9bb0e
--- /dev/null
+++ b/src/unix/linux_like/linux/arch/sparc/mod.rs
@@ -0,0 +1,88 @@
+// arch/sparc/include/uapi/asm/socket.h
+pub const SOL_SOCKET: ::c_int = 0xffff;
+
+// Defined in unix/linux_like/mod.rs
+// pub const SO_DEBUG: ::c_int = 0x0001;
+pub const SO_PASSCRED: ::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_PEERCRED: ::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_BSDCOMPAT: ::c_int = 0x0400;
+pub const SO_RCVLOWAT: ::c_int = 0x0800;
+pub const SO_SNDLOWAT: ::c_int = 0x1000;
+pub const SO_RCVTIMEO: ::c_int = 0x2000;
+pub const SO_SNDTIMEO: ::c_int = 0x4000;
+// pub const SO_RCVTIMEO_OLD: ::c_int = 0x2000;
+// pub const SO_SNDTIMEO_OLD: ::c_int = 0x4000;
+pub const SO_ACCEPTCONN: ::c_int = 0x8000;
+pub const SO_SNDBUF: ::c_int = 0x1001;
+pub const SO_RCVBUF: ::c_int = 0x1002;
+pub const SO_SNDBUFFORCE: ::c_int = 0x100a;
+pub const SO_RCVBUFFORCE: ::c_int = 0x100b;
+pub const SO_ERROR: ::c_int = 0x1007;
+pub const SO_TYPE: ::c_int = 0x1008;
+pub const SO_PROTOCOL: ::c_int = 0x1028;
+pub const SO_DOMAIN: ::c_int = 0x1029;
+pub const SO_NO_CHECK: ::c_int = 0x000b;
+pub const SO_PRIORITY: ::c_int = 0x000c;
+pub const SO_BINDTODEVICE: ::c_int = 0x000d;
+pub const SO_ATTACH_FILTER: ::c_int = 0x001a;
+pub const SO_DETACH_FILTER: ::c_int = 0x001b;
+pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
+pub const SO_PEERNAME: ::c_int = 0x001c;
+pub const SO_PEERSEC: ::c_int = 0x001e;
+pub const SO_PASSSEC: ::c_int = 0x001f;
+pub const SO_MARK: ::c_int = 0x0022;
+pub const SO_RXQ_OVFL: ::c_int = 0x0024;
+pub const SO_WIFI_STATUS: ::c_int = 0x0025;
+pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS;
+pub const SO_PEEK_OFF: ::c_int = 0x0026;
+pub const SO_NOFCS: ::c_int = 0x0027;
+pub const SO_LOCK_FILTER: ::c_int = 0x0028;
+pub const SO_SELECT_ERR_QUEUE: ::c_int = 0x0029;
+pub const SO_BUSY_POLL: ::c_int = 0x0030;
+pub const SO_MAX_PACING_RATE: ::c_int = 0x0031;
+pub const SO_BPF_EXTENSIONS: ::c_int = 0x0032;
+pub const SO_INCOMING_CPU: ::c_int = 0x0033;
+pub const SO_ATTACH_BPF: ::c_int = 0x0034;
+pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER;
+pub const SO_ATTACH_REUSEPORT_CBPF: ::c_int = 0x0035;
+pub const SO_ATTACH_REUSEPORT_EBPF: ::c_int = 0x0036;
+pub const SO_CNX_ADVICE: ::c_int = 0x0037;
+pub const SCM_TIMESTAMPING_OPT_STATS: ::c_int = 0x0038;
+pub const SO_MEMINFO: ::c_int = 0x0039;
+pub const SO_INCOMING_NAPI_ID: ::c_int = 0x003a;
+pub const SO_COOKIE: ::c_int = 0x003b;
+pub const SCM_TIMESTAMPING_PKTINFO: ::c_int = 0x003c;
+pub const SO_PEERGROUPS: ::c_int = 0x003d;
+pub const SO_ZEROCOPY: ::c_int = 0x003e;
+pub const SO_TXTIME: ::c_int = 0x003f;
+pub const SCM_TXTIME: ::c_int = SO_TXTIME;
+pub const SO_BINDTOIFINDEX: ::c_int = 0x0041;
+pub const SO_SECURITY_AUTHENTICATION: ::c_int = 0x5001;
+pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 0x5002;
+pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 0x5004;
+pub const SO_TIMESTAMP: ::c_int = 0x001d;
+pub const SO_TIMESTAMPNS: ::c_int = 0x0021;
+pub const SO_TIMESTAMPING: ::c_int = 0x0023;
+// pub const SO_TIMESTAMP_OLD: ::c_int = 0x001d;
+// pub const SO_TIMESTAMPNS_OLD: ::c_int = 0x0021;
+// pub const SO_TIMESTAMPING_OLD: ::c_int = 0x0023;
+// pub const SO_TIMESTAMP_NEW: ::c_int = 0x0046;
+// pub const SO_TIMESTAMPNS_NEW: ::c_int = 0x0042;
+// pub const SO_TIMESTAMPING_NEW: ::c_int = 0x0043;
+// pub const SO_RCVTIMEO_NEW: ::c_int = 0x0044;
+// pub const SO_SNDTIMEO_NEW: ::c_int = 0x0045;
+// pub const SO_DETACH_REUSEPORT_BPF: ::c_int = 0x0047;
+// pub const SO_PREFER_BUSY_POLL: ::c_int = 0x0048;
+// pub const SO_BUSY_POLL_BUDGET: ::c_int = 0x0049;
+
+// 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;
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 0a5fc856..0e7fb70f 100644
--- a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs
@@ -212,8 +212,7 @@ 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 SOL_SOCKET: ::c_int = 1;
+pub const MAP_SYNC: ::c_int = 0x080000;
pub const EDEADLOCK: ::c_int = 35;
pub const EUCLEAN: ::c_int = 117;
@@ -300,29 +299,6 @@ pub const ENOTRECOVERABLE: ::c_int = 131;
pub const EHWPOISON: ::c_int = 133;
pub const ERFKILL: ::c_int = 132;
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_TYPE: ::c_int = 3;
-pub const SO_ERROR: ::c_int = 4;
-pub const SO_DONTROUTE: ::c_int = 5;
-pub const SO_BROADCAST: ::c_int = 6;
-pub const SO_SNDBUF: ::c_int = 7;
-pub const SO_RCVBUF: ::c_int = 8;
-pub const SO_KEEPALIVE: ::c_int = 9;
-pub const SO_OOBINLINE: ::c_int = 10;
-pub const SO_LINGER: ::c_int = 13;
-pub const SO_REUSEPORT: ::c_int = 15;
-pub const SO_ACCEPTCONN: ::c_int = 30;
-pub const SO_PROTOCOL: ::c_int = 38;
-pub const SO_DOMAIN: ::c_int = 39;
-pub const SO_PASSCRED: ::c_int = 16;
-pub const SO_PEERCRED: ::c_int = 17;
-pub const SO_RCVLOWAT: ::c_int = 18;
-pub const SO_SNDLOWAT: ::c_int = 19;
-pub const SO_RCVTIMEO: ::c_int = 20;
-pub const SO_SNDTIMEO: ::c_int = 21;
-pub const SO_SNDBUFFORCE: ::c_int = 32;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-
pub const SA_SIGINFO: ::c_int = 0x00000004;
pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
@@ -867,6 +843,25 @@ pub const SYS_pkey_mprotect: ::c_long = 394;
pub const SYS_pkey_alloc: ::c_long = 395;
pub const SYS_pkey_free: ::c_long = 396;
pub const SYS_statx: ::c_long = 397;
+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;
cfg_if! {
if #[cfg(libc_align)] {
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 4a3b600a..4ded201f 100644
--- a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs
@@ -527,6 +527,25 @@ pub const SYS_pkey_mprotect: ::c_long = 4000 + 363;
pub const SYS_pkey_alloc: ::c_long = 4000 + 364;
pub const SYS_pkey_free: ::c_long = 4000 + 365;
pub const SYS_statx: ::c_long = 4000 + 366;
+pub const SYS_pidfd_send_signal: ::c_long = 4000 + 424;
+pub const SYS_io_uring_setup: ::c_long = 4000 + 425;
+pub const SYS_io_uring_enter: ::c_long = 4000 + 426;
+pub const SYS_io_uring_register: ::c_long = 4000 + 427;
+pub const SYS_open_tree: ::c_long = 4000 + 428;
+pub const SYS_move_mount: ::c_long = 4000 + 429;
+pub const SYS_fsopen: ::c_long = 4000 + 430;
+pub const SYS_fsconfig: ::c_long = 4000 + 431;
+pub const SYS_fsmount: ::c_long = 4000 + 432;
+pub const SYS_fspick: ::c_long = 4000 + 433;
+pub const SYS_pidfd_open: ::c_long = 4000 + 434;
+pub const SYS_clone3: ::c_long = 4000 + 435;
+pub const SYS_close_range: ::c_long = 4000 + 436;
+pub const SYS_openat2: ::c_long = 4000 + 437;
+pub const SYS_pidfd_getfd: ::c_long = 4000 + 438;
+pub const SYS_faccessat2: ::c_long = 4000 + 439;
+pub const SYS_process_madvise: ::c_long = 4000 + 440;
+pub const SYS_epoll_pwait2: ::c_long = 4000 + 441;
+pub const SYS_mount_setattr: ::c_long = 4000 + 442;
pub const O_DIRECT: ::c_int = 0x8000;
pub const O_DIRECTORY: ::c_int = 0x10000;
@@ -649,55 +668,6 @@ pub const MAP_STACK: ::c_int = 0x40000;
pub const SOCK_STREAM: ::c_int = 2;
pub const SOCK_DGRAM: ::c_int = 1;
-pub const SOL_SOCKET: ::c_int = 0xffff;
-
-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_LINGER: ::c_int = 0x0080;
-pub const SO_OOBINLINE: ::c_int = 0x0100;
-pub const SO_REUSEPORT: ::c_int = 0x0200;
-pub const SO_TYPE: ::c_int = 0x1008;
-pub const SO_STYLE: ::c_int = SO_TYPE;
-pub const SO_ERROR: ::c_int = 0x1007;
-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_ACCEPTCONN: ::c_int = 0x1009;
-pub const SO_PROTOCOL: ::c_int = 0x1028;
-pub const SO_DOMAIN: ::c_int = 0x1029;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PASSCRED: ::c_int = 17;
-pub const SO_PEERCRED: ::c_int = 18;
-pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22;
-pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
-pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
-pub const SO_ATTACH_FILTER: ::c_int = 26;
-pub const SO_DETACH_FILTER: ::c_int = 27;
-pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
-pub const SO_PEERNAME: ::c_int = 28;
-pub const SO_PEERSEC: ::c_int = 30;
-pub const SO_SNDBUFFORCE: ::c_int = 31;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_PASSSEC: ::c_int = 34;
-pub const SO_TIMESTAMPNS: ::c_int = 35;
-pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
-
-pub const SO_WIFI_STATUS: ::c_int = 41;
-pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS;
-pub const SO_NOFCS: ::c_int = 43;
-pub const SO_LOCK_FILTER: ::c_int = 44;
-pub const SO_SELECT_ERR_QUEUE: ::c_int = 45;
-pub const SO_MAX_PACING_RATE: ::c_int = 47;
-pub const SO_BPF_EXTENSIONS: ::c_int = 48;
-pub const SO_INCOMING_CPU: ::c_int = 49;
-pub const SO_ATTACH_BPF: ::c_int = 50;
-pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER;
-
pub const FIOCLEX: ::c_ulong = 0x6601;
pub const FIONCLEX: ::c_ulong = 0x6602;
pub const FIONBIO: ::c_ulong = 0x667e;
diff --git a/src/unix/linux_like/linux/gnu/b32/mod.rs b/src/unix/linux_like/linux/gnu/b32/mod.rs
index cc6b6367..239492b1 100644
--- a/src/unix/linux_like/linux/gnu/b32/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b32/mod.rs
@@ -5,22 +5,39 @@ use pthread_mutex_t;
pub type c_long = i32;
pub type c_ulong = u32;
pub type clock_t = i32;
-pub type time_t = i32;
-pub type suseconds_t = i32;
-pub type ino_t = u32;
-pub type off_t = i32;
-pub type blkcnt_t = i32;
-
-pub type fsblkcnt_t = ::c_ulong;
-pub type fsfilcnt_t = ::c_ulong;
-pub type rlim_t = c_ulong;
+
pub type shmatt_t = ::c_ulong;
pub type msgqnum_t = ::c_ulong;
pub type msglen_t = ::c_ulong;
-pub type blksize_t = i32;
pub type nlink_t = u32;
pub type __u64 = ::c_ulonglong;
pub type __fsword_t = i32;
+pub type fsblkcnt64_t = u64;
+pub type fsfilcnt64_t = u64;
+
+cfg_if! {
+ if #[cfg(target_arch = "riscv32")] {
+ pub type time_t = i64;
+ pub type suseconds_t = i64;
+ pub type ino_t = u64;
+ pub type off_t = i64;
+ pub type blkcnt_t = i64;
+ pub type fsblkcnt_t = u64;
+ pub type fsfilcnt_t = u64;
+ pub type rlim_t = u64;
+ pub type blksize_t = i64;
+ } else {
+ pub type time_t = i32;
+ pub type suseconds_t = i32;
+ pub type ino_t = u32;
+ pub type off_t = i32;
+ pub type blkcnt_t = i32;
+ pub type fsblkcnt_t = ::c_ulong;
+ pub type fsfilcnt_t = ::c_ulong;
+ pub type rlim_t = c_ulong;
+ pub type blksize_t = i32;
+ }
+}
s! {
pub struct stat {
@@ -115,71 +132,121 @@ s! {
pub mem_unit: ::c_uint,
pub _f: [::c_char; 8],
}
+
+ pub struct ip_mreqn {
+ pub imr_multiaddr: ::in_addr,
+ pub imr_address: ::in_addr,
+ pub imr_ifindex: ::c_int,
+ }
}
-pub const O_NOATIME: ::c_int = 0o1000000;
-pub const O_PATH: ::c_int = 0o10000000;
-pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
+pub const POSIX_FADV_DONTNEED: ::c_int = 4;
+pub const POSIX_FADV_NOREUSE: ::c_int = 5;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_BSDCOMPAT: ::c_int = 14;
-pub const SO_BINDTODEVICE: ::c_int = 25;
-pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SO_MARK: ::c_int = 36;
-pub const SO_RXQ_OVFL: ::c_int = 40;
-pub const SO_PEEK_OFF: ::c_int = 42;
-pub const SO_BUSY_POLL: ::c_int = 46;
+pub const F_OFD_GETLK: ::c_int = 36;
+pub const F_OFD_SETLK: ::c_int = 37;
+pub const F_OFD_SETLKW: ::c_int = 38;
-pub const SA_ONSTACK: ::c_int = 0x08000000;
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
+pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
+pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
-pub const PTRACE_DETACH: ::c_uint = 17;
-pub const POSIX_FADV_DONTNEED: ::c_int = 4;
-pub const POSIX_FADV_NOREUSE: ::c_int = 5;
+cfg_if! {
+ if #[cfg(target_arch = "sparc")] {
+ pub const O_NOATIME: ::c_int = 0x200000;
+ pub const O_PATH: ::c_int = 0x1000000;
+ pub const O_TMPFILE: ::c_int = 0x2000000 | O_DIRECTORY;
-pub const F_SETLK: ::c_int = 6;
-pub const F_SETLKW: ::c_int = 7;
+ pub const SA_ONSTACK: ::c_int = 1;
-pub const F_RDLCK: ::c_int = 0;
-pub const F_WRLCK: ::c_int = 1;
-pub const F_UNLCK: ::c_int = 2;
+ pub const PTRACE_DETACH: ::c_uint = 11;
-pub const SFD_CLOEXEC: ::c_int = 0x080000;
+ pub const F_SETLK: ::c_int = 8;
+ pub const F_SETLKW: ::c_int = 9;
-pub const NCCS: usize = 32;
+ pub const F_RDLCK: ::c_int = 1;
+ pub const F_WRLCK: ::c_int = 2;
+ pub const F_UNLCK: ::c_int = 3;
-pub const O_TRUNC: ::c_int = 512;
+ pub const SFD_CLOEXEC: ::c_int = 0x400000;
-pub const O_CLOEXEC: ::c_int = 0x80000;
+ pub const NCCS: usize = 17;
-pub const EBFONT: ::c_int = 59;
-pub const ENOSTR: ::c_int = 60;
-pub const ENODATA: ::c_int = 61;
-pub const ETIME: ::c_int = 62;
-pub const ENOSR: ::c_int = 63;
-pub const ENONET: ::c_int = 64;
-pub const ENOPKG: ::c_int = 65;
-pub const EREMOTE: ::c_int = 66;
-pub const ENOLINK: ::c_int = 67;
-pub const EADV: ::c_int = 68;
-pub const ESRMNT: ::c_int = 69;
-pub const ECOMM: ::c_int = 70;
-pub const EPROTO: ::c_int = 71;
-pub const EDOTDOT: ::c_int = 73;
+ pub const O_TRUNC: ::c_int = 0x400;
+ pub const O_CLOEXEC: ::c_int = 0x400000;
-pub const SA_NODEFER: ::c_int = 0x40000000;
-pub const SA_RESETHAND: ::c_int = 0x80000000;
-pub const SA_RESTART: ::c_int = 0x10000000;
-pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
+ pub const EBFONT: ::c_int = 109;
+ pub const ENOSTR: ::c_int = 72;
+ pub const ENODATA: ::c_int = 111;
+ pub const ETIME: ::c_int = 73;
+ pub const ENOSR: ::c_int = 74;
+ pub const ENONET: ::c_int = 80;
+ pub const ENOPKG: ::c_int = 113;
+ pub const EREMOTE: ::c_int = 71;
+ pub const ENOLINK: ::c_int = 82;
+ pub const EADV: ::c_int = 83;
+ pub const ESRMNT: ::c_int = 84;
+ pub const ECOMM: ::c_int = 85;
+ pub const EPROTO: ::c_int = 86;
+ pub const EDOTDOT: ::c_int = 88;
-pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
+ pub const SA_NODEFER: ::c_int = 0x20;
+ pub const SA_RESETHAND: ::c_int = 0x4;
+ pub const SA_RESTART: ::c_int = 0x2;
+ pub const SA_NOCLDSTOP: ::c_int = 0x00000008;
-pub const EFD_CLOEXEC: ::c_int = 0x80000;
+ pub const EPOLL_CLOEXEC: ::c_int = 0x400000;
-pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
-pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
-pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
-pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
-pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
+ pub const EFD_CLOEXEC: ::c_int = 0x400000;
+ } else {
+ pub const O_NOATIME: ::c_int = 0o1000000;
+ pub const O_PATH: ::c_int = 0o10000000;
+ pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
+
+ pub const SA_ONSTACK: ::c_int = 0x08000000;
+
+ pub const PTRACE_DETACH: ::c_uint = 17;
+
+ pub const F_SETLK: ::c_int = 6;
+ pub const F_SETLKW: ::c_int = 7;
+
+ pub const F_RDLCK: ::c_int = 0;
+ pub const F_WRLCK: ::c_int = 1;
+ pub const F_UNLCK: ::c_int = 2;
+
+ pub const SFD_CLOEXEC: ::c_int = 0x080000;
+
+ pub const NCCS: usize = 32;
+
+ pub const O_TRUNC: ::c_int = 512;
+ pub const O_CLOEXEC: ::c_int = 0x80000;
+ pub const EBFONT: ::c_int = 59;
+ pub const ENOSTR: ::c_int = 60;
+ pub const ENODATA: ::c_int = 61;
+ pub const ETIME: ::c_int = 62;
+ pub const ENOSR: ::c_int = 63;
+ pub const ENONET: ::c_int = 64;
+ pub const ENOPKG: ::c_int = 65;
+ pub const EREMOTE: ::c_int = 66;
+ pub const ENOLINK: ::c_int = 67;
+ pub const EADV: ::c_int = 68;
+ pub const ESRMNT: ::c_int = 69;
+ pub const ECOMM: ::c_int = 70;
+ pub const EPROTO: ::c_int = 71;
+ pub const EDOTDOT: ::c_int = 73;
+
+ pub const SA_NODEFER: ::c_int = 0x40000000;
+ pub const SA_RESETHAND: ::c_int = 0x80000000;
+ pub const SA_RESTART: ::c_int = 0x10000000;
+ pub const SA_NOCLDSTOP: ::c_int = 0x00000001;
+
+ pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
+
+ pub const EFD_CLOEXEC: ::c_int = 0x80000;
+ }
+}
align_const! {
#[cfg(target_endian = "little")]
@@ -237,7 +304,9 @@ pub const PTRACE_SETFPREGS: ::c_uint = 15;
pub const PTRACE_GETREGS: ::c_uint = 12;
pub const PTRACE_SETREGS: ::c_uint = 13;
-#[link(name = "util")]
+pub const TIOCSBRK: ::c_int = 0x5427;
+pub const TIOCCBRK: ::c_int = 0x5428;
+
extern "C" {
pub fn sysctl(
name: *mut ::c_int,
@@ -265,6 +334,9 @@ cfg_if! {
} else if #[cfg(target_arch = "sparc")] {
mod sparc;
pub use self::sparc::*;
+ } else if #[cfg(target_arch = "riscv32")] {
+ mod riscv32;
+ pub use self::riscv32::*;
} 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 76444280..59c1e1c8 100644
--- a/src/unix/linux_like/linux/gnu/b32/powerpc.rs
+++ b/src/unix/linux_like/linux/gnu/b32/powerpc.rs
@@ -213,8 +213,7 @@ 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 SOL_SOCKET: ::c_int = 1;
+pub const MAP_SYNC: ::c_int = 0x080000;
pub const EDEADLOCK: ::c_int = 58;
pub const EUCLEAN: ::c_int = 117;
@@ -301,30 +300,6 @@ pub const ENOTRECOVERABLE: ::c_int = 131;
pub const EHWPOISON: ::c_int = 133;
pub const ERFKILL: ::c_int = 132;
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_TYPE: ::c_int = 3;
-pub const SO_ERROR: ::c_int = 4;
-pub const SO_DONTROUTE: ::c_int = 5;
-pub const SO_BROADCAST: ::c_int = 6;
-pub const SO_SNDBUF: ::c_int = 7;
-pub const SO_RCVBUF: ::c_int = 8;
-pub const SO_KEEPALIVE: ::c_int = 9;
-pub const SO_OOBINLINE: ::c_int = 10;
-pub const SO_LINGER: ::c_int = 13;
-pub const SO_REUSEPORT: ::c_int = 15;
-pub const SO_ACCEPTCONN: ::c_int = 30;
-pub const SO_PROTOCOL: ::c_int = 38;
-pub const SO_DOMAIN: ::c_int = 39;
-pub const SO_SNDBUFFORCE: ::c_int = 32;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_RCVLOWAT: ::c_int = 16;
-pub const SO_SNDLOWAT: ::c_int = 17;
-pub const SO_RCVTIMEO: ::c_int = 18;
-pub const SO_SNDTIMEO: ::c_int = 19;
-pub const SO_PASSCRED: ::c_int = 20;
-pub const SO_PEERCRED: ::c_int = 21;
-
pub const SA_SIGINFO: ::c_int = 0x00000004;
pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
@@ -871,3 +846,22 @@ pub const SYS_preadv2: ::c_long = 380;
pub const SYS_pwritev2: ::c_long = 381;
pub const SYS_kexec_file_load: ::c_long = 382;
pub const SYS_statx: ::c_long = 383;
+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;
diff --git a/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs b/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs
new file mode 100644
index 00000000..96ee5a3b
--- /dev/null
+++ b/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs
@@ -0,0 +1,795 @@
+//! RISC-V-specific definitions for 32-bit linux-like values
+
+pub type c_char = u8;
+pub type wchar_t = ::c_int;
+
+s! {
+ pub struct pthread_attr_t {
+ __size: [::c_ulong; 7],
+ }
+
+ pub struct msqid_ds {
+ pub msg_perm: ::ipc_perm,
+ pub msg_stime: ::time_t,
+ pub msg_rtime: ::time_t,
+ pub msg_ctime: ::time_t,
+ __msg_cbytes: ::c_ulong,
+ pub msg_qnum: ::msgqnum_t,
+ pub msg_qbytes: ::msglen_t,
+ pub msg_lspid: ::pid_t,
+ pub msg_lrpid: ::pid_t,
+ __glibc_reserved4: ::c_ulong,
+ __glibc_reserved5: ::c_ulong,
+ }
+
+ pub struct 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 __pad1: ::dev_t,
+ pub st_size: ::off_t,
+ pub st_blksize: ::blksize_t,
+ pub __pad2: ::c_int,
+ 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,
+ __unused: [::c_int; 2usize],
+ }
+
+ pub struct stat64 {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino64_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 __pad1: ::dev_t,
+ pub st_size: ::off64_t,
+ pub st_blksize: ::blksize_t,
+ pub __pad2: ::c_int,
+ 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,
+ __unused: [::c_int; 2],
+ }
+
+ pub struct statfs {
+ pub f_type: ::c_long,
+ pub f_bsize: ::c_long,
+ 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_long,
+ pub f_frsize: ::c_long,
+ pub f_flags: ::c_long,
+ pub f_spare: [::c_long; 4],
+ }
+
+ pub struct statfs64 {
+ pub f_type: ::c_long,
+ pub f_bsize: ::c_long,
+ 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_namelen: ::c_long,
+ pub f_frsize: ::c_long,
+ pub f_flags: ::c_long,
+ pub f_spare: [::c_long; 4],
+ }
+
+ pub struct statvfs {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: ::fsblkcnt_t,
+ pub f_bfree: ::fsblkcnt_t,
+ pub f_bavail: ::fsblkcnt_t,
+ pub f_files: ::fsfilcnt_t,
+ pub f_ffree: ::fsfilcnt_t,
+ pub f_favail: ::fsfilcnt_t,
+ pub f_fsid: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ pub __f_spare: [::c_int; 6],
+ }
+
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::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_favail: ::fsfilcnt64_t,
+ pub f_fsid: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ pub __f_spare: [::c_int; 6],
+ }
+
+ 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: [u64; 0],
+ }
+
+ pub struct stack_t {
+ pub ss_sp: *mut ::c_void,
+ pub ss_flags: ::c_int,
+ pub ss_size: ::size_t,
+ }
+
+ pub struct sigaction {
+ pub sa_sigaction: ::sighandler_t,
+ pub sa_mask: ::sigset_t,
+ pub sa_flags: ::c_int,
+ pub sa_restorer: ::Option<unsafe extern "C" fn()>,
+ }
+
+ 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 shmid_ds {
+ pub shm_perm: ::ipc_perm,
+ pub shm_segsz: ::size_t,
+ pub shm_atime: ::time_t,
+ pub shm_dtime: ::time_t,
+ pub shm_ctime: ::time_t,
+ pub shm_cpid: ::pid_t,
+ pub shm_lpid: ::pid_t,
+ pub shm_nattch: ::shmatt_t,
+ __unused5: ::c_ulong,
+ __unused6: ::c_ulong,
+ }
+
+ 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 const RLIM_INFINITY: ::rlim_t = !0;
+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 TIOCGSOFTCAR: ::c_ulong = 21529;
+pub const TIOCSSOFTCAR: ::c_ulong = 21530;
+pub const TIOCGRS485: ::c_int = 21550;
+pub const TIOCSRS485: ::c_int = 21551;
+pub const RLIMIT_RSS: ::__rlimit_resource_t = 5;
+pub const RLIMIT_AS: ::__rlimit_resource_t = 9;
+pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8;
+pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7;
+pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6;
+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 = 1052672;
+pub const MAP_GROWSDOWN: ::c_int = 256;
+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 SOCK_STREAM: ::c_int = 1;
+pub const SOCK_DGRAM: ::c_int = 2;
+pub const SA_SIGINFO: ::c_int = 4;
+pub const SA_NOCLDWAIT: ::c_int = 2;
+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 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;
+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 = 0;
+pub const SIG_UNBLOCK: ::c_int = 1;
+pub const POLLWRNORM: ::c_short = 256;
+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 SFD_NONBLOCK: ::c_int = 2048;
+pub const TCSANOW: ::c_int = 0;
+pub const TCSADRAIN: ::c_int = 1;
+pub const TCSAFLUSH: ::c_int = 2;
+pub const TIOCLINUX: ::c_ulong = 21532;
+pub const TIOCGSERIAL: ::c_ulong = 21534;
+pub const TIOCEXCL: ::c_ulong = 21516;
+pub const TIOCNXCL: ::c_ulong = 21517;
+pub const TIOCSCTTY: ::c_ulong = 21518;
+pub const TIOCSTI: ::c_ulong = 21522;
+pub const TIOCMGET: ::c_ulong = 21525;
+pub const TIOCMBIS: ::c_ulong = 21526;
+pub const TIOCMBIC: ::c_ulong = 21527;
+pub const TIOCMSET: ::c_ulong = 21528;
+pub const TIOCCONS: ::c_ulong = 21533;
+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_RNG: ::c_int = 128;
+pub const TIOCM_DSR: ::c_int = 256;
+
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const O_DIRECT: ::c_int = 16384;
+pub const O_DIRECTORY: ::c_int = 65536;
+pub const O_NOFOLLOW: ::c_int = 131072;
+pub const MAP_HUGETLB: ::c_int = 262144;
+pub const MAP_LOCKED: ::c_int = 8192;
+pub const MAP_NORESERVE: ::c_int = 16384;
+pub const MAP_ANON: ::c_int = 32;
+pub const MAP_ANONYMOUS: ::c_int = 32;
+pub const MAP_DENYWRITE: ::c_int = 2048;
+pub const MAP_EXECUTABLE: ::c_int = 4096;
+pub const MAP_POPULATE: ::c_int = 32768;
+pub const MAP_NONBLOCK: ::c_int = 65536;
+pub const MAP_STACK: ::c_int = 131072;
+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 FIOCLEX: ::c_ulong = 21585;
+pub const FIONCLEX: ::c_ulong = 21584;
+pub const FIONBIO: ::c_ulong = 21537;
+pub const MCL_CURRENT: ::c_int = 1;
+pub const MCL_FUTURE: ::c_int = 2;
+pub const SIGSTKSZ: ::size_t = 8192;
+pub const MINSIGSTKSZ: ::size_t = 2048;
+pub const CBAUD: ::tcflag_t = 4111;
+pub const TAB1: ::tcflag_t = 2048;
+pub const TAB2: ::tcflag_t = 4096;
+pub const TAB3: ::tcflag_t = 6144;
+pub const CR1: ::tcflag_t = 512;
+pub const CR2: ::tcflag_t = 1024;
+pub const CR3: ::tcflag_t = 1536;
+pub const FF1: ::tcflag_t = 32768;
+pub const BS1: ::tcflag_t = 8192;
+pub const VT1: ::tcflag_t = 16384;
+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 = 1024;
+pub const IXOFF: ::tcflag_t = 4096;
+pub const ONLCR: ::tcflag_t = 4;
+pub const CSIZE: ::tcflag_t = 48;
+pub const CS6: ::tcflag_t = 16;
+pub const CS7: ::tcflag_t = 32;
+pub const CS8: ::tcflag_t = 48;
+pub const CSTOPB: ::tcflag_t = 64;
+pub const CREAD: ::tcflag_t = 128;
+pub const PARENB: ::tcflag_t = 256;
+pub const PARODD: ::tcflag_t = 512;
+pub const HUPCL: ::tcflag_t = 1024;
+pub const CLOCAL: ::tcflag_t = 2048;
+pub const ECHOKE: ::tcflag_t = 2048;
+pub const ECHOE: ::tcflag_t = 16;
+pub const ECHOK: ::tcflag_t = 32;
+pub const ECHONL: ::tcflag_t = 64;
+pub const ECHOPRT: ::tcflag_t = 1024;
+pub const ECHOCTL: ::tcflag_t = 512;
+pub const ISIG: ::tcflag_t = 1;
+pub const ICANON: ::tcflag_t = 2;
+pub const PENDIN: ::tcflag_t = 16384;
+pub const NOFLSH: ::tcflag_t = 128;
+pub const CIBAUD: ::tcflag_t = 269418496;
+pub const CBAUDEX: ::tcflag_t = 4096;
+pub const VSWTC: usize = 7;
+pub const OLCUC: ::tcflag_t = 2;
+pub const NLDLY: ::tcflag_t = 256;
+pub const CRDLY: ::tcflag_t = 1536;
+pub const TABDLY: ::tcflag_t = 6144;
+pub const BSDLY: ::tcflag_t = 8192;
+pub const FFDLY: ::tcflag_t = 32768;
+pub const VTDLY: ::tcflag_t = 16384;
+pub const XTABS: ::tcflag_t = 6144;
+pub const B0: ::speed_t = 0;
+pub const B50: ::speed_t = 1;
+pub const B75: ::speed_t = 2;
+pub const B110: ::speed_t = 3;
+pub const B134: ::speed_t = 4;
+pub const B150: ::speed_t = 5;
+pub const B200: ::speed_t = 6;
+pub const B300: ::speed_t = 7;
+pub const B600: ::speed_t = 8;
+pub const B1200: ::speed_t = 9;
+pub const B1800: ::speed_t = 10;
+pub const B2400: ::speed_t = 11;
+pub const B4800: ::speed_t = 12;
+pub const B9600: ::speed_t = 13;
+pub const B19200: ::speed_t = 14;
+pub const B38400: ::speed_t = 15;
+pub const EXTA: ::speed_t = 14;
+pub const EXTB: ::speed_t = 15;
+pub const B57600: ::speed_t = 4097;
+pub const B115200: ::speed_t = 4098;
+pub const B230400: ::speed_t = 4099;
+pub const B460800: ::speed_t = 4100;
+pub const B500000: ::speed_t = 4101;
+pub const B576000: ::speed_t = 4102;
+pub const B921600: ::speed_t = 4103;
+pub const B1000000: ::speed_t = 4104;
+pub const B1152000: ::speed_t = 4105;
+pub const B1500000: ::speed_t = 4106;
+pub const B2000000: ::speed_t = 4107;
+pub const B2500000: ::speed_t = 4108;
+pub const B3000000: ::speed_t = 4109;
+pub const B3500000: ::speed_t = 4110;
+pub const B4000000: ::speed_t = 4111;
+pub const VEOL: usize = 11;
+pub const VEOL2: usize = 16;
+pub const VMIN: usize = 6;
+pub const IEXTEN: ::tcflag_t = 32768;
+pub const TOSTOP: ::tcflag_t = 256;
+pub const FLUSHO: ::tcflag_t = 4096;
+pub const EXTPROC: ::tcflag_t = 65536;
+pub const TCGETS: ::c_ulong = 21505;
+pub const TCSETS: ::c_ulong = 21506;
+pub const TCSETSW: ::c_ulong = 21507;
+pub const TCSETSF: ::c_ulong = 21508;
+pub const TCGETA: ::c_ulong = 21509;
+pub const TCSETA: ::c_ulong = 21510;
+pub const TCSETAW: ::c_ulong = 21511;
+pub const TCSETAF: ::c_ulong = 21512;
+pub const TCSBRK: ::c_ulong = 21513;
+pub const TCXONC: ::c_ulong = 21514;
+pub const TCFLSH: ::c_ulong = 21515;
+pub const TIOCINQ: ::c_ulong = 21531;
+pub const TIOCGPGRP: ::c_ulong = 21519;
+pub const TIOCSPGRP: ::c_ulong = 21520;
+pub const TIOCOUTQ: ::c_ulong = 21521;
+pub const TIOCGWINSZ: ::c_ulong = 21523;
+pub const TIOCSWINSZ: ::c_ulong = 21524;
+pub const FIONREAD: ::c_ulong = 21531;
+pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
+pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
+
+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_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;
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 f670b342..43648140 100644
--- a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs
@@ -1,6 +1,6 @@
//! SPARC-specific definitions for 32-bit linux-like values
-pub type c_char = u8;
+pub type c_char = i8;
pub type wchar_t = i32;
s! {
@@ -204,9 +204,6 @@ s! {
}
}
-pub const POSIX_FADV_DONTNEED: ::c_int = 4;
-pub const POSIX_FADV_NOREUSE: ::c_int = 5;
-
pub const RLIM_INFINITY: ::rlim_t = !0;
pub const VEOF: usize = 4;
pub const RTLD_DEEPBIND: ::c_int = 0x8;
@@ -231,9 +228,6 @@ pub const O_SYNC: ::c_int = 0x802000;
pub const O_RSYNC: ::c_int = 0x802000;
pub const O_DSYNC: ::c_int = 0x2000;
pub const O_FSYNC: ::c_int = 0x802000;
-pub const O_NOATIME: ::c_int = 0x200000;
-pub const O_PATH: ::c_int = 0x1000000;
-pub const O_TMPFILE: ::c_int = 0x2000000 | O_DIRECTORY;
pub const MADV_SOFT_OFFLINE: ::c_int = 101;
pub const MAP_GROWSDOWN: ::c_int = 0x0200;
@@ -245,6 +239,7 @@ 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_SYNC: ::c_int = 0x080000;
pub const EDEADLK: ::c_int = 78;
pub const ENAMETOOLONG: ::c_int = 63;
@@ -325,35 +320,9 @@ pub const ENOTRECOVERABLE: ::c_int = 133;
pub const EHWPOISON: ::c_int = 135;
pub const ERFKILL: ::c_int = 134;
-pub const SOL_SOCKET: ::c_int = 0xffff;
-
-pub const SO_PASSCRED: ::c_int = 2;
-pub const SO_REUSEADDR: ::c_int = 4;
-pub const SO_BINDTODEVICE: ::c_int = 0x000d;
-pub const SO_TIMESTAMP: ::c_int = 0x001d;
-pub const SO_MARK: ::c_int = 0x0022;
-pub const SO_RXQ_OVFL: ::c_int = 0x0024;
-pub const SO_PEEK_OFF: ::c_int = 0x0026;
-pub const SO_BUSY_POLL: ::c_int = 0x0030;
-pub const SO_TYPE: ::c_int = 0x1008;
-pub const SO_ERROR: ::c_int = 0x1007;
-pub const SO_DONTROUTE: ::c_int = 16;
-pub const SO_BROADCAST: ::c_int = 32;
-pub const SO_SNDBUF: ::c_int = 0x1001;
-pub const SO_RCVBUF: ::c_int = 0x1002;
-pub const SO_SNDBUFFORCE: ::c_int = 0x100a;
-pub const SO_RCVBUFFORCE: ::c_int = 0x100b;
-pub const SO_DOMAIN: ::c_int = 0x1029;
-pub const SO_KEEPALIVE: ::c_int = 8;
-pub const SO_OOBINLINE: ::c_int = 0x100;
-pub const SO_LINGER: ::c_int = 128;
-pub const SO_REUSEPORT: ::c_int = 0x200;
-pub const SO_ACCEPTCONN: ::c_int = 0x8000;
-
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
-pub const SA_ONSTACK: ::c_int = 1;
pub const SA_SIGINFO: ::c_int = 0x200;
pub const SA_NOCLDWAIT: ::c_int = 0x100;
@@ -386,19 +355,11 @@ pub const POLLWRBAND: ::c_short = 0x100;
pub const O_ASYNC: ::c_int = 0x40;
pub const O_NDELAY: ::c_int = 0x4004;
-pub const PTRACE_DETACH: ::c_uint = 11;
-
pub const EFD_NONBLOCK: ::c_int = 0x4000;
pub const F_GETLK: ::c_int = 7;
pub const F_GETOWN: ::c_int = 5;
pub const F_SETOWN: ::c_int = 6;
-pub const F_SETLK: ::c_int = 8;
-pub const F_SETLKW: ::c_int = 9;
-
-pub const F_RDLCK: ::c_int = 1;
-pub const F_WRLCK: ::c_int = 2;
-pub const F_UNLCK: ::c_int = 3;
pub const SFD_NONBLOCK: ::c_int = 0x4000;
@@ -425,37 +386,6 @@ pub const TIOCM_CAR: ::c_int = 0x040;
pub const TIOCM_RNG: ::c_int = 0x080;
pub const TIOCM_DSR: ::c_int = 0x100;
-pub const SFD_CLOEXEC: ::c_int = 0x400000;
-
-pub const NCCS: usize = 17;
-pub const O_TRUNC: ::c_int = 0x400;
-
-pub const O_CLOEXEC: ::c_int = 0x400000;
-
-pub const EBFONT: ::c_int = 109;
-pub const ENOSTR: ::c_int = 72;
-pub const ENODATA: ::c_int = 111;
-pub const ETIME: ::c_int = 73;
-pub const ENOSR: ::c_int = 74;
-pub const ENONET: ::c_int = 80;
-pub const ENOPKG: ::c_int = 113;
-pub const EREMOTE: ::c_int = 71;
-pub const ENOLINK: ::c_int = 82;
-pub const EADV: ::c_int = 83;
-pub const ESRMNT: ::c_int = 84;
-pub const ECOMM: ::c_int = 85;
-pub const EPROTO: ::c_int = 86;
-pub const EDOTDOT: ::c_int = 88;
-
-pub const SA_NODEFER: ::c_int = 0x20;
-pub const SA_RESETHAND: ::c_int = 0x4;
-pub const SA_RESTART: ::c_int = 0x2;
-pub const SA_NOCLDSTOP: ::c_int = 0x00000008;
-
-pub const EPOLL_CLOEXEC: ::c_int = 0x400000;
-
-pub const EFD_CLOEXEC: ::c_int = 0x400000;
-
pub const O_DIRECTORY: ::c_int = 0o200000;
pub const O_NOFOLLOW: ::c_int = 0o400000;
pub const O_LARGEFILE: ::c_int = 0x40000;
@@ -471,12 +401,6 @@ pub const ENAVAIL: ::c_int = 119;
pub const EISNAM: ::c_int = 120;
pub const EREMOTEIO: ::c_int = 121;
-pub const SO_PEERCRED: ::c_int = 0x40;
-pub const SO_RCVLOWAT: ::c_int = 0x800;
-pub const SO_SNDLOWAT: ::c_int = 0x1000;
-pub const SO_RCVTIMEO: ::c_int = 0x2000;
-pub const SO_SNDTIMEO: ::c_int = 0x4000;
-
pub const FIOCLEX: ::c_ulong = 0x20006601;
pub const FIONCLEX: ::c_ulong = 0x20006602;
pub const FIONBIO: ::c_ulong = 0x8004667e;
@@ -957,18 +881,26 @@ pub const SYS_copy_file_range: ::c_long = 357;
pub const SYS_preadv2: ::c_long = 358;
pub const SYS_pwritev2: ::c_long = 359;
pub const SYS_statx: ::c_long = 360;
-
-#[link(name = "util")]
-extern "C" {
- pub fn sysctl(
- name: *mut ::c_int,
- namelen: ::c_int,
- oldp: *mut ::c_void,
- oldlenp: *mut ::size_t,
- newp: *mut ::c_void,
- newlen: ::size_t,
- ) -> ::c_int;
-}
+pub 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;
+// Reserved in the kernel, but not actually implemented yet
+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;
cfg_if! {
if #[cfg(libc_align)] {
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 f5f7cac4..75edd278 100644
--- a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs
@@ -401,8 +401,6 @@ pub const RLIMIT_RSS: ::__rlimit_resource_t = 5;
pub const RLIMIT_AS: ::__rlimit_resource_t = 9;
pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8;
-pub const SOL_SOCKET: ::c_int = 1;
-
pub const MADV_SOFT_OFFLINE: ::c_int = 101;
pub const MAP_LOCKED: ::c_int = 0x02000;
pub const MAP_NORESERVE: ::c_int = 0x04000;
@@ -416,6 +414,7 @@ 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;
@@ -502,30 +501,6 @@ pub const ENOTRECOVERABLE: ::c_int = 131;
pub const EHWPOISON: ::c_int = 133;
pub const ERFKILL: ::c_int = 132;
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_TYPE: ::c_int = 3;
-pub const SO_ERROR: ::c_int = 4;
-pub const SO_DONTROUTE: ::c_int = 5;
-pub const SO_BROADCAST: ::c_int = 6;
-pub const SO_SNDBUF: ::c_int = 7;
-pub const SO_RCVBUF: ::c_int = 8;
-pub const SO_KEEPALIVE: ::c_int = 9;
-pub const SO_OOBINLINE: ::c_int = 10;
-pub const SO_LINGER: ::c_int = 13;
-pub const SO_REUSEPORT: ::c_int = 15;
-pub const SO_ACCEPTCONN: ::c_int = 30;
-pub const SO_PROTOCOL: ::c_int = 38;
-pub const SO_DOMAIN: ::c_int = 39;
-pub const SO_SNDBUFFORCE: ::c_int = 32;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PASSCRED: ::c_int = 16;
-pub const SO_PEERCRED: ::c_int = 17;
-pub const SO_RCVLOWAT: ::c_int = 18;
-pub const SO_SNDLOWAT: ::c_int = 19;
-pub const SO_RCVTIMEO: ::c_int = 20;
-pub const SO_SNDTIMEO: ::c_int = 21;
-
pub const SA_SIGINFO: ::c_int = 0x00000004;
pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
@@ -542,6 +517,8 @@ pub const FIONBIO: ::c_ulong = 0x5421;
pub const PTRACE_GETFPXREGS: ::c_uint = 18;
pub const PTRACE_SETFPXREGS: ::c_uint = 19;
+pub const PTRACE_SYSEMU: ::c_uint = 31;
+pub const PTRACE_SYSEMU_SINGLESTEP: ::c_uint = 32;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
@@ -1100,6 +1077,25 @@ pub const SYS_pkey_mprotect: ::c_long = 380;
pub const SYS_pkey_alloc: ::c_long = 381;
pub const SYS_pkey_free: ::c_long = 382;
pub const SYS_statx: ::c_long = 383;
+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;
// offsets in user_regs_structs, from sys/reg.h
pub const EBX: ::c_int = 0;
@@ -1144,16 +1140,8 @@ pub const REG_SS: ::c_int = 18;
extern "C" {
pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;
pub fn setcontext(ucp: *const ucontext_t) -> ::c_int;
- pub fn makecontext(
- ucp: *mut ucontext_t,
- func: extern "C" fn(),
- argc: ::c_int,
- ...
- );
- pub fn swapcontext(
- uocp: *mut ucontext_t,
- ucp: *const ucontext_t,
- ) -> ::c_int;
+ pub fn makecontext(ucp: *mut ucontext_t, func: extern "C" fn(), argc: ::c_int, ...);
+ pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> ::c_int;
}
cfg_if! {
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 8e949963..154c2c54 100644
--- a/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs
+++ b/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs
@@ -5,3 +5,25 @@ s_no_extra_traits! {
priv_: [f32; 8]
}
}
+
+s! {
+ pub struct ucontext_t {
+ pub uc_flags: ::c_ulong,
+ pub uc_link: *mut ucontext_t,
+ pub uc_stack: ::stack_t,
+ pub uc_sigmask: ::sigset_t,
+ pub uc_mcontext: mcontext_t,
+ }
+
+ #[repr(align(16))]
+ pub struct mcontext_t {
+ pub fault_address: ::c_ulonglong,
+ pub regs: [::c_ulonglong; 31],
+ pub sp: ::c_ulonglong,
+ pub pc: ::c_ulonglong,
+ pub pstate: ::c_ulonglong,
+ // nested arrays to get the right size/length while being able to
+ // auto-derive traits like Debug
+ __reserved: [[u64; 32]; 16],
+ }
+}
diff --git a/src/unix/linux_like/linux/gnu/b64/aarch64/ilp32.rs b/src/unix/linux_like/linux/gnu/b64/aarch64/ilp32.rs
new file mode 100644
index 00000000..24b7f4e6
--- /dev/null
+++ b/src/unix/linux_like/linux/gnu/b64/aarch64/ilp32.rs
@@ -0,0 +1,62 @@
+use pthread_mutex_t;
+
+pub type c_long = i32;
+pub type c_ulong = u32;
+
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 32;
+pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 48;
+
+align_const! {
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ],
+ };
+}
+
+pub const SYS_sync_file_range2: ::c_long = 84;
diff --git a/src/unix/linux_like/linux/gnu/b64/aarch64/lp64.rs b/src/unix/linux_like/linux/gnu/b64/aarch64/lp64.rs
new file mode 100644
index 00000000..14d39e54
--- /dev/null
+++ b/src/unix/linux_like/linux/gnu/b64/aarch64/lp64.rs
@@ -0,0 +1,71 @@
+use pthread_mutex_t;
+
+pub type c_long = i64;
+pub type c_ulong = u64;
+
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 8;
+pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 48;
+pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 8;
+pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
+
+align_const! {
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "little")]
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ ],
+ };
+ #[cfg(target_endian = "big")]
+ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
+ pthread_mutex_t {
+ size: [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+ ],
+ };
+}
+
+pub const SYS_renameat: ::c_long = 38;
+pub const SYS_sync_file_range: ::c_long = 84;
+pub const SYS_getrlimit: ::c_long = 163;
+pub const SYS_setrlimit: ::c_long = 164;
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 93f0f2bc..35fe3061 100644
--- a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs
@@ -1,9 +1,5 @@
//! AArch64-specific definitions for 64-bit linux-like values
-use pthread_mutex_t;
-
-pub type c_long = i64;
-pub type c_ulong = u64;
pub type c_char = u8;
pub type wchar_t = u32;
pub type nlink_t = u32;
@@ -143,7 +139,7 @@ s! {
}
pub struct pthread_attr_t {
- __size: [u64; 8]
+ __size: [usize; 8]
}
pub struct ipc_perm {
@@ -203,20 +199,20 @@ s! {
pub ss_flags: ::c_int,
pub ss_size: ::size_t
}
+
+ pub struct ip_mreqn {
+ pub imr_multiaddr: ::in_addr,
+ pub imr_address: ::in_addr,
+ pub imr_ifindex: ::c_int,
+ }
}
pub const VEOF: usize = 4;
-pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
pub const RTLD_DEEPBIND: ::c_int = 0x8;
pub const RTLD_GLOBAL: ::c_int = 0x100;
pub const RTLD_NOLOAD: ::c_int = 0x4;
-pub const TIOCGSOFTCAR: ::c_ulong = 0x5419;
-pub const TIOCSSOFTCAR: ::c_ulong = 0x541A;
-pub const TIOCGRS485: ::c_int = 0x542E;
-pub const TIOCSRS485: ::c_int = 0x542F;
-
pub const RLIMIT_RSS: ::__rlimit_resource_t = 5;
pub const RLIMIT_AS: ::__rlimit_resource_t = 9;
pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8;
@@ -326,61 +322,6 @@ pub const ERFKILL: ::c_int = 132;
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
-pub const SOL_SOCKET: ::c_int = 1;
-
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_TYPE: ::c_int = 3;
-pub const SO_ERROR: ::c_int = 4;
-pub const SO_DONTROUTE: ::c_int = 5;
-pub const SO_BROADCAST: ::c_int = 6;
-pub const SO_SNDBUF: ::c_int = 7;
-pub const SO_RCVBUF: ::c_int = 8;
-pub const SO_SNDBUFFORCE: ::c_int = 32;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_KEEPALIVE: ::c_int = 9;
-pub const SO_OOBINLINE: ::c_int = 10;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_LINGER: ::c_int = 13;
-pub const SO_BSDCOMPAT: ::c_int = 14;
-pub const SO_REUSEPORT: ::c_int = 15;
-pub const SO_PASSCRED: ::c_int = 16;
-pub const SO_PEERCRED: ::c_int = 17;
-pub const SO_RCVLOWAT: ::c_int = 18;
-pub const SO_SNDLOWAT: ::c_int = 19;
-pub const SO_RCVTIMEO: ::c_int = 20;
-pub const SO_SNDTIMEO: ::c_int = 21;
-pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22;
-pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
-pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
-pub const SO_BINDTODEVICE: ::c_int = 25;
-pub const SO_ATTACH_FILTER: ::c_int = 26;
-pub const SO_DETACH_FILTER: ::c_int = 27;
-pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
-pub const SO_PEERNAME: ::c_int = 28;
-pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SO_ACCEPTCONN: ::c_int = 30;
-pub const SO_PEERSEC: ::c_int = 31;
-pub const SO_PASSSEC: ::c_int = 34;
-pub const SO_TIMESTAMPNS: ::c_int = 35;
-pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
-pub const SO_MARK: ::c_int = 36;
-pub const SO_PROTOCOL: ::c_int = 38;
-pub const SO_DOMAIN: ::c_int = 39;
-pub const SO_RXQ_OVFL: ::c_int = 40;
-pub const SO_WIFI_STATUS: ::c_int = 41;
-pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS;
-pub const SO_PEEK_OFF: ::c_int = 42;
-pub const SO_NOFCS: ::c_int = 43;
-pub const SO_LOCK_FILTER: ::c_int = 44;
-pub const SO_SELECT_ERR_QUEUE: ::c_int = 45;
-pub const SO_BUSY_POLL: ::c_int = 46;
-pub const SO_MAX_PACING_RATE: ::c_int = 47;
-pub const SO_BPF_EXTENSIONS: ::c_int = 48;
-pub const SO_INCOMING_CPU: ::c_int = 49;
-pub const SO_ATTACH_BPF: ::c_int = 50;
-pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER;
-
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
@@ -429,6 +370,9 @@ 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 F_RDLCK: ::c_int = 0;
pub const F_WRLCK: ::c_int = 1;
@@ -444,7 +388,13 @@ pub const TIOCMGET: ::c_ulong = 0x5415;
pub const TIOCMBIS: ::c_ulong = 0x5416;
pub const TIOCMBIC: ::c_ulong = 0x5417;
pub const TIOCMSET: ::c_ulong = 0x5418;
+pub const TIOCGSOFTCAR: ::c_ulong = 0x5419;
+pub const TIOCSSOFTCAR: ::c_ulong = 0x541A;
pub const TIOCCONS: ::c_ulong = 0x541D;
+pub const TIOCSBRK: ::c_ulong = 0x5427;
+pub const TIOCCBRK: ::c_ulong = 0x5428;
+pub const TIOCGRS485: ::c_int = 0x542E;
+pub const TIOCSRS485: ::c_int = 0x542F;
pub const TIOCM_ST: ::c_int = 0x008;
pub const TIOCM_SR: ::c_int = 0x010;
@@ -485,37 +435,6 @@ pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
pub const EFD_CLOEXEC: ::c_int = 0x80000;
-pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 8;
-pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 48;
-pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 8;
-
-align_const! {
- pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- pthread_mutex_t {
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- ],
- };
- pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- pthread_mutex_t {
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- ],
- };
- pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t =
- pthread_mutex_t {
- size: [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0,
- ],
- };
-}
-
pub const O_DIRECT: ::c_int = 0x10000;
pub const O_DIRECTORY: ::c_int = 0x4000;
pub const O_NOFOLLOW: ::c_int = 0x8000;
@@ -530,6 +449,7 @@ 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_SYNC: ::c_int = 0x080000;
pub const EDEADLOCK: ::c_int = 35;
@@ -662,6 +582,51 @@ pub const TCSAFLUSH: ::c_int = 2;
pub const TIOCLINUX: ::c_ulong = 0x541C;
pub const TIOCGSERIAL: ::c_ulong = 0x541E;
+// sys/auxv.h
+pub const HWCAP_FP: ::c_ulong = 1 << 0;
+pub const HWCAP_ASIMD: ::c_ulong = 1 << 1;
+pub const HWCAP_EVTSTRM: ::c_ulong = 1 << 2;
+pub const HWCAP_AES: ::c_ulong = 1 << 3;
+pub const HWCAP_PMULL: ::c_ulong = 1 << 4;
+pub const HWCAP_SHA1: ::c_ulong = 1 << 5;
+pub const HWCAP_SHA2: ::c_ulong = 1 << 6;
+pub const HWCAP_CRC32: ::c_ulong = 1 << 7;
+pub const HWCAP_ATOMICS: ::c_ulong = 1 << 8;
+pub const HWCAP_FPHP: ::c_ulong = 1 << 9;
+pub const HWCAP_ASIMDHP: ::c_ulong = 1 << 10;
+pub const HWCAP_CPUID: ::c_ulong = 1 << 11;
+pub const HWCAP_ASIMDRDM: ::c_ulong = 1 << 12;
+pub const HWCAP_JSCVT: ::c_ulong = 1 << 13;
+pub const HWCAP_FCMA: ::c_ulong = 1 << 14;
+pub const HWCAP_LRCPC: ::c_ulong = 1 << 15;
+pub const HWCAP_DCPOP: ::c_ulong = 1 << 16;
+pub const HWCAP_SHA3: ::c_ulong = 1 << 17;
+pub const HWCAP_SM3: ::c_ulong = 1 << 18;
+pub const HWCAP_SM4: ::c_ulong = 1 << 19;
+pub const HWCAP_ASIMDDP: ::c_ulong = 1 << 20;
+pub const HWCAP_SHA512: ::c_ulong = 1 << 21;
+pub const HWCAP_SVE: ::c_ulong = 1 << 22;
+pub const HWCAP_ASIMDFHM: ::c_ulong = 1 << 23;
+pub const HWCAP_DIT: ::c_ulong = 1 << 24;
+pub const HWCAP_USCAT: ::c_ulong = 1 << 25;
+pub const HWCAP_ILRCPC: ::c_ulong = 1 << 26;
+pub const HWCAP_FLAGM: ::c_ulong = 1 << 27;
+pub const HWCAP_SSBS: ::c_ulong = 1 << 28;
+pub const HWCAP_SB: ::c_ulong = 1 << 29;
+pub const HWCAP_PACA: ::c_ulong = 1 << 30;
+pub const HWCAP_PACG: ::c_ulong = 1 << 31;
+// FIXME: enable these again once linux-api-headers are up to date enough on CI.
+// See discussion in https://github.com/rust-lang/libc/pull/1638
+//pub const HWCAP2_DCPODP: ::c_ulong = 1 << 0;
+//pub const HWCAP2_SVE2: ::c_ulong = 1 << 1;
+//pub const HWCAP2_SVEAES: ::c_ulong = 1 << 2;
+//pub const HWCAP2_SVEPMULL: ::c_ulong = 1 << 3;
+//pub const HWCAP2_SVEBITPERM: ::c_ulong = 1 << 4;
+//pub const HWCAP2_SVESHA3: ::c_ulong = 1 << 5;
+//pub const HWCAP2_SVESM4: ::c_ulong = 1 << 6;
+//pub const HWCAP2_FLAGM2: ::c_ulong = 1 << 7;
+//pub const HWCAP2_FRINT: ::c_ulong = 1 << 8;
+
// Syscall table
pub const SYS_io_setup: ::c_long = 0;
pub const SYS_io_destroy: ::c_long = 1;
@@ -701,11 +666,15 @@ pub const SYS_mkdirat: ::c_long = 34;
pub const SYS_unlinkat: ::c_long = 35;
pub const SYS_symlinkat: ::c_long = 36;
pub const SYS_linkat: ::c_long = 37;
-pub const SYS_renameat: ::c_long = 38;
+// 38 is renameat only on LP64
pub const SYS_umount2: ::c_long = 39;
pub const SYS_mount: ::c_long = 40;
pub const SYS_pivot_root: ::c_long = 41;
pub const SYS_nfsservctl: ::c_long = 42;
+pub const SYS_statfs: ::c_long = 43;
+pub const SYS_fstatfs: ::c_long = 44;
+pub const SYS_truncate: ::c_long = 45;
+pub const SYS_ftruncate: ::c_long = 46;
pub const SYS_fallocate: ::c_long = 47;
pub const SYS_faccessat: ::c_long = 48;
pub const SYS_chdir: ::c_long = 49;
@@ -742,7 +711,7 @@ pub const SYS_fstat: ::c_long = 80;
pub const SYS_sync: ::c_long = 81;
pub const SYS_fsync: ::c_long = 82;
pub const SYS_fdatasync: ::c_long = 83;
-pub const SYS_sync_file_range: ::c_long = 84;
+// 84 sync_file_range on LP64 and sync_file_range2 on ILP32
pub const SYS_timerfd_create: ::c_long = 85;
pub const SYS_timerfd_settime: ::c_long = 86;
pub const SYS_timerfd_gettime: ::c_long = 87;
@@ -821,8 +790,8 @@ pub const SYS_setgroups: ::c_long = 159;
pub const SYS_uname: ::c_long = 160;
pub const SYS_sethostname: ::c_long = 161;
pub const SYS_setdomainname: ::c_long = 162;
-pub const SYS_getrlimit: ::c_long = 163;
-pub const SYS_setrlimit: ::c_long = 164;
+// 163 is getrlimit only on LP64
+// 164 is setrlimit only on LP64
pub const SYS_getrusage: ::c_long = 165;
pub const SYS_umask: ::c_long = 166;
pub const SYS_prctl: ::c_long = 167;
@@ -933,8 +902,26 @@ 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_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;
-#[link(name = "util")]
extern "C" {
pub fn sysctl(
name: *mut ::c_int,
@@ -947,6 +934,16 @@ extern "C" {
}
cfg_if! {
+ if #[cfg(target_pointer_width = "32")] {
+ mod ilp32;
+ pub use self::ilp32::*;
+ } else {
+ mod lp64;
+ pub use self::lp64::*;
+ }
+}
+
+cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
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 a59554b8..87939566 100644
--- a/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs
@@ -577,6 +577,25 @@ pub const SYS_pkey_mprotect: ::c_long = 5000 + 323;
pub const SYS_pkey_alloc: ::c_long = 5000 + 324;
pub const SYS_pkey_free: ::c_long = 5000 + 325;
pub const SYS_statx: ::c_long = 5000 + 326;
+pub const SYS_pidfd_send_signal: ::c_long = 5000 + 424;
+pub const SYS_io_uring_setup: ::c_long = 5000 + 425;
+pub const SYS_io_uring_enter: ::c_long = 5000 + 426;
+pub const SYS_io_uring_register: ::c_long = 5000 + 427;
+pub const SYS_open_tree: ::c_long = 5000 + 428;
+pub const SYS_move_mount: ::c_long = 5000 + 429;
+pub const SYS_fsopen: ::c_long = 5000 + 430;
+pub const SYS_fsconfig: ::c_long = 5000 + 431;
+pub const SYS_fsmount: ::c_long = 5000 + 432;
+pub const SYS_fspick: ::c_long = 5000 + 433;
+pub const SYS_pidfd_open: ::c_long = 5000 + 434;
+pub const SYS_clone3: ::c_long = 5000 + 435;
+pub const SYS_close_range: ::c_long = 5000 + 436;
+pub const SYS_openat2: ::c_long = 5000 + 437;
+pub const SYS_pidfd_getfd: ::c_long = 5000 + 438;
+pub const SYS_faccessat2: ::c_long = 5000 + 439;
+pub const SYS_process_madvise: ::c_long = 5000 + 440;
+pub const SYS_epoll_pwait2: ::c_long = 5000 + 441;
+pub const SYS_mount_setattr: ::c_long = 5000 + 442;
pub const SFD_CLOEXEC: ::c_int = 0x080000;
@@ -737,62 +756,6 @@ pub const MAP_HUGETLB: ::c_int = 0x080000;
pub const SOCK_STREAM: ::c_int = 2;
pub const SOCK_DGRAM: ::c_int = 1;
-pub const SOL_SOCKET: ::c_int = 0xffff;
-
-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_LINGER: ::c_int = 0x0080;
-pub const SO_OOBINLINE: ::c_int = 0x0100;
-pub const SO_REUSEPORT: ::c_int = 0x0200;
-pub const SO_TYPE: ::c_int = 0x1008;
-pub const SO_STYLE: ::c_int = SO_TYPE;
-pub const SO_ERROR: ::c_int = 0x1007;
-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_ACCEPTCONN: ::c_int = 0x1009;
-pub const SO_PROTOCOL: ::c_int = 0x1028;
-pub const SO_DOMAIN: ::c_int = 0x1029;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_BSDCOMPAT: ::c_int = 14;
-pub const SO_PASSCRED: ::c_int = 17;
-pub const SO_PEERCRED: ::c_int = 18;
-pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22;
-pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
-pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
-pub const SO_BINDTODEVICE: ::c_int = 25;
-pub const SO_ATTACH_FILTER: ::c_int = 26;
-pub const SO_DETACH_FILTER: ::c_int = 27;
-pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
-pub const SO_PEERNAME: ::c_int = 28;
-pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SO_PEERSEC: ::c_int = 30;
-pub const SO_SNDBUFFORCE: ::c_int = 31;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_PASSSEC: ::c_int = 34;
-pub const SO_TIMESTAMPNS: ::c_int = 35;
-pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
-pub const SO_MARK: ::c_int = 36;
-pub const SO_RXQ_OVFL: ::c_int = 40;
-pub const SO_WIFI_STATUS: ::c_int = 41;
-pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS;
-pub const SO_PEEK_OFF: ::c_int = 42;
-pub const SO_NOFCS: ::c_int = 43;
-pub const SO_LOCK_FILTER: ::c_int = 44;
-pub const SO_SELECT_ERR_QUEUE: ::c_int = 45;
-pub const SO_BUSY_POLL: ::c_int = 46;
-pub const SO_MAX_PACING_RATE: ::c_int = 47;
-pub const SO_BPF_EXTENSIONS: ::c_int = 48;
-pub const SO_INCOMING_CPU: ::c_int = 49;
-pub const SO_ATTACH_BPF: ::c_int = 50;
-pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER;
-
pub const FIOCLEX: ::c_ulong = 0x6601;
pub const FIONCLEX: ::c_ulong = 0x6602;
pub const FIONBIO: ::c_ulong = 0x667e;
@@ -857,6 +820,9 @@ 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 SFD_NONBLOCK: ::c_int = 0x80;
@@ -871,6 +837,8 @@ pub const TCSETAF: ::c_ulong = 0x5404;
pub const TCSBRK: ::c_ulong = 0x5405;
pub const TCXONC: ::c_ulong = 0x5406;
pub const TCFLSH: ::c_ulong = 0x5407;
+pub const TIOCSBRK: ::c_ulong = 0x5427;
+pub const TIOCCBRK: ::c_ulong = 0x5428;
pub const TIOCGSOFTCAR: ::c_ulong = 0x5481;
pub const TIOCSSOFTCAR: ::c_ulong = 0x5482;
pub const TIOCINQ: ::c_ulong = 0x467f;
@@ -997,7 +965,6 @@ pub const TIOCM_DSR: ::c_int = 0x400;
pub const EHWPOISON: ::c_int = 168;
-#[link(name = "util")]
extern "C" {
pub fn sysctl(
name: *mut ::c_int,
diff --git a/src/unix/linux_like/linux/gnu/b64/mod.rs b/src/unix/linux_like/linux/gnu/b64/mod.rs
index 40ce8441..138adc91 100644
--- a/src/unix/linux_like/linux/gnu/b64/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b64/mod.rs
@@ -1,7 +1,5 @@
//! 64-bit specific definitions for linux-like values
-pub type clock_t = i64;
-pub type time_t = i64;
pub type ino_t = u64;
pub type off_t = i64;
pub type blkcnt_t = i64;
@@ -11,7 +9,17 @@ pub type msglen_t = u64;
pub type fsblkcnt_t = u64;
pub type fsfilcnt_t = u64;
pub type rlim_t = u64;
-pub type __fsword_t = i64;
+cfg_if! {
+ if #[cfg(all(target_arch = "aarch64", target_pointer_width = "32"))] {
+ pub type clock_t = i32;
+ pub type time_t = i32;
+ pub type __fsword_t = i32;
+ } else {
+ pub type __fsword_t = i64;
+ pub type clock_t = i64;
+ pub type time_t = i64;
+ }
+}
s! {
pub struct sigset_t {
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 22507d72..dcaeaf52 100644
--- a/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs
@@ -190,6 +190,12 @@ s! {
pub ss_flags: ::c_int,
pub ss_size: ::size_t
}
+
+ pub struct ip_mreqn {
+ pub imr_multiaddr: ::in_addr,
+ pub imr_address: ::in_addr,
+ pub imr_ifindex: ::c_int,
+ }
}
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
@@ -313,61 +319,6 @@ pub const ENOTRECOVERABLE: ::c_int = 131;
pub const EHWPOISON: ::c_int = 133;
pub const ERFKILL: ::c_int = 132;
-pub const SOL_SOCKET: ::c_int = 1;
-
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_TYPE: ::c_int = 3;
-pub const SO_ERROR: ::c_int = 4;
-pub const SO_DONTROUTE: ::c_int = 5;
-pub const SO_BROADCAST: ::c_int = 6;
-pub const SO_SNDBUF: ::c_int = 7;
-pub const SO_RCVBUF: ::c_int = 8;
-pub const SO_SNDBUFFORCE: ::c_int = 32;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_KEEPALIVE: ::c_int = 9;
-pub const SO_OOBINLINE: ::c_int = 10;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_LINGER: ::c_int = 13;
-pub const SO_BSDCOMPAT: ::c_int = 14;
-pub const SO_REUSEPORT: ::c_int = 15;
-pub const SO_PASSCRED: ::c_int = 20;
-pub const SO_PEERCRED: ::c_int = 21;
-pub const SO_RCVLOWAT: ::c_int = 16;
-pub const SO_SNDLOWAT: ::c_int = 17;
-pub const SO_RCVTIMEO: ::c_int = 18;
-pub const SO_SNDTIMEO: ::c_int = 19;
-pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22;
-pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
-pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
-pub const SO_BINDTODEVICE: ::c_int = 25;
-pub const SO_ATTACH_FILTER: ::c_int = 26;
-pub const SO_DETACH_FILTER: ::c_int = 27;
-pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
-pub const SO_PEERNAME: ::c_int = 28;
-pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SO_ACCEPTCONN: ::c_int = 30;
-pub const SO_PEERSEC: ::c_int = 31;
-pub const SO_PASSSEC: ::c_int = 34;
-pub const SO_TIMESTAMPNS: ::c_int = 35;
-pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
-pub const SO_MARK: ::c_int = 36;
-pub const SO_PROTOCOL: ::c_int = 38;
-pub const SO_DOMAIN: ::c_int = 39;
-pub const SO_RXQ_OVFL: ::c_int = 40;
-pub const SO_WIFI_STATUS: ::c_int = 41;
-pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS;
-pub const SO_PEEK_OFF: ::c_int = 42;
-pub const SO_NOFCS: ::c_int = 43;
-pub const SO_LOCK_FILTER: ::c_int = 44;
-pub const SO_SELECT_ERR_QUEUE: ::c_int = 45;
-pub const SO_BUSY_POLL: ::c_int = 46;
-pub const SO_MAX_PACING_RATE: ::c_int = 47;
-pub const SO_BPF_EXTENSIONS: ::c_int = 48;
-pub const SO_INCOMING_CPU: ::c_int = 49;
-pub const SO_ATTACH_BPF: ::c_int = 50;
-pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER;
-
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
@@ -416,6 +367,9 @@ 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 F_RDLCK: ::c_int = 0;
pub const F_WRLCK: ::c_int = 1;
@@ -438,6 +392,8 @@ pub const TIOCMBIS: ::c_ulong = 0x5416;
pub const TIOCMBIC: ::c_ulong = 0x5417;
pub const TIOCMSET: ::c_ulong = 0x5418;
pub const TIOCCONS: ::c_ulong = 0x541D;
+pub const TIOCSBRK: ::c_ulong = 0x5427;
+pub const TIOCCBRK: ::c_ulong = 0x5428;
pub const TIOCGRS485: ::c_int = 0x542E;
pub const TIOCSRS485: ::c_int = 0x542F;
@@ -541,6 +497,7 @@ pub const O_DIRECT: ::c_int = 0x20000;
pub const MAP_LOCKED: ::c_int = 0x00080;
pub const MAP_NORESERVE: ::c_int = 0x00040;
+pub const MAP_SYNC: ::c_int = 0x080000;
pub const EDEADLOCK: ::c_int = 58;
pub const EUCLEAN: ::c_int = 117;
@@ -1031,8 +988,26 @@ pub const SYS_preadv2: ::c_long = 380;
pub const SYS_pwritev2: ::c_long = 381;
pub const SYS_kexec_file_load: ::c_long = 382;
pub const SYS_statx: ::c_long = 383;
+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;
-#[link(name = "util")]
extern "C" {
pub fn sysctl(
name: *mut ::c_int,
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 c45c5b23..c656189c 100644
--- a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs
@@ -4,23 +4,10 @@ pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type wchar_t = ::c_int;
-pub type time_t = ::c_long;
-pub type dev_t = ::c_ulong;
-pub type uid_t = ::c_uint;
-pub type gid_t = ::c_uint;
-pub type ino_t = ::c_ulong;
-pub type ino64_t = ::c_ulong;
-pub type mode_t = ::c_uint;
pub type nlink_t = ::c_uint;
-pub type off_t = ::c_long;
-pub type off64_t = ::c_long;
-pub type pid_t = ::c_int;
pub type blksize_t = ::c_int;
-pub type blkcnt_t = ::c_long;
-pub type fsblkcnt_t = ::c_ulong;
pub type fsblkcnt64_t = ::c_ulong;
-pub type fsfilcnt_t = ::c_ulong;
pub type fsfilcnt64_t = ::c_ulong;
pub type suseconds_t = i64;
pub type __u64 = ::c_ulonglong;
@@ -30,63 +17,58 @@ s! {
__size: [::c_ulong; 7],
}
- pub struct timespec {
- pub tv_sec: time_t,
- pub tv_nsec: ::c_long,
- }
-
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 __pad1: dev_t,
- pub st_size: off_t,
- pub st_blksize: blksize_t,
+ 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 __pad1: ::dev_t,
+ pub st_size: ::off_t,
+ pub st_blksize: ::blksize_t,
pub __pad2: ::c_int,
- pub st_blocks: blkcnt_t,
- pub st_atime: time_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: ::time_t,
pub st_mtime_nsec: ::c_long,
- pub st_ctime: time_t,
+ pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
- pub __unused: [::c_int; 2usize],
+ __unused: [::c_int; 2usize],
}
pub struct stat64 {
- pub st_dev: dev_t,
- pub st_ino: ino64_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 __pad1: dev_t,
- pub st_size: off64_t,
- pub st_blksize: blksize_t,
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino64_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 __pad1: ::dev_t,
+ pub st_size: ::off64_t,
+ pub st_blksize: ::blksize_t,
pub __pad2: ::c_int,
- pub st_blocks: blkcnt_t,
- pub st_atime: time_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: ::time_t,
pub st_mtime_nsec: ::c_long,
- pub st_ctime: time_t,
+ pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
- pub __unused: [::c_int; 2],
+ __unused: [::c_int; 2],
}
pub struct statfs {
pub f_type: ::c_long,
pub f_bsize: ::c_long,
- 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_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_long,
pub f_frsize: ::c_long,
@@ -97,11 +79,11 @@ s! {
pub struct statfs64 {
pub f_type: ::c_long,
pub f_bsize: ::c_long,
- 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_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_namelen: ::c_long,
pub f_frsize: ::c_long,
@@ -112,12 +94,12 @@ s! {
pub struct statvfs {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
- pub f_blocks: fsblkcnt_t,
- pub f_bfree: fsblkcnt_t,
- pub f_bavail: fsblkcnt_t,
- pub f_files: fsfilcnt_t,
- pub f_ffree: fsfilcnt_t,
- pub f_favail: fsfilcnt_t,
+ pub f_blocks: ::fsblkcnt_t,
+ pub f_bfree: ::fsblkcnt_t,
+ pub f_bavail: ::fsblkcnt_t,
+ pub f_files: ::fsfilcnt_t,
+ pub f_ffree: ::fsfilcnt_t,
+ pub f_favail: ::fsfilcnt_t,
pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
@@ -127,12 +109,12 @@ s! {
pub struct statvfs64 {
pub f_bsize: ::c_ulong,
pub f_frsize: ::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_favail: fsfilcnt64_t,
+ 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_favail: ::fsfilcnt64_t,
pub f_fsid: ::c_ulong,
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
@@ -167,35 +149,31 @@ s! {
pub sa_restorer: ::Option<unsafe extern "C" fn()>,
}
- pub struct sigset_t {
- pub __val: [::c_ulong; 16],
- }
-
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 uid: ::uid_t,
+ pub gid: ::gid_t,
+ pub cuid: ::uid_t,
+ pub cgid: ::gid_t,
pub mode: ::c_ushort,
- pub __pad1: ::c_ushort,
+ __pad1: ::c_ushort,
pub __seq: ::c_ushort,
- pub __pad2: ::c_ushort,
- pub __unused1: ::c_ulong,
- pub __unused2: ::c_ulong,
+ __pad2: ::c_ushort,
+ __unused1: ::c_ulong,
+ __unused2: ::c_ulong,
}
pub struct shmid_ds {
- pub shm_perm: ipc_perm,
+ pub shm_perm: ::ipc_perm,
pub shm_segsz: ::size_t,
- pub shm_atime: time_t,
- pub shm_dtime: time_t,
- pub shm_ctime: time_t,
- pub shm_cpid: pid_t,
- pub shm_lpid: pid_t,
+ pub shm_atime: ::time_t,
+ pub shm_dtime: ::time_t,
+ pub shm_ctime: ::time_t,
+ pub shm_cpid: ::pid_t,
+ pub shm_lpid: ::pid_t,
pub shm_nattch: ::shmatt_t,
- pub __unused5: ::c_ulong,
- pub __unused6: ::c_ulong,
+ __unused5: ::c_ulong,
+ __unused6: ::c_ulong,
}
pub struct flock {
@@ -205,15 +183,37 @@ s! {
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 ip_mreqn {
+ pub imr_multiaddr: ::in_addr,
+ pub imr_address: ::in_addr,
+ pub imr_ifindex: ::c_int,
+ }
}
pub const POSIX_FADV_DONTNEED: ::c_int = 4;
pub const POSIX_FADV_NOREUSE: ::c_int = 5;
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 TIOCGSOFTCAR: ::c_ulong = 21529;
pub const TIOCSSOFTCAR: ::c_ulong = 21530;
pub const TIOCGRS485: ::c_int = 21550;
pub const TIOCSRS485: ::c_int = 21551;
+pub const RLIMIT_RSS: ::__rlimit_resource_t = 5;
+pub const RLIMIT_AS: ::__rlimit_resource_t = 9;
+pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8;
+pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7;
+pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6;
pub const O_APPEND: ::c_int = 1024;
pub const O_CREAT: ::c_int = 64;
pub const O_EXCL: ::c_int = 128;
@@ -305,59 +305,7 @@ 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 SOL_SOCKET: ::c_int = 1;
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_TYPE: ::c_int = 3;
-pub const SO_ERROR: ::c_int = 4;
-pub const SO_DONTROUTE: ::c_int = 5;
-pub const SO_BROADCAST: ::c_int = 6;
-pub const SO_SNDBUF: ::c_int = 7;
-pub const SO_RCVBUF: ::c_int = 8;
-pub const SO_SNDBUFFORCE: ::c_int = 32;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_KEEPALIVE: ::c_int = 9;
-pub const SO_OOBINLINE: ::c_int = 10;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_LINGER: ::c_int = 13;
-pub const SO_BSDCOMPAT: ::c_int = 14;
-pub const SO_REUSEPORT: ::c_int = 15;
-pub const SO_PASSCRED: ::c_int = 16;
-pub const SO_PEERCRED: ::c_int = 17;
-pub const SO_RCVLOWAT: ::c_int = 18;
-pub const SO_SNDLOWAT: ::c_int = 19;
-pub const SO_RCVTIMEO: ::c_int = 20;
-pub const SO_SNDTIMEO: ::c_int = 21;
-pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22;
-pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
-pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
-pub const SO_BINDTODEVICE: ::c_int = 25;
-pub const SO_ATTACH_FILTER: ::c_int = 26;
-pub const SO_DETACH_FILTER: ::c_int = 27;
-pub const SO_GET_FILTER: ::c_int = 26;
-pub const SO_PEERNAME: ::c_int = 28;
-pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SO_ACCEPTCONN: ::c_int = 30;
-pub const SO_PEERSEC: ::c_int = 31;
-pub const SO_PASSSEC: ::c_int = 34;
-pub const SO_TIMESTAMPNS: ::c_int = 35;
-pub const SCM_TIMESTAMPNS: ::c_int = 35;
-pub const SO_MARK: ::c_int = 36;
-pub const SO_PROTOCOL: ::c_int = 38;
-pub const SO_DOMAIN: ::c_int = 39;
-pub const SO_RXQ_OVFL: ::c_int = 40;
-pub const SO_WIFI_STATUS: ::c_int = 41;
-pub const SCM_WIFI_STATUS: ::c_int = 41;
-pub const SO_PEEK_OFF: ::c_int = 42;
-pub const SO_NOFCS: ::c_int = 43;
-pub const SO_LOCK_FILTER: ::c_int = 44;
-pub const SO_SELECT_ERR_QUEUE: ::c_int = 45;
-pub const SO_BUSY_POLL: ::c_int = 46;
-pub const SO_MAX_PACING_RATE: ::c_int = 47;
-pub const SO_BPF_EXTENSIONS: ::c_int = 48;
-pub const SO_INCOMING_CPU: ::c_int = 49;
-pub const SO_ATTACH_BPF: ::c_int = 50;
-pub const SO_DETACH_BPF: ::c_int = 27;
+
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
pub const SA_ONSTACK: ::c_int = 134217728;
@@ -400,6 +348,9 @@ pub const F_SETLKW: ::c_int = 7;
pub const F_RDLCK: ::c_int = 0;
pub const F_WRLCK: ::c_int = 1;
pub const F_UNLCK: ::c_int = 2;
+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 SFD_NONBLOCK: ::c_int = 2048;
pub const TCSANOW: ::c_int = 0;
pub const TCSADRAIN: ::c_int = 1;
@@ -460,6 +411,7 @@ pub const MAP_EXECUTABLE: ::c_int = 4096;
pub const MAP_POPULATE: ::c_int = 32768;
pub const MAP_NONBLOCK: ::c_int = 65536;
pub const MAP_STACK: ::c_int = 131072;
+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;
@@ -859,3 +811,22 @@ 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_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;
diff --git a/src/unix/linux_like/linux/gnu/b64/s390x.rs b/src/unix/linux_like/linux/gnu/b64/s390x.rs
index cf0612a8..7685a34f 100644
--- a/src/unix/linux_like/linux/gnu/b64/s390x.rs
+++ b/src/unix/linux_like/linux/gnu/b64/s390x.rs
@@ -354,20 +354,6 @@ pub const SIGBUS: ::c_int = 7;
pub const SIGSTKSZ: ::size_t = 0x2000;
pub const MINSIGSTKSZ: ::size_t = 2048;
pub const SIG_SETMASK: ::c_int = 2;
-pub const SOL_SOCKET: ::c_int = 1;
-pub const SO_BROADCAST: ::c_int = 6;
-pub const SO_ERROR: ::c_int = 4;
-pub const SO_RCVTIMEO: ::c_int = 20;
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_SNDTIMEO: ::c_int = 21;
-pub const SO_BINDTODEVICE: ::c_int = 25;
-pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SO_MARK: ::c_int = 36;
-pub const SO_PROTOCOL: ::c_int = 38;
-pub const SO_DOMAIN: ::c_int = 39;
-pub const SO_RXQ_OVFL: ::c_int = 40;
-pub const SO_PEEK_OFF: ::c_int = 42;
-pub const SO_BUSY_POLL: ::c_int = 46;
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
@@ -471,24 +457,6 @@ pub const ENOTRECOVERABLE: ::c_int = 131;
pub const EHWPOISON: ::c_int = 133;
pub const ERFKILL: ::c_int = 132;
-pub const SO_TYPE: ::c_int = 3;
-pub const SO_DONTROUTE: ::c_int = 5;
-pub const SO_SNDBUF: ::c_int = 7;
-pub const SO_RCVBUF: ::c_int = 8;
-pub const SO_KEEPALIVE: ::c_int = 9;
-pub const SO_OOBINLINE: ::c_int = 10;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_LINGER: ::c_int = 13;
-pub const SO_BSDCOMPAT: ::c_int = 14;
-pub const SO_REUSEPORT: ::c_int = 15;
-pub const SO_PASSCRED: ::c_int = 16;
-pub const SO_PEERCRED: ::c_int = 17;
-pub const SO_RCVLOWAT: ::c_int = 18;
-pub const SO_SNDLOWAT: ::c_int = 19;
-pub const SO_ACCEPTCONN: ::c_int = 30;
-pub const SO_SNDBUFFORCE: ::c_int = 32;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-
pub const SIGTTIN: ::c_int = 21;
pub const SIGTTOU: ::c_int = 22;
pub const SIGXCPU: ::c_int = 24;
@@ -540,6 +508,9 @@ 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 SFD_NONBLOCK: ::c_int = 0x0800;
@@ -572,6 +543,8 @@ pub const TIOCMBIC: ::c_ulong = 0x5417;
pub const TIOCMSET: ::c_ulong = 0x5418;
pub const FIONREAD: ::c_ulong = 0x541B;
pub const TIOCCONS: ::c_ulong = 0x541D;
+pub const TIOCSBRK: ::c_ulong = 0x5427;
+pub const TIOCCBRK: ::c_ulong = 0x5428;
pub const TCSANOW: ::c_int = 0;
pub const TCSADRAIN: ::c_int = 1;
@@ -1002,8 +975,26 @@ pub const SYS_setfsuid: ::c_long = 215;
pub const SYS_setfsgid: ::c_long = 216;
pub const SYS_newfstatat: ::c_long = 293;
pub const SYS_statx: ::c_long = 379;
+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;
-#[link(name = "util")]
extern "C" {
pub fn sysctl(
@@ -1016,14 +1007,6 @@ extern "C" {
) -> ::c_int;
pub fn getcontext(ucp: *mut ::ucontext_t) -> ::c_int;
pub fn setcontext(ucp: *const ::ucontext_t) -> ::c_int;
- pub fn makecontext(
- ucp: *mut ::ucontext_t,
- func: extern "C" fn(),
- argc: ::c_int,
- ...
- );
- pub fn swapcontext(
- uocp: *mut ::ucontext_t,
- ucp: *const ::ucontext_t,
- ) -> ::c_int;
+ pub fn makecontext(ucp: *mut ::ucontext_t, func: extern "C" fn(), argc: ::c_int, ...);
+ pub fn swapcontext(uocp: *mut ::ucontext_t, ucp: *const ::ucontext_t) -> ::c_int;
}
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 651ada37..5ed83ab8 100644
--- a/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs
+++ b/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs
@@ -247,6 +247,7 @@ 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_SYNC: ::c_int = 0x080000;
pub const EDEADLK: ::c_int = 78;
pub const ENAMETOOLONG: ::c_int = 63;
@@ -327,31 +328,6 @@ pub const ENOTRECOVERABLE: ::c_int = 133;
pub const EHWPOISON: ::c_int = 135;
pub const ERFKILL: ::c_int = 134;
-pub const SOL_SOCKET: ::c_int = 0xffff;
-
-pub const SO_PASSCRED: ::c_int = 2;
-pub const SO_REUSEADDR: ::c_int = 4;
-pub const SO_BINDTODEVICE: ::c_int = 0x000d;
-pub const SO_TIMESTAMP: ::c_int = 0x001d;
-pub const SO_MARK: ::c_int = 0x0022;
-pub const SO_RXQ_OVFL: ::c_int = 0x0024;
-pub const SO_PEEK_OFF: ::c_int = 0x0026;
-pub const SO_BUSY_POLL: ::c_int = 0x0030;
-pub const SO_TYPE: ::c_int = 0x1008;
-pub const SO_ERROR: ::c_int = 0x1007;
-pub const SO_DONTROUTE: ::c_int = 16;
-pub const SO_BROADCAST: ::c_int = 32;
-pub const SO_SNDBUF: ::c_int = 0x1001;
-pub const SO_RCVBUF: ::c_int = 0x1002;
-pub const SO_SNDBUFFORCE: ::c_int = 0x100a;
-pub const SO_RCVBUFFORCE: ::c_int = 0x100b;
-pub const SO_DOMAIN: ::c_int = 0x1029;
-pub const SO_KEEPALIVE: ::c_int = 8;
-pub const SO_OOBINLINE: ::c_int = 0x100;
-pub const SO_LINGER: ::c_int = 128;
-pub const SO_REUSEPORT: ::c_int = 0x200;
-pub const SO_ACCEPTCONN: ::c_int = 0x8000;
-
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
@@ -397,6 +373,9 @@ pub const F_GETOWN: ::c_int = 5;
pub const F_SETOWN: ::c_int = 6;
pub const F_SETLK: ::c_int = 8;
pub const F_SETLKW: ::c_int = 9;
+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 = 1;
pub const F_WRLCK: ::c_int = 2;
@@ -412,13 +391,15 @@ pub const TIOCLINUX: ::c_ulong = 0x541C;
pub const TIOCGSERIAL: ::c_ulong = 0x541E;
pub const TIOCEXCL: ::c_ulong = 0x2000740d;
pub const TIOCNXCL: ::c_ulong = 0x2000740e;
-pub const TIOCSCTTY: ::c_ulong = 0x20007484;
-pub const TIOCSTI: ::c_ulong = 0x80017472;
+pub const TIOCCONS: ::c_ulong = 0x20007424;
pub const TIOCMGET: ::c_ulong = 0x4004746a;
-pub const TIOCMBIS: ::c_ulong = 0x8004746c;
pub const TIOCMBIC: ::c_ulong = 0x8004746b;
+pub const TIOCMBIS: ::c_ulong = 0x8004746c;
pub const TIOCMSET: ::c_ulong = 0x8004746d;
-pub const TIOCCONS: ::c_ulong = 0x20007424;
+pub const TIOCSTI: ::c_ulong = 0x80017472;
+pub const TIOCCBRK: ::c_ulong = 0x2000747a;
+pub const TIOCSBRK: ::c_ulong = 0x2000747b;
+pub const TIOCSCTTY: ::c_ulong = 0x20007484;
pub const TIOCM_ST: ::c_int = 0x008;
pub const TIOCM_SR: ::c_int = 0x010;
@@ -499,12 +480,6 @@ pub const ENAVAIL: ::c_int = 119;
pub const EISNAM: ::c_int = 120;
pub const EREMOTEIO: ::c_int = 121;
-pub const SO_PEERCRED: ::c_int = 0x40;
-pub const SO_RCVLOWAT: ::c_int = 0x800;
-pub const SO_SNDLOWAT: ::c_int = 0x1000;
-pub const SO_RCVTIMEO: ::c_int = 0x2000;
-pub const SO_SNDTIMEO: ::c_int = 0x4000;
-
pub const FIOCLEX: ::c_ulong = 0x20006601;
pub const FIONCLEX: ::c_ulong = 0x20006602;
pub const FIONBIO: ::c_ulong = 0x8004667e;
@@ -967,8 +942,27 @@ pub const SYS_copy_file_range: ::c_long = 357;
pub const SYS_preadv2: ::c_long = 358;
pub const SYS_pwritev2: ::c_long = 359;
pub const SYS_statx: ::c_long = 360;
+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;
+// Reserved in the kernel, but not actually implemented yet
+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;
-#[link(name = "util")]
extern "C" {
pub fn sysctl(
name: *mut ::c_int,
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 34e4da8b..99937dfa 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
@@ -515,61 +515,6 @@ pub const ENOTRECOVERABLE: ::c_int = 131;
pub const EHWPOISON: ::c_int = 133;
pub const ERFKILL: ::c_int = 132;
-pub const SOL_SOCKET: ::c_int = 1;
-
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_TYPE: ::c_int = 3;
-pub const SO_ERROR: ::c_int = 4;
-pub const SO_DONTROUTE: ::c_int = 5;
-pub const SO_BROADCAST: ::c_int = 6;
-pub const SO_SNDBUF: ::c_int = 7;
-pub const SO_RCVBUF: ::c_int = 8;
-pub const SO_SNDBUFFORCE: ::c_int = 32;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_KEEPALIVE: ::c_int = 9;
-pub const SO_OOBINLINE: ::c_int = 10;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_LINGER: ::c_int = 13;
-pub const SO_BSDCOMPAT: ::c_int = 14;
-pub const SO_REUSEPORT: ::c_int = 15;
-pub const SO_PASSCRED: ::c_int = 16;
-pub const SO_PEERCRED: ::c_int = 17;
-pub const SO_RCVLOWAT: ::c_int = 18;
-pub const SO_SNDLOWAT: ::c_int = 19;
-pub const SO_RCVTIMEO: ::c_int = 20;
-pub const SO_SNDTIMEO: ::c_int = 21;
-pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22;
-pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
-pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
-pub const SO_BINDTODEVICE: ::c_int = 25;
-pub const SO_ATTACH_FILTER: ::c_int = 26;
-pub const SO_DETACH_FILTER: ::c_int = 27;
-pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
-pub const SO_PEERNAME: ::c_int = 28;
-pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SO_ACCEPTCONN: ::c_int = 30;
-pub const SO_PEERSEC: ::c_int = 31;
-pub const SO_PASSSEC: ::c_int = 34;
-pub const SO_TIMESTAMPNS: ::c_int = 35;
-pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
-pub const SO_MARK: ::c_int = 36;
-pub const SO_PROTOCOL: ::c_int = 38;
-pub const SO_DOMAIN: ::c_int = 39;
-pub const SO_RXQ_OVFL: ::c_int = 40;
-pub const SO_WIFI_STATUS: ::c_int = 41;
-pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS;
-pub const SO_PEEK_OFF: ::c_int = 42;
-pub const SO_NOFCS: ::c_int = 43;
-pub const SO_LOCK_FILTER: ::c_int = 44;
-pub const SO_SELECT_ERR_QUEUE: ::c_int = 45;
-pub const SO_BUSY_POLL: ::c_int = 46;
-pub const SO_MAX_PACING_RATE: ::c_int = 47;
-pub const SO_BPF_EXTENSIONS: ::c_int = 48;
-pub const SO_INCOMING_CPU: ::c_int = 49;
-pub const SO_ATTACH_BPF: ::c_int = 50;
-pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER;
-
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
@@ -618,6 +563,9 @@ 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 F_RDLCK: ::c_int = 0;
pub const F_WRLCK: ::c_int = 1;
@@ -698,6 +646,7 @@ 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_SYNC: ::c_int = 0x080000;
pub const EDEADLOCK: ::c_int = 35;
pub const EUCLEAN: ::c_int = 117;
@@ -717,6 +666,8 @@ pub const PTRACE_SETFPXREGS: ::c_uint = 19;
pub const PTRACE_GETREGS: ::c_uint = 12;
pub const PTRACE_SETREGS: ::c_uint = 13;
pub const PTRACE_PEEKSIGINFO_SHARED: ::c_uint = 1;
+pub const PTRACE_SYSEMU: ::c_uint = 31;
+pub const PTRACE_SYSEMU_SINGLESTEP: ::c_uint = 32;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
@@ -835,6 +786,8 @@ pub const TIOCOUTQ: ::c_ulong = 0x5411;
pub const TIOCGWINSZ: ::c_ulong = 0x5413;
pub const TIOCSWINSZ: ::c_ulong = 0x5414;
pub const FIONREAD: ::c_ulong = 0x541B;
+pub const TIOCSBRK: ::c_ulong = 0x5427;
+pub const TIOCCBRK: ::c_ulong = 0x5428;
// offsets in user_regs_structs, from sys/reg.h
pub const R15: ::c_int = 0;
@@ -893,22 +846,10 @@ pub const REG_CR2: ::c_int = 22;
extern "C" {
pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;
pub fn setcontext(ucp: *const ucontext_t) -> ::c_int;
- pub fn makecontext(
- ucp: *mut ucontext_t,
- func: extern "C" fn(),
- argc: ::c_int,
- ...
- );
- pub fn swapcontext(
- uocp: *mut ucontext_t,
- ucp: *const ucontext_t,
- ) -> ::c_int;
+ pub fn makecontext(ucp: *mut ucontext_t, func: extern "C" fn(), argc: ::c_int, ...);
+ pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> ::c_int;
pub fn iopl(level: ::c_int) -> ::c_int;
- pub fn ioperm(
- from: ::c_ulong,
- num: ::c_ulong,
- turn_on: ::c_int,
- ) -> ::c_int;
+ pub fn ioperm(from: ::c_ulong, num: ::c_ulong, turn_on: ::c_int) -> ::c_int;
}
cfg_if! {
diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs
index 64a6de9c..e1269842 100644
--- a/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs
+++ b/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs
@@ -409,8 +409,26 @@ pub const SYS_pkey_mprotect: ::c_long = 329;
pub const SYS_pkey_alloc: ::c_long = 330;
pub const SYS_pkey_free: ::c_long = 331;
pub const SYS_statx: ::c_long = 332;
+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;
-#[link(name = "util")]
extern "C" {
pub fn sysctl(
name: *mut ::c_int,
diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs
index 37468818..dcbc3472 100644
--- a/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs
+++ b/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs
@@ -337,6 +337,25 @@ pub const SYS_pkey_mprotect: ::c_long = __X32_SYSCALL_BIT + 329;
pub const SYS_pkey_alloc: ::c_long = __X32_SYSCALL_BIT + 330;
pub const SYS_pkey_free: ::c_long = __X32_SYSCALL_BIT + 331;
pub const SYS_statx: ::c_long = __X32_SYSCALL_BIT + 332;
+pub const SYS_pidfd_send_signal: ::c_long = __X32_SYSCALL_BIT + 424;
+pub const SYS_io_uring_setup: ::c_long = __X32_SYSCALL_BIT + 425;
+pub const SYS_io_uring_enter: ::c_long = __X32_SYSCALL_BIT + 426;
+pub const SYS_io_uring_register: ::c_long = __X32_SYSCALL_BIT + 427;
+pub const SYS_open_tree: ::c_long = __X32_SYSCALL_BIT + 428;
+pub const SYS_move_mount: ::c_long = __X32_SYSCALL_BIT + 429;
+pub const SYS_fsopen: ::c_long = __X32_SYSCALL_BIT + 430;
+pub const SYS_fsconfig: ::c_long = __X32_SYSCALL_BIT + 431;
+pub const SYS_fsmount: ::c_long = __X32_SYSCALL_BIT + 432;
+pub const SYS_fspick: ::c_long = __X32_SYSCALL_BIT + 433;
+pub const SYS_pidfd_open: ::c_long = __X32_SYSCALL_BIT + 434;
+pub const SYS_clone3: ::c_long = __X32_SYSCALL_BIT + 435;
+pub const SYS_close_range: ::c_long = __X32_SYSCALL_BIT + 436;
+pub const SYS_openat2: ::c_long = __X32_SYSCALL_BIT + 437;
+pub const SYS_pidfd_getfd: ::c_long = __X32_SYSCALL_BIT + 438;
+pub const SYS_faccessat2: ::c_long = __X32_SYSCALL_BIT + 439;
+pub const SYS_process_madvise: ::c_long = __X32_SYSCALL_BIT + 440;
+pub const SYS_epoll_pwait2: ::c_long = __X32_SYSCALL_BIT + 441;
+pub const SYS_mount_setattr: ::c_long = __X32_SYSCALL_BIT + 442;
pub const SYS_rt_sigaction: ::c_long = __X32_SYSCALL_BIT + 512;
pub const SYS_rt_sigreturn: ::c_long = __X32_SYSCALL_BIT + 513;
pub const SYS_ioctl: ::c_long = __X32_SYSCALL_BIT + 514;
diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs
index 1d3e0ab4..09cddb9f 100644
--- a/src/unix/linux_like/linux/gnu/mod.rs
+++ b/src/unix/linux_like/linux/gnu/mod.rs
@@ -1,6 +1,8 @@
pub type pthread_t = c_ulong;
pub type __priority_which_t = ::c_uint;
pub type __rlimit_resource_t = ::c_uint;
+pub type Lmid_t = ::c_long;
+pub type regoff_t = ::c_int;
s! {
pub struct statx {
@@ -11,7 +13,7 @@ s! {
pub stx_uid: u32,
pub stx_gid: u32,
pub stx_mode: u16,
- pub __statx_pad1: [u16; 1],
+ __statx_pad1: [u16; 1],
pub stx_ino: u64,
pub stx_size: u64,
pub stx_blocks: u64,
@@ -24,7 +26,9 @@ s! {
pub stx_rdev_minor: u32,
pub stx_dev_major: u32,
pub stx_dev_minor: u32,
- pub __statx_pad2: [u64; 14],
+ pub stx_mnt_id: u64,
+ __statx_pad2: u64,
+ __statx_pad3: [u64; 12],
}
pub struct statx_timestamp {
@@ -182,6 +186,120 @@ s! {
pub rt_window: ::c_ulong,
pub rt_irtt: ::c_ushort,
}
+
+ pub struct timex {
+ pub modes: ::c_uint,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub offset: i64,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub offset: ::c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub freq: i64,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub freq: ::c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub maxerror: i64,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub maxerror: ::c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub esterror: i64,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub esterror: ::c_long,
+ pub status: ::c_int,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub constant: i64,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub constant: ::c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub precision: i64,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub precision: ::c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub tolerance: i64,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub tolerance: ::c_long,
+ pub time: ::timeval,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub tick: i64,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub tick: ::c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub ppsfreq: i64,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub ppsfreq: ::c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub jitter: i64,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub jitter: ::c_long,
+ pub shift: ::c_int,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub stabil: i64,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub stabil: ::c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub jitcnt: i64,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub jitcnt: ::c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub calcnt: i64,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub calcnt: ::c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub errcnt: i64,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub errcnt: ::c_long,
+ #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
+ pub stbcnt: i64,
+ #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
+ pub stbcnt: ::c_long,
+ pub tai: ::c_int,
+ pub __unused1: i32,
+ pub __unused2: i32,
+ pub __unused3: i32,
+ pub __unused4: i32,
+ pub __unused5: i32,
+ pub __unused6: i32,
+ pub __unused7: i32,
+ pub __unused8: i32,
+ pub __unused9: i32,
+ pub __unused10: i32,
+ pub __unused11: i32,
+ }
+
+ pub struct ntptimeval {
+ pub time: ::timeval,
+ pub maxerror: ::c_long,
+ pub esterror: ::c_long,
+ pub tai: ::c_long,
+ pub __glibc_reserved1: ::c_long,
+ pub __glibc_reserved2: ::c_long,
+ pub __glibc_reserved3: ::c_long,
+ pub __glibc_reserved4: ::c_long,
+ }
+
+ pub struct regex_t {
+ __buffer: *mut ::c_void,
+ __allocated: ::size_t,
+ __used: ::size_t,
+ __syntax: ::c_ulong,
+ __fastmap: *mut ::c_char,
+ __translate: *mut ::c_char,
+ __re_nsub: ::size_t,
+ __bitfield: u8,
+ }
+
+ pub struct Elf64_Chdr {
+ pub ch_type: ::Elf64_Word,
+ pub ch_reserved: ::Elf64_Word,
+ pub ch_size: ::Elf64_Xword,
+ pub ch_addralign: ::Elf64_Xword,
+ }
+
+ pub struct Elf32_Chdr {
+ pub ch_type: ::Elf32_Word,
+ pub ch_size: ::Elf32_Word,
+ pub ch_addralign: ::Elf32_Word,
+ }
}
impl siginfo_t {
@@ -210,6 +328,68 @@ impl siginfo_t {
}
}
+cfg_if! {
+ if #[cfg(libc_union)] {
+ // Internal, for casts to access union fields
+ #[repr(C)]
+ struct sifields_sigchld {
+ si_pid: ::pid_t,
+ si_uid: ::uid_t,
+ si_status: ::c_int,
+ si_utime: ::c_long,
+ si_stime: ::c_long,
+ }
+ impl ::Copy for sifields_sigchld {}
+ impl ::Clone for sifields_sigchld {
+ fn clone(&self) -> sifields_sigchld {
+ *self
+ }
+ }
+
+ // Internal, for casts to access union fields
+ #[repr(C)]
+ union sifields {
+ _align_pointer: *mut ::c_void,
+ sigchld: sifields_sigchld,
+ }
+
+ // Internal, for casts to access union fields. Note that some variants
+ // of sifields start with a pointer, which makes the alignment of
+ // sifields vary on 32-bit and 64-bit architectures.
+ #[repr(C)]
+ struct siginfo_f {
+ _siginfo_base: [::c_int; 3],
+ sifields: sifields,
+ }
+
+ impl siginfo_t {
+ unsafe fn sifields(&self) -> &sifields {
+ &(*(self as *const siginfo_t as *const siginfo_f)).sifields
+ }
+
+ pub unsafe fn si_pid(&self) -> ::pid_t {
+ self.sifields().sigchld.si_pid
+ }
+
+ pub unsafe fn si_uid(&self) -> ::uid_t {
+ self.sifields().sigchld.si_uid
+ }
+
+ pub unsafe fn si_status(&self) -> ::c_int {
+ self.sifields().sigchld.si_status
+ }
+
+ pub unsafe fn si_utime(&self) -> ::c_long {
+ self.sifields().sigchld.si_utime
+ }
+
+ pub unsafe fn si_stime(&self) -> ::c_long {
+ self.sifields().sigchld.si_stime
+ }
+ }
+ }
+}
+
s_no_extra_traits! {
pub struct utmpx {
pub ut_type: ::c_short,
@@ -308,6 +488,47 @@ cfg_if! {
}
}
+// include/uapi/asm-generic/hugetlb_encode.h
+pub const HUGETLB_FLAG_ENCODE_SHIFT: ::c_int = 26;
+pub const HUGETLB_FLAG_ENCODE_MASK: ::c_int = 0x3f;
+
+pub const HUGETLB_FLAG_ENCODE_64KB: ::c_int = 16 << HUGETLB_FLAG_ENCODE_SHIFT;
+pub const HUGETLB_FLAG_ENCODE_512KB: ::c_int = 19 << HUGETLB_FLAG_ENCODE_SHIFT;
+pub const HUGETLB_FLAG_ENCODE_1MB: ::c_int = 20 << HUGETLB_FLAG_ENCODE_SHIFT;
+pub const HUGETLB_FLAG_ENCODE_2MB: ::c_int = 21 << HUGETLB_FLAG_ENCODE_SHIFT;
+pub const HUGETLB_FLAG_ENCODE_8MB: ::c_int = 23 << HUGETLB_FLAG_ENCODE_SHIFT;
+pub const HUGETLB_FLAG_ENCODE_16MB: ::c_int = 24 << HUGETLB_FLAG_ENCODE_SHIFT;
+pub const HUGETLB_FLAG_ENCODE_32MB: ::c_int = 25 << HUGETLB_FLAG_ENCODE_SHIFT;
+pub const HUGETLB_FLAG_ENCODE_256MB: ::c_int = 28 << HUGETLB_FLAG_ENCODE_SHIFT;
+pub const HUGETLB_FLAG_ENCODE_512MB: ::c_int = 29 << HUGETLB_FLAG_ENCODE_SHIFT;
+pub const HUGETLB_FLAG_ENCODE_1GB: ::c_int = 30 << HUGETLB_FLAG_ENCODE_SHIFT;
+pub const HUGETLB_FLAG_ENCODE_2GB: ::c_int = 31 << HUGETLB_FLAG_ENCODE_SHIFT;
+pub const HUGETLB_FLAG_ENCODE_16GB: ::c_int = 34 << HUGETLB_FLAG_ENCODE_SHIFT;
+
+// include/uapi/linux/mman.h
+/*
+ * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
+ * size other than the default is desired. See hugetlb_encode.h.
+ * All known huge page size encodings are provided here. It is the
+ * responsibility of the application to know which sizes are supported on
+ * the running system. See mmap(2) man page for details.
+ */
+pub const MAP_HUGE_SHIFT: ::c_int = HUGETLB_FLAG_ENCODE_SHIFT;
+pub const MAP_HUGE_MASK: ::c_int = HUGETLB_FLAG_ENCODE_MASK;
+
+pub const MAP_HUGE_64KB: ::c_int = HUGETLB_FLAG_ENCODE_64KB;
+pub const MAP_HUGE_512KB: ::c_int = HUGETLB_FLAG_ENCODE_512KB;
+pub const MAP_HUGE_1MB: ::c_int = HUGETLB_FLAG_ENCODE_1MB;
+pub const MAP_HUGE_2MB: ::c_int = HUGETLB_FLAG_ENCODE_2MB;
+pub const MAP_HUGE_8MB: ::c_int = HUGETLB_FLAG_ENCODE_8MB;
+pub const MAP_HUGE_16MB: ::c_int = HUGETLB_FLAG_ENCODE_16MB;
+pub const MAP_HUGE_32MB: ::c_int = HUGETLB_FLAG_ENCODE_32MB;
+pub const MAP_HUGE_256MB: ::c_int = HUGETLB_FLAG_ENCODE_256MB;
+pub const MAP_HUGE_512MB: ::c_int = HUGETLB_FLAG_ENCODE_512MB;
+pub const MAP_HUGE_1GB: ::c_int = HUGETLB_FLAG_ENCODE_1GB;
+pub const MAP_HUGE_2GB: ::c_int = HUGETLB_FLAG_ENCODE_2GB;
+pub const MAP_HUGE_16GB: ::c_int = HUGETLB_FLAG_ENCODE_16GB;
+
pub const RLIMIT_CPU: ::__rlimit_resource_t = 0;
pub const RLIMIT_FSIZE: ::__rlimit_resource_t = 1;
pub const RLIMIT_DATA: ::__rlimit_resource_t = 2;
@@ -321,6 +542,10 @@ pub const RLIMIT_RTPRIO: ::__rlimit_resource_t = 14;
pub const RLIMIT_RTTIME: ::__rlimit_resource_t = 15;
pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = 16;
+pub const PRIO_PROCESS: ::__priority_which_t = 0;
+pub const PRIO_PGRP: ::__priority_which_t = 1;
+pub const PRIO_USER: ::__priority_which_t = 2;
+
pub const MS_RMT_MASK: ::c_ulong = 0x02800051;
pub const __UT_LINESIZE: usize = 32;
@@ -337,6 +562,21 @@ pub const USER_PROCESS: ::c_short = 7;
pub const DEAD_PROCESS: ::c_short = 8;
pub const ACCOUNTING: ::c_short = 9;
+// dlfcn.h
+pub const LM_ID_BASE: ::c_long = 0;
+pub const LM_ID_NEWLM: ::c_long = -1;
+
+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 SOCK_NONBLOCK: ::c_int = O_NONBLOCK;
pub const SOL_RXRPC: ::c_int = 272;
@@ -356,12 +596,12 @@ 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_PAPER_MASK: ::c_int = (1 << LC_PAPER);
-pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME);
-pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS);
-pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE);
-pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT);
-pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION);
+pub const LC_PAPER_MASK: ::c_int = 1 << LC_PAPER;
+pub const LC_NAME_MASK: ::c_int = 1 << LC_NAME;
+pub const LC_ADDRESS_MASK: ::c_int = 1 << LC_ADDRESS;
+pub const LC_TELEPHONE_MASK: ::c_int = 1 << LC_TELEPHONE;
+pub const LC_MEASUREMENT_MASK: ::c_int = 1 << LC_MEASUREMENT;
+pub const LC_IDENTIFICATION_MASK: ::c_int = 1 << LC_IDENTIFICATION;
pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK
| ::LC_NUMERIC_MASK
| ::LC_TIME_MASK
@@ -375,9 +615,6 @@ pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK
| LC_MEASUREMENT_MASK
| LC_IDENTIFICATION_MASK;
-pub const MAP_SHARED_VALIDATE: ::c_int = 0x3;
-pub const MAP_FIXED_NOREPLACE: ::c_int = 0x100000;
-
pub const ENOTSUP: ::c_int = EOPNOTSUPP;
pub const SOCK_SEQPACKET: ::c_int = 5;
@@ -394,6 +631,23 @@ 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_FASTOPEN_CONNECT: ::c_int = 30;
+
+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;
+pub const AF_VSOCK: ::c_int = 40;
+pub const AF_XDP: ::c_int = 44;
+pub const PF_IB: ::c_int = AF_IB;
+pub const PF_MPLS: ::c_int = AF_MPLS;
+pub const PF_NFC: ::c_int = AF_NFC;
+pub const PF_VSOCK: ::c_int = AF_VSOCK;
+pub const PF_XDP: ::c_int = AF_XDP;
/* DCCP socket options */
pub const DCCP_SOCKOPT_PACKET_SIZE: ::c_int = 1;
@@ -421,6 +675,7 @@ pub const SIGEV_THREAD_ID: ::c_int = 4;
pub const BUFSIZ: ::c_uint = 8192;
pub const TMP_MAX: ::c_uint = 238328;
pub const FOPEN_MAX: ::c_uint = 16;
+pub const FILENAME_MAX: ::c_uint = 4096;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41;
pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45;
@@ -501,32 +756,117 @@ pub const O_ACCMODE: ::c_int = 3;
pub const ST_RELATIME: ::c_ulong = 4096;
pub const NI_MAXHOST: ::socklen_t = 1025;
-pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
-pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
-pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
-pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
-pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
-pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
-pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
-pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
-pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
-pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
-pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
-pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
-pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
-pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
-pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
-pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
-pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
-pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
-pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
-pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
-pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
-pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
-pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
-pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
-pub const TMPFS_MAGIC: ::c_long = 0x01021994;
-pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
+cfg_if! {
+ if #[cfg(not(target_arch = "s390x"))] {
+ pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
+ pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
+ pub const AFS_SUPER_MAGIC: ::c_long = 0x5346414f;
+ pub const AUTOFS_SUPER_MAGIC: ::c_long = 0x0187;
+ pub const BINDERFS_SUPER_MAGIC: ::c_long = 0x6c6f6f70;
+ pub const BPF_FS_MAGIC: ::c_long = 0xcafe4a11;
+ pub const BTRFS_SUPER_MAGIC: ::c_long = 0x9123683e;
+ pub const CGROUP2_SUPER_MAGIC: ::c_long = 0x63677270;
+ pub const CGROUP_SUPER_MAGIC: ::c_long = 0x27e0eb;
+ pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
+ pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
+ pub const DEBUGFS_MAGIC: ::c_long = 0x64626720;
+ pub const DEVPTS_SUPER_MAGIC: ::c_long = 0x1cd1;
+ pub const ECRYPTFS_SUPER_MAGIC: ::c_long = 0xf15f;
+ pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
+ pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
+ pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
+ pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
+ pub const F2FS_SUPER_MAGIC: ::c_long = 0xf2f52010;
+ pub const FUTEXFS_SUPER_MAGIC: ::c_long = 0xbad1dea;
+ pub const HOSTFS_SUPER_MAGIC: ::c_long = 0x00c0ffee;
+ pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
+ pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
+ pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
+ pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
+ pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
+ pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
+ pub const MINIX3_SUPER_MAGIC: ::c_long = 0x4d5a;
+ pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
+ pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
+ pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
+ pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
+ pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
+ pub const NILFS_SUPER_MAGIC: ::c_long = 0x3434;
+ pub const OCFS2_SUPER_MAGIC: ::c_long = 0x7461636f;
+ pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
+ pub const OVERLAYFS_SUPER_MAGIC: ::c_long = 0x794c7630;
+ pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
+ pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
+ pub const QNX6_SUPER_MAGIC: ::c_long = 0x68191122;
+ pub const RDTGROUP_SUPER_MAGIC: ::c_long = 0x7655821;
+ pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
+ pub const SECURITYFS_MAGIC: ::c_long = 0x73636673;
+ pub const SELINUX_MAGIC: ::c_long = 0xf97cff8c;
+ pub const SMACK_MAGIC: ::c_long = 0x43415d53;
+ pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
+ pub const SYSFS_MAGIC: ::c_long = 0x62656572;
+ pub const TMPFS_MAGIC: ::c_long = 0x01021994;
+ pub const TRACEFS_MAGIC: ::c_long = 0x74726163;
+ pub const UDF_SUPER_MAGIC: ::c_long = 0x15013346;
+ pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
+ pub const XENFS_SUPER_MAGIC: ::c_long = 0xabba1974;
+ pub const XFS_SUPER_MAGIC: ::c_long = 0x58465342;
+ } else if #[cfg(target_arch = "s390x")] {
+ pub const ADFS_SUPER_MAGIC: ::c_uint = 0x0000adf5;
+ pub const AFFS_SUPER_MAGIC: ::c_uint = 0x0000adff;
+ pub const AFS_SUPER_MAGIC: ::c_uint = 0x5346414f;
+ pub const AUTOFS_SUPER_MAGIC: ::c_uint = 0x0187;
+ pub const BINDERFS_SUPER_MAGIC: ::c_uint = 0x6c6f6f70;
+ pub const BPF_FS_MAGIC: ::c_uint = 0xcafe4a11;
+ pub const BTRFS_SUPER_MAGIC: ::c_uint = 0x9123683e;
+ pub const CGROUP2_SUPER_MAGIC: ::c_uint = 0x63677270;
+ pub const CGROUP_SUPER_MAGIC: ::c_uint = 0x27e0eb;
+ pub const CODA_SUPER_MAGIC: ::c_uint = 0x73757245;
+ pub const CRAMFS_MAGIC: ::c_uint = 0x28cd3d45;
+ pub const DEBUGFS_MAGIC: ::c_uint = 0x64626720;
+ pub const DEVPTS_SUPER_MAGIC: ::c_uint = 0x1cd1;
+ pub const ECRYPTFS_SUPER_MAGIC: ::c_uint = 0xf15f;
+ pub const EFS_SUPER_MAGIC: ::c_uint = 0x00414a53;
+ pub const EXT2_SUPER_MAGIC: ::c_uint = 0x0000ef53;
+ pub const EXT3_SUPER_MAGIC: ::c_uint = 0x0000ef53;
+ pub const EXT4_SUPER_MAGIC: ::c_uint = 0x0000ef53;
+ pub const F2FS_SUPER_MAGIC: ::c_uint = 0xf2f52010;
+ pub const FUTEXFS_SUPER_MAGIC: ::c_uint = 0xbad1dea;
+ pub const HOSTFS_SUPER_MAGIC: ::c_uint = 0x00c0ffee;
+ pub const HPFS_SUPER_MAGIC: ::c_uint = 0xf995e849;
+ pub const HUGETLBFS_MAGIC: ::c_uint = 0x958458f6;
+ pub const ISOFS_SUPER_MAGIC: ::c_uint = 0x00009660;
+ pub const JFFS2_SUPER_MAGIC: ::c_uint = 0x000072b6;
+ pub const MINIX2_SUPER_MAGIC2: ::c_uint = 0x00002478;
+ pub const MINIX2_SUPER_MAGIC: ::c_uint = 0x00002468;
+ pub const MINIX3_SUPER_MAGIC: ::c_uint = 0x4d5a;
+ pub const MINIX_SUPER_MAGIC2: ::c_uint = 0x0000138f;
+ pub const MINIX_SUPER_MAGIC: ::c_uint = 0x0000137f;
+ pub const MSDOS_SUPER_MAGIC: ::c_uint = 0x00004d44;
+ pub const NCP_SUPER_MAGIC: ::c_uint = 0x0000564c;
+ pub const NFS_SUPER_MAGIC: ::c_uint = 0x00006969;
+ pub const NILFS_SUPER_MAGIC: ::c_uint = 0x3434;
+ pub const OCFS2_SUPER_MAGIC: ::c_uint = 0x7461636f;
+ pub const OPENPROM_SUPER_MAGIC: ::c_uint = 0x00009fa1;
+ pub const OVERLAYFS_SUPER_MAGIC: ::c_uint = 0x794c7630;
+ pub const PROC_SUPER_MAGIC: ::c_uint = 0x00009fa0;
+ pub const QNX4_SUPER_MAGIC: ::c_uint = 0x0000002f;
+ pub const QNX6_SUPER_MAGIC: ::c_uint = 0x68191122;
+ pub const RDTGROUP_SUPER_MAGIC: ::c_uint = 0x7655821;
+ pub const REISERFS_SUPER_MAGIC: ::c_uint = 0x52654973;
+ pub const SECURITYFS_MAGIC: ::c_uint = 0x73636673;
+ pub const SELINUX_MAGIC: ::c_uint = 0xf97cff8c;
+ pub const SMACK_MAGIC: ::c_uint = 0x43415d53;
+ pub const SMB_SUPER_MAGIC: ::c_uint = 0x0000517b;
+ pub const SYSFS_MAGIC: ::c_uint = 0x62656572;
+ pub const TMPFS_MAGIC: ::c_uint = 0x01021994;
+ pub const TRACEFS_MAGIC: ::c_uint = 0x74726163;
+ pub const UDF_SUPER_MAGIC: ::c_uint = 0x15013346;
+ pub const USBDEVICE_SUPER_MAGIC: ::c_uint = 0x00009fa2;
+ pub const XENFS_SUPER_MAGIC: ::c_uint = 0xabba1974;
+ pub const XFS_SUPER_MAGIC: ::c_uint = 0x58465342;
+ }
+}
pub const CPU_SETSIZE: ::c_int = 0x400;
@@ -553,25 +893,14 @@ pub const PTRACE_INTERRUPT: ::c_uint = 0x4207;
pub const PTRACE_LISTEN: ::c_uint = 0x4208;
pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209;
-pub const EPOLLWAKEUP: ::c_int = 0x20000000;
-
-pub const SEEK_DATA: ::c_int = 3;
-pub const SEEK_HOLE: ::c_int = 4;
+// linux/fs.h
-pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead;
-pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793;
-pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278;
-pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448;
-pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216;
-
-pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567;
-pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123;
-pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF;
-pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000;
-pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC;
-pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4;
-pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2;
-pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
+// Flags for preadv2/pwritev2
+pub const RWF_HIPRI: ::c_int = 0x00000001;
+pub const RWF_DSYNC: ::c_int = 0x00000002;
+pub const RWF_SYNC: ::c_int = 0x00000004;
+pub const RWF_NOWAIT: ::c_int = 0x00000008;
+pub const RWF_APPEND: ::c_int = 0x00000010;
// linux/rtnetlink.h
pub const TCA_PAD: ::c_ushort = 9;
@@ -605,6 +934,10 @@ pub const NDA_MASTER: ::c_ushort = 9;
pub const NDA_LINK_NETNSID: ::c_ushort = 10;
pub const NDA_SRC_VNI: ::c_ushort = 11;
+// linux/personality.h
+pub const UNAME26: ::c_int = 0x0020000;
+pub const FDPIC_FUNCPTRS: ::c_int = 0x0080000;
+
// linux/if_addr.h
pub const IFA_FLAGS: ::c_ushort = 8;
@@ -632,6 +965,37 @@ pub const NF_NETDEV_NUMHOOKS: ::c_int = 1;
pub const NFPROTO_INET: ::c_int = 1;
pub const NFPROTO_NETDEV: ::c_int = 5;
+// linux/keyctl.h
+pub const KEYCTL_DH_COMPUTE: u32 = 23;
+pub const KEYCTL_PKEY_QUERY: u32 = 24;
+pub const KEYCTL_PKEY_ENCRYPT: u32 = 25;
+pub const KEYCTL_PKEY_DECRYPT: u32 = 26;
+pub const KEYCTL_PKEY_SIGN: u32 = 27;
+pub const KEYCTL_PKEY_VERIFY: u32 = 28;
+pub const KEYCTL_RESTRICT_KEYRING: u32 = 29;
+
+pub const KEYCTL_SUPPORTS_ENCRYPT: u32 = 0x01;
+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")))] {
+ pub const KEYCTL_MOVE: u32 = 30;
+ pub const KEYCTL_CAPABILITIES: u32 = 31;
+
+ pub const KEYCTL_CAPS0_CAPABILITIES: u32 = 0x01;
+ pub const KEYCTL_CAPS0_PERSISTENT_KEYRINGS: u32 = 0x02;
+ pub const KEYCTL_CAPS0_DIFFIE_HELLMAN: u32 = 0x04;
+ pub const KEYCTL_CAPS0_PUBLIC_KEY: u32 = 0x08;
+ pub const KEYCTL_CAPS0_BIG_KEY: u32 = 0x10;
+ pub const KEYCTL_CAPS0_INVALIDATE: u32 = 0x20;
+ pub const KEYCTL_CAPS0_RESTRICT_KEYRING: u32 = 0x40;
+ pub const KEYCTL_CAPS0_MOVE: u32 = 0x80;
+ pub const KEYCTL_CAPS1_NS_KEYRING_NAME: u32 = 0x01;
+ pub const KEYCTL_CAPS1_NS_KEY_TAG: u32 = 0x02;
+ }
+}
+
// linux/netfilter/nf_tables.h
pub const NFT_TABLE_MAXNAMELEN: ::c_int = 256;
pub const NFT_CHAIN_MAXNAMELEN: ::c_int = 256;
@@ -731,12 +1095,12 @@ pub const NFT_CMP_GTE: ::c_int = 5;
pub const NFT_RANGE_EQ: ::c_int = 0;
pub const NFT_RANGE_NEQ: ::c_int = 1;
-pub const NFT_LOOKUP_F_INV: ::c_int = (1 << 0);
+pub const NFT_LOOKUP_F_INV: ::c_int = 1 << 0;
pub const NFT_DYNSET_OP_ADD: ::c_int = 0;
pub const NFT_DYNSET_OP_UPDATE: ::c_int = 1;
-pub const NFT_DYNSET_F_INV: ::c_int = (1 << 0);
+pub const NFT_DYNSET_F_INV: ::c_int = 1 << 0;
pub const NFT_PAYLOAD_LL_HEADER: ::c_int = 0;
pub const NFT_PAYLOAD_NETWORK_HEADER: ::c_int = 1;
@@ -791,13 +1155,13 @@ pub const NFT_CT_BYTES: ::c_int = 15;
pub const NFT_LIMIT_PKTS: ::c_int = 0;
pub const NFT_LIMIT_PKT_BYTES: ::c_int = 1;
-pub const NFT_LIMIT_F_INV: ::c_int = (1 << 0);
+pub const NFT_LIMIT_F_INV: ::c_int = 1 << 0;
pub const NFT_QUEUE_FLAG_BYPASS: ::c_int = 0x01;
pub const NFT_QUEUE_FLAG_CPU_FANOUT: ::c_int = 0x02;
pub const NFT_QUEUE_FLAG_MASK: ::c_int = 0x03;
-pub const NFT_QUOTA_F_INV: ::c_int = (1 << 0);
+pub const NFT_QUOTA_F_INV: ::c_int = 1 << 0;
pub const NFT_REJECT_ICMP_UNREACH: ::c_int = 0;
pub const NFT_REJECT_TCP_RST: ::c_int = 1;
@@ -849,6 +1213,7 @@ pub const STATX_SIZE: ::c_uint = 0x0200;
pub const STATX_BLOCKS: ::c_uint = 0x0400;
pub const STATX_BASIC_STATS: ::c_uint = 0x07ff;
pub const STATX_BTIME: ::c_uint = 0x0800;
+pub const STATX_MNT_ID: ::c_uint = 0x1000;
pub const STATX_ALL: ::c_uint = 0x0fff;
pub const STATX__RESERVED: ::c_int = 0x80000000;
pub const STATX_ATTR_COMPRESSED: ::c_int = 0x0004;
@@ -858,12 +1223,73 @@ pub const STATX_ATTR_NODUMP: ::c_int = 0x0040;
pub const STATX_ATTR_ENCRYPTED: ::c_int = 0x0800;
pub const STATX_ATTR_AUTOMOUNT: ::c_int = 0x1000;
+//sys/timex.h
+pub const ADJ_OFFSET: ::c_uint = 0x0001;
+pub const ADJ_FREQUENCY: ::c_uint = 0x0002;
+pub const ADJ_MAXERROR: ::c_uint = 0x0004;
+pub const ADJ_ESTERROR: ::c_uint = 0x0008;
+pub const ADJ_STATUS: ::c_uint = 0x0010;
+pub const ADJ_TIMECONST: ::c_uint = 0x0020;
+pub const ADJ_TAI: ::c_uint = 0x0080;
+pub const ADJ_SETOFFSET: ::c_uint = 0x0100;
+pub const ADJ_MICRO: ::c_uint = 0x1000;
+pub const ADJ_NANO: ::c_uint = 0x2000;
+pub const ADJ_TICK: ::c_uint = 0x4000;
+pub const ADJ_OFFSET_SINGLESHOT: ::c_uint = 0x8001;
+pub const ADJ_OFFSET_SS_READ: ::c_uint = 0xa001;
+pub const MOD_OFFSET: ::c_uint = ADJ_OFFSET;
+pub const MOD_FREQUENCY: ::c_uint = ADJ_FREQUENCY;
+pub const MOD_MAXERROR: ::c_uint = ADJ_MAXERROR;
+pub const MOD_ESTERROR: ::c_uint = ADJ_ESTERROR;
+pub const MOD_STATUS: ::c_uint = ADJ_STATUS;
+pub const MOD_TIMECONST: ::c_uint = ADJ_TIMECONST;
+pub const MOD_CLKB: ::c_uint = ADJ_TICK;
+pub const MOD_CLKA: ::c_uint = ADJ_OFFSET_SINGLESHOT;
+pub const MOD_TAI: ::c_uint = ADJ_TAI;
+pub const MOD_MICRO: ::c_uint = ADJ_MICRO;
+pub const MOD_NANO: ::c_uint = ADJ_NANO;
+pub const STA_PLL: ::c_int = 0x0001;
+pub const STA_PPSFREQ: ::c_int = 0x0002;
+pub const STA_PPSTIME: ::c_int = 0x0004;
+pub const STA_FLL: ::c_int = 0x0008;
+pub const STA_INS: ::c_int = 0x0010;
+pub const STA_DEL: ::c_int = 0x0020;
+pub const STA_UNSYNC: ::c_int = 0x0040;
+pub const STA_FREQHOLD: ::c_int = 0x0080;
+pub const STA_PPSSIGNAL: ::c_int = 0x0100;
+pub const STA_PPSJITTER: ::c_int = 0x0200;
+pub const STA_PPSWANDER: ::c_int = 0x0400;
+pub const STA_PPSERROR: ::c_int = 0x0800;
+pub const STA_CLOCKERR: ::c_int = 0x1000;
+pub const STA_NANO: ::c_int = 0x2000;
+pub const STA_MODE: ::c_int = 0x4000;
+pub const STA_CLK: ::c_int = 0x8000;
+pub const STA_RONLY: ::c_int = STA_PPSSIGNAL
+ | STA_PPSJITTER
+ | STA_PPSWANDER
+ | STA_PPSERROR
+ | STA_CLOCKERR
+ | STA_NANO
+ | STA_MODE
+ | STA_CLK;
+pub const NTP_API: ::c_int = 4;
+pub const TIME_OK: ::c_int = 0;
+pub const TIME_INS: ::c_int = 1;
+pub const TIME_DEL: ::c_int = 2;
+pub const TIME_OOP: ::c_int = 3;
+pub const TIME_WAIT: ::c_int = 4;
+pub const TIME_ERROR: ::c_int = 5;
+pub const TIME_BAD: ::c_int = TIME_ERROR;
+pub const MAXTC: ::c_long = 6;
+
cfg_if! {
if #[cfg(any(
target_arch = "arm",
target_arch = "x86",
target_arch = "x86_64",
- target_arch = "s390x"
+ target_arch = "s390x",
+ target_arch = "riscv64",
+ target_arch = "riscv32"
))] {
pub const PTHREAD_STACK_MIN: ::size_t = 16384;
} else if #[cfg(any(
@@ -877,7 +1303,42 @@ cfg_if! {
}
pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 3;
+pub const REG_STARTEND: ::c_int = 4;
+
+pub const REG_EEND: ::c_int = 14;
+pub const REG_ESIZE: ::c_int = 15;
+pub const REG_ERPAREN: ::c_int = 16;
+
extern "C" {
+ pub fn fgetspent_r(
+ fp: *mut ::FILE,
+ spbuf: *mut ::spwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ spbufp: *mut *mut ::spwd,
+ ) -> ::c_int;
+ pub fn sgetspent_r(
+ s: *const ::c_char,
+ spbuf: *mut ::spwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ spbufp: *mut *mut ::spwd,
+ ) -> ::c_int;
+ pub fn getspent_r(
+ spbuf: *mut ::spwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ spbufp: *mut *mut ::spwd,
+ ) -> ::c_int;
+ pub fn qsort_r(
+ base: *mut ::c_void,
+ num: ::size_t,
+ size: ::size_t,
+ compar: ::Option<
+ unsafe extern "C" fn(*const ::c_void, *const ::c_void, *mut ::c_void) -> ::c_int,
+ >,
+ arg: *mut ::c_void,
+ );
pub fn sendmmsg(
sockfd: ::c_int,
msgvec: *mut ::mmsghdr,
@@ -892,22 +1353,10 @@ extern "C" {
timeout: *mut ::timespec,
) -> ::c_int;
- pub fn getrlimit64(
- resource: ::__rlimit_resource_t,
- rlim: *mut ::rlimit64,
- ) -> ::c_int;
- pub fn setrlimit64(
- resource: ::__rlimit_resource_t,
- rlim: *const ::rlimit64,
- ) -> ::c_int;
- pub fn getrlimit(
- resource: ::__rlimit_resource_t,
- rlim: *mut ::rlimit,
- ) -> ::c_int;
- pub fn setrlimit(
- resource: ::__rlimit_resource_t,
- rlim: *const ::rlimit,
- ) -> ::c_int;
+ pub fn getrlimit64(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit64) -> ::c_int;
+ pub fn setrlimit64(resource: ::__rlimit_resource_t, rlim: *const ::rlimit64) -> ::c_int;
+ pub fn getrlimit(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit) -> ::c_int;
+ pub fn setrlimit(resource: ::__rlimit_resource_t, rlim: *const ::rlimit) -> ::c_int;
pub fn prlimit(
pid: ::pid_t,
resource: ::__rlimit_resource_t,
@@ -938,23 +1387,65 @@ extern "C" {
mask: ::c_uint,
statxbuf: *mut statx,
) -> ::c_int;
- pub fn getrandom(
- buf: *mut ::c_void,
- buflen: ::size_t,
+ pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
+
+ pub fn memmem(
+ haystack: *const ::c_void,
+ haystacklen: ::size_t,
+ needle: *const ::c_void,
+ needlelen: ::size_t,
+ ) -> *mut ::c_void;
+ pub fn getauxval(type_: ::c_ulong) -> ::c_ulong;
+
+ pub fn adjtimex(buf: *mut timex) -> ::c_int;
+ pub fn ntp_adjtime(buf: *mut timex) -> ::c_int;
+ #[link_name = "ntp_gettimex"]
+ pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int;
+ pub fn copy_file_range(
+ fd_in: ::c_int,
+ off_in: *mut ::off64_t,
+ fd_out: ::c_int,
+ off_out: *mut ::off64_t,
+ len: ::size_t,
+ flags: ::c_uint,
+ ) -> ::ssize_t;
+ pub fn fanotify_mark(
+ fd: ::c_int,
flags: ::c_uint,
+ mask: u64,
+ dirfd: ::c_int,
+ path: *const ::c_char,
+ ) -> ::c_int;
+ pub fn preadv2(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t,
+ flags: ::c_int,
) -> ::ssize_t;
+ pub fn pwritev2(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t,
+ flags: ::c_int,
+ ) -> ::ssize_t;
+ pub fn renameat2(
+ olddirfd: ::c_int,
+ oldpath: *const ::c_char,
+ newdirfd: ::c_int,
+ newpath: *const ::c_char,
+ flags: ::c_uint,
+ ) -> ::c_int;
}
-#[link(name = "util")]
extern "C" {
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int;
pub fn glob64(
pattern: *const ::c_char,
flags: ::c_int,
- errfunc: ::Option<
- extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int,
- >,
+ errfunc: ::Option<extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>,
pglob: *mut glob64_t,
) -> ::c_int;
pub fn globfree64(pglob: *mut glob64_t);
@@ -970,11 +1461,7 @@ extern "C" {
cpuset: *const ::cpu_set_t,
) -> ::c_int;
pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int;
- pub fn setpriority(
- which: ::__priority_which_t,
- who: ::id_t,
- prio: ::c_int,
- ) -> ::c_int;
+ pub fn setpriority(which: ::__priority_which_t, who: ::id_t, prio: ::c_int) -> ::c_int;
pub fn pthread_getaffinity_np(
thread: ::pthread_t,
cpusetsize: ::size_t,
@@ -996,32 +1483,25 @@ extern "C" {
pub fn sched_getcpu() -> ::c_int;
pub fn mallinfo() -> ::mallinfo;
pub fn malloc_usable_size(ptr: *mut ::c_void) -> ::size_t;
- pub fn getauxval(type_: ::c_ulong) -> ::c_ulong;
- #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwent_r")]
pub fn getpwent_r(
pwd: *mut ::passwd,
buf: *mut ::c_char,
buflen: ::size_t,
result: *mut *mut ::passwd,
) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__getgrent_r50")]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrent_r")]
pub fn getgrent_r(
grp: *mut ::group,
buf: *mut ::c_char,
buflen: ::size_t,
result: *mut *mut ::group,
) -> ::c_int;
- pub fn pthread_getname_np(
- thread: ::pthread_t,
- name: *mut ::c_char,
- len: ::size_t,
- ) -> ::c_int;
- pub fn pthread_setname_np(
- thread: ::pthread_t,
- name: *const ::c_char,
- ) -> ::c_int;
+ pub fn pthread_getname_np(thread: ::pthread_t, name: *mut ::c_char, len: ::size_t) -> ::c_int;
+ pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;
+}
+
+extern "C" {
+ pub fn dlmopen(lmid: Lmid_t, filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
+ pub fn dlinfo(handle: *mut ::c_void, request: ::c_int, info: *mut ::c_void) -> ::c_int;
}
cfg_if! {
@@ -1029,7 +1509,8 @@ cfg_if! {
target_arch = "arm",
target_arch = "mips",
target_arch = "powerpc",
- target_arch = "sparc"))] {
+ target_arch = "sparc",
+ target_arch = "riscv32"))] {
mod b32;
pub use self::b32::*;
} else if #[cfg(any(target_arch = "x86_64",
diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs
index 80505ff8..38e89d3e 100644
--- a/src/unix/linux_like/linux/mod.rs
+++ b/src/unix/linux_like/linux/mod.rs
@@ -36,8 +36,14 @@ pub type Elf64_Sxword = i64;
pub type Elf32_Section = u16;
pub type Elf64_Section = u16;
+// linux/can.h
+pub type canid_t = u32;
+pub type can_err_mask_t = u32;
+
+pub type iconv_t = *mut ::c_void;
+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
-pub enum fpos64_t {} // TODO: fill this out with a struct
+pub enum fpos64_t {} // FIXME: fill this out with a struct
impl ::Copy for fpos64_t {}
impl ::Clone for fpos64_t {
fn clone(&self) -> fpos64_t {
@@ -278,6 +284,24 @@ s! {
pub u: [u32; 7],
}
+ pub struct uinput_ff_upload {
+ pub request_id: ::__u32,
+ pub retval: ::__s32,
+ pub effect: ff_effect,
+ pub old: ff_effect,
+ }
+
+ pub struct uinput_ff_erase {
+ pub request_id: ::__u32,
+ pub retval: ::__s32,
+ pub effect_id: ::__u32,
+ }
+
+ pub struct uinput_abs_setup {
+ pub code: ::__u16,
+ pub absinfo: input_absinfo,
+ }
+
pub struct dl_phdr_info {
#[cfg(target_pointer_width = "64")]
pub dlpi_addr: Elf64_Addr,
@@ -296,9 +320,18 @@ s! {
#[cfg(target_pointer_width = "32")]
pub dlpi_phnum: Elf32_Half,
+ // As of uClibc 1.0.36, the following fields are
+ // gated behind a "#if 0" block which always evaluates
+ // to false. So I'm just removing these, and if uClibc changes
+ // the #if block in the future to include the following fields, these
+ // will probably need including here. tsidea, skrap
+ #[cfg(not(target_env = "uclibc"))]
pub dlpi_adds: ::c_ulonglong,
+ #[cfg(not(target_env = "uclibc"))]
pub dlpi_subs: ::c_ulonglong,
+ #[cfg(not(target_env = "uclibc"))]
pub dlpi_tls_modid: ::size_t,
+ #[cfg(not(target_env = "uclibc"))]
pub dlpi_tls_data: *mut ::c_void,
}
@@ -402,19 +435,6 @@ s! {
pub sh_entsize: Elf64_Xword,
}
- pub struct Elf32_Chdr {
- pub ch_type: Elf32_Word,
- pub ch_size: Elf32_Word,
- pub ch_addralign: Elf32_Word,
- }
-
- pub struct Elf64_Chdr {
- pub ch_type: Elf64_Word,
- pub ch_reserved: Elf64_Word,
- pub ch_size: Elf64_Xword,
- pub ch_addralign: Elf64_Xword,
- }
-
pub struct ucred {
pub pid: ::pid_t,
pub uid: ::uid_t,
@@ -477,6 +497,11 @@ s! {
pub len: u32
}
+ pub struct fanotify_response {
+ pub fd: ::c_int,
+ pub response: __u32,
+ }
+
pub struct sockaddr_vm {
pub svm_family: ::sa_family_t,
pub svm_reserved1: ::c_ushort,
@@ -484,6 +509,38 @@ s! {
pub svm_cid: ::c_uint,
pub svm_zero: [u8; 4]
}
+
+ pub struct regmatch_t {
+ pub rm_so: regoff_t,
+ pub rm_eo: regoff_t,
+ }
+
+ pub struct sock_extended_err {
+ pub ee_errno: u32,
+ pub ee_origin: u8,
+ pub ee_type: u8,
+ pub ee_code: u8,
+ pub ee_pad: u8,
+ pub ee_info: u32,
+ pub ee_data: u32,
+ }
+
+ // linux/can.h
+ pub struct __c_anonymous_sockaddr_can_tp {
+ pub rx_id: canid_t,
+ pub tx_id: canid_t,
+ }
+
+ pub struct __c_anonymous_sockaddr_can_j1939 {
+ pub name: u64,
+ pub pgn: u32,
+ pub addr: u8,
+ }
+
+ pub struct can_filter {
+ pub can_id: canid_t,
+ pub can_mask: canid_t,
+ }
}
s_no_extra_traits! {
@@ -518,6 +575,29 @@ s_no_extra_traits! {
pub salg_name: [::c_uchar; 64],
}
+ pub struct uinput_setup {
+ pub id: input_id,
+ pub name: [::c_char; UINPUT_MAX_NAME_SIZE],
+ pub ff_effects_max: ::__u32,
+ }
+
+ pub struct uinput_user_dev {
+ pub name: [::c_char; UINPUT_MAX_NAME_SIZE],
+ pub id: input_id,
+ pub ff_effects_max: ::__u32,
+ pub absmax: [::__s32; ABS_CNT],
+ pub absmin: [::__s32; ABS_CNT],
+ pub absfuzz: [::__s32; ABS_CNT],
+ pub absflat: [::__s32; ABS_CNT],
+ }
+
+ /// WARNING: The `PartialEq`, `Eq` and `Hash` implementations of this
+ /// type are unsound and will be removed in the future.
+ #[deprecated(
+ note = "this struct has unsafe trait implementations that will be \
+ removed in the future",
+ since = "0.2.80"
+ )]
pub struct af_alg_iv {
pub ivlen: u32,
pub iv: [::c_uchar; 0],
@@ -551,6 +631,26 @@ s_no_extra_traits! {
}
cfg_if! {
+ if #[cfg(libc_union)] {
+ s_no_extra_traits! {
+ // linux/can.h
+ #[allow(missing_debug_implementations)]
+ pub union __c_anonymous_sockaddr_can_can_addr {
+ pub tp: __c_anonymous_sockaddr_can_tp,
+ pub j1939: __c_anonymous_sockaddr_can_j1939,
+ }
+
+ #[allow(missing_debug_implementations)]
+ pub struct sockaddr_can {
+ pub can_family: ::sa_family_t,
+ pub can_ifindex: ::c_int,
+ pub can_addr: __c_anonymous_sockaddr_can_can_addr,
+ }
+ }
+ }
+}
+
+cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for sockaddr_nl {
fn eq(&self, other: &sockaddr_nl) -> bool {
@@ -761,6 +861,73 @@ cfg_if! {
}
}
+ impl PartialEq for uinput_setup {
+ fn eq(&self, other: &uinput_setup) -> bool {
+ self.id == other.id
+ && self.name[..] == other.name[..]
+ && self.ff_effects_max == other.ff_effects_max
+ }
+ }
+ impl Eq for uinput_setup {}
+
+ impl ::fmt::Debug for uinput_setup {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("uinput_setup")
+ .field("id", &self.id)
+ .field("name", &&self.name[..])
+ .field("ff_effects_max", &self.ff_effects_max)
+ .finish()
+ }
+ }
+
+ impl ::hash::Hash for uinput_setup {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.id.hash(state);
+ self.name.hash(state);
+ self.ff_effects_max.hash(state);
+ }
+ }
+
+ impl PartialEq for uinput_user_dev {
+ fn eq(&self, other: &uinput_user_dev) -> bool {
+ self.name[..] == other.name[..]
+ && self.id == other.id
+ && self.ff_effects_max == other.ff_effects_max
+ && self.absmax[..] == other.absmax[..]
+ && self.absmin[..] == other.absmin[..]
+ && self.absfuzz[..] == other.absfuzz[..]
+ && self.absflat[..] == other.absflat[..]
+ }
+ }
+ impl Eq for uinput_user_dev {}
+
+ impl ::fmt::Debug for uinput_user_dev {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("uinput_setup")
+ .field("name", &&self.name[..])
+ .field("id", &self.id)
+ .field("ff_effects_max", &self.ff_effects_max)
+ .field("absmax", &&self.absmax[..])
+ .field("absmin", &&self.absmin[..])
+ .field("absfuzz", &&self.absfuzz[..])
+ .field("absflat", &&self.absflat[..])
+ .finish()
+ }
+ }
+
+ impl ::hash::Hash for uinput_user_dev {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.name.hash(state);
+ self.id.hash(state);
+ self.ff_effects_max.hash(state);
+ self.absmax.hash(state);
+ self.absmin.hash(state);
+ self.absfuzz.hash(state);
+ self.absflat.hash(state);
+ }
+ }
+
+ #[allow(deprecated)]
impl af_alg_iv {
fn as_slice(&self) -> &[u8] {
unsafe {
@@ -772,22 +939,26 @@ cfg_if! {
}
}
+ #[allow(deprecated)]
impl PartialEq for af_alg_iv {
fn eq(&self, other: &af_alg_iv) -> bool {
*self.as_slice() == *other.as_slice()
}
}
+ #[allow(deprecated)]
impl Eq for af_alg_iv {}
+ #[allow(deprecated)]
impl ::fmt::Debug for af_alg_iv {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("af_alg_iv")
- .field("iv", &self.as_slice())
+ .field("ivlen", &self.ivlen)
.finish()
}
}
+ #[allow(deprecated)]
impl ::hash::Hash for af_alg_iv {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.as_slice().hash(state);
@@ -824,78 +995,76 @@ cfg_if! {
}
}
-pub const ABDAY_1: ::nl_item = 0x20000;
-pub const ABDAY_2: ::nl_item = 0x20001;
-pub const ABDAY_3: ::nl_item = 0x20002;
-pub const ABDAY_4: ::nl_item = 0x20003;
-pub const ABDAY_5: ::nl_item = 0x20004;
-pub const ABDAY_6: ::nl_item = 0x20005;
-pub const ABDAY_7: ::nl_item = 0x20006;
-
-pub const DAY_1: ::nl_item = 0x20007;
-pub const DAY_2: ::nl_item = 0x20008;
-pub const DAY_3: ::nl_item = 0x20009;
-pub const DAY_4: ::nl_item = 0x2000A;
-pub const DAY_5: ::nl_item = 0x2000B;
-pub const DAY_6: ::nl_item = 0x2000C;
-pub const DAY_7: ::nl_item = 0x2000D;
-
-pub const ABMON_1: ::nl_item = 0x2000E;
-pub const ABMON_2: ::nl_item = 0x2000F;
-pub const ABMON_3: ::nl_item = 0x20010;
-pub const ABMON_4: ::nl_item = 0x20011;
-pub const ABMON_5: ::nl_item = 0x20012;
-pub const ABMON_6: ::nl_item = 0x20013;
-pub const ABMON_7: ::nl_item = 0x20014;
-pub const ABMON_8: ::nl_item = 0x20015;
-pub const ABMON_9: ::nl_item = 0x20016;
-pub const ABMON_10: ::nl_item = 0x20017;
-pub const ABMON_11: ::nl_item = 0x20018;
-pub const ABMON_12: ::nl_item = 0x20019;
-
-pub const MON_1: ::nl_item = 0x2001A;
-pub const MON_2: ::nl_item = 0x2001B;
-pub const MON_3: ::nl_item = 0x2001C;
-pub const MON_4: ::nl_item = 0x2001D;
-pub const MON_5: ::nl_item = 0x2001E;
-pub const MON_6: ::nl_item = 0x2001F;
-pub const MON_7: ::nl_item = 0x20020;
-pub const MON_8: ::nl_item = 0x20021;
-pub const MON_9: ::nl_item = 0x20022;
-pub const MON_10: ::nl_item = 0x20023;
-pub const MON_11: ::nl_item = 0x20024;
-pub const MON_12: ::nl_item = 0x20025;
-
-pub const AM_STR: ::nl_item = 0x20026;
-pub const PM_STR: ::nl_item = 0x20027;
-
-pub const D_T_FMT: ::nl_item = 0x20028;
-pub const D_FMT: ::nl_item = 0x20029;
-pub const T_FMT: ::nl_item = 0x2002A;
-pub const T_FMT_AMPM: ::nl_item = 0x2002B;
-
-pub const ERA: ::nl_item = 0x2002C;
-pub const ERA_D_FMT: ::nl_item = 0x2002E;
-pub const ALT_DIGITS: ::nl_item = 0x2002F;
-pub const ERA_D_T_FMT: ::nl_item = 0x20030;
-pub const ERA_T_FMT: ::nl_item = 0x20031;
-
-pub const CODESET: ::nl_item = 14;
-
-pub const CRNCYSTR: ::nl_item = 0x4000F;
-
-pub const RUSAGE_THREAD: ::c_int = 1;
-pub const RUSAGE_CHILDREN: ::c_int = -1;
-
-pub const RADIXCHAR: ::nl_item = 0x10000;
-pub const THOUSEP: ::nl_item = 0x10001;
-
-pub const YESEXPR: ::nl_item = 0x50000;
-pub const NOEXPR: ::nl_item = 0x50001;
-pub const YESSTR: ::nl_item = 0x50002;
-pub const NOSTR: ::nl_item = 0x50003;
+cfg_if! {
+ if #[cfg(any(target_env = "gnu", target_env = "musl"))] {
+ pub const ABDAY_1: ::nl_item = 0x20000;
+ pub const ABDAY_2: ::nl_item = 0x20001;
+ pub const ABDAY_3: ::nl_item = 0x20002;
+ pub const ABDAY_4: ::nl_item = 0x20003;
+ pub const ABDAY_5: ::nl_item = 0x20004;
+ pub const ABDAY_6: ::nl_item = 0x20005;
+ pub const ABDAY_7: ::nl_item = 0x20006;
+
+ pub const DAY_1: ::nl_item = 0x20007;
+ pub const DAY_2: ::nl_item = 0x20008;
+ pub const DAY_3: ::nl_item = 0x20009;
+ pub const DAY_4: ::nl_item = 0x2000A;
+ pub const DAY_5: ::nl_item = 0x2000B;
+ pub const DAY_6: ::nl_item = 0x2000C;
+ pub const DAY_7: ::nl_item = 0x2000D;
+
+ pub const ABMON_1: ::nl_item = 0x2000E;
+ pub const ABMON_2: ::nl_item = 0x2000F;
+ pub const ABMON_3: ::nl_item = 0x20010;
+ pub const ABMON_4: ::nl_item = 0x20011;
+ pub const ABMON_5: ::nl_item = 0x20012;
+ pub const ABMON_6: ::nl_item = 0x20013;
+ pub const ABMON_7: ::nl_item = 0x20014;
+ pub const ABMON_8: ::nl_item = 0x20015;
+ pub const ABMON_9: ::nl_item = 0x20016;
+ pub const ABMON_10: ::nl_item = 0x20017;
+ pub const ABMON_11: ::nl_item = 0x20018;
+ pub const ABMON_12: ::nl_item = 0x20019;
+
+ pub const MON_1: ::nl_item = 0x2001A;
+ pub const MON_2: ::nl_item = 0x2001B;
+ pub const MON_3: ::nl_item = 0x2001C;
+ pub const MON_4: ::nl_item = 0x2001D;
+ pub const MON_5: ::nl_item = 0x2001E;
+ pub const MON_6: ::nl_item = 0x2001F;
+ pub const MON_7: ::nl_item = 0x20020;
+ pub const MON_8: ::nl_item = 0x20021;
+ pub const MON_9: ::nl_item = 0x20022;
+ pub const MON_10: ::nl_item = 0x20023;
+ pub const MON_11: ::nl_item = 0x20024;
+ pub const MON_12: ::nl_item = 0x20025;
+
+ pub const AM_STR: ::nl_item = 0x20026;
+ pub const PM_STR: ::nl_item = 0x20027;
+
+ pub const D_T_FMT: ::nl_item = 0x20028;
+ pub const D_FMT: ::nl_item = 0x20029;
+ pub const T_FMT: ::nl_item = 0x2002A;
+ pub const T_FMT_AMPM: ::nl_item = 0x2002B;
+
+ pub const ERA: ::nl_item = 0x2002C;
+ pub const ERA_D_FMT: ::nl_item = 0x2002E;
+ pub const ALT_DIGITS: ::nl_item = 0x2002F;
+ pub const ERA_D_T_FMT: ::nl_item = 0x20030;
+ pub const ERA_T_FMT: ::nl_item = 0x20031;
+
+ pub const CODESET: ::nl_item = 14;
+ pub const CRNCYSTR: ::nl_item = 0x4000F;
+ pub const RADIXCHAR: ::nl_item = 0x10000;
+ pub const THOUSEP: ::nl_item = 0x10001;
+ pub const YESEXPR: ::nl_item = 0x50000;
+ pub const NOEXPR: ::nl_item = 0x50001;
+ pub const YESSTR: ::nl_item = 0x50002;
+ pub const NOSTR: ::nl_item = 0x50003;
+ }
+}
-pub const FILENAME_MAX: ::c_uint = 4096;
+pub const RUSAGE_CHILDREN: ::c_int = -1;
pub const L_tmpnam: ::c_uint = 20;
pub const _PC_LINK_MAX: ::c_int = 0;
pub const _PC_MAX_CANON: ::c_int = 1;
@@ -1066,6 +1235,32 @@ pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 248;
pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY;
pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY;
+pub const AT_NULL: ::c_ulong = 0;
+pub const AT_IGNORE: ::c_ulong = 1;
+pub const AT_EXECFD: ::c_ulong = 2;
+pub const AT_PHDR: ::c_ulong = 3;
+pub const AT_PHENT: ::c_ulong = 4;
+pub const AT_PHNUM: ::c_ulong = 5;
+pub const AT_PAGESZ: ::c_ulong = 6;
+pub const AT_BASE: ::c_ulong = 7;
+pub const AT_FLAGS: ::c_ulong = 8;
+pub const AT_ENTRY: ::c_ulong = 9;
+pub const AT_NOTELF: ::c_ulong = 10;
+pub const AT_UID: ::c_ulong = 11;
+pub const AT_EUID: ::c_ulong = 12;
+pub const AT_GID: ::c_ulong = 13;
+pub const AT_EGID: ::c_ulong = 14;
+pub const AT_PLATFORM: ::c_ulong = 15;
+pub const AT_HWCAP: ::c_ulong = 16;
+pub const AT_CLKTCK: ::c_ulong = 17;
+
+pub const AT_SECURE: ::c_ulong = 23;
+pub const AT_BASE_PLATFORM: ::c_ulong = 24;
+pub const AT_RANDOM: ::c_ulong = 25;
+pub const AT_HWCAP2: ::c_ulong = 26;
+
+pub const AT_EXECFN: ::c_ulong = 31;
+
pub const GLOB_ERR: ::c_int = 1 << 0;
pub const GLOB_MARK: ::c_int = 1 << 1;
pub const GLOB_NOSORT: ::c_int = 1 << 2;
@@ -1159,6 +1354,23 @@ pub const IFLA_PHYS_SWITCH_ID: ::c_ushort = 36;
pub const IFLA_LINK_NETNSID: ::c_ushort = 37;
pub const IFLA_PHYS_PORT_NAME: ::c_ushort = 38;
pub const IFLA_PROTO_DOWN: ::c_ushort = 39;
+pub const IFLA_GSO_MAX_SEGS: ::c_ushort = 40;
+pub const IFLA_GSO_MAX_SIZE: ::c_ushort = 41;
+pub const IFLA_PAD: ::c_ushort = 42;
+pub const IFLA_XDP: ::c_ushort = 43;
+pub const IFLA_EVENT: ::c_ushort = 44;
+pub const IFLA_NEW_NETNSID: ::c_ushort = 45;
+pub const IFLA_IF_NETNSID: ::c_ushort = 46;
+pub const IFLA_TARGET_NETNSID: ::c_ushort = IFLA_IF_NETNSID;
+pub const IFLA_CARRIER_UP_COUNT: ::c_ushort = 47;
+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_INFO_UNSPEC: ::c_ushort = 0;
pub const IFLA_INFO_KIND: ::c_ushort = 1;
@@ -1188,6 +1400,10 @@ pub const IFF_DETACH_QUEUE: ::c_int = 0x0400;
pub const IFF_PERSIST: ::c_int = 0x0800;
pub const IFF_NOFILTER: ::c_int = 0x1000;
+// Since Linux 3.1
+pub const SEEK_DATA: ::c_int = 3;
+pub const SEEK_HOLE: ::c_int = 4;
+
pub const ST_RDONLY: ::c_ulong = 1;
pub const ST_NOSUID: ::c_ulong = 2;
pub const ST_NODEV: ::c_ulong = 4;
@@ -1205,6 +1421,8 @@ pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
pub const RTLD_NODELETE: ::c_int = 0x1000;
pub const RTLD_NOW: ::c_int = 0x2;
+pub const AT_EACCESS: ::c_int = 0x200;
+
pub const TCP_MD5SIG: ::c_int = 14;
align_const! {
@@ -1226,9 +1444,9 @@ pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0;
pub const PTHREAD_PROCESS_SHARED: ::c_int = 1;
pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
-pub const RENAME_NOREPLACE: ::c_int = 1;
-pub const RENAME_EXCHANGE: ::c_int = 2;
-pub const RENAME_WHITEOUT: ::c_int = 4;
+pub const RENAME_NOREPLACE: ::c_uint = 1;
+pub const RENAME_EXCHANGE: ::c_uint = 2;
+pub const RENAME_WHITEOUT: ::c_uint = 4;
pub const SCHED_OTHER: ::c_int = 0;
pub const SCHED_FIFO: ::c_int = 1;
@@ -1241,72 +1459,16 @@ pub const SCHED_RESET_ON_FORK: ::c_int = 0x40000000;
// netinet/in.h
// NOTE: These are in addition to the constants defined in src/unix/mod.rs
-// IPPROTO_IP defined in src/unix/mod.rs
-/// Hop-by-hop option header
-pub const IPPROTO_HOPOPTS: ::c_int = 0;
-// IPPROTO_ICMP defined in src/unix/mod.rs
-/// group mgmt protocol
-pub const IPPROTO_IGMP: ::c_int = 2;
-/// for compatibility
-pub const IPPROTO_IPIP: ::c_int = 4;
-// IPPROTO_TCP defined in src/unix/mod.rs
-/// exterior gateway protocol
-pub const IPPROTO_EGP: ::c_int = 8;
-/// pup
-pub const IPPROTO_PUP: ::c_int = 12;
-// IPPROTO_UDP defined in src/unix/mod.rs
-/// xns idp
-pub const IPPROTO_IDP: ::c_int = 22;
-/// tp-4 w/ class negotiation
-pub const IPPROTO_TP: ::c_int = 29;
-/// DCCP
-pub const IPPROTO_DCCP: ::c_int = 33;
-// IPPROTO_IPV6 defined in src/unix/mod.rs
-/// IP6 routing header
-pub const IPPROTO_ROUTING: ::c_int = 43;
-/// IP6 fragmentation header
-pub const IPPROTO_FRAGMENT: ::c_int = 44;
-/// resource reservation
-pub const IPPROTO_RSVP: ::c_int = 46;
-/// General Routing Encap.
-pub const IPPROTO_GRE: ::c_int = 47;
-/// IP6 Encap Sec. Payload
-pub const IPPROTO_ESP: ::c_int = 50;
-/// IP6 Auth Header
-pub const IPPROTO_AH: ::c_int = 51;
-// IPPROTO_ICMPV6 defined in src/unix/mod.rs
-/// IP6 no next header
-pub const IPPROTO_NONE: ::c_int = 59;
-/// IP6 destination option
-pub const IPPROTO_DSTOPTS: ::c_int = 60;
-pub const IPPROTO_MTP: ::c_int = 92;
-pub const IPPROTO_BEETPH: ::c_int = 94;
-/// encapsulation header
-pub const IPPROTO_ENCAP: ::c_int = 98;
-/// Protocol indep. multicast
-pub const IPPROTO_PIM: ::c_int = 103;
-/// IP Payload Comp. Protocol
-pub const IPPROTO_COMP: ::c_int = 108;
-/// SCTP
-pub const IPPROTO_SCTP: ::c_int = 132;
-pub const IPPROTO_MH: ::c_int = 135;
-pub const IPPROTO_UDPLITE: ::c_int = 136;
-pub const IPPROTO_MPLS: ::c_int = 137;
-/// raw IP packet
-pub const IPPROTO_RAW: ::c_int = 255;
+/// Multipath TCP
+pub const IPPROTO_MPTCP: ::c_int = 262;
+#[deprecated(
+ since = "0.2.80",
+ note = "This value was increased in the newer kernel \
+ and we'll change this following upstream in the future release. \
+ See #1896 for more info."
+)]
pub const IPPROTO_MAX: ::c_int = 256;
-pub const AF_IB: ::c_int = 27;
-pub const AF_MPLS: ::c_int = 28;
-pub const AF_NFC: ::c_int = 39;
-pub const AF_VSOCK: ::c_int = 40;
-pub const AF_XDP: ::c_int = 44;
-pub const PF_IB: ::c_int = AF_IB;
-pub const PF_MPLS: ::c_int = AF_MPLS;
-pub const PF_NFC: ::c_int = AF_NFC;
-pub const PF_VSOCK: ::c_int = AF_VSOCK;
-pub const PF_XDP: ::c_int = AF_XDP;
-
// System V IPC
pub const IPC_PRIVATE: ::key_t = 0;
@@ -1323,7 +1485,6 @@ pub const MSG_INFO: ::c_int = 12;
pub const MSG_NOERROR: ::c_int = 0o10000;
pub const MSG_EXCEPT: ::c_int = 0o20000;
-pub const MSG_COPY: ::c_int = 0o40000;
pub const SHM_R: ::c_int = 0o400;
pub const SHM_W: ::c_int = 0o200;
@@ -1331,16 +1492,17 @@ pub const SHM_W: ::c_int = 0o200;
pub const SHM_RDONLY: ::c_int = 0o10000;
pub const SHM_RND: ::c_int = 0o20000;
pub const SHM_REMAP: ::c_int = 0o40000;
-pub const SHM_EXEC: ::c_int = 0o100000;
pub const SHM_LOCK: ::c_int = 11;
pub const SHM_UNLOCK: ::c_int = 12;
pub const SHM_HUGETLB: ::c_int = 0o4000;
+#[cfg(not(all(target_env = "uclibc", target_arch = "mips")))]
pub const SHM_NORESERVE: ::c_int = 0o10000;
pub const EPOLLRDHUP: ::c_int = 0x2000;
pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000;
+pub const EPOLLWAKEUP: ::c_int = 0x20000000;
pub const EPOLLONESHOT: ::c_int = 0x40000000;
pub const QFMT_VFS_OLD: ::c_int = 1;
@@ -1392,14 +1554,28 @@ pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1;
pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2;
pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4;
-pub const AIO_CANCELED: ::c_int = 0;
-pub const AIO_NOTCANCELED: ::c_int = 1;
-pub const AIO_ALLDONE: ::c_int = 2;
-pub const LIO_READ: ::c_int = 0;
-pub const LIO_WRITE: ::c_int = 1;
-pub const LIO_NOP: ::c_int = 2;
-pub const LIO_WAIT: ::c_int = 0;
-pub const LIO_NOWAIT: ::c_int = 1;
+cfg_if! {
+ if #[cfg(not(target_env = "uclibc"))] {
+ pub const AIO_CANCELED: ::c_int = 0;
+ pub const AIO_NOTCANCELED: ::c_int = 1;
+ pub const AIO_ALLDONE: ::c_int = 2;
+ pub const LIO_READ: ::c_int = 0;
+ pub const LIO_WRITE: ::c_int = 1;
+ pub const LIO_NOP: ::c_int = 2;
+ pub const LIO_WAIT: ::c_int = 0;
+ pub const LIO_NOWAIT: ::c_int = 1;
+ pub const RUSAGE_THREAD: ::c_int = 1;
+ pub const TCP_ULP: ::c_int = 31;
+ pub const MSG_COPY: ::c_int = 0o40000;
+ pub const SHM_EXEC: ::c_int = 0o100000;
+ pub const IPV6_MULTICAST_ALL: ::c_int = 29;
+ pub const IPV6_ROUTER_ALERT_ISOLATE: ::c_int = 30;
+ pub const PACKET_MR_UNICAST: ::c_int = 3;
+ pub const PTRACE_EVENT_STOP: ::c_int = 128;
+ pub const UDP_SEGMENT: ::c_int = 103;
+ pub const UDP_GRO: ::c_int = 104;
+ }
+}
pub const MREMAP_MAYMOVE: ::c_int = 1;
pub const MREMAP_FIXED: ::c_int = 2;
@@ -1558,16 +1734,22 @@ pub const FALLOC_FL_UNSHARE_RANGE: ::c_int = 0x40;
pub const ENOATTR: ::c_int = ::ENODATA;
pub const SO_ORIGINAL_DST: ::c_int = 80;
-pub const IP_ORIGDSTADDR: ::c_int = 20;
-pub const IP_RECVORIGDSTADDR: ::c_int = IP_ORIGDSTADDR;
-pub const IPV6_ORIGDSTADDR: ::c_int = 74;
-pub const IPV6_RECVORIGDSTADDR: ::c_int = IPV6_ORIGDSTADDR;
+
+pub const IP_RECVFRAGSIZE: ::c_int = 25;
+
+pub const IPV6_FLOWINFO: ::c_int = 11;
pub const IPV6_FLOWLABEL_MGR: ::c_int = 32;
pub const IPV6_FLOWINFO_SEND: ::c_int = 33;
+pub const IPV6_RECVFRAGSIZE: ::c_int = 77;
+pub const IPV6_FREEBIND: ::c_int = 78;
pub const IPV6_FLOWINFO_FLOWLABEL: ::c_int = 0x000fffff;
pub const IPV6_FLOWINFO_PRIORITY: ::c_int = 0x0ff00000;
+pub const IPV6_RTHDR_LOOSE: ::c_int = 0;
+pub const IPV6_RTHDR_STRICT: ::c_int = 1;
+
pub const IUTF8: ::tcflag_t = 0x00004000;
+#[cfg(not(all(target_env = "uclibc", target_arch = "mips")))]
pub const CMSPAR: ::tcflag_t = 0o10000000000;
pub const MFD_CLOEXEC: ::c_uint = 0x0001;
@@ -1773,6 +1955,72 @@ pub const NFULNL_CFG_F_SEQ: ::c_int = 0x0001;
pub const NFULNL_CFG_F_SEQ_GLOBAL: ::c_int = 0x0002;
pub const NFULNL_CFG_F_CONNTRACK: ::c_int = 0x0004;
+// linux/netfilter/nfnetlink_log.h
+pub const NFQNL_MSG_PACKET: ::c_int = 0;
+pub const NFQNL_MSG_VERDICT: ::c_int = 1;
+pub const NFQNL_MSG_CONFIG: ::c_int = 2;
+pub const NFQNL_MSG_VERDICT_BATCH: ::c_int = 3;
+
+pub const NFQA_UNSPEC: ::c_int = 0;
+pub const NFQA_PACKET_HDR: ::c_int = 1;
+pub const NFQA_VERDICT_HDR: ::c_int = 2;
+pub const NFQA_MARK: ::c_int = 3;
+pub const NFQA_TIMESTAMP: ::c_int = 4;
+pub const NFQA_IFINDEX_INDEV: ::c_int = 5;
+pub const NFQA_IFINDEX_OUTDEV: ::c_int = 6;
+pub const NFQA_IFINDEX_PHYSINDEV: ::c_int = 7;
+pub const NFQA_IFINDEX_PHYSOUTDEV: ::c_int = 8;
+pub const NFQA_HWADDR: ::c_int = 9;
+pub const NFQA_PAYLOAD: ::c_int = 10;
+pub const NFQA_CT: ::c_int = 11;
+pub const NFQA_CT_INFO: ::c_int = 12;
+pub const NFQA_CAP_LEN: ::c_int = 13;
+pub const NFQA_SKB_INFO: ::c_int = 14;
+pub const NFQA_EXP: ::c_int = 15;
+pub const NFQA_UID: ::c_int = 16;
+pub const NFQA_GID: ::c_int = 17;
+pub const NFQA_SECCTX: ::c_int = 18;
+/*
+ FIXME: These are not yet available in musl sanitized kernel headers and
+ make the tests fail. Enable them once musl has them.
+
+ See https://github.com/rust-lang/libc/pull/1628 for more details.
+pub const NFQA_VLAN: ::c_int = 19;
+pub const NFQA_L2HDR: ::c_int = 20;
+
+pub const NFQA_VLAN_UNSPEC: ::c_int = 0;
+pub const NFQA_VLAN_PROTO: ::c_int = 1;
+pub const NFQA_VLAN_TCI: ::c_int = 2;
+*/
+
+pub const NFQNL_CFG_CMD_NONE: ::c_int = 0;
+pub const NFQNL_CFG_CMD_BIND: ::c_int = 1;
+pub const NFQNL_CFG_CMD_UNBIND: ::c_int = 2;
+pub const NFQNL_CFG_CMD_PF_BIND: ::c_int = 3;
+pub const NFQNL_CFG_CMD_PF_UNBIND: ::c_int = 4;
+
+pub const NFQNL_COPY_NONE: ::c_int = 0;
+pub const NFQNL_COPY_META: ::c_int = 1;
+pub const NFQNL_COPY_PACKET: ::c_int = 2;
+
+pub const NFQA_CFG_UNSPEC: ::c_int = 0;
+pub const NFQA_CFG_CMD: ::c_int = 1;
+pub const NFQA_CFG_PARAMS: ::c_int = 2;
+pub const NFQA_CFG_QUEUE_MAXLEN: ::c_int = 3;
+pub const NFQA_CFG_MASK: ::c_int = 4;
+pub const NFQA_CFG_FLAGS: ::c_int = 5;
+
+pub const NFQA_CFG_F_FAIL_OPEN: ::c_int = 0x0001;
+pub const NFQA_CFG_F_CONNTRACK: ::c_int = 0x0002;
+pub const NFQA_CFG_F_GSO: ::c_int = 0x0004;
+pub const NFQA_CFG_F_UID_GID: ::c_int = 0x0008;
+pub const NFQA_CFG_F_SECCTX: ::c_int = 0x0010;
+pub const NFQA_CFG_F_MAX: ::c_int = 0x0020;
+
+pub const NFQA_SKB_CSUMNOTREADY: ::c_int = 0x0001;
+pub const NFQA_SKB_GSO: ::c_int = 0x0002;
+pub const NFQA_SKB_CSUM_NOTVERIFIED: ::c_int = 0x0004;
+
pub const GENL_NAMSIZ: ::c_int = 16;
pub const GENL_MIN_ID: ::c_int = NLMSG_MIN_TYPE;
@@ -1820,7 +2068,6 @@ pub const PACKET_DROP_MEMBERSHIP: ::c_int = 2;
pub const PACKET_MR_MULTICAST: ::c_int = 0;
pub const PACKET_MR_PROMISC: ::c_int = 1;
pub const PACKET_MR_ALLMULTI: ::c_int = 2;
-pub const PACKET_MR_UNICAST: ::c_int = 3;
// linux/netfilter.h
pub const NF_DROP: ::c_int = 0;
@@ -1900,6 +2147,9 @@ pub const NF_IP6_PRI_SELINUX_LAST: ::c_int = 225;
pub const NF_IP6_PRI_CONNTRACK_HELPER: ::c_int = 300;
pub const NF_IP6_PRI_LAST: ::c_int = ::INT_MAX;
+// linux/netfilter_ipv6/ip6_tables.h
+pub const IP6T_SO_ORIGINAL_DST: ::c_int = 80;
+
pub const SIOCADDRT: ::c_ulong = 0x0000890B;
pub const SIOCDELRT: ::c_ulong = 0x0000890C;
pub const SIOCGIFNAME: ::c_ulong = 0x00008910;
@@ -2206,12 +2456,6 @@ pub const ARPD_LOOKUP: ::c_ushort = 0x02;
pub const ARPD_FLUSH: ::c_ushort = 0x03;
pub const ATF_MAGIC: ::c_int = 0x80;
-#[cfg(not(target_arch = "sparc64"))]
-pub const SO_TIMESTAMPING: ::c_int = 37;
-#[cfg(target_arch = "sparc64")]
-pub const SO_TIMESTAMPING: ::c_int = 35;
-pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;
-
// linux/module.h
pub const MODULE_INIT_IGNORE_MODVERSIONS: ::c_uint = 0x0001;
pub const MODULE_INIT_IGNORE_VERMAGIC: ::c_uint = 0x0002;
@@ -2235,10 +2479,28 @@ pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5;
pub const ALG_OP_DECRYPT: ::c_int = 0;
pub const ALG_OP_ENCRYPT: ::c_int = 1;
+// include/uapi/linux/udp.h
+pub const UDP_CORK: ::c_int = 1;
+pub const UDP_ENCAP: ::c_int = 100;
+pub const UDP_NO_CHECK6_TX: ::c_int = 101;
+pub const UDP_NO_CHECK6_RX: ::c_int = 102;
+
+// include/uapi/linux/mman.h
+pub const MAP_SHARED_VALIDATE: ::c_int = 0x3;
+
+// include/uapi/asm-generic/mman-common.h
+pub const MAP_FIXED_NOREPLACE: ::c_int = 0x100000;
+
// uapi/linux/vm_sockets.h
pub const VMADDR_CID_ANY: ::c_uint = 0xFFFFFFFF;
pub const VMADDR_CID_HYPERVISOR: ::c_uint = 0;
+#[deprecated(
+ since = "0.2.74",
+ note = "VMADDR_CID_RESERVED is removed since Linux v5.6 and \
+ replaced with VMADDR_CID_LOCAL"
+)]
pub const VMADDR_CID_RESERVED: ::c_uint = 1;
+pub const VMADDR_CID_LOCAL: ::c_uint = 1;
pub const VMADDR_CID_HOST: ::c_uint = 2;
pub const VMADDR_PORT_ANY: ::c_uint = 0xFFFFFFFF;
@@ -2248,11 +2510,11 @@ pub const IN_MODIFY: u32 = 0x0000_0002;
pub const IN_ATTRIB: u32 = 0x0000_0004;
pub const IN_CLOSE_WRITE: u32 = 0x0000_0008;
pub const IN_CLOSE_NOWRITE: u32 = 0x0000_0010;
-pub const IN_CLOSE: u32 = (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE);
+pub const IN_CLOSE: u32 = IN_CLOSE_WRITE | IN_CLOSE_NOWRITE;
pub const IN_OPEN: u32 = 0x0000_0020;
pub const IN_MOVED_FROM: u32 = 0x0000_0040;
pub const IN_MOVED_TO: u32 = 0x0000_0080;
-pub const IN_MOVE: u32 = (IN_MOVED_FROM | IN_MOVED_TO);
+pub const IN_MOVE: u32 = IN_MOVED_FROM | IN_MOVED_TO;
pub const IN_CREATE: u32 = 0x0000_0100;
pub const IN_DELETE: u32 = 0x0000_0200;
pub const IN_DELETE_SELF: u32 = 0x0000_0400;
@@ -2264,12 +2526,56 @@ pub const IN_ONLYDIR: u32 = 0x0100_0000;
pub const IN_DONT_FOLLOW: u32 = 0x0200_0000;
// pub const IN_EXCL_UNLINK: u32 = 0x0400_0000;
+// linux/keyctl.h
+pub const KEY_SPEC_THREAD_KEYRING: i32 = -1;
+pub const KEY_SPEC_PROCESS_KEYRING: i32 = -2;
+pub const KEY_SPEC_SESSION_KEYRING: i32 = -3;
+pub const KEY_SPEC_USER_KEYRING: i32 = -4;
+pub const KEY_SPEC_USER_SESSION_KEYRING: i32 = -5;
+pub const KEY_SPEC_GROUP_KEYRING: i32 = -6;
+pub const KEY_SPEC_REQKEY_AUTH_KEY: i32 = -7;
+pub const KEY_SPEC_REQUESTOR_KEYRING: i32 = -8;
+
+pub const KEY_REQKEY_DEFL_NO_CHANGE: i32 = -1;
+pub const KEY_REQKEY_DEFL_DEFAULT: i32 = 0;
+pub const KEY_REQKEY_DEFL_THREAD_KEYRING: i32 = 1;
+pub const KEY_REQKEY_DEFL_PROCESS_KEYRING: i32 = 2;
+pub const KEY_REQKEY_DEFL_SESSION_KEYRING: i32 = 3;
+pub const KEY_REQKEY_DEFL_USER_KEYRING: i32 = 4;
+pub const KEY_REQKEY_DEFL_USER_SESSION_KEYRING: i32 = 5;
+pub const KEY_REQKEY_DEFL_GROUP_KEYRING: i32 = 6;
+pub const KEY_REQKEY_DEFL_REQUESTOR_KEYRING: i32 = 7;
+
+pub const KEYCTL_GET_KEYRING_ID: u32 = 0;
+pub const KEYCTL_JOIN_SESSION_KEYRING: u32 = 1;
+pub const KEYCTL_UPDATE: u32 = 2;
+pub const KEYCTL_REVOKE: u32 = 3;
+pub const KEYCTL_CHOWN: u32 = 4;
+pub const KEYCTL_SETPERM: u32 = 5;
+pub const KEYCTL_DESCRIBE: u32 = 6;
+pub const KEYCTL_CLEAR: u32 = 7;
+pub const KEYCTL_LINK: u32 = 8;
+pub const KEYCTL_UNLINK: u32 = 9;
+pub const KEYCTL_SEARCH: u32 = 10;
+pub const KEYCTL_READ: u32 = 11;
+pub const KEYCTL_INSTANTIATE: u32 = 12;
+pub const KEYCTL_NEGATE: u32 = 13;
+pub const KEYCTL_SET_REQKEY_KEYRING: u32 = 14;
+pub const KEYCTL_SET_TIMEOUT: u32 = 15;
+pub const KEYCTL_ASSUME_AUTHORITY: u32 = 16;
+pub const KEYCTL_GET_SECURITY: u32 = 17;
+pub const KEYCTL_SESSION_TO_PARENT: u32 = 18;
+pub const KEYCTL_REJECT: u32 = 19;
+pub const KEYCTL_INSTANTIATE_IOV: u32 = 20;
+pub const KEYCTL_INVALIDATE: u32 = 21;
+pub const KEYCTL_GET_PERSISTENT: u32 = 22;
+
// pub const IN_MASK_CREATE: u32 = 0x1000_0000;
// pub const IN_MASK_ADD: u32 = 0x2000_0000;
pub const IN_ISDIR: u32 = 0x4000_0000;
pub const IN_ONESHOT: u32 = 0x8000_0000;
-pub const IN_ALL_EVENTS: u32 = (IN_ACCESS
+pub const IN_ALL_EVENTS: u32 = IN_ACCESS
| IN_MODIFY
| IN_ATTRIB
| IN_CLOSE_WRITE
@@ -2280,11 +2586,86 @@ pub const IN_ALL_EVENTS: u32 = (IN_ACCESS
| IN_DELETE
| IN_CREATE
| IN_DELETE_SELF
- | IN_MOVE_SELF);
+ | IN_MOVE_SELF;
pub const IN_CLOEXEC: ::c_int = O_CLOEXEC;
pub const IN_NONBLOCK: ::c_int = O_NONBLOCK;
+// linux/input.h
+pub const FF_MAX: ::__u16 = 0x7f;
+pub const FF_CNT: usize = FF_MAX as usize + 1;
+
+// linux/input-event-codes.h
+pub const INPUT_PROP_MAX: ::__u16 = 0x1f;
+pub const INPUT_PROP_CNT: usize = INPUT_PROP_MAX as usize + 1;
+pub const EV_MAX: ::__u16 = 0x1f;
+pub const EV_CNT: usize = EV_MAX as usize + 1;
+pub const SYN_MAX: ::__u16 = 0xf;
+pub const SYN_CNT: usize = SYN_MAX as usize + 1;
+pub const KEY_MAX: ::__u16 = 0x2ff;
+pub const KEY_CNT: usize = KEY_MAX as usize + 1;
+pub const REL_MAX: ::__u16 = 0x0f;
+pub const REL_CNT: usize = REL_MAX as usize + 1;
+pub const ABS_MAX: ::__u16 = 0x3f;
+pub const ABS_CNT: usize = ABS_MAX as usize + 1;
+pub const SW_MAX: ::__u16 = 0x10;
+pub const SW_CNT: usize = SW_MAX as usize + 1;
+pub const MSC_MAX: ::__u16 = 0x07;
+pub const MSC_CNT: usize = MSC_MAX as usize + 1;
+pub const LED_MAX: ::__u16 = 0x0f;
+pub const LED_CNT: usize = LED_MAX as usize + 1;
+pub const REP_MAX: ::__u16 = 0x01;
+pub const REP_CNT: usize = REP_MAX as usize + 1;
+pub const SND_MAX: ::__u16 = 0x07;
+pub const SND_CNT: usize = SND_MAX as usize + 1;
+
+// linux/uinput.h
+pub const UINPUT_VERSION: ::c_uint = 5;
+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_CLOSE_WRITE: u64 = 0x0000_0008;
+pub const FAN_CLOSE_NOWRITE: u64 = 0x0000_0010;
+pub const FAN_OPEN: u64 = 0x0000_0020;
+
+pub const FAN_Q_OVERFLOW: u64 = 0x0000_4000;
+
+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_EVENT_ON_CHILD: u64 = 0x0800_0000;
+
+pub const FAN_CLOSE: u64 = FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE;
+
+pub const FAN_CLOEXEC: ::c_uint = 0x0000_0001;
+pub const FAN_NONBLOCK: ::c_uint = 0x0000_0002;
+
+pub const FAN_CLASS_NOTIF: ::c_uint = 0x0000_0000;
+pub const FAN_CLASS_CONTENT: ::c_uint = 0x0000_0004;
+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_MARK_ADD: ::c_uint = 0x0000_0001;
+pub const FAN_MARK_REMOVE: ::c_uint = 0x0000_0002;
+pub const FAN_MARK_DONT_FOLLOW: ::c_uint = 0x0000_0004;
+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 FANOTIFY_METADATA_VERSION: u8 = 3;
+
+pub const FAN_ALLOW: u32 = 0x01;
+pub const FAN_DENY: u32 = 0x02;
+
+pub const FAN_NOFD: ::c_int = -1;
+
pub const FUTEX_WAIT: ::c_int = 0;
pub const FUTEX_WAKE: ::c_int = 1;
pub const FUTEX_FD: ::c_int = 2;
@@ -2301,8 +2682,131 @@ pub const FUTEX_CMP_REQUEUE_PI: ::c_int = 12;
pub const FUTEX_PRIVATE_FLAG: ::c_int = 128;
pub const FUTEX_CLOCK_REALTIME: ::c_int = 256;
-pub const FUTEX_CMD_MASK: ::c_int =
- !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME);
+pub const FUTEX_CMD_MASK: ::c_int = !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME);
+
+// linux/reboot.h
+pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead;
+pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793;
+pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278;
+pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448;
+pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216;
+
+pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567;
+pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123;
+pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF;
+pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000;
+pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC;
+pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4;
+pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2;
+pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
+
+pub const REG_EXTENDED: ::c_int = 1;
+pub const REG_ICASE: ::c_int = 2;
+pub const REG_NEWLINE: ::c_int = 4;
+pub const REG_NOSUB: ::c_int = 8;
+
+pub const REG_NOTBOL: ::c_int = 1;
+pub const REG_NOTEOL: ::c_int = 2;
+
+pub const REG_ENOSYS: ::c_int = -1;
+pub const REG_NOMATCH: ::c_int = 1;
+pub const REG_BADPAT: ::c_int = 2;
+pub const REG_ECOLLATE: ::c_int = 3;
+pub const REG_ECTYPE: ::c_int = 4;
+pub const REG_EESCAPE: ::c_int = 5;
+pub const REG_ESUBREG: ::c_int = 6;
+pub const REG_EBRACK: ::c_int = 7;
+pub const REG_EPAREN: ::c_int = 8;
+pub const REG_EBRACE: ::c_int = 9;
+pub const REG_BADBR: ::c_int = 10;
+pub const REG_ERANGE: ::c_int = 11;
+pub const REG_ESPACE: ::c_int = 12;
+pub const REG_BADRPT: ::c_int = 13;
+
+// linux/errqueue.h
+pub const SO_EE_ORIGIN_NONE: u8 = 0;
+pub const SO_EE_ORIGIN_LOCAL: u8 = 1;
+pub const SO_EE_ORIGIN_ICMP: u8 = 2;
+pub const SO_EE_ORIGIN_ICMP6: u8 = 3;
+pub const SO_EE_ORIGIN_TXSTATUS: u8 = 4;
+pub const SO_EE_ORIGIN_TIMESTAMPING: u8 = SO_EE_ORIGIN_TXSTATUS;
+
+// 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 EWOULDBLOCK: ::c_int = EAGAIN;
+
+// linux/can.h
+pub const CAN_EFF_FLAG: canid_t = 0x80000000;
+pub const CAN_RTR_FLAG: canid_t = 0x40000000;
+pub const CAN_ERR_FLAG: canid_t = 0x20000000;
+pub const CAN_SFF_MASK: canid_t = 0x000007FF;
+pub const CAN_EFF_MASK: canid_t = 0x1FFFFFFF;
+pub const CAN_ERR_MASK: canid_t = 0x1FFFFFFF;
+
+pub const CAN_SFF_ID_BITS: ::c_int = 11;
+pub const CAN_EFF_ID_BITS: ::c_int = 29;
+
+pub const CAN_MAX_DLC: ::c_int = 8;
+pub const CAN_MAX_DLEN: usize = 8;
+pub const CANFD_MAX_DLC: ::c_int = 15;
+pub const CANFD_MAX_DLEN: usize = 64;
+
+pub const CANFD_BRS: ::c_int = 0x01;
+pub const CANFD_ESI: ::c_int = 0x02;
+
+cfg_if! {
+ if #[cfg(libc_align)] {
+ pub const CAN_MTU: usize = ::mem::size_of::<can_frame>();
+ pub const CANFD_MTU: usize = ::mem::size_of::<canfd_frame>();
+ }
+}
+
+pub const CAN_RAW: ::c_int = 1;
+pub const CAN_BCM: ::c_int = 2;
+pub const CAN_TP16: ::c_int = 3;
+pub const CAN_TP20: ::c_int = 4;
+pub const CAN_MCNET: ::c_int = 5;
+pub const CAN_ISOTP: ::c_int = 6;
+pub const CAN_J1939: ::c_int = 7;
+pub const CAN_NPROTO: ::c_int = 8;
+
+pub const SOL_CAN_BASE: ::c_int = 100;
+
+pub const CAN_INV_FILTER: canid_t = 0x20000000;
+pub const CAN_RAW_FILTER_MAX: ::c_int = 512;
f! {
pub fn NLA_ALIGN(len: ::c_int) -> ::c_int {
@@ -2328,6 +2832,12 @@ f! {
}
}
+ pub fn CPU_ALLOC_SIZE(count: ::c_int) -> ::size_t {
+ let _dummy: cpu_set_t = ::mem::zeroed();
+ let size_in_bits = 8 * ::mem::size_of_val(&_dummy.bits[0]);
+ ((count as ::size_t + size_in_bits - 1) / 8) as ::size_t
+ }
+
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
for slot in cpuset.bits.iter_mut() {
*slot = 0;
@@ -2356,6 +2866,19 @@ f! {
0 != (cpuset.bits[idx] & (1 << offset))
}
+ pub fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> ::c_int {
+ let mut s: u32 = 0;
+ let size_of_mask = ::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(::mem::size_of::<cpu_set_t>(), cpuset)
+ }
+
pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
set1.bits == set2.bits
}
@@ -2404,15 +2927,84 @@ f! {
pub fn RT_LOCALADDR(flags: u32) -> bool {
(flags & RTF_ADDRCLASSMASK) == (RTF_LOCAL | RTF_INTERFACE)
}
+
+ pub fn SO_EE_OFFENDER(ee: *const ::sock_extended_err) -> *mut ::sockaddr {
+ ee.offset(1) as *mut ::sockaddr
+ }
+}
+
+cfg_if! {
+ if #[cfg(not(target_env = "uclibc"))] {
+ extern "C" {
+ pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
+ pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
+ pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
+ pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
+ pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
+ pub fn aio_suspend(
+ aiocb_list: *const *const aiocb,
+ nitems: ::c_int,
+ timeout: *const ::timespec,
+ ) -> ::c_int;
+ pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
+ pub fn lio_listio(
+ mode: ::c_int,
+ aiocb_list: *const *mut aiocb,
+ nitems: ::c_int,
+ sevp: *mut ::sigevent,
+ ) -> ::c_int;
+ pub fn pwritev(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t,
+ ) -> ::ssize_t;
+ pub fn preadv(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off_t,
+ ) -> ::ssize_t;
+ pub fn getnameinfo(
+ sa: *const ::sockaddr,
+ salen: ::socklen_t,
+ host: *mut ::c_char,
+ hostlen: ::socklen_t,
+ serv: *mut ::c_char,
+ sevlen: ::socklen_t,
+ flags: ::c_int,
+ ) -> ::c_int;
+ pub fn getloadavg(
+ loadavg: *mut ::c_double,
+ nelem: ::c_int
+ ) -> ::c_int;
+ pub fn process_vm_readv(
+ pid: ::pid_t,
+ local_iov: *const ::iovec,
+ liovcnt: ::c_ulong,
+ remote_iov: *const ::iovec,
+ riovcnt: ::c_ulong,
+ flags: ::c_ulong,
+ ) -> isize;
+ pub fn process_vm_writev(
+ pid: ::pid_t,
+ local_iov: *const ::iovec,
+ liovcnt: ::c_ulong,
+ remote_iov: *const ::iovec,
+ riovcnt: ::c_ulong,
+ flags: ::c_ulong,
+ ) -> isize;
+ pub fn futimes(
+ fd: ::c_int,
+ times: *const ::timeval
+ ) -> ::c_int;
+ }
+ }
}
extern "C" {
#[cfg_attr(not(target_env = "musl"), link_name = "__xpg_strerror_r")]
- pub fn strerror_r(
- errnum: ::c_int,
- buf: *mut c_char,
- buflen: ::size_t,
- ) -> ::c_int;
+ pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
pub fn abs(i: ::c_int) -> ::c_int;
pub fn atof(s: *const ::c_char) -> ::c_double;
@@ -2420,24 +3012,6 @@ extern "C" {
pub fn rand() -> ::c_int;
pub fn srand(seed: ::c_uint);
- pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
- pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
- pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
- pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
- pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
- pub fn aio_suspend(
- aiocb_list: *const *const aiocb,
- nitems: ::c_int,
- timeout: *const ::timespec,
- ) -> ::c_int;
- pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
- pub fn lio_listio(
- mode: ::c_int,
- aiocb_list: *const *mut aiocb,
- nitems: ::c_int,
- sevp: *mut ::sigevent,
- ) -> ::c_int;
-
pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
pub fn setpwent();
@@ -2450,42 +3024,30 @@ extern "C" {
pub fn endspent();
pub fn getspent() -> *mut spwd;
- pub fn getspnam(__name: *const ::c_char) -> *mut spwd;
-
- pub fn shm_open(
- name: *const c_char,
- oflag: ::c_int,
- mode: mode_t,
+ pub fn getspnam(name: *const ::c_char) -> *mut spwd;
+ // Only `getspnam_r` is implemented for musl, out of all of the reenterant
+ // functions from `shadow.h`.
+ // https://git.musl-libc.org/cgit/musl/tree/include/shadow.h
+ pub fn getspnam_r(
+ name: *const ::c_char,
+ spbuf: *mut spwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ spbufp: *mut *mut spwd,
) -> ::c_int;
+ pub fn shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int;
+
// System V IPC
pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
- pub fn shmat(
- shmid: ::c_int,
- shmaddr: *const ::c_void,
- shmflg: ::c_int,
- ) -> *mut ::c_void;
+ 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 shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
pub fn ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
pub fn semget(key: ::key_t, nsems: ::c_int, semflag: ::c_int) -> ::c_int;
- pub fn semop(
- semid: ::c_int,
- sops: *mut ::sembuf,
- nsops: ::size_t,
- ) -> ::c_int;
- pub fn semctl(
- semid: ::c_int,
- semnum: ::c_int,
- cmd: ::c_int,
- ...
- ) -> ::c_int;
- pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds)
- -> ::c_int;
+ pub fn semop(semid: ::c_int, sops: *mut ::sembuf, nsops: ::size_t) -> ::c_int;
+ pub fn semctl(semid: ::c_int, semnum: ::c_int, cmd: ::c_int, ...) -> ::c_int;
+ pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds) -> ::c_int;
pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
pub fn msgrcv(
msqid: ::c_int,
@@ -2501,17 +3063,10 @@ extern "C" {
msgflg: ::c_int,
) -> ::c_int;
- pub fn mprotect(
- addr: *mut ::c_void,
- len: ::size_t,
- prot: ::c_int,
- ) -> ::c_int;
+ pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
pub fn __errno_location() -> *mut ::c_int;
- pub fn fopen64(
- filename: *const c_char,
- mode: *const c_char,
- ) -> *mut ::FILE;
+ pub fn fopen64(filename: *const c_char, mode: *const c_char) -> *mut ::FILE;
pub fn freopen64(
filename: *const c_char,
mode: *const c_char,
@@ -2520,39 +3075,13 @@ extern "C" {
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 fseeko64(stream: *mut ::FILE, offset: ::off64_t, whence: ::c_int) -> ::c_int;
pub fn ftello64(stream: *mut ::FILE) -> ::off64_t;
- pub fn fallocate(
- fd: ::c_int,
- mode: ::c_int,
- offset: ::off_t,
- len: ::off_t,
- ) -> ::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 readahead(
- fd: ::c_int,
- offset: ::off64_t,
- count: ::size_t,
- ) -> ::ssize_t;
+ pub fn fallocate(fd: ::c_int, mode: ::c_int, offset: ::off_t, len: ::off_t) -> ::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 readahead(fd: ::c_int, offset: ::off64_t, count: ::size_t) -> ::ssize_t;
pub fn getxattr(
path: *const c_char,
name: *const c_char,
@@ -2592,52 +3121,21 @@ extern "C" {
size: ::size_t,
flags: ::c_int,
) -> ::c_int;
- pub fn listxattr(
- path: *const c_char,
- list: *mut c_char,
- size: ::size_t,
- ) -> ::ssize_t;
- pub fn llistxattr(
- path: *const c_char,
- list: *mut c_char,
- size: ::size_t,
- ) -> ::ssize_t;
- pub fn flistxattr(
- filedes: ::c_int,
- list: *mut c_char,
- size: ::size_t,
- ) -> ::ssize_t;
+ pub fn listxattr(path: *const c_char, list: *mut c_char, size: ::size_t) -> ::ssize_t;
+ pub fn llistxattr(path: *const c_char, list: *mut c_char, size: ::size_t) -> ::ssize_t;
+ pub fn flistxattr(filedes: ::c_int, list: *mut c_char, size: ::size_t) -> ::ssize_t;
pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int;
pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int;
pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int;
- pub fn signalfd(
- fd: ::c_int,
- mask: *const ::sigset_t,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn signalfd(fd: ::c_int, mask: *const ::sigset_t, flags: ::c_int) -> ::c_int;
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_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 pwritev(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t,
- ) -> ::ssize_t;
- pub fn preadv(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t,
- ) -> ::ssize_t;
pub fn quotactl(
cmd: ::c_int,
special: *const ::c_char,
@@ -2674,11 +3172,7 @@ extern "C" {
abs_timeout: *const ::timespec,
) -> ::c_int;
pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
- pub fn mq_setattr(
- mqd: ::mqd_t,
- newattr: *const ::mq_attr,
- oldattr: *mut ::mq_attr,
- ) -> ::c_int;
+ pub fn mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int;
pub fn epoll_pwait(
epfd: ::c_int,
events: *mut ::epoll_event,
@@ -2688,59 +3182,27 @@ extern "C" {
) -> ::c_int;
pub fn dup3(oldfd: ::c_int, newfd: ::c_int, flags: ::c_int) -> ::c_int;
pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
- pub fn mkostemps(
- template: *mut ::c_char,
- suffixlen: ::c_int,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int;
pub fn sigtimedwait(
set: *const sigset_t,
info: *mut siginfo_t,
timeout: *const ::timespec,
) -> ::c_int;
pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int;
- pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t)
- -> *mut ::c_char;
- pub fn getnameinfo(
- sa: *const ::sockaddr,
- salen: ::socklen_t,
- host: *mut ::c_char,
- hostlen: ::socklen_t,
- serv: *mut ::c_char,
- sevlen: ::socklen_t,
- flags: ::c_int,
- ) -> ::c_int;
- pub fn pthread_setschedprio(
- native: ::pthread_t,
- priority: ::c_int,
+ pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
+ pub fn accept4(
+ fd: ::c_int,
+ addr: *mut ::sockaddr,
+ len: *mut ::socklen_t,
+ flg: ::c_int,
) -> ::c_int;
- pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
- pub fn process_vm_readv(
- pid: ::pid_t,
- local_iov: *const ::iovec,
- liovcnt: ::c_ulong,
- remote_iov: *const ::iovec,
- riovcnt: ::c_ulong,
- flags: ::c_ulong,
- ) -> isize;
- pub fn process_vm_writev(
- pid: ::pid_t,
- local_iov: *const ::iovec,
- liovcnt: ::c_ulong,
- remote_iov: *const ::iovec,
- riovcnt: ::c_ulong,
- flags: ::c_ulong,
- ) -> isize;
+ pub fn pthread_setschedprio(native: ::pthread_t, priority: ::c_int) -> ::c_int;
pub fn reboot(how_to: ::c_int) -> ::c_int;
pub fn setfsgid(gid: ::gid_t) -> ::c_int;
pub fn setfsuid(uid: ::uid_t) -> ::c_int;
// Not available now on Android
- pub fn mkfifoat(
- dirfd: ::c_int,
- pathname: *const ::c_char,
- mode: ::mode_t,
- ) -> ::c_int;
+ pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int;
pub fn if_nameindex() -> *mut if_nameindex;
pub fn if_freenameindex(ptr: *mut if_nameindex);
pub fn sync_file_range(
@@ -2760,35 +3222,21 @@ extern "C" {
pub fn glob(
pattern: *const c_char,
flags: ::c_int,
- errfunc: ::Option<
- extern "C" fn(epath: *const c_char, errno: ::c_int) -> ::c_int,
- >,
+ errfunc: ::Option<extern "C" fn(epath: *const c_char, errno: ::c_int) -> ::c_int>,
pglob: *mut ::glob_t,
) -> ::c_int;
pub fn globfree(pglob: *mut ::glob_t);
- pub fn posix_madvise(
- addr: *mut ::c_void,
- len: ::size_t,
- advice: ::c_int,
- ) -> ::c_int;
+ pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
- pub fn madvise(
- addr: *mut ::c_void,
- len: ::size_t,
- advice: ::c_int,
- ) -> ::c_int;
+ pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
- pub fn msync(
- addr: *mut ::c_void,
- len: ::size_t,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
pub fn remap_file_pages(
addr: *mut ::c_void,
size: ::size_t,
@@ -2805,7 +3253,7 @@ extern "C" {
addrlen: *mut ::socklen_t,
) -> ::ssize_t;
pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
- pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int;
+
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
@@ -2813,11 +3261,8 @@ extern "C" {
pub fn vhangup() -> ::c_int;
pub fn sync();
pub fn syscall(num: ::c_long, ...) -> ::c_long;
- pub fn sched_getaffinity(
- pid: ::pid_t,
- cpusetsize: ::size_t,
- cpuset: *mut cpu_set_t,
- ) -> ::c_int;
+ pub fn sched_getaffinity(pid: ::pid_t, cpusetsize: ::size_t, cpuset: *mut cpu_set_t)
+ -> ::c_int;
pub fn sched_setaffinity(
pid: ::pid_t,
cpusetsize: ::size_t,
@@ -2831,12 +3276,8 @@ extern "C" {
maxevents: ::c_int,
timeout: ::c_int,
) -> ::c_int;
- pub fn epoll_ctl(
- epfd: ::c_int,
- op: ::c_int,
- fd: ::c_int,
- event: *mut ::epoll_event,
- ) -> ::c_int;
+ pub fn epoll_ctl(epfd: ::c_int, op: ::c_int, fd: ::c_int, event: *mut ::epoll_event)
+ -> ::c_int;
pub fn pthread_getschedparam(
native: ::pthread_t,
policy: *mut ::c_int,
@@ -2845,16 +3286,8 @@ extern "C" {
pub fn unshare(flags: ::c_int) -> ::c_int;
pub fn umount(target: *const ::c_char) -> ::c_int;
pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
- pub fn tee(
- fd_in: ::c_int,
- fd_out: ::c_int,
- len: ::size_t,
- flags: ::c_uint,
- ) -> ::ssize_t;
- pub fn settimeofday(
- tv: *const ::timeval,
- tz: *const ::timezone,
- ) -> ::c_int;
+ pub fn tee(fd_in: ::c_int, fd_out: ::c_int, len: ::size_t, flags: ::c_uint) -> ::ssize_t;
+ pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
pub fn splice(
fd_in: ::c_int,
off_in: *mut ::loff_t,
@@ -2864,19 +3297,12 @@ extern "C" {
flags: ::c_uint,
) -> ::ssize_t;
pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
- pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec)
- -> ::c_int;
- pub fn sem_timedwait(
- sem: *mut sem_t,
- abstime: *const ::timespec,
- ) -> ::c_int;
+ pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int;
pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int;
- pub fn sched_setparam(
- pid: ::pid_t,
- param: *const ::sched_param,
- ) -> ::c_int;
+ pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int;
pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int;
- pub fn swapoff(puath: *const ::c_char) -> ::c_int;
+ pub fn swapoff(path: *const ::c_char) -> ::c_int;
pub fn vmsplice(
fd: ::c_int,
iov: *const ::iovec,
@@ -2946,8 +3372,13 @@ extern "C" {
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 sigsuspend(mask: *const ::sigset_t) -> ::c_int;
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
pub fn getgrgid_r(
gid: ::gid_t,
grp: *mut ::group,
@@ -2955,15 +3386,9 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut ::group,
) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "sigaltstack$UNIX2003"
- )]
- #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
pub fn sem_close(sem: *mut sem_t) -> ::c_int;
pub fn getdtablesize() -> ::c_int;
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
pub fn getgrnam_r(
name: *const ::c_char,
grp: *mut ::group,
@@ -2972,23 +3397,13 @@ extern "C" {
result: *mut *mut ::group,
) -> ::c_int;
pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_sigmask$UNIX2003"
- )]
- pub fn pthread_sigmask(
- how: ::c_int,
- set: *const sigset_t,
- oldset: *mut sigset_t,
- ) -> ::c_int;
+ pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int;
pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int;
pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
pub fn getpwnam_r(
name: *const ::c_char,
pwd: *mut passwd,
@@ -2996,8 +3411,6 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut passwd,
) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
pub fn getpwuid_r(
uid: ::uid_t,
pwd: *mut passwd,
@@ -3005,11 +3418,6 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut passwd,
) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "sigwait$UNIX2003"
- )]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int;
pub fn pthread_atfork(
prepare: ::Option<unsafe extern "C" fn()>,
@@ -3027,10 +3435,6 @@ extern "C" {
attr: *const pthread_mutexattr_t,
pshared: *mut ::c_int,
) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "popen$UNIX2003"
- )]
pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
pub fn faccessat(
dirfd: ::c_int,
@@ -3055,17 +3459,11 @@ extern "C" {
data: *mut ::c_void,
) -> ::c_int;
- pub fn setmntent(
- filename: *const ::c_char,
- ty: *const ::c_char,
- ) -> *mut ::FILE;
+ pub fn setmntent(filename: *const ::c_char, ty: *const ::c_char) -> *mut ::FILE;
pub fn getmntent(stream: *mut ::FILE) -> *mut ::mntent;
pub fn addmntent(stream: *mut ::FILE, mnt: *const ::mntent) -> ::c_int;
pub fn endmntent(streamp: *mut ::FILE) -> ::c_int;
- pub fn hasmntopt(
- mnt: *const ::mntent,
- opt: *const ::c_char,
- ) -> *mut ::c_char;
+ pub fn hasmntopt(mnt: *const ::mntent, opt: *const ::c_char) -> *mut ::c_char;
pub fn posix_spawn(
pid: *mut ::pid_t,
@@ -3105,26 +3503,17 @@ extern "C" {
attr: *const posix_spawnattr_t,
flags: *mut ::c_short,
) -> ::c_int;
- pub fn posix_spawnattr_setflags(
- attr: *mut posix_spawnattr_t,
- flags: ::c_short,
- ) -> ::c_int;
+ pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: ::c_short) -> ::c_int;
pub fn posix_spawnattr_getpgroup(
attr: *const posix_spawnattr_t,
flags: *mut ::pid_t,
) -> ::c_int;
- pub fn posix_spawnattr_setpgroup(
- attr: *mut posix_spawnattr_t,
- flags: ::pid_t,
- ) -> ::c_int;
+ pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: ::pid_t) -> ::c_int;
pub fn posix_spawnattr_getschedpolicy(
attr: *const posix_spawnattr_t,
flags: *mut ::c_int,
) -> ::c_int;
- pub fn posix_spawnattr_setschedpolicy(
- attr: *mut posix_spawnattr_t,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: ::c_int) -> ::c_int;
pub fn posix_spawnattr_getschedparam(
attr: *const posix_spawnattr_t,
param: *mut ::sched_param,
@@ -3134,12 +3523,8 @@ extern "C" {
param: *const ::sched_param,
) -> ::c_int;
- pub fn posix_spawn_file_actions_init(
- actions: *mut posix_spawn_file_actions_t,
- ) -> ::c_int;
- pub fn posix_spawn_file_actions_destroy(
- actions: *mut posix_spawn_file_actions_t,
- ) -> ::c_int;
+ pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> ::c_int;
+ pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> ::c_int;
pub fn posix_spawn_file_actions_addopen(
actions: *mut posix_spawn_file_actions_t,
fd: ::c_int,
@@ -3165,15 +3550,46 @@ extern "C" {
pub fn inotify_rm_watch(fd: ::c_int, wd: ::c_int) -> ::c_int;
pub fn inotify_init() -> ::c_int;
pub fn inotify_init1(flags: ::c_int) -> ::c_int;
- pub fn inotify_add_watch(
- fd: ::c_int,
- path: *const ::c_char,
- mask: u32,
+ pub fn inotify_add_watch(fd: ::c_int, path: *const ::c_char, mask: u32) -> ::c_int;
+ pub fn fanotify_init(flags: ::c_uint, event_f_flags: ::c_uint) -> ::c_int;
+
+ pub fn regcomp(preg: *mut ::regex_t, pattern: *const ::c_char, cflags: ::c_int) -> ::c_int;
+
+ pub fn regexec(
+ preg: *const ::regex_t,
+ input: *const ::c_char,
+ nmatch: ::size_t,
+ pmatch: *mut regmatch_t,
+ eflags: ::c_int,
) -> ::c_int;
+
+ pub fn regerror(
+ errcode: ::c_int,
+ preg: *const ::regex_t,
+ errbuf: *mut ::c_char,
+ errbuf_size: ::size_t,
+ ) -> ::size_t;
+
+ pub fn regfree(preg: *mut ::regex_t);
+
+ pub fn iconv_open(tocode: *const ::c_char, fromcode: *const ::c_char) -> iconv_t;
+ pub fn iconv(
+ cd: iconv_t,
+ inbuf: *mut *mut ::c_char,
+ inbytesleft: *mut ::size_t,
+ outbuf: *mut *mut ::c_char,
+ outbytesleft: *mut ::size_t,
+ ) -> ::size_t;
+ pub fn iconv_close(cd: iconv_t) -> ::c_int;
+
+ pub fn gettid() -> ::pid_t;
}
cfg_if! {
- if #[cfg(target_env = "musl")] {
+ if #[cfg(target_env = "uclibc")] {
+ mod uclibc;
+ pub use self::uclibc::*;
+ } else if #[cfg(target_env = "musl")] {
mod musl;
pub use self::musl::*;
} else if #[cfg(target_env = "gnu")] {
@@ -3182,6 +3598,9 @@ cfg_if! {
}
}
+mod arch;
+pub use self::arch::*;
+
cfg_if! {
if #[cfg(libc_align)] {
#[macro_use]
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 ff236887..1f952c31 100644
--- a/src/unix/linux_like/linux/musl/b32/arm/mod.rs
+++ b/src/unix/linux_like/linux/musl/b32/arm/mod.rs
@@ -262,13 +262,12 @@ pub const MAP_NORESERVE: ::c_int = 0x04000;
pub const MAP_POPULATE: ::c_int = 0x08000;
pub const MAP_NONBLOCK: ::c_int = 0x010000;
pub const MAP_STACK: ::c_int = 0x020000;
+pub const 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 SOL_SOCKET: ::c_int = 1;
-
pub const EDEADLK: ::c_int = 35;
pub const ENAMETOOLONG: ::c_int = 36;
pub const ENOLCK: ::c_int = 37;
@@ -355,32 +354,6 @@ pub const ENOTRECOVERABLE: ::c_int = 131;
pub const ERFKILL: ::c_int = 132;
pub const EHWPOISON: ::c_int = 133;
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_TYPE: ::c_int = 3;
-pub const SO_ERROR: ::c_int = 4;
-pub const SO_DONTROUTE: ::c_int = 5;
-pub const SO_BROADCAST: ::c_int = 6;
-pub const SO_SNDBUF: ::c_int = 7;
-pub const SO_RCVBUF: ::c_int = 8;
-pub const SO_KEEPALIVE: ::c_int = 9;
-pub const SO_OOBINLINE: ::c_int = 10;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_LINGER: ::c_int = 13;
-pub const SO_BSDCOMPAT: ::c_int = 14;
-pub const SO_REUSEPORT: ::c_int = 15;
-pub const SO_PASSCRED: ::c_int = 16;
-pub const SO_PEERCRED: ::c_int = 17;
-pub const SO_RCVLOWAT: ::c_int = 18;
-pub const SO_SNDLOWAT: ::c_int = 19;
-pub const SO_RCVTIMEO: ::c_int = 20;
-pub const SO_SNDTIMEO: ::c_int = 21;
-pub const SO_ACCEPTCONN: ::c_int = 30;
-pub const SO_SNDBUFFORCE: ::c_int = 32;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_PROTOCOL: ::c_int = 38;
-pub const SO_DOMAIN: ::c_int = 39;
-
pub const SA_ONSTACK: ::c_int = 0x08000000;
pub const SA_SIGINFO: ::c_int = 0x00000004;
pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
@@ -418,6 +391,9 @@ 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;
@@ -828,13 +804,28 @@ pub const SYS_pkey_mprotect: ::c_long = 394;
pub const SYS_pkey_alloc: ::c_long = 395;
pub const SYS_pkey_free: ::c_long = 396;
pub const SYS_statx: ::c_long = 397;
+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;
extern "C" {
- pub fn getrandom(
- buf: *mut ::c_void,
- buflen: ::size_t,
- flags: ::c_uint,
- ) -> ::ssize_t;
+ pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
}
cfg_if! {
diff --git a/src/unix/linux_like/linux/musl/b32/hexagon.rs b/src/unix/linux_like/linux/musl/b32/hexagon.rs
index 23406955..a94ebb6a 100644
--- a/src/unix/linux_like/linux/musl/b32/hexagon.rs
+++ b/src/unix/linux_like/linux/musl/b32/hexagon.rs
@@ -222,6 +222,7 @@ pub const ESOCKTNOSUPPORT: ::c_int = 94;
pub const ESTALE: ::c_int = 116;
pub const ESTRPIPE: ::c_int = 86;
pub const ETOOMANYREFS: ::c_int = 109;
+pub const ETIMEDOUT: ::c_int = 110;
pub const EUCLEAN: ::c_int = 117;
pub const EUNATCH: ::c_int = 49;
pub const EUSERS: ::c_int = 87;
@@ -258,8 +259,6 @@ pub const MAP_ANON: ::c_int = 32;
pub const MAP_DENYWRITE: ::c_int = 2048;
pub const MAP_EXECUTABLE: ::c_int = 4096;
pub const MAP_GROWSDOWN: ::c_int = 256;
-pub const MAP_HUGE_MASK: ::c_int = 63;
-pub const MAP_HUGE_SHIFT: ::c_int = 26;
pub const MAP_HUGETLB: ::c_int = 262144;
pub const MAP_LOCKED: ::c_int = 8192;
pub const MAP_NONBLOCK: ::c_int = 65536;
@@ -301,6 +300,8 @@ pub const SIGPOLL: ::c_int = 29;
pub const SIGPROF: ::c_int = 27;
pub const SIGPWR: ::c_int = 30;
pub const SIGSTKFLT: ::c_int = 16;
+pub const SIGSTKSZ: ::size_t = 8192;
+pub const MINSIGSTKSZ: ::size_t = 2048;
pub const SIGSTOP: ::c_int = 19;
pub const SIGSYS: ::c_int = 31;
pub const SIGTSTP: ::c_int = 20;
@@ -316,65 +317,19 @@ pub const SIGXFSZ: ::c_int = 25;
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 SO_ACCEPTCONN: ::c_int = 30;
-pub const SO_ATTACH_BPF: ::c_int = 50;
-pub const SO_ATTACH_FILTER: ::c_int = 26;
-pub const SO_ATTACH_REUSEPORT_CBPF: ::c_int = 51;
-pub const SO_ATTACH_REUSEPORT_EBPF: ::c_int = 52;
-pub const SO_BPF_EXTENSIONS: ::c_int = 48;
-pub const SO_BROADCAST: ::c_int = 6;
-pub const SO_BSDCOMPAT: ::c_int = 14;
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 SO_CNX_ADVICE: ::c_int = 53;
-pub const SO_DETACH_BPF: ::c_int = 27;
-pub const SO_DETACH_FILTER: ::c_int = 27;
-pub const SO_DOMAIN: ::c_int = 39;
-pub const SO_DONTROUTE: ::c_int = 5;
-pub const SO_ERROR: ::c_int = 4;
-pub const SO_GET_FILTER: ::c_int = 26;
-pub const SO_INCOMING_CPU: ::c_int = 49;
-pub const SO_KEEPALIVE: ::c_int = 9;
pub const SOL_CAIF: ::c_int = 278;
-pub const SO_LINGER: ::c_int = 13;
pub const SOL_IUCV: ::c_int = 277;
pub const SOL_KCM: ::c_int = 281;
pub const SOL_NFC: ::c_int = 280;
-pub const SO_LOCK_FILTER: ::c_int = 44;
pub const SOL_PNPIPE: ::c_int = 275;
pub const SOL_PPPOL2TP: ::c_int = 273;
pub const SOL_RDS: ::c_int = 276;
pub const SOL_RXRPC: ::c_int = 272;
-pub const SOL_SOCKET: ::c_int = 1;
-pub const SO_MAX_PACING_RATE: ::c_int = 47;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_NOFCS: ::c_int = 43;
-pub const SO_OOBINLINE: ::c_int = 10;
-pub const SO_PASSCRED: ::c_int = 16;
-pub const SO_PASSSEC: ::c_int = 34;
-pub const SO_PEERCRED: ::c_int = 17;
-pub const SO_PEERNAME: ::c_int = 28;
-pub const SO_PEERSEC: ::c_int = 31;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_PROTOCOL: ::c_int = 38;
-pub const SO_RCVBUF: ::c_int = 8;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_RCVLOWAT: ::c_int = 18;
-pub const SO_RCVTIMEO: ::c_int = 20;
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_REUSEPORT: ::c_int = 15;
-pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22;
-pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
-pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
-pub const SO_SELECT_ERR_QUEUE: ::c_int = 45;
-pub const SO_SNDBUF: ::c_int = 7;
-pub const SO_SNDBUFFORCE: ::c_int = 32;
-pub const SO_SNDLOWAT: ::c_int = 19;
-pub const SO_SNDTIMEO: ::c_int = 21;
-pub const SO_TYPE: ::c_int = 3;
-pub const SO_WIFI_STATUS: ::c_int = 41;
+
pub const SYS3264_fadvise64: ::c_int = 223;
pub const SYS3264_fcntl: ::c_int = 25;
pub const SYS3264_fstatat: ::c_int = 79;
@@ -727,7 +682,6 @@ pub const TCSETX: ::c_int = 21555;
pub const TCSETXF: ::c_int = 21556;
pub const TCSETXW: ::c_int = 21557;
pub const TCXONC: ::c_int = 21514;
-pub const TIOCCBRK: ::c_int = 21544;
pub const TIOCCONS: ::c_int = 21533;
pub const TIOCEXCL: ::c_int = 21516;
pub const TIOCGETD: ::c_int = 21540;
@@ -771,7 +725,6 @@ pub const TIOCPKT_IOCTL: ::c_int = 64;
pub const TIOCPKT_NOSTOP: ::c_int = 16;
pub const TIOCPKT_START: ::c_int = 8;
pub const TIOCPKT_STOP: ::c_int = 4;
-pub const TIOCSBRK: ::c_int = 21543;
pub const TIOCSCTTY: ::c_int = 21518;
pub const TIOCSERCONFIG: ::c_int = 21587;
pub const TIOCSERGETLSR: ::c_int = 21593;
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 be113416..115ba53d 100644
--- a/src/unix/linux_like/linux/musl/b32/mips/mod.rs
+++ b/src/unix/linux_like/linux/musl/b32/mips/mod.rs
@@ -363,34 +363,6 @@ pub const SOCK_STREAM: ::c_int = 2;
pub const SOCK_DGRAM: ::c_int = 1;
pub const SOCK_SEQPACKET: ::c_int = 5;
-pub const SOL_SOCKET: ::c_int = 65535;
-
-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_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_RCVTIMEO: ::c_int = 0x1006;
-pub const SO_SNDTIMEO: ::c_int = 0x1005;
-pub const SO_ERROR: ::c_int = 0x1007;
-pub const SO_TYPE: ::c_int = 0x1008;
-pub const SO_ACCEPTCONN: ::c_int = 0x1009;
-pub const SO_PROTOCOL: ::c_int = 0x1028;
-pub const SO_DOMAIN: ::c_int = 0x1029;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_BSDCOMPAT: ::c_int = 14;
-pub const SO_PASSCRED: ::c_int = 17;
-pub const SO_PEERCRED: ::c_int = 18;
-pub const SO_SNDBUFFORCE: ::c_int = 31;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-
pub const SA_ONSTACK: ::c_int = 0x08000000;
pub const SA_SIGINFO: ::c_int = 8;
pub const SA_NOCLDWAIT: ::c_int = 0x10000;
@@ -428,6 +400,9 @@ 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;
@@ -840,6 +815,25 @@ pub const SYS_pkey_mprotect: ::c_long = 4000 + 363;
pub const SYS_pkey_alloc: ::c_long = 4000 + 364;
pub const SYS_pkey_free: ::c_long = 4000 + 365;
pub const SYS_statx: ::c_long = 4000 + 366;
+pub const SYS_pidfd_send_signal: ::c_long = 4000 + 424;
+pub const SYS_io_uring_setup: ::c_long = 4000 + 425;
+pub const SYS_io_uring_enter: ::c_long = 4000 + 426;
+pub const SYS_io_uring_register: ::c_long = 4000 + 427;
+pub const SYS_open_tree: ::c_long = 4000 + 428;
+pub const SYS_move_mount: ::c_long = 4000 + 429;
+pub const SYS_fsopen: ::c_long = 4000 + 430;
+pub const SYS_fsconfig: ::c_long = 4000 + 431;
+pub const SYS_fsmount: ::c_long = 4000 + 432;
+pub const SYS_fspick: ::c_long = 4000 + 433;
+pub const SYS_pidfd_open: ::c_long = 4000 + 434;
+pub const SYS_clone3: ::c_long = 4000 + 435;
+pub const SYS_close_range: ::c_long = 4000 + 436;
+pub const SYS_openat2: ::c_long = 4000 + 437;
+pub const SYS_pidfd_getfd: ::c_long = 4000 + 438;
+pub const SYS_faccessat2: ::c_long = 4000 + 439;
+pub const SYS_process_madvise: ::c_long = 4000 + 440;
+pub const SYS_epoll_pwait2: ::c_long = 4000 + 441;
+pub const SYS_mount_setattr: ::c_long = 4000 + 442;
cfg_if! {
if #[cfg(libc_align)] {
diff --git a/src/unix/linux_like/linux/musl/b32/mod.rs b/src/unix/linux_like/linux/musl/b32/mod.rs
index 7cf6da91..f54e5d9c 100644
--- a/src/unix/linux_like/linux/musl/b32/mod.rs
+++ b/src/unix/linux_like/linux/musl/b32/mod.rs
@@ -3,6 +3,7 @@ pub type c_ulong = u32;
pub type nlink_t = u32;
pub type blksize_t = ::c_long;
pub type __u64 = ::c_ulonglong;
+pub type regoff_t = ::c_int;
s! {
pub struct pthread_attr_t {
diff --git a/src/unix/linux_like/linux/musl/b32/powerpc.rs b/src/unix/linux_like/linux/musl/b32/powerpc.rs
index 6181b1cd..848d2d55 100644
--- a/src/unix/linux_like/linux/musl/b32/powerpc.rs
+++ b/src/unix/linux_like/linux/musl/b32/powerpc.rs
@@ -270,8 +270,6 @@ pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
pub const SOCK_SEQPACKET: ::c_int = 5;
-pub const SOL_SOCKET: ::c_int = 1;
-
pub const EDEADLK: ::c_int = 35;
pub const ENAMETOOLONG: ::c_int = 36;
pub const ENOLCK: ::c_int = 37;
@@ -358,32 +356,6 @@ pub const ENOTRECOVERABLE: ::c_int = 131;
pub const ERFKILL: ::c_int = 132;
pub const EHWPOISON: ::c_int = 133;
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_TYPE: ::c_int = 3;
-pub const SO_ERROR: ::c_int = 4;
-pub const SO_DONTROUTE: ::c_int = 5;
-pub const SO_BROADCAST: ::c_int = 6;
-pub const SO_SNDBUF: ::c_int = 7;
-pub const SO_RCVBUF: ::c_int = 8;
-pub const SO_KEEPALIVE: ::c_int = 9;
-pub const SO_OOBINLINE: ::c_int = 10;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_LINGER: ::c_int = 13;
-pub const SO_BSDCOMPAT: ::c_int = 14;
-pub const SO_REUSEPORT: ::c_int = 15;
-pub const SO_RCVLOWAT: ::c_int = 16;
-pub const SO_SNDLOWAT: ::c_int = 17;
-pub const SO_RCVTIMEO: ::c_int = 18;
-pub const SO_SNDTIMEO: ::c_int = 19;
-pub const SO_PASSCRED: ::c_int = 20;
-pub const SO_PEERCRED: ::c_int = 21;
-pub const SO_ACCEPTCONN: ::c_int = 30;
-pub const SO_SNDBUFFORCE: ::c_int = 32;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_PROTOCOL: ::c_int = 38;
-pub const SO_DOMAIN: ::c_int = 39;
-
pub const SA_ONSTACK: ::c_int = 0x08000000;
pub const SA_SIGINFO: ::c_int = 0x00000004;
pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
@@ -421,6 +393,9 @@ 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;
@@ -853,11 +828,26 @@ pub const SYS_statx: ::c_long = 383;
pub const SYS_pkey_alloc: ::c_long = 384;
pub const SYS_pkey_free: ::c_long = 385;
pub const SYS_pkey_mprotect: ::c_long = 386;
+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;
extern "C" {
- pub fn getrandom(
- buf: *mut ::c_void,
- buflen: ::size_t,
- flags: ::c_uint,
- ) -> ::ssize_t;
+ pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
}
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 fcd8ae41..d4cedbc5 100644
--- a/src/unix/linux_like/linux/musl/b32/x86/mod.rs
+++ b/src/unix/linux_like/linux/musl/b32/x86/mod.rs
@@ -322,13 +322,12 @@ pub const MAP_NORESERVE: ::c_int = 0x04000;
pub const MAP_POPULATE: ::c_int = 0x08000;
pub const MAP_NONBLOCK: ::c_int = 0x010000;
pub const MAP_STACK: ::c_int = 0x020000;
+pub const 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 SOL_SOCKET: ::c_int = 1;
-
pub const EDEADLK: ::c_int = 35;
pub const ENAMETOOLONG: ::c_int = 36;
pub const ENOLCK: ::c_int = 37;
@@ -415,32 +414,6 @@ pub const ENOTRECOVERABLE: ::c_int = 131;
pub const ERFKILL: ::c_int = 132;
pub const EHWPOISON: ::c_int = 133;
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_TYPE: ::c_int = 3;
-pub const SO_ERROR: ::c_int = 4;
-pub const SO_DONTROUTE: ::c_int = 5;
-pub const SO_BROADCAST: ::c_int = 6;
-pub const SO_SNDBUF: ::c_int = 7;
-pub const SO_RCVBUF: ::c_int = 8;
-pub const SO_KEEPALIVE: ::c_int = 9;
-pub const SO_OOBINLINE: ::c_int = 10;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_LINGER: ::c_int = 13;
-pub const SO_BSDCOMPAT: ::c_int = 14;
-pub const SO_REUSEPORT: ::c_int = 15;
-pub const SO_PASSCRED: ::c_int = 16;
-pub const SO_PEERCRED: ::c_int = 17;
-pub const SO_RCVLOWAT: ::c_int = 18;
-pub const SO_SNDLOWAT: ::c_int = 19;
-pub const SO_RCVTIMEO: ::c_int = 20;
-pub const SO_SNDTIMEO: ::c_int = 21;
-pub const SO_ACCEPTCONN: ::c_int = 30;
-pub const SO_SNDBUFFORCE: ::c_int = 32;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_PROTOCOL: ::c_int = 38;
-pub const SO_DOMAIN: ::c_int = 39;
-
pub const SA_ONSTACK: ::c_int = 0x08000000;
pub const SA_SIGINFO: ::c_int = 0x00000004;
pub const SA_NOCLDWAIT: ::c_int = 0x00000002;
@@ -479,6 +452,9 @@ 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;
@@ -918,6 +894,25 @@ pub const SYS_pkey_mprotect: ::c_long = 380;
pub const SYS_pkey_alloc: ::c_long = 381;
pub const SYS_pkey_free: ::c_long = 382;
pub const SYS_statx: ::c_long = 383;
+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;
// offsets in user_regs_structs, from sys/reg.h
pub const EBX: ::c_int = 0;
@@ -939,11 +934,7 @@ pub const UESP: ::c_int = 15;
pub const SS: ::c_int = 16;
extern "C" {
- pub fn getrandom(
- buf: *mut ::c_void,
- buflen: ::size_t,
- flags: ::c_uint,
- ) -> ::ssize_t;
+ pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
}
cfg_if! {
diff --git a/src/unix/linux_like/linux/musl/b64/aarch64/align.rs b/src/unix/linux_like/linux/musl/b64/aarch64/align.rs
index 8e949963..81c55c64 100644
--- a/src/unix/linux_like/linux/musl/b64/aarch64/align.rs
+++ b/src/unix/linux_like/linux/musl/b64/aarch64/align.rs
@@ -5,3 +5,23 @@ s_no_extra_traits! {
priv_: [f32; 8]
}
}
+
+s! {
+ pub struct ucontext_t {
+ pub uc_flags: ::c_ulong,
+ pub uc_link: *mut ucontext_t,
+ pub uc_stack: ::stack_t,
+ pub uc_sigmask: ::sigset_t,
+ pub uc_mcontext: mcontext_t,
+ }
+
+ #[repr(align(16))]
+ pub struct mcontext_t {
+ pub fault_address: ::c_ulong,
+ pub regs: [::c_ulong; 31],
+ pub sp: ::c_ulong,
+ pub pc: ::c_ulong,
+ pub pstate: ::c_ulong,
+ __reserved: [[u64; 32]; 16],
+ }
+}
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 876ff3c8..6aab650a 100644
--- a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs
+++ b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs
@@ -170,29 +170,10 @@ 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_SYNC: ::c_int = 0x080000;
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
-pub const SOL_SOCKET: ::c_int = 1;
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_TYPE: ::c_int = 3;
-pub const SO_ERROR: ::c_int = 4;
-pub const SO_DONTROUTE: ::c_int = 5;
-pub const SO_BROADCAST: ::c_int = 6;
-pub const SO_SNDBUF: ::c_int = 7;
-pub const SO_RCVBUF: ::c_int = 8;
-pub const SO_KEEPALIVE: ::c_int = 9;
-pub const SO_OOBINLINE: ::c_int = 10;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_LINGER: ::c_int = 13;
-pub const SO_BSDCOMPAT: ::c_int = 14;
-pub const SO_REUSEPORT: ::c_int = 15;
-pub const SO_ACCEPTCONN: ::c_int = 30;
-pub const SO_SNDBUFFORCE: ::c_int = 32;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_PROTOCOL: ::c_int = 38;
-pub const SO_DOMAIN: ::c_int = 39;
pub const SA_ONSTACK: ::c_int = 0x08000000;
pub const SA_SIGINFO: ::c_int = 0x00000004;
@@ -227,6 +208,9 @@ 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;
@@ -280,6 +264,10 @@ pub const SYS_umount2: ::c_long = 39;
pub const SYS_mount: ::c_long = 40;
pub const SYS_pivot_root: ::c_long = 41;
pub const SYS_nfsservctl: ::c_long = 42;
+pub const SYS_statfs: ::c_long = 43;
+pub const SYS_fstatfs: ::c_long = 44;
+pub const SYS_truncate: ::c_long = 45;
+pub const SYS_ftruncate: ::c_long = 46;
pub const SYS_fallocate: ::c_long = 47;
pub const SYS_faccessat: ::c_long = 48;
pub const SYS_chdir: ::c_long = 49;
@@ -507,6 +495,25 @@ 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_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 RLIMIT_NLIMITS: ::c_int = 15;
pub const TIOCINQ: ::c_int = ::FIONREAD;
@@ -584,12 +591,7 @@ pub const FIONCLEX: ::c_int = 0x5450;
pub const FIONBIO: ::c_int = 0x5421;
pub const EDEADLK: ::c_int = 35;
pub const EDEADLOCK: ::c_int = EDEADLK;
-pub const SO_PASSCRED: ::c_int = 16;
-pub const SO_PEERCRED: ::c_int = 17;
-pub const SO_RCVLOWAT: ::c_int = 18;
-pub const SO_SNDLOWAT: ::c_int = 19;
-pub const SO_RCVTIMEO: ::c_int = 20;
-pub const SO_SNDTIMEO: ::c_int = 21;
+
pub const EXTPROC: ::tcflag_t = 0x00010000;
pub const VEOL: usize = 11;
pub const VEOL2: usize = 16;
diff --git a/src/unix/linux_like/linux/musl/b64/mips64.rs b/src/unix/linux_like/linux/musl/b64/mips64.rs
index 2c410509..4605a07e 100644
--- a/src/unix/linux_like/linux/musl/b64/mips64.rs
+++ b/src/unix/linux_like/linux/musl/b64/mips64.rs
@@ -425,6 +425,25 @@ pub const SYS_pkey_mprotect: ::c_long = 5000 + 323;
pub const SYS_pkey_alloc: ::c_long = 5000 + 324;
pub const SYS_pkey_free: ::c_long = 5000 + 325;
pub const SYS_statx: ::c_long = 5000 + 326;
+pub const SYS_pidfd_send_signal: ::c_long = 5000 + 424;
+pub const SYS_io_uring_setup: ::c_long = 5000 + 425;
+pub const SYS_io_uring_enter: ::c_long = 5000 + 426;
+pub const SYS_io_uring_register: ::c_long = 5000 + 427;
+pub const SYS_open_tree: ::c_long = 5000 + 428;
+pub const SYS_move_mount: ::c_long = 5000 + 429;
+pub const SYS_fsopen: ::c_long = 5000 + 430;
+pub const SYS_fsconfig: ::c_long = 5000 + 431;
+pub const SYS_fsmount: ::c_long = 5000 + 432;
+pub const SYS_fspick: ::c_long = 5000 + 433;
+pub const SYS_pidfd_open: ::c_long = 5000 + 434;
+pub const SYS_clone3: ::c_long = 5000 + 435;
+pub const SYS_close_range: ::c_long = 5000 + 436;
+pub const SYS_openat2: ::c_long = 5000 + 437;
+pub const SYS_pidfd_getfd: ::c_long = 5000 + 438;
+pub const SYS_faccessat2: ::c_long = 5000 + 439;
+pub const SYS_process_madvise: ::c_long = 5000 + 440;
+pub const SYS_epoll_pwait2: ::c_long = 5000 + 441;
+pub const SYS_mount_setattr: ::c_long = 5000 + 442;
pub const O_DIRECT: ::c_int = 0x8000;
pub const O_DIRECTORY: ::c_int = 0x10000;
@@ -538,55 +557,6 @@ pub const MAP_HUGETLB: ::c_int = 0x080000;
pub const SOCK_STREAM: ::c_int = 2;
pub const SOCK_DGRAM: ::c_int = 1;
-pub const SOL_SOCKET: ::c_int = 0xffff;
-
-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_LINGER: ::c_int = 0x0080;
-pub const SO_OOBINLINE: ::c_int = 0x0100;
-pub const SO_REUSEPORT: ::c_int = 0x0200;
-pub const SO_TYPE: ::c_int = 0x1008;
-pub const SO_ERROR: ::c_int = 0x1007;
-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_ACCEPTCONN: ::c_int = 0x1009;
-pub const SO_PROTOCOL: ::c_int = 0x1028;
-pub const SO_DOMAIN: ::c_int = 0x1029;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_BSDCOMPAT: ::c_int = 14;
-pub const SO_PASSCRED: ::c_int = 17;
-pub const SO_PEERCRED: ::c_int = 18;
-pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22;
-pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
-pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
-pub const SO_ATTACH_FILTER: ::c_int = 26;
-pub const SO_DETACH_FILTER: ::c_int = 27;
-pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
-pub const SO_PEERNAME: ::c_int = 28;
-pub const SO_PEERSEC: ::c_int = 30;
-pub const SO_SNDBUFFORCE: ::c_int = 31;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_PASSSEC: ::c_int = 34;
-pub const SO_TIMESTAMPNS: ::c_int = 35;
-pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
-pub const SO_WIFI_STATUS: ::c_int = 41;
-pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS;
-pub const SO_NOFCS: ::c_int = 43;
-pub const SO_LOCK_FILTER: ::c_int = 44;
-pub const SO_SELECT_ERR_QUEUE: ::c_int = 45;
-pub const SO_MAX_PACING_RATE: ::c_int = 47;
-pub const SO_BPF_EXTENSIONS: ::c_int = 48;
-pub const SO_INCOMING_CPU: ::c_int = 49;
-pub const SO_ATTACH_BPF: ::c_int = 50;
-pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER;
-
pub const FIOCLEX: ::c_int = 0x6601;
pub const FIONCLEX: ::c_int = 0x6602;
pub const FIONBIO: ::c_int = 0x667e;
@@ -635,38 +605,41 @@ 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 TCGETS: ::c_ulong = 0x540d;
-pub const TCSETS: ::c_ulong = 0x540e;
-pub const TCSETSW: ::c_ulong = 0x540f;
-pub const TCSETSF: ::c_ulong = 0x5410;
-pub const TCGETA: ::c_ulong = 0x5401;
-pub const TCSETA: ::c_ulong = 0x5402;
-pub const TCSETAW: ::c_ulong = 0x5403;
-pub const TCSETAF: ::c_ulong = 0x5404;
-pub const TCSBRK: ::c_ulong = 0x5405;
-pub const TCXONC: ::c_ulong = 0x5406;
-pub const TCFLSH: ::c_ulong = 0x5407;
-pub const TIOCGSOFTCAR: ::c_ulong = 0x5481;
-pub const TIOCSSOFTCAR: ::c_ulong = 0x5482;
-pub const TIOCINQ: ::c_ulong = 0x467f;
-pub const TIOCLINUX: ::c_ulong = 0x5483;
-pub const TIOCGSERIAL: ::c_ulong = 0x5484;
-pub const TIOCEXCL: ::c_ulong = 0x740d;
-pub const TIOCNXCL: ::c_ulong = 0x740e;
-pub const TIOCSCTTY: ::c_ulong = 0x5480;
-pub const TIOCGPGRP: ::c_ulong = 0x40047477;
-pub const TIOCSPGRP: ::c_ulong = 0x80047476;
-pub const TIOCOUTQ: ::c_ulong = 0x7472;
-pub const TIOCSTI: ::c_ulong = 0x5472;
-pub const TIOCGWINSZ: ::c_ulong = 0x40087468;
-pub const TIOCSWINSZ: ::c_ulong = 0x80087467;
-pub const TIOCMGET: ::c_ulong = 0x741d;
-pub const TIOCMBIS: ::c_ulong = 0x741b;
-pub const TIOCMBIC: ::c_ulong = 0x741c;
-pub const TIOCMSET: ::c_ulong = 0x741a;
-pub const FIONREAD: ::c_ulong = 0x467f;
-pub const TIOCCONS: ::c_ulong = 0x80047478;
+pub const TCGETS: ::c_int = 0x540d;
+pub const TCSETS: ::c_int = 0x540e;
+pub const TCSETSW: ::c_int = 0x540f;
+pub const TCSETSF: ::c_int = 0x5410;
+pub const TCGETA: ::c_int = 0x5401;
+pub const TCSETA: ::c_int = 0x5402;
+pub const TCSETAW: ::c_int = 0x5403;
+pub const TCSETAF: ::c_int = 0x5404;
+pub const TCSBRK: ::c_int = 0x5405;
+pub const TCXONC: ::c_int = 0x5406;
+pub const TCFLSH: ::c_int = 0x5407;
+pub const TIOCGSOFTCAR: ::c_int = 0x5481;
+pub const TIOCSSOFTCAR: ::c_int = 0x5482;
+pub const TIOCINQ: ::c_int = 0x467f;
+pub const TIOCLINUX: ::c_int = 0x5483;
+pub const TIOCGSERIAL: ::c_int = 0x5484;
+pub const TIOCEXCL: ::c_int = 0x740d;
+pub const TIOCNXCL: ::c_int = 0x740e;
+pub const TIOCSCTTY: ::c_int = 0x5480;
+pub const TIOCGPGRP: ::c_int = 0x40047477;
+pub const TIOCSPGRP: ::c_int = 0x80047476_u32 as i32;
+pub const TIOCOUTQ: ::c_int = 0x7472;
+pub const TIOCSTI: ::c_int = 0x5472;
+pub const TIOCGWINSZ: ::c_int = 0x40087468;
+pub const TIOCSWINSZ: ::c_int = 0x80087467_u32 as i32;
+pub const TIOCMGET: ::c_int = 0x741d;
+pub const TIOCMBIS: ::c_int = 0x741b;
+pub const TIOCMBIC: ::c_int = 0x741c;
+pub const TIOCMSET: ::c_int = 0x741a;
+pub const FIONREAD: ::c_int = 0x467f;
+pub const TIOCCONS: ::c_int = 0x80047478_u32 as i32;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
diff --git a/src/unix/linux_like/linux/musl/b64/mod.rs b/src/unix/linux_like/linux/musl/b64/mod.rs
index e6a8fc81..cfcdaaec 100644
--- a/src/unix/linux_like/linux/musl/b64/mod.rs
+++ b/src/unix/linux_like/linux/musl/b64/mod.rs
@@ -1,5 +1,6 @@
pub type c_long = i64;
pub type c_ulong = u64;
+pub type regoff_t = ::c_long;
s! {
pub struct statfs64 {
@@ -143,11 +144,7 @@ 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;
+ pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
}
cfg_if! {
@@ -160,6 +157,9 @@ cfg_if! {
} else if #[cfg(any(target_arch = "powerpc64"))] {
mod powerpc64;
pub use self::powerpc64::*;
+ } else if #[cfg(any(target_arch = "s390x"))] {
+ mod s390x;
+ pub use self::s390x::*;
} else if #[cfg(any(target_arch = "x86_64"))] {
mod x86_64;
pub use self::x86_64::*;
diff --git a/src/unix/linux_like/linux/musl/b64/powerpc64.rs b/src/unix/linux_like/linux/musl/b64/powerpc64.rs
index d27d703a..daa5b11f 100644
--- a/src/unix/linux_like/linux/musl/b64/powerpc64.rs
+++ b/src/unix/linux_like/linux/musl/b64/powerpc64.rs
@@ -170,29 +170,10 @@ 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_SYNC: ::c_int = 0x080000;
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
-pub const SOL_SOCKET: ::c_int = 1;
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_TYPE: ::c_int = 3;
-pub const SO_ERROR: ::c_int = 4;
-pub const SO_DONTROUTE: ::c_int = 5;
-pub const SO_BROADCAST: ::c_int = 6;
-pub const SO_SNDBUF: ::c_int = 7;
-pub const SO_RCVBUF: ::c_int = 8;
-pub const SO_KEEPALIVE: ::c_int = 9;
-pub const SO_OOBINLINE: ::c_int = 10;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_LINGER: ::c_int = 13;
-pub const SO_BSDCOMPAT: ::c_int = 14;
-pub const SO_REUSEPORT: ::c_int = 15;
-pub const SO_ACCEPTCONN: ::c_int = 30;
-pub const SO_SNDBUFFORCE: ::c_int = 32;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_PROTOCOL: ::c_int = 38;
-pub const SO_DOMAIN: ::c_int = 39;
pub const SA_ONSTACK: ::c_int = 0x08000000;
pub const SA_SIGINFO: ::c_int = 0x00000004;
@@ -227,6 +208,9 @@ 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;
@@ -597,18 +581,32 @@ pub const SYS_preadv2: ::c_long = 380;
pub const SYS_pwritev2: ::c_long = 381;
pub const SYS_kexec_file_load: ::c_long = 382;
pub const SYS_statx: ::c_long = 383;
+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 FIOCLEX: ::c_int = 0x20006601;
pub const FIONCLEX: ::c_int = 0x20006602;
pub const FIONBIO: ::c_int = 0x8004667e;
pub const EDEADLK: ::c_int = 58;
pub const EDEADLOCK: ::c_int = EDEADLK;
-pub const SO_PASSCRED: ::c_int = 20;
-pub const SO_PEERCRED: ::c_int = 21;
-pub const SO_RCVLOWAT: ::c_int = 16;
-pub const SO_SNDLOWAT: ::c_int = 17;
-pub const SO_RCVTIMEO: ::c_int = 18;
-pub const SO_SNDTIMEO: ::c_int = 19;
+
pub const EXTPROC: ::tcflag_t = 0x10000000;
pub const VEOL: usize = 6;
pub const VEOL2: usize = 8;
diff --git a/src/unix/linux_like/linux/musl/b64/s390x.rs b/src/unix/linux_like/linux/musl/b64/s390x.rs
new file mode 100644
index 00000000..bd33bdbb
--- /dev/null
+++ b/src/unix/linux_like/linux/musl/b64/s390x.rs
@@ -0,0 +1,754 @@
+pub type blksize_t = i64;
+pub type c_char = u8;
+pub type nlink_t = u64;
+pub type wchar_t = i32;
+pub type greg_t = u64;
+pub type __u64 = u64;
+
+s! {
+ pub struct ipc_perm {
+ pub __ipc_perm_key: ::key_t,
+ pub uid: ::uid_t,
+ pub gid: ::gid_t,
+ pub cuid: ::uid_t,
+ pub cgid: ::gid_t,
+ pub mode: ::mode_t,
+ pub __seq: ::c_int,
+ __pad1: ::c_long,
+ __pad2: ::c_long,
+ }
+
+ pub struct stat {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino_t,
+ pub st_nlink: ::nlink_t,
+ pub st_mode: ::mode_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,
+ __unused: [::c_long; 3],
+ }
+
+ pub struct stat64 {
+ pub st_dev: ::dev_t,
+ pub st_ino: ::ino64_t,
+ pub st_nlink: ::nlink_t,
+ pub st_mode: ::mode_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: ::blkcnt64_t,
+ __unused: [::c_long; 3],
+ }
+
+ pub struct statfs {
+ pub f_type: ::c_ulong,
+ pub f_bsize: ::c_ulong,
+ pub f_blocks: ::fsblkcnt_t,
+ pub f_bfree: ::fsblkcnt_t,
+ pub f_bavail: ::fsblkcnt_t,
+ pub f_files: ::fsfilcnt_t,
+ pub f_ffree: ::fsfilcnt_t,
+ pub f_fsid: ::fsid_t,
+ pub f_namelen: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_flags: ::c_ulong,
+ pub f_spare: [::c_ulong; 4],
+ }
+
+ pub struct 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],
+ }
+}
+
+s_no_extra_traits! {
+ // FIXME: This is actually a union.
+ pub struct fpreg_t {
+ pub d: ::c_double,
+ // f: ::c_float,
+ }
+}
+
+cfg_if! {
+ if #[cfg(feature = "extra_traits")] {
+ impl PartialEq for fpreg_t {
+ fn eq(&self, other: &fpreg_t) -> bool {
+ self.d == other.d
+ }
+ }
+
+ impl Eq for fpreg_t {}
+
+ impl ::fmt::Debug for fpreg_t {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("fpreg_t")
+ .field("d", &self.d)
+ .finish()
+ }
+ }
+
+ impl ::hash::Hash for fpreg_t {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ let d: u64 = unsafe { ::mem::transmute(self.d) };
+ d.hash(state);
+ }
+ }
+ }
+}
+
+pub const VEOF: usize = 4;
+pub const RTLD_DEEPBIND: ::c_int = 0x8;
+
+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 EADDRINUSE: ::c_int = 98;
+pub const EADDRNOTAVAIL: ::c_int = 99;
+pub const ECONNABORTED: ::c_int = 103;
+pub const ECONNREFUSED: ::c_int = 111;
+pub const ECONNRESET: ::c_int = 104;
+pub const EDEADLK: ::c_int = 35;
+pub const ENOSYS: ::c_int = 38;
+pub const ENOTCONN: ::c_int = 107;
+pub const ETIMEDOUT: ::c_int = 110;
+pub const FIOCLEX: ::c_ulong = 0x5451;
+pub const FIONCLEX: ::c_ulong = 0x5450;
+pub const FIONBIO: ::c_ulong = 0x5421;
+pub const O_APPEND: ::c_int = 1024;
+pub const O_CREAT: ::c_int = 64;
+pub const O_EXCL: ::c_int = 128;
+pub const O_NONBLOCK: ::c_int = 2048;
+pub const SA_NOCLDWAIT: ::c_int = 2;
+pub const SA_ONSTACK: ::c_int = 0x08000000;
+pub const SA_SIGINFO: ::c_int = 4;
+pub const SIGBUS: ::c_int = 7;
+pub const SIGSTKSZ: ::size_t = 0x2000;
+pub const MINSIGSTKSZ: ::size_t = 2048;
+pub const SIG_SETMASK: ::c_int = 2;
+
+pub const SOCK_STREAM: ::c_int = 1;
+pub const SOCK_DGRAM: ::c_int = 2;
+
+pub const O_NOCTTY: ::c_int = 256;
+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_DIRECT: ::c_int = 0x4000;
+pub const O_DIRECTORY: ::c_int = 0x10000;
+pub const O_NOFOLLOW: ::c_int = 0x20000;
+
+pub const MADV_SOFT_OFFLINE: ::c_int = 101;
+pub const MAP_GROWSDOWN: ::c_int = 0x0100;
+pub const MAP_LOCKED: ::c_int = 0x02000;
+pub const MAP_NORESERVE: ::c_int = 0x04000;
+pub const MAP_ANON: ::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 EDEADLOCK: ::c_int = 35;
+pub const ENAMETOOLONG: ::c_int = 36;
+pub const ENOLCK: ::c_int = 37;
+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 ENETDOWN: ::c_int = 100;
+pub const ENETUNREACH: ::c_int = 101;
+pub const ENETRESET: ::c_int = 102;
+pub const ENOBUFS: ::c_int = 105;
+pub const EISCONN: ::c_int = 106;
+pub const ESHUTDOWN: ::c_int = 108;
+pub const ETOOMANYREFS: ::c_int = 109;
+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 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 SIGCHLD: ::c_int = 17;
+pub const SIGUSR1: ::c_int = 10;
+pub const SIGUSR2: ::c_int = 12;
+pub const SIGCONT: ::c_int = 18;
+pub const SIGSTOP: ::c_int = 19;
+pub const SIGTSTP: ::c_int = 20;
+pub const SIGURG: ::c_int = 23;
+pub const SIGIO: ::c_int = 29;
+pub const SIGSYS: ::c_int = 31;
+pub const SIGSTKFLT: ::c_int = 16;
+pub const SIGPOLL: ::c_int = 29;
+pub const SIGPWR: ::c_int = 30;
+pub const SIG_BLOCK: ::c_int = 0x000000;
+pub const SIG_UNBLOCK: ::c_int = 0x01;
+
+pub const O_ASYNC: ::c_int = 0x2000;
+
+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 MCL_CURRENT: ::c_int = 0x0001;
+pub const MCL_FUTURE: ::c_int = 0x0002;
+
+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 TCGETS: ::c_int = 0x5401;
+pub const TCSETS: ::c_int = 0x5402;
+pub const TCSETSW: ::c_int = 0x5403;
+pub const TCSETSF: ::c_int = 0x5404;
+pub const TCGETA: ::c_int = 0x5405;
+pub const TCSETA: ::c_int = 0x5406;
+pub const TCSETAW: ::c_int = 0x5407;
+pub const TCSETAF: ::c_int = 0x5408;
+pub const TCSBRK: ::c_int = 0x5409;
+pub const TCXONC: ::c_int = 0x540A;
+pub const TCFLSH: ::c_int = 0x540B;
+pub const TIOCGSOFTCAR: ::c_int = 0x5419;
+pub const TIOCSSOFTCAR: ::c_int = 0x541A;
+pub const TIOCINQ: ::c_int = 0x541B;
+pub const TIOCEXCL: ::c_int = 0x540C;
+pub const TIOCNXCL: ::c_int = 0x540D;
+pub const TIOCSCTTY: ::c_int = 0x540E;
+pub const TIOCGPGRP: ::c_int = 0x540F;
+pub const TIOCSPGRP: ::c_int = 0x5410;
+pub const TIOCOUTQ: ::c_int = 0x5411;
+pub const TIOCSTI: ::c_int = 0x5412;
+pub const TIOCGWINSZ: ::c_int = 0x5413;
+pub const TIOCSWINSZ: ::c_int = 0x5414;
+pub const TIOCMGET: ::c_int = 0x5415;
+pub const TIOCMBIS: ::c_int = 0x5416;
+pub const TIOCMBIC: ::c_int = 0x5417;
+pub const TIOCMSET: ::c_int = 0x5418;
+pub const FIONREAD: ::c_int = 0x541B;
+pub const TIOCCONS: ::c_int = 0x541D;
+
+pub const TIOCLINUX: ::c_int = 0x541C;
+pub const TIOCGSERIAL: ::c_int = 0x541E;
+pub const TIOCM_ST: ::c_int = 0x008;
+pub const TIOCM_SR: ::c_int = 0x010;
+pub const TIOCM_CTS: ::c_int = 0x020;
+pub const TIOCM_CAR: ::c_int = 0x040;
+pub const TIOCM_RNG: ::c_int = 0x080;
+pub const TIOCM_DSR: ::c_int = 0x100;
+
+pub const VTIME: usize = 5;
+pub const VSWTC: usize = 7;
+pub const VSTART: usize = 8;
+pub const VSTOP: usize = 9;
+pub const VSUSP: usize = 10;
+pub const VREPRINT: usize = 12;
+pub const VDISCARD: usize = 13;
+pub const VWERASE: usize = 14;
+pub const OLCUC: ::tcflag_t = 0o000002;
+pub const ONLCR: ::tcflag_t = 0o000004;
+pub const NLDLY: ::tcflag_t = 0o000400;
+pub const CRDLY: ::tcflag_t = 0o003000;
+pub const CR1: ::tcflag_t = 0x00000200;
+pub const CR2: ::tcflag_t = 0x00000400;
+pub const CR3: ::tcflag_t = 0x00000600;
+pub const TABDLY: ::tcflag_t = 0o014000;
+pub const TAB1: ::tcflag_t = 0x00000800;
+pub const TAB2: ::tcflag_t = 0x00001000;
+pub const TAB3: ::tcflag_t = 0x00001800;
+pub const BSDLY: ::tcflag_t = 0o020000;
+pub const BS1: ::tcflag_t = 0x00002000;
+pub const FFDLY: ::tcflag_t = 0o100000;
+pub const FF1: ::tcflag_t = 0x00008000;
+pub const VTDLY: ::tcflag_t = 0o040000;
+pub const VT1: ::tcflag_t = 0x00004000;
+pub const XTABS: ::tcflag_t = 0o014000;
+
+pub const CBAUD: ::speed_t = 0o010017;
+pub const CSIZE: ::tcflag_t = 0o000060;
+pub const CS6: ::tcflag_t = 0o000020;
+pub const CS7: ::tcflag_t = 0o000040;
+pub const CS8: ::tcflag_t = 0o000060;
+pub const CSTOPB: ::tcflag_t = 0o000100;
+pub const CREAD: ::tcflag_t = 0o000200;
+pub const PARENB: ::tcflag_t = 0o000400;
+pub const PARODD: ::tcflag_t = 0o001000;
+pub const HUPCL: ::tcflag_t = 0o002000;
+pub const CLOCAL: ::tcflag_t = 0o004000;
+pub const CBAUDEX: ::tcflag_t = 0o010000;
+pub const BOTHER: ::speed_t = 0o010000;
+pub const B57600: ::speed_t = 0o010001;
+pub const B115200: ::speed_t = 0o010002;
+pub const B230400: ::speed_t = 0o010003;
+pub const B460800: ::speed_t = 0o010004;
+pub const B500000: ::speed_t = 0o010005;
+pub const B576000: ::speed_t = 0o010006;
+pub const B921600: ::speed_t = 0o010007;
+pub const B1000000: ::speed_t = 0o010010;
+pub const B1152000: ::speed_t = 0o010011;
+pub const B1500000: ::speed_t = 0o010012;
+pub const B2000000: ::speed_t = 0o010013;
+pub const B2500000: ::speed_t = 0o010014;
+pub const B3000000: ::speed_t = 0o010015;
+pub const B3500000: ::speed_t = 0o010016;
+pub const B4000000: ::speed_t = 0o010017;
+pub const CIBAUD: ::tcflag_t = 0o02003600000;
+
+pub const ISIG: ::tcflag_t = 0o000001;
+pub const ICANON: ::tcflag_t = 0o000002;
+pub const XCASE: ::tcflag_t = 0o000004;
+pub const ECHOE: ::tcflag_t = 0o000020;
+pub const ECHOK: ::tcflag_t = 0o000040;
+pub const ECHONL: ::tcflag_t = 0o000100;
+pub const NOFLSH: ::tcflag_t = 0o000200;
+pub const ECHOCTL: ::tcflag_t = 0o001000;
+pub const ECHOPRT: ::tcflag_t = 0o002000;
+pub const ECHOKE: ::tcflag_t = 0o004000;
+pub const PENDIN: ::tcflag_t = 0o040000;
+
+pub const POLLWRNORM: ::c_short = 0x100;
+pub const POLLWRBAND: ::c_short = 0x200;
+
+pub const IXON: ::tcflag_t = 0o002000;
+pub const IXOFF: ::tcflag_t = 0o010000;
+
+pub const SYS_exit: ::c_long = 1;
+pub const SYS_fork: ::c_long = 2;
+pub const SYS_read: ::c_long = 3;
+pub const SYS_write: ::c_long = 4;
+pub const SYS_open: ::c_long = 5;
+pub const SYS_close: ::c_long = 6;
+pub const SYS_restart_syscall: ::c_long = 7;
+pub const SYS_creat: ::c_long = 8;
+pub const SYS_link: ::c_long = 9;
+pub const SYS_unlink: ::c_long = 10;
+pub const SYS_execve: ::c_long = 11;
+pub const SYS_chdir: ::c_long = 12;
+pub const SYS_mknod: ::c_long = 14;
+pub const SYS_chmod: ::c_long = 15;
+pub const SYS_lseek: ::c_long = 19;
+pub const SYS_getpid: ::c_long = 20;
+pub const SYS_mount: ::c_long = 21;
+pub const SYS_umount: ::c_long = 22;
+pub const SYS_ptrace: ::c_long = 26;
+pub const SYS_alarm: ::c_long = 27;
+pub const SYS_pause: ::c_long = 29;
+pub const SYS_utime: ::c_long = 30;
+pub const SYS_access: ::c_long = 33;
+pub const SYS_nice: ::c_long = 34;
+pub const SYS_sync: ::c_long = 36;
+pub const SYS_kill: ::c_long = 37;
+pub const SYS_rename: ::c_long = 38;
+pub const SYS_mkdir: ::c_long = 39;
+pub const SYS_rmdir: ::c_long = 40;
+pub const SYS_dup: ::c_long = 41;
+pub const SYS_pipe: ::c_long = 42;
+pub const SYS_times: ::c_long = 43;
+pub const SYS_brk: ::c_long = 45;
+pub const SYS_signal: ::c_long = 48;
+pub const SYS_acct: ::c_long = 51;
+pub const SYS_umount2: ::c_long = 52;
+pub const SYS_ioctl: ::c_long = 54;
+pub const SYS_fcntl: ::c_long = 55;
+pub const SYS_setpgid: ::c_long = 57;
+pub const SYS_umask: ::c_long = 60;
+pub const SYS_chroot: ::c_long = 61;
+pub const SYS_ustat: ::c_long = 62;
+pub const SYS_dup2: ::c_long = 63;
+pub const SYS_getppid: ::c_long = 64;
+pub const SYS_getpgrp: ::c_long = 65;
+pub const SYS_setsid: ::c_long = 66;
+pub const SYS_sigaction: ::c_long = 67;
+pub const SYS_sigsuspend: ::c_long = 72;
+pub const SYS_sigpending: ::c_long = 73;
+pub const SYS_sethostname: ::c_long = 74;
+pub const SYS_setrlimit: ::c_long = 75;
+pub const SYS_getrusage: ::c_long = 77;
+pub const SYS_gettimeofday: ::c_long = 78;
+pub const SYS_settimeofday: ::c_long = 79;
+pub const SYS_symlink: ::c_long = 83;
+pub const SYS_readlink: ::c_long = 85;
+pub const SYS_uselib: ::c_long = 86;
+pub const SYS_swapon: ::c_long = 87;
+pub const SYS_reboot: ::c_long = 88;
+pub const SYS_readdir: ::c_long = 89;
+pub const SYS_mmap: ::c_long = 90;
+pub const SYS_munmap: ::c_long = 91;
+pub const SYS_truncate: ::c_long = 92;
+pub const SYS_ftruncate: ::c_long = 93;
+pub const SYS_fchmod: ::c_long = 94;
+pub const SYS_getpriority: ::c_long = 96;
+pub const SYS_setpriority: ::c_long = 97;
+pub const SYS_statfs: ::c_long = 99;
+pub const SYS_fstatfs: ::c_long = 100;
+pub const SYS_socketcall: ::c_long = 102;
+pub const SYS_syslog: ::c_long = 103;
+pub const SYS_setitimer: ::c_long = 104;
+pub const SYS_getitimer: ::c_long = 105;
+pub const SYS_stat: ::c_long = 106;
+pub const SYS_lstat: ::c_long = 107;
+pub const SYS_fstat: ::c_long = 108;
+pub const SYS_lookup_dcookie: ::c_long = 110;
+pub const SYS_vhangup: ::c_long = 111;
+pub const SYS_idle: ::c_long = 112;
+pub const SYS_wait4: ::c_long = 114;
+pub const SYS_swapoff: ::c_long = 115;
+pub const SYS_sysinfo: ::c_long = 116;
+pub const SYS_ipc: ::c_long = 117;
+pub const SYS_fsync: ::c_long = 118;
+pub const SYS_sigreturn: ::c_long = 119;
+pub const SYS_clone: ::c_long = 120;
+pub const SYS_setdomainname: ::c_long = 121;
+pub const SYS_uname: ::c_long = 122;
+pub const SYS_adjtimex: ::c_long = 124;
+pub const SYS_mprotect: ::c_long = 125;
+pub const SYS_sigprocmask: ::c_long = 126;
+pub const SYS_create_module: ::c_long = 127;
+pub const SYS_init_module: ::c_long = 128;
+pub const SYS_delete_module: ::c_long = 129;
+pub const SYS_get_kernel_syms: ::c_long = 130;
+pub const SYS_quotactl: ::c_long = 131;
+pub const SYS_getpgid: ::c_long = 132;
+pub const SYS_fchdir: ::c_long = 133;
+pub const SYS_bdflush: ::c_long = 134;
+pub const SYS_sysfs: ::c_long = 135;
+pub const SYS_personality: ::c_long = 136;
+pub const SYS_afs_syscall: ::c_long = 137; /* Syscall for Andrew File System */
+pub const SYS_getdents: ::c_long = 141;
+pub const SYS_flock: ::c_long = 143;
+pub const SYS_msync: ::c_long = 144;
+pub const SYS_readv: ::c_long = 145;
+pub const SYS_writev: ::c_long = 146;
+pub const SYS_getsid: ::c_long = 147;
+pub const SYS_fdatasync: ::c_long = 148;
+pub const SYS__sysctl: ::c_long = 149;
+pub const SYS_mlock: ::c_long = 150;
+pub const SYS_munlock: ::c_long = 151;
+pub const SYS_mlockall: ::c_long = 152;
+pub const SYS_munlockall: ::c_long = 153;
+pub const SYS_sched_setparam: ::c_long = 154;
+pub const SYS_sched_getparam: ::c_long = 155;
+pub const SYS_sched_setscheduler: ::c_long = 156;
+pub const SYS_sched_getscheduler: ::c_long = 157;
+pub const SYS_sched_yield: ::c_long = 158;
+pub const SYS_sched_get_priority_max: ::c_long = 159;
+pub const SYS_sched_get_priority_min: ::c_long = 160;
+pub const SYS_sched_rr_get_interval: ::c_long = 161;
+pub const SYS_nanosleep: ::c_long = 162;
+pub const SYS_mremap: ::c_long = 163;
+pub const SYS_query_module: ::c_long = 167;
+pub const SYS_poll: ::c_long = 168;
+pub const SYS_nfsservctl: ::c_long = 169;
+pub const SYS_prctl: ::c_long = 172;
+pub const SYS_rt_sigreturn: ::c_long = 173;
+pub const SYS_rt_sigaction: ::c_long = 174;
+pub const SYS_rt_sigprocmask: ::c_long = 175;
+pub const SYS_rt_sigpending: ::c_long = 176;
+pub const SYS_rt_sigtimedwait: ::c_long = 177;
+pub const SYS_rt_sigqueueinfo: ::c_long = 178;
+pub const SYS_rt_sigsuspend: ::c_long = 179;
+pub const SYS_pread64: ::c_long = 180;
+pub const SYS_pwrite64: ::c_long = 181;
+pub const SYS_getcwd: ::c_long = 183;
+pub const SYS_capget: ::c_long = 184;
+pub const SYS_capset: ::c_long = 185;
+pub const SYS_sigaltstack: ::c_long = 186;
+pub const SYS_sendfile: ::c_long = 187;
+pub const SYS_getpmsg: ::c_long = 188;
+pub const SYS_putpmsg: ::c_long = 189;
+pub const SYS_vfork: ::c_long = 190;
+pub const SYS_pivot_root: ::c_long = 217;
+pub const SYS_mincore: ::c_long = 218;
+pub const SYS_madvise: ::c_long = 219;
+pub const SYS_getdents64: ::c_long = 220;
+pub const SYS_readahead: ::c_long = 222;
+pub const SYS_setxattr: ::c_long = 224;
+pub const SYS_lsetxattr: ::c_long = 225;
+pub const SYS_fsetxattr: ::c_long = 226;
+pub const SYS_getxattr: ::c_long = 227;
+pub const SYS_lgetxattr: ::c_long = 228;
+pub const SYS_fgetxattr: ::c_long = 229;
+pub const SYS_listxattr: ::c_long = 230;
+pub const SYS_llistxattr: ::c_long = 231;
+pub const SYS_flistxattr: ::c_long = 232;
+pub const SYS_removexattr: ::c_long = 233;
+pub const SYS_lremovexattr: ::c_long = 234;
+pub const SYS_fremovexattr: ::c_long = 235;
+pub const SYS_gettid: ::c_long = 236;
+pub const SYS_tkill: ::c_long = 237;
+pub const SYS_futex: ::c_long = 238;
+pub const SYS_sched_setaffinity: ::c_long = 239;
+pub const SYS_sched_getaffinity: ::c_long = 240;
+pub const SYS_tgkill: ::c_long = 241;
+pub const SYS_io_setup: ::c_long = 243;
+pub const SYS_io_destroy: ::c_long = 244;
+pub const SYS_io_getevents: ::c_long = 245;
+pub const SYS_io_submit: ::c_long = 246;
+pub const SYS_io_cancel: ::c_long = 247;
+pub const SYS_exit_group: ::c_long = 248;
+pub const SYS_epoll_create: ::c_long = 249;
+pub const SYS_epoll_ctl: ::c_long = 250;
+pub const SYS_epoll_wait: ::c_long = 251;
+pub const SYS_set_tid_address: ::c_long = 252;
+pub const SYS_fadvise64: ::c_long = 253;
+pub const SYS_timer_create: ::c_long = 254;
+pub const SYS_timer_settime: ::c_long = 255;
+pub const SYS_timer_gettime: ::c_long = 256;
+pub const SYS_timer_getoverrun: ::c_long = 257;
+pub const SYS_timer_delete: ::c_long = 258;
+pub const SYS_clock_settime: ::c_long = 259;
+pub const SYS_clock_gettime: ::c_long = 260;
+pub const SYS_clock_getres: ::c_long = 261;
+pub const SYS_clock_nanosleep: ::c_long = 262;
+pub const SYS_statfs64: ::c_long = 265;
+pub const SYS_fstatfs64: ::c_long = 266;
+pub const SYS_remap_file_pages: ::c_long = 267;
+pub const SYS_mbind: ::c_long = 268;
+pub const SYS_get_mempolicy: ::c_long = 269;
+pub const SYS_set_mempolicy: ::c_long = 270;
+pub const SYS_mq_open: ::c_long = 271;
+pub const SYS_mq_unlink: ::c_long = 272;
+pub const SYS_mq_timedsend: ::c_long = 273;
+pub const SYS_mq_timedreceive: ::c_long = 274;
+pub const SYS_mq_notify: ::c_long = 275;
+pub const SYS_mq_getsetattr: ::c_long = 276;
+pub const SYS_kexec_load: ::c_long = 277;
+pub const SYS_add_key: ::c_long = 278;
+pub const SYS_request_key: ::c_long = 279;
+pub const SYS_keyctl: ::c_long = 280;
+pub const SYS_waitid: ::c_long = 281;
+pub const SYS_ioprio_set: ::c_long = 282;
+pub const SYS_ioprio_get: ::c_long = 283;
+pub const SYS_inotify_init: ::c_long = 284;
+pub const SYS_inotify_add_watch: ::c_long = 285;
+pub const SYS_inotify_rm_watch: ::c_long = 286;
+pub const SYS_migrate_pages: ::c_long = 287;
+pub const SYS_openat: ::c_long = 288;
+pub const SYS_mkdirat: ::c_long = 289;
+pub const SYS_mknodat: ::c_long = 290;
+pub const SYS_fchownat: ::c_long = 291;
+pub const SYS_futimesat: ::c_long = 292;
+pub const SYS_unlinkat: ::c_long = 294;
+pub const SYS_renameat: ::c_long = 295;
+pub const SYS_linkat: ::c_long = 296;
+pub const SYS_symlinkat: ::c_long = 297;
+pub const SYS_readlinkat: ::c_long = 298;
+pub const SYS_fchmodat: ::c_long = 299;
+pub const SYS_faccessat: ::c_long = 300;
+pub const SYS_pselect6: ::c_long = 301;
+pub const SYS_ppoll: ::c_long = 302;
+pub const SYS_unshare: ::c_long = 303;
+pub const SYS_set_robust_list: ::c_long = 304;
+pub const SYS_get_robust_list: ::c_long = 305;
+pub const SYS_splice: ::c_long = 306;
+pub const SYS_sync_file_range: ::c_long = 307;
+pub const SYS_tee: ::c_long = 308;
+pub const SYS_vmsplice: ::c_long = 309;
+pub const SYS_move_pages: ::c_long = 310;
+pub const SYS_getcpu: ::c_long = 311;
+pub const SYS_epoll_pwait: ::c_long = 312;
+pub const SYS_utimes: ::c_long = 313;
+pub const SYS_fallocate: ::c_long = 314;
+pub const SYS_utimensat: ::c_long = 315;
+pub const SYS_signalfd: ::c_long = 316;
+pub const SYS_timerfd: ::c_long = 317;
+pub const SYS_eventfd: ::c_long = 318;
+pub const SYS_timerfd_create: ::c_long = 319;
+pub const SYS_timerfd_settime: ::c_long = 320;
+pub const SYS_timerfd_gettime: ::c_long = 321;
+pub const SYS_signalfd4: ::c_long = 322;
+pub const SYS_eventfd2: ::c_long = 323;
+pub const SYS_inotify_init1: ::c_long = 324;
+pub const SYS_pipe2: ::c_long = 325;
+pub const SYS_dup3: ::c_long = 326;
+pub const SYS_epoll_create1: ::c_long = 327;
+pub const SYS_preadv: ::c_long = 328;
+pub const SYS_pwritev: ::c_long = 329;
+pub const SYS_rt_tgsigqueueinfo: ::c_long = 330;
+pub const SYS_perf_event_open: ::c_long = 331;
+pub const SYS_fanotify_init: ::c_long = 332;
+pub const SYS_fanotify_mark: ::c_long = 333;
+pub const SYS_prlimit64: ::c_long = 334;
+pub const SYS_name_to_handle_at: ::c_long = 335;
+pub const SYS_open_by_handle_at: ::c_long = 336;
+pub const SYS_clock_adjtime: ::c_long = 337;
+pub const SYS_syncfs: ::c_long = 338;
+pub const SYS_setns: ::c_long = 339;
+pub const SYS_process_vm_readv: ::c_long = 340;
+pub const SYS_process_vm_writev: ::c_long = 341;
+pub const SYS_s390_runtime_instr: ::c_long = 342;
+pub const SYS_kcmp: ::c_long = 343;
+pub const SYS_finit_module: ::c_long = 344;
+pub const SYS_sched_setattr: ::c_long = 345;
+pub const SYS_sched_getattr: ::c_long = 346;
+pub const SYS_renameat2: ::c_long = 347;
+pub const SYS_seccomp: ::c_long = 348;
+pub const SYS_getrandom: ::c_long = 349;
+pub const SYS_memfd_create: ::c_long = 350;
+pub const SYS_bpf: ::c_long = 351;
+pub const SYS_s390_pci_mmio_write: ::c_long = 352;
+pub const SYS_s390_pci_mmio_read: ::c_long = 353;
+pub const SYS_execveat: ::c_long = 354;
+pub const SYS_userfaultfd: ::c_long = 355;
+pub const SYS_membarrier: ::c_long = 356;
+pub const SYS_recvmmsg: ::c_long = 357;
+pub const SYS_sendmmsg: ::c_long = 358;
+pub const SYS_socket: ::c_long = 359;
+pub const SYS_socketpair: ::c_long = 360;
+pub const SYS_bind: ::c_long = 361;
+pub const SYS_connect: ::c_long = 362;
+pub const SYS_listen: ::c_long = 363;
+pub const SYS_accept4: ::c_long = 364;
+pub const SYS_getsockopt: ::c_long = 365;
+pub const SYS_setsockopt: ::c_long = 366;
+pub const SYS_getsockname: ::c_long = 367;
+pub const SYS_getpeername: ::c_long = 368;
+pub const SYS_sendto: ::c_long = 369;
+pub const SYS_sendmsg: ::c_long = 370;
+pub const SYS_recvfrom: ::c_long = 371;
+pub const SYS_recvmsg: ::c_long = 372;
+pub const SYS_shutdown: ::c_long = 373;
+pub const SYS_mlock2: ::c_long = 374;
+pub const SYS_copy_file_range: ::c_long = 375;
+pub const SYS_preadv2: ::c_long = 376;
+pub const SYS_pwritev2: ::c_long = 377;
+pub const SYS_lchown: ::c_long = 198;
+pub const SYS_setuid: ::c_long = 213;
+pub const SYS_getuid: ::c_long = 199;
+pub const SYS_setgid: ::c_long = 214;
+pub const SYS_getgid: ::c_long = 200;
+pub const SYS_geteuid: ::c_long = 201;
+pub const SYS_setreuid: ::c_long = 203;
+pub const SYS_setregid: ::c_long = 204;
+pub const SYS_getrlimit: ::c_long = 191;
+pub const SYS_getgroups: ::c_long = 205;
+pub const SYS_fchown: ::c_long = 207;
+pub const SYS_setresuid: ::c_long = 208;
+pub const SYS_setresgid: ::c_long = 210;
+pub const SYS_getresgid: ::c_long = 211;
+pub const SYS_select: ::c_long = 142;
+pub const SYS_getegid: ::c_long = 202;
+pub const SYS_setgroups: ::c_long = 206;
+pub const SYS_getresuid: ::c_long = 209;
+pub const SYS_chown: ::c_long = 212;
+pub const SYS_setfsuid: ::c_long = 215;
+pub const SYS_setfsgid: ::c_long = 216;
+pub const SYS_newfstatat: ::c_long = 293;
+pub const SYS_statx: ::c_long = 379;
+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;
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 ff9300c8..5c4b6bbb 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
@@ -580,6 +580,25 @@ pub const SYS_pkey_mprotect: ::c_long = 329;
pub const SYS_pkey_alloc: ::c_long = 330;
pub const SYS_pkey_free: ::c_long = 331;
pub const SYS_statx: ::c_long = 332;
+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;
// offsets in user_regs_structs, from sys/reg.h
pub const R15: ::c_int = 0;
@@ -777,6 +796,9 @@ 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;
@@ -785,26 +807,6 @@ pub const POLLWRBAND: ::c_short = 0x200;
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
-pub const SOL_SOCKET: ::c_int = 1;
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_TYPE: ::c_int = 3;
-pub const SO_ERROR: ::c_int = 4;
-pub const SO_DONTROUTE: ::c_int = 5;
-pub const SO_BROADCAST: ::c_int = 6;
-pub const SO_SNDBUF: ::c_int = 7;
-pub const SO_RCVBUF: ::c_int = 8;
-pub const SO_KEEPALIVE: ::c_int = 9;
-pub const SO_OOBINLINE: ::c_int = 10;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_LINGER: ::c_int = 13;
-pub const SO_BSDCOMPAT: ::c_int = 14;
-pub const SO_REUSEPORT: ::c_int = 15;
-pub const SO_ACCEPTCONN: ::c_int = 30;
-pub const SO_SNDBUFFORCE: ::c_int = 32;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_PROTOCOL: ::c_int = 38;
-pub const SO_DOMAIN: ::c_int = 39;
pub const MAP_ANON: ::c_int = 0x0020;
pub const MAP_GROWSDOWN: ::c_int = 0x0100;
@@ -816,6 +818,7 @@ 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_SYNC: ::c_int = 0x080000;
pub const RLIMIT_NLIMITS: ::c_int = 15;
pub const TIOCINQ: ::c_int = ::FIONREAD;
@@ -893,12 +896,7 @@ pub const FIONCLEX: ::c_int = 0x5450;
pub const FIONBIO: ::c_int = 0x5421;
pub const EDEADLK: ::c_int = 35;
pub const EDEADLOCK: ::c_int = EDEADLK;
-pub const SO_PASSCRED: ::c_int = 16;
-pub const SO_PEERCRED: ::c_int = 17;
-pub const SO_RCVLOWAT: ::c_int = 18;
-pub const SO_SNDLOWAT: ::c_int = 19;
-pub const SO_RCVTIMEO: ::c_int = 20;
-pub const SO_SNDTIMEO: ::c_int = 21;
+
pub const EXTPROC: ::tcflag_t = 0x00010000;
pub const VEOL: usize = 11;
pub const VEOL2: usize = 16;
diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs
index 2c5d375a..00f26475 100644
--- a/src/unix/linux_like/linux/musl/mod.rs
+++ b/src/unix/linux_like/linux/musl/mod.rs
@@ -1,5 +1,14 @@
pub type pthread_t = *mut ::c_void;
pub type clock_t = c_long;
+#[cfg_attr(
+ not(feature = "rustc-dep-of-std"),
+ deprecated(
+ since = "0.2.80",
+ note = "This type is changed to 64-bit in musl 1.2.0, \
+ we'll follow that change in the future release. \
+ See #1848 for more info."
+ )
+)]
pub type time_t = c_long;
pub type suseconds_t = c_long;
pub type ino_t = u64;
@@ -24,7 +33,6 @@ impl siginfo_t {
_si_code: ::c_int,
si_addr: *mut ::c_void,
}
-
(*(self as *const siginfo_t as *const siginfo_sigfault)).si_addr
}
@@ -38,11 +46,72 @@ impl siginfo_t {
_si_overrun: ::c_int,
si_value: ::sigval,
}
-
(*(self as *const siginfo_t as *const siginfo_si_value)).si_value
}
}
+cfg_if! {
+ if #[cfg(libc_union)] {
+ // Internal, for casts to access union fields
+ #[repr(C)]
+ struct sifields_sigchld {
+ si_pid: ::pid_t,
+ si_uid: ::uid_t,
+ si_status: ::c_int,
+ si_utime: ::c_long,
+ si_stime: ::c_long,
+ }
+ impl ::Copy for sifields_sigchld {}
+ impl ::Clone for sifields_sigchld {
+ fn clone(&self) -> sifields_sigchld {
+ *self
+ }
+ }
+
+ // Internal, for casts to access union fields
+ #[repr(C)]
+ union sifields {
+ _align_pointer: *mut ::c_void,
+ sigchld: sifields_sigchld,
+ }
+
+ // Internal, for casts to access union fields. Note that some variants
+ // of sifields start with a pointer, which makes the alignment of
+ // sifields vary on 32-bit and 64-bit architectures.
+ #[repr(C)]
+ struct siginfo_f {
+ _siginfo_base: [::c_int; 3],
+ sifields: sifields,
+ }
+
+ impl siginfo_t {
+ unsafe fn sifields(&self) -> &sifields {
+ &(*(self as *const siginfo_t as *const siginfo_f)).sifields
+ }
+
+ pub unsafe fn si_pid(&self) -> ::pid_t {
+ self.sifields().sigchld.si_pid
+ }
+
+ pub unsafe fn si_uid(&self) -> ::uid_t {
+ self.sifields().sigchld.si_uid
+ }
+
+ pub unsafe fn si_status(&self) -> ::c_int {
+ self.sifields().sigchld.si_status
+ }
+
+ pub unsafe fn si_utime(&self) -> ::c_long {
+ self.sifields().sigchld.si_utime
+ }
+
+ pub unsafe fn si_stime(&self) -> ::c_long {
+ self.sifields().sigchld.si_stime
+ }
+ }
+ }
+}
+
s! {
pub struct aiocb {
pub aio_fildes: ::c_int,
@@ -64,6 +133,24 @@ s! {
__dummy4: [::c_char; 16],
}
+ pub struct nlmsghdr {
+ pub nlmsg_len: u32,
+ pub nlmsg_type: u16,
+ pub nlmsg_flags: u16,
+ pub nlmsg_seq: u32,
+ pub nlmsg_pid: u32,
+ }
+
+ pub struct nlmsgerr {
+ pub error: ::c_int,
+ pub msg: nlmsghdr,
+ }
+
+ pub struct nlattr {
+ pub nla_len: u16,
+ pub nla_type: u16,
+ }
+
pub struct sigaction {
pub sa_sigaction: ::sighandler_t,
pub sa_mask: ::sigset_t,
@@ -109,6 +196,59 @@ s! {
pub l_len: ::off_t,
pub l_pid: ::pid_t,
}
+
+ pub struct regex_t {
+ __re_nsub: ::size_t,
+ __opaque: *mut ::c_void,
+ __padding: [*mut ::c_void; 4usize],
+ __nsub2: ::size_t,
+ __padding2: ::c_char,
+ }
+
+ pub struct rtentry {
+ pub rt_pad1: ::c_ulong,
+ pub rt_dst: ::sockaddr,
+ pub rt_gateway: ::sockaddr,
+ pub rt_genmask: ::sockaddr,
+ pub rt_flags: ::c_ushort,
+ pub rt_pad2: ::c_short,
+ pub rt_pad3: ::c_ulong,
+ pub rt_tos: ::c_uchar,
+ pub rt_class: ::c_uchar,
+ #[cfg(target_pointer_width = "64")]
+ pub rt_pad4: [::c_short; 3usize],
+ #[cfg(not(target_pointer_width = "64"))]
+ pub rt_pad4: [::c_short; 1usize],
+ pub rt_metric: ::c_short,
+ pub rt_dev: *mut ::c_char,
+ pub rt_mtu: ::c_ulong,
+ pub rt_window: ::c_ulong,
+ pub rt_irtt: ::c_ushort,
+ }
+
+ pub struct ip_mreqn {
+ pub imr_multiaddr: ::in_addr,
+ pub imr_address: ::in_addr,
+ pub imr_ifindex: ::c_int,
+ }
+
+ pub struct __exit_status {
+ pub e_termination: ::c_short,
+ pub e_exit: ::c_short,
+ }
+
+ pub struct Elf64_Chdr {
+ pub ch_type: ::Elf64_Word,
+ pub ch_reserved: ::Elf64_Word,
+ pub ch_size: ::Elf64_Xword,
+ pub ch_addralign: ::Elf64_Xword,
+ }
+
+ pub struct Elf32_Chdr {
+ pub ch_type: ::Elf32_Word,
+ pub ch_size: ::Elf32_Word,
+ pub ch_addralign: ::Elf32_Word,
+ }
}
s_no_extra_traits! {
@@ -128,6 +268,36 @@ s_no_extra_traits! {
pub mem_unit: ::c_uint,
pub __reserved: [::c_char; 256],
}
+
+ // FIXME: musl added paddings and adjusted
+ // layout in 1.2.0 but our CI is still 1.1.24.
+ // So, I'm leaving some fields as comments for now.
+ // ref. https://github.com/bminor/musl/commit/
+ // 1e7f0fcd7ff2096904fd93a2ee6d12a2392be392
+ pub struct utmpx {
+ pub ut_type: ::c_short,
+ //__ut_pad1: ::c_short,
+ pub ut_pid: ::pid_t,
+ pub ut_line: [::c_char; 32],
+ pub ut_id: [::c_char; 4],
+ pub ut_user: [::c_char; 32],
+ pub ut_host: [::c_char; 256],
+ pub ut_exit: __exit_status,
+
+ //#[cfg(target_endian = "little")]
+ pub ut_session: ::c_long,
+ //#[cfg(target_endian = "little")]
+ //__ut_pad2: ::c_long,
+
+ //#[cfg(not(target_endian = "little"))]
+ //__ut_pad2: ::c_int,
+ //#[cfg(not(target_endian = "little"))]
+ //pub ut_session: ::c_int,
+
+ pub ut_tv: ::timeval,
+ pub ut_addr_v6: [::c_uint; 4],
+ __unused: [::c_char; 20],
+ }
}
cfg_if! {
@@ -196,9 +366,95 @@ cfg_if! {
self.__reserved.hash(state);
}
}
+
+ impl PartialEq for utmpx {
+ fn eq(&self, other: &utmpx) -> bool {
+ self.ut_type == other.ut_type
+ //&& self.__ut_pad1 == other.__ut_pad1
+ && self.ut_pid == other.ut_pid
+ && self.ut_line == other.ut_line
+ && self.ut_id == other.ut_id
+ && self.ut_user == other.ut_user
+ && self
+ .ut_host
+ .iter()
+ .zip(other.ut_host.iter())
+ .all(|(a,b)| a == b)
+ && self.ut_exit == other.ut_exit
+ && self.ut_session == other.ut_session
+ //&& self.__ut_pad2 == other.__ut_pad2
+ && self.ut_tv == other.ut_tv
+ && self.ut_addr_v6 == other.ut_addr_v6
+ && self.__unused == other.__unused
+ }
+ }
+
+ impl Eq for utmpx {}
+
+ impl ::fmt::Debug for utmpx {
+ fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
+ f.debug_struct("utmpx")
+ .field("ut_type", &self.ut_type)
+ //.field("__ut_pad1", &self.__ut_pad1)
+ .field("ut_pid", &self.ut_pid)
+ .field("ut_line", &self.ut_line)
+ .field("ut_id", &self.ut_id)
+ .field("ut_user", &self.ut_user)
+ //FIXME: .field("ut_host", &self.ut_host)
+ .field("ut_exit", &self.ut_exit)
+ .field("ut_session", &self.ut_session)
+ //.field("__ut_pad2", &self.__ut_pad2)
+ .field("ut_tv", &self.ut_tv)
+ .field("ut_addr_v6", &self.ut_addr_v6)
+ .field("__unused", &self.__unused)
+ .finish()
+ }
+ }
+
+ impl ::hash::Hash for utmpx {
+ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
+ self.ut_type.hash(state);
+ //self.__ut_pad1.hash(state);
+ self.ut_pid.hash(state);
+ self.ut_line.hash(state);
+ self.ut_id.hash(state);
+ self.ut_user.hash(state);
+ self.ut_host.hash(state);
+ self.ut_exit.hash(state);
+ self.ut_session.hash(state);
+ //self.__ut_pad2.hash(state);
+ self.ut_tv.hash(state);
+ self.ut_addr_v6.hash(state);
+ self.__unused.hash(state);
+ }
+ }
}
}
+// include/sys/mman.h
+/*
+ * Huge page size encoding when MAP_HUGETLB is specified, and a huge page
+ * size other than the default is desired. See hugetlb_encode.h.
+ * All known huge page size encodings are provided here. It is the
+ * responsibility of the application to know which sizes are supported on
+ * the running system. See mmap(2) man page for details.
+ */
+pub const MAP_HUGE_SHIFT: ::c_int = 26;
+pub const MAP_HUGE_MASK: ::c_int = 0x3f;
+
+pub const MAP_HUGE_64KB: ::c_int = 16 << MAP_HUGE_SHIFT;
+pub const MAP_HUGE_512KB: ::c_int = 19 << MAP_HUGE_SHIFT;
+pub const MAP_HUGE_1MB: ::c_int = 20 << MAP_HUGE_SHIFT;
+pub const MAP_HUGE_2MB: ::c_int = 21 << MAP_HUGE_SHIFT;
+pub const MAP_HUGE_8MB: ::c_int = 23 << MAP_HUGE_SHIFT;
+pub const MAP_HUGE_16MB: ::c_int = 24 << MAP_HUGE_SHIFT;
+pub const MAP_HUGE_32MB: ::c_int = 25 << MAP_HUGE_SHIFT;
+pub const MAP_HUGE_256MB: ::c_int = 28 << MAP_HUGE_SHIFT;
+pub const MAP_HUGE_512MB: ::c_int = 29 << MAP_HUGE_SHIFT;
+pub const MAP_HUGE_1GB: ::c_int = 30 << MAP_HUGE_SHIFT;
+pub const MAP_HUGE_2GB: ::c_int = 31 << MAP_HUGE_SHIFT;
+pub const MAP_HUGE_16GB: ::c_int = 34 << MAP_HUGE_SHIFT;
+
pub const MS_RMT_MASK: ::c_ulong = 0x02800051;
pub const SFD_CLOEXEC: ::c_int = 0x080000;
@@ -241,6 +497,7 @@ pub const EFD_CLOEXEC: ::c_int = 0x80000;
pub const BUFSIZ: ::c_uint = 1024;
pub const TMP_MAX: ::c_uint = 10000;
pub const FOPEN_MAX: ::c_uint = 1000;
+pub const FILENAME_MAX: ::c_uint = 4096;
pub const O_PATH: ::c_int = 0o10000000;
pub const O_EXEC: ::c_int = 0o10000000;
pub const O_SEARCH: ::c_int = 0o10000000;
@@ -248,8 +505,6 @@ pub const O_ACCMODE: ::c_int = 0o10000003;
pub const O_NDELAY: ::c_int = O_NONBLOCK;
pub const NI_MAXHOST: ::socklen_t = 255;
pub const PTHREAD_STACK_MIN: ::size_t = 2048;
-pub const POSIX_FADV_DONTNEED: ::c_int = 4;
-pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
@@ -271,6 +526,7 @@ 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_FASTOPEN_CONNECT: ::c_int = 30;
#[deprecated(since = "0.2.55", note = "Use SIGSYS instead")]
pub const SIGUNUSED: ::c_int = ::SIGSYS;
@@ -311,10 +567,21 @@ pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
pub const PTRACE_LISTEN: ::c_int = 0x4208;
pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209;
-pub const EPOLLWAKEUP: ::c_int = 0x20000000;
-
-pub const SEEK_DATA: ::c_int = 3;
-pub const SEEK_HOLE: ::c_int = 4;
+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;
+pub const AF_VSOCK: ::c_int = 40;
+pub const AF_XDP: ::c_int = 44;
+pub const PF_IB: ::c_int = AF_IB;
+pub const PF_MPLS: ::c_int = AF_MPLS;
+pub const PF_NFC: ::c_int = AF_NFC;
+pub const PF_VSOCK: ::c_int = AF_VSOCK;
+pub const PF_XDP: ::c_int = AF_XDP;
pub const EFD_NONBLOCK: ::c_int = ::O_NONBLOCK;
@@ -327,10 +594,7 @@ pub const TCSAFLUSH: ::c_int = 2;
pub const RTLD_GLOBAL: ::c_int = 0x100;
pub const RTLD_NOLOAD: ::c_int = 0x4;
-// TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux
-// kernel 3.10). See also linux_like/mod.rs
pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
-pub const CLOCK_TAI: ::clockid_t = 11;
pub const B0: ::speed_t = 0o000000;
pub const B50: ::speed_t = 0o000001;
@@ -351,13 +615,6 @@ pub const B38400: ::speed_t = 0o000017;
pub const EXTA: ::speed_t = B19200;
pub const EXTB: ::speed_t = B38400;
-pub const SO_BINDTODEVICE: ::c_int = 25;
-pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SO_MARK: ::c_int = 36;
-pub const SO_RXQ_OVFL: ::c_int = 40;
-pub const SO_PEEK_OFF: ::c_int = 42;
-pub const SO_BUSY_POLL: ::c_int = 46;
-
pub const RLIMIT_CPU: ::c_int = 0;
pub const RLIMIT_FSIZE: ::c_int = 1;
pub const RLIMIT_DATA: ::c_int = 2;
@@ -369,6 +626,25 @@ pub const RLIMIT_MSGQUEUE: ::c_int = 12;
pub const RLIMIT_NICE: ::c_int = 13;
pub const RLIMIT_RTPRIO: ::c_int = 14;
+pub const REG_OK: ::c_int = 0;
+
+pub const TIOCSBRK: ::c_int = 0x5427;
+pub const TIOCCBRK: ::c_int = 0x5428;
+
+pub const PRIO_PROCESS: ::c_int = 0;
+pub const PRIO_PGRP: ::c_int = 1;
+pub const PRIO_USER: ::c_int = 2;
+
+cfg_if! {
+ if #[cfg(target_arch = "s390x")] {
+ pub const POSIX_FADV_DONTNEED: ::c_int = 6;
+ pub const POSIX_FADV_NOREUSE: ::c_int = 7;
+ } else {
+ pub const POSIX_FADV_DONTNEED: ::c_int = 4;
+ pub const POSIX_FADV_NOREUSE: ::c_int = 5;
+ }
+}
+
extern "C" {
pub fn sendmmsg(
sockfd: ::c_int,
@@ -416,13 +692,31 @@ extern "C" {
cpuset: *const ::cpu_set_t,
) -> ::c_int;
pub fn sched_getcpu() -> ::c_int;
+ pub fn memmem(
+ haystack: *const ::c_void,
+ haystacklen: ::size_t,
+ needle: *const ::c_void,
+ needlelen: ::size_t,
+ ) -> *mut ::c_void;
+ // Musl targets need the `mask` argument of `fanotify_mark` be specified
+ // `::c_ulonglong` instead of `u64` or there will be a type mismatch between
+ // `long long unsigned int` and the expected `uint64_t`.
+ pub fn fanotify_mark(
+ fd: ::c_int,
+ flags: ::c_uint,
+ mask: ::c_ulonglong,
+ dirfd: ::c_int,
+ path: *const ::c_char,
+ ) -> ::c_int;
+ pub fn getauxval(type_: ::c_ulong) -> ::c_ulong;
}
cfg_if! {
if #[cfg(any(target_arch = "x86_64",
target_arch = "aarch64",
target_arch = "mips64",
- target_arch = "powerpc64"))] {
+ target_arch = "powerpc64",
+ target_arch = "s390x"))] {
mod b64;
pub use self::b64::*;
} else if #[cfg(any(target_arch = "x86",
diff --git a/src/unix/linux_like/linux/no_align.rs b/src/unix/linux_like/linux/no_align.rs
index 13c2b71c..de64be5a 100644
--- a/src/unix/linux_like/linux/no_align.rs
+++ b/src/unix/linux_like/linux/no_align.rs
@@ -7,6 +7,8 @@ macro_rules! expand_align {
target_arch = "mips64",
target_arch = "s390x",
target_arch = "sparc64",
+ target_arch = "riscv64",
+ target_arch = "riscv32",
all(target_arch = "aarch64",
target_env = "musl")))]
__align: [::c_int; 0],
@@ -15,6 +17,8 @@ macro_rules! expand_align {
target_arch = "mips64",
target_arch = "s390x",
target_arch = "sparc64",
+ target_arch = "riscv64",
+ target_arch = "riscv32",
all(target_arch = "aarch64",
target_env = "musl"))))]
__align: [::c_long; 0],
@@ -33,6 +37,17 @@ macro_rules! expand_align {
__align: [::c_int; 0],
size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
}
+
+ pub struct fanotify_event_metadata {
+ __align: [::c_long; 0],
+ pub event_len: __u32,
+ pub vers: __u8,
+ pub reserved: __u8,
+ pub metadata_len: __u16,
+ pub mask: __u64,
+ pub fd: ::c_int,
+ pub pid: ::c_int,
+ }
}
s_no_extra_traits! {
diff --git a/src/unix/linux_like/linux/uclibc/align.rs b/src/unix/linux_like/linux/uclibc/align.rs
new file mode 100644
index 00000000..e6610bb7
--- /dev/null
+++ b/src/unix/linux_like/linux/uclibc/align.rs
@@ -0,0 +1,28 @@
+macro_rules! expand_align {
+ () => {
+ s! {
+ #[cfg_attr(any(target_pointer_width = "32",
+ target_arch = "x86_64",
+ target_arch = "powerpc64",
+ target_arch = "mips64",
+ target_arch = "s390x",
+ target_arch = "sparc64"),
+ repr(align(4)))]
+ #[cfg_attr(not(any(target_pointer_width = "32",
+ target_arch = "x86_64",
+ target_arch = "powerpc64",
+ target_arch = "mips64",
+ target_arch = "s390x",
+ target_arch = "sparc64")),
+ repr(align(8)))]
+ pub struct pthread_mutexattr_t {
+ size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T],
+ }
+
+ #[repr(align(4))]
+ pub struct pthread_condattr_t {
+ size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
+ }
+ }
+ };
+}
diff --git a/src/unix/uclibc/arm/align.rs b/src/unix/linux_like/linux/uclibc/arm/align.rs
index 4a0e0746..4a0e0746 100644
--- a/src/unix/uclibc/arm/align.rs
+++ b/src/unix/linux_like/linux/uclibc/arm/align.rs
diff --git a/src/unix/uclibc/arm/mod.rs b/src/unix/linux_like/linux/uclibc/arm/mod.rs
index 613a11fb..dc6518c0 100644
--- a/src/unix/uclibc/arm/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/arm/mod.rs
@@ -17,6 +17,10 @@ pub type nlink_t = ::c_uint;
pub type blksize_t = ::c_long;
pub type blkcnt_t = ::c_long;
+pub type fsblkcnt64_t = u64;
+pub type fsfilcnt64_t = u64;
+pub type __u64 = ::c_ulonglong;
+
s! {
pub struct cmsghdr {
pub cmsg_len: ::size_t,
@@ -52,13 +56,13 @@ s! {
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt_t,
pub st_atime: ::time_t,
- pub st_atime_nsec: ::c_ulong,
+ pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
- pub st_mtime_nsec: ::c_ulong,
+ pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
- pub st_ctime_nsec: ::c_ulong,
- pub __unused4: ::c_ulong,
- pub __unused5: ::c_ulong,
+ pub st_ctime_nsec: ::c_long,
+ pub __uclibc_unused4: ::c_ulong,
+ pub __uclibc_unused5: ::c_ulong,
}
pub struct stat64
@@ -76,11 +80,11 @@ s! {
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt64_t,
pub st_atime: ::time_t,
- pub st_atime_nsec: ::c_ulong,
+ pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
- pub st_mtime_nsec: ::c_ulong,
+ pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
- pub st_ctime_nsec: ::c_ulong,
+ pub st_ctime_nsec: ::c_long,
pub st_ino: ::ino64_t,
}
@@ -92,6 +96,23 @@ s! {
pub l_pid: ::pid_t,
}
+ pub struct sysinfo {
+ pub uptime: ::c_long,
+ pub loads: [::c_ulong; 3],
+ pub totalram: ::c_ulong,
+ pub freeram: ::c_ulong,
+ pub sharedram: ::c_ulong,
+ pub bufferram: ::c_ulong,
+ pub totalswap: ::c_ulong,
+ pub freeswap: ::c_ulong,
+ pub procs: ::c_ushort,
+ pub pad: ::c_ushort,
+ pub totalhigh: ::c_ulong,
+ pub freehigh: ::c_ulong,
+ pub mem_unit: ::c_uint,
+ pub _f: [::c_char; 8],
+ }
+
pub struct statfs {
pub f_type: ::c_int,
pub f_bsize: ::c_int,
@@ -104,7 +125,39 @@ s! {
pub f_fsid: ::fsid_t,
pub f_namelen: ::c_int,
pub f_frsize: ::c_int,
- pub f_spare: [::c_int; 5],
+ pub f_flags: ::c_int,
+ pub f_spare: [::c_int; 4],
+ }
+
+ pub struct statfs64 {
+ pub f_type: ::c_int,
+ pub f_bsize: ::c_int,
+ 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_namelen: ::c_int,
+ pub f_frsize: ::c_int,
+ pub f_flags: ::c_int,
+ pub f_spare: [::c_int; 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 sigset_t {
@@ -113,10 +166,8 @@ s! {
pub struct sigaction {
pub sa_sigaction: ::sighandler_t,
- // uClibc defines sa_flags as `unsigned long int`,
- // but nix crate expects `int`
- pub sa_flags: ::c_int,
- pub sa_restorer: *mut ::c_void,
+ pub sa_flags: ::c_ulong,
+ pub sa_restorer: ::Option<extern fn()>,
pub sa_mask: sigset_t,
}
@@ -154,49 +205,42 @@ s! {
pub __pad1: ::c_ushort,
pub __seq: ::c_ushort,
pub __pad2: ::c_ushort,
- pub __unused1: ::c_ulong,
- pub __unused2: ::c_ulong,
+ pub __uclibc_unused1: ::c_ulong,
+ pub __uclibc_unused2: ::c_ulong,
}
pub struct msqid_ds {
pub msg_perm: ::ipc_perm,
pub msg_stime: ::time_t,
- pub __unused1: ::c_ulong,
+ pub __uclibc_unused1: ::c_ulong,
pub msg_rtime: ::time_t,
- pub __unused2: ::c_ulong,
+ pub __uclibc_unused2: ::c_ulong,
pub msg_ctime: ::time_t,
- pub __unused3: ::c_ulong,
+ pub __uclibc_unused3: ::c_ulong,
pub __msg_cbytes: ::c_ulong,
pub msg_qnum: ::msgqnum_t,
pub msg_qbytes: ::msglen_t,
pub msg_lspid: ::pid_t,
pub msg_lrpid: ::pid_t,
- pub __unused4: ::c_ulong,
- pub __unused5: ::c_ulong,
+ pub __uclibc_unused4: ::c_ulong,
+ pub __uclibc_unused5: ::c_ulong,
}
pub struct shmid_ds {
pub shm_perm: ::ipc_perm,
pub shm_segsz: ::size_t,
pub shm_atime: ::time_t,
- pub __unused1: ::c_ulong,
+ pub __uclibc_unused1: ::c_ulong,
pub shm_dtime: ::time_t,
- pub __unused2: ::c_ulong,
+ pub __uclibc_unused2: ::c_ulong,
pub shm_ctime: ::time_t,
- pub __unused3: ::c_ulong,
+ pub __uclibc_unused3: ::c_ulong,
pub shm_cpid: ::pid_t,
pub shm_lpid: ::pid_t,
pub shm_nattch: ::shmatt_t,
- pub __unused4: ::c_ulong,
- pub __unused5: ::c_ulong,
+ pub __uclibc_unused4: ::c_ulong,
+ pub __uclibc_unused5: ::c_ulong,
}
-
- pub struct ucred {
- pub pid: ::pid_t,
- pub uid: ::uid_t,
- pub gid: ::gid_t,
- }
-
}
pub const O_CLOEXEC: ::c_int = 0o2000000;
@@ -214,33 +258,9 @@ pub const NCCS: usize = 32;
// I wasn't able to find those constants
// in uclibc build environment for armv7
-pub const AIO_ALLDONE: ::c_int = 2; // from linux/mod.rs
-pub const AIO_CANCELED: ::c_int = 0; // from linux/mod.rs
-pub const AIO_NOTCANCELED: ::c_int = 1; // from linux/mod.rs
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000; // from linux/mod.rs
-pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000; // from linux/mod.rs
-pub const EPOLLWAKEUP: ::c_int = 0x20000000; // from linux/other/mod.rs
-pub const EXTPROC: ::tcflag_t = 0o200000; // from asm-generic/termbits.h
-pub const F_GETPIPE_SZ: ::c_int = 1032; // from linux_like/mod.rs
-pub const F_SETPIPE_SZ: ::c_int = 1031; // from linux_like/mod.rs
-pub const LIO_NOP: ::c_int = 2; // from linux/mod.rs
-pub const LIO_NOWAIT: ::c_int = 1; // from linux/mod.rs
-pub const LIO_READ: ::c_int = 0; // from linux/mod.rs
-pub const LIO_WAIT: ::c_int = 0; // from linux/mod.rs
-pub const LIO_WRITE: ::c_int = 1; // from linux/mod.rs
pub const MAP_HUGETLB: ::c_int = 0x040000; // from linux/other/mod.rs
-pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
-pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32; // from linux/mod.rs
-pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32; // from linux/mod.rs
-pub const SO_BUSY_POLL: ::c_int = 46; // from src/unix/linux_like/mod.rs
-pub const SO_PEEK_OFF: ::c_int = 42; // from src/unix/linux_like/mod.rs
-pub const SO_REUSEPORT: ::c_int = 15; // from src/unix/linux_like/mod.rs
-pub const SOL_NETLINK: ::c_int = 270; // from src/unix/linux_like/mod.rs
-pub const _POSIX_VDISABLE: ::cc_t = 0; // from linux/mod.rs
-pub const AT_EMPTY_PATH: ::c_int = 0x1000; // from linux_like/mod.rs
// autogenerated constants with hand tuned types
-pub const AT_NO_AUTOMOUNT: ::c_int = 0x800;
pub const B0: ::speed_t = 0;
pub const B1000000: ::speed_t = 0x1008;
pub const B110: ::speed_t = 0x3;
@@ -278,7 +298,6 @@ pub const CBAUD: ::tcflag_t = 0x100f;
pub const CBAUDEX: ::tcflag_t = 0x1000;
pub const CIBAUD: ::tcflag_t = 0x100f0000;
pub const CLOCAL: ::tcflag_t = 0x800;
-pub const CMSPAR: ::tcflag_t = 0x40000000;
pub const CPU_SETSIZE: ::c_int = 0x400;
pub const CR1: ::c_int = 0x200;
pub const CR2: ::c_int = 0x400;
@@ -409,7 +428,6 @@ pub const HUPCL: ::tcflag_t = 0x400;
pub const ICANON: ::tcflag_t = 0x2;
pub const IEXTEN: ::tcflag_t = 0x8000;
pub const ISIG: ::tcflag_t = 0x1;
-pub const IUTF8: ::tcflag_t = 0x4000;
pub const IXOFF: ::tcflag_t = 0x1000;
pub const IXON: ::tcflag_t = 0x400;
pub const MAP_ANON: ::c_int = 0x20;
@@ -422,67 +440,45 @@ pub const MAP_NONBLOCK: ::c_int = 0x10000;
pub const MAP_NORESERVE: ::c_int = 0x4000;
pub const MAP_POPULATE: ::c_int = 0x8000;
pub const MAP_STACK: ::c_int = 0x20000;
-pub const MS_ACTIVE: u32 = 0x40000000;
-pub const MS_DIRSYNC: u32 = 0x80;
-pub const MS_I_VERSION: u32 = 0x800000;
-pub const MS_KERNMOUNT: u32 = 0x400000;
-pub const MS_MOVE: u32 = 0x2000;
-pub const MS_POSIXACL: u32 = 0x10000;
-pub const MS_PRIVATE: u32 = 0x40000;
-pub const MS_REC: u32 = 0x4000;
-pub const MS_RELATIME: u32 = 0x200000;
-pub const MS_SHARED: u32 = 0x100000;
-pub const MS_SILENT: u32 = 0x8000;
-pub const MS_SLAVE: u32 = 0x80000;
-pub const MS_STRICTATIME: u32 = 0x1000000;
-pub const MS_UNBINDABLE: u32 = 0x20000;
pub const NLDLY: ::tcflag_t = 0x100;
pub const NOFLSH: ::tcflag_t = 0x80;
-pub const OCRNL: ::c_int = 0x8;
-pub const OFDEL: ::c_int = 0x80;
-pub const OFILL: ::c_int = 0x40;
pub const OLCUC: ::tcflag_t = 0x2;
pub const ONLCR: ::tcflag_t = 0x4;
-pub const ONLRET: ::tcflag_t = 0x20;
-pub const ONOCR: ::tcflag_t = 0x10;
pub const O_ACCMODE: ::c_int = 0x3;
pub const O_APPEND: ::c_int = 0x400;
+pub const O_ASYNC: ::c_int = 0o20000;
pub const O_CREAT: ::c_int = 0x40;
pub const O_DIRECT: ::c_int = 0x10000;
pub const O_DIRECTORY: ::c_int = 0x4000;
-pub const O_DSYNC: ::c_int = 0x1000;
+pub const O_DSYNC: ::c_int = O_SYNC;
pub const O_EXCL: ::c_int = 0x80;
-pub const O_NDELAY: ::c_int = 0x800;
+pub const O_FSYNC: ::c_int = O_SYNC;
+pub const O_LARGEFILE: ::c_int = 0o400000;
+pub const O_NDELAY: ::c_int = O_NONBLOCK;
+pub const O_NOATIME: ::c_int = 0o1000000;
pub const O_NOCTTY: ::c_int = 0x100;
pub const O_NOFOLLOW: ::c_int = 0x8000;
pub const O_NONBLOCK: ::c_int = 0x800;
+pub const O_PATH: ::c_int = 0o10000000;
+pub const O_RSYNC: ::c_int = O_SYNC;
pub const O_SYNC: ::c_int = 0o10000;
pub const O_TRUNC: ::c_int = 0x200;
pub const PARENB: ::tcflag_t = 0x100;
pub const PARODD: ::tcflag_t = 0x200;
pub const PENDIN: ::tcflag_t = 0x4000;
-pub const POLLRDBAND: ::c_short = 0x80;
-pub const POLLRDNORM: ::c_short = 0x40;
pub const POLLWRBAND: ::c_short = 0x200;
pub const POLLWRNORM: ::c_short = 0x100;
pub const PTHREAD_STACK_MIN: ::size_t = 16384;
-pub const QIF_ALL: u32 = 0x3f;
-pub const QIF_BLIMITS: u32 = 0x1;
-pub const QIF_BTIME: u32 = 0x10;
-pub const QIF_ILIMITS: u32 = 0x4;
-pub const QIF_INODES: u32 = 0x8;
-pub const QIF_ITIME: u32 = 0x20;
-pub const QIF_LIMITS: u32 = 0x5;
-pub const QIF_SPACE: u32 = 0x2;
-pub const QIF_TIMES: u32 = 0x30;
-pub const QIF_USAGE: u32 = 0xa;
-pub const SA_NOCLDSTOP: ::c_int = 0x1;
-pub const SA_NOCLDWAIT: ::c_int = 0x2;
-pub const SA_NODEFER: ::c_int = 0x40000000;
-pub const SA_ONSTACK: ::c_int = 0x8000000;
-pub const SA_RESETHAND: ::c_int = 0x80000000;
-pub const SA_RESTART: ::c_int = 0x10000000;
-pub const SA_SIGINFO: ::c_int = 0x4;
+
+// These are typed unsigned to match sigaction
+pub const SA_NOCLDSTOP: ::c_ulong = 0x1;
+pub const SA_NOCLDWAIT: ::c_ulong = 0x2;
+pub const SA_SIGINFO: ::c_ulong = 0x4;
+pub const SA_NODEFER: ::c_ulong = 0x40000000;
+pub const SA_ONSTACK: ::c_ulong = 0x8000000;
+pub const SA_RESETHAND: ::c_ulong = 0x80000000;
+pub const SA_RESTART: ::c_ulong = 0x10000000;
+
pub const SFD_CLOEXEC: ::c_int = 0x80000;
pub const SFD_NONBLOCK: ::c_int = 0x800;
pub const SIGBUS: ::c_int = 0x7;
@@ -512,33 +508,7 @@ pub const SOCK_DGRAM: ::c_int = 0x2;
pub const SOCK_NONBLOCK: ::c_int = 0o0004000;
pub const SOCK_SEQPACKET: ::c_int = 0x5;
pub const SOCK_STREAM: ::c_int = 0x1;
-pub const SOL_SOCKET: ::c_int = 0x1;
-pub const SO_ACCEPTCONN: ::c_int = 0x1e;
-pub const SO_BINDTODEVICE: ::c_int = 0x19;
-pub const SO_BROADCAST: ::c_int = 0x6;
-pub const SO_BSDCOMPAT: ::c_int = 0xe;
-pub const SO_DOMAIN: ::c_int = 0x27;
-pub const SO_DONTROUTE: ::c_int = 0x5;
-pub const SO_ERROR: ::c_int = 0x4;
-pub const SO_KEEPALIVE: ::c_int = 0x9;
-pub const SO_LINGER: ::c_int = 0xd;
-pub const SO_MARK: ::c_int = 0x24;
-pub const SO_OOBINLINE: ::c_int = 0xa;
-pub const SO_PASSCRED: ::c_int = 0x10;
-pub const SO_PEERCRED: ::c_int = 0x11;
-pub const SO_PRIORITY: ::c_int = 0xc;
-pub const SO_PROTOCOL: ::c_int = 0x26;
-pub const SO_RCVBUF: ::c_int = 0x8;
-pub const SO_RCVLOWAT: ::c_int = 0x12;
-pub const SO_RCVTIMEO: ::c_int = 0x14;
-pub const SO_REUSEADDR: ::c_int = 0x2;
-pub const SO_RXQ_OVFL: ::c_int = 0x28;
-pub const SO_SNDBUF: ::c_int = 0x7;
-pub const SO_SNDBUFFORCE: ::c_int = 0x20;
-pub const SO_SNDLOWAT: ::c_int = 0x13;
-pub const SO_SNDTIMEO: ::c_int = 0x15;
-pub const SO_TIMESTAMP: ::c_int = 0x1d;
-pub const SO_TYPE: ::c_int = 0x3;
+
pub const TAB1: ::c_int = 0x800;
pub const TAB2: ::c_int = 0x1000;
pub const TAB3: ::c_int = 0x1800;
@@ -562,58 +532,8 @@ pub const VTDLY: ::c_int = 0x4000;
pub const VTIME: usize = 0x5;
pub const VWERASE: usize = 0xe;
pub const XTABS: ::tcflag_t = 0x1800;
-pub const _PC_2_SYMLINKS: ::c_int = 0x14;
-pub const _PC_ALLOC_SIZE_MIN: ::c_int = 0x12;
-pub const _PC_ASYNC_IO: ::c_int = 0xa;
-pub const _PC_FILESIZEBITS: ::c_int = 0xd;
-pub const _PC_PRIO_IO: ::c_int = 0xb;
-pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 0xe;
-pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 0xf;
-pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 0x10;
-pub const _PC_REC_XFER_ALIGN: ::c_int = 0x11;
-pub const _PC_SYMLINK_MAX: ::c_int = 0x13;
-pub const _PC_SYNC_IO: ::c_int = 0x9;
-pub const _SC_2_PBS: ::c_int = 0xa8;
-pub const _SC_2_PBS_ACCOUNTING: ::c_int = 0xa9;
-pub const _SC_2_PBS_CHECKPOINT: ::c_int = 0xaf;
-pub const _SC_2_PBS_LOCATE: ::c_int = 0xaa;
-pub const _SC_2_PBS_MESSAGE: ::c_int = 0xab;
-pub const _SC_2_PBS_TRACK: ::c_int = 0xac;
-pub const _SC_ADVISORY_INFO: ::c_int = 0x84;
-pub const _SC_BARRIERS: ::c_int = 0x85;
-pub const _SC_CLOCK_SELECTION: ::c_int = 0x89;
-pub const _SC_CPUTIME: ::c_int = 0x8a;
-pub const _SC_IPV6: ::c_int = 0xeb;
-pub const _SC_MONOTONIC_CLOCK: ::c_int = 0x95;
-pub const _SC_RAW_SOCKETS: ::c_int = 0xec;
-pub const _SC_READER_WRITER_LOCKS: ::c_int = 0x99;
-pub const _SC_REGEXP: ::c_int = 0x9b;
-pub const _SC_SHELL: ::c_int = 0x9d;
-pub const _SC_SPAWN: ::c_int = 0x9f;
-pub const _SC_SPIN_LOCKS: ::c_int = 0x9a;
-pub const _SC_SPORADIC_SERVER: ::c_int = 0xa0;
-pub const _SC_SS_REPL_MAX: ::c_int = 0xf1;
-pub const _SC_SYMLOOP_MAX: ::c_int = 0xad;
-pub const _SC_THREAD_CPUTIME: ::c_int = 0x8b;
-pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 0x52;
-pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 0xf7;
-pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 0xf8;
-pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 0xa1;
-pub const _SC_TIMEOUTS: ::c_int = 0xa4;
-pub const _SC_TRACE: ::c_int = 0xb5;
-pub const _SC_TRACE_EVENT_FILTER: ::c_int = 0xb6;
-pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 0xf2;
-pub const _SC_TRACE_INHERIT: ::c_int = 0xb7;
-pub const _SC_TRACE_LOG: ::c_int = 0xb8;
-pub const _SC_TRACE_NAME_MAX: ::c_int = 0xf3;
-pub const _SC_TRACE_SYS_MAX: ::c_int = 0xf4;
-pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 0xf5;
-pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 0xa5;
-pub const _SC_V6_ILP32_OFF32: ::c_int = 0xb0;
-pub const _SC_V6_ILP32_OFFBIG: ::c_int = 0xb1;
-pub const _SC_V6_LP64_OFF64: ::c_int = 0xb2;
-pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 0xb3;
-pub const _SC_XOPEN_STREAMS: ::c_int = 0xf6;
+
+pub const MADV_SOFT_OFFLINE: ::c_int = 101;
// Syscall table is copied from src/unix/notbsd/linux/musl/b32/arm.rs
pub const SYS_restart_syscall: ::c_long = 0;
@@ -967,75 +887,8 @@ pub const SYS_pkey_mprotect: ::c_long = 394;
pub const SYS_pkey_alloc: ::c_long = 395;
pub const SYS_pkey_free: ::c_long = 396;
-fn CMSG_ALIGN(len: usize) -> usize {
- len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
-}
-
-f! {
- pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
- if (*mhdr).msg_controllen as usize >= ::mem::size_of::<cmsghdr>() {
- (*mhdr).msg_control as *mut cmsghdr
- } else {
- 0 as *mut cmsghdr
- }
- }
-
- pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut ::c_uchar {
- cmsg.offset(1) as *mut ::c_uchar
- }
-
- pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
- (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>()))
- as ::c_uint
- }
-
- pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
- CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length
- }
-
- pub fn CMSG_NXTHDR(mhdr: *const msghdr,
- cmsg: *const cmsghdr) -> *mut cmsghdr {
- if ((*cmsg).cmsg_len as usize) < ::mem::size_of::<cmsghdr>() {
- return 0 as *mut cmsghdr;
- };
- let next = (cmsg as usize +
- CMSG_ALIGN((*cmsg).cmsg_len as usize))
- as *mut cmsghdr;
- let max = (*mhdr).msg_control as usize
- + (*mhdr).msg_controllen as usize;
- if (next.offset(1)) as usize > max ||
- next as usize + CMSG_ALIGN((*next).cmsg_len as usize) > max
- {
- 0 as *mut cmsghdr
- } else {
- next as *mut cmsghdr
- }
- }
-
-}
-
extern "C" {
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
- pub fn openpty(
- amaster: *mut ::c_int,
- aslave: *mut ::c_int,
- name: *mut ::c_char,
- termp: *mut termios,
- winp: *mut ::winsize,
- ) -> ::c_int;
- pub fn setns(fd: ::c_int, nstype: ::c_int) -> ::c_int;
- pub fn pwritev(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t,
- ) -> ::ssize_t;
- pub fn preadv(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t,
- ) -> ::ssize_t;
}
cfg_if! {
diff --git a/src/unix/uclibc/arm/no_align.rs b/src/unix/linux_like/linux/uclibc/arm/no_align.rs
index e32bf673..e32bf673 100644
--- a/src/unix/uclibc/arm/no_align.rs
+++ b/src/unix/linux_like/linux/uclibc/arm/no_align.rs
diff --git a/src/unix/uclibc/mips/mips32/align.rs b/src/unix/linux_like/linux/uclibc/mips/mips32/align.rs
index 4a0e0746..4a0e0746 100644
--- a/src/unix/uclibc/mips/mips32/align.rs
+++ b/src/unix/linux_like/linux/uclibc/mips/mips32/align.rs
diff --git a/src/unix/uclibc/mips/mips32/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs
index 31bca589..8edde11a 100644
--- a/src/unix/uclibc/mips/mips32/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs
@@ -12,7 +12,10 @@ pub type blksize_t = i32;
pub type nlink_t = u32;
pub type fsblkcnt_t = ::c_ulong;
pub type fsfilcnt_t = ::c_ulong;
-pub type rlim_t = c_ulong;
+pub type rlim_t = ::c_ulong;
+pub type __u64 = ::c_ulonglong;
+pub type fsblkcnt64_t = u64;
+pub type fsfilcnt64_t = u64;
s! {
pub struct stat {
@@ -61,6 +64,22 @@ s! {
st_pad5: [::c_long; 14],
}
+ pub struct statvfs64 {
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::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_favail: ::fsfilcnt64_t,
+ pub f_fsid: ::c_ulong,
+ pub __f_unused: ::c_int,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ pub __f_spare: [::c_int; 6],
+ }
+
pub struct pthread_attr_t {
__size: [u32; 9]
}
@@ -169,6 +188,21 @@ s! {
f_spare: [::c_long; 6],
}
+ pub struct statfs64 {
+ pub f_type: ::c_long,
+ pub f_bsize: ::c_long,
+ pub f_frsize: ::c_long,
+ pub f_blocks: ::fsblkcnt64_t,
+ pub f_bfree: ::fsblkcnt64_t,
+ pub f_files: ::fsblkcnt64_t,
+ pub f_ffree: ::fsblkcnt64_t,
+ pub f_bavail: ::fsblkcnt64_t,
+ pub f_fsid: ::fsid_t,
+ pub f_namelen: ::c_long,
+ pub f_flags: ::c_long,
+ pub f_spare: [::c_long; 5],
+ }
+
pub struct msghdr {
pub msg_name: *mut ::c_void,
pub msg_namelen: ::socklen_t,
@@ -222,10 +256,14 @@ s! {
}
}
-pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_ATTR_T: usize = 36;
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24;
-pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
+pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
+pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 20;
+pub const __SIZEOF_PTHREAD_BARRIERATTR_T: usize = 4;
pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff;
@@ -599,17 +637,13 @@ extern "C" {
newlen: ::size_t,
) -> ::c_int;
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
- pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int;
pub fn glob64(
pattern: *const ::c_char,
flags: ::c_int,
- errfunc: ::Option<
- extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int,
- >,
+ errfunc: ::Option<extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>,
pglob: *mut glob64_t,
) -> ::c_int;
pub fn globfree64(pglob: *mut glob64_t);
- pub fn ptrace(request: ::c_uint, ...) -> ::c_long;
pub fn pthread_attr_getaffinity_np(
attr: *const ::pthread_attr_t,
cpusetsize: ::size_t,
diff --git a/src/unix/uclibc/mips/mips32/no_align.rs b/src/unix/linux_like/linux/uclibc/mips/mips32/no_align.rs
index e32bf673..e32bf673 100644
--- a/src/unix/uclibc/mips/mips32/no_align.rs
+++ b/src/unix/linux_like/linux/uclibc/mips/mips32/no_align.rs
diff --git a/src/unix/uclibc/mips/mips64/align.rs b/src/unix/linux_like/linux/uclibc/mips/mips64/align.rs
index 21e21907..21e21907 100644
--- a/src/unix/uclibc/mips/mips64/align.rs
+++ b/src/unix/linux_like/linux/uclibc/mips/mips64/align.rs
diff --git a/src/unix/uclibc/mips/mips64/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs
index 735eb851..735eb851 100644
--- a/src/unix/uclibc/mips/mips64/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs
diff --git a/src/unix/uclibc/mips/mips64/no_align.rs b/src/unix/linux_like/linux/uclibc/mips/mips64/no_align.rs
index 8909114c..8909114c 100644
--- a/src/unix/uclibc/mips/mips64/no_align.rs
+++ b/src/unix/linux_like/linux/uclibc/mips/mips64/no_align.rs
diff --git a/src/unix/uclibc/mips/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mod.rs
index 6a9b41c9..d3f6bb27 100644
--- a/src/unix/uclibc/mips/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/mips/mod.rs
@@ -35,15 +35,12 @@ pub const EFD_CLOEXEC: ::c_int = 0x80000;
pub const BUFSIZ: ::c_uint = 4096;
pub const TMP_MAX: ::c_uint = 238328;
pub const FOPEN_MAX: ::c_uint = 16;
-pub const POSIX_FADV_DONTNEED: ::c_int = 4;
-pub const POSIX_FADV_NOREUSE: ::c_int = 5;
pub const POSIX_MADV_DONTNEED: ::c_int = 4;
pub const _SC_2_C_VERSION: ::c_int = 96;
pub const O_ACCMODE: ::c_int = 3;
pub const O_DIRECT: ::c_int = 0x8000;
pub const O_DIRECTORY: ::c_int = 0x10000;
pub const O_NOFOLLOW: ::c_int = 0x20000;
-pub const ST_RELATIME: ::c_ulong = 4096;
pub const NI_MAXHOST: ::socklen_t = 1025;
pub const RLIMIT_NOFILE: ::c_int = 5;
@@ -113,7 +110,6 @@ pub const ENOPROTOOPT: ::c_int = 99;
pub const EPROTONOSUPPORT: ::c_int = 120;
pub const ESOCKTNOSUPPORT: ::c_int = 121;
pub const EOPNOTSUPP: ::c_int = 122;
-pub const ENOTSUP: ::c_int = EOPNOTSUPP;
pub const EPFNOSUPPORT: ::c_int = 123;
pub const EAFNOSUPPORT: ::c_int = 124;
pub const EADDRINUSE: ::c_int = 125;
@@ -167,62 +163,6 @@ pub const SOCK_STREAM: ::c_int = 2;
pub const SOCK_DGRAM: ::c_int = 1;
pub const SOCK_SEQPACKET: ::c_int = 5;
-pub const SOL_SOCKET: ::c_int = 0xffff;
-
-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_LINGER: ::c_int = 0x0080;
-pub const SO_OOBINLINE: ::c_int = 0x0100;
-pub const SO_REUSEPORT: ::c_int = 0x0200;
-pub const SO_TYPE: ::c_int = 0x1008;
-pub const SO_STYLE: ::c_int = SO_TYPE;
-pub const SO_ERROR: ::c_int = 0x1007;
-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_ACCEPTCONN: ::c_int = 0x1009;
-pub const SO_PROTOCOL: ::c_int = 0x1028;
-pub const SO_DOMAIN: ::c_int = 0x1029;
-pub const SO_NO_CHECK: ::c_int = 11;
-pub const SO_PRIORITY: ::c_int = 12;
-pub const SO_BSDCOMPAT: ::c_int = 14;
-pub const SO_PASSCRED: ::c_int = 17;
-pub const SO_PEERCRED: ::c_int = 18;
-pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22;
-pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23;
-pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24;
-pub const SO_BINDTODEVICE: ::c_int = 25;
-pub const SO_ATTACH_FILTER: ::c_int = 26;
-pub const SO_DETACH_FILTER: ::c_int = 27;
-pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER;
-pub const SO_PEERNAME: ::c_int = 28;
-pub const SO_TIMESTAMP: ::c_int = 29;
-pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
-pub const SO_PEERSEC: ::c_int = 30;
-pub const SO_SNDBUFFORCE: ::c_int = 31;
-pub const SO_RCVBUFFORCE: ::c_int = 33;
-pub const SO_PASSSEC: ::c_int = 34;
-pub const SO_TIMESTAMPNS: ::c_int = 35;
-pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
-pub const SO_MARK: ::c_int = 36;
-pub const SO_TIMESTAMPING: ::c_int = 37;
-pub const SCM_TIMESTAMPING: ::c_int = SO_TIMESTAMPING;
-pub const SO_RXQ_OVFL: ::c_int = 40;
-pub const SO_WIFI_STATUS: ::c_int = 41;
-pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS;
-pub const SO_PEEK_OFF: ::c_int = 42;
-pub const SO_NOFCS: ::c_int = 43;
-pub const SO_LOCK_FILTER: ::c_int = 44;
-pub const SO_SELECT_ERR_QUEUE: ::c_int = 45;
-pub const SO_BUSY_POLL: ::c_int = 46;
-pub const SO_MAX_PACING_RATE: ::c_int = 47;
-pub const SO_BPF_EXTENSIONS: ::c_int = 48;
-
pub const FIOCLEX: ::c_ulong = 0x6601;
pub const FIONCLEX: ::c_ulong = 0x6602;
pub const FIONBIO: ::c_ulong = 0x667e;
@@ -254,40 +194,11 @@ pub const SIG_SETMASK: ::c_int = 3;
pub const SIG_BLOCK: ::c_int = 0x1;
pub const SIG_UNBLOCK: ::c_int = 0x2;
-pub const POLLRDNORM: ::c_short = 0x040;
pub const POLLWRNORM: ::c_short = 0x004;
-pub const POLLRDBAND: ::c_short = 0x080;
pub const POLLWRBAND: ::c_short = 0x100;
pub const PTHREAD_STACK_MIN: ::size_t = 16384;
-pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
-pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
-pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
-pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
-pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
-pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
-pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
-pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
-pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
-pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
-pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
-pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
-pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
-pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
-pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
-pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
-pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
-pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
-pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
-pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
-pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
-pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
-pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
-pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
-pub const TMPFS_MAGIC: ::c_long = 0x01021994;
-pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
-
pub const VEOF: usize = 16;
pub const VEOL: usize = 17;
pub const VEOL2: usize = 6;
@@ -295,37 +206,12 @@ pub const VMIN: usize = 4;
pub const IEXTEN: ::tcflag_t = 0x00000100;
pub const TOSTOP: ::tcflag_t = 0x00008000;
pub const FLUSHO: ::tcflag_t = 0x00002000;
-pub const IUTF8: ::tcflag_t = 0x00004000;
pub const TCSANOW: ::c_int = 0x540e;
pub const TCSADRAIN: ::c_int = 0x540f;
pub const TCSAFLUSH: ::c_int = 0x5410;
pub const CPU_SETSIZE: ::c_int = 0x400;
-pub const PTRACE_TRACEME: ::c_uint = 0;
-pub const PTRACE_PEEKTEXT: ::c_uint = 1;
-pub const PTRACE_PEEKDATA: ::c_uint = 2;
-pub const PTRACE_PEEKUSER: ::c_uint = 3;
-pub const PTRACE_POKETEXT: ::c_uint = 4;
-pub const PTRACE_POKEDATA: ::c_uint = 5;
-pub const PTRACE_POKEUSER: ::c_uint = 6;
-pub const PTRACE_CONT: ::c_uint = 7;
-pub const PTRACE_KILL: ::c_uint = 8;
-pub const PTRACE_SINGLESTEP: ::c_uint = 9;
-pub const PTRACE_ATTACH: ::c_uint = 16;
-pub const PTRACE_DETACH: ::c_uint = 17;
-pub const PTRACE_SYSCALL: ::c_uint = 24;
-pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200;
-pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201;
-pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202;
-pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203;
-pub const PTRACE_GETFPREGS: ::c_uint = 14;
-pub const PTRACE_SETFPREGS: ::c_uint = 15;
-pub const PTRACE_GETFPXREGS: ::c_uint = 18;
-pub const PTRACE_SETFPXREGS: ::c_uint = 19;
-pub const PTRACE_GETREGS: ::c_uint = 12;
-pub const PTRACE_SETREGS: ::c_uint = 13;
-
pub const EFD_NONBLOCK: ::c_int = 0x80;
pub const F_GETLK: ::c_int = 14;
@@ -368,28 +254,9 @@ pub const TIOCMSET: ::c_ulong = 0x741a;
pub const FIONREAD: ::c_ulong = 0x467f;
pub const TIOCCONS: ::c_ulong = 0x80047478;
-pub const RTLD_DEEPBIND: ::c_int = 0x10;
pub const RTLD_GLOBAL: ::c_int = 0x4;
pub const RTLD_NOLOAD: ::c_int = 0x8;
-pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead;
-pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793;
-pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278;
-pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448;
-pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216;
-
-pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567;
-pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123;
-pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF;
-pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000;
-pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC;
-pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4;
-pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2;
-pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543;
-
-pub const MCL_CURRENT: ::c_int = 0x0001;
-pub const MCL_FUTURE: ::c_int = 0x0002;
-
pub const SIGSTKSZ: ::size_t = 8192;
pub const CBAUD: ::tcflag_t = 0o0010017;
pub const TAB1: ::tcflag_t = 0x00000800;
diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs
new file mode 100644
index 00000000..9c79f999
--- /dev/null
+++ b/src/unix/linux_like/linux/uclibc/mod.rs
@@ -0,0 +1,303 @@
+pub type shmatt_t = ::c_ulong;
+pub type msgqnum_t = ::c_ulong;
+pub type msglen_t = ::c_ulong;
+pub type regoff_t = ::c_int;
+
+s! {
+ pub struct statvfs { // Different than GNU!
+ pub f_bsize: ::c_ulong,
+ pub f_frsize: ::c_ulong,
+ pub f_blocks: ::fsblkcnt_t,
+ pub f_bfree: ::fsblkcnt_t,
+ pub f_bavail: ::fsblkcnt_t,
+ pub f_files: ::fsfilcnt_t,
+ pub f_ffree: ::fsfilcnt_t,
+ pub f_favail: ::fsfilcnt_t,
+ #[cfg(target_endian = "little")]
+ pub f_fsid: ::c_ulong,
+ #[cfg(target_pointer_width = "32")]
+ __f_unused: ::c_int,
+ #[cfg(target_endian = "big")]
+ pub f_fsid: ::c_ulong,
+ pub f_flag: ::c_ulong,
+ pub f_namemax: ::c_ulong,
+ __f_spare: [::c_int; 6],
+ }
+
+ pub struct regex_t {
+ __buffer: *mut ::c_void,
+ __allocated: ::size_t,
+ __used: ::size_t,
+ __syntax: ::c_ulong,
+ __fastmap: *mut ::c_char,
+ __translate: *mut ::c_char,
+ __re_nsub: ::size_t,
+ __bitfield: u8,
+ }
+}
+
+pub const MCL_CURRENT: ::c_int = 0x0001;
+pub const MCL_FUTURE: ::c_int = 0x0002;
+
+pub const SIGEV_THREAD_ID: ::c_int = 4;
+
+pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5;
+pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff;
+pub const AFS_SUPER_MAGIC: ::c_long = 0x5346414f;
+pub const AUTOFS_SUPER_MAGIC: ::c_long = 0x0187;
+pub const BINDERFS_SUPER_MAGIC: ::c_long = 0x6c6f6f70;
+pub const BPF_FS_MAGIC: ::c_long = 0xcafe4a11;
+pub const BTRFS_SUPER_MAGIC: ::c_long = 0x9123683e;
+pub const CGROUP2_SUPER_MAGIC: ::c_long = 0x63677270;
+pub const CGROUP_SUPER_MAGIC: ::c_long = 0x27e0eb;
+pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245;
+pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45;
+pub const DEBUGFS_MAGIC: ::c_long = 0x64626720;
+pub const DEVPTS_SUPER_MAGIC: ::c_long = 0x1cd1;
+pub const ECRYPTFS_SUPER_MAGIC: ::c_long = 0xf15f;
+pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53;
+pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53;
+pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53;
+pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53;
+pub const F2FS_SUPER_MAGIC: ::c_long = 0xf2f52010;
+pub const FUTEXFS_SUPER_MAGIC: ::c_long = 0xbad1dea;
+pub const HOSTFS_SUPER_MAGIC: ::c_long = 0x00c0ffee;
+pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849;
+pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6;
+pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660;
+pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6;
+pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478;
+pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468;
+pub const MINIX3_SUPER_MAGIC: ::c_long = 0x4d5a;
+pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f;
+pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f;
+pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44;
+pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c;
+pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969;
+pub const NILFS_SUPER_MAGIC: ::c_long = 0x3434;
+pub const OCFS2_SUPER_MAGIC: ::c_long = 0x7461636f;
+pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1;
+pub const OVERLAYFS_SUPER_MAGIC: ::c_long = 0x794c7630;
+pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0;
+pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f;
+pub const QNX6_SUPER_MAGIC: ::c_long = 0x68191122;
+pub const RDTGROUP_SUPER_MAGIC: ::c_long = 0x7655821;
+pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973;
+pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b;
+pub const SYSFS_MAGIC: ::c_long = 0x62656572;
+pub const TMPFS_MAGIC: ::c_long = 0x01021994;
+pub const TRACEFS_MAGIC: ::c_long = 0x74726163;
+pub const UDF_SUPER_MAGIC: ::c_long = 0x15013346;
+pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2;
+pub const XENFS_SUPER_MAGIC: ::c_long = 0xabba1974;
+pub const XFS_SUPER_MAGIC: ::c_long = 0x58465342;
+
+pub const PTRACE_TRACEME: ::c_int = 0;
+pub const PTRACE_PEEKTEXT: ::c_int = 1;
+pub const PTRACE_PEEKDATA: ::c_int = 2;
+pub const PTRACE_PEEKUSER: ::c_int = 3;
+pub const PTRACE_POKETEXT: ::c_int = 4;
+pub const PTRACE_POKEDATA: ::c_int = 5;
+pub const PTRACE_POKEUSER: ::c_int = 6;
+pub const PTRACE_CONT: ::c_int = 7;
+pub const PTRACE_KILL: ::c_int = 8;
+pub const PTRACE_SINGLESTEP: ::c_int = 9;
+pub const PTRACE_GETREGS: ::c_int = 12;
+pub const PTRACE_SETREGS: ::c_int = 13;
+pub const PTRACE_GETFPREGS: ::c_int = 14;
+pub const PTRACE_SETFPREGS: ::c_int = 15;
+pub const PTRACE_ATTACH: ::c_int = 16;
+pub const PTRACE_DETACH: ::c_int = 17;
+pub const PTRACE_GETFPXREGS: ::c_int = 18;
+pub const PTRACE_SETFPXREGS: ::c_int = 19;
+pub const PTRACE_SYSCALL: ::c_int = 24;
+pub const PTRACE_SETOPTIONS: ::c_int = 0x4200;
+pub const PTRACE_GETEVENTMSG: ::c_int = 0x4201;
+pub const PTRACE_GETSIGINFO: ::c_int = 0x4202;
+pub const PTRACE_SETSIGINFO: ::c_int = 0x4203;
+pub const PTRACE_GETREGSET: ::c_int = 0x4204;
+pub const PTRACE_SETREGSET: ::c_int = 0x4205;
+pub const PTRACE_SEIZE: ::c_int = 0x4206;
+pub const PTRACE_INTERRUPT: ::c_int = 0x4207;
+pub const PTRACE_LISTEN: ::c_int = 0x4208;
+pub const PTRACE_O_MASK: ::c_int = 0x000000ff;
+
+pub const POSIX_FADV_DONTNEED: ::c_int = 4;
+pub const POSIX_FADV_NOREUSE: ::c_int = 5;
+
+pub const RLIMIT_CPU: ::c_int = 0;
+pub const RLIMIT_FSIZE: ::c_int = 1;
+pub const RLIMIT_DATA: ::c_int = 2;
+pub const RLIMIT_STACK: ::c_int = 3;
+pub const RLIMIT_CORE: ::c_int = 4;
+pub const RLIMIT_LOCKS: ::c_int = 10;
+pub const RLIMIT_SIGPENDING: ::c_int = 11;
+pub const RLIMIT_MSGQUEUE: ::c_int = 12;
+pub const RLIMIT_NICE: ::c_int = 13;
+pub const RLIMIT_RTPRIO: ::c_int = 14;
+
+// These are different than GNU!
+pub const LC_CTYPE: ::c_int = 0;
+pub const LC_NUMERIC: ::c_int = 1;
+pub const LC_TIME: ::c_int = 3;
+pub const LC_COLLATE: ::c_int = 4;
+pub const LC_MONETARY: ::c_int = 2;
+pub const LC_MESSAGES: ::c_int = 5;
+pub const LC_ALL: ::c_int = 6;
+// end different section
+
+// MS_ flags for mount(2)
+pub const MS_RMT_MASK: ::c_ulong = ::MS_RDONLY | ::MS_SYNCHRONOUS | ::MS_MANDLOCK | ::MS_I_VERSION;
+
+pub const ENOTSUP: ::c_int = EOPNOTSUPP;
+
+pub const IPV6_JOIN_GROUP: ::c_int = 20;
+pub const IPV6_LEAVE_GROUP: ::c_int = 21;
+
+// These are different from GNU
+pub const ABDAY_1: ::nl_item = 0x300;
+pub const ABDAY_2: ::nl_item = 0x301;
+pub const ABDAY_3: ::nl_item = 0x302;
+pub const ABDAY_4: ::nl_item = 0x303;
+pub const ABDAY_5: ::nl_item = 0x304;
+pub const ABDAY_6: ::nl_item = 0x305;
+pub const ABDAY_7: ::nl_item = 0x306;
+pub const DAY_1: ::nl_item = 0x307;
+pub const DAY_2: ::nl_item = 0x308;
+pub const DAY_3: ::nl_item = 0x309;
+pub const DAY_4: ::nl_item = 0x30A;
+pub const DAY_5: ::nl_item = 0x30B;
+pub const DAY_6: ::nl_item = 0x30C;
+pub const DAY_7: ::nl_item = 0x30D;
+pub const ABMON_1: ::nl_item = 0x30E;
+pub const ABMON_2: ::nl_item = 0x30F;
+pub const ABMON_3: ::nl_item = 0x310;
+pub const ABMON_4: ::nl_item = 0x311;
+pub const ABMON_5: ::nl_item = 0x312;
+pub const ABMON_6: ::nl_item = 0x313;
+pub const ABMON_7: ::nl_item = 0x314;
+pub const ABMON_8: ::nl_item = 0x315;
+pub const ABMON_9: ::nl_item = 0x316;
+pub const ABMON_10: ::nl_item = 0x317;
+pub const ABMON_11: ::nl_item = 0x318;
+pub const ABMON_12: ::nl_item = 0x319;
+pub const MON_1: ::nl_item = 0x31A;
+pub const MON_2: ::nl_item = 0x31B;
+pub const MON_3: ::nl_item = 0x31C;
+pub const MON_4: ::nl_item = 0x31D;
+pub const MON_5: ::nl_item = 0x31E;
+pub const MON_6: ::nl_item = 0x31F;
+pub const MON_7: ::nl_item = 0x320;
+pub const MON_8: ::nl_item = 0x321;
+pub const MON_9: ::nl_item = 0x322;
+pub const MON_10: ::nl_item = 0x323;
+pub const MON_11: ::nl_item = 0x324;
+pub const MON_12: ::nl_item = 0x325;
+pub const AM_STR: ::nl_item = 0x326;
+pub const PM_STR: ::nl_item = 0x327;
+pub const D_T_FMT: ::nl_item = 0x328;
+pub const D_FMT: ::nl_item = 0x329;
+pub const T_FMT: ::nl_item = 0x32A;
+pub const T_FMT_AMPM: ::nl_item = 0x32B;
+pub const ERA: ::nl_item = 0x32C;
+pub const ERA_D_FMT: ::nl_item = 0x32E;
+pub const ALT_DIGITS: ::nl_item = 0x32F;
+pub const ERA_D_T_FMT: ::nl_item = 0x330;
+pub const ERA_T_FMT: ::nl_item = 0x331;
+pub const CODESET: ::nl_item = 10;
+pub const CRNCYSTR: ::nl_item = 0x215;
+pub const RADIXCHAR: ::nl_item = 0x100;
+pub const THOUSEP: ::nl_item = 0x101;
+pub const NOEXPR: ::nl_item = 0x501;
+pub const YESSTR: ::nl_item = 0x502;
+pub const NOSTR: ::nl_item = 0x503;
+
+// Different than Gnu.
+pub const FILENAME_MAX: ::c_uint = 4095;
+
+pub const PRIO_PROCESS: ::c_int = 0;
+pub const PRIO_PGRP: ::c_int = 1;
+pub const PRIO_USER: ::c_int = 2;
+
+pub const ST_RELATIME: ::c_ulong = 4096;
+
+extern "C" {
+ pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
+
+ pub fn pthread_rwlockattr_getkind_np(
+ attr: *const ::pthread_rwlockattr_t,
+ val: *mut ::c_int,
+ ) -> ::c_int;
+ pub fn pthread_rwlockattr_setkind_np(
+ attr: *mut ::pthread_rwlockattr_t,
+ val: ::c_int,
+ ) -> ::c_int;
+
+ pub fn ptrace(request: ::c_uint, ...) -> ::c_long;
+
+ pub fn sendmmsg(
+ sockfd: ::c_int,
+ msgvec: *mut ::mmsghdr,
+ vlen: ::c_uint,
+ flags: ::c_int,
+ ) -> ::c_int;
+ pub fn recvmmsg(
+ sockfd: ::c_int,
+ msgvec: *mut ::mmsghdr,
+ vlen: ::c_uint,
+ flags: ::c_int,
+ timeout: *mut ::timespec,
+ ) -> ::c_int;
+
+ pub fn openpty(
+ amaster: *mut ::c_int,
+ aslave: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *mut termios,
+ winp: *mut ::winsize,
+ ) -> ::c_int;
+ pub fn forkpty(
+ amaster: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *mut termios,
+ winp: *mut ::winsize,
+ ) -> ::pid_t;
+
+ pub fn getnameinfo(
+ sa: *const ::sockaddr,
+ salen: ::socklen_t,
+ host: *mut ::c_char,
+ hostlen: ::socklen_t,
+ serv: *mut ::c_char,
+ sevlen: ::socklen_t,
+ flags: ::c_int,
+ ) -> ::c_int;
+
+ pub fn pwritev(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off64_t,
+ ) -> ::ssize_t;
+ pub fn preadv(
+ fd: ::c_int,
+ iov: *const ::iovec,
+ iovcnt: ::c_int,
+ offset: ::off64_t,
+ ) -> ::ssize_t;
+}
+
+cfg_if! {
+ if #[cfg(any(target_arch = "mips", target_arch = "mips64"))] {
+ mod mips;
+ pub use self::mips::*;
+ } else if #[cfg(target_arch = "x86_64")] {
+ mod x86_64;
+ pub use self::x86_64::*;
+ } else if #[cfg(target_arch = "arm")] {
+ mod arm;
+ pub use self::arm::*;
+ } else {
+ pub use unsupported_target;
+ }
+}
diff --git a/src/unix/uclibc/no_align.rs b/src/unix/linux_like/linux/uclibc/no_align.rs
index a73dbded..a73dbded 100644
--- a/src/unix/uclibc/no_align.rs
+++ b/src/unix/linux_like/linux/uclibc/no_align.rs
diff --git a/src/unix/uclibc/x86_64/l4re.rs b/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs
index 16ec0ef9..16ec0ef9 100644
--- a/src/unix/uclibc/x86_64/l4re.rs
+++ b/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs
diff --git a/src/unix/uclibc/x86_64/mod.rs b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs
index a8bb0794..4f7974c5 100644
--- a/src/unix/uclibc/x86_64/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs
@@ -12,13 +12,16 @@ pub type ino_t = ::c_ulong;
pub type nlink_t = ::c_uint;
pub type off_t = ::c_long;
pub type rlim_t = c_ulong;
-pub type rlim64_t = u64;
// [uClibc docs] Note stat64 has the same shape as stat for x86-64.
pub type stat64 = stat;
pub type suseconds_t = ::c_long;
pub type time_t = ::c_int;
pub type wchar_t = ::c_int;
+pub type fsblkcnt64_t = u64;
+pub type fsfilcnt64_t = u64;
+pub type __u64 = ::c_ulong;
+
s! {
pub struct ipc_perm {
pub __key: ::key_t,
@@ -143,17 +146,17 @@ s! {
pub struct sigaction {
pub sa_handler: ::sighandler_t,
pub sa_flags: ::c_ulong,
- pub sa_restorer: *mut ::c_void,
+ pub sa_restorer: ::Option<extern fn()>,
pub sa_mask: ::sigset_t,
}
- pub struct stack_t { // ToDo
+ pub struct stack_t { // FIXME
pub ss_sp: *mut ::c_void,
pub ss_flags: ::c_int,
pub ss_size: ::size_t
}
- pub struct statfs { // ToDo
+ pub struct statfs { // FIXME
pub f_type: fsword_t,
pub f_bsize: fsword_t,
pub f_blocks: ::fsblkcnt_t,
@@ -167,7 +170,38 @@ s! {
f_spare: [fsword_t; 5],
}
- pub struct msghdr { // ToDo
+ pub struct statfs64 {
+ pub f_type: ::c_int,
+ pub f_bsize: ::c_int,
+ 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_namelen: ::c_int,
+ pub f_frsize: ::c_int,
+ pub f_flags: ::c_int,
+ pub f_spare: [::c_int; 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 msghdr { // FIXME
pub msg_name: *mut ::c_void,
pub msg_namelen: ::socklen_t,
pub msg_iov: *mut ::iovec,
@@ -177,7 +211,7 @@ s! {
pub msg_flags: ::c_int,
}
- pub struct termios { // ToDo
+ pub struct termios { // FIXME
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
pub c_cflag: ::tcflag_t,
@@ -186,11 +220,11 @@ s! {
pub c_cc: [::cc_t; ::NCCS],
}
- pub struct sigset_t { // ToDo
+ pub struct sigset_t { // FIXME
__val: [::c_ulong; 16],
}
- pub struct sysinfo { // ToDo
+ pub struct sysinfo { // FIXME
pub uptime: ::c_long,
pub loads: [::c_ulong; 3],
pub totalram: ::c_ulong,
@@ -207,7 +241,7 @@ s! {
pub _f: [::c_char; 0],
}
- pub struct glob_t { // ToDo
+ pub struct glob_t { // FIXME
pub gl_pathc: ::size_t,
pub gl_pathv: *mut *mut c_char,
pub gl_offs: ::size_t,
@@ -219,21 +253,31 @@ s! {
__unused5: *mut ::c_void,
}
- pub struct rlimit64 { // ToDo
- pub rlim_cur: rlim64_t,
- pub rlim_max: rlim64_t,
- }
-
- pub struct cpu_set_t { // ToDo
+ pub struct cpu_set_t { // FIXME
#[cfg(target_pointer_width = "32")]
bits: [u32; 32],
#[cfg(target_pointer_width = "64")]
bits: [u64; 16],
}
- pub struct fsid_t { // ToDo
+ pub struct fsid_t { // FIXME
__val: [::c_int; 2],
}
+
+ // FIXME this is actually a union
+ pub struct sem_t {
+ #[cfg(target_pointer_width = "32")]
+ __size: [::c_char; 16],
+ #[cfg(target_pointer_width = "64")]
+ __size: [::c_char; 32],
+ __align: [::c_long; 0],
+ }
+
+ pub struct cmsghdr {
+ pub cmsg_len: ::size_t,
+ pub cmsg_level: ::c_int,
+ pub cmsg_type: ::c_int,
+ }
}
s_no_extra_traits! {
@@ -245,14 +289,6 @@ s_no_extra_traits! {
pub d_type: u8,
pub d_name: [::c_char; 256],
}
- #[allow(missing_debug_implementations)]
- pub struct dirent64 {
- pub d_ino: ::ino64_t,
- pub d_off: ::off64_t,
- pub d_reclen: u16,
- pub d_type: u8,
- pub d_name: [::c_char; 256],
- }
}
// constants
@@ -265,6 +301,8 @@ pub const EDEADLK: ::c_int = 35; // Resource deadlock would occur
pub const ENOSYS: ::c_int = 38; // Function not implemented
pub const ENOTCONN: ::c_int = 107; // Transport endpoint is not connected
pub const ETIMEDOUT: ::c_int = 110; // connection timed out
+pub const EOPNOTSUPP: ::c_int = 0x5f;
+pub const ENODATA: ::c_int = 0x3d;
pub const O_APPEND: ::c_int = 02000;
pub const O_ACCMODE: ::c_int = 0003;
pub const O_CLOEXEC: ::c_int = 0x80000;
@@ -277,18 +315,13 @@ pub const NCCS: usize = 32;
pub const SIG_SETMASK: ::c_int = 2; // Set the set of blocked signals
pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40;
pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4;
-pub const SO_BROADCAST: ::c_int = 6;
pub const SOCK_DGRAM: ::c_int = 2; // connectionless, unreliable datagrams
pub const SOCK_STREAM: ::c_int = 1; // …/common/bits/socket_type.h
-pub const SO_ERROR: ::c_int = 4;
-pub const SOL_SOCKET: ::c_int = 1;
-pub const SO_RCVTIMEO: ::c_int = 20;
-pub const SO_REUSEADDR: ::c_int = 2;
-pub const SO_SNDTIMEO: ::c_int = 21;
pub const RLIM_INFINITY: u64 = 0xffffffffffffffff;
pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4;
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
+pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8;
cfg_if! {
if #[cfg(target_os = "l4re")] {
@@ -299,14 +332,3 @@ cfg_if! {
pub use other::*;
}
}
-
-cfg_if! {
- if #[cfg(libc_align)] {
- #[macro_use]
- mod align;
- } else {
- #[macro_use]
- mod no_align;
- }
-}
-expand_align!();
diff --git a/src/unix/uclibc/x86_64/other.rs b/src/unix/linux_like/linux/uclibc/x86_64/other.rs
index 481577cf..481577cf 100644
--- a/src/unix/uclibc/x86_64/other.rs
+++ b/src/unix/linux_like/linux/uclibc/x86_64/other.rs
diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs
index 792548f9..1cfc910a 100644
--- a/src/unix/linux_like/mod.rs
+++ b/src/unix/linux_like/mod.rs
@@ -50,6 +50,8 @@ s! {
pub sin6_scope_id: u32,
}
+ // The order of the `ai_addr` field in this struct is crucial
+ // for converting between the Rust and C types.
pub struct addrinfo {
pub ai_flags: ::c_int,
pub ai_family: ::c_int,
@@ -472,7 +474,7 @@ pub const F_SEAL_SHRINK: ::c_int = 0x0002;
pub const F_SEAL_GROW: ::c_int = 0x0004;
pub const F_SEAL_WRITE: ::c_int = 0x0008;
-// TODO(#235): Include file sealing fcntls once we have a way to verify them.
+// FIXME(#235): Include file sealing fcntls once we have a way to verify them.
pub const SIGTRAP: ::c_int = 5;
@@ -489,10 +491,7 @@ pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6;
pub const CLOCK_BOOTTIME: ::clockid_t = 7;
pub const CLOCK_REALTIME_ALARM: ::clockid_t = 8;
pub const CLOCK_BOOTTIME_ALARM: ::clockid_t = 9;
-// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep
-// 2014.) See also musl/mod.rs
-// pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
-// pub const CLOCK_TAI: ::clockid_t = 11;
+pub const CLOCK_TAI: ::clockid_t = 11;
pub const TIMER_ABSTIME: ::c_int = 1;
pub const RUSAGE_SELF: ::c_int = 0;
@@ -547,19 +546,24 @@ pub const PROT_READ: ::c_int = 1;
pub const PROT_WRITE: ::c_int = 2;
pub const PROT_EXEC: ::c_int = 4;
-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_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
-pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
-pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
-pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE);
-pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY);
-pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES);
+cfg_if! {
+ if #[cfg(not(target_env = "uclibc"))] {
+ 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_CTYPE_MASK: ::c_int = 1 << LC_CTYPE;
+pub const LC_NUMERIC_MASK: ::c_int = 1 << LC_NUMERIC;
+pub const LC_TIME_MASK: ::c_int = 1 << LC_TIME;
+pub const LC_COLLATE_MASK: ::c_int = 1 << LC_COLLATE;
+pub const LC_MONETARY_MASK: ::c_int = 1 << LC_MONETARY;
+pub const LC_MESSAGES_MASK: ::c_int = 1 << LC_MESSAGES;
// LC_ALL_MASK defined per platform
pub const MAP_FILE: ::c_int = 0x0000;
@@ -602,42 +606,6 @@ pub const MS_ACTIVE: ::c_ulong = 0x40000000;
pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000;
pub const MS_MGC_MSK: ::c_ulong = 0xffff0000;
-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 EWOULDBLOCK: ::c_int = EAGAIN;
-
pub const SCM_RIGHTS: ::c_int = 0x01;
pub const SCM_CREDENTIALS: ::c_int = 0x02;
@@ -805,20 +773,116 @@ pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
pub const SOCK_RAW: ::c_int = 3;
pub const SOCK_RDM: ::c_int = 4;
-pub const IP_MULTICAST_IF: ::c_int = 32;
-pub const IP_MULTICAST_TTL: ::c_int = 33;
-pub const IP_MULTICAST_LOOP: ::c_int = 34;
pub const IP_TOS: ::c_int = 1;
pub const IP_TTL: ::c_int = 2;
pub const IP_HDRINCL: ::c_int = 3;
+pub const IP_OPTIONS: ::c_int = 4;
+pub const IP_ROUTER_ALERT: ::c_int = 5;
+pub const IP_RECVOPTS: ::c_int = 6;
+pub const IP_RETOPTS: ::c_int = 7;
pub const IP_PKTINFO: ::c_int = 8;
-pub const IP_RECVTOS: ::c_int = 13;
+pub const IP_PKTOPTIONS: ::c_int = 9;
+pub const IP_MTU_DISCOVER: ::c_int = 10;
pub const IP_RECVERR: ::c_int = 11;
+pub const IP_RECVTTL: ::c_int = 12;
+pub const IP_RECVTOS: ::c_int = 13;
+pub const IP_MTU: ::c_int = 14;
+pub const IP_FREEBIND: ::c_int = 15;
+pub const IP_IPSEC_POLICY: ::c_int = 16;
+pub const IP_XFRM_POLICY: ::c_int = 17;
+pub const IP_PASSSEC: ::c_int = 18;
+pub const IP_TRANSPARENT: ::c_int = 19;
+pub const IP_ORIGDSTADDR: ::c_int = 20;
+pub const IP_RECVORIGDSTADDR: ::c_int = IP_ORIGDSTADDR;
+pub const IP_MINTTL: ::c_int = 21;
+pub const IP_NODEFRAG: ::c_int = 22;
+pub const IP_CHECKSUM: ::c_int = 23;
+pub const IP_BIND_ADDRESS_NO_PORT: ::c_int = 24;
+pub const IP_MULTICAST_IF: ::c_int = 32;
+pub const IP_MULTICAST_TTL: ::c_int = 33;
+pub const IP_MULTICAST_LOOP: ::c_int = 34;
pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
+pub const IP_UNBLOCK_SOURCE: ::c_int = 37;
+pub const IP_BLOCK_SOURCE: ::c_int = 38;
pub const IP_ADD_SOURCE_MEMBERSHIP: ::c_int = 39;
pub const IP_DROP_SOURCE_MEMBERSHIP: ::c_int = 40;
-pub const IP_TRANSPARENT: ::c_int = 19;
+pub const IP_MSFILTER: ::c_int = 41;
+pub const IP_MULTICAST_ALL: ::c_int = 49;
+pub const IP_UNICAST_IF: ::c_int = 50;
+
+pub const IP_DEFAULT_MULTICAST_TTL: ::c_int = 1;
+pub const IP_DEFAULT_MULTICAST_LOOP: ::c_int = 1;
+
+pub const IP_PMTUDISC_DONT: ::c_int = 0;
+pub const IP_PMTUDISC_WANT: ::c_int = 1;
+pub const IP_PMTUDISC_DO: ::c_int = 2;
+pub const IP_PMTUDISC_PROBE: ::c_int = 3;
+pub const IP_PMTUDISC_INTERFACE: ::c_int = 4;
+pub const IP_PMTUDISC_OMIT: ::c_int = 5;
+
+// IPPROTO_IP defined in src/unix/mod.rs
+/// Hop-by-hop option header
+pub const IPPROTO_HOPOPTS: ::c_int = 0;
+// IPPROTO_ICMP defined in src/unix/mod.rs
+/// group mgmt protocol
+pub const IPPROTO_IGMP: ::c_int = 2;
+/// for compatibility
+pub const IPPROTO_IPIP: ::c_int = 4;
+// IPPROTO_TCP defined in src/unix/mod.rs
+/// exterior gateway protocol
+pub const IPPROTO_EGP: ::c_int = 8;
+/// pup
+pub const IPPROTO_PUP: ::c_int = 12;
+// IPPROTO_UDP defined in src/unix/mod.rs
+/// xns idp
+pub const IPPROTO_IDP: ::c_int = 22;
+/// tp-4 w/ class negotiation
+pub const IPPROTO_TP: ::c_int = 29;
+/// DCCP
+pub const IPPROTO_DCCP: ::c_int = 33;
+// IPPROTO_IPV6 defined in src/unix/mod.rs
+/// IP6 routing header
+pub const IPPROTO_ROUTING: ::c_int = 43;
+/// IP6 fragmentation header
+pub const IPPROTO_FRAGMENT: ::c_int = 44;
+/// resource reservation
+pub const IPPROTO_RSVP: ::c_int = 46;
+/// General Routing Encap.
+pub const IPPROTO_GRE: ::c_int = 47;
+/// IP6 Encap Sec. Payload
+pub const IPPROTO_ESP: ::c_int = 50;
+/// IP6 Auth Header
+pub const IPPROTO_AH: ::c_int = 51;
+// IPPROTO_ICMPV6 defined in src/unix/mod.rs
+/// IP6 no next header
+pub const IPPROTO_NONE: ::c_int = 59;
+/// IP6 destination option
+pub const IPPROTO_DSTOPTS: ::c_int = 60;
+pub const IPPROTO_MTP: ::c_int = 92;
+/// encapsulation header
+pub const IPPROTO_ENCAP: ::c_int = 98;
+/// Protocol indep. multicast
+pub const IPPROTO_PIM: ::c_int = 103;
+/// IP Payload Comp. Protocol
+pub const IPPROTO_COMP: ::c_int = 108;
+/// SCTP
+pub const IPPROTO_SCTP: ::c_int = 132;
+pub const IPPROTO_MH: ::c_int = 135;
+pub const IPPROTO_UDPLITE: ::c_int = 136;
+/// raw IP packet
+pub const IPPROTO_RAW: ::c_int = 255;
+
+pub const MCAST_EXCLUDE: ::c_int = 0;
+pub const MCAST_INCLUDE: ::c_int = 1;
+pub const MCAST_JOIN_GROUP: ::c_int = 42;
+pub const MCAST_BLOCK_SOURCE: ::c_int = 43;
+pub const MCAST_UNBLOCK_SOURCE: ::c_int = 44;
+pub const MCAST_LEAVE_GROUP: ::c_int = 45;
+pub const MCAST_JOIN_SOURCE_GROUP: ::c_int = 46;
+pub const MCAST_LEAVE_SOURCE_GROUP: ::c_int = 47;
+pub const MCAST_MSFILTER: ::c_int = 48;
+
pub const IPV6_ADDRFORM: ::c_int = 1;
pub const IPV6_2292PKTINFO: ::c_int = 2;
pub const IPV6_2292HOPOPTS: ::c_int = 3;
@@ -828,7 +892,7 @@ pub const IPV6_2292PKTOPTIONS: ::c_int = 6;
pub const IPV6_CHECKSUM: ::c_int = 7;
pub const IPV6_2292HOPLIMIT: ::c_int = 8;
pub const IPV6_NEXTHOP: ::c_int = 9;
-pub const IPV6_FLOWINFO: ::c_int = 11;
+pub const IPV6_AUTHHDR: ::c_int = 10;
pub const IPV6_UNICAST_HOPS: ::c_int = 16;
pub const IPV6_MULTICAST_IF: ::c_int = 17;
pub const IPV6_MULTICAST_HOPS: ::c_int = 18;
@@ -842,10 +906,43 @@ 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_IPSEC_POLICY: ::c_int = 34;
+pub const IPV6_XFRM_POLICY: ::c_int = 35;
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_AUTOFLOWLABEL: ::c_int = 70;
+pub const IPV6_ADDR_PREFERENCES: ::c_int = 72;
+pub const IPV6_MINHOPCOUNT: ::c_int = 73;
+pub const IPV6_ORIGDSTADDR: ::c_int = 74;
+pub const IPV6_RECVORIGDSTADDR: ::c_int = IPV6_ORIGDSTADDR;
+pub const IPV6_TRANSPARENT: ::c_int = 75;
+pub const IPV6_UNICAST_IF: ::c_int = 76;
+pub const IPV6_PREFER_SRC_TMP: ::c_int = 0x0001;
+pub const IPV6_PREFER_SRC_PUBLIC: ::c_int = 0x0002;
+pub const IPV6_PREFER_SRC_PUBTMP_DEFAULT: ::c_int = 0x0100;
+pub const IPV6_PREFER_SRC_COA: ::c_int = 0x0004;
+pub const IPV6_PREFER_SRC_HOME: ::c_int = 0x0400;
+pub const IPV6_PREFER_SRC_CGA: ::c_int = 0x0008;
+pub const IPV6_PREFER_SRC_NONCGA: ::c_int = 0x0800;
+
+pub const IPV6_PMTUDISC_DONT: ::c_int = 0;
+pub const IPV6_PMTUDISC_WANT: ::c_int = 1;
+pub const IPV6_PMTUDISC_DO: ::c_int = 2;
+pub const IPV6_PMTUDISC_PROBE: ::c_int = 3;
pub const TCP_NODELAY: ::c_int = 1;
pub const TCP_MAXSEG: ::c_int = 2;
@@ -877,6 +974,8 @@ pub const SS_DISABLE: ::c_int = 2;
pub const PATH_MAX: ::c_int = 4096;
+pub const UIO_MAXIOV: ::c_int = 1024;
+
pub const FD_SETSIZE: usize = 1024;
pub const EPOLLIN: ::c_int = 0x1;
@@ -982,7 +1081,6 @@ pub const CLONE_NEWUSER: ::c_int = 0x10000000;
pub const CLONE_NEWPID: ::c_int = 0x20000000;
pub const CLONE_NEWNET: ::c_int = 0x40000000;
pub const CLONE_IO: ::c_int = 0x80000000;
-pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
pub const WNOHANG: ::c_int = 0x00000001;
pub const WUNTRACED: ::c_int = 0x00000002;
@@ -991,6 +1089,13 @@ pub const WEXITED: ::c_int = 0x00000004;
pub const WCONTINUED: ::c_int = 0x00000008;
pub const WNOWAIT: ::c_int = 0x01000000;
+// Options for personality(2).
+pub const MMAP_PAGE_ZERO: ::c_int = 0x0100000;
+pub const ADDR_LIMIT_32BIT: ::c_int = 0x0800000;
+pub const SHORT_INODE: ::c_int = 0x1000000;
+pub const WHOLE_SECONDS: ::c_int = 0x2000000;
+pub const STICKY_TIMEOUTS: ::c_int = 0x4000000;
+
// Options set using PTRACE_SETOPTIONS.
pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001;
pub const PTRACE_O_TRACEFORK: ::c_int = 0x00000002;
@@ -1000,9 +1105,6 @@ pub const PTRACE_O_TRACEEXEC: ::c_int = 0x00000010;
pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 0x00000020;
pub const PTRACE_O_TRACEEXIT: ::c_int = 0x00000040;
pub const PTRACE_O_TRACESECCOMP: ::c_int = 0x00000080;
-pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000;
-pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000;
-pub const PTRACE_O_MASK: ::c_int = 0x003000ff;
// Wait extended result codes for the above trace options.
pub const PTRACE_EVENT_FORK: ::c_int = 1;
@@ -1012,8 +1114,6 @@ pub const PTRACE_EVENT_EXEC: ::c_int = 4;
pub const PTRACE_EVENT_VFORK_DONE: ::c_int = 5;
pub const PTRACE_EVENT_EXIT: ::c_int = 6;
pub const PTRACE_EVENT_SECCOMP: ::c_int = 7;
-// PTRACE_EVENT_STOP was added to glibc in 2.26
-// pub const PTRACE_EVENT_STOP: ::c_int = 128;
pub const __WNOTHREAD: ::c_int = 0x20000000;
pub const __WALL: ::c_int = 0x40000000;
@@ -1048,6 +1148,13 @@ pub const PIPE_BUF: usize = 4096;
pub const SI_LOAD_SHIFT: ::c_uint = 16;
+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 SIGEV_SIGNAL: ::c_int = 0;
pub const SIGEV_NONE: ::c_int = 1;
pub const SIGEV_THREAD: ::c_int = 2;
@@ -1055,6 +1162,11 @@ pub const SIGEV_THREAD: ::c_int = 2;
pub const P_ALL: idtype_t = 0;
pub const P_PID: idtype_t = 1;
pub const P_PGID: idtype_t = 2;
+cfg_if! {
+ if #[cfg(not(target_os = "emscripten"))] {
+ pub const P_PIDFD: idtype_t = 3;
+ }
+}
pub const UTIME_OMIT: c_long = 1073741822;
pub const UTIME_NOW: c_long = 1073741823;
@@ -1095,15 +1207,15 @@ pub const IPOPT_CONTROL: u8 = 0x00;
pub const IPOPT_RESERVED1: u8 = 0x20;
pub const IPOPT_MEASUREMENT: u8 = 0x40;
pub const IPOPT_RESERVED2: u8 = 0x60;
-pub const IPOPT_END: u8 = (0 | IPOPT_CONTROL);
-pub const IPOPT_NOOP: u8 = (1 | IPOPT_CONTROL);
-pub const IPOPT_SEC: u8 = (2 | IPOPT_CONTROL | IPOPT_COPY);
-pub const IPOPT_LSRR: u8 = (3 | IPOPT_CONTROL | IPOPT_COPY);
-pub const IPOPT_TIMESTAMP: u8 = (4 | IPOPT_MEASUREMENT);
-pub const IPOPT_RR: u8 = (7 | IPOPT_CONTROL);
-pub const IPOPT_SID: u8 = (8 | IPOPT_CONTROL | IPOPT_COPY);
-pub const IPOPT_SSRR: u8 = (9 | IPOPT_CONTROL | IPOPT_COPY);
-pub const IPOPT_RA: u8 = (20 | IPOPT_CONTROL | IPOPT_COPY);
+pub const IPOPT_END: u8 = 0 | IPOPT_CONTROL;
+pub const IPOPT_NOOP: u8 = 1 | IPOPT_CONTROL;
+pub const IPOPT_SEC: u8 = 2 | IPOPT_CONTROL | IPOPT_COPY;
+pub const IPOPT_LSRR: u8 = 3 | IPOPT_CONTROL | IPOPT_COPY;
+pub const IPOPT_TIMESTAMP: u8 = 4 | IPOPT_MEASUREMENT;
+pub const IPOPT_RR: u8 = 7 | IPOPT_CONTROL;
+pub const IPOPT_SID: u8 = 8 | IPOPT_CONTROL | IPOPT_COPY;
+pub const IPOPT_SSRR: u8 = 9 | IPOPT_CONTROL | IPOPT_COPY;
+pub const IPOPT_RA: u8 = 20 | IPOPT_CONTROL | IPOPT_COPY;
pub const IPVERSION: u8 = 4;
pub const MAXTTL: u8 = 255;
pub const IPDEFTTL: u8 = 64;
@@ -1189,6 +1301,24 @@ pub const ARPHRD_IEEE802154: u16 = 804;
pub const ARPHRD_VOID: u16 = 0xFFFF;
pub const ARPHRD_NONE: u16 = 0xFFFE;
+cfg_if! {
+ if #[cfg(not(target_env = "uclibc"))] {
+ pub const IPPROTO_BEETPH: ::c_int = 94;
+ pub const IPPROTO_MPLS: ::c_int = 137;
+ pub const IPV6_HDRINCL: ::c_int = 36;
+ pub const IPV6_PMTUDISC_INTERFACE: ::c_int = 4;
+ pub const IPV6_PMTUDISC_OMIT: ::c_int = 5;
+ pub const CLONE_NEWCGROUP: ::c_int = 0x02000000;
+ pub const ADDR_NO_RANDOMIZE: ::c_int = 0x0040000;
+ pub const ADDR_COMPAT_LAYOUT: ::c_int = 0x0200000;
+ pub const READ_IMPLIES_EXEC: ::c_int = 0x0400000;
+ pub const ADDR_LIMIT_3GB: ::c_int = 0x8000000;
+ pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000;
+ pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000;
+ pub const PTRACE_O_MASK: ::c_int = 0x003000ff;
+ }
+}
+
const_fn! {
{const} fn CMSG_ALIGN(len: usize) -> usize {
len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
@@ -1242,85 +1372,84 @@ f! {
*slot = 0;
}
}
+}
- pub fn WIFSTOPPED(status: ::c_int) -> bool {
+safe_f! {
+ pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
(status & 0xff) == 0x7f
}
- pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
+ pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
(status >> 8) & 0xff
}
- pub fn WIFCONTINUED(status: ::c_int) -> bool {
+ pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
status == 0xffff
}
- pub fn WIFSIGNALED(status: ::c_int) -> bool {
+ pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
((status & 0x7f) + 1) as i8 >= 2
}
- pub fn WTERMSIG(status: ::c_int) -> ::c_int {
+ pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
status & 0x7f
}
- pub fn WIFEXITED(status: ::c_int) -> bool {
+ pub {const} fn WIFEXITED(status: ::c_int) -> bool {
(status & 0x7f) == 0
}
- pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
+ pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int {
(status >> 8) & 0xff
}
- pub fn WCOREDUMP(status: ::c_int) -> bool {
+ pub {const} fn WCOREDUMP(status: ::c_int) -> bool {
(status & 0x80) != 0
}
- pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
+ 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 fn IPOPT_COPIED(o: u8) -> u8 {
+ pub {const} fn IPOPT_COPIED(o: u8) -> u8 {
o & IPOPT_COPY
}
- pub fn IPOPT_CLASS(o: u8) -> u8 {
+ pub {const} fn IPOPT_CLASS(o: u8) -> u8 {
o & IPOPT_CLASS_MASK
}
- pub fn IPOPT_NUMBER(o: u8) -> u8 {
+ pub {const} fn IPOPT_NUMBER(o: u8) -> u8 {
o & IPOPT_NUMBER_MASK
}
- pub fn IPTOS_ECN(x: u8) -> u8 {
+ pub {const} fn IPTOS_ECN(x: u8) -> u8 {
x & ::IPTOS_ECN_MASK
}
}
extern "C" {
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 sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int;
pub fn fdatasync(fd: ::c_int) -> ::c_int;
- pub fn mincore(
- addr: *mut ::c_void,
- len: ::size_t,
- vec: *mut ::c_uchar,
- ) -> ::c_int;
+ pub fn mincore(addr: *mut ::c_void, len: ::size_t, vec: *mut ::c_uchar) -> ::c_int;
+
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_settime(
- clk_id: ::clockid_t,
- tp: *const ::timespec,
- ) -> ::c_int;
+ pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
+ pub fn clock_getcpuclockid(pid: ::pid_t, clk_id: *mut ::clockid_t) -> ::c_int;
+
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
- pub fn pthread_getattr_np(
- native: ::pthread_t,
- attr: *mut ::pthread_attr_t,
- ) -> ::c_int;
+ pub fn pthread_getattr_np(native: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int;
pub fn pthread_attr_getstack(
attr: *const ::pthread_attr_t,
stackaddr: *mut *mut ::c_void,
@@ -1335,16 +1464,13 @@ 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;
pub fn fstatvfs64(fd: ::c_int, buf: *mut statvfs64) -> ::c_int;
- pub fn memrchr(
- cx: *const ::c_void,
- c: ::c_int,
- n: ::size_t,
- ) -> *mut ::c_void;
+ pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
- pub fn posix_fadvise(
+ 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: ::off_t,
- len: ::off_t,
+ offset: ::off64_t,
+ len: ::off64_t,
advise: ::c_int,
) -> ::c_int;
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
@@ -1356,11 +1482,7 @@ extern "C" {
) -> ::c_int;
pub fn duplocale(base: ::locale_t) -> ::locale_t;
pub fn freelocale(loc: ::locale_t);
- pub fn newlocale(
- mask: ::c_int,
- locale: *const ::c_char,
- base: ::locale_t,
- ) -> ::locale_t;
+ pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t;
pub fn uselocale(loc: ::locale_t) -> ::locale_t;
pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int;
pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int;
@@ -1382,36 +1504,14 @@ extern "C" {
offset: off64_t,
) -> *mut ::c_void;
pub fn open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
- pub fn openat64(
- fd: ::c_int,
- path: *const c_char,
- oflag: ::c_int,
- ...
- ) -> ::c_int;
- pub fn pread64(
- fd: ::c_int,
- buf: *mut ::c_void,
- count: ::size_t,
- offset: off64_t,
- ) -> ::ssize_t;
- pub fn preadv64(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off64_t,
- ) -> ::ssize_t;
+ pub fn openat64(fd: ::c_int, path: *const c_char, oflag: ::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 pwritev64(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off64_t,
- ) -> ::ssize_t;
pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64;
pub fn readdir64_r(
dirp: *mut ::DIR,
@@ -1435,16 +1535,7 @@ extern "C" {
attr: *mut pthread_condattr_t,
clock_id: ::clockid_t,
) -> ::c_int;
- pub fn pthread_condattr_setpshared(
- attr: *mut pthread_condattr_t,
- pshared: ::c_int,
- ) -> ::c_int;
- pub fn accept4(
- fd: ::c_int,
- addr: *mut ::sockaddr,
- len: *mut ::socklen_t,
- flg: ::c_int,
- ) -> ::c_int;
+ pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: ::c_int) -> ::c_int;
pub fn pthread_mutexattr_setpshared(
attr: *mut pthread_mutexattr_t,
pshared: ::c_int,
@@ -1453,34 +1544,15 @@ extern "C" {
attr: *const pthread_rwlockattr_t,
val: *mut ::c_int,
) -> ::c_int;
- pub fn pthread_rwlockattr_setpshared(
- attr: *mut pthread_rwlockattr_t,
- val: ::c_int,
- ) -> ::c_int;
- pub fn ptsname_r(
- fd: ::c_int,
- buf: *mut ::c_char,
- buflen: ::size_t,
- ) -> ::c_int;
+ pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: ::c_int) -> ::c_int;
+ pub fn ptsname_r(fd: ::c_int, buf: *mut ::c_char, buflen: ::size_t) -> ::c_int;
pub fn clearenv() -> ::c_int;
- pub fn waitid(
- idtype: idtype_t,
- id: id_t,
- infop: *mut ::siginfo_t,
- options: ::c_int,
- ) -> ::c_int;
+ pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int)
+ -> ::c_int;
pub fn setreuid(ruid: ::uid_t, euid: ::uid_t) -> ::c_int;
pub fn setregid(rgid: ::gid_t, egid: ::gid_t) -> ::c_int;
- pub fn getresuid(
- ruid: *mut ::uid_t,
- euid: *mut ::uid_t,
- suid: *mut ::uid_t,
- ) -> ::c_int;
- pub fn getresgid(
- rgid: *mut ::gid_t,
- egid: *mut ::gid_t,
- sgid: *mut ::gid_t,
- ) -> ::c_int;
+ pub fn getresuid(ruid: *mut ::uid_t, euid: *mut ::uid_t, suid: *mut ::uid_t) -> ::c_int;
+ pub fn getresgid(rgid: *mut ::gid_t, egid: *mut ::gid_t, sgid: *mut ::gid_t) -> ::c_int;
pub fn acct(filename: *const ::c_char) -> ::c_int;
pub fn brk(addr: *mut ::c_void) -> ::c_int;
pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void;
@@ -1497,19 +1569,6 @@ extern "C" {
options: ::c_int,
rusage: *mut ::rusage,
) -> ::pid_t;
- pub fn openpty(
- amaster: *mut ::c_int,
- aslave: *mut ::c_int,
- name: *mut ::c_char,
- termp: *const termios,
- winp: *const ::winsize,
- ) -> ::c_int;
- pub fn forkpty(
- amaster: *mut ::c_int,
- name: *mut ::c_char,
- termp: *const termios,
- winp: *const ::winsize,
- ) -> ::pid_t;
pub fn login_tty(fd: ::c_int) -> ::c_int;
pub fn execvpe(
file: *const ::c_char,
@@ -1523,43 +1582,60 @@ extern "C" {
) -> ::c_int;
pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
pub fn freeifaddrs(ifa: *mut ::ifaddrs);
- pub fn bind(
- socket: ::c_int,
- address: *const ::sockaddr,
- address_len: ::socklen_t,
- ) -> ::c_int;
+ pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int;
- pub fn writev(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- ) -> ::ssize_t;
- pub fn readv(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- ) -> ::ssize_t;
+ pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
+ pub fn readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
- pub fn sendmsg(
- fd: ::c_int,
- msg: *const ::msghdr,
- flags: ::c_int,
- ) -> ::ssize_t;
- pub fn recvmsg(
- fd: ::c_int,
- msg: *mut ::msghdr,
- flags: ::c_int,
- ) -> ::ssize_t;
+ pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t;
+ pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t;
pub fn uname(buf: *mut ::utsname) -> ::c_int;
}
cfg_if! {
+ if #[cfg(not(target_env = "uclibc"))] {
+ extern "C" {
+ 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;
+ // uclibc has separate non-const version of this function
+ pub fn forkpty(
+ amaster: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *const termios,
+ winp: *const ::winsize,
+ ) -> ::pid_t;
+ // uclibc has separate non-const version of this function
+ pub fn openpty(
+ amaster: *mut ::c_int,
+ aslave: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *const termios,
+ winp: *const ::winsize,
+ ) -> ::c_int;
+ }
+ }
+}
+
+cfg_if! {
if #[cfg(target_os = "emscripten")] {
mod emscripten;
pub use self::emscripten::*;
} else if #[cfg(target_os = "linux")] {
mod linux;
pub use self::linux::*;
+ } else if #[cfg(target_os = "l4re")] {
+ mod linux;
+ pub use self::linux::*;
} else if #[cfg(target_os = "android")] {
mod android;
pub use self::android::*;
diff --git a/src/unix/mod.rs b/src/unix/mod.rs
index 238da24b..be7b6e73 100644
--- a/src/unix/mod.rs
+++ b/src/unix/mod.rs
@@ -226,8 +226,13 @@ pub const S_ISUID: ::mode_t = 0x800;
pub const S_ISGID: ::mode_t = 0x400;
pub const S_ISVTX: ::mode_t = 0x200;
-pub const IF_NAMESIZE: ::size_t = 16;
-pub const IFNAMSIZ: ::size_t = IF_NAMESIZE;
+cfg_if! {
+ if #[cfg(not(any(target_os = "haiku", target_os = "illumos",
+ target_os = "solaris")))] {
+ pub const IF_NAMESIZE: ::size_t = 16;
+ pub const IFNAMSIZ: ::size_t = IF_NAMESIZE;
+ }
+}
pub const LOG_EMERG: ::c_int = 0;
pub const LOG_ALERT: ::c_int = 1;
@@ -256,19 +261,18 @@ pub const LOG_LOCAL5: ::c_int = 21 << 3;
pub const LOG_LOCAL6: ::c_int = 22 << 3;
pub const LOG_LOCAL7: ::c_int = 23 << 3;
-pub const LOG_PID: ::c_int = 0x01;
-pub const LOG_CONS: ::c_int = 0x02;
-pub const LOG_ODELAY: ::c_int = 0x04;
-pub const LOG_NDELAY: ::c_int = 0x08;
-pub const LOG_NOWAIT: ::c_int = 0x10;
-
+cfg_if! {
+ if #[cfg(not(target_os = "haiku"))] {
+ pub const LOG_PID: ::c_int = 0x01;
+ pub const LOG_CONS: ::c_int = 0x02;
+ pub const LOG_ODELAY: ::c_int = 0x04;
+ pub const LOG_NDELAY: ::c_int = 0x08;
+ pub const LOG_NOWAIT: ::c_int = 0x10;
+ }
+}
pub const LOG_PRIMASK: ::c_int = 7;
pub const LOG_FACMASK: ::c_int = 0x3f8;
-pub const PRIO_PROCESS: ::c_int = 0;
-pub const PRIO_PGRP: ::c_int = 1;
-pub const PRIO_USER: ::c_int = 2;
-
pub const PRIO_MIN: ::c_int = -20;
pub const PRIO_MAX: ::c_int = 20;
@@ -298,6 +302,32 @@ cfg_if! {
} else if #[cfg(feature = "std")] {
// cargo build, don't pull in anything extra as the libstd dep
// already pulls in all libs.
+ } else if #[cfg(all(target_os = "linux",
+ any(target_env = "gnu", target_env = "uclibc"),
+ feature = "rustc-dep-of-std"))] {
+ #[link(name = "util", kind = "static-nobundle",
+ cfg(target_feature = "crt-static"))]
+ #[link(name = "rt", kind = "static-nobundle",
+ cfg(target_feature = "crt-static"))]
+ #[link(name = "pthread", kind = "static-nobundle",
+ cfg(target_feature = "crt-static"))]
+ #[link(name = "m", kind = "static-nobundle",
+ cfg(target_feature = "crt-static"))]
+ #[link(name = "dl", kind = "static-nobundle",
+ cfg(target_feature = "crt-static"))]
+ #[link(name = "c", kind = "static-nobundle",
+ cfg(target_feature = "crt-static"))]
+ #[link(name = "gcc_eh", kind = "static-nobundle",
+ cfg(target_feature = "crt-static"))]
+ #[link(name = "gcc", kind = "static-nobundle",
+ cfg(target_feature = "crt-static"))]
+ #[link(name = "util", cfg(not(target_feature = "crt-static")))]
+ #[link(name = "rt", cfg(not(target_feature = "crt-static")))]
+ #[link(name = "pthread", cfg(not(target_feature = "crt-static")))]
+ #[link(name = "m", cfg(not(target_feature = "crt-static")))]
+ #[link(name = "dl", cfg(not(target_feature = "crt-static")))]
+ #[link(name = "c", cfg(not(target_feature = "crt-static")))]
+ extern {}
} else if #[cfg(target_env = "musl")] {
#[cfg_attr(feature = "rustc-dep-of-std",
link(name = "c", kind = "static",
@@ -365,7 +395,7 @@ impl ::Clone for FILE {
}
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
-pub enum fpos_t {} // TODO: fill this out with a struct
+pub enum fpos_t {} // FIXME: fill this out with a struct
impl ::Copy for fpos_t {}
impl ::Clone for fpos_t {
fn clone(&self) -> fpos_t {
@@ -388,6 +418,19 @@ extern "C" {
pub fn isblank(c: c_int) -> c_int;
pub fn tolower(c: c_int) -> c_int;
pub fn toupper(c: c_int) -> c_int;
+ pub fn qsort(
+ base: *mut c_void,
+ num: size_t,
+ size: size_t,
+ compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
+ );
+ pub fn bsearch(
+ key: *const c_void,
+ base: *const c_void,
+ num: size_t,
+ size: size_t,
+ compar: ::Option<unsafe extern "C" fn(*const c_void, *const c_void) -> c_int>,
+ ) -> *mut c_void;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "fopen$UNIX2003"
@@ -397,28 +440,21 @@ extern "C" {
all(target_os = "macos", target_arch = "x86"),
link_name = "freopen$UNIX2003"
)]
- pub fn freopen(
- filename: *const c_char,
- mode: *const c_char,
- file: *mut FILE,
- ) -> *mut FILE;
+ pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE;
+ pub fn fmemopen(buf: *mut c_void, size: size_t, mode: *const c_char) -> *mut FILE;
+ pub fn open_memstream(ptr: *mut *mut c_char, sizeloc: *mut size_t) -> *mut FILE;
+
pub fn fflush(file: *mut FILE) -> c_int;
pub fn fclose(file: *mut FILE) -> c_int;
pub fn remove(filename: *const c_char) -> c_int;
pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
pub fn tmpfile() -> *mut FILE;
- pub fn setvbuf(
- stream: *mut FILE,
- buffer: *mut c_char,
- mode: c_int,
- size: size_t,
- ) -> c_int;
+ pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int;
pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
pub fn getchar() -> c_int;
pub fn putchar(c: c_int) -> c_int;
pub fn fgetc(stream: *mut FILE) -> c_int;
- pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
- -> *mut c_char;
+ pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
@@ -427,22 +463,12 @@ extern "C" {
pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
pub fn puts(s: *const c_char) -> c_int;
pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
- pub fn fread(
- ptr: *mut c_void,
- size: size_t,
- nobj: size_t,
- stream: *mut FILE,
- ) -> size_t;
+ pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "fwrite$UNIX2003"
)]
- pub fn fwrite(
- ptr: *const c_void,
- size: size_t,
- nobj: size_t,
- stream: *mut FILE,
- ) -> size_t;
+ pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
pub fn ftell(stream: *mut FILE) -> c_long;
pub fn rewind(stream: *mut FILE);
@@ -452,6 +478,7 @@ extern "C" {
pub fn fsetpos(stream: *mut FILE, ptr: *const fpos_t) -> c_int;
pub fn feof(stream: *mut FILE) -> c_int;
pub fn ferror(stream: *mut FILE) -> c_int;
+ pub fn clearerr(stream: *mut FILE);
pub fn perror(s: *const c_char);
pub fn atoi(s: *const c_char) -> c_int;
#[cfg_attr(
@@ -459,16 +486,8 @@ extern "C" {
link_name = "strtod$UNIX2003"
)]
pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
- pub fn strtol(
- s: *const c_char,
- endp: *mut *mut c_char,
- base: c_int,
- ) -> c_long;
- pub fn strtoul(
- s: *const c_char,
- endp: *mut *mut c_char,
- base: c_int,
- ) -> c_ulong;
+ pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long;
+ pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong;
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;
@@ -485,17 +504,9 @@ extern "C" {
pub fn getenv(s: *const c_char) -> *mut c_char;
pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
- pub fn strncpy(
- dst: *mut c_char,
- src: *const c_char,
- n: size_t,
- ) -> *mut c_char;
+ pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
- pub fn strncat(
- s: *mut c_char,
- ct: *const c_char,
- n: size_t,
- ) -> *mut c_char;
+ pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char;
pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
@@ -504,14 +515,11 @@ extern "C" {
pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
pub fn strdup(cs: *const c_char) -> *mut c_char;
+ pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char;
pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char;
pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int;
- pub fn strncasecmp(
- s1: *const c_char,
- s2: *const c_char,
- n: size_t,
- ) -> c_int;
+ pub fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int;
pub fn strlen(cs: *const c_char) -> size_t;
pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
#[cfg_attr(
@@ -521,25 +529,15 @@ extern "C" {
pub fn strerror(n: c_int) -> *mut c_char;
pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
+ pub fn strsignal(sig: c_int) -> *mut c_char;
pub fn wcslen(buf: *const wchar_t) -> size_t;
- pub fn wcstombs(
- dest: *mut c_char,
- src: *const wchar_t,
- n: size_t,
- ) -> ::size_t;
+ pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t;
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 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;
}
@@ -549,61 +547,67 @@ extern "C" {
#[cfg_attr(target_os = "netbsd", link_name = "__getpwuid50")]
pub fn getpwuid(uid: ::uid_t) -> *mut passwd;
- pub fn fprintf(
- stream: *mut ::FILE,
- format: *const ::c_char,
- ...
- ) -> ::c_int;
+ pub fn fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
pub fn printf(format: *const ::c_char, ...) -> ::c_int;
- pub fn snprintf(
- s: *mut ::c_char,
- n: ::size_t,
- format: *const ::c_char,
- ...
- ) -> ::c_int;
+ pub fn snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int;
pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
- #[cfg_attr(target_os = "linux", link_name = "__isoc99_fscanf")]
- pub fn fscanf(
- stream: *mut ::FILE,
- format: *const ::c_char,
- ...
- ) -> ::c_int;
- #[cfg_attr(target_os = "linux", link_name = "__isoc99_scanf")]
+ #[cfg_attr(
+ all(target_os = "linux", not(target_env = "uclibc")),
+ link_name = "__isoc99_fscanf"
+ )]
+ pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "linux", not(target_env = "uclibc")),
+ link_name = "__isoc99_scanf"
+ )]
pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
- #[cfg_attr(target_os = "linux", link_name = "__isoc99_sscanf")]
- pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...)
- -> ::c_int;
+ #[cfg_attr(
+ all(target_os = "linux", not(target_env = "uclibc")),
+ link_name = "__isoc99_sscanf"
+ )]
+ pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int;
pub fn getchar_unlocked() -> ::c_int;
pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
+ #[cfg(not(all(
+ libc_cfg_target_vendor,
+ target_arch = "powerpc",
+ target_vendor = "nintendo"
+ )))]
#[cfg_attr(target_os = "netbsd", link_name = "__socket30")]
#[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")]
pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int;
+ #[cfg(not(all(
+ libc_cfg_target_vendor,
+ target_arch = "powerpc",
+ target_vendor = "nintendo"
+ )))]
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "connect$UNIX2003"
)]
#[cfg_attr(target_os = "illumos", link_name = "__xnet_connect")]
- pub fn connect(
- socket: ::c_int,
- address: *const sockaddr,
- len: socklen_t,
- ) -> ::c_int;
+ pub fn connect(socket: ::c_int, address: *const sockaddr, len: socklen_t) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "listen$UNIX2003"
)]
- #[cfg_attr(target_os = "illumos", link_name = "__xnet_listen")]
pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
+ #[cfg(not(all(
+ libc_cfg_target_vendor,
+ target_arch = "powerpc",
+ target_vendor = "nintendo"
+ )))]
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "accept$UNIX2003"
)]
- pub fn accept(
- socket: ::c_int,
- address: *mut sockaddr,
- address_len: *mut socklen_t,
- ) -> ::c_int;
+ pub fn accept(socket: ::c_int, address: *mut sockaddr, address_len: *mut socklen_t) -> ::c_int;
+ #[cfg(not(all(
+ libc_cfg_target_vendor,
+ target_arch = "powerpc",
+ target_vendor = "nintendo"
+ )))]
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "getpeername$UNIX2003"
@@ -613,6 +617,11 @@ extern "C" {
address: *mut sockaddr,
address_len: *mut socklen_t,
) -> ::c_int;
+ #[cfg(not(all(
+ libc_cfg_target_vendor,
+ target_arch = "powerpc",
+ target_vendor = "nintendo"
+ )))]
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "getsockname$UNIX2003"
@@ -640,6 +649,11 @@ extern "C" {
protocol: ::c_int,
socket_vector: *mut ::c_int,
) -> ::c_int;
+ #[cfg(not(all(
+ libc_cfg_target_vendor,
+ target_arch = "powerpc",
+ target_vendor = "nintendo"
+ )))]
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "sendto$UNIX2003"
@@ -666,7 +680,10 @@ extern "C" {
)]
pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "fstat$INODE64")]
+ #[cfg_attr(
+ all(target_os = "macos", not(target_arch = "aarch64")),
+ link_name = "fstat$INODE64"
+ )]
#[cfg_attr(target_os = "netbsd", link_name = "__fstat50")]
#[cfg_attr(
all(target_os = "freebsd", any(freebsd11, freebsd10)),
@@ -676,7 +693,10 @@ extern "C" {
pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "stat$INODE64")]
+ #[cfg_attr(
+ all(target_os = "macos", not(target_arch = "aarch64")),
+ link_name = "stat$INODE64"
+ )]
#[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
#[cfg_attr(
all(target_os = "freebsd", any(freebsd11, freebsd10)),
@@ -719,7 +739,10 @@ extern "C" {
#[cfg_attr(target_os = "netbsd", link_name = "__opendir30")]
pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
- #[cfg_attr(target_os = "macos", link_name = "readdir$INODE64")]
+ #[cfg_attr(
+ all(target_os = "macos", not(target_arch = "aarch64")),
+ link_name = "readdir$INODE64"
+ )]
#[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
#[cfg_attr(
all(target_os = "freebsd", any(freebsd11, freebsd10)),
@@ -755,7 +778,10 @@ extern "C" {
group: ::gid_t,
flags: ::c_int,
) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "fstatat$INODE64")]
+ #[cfg_attr(
+ all(target_os = "macos", not(target_arch = "aarch64")),
+ link_name = "fstatat$INODE64"
+ )]
#[cfg_attr(
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "fstatat@FBSD_1.1"
@@ -784,11 +810,7 @@ extern "C" {
newdirfd: ::c_int,
linkpath: *const ::c_char,
) -> ::c_int;
- pub fn unlinkat(
- dirfd: ::c_int,
- pathname: *const ::c_char,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int) -> ::c_int;
pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
pub fn alarm(seconds: ::c_uint) -> ::c_uint;
@@ -812,16 +834,8 @@ extern "C" {
pub fn dup(fd: ::c_int) -> ::c_int;
pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int;
- pub fn execle(
- path: *const ::c_char,
- arg0: *const ::c_char,
- ...
- ) -> ::c_int;
- pub fn execlp(
- file: *const ::c_char,
- arg0: *const ::c_char,
- ...
- ) -> ::c_int;
+ pub fn execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int;
+ pub fn execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int;
pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int;
pub fn execve(
prog: *const c_char,
@@ -836,16 +850,13 @@ extern "C" {
pub fn geteuid() -> uid_t;
pub fn getgid() -> gid_t;
pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int;
+ #[cfg_attr(target_os = "illumos", link_name = "getloginx")]
pub fn getlogin() -> *mut c_char;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "getopt$UNIX2003"
)]
- pub fn getopt(
- argc: ::c_int,
- argv: *const *mut c_char,
- optstr: *const c_char,
- ) -> ::c_int;
+ pub fn getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int;
pub fn getpgid(pid: pid_t) -> pid_t;
pub fn getpgrp() -> pid_t;
pub fn getpid() -> pid_t;
@@ -856,17 +867,12 @@ extern "C" {
pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
pub fn pipe(fds: *mut ::c_int) -> ::c_int;
- pub fn posix_memalign(
- memptr: *mut *mut ::c_void,
- align: ::size_t,
- size: ::size_t,
- ) -> ::c_int;
+ pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "read$UNIX2003"
)]
- pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t)
- -> ::ssize_t;
+ pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t;
pub fn rmdir(path: *const c_char) -> ::c_int;
pub fn seteuid(uid: uid_t) -> ::c_int;
pub fn setegid(gid: gid_t) -> ::c_int;
@@ -892,11 +898,8 @@ extern "C" {
all(target_os = "macos", target_arch = "x86"),
link_name = "ttyname_r$UNIX2003"
)]
- pub fn ttyname_r(
- fd: ::c_int,
- buf: *mut c_char,
- buflen: ::size_t,
- ) -> ::c_int;
+ #[cfg_attr(target_os = "illumos", link_name = "__posix_ttyname_r")]
+ pub fn ttyname_r(fd: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
pub fn unlink(c: *const c_char) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
@@ -907,40 +910,22 @@ extern "C" {
all(target_os = "macos", target_arch = "x86"),
link_name = "waitpid$UNIX2003"
)]
- pub fn waitpid(
- pid: pid_t,
- status: *mut ::c_int,
- options: ::c_int,
- ) -> pid_t;
+ pub fn waitpid(pid: pid_t, status: *mut ::c_int, options: ::c_int) -> pid_t;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "write$UNIX2003"
)]
- pub fn write(
- fd: ::c_int,
- buf: *const ::c_void,
- count: ::size_t,
- ) -> ::ssize_t;
+ pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "pread$UNIX2003"
)]
- pub fn pread(
- fd: ::c_int,
- buf: *mut ::c_void,
- count: ::size_t,
- offset: off_t,
- ) -> ::ssize_t;
+ pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "pwrite$UNIX2003"
)]
- pub fn pwrite(
- fd: ::c_int,
- buf: *const ::c_void,
- count: ::size_t,
- offset: off_t,
- ) -> ::ssize_t;
+ pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t;
pub fn umask(mask: mode_t) -> mode_t;
#[cfg_attr(target_os = "netbsd", link_name = "__utime50")]
@@ -981,12 +966,12 @@ extern "C" {
pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
pub fn if_nametoindex(ifname: *const c_char) -> ::c_uint;
- pub fn if_indextoname(
- ifindex: ::c_uint,
- ifname: *mut ::c_char,
- ) -> *mut ::c_char;
+ pub fn if_indextoname(ifindex: ::c_uint, ifname: *mut ::c_char) -> *mut ::c_char;
- #[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")]
+ #[cfg_attr(
+ all(target_os = "macos", not(target_arch = "aarch64")),
+ link_name = "lstat$INODE64"
+ )]
#[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]
#[cfg_attr(
all(target_os = "freebsd", any(freebsd11, freebsd10)),
@@ -1004,11 +989,7 @@ extern "C" {
all(target_os = "macos", target_arch = "x86"),
link_name = "setenv$UNIX2003"
)]
- pub fn setenv(
- name: *const c_char,
- val: *const c_char,
- overwrite: ::c_int,
- ) -> ::c_int;
+ pub fn setenv(name: *const c_char, val: *const c_char, overwrite: ::c_int) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "unsetenv$UNIX2003"
@@ -1029,10 +1010,7 @@ extern "C" {
any(target_os = "macos", target_os = "ios"),
link_name = "realpath$DARWIN_EXTSN"
)]
- pub fn realpath(
- pathname: *const ::c_char,
- resolved: *mut ::c_char,
- ) -> *mut ::c_char;
+ pub fn realpath(pathname: *const ::c_char, resolved: *mut ::c_char) -> *mut ::c_char;
pub fn flock(fd: ::c_int, operation: ::c_int) -> ::c_int;
@@ -1044,21 +1022,12 @@ extern "C" {
all(target_os = "macos", target_arch = "x86"),
link_name = "pthread_join$UNIX2003"
)]
- pub fn pthread_join(
- native: ::pthread_t,
- value: *mut *mut ::c_void,
- ) -> ::c_int;
+ pub fn pthread_join(native: ::pthread_t, value: *mut *mut ::c_void) -> ::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_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_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;
#[cfg_attr(target_os = "netbsd", link_name = "__libc_thr_yield")]
pub fn sched_yield() -> ::c_int;
@@ -1068,10 +1037,7 @@ extern "C" {
) -> ::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_setspecific(key: pthread_key_t, value: *const ::c_void) -> ::c_int;
pub fn pthread_mutex_init(
lock: *mut pthread_mutex_t,
attr: *const pthread_mutexattr_t,
@@ -1086,30 +1052,20 @@ extern "C" {
all(target_os = "macos", target_arch = "x86"),
link_name = "pthread_mutexattr_destroy$UNIX2003"
)]
- pub fn pthread_mutexattr_destroy(
- 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_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int;
+ pub fn pthread_mutexattr_settype(attr: *mut pthread_mutexattr_t, _type: ::c_int) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "pthread_cond_init$UNIX2003"
)]
- pub fn pthread_cond_init(
- cond: *mut pthread_cond_t,
- attr: *const pthread_condattr_t,
- ) -> ::c_int;
+ pub fn pthread_cond_init(cond: *mut pthread_cond_t, attr: *const pthread_condattr_t)
+ -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "pthread_cond_wait$UNIX2003"
)]
- pub fn pthread_cond_wait(
- cond: *mut pthread_cond_t,
- lock: *mut pthread_mutex_t,
- ) -> ::c_int;
+ pub fn pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "pthread_cond_timedwait$UNIX2003"
@@ -1162,11 +1118,8 @@ extern "C" {
link_name = "pthread_rwlock_unlock$UNIX2003"
)]
pub fn pthread_rwlock_unlock(lock: *mut pthread_rwlock_t) -> ::c_int;
- pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t)
- -> ::c_int;
- pub fn pthread_rwlockattr_destroy(
- attr: *mut pthread_rwlockattr_t,
- ) -> ::c_int;
+ pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int;
+ pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int;
#[cfg_attr(target_os = "illumos", link_name = "__xnet_getsockopt")]
pub fn getsockopt(
@@ -1178,32 +1131,33 @@ extern "C" {
) -> ::c_int;
pub fn raise(signum: ::c_int) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__sigaction14")]
- pub fn sigaction(
- signum: ::c_int,
- act: *const sigaction,
- oldact: *mut sigaction,
- ) -> ::c_int;
+ pub fn sigaction(signum: ::c_int, act: *const sigaction, oldact: *mut sigaction) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__utimes50")]
- pub fn utimes(
- filename: *const ::c_char,
- times: *const ::timeval,
- ) -> ::c_int;
+ pub fn utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int;
pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
pub fn dlerror() -> *mut ::c_char;
- pub fn dlsym(
- handle: *mut ::c_void,
- symbol: *const ::c_char,
- ) -> *mut ::c_void;
+ pub fn dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void;
pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int;
+ #[cfg(not(all(
+ libc_cfg_target_vendor,
+ target_arch = "powerpc",
+ target_vendor = "nintendo"
+ )))]
+ #[cfg_attr(target_os = "illumos", link_name = "__xnet_getaddrinfo")]
pub fn getaddrinfo(
node: *const c_char,
service: *const c_char,
hints: *const addrinfo,
res: *mut *mut addrinfo,
) -> ::c_int;
+ #[cfg(not(all(
+ libc_cfg_target_vendor,
+ target_arch = "powerpc",
+ target_vendor = "nintendo"
+ )))]
pub fn freeaddrinfo(res: *mut addrinfo);
pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char;
#[cfg_attr(
@@ -1215,46 +1169,58 @@ extern "C" {
),
link_name = "__res_init"
)]
- #[cfg_attr(
- any(target_os = "macos", target_os = "ios"),
- link_name = "res_9_init"
- )]
+ #[cfg_attr(any(target_os = "macos", target_os = "ios"), link_name = "res_9_init")]
pub fn res_init() -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__gmtime_r50")]
+ #[cfg_attr(target_env = "musl", allow(deprecated))]
+ // FIXME: for `time_t`
pub fn gmtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
#[cfg_attr(target_os = "netbsd", link_name = "__localtime_r50")]
+ #[cfg_attr(target_env = "musl", allow(deprecated))]
+ // FIXME: for `time_t`
pub fn localtime_r(time_p: *const time_t, result: *mut tm) -> *mut tm;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "mktime$UNIX2003"
)]
#[cfg_attr(target_os = "netbsd", link_name = "__mktime50")]
+ #[cfg_attr(target_env = "musl", allow(deprecated))]
+ // FIXME: for `time_t`
pub fn mktime(tm: *mut tm) -> time_t;
#[cfg_attr(target_os = "netbsd", link_name = "__time50")]
+ #[cfg_attr(target_env = "musl", allow(deprecated))]
+ // FIXME: for `time_t`
pub fn time(time: *mut time_t) -> time_t;
#[cfg_attr(target_os = "netbsd", link_name = "__gmtime50")]
+ #[cfg_attr(target_env = "musl", allow(deprecated))]
+ // FIXME: for `time_t`
pub fn gmtime(time_p: *const time_t) -> *mut tm;
#[cfg_attr(target_os = "netbsd", link_name = "__locatime50")]
+ #[cfg_attr(target_env = "musl", allow(deprecated))]
+ // FIXME: for `time_t`
pub fn localtime(time_p: *const time_t) -> *mut tm;
#[cfg_attr(target_os = "netbsd", link_name = "__difftime50")]
+ #[cfg_attr(target_env = "musl", allow(deprecated))]
+ // FIXME: for `time_t`
pub fn difftime(time1: time_t, time0: time_t) -> ::c_double;
+ #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
+ #[cfg_attr(target_env = "musl", allow(deprecated))]
+ // FIXME: for `time_t`
+ pub fn timegm(tm: *mut ::tm) -> time_t;
#[cfg_attr(target_os = "netbsd", link_name = "__mknod50")]
#[cfg_attr(
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "mknod@FBSD_1.0"
)]
- pub fn mknod(
- pathname: *const ::c_char,
- mode: ::mode_t,
- dev: ::dev_t,
- ) -> ::c_int;
+ pub fn mknod(pathname: *const ::c_char, mode: ::mode_t, dev: ::dev_t) -> ::c_int;
pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
- pub fn getservbyname(
- name: *const ::c_char,
- proto: *const ::c_char,
- ) -> *mut servent;
+ pub fn endservent();
+ pub fn getservbyname(name: *const ::c_char, proto: *const ::c_char) -> *mut servent;
+ pub fn getservbyport(port: ::c_int, proto: *const ::c_char) -> *mut servent;
+ pub fn getservent() -> *mut servent;
+ pub fn setservent(stayopen: ::c_int);
pub fn getprotobyname(name: *const ::c_char) -> *mut protoent;
pub fn getprotobynumber(proto: ::c_int) -> *mut protoent;
pub fn chroot(name: *const ::c_char) -> ::c_int;
@@ -1267,22 +1233,12 @@ extern "C" {
all(target_os = "macos", target_arch = "x86"),
link_name = "send$UNIX2003"
)]
- pub fn send(
- socket: ::c_int,
- buf: *const ::c_void,
- len: ::size_t,
- flags: ::c_int,
- ) -> ::ssize_t;
+ pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "recv$UNIX2003"
)]
- pub fn recv(
- socket: ::c_int,
- buf: *mut ::c_void,
- len: ::size_t,
- flags: ::c_int,
- ) -> ::ssize_t;
+ pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "putenv$UNIX2003"
@@ -1311,10 +1267,7 @@ extern "C" {
timeout: *mut timeval,
) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__setlocale50")]
- pub fn setlocale(
- category: ::c_int,
- locale: *const ::c_char,
- ) -> *mut ::c_char;
+ pub fn setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char;
pub fn localeconv() -> *mut lconv;
#[cfg_attr(
@@ -1327,11 +1280,7 @@ extern "C" {
pub fn statvfs(path: *const c_char, buf: *mut statvfs) -> ::c_int;
pub fn fstatvfs(fd: ::c_int, buf: *mut statvfs) -> ::c_int;
- pub fn readlink(
- path: *const c_char,
- buf: *mut c_char,
- bufsz: ::size_t,
- ) -> ::ssize_t;
+ pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t;
#[cfg_attr(target_os = "netbsd", link_name = "__sigemptyset14")]
pub fn sigemptyset(set: *mut sigset_t) -> ::c_int;
@@ -1345,17 +1294,10 @@ extern "C" {
pub fn sigismember(set: *const sigset_t, signum: ::c_int) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__sigprocmask14")]
- pub fn sigprocmask(
- how: ::c_int,
- set: *const sigset_t,
- oldset: *mut sigset_t,
- ) -> ::c_int;
+ pub fn sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__sigpending14")]
pub fn sigpending(set: *mut sigset_t) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
- pub fn timegm(tm: *mut ::tm) -> time_t;
-
pub fn sysconf(name: ::c_int) -> ::c_long;
pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
@@ -1377,11 +1319,7 @@ extern "C" {
timeout: *const timespec,
sigmask: *const sigset_t,
) -> ::c_int;
- pub fn fseeko(
- stream: *mut ::FILE,
- offset: ::off_t,
- whence: ::c_int,
- ) -> ::c_int;
+ pub fn fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int;
pub fn ftello(stream: *mut ::FILE) -> ::off_t;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
@@ -1393,11 +1331,7 @@ extern "C" {
pub fn cfsetispeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
pub fn cfsetospeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int;
pub fn tcgetattr(fd: ::c_int, termios: *mut ::termios) -> ::c_int;
- pub fn tcsetattr(
- fd: ::c_int,
- optional_actions: ::c_int,
- termios: *const ::termios,
- ) -> ::c_int;
+ pub fn tcsetattr(fd: ::c_int, optional_actions: ::c_int, termios: *const ::termios) -> ::c_int;
pub fn tcflow(fd: ::c_int, action: ::c_int) -> ::c_int;
pub fn tcflush(fd: ::c_int, action: ::c_int) -> ::c_int;
pub fn tcgetsid(fd: ::c_int) -> ::pid_t;
@@ -1424,11 +1358,20 @@ extern "C" {
pub fn unlockpt(fd: ::c_int) -> ::c_int;
pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
- pub fn getline(
- lineptr: *mut *mut c_char,
- n: *mut size_t,
- stream: *mut FILE,
- ) -> ssize_t;
+ pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t;
+
+ pub fn lockf(fd: ::c_int, cmd: ::c_int, len: ::off_t) -> ::c_int;
+}
+
+cfg_if! {
+ if #[cfg(not(target_env = "uclibc"))] {
+ extern "C" {
+ pub fn open_wmemstream(
+ ptr: *mut *mut wchar_t,
+ sizeloc: *mut size_t,
+ ) -> *mut FILE;
+ }
+ }
}
cfg_if! {
@@ -1455,15 +1398,17 @@ cfg_if! {
link_name = "fdopendir$INODE64$UNIX2003")]
pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
- #[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")]
+ #[cfg_attr(all(target_os = "macos", not(target_arch = "aarch64")),
+ link_name = "readdir_r$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
#[cfg_attr(
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "readdir_r@FBSD_1.0"
)]
- /// The 64-bit libc on Solaris and illumos only has readdir_r. If a
+ #[allow(non_autolinks)] // FIXME: `<>` breaks line length limit.
+ /// The 64-bit libc on Solaris and illumos only has readdir_r. If a
/// 32-bit Solaris or illumos target is ever created, it should use
- /// __posix_readdir_r. See libc(3LIB) on Solaris or illumos:
+ /// __posix_readdir_r. See libc(3LIB) on Solaris or illumos:
/// https://illumos.org/man/3lib/libc
/// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html
/// https://www.unix.com/man-page/opensolaris/3LIB/libc/
@@ -1484,13 +1429,11 @@ cfg_if! {
}
cfg_if! {
- if #[cfg(target_env = "uclibc")] {
- mod uclibc;
- pub use self::uclibc::*;
- } else if #[cfg(target_env = "newlib")] {
+ if #[cfg(target_env = "newlib")] {
mod newlib;
pub use self::newlib::*;
} else if #[cfg(any(target_os = "linux",
+ target_os = "l4re",
target_os = "android",
target_os = "emscripten"))] {
mod linux_like;
diff --git a/src/unix/newlib/aarch64/mod.rs b/src/unix/newlib/aarch64/mod.rs
index 7e1b2bb7..71aa8949 100644
--- a/src/unix/newlib/aarch64/mod.rs
+++ b/src/unix/newlib/aarch64/mod.rs
@@ -1,3 +1,4 @@
+pub type clock_t = ::c_long;
pub type c_char = u8;
pub type wchar_t = u32;
@@ -29,5 +30,23 @@ s! {
}
}
+pub const AF_INET6: ::c_int = 23;
+
+pub const FIONBIO: ::c_ulong = 1;
+
+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 SOL_SOCKET: ::c_int = 65535;
+
+pub const MSG_OOB: ::c_int = 1;
+pub const MSG_PEEK: ::c_int = 2;
+pub const MSG_DONTWAIT: ::c_int = 4;
+pub const MSG_DONTROUTE: ::c_int = 0;
+pub const MSG_WAITALL: ::c_int = 0;
+pub const MSG_MORE: ::c_int = 0;
+pub const MSG_NOSIGNAL: ::c_int = 0;
diff --git a/src/unix/newlib/arm/mod.rs b/src/unix/newlib/arm/mod.rs
index 39cb425f..78bea276 100644
--- a/src/unix/newlib/arm/mod.rs
+++ b/src/unix/newlib/arm/mod.rs
@@ -1,3 +1,4 @@
+pub type clock_t = ::c_long;
pub type c_char = u8;
pub type wchar_t = u32;
@@ -31,5 +32,23 @@ s! {
}
}
-pub const POLLOUT: ::c_short = 0x10;
+pub const AF_INET6: ::c_int = 23;
+
+pub const FIONBIO: ::c_ulong = 1;
+
+pub const POLLIN: ::c_short = 0x1;
+pub const POLLPRI: ::c_short = 0x2;
pub const POLLHUP: ::c_short = 0x4;
+pub const POLLERR: ::c_short = 0x8;
+pub const POLLOUT: ::c_short = 0x10;
+pub const POLLNVAL: ::c_short = 0x20;
+
+pub const SOL_SOCKET: ::c_int = 65535;
+
+pub const MSG_OOB: ::c_int = 1;
+pub const MSG_PEEK: ::c_int = 2;
+pub const MSG_DONTWAIT: ::c_int = 4;
+pub const MSG_DONTROUTE: ::c_int = 0;
+pub const MSG_WAITALL: ::c_int = 0;
+pub const MSG_MORE: ::c_int = 0;
+pub const MSG_NOSIGNAL: ::c_int = 0;
diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs
index bd9a1079..6e87983f 100644
--- a/src/unix/newlib/mod.rs
+++ b/src/unix/newlib/mod.rs
@@ -1,6 +1,5 @@
pub type blkcnt_t = i32;
pub type blksize_t = i32;
-pub type clock_t = i32;
pub type clockid_t = ::c_ulong;
pub type dev_t = u32;
pub type fsblkcnt_t = u64;
@@ -25,14 +24,27 @@ pub type time_t = i32;
pub type useconds_t = u32;
s! {
+ // The order of the `ai_addr` field in this struct is crucial
+ // for converting between the Rust and C types.
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,
+
+ #[cfg(not(all(libc_cfg_target_vendor, target_arch = "powerpc",
+ target_vendor = "nintendo")))]
+ #[cfg(target_arch = "xtensa")]
+ pub ai_addr: *mut sockaddr,
+
pub ai_canonname: *mut ::c_char,
+
+ #[cfg(not(all(libc_cfg_target_vendor, target_arch = "powerpc",
+ target_vendor = "nintendo")))]
+ #[cfg(not(target_arch = "xtensa"))]
pub ai_addr: *mut sockaddr,
+
pub ai_next: *mut addrinfo,
}
@@ -364,11 +376,6 @@ pub const O_NONBLOCK: ::c_int = 16384;
pub const O_ACCMODE: ::c_int = 3;
pub const O_CLOEXEC: ::c_int = 0x80000;
-pub const POLLIN: ::c_short = 0x1;
-pub const POLLPRI: ::c_short = 0x2;
-pub const POLLERR: ::c_short = 0x8;
-pub const POLLNVAL: ::c_short = 0x20;
-
pub const RTLD_LAZY: ::c_int = 0x1;
pub const STDIN_FILENO: ::c_int = 0;
@@ -379,7 +386,6 @@ pub const SEEK_SET: ::c_int = 0;
pub const SEEK_CUR: ::c_int = 1;
pub const SEEK_END: ::c_int = 2;
-pub const FIONBIO: ::c_ulong = 1;
pub const FIOCLEX: ::c_ulong = 0x20006601;
pub const FIONCLEX: ::c_ulong = 0x20006602;
@@ -406,7 +412,6 @@ pub const S_IROTH: ::mode_t = 4;
pub const S_IWOTH: ::mode_t = 2;
pub const S_IXOTH: ::mode_t = 1;
-pub const SOL_SOCKET: ::c_int = 65535;
pub const SOL_TCP: ::c_int = 6;
pub const PF_UNSPEC: ::c_int = 0;
@@ -415,19 +420,14 @@ pub const PF_INET6: ::c_int = 23;
pub const AF_UNSPEC: ::c_int = 0;
pub const AF_INET: ::c_int = 2;
-pub const AF_INET6: ::c_int = 23;
+
+pub const CLOCK_REALTIME: ::clockid_t = 1;
+pub const CLOCK_MONOTONIC: ::clockid_t = 4;
+pub const CLOCK_BOOTTIME: ::clockid_t = 4;
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
-pub const MSG_OOB: ::c_int = 1;
-pub const MSG_PEEK: ::c_int = 2;
-pub const MSG_DONTWAIT: ::c_int = 4;
-pub const MSG_DONTROUTE: ::c_int = 0;
-pub const MSG_WAITALL: ::c_int = 0;
-pub const MSG_MORE: ::c_int = 0;
-pub const MSG_NOSIGNAL: ::c_int = 0;
-
pub const SHUT_RD: ::c_int = 0;
pub const SHUT_WR: ::c_int = 1;
pub const SHUT_RDWR: ::c_int = 2;
@@ -543,6 +543,13 @@ 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;
+
+pub const PRIO_PROCESS: ::c_int = 0;
+pub const PRIO_PGRP: ::c_int = 1;
+pub const PRIO_USER: ::c_int = 2;
+
f! {
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
@@ -576,18 +583,10 @@ extern "C" {
pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int;
#[cfg_attr(target_os = "linux", link_name = "__xpg_strerror_r")]
- pub fn strerror_r(
- errnum: ::c_int,
- buf: *mut c_char,
- buflen: ::size_t,
- ) -> ::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 sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int;
pub fn abs(i: ::c_int) -> ::c_int;
pub fn atof(s: *const ::c_char) -> ::c_double;
@@ -595,10 +594,22 @@ extern "C" {
pub fn rand() -> ::c_int;
pub fn srand(seed: ::c_uint);
- pub fn bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t)
- -> ::c_int;
+ #[cfg(not(all(
+ libc_cfg_target_vendor,
+ target_arch = "powerpc",
+ target_vendor = "nintendo"
+ )))]
+ pub fn bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t) -> ::c_int;
+ pub fn clock_settime(clock_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
+ pub fn clock_gettime(clock_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
+ pub fn clock_getres(clock_id: ::clockid_t, res: *mut ::timespec) -> ::c_int;
pub fn closesocket(sockfd: ::c_int) -> ::c_int;
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
+ #[cfg(not(all(
+ libc_cfg_target_vendor,
+ target_arch = "powerpc",
+ target_vendor = "nintendo"
+ )))]
pub fn recvfrom(
fd: ::c_int,
buf: *mut ::c_void,
@@ -607,6 +618,11 @@ extern "C" {
addr: *mut sockaddr,
addr_len: *mut socklen_t,
) -> isize;
+ #[cfg(not(all(
+ libc_cfg_target_vendor,
+ target_arch = "powerpc",
+ target_vendor = "nintendo"
+ )))]
pub fn getnameinfo(
sa: *const sockaddr,
salen: socklen_t,
@@ -623,7 +639,6 @@ extern "C" {
envp: *const *const ::c_char,
) -> ::c_int;
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
pub fn getgrgid_r(
gid: ::gid_t,
grp: *mut ::group,
@@ -631,15 +646,9 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut ::group,
) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "sigaltstack$UNIX2003"
- )]
- #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
pub fn sem_close(sem: *mut sem_t) -> ::c_int;
pub fn getdtablesize() -> ::c_int;
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
pub fn getgrnam_r(
name: *const ::c_char,
grp: *mut ::group,
@@ -647,22 +656,12 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut ::group,
) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_sigmask$UNIX2003"
- )]
- pub fn pthread_sigmask(
- how: ::c_int,
- set: *const sigset_t,
- oldset: *mut sigset_t,
- ) -> ::c_int;
+ pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int;
pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
pub fn getpwnam_r(
name: *const ::c_char,
pwd: *mut passwd,
@@ -670,8 +669,6 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut passwd,
) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
pub fn getpwuid_r(
uid: ::uid_t,
pwd: *mut passwd,
@@ -679,11 +676,6 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut passwd,
) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "sigwait$UNIX2003"
- )]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int;
pub fn pthread_atfork(
prepare: ::Option<unsafe extern "C" fn()>,
@@ -691,10 +683,6 @@ extern "C" {
child: ::Option<unsafe extern "C" fn()>,
) -> ::c_int;
pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "popen$UNIX2003"
- )]
pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
pub fn uname(buf: *mut ::utsname) -> ::c_int;
}
@@ -706,6 +694,12 @@ cfg_if! {
} else if #[cfg(target_arch = "aarch64")] {
mod aarch64;
pub use self::aarch64::*;
+ } else if #[cfg(target_arch = "xtensa")] {
+ mod xtensa;
+ pub use self::xtensa::*;
+ } else if #[cfg(target_arch = "powerpc")] {
+ mod powerpc;
+ pub use self::powerpc::*;
} else {
// Only tested on ARM so far. Other platforms might have different
// definitions for types and constants.
diff --git a/src/unix/newlib/no_align.rs b/src/unix/newlib/no_align.rs
index 316c464e..ce3aca4e 100644
--- a/src/unix/newlib/no_align.rs
+++ b/src/unix/newlib/no_align.rs
@@ -47,5 +47,5 @@ macro_rules! expand_align {
size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
}
}
- }
+ };
}
diff --git a/src/unix/newlib/powerpc/mod.rs b/src/unix/newlib/powerpc/mod.rs
new file mode 100644
index 00000000..4289658c
--- /dev/null
+++ b/src/unix/newlib/powerpc/mod.rs
@@ -0,0 +1,14 @@
+pub type clock_t = ::c_ulong;
+pub type c_char = u8;
+pub type wchar_t = ::c_int;
+
+pub type c_long = i32;
+pub type c_ulong = u32;
+
+// the newlib shipped with devkitPPC does not support the following components:
+// - sockaddr
+// - AF_INET6
+// - FIONBIO
+// - POLL*
+// - SOL_SOCKET
+// - MSG_*
diff --git a/src/unix/newlib/xtensa/mod.rs b/src/unix/newlib/xtensa/mod.rs
new file mode 100644
index 00000000..f520f7a1
--- /dev/null
+++ b/src/unix/newlib/xtensa/mod.rs
@@ -0,0 +1,93 @@
+pub type clock_t = ::c_ulong;
+pub type c_char = i8;
+pub type wchar_t = u32;
+
+pub type c_long = i32;
+pub type c_ulong = u32;
+
+s! {
+ pub struct cmsghdr {
+ pub cmsg_len: ::socklen_t,
+ pub cmsg_level: ::c_int,
+ pub cmsg_type: ::c_int,
+ }
+
+ 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_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_in6 {
+ pub sin6_len: u8,
+ pub sin6_family: ::sa_family_t,
+ pub sin6_port: ::in_port_t,
+ pub sin6_flowinfo: u32,
+ pub sin6_addr: ::in6_addr,
+ pub sin6_scope_id: u32,
+ }
+
+ pub struct sockaddr_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 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 const AF_UNIX: ::c_int = 1;
+pub const AF_INET6: ::c_int = 10;
+
+pub const FIONBIO: ::c_ulong = 2147772030;
+
+pub const POLLIN: ::c_short = 1 << 0;
+pub const POLLRDNORM: ::c_short = 1 << 1;
+pub const POLLRDBAND: ::c_short = 1 << 2;
+pub const POLLPRI: ::c_short = POLLRDBAND;
+pub const POLLOUT: ::c_short = 1 << 3;
+pub const POLLWRNORM: ::c_short = POLLOUT;
+pub const POLLWRBAND: ::c_short = 1 << 4;
+pub const POLLERR: ::c_short = 1 << 5;
+pub const POLLHUP: ::c_short = 1 << 6;
+
+pub const SOL_SOCKET: ::c_int = 0xfff;
+
+pub const MSG_OOB: ::c_int = 0x04;
+pub const MSG_PEEK: ::c_int = 0x01;
+pub const MSG_DONTWAIT: ::c_int = 0x08;
+pub const MSG_DONTROUTE: ::c_int = 0x4;
+pub const MSG_WAITALL: ::c_int = 0x02;
+pub const MSG_MORE: ::c_int = 0x10;
+pub const MSG_NOSIGNAL: ::c_int = 0x20;
+
+extern "C" {
+ 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 writev(s: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::c_int;
+ pub fn readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
+}
diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs
index b00a191c..45615a54 100644
--- a/src/unix/redox/mod.rs
+++ b/src/unix/redox/mod.rs
@@ -258,7 +258,7 @@ pub const F_GETLK: ::c_int = 5;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
-// TODO: relibc {
+// FIXME: relibc {
pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
// }
@@ -413,7 +413,7 @@ 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;
-// TODO: relibc {
+// FIXME: relibc {
pub const F_DUPFD_CLOEXEC: ::c_int = ::F_DUPFD;
// }
pub const FD_CLOEXEC: ::c_int = 0x0100_0000;
@@ -435,14 +435,21 @@ pub const O_DIRECTORY: ::c_int = 0x1000_0000;
pub const O_PATH: ::c_int = 0x2000_0000;
pub const O_SYMLINK: ::c_int = 0x4000_0000;
// Negative to allow it to be used as int
-// TODO: Fix negative values missing from includes
+// FIXME: Fix negative values missing from includes
pub const O_NOFOLLOW: ::c_int = -0x8000_0000;
// netdb.h
pub const EAI_SYSTEM: ::c_int = -11;
+pub const NI_MAXHOST: ::c_int = 1025;
+pub const NI_MAXSERV: ::c_int = 32;
+pub const NI_NUMERICHOST: ::c_int = 0x0001;
+pub const NI_NUMERICSERV: ::c_int = 0x0002;
+pub const NI_NOFQDN: ::c_int = 0x0004;
+pub const NI_NAMEREQD: ::c_int = 0x0008;
+pub const NI_DGRAM: ::c_int = 0x0010;
// netinet/in.h
-// TODO: relibc {
+// FIXME: relibc {
pub const IP_TTL: ::c_int = 2;
pub const IPV6_UNICAST_HOPS: ::c_int = 16;
pub const IPV6_MULTICAST_IF: ::c_int = 17;
@@ -460,7 +467,7 @@ pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
// netinet/tcp.h
pub const TCP_NODELAY: ::c_int = 1;
-// TODO: relibc {
+// FIXME: relibc {
pub const TCP_KEEPIDLE: ::c_int = 1;
// }
@@ -526,6 +533,12 @@ pub const SA_RESTART: ::c_ulong = 0x10000000;
pub const SA_NODEFER: ::c_ulong = 0x40000000;
pub const SA_RESETHAND: ::c_ulong = 0x80000000;
+// sys/file.h
+pub const LOCK_SH: ::c_int = 1;
+pub const LOCK_EX: ::c_int = 2;
+pub const LOCK_NB: ::c_int = 4;
+pub const LOCK_UN: ::c_int = 8;
+
// sys/epoll.h
pub const EPOLL_CLOEXEC: ::c_int = 0x0100_0000;
pub const EPOLL_CTL_ADD: ::c_int = 1;
@@ -575,7 +588,7 @@ pub const EXIT_SUCCESS: ::c_int = 0;
pub const EXIT_FAILURE: ::c_int = 1;
// sys/ioctl.h
-// TODO: relibc {
+// FIXME: relibc {
pub const FIONBIO: ::c_ulong = 0x5421;
pub const FIOCLEX: ::c_ulong = 0x5451;
// }
@@ -587,29 +600,77 @@ pub const TIOCSPGRP: ::c_ulong = 0x5410;
pub const TIOCGWINSZ: ::c_ulong = 0x5413;
pub const TIOCSWINSZ: ::c_ulong = 0x5414;
+// sys/mman.h
+pub const PROT_NONE: ::c_int = 0x0000;
+pub const PROT_READ: ::c_int = 0x0004;
+pub const PROT_WRITE: ::c_int = 0x0002;
+pub const PROT_EXEC: ::c_int = 0x0001;
+
+pub const MAP_SHARED: ::c_int = 0x0001;
+pub const MAP_PRIVATE: ::c_int = 0x0002;
+pub const MAP_ANON: ::c_int = 0x0020;
+pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
+pub const MAP_FIXED: ::c_int = 0x0010;
+pub const MAP_FAILED: *mut ::c_void = !0 as _;
+
+pub const MS_ASYNC: ::c_int = 0x0001;
+pub const MS_INVALIDATE: ::c_int = 0x0002;
+pub const MS_SYNC: ::c_int = 0x0004;
+
// sys/select.h
pub const FD_SETSIZE: usize = 1024;
// sys/socket.h
-pub const AF_UNIX: ::c_int = 1;
pub const AF_INET: ::c_int = 2;
pub const AF_INET6: ::c_int = 10;
+pub const AF_UNIX: ::c_int = 1;
+pub const AF_UNSPEC: ::c_int = 0;
+pub const PF_INET: ::c_int = 2;
+pub const PF_INET6: ::c_int = 10;
+pub const PF_UNIX: ::c_int = 1;
+pub const PF_UNSPEC: ::c_int = 0;
+pub const MSG_CTRUNC: ::c_int = 8;
+pub const MSG_DONTROUTE: ::c_int = 4;
+pub const MSG_EOR: ::c_int = 128;
+pub const MSG_OOB: ::c_int = 1;
pub const MSG_PEEK: ::c_int = 2;
+pub const MSG_TRUNC: ::c_int = 32;
+pub const MSG_WAITALL: ::c_int = 256;
pub const SHUT_RD: ::c_int = 0;
pub const SHUT_WR: ::c_int = 1;
pub const SHUT_RDWR: ::c_int = 2;
+pub const SO_DEBUG: ::c_int = 1;
pub const SO_REUSEADDR: ::c_int = 2;
+pub const SO_TYPE: ::c_int = 3;
pub const SO_ERROR: ::c_int = 4;
+pub const SO_DONTROUTE: ::c_int = 5;
pub const SO_BROADCAST: ::c_int = 6;
pub const SO_SNDBUF: ::c_int = 7;
pub const SO_RCVBUF: ::c_int = 8;
pub const SO_KEEPALIVE: ::c_int = 9;
+pub const SO_OOBINLINE: ::c_int = 10;
+pub const SO_NO_CHECK: ::c_int = 11;
+pub const SO_PRIORITY: ::c_int = 12;
pub const SO_LINGER: ::c_int = 13;
+pub const SO_BSDCOMPAT: ::c_int = 14;
pub const SO_REUSEPORT: ::c_int = 15;
+pub const SO_PASSCRED: ::c_int = 16;
+pub const SO_PEERCRED: ::c_int = 17;
+pub const SO_RCVLOWAT: ::c_int = 18;
+pub const SO_SNDLOWAT: ::c_int = 19;
pub const SO_RCVTIMEO: ::c_int = 20;
pub const SO_SNDTIMEO: ::c_int = 21;
+pub const SO_ACCEPTCONN: ::c_int = 30;
+pub const SO_PEERSEC: ::c_int = 31;
+pub const SO_SNDBUFFORCE: ::c_int = 32;
+pub const SO_RCVBUFFORCE: ::c_int = 33;
+pub const SO_PROTOCOL: ::c_int = 38;
+pub const SO_DOMAIN: ::c_int = 39;
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
+pub const SOCK_NONBLOCK: ::c_int = 0o4_000;
+pub const SOCK_CLOEXEC: ::c_int = 0o2_000_000;
+pub const SOCK_SEQPACKET: ::c_int = 5;
pub const SOL_SOCKET: ::c_int = 1;
// sys/termios.h
@@ -806,37 +867,69 @@ 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 PRIO_PROCESS: ::c_int = 0;
+pub const PRIO_PGRP: ::c_int = 1;
+pub const PRIO_USER: ::c_int = 2;
+
// wait.h
f! {
- pub fn WIFSTOPPED(status: ::c_int) -> bool {
+ pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
+ let fd = fd as usize;
+ let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
+ (*set).fds_bits[fd / size] &= !(1 << (fd % size));
+ return
+ }
+
+ pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
+ let fd = fd as usize;
+ let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
+ return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
+ }
+
+ pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
+ let fd = fd as usize;
+ let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
+ (*set).fds_bits[fd / size] |= 1 << (fd % size);
+ return
+ }
+
+ pub fn FD_ZERO(set: *mut fd_set) -> () {
+ for slot in (*set).fds_bits.iter_mut() {
+ *slot = 0;
+ }
+ }
+}
+
+safe_f! {
+ pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
(status & 0xff) == 0x7f
}
- pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
+ pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
(status >> 8) & 0xff
}
- pub fn WIFCONTINUED(status: ::c_int) -> bool {
+ pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
status == 0xffff
}
- pub fn WIFSIGNALED(status: ::c_int) -> bool {
+ pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
((status & 0x7f) + 1) as i8 >= 2
}
- pub fn WTERMSIG(status: ::c_int) -> ::c_int {
+ pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
status & 0x7f
}
- pub fn WIFEXITED(status: ::c_int) -> bool {
+ pub {const} fn WIFEXITED(status: ::c_int) -> bool {
(status & 0x7f) == 0
}
- pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
+ pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int {
(status >> 8) & 0xff
}
- pub fn WCOREDUMP(status: ::c_int) -> bool {
+ pub {const} fn WCOREDUMP(status: ::c_int) -> bool {
(status & 0x80) != 0
}
}
@@ -844,11 +937,7 @@ f! {
extern "C" {
// errno.h
pub fn __errno_location() -> *mut ::c_int;
- pub fn strerror_r(
- errnum: ::c_int,
- buf: *mut c_char,
- buflen: ::size_t,
- ) -> ::c_int;
+ pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
// unistd.h
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
@@ -898,26 +987,24 @@ extern "C" {
maxevents: ::c_int,
timeout: ::c_int,
) -> ::c_int;
- pub fn epoll_ctl(
- epfd: ::c_int,
- op: ::c_int,
- fd: ::c_int,
- event: *mut ::epoll_event,
- ) -> ::c_int;
+ pub fn epoll_ctl(epfd: ::c_int, op: ::c_int, fd: ::c_int, event: *mut ::epoll_event)
+ -> ::c_int;
// sys/ioctl.h
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
+ // sys/mman.h
+ pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
+ pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::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;
+
// sys/resource.h
pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int;
// sys/socket.h
- pub fn bind(
- socket: ::c_int,
- address: *const ::sockaddr,
- address_len: ::socklen_t,
- ) -> ::c_int;
+ pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int;
pub fn recvfrom(
socket: ::c_int,
buf: *mut ::c_void,
@@ -931,16 +1018,8 @@ extern "C" {
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
// sys/uio.h
- pub fn readv(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- ) -> ::ssize_t;
- 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 writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
// sys/utsname.h
pub fn uname(utsname: *mut utsname) -> ::c_int;
diff --git a/src/unix/solarish/compat.rs b/src/unix/solarish/compat.rs
index a3364521..4a232f0d 100644
--- a/src/unix/solarish/compat.rs
+++ b/src/unix/solarish/compat.rs
@@ -3,30 +3,169 @@
use unix::solarish::*;
+const PTEM: &[u8] = b"ptem\0";
+const LDTERM: &[u8] = b"ldterm\0";
+
pub unsafe fn cfmakeraw(termios: *mut ::termios) {
- let mut t = *termios as ::termios;
- t.c_iflag &= !(IMAXBEL
- | IGNBRK
- | BRKINT
- | PARMRK
- | ISTRIP
- | INLCR
- | IGNCR
- | ICRNL
- | IXON);
- t.c_oflag &= !OPOST;
- t.c_lflag &= !(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
- t.c_cflag &= !(CSIZE | PARENB);
- t.c_cflag |= CS8;
+ (*termios).c_iflag &=
+ !(IMAXBEL | IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON);
+ (*termios).c_oflag &= !OPOST;
+ (*termios).c_lflag &= !(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
+ (*termios).c_cflag &= !(CSIZE | PARENB);
+ (*termios).c_cflag |= CS8;
+
+ // By default, most software expects a pending read to block until at
+ // least one byte becomes available. As per termio(7I), this requires
+ // setting the MIN and TIME parameters appropriately.
+ //
+ // As a somewhat unfortunate artefact of history, the MIN and TIME slots
+ // in the control character array overlap with the EOF and EOL slots used
+ // for canonical mode processing. Because the EOF character needs to be
+ // the ASCII EOT value (aka Control-D), it has the byte value 4. When
+ // switching to raw mode, this is interpreted as a MIN value of 4; i.e.,
+ // reads will block until at least four bytes have been input.
+ //
+ // Other platforms with a distinct MIN slot like Linux and FreeBSD appear
+ // to default to a MIN value of 1, so we'll force that value here:
+ (*termios).c_cc[VMIN] = 1;
+ (*termios).c_cc[VTIME] = 0;
}
-pub unsafe fn cfsetspeed(
- termios: *mut ::termios,
- speed: ::speed_t,
-) -> ::c_int {
+pub unsafe fn cfsetspeed(termios: *mut ::termios, speed: ::speed_t) -> ::c_int {
// Neither of these functions on illumos or Solaris actually ever
// return an error
::cfsetispeed(termios, speed);
::cfsetospeed(termios, speed);
0
}
+
+unsafe fn bail(fdm: ::c_int, fds: ::c_int) -> ::c_int {
+ let e = *___errno();
+ if fds >= 0 {
+ ::close(fds);
+ }
+ if fdm >= 0 {
+ ::close(fdm);
+ }
+ *___errno() = e;
+ return -1;
+}
+
+pub unsafe fn openpty(
+ amain: *mut ::c_int,
+ asubord: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *const termios,
+ winp: *const ::winsize,
+) -> ::c_int {
+ // Open the main pseudo-terminal device, making sure not to set it as the
+ // controlling terminal for this process:
+ let fdm = ::posix_openpt(O_RDWR | O_NOCTTY);
+ if fdm < 0 {
+ return -1;
+ }
+
+ // Set permissions and ownership on the subordinate device and unlock it:
+ if ::grantpt(fdm) < 0 || ::unlockpt(fdm) < 0 {
+ return bail(fdm, -1);
+ }
+
+ // Get the path name of the subordinate device:
+ let subordpath = ::ptsname(fdm);
+ if subordpath.is_null() {
+ return bail(fdm, -1);
+ }
+
+ // Open the subordinate device without setting it as the controlling
+ // terminal for this process:
+ let fds = ::open(subordpath, O_RDWR | O_NOCTTY);
+ if fds < 0 {
+ return bail(fdm, -1);
+ }
+
+ // Check if the STREAMS modules are already pushed:
+ let setup = ::ioctl(fds, I_FIND, LDTERM.as_ptr());
+ if setup < 0 {
+ return bail(fdm, fds);
+ } else if setup == 0 {
+ // The line discipline is not present, so push the appropriate STREAMS
+ // modules for the subordinate device:
+ if ::ioctl(fds, I_PUSH, PTEM.as_ptr()) < 0 || ::ioctl(fds, I_PUSH, LDTERM.as_ptr()) < 0 {
+ return bail(fdm, fds);
+ }
+ }
+
+ // If provided, set the terminal parameters:
+ if !termp.is_null() && ::tcsetattr(fds, TCSAFLUSH, termp) != 0 {
+ return bail(fdm, fds);
+ }
+
+ // If provided, set the window size:
+ if !winp.is_null() && ::ioctl(fds, TIOCSWINSZ, winp) < 0 {
+ return bail(fdm, fds);
+ }
+
+ // If the caller wants the name of the subordinate device, copy it out.
+ //
+ // Note that this is a terrible interface: there appears to be no standard
+ // upper bound on the copy length for this pointer. Nobody should pass
+ // anything but NULL here, preferring instead to use ptsname(3C) directly.
+ if !name.is_null() {
+ ::strcpy(name, subordpath);
+ }
+
+ *amain = fdm;
+ *asubord = fds;
+ 0
+}
+
+pub unsafe fn forkpty(
+ amain: *mut ::c_int,
+ name: *mut ::c_char,
+ termp: *const termios,
+ winp: *const ::winsize,
+) -> ::pid_t {
+ let mut fds = -1;
+
+ if openpty(amain, &mut fds, name, termp, winp) != 0 {
+ return -1;
+ }
+
+ let pid = ::fork();
+ if pid < 0 {
+ return bail(*amain, fds);
+ } else if pid > 0 {
+ // In the parent process, we close the subordinate device and return the
+ // process ID of the new child:
+ ::close(fds);
+ return pid;
+ }
+
+ // The rest of this function executes in the child process.
+
+ // Close the main side of the pseudo-terminal pair:
+ ::close(*amain);
+
+ // Use TIOCSCTTY to set the subordinate device as our controlling
+ // terminal. This will fail (with ENOTTY) if we are not the leader in
+ // our own session, so we call setsid() first. Finally, arrange for
+ // the pseudo-terminal to occupy the standard I/O descriptors.
+ if ::setsid() < 0
+ || ::ioctl(fds, TIOCSCTTY, 0) < 0
+ || ::dup2(fds, 0) < 0
+ || ::dup2(fds, 1) < 0
+ || ::dup2(fds, 2) < 0
+ {
+ // At this stage there are no particularly good ways to handle failure.
+ // Exit as abruptly as possible, using _exit() to avoid messing with any
+ // state still shared with the parent process.
+ ::_exit(EXIT_FAILURE);
+ }
+ // Close the inherited descriptor, taking care to avoid closing the standard
+ // descriptors by mistake:
+ if fds > 2 {
+ ::close(fds);
+ }
+
+ 0
+}
diff --git a/src/unix/solarish/illumos.rs b/src/unix/solarish/illumos.rs
new file mode 100644
index 00000000..730bb690
--- /dev/null
+++ b/src/unix/solarish/illumos.rs
@@ -0,0 +1,40 @@
+s! {
+ pub struct shmid_ds {
+ pub shm_perm: ::ipc_perm,
+ pub shm_segsz: ::size_t,
+ pub shm_amp: *mut ::c_void,
+ pub shm_lkcnt: ::c_ushort,
+ pub shm_lpid: ::pid_t,
+ pub shm_cpid: ::pid_t,
+ pub shm_nattch: ::shmatt_t,
+ pub shm_cnattch: ::c_ulong,
+ pub shm_atime: ::time_t,
+ pub shm_dtime: ::time_t,
+ pub shm_ctime: ::time_t,
+ pub shm_pad4: [i64; 4],
+ }
+}
+
+pub const AF_LOCAL: ::c_int = 1; // AF_UNIX
+pub const AF_FILE: ::c_int = 1; // AF_UNIX
+
+pub const EFD_SEMAPHORE: ::c_int = 0x1;
+pub const EFD_NONBLOCK: ::c_int = 0x800;
+pub const EFD_CLOEXEC: ::c_int = 0x80000;
+
+pub const TCP_KEEPIDLE: ::c_int = 34;
+pub const TCP_KEEPCNT: ::c_int = 35;
+pub const TCP_KEEPINTVL: ::c_int = 36;
+pub const TCP_CONGESTION: ::c_int = 37;
+
+pub const F_OFD_GETLK: ::c_int = 50;
+pub const F_OFD_SETLKL: ::c_int = 51;
+pub const F_OFD_SETLKW: ::c_int = 52;
+pub const F_FLOCK: ::c_int = 55;
+pub const F_FLOCKW: ::c_int = 56;
+
+extern "C" {
+ pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
+
+ pub fn mincore(addr: ::caddr_t, len: ::size_t, vec: *mut ::c_char) -> ::c_int;
+}
diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs
index 06c1a20c..6166da5d 100644
--- a/src/unix/solarish/mod.rs
+++ b/src/unix/solarish/mod.rs
@@ -1,6 +1,7 @@
pub type c_char = i8;
pub type c_long = i64;
pub type c_ulong = u64;
+pub type caddr_t = *mut ::c_char;
pub type clockid_t = ::c_int;
pub type blkcnt_t = ::c_long;
@@ -19,8 +20,11 @@ pub type rlim_t = ::c_ulong;
pub type speed_t = ::c_uint;
pub type tcflag_t = ::c_uint;
pub type time_t = ::c_long;
+pub type timer_t = ::c_int;
pub type wchar_t = ::c_int;
pub type nfds_t = ::c_ulong;
+pub type projid_t = ::c_int;
+pub type zoneid_t = ::c_int;
pub type suseconds_t = ::c_long;
pub type off_t = ::c_long;
@@ -36,9 +40,6 @@ pub type id_t = ::c_int;
pub type idtype_t = ::c_uint;
pub type shmatt_t = ::c_ulong;
-pub type door_attr_t = ::c_uint;
-pub type door_id_t = ::c_ulonglong;
-
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::Copy for timezone {}
@@ -48,6 +49,15 @@ impl ::Clone for timezone {
}
}
+#[cfg_attr(feature = "extra_traits", derive(Debug))]
+pub enum ucred_t {}
+impl ::Copy for ucred_t {}
+impl ::Clone for ucred_t {
+ fn clone(&self) -> ucred_t {
+ *self
+ }
+}
+
s! {
pub struct in_addr {
pub s_addr: ::in_addr_t,
@@ -111,6 +121,11 @@ s! {
pub ifa_data: *mut ::c_void
}
+ pub struct itimerspec {
+ pub it_interval: ::timespec,
+ pub it_value: ::timespec,
+ }
+
pub struct tm {
pub tm_sec: ::c_int,
pub tm_min: ::c_int,
@@ -217,33 +232,6 @@ s! {
pub ai_next: *mut addrinfo,
}
- pub struct shmid_ds {
- pub shm_perm: ipc_perm,
- pub shm_segsz: ::size_t,
- #[cfg(target_os = "illumos")]
- pub shm_amp: *mut ::c_void,
- #[cfg(target_os = "solaris")]
- pub shm_flags: ::uintptr_t,
- pub shm_lkcnt: ::c_ushort,
- pub shm_lpid: ::pid_t,
- pub shm_cpid: ::pid_t,
- pub shm_nattch: ::shmatt_t,
- pub shm_cnattch: ::c_ulong,
- pub shm_atime: ::time_t,
- pub shm_dtime: ::time_t,
- pub shm_ctime: ::time_t,
- #[cfg(target_os = "illumos")]
- pub shm_pad4: [i64; 4],
- #[cfg(target_os = "solaris")]
- pub shm_amp: *mut ::c_void,
- #[cfg(target_os = "solaris")]
- pub shm_gransize: u64,
- #[cfg(target_os = "solaris")]
- pub shm_allocated: u64,
- #[cfg(target_os = "solaris")]
- pub shm_pad4: [i64; 1],
- }
-
pub struct sigset_t {
bits: [u32; 4],
}
@@ -371,7 +359,7 @@ s! {
pub mq_maxmsg: ::c_long,
pub mq_msgsize: ::c_long,
pub mq_curmsgs: ::c_long,
- _pad: [::c_int; 4]
+ _pad: [::c_int; 12]
}
pub struct port_event {
@@ -382,9 +370,9 @@ s! {
pub portev_user: *mut ::c_void,
}
- pub struct door_desc_t__d_data__d_desc {
- pub d_descriptor: ::c_int,
- pub d_id: ::door_id_t
+ pub struct port_notify {
+ pub portnfy_port: ::c_int,
+ pub portnfy_user: *mut ::c_void,
}
pub struct exit_status {
@@ -401,10 +389,44 @@ s! {
pub ut_exit: exit_status,
pub ut_time: ::time_t,
}
+
+ pub struct timex {
+ pub modes: u32,
+ pub offset: i32,
+ pub freq: i32,
+ pub maxerror: i32,
+ pub esterror: i32,
+ pub status: i32,
+ pub constant: i32,
+ pub precision: i32,
+ pub tolerance: i32,
+ pub ppsfreq: i32,
+ pub jitter: i32,
+ pub shift: i32,
+ pub stabil: i32,
+ pub jitcnt: i32,
+ pub calcnt: i32,
+ pub errcnt: i32,
+ pub stbcnt: i32,
+ }
+
+ pub struct ntptimeval {
+ pub time: ::timeval,
+ pub maxerror: i32,
+ pub esterror: i32,
+ }
+
}
s_no_extra_traits! {
- #[cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), repr(packed))]
+ #[cfg_attr(all(
+ any(target_arch = "x86", target_arch = "x86_64"),
+ libc_packedN
+ ), repr(packed(4)))]
+ #[cfg_attr(all(
+ any(target_arch = "x86", target_arch = "x86_64"),
+ not(libc_packedN)
+ ), repr(packed))]
pub struct epoll_event {
pub events: u32,
pub u64: u64,
@@ -478,25 +500,6 @@ s_no_extra_traits! {
pub sigev_notify_attributes: *const ::pthread_attr_t,
__sigev_pad2: ::c_int,
}
-
- pub union door_desc_t__d_data {
- pub d_desc: door_desc_t__d_data__d_desc,
- d_resv: [::c_int; 5], /* Check out /usr/include/sys/door.h */
- }
-
- pub struct door_desc_t {
- pub d_attributes: door_attr_t,
- pub d_data: door_desc_t__d_data,
- }
-
- pub struct door_arg_t {
- pub data_ptr: *const ::c_char,
- pub data_size: ::size_t,
- pub desc_ptr: *const door_desc_t,
- pub dec_num: ::c_uint,
- pub rbuf: *const ::c_char,
- pub rsize: ::size_t,
- }
}
cfg_if! {
@@ -536,7 +539,7 @@ cfg_if! {
.field("ut_session", &self.ut_session)
.field("ut_pad", &self.ut_pad)
.field("ut_syslen", &self.ut_syslen)
- .field("ut_host", &self.ut_host)
+ .field("ut_host", &&self.ut_host[..])
.finish()
}
}
@@ -832,12 +835,12 @@ 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_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
-pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
-pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
-pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE);
-pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY);
-pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES);
+pub const LC_CTYPE_MASK: ::c_int = 1 << LC_CTYPE;
+pub const LC_NUMERIC_MASK: ::c_int = 1 << LC_NUMERIC;
+pub const LC_TIME_MASK: ::c_int = 1 << LC_TIME;
+pub const LC_COLLATE_MASK: ::c_int = 1 << LC_COLLATE;
+pub const LC_MONETARY_MASK: ::c_int = 1 << LC_MONETARY;
+pub const LC_MESSAGES_MASK: ::c_int = 1 << LC_MESSAGES;
pub const LC_ALL_MASK: ::c_int = LC_CTYPE_MASK
| LC_NUMERIC_MASK
| LC_TIME_MASK
@@ -943,10 +946,15 @@ pub const SIGEV_NONE: ::c_int = 1;
pub const SIGEV_SIGNAL: ::c_int = 2;
pub const SIGEV_THREAD: ::c_int = 3;
+pub const IP_RECVDSTADDR: ::c_int = 0x7;
+pub const IP_SEC_OPT: ::c_int = 0x22;
+
pub const IPV6_UNICAST_HOPS: ::c_int = 0x5;
pub const IPV6_MULTICAST_IF: ::c_int = 0x6;
pub const IPV6_MULTICAST_HOPS: ::c_int = 0x7;
pub const IPV6_MULTICAST_LOOP: ::c_int = 0x8;
+pub const IPV6_RECVPKTINFO: ::c_int = 0x12;
+pub const IPV6_SEC_OPT: ::c_int = 0x22;
pub const IPV6_V6ONLY: ::c_int = 0x27;
cfg_if! {
@@ -969,6 +977,8 @@ pub const EOF: ::c_int = -1;
pub const SEEK_SET: ::c_int = 0;
pub const SEEK_CUR: ::c_int = 1;
pub const SEEK_END: ::c_int = 2;
+pub const SEEK_DATA: ::c_int = 3;
+pub const SEEK_HOLE: ::c_int = 4;
pub const _IOFBF: ::c_int = 0;
pub const _IONBF: ::c_int = 4;
pub const _IOLBF: ::c_int = 64;
@@ -988,11 +998,13 @@ pub const O_CREAT: ::c_int = 256;
pub const O_EXCL: ::c_int = 1024;
pub const O_NOCTTY: ::c_int = 2048;
pub const O_TRUNC: ::c_int = 512;
-pub const O_NOFOLLOW: ::c_int = 0x200000;
+pub const O_NOFOLLOW: ::c_int = 0x20000;
+pub const O_DIRECTORY: ::c_int = 0x1000000;
pub const O_SEARCH: ::c_int = 0x200000;
pub const O_EXEC: ::c_int = 0x400000;
pub const O_CLOEXEC: ::c_int = 0x800000;
pub const O_ACCMODE: ::c_int = 0x600003;
+pub const O_XATTR: ::c_int = 0x4000;
pub const S_IFIFO: mode_t = 4096;
pub const S_IFCHR: mode_t = 8192;
pub const S_IFBLK: mode_t = 24576;
@@ -1031,6 +1043,12 @@ pub const F_DUPFD_CLOEXEC: ::c_int = 37;
pub const F_SETLK: ::c_int = 6;
pub const F_SETLKW: ::c_int = 7;
pub const F_GETLK: ::c_int = 14;
+pub const F_ALLOCSP: ::c_int = 10;
+pub const F_FREESP: ::c_int = 11;
+pub const F_BLOCKS: ::c_int = 18;
+pub const F_BLKSIZE: ::c_int = 19;
+pub const F_SHARE: ::c_int = 40;
+pub const F_UNSHARE: ::c_int = 41;
pub const SIGHUP: ::c_int = 1;
pub const SIGINT: ::c_int = 2;
pub const SIGQUIT: ::c_int = 3;
@@ -1072,6 +1090,10 @@ pub const WNOWAIT: ::c_int = 0x80;
pub const AT_FDCWD: ::c_int = 0xffd19553;
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x1000;
+pub const AT_SYMLINK_FOLLOW: ::c_int = 0x2000;
+pub const AT_REMOVEDIR: ::c_int = 0x1;
+pub const _AT_TRIGGER: ::c_int = 0x2;
+pub const AT_EACCESS: ::c_int = 0x4;
pub const P_PID: idtype_t = 0;
pub const P_PPID: idtype_t = 1;
@@ -1117,7 +1139,6 @@ pub const MCL_FUTURE: ::c_int = 0x0002;
pub const MS_SYNC: ::c_int = 0x0004;
pub const MS_ASYNC: ::c_int = 0x0001;
pub const MS_INVALIDATE: ::c_int = 0x0002;
-pub const MS_INVALCURPROC: ::c_int = 0x0008;
pub const EPERM: ::c_int = 1;
pub const ENOENT: ::c_int = 2;
@@ -1256,10 +1277,13 @@ pub const EAI_SYSTEM: ::c_int = 11;
pub const EAI_OVERFLOW: ::c_int = 12;
pub const F_DUPFD: ::c_int = 0;
+pub const F_DUP2FD: ::c_int = 9;
+pub const F_DUP2FD_CLOEXEC: ::c_int = 36;
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_GETXFL: ::c_int = 45;
pub const SIGTRAP: ::c_int = 5;
@@ -1327,7 +1351,7 @@ pub const RLIMIT_AS: ::c_int = RLIMIT_VMEM;
#[deprecated(since = "0.2.64", note = "Not stable across OS versions")]
pub const RLIM_NLIMITS: rlim_t = 7;
-pub const RLIM_INFINITY: rlim_t = 0x7fffffff;
+pub const RLIM_INFINITY: rlim_t = 0xfffffffffffffffd;
pub const RUSAGE_SELF: ::c_int = 0;
pub const RUSAGE_CHILDREN: ::c_int = -1;
@@ -1341,8 +1365,6 @@ pub const MADV_FREE: ::c_int = 5;
pub const AF_UNSPEC: ::c_int = 0;
pub const AF_UNIX: ::c_int = 1;
-pub const AF_LOCAL: ::c_int = 0;
-pub const AF_FILE: ::c_int = 0;
pub const AF_INET: ::c_int = 2;
pub const AF_IMPLINK: ::c_int = 3;
pub const AF_PUP: ::c_int = 4;
@@ -1374,7 +1396,6 @@ pub const AF_POLICY: ::c_int = 29;
pub const AF_INET_OFFLOAD: ::c_int = 30;
pub const AF_TRILL: ::c_int = 31;
pub const AF_PACKET: ::c_int = 32;
-pub const AF_LX_NETLINK: ::c_int = 33;
pub const SOCK_DGRAM: ::c_int = 1;
pub const SOCK_STREAM: ::c_int = 2;
@@ -1391,8 +1412,27 @@ pub const IP_DROP_MEMBERSHIP: ::c_int = 20;
pub const IPV6_JOIN_GROUP: ::c_int = 9;
pub const IPV6_LEAVE_GROUP: ::c_int = 10;
-pub const TCP_NODELAY: ::c_int = 1;
-pub const TCP_KEEPIDLE: ::c_int = 34;
+// These TCP socket options are common between illumos and Solaris, while higher
+// numbers have generally diverged:
+pub const TCP_NODELAY: ::c_int = 0x1;
+pub const TCP_MAXSEG: ::c_int = 0x2;
+pub const TCP_KEEPALIVE: ::c_int = 0x8;
+pub const TCP_NOTIFY_THRESHOLD: ::c_int = 0x10;
+pub const TCP_ABORT_THRESHOLD: ::c_int = 0x11;
+pub const TCP_CONN_NOTIFY_THRESHOLD: ::c_int = 0x12;
+pub const TCP_CONN_ABORT_THRESHOLD: ::c_int = 0x13;
+pub const TCP_RECVDSTADDR: ::c_int = 0x14;
+pub const TCP_INIT_CWND: ::c_int = 0x15;
+pub const TCP_KEEPALIVE_THRESHOLD: ::c_int = 0x16;
+pub const TCP_KEEPALIVE_ABORT_THRESHOLD: ::c_int = 0x17;
+pub const TCP_CORK: ::c_int = 0x18;
+pub const TCP_RTO_INITIAL: ::c_int = 0x19;
+pub const TCP_RTO_MIN: ::c_int = 0x1a;
+pub const TCP_RTO_MAX: ::c_int = 0x1b;
+pub const TCP_LINGER2: ::c_int = 0x1c;
+
+pub const UDP_NAT_T_ENDPOINT: ::c_int = 0x0103;
+
pub const SOL_SOCKET: ::c_int = 0xffff;
pub const SO_DEBUG: ::c_int = 0x01;
pub const SO_ACCEPTCONN: ::c_int = 0x0002;
@@ -1431,6 +1471,9 @@ pub const MSG_DUPCTRL: ::c_int = 0x800;
pub const MSG_XPG4_2: ::c_int = 0x8000;
pub const MSG_MAXIOVLEN: ::c_int = 16;
+pub const IF_NAMESIZE: ::size_t = 32;
+pub const IFNAMSIZ: ::size_t = 16;
+
// https://docs.oracle.com/cd/E23824_01/html/821-1475/if-7p.html
pub const IFF_UP: ::c_int = 0x0000000001; // Address is up
pub const IFF_BROADCAST: ::c_int = 0x0000000002; // Broadcast address valid
@@ -1746,8 +1789,6 @@ pub const PORT_SOURCE_FD: ::c_int = 4;
pub const PORT_SOURCE_ALERT: ::c_int = 5;
pub const PORT_SOURCE_MQ: ::c_int = 6;
pub const PORT_SOURCE_FILE: ::c_int = 7;
-pub const PORT_SOURCE_POSTWAIT: ::c_int = 8;
-pub const PORT_SOURCE_SIGNAL: ::c_int = 9;
pub const NONROOT_USR: ::c_short = 2;
pub const _UTX_USERSIZE: usize = 32;
@@ -1769,21 +1810,21 @@ pub const DOWN_TIME: ::c_short = 10;
const _TIOC: ::c_int = ('T' as i32) << 8;
const tIOC: ::c_int = ('t' as i32) << 8;
-pub const TCGETA: ::c_int = (_TIOC | 1);
-pub const TCSETA: ::c_int = (_TIOC | 2);
-pub const TCSETAW: ::c_int = (_TIOC | 3);
-pub const TCSETAF: ::c_int = (_TIOC | 4);
-pub const TCSBRK: ::c_int = (_TIOC | 5);
-pub const TCXONC: ::c_int = (_TIOC | 6);
-pub const TCFLSH: ::c_int = (_TIOC | 7);
-pub const TCDSET: ::c_int = (_TIOC | 32);
-pub const TCGETS: ::c_int = (_TIOC | 13);
-pub const TCSETS: ::c_int = (_TIOC | 14);
-pub const TCSANOW: ::c_int = (_TIOC | 14);
-pub const TCSETSW: ::c_int = (_TIOC | 15);
-pub const TCSADRAIN: ::c_int = (_TIOC | 15);
-pub const TCSETSF: ::c_int = (_TIOC | 16);
-pub const TCSAFLUSH: ::c_int = (_TIOC | 16);
+pub const TCGETA: ::c_int = _TIOC | 1;
+pub const TCSETA: ::c_int = _TIOC | 2;
+pub const TCSETAW: ::c_int = _TIOC | 3;
+pub const TCSETAF: ::c_int = _TIOC | 4;
+pub const TCSBRK: ::c_int = _TIOC | 5;
+pub const TCXONC: ::c_int = _TIOC | 6;
+pub const TCFLSH: ::c_int = _TIOC | 7;
+pub const TCDSET: ::c_int = _TIOC | 32;
+pub const TCGETS: ::c_int = _TIOC | 13;
+pub const TCSETS: ::c_int = _TIOC | 14;
+pub const TCSANOW: ::c_int = _TIOC | 14;
+pub const TCSETSW: ::c_int = _TIOC | 15;
+pub const TCSADRAIN: ::c_int = _TIOC | 15;
+pub const TCSETSF: ::c_int = _TIOC | 16;
+pub const TCSAFLUSH: ::c_int = _TIOC | 16;
pub const TCIFLUSH: ::c_int = 0;
pub const TCOFLUSH: ::c_int = 1;
pub const TCIOFLUSH: ::c_int = 2;
@@ -1792,55 +1833,53 @@ pub const TCOON: ::c_int = 1;
pub const TCIOFF: ::c_int = 2;
pub const TCION: ::c_int = 3;
pub const TIOC: ::c_int = _TIOC;
-pub const TIOCKBON: ::c_int = (_TIOC | 8);
-pub const TIOCKBOF: ::c_int = (_TIOC | 9);
-pub const TIOCGWINSZ: ::c_int = (_TIOC | 104);
-pub const TIOCSWINSZ: ::c_int = (_TIOC | 103);
-pub const TIOCGSOFTCAR: ::c_int = (_TIOC | 105);
-pub const TIOCSSOFTCAR: ::c_int = (_TIOC | 106);
-pub const TIOCSETLD: ::c_int = (_TIOC | 123);
-pub const TIOCGETLD: ::c_int = (_TIOC | 124);
-pub const TIOCGPPS: ::c_int = (_TIOC | 125);
-pub const TIOCSPPS: ::c_int = (_TIOC | 126);
-pub const TIOCGPPSEV: ::c_int = (_TIOC | 127);
-pub const TIOCGETD: ::c_int = (tIOC | 0);
-pub const TIOCSETD: ::c_int = (tIOC | 1);
-pub const TIOCHPCL: ::c_int = (tIOC | 2);
-pub const TIOCGETP: ::c_int = (tIOC | 8);
-pub const TIOCSETP: ::c_int = (tIOC | 9);
-pub const TIOCSETN: ::c_int = (tIOC | 10);
-pub const TIOCEXCL: ::c_int = (tIOC | 13);
-pub const TIOCNXCL: ::c_int = (tIOC | 14);
-pub const TIOCFLUSH: ::c_int = (tIOC | 16);
-pub const TIOCSETC: ::c_int = (tIOC | 17);
-pub const TIOCGETC: ::c_int = (tIOC | 18);
-pub const TIOCLBIS: ::c_int = (tIOC | 127);
-pub const TIOCLBIC: ::c_int = (tIOC | 126);
-pub const TIOCLSET: ::c_int = (tIOC | 125);
-pub const TIOCLGET: ::c_int = (tIOC | 124);
-pub const TIOCSBRK: ::c_int = (tIOC | 123);
-pub const TIOCCBRK: ::c_int = (tIOC | 122);
-pub const TIOCSDTR: ::c_int = (tIOC | 121);
-pub const TIOCCDTR: ::c_int = (tIOC | 120);
-pub const TIOCSLTC: ::c_int = (tIOC | 117);
-pub const TIOCGLTC: ::c_int = (tIOC | 116);
-pub const TIOCOUTQ: ::c_int = (tIOC | 115);
-pub const TIOCNOTTY: ::c_int = (tIOC | 113);
-pub const TIOCSCTTY: ::c_int = (tIOC | 132);
-pub const TIOCSTOP: ::c_int = (tIOC | 111);
-pub const TIOCSTART: ::c_int = (tIOC | 110);
-pub const TIOCSILOOP: ::c_int = (tIOC | 109);
-pub const TIOCCILOOP: ::c_int = (tIOC | 108);
-pub const TIOCGPGRP: ::c_int = (tIOC | 20);
-pub const TIOCSPGRP: ::c_int = (tIOC | 21);
-pub const TIOCGSID: ::c_int = (tIOC | 22);
-pub const TIOCSTI: ::c_int = (tIOC | 23);
-pub const TIOCMSET: ::c_int = (tIOC | 26);
-pub const TIOCMBIS: ::c_int = (tIOC | 27);
-pub const TIOCMBIC: ::c_int = (tIOC | 28);
-pub const TIOCMGET: ::c_int = (tIOC | 29);
-pub const TIOCREMOTE: ::c_int = (tIOC | 30);
-pub const TIOCSIGNAL: ::c_int = (tIOC | 31);
+pub const TIOCKBON: ::c_int = _TIOC | 8;
+pub const TIOCKBOF: ::c_int = _TIOC | 9;
+pub const TIOCGWINSZ: ::c_int = _TIOC | 104;
+pub const TIOCSWINSZ: ::c_int = _TIOC | 103;
+pub const TIOCGSOFTCAR: ::c_int = _TIOC | 105;
+pub const TIOCSSOFTCAR: ::c_int = _TIOC | 106;
+pub const TIOCGPPS: ::c_int = _TIOC | 125;
+pub const TIOCSPPS: ::c_int = _TIOC | 126;
+pub const TIOCGPPSEV: ::c_int = _TIOC | 127;
+pub const TIOCGETD: ::c_int = tIOC | 0;
+pub const TIOCSETD: ::c_int = tIOC | 1;
+pub const TIOCHPCL: ::c_int = tIOC | 2;
+pub const TIOCGETP: ::c_int = tIOC | 8;
+pub const TIOCSETP: ::c_int = tIOC | 9;
+pub const TIOCSETN: ::c_int = tIOC | 10;
+pub const TIOCEXCL: ::c_int = tIOC | 13;
+pub const TIOCNXCL: ::c_int = tIOC | 14;
+pub const TIOCFLUSH: ::c_int = tIOC | 16;
+pub const TIOCSETC: ::c_int = tIOC | 17;
+pub const TIOCGETC: ::c_int = tIOC | 18;
+pub const TIOCLBIS: ::c_int = tIOC | 127;
+pub const TIOCLBIC: ::c_int = tIOC | 126;
+pub const TIOCLSET: ::c_int = tIOC | 125;
+pub const TIOCLGET: ::c_int = tIOC | 124;
+pub const TIOCSBRK: ::c_int = tIOC | 123;
+pub const TIOCCBRK: ::c_int = tIOC | 122;
+pub const TIOCSDTR: ::c_int = tIOC | 121;
+pub const TIOCCDTR: ::c_int = tIOC | 120;
+pub const TIOCSLTC: ::c_int = tIOC | 117;
+pub const TIOCGLTC: ::c_int = tIOC | 116;
+pub const TIOCOUTQ: ::c_int = tIOC | 115;
+pub const TIOCNOTTY: ::c_int = tIOC | 113;
+pub const TIOCSCTTY: ::c_int = tIOC | 132;
+pub const TIOCSTOP: ::c_int = tIOC | 111;
+pub const TIOCSTART: ::c_int = tIOC | 110;
+pub const TIOCSILOOP: ::c_int = tIOC | 109;
+pub const TIOCCILOOP: ::c_int = tIOC | 108;
+pub const TIOCGPGRP: ::c_int = tIOC | 20;
+pub const TIOCSPGRP: ::c_int = tIOC | 21;
+pub const TIOCGSID: ::c_int = tIOC | 22;
+pub const TIOCSTI: ::c_int = tIOC | 23;
+pub const TIOCMSET: ::c_int = tIOC | 26;
+pub const TIOCMBIS: ::c_int = tIOC | 27;
+pub const TIOCMBIC: ::c_int = tIOC | 28;
+pub const TIOCMGET: ::c_int = tIOC | 29;
+pub const TIOCREMOTE: ::c_int = tIOC | 30;
+pub const TIOCSIGNAL: ::c_int = tIOC | 31;
pub const EPOLLIN: ::c_int = 0x1;
pub const EPOLLPRI: ::c_int = 0x2;
@@ -1854,8 +1893,9 @@ pub const EPOLLERR: ::c_int = 0x8;
pub const EPOLLHUP: ::c_int = 0x10;
pub const EPOLLET: ::c_int = 0x80000000;
pub const EPOLLRDHUP: ::c_int = 0x2000;
-pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000;
pub const EPOLLONESHOT: ::c_int = 0x40000000;
+pub const EPOLLWAKEUP: ::c_int = 0x20000000;
+pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000;
pub const EPOLL_CLOEXEC: ::c_int = 0x80000;
pub const EPOLL_CTL_ADD: ::c_int = 1;
pub const EPOLL_CTL_MOD: ::c_int = 3;
@@ -1886,9 +1926,9 @@ pub const B230400: speed_t = 20;
pub const B307200: speed_t = 21;
pub const B460800: speed_t = 22;
pub const B921600: speed_t = 23;
-pub const CSTART: ::tcflag_t = 021;
-pub const CSTOP: ::tcflag_t = 023;
-pub const CSWTCH: ::tcflag_t = 032;
+pub const CSTART: ::tcflag_t = 0o21;
+pub const CSTOP: ::tcflag_t = 0o23;
+pub const CSWTCH: ::tcflag_t = 0o32;
pub const CSIZE: ::tcflag_t = 0o000060;
pub const CS5: ::tcflag_t = 0;
pub const CS6: ::tcflag_t = 0o000020;
@@ -1955,12 +1995,161 @@ pub const VLNEXT: usize = 15;
pub const VSTATUS: usize = 16;
pub const VERASE2: usize = 17;
+// <sys/stropts.h>
+const STR: ::c_int = (b'S' as ::c_int) << 8;
+pub const I_NREAD: ::c_int = STR | 0o1;
+pub const I_PUSH: ::c_int = STR | 0o2;
+pub const I_POP: ::c_int = STR | 0o3;
+pub const I_LOOK: ::c_int = STR | 0o4;
+pub const I_FLUSH: ::c_int = STR | 0o5;
+pub const I_SRDOPT: ::c_int = STR | 0o6;
+pub const I_GRDOPT: ::c_int = STR | 0o7;
+pub const I_STR: ::c_int = STR | 0o10;
+pub const I_SETSIG: ::c_int = STR | 0o11;
+pub const I_GETSIG: ::c_int = STR | 0o12;
+pub const I_FIND: ::c_int = STR | 0o13;
+pub const I_LINK: ::c_int = STR | 0o14;
+pub const I_UNLINK: ::c_int = STR | 0o15;
+pub const I_PEEK: ::c_int = STR | 0o17;
+pub const I_FDINSERT: ::c_int = STR | 0o20;
+pub const I_SENDFD: ::c_int = STR | 0o21;
+pub const I_RECVFD: ::c_int = STR | 0o16;
+pub const I_SWROPT: ::c_int = STR | 0o23;
+pub const I_GWROPT: ::c_int = STR | 0o24;
+pub const I_LIST: ::c_int = STR | 0o25;
+pub const I_PLINK: ::c_int = STR | 0o26;
+pub const I_PUNLINK: ::c_int = STR | 0o27;
+pub const I_ANCHOR: ::c_int = STR | 0o30;
+pub const I_FLUSHBAND: ::c_int = STR | 0o34;
+pub const I_CKBAND: ::c_int = STR | 0o35;
+pub const I_GETBAND: ::c_int = STR | 0o36;
+pub const I_ATMARK: ::c_int = STR | 0o37;
+pub const I_SETCLTIME: ::c_int = STR | 0o40;
+pub const I_GETCLTIME: ::c_int = STR | 0o41;
+pub const I_CANPUT: ::c_int = STR | 0o42;
+pub const I_SERROPT: ::c_int = STR | 0o43;
+pub const I_GERROPT: ::c_int = STR | 0o44;
+pub const I_ESETSIG: ::c_int = STR | 0o45;
+pub const I_EGETSIG: ::c_int = STR | 0o46;
+pub const __I_PUSH_NOCTTY: ::c_int = STR | 0o47;
+
// 3SOCKET flags
pub const SOCK_CLOEXEC: ::c_int = 0x080000;
pub const SOCK_NONBLOCK: ::c_int = 0x100000;
pub const SOCK_NDELAY: ::c_int = 0x200000;
+//<sys/timex.h>
+pub const SCALE_KG: ::c_int = 1 << 6;
+pub const SCALE_KF: ::c_int = 1 << 16;
+pub const SCALE_KH: ::c_int = 1 << 2;
+pub const MAXTC: ::c_int = 1 << 6;
+pub const SCALE_PHASE: ::c_int = 1 << 22;
+pub const SCALE_USEC: ::c_int = 1 << 16;
+pub const SCALE_UPDATE: ::c_int = SCALE_KG * MAXTC;
+pub const FINEUSEC: ::c_int = 1 << 22;
+pub const MAXPHASE: ::c_int = 512000;
+pub const MAXFREQ: ::c_int = 512 * SCALE_USEC;
+pub const MAXTIME: ::c_int = 200 << PPS_AVG;
+pub const MINSEC: ::c_int = 16;
+pub const MAXSEC: ::c_int = 1200;
+pub const PPS_AVG: ::c_int = 2;
+pub const PPS_SHIFT: ::c_int = 2;
+pub const PPS_SHIFTMAX: ::c_int = 8;
+pub const PPS_VALID: ::c_int = 120;
+pub const MAXGLITCH: ::c_int = 30;
+pub const MOD_OFFSET: u32 = 0x0001;
+pub const MOD_FREQUENCY: u32 = 0x0002;
+pub const MOD_MAXERROR: u32 = 0x0004;
+pub const MOD_ESTERROR: u32 = 0x0008;
+pub const MOD_STATUS: u32 = 0x0010;
+pub const MOD_TIMECONST: u32 = 0x0020;
+pub const MOD_CLKB: u32 = 0x4000;
+pub const MOD_CLKA: u32 = 0x8000;
+pub const STA_PLL: u32 = 0x0001;
+pub const STA_PPSFREQ: i32 = 0x0002;
+pub const STA_PPSTIME: i32 = 0x0004;
+pub const STA_FLL: i32 = 0x0008;
+pub const STA_INS: i32 = 0x0010;
+pub const STA_DEL: i32 = 0x0020;
+pub const STA_UNSYNC: i32 = 0x0040;
+pub const STA_FREQHOLD: i32 = 0x0080;
+pub const STA_PPSSIGNAL: i32 = 0x0100;
+pub const STA_PPSJITTER: i32 = 0x0200;
+pub const STA_PPSWANDER: i32 = 0x0400;
+pub const STA_PPSERROR: i32 = 0x0800;
+pub const STA_CLOCKERR: i32 = 0x1000;
+pub const STA_RONLY: i32 =
+ STA_PPSSIGNAL | STA_PPSJITTER | STA_PPSWANDER | STA_PPSERROR | STA_CLOCKERR;
+pub const TIME_OK: i32 = 0;
+pub const TIME_INS: i32 = 1;
+pub const TIME_DEL: i32 = 2;
+pub const TIME_OOP: i32 = 3;
+pub const TIME_WAIT: i32 = 4;
+pub const TIME_ERROR: i32 = 5;
+
+pub const PRIO_PROCESS: ::c_int = 0;
+pub const PRIO_PGRP: ::c_int = 1;
+pub const PRIO_USER: ::c_int = 2;
+
+// As per sys/socket.h, header alignment must be 8 bytes on SPARC
+// and 4 bytes everywhere else:
+#[cfg(target_arch = "sparc64")]
+const _CMSG_HDR_ALIGNMENT: usize = 8;
+#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+const _CMSG_HDR_ALIGNMENT: usize = 4;
+
+const _CMSG_DATA_ALIGNMENT: usize = ::mem::size_of::<::c_int>();
+
+const_fn! {
+ {const} fn _CMSG_HDR_ALIGN(p: usize) -> usize {
+ (p + _CMSG_HDR_ALIGNMENT - 1) & !(_CMSG_HDR_ALIGNMENT - 1)
+ }
+
+ {const} fn _CMSG_DATA_ALIGN(p: usize) -> usize {
+ (p + _CMSG_DATA_ALIGNMENT - 1) & !(_CMSG_DATA_ALIGNMENT - 1)
+ }
+}
+
f! {
+ pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar {
+ _CMSG_DATA_ALIGN(cmsg.offset(1) as usize) as *mut ::c_uchar
+ }
+
+ pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
+ _CMSG_DATA_ALIGN(::mem::size_of::<::cmsghdr>()) as ::c_uint + length
+ }
+
+ pub fn CMSG_FIRSTHDR(mhdr: *const ::msghdr) -> *mut ::cmsghdr {
+ if ((*mhdr).msg_controllen as usize) < ::mem::size_of::<::cmsghdr>() {
+ 0 as *mut ::cmsghdr
+ } else {
+ (*mhdr).msg_control as *mut ::cmsghdr
+ }
+ }
+
+ pub fn CMSG_NXTHDR(mhdr: *const ::msghdr, cmsg: *const ::cmsghdr)
+ -> *mut ::cmsghdr
+ {
+ if cmsg.is_null() {
+ return ::CMSG_FIRSTHDR(mhdr);
+ };
+ let next = _CMSG_HDR_ALIGN(cmsg as usize + (*cmsg).cmsg_len as usize
+ + ::mem::size_of::<::cmsghdr>());
+ let max = (*mhdr).msg_control as usize
+ + (*mhdr).msg_controllen as usize;
+ if next > max {
+ 0 as *mut ::cmsghdr
+ } else {
+ _CMSG_HDR_ALIGN(cmsg as usize + (*cmsg).cmsg_len as usize)
+ as *mut ::cmsghdr
+ }
+ }
+
+ pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ _CMSG_HDR_ALIGN(::mem::size_of::<::cmsghdr>() as usize
+ + length as usize) as ::c_uint
+ }
+
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
let fd = fd as usize;
@@ -1986,36 +2175,38 @@ f! {
*slot = 0;
}
}
+}
- pub fn WIFEXITED(status: ::c_int) -> bool {
+safe_f! {
+ pub {const} fn WIFEXITED(status: ::c_int) -> bool {
(status & 0xFF) == 0
}
- pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
+ pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int {
(status >> 8) & 0xFF
}
- pub fn WTERMSIG(status: ::c_int) -> ::c_int {
+ pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
status & 0x7F
}
- pub fn WIFCONTINUED(status: ::c_int) -> bool {
+ pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
(status & 0xffff) == 0xffff
}
- pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
+ pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
(status & 0xff00) >> 8
}
- pub fn WIFSIGNALED(status: ::c_int) -> bool {
+ pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
((status & 0xff) > 0) && (status & 0xff00 == 0)
}
- pub fn WIFSTOPPED(status: ::c_int) -> bool {
+ pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
((status & 0xff) == 0x7f) && ((status & 0xff00) != 0)
}
- pub fn WCOREDUMP(status: ::c_int) -> bool {
+ pub {const} fn WCOREDUMP(status: ::c_int) -> bool {
(status & 0x80) != 0
}
}
@@ -2024,18 +2215,10 @@ 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 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 sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int;
pub fn abs(i: ::c_int) -> ::c_int;
pub fn acct(filename: *const ::c_char) -> ::c_int;
@@ -2051,19 +2234,10 @@ extern "C" {
pub fn freeifaddrs(ifa: *mut ::ifaddrs);
pub fn stack_getbounds(sp: *mut ::stack_t) -> ::c_int;
- pub fn mincore(
- addr: *const ::c_void,
- len: ::size_t,
- vec: *mut c_char,
- ) -> ::c_int;
pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
pub fn setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int;
pub fn ioctl(fildes: ::c_int, request: ::c_int, ...) -> ::c_int;
- pub fn mprotect(
- addr: *const ::c_void,
- len: ::size_t,
- prot: ::c_int,
- ) -> ::c_int;
+ pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
pub fn ___errno() -> *mut ::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;
@@ -2073,10 +2247,7 @@ extern "C" {
rqtp: *const ::timespec,
rmtp: *mut ::timespec,
) -> ::c_int;
- pub fn clock_settime(
- clk_id: ::clockid_t,
- tp: *const ::timespec,
- ) -> ::c_int;
+ pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
pub fn getnameinfo(
sa: *const ::sockaddr,
salen: ::socklen_t,
@@ -2090,22 +2261,16 @@ extern "C" {
pub fn endpwent();
pub fn getpwent() -> *mut passwd;
pub fn fdatasync(fd: ::c_int) -> ::c_int;
- pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t)
- -> *mut ::c_char;
+ pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
pub fn duplocale(base: ::locale_t) -> ::locale_t;
pub fn freelocale(loc: ::locale_t);
- pub fn newlocale(
- mask: ::c_int,
- locale: *const ::c_char,
- base: ::locale_t,
- ) -> ::locale_t;
+ pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t;
pub fn uselocale(loc: ::locale_t) -> ::locale_t;
pub fn getprogname() -> *const ::c_char;
pub fn setprogname(name: *const ::c_char);
pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
pub fn getpriority(which: ::c_int, who: ::c_int) -> ::c_int;
- pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int)
- -> ::c_int;
+ pub fn setpriority(which: ::c_int, who: ::c_int, prio: ::c_int) -> ::c_int;
pub fn mknodat(
dirfd: ::c_int,
@@ -2113,11 +2278,7 @@ extern "C" {
mode: ::mode_t,
dev: dev_t,
) -> ::c_int;
- pub fn mkfifoat(
- dirfd: ::c_int,
- pathname: *const ::c_char,
- mode: ::mode_t,
- ) -> ::c_int;
+ pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int;
pub fn sethostname(name: *const ::c_char, len: ::c_int) -> ::c_int;
pub fn if_nameindex() -> *mut if_nameindex;
pub fn if_freenameindex(ptr: *mut if_nameindex);
@@ -2127,6 +2288,11 @@ extern "C" {
f: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
value: *mut ::c_void,
) -> ::c_int;
+ pub fn pthread_attr_getstack(
+ attr: *const ::pthread_attr_t,
+ stackaddr: *mut *mut ::c_void,
+ stacksize: *mut ::size_t,
+ ) -> ::c_int;
pub fn pthread_condattr_getclock(
attr: *const pthread_condattr_t,
clock_id: *mut clockid_t,
@@ -2135,76 +2301,45 @@ extern "C" {
attr: *mut pthread_condattr_t,
clock_id: ::clockid_t,
) -> ::c_int;
- pub fn sem_timedwait(
- sem: *mut sem_t,
- abstime: *const ::timespec,
- ) -> ::c_int;
+ pub fn sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int;
pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int;
pub fn pthread_mutex_timedlock(
lock: *mut pthread_mutex_t,
abstime: *const ::timespec,
) -> ::c_int;
- pub fn waitid(
- idtype: idtype_t,
- id: id_t,
- infop: *mut ::siginfo_t,
- options: ::c_int,
- ) -> ::c_int;
+ pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int)
+ -> ::c_int;
+ #[cfg_attr(target_os = "illumos", link_name = "_glob_ext")]
pub fn glob(
pattern: *const ::c_char,
flags: ::c_int,
- errfunc: ::Option<
- extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int,
- >,
+ errfunc: ::Option<extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>,
pglob: *mut ::glob_t,
) -> ::c_int;
+ #[cfg_attr(target_os = "illumos", link_name = "_globfree_ext")]
pub fn globfree(pglob: *mut ::glob_t);
- pub fn posix_madvise(
- addr: *mut ::c_void,
- len: ::size_t,
- advice: ::c_int,
- ) -> ::c_int;
+ pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
- pub fn shmat(
- shmid: ::c_int,
- shmaddr: *const ::c_void,
- shmflg: ::c_int,
- ) -> *mut ::c_void;
+ pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void;
- pub fn shmctl(
- shmid: ::c_int,
- cmd: ::c_int,
- buf: *mut ::shmid_ds,
- ) -> ::c_int;
+ pub fn shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
pub fn shmget(key: key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
- pub fn shm_open(
- name: *const ::c_char,
- oflag: ::c_int,
- mode: ::mode_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 seekdir(dirp: *mut ::DIR, loc: ::c_long);
pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
- pub fn madvise(
- addr: *mut ::c_void,
- len: ::size_t,
- advice: ::c_int,
- ) -> ::c_int;
+ pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
- pub fn msync(
- addr: *mut ::c_void,
- len: ::size_t,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
@@ -2217,11 +2352,7 @@ extern "C" {
addrlen: *mut ::socklen_t,
) -> ::ssize_t;
pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
- pub fn futimesat(
- fd: ::c_int,
- path: *const ::c_char,
- times: *const ::timeval,
- ) -> ::c_int;
+ pub fn futimesat(fd: ::c_int, path: *const ::c_char, times: *const ::timeval) -> ::c_int;
pub fn futimens(dirfd: ::c_int, times: *const ::timespec) -> ::c_int;
pub fn utimensat(
dirfd: ::c_int,
@@ -2232,35 +2363,21 @@ extern "C" {
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
#[cfg_attr(target_os = "illumos", link_name = "__xnet_bind")]
- pub fn bind(
- socket: ::c_int,
- address: *const ::sockaddr,
- address_len: ::socklen_t,
- ) -> ::c_int;
+ pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int;
- pub fn writev(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- ) -> ::ssize_t;
- pub fn readv(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- ) -> ::ssize_t;
+ pub fn 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;
#[cfg_attr(target_os = "illumos", link_name = "__xnet_sendmsg")]
- pub fn sendmsg(
- fd: ::c_int,
- msg: *const ::msghdr,
- flags: ::c_int,
- ) -> ::ssize_t;
+ pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t;
#[cfg_attr(target_os = "illumos", link_name = "__xnet_recvmsg")]
- pub fn recvmsg(
+ pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t;
+ pub fn accept4(
fd: ::c_int,
- msg: *mut ::msghdr,
+ address: *mut sockaddr,
+ address_len: *mut socklen_t,
flags: ::c_int,
- ) -> ::ssize_t;
+ ) -> ::c_int;
pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
@@ -2292,11 +2409,7 @@ extern "C" {
abs_timeout: *const ::timespec,
) -> ::c_int;
pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
- pub fn mq_setattr(
- mqd: ::mqd_t,
- newattr: *const ::mq_attr,
- oldattr: *mut ::mq_attr,
- ) -> ::c_int;
+ pub fn mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int;
pub fn port_create() -> ::c_int;
pub fn port_associate(
port: ::c_int,
@@ -2305,16 +2418,8 @@ extern "C" {
events: ::c_int,
user: *mut ::c_void,
) -> ::c_int;
- pub fn port_dissociate(
- port: ::c_int,
- source: ::c_int,
- object: ::uintptr_t,
- ) -> ::c_int;
- pub fn port_get(
- port: ::c_int,
- pe: *mut port_event,
- timeout: *mut ::timespec,
- ) -> ::c_int;
+ pub fn port_dissociate(port: ::c_int, source: ::c_int, object: ::uintptr_t) -> ::c_int;
+ pub fn port_get(port: ::c_int, pe: *mut port_event, timeout: *mut ::timespec) -> ::c_int;
pub fn port_getn(
port: ::c_int,
pe_list: *mut port_event,
@@ -2322,10 +2427,13 @@ extern "C" {
nget: *mut ::c_uint,
timeout: *mut ::timespec,
) -> ::c_int;
- pub fn fexecve(
- fd: ::c_int,
- argv: *const *const ::c_char,
- envp: *const *const ::c_char,
+ pub fn port_send(port: ::c_int, events: ::c_int, user: *mut ::c_void) -> ::c_int;
+ pub fn port_sendn(
+ port_list: *mut ::c_int,
+ error_list: *mut ::c_int,
+ nent: ::c_uint,
+ events: ::c_int,
+ user: *mut ::c_void,
) -> ::c_int;
#[cfg_attr(
any(target_os = "solaris", target_os = "illumos"),
@@ -2344,7 +2452,7 @@ extern "C" {
// The epoll functions are actually only present on illumos. However,
// there are things using epoll on illumos (built using the
- // x86_64-sun-solaris target) which would break until the illumos target is
+ // x86_64-pc-solaris target) which would break until the illumos target is
// present in rustc.
pub fn epoll_pwait(
epfd: ::c_int,
@@ -2362,12 +2470,8 @@ extern "C" {
maxevents: ::c_int,
timeout: ::c_int,
) -> ::c_int;
- pub fn epoll_ctl(
- epfd: ::c_int,
- op: ::c_int,
- fd: ::c_int,
- event: *mut ::epoll_event,
- ) -> ::c_int;
+ pub fn epoll_ctl(epfd: ::c_int, op: ::c_int, fd: ::c_int, event: *mut ::epoll_event)
+ -> ::c_int;
#[cfg_attr(
any(target_os = "solaris", target_os = "illumos"),
@@ -2380,11 +2484,7 @@ extern "C" {
buflen: ::size_t,
result: *mut *mut ::group,
) -> ::c_int;
- pub fn pthread_sigmask(
- how: ::c_int,
- set: *const sigset_t,
- oldset: *mut sigset_t,
- ) -> ::c_int;
+ pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int;
pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
@@ -2451,25 +2551,6 @@ extern "C" {
pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int;
pub fn uname(buf: *mut ::utsname) -> ::c_int;
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
- pub fn door_call(d: ::c_int, params: *const door_arg_t) -> ::c_int;
- pub fn door_return(
- data_ptr: *const ::c_char,
- data_size: ::size_t,
- desc_ptr: *const door_desc_t,
- num_desc: ::c_uint,
- );
- pub fn door_create(
- server_procedure: extern "C" fn(
- cookie: *const ::c_void,
- argp: *const ::c_char,
- arg_size: ::size_t,
- dp: *const door_desc_t,
- n_desc: ::c_uint,
- ),
- cookie: *const ::c_void,
- attributes: door_attr_t,
- ) -> ::c_int;
- pub fn fattach(fildes: ::c_int, path: *const ::c_char) -> ::c_int;
pub fn makeutx(ux: *const utmpx) -> *mut utmpx;
pub fn modutx(ux: *const utmpx) -> *mut utmpx;
@@ -2493,7 +2574,52 @@ extern "C" {
pub fn getutmp(ux: *const utmpx, u: *mut utmp);
pub fn getutmpx(u: *const utmp, ux: *mut utmpx);
pub fn updwtmp(file: *const ::c_char, u: *mut utmp);
+
+ pub fn ntp_adjtime(buf: *mut timex) -> ::c_int;
+ pub fn ntp_gettime(buf: *mut ntptimeval) -> ::c_int;
+
+ pub fn timer_create(clock_id: clockid_t, evp: *mut sigevent, timerid: *mut timer_t) -> ::c_int;
+ pub fn timer_delete(timerid: timer_t) -> ::c_int;
+ pub fn timer_getoverrun(timerid: timer_t) -> ::c_int;
+ pub fn timer_gettime(timerid: timer_t, value: *mut itimerspec) -> ::c_int;
+ pub fn timer_settime(
+ timerid: timer_t,
+ flags: ::c_int,
+ value: *const itimerspec,
+ ovalue: *mut itimerspec,
+ ) -> ::c_int;
+
+ pub fn ucred_get(pid: ::pid_t) -> *mut ucred_t;
+ pub fn getpeerucred(fd: ::c_int, ucred: *mut *mut ucred_t) -> ::c_int;
+
+ pub fn ucred_free(ucred: *mut ucred_t);
+
+ pub fn ucred_geteuid(ucred: *const ucred_t) -> ::uid_t;
+ pub fn ucred_getruid(ucred: *const ucred_t) -> ::uid_t;
+ pub fn ucred_getsuid(ucred: *const ucred_t) -> ::uid_t;
+ pub fn ucred_getegid(ucred: *const ucred_t) -> ::gid_t;
+ pub fn ucred_getrgid(ucred: *const ucred_t) -> ::gid_t;
+ pub fn ucred_getsgid(ucred: *const ucred_t) -> ::gid_t;
+ pub fn ucred_getgroups(ucred: *const ucred_t, groups: *mut *const ::gid_t) -> ::c_int;
+ pub fn ucred_getpid(ucred: *const ucred_t) -> ::pid_t;
+ pub fn ucred_getprojid(ucred: *const ucred_t) -> projid_t;
+ pub fn ucred_getzoneid(ucred: *const ucred_t) -> zoneid_t;
+ pub fn ucred_getpflags(ucred: *const ucred_t, flags: ::c_uint) -> ::c_uint;
+
+ pub fn ucred_size() -> ::size_t;
}
mod compat;
pub use self::compat::*;
+
+cfg_if! {
+ if #[cfg(target_os = "illumos")] {
+ mod illumos;
+ pub use self::illumos::*;
+ } else if #[cfg(target_os = "solaris")] {
+ mod solaris;
+ pub use self::solaris::*;
+ } else {
+ // Unknown target_os
+ }
+}
diff --git a/src/unix/solarish/solaris.rs b/src/unix/solarish/solaris.rs
new file mode 100644
index 00000000..8ea070c6
--- /dev/null
+++ b/src/unix/solarish/solaris.rs
@@ -0,0 +1,94 @@
+pub type door_attr_t = ::c_uint;
+pub type door_id_t = ::c_ulonglong;
+
+s! {
+ pub struct shmid_ds {
+ pub shm_perm: ::ipc_perm,
+ pub shm_segsz: ::size_t,
+ pub shm_flags: ::uintptr_t,
+ pub shm_lkcnt: ::c_ushort,
+ pub shm_lpid: ::pid_t,
+ pub shm_cpid: ::pid_t,
+ pub shm_nattch: ::shmatt_t,
+ pub shm_cnattch: ::c_ulong,
+ pub shm_atime: ::time_t,
+ pub shm_dtime: ::time_t,
+ pub shm_ctime: ::time_t,
+ pub shm_amp: *mut ::c_void,
+ pub shm_gransize: u64,
+ pub shm_allocated: u64,
+ pub shm_pad4: [i64; 1],
+ }
+
+ pub struct door_desc_t__d_data__d_desc {
+ pub d_descriptor: ::c_int,
+ pub d_id: ::door_id_t
+ }
+}
+
+pub const PORT_SOURCE_POSTWAIT: ::c_int = 8;
+pub const PORT_SOURCE_SIGNAL: ::c_int = 9;
+
+pub const AF_LOCAL: ::c_int = 0;
+pub const AF_FILE: ::c_int = 0;
+
+pub const TCP_KEEPIDLE: ::c_int = 0x1d;
+pub const TCP_KEEPCNT: ::c_int = 0x1e;
+pub const TCP_KEEPINTVL: ::c_int = 0x1f;
+
+extern "C" {
+ pub fn fexecve(
+ fd: ::c_int,
+ argv: *const *const ::c_char,
+ envp: *const *const ::c_char,
+ ) -> ::c_int;
+
+ pub fn mincore(addr: *const ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int;
+
+ pub fn door_call(d: ::c_int, params: *const door_arg_t) -> ::c_int;
+ pub fn door_return(
+ data_ptr: *const ::c_char,
+ data_size: ::size_t,
+ desc_ptr: *const door_desc_t,
+ num_desc: ::c_uint,
+ );
+ pub fn door_create(
+ server_procedure: extern "C" fn(
+ cookie: *const ::c_void,
+ argp: *const ::c_char,
+ arg_size: ::size_t,
+ dp: *const door_desc_t,
+ n_desc: ::c_uint,
+ ),
+ cookie: *const ::c_void,
+ attributes: door_attr_t,
+ ) -> ::c_int;
+
+ pub fn fattach(fildes: ::c_int, path: *const ::c_char) -> ::c_int;
+
+ pub fn pthread_getattr_np(thread: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int;
+}
+
+s_no_extra_traits! {
+ #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))]
+ pub union door_desc_t__d_data {
+ pub d_desc: door_desc_t__d_data__d_desc,
+ d_resv: [::c_int; 5], /* Check out /usr/include/sys/door.h */
+ }
+
+ #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))]
+ pub struct door_desc_t {
+ pub d_attributes: door_attr_t,
+ pub d_data: door_desc_t__d_data,
+ }
+
+ #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))]
+ pub struct door_arg_t {
+ pub data_ptr: *const ::c_char,
+ pub data_size: ::size_t,
+ pub desc_ptr: *const door_desc_t,
+ pub dec_num: ::c_uint,
+ pub rbuf: *const ::c_char,
+ pub rsize: ::size_t,
+ }
+}
diff --git a/src/unix/uclibc/align.rs b/src/unix/uclibc/align.rs
deleted file mode 100644
index 76b524d0..00000000
--- a/src/unix/uclibc/align.rs
+++ /dev/null
@@ -1,66 +0,0 @@
-macro_rules! expand_align {
- () => {
- s! {
- #[cfg_attr(any(target_pointer_width = "32",
- target_arch = "x86_64",
- target_arch = "powerpc64",
- target_arch = "mips64",
- target_arch = "s390x",
- target_arch = "sparc64"),
- repr(align(4)))]
- #[cfg_attr(not(any(target_pointer_width = "32",
- target_arch = "x86_64",
- target_arch = "powerpc64",
- target_arch = "mips64",
- target_arch = "s390x",
- target_arch = "sparc64")),
- repr(align(8)))]
- pub struct pthread_mutexattr_t {
- size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T],
- }
-
- #[repr(align(4))]
- pub struct pthread_condattr_t {
- size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
- }
- }
-
- s_no_extra_traits! {
- #[repr(align(8))]
- #[allow(missing_debug_implementations)]
- pub struct pthread_cond_t {
- size: [u8; ::__SIZEOF_PTHREAD_COND_T],
- }
-
- #[cfg_attr(all(target_pointer_width = "32",
- any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc")),
- repr(align(4)))]
- #[cfg_attr(any(target_pointer_width = "64",
- not(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc"))),
- repr(align(8)))]
- #[allow(missing_debug_implementations)]
- pub struct pthread_mutex_t {
- size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
- }
-
- #[cfg_attr(all(target_pointer_width = "32",
- any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc")),
- repr(align(4)))]
- #[cfg_attr(any(target_pointer_width = "64",
- not(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc"))),
- repr(align(8)))]
- #[allow(missing_debug_implementations)]
- pub struct pthread_rwlock_t {
- size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T],
- }
- }
- };
-}
diff --git a/src/unix/uclibc/mod.rs b/src/unix/uclibc/mod.rs
deleted file mode 100644
index b4fe0368..00000000
--- a/src/unix/uclibc/mod.rs
+++ /dev/null
@@ -1,2295 +0,0 @@
-pub type sa_family_t = u16;
-pub type pthread_key_t = ::c_uint;
-pub type speed_t = ::c_uint;
-pub type tcflag_t = ::c_uint;
-pub type loff_t = ::c_longlong;
-pub type clockid_t = ::c_int;
-pub type key_t = ::c_int;
-pub type id_t = ::c_uint;
-pub type useconds_t = u32;
-pub type dev_t = u64;
-pub type socklen_t = u32;
-pub type mode_t = u32;
-pub type ino64_t = u64;
-pub type off64_t = i64;
-pub type blkcnt64_t = i64;
-pub type rlim64_t = u64;
-pub type shmatt_t = ::c_ulong;
-pub type mqd_t = ::c_int;
-pub type msgqnum_t = ::c_ulong;
-pub type msglen_t = ::c_ulong;
-pub type nfds_t = ::c_ulong;
-pub type nl_item = ::c_int;
-pub type idtype_t = ::c_uint;
-
-#[cfg_attr(feature = "extra_traits", derive(Debug))]
-pub enum fpos64_t {} // TODO: fill this out with a struct
-impl ::Copy for fpos64_t {}
-impl ::Clone for fpos64_t {
- fn clone(&self) -> fpos64_t {
- *self
- }
-}
-
-#[cfg_attr(feature = "extra_traits", derive(Debug))]
-pub enum timezone {}
-impl ::Copy for timezone {}
-impl ::Clone for timezone {
- fn clone(&self) -> timezone {
- *self
- }
-}
-
-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 sockaddr {
- pub sa_family: sa_family_t,
- pub sa_data: [::c_char; 14],
- }
-
- pub struct sockaddr_in {
- pub sin_family: sa_family_t,
- pub sin_port: ::in_port_t,
- pub sin_addr: ::in_addr,
- pub sin_zero: [u8; 8],
- }
-
- pub struct sockaddr_in6 {
- pub sin6_family: sa_family_t,
- pub sin6_port: ::in_port_t,
- pub sin6_flowinfo: u32,
- pub sin6_addr: ::in6_addr,
- pub sin6_scope_id: u32,
- }
-
- 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 sockaddr_ll {
- pub sll_family: ::c_ushort,
- pub sll_protocol: ::c_ushort,
- pub sll_ifindex: ::c_int,
- pub sll_hatype: ::c_ushort,
- pub sll_pkttype: ::c_uchar,
- pub sll_halen: ::c_uchar,
- pub sll_addr: [::c_uchar; 8]
- }
-
- pub struct fd_set {
- fds_bits: [::c_ulong; FD_SETSIZE / ULONG_SIZE],
- }
-
- pub struct tm {
- pub tm_sec: ::c_int,
- pub tm_min: ::c_int,
- pub tm_hour: ::c_int,
- pub tm_mday: ::c_int,
- pub tm_mon: ::c_int,
- pub tm_year: ::c_int,
- pub tm_wday: ::c_int,
- pub tm_yday: ::c_int,
- pub tm_isdst: ::c_int,
- pub tm_gmtoff: ::c_long,
- pub tm_zone: *const ::c_char,
- }
-
- pub struct sched_param {
- pub sched_priority: ::c_int,
- }
-
- pub struct Dl_info {
- pub dli_fname: *const ::c_char,
- pub dli_fbase: *mut ::c_void,
- pub dli_sname: *const ::c_char,
- pub dli_saddr: *mut ::c_void,
- }
-
- pub struct 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 rlimit64 {
- pub rlim_cur: rlim64_t,
- pub rlim_max: rlim64_t,
- }
-
- pub struct glob_t {
- pub gl_pathc: ::size_t,
- pub gl_pathv: *mut *mut c_char,
- pub gl_offs: ::size_t,
- pub gl_flags: ::c_int,
-
- __unused1: *mut ::c_void,
- __unused2: *mut ::c_void,
- __unused3: *mut ::c_void,
- __unused4: *mut ::c_void,
- __unused5: *mut ::c_void,
- }
-
- pub struct ifaddrs {
- pub ifa_next: *mut ifaddrs,
- pub ifa_name: *mut c_char,
- pub ifa_flags: ::c_uint,
- pub ifa_addr: *mut ::sockaddr,
- pub ifa_netmask: *mut ::sockaddr,
- pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
- pub ifa_data: *mut ::c_void
- }
-
- pub struct pthread_rwlockattr_t {
- __lockkind: ::c_int,
- __pshared: ::c_int,
- }
-
- pub struct passwd {
- pub pw_name: *mut ::c_char,
- pub pw_passwd: *mut ::c_char,
- pub pw_uid: ::uid_t,
- pub pw_gid: ::gid_t,
- pub pw_gecos: *mut ::c_char,
- pub pw_dir: *mut ::c_char,
- pub pw_shell: *mut ::c_char,
- }
-
- pub struct spwd {
- pub sp_namp: *mut ::c_char,
- pub sp_pwdp: *mut ::c_char,
- pub sp_lstchg: ::c_long,
- pub sp_min: ::c_long,
- pub sp_max: ::c_long,
- pub sp_warn: ::c_long,
- pub sp_inact: ::c_long,
- pub sp_expire: ::c_long,
- pub sp_flag: ::c_ulong,
- }
-
- pub struct statvfs {
- pub f_bsize: ::c_ulong,
- pub f_frsize: ::c_ulong,
- pub f_blocks: ::fsblkcnt_t,
- pub f_bfree: ::fsblkcnt_t,
- pub f_bavail: ::fsblkcnt_t,
- pub f_files: ::fsfilcnt_t,
- pub f_ffree: ::fsfilcnt_t,
- pub f_favail: ::fsfilcnt_t,
- #[cfg(target_endian = "little")]
- pub f_fsid: ::c_ulong,
- #[cfg(target_pointer_width = "32")]
- __f_unused: ::c_int,
- #[cfg(target_endian = "big")]
- pub f_fsid: ::c_ulong,
- pub f_flag: ::c_ulong,
- pub f_namemax: ::c_ulong,
- __f_spare: [::c_int; 6],
- }
-
- pub struct dqblk {
- pub dqb_bhardlimit: u32,
- pub dqb_bsoftlimit: u32,
- pub dqb_curblocks: u32,
- pub dqb_ihardlimit: u32,
- pub dqb_isoftlimit: u32,
- pub dqb_curinodes: u32,
- pub dqb_btime: ::time_t,
- pub dqb_itime: ::time_t,
- }
-
- pub struct signalfd_siginfo {
- pub ssi_signo: u32,
- pub ssi_errno: i32,
- pub ssi_code: i32,
- pub ssi_pid: u32,
- pub ssi_uid: u32,
- pub ssi_fd: i32,
- pub ssi_tid: u32,
- pub ssi_band: u32,
- pub ssi_overrun: u32,
- pub ssi_trapno: u32,
- pub ssi_status: i32,
- pub ssi_int: i32,
- pub ssi_ptr: u64,
- pub ssi_utime: u64,
- pub ssi_stime: u64,
- pub ssi_addr: u64,
- pub ssi_addr_lsb: u16,
- _pad2: u16,
- pub ssi_syscall: i32,
- pub ssi_call_addr: u64,
- pub ssi_arch: u32,
- _pad: [u8; 28],
- }
-
- pub struct fsid_t {
- __val: [::c_int; 2],
- }
-
- pub struct cpu_set_t {
- #[cfg(target_pointer_width = "32")]
- bits: [u32; 32],
- #[cfg(target_pointer_width = "64")]
- bits: [u64; 16],
- }
-
- pub struct if_nameindex {
- pub if_index: ::c_uint,
- pub if_name: *mut ::c_char,
- }
-
- // System V IPC
- pub struct msginfo {
- pub msgpool: ::c_int,
- pub msgmap: ::c_int,
- pub msgmax: ::c_int,
- pub msgmnb: ::c_int,
- pub msgmni: ::c_int,
- pub msgssz: ::c_int,
- pub msgtql: ::c_int,
- pub msgseg: ::c_ushort,
- }
-
- pub struct ucred {
- pub pid: ::pid_t,
- pub uid: ::uid_t,
- pub gid: ::gid_t,
- }
-}
-
-s_no_extra_traits! {
- #[cfg_attr(
- any(target_arch = "x86", target_arch = "x86_64"),
- repr(packed)
- )]
- #[allow(missing_debug_implementations)]
- pub struct epoll_event {
- pub events: u32,
- pub u64: u64,
- }
-
- #[allow(missing_debug_implementations)]
- pub struct sockaddr_un {
- pub sun_family: sa_family_t,
- pub sun_path: [::c_char; 108]
- }
-
- #[allow(missing_debug_implementations)]
- pub struct sockaddr_storage {
- pub ss_family: sa_family_t,
- __ss_align: ::size_t,
- #[cfg(target_pointer_width = "32")]
- __ss_pad2: [u8; 128 - 2 * 4],
- #[cfg(target_pointer_width = "64")]
- __ss_pad2: [u8; 128 - 2 * 8],
- }
-
- #[allow(missing_debug_implementations)]
- 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]
- }
-
- #[allow(missing_debug_implementations)]
- pub struct dirent {
- pub d_ino: ::ino_t,
- pub d_off: ::off_t,
- pub d_reclen: ::c_ushort,
- pub d_type: ::c_uchar,
- pub d_name: [::c_char; 256],
- }
-
- #[allow(missing_debug_implementations)]
- 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 mq_attr {
- pub mq_flags: ::c_long,
- pub mq_maxmsg: ::c_long,
- pub mq_msgsize: ::c_long,
- pub mq_curmsgs: ::c_long,
- pad: [::c_long; 4]
- }
-
- pub struct sockaddr_nl {
- pub nl_family: ::sa_family_t,
- nl_pad: ::c_ushort,
- pub nl_pid: u32,
- pub nl_groups: u32
- }
-
- pub struct sigevent {
- pub sigev_value: ::sigval,
- pub sigev_signo: ::c_int,
- pub sigev_notify: ::c_int,
- // Actually a union. We only expose sigev_notify_thread_id because it's
- // the most useful member
- pub sigev_notify_thread_id: ::c_int,
- #[cfg(target_pointer_width = "64")]
- __unused1: [::c_int; 11],
- #[cfg(target_pointer_width = "32")]
- __unused1: [::c_int; 12]
- }
-}
-
-cfg_if! {
- if #[cfg(feature = "extra_traits")] {
- impl PartialEq for mq_attr {
- fn eq(&self, other: &mq_attr) -> bool {
- self.mq_flags == other.mq_flags &&
- self.mq_maxmsg == other.mq_maxmsg &&
- self.mq_msgsize == other.mq_msgsize &&
- self.mq_curmsgs == other.mq_curmsgs
- }
- }
- impl Eq for mq_attr {}
- impl ::fmt::Debug for mq_attr {
- fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
- f.debug_struct("mq_attr")
- .field("mq_flags", &self.mq_flags)
- .field("mq_maxmsg", &self.mq_maxmsg)
- .field("mq_msgsize", &self.mq_msgsize)
- .field("mq_curmsgs", &self.mq_curmsgs)
- .finish()
- }
- }
- impl ::hash::Hash for mq_attr {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- self.mq_flags.hash(state);
- self.mq_maxmsg.hash(state);
- self.mq_msgsize.hash(state);
- self.mq_curmsgs.hash(state);
- }
- }
-
- impl PartialEq for sockaddr_nl {
- fn eq(&self, other: &sockaddr_nl) -> bool {
- self.nl_family == other.nl_family &&
- self.nl_pid == other.nl_pid &&
- self.nl_groups == other.nl_groups
- }
- }
- impl Eq for sockaddr_nl {}
- impl ::fmt::Debug for sockaddr_nl {
- fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
- f.debug_struct("sockaddr_nl")
- .field("nl_family", &self.nl_family)
- .field("nl_pid", &self.nl_pid)
- .field("nl_groups", &self.nl_groups)
- .finish()
- }
- }
- impl ::hash::Hash for sockaddr_nl {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- self.nl_family.hash(state);
- self.nl_pid.hash(state);
- self.nl_groups.hash(state);
- }
- }
-
- impl PartialEq for sigevent {
- fn eq(&self, other: &sigevent) -> bool {
- self.sigev_value == other.sigev_value
- && self.sigev_signo == other.sigev_signo
- && self.sigev_notify == other.sigev_notify
- && self.sigev_notify_thread_id
- == other.sigev_notify_thread_id
- }
- }
- impl Eq for sigevent {}
- impl ::fmt::Debug for sigevent {
- fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
- f.debug_struct("sigevent")
- .field("sigev_value", &self.sigev_value)
- .field("sigev_signo", &self.sigev_signo)
- .field("sigev_notify", &self.sigev_notify)
- .field("sigev_notify_thread_id",
- &self.sigev_notify_thread_id)
- .finish()
- }
- }
- impl ::hash::Hash for sigevent {
- fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
- self.sigev_value.hash(state);
- self.sigev_signo.hash(state);
- self.sigev_notify.hash(state);
- self.sigev_notify_thread_id.hash(state);
- }
- }
- }
-}
-
-// intentionally not public, only used for fd_set
-cfg_if! {
- if #[cfg(target_pointer_width = "32")] {
- const ULONG_SIZE: usize = 32;
- } else if #[cfg(target_pointer_width = "64")] {
- const ULONG_SIZE: usize = 64;
- } else {
- // Unknown target_pointer_width
- }
-}
-
-pub const EXIT_FAILURE: ::c_int = 1;
-pub const EXIT_SUCCESS: ::c_int = 0;
-pub const RAND_MAX: ::c_int = 2147483647;
-pub const EOF: ::c_int = -1;
-pub const SEEK_SET: ::c_int = 0;
-pub const SEEK_CUR: ::c_int = 1;
-pub const SEEK_END: ::c_int = 2;
-pub const _IOFBF: ::c_int = 0;
-pub const _IONBF: ::c_int = 2;
-pub const _IOLBF: ::c_int = 1;
-
-pub const F_DUPFD: ::c_int = 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;
-
-// Linux-specific fcntls
-pub const F_SETLEASE: ::c_int = 1024;
-pub const F_GETLEASE: ::c_int = 1025;
-pub const F_NOTIFY: ::c_int = 1026;
-pub const F_DUPFD_CLOEXEC: ::c_int = 1030;
-
-// TODO(#235): Include file sealing fcntls once we have a way to verify them.
-
-pub const SIGTRAP: ::c_int = 5;
-
-pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
-pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
-
-pub const CLOCK_REALTIME: ::clockid_t = 0;
-pub const CLOCK_MONOTONIC: ::clockid_t = 1;
-pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2;
-pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3;
-// TODO(#247) Someday our Travis shall have glibc 2.21 (released in Sep
-// 2014.) See also musl/mod.rs
-// pub const CLOCK_SGI_CYCLE: ::clockid_t = 10;
-// pub const CLOCK_TAI: ::clockid_t = 11;
-pub const TIMER_ABSTIME: ::c_int = 1;
-
-pub const RLIMIT_CPU: ::c_int = 0;
-pub const RLIMIT_FSIZE: ::c_int = 1;
-pub const RLIMIT_DATA: ::c_int = 2;
-pub const RLIMIT_STACK: ::c_int = 3;
-pub const RLIMIT_CORE: ::c_int = 4;
-pub const RLIMIT_LOCKS: ::c_int = 10;
-pub const RLIMIT_SIGPENDING: ::c_int = 11;
-pub const RLIMIT_MSGQUEUE: ::c_int = 12;
-pub const RLIMIT_NICE: ::c_int = 13;
-pub const RLIMIT_RTPRIO: ::c_int = 14;
-
-pub const RUSAGE_SELF: ::c_int = 0;
-
-pub const O_RDONLY: ::c_int = 0;
-pub const O_WRONLY: ::c_int = 1;
-pub const O_RDWR: ::c_int = 2;
-
-pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC;
-
-pub const S_IFIFO: ::mode_t = 4096;
-pub const S_IFCHR: ::mode_t = 8192;
-pub const S_IFBLK: ::mode_t = 24576;
-pub const S_IFDIR: ::mode_t = 16384;
-pub const S_IFREG: ::mode_t = 32768;
-pub const S_IFLNK: ::mode_t = 40960;
-pub const S_IFSOCK: ::mode_t = 49152;
-pub const S_IFMT: ::mode_t = 61440;
-pub const S_IRWXU: ::mode_t = 448;
-pub const S_IXUSR: ::mode_t = 64;
-pub const S_IWUSR: ::mode_t = 128;
-pub const S_IRUSR: ::mode_t = 256;
-pub const S_IRWXG: ::mode_t = 56;
-pub const S_IXGRP: ::mode_t = 8;
-pub const S_IWGRP: ::mode_t = 16;
-pub const S_IRGRP: ::mode_t = 32;
-pub const S_IRWXO: ::mode_t = 7;
-pub const S_IXOTH: ::mode_t = 1;
-pub const S_IWOTH: ::mode_t = 2;
-pub const S_IROTH: ::mode_t = 4;
-pub const F_OK: ::c_int = 0;
-pub const R_OK: ::c_int = 4;
-pub const W_OK: ::c_int = 2;
-pub const X_OK: ::c_int = 1;
-pub const STDIN_FILENO: ::c_int = 0;
-pub const STDOUT_FILENO: ::c_int = 1;
-pub const STDERR_FILENO: ::c_int = 2;
-pub const SIGHUP: ::c_int = 1;
-pub const SIGINT: ::c_int = 2;
-pub const SIGQUIT: ::c_int = 3;
-pub const SIGILL: ::c_int = 4;
-pub const SIGABRT: ::c_int = 6;
-pub const SIGFPE: ::c_int = 8;
-pub const SIGKILL: ::c_int = 9;
-pub const SIGSEGV: ::c_int = 11;
-pub const SIGPIPE: ::c_int = 13;
-pub const SIGALRM: ::c_int = 14;
-pub const SIGTERM: ::c_int = 15;
-
-pub const PROT_NONE: ::c_int = 0;
-pub const PROT_READ: ::c_int = 1;
-pub const PROT_WRITE: ::c_int = 2;
-pub const PROT_EXEC: ::c_int = 4;
-
-pub const LC_CTYPE: ::c_int = 0;
-pub const LC_NUMERIC: ::c_int = 1;
-pub const LC_MONETARY: ::c_int = 2;
-pub const LC_TIME: ::c_int = 3;
-pub const LC_COLLATE: ::c_int = 4;
-pub const LC_MESSAGES: ::c_int = 5;
-pub const LC_ALL: ::c_int = 6;
-pub const LC_CTYPE_MASK: ::c_int = (1 << LC_CTYPE);
-pub const LC_NUMERIC_MASK: ::c_int = (1 << LC_NUMERIC);
-pub const LC_TIME_MASK: ::c_int = (1 << LC_TIME);
-pub const LC_COLLATE_MASK: ::c_int = (1 << LC_COLLATE);
-pub const LC_MONETARY_MASK: ::c_int = (1 << LC_MONETARY);
-pub const LC_MESSAGES_MASK: ::c_int = (1 << LC_MESSAGES);
-// LC_ALL_MASK defined per platform
-
-pub const MAP_FILE: ::c_int = 0x0000;
-pub const MAP_SHARED: ::c_int = 0x0001;
-pub const MAP_PRIVATE: ::c_int = 0x0002;
-pub const MAP_FIXED: ::c_int = 0x0010;
-
-pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
-
-// MS_ flags for msync(2)
-pub const MS_ASYNC: ::c_int = 0x0001;
-pub const MS_INVALIDATE: ::c_int = 0x0002;
-pub const MS_SYNC: ::c_int = 0x0004;
-
-// MS_ flags for mount(2)
-pub const MS_RDONLY: ::c_ulong = 0x01;
-pub const MS_NOSUID: ::c_ulong = 0x02;
-pub const MS_NODEV: ::c_ulong = 0x04;
-pub const MS_NOEXEC: ::c_ulong = 0x08;
-pub const MS_SYNCHRONOUS: ::c_ulong = 0x10;
-pub const MS_REMOUNT: ::c_ulong = 0x20;
-pub const MS_MANDLOCK: ::c_ulong = 0x40;
-pub const MS_NOATIME: ::c_ulong = 0x0400;
-pub const MS_NODIRATIME: ::c_ulong = 0x0800;
-pub const MS_BIND: ::c_ulong = 0x1000;
-pub const MS_NOUSER: ::c_ulong = 0x80000000;
-pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000;
-pub const MS_MGC_MSK: ::c_ulong = 0xffff0000;
-pub const MS_RMT_MASK: ::c_ulong = 0x800051;
-
-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 EWOULDBLOCK: ::c_int = EAGAIN;
-
-pub const SCM_RIGHTS: ::c_int = 0x01;
-pub const SCM_CREDENTIALS: ::c_int = 0x02;
-
-// netinet/in.h
-// NOTE: These are in addition to the constants defined in src/unix/mod.rs
-
-// IPPROTO_IP defined in src/unix/mod.rs
-/// Hop-by-hop option header
-pub const IPPROTO_HOPOPTS: ::c_int = 0;
-// IPPROTO_ICMP defined in src/unix/mod.rs
-/// group mgmt protocol
-pub const IPPROTO_IGMP: ::c_int = 2;
-/// for compatibility
-pub const IPPROTO_IPIP: ::c_int = 4;
-// IPPROTO_TCP defined in src/unix/mod.rs
-/// exterior gateway protocol
-pub const IPPROTO_EGP: ::c_int = 8;
-/// pup
-pub const IPPROTO_PUP: ::c_int = 12;
-// IPPROTO_UDP defined in src/unix/mod.rs
-/// xns idp
-pub const IPPROTO_IDP: ::c_int = 22;
-/// tp-4 w/ class negotiation
-pub const IPPROTO_TP: ::c_int = 29;
-/// DCCP
-pub const IPPROTO_DCCP: ::c_int = 33;
-// IPPROTO_IPV6 defined in src/unix/mod.rs
-/// IP6 routing header
-pub const IPPROTO_ROUTING: ::c_int = 43;
-/// IP6 fragmentation header
-pub const IPPROTO_FRAGMENT: ::c_int = 44;
-/// resource reservation
-pub const IPPROTO_RSVP: ::c_int = 46;
-/// General Routing Encap.
-pub const IPPROTO_GRE: ::c_int = 47;
-/// IP6 Encap Sec. Payload
-pub const IPPROTO_ESP: ::c_int = 50;
-/// IP6 Auth Header
-pub const IPPROTO_AH: ::c_int = 51;
-// IPPROTO_ICMPV6 defined in src/unix/mod.rs
-/// IP6 no next header
-pub const IPPROTO_NONE: ::c_int = 59;
-/// IP6 destination option
-pub const IPPROTO_DSTOPTS: ::c_int = 60;
-pub const IPPROTO_MTP: ::c_int = 92;
-pub const IPPROTO_BEETPH: ::c_int = 94;
-/// encapsulation header
-pub const IPPROTO_ENCAP: ::c_int = 98;
-/// Protocol indep. multicast
-pub const IPPROTO_PIM: ::c_int = 103;
-/// IP Payload Comp. Protocol
-pub const IPPROTO_COMP: ::c_int = 108;
-/// SCTP
-pub const IPPROTO_SCTP: ::c_int = 132;
-pub const IPPROTO_MH: ::c_int = 135;
-pub const IPPROTO_UDPLITE: ::c_int = 136;
-pub const IPPROTO_MPLS: ::c_int = 137;
-/// raw IP packet
-pub const IPPROTO_RAW: ::c_int = 255;
-pub const IPPROTO_MAX: ::c_int = 256;
-
-pub const PROT_GROWSDOWN: ::c_int = 0x1000000;
-pub const PROT_GROWSUP: ::c_int = 0x2000000;
-
-pub const MAP_TYPE: ::c_int = 0x000f;
-
-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;
-pub const MADV_REMOVE: ::c_int = 9;
-pub const MADV_DONTFORK: ::c_int = 10;
-pub const MADV_DOFORK: ::c_int = 11;
-pub const MADV_MERGEABLE: ::c_int = 12;
-pub const MADV_UNMERGEABLE: ::c_int = 13;
-pub const MADV_HWPOISON: ::c_int = 100;
-
-// https://github.com/kraj/uClibc/blob/master/include/net/if.h#L44
-pub const IFF_UP: ::c_int = 0x1; // Interface is up.
-pub const IFF_BROADCAST: ::c_int = 0x2; // Broadcast address valid.
-pub const IFF_DEBUG: ::c_int = 0x4; // Turn on debugging.
-pub const IFF_LOOPBACK: ::c_int = 0x8; // Is a loopback net.
-pub const IFF_POINTOPOINT: ::c_int = 0x10; // Interface is point-to-point link.
-pub const IFF_NOTRAILERS: ::c_int = 0x20; // Avoid use of trailers.
-pub const IFF_RUNNING: ::c_int = 0x40; // Resources allocated.
-pub const IFF_NOARP: ::c_int = 0x80; // No address resolution protocol.
-pub const IFF_PROMISC: ::c_int = 0x100; // Receive all packets.
-
-// Not supported
-pub const IFF_ALLMULTI: ::c_int = 0x200; // Receive all multicast packets.
-pub const IFF_MASTER: ::c_int = 0x400; // Master of a load balancer.
-pub const IFF_SLAVE: ::c_int = 0x800; // Slave of a load balancer.
-pub const IFF_MULTICAST: ::c_int = 0x1000; // Supports multicast.
-pub const IFF_PORTSEL: ::c_int = 0x2000; // Can set media type.
-pub const IFF_AUTOMEDIA: ::c_int = 0x4000; // Auto media select active.
-
-// Dialup device with changing addresses.
-pub const IFF_DYNAMIC: ::c_int = 0x8000;
-
-pub const SOL_IP: ::c_int = 0;
-pub const SOL_TCP: ::c_int = 6;
-pub const SOL_IPV6: ::c_int = 41;
-pub const SOL_ICMPV6: ::c_int = 58;
-pub const SOL_RAW: ::c_int = 255;
-pub const SOL_DECNET: ::c_int = 261;
-pub const SOL_X25: ::c_int = 262;
-pub const SOL_PACKET: ::c_int = 263;
-pub const SOL_ATM: ::c_int = 264;
-pub const SOL_AAL: ::c_int = 265;
-pub const SOL_IRDA: ::c_int = 266;
-
-pub const AF_UNSPEC: ::c_int = 0;
-pub const AF_UNIX: ::c_int = 1;
-pub const AF_LOCAL: ::c_int = 1;
-pub const AF_INET: ::c_int = 2;
-pub const AF_AX25: ::c_int = 3;
-pub const AF_IPX: ::c_int = 4;
-pub const AF_APPLETALK: ::c_int = 5;
-pub const AF_NETROM: ::c_int = 6;
-pub const AF_BRIDGE: ::c_int = 7;
-pub const AF_ATMPVC: ::c_int = 8;
-pub const AF_X25: ::c_int = 9;
-pub const AF_INET6: ::c_int = 10;
-pub const AF_ROSE: ::c_int = 11;
-pub const AF_DECnet: ::c_int = 12;
-pub const AF_NETBEUI: ::c_int = 13;
-pub const AF_SECURITY: ::c_int = 14;
-pub const AF_KEY: ::c_int = 15;
-pub const AF_NETLINK: ::c_int = 16;
-pub const AF_ROUTE: ::c_int = AF_NETLINK;
-pub const AF_PACKET: ::c_int = 17;
-pub const AF_ASH: ::c_int = 18;
-pub const AF_ECONET: ::c_int = 19;
-pub const AF_ATMSVC: ::c_int = 20;
-pub const AF_SNA: ::c_int = 22;
-pub const AF_IRDA: ::c_int = 23;
-pub const AF_PPPOX: ::c_int = 24;
-pub const AF_WANPIPE: ::c_int = 25;
-pub const AF_LLC: ::c_int = 26;
-pub const AF_CAN: ::c_int = 29;
-pub const AF_TIPC: ::c_int = 30;
-pub const AF_BLUETOOTH: ::c_int = 31;
-pub const AF_IUCV: ::c_int = 32;
-pub const AF_RXRPC: ::c_int = 33;
-pub const AF_ISDN: ::c_int = 34;
-pub const AF_PHONET: ::c_int = 35;
-pub const AF_IEEE802154: ::c_int = 36;
-pub const AF_CAIF: ::c_int = 37;
-pub const AF_ALG: ::c_int = 38;
-
-pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
-pub const PF_UNIX: ::c_int = AF_UNIX;
-pub const PF_LOCAL: ::c_int = AF_LOCAL;
-pub const PF_INET: ::c_int = AF_INET;
-pub const PF_AX25: ::c_int = AF_AX25;
-pub const PF_IPX: ::c_int = AF_IPX;
-pub const PF_APPLETALK: ::c_int = AF_APPLETALK;
-pub const PF_NETROM: ::c_int = AF_NETROM;
-pub const PF_BRIDGE: ::c_int = AF_BRIDGE;
-pub const PF_ATMPVC: ::c_int = AF_ATMPVC;
-pub const PF_X25: ::c_int = AF_X25;
-pub const PF_INET6: ::c_int = AF_INET6;
-pub const PF_ROSE: ::c_int = AF_ROSE;
-pub const PF_DECnet: ::c_int = AF_DECnet;
-pub const PF_NETBEUI: ::c_int = AF_NETBEUI;
-pub const PF_SECURITY: ::c_int = AF_SECURITY;
-pub const PF_KEY: ::c_int = AF_KEY;
-pub const PF_NETLINK: ::c_int = AF_NETLINK;
-pub const PF_ROUTE: ::c_int = AF_ROUTE;
-pub const PF_PACKET: ::c_int = AF_PACKET;
-pub const PF_ASH: ::c_int = AF_ASH;
-pub const PF_ECONET: ::c_int = AF_ECONET;
-pub const PF_ATMSVC: ::c_int = AF_ATMSVC;
-pub const PF_SNA: ::c_int = AF_SNA;
-pub const PF_IRDA: ::c_int = AF_IRDA;
-pub const PF_PPPOX: ::c_int = AF_PPPOX;
-pub const PF_WANPIPE: ::c_int = AF_WANPIPE;
-pub const PF_LLC: ::c_int = AF_LLC;
-pub const PF_CAN: ::c_int = AF_CAN;
-pub const PF_TIPC: ::c_int = AF_TIPC;
-pub const PF_BLUETOOTH: ::c_int = AF_BLUETOOTH;
-pub const PF_IUCV: ::c_int = AF_IUCV;
-pub const PF_RXRPC: ::c_int = AF_RXRPC;
-pub const PF_ISDN: ::c_int = AF_ISDN;
-pub const PF_PHONET: ::c_int = AF_PHONET;
-pub const PF_IEEE802154: ::c_int = AF_IEEE802154;
-pub const PF_CAIF: ::c_int = AF_CAIF;
-pub const PF_ALG: ::c_int = AF_ALG;
-
-pub const SOMAXCONN: ::c_int = 128;
-
-pub const MSG_OOB: ::c_int = 1;
-pub const MSG_PEEK: ::c_int = 2;
-pub const MSG_DONTROUTE: ::c_int = 4;
-pub const MSG_CTRUNC: ::c_int = 8;
-pub const MSG_TRUNC: ::c_int = 0x20;
-pub const MSG_DONTWAIT: ::c_int = 0x40;
-pub const MSG_EOR: ::c_int = 0x80;
-pub const MSG_WAITALL: ::c_int = 0x100;
-pub const MSG_FIN: ::c_int = 0x200;
-pub const MSG_SYN: ::c_int = 0x400;
-pub const MSG_CONFIRM: ::c_int = 0x800;
-pub const MSG_RST: ::c_int = 0x1000;
-pub const MSG_ERRQUEUE: ::c_int = 0x2000;
-pub const MSG_NOSIGNAL: ::c_int = 0x4000;
-pub const MSG_MORE: ::c_int = 0x8000;
-pub const MSG_WAITFORONE: ::c_int = 0x10000;
-pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
-
-pub const SOCK_RAW: ::c_int = 3;
-pub const IP_MULTICAST_TTL: ::c_int = 33;
-pub const IP_MULTICAST_LOOP: ::c_int = 34;
-pub const IP_TTL: ::c_int = 2;
-pub const IP_HDRINCL: ::c_int = 3;
-pub const IP_ADD_MEMBERSHIP: ::c_int = 35;
-pub const IP_DROP_MEMBERSHIP: ::c_int = 36;
-pub const IPV6_ADD_MEMBERSHIP: ::c_int = 20;
-pub const IPV6_DROP_MEMBERSHIP: ::c_int = 21;
-
-pub const IPV6_JOIN_GROUP: ::c_int = 20;
-pub const IPV6_LEAVE_GROUP: ::c_int = 21;
-
-pub const TCP_NODELAY: ::c_int = 1;
-pub const TCP_MAXSEG: ::c_int = 2;
-pub const TCP_CORK: ::c_int = 3;
-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;
-
-// Source:
-// https://github.com/kraj/uClibc/blob/ca1c74d67dd115d059a875150e10b8560a9c35a8
-// /libc/sysdeps/linux/common/bits/in.h
-// Same for all architectures
-pub const IPV6_MULTICAST_HOPS: ::c_int = 18;
-pub const IP_MULTICAST_IF: ::c_int = 32;
-pub const IPV6_MULTICAST_IF: ::c_int = 17;
-pub const IPV6_UNICAST_HOPS: ::c_int = 16;
-
-// Source:
-// https://github.com/kraj/uClibc/tree/ca1c74d67dd115d059a875150e10b8560a9c35a8
-// Same for all architectures
-pub const FUTEX_WAIT: ::c_int = 0;
-pub const FUTEX_PRIVATE_FLAG: ::c_int = 128;
-pub const FUTEX_WAKE: ::c_int = 1;
-
-pub const IPV6_MULTICAST_LOOP: ::c_int = 19;
-pub const IPV6_V6ONLY: ::c_int = 26;
-
-pub const SO_DEBUG: ::c_int = 1;
-
-pub const SHUT_RD: ::c_int = 0;
-pub const SHUT_WR: ::c_int = 1;
-pub const SHUT_RDWR: ::c_int = 2;
-
-pub const LOCK_SH: ::c_int = 1;
-pub const LOCK_EX: ::c_int = 2;
-pub const LOCK_NB: ::c_int = 4;
-pub const LOCK_UN: ::c_int = 8;
-
-pub const SS_ONSTACK: ::c_int = 1;
-pub const SS_DISABLE: ::c_int = 2;
-
-pub const PATH_MAX: ::c_int = 4096;
-
-pub const FD_SETSIZE: usize = 1024;
-
-pub const EPOLLIN: ::c_int = 0x1;
-pub const EPOLLPRI: ::c_int = 0x2;
-pub const EPOLLOUT: ::c_int = 0x4;
-pub const EPOLLRDNORM: ::c_int = 0x40;
-pub const EPOLLRDBAND: ::c_int = 0x80;
-pub const EPOLLWRNORM: ::c_int = 0x100;
-pub const EPOLLWRBAND: ::c_int = 0x200;
-pub const EPOLLMSG: ::c_int = 0x400;
-pub const EPOLLERR: ::c_int = 0x8;
-pub const EPOLLHUP: ::c_int = 0x10;
-pub const EPOLLET: ::c_int = 0x80000000;
-
-pub const EPOLL_CTL_ADD: ::c_int = 1;
-pub const EPOLL_CTL_MOD: ::c_int = 3;
-pub const EPOLL_CTL_DEL: ::c_int = 2;
-
-pub const MNT_DETACH: ::c_int = 0x2;
-pub const MNT_EXPIRE: ::c_int = 0x4;
-
-pub const MNT_FORCE: ::c_int = 0x1;
-
-pub const Q_SYNC: ::c_int = 0x600;
-pub const Q_QUOTAON: ::c_int = 0x100;
-pub const Q_QUOTAOFF: ::c_int = 0x200;
-pub const Q_GETQUOTA: ::c_int = 0x300;
-pub const Q_SETQUOTA: ::c_int = 0x400;
-
-pub const TCIOFF: ::c_int = 2;
-pub const TCION: ::c_int = 3;
-pub const TCOOFF: ::c_int = 0;
-pub const TCOON: ::c_int = 1;
-pub const TCIFLUSH: ::c_int = 0;
-pub const TCOFLUSH: ::c_int = 1;
-pub const TCIOFLUSH: ::c_int = 2;
-pub const NL0: ::tcflag_t = 0x00000000;
-pub const NL1: ::tcflag_t = 0x00000100;
-pub const TAB0: ::tcflag_t = 0x00000000;
-pub const CR0: ::tcflag_t = 0x00000000;
-pub const FF0: ::tcflag_t = 0x00000000;
-pub const BS0: ::tcflag_t = 0x00000000;
-pub const VT0: ::tcflag_t = 0x00000000;
-pub const VERASE: usize = 2;
-pub const VKILL: usize = 3;
-pub const VINTR: usize = 0;
-pub const VQUIT: usize = 1;
-pub const VLNEXT: usize = 15;
-pub const IGNBRK: ::tcflag_t = 0x00000001;
-pub const BRKINT: ::tcflag_t = 0x00000002;
-pub const IGNPAR: ::tcflag_t = 0x00000004;
-pub const PARMRK: ::tcflag_t = 0x00000008;
-pub const INPCK: ::tcflag_t = 0x00000010;
-pub const ISTRIP: ::tcflag_t = 0x00000020;
-pub const INLCR: ::tcflag_t = 0x00000040;
-pub const IGNCR: ::tcflag_t = 0x00000080;
-pub const ICRNL: ::tcflag_t = 0x00000100;
-pub const IXANY: ::tcflag_t = 0x00000800;
-pub const IMAXBEL: ::tcflag_t = 0x00002000;
-pub const OPOST: ::tcflag_t = 0x1;
-pub const CS5: ::tcflag_t = 0x00000000;
-pub const CRTSCTS: ::tcflag_t = 0x80000000;
-pub const ECHO: ::tcflag_t = 0x00000008;
-
-pub const CLONE_VM: ::c_int = 0x100;
-pub const CLONE_FS: ::c_int = 0x200;
-pub const CLONE_FILES: ::c_int = 0x400;
-pub const CLONE_SIGHAND: ::c_int = 0x800;
-pub const CLONE_PTRACE: ::c_int = 0x2000;
-pub const CLONE_VFORK: ::c_int = 0x4000;
-pub const CLONE_PARENT: ::c_int = 0x8000;
-pub const CLONE_THREAD: ::c_int = 0x10000;
-pub const CLONE_NEWNS: ::c_int = 0x20000;
-pub const CLONE_SYSVSEM: ::c_int = 0x40000;
-pub const CLONE_SETTLS: ::c_int = 0x80000;
-pub const CLONE_PARENT_SETTID: ::c_int = 0x100000;
-pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000;
-pub const CLONE_DETACHED: ::c_int = 0x400000;
-pub const CLONE_UNTRACED: ::c_int = 0x800000;
-pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000;
-pub const CLONE_NEWUTS: ::c_int = 0x04000000;
-pub const CLONE_NEWIPC: ::c_int = 0x08000000;
-pub const CLONE_NEWUSER: ::c_int = 0x10000000;
-pub const CLONE_NEWPID: ::c_int = 0x20000000;
-pub const CLONE_NEWNET: ::c_int = 0x40000000;
-pub const CLONE_IO: ::c_int = 0x80000000;
-
-pub const WNOHANG: ::c_int = 0x00000001;
-pub const WUNTRACED: ::c_int = 0x00000002;
-pub const WSTOPPED: ::c_int = WUNTRACED;
-pub const WEXITED: ::c_int = 0x00000004;
-pub const WCONTINUED: ::c_int = 0x00000008;
-pub const WNOWAIT: ::c_int = 0x01000000;
-
-pub const __WNOTHREAD: ::c_int = 0x20000000;
-pub const __WALL: ::c_int = 0x40000000;
-pub const __WCLONE: ::c_int = 0x80000000;
-
-pub const SPLICE_F_MOVE: ::c_uint = 0x01;
-pub const SPLICE_F_NONBLOCK: ::c_uint = 0x02;
-pub const SPLICE_F_MORE: ::c_uint = 0x04;
-pub const SPLICE_F_GIFT: ::c_uint = 0x08;
-
-pub const RTLD_LOCAL: ::c_int = 0;
-pub const RTLD_LAZY: ::c_int = 1;
-
-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 AT_FDCWD: ::c_int = -100;
-pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100;
-pub const AT_REMOVEDIR: ::c_int = 0x200;
-pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
-
-pub const LOG_CRON: ::c_int = 9 << 3;
-pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
-pub const LOG_FTP: ::c_int = 11 << 3;
-pub const LOG_PERROR: ::c_int = 0x20;
-
-pub const 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 PIPE_BUF: usize = 4096;
-
-pub const SI_LOAD_SHIFT: ::c_uint = 16;
-
-pub const SIGEV_SIGNAL: ::c_int = 0;
-pub const SIGEV_NONE: ::c_int = 1;
-pub const SIGEV_THREAD: ::c_int = 2;
-
-pub const P_ALL: idtype_t = 0;
-pub const P_PID: idtype_t = 1;
-pub const P_PGID: idtype_t = 2;
-
-pub const UTIME_OMIT: c_long = 1073741822;
-pub const UTIME_NOW: c_long = 1073741823;
-
-pub const L_tmpnam: ::c_uint = 20;
-pub const _PC_LINK_MAX: ::c_int = 0;
-pub const _PC_MAX_CANON: ::c_int = 1;
-pub const _PC_MAX_INPUT: ::c_int = 2;
-pub const _PC_NAME_MAX: ::c_int = 3;
-pub const _PC_PATH_MAX: ::c_int = 4;
-pub const _PC_PIPE_BUF: ::c_int = 5;
-pub const _PC_CHOWN_RESTRICTED: ::c_int = 6;
-pub const _PC_NO_TRUNC: ::c_int = 7;
-pub const _PC_VDISABLE: ::c_int = 8;
-
-pub const _SC_ARG_MAX: ::c_int = 0;
-pub const _SC_CHILD_MAX: ::c_int = 1;
-pub const _SC_CLK_TCK: ::c_int = 2;
-pub const _SC_NGROUPS_MAX: ::c_int = 3;
-pub const _SC_OPEN_MAX: ::c_int = 4;
-pub const _SC_STREAM_MAX: ::c_int = 5;
-pub const _SC_TZNAME_MAX: ::c_int = 6;
-pub const _SC_JOB_CONTROL: ::c_int = 7;
-pub const _SC_SAVED_IDS: ::c_int = 8;
-pub const _SC_REALTIME_SIGNALS: ::c_int = 9;
-pub const _SC_PRIORITY_SCHEDULING: ::c_int = 10;
-pub const _SC_TIMERS: ::c_int = 11;
-pub const _SC_ASYNCHRONOUS_IO: ::c_int = 12;
-pub const _SC_PRIORITIZED_IO: ::c_int = 13;
-pub const _SC_SYNCHRONIZED_IO: ::c_int = 14;
-pub const _SC_FSYNC: ::c_int = 15;
-pub const _SC_MAPPED_FILES: ::c_int = 16;
-pub const _SC_MEMLOCK: ::c_int = 17;
-pub const _SC_MEMLOCK_RANGE: ::c_int = 18;
-pub const _SC_MEMORY_PROTECTION: ::c_int = 19;
-pub const _SC_MESSAGE_PASSING: ::c_int = 20;
-pub const _SC_SEMAPHORES: ::c_int = 21;
-pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 22;
-pub const _SC_AIO_LISTIO_MAX: ::c_int = 23;
-pub const _SC_AIO_MAX: ::c_int = 24;
-pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 25;
-pub const _SC_DELAYTIMER_MAX: ::c_int = 26;
-pub const _SC_MQ_OPEN_MAX: ::c_int = 27;
-pub const _SC_MQ_PRIO_MAX: ::c_int = 28;
-pub const _SC_VERSION: ::c_int = 29;
-pub const _SC_PAGESIZE: ::c_int = 30;
-pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
-pub const _SC_RTSIG_MAX: ::c_int = 31;
-pub const _SC_SEM_NSEMS_MAX: ::c_int = 32;
-pub const _SC_SEM_VALUE_MAX: ::c_int = 33;
-pub const _SC_SIGQUEUE_MAX: ::c_int = 34;
-pub const _SC_TIMER_MAX: ::c_int = 35;
-pub const _SC_BC_BASE_MAX: ::c_int = 36;
-pub const _SC_BC_DIM_MAX: ::c_int = 37;
-pub const _SC_BC_SCALE_MAX: ::c_int = 38;
-pub const _SC_BC_STRING_MAX: ::c_int = 39;
-pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 40;
-pub const _SC_EXPR_NEST_MAX: ::c_int = 42;
-pub const _SC_LINE_MAX: ::c_int = 43;
-pub const _SC_RE_DUP_MAX: ::c_int = 44;
-pub const _SC_2_VERSION: ::c_int = 46;
-pub const _SC_2_C_BIND: ::c_int = 47;
-pub const _SC_2_C_DEV: ::c_int = 48;
-pub const _SC_2_FORT_DEV: ::c_int = 49;
-pub const _SC_2_FORT_RUN: ::c_int = 50;
-pub const _SC_2_SW_DEV: ::c_int = 51;
-pub const _SC_2_LOCALEDEF: ::c_int = 52;
-pub const _SC_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_NPROCESSORS_ONLN: ::c_int = 84;
-pub const _SC_ATEXIT_MAX: ::c_int = 87;
-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_XBS5_ILP32_OFF32: ::c_int = 125;
-pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 126;
-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_HOST_NAME_MAX: ::c_int = 180;
-
-pub const RLIM_SAVED_MAX: ::rlim_t = RLIM_INFINITY;
-pub const RLIM_SAVED_CUR: ::rlim_t = RLIM_INFINITY;
-
-pub const GLOB_ERR: ::c_int = 1 << 0;
-pub const GLOB_MARK: ::c_int = 1 << 1;
-pub const GLOB_NOSORT: ::c_int = 1 << 2;
-pub const GLOB_DOOFFS: ::c_int = 1 << 3;
-pub const GLOB_NOCHECK: ::c_int = 1 << 4;
-pub const GLOB_APPEND: ::c_int = 1 << 5;
-pub const GLOB_NOESCAPE: ::c_int = 1 << 6;
-
-pub const GLOB_NOSPACE: ::c_int = 1;
-pub const GLOB_ABORTED: ::c_int = 2;
-pub const GLOB_NOMATCH: ::c_int = 3;
-
-pub const POSIX_MADV_NORMAL: ::c_int = 0;
-pub const POSIX_MADV_RANDOM: ::c_int = 1;
-pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
-pub const POSIX_MADV_WILLNEED: ::c_int = 3;
-
-pub const S_IEXEC: mode_t = 64;
-pub const S_IWRITE: mode_t = 128;
-pub const S_IREAD: mode_t = 256;
-
-pub const F_LOCK: ::c_int = 1;
-pub const F_TEST: ::c_int = 3;
-pub const F_TLOCK: ::c_int = 2;
-pub const F_ULOCK: ::c_int = 0;
-
-pub const ST_RDONLY: ::c_ulong = 1;
-pub const ST_NOSUID: ::c_ulong = 2;
-pub const ST_NODEV: ::c_ulong = 4;
-pub const ST_NOEXEC: ::c_ulong = 8;
-pub const ST_SYNCHRONOUS: ::c_ulong = 16;
-pub const ST_MANDLOCK: ::c_ulong = 64;
-pub const ST_WRITE: ::c_ulong = 128;
-pub const ST_APPEND: ::c_ulong = 256;
-pub const ST_IMMUTABLE: ::c_ulong = 512;
-pub const ST_NOATIME: ::c_ulong = 1024;
-pub const ST_NODIRATIME: ::c_ulong = 2048;
-
-pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void;
-pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
-pub const RTLD_NODELETE: ::c_int = 0x1000;
-pub const RTLD_NOW: ::c_int = 0x2;
-
-pub const TCP_MD5SIG: ::c_int = 14;
-
-align_const! {
- pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
- size: [0; __SIZEOF_PTHREAD_MUTEX_T],
- };
- pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
- size: [0; __SIZEOF_PTHREAD_COND_T],
- };
- pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
- size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
- };
-}
-pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
-pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1;
-pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2;
-pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL;
-pub const __SIZEOF_PTHREAD_COND_T: usize = 48;
-
-pub const SCHED_OTHER: ::c_int = 0;
-pub const SCHED_FIFO: ::c_int = 1;
-pub const SCHED_RR: ::c_int = 2;
-pub const SCHED_BATCH: ::c_int = 3;
-pub const SCHED_IDLE: ::c_int = 5;
-
-// System V IPC
-pub const IPC_PRIVATE: ::key_t = 0;
-
-pub const IPC_CREAT: ::c_int = 0o1000;
-pub const IPC_EXCL: ::c_int = 0o2000;
-pub const IPC_NOWAIT: ::c_int = 0o4000;
-
-pub const IPC_RMID: ::c_int = 0;
-pub const IPC_SET: ::c_int = 1;
-pub const IPC_STAT: ::c_int = 2;
-pub const IPC_INFO: ::c_int = 3;
-pub const MSG_STAT: ::c_int = 11;
-pub const MSG_INFO: ::c_int = 12;
-
-pub const MSG_NOERROR: ::c_int = 0o10000;
-pub const MSG_EXCEPT: ::c_int = 0o20000;
-
-pub const SHM_R: ::c_int = 0o400;
-pub const SHM_W: ::c_int = 0o200;
-
-pub const SHM_RDONLY: ::c_int = 0o10000;
-pub const SHM_RND: ::c_int = 0o20000;
-pub const SHM_REMAP: ::c_int = 0o40000;
-
-pub const SHM_LOCK: ::c_int = 11;
-pub const SHM_UNLOCK: ::c_int = 12;
-
-pub const SHM_HUGETLB: ::c_int = 0o4000;
-pub const SHM_NORESERVE: ::c_int = 0o10000;
-
-pub const EPOLLRDHUP: ::c_int = 0x2000;
-pub const EPOLLONESHOT: ::c_int = 0x40000000;
-
-pub const QFMT_VFS_OLD: ::c_int = 1;
-pub const QFMT_VFS_V0: ::c_int = 2;
-
-pub const EFD_SEMAPHORE: ::c_int = 0x1;
-
-pub const LOG_NFACILITIES: ::c_int = 24;
-
-pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t;
-
-pub const RB_AUTOBOOT: ::c_int = 0x01234567u32 as i32;
-pub const RB_HALT_SYSTEM: ::c_int = 0xcdef0123u32 as i32;
-pub const RB_ENABLE_CAD: ::c_int = 0x89abcdefu32 as i32;
-pub const RB_DISABLE_CAD: ::c_int = 0x00000000u32 as i32;
-pub const RB_POWER_OFF: ::c_int = 0x4321fedcu32 as i32;
-
-pub const AI_PASSIVE: ::c_int = 0x0001;
-pub const AI_CANONNAME: ::c_int = 0x0002;
-pub const AI_NUMERICHOST: ::c_int = 0x0004;
-pub const AI_V4MAPPED: ::c_int = 0x0008;
-pub const AI_ALL: ::c_int = 0x0010;
-pub const AI_ADDRCONFIG: ::c_int = 0x0020;
-
-pub const AI_NUMERICSERV: ::c_int = 0x0400;
-
-pub const EAI_BADFLAGS: ::c_int = -1;
-pub const EAI_NONAME: ::c_int = -2;
-pub const EAI_AGAIN: ::c_int = -3;
-pub const EAI_FAIL: ::c_int = -4;
-pub const EAI_FAMILY: ::c_int = -6;
-pub const EAI_SOCKTYPE: ::c_int = -7;
-pub const EAI_SERVICE: ::c_int = -8;
-pub const EAI_MEMORY: ::c_int = -10;
-pub const EAI_OVERFLOW: ::c_int = -12;
-
-pub const NI_NUMERICHOST: ::c_int = 1;
-pub const NI_NUMERICSERV: ::c_int = 2;
-pub const NI_NOFQDN: ::c_int = 4;
-pub const NI_NAMEREQD: ::c_int = 8;
-pub const NI_DGRAM: ::c_int = 16;
-
-pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1;
-pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2;
-pub const SYNC_FILE_RANGE_WAIT_AFTER: ::c_uint = 4;
-
-pub const EAI_SYSTEM: ::c_int = -11;
-
-pub const MREMAP_MAYMOVE: ::c_int = 1;
-pub const MREMAP_FIXED: ::c_int = 2;
-
-pub const PR_SET_PDEATHSIG: ::c_int = 1;
-pub const PR_GET_PDEATHSIG: ::c_int = 2;
-
-pub const PR_GET_DUMPABLE: ::c_int = 3;
-pub const PR_SET_DUMPABLE: ::c_int = 4;
-
-pub const PR_GET_UNALIGN: ::c_int = 5;
-pub const PR_SET_UNALIGN: ::c_int = 6;
-pub const PR_UNALIGN_NOPRINT: ::c_int = 1;
-pub const PR_UNALIGN_SIGBUS: ::c_int = 2;
-
-pub const PR_GET_KEEPCAPS: ::c_int = 7;
-pub const PR_SET_KEEPCAPS: ::c_int = 8;
-
-pub const PR_GET_FPEMU: ::c_int = 9;
-pub const PR_SET_FPEMU: ::c_int = 10;
-pub const PR_FPEMU_NOPRINT: ::c_int = 1;
-pub const PR_FPEMU_SIGFPE: ::c_int = 2;
-
-pub const PR_GET_FPEXC: ::c_int = 11;
-pub const PR_SET_FPEXC: ::c_int = 12;
-pub const PR_FP_EXC_SW_ENABLE: ::c_int = 0x80;
-pub const PR_FP_EXC_DIV: ::c_int = 0x010000;
-pub const PR_FP_EXC_OVF: ::c_int = 0x020000;
-pub const PR_FP_EXC_UND: ::c_int = 0x040000;
-pub const PR_FP_EXC_RES: ::c_int = 0x080000;
-pub const PR_FP_EXC_INV: ::c_int = 0x100000;
-pub const PR_FP_EXC_DISABLED: ::c_int = 0;
-pub const PR_FP_EXC_NONRECOV: ::c_int = 1;
-pub const PR_FP_EXC_ASYNC: ::c_int = 2;
-pub const PR_FP_EXC_PRECISE: ::c_int = 3;
-
-pub const PR_GET_TIMING: ::c_int = 13;
-pub const PR_SET_TIMING: ::c_int = 14;
-pub const PR_TIMING_STATISTICAL: ::c_int = 0;
-pub const PR_TIMING_TIMESTAMP: ::c_int = 1;
-
-pub const PR_SET_NAME: ::c_int = 15;
-pub const PR_GET_NAME: ::c_int = 16;
-
-pub const PR_GET_ENDIAN: ::c_int = 19;
-pub const PR_SET_ENDIAN: ::c_int = 20;
-pub const PR_ENDIAN_BIG: ::c_int = 0;
-pub const PR_ENDIAN_LITTLE: ::c_int = 1;
-pub const PR_ENDIAN_PPC_LITTLE: ::c_int = 2;
-
-pub const PR_GET_SECCOMP: ::c_int = 21;
-pub const PR_SET_SECCOMP: ::c_int = 22;
-
-pub const PR_CAPBSET_READ: ::c_int = 23;
-pub const PR_CAPBSET_DROP: ::c_int = 24;
-
-pub const PR_GET_TSC: ::c_int = 25;
-pub const PR_SET_TSC: ::c_int = 26;
-pub const PR_TSC_ENABLE: ::c_int = 1;
-pub const PR_TSC_SIGSEGV: ::c_int = 2;
-
-pub const PR_GET_SECUREBITS: ::c_int = 27;
-pub const PR_SET_SECUREBITS: ::c_int = 28;
-
-pub const PR_SET_TIMERSLACK: ::c_int = 29;
-pub const PR_GET_TIMERSLACK: ::c_int = 30;
-
-pub const PR_TASK_PERF_EVENTS_DISABLE: ::c_int = 31;
-pub const PR_TASK_PERF_EVENTS_ENABLE: ::c_int = 32;
-
-pub const PR_MCE_KILL: ::c_int = 33;
-pub const PR_MCE_KILL_CLEAR: ::c_int = 0;
-pub const PR_MCE_KILL_SET: ::c_int = 1;
-
-pub const PR_MCE_KILL_LATE: ::c_int = 0;
-pub const PR_MCE_KILL_EARLY: ::c_int = 1;
-pub const PR_MCE_KILL_DEFAULT: ::c_int = 2;
-
-pub const PR_MCE_KILL_GET: ::c_int = 34;
-
-pub const PR_SET_MM: ::c_int = 35;
-pub const PR_SET_MM_START_CODE: ::c_int = 1;
-pub const PR_SET_MM_END_CODE: ::c_int = 2;
-pub const PR_SET_MM_START_DATA: ::c_int = 3;
-pub const PR_SET_MM_END_DATA: ::c_int = 4;
-pub const PR_SET_MM_START_STACK: ::c_int = 5;
-pub const PR_SET_MM_START_BRK: ::c_int = 6;
-pub const PR_SET_MM_BRK: ::c_int = 7;
-pub const PR_SET_MM_ARG_START: ::c_int = 8;
-pub const PR_SET_MM_ARG_END: ::c_int = 9;
-pub const PR_SET_MM_ENV_START: ::c_int = 10;
-pub const PR_SET_MM_ENV_END: ::c_int = 11;
-pub const PR_SET_MM_AUXV: ::c_int = 12;
-pub const PR_SET_MM_EXE_FILE: ::c_int = 13;
-pub const PR_SET_MM_MAP: ::c_int = 14;
-pub const PR_SET_MM_MAP_SIZE: ::c_int = 15;
-
-pub const PR_SET_PTRACER: ::c_int = 0x59616d61;
-
-pub const PR_SET_CHILD_SUBREAPER: ::c_int = 36;
-pub const PR_GET_CHILD_SUBREAPER: ::c_int = 37;
-
-pub const PR_SET_NO_NEW_PRIVS: ::c_int = 38;
-pub const PR_GET_NO_NEW_PRIVS: ::c_int = 39;
-
-pub const PR_GET_TID_ADDRESS: ::c_int = 40;
-
-pub const PR_SET_THP_DISABLE: ::c_int = 41;
-pub const PR_GET_THP_DISABLE: ::c_int = 42;
-
-pub const GRND_NONBLOCK: ::c_uint = 0x0001;
-pub const GRND_RANDOM: ::c_uint = 0x0002;
-
-pub const ABDAY_1: ::nl_item = 0x300;
-pub const ABDAY_2: ::nl_item = 0x301;
-pub const ABDAY_3: ::nl_item = 0x302;
-pub const ABDAY_4: ::nl_item = 0x303;
-pub const ABDAY_5: ::nl_item = 0x304;
-pub const ABDAY_6: ::nl_item = 0x305;
-pub const ABDAY_7: ::nl_item = 0x306;
-
-pub const DAY_1: ::nl_item = 0x307;
-pub const DAY_2: ::nl_item = 0x308;
-pub const DAY_3: ::nl_item = 0x309;
-pub const DAY_4: ::nl_item = 0x30A;
-pub const DAY_5: ::nl_item = 0x30B;
-pub const DAY_6: ::nl_item = 0x30C;
-pub const DAY_7: ::nl_item = 0x30D;
-
-pub const ABMON_1: ::nl_item = 0x30E;
-pub const ABMON_2: ::nl_item = 0x30F;
-pub const ABMON_3: ::nl_item = 0x310;
-pub const ABMON_4: ::nl_item = 0x311;
-pub const ABMON_5: ::nl_item = 0x312;
-pub const ABMON_6: ::nl_item = 0x313;
-pub const ABMON_7: ::nl_item = 0x314;
-pub const ABMON_8: ::nl_item = 0x315;
-pub const ABMON_9: ::nl_item = 0x316;
-pub const ABMON_10: ::nl_item = 0x317;
-pub const ABMON_11: ::nl_item = 0x318;
-pub const ABMON_12: ::nl_item = 0x319;
-
-pub const MON_1: ::nl_item = 0x31A;
-pub const MON_2: ::nl_item = 0x31B;
-pub const MON_3: ::nl_item = 0x31C;
-pub const MON_4: ::nl_item = 0x31D;
-pub const MON_5: ::nl_item = 0x31E;
-pub const MON_6: ::nl_item = 0x31F;
-pub const MON_7: ::nl_item = 0x320;
-pub const MON_8: ::nl_item = 0x321;
-pub const MON_9: ::nl_item = 0x322;
-pub const MON_10: ::nl_item = 0x323;
-pub const MON_11: ::nl_item = 0x324;
-pub const MON_12: ::nl_item = 0x325;
-
-pub const AM_STR: ::nl_item = 0x326;
-pub const PM_STR: ::nl_item = 0x327;
-
-pub const D_T_FMT: ::nl_item = 0x328;
-pub const D_FMT: ::nl_item = 0x329;
-pub const T_FMT: ::nl_item = 0x32A;
-pub const T_FMT_AMPM: ::nl_item = 0x32B;
-
-pub const ERA: ::nl_item = 0x32C;
-pub const ERA_D_FMT: ::nl_item = 0x32E;
-pub const ALT_DIGITS: ::nl_item = 0x32F;
-pub const ERA_D_T_FMT: ::nl_item = 0x330;
-pub const ERA_T_FMT: ::nl_item = 0x331;
-
-pub const CODESET: ::nl_item = 10;
-
-pub const CRNCYSTR: ::nl_item = 0x215;
-
-pub const RADIXCHAR: ::nl_item = 0x100;
-pub const THOUSEP: ::nl_item = 0x101;
-
-pub const NOEXPR: ::nl_item = 0x501;
-pub const YESSTR: ::nl_item = 0x502;
-pub const NOSTR: ::nl_item = 0x503;
-
-pub const FILENAME_MAX: ::c_uint = 4095;
-
-f! {
- pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
- let fd = fd as usize;
- let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
- (*set).fds_bits[fd / size] &= !(1 << (fd % size));
- return
- }
-
- pub fn FD_ISSET(fd: ::c_int, set: *mut fd_set) -> bool {
- let fd = fd as usize;
- let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
- return ((*set).fds_bits[fd / size] & (1 << (fd % size))) != 0
- }
-
- pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
- let fd = fd as usize;
- let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
- (*set).fds_bits[fd / size] |= 1 << (fd % size);
- return
- }
-
- pub fn FD_ZERO(set: *mut fd_set) -> () {
- for slot in (*set).fds_bits.iter_mut() {
- *slot = 0;
- }
- }
-
- pub fn WIFSTOPPED(status: ::c_int) -> bool {
- (status & 0xff) == 0x7f
- }
-
- pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
- (status >> 8) & 0xff
- }
-
- pub fn WIFCONTINUED(status: ::c_int) -> bool {
- status == 0xffff
- }
-
- pub fn WIFSIGNALED(status: ::c_int) -> bool {
- ((status & 0x7f) + 1) as i8 >= 2
- }
-
- pub fn WTERMSIG(status: ::c_int) -> ::c_int {
- status & 0x7f
- }
-
- pub fn WIFEXITED(status: ::c_int) -> bool {
- (status & 0x7f) == 0
- }
-
- pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
- (status >> 8) & 0xff
- }
-
- pub fn WCOREDUMP(status: ::c_int) -> bool {
- (status & 0x80) != 0
- }
-
- pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
- for slot in cpuset.bits.iter_mut() {
- *slot = 0;
- }
- }
-
- pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
- let size_in_bits
- = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
- let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
- cpuset.bits[idx] |= 1 << offset;
- ()
- }
-
- pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
- let size_in_bits
- = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
- let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
- cpuset.bits[idx] &= !(1 << offset);
- ()
- }
-
- pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
- let size_in_bits = 8 * ::mem::size_of_val(&cpuset.bits[0]);
- let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
- 0 != (cpuset.bits[idx] & (1 << offset))
- }
-
- pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
- set1.bits == set2.bits
- }
-
- pub fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
- (cmd << 8) | (type_ & 0x00ff)
- }
-}
-
-extern "C" {
- #[cfg_attr(target_os = "linux", link_name = "__xpg_strerror_r")]
- 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 atof(s: *const ::c_char) -> ::c_double;
- pub fn labs(i: ::c_long) -> ::c_long;
- pub fn rand() -> ::c_int;
- pub fn srand(seed: ::c_uint);
-
- pub fn fdatasync(fd: ::c_int) -> ::c_int;
- pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
- pub fn mincore(
- addr: *mut ::c_void,
- len: ::size_t,
- vec: *mut ::c_uchar,
- ) -> ::c_int;
- pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
- pub fn clock_nanosleep(
- clk_id: ::clockid_t,
- flags: ::c_int,
- rqtp: *const ::timespec,
- rmtp: *mut ::timespec,
- ) -> ::c_int;
- pub fn clock_settime(
- clk_id: ::clockid_t,
- tp: *const ::timespec,
- ) -> ::c_int;
- pub fn prctl(option: ::c_int, ...) -> ::c_int;
- pub fn pthread_getattr_np(
- native: ::pthread_t,
- attr: *mut ::pthread_attr_t,
- ) -> ::c_int;
- pub fn pthread_attr_getguardsize(
- attr: *const ::pthread_attr_t,
- guardsize: *mut ::size_t,
- ) -> ::c_int;
- pub fn pthread_attr_getstack(
- attr: *const ::pthread_attr_t,
- stackaddr: *mut *mut ::c_void,
- stacksize: *mut ::size_t,
- ) -> ::c_int;
- pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
- pub fn setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int;
- pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
- pub fn sched_setscheduler(
- pid: ::pid_t,
- policy: ::c_int,
- param: *const ::sched_param,
- ) -> ::c_int;
- pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
- pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
- pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
- pub fn epoll_create(size: ::c_int) -> ::c_int;
- pub fn epoll_create1(flags: ::c_int) -> ::c_int;
- pub fn epoll_ctl(
- epfd: ::c_int,
- op: ::c_int,
- fd: ::c_int,
- event: *mut ::epoll_event,
- ) -> ::c_int;
- pub fn epoll_wait(
- epfd: ::c_int,
- events: *mut ::epoll_event,
- maxevents: ::c_int,
- timeout: ::c_int,
- ) -> ::c_int;
- pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
- pub fn mount(
- src: *const ::c_char,
- target: *const ::c_char,
- fstype: *const ::c_char,
- flags: ::c_ulong,
- data: *const ::c_void,
- ) -> ::c_int;
- pub fn umount(target: *const ::c_char) -> ::c_int;
- pub fn umount2(target: *const ::c_char, flags: ::c_int) -> ::c_int;
- pub fn clone(
- cb: extern "C" fn(*mut ::c_void) -> ::c_int,
- child_stack: *mut ::c_void,
- flags: ::c_int,
- arg: *mut ::c_void,
- ...
- ) -> ::c_int;
- pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
- pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
- pub fn memrchr(
- cx: *const ::c_void,
- c: ::c_int,
- n: ::size_t,
- ) -> *mut ::c_void;
- pub fn syscall(num: ::c_long, ...) -> ::c_long;
- pub fn sendfile(
- out_fd: ::c_int,
- in_fd: ::c_int,
- offset: *mut off_t,
- count: ::size_t,
- ) -> ::ssize_t;
- pub fn splice(
- fd_in: ::c_int,
- off_in: *mut ::loff_t,
- fd_out: ::c_int,
- off_out: *mut ::loff_t,
- len: ::size_t,
- flags: ::c_uint,
- ) -> ::ssize_t;
- pub fn tee(
- fd_in: ::c_int,
- fd_out: ::c_int,
- len: ::size_t,
- flags: ::c_uint,
- ) -> ::ssize_t;
- pub fn vmsplice(
- fd: ::c_int,
- iov: *const ::iovec,
- nr_segs: ::size_t,
- flags: ::c_uint,
- ) -> ::ssize_t;
-
- pub fn posix_fadvise(
- fd: ::c_int,
- offset: ::off_t,
- len: ::off_t,
- advise: ::c_int,
- ) -> ::c_int;
- pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
- pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::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 duplocale(base: ::locale_t) -> ::locale_t;
- pub fn freelocale(loc: ::locale_t);
- pub fn newlocale(
- mask: ::c_int,
- locale: *const ::c_char,
- base: ::locale_t,
- ) -> ::locale_t;
- pub fn uselocale(loc: ::locale_t) -> ::locale_t;
- pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int;
- pub fn fstat64(fildes: ::c_int, buf: *mut stat64) -> ::c_int;
- pub fn fstatat64(
- fildes: ::c_int,
- path: *const ::c_char,
- buf: *mut stat64,
- flag: ::c_int,
- ) -> ::c_int;
- pub fn ftruncate64(fd: ::c_int, length: off64_t) -> ::c_int;
- pub fn getrlimit64(resource: ::c_int, rlim: *mut rlimit64) -> ::c_int;
- pub fn lseek64(fd: ::c_int, offset: off64_t, whence: ::c_int) -> off64_t;
- pub fn lstat64(path: *const c_char, buf: *mut stat64) -> ::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 open64(path: *const c_char, oflag: ::c_int, ...) -> ::c_int;
- pub fn openat64(
- fd: ::c_int,
- path: *const c_char,
- oflag: ::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 readdir64(dirp: *mut ::DIR) -> *mut ::dirent64;
- pub fn readdir64_r(
- dirp: *mut ::DIR,
- entry: *mut ::dirent64,
- result: *mut *mut ::dirent64,
- ) -> ::c_int;
- pub fn setrlimit64(resource: ::c_int, rlim: *const rlimit64) -> ::c_int;
- pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int;
- pub fn truncate64(path: *const c_char, length: off64_t) -> ::c_int;
- pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int;
-
- pub fn mknodat(
- dirfd: ::c_int,
- pathname: *const ::c_char,
- mode: ::mode_t,
- dev: dev_t,
- ) -> ::c_int;
- pub fn ppoll(
- fds: *mut ::pollfd,
- nfds: nfds_t,
- timeout: *const ::timespec,
- sigmask: *const sigset_t,
- ) -> ::c_int;
- pub fn pthread_condattr_getclock(
- attr: *const pthread_condattr_t,
- clock_id: *mut clockid_t,
- ) -> ::c_int;
- pub fn pthread_condattr_setclock(
- attr: *mut pthread_condattr_t,
- clock_id: ::clockid_t,
- ) -> ::c_int;
- pub fn pthread_condattr_setpshared(
- attr: *mut pthread_condattr_t,
- pshared: ::c_int,
- ) -> ::c_int;
- pub fn pthread_condattr_getpshared(
- attr: *const pthread_condattr_t,
- pshared: *mut ::c_int,
- ) -> ::c_int;
- pub fn sched_getaffinity(
- pid: ::pid_t,
- cpusetsize: ::size_t,
- cpuset: *mut cpu_set_t,
- ) -> ::c_int;
- pub fn sched_setaffinity(
- pid: ::pid_t,
- cpusetsize: ::size_t,
- cpuset: *const cpu_set_t,
- ) -> ::c_int;
- pub fn unshare(flags: ::c_int) -> ::c_int;
- pub fn sem_timedwait(
- sem: *mut sem_t,
- abstime: *const ::timespec,
- ) -> ::c_int;
- pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int;
- pub fn accept4(
- fd: ::c_int,
- addr: *mut ::sockaddr,
- len: *mut ::socklen_t,
- flg: ::c_int,
- ) -> ::c_int;
- pub fn pthread_mutex_timedlock(
- lock: *mut pthread_mutex_t,
- abstime: *const ::timespec,
- ) -> ::c_int;
- pub fn pthread_mutexattr_setpshared(
- attr: *mut pthread_mutexattr_t,
- pshared: ::c_int,
- ) -> ::c_int;
- pub fn pthread_mutexattr_getpshared(
- attr: *const pthread_mutexattr_t,
- pshared: *mut ::c_int,
- ) -> ::c_int;
- pub fn pthread_rwlockattr_getkind_np(
- attr: *const pthread_rwlockattr_t,
- val: *mut ::c_int,
- ) -> ::c_int;
- pub fn pthread_rwlockattr_setkind_np(
- attr: *mut pthread_rwlockattr_t,
- val: ::c_int,
- ) -> ::c_int;
- pub fn pthread_rwlockattr_getpshared(
- attr: *const pthread_rwlockattr_t,
- val: *mut ::c_int,
- ) -> ::c_int;
- pub fn pthread_rwlockattr_setpshared(
- attr: *mut pthread_rwlockattr_t,
- val: ::c_int,
- ) -> ::c_int;
- pub fn ptsname_r(
- fd: ::c_int,
- buf: *mut ::c_char,
- buflen: ::size_t,
- ) -> ::c_int;
- pub fn clearenv() -> ::c_int;
- pub fn waitid(
- idtype: idtype_t,
- id: id_t,
- infop: *mut ::siginfo_t,
- options: ::c_int,
- ) -> ::c_int;
-
- pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int;
-
- pub fn setpwent();
- pub fn endpwent();
- pub fn getpwent() -> *mut passwd;
- pub fn setspent();
- pub fn endspent();
- pub fn getspent() -> *mut spwd;
- pub fn getspnam(__name: *const ::c_char) -> *mut spwd;
-
- pub fn shm_open(
- name: *const c_char,
- oflag: ::c_int,
- mode: mode_t,
- ) -> ::c_int;
-
- // System V IPC
- pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
- pub fn shmat(
- shmid: ::c_int,
- shmaddr: *const ::c_void,
- 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 ftok(pathname: *const ::c_char, proj_id: ::c_int) -> ::key_t;
- pub fn msgctl(msqid: ::c_int, cmd: ::c_int, buf: *mut msqid_ds)
- -> ::c_int;
- pub fn msgget(key: ::key_t, msgflg: ::c_int) -> ::c_int;
- pub fn msgrcv(
- msqid: ::c_int,
- msgp: *mut ::c_void,
- msgsz: ::size_t,
- msgtyp: ::c_long,
- msgflg: ::c_int,
- ) -> ::ssize_t;
- pub fn msgsnd(
- msqid: ::c_int,
- msgp: *const ::c_void,
- msgsz: ::size_t,
- msgflg: ::c_int,
- ) -> ::c_int;
-
- pub fn mprotect(
- addr: *mut ::c_void,
- len: ::size_t,
- prot: ::c_int,
- ) -> ::c_int;
- pub fn __errno_location() -> *mut ::c_int;
-
- 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 readahead(
- fd: ::c_int,
- offset: ::off64_t,
- count: ::size_t,
- ) -> ::ssize_t;
- pub fn getxattr(
- path: *const c_char,
- name: *const c_char,
- value: *mut ::c_void,
- size: ::size_t,
- ) -> ::ssize_t;
- pub fn lgetxattr(
- path: *const c_char,
- name: *const c_char,
- value: *mut ::c_void,
- size: ::size_t,
- ) -> ::ssize_t;
- pub fn fgetxattr(
- filedes: ::c_int,
- name: *const c_char,
- value: *mut ::c_void,
- size: ::size_t,
- ) -> ::ssize_t;
- pub fn setxattr(
- path: *const c_char,
- name: *const c_char,
- value: *const ::c_void,
- size: ::size_t,
- flags: ::c_int,
- ) -> ::c_int;
- pub fn lsetxattr(
- path: *const c_char,
- name: *const c_char,
- value: *const ::c_void,
- size: ::size_t,
- flags: ::c_int,
- ) -> ::c_int;
- pub fn fsetxattr(
- filedes: ::c_int,
- name: *const c_char,
- value: *const ::c_void,
- size: ::size_t,
- flags: ::c_int,
- ) -> ::c_int;
- pub fn listxattr(
- path: *const c_char,
- list: *mut c_char,
- size: ::size_t,
- ) -> ::ssize_t;
- pub fn llistxattr(
- path: *const c_char,
- list: *mut c_char,
- size: ::size_t,
- ) -> ::ssize_t;
- pub fn flistxattr(
- filedes: ::c_int,
- list: *mut c_char,
- size: ::size_t,
- ) -> ::ssize_t;
- pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int;
- pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int;
- pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int;
- pub fn signalfd(
- fd: ::c_int,
- mask: *const ::sigset_t,
- flags: ::c_int,
- ) -> ::c_int;
- pub fn quotactl(
- cmd: ::c_int,
- special: *const ::c_char,
- id: ::c_int,
- data: *mut ::c_char,
- ) -> ::c_int;
- pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
- pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
- pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
- pub fn mq_receive(
- mqd: ::mqd_t,
- msg_ptr: *mut ::c_char,
- msg_len: ::size_t,
- msg_prio: *mut ::c_uint,
- ) -> ::ssize_t;
- pub fn mq_send(
- mqd: ::mqd_t,
- msg_ptr: *const ::c_char,
- msg_len: ::size_t,
- msg_prio: ::c_uint,
- ) -> ::c_int;
- pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
- pub fn mq_setattr(
- mqd: ::mqd_t,
- newattr: *const ::mq_attr,
- oldattr: *mut ::mq_attr,
- ) -> ::c_int;
- pub fn epoll_pwait(
- epfd: ::c_int,
- events: *mut ::epoll_event,
- maxevents: ::c_int,
- timeout: ::c_int,
- sigmask: *const ::sigset_t,
- ) -> ::c_int;
- pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
- pub fn sigtimedwait(
- set: *const sigset_t,
- info: *mut siginfo_t,
- timeout: *const ::timespec,
- ) -> ::c_int;
- pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int;
- pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t)
- -> *mut ::c_char;
- pub fn prlimit(
- pid: ::pid_t,
- resource: ::c_int,
- new_limit: *const ::rlimit,
- old_limit: *mut ::rlimit,
- ) -> ::c_int;
- pub fn prlimit64(
- pid: ::pid_t,
- resource: ::c_int,
- new_limit: *const ::rlimit64,
- old_limit: *mut ::rlimit64,
- ) -> ::c_int;
- pub fn reboot(how_to: ::c_int) -> ::c_int;
- pub fn setfsgid(gid: ::gid_t) -> ::c_int;
- pub fn setfsuid(uid: ::uid_t) -> ::c_int;
- pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
- pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
-
- // Not available now on Android
- pub fn mkfifoat(
- dirfd: ::c_int,
- pathname: *const ::c_char,
- mode: ::mode_t,
- ) -> ::c_int;
- pub fn if_nameindex() -> *mut if_nameindex;
- pub fn if_freenameindex(ptr: *mut if_nameindex);
- pub fn sync_file_range(
- fd: ::c_int,
- offset: ::off64_t,
- nbytes: ::off64_t,
- flags: ::c_uint,
- ) -> ::c_int;
- pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
- pub fn freeifaddrs(ifa: *mut ::ifaddrs);
-
- pub fn mremap(
- addr: *mut ::c_void,
- len: ::size_t,
- new_len: ::size_t,
- flags: ::c_int,
- ...
- ) -> *mut ::c_void;
-
- pub fn glob(
- pattern: *const c_char,
- flags: ::c_int,
- errfunc: ::Option<
- extern "C" fn(epath: *const c_char, errno: ::c_int) -> ::c_int,
- >,
- pglob: *mut ::glob_t,
- ) -> ::c_int;
- pub fn globfree(pglob: *mut ::glob_t);
-
- pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
-
- pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
-
- pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
-
- pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
- pub fn madvise(
- addr: *mut ::c_void,
- len: ::size_t,
- advice: ::c_int,
- ) -> ::c_int;
-
- pub fn msync(
- addr: *mut ::c_void,
- len: ::size_t,
- flags: ::c_int,
- ) -> ::c_int;
-
- pub fn recvfrom(
- socket: ::c_int,
- buf: *mut ::c_void,
- len: ::size_t,
- flags: ::c_int,
- addr: *mut ::sockaddr,
- addrlen: *mut ::socklen_t,
- ) -> ::ssize_t;
- pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
-
- pub fn bind(
- socket: ::c_int,
- address: *const ::sockaddr,
- address_len: ::socklen_t,
- ) -> ::c_int;
-
- pub fn writev(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- ) -> ::ssize_t;
- pub fn readv(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- ) -> ::ssize_t;
-
- pub fn sendmsg(
- fd: ::c_int,
- msg: *const ::msghdr,
- flags: ::c_int,
- ) -> ::ssize_t;
- pub fn recvmsg(
- fd: ::c_int,
- msg: *mut ::msghdr,
- flags: ::c_int,
- ) -> ::ssize_t;
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrgid_r")]
- pub fn getgrgid_r(
- gid: ::gid_t,
- grp: *mut ::group,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut ::group,
- ) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "sigaltstack$UNIX2003"
- )]
- #[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
- pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
- pub fn sem_close(sem: *mut sem_t) -> ::c_int;
- pub fn getdtablesize() -> ::c_int;
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrnam_r")]
- pub fn getgrnam_r(
- name: *const ::c_char,
- grp: *mut ::group,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut ::group,
- ) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "pthread_sigmask$UNIX2003"
- )]
- pub fn pthread_sigmask(
- how: ::c_int,
- set: *const sigset_t,
- oldset: *mut sigset_t,
- ) -> ::c_int;
- pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
- pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
- pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
- pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
- pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwnam_r")]
- pub fn getpwnam_r(
- name: *const ::c_char,
- pwd: *mut passwd,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut passwd,
- ) -> ::c_int;
- #[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwuid_r")]
- pub fn getpwuid_r(
- uid: ::uid_t,
- pwd: *mut passwd,
- buf: *mut ::c_char,
- buflen: ::size_t,
- result: *mut *mut passwd,
- ) -> ::c_int;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "sigwait$UNIX2003"
- )]
- #[cfg_attr(target_os = "solaris", link_name = "__posix_sigwait")]
- pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int;
- pub fn pthread_atfork(
- prepare: ::Option<unsafe extern "C" fn()>,
- parent: ::Option<unsafe extern "C" fn()>,
- child: ::Option<unsafe extern "C" fn()>,
- ) -> ::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 getgrgid(gid: ::gid_t) -> *mut ::group;
- #[cfg_attr(
- all(target_os = "macos", target_arch = "x86"),
- link_name = "popen$UNIX2003"
- )]
- pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
- pub fn uname(buf: *mut ::utsname) -> ::c_int;
-}
-
-cfg_if! {
- if #[cfg(any(target_arch = "mips", target_arch = "mips64"))] {
- mod mips;
- pub use self::mips::*;
- } else if #[cfg(target_arch = "x86_64")] {
- mod x86_64;
- pub use self::x86_64::*;
- } else if #[cfg(target_arch = "arm")] {
- mod arm;
- pub use self::arm::*;
- } else {
- pub use unsupported_target;
- }
-}
-
-cfg_if! {
- if #[cfg(libc_align)] {
- #[macro_use]
- mod align;
- } else {
- #[macro_use]
- mod no_align;
- }
-}
-
-expand_align!();
diff --git a/src/unix/uclibc/x86_64/align.rs b/src/unix/uclibc/x86_64/align.rs
deleted file mode 100644
index 583a278d..00000000
--- a/src/unix/uclibc/x86_64/align.rs
+++ /dev/null
@@ -1,77 +0,0 @@
-macro_rules! expand_align {
- () => {
- s! {
- #[cfg_attr(target_pointer_width = "32",
- repr(align(4)))]
- #[cfg_attr(target_pointer_width = "64",
- repr(align(8)))]
- pub struct sem_t { // ToDo
- #[cfg(target_pointer_width = "32")]
- __size: [::c_char; 16],
- #[cfg(target_pointer_width = "64")]
- __size: [::c_char; 32],
- }
-
- #[cfg_attr(any(target_pointer_width = "32",
- target_arch = "x86_64",
- target_arch = "powerpc64",
- target_arch = "mips64",
- target_arch = "s390x",
- target_arch = "sparc64"),
- repr(align(4)))]
- #[cfg_attr(not(any(target_pointer_width = "32",
- target_arch = "x86_64",
- target_arch = "powerpc64",
- target_arch = "mips64",
- target_arch = "s390x",
- target_arch = "sparc64")),
- repr(align(8)))]
- pub struct pthread_mutexattr_t { // ToDo
- size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T],
- }
-
- #[repr(align(4))]
- pub struct pthread_condattr_t { // ToDo
- size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
- }
- }
-
- s_no_extra_traits! {
- #[cfg_attr(all(target_pointer_width = "32",
- any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc")),
- repr(align(4)))]
- #[cfg_attr(all(any(target_pointer_width = "64",
- not(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc")))),
- repr(align(8)))]
- #[allow(missing_debug_implementations)]
- pub struct pthread_mutex_t { // ToDo
- size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
- }
-
- #[repr(align(8))]
- #[allow(missing_debug_implementations)]
- pub struct pthread_cond_t { // ToDo
- size: [u8; ::__SIZEOF_PTHREAD_COND_T],
- }
-
- #[cfg_attr(all(target_pointer_width = "32",
- any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc")),
- repr(align(4)))]
- #[cfg_attr(any(target_pointer_width = "64",
- not(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc"))),
- repr(align(8)))]
- #[allow(missing_debug_implementations)]
- pub struct pthread_rwlock_t { // ToDo
- size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T],
- }
- }
- };
-}
diff --git a/src/unix/uclibc/x86_64/no_align.rs b/src/unix/uclibc/x86_64/no_align.rs
deleted file mode 100644
index 422d78fa..00000000
--- a/src/unix/uclibc/x86_64/no_align.rs
+++ /dev/null
@@ -1,59 +0,0 @@
-macro_rules! expand_align {
- () => {
- s! {
- pub struct sem_t { // ToDo
- #[cfg(target_pointer_width = "32")]
- __size: [::c_char; 16],
- #[cfg(target_pointer_width = "64")]
- __size: [::c_char; 32],
- __align: [::c_long; 0],
- }
-
- pub struct pthread_mutex_t { // ToDo
- #[cfg(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc"))]
- __align: [::c_long; 0],
- #[cfg(not(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc")))]
- __align: [::c_longlong; 0],
- size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
- }
-
- pub struct pthread_mutexattr_t { // ToDo
- #[cfg(any(target_arch = "x86_64", target_arch = "powerpc64",
- target_arch = "mips64", target_arch = "s390x",
- target_arch = "sparc64"))]
- __align: [::c_int; 0],
- #[cfg(not(any(target_arch = "x86_64", target_arch = "powerpc64",
- target_arch = "mips64", target_arch = "s390x",
- target_arch = "sparc64")))]
- __align: [::c_long; 0],
- size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T],
- }
-
- pub struct pthread_cond_t { // ToDo
- __align: [::c_longlong; 0],
- size: [u8; ::__SIZEOF_PTHREAD_COND_T],
- }
-
- pub struct pthread_condattr_t { // ToDo
- __align: [::c_int; 0],
- size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
- }
-
- pub struct pthread_rwlock_t { // ToDo
- #[cfg(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc"))]
- __align: [::c_long; 0],
- #[cfg(not(any(target_arch = "mips",
- target_arch = "arm",
- target_arch = "powerpc")))]
- __align: [::c_longlong; 0],
- size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T],
- }
- }
- }
-}
diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs
index a086dedf..1e4deb71 100755
--- a/src/vxworks/mod.rs
+++ b/src/vxworks/mod.rs
@@ -100,6 +100,9 @@ pub type _Vx_ticks64_t = ::c_ulonglong;
pub type sa_family_t = ::c_uchar;
+// mqueue.h
+pub type mqd_t = ::c_int;
+
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum _Vx_semaphore {}
impl ::Copy for _Vx_semaphore {}
@@ -109,6 +112,28 @@ impl ::Clone for _Vx_semaphore {
}
}
+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
+ }
+}
+
s! {
// b_pthread_condattr_t.h
pub struct pthread_condattr_t {
@@ -379,6 +404,13 @@ s! {
pub dli_sname: *const ::c_char,
pub dli_saddr: *mut ::c_void,
}
+
+ pub struct mq_attr {
+ pub mq_maxmsg: ::c_long,
+ pub mq_msgsize: ::c_long,
+ pub mq_flags: ::c_long,
+ pub mq_curmsgs: ::c_long,
+ }
}
s_no_extra_traits! {
@@ -670,24 +702,16 @@ pub const S_nfsLib_NFSERR_NAMETOOLONG: ::c_int = ENAMETOOLONG;
pub const S_nfsLib_NFSERR_NOTEMPTY: ::c_int = ENOTEMPTY;
pub const S_nfsLib_NFSERR_DQUOT: ::c_int = EDQUOT;
pub const S_nfsLib_NFSERR_STALE: ::c_int = ESTALE;
-pub const S_nfsLib_NFSERR_WFLUSH: ::c_int =
- M_nfsStat | nfsstat::NFSERR_WFLUSH as ::c_int;
-pub const S_nfsLib_NFSERR_REMOTE: ::c_int =
- M_nfsStat | nfsstat::NFSERR_REMOTE as ::c_int;
-pub const S_nfsLib_NFSERR_BADHANDLE: ::c_int =
- M_nfsStat | nfsstat::NFSERR_BADHANDLE as ::c_int;
-pub const S_nfsLib_NFSERR_NOT_SYNC: ::c_int =
- M_nfsStat | nfsstat::NFSERR_NOT_SYNC as ::c_int;
-pub const S_nfsLib_NFSERR_BAD_COOKIE: ::c_int =
- M_nfsStat | nfsstat::NFSERR_BAD_COOKIE as ::c_int;
+pub const S_nfsLib_NFSERR_WFLUSH: ::c_int = M_nfsStat | nfsstat::NFSERR_WFLUSH as ::c_int;
+pub const S_nfsLib_NFSERR_REMOTE: ::c_int = M_nfsStat | nfsstat::NFSERR_REMOTE as ::c_int;
+pub const S_nfsLib_NFSERR_BADHANDLE: ::c_int = M_nfsStat | nfsstat::NFSERR_BADHANDLE as ::c_int;
+pub const S_nfsLib_NFSERR_NOT_SYNC: ::c_int = M_nfsStat | nfsstat::NFSERR_NOT_SYNC as ::c_int;
+pub const S_nfsLib_NFSERR_BAD_COOKIE: ::c_int = M_nfsStat | nfsstat::NFSERR_BAD_COOKIE as ::c_int;
pub const S_nfsLib_NFSERR_NOTSUPP: ::c_int = EOPNOTSUPP;
-pub const S_nfsLib_NFSERR_TOOSMALL: ::c_int =
- M_nfsStat | nfsstat::NFSERR_TOOSMALL as ::c_int;
+pub const S_nfsLib_NFSERR_TOOSMALL: ::c_int = M_nfsStat | nfsstat::NFSERR_TOOSMALL as ::c_int;
pub const S_nfsLib_NFSERR_SERVERFAULT: ::c_int = EIO;
-pub const S_nfsLib_NFSERR_BADTYPE: ::c_int =
- M_nfsStat | nfsstat::NFSERR_BADTYPE as ::c_int;
-pub const S_nfsLib_NFSERR_JUKEBOX: ::c_int =
- M_nfsStat | nfsstat::NFSERR_JUKEBOX as ::c_int;
+pub const S_nfsLib_NFSERR_BADTYPE: ::c_int = M_nfsStat | nfsstat::NFSERR_BADTYPE as ::c_int;
+pub const S_nfsLib_NFSERR_JUKEBOX: ::c_int = M_nfsStat | nfsstat::NFSERR_JUKEBOX as ::c_int;
// in.h
pub const IPPROTO_IP: ::c_int = 0;
@@ -771,13 +795,12 @@ pub const SOCK_PACKET: ::c_int = 10;
pub const _SS_MAXSIZE: usize = 128;
pub const _SS_ALIGNSIZE: usize = size_of::<u32>();
-pub const _SS_PAD1SIZE: usize =
- (_SS_ALIGNSIZE - size_of::<::c_uchar>() - size_of::<::sa_family_t>());
-pub const _SS_PAD2SIZE: usize = (_SS_MAXSIZE
+pub const _SS_PAD1SIZE: usize = _SS_ALIGNSIZE - size_of::<::c_uchar>() - size_of::<::sa_family_t>();
+pub const _SS_PAD2SIZE: usize = _SS_MAXSIZE
- size_of::<::c_uchar>()
- size_of::<::sa_family_t>()
- _SS_PAD1SIZE
- - _SS_ALIGNSIZE);
+ - _SS_ALIGNSIZE;
pub const MSG_OOB: ::c_int = 0x0001;
pub const MSG_PEEK: ::c_int = 0x0002;
@@ -919,14 +942,13 @@ pub const _PARM_PATH_MAX: ::c_int = 1024;
pub const WNOHANG: ::c_int = 0x01;
pub const WUNTRACED: ::c_int = 0x02;
-const PTHREAD_MUTEXATTR_INITIALIZER: pthread_mutexattr_t =
- pthread_mutexattr_t {
- mutexAttrStatus: PTHREAD_INITIALIZED_OBJ,
- mutexAttrProtocol: PTHREAD_PRIO_NONE,
- mutexAttrPrioceiling: 0,
- mutexAttrType: PTHREAD_MUTEX_DEFAULT,
- mutexAttrPshared: 1,
- };
+const PTHREAD_MUTEXATTR_INITIALIZER: pthread_mutexattr_t = pthread_mutexattr_t {
+ mutexAttrStatus: PTHREAD_INITIALIZED_OBJ,
+ mutexAttrProtocol: PTHREAD_PRIO_NONE,
+ mutexAttrPrioceiling: 0,
+ mutexAttrType: PTHREAD_MUTEX_DEFAULT,
+ mutexAttrPshared: 1,
+};
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
mutexSemId: null_mut(),
mutexValid: PTHREAD_VALID_OBJ,
@@ -952,13 +974,12 @@ pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
condSemName: [0; _PTHREAD_SHARED_SEM_NAME_MAX],
};
-const PTHREAD_RWLOCKATTR_INITIALIZER: pthread_rwlockattr_t =
- pthread_rwlockattr_t {
- rwlockAttrStatus: PTHREAD_INITIALIZED_OBJ,
- rwlockAttrPshared: 1,
- rwlockAttrMaxReaders: 0,
- rwlockAttrConformOpt: 1,
- };
+const PTHREAD_RWLOCKATTR_INITIALIZER: pthread_rwlockattr_t = pthread_rwlockattr_t {
+ rwlockAttrStatus: PTHREAD_INITIALIZED_OBJ,
+ rwlockAttrPshared: 1,
+ rwlockAttrMaxReaders: 0,
+ rwlockAttrConformOpt: 1,
+};
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
rwlockSemId: null_mut(),
rwlockReadersRefCount: 0,
@@ -999,7 +1020,7 @@ impl ::Clone for FILE {
}
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
-pub enum fpos_t {} // TODO: fill this out with a struct
+pub enum fpos_t {} // FIXME: fill this out with a struct
impl ::Copy for fpos_t {}
impl ::Clone for fpos_t {
fn clone(&self) -> fpos_t {
@@ -1008,7 +1029,7 @@ impl ::Clone for fpos_t {
}
f! {
- pub fn CMSG_ALIGN(len: usize) -> usize {
+ pub {const} fn CMSG_ALIGN(len: usize) -> usize {
len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
}
@@ -1039,7 +1060,7 @@ f! {
.offset(CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) as isize)
}
- pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+ pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
(CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>()))
as ::c_uint
}
@@ -1065,44 +1086,24 @@ extern "C" {
pub fn tolower(c: c_int) -> c_int;
pub fn toupper(c: c_int) -> c_int;
pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
- pub fn freopen(
- filename: *const c_char,
- mode: *const c_char,
- file: *mut FILE,
- ) -> *mut FILE;
+ pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE;
pub fn fflush(file: *mut FILE) -> c_int;
pub fn fclose(file: *mut FILE) -> c_int;
pub fn remove(filename: *const c_char) -> c_int;
pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
pub fn tmpfile() -> *mut FILE;
- pub fn setvbuf(
- stream: *mut FILE,
- buffer: *mut c_char,
- mode: c_int,
- size: size_t,
- ) -> c_int;
+ pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int;
pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
pub fn getchar() -> c_int;
pub fn putchar(c: c_int) -> c_int;
pub fn fgetc(stream: *mut FILE) -> c_int;
- pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
- -> *mut c_char;
+ pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
pub fn puts(s: *const c_char) -> c_int;
pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
- pub fn fread(
- ptr: *mut c_void,
- size: size_t,
- nobj: size_t,
- stream: *mut FILE,
- ) -> size_t;
- pub fn fwrite(
- ptr: *const c_void,
- size: size_t,
- nobj: size_t,
- stream: *mut FILE,
- ) -> size_t;
+ pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
+ pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
pub fn ftell(stream: *mut FILE) -> c_long;
pub fn rewind(stream: *mut FILE);
@@ -1113,16 +1114,8 @@ extern "C" {
pub fn perror(s: *const c_char);
pub fn atoi(s: *const c_char) -> c_int;
pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
- pub fn strtol(
- s: *const c_char,
- endp: *mut *mut c_char,
- base: c_int,
- ) -> c_long;
- pub fn strtoul(
- s: *const c_char,
- endp: *mut *mut c_char,
- base: c_int,
- ) -> c_ulong;
+ pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long;
+ pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong;
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;
@@ -1134,17 +1127,9 @@ extern "C" {
pub fn getenv(s: *const c_char) -> *mut c_char;
pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
- pub fn strncpy(
- dst: *mut c_char,
- src: *const c_char,
- n: size_t,
- ) -> *mut c_char;
+ pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
- pub fn strncat(
- s: *mut c_char,
- ct: *const c_char,
- n: size_t,
- ) -> *mut c_char;
+ pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char;
pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
@@ -1156,59 +1141,30 @@ extern "C" {
pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char;
pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int;
- pub fn strncasecmp(
- s1: *const c_char,
- s2: *const c_char,
- n: size_t,
- ) -> c_int;
+ pub fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int;
pub fn strlen(cs: *const c_char) -> size_t;
pub fn strerror(n: c_int) -> *mut c_char;
pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
pub fn wcslen(buf: *const wchar_t) -> size_t;
- pub fn wcstombs(
- dest: *mut c_char,
- src: *const wchar_t,
- n: size_t,
- ) -> ::size_t;
+ pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t;
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 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;
}
extern "C" {
- pub fn fprintf(
- stream: *mut ::FILE,
- format: *const ::c_char,
- ...
- ) -> ::c_int;
+ pub fn fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
pub fn printf(format: *const ::c_char, ...) -> ::c_int;
- pub fn snprintf(
- s: *mut ::c_char,
- n: ::size_t,
- format: *const ::c_char,
- ...
- ) -> ::c_int;
+ pub fn snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int;
pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
- pub fn fscanf(
- stream: *mut ::FILE,
- format: *const ::c_char,
- ...
- ) -> ::c_int;
+ pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
- pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...)
- -> ::c_int;
+ pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int;
pub fn getchar_unlocked() -> ::c_int;
pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
@@ -1226,11 +1182,7 @@ extern "C" {
pub fn geteuid() -> uid_t;
pub fn getgroups(ngroups_max: ::c_int, groups: *mut gid_t) -> ::c_int;
pub fn getlogin() -> *mut c_char;
- pub fn getopt(
- argc: ::c_int,
- argv: *const *mut c_char,
- optstr: *const c_char,
- ) -> ::c_int;
+ pub fn getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int;
pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
pub fn pause() -> ::c_int;
pub fn seteuid(uid: uid_t) -> ::c_int;
@@ -1256,27 +1208,13 @@ extern "C" {
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
pub fn pthread_exit(value: *mut ::c_void) -> !;
- pub fn pthread_attr_setdetachstate(
- attr: *mut ::pthread_attr_t,
- state: ::c_int,
- ) -> ::c_int;
+ pub fn pthread_attr_setdetachstate(attr: *mut ::pthread_attr_t, state: ::c_int) -> ::c_int;
- pub fn strerror_r(
- errnum: ::c_int,
- buf: *mut c_char,
- buflen: ::size_t,
- ) -> ::c_int;
+ pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
- pub fn sigaction(
- signum: ::c_int,
- act: *const sigaction,
- oldact: *mut sigaction,
- ) -> ::c_int;
+ pub fn sigaction(signum: ::c_int, act: *const sigaction, oldact: *mut sigaction) -> ::c_int;
- pub fn utimes(
- filename: *const ::c_char,
- times: *const ::timeval,
- ) -> ::c_int;
+ pub fn utimes(filename: *const ::c_char, times: *const ::timeval) -> ::c_int;
#[link_name = "_rtld_dlopen"]
pub fn dlopen(filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
@@ -1285,10 +1223,7 @@ extern "C" {
pub fn dlerror() -> *mut ::c_char;
#[link_name = "_rtld_dlsym"]
- pub fn dlsym(
- handle: *mut ::c_void,
- symbol: *const ::c_char,
- ) -> *mut ::c_void;
+ pub fn dlsym(handle: *mut ::c_void, symbol: *const ::c_char) -> *mut ::c_void;
#[link_name = "_rtld_dlclose"]
pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
@@ -1308,25 +1243,14 @@ extern "C" {
pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
pub fn usleep(secs: ::useconds_t) -> ::c_int;
pub fn putenv(string: *mut c_char) -> ::c_int;
- pub fn setlocale(
- category: ::c_int,
- locale: *const ::c_char,
- ) -> *mut ::c_char;
-
- pub fn sigprocmask(
- how: ::c_int,
- set: *const sigset_t,
- oldset: *mut sigset_t,
- ) -> ::c_int;
+ pub fn setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char;
+
+ pub fn sigprocmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int;
pub fn sigpending(set: *mut sigset_t) -> ::c_int;
pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
- pub fn fseeko(
- stream: *mut ::FILE,
- offset: ::off_t,
- whence: ::c_int,
- ) -> ::c_int;
+ pub fn fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int;
pub fn ftello(stream: *mut ::FILE) -> ::off_t;
pub fn mkstemp(template: *mut ::c_char) -> ::c_int;
@@ -1336,18 +1260,13 @@ extern "C" {
pub fn closelog();
pub fn setlogmask(maskpri: ::c_int) -> ::c_int;
pub fn syslog(priority: ::c_int, message: *const ::c_char, ...);
- pub fn getline(
- lineptr: *mut *mut c_char,
- n: *mut size_t,
- stream: *mut FILE,
- ) -> ssize_t;
+ pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t;
}
extern "C" {
// stdlib.h
- pub fn memalign(block_size: ::size_t, size_arg: ::size_t)
- -> *mut ::c_void;
+ pub fn memalign(block_size: ::size_t, size_arg: ::size_t) -> *mut ::c_void;
// ioLib.h
pub fn getcwd(buf: *mut ::c_char, size: ::size_t) -> *mut ::c_char;
@@ -1359,15 +1278,10 @@ extern "C" {
pub fn pthread_mutexattr_init(attr: *mut pthread_mutexattr_t) -> ::c_int;
// pthread.h
- pub fn pthread_mutexattr_destroy(
- attr: *mut pthread_mutexattr_t,
- ) -> ::c_int;
+ pub fn pthread_mutexattr_destroy(attr: *mut pthread_mutexattr_t) -> ::c_int;
// pthread.h
- pub fn pthread_mutexattr_settype(
- pAttr: *mut ::pthread_mutexattr_t,
- pType: ::c_int,
- ) -> ::c_int;
+ pub fn pthread_mutexattr_settype(pAttr: *mut ::pthread_mutexattr_t, pType: ::c_int) -> ::c_int;
// pthread.h
pub fn pthread_mutex_init(
@@ -1385,31 +1299,20 @@ extern "C" {
pub fn pthread_mutex_trylock(mutex: *mut pthread_mutex_t) -> ::c_int;
// pthread.h
- pub fn pthread_mutex_timedlock(
- attr: *mut pthread_mutex_t,
- spec: *const timespec,
- ) -> ::c_int;
+ pub fn pthread_mutex_timedlock(attr: *mut pthread_mutex_t, spec: *const timespec) -> ::c_int;
// pthread.h
pub fn pthread_mutex_unlock(mutex: *mut pthread_mutex_t) -> ::c_int;
// pthread.h
- pub fn pthread_attr_setname(
- pAttr: *mut ::pthread_attr_t,
- name: *mut ::c_char,
- ) -> ::c_int;
+ pub fn pthread_attr_setname(pAttr: *mut ::pthread_attr_t, name: *mut ::c_char) -> ::c_int;
// pthread.h
- pub fn pthread_attr_setstacksize(
- attr: *mut ::pthread_attr_t,
- stacksize: ::size_t,
- ) -> ::c_int;
+ pub fn pthread_attr_setstacksize(attr: *mut ::pthread_attr_t, stacksize: ::size_t) -> ::c_int;
// pthread.h
- pub fn pthread_attr_getstacksize(
- attr: *const ::pthread_attr_t,
- size: *mut ::size_t,
- ) -> ::c_int;
+ pub fn pthread_attr_getstacksize(attr: *const ::pthread_attr_t, size: *mut ::size_t)
+ -> ::c_int;
// pthread.h
pub fn pthread_attr_init(attr: *mut ::pthread_attr_t) -> ::c_int;
@@ -1444,11 +1347,8 @@ extern "C" {
pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int;
// dirent.h
- pub fn readdir_r(
- pDir: *mut ::DIR,
- entry: *mut ::dirent,
- result: *mut *mut ::dirent,
- ) -> ::c_int;
+ pub fn readdir_r(pDir: *mut ::DIR, entry: *mut ::dirent, result: *mut *mut ::dirent)
+ -> ::c_int;
// dirent.h
pub fn readdir(pDir: *mut ::DIR) -> *mut ::dirent;
@@ -1464,9 +1364,7 @@ extern "C" {
pub fn pthread_condattr_init(attr: *mut ::pthread_condattr_t) -> ::c_int;
// pthread.h
- pub fn pthread_condattr_destroy(
- attr: *mut ::pthread_condattr_t,
- ) -> ::c_int;
+ pub fn pthread_condattr_destroy(attr: *mut ::pthread_condattr_t) -> ::c_int;
// pthread.h
pub fn pthread_condattr_getclock(
@@ -1496,20 +1394,14 @@ extern "C" {
pub fn pthread_cond_broadcast(cond: *mut ::pthread_cond_t) -> ::c_int;
// pthread.h
- pub fn pthread_cond_wait(
- cond: *mut ::pthread_cond_t,
- mutex: *mut ::pthread_mutex_t,
- ) -> ::c_int;
+ pub fn pthread_cond_wait(cond: *mut ::pthread_cond_t, mutex: *mut ::pthread_mutex_t)
+ -> ::c_int;
// pthread.h
- pub fn pthread_rwlockattr_init(
- attr: *mut ::pthread_rwlockattr_t,
- ) -> ::c_int;
+ pub fn pthread_rwlockattr_init(attr: *mut ::pthread_rwlockattr_t) -> ::c_int;
// pthread.h
- pub fn pthread_rwlockattr_destroy(
- attr: *mut ::pthread_rwlockattr_t,
- ) -> ::c_int;
+ pub fn pthread_rwlockattr_destroy(attr: *mut ::pthread_rwlockattr_t) -> ::c_int;
// pthread.h
pub fn pthread_rwlockattr_setmaxreaders(
@@ -1563,10 +1455,7 @@ extern "C" {
pub fn pthread_key_delete(key: ::pthread_key_t) -> ::c_int;
// pthread.h
- pub fn pthread_setspecific(
- key: ::pthread_key_t,
- value: *const ::c_void,
- ) -> ::c_int;
+ pub fn pthread_setspecific(key: ::pthread_key_t, value: *const ::c_void) -> ::c_int;
// pthread.h
pub fn pthread_getspecific(key: ::pthread_key_t) -> *mut ::c_void;
@@ -1579,37 +1468,22 @@ extern "C" {
) -> ::c_int;
// pthread.h
- pub fn pthread_attr_getname(
- attr: *mut ::pthread_attr_t,
- name: *mut *mut ::c_char,
- ) -> ::c_int;
+ pub fn pthread_attr_getname(attr: *mut ::pthread_attr_t, name: *mut *mut ::c_char) -> ::c_int;
// pthread.h
- pub fn pthread_join(
- thread: ::pthread_t,
- status: *mut *mut ::c_void,
- ) -> ::c_int;
+ pub fn pthread_join(thread: ::pthread_t, status: *mut *mut ::c_void) -> ::c_int;
// pthread.h
pub fn pthread_self() -> ::pthread_t;
// clockLib.h
- pub fn clock_gettime(
- clock_id: ::clockid_t,
- tp: *mut ::timespec,
- ) -> ::c_int;
+ pub fn clock_gettime(clock_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
// clockLib.h
- pub fn clock_settime(
- clock_id: ::clockid_t,
- tp: *const ::timespec,
- ) -> ::c_int;
+ pub fn clock_settime(clock_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
// clockLib.h
- pub fn clock_getres(
- clock_id: ::clockid_t,
- res: *mut ::timespec,
- ) -> ::c_int;
+ pub fn clock_getres(clock_id: ::clockid_t, res: *mut ::timespec) -> ::c_int;
// clockLib.h
pub fn clock_nanosleep(
@@ -1620,35 +1494,19 @@ extern "C" {
) -> ::c_int;
// timerLib.h
- pub fn nanosleep(
- rqtp: *const ::timespec,
- rmtp: *mut ::timespec,
- ) -> ::c_int;
+ pub fn nanosleep(rqtp: *const ::timespec, rmtp: *mut ::timespec) -> ::c_int;
// socket.h
- pub fn accept(
- s: ::c_int,
- addr: *mut ::sockaddr,
- addrlen: *mut ::socklen_t,
- ) -> ::c_int;
+ pub fn accept(s: ::c_int, addr: *mut ::sockaddr, addrlen: *mut ::socklen_t) -> ::c_int;
// socket.h
- pub fn bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t)
- -> ::c_int;
+ pub fn bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t) -> ::c_int;
// socket.h
- pub fn connect(
- s: ::c_int,
- name: *const ::sockaddr,
- namelen: ::socklen_t,
- ) -> ::c_int;
+ pub fn connect(s: ::c_int, name: *const ::sockaddr, namelen: ::socklen_t) -> ::c_int;
// socket.h
- pub fn getpeername(
- s: ::c_int,
- name: *mut ::sockaddr,
- namelen: *mut ::socklen_t,
- ) -> ::c_int;
+ pub fn getpeername(s: ::c_int, name: *mut ::sockaddr, namelen: *mut ::socklen_t) -> ::c_int;
// socket.h
pub fn getsockname(
@@ -1670,12 +1528,7 @@ extern "C" {
pub fn listen(socket: ::c_int, backlog: ::c_int) -> ::c_int;
// socket.h
- pub fn recv(
- s: ::c_int,
- buf: *mut ::c_void,
- bufLen: ::size_t,
- flags: ::c_int,
- ) -> ::ssize_t;
+ pub fn recv(s: ::c_int, buf: *mut ::c_void, bufLen: ::size_t, flags: ::c_int) -> ::ssize_t;
// socket.h
pub fn recvfrom(
@@ -1687,25 +1540,12 @@ extern "C" {
pFromLen: *mut ::socklen_t,
) -> ::ssize_t;
- pub fn recvmsg(
- socket: ::c_int,
- mp: *mut ::msghdr,
- flags: ::c_int,
- ) -> ::ssize_t;
+ pub fn recvmsg(socket: ::c_int, mp: *mut ::msghdr, flags: ::c_int) -> ::ssize_t;
// socket.h
- pub fn send(
- socket: ::c_int,
- buf: *const ::c_void,
- len: ::size_t,
- flags: ::c_int,
- ) -> ::ssize_t;
+ pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t;
- pub fn sendmsg(
- socket: ::c_int,
- mp: *const ::msghdr,
- flags: ::c_int,
- ) -> ::ssize_t;
+ pub fn sendmsg(socket: ::c_int, mp: *const ::msghdr, flags: ::c_int) -> ::ssize_t;
// socket.h
pub fn sendto(
@@ -1730,11 +1570,7 @@ extern "C" {
pub fn shutdown(s: ::c_int, how: ::c_int) -> ::c_int;
// socket.h
- pub fn socket(
- domain: ::c_int,
- _type: ::c_int,
- protocol: ::c_int,
- ) -> ::c_int;
+ pub fn socket(domain: ::c_int, _type: ::c_int, protocol: ::c_int) -> ::c_int;
// icotl.h
pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
@@ -1752,16 +1588,11 @@ extern "C" {
// ioLib.h or
// unistd.h
- pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t)
- -> ::ssize_t;
+ pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::size_t) -> ::ssize_t;
// ioLib.h or
// unistd.h
- pub fn write(
- fd: ::c_int,
- buf: *const ::c_void,
- count: ::size_t,
- ) -> ::ssize_t;
+ pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t;
// ioLib.h or
// unistd.h
@@ -1808,8 +1639,7 @@ extern "C" {
pub fn getppid() -> pid_t;
// wait.h
- pub fn waitpid(pid: pid_t, status: *mut ::c_int, optons: ::c_int)
- -> pid_t;
+ pub fn waitpid(pid: pid_t, status: *mut ::c_int, optons: ::c_int) -> pid_t;
// unistd.h
pub fn sysconf(attr: ::c_int) -> ::c_long;
@@ -1829,20 +1659,13 @@ extern "C" {
) -> ::c_int;
// stdlib.h
- pub fn realpath(
- fileName: *const ::c_char,
- resolvedName: *mut ::c_char,
- ) -> *mut ::c_char;
+ pub fn realpath(fileName: *const ::c_char, resolvedName: *mut ::c_char) -> *mut ::c_char;
// unistd.h
pub fn link(src: *const ::c_char, dst: *const ::c_char) -> ::c_int;
// unistd.h
- pub fn readlink(
- path: *const ::c_char,
- buf: *mut ::c_char,
- bufsize: ::size_t,
- ) -> ::ssize_t;
+ pub fn readlink(path: *const ::c_char, buf: *mut ::c_char, bufsize: ::size_t) -> ::ssize_t;
// unistd.h
pub fn symlink(path1: *const ::c_char, path2: *const ::c_char) -> ::c_int;
@@ -1907,11 +1730,7 @@ extern "C" {
pub fn kill(__pid: pid_t, __signo: ::c_int) -> ::c_int;
// signal.h for user
- pub fn sigqueue(
- __pid: pid_t,
- __signo: ::c_int,
- __value: ::sigval,
- ) -> ::c_int;
+ pub fn sigqueue(__pid: pid_t, __signo: ::c_int, __value: ::sigval) -> ::c_int;
// signal.h for user
pub fn _sigqueue(
@@ -1944,63 +1763,79 @@ extern "C" {
) -> RTP_ID;
// ioLib.h
- pub fn _realpath(
- fileName: *const ::c_char,
- resolvedName: *mut ::c_char,
- ) -> *mut ::c_char;
+ pub fn _realpath(fileName: *const ::c_char, resolvedName: *mut ::c_char) -> *mut ::c_char;
// pathLib.h
- pub fn _pathIsAbsolute(
- filepath: *const ::c_char,
- pNameTail: *mut *const ::c_char,
- ) -> BOOL;
+ pub fn _pathIsAbsolute(filepath: *const ::c_char, pNameTail: *mut *const ::c_char) -> BOOL;
- 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 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;
// randomNumGen.h
pub fn randBytes(buf: *mut c_uchar, length: c_int) -> c_int;
pub fn randABytes(buf: *mut c_uchar, length: c_int) -> c_int;
pub fn randUBytes(buf: *mut c_uchar, length: c_int) -> c_int;
pub fn randSecure() -> c_int;
+
+ // mqueue.h
+ pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
+ pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
+ pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
+ pub fn mq_receive(
+ mqd: ::mqd_t,
+ msg_ptr: *mut ::c_char,
+ msg_len: ::size_t,
+ msg_prio: *mut ::c_uint,
+ ) -> ::ssize_t;
+ pub fn mq_timedreceive(
+ mqd: ::mqd_t,
+ msg_ptr: *mut ::c_char,
+ msg_len: ::size_t,
+ msg_prio: *mut ::c_uint,
+ abs_timeout: *const ::timespec,
+ ) -> ::ssize_t;
+ pub fn mq_send(
+ mqd: ::mqd_t,
+ msg_ptr: *const ::c_char,
+ msg_len: ::size_t,
+ msg_prio: ::c_uint,
+ ) -> ::c_int;
+ pub fn mq_timedsend(
+ mqd: ::mqd_t,
+ msg_ptr: *const ::c_char,
+ msg_len: ::size_t,
+ msg_prio: ::c_uint,
+ abs_timeout: *const ::timespec,
+ ) -> ::c_int;
+ pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
+ pub fn mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int;
}
//Dummy functions, these don't really exist in VxWorks.
// wait.h macros
-pub fn WIFEXITED(status: ::c_int) -> bool {
- (status & 0xFF00) == 0
-}
-pub fn WIFSIGNALED(status: ::c_int) -> bool {
- (status & 0xFF00) != 0
-}
-pub fn WIFSTOPPED(status: ::c_int) -> bool {
- (status & 0xFF0000) != 0
-}
-pub fn WEXITSTATUS(status: ::c_int) -> ::c_int {
- status & 0xFF
-}
-pub fn WTERMSIG(status: ::c_int) -> ::c_int {
- (status >> 8) & 0xFF
-}
-pub fn WSTOPSIG(status: ::c_int) -> ::c_int {
- (status >> 16) & 0xFF
+safe_f! {
+ pub {const} fn WIFEXITED(status: ::c_int) -> bool {
+ (status & 0xFF00) == 0
+ }
+ pub {const} fn WIFSIGNALED(status: ::c_int) -> bool {
+ (status & 0xFF00) != 0
+ }
+ pub {const} fn WIFSTOPPED(status: ::c_int) -> bool {
+ (status & 0xFF0000) != 0
+ }
+ pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int {
+ status & 0xFF
+ }
+ pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
+ (status >> 8) & 0xFF
+ }
+ pub {const} fn WSTOPSIG(status: ::c_int) -> ::c_int {
+ (status >> 16) & 0xFF
+ }
}
-pub fn pread(
- _fd: ::c_int,
- _buf: *mut ::c_void,
- _count: ::size_t,
- _offset: off64_t,
-) -> ::ssize_t {
+pub fn pread(_fd: ::c_int, _buf: *mut ::c_void, _count: ::size_t, _offset: off64_t) -> ::ssize_t {
-1
}
@@ -2012,16 +1847,10 @@ pub fn pwrite(
) -> ::ssize_t {
-1
}
-pub fn posix_memalign(
- memptr: *mut *mut ::c_void,
- align: ::size_t,
- size: ::size_t,
-) -> ::c_int {
+pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int {
// check to see if align is a power of 2 and if align is a multiple
// of sizeof(void *)
- if (align & align - 1 != 0)
- || (align as usize % size_of::<::size_t>() != 0)
- {
+ if (align & align - 1 != 0) || (align as usize % size_of::<::size_t>() != 0) {
return ::EINVAL;
}
diff --git a/src/wasi.rs b/src/wasi.rs
index 2e0914dc..6aefff8a 100644
--- a/src/wasi.rs
+++ b/src/wasi.rs
@@ -35,6 +35,7 @@ pub type nlink_t = u64;
pub type blksize_t = c_long;
pub type blkcnt_t = i64;
pub type nfds_t = c_ulong;
+pub type wchar_t = i32;
pub type __wasi_rights_t = u64;
@@ -174,12 +175,17 @@ pub const EXIT_FAILURE: c_int = 1;
pub const STDIN_FILENO: c_int = 0;
pub const STDOUT_FILENO: c_int = 1;
pub const STDERR_FILENO: c_int = 2;
-pub const SEEK_SET: c_int = 2;
-pub const SEEK_CUR: c_int = 0;
-pub const SEEK_END: c_int = 1;
+pub const SEEK_SET: c_int = 0;
+pub const SEEK_CUR: c_int = 1;
+pub const SEEK_END: c_int = 2;
pub const _IOFBF: c_int = 0;
pub const _IONBF: c_int = 2;
pub const _IOLBF: c_int = 1;
+pub const F_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 FD_CLOEXEC: c_int = 1;
pub const FD_SETSIZE: size_t = 1024;
pub const O_APPEND: c_int = 0x0001;
pub const O_DSYNC: c_int = 0x0002;
@@ -197,18 +203,47 @@ pub const O_SEARCH: c_int = 0x08000000;
pub const O_WRONLY: c_int = 0x10000000;
pub const O_RDWR: c_int = O_WRONLY | O_RDONLY;
pub const O_ACCMODE: c_int = O_EXEC | O_RDWR | O_SEARCH;
+pub const O_NOCTTY: c_int = 0x0;
pub const POSIX_FADV_DONTNEED: c_int = 4;
pub const POSIX_FADV_NOREUSE: c_int = 5;
pub const POSIX_FADV_NORMAL: c_int = 0;
pub const POSIX_FADV_RANDOM: c_int = 2;
pub const POSIX_FADV_SEQUENTIAL: c_int = 1;
pub const POSIX_FADV_WILLNEED: c_int = 3;
+pub const AT_FDCWD: ::c_int = -2;
pub const AT_EACCESS: c_int = 0x0;
pub const AT_SYMLINK_NOFOLLOW: c_int = 0x1;
pub const AT_SYMLINK_FOLLOW: c_int = 0x2;
pub const AT_REMOVEDIR: c_int = 0x4;
-pub const UTIME_OMIT: c_long = 1073741822;
-pub const UTIME_NOW: c_long = 1073741823;
+pub const UTIME_OMIT: c_long = 0xfffffffe;
+pub const UTIME_NOW: c_long = 0xffffffff;
+pub const S_IFIFO: mode_t = 49152;
+pub const S_IFCHR: mode_t = 8192;
+pub const S_IFBLK: mode_t = 24576;
+pub const S_IFDIR: mode_t = 16384;
+pub const S_IFREG: mode_t = 32768;
+pub const S_IFLNK: mode_t = 40960;
+pub const S_IFSOCK: mode_t = 49152;
+pub const S_IFMT: mode_t = 57344;
+pub const DT_UNKNOWN: u8 = 0;
+pub const DT_BLK: u8 = 1;
+pub const DT_CHR: u8 = 2;
+pub const DT_DIR: u8 = 3;
+pub const DT_REG: u8 = 4;
+pub const DT_LNK: u8 = 7;
+pub const FIONREAD: c_int = 1;
+pub const FIONBIO: c_int = 2;
+pub const F_OK: ::c_int = 0;
+pub const R_OK: ::c_int = 4;
+pub const W_OK: ::c_int = 2;
+pub const X_OK: ::c_int = 1;
+pub const POLLIN: ::c_short = 0x1;
+pub const POLLOUT: ::c_short = 0x2;
+pub const POLLERR: ::c_short = 0x1000;
+pub const POLLHUP: ::c_short = 0x2000;
+pub const POLLNVAL: ::c_short = 0x4000;
+pub const POLLRDNORM: ::c_short = 0x1;
+pub const POLLWRNORM: ::c_short = 0x2;
pub const E2BIG: c_int = 1;
pub const EACCES: c_int = 2;
@@ -289,6 +324,11 @@ pub const ENOTCAPABLE: c_int = 76;
pub const EOPNOTSUPP: c_int = ENOTSUP;
pub const EWOULDBLOCK: c_int = EAGAIN;
+pub const _SC_PAGESIZE: c_int = 30;
+pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
+pub const _SC_IOV_MAX: c_int = 60;
+pub const _SC_SYMLOOP_MAX: c_int = 173;
+
#[cfg_attr(
feature = "rustc-dep-of-std",
link(name = "c", kind = "static", cfg(target_feature = "crt-static"))
@@ -318,11 +358,7 @@ extern "C" {
pub fn write(fd: c_int, ptr: *const c_void, size: size_t) -> ssize_t;
pub static mut environ: *mut *mut c_char;
pub fn fopen(a: *const c_char, b: *const c_char) -> *mut FILE;
- pub fn freopen(
- a: *const c_char,
- b: *const c_char,
- f: *mut FILE,
- ) -> *mut FILE;
+ pub fn freopen(a: *const c_char, b: *const c_char, f: *mut FILE) -> *mut FILE;
pub fn fclose(f: *mut FILE) -> c_int;
pub fn remove(a: *const c_char) -> c_int;
pub fn rename(a: *const c_char, b: *const c_char) -> c_int;
@@ -335,18 +371,8 @@ extern "C" {
pub fn rewind(f: *mut FILE);
pub fn fgetpos(f: *mut FILE, pos: *mut fpos_t) -> c_int;
pub fn fsetpos(f: *mut FILE, pos: *const fpos_t) -> c_int;
- pub fn fread(
- buf: *mut c_void,
- a: size_t,
- b: size_t,
- f: *mut FILE,
- ) -> size_t;
- pub fn fwrite(
- buf: *const c_void,
- a: size_t,
- b: size_t,
- f: *mut FILE,
- ) -> size_t;
+ pub fn fread(buf: *mut c_void, a: size_t, b: size_t, f: *mut FILE) -> size_t;
+ pub fn fwrite(buf: *const c_void, a: size_t, b: size_t, f: *mut FILE) -> size_t;
pub fn fgetc(f: *mut FILE) -> c_int;
pub fn getc(f: *mut FILE) -> c_int;
pub fn getchar() -> c_int;
@@ -370,14 +396,10 @@ extern "C" {
pub fn time(a: *mut time_t) -> time_t;
pub fn difftime(a: time_t, b: time_t) -> c_double;
pub fn mktime(a: *mut tm) -> time_t;
- pub fn strftime(
- a: *mut c_char,
- b: size_t,
- c: *const c_char,
- d: *const tm,
- ) -> size_t;
+ pub fn strftime(a: *mut c_char, b: size_t, c: *const c_char, d: *const tm) -> size_t;
pub fn gmtime(a: *const time_t) -> *mut tm;
pub fn gmtime_r(a: *const time_t, b: *mut tm) -> *mut tm;
+ pub fn localtime(a: *const time_t) -> *mut tm;
pub fn localtime_r(a: *const time_t, b: *mut tm) -> *mut tm;
pub fn asctime_r(a: *const tm, b: *mut c_char) -> *mut c_char;
pub fn ctime_r(a: *const time_t, b: *mut c_char) -> *mut c_char;
@@ -403,43 +425,22 @@ extern "C" {
pub fn isspace(c: c_int) -> c_int;
pub fn isupper(c: c_int) -> c_int;
pub fn isxdigit(c: c_int) -> c_int;
+ pub fn isblank(c: c_int) -> c_int;
pub fn tolower(c: c_int) -> c_int;
pub fn toupper(c: c_int) -> c_int;
- pub fn setvbuf(
- stream: *mut FILE,
- buffer: *mut c_char,
- mode: c_int,
- size: size_t,
- ) -> c_int;
+ pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int;
pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
- pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
- -> *mut c_char;
+ pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
pub fn atoi(s: *const c_char) -> c_int;
pub fn atof(s: *const c_char) -> c_double;
pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
- pub fn strtol(
- s: *const c_char,
- endp: *mut *mut c_char,
- base: c_int,
- ) -> c_long;
- pub fn strtoul(
- s: *const c_char,
- endp: *mut *mut c_char,
- base: c_int,
- ) -> c_ulong;
+ pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long;
+ pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong;
pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
- pub fn strncpy(
- dst: *mut c_char,
- src: *const c_char,
- n: size_t,
- ) -> *mut c_char;
+ pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
- pub fn strncat(
- s: *mut c_char,
- ct: *const c_char,
- n: size_t,
- ) -> *mut c_char;
+ pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char;
pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
@@ -448,14 +449,11 @@ extern "C" {
pub fn strspn(cs: *const c_char, ct: *const c_char) -> size_t;
pub fn strcspn(cs: *const c_char, ct: *const c_char) -> size_t;
pub fn strdup(cs: *const c_char) -> *mut c_char;
+ pub fn strndup(cs: *const c_char, n: size_t) -> *mut c_char;
pub fn strpbrk(cs: *const c_char, ct: *const c_char) -> *mut c_char;
pub fn strstr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
pub fn strcasecmp(s1: *const c_char, s2: *const c_char) -> c_int;
- pub fn strncasecmp(
- s1: *const c_char,
- s2: *const c_char,
- n: size_t,
- ) -> c_int;
+ pub fn strncasecmp(s1: *const c_char, s2: *const c_char, n: size_t) -> c_int;
pub fn strlen(cs: *const c_char) -> size_t;
pub fn strnlen(cs: *const c_char, maxlen: size_t) -> size_t;
pub fn strerror(n: c_int) -> *mut c_char;
@@ -464,39 +462,17 @@ extern "C" {
pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
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 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;
- pub fn fprintf(
- stream: *mut ::FILE,
- format: *const ::c_char,
- ...
- ) -> ::c_int;
+ pub fn fprintf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
pub fn printf(format: *const ::c_char, ...) -> ::c_int;
- pub fn snprintf(
- s: *mut ::c_char,
- n: ::size_t,
- format: *const ::c_char,
- ...
- ) -> ::c_int;
+ pub fn snprintf(s: *mut ::c_char, n: ::size_t, format: *const ::c_char, ...) -> ::c_int;
pub fn sprintf(s: *mut ::c_char, format: *const ::c_char, ...) -> ::c_int;
- pub fn fscanf(
- stream: *mut ::FILE,
- format: *const ::c_char,
- ...
- ) -> ::c_int;
+ pub fn fscanf(stream: *mut ::FILE, format: *const ::c_char, ...) -> ::c_int;
pub fn scanf(format: *const ::c_char, ...) -> ::c_int;
- pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...)
- -> ::c_int;
+ pub fn sscanf(s: *const ::c_char, format: *const ::c_char, ...) -> ::c_int;
pub fn getchar_unlocked() -> ::c_int;
pub fn putchar_unlocked(c: ::c_int) -> ::c_int;
@@ -515,13 +491,10 @@ extern "C" {
pub fn closedir(dirp: *mut ::DIR) -> ::c_int;
pub fn rewinddir(dirp: *mut ::DIR);
pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
+ pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
+ pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
- pub fn openat(
- dirfd: ::c_int,
- pathname: *const ::c_char,
- flags: ::c_int,
- ...
- ) -> ::c_int;
+ pub fn openat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int, ...) -> ::c_int;
pub fn fstatat(
dirfd: ::c_int,
pathname: *const ::c_char,
@@ -535,11 +508,7 @@ extern "C" {
newpath: *const ::c_char,
flags: ::c_int,
) -> ::c_int;
- pub fn mkdirat(
- dirfd: ::c_int,
- pathname: *const ::c_char,
- mode: ::mode_t,
- ) -> ::c_int;
+ pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_t) -> ::c_int;
pub fn readlinkat(
dirfd: ::c_int,
pathname: *const ::c_char,
@@ -557,40 +526,21 @@ extern "C" {
newdirfd: ::c_int,
linkpath: *const ::c_char,
) -> ::c_int;
- pub fn unlinkat(
- dirfd: ::c_int,
- pathname: *const ::c_char,
- flags: ::c_int,
- ) -> ::c_int;
+ pub fn unlinkat(dirfd: ::c_int, pathname: *const ::c_char, flags: ::c_int) -> ::c_int;
pub fn access(path: *const c_char, amode: ::c_int) -> ::c_int;
pub fn close(fd: ::c_int) -> ::c_int;
pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long;
- pub fn getopt(
- argc: ::c_int,
- argv: *const *mut c_char,
- optstr: *const c_char,
- ) -> ::c_int;
+ pub fn getopt(argc: ::c_int, argv: *const *mut c_char, optstr: *const c_char) -> ::c_int;
pub fn isatty(fd: ::c_int) -> ::c_int;
pub fn link(src: *const c_char, dst: *const c_char) -> ::c_int;
pub fn lseek(fd: ::c_int, offset: off_t, whence: ::c_int) -> off_t;
pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
- pub fn pause() -> ::c_int;
pub fn rmdir(path: *const c_char) -> ::c_int;
pub fn sleep(secs: ::c_uint) -> ::c_uint;
pub fn unlink(c: *const c_char) -> ::c_int;
- pub fn pread(
- fd: ::c_int,
- buf: *mut ::c_void,
- count: ::size_t,
- offset: off_t,
- ) -> ::ssize_t;
- pub fn pwrite(
- fd: ::c_int,
- buf: *const ::c_void,
- count: ::size_t,
- offset: off_t,
- ) -> ::ssize_t;
+ pub fn pread(fd: ::c_int, buf: *mut ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t;
+ pub fn pwrite(fd: ::c_int, buf: *const ::c_void, count: ::size_t, offset: off_t) -> ::ssize_t;
pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
@@ -607,60 +557,29 @@ extern "C" {
pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int;
pub fn times(buf: *mut ::tms) -> ::clock_t;
- pub fn strerror_r(
- errnum: ::c_int,
- buf: *mut c_char,
- buflen: ::size_t,
- ) -> ::c_int;
+ pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
pub fn usleep(secs: ::c_uint) -> ::c_int;
- pub fn send(
- socket: ::c_int,
- buf: *const ::c_void,
- len: ::size_t,
- flags: ::c_int,
- ) -> ::ssize_t;
- pub fn recv(
- socket: ::c_int,
- buf: *mut ::c_void,
- len: ::size_t,
- flags: ::c_int,
- ) -> ::ssize_t;
+ pub fn send(socket: ::c_int, buf: *const ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t;
+ pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::ssize_t;
pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: ::c_int) -> ::c_int;
- pub fn setlocale(
- category: ::c_int,
- locale: *const ::c_char,
- ) -> *mut ::c_char;
+ pub fn setlocale(category: ::c_int, locale: *const ::c_char) -> *mut ::c_char;
pub fn localeconv() -> *mut lconv;
- pub fn readlink(
- path: *const c_char,
- buf: *mut c_char,
- bufsz: ::size_t,
- ) -> ::ssize_t;
+ pub fn readlink(path: *const c_char, buf: *mut c_char, bufsz: ::size_t) -> ::ssize_t;
pub fn timegm(tm: *mut ::tm) -> time_t;
pub fn sysconf(name: ::c_int) -> ::c_long;
- pub fn fseeko(
- stream: *mut ::FILE,
- offset: ::off_t,
- whence: ::c_int,
- ) -> ::c_int;
+ pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int;
+
+ pub fn fseeko(stream: *mut ::FILE, offset: ::off_t, whence: ::c_int) -> ::c_int;
pub fn ftello(stream: *mut ::FILE) -> ::off_t;
- pub fn posix_fallocate(
- fd: ::c_int,
- offset: ::off_t,
- len: ::off_t,
- ) -> ::c_int;
+ pub fn posix_fallocate(fd: ::c_int, offset: ::off_t, len: ::off_t) -> ::c_int;
pub fn strcasestr(cs: *const c_char, ct: *const c_char) -> *mut c_char;
- pub fn getline(
- lineptr: *mut *mut c_char,
- n: *mut size_t,
- stream: *mut FILE,
- ) -> ssize_t;
+ pub fn getline(lineptr: *mut *mut c_char, n: *mut size_t, stream: *mut FILE) -> ssize_t;
pub fn faccessat(
dirfd: ::c_int,
@@ -668,34 +587,12 @@ extern "C" {
mode: ::c_int,
flags: ::c_int,
) -> ::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 pwritev(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t,
- ) -> ::ssize_t;
- pub fn preadv(
- fd: ::c_int,
- iov: *const ::iovec,
- iovcnt: ::c_int,
- offset: ::off_t,
- ) -> ::ssize_t;
- pub fn posix_fadvise(
- fd: ::c_int,
- offset: ::off_t,
- len: ::off_t,
- advise: ::c_int,
- ) -> ::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 pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t)
+ -> ::ssize_t;
+ pub fn preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t;
+ pub fn posix_fadvise(fd: ::c_int, offset: ::off_t, len: ::off_t, advise: ::c_int) -> ::c_int;
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
pub fn utimensat(
dirfd: ::c_int,
@@ -704,38 +601,104 @@ extern "C" {
flag: ::c_int,
) -> ::c_int;
pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
- pub fn memrchr(
- cx: *const ::c_void,
- c: ::c_int,
- n: ::size_t,
- ) -> *mut ::c_void;
+ pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
pub fn abs(i: c_int) -> c_int;
pub fn labs(i: c_long) -> c_long;
pub fn duplocale(base: ::locale_t) -> ::locale_t;
pub fn freelocale(loc: ::locale_t);
- pub fn newlocale(
- mask: ::c_int,
- locale: *const ::c_char,
- base: ::locale_t,
- ) -> ::locale_t;
+ pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t;
pub fn uselocale(loc: ::locale_t) -> ::locale_t;
pub fn sched_yield() -> ::c_int;
- pub fn __wasilibc_register_preopened_fd(
- fd: c_int,
- path: *const c_char,
- ) -> c_int;
+ pub fn __wasilibc_register_preopened_fd(fd: c_int, path: *const c_char) -> c_int;
pub fn __wasilibc_fd_renumber(fd: c_int, newfd: c_int) -> c_int;
pub fn __wasilibc_unlinkat(fd: c_int, path: *const c_char) -> c_int;
pub fn __wasilibc_rmdirat(fd: c_int, path: *const c_char) -> c_int;
- pub fn __wasilibc_init_preopen();
pub fn __wasilibc_find_relpath(
path: *const c_char,
- rights_base: __wasi_rights_t,
- rights_inheriting: __wasi_rights_t,
- relative_path: *mut *const c_char,
+ abs_prefix: *mut *const c_char,
+ relative_path: *mut *mut c_char,
+ relative_path_len: usize,
) -> c_int;
pub fn __wasilibc_tell(fd: c_int) -> ::off_t;
+ pub fn __wasilibc_nocwd___wasilibc_unlinkat(dirfd: c_int, path: *const c_char) -> c_int;
+ pub fn __wasilibc_nocwd___wasilibc_rmdirat(dirfd: c_int, path: *const c_char) -> c_int;
+ pub fn __wasilibc_nocwd_linkat(
+ olddirfd: c_int,
+ oldpath: *const c_char,
+ newdirfd: c_int,
+ newpath: *const c_char,
+ flags: c_int,
+ ) -> c_int;
+ pub fn __wasilibc_nocwd_symlinkat(
+ target: *const c_char,
+ dirfd: c_int,
+ path: *const c_char,
+ ) -> c_int;
+ pub fn __wasilibc_nocwd_readlinkat(
+ dirfd: c_int,
+ path: *const c_char,
+ buf: *mut c_char,
+ bufsize: usize,
+ ) -> isize;
+ pub fn __wasilibc_nocwd_faccessat(
+ dirfd: c_int,
+ path: *const c_char,
+ mode: c_int,
+ flags: c_int,
+ ) -> c_int;
+ pub fn __wasilibc_nocwd_renameat(
+ olddirfd: c_int,
+ oldpath: *const c_char,
+ newdirfd: c_int,
+ newpath: *const c_char,
+ ) -> c_int;
+ pub fn __wasilibc_nocwd_openat_nomode(dirfd: c_int, path: *const c_char, flags: c_int)
+ -> c_int;
+ pub fn __wasilibc_nocwd_fstatat(
+ dirfd: c_int,
+ path: *const c_char,
+ buf: *mut stat,
+ flags: c_int,
+ ) -> c_int;
+ pub fn __wasilibc_nocwd_mkdirat_nomode(dirfd: c_int, path: *const c_char) -> c_int;
+ pub fn __wasilibc_nocwd_utimensat(
+ dirfd: c_int,
+ path: *const c_char,
+ times: *const ::timespec,
+ flags: c_int,
+ ) -> c_int;
+ pub fn __wasilibc_nocwd_opendirat(dirfd: c_int, path: *const c_char) -> *mut ::DIR;
+ pub fn __wasilibc_access(pathname: *const c_char, mode: c_int, flags: c_int) -> c_int;
+ pub fn __wasilibc_stat(pathname: *const c_char, buf: *mut stat, flags: c_int) -> c_int;
+ pub fn __wasilibc_utimens(
+ pathname: *const c_char,
+ times: *const ::timespec,
+ flags: c_int,
+ ) -> c_int;
+ pub fn __wasilibc_link(oldpath: *const c_char, newpath: *const c_char, flags: c_int) -> c_int;
+ pub fn __wasilibc_link_oldat(
+ olddirfd: c_int,
+ oldpath: *const c_char,
+ newpath: *const c_char,
+ flags: c_int,
+ ) -> c_int;
+ pub fn __wasilibc_link_newat(
+ oldpath: *const c_char,
+ newdirfd: c_int,
+ newpath: *const c_char,
+ flags: c_int,
+ ) -> c_int;
+ pub fn __wasilibc_rename_oldat(
+ olddirfd: c_int,
+ oldpath: *const c_char,
+ newpath: *const c_char,
+ ) -> c_int;
+ pub fn __wasilibc_rename_newat(
+ oldpath: *const c_char,
+ newdirfd: c_int,
+ newpath: *const c_char,
+ ) -> c_int;
pub fn arc4random() -> u32;
pub fn arc4random_buf(a: *mut c_void, b: size_t);
diff --git a/src/windows/gnu/mod.rs b/src/windows/gnu/mod.rs
index e74628b9..3e7d38b8 100644
--- a/src/windows/gnu/mod.rs
+++ b/src/windows/gnu/mod.rs
@@ -8,11 +8,11 @@ pub const STDERR_FILENO: ::c_int = 2;
extern "C" {
pub fn strcasecmp(s1: *const ::c_char, s2: *const ::c_char) -> ::c_int;
- pub fn strncasecmp(
- s1: *const ::c_char,
- s2: *const ::c_char,
- n: ::size_t,
- ) -> ::c_int;
+ pub fn strncasecmp(s1: *const ::c_char, s2: *const ::c_char, n: ::size_t) -> ::c_int;
+
+ // NOTE: For MSVC target, `wmemchr` is only a inline function in `<wchar.h>`
+ // header file. We cannot find a way to link to that symbol from Rust.
+ pub fn wmemchr(cx: *const ::wchar_t, c: ::wchar_t, n: ::size_t) -> *mut ::wchar_t;
}
cfg_if! {
diff --git a/src/windows/mod.rs b/src/windows/mod.rs
index a83babae..f64aa2f9 100644
--- a/src/windows/mod.rs
+++ b/src/windows/mod.rs
@@ -250,7 +250,7 @@ impl ::Clone for FILE {
}
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
-pub enum fpos_t {} // TODO: fill this out with a struct
+pub enum fpos_t {} // FIXME: fill this out with a struct
impl ::Copy for fpos_t {}
impl ::Clone for fpos_t {
fn clone(&self) -> fpos_t {
@@ -274,44 +274,24 @@ extern "C" {
pub fn tolower(c: c_int) -> c_int;
pub fn toupper(c: c_int) -> c_int;
pub fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FILE;
- pub fn freopen(
- filename: *const c_char,
- mode: *const c_char,
- file: *mut FILE,
- ) -> *mut FILE;
+ pub fn freopen(filename: *const c_char, mode: *const c_char, file: *mut FILE) -> *mut FILE;
pub fn fflush(file: *mut FILE) -> c_int;
pub fn fclose(file: *mut FILE) -> c_int;
pub fn remove(filename: *const c_char) -> c_int;
pub fn rename(oldname: *const c_char, newname: *const c_char) -> c_int;
pub fn tmpfile() -> *mut FILE;
- pub fn setvbuf(
- stream: *mut FILE,
- buffer: *mut c_char,
- mode: c_int,
- size: size_t,
- ) -> c_int;
+ pub fn setvbuf(stream: *mut FILE, buffer: *mut c_char, mode: c_int, size: size_t) -> c_int;
pub fn setbuf(stream: *mut FILE, buf: *mut c_char);
pub fn getchar() -> c_int;
pub fn putchar(c: c_int) -> c_int;
pub fn fgetc(stream: *mut FILE) -> c_int;
- pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE)
- -> *mut c_char;
+ pub fn fgets(buf: *mut c_char, n: c_int, stream: *mut FILE) -> *mut c_char;
pub fn fputc(c: c_int, stream: *mut FILE) -> c_int;
pub fn fputs(s: *const c_char, stream: *mut FILE) -> c_int;
pub fn puts(s: *const c_char) -> c_int;
pub fn ungetc(c: c_int, stream: *mut FILE) -> c_int;
- pub fn fread(
- ptr: *mut c_void,
- size: size_t,
- nobj: size_t,
- stream: *mut FILE,
- ) -> size_t;
- pub fn fwrite(
- ptr: *const c_void,
- size: size_t,
- nobj: size_t,
- stream: *mut FILE,
- ) -> size_t;
+ pub fn fread(ptr: *mut c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
+ pub fn fwrite(ptr: *const c_void, size: size_t, nobj: size_t, stream: *mut FILE) -> size_t;
pub fn fseek(stream: *mut FILE, offset: c_long, whence: c_int) -> c_int;
pub fn ftell(stream: *mut FILE) -> c_long;
pub fn rewind(stream: *mut FILE);
@@ -322,16 +302,8 @@ extern "C" {
pub fn perror(s: *const c_char);
pub fn atoi(s: *const c_char) -> c_int;
pub fn strtod(s: *const c_char, endp: *mut *mut c_char) -> c_double;
- pub fn strtol(
- s: *const c_char,
- endp: *mut *mut c_char,
- base: c_int,
- ) -> c_long;
- pub fn strtoul(
- s: *const c_char,
- endp: *mut *mut c_char,
- base: c_int,
- ) -> c_ulong;
+ pub fn strtol(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_long;
+ pub fn strtoul(s: *const c_char, endp: *mut *mut c_char, base: c_int) -> c_ulong;
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;
@@ -344,17 +316,9 @@ extern "C" {
pub fn getenv(s: *const c_char) -> *mut c_char;
pub fn strcpy(dst: *mut c_char, src: *const c_char) -> *mut c_char;
- pub fn strncpy(
- dst: *mut c_char,
- src: *const c_char,
- n: size_t,
- ) -> *mut c_char;
+ pub fn strncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char;
pub fn strcat(s: *mut c_char, ct: *const c_char) -> *mut c_char;
- pub fn strncat(
- s: *mut c_char,
- ct: *const c_char,
- n: size_t,
- ) -> *mut c_char;
+ pub fn strncat(s: *mut c_char, ct: *const c_char, n: size_t) -> *mut c_char;
pub fn strcmp(cs: *const c_char, ct: *const c_char) -> c_int;
pub fn strncmp(cs: *const c_char, ct: *const c_char, n: size_t) -> c_int;
pub fn strcoll(cs: *const c_char, ct: *const c_char) -> c_int;
@@ -371,24 +335,12 @@ extern "C" {
pub fn strtok(s: *mut c_char, t: *const c_char) -> *mut c_char;
pub fn strxfrm(s: *mut c_char, ct: *const c_char, n: size_t) -> size_t;
pub fn wcslen(buf: *const wchar_t) -> size_t;
- pub fn wcstombs(
- dest: *mut c_char,
- src: *const wchar_t,
- n: size_t,
- ) -> ::size_t;
+ pub fn wcstombs(dest: *mut c_char, src: *const wchar_t, n: size_t) -> ::size_t;
pub fn memchr(cx: *const c_void, c: c_int, n: size_t) -> *mut c_void;
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 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;
pub fn abs(i: c_int) -> c_int;
@@ -400,6 +352,8 @@ extern "C" {
pub fn signal(signum: c_int, handler: sighandler_t) -> sighandler_t;
pub fn raise(signum: c_int) -> c_int;
+ #[link_name = "_gmtime64_s"]
+ pub fn gmtime_s(destTime: *mut tm, srcTime: *const time_t) -> ::c_int;
#[link_name = "_time64"]
pub fn time(destTime: *mut time_t) -> time_t;
#[link_name = "_chmod"]
@@ -442,11 +396,24 @@ extern "C" {
pub fn dup(fd: ::c_int) -> ::c_int;
#[link_name = "_dup2"]
pub fn dup2(src: ::c_int, dst: ::c_int) -> ::c_int;
+ #[link_name = "_execl"]
+ pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> intptr_t;
+ #[link_name = "_wexecl"]
+ pub fn wexecl(path: *const wchar_t, arg0: *const wchar_t, ...) -> intptr_t;
+ #[link_name = "_execle"]
+ pub fn execle(path: *const c_char, arg0: *const c_char, ...) -> intptr_t;
+ #[link_name = "_wexecle"]
+ pub fn wexecle(path: *const wchar_t, arg0: *const wchar_t, ...) -> intptr_t;
+ #[link_name = "_execlp"]
+ pub fn execlp(path: *const c_char, arg0: *const c_char, ...) -> intptr_t;
+ #[link_name = "_wexeclp"]
+ pub fn wexeclp(path: *const wchar_t, arg0: *const wchar_t, ...) -> intptr_t;
+ #[link_name = "_execlpe"]
+ pub fn execlpe(path: *const c_char, arg0: *const c_char, ...) -> intptr_t;
+ #[link_name = "_wexeclpe"]
+ pub fn wexeclpe(path: *const wchar_t, arg0: *const wchar_t, ...) -> intptr_t;
#[link_name = "_execv"]
- pub fn execv(
- prog: *const c_char,
- argv: *const *const c_char,
- ) -> ::intptr_t;
+ pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::intptr_t;
#[link_name = "_execve"]
pub fn execve(
prog: *const c_char,
@@ -461,6 +428,22 @@ extern "C" {
argv: *const *const c_char,
envp: *const *const c_char,
) -> ::c_int;
+ #[link_name = "_wexecv"]
+ pub fn wexecv(prog: *const wchar_t, argv: *const *const wchar_t) -> ::intptr_t;
+ #[link_name = "_wexecve"]
+ pub fn wexecve(
+ prog: *const wchar_t,
+ argv: *const *const wchar_t,
+ envp: *const *const wchar_t,
+ ) -> ::intptr_t;
+ #[link_name = "_wexecvp"]
+ pub fn wexecvp(c: *const wchar_t, argv: *const *const wchar_t) -> ::intptr_t;
+ #[link_name = "_wexecvpe"]
+ pub fn wexecvpe(
+ c: *const wchar_t,
+ argv: *const *const wchar_t,
+ envp: *const *const wchar_t,
+ ) -> ::intptr_t;
#[link_name = "_getcwd"]
pub fn getcwd(buf: *mut c_char, size: ::c_int) -> *mut c_char;
#[link_name = "_getpid"]
@@ -470,17 +453,9 @@ extern "C" {
#[link_name = "_lseek"]
pub fn lseek(fd: ::c_int, offset: c_long, origin: ::c_int) -> c_long;
#[link_name = "_lseeki64"]
- pub fn lseek64(
- fd: ::c_int,
- offset: c_longlong,
- origin: ::c_int,
- ) -> c_longlong;
+ pub fn lseek64(fd: ::c_int, offset: c_longlong, origin: ::c_int) -> c_longlong;
#[link_name = "_pipe"]
- pub fn pipe(
- fds: *mut ::c_int,
- psize: ::c_uint,
- textmode: ::c_int,
- ) -> ::c_int;
+ pub fn pipe(fds: *mut ::c_int, psize: ::c_uint, textmode: ::c_int) -> ::c_int;
#[link_name = "_read"]
pub fn read(fd: ::c_int, buf: *mut ::c_void, count: ::c_uint) -> ::c_int;
#[link_name = "_rmdir"]
@@ -488,11 +463,7 @@ extern "C" {
#[link_name = "_unlink"]
pub fn unlink(c: *const c_char) -> ::c_int;
#[link_name = "_write"]
- pub fn write(
- fd: ::c_int,
- buf: *const ::c_void,
- count: ::c_uint,
- ) -> ::c_int;
+ pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::c_uint) -> ::c_int;
#[link_name = "_commit"]
pub fn commit(fd: ::c_int) -> ::c_int;
#[link_name = "_get_osfhandle"]
@@ -501,39 +472,18 @@ extern "C" {
pub fn open_osfhandle(osfhandle: ::intptr_t, flags: ::c_int) -> ::c_int;
pub fn setlocale(category: ::c_int, locale: *const c_char) -> *mut c_char;
#[link_name = "_wsetlocale"]
- pub fn wsetlocale(
- category: ::c_int,
- locale: *const wchar_t,
- ) -> *mut wchar_t;
+ pub fn wsetlocale(category: ::c_int, locale: *const wchar_t) -> *mut wchar_t;
+ #[link_name = "_aligned_malloc"]
+ pub fn aligned_malloc(size: size_t, alignment: size_t) -> *mut c_void;
}
extern "system" {
pub fn listen(s: SOCKET, backlog: ::c_int) -> ::c_int;
- pub fn accept(
- s: SOCKET,
- addr: *mut ::sockaddr,
- addrlen: *mut ::c_int,
- ) -> SOCKET;
- pub fn bind(
- s: SOCKET,
- name: *const ::sockaddr,
- namelen: ::c_int,
- ) -> ::c_int;
- pub fn connect(
- s: SOCKET,
- name: *const ::sockaddr,
- namelen: ::c_int,
- ) -> ::c_int;
- pub fn getpeername(
- s: SOCKET,
- name: *mut ::sockaddr,
- nameln: *mut ::c_int,
- ) -> ::c_int;
- pub fn getsockname(
- s: SOCKET,
- name: *mut ::sockaddr,
- nameln: *mut ::c_int,
- ) -> ::c_int;
+ pub fn accept(s: SOCKET, addr: *mut ::sockaddr, addrlen: *mut ::c_int) -> SOCKET;
+ pub fn bind(s: SOCKET, name: *const ::sockaddr, namelen: ::c_int) -> ::c_int;
+ pub fn connect(s: SOCKET, name: *const ::sockaddr, namelen: ::c_int) -> ::c_int;
+ pub fn getpeername(s: SOCKET, name: *mut ::sockaddr, nameln: *mut ::c_int) -> ::c_int;
+ pub fn getsockname(s: SOCKET, name: *mut ::sockaddr, nameln: *mut ::c_int) -> ::c_int;
pub fn getsockopt(
s: SOCKET,
level: ::c_int,
@@ -564,11 +514,7 @@ extern "system" {
optval: *const ::c_char,
optlen: ::c_int,
) -> ::c_int;
- pub fn socket(
- af: ::c_int,
- socket_type: ::c_int,
- protocol: ::c_int,
- ) -> SOCKET;
+ pub fn socket(af: ::c_int, socket_type: ::c_int, protocol: ::c_int) -> SOCKET;
}
cfg_if! {
diff --git a/src/windows/msvc.rs b/src/windows/msvc.rs
index 8f20deb5..b4c98a84 100644
--- a/src/windows/msvc.rs
+++ b/src/windows/msvc.rs
@@ -9,9 +9,5 @@ extern "C" {
#[link_name = "_stricmp"]
pub fn stricmp(s1: *const ::c_char, s2: *const ::c_char) -> ::c_int;
#[link_name = "_strnicmp"]
- pub fn strnicmp(
- s1: *const ::c_char,
- s2: *const ::c_char,
- n: ::size_t,
- ) -> ::c_int;
+ pub fn strnicmp(s1: *const ::c_char, s2: *const ::c_char, n: ::size_t) -> ::c_int;
}