From 4db7a390041035006919fe5056e5c09de3308924 Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Sun, 12 Nov 2023 17:46:38 +0800 Subject: [PATCH] feat: eventfd_read/write for Android/FreeBSD/Linux --- .cirrus.yml | 4 +- .github/dependabot.yml | 6 + .github/workflows/bors.yml | 51 +- .github/workflows/docs.yml | 37 - .github/workflows/main.yml | 8 +- Cargo.toml | 2 +- README.md | 3 +- build.rs | 18 +- ci/android-install-ndk.sh | 40 +- ci/build.sh | 22 +- ci/docker/aarch64-linux-android/Dockerfile | 7 +- .../aarch64-unknown-linux-gnu/Dockerfile | 2 +- .../aarch64-unknown-linux-musl/Dockerfile | 4 +- ci/docker/arm-linux-androideabi/Dockerfile | 11 +- .../arm-unknown-linux-gnueabihf/Dockerfile | 2 +- .../arm-unknown-linux-musleabihf/Dockerfile | 2 +- .../Dockerfile | 2 +- ci/docker/asmjs-unknown-emscripten/Dockerfile | 2 +- ci/docker/i686-linux-android/Dockerfile | 11 +- ci/docker/i686-unknown-linux-gnu/Dockerfile | 2 +- ci/docker/i686-unknown-linux-musl/Dockerfile | 2 +- ci/docker/mips-unknown-linux-gnu/Dockerfile | 10 - ci/docker/mips-unknown-linux-musl/Dockerfile | 25 - .../mips64-unknown-linux-gnuabi64/Dockerfile | 11 - .../mips64-unknown-linux-muslabi64/Dockerfile | 15 - .../Dockerfile | 11 - .../Dockerfile | 15 - .../mipsel-unknown-linux-musl/Dockerfile | 25 - .../mipsel-unknown-linux-uclibc/Dockerfile | 22 - .../powerpc-unknown-linux-gnu/Dockerfile | 2 +- .../powerpc64-unknown-linux-gnu/Dockerfile | 2 +- .../powerpc64le-unknown-linux-gnu/Dockerfile | 2 +- .../riscv64gc-unknown-linux-gnu/Dockerfile | 2 +- ci/docker/s390x-unknown-linux-gnu/Dockerfile | 2 +- ci/docker/s390x-unknown-linux-musl/Dockerfile | 4 +- .../sparc64-unknown-linux-gnu/Dockerfile | 2 +- .../wasm32-unknown-emscripten/Dockerfile | 2 +- ci/docker/wasm32-wasi/Dockerfile | 2 +- ci/docker/x86_64-linux-android/Dockerfile | 13 +- ci/docker/x86_64-unknown-linux-gnu/Dockerfile | 2 +- .../x86_64-unknown-linux-gnux32/Dockerfile | 2 +- .../x86_64-unknown-linux-musl/Dockerfile | 2 +- ci/dox.sh | 82 - ci/install-musl.sh | 14 - ci/install-rust.sh | 10 +- ci/run-docker.sh | 8 +- libc-test/Cargo.toml | 4 +- libc-test/build.rs | 210 +- libc-test/semver/android.txt | 14 + libc-test/semver/apple.txt | 6 + libc-test/semver/dragonfly.txt | 6 + libc-test/semver/freebsd.txt | 10 + libc-test/semver/linux-gnu.txt | 12 + libc-test/semver/linux.txt | 88 + libc-test/semver/netbsd-mips.txt | 4 + libc-test/semver/netbsd.txt | 15 + libc-test/semver/openbsd.txt | 16 + libc-test/semver/redox.txt | 5 + src/fuchsia/mod.rs | 5 +- src/lib.rs | 4 - src/teeos/mod.rs | 2 + src/unix/aix/mod.rs | 14 +- src/unix/bsd/apple/mod.rs | 312 ++- src/unix/bsd/freebsdlike/dragonfly/mod.rs | 6 + src/unix/bsd/freebsdlike/freebsd/mod.rs | 52 +- src/unix/bsd/freebsdlike/mod.rs | 17 + src/unix/bsd/netbsdlike/mod.rs | 9 + src/unix/bsd/netbsdlike/netbsd/mips.rs | 21 + src/unix/bsd/netbsdlike/netbsd/mod.rs | 66 +- src/unix/bsd/netbsdlike/netbsd/riscv64.rs | 21 + src/unix/bsd/netbsdlike/openbsd/mod.rs | 163 +- src/unix/haiku/mod.rs | 5 +- src/unix/hurd/b32.rs | 2 + src/unix/hurd/b64.rs | 2 + src/unix/hurd/mod.rs | 2102 +++++++++++++++-- src/unix/linux_like/android/mod.rs | 161 +- src/unix/linux_like/emscripten/mod.rs | 5 +- src/unix/linux_like/linux/arch/generic/mod.rs | 7 + src/unix/linux_like/linux/arch/mips/mod.rs | 7 + src/unix/linux_like/linux/arch/powerpc/mod.rs | 6 + src/unix/linux_like/linux/arch/sparc/mod.rs | 3 + src/unix/linux_like/linux/gnu/b32/arm/mod.rs | 1 + src/unix/linux_like/linux/gnu/b32/csky/mod.rs | 1 + src/unix/linux_like/linux/gnu/b32/m68k/mod.rs | 1 + src/unix/linux_like/linux/gnu/b32/mips/mod.rs | 1 + src/unix/linux_like/linux/gnu/b32/powerpc.rs | 1 + .../linux_like/linux/gnu/b32/riscv32/mod.rs | 1 + .../linux_like/linux/gnu/b32/sparc/mod.rs | 1 + src/unix/linux_like/linux/gnu/b32/x86/mod.rs | 1 + .../linux_like/linux/gnu/b64/aarch64/mod.rs | 1 + .../linux_like/linux/gnu/b64/mips64/mod.rs | 1 + .../linux_like/linux/gnu/b64/powerpc64/mod.rs | 1 + .../linux_like/linux/gnu/b64/riscv64/mod.rs | 1 + src/unix/linux_like/linux/gnu/b64/s390x.rs | 1 + .../linux_like/linux/gnu/b64/sparc64/mod.rs | 1 + .../linux_like/linux/gnu/b64/x86_64/mod.rs | 1 + src/unix/linux_like/linux/gnu/mod.rs | 27 +- src/unix/linux_like/linux/mod.rs | 319 ++- src/unix/linux_like/linux/musl/b32/arm/mod.rs | 7 +- src/unix/linux_like/linux/musl/b32/hexagon.rs | 6 - .../linux_like/linux/musl/b32/mips/mod.rs | 7 +- src/unix/linux_like/linux/musl/b32/powerpc.rs | 7 +- .../linux_like/linux/musl/b32/riscv32/mod.rs | 8 +- src/unix/linux_like/linux/musl/b32/x86/mod.rs | 7 +- .../linux_like/linux/musl/b64/aarch64/mod.rs | 4 +- src/unix/linux_like/linux/musl/b64/mips64.rs | 4 +- src/unix/linux_like/linux/musl/b64/mod.rs | 4 - .../linux_like/linux/musl/b64/powerpc64.rs | 4 +- .../linux_like/linux/musl/b64/riscv64/mod.rs | 7 +- src/unix/linux_like/linux/musl/b64/s390x.rs | 4 +- .../linux_like/linux/musl/b64/x86_64/mod.rs | 4 +- src/unix/linux_like/linux/musl/mod.rs | 13 +- src/unix/linux_like/linux/uclibc/mod.rs | 8 +- src/unix/mod.rs | 2 +- src/unix/nto/mod.rs | 3 +- src/unix/redox/mod.rs | 7 +- src/unix/solarish/mod.rs | 2 +- src/vxworks/mod.rs | 31 +- 118 files changed, 3568 insertions(+), 839 deletions(-) create mode 100644 .github/dependabot.yml delete mode 100644 .github/workflows/docs.yml delete mode 100644 ci/docker/mips-unknown-linux-gnu/Dockerfile delete mode 100644 ci/docker/mips-unknown-linux-musl/Dockerfile delete mode 100644 ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile delete mode 100644 ci/docker/mips64-unknown-linux-muslabi64/Dockerfile delete mode 100644 ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile delete mode 100644 ci/docker/mips64el-unknown-linux-muslabi64/Dockerfile delete mode 100644 ci/docker/mipsel-unknown-linux-musl/Dockerfile delete mode 100644 ci/docker/mipsel-unknown-linux-uclibc/Dockerfile delete mode 100644 ci/dox.sh create mode 100644 libc-test/semver/netbsd-mips.txt create mode 100644 src/unix/bsd/netbsdlike/netbsd/mips.rs create mode 100644 src/unix/bsd/netbsdlike/netbsd/riscv64.rs diff --git a/.cirrus.yml b/.cirrus.yml index dcfff67206296..3a42cc356c255 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -29,9 +29,7 @@ task: task: name: nightly x86_64-unknown-freebsd-14 freebsd_instance: - # FIXME: FreeBSD 14 CI fails due to pkg installation. - # Use 14 again once a new image is available on Cirrus CI. - image_family: freebsd-13-2 + image: freebsd-14-0-rc1-amd64 setup_script: - pkg install -y libnghttp2 curl - curl https://sh.rustup.rs -sSf --output rustup.sh diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000000..5ace4600a1f26 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/bors.yml b/.github/workflows/bors.yml index cc0bb667bdf20..c42d40be76cf6 100644 --- a/.github/workflows/bors.yml +++ b/.github/workflows/bors.yml @@ -26,7 +26,7 @@ jobs: - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD with: github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Rust toolchain run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh - name: Execute run-docker.sh @@ -49,7 +49,7 @@ jobs: - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD with: github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Rust toolchain run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh - name: Execute run.sh @@ -84,7 +84,7 @@ jobs: - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD with: github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Self-update rustup run: rustup self update shell: bash @@ -106,7 +106,7 @@ jobs: - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD with: github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Rust toolchain run: sh ./ci/install-rust.sh - name: Check style @@ -136,13 +136,6 @@ jobs: asmjs-unknown-emscripten, i686-linux-android, i686-unknown-linux-musl, - mips-unknown-linux-gnu, - mips-unknown-linux-musl, - # FIXME: Somehow failed on CI - # https://github.com/rust-lang/libc/runs/1659882216 - # mips64-unknown-linux-gnuabi64, - # mips64el-unknown-linux-gnuabi64, - mipsel-unknown-linux-musl, powerpc-unknown-linux-gnu, powerpc64-unknown-linux-gnu, powerpc64le-unknown-linux-gnu, @@ -167,7 +160,7 @@ jobs: - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD with: github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Rust toolchain run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh - name: Execute run-docker.sh @@ -195,7 +188,7 @@ jobs: - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD with: github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Rust toolchain run: TOOLCHAIN=nightly INSTALL_RUST_SRC=1 sh ./ci/install-rust.sh - name: Execute run-docker.sh @@ -214,7 +207,7 @@ jobs: - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD with: github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Rust toolchain run: sh ./ci/install-rust.sh - name: Execute run-docker.sh @@ -250,7 +243,7 @@ jobs: - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD with: github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Rust toolchain run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/install-rust.sh - name: Execute build.sh @@ -285,7 +278,7 @@ jobs: - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD with: github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Rust toolchain run: TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/install-rust.sh - name: Execute build.sh @@ -310,7 +303,7 @@ jobs: stable, ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Self-update rustup run: rustup self update shell: bash @@ -329,29 +322,11 @@ jobs: - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD with: github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Rust toolchain run: TOOLCHAIN=nightly sh ./ci/install-rust.sh - name: Build with check-cfg - run: LIBC_CI=1 LIBC_CHECK_CFG=1 cargo build -Z unstable-options -Z check-cfg=features,names,values,output - - docs: - permissions: - actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds) - contents: read # to fetch code (actions/checkout) - - name: Generate documentation - runs-on: ubuntu-22.04 - needs: docker_linux_tier2 - steps: - - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD - with: - github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v3 - - name: Setup Rust toolchain - run: sh ./ci/install-rust.sh - - name: Generate documentation - run: LIBC_CI=1 sh ci/dox.sh + run: LIBC_CI=1 LIBC_CHECK_CFG=1 cargo build -Z unstable-options -Z check-cfg # These jobs doesn't actually test anything, but they're only used to tell # bors the build completed, as there is no practical way to detect when a @@ -374,7 +349,6 @@ jobs: build_channels_linux, build_channels_macos, build_channels_windows, - docs, ] steps: @@ -396,7 +370,6 @@ jobs: build_channels_linux, build_channels_macos, build_channels_windows, - docs, ] steps: diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index ff722bc96e748..0000000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Upload documentation to GitHub Pages - -on: - push: - branches: - - main - -# Sets permissions of `GITHUB_TOKEN` to allow deployment to GitHub Pages -permissions: - contents: read - pages: write - id-token: write - -jobs: - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Rust toolchain - run: TARGET=x86_64-unknown-linux-gnu sh ./ci/install-rust.sh - - name: Generate documentation - run: LIBC_CI=1 sh ci/dox.sh - - name: Setup Pages - uses: actions/configure-pages@v3 - - name: Fix permissions - run: rm -f ./target/doc/.lock - - name: Upload artifact - uses: actions/upload-pages-artifact@v2 - with: - path: 'target/doc' - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 91c07cad417c1..7a0e646bddd70 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,7 +22,7 @@ jobs: x86_64-unknown-linux-gnu, ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Rust toolchain run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh - name: Execute run-docker.sh @@ -38,7 +38,7 @@ jobs: x86_64-apple-darwin, ] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Rust toolchain run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh - name: Execute run.sh @@ -66,7 +66,7 @@ jobs: # ARCH: i686 - target: i686-pc-windows-msvc steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Self-update rustup run: rustup self update shell: bash @@ -81,7 +81,7 @@ jobs: name: Style check runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Rust toolchain run: sh ./ci/install-rust.sh - name: Check style diff --git a/Cargo.toml b/Cargo.toml index b43cbcd504383..b70de560209fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libc" -version = "0.2.148" +version = "0.2.150" authors = ["The Rust Project Developers"] license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/README.md b/README.md index 43d706d0f2a64..29d2a4b6160f7 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ newer Rust features are only available on newer Rust toolchains: ## Platform support -[Platform-specific documentation (HEAD)][docs.head]. +You can see the platform(target)-specific docs on [docs.rs], select a platform you want to see. See [`ci/build.sh`](https://github.com/rust-lang/libc/blob/HEAD/ci/build.sh) @@ -107,4 +107,3 @@ dual licensed as above, without any additional terms or conditions. [Documentation]: https://docs.rs/libc/badge.svg [docs.rs]: https://docs.rs/libc [License]: https://img.shields.io/crates/l/libc.svg -[docs.head]: https://rust-lang.github.io/libc/#platform-specific-documentation diff --git a/build.rs b/build.rs index 1bd9a8db514ab..ee99981881c04 100644 --- a/build.rs +++ b/build.rs @@ -59,15 +59,15 @@ fn main() { ); } - // The ABI of libc used by libstd is backward compatible with FreeBSD 10. + // The ABI of libc used by std is backward compatible with FreeBSD 12. // The ABI of libc from crates.io is backward compatible with FreeBSD 11. // // On CI, we detect the actual FreeBSD version and match its ABI exactly, // running tests to ensure that the ABI is correct. match which_freebsd() { - Some(10) if libc_ci || rustc_dep_of_std => set_cfg("freebsd10"), + Some(10) if libc_ci => set_cfg("freebsd10"), Some(11) if libc_ci => set_cfg("freebsd11"), - Some(12) if libc_ci => set_cfg("freebsd12"), + Some(12) if libc_ci || rustc_dep_of_std => set_cfg("freebsd12"), Some(13) if libc_ci => set_cfg("freebsd13"), Some(14) if libc_ci => set_cfg("freebsd14"), Some(_) | None => set_cfg("freebsd11"), @@ -167,11 +167,19 @@ fn main() { // https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg if libc_check_cfg { for cfg in ALLOWED_CFGS { - println!("cargo:rustc-check-cfg=values({})", cfg); + if rustc_minor_ver >= 75 { + println!("cargo:rustc-check-cfg=cfg({})", cfg); + } else { + println!("cargo:rustc-check-cfg=values({})", cfg); + } } for &(name, values) in CHECK_CFG_EXTRA { let values = values.join("\",\""); - println!("cargo:rustc-check-cfg=values({},\"{}\")", name, values); + if rustc_minor_ver >= 75 { + println!("cargo:rustc-check-cfg=cfg({},values(\"{}\"))", name, values); + } else { + println!("cargo:rustc-check-cfg=values({},\"{}\")", name, values); + } } } } diff --git a/ci/android-install-ndk.sh b/ci/android-install-ndk.sh index 463565125972f..ebe791af703b8 100644 --- a/ci/android-install-ndk.sh +++ b/ci/android-install-ndk.sh @@ -2,40 +2,10 @@ set -ex -NDK=android-ndk-r21d -wget --tries=20 -q https://dl.google.com/android/repository/${NDK}-linux-x86_64.zip -unzip -q ${NDK}-linux-x86_64.zip +NDK=android-ndk-r26b +wget --tries=20 -q https://dl.google.com/android/repository/${NDK}-linux.zip +unzip -q ${NDK}-linux.zip -case "$1" in - arm) - arch=arm - api=28 - ;; - armv7) - arch=arm - api=28 - ;; - aarch64) - arch=arm64 - api=28 - ;; - i686) - arch=x86 - api=28 - ;; - x86_64) - arch=x86_64 - api=28 - ;; - *) - echo "invalid arch: $1" - exit 1 - ;; -esac; +mv ./${NDK}/toolchains/llvm/prebuilt/linux-x86_64 /android -python3 ${NDK}/build/tools/make_standalone_toolchain.py \ - --install-dir "/android/ndk-${1}" \ - --arch "${arch}" \ - --api ${api} - -rm -rf ./${NDK}-linux-x86_64.zip ./${NDK} +rm -rf ./${NDK}-linux.zip ./${NDK} diff --git a/ci/build.sh b/ci/build.sh index 2a9d68f53859b..41225f9cdffd6 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -39,7 +39,7 @@ test_target() { done fi - # Test that libc builds without any default features (no libstd) + # Test that libc builds without any default features (no std) if [ "${NO_STD}" != "1" ]; then cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" else @@ -47,8 +47,8 @@ test_target() { RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ -Z build-std=core,alloc -vv --no-default-features --target "${TARGET}" fi - # Test that libc builds with default features (e.g. libstd) - # if the target supports libstd + # Test that libc builds with default features (e.g. std) + # if the target supports std if [ "$NO_STD" != "1" ]; then cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}" else @@ -112,14 +112,6 @@ x86_64-unknown-linux-musl \ x86_64-unknown-netbsd \ " -# FIXME: builds of MIPS targets are currently broken on nightly. -# mips-unknown-linux-gnu \ -# mips-unknown-linux-musl \ -# mips64-unknown-linux-gnuabi64 \ -# mips64el-unknown-linux-gnuabi64 \ -# mipsel-unknown-linux-gnu \ -# mipsel-unknown-linux-musl \ - RUST_GT_1_13_LINUX_TARGETS="\ arm-unknown-linux-musleabi \ arm-unknown-linux-musleabihf \ @@ -238,9 +230,15 @@ i686-unknown-haiku \ i686-unknown-netbsd \ i686-unknown-openbsd \ i686-wrs-vxworks \ -mipsel-sony-psp \ +mips-unknown-linux-gnu \ +mips-unknown-linux-musl \ +mips64-unknown-linux-gnuabi64 \ mips64-unknown-linux-muslabi64 \ +mips64el-unknown-linux-gnuabi64 \ mips64el-unknown-linux-muslabi64 \ +mipsel-unknown-linux-gnu \ +mipsel-unknown-linux-musl \ +mipsel-sony-psp \ nvptx64-nvidia-cuda \ powerpc-unknown-linux-gnuspe \ powerpc-unknown-netbsd \ diff --git a/ci/docker/aarch64-linux-android/Dockerfile b/ci/docker/aarch64-linux-android/Dockerfile index b009e95b0e71e..7b8bdcfdadb32 100644 --- a/ci/docker/aarch64-linux-android/Dockerfile +++ b/ci/docker/aarch64-linux-android/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:23.10 RUN dpkg --add-architecture i386 RUN apt-get update @@ -19,9 +19,9 @@ WORKDIR /android/ COPY android* /android/ ENV ANDROID_ARCH=aarch64 -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools +ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH +RUN sh /android/android-install-ndk.sh RUN sh /android/android-install-sdk.sh $ANDROID_ARCH RUN mv /root/.android /tmp RUN chmod 777 -R /tmp/.android @@ -31,6 +31,7 @@ ENV PATH=$PATH:/rust/bin \ CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android28-clang \ CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=/tmp/runtest \ CC_aarch64_linux_android=aarch64-linux-android28-clang \ + AR_aarch64_linux_android=llvm-ar \ HOME=/tmp ADD runtest-android.rs /tmp/runtest.rs diff --git a/ci/docker/aarch64-unknown-linux-gnu/Dockerfile b/ci/docker/aarch64-unknown-linux-gnu/Dockerfile index a609d8a3b7a28..c94a7c63c0ea4 100644 --- a/ci/docker/aarch64-unknown-linux-gnu/Dockerfile +++ b/ci/docker/aarch64-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:23.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev ca-certificates \ gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user diff --git a/ci/docker/aarch64-unknown-linux-musl/Dockerfile b/ci/docker/aarch64-unknown-linux-musl/Dockerfile index 2002879e8c9e0..bc15db0692297 100644 --- a/ci/docker/aarch64-unknown-linux-musl/Dockerfile +++ b/ci/docker/aarch64-unknown-linux-musl/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:23.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc make libc6-dev git curl ca-certificates \ @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY install-musl.sh / RUN sh /install-musl.sh aarch64 -# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in libstd? +# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in std? ENV PATH=$PATH:/musl-aarch64/bin:/rust/bin \ CC_aarch64_unknown_linux_musl=musl-gcc \ RUSTFLAGS='-Clink-args=-lgcc -L /musl-aarch64/lib' \ diff --git a/ci/docker/arm-linux-androideabi/Dockerfile b/ci/docker/arm-linux-androideabi/Dockerfile index 93d850b38eb1f..d0fb3176de7e7 100644 --- a/ci/docker/arm-linux-androideabi/Dockerfile +++ b/ci/docker/arm-linux-androideabi/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:23.10 RUN dpkg --add-architecture i386 RUN apt-get update @@ -19,18 +19,19 @@ WORKDIR /android/ COPY android* /android/ ENV ANDROID_ARCH=arm -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools +ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH +RUN sh /android/android-install-ndk.sh RUN sh /android/android-install-sdk.sh $ANDROID_ARCH RUN mv /root/.android /tmp RUN chmod 777 -R /tmp/.android RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/* ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \ + CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi28-clang \ CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \ - CC_arm_linux_androideabi=arm-linux-androideabi-gcc \ + CC_arm_linux_androideabi=armv7a-linux-androideabi28-clang \ + AR_arm_linux_androideabi=llvm-ar \ HOME=/tmp ADD runtest-android.rs /tmp/runtest.rs diff --git a/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile b/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile index 57efe887b6292..977acabf4b6ba 100644 --- a/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile +++ b/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:23.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev ca-certificates \ gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user diff --git a/ci/docker/arm-unknown-linux-musleabihf/Dockerfile b/ci/docker/arm-unknown-linux-musleabihf/Dockerfile index 53228f46e6cef..1709699997e7f 100644 --- a/ci/docker/arm-unknown-linux-musleabihf/Dockerfile +++ b/ci/docker/arm-unknown-linux-musleabihf/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:23.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc make libc6-dev git curl ca-certificates \ diff --git a/ci/docker/armv7-unknown-linux-uclibceabihf/Dockerfile b/ci/docker/armv7-unknown-linux-uclibceabihf/Dockerfile index e6be22c93c637..585fdc35ff542 100644 --- a/ci/docker/armv7-unknown-linux-uclibceabihf/Dockerfile +++ b/ci/docker/armv7-unknown-linux-uclibceabihf/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:23.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates qemu-system-arm curl \ diff --git a/ci/docker/asmjs-unknown-emscripten/Dockerfile b/ci/docker/asmjs-unknown-emscripten/Dockerfile index 65d1a949ec577..d344cb1368f28 100644 --- a/ci/docker/asmjs-unknown-emscripten/Dockerfile +++ b/ci/docker/asmjs-unknown-emscripten/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:23.10 # This is a workaround to avoid the interaction with tzdata. ENV DEBIAN_FRONTEND=noninteractive diff --git a/ci/docker/i686-linux-android/Dockerfile b/ci/docker/i686-linux-android/Dockerfile index ed1b2e9fbef0e..a78c7cb6e8457 100644 --- a/ci/docker/i686-linux-android/Dockerfile +++ b/ci/docker/i686-linux-android/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:23.10 RUN dpkg --add-architecture i386 RUN apt-get update @@ -19,18 +19,19 @@ WORKDIR /android/ COPY android* /android/ ENV ANDROID_ARCH=i686 -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools +ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH +RUN sh /android/android-install-ndk.sh RUN sh /android/android-install-sdk.sh $ANDROID_ARCH RUN mv /root/.android /tmp RUN chmod 777 -R /tmp/.android RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/* ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \ + CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android28-clang \ CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=/tmp/runtest \ - CC_i686_linux_android=i686-linux-android-gcc \ + CC_i686_linux_android=i686-linux-android28-clang \ + AR_i686_linux_android=llvm-ar \ HOME=/tmp ADD runtest-android.rs /tmp/runtest.rs diff --git a/ci/docker/i686-unknown-linux-gnu/Dockerfile b/ci/docker/i686-unknown-linux-gnu/Dockerfile index bbe76a4c5c16c..6cdc1942c50c7 100644 --- a/ci/docker/i686-unknown-linux-gnu/Dockerfile +++ b/ci/docker/i686-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:23.10 RUN apt-get update RUN apt-get install -y --no-install-recommends \ gcc-multilib libc6-dev ca-certificates diff --git a/ci/docker/i686-unknown-linux-musl/Dockerfile b/ci/docker/i686-unknown-linux-musl/Dockerfile index fd2ba4c63b166..a54456fd9942b 100644 --- a/ci/docker/i686-unknown-linux-musl/Dockerfile +++ b/ci/docker/i686-unknown-linux-musl/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:23.10 RUN dpkg --add-architecture i386 RUN apt-get update diff --git a/ci/docker/mips-unknown-linux-gnu/Dockerfile b/ci/docker/mips-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 333a5bae32a9d..0000000000000 --- a/ci/docker/mips-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM ubuntu:22.04 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates \ - gcc-mips-linux-gnu libc6-dev-mips-cross \ - qemu-system-mips linux-headers-generic - -ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \ - CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_RUNNER="qemu-mips -L /usr/mips-linux-gnu" \ - PATH=$PATH:/rust/bin diff --git a/ci/docker/mips-unknown-linux-musl/Dockerfile b/ci/docker/mips-unknown-linux-musl/Dockerfile deleted file mode 100644 index 6fbd284fb9ba3..0000000000000 --- a/ci/docker/mips-unknown-linux-musl/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM ubuntu:22.04 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \ - xz-utils patch - -RUN mkdir /toolchain - -# Linux kernel version: 5.4.154 -# See build_dir/target-mips_24kc_musl/linux-ath79_generic/linux-5.4.154 -# Musl version: 1.1.24 -# See staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl/info.mk -RUN curl --retry 5 -L https://downloads.openwrt.org/releases/21.02.1/targets/ath79/generic/openwrt-sdk-21.02.1-ath79-generic_gcc-8.4.0_musl.Linux-x86_64.tar.xz | \ - tar xJf - -C /toolchain --strip-components=1 - -# See https://lkml.org/lkml/2014/3/14/269 -COPY sysinfo_guard.patch /toolchain -RUN patch /toolchain/staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl/include/linux/kernel.h targets -sed -i.bak 's/ \\//g' targets -grep '^[_a-zA-Z0-9-]*$' targets | sort > tmp && mv tmp targets - -# Create a markdown list of supported platforms in $PLATFORM_SUPPORT -rm $PLATFORM_SUPPORT || true - -printf '### Platform-specific documentation\n' >> $PLATFORM_SUPPORT - -while read -r target; do - echo "documenting ${target}" - - case "${target}" in - *apple*) - # FIXME: - # We can't build docs of apple targets from Linux yet. - continue - ;; - *) - ;; - esac - - rustup target add "${target}" || true - - # Enable extra configuration flags: - export RUSTDOCFLAGS="--cfg freebsd11" - - # If cargo doc fails, then try with unstable feature: - if ! cargo doc --target "${target}" \ - --no-default-features --features const-extern-fn,extra_traits ; then - cargo doc --target "${target}" \ - -Z build-std=core,alloc \ - --no-default-features --features const-extern-fn,extra_traits - fi - - mkdir -p "${TARGET_DOC_DIR}/${target}" - cp -r "target/${target}/doc" "${TARGET_DOC_DIR}/${target}" - - echo "* [${target}](${target}/doc/libc/index.html)" >> $PLATFORM_SUPPORT -done < targets - -# Replace
with the contents of $PLATFORM_SUPPORT -cp $README $TARGET_DOC_DIR -line=$(grep -n '
' $README | cut -d ":" -f 1) - -{ head -n "$((line-1))" $README; cat $PLATFORM_SUPPORT; tail -n "+$((line+1))" $README; } > $TARGET_DOC_DIR/$README - -cp $TARGET_DOC_DIR/$README $TARGET_DOC_DIR/index.md - -RUSTDOCFLAGS="--enable-index-page --index-page=${TARGET_DOC_DIR}/index.md -Zunstable-options" cargo doc - -# Tweak style -cp ci/rust.css $TARGET_DOC_DIR -sed -ie "8i " $TARGET_DOC_DIR/index.html -sed -ie "9i " $TARGET_DOC_DIR/index.html - -# Copy the licenses -cp LICENSE-* $TARGET_DOC_DIR/ diff --git a/ci/install-musl.sh b/ci/install-musl.sh index 036a369631c0e..7ea50916c4caf 100644 --- a/ci/install-musl.sh +++ b/ci/install-musl.sh @@ -46,20 +46,6 @@ case ${1} in ./configure --prefix="/musl-${musl_arch}" make install -j4 ;; - mips64) - musl_arch=mips64 - kernel_arch=mips - CC=mips64-linux-gnuabi64-gcc CFLAGS="-march=mips64r2 -mabi=64" \ - ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes - make install -j4 - ;; - mips64el) - musl_arch=mips64el - kernel_arch=mips - CC=mips64el-linux-gnuabi64-gcc CFLAGS="-march=mips64r2 -mabi=64" \ - ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes - make install -j4 - ;; s390x) musl_arch=s390x kernel_arch=s390 diff --git a/ci/install-rust.sh b/ci/install-rust.sh index 3ce81e6299932..d7e2be8070dc0 100644 --- a/ci/install-rust.sh +++ b/ci/install-rust.sh @@ -8,15 +8,7 @@ toolchain= if [ -n "$TOOLCHAIN" ]; then toolchain=$TOOLCHAIN else - # Pin the nightly version as newer nightly versions break CI, - # https://github.com/rust-lang/rust/issues/103673 contains related information. - case "$TARGET" in - *android*) toolchain=nightly-2022-10-09;; - # FIXME: Unpin once mips' components are available on nightly. - # https://rust-lang.github.io/rustup-components-history/mips-unknown-linux-gnu.html - *mips*) toolchain=nightly-2023-07-04;; - *) toolchain=nightly;; - esac + toolchain=nightly fi if [ "$OS" = "windows" ]; then : "${TARGET?The TARGET environment variable must be set.}" diff --git a/ci/run-docker.sh b/ci/run-docker.sh index c7d78bc8a1d29..042303846f3fe 100755 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -28,7 +28,7 @@ run() { echo "Building docker container for target ${1}" # use -f so we can use ci/ as build context - docker build -t libc -f "ci/docker/${1}/Dockerfile" ci/ + docker build -t "libc-${1}" -f "ci/docker/${1}/Dockerfile" ci/ mkdir -p target if [ -w /dev/kvm ]; then kvm="--volume /dev/kvm:/dev/kvm" @@ -50,7 +50,7 @@ run() { $kvm \ --init \ --workdir /checkout \ - libc \ + "libc-${1}" \ sh -c "HOME=/tmp PATH=\$PATH:/rust/bin exec ci/run.sh ${1}" } @@ -58,7 +58,7 @@ build_switch() { echo "Building docker container for target switch" # use -f so we can use ci/ as build context - docker build -t libc -f "ci/docker/switch/Dockerfile" ci/ + docker build -t libc-switch -f "ci/docker/switch/Dockerfile" ci/ mkdir -p target if [ -w /dev/kvm ]; then kvm="--volume /dev/kvm:/dev/kvm" @@ -82,7 +82,7 @@ build_switch() { $kvm \ --init \ --workdir /checkout \ - libc \ + libc-switch \ sh -c "HOME=/tmp RUSTUP_HOME=/tmp PATH=\$PATH:/rust/bin rustup default nightly \ && rustup component add rust-src --target ci/switch.json \ && cargo build -Z build-std=core,alloc --target ci/switch.json" diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml index 87efab5d0542b..6594300a9d2bf 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libc-test" -version = "0.2.148" +version = "0.2.150" authors = ["The Rust Project Developers"] license = "MIT OR Apache-2.0" build = "build.rs" @@ -12,7 +12,7 @@ A test crate for the libc crate. [dependencies.libc] path = ".." -version = "0.2.148" +version = "0.2.150" default-features = false [build-dependencies] diff --git a/libc-test/build.rs b/libc-test/build.rs index 1d689e6d15b16..9e2adf84b0ef4 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -299,6 +299,9 @@ fn test_apple(target: &str) { } cfg.skip_struct(move |ty| { + if ty.starts_with("__c_anonymous_") { + return true; + } match ty { // FIXME: actually a union "sigval" => true, @@ -310,8 +313,13 @@ fn test_apple(target: &str) { } }); - cfg.skip_type(move |ty| match ty { - _ => false, + cfg.skip_type(move |ty| { + if ty.starts_with("__c_anonymous_") { + return true; + } + match ty { + _ => false, + } }); cfg.skip_const(move |name| { @@ -341,7 +349,7 @@ fn test_apple(target: &str) { // close calls the close_nocancel system call "close" => true, - // FIXME: libstd removed libresolv support: https://github.com/rust-lang/rust/pull/102766 + // FIXME: std removed libresolv support: https://github.com/rust-lang/rust/pull/102766 "res_init" => true, // FIXME: remove once the target in CI is updated @@ -364,6 +372,9 @@ fn test_apple(target: &str) { ("__darwin_arm_neon_state64", "__v") => true, // MAXPATHLEN is too big for auto-derive traits on arrays. ("vnode_info_path", "vip_path") => true, + ("ifreq", "ifr_ifru") => true, + ("ifkpi", "ifk_data") => true, + ("ifconf", "ifc_ifcu") => true, _ => false, } }); @@ -507,12 +518,16 @@ fn test_openbsd(target: &str) { "util.h", "ufs/ufs/quota.h", "pthread_np.h", + "sys/reboot.h", "sys/syscall.h", "sys/shm.h", "sys/param.h", } cfg.skip_struct(move |ty| { + if ty.starts_with("__c_anonymous_") { + return true; + } match ty { // FIXME: actually a union "sigval" => true, @@ -586,6 +601,8 @@ fn test_openbsd(target: &str) { // conflicting with `p_type` macro from . ("Elf32_Phdr", "p_type") => true, ("Elf64_Phdr", "p_type") => true, + // ifr_ifru is defined is an union + ("ifreq", "ifr_ifru") => true, _ => false, } }); @@ -1094,6 +1111,7 @@ fn test_netbsd(target: &str) { "netinet/dccp.h", "sys/event.h", "sys/quota.h", + "sys/reboot.h", "sys/shm.h", "iconv.h", } @@ -1544,6 +1562,7 @@ fn test_android(target: &str) { "libgen.h", "limits.h", "link.h", + "linux/sysctl.h", "locale.h", "malloc.h", "net/ethernet.h", @@ -1739,6 +1758,14 @@ fn test_android(target: &str) { // These are tested in the `linux_elf.rs` file. "Elf64_Phdr" | "Elf32_Phdr" => true, + // FIXME: The type of `iv` has been changed. + "af_alg_iv" => true, + + // FIXME: The size of struct has been changed: + "inotify_event" => true, + // FIXME: The field has been changed: + "sockaddr_vm" => true, + _ => false, } }); @@ -1805,6 +1832,9 @@ fn test_android(target: &str) { // kernel 5.6 minimum required "IPPROTO_MPTCP" | "IPPROTO_ETHERNET" => true, + // kernel 6.2 minimum + "TUN_F_USO4" | "TUN_F_USO6" | "IFF_NO_CARRIER" => true, + // FIXME: NDK r22 minimum required | "FDB_NOTIFY_BIT" | "FDB_NOTIFY_INACTIVE_BIT" @@ -1838,7 +1868,16 @@ fn test_android(target: &str) { | "NDA_NDM_FLAGS_MASK" | "NDTPA_INTERVAL_PROBE_TIME_MS" | "NFQA_UNSPEC" - | "NTF_EXT_LOCKED" => true, + | "NTF_EXT_LOCKED" + | "ALG_SET_DRBG_ENTROPY" => true, + + // FIXME: Something has been changed on r26b: + | "IPPROTO_MAX" + | "NFNL_SUBSYS_COUNT" + | "NF_NETDEV_NUMHOOKS" + | "NFT_MSG_MAX" + | "SW_MAX" + | "SW_CNT" => true, _ => false, } @@ -1883,6 +1922,13 @@ fn test_android(target: &str) { // Added in API level 28, but some tests use level 24. "pthread_attr_getinheritsched" | "pthread_attr_setinheritsched" => true, + // Added in API level 28, but some tests use level 24. + "fread_unlocked" | "fwrite_unlocked" | "fgets_unlocked" | "fflush_unlocked" => true, + + // FIXME: bad function pointers: + "isalnum" | "isalpha" | "iscntrl" | "isdigit" | "isgraph" | "islower" | "isprint" + | "ispunct" | "isspace" | "isupper" | "isxdigit" | "isblank" | "tolower" + | "toupper" => true, _ => false, } @@ -1899,7 +1945,9 @@ fn test_android(target: &str) { // incorrect, see: https://github.com/rust-lang/libc/issues/1359 (struct_ == "sigaction" && field == "sa_sigaction") || // signalfd had SIGSYS fields added in Android 4.19, but CI does not have that version yet. - (struct_ == "signalfd_siginfo" && field == "ssi_call_addr") + (struct_ == "signalfd_siginfo" && field == "ssi_call_addr") || + // FIXME: Seems the type has been changed on NDK r26b + (struct_ == "flock64" && (field == "l_start" || field == "l_len")) }); cfg.skip_field(move |struct_, field| { @@ -1960,6 +2008,10 @@ fn test_freebsd(target: &str) { Some(n) if n >= 13 => true, _ => false, }; + let freebsd14 = match freebsd_ver { + Some(n) if n >= 14 => true, + _ => false, + }; headers! { cfg: "aio.h", @@ -2047,6 +2099,7 @@ fn test_freebsd(target: &str) { "sys/sysctl.h", "sys/thr.h", "sys/time.h", + [freebsd14]:"sys/timerfd.h", "sys/times.h", "sys/timex.h", "sys/types.h", @@ -2169,6 +2222,12 @@ fn test_freebsd(target: &str) { // should've been used anywhere anyway. "TDF_UNUSED23" => true, + // Removed in FreeBSD 14 (git a6b55ee6be1) + "IFF_KNOWSEPOCH" => true, + + // Removed in FreeBSD 14 (git 7ff9ae90f0b) + "IFF_NOGROUP" => true, + // FIXME: These are deprecated - remove in a couple of releases. // These symbols are not stable across OS-versions. They were // changed for FreeBSD 14 in git revisions b62848b0c3f and @@ -2250,8 +2309,8 @@ fn test_freebsd(target: &str) { // Added in freebsd 14. "IFCAP_MEXTPG" if Some(14) > freebsd_ver => true, // Added in freebsd 13. - "IFF_KNOWSEPOCH" | "IFCAP_TXTLS4" | "IFCAP_TXTLS6" | "IFCAP_VXLAN_HWCSUM" - | "IFCAP_VXLAN_HWTSO" | "IFCAP_TXTLS_RTLMT" | "IFCAP_TXTLS" + "IFCAP_TXTLS4" | "IFCAP_TXTLS6" | "IFCAP_VXLAN_HWCSUM" | "IFCAP_VXLAN_HWTSO" + | "IFCAP_TXTLS_RTLMT" | "IFCAP_TXTLS" if Some(13) > freebsd_ver => { true @@ -2358,6 +2417,7 @@ fn test_freebsd(target: &str) { // the struct "__kvm" is quite tricky to bind so since we only use a pointer to it // for now, it doesn't matter too much... "kvm_t" => true, + "eventfd_t" if Some(13) > freebsd_ver => true, _ => false, } @@ -2435,6 +2495,8 @@ fn test_freebsd(target: &str) { | "aio_readv" | "aio_writev" | "copy_file_range" + | "eventfd_read" + | "eventfd_write" if Some(13) > freebsd_ver => { true @@ -3185,10 +3247,8 @@ fn test_linux(target: &str) { } let arm = target.contains("arm"); + let aarch64 = target.contains("aarch64"); let i686 = target.contains("i686"); - let mips = target.contains("mips"); - let mips32 = mips && !target.contains("64"); - let mips64 = mips && target.contains("64"); let ppc = target.contains("powerpc"); let ppc64 = target.contains("powerpc64"); let s390x = target.contains("s390x"); @@ -3196,7 +3256,7 @@ fn test_linux(target: &str) { let x32 = target.contains("x32"); let x86_32 = target.contains("i686"); let x86_64 = target.contains("x86_64"); - let aarch64_musl = target.contains("aarch64") && musl; + let aarch64_musl = aarch64 && musl; let gnueabihf = target.contains("gnueabihf"); let x86_64_gnux32 = target.contains("gnux32") && x86_64; let riscv64 = target.contains("riscv64"); @@ -3225,6 +3285,7 @@ fn test_linux(target: &str) { "libgen.h", "limits.h", "link.h", + "linux/sysctl.h", "locale.h", "malloc.h", "mntent.h", @@ -3378,6 +3439,7 @@ fn test_linux(target: &str) { "sys/fanotify.h", // is not present on uclibc [!uclibc]: "sys/auxv.h", + [gnu]: "linux/close_range.h", } // note: aio.h must be included before sys/mount.h @@ -3549,6 +3611,27 @@ fn test_linux(target: &str) { // FIXME: requires >= 6.1 kernel headers "canxl_frame" => true, + + // FIXME: The size of `iv` has been changed since Linux v6.0 + // https://github.com/torvalds/linux/commit/94dfc73e7cf4a31da66b8843f0b9283ddd6b8381 + "af_alg_iv" => true, + + // FIXME: Requires >= 5.1 kernel headers. + // Everything that uses install-musl.sh has 4.19 kernel headers. + "tls12_crypto_info_aes_gcm_256" + if (aarch64 || arm || i686 || s390x || x86_64) && musl => + { + true + } + + // FIXME: Requires >= 5.11 kernel headers. + // Everything that uses install-musl.sh has 4.19 kernel headers. + "tls12_crypto_info_chacha20_poly1305" + if (aarch64 || arm || i686 || s390x || x86_64) && musl => + { + true + } + _ => false, } }); @@ -3665,16 +3748,11 @@ fn test_linux(target: &str) { | "IPPROTO_ETHERNET" | "IPPROTO_MPTCP" => true, - // FIXME: Not currently available in headers - "P_PIDFD" if mips => true, - "SYS_pidfd_open" if mips => true, - - // FIXME: Not currently available in headers on MIPS - // Not yet implemented on sparc64 - "SYS_clone3" if mips | sparc64 => true, + // FIXME: Not yet implemented on sparc64 + "SYS_clone3" if sparc64 => true, - // FIXME: Not defined on ARM, gnueabihf, MIPS, musl, PowerPC, riscv64, s390x, and sparc64. - "SYS_memfd_secret" if arm | gnueabihf | mips | musl | ppc | riscv64 | s390x | sparc64 => true, + // FIXME: Not defined on ARM, gnueabihf, musl, PowerPC, riscv64, s390x, and sparc64. + "SYS_memfd_secret" if arm | gnueabihf | musl | ppc | riscv64 | s390x | sparc64 => true, // FIXME: Added in Linux 5.16 // https://github.com/torvalds/linux/commit/039c0ec9bb77446d7ada7f55f90af9299b28ca49 @@ -3692,15 +3770,13 @@ fn test_linux(target: &str) { | "UINPUT_VERSION" | "SW_MAX" | "SW_CNT" - if mips || ppc64 || riscv64 => true, + if ppc64 || riscv64 => true, - // FIXME: Not currently available in headers on ARM, MIPS and musl. - "NETLINK_GET_STRICT_CHK" if arm || mips || musl => true, + // FIXME: Not currently available in headers on ARM and musl. + "NETLINK_GET_STRICT_CHK" if arm || musl => true, // kernel constants not available in uclibc 1.0.34 | "EXTPROC" - | "FAN_MARK_FILESYSTEM" - | "FAN_MARK_INODE" | "IPPROTO_BEETPH" | "IPPROTO_MPLS" | "IPV6_HDRINCL" @@ -3815,10 +3891,14 @@ fn test_linux(target: &str) { | "MADV_POPULATE_READ" | "MADV_POPULATE_WRITE" if musl => true, + "CLONE_CLEAR_SIGHAND" | "CLONE_INTO_CGROUP" => true, // kernel 6.1 minimum "MADV_COLLAPSE" => true, + // kernel 6.2 minimum + "TUN_F_USO4" | "TUN_F_USO6" | "IFF_NO_CARRIER" => true, + // FIXME: Requires more recent kernel headers | "IFLA_PARENT_DEV_NAME" // linux v5.13+ | "IFLA_PARENT_DEV_BUS_NAME" // linux v5.13+ @@ -3833,6 +3913,73 @@ fn test_linux(target: &str) { // FIXME: Requires more recent kernel headers "HWTSTAMP_TX_ONESTEP_P2P" if musl => true, // linux v5.6+ + // kernel 6.5 minimum + "MOVE_MOUNT_BENEATH" => true, + // FIXME: Requires linux 6.1 + "ALG_SET_KEY_BY_KEY_SERIAL" | "ALG_SET_DRBG_ENTROPY" => true, + + // FIXME: Requires more recent kernel headers + | "FAN_FS_ERROR" // linux v5.16+ + | "FAN_RENAME" // linux v5.17+ + | "FAN_REPORT_TARGET_FID" // linux v5.17+ + | "FAN_REPORT_DFID_NAME_TARGET" // linux v5.17+ + | "FAN_MARK_EVICTABLE" // linux v5.19+ + | "FAN_MARK_IGNORE" // linux v6.0+ + | "FAN_MARK_IGNORE_SURV" // linux v6.0+ + | "FAN_EVENT_INFO_TYPE_ERROR" // linux v5.16+ + | "FAN_EVENT_INFO_TYPE_OLD_DFID_NAME" // linux v5.17+ + | "FAN_EVENT_INFO_TYPE_NEW_DFID_NAME" // linux v5.17+ + | "FAN_RESPONSE_INFO_NONE" // linux v5.16+ + | "FAN_RESPONSE_INFO_AUDIT_RULE" // linux v5.16+ + | "FAN_INFO" // linux v5.16+ + => true, + + // FIXME: Requires linux 5.15+ + "FAN_REPORT_PIDFD" if musl => true, + + // FIXME: Requires linux 5.9+ + | "FAN_REPORT_DIR_FID" + | "FAN_REPORT_NAME" + | "FAN_REPORT_DFID_NAME" + | "FAN_EVENT_INFO_TYPE_DFID_NAME" + | "FAN_EVENT_INFO_TYPE_DFID" + | "FAN_EVENT_INFO_TYPE_PIDFD" + | "FAN_NOPIDFD" + | "FAN_EPIDFD" + if musl => true, + + // FIXME: Requires linux 6.5 + "NFT_MSG_MAX" => true, + + // FIXME: Requires >= 5.1 kernel headers. + // Everything that uses install-musl.sh has 4.19 kernel headers. + "TLS_1_3_VERSION" + | "TLS_1_3_VERSION_MAJOR" + | "TLS_1_3_VERSION_MINOR" + | "TLS_CIPHER_AES_GCM_256" + | "TLS_CIPHER_AES_GCM_256_IV_SIZE" + | "TLS_CIPHER_AES_GCM_256_KEY_SIZE" + | "TLS_CIPHER_AES_GCM_256_SALT_SIZE" + | "TLS_CIPHER_AES_GCM_256_TAG_SIZE" + | "TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE" + if (aarch64 || arm || i686 || s390x || x86_64) && musl => + { + true + } + + // FIXME: Requires >= 5.11 kernel headers. + // Everything that uses install-musl.sh has 4.19 kernel headers. + "TLS_CIPHER_CHACHA20_POLY1305" + | "TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE" + | "TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE" + | "TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE" + | "TLS_CIPHER_CHACHA20_POLY1305_TAG_SIZE" + | "TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE" + if (aarch64 || arm || i686 || s390x || x86_64) && musl => + { + true + } + _ => false, } }); @@ -3939,6 +4086,9 @@ fn test_linux(target: &str) { "posix_basename" if gnu => true, "gnu_basename" if gnu => true, + // FIXME: function pointers changed since Ubuntu 23.10 + "strtol" | "strtoll" | "strtoul" | "strtoull" | "fscanf" | "scanf" | "sscanf" => true, + _ => false, } }); @@ -4012,20 +4162,18 @@ fn test_linux(target: &str) { (struct_ == "sockaddr_vm" && field == "svm_zero") || // the `ifr_ifru` field is an anonymous union (struct_ == "ifreq" && field == "ifr_ifru") || + // the `ifc_ifcu` field is an anonymous union + (struct_ == "ifconf" && field == "ifc_ifcu") || // glibc uses a single array `uregs` instead of individual fields. (struct_ == "user_regs" && arm) }); cfg.skip_roundtrip(move |s| match s { - // FIXME: - "utsname" if mips32 || mips64 => true, // FIXME: "mcontext_t" if s390x => true, // FIXME: This is actually a union. "fpreg_t" if s390x => true, - "sockaddr_un" | "sembuf" | "ff_constant_effect" if mips32 && (gnu || musl) => true, - // The test doesn't work on some env: "ipv6_mreq" | "ip_mreq_source" @@ -4045,7 +4193,7 @@ fn test_linux(target: &str) { | "sockaddr_nl" | "termios" | "nlmsgerr" - if (mips64 || sparc64) && gnu => + if sparc64 && gnu => { true } @@ -4058,7 +4206,7 @@ fn test_linux(target: &str) { "cmsghdr" => true, // FIXME: the call ABI of max_align_t is incorrect on these platforms: - "max_align_t" if i686 || mips64 || ppc64 => true, + "max_align_t" if i686 || ppc64 => true, _ => false, }); diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 5153069559f68..6ab9ec6d49a6a 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -61,6 +61,7 @@ ALG_OP_DECRYPT ALG_OP_ENCRYPT ALG_SET_AEAD_ASSOCLEN ALG_SET_AEAD_AUTHSIZE +ALG_SET_DRBG_ENTROPY ALG_SET_IV ALG_SET_KEY ALG_SET_OP @@ -698,6 +699,7 @@ IFF_MASTER IFF_MULTICAST IFF_NOARP IFF_NOTRAILERS +IFF_NO_CARRIER IFF_NO_PI IFF_POINTOPOINT IFF_PORTSEL @@ -707,6 +709,13 @@ IFF_SLAVE IFF_TAP IFF_TUN IFF_UP +TUN_F_CSUM +TUN_F_TSO4 +TUN_F_TSO6 +TUN_F_TSO_ECN +TUN_F_UFO +TUN_F_USO4 +TUN_F_USO6 IFNAMSIZ IF_NAMESIZE IFA_UNSPEC @@ -3101,6 +3110,7 @@ ff_trigger fgetc fgetpos fgets +fgets_unlocked fgetxattr fileno flistxattr @@ -3116,6 +3126,7 @@ fprintf fputc fputs fread +fread_unlocked free freeaddrinfo freeifaddrs @@ -3144,6 +3155,7 @@ ftruncate ftruncate64 futimens fwrite +fwrite_unlocked gai_strerror genlmsghdr getaddrinfo @@ -3744,3 +3756,5 @@ write writev dirname basename +eventfd_read +eventfd_write diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index d70ce6fc24749..ef911271ff425 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -1883,6 +1883,7 @@ endpwent endservent endutxent exchangedata +execvP faccessat fchdir fchflags @@ -1957,6 +1958,9 @@ if_freenameindex if_msghdr if_nameindex ifaddrs +ifconf +ifkpi +ifreq image_offset in6_pktinfo in_pktinfo @@ -2080,6 +2084,8 @@ posix_spawnattr_setflags posix_spawnattr_setpgroup posix_spawnattr_setsigdefault posix_spawnattr_setsigmask +posix_spawnattr_getbinpref_np +posix_spawnattr_setbinpref_np posix_spawnattr_t posix_spawnp preadv diff --git a/libc-test/semver/dragonfly.txt b/libc-test/semver/dragonfly.txt index 1e1261cad8803..b9c8e7ee6180c 100644 --- a/libc-test/semver/dragonfly.txt +++ b/libc-test/semver/dragonfly.txt @@ -1287,6 +1287,8 @@ eui64_aton eui64_hostton eui64_ntoa eui64_ntohost +exect +execvP exit_status explicit_bzero faccessat @@ -1318,6 +1320,8 @@ getitimer getlastlogx getline getloadavg +getmntinfo +getmntvinfo getnameinfo getopt_long getpeereid @@ -1451,6 +1455,7 @@ pthread_condattr_getpshared pthread_condattr_setclock pthread_condattr_setpshared pthread_get_name_np +pthread_getname_np pthread_getcpuclockid pthread_kill pthread_main_np @@ -1460,6 +1465,7 @@ pthread_mutexattr_setpshared pthread_rwlockattr_getpshared pthread_rwlockattr_setpshared pthread_set_name_np +pthread_setname_np pthread_spin_destroy pthread_spin_init pthread_spin_lock diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index 0adb0dcf736e3..c20810f5e10a4 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -972,6 +972,8 @@ PROC_WX_MAPPINGS_PERMIT PROC_WXMAP_CTL PROC_WXMAP_STATUS PROC_WXORX_ENFORCE +PROT_MAX +PROT_MAX_EXTRACT PTHREAD_CREATE_DETACHED PTHREAD_CREATE_JOINABLE PTHREAD_MUTEX_ADAPTIVE_NP @@ -1770,6 +1772,8 @@ eui64_aton eui64_hostton eui64_ntoa eui64_ntohost +exect +execvP explicit_bzero extattr_delete_fd extattr_delete_file @@ -2025,6 +2029,7 @@ pthread_condattr_getpshared pthread_condattr_setclock pthread_condattr_setpshared pthread_get_name_np +pthread_getname_np pthread_getaffinity_np pthread_getcpuclockid pthread_getthreadid_np @@ -2040,6 +2045,7 @@ pthread_rwlockattr_getpshared pthread_rwlockattr_setpshared pthread_setaffinity_np pthread_set_name_np +pthread_setname_np pthread_getschedparam pthread_setschedparam pthread_spin_destroy @@ -2237,3 +2243,7 @@ xucred eaccess dirname basename +closefrom +close_range +eventfd_read +eventfd_write \ No newline at end of file diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index 59950d81903f4..ad971de731bad 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -31,6 +31,9 @@ BPF_FS_MAGIC BTRFS_SUPER_MAGIC CGROUP2_SUPER_MAGIC CGROUP_SUPER_MAGIC +CLONE_NEWTIME +CLONE_CLEAR_SIGHAND +CLONE_INTO_CGROUP CODA_SUPER_MAGIC CRAMFS_MAGIC DEAD_PROCESS @@ -137,6 +140,14 @@ MOD_OFFSET MOD_STATUS MOD_TAI MOD_TIMECONST +MOVE_MOUNT_BENEATH +MOVE_MOUNT_F_AUTOMOUNTS +MOVE_MOUNT_F_EMPTY_PATH +MOVE_MOUNT_F_SYMLINKS +MOVE_MOUNT_SET_GROUP +MOVE_MOUNT_T_AUTOMOUNTS +MOVE_MOUNT_T_EMPTY_PATH +MOVE_MOUNT_T_SYMLINKS MPOL_BIND MPOL_DEFAULT MPOL_F_NUMA_BALANCING @@ -665,3 +676,4 @@ getmntent_r putpwent putgrent execveat +close_range diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index b4091a707047d..52127c1d05312 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -71,8 +71,10 @@ ALG_OP_DECRYPT ALG_OP_ENCRYPT ALG_SET_AEAD_ASSOCLEN ALG_SET_AEAD_AUTHSIZE +ALG_SET_DRBG_ENTROPY ALG_SET_IV ALG_SET_KEY +ALG_SET_KEY_BY_KEY_SERIAL ALG_SET_OP ALT_DIGITS AM_STR @@ -717,6 +719,8 @@ FANOTIFY_METADATA_VERSION FAN_ACCESS FAN_ACCESS_PERM FAN_ALLOW +FAN_ATTRIB +FAN_AUDIT FAN_CLASS_CONTENT FAN_CLASS_NOTIF FAN_CLASS_PRE_CONTENT @@ -724,25 +728,60 @@ FAN_CLOEXEC FAN_CLOSE FAN_CLOSE_NOWRITE FAN_CLOSE_WRITE +FAN_CREATE +FAN_DELETE +FAN_DELETE_SELF FAN_DENY +FAN_ENABLE_AUDIT +FAN_EPIDFD +FAN_EVENT_INFO_TYPE_DFID +FAN_EVENT_INFO_TYPE_DFID_NAME +FAN_EVENT_INFO_TYPE_ERROR +FAN_EVENT_INFO_TYPE_FID +FAN_EVENT_INFO_TYPE_NEW_DFID_NAME +FAN_EVENT_INFO_TYPE_OLD_DFID_NAME +FAN_EVENT_INFO_TYPE_PIDFD FAN_EVENT_ON_CHILD +FAN_FS_ERROR +FAN_INFO FAN_MARK_ADD FAN_MARK_DONT_FOLLOW +FAN_MARK_EVICTABLE FAN_MARK_FILESYSTEM FAN_MARK_FLUSH +FAN_MARK_IGNORE FAN_MARK_IGNORED_MASK FAN_MARK_IGNORED_SURV_MODIFY +FAN_MARK_IGNORE_SURV FAN_MARK_INODE FAN_MARK_MOUNT FAN_MARK_ONLYDIR FAN_MARK_REMOVE FAN_MODIFY +FAN_MOVE +FAN_MOVED_FROM +FAN_MOVED_TO +FAN_MOVE_SELF FAN_NOFD FAN_NONBLOCK +FAN_NOPIDFD FAN_ONDIR FAN_OPEN +FAN_OPEN_EXEC +FAN_OPEN_EXEC_PERM FAN_OPEN_PERM FAN_Q_OVERFLOW +FAN_RENAME +FAN_REPORT_DFID_NAME +FAN_REPORT_DFID_NAME_TARGET +FAN_REPORT_DIR_FID +FAN_REPORT_FID +FAN_REPORT_NAME +FAN_REPORT_PIDFD +FAN_REPORT_TARGET_FID +FAN_REPORT_TID +FAN_RESPONSE_INFO_AUDIT_RULE +FAN_RESPONSE_INFO_NONE FAN_UNLIMITED_MARKS FAN_UNLIMITED_QUEUE FF0 @@ -893,8 +932,19 @@ IFF_LOWER_UP IFF_MASTER IFF_MULTICAST IFF_MULTI_QUEUE +IFF_NO_CARRIER IFF_NOARP IFF_NOFILTER +TUN_TX_TIMESTAMP +TUN_F_CSUM +TUN_F_TSO4 +TUN_F_TSO6 +TUN_F_TSO_ECN +TUN_F_UFO +TUN_F_USO4 +TUN_F_USO6 +TUN_PKT_STRIP +TUN_FLT_ALLMULTI IFF_NOTRAILERS IFF_NO_PI IFF_ONE_QUEUE @@ -906,6 +956,8 @@ IFF_RUNNING IFF_SLAVE IFF_TAP IFF_TUN +IFF_NAPI +IFF_NAPI_FRAGS IFF_TUN_EXCL IFF_UP IFF_VNET_HDR @@ -1375,6 +1427,7 @@ MCAST_MSFILTER MCAST_UNBLOCK_SOURCE MCL_CURRENT MCL_FUTURE +MCL_ONFAULT MEMBARRIER_CMD_GLOBAL MEMBARRIER_CMD_GLOBAL_EXPEDITED MEMBARRIER_CMD_QUERY @@ -1926,6 +1979,7 @@ PTHREAD_PRIO_PROTECT PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_SHARED PTHREAD_STACK_MIN +PTHREAD_ONCE_INIT PTRACE_ATTACH PTRACE_CONT PTRACE_DETACH @@ -1940,6 +1994,7 @@ PTRACE_EVENT_VFORK_DONE PTRACE_GETEVENTMSG PTRACE_GETREGSET PTRACE_GETSIGINFO +PTRACE_GETSIGMASK PTRACE_INTERRUPT PTRACE_KILL PTRACE_LISTEN @@ -1965,6 +2020,7 @@ PTRACE_SEIZE PTRACE_SETOPTIONS PTRACE_SETREGSET PTRACE_SETSIGINFO +PTRACE_SETSIGMASK PTRACE_SINGLESTEP PTRACE_SYSCALL PTRACE_TRACEME @@ -2854,7 +2910,34 @@ TIOCSCTTY TIOCSPGRP TIOCSSOFTCAR TIOCSTI +TLS_1_2_VERSION +TLS_1_2_VERSION_MAJOR +TLS_1_2_VERSION_MINOR +TLS_1_3_VERSION +TLS_1_3_VERSION_MAJOR +TLS_1_3_VERSION_MINOR +TLS_CIPHER_AES_GCM_128 +TLS_CIPHER_AES_GCM_128_IV_SIZE +TLS_CIPHER_AES_GCM_128_KEY_SIZE +TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE +TLS_CIPHER_AES_GCM_128_SALT_SIZE +TLS_CIPHER_AES_GCM_128_TAG_SIZE +TLS_CIPHER_AES_GCM_256 +TLS_CIPHER_AES_GCM_256_IV_SIZE +TLS_CIPHER_AES_GCM_256_KEY_SIZE +TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE +TLS_CIPHER_AES_GCM_256_SALT_SIZE +TLS_CIPHER_AES_GCM_256_TAG_SIZE +TLS_CIPHER_CHACHA20_POLY1305 +TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE +TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE +TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE +TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE +TLS_CIPHER_CHACHA20_POLY1305_TAG_SIZE TLS_GET_RECORD_TYPE +TLS_RX +TLS_SET_RECORD_TYPE +TLS_TX TUN_READQ_SIZE TUN_TAP_DEV TUN_TUN_DEV @@ -3197,6 +3280,7 @@ if_freenameindex if_nameindex ifaddrs ifreq +ifconf in6_ifreq in6_pktinfo in6_rtmsg @@ -3373,6 +3457,8 @@ pthread_barrier_wait pthread_barrier_destroy pthread_barrierattr_t pthread_barrier_t +pthread_once +pthread_once_t ptrace ptsname_r pwrite64 @@ -3525,3 +3611,5 @@ vhangup vmsplice wait4 waitid +eventfd_read +eventfd_write diff --git a/libc-test/semver/netbsd-mips.txt b/libc-test/semver/netbsd-mips.txt new file mode 100644 index 0000000000000..26d05a44b1163 --- /dev/null +++ b/libc-test/semver/netbsd-mips.txt @@ -0,0 +1,4 @@ +PT_GETREGS +PT_SETREGS +PT_GETFPREGS +PT_SETFPREGS diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt index 5fa24d0e8cf4f..495b56cc3611a 100644 --- a/libc-test/semver/netbsd.txt +++ b/libc-test/semver/netbsd.txt @@ -863,6 +863,19 @@ Q_SETQUOTA Q_SYNC RADIXCHAR RAND_MAX +RB_ASKNAME +RB_AUTOBOOT +RB_DUMP +RB_HALT +RB_INITNAME +RB_KDB +RB_MINIROOT +RB_NOSYNC +RB_POWERDOWN +RB_RDONLY +RB_SINGLE +RB_STRING +RB_USERCONF REG_ASSERT REG_ATOI REG_BACKR @@ -957,6 +970,7 @@ SOCK_RDM SOMAXCONN SO_ACCEPTFILTER SO_NOHEADER +SO_NOSIGPIPE SO_OVERFLOWED SO_REUSEPORT SO_TIMESTAMP @@ -1465,6 +1479,7 @@ readdir_r readlinkat reallocarr reallocarray +reboot recvmmsg recvmsg regcomp diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt index e56760a9e8118..7843f6af10c87 100644 --- a/libc-test/semver/openbsd.txt +++ b/libc-test/semver/openbsd.txt @@ -704,6 +704,20 @@ Q_SETQUOTA Q_SYNC RADIXCHAR RAND_MAX +RB_ASKNAME +RB_AUTOBOOT +RB_CONFIG +RB_DUMP +RB_GOODRANDOM +RB_HALT +RB_KDB +RB_INITNAME +RB_POWERDOWN +RB_RESET +RB_SERCONS +RB_TIMEBAD +RB_UNHIBERNATE +RB_USERREQ REG_ASSERT REG_ATOI REG_BACKR @@ -1083,6 +1097,7 @@ if_freenameindex if_msghdr if_nameindex ifaddrs +ifreq in6_pktinfo initgroups ip_mreqn @@ -1173,6 +1188,7 @@ rand readdir_r readlinkat reallocarray +reboot recvmsg regcomp regerror diff --git a/libc-test/semver/redox.txt b/libc-test/semver/redox.txt index 6e73d0ac25f7d..5f85e1aa7f3d4 100644 --- a/libc-test/semver/redox.txt +++ b/libc-test/semver/redox.txt @@ -180,6 +180,7 @@ bsearch chroot clearerr difftime +endgrent endpwent endservent epoll_create @@ -191,7 +192,10 @@ explicit_bzero fchdir fmemopen getdtablesize +getgrent +getgrgid getgrgid_r +getgrnam getgrnam_r getgrouplist getline @@ -212,6 +216,7 @@ pipe2 pthread_condattr_setclock qsort reallocarray +setgrent setpwent setrlimit setservent diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index e8c8719f9cbac..7e76db6f1f7d5 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -2811,7 +2811,10 @@ pub const POSIX_MADV_DONTNEED: ::c_int = 4; pub const RLIM_INFINITY: ::rlim_t = !0; pub const RLIMIT_RTTIME: ::c_int = 15; +#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIMIT_NLIMITS: ::c_int = 16; +#[allow(deprecated)] +#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::c_int = RLIMIT_NLIMITS; pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; @@ -4101,7 +4104,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; pub fn reboot(how_to: ::c_int) -> ::c_int; diff --git a/src/lib.rs b/src/lib.rs index dc8f8312072e5..1b6f0c077ab24 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,4 @@ //! libc - Raw FFI bindings to platforms' system libraries -//! -//! [Documentation for other platforms][pd]. -//! -//! [pd]: https://rust-lang.github.io/libc/#platform-specific-documentation #![crate_name = "libc"] #![crate_type = "rlib"] #![allow( diff --git a/src/teeos/mod.rs b/src/teeos/mod.rs index 13d8ce1b8ffd2..cffe041976573 100644 --- a/src/teeos/mod.rs +++ b/src/teeos/mod.rs @@ -8,6 +8,8 @@ // only supported on Rust > 1.59, so we can directly reexport c_void from core. pub use core::ffi::c_void; +use Option; + pub type c_schar = i8; pub type c_uchar = u8; diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index bc02b108dc412..0fc923d6072f0 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -1,7 +1,6 @@ pub type c_char = i8; pub type caddr_t = *mut ::c_char; -// FIXME: clockid_t must be c_long, but time.rs accepts only i32 -pub type clockid_t = ::c_int; +pub type clockid_t = ::c_longlong; pub type blkcnt_t = ::c_long; pub type clock_t = ::c_int; pub type daddr_t = ::c_long; @@ -1762,6 +1761,7 @@ pub const PRIO_USER: ::c_int = 2; pub const RUSAGE_THREAD: ::c_int = 1; pub const RLIM_SAVED_MAX: ::c_ulong = RLIM_INFINITY - 1; pub const RLIM_SAVED_CUR: ::c_ulong = RLIM_INFINITY - 2; +#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::c_int = 10; // sys/sched.h @@ -2889,7 +2889,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::size_t, serv: *mut ::c_char, - sevlen: ::size_t, + servlen: ::size_t, flags: ::c_int, ) -> ::c_int; pub fn getpagesize() -> ::c_int; @@ -3274,7 +3274,13 @@ extern "C" { pub fn splice(socket1: ::c_int, socket2: ::c_int, flags: ::c_int) -> ::c_int; pub fn srand(seed: ::c_uint); pub fn srand48(seed: ::c_long); - pub fn stat64(path: *const c_char, buf: *mut stat64) -> ::c_int; + pub fn stat64(path: *const ::c_char, buf: *mut stat64) -> ::c_int; + pub fn stat64at( + dirfd: ::c_int, + path: *const ::c_char, + buf: *mut stat64, + flags: ::c_int, + ) -> ::c_int; pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int; pub fn statfs64(path: *const ::c_char, buf: *mut statfs64) -> ::c_int; pub fn statvfs64(path: *const ::c_char, buf: *mut statvfs64) -> ::c_int; diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index b22b40ef9b374..79c5641d47813 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -797,7 +797,7 @@ s! { pub struct sockaddr_ndrv { pub snd_len: ::c_uchar, pub snd_family: ::c_uchar, - pub snd_name: [::c_uchar; 16] // IFNAMSIZ from if.h + pub snd_name: [::c_uchar; ::IFNAMSIZ], } // sys/socket.h @@ -1129,6 +1129,15 @@ s! { pub validattr: attribute_set_t, pub nativeattr: attribute_set_t, } + + #[cfg_attr(libc_packedN, repr(packed(4)))] + pub struct ifconf { + pub ifc_len: ::c_int, + #[cfg(libc_union)] + pub ifc_ifcu: __c_anonymous_ifc_ifcu, + #[cfg(not(libc_union))] + pub ifc_ifcu: *mut ifreq, + } } s_no_extra_traits! { @@ -1419,6 +1428,60 @@ s_no_extra_traits! { pub svm_port: ::c_uint, pub svm_cid: ::c_uint, } + + pub struct ifdevmtu { + pub ifdm_current: ::c_int, + pub ifdm_min: ::c_int, + pub ifdm_max: ::c_int, + } + + #[cfg(libc_union)] + pub union __c_anonymous_ifk_data { + pub ifk_ptr: *mut ::c_void, + pub ifk_value: ::c_int, + } + + #[cfg_attr(libc_packedN, repr(packed(4)))] + pub struct ifkpi { + pub ifk_module_id: ::c_uint, + pub ifk_type: ::c_uint, + #[cfg(libc_union)] + pub ifk_data: __c_anonymous_ifk_data, + } + + #[cfg(libc_union)] + pub union __c_anonymous_ifr_ifru { + pub ifru_addr: ::sockaddr, + pub ifru_dstaddr: ::sockaddr, + pub ifru_broadaddr: ::sockaddr, + pub ifru_flags: ::c_short, + pub ifru_metrics: ::c_int, + pub ifru_mtu: ::c_int, + pub ifru_phys: ::c_int, + pub ifru_media: ::c_int, + pub ifru_intval: ::c_int, + pub ifru_data: *mut ::c_char, + pub ifru_devmtu: ifdevmtu, + pub ifru_kpi: ifkpi, + pub ifru_wake_flags: u32, + pub ifru_route_refcnt: u32, + pub ifru_cap: [::c_int; 2], + pub ifru_functional_type: u32, + } + + pub struct ifreq { + pub ifr_name: [::c_char; ::IFNAMSIZ], + #[cfg(libc_union)] + pub ifr_ifru: __c_anonymous_ifr_ifru, + #[cfg(not(libc_union))] + pub ifr_ifru: ::sockaddr, + } + + #[cfg(libc_union)] + pub union __c_anonymous_ifc_ifcu { + pub ifcu_buf: *mut ::c_char, + pub ifcu_req: *mut ifreq, + } } impl siginfo_t { @@ -2767,6 +2830,222 @@ cfg_if! { svm_cid.hash(state); } } + + impl PartialEq for ifdevmtu { + fn eq(&self, other: &ifdevmtu) -> bool { + self.ifdm_current == other.ifdm_current + && self.ifdm_min == other.ifdm_min + && self.ifdm_max == other.ifdm_max + } + } + + impl Eq for ifdevmtu {} + + impl ::fmt::Debug for ifdevmtu { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ifdevmtu") + .field("ifdm_current", &self.ifdm_current) + .field("ifdm_min", &self.ifdm_min) + .field("ifdm_max", &self.ifdm_max) + .finish() + } + } + + impl ::hash::Hash for ifdevmtu { + fn hash(&self, state: &mut H) { + self.ifdm_current.hash(state); + self.ifdm_min.hash(state); + self.ifdm_max.hash(state); + } + } + + #[cfg(libc_union)] + impl PartialEq for __c_anonymous_ifk_data { + fn eq(&self, other: &__c_anonymous_ifk_data) -> bool { + unsafe { + self.ifk_ptr == other.ifk_ptr + && self.ifk_value == other.ifk_value + } + } + } + + #[cfg(libc_union)] + impl Eq for __c_anonymous_ifk_data {} + + #[cfg(libc_union)] + impl ::fmt::Debug for __c_anonymous_ifk_data { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("__c_anonymous_ifk_data") + .field("ifk_ptr", unsafe { &self.ifk_ptr }) + .field("ifk_value", unsafe { &self.ifk_value }) + .finish() + } + } + #[cfg(libc_union)] + impl ::hash::Hash for __c_anonymous_ifk_data { + fn hash(&self, state: &mut H) { + unsafe { + self.ifk_ptr.hash(state); + self.ifk_value.hash(state); + } + } + } + + impl PartialEq for ifkpi { + fn eq(&self, other: &ifkpi) -> bool { + self.ifk_module_id == other.ifk_module_id + && self.ifk_type == other.ifk_type + } + } + + impl Eq for ifkpi {} + + impl ::fmt::Debug for ifkpi { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ifkpi") + .field("ifk_module_id", &self.ifk_module_id) + .field("ifk_type", &self.ifk_type) + .finish() + } + } + + impl ::hash::Hash for ifkpi { + fn hash(&self, state: &mut H) { + self.ifk_module_id.hash(state); + self.ifk_type.hash(state); + } + } + + #[cfg(libc_union)] + impl PartialEq for __c_anonymous_ifr_ifru { + fn eq(&self, other: &__c_anonymous_ifr_ifru) -> bool { + unsafe { + self.ifru_addr == other.ifru_addr + && self.ifru_dstaddr == other.ifru_dstaddr + && self.ifru_broadaddr == other.ifru_broadaddr + && self.ifru_flags == other.ifru_flags + && self.ifru_metrics == other.ifru_metrics + && self.ifru_mtu == other.ifru_mtu + && self.ifru_phys == other.ifru_phys + && self.ifru_media == other.ifru_media + && self.ifru_intval == other.ifru_intval + && self.ifru_data == other.ifru_data + && self.ifru_devmtu == other.ifru_devmtu + && self.ifru_kpi == other.ifru_kpi + && self.ifru_wake_flags == other.ifru_wake_flags + && self.ifru_route_refcnt == other.ifru_route_refcnt + && self.ifru_cap.iter().zip(other.ifru_cap.iter()).all(|(a,b)| a == b) + && self.ifru_functional_type == other.ifru_functional_type + } + } + } + + #[cfg(libc_union)] + impl Eq for __c_anonymous_ifr_ifru {} + + #[cfg(libc_union)] + impl ::fmt::Debug for __c_anonymous_ifr_ifru { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("__c_anonymous_ifr_ifru") + .field("ifru_addr", unsafe { &self.ifru_addr }) + .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) + .field("ifru_broadaddr", unsafe { &self.ifru_broadaddr }) + .field("ifru_flags", unsafe { &self.ifru_flags }) + .field("ifru_metrics", unsafe { &self.ifru_metrics }) + .field("ifru_mtu", unsafe { &self.ifru_mtu }) + .field("ifru_phys", unsafe { &self.ifru_phys }) + .field("ifru_media", unsafe { &self.ifru_media }) + .field("ifru_intval", unsafe { &self.ifru_intval }) + .field("ifru_data", unsafe { &self.ifru_data }) + .field("ifru_devmtu", unsafe { &self.ifru_devmtu }) + .field("ifru_kpi", unsafe { &self.ifru_kpi }) + .field("ifru_wake_flags", unsafe { &self.ifru_wake_flags }) + .field("ifru_route_refcnt", unsafe { &self.ifru_route_refcnt }) + .field("ifru_cap", unsafe { &self.ifru_cap }) + .field("ifru_functional_type", unsafe { &self.ifru_functional_type }) + .finish() + } + } + + #[cfg(libc_union)] + impl ::hash::Hash for __c_anonymous_ifr_ifru { + fn hash(&self, state: &mut H) { + unsafe { + self.ifru_addr.hash(state); + self.ifru_dstaddr.hash(state); + self.ifru_broadaddr.hash(state); + self.ifru_flags.hash(state); + self.ifru_metrics.hash(state); + self.ifru_mtu.hash(state); + self.ifru_phys.hash(state); + self.ifru_media.hash(state); + self.ifru_intval.hash(state); + self.ifru_data.hash(state); + self.ifru_devmtu.hash(state); + self.ifru_kpi.hash(state); + self.ifru_wake_flags.hash(state); + self.ifru_route_refcnt.hash(state); + self.ifru_cap.hash(state); + self.ifru_functional_type.hash(state); + } + } + } + + impl PartialEq for ifreq { + fn eq(&self, other: &ifreq) -> bool { + self.ifr_name == other.ifr_name + && self.ifr_ifru == other.ifr_ifru + } + } + + impl Eq for ifreq {} + + impl ::fmt::Debug for ifreq { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ifreq") + .field("ifr_name", &self.ifr_name) + .field("ifr_ifru", &self.ifr_ifru) + .finish() + } + } + + impl ::hash::Hash for ifreq { + fn hash(&self, state: &mut H) { + self.ifr_name.hash(state); + self.ifr_ifru.hash(state); + } + } + + #[cfg(libc_union)] + impl Eq for __c_anonymous_ifc_ifcu {} + + #[cfg(libc_union)] + impl PartialEq for __c_anonymous_ifc_ifcu { + fn eq(&self, other: &__c_anonymous_ifc_ifcu) -> bool { + unsafe { + self.ifcu_buf == other.ifcu_buf && + self.ifcu_req == other.ifcu_req + } + } + } + + #[cfg(libc_union)] + impl ::fmt::Debug for __c_anonymous_ifc_ifcu { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ifc_ifcu") + .field("ifcu_buf", unsafe { &self.ifcu_buf }) + .field("ifcu_req", unsafe { &self.ifcu_req }) + .finish() + } + } + + #[cfg(libc_union)] + impl ::hash::Hash for __c_anonymous_ifc_ifcu { + fn hash(&self, state: &mut H) { + unsafe { self.ifcu_buf.hash(state) }; + unsafe { self.ifcu_req.hash(state) }; + } + } } } @@ -4719,12 +4998,12 @@ pub const MNT_SNAPSHOT: ::c_int = 0x40000000; pub const MNT_NOBLOCK: ::c_int = 0x00020000; // sys/spawn.h: -pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01; -pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02; -pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x04; -pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x08; -pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x40; -pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x80; +pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x0001; +pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x0002; +pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x0004; +pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x0008; +pub const POSIX_SPAWN_SETEXEC: ::c_int = 0x0040; +pub const POSIX_SPAWN_START_SUSPENDED: ::c_int = 0x0080; pub const POSIX_SPAWN_CLOEXEC_DEFAULT: ::c_int = 0x4000; // sys/ipc.h: @@ -5343,7 +5622,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; pub fn mincore(addr: *const ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int; @@ -5779,6 +6058,18 @@ extern "C" { subpref: *mut ::cpu_subtype_t, ocount: *mut ::size_t, ) -> ::c_int; + pub fn posix_spawnattr_getbinpref_np( + attr: *const posix_spawnattr_t, + count: ::size_t, + pref: *mut ::cpu_type_t, + ocount: *mut ::size_t, + ) -> ::c_int; + pub fn posix_spawnattr_setbinpref_np( + attr: *mut posix_spawnattr_t, + count: ::size_t, + pref: *mut ::cpu_type_t, + ocount: *mut ::size_t, + ) -> ::c_int; pub fn posix_spawnattr_set_qos_class_np( attr: *mut posix_spawnattr_t, qos_class: ::qos_class_t, @@ -6117,6 +6408,11 @@ extern "C" { dev: dev_t, ) -> ::c_int; pub fn freadlink(fd: ::c_int, buf: *mut ::c_char, size: ::size_t) -> ::c_int; + pub fn execvP( + file: *const ::c_char, + search_path: *const ::c_char, + argv: *const *mut ::c_char, + ) -> ::c_int; } pub unsafe fn mach_task_self() -> ::mach_port_t { diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index b3a5be4494543..6ade7949afb0f 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -1678,6 +1678,12 @@ extern "C" { pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; pub fn basename(path: *mut ::c_char) -> *mut ::c_char; + pub fn getmntinfo(mntbufp: *mut *mut ::statfs, flags: ::c_int) -> ::c_int; + pub fn getmntvinfo( + mntbufp: *mut *mut ::statfs, + mntvbufp: *mut *mut ::statvfs, + flags: ::c_int, + ) -> ::c_int; } #[link(name = "rt")] diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index c8403d1cf369d..feaabc5b9b78b 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -48,6 +48,8 @@ pub type cpusetid_t = ::c_int; pub type sctp_assoc_t = u32; +pub type eventfd_t = u64; + #[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))] #[repr(u32)] pub enum devstat_support_flags { @@ -365,9 +367,13 @@ s! { } pub struct cpuset_t { - #[cfg(target_pointer_width = "64")] + #[cfg(all(freebsd14, target_pointer_width = "64"))] + __bits: [::c_long; 16], + #[cfg(all(freebsd14, target_pointer_width = "32"))] + __bits: [::c_long; 32], + #[cfg(all(not(freebsd14), target_pointer_width = "64"))] __bits: [::c_long; 4], - #[cfg(target_pointer_width = "32")] + #[cfg(all(not(freebsd14), target_pointer_width = "32"))] __bits: [::c_long; 8], } @@ -967,6 +973,8 @@ s! { pub ifc_len: ::c_int, #[cfg(libc_union)] pub ifc_ifcu: __c_anonymous_ifc_ifcu, + #[cfg(not(libc_union))] + pub ifc_ifcu: *mut ifreq, } pub struct au_mask_t { @@ -996,6 +1004,8 @@ s! { pub pcbcnt: u32, } + // Note: this structure will change in a backwards-incompatible way in + // FreeBSD 15. pub struct tcp_info { pub tcpi_state: u8, pub __tcpi_ca_state: u8, @@ -1053,7 +1063,21 @@ s! { #[cfg(freebsd14)] pub __tcpi_received_ce_bytes: u32, #[cfg(freebsd14)] - pub __tcpi_pad: [u32; 19], + pub tcpi_total_tlp: u32, + #[cfg(freebsd14)] + pub tcpi_total_tlp_bytes: u64, + #[cfg(freebsd14)] + pub tcpi_snd_una: u32, + #[cfg(freebsd14)] + pub tcpi_snd_max: u32, + #[cfg(freebsd14)] + pub tcpi_rcv_numsacks: u32, + #[cfg(freebsd14)] + pub tcpi_rcv_adv: u32, + #[cfg(freebsd14)] + pub tcpi_dupacks: u32, + #[cfg(freebsd14)] + pub __tcpi_pad: [u32; 10], #[cfg(not(freebsd14))] pub __tcpi_pad: [u32; 26], } @@ -2597,7 +2621,13 @@ pub const DEVSTAT_N_TRANS_FLAGS: ::c_int = 4; pub const DEVSTAT_NAME_LEN: ::c_int = 16; // sys/cpuset.h -pub const CPU_SETSIZE: ::c_int = 256; +cfg_if! { + if #[cfg(freebsd14)] { + pub const CPU_SETSIZE: ::c_int = 1024; + } else { + pub const CPU_SETSIZE: ::c_int = 256; + } +} pub const SIGEV_THREAD_ID: ::c_int = 4; @@ -3170,6 +3200,7 @@ pub const IFF_LOOPBACK: ::c_int = 0x8; /// (i) is a point-to-point link pub const IFF_POINTOPOINT: ::c_int = 0x10; /// (i) calls if_input in net epoch +#[deprecated(since = "0.2.149", note = "Removed in FreeBSD 14")] pub const IFF_KNOWSEPOCH: ::c_int = 0x20; /// (d) resources allocated pub const IFF_RUNNING: ::c_int = 0x40; @@ -3217,6 +3248,7 @@ pub const IFF_DYING: ::c_int = 0x200000; /// (n) interface is being renamed pub const IFF_RENAMING: ::c_int = 0x400000; /// interface is not part of any groups +#[deprecated(since = "0.2.149", note = "Removed in FreeBSD 14")] pub const IFF_NOGROUP: ::c_int = 0x800000; /// link invalid/unknown @@ -4827,6 +4859,14 @@ f! { }; ::mem::size_of::() + ::mem::size_of::<::gid_t>() * ngrps } + + pub fn PROT_MAX(x: ::c_int) -> ::c_int { + x << 16 + } + + pub fn PROT_MAX_EXTRACT(x: ::c_int) -> ::c_int { + (x >> 16) & (::PROT_READ | ::PROT_WRITE | ::PROT_EXEC) + } } safe_f! { @@ -5345,6 +5385,8 @@ extern "C" { pub fn setaudit(auditinfo: *const auditinfo_t) -> ::c_int; pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; + pub fn eventfd_read(fd: ::c_int, value: *mut eventfd_t) -> ::c_int; + pub fn eventfd_write(fd: ::c_int, value: eventfd_t) -> ::c_int; pub fn fdatasync(fd: ::c_int) -> ::c_int; @@ -5422,6 +5464,8 @@ extern "C" { new_value: *const itimerspec, old_value: *mut itimerspec, ) -> ::c_int; + pub fn closefrom(lowfd: ::c_int); + pub fn close_range(lowfd: ::c_uint, highfd: ::c_uint, flags: ::c_int) -> ::c_int; } #[link(name = "memstat")] diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 8eb4a8e7bf480..d2cd7794b107e 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1646,6 +1646,12 @@ extern "C" { pub fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> ::c_int; pub fn pthread_get_name_np(tid: ::pthread_t, name: *mut ::c_char, len: ::size_t); pub fn pthread_set_name_np(tid: ::pthread_t, name: *const ::c_char); + pub fn pthread_getname_np( + thread: ::pthread_t, + buffer: *mut ::c_char, + length: ::size_t, + ) -> ::c_int; + pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int; pub fn pthread_setschedparam( native: ::pthread_t, policy: ::c_int, @@ -1772,6 +1778,17 @@ extern "C" { len: ::c_int, ) -> ::c_int; pub fn reboot(howto: ::c_int) -> ::c_int; + + pub fn exect( + path: *const ::c_char, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char, + ) -> ::c_int; + pub fn execvP( + file: *const ::c_char, + search_path: *const ::c_char, + argv: *const *mut ::c_char, + ) -> ::c_int; } #[link(name = "rt")] diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index c43a4b9e8e4e3..07dc39be54e36 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -646,6 +646,10 @@ pub const TIOCM_RI: ::c_int = TIOCM_RNG; pub const TIMER_ABSTIME: ::c_int = 1; +// sys/reboot.h + +pub const RB_AUTOBOOT: ::c_int = 0; + #[link(name = "util")] extern "C" { pub fn setgrent(); @@ -736,6 +740,11 @@ extern "C" { pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void; pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int; pub fn shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int; + pub fn execvpe( + file: *const ::c_char, + argv: *const *const ::c_char, + envp: *const *const ::c_char, + ) -> ::c_int; } extern "C" { diff --git a/src/unix/bsd/netbsdlike/netbsd/mips.rs b/src/unix/bsd/netbsdlike/netbsd/mips.rs new file mode 100644 index 0000000000000..a536254ceb4b3 --- /dev/null +++ b/src/unix/bsd/netbsdlike/netbsd/mips.rs @@ -0,0 +1,21 @@ +use PT_FIRSTMACH; + +pub type c_long = i32; +pub type c_ulong = u32; +pub type c_char = i8; +pub type __cpu_simple_lock_nv_t = ::c_int; + +cfg_if! { + if #[cfg(libc_const_size_of)] { + #[doc(hidden)] + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1; + } else { + #[doc(hidden)] + pub const _ALIGNBYTES: usize = 8 - 1; + } +} + +pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; +pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2; +pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3; +pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index bd5161893a864..a65035d348f9b 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -10,7 +10,7 @@ type __pthread_spin_t = __cpu_simple_lock_nv_t; pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time pub type lwpid_t = ::c_uint; pub type shmatt_t = ::c_uint; -pub type cpuid_t = u64; +pub type cpuid_t = ::c_ulong; pub type cpuset_t = _cpuset; pub type pthread_spin_t = ::c_uchar; pub type timer_t = ::c_int; @@ -60,6 +60,39 @@ impl siginfo_t { self.si_addr } + pub unsafe fn si_code(&self) -> ::c_int { + self.si_code + } + + pub unsafe fn si_errno(&self) -> ::c_int { + self.si_errno + } + + pub unsafe fn si_pid(&self) -> ::pid_t { + #[repr(C)] + struct siginfo_timer { + _si_signo: ::c_int, + _si_errno: ::c_int, + _si_code: ::c_int, + __pad1: ::c_int, + _pid: ::pid_t, + } + (*(self as *const siginfo_t as *const siginfo_timer))._pid + } + + pub unsafe fn si_uid(&self) -> ::uid_t { + #[repr(C)] + struct siginfo_timer { + _si_signo: ::c_int, + _si_errno: ::c_int, + _si_code: ::c_int, + __pad1: ::c_int, + _pid: ::pid_t, + _uid: ::uid_t, + } + (*(self as *const siginfo_t as *const siginfo_timer))._uid + } + pub unsafe fn si_value(&self) -> ::sigval { #[repr(C)] struct siginfo_timer { @@ -1527,6 +1560,7 @@ pub const SOCK_FLAGS_MASK: ::c_int = 0xf0000000; pub const SO_SNDTIMEO: ::c_int = 0x100b; pub const SO_RCVTIMEO: ::c_int = 0x100c; +pub const SO_NOSIGPIPE: ::c_int = 0x0800; pub const SO_ACCEPTFILTER: ::c_int = 0x1000; pub const SO_TIMESTAMP: ::c_int = 0x2000; pub const SO_OVERFLOWED: ::c_int = 0x1009; @@ -2400,6 +2434,20 @@ pub const GRND_NONBLOCK: ::c_uint = 0x1; pub const GRND_RANDOM: ::c_uint = 0x2; pub const GRND_INSECURE: ::c_uint = 0x4; +// sys/reboot.h +pub const RB_ASKNAME: ::c_int = 0x000000001; +pub const RB_SINGLE: ::c_int = 0x000000002; +pub const RB_NOSYNC: ::c_int = 0x000000004; +pub const RB_HALT: ::c_int = 0x000000008; +pub const RB_INITNAME: ::c_int = 0x000000010; +pub const RB_KDB: ::c_int = 0x000000040; +pub const RB_RDONLY: ::c_int = 0x000000080; +pub const RB_DUMP: ::c_int = 0x000000100; +pub const RB_MINIROOT: ::c_int = 0x000000200; +pub const RB_STRING: ::c_int = 0x000000400; +pub const RB_POWERDOWN: ::c_int = RB_HALT | 0x000000800; +pub const RB_USERCONF: ::c_int = 0x000001000; + cfg_if! { if #[cfg(libc_const_extern_fn)] { @@ -2532,12 +2580,6 @@ extern "C" { pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int; pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int; - pub fn execvpe( - file: *const ::c_char, - argv: *const *const ::c_char, - envp: *const *const ::c_char, - ) -> ::c_int; - pub fn extattr_list_fd( fd: ::c_int, attrnamespace: ::c_int, @@ -2646,7 +2688,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; @@ -2956,6 +2998,8 @@ extern "C" { newfd: ::c_int, ) -> ::c_int; pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; + + pub fn reboot(mode: ::c_int, bootstr: *mut ::c_char) -> ::c_int; } #[link(name = "rt")] @@ -3208,6 +3252,12 @@ cfg_if! { } else if #[cfg(target_arch = "x86")] { mod x86; pub use self::x86::*; + } else if #[cfg(target_arch = "mips")] { + mod mips; + pub use self::mips::*; + } else if #[cfg(target_arch = "riscv64")] { + mod riscv64; + pub use self::riscv64::*; } else { // Unknown target_arch } diff --git a/src/unix/bsd/netbsdlike/netbsd/riscv64.rs b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs new file mode 100644 index 0000000000000..bc09149efeabd --- /dev/null +++ b/src/unix/bsd/netbsdlike/netbsd/riscv64.rs @@ -0,0 +1,21 @@ +use PT_FIRSTMACH; + +pub type c_long = i64; +pub type c_ulong = u64; +pub type c_char = u8; +pub type __cpu_simple_lock_nv_t = ::c_int; + +cfg_if! { + if #[cfg(libc_const_size_of)] { + #[doc(hidden)] + pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1; + } else { + #[doc(hidden)] + pub const _ALIGNBYTES: usize = 8 - 1; + } +} + +pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0; +pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1; +pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2; +pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3; diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index 38fa29c97e02b..17dfa6571568f 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -533,6 +533,14 @@ s! { pub key: *mut ::c_char, pub data: *mut ::c_void, } + + pub struct ifreq { + pub ifr_name: [::c_char; ::IFNAMSIZ], + #[cfg(libc_union)] + pub ifr_ifru: __c_anonymous_ifr_ifru, + #[cfg(not(libc_union))] + pub ifr_ifru: ::sockaddr, + } } impl siginfo_t { @@ -540,12 +548,46 @@ impl siginfo_t { self.si_addr } - pub unsafe fn si_value(&self) -> ::sigval { + pub unsafe fn si_code(&self) -> ::c_int { + self.si_code + } + + pub unsafe fn si_errno(&self) -> ::c_int { + self.si_errno + } + + pub unsafe fn si_pid(&self) -> ::pid_t { #[repr(C)] struct siginfo_timer { _si_signo: ::c_int, + _si_code: ::c_int, _si_errno: ::c_int, + _pad: [::c_int; SI_PAD], + _pid: ::pid_t, + } + (*(self as *const siginfo_t as *const siginfo_timer))._pid + } + + pub unsafe fn si_uid(&self) -> ::uid_t { + #[repr(C)] + struct siginfo_timer { + _si_signo: ::c_int, + _si_code: ::c_int, + _si_errno: ::c_int, + _pad: [::c_int; SI_PAD], + _pid: ::pid_t, + _uid: ::uid_t, + } + (*(self as *const siginfo_t as *const siginfo_timer))._uid + } + + pub unsafe fn si_value(&self) -> ::sigval { + #[repr(C)] + struct siginfo_timer { + _si_signo: ::c_int, _si_code: ::c_int, + _si_errno: ::c_int, + _pad: [::c_int; SI_PAD], _pid: ::pid_t, _uid: ::uid_t, value: ::sigval, @@ -608,6 +650,18 @@ s_no_extra_traits! { align: [::c_char; 160], } + #[cfg(libc_union)] + pub union __c_anonymous_ifr_ifru { + pub ifru_addr: ::sockaddr, + pub ifru_dstaddr: ::sockaddr, + pub ifru_broadaddr: ::sockaddr, + pub ifru_flags: ::c_short, + pub ifru_metric: ::c_int, + pub ifru_vnetid: i64, + pub ifru_media: u64, + pub ifru_data: ::caddr_t, + pub ifru_index: ::c_uint, + } } cfg_if! { @@ -814,6 +868,60 @@ cfg_if! { unsafe { self.align.hash(state) }; } } + + #[cfg(libc_union)] + impl PartialEq for __c_anonymous_ifr_ifru { + fn eq(&self, other: &__c_anonymous_ifr_ifru) -> bool { + unsafe { + self.ifru_addr == other.ifru_addr + && self.ifru_dstaddr == other.ifru_dstaddr + && self.ifru_broadaddr == other.ifru_broadaddr + && self.ifru_flags == other.ifru_flags + && self.ifru_metric == other.ifru_metric + && self.ifru_vnetid == other.ifru_vnetid + && self.ifru_media == other.ifru_media + && self.ifru_data == other.ifru_data + && self.ifru_index == other.ifru_index + } + } + } + + #[cfg(libc_union)] + impl Eq for __c_anonymous_ifr_ifru {} + + #[cfg(libc_union)] + impl ::fmt::Debug for __c_anonymous_ifr_ifru { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("__c_anonymous_ifr_ifru") + .field("ifru_addr", unsafe { &self.ifru_addr }) + .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) + .field("ifru_broadaddr", unsafe { &self.ifru_broadaddr }) + .field("ifru_flags", unsafe { &self.ifru_flags }) + .field("ifru_metric", unsafe { &self.ifru_metric }) + .field("ifru_vnetid", unsafe { &self.ifru_vnetid }) + .field("ifru_media", unsafe { &self.ifru_media }) + .field("ifru_data", unsafe { &self.ifru_data }) + .field("ifru_index", unsafe { &self.ifru_index }) + .finish() + } + } + + #[cfg(libc_union)] + impl ::hash::Hash for __c_anonymous_ifr_ifru { + fn hash(&self, state: &mut H) { + unsafe { + self.ifru_addr.hash(state); + self.ifru_dstaddr.hash(state); + self.ifru_broadaddr.hash(state); + self.ifru_flags.hash(state); + self.ifru_metric.hash(state); + self.ifru_vnetid.hash(state); + self.ifru_media.hash(state); + self.ifru_data.hash(state); + self.ifru_index.hash(state); + } + } + } } } @@ -1578,6 +1686,9 @@ pub const NTFS_MFLAG_ALLNAMES: ::c_int = 0x2; pub const TMPFS_ARGS_VERSION: ::c_int = 1; +const SI_MAXSZ: ::size_t = 128; +const SI_PAD: ::size_t = (SI_MAXSZ / ::mem::size_of::<::c_int>()) - 3; + pub const MAP_STACK: ::c_int = 0x4000; pub const MAP_CONCEAL: ::c_int = 0x8000; @@ -1657,6 +1768,30 @@ pub const SF_ARCHIVED: ::c_uint = 0x00010000; pub const SF_IMMUTABLE: ::c_uint = 0x00020000; pub const SF_APPEND: ::c_uint = 0x00040000; +// sys/exec_elf.h - Legal values for p_type (segment type). +pub const PT_NULL: u32 = 0; +pub const PT_LOAD: u32 = 1; +pub const PT_DYNAMIC: u32 = 2; +pub const PT_INTERP: u32 = 3; +pub const PT_NOTE: u32 = 4; +pub const PT_SHLIB: u32 = 5; +pub const PT_PHDR: u32 = 6; +pub const PT_TLS: u32 = 7; +pub const PT_LOOS: u32 = 0x60000000; +pub const PT_HIOS: u32 = 0x6fffffff; +pub const PT_LOPROC: u32 = 0x70000000; +pub const PT_HIPROC: u32 = 0x7fffffff; + +pub const PT_GNU_EH_FRAME: u32 = 0x6474e550; +pub const PT_GNU_RELRO: u32 = 0x6474e552; + +// sys/exec_elf.h - Legal values for p_flags (segment flags). +pub const PF_X: u32 = 0x1; +pub const PF_W: u32 = 0x2; +pub const PF_R: u32 = 0x4; +pub const PF_MASKOS: u32 = 0x0ff00000; +pub const PF_MASKPROC: u32 = 0xf0000000; + // sys/mount.h pub const MNT_NOPERM: ::c_int = 0x00000020; pub const MNT_WXALLOWED: ::c_int = 0x00000800; @@ -1695,6 +1830,25 @@ pub const LC_ALL_MASK: ::c_int = (1 << _LC_LAST) - 2; pub const LC_GLOBAL_LOCALE: ::locale_t = -1isize as ::locale_t; +// sys/reboot.h +pub const RB_ASKNAME: ::c_int = 0x00001; +pub const RB_SINGLE: ::c_int = 0x00002; +pub const RB_NOSYNC: ::c_int = 0x00004; +pub const RB_HALT: ::c_int = 0x00008; +pub const RB_INITNAME: ::c_int = 0x00010; +pub const RB_KDB: ::c_int = 0x00040; +pub const RB_RDONLY: ::c_int = 0x00080; +pub const RB_DUMP: ::c_int = 0x00100; +pub const RB_MINIROOT: ::c_int = 0x00200; +pub const RB_CONFIG: ::c_int = 0x00400; +pub const RB_TIMEBAD: ::c_int = 0x00800; +pub const RB_POWERDOWN: ::c_int = 0x01000; +pub const RB_SERCONS: ::c_int = 0x02000; +pub const RB_USERREQ: ::c_int = 0x04000; +pub const RB_RESET: ::c_int = 0x08000; +pub const RB_GOODRANDOM: ::c_int = 0x10000; +pub const RB_UNHIBERNATE: ::c_int = 0x20000; + const_fn! { {const} fn _ALIGN(p: usize) -> usize { (p + _ALIGNBYTES) & !_ALIGNBYTES @@ -1779,11 +1933,6 @@ safe_f! { extern "C" { pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int; pub fn settimeofday(tp: *const ::timeval, tz: *const ::timezone) -> ::c_int; - pub fn execvpe( - file: *const ::c_char, - argv: *const *const ::c_char, - envp: *const *const ::c_char, - ) -> ::c_int; pub fn pledge(promises: *const ::c_char, execpromises: *const ::c_char) -> ::c_int; pub fn unveil(path: *const ::c_char, permissions: *const ::c_char) -> ::c_int; pub fn strtonum( @@ -1927,6 +2076,8 @@ extern "C" { ) -> ::c_int; pub fn mimmutable(addr: *mut ::c_void, len: ::size_t) -> ::c_int; + + pub fn reboot(mode: ::c_int) -> ::c_int; } #[link(name = "execinfo")] diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index 8bfb78b786753..a7d1719983c8f 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -741,6 +741,7 @@ pub const RLIMIT_AS: ::c_int = 6; pub const RLIM_INFINITY: ::rlim_t = 0xffffffff; // Haiku specific pub const RLIMIT_NOVMON: ::c_int = 7; +#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::c_int = 8; pub const RUSAGE_SELF: ::c_int = 0; @@ -864,7 +865,7 @@ pub const LC_NUMERIC: ::c_int = 4; pub const LC_TIME: ::c_int = 5; pub const LC_MESSAGES: ::c_int = 6; -// FIXME: Haiku does not have MAP_FILE, but libstd/os.rs requires it +// FIXME: Haiku does not have MAP_FILE, but library/std/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; @@ -1707,7 +1708,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; pub fn pthread_mutex_timedlock( diff --git a/src/unix/hurd/b32.rs b/src/unix/hurd/b32.rs index 7e83ed93000ed..7e82a91d3be03 100644 --- a/src/unix/hurd/b32.rs +++ b/src/unix/hurd/b32.rs @@ -25,6 +25,8 @@ pub type __ulong32_type = ::c_ulong; pub type __s64_type = ::__int64_t; pub type __u64_type = ::__uint64_t; +pub type __ipc_pid_t = ::c_ushort; + pub type Elf32_Half = u16; pub type Elf32_Word = u32; pub type Elf32_Off = u32; diff --git a/src/unix/hurd/b64.rs b/src/unix/hurd/b64.rs index 3b171f1045925..e2e502af2b645 100644 --- a/src/unix/hurd/b64.rs +++ b/src/unix/hurd/b64.rs @@ -25,6 +25,8 @@ pub type __ulong32_type = ::c_uint; pub type __s64_type = ::c_long; pub type __u64_type = ::c_ulong; +pub type __ipc_pid_t = ::c_int; + pub type Elf64_Half = u16; pub type Elf64_Word = u32; pub type Elf64_Off = u64; diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index ba84edb8c6ffc..2701649f6c646 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -164,6 +164,7 @@ pub type pthread_key_t = __pthread_key; pub type pthread_once_t = __pthread_once; pub type __rlimit_resource = ::c_uint; +pub type __rlimit_resource_t = __rlimit_resource; pub type rlim_t = __rlim_t; pub type rlim64_t = __rlim64_t; @@ -215,6 +216,34 @@ pub type tcp_ca_state = ::c_uint; pub type idtype_t = ::c_uint; +pub type mqd_t = ::c_int; + +pub type Lmid_t = ::c_long; + +pub type regoff_t = ::c_int; + +pub type nl_item = ::c_int; + +pub type iconv_t = *mut ::c_void; + +#[cfg_attr(feature = "extra_traits", derive(Debug))] +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 { + *self + } +} + +#[cfg_attr(feature = "extra_traits", derive(Debug))] +pub enum timezone {} +impl ::Copy for timezone {} +impl ::Clone for timezone { + fn clone(&self) -> timezone { + *self + } +} + // structs s! { pub struct ip_mreq { @@ -228,6 +257,12 @@ s! { pub imr_ifindex: ::c_int, } + pub struct ip_mreq_source { + pub imr_multiaddr: in_addr, + pub imr_interface: in_addr, + pub imr_sourceaddr: in_addr, + } + pub struct sockaddr { pub sa_len: ::c_uchar, pub sa_family: sa_family_t, @@ -315,13 +350,19 @@ s! { pub struct msghdr { pub msg_name: *mut ::c_void, pub msg_namelen: socklen_t, - pub msg_iov: *mut iovec, + pub msg_iov: *mut ::iovec, pub msg_iovlen: ::c_int, pub msg_control: *mut ::c_void, pub msg_controllen: socklen_t, pub msg_flags: ::c_int, } + pub struct cmsghdr { + pub cmsg_len: ::socklen_t, + pub cmsg_level: ::c_int, + pub cmsg_type: ::c_int, + } + pub struct dirent { pub d_ino: __ino_t, pub d_reclen: ::c_ushort, @@ -343,13 +384,39 @@ s! { } pub struct termios { - pub c_iflag: tcflag_t, - pub c_oflag: tcflag_t, - pub c_cflag: tcflag_t, - pub c_lflag: tcflag_t, - pub c_cc: [cc_t; 20usize], - pub __ispeed: speed_t, - pub __ospeed: speed_t, + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_cc: [::cc_t; 20usize], + pub __ispeed: ::speed_t, + pub __ospeed: ::speed_t, + } + + pub struct mallinfo { + pub arena: ::c_int, + pub ordblks: ::c_int, + pub smblks: ::c_int, + pub hblks: ::c_int, + pub hblkhd: ::c_int, + pub usmblks: ::c_int, + pub fsmblks: ::c_int, + pub uordblks: ::c_int, + pub fordblks: ::c_int, + pub keepcost: ::c_int, + } + + pub struct mallinfo2 { + pub arena: ::size_t, + pub ordblks: ::size_t, + pub smblks: ::size_t, + pub hblks: ::size_t, + pub hblkhd: ::size_t, + pub usmblks: ::size_t, + pub fsmblks: ::size_t, + pub uordblks: ::size_t, + pub fordblks: ::size_t, + pub keepcost: ::size_t, } pub struct sigaction { @@ -389,7 +456,7 @@ s! { pub struct stat { pub st_fstype: ::c_int, - pub st_fsid: __fsid_t, + pub st_dev: __fsid_t, /* Actually st_fsid */ pub st_ino: __ino_t, pub st_gen: ::c_uint, pub st_rdev: __dev_t, @@ -429,6 +496,36 @@ s! { pub st_spare: [::c_int; 8usize], } + pub struct statx { + pub stx_mask: u32, + pub stx_blksize: u32, + pub stx_attributes: u64, + pub stx_nlink: u32, + pub stx_uid: u32, + pub stx_gid: u32, + pub stx_mode: u16, + __statx_pad1: [u16; 1], + pub stx_ino: u64, + pub stx_size: u64, + pub stx_blocks: u64, + pub stx_attributes_mask: u64, + pub stx_atime: ::statx_timestamp, + pub stx_btime: ::statx_timestamp, + pub stx_ctime: ::statx_timestamp, + pub stx_mtime: ::statx_timestamp, + pub stx_rdev_major: u32, + pub stx_rdev_minor: u32, + pub stx_dev_major: u32, + pub stx_dev_minor: u32, + __statx_pad2: [u64; 14], + } + + pub struct statx_timestamp { + pub tv_sec: i64, + pub tv_nsec: u32, + pub __statx_timestamp_pad1: [i32; 1], + } + pub struct statfs { pub f_type: ::c_uint, pub f_bsize: ::c_ulong, @@ -493,6 +590,36 @@ s! { pub f_spare: [::c_uint; 3usize], } + pub struct aiocb { + pub aio_fildes: ::c_int, + pub aio_lio_opcode: ::c_int, + pub aio_reqprio: ::c_int, + pub aio_buf: *mut ::c_void, + pub aio_nbytes: ::size_t, + pub aio_sigevent: ::sigevent, + __next_prio: *mut aiocb, + __abs_prio: ::c_int, + __policy: ::c_int, + __error_code: ::c_int, + __return_value: ::ssize_t, + pub aio_offset: off_t, + #[cfg(all(not(target_arch = "x86_64"), target_pointer_width = "32"))] + __unused1: [::c_char; 4], + __glibc_reserved: [::c_char; 32] + } + + pub struct mq_attr { + pub mq_flags: ::c_long, + pub mq_maxmsg: ::c_long, + pub mq_msgsize: ::c_long, + pub mq_curmsgs: ::c_long, + } + + pub struct __exit_status { + pub e_termination: ::c_short, + pub e_exit: ::c_short, + } + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] #[cfg_attr(target_pointer_width = "64", @@ -549,7 +676,7 @@ s! { } pub struct __pthread_attr { - pub __schedparam: __sched_param, + pub __schedparam: sched_param, pub __stackaddr: *mut ::c_void, pub __stacksize: size_t, pub __guardsize: size_t, @@ -578,12 +705,25 @@ s! { pub __data: *mut ::c_void, } + pub struct seminfo { + pub semmap: ::c_int, + pub semmni: ::c_int, + pub semmns: ::c_int, + pub semmnu: ::c_int, + pub semmsl: ::c_int, + pub semopm: ::c_int, + pub semume: ::c_int, + pub semusz: ::c_int, + pub semvmx: ::c_int, + pub semaem: ::c_int, + } + pub struct _IO_FILE { _unused: [u8; 0], } - pub struct __sched_param { - pub __sched_priority: ::c_int, + pub struct sched_param { + pub sched_priority: ::c_int, } pub struct iovec { @@ -601,6 +741,23 @@ s! { 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 itimerspec { + pub it_interval: ::timespec, + pub it_value: ::timespec, + } + pub struct tm { pub tm_sec: ::c_int, pub tm_min: ::c_int, @@ -649,6 +806,59 @@ s! { pub dli_saddr: *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 arpreq { + pub arp_pa: ::sockaddr, + pub arp_ha: ::sockaddr, + pub arp_flags: ::c_int, + pub arp_netmask: ::sockaddr, + pub arp_dev: [::c_char; 16], + } + + pub struct arpreq_old { + pub arp_pa: ::sockaddr, + pub arp_ha: ::sockaddr, + pub arp_flags: ::c_int, + pub arp_netmask: ::sockaddr, + } + + pub struct arphdr { + pub ar_hrd: u16, + pub ar_pro: u16, + pub ar_hln: u8, + pub ar_pln: u8, + pub ar_op: u16, + } + + pub struct arpd_request { + pub req: ::c_ushort, + pub ip: u32, + pub dev: ::c_ulong, + pub stamp: ::c_ulong, + pub updated: ::c_ulong, + pub ha: [::c_uchar; ::MAX_ADDR_LEN], + } + + pub struct mmsghdr { + pub msg_hdr: ::msghdr, + pub msg_len: ::c_uint, + } + + pub struct ifreq { + /// interface name, e.g. "en0" + pub ifr_name: [::c_char; ::IFNAMSIZ], + pub ifr_ifru: ::sockaddr, + } + pub struct __locale_struct { pub __locales: [*mut __locale_data; 13usize], pub __ctype_b: *const ::c_ushort, @@ -715,6 +925,204 @@ s! { pub l_len : __off64_t, pub l_pid : __pid_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 glob64_t { + pub gl_pathc: ::size_t, + pub gl_pathv: *mut *mut ::c_char, + pub gl_offs: ::size_t, + pub gl_flags: ::c_int, + + __unused1: *mut ::c_void, + __unused2: *mut ::c_void, + __unused3: *mut ::c_void, + __unused4: *mut ::c_void, + __unused5: *mut ::c_void, + } + + pub struct 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 cpu_set_t { + #[cfg(all(target_pointer_width = "32", + not(target_arch = "x86_64")))] + bits: [u32; 32], + #[cfg(not(all(target_pointer_width = "32", + not(target_arch = "x86_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 sembuf { + pub sem_num: ::c_ushort, + pub sem_op: ::c_short, + pub sem_flg: ::c_short, + } + + pub struct mntent { + pub mnt_fsname: *mut ::c_char, + pub mnt_dir: *mut ::c_char, + pub mnt_type: *mut ::c_char, + pub mnt_opts: *mut ::c_char, + pub mnt_freq: ::c_int, + pub mnt_passno: ::c_int, + } + + pub struct posix_spawn_file_actions_t { + __allocated: ::c_int, + __used: ::c_int, + __actions: *mut ::c_int, + __pad: [::c_int; 16], + } + + pub struct posix_spawnattr_t { + __flags: ::c_short, + __pgrp: ::pid_t, + __sd: ::sigset_t, + __ss: ::sigset_t, + __sp: ::sched_param, + __policy: ::c_int, + __pad: [::c_int; 16], + } + + pub struct regmatch_t { + pub rm_so: regoff_t, + pub rm_eo: regoff_t, + } + + pub struct option { + pub name: *const ::c_char, + pub has_arg: ::c_int, + pub flag: *mut ::c_int, + pub val: ::c_int, + } + +} + +s_no_extra_traits! { + pub struct utmpx { + pub ut_type: ::c_short, + pub ut_pid: ::pid_t, + pub ut_line: [::c_char; __UT_LINESIZE], + pub ut_id: [::c_char; 4], + + pub ut_user: [::c_char; __UT_NAMESIZE], + pub ut_host: [::c_char; __UT_HOSTSIZE], + pub ut_exit: __exit_status, + + #[cfg(any( all(target_pointer_width = "32", + not(target_arch = "x86_64"))))] + pub ut_session: ::c_long, + #[cfg(any(all(target_pointer_width = "32", + not(target_arch = "x86_64"))))] + pub ut_tv: ::timeval, + + #[cfg(not(any(all(target_pointer_width = "32", + not(target_arch = "x86_64")))))] + pub ut_session: i32, + #[cfg(not(any(all(target_pointer_width = "32", + not(target_arch = "x86_64")))))] + pub ut_tv: __timeval, + + pub ut_addr_v6: [i32; 4], + __glibc_reserved: [::c_char; 20], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for utmpx { + fn eq(&self, other: &utmpx) -> bool { + self.ut_type == other.ut_type + && 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_tv == other.ut_tv + && self.ut_addr_v6 == other.ut_addr_v6 + && self.__glibc_reserved == other.__glibc_reserved + } + } + + 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_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_tv", &self.ut_tv) + .field("ut_addr_v6", &self.ut_addr_v6) + .field("__glibc_reserved", &self.__glibc_reserved) + .finish() + } + } + + impl ::hash::Hash for utmpx { + fn hash(&self, state: &mut H) { + self.ut_type.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_tv.hash(state); + self.ut_addr_v6.hash(state); + self.__glibc_reserved.hash(state); + } + } + } } impl siginfo_t { @@ -740,16 +1148,69 @@ impl siginfo_t { } // const -pub const IPOPT_COPY: u8 = 0x80; -pub const IPOPT_NUMBER_MASK: u8 = 0x1f; -pub const IPOPT_CLASS_MASK: u8 = 0x60; -pub const IPTOS_ECN_MASK: u8 = 0x03; -pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000; +// aio.h +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; + +// glob.h +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 GLOB_PERIOD: ::c_int = 1 << 7; +pub const GLOB_ALTDIRFUNC: ::c_int = 1 << 9; +pub const GLOB_BRACE: ::c_int = 1 << 10; +pub const GLOB_NOMAGIC: ::c_int = 1 << 11; +pub const GLOB_TILDE: ::c_int = 1 << 12; +pub const GLOB_ONLYDIR: ::c_int = 1 << 13; +pub const GLOB_TILDE_CHECK: ::c_int = 1 << 14; + +// ipc.h +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; + +// shm.h +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; // unistd.h -pub const STDIN_FILENO: c_long = 0; -pub const STDOUT_FILENO: c_long = 1; -pub const STDERR_FILENO: c_long = 2; +pub const STDIN_FILENO: ::c_int = 0; +pub const STDOUT_FILENO: ::c_int = 1; +pub const STDERR_FILENO: ::c_int = 2; pub const __FD_SETSIZE: usize = 256; pub const R_OK: ::c_int = 4; pub const W_OK: ::c_int = 2; @@ -769,6 +1230,9 @@ pub const F_TLOCK: ::c_int = 2; pub const F_TEST: ::c_int = 3; pub const CLOSE_RANGE_CLOEXEC: ::c_int = 4; +// stdio.h +pub const EOF: ::c_int = -1; + // stdlib.h pub const WNOHANG: ::c_int = 1; pub const WUNTRACED: ::c_int = 2; @@ -884,8 +1348,17 @@ pub const _SS_SIZE: usize = 128; pub const CMGROUP_MAX: usize = 16; pub const SOL_SOCKET: ::c_int = 65535; +// sys/time.h +pub const ITIMER_REAL: ::c_int = 0; +pub const ITIMER_VIRTUAL: ::c_int = 1; +pub const ITIMER_PROF: ::c_int = 2; + // netinet/in.h pub const SOL_IP: ::c_int = 0; +pub const SOL_TCP: ::c_int = 6; +pub const SOL_UDP: ::c_int = 17; +pub const SOL_IPV6: ::c_int = 41; +pub const SOL_ICMPV6: ::c_int = 58; pub const IP_OPTIONS: ::c_int = 1; pub const IP_HDRINCL: ::c_int = 2; pub const IP_TOS: ::c_int = 3; @@ -899,8 +1372,6 @@ pub const IP_MULTICAST_TTL: ::c_int = 10; pub const IP_MULTICAST_LOOP: ::c_int = 11; pub const IP_ADD_MEMBERSHIP: ::c_int = 12; pub const IP_DROP_MEMBERSHIP: ::c_int = 13; -pub const SOL_IPV6: ::c_int = 41; -pub const SOL_ICMPV6: ::c_int = 58; pub const IPV6_ADDRFORM: ::c_int = 1; pub const IPV6_2292PKTINFO: ::c_int = 2; pub const IPV6_2292HOPOPTS: ::c_int = 3; @@ -965,6 +1436,143 @@ pub const IN_LOOPBACKNET: u32 = 127; pub const INET_ADDRSTRLEN: usize = 16; pub const INET6_ADDRSTRLEN: usize = 46; +// netinet/ip.h +pub const IPTOS_TOS_MASK: u8 = 0x1E; +pub const IPTOS_PREC_MASK: u8 = 0xE0; + +pub const IPTOS_ECN_NOT_ECT: u8 = 0x00; + +pub const IPTOS_LOWDELAY: u8 = 0x10; +pub const IPTOS_THROUGHPUT: u8 = 0x08; +pub const IPTOS_RELIABILITY: u8 = 0x04; +pub const IPTOS_MINCOST: u8 = 0x02; + +pub const IPTOS_PREC_NETCONTROL: u8 = 0xe0; +pub const IPTOS_PREC_INTERNETCONTROL: u8 = 0xc0; +pub const IPTOS_PREC_CRITIC_ECP: u8 = 0xa0; +pub const IPTOS_PREC_FLASHOVERRIDE: u8 = 0x80; +pub const IPTOS_PREC_FLASH: u8 = 0x60; +pub const IPTOS_PREC_IMMEDIATE: u8 = 0x40; +pub const IPTOS_PREC_PRIORITY: u8 = 0x20; +pub const IPTOS_PREC_ROUTINE: u8 = 0x00; + +pub const IPTOS_ECN_MASK: u8 = 0x03; +pub const IPTOS_ECN_ECT1: u8 = 0x01; +pub const IPTOS_ECN_ECT0: u8 = 0x02; +pub const IPTOS_ECN_CE: u8 = 0x03; + +pub const IPOPT_COPY: u8 = 0x80; +pub const IPOPT_CLASS_MASK: u8 = 0x60; +pub const IPOPT_NUMBER_MASK: u8 = 0x1f; + +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 IPVERSION: u8 = 4; +pub const MAXTTL: u8 = 255; +pub const IPDEFTTL: u8 = 64; +pub const IPOPT_OPTVAL: u8 = 0; +pub const IPOPT_OLEN: u8 = 1; +pub const IPOPT_OFFSET: u8 = 2; +pub const IPOPT_MINOFF: u8 = 4; +pub const MAX_IPOPTLEN: u8 = 40; +pub const IPOPT_NOP: u8 = IPOPT_NOOP; +pub const IPOPT_EOL: u8 = IPOPT_END; +pub const IPOPT_TS: u8 = IPOPT_TIMESTAMP; +pub const IPOPT_TS_TSONLY: u8 = 0; +pub const IPOPT_TS_TSANDADDR: u8 = 1; +pub const IPOPT_TS_PRESPEC: u8 = 3; + +// net/if_arp.h +pub const ARPOP_REQUEST: u16 = 1; +pub const ARPOP_REPLY: u16 = 2; +pub const ARPOP_RREQUEST: u16 = 3; +pub const ARPOP_RREPLY: u16 = 4; +pub const ARPOP_InREQUEST: u16 = 8; +pub const ARPOP_InREPLY: u16 = 9; +pub const ARPOP_NAK: u16 = 10; + +pub const MAX_ADDR_LEN: usize = 7; +pub const ARPD_UPDATE: ::c_ushort = 0x01; +pub const ARPD_LOOKUP: ::c_ushort = 0x02; +pub const ARPD_FLUSH: ::c_ushort = 0x03; +pub const ATF_MAGIC: ::c_int = 0x80; + +pub const ATF_NETMASK: ::c_int = 0x20; +pub const ATF_DONTPUB: ::c_int = 0x40; + +pub const ARPHRD_NETROM: u16 = 0; +pub const ARPHRD_ETHER: u16 = 1; +pub const ARPHRD_EETHER: u16 = 2; +pub const ARPHRD_AX25: u16 = 3; +pub const ARPHRD_PRONET: u16 = 4; +pub const ARPHRD_CHAOS: u16 = 5; +pub const ARPHRD_IEEE802: u16 = 6; +pub const ARPHRD_ARCNET: u16 = 7; +pub const ARPHRD_APPLETLK: u16 = 8; +pub const ARPHRD_DLCI: u16 = 15; +pub const ARPHRD_ATM: u16 = 19; +pub const ARPHRD_METRICOM: u16 = 23; +pub const ARPHRD_IEEE1394: u16 = 24; +pub const ARPHRD_EUI64: u16 = 27; +pub const ARPHRD_INFINIBAND: u16 = 32; + +pub const ARPHRD_SLIP: u16 = 256; +pub const ARPHRD_CSLIP: u16 = 257; +pub const ARPHRD_SLIP6: u16 = 258; +pub const ARPHRD_CSLIP6: u16 = 259; +pub const ARPHRD_RSRVD: u16 = 260; +pub const ARPHRD_ADAPT: u16 = 264; +pub const ARPHRD_ROSE: u16 = 270; +pub const ARPHRD_X25: u16 = 271; +pub const ARPHRD_HWX25: u16 = 272; +pub const ARPHRD_CAN: u16 = 280; +pub const ARPHRD_PPP: u16 = 512; +pub const ARPHRD_CISCO: u16 = 513; +pub const ARPHRD_HDLC: u16 = ARPHRD_CISCO; +pub const ARPHRD_LAPB: u16 = 516; +pub const ARPHRD_DDCMP: u16 = 517; +pub const ARPHRD_RAWHDLC: u16 = 518; + +pub const ARPHRD_TUNNEL: u16 = 768; +pub const ARPHRD_TUNNEL6: u16 = 769; +pub const ARPHRD_FRAD: u16 = 770; +pub const ARPHRD_SKIP: u16 = 771; +pub const ARPHRD_LOOPBACK: u16 = 772; +pub const ARPHRD_LOCALTLK: u16 = 773; +pub const ARPHRD_FDDI: u16 = 774; +pub const ARPHRD_BIF: u16 = 775; +pub const ARPHRD_SIT: u16 = 776; +pub const ARPHRD_IPDDP: u16 = 777; +pub const ARPHRD_IPGRE: u16 = 778; +pub const ARPHRD_PIMREG: u16 = 779; +pub const ARPHRD_HIPPI: u16 = 780; +pub const ARPHRD_ASH: u16 = 781; +pub const ARPHRD_ECONET: u16 = 782; +pub const ARPHRD_IRDA: u16 = 783; +pub const ARPHRD_FCPP: u16 = 784; +pub const ARPHRD_FCAL: u16 = 785; +pub const ARPHRD_FCPL: u16 = 786; +pub const ARPHRD_FCFABRIC: u16 = 787; +pub const ARPHRD_IEEE802_TR: u16 = 800; +pub const ARPHRD_IEEE80211: u16 = 801; +pub const ARPHRD_IEEE80211_PRISM: u16 = 802; +pub const ARPHRD_IEEE80211_RADIOTAP: u16 = 803; +pub const ARPHRD_IEEE802154: u16 = 804; + +pub const ARPHRD_VOID: u16 = 0xFFFF; +pub const ARPHRD_NONE: u16 = 0xFFFE; + // bits/posix1_lim.h pub const _POSIX_AIO_LISTIO_MAX: usize = 2; pub const _POSIX_AIO_MAX: usize = 1; @@ -1063,13 +1671,13 @@ pub const NI_DGRAM: ::c_int = 16; pub const NI_IDN: ::c_int = 32; // time.h -pub const CLOCK_REALTIME: clockid_t = 0; -pub const CLOCK_MONOTONIC: clockid_t = 1; -pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2; -pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3; -pub const CLOCK_MONOTONIC_RAW: clockid_t = 4; -pub const CLOCK_REALTIME_COARSE: clockid_t = 5; -pub const CLOCK_MONOTONIC_COARSE: clockid_t = 6; +pub const CLOCK_REALTIME: ::clockid_t = 0; +pub const CLOCK_MONOTONIC: ::clockid_t = 1; +pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2; +pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3; +pub const CLOCK_MONOTONIC_RAW: ::clockid_t = 4; +pub const CLOCK_REALTIME_COARSE: ::clockid_t = 5; +pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6; pub const TIMER_ABSTIME: ::c_int = 1; pub const TIME_UTC: ::c_int = 1; @@ -1126,155 +1734,234 @@ pub const LC_MEASUREMENT_MASK: ::c_int = 2048; pub const LC_IDENTIFICATION_MASK: ::c_int = 4096; pub const LC_ALL_MASK: ::c_int = 8127; +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; + +// reboot.h +pub const RB_AUTOBOOT: ::c_int = 0x0; +pub const RB_ASKNAME: ::c_int = 0x1; +pub const RB_SINGLE: ::c_int = 0x2; +pub const RB_KBD: ::c_int = 0x4; +pub const RB_HALT: ::c_int = 0x8; +pub const RB_INITNAME: ::c_int = 0x10; +pub const RB_DFLTROOT: ::c_int = 0x20; +pub const RB_NOBOOTRC: ::c_int = 0x20; +pub const RB_ALTBOOT: ::c_int = 0x40; +pub const RB_UNIPROC: ::c_int = 0x80; +pub const RB_DEBUGGER: ::c_int = 0x1000; + // semaphore.h pub const __SIZEOF_SEM_T: usize = 20; +pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t; // termios.h -pub const IGNBRK: tcflag_t = 1; -pub const BRKINT: tcflag_t = 2; -pub const IGNPAR: tcflag_t = 4; -pub const PARMRK: tcflag_t = 8; -pub const INPCK: tcflag_t = 16; -pub const ISTRIP: tcflag_t = 32; -pub const INLCR: tcflag_t = 64; -pub const IGNCR: tcflag_t = 128; -pub const ICRNL: tcflag_t = 256; -pub const IXON: tcflag_t = 512; -pub const IXOFF: tcflag_t = 1024; -pub const IXANY: tcflag_t = 2048; -pub const IMAXBEL: tcflag_t = 8192; -pub const IUCLC: tcflag_t = 16384; -pub const OPOST: tcflag_t = 1; -pub const ONLCR: tcflag_t = 2; -pub const ONOEOT: tcflag_t = 8; -pub const OCRNL: tcflag_t = 16; -pub const ONOCR: tcflag_t = 32; -pub const ONLRET: tcflag_t = 64; -pub const NLDLY: tcflag_t = 768; -pub const NL0: tcflag_t = 0; -pub const NL1: tcflag_t = 256; -pub const TABDLY: tcflag_t = 3076; -pub const TAB0: tcflag_t = 0; -pub const TAB1: tcflag_t = 1024; -pub const TAB2: tcflag_t = 2048; -pub const TAB3: tcflag_t = 4; -pub const CRDLY: tcflag_t = 12288; -pub const CR0: tcflag_t = 0; -pub const CR1: tcflag_t = 4096; -pub const CR2: tcflag_t = 8192; -pub const CR3: tcflag_t = 12288; -pub const FFDLY: tcflag_t = 16384; -pub const FF0: tcflag_t = 0; -pub const FF1: tcflag_t = 16384; -pub const BSDLY: tcflag_t = 32768; -pub const BS0: tcflag_t = 0; -pub const BS1: tcflag_t = 32768; -pub const VTDLY: tcflag_t = 65536; -pub const VT0: tcflag_t = 0; -pub const VT1: tcflag_t = 65536; -pub const OLCUC: tcflag_t = 131072; -pub const OFILL: tcflag_t = 262144; -pub const OFDEL: tcflag_t = 524288; -pub const CIGNORE: tcflag_t = 1; -pub const CSIZE: tcflag_t = 768; -pub const CS5: tcflag_t = 0; -pub const CS6: tcflag_t = 256; -pub const CS7: tcflag_t = 512; -pub const CS8: tcflag_t = 768; -pub const CSTOPB: tcflag_t = 1024; -pub const CREAD: tcflag_t = 2048; -pub const PARENB: tcflag_t = 4096; -pub const PARODD: tcflag_t = 8192; -pub const HUPCL: tcflag_t = 16384; -pub const CLOCAL: tcflag_t = 32768; -pub const CRTSCTS: tcflag_t = 65536; -pub const CRTS_IFLOW: tcflag_t = 65536; -pub const CCTS_OFLOW: tcflag_t = 65536; -pub const CDTRCTS: tcflag_t = 131072; -pub const MDMBUF: tcflag_t = 1048576; -pub const CHWFLOW: tcflag_t = 1245184; -pub const ECHOKE: tcflag_t = 1; -pub const _ECHOE: tcflag_t = 2; -pub const ECHOE: tcflag_t = 2; -pub const _ECHOK: tcflag_t = 4; -pub const ECHOK: tcflag_t = 4; -pub const _ECHO: tcflag_t = 8; -pub const ECHO: tcflag_t = 8; -pub const _ECHONL: tcflag_t = 16; -pub const ECHONL: tcflag_t = 16; -pub const ECHOPRT: tcflag_t = 32; -pub const ECHOCTL: tcflag_t = 64; -pub const _ISIG: tcflag_t = 128; -pub const ISIG: tcflag_t = 128; -pub const _ICANON: tcflag_t = 256; -pub const ICANON: tcflag_t = 256; -pub const ALTWERASE: tcflag_t = 512; -pub const _IEXTEN: tcflag_t = 1024; -pub const IEXTEN: tcflag_t = 1024; -pub const EXTPROC: tcflag_t = 2048; -pub const _TOSTOP: tcflag_t = 4194304; -pub const TOSTOP: tcflag_t = 4194304; -pub const FLUSHO: tcflag_t = 8388608; -pub const NOKERNINFO: tcflag_t = 33554432; -pub const PENDIN: tcflag_t = 536870912; -pub const _NOFLSH: tcflag_t = 2147483648; -pub const NOFLSH: tcflag_t = 2147483648; -pub const VEOF: cc_t = 0; -pub const VEOL: cc_t = 1; -pub const VEOL2: cc_t = 2; -pub const VERASE: cc_t = 3; -pub const VWERASE: cc_t = 4; -pub const VKILL: cc_t = 5; -pub const VREPRINT: cc_t = 6; -pub const VINTR: cc_t = 8; -pub const VQUIT: cc_t = 9; -pub const VSUSP: cc_t = 10; -pub const VDSUSP: cc_t = 11; -pub const VSTART: cc_t = 12; -pub const VSTOP: cc_t = 13; -pub const VLNEXT: cc_t = 14; -pub const VDISCARD: cc_t = 15; -pub const VMIN: cc_t = 16; -pub const VTIME: cc_t = 17; -pub const VSTATUS: cc_t = 18; +pub const IGNBRK: ::tcflag_t = 1; +pub const BRKINT: ::tcflag_t = 2; +pub const IGNPAR: ::tcflag_t = 4; +pub const PARMRK: ::tcflag_t = 8; +pub const INPCK: ::tcflag_t = 16; +pub const ISTRIP: ::tcflag_t = 32; +pub const INLCR: ::tcflag_t = 64; +pub const IGNCR: ::tcflag_t = 128; +pub const ICRNL: ::tcflag_t = 256; +pub const IXON: ::tcflag_t = 512; +pub const IXOFF: ::tcflag_t = 1024; +pub const IXANY: ::tcflag_t = 2048; +pub const IMAXBEL: ::tcflag_t = 8192; +pub const IUCLC: ::tcflag_t = 16384; +pub const OPOST: ::tcflag_t = 1; +pub const ONLCR: ::tcflag_t = 2; +pub const ONOEOT: ::tcflag_t = 8; +pub const OCRNL: ::tcflag_t = 16; +pub const ONOCR: ::tcflag_t = 32; +pub const ONLRET: ::tcflag_t = 64; +pub const NLDLY: ::tcflag_t = 768; +pub const NL0: ::tcflag_t = 0; +pub const NL1: ::tcflag_t = 256; +pub const TABDLY: ::tcflag_t = 3076; +pub const TAB0: ::tcflag_t = 0; +pub const TAB1: ::tcflag_t = 1024; +pub const TAB2: ::tcflag_t = 2048; +pub const TAB3: ::tcflag_t = 4; +pub const CRDLY: ::tcflag_t = 12288; +pub const CR0: ::tcflag_t = 0; +pub const CR1: ::tcflag_t = 4096; +pub const CR2: ::tcflag_t = 8192; +pub const CR3: ::tcflag_t = 12288; +pub const FFDLY: ::tcflag_t = 16384; +pub const FF0: ::tcflag_t = 0; +pub const FF1: ::tcflag_t = 16384; +pub const BSDLY: ::tcflag_t = 32768; +pub const BS0: ::tcflag_t = 0; +pub const BS1: ::tcflag_t = 32768; +pub const VTDLY: ::tcflag_t = 65536; +pub const VT0: ::tcflag_t = 0; +pub const VT1: ::tcflag_t = 65536; +pub const OLCUC: ::tcflag_t = 131072; +pub const OFILL: ::tcflag_t = 262144; +pub const OFDEL: ::tcflag_t = 524288; +pub const CIGNORE: ::tcflag_t = 1; +pub const CSIZE: ::tcflag_t = 768; +pub const CS5: ::tcflag_t = 0; +pub const CS6: ::tcflag_t = 256; +pub const CS7: ::tcflag_t = 512; +pub const CS8: ::tcflag_t = 768; +pub const CSTOPB: ::tcflag_t = 1024; +pub const CREAD: ::tcflag_t = 2048; +pub const PARENB: ::tcflag_t = 4096; +pub const PARODD: ::tcflag_t = 8192; +pub const HUPCL: ::tcflag_t = 16384; +pub const CLOCAL: ::tcflag_t = 32768; +pub const CRTSCTS: ::tcflag_t = 65536; +pub const CRTS_IFLOW: ::tcflag_t = 65536; +pub const CCTS_OFLOW: ::tcflag_t = 65536; +pub const CDTRCTS: ::tcflag_t = 131072; +pub const MDMBUF: ::tcflag_t = 1048576; +pub const CHWFLOW: ::tcflag_t = 1245184; +pub const ECHOKE: ::tcflag_t = 1; +pub const _ECHOE: ::tcflag_t = 2; +pub const ECHOE: ::tcflag_t = 2; +pub const _ECHOK: ::tcflag_t = 4; +pub const ECHOK: ::tcflag_t = 4; +pub const _ECHO: ::tcflag_t = 8; +pub const ECHO: ::tcflag_t = 8; +pub const _ECHONL: ::tcflag_t = 16; +pub const ECHONL: ::tcflag_t = 16; +pub const ECHOPRT: ::tcflag_t = 32; +pub const ECHOCTL: ::tcflag_t = 64; +pub const _ISIG: ::tcflag_t = 128; +pub const ISIG: ::tcflag_t = 128; +pub const _ICANON: ::tcflag_t = 256; +pub const ICANON: ::tcflag_t = 256; +pub const ALTWERASE: ::tcflag_t = 512; +pub const _IEXTEN: ::tcflag_t = 1024; +pub const IEXTEN: ::tcflag_t = 1024; +pub const EXTPROC: ::tcflag_t = 2048; +pub const _TOSTOP: ::tcflag_t = 4194304; +pub const TOSTOP: ::tcflag_t = 4194304; +pub const FLUSHO: ::tcflag_t = 8388608; +pub const NOKERNINFO: ::tcflag_t = 33554432; +pub const PENDIN: ::tcflag_t = 536870912; +pub const _NOFLSH: ::tcflag_t = 2147483648; +pub const NOFLSH: ::tcflag_t = 2147483648; +pub const VEOF: usize = 0; +pub const VEOL: usize = 1; +pub const VEOL2: usize = 2; +pub const VERASE: usize = 3; +pub const VWERASE: usize = 4; +pub const VKILL: usize = 5; +pub const VREPRINT: usize = 6; +pub const VINTR: usize = 8; +pub const VQUIT: usize = 9; +pub const VSUSP: usize = 10; +pub const VDSUSP: usize = 11; +pub const VSTART: usize = 12; +pub const VSTOP: usize = 13; +pub const VLNEXT: usize = 14; +pub const VDISCARD: usize = 15; +pub const VMIN: usize = 16; +pub const VTIME: usize = 17; +pub const VSTATUS: usize = 18; pub const NCCS: usize = 20; -pub const B0: speed_t = 0; -pub const B50: speed_t = 50; -pub const B75: speed_t = 75; -pub const B110: speed_t = 110; -pub const B134: speed_t = 134; -pub const B150: speed_t = 150; -pub const B200: speed_t = 200; -pub const B300: speed_t = 300; -pub const B600: speed_t = 600; -pub const B1200: speed_t = 1200; -pub const B1800: speed_t = 1800; -pub const B2400: speed_t = 2400; -pub const B4800: speed_t = 4800; -pub const B9600: speed_t = 9600; -pub const B7200: speed_t = 7200; -pub const B14400: speed_t = 14400; -pub const B19200: speed_t = 19200; -pub const B28800: speed_t = 28800; -pub const B38400: speed_t = 38400; -pub const EXTA: speed_t = 19200; -pub const EXTB: speed_t = 38400; -pub const B57600: speed_t = 57600; -pub const B76800: speed_t = 76800; -pub const B115200: speed_t = 115200; -pub const B230400: speed_t = 230400; -pub const B460800: speed_t = 460800; -pub const B500000: speed_t = 500000; -pub const B576000: speed_t = 576000; -pub const B921600: speed_t = 921600; -pub const B1000000: speed_t = 1000000; -pub const B1152000: speed_t = 1152000; -pub const B1500000: speed_t = 1500000; -pub const B2000000: speed_t = 2000000; -pub const B2500000: speed_t = 2500000; -pub const B3000000: speed_t = 3000000; -pub const B3500000: speed_t = 3500000; -pub const B4000000: speed_t = 4000000; +pub const B0: ::speed_t = 0; +pub const B50: ::speed_t = 50; +pub const B75: ::speed_t = 75; +pub const B110: ::speed_t = 110; +pub const B134: ::speed_t = 134; +pub const B150: ::speed_t = 150; +pub const B200: ::speed_t = 200; +pub const B300: ::speed_t = 300; +pub const B600: ::speed_t = 600; +pub const B1200: ::speed_t = 1200; +pub const B1800: ::speed_t = 1800; +pub const B2400: ::speed_t = 2400; +pub const B4800: ::speed_t = 4800; +pub const B9600: ::speed_t = 9600; +pub const B7200: ::speed_t = 7200; +pub const B14400: ::speed_t = 14400; +pub const B19200: ::speed_t = 19200; +pub const B28800: ::speed_t = 28800; +pub const B38400: ::speed_t = 38400; +pub const EXTA: ::speed_t = B19200; +pub const EXTB: ::speed_t = B38400; +pub const B57600: ::speed_t = 57600; +pub const B76800: ::speed_t = 76800; +pub const B115200: ::speed_t = 115200; +pub const B230400: ::speed_t = 230400; +pub const B460800: ::speed_t = 460800; +pub const B500000: ::speed_t = 500000; +pub const B576000: ::speed_t = 576000; +pub const B921600: ::speed_t = 921600; +pub const B1000000: ::speed_t = 1000000; +pub const B1152000: ::speed_t = 1152000; +pub const B1500000: ::speed_t = 1500000; +pub const B2000000: ::speed_t = 2000000; +pub const B2500000: ::speed_t = 2500000; +pub const B3000000: ::speed_t = 3000000; +pub const B3500000: ::speed_t = 3500000; +pub const B4000000: ::speed_t = 4000000; pub const TCSANOW: ::c_int = 0; pub const TCSADRAIN: ::c_int = 1; pub const TCSAFLUSH: ::c_int = 2; @@ -1286,10 +1973,10 @@ pub const TCOOFF: ::c_int = 1; pub const TCOON: ::c_int = 2; pub const TCIOFF: ::c_int = 3; pub const TCION: ::c_int = 4; -pub const TTYDEF_IFLAG: tcflag_t = 11042; -pub const TTYDEF_LFLAG: tcflag_t = 1483; -pub const TTYDEF_CFLAG: tcflag_t = 23040; -pub const TTYDEF_SPEED: tcflag_t = 9600; +pub const TTYDEF_IFLAG: ::tcflag_t = 11042; +pub const TTYDEF_LFLAG: ::tcflag_t = 1483; +pub const TTYDEF_CFLAG: ::tcflag_t = 23040; +pub const TTYDEF_SPEED: ::tcflag_t = 9600; pub const CEOL: u8 = 0u8; pub const CERASE: u8 = 127; pub const CMIN: u8 = 1; @@ -1299,6 +1986,7 @@ pub const CBRK: u8 = 0u8; // dlfcn.h pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; +pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void; pub const RTLD_LAZY: ::c_int = 1; pub const RTLD_NOW: ::c_int = 2; pub const RTLD_BINDING_MASK: ::c_int = 3; @@ -1467,35 +2155,35 @@ pub const SF_NOUNLINK: ::c_uint = 1048576; pub const SF_SNAPSHOT: ::c_uint = 2097152; pub const UTIME_NOW: ::c_long = -1; pub const UTIME_OMIT: ::c_long = -2; -pub const S_IFMT: mode_t = 61440; -pub const S_IFDIR: mode_t = 16384; -pub const S_IFCHR: mode_t = 8192; -pub const S_IFBLK: mode_t = 24576; -pub const S_IFREG: mode_t = 32768; -pub const S_IFIFO: mode_t = 4096; -pub const S_IFLNK: mode_t = 40960; -pub const S_IFSOCK: mode_t = 49152; -pub const S_ISUID: mode_t = 2048; -pub const S_ISGID: mode_t = 1024; -pub const S_ISVTX: mode_t = 512; -pub const S_IRUSR: mode_t = 256; -pub const S_IWUSR: mode_t = 128; -pub const S_IXUSR: mode_t = 64; -pub const S_IRWXU: mode_t = 448; -pub const S_IREAD: mode_t = 256; -pub const S_IWRITE: mode_t = 128; -pub const S_IEXEC: mode_t = 64; -pub const S_IRGRP: mode_t = 32; -pub const S_IWGRP: mode_t = 16; -pub const S_IXGRP: mode_t = 8; -pub const S_IRWXG: mode_t = 56; -pub const S_IROTH: mode_t = 4; -pub const S_IWOTH: mode_t = 2; -pub const S_IXOTH: mode_t = 1; -pub const S_IRWXO: mode_t = 7; -pub const ACCESSPERMS: mode_t = 511; -pub const ALLPERMS: mode_t = 4095; -pub const DEFFILEMODE: mode_t = 438; +pub const S_IFMT: ::mode_t = 61440; +pub const S_IFDIR: ::mode_t = 16384; +pub const S_IFCHR: ::mode_t = 8192; +pub const S_IFBLK: ::mode_t = 24576; +pub const S_IFREG: ::mode_t = 32768; +pub const S_IFIFO: ::mode_t = 4096; +pub const S_IFLNK: ::mode_t = 40960; +pub const S_IFSOCK: ::mode_t = 49152; +pub const S_ISUID: ::mode_t = 2048; +pub const S_ISGID: ::mode_t = 1024; +pub const S_ISVTX: ::mode_t = 512; +pub const S_IRUSR: ::mode_t = 256; +pub const S_IWUSR: ::mode_t = 128; +pub const S_IXUSR: ::mode_t = 64; +pub const S_IRWXU: ::mode_t = 448; +pub const S_IREAD: ::mode_t = 256; +pub const S_IWRITE: ::mode_t = 128; +pub const S_IEXEC: ::mode_t = 64; +pub const S_IRGRP: ::mode_t = 32; +pub const S_IWGRP: ::mode_t = 16; +pub const S_IXGRP: ::mode_t = 8; +pub const S_IRWXG: ::mode_t = 56; +pub const S_IROTH: ::mode_t = 4; +pub const S_IWOTH: ::mode_t = 2; +pub const S_IXOTH: ::mode_t = 1; +pub const S_IRWXO: ::mode_t = 7; +pub const ACCESSPERMS: ::mode_t = 511; +pub const ALLPERMS: ::mode_t = 4095; +pub const DEFFILEMODE: ::mode_t = 438; pub const S_BLKSIZE: usize = 512; pub const STATX_TYPE: ::c_uint = 1; pub const STATX_MODE: ::c_uint = 2; @@ -1547,34 +2235,34 @@ pub const TIOCPKT_IOCTL: ::c_int = 64; pub const TTYDISC: ::c_int = 0; pub const TABLDISC: ::c_int = 3; pub const SLIPDISC: ::c_int = 4; -pub const TANDEM: tcflag_t = 1; -pub const CBREAK: tcflag_t = 2; -pub const LCASE: tcflag_t = 4; -pub const CRMOD: tcflag_t = 16; -pub const RAW: tcflag_t = 32; -pub const ODDP: tcflag_t = 64; -pub const EVENP: tcflag_t = 128; -pub const ANYP: tcflag_t = 192; -pub const NLDELAY: tcflag_t = 768; -pub const NL2: tcflag_t = 512; -pub const NL3: tcflag_t = 768; -pub const TBDELAY: tcflag_t = 3072; -pub const XTABS: tcflag_t = 3072; -pub const CRDELAY: tcflag_t = 12288; -pub const VTDELAY: tcflag_t = 16384; -pub const BSDELAY: tcflag_t = 32768; -pub const ALLDELAY: tcflag_t = 65280; -pub const CRTBS: tcflag_t = 65536; -pub const PRTERA: tcflag_t = 131072; -pub const CRTERA: tcflag_t = 262144; -pub const TILDE: tcflag_t = 524288; -pub const LITOUT: tcflag_t = 2097152; -pub const NOHANG: tcflag_t = 16777216; -pub const L001000: tcflag_t = 33554432; -pub const CRTKIL: tcflag_t = 67108864; -pub const PASS8: tcflag_t = 134217728; -pub const CTLECH: tcflag_t = 268435456; -pub const DECCTQ: tcflag_t = 1073741824; +pub const TANDEM: ::tcflag_t = 1; +pub const CBREAK: ::tcflag_t = 2; +pub const LCASE: ::tcflag_t = 4; +pub const CRMOD: ::tcflag_t = 16; +pub const RAW: ::tcflag_t = 32; +pub const ODDP: ::tcflag_t = 64; +pub const EVENP: ::tcflag_t = 128; +pub const ANYP: ::tcflag_t = 192; +pub const NLDELAY: ::tcflag_t = 768; +pub const NL2: ::tcflag_t = 512; +pub const NL3: ::tcflag_t = 768; +pub const TBDELAY: ::tcflag_t = 3072; +pub const XTABS: ::tcflag_t = 3072; +pub const CRDELAY: ::tcflag_t = 12288; +pub const VTDELAY: ::tcflag_t = 16384; +pub const BSDELAY: ::tcflag_t = 32768; +pub const ALLDELAY: ::tcflag_t = 65280; +pub const CRTBS: ::tcflag_t = 65536; +pub const PRTERA: ::tcflag_t = 131072; +pub const CRTERA: ::tcflag_t = 262144; +pub const TILDE: ::tcflag_t = 524288; +pub const LITOUT: ::tcflag_t = 2097152; +pub const NOHANG: ::tcflag_t = 16777216; +pub const L001000: ::tcflag_t = 33554432; +pub const CRTKIL: ::tcflag_t = 67108864; +pub const PASS8: ::tcflag_t = 134217728; +pub const CTLECH: ::tcflag_t = 268435456; +pub const DECCTQ: ::tcflag_t = 1073741824; pub const FIONBIO: ::c_ulong = 0xa008007e; pub const FIONREAD: ::c_ulong = 0x6008007f; @@ -2007,7 +2695,6 @@ pub const TCPOPT_TSTAMP_HDR: u32 = 16844810; pub const TCP_MSS: usize = 512; pub const TCP_MAXWIN: usize = 65535; pub const TCP_MAX_WINSHIFT: usize = 14; -pub const SOL_TCP: ::c_int = 6; pub const TCPI_OPT_TIMESTAMPS: u8 = 1; pub const TCPI_OPT_SACK: u8 = 2; pub const TCPI_OPT_WSCALE: u8 = 4; @@ -2042,21 +2729,64 @@ pub const PROT_NONE: ::c_int = 0; pub const PROT_READ: ::c_int = 4; pub const PROT_WRITE: ::c_int = 2; pub const PROT_EXEC: ::c_int = 1; -pub const MAP_PRIVATE: ::c_int = 0; pub const MAP_FILE: ::c_int = 1; pub const MAP_ANON: ::c_int = 2; -pub const MAP_SHARED: ::c_int = 16; +pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; +pub const MAP_TYPE: ::c_int = 15; pub const MAP_COPY: ::c_int = 32; +pub const MAP_SHARED: ::c_int = 16; +pub const MAP_PRIVATE: ::c_int = 0; pub const MAP_FIXED: ::c_int = 256; +pub const MAP_NOEXTEND: ::c_int = 512; +pub const MAP_HASSEMPHORE: ::c_int = 1024; +pub const MAP_INHERIT: ::c_int = 2048; pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; -pub const MS_SYNC: ::c_int = 0; -pub const MS_ASYNC: ::c_int = 1; -pub const MS_INVALIDATE: ::c_int = 2; pub const MADV_NORMAL: ::c_int = 0; pub const MADV_RANDOM: ::c_int = 1; pub const MADV_SEQUENTIAL: ::c_int = 2; pub const MADV_WILLNEED: ::c_int = 3; pub const MADV_DONTNEED: ::c_int = 4; +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 POSIX_MADV_WONTNEED: ::c_int = 4; + +pub const MS_ASYNC: ::c_int = 1; +pub const MS_SYNC: ::c_int = 0; +pub const MS_INVALIDATE: ::c_int = 2; +pub const MREMAP_MAYMOVE: ::c_int = 1; +pub const MREMAP_FIXED: ::c_int = 2; +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; + +// spawn.h +pub const POSIX_SPAWN_USEVFORK: ::c_int = 64; +pub const POSIX_SPAWN_SETSID: ::c_int = 128; + +// sys/syslog.h +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; + +// net/if.h +pub const IFF_UP: ::c_int = 0x1; +pub const IFF_BROADCAST: ::c_int = 0x2; +pub const IFF_DEBUG: ::c_int = 0x4; +pub const IFF_LOOPBACK: ::c_int = 0x8; +pub const IFF_POINTOPOINT: ::c_int = 0x10; +pub const IFF_NOTRAILERS: ::c_int = 0x20; +pub const IFF_RUNNING: ::c_int = 0x40; +pub const IFF_NOARP: ::c_int = 0x80; +pub const IFF_PROMISC: ::c_int = 0x100; +pub const IFF_ALLMULTI: ::c_int = 0x200; +pub const IFF_MASTER: ::c_int = 0x400; +pub const IFF_SLAVE: ::c_int = 0x800; +pub const IFF_MULTICAST: ::c_int = 0x1000; +pub const IFF_PORTSEL: ::c_int = 0x2000; +pub const IFF_AUTOMEDIA: ::c_int = 0x4000; +pub const IFF_DYNAMIC: ::c_int = 0x8000; // random.h pub const GRND_NONBLOCK: ::c_uint = 1; @@ -2391,21 +3121,21 @@ pub const PTHREAD_MUTEX_RECURSIVE: __pthread_mutex_type = 2; pub const PTHREAD_MUTEX_STALLED: __pthread_mutex_robustness = 0; pub const PTHREAD_MUTEX_ROBUST: __pthread_mutex_robustness = 256; -pub const RLIMIT_CPU: __rlimit_resource = 0; -pub const RLIMIT_FSIZE: __rlimit_resource = 1; -pub const RLIMIT_DATA: __rlimit_resource = 2; -pub const RLIMIT_STACK: __rlimit_resource = 3; -pub const RLIMIT_CORE: __rlimit_resource = 4; -pub const RLIMIT_RSS: __rlimit_resource = 5; -pub const RLIMIT_MEMLOCK: __rlimit_resource = 6; -pub const RLIMIT_NPROC: __rlimit_resource = 7; -pub const RLIMIT_OFILE: __rlimit_resource = 8; -pub const RLIMIT_NOFILE: __rlimit_resource = 8; -pub const RLIMIT_SBSIZE: __rlimit_resource = 9; -pub const RLIMIT_AS: __rlimit_resource = 10; -pub const RLIMIT_VMEM: __rlimit_resource = 10; -pub const RLIMIT_NLIMITS: __rlimit_resource = 11; -pub const RLIM_NLIMITS: __rlimit_resource = 11; +pub const RLIMIT_CPU: ::__rlimit_resource_t = 0; +pub const RLIMIT_FSIZE: ::__rlimit_resource_t = 1; +pub const RLIMIT_DATA: ::__rlimit_resource_t = 2; +pub const RLIMIT_STACK: ::__rlimit_resource_t = 3; +pub const RLIMIT_CORE: ::__rlimit_resource_t = 4; +pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; +pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 6; +pub const RLIMIT_NPROC: ::__rlimit_resource_t = 7; +pub const RLIMIT_OFILE: ::__rlimit_resource_t = 8; +pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 8; +pub const RLIMIT_SBSIZE: ::__rlimit_resource_t = 9; +pub const RLIMIT_AS: ::__rlimit_resource_t = 10; +pub const RLIMIT_VMEM: ::__rlimit_resource_t = 10; +pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = 11; +pub const RLIM_NLIMITS: ::__rlimit_resource_t = 11; pub const RUSAGE_SELF: __rusage_who = 0; pub const RUSAGE_CHILDREN: __rusage_who = -1; @@ -2414,6 +3144,10 @@ pub const PRIO_PROCESS: __priority_which = 0; pub const PRIO_PGRP: __priority_which = 1; pub const PRIO_USER: __priority_which = 2; +pub const __UT_LINESIZE: usize = 32; +pub const __UT_NAMESIZE: usize = 32; +pub const __UT_HOSTSIZE: usize = 256; + pub const SOCK_STREAM: ::c_int = 1; pub const SOCK_DGRAM: ::c_int = 2; pub const SOCK_RAW: ::c_int = 3; @@ -2431,6 +3165,7 @@ pub const MSG_CTRUNC: ::c_int = 32; pub const MSG_WAITALL: ::c_int = 64; pub const MSG_DONTWAIT: ::c_int = 128; pub const MSG_NOSIGNAL: ::c_int = 1024; +pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000; pub const SCM_RIGHTS: ::c_int = 1; pub const SCM_TIMESTAMP: ::c_int = 2; @@ -2693,8 +3428,105 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { }; pub const PTHREAD_STACK_MIN: ::size_t = 0; +const_fn! { + {const} fn CMSG_ALIGN(len: usize) -> usize { + len + ::mem::size_of::() - 1 & !(::mem::size_of::() - 1) + } +} + // functions f! { + pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { + if (*mhdr).msg_controllen as usize >= ::mem::size_of::() { + (*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 {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { + (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::())) + as ::c_uint + } + + pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint { + CMSG_ALIGN(::mem::size_of::()) 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::() { + 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 + } + } + + 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; + } + } + + 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_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::(), cpuset) + } + + pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { + set1.bits == set2.bits + } + pub fn major(dev: ::dev_t) -> ::c_uint { ((dev >> 8) & 0xff) as ::c_uint } @@ -2703,6 +3535,14 @@ f! { (dev & 0xffff00ff) as ::c_uint } + pub fn IPTOS_TOS(tos: u8) -> u8 { + tos & IPTOS_TOS_MASK + } + + pub fn IPTOS_PREC(tos: u8) -> u8 { + tos & IPTOS_PREC_MASK + } + 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; @@ -2756,11 +3596,26 @@ extern "C" { pub fn __libc_current_sigrtmax() -> ::c_int; + pub fn wait4( + pid: ::pid_t, + status: *mut ::c_int, + options: ::c_int, + rusage: *mut ::rusage, + ) -> ::pid_t; + pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int) -> ::c_int; pub fn sigwait(__set: *const sigset_t, __sig: *mut ::c_int) -> ::c_int; + pub fn sigsuspend(mask: *const ::sigset_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 sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int; pub fn ioctl(__fd: ::c_int, __request: ::c_ulong, ...) -> ::c_int; @@ -2806,10 +3661,72 @@ extern "C" { offset: ::off64_t, ) -> ::ssize_t; + pub fn fread_unlocked( + buf: *mut ::c_void, + size: ::size_t, + nobj: ::size_t, + stream: *mut ::FILE, + ) -> ::size_t; + + 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 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; + pub fn lseek64(__fd: ::c_int, __offset: __off64_t, __whence: ::c_int) -> __off64_t; pub fn lseek(__fd: ::c_int, __offset: __off_t, __whence: ::c_int) -> __off_t; + pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int; + pub fn fseeko64(stream: *mut ::FILE, offset: ::off64_t, whence: ::c_int) -> ::c_int; + pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int; + pub fn ftello64(stream: *mut ::FILE) -> ::off64_t; + pub fn bind(__fd: ::c_int, __addr: *const sockaddr, __len: socklen_t) -> ::c_int; pub fn accept4( @@ -2819,6 +3736,13 @@ extern "C" { flg: ::c_int, ) -> ::c_int; + pub fn ppoll( + fds: *mut ::pollfd, + nfds: nfds_t, + timeout: *const ::timespec, + sigmask: *const sigset_t, + ) -> ::c_int; + pub fn recvmsg(__fd: ::c_int, __message: *mut msghdr, __flags: ::c_int) -> ::ssize_t; pub fn sendmsg(__fd: ::c_int, __message: *const msghdr, __flags: ::c_int) -> ssize_t; @@ -2832,12 +3756,95 @@ extern "C" { addrlen: *mut ::socklen_t, ) -> ::ssize_t; + pub fn sendfile( + out_fd: ::c_int, + in_fd: ::c_int, + 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 shutdown(__fd: ::c_int, __how: ::c_int) -> ::c_int; pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int; + 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 if_nameindex() -> *mut if_nameindex; + pub fn if_freenameindex(ptr: *mut if_nameindex); + + pub fn getnameinfo( + sa: *const ::sockaddr, + salen: ::socklen_t, + host: *mut ::c_char, + hostlen: ::socklen_t, + serv: *mut ::c_char, + servlen: ::socklen_t, + flags: ::c_int, + ) -> ::c_int; + + pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; + pub fn freeifaddrs(ifa: *mut ::ifaddrs); pub fn uname(buf: *mut ::utsname) -> ::c_int; + pub fn gethostid() -> ::c_long; + pub fn sethostid(hostid: ::c_long) -> ::c_int; + + pub fn setpwent(); + pub fn endpwent(); + pub fn getpwent() -> *mut passwd; + pub fn setgrent(); + pub fn endgrent(); + pub fn getgrent() -> *mut ::group; + pub fn setspent(); + pub fn endspent(); + pub fn getspent() -> *mut spwd; + + pub fn getspnam(name: *const ::c_char) -> *mut spwd; + + pub fn getpwent_r( + pwd: *mut ::passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::passwd, + ) -> ::c_int; + pub fn getgrent_r( + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group, + ) -> ::c_int; + pub fn fgetpwent_r( + stream: *mut ::FILE, + pwd: *mut ::passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::passwd, + ) -> ::c_int; + pub fn fgetgrent_r( + stream: *mut ::FILE, + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group, + ) -> ::c_int; + + pub fn putpwent(p: *const ::passwd, stream: *mut ::FILE) -> ::c_int; + pub fn putgrent(grp: *const ::group, stream: *mut ::FILE) -> ::c_int; + + pub fn getpwnam_r( + name: *const ::c_char, + pwd: *mut passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut passwd, + ) -> ::c_int; + pub fn getpwuid_r( uid: ::uid_t, pwd: *mut passwd, @@ -2846,23 +3853,111 @@ extern "C" { result: *mut *mut passwd, ) -> ::c_int; + 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 getspnam_r( + name: *const ::c_char, + spbuf: *mut spwd, + buf: *mut ::c_char, + buflen: ::size_t, + spbufp: *mut *mut spwd, + ) -> ::c_int; + + // mntent.h + pub fn getmntent_r( + stream: *mut ::FILE, + mntbuf: *mut ::mntent, + buf: *mut ::c_char, + buflen: ::c_int, + ) -> *mut ::mntent; + + pub fn utmpname(file: *const ::c_char) -> ::c_int; + pub fn utmpxname(file: *const ::c_char) -> ::c_int; + pub fn getutxent() -> *mut utmpx; + pub fn getutxid(ut: *const utmpx) -> *mut utmpx; + pub fn getutxline(ut: *const utmpx) -> *mut utmpx; + pub fn pututxline(ut: *const utmpx) -> *mut utmpx; + pub fn setutxent(); + pub fn endutxent(); + + 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 setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int; + pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int; + + pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int; + + pub fn getgrgid(gid: ::gid_t) -> *mut ::group; + pub fn getgrgid_r( + gid: ::gid_t, + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group, + ) -> ::c_int; + + pub fn getgrnam(name: *const ::c_char) -> *mut ::group; + pub fn getgrnam_r( + name: *const ::c_char, + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group, + ) -> ::c_int; + + pub fn getgrouplist( + user: *const ::c_char, + group: ::gid_t, + groups: *mut ::gid_t, + ngroups: *mut ::c_int, + ) -> ::c_int; + pub fn setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int; + pub fn acct(filename: *const ::c_char) -> ::c_int; + + 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 pthread_create( native: *mut ::pthread_t, attr: *const ::pthread_attr_t, f: extern "C" fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void, ) -> ::c_int; - pub fn pthread_kill(__threadid: pthread_t, __signo: ::c_int) -> ::c_int; + pub fn pthread_kill(__threadid: ::pthread_t, __signo: ::c_int) -> ::c_int; + pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int; pub fn __pthread_equal(__t1: __pthread_t, __t2: __pthread_t) -> ::c_int; - pub fn pthread_getattr_np(__thr: pthread_t, __attr: *mut pthread_attr_t) -> ::c_int; + pub fn pthread_getattr_np(__thr: ::pthread_t, __attr: *mut pthread_attr_t) -> ::c_int; pub fn pthread_attr_getguardsize( __attr: *const pthread_attr_t, __guardsize: *mut ::size_t, ) -> ::c_int; + pub fn pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::size_t) -> ::c_int; pub fn pthread_attr_getstack( __attr: *const pthread_attr_t, @@ -2870,11 +3965,64 @@ extern "C" { __stacksize: *mut ::size_t, ) -> ::c_int; + pub fn pthread_mutexattr_getpshared( + attr: *const pthread_mutexattr_t, + pshared: *mut ::c_int, + ) -> ::c_int; + pub fn pthread_mutexattr_setpshared( + attr: *mut pthread_mutexattr_t, + pshared: ::c_int, + ) -> ::c_int; + + pub fn pthread_mutex_timedlock( + lock: *mut pthread_mutex_t, + abstime: *const ::timespec, + ) -> ::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 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_getpshared( + attr: *const pthread_condattr_t, + pshared: *mut ::c_int, + ) -> ::c_int; + pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: ::c_int) -> ::c_int; + + pub fn pthread_once(control: *mut pthread_once_t, routine: extern "C" fn()) -> ::c_int; + pub fn pthread_barrierattr_init(attr: *mut ::pthread_barrierattr_t) -> ::c_int; + pub fn pthread_barrierattr_destroy(attr: *mut ::pthread_barrierattr_t) -> ::c_int; + pub fn pthread_barrierattr_getpshared( + attr: *const ::pthread_barrierattr_t, + shared: *mut ::c_int, + ) -> ::c_int; + pub fn pthread_barrierattr_setpshared( + attr: *mut ::pthread_barrierattr_t, + shared: ::c_int, + ) -> ::c_int; + pub fn pthread_barrier_init( + barrier: *mut pthread_barrier_t, + attr: *const ::pthread_barrierattr_t, + count: ::c_uint, + ) -> ::c_int; + pub fn pthread_barrier_destroy(barrier: *mut pthread_barrier_t) -> ::c_int; + pub fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> ::c_int; + pub fn pthread_spin_init(lock: *mut ::pthread_spinlock_t, pshared: ::c_int) -> ::c_int; + pub fn pthread_spin_destroy(lock: *mut ::pthread_spinlock_t) -> ::c_int; + pub fn pthread_spin_lock(lock: *mut ::pthread_spinlock_t) -> ::c_int; + pub fn pthread_spin_trylock(lock: *mut ::pthread_spinlock_t) -> ::c_int; + pub fn pthread_spin_unlock(lock: *mut ::pthread_spinlock_t) -> ::c_int; pub fn pthread_atfork( prepare: ::Option, parent: ::Option, @@ -2887,9 +4035,72 @@ extern "C" { __oldmask: *mut __sigset_t, ) -> ::c_int; + pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int; + pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int; + pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int; + pub fn sched_setscheduler( + pid: ::pid_t, + policy: ::c_int, + param: *const ::sched_param, + ) -> ::c_int; + pub fn pthread_getschedparam( + native: ::pthread_t, + policy: *mut ::c_int, + param: *mut ::sched_param, + ) -> ::c_int; + pub fn pthread_setschedparam( + native: ::pthread_t, + policy: ::c_int, + param: *const ::sched_param, + ) -> ::c_int; + + pub fn pthread_getcpuclockid(thread: ::pthread_t, clk_id: *mut ::clockid_t) -> ::c_int; + + pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int; + pub fn sem_destroy(sem: *mut sem_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 clock_getres(__clock_id: clockid_t, __res: *mut ::timespec) -> ::c_int; pub fn clock_gettime(__clock_id: clockid_t, __tp: *mut ::timespec) -> ::c_int; pub fn clock_settime(__clock_id: clockid_t, __tp: *const ::timespec) -> ::c_int; + pub fn clock_getcpuclockid(pid: ::pid_t, clk_id: *mut ::clockid_t) -> ::c_int; + + pub fn clock_nanosleep( + clk_id: ::clockid_t, + flags: ::c_int, + rqtp: *const ::timespec, + rmtp: *mut ::timespec, + ) -> ::c_int; + + pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int; + pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int; + + pub fn asctime_r(tm: *const ::tm, buf: *mut ::c_char) -> *mut ::c_char; + pub fn ctime_r(timep: *const time_t, buf: *mut ::c_char) -> *mut ::c_char; + + pub fn strftime( + s: *mut ::c_char, + max: ::size_t, + format: *const ::c_char, + tm: *const ::tm, + ) -> ::size_t; + pub fn strptime(s: *const ::c_char, format: *const ::c_char, tm: *mut ::tm) -> *mut ::c_char; + + pub fn timer_create( + clockid: ::clockid_t, + sevp: *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, curr_value: *mut ::itimerspec) -> ::c_int; + pub fn timer_settime( + timerid: ::timer_t, + flags: ::c_int, + new_value: *const ::itimerspec, + old_value: *mut ::itimerspec, + ) -> ::c_int; pub fn fstat(__fd: ::c_int, __buf: *mut stat) -> ::c_int; pub fn fstat64(__fd: ::c_int, __buf: *mut stat64) -> ::c_int; @@ -2907,6 +4118,14 @@ extern "C" { __flag: ::c_int, ) -> ::c_int; + pub fn statx( + dirfd: ::c_int, + pathname: *const c_char, + flags: ::c_int, + mask: ::c_uint, + statxbuf: *mut statx, + ) -> ::c_int; + pub fn ftruncate(__fd: ::c_int, __length: __off_t) -> ::c_int; pub fn ftruncate64(__fd: ::c_int, __length: __off64_t) -> ::c_int; pub fn truncate64(__file: *const ::c_char, __length: __off64_t) -> ::c_int; @@ -2930,6 +4149,175 @@ extern "C" { pub fn openat(__fd: ::c_int, __file: *const ::c_char, __oflag: ::c_int, ...) -> ::c_int; pub fn openat64(__fd: ::c_int, __file: *const ::c_char, __oflag: ::c_int, ...) -> ::c_int; + pub fn 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 creat64(path: *const c_char, mode: mode_t) -> ::c_int; + + pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int; + pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int; + pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; + pub fn tmpfile64() -> *mut ::FILE; + + pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; + + pub fn getdtablesize() -> ::c_int; + + // Added in `glibc` 2.34 + pub fn close_range(first: ::c_uint, last: ::c_uint, flags: ::c_int) -> ::c_int; + + pub fn openpty( + __amaster: *mut ::c_int, + __aslave: *mut ::c_int, + __name: *mut ::c_char, + __termp: *const termios, + __winp: *const ::winsize, + ) -> ::c_int; + + pub fn forkpty( + __amaster: *mut ::c_int, + __name: *mut ::c_char, + __termp: *const termios, + __winp: *const ::winsize, + ) -> ::pid_t; + + pub fn getpt() -> ::c_int; + pub fn ptsname_r(fd: ::c_int, buf: *mut ::c_char, buflen: ::size_t) -> ::c_int; + pub fn login_tty(fd: ::c_int) -> ::c_int; + + pub fn ctermid(s: *mut ::c_char) -> *mut ::c_char; + + pub fn clearenv() -> ::c_int; + + pub fn execveat( + dirfd: ::c_int, + pathname: *const ::c_char, + argv: *const *mut c_char, + envp: *const *mut c_char, + flags: ::c_int, + ) -> ::c_int; + pub fn execvpe( + file: *const ::c_char, + argv: *const *const ::c_char, + envp: *const *const ::c_char, + ) -> ::c_int; + pub fn fexecve( + fd: ::c_int, + argv: *const *const ::c_char, + envp: *const *const ::c_char, + ) -> ::c_int; + + pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; + + // posix/spawn.h + pub fn posix_spawn( + pid: *mut ::pid_t, + path: *const ::c_char, + file_actions: *const ::posix_spawn_file_actions_t, + attrp: *const ::posix_spawnattr_t, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char, + ) -> ::c_int; + pub fn posix_spawnp( + pid: *mut ::pid_t, + file: *const ::c_char, + file_actions: *const ::posix_spawn_file_actions_t, + attrp: *const ::posix_spawnattr_t, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char, + ) -> ::c_int; + pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int; + pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int; + pub fn posix_spawnattr_getsigdefault( + attr: *const posix_spawnattr_t, + default: *mut ::sigset_t, + ) -> ::c_int; + pub fn posix_spawnattr_setsigdefault( + attr: *mut posix_spawnattr_t, + default: *const ::sigset_t, + ) -> ::c_int; + pub fn posix_spawnattr_getsigmask( + attr: *const posix_spawnattr_t, + default: *mut ::sigset_t, + ) -> ::c_int; + pub fn posix_spawnattr_setsigmask( + attr: *mut posix_spawnattr_t, + default: *const ::sigset_t, + ) -> ::c_int; + pub fn posix_spawnattr_getflags( + 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_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_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_getschedparam( + attr: *const posix_spawnattr_t, + param: *mut ::sched_param, + ) -> ::c_int; + pub fn posix_spawnattr_setschedparam( + attr: *mut posix_spawnattr_t, + 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_addopen( + actions: *mut posix_spawn_file_actions_t, + fd: ::c_int, + path: *const ::c_char, + oflag: ::c_int, + mode: ::mode_t, + ) -> ::c_int; + pub fn posix_spawn_file_actions_addclose( + actions: *mut posix_spawn_file_actions_t, + fd: ::c_int, + ) -> ::c_int; + pub fn posix_spawn_file_actions_adddup2( + actions: *mut posix_spawn_file_actions_t, + fd: ::c_int, + newfd: ::c_int, + ) -> ::c_int; + + // Added in `glibc` 2.29 + pub fn posix_spawn_file_actions_addchdir_np( + actions: *mut ::posix_spawn_file_actions_t, + path: *const ::c_char, + ) -> ::c_int; + // Added in `glibc` 2.29 + pub fn posix_spawn_file_actions_addfchdir_np( + actions: *mut ::posix_spawn_file_actions_t, + fd: ::c_int, + ) -> ::c_int; + // Added in `glibc` 2.34 + pub fn posix_spawn_file_actions_addclosefrom_np( + actions: *mut ::posix_spawn_file_actions_t, + from: ::c_int, + ) -> ::c_int; + // Added in `glibc` 2.35 + pub fn posix_spawn_file_actions_addtcsetpgrp_np( + actions: *mut ::posix_spawn_file_actions_t, + tcfd: ::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; + + pub fn euidaccess(pathname: *const ::c_char, mode: ::c_int) -> ::c_int; + pub fn eaccess(pathname: *const ::c_char, mode: ::c_int) -> ::c_int; + pub fn faccessat( dirfd: ::c_int, pathname: *const ::c_char, @@ -2944,6 +4332,13 @@ extern "C" { pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64; pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, result: *mut *mut ::dirent) -> ::c_int; + pub fn readdir64_r( + dirp: *mut ::DIR, + entry: *mut ::dirent64, + result: *mut *mut ::dirent64, + ) -> ::c_int; + pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long); + pub fn telldir(dirp: *mut ::DIR) -> ::c_long; pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; @@ -2961,6 +4356,14 @@ extern "C" { __offset: __off64_t, ) -> *mut ::c_void; + pub fn mremap( + addr: *mut ::c_void, + len: ::size_t, + new_len: ::size_t, + flags: ::c_int, + ... + ) -> *mut ::c_void; + pub fn mprotect(__addr: *mut ::c_void, __len: ::size_t, __prot: ::c_int) -> ::c_int; pub fn msync(__addr: *mut ::c_void, __len: ::size_t, __flags: ::c_int) -> ::c_int; @@ -2983,10 +4386,12 @@ extern "C" { pub fn madvise(__addr: *mut ::c_void, __len: ::size_t, __advice: ::c_int) -> ::c_int; - pub fn getrlimit(resource: ::__rlimit_resource, rlim: *mut ::rlimit) -> ::c_int; - pub fn getrlimit64(resource: ::__rlimit_resource, rlim: *mut ::rlimit64) -> ::c_int; - pub fn setrlimit(resource: ::__rlimit_resource, rlim: *const ::rlimit) -> ::c_int; - pub fn setrlimit64(resource: ::__rlimit_resource, rlim: *const ::rlimit64) -> ::c_int; + pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int; + + pub fn getrlimit(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit) -> ::c_int; + pub fn getrlimit64(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit64) -> ::c_int; + pub fn setrlimit(resource: ::__rlimit_resource_t, rlim: *const ::rlimit) -> ::c_int; + pub fn setrlimit64(resource: ::__rlimit_resource_t, rlim: *const ::rlimit64) -> ::c_int; pub fn getpriority(which: ::__priority_which, who: ::id_t) -> ::c_int; pub fn setpriority(which: ::__priority_which, who: ::id_t, prio: ::c_int) -> ::c_int; @@ -2994,7 +4399,179 @@ extern "C" { pub fn getrandom(__buffer: *mut ::c_void, __length: ::size_t, __flags: ::c_uint) -> ::ssize_t; pub fn getentropy(__buffer: *mut ::c_void, __length: ::size_t) -> ::c_int; + pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void; + pub fn memmem( + haystack: *const ::c_void, + haystacklen: ::size_t, + needle: *const ::c_void, + needlelen: ::size_t, + ) -> *mut ::c_void; + pub fn strchrnul(s: *const ::c_char, c: ::c_int) -> *mut ::c_char; + + pub fn abs(i: ::c_int) -> ::c_int; + pub fn labs(i: ::c_long) -> ::c_long; + pub fn rand() -> ::c_int; + pub fn srand(seed: ::c_uint); + + pub fn drand48() -> ::c_double; + pub fn erand48(xseed: *mut ::c_ushort) -> ::c_double; + pub fn lrand48() -> ::c_long; + pub fn nrand48(xseed: *mut ::c_ushort) -> ::c_long; + pub fn mrand48() -> ::c_long; + pub fn jrand48(xseed: *mut ::c_ushort) -> ::c_long; + pub fn srand48(seed: ::c_long); + pub fn seed48(xseed: *mut ::c_ushort) -> *mut ::c_ushort; + pub fn lcong48(p: *mut ::c_ushort); + + 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 brk(addr: *mut ::c_void) -> ::c_int; + pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void; + + pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; + pub fn mallopt(param: ::c_int, value: ::c_int) -> ::c_int; + + pub fn mallinfo() -> ::mallinfo; + pub fn mallinfo2() -> ::mallinfo2; + pub fn malloc_info(options: ::c_int, stream: *mut ::FILE) -> ::c_int; + pub fn malloc_usable_size(ptr: *mut ::c_void) -> ::size_t; + pub fn malloc_trim(__pad: ::size_t) -> ::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; + + pub fn getopt_long( + argc: ::c_int, + argv: *const *mut c_char, + optstring: *const c_char, + longopts: *const option, + longindex: *mut ::c_int, + ) -> ::c_int; + pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int; + + pub fn reboot(how_to: ::c_int) -> ::c_int; + + pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::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 glob( + pattern: *const c_char, + flags: ::c_int, + errfunc: ::Option ::c_int>, + pglob: *mut ::glob_t, + ) -> ::c_int; + pub fn globfree(pglob: *mut ::glob_t); + + pub fn glob64( + pattern: *const ::c_char, + flags: ::c_int, + errfunc: ::Option ::c_int>, + pglob: *mut glob64_t, + ) -> ::c_int; + pub fn globfree64(pglob: *mut glob64_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 dirname(path: *mut ::c_char) -> *mut ::c_char; + /// POSIX version of `basename(3)`, defined in `libgen.h`. + #[link_name = "__xpg_basename"] + pub fn posix_basename(path: *mut ::c_char) -> *mut ::c_char; + /// GNU version of `basename(3)`, defined in `string.h`. + #[link_name = "basename"] + pub fn gnu_basename(path: *const ::c_char) -> *mut ::c_char; + + 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; + pub fn dladdr1( + addr: *const ::c_void, + info: *mut ::Dl_info, + extra_info: *mut *mut ::c_void, + flags: ::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 nl_langinfo(item: ::nl_item) -> *mut ::c_char; + pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; + pub fn dl_iterate_phdr( callback: ::Option< unsafe extern "C" fn( @@ -3005,6 +4582,9 @@ extern "C" { >, data: *mut ::c_void, ) -> ::c_int; + + pub fn gnu_get_libc_release() -> *const ::c_char; + pub fn gnu_get_libc_version() -> *const ::c_char; } safe_f! { diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index cdac6c32ee3f4..1bc484d690262 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -46,6 +46,8 @@ pub type Elf64_Off = u64; pub type Elf64_Word = u32; pub type Elf64_Xword = u64; +pub type eventfd_t = u64; + s! { pub struct stack_t { pub ss_sp: *mut ::c_void, @@ -1562,6 +1564,7 @@ pub const RLIMIT_MSGQUEUE: ::c_int = 12; pub const RLIMIT_NICE: ::c_int = 13; pub const RLIMIT_RTPRIO: ::c_int = 14; +#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::c_int = 16; pub const RLIM_INFINITY: ::rlim_t = !0; @@ -1706,6 +1709,7 @@ pub const REG_BACKR: ::c_int = 1024; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const CBAUD: ::tcflag_t = 0o0010017; pub const TAB1: ::tcflag_t = 0x00000800; @@ -2479,6 +2483,7 @@ pub const IFF_TUN: ::c_int = 0x0001; pub const IFF_TAP: ::c_int = 0x0002; pub const IFF_NAPI: ::c_int = 0x0010; pub const IFF_NAPI_FRAGS: ::c_int = 0x0020; +pub const IFF_NO_CARRIER: ::c_int = 0x0040; pub const IFF_NO_PI: ::c_int = 0x1000; pub const IFF_ONE_QUEUE: ::c_int = 0x2000; pub const IFF_VNET_HDR: ::c_int = 0x4000; @@ -2488,6 +2493,14 @@ pub const IFF_ATTACH_QUEUE: ::c_int = 0x0200; pub const IFF_DETACH_QUEUE: ::c_int = 0x0400; pub const IFF_PERSIST: ::c_int = 0x0800; pub const IFF_NOFILTER: ::c_int = 0x1000; +// Features for GSO (TUNSETOFFLOAD) +pub const TUN_F_CSUM: ::c_uint = 0x01; +pub const TUN_F_TSO4: ::c_uint = 0x02; +pub const TUN_F_TSO6: ::c_uint = 0x04; +pub const TUN_F_TSO_ECN: ::c_uint = 0x08; +pub const TUN_F_UFO: ::c_uint = 0x10; +pub const TUN_F_USO4: ::c_uint = 0x20; +pub const TUN_F_USO6: ::c_uint = 0x40; // start android/platform/bionic/libc/kernel/uapi/linux/if_ether.h // from https://android.googlesource.com/platform/bionic/+/HEAD/libc/kernel/uapi/linux/if_ether.h @@ -2743,6 +2756,7 @@ pub const ALG_SET_IV: ::c_int = 2; pub const ALG_SET_OP: ::c_int = 3; pub const ALG_SET_AEAD_ASSOCLEN: ::c_int = 4; pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5; +pub const ALG_SET_DRBG_ENTROPY: ::c_int = 6; pub const ALG_OP_DECRYPT: ::c_int = 0; pub const ALG_OP_ENCRYPT: ::c_int = 1; @@ -3150,6 +3164,135 @@ pub const RTMSG_DELDEVICE: u32 = 0x12; pub const RTMSG_NEWROUTE: u32 = 0x21; pub const RTMSG_DELROUTE: u32 = 0x22; +pub const CTL_KERN: ::c_int = 1; +pub const CTL_VM: ::c_int = 2; +pub const CTL_NET: ::c_int = 3; +pub const CTL_FS: ::c_int = 5; +pub const CTL_DEBUG: ::c_int = 6; +pub const CTL_DEV: ::c_int = 7; +pub const CTL_BUS: ::c_int = 8; +pub const CTL_ABI: ::c_int = 9; +pub const CTL_CPU: ::c_int = 10; + +pub const CTL_BUS_ISA: ::c_int = 1; + +pub const INOTIFY_MAX_USER_INSTANCES: ::c_int = 1; +pub const INOTIFY_MAX_USER_WATCHES: ::c_int = 2; +pub const INOTIFY_MAX_QUEUED_EVENTS: ::c_int = 3; + +pub const KERN_OSTYPE: ::c_int = 1; +pub const KERN_OSRELEASE: ::c_int = 2; +pub const KERN_OSREV: ::c_int = 3; +pub const KERN_VERSION: ::c_int = 4; +pub const KERN_SECUREMASK: ::c_int = 5; +pub const KERN_PROF: ::c_int = 6; +pub const KERN_NODENAME: ::c_int = 7; +pub const KERN_DOMAINNAME: ::c_int = 8; +pub const KERN_PANIC: ::c_int = 15; +pub const KERN_REALROOTDEV: ::c_int = 16; +pub const KERN_SPARC_REBOOT: ::c_int = 21; +pub const KERN_CTLALTDEL: ::c_int = 22; +pub const KERN_PRINTK: ::c_int = 23; +pub const KERN_NAMETRANS: ::c_int = 24; +pub const KERN_PPC_HTABRECLAIM: ::c_int = 25; +pub const KERN_PPC_ZEROPAGED: ::c_int = 26; +pub const KERN_PPC_POWERSAVE_NAP: ::c_int = 27; +pub const KERN_MODPROBE: ::c_int = 28; +pub const KERN_SG_BIG_BUFF: ::c_int = 29; +pub const KERN_ACCT: ::c_int = 30; +pub const KERN_PPC_L2CR: ::c_int = 31; +pub const KERN_RTSIGNR: ::c_int = 32; +pub const KERN_RTSIGMAX: ::c_int = 33; +pub const KERN_SHMMAX: ::c_int = 34; +pub const KERN_MSGMAX: ::c_int = 35; +pub const KERN_MSGMNB: ::c_int = 36; +pub const KERN_MSGPOOL: ::c_int = 37; +pub const KERN_SYSRQ: ::c_int = 38; +pub const KERN_MAX_THREADS: ::c_int = 39; +pub const KERN_RANDOM: ::c_int = 40; +pub const KERN_SHMALL: ::c_int = 41; +pub const KERN_MSGMNI: ::c_int = 42; +pub const KERN_SEM: ::c_int = 43; +pub const KERN_SPARC_STOP_A: ::c_int = 44; +pub const KERN_SHMMNI: ::c_int = 45; +pub const KERN_OVERFLOWUID: ::c_int = 46; +pub const KERN_OVERFLOWGID: ::c_int = 47; +pub const KERN_SHMPATH: ::c_int = 48; +pub const KERN_HOTPLUG: ::c_int = 49; +pub const KERN_IEEE_EMULATION_WARNINGS: ::c_int = 50; +pub const KERN_S390_USER_DEBUG_LOGGING: ::c_int = 51; +pub const KERN_CORE_USES_PID: ::c_int = 52; +pub const KERN_TAINTED: ::c_int = 53; +pub const KERN_CADPID: ::c_int = 54; +pub const KERN_PIDMAX: ::c_int = 55; +pub const KERN_CORE_PATTERN: ::c_int = 56; +pub const KERN_PANIC_ON_OOPS: ::c_int = 57; +pub const KERN_HPPA_PWRSW: ::c_int = 58; +pub const KERN_HPPA_UNALIGNED: ::c_int = 59; +pub const KERN_PRINTK_RATELIMIT: ::c_int = 60; +pub const KERN_PRINTK_RATELIMIT_BURST: ::c_int = 61; +pub const KERN_PTY: ::c_int = 62; +pub const KERN_NGROUPS_MAX: ::c_int = 63; +pub const KERN_SPARC_SCONS_PWROFF: ::c_int = 64; +pub const KERN_HZ_TIMER: ::c_int = 65; +pub const KERN_UNKNOWN_NMI_PANIC: ::c_int = 66; +pub const KERN_BOOTLOADER_TYPE: ::c_int = 67; +pub const KERN_RANDOMIZE: ::c_int = 68; +pub const KERN_SETUID_DUMPABLE: ::c_int = 69; +pub const KERN_SPIN_RETRY: ::c_int = 70; +pub const KERN_ACPI_VIDEO_FLAGS: ::c_int = 71; +pub const KERN_IA64_UNALIGNED: ::c_int = 72; +pub const KERN_COMPAT_LOG: ::c_int = 73; +pub const KERN_MAX_LOCK_DEPTH: ::c_int = 74; + +pub const VM_OVERCOMMIT_MEMORY: ::c_int = 5; +pub const VM_PAGE_CLUSTER: ::c_int = 10; +pub const VM_DIRTY_BACKGROUND: ::c_int = 11; +pub const VM_DIRTY_RATIO: ::c_int = 12; +pub const VM_DIRTY_WB_CS: ::c_int = 13; +pub const VM_DIRTY_EXPIRE_CS: ::c_int = 14; +pub const VM_NR_PDFLUSH_THREADS: ::c_int = 15; +pub const VM_OVERCOMMIT_RATIO: ::c_int = 16; +pub const VM_PAGEBUF: ::c_int = 17; +pub const VM_HUGETLB_PAGES: ::c_int = 18; +pub const VM_SWAPPINESS: ::c_int = 19; +pub const VM_LOWMEM_RESERVE_RATIO: ::c_int = 20; +pub const VM_MIN_FREE_KBYTES: ::c_int = 21; +pub const VM_MAX_MAP_COUNT: ::c_int = 22; +pub const VM_LAPTOP_MODE: ::c_int = 23; +pub const VM_BLOCK_DUMP: ::c_int = 24; +pub const VM_HUGETLB_GROUP: ::c_int = 25; +pub const VM_VFS_CACHE_PRESSURE: ::c_int = 26; +pub const VM_LEGACY_VA_LAYOUT: ::c_int = 27; +pub const VM_SWAP_TOKEN_TIMEOUT: ::c_int = 28; +pub const VM_DROP_PAGECACHE: ::c_int = 29; +pub const VM_PERCPU_PAGELIST_FRACTION: ::c_int = 30; +pub const VM_ZONE_RECLAIM_MODE: ::c_int = 31; +pub const VM_MIN_UNMAPPED: ::c_int = 32; +pub const VM_PANIC_ON_OOM: ::c_int = 33; +pub const VM_VDSO_ENABLED: ::c_int = 34; + +pub const NET_CORE: ::c_int = 1; +pub const NET_ETHER: ::c_int = 2; +pub const NET_802: ::c_int = 3; +pub const NET_UNIX: ::c_int = 4; +pub const NET_IPV4: ::c_int = 5; +pub const NET_IPX: ::c_int = 6; +pub const NET_ATALK: ::c_int = 7; +pub const NET_NETROM: ::c_int = 8; +pub const NET_AX25: ::c_int = 9; +pub const NET_BRIDGE: ::c_int = 10; +pub const NET_ROSE: ::c_int = 11; +pub const NET_IPV6: ::c_int = 12; +pub const NET_X25: ::c_int = 13; +pub const NET_TR: ::c_int = 14; +pub const NET_DECNET: ::c_int = 15; +pub const NET_ECONET: ::c_int = 16; +pub const NET_SCTP: ::c_int = 17; +pub const NET_LLC: ::c_int = 18; +pub const NET_NETFILTER: ::c_int = 19; +pub const NET_DCCP: ::c_int = 20; + // Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the // following are only available on newer Linux versions than the versions // currently used in CI in some configurations, so we define them here. @@ -3290,7 +3433,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::size_t, serv: *mut ::c_char, - sevlen: ::size_t, + servlen: ::size_t, flags: ::c_int, ) -> ::c_int; pub fn preadv(fd: ::c_int, iov: *const ::iovec, count: ::c_int, offset: ::off_t) -> ::ssize_t; @@ -3425,6 +3568,8 @@ extern "C" { flags: ::c_uint, ) -> ::ssize_t; pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; + pub fn eventfd_read(fd: ::c_int, value: *mut eventfd_t) -> ::c_int; + pub fn eventfd_write(fd: ::c_int, value: eventfd_t) -> ::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; @@ -3706,6 +3851,20 @@ extern "C" { needle: *const ::c_void, needlelen: ::size_t, ) -> *mut ::c_void; + pub fn fread_unlocked( + buf: *mut ::c_void, + size: ::size_t, + nobj: ::size_t, + stream: *mut ::FILE, + ) -> ::size_t; + pub fn fwrite_unlocked( + buf: *const ::c_void, + size: ::size_t, + nobj: ::size_t, + stream: *mut ::FILE, + ) -> ::size_t; + pub fn fflush_unlocked(stream: *mut ::FILE) -> ::c_int; + pub fn fgets_unlocked(buf: *mut ::c_char, size: ::c_int, stream: *mut ::FILE) -> *mut ::c_char; } cfg_if! { diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs index 0457f5dadea70..1dc607496a2ad 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -1230,7 +1230,10 @@ pub const POSIX_FADV_NOREUSE: ::c_int = 5; pub const POSIX_MADV_DONTNEED: ::c_int = 0; pub const RLIM_INFINITY: ::rlim_t = !0; +#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIMIT_NLIMITS: ::c_int = 15; +#[allow(deprecated)] +#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::c_int = RLIMIT_NLIMITS; pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; @@ -1699,7 +1702,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int; diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs index 19d5e7b3938c1..10e1fcca630dd 100644 --- a/src/unix/linux_like/linux/arch/generic/mod.rs +++ b/src/unix/linux_like/linux/arch/generic/mod.rs @@ -257,6 +257,8 @@ cfg_if! { pub const RLIMIT_NICE: ::__rlimit_resource_t = 13; pub const RLIMIT_RTPRIO: ::__rlimit_resource_t = 14; pub const RLIMIT_RTTIME: ::__rlimit_resource_t = 15; + #[allow(deprecated)] + #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = RLIM_NLIMITS; } else if #[cfg(any(target_env = "musl", target_env = "ohos"))] { @@ -277,16 +279,21 @@ cfg_if! { pub const RLIMIT_NICE: ::c_int = 13; pub const RLIMIT_RTPRIO: ::c_int = 14; pub const RLIMIT_RTTIME: ::c_int = 15; + #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::c_int = 15; + #[allow(deprecated)] + #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIMIT_NLIMITS: ::c_int = RLIM_NLIMITS; } } cfg_if! { if #[cfg(target_env = "gnu")] { + #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::__rlimit_resource_t = 16; } else if #[cfg(target_env = "uclibc")] { + #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::__rlimit_resource_t = 15; } } diff --git a/src/unix/linux_like/linux/arch/mips/mod.rs b/src/unix/linux_like/linux/arch/mips/mod.rs index 975e334de5ffb..6c0aecf8cbac3 100644 --- a/src/unix/linux_like/linux/arch/mips/mod.rs +++ b/src/unix/linux_like/linux/arch/mips/mod.rs @@ -237,6 +237,8 @@ cfg_if! { pub const RLIMIT_NICE: ::__rlimit_resource_t = 13; pub const RLIMIT_RTPRIO: ::__rlimit_resource_t = 14; pub const RLIMIT_RTTIME: ::__rlimit_resource_t = 15; + #[allow(deprecated)] + #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = RLIM_NLIMITS; } else if #[cfg(target_env = "musl")] { @@ -257,7 +259,10 @@ cfg_if! { pub const RLIMIT_NICE: ::c_int = 13; pub const RLIMIT_RTPRIO: ::c_int = 14; pub const RLIMIT_RTTIME: ::c_int = 15; + #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::c_int = 15; + #[allow(deprecated)] + #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIMIT_NLIMITS: ::c_int = RLIM_NLIMITS; pub const RLIM_INFINITY: ::rlim_t = !0; } @@ -265,8 +270,10 @@ cfg_if! { cfg_if! { if #[cfg(target_env = "gnu")] { + #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::__rlimit_resource_t = 16; } else if #[cfg(target_env = "uclibc")] { + #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::__rlimit_resource_t = 15; } } diff --git a/src/unix/linux_like/linux/arch/powerpc/mod.rs b/src/unix/linux_like/linux/arch/powerpc/mod.rs index 64c3eaab543a6..584be5b6c2860 100644 --- a/src/unix/linux_like/linux/arch/powerpc/mod.rs +++ b/src/unix/linux_like/linux/arch/powerpc/mod.rs @@ -215,7 +215,10 @@ cfg_if! { pub const RLIMIT_NICE: ::__rlimit_resource_t = 13; pub const RLIMIT_RTPRIO: ::__rlimit_resource_t = 14; pub const RLIMIT_RTTIME: ::__rlimit_resource_t = 15; + #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::__rlimit_resource_t = 16; + #[allow(deprecated)] + #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = RLIM_NLIMITS; } else if #[cfg(target_env = "musl")] { @@ -236,7 +239,10 @@ cfg_if! { pub const RLIMIT_NICE: ::c_int = 13; pub const RLIMIT_RTPRIO: ::c_int = 14; pub const RLIMIT_RTTIME: ::c_int = 15; + #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::c_int = 15; + #[allow(deprecated)] + #[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIMIT_NLIMITS: ::c_int = RLIM_NLIMITS; } } diff --git a/src/unix/linux_like/linux/arch/sparc/mod.rs b/src/unix/linux_like/linux/arch/sparc/mod.rs index da3e388e3d286..c7813aa46be61 100644 --- a/src/unix/linux_like/linux/arch/sparc/mod.rs +++ b/src/unix/linux_like/linux/arch/sparc/mod.rs @@ -216,7 +216,10 @@ pub const RLIMIT_MSGQUEUE: ::__rlimit_resource_t = 12; pub const RLIMIT_NICE: ::__rlimit_resource_t = 13; pub const RLIMIT_RTPRIO: ::__rlimit_resource_t = 14; pub const RLIMIT_RTTIME: ::__rlimit_resource_t = 15; +#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::__rlimit_resource_t = 16; +#[allow(deprecated)] +#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = RLIM_NLIMITS; cfg_if! { diff --git a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs index fd690a17e158d..9b3a2ff861731 100644 --- a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs @@ -341,6 +341,7 @@ pub const SOCK_DGRAM: ::c_int = 2; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const POLLWRNORM: ::c_short = 0x100; pub const POLLWRBAND: ::c_short = 0x200; diff --git a/src/unix/linux_like/linux/gnu/b32/csky/mod.rs b/src/unix/linux_like/linux/gnu/b32/csky/mod.rs index c1234845e9a1f..9807cea831021 100644 --- a/src/unix/linux_like/linux/gnu/b32/csky/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/csky/mod.rs @@ -290,6 +290,7 @@ pub const SOCK_DGRAM: ::c_int = 2; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const POLLWRNORM: ::c_short = 0x100; pub const POLLWRBAND: ::c_short = 0x200; diff --git a/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs b/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs index 69725ee7cf6a2..8ca7d3d214094 100644 --- a/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs @@ -293,6 +293,7 @@ pub const PTRACE_SYSEMU_SINGLESTEP: ::c_uint = 32; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const POLLWRNORM: ::c_short = 0x100; pub const POLLWRBAND: ::c_short = 0x200; diff --git a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs index 6a03f0ba83bac..fa2707500dbe4 100644 --- a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs @@ -719,6 +719,7 @@ pub const RTLD_NOLOAD: ::c_int = 0x8; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const SIGSTKSZ: ::size_t = 8192; pub const MINSIGSTKSZ: ::size_t = 2048; diff --git a/src/unix/linux_like/linux/gnu/b32/powerpc.rs b/src/unix/linux_like/linux/gnu/b32/powerpc.rs index e70b216bf9c50..dd5732e0dcc14 100644 --- a/src/unix/linux_like/linux/gnu/b32/powerpc.rs +++ b/src/unix/linux_like/linux/gnu/b32/powerpc.rs @@ -293,6 +293,7 @@ pub const SOCK_DGRAM: ::c_int = 2; pub const MCL_CURRENT: ::c_int = 0x2000; pub const MCL_FUTURE: ::c_int = 0x4000; +pub const MCL_ONFAULT: ::c_int = 0x8000; pub const POLLWRNORM: ::c_short = 0x100; pub const POLLWRBAND: ::c_short = 0x200; diff --git a/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs b/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs index f3b130cbc6205..65b7aaa783559 100644 --- a/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs @@ -393,6 +393,7 @@ pub const EISNAM: ::c_int = 120; pub const EREMOTEIO: ::c_int = 121; pub const MCL_CURRENT: ::c_int = 1; pub const MCL_FUTURE: ::c_int = 2; +pub const MCL_ONFAULT: ::c_int = 4; pub const SIGSTKSZ: ::size_t = 8192; pub const MINSIGSTKSZ: ::size_t = 2048; pub const CBAUD: ::tcflag_t = 4111; diff --git a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs index 57ad9fe8ee21b..da9cf29c48668 100644 --- a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs @@ -363,6 +363,7 @@ pub const EREMOTEIO: ::c_int = 121; pub const MCL_CURRENT: ::c_int = 0x2000; pub const MCL_FUTURE: ::c_int = 0x4000; +pub const MCL_ONFAULT: ::c_int = 0x8000; pub const SIGSTKSZ: ::size_t = 16384; pub const MINSIGSTKSZ: ::size_t = 4096; diff --git a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs index 93622387e81a9..a3531c141fdb6 100644 --- a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs @@ -507,6 +507,7 @@ pub const PTRACE_SYSEMU_SINGLESTEP: ::c_uint = 32; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const POLLWRNORM: ::c_short = 0x100; pub const POLLWRBAND: ::c_short = 0x200; diff --git a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs index f9aed99b2e788..206283e22f6b2 100644 --- a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs @@ -423,6 +423,7 @@ pub const EDEADLOCK: ::c_int = 35; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const SIGSTKSZ: ::size_t = 16384; pub const MINSIGSTKSZ: ::size_t = 5120; 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 66b29a8aaf168..f7b52be805cab 100644 --- a/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs @@ -823,6 +823,7 @@ pub const RTLD_NOLOAD: ::c_int = 0x8; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const SIGSTKSZ: ::size_t = 8192; pub const MINSIGSTKSZ: ::size_t = 2048; diff --git a/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs b/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs index 2b225e4809f30..3088c25a2646f 100644 --- a/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs @@ -473,6 +473,7 @@ pub const EREMOTEIO: ::c_int = 121; pub const MCL_CURRENT: ::c_int = 0x2000; pub const MCL_FUTURE: ::c_int = 0x4000; +pub const MCL_ONFAULT: ::c_int = 0x8000; pub const SIGSTKSZ: ::size_t = 0x4000; pub const MINSIGSTKSZ: ::size_t = 4096; diff --git a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs index c65a562ac2e18..8e06a135baa42 100644 --- a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs @@ -432,6 +432,7 @@ pub const PTRACE_GETREGS: ::c_uint = 12; pub const PTRACE_SETREGS: ::c_uint = 13; pub const MCL_CURRENT: ::c_int = 1; pub const MCL_FUTURE: ::c_int = 2; +pub const MCL_ONFAULT: ::c_int = 4; pub const SIGSTKSZ: ::size_t = 8192; pub const MINSIGSTKSZ: ::size_t = 2048; pub const CBAUD: ::tcflag_t = 4111; diff --git a/src/unix/linux_like/linux/gnu/b64/s390x.rs b/src/unix/linux_like/linux/gnu/b64/s390x.rs index c2c4f31cf8117..61ee2dcc9b50a 100644 --- a/src/unix/linux_like/linux/gnu/b64/s390x.rs +++ b/src/unix/linux_like/linux/gnu/b64/s390x.rs @@ -481,6 +481,7 @@ pub const PTRACE_DETACH: ::c_uint = 17; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const EFD_NONBLOCK: ::c_int = 0x800; diff --git a/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs b/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs index 2427c7a0ad219..de2f0d6e470f6 100644 --- a/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs @@ -444,6 +444,7 @@ pub const EREMOTEIO: ::c_int = 121; pub const MCL_CURRENT: ::c_int = 0x2000; pub const MCL_FUTURE: ::c_int = 0x4000; +pub const MCL_ONFAULT: ::c_int = 0x8000; pub const SIGSTKSZ: ::size_t = 16384; pub const MINSIGSTKSZ: ::size_t = 4096; diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs index e6307e282a116..9b2aac5c2ba34 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs @@ -651,6 +651,7 @@ pub const PR_SPEC_INDIRECT_BRANCH: ::c_int = 1; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const SIGSTKSZ: ::size_t = 8192; pub const MINSIGSTKSZ: ::size_t = 2048; diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index fe8f89177caae..377b9f122f150 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -718,11 +718,6 @@ pub const SOCK_SEQPACKET: ::c_int = 5; pub const SOCK_DCCP: ::c_int = 6; pub const SOCK_PACKET: ::c_int = 10; -pub const FAN_MARK_INODE: ::c_uint = 0x0000_0000; -pub const FAN_MARK_MOUNT: ::c_uint = 0x0000_0010; -// NOTE: FAN_MARK_FILESYSTEM requires Linux Kernel >= 4.20.0 -pub const FAN_MARK_FILESYSTEM: ::c_uint = 0x0000_0100; - pub const AF_IB: ::c_int = 27; pub const AF_MPLS: ::c_int = 28; pub const AF_NFC: ::c_int = 39; @@ -857,6 +852,8 @@ pub const PTRACE_SEIZE: ::c_uint = 0x4206; pub const PTRACE_INTERRUPT: ::c_uint = 0x4207; pub const PTRACE_LISTEN: ::c_uint = 0x4208; pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209; +pub const PTRACE_GETSIGMASK: ::c_uint = 0x420a; +pub const PTRACE_SETSIGMASK: ::c_uint = 0x420b; pub const PTRACE_GET_SYSCALL_INFO: ::c_uint = 0x420e; pub const PTRACE_SYSCALL_INFO_NONE: ::__u8 = 0; pub const PTRACE_SYSCALL_INFO_ENTRY: ::__u8 = 1; @@ -944,6 +941,11 @@ pub const NT_PRFPXREG: ::c_int = 20; pub const ELFOSABI_ARM_AEABI: u8 = 64; +// linux/sched.h +pub const CLONE_NEWTIME: ::c_int = 0x80; +pub const CLONE_CLEAR_SIGHAND: ::c_int = 0x100000000; +pub const CLONE_INTO_CGROUP: ::c_int = 0x200000000; + // linux/keyctl.h pub const KEYCTL_DH_COMPUTE: u32 = 23; pub const KEYCTL_PKEY_QUERY: u32 = 24; @@ -1024,7 +1026,17 @@ pub const STATX_ATTR_DAX: ::c_int = 0x00200000; pub const SOMAXCONN: ::c_int = 4096; -//sys/timex.h +// linux/mount.h +pub const MOVE_MOUNT_F_SYMLINKS: ::c_uint = 0x00000001; +pub const MOVE_MOUNT_F_AUTOMOUNTS: ::c_uint = 0x00000002; +pub const MOVE_MOUNT_F_EMPTY_PATH: ::c_uint = 0x00000004; +pub const MOVE_MOUNT_T_SYMLINKS: ::c_uint = 0x00000010; +pub const MOVE_MOUNT_T_AUTOMOUNTS: ::c_uint = 0x00000020; +pub const MOVE_MOUNT_T_EMPTY_PATH: ::c_uint = 0x00000040; +pub const MOVE_MOUNT_SET_GROUP: ::c_uint = 0x00000100; +pub const MOVE_MOUNT_BENEATH: ::c_uint = 0x00000200; + +// sys/timex.h pub const ADJ_OFFSET: ::c_uint = 0x0001; pub const ADJ_FREQUENCY: ::c_uint = 0x0002; pub const ADJ_MAXERROR: ::c_uint = 0x0004; @@ -1399,6 +1411,9 @@ extern "C" { envp: *const *mut c_char, flags: ::c_int, ) -> ::c_int; + + // Added in `glibc` 2.34 + pub fn close_range(first: ::c_uint, last: ::c_uint, flags: ::c_int) -> ::c_int; } cfg_if! { diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 067fe07c71f2f..d8ba968a27225 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -14,6 +14,7 @@ pub type nl_item = ::c_int; pub type idtype_t = ::c_uint; pub type loff_t = ::c_longlong; pub type pthread_key_t = ::c_uint; +pub type pthread_once_t = ::c_int; pub type pthread_spinlock_t = ::c_int; pub type __u8 = ::c_uchar; @@ -51,6 +52,8 @@ pub type iconv_t = *mut ::c_void; // linux/sctp.h pub type sctp_assoc_t = ::__s32; +pub type eventfd_t = u64; + #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum fpos64_t {} // FIXME: fill this out with a struct impl ::Copy for fpos64_t {} @@ -685,6 +688,37 @@ s! { pub rlim_cur: rlim64_t, pub rlim_max: rlim64_t, } + + // linux/tls.h + + pub struct tls_crypto_info { + pub version: ::__u16, + pub cipher_type: ::__u16, + } + + pub struct tls12_crypto_info_aes_gcm_128 { + pub info: tls_crypto_info, + pub iv: [::c_uchar; TLS_CIPHER_AES_GCM_128_IV_SIZE], + pub key: [::c_uchar; TLS_CIPHER_AES_GCM_128_KEY_SIZE], + pub salt: [::c_uchar; TLS_CIPHER_AES_GCM_128_SALT_SIZE], + pub rec_seq: [::c_uchar; TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE], + } + + pub struct tls12_crypto_info_aes_gcm_256 { + pub info: tls_crypto_info, + pub iv: [::c_uchar; TLS_CIPHER_AES_GCM_256_IV_SIZE], + pub key: [::c_uchar; TLS_CIPHER_AES_GCM_256_KEY_SIZE], + pub salt: [::c_uchar; TLS_CIPHER_AES_GCM_256_SALT_SIZE], + pub rec_seq: [::c_uchar; TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE], + } + + pub struct tls12_crypto_info_chacha20_poly1305 { + pub info: tls_crypto_info, + pub iv: [::c_uchar; TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE], + pub key: [::c_uchar; TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE], + pub salt: [::c_uchar; TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE], + pub rec_seq: [::c_uchar; TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE], + } } s_no_extra_traits! { @@ -791,6 +825,23 @@ s_no_extra_traits! { pub ifr_ifru: ::sockaddr, } + #[cfg(libc_union)] + pub union __c_anonymous_ifc_ifcu { + pub ifcu_buf: *mut ::c_char, + pub ifcu_req: *mut ::ifreq, + } + + /* Structure used in SIOCGIFCONF request. Used to retrieve interface + configuration for machine (useful for programs which must know all + networks accessible). */ + pub struct ifconf { + pub ifc_len: ::c_int, /* Size of buffer. */ + #[cfg(libc_union)] + pub ifc_ifcu: __c_anonymous_ifc_ifcu, + #[cfg(not(libc_union))] + pub ifc_ifcu: *mut ::ifreq, + } + pub struct hwtstamp_config { pub flags: ::c_int, pub tx_type: ::c_int, @@ -1228,6 +1279,23 @@ cfg_if! { } } + #[cfg(libc_union)] + impl ::fmt::Debug for __c_anonymous_ifc_ifcu { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ifr_ifru") + .field("ifcu_buf", unsafe { &self.ifcu_buf }) + .field("ifcu_req", unsafe { &self.ifcu_req }) + .finish() + } + } + impl ::fmt::Debug for ifconf { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ifconf") + .field("ifc_len", &self.ifc_len) + .field("ifc_ifcu", &self.ifc_ifcu) + .finish() + } + } impl ::fmt::Debug for hwtstamp_config { fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { f.debug_struct("hwtstamp_config") @@ -1829,6 +1897,10 @@ pub const IFLA_INFO_SLAVE_DATA: ::c_ushort = 5; // linux/if_tun.h pub const IFF_TUN: ::c_int = 0x0001; pub const IFF_TAP: ::c_int = 0x0002; +pub const IFF_NAPI: ::c_int = 0x0010; +pub const IFF_NAPI_FRAGS: ::c_int = 0x0020; +// Used in TUNSETIFF to bring up tun/tap without carrier +pub const IFF_NO_CARRIER: ::c_int = 0x0040; pub const IFF_NO_PI: ::c_int = 0x1000; // Read queue size pub const TUN_READQ_SIZE: ::c_short = 500; @@ -1846,6 +1918,20 @@ pub const IFF_DETACH_QUEUE: ::c_int = 0x0400; // read-only flag pub const IFF_PERSIST: ::c_int = 0x0800; pub const IFF_NOFILTER: ::c_int = 0x1000; +// Socket options +pub const TUN_TX_TIMESTAMP: ::c_int = 1; +// Features for GSO (TUNSETOFFLOAD) +pub const TUN_F_CSUM: ::c_uint = 0x01; +pub const TUN_F_TSO4: ::c_uint = 0x02; +pub const TUN_F_TSO6: ::c_uint = 0x04; +pub const TUN_F_TSO_ECN: ::c_uint = 0x08; +pub const TUN_F_UFO: ::c_uint = 0x10; +pub const TUN_F_USO4: ::c_uint = 0x20; +pub const TUN_F_USO6: ::c_uint = 0x40; +// Protocol info prepended to the packets (when IFF_NO_PI is not set) +pub const TUN_PKT_STRIP: ::c_int = 0x0001; +// Accept all multicast packets +pub const TUN_FLT_ALLMULTI: ::c_int = 0x0001; // Since Linux 3.1 pub const SEEK_DATA: ::c_int = 3; @@ -1903,6 +1989,7 @@ align_const! { size: [0; __SIZEOF_PTHREAD_RWLOCK_T], }; } +pub const PTHREAD_ONCE_INIT: pthread_once_t = 0; pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; @@ -3184,6 +3271,41 @@ pub const HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: ::c_uint = 14; pub const HWTSTAMP_FILTER_NTP_ALL: ::c_uint = 15; // linux/tls.h +pub const TLS_TX: ::c_int = 1; +pub const TLS_RX: ::c_int = 2; + +pub const TLS_1_2_VERSION_MAJOR: ::__u8 = 0x3; +pub const TLS_1_2_VERSION_MINOR: ::__u8 = 0x3; +pub const TLS_1_2_VERSION: ::__u16 = + ((TLS_1_2_VERSION_MAJOR as ::__u16) << 8) | (TLS_1_2_VERSION_MINOR as ::__u16); + +pub const TLS_1_3_VERSION_MAJOR: ::__u8 = 0x3; +pub const TLS_1_3_VERSION_MINOR: ::__u8 = 0x4; +pub const TLS_1_3_VERSION: ::__u16 = + ((TLS_1_3_VERSION_MAJOR as ::__u16) << 8) | (TLS_1_3_VERSION_MINOR as ::__u16); + +pub const TLS_CIPHER_AES_GCM_128: ::__u16 = 51; +pub const TLS_CIPHER_AES_GCM_128_IV_SIZE: usize = 8; +pub const TLS_CIPHER_AES_GCM_128_KEY_SIZE: usize = 16; +pub const TLS_CIPHER_AES_GCM_128_SALT_SIZE: usize = 4; +pub const TLS_CIPHER_AES_GCM_128_TAG_SIZE: usize = 16; +pub const TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE: usize = 8; + +pub const TLS_CIPHER_AES_GCM_256: ::__u16 = 52; +pub const TLS_CIPHER_AES_GCM_256_IV_SIZE: usize = 8; +pub const TLS_CIPHER_AES_GCM_256_KEY_SIZE: usize = 32; +pub const TLS_CIPHER_AES_GCM_256_SALT_SIZE: usize = 4; +pub const TLS_CIPHER_AES_GCM_256_TAG_SIZE: usize = 16; +pub const TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE: usize = 8; + +pub const TLS_CIPHER_CHACHA20_POLY1305: ::__u16 = 54; +pub const TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE: usize = 12; +pub const TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE: usize = 32; +pub const TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE: usize = 0; +pub const TLS_CIPHER_CHACHA20_POLY1305_TAG_SIZE: usize = 16; +pub const TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE: usize = 8; + +pub const TLS_SET_RECORD_TYPE: ::c_int = 1; pub const TLS_GET_RECORD_TYPE: ::c_int = 2; pub const SOL_TLS: ::c_int = 282; @@ -3194,6 +3316,8 @@ pub const ALG_SET_IV: ::c_int = 2; pub const ALG_SET_OP: ::c_int = 3; pub const ALG_SET_AEAD_ASSOCLEN: ::c_int = 4; pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5; +pub const ALG_SET_DRBG_ENTROPY: ::c_int = 6; +pub const ALG_SET_KEY_BY_KEY_SERIAL: ::c_int = 7; pub const ALG_OP_DECRYPT: ::c_int = 0; pub const ALG_OP_ENCRYPT: ::c_int = 1; @@ -3550,20 +3674,33 @@ pub const UINPUT_MAX_NAME_SIZE: usize = 80; // uapi/linux/fanotify.h pub const FAN_ACCESS: u64 = 0x0000_0001; pub const FAN_MODIFY: u64 = 0x0000_0002; +pub const FAN_ATTRIB: u64 = 0x0000_0004; pub const FAN_CLOSE_WRITE: u64 = 0x0000_0008; pub const FAN_CLOSE_NOWRITE: u64 = 0x0000_0010; pub const FAN_OPEN: u64 = 0x0000_0020; +pub const FAN_MOVED_FROM: u64 = 0x0000_0040; +pub const FAN_MOVED_TO: u64 = 0x0000_0080; +pub const FAN_CREATE: u64 = 0x0000_0100; +pub const FAN_DELETE: u64 = 0x0000_0200; +pub const FAN_DELETE_SELF: u64 = 0x0000_0400; +pub const FAN_MOVE_SELF: u64 = 0x0000_0800; +pub const FAN_OPEN_EXEC: u64 = 0x0000_1000; pub const FAN_Q_OVERFLOW: u64 = 0x0000_4000; +pub const FAN_FS_ERROR: u64 = 0x0000_8000; pub const FAN_OPEN_PERM: u64 = 0x0001_0000; pub const FAN_ACCESS_PERM: u64 = 0x0002_0000; - -pub const FAN_ONDIR: u64 = 0x4000_0000; +pub const FAN_OPEN_EXEC_PERM: u64 = 0x0004_0000; pub const FAN_EVENT_ON_CHILD: u64 = 0x0800_0000; +pub const FAN_RENAME: u64 = 0x1000_0000; + +pub const FAN_ONDIR: u64 = 0x4000_0000; + pub const FAN_CLOSE: u64 = FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE; +pub const FAN_MOVE: u64 = FAN_MOVED_FROM | FAN_MOVED_TO; pub const FAN_CLOEXEC: ::c_uint = 0x0000_0001; pub const FAN_NONBLOCK: ::c_uint = 0x0000_0002; @@ -3574,6 +3711,18 @@ pub const FAN_CLASS_PRE_CONTENT: ::c_uint = 0x0000_0008; pub const FAN_UNLIMITED_QUEUE: ::c_uint = 0x0000_0010; pub const FAN_UNLIMITED_MARKS: ::c_uint = 0x0000_0020; +pub const FAN_ENABLE_AUDIT: ::c_uint = 0x0000_0040; + +pub const FAN_REPORT_PIDFD: ::c_uint = 0x0000_0080; +pub const FAN_REPORT_TID: ::c_uint = 0x0000_0100; +pub const FAN_REPORT_FID: ::c_uint = 0x0000_0200; +pub const FAN_REPORT_DIR_FID: ::c_uint = 0x0000_0400; +pub const FAN_REPORT_NAME: ::c_uint = 0x0000_0800; +pub const FAN_REPORT_TARGET_FID: ::c_uint = 0x0000_1000; + +pub const FAN_REPORT_DFID_NAME: ::c_uint = FAN_REPORT_DIR_FID | FAN_REPORT_NAME; +pub const FAN_REPORT_DFID_NAME_TARGET: ::c_uint = + FAN_REPORT_DFID_NAME | FAN_REPORT_FID | FAN_REPORT_TARGET_FID; pub const FAN_MARK_ADD: ::c_uint = 0x0000_0001; pub const FAN_MARK_REMOVE: ::c_uint = 0x0000_0002; @@ -3582,13 +3731,37 @@ pub const FAN_MARK_ONLYDIR: ::c_uint = 0x0000_0008; pub const FAN_MARK_IGNORED_MASK: ::c_uint = 0x0000_0020; pub const FAN_MARK_IGNORED_SURV_MODIFY: ::c_uint = 0x0000_0040; pub const FAN_MARK_FLUSH: ::c_uint = 0x0000_0080; +pub const FAN_MARK_EVICTABLE: ::c_uint = 0x0000_0200; +pub const FAN_MARK_IGNORE: ::c_uint = 0x0000_0100; + +pub const FAN_MARK_INODE: ::c_uint = 0x0000_0000; +pub const FAN_MARK_MOUNT: ::c_uint = 0x0000_0010; +pub const FAN_MARK_FILESYSTEM: ::c_uint = 0x0000_0100; + +pub const FAN_MARK_IGNORE_SURV: ::c_uint = FAN_MARK_IGNORE | FAN_MARK_IGNORED_SURV_MODIFY; pub const FANOTIFY_METADATA_VERSION: u8 = 3; +pub const FAN_EVENT_INFO_TYPE_FID: u8 = 1; +pub const FAN_EVENT_INFO_TYPE_DFID_NAME: u8 = 2; +pub const FAN_EVENT_INFO_TYPE_DFID: u8 = 3; +pub const FAN_EVENT_INFO_TYPE_PIDFD: u8 = 4; +pub const FAN_EVENT_INFO_TYPE_ERROR: u8 = 5; + +pub const FAN_EVENT_INFO_TYPE_OLD_DFID_NAME: u8 = 10; +pub const FAN_EVENT_INFO_TYPE_NEW_DFID_NAME: u8 = 12; + +pub const FAN_RESPONSE_INFO_NONE: u8 = 0; +pub const FAN_RESPONSE_INFO_AUDIT_RULE: u8 = 1; + pub const FAN_ALLOW: u32 = 0x01; pub const FAN_DENY: u32 = 0x02; +pub const FAN_AUDIT: u32 = 0x10; +pub const FAN_INFO: u32 = 0x20; pub const FAN_NOFD: ::c_int = -1; +pub const FAN_NOPIDFD: ::c_int = FAN_NOFD; +pub const FAN_EPIDFD: ::c_int = -2; pub const FUTEX_WAIT: ::c_int = 0; pub const FUTEX_WAKE: ::c_int = 1; @@ -3928,6 +4101,139 @@ pub const DCCP_SOCKOPT_CCID_TX_INFO: ::c_int = 192; /// maximum number of services provided on the same listening port pub const DCCP_SERVICE_LIST_MAX_LEN: ::c_int = 32; +pub const CTL_KERN: ::c_int = 1; +pub const CTL_VM: ::c_int = 2; +pub const CTL_NET: ::c_int = 3; +pub const CTL_FS: ::c_int = 5; +pub const CTL_DEBUG: ::c_int = 6; +pub const CTL_DEV: ::c_int = 7; +pub const CTL_BUS: ::c_int = 8; +pub const CTL_ABI: ::c_int = 9; +pub const CTL_CPU: ::c_int = 10; + +pub const CTL_BUS_ISA: ::c_int = 1; + +pub const INOTIFY_MAX_USER_INSTANCES: ::c_int = 1; +pub const INOTIFY_MAX_USER_WATCHES: ::c_int = 2; +pub const INOTIFY_MAX_QUEUED_EVENTS: ::c_int = 3; + +pub const KERN_OSTYPE: ::c_int = 1; +pub const KERN_OSRELEASE: ::c_int = 2; +pub const KERN_OSREV: ::c_int = 3; +pub const KERN_VERSION: ::c_int = 4; +pub const KERN_SECUREMASK: ::c_int = 5; +pub const KERN_PROF: ::c_int = 6; +pub const KERN_NODENAME: ::c_int = 7; +pub const KERN_DOMAINNAME: ::c_int = 8; +pub const KERN_PANIC: ::c_int = 15; +pub const KERN_REALROOTDEV: ::c_int = 16; +pub const KERN_SPARC_REBOOT: ::c_int = 21; +pub const KERN_CTLALTDEL: ::c_int = 22; +pub const KERN_PRINTK: ::c_int = 23; +pub const KERN_NAMETRANS: ::c_int = 24; +pub const KERN_PPC_HTABRECLAIM: ::c_int = 25; +pub const KERN_PPC_ZEROPAGED: ::c_int = 26; +pub const KERN_PPC_POWERSAVE_NAP: ::c_int = 27; +pub const KERN_MODPROBE: ::c_int = 28; +pub const KERN_SG_BIG_BUFF: ::c_int = 29; +pub const KERN_ACCT: ::c_int = 30; +pub const KERN_PPC_L2CR: ::c_int = 31; +pub const KERN_RTSIGNR: ::c_int = 32; +pub const KERN_RTSIGMAX: ::c_int = 33; +pub const KERN_SHMMAX: ::c_int = 34; +pub const KERN_MSGMAX: ::c_int = 35; +pub const KERN_MSGMNB: ::c_int = 36; +pub const KERN_MSGPOOL: ::c_int = 37; +pub const KERN_SYSRQ: ::c_int = 38; +pub const KERN_MAX_THREADS: ::c_int = 39; +pub const KERN_RANDOM: ::c_int = 40; +pub const KERN_SHMALL: ::c_int = 41; +pub const KERN_MSGMNI: ::c_int = 42; +pub const KERN_SEM: ::c_int = 43; +pub const KERN_SPARC_STOP_A: ::c_int = 44; +pub const KERN_SHMMNI: ::c_int = 45; +pub const KERN_OVERFLOWUID: ::c_int = 46; +pub const KERN_OVERFLOWGID: ::c_int = 47; +pub const KERN_SHMPATH: ::c_int = 48; +pub const KERN_HOTPLUG: ::c_int = 49; +pub const KERN_IEEE_EMULATION_WARNINGS: ::c_int = 50; +pub const KERN_S390_USER_DEBUG_LOGGING: ::c_int = 51; +pub const KERN_CORE_USES_PID: ::c_int = 52; +pub const KERN_TAINTED: ::c_int = 53; +pub const KERN_CADPID: ::c_int = 54; +pub const KERN_PIDMAX: ::c_int = 55; +pub const KERN_CORE_PATTERN: ::c_int = 56; +pub const KERN_PANIC_ON_OOPS: ::c_int = 57; +pub const KERN_HPPA_PWRSW: ::c_int = 58; +pub const KERN_HPPA_UNALIGNED: ::c_int = 59; +pub const KERN_PRINTK_RATELIMIT: ::c_int = 60; +pub const KERN_PRINTK_RATELIMIT_BURST: ::c_int = 61; +pub const KERN_PTY: ::c_int = 62; +pub const KERN_NGROUPS_MAX: ::c_int = 63; +pub const KERN_SPARC_SCONS_PWROFF: ::c_int = 64; +pub const KERN_HZ_TIMER: ::c_int = 65; +pub const KERN_UNKNOWN_NMI_PANIC: ::c_int = 66; +pub const KERN_BOOTLOADER_TYPE: ::c_int = 67; +pub const KERN_RANDOMIZE: ::c_int = 68; +pub const KERN_SETUID_DUMPABLE: ::c_int = 69; +pub const KERN_SPIN_RETRY: ::c_int = 70; +pub const KERN_ACPI_VIDEO_FLAGS: ::c_int = 71; +pub const KERN_IA64_UNALIGNED: ::c_int = 72; +pub const KERN_COMPAT_LOG: ::c_int = 73; +pub const KERN_MAX_LOCK_DEPTH: ::c_int = 74; +pub const KERN_NMI_WATCHDOG: ::c_int = 75; +pub const KERN_PANIC_ON_NMI: ::c_int = 76; + +pub const VM_OVERCOMMIT_MEMORY: ::c_int = 5; +pub const VM_PAGE_CLUSTER: ::c_int = 10; +pub const VM_DIRTY_BACKGROUND: ::c_int = 11; +pub const VM_DIRTY_RATIO: ::c_int = 12; +pub const VM_DIRTY_WB_CS: ::c_int = 13; +pub const VM_DIRTY_EXPIRE_CS: ::c_int = 14; +pub const VM_NR_PDFLUSH_THREADS: ::c_int = 15; +pub const VM_OVERCOMMIT_RATIO: ::c_int = 16; +pub const VM_PAGEBUF: ::c_int = 17; +pub const VM_HUGETLB_PAGES: ::c_int = 18; +pub const VM_SWAPPINESS: ::c_int = 19; +pub const VM_LOWMEM_RESERVE_RATIO: ::c_int = 20; +pub const VM_MIN_FREE_KBYTES: ::c_int = 21; +pub const VM_MAX_MAP_COUNT: ::c_int = 22; +pub const VM_LAPTOP_MODE: ::c_int = 23; +pub const VM_BLOCK_DUMP: ::c_int = 24; +pub const VM_HUGETLB_GROUP: ::c_int = 25; +pub const VM_VFS_CACHE_PRESSURE: ::c_int = 26; +pub const VM_LEGACY_VA_LAYOUT: ::c_int = 27; +pub const VM_SWAP_TOKEN_TIMEOUT: ::c_int = 28; +pub const VM_DROP_PAGECACHE: ::c_int = 29; +pub const VM_PERCPU_PAGELIST_FRACTION: ::c_int = 30; +pub const VM_ZONE_RECLAIM_MODE: ::c_int = 31; +pub const VM_MIN_UNMAPPED: ::c_int = 32; +pub const VM_PANIC_ON_OOM: ::c_int = 33; +pub const VM_VDSO_ENABLED: ::c_int = 34; +pub const VM_MIN_SLAB: ::c_int = 35; + +pub const NET_CORE: ::c_int = 1; +pub const NET_ETHER: ::c_int = 2; +pub const NET_802: ::c_int = 3; +pub const NET_UNIX: ::c_int = 4; +pub const NET_IPV4: ::c_int = 5; +pub const NET_IPX: ::c_int = 6; +pub const NET_ATALK: ::c_int = 7; +pub const NET_NETROM: ::c_int = 8; +pub const NET_AX25: ::c_int = 9; +pub const NET_BRIDGE: ::c_int = 10; +pub const NET_ROSE: ::c_int = 11; +pub const NET_IPV6: ::c_int = 12; +pub const NET_X25: ::c_int = 13; +pub const NET_TR: ::c_int = 14; +pub const NET_DECNET: ::c_int = 15; +pub const NET_ECONET: ::c_int = 16; +pub const NET_SCTP: ::c_int = 17; +pub const NET_LLC: ::c_int = 18; +pub const NET_NETFILTER: ::c_int = 19; +pub const NET_DCCP: ::c_int = 20; +pub const NET_IRDA: ::c_int = 412; + f! { pub fn NLA_ALIGN(len: ::c_int) -> ::c_int { return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1) @@ -4142,7 +4448,7 @@ cfg_if! { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; pub fn getloadavg( @@ -4501,6 +4807,9 @@ extern "C" { flags: ::c_uint, ) -> ::ssize_t; pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; + pub fn eventfd_read(fd: ::c_int, value: *mut eventfd_t) -> ::c_int; + pub fn eventfd_write(fd: ::c_int, value: eventfd_t) -> ::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; @@ -4771,7 +5080,7 @@ extern "C" { newfd: ::c_int, ) -> ::c_int; pub fn fread_unlocked( - ptr: *mut ::c_void, + buf: *mut ::c_void, size: ::size_t, nobj: ::size_t, stream: *mut ::FILE, @@ -4849,6 +5158,8 @@ extern "C" { longindex: *mut ::c_int, ) -> ::c_int; + pub fn pthread_once(control: *mut pthread_once_t, routine: extern "C" fn()) -> ::c_int; + pub fn copy_file_range( fd_in: ::c_int, off_in: *mut ::off64_t, diff --git a/src/unix/linux_like/linux/musl/b32/arm/mod.rs b/src/unix/linux_like/linux/musl/b32/arm/mod.rs index c47fa2c4cfda9..8225f26adb474 100644 --- a/src/unix/linux_like/linux/musl/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/arm/mod.rs @@ -235,6 +235,7 @@ pub const O_LARGEFILE: ::c_int = 0o400000; pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const CBAUD: ::tcflag_t = 0o0010017; pub const TAB1: ::c_int = 0x00000800; pub const TAB2: ::c_int = 0x00001000; @@ -311,8 +312,6 @@ pub const O_SYNC: ::c_int = 1052672; pub const O_RSYNC: ::c_int = 1052672; pub const O_DSYNC: ::c_int = 4096; -pub const SOCK_NONBLOCK: ::c_int = 2048; - pub const MAP_ANON: ::c_int = 0x0020; pub const MAP_GROWSDOWN: ::c_int = 0x0100; pub const MAP_DENYWRITE: ::c_int = 0x0800; @@ -326,7 +325,6 @@ pub const MAP_SYNC: ::c_int = 0x080000; pub const SOCK_STREAM: ::c_int = 1; pub const SOCK_DGRAM: ::c_int = 2; -pub const SOCK_SEQPACKET: ::c_int = 5; pub const EDEADLK: ::c_int = 35; pub const ENAMETOOLONG: ::c_int = 36; @@ -451,9 +449,6 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETLK: ::c_int = 13; pub const F_SETLKW: ::c_int = 14; pub const F_SETOWN: ::c_int = 8; -pub const F_OFD_GETLK: ::c_int = 36; -pub const F_OFD_SETLK: ::c_int = 37; -pub const F_OFD_SETLKW: ::c_int = 38; pub const VEOF: usize = 4; pub const VEOL: usize = 11; diff --git a/src/unix/linux_like/linux/musl/b32/hexagon.rs b/src/unix/linux_like/linux/musl/b32/hexagon.rs index f83d208d5fe8f..089c06f859e6b 100644 --- a/src/unix/linux_like/linux/musl/b32/hexagon.rs +++ b/src/unix/linux_like/linux/musl/b32/hexagon.rs @@ -225,9 +225,6 @@ pub const F_GETOWN_EX: ::c_int = 16; pub const F_GETSIG: ::c_int = 11; pub const F_LINUX_SPECIFIC_BASE: ::c_int = 1024; pub const FLUSHO: ::c_int = 4096; -pub const F_OFD_GETLK: ::c_int = 36; -pub const F_OFD_SETLK: ::c_int = 37; -pub const F_OFD_SETLKW: ::c_int = 38; pub const F_OWNER_PGRP: ::c_int = 2; pub const F_OWNER_PID: ::c_int = 1; pub const F_OWNER_TID: ::c_int = 0; @@ -265,7 +262,6 @@ pub const PF_FILE: ::c_int = 1; pub const PF_KCM: ::c_int = 41; pub const PF_MAX: ::c_int = 43; pub const PF_QIPCRTR: ::c_int = 42; -#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const SA_ONSTACK: ::c_int = 0x08000000; pub const SA_SIGINFO: ::c_int = 0x00000004; pub const SA_NOCLDWAIT: ::c_int = 0x00000002; @@ -295,8 +291,6 @@ pub const SIG_SETMASK: ::c_int = 2; // FIXME check these pub const SIG_BLOCK: ::c_int = 0x000000; pub const SIG_UNBLOCK: ::c_int = 0x01; pub const SOCK_DGRAM: ::c_int = 2; -pub const SOCK_NONBLOCK: ::c_int = 2048; -pub const SOCK_SEQPACKET: ::c_int = 5; pub const SOCK_STREAM: ::c_int = 1; pub const SOL_CAIF: ::c_int = 278; pub const SOL_IUCV: ::c_int = 277; diff --git a/src/unix/linux_like/linux/musl/b32/mips/mod.rs b/src/unix/linux_like/linux/musl/b32/mips/mod.rs index d09b8278e5f1c..2fb405bbc6ceb 100644 --- a/src/unix/linux_like/linux/musl/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/mips/mod.rs @@ -174,6 +174,7 @@ pub const O_LARGEFILE: ::c_int = 0x2000; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const CBAUD: ::tcflag_t = 0o0010017; pub const TAB1: ::c_int = 0x00000800; pub const TAB2: ::c_int = 0x00001000; @@ -250,8 +251,6 @@ pub const O_SYNC: ::c_int = 0o40020; pub const O_RSYNC: ::c_int = 0o40020; pub const O_DSYNC: ::c_int = 0o020; -pub const SOCK_NONBLOCK: ::c_int = 0o200; - pub const MAP_ANON: ::c_int = 0x800; pub const MAP_GROWSDOWN: ::c_int = 0x1000; pub const MAP_DENYWRITE: ::c_int = 0x2000; @@ -351,7 +350,6 @@ pub const ERFKILL: ::c_int = 167; pub const SOCK_STREAM: ::c_int = 2; pub const SOCK_DGRAM: ::c_int = 1; -pub const SOCK_SEQPACKET: ::c_int = 5; pub const SA_ONSTACK: ::c_int = 0x08000000; pub const SA_SIGINFO: ::c_int = 8; @@ -388,9 +386,6 @@ pub const F_GETOWN: ::c_int = 23; pub const F_SETLK: ::c_int = 34; pub const F_SETLKW: ::c_int = 35; pub const F_SETOWN: ::c_int = 24; -pub const F_OFD_GETLK: ::c_int = 36; -pub const F_OFD_SETLK: ::c_int = 37; -pub const F_OFD_SETLKW: ::c_int = 38; pub const VEOF: usize = 16; pub const VEOL: usize = 17; diff --git a/src/unix/linux_like/linux/musl/b32/powerpc.rs b/src/unix/linux_like/linux/musl/b32/powerpc.rs index ec4f2047e46b2..bdf25455fd8cc 100644 --- a/src/unix/linux_like/linux/musl/b32/powerpc.rs +++ b/src/unix/linux_like/linux/musl/b32/powerpc.rs @@ -167,6 +167,7 @@ pub const O_LARGEFILE: ::c_int = 0x10000; pub const MCL_CURRENT: ::c_int = 0x2000; pub const MCL_FUTURE: ::c_int = 0x4000; +pub const MCL_ONFAULT: ::c_int = 0x8000; pub const CBAUD: ::tcflag_t = 0o0000377; pub const TAB1: ::c_int = 0x00000400; pub const TAB2: ::c_int = 0x00000800; @@ -243,8 +244,6 @@ pub const O_SYNC: ::c_int = 1052672; pub const O_RSYNC: ::c_int = 1052672; pub const O_DSYNC: ::c_int = 4096; -pub const SOCK_NONBLOCK: ::c_int = 2048; - pub const MAP_ANON: ::c_int = 0x0020; pub const MAP_GROWSDOWN: ::c_int = 0x0100; pub const MAP_DENYWRITE: ::c_int = 0x0800; @@ -262,7 +261,6 @@ pub const PTRACE_SYSEMU_SINGLESTEP: ::c_int = 0x1e; pub const SOCK_STREAM: ::c_int = 1; pub const SOCK_DGRAM: ::c_int = 2; -pub const SOCK_SEQPACKET: ::c_int = 5; pub const EDEADLK: ::c_int = 35; pub const ENAMETOOLONG: ::c_int = 36; @@ -385,9 +383,6 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETLK: ::c_int = 13; pub const F_SETLKW: ::c_int = 14; pub const F_SETOWN: ::c_int = 8; -pub const F_OFD_GETLK: ::c_int = 36; -pub const F_OFD_SETLK: ::c_int = 37; -pub const F_OFD_SETLKW: ::c_int = 38; pub const VEOF: usize = 4; pub const VEOL: usize = 6; diff --git a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs index bf7a4f59c7945..f963f645a9f10 100644 --- a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs @@ -323,9 +323,11 @@ pub const POLLWRBAND: ::c_short = 512; pub const O_ASYNC: ::c_int = 8192; pub const O_NDELAY: ::c_int = 2048; pub const EFD_NONBLOCK: ::c_int = 2048; -pub const F_GETLK: ::c_int = 5; -pub const F_GETOWN: ::c_int = 9; pub const F_SETOWN: ::c_int = 8; +pub const F_GETOWN: ::c_int = 9; +pub const F_GETLK: ::c_int = 12; +pub const F_SETLK: ::c_int = 13; +pub const F_SETLKW: ::c_int = 14; pub const SFD_NONBLOCK: ::c_int = 2048; pub const TCSANOW: ::c_int = 0; pub const TCSADRAIN: ::c_int = 1; @@ -353,6 +355,7 @@ pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; pub const __SIZEOF_PTHREAD_BARRIERATTR_T: usize = 4; pub const O_DIRECT: ::c_int = 16384; pub const O_DIRECTORY: ::c_int = 65536; +pub const O_LARGEFILE: ::c_int = 0o0100000; pub const O_NOFOLLOW: ::c_int = 131072; pub const MAP_HUGETLB: ::c_int = 262144; pub const MAP_LOCKED: ::c_int = 8192; @@ -376,6 +379,7 @@ pub const FIONCLEX: ::c_int = 21584; pub const FIONBIO: ::c_int = 21537; pub const MCL_CURRENT: ::c_int = 1; pub const MCL_FUTURE: ::c_int = 2; +pub const MCL_ONFAULT: ::c_int = 4; pub const SIGSTKSZ: ::size_t = 8192; pub const MINSIGSTKSZ: ::size_t = 2048; pub const CBAUD: ::tcflag_t = 4111; diff --git a/src/unix/linux_like/linux/musl/b32/x86/mod.rs b/src/unix/linux_like/linux/musl/b32/x86/mod.rs index aaca917fa03cd..944d6e7877d48 100644 --- a/src/unix/linux_like/linux/musl/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/x86/mod.rs @@ -224,6 +224,7 @@ pub const O_LARGEFILE: ::c_int = 0o0100000; pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const CBAUD: ::tcflag_t = 0o0010017; pub const TAB1: ::c_int = 0x00000800; pub const TAB2: ::c_int = 0x00001000; @@ -300,8 +301,6 @@ pub const O_SYNC: ::c_int = 1052672; pub const O_RSYNC: ::c_int = 1052672; pub const O_DSYNC: ::c_int = 4096; -pub const SOCK_NONBLOCK: ::c_int = 2048; - pub const MAP_ANON: ::c_int = 0x0020; pub const MAP_GROWSDOWN: ::c_int = 0x0100; pub const MAP_DENYWRITE: ::c_int = 0x0800; @@ -315,7 +314,6 @@ pub const MAP_SYNC: ::c_int = 0x080000; pub const SOCK_STREAM: ::c_int = 1; pub const SOCK_DGRAM: ::c_int = 2; -pub const SOCK_SEQPACKET: ::c_int = 5; pub const EDEADLK: ::c_int = 35; pub const ENAMETOOLONG: ::c_int = 36; @@ -441,9 +439,6 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETLK: ::c_int = 13; pub const F_SETLKW: ::c_int = 14; pub const F_SETOWN: ::c_int = 8; -pub const F_OFD_GETLK: ::c_int = 36; -pub const F_OFD_SETLK: ::c_int = 37; -pub const F_OFD_SETLKW: ::c_int = 38; pub const VEOF: usize = 4; pub const VEOL: usize = 11; diff --git a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs index 14b4bc6d68b87..54e072b314a84 100644 --- a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs @@ -250,9 +250,6 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; pub const F_SETOWN: ::c_int = 8; -pub const F_OFD_GETLK: ::c_int = 36; -pub const F_OFD_SETLK: ::c_int = 37; -pub const F_OFD_SETLKW: ::c_int = 38; pub const VEOF: usize = 4; @@ -567,6 +564,7 @@ pub const SYS_set_mempolicy_home_node: ::c_long = 450; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const CBAUD: ::tcflag_t = 0o0010017; pub const TAB1: ::c_int = 0x00000800; pub const TAB2: ::c_int = 0x00001000; diff --git a/src/unix/linux_like/linux/musl/b64/mips64.rs b/src/unix/linux_like/linux/musl/b64/mips64.rs index 22ac916909346..18fa6c664c81d 100644 --- a/src/unix/linux_like/linux/musl/b64/mips64.rs +++ b/src/unix/linux_like/linux/musl/b64/mips64.rs @@ -612,12 +612,10 @@ pub const F_GETOWN: ::c_int = 23; pub const F_SETOWN: ::c_int = 24; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; -pub const F_OFD_GETLK: ::c_int = 36; -pub const F_OFD_SETLK: ::c_int = 37; -pub const F_OFD_SETLKW: ::c_int = 38; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const CBAUD: ::tcflag_t = 0o0010017; pub const TAB1: ::tcflag_t = 0x00000800; diff --git a/src/unix/linux_like/linux/musl/b64/mod.rs b/src/unix/linux_like/linux/musl/b64/mod.rs index f437355d900cb..05586cdb44b68 100644 --- a/src/unix/linux_like/linux/musl/b64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/mod.rs @@ -134,10 +134,6 @@ pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 32; -pub const SOCK_NONBLOCK: ::c_int = 2048; - -pub const SOCK_SEQPACKET: ::c_int = 5; - extern "C" { pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; } diff --git a/src/unix/linux_like/linux/musl/b64/powerpc64.rs b/src/unix/linux_like/linux/musl/b64/powerpc64.rs index c9bd94135c9a4..202abe8796b13 100644 --- a/src/unix/linux_like/linux/musl/b64/powerpc64.rs +++ b/src/unix/linux_like/linux/musl/b64/powerpc64.rs @@ -212,9 +212,6 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; pub const F_SETOWN: ::c_int = 8; -pub const F_OFD_GETLK: ::c_int = 36; -pub const F_OFD_SETLK: ::c_int = 37; -pub const F_OFD_SETLKW: ::c_int = 38; pub const VEOF: usize = 4; @@ -626,6 +623,7 @@ pub const FLUSHO: ::tcflag_t = 0x00800000; pub const MCL_CURRENT: ::c_int = 0x2000; pub const MCL_FUTURE: ::c_int = 0x4000; +pub const MCL_ONFAULT: ::c_int = 0x8000; pub const CBAUD: ::tcflag_t = 0xff; pub const TAB1: ::c_int = 0x400; pub const TAB2: ::c_int = 0x800; diff --git a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs index 9e9dbf6c83097..393f54d3ff773 100644 --- a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs @@ -469,6 +469,9 @@ pub const SYS_faccessat2: ::c_long = 439; pub const SYS_process_madvise: ::c_long = 440; pub const SYS_epoll_pwait2: ::c_long = 441; pub const SYS_mount_setattr: ::c_long = 442; +pub const SYS_landlock_create_ruleset: ::c_long = 444; +pub const SYS_landlock_add_rule: ::c_long = 445; +pub const SYS_landlock_restrict_self: ::c_long = 446; pub const O_APPEND: ::c_int = 1024; pub const O_DIRECT: ::c_int = 0x4000; @@ -604,9 +607,6 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; pub const F_SETOWN: ::c_int = 8; -pub const F_OFD_GETLK: ::c_int = 36; -pub const F_OFD_SETLK: ::c_int = 37; -pub const F_OFD_SETLKW: ::c_int = 38; pub const VEOF: usize = 4; @@ -630,6 +630,7 @@ pub const MAP_SYNC: ::c_int = 0x080000; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const CBAUD: ::tcflag_t = 0o0010017; pub const TAB1: ::c_int = 0x00000800; pub const TAB2: ::c_int = 0x00001000; diff --git a/src/unix/linux_like/linux/musl/b64/s390x.rs b/src/unix/linux_like/linux/musl/b64/s390x.rs index f338dcc54a7ec..aa4cbf87f8a22 100644 --- a/src/unix/linux_like/linux/musl/b64/s390x.rs +++ b/src/unix/linux_like/linux/musl/b64/s390x.rs @@ -290,15 +290,13 @@ pub const EXTPROC: ::tcflag_t = 0x00010000; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const F_GETLK: ::c_int = 5; pub const F_GETOWN: ::c_int = 9; pub const F_SETOWN: ::c_int = 8; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; -pub const F_OFD_GETLK: ::c_int = 36; -pub const F_OFD_SETLK: ::c_int = 37; -pub const F_OFD_SETLKW: ::c_int = 38; pub const VTIME: usize = 5; pub const VSWTC: usize = 7; diff --git a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs index 9decf91bcc63a..4d17868000ebd 100644 --- a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs @@ -805,9 +805,6 @@ pub const F_GETOWN: ::c_int = 9; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; pub const F_SETOWN: ::c_int = 8; -pub const F_OFD_GETLK: ::c_int = 36; -pub const F_OFD_SETLK: ::c_int = 37; -pub const F_OFD_SETLKW: ::c_int = 38; pub const VEOF: usize = 4; @@ -831,6 +828,7 @@ pub const MAP_SYNC: ::c_int = 0x080000; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const CBAUD: ::tcflag_t = 0o0010017; pub const TAB1: ::c_int = 0x00000800; pub const TAB2: ::c_int = 0x00001000; diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 4c605338972e3..b67d55e99bb53 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -512,6 +512,10 @@ pub const ECOMM: ::c_int = 70; pub const EPROTO: ::c_int = 71; pub const EDOTDOT: ::c_int = 73; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; + pub const F_RDLCK: ::c_int = 0; pub const F_WRLCK: ::c_int = 1; pub const F_UNLCK: ::c_int = 2; @@ -541,7 +545,9 @@ pub const POSIX_MADV_DONTNEED: ::c_int = 4; pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; +pub const SOCK_SEQPACKET: ::c_int = 5; pub const SOCK_DCCP: ::c_int = 6; +pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK; pub const SOCK_PACKET: ::c_int = 10; pub const SOMAXCONN: ::c_int = 128; @@ -585,11 +591,8 @@ pub const PTRACE_SEIZE: ::c_int = 0x4206; pub const PTRACE_INTERRUPT: ::c_int = 0x4207; pub const PTRACE_LISTEN: ::c_int = 0x4208; pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209; - -pub const FAN_MARK_INODE: ::c_uint = 0x0000_0000; -pub const FAN_MARK_MOUNT: ::c_uint = 0x0000_0010; -// NOTE: FAN_MARK_FILESYSTEM requires Linux Kernel >= 4.20.0 -pub const FAN_MARK_FILESYSTEM: ::c_uint = 0x0000_0100; +pub const PTRACE_GETSIGMASK: ::c_uint = 0x420a; +pub const PTRACE_SETSIGMASK: ::c_uint = 0x420b; pub const AF_IB: ::c_int = 27; pub const AF_MPLS: ::c_int = 28; diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs index 4a01e0cd81c85..48b03e9ee43fa 100644 --- a/src/unix/linux_like/linux/uclibc/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mod.rs @@ -109,6 +109,7 @@ impl siginfo_t { pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; pub const SIGEV_THREAD_ID: ::c_int = 4; @@ -245,9 +246,6 @@ pub const EDEADLOCK: ::c_int = EDEADLK; pub const EXTA: ::c_uint = B19200; pub const EXTB: ::c_uint = B38400; pub const EXTPROC: ::tcflag_t = 0200000; -pub const FAN_MARK_FILESYSTEM: ::c_int = 0x00000100; -pub const FAN_MARK_INODE: ::c_int = 0x00000000; -pub const FAN_MARK_MOUNT: ::c_int = 0x10; pub const FOPEN_MAX: ::c_int = 16; pub const F_GETOWN: ::c_int = 9; pub const F_OFD_GETLK: ::c_int = 36; @@ -282,7 +280,9 @@ pub const PF_NFC: ::c_int = 39; pub const PF_VSOCK: ::c_int = 40; pub const POSIX_MADV_DONTNEED: ::c_int = 4; pub const PTRACE_EVENT_STOP: ::c_int = 128; +pub const PTRACE_GETSIGMASK: ::c_uint = 0x420a; pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209; +pub const PTRACE_SETSIGMASK: ::c_uint = 0x420b; pub const RTLD_NOLOAD: ::c_int = 0x00004; pub const RUSAGE_THREAD: ::c_int = 1; pub const SHM_EXEC: ::c_int = 0100000; @@ -343,7 +343,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 9daebcaa6d364..fc905cfcc6589 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -321,7 +321,7 @@ cfg_if! { if #[cfg(any(target_os = "l4re", target_os = "espidf"))] { // required libraries for L4Re and the ESP-IDF framework are linked externally, ATM } else if #[cfg(feature = "std")] { - // cargo build, don't pull in anything extra as the libstd dep + // cargo build, don't pull in anything extra as the std dep // already pulls in all libs. } else if #[cfg(all(target_os = "linux", any(target_env = "gnu", target_env = "uclibc"), diff --git a/src/unix/nto/mod.rs b/src/unix/nto/mod.rs index ed6f6df41368e..9eef23458d14a 100644 --- a/src/unix/nto/mod.rs +++ b/src/unix/nto/mod.rs @@ -2557,6 +2557,7 @@ pub const RLIMIT_NPROC: ::c_int = 8; pub const RLIMIT_RSS: ::c_int = 6; pub const RLIMIT_STACK: ::c_int = 3; pub const RLIMIT_VMEM: ::c_int = 6; +#[deprecated(since = "0.2.64", note = "Not stable across OS versions")] pub const RLIM_NLIMITS: ::c_int = 14; pub const SCHED_ADJTOHEAD: ::c_int = 5; @@ -3282,7 +3283,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index 900337b4f7e21..17242eaf2a1df 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -28,7 +28,7 @@ pub type nfds_t = ::c_ulong; pub type nlink_t = ::c_ulong; pub type off_t = ::c_longlong; pub type pthread_t = *mut ::c_void; -// Must be usize due to libstd/sys_common/thread_local.rs, +// Must be usize due to library/std/sys_common/thread_local.rs, // should technically be *mut ::c_void pub type pthread_key_t = usize; pub type rlim_t = ::c_ulonglong; @@ -1080,6 +1080,10 @@ extern "C" { pub fn getdtablesize() -> ::c_int; // grp.h + pub fn getgrent() -> *mut ::group; + pub fn setgrent(); + pub fn endgrent(); + pub fn getgrgid(gid: ::gid_t) -> *mut ::group; pub fn getgrgid_r( gid: ::gid_t, grp: *mut ::group, @@ -1087,6 +1091,7 @@ extern "C" { buflen: ::size_t, result: *mut *mut ::group, ) -> ::c_int; + pub fn getgrnam(name: *const ::c_char) -> *mut ::group; pub fn getgrnam_r( name: *const ::c_char, grp: *mut ::group, diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index a3fa56a65a67e..04dde54cf3649 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -2753,7 +2753,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; pub fn setpwent(); diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index c337a82793e6a..43afbc3e2c23d 100644 --- a/src/vxworks/mod.rs +++ b/src/vxworks/mod.rs @@ -582,8 +582,8 @@ pub const EAI_SERVICE: ::c_int = 9; pub const EAI_SOCKTYPE: ::c_int = 10; pub const EAI_SYSTEM: ::c_int = 11; -// This is not defined in vxWorks, but we have to define it here -// to make the building pass for getrandom and libstd, FIXME +// FIXME: This is not defined in vxWorks, but we have to define it here +// to make the building pass for getrandom and std pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; //Clock Lib Stuff @@ -1018,6 +1018,21 @@ pub const O_WRONLY: ::c_int = 0x0001; pub const O_RDONLY: ::c_int = 0; pub const O_NONBLOCK: ::c_int = 0x4000; +// mman.h +pub const PROT_NONE: ::c_int = 0x0000; +pub const PROT_READ: ::c_int = 0x0001; +pub const PROT_WRITE: ::c_int = 0x0002; +pub const PROT_EXEC: ::c_int = 0x0004; + +pub const MAP_SHARED: ::c_int = 0x0001; +pub const MAP_PRIVATE: ::c_int = 0x0002; +pub const MAP_ANON: ::c_int = 0x0004; +pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; +pub const MAP_FIXED: ::c_int = 0x0010; +pub const MAP_CONTIG: ::c_int = 0x0020; + +pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; + #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum FILE {} impl ::Copy for FILE {} @@ -1218,6 +1233,8 @@ extern "C" { ) -> *mut ::c_void; pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int; pub fn truncate(path: *const c_char, length: off_t) -> ::c_int; + pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) -> ::c_int; + pub fn shm_unlink(name: *const ::c_char) -> ::c_int; pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int; pub fn pthread_exit(value: *mut ::c_void) -> !; @@ -1909,19 +1926,19 @@ cfg_if! { if #[cfg(target_arch = "aarch64")] { mod aarch64; pub use self::aarch64::*; - } else if #[cfg(any(target_arch = "arm"))] { + } else if #[cfg(target_arch = "arm")] { mod arm; pub use self::arm::*; - } else if #[cfg(any(target_arch = "x86"))] { + } else if #[cfg(target_arch = "x86")] { mod x86; pub use self::x86::*; - } else if #[cfg(any(target_arch = "x86_64"))] { + } else if #[cfg(target_arch = "x86_64")] { mod x86_64; pub use self::x86_64::*; - } else if #[cfg(any(target_arch = "powerpc"))] { + } else if #[cfg(target_arch = "powerpc")] { mod powerpc; pub use self::powerpc::*; - } else if #[cfg(any(target_arch = "powerpc64"))] { + } else if #[cfg(target_arch = "powerpc64")] { mod powerpc64; pub use self::powerpc64::*; } else {