diff --git a/.cirrus.yml b/.cirrus.yml index e428871c41b84..18753922ed651 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,7 +1,7 @@ task: name: nightly x86_64-unknown-freebsd-13 freebsd_instance: - image_family: freebsd-13-2 + image_family: freebsd-13-3 setup_script: - pkg install -y libnghttp2 curl - curl https://sh.rustup.rs -sSf --output rustup.sh @@ -15,7 +15,7 @@ task: task: name: nightly x86_64-unknown-freebsd-14 freebsd_instance: - image: freebsd-14-0-release-amd64-ufs + image: freebsd-14-1-release-amd64-ufs setup_script: - pkg install -y libnghttp2 curl - curl https://sh.rustup.rs -sSf --output rustup.sh diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 70ed1ca355300..3bfd0807ce11b 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,15 +1,25 @@ Thanks for considering submitting a PR! -We have the [contribution guide](https://github.com/rust-lang/libc/blob/main/CONTRIBUTING.md). Please read it if you're new here! +We have the +[contribution guide](https://github.com/rust-lang/libc/blob/main/CONTRIBUTING.md). +Please read it if you're new here! -Here's a checklist for things that will be checked during review or continuous integration. +Here is a checklist for things that will be checked during review or continuous +integration: -- \[ ] Edit corresponding file(s) under `libc-test/semver` when you add/remove item(s), e.g. edit `linux.txt` if you add an item to `src/unix/linux_like/linux/mod.rs` -- \[ ] Your PR doesn't contain any private or *unstable* values like `*LAST` or `*MAX` (see [#3131](https://github.com/rust-lang/libc/issues/3131)) +- \[ ] Edit corresponding file(s) under `libc-test/semver` when you add/remove + item(s), e.g. edit `linux.txt` if you add an item to + `src/unix/linux_like/linux/mod.rs` +- \[ ] Your PR doesn't contain any private or _unstable_ values like `*LAST` or + `*MAX` (see [#3131](https://github.com/rust-lang/libc/issues/3131)) +- \[ ] Provide a link to relevant source (headers or documentation) if your PR + adds or changes API. - \[ ] If your PR has a breaking change, please clarify it -- \[ ] If your PR increments version number, it must NOT contain any other changes (otherwise a release could be delayed) +- \[ ] If your PR increments version number, it must NOT contain any other + changes (otherwise a release could be delayed) - \[ ] Make sure `ci/style.sh` passes - \[ ] `cd libc-test && cargo test` - - (this might fail on your env due to environment difference between your env and CI. Ignore failures if you are not sure) + - (this might fail on your env due to environment difference between your env + and CI. Ignore local failures if you are not sure) Delete this line and everything above before opening your PR. diff --git a/.github/workflows/bors.yml b/.github/workflows/bors.yml deleted file mode 100644 index d936a106c1288..0000000000000 --- a/.github/workflows/bors.yml +++ /dev/null @@ -1,356 +0,0 @@ -name: CI (bors) - -on: - push: - branches: - - auto-libc - - try - -permissions: {} -jobs: - docker_linux_tier1: - permissions: - actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds) - contents: read # to fetch code (actions/checkout) - - name: Docker Linux Tier1 - runs-on: ubuntu-22.04 - strategy: - fail-fast: true - matrix: - target: [ - i686-unknown-linux-gnu, - x86_64-unknown-linux-gnu, - ] - steps: - - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD - with: - github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v4 - - name: Setup Rust toolchain - run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh - - name: Execute run-docker.sh - run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }} - - macos: - permissions: - actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds) - contents: read # to fetch code (actions/checkout) - - name: macOS - runs-on: macos-13 - strategy: - fail-fast: true - matrix: - target: [ - x86_64-apple-darwin, - ] - steps: - - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD - with: - github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v4 - - name: Setup Rust toolchain - run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh - - name: Execute run.sh - run: LIBC_CI=1 sh ./ci/run.sh ${{ matrix.target }} - - windows: - permissions: - actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds) - contents: read # to fetch code (actions/checkout) - - name: Windows - runs-on: windows-2022 - env: - OS: windows - strategy: - fail-fast: true - matrix: - include: - - target: x86_64-pc-windows-gnu - env: - ARCH_BITS: 64 - ARCH: x86_64 - - target: x86_64-pc-windows-msvc - - target: i686-pc-windows-gnu - env: - ARCH_BITS: 32 - ARCH: i686 - - target: i686-pc-windows-msvc - steps: - - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD - with: - github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v4 - - name: Self-update rustup - run: rustup self update - shell: bash - - name: Setup Rust toolchain - run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh - shell: bash - - name: Execute run.sh - run: LIBC_CI=1 sh ./ci/run.sh ${{ matrix.target }} - shell: bash - - style_check: - permissions: - actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds) - contents: read # to fetch code (actions/checkout) - - name: Style check - runs-on: ubuntu-22.04 - steps: - - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD - with: - github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v4 - - name: Setup Rust toolchain - run: sh ./ci/install-rust.sh - - name: Check style - run: sh ci/style.sh - - docker_linux_tier2: - permissions: - actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds) - contents: read # to fetch code (actions/checkout) - - name: Docker Linux Tier2 - needs: [docker_linux_tier1, style_check] - runs-on: ubuntu-22.04 - strategy: - fail-fast: true - max-parallel: 12 - matrix: - target: [ - aarch64-linux-android, - aarch64-unknown-linux-gnu, - aarch64-unknown-linux-musl, - arm-linux-androideabi, - arm-unknown-linux-gnueabihf, - arm-unknown-linux-musleabihf, - i686-linux-android, - i686-unknown-linux-musl, - powerpc-unknown-linux-gnu, - powerpc64-unknown-linux-gnu, - powerpc64le-unknown-linux-gnu, - s390x-unknown-linux-gnu, - riscv64gc-unknown-linux-gnu, - # FIXME: A recent nightly causes a linker failure: - # https://github.com/rust-lang/rust/issues/76679 - # See this comment for more details: - # https://github.com/rust-lang/libc/pull/2225#issuecomment-880696737 - #wasm32-wasi, - sparc64-unknown-linux-gnu, - wasm32-unknown-emscripten, - x86_64-linux-android, - # FIXME: Exec format error (os error 8) - #x86_64-unknown-linux-gnux32, - x86_64-unknown-linux-musl, - # FIXME: It seems some items in `src/unix/mod.rs` - # aren't defined on redox actually. - # x86_64-unknown-redox, - ] - steps: - - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD - with: - github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v4 - - name: Setup Rust toolchain - run: TARGET=${{ matrix.target }} sh ./ci/install-rust.sh - - name: Execute run-docker.sh - run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }} - - # These targets are tier 3 or otherwise need to have CI build std via -Zbuild-std. - # Because of this, only the nightly compiler can be used on these targets. - docker_linux_build_std: - permissions: - actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds) - contents: read # to fetch code (actions/checkout) - - if: ${{ false }} # This is currently broken - name: Docker Linux Build-Std Targets - needs: [docker_linux_tier1, style_check] - runs-on: ubuntu-22.04 - strategy: - fail-fast: true - max-parallel: 12 - matrix: - target: [ - armv7-unknown-linux-uclibceabihf - ] - steps: - - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD - with: - github_token: "${{ secrets.GITHUB_TOKEN }}" - - 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 - run: LIBC_CI=1 TOOLCHAIN=nightly LIBC_CI_ZBUILD_STD=1 sh ./ci/run-docker.sh ${{ matrix.target }} - - # devkitpro's pacman needs to be connected from Docker. - docker_switch: - permissions: - actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds) - contents: read # to fetch code (actions/checkout) - - name: Docker Switch - needs: [docker_linux_tier1, style_check] - runs-on: ubuntu-22.04 - steps: - - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD - with: - github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v4 - - name: Setup Rust toolchain - run: sh ./ci/install-rust.sh - - name: Execute run-docker.sh - run: LIBC_CI=1 sh ./ci/run-docker.sh switch - - build_channels_linux: - permissions: - actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds) - contents: read # to fetch code (actions/checkout) - - name: Build Channels Linux - needs: docker_linux_tier2 - runs-on: ubuntu-22.04 - env: - OS: linux - strategy: - fail-fast: true - max-parallel: 5 - matrix: - toolchain: [ - stable, - beta, - nightly, - 1.71.0, - ] - steps: - - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD - with: - github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v4 - - name: Setup Rust toolchain - run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/install-rust.sh - - name: Execute build.sh - run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh - - build_channels_macos: - permissions: - contents: read # to fetch code (actions/checkout) - - name: Build Channels macOS - needs: macos - env: - OS: macos - strategy: - fail-fast: true - max-parallel: 4 - matrix: - target: - - { toolchain: stable, os: macos-13 } - - { toolchain: beta, os: macos-13 } - - { toolchain: nightly, os: macos-13 } - - { toolchain: 1.71.0, os: macos-13 } - runs-on: ${{ matrix.target.os }} - steps: - - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD - with: - github_token: "${{ secrets.GITHUB_TOKEN }}" - - uses: actions/checkout@v4 - - name: Setup Rust toolchain - run: TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/install-rust.sh - - name: Execute build.sh - run: LIBC_CI=1 TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/build.sh - - build_channels_windows: - permissions: - contents: read # to fetch code (actions/checkout) - - name: Build Channels Windows - runs-on: windows-2022 - env: - OS: windows - strategy: - fail-fast: true - matrix: - toolchain: [ - 1.71.0, - stable, - ] - steps: - - uses: actions/checkout@v4 - - name: Self-update rustup - run: rustup self update - shell: bash - - name: Execute build.sh - run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh - shell: bash - - check_cfg: - permissions: - actions: write # to cancel workflows (rust-lang/simpleinfra/github-actions/cancel-outdated-builds) - contents: read # to fetch code (actions/checkout) - - name: "Check #[cfg]s" - runs-on: ubuntu-22.04 - steps: - - uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@HEAD - with: - github_token: "${{ secrets.GITHUB_TOKEN }}" - - 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 - - # 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 - # workflow is successful listening to webhooks only. - # - # ALL THE PREVIOUS JOBS NEED TO BE ADDED TO THE `needs` SECTION OF THIS JOB! - - end_success: - name: bors build finished - if: github.event.pusher.name == 'bors' && success() - runs-on: ubuntu-22.04 - needs: [ - docker_linux_tier1, - docker_linux_tier2, - #docker_linux_build_std, - macos, - windows, - style_check, - docker_switch, - build_channels_linux, - build_channels_macos, - build_channels_windows, - ] - - steps: - - name: Mark the job as successful - run: exit 0 - - end_failure: - name: bors build finished - if: github.event.pusher.name == 'bors' && (failure() || cancelled()) - runs-on: ubuntu-22.04 - needs: [ - docker_linux_tier1, - docker_linux_tier2, - #docker_linux_build_std, - macos, - windows, - style_check, - docker_switch, - build_channels_linux, - build_channels_macos, - build_channels_windows, - ] - - steps: - - name: Mark the job as a failure - run: exit 1 diff --git a/.github/workflows/full_ci.yml b/.github/workflows/full_ci.yml index 5c2f79f2ef5e5..13f26ac6fa2d5 100644 --- a/.github/workflows/full_ci.yml +++ b/.github/workflows/full_ci.yml @@ -31,12 +31,12 @@ jobs: contents: read # to fetch code (actions/checkout) name: macOS - runs-on: macos-13 + runs-on: macos-14 strategy: fail-fast: true matrix: target: [ - x86_64-apple-darwin, + aarch64-apple-darwin, ] steps: - uses: actions/checkout@v4 @@ -62,10 +62,11 @@ jobs: ARCH_BITS: 64 ARCH: x86_64 - target: x86_64-pc-windows-msvc - - target: i686-pc-windows-gnu - env: - ARCH_BITS: 32 - ARCH: i686 + # FIXME: It currently causes segfaults. + #- target: i686-pc-windows-gnu + # env: + # ARCH_BITS: 32 + # ARCH: i686 - target: i686-pc-windows-msvc steps: - uses: actions/checkout@v4 @@ -117,11 +118,8 @@ jobs: powerpc64le-unknown-linux-gnu, s390x-unknown-linux-gnu, riscv64gc-unknown-linux-gnu, - # FIXME: A recent nightly causes a linker failure: - # https://github.com/rust-lang/rust/issues/76679 - # See this comment for more details: - # https://github.com/rust-lang/libc/pull/2225#issuecomment-880696737 - #wasm32-wasi, + wasm32-wasip1, + wasm32-wasip2, sparc64-unknown-linux-gnu, wasm32-unknown-emscripten, x86_64-linux-android, @@ -139,45 +137,6 @@ jobs: - name: Execute run-docker.sh run: LIBC_CI=1 sh ./ci/run-docker.sh ${{ matrix.target }} - # These targets are tier 3 or otherwise need to have CI build std via -Zbuild-std. - # Because of this, only the nightly compiler can be used on these targets. - docker_linux_build_std: - permissions: - contents: read # to fetch code (actions/checkout) - - if: ${{ false }} # This is currently broken - name: Docker Linux Build-Std Targets - needs: [docker_linux_tier1, style_check] - runs-on: ubuntu-22.04 - strategy: - fail-fast: true - max-parallel: 12 - matrix: - target: [ - armv7-unknown-linux-uclibceabihf - ] - steps: - - 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 - run: LIBC_CI=1 TOOLCHAIN=nightly LIBC_CI_ZBUILD_STD=1 sh ./ci/run-docker.sh ${{ matrix.target }} - - # devkitpro's pacman needs to be connected from Docker. - docker_switch: - permissions: - contents: read # to fetch code (actions/checkout) - - name: Docker Switch - needs: [docker_linux_tier1, style_check] - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - name: Setup Rust toolchain - run: sh ./ci/install-rust.sh - - name: Execute run-docker.sh - run: LIBC_CI=1 sh ./ci/run-docker.sh switch - build_channels_linux: permissions: contents: read # to fetch code (actions/checkout) @@ -195,7 +154,7 @@ jobs: stable, beta, nightly, - 1.71.0, + 1.63.0, ] steps: - uses: actions/checkout@v4 @@ -217,10 +176,10 @@ jobs: max-parallel: 4 matrix: target: - - { toolchain: stable, os: macos-13 } - - { toolchain: beta, os: macos-13 } - - { toolchain: nightly, os: macos-13 } - - { toolchain: 1.71.0, os: macos-13 } + - { toolchain: stable, os: macos-14 } + - { toolchain: beta, os: macos-14 } + - { toolchain: nightly, os: macos-14 } + - { toolchain: 1.63.0, os: macos-14 } runs-on: ${{ matrix.target.os }} steps: - uses: actions/checkout@v4 @@ -241,7 +200,7 @@ jobs: fail-fast: true matrix: toolchain: [ - 1.71.0, + 1.63.0, stable, ] steps: @@ -269,16 +228,14 @@ jobs: # One job that "summarizes" the success state of this pipeline. This can then be added to branch # protection, rather than having to add each job separately. success: - name: Success + name: success runs-on: ubuntu-22.04 needs: [ docker_linux_tier1, docker_linux_tier2, - #docker_linux_build_std, macos, windows, style_check, - docker_switch, build_channels_linux, build_channels_macos, build_channels_windows, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b6f41cc6de85e..beebff7ac4c08 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,12 +3,41 @@ Welcome! If you are reading this document, it means you are interested in contributing to the `libc` crate. -## v0.2 changes +## v1.0 Roadmap -If you want to add your changes to v0.2, please submit them to the `libc-0.2` branch. -If you want to add any breaking changes, it should be submitted to the main branch, -which has changes for v0.3. -We will support and make a new release for v0.2 until we make the first release of v0.3. +`libc` has two active branches: `main` and `libc-0.2`. `main` is for active +development of the upcoming v1.0 release, and should be the target of all pull +requests. `libc-0.2` is for updates to the currently released version. + +If a pull request to `main` is a good candidate for inclusion in an `0.2.x` +release, include `@rustbot label stable-nominated` in a comment to propose this. +Good candidates will usually meet the following: + +1. The included changes are non-breaking. +2. The change applies cleanly to both branches. +3. There is a usecase that justifies inclusion in a stable release (all + additions should always have a usecase, hopefully). + +Once a `stable-nominated` PR targeting `main` has merged, it can be cherry +picked to the `libc-0.2` branch. A maintainer will likely do these cherry +picks in a batch. + +Alternatively, you can start this process yourself by creating a new branch +based on `libc-0.2` and running `git cherry-pick -xe commit-sha-on-main` (`git +cherry-pick -xe start-sha^..end-sha` if a range of commits is needed). `git` +will automatically add the "cherry picked from commit" note, but try to add a +backport note so the original PR gets crosslinked: + +``` +# ... original commit message ... + +(backport ) # add manually +(cherry picked from commit 104b6a4ae31c726814c36318dc718470cc96e167) # added by git +``` + +Once the cherry-pick is complete, open a PR targeting `libc-0.2`. + +See the [tracking issue](https://github.com/rust-lang/libc/issues/3248) for details. ## Adding an API @@ -51,7 +80,7 @@ With that in mind, the steps for adding a new API are: 5. Wait for a merge! 1: Note that this list has nothing to do with any Unix or Posix -standard, it's just a list shared between all OSs that declare `#[cfg(unix)]`. +standard, it's just a list shared among all OSs that declare `#[cfg(unix)]`. ## Test before you commit diff --git a/Cargo.toml b/Cargo.toml index 45691e3e7e948..ffce4f3241bda 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ exclude = ["/ci/*", "/.github/*", "/.cirrus.yml", "/triagebot.toml"] description = """ Raw FFI bindings to platform libraries like libc. """ -rust-version = "1.71.0" +rust-version = "1.63.0" [package.metadata.docs.rs] features = ["const-extern-fn", "extra_traits"] @@ -47,7 +47,8 @@ targets = [ "armv7-wrs-vxworks-eabihf", "armv7r-none-eabi", "armv7r-none-eabihf", - "hexagon-unknown-linux-musl", + # FIXME(hexagon): excluded due to duplicate symbol errors + # "hexagon-unknown-linux-musl", "i586-pc-windows-msvc", "i586-unknown-linux-gnu", "i586-unknown-linux-musl", diff --git a/README.md b/README.md index 4b72be03179aa..da5a64f2e1083 100644 --- a/README.md +++ b/README.md @@ -16,14 +16,17 @@ More detailed information about the design of this library can be found in its [rfc]: https://github.com/rust-lang/rfcs/blob/HEAD/text/1291-promote-libc.md -## v0.3 Roadmap +## v1.0 Roadmap -The main branch is now for v0.3 which has some breaking changes. +Currently, `libc` has two active branches: `main` for the upcoming v1.0 release, +and `libc-0.2` for the currently published version. By default all pull requests +should target `main`; once reviewed, they can be cherry picked to the `libc-0.2` +branch if needed. -For v0.2, please submit PRs to the `libc-0.2` branch instead. -We will stop making new v0.2 releases once we release v0.3 on crates.io. +We will stop making new v0.2 releases once v1.0 is released. -See the [tracking issue](https://github.com/rust-lang/libc/issues/3248) for details. +See the section in [CONTRIBUTING.md](CONTRIBUTING.md#v10-roadmap) for more +details. ## Usage @@ -49,7 +52,7 @@ libc = "0.2" ## Rust version support -The minimum supported Rust toolchain version is currently **Rust 1.71.0** +The minimum supported Rust toolchain version is currently **Rust 1.63.0** (libc does not currently have any policy regarding changes to the minimum supported Rust version; such policy is a work in progress). diff --git a/build.rs b/build.rs index 1933775aa407a..46f5dc8efff7c 100644 --- a/build.rs +++ b/build.rs @@ -1,13 +1,13 @@ use std::env; use std::process::Command; use std::str; -use std::string::String; // List of cfgs this build script is allowed to set. The list is needed to support check-cfg, as we // need to know all the possible cfgs that this script will set. If you need to set another cfg // make sure to add it to this list as well. const ALLOWED_CFGS: &'static [&'static str] = &[ "emscripten_new_stat_abi", + "espidf_time64", "freebsd10", "freebsd11", "freebsd12", @@ -17,12 +17,12 @@ const ALLOWED_CFGS: &'static [&'static str] = &[ "libc_const_extern_fn", "libc_const_extern_fn_unstable", "libc_deny_warnings", - "libc_thread_local", + "libc_ctest", ]; // Extra values to allow for check-cfg. const CHECK_CFG_EXTRA: &'static [(&'static str, &'static [&'static str])] = &[ - ("target_os", &["switch", "aix", "ohos", "hurd"]), + ("target_os", &["switch", "aix", "ohos", "hurd", "visionos"]), ("target_env", &["illumos", "wasi", "aix", "ohos"]), ( "target_arch", @@ -37,7 +37,7 @@ fn main() { let (rustc_minor_ver, is_nightly) = rustc_minor_nightly(); let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok(); let libc_ci = env::var("LIBC_CI").is_ok(); - let libc_check_cfg = env::var("LIBC_CHECK_CFG").is_ok(); + let libc_check_cfg = env::var("LIBC_CHECK_CFG").is_ok() || rustc_minor_ver >= 80; let const_extern_fn_cargo_feature = env::var("CARGO_FEATURE_CONST_EXTERN_FN").is_ok(); // The ABI of libc used by std is backward compatible with FreeBSD 12. @@ -45,14 +45,21 @@ fn main() { // // 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 => set_cfg("freebsd10"), - Some(11) if libc_ci => set_cfg("freebsd11"), - 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(15) if libc_ci => set_cfg("freebsd15"), - Some(_) | None => set_cfg("freebsd11"), + let which_freebsd = if libc_ci { + which_freebsd().unwrap_or(11) + } else if rustc_dep_of_std { + 12 + } else { + 11 + }; + match which_freebsd { + x if x < 10 => panic!("FreeBSD older than 10 is not supported"), + 10 => set_cfg("freebsd10"), + 11 => set_cfg("freebsd11"), + 12 => set_cfg("freebsd12"), + 13 => set_cfg("freebsd13"), + 14 => set_cfg("freebsd14"), + _ => set_cfg("freebsd15"), } match emcc_version_code() { @@ -66,11 +73,6 @@ fn main() { set_cfg("libc_deny_warnings"); } - // #[thread_local] is currently unstable - if rustc_dep_of_std { - set_cfg("libc_thread_local"); - } - // Rust >= 1.62.0 allows to use `const_extern_fn` for "Rust" and "C". if rustc_minor_ver >= 62 { set_cfg("libc_const_extern_fn"); @@ -119,11 +121,18 @@ fn rustc_minor_nightly() -> (u32, bool) { }; } - let rustc = otry!(env::var_os("RUSTC")); - let output = Command::new(rustc) + let rustc = env::var_os("RUSTC").expect("Failed to get rustc version: missing RUSTC env"); + let mut cmd = if let Some(wrapper) = env::var_os("RUSTC_WRAPPER").filter(|w| !w.is_empty()) { + let mut cmd = Command::new(wrapper); + cmd.arg(rustc); + cmd + } else { + Command::new(rustc) + }; + + let output = cmd .arg("--version") .output() - .ok() .expect("Failed to get rustc version"); if !output.status.success() { panic!( @@ -189,7 +198,7 @@ fn emcc_version_code() -> Option { // Some Emscripten versions come with `-git` attached, so split the // version string also on the `-` char. - let mut pieces = version.trim().split(|c| c == '.' || c == '-'); + let mut pieces = version.trim().split(['.', '-']); let major = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0); let minor = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0); diff --git a/ci/README.md b/ci/README.md index c8c23cfc947a9..c8da26f796557 100644 --- a/ci/README.md +++ b/ci/README.md @@ -158,7 +158,7 @@ about above), and then shut down. poweroff 1. Exit the post install shell: `exit` - 1. Back in in the installer choose Reboot + 1. Back in the installer choose Reboot 1. If all went well the machine should reboot and show a login prompt. If you switch to the serial console by choosing View > serial0 in the qemu menu, you should be logged in as root. diff --git a/ci/android-install-ndk.sh b/ci/android-install-ndk.sh index ebe791af703b8..b57370d81e6f7 100644 --- a/ci/android-install-ndk.sh +++ b/ci/android-install-ndk.sh @@ -2,7 +2,7 @@ set -ex -NDK=android-ndk-r26b +NDK=android-ndk-r27 wget --tries=20 -q https://dl.google.com/android/repository/${NDK}-linux.zip unzip -q ${NDK}-linux.zip diff --git a/ci/build.sh b/ci/build.sh index e22b893222312..722626b43d686 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -11,6 +11,7 @@ set -ex : "${OS?The OS environment variable must be set.}" RUST=${TOOLCHAIN} +VERBOSE=-v echo "Testing Rust ${RUST} on ${OS}" @@ -41,50 +42,50 @@ test_target() { # 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}" + cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --no-default-features --target "${TARGET}" else # FIXME: With `build-std` feature, `compiler_builtins` emits a lof of lint warnings. RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --no-default-features --target "${TARGET}" + -Z build-std=core,alloc "$VERBOSE" --no-default-features --target "${TARGET}" fi # 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}" + cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --target "${TARGET}" else RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --target "${TARGET}" + -Z build-std=core,alloc "$VERBOSE" --target "${TARGET}" fi # Test that libc builds with the `extra_traits` feature if [ "${NO_STD}" != "1" ]; then - cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \ + cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --no-default-features --target "${TARGET}" \ --features extra_traits else RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --no-default-features \ + -Z build-std=core,alloc "$VERBOSE" --no-default-features \ --target "${TARGET}" --features extra_traits fi # Test the 'const-extern-fn' feature on nightly if [ "${RUST}" = "nightly" ]; then if [ "${NO_STD}" != "1" ]; then - cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \ + cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --no-default-features --target "${TARGET}" \ --features const-extern-fn else RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --no-default-features \ + -Z build-std=core,alloc "$VERBOSE" --no-default-features \ --target "${TARGET}" --features const-extern-fn fi fi # Also test that it builds with `extra_traits` and default features: if [ "$NO_STD" != "1" ]; then - cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}" \ + cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --target "${TARGET}" \ --features extra_traits else RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ - -Z build-std=core,alloc -vv --target "${TARGET}" \ + -Z build-std=core,alloc "$VERBOSE" --target "${TARGET}" \ --features extra_traits fi } @@ -147,8 +148,6 @@ x86_64-unknown-redox \ RUST_APPLE_TARGETS="\ aarch64-apple-ios \ -x86_64-apple-darwin \ -x86_64-apple-ios \ " RUST_NIGHTLY_APPLE_TARGETS="\ @@ -211,6 +210,8 @@ for TARGET in $TARGETS; do done # Targets which are not available via rustup and must be built with -Zbuild-std +# FIXME(hexagon): hexagon-unknown-linux-musl should be tested but currently has +# duplicate symbol errors from `compiler_builtins`. RUST_LINUX_NO_CORE_TARGETS="\ aarch64-pc-windows-msvc \ aarch64-unknown-freebsd \ @@ -223,7 +224,6 @@ armebv7r-none-eabihf \ armv7-wrs-vxworks-eabihf \ armv7r-none-eabi \ armv7r-none-eabihf \ -hexagon-unknown-linux-musl \ i586-pc-windows-msvc \ i686-pc-windows-msvc \ i686-unknown-haiku \ diff --git a/ci/docker/sparc64-unknown-linux-gnu/Dockerfile b/ci/docker/sparc64-unknown-linux-gnu/Dockerfile index 99ba40276a568..ff6810a7fac58 100644 --- a/ci/docker/sparc64-unknown-linux-gnu/Dockerfile +++ b/ci/docker/sparc64-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:23.10 +FROM ubuntu:22.04 RUN apt-get update && apt-get install -y --no-install-recommends \ curl ca-certificates \ diff --git a/ci/docker/wasm32-wasi/Dockerfile b/ci/docker/wasm32-wasi/Dockerfile deleted file mode 100644 index 80ae09f75038b..0000000000000 --- a/ci/docker/wasm32-wasi/Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -FROM ubuntu:23.10 - -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - ca-certificates \ - clang \ - curl \ - git \ - libc6-dev \ - make \ - xz-utils - -# Note that we're using `git reset --hard` to pin to a specific commit for -# verification for now. The sysroot is currently in somewhat of a state of flux -# and is expected to have breaking changes, so this is an attempt to mitigate -# those breaking changes on `libc`'s own CI -RUN git clone https://github.com/WebAssembly/wasi-libc && \ - cd wasi-libc && \ - git reset --hard ad5133410f66b93a2381db5b542aad5e0964db96 -RUN apt-get install -y --no-install-recommends llvm -RUN make -C wasi-libc install -j $(nproc) INSTALL_DIR=/wasi-libc - -RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/dev/wasmtime-dev-x86_64-linux.tar.xz | \ - tar xJf - -ENV PATH=$PATH:/wasmtime-dev-x86_64-linux -COPY docker/wasm32-wasi/clang.sh /wasi-libc/bin/clang - -RUN apt-get install -y --no-install-recommends lld -RUN ln -s /usr/bin/wasm-ld-10 /usr/bin/wasm-ld -ENV PATH=$PATH:/usr/lib/llvm-10/bin - -# Of note here is our clang wrapper which just executes a normal clang -# executable with the right sysroot, and then we're sure to turn off the -# crt-static feature to ensure that the CRT that we're specifying with `clang` -# is used. -ENV CARGO_TARGET_WASM32_WASI_RUNNER=wasmtime \ - CARGO_TARGET_WASM32_WASI_LINKER=/wasi-libc/bin/clang \ - CC_wasm32_wasi=/wasi-libc/bin/clang \ - PATH=$PATH:/rust/bin \ - RUSTFLAGS=-Ctarget-feature=-crt-static diff --git a/ci/docker/wasm32-wasi/clang.sh b/ci/docker/wasm32-wasi/clang.sh deleted file mode 100755 index 83f5da5ad6d81..0000000000000 --- a/ci/docker/wasm32-wasi/clang.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env sh -exec /usr/bin/clang --target=wasm32-wasi --sysroot /wasi-libc/sysroot "$@" diff --git a/ci/docker/wasm32-wasip1/Dockerfile b/ci/docker/wasm32-wasip1/Dockerfile new file mode 100644 index 0000000000000..e1318151d2e62 --- /dev/null +++ b/ci/docker/wasm32-wasip1/Dockerfile @@ -0,0 +1,16 @@ +FROM ubuntu:24.04 + +COPY wasi.sh / +RUN bash /wasi.sh + +# Note that `-D_WASI_EMULATED_PROCESS_CLOCKS` is used to enable access to +# clock-related defines even though they're emulated. Also note that the usage +# of `-Ctarget-feature=-crt-static` here forces usage of the external wasi-libc +# installed via `wasi-sdk` instead of the version that comes with the standard +# library. +ENV CARGO_TARGET_WASM32_WASIP1_RUNNER=wasmtime \ + CARGO_TARGET_WASM32_WASIP1_LINKER=/opt/wasi-sdk/bin/clang \ + CARGO_TARGET_WASM32_WASIP1_RUSTFLAGS="-lwasi-emulated-process-clocks -Ctarget-feature=-crt-static" \ + CC_wasm32_wasip1=/opt/wasi-sdk/bin/clang \ + CFLAGS_wasm32_wasip1=-D_WASI_EMULATED_PROCESS_CLOCKS \ + PATH=$PATH:/rust/bin:/wasmtime diff --git a/ci/docker/wasm32-wasip2/Dockerfile b/ci/docker/wasm32-wasip2/Dockerfile new file mode 100644 index 0000000000000..c433c491353f9 --- /dev/null +++ b/ci/docker/wasm32-wasip2/Dockerfile @@ -0,0 +1,15 @@ +FROM ubuntu:24.04 + +COPY wasi.sh / +RUN bash /wasi.sh + +# Note that most of these are copied from `wasm32-wasip1/Dockerfile` +# +# FIXME: the `-Clink-arg` to export `cabi_realloc` is a bug in the target +# itself, this should be fixed upstream. +ENV CARGO_TARGET_WASM32_WASIP2_RUNNER=wasmtime \ + CARGO_TARGET_WASM32_WASIP2_LINKER=/opt/wasi-sdk/bin/clang \ + CARGO_TARGET_WASM32_WASIP2_RUSTFLAGS="-lwasi-emulated-process-clocks -Ctarget-feature=-crt-static -Clink-arg=-Wl,--export,cabi_realloc" \ + CC_wasm32_wasip2=/opt/wasi-sdk/bin/clang \ + CFLAGS_wasm32_wasip2=-D_WASI_EMULATED_PROCESS_CLOCKS \ + PATH=$PATH:/rust/bin:/wasmtime diff --git a/ci/install-rust.sh b/ci/install-rust.sh index d7e2be8070dc0..d7a035af21689 100644 --- a/ci/install-rust.sh +++ b/ci/install-rust.sh @@ -13,12 +13,12 @@ fi if [ "$OS" = "windows" ]; then : "${TARGET?The TARGET environment variable must be set.}" rustup set profile minimal - rustup update --force $toolchain-"$TARGET" - rustup default $toolchain-"$TARGET" + rustup update --force "$toolchain-$TARGET" + rustup default "$toolchain-$TARGET" else rustup set profile minimal - rustup update --force $toolchain - rustup default $toolchain + rustup update --force "$toolchain" + rustup default "$toolchain" fi if [ -n "$TARGET" ]; then diff --git a/ci/switch.json b/ci/switch.json index bc1894879d7f7..c2df6610c5628 100644 --- a/ci/switch.json +++ b/ci/switch.json @@ -1,7 +1,5 @@ { - "family": "unix", "env": "newlib", - "target-env": "newlib", "target-family": "unix", "target-c-int-width": "32", "target-endian": "little", @@ -9,14 +7,6 @@ "os": "horizon", "arch": "aarch64", "panic-strategy": "unwind", - "abi-blacklist": [ - "stdcall", - "fastcall", - "vectorcall", - "thiscall", - "win64", - "sysv64" - ], "dynamic-linking" : false, "features": "+a53,+strict-align", "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", @@ -24,7 +14,7 @@ "position-independent-executables" : true, "linker-flavor": "gcc", "llvm-target": "aarch64-unknown-none", - "has-elf-tls" : false, + "has-thread-local": false, "linker-is-gnu" : true, "disable-redzone" : true, "relocation-model" : "pic", @@ -34,4 +24,4 @@ "trap-unreachable" : true, "emit-debug-gdb-scripts" : true, "requires-uwtable" : true -} \ No newline at end of file +} diff --git a/ci/wasi.sh b/ci/wasi.sh new file mode 100644 index 0000000000000..a06c1f45af11a --- /dev/null +++ b/ci/wasi.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -ex + +apt-get update +apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + clang \ + xz-utils + +# Wasmtime is used to execute tests and wasi-sdk is used to compile tests. +# Download appropriate versions here and configure various flags below. +# +# At the time of this writing wasmtime 24.0.0 is the latest release and +# wasi-sdk-24 is the latest release, that these numbers match is just +# coincidence. +wasmtime=24.0.0 +wasi_sdk=24 + +curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v$wasmtime/wasmtime-v$wasmtime-x86_64-linux.tar.xz | \ + tar xJf - +mv wasmtime-v$wasmtime-x86_64-linux wasmtime + +# The pre-built `*.deb` files for wasi-sdk install to `/opt/wasi-sdk` +curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$wasi_sdk/wasi-sdk-$wasi_sdk.0-x86_64-linux.deb +dpkg -i ./wasi-sdk-*.deb diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml index 20543d69bcb0f..df1bd04abd7d9 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "libc-test" version = "0.2.151" +edition = "2018" authors = ["The Rust Project Developers"] license = "MIT OR Apache-2.0" build = "build.rs" @@ -85,3 +86,8 @@ harness = true name = "semver" path = "test/semver.rs" harness = false + +[[test]] +name = "primitive_types" +path = "test/primitive_types.rs" +harness = true diff --git a/libc-test/build.rs b/libc-test/build.rs index 7cbbf13fff423..88b37451150be 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -67,12 +67,7 @@ fn do_ctest() { } fn ctest_cfg() -> ctest::TestGenerator { - let mut cfg = ctest::TestGenerator::new(); - let libc_cfgs = ["libc_thread_local"]; - for f in &libc_cfgs { - cfg.cfg(f, None); - } - cfg + ctest::TestGenerator::new() } fn do_semver() { @@ -87,8 +82,7 @@ fn do_semver() { let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap(); // `libc-test/semver` dir. - let mut semver_root = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); - semver_root.push("semver"); + let mut semver_root = PathBuf::from("semver"); // NOTE: Windows has the same `family` as `os`, no point in including it // twice. @@ -98,7 +92,10 @@ fn do_semver() { if family != os && os != "android" { process_semver_file(&mut output, &mut semver_root, &family); } - process_semver_file(&mut output, &mut semver_root, &vendor); + // We don't do semver for unknown targets. + if vendor != "unknown" { + process_semver_file(&mut output, &mut semver_root, &vendor); + } process_semver_file(&mut output, &mut semver_root, &os); let os_arch = format!("{}-{}", os, arch); process_semver_file(&mut output, &mut semver_root, &os_arch); @@ -146,6 +143,9 @@ fn process_semver_file>(output: &mut W, path: &mut Path } fn main() { + // Avoid unnecessary re-building. + println!("cargo:rerun-if-changed=build.rs"); + do_cc(); do_ctest(); do_semver(); @@ -202,14 +202,6 @@ fn test_apple(target: &str) { "libproc.h", "limits.h", "locale.h", - "mach-o/dyld.h", - "mach/mach_init.h", - "mach/mach.h", - "mach/mach_time.h", - "mach/mach_types.h", - "mach/mach_vm.h", - "mach/thread_act.h", - "mach/thread_policy.h", "malloc/malloc.h", "net/bpf.h", "net/dlil.h", @@ -226,8 +218,12 @@ fn test_apple(target: &str) { "netinet/ip.h", "netinet/tcp.h", "netinet/udp.h", + "netinet6/in6_var.h", + "os/clock.h", "os/lock.h", "os/signpost.h", + // FIXME: Requires the macOS 14.4 SDK. + //"os/os_sync_wait_on_address.h", "poll.h", "pthread.h", "pthread_spis.h", @@ -304,6 +300,10 @@ fn test_apple(target: &str) { // it is a moving target, changing through versions // also contains bitfields members "tcp_connection_info" => true, + // FIXME: The size is changed in recent macOSes. + "malloc_introspection_t" => true, + // sonoma changes the padding `rmx_filler` field. + "rt_metrics" => true, _ => false, } @@ -314,15 +314,14 @@ fn test_apple(target: &str) { return true; } match ty { + // FIXME: Requires the macOS 14.4 SDK. + "os_sync_wake_by_address_flags_t" | "os_sync_wait_on_address_flags_t" => true, + _ => false, } }); cfg.skip_const(move |name| { - // They're declared via `deprecated_mach` and we don't support it anymore. - if name.starts_with("VM_FLAGS_") { - return true; - } match name { // These OSX constants are removed in Sierra. // https://developer.apple.com/library/content/releasenotes/General/APIDiffsMacOS10_12/Swift/Darwin.html @@ -332,6 +331,13 @@ fn test_apple(target: &str) { // FIXME: XCode 13.1 doesn't have it. "TIOCREMOTE" => true, + + // FIXME: Requires the macOS 14.4 SDK. + "OS_SYNC_WAKE_BY_ADDRESS_NONE" + | "OS_SYNC_WAKE_BY_ADDRESS_SHARED" + | "OS_SYNC_WAIT_ON_ADDRESS_NONE" + | "OS_SYNC_WAIT_ON_ADDRESS_SHARED" => true, + _ => false, } }); @@ -339,9 +345,6 @@ fn test_apple(target: &str) { cfg.skip_fn(move |name| { // skip those that are manually verified match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" => true, - // close calls the close_nocancel system call "close" => true, @@ -357,6 +360,15 @@ fn test_apple(target: &str) { // FIXME: Once the SDK get updated to Ventura's level "freadlink" | "mknodat" | "mkfifoat" => true, + // FIXME: Requires the macOS 14.4 SDK. + "os_sync_wake_by_address_any" + | "os_sync_wake_by_address_all" + | "os_sync_wake_by_address_flags_t" + | "os_sync_wait_on_address" + | "os_sync_wait_on_address_flags_t" + | "os_sync_wait_on_address_with_deadline" + | "os_sync_wait_on_address_with_timeout" => true, + _ => false, } }); @@ -369,6 +381,7 @@ fn test_apple(target: &str) { // MAXPATHLEN is too big for auto-derive traits on arrays. ("vnode_info_path", "vip_path") => true, ("ifreq", "ifr_ifru") => true, + ("in6_ifreq", "ifr_ifru") => true, ("ifkpi", "ifk_data") => true, ("ifconf", "ifc_ifcu") => true, _ => false, @@ -533,38 +546,11 @@ fn test_openbsd(target: &str) { } }); - cfg.skip_const(move |name| { - match name { - // Removed in OpenBSD 6.0 - "KERN_USERMOUNT" | "KERN_ARND" => true, - // Removed in OpenBSD 7.2 - "KERN_NSELCOLL" => true, - // Good chance it's going to be wrong depending on the host release - "KERN_MAXID" | "NET_RT_MAXID" => true, - "EV_SYSFLAGS" => true, - _ => false, - } - }); - cfg.skip_fn(move |name| { match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" | "execvpe" => true, - - // Removed in OpenBSD 6.5 - // https://marc.info/?l=openbsd-cvs&m=154723400730318 - "mincore" => true, - // futex() has volatile arguments, but that doesn't exist in Rust. "futex" => true, - // Available for openBSD 7.3 - "mimmutable" => true, - - // Removed in OpenBSD 7.5 - // https://marc.info/?l=openbsd-cvs&m=170239504300386 - "syscall" => true, - _ => false, } }); @@ -728,14 +714,7 @@ fn test_windows(target: &str) { } }); - cfg.skip_fn(move |name| { - match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" | "execvpe" => true, - - _ => false, - } - }); + cfg.skip_fn(|_| false); cfg.generate("../src/lib.rs", "main.rs"); } @@ -1008,7 +987,7 @@ fn test_solarish(target: &str) { "cfmakeraw" | "cfsetspeed" => true, // const-ness issues - "execv" | "execve" | "execvp" | "settimeofday" | "sethostname" => true, + "settimeofday" | "sethostname" => true, // Solaris-different "getpwent_r" | "getgrent_r" | "updwtmpx" if is_illumos => true, @@ -1216,8 +1195,6 @@ fn test_netbsd(target: &str) { cfg.skip_fn(move |name| { match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" => true, // FIXME: netbsd 10 minimum "getentropy" | "getrandom" => true, @@ -1445,9 +1422,6 @@ fn test_dragonflybsd(target: &str) { cfg.skip_fn(move |name| { // skip those that are manually verified match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" | "fexecve" => true, - "getrlimit" | "getrlimit64" | // non-int in 1st arg "setrlimit" | "setrlimit64" | // non-int in 1st arg "prlimit" | "prlimit64" // non-int in 2nd arg @@ -1490,6 +1464,7 @@ fn test_wasi(target: &str) { "dirent.h", "errno.h", "fcntl.h", + "langinfo.h", "limits.h", "locale.h", "malloc.h", @@ -1501,6 +1476,7 @@ fn test_wasi(target: &str) { "stdio.h", "stdlib.h", "string.h", + "sys/ioctl.h", "sys/resource.h", "sys/select.h", "sys/socket.h", @@ -1509,16 +1485,20 @@ fn test_wasi(target: &str) { "sys/types.h", "sys/uio.h", "sys/utsname.h", - "sys/ioctl.h", "time.h", "unistd.h", "wasi/api.h", - "wasi/libc.h", "wasi/libc-find-relpath.h", "wasi/libc-nocwd.h", + "wasi/libc.h", "wchar.h", } + // Currently `ctest2` doesn't support macros-in-static-expressions and will + // panic on them. That affects `CLOCK_*` defines in wasi to set this here + // to omit them. + cfg.cfg("libc_ctest", None); + cfg.type_name(move |ty, is_struct, is_union| match ty { "FILE" | "fd_set" | "DIR" => ty.to_string(), t if is_union => format!("union {}", t), @@ -1537,20 +1517,27 @@ fn test_wasi(target: &str) { } }); - // Looks like LLD doesn't merge duplicate imports, so if the Rust - // code imports from a module and the C code also imports from a - // module we end up with two imports of function pointers which - // import the same thing but have different function pointers - cfg.skip_fn_ptrcheck(|f| f.starts_with("__wasi")); + // These have a different and internal type in header files and are only + // used here to generate a pointer to them in bindings so skip these tests. + cfg.skip_static(|c| c.starts_with("_CLOCK_")); + + cfg.skip_fn(|f| match f { + // This function doesn't actually exist in libc's header files + "__errno_location" => true, + + // The `timeout` argument to this function is `*const` in Rust but + // mutable in C which causes a mismatch. Avoiding breakage by changing + // this in wasi-libc and instead accepting that this is slightly + // different. + "select" => true, + + _ => false, + }); // d_name is declared as a flexible array in WASI libc, so it // doesn't support sizeof. cfg.skip_field(|s, field| s == "dirent" && field == "d_name"); - // Currently Rust/clang disagree on function argument ABI, so skip these - // tests. For more info see WebAssembly/tool-conventions#88 - cfg.skip_roundtrip(|_| true); - cfg.generate("../src/lib.rs", "main.rs"); } @@ -1603,6 +1590,7 @@ fn test_android(target: &str) { "sched.h", "semaphore.h", "signal.h", + "spawn.h", "stddef.h", "stdint.h", "stdio.h", @@ -1615,6 +1603,7 @@ fn test_android(target: &str) { "sys/fsuid.h", "sys/inotify.h", "sys/ioctl.h", + "sys/klog.h", "sys/mman.h", "sys/mount.h", "sys/personality.h", @@ -1688,6 +1677,8 @@ fn test_android(target: &str) { "linux/netfilter/nfnetlink_log.h", "linux/netfilter/nfnetlink_queue.h", "linux/netfilter/nf_tables.h", + "linux/netfilter_arp.h", + "linux/netfilter_bridge.h", "linux/netfilter_ipv4.h", "linux/netfilter_ipv6.h", "linux/netfilter_ipv6/ip6_tables.h", @@ -1760,6 +1751,10 @@ fn test_android(target: &str) { // FIXME: Somehow fails to test after removing cfg hacks: "__uint128" => true, + + // These are intended to be opaque + "posix_spawn_file_actions_t" => true, + "posix_spawnattr_t" => true, _ => false, } }); @@ -1942,8 +1937,8 @@ fn test_android(target: &str) { cfg.skip_fn(move |name| { // skip those that are manually verified match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true, + // FIXME: for unknown reasons linker unable to find "fexecve" + "fexecve" => true, // There are two versions of the sterror_r function, see // @@ -1965,7 +1960,7 @@ fn test_android(target: &str) { "__system_property_wait" => true, // Added in API level 30, but tests use level 28. - "mlock2" => true, + "memfd_create" | "mlock2" | "renameat2" | "statx" | "statx_timestamp" => true, // Added in glibc 2.25. "getentropy" => true, @@ -1981,6 +1976,9 @@ fn test_android(target: &str) { // Added in API level 28, but some tests use level 24. "fread_unlocked" | "fwrite_unlocked" | "fgets_unlocked" | "fflush_unlocked" => true, + // Added in API level 28, but some tests use level 24. + "aligned_alloc" => true, + // FIXME: bad function pointers: "isalnum" | "isalpha" | "iscntrl" | "isdigit" | "isgraph" | "islower" | "isprint" | "ispunct" | "isspace" | "isupper" | "isxdigit" | "isblank" | "tolower" @@ -2270,6 +2268,12 @@ fn test_freebsd(target: &str) { // should've been used anywhere anyway. "TDF_UNUSED23" => true, + // Removed in FreeBSD 15 + "TDF_CANSWAP" | "TDF_SWAPINREQ" => true, + + // Unaccessible in FreeBSD 15 + "TDI_SWAPPED" | "P_SWAPPINGOUT" | "P_SWAPPINGIN" => true, + // Removed in FreeBSD 14 (git a6b55ee6be1) "IFF_KNOWSEPOCH" => true, @@ -2332,7 +2336,7 @@ fn test_freebsd(target: &str) { true } - // Added in in FreeBSD 13.0 (r367776 and r367287) + // Added in FreeBSD 13.0 (r367776 and r367287) "SCM_CREDS2" | "LOCAL_CREDS_PERSISTENT" if Some(13) > freebsd_ver => true, // Added in FreeBSD 14 @@ -2463,6 +2467,19 @@ fn test_freebsd(target: &str) { true } + // Added in FreeBSD 14.1 + "KCMP_FILE" | "KCMP_FILEOBJ" | "KCMP_FILES" | "KCMP_SIGHAND" | "KCMP_VM" + if Some(14) > freebsd_ver => + { + true + } + + // FIXME: Removed in FreeBSD 15: + "LOCAL_CONNWAIT" => true, + + // FIXME: The values has been changed in FreeBSD 15: + "CLOCK_BOOTTIME" if Some(15) <= freebsd_ver => true, + _ => false, } }); @@ -2511,6 +2528,9 @@ fn test_freebsd(target: &str) { | "sctp_send_failed_event" | "sctp_stream_reset_event" => true, + // FIXME: Changed in FreeBSD 15 + "tcp_info" | "sockstat" if Some(15) >= freebsd_ver => true, + _ => false, } }); @@ -2518,9 +2538,8 @@ fn test_freebsd(target: &str) { cfg.skip_fn(move |name| { // skip those that are manually verified match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true, - + // This is introduced in FreeBSD 14.1 + "execvpe" => true, // The `uname` function in the `utsname.h` FreeBSD header is a C // inline function (has no symbol) that calls the `__xuname` symbol. // Therefore the function pointer comparison does not make sense for it. @@ -2570,6 +2589,9 @@ fn test_freebsd(target: &str) { true } + // Those are introduced in FreeBSD 14.1. + "kcmp" => true, + _ => false, } }); @@ -3120,9 +3142,6 @@ fn test_neutrino(target: &str) { cfg.skip_fn(move |name| { // skip those that are manually verified match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" | "execvpe" => true, - // wrong signature "signal" => true, @@ -3316,6 +3335,7 @@ fn test_linux(target: &str) { let gnueabihf = target.contains("gnueabihf"); let x86_64_gnux32 = target.contains("gnux32") && x86_64; let riscv64 = target.contains("riscv64"); + let loongarch64 = target.contains("loongarch64"); let uclibc = target.contains("uclibc"); let mut cfg = ctest_cfg(); @@ -3375,6 +3395,7 @@ fn test_linux(target: &str) { "sys/eventfd.h", "sys/file.h", "sys/fsuid.h", + "sys/klog.h", "sys/inotify.h", "sys/ioctl.h", "sys/ipc.h", @@ -3437,6 +3458,7 @@ fn test_linux(target: &str) { // Include linux headers at the end: headers! { cfg: + [loongarch64 || riscv64]: "asm/hwcap.h", "asm/mman.h", [gnu]: "linux/aio_abi.h", "linux/can.h", @@ -3474,6 +3496,8 @@ fn test_linux(target: &str) { "linux/netfilter/nfnetlink_log.h", "linux/netfilter/nfnetlink_queue.h", "linux/netfilter/nf_tables.h", + "linux/netfilter_arp.h", + "linux/netfilter_bridge.h", "linux/netfilter_ipv4.h", "linux/netfilter_ipv6.h", "linux/netfilter_ipv6/ip6_tables.h", @@ -3561,6 +3585,14 @@ fn test_linux(target: &str) { }); cfg.skip_type(move |ty| { + // FIXME: very recent additions to musl, not yet released. + // also apparently some glibc versions + if ty == "Elf32_Relr" || ty == "Elf64_Relr" { + return true; + } + if sparc64 && (ty == "Elf32_Rela" || ty == "Elf64_Rela") { + return true; + } match ty { // FIXME: `sighandler_t` type is incorrect, see: // https://github.com/rust-lang/libc/issues/1359 @@ -3829,6 +3861,10 @@ fn test_linux(target: &str) { if name.starts_with("NI_IDN") { return true; } + // FIXME: Requires >= 6.3 kernel headers + if name == "MFD_NOEXEC_SEAL" || name == "MFD_EXEC" { + return true; + } } match name { // These constants are not available if gnu headers have been included @@ -3909,6 +3945,9 @@ fn test_linux(target: &str) { | "SW_CNT" if ppc64 || riscv64 => true, + // FIXME: requires more recent kernel headers on CI + "SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV" if sparc64 => true, + // FIXME: Not currently available in headers on ARM and musl. "NETLINK_GET_STRICT_CHK" if arm || musl => true, @@ -3979,9 +4018,15 @@ fn test_linux(target: &str) { | "MINSIGSTKSZ" if gnu => true, - // FIXME: Linux >= 5.16 changed its value: + // FIXME: Linux >= 5.10: + // https://github.com/torvalds/linux/commit/d25e2e9388eda61b6e298585024ee3355f50c493 + "NF_INET_INGRESS" if musl => true, + + // FIXME: Linux >= 5.16: // https://github.com/torvalds/linux/commit/42df6e1d221dddc0f2acf2be37e68d553ad65f96 - "NF_NETDEV_NUMHOOKS" => true, + "NF_NETDEV_EGRESS" if musl || sparc64 => true, + // value changed + "NF_NETDEV_NUMHOOKS" if musl || sparc64 => true, // FIXME: requires Linux >= 5.6: | "RESOLVE_BENEATH" @@ -4030,6 +4075,9 @@ fn test_linux(target: &str) { if musl => true, "CLONE_CLEAR_SIGHAND" | "CLONE_INTO_CGROUP" => true, + // FIXME: Requires >= 6.3 kernel headers + "MFD_EXEC" | "MFD_NOEXEC_SEAL" if sparc64 => true, + // kernel 6.1 minimum "MADV_COLLAPSE" => true, @@ -4145,6 +4193,12 @@ fn test_linux(target: &str) { true } + // FIXME: Requires >= 6.6 kernel headers. + "SYS_fchmodat2" => true, + + // FIXME: Requires >= 6.10 kernel headers. + "SYS_mseal" => true, + // FIXME: seems to not be available all the time (from : "PF_VCPU" | "PF_IDLE" @@ -4187,9 +4241,6 @@ fn test_linux(target: &str) { cfg.skip_fn(move |name| { // skip those that are manually verified match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true, - // There are two versions of the sterror_r function, see // // https://linux.die.net/man/3/strerror_r @@ -4289,6 +4340,9 @@ fn test_linux(target: &str) { // FIXME: function pointers changed since Ubuntu 23.10 "strtol" | "strtoll" | "strtoul" | "strtoull" | "fscanf" | "scanf" | "sscanf" => true, + // Added in musl 1.2.5 + "preadv2" | "pwritev2" if musl => true, + _ => false, } }); @@ -4367,7 +4421,11 @@ fn test_linux(target: &str) { // 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) + (struct_ == "user_regs" && arm) || + // the `ifr_ifrn` field is an anonymous union + (struct_ == "iwreq" && field == "ifr_ifrn") || + // the `key` field is a zero-sized array + (struct_ == "iw_encode_ext" && field == "key") }); cfg.skip_roundtrip(move |s| match s { @@ -4776,8 +4834,6 @@ fn test_haiku(target: &str) { cfg.skip_fn(move |name| { // skip those that are manually verified match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" | "execvpe" => true, // FIXME: does not exist on haiku "open_wmemstream" => true, "mlockall" | "munlockall" => true, diff --git a/libc-test/semver/TODO-linux.txt b/libc-test/semver/TODO-linux.txt index 7855498efafcf..8427cf1ea12c8 100644 --- a/libc-test/semver/TODO-linux.txt +++ b/libc-test/semver/TODO-linux.txt @@ -1,4 +1,4 @@ -# The following symbols are not not available in some combinations of +# The following symbols are not available in some combinations of # musl/gnu/android and/or architecture. KEYCTL_CAPABILITIES KEYCTL_CAPS0_BIG_KEY diff --git a/libc-test/semver/android-aarch64.txt b/libc-test/semver/android-aarch64.txt index 9b4cc355e3f9e..4dfedef857928 100644 --- a/libc-test/semver/android-aarch64.txt +++ b/libc-test/semver/android-aarch64.txt @@ -1,3 +1,5 @@ +AT_SYSINFO_EHDR +AT_VECTOR_SIZE_ARCH HWCAP2_DCPODP HWCAP2_FLAGM2 HWCAP2_FRINT @@ -10,6 +12,9 @@ HWCAP2_SVESM4 PROT_BTI PROT_MTE SYS_arch_specific_syscall +SYS_lseek +SYS_memfd_secret +SYS_mmap SYS_syscalls SYS_fcntl __system_property_wait diff --git a/libc-test/semver/android-arm.txt b/libc-test/semver/android-arm.txt index fe1ce5bba1c5d..15578095c5c5f 100644 --- a/libc-test/semver/android-arm.txt +++ b/libc-test/semver/android-arm.txt @@ -1,3 +1,4 @@ +AT_SYSINFO_EHDR NGREG PTRACE_GETFPREGS PTRACE_GETREGS diff --git a/libc-test/semver/android-i686.txt b/libc-test/semver/android-i686.txt index eb6ecadba60b5..5ffb45ebc32c6 100644 --- a/libc-test/semver/android-i686.txt +++ b/libc-test/semver/android-i686.txt @@ -1,3 +1,7 @@ +AT_SYSINFO +AT_SYSINFO_EHDR +AT_VECTOR_SIZE_ARCH +SYS_memfd_secret __c_anonymous_uc_sigmask __c_anonymous_uc_sigmask_with_padding time64_t diff --git a/libc-test/semver/android-riscv64.txt b/libc-test/semver/android-riscv64.txt new file mode 100644 index 0000000000000..723278a289464 --- /dev/null +++ b/libc-test/semver/android-riscv64.txt @@ -0,0 +1,90 @@ +AT_SYSINFO_EHDR +AT_VECTOR_SIZE_ARCH +HWCAP2_AFP +HWCAP2_BF16 +HWCAP2_BTI +HWCAP2_DCPODP +HWCAP2_DGH +HWCAP2_EBF16 +HWCAP2_ECV +HWCAP2_FLAGM2 +HWCAP2_FRINT +HWCAP2_I8MM +HWCAP2_MTE +HWCAP2_MTE3 +HWCAP2_RNG +HWCAP2_RPRES +HWCAP2_SME +HWCAP2_SME_B16F32 +HWCAP2_SME_F16F32 +HWCAP2_SME_F32F32 +HWCAP2_SME_F64F64 +HWCAP2_SME_FA64 +HWCAP2_SME_I16I64 +HWCAP2_SME_I8I32 +HWCAP2_SVE2 +HWCAP2_SVEAES +HWCAP2_SVEBF16 +HWCAP2_SVEBITPERM +HWCAP2_SVEF32MM +HWCAP2_SVEF64MM +HWCAP2_SVEI8MM +HWCAP2_SVEPMULL +HWCAP2_SVESHA3 +HWCAP2_SVESM4 +HWCAP2_SVE_EBF16 +HWCAP2_WFXT +HWCAP_AES +HWCAP_ASIMD +HWCAP_ASIMDDP +HWCAP_ASIMDFHM +HWCAP_ASIMDHP +HWCAP_ASIMDRDM +HWCAP_ATOMICS +HWCAP_CPUID +HWCAP_CRC32 +HWCAP_DCPOP +HWCAP_DIT +HWCAP_EVTSTRM +HWCAP_FCMA +HWCAP_FLAGM +HWCAP_FP +HWCAP_FPHP +HWCAP_ILRCPC +HWCAP_JSCVT +HWCAP_LRCPC +HWCAP_PACA +HWCAP_PACG +HWCAP_PMULL +HWCAP_SB +HWCAP_SHA1 +HWCAP_SHA2 +HWCAP_SHA3 +HWCAP_SHA512 +HWCAP_SM3 +HWCAP_SM4 +HWCAP_SSBS +HWCAP_SVE +HWCAP_USCAT +PROT_BTI +PROT_MTE +SYS_accept +SYS_arch_specific_syscall +SYS_fcntl +SYS_getrlimit +SYS_memfd_secret +SYS_migrate_pages +SYS_msgctl +SYS_msgget +SYS_msgrcv +SYS_msgsnd +SYS_semctl +SYS_semget +SYS_semop +SYS_semtimedop +SYS_shmat +SYS_shmctl +SYS_shmdt +SYS_shmget +SYS_sync_file_range +SYS_syscalls diff --git a/libc-test/semver/android-x86_64.txt b/libc-test/semver/android-x86_64.txt index c4bb87bccb66d..80471e37403fc 100644 --- a/libc-test/semver/android-x86_64.txt +++ b/libc-test/semver/android-x86_64.txt @@ -1,3 +1,5 @@ +AT_SYSINFO_EHDR +AT_VECTOR_SIZE_ARCH EFLAGS FS_BASE GS_BASE @@ -44,6 +46,7 @@ SYS_arch_prctl SYS_epoll_ctl_old SYS_epoll_wait_old SYS_kexec_file_load +SYS_memfd_secret SYS_msgctl SYS_msgget SYS_msgrcv diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index f0e4358d37c62..df205a82497c1 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -136,13 +136,39 @@ ATF_NETMASK ATF_PERM ATF_PUBL ATF_USETRAILERS +AT_BASE +AT_BASE_PLATFORM +AT_CLKTCK +AT_EGID AT_EMPTY_PATH +AT_ENTRY +AT_EUID +AT_EXECFD +AT_EXECFN AT_FDCWD +AT_FLAGS +AT_GID +AT_HWCAP +AT_HWCAP2 +AT_IGNORE +AT_MINSIGSTKSZ +AT_NOTELF AT_NO_AUTOMOUNT +AT_NULL +AT_PAGESZ +AT_PHDR +AT_PHENT +AT_PHNUM +AT_PLATFORM +AT_RANDOM AT_RECURSIVE AT_REMOVEDIR +AT_RSEQ_ALIGN +AT_RSEQ_FEATURE_SIZE +AT_SECURE AT_SYMLINK_FOLLOW AT_SYMLINK_NOFOLLOW +AT_UID B0 B1000000 B110 @@ -627,6 +653,7 @@ FUTEX_CMP_REQUEUE FUTEX_CMP_REQUEUE_PI FUTEX_FD FUTEX_LOCK_PI +FUTEX_LOCK_PI2 FUTEX_PRIVATE_FLAG FUTEX_REQUEUE FUTEX_TRYLOCK_PI @@ -1072,6 +1099,17 @@ KEXEC_ON_CRASH KEXEC_PRESERVE_CONTEXT KEY_CNT KEY_MAX +KLOG_CLOSE +KLOG_OPEN +KLOG_READ +KLOG_READ_ALL +KLOG_READ_CLEAR +KLOG_CLEAR +KLOG_CONSOLE_OFF +KLOG_CONSOLE_ON +KLOG_CONSOLE_LEVEL +KLOG_SIZE_UNREAD +KLOG_SIZE_BUFFER LC_ADDRESS LC_ADDRESS_MASK LC_ALL @@ -1214,7 +1252,9 @@ MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ MFD_ALLOW_SEALING MFD_CLOEXEC +MFD_EXEC MFD_HUGETLB +MFD_NOEXEC_SEAL MINIX2_SUPER_MAGIC MINIX2_SUPER_MAGIC2 MINIX_SUPER_MAGIC @@ -1463,11 +1503,16 @@ NFT_CMP_LT NFT_CMP_LTE NFT_CMP_NEQ NFT_CONTINUE +NFT_CT_AVGPKT NFT_CT_BYTES NFT_CT_DIRECTION NFT_CT_DST +NFT_CT_DST_IP +NFT_CT_DST_IP6 +NFT_CT_EVENTMASK NFT_CT_EXPIRATION NFT_CT_HELPER +NFT_CT_ID NFT_CT_L3PROTOCOL NFT_CT_LABELS NFT_CT_MARK @@ -1477,8 +1522,11 @@ NFT_CT_PROTO_DST NFT_CT_PROTO_SRC NFT_CT_SECMARK NFT_CT_SRC +NFT_CT_SRC_IP +NFT_CT_SRC_IP6 NFT_CT_STATE NFT_CT_STATUS +NFT_CT_ZONE NFT_DATA_RESERVED_MASK NFT_DATA_VALUE NFT_DATA_VALUE_MAXLEN @@ -1644,8 +1692,29 @@ NFULNL_COPY_PACKET NFULNL_MSG_CONFIG NFULNL_MSG_PACKET NF_ACCEPT +NF_ARP +NF_ARP_FORWARD +NF_ARP_IN +NF_ARP_NUMHOOKS +NF_ARP_OUT +NF_BR_BROUTING +NF_BR_FORWARD +NF_BR_LOCAL_IN +NF_BR_LOCAL_OUT +NF_BR_NUMHOOKS +NF_BR_POST_ROUTING +NF_BR_PRE_ROUTING +NF_BR_PRI_BRNF +NF_BR_PRI_FILTER_BRIDGED +NF_BR_PRI_FILTER_OTHER +NF_BR_PRI_FIRST +NF_BR_PRI_LAST +NF_BR_PRI_NAT_DST_BRIDGED +NF_BR_PRI_NAT_DST_OTHER +NF_BR_PRI_NAT_SRC NF_DROP NF_INET_FORWARD +NF_INET_INGRESS NF_INET_LOCAL_IN NF_INET_LOCAL_OUT NF_INET_NUMHOOKS @@ -1667,6 +1736,7 @@ NF_IP6_PRI_MANGLE NF_IP6_PRI_NAT_DST NF_IP6_PRI_NAT_SRC NF_IP6_PRI_RAW +NF_IP6_PRI_RAW_BEFORE_DEFRAG NF_IP6_PRI_SECURITY NF_IP6_PRI_SELINUX_FIRST NF_IP6_PRI_SELINUX_LAST @@ -1687,10 +1757,12 @@ NF_IP_PRI_MANGLE NF_IP_PRI_NAT_DST NF_IP_PRI_NAT_SRC NF_IP_PRI_RAW +NF_IP_PRI_RAW_BEFORE_DEFRAG NF_IP_PRI_SECURITY NF_IP_PRI_SELINUX_FIRST NF_IP_PRI_SELINUX_LAST NF_MAX_VERDICT +NF_NETDEV_EGRESS NF_NETDEV_INGRESS NF_NETDEV_NUMHOOKS NF_QUEUE @@ -1879,6 +1951,7 @@ PROT_GROWSUP PROT_NONE PROT_READ PROT_WRITE +PTHREAD_BARRIER_SERIAL_THREAD PTHREAD_COND_INITIALIZER PTHREAD_CREATE_DETACHED PTHREAD_CREATE_JOINABLE @@ -2029,6 +2102,7 @@ RTLD_LAZY RTLD_LOCAL RTLD_NOLOAD RTLD_NOW +RTLD_NODELETE TCA_UNSPEC TCA_KIND TCA_OPTIONS @@ -2449,7 +2523,9 @@ SYS_clock_gettime SYS_clock_nanosleep SYS_clock_settime SYS_clone +SYS_clone3 SYS_close +SYS_close_range SYS_connect SYS_copy_file_range SYS_delete_module @@ -2458,12 +2534,14 @@ SYS_dup3 SYS_epoll_create1 SYS_epoll_ctl SYS_epoll_pwait +SYS_epoll_pwait2 SYS_eventfd2 SYS_execve SYS_execveat SYS_exit SYS_exit_group SYS_faccessat +SYS_faccessat2 SYS_fallocate SYS_fanotify_init SYS_fanotify_mark @@ -2485,6 +2563,7 @@ SYS_fsopen SYS_fspick SYS_fsync SYS_futex +SYS_futex_waitv SYS_get_mempolicy SYS_get_robust_list SYS_getcpu @@ -2530,6 +2609,9 @@ SYS_kcmp SYS_kexec_load SYS_keyctl SYS_kill +SYS_landlock_add_rule +SYS_landlock_create_ruleset +SYS_landlock_restrict_self SYS_lgetxattr SYS_linkat SYS_listen @@ -2549,6 +2631,7 @@ SYS_mlock SYS_mlock2 SYS_mlockall SYS_mount +SYS_mount_setattr SYS_move_mount SYS_move_pages SYS_mprotect @@ -2569,8 +2652,11 @@ SYS_nfsservctl SYS_open_by_handle_at SYS_open_tree SYS_openat +SYS_openat2 SYS_perf_event_open SYS_personality +SYS_pidfd_getfd +SYS_pidfd_open SYS_pidfd_send_signal SYS_pipe2 SYS_pivot_root @@ -2583,6 +2669,8 @@ SYS_pread64 SYS_preadv SYS_preadv2 SYS_prlimit64 +SYS_process_madvise +SYS_process_mrelease SYS_process_vm_readv SYS_process_vm_writev SYS_pselect6 @@ -2591,6 +2679,7 @@ SYS_pwrite64 SYS_pwritev SYS_pwritev2 SYS_quotactl +SYS_quotactl_fd SYS_read SYS_readahead SYS_readlinkat @@ -2630,6 +2719,7 @@ SYS_sendmmsg SYS_sendmsg SYS_sendto SYS_set_mempolicy +SYS_set_mempolicy_home_node SYS_set_robust_list SYS_set_tid_address SYS_setdomainname @@ -2918,6 +3008,21 @@ _SC_HOST_NAME_MAX _SC_IOV_MAX _SC_IPV6 _SC_JOB_CONTROL +_SC_LEVEL1_DCACHE_ASSOC +_SC_LEVEL1_DCACHE_LINESIZE +_SC_LEVEL1_DCACHE_SIZE +_SC_LEVEL1_ICACHE_ASSOC +_SC_LEVEL1_ICACHE_LINESIZE +_SC_LEVEL1_ICACHE_SIZE +_SC_LEVEL2_CACHE_ASSOC +_SC_LEVEL2_CACHE_LINESIZE +_SC_LEVEL2_CACHE_SIZE +_SC_LEVEL3_CACHE_ASSOC +_SC_LEVEL3_CACHE_LINESIZE +_SC_LEVEL3_CACHE_SIZE +_SC_LEVEL4_CACHE_ASSOC +_SC_LEVEL4_CACHE_LINESIZE +_SC_LEVEL4_CACHE_SIZE _SC_LINE_MAX _SC_LOGIN_NAME_MAX _SC_MAPPED_FILES @@ -2988,6 +3093,7 @@ _SC_TRACE_USER_EVENT_MAX _SC_TTY_NAME_MAX _SC_TYPED_MEMORY_OBJECTS _SC_TZNAME_MAX +_SC_UIO_MAXIOV _SC_V7_ILP32_OFF32 _SC_V7_ILP32_OFFBIG _SC_V7_LP64_OFF64 @@ -3320,6 +3426,7 @@ itimerval key_t kill killpg +klogctl lastlog lchown lconv @@ -3354,6 +3461,7 @@ memalign memchr memcmp memcpy +memfd_create memmem memmove memrchr @@ -3369,6 +3477,7 @@ mknodat mkstemp mktime mlock +mlock2 mlockall mmap mmap64 @@ -3558,6 +3667,7 @@ remove removexattr rename renameat +renameat2 res_init rewind rewinddir @@ -3682,6 +3792,8 @@ statfs statfs64 statvfs statvfs64 +statx +statx_timestamp strcasecmp strcasestr strcat @@ -3793,7 +3905,6 @@ utimes utmp utmpname utsname -vfork vmsplice wait wait4 diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index e33b84e746769..832182dd117b3 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -256,10 +256,10 @@ COPYFILE_STATE_SRC_FD COPYFILE_STATE_SRC_FILENAME COPYFILE_STATE_STATUS_CB COPYFILE_STATE_STATUS_CTX -COPYFILE_STATE_XATTRNAME COPYFILE_STATE_WAS_CLONED -COPYFILE_VERBOSE +COPYFILE_STATE_XATTRNAME COPYFILE_UNLINK +COPYFILE_VERBOSE COPYFILE_XATTR CR0 CR1 @@ -428,6 +428,7 @@ FSOPT_REPORT_FULLSIZE FSOPT_RETURN_REALDEV F_ALLOCATEALL F_ALLOCATECONTIG +F_ALLOCATEPERSIST F_BARRIERFSYNC F_FREEZE_FS F_FULLFSYNC @@ -440,6 +441,9 @@ F_LOG2PHYS F_LOG2PHYS_EXT F_NOCACHE F_NODIRECT +F_OFD_GETLK +F_OFD_SETLK +F_OFD_SETLKW F_PEOFPOSMODE F_PREALLOCATE F_PUNCHHOLE @@ -1000,6 +1004,8 @@ NOTE_FORK NOTE_LEEWAY NOTE_LINK NOTE_LOWAT +NOTE_MACHTIME +NOTE_MACH_CONTINUOUS_TIME NOTE_NONE NOTE_NSECONDS NOTE_PCTRLMASK @@ -1022,6 +1028,7 @@ OFDEL OFILL OLD_TIME ONOEOT +OS_CLOCK_MACH_ABSOLUTE_TIME OS_LOG_TYPE_DEBUG OS_LOG_TYPE_DEFAULT OS_LOG_TYPE_ERROR @@ -1030,16 +1037,22 @@ OS_LOG_TYPE_INFO OS_SIGNPOST_EVENT OS_SIGNPOST_INTERVAL_BEGIN OS_SIGNPOST_INTERVAL_END +OS_SYNC_WAKE_BY_ADDRESS_NONE +OS_SYNC_WAKE_BY_ADDRESS_SHARED +OS_SYNC_WAIT_ON_ADDRESS_NONE +OS_SYNC_WAIT_ON_ADDRESS_SHARED OS_UNFAIR_LOCK_INIT OXTABS O_ASYNC O_DSYNC O_EVTONLY +O_EXEC O_EXLOCK O_FSYNC O_NDELAY O_NOCTTY O_NOFOLLOW_ANY +O_SEARCH O_SHLOCK O_SYMLINK O_SYNC @@ -1353,9 +1366,6 @@ STA_RONLY STA_UNSYNC ST_NOSUID ST_RDONLY -SUPERPAGE_NONE -SUPERPAGE_SIZE_2MB -SUPERPAGE_SIZE_ANY SYSPROTO_CONTROL SYSPROTO_EVENT S_IEXEC @@ -1516,95 +1526,10 @@ UTUN_OPT_IFNAME VDISCARD VDSUSP VLNEXT -VM_FLAGS_ALIAS_MASK -VM_FLAGS_ANYWHERE -VM_FLAGS_FIXED -VM_FLAGS_NO_CACHE -VM_FLAGS_OVERWRITE -VM_FLAGS_PURGABLE -VM_FLAGS_RANDOM_ADDR -VM_FLAGS_RESILIENT_CODESIGN -VM_FLAGS_RESILIENT_MEDIA -VM_FLAGS_RETURN_4K_DATA_ADDR -VM_FLAGS_RETURN_DATA_ADDR -VM_FLAGS_SUPERPAGE_MASK -VM_FLAGS_SUPERPAGE_NONE -VM_FLAGS_SUPERPAGE_SHIFT -VM_FLAGS_SUPERPAGE_SIZE_2MB -VM_FLAGS_SUPERPAGE_SIZE_ANY -VM_FLAGS_USER_ALLOCATE -VM_FLAGS_USER_MAP -VM_FLAGS_USER_REMAP VM_LOADAVG VM_MACHFACTOR VM_MAKE_TAG VM_MAXID -VM_MEMORY_ACCELERATE -VM_MEMORY_ANALYSIS_TOOL -VM_MEMORY_APPKIT -VM_MEMORY_APPLICATION_SPECIFIC_1 -VM_MEMORY_APPLICATION_SPECIFIC_16 -VM_MEMORY_ASL -VM_MEMORY_ASSETSD -VM_MEMORY_ATS -VM_MEMORY_CARBON -VM_MEMORY_CGIMAGE -VM_MEMORY_COREDATA -VM_MEMORY_COREDATA_OBJECTIDS -VM_MEMORY_COREGRAPHICS -VM_MEMORY_COREGRAPHICS_BACKINGSTORES -VM_MEMORY_COREGRAPHICS_DATA -VM_MEMORY_COREGRAPHICS_FRAMEBUFFERS -VM_MEMORY_COREGRAPHICS_MISC -VM_MEMORY_COREGRAPHICS_SHARED -VM_MEMORY_COREGRAPHICS_XALLOC -VM_MEMORY_COREIMAGE -VM_MEMORY_COREPROFILE -VM_MEMORY_CORESERVICES -VM_MEMORY_COREUI -VM_MEMORY_COREUIFILE -VM_MEMORY_CORPSEINFO -VM_MEMORY_DHMM -VM_MEMORY_DYLD -VM_MEMORY_DYLD_MALLOC -VM_MEMORY_DYLIB -VM_MEMORY_FOUNDATION -VM_MEMORY_GENEALOGY -VM_MEMORY_GLSL -VM_MEMORY_GUARD -VM_MEMORY_IMAGEIO -VM_MEMORY_IOKIT -VM_MEMORY_JAVA -VM_MEMORY_JAVASCRIPT_CORE -VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR -VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE -VM_MEMORY_LAYERKIT -VM_MEMORY_LIBDISPATCH -VM_MEMORY_MACH_MSG -VM_MEMORY_MALLOC -VM_MEMORY_MALLOC_HUGE -VM_MEMORY_MALLOC_LARGE -VM_MEMORY_MALLOC_LARGE_REUSABLE -VM_MEMORY_MALLOC_LARGE_REUSED -VM_MEMORY_MALLOC_NANO -VM_MEMORY_MALLOC_SMALL -VM_MEMORY_MALLOC_TINY -VM_MEMORY_OBJC_DISPATCHERS -VM_MEMORY_OPENCL -VM_MEMORY_OS_ALLOC_ONCE -VM_MEMORY_RAWCAMERA -VM_MEMORY_REALLOC -VM_MEMORY_SBRK -VM_MEMORY_SCENEKIT -VM_MEMORY_SHARED_PMAP -VM_MEMORY_SKYWALK -VM_MEMORY_SQLITE -VM_MEMORY_STACK -VM_MEMORY_SWIFT_METADATA -VM_MEMORY_SWIFT_RUNTIME -VM_MEMORY_TCMALLOC -VM_MEMORY_UNSHARED_PMAP -VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS VM_METER VM_PROT_EXECUTE VM_PROT_NONE @@ -1684,8 +1609,10 @@ _CS_PATH _IOFBF _IOLBF _IONBF +_NSGetArgc +_NSGetArgv _NSGetEnviron -_NSGetExecutablePath +_NSGetProgname _POSIX_VDISABLE _PTHREAD_COND_SIG_init _PTHREAD_MUTEX_SIG_init @@ -1820,10 +1747,6 @@ __PTHREAD_RWLOCKATTR_SIZE__ __PTHREAD_RWLOCK_SIZE__ __darwin_mcontext64 __error -_dyld_get_image_header -_dyld_get_image_name -_dyld_get_image_vmaddr_slide -_dyld_image_count abs acct aio_cancel @@ -1951,6 +1874,7 @@ getxattr glob glob_t globfree +icmp6_ifstat iconv_t id_t idtype_t @@ -1964,6 +1888,9 @@ ifkpi ifreq image_offset in6_pktinfo +in6_addrlifetime +in6_ifreq +in6_ifstat in_pktinfo initgroups integer_t @@ -1985,18 +1912,6 @@ lockf log2phys login_tty lutimes -mach_absolute_time -mach_header -mach_header_64 -mach_host_self -mach_port_t -mach_thread_self -mach_timebase_info -mach_timebase_info_data_t -mach_vm_address_t -mach_vm_map -mach_vm_offset_t -mach_vm_size_t madvise malloc_default_zone malloc_good_size @@ -2043,6 +1958,7 @@ open_memstream open_wmemstream openat openpty +os_clockid_t os_log_create os_log_t os_log_type_enabled @@ -2052,6 +1968,13 @@ os_signpost_id_generate os_signpost_id_make_with_pointer os_signpost_id_t os_signpost_type_t +os_sync_wake_by_address_any +os_sync_wake_by_address_all +os_sync_wake_by_address_flags_t +os_sync_wait_on_address +os_sync_wait_on_address_flags_t +os_sync_wait_on_address_with_deadline +os_sync_wait_on_address_with_timeout os_unfair_lock os_unfair_lock_assert_not_owner os_unfair_lock_assert_owner @@ -2074,6 +1997,7 @@ posix_spawn_file_actions_t posix_spawnattr_destroy posix_spawnattr_get_qos_class_np posix_spawnattr_getarchpref_np +posix_spawnattr_getbinpref_np posix_spawnattr_getflags posix_spawnattr_getpgroup posix_spawnattr_getsigdefault @@ -2081,12 +2005,11 @@ posix_spawnattr_getsigmask posix_spawnattr_init posix_spawnattr_set_qos_class_np posix_spawnattr_setarchpref_np +posix_spawnattr_setbinpref_np 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 @@ -2121,8 +2044,6 @@ pthread_cancel pthread_condattr_getpshared pthread_condattr_setpshared pthread_cpu_number_np -pthread_create_from_mach_thread -pthread_from_mach_thread_np pthread_get_stackaddr_np pthread_get_stacksize_np pthread_getname_np @@ -2261,6 +2182,7 @@ timeval32 timex truncate ttyname_r +u_quad_t ucontext_t unmount useconds_t @@ -2281,3 +2203,21 @@ wait4 waitid xsw_usage xucred +_PC_NAME_CHARS_MAX +_PC_CASE_SENSITIVE +_PC_CASE_PRESERVING +_PC_EXTENDED_SECURITY_NP +_PC_AUTH_OPAQUE_NP +_PC_2_SYMLINKS +_PC_ALLOC_SIZE_MIN +_PC_ASYNC_IO +_PC_FILESIZEBITS +_PC_PRIO_IO +_PC_REC_INCR_XFER_SIZE +_PC_REC_MAX_XFER_SIZE +_PC_REC_MIN_XFER_SIZE +_PC_REC_XFER_ALIGN +_PC_SYMLINK_MAX +_PC_SYNC_IO +_PC_XATTR_SIZE_BITS +_PC_MIN_HOLE_SIZE diff --git a/libc-test/semver/dragonfly.txt b/libc-test/semver/dragonfly.txt index 8135be3b4948d..b9ccffb681ad3 100644 --- a/libc-test/semver/dragonfly.txt +++ b/libc-test/semver/dragonfly.txt @@ -326,6 +326,9 @@ GLOB_NOESCAPE GLOB_NOMATCH GLOB_NOSORT GLOB_NOSPACE +GRND_INSECURE +GRND_NONBLOCK +GRND_RANDOM HW_BYTEORDER HW_DISKNAMES HW_DISKSTATS @@ -1308,6 +1311,7 @@ fstatfs futimes getdomainname getdtablesize +getentropy getgrent getgrent_r getgrgid @@ -1331,6 +1335,7 @@ getprogname getpwent getpwent_r getpwnam_r +getrandom getresgid getresuid getrlimit @@ -1587,3 +1592,5 @@ xucred eaccess dirname basename +IP_RECVTTL +IPV6_RECVHOPLIMIT diff --git a/libc-test/semver/freebsd-x86_64.txt b/libc-test/semver/freebsd-x86_64.txt index 8edfb525633db..be73d1f7290fe 100644 --- a/libc-test/semver/freebsd-x86_64.txt +++ b/libc-test/semver/freebsd-x86_64.txt @@ -1,4 +1,5 @@ Elf64_Auxinfo +KINFO_FILE_SIZE MAP_32BIT _MC_FLAG_MASK _MC_FPFMT_NODEV diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index cf9c603cf04d0..933fea0e63e94 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -144,6 +144,100 @@ BUFSIZ BUS_ADRALN BUS_ADRERR BUS_OBJERR +CAP_READ +CAP_RIGHTS_VERSION_00 +CAP_RIGHTS_VERSION +CAP_WRITE +CAP_SEEK_TELL +CAP_SEEK +CAP_PREAD +CAP_PWRITE +CAP_MMAP +CAP_MMAP_R +CAP_MMAP_W +CAP_MMAP_X +CAP_MMAP_RW +CAP_MMAP_RX +CAP_MMAP_WX +CAP_MMAP_RWX +CAP_CREATE +CAP_FEXECVE +CAP_FSYNC +CAP_FTRUNCATE +CAP_LOOKUP +CAP_FCHDIR +CAP_FCHFLAGS +CAP_CHFLAGSAT +CAP_FCHMOD +CAP_FCHMODAT +CAP_FCHOWN +CAP_FCHOWNAT +CAP_FCNTL +CAP_FLOCK +CAP_FPATHCONF +CAP_FSCK +CAP_FSTAT +CAP_FSTATAT +CAP_FSTATFS +CAP_FUTIMES +CAP_FUTIMESAT +CAP_LINKAT_TARGET +CAP_MKDIRAT +CAP_MKFIFOAT +CAP_MKNODAT +CAP_RENAMEAT_SOURCE +CAP_SYMLINKAT +CAP_UNLINKAT +CAP_ACCEPT +CAP_BIND +CAP_CONNECT +CAP_GETPEERNAME +CAP_GETSOCKNAME +CAP_GETSOCKOPT +CAP_LISTEN +CAP_PEELOFF +CAP_RECV +CAP_SEND +CAP_SETSOCKOPT +CAP_SHUTDOWN +CAP_BINDAT +CAP_CONNECTAT +CAP_LINKAT_SOURCE +CAP_RENAMEAT_TARGET +CAP_SOCK_CLIENT +CAP_SOCK_SERVER +CAP_ALL0 +CAP_UNUSED0_44 +CAP_UNUSED0_57 +CAP_MAC_GET +CAP_MAC_SET +CAP_SEM_GETVALUE +CAP_SEM_POST +CAP_SEM_WAIT +CAP_EVENT +CAP_KQUEUE_EVENT +CAP_IOCTL +CAP_TTYHOOK +CAP_PDGETPID +CAP_PDWAIT +CAP_PDKILL +CAP_EXTATTR_DELETE +CAP_EXTATTR_GET +CAP_EXTATTR_LIST +CAP_EXTATTR_SET +CAP_ACL_CHECK +CAP_ACL_DELETE +CAP_ACL_GET +CAP_ACL_SET +CAP_KQUEUE_CHANGE +CAP_KQUEUE +CAP_ALL1 +CAP_UNUSED1_22 +CAP_UNUSED1_57 +CAP_FCNTL_GETFL +CAP_FCNTL_SETFL +CAP_FCNTL_GETOWN +CAP_FCNTL_SETOWN CCAR_OFLOW CCTS_OFLOW CDSR_OFLOW @@ -592,6 +686,11 @@ JAIL_SYS_DISABLE JAIL_SYS_INHERIT JAIL_SYS_NEW JAIL_UPDATE +KCMP_FILE +KCMP_FILEOBJ +KCMP_FILES +KCMP_SIGHAND +KCMP_VM KENV_GET KENV_SET KENV_UNSET @@ -974,6 +1073,7 @@ PROC_WXMAP_STATUS PROC_WXORX_ENFORCE PROT_MAX PROT_MAX_EXTRACT +PTHREAD_BARRIER_SERIAL_THREAD PTHREAD_CREATE_DETACHED PTHREAD_CREATE_JOINABLE PTHREAD_MUTEX_ADAPTIVE_NP @@ -1774,6 +1874,7 @@ eui64_hostton eui64_ntoa eui64_ntohost exect +execvpe execvP explicit_bzero extattr_delete_fd @@ -1878,9 +1979,11 @@ jail_get jail_remove jail_set jrand48 +kcmp kevent key_t killpg +kinfo_file kinfo_getvmmap kinfo_proc kinfo_vmentry diff --git a/libc-test/semver/fuchsia.txt b/libc-test/semver/fuchsia.txt index 525b26bd62940..164916ccd554f 100644 --- a/libc-test/semver/fuchsia.txt +++ b/libc-test/semver/fuchsia.txt @@ -951,6 +951,7 @@ SOL_UDP SOL_X25 SOMAXCONN SO_BINDTODEVICE +SO_BINDTOIFINDEX SO_BSDCOMPAT SO_BUSY_POLL SO_DOMAIN diff --git a/libc-test/semver/hermit.txt b/libc-test/semver/hermit.txt new file mode 100644 index 0000000000000..ef3f1894fbb89 --- /dev/null +++ b/libc-test/semver/hermit.txt @@ -0,0 +1,302 @@ +AF_INET +AF_INET6 +CLOCK_REALTIME +CLOCK_MONOTONIC +DT_UNKNOWN +DT_FIFO +DT_CHR +DT_DIR +DT_BLK +DT_REG +DT_LNK +DT_SOCK +DT_WHT +EAI_AGAIN +EAI_BADFLAGS +EAI_FAIL +EAI_FAMILY +EAI_MEMORY +EAI_NODATA +EAI_NONAME +EAI_SERVICE +EAI_SOCKTYPE +EAI_SYSTEM +EAI_OVERFLOW +EFD_SEMAPHORE +EFD_NONBLOCK +EFD_CLOEXEC +F_DUPFD +F_GETFD +F_SETFD +F_GETFL +F_SETFL +FD_CLOEXEC +FIONBIO +FUTEX_RELATIVE_TIMEOUT +IP_TOS +IP_TTL +IP_ADD_MEMBERSHIP +IP_DROP_MEMBERSHIP +IP_MULTICAST_TTL +IP_MULTICAST_LOOP +IPPROTO_IP +IPPROTO_TCP +IPPROTO_UDP +IPPROTO_IPV6 +IPV6_ADD_MEMBERSHIP +IPV6_DROP_MEMBERSHIP +IPV6_MULTICAST_LOOP +IPV6_V6ONLY +MSG_PEEK +O_RDONLY +O_WRONLY +O_RDWR +O_CREAT +O_EXCL +O_TRUNC +O_APPEND +O_NONBLOCK +O_DIRECTORY +POLLIN +POLLPRI +POLLOUT +POLLERR +POLLHUP +POLLNVAL +POLLRDNORM +POLLRDBAND +POLLWRNORM +POLLWRBAND +POLLRDHUP +S_IRWXU +S_IRUSR +S_IWUSR +S_IXUSR +S_IRWXG +S_IRGRP +S_IWGRP +S_IXGRP +S_IRWXO +S_IROTH +S_IWOTH +S_IXOTH +S_IFMT +S_IFSOCK +S_IFLNK +S_IFREG +S_IFBLK +S_IFDIR +S_IFCHR +S_IFIFO +SHUT_RD +SHUT_WR +SHUT_RDWR +SO_REUSEADDR +SO_KEEPALIVE +SO_BROADCAST +SO_LINGER +SO_SNDBUF +SO_RCVBUF +SO_SNDTIMEO +SO_RCVTIMEO +SO_ERROR +SOCK_STREAM +SOCK_DGRAM +SOCK_NONBLOCK +SOCK_CLOEXEC +SOL_SOCKET +STDIN_FILENO +STDOUT_FILENO +STDERR_FILENO +TCP_NODELAY +EPERM +ENOENT +ESRCH +EINTR +EIO +ENXIO +E2BIG +ENOEXEC +EBADF +ECHILD +EAGAIN +ENOMEM +EACCES +EFAULT +ENOTBLK +EBUSY +EEXIST +EXDEV +ENODEV +ENOTDIR +EISDIR +EINVAL +ENFILE +EMFILE +ENOTTY +ETXTBSY +EFBIG +ENOSPC +ESPIPE +EROFS +EMLINK +EPIPE +EDOM +ERANGE +EDEADLK +ENAMETOOLONG +ENOLCK +ENOSYS +ENOTEMPTY +ELOOP +EWOULDBLOCK +ENOMSG +EIDRM +ECHRNG +EL2NSYNC +EL3HLT +EL3RST +ELNRNG +EUNATCH +ENOCSI +EL2HLT +EBADE +EBADR +EXFULL +ENOANO +EBADRQC +EBADSLT +EDEADLOCK +EBFONT +ENOSTR +ENODATA +ETIME +ENOSR +ENONET +ENOPKG +EREMOTE +ENOLINK +EADV +ESRMNT +ECOMM +EPROTO +EMULTIHOP +EDOTDOT +EBADMSG +EOVERFLOW +ENOTUNIQ +EBADFD +EREMCHG +ELIBACC +ELIBBAD +ELIBSCN +ELIBMAX +ELIBEXEC +EILSEQ +ERESTART +ESTRPIPE +EUSERS +ENOTSOCK +EDESTADDRREQ +EMSGSIZE +EPROTOTYPE +ENOPROTOOPT +EPROTONOSUPPORT +ESOCKTNOSUPPORT +EOPNOTSUPP +EPFNOSUPPORT +EAFNOSUPPORT +EADDRINUSE +EADDRNOTAVAIL +ENETDOWN +ENETUNREACH +ENETRESET +ECONNABORTED +ECONNRESET +ENOBUFS +EISCONN +ENOTCONN +ESHUTDOWN +ETOOMANYREFS +ETIMEDOUT +ECONNREFUSED +EHOSTDOWN +EHOSTUNREACH +EALREADY +EINPROGRESS +ESTALE +EUCLEAN +ENOTNAM +ENAVAIL +EISNAM +EREMOTEIO +EDQUOT +ENOMEDIUM +EMEDIUMTYPE +ECANCELED +ENOKEY +EKEYEXPIRED +EKEYREVOKED +EKEYREJECTED +EOWNERDEAD +ENOTRECOVERABLE +ERFKIL +EHWPOISON +addrinfo +dirent64 +in6_addr +in_addr +iovec +pollfd +sockaddr +sockaddr_in +sockaddr_in6 +sockaddr_storage +stat +timespec +sys_abort +sys_accept +sys_alloc +sys_alloc_zeroed +sys_available_parallelism +sys_bind +sys_clock_gettime +sys_close +sys_connect +sys_dealloc +sys_dup +sys_errno +sys_eventfd +sys_exit +sys_fcntl +sys_freeaddrinfo +sys_fstat +sys_futex_wait +sys_futex_wake +sys_getaddrinfo +sys_getdents64 +sys_getpeername +sys_getsockname +sys_getsockopt +sys_ioctl +sys_listen +sys_lstat +sys_mkdir +sys_nanosleep +sys_open +sys_poll +sys_read +sys_readv +sys_realloc +sys_recv +sys_recvfrom +sys_rmdir +sys_send +sys_sendto +sys_setsockopt +sys_shutdown +sys_socket +sys_stat +sys_unlink +sys_write +sys_writev diff --git a/libc-test/semver/illumos.txt b/libc-test/semver/illumos.txt new file mode 100644 index 0000000000000..d0ef608456d54 --- /dev/null +++ b/libc-test/semver/illumos.txt @@ -0,0 +1,3 @@ +pthread_attr_get_np +pthread_attr_getstackaddr +pthread_attr_setstack diff --git a/libc-test/semver/linux-aarch64.txt b/libc-test/semver/linux-aarch64.txt index 5714299010e9e..6c92db32d8104 100644 --- a/libc-test/semver/linux-aarch64.txt +++ b/libc-test/semver/linux-aarch64.txt @@ -38,6 +38,8 @@ BPF_W BPF_X BPF_XOR CIBAUD +Elf32_Rela +Elf64_Rela FICLONE FICLONERANGE MADV_SOFT_OFFLINE @@ -66,6 +68,7 @@ SKF_NET_OFF SO_PRIORITY SO_PROTOCOL SYS_accept +SYS_fstat SYS_msgctl SYS_msgget SYS_msgrcv @@ -79,6 +82,7 @@ SYS_semctl SYS_semget SYS_semop SYS_semtimedop +SYS_setrlimit SYS_shmat SYS_shmctl SYS_shmdt diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index d39726f4260a7..08ad12967f618 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -191,9 +191,13 @@ NFT_CMP_LT NFT_CMP_LTE NFT_CMP_NEQ NFT_CONTINUE +NFT_CT_AVGPKT NFT_CT_BYTES NFT_CT_DIRECTION NFT_CT_DST +NFT_CT_DST_IP +NFT_CT_DST_IP6 +NFT_CT_EVENTMASK NFT_CT_EXPIRATION NFT_CT_HELPER NFT_CT_L3PROTOCOL @@ -205,8 +209,11 @@ NFT_CT_PROTO_DST NFT_CT_PROTO_SRC NFT_CT_SECMARK NFT_CT_SRC +NFT_CT_SRC_IP +NFT_CT_SRC_IP6 NFT_CT_STATE NFT_CT_STATUS +NFT_CT_ZONE NFT_DATA_RESERVED_MASK NFT_DATA_VALUE NFT_DATA_VALUE_MAXLEN @@ -511,6 +518,9 @@ XSK_UNALIGNED_BUF_ADDR_MASK XDP_PKT_CONTD XENFS_SUPER_MAGIC XFS_SUPER_MAGIC +_CS_GNU_LIBC_VERSION +_CS_GNU_LIBPTHREAD_VERSION +_CS_PATH _SC_2_C_VERSION _SC_BASE _SC_CHARCLASS_NAME_MAX @@ -611,6 +621,7 @@ aio_write aiocb backtrace clock_adjtime +confstr copy_file_range ctermid dlinfo @@ -643,9 +654,11 @@ lio_listio mallinfo mallinfo2 malloc_info +malloc_stats malloc_trim malloc_usable_size mallopt +mq_notify nl_mmap_hdr nl_mmap_req nl_pktinfo @@ -691,9 +704,6 @@ euidaccess eaccess asctime_r ctime_r -strftime -strftime_l -strptime dirname posix_basename gnu_basename diff --git a/libc-test/semver/linux-i686.txt b/libc-test/semver/linux-i686.txt index 97e9f741a8929..3352969499e23 100644 --- a/libc-test/semver/linux-i686.txt +++ b/libc-test/semver/linux-i686.txt @@ -13,6 +13,8 @@ EDI EDX EFL EIP +Elf32_Rela +Elf64_Rela ES ESI FS @@ -96,6 +98,7 @@ SYS_fadvise64_64 SYS_fchown32 SYS_fcntl64 SYS_fork +SYS_fstat SYS_fstat64 SYS_fstatat64 SYS_fstatfs64 @@ -131,6 +134,7 @@ SYS_mknod SYS_mmap2 SYS_modify_ldt SYS_mpx +SYS_mseal SYS_nice SYS_oldfstat SYS_oldlstat @@ -165,6 +169,7 @@ SYS_setregid32 SYS_setresgid32 SYS_setresuid32 SYS_setreuid32 +SYS_setrlimit SYS_setuid32 SYS_sgetmask SYS_sigaction diff --git a/libc-test/semver/linux-mips.txt b/libc-test/semver/linux-mips.txt index 80aa25a60bf84..62da7368b5587 100644 --- a/libc-test/semver/linux-mips.txt +++ b/libc-test/semver/linux-mips.txt @@ -30,6 +30,7 @@ SYS_epoll_wait SYS_eventfd SYS_fcntl64 SYS_fork +SYS_fstat SYS_fstat64 SYS_fstatfs64 SYS_ftime @@ -77,6 +78,7 @@ SYS_send SYS_sendfile SYS_sendfile64 SYS_set_thread_area +SYS_setrlimit SYS_sgetmask SYS_sigaction SYS_signal diff --git a/libc-test/semver/linux-musl.txt b/libc-test/semver/linux-musl.txt index f6e293aa9b7fc..fa457ddf63cb2 100644 --- a/libc-test/semver/linux-musl.txt +++ b/libc-test/semver/linux-musl.txt @@ -23,6 +23,11 @@ PF_XDP PIDFD_NONBLOCK PR_SET_VMA PR_SET_VMA_ANON_NAME +RWF_APPEND +RWF_DSYNC +RWF_HIPRI +RWF_NOWAIT +RWF_SYNC SOL_XDP XDP_SHARED_UMEM XDP_COPY @@ -75,16 +80,15 @@ getutxline lio_listio ntptimeval open_wmemstream +preadv2 preadv64 prlimit prlimit64 process_vm_readv process_vm_writev pututxline +pwritev2 pwritev64 reallocarray setutxent -strftime -strftime_l -strptime timex diff --git a/libc-test/semver/linux-powerpc.txt b/libc-test/semver/linux-powerpc.txt index 1d162417608fa..2826bb98d20e3 100644 --- a/libc-test/semver/linux-powerpc.txt +++ b/libc-test/semver/linux-powerpc.txt @@ -54,6 +54,7 @@ SYS_fadvise64 SYS_fadvise64_64 SYS_fcntl64 SYS_fork +SYS_fstat SYS_fstat64 SYS_fstatat64 SYS_fstatfs64 @@ -81,6 +82,7 @@ SYS_mknod SYS_mmap2 SYS_modify_ldt SYS_mpx +SYS_mseal SYS_multiplexer SYS_nice SYS_oldfstat @@ -110,6 +112,7 @@ SYS_select SYS_send SYS_sendfile SYS_sendfile64 +SYS_setrlimit SYS_sgetmask SYS_sigaction SYS_signal diff --git a/libc-test/semver/linux-powerpc64.txt b/libc-test/semver/linux-powerpc64.txt index 983c7e7d30c28..77718d9ce47f0 100644 --- a/libc-test/semver/linux-powerpc64.txt +++ b/libc-test/semver/linux-powerpc64.txt @@ -2,6 +2,8 @@ B2500000 B3000000 B3500000 B4000000 +Elf32_Rela +Elf64_Rela KEYCTL_CAPABILITIES KEYCTL_CAPS0_BIG_KEY KEYCTL_CAPS0_CAPABILITIES @@ -66,6 +68,7 @@ SYS_epoll_create SYS_epoll_wait SYS_eventfd SYS_fork +SYS_fstat SYS_fstatfs64 SYS_ftime SYS_futimesat @@ -117,6 +120,7 @@ SYS_rtas SYS_select SYS_send SYS_sendfile +SYS_setrlimit SYS_sgetmask SYS_sigaction SYS_signal diff --git a/libc-test/semver/linux-powerpc64le.txt b/libc-test/semver/linux-powerpc64le.txt index 983c7e7d30c28..99be508e6bd59 100644 --- a/libc-test/semver/linux-powerpc64le.txt +++ b/libc-test/semver/linux-powerpc64le.txt @@ -66,6 +66,7 @@ SYS_epoll_create SYS_epoll_wait SYS_eventfd SYS_fork +SYS_fstat SYS_fstatfs64 SYS_ftime SYS_futimesat @@ -117,6 +118,7 @@ SYS_rtas SYS_select SYS_send SYS_sendfile +SYS_setrlimit SYS_sgetmask SYS_sigaction SYS_signal diff --git a/libc-test/semver/linux-riscv64gc.txt b/libc-test/semver/linux-riscv64gc.txt index cc4d97fe6fa51..dcaa86e7eab6e 100644 --- a/libc-test/semver/linux-riscv64gc.txt +++ b/libc-test/semver/linux-riscv64gc.txt @@ -3,6 +3,8 @@ B3000000 B3500000 B4000000 CIBAUD +Elf32_Rela +Elf64_Rela KEYCTL_CAPABILITIES KEYCTL_CAPS0_BIG_KEY KEYCTL_CAPS0_CAPABILITIES @@ -46,6 +48,7 @@ SO_TIMESTAMPNS SO_WIFI_STATUS SYS_accept SYS_fadvise64 +SYS_fstat SYS_msgctl SYS_msgget SYS_msgrcv @@ -59,6 +62,7 @@ SYS_semget SYS_semop SYS_semtimedop SYS_sendfile +SYS_setrlimit SYS_shmat SYS_shmctl SYS_shmdt @@ -69,3 +73,10 @@ TIOCSRS485 flock64 fsblkcnt64_t fsfilcnt64_t +COMPAT_HWCAP_ISA_I +COMPAT_HWCAP_ISA_M +COMPAT_HWCAP_ISA_A +COMPAT_HWCAP_ISA_F +COMPAT_HWCAP_ISA_D +COMPAT_HWCAP_ISA_C +COMPAT_HWCAP_ISA_V diff --git a/libc-test/semver/linux-s390x.txt b/libc-test/semver/linux-s390x.txt index c2ffaf8d06f39..96be9c25e4f3c 100644 --- a/libc-test/semver/linux-s390x.txt +++ b/libc-test/semver/linux-s390x.txt @@ -44,6 +44,7 @@ SYS_epoll_wait SYS_eventfd SYS_fadvise64 SYS_fork +SYS_fstat SYS_fstatfs64 SYS_futimesat SYS_get_kernel_syms @@ -58,6 +59,7 @@ SYS_link SYS_lstat SYS_mkdir SYS_mknod +SYS_mseal SYS_newfstatat SYS_nice SYS_open @@ -76,6 +78,7 @@ SYS_s390_pci_mmio_write SYS_s390_runtime_instr SYS_select SYS_sendfile +SYS_setrlimit SYS_sigaction SYS_signal SYS_signalfd diff --git a/libc-test/semver/linux-sparc64.txt b/libc-test/semver/linux-sparc64.txt index 956cd2aeda15e..d6ae2f675f793 100644 --- a/libc-test/semver/linux-sparc64.txt +++ b/libc-test/semver/linux-sparc64.txt @@ -40,6 +40,7 @@ SYS_execv SYS_fadvise64 SYS_fadvise64_64 SYS_fork +SYS_fstat SYS_fstat64 SYS_fstatat64 SYS_fstatfs64 @@ -79,6 +80,7 @@ SYS_sched_set_affinity SYS_select SYS_sendfile SYS_sendfile64 +SYS_setrlimit SYS_sgetmask SYS_sigaction SYS_signal diff --git a/libc-test/semver/linux-x86_64.txt b/libc-test/semver/linux-x86_64.txt index 64126fbc841e1..fec226ca310e2 100644 --- a/libc-test/semver/linux-x86_64.txt +++ b/libc-test/semver/linux-x86_64.txt @@ -40,6 +40,8 @@ BPF_XOR CIBAUD CS DS +Elf32_Rela +Elf64_Rela ES FS GS @@ -93,6 +95,7 @@ SYS_epoll_wait SYS_eventfd SYS_fadvise64 SYS_fork +SYS_fstat SYS_futimesat SYS_getdents SYS_getpgrp @@ -106,6 +109,7 @@ SYS_lstat SYS_mkdir SYS_mknod SYS_modify_ldt +SYS_mseal SYS_open SYS_pause SYS_pipe @@ -120,6 +124,7 @@ SYS_renameat SYS_rmdir SYS_select SYS_sendfile +SYS_setrlimit SYS_signalfd SYS_stat SYS_symlink diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 07e93fee31ee4..2e928030486d4 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -169,6 +169,7 @@ AT_GID AT_HWCAP AT_HWCAP2 AT_IGNORE +AT_MINSIGSTKSZ AT_NOTELF AT_NO_AUTOMOUNT AT_NULL @@ -415,8 +416,14 @@ EKEYREJECTED EKEYREVOKED EL2HLT EL2NSYNC +ELF32_R_SYM +ELF32_R_TYPE +ELF32_R_INFO EL3HLT EL3RST +ELF64_R_SYM +ELF64_R_TYPE +ELF64_R_INFO ELFCLASS32 ELFCLASS64 ELFCLASSNONE @@ -694,17 +701,24 @@ Elf32_Ehdr Elf32_Half Elf32_Off Elf32_Phdr +Elf32_Rel +Elf32_Relr Elf32_Section Elf32_Shdr Elf32_Sym +Elf32_Sword Elf32_Word +Elf32_Xword Elf64_Addr Elf64_Ehdr Elf64_Half Elf64_Off Elf64_Phdr +Elf64_Rel +Elf64_Relr Elf64_Section Elf64_Shdr +Elf64_Sword Elf64_Sxword Elf64_Sym Elf64_Word @@ -823,13 +837,16 @@ FUTEX_OP_OPARG_SHIFT FUTEX_OP_OR FUTEX_OP_SET FUTEX_OP_XOR +FUTEX_OWNER_DIED FUTEX_PRIVATE_FLAG FUTEX_REQUEUE +FUTEX_TID_MASK FUTEX_TRYLOCK_PI FUTEX_UNLOCK_PI FUTEX_WAIT FUTEX_WAIT_BITSET FUTEX_WAIT_REQUEUE_PI +FUTEX_WAITERS FUTEX_WAKE FUTEX_WAKE_BITSET FUTEX_WAKE_OP @@ -1448,7 +1465,9 @@ MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ MFD_ALLOW_SEALING MFD_CLOEXEC +MFD_EXEC MFD_HUGETLB +MFD_NOEXEC_SEAL MINSIGSTKSZ MMAP_PAGE_ZERO MNT_DETACH @@ -1679,8 +1698,29 @@ NFULNL_COPY_PACKET NFULNL_MSG_CONFIG NFULNL_MSG_PACKET NF_ACCEPT +NF_ARP +NF_ARP_FORWARD +NF_ARP_IN +NF_ARP_NUMHOOKS +NF_ARP_OUT +NF_BR_BROUTING +NF_BR_FORWARD +NF_BR_LOCAL_IN +NF_BR_LOCAL_OUT +NF_BR_NUMHOOKS +NF_BR_POST_ROUTING +NF_BR_PRE_ROUTING +NF_BR_PRI_BRNF +NF_BR_PRI_FILTER_BRIDGED +NF_BR_PRI_FILTER_OTHER +NF_BR_PRI_FIRST +NF_BR_PRI_LAST +NF_BR_PRI_NAT_DST_BRIDGED +NF_BR_PRI_NAT_DST_OTHER +NF_BR_PRI_NAT_SRC NF_DROP NF_INET_FORWARD +NF_INET_INGRESS NF_INET_LOCAL_IN NF_INET_LOCAL_OUT NF_INET_NUMHOOKS @@ -1702,6 +1742,7 @@ NF_IP6_PRI_MANGLE NF_IP6_PRI_NAT_DST NF_IP6_PRI_NAT_SRC NF_IP6_PRI_RAW +NF_IP6_PRI_RAW_BEFORE_DEFRAG NF_IP6_PRI_SECURITY NF_IP6_PRI_SELINUX_FIRST NF_IP6_PRI_SELINUX_LAST @@ -1722,10 +1763,12 @@ NF_IP_PRI_MANGLE NF_IP_PRI_NAT_DST NF_IP_PRI_NAT_SRC NF_IP_PRI_RAW +NF_IP_PRI_RAW_BEFORE_DEFRAG NF_IP_PRI_SECURITY NF_IP_PRI_SELINUX_FIRST NF_IP_PRI_SELINUX_LAST NF_MAX_VERDICT +NF_NETDEV_EGRESS NF_QUEUE NF_REPEAT NF_STOLEN @@ -2004,6 +2047,7 @@ PR_TSC_ENABLE PR_TSC_SIGSEGV PR_UNALIGN_NOPRINT PR_UNALIGN_SIGBUS +PTHREAD_BARRIER_SERIAL_THREAD PTHREAD_CREATE_DETACHED PTHREAD_CREATE_JOINABLE PTHREAD_MUTEX_DEFAULT @@ -2744,6 +2788,8 @@ IW_ENC_CAPA_WPA2 IW_ENC_CAPA_CIPHER_TKIP IW_ENC_CAPA_CIPHER_CCMP IW_ENC_CAPA_4WAY_HANDSHAKE +IW_EVENT_CAPA_K_0 +IW_EVENT_CAPA_K_1 IW_PMKSA_ADD IW_PMKSA_REMOVE IW_PMKSA_FLUSH @@ -2752,6 +2798,11 @@ IW_PMKID_CAND_PREAUTH IW_EV_CHAR_PK_LEN IW_EV_LCP_PK_LEN IW_EV_POINT_PK_LEN +IW_EV_UINT_PK_LEN +IW_EV_FREQ_PK_LEN +IW_EV_PARAM_PK_LEN +IW_EV_ADDR_PK_LEN +IW_EV_QUAL_PK_LEN SI_LOAD_SHIFT SND_CNT SND_MAX @@ -2901,7 +2952,6 @@ SYS_flistxattr SYS_flock SYS_fremovexattr SYS_fsetxattr -SYS_fstat SYS_fstatfs SYS_fsync SYS_ftruncate @@ -3056,7 +3106,6 @@ SYS_setregid SYS_setresgid SYS_setresuid SYS_setreuid -SYS_setrlimit SYS_setsid SYS_setsockopt SYS_settimeofday @@ -3597,10 +3646,27 @@ ip_mreqn ip_mreq_source ipc_perm itimerspec +iw_discarded +iw_encode_ext +iw_event +iw_freq +iw_missed +iw_param +iw_pmkid_cand +iw_pmksa +iw_point +iw_priv_args +iw_quality +iw_range +iwreq +iwreq_data +iw_scan_req +iw_statistics j1939_filter jrand48 key_t killpg +klogctl labs lcong48 lgetxattr @@ -3877,8 +3943,11 @@ statvfs64 strcasecmp strcasestr strchrnul +strftime +strftime_l strncasecmp strndup +strptime strsignal swapoff swapon @@ -3929,7 +3998,6 @@ unshare useconds_t uselocale utimensat -vfork vhangup vmsplice wait4 diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt index 353b1e7356ff5..838f28f71b5d1 100644 --- a/libc-test/semver/netbsd.txt +++ b/libc-test/semver/netbsd.txt @@ -468,6 +468,7 @@ IPTOS_ECN_ECT0 IPTOS_ECN_ECT1 IPTOS_ECN_MASK IPTOS_ECN_NOTECT +IPV6_DONTFRAG IPV6_JOIN_GROUP IPV6_LEAVE_GROUP IPV6_PKTINFO @@ -1189,6 +1190,9 @@ _cpuset_destroy _cpuset_isset _cpuset_set _cpuset_zero +_lwp_park +_lwp_unpark +_lwp_unpark_all _lwp_self abs accept4 diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt index fd4563212d60d..019ab53d34ff0 100644 --- a/libc-test/semver/openbsd.txt +++ b/libc-test/semver/openbsd.txt @@ -311,6 +311,7 @@ IPTOS_ECN_ECT0 IPTOS_ECN_ECT1 IPTOS_ECN_MASK IPTOS_ECN_NOTECT +IPV6_DONTFRAG IPV6_JOIN_GROUP IPV6_LEAVE_GROUP IPV6_PKTINFO @@ -331,7 +332,6 @@ ITIMER_PROF ITIMER_REAL ITIMER_VIRTUAL KERN_ARGMAX -KERN_ARND KERN_AUDIO KERN_BOOTTIME KERN_CACHEPCT @@ -357,7 +357,6 @@ KERN_JOB_CONTROL KERN_MALLOCSTATS KERN_MAXCLUSTERS KERN_MAXFILES -KERN_MAXID KERN_MAXLOCKSPERUID KERN_MAXPARTITIONS KERN_MAXPROC @@ -372,7 +371,6 @@ KERN_NFILES KERN_NGROUPS KERN_NOSUIDCOREDUMP KERN_NPROCS -KERN_NSELCOLL KERN_NTHREADS KERN_NUMVNODES KERN_OSRELEASE @@ -422,7 +420,6 @@ KERN_TIMECOUNTER KERN_TIMEOUT_STATS KERN_TTY KERN_TTYCOUNT -KERN_USERMOUNT KERN_VERSION KERN_WATCHDOG KVE_ADV_NORMAL @@ -1129,13 +1126,13 @@ memmem memrchr mfs_args mimmutable -mincore mkdirat mkfifoat mknodat mkostemp mkostemps mkstemps +mmsghdr mount_info mrand48 msdosfs_args @@ -1215,6 +1212,7 @@ readlinkat reallocarray reboot recvmsg +recvmmsg regcomp regerror regex_t @@ -1236,6 +1234,7 @@ sem_init sem_open sem_timedwait sem_unlink +sendmmsg sendmsg setdomainname setgrent @@ -1279,7 +1278,6 @@ strndup strsignal strtonum sync -syscall sysctl tcp_info telldir diff --git a/libc-test/semver/redox.txt b/libc-test/semver/redox.txt index 80095a09f5345..48b1e3c18278e 100644 --- a/libc-test/semver/redox.txt +++ b/libc-test/semver/redox.txt @@ -96,6 +96,17 @@ EUSERS EXFULL FIONREAD IMAXBEL +IP_RECVTOS +IP_TOS +IPPROTO_ICMP +IPPROTO_IDP +IPPROTO_IGMP +IPPROTO_IP +IPPROTO_IPV6 +IPPROTO_MAX +IPPROTO_PUP +IPPROTO_TCP +IPPROTO_UDP IPV6_ADD_MEMBERSHIP IPV6_DROP_MEMBERSHIP IUCLC @@ -129,6 +140,7 @@ SIGPWR SIGSTKFLT SOCK_CLOEXEC SOCK_NONBLOCK +SOCK_RAW SO_BSDCOMPAT SO_DOMAIN SO_NO_CHECK diff --git a/libc-test/semver/solarish.txt b/libc-test/semver/solarish.txt new file mode 100644 index 0000000000000..8f51b3ceca6fa --- /dev/null +++ b/libc-test/semver/solarish.txt @@ -0,0 +1,14 @@ +IPV6_DONTFRAG +IPV6_PKTINFO +IPV6_RECVTCLASS +IPV6_TCLASS +IP_DONTFRAG +IP_PKTINFO +IP_TOS +IP_TTL +PIPE_BUF +bind +in6_pktinfo +in_pktinfo +recvmsg +sendmsg diff --git a/libc-test/semver/unix.txt b/libc-test/semver/unix.txt index 5e84434b46bf4..062d867b8530c 100644 --- a/libc-test/semver/unix.txt +++ b/libc-test/semver/unix.txt @@ -152,6 +152,8 @@ IF_NAMESIZE IGNBRK IGNCR IGNPAR +IN6ADDR_ANY_INIT +IN6ADDR_LOOPBACK_INIT INADDR_ANY INADDR_BROADCAST INADDR_LOOPBACK @@ -450,6 +452,7 @@ accept access addrinfo alarm +aligned_alloc atexit atof atoi @@ -583,9 +586,13 @@ grantpt group hostent hstrerror +htonl +htons if_indextoname if_nametoindex in6_addr +in6addr_any +in6addr_loopback in_addr in_addr_t in_port_t @@ -651,6 +658,8 @@ munmap nanosleep nfds_t nlink_t +ntohl +ntohs off_t open opendir @@ -687,6 +696,7 @@ pthread_condattr_init pthread_condattr_t pthread_create pthread_detach +pthread_equal pthread_exit pthread_getspecific pthread_join diff --git a/libc-test/semver/wasi.txt b/libc-test/semver/wasi.txt new file mode 100644 index 0000000000000..975c8155a58cb --- /dev/null +++ b/libc-test/semver/wasi.txt @@ -0,0 +1,5 @@ +fd_set +FD_SET +FD_ZERO +FD_ISSET +select diff --git a/libc-test/semver/windows.txt b/libc-test/semver/windows.txt index fa3fb8efecd38..ad0a60d4719cd 100644 --- a/libc-test/semver/windows.txt +++ b/libc-test/semver/windows.txt @@ -149,6 +149,7 @@ accept access aligned_malloc aligned_free +aligned_realloc atexit atof atoi diff --git a/libc-test/test/makedev.rs b/libc-test/test/makedev.rs index c9a92aa83e686..6b5b85efb8197 100644 --- a/libc-test/test/makedev.rs +++ b/libc-test/test/makedev.rs @@ -79,7 +79,7 @@ mod t { // These OSes allow 32 bits for both minor and major #[cfg(any( - target_os = "empscripten", + target_os = "emscripten", target_os = "freebsd", target_os = "fuchsia", target_os = "linux", diff --git a/libc-test/test/primitive_types.rs b/libc-test/test/primitive_types.rs new file mode 100644 index 0000000000000..c125a92a58110 --- /dev/null +++ b/libc-test/test/primitive_types.rs @@ -0,0 +1,15 @@ +use std::any::TypeId; + +macro_rules! ok { + ($($t:ident)*) => {$( + assert!(TypeId::of::() == TypeId::of::(), + "{} is wrong", stringify!($t)); + )*} +} + +#[test] +fn same() { + use std::ffi; + ok!(c_char c_schar c_uchar c_short c_ushort c_int c_uint c_long c_ulong + c_longlong c_ulonglong c_float c_double); +} diff --git a/src/fixed_width_ints.rs b/src/fixed_width_ints.rs index 7a6f6cfaedb9b..f24fa5dd2d1d7 100644 --- a/src/fixed_width_ints.rs +++ b/src/fixed_width_ints.rs @@ -20,7 +20,7 @@ pub type uint32_t = u32; pub type uint64_t = u64; cfg_if! { - if #[cfg(all(target_arch = "aarch64", not(target_os = "windows")))] { + if #[cfg(all(target_arch = "aarch64", not(any(target_os = "windows", target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))))] { // This introduces partial support for FFI with __int128 and // equivalent types on platforms where Rust's definition is validated // to match the standard C ABI of that platform. @@ -92,5 +92,10 @@ cfg_if! { // static_assert_eq!(core::mem::size_of::<__uint128_t>(), _SIZE_128); // static_assert_eq!(core::mem::align_of::<__uint128_t>(), _ALIGN_128); + } else if #[cfg(all(target_arch = "aarch64", any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos")))] { + /// /// C `__int128_t` + pub type __int128_t = i128; + /// /// C `__uint128_t` + pub type __uint128_t = u128; } } diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 35991e463669b..bf4250c974106 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -1334,9 +1334,9 @@ pub const GRPQUOTA: ::c_int = 1; pub const SIGIOT: ::c_int = 6; -pub const S_ISUID: ::c_int = 0x800; -pub const S_ISGID: ::c_int = 0x400; -pub const S_ISVTX: ::c_int = 0x200; +pub const S_ISUID: ::mode_t = 0o4000; +pub const S_ISGID: ::mode_t = 0o2000; +pub const S_ISVTX: ::mode_t = 0o1000; pub const IF_NAMESIZE: ::size_t = 16; pub const IFNAMSIZ: ::size_t = IF_NAMESIZE; @@ -1467,26 +1467,26 @@ pub const O_RDONLY: ::c_int = 0; pub const O_WRONLY: ::c_int = 1; pub const O_RDWR: ::c_int = 2; -pub const S_IFIFO: ::mode_t = 4096; -pub const S_IFCHR: ::mode_t = 8192; -pub const S_IFBLK: ::mode_t = 24576; -pub const S_IFDIR: ::mode_t = 16384; -pub const S_IFREG: ::mode_t = 32768; -pub const S_IFLNK: ::mode_t = 40960; -pub const S_IFSOCK: ::mode_t = 49152; -pub const S_IFMT: ::mode_t = 61440; -pub const S_IRWXU: ::mode_t = 448; -pub const S_IXUSR: ::mode_t = 64; -pub const S_IWUSR: ::mode_t = 128; -pub const S_IRUSR: ::mode_t = 256; -pub const S_IRWXG: ::mode_t = 56; -pub const S_IXGRP: ::mode_t = 8; -pub const S_IWGRP: ::mode_t = 16; -pub const S_IRGRP: ::mode_t = 32; -pub const S_IRWXO: ::mode_t = 7; -pub const S_IXOTH: ::mode_t = 1; -pub const S_IWOTH: ::mode_t = 2; -pub const S_IROTH: ::mode_t = 4; +pub const S_IFIFO: ::mode_t = 0o1_0000; +pub const S_IFCHR: ::mode_t = 0o2_0000; +pub const S_IFBLK: ::mode_t = 0o6_0000; +pub const S_IFDIR: ::mode_t = 0o4_0000; +pub const S_IFREG: ::mode_t = 0o10_0000; +pub const S_IFLNK: ::mode_t = 0o12_0000; +pub const S_IFSOCK: ::mode_t = 0o14_0000; +pub const S_IFMT: ::mode_t = 0o17_0000; +pub const S_IRWXU: ::mode_t = 0o0700; +pub const S_IXUSR: ::mode_t = 0o0100; +pub const S_IWUSR: ::mode_t = 0o0200; +pub const S_IRUSR: ::mode_t = 0o0400; +pub const S_IRWXG: ::mode_t = 0o0070; +pub const S_IXGRP: ::mode_t = 0o0010; +pub const S_IWGRP: ::mode_t = 0o0020; +pub const S_IRGRP: ::mode_t = 0o0040; +pub const S_IRWXO: ::mode_t = 0o0007; +pub const S_IXOTH: ::mode_t = 0o0001; +pub const S_IWOTH: ::mode_t = 0o0002; +pub const S_IROTH: ::mode_t = 0o0004; pub const F_OK: ::c_int = 0; pub const R_OK: ::c_int = 4; pub const W_OK: ::c_int = 2; @@ -2283,9 +2283,9 @@ pub const POSIX_MADV_RANDOM: ::c_int = 1; pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; pub const POSIX_MADV_WILLNEED: ::c_int = 3; -pub const S_IEXEC: mode_t = 64; -pub const S_IWRITE: mode_t = 128; -pub const S_IREAD: mode_t = 256; +pub const S_IEXEC: mode_t = 0o0100; +pub const S_IWRITE: mode_t = 0o0200; +pub const S_IREAD: mode_t = 0o0400; pub const F_LOCK: ::c_int = 1; pub const F_TEST: ::c_int = 3; @@ -2979,6 +2979,7 @@ pub const SO_MARK: ::c_int = 36; pub const SO_RXQ_OVFL: ::c_int = 40; pub const SO_PEEK_OFF: ::c_int = 42; pub const SO_BUSY_POLL: ::c_int = 46; +pub const SO_BINDTOIFINDEX: ::c_int = 62; pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; @@ -3675,13 +3676,13 @@ extern "C" { pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int; pub fn execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int; pub fn execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int; - pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int; + pub fn execv(prog: *const c_char, argv: *const *mut c_char) -> ::c_int; pub fn execve( prog: *const c_char, - argv: *const *const c_char, - envp: *const *const c_char, + argv: *const *mut c_char, + envp: *const *mut c_char, ) -> ::c_int; - pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int; + pub fn execvp(c: *const c_char, argv: *const *mut c_char) -> ::c_int; pub fn fork() -> pid_t; pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long; pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char; @@ -4023,14 +4024,10 @@ extern "C" { ) -> ::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, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char, ) -> ::c_int; + pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int; pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; diff --git a/src/hermit.rs b/src/hermit.rs new file mode 100644 index 0000000000000..77df54ae12d8d --- /dev/null +++ b/src/hermit.rs @@ -0,0 +1,580 @@ +//! Hermit C type definitions + +cfg_if! { + if #[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))] { + pub type c_char = u8; + } else { + pub type c_char = i8; + } +} + +pub type c_schar = i8; +pub type c_uchar = u8; +pub type c_short = i16; +pub type c_ushort = u16; +pub type c_int = i32; +pub type c_uint = u32; +pub type c_long = i64; +pub type c_ulong = u64; +pub type c_longlong = i64; +pub type c_ulonglong = u64; +pub type intmax_t = i64; +pub type uintmax_t = u64; +pub type intptr_t = isize; +pub type uintptr_t = usize; + +pub type c_float = f32; +pub type c_double = f64; + +pub type size_t = usize; +pub type ssize_t = isize; +pub type ptrdiff_t = isize; + +pub type clockid_t = i32; +pub type in_addr_t = u32; +pub type in_port_t = u16; +pub type mode_t = u32; +pub type nfds_t = usize; +pub type pid_t = i32; +pub type sa_family_t = u8; +pub type socklen_t = u32; +pub type time_t = i64; + +s! { + pub struct addrinfo { + pub ai_flags: i32, + pub ai_family: i32, + pub ai_socktype: i32, + pub ai_protocol: i32, + pub ai_addrlen: socklen_t, + pub ai_canonname: *mut c_char, + pub ai_addr: *mut sockaddr, + pub ai_next: *mut addrinfo, + } + + pub struct dirent64 { + pub d_ino: u64, + pub d_off: i64, + pub d_reclen: u16, + pub d_type: u8, + pub d_name: [c_char; 256], + } + + #[repr(align(4))] + pub struct in6_addr { + pub s6_addr: [u8; 16], + } + + pub struct in_addr { + pub s_addr: in_addr_t, + } + + pub struct iovec { + iov_base: *mut c_void, + iov_len: usize, + } + + pub struct pollfd { + pub fd: i32, + pub events: i16, + pub revents: i16, + } + + pub struct sockaddr { + pub sa_len: u8, + pub sa_family: sa_family_t, + pub sa_data: [c_char; 14], + } + + pub struct sockaddr_in { + pub sin_len: u8, + pub sin_family: sa_family_t, + pub sin_port: in_port_t, + pub sin_addr: in_addr, + pub sin_zero: [c_char; 8], + } + + pub struct sockaddr_in6 { + pub sin6_len: u8, + pub sin6_family: sa_family_t, + pub sin6_port: in_port_t, + pub sin6_flowinfo: u32, + pub sin6_addr: in6_addr, + pub sin6_scope_id: u32, + } + + pub struct sockaddr_storage { + pub ss_len: u8, + pub ss_family: sa_family_t, + __ss_pad1: [u8; 6], + __ss_align: i64, + __ss_pad2: [u8; 112], + } + + pub struct stat { + pub st_dev: u64, + pub st_ino: u64, + pub st_nlink: u64, + pub st_mode: mode_t, + pub st_uid: u32, + pub st_gid: u32, + pub st_rdev: u64, + pub st_size: u64, + pub st_blksize: i64, + pub st_blocks: i64, + pub st_atim: timespec, + pub st_mtim: timespec, + pub st_ctim: timespec, + } + + pub struct timespec { + pub tv_sec: time_t, + pub tv_nsec: i32, + } +} + +pub const AF_INET: i32 = 0; +pub const AF_INET6: i32 = 1; + +pub const CLOCK_REALTIME: clockid_t = 1; +pub const CLOCK_MONOTONIC: clockid_t = 4; + +pub const DT_UNKNOWN: u8 = 0; +pub const DT_FIFO: u8 = 1; +pub const DT_CHR: u8 = 2; +pub const DT_DIR: u8 = 4; +pub const DT_BLK: u8 = 6; +pub const DT_REG: u8 = 8; +pub const DT_LNK: u8 = 10; +pub const DT_SOCK: u8 = 12; +pub const DT_WHT: u8 = 14; + +pub const EAI_AGAIN: i32 = 2; +pub const EAI_BADFLAGS: i32 = 3; +pub const EAI_FAIL: i32 = 4; +pub const EAI_FAMILY: i32 = 5; +pub const EAI_MEMORY: i32 = 6; +pub const EAI_NODATA: i32 = 7; +pub const EAI_NONAME: i32 = 8; +pub const EAI_SERVICE: i32 = 9; +pub const EAI_SOCKTYPE: i32 = 10; +pub const EAI_SYSTEM: i32 = 11; +pub const EAI_OVERFLOW: i32 = 14; + +pub const EFD_SEMAPHORE: i16 = 0o1; +pub const EFD_NONBLOCK: i16 = 0o4000; +pub const EFD_CLOEXEC: i16 = 0o40000; + +pub const F_DUPFD: i32 = 0; +pub const F_GETFD: i32 = 1; +pub const F_SETFD: i32 = 2; +pub const F_GETFL: i32 = 3; +pub const F_SETFL: i32 = 4; + +pub const FD_CLOEXEC: i32 = 1; + +pub const FIONBIO: i32 = 0x8008667e; + +pub const FUTEX_RELATIVE_TIMEOUT: u32 = 1; + +pub const IP_TOS: i32 = 1; +pub const IP_TTL: i32 = 2; +pub const IP_ADD_MEMBERSHIP: i32 = 3; +pub const IP_DROP_MEMBERSHIP: i32 = 4; +pub const IP_MULTICAST_TTL: i32 = 5; +pub const IP_MULTICAST_LOOP: i32 = 7; + +pub const IPPROTO_IP: i32 = 0; +pub const IPPROTO_TCP: i32 = 6; +pub const IPPROTO_UDP: i32 = 17; +pub const IPPROTO_IPV6: i32 = 41; + +pub const IPV6_ADD_MEMBERSHIP: i32 = 12; +pub const IPV6_DROP_MEMBERSHIP: i32 = 13; +pub const IPV6_MULTICAST_LOOP: i32 = 19; +pub const IPV6_V6ONLY: i32 = 27; + +pub const MSG_PEEK: i32 = 1; + +pub const O_RDONLY: i32 = 0o0; +pub const O_WRONLY: i32 = 0o1; +pub const O_RDWR: i32 = 0o2; +pub const O_CREAT: i32 = 0o100; +pub const O_EXCL: i32 = 0o200; +pub const O_TRUNC: i32 = 0o1000; +pub const O_APPEND: i32 = 0o2000; +pub const O_NONBLOCK: i32 = 0o4000; +pub const O_DIRECTORY: i32 = 0o200000; + +pub const POLLIN: i16 = 0x1; +pub const POLLPRI: i16 = 0x2; +pub const POLLOUT: i16 = 0x4; +pub const POLLERR: i16 = 0x8; +pub const POLLHUP: i16 = 0x10; +pub const POLLNVAL: i16 = 0x20; +pub const POLLRDNORM: i16 = 0x040; +pub const POLLRDBAND: i16 = 0x080; +pub const POLLWRNORM: i16 = 0x0100; +pub const POLLWRBAND: i16 = 0x0200; +pub const POLLRDHUP: i16 = 0x2000; + +pub const S_IRWXU: mode_t = 0o0700; +pub const S_IRUSR: mode_t = 0o0400; +pub const S_IWUSR: mode_t = 0o0200; +pub const S_IXUSR: mode_t = 0o0100; +pub const S_IRWXG: mode_t = 0o0070; +pub const S_IRGRP: mode_t = 0o0040; +pub const S_IWGRP: mode_t = 0o0020; +pub const S_IXGRP: mode_t = 0o0010; +pub const S_IRWXO: mode_t = 0o0007; +pub const S_IROTH: mode_t = 0o0004; +pub const S_IWOTH: mode_t = 0o0002; +pub const S_IXOTH: mode_t = 0o0001; + +pub const S_IFMT: mode_t = 0o17_0000; +pub const S_IFSOCK: mode_t = 0o14_0000; +pub const S_IFLNK: mode_t = 0o12_0000; +pub const S_IFREG: mode_t = 0o10_0000; +pub const S_IFBLK: mode_t = 0o6_0000; +pub const S_IFDIR: mode_t = 0o4_0000; +pub const S_IFCHR: mode_t = 0o2_0000; +pub const S_IFIFO: mode_t = 0o1_0000; + +pub const SHUT_RD: i32 = 0; +pub const SHUT_WR: i32 = 1; +pub const SHUT_RDWR: i32 = 2; + +pub const SO_REUSEADDR: i32 = 0x0004; +pub const SO_KEEPALIVE: i32 = 0x0008; +pub const SO_BROADCAST: i32 = 0x0020; +pub const SO_LINGER: i32 = 0x0080; +pub const SO_SNDBUF: i32 = 0x1001; +pub const SO_RCVBUF: i32 = 0x1002; +pub const SO_SNDTIMEO: i32 = 0x1005; +pub const SO_RCVTIMEO: i32 = 0x1006; +pub const SO_ERROR: i32 = 0x1007; + +pub const SOCK_STREAM: i32 = 1; +pub const SOCK_DGRAM: i32 = 2; +pub const SOCK_NONBLOCK: i32 = 0o4000; +pub const SOCK_CLOEXEC: i32 = 0o40000; + +pub const SOL_SOCKET: i32 = 4095; + +pub const STDIN_FILENO: c_int = 0; +pub const STDOUT_FILENO: c_int = 1; +pub const STDERR_FILENO: c_int = 2; + +pub const TCP_NODELAY: i32 = 1; + +pub const EPERM: i32 = 1; +pub const ENOENT: i32 = 2; +pub const ESRCH: i32 = 3; +pub const EINTR: i32 = 4; +pub const EIO: i32 = 5; +pub const ENXIO: i32 = 6; +pub const E2BIG: i32 = 7; +pub const ENOEXEC: i32 = 8; +pub const EBADF: i32 = 9; +pub const ECHILD: i32 = 10; +pub const EAGAIN: i32 = 11; +pub const ENOMEM: i32 = 12; +pub const EACCES: i32 = 13; +pub const EFAULT: i32 = 14; +pub const ENOTBLK: i32 = 15; +pub const EBUSY: i32 = 16; +pub const EEXIST: i32 = 17; +pub const EXDEV: i32 = 18; +pub const ENODEV: i32 = 19; +pub const ENOTDIR: i32 = 20; +pub const EISDIR: i32 = 21; +pub const EINVAL: i32 = 22; +pub const ENFILE: i32 = 23; +pub const EMFILE: i32 = 24; +pub const ENOTTY: i32 = 25; +pub const ETXTBSY: i32 = 26; +pub const EFBIG: i32 = 27; +pub const ENOSPC: i32 = 28; +pub const ESPIPE: i32 = 29; +pub const EROFS: i32 = 30; +pub const EMLINK: i32 = 31; +pub const EPIPE: i32 = 32; +pub const EDOM: i32 = 33; +pub const ERANGE: i32 = 34; +pub const EDEADLK: i32 = 35; +pub const ENAMETOOLONG: i32 = 36; +pub const ENOLCK: i32 = 37; +pub const ENOSYS: i32 = 38; +pub const ENOTEMPTY: i32 = 39; +pub const ELOOP: i32 = 40; +pub const EWOULDBLOCK: i32 = EAGAIN; +pub const ENOMSG: i32 = 42; +pub const EIDRM: i32 = 43; +pub const ECHRNG: i32 = 44; +pub const EL2NSYNC: i32 = 45; +pub const EL3HLT: i32 = 46; +pub const EL3RST: i32 = 47; +pub const ELNRNG: i32 = 48; +pub const EUNATCH: i32 = 49; +pub const ENOCSI: i32 = 50; +pub const EL2HLT: i32 = 51; +pub const EBADE: i32 = 52; +pub const EBADR: i32 = 53; +pub const EXFULL: i32 = 54; +pub const ENOANO: i32 = 55; +pub const EBADRQC: i32 = 56; +pub const EBADSLT: i32 = 57; +pub const EDEADLOCK: i32 = EDEADLK; +pub const EBFONT: i32 = 59; +pub const ENOSTR: i32 = 60; +pub const ENODATA: i32 = 61; +pub const ETIME: i32 = 62; +pub const ENOSR: i32 = 63; +pub const ENONET: i32 = 64; +pub const ENOPKG: i32 = 65; +pub const EREMOTE: i32 = 66; +pub const ENOLINK: i32 = 67; +pub const EADV: i32 = 68; +pub const ESRMNT: i32 = 69; +pub const ECOMM: i32 = 70; +pub const EPROTO: i32 = 71; +pub const EMULTIHOP: i32 = 72; +pub const EDOTDOT: i32 = 73; +pub const EBADMSG: i32 = 74; +pub const EOVERFLOW: i32 = 75; +pub const ENOTUNIQ: i32 = 76; +pub const EBADFD: i32 = 77; +pub const EREMCHG: i32 = 78; +pub const ELIBACC: i32 = 79; +pub const ELIBBAD: i32 = 80; +pub const ELIBSCN: i32 = 81; +pub const ELIBMAX: i32 = 82; +pub const ELIBEXEC: i32 = 83; +pub const EILSEQ: i32 = 84; +pub const ERESTART: i32 = 85; +pub const ESTRPIPE: i32 = 86; +pub const EUSERS: i32 = 87; +pub const ENOTSOCK: i32 = 88; +pub const EDESTADDRREQ: i32 = 89; +pub const EMSGSIZE: i32 = 90; +pub const EPROTOTYPE: i32 = 91; +pub const ENOPROTOOPT: i32 = 92; +pub const EPROTONOSUPPORT: i32 = 93; +pub const ESOCKTNOSUPPORT: i32 = 94; +pub const EOPNOTSUPP: i32 = 95; +pub const EPFNOSUPPORT: i32 = 96; +pub const EAFNOSUPPORT: i32 = 97; +pub const EADDRINUSE: i32 = 98; +pub const EADDRNOTAVAIL: i32 = 99; +pub const ENETDOWN: i32 = 100; +pub const ENETUNREACH: i32 = 101; +pub const ENETRESET: i32 = 102; +pub const ECONNABORTED: i32 = 103; +pub const ECONNRESET: i32 = 104; +pub const ENOBUFS: i32 = 105; +pub const EISCONN: i32 = 106; +pub const ENOTCONN: i32 = 107; +pub const ESHUTDOWN: i32 = 108; +pub const ETOOMANYREFS: i32 = 109; +pub const ETIMEDOUT: i32 = 110; +pub const ECONNREFUSED: i32 = 111; +pub const EHOSTDOWN: i32 = 112; +pub const EHOSTUNREACH: i32 = 113; +pub const EALREADY: i32 = 114; +pub const EINPROGRESS: i32 = 115; +pub const ESTALE: i32 = 116; +pub const EUCLEAN: i32 = 117; +pub const ENOTNAM: i32 = 118; +pub const ENAVAIL: i32 = 119; +pub const EISNAM: i32 = 120; +pub const EREMOTEIO: i32 = 121; +pub const EDQUOT: i32 = 122; +pub const ENOMEDIUM: i32 = 123; +pub const EMEDIUMTYPE: i32 = 124; +pub const ECANCELED: i32 = 125; +pub const ENOKEY: i32 = 126; +pub const EKEYEXPIRED: i32 = 127; +pub const EKEYREVOKED: i32 = 128; +pub const EKEYREJECTED: i32 = 129; +pub const EOWNERDEAD: i32 = 130; +pub const ENOTRECOVERABLE: i32 = 131; +pub const ERFKILL: i32 = 132; +pub const EHWPOISON: i32 = 133; + +extern "C" { + #[link_name = "sys_alloc"] + pub fn alloc(size: usize, align: usize) -> *mut u8; + + #[link_name = "sys_alloc_zeroed"] + pub fn alloc_zeroed(size: usize, align: usize) -> *mut u8; + + #[link_name = "sys_realloc"] + pub fn realloc(ptr: *mut u8, size: usize, align: usize, new_size: usize) -> *mut u8; + + #[link_name = "sys_dealloc"] + pub fn dealloc(ptr: *mut u8, size: usize, align: usize); + + #[link_name = "sys_exit"] + pub fn exit(status: i32) -> !; + + #[link_name = "sys_abort"] + pub fn abort() -> !; + + #[link_name = "sys_errno"] + pub fn errno() -> i32; + + #[link_name = "sys_clock_gettime"] + pub fn clock_gettime(clockid: clockid_t, tp: *mut timespec) -> i32; + + #[link_name = "sys_nanosleep"] + pub fn nanosleep(req: *const timespec) -> i32; + + #[link_name = "sys_available_parallelism"] + pub fn available_parallelism() -> usize; + + #[link_name = "sys_futex_wait"] + pub fn futex_wait( + address: *mut u32, + expected: u32, + timeout: *const timespec, + flags: u32, + ) -> i32; + + #[link_name = "sys_futex_wake"] + pub fn futex_wake(address: *mut u32, count: i32) -> i32; + + #[link_name = "sys_stat"] + pub fn stat(path: *const c_char, stat: *mut stat) -> i32; + + #[link_name = "sys_fstat"] + pub fn fstat(fd: i32, stat: *mut stat) -> i32; + + #[link_name = "sys_lstat"] + pub fn lstat(path: *const c_char, stat: *mut stat) -> i32; + + #[link_name = "sys_open"] + pub fn open(path: *const c_char, flags: i32, mode: mode_t) -> i32; + + #[link_name = "sys_unlink"] + pub fn unlink(path: *const c_char) -> i32; + + #[link_name = "sys_mkdir"] + pub fn mkdir(path: *const c_char, mode: mode_t) -> i32; + + #[link_name = "sys_rmdir"] + pub fn rmdir(path: *const c_char) -> i32; + + #[link_name = "sys_read"] + pub fn read(fd: i32, buf: *mut u8, len: usize) -> isize; + + #[link_name = "sys_write"] + pub fn write(fd: i32, buf: *const u8, len: usize) -> isize; + + #[link_name = "sys_readv"] + pub fn readv(fd: i32, iov: *const iovec, iovcnt: usize) -> isize; + + #[link_name = "sys_writev"] + pub fn writev(fd: i32, iov: *const iovec, iovcnt: usize) -> isize; + + #[link_name = "sys_close"] + pub fn close(fd: i32) -> i32; + + #[link_name = "sys_dup"] + pub fn dup(fd: i32) -> i32; + + #[link_name = "sys_fcntl"] + pub fn fcntl(fd: i32, cmd: i32, arg: i32) -> i32; + + #[link_name = "sys_getdents64"] + pub fn getdents64(fd: i32, dirp: *mut dirent64, count: usize) -> isize; + + #[link_name = "sys_getaddrinfo"] + pub fn getaddrinfo( + nodename: *const c_char, + servname: *const c_char, + hints: *const addrinfo, + res: *mut *mut addrinfo, + ) -> i32; + + #[link_name = "sys_freeaddrinfo"] + pub fn freeaddrinfo(ai: *mut addrinfo); + + #[link_name = "sys_socket"] + pub fn socket(domain: i32, ty: i32, protocol: i32) -> i32; + + #[link_name = "sys_bind"] + pub fn bind(sockfd: i32, addr: *const sockaddr, addrlen: socklen_t) -> i32; + + #[link_name = "sys_listen"] + pub fn listen(sockfd: i32, backlog: i32) -> i32; + + #[link_name = "sys_accept"] + pub fn accept(sockfd: i32, addr: *mut sockaddr, addrlen: *mut socklen_t) -> i32; + + #[link_name = "sys_connect"] + pub fn connect(sockfd: i32, addr: *const sockaddr, addrlen: socklen_t) -> i32; + + #[link_name = "sys_recv"] + pub fn recv(sockfd: i32, buf: *mut u8, len: usize, flags: i32) -> isize; + + #[link_name = "sys_recvfrom"] + pub fn recvfrom( + sockfd: i32, + buf: *mut c_void, + len: usize, + flags: i32, + addr: *mut sockaddr, + addrlen: *mut socklen_t, + ) -> isize; + + #[link_name = "sys_send"] + pub fn send(sockfd: i32, buf: *const c_void, len: usize, flags: i32) -> isize; + + #[link_name = "sys_sendto"] + pub fn sendto( + sockfd: i32, + buf: *const c_void, + len: usize, + flags: i32, + to: *const sockaddr, + tolen: socklen_t, + ) -> isize; + + #[link_name = "sys_getpeername"] + pub fn getpeername(sockfd: i32, addr: *mut sockaddr, addrlen: *mut socklen_t) -> i32; + + #[link_name = "sys_getsockname"] + pub fn getsockname(sockfd: i32, addr: *mut sockaddr, addrlen: *mut socklen_t) -> i32; + + #[link_name = "sys_getsockopt"] + pub fn getsockopt( + sockfd: i32, + level: i32, + optname: i32, + optval: *mut c_void, + optlen: *mut socklen_t, + ) -> i32; + + #[link_name = "sys_setsockopt"] + pub fn setsockopt( + sockfd: i32, + level: i32, + optname: i32, + optval: *const c_void, + optlen: socklen_t, + ) -> i32; + + #[link_name = "sys_ioctl"] + pub fn ioctl(sockfd: i32, cmd: i32, argp: *mut c_void) -> i32; + + #[link_name = "sys_shutdown"] + pub fn shutdown(sockfd: i32, how: i32) -> i32; + + #[link_name = "sys_eventfd"] + pub fn eventfd(initval: u64, flags: i16) -> i32; + + #[link_name = "sys_poll"] + pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: i32) -> i32; +} + +pub use ffi::c_void; diff --git a/src/hermit/aarch64.rs b/src/hermit/aarch64.rs deleted file mode 100644 index 1a92e3b4fa341..0000000000000 --- a/src/hermit/aarch64.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub type c_char = u8; -pub type wchar_t = u32; diff --git a/src/hermit/mod.rs b/src/hermit/mod.rs deleted file mode 100644 index b80a5cdffc107..0000000000000 --- a/src/hermit/mod.rs +++ /dev/null @@ -1,43 +0,0 @@ -//! Hermit C types definition - -pub type c_schar = i8; -pub type c_uchar = u8; -pub type c_short = i16; -pub type c_ushort = u16; -pub type c_int = i32; -pub type c_uint = u32; -pub type c_float = f32; -pub type c_double = f64; -pub type c_longlong = i64; -pub type c_ulonglong = u64; -pub type intmax_t = i64; -pub type uintmax_t = u64; - -pub type size_t = usize; -pub type ptrdiff_t = isize; -pub type intptr_t = isize; -pub type uintptr_t = usize; -pub type ssize_t = isize; - -pub type c_long = i64; -pub type c_ulong = u64; - -pub type wint_t = u32; -pub type wctype_t = i64; - -pub type regoff_t = size_t; -pub type off_t = c_long; - -cfg_if! { - if #[cfg(target_arch = "aarch64")] { - mod aarch64; - pub use self::aarch64::*; - } else if #[cfg(target_arch = "x86_64")] { - mod x86_64; - pub use self::x86_64::*; - } else { - // Unknown target_arch - } -} - -pub use ffi::c_void; diff --git a/src/hermit/x86_64.rs b/src/hermit/x86_64.rs deleted file mode 100644 index 76ec3ce823e8f..0000000000000 --- a/src/hermit/x86_64.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub type c_char = i8; -pub type wchar_t = i32; diff --git a/src/lib.rs b/src/lib.rs index 4d4587e995e1c..1fe44ce6eef08 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,11 +12,14 @@ redundant_semicolons, unused_macros, unused_macro_rules, + // FIXME: temporarily allow dead_code to fix CI: + // - https://github.com/rust-lang/libc/issues/3740 + // - https://github.com/rust-lang/rust/pull/126456 + dead_code, )] #![cfg_attr(libc_deny_warnings, deny(warnings))] // Attributes needed when building as part of the standard library #![cfg_attr(feature = "rustc-dep-of-std", feature(link_cfg, no_core))] -#![cfg_attr(libc_thread_local, feature(thread_local))] // Enable extra lints: #![cfg_attr(feature = "extra_traits", deny(missing_debug_implementations))] #![deny(missing_copy_implementations, safe_packed_borrows)] diff --git a/src/macros.rs b/src/macros.rs index 8119ae5fad05d..7090e6d1d1538 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -61,13 +61,23 @@ macro_rules! cfg_if { }; } +/// Implement `Clone` and `Copy` for a struct, as well as `Debug`, `Eq`, `Hash`, and +/// `PartialEq` if the `extra_traits` feature is enabled. +/// +/// Use [`s_no_extra_traits`] for structs where the `extra_traits` feature does not +/// make sense, and for unions. macro_rules! s { - ($($(#[$attr:meta])* pub $t:ident $i:ident { $($field:tt)* })*) => ($( + ($( + $(#[$attr:meta])* + pub $t:ident $i:ident { $($field:tt)* } + )*) => ($( s!(it: $(#[$attr])* pub $t $i { $($field)* }); )*); + (it: $(#[$attr:meta])* pub union $i:ident { $($field:tt)* }) => ( compile_error!("unions cannot derive extra traits, use s_no_extra_traits instead"); ); + (it: $(#[$attr:meta])* pub struct $i:ident { $($field:tt)* }) => ( __item! { #[repr(C)] @@ -85,10 +95,38 @@ macro_rules! s { ); } +/// Implement `Clone` and `Copy` for a tuple struct, as well as `Debug`, `Eq`, `Hash`, +/// and `PartialEq` if the `extra_traits` feature is enabled. +/// +/// This is the same as [`s`] but works for tuple structs. +macro_rules! s_paren { + ($( + $(#[$attr:meta])* + pub struct $i:ident ( $($field:tt)* ); + )*) => ($( + __item! { + #[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] + $(#[$attr])* + pub struct $i ( $($field)* ); + } + impl ::Copy for $i {} + impl ::Clone for $i { + fn clone(&self) -> $i { *self } + } + )*); +} + +/// Implement `Clone` and `Copy` for a struct with no `extra_traits` feature. +/// +/// Most items will prefer to use [`s`]. macro_rules! s_no_extra_traits { - ($($(#[$attr:meta])* pub $t:ident $i:ident { $($field:tt)* })*) => ($( + ($( + $(#[$attr:meta])* + pub $t:ident $i:ident { $($field:tt)* } + )*) => ($( s_no_extra_traits!(it: $(#[$attr])* pub $t $i { $($field)* }); )*); + (it: $(#[$attr:meta])* pub union $i:ident { $($field:tt)* }) => ( __item! { #[repr(C)] @@ -101,6 +139,7 @@ macro_rules! s_no_extra_traits { fn clone(&self) -> $i { *self } } ); + (it: $(#[$attr:meta])* pub struct $i:ident { $($field:tt)* }) => ( __item! { #[repr(C)] @@ -116,14 +155,26 @@ macro_rules! s_no_extra_traits { ); } +/// Specify that an enum should have no traits that aren't specified in the macro +/// invocation, i.e. no `Clone` or `Copy`. macro_rules! missing { - ($($(#[$attr:meta])* pub enum $i:ident {})*) => ($( - $(#[$attr])* #[allow(missing_copy_implementations)] pub enum $i { } + ($( + $(#[$attr:meta])* + pub enum $i:ident {} + )*) => ($( + $(#[$attr])* + #[allow(missing_copy_implementations)] + pub enum $i { } )*); } +/// Implement `Clone` and `Copy` for an enum, as well as `Debug`, `Eq`, `Hash`, and +/// `PartialEq` if the `extra_traits` feature is enabled. macro_rules! e { - ($($(#[$attr:meta])* pub enum $i:ident { $($field:tt)* })*) => ($( + ($( + $(#[$attr:meta])* + pub enum $i:ident { $($field:tt)* } + )*) => ($( __item! { #[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] $(#[$attr])* @@ -136,89 +187,80 @@ macro_rules! e { )*); } -macro_rules! s_paren { - ($($(#[$attr:meta])* pub struct $i:ident ( $($field:tt)* ); )* ) => ($( - __item! { - #[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))] - $(#[$attr])* - pub struct $i ( $($field)* ); - } - impl ::Copy for $i {} - impl ::Clone for $i { - fn clone(&self) -> $i { *self } - } - )*); -} - cfg_if! { if #[cfg(feature = "const-extern-fn")] { + /// Define an `unsafe` function that is const as long as `const-extern-fn` is enabled. macro_rules! f { - ($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident( - $($arg:ident: $argty:ty),* - ) -> $ret:ty { - $($body:stmt);* - })*) => ($( + ($( + $(#[$attr:meta])* + pub $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),*) -> $ret:ty { + $($body:stmt);* + } + )*) => ($( #[inline] $(#[$attr])* - pub $($constness)* unsafe extern fn $i($($arg: $argty),* - ) -> $ret { + pub $($constness)* unsafe extern fn $i($($arg: $argty),*) -> $ret { $($body);* } )*) } + /// Define a safe function that is const as long as `const-extern-fn` is enabled. macro_rules! safe_f { - ($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident( - $($arg:ident: $argty:ty),* - ) -> $ret:ty { - $($body:stmt);* - })*) => ($( + ($( + $(#[$attr:meta])* + pub $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),*) -> $ret:ty { + $($body:stmt);* + } + )*) => ($( #[inline] $(#[$attr])* - pub $($constness)* extern fn $i($($arg: $argty),* - ) -> $ret { + pub $($constness)* extern fn $i($($arg: $argty),*) -> $ret { $($body);* } )*) } + /// A nonpublic function that is const as long as `const-extern-fn` is enabled. macro_rules! const_fn { - ($($(#[$attr:meta])* $({$constness:ident})* fn $i:ident( - $($arg:ident: $argty:ty),* - ) -> $ret:ty { - $($body:stmt);* - })*) => ($( + ($( + $(#[$attr:meta])* + $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),*) -> $ret:ty { + $($body:stmt);* + } + )*) => ($( #[inline] $(#[$attr])* - $($constness)* fn $i($($arg: $argty),* - ) -> $ret { + $($constness)* fn $i($($arg: $argty),*) -> $ret { $($body);* } )*) } - } else { + /// Define an `unsafe` function that is const as long as `const-extern-fn` is enabled. macro_rules! f { - ($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident( - $($arg:ident: $argty:ty),* - ) -> $ret:ty { - $($body:stmt);* - })*) => ($( + ($( + $(#[$attr:meta])* + pub $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),*) -> $ret:ty { + $($body:stmt);* + } + )*) => ($( #[inline] $(#[$attr])* - pub unsafe extern fn $i($($arg: $argty),* - ) -> $ret { + pub unsafe extern fn $i($($arg: $argty),*) -> $ret { $($body);* } )*) } + /// Define a safe function that is const as long as `const-extern-fn` is enabled. macro_rules! safe_f { - ($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident( - $($arg:ident: $argty:ty),* - ) -> $ret:ty { - $($body:stmt);* - })*) => ($( + ($( + $(#[$attr:meta])* + pub $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),*) -> $ret:ty { + $($body:stmt);* + } + )*) => ($( #[inline] $(#[$attr])* pub extern fn $i($($arg: $argty),* @@ -228,16 +270,17 @@ cfg_if! { )*) } + /// A nonpublic function that is const as long as `const-extern-fn` is enabled. macro_rules! const_fn { - ($($(#[$attr:meta])* $({$constness:ident})* fn $i:ident( - $($arg:ident: $argty:ty),* - ) -> $ret:ty { - $($body:stmt);* - })*) => ($( + ($( + $(#[$attr:meta])* + $({$constness:ident})* fn $i:ident($($arg:ident: $argty:ty),*) -> $ret:ty { + $($body:stmt);* + } + )*) => ($( #[inline] $(#[$attr])* - fn $i($($arg: $argty),* - ) -> $ret { + fn $i($($arg: $argty),*) -> $ret { $($body);* } )*) @@ -251,40 +294,6 @@ macro_rules! __item { }; } -// This macro is used to deprecate items that should be accessed via the mach2 crate -macro_rules! deprecated_mach { - (pub const $id:ident: $ty:ty = $expr:expr;) => { - #[deprecated( - since = "0.2.55", - note = "Use the `mach2` crate instead", - )] - #[allow(deprecated)] - pub const $id: $ty = $expr; - }; - ($(pub const $id:ident: $ty:ty = $expr:expr;)*) => { - $( - deprecated_mach!( - pub const $id: $ty = $expr; - ); - )* - }; - (pub type $id:ident = $ty:ty;) => { - #[deprecated( - since = "0.2.55", - note = "Use the `mach2` crate instead", - )] - #[allow(deprecated)] - pub type $id = $ty; - }; - ($(pub type $id:ident = $ty:ty;)*) => { - $( - deprecated_mach!( - pub type $id = $ty; - ); - )* - } -} - macro_rules! ptr_addr_of { ($place:expr) => { ::core::ptr::addr_of!($place) diff --git a/src/solid/mod.rs b/src/solid/mod.rs index c88c663ee3f8c..4c880796340eb 100644 --- a/src/solid/mod.rs +++ b/src/solid/mod.rs @@ -209,15 +209,15 @@ pub const O_EXCL: c_int = 0x400; pub const O_TEXT: c_int = 0x100; pub const O_BINARY: c_int = 0x200; pub const O_TRUNC: c_int = 0x20; -pub const S_IEXEC: c_short = 0x0040; -pub const S_IWRITE: c_short = 0x0080; -pub const S_IREAD: c_short = 0x0100; -pub const S_IFCHR: c_short = 0x2000; -pub const S_IFDIR: c_short = 0x4000; -pub const S_IFMT: c_short = 0o160000; -pub const S_IFIFO: c_short = 0o0010000; -pub const S_IFBLK: c_short = 0o0060000; -pub const S_IFREG: c_short = 0o0100000; +pub const S_IEXEC: c_short = 0o0100; +pub const S_IWRITE: c_short = 0o0200; +pub const S_IREAD: c_short = 0o0400; +pub const S_IFCHR: c_short = 0o2_0000; +pub const S_IFDIR: c_short = 0o4_0000; +pub const S_IFMT: c_short = 0o16_0000; +pub const S_IFIFO: c_short = 0o1_0000; +pub const S_IFBLK: c_short = 0o6_0000; +pub const S_IFREG: c_short = 0o10_0000; pub const LC_ALL: c_int = 0; pub const LC_COLLATE: c_int = 1; diff --git a/src/teeos/mod.rs b/src/teeos/mod.rs index 25e06ffaa3b10..35232d63b9778 100644 --- a/src/teeos/mod.rs +++ b/src/teeos/mod.rs @@ -48,7 +48,7 @@ pub type ssize_t = isize; pub type pid_t = c_int; -// aarch64 specifc +// aarch64 specific pub type c_char = u8; pub type wchar_t = u32; @@ -61,9 +61,9 @@ pub type c_ulong = u64; pub struct _CLongDouble(pub u128); // long double in C means A float point value, which has 128bit length. -// but some bit maybe not used, so the really length of long double could be 80(x86) or 128(power pc/IEEE) +// but some bit maybe not used, so the real length of long double could be 80(x86) or 128(power pc/IEEE) // this is different from f128(not stable and not included default) in Rust, so we use u128 for FFI(Rust to C). -// this is unstable and will couse to memfault/data abort. +// this is unstable and will cause to memfault/data abort. pub type c_longdouble = _CLongDouble; pub type pthread_t = c_ulong; @@ -177,41 +177,41 @@ pub struct div_t { } // fcntl -pub const O_CREAT: u32 = 0100; +pub const O_CREAT: u32 = 0o100; -pub const O_EXCL: u32 = 0200; +pub const O_EXCL: u32 = 0o200; -pub const O_NOCTTY: u32 = 0400; +pub const O_NOCTTY: u32 = 0o400; -pub const O_TRUNC: u32 = 01000; +pub const O_TRUNC: u32 = 0o1000; -pub const O_APPEND: u32 = 02000; +pub const O_APPEND: u32 = 0o2000; -pub const O_NONBLOCK: u32 = 04000; +pub const O_NONBLOCK: u32 = 0o4000; -pub const O_DSYNC: u32 = 010000; +pub const O_DSYNC: u32 = 0o10000; -pub const O_SYNC: u32 = 04010000; +pub const O_SYNC: u32 = 0o4010000; -pub const O_RSYNC: u32 = 04010000; +pub const O_RSYNC: u32 = 0o4010000; -pub const O_DIRECTORY: u32 = 0200000; +pub const O_DIRECTORY: u32 = 0o200000; -pub const O_NOFOLLOW: u32 = 0400000; +pub const O_NOFOLLOW: u32 = 0o400000; -pub const O_CLOEXEC: u32 = 02000000; +pub const O_CLOEXEC: u32 = 0o2000000; -pub const O_ASYNC: u32 = 020000; +pub const O_ASYNC: u32 = 0o20000; -pub const O_DIRECT: u32 = 040000; +pub const O_DIRECT: u32 = 0o40000; -pub const O_LARGEFILE: u32 = 0100000; +pub const O_LARGEFILE: u32 = 0o100000; -pub const O_NOATIME: u32 = 01000000; +pub const O_NOATIME: u32 = 0o1000000; -pub const O_PATH: u32 = 010000000; +pub const O_PATH: u32 = 0o10000000; -pub const O_TMPFILE: u32 = 020200000; +pub const O_TMPFILE: u32 = 0o20200000; pub const O_NDELAY: u32 = O_NONBLOCK; diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index a1ab1d4dfb36a..e870d5b91ce79 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -1,4 +1,4 @@ -pub type c_char = i8; +pub type c_char = u8; pub type caddr_t = *mut ::c_char; pub type clockid_t = ::c_longlong; pub type blkcnt_t = ::c_long; @@ -17,7 +17,7 @@ pub type rlim_t = ::c_ulong; pub type speed_t = ::c_uint; pub type tcflag_t = ::c_uint; pub type time_t = ::c_long; -pub type time64_t = ::int64_t; +pub type time64_t = u64; pub type timer_t = ::c_long; pub type wchar_t = ::c_uint; pub type nfds_t = ::c_int; @@ -25,7 +25,7 @@ pub type projid_t = ::c_int; pub type id_t = ::c_uint; pub type blksize64_t = ::c_ulonglong; pub type blkcnt64_t = ::c_ulonglong; -pub type sctp_assoc_t = ::uint32_t; +pub type sctp_assoc_t = u32; pub type suseconds_t = ::c_int; pub type useconds_t = ::c_uint; @@ -60,6 +60,7 @@ pub type posix_spawn_file_actions_t = *mut ::c_char; pub type iconv_t = *mut ::c_void; e! { + #[repr(u32)] pub enum uio_rw { UIO_READ = 0, UIO_WRITE, @@ -573,7 +574,7 @@ cfg_if! { } impl Eq for __sigaction_sa_union {} impl ::fmt::Debug for __sigaction_sa_union { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { f.debug_struct("__sigaction_sa_union") .field("__su_handler", unsafe { &self.__su_handler }) .field("__su_sigaction", unsafe { &self.__su_sigaction }) @@ -599,7 +600,7 @@ cfg_if! { } impl Eq for sigaction {} impl ::fmt::Debug for sigaction { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { let mut struct_formatter = f.debug_struct("sigaction"); struct_formatter.field("sa_union", &self.sa_union); struct_formatter.field("sa_mask", &self.sa_mask); @@ -626,7 +627,7 @@ cfg_if! { } impl Eq for __poll_ctl_ext_u {} impl ::fmt::Debug for __poll_ctl_ext_u { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { f.debug_struct("__poll_ctl_ext_u") .field("addr", unsafe { &self.addr }) .field("data32", unsafe { &self.data32 }) @@ -657,7 +658,7 @@ cfg_if! { } impl Eq for poll_ctl_ext {} impl ::fmt::Debug for poll_ctl_ext { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { let mut struct_formatter = f.debug_struct("poll_ctl_ext"); struct_formatter.field("version", &self.version); struct_formatter.field("command", &self.command); @@ -961,8 +962,6 @@ pub const BPF_X: ::c_int = 8; // net/if.h pub const IFNET_SLOWHZ: ::c_int = 1; pub const IFQ_MAXLEN: ::c_int = 50; -pub const IF_NAMESIZE: ::c_int = 16; -pub const IFNAMSIZ: ::c_int = 16; pub const IFF_UP: ::c_int = 0x1; pub const IFF_BROADCAST: ::c_int = 0x2; pub const IFF_DEBUG: ::c_int = 0x4; @@ -985,8 +984,6 @@ pub const ARPHRD_ETHER: ::c_int = 1; pub const ARPHRD_802_5: ::c_int = 6; pub const ARPHRD_802_3: ::c_int = 6; pub const ARPHRD_FDDI: ::c_int = 1; -pub const ARPOP_REQUEST: ::c_int = 1; -pub const ARPOP_REPLY: ::c_int = 2; // net/route.h pub const RTM_ADD: ::c_int = 0x1; @@ -1188,6 +1185,7 @@ pub const TCP_KEEPCNT: ::c_int = 0x13; pub const TCP_NODELAYACK: ::c_int = 0x14; // pthread.h +pub const PTHREAD_BARRIER_SERIAL_THREAD: ::c_int = -1; pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0; pub const PTHREAD_CREATE_DETACHED: ::c_int = 1; pub const PTHREAD_PROCESS_SHARED: ::c_int = 0; @@ -1252,13 +1250,13 @@ pub const ENTER: ::c_int = 1; pub const SEM_FAILED: *mut sem_t = -1isize as *mut ::sem_t; // spawn.h -pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x1; -pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x2; -pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x4; -pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x8; -pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_int = 0x10; -pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x20; -pub const POSIX_SPAWN_FORK_HANDLERS: ::c_int = 0x1000; +pub const POSIX_SPAWN_SETPGROUP: ::c_short = 0x1; +pub const POSIX_SPAWN_SETSIGMASK: ::c_short = 0x2; +pub const POSIX_SPAWN_SETSIGDEF: ::c_short = 0x4; +pub const POSIX_SPAWN_SETSCHEDULER: ::c_short = 0x8; +pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_short = 0x10; +pub const POSIX_SPAWN_RESETIDS: ::c_short = 0x20; +pub const POSIX_SPAWN_FORK_HANDLERS: ::c_short = 0x1000; // stdio.h pub const EOF: ::c_int = -1; @@ -1594,29 +1592,29 @@ pub const MADV_WILLNEED: ::c_int = 3; pub const MADV_DONTNEED: ::c_int = 4; // sys/mode.h -pub const S_IFMT: mode_t = 0o170000; -pub const S_IFREG: mode_t = 0o100000; -pub const S_IFDIR: mode_t = 0o40000; -pub const S_IFBLK: mode_t = 0o60000; -pub const S_IFCHR: mode_t = 0o20000; -pub const S_IFIFO: mode_t = 0o10000; -pub const S_IRWXU: mode_t = 0o700; -pub const S_IRUSR: mode_t = 0o400; -pub const S_IWUSR: mode_t = 0o200; -pub const S_IXUSR: mode_t = 0o100; -pub const S_IRWXG: mode_t = 0o70; -pub const S_IRGRP: mode_t = 0o40; -pub const S_IWGRP: mode_t = 0o20; -pub const S_IXGRP: mode_t = 0o10; -pub const S_IRWXO: mode_t = 7; -pub const S_IROTH: mode_t = 4; -pub const S_IWOTH: mode_t = 2; -pub const S_IXOTH: mode_t = 1; -pub const S_IFLNK: mode_t = 0o120000; -pub const S_IFSOCK: mode_t = 0o140000; -pub const S_IEXEC: mode_t = 0o100; -pub const S_IWRITE: mode_t = 0o200; -pub const S_IREAD: mode_t = 0o400; +pub const S_IFMT: mode_t = 0o17_0000; +pub const S_IFREG: mode_t = 0o10_0000; +pub const S_IFDIR: mode_t = 0o4_0000; +pub const S_IFBLK: mode_t = 0o6_0000; +pub const S_IFCHR: mode_t = 0o2_0000; +pub const S_IFIFO: mode_t = 0o1_0000; +pub const S_IRWXU: mode_t = 0o0700; +pub const S_IRUSR: mode_t = 0o0400; +pub const S_IWUSR: mode_t = 0o0200; +pub const S_IXUSR: mode_t = 0o0100; +pub const S_IRWXG: mode_t = 0o0070; +pub const S_IRGRP: mode_t = 0o0040; +pub const S_IWGRP: mode_t = 0o0020; +pub const S_IXGRP: mode_t = 0o0010; +pub const S_IRWXO: mode_t = 0o0007; +pub const S_IROTH: mode_t = 0o0004; +pub const S_IWOTH: mode_t = 0o0002; +pub const S_IXOTH: mode_t = 0o0001; +pub const S_IFLNK: mode_t = 0o12_0000; +pub const S_IFSOCK: mode_t = 0o14_0000; +pub const S_IEXEC: mode_t = 0o0100; +pub const S_IWRITE: mode_t = 0o0200; +pub const S_IREAD: mode_t = 0o0400; // sys/msg.h pub const MSG_NOERROR: ::c_int = 0o10000; @@ -2810,11 +2808,7 @@ extern "C" { ) -> ::c_int; pub fn fattach(fildes: ::c_int, path: *const ::c_char) -> ::c_int; pub fn fdatasync(fd: ::c_int) -> ::c_int; - pub fn fexecve( - fd: ::c_int, - argv: *const *const ::c_char, - envp: *const *const ::c_char, - ) -> ::c_int; + pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int; pub fn ffs(value: ::c_int) -> ::c_int; pub fn ffsl(value: ::c_long) -> ::c_int; pub fn ffsll(value: ::c_longlong) -> ::c_int; diff --git a/src/unix/aix/powerpc64.rs b/src/unix/aix/powerpc64.rs index deec291b28dca..ff5f77a74a2f6 100644 --- a/src/unix/aix/powerpc64.rs +++ b/src/unix/aix/powerpc64.rs @@ -307,7 +307,7 @@ cfg_if! { } impl Eq for siginfo_t {} impl ::fmt::Debug for siginfo_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { let mut struct_formatter = f.debug_struct("siginfo_t"); struct_formatter.field("si_signo", &self.si_signo); struct_formatter.field("si_errno", &self.si_errno); @@ -347,7 +347,7 @@ cfg_if! { } impl Eq for _kernel_simple_lock {} impl ::fmt::Debug for _kernel_simple_lock { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { f.debug_struct("_kernel_simple_lock") .field("_slock", unsafe { &self._slock }) .field("_slockp", unsafe { &self._slockp }) @@ -374,7 +374,7 @@ cfg_if! { } impl Eq for fileops_t {} impl ::fmt::Debug for fileops_t { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { let mut struct_formatter = f.debug_struct("fileops_t"); struct_formatter.field("fo_rw", &self.fo_rw); struct_formatter.field("fo_ioctl", &self.fo_ioctl); @@ -415,7 +415,7 @@ cfg_if! { } impl Eq for file {} impl ::fmt::Debug for file { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { let mut struct_formatter = f.debug_struct("file"); struct_formatter.field("f_flag", &self.f_flag); struct_formatter.field("f_count", &self.f_count); @@ -466,7 +466,7 @@ cfg_if! { } impl Eq for __ld_info_file {} impl ::fmt::Debug for __ld_info_file { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { f.debug_struct("__ld_info_file") .field("_ldinfo_fd", unsafe { &self._ldinfo_fd }) .field("_ldinfo_fp", unsafe { &self._ldinfo_fp }) @@ -498,7 +498,7 @@ cfg_if! { } impl Eq for ld_info {} impl ::fmt::Debug for ld_info { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { let mut struct_formatter = f.debug_struct("ld_info"); struct_formatter.field("ldinfo_next", &self.ldinfo_next); struct_formatter.field("ldinfo_flags", &self.ldinfo_flags); @@ -535,7 +535,7 @@ cfg_if! { } impl Eq for __pollfd_ext_u {} impl ::fmt::Debug for __pollfd_ext_u { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { f.debug_struct("__pollfd_ext_u") .field("addr", unsafe { &self.addr }) .field("data32", unsafe { &self.data32 }) @@ -563,7 +563,7 @@ cfg_if! { } impl Eq for pollfd_ext {} impl ::fmt::Debug for pollfd_ext { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + fn fmt(&self, f: &mut ::fmt::Formatter<'_>) -> ::fmt::Result { let mut struct_formatter = f.debug_struct("pollfd_ext"); struct_formatter.field("fd", &self.fd); struct_formatter.field("events", &self.events); diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index b475c4b6797fb..9a5dc357fd038 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -37,6 +37,8 @@ pub type rusage_info_t = *mut ::c_void; pub type vm_offset_t = ::uintptr_t; pub type vm_size_t = ::uintptr_t; pub type vm_address_t = vm_offset_t; +pub type quad_t = i64; +pub type u_quad_t = u64; pub type posix_spawnattr_t = *mut ::c_void; pub type posix_spawn_file_actions_t = *mut ::c_void; @@ -121,6 +123,11 @@ pub type pthread_introspection_hook_t = extern "C" fn(event: ::c_uint, thread: ::pthread_t, addr: *mut ::c_void, size: ::size_t); pub type pthread_jit_write_callback_t = ::Option ::c_int>; +pub type os_clockid_t = u32; + +pub type os_sync_wait_on_address_flags_t = u32; +pub type os_sync_wake_by_address_flags_t = u32; + pub type os_unfair_lock = os_unfair_lock_s; pub type os_unfair_lock_t = *mut os_unfair_lock; @@ -159,10 +166,6 @@ pub type copyfile_callback_t = ::Option< pub type attrgroup_t = u32; pub type vol_capabilities_set_t = [u32; 4]; -deprecated_mach! { - pub type mach_timebase_info_data_t = mach_timebase_info; -} - #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} impl ::Copy for timezone {} @@ -295,15 +298,6 @@ s! { pub ai_next: *mut addrinfo, } - #[deprecated( - since = "0.2.55", - note = "Use the `mach2` crate instead", - )] - pub struct mach_timebase_info { - pub numer: u32, - pub denom: u32, - } - pub struct stat { pub st_dev: dev_t, pub st_mode: mode_t, @@ -504,8 +498,7 @@ s! { pub rmx_rtt: u32, pub rmx_rttvar: u32, pub rmx_pksent: u32, - pub rmx_state: u32, - pub rmx_filler: [u32; 3], + pub rmx_filler: [u32; 4], } pub struct rt_msghdr { @@ -656,35 +649,6 @@ s! { pub cr_groups: [::gid_t;16] } - #[deprecated( - since = "0.2.55", - note = "Use the `mach2` crate instead", - )] - pub struct mach_header { - pub magic: u32, - pub cputype: cpu_type_t, - pub cpusubtype: cpu_subtype_t, - pub filetype: u32, - pub ncmds: u32, - pub sizeofcmds: u32, - pub flags: u32, - } - - #[deprecated( - since = "0.2.55", - note = "Use the `mach2` crate instead", - )] - pub struct mach_header_64 { - pub magic: u32, - pub cputype: cpu_type_t, - pub cpusubtype: cpu_subtype_t, - pub filetype: u32, - pub ncmds: u32, - pub sizeofcmds: u32, - pub flags: u32, - pub reserved: u32, - } - pub struct segment_command { pub cmd: u32, pub cmdsize: u32, @@ -1130,12 +1094,6 @@ s! { pub nativeattr: attribute_set_t, } - #[repr(packed(4))] - pub struct ifconf { - pub ifc_len: ::c_int, - pub ifc_ifcu: __c_anonymous_ifc_ifcu, - } - #[repr(align(8))] pub struct tcp_connection_info { pub tcpi_state: u8, @@ -1178,9 +1136,86 @@ s! { pub tcpi_rxoutoforderbytes: u64, pub tcpi_rxretransmitpackets: u64, } + + pub struct in6_addrlifetime { + pub ia6t_expire: time_t, + pub ia6t_preferred: time_t, + pub ia6t_vltime: u32, + pub ia6t_pltime: u32, + } + + pub struct in6_ifstat { + pub ifs6_in_receive: ::u_quad_t, + pub ifs6_in_hdrerr: ::u_quad_t, + pub ifs6_in_toobig: ::u_quad_t, + pub ifs6_in_noroute: ::u_quad_t, + pub ifs6_in_addrerr: ::u_quad_t, + pub ifs6_in_protounknown: ::u_quad_t, + pub ifs6_in_truncated: ::u_quad_t, + pub ifs6_in_discard: ::u_quad_t, + pub ifs6_in_deliver: ::u_quad_t, + pub ifs6_out_forward: ::u_quad_t, + pub ifs6_out_request: ::u_quad_t, + pub ifs6_out_discard: ::u_quad_t, + pub ifs6_out_fragok: ::u_quad_t, + pub ifs6_out_fragfail: ::u_quad_t, + pub ifs6_out_fragcreat: ::u_quad_t, + pub ifs6_reass_reqd: ::u_quad_t, + pub ifs6_reass_ok: ::u_quad_t, + pub ifs6_atmfrag_rcvd: ::u_quad_t, + pub ifs6_reass_fail: ::u_quad_t, + pub ifs6_in_mcast: ::u_quad_t, + pub ifs6_out_mcast: ::u_quad_t, + pub ifs6_cantfoward_icmp6: ::u_quad_t, + pub ifs6_addr_expiry_cnt: ::u_quad_t, + pub ifs6_pfx_expiry_cnt: ::u_quad_t, + pub ifs6_defrtr_expiry_cnt: ::u_quad_t, + } + pub struct icmp6_ifstat { + pub ifs6_in_msg: ::u_quad_t, + pub ifs6_in_error: ::u_quad_t, + pub ifs6_in_dstunreach: ::u_quad_t, + pub ifs6_in_adminprohib: ::u_quad_t, + pub ifs6_in_timeexceed: ::u_quad_t, + pub ifs6_in_paramprob: ::u_quad_t, + pub ifs6_in_pkttoobig: ::u_quad_t, + pub ifs6_in_echo: ::u_quad_t, + pub ifs6_in_echoreply: ::u_quad_t, + pub ifs6_in_routersolicit: ::u_quad_t, + pub ifs6_in_routeradvert: ::u_quad_t, + pub ifs6_in_neighborsolicit: ::u_quad_t, + pub ifs6_in_neighboradvert: ::u_quad_t, + pub ifs6_in_redirect: ::u_quad_t, + pub ifs6_in_mldquery: ::u_quad_t, + pub ifs6_in_mldreport: ::u_quad_t, + pub ifs6_in_mlddone: ::u_quad_t, + pub ifs6_out_msg: ::u_quad_t, + pub ifs6_out_error: ::u_quad_t, + pub ifs6_out_dstunreach: ::u_quad_t, + pub ifs6_out_adminprohib: ::u_quad_t, + pub ifs6_out_timeexceed: ::u_quad_t, + pub ifs6_out_paramprob: ::u_quad_t, + pub ifs6_out_pkttoobig: ::u_quad_t, + pub ifs6_out_echo: ::u_quad_t, + pub ifs6_out_echoreply: ::u_quad_t, + pub ifs6_out_routersolicit: ::u_quad_t, + pub ifs6_out_routeradvert: ::u_quad_t, + pub ifs6_out_neighborsolicit: ::u_quad_t, + pub ifs6_out_neighboradvert: ::u_quad_t, + pub ifs6_out_redirect: ::u_quad_t, + pub ifs6_out_mldquery: ::u_quad_t, + pub ifs6_out_mldreport: ::u_quad_t, + pub ifs6_out_mlddone: ::u_quad_t, + } } s_no_extra_traits! { + #[repr(packed(4))] + pub struct ifconf { + pub ifc_len: ::c_int, + pub ifc_ifcu: __c_anonymous_ifc_ifcu, + } + #[repr(packed(4))] pub struct kevent { pub ident: ::uintptr_t, @@ -1515,6 +1550,25 @@ s_no_extra_traits! { pub ifcu_buf: *mut ::c_char, pub ifcu_req: *mut ifreq, } + + pub union __c_anonymous_ifr_ifru6 { + pub ifru_addr: ::sockaddr_in6, + pub ifru_dstaddr: ::sockaddr_in6, + pub ifru_flags: ::c_int, + pub ifru_flags6: ::c_int, + pub ifru_metrics: ::c_int, + pub ifru_intval: ::c_int, + pub ifru_data: *mut ::c_char, + pub ifru_lifetime: in6_addrlifetime, + pub ifru_stat: in6_ifstat, + pub ifru_icmp6stat: icmp6_ifstat, + pub ifru_scope_id: [u32; SCOPE6_ID_MAX], + } + + pub struct in6_ifreq { + pub ifr_name: [::c_char; ::IFNAMSIZ], + pub ifr_ifru: __c_anonymous_ifr_ifru6, + } } impl siginfo_t { @@ -3037,30 +3091,83 @@ cfg_if! { } } - impl Eq for __c_anonymous_ifc_ifcu {} + impl ::fmt::Debug for ifconf{ + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ifconf").finish_non_exhaustive() + } + } + + impl ::fmt::Debug for __c_anonymous_ifc_ifcu { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("ifc_ifcu").finish_non_exhaustive() + } + } - impl PartialEq for __c_anonymous_ifc_ifcu { - fn eq(&self, other: &__c_anonymous_ifc_ifcu) -> bool { + impl PartialEq for __c_anonymous_ifr_ifru6 { + fn eq(&self, other: &__c_anonymous_ifr_ifru6) -> bool { unsafe { - self.ifcu_buf == other.ifcu_buf && - self.ifcu_req == other.ifcu_req + self.ifru_addr == other.ifru_addr + && self.ifru_dstaddr == other.ifru_dstaddr + && self.ifru_flags == other.ifru_flags + && self.ifru_flags6 == other.ifru_flags6 + && self.ifru_metrics == other.ifru_metrics + && self.ifru_intval == other.ifru_intval + && self.ifru_data == other.ifru_data + && self.ifru_scope_id + .iter() + .zip(other.ifru_scope_id.iter()) + .all(|(a,b)| a == b) } } } - impl ::fmt::Debug for __c_anonymous_ifc_ifcu { + impl Eq for __c_anonymous_ifr_ifru6 {} + + impl ::fmt::Debug for __c_anonymous_ifr_ifru6 { 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 }) + f.debug_struct("__c_anonymous_ifr_ifru6") + .field("ifru_addr", unsafe { &self.ifru_addr }) + .field("ifru_dstaddr", unsafe { &self.ifru_dstaddr }) + .field("ifru_flags", unsafe { &self.ifru_flags }) + .field("ifru_flags6", unsafe { &self.ifru_flags6 }) + .field("ifru_metrics", unsafe { &self.ifru_metrics }) + .field("ifru_intval", unsafe { &self.ifru_intval }) + .field("ifru_data", unsafe { &self.ifru_data }) + .field("ifru_scope_id", unsafe { &self.ifru_scope_id }) .finish() } } - impl ::hash::Hash for __c_anonymous_ifc_ifcu { + impl ::hash::Hash for __c_anonymous_ifr_ifru6 { fn hash(&self, state: &mut H) { - unsafe { self.ifcu_buf.hash(state) }; - unsafe { self.ifcu_req.hash(state) }; + unsafe { + self.ifru_addr.hash(state); + self.ifru_dstaddr.hash(state); + self.ifru_flags.hash(state); + self.ifru_flags6.hash(state); + self.ifru_metrics.hash(state); + self.ifru_intval.hash(state); + self.ifru_data.hash(state); + self.ifru_scope_id.hash(state); + } + } + } + + impl PartialEq for in6_ifreq { + fn eq(&self, other: &in6_ifreq) -> bool { + self.ifr_name == other.ifr_name + && self.ifr_ifru == other.ifr_ifru + } + } + + impl Eq for in6_ifreq {} + + impl ::fmt::Debug for in6_ifreq { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("in6_ifreq") + .field("ifr_name", &self.ifr_name) + .field("ifr_ifru", &self.ifr_ifru) + .finish() } } } @@ -3201,6 +3308,24 @@ pub const _PC_PIPE_BUF: ::c_int = 6; pub const _PC_CHOWN_RESTRICTED: ::c_int = 7; pub const _PC_NO_TRUNC: ::c_int = 8; pub const _PC_VDISABLE: ::c_int = 9; +pub const _PC_NAME_CHARS_MAX: ::c_int = 10; +pub const _PC_CASE_SENSITIVE: ::c_int = 11; +pub const _PC_CASE_PRESERVING: ::c_int = 12; +pub const _PC_EXTENDED_SECURITY_NP: ::c_int = 13; +pub const _PC_AUTH_OPAQUE_NP: ::c_int = 14; +pub const _PC_2_SYMLINKS: ::c_int = 15; +pub const _PC_ALLOC_SIZE_MIN: ::c_int = 16; +pub const _PC_ASYNC_IO: ::c_int = 17; +pub const _PC_FILESIZEBITS: ::c_int = 18; +pub const _PC_PRIO_IO: ::c_int = 19; +pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 20; +pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 21; +pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 22; +pub const _PC_REC_XFER_ALIGN: ::c_int = 23; +pub const _PC_SYMLINK_MAX: ::c_int = 24; +pub const _PC_SYNC_IO: ::c_int = 25; +pub const _PC_XATTR_SIZE_BITS: ::c_int = 26; +pub const _PC_MIN_HOLE_SIZE: ::c_int = 27; pub const O_EVTONLY: ::c_int = 0x00008000; pub const O_NOCTTY: ::c_int = 0x00020000; pub const O_DIRECTORY: ::c_int = 0x00100000; @@ -3208,29 +3333,31 @@ pub const O_SYMLINK: ::c_int = 0x00200000; pub const O_DSYNC: ::c_int = 0x00400000; pub const O_CLOEXEC: ::c_int = 0x01000000; pub const O_NOFOLLOW_ANY: ::c_int = 0x20000000; -pub const S_IFIFO: mode_t = 4096; -pub const S_IFCHR: mode_t = 8192; -pub const S_IFBLK: mode_t = 24576; -pub const S_IFDIR: mode_t = 16384; -pub const S_IFREG: mode_t = 32768; -pub const S_IFLNK: mode_t = 40960; -pub const S_IFSOCK: mode_t = 49152; -pub const S_IFMT: mode_t = 61440; -pub const S_IEXEC: mode_t = 64; -pub const S_IWRITE: mode_t = 128; -pub const S_IREAD: mode_t = 256; -pub const S_IRWXU: mode_t = 448; -pub const S_IXUSR: mode_t = 64; -pub const S_IWUSR: mode_t = 128; -pub const S_IRUSR: mode_t = 256; -pub const S_IRWXG: mode_t = 56; -pub const S_IXGRP: mode_t = 8; -pub const S_IWGRP: mode_t = 16; -pub const S_IRGRP: mode_t = 32; -pub const S_IRWXO: mode_t = 7; -pub const S_IXOTH: mode_t = 1; -pub const S_IWOTH: mode_t = 2; -pub const S_IROTH: mode_t = 4; +pub const O_EXEC: ::c_int = 0x40000000; +pub const O_SEARCH: ::c_int = O_EXEC | O_DIRECTORY; +pub const S_IFIFO: mode_t = 0o1_0000; +pub const S_IFCHR: mode_t = 0o2_0000; +pub const S_IFBLK: mode_t = 0o6_0000; +pub const S_IFDIR: mode_t = 0o4_0000; +pub const S_IFREG: mode_t = 0o10_0000; +pub const S_IFLNK: mode_t = 0o12_0000; +pub const S_IFSOCK: mode_t = 0o14_0000; +pub const S_IFMT: mode_t = 0o17_0000; +pub const S_IEXEC: mode_t = 0o0100; +pub const S_IWRITE: mode_t = 0o0200; +pub const S_IREAD: mode_t = 0o0400; +pub const S_IRWXU: mode_t = 0o0700; +pub const S_IXUSR: mode_t = 0o0100; +pub const S_IWUSR: mode_t = 0o0200; +pub const S_IRUSR: mode_t = 0o0400; +pub const S_IRWXG: mode_t = 0o0070; +pub const S_IXGRP: mode_t = 0o0010; +pub const S_IWGRP: mode_t = 0o0020; +pub const S_IRGRP: mode_t = 0o0040; +pub const S_IRWXO: mode_t = 0o0007; +pub const S_IXOTH: mode_t = 0o0001; +pub const S_IWOTH: mode_t = 0o0002; +pub const S_IROTH: mode_t = 0o0004; pub const F_OK: ::c_int = 0; pub const R_OK: ::c_int = 4; pub const W_OK: ::c_int = 2; @@ -3303,107 +3430,6 @@ pub const PROCESSOR_TEMPERATURE: ::c_int = 0x10000002; pub const PROCESSOR_SET_LOAD_INFO: ::c_int = 4; pub const PROCESSOR_SET_BASIC_INFO: ::c_int = 5; -deprecated_mach! { - pub const VM_FLAGS_FIXED: ::c_int = 0x0000; - pub const VM_FLAGS_ANYWHERE: ::c_int = 0x0001; - pub const VM_FLAGS_PURGABLE: ::c_int = 0x0002; - pub const VM_FLAGS_RANDOM_ADDR: ::c_int = 0x0008; - pub const VM_FLAGS_NO_CACHE: ::c_int = 0x0010; - pub const VM_FLAGS_RESILIENT_CODESIGN: ::c_int = 0x0020; - pub const VM_FLAGS_RESILIENT_MEDIA: ::c_int = 0x0040; - pub const VM_FLAGS_OVERWRITE: ::c_int = 0x4000; - pub const VM_FLAGS_SUPERPAGE_MASK: ::c_int = 0x70000; - pub const VM_FLAGS_RETURN_DATA_ADDR: ::c_int = 0x100000; - pub const VM_FLAGS_RETURN_4K_DATA_ADDR: ::c_int = 0x800000; - pub const VM_FLAGS_ALIAS_MASK: ::c_int = 0xFF000000; - pub const VM_FLAGS_USER_ALLOCATE: ::c_int = 0xff07401f; - pub const VM_FLAGS_USER_MAP: ::c_int = 0xff97401f; - pub const VM_FLAGS_USER_REMAP: ::c_int = VM_FLAGS_FIXED | - VM_FLAGS_ANYWHERE | - VM_FLAGS_RANDOM_ADDR | - VM_FLAGS_OVERWRITE | - VM_FLAGS_RETURN_DATA_ADDR | - VM_FLAGS_RESILIENT_CODESIGN; - - pub const VM_FLAGS_SUPERPAGE_SHIFT: ::c_int = 16; - pub const SUPERPAGE_NONE: ::c_int = 0; - pub const SUPERPAGE_SIZE_ANY: ::c_int = 1; - pub const VM_FLAGS_SUPERPAGE_NONE: ::c_int = SUPERPAGE_NONE << - VM_FLAGS_SUPERPAGE_SHIFT; - pub const VM_FLAGS_SUPERPAGE_SIZE_ANY: ::c_int = SUPERPAGE_SIZE_ANY << - VM_FLAGS_SUPERPAGE_SHIFT; - pub const SUPERPAGE_SIZE_2MB: ::c_int = 2; - pub const VM_FLAGS_SUPERPAGE_SIZE_2MB: ::c_int = SUPERPAGE_SIZE_2MB << - VM_FLAGS_SUPERPAGE_SHIFT; - - pub const VM_MEMORY_MALLOC: ::c_int = 1; - pub const VM_MEMORY_MALLOC_SMALL: ::c_int = 2; - pub const VM_MEMORY_MALLOC_LARGE: ::c_int = 3; - pub const VM_MEMORY_MALLOC_HUGE: ::c_int = 4; - pub const VM_MEMORY_SBRK: ::c_int = 5; - pub const VM_MEMORY_REALLOC: ::c_int = 6; - pub const VM_MEMORY_MALLOC_TINY: ::c_int = 7; - pub const VM_MEMORY_MALLOC_LARGE_REUSABLE: ::c_int = 8; - pub const VM_MEMORY_MALLOC_LARGE_REUSED: ::c_int = 9; - pub const VM_MEMORY_ANALYSIS_TOOL: ::c_int = 10; - pub const VM_MEMORY_MALLOC_NANO: ::c_int = 11; - pub const VM_MEMORY_MACH_MSG: ::c_int = 20; - pub const VM_MEMORY_IOKIT: ::c_int = 21; - pub const VM_MEMORY_STACK: ::c_int = 30; - pub const VM_MEMORY_GUARD: ::c_int = 31; - pub const VM_MEMORY_SHARED_PMAP: ::c_int = 32; - pub const VM_MEMORY_DYLIB: ::c_int = 33; - pub const VM_MEMORY_OBJC_DISPATCHERS: ::c_int = 34; - pub const VM_MEMORY_UNSHARED_PMAP: ::c_int = 35; - pub const VM_MEMORY_APPKIT: ::c_int = 40; - pub const VM_MEMORY_FOUNDATION: ::c_int = 41; - pub const VM_MEMORY_COREGRAPHICS: ::c_int = 42; - pub const VM_MEMORY_CORESERVICES: ::c_int = 43; - pub const VM_MEMORY_CARBON: ::c_int = VM_MEMORY_CORESERVICES; - pub const VM_MEMORY_JAVA: ::c_int = 44; - pub const VM_MEMORY_COREDATA: ::c_int = 45; - pub const VM_MEMORY_COREDATA_OBJECTIDS: ::c_int = 46; - pub const VM_MEMORY_ATS: ::c_int = 50; - pub const VM_MEMORY_LAYERKIT: ::c_int = 51; - pub const VM_MEMORY_CGIMAGE: ::c_int = 52; - pub const VM_MEMORY_TCMALLOC: ::c_int = 53; - pub const VM_MEMORY_COREGRAPHICS_DATA: ::c_int = 54; - pub const VM_MEMORY_COREGRAPHICS_SHARED: ::c_int = 55; - pub const VM_MEMORY_COREGRAPHICS_FRAMEBUFFERS: ::c_int = 56; - pub const VM_MEMORY_COREGRAPHICS_BACKINGSTORES: ::c_int = 57; - pub const VM_MEMORY_COREGRAPHICS_XALLOC: ::c_int = 58; - pub const VM_MEMORY_COREGRAPHICS_MISC: ::c_int = VM_MEMORY_COREGRAPHICS; - pub const VM_MEMORY_DYLD: ::c_int = 60; - pub const VM_MEMORY_DYLD_MALLOC: ::c_int = 61; - pub const VM_MEMORY_SQLITE: ::c_int = 62; - pub const VM_MEMORY_JAVASCRIPT_CORE: ::c_int = 63; - pub const VM_MEMORY_JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR: ::c_int = 64; - pub const VM_MEMORY_JAVASCRIPT_JIT_REGISTER_FILE: ::c_int = 65; - pub const VM_MEMORY_GLSL: ::c_int = 66; - pub const VM_MEMORY_OPENCL: ::c_int = 67; - pub const VM_MEMORY_COREIMAGE: ::c_int = 68; - pub const VM_MEMORY_WEBCORE_PURGEABLE_BUFFERS: ::c_int = 69; - pub const VM_MEMORY_IMAGEIO: ::c_int = 70; - pub const VM_MEMORY_COREPROFILE: ::c_int = 71; - pub const VM_MEMORY_ASSETSD: ::c_int = 72; - pub const VM_MEMORY_OS_ALLOC_ONCE: ::c_int = 73; - pub const VM_MEMORY_LIBDISPATCH: ::c_int = 74; - pub const VM_MEMORY_ACCELERATE: ::c_int = 75; - pub const VM_MEMORY_COREUI: ::c_int = 76; - pub const VM_MEMORY_COREUIFILE: ::c_int = 77; - pub const VM_MEMORY_GENEALOGY: ::c_int = 78; - pub const VM_MEMORY_RAWCAMERA: ::c_int = 79; - pub const VM_MEMORY_CORPSEINFO: ::c_int = 80; - pub const VM_MEMORY_ASL: ::c_int = 81; - pub const VM_MEMORY_SWIFT_RUNTIME: ::c_int = 82; - pub const VM_MEMORY_SWIFT_METADATA: ::c_int = 83; - pub const VM_MEMORY_DHMM: ::c_int = 84; - pub const VM_MEMORY_SCENEKIT: ::c_int = 86; - pub const VM_MEMORY_SKYWALK: ::c_int = 87; - pub const VM_MEMORY_APPLICATION_SPECIFIC_1: ::c_int = 240; - pub const VM_MEMORY_APPLICATION_SPECIFIC_16: ::c_int = 255; -} - pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; pub const MCL_CURRENT: ::c_int = 0x0001; @@ -3556,6 +3582,10 @@ pub const F_GLOBAL_NOCACHE: ::c_int = 55; pub const F_NODIRECT: ::c_int = 62; pub const F_LOG2PHYS_EXT: ::c_int = 65; pub const F_BARRIERFSYNC: ::c_int = 85; +// See https://github.com/apple/darwin-xnu/blob/main/bsd/sys/fcntl.h +pub const F_OFD_SETLK: ::c_int = 90; /* Acquire or release open file description lock */ +pub const F_OFD_SETLKW: ::c_int = 91; /* (as F_OFD_SETLK but blocking if conflicting lock) */ +pub const F_OFD_GETLK: ::c_int = 92; /* Examine OFD lock */ pub const F_PUNCHHOLE: ::c_int = 99; pub const F_TRIM_ACTIVE_FILE: ::c_int = 100; pub const F_SPECULATIVE_READ: ::c_int = 101; @@ -3563,6 +3593,7 @@ pub const F_GETPATH_NOFIRMLINK: ::c_int = 102; pub const F_ALLOCATECONTIG: ::c_uint = 0x02; pub const F_ALLOCATEALL: ::c_uint = 0x04; +pub const F_ALLOCATEPERSIST: ::c_uint = 0x08; pub const F_PEOFPOSMODE: ::c_int = 3; pub const F_VOLPOSMODE: ::c_int = 4; @@ -4106,7 +4137,6 @@ pub const IPV6_RECVHOPLIMIT: ::c_int = 37; pub const IPV6_PKTINFO: ::c_int = 46; pub const IPV6_HOPLIMIT: ::c_int = 47; pub const IPV6_RECVPKTINFO: ::c_int = 61; -pub const IPV6_DONTFRAG: ::c_int = 62; pub const IP_ADD_SOURCE_MEMBERSHIP: ::c_int = 70; pub const IP_DROP_SOURCE_MEMBERSHIP: ::c_int = 71; pub const IP_BLOCK_SOURCE: ::c_int = 72; @@ -4207,6 +4237,8 @@ pub const IFF_LINK2: ::c_int = 0x4000; // per link layer defined bit pub const IFF_ALTPHYS: ::c_int = IFF_LINK2; // use alternate physical connection pub const IFF_MULTICAST: ::c_int = 0x8000; // supports multicast +pub const SCOPE6_ID_MAX: ::size_t = 16; + pub const SHUT_RD: ::c_int = 0; pub const SHUT_WR: ::c_int = 1; pub const SHUT_RDWR: ::c_int = 2; @@ -4465,6 +4497,8 @@ pub const NOTE_ABSOLUTE: u32 = 0x00000008; pub const NOTE_LEEWAY: u32 = 0x00000010; pub const NOTE_CRITICAL: u32 = 0x00000020; pub const NOTE_BACKGROUND: u32 = 0x00000040; +pub const NOTE_MACH_CONTINUOUS_TIME: u32 = 0x00000080; +pub const NOTE_MACHTIME: u32 = 0x00000100; pub const NOTE_TRACK: u32 = 0x00000001; pub const NOTE_TRACKERR: u32 = 0x00000002; pub const NOTE_CHILD: u32 = 0x00000004; @@ -5018,13 +5052,13 @@ pub const MNT_SNAPSHOT: ::c_int = 0x40000000; pub const MNT_NOBLOCK: ::c_int = 0x00020000; // sys/spawn.h: -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; +pub const POSIX_SPAWN_RESETIDS: ::c_short = 0x0001; +pub const POSIX_SPAWN_SETPGROUP: ::c_short = 0x0002; +pub const POSIX_SPAWN_SETSIGDEF: ::c_short = 0x0004; +pub const POSIX_SPAWN_SETSIGMASK: ::c_short = 0x0008; +pub const POSIX_SPAWN_SETEXEC: ::c_short = 0x0040; +pub const POSIX_SPAWN_START_SUSPENDED: ::c_short = 0x0080; +pub const POSIX_SPAWN_CLOEXEC_DEFAULT: ::c_short = 0x4000; // sys/ipc.h: pub const IPC_CREAT: ::c_int = 0x200; @@ -5395,6 +5429,15 @@ pub const VOL_CAP_INT_RENAME_SWAP: attrgroup_t = 0x00040000; pub const VOL_CAP_INT_RENAME_EXCL: attrgroup_t = 0x00080000; pub const VOL_CAP_INT_RENAME_OPENFAIL: attrgroup_t = 0x00100000; +// os/clock.h +pub const OS_CLOCK_MACH_ABSOLUTE_TIME: os_clockid_t = 32; + +// os/os_sync_wait_on_address.h +pub const OS_SYNC_WAIT_ON_ADDRESS_NONE: os_sync_wait_on_address_flags_t = 0x00000000; +pub const OS_SYNC_WAIT_ON_ADDRESS_SHARED: os_sync_wait_on_address_flags_t = 0x00000001; +pub const OS_SYNC_WAKE_BY_ADDRESS_NONE: os_sync_wake_by_address_flags_t = 0x00000000; +pub const OS_SYNC_WAKE_BY_ADDRESS_SHARED: os_sync_wake_by_address_flags_t = 0x00000001; + // /// Process being created by fork. pub const SIDL: u32 = 1; @@ -5465,11 +5508,11 @@ f! { return ::CMSG_FIRSTHDR(mhdr); }; let cmsg_len = (*cmsg).cmsg_len as usize; - let next = cmsg as usize + __DARWIN_ALIGN32(cmsg_len as usize); + let next = cmsg as usize + __DARWIN_ALIGN32(cmsg_len); let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; if next + __DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) > max { - 0 as *mut ::cmsghdr + core::ptr::null_mut() } else { next as *mut ::cmsghdr } @@ -5477,7 +5520,7 @@ f! { pub fn CMSG_DATA(cmsg: *const ::cmsghdr) -> *mut ::c_uchar { (cmsg as *mut ::c_uchar) - .offset(__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>()) as isize) + .add(__DARWIN_ALIGN32(::mem::size_of::<::cmsghdr>())) } pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { @@ -5649,13 +5692,6 @@ extern "C" { newp: *mut ::c_void, newlen: ::size_t, ) -> ::c_int; - #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")] - pub fn mach_absolute_time() -> u64; - #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")] - #[allow(deprecated)] - pub fn mach_timebase_info(info: *mut ::mach_timebase_info) -> ::c_int; - pub fn mach_host_self() -> mach_port_t; - pub fn mach_thread_self() -> mach_port_t; pub fn pthread_setname_np(name: *const ::c_char) -> ::c_int; pub fn pthread_getname_np(thread: ::pthread_t, name: *mut ::c_char, len: ::size_t) -> ::c_int; pub fn pthread_mach_thread_np(thread: ::pthread_t) -> ::mach_port_t; @@ -5755,6 +5791,40 @@ extern "C" { pub fn pthread_jit_write_freeze_callbacks_np(); pub fn pthread_cpu_number_np(cpu_number_out: *mut ::size_t) -> ::c_int; + // Available starting with macOS 14.4. + pub fn os_sync_wait_on_address( + addr: *mut ::c_void, + value: u64, + size: ::size_t, + flags: os_sync_wait_on_address_flags_t, + ) -> ::c_int; + pub fn os_sync_wait_on_address_with_deadline( + addr: *mut ::c_void, + value: u64, + size: ::size_t, + flags: os_sync_wait_on_address_flags_t, + clockid: os_clockid_t, + deadline: u64, + ) -> ::c_int; + pub fn os_sync_wait_on_address_with_timeout( + addr: *mut ::c_void, + value: u64, + size: ::size_t, + flags: os_sync_wait_on_address_flags_t, + clockid: os_clockid_t, + timeout_ns: u64, + ) -> ::c_int; + pub fn os_sync_wake_by_address_any( + addr: *mut ::c_void, + size: ::size_t, + flags: os_sync_wake_by_address_flags_t, + ) -> ::c_int; + pub fn os_sync_wake_by_address_all( + addr: *mut ::c_void, + size: ::size_t, + flags: os_sync_wake_by_address_flags_t, + ) -> ::c_int; + pub fn os_unfair_lock_lock(lock: os_unfair_lock_t); pub fn os_unfair_lock_trylock(lock: os_unfair_lock_t) -> bool; pub fn os_unfair_lock_unlock(lock: os_unfair_lock_t); @@ -5971,15 +6041,6 @@ extern "C" { pub fn brk(addr: *const ::c_void) -> *mut ::c_void; pub fn sbrk(increment: ::c_int) -> *mut ::c_void; pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int; - #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")] - pub fn _dyld_image_count() -> u32; - #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")] - #[allow(deprecated)] - pub fn _dyld_get_image_header(image_index: u32) -> *const mach_header; - #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")] - pub fn _dyld_get_image_vmaddr_slide(image_index: u32) -> ::intptr_t; - #[deprecated(since = "0.2.55", note = "Use the `mach2` crate instead")] - pub fn _dyld_get_image_name(image_index: u32) -> *const ::c_char; pub fn posix_spawn( pid: *mut ::pid_t, @@ -6243,22 +6304,11 @@ extern "C" { pub fn CCRandomGenerateBytes(bytes: *mut ::c_void, size: ::size_t) -> ::CCRNGStatus; pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; - pub fn _NSGetExecutablePath(buf: *mut ::c_char, bufsize: *mut u32) -> ::c_int; + // crt_externs.h + pub fn _NSGetArgv() -> *mut *mut *mut ::c_char; + pub fn _NSGetArgc() -> *mut ::c_int; pub fn _NSGetEnviron() -> *mut *mut *mut ::c_char; - - pub fn mach_vm_map( - target_task: ::vm_map_t, - address: *mut ::mach_vm_address_t, - size: ::mach_vm_size_t, - mask: ::mach_vm_offset_t, - flags: ::c_int, - object: ::mem_entry_name_port_t, - offset: ::memory_object_offset_t, - copy: ::boolean_t, - cur_protection: ::vm_prot_t, - max_protection: ::vm_prot_t, - inheritance: ::vm_inherit_t, - ) -> ::kern_return_t; + pub fn _NSGetProgname() -> *mut *mut ::c_char; pub fn vm_allocate( target_task: vm_map_t, @@ -6287,7 +6337,6 @@ extern "C" { out_processor_infoCnt: *mut mach_msg_type_number_t, ) -> ::kern_return_t; - pub static mut mach_task_self_: ::mach_port_t; pub fn task_for_pid( host: ::mach_port_t, pid: ::pid_t, @@ -6404,10 +6453,6 @@ extern "C" { ) -> ::c_int; } -pub unsafe fn mach_task_self() -> ::mach_port_t { - mach_task_self_ -} - cfg_if! { if #[cfg(target_os = "macos")] { extern "C" { @@ -6416,7 +6461,7 @@ cfg_if! { } } cfg_if! { - if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))] { + if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "visionos"))] { extern "C" { pub fn memmem( haystack: *const ::c_void, diff --git a/src/unix/bsd/freebsdlike/dragonfly/errno.rs b/src/unix/bsd/freebsdlike/dragonfly/errno.rs deleted file mode 100644 index 5fe6bb89cf2e5..0000000000000 --- a/src/unix/bsd/freebsdlike/dragonfly/errno.rs +++ /dev/null @@ -1,13 +0,0 @@ -// DragonFlyBSD's __error function is declared with "static inline", so it must -// be implemented in the libc crate, as a pointer to a static thread_local. -f! { - #[deprecated(since = "0.2.77", note = "Use `__errno_location()` instead")] - pub fn __error() -> *mut ::c_int { - &mut errno - } -} - -extern "C" { - #[thread_local] - pub static mut errno: ::c_int; -} diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index 6ade7949afb0f..489b82adb84b9 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -1723,10 +1723,3 @@ extern "C" { entry: vm_map_entry_t, ) -> vm_map_entry_t; } - -cfg_if! { - if #[cfg(libc_thread_local)] { - mod errno; - pub use self::errno::*; - } -} diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 7b90d743c2144..3cf1fc1aeeef3 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -1043,41 +1043,49 @@ s! { pub tcpi_snd_rexmitpack: u32, pub tcpi_rcv_ooopack: u32, pub tcpi_snd_zerowin: u32, + #[cfg(freebsd13)] + pub __tcpi_delivered_ce: u32, #[cfg(any(freebsd15, freebsd14))] pub tcpi_delivered_ce: u32, + #[cfg(freebsd13)] + pub __tcpi_received_ce: u32, #[cfg(any(freebsd15, freebsd14))] pub tcpi_received_ce: u32, - #[cfg(any(freebsd15, freebsd14))] + #[cfg(any(freebsd15, freebsd14, freebsd13))] pub __tcpi_delivered_e1_bytes: u32, - #[cfg(any(freebsd15, freebsd14))] + #[cfg(any(freebsd15, freebsd14, freebsd13))] pub __tcpi_delivered_e0_bytes: u32, - #[cfg(any(freebsd15, freebsd14))] + #[cfg(any(freebsd15, freebsd14, freebsd13))] pub __tcpi_delivered_ce_bytes: u32, - #[cfg(any(freebsd15, freebsd14))] + #[cfg(any(freebsd15, freebsd14, freebsd13))] pub __tcpi_received_e1_bytes: u32, - #[cfg(any(freebsd15, freebsd14))] + #[cfg(any(freebsd15, freebsd14, freebsd13))] pub __tcpi_received_e0_bytes: u32, - #[cfg(any(freebsd15, freebsd14))] + #[cfg(any(freebsd15, freebsd14, freebsd13))] pub __tcpi_received_ce_bytes: u32, + #[cfg(freebsd13)] + pub __tcpi_total_tlp: u32, #[cfg(any(freebsd15, freebsd14))] pub tcpi_total_tlp: u32, + #[cfg(freebsd13)] + pub __tcpi_total_tlp_bytes: u64, #[cfg(any(freebsd15, freebsd14))] pub tcpi_total_tlp_bytes: u64, - #[cfg(any(freebsd15, freebsd14))] + #[cfg(any(freebsd15, freebsd14, freebsd13))] pub tcpi_snd_una: u32, - #[cfg(any(freebsd15, freebsd14))] + #[cfg(any(freebsd15, freebsd14, freebsd13))] pub tcpi_snd_max: u32, - #[cfg(any(freebsd15, freebsd14))] + #[cfg(any(freebsd15, freebsd14, freebsd13))] pub tcpi_rcv_numsacks: u32, - #[cfg(any(freebsd15, freebsd14))] + #[cfg(any(freebsd15, freebsd14, freebsd13))] pub tcpi_rcv_adv: u32, - #[cfg(any(freebsd15, freebsd14))] + #[cfg(any(freebsd15, freebsd14, freebsd13))] pub tcpi_dupacks: u32, - #[cfg(freebsd14)] + #[cfg(any(freebsd14, freebsd13))] pub __tcpi_pad: [u32; 10], #[cfg(freebsd15)] pub __tcpi_pad: [u32; 14], - #[cfg(not(any(freebsd15, freebsd14)))] + #[cfg(not(any(freebsd15, freebsd14, freebsd13)))] pub __tcpi_pad: [u32; 26], } @@ -1613,6 +1621,23 @@ s_no_extra_traits! { pub cause: sctp_error_cause, pub hmac_id: u16, } + + pub struct kinfo_file { + pub kf_structsize: ::c_int, + pub kf_type: ::c_int, + pub kf_fd: ::c_int, + pub kf_ref_count: ::c_int, + pub kf_flags: ::c_int, + _kf_pad0: ::c_int, + pub kf_offset: i64, + _priv: [::uintptr_t; 38], // FIXME if needed + pub kf_status: u16, + _kf_pad1: u16, + _kf_ispare0: ::c_int, + pub kf_cap_rights: ::cap_rights_t, + _kf_cap_spare: u64, + pub kf_path: [::c_char; ::PATH_MAX as usize], + } } cfg_if! { @@ -2521,6 +2546,52 @@ cfg_if! { {self.hmac_id}.hash(state); } } + + impl PartialEq for kinfo_file { + fn eq(&self, other: &kinfo_file) -> bool { + self.kf_structsize == other.kf_structsize && + self.kf_type == other.kf_type && + self.kf_fd == other.kf_fd && + self.kf_ref_count == other.kf_ref_count && + self.kf_flags == other.kf_flags && + self.kf_offset == other.kf_offset && + self.kf_status == other.kf_status && + self.kf_cap_rights == other.kf_cap_rights && + self.kf_path + .iter() + .zip(other.kf_path.iter()) + .all(|(a,b)| a == b) + } + } + impl Eq for kinfo_file {} + impl ::fmt::Debug for kinfo_file { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("kinfo_file") + .field("kf_structsize", &self.kf_structsize) + .field("kf_type", &self.kf_type) + .field("kf_fd", &self.kf_fd) + .field("kf_ref_count", &self.kf_ref_count) + .field("kf_flags", &self.kf_flags) + .field("kf_offset", &self.kf_offset) + .field("kf_status", &self.kf_status) + .field("kf_cap_rights", &self.kf_cap_rights) + .field("kf_path", &&self.kf_path[..]) + .finish() + } + } + impl ::hash::Hash for kinfo_file { + fn hash(&self, state: &mut H) { + self.kf_structsize.hash(state); + self.kf_type.hash(state); + self.kf_fd.hash(state); + self.kf_ref_count.hash(state); + self.kf_flags.hash(state); + self.kf_offset.hash(state); + self.kf_status.hash(state); + self.kf_cap_rights.hash(state); + self.kf_path.hash(state); + } + } } } @@ -2546,6 +2617,129 @@ pub const LIO_VECTORED: ::c_int = 4; pub const LIO_WRITEV: ::c_int = 5; pub const LIO_READV: ::c_int = 6; +// sys/caprights.h +pub const CAP_RIGHTS_VERSION_00: i32 = 0; +pub const CAP_RIGHTS_VERSION: i32 = CAP_RIGHTS_VERSION_00; + +// sys/capsicum.h +macro_rules! cap_right { + ($idx:expr, $bit:expr) => { + ((1u64 << (57 + ($idx))) | ($bit)) + }; +} +pub const CAP_READ: u64 = cap_right!(0, 0x0000000000000001u64); +pub const CAP_WRITE: u64 = cap_right!(0, 0x0000000000000002u64); +pub const CAP_SEEK_TELL: u64 = cap_right!(0, 0x0000000000000004u64); +pub const CAP_SEEK: u64 = CAP_SEEK_TELL | 0x0000000000000008u64; +pub const CAP_PREAD: u64 = CAP_SEEK | CAP_READ; +pub const CAP_PWRITE: u64 = CAP_SEEK | CAP_WRITE; +pub const CAP_MMAP: u64 = cap_right!(0, 0x0000000000000010u64); +pub const CAP_MMAP_R: u64 = CAP_MMAP | CAP_SEEK | CAP_READ; +pub const CAP_MMAP_W: u64 = CAP_MMAP | CAP_SEEK | CAP_WRITE; +pub const CAP_MMAP_X: u64 = CAP_MMAP | CAP_SEEK | 0x0000000000000020u64; +pub const CAP_MMAP_RW: u64 = CAP_MMAP_R | CAP_MMAP_W; +pub const CAP_MMAP_RX: u64 = CAP_MMAP_R | CAP_MMAP_X; +pub const CAP_MMAP_WX: u64 = CAP_MMAP_W | CAP_MMAP_X; +pub const CAP_MMAP_RWX: u64 = CAP_MMAP_R | CAP_MMAP_W | CAP_MMAP_X; +pub const CAP_CREATE: u64 = cap_right!(0, 0x0000000000000040u64); +pub const CAP_FEXECVE: u64 = cap_right!(0, 0x0000000000000080u64); +pub const CAP_FSYNC: u64 = cap_right!(0, 0x0000000000000100u64); +pub const CAP_FTRUNCATE: u64 = cap_right!(0, 0x0000000000000200u64); +pub const CAP_LOOKUP: u64 = cap_right!(0, 0x0000000000000400u64); +pub const CAP_FCHDIR: u64 = cap_right!(0, 0x0000000000000800u64); +pub const CAP_FCHFLAGS: u64 = cap_right!(0, 0x0000000000001000u64); +pub const CAP_CHFLAGSAT: u64 = CAP_FCHFLAGS | CAP_LOOKUP; +pub const CAP_FCHMOD: u64 = cap_right!(0, 0x0000000000002000u64); +pub const CAP_FCHMODAT: u64 = CAP_FCHMOD | CAP_LOOKUP; +pub const CAP_FCHOWN: u64 = cap_right!(0, 0x0000000000004000u64); +pub const CAP_FCHOWNAT: u64 = CAP_FCHOWN | CAP_LOOKUP; +pub const CAP_FCNTL: u64 = cap_right!(0, 0x0000000000008000u64); +pub const CAP_FLOCK: u64 = cap_right!(0, 0x0000000000010000u64); +pub const CAP_FPATHCONF: u64 = cap_right!(0, 0x0000000000020000u64); +pub const CAP_FSCK: u64 = cap_right!(0, 0x0000000000040000u64); +pub const CAP_FSTAT: u64 = cap_right!(0, 0x0000000000080000u64); +pub const CAP_FSTATAT: u64 = CAP_FSTAT | CAP_LOOKUP; +pub const CAP_FSTATFS: u64 = cap_right!(0, 0x0000000000100000u64); +pub const CAP_FUTIMES: u64 = cap_right!(0, 0x0000000000200000u64); +pub const CAP_FUTIMESAT: u64 = CAP_FUTIMES | CAP_LOOKUP; +// Note: this was named CAP_LINKAT prior to FreeBSD 11.0. +pub const CAP_LINKAT_TARGET: u64 = CAP_LOOKUP | 0x0000000000400000u64; +pub const CAP_MKDIRAT: u64 = CAP_LOOKUP | 0x0000000000800000u64; +pub const CAP_MKFIFOAT: u64 = CAP_LOOKUP | 0x0000000001000000u64; +pub const CAP_MKNODAT: u64 = CAP_LOOKUP | 0x0000000002000000u64; +// Note: this was named CAP_RENAMEAT prior to FreeBSD 11.0. +pub const CAP_RENAMEAT_SOURCE: u64 = CAP_LOOKUP | 0x0000000004000000u64; +pub const CAP_SYMLINKAT: u64 = CAP_LOOKUP | 0x0000000008000000u64; +pub const CAP_UNLINKAT: u64 = CAP_LOOKUP | 0x0000000010000000u64; +pub const CAP_ACCEPT: u64 = cap_right!(0, 0x0000000020000000u64); +pub const CAP_BIND: u64 = cap_right!(0, 0x0000000040000000u64); +pub const CAP_CONNECT: u64 = cap_right!(0, 0x0000000080000000u64); +pub const CAP_GETPEERNAME: u64 = cap_right!(0, 0x0000000100000000u64); +pub const CAP_GETSOCKNAME: u64 = cap_right!(0, 0x0000000200000000u64); +pub const CAP_GETSOCKOPT: u64 = cap_right!(0, 0x0000000400000000u64); +pub const CAP_LISTEN: u64 = cap_right!(0, 0x0000000800000000u64); +pub const CAP_PEELOFF: u64 = cap_right!(0, 0x0000001000000000u64); +pub const CAP_RECV: u64 = CAP_READ; +pub const CAP_SEND: u64 = CAP_WRITE; +pub const CAP_SETSOCKOPT: u64 = cap_right!(0, 0x0000002000000000u64); +pub const CAP_SHUTDOWN: u64 = cap_right!(0, 0x0000004000000000u64); +pub const CAP_BINDAT: u64 = CAP_LOOKUP | 0x0000008000000000u64; +pub const CAP_CONNECTAT: u64 = CAP_LOOKUP | 0x0000010000000000u64; +pub const CAP_LINKAT_SOURCE: u64 = CAP_LOOKUP | 0x0000020000000000u64; +pub const CAP_RENAMEAT_TARGET: u64 = CAP_LOOKUP | 0x0000040000000000u64; +pub const CAP_SOCK_CLIENT: u64 = CAP_CONNECT + | CAP_GETPEERNAME + | CAP_GETSOCKNAME + | CAP_GETSOCKOPT + | CAP_PEELOFF + | CAP_RECV + | CAP_SEND + | CAP_SETSOCKOPT + | CAP_SHUTDOWN; +pub const CAP_SOCK_SERVER: u64 = CAP_ACCEPT + | CAP_BIND + | CAP_GETPEERNAME + | CAP_GETSOCKNAME + | CAP_GETSOCKOPT + | CAP_LISTEN + | CAP_PEELOFF + | CAP_RECV + | CAP_SEND + | CAP_SETSOCKOPT + | CAP_SHUTDOWN; +pub const CAP_ALL0: u64 = cap_right!(0, 0x000007FFFFFFFFFFu64); +pub const CAP_UNUSED0_44: u64 = cap_right!(0, 0x0000080000000000u64); +pub const CAP_UNUSED0_57: u64 = cap_right!(0, 0x0100000000000000u64); +pub const CAP_MAC_GET: u64 = cap_right!(1, 0x0000000000000001u64); +pub const CAP_MAC_SET: u64 = cap_right!(1, 0x0000000000000002u64); +pub const CAP_SEM_GETVALUE: u64 = cap_right!(1, 0x0000000000000004u64); +pub const CAP_SEM_POST: u64 = cap_right!(1, 0x0000000000000008u64); +pub const CAP_SEM_WAIT: u64 = cap_right!(1, 0x0000000000000010u64); +pub const CAP_EVENT: u64 = cap_right!(1, 0x0000000000000020u64); +pub const CAP_KQUEUE_EVENT: u64 = cap_right!(1, 0x0000000000000040u64); +pub const CAP_IOCTL: u64 = cap_right!(1, 0x0000000000000080u64); +pub const CAP_TTYHOOK: u64 = cap_right!(1, 0x0000000000000100u64); +pub const CAP_PDGETPID: u64 = cap_right!(1, 0x0000000000000200u64); +pub const CAP_PDWAIT: u64 = cap_right!(1, 0x0000000000000400u64); +pub const CAP_PDKILL: u64 = cap_right!(1, 0x0000000000000800u64); +pub const CAP_EXTATTR_DELETE: u64 = cap_right!(1, 0x0000000000001000u64); +pub const CAP_EXTATTR_GET: u64 = cap_right!(1, 0x0000000000002000u64); +pub const CAP_EXTATTR_LIST: u64 = cap_right!(1, 0x0000000000004000u64); +pub const CAP_EXTATTR_SET: u64 = cap_right!(1, 0x0000000000008000u64); +pub const CAP_ACL_CHECK: u64 = cap_right!(1, 0x0000000000010000u64); +pub const CAP_ACL_DELETE: u64 = cap_right!(1, 0x0000000000020000u64); +pub const CAP_ACL_GET: u64 = cap_right!(1, 0x0000000000040000u64); +pub const CAP_ACL_SET: u64 = cap_right!(1, 0x0000000000080000u64); +pub const CAP_KQUEUE_CHANGE: u64 = cap_right!(1, 0x0000000000100000u64); +pub const CAP_KQUEUE: u64 = CAP_KQUEUE_EVENT | CAP_KQUEUE_CHANGE; +pub const CAP_ALL1: u64 = cap_right!(1, 0x00000000001FFFFFu64); +pub const CAP_UNUSED1_22: u64 = cap_right!(1, 0x0000000000200000u64); +pub const CAP_UNUSED1_57: u64 = cap_right!(1, 0x0100000000000000u64); +pub const CAP_FCNTL_GETFL: u32 = 1 << 3; +pub const CAP_FCNTL_SETFL: u32 = 1 << 4; +pub const CAP_FCNTL_GETOWN: u32 = 1 << 5; +pub const CAP_FCNTL_SETOWN: u32 = 1 << 6; + // sys/devicestat.h pub const DEVSTAT_N_TRANS_FLAGS: ::c_int = 4; pub const DEVSTAT_NAME_LEN: ::c_int = 16; @@ -3609,8 +3803,6 @@ pub const IP_RSS_LISTEN_BUCKET: ::c_int = 26; pub const IP_ORIGDSTADDR: ::c_int = 27; pub const IP_RECVORIGDSTADDR: ::c_int = IP_ORIGDSTADDR; -pub const IP_RECVTTL: ::c_int = 65; -pub const IPV6_RECVHOPLIMIT: ::c_int = 37; pub const IP_DONTFRAG: ::c_int = 67; pub const IP_RECVTOS: ::c_int = 68; @@ -3768,12 +3960,12 @@ pub const RTP_PRIO_REALTIME: ::c_ushort = 2; pub const RTP_PRIO_NORMAL: ::c_ushort = 3; pub const RTP_PRIO_IDLE: ::c_ushort = 4; -pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01; -pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02; -pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_int = 0x04; -pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x08; -pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x10; -pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x20; +pub const POSIX_SPAWN_RESETIDS: ::c_short = 0x01; +pub const POSIX_SPAWN_SETPGROUP: ::c_short = 0x02; +pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_short = 0x04; +pub const POSIX_SPAWN_SETSCHEDULER: ::c_short = 0x08; +pub const POSIX_SPAWN_SETSIGDEF: ::c_short = 0x10; +pub const POSIX_SPAWN_SETSIGMASK: ::c_short = 0x20; // Flags for chflags(2) pub const UF_SYSTEM: ::c_ulong = 0x00000080; @@ -3805,11 +3997,6 @@ pub const F_SEAL_WRITE: ::c_int = 8; // for use with fspacectl pub const SPACECTL_DEALLOC: ::c_int = 1; -// For getrandom() -pub const GRND_NONBLOCK: ::c_uint = 0x1; -pub const GRND_RANDOM: ::c_uint = 0x2; -pub const GRND_INSECURE: ::c_uint = 0x4; - // For realhostname* api pub const HOSTNAME_FOUND: ::c_int = 0; pub const HOSTNAME_INCORRECTNAME: ::c_int = 1; @@ -4672,6 +4859,12 @@ pub const TFD_CLOEXEC: ::c_int = O_CLOEXEC; pub const TFD_TIMER_ABSTIME: ::c_int = 0x01; pub const TFD_TIMER_CANCEL_ON_SET: ::c_int = 0x02; +pub const KCMP_FILE: ::c_int = 100; +pub const KCMP_FILEOBJ: ::c_int = 101; +pub const KCMP_FILES: ::c_int = 102; +pub const KCMP_SIGHAND: ::c_int = 103; +pub const KCMP_VM: ::c_int = 104; + pub const fn MAP_ALIGNED(a: ::c_int) -> ::c_int { a << 24 } @@ -5315,8 +5508,6 @@ extern "C" { pub fn fdatasync(fd: ::c_int) -> ::c_int; - pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; - pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int; pub fn setproctitle_fast(fmt: *const ::c_char, ...); pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; @@ -5391,6 +5582,20 @@ extern "C" { ) -> ::c_int; pub fn closefrom(lowfd: ::c_int); pub fn close_range(lowfd: ::c_uint, highfd: ::c_uint, flags: ::c_int) -> ::c_int; + + pub fn kcmp( + pid1: ::pid_t, + pid2: ::pid_t, + type_: ::c_int, + idx1: ::c_ulong, + idx2: ::c_ulong, + ) -> ::c_int; + + pub fn execvpe( + file: *const ::c_char, + argv: *const *const ::c_char, + envp: *const *const ::c_char, + ) -> ::c_int; } #[link(name = "memstat")] diff --git a/src/unix/bsd/freebsdlike/freebsd/x86.rs b/src/unix/bsd/freebsdlike/freebsd/x86.rs index 29689c910689f..3e3e5cc9f34fb 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86.rs @@ -190,3 +190,5 @@ cfg_if! { } pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4 + +pub const KINFO_FILE_SIZE: ::c_int = 1392; diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs index c94695ed06cfb..aa33345f3113f 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs @@ -91,23 +91,6 @@ s_no_extra_traits! { pub a_type: ::c_long, pub a_un: __c_anonymous_elf64_auxv_union, } - - pub struct kinfo_file { - pub kf_structsize: ::c_int, - pub kf_type: ::c_int, - pub kf_fd: ::c_int, - pub kf_ref_count: ::c_int, - pub kf_flags: ::c_int, - _kf_pad0: ::c_int, - pub kf_offset: i64, - _priv: [::uintptr_t; 38], // FIXME if needed - pub kf_status: u16, - _kf_pad1: u16, - _kf_ispare0: ::c_int, - pub kf_cap_rights: ::cap_rights_t, - _kf_cap_spare: u64, - pub kf_path: [::c_char; ::PATH_MAX as usize], - } } cfg_if! { @@ -232,52 +215,6 @@ cfg_if! { .finish() } } - - impl PartialEq for kinfo_file { - fn eq(&self, other: &kinfo_file) -> bool { - self.kf_structsize == other.kf_structsize && - self.kf_type == other.kf_type && - self.kf_fd == other.kf_fd && - self.kf_ref_count == other.kf_ref_count && - self.kf_flags == other.kf_flags && - self.kf_offset == other.kf_offset && - self.kf_status == other.kf_status && - self.kf_cap_rights == other.kf_cap_rights && - self.kf_path - .iter() - .zip(other.kf_path.iter()) - .all(|(a,b)| a == b) - } - } - impl Eq for kinfo_file {} - impl ::fmt::Debug for kinfo_file { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("kinfo_file") - .field("kf_structsize", &self.kf_structsize) - .field("kf_type", &self.kf_type) - .field("kf_fd", &self.kf_fd) - .field("kf_ref_count", &self.kf_ref_count) - .field("kf_flags", &self.kf_flags) - .field("kf_offset", &self.kf_offset) - .field("kf_status", &self.kf_status) - .field("kf_cap_rights", &self.kf_cap_rights) - .field("kf_path", &&self.kf_path[..]) - .finish() - } - } - impl ::hash::Hash for kinfo_file { - fn hash(&self, state: &mut H) { - self.kf_structsize.hash(state); - self.kf_type.hash(state); - self.kf_fd.hash(state); - self.kf_ref_count.hash(state); - self.kf_flags.hash(state); - self.kf_offset.hash(state); - self.kf_status.hash(state); - self.kf_cap_rights.hash(state); - self.kf_path.hash(state); - } - } } } @@ -297,5 +234,7 @@ pub const _MC_FPOWNED_NONE: c_long = 0x20000; pub const _MC_FPOWNED_FPU: c_long = 0x20001; pub const _MC_FPOWNED_PCB: c_long = 0x20002; +pub const KINFO_FILE_SIZE: ::c_int = 1392; + mod align; pub use self::align::*; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 79de969c8be6b..af0632882cdbc 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -555,29 +555,29 @@ pub const TMP_MAX: ::c_uint = 308915776; pub const O_NOCTTY: ::c_int = 32768; pub const O_DIRECT: ::c_int = 0x00010000; -pub const S_IFIFO: mode_t = 4096; -pub const S_IFCHR: mode_t = 8192; -pub const S_IFBLK: mode_t = 24576; -pub const S_IFDIR: mode_t = 16384; -pub const S_IFREG: mode_t = 32768; -pub const S_IFLNK: mode_t = 40960; -pub const S_IFSOCK: mode_t = 49152; -pub const S_IFMT: mode_t = 61440; -pub const S_IEXEC: mode_t = 64; -pub const S_IWRITE: mode_t = 128; -pub const S_IREAD: mode_t = 256; -pub const S_IRWXU: mode_t = 448; -pub const S_IXUSR: mode_t = 64; -pub const S_IWUSR: mode_t = 128; -pub const S_IRUSR: mode_t = 256; -pub const S_IRWXG: mode_t = 56; -pub const S_IXGRP: mode_t = 8; -pub const S_IWGRP: mode_t = 16; -pub const S_IRGRP: mode_t = 32; -pub const S_IRWXO: mode_t = 7; -pub const S_IXOTH: mode_t = 1; -pub const S_IWOTH: mode_t = 2; -pub const S_IROTH: mode_t = 4; +pub const S_IFIFO: mode_t = 0o1_0000; +pub const S_IFCHR: mode_t = 0o2_0000; +pub const S_IFBLK: mode_t = 0o6_0000; +pub const S_IFDIR: mode_t = 0o4_0000; +pub const S_IFREG: mode_t = 0o10_0000; +pub const S_IFLNK: mode_t = 0o12_0000; +pub const S_IFSOCK: mode_t = 0o14_0000; +pub const S_IFMT: mode_t = 0o17_0000; +pub const S_IEXEC: mode_t = 0o0100; +pub const S_IWRITE: mode_t = 0o0200; +pub const S_IREAD: mode_t = 0o0400; +pub const S_IRWXU: mode_t = 0o0700; +pub const S_IXUSR: mode_t = 0o0100; +pub const S_IWUSR: mode_t = 0o0200; +pub const S_IRUSR: mode_t = 0o0400; +pub const S_IRWXG: mode_t = 0o0070; +pub const S_IXGRP: mode_t = 0o0010; +pub const S_IWGRP: mode_t = 0o0020; +pub const S_IRGRP: mode_t = 0o0040; +pub const S_IRWXO: mode_t = 0o0007; +pub const S_IXOTH: mode_t = 0o0001; +pub const S_IWOTH: mode_t = 0o0002; +pub const S_IROTH: mode_t = 0o0004; pub const F_OK: ::c_int = 0; pub const R_OK: ::c_int = 4; pub const W_OK: ::c_int = 2; @@ -789,6 +789,7 @@ pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; pub const POSIX_MADV_WILLNEED: ::c_int = 3; pub const POSIX_MADV_DONTNEED: ::c_int = 4; +pub const PTHREAD_BARRIER_SERIAL_THREAD: ::c_int = -1; pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0; pub const PTHREAD_PROCESS_SHARED: ::c_int = 1; pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0; @@ -962,6 +963,8 @@ pub const IP_SENDSRCADDR: ::c_int = IP_RECVDSTADDR; pub const IP_ADD_MEMBERSHIP: ::c_int = 12; pub const IP_DROP_MEMBERSHIP: ::c_int = 13; pub const IP_RECVIF: ::c_int = 20; +pub const IP_RECVTTL: ::c_int = 65; +pub const IPV6_RECVHOPLIMIT: ::c_int = 37; pub const IPV6_JOIN_GROUP: ::c_int = 12; pub const IPV6_LEAVE_GROUP: ::c_int = 13; pub const IPV6_CHECKSUM: ::c_int = 26; @@ -970,7 +973,6 @@ pub const IPV6_PKTINFO: ::c_int = 46; pub const IPV6_HOPLIMIT: ::c_int = 47; pub const IPV6_RECVTCLASS: ::c_int = 57; pub const IPV6_TCLASS: ::c_int = 61; -pub const IPV6_DONTFRAG: ::c_int = 62; pub const IP_ADD_SOURCE_MEMBERSHIP: ::c_int = 70; pub const IP_DROP_SOURCE_MEMBERSHIP: ::c_int = 71; pub const IP_BLOCK_SOURCE: ::c_int = 72; @@ -1448,6 +1450,11 @@ pub const RB_GDB: ::c_int = 0x8000; pub const RB_MUTE: ::c_int = 0x10000; pub const RB_SELFTEST: ::c_int = 0x20000; +// For getrandom() +pub const GRND_NONBLOCK: ::c_uint = 0x1; +pub const GRND_RANDOM: ::c_uint = 0x2; +pub const GRND_INSECURE: ::c_uint = 0x4; + safe_f! { pub {const} fn WIFCONTINUED(status: ::c_int) -> bool { status == 0x13 @@ -1500,11 +1507,7 @@ extern "C" { pub fn duplocale(base: ::locale_t) -> ::locale_t; pub fn endutxent(); pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int; - pub fn fexecve( - fd: ::c_int, - argv: *const *const ::c_char, - envp: *const *const ::c_char, - ) -> ::c_int; + pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int; pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int; pub fn getdomainname(name: *mut ::c_char, len: ::c_int) -> ::c_int; pub fn getgrent_r( @@ -1821,6 +1824,9 @@ extern "C" { abs_timeout: *const ::timespec, ) -> ::c_int; pub fn mq_unlink(name: *const ::c_char) -> ::c_int; + + pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; + pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; } #[link(name = "util")] diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 435ffc39cd8d2..61f764d1d2dee 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -39,6 +39,7 @@ s! { target_os = "ios", target_os = "tvos", target_os = "watchos", + target_os = "visionos", target_os = "netbsd", target_os = "openbsd")))] pub pw_fields: ::c_int, @@ -128,7 +129,7 @@ s_no_extra_traits! { pub struct sockaddr_un { pub sun_len: u8, pub sun_family: sa_family_t, - pub sun_path: [c_char; 104] + pub sun_path: [::c_char; 104] } pub struct utsname { @@ -310,6 +311,7 @@ pub const IPV6_MULTICAST_IF: ::c_int = 9; pub const IPV6_MULTICAST_HOPS: ::c_int = 10; pub const IPV6_MULTICAST_LOOP: ::c_int = 11; pub const IPV6_V6ONLY: ::c_int = 27; +pub const IPV6_DONTFRAG: ::c_int = 62; pub const IPTOS_ECN_NOTECT: u8 = 0x00; pub const IPTOS_ECN_MASK: u8 = 0x03; @@ -546,7 +548,7 @@ f! { if (*mhdr).msg_controllen as usize >= ::mem::size_of::<::cmsghdr>() { (*mhdr).msg_control as *mut ::cmsghdr } else { - 0 as *mut ::cmsghdr + core::ptr::null_mut() } } @@ -632,7 +634,6 @@ extern "C" { pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; pub fn kqueue() -> ::c_int; pub fn unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int; - pub fn syscall(num: ::c_int, ...) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__getpwent50")] pub fn getpwent() -> *mut passwd; pub fn setpwent(); @@ -917,7 +918,15 @@ extern "C" { } cfg_if! { - if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))] { + if #[cfg(not(target_os = "openbsd"))] { + extern "C" { + pub fn syscall(num: ::c_int, ...) -> ::c_int; + } + } +} + +cfg_if! { + if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))] { mod apple; pub use self::apple::*; } else if #[cfg(any(target_os = "openbsd", target_os = "netbsd"))] { diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index e92cf65940141..29f54b92cd48b 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -92,6 +92,11 @@ s! { pub piod_addr: *mut ::c_void, pub piod_len: ::size_t, } + + pub struct mmsghdr { + pub msg_hdr: ::msghdr, + pub msg_len: ::c_uint, + } } pub const D_T_FMT: ::nl_item = 0; @@ -168,29 +173,29 @@ pub const FOPEN_MAX: ::c_uint = 20; pub const FILENAME_MAX: ::c_uint = 1024; pub const L_tmpnam: ::c_uint = 1024; pub const O_NOCTTY: ::c_int = 32768; -pub const S_IFIFO: mode_t = 4096; -pub const S_IFCHR: mode_t = 8192; -pub const S_IFBLK: mode_t = 24576; -pub const S_IFDIR: mode_t = 16384; -pub const S_IFREG: mode_t = 32768; -pub const S_IFLNK: mode_t = 40960; -pub const S_IFSOCK: mode_t = 49152; -pub const S_IFMT: mode_t = 61440; -pub const S_IEXEC: mode_t = 64; -pub const S_IWRITE: mode_t = 128; -pub const S_IREAD: mode_t = 256; -pub const S_IRWXU: mode_t = 448; -pub const S_IXUSR: mode_t = 64; -pub const S_IWUSR: mode_t = 128; -pub const S_IRUSR: mode_t = 256; -pub const S_IRWXG: mode_t = 56; -pub const S_IXGRP: mode_t = 8; -pub const S_IWGRP: mode_t = 16; -pub const S_IRGRP: mode_t = 32; -pub const S_IRWXO: mode_t = 7; -pub const S_IXOTH: mode_t = 1; -pub const S_IWOTH: mode_t = 2; -pub const S_IROTH: mode_t = 4; +pub const S_IFIFO: mode_t = 0o1_0000; +pub const S_IFCHR: mode_t = 0o2_0000; +pub const S_IFBLK: mode_t = 0o6_0000; +pub const S_IFDIR: mode_t = 0o4_0000; +pub const S_IFREG: mode_t = 0o10_0000; +pub const S_IFLNK: mode_t = 0o12_0000; +pub const S_IFSOCK: mode_t = 0o14_0000; +pub const S_IFMT: mode_t = 0o17_0000; +pub const S_IEXEC: mode_t = 0o0100; +pub const S_IWRITE: mode_t = 0o0200; +pub const S_IREAD: mode_t = 0o0400; +pub const S_IRWXU: mode_t = 0o0700; +pub const S_IXUSR: mode_t = 0o0100; +pub const S_IWUSR: mode_t = 0o0200; +pub const S_IRUSR: mode_t = 0o0400; +pub const S_IRWXG: mode_t = 0o0070; +pub const S_IXGRP: mode_t = 0o0010; +pub const S_IWGRP: mode_t = 0o0020; +pub const S_IRGRP: mode_t = 0o0040; +pub const S_IRWXO: mode_t = 0o0007; +pub const S_IXOTH: mode_t = 0o0001; +pub const S_IWOTH: mode_t = 0o0002; +pub const S_IROTH: mode_t = 0o0004; pub const F_OK: ::c_int = 0; pub const R_OK: ::c_int = 4; pub const W_OK: ::c_int = 2; @@ -364,12 +369,12 @@ pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; pub const POSIX_MADV_WILLNEED: ::c_int = 3; pub const POSIX_MADV_DONTNEED: ::c_int = 4; -pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01; -pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02; -pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_int = 0x04; -pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x08; -pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x10; -pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x20; +pub const POSIX_SPAWN_RESETIDS: ::c_short = 0x01; +pub const POSIX_SPAWN_SETPGROUP: ::c_short = 0x02; +pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_short = 0x04; +pub const POSIX_SPAWN_SETSCHEDULER: ::c_short = 0x08; +pub const POSIX_SPAWN_SETSIGDEF: ::c_short = 0x10; +pub const POSIX_SPAWN_SETSIGMASK: ::c_short = 0x20; pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0; pub const PTHREAD_CREATE_DETACHED: ::c_int = 1; @@ -672,7 +677,6 @@ extern "C" { addrlen: *mut ::socklen_t, flags: ::c_int, ) -> ::c_int; - pub fn mincore(addr: *mut ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__clock_getres50")] pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__clock_gettime50")] @@ -751,8 +755,8 @@ extern "C" { 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, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char, ) -> ::c_int; pub fn waitid( idtype: idtype_t, @@ -848,6 +852,20 @@ extern "C" { pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; pub fn basename(path: *mut ::c_char) -> *mut ::c_char; pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; + + pub fn sendmmsg( + sockfd: ::c_int, + mmsg: *mut ::mmsghdr, + vlen: ::c_uint, + flags: ::c_int, + ) -> ::c_int; + pub fn recvmmsg( + sockfd: ::c_int, + mmsg: *mut ::mmsghdr, + vlen: ::c_uint, + flags: ::c_int, + timeout: *mut ::timespec, + ) -> ::c_int; } cfg_if! { diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 2f383bfb9b9e9..f919b73e5c2f4 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -401,11 +401,6 @@ s! { pub sdl_data: [::c_char; 12], } - pub struct mmsghdr { - pub msg_hdr: ::msghdr, - pub msg_len: ::c_uint, - } - pub struct __exit_status { pub e_termination: u16, pub e_exit: u16, @@ -2330,7 +2325,7 @@ pub const PT_LWPNEXT: ::c_int = 25; pub const PT_SET_SIGPASS: ::c_int = 26; pub const PT_GET_SIGPASS: ::c_int = 27; pub const PT_FIRSTMACH: ::c_int = 32; -pub const POSIX_SPAWN_RETURNERROR: ::c_int = 0x40; +pub const POSIX_SPAWN_RETURNERROR: ::c_short = 0x40; // Flags for chflags(2) pub const SF_APPEND: ::c_ulong = 0x00040000; @@ -2759,20 +2754,6 @@ extern "C" { pub fn kqueue1(flags: ::c_int) -> ::c_int; - pub fn sendmmsg( - sockfd: ::c_int, - msgvec: *mut ::mmsghdr, - vlen: ::c_uint, - flags: ::c_int, - ) -> ::c_int; - pub fn recvmmsg( - sockfd: ::c_int, - msgvec: *mut ::mmsghdr, - vlen: ::c_uint, - flags: ::c_int, - timeout: *mut ::timespec, - ) -> ::c_int; - pub fn _lwp_self() -> lwpid_t; pub fn memmem( haystack: *const ::c_void, @@ -2862,6 +2843,22 @@ extern "C" { 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 = "___lwp_park60"] + pub fn _lwp_park( + clock: ::clockid_t, + flags: ::c_int, + ts: *const ::timespec, + unpark: ::lwpid_t, + hint: *const ::c_void, + unparkhint: *mut ::c_void, + ) -> ::c_int; + pub fn _lwp_unpark(lwp: ::lwpid_t, hint: *const ::c_void) -> ::c_int; + pub fn _lwp_unpark_all( + targets: *const ::lwpid_t, + ntargets: ::size_t, + hint: *const ::c_void, + ) -> ::c_int; } #[link(name = "rt")] @@ -2902,6 +2899,8 @@ extern "C" { result: *mut *mut ::group, ) -> ::c_int; + pub fn mincore(addr: *mut ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int; + pub fn updwtmpx(file: *const ::c_char, ut: *const utmpx) -> ::c_int; pub fn getlastlogx(fname: *const ::c_char, uid: ::uid_t, ll: *mut lastlogx) -> *mut lastlogx; pub fn updlastlogx(fname: *const ::c_char, uid: ::uid_t, ll: *mut lastlogx) -> ::c_int; diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index 145f46d0ba0f2..357662547b8e3 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -1248,12 +1248,6 @@ pub const NET_RT_IFLIST: ::c_int = 3; pub const NET_RT_STATS: ::c_int = 4; pub const NET_RT_TABLE: ::c_int = 5; pub const NET_RT_IFNAMES: ::c_int = 6; -#[doc(hidden)] -#[deprecated( - since = "0.2.95", - note = "Possibly increasing over the releases and might not be so used in the field" -)] -pub const NET_RT_MAXID: ::c_int = 7; pub const IPV6_JOIN_GROUP: ::c_int = 12; pub const IPV6_LEAVE_GROUP: ::c_int = 13; @@ -1554,21 +1548,16 @@ pub const KERN_NTHREADS: ::c_int = 26; pub const KERN_OSVERSION: ::c_int = 27; pub const KERN_SOMAXCONN: ::c_int = 28; pub const KERN_SOMINCONN: ::c_int = 29; -#[deprecated(since = "0.2.71", note = "Removed in OpenBSD 6.0")] -pub const KERN_USERMOUNT: ::c_int = 30; pub const KERN_NOSUIDCOREDUMP: ::c_int = 32; pub const KERN_FSYNC: ::c_int = 33; pub const KERN_SYSVMSG: ::c_int = 34; pub const KERN_SYSVSEM: ::c_int = 35; pub const KERN_SYSVSHM: ::c_int = 36; -#[deprecated(since = "0.2.71", note = "Removed in OpenBSD 6.0")] -pub const KERN_ARND: ::c_int = 37; pub const KERN_MSGBUFSIZE: ::c_int = 38; pub const KERN_MALLOCSTATS: ::c_int = 39; pub const KERN_CPTIME: ::c_int = 40; pub const KERN_NCHSTATS: ::c_int = 41; pub const KERN_FORKSTAT: ::c_int = 42; -pub const KERN_NSELCOLL: ::c_int = 43; pub const KERN_TTY: ::c_int = 44; pub const KERN_CCPU: ::c_int = 45; pub const KERN_FSCALE: ::c_int = 46; @@ -1608,11 +1597,6 @@ pub const KERN_AUDIO: ::c_int = 84; pub const KERN_CPUSTATS: ::c_int = 85; pub const KERN_PFSTATUS: ::c_int = 86; pub const KERN_TIMEOUT_STATS: ::c_int = 87; -#[deprecated( - since = "0.2.95", - note = "Possibly increasing over the releases and might not be so used in the field" -)] -pub const KERN_MAXID: ::c_int = 88; pub const KERN_PROC_ALL: ::c_int = 0; pub const KERN_PROC_PID: ::c_int = 1; diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index 50ed271d65e15..4afbeedfc1f9a 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -706,7 +706,7 @@ pub const F_RDLCK: ::c_int = 0x0040; pub const F_UNLCK: ::c_int = 0x0200; pub const F_WRLCK: ::c_int = 0x0400; -pub const AT_FDCWD: ::c_int = -1; +pub const AT_FDCWD: ::c_int = -100; pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x01; pub const AT_SYMLINK_FOLLOW: ::c_int = 0x02; pub const AT_REMOVEDIR: ::c_int = 0x04; @@ -771,27 +771,27 @@ pub const O_NOFOLLOW: ::c_int = 0x00080000; pub const O_NOCACHE: ::c_int = 0x00100000; pub const O_DIRECTORY: ::c_int = 0x00200000; -pub const S_IFIFO: ::mode_t = 4096; -pub const S_IFCHR: ::mode_t = 8192; -pub const S_IFBLK: ::mode_t = 24576; -pub const S_IFDIR: ::mode_t = 16384; -pub const S_IFREG: ::mode_t = 32768; -pub const S_IFLNK: ::mode_t = 40960; -pub const S_IFSOCK: ::mode_t = 49152; -pub const S_IFMT: ::mode_t = 61440; - -pub const S_IRWXU: ::mode_t = 0o00700; -pub const S_IRUSR: ::mode_t = 0o00400; -pub const S_IWUSR: ::mode_t = 0o00200; -pub const S_IXUSR: ::mode_t = 0o00100; -pub const S_IRWXG: ::mode_t = 0o00070; -pub const S_IRGRP: ::mode_t = 0o00040; -pub const S_IWGRP: ::mode_t = 0o00020; -pub const S_IXGRP: ::mode_t = 0o00010; -pub const S_IRWXO: ::mode_t = 0o00007; -pub const S_IROTH: ::mode_t = 0o00004; -pub const S_IWOTH: ::mode_t = 0o00002; -pub const S_IXOTH: ::mode_t = 0o00001; +pub const S_IFIFO: ::mode_t = 0o1_0000; +pub const S_IFCHR: ::mode_t = 0o2_0000; +pub const S_IFBLK: ::mode_t = 0o6_0000; +pub const S_IFDIR: ::mode_t = 0o4_0000; +pub const S_IFREG: ::mode_t = 0o10_0000; +pub const S_IFLNK: ::mode_t = 0o12_0000; +pub const S_IFSOCK: ::mode_t = 0o14_0000; +pub const S_IFMT: ::mode_t = 0o17_0000; + +pub const S_IRWXU: ::mode_t = 0o0700; +pub const S_IRUSR: ::mode_t = 0o0400; +pub const S_IWUSR: ::mode_t = 0o0200; +pub const S_IXUSR: ::mode_t = 0o0100; +pub const S_IRWXG: ::mode_t = 0o0070; +pub const S_IRGRP: ::mode_t = 0o0040; +pub const S_IWGRP: ::mode_t = 0o0020; +pub const S_IXGRP: ::mode_t = 0o0010; +pub const S_IRWXO: ::mode_t = 0o0007; +pub const S_IROTH: ::mode_t = 0o0004; +pub const S_IWOTH: ::mode_t = 0o0002; +pub const S_IXOTH: ::mode_t = 0o0001; pub const F_OK: ::c_int = 0; pub const R_OK: ::c_int = 4; @@ -1192,6 +1192,80 @@ pub const _SC_REGEXP: ::c_int = 62; pub const _SC_SYMLOOP_MAX: ::c_int = 63; pub const _SC_SHELL: ::c_int = 64; pub const _SC_TTY_NAME_MAX: ::c_int = 65; +pub const _SC_ADVISORY_INFO: ::c_int = 66; +pub const _SC_BARRIERS: ::c_int = 67; +pub const _SC_CLOCK_SELECTION: ::c_int = 68; +pub const _SC_FSYNC: ::c_int = 69; +pub const _SC_IPV6: ::c_int = 70; +pub const _SC_MEMLOCK: ::c_int = 71; +pub const _SC_MEMLOCK_RANGE: ::c_int = 72; +pub const _SC_MESSAGE_PASSING: ::c_int = 73; +pub const _SC_PRIORITIZED_IO: ::c_int = 74; +pub const _SC_PRIORITY_SCHEDULING: ::c_int = 75; +pub const _SC_READER_WRITER_LOCKS: ::c_int = 76; +pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 77; +pub const _SC_SPAWN: ::c_int = 78; +pub const _SC_SPIN_LOCKS: ::c_int = 79; +pub const _SC_SPORADIC_SERVER: ::c_int = 80; +pub const _SC_SYNCHRONIZED_IO: ::c_int = 81; +pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 82; +pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 83; +pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 84; +pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 85; +pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 86; +pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 87; +pub const _SC_TIMEOUTS: ::c_int = 88; +pub const _SC_TRACE: ::c_int = 89; +pub const _SC_TRACE_EVENT_FILTER: ::c_int = 90; +pub const _SC_TRACE_INHERIT: ::c_int = 91; +pub const _SC_TRACE_LOG: ::c_int = 92; +pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 93; +pub const _SC_V6_ILP32_OFF32: ::c_int = 94; +pub const _SC_V6_ILP32_OFFBIG: ::c_int = 95; +pub const _SC_V6_LP64_OFF64: ::c_int = 96; +pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 97; +pub const _SC_V7_ILP32_OFF32: ::c_int = 98; +pub const _SC_V7_ILP32_OFFBIG: ::c_int = 99; +pub const _SC_V7_LP64_OFF64: ::c_int = 100; +pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 101; +pub const _SC_2_C_BIND: ::c_int = 102; +pub const _SC_2_C_DEV: ::c_int = 103; +pub const _SC_2_CHAR_TERM: ::c_int = 104; +pub const _SC_2_FORT_DEV: ::c_int = 105; +pub const _SC_2_FORT_RUN: ::c_int = 106; +pub const _SC_2_LOCALEDEF: ::c_int = 107; +pub const _SC_2_PBS: ::c_int = 108; +pub const _SC_2_PBS_ACCOUNTING: ::c_int = 109; +pub const _SC_2_PBS_CHECKPOINT: ::c_int = 110; +pub const _SC_2_PBS_LOCATE: ::c_int = 111; +pub const _SC_2_PBS_MESSAGE: ::c_int = 112; +pub const _SC_2_PBS_TRACK: ::c_int = 113; +pub const _SC_2_SW_DEV: ::c_int = 114; +pub const _SC_2_UPE: ::c_int = 115; +pub const _SC_2_VERSION: ::c_int = 116; +pub const _SC_XOPEN_CRYPT: ::c_int = 117; +pub const _SC_XOPEN_ENH_I18N: ::c_int = 118; +pub const _SC_XOPEN_REALTIME: ::c_int = 119; +pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 120; +pub const _SC_XOPEN_SHM: ::c_int = 121; +pub const _SC_XOPEN_STREAMS: ::c_int = 122; +pub const _SC_XOPEN_UNIX: ::c_int = 123; +pub const _SC_XOPEN_UUCP: ::c_int = 124; +pub const _SC_XOPEN_VERSION: ::c_int = 125; +pub const _SC_BC_BASE_MAX: ::c_int = 129; +pub const _SC_BC_DIM_MAX: ::c_int = 130; +pub const _SC_BC_SCALE_MAX: ::c_int = 131; +pub const _SC_BC_STRING_MAX: ::c_int = 132; +pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 133; +pub const _SC_EXPR_NEST_MAX: ::c_int = 134; +pub const _SC_LINE_MAX: ::c_int = 135; +pub const _SC_LOGIN_NAME_MAX: ::c_int = 136; +pub const _SC_MQ_OPEN_MAX: ::c_int = 137; +pub const _SC_MQ_PRIO_MAX: ::c_int = 138; +pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 139; +pub const _SC_THREAD_KEYS_MAX: ::c_int = 140; +pub const _SC_THREAD_THREADS_MAX: ::c_int = 141; +pub const _SC_RE_DUP_MAX: ::c_int = 142; pub const PTHREAD_STACK_MIN: ::size_t = 8192; @@ -1386,8 +1460,9 @@ pub const TCGB_RI: ::c_int = 0x04; pub const TCGB_DCD: ::c_int = 0x08; pub const TIOCM_CTS: ::c_int = TCGB_CTS; pub const TIOCM_CD: ::c_int = TCGB_DCD; -pub const TIOCM_CAR: ::c_int = TIOCM_CD; +pub const TIOCM_CAR: ::c_int = TCGB_DCD; pub const TIOCM_RI: ::c_int = TCGB_RI; +pub const TIOCM_RNG: ::c_int = TCGB_RI; pub const TIOCM_DSR: ::c_int = TCGB_DSR; pub const TIOCM_DTR: ::c_int = 0x10; pub const TIOCM_RTS: ::c_int = 0x20; @@ -1430,17 +1505,14 @@ pub const TCGETA: ::c_ulong = 0x8000; pub const TCSETA: ::c_ulong = TCGETA + 1; pub const TCSETAF: ::c_ulong = TCGETA + 2; pub const TCSETAW: ::c_ulong = TCGETA + 3; -pub const TCWAITEVENT: ::c_ulong = TCGETA + 4; pub const TCSBRK: ::c_ulong = TCGETA + 5; pub const TCFLSH: ::c_ulong = TCGETA + 6; pub const TCXONC: ::c_ulong = TCGETA + 7; -pub const TCQUERYCONNECTED: ::c_ulong = TCGETA + 8; pub const TCGETBITS: ::c_ulong = TCGETA + 9; pub const TCSETDTR: ::c_ulong = TCGETA + 10; pub const TCSETRTS: ::c_ulong = TCGETA + 11; pub const TIOCGWINSZ: ::c_ulong = TCGETA + 12; pub const TIOCSWINSZ: ::c_ulong = TCGETA + 13; -pub const TCVTIME: ::c_ulong = TCGETA + 14; pub const TIOCGPGRP: ::c_ulong = TCGETA + 15; pub const TIOCSPGRP: ::c_ulong = TCGETA + 16; pub const TIOCSCTTY: ::c_ulong = TCGETA + 17; @@ -1450,6 +1522,10 @@ pub const TIOCSBRK: ::c_ulong = TCGETA + 20; pub const TIOCCBRK: ::c_ulong = TCGETA + 21; pub const TIOCMBIS: ::c_ulong = TCGETA + 22; pub const TIOCMBIC: ::c_ulong = TCGETA + 23; +pub const TIOCGSID: ::c_ulong = TCGETA + 24; +pub const TIOCOUTQ: ::c_ulong = TCGETA + 25; +pub const TIOCEXCL: ::c_ulong = TCGETA + 26; +pub const TIOCNXCL: ::c_ulong = TCGETA + 27; pub const PRIO_PROCESS: ::c_int = 0; pub const PRIO_PGRP: ::c_int = 1; @@ -1474,11 +1550,11 @@ pub const LOG_PERROR: ::c_int = 32 << 12; pub const LOG_NOWAIT: ::c_int = 64 << 12; // 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 = 0x10; -pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x20; -pub const POSIX_SPAWN_SETSID: ::c_int = 0x40; +pub const POSIX_SPAWN_RESETIDS: ::c_short = 0x01; +pub const POSIX_SPAWN_SETPGROUP: ::c_short = 0x02; +pub const POSIX_SPAWN_SETSIGDEF: ::c_short = 0x10; +pub const POSIX_SPAWN_SETSIGMASK: ::c_short = 0x20; +pub const POSIX_SPAWN_SETSID: ::c_short = 0x40; const_fn! { {const} fn CMSG_ALIGN(len: usize) -> usize { @@ -1715,6 +1791,7 @@ extern "C" { lock: *mut pthread_mutex_t, abstime: *const ::timespec, ) -> ::c_int; + pub fn pthread_sigqueue(thread: ::pthread_t, sig: ::c_int, value: ::sigval) -> ::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; @@ -1765,8 +1842,8 @@ extern "C" { pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; pub fn execvpe( file: *const ::c_char, - argv: *const *const ::c_char, - environment: *const *const ::c_char, + argv: *const *mut ::c_char, + environment: *const *mut ::c_char, ) -> ::c_int; pub fn getgrgid_r( gid: ::gid_t, diff --git a/src/unix/haiku/native.rs b/src/unix/haiku/native.rs index 3d266deb56721..77aa1cf16ae43 100644 --- a/src/unix/haiku/native.rs +++ b/src/unix/haiku/native.rs @@ -945,6 +945,7 @@ pub const B_XATTR_TYPE: u32 = haiku_constant!('X', 'A', 'T', 'R'); pub const B_NETWORK_ADDRESS_TYPE: u32 = haiku_constant!('N', 'W', 'A', 'D'); pub const B_MIME_STRING_TYPE: u32 = haiku_constant!('M', 'I', 'M', 'S'); pub const B_ASCII_TYPE: u32 = haiku_constant!('T', 'E', 'X', 'T'); +pub const B_APP_IMAGE_SYMBOL: *const ::c_void = core::ptr::null(); extern "C" { // kernel/OS.h @@ -1299,7 +1300,7 @@ extern "C" { pub fn find_path_for_path_etc( path: *const ::c_char, dependency: *const ::c_char, - architectur: *const ::c_char, + architecture: *const ::c_char, baseDirectory: path_base_directory, subPath: *const ::c_char, flags: u32, diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index d780e22f78e7b..a89da8c5e5b2b 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -73,7 +73,6 @@ pub type __socklen_t = __u32_type; pub type __sig_atomic_t = ::c_int; pub type __time64_t = __int64_t; pub type ssize_t = __ssize_t; -pub type size_t = ::c_ulong; pub type wchar_t = ::c_int; pub type wint_t = ::c_uint; pub type gid_t = __gid_t; @@ -341,7 +340,7 @@ s! { pub ai_family: ::c_int, pub ai_socktype: ::c_int, pub ai_protocol: ::c_int, - pub ai_addrlen: socklen_t, + pub ai_addrlen: ::socklen_t, pub ai_addr: *mut sockaddr, pub ai_canonname: *mut ::c_char, pub ai_next: *mut addrinfo, @@ -349,11 +348,11 @@ s! { pub struct msghdr { pub msg_name: *mut ::c_void, - pub msg_namelen: socklen_t, + pub msg_namelen: ::socklen_t, pub msg_iov: *mut ::iovec, pub msg_iovlen: ::c_int, pub msg_control: *mut ::c_void, - pub msg_controllen: socklen_t, + pub msg_controllen: ::socklen_t, pub msg_flags: ::c_int, } @@ -450,6 +449,11 @@ s! { pub tv_nsec: __syscall_slong_t, } + pub struct __timeval { + pub tv_sec: i32, + pub tv_usec: i32, + } + pub struct __locale_data { pub _address: u8, } @@ -678,8 +682,8 @@ s! { pub struct __pthread_attr { pub __schedparam: sched_param, pub __stackaddr: *mut ::c_void, - pub __stacksize: size_t, - pub __guardsize: size_t, + pub __stacksize: ::size_t, + pub __guardsize: ::size_t, pub __detachstate: __pthread_detachstate, pub __inheritsched: __pthread_inheritsched, pub __contentionscope: __pthread_contentionscope, @@ -728,7 +732,7 @@ s! { pub struct iovec { pub iov_base: *mut ::c_void, - pub iov_len: size_t, + pub iov_len: ::size_t, } pub struct passwd { @@ -2117,29 +2121,29 @@ pub const MINSIGSTKSZ: usize = 8192; pub const SIGSTKSZ: usize = 40960; // sys/stat.h -pub const __S_IFMT: mode_t = 61440; -pub const __S_IFDIR: mode_t = 16384; -pub const __S_IFCHR: mode_t = 8192; -pub const __S_IFBLK: mode_t = 24576; -pub const __S_IFREG: mode_t = 32768; -pub const __S_IFLNK: mode_t = 40960; -pub const __S_IFSOCK: mode_t = 49152; -pub const __S_IFIFO: mode_t = 4096; -pub const __S_ISUID: mode_t = 2048; -pub const __S_ISGID: mode_t = 1024; -pub const __S_ISVTX: mode_t = 512; -pub const __S_IREAD: mode_t = 256; -pub const __S_IWRITE: mode_t = 128; -pub const __S_IEXEC: mode_t = 64; -pub const S_INOCACHE: mode_t = 65536; -pub const S_IUSEUNK: mode_t = 131072; -pub const S_IUNKNOWN: mode_t = 1835008; -pub const S_IUNKSHIFT: mode_t = 12; -pub const S_IPTRANS: mode_t = 2097152; -pub const S_IATRANS: mode_t = 4194304; -pub const S_IROOT: mode_t = 8388608; -pub const S_ITRANS: mode_t = 14680064; -pub const S_IMMAP0: mode_t = 16777216; +pub const __S_IFMT: mode_t = 0o17_0000; +pub const __S_IFDIR: mode_t = 0o4_0000; +pub const __S_IFCHR: mode_t = 0o2_0000; +pub const __S_IFBLK: mode_t = 0o6_0000; +pub const __S_IFREG: mode_t = 0o10_0000; +pub const __S_IFLNK: mode_t = 0o12_0000; +pub const __S_IFSOCK: mode_t = 0o14_0000; +pub const __S_IFIFO: mode_t = 0o1_0000; +pub const __S_ISUID: mode_t = 0o4000; +pub const __S_ISGID: mode_t = 0o2000; +pub const __S_ISVTX: mode_t = 0o1000; +pub const __S_IREAD: mode_t = 0o0400; +pub const __S_IWRITE: mode_t = 0o0200; +pub const __S_IEXEC: mode_t = 0o0100; +pub const S_INOCACHE: mode_t = 0o20_0000; +pub const S_IUSEUNK: mode_t = 0o40_0000; +pub const S_IUNKNOWN: mode_t = 0o700_0000; +pub const S_IUNKSHIFT: mode_t = 0o0014; +pub const S_IPTRANS: mode_t = 0o1000_0000; +pub const S_IATRANS: mode_t = 0o2000_0000; +pub const S_IROOT: mode_t = 0o4000_0000; +pub const S_ITRANS: mode_t = 0o7000_0000; +pub const S_IMMAP0: mode_t = 0o10000_0000; pub const CMASK: mode_t = 18; pub const UF_SETTABLE: ::c_uint = 65535; pub const UF_NODUMP: ::c_uint = 1; @@ -2155,32 +2159,32 @@ 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 S_IFMT: ::mode_t = 0o17_0000; +pub const S_IFDIR: ::mode_t = 0o4_0000; +pub const S_IFCHR: ::mode_t = 0o2_0000; +pub const S_IFBLK: ::mode_t = 0o6_0000; +pub const S_IFREG: ::mode_t = 0o10_0000; +pub const S_IFIFO: ::mode_t = 0o1_0000; +pub const S_IFLNK: ::mode_t = 0o12_0000; +pub const S_IFSOCK: ::mode_t = 0o14_0000; +pub const S_ISUID: ::mode_t = 0o4000; +pub const S_ISGID: ::mode_t = 0o2000; +pub const S_ISVTX: ::mode_t = 0o1000; +pub const S_IRUSR: ::mode_t = 0o0400; +pub const S_IWUSR: ::mode_t = 0o0200; +pub const S_IXUSR: ::mode_t = 0o0100; +pub const S_IRWXU: ::mode_t = 0o0700; +pub const S_IREAD: ::mode_t = 0o0400; +pub const S_IWRITE: ::mode_t = 0o0200; +pub const S_IEXEC: ::mode_t = 0o0100; +pub const S_IRGRP: ::mode_t = 0o0040; +pub const S_IWGRP: ::mode_t = 0o0020; +pub const S_IXGRP: ::mode_t = 0o0010; +pub const S_IRWXG: ::mode_t = 0o0070; +pub const S_IROTH: ::mode_t = 0o0004; +pub const S_IWOTH: ::mode_t = 0o0002; +pub const S_IXOTH: ::mode_t = 0o0001; +pub const S_IRWXO: ::mode_t = 0o0007; pub const ACCESSPERMS: ::mode_t = 511; pub const ALLPERMS: ::mode_t = 4095; pub const DEFFILEMODE: ::mode_t = 438; @@ -2760,9 +2764,13 @@ pub const MREMAP_FIXED: ::c_int = 2; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +// sys/xattr.h +pub const XATTR_CREATE: ::c_int = 0x1; +pub const XATTR_REPLACE: ::c_int = 0x2; + // spawn.h -pub const POSIX_SPAWN_USEVFORK: ::c_int = 64; -pub const POSIX_SPAWN_SETSID: ::c_int = 128; +pub const POSIX_SPAWN_USEVFORK: ::c_short = 64; +pub const POSIX_SPAWN_SETSID: ::c_short = 128; // sys/syslog.h pub const LOG_CRON: ::c_int = 9 << 3; @@ -3640,13 +3648,13 @@ extern "C" { __iovec: *const ::iovec, __count: ::c_int, __offset: __off_t, - ) -> ssize_t; + ) -> ::ssize_t; pub fn pwritev( __fd: ::c_int, __iovec: *const ::iovec, __count: ::c_int, __offset: __off_t, - ) -> ssize_t; + ) -> ::ssize_t; pub fn preadv64( fd: ::c_int, @@ -3727,7 +3735,7 @@ extern "C" { 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 bind(__fd: ::c_int, __addr: *const sockaddr, __len: ::socklen_t) -> ::c_int; pub fn accept4( fd: ::c_int, @@ -3745,7 +3753,7 @@ extern "C" { pub fn recvmsg(__fd: ::c_int, __message: *mut msghdr, __flags: ::c_int) -> ::ssize_t; - pub fn sendmsg(__fd: ::c_int, __message: *const msghdr, __flags: ::c_int) -> ssize_t; + pub fn sendmsg(__fd: ::c_int, __message: *const msghdr, __flags: ::c_int) -> ::ssize_t; pub fn recvfrom( socket: ::c_int, @@ -4202,14 +4210,10 @@ extern "C" { ) -> ::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, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char, ) -> ::c_int; + pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int; pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; @@ -4349,7 +4353,7 @@ extern "C" { pub fn mmap64( __addr: *mut ::c_void, - __len: size_t, + __len: ::size_t, __prot: ::c_int, __flags: ::c_int, __fd: ::c_int, diff --git a/src/unix/linux_like/android/b32/arm.rs b/src/unix/linux_like/android/b32/arm.rs index caf1f8a0f50fc..bc815fba392e5 100644 --- a/src/unix/linux_like/android/b32/arm.rs +++ b/src/unix/linux_like/android/b32/arm.rs @@ -508,6 +508,22 @@ pub const SYS_fsopen: ::c_long = 430; pub const SYS_fsconfig: ::c_long = 431; pub const SYS_fsmount: ::c_long = 432; pub const SYS_fspick: ::c_long = 433; +pub const SYS_pidfd_open: ::c_long = 434; +pub const SYS_clone3: ::c_long = 435; +pub const SYS_close_range: ::c_long = 436; +pub const SYS_openat2: ::c_long = 437; +pub const SYS_pidfd_getfd: ::c_long = 438; +pub const SYS_faccessat2: ::c_long = 439; +pub const SYS_process_madvise: ::c_long = 440; +pub const SYS_epoll_pwait2: ::c_long = 441; +pub const SYS_mount_setattr: ::c_long = 442; +pub const SYS_quotactl_fd: ::c_long = 443; +pub const SYS_landlock_create_ruleset: ::c_long = 444; +pub const SYS_landlock_add_rule: ::c_long = 445; +pub const SYS_landlock_restrict_self: ::c_long = 446; +pub const SYS_process_mrelease: ::c_long = 448; +pub const SYS_futex_waitv: ::c_long = 449; +pub const SYS_set_mempolicy_home_node: ::c_long = 450; // offsets in mcontext_t.gregs from sys/ucontext.h pub const REG_R0: ::c_int = 0; @@ -529,6 +545,9 @@ pub const REG_R15: ::c_int = 15; pub const NGREG: ::c_int = 18; +// From NDK's asm/auxvec.h +pub const AT_SYSINFO_EHDR: ::c_ulong = 33; + f! { // Sadly, Android before 5.0 (API level 21), the accept4 syscall is not // exposed by the libc. As work-around, we implement it through `syscall` diff --git a/src/unix/linux_like/android/b32/mod.rs b/src/unix/linux_like/android/b32/mod.rs index 1f4f796f2a94a..aa29267f9db50 100644 --- a/src/unix/linux_like/android/b32/mod.rs +++ b/src/unix/linux_like/android/b32/mod.rs @@ -9,6 +9,7 @@ pub type sigset_t = ::c_ulong; pub type socklen_t = i32; pub type time64_t = i64; pub type __u64 = ::c_ulonglong; +pub type __s64 = ::c_longlong; s! { pub struct sigaction { diff --git a/src/unix/linux_like/android/b32/x86/mod.rs b/src/unix/linux_like/android/b32/x86/mod.rs index de0b3ab595f24..2ec6093f488d6 100644 --- a/src/unix/linux_like/android/b32/x86/mod.rs +++ b/src/unix/linux_like/android/b32/x86/mod.rs @@ -540,6 +540,23 @@ pub const SYS_fsopen: ::c_long = 430; pub const SYS_fsconfig: ::c_long = 431; pub const SYS_fsmount: ::c_long = 432; pub const SYS_fspick: ::c_long = 433; +pub const SYS_pidfd_open: ::c_long = 434; +pub const SYS_clone3: ::c_long = 435; +pub const SYS_close_range: ::c_long = 436; +pub const SYS_openat2: ::c_long = 437; +pub const SYS_pidfd_getfd: ::c_long = 438; +pub const SYS_faccessat2: ::c_long = 439; +pub const SYS_process_madvise: ::c_long = 440; +pub const SYS_epoll_pwait2: ::c_long = 441; +pub const SYS_mount_setattr: ::c_long = 442; +pub const SYS_quotactl_fd: ::c_long = 443; +pub const SYS_landlock_create_ruleset: ::c_long = 444; +pub const SYS_landlock_add_rule: ::c_long = 445; +pub const SYS_landlock_restrict_self: ::c_long = 446; +pub const SYS_memfd_secret: ::c_long = 447; +pub const SYS_process_mrelease: ::c_long = 448; +pub const SYS_futex_waitv: ::c_long = 449; +pub const SYS_set_mempolicy_home_node: ::c_long = 450; // offsets in user_regs_structs, from sys/reg.h pub const EBX: ::c_int = 0; @@ -581,6 +598,11 @@ pub const REG_EFL: ::c_int = 16; pub const REG_UESP: ::c_int = 17; pub const REG_SS: ::c_int = 18; +// From NDK's asm/auxvec.h +pub const AT_SYSINFO: ::c_ulong = 32; +pub const AT_SYSINFO_EHDR: ::c_ulong = 33; +pub const AT_VECTOR_SIZE_ARCH: ::c_ulong = 3; + // socketcall values from linux/net.h (only the needed ones, and not public) const SYS_ACCEPT4: ::c_int = 18; diff --git a/src/unix/linux_like/android/b64/aarch64/mod.rs b/src/unix/linux_like/android/b64/aarch64/mod.rs index ce7bdaa31aa63..718bf779bb908 100644 --- a/src/unix/linux_like/android/b64/aarch64/mod.rs +++ b/src/unix/linux_like/android/b64/aarch64/mod.rs @@ -1,6 +1,7 @@ pub type c_char = u8; pub type wchar_t = u32; pub type __u64 = ::c_ulonglong; +pub type __s64 = ::c_longlong; s! { pub struct stat { @@ -191,6 +192,7 @@ pub const SYS_vhangup: ::c_long = 58; pub const SYS_pipe2: ::c_long = 59; pub const SYS_quotactl: ::c_long = 60; pub const SYS_getdents64: ::c_long = 61; +pub const SYS_lseek: ::c_long = 62; pub const SYS_read: ::c_long = 63; pub const SYS_write: ::c_long = 64; pub const SYS_readv: ::c_long = 65; @@ -347,6 +349,7 @@ pub const SYS_request_key: ::c_long = 218; pub const SYS_keyctl: ::c_long = 219; pub const SYS_clone: ::c_long = 220; pub const SYS_execve: ::c_long = 221; +pub const SYS_mmap: ::c_long = 222; pub const SYS_swapon: ::c_long = 224; pub const SYS_swapoff: ::c_long = 225; pub const SYS_mprotect: ::c_long = 226; @@ -410,11 +413,32 @@ pub const SYS_fsopen: ::c_long = 430; pub const SYS_fsconfig: ::c_long = 431; pub const SYS_fsmount: ::c_long = 432; pub const SYS_fspick: ::c_long = 433; -pub const SYS_syscalls: ::c_long = 436; +pub const SYS_pidfd_open: ::c_long = 434; +pub const SYS_clone3: ::c_long = 435; +pub const SYS_close_range: ::c_long = 436; +pub const SYS_openat2: ::c_long = 437; +pub const SYS_pidfd_getfd: ::c_long = 438; +pub const SYS_faccessat2: ::c_long = 439; +pub const SYS_process_madvise: ::c_long = 440; +pub const SYS_epoll_pwait2: ::c_long = 441; +pub const SYS_mount_setattr: ::c_long = 442; +pub const SYS_quotactl_fd: ::c_long = 443; +pub const SYS_landlock_create_ruleset: ::c_long = 444; +pub const SYS_landlock_add_rule: ::c_long = 445; +pub const SYS_landlock_restrict_self: ::c_long = 446; +pub const SYS_memfd_secret: ::c_long = 447; +pub const SYS_process_mrelease: ::c_long = 448; +pub const SYS_futex_waitv: ::c_long = 449; +pub const SYS_set_mempolicy_home_node: ::c_long = 450; +pub const SYS_syscalls: ::c_long = 451; pub const PROT_BTI: ::c_int = 0x10; pub const PROT_MTE: ::c_int = 0x20; +// From NDK's asm/auxvec.h +pub const AT_SYSINFO_EHDR: ::c_ulong = 33; +pub const AT_VECTOR_SIZE_ARCH: ::c_ulong = 2; + mod align; pub use self::align::*; diff --git a/src/unix/linux_like/android/b64/mod.rs b/src/unix/linux_like/android/b64/mod.rs index 67d0dacf17e93..97cf137b7fc79 100644 --- a/src/unix/linux_like/android/b64/mod.rs +++ b/src/unix/linux_like/android/b64/mod.rs @@ -264,31 +264,6 @@ pub const RTLD_GLOBAL: ::c_int = 0x00100; pub const RTLD_NOW: ::c_int = 2; pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; -// From NDK's linux/auxvec.h -pub const AT_NULL: ::c_ulong = 0; -pub const AT_IGNORE: ::c_ulong = 1; -pub const AT_EXECFD: ::c_ulong = 2; -pub const AT_PHDR: ::c_ulong = 3; -pub const AT_PHENT: ::c_ulong = 4; -pub const AT_PHNUM: ::c_ulong = 5; -pub const AT_PAGESZ: ::c_ulong = 6; -pub const AT_BASE: ::c_ulong = 7; -pub const AT_FLAGS: ::c_ulong = 8; -pub const AT_ENTRY: ::c_ulong = 9; -pub const AT_NOTELF: ::c_ulong = 10; -pub const AT_UID: ::c_ulong = 11; -pub const AT_EUID: ::c_ulong = 12; -pub const AT_GID: ::c_ulong = 13; -pub const AT_EGID: ::c_ulong = 14; -pub const AT_PLATFORM: ::c_ulong = 15; -pub const AT_HWCAP: ::c_ulong = 16; -pub const AT_CLKTCK: ::c_ulong = 17; -pub const AT_SECURE: ::c_ulong = 23; -pub const AT_BASE_PLATFORM: ::c_ulong = 24; -pub const AT_RANDOM: ::c_ulong = 25; -pub const AT_HWCAP2: ::c_ulong = 26; -pub const AT_EXECFN: ::c_ulong = 31; - pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { value: 0, __reserved: [0; 36], diff --git a/src/unix/linux_like/android/b64/riscv64/mod.rs b/src/unix/linux_like/android/b64/riscv64/mod.rs index 9d233ad0a2a38..bf4c8988fae93 100644 --- a/src/unix/linux_like/android/b64/riscv64/mod.rs +++ b/src/unix/linux_like/android/b64/riscv64/mod.rs @@ -2,6 +2,7 @@ pub type c_char = i8; pub type wchar_t = u32; pub type greg_t = i64; pub type __u64 = ::c_ulonglong; +pub type __s64 = ::c_longlong; s! { pub struct stat { @@ -343,7 +344,35 @@ pub const SYS_fsopen: ::c_long = 430; pub const SYS_fsconfig: ::c_long = 431; pub const SYS_fsmount: ::c_long = 432; pub const SYS_fspick: ::c_long = 433; -pub const SYS_syscalls: ::c_long = 436; +pub const SYS_pidfd_open: ::c_long = 434; +pub const SYS_clone3: ::c_long = 435; +pub const SYS_close_range: ::c_long = 436; +pub const SYS_openat2: ::c_long = 437; +pub const SYS_pidfd_getfd: ::c_long = 438; +pub const SYS_faccessat2: ::c_long = 439; +pub const SYS_process_madvise: ::c_long = 440; +pub const SYS_epoll_pwait2: ::c_long = 441; +pub const SYS_mount_setattr: ::c_long = 442; +pub const SYS_quotactl_fd: ::c_long = 443; +pub const SYS_landlock_create_ruleset: ::c_long = 444; +pub const SYS_landlock_add_rule: ::c_long = 445; +pub const SYS_landlock_restrict_self: ::c_long = 446; +pub const SYS_memfd_secret: ::c_long = 447; +pub const SYS_process_mrelease: ::c_long = 448; +pub const SYS_futex_waitv: ::c_long = 449; +pub const SYS_set_mempolicy_home_node: ::c_long = 450; + +// From NDK's asm/auxvec.h +pub const AT_SYSINFO_EHDR: ::c_ulong = 33; +pub const AT_L1I_CACHESIZE: ::c_ulong = 40; +pub const AT_L1I_CACHEGEOMETRY: ::c_ulong = 41; +pub const AT_L1D_CACHESIZE: ::c_ulong = 42; +pub const AT_L1D_CACHEGEOMETRY: ::c_ulong = 43; +pub const AT_L2_CACHESIZE: ::c_ulong = 44; +pub const AT_L2_CACHEGEOMETRY: ::c_ulong = 45; +pub const AT_L3_CACHESIZE: ::c_ulong = 46; +pub const AT_L3_CACHEGEOMETRY: ::c_ulong = 47; +pub const AT_VECTOR_SIZE_ARCH: ::c_ulong = 9; mod align; pub use self::align::*; diff --git a/src/unix/linux_like/android/b64/x86_64/mod.rs b/src/unix/linux_like/android/b64/x86_64/mod.rs index 5d392268493f2..780dae6103491 100644 --- a/src/unix/linux_like/android/b64/x86_64/mod.rs +++ b/src/unix/linux_like/android/b64/x86_64/mod.rs @@ -2,6 +2,7 @@ pub type c_char = i8; pub type wchar_t = i32; pub type greg_t = i64; pub type __u64 = ::c_ulonglong; +pub type __s64 = ::c_longlong; s! { pub struct stat { @@ -735,6 +736,23 @@ pub const SYS_fsopen: ::c_long = 430; pub const SYS_fsconfig: ::c_long = 431; pub const SYS_fsmount: ::c_long = 432; pub const SYS_fspick: ::c_long = 433; +pub const SYS_pidfd_open: ::c_long = 434; +pub const SYS_clone3: ::c_long = 435; +pub const SYS_close_range: ::c_long = 436; +pub const SYS_openat2: ::c_long = 437; +pub const SYS_pidfd_getfd: ::c_long = 438; +pub const SYS_faccessat2: ::c_long = 439; +pub const SYS_process_madvise: ::c_long = 440; +pub const SYS_epoll_pwait2: ::c_long = 441; +pub const SYS_mount_setattr: ::c_long = 442; +pub const SYS_quotactl_fd: ::c_long = 443; +pub const SYS_landlock_create_ruleset: ::c_long = 444; +pub const SYS_landlock_add_rule: ::c_long = 445; +pub const SYS_landlock_restrict_self: ::c_long = 446; +pub const SYS_memfd_secret: ::c_long = 447; +pub const SYS_process_mrelease: ::c_long = 448; +pub const SYS_futex_waitv: ::c_long = 449; +pub const SYS_set_mempolicy_home_node: ::c_long = 450; // offsets in user_regs_structs, from sys/reg.h pub const R15: ::c_int = 0; @@ -790,5 +808,9 @@ pub const REG_TRAPNO: ::c_int = 20; pub const REG_OLDMASK: ::c_int = 21; pub const REG_CR2: ::c_int = 22; +// From NDK's asm/auxvec.h +pub const AT_SYSINFO_EHDR: ::c_ulong = 33; +pub const AT_VECTOR_SIZE_ARCH: ::c_ulong = 3; + mod align; pub use self::align::*; diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 7208e4fa12b5b..3e1b83e5adb73 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -48,6 +48,10 @@ pub type Elf64_Xword = u64; pub type eventfd_t = u64; +// these structs sit behind a heap allocation on Android +pub type posix_spawn_file_actions_t = *mut ::c_void; +pub type posix_spawnattr_t = *mut ::c_void; + s! { pub struct stack_t { pub ss_sp: *mut ::c_void, @@ -510,8 +514,40 @@ s! { pub ifr6_addr: ::in6_addr, pub ifr6_prefixlen: u32, pub ifr6_ifindex: ::c_int, - } + } + + 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, + pub stx_mnt_id: ::__u64, + pub stx_dio_mem_align: ::__u32, + pub stx_dio_offset_align: ::__u32, + __statx_pad3: [::__u64; 12], + } + pub struct statx_timestamp { + pub tv_sec: ::__s64, + pub tv_nsec: ::__u32, + pub __reserved: ::__s32, + } } s_no_extra_traits! { @@ -590,13 +626,7 @@ s_no_extra_traits! { pub absflat: [::__s32; ABS_CNT], } - /// WARNING: The `PartialEq`, `Eq` and `Hash` implementations of this - /// type are unsound and will be removed in the future. - #[deprecated( - note = "this struct has unsafe trait implementations that will be \ - removed in the future", - since = "0.2.80" - )] + #[allow(missing_debug_implementations)] pub struct af_alg_iv { pub ivlen: u32, pub iv: [::c_uchar; 0], @@ -1032,44 +1062,6 @@ cfg_if! { } } - #[allow(deprecated)] - impl af_alg_iv { - fn as_slice(&self) -> &[u8] { - unsafe { - ::core::slice::from_raw_parts( - self.iv.as_ptr(), - self.ivlen as usize - ) - } - } - } - - #[allow(deprecated)] - impl PartialEq for af_alg_iv { - fn eq(&self, other: &af_alg_iv) -> bool { - *self.as_slice() == *other.as_slice() - } - } - - #[allow(deprecated)] - impl Eq for af_alg_iv {} - - #[allow(deprecated)] - impl ::fmt::Debug for af_alg_iv { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("af_alg_iv") - .field("ivlen", &self.ivlen) - .finish() - } - } - - #[allow(deprecated)] - impl ::hash::Hash for af_alg_iv { - fn hash(&self, state: &mut H) { - self.as_slice().hash(state); - } - } - impl PartialEq for prop_info { fn eq(&self, other: &prop_info) -> bool { self.__name == other.__name && @@ -1169,140 +1161,155 @@ pub const _PC_SYNC_IO: ::c_int = 19; pub const FIONBIO: ::c_int = 0x5421; -pub const _SC_ARG_MAX: ::c_int = 0; -pub const _SC_BC_BASE_MAX: ::c_int = 1; -pub const _SC_BC_DIM_MAX: ::c_int = 2; -pub const _SC_BC_SCALE_MAX: ::c_int = 3; -pub const _SC_BC_STRING_MAX: ::c_int = 4; -pub const _SC_CHILD_MAX: ::c_int = 5; -pub const _SC_CLK_TCK: ::c_int = 6; -pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 7; -pub const _SC_EXPR_NEST_MAX: ::c_int = 8; -pub const _SC_LINE_MAX: ::c_int = 9; -pub const _SC_NGROUPS_MAX: ::c_int = 10; -pub const _SC_OPEN_MAX: ::c_int = 11; -pub const _SC_PASS_MAX: ::c_int = 12; -pub const _SC_2_C_BIND: ::c_int = 13; -pub const _SC_2_C_DEV: ::c_int = 14; -pub const _SC_2_C_VERSION: ::c_int = 15; -pub const _SC_2_CHAR_TERM: ::c_int = 16; -pub const _SC_2_FORT_DEV: ::c_int = 17; -pub const _SC_2_FORT_RUN: ::c_int = 18; -pub const _SC_2_LOCALEDEF: ::c_int = 19; -pub const _SC_2_SW_DEV: ::c_int = 20; -pub const _SC_2_UPE: ::c_int = 21; -pub const _SC_2_VERSION: ::c_int = 22; -pub const _SC_JOB_CONTROL: ::c_int = 23; -pub const _SC_SAVED_IDS: ::c_int = 24; -pub const _SC_VERSION: ::c_int = 25; -pub const _SC_RE_DUP_MAX: ::c_int = 26; -pub const _SC_STREAM_MAX: ::c_int = 27; -pub const _SC_TZNAME_MAX: ::c_int = 28; -pub const _SC_XOPEN_CRYPT: ::c_int = 29; -pub const _SC_XOPEN_ENH_I18N: ::c_int = 30; -pub const _SC_XOPEN_SHM: ::c_int = 31; -pub const _SC_XOPEN_VERSION: ::c_int = 32; -pub const _SC_XOPEN_XCU_VERSION: ::c_int = 33; -pub const _SC_XOPEN_REALTIME: ::c_int = 34; -pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 35; -pub const _SC_XOPEN_LEGACY: ::c_int = 36; -pub const _SC_ATEXIT_MAX: ::c_int = 37; -pub const _SC_IOV_MAX: ::c_int = 38; -pub const _SC_PAGESIZE: ::c_int = 39; -pub const _SC_PAGE_SIZE: ::c_int = 40; -pub const _SC_XOPEN_UNIX: ::c_int = 41; -pub const _SC_XBS5_ILP32_OFF32: ::c_int = 42; -pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 43; -pub const _SC_XBS5_LP64_OFF64: ::c_int = 44; -pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 45; -pub const _SC_AIO_LISTIO_MAX: ::c_int = 46; -pub const _SC_AIO_MAX: ::c_int = 47; -pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 48; -pub const _SC_DELAYTIMER_MAX: ::c_int = 49; -pub const _SC_MQ_OPEN_MAX: ::c_int = 50; -pub const _SC_MQ_PRIO_MAX: ::c_int = 51; -pub const _SC_RTSIG_MAX: ::c_int = 52; -pub const _SC_SEM_NSEMS_MAX: ::c_int = 53; -pub const _SC_SEM_VALUE_MAX: ::c_int = 54; -pub const _SC_SIGQUEUE_MAX: ::c_int = 55; -pub const _SC_TIMER_MAX: ::c_int = 56; -pub const _SC_ASYNCHRONOUS_IO: ::c_int = 57; -pub const _SC_FSYNC: ::c_int = 58; -pub const _SC_MAPPED_FILES: ::c_int = 59; -pub const _SC_MEMLOCK: ::c_int = 60; -pub const _SC_MEMLOCK_RANGE: ::c_int = 61; -pub const _SC_MEMORY_PROTECTION: ::c_int = 62; -pub const _SC_MESSAGE_PASSING: ::c_int = 63; -pub const _SC_PRIORITIZED_IO: ::c_int = 64; -pub const _SC_PRIORITY_SCHEDULING: ::c_int = 65; -pub const _SC_REALTIME_SIGNALS: ::c_int = 66; -pub const _SC_SEMAPHORES: ::c_int = 67; -pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 68; -pub const _SC_SYNCHRONIZED_IO: ::c_int = 69; -pub const _SC_TIMERS: ::c_int = 70; -pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 71; -pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 72; -pub const _SC_LOGIN_NAME_MAX: ::c_int = 73; -pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 74; -pub const _SC_THREAD_KEYS_MAX: ::c_int = 75; -pub const _SC_THREAD_STACK_MIN: ::c_int = 76; -pub const _SC_THREAD_THREADS_MAX: ::c_int = 77; -pub const _SC_TTY_NAME_MAX: ::c_int = 78; -pub const _SC_THREADS: ::c_int = 79; -pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 80; -pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 81; -pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 82; -pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 83; -pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 84; -pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 85; -pub const _SC_NPROCESSORS_CONF: ::c_int = 96; -pub const _SC_NPROCESSORS_ONLN: ::c_int = 97; -pub const _SC_PHYS_PAGES: ::c_int = 98; -pub const _SC_AVPHYS_PAGES: ::c_int = 99; -pub const _SC_MONOTONIC_CLOCK: ::c_int = 100; - -pub const _SC_2_PBS: ::c_int = 101; -pub const _SC_2_PBS_ACCOUNTING: ::c_int = 102; -pub const _SC_2_PBS_CHECKPOINT: ::c_int = 103; -pub const _SC_2_PBS_LOCATE: ::c_int = 104; -pub const _SC_2_PBS_MESSAGE: ::c_int = 105; -pub const _SC_2_PBS_TRACK: ::c_int = 106; -pub const _SC_ADVISORY_INFO: ::c_int = 107; -pub const _SC_BARRIERS: ::c_int = 108; -pub const _SC_CLOCK_SELECTION: ::c_int = 109; -pub const _SC_CPUTIME: ::c_int = 110; -pub const _SC_HOST_NAME_MAX: ::c_int = 111; -pub const _SC_IPV6: ::c_int = 112; -pub const _SC_RAW_SOCKETS: ::c_int = 113; -pub const _SC_READER_WRITER_LOCKS: ::c_int = 114; -pub const _SC_REGEXP: ::c_int = 115; -pub const _SC_SHELL: ::c_int = 116; -pub const _SC_SPAWN: ::c_int = 117; -pub const _SC_SPIN_LOCKS: ::c_int = 118; -pub const _SC_SPORADIC_SERVER: ::c_int = 119; -pub const _SC_SS_REPL_MAX: ::c_int = 120; -pub const _SC_SYMLOOP_MAX: ::c_int = 121; -pub const _SC_THREAD_CPUTIME: ::c_int = 122; -pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 123; -pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 124; -pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 125; -pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 126; -pub const _SC_TIMEOUTS: ::c_int = 127; -pub const _SC_TRACE: ::c_int = 128; -pub const _SC_TRACE_EVENT_FILTER: ::c_int = 129; -pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 130; -pub const _SC_TRACE_INHERIT: ::c_int = 131; -pub const _SC_TRACE_LOG: ::c_int = 132; -pub const _SC_TRACE_NAME_MAX: ::c_int = 133; -pub const _SC_TRACE_SYS_MAX: ::c_int = 134; -pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 135; -pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 136; -pub const _SC_V7_ILP32_OFF32: ::c_int = 137; -pub const _SC_V7_ILP32_OFFBIG: ::c_int = 138; -pub const _SC_V7_LP64_OFF64: ::c_int = 139; -pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 140; -pub const _SC_XOPEN_STREAMS: ::c_int = 141; -pub const _SC_XOPEN_UUCP: ::c_int = 142; +pub const _SC_ARG_MAX: ::c_int = 0x0000; +pub const _SC_BC_BASE_MAX: ::c_int = 0x0001; +pub const _SC_BC_DIM_MAX: ::c_int = 0x0002; +pub const _SC_BC_SCALE_MAX: ::c_int = 0x0003; +pub const _SC_BC_STRING_MAX: ::c_int = 0x0004; +pub const _SC_CHILD_MAX: ::c_int = 0x0005; +pub const _SC_CLK_TCK: ::c_int = 0x0006; +pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 0x0007; +pub const _SC_EXPR_NEST_MAX: ::c_int = 0x0008; +pub const _SC_LINE_MAX: ::c_int = 0x0009; +pub const _SC_NGROUPS_MAX: ::c_int = 0x000a; +pub const _SC_OPEN_MAX: ::c_int = 0x000b; +pub const _SC_PASS_MAX: ::c_int = 0x000c; +pub const _SC_2_C_BIND: ::c_int = 0x000d; +pub const _SC_2_C_DEV: ::c_int = 0x000e; +pub const _SC_2_C_VERSION: ::c_int = 0x000f; +pub const _SC_2_CHAR_TERM: ::c_int = 0x0010; +pub const _SC_2_FORT_DEV: ::c_int = 0x0011; +pub const _SC_2_FORT_RUN: ::c_int = 0x0012; +pub const _SC_2_LOCALEDEF: ::c_int = 0x0013; +pub const _SC_2_SW_DEV: ::c_int = 0x0014; +pub const _SC_2_UPE: ::c_int = 0x0015; +pub const _SC_2_VERSION: ::c_int = 0x0016; +pub const _SC_JOB_CONTROL: ::c_int = 0x0017; +pub const _SC_SAVED_IDS: ::c_int = 0x0018; +pub const _SC_VERSION: ::c_int = 0x0019; +pub const _SC_RE_DUP_MAX: ::c_int = 0x001a; +pub const _SC_STREAM_MAX: ::c_int = 0x001b; +pub const _SC_TZNAME_MAX: ::c_int = 0x001c; +pub const _SC_XOPEN_CRYPT: ::c_int = 0x001d; +pub const _SC_XOPEN_ENH_I18N: ::c_int = 0x001e; +pub const _SC_XOPEN_SHM: ::c_int = 0x001f; +pub const _SC_XOPEN_VERSION: ::c_int = 0x0020; +pub const _SC_XOPEN_XCU_VERSION: ::c_int = 0x0021; +pub const _SC_XOPEN_REALTIME: ::c_int = 0x0022; +pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 0x0023; +pub const _SC_XOPEN_LEGACY: ::c_int = 0x0024; +pub const _SC_ATEXIT_MAX: ::c_int = 0x0025; +pub const _SC_IOV_MAX: ::c_int = 0x0026; +pub const _SC_UIO_MAXIOV: ::c_int = _SC_IOV_MAX; +pub const _SC_PAGESIZE: ::c_int = 0x0027; +pub const _SC_PAGE_SIZE: ::c_int = 0x0028; +pub const _SC_XOPEN_UNIX: ::c_int = 0x0029; +pub const _SC_XBS5_ILP32_OFF32: ::c_int = 0x002a; +pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 0x002b; +pub const _SC_XBS5_LP64_OFF64: ::c_int = 0x002c; +pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 0x002d; +pub const _SC_AIO_LISTIO_MAX: ::c_int = 0x002e; +pub const _SC_AIO_MAX: ::c_int = 0x002f; +pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 0x0030; +pub const _SC_DELAYTIMER_MAX: ::c_int = 0x0031; +pub const _SC_MQ_OPEN_MAX: ::c_int = 0x0032; +pub const _SC_MQ_PRIO_MAX: ::c_int = 0x0033; +pub const _SC_RTSIG_MAX: ::c_int = 0x0034; +pub const _SC_SEM_NSEMS_MAX: ::c_int = 0x0035; +pub const _SC_SEM_VALUE_MAX: ::c_int = 0x0036; +pub const _SC_SIGQUEUE_MAX: ::c_int = 0x0037; +pub const _SC_TIMER_MAX: ::c_int = 0x0038; +pub const _SC_ASYNCHRONOUS_IO: ::c_int = 0x0039; +pub const _SC_FSYNC: ::c_int = 0x003a; +pub const _SC_MAPPED_FILES: ::c_int = 0x003b; +pub const _SC_MEMLOCK: ::c_int = 0x003c; +pub const _SC_MEMLOCK_RANGE: ::c_int = 0x003d; +pub const _SC_MEMORY_PROTECTION: ::c_int = 0x003e; +pub const _SC_MESSAGE_PASSING: ::c_int = 0x003f; +pub const _SC_PRIORITIZED_IO: ::c_int = 0x0040; +pub const _SC_PRIORITY_SCHEDULING: ::c_int = 0x0041; +pub const _SC_REALTIME_SIGNALS: ::c_int = 0x0042; +pub const _SC_SEMAPHORES: ::c_int = 0x0043; +pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 0x0044; +pub const _SC_SYNCHRONIZED_IO: ::c_int = 0x0045; +pub const _SC_TIMERS: ::c_int = 0x0046; +pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 0x0047; +pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 0x0048; +pub const _SC_LOGIN_NAME_MAX: ::c_int = 0x0049; +pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 0x004a; +pub const _SC_THREAD_KEYS_MAX: ::c_int = 0x004b; +pub const _SC_THREAD_STACK_MIN: ::c_int = 0x004c; +pub const _SC_THREAD_THREADS_MAX: ::c_int = 0x004d; +pub const _SC_TTY_NAME_MAX: ::c_int = 0x004e; +pub const _SC_THREADS: ::c_int = 0x004f; +pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 0x0050; +pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 0x0051; +pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 0x0052; +pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 0x0053; +pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 0x0054; +pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 0x0055; +pub const _SC_NPROCESSORS_CONF: ::c_int = 0x0060; +pub const _SC_NPROCESSORS_ONLN: ::c_int = 0x0061; +pub const _SC_PHYS_PAGES: ::c_int = 0x0062; +pub const _SC_AVPHYS_PAGES: ::c_int = 0x0063; +pub const _SC_MONOTONIC_CLOCK: ::c_int = 0x0064; +pub const _SC_2_PBS: ::c_int = 0x0065; +pub const _SC_2_PBS_ACCOUNTING: ::c_int = 0x0066; +pub const _SC_2_PBS_CHECKPOINT: ::c_int = 0x0067; +pub const _SC_2_PBS_LOCATE: ::c_int = 0x0068; +pub const _SC_2_PBS_MESSAGE: ::c_int = 0x0069; +pub const _SC_2_PBS_TRACK: ::c_int = 0x006a; +pub const _SC_ADVISORY_INFO: ::c_int = 0x006b; +pub const _SC_BARRIERS: ::c_int = 0x006c; +pub const _SC_CLOCK_SELECTION: ::c_int = 0x006d; +pub const _SC_CPUTIME: ::c_int = 0x006e; +pub const _SC_HOST_NAME_MAX: ::c_int = 0x006f; +pub const _SC_IPV6: ::c_int = 0x0070; +pub const _SC_RAW_SOCKETS: ::c_int = 0x0071; +pub const _SC_READER_WRITER_LOCKS: ::c_int = 0x0072; +pub const _SC_REGEXP: ::c_int = 0x0073; +pub const _SC_SHELL: ::c_int = 0x0074; +pub const _SC_SPAWN: ::c_int = 0x0075; +pub const _SC_SPIN_LOCKS: ::c_int = 0x0076; +pub const _SC_SPORADIC_SERVER: ::c_int = 0x0077; +pub const _SC_SS_REPL_MAX: ::c_int = 0x0078; +pub const _SC_SYMLOOP_MAX: ::c_int = 0x0079; +pub const _SC_THREAD_CPUTIME: ::c_int = 0x007a; +pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 0x007b; +pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 0x007c; +pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 0x007d; +pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 0x007e; +pub const _SC_TIMEOUTS: ::c_int = 0x007f; +pub const _SC_TRACE: ::c_int = 0x0080; +pub const _SC_TRACE_EVENT_FILTER: ::c_int = 0x0081; +pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 0x0082; +pub const _SC_TRACE_INHERIT: ::c_int = 0x0083; +pub const _SC_TRACE_LOG: ::c_int = 0x0084; +pub const _SC_TRACE_NAME_MAX: ::c_int = 0x0085; +pub const _SC_TRACE_SYS_MAX: ::c_int = 0x0086; +pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 0x0087; +pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 0x0088; +pub const _SC_V7_ILP32_OFF32: ::c_int = 0x0089; +pub const _SC_V7_ILP32_OFFBIG: ::c_int = 0x008a; +pub const _SC_V7_LP64_OFF64: ::c_int = 0x008b; +pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 0x008c; +pub const _SC_XOPEN_STREAMS: ::c_int = 0x008d; +pub const _SC_XOPEN_UUCP: ::c_int = 0x008e; +pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 0x008f; +pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 0x0090; +pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 0x0091; +pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 0x0092; +pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 0x0093; +pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 0x0094; +pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 0x0095; +pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 0x0096; +pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 0x0097; +pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 0x0098; +pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 0x0099; +pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 0x009a; +pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 0x009b; +pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 0x009c; +pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 0x009d; pub const F_LOCK: ::c_int = 1; pub const F_TEST: ::c_int = 3; @@ -1315,6 +1322,7 @@ pub const IFF_LOWER_UP: ::c_int = 0x10000; pub const IFF_DORMANT: ::c_int = 0x20000; pub const IFF_ECHO: ::c_int = 0x40000; +pub const PTHREAD_BARRIER_SERIAL_THREAD: ::c_int = -1; pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0; pub const PTHREAD_MUTEX_RECURSIVE: ::c_int = 1; pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; @@ -1728,6 +1736,7 @@ pub const ST_NODIRATIME: ::c_ulong = 2048; pub const ST_RELATIME: ::c_ulong = 4096; pub const RTLD_NOLOAD: ::c_int = 0x4; +pub const RTLD_NODELETE: ::c_int = 0x1000; pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t; @@ -2262,6 +2271,8 @@ pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const MFD_CLOEXEC: ::c_uint = 0x0001; pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002; pub const MFD_HUGETLB: ::c_uint = 0x0004; +pub const MFD_NOEXEC_SEAL: ::c_uint = 0x0008; +pub const MFD_EXEC: ::c_uint = 0x0010; pub const MFD_HUGE_64KB: ::c_uint = 0x40000000; pub const MFD_HUGE_512KB: ::c_uint = 0x4c000000; pub const MFD_HUGE_1MB: ::c_uint = 0x50000000; @@ -2323,9 +2334,11 @@ pub const NF_INET_FORWARD: ::c_int = 2; pub const NF_INET_LOCAL_OUT: ::c_int = 3; pub const NF_INET_POST_ROUTING: ::c_int = 4; pub const NF_INET_NUMHOOKS: ::c_int = 5; +pub const NF_INET_INGRESS: ::c_int = NF_INET_NUMHOOKS; pub const NF_NETDEV_INGRESS: ::c_int = 0; -pub const NF_NETDEV_NUMHOOKS: ::c_int = 1; +pub const NF_NETDEV_EGRESS: ::c_int = 1; +pub const NF_NETDEV_NUMHOOKS: ::c_int = 2; pub const NFPROTO_UNSPEC: ::c_int = 0; pub const NFPROTO_INET: ::c_int = 1; @@ -2337,6 +2350,31 @@ pub const NFPROTO_IPV6: ::c_int = 10; pub const NFPROTO_DECNET: ::c_int = 12; pub const NFPROTO_NUMPROTO: ::c_int = 13; +// linux/netfilter_arp.h +pub const NF_ARP: ::c_int = 0; +pub const NF_ARP_IN: ::c_int = 0; +pub const NF_ARP_OUT: ::c_int = 1; +pub const NF_ARP_FORWARD: ::c_int = 2; +pub const NF_ARP_NUMHOOKS: ::c_int = 3; + +// linux/netfilter_bridge.h +pub const NF_BR_PRE_ROUTING: ::c_int = 0; +pub const NF_BR_LOCAL_IN: ::c_int = 1; +pub const NF_BR_FORWARD: ::c_int = 2; +pub const NF_BR_LOCAL_OUT: ::c_int = 3; +pub const NF_BR_POST_ROUTING: ::c_int = 4; +pub const NF_BR_BROUTING: ::c_int = 5; +pub const NF_BR_NUMHOOKS: ::c_int = 6; + +pub const NF_BR_PRI_FIRST: ::c_int = ::INT_MIN; +pub const NF_BR_PRI_NAT_DST_BRIDGED: ::c_int = -300; +pub const NF_BR_PRI_FILTER_BRIDGED: ::c_int = -200; +pub const NF_BR_PRI_BRNF: ::c_int = 0; +pub const NF_BR_PRI_NAT_DST_OTHER: ::c_int = 100; +pub const NF_BR_PRI_FILTER_OTHER: ::c_int = 200; +pub const NF_BR_PRI_NAT_SRC: ::c_int = 300; +pub const NF_BR_PRI_LAST: ::c_int = ::INT_MAX; + // linux/netfilter_ipv4.h pub const NF_IP_PRE_ROUTING: ::c_int = 0; pub const NF_IP_LOCAL_IN: ::c_int = 1; @@ -2346,6 +2384,7 @@ pub const NF_IP_POST_ROUTING: ::c_int = 4; pub const NF_IP_NUMHOOKS: ::c_int = 5; pub const NF_IP_PRI_FIRST: ::c_int = ::INT_MIN; +pub const NF_IP_PRI_RAW_BEFORE_DEFRAG: ::c_int = -450; pub const NF_IP_PRI_CONNTRACK_DEFRAG: ::c_int = -400; pub const NF_IP_PRI_RAW: ::c_int = -300; pub const NF_IP_PRI_SELINUX_FIRST: ::c_int = -225; @@ -2369,6 +2408,7 @@ pub const NF_IP6_POST_ROUTING: ::c_int = 4; pub const NF_IP6_NUMHOOKS: ::c_int = 5; pub const NF_IP6_PRI_FIRST: ::c_int = ::INT_MIN; +pub const NF_IP6_PRI_RAW_BEFORE_DEFRAG: ::c_int = -450; pub const NF_IP6_PRI_CONNTRACK_DEFRAG: ::c_int = -400; pub const NF_IP6_PRI_RAW: ::c_int = -300; pub const NF_IP6_PRI_SELINUX_FIRST: ::c_int = -225; @@ -2536,6 +2576,14 @@ pub const NFT_CT_PROTO_DST: ::c_int = 12; pub const NFT_CT_LABELS: ::c_int = 13; pub const NFT_CT_PKTS: ::c_int = 14; pub const NFT_CT_BYTES: ::c_int = 15; +pub const NFT_CT_AVGPKT: ::c_int = 16; +pub const NFT_CT_ZONE: ::c_int = 17; +pub const NFT_CT_EVENTMASK: ::c_int = 18; +pub const NFT_CT_SRC_IP: ::c_int = 19; +pub const NFT_CT_DST_IP: ::c_int = 20; +pub const NFT_CT_SRC_IP6: ::c_int = 21; +pub const NFT_CT_DST_IP6: ::c_int = 22; +pub const NFT_CT_ID: ::c_int = 23; pub const NFT_LIMIT_PKTS: ::c_int = 0; pub const NFT_LIMIT_PKT_BYTES: ::c_int = 1; @@ -2987,6 +3035,7 @@ pub const FUTEX_WAIT_BITSET: ::c_int = 9; pub const FUTEX_WAKE_BITSET: ::c_int = 10; pub const FUTEX_WAIT_REQUEUE_PI: ::c_int = 11; pub const FUTEX_CMP_REQUEUE_PI: ::c_int = 12; +pub const FUTEX_LOCK_PI2: ::c_int = 13; pub const FUTEX_PRIVATE_FLAG: ::c_int = 128; pub const FUTEX_CLOCK_REALTIME: ::c_int = 256; @@ -3486,6 +3535,46 @@ pub const PF_MEMALLOC_PIN: ::c_int = 0x10000000; pub const PF_SUSPEND_TASK: ::c_int = 0x80000000; +pub const KLOG_CLOSE: ::c_int = 0; +pub const KLOG_OPEN: ::c_int = 1; +pub const KLOG_READ: ::c_int = 2; +pub const KLOG_READ_ALL: ::c_int = 3; +pub const KLOG_READ_CLEAR: ::c_int = 4; +pub const KLOG_CLEAR: ::c_int = 5; +pub const KLOG_CONSOLE_OFF: ::c_int = 6; +pub const KLOG_CONSOLE_ON: ::c_int = 7; +pub const KLOG_CONSOLE_LEVEL: ::c_int = 8; +pub const KLOG_SIZE_UNREAD: ::c_int = 9; +pub const KLOG_SIZE_BUFFER: ::c_int = 10; + +// From NDK's linux/auxvec.h +pub const AT_NULL: ::c_ulong = 0; +pub const AT_IGNORE: ::c_ulong = 1; +pub const AT_EXECFD: ::c_ulong = 2; +pub const AT_PHDR: ::c_ulong = 3; +pub const AT_PHENT: ::c_ulong = 4; +pub const AT_PHNUM: ::c_ulong = 5; +pub const AT_PAGESZ: ::c_ulong = 6; +pub const AT_BASE: ::c_ulong = 7; +pub const AT_FLAGS: ::c_ulong = 8; +pub const AT_ENTRY: ::c_ulong = 9; +pub const AT_NOTELF: ::c_ulong = 10; +pub const AT_UID: ::c_ulong = 11; +pub const AT_EUID: ::c_ulong = 12; +pub const AT_GID: ::c_ulong = 13; +pub const AT_EGID: ::c_ulong = 14; +pub const AT_PLATFORM: ::c_ulong = 15; +pub const AT_HWCAP: ::c_ulong = 16; +pub const AT_CLKTCK: ::c_ulong = 17; +pub const AT_SECURE: ::c_ulong = 23; +pub const AT_BASE_PLATFORM: ::c_ulong = 24; +pub const AT_RANDOM: ::c_ulong = 25; +pub const AT_HWCAP2: ::c_ulong = 26; +pub const AT_RSEQ_FEATURE_SIZE: ::c_ulong = 27; +pub const AT_RSEQ_ALIGN: ::c_ulong = 28; +pub const AT_EXECFN: ::c_ulong = 31; +pub const AT_MINSIGSTKSZ: ::c_ulong = 51; + // 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. @@ -4058,6 +4147,24 @@ extern "C" { ) -> ::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; + + pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int; + pub fn renameat2( + olddirfd: ::c_int, + oldpath: *const ::c_char, + newdirfd: ::c_int, + newpath: *const ::c_char, + flags: ::c_uint, + ) -> ::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 klogctl(syslog_type: ::c_int, bufp: *mut ::c_char, len: ::c_int) -> ::c_int; } cfg_if! { diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs index 07f33fc9839d3..8014060890963 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -775,9 +775,9 @@ pub const POSIX_MADV_RANDOM: ::c_int = 1; pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; pub const POSIX_MADV_WILLNEED: ::c_int = 3; -pub const S_IEXEC: mode_t = 64; -pub const S_IWRITE: mode_t = 128; -pub const S_IREAD: mode_t = 256; +pub const S_IEXEC: mode_t = 0o0100; +pub const S_IWRITE: mode_t = 0o0200; +pub const S_IREAD: mode_t = 0o0400; pub const F_LOCK: ::c_int = 1; pub const F_TEST: ::c_int = 3; diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs index b8e459631e49f..2f437e16db26a 100644 --- a/src/unix/linux_like/linux/arch/generic/mod.rs +++ b/src/unix/linux_like/linux/arch/generic/mod.rs @@ -218,7 +218,7 @@ cfg_if! { // where S stands for size (int, long, struct...) // where T stands for type ('f','v','X'...) // where N stands for NR (NumbeR) - if #[cfg(any(target_arch = "x86", target_arch = "arm"))] { + if #[cfg(any(target_arch = "x86", target_arch = "arm", target_arch = "csky"))] { pub const FS_IOC_GETFLAGS: ::Ioctl = 0x80046601; pub const FS_IOC_SETFLAGS: ::Ioctl = 0x40046602; pub const FS_IOC_GETVERSION: ::Ioctl = 0x80047601; @@ -227,7 +227,11 @@ cfg_if! { pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x40046602; pub const FS_IOC32_GETVERSION: ::Ioctl = 0x80047601; pub const FS_IOC32_SETVERSION: ::Ioctl = 0x40047602; - } else if #[cfg(any(target_arch = "x86_64", target_arch = "riscv64", target_arch = "aarch64", target_arch = "s390x"))] { + } else if #[cfg(any(target_arch = "x86_64", + target_arch = "riscv64", + target_arch = "aarch64", + target_arch = "s390x", + target_arch = "loongarch64"))] { pub const FS_IOC_GETFLAGS: ::Ioctl = 0x80086601; pub const FS_IOC_SETFLAGS: ::Ioctl = 0x40086602; pub const FS_IOC_GETVERSION: ::Ioctl = 0x80087601; diff --git a/src/unix/linux_like/linux/arch/mips/mod.rs b/src/unix/linux_like/linux/arch/mips/mod.rs index 7699677026f2b..6a96aa9c3b159 100644 --- a/src/unix/linux_like/linux/arch/mips/mod.rs +++ b/src/unix/linux_like/linux/arch/mips/mod.rs @@ -200,7 +200,7 @@ cfg_if! { // where S stands for size (int, long, struct...) // where T stands for type ('f','v','X'...) // where N stands for NR (NumbeR) - if #[cfg(target_arch = "mips")] { + if #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] { pub const FS_IOC_GETFLAGS: ::Ioctl = 0x40046601; pub const FS_IOC_SETFLAGS: ::Ioctl = 0x80046602; pub const FS_IOC_GETVERSION: ::Ioctl = 0x40047601; @@ -209,7 +209,7 @@ cfg_if! { pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x80046602; pub const FS_IOC32_GETVERSION: ::Ioctl = 0x40047601; pub const FS_IOC32_SETVERSION: ::Ioctl = 0x80047602; - } else if #[cfg(target_arch = "mips64")] { + } else if #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))] { pub const FS_IOC_GETFLAGS: ::Ioctl = 0x40086601; pub const FS_IOC_SETFLAGS: ::Ioctl = 0x80086602; pub const FS_IOC_GETVERSION: ::Ioctl = 0x40087601; 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 454767a9f53ad..947384f76e557 100644 --- a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs @@ -22,7 +22,8 @@ s! { pub f_namelen: ::__fsword_t, pub f_frsize: ::__fsword_t, - f_spare: [::__fsword_t; 5], + pub f_flags: ::__fsword_t, + f_spare: [::__fsword_t; 4], } pub struct flock { @@ -855,6 +856,7 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; +pub const SYS_mseal: ::c_long = 462; mod align; pub use self::align::*; diff --git a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs index 8f5ed0f348459..6f9560334c164 100644 --- a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs @@ -37,7 +37,8 @@ s! { pub f_fsid: ::fsid_t, pub f_namelen: ::c_long, - f_spare: [::c_long; 6], + pub f_flags: ::c_long, + f_spare: [::c_long; 5], } pub struct statfs64 { diff --git a/src/unix/linux_like/linux/gnu/b32/powerpc.rs b/src/unix/linux_like/linux/gnu/b32/powerpc.rs index dd5732e0dcc14..da50989c7fccb 100644 --- a/src/unix/linux_like/linux/gnu/b32/powerpc.rs +++ b/src/unix/linux_like/linux/gnu/b32/powerpc.rs @@ -22,7 +22,8 @@ s! { pub f_namelen: ::__fsword_t, pub f_frsize: ::__fsword_t, - f_spare: [::__fsword_t; 5], + pub f_flags: ::__fsword_t, + f_spare: [::__fsword_t; 4], } pub struct flock { @@ -823,3 +824,4 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; +pub const SYS_mseal: ::c_long = 462; 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 4ced1616cc4a7..9c54fb5a2e5f7 100644 --- a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs @@ -23,7 +23,8 @@ s! { pub f_namelen: ::__fsword_t, pub f_frsize: ::__fsword_t, - f_spare: [::__fsword_t; 5], + pub f_flags: ::__fsword_t, + f_spare: [::__fsword_t; 4], } pub struct flock { @@ -1044,6 +1045,8 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; +pub const SYS_fchmodat2: ::c_long = 452; +pub const SYS_mseal: ::c_long = 462; // offsets in user_regs_structs, from sys/reg.h pub const EBX: ::c_int = 0; 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 2d73c68389728..96b5b532f74d2 100644 --- a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs @@ -892,6 +892,7 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; +pub const SYS_mseal: ::c_long = 462; pub const PROT_BTI: ::c_int = 0x10; pub const PROT_MTE: ::c_int = 0x20; diff --git a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs index 31620c79efa4c..eccbeff79f6c6 100644 --- a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs @@ -256,20 +256,20 @@ pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = pthread_mut ], }; -pub const HWCAP_CPUCFG: ::c_ulong = 1 << 0; -pub const HWCAP_LAM: ::c_ulong = 1 << 1; -pub const HWCAP_UAL: ::c_ulong = 1 << 2; -pub const HWCAP_FPU: ::c_ulong = 1 << 3; -pub const HWCAP_LSX: ::c_ulong = 1 << 4; -pub const HWCAP_LASX: ::c_ulong = 1 << 5; -pub const HWCAP_CRC32: ::c_ulong = 1 << 6; -pub const HWCAP_COMPLEX: ::c_ulong = 1 << 7; -pub const HWCAP_CRYPTO: ::c_ulong = 1 << 8; -pub const HWCAP_LVZ: ::c_ulong = 1 << 9; -pub const HWCAP_LBT_X86: ::c_ulong = 1 << 10; -pub const HWCAP_LBT_ARM: ::c_ulong = 1 << 11; -pub const HWCAP_LBT_MIPS: ::c_ulong = 1 << 12; -pub const HWCAP_PTW: ::c_ulong = 1 << 13; +pub const HWCAP_LOONGARCH_CPUCFG: ::c_ulong = 1 << 0; +pub const HWCAP_LOONGARCH_LAM: ::c_ulong = 1 << 1; +pub const HWCAP_LOONGARCH_UAL: ::c_ulong = 1 << 2; +pub const HWCAP_LOONGARCH_FPU: ::c_ulong = 1 << 3; +pub const HWCAP_LOONGARCH_LSX: ::c_ulong = 1 << 4; +pub const HWCAP_LOONGARCH_LASX: ::c_ulong = 1 << 5; +pub const HWCAP_LOONGARCH_CRC32: ::c_ulong = 1 << 6; +pub const HWCAP_LOONGARCH_COMPLEX: ::c_ulong = 1 << 7; +pub const HWCAP_LOONGARCH_CRYPTO: ::c_ulong = 1 << 8; +pub const HWCAP_LOONGARCH_LVZ: ::c_ulong = 1 << 9; +pub const HWCAP_LOONGARCH_LBT_X86: ::c_ulong = 1 << 10; +pub const HWCAP_LOONGARCH_LBT_ARM: ::c_ulong = 1 << 11; +pub const HWCAP_LOONGARCH_LBT_MIPS: ::c_ulong = 1 << 12; +pub const HWCAP_LOONGARCH_PTW: ::c_ulong = 1 << 13; pub const SYS_io_setup: ::c_long = 0; pub const SYS_io_destroy: ::c_long = 1; diff --git a/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs b/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs index 48d152a5721ec..5b33f2375d39c 100644 --- a/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs +++ b/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs @@ -42,3 +42,20 @@ s_no_extra_traits! { pub __glibc_reserved: [::c_uint; 3], } } + +s! { + #[repr(align(8))] + pub struct clone_args { + pub flags: ::c_ulonglong, + pub pidfd: ::c_ulonglong, + pub child_tid: ::c_ulonglong, + pub parent_tid: ::c_ulonglong, + pub exit_signal: ::c_ulonglong, + pub stack: ::c_ulonglong, + pub stack_size: ::c_ulonglong, + pub tls: ::c_ulonglong, + pub set_tid: ::c_ulonglong, + pub set_tid_size: ::c_ulonglong, + pub cgroup: ::c_ulonglong, + } +} 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 e7f22dd7f2698..750ee8f8436e8 100644 --- a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs @@ -540,6 +540,14 @@ pub const REG_A0: usize = 10; pub const REG_S2: usize = 18; pub const REG_NARGS: usize = 8; +pub const COMPAT_HWCAP_ISA_I: ::c_ulong = 1 << (b'I' - b'A'); +pub const COMPAT_HWCAP_ISA_M: ::c_ulong = 1 << (b'M' - b'A'); +pub const COMPAT_HWCAP_ISA_A: ::c_ulong = 1 << (b'A' - b'A'); +pub const COMPAT_HWCAP_ISA_F: ::c_ulong = 1 << (b'F' - b'A'); +pub const COMPAT_HWCAP_ISA_D: ::c_ulong = 1 << (b'D' - b'A'); +pub const COMPAT_HWCAP_ISA_C: ::c_ulong = 1 << (b'C' - b'A'); +pub const COMPAT_HWCAP_ISA_V: ::c_ulong = 1 << (b'V' - b'A'); + pub const SYS_read: ::c_long = 63; pub const SYS_write: ::c_long = 64; pub const SYS_close: ::c_long = 57; diff --git a/src/unix/linux_like/linux/gnu/b64/s390x.rs b/src/unix/linux_like/linux/gnu/b64/s390x.rs index deeb23f9ed8e9..6bf730106e4c2 100644 --- a/src/unix/linux_like/linux/gnu/b64/s390x.rs +++ b/src/unix/linux_like/linux/gnu/b64/s390x.rs @@ -941,6 +941,7 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; +pub const SYS_mseal: ::c_long = 462; extern "C" { diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs index 1813f3ef41c68..0c83fa13b4e5e 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs @@ -430,6 +430,8 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; +pub const SYS_fchmodat2: ::c_long = 452; +pub const SYS_mseal: ::c_long = 462; extern "C" { pub fn sysctl( diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs index 17da00db5c8c1..55b85e9626807 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs @@ -361,6 +361,7 @@ pub const SYS_memfd_secret: ::c_long = __X32_SYSCALL_BIT + 447; pub const SYS_process_mrelease: ::c_long = __X32_SYSCALL_BIT + 448; pub const SYS_futex_waitv: ::c_long = __X32_SYSCALL_BIT + 449; pub const SYS_set_mempolicy_home_node: ::c_long = __X32_SYSCALL_BIT + 450; +pub const SYS_fchmodat2: ::c_long = __X32_SYSCALL_BIT + 452; pub const SYS_rt_sigaction: ::c_long = __X32_SYSCALL_BIT + 512; pub const SYS_rt_sigreturn: ::c_long = __X32_SYSCALL_BIT + 513; pub const SYS_ioctl: ::c_long = __X32_SYSCALL_BIT + 514; diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index 461fbda84e133..25eb4327cd5be 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -826,6 +826,9 @@ pub const TMP_MAX: ::c_uint = 238328; pub const FOPEN_MAX: ::c_uint = 16; pub const FILENAME_MAX: ::c_uint = 4096; pub const POSIX_MADV_DONTNEED: ::c_int = 4; +pub const _CS_GNU_LIBC_VERSION: ::c_int = 2; +pub const _CS_GNU_LIBPTHREAD_VERSION: ::c_int = 3; +pub const _CS_PATH: ::c_int = 0; pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41; pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45; pub const _SC_PII: ::c_int = 53; @@ -1065,8 +1068,8 @@ 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; +pub const CLONE_CLEAR_SIGHAND: ::c_ulonglong = 0x100000000; +pub const CLONE_INTO_CGROUP: ::c_ulonglong = 0x200000000; // linux/keyctl.h pub const KEYCTL_DH_COMPUTE: u32 = 23; @@ -1393,7 +1396,6 @@ extern "C" { pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void; pub fn ctermid(s: *mut ::c_char) -> *mut ::c_char; - pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int; pub fn glob64( pattern: *const ::c_char, @@ -1426,6 +1428,7 @@ extern "C" { pub fn pthread_sigqueue(thread: ::pthread_t, sig: ::c_int, value: ::sigval) -> ::c_int; pub fn mallinfo() -> ::mallinfo; pub fn mallinfo2() -> ::mallinfo2; + pub fn malloc_stats(); 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 getpwent_r( @@ -1469,21 +1472,7 @@ extern "C" { 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 strftime_l( - s: *mut ::c_char, - max: ::size_t, - format: *const ::c_char, - tm: *const ::tm, - locale: ::locale_t, - ) -> ::size_t; - pub fn strptime(s: *const ::c_char, format: *const ::c_char, tm: *mut ::tm) -> *mut ::c_char; - + pub fn confstr(name: ::c_int, buf: *mut ::c_char, len: ::size_t) -> ::size_t; pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; /// POSIX version of `basename(3)`, defined in `libgen.h`. #[link_name = "__xpg_basename"] @@ -1543,6 +1532,8 @@ extern "C" { // Added in `glibc` 2.34 pub fn close_range(first: ::c_uint, last: ::c_uint, flags: ::c_int) -> ::c_int; + + pub fn mq_notify(mqdes: ::mqd_t, sevp: *const ::sigevent) -> ::c_int; } cfg_if! { diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 82da38e59e2a2..a47d0618ab230 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -27,6 +27,8 @@ pub type Elf32_Half = u16; pub type Elf32_Word = u32; pub type Elf32_Off = u32; pub type Elf32_Addr = u32; +pub type Elf32_Xword = u64; +pub type Elf32_Sword = i32; pub type Elf64_Half = u16; pub type Elf64_Word = u32; @@ -34,10 +36,23 @@ pub type Elf64_Off = u64; pub type Elf64_Addr = u64; pub type Elf64_Xword = u64; pub type Elf64_Sxword = i64; +pub type Elf64_Sword = i32; pub type Elf32_Section = u16; pub type Elf64_Section = u16; +pub type Elf32_Relr = Elf32_Word; +pub type Elf64_Relr = Elf32_Xword; +pub type Elf32_Rel = __c_anonymous_elf32_rel; +pub type Elf64_Rel = __c_anonymous_elf64_rel; + +cfg_if! { + if #[cfg(not(target_arch = "sparc64"))] { + pub type Elf32_Rela = __c_anonymous_elf32_rela; + pub type Elf64_Rela = __c_anonymous_elf64_rela; + } +} + // linux/can.h pub type canid_t = u32; @@ -454,13 +469,14 @@ s! { // to false. So I'm just removing these, and if uClibc changes // the #if block in the future to include the following fields, these // will probably need including here. tsidea, skrap - #[cfg(not(target_env = "uclibc"))] + // QNX (NTO) platform does not define these fields + #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] pub dlpi_adds: ::c_ulonglong, - #[cfg(not(target_env = "uclibc"))] + #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] pub dlpi_subs: ::c_ulonglong, - #[cfg(not(target_env = "uclibc"))] + #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] pub dlpi_tls_modid: ::size_t, - #[cfg(not(target_env = "uclibc"))] + #[cfg(not(any(target_env = "uclibc", target_os = "nto")))] pub dlpi_tls_data: *mut ::c_void, } @@ -564,6 +580,16 @@ s! { pub sh_entsize: Elf64_Xword, } + pub struct __c_anonymous_elf32_rel { + pub r_offset: Elf32_Addr, + pub r_info: Elf32_Word, + } + + pub struct __c_anonymous_elf64_rel { + pub r_offset: Elf64_Addr, + pub r_info: Elf64_Xword, + } + pub struct ucred { pub pid: ::pid_t, pub uid: ::uid_t, @@ -870,8 +896,164 @@ s! { pub salt: [::c_uchar; TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE], pub rec_seq: [::c_uchar; TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE], } + + // linux/wireless.h + + pub struct iw_param { + pub value: __s32, + pub fixed: __u8, + pub disabled: __u8, + pub flags: __u16, + } + pub struct iw_point { + pub pointer: *mut ::c_void, + pub length: __u16, + pub flags: __u16, + } + pub struct iw_freq { + pub m: __s32, + pub e: __s16, + pub i: __u8, + pub flags: __u8, + } + pub struct iw_quality { + pub qual: __u8, + pub level: __u8, + pub noise: __u8, + pub updated: __u8, + } + pub struct iw_discarded { + pub nwid: __u32, + pub code: __u32, + pub fragment: __u32, + pub retries: __u32, + pubmisc: __u32, + } + pub struct iw_missed { + pub beacon: __u32, + } + pub struct iw_scan_req { + pub scan_type: __u8, + pub essid_len: __u8, + pub num_channels: __u8, + pub flags: __u8, + pub bssid: ::sockaddr, + pub essid: [__u8; IW_ESSID_MAX_SIZE], + pub min_channel_time: __u32, + pub max_channel_time: __u32, + pub channel_list: [iw_freq; IW_MAX_FREQUENCIES], + } + pub struct iw_encode_ext { + pub ext_flags: __u32, + pub tx_seq: [__u8; IW_ENCODE_SEQ_MAX_SIZE], + pub rx_seq: [__u8; IW_ENCODE_SEQ_MAX_SIZE], + pub addr: ::sockaddr, + pub alg: __u16, + pub key_len: __u16, + pub key: [__u8;0], + } + pub struct iw_pmksa { + pub cmd: __u32, + pub bssid: ::sockaddr, + pub pmkid: [__u8; IW_PMKID_LEN], + } + pub struct iw_pmkid_cand { + pub flags: __u32, + pub index: __u32, + pub bssid: ::sockaddr, + } + pub struct iw_statistics { + pub status: __u16, + pub qual: iw_quality, + pub discard: iw_discarded, + pub miss: iw_missed, + } + pub struct iw_range { + pub throughput: __u32, + pub min_nwid: __u32, + pub max_nwid: __u32, + pub old_num_channels: __u16, + pub old_num_frequency: __u8, + pub scan_capa: __u8, + pub event_capa: [__u32; 6], + pub sensitivity: __s32, + pub max_qual: iw_quality, + pub avg_qual: iw_quality, + pub num_bitrates: __u8, + pub bitrate: [__s32; IW_MAX_BITRATES], + pub min_rts: __s32, + pub max_rts: __s32, + pub min_frag: __s32, + pub max_frag: __s32, + pub min_pmp: __s32, + pub max_pmp: __s32, + pub min_pmt: __s32, + pub max_pmt: __s32, + pub pmp_flags: __u16, + pub pmt_flags: __u16, + pub pm_capa: __u16, + pub encoding_size: [__u16; IW_MAX_ENCODING_SIZES], + pub num_encoding_sizes: __u8, + pub max_encoding_tokens: __u8, + pub encoding_login_index: __u8, + pub txpower_capa: __u16, + pub num_txpower: __u8, + pub txpower: [__s32;IW_MAX_TXPOWER], + pub we_version_compiled: __u8, + pub we_version_source: __u8, + pub retry_capa: __u16, + pub retry_flags: __u16, + pub r_time_flags: __u16, + pub min_retry: __s32, + pub max_retry: __s32, + pub min_r_time: __s32, + pub max_r_time: __s32, + pub num_channels: __u16, + pub num_frequency: __u8, + pub freq: [iw_freq; IW_MAX_FREQUENCIES], + pub enc_capa: __u32, + } + pub struct iw_priv_args { + pub cmd: __u32, + pub set_args: __u16, + pub get_args: __u16, + pub name: [c_char; ::IFNAMSIZ], + } } +cfg_if! { + if #[cfg(not(target_arch = "sparc64"))] { + s!{ + pub struct iw_thrspy { + pub addr: ::sockaddr, + pub qual: iw_quality, + pub low: iw_quality, + pub high: iw_quality, + } + pub struct iw_mlme { + pub cmd: __u16, + pub reason_code: __u16, + pub addr: ::sockaddr, + } + pub struct iw_michaelmicfailure { + pub flags: __u32, + pub src_addr: ::sockaddr, + pub tsc: [__u8; IW_ENCODE_SEQ_MAX_SIZE], + } + pub struct __c_anonymous_elf32_rela { + pub r_offset: Elf32_Addr, + pub r_info: Elf32_Word, + pub r_addend: Elf32_Sword, + } + + pub struct __c_anonymous_elf64_rela { + pub r_offset: Elf64_Addr, + pub r_info: Elf64_Xword, + pub r_addend: Elf64_Sxword, + } + } + } +} s_no_extra_traits! { pub struct sockaddr_nl { pub nl_family: ::sa_family_t, @@ -912,13 +1094,7 @@ s_no_extra_traits! { pub absflat: [::__s32; ABS_CNT], } - /// WARNING: The `PartialEq`, `Eq` and `Hash` implementations of this - /// type are unsound and will be removed in the future. - #[deprecated( - note = "this struct has unsafe trait implementations that will be \ - removed in the future", - since = "0.2.80" - )] + #[allow(missing_debug_implementations)] pub struct af_alg_iv { pub ivlen: u32, pub iv: [::c_uchar; 0], @@ -1007,15 +1183,18 @@ s_no_extra_traits! { pub sched_period: ::__u64, } + #[allow(missing_debug_implementations)] pub union tpacket_req_u { pub req: ::tpacket_req, pub req3: ::tpacket_req3, } + #[allow(missing_debug_implementations)] pub union tpacket_bd_header_u { pub bh1: ::tpacket_hdr_v1, } + #[allow(missing_debug_implementations)] pub struct tpacket_block_desc { pub version: ::__u32, pub offset_to_priv: ::__u32, @@ -1048,6 +1227,45 @@ s_no_extra_traits! { } } +s_no_extra_traits! { + // linux/wireless.h + pub union iwreq_data { + pub name: [c_char; ::IFNAMSIZ], + pub essid: iw_point, + pub nwid: iw_param, + pub freq: iw_freq, + pub sens: iw_param, + pub bitrate: iw_param, + pub txpower: iw_param, + pub rts: iw_param, + pub frag: iw_param, + pub mode: __u32, + pub retry: iw_param, + pub encoding: iw_point, + pub power: iw_param, + pub qual: iw_quality, + pub ap_addr: ::sockaddr, + pub addr: ::sockaddr, + pub param: iw_param, + pub data: iw_point, + } + + pub struct iw_event { + pub len: __u16, + pub cmd: __u16, + pub u: iwreq_data, + } + + pub union __c_anonymous_iwreq { + pub ifrn_name: [c_char; ::IFNAMSIZ], + } + + pub struct iwreq { + pub ifr_ifrn: __c_anonymous_iwreq, + pub u: iwreq_data, + } +} + cfg_if! { if #[cfg(feature = "extra_traits")] { impl PartialEq for sockaddr_nl { @@ -1347,44 +1565,6 @@ cfg_if! { } } - #[allow(deprecated)] - impl af_alg_iv { - fn as_slice(&self) -> &[u8] { - unsafe { - ::core::slice::from_raw_parts( - self.iv.as_ptr(), - self.ivlen as usize - ) - } - } - } - - #[allow(deprecated)] - impl PartialEq for af_alg_iv { - fn eq(&self, other: &af_alg_iv) -> bool { - *self.as_slice() == *other.as_slice() - } - } - - #[allow(deprecated)] - impl Eq for af_alg_iv {} - - #[allow(deprecated)] - impl ::fmt::Debug for af_alg_iv { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("af_alg_iv") - .field("ivlen", &self.ivlen) - .finish() - } - } - - #[allow(deprecated)] - impl ::hash::Hash for af_alg_iv { - fn hash(&self, state: &mut H) { - self.as_slice().hash(state); - } - } - impl PartialEq for mq_attr { fn eq(&self, other: &mq_attr) -> bool { self.mq_flags == other.mq_flags && @@ -1440,32 +1620,6 @@ cfg_if! { } } - impl ::fmt::Debug for tpacket_req_u { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("tpacket_req_u") - .field("req3", unsafe { &self.req3 }) - .finish() - } - } - - impl ::fmt::Debug for tpacket_bd_header_u { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("tpacket_bd_header_u") - .field("bh1", unsafe { &self.bh1 }) - .finish() - } - } - - impl ::fmt::Debug for tpacket_block_desc { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("tpacket_bd_header_u") - .field("version", &self.version) - .field("offset_to_priv", &self.offset_to_priv) - .field("hdr", &self.hdr) - .finish() - } - } - impl ::fmt::Debug for __c_anonymous_ifc_ifcu { fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { f.debug_struct("ifr_ifru") @@ -1546,6 +1700,57 @@ cfg_if! { self.sched_period.hash(state); } } + impl ::fmt::Debug for iwreq_data { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("iwreq_data") + .field("name", unsafe { &self.name }) + .field("essid", unsafe { &self.essid }) + .field("nwid", unsafe { &self.nwid }) + .field("freq", unsafe { &self.freq }) + .field("sens", unsafe { &self.sens }) + .field("bitrate", unsafe { &self.bitrate }) + .field("txpower", unsafe { &self.txpower }) + .field("rts", unsafe { &self.rts }) + .field("frag", unsafe { &self.frag }) + .field("mode", unsafe { &self.mode }) + .field("retry", unsafe { &self.retry }) + .field("encoding", unsafe { &self.encoding }) + .field("power", unsafe { &self.power }) + .field("qual", unsafe { &self.qual }) + .field("ap_addr", unsafe { &self.ap_addr }) + .field("addr", unsafe { &self.addr }) + .field("param", unsafe { &self.param }) + .field("data", unsafe { &self.data }) + .finish() + } + } + + impl ::fmt::Debug for iw_event { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("iw_event") + .field("len", &self.len ) + .field("cmd", &self.cmd ) + .field("u", &self.u ) + .finish() + } + } + + impl ::fmt::Debug for __c_anonymous_iwreq { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("__c_anonymous_iwreq") + .field("ifrn_name", unsafe { &self.ifrn_name }) + .finish() + } + } + + impl ::fmt::Debug for iwreq { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("iwreq") + .field("ifr_ifrn", &self.ifr_ifrn ) + .field("u", &self.u ) + .finish() + } + } } } @@ -1993,6 +2198,7 @@ pub const AT_EXECFN: ::c_ulong = 31; // defined in arch//include/uapi/asm/auxvec.h but has the same value // wherever it is defined. pub const AT_SYSINFO_EHDR: ::c_ulong = 33; +pub const AT_MINSIGSTKSZ: ::c_ulong = 51; pub const GLOB_ERR: ::c_int = 1 << 0; pub const GLOB_MARK: ::c_int = 1 << 1; @@ -2010,12 +2216,12 @@ 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_SPAWN_USEVFORK: ::c_int = 64; -pub const POSIX_SPAWN_SETSID: ::c_int = 128; +pub const POSIX_SPAWN_USEVFORK: ::c_short = 64; +pub const POSIX_SPAWN_SETSID: ::c_short = 128; -pub const S_IEXEC: mode_t = 64; -pub const S_IWRITE: mode_t = 128; -pub const S_IREAD: mode_t = 256; +pub const S_IEXEC: mode_t = 0o0100; +pub const S_IWRITE: mode_t = 0o0200; +pub const S_IREAD: mode_t = 0o0400; pub const F_LOCK: ::c_int = 1; pub const F_TEST: ::c_int = 3; @@ -2213,6 +2419,7 @@ pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t { pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { size: [0; __SIZEOF_PTHREAD_RWLOCK_T], }; +pub const PTHREAD_BARRIER_SERIAL_THREAD: ::c_int = -1; 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; @@ -2583,6 +2790,8 @@ pub const CMSPAR: ::tcflag_t = 0o10000000000; pub const MFD_CLOEXEC: ::c_uint = 0x0001; pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002; pub const MFD_HUGETLB: ::c_uint = 0x0004; +pub const MFD_NOEXEC_SEAL: ::c_uint = 0x0008; +pub const MFD_EXEC: ::c_uint = 0x0010; pub const MFD_HUGE_64KB: ::c_uint = 0x40000000; pub const MFD_HUGE_512KB: ::c_uint = 0x4c000000; pub const MFD_HUGE_1MB: ::c_uint = 0x50000000; @@ -2765,12 +2974,12 @@ pub const ETH_P_PHONET: ::c_int = 0x00F5; pub const ETH_P_IEEE802154: ::c_int = 0x00F6; pub const ETH_P_CAIF: ::c_int = 0x00F7; -pub const 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_SETSCHEDPARAM: ::c_int = 0x10; -pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x20; +pub const POSIX_SPAWN_RESETIDS: ::c_short = 0x01; +pub const POSIX_SPAWN_SETPGROUP: ::c_short = 0x02; +pub const POSIX_SPAWN_SETSIGDEF: ::c_short = 0x04; +pub const POSIX_SPAWN_SETSIGMASK: ::c_short = 0x08; +pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_short = 0x10; +pub const POSIX_SPAWN_SETSCHEDULER: ::c_short = 0x20; pub const NLMSG_NOOP: ::c_int = 0x1; pub const NLMSG_ERROR: ::c_int = 0x2; @@ -3061,20 +3270,47 @@ pub const NF_INET_FORWARD: ::c_int = 2; pub const NF_INET_LOCAL_OUT: ::c_int = 3; pub const NF_INET_POST_ROUTING: ::c_int = 4; pub const NF_INET_NUMHOOKS: ::c_int = 5; +pub const NF_INET_INGRESS: ::c_int = NF_INET_NUMHOOKS; + +pub const NF_NETDEV_INGRESS: ::c_int = 0; +pub const NF_NETDEV_EGRESS: ::c_int = 1; +pub const NF_NETDEV_NUMHOOKS: ::c_int = 2; // Some NFPROTO are not compatible with musl and are defined in submodules. pub const NFPROTO_UNSPEC: ::c_int = 0; +pub const NFPROTO_INET: ::c_int = 1; pub const NFPROTO_IPV4: ::c_int = 2; pub const NFPROTO_ARP: ::c_int = 3; +pub const NFPROTO_NETDEV: ::c_int = 5; pub const NFPROTO_BRIDGE: ::c_int = 7; pub const NFPROTO_IPV6: ::c_int = 10; pub const NFPROTO_DECNET: ::c_int = 12; pub const NFPROTO_NUMPROTO: ::c_int = 13; -pub const NFPROTO_INET: ::c_int = 1; -pub const NFPROTO_NETDEV: ::c_int = 5; -pub const NF_NETDEV_INGRESS: ::c_int = 0; -pub const NF_NETDEV_NUMHOOKS: ::c_int = 1; +// linux/netfilter_arp.h +pub const NF_ARP: ::c_int = 0; +pub const NF_ARP_IN: ::c_int = 0; +pub const NF_ARP_OUT: ::c_int = 1; +pub const NF_ARP_FORWARD: ::c_int = 2; +pub const NF_ARP_NUMHOOKS: ::c_int = 3; + +// linux/netfilter_bridge.h +pub const NF_BR_PRE_ROUTING: ::c_int = 0; +pub const NF_BR_LOCAL_IN: ::c_int = 1; +pub const NF_BR_FORWARD: ::c_int = 2; +pub const NF_BR_LOCAL_OUT: ::c_int = 3; +pub const NF_BR_POST_ROUTING: ::c_int = 4; +pub const NF_BR_BROUTING: ::c_int = 5; +pub const NF_BR_NUMHOOKS: ::c_int = 6; + +pub const NF_BR_PRI_FIRST: ::c_int = ::INT_MIN; +pub const NF_BR_PRI_NAT_DST_BRIDGED: ::c_int = -300; +pub const NF_BR_PRI_FILTER_BRIDGED: ::c_int = -200; +pub const NF_BR_PRI_BRNF: ::c_int = 0; +pub const NF_BR_PRI_NAT_DST_OTHER: ::c_int = 100; +pub const NF_BR_PRI_FILTER_OTHER: ::c_int = 200; +pub const NF_BR_PRI_NAT_SRC: ::c_int = 300; +pub const NF_BR_PRI_LAST: ::c_int = ::INT_MAX; // linux/netfilter_ipv4.h pub const NF_IP_PRE_ROUTING: ::c_int = 0; @@ -3085,6 +3321,7 @@ pub const NF_IP_POST_ROUTING: ::c_int = 4; pub const NF_IP_NUMHOOKS: ::c_int = 5; pub const NF_IP_PRI_FIRST: ::c_int = ::INT_MIN; +pub const NF_IP_PRI_RAW_BEFORE_DEFRAG: ::c_int = -450; pub const NF_IP_PRI_CONNTRACK_DEFRAG: ::c_int = -400; pub const NF_IP_PRI_RAW: ::c_int = -300; pub const NF_IP_PRI_SELINUX_FIRST: ::c_int = -225; @@ -3108,6 +3345,7 @@ pub const NF_IP6_POST_ROUTING: ::c_int = 4; pub const NF_IP6_NUMHOOKS: ::c_int = 5; pub const NF_IP6_PRI_FIRST: ::c_int = ::INT_MIN; +pub const NF_IP6_PRI_RAW_BEFORE_DEFRAG: ::c_int = -450; pub const NF_IP6_PRI_CONNTRACK_DEFRAG: ::c_int = -400; pub const NF_IP6_PRI_RAW: ::c_int = -300; pub const NF_IP6_PRI_SELINUX_FIRST: ::c_int = -225; @@ -3457,6 +3695,9 @@ pub const IW_ENC_CAPA_CIPHER_TKIP: ::c_ulong = 0x00000004; pub const IW_ENC_CAPA_CIPHER_CCMP: ::c_ulong = 0x00000008; pub const IW_ENC_CAPA_4WAY_HANDSHAKE: ::c_ulong = 0x00000010; +pub const IW_EVENT_CAPA_K_0: c_ulong = 0x4000050; // IW_EVENT_CAPA_MASK(0x8B04) | IW_EVENT_CAPA_MASK(0x8B06) | IW_EVENT_CAPA_MASK(0x8B1A); +pub const IW_EVENT_CAPA_K_1: c_ulong = 0x400; // W_EVENT_CAPA_MASK(0x8B2A); + pub const IW_PMKSA_ADD: usize = 1; pub const IW_PMKSA_REMOVE: usize = 2; pub const IW_PMKSA_FLUSH: usize = 3; @@ -3467,8 +3708,13 @@ pub const IW_PMKID_CAND_PREAUTH: ::c_ulong = 0x00000001; pub const IW_EV_LCP_PK_LEN: usize = 4; -pub const IW_EV_CHAR_PK_LEN: usize = IW_EV_LCP_PK_LEN + ::IFNAMSIZ; -pub const IW_EV_POINT_PK_LEN: usize = IW_EV_LCP_PK_LEN + 4; +pub const IW_EV_CHAR_PK_LEN: usize = 20; // IW_EV_LCP_PK_LEN + ::IFNAMSIZ; +pub const IW_EV_UINT_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + ::mem::size_of::(); +pub const IW_EV_FREQ_PK_LEN: usize = 12; // IW_EV_LCP_PK_LEN + ::mem::size_of::(); +pub const IW_EV_PARAM_PK_LEN: usize = 12; // IW_EV_LCP_PK_LEN + ::mem::size_of::(); +pub const IW_EV_ADDR_PK_LEN: usize = 20; // IW_EV_LCP_PK_LEN + ::mem::size_of::<::sockaddr>(); +pub const IW_EV_QUAL_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + ::mem::size_of::(); +pub const IW_EV_POINT_PK_LEN: usize = 8; // IW_EV_LCP_PK_LEN + 4; pub const IPTOS_TOS_MASK: u8 = 0x1E; pub const IPTOS_PREC_MASK: u8 = 0xE0; @@ -4186,6 +4432,13 @@ pub const NFT_CT_PROTO_DST: ::c_int = 12; pub const NFT_CT_LABELS: ::c_int = 13; pub const NFT_CT_PKTS: ::c_int = 14; pub const NFT_CT_BYTES: ::c_int = 15; +pub const NFT_CT_AVGPKT: ::c_int = 16; +pub const NFT_CT_ZONE: ::c_int = 17; +pub const NFT_CT_EVENTMASK: ::c_int = 18; +pub const NFT_CT_SRC_IP: ::c_int = 19; +pub const NFT_CT_DST_IP: ::c_int = 20; +pub const NFT_CT_SRC_IP6: ::c_int = 21; +pub const NFT_CT_DST_IP6: ::c_int = 22; pub const NFT_LIMIT_PKTS: ::c_int = 0; pub const NFT_LIMIT_PKT_BYTES: ::c_int = 1; @@ -4311,7 +4564,7 @@ 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_IGNORE: ::c_uint = 0x0000_0400; pub const FAN_MARK_INODE: ::c_uint = 0x0000_0000; pub const FAN_MARK_MOUNT: ::c_uint = 0x0000_0010; @@ -4342,6 +4595,7 @@ pub const FAN_NOFD: ::c_int = -1; pub const FAN_NOPIDFD: ::c_int = FAN_NOFD; pub const FAN_EPIDFD: ::c_int = -2; +// linux/futex.h pub const FUTEX_WAIT: ::c_int = 0; pub const FUTEX_WAKE: ::c_int = 1; pub const FUTEX_FD: ::c_int = 2; @@ -4361,6 +4615,10 @@ pub const FUTEX_PRIVATE_FLAG: ::c_int = 128; pub const FUTEX_CLOCK_REALTIME: ::c_int = 256; pub const FUTEX_CMD_MASK: ::c_int = !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME); +pub const FUTEX_WAITERS: u32 = 0x80000000; +pub const FUTEX_OWNER_DIED: u32 = 0x40000000; +pub const FUTEX_TID_MASK: u32 = 0x3fffffff; + pub const FUTEX_BITSET_MATCH_ANY: ::c_int = 0xffffffff; pub const FUTEX_OP_SET: ::c_int = 0; @@ -4883,7 +5141,7 @@ f! { as *mut cmsghdr; let max = (*mhdr).msg_control as usize + (*mhdr).msg_controllen as usize; - if (next.offset(1)) as usize > max || + if (next.wrapping_offset(1)) as usize > max || next as usize + super::CMSG_ALIGN((*next).cmsg_len as usize) > max { 0 as *mut cmsghdr @@ -5015,6 +5273,30 @@ f! { pub fn BPF_JUMP(code: ::__u16, k: ::__u32, jt: ::__u8, jf: ::__u8) -> sock_filter { sock_filter{code: code, jt: jt, jf: jf, k: k} } + + pub fn ELF32_R_SYM(val: Elf32_Word) -> Elf32_Word { + val >> 8 + } + + pub fn ELF32_R_TYPE(val: Elf32_Word) -> Elf32_Word { + val & 0xff + } + + pub fn ELF32_R_INFO(sym: Elf32_Word, t: Elf32_Word) -> Elf32_Word { + sym << 8 + t & 0xff + } + + pub fn ELF64_R_SYM(val: Elf64_Xword) -> Elf64_Xword { + val >> 32 + } + + pub fn ELF64_R_TYPE(val: Elf64_Xword) -> Elf64_Xword { + val & 0xffffffff + } + + pub fn ELF64_R_INFO(sym: Elf64_Xword, t: Elf64_Xword) -> Elf64_Xword { + sym << 32 + t + } } safe_f! { @@ -5133,9 +5415,6 @@ cfg_if! { spbufp: *mut *mut spwd, ) -> ::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 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; @@ -5222,6 +5501,9 @@ extern "C" { pub fn getspnam(name: *const ::c_char) -> *mut spwd; + pub fn shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int; + pub fn shm_unlink(name: *const ::c_char) -> ::c_int; + // System V IPC pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int; pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void; @@ -5828,6 +6110,10 @@ extern "C" { len: ::size_t, flags: ::c_uint, ) -> ::ssize_t; + + pub fn klogctl(syslog_type: ::c_int, bufp: *mut ::c_char, len: ::c_int) -> ::c_int; + + pub fn ioctl(fd: ::c_int, request: ::Ioctl, ...) -> ::c_int; } // LFS64 extensions 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 3f41f8990a09f..58097f1434015 100644 --- a/src/unix/linux_like/linux/musl/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/arm/mod.rs @@ -840,6 +840,7 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; +pub const SYS_mseal: ::c_long = 462; 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/b32/powerpc.rs b/src/unix/linux_like/linux/musl/b32/powerpc.rs index bdf25455fd8cc..834a442802b27 100644 --- a/src/unix/linux_like/linux/musl/b32/powerpc.rs +++ b/src/unix/linux_like/linux/musl/b32/powerpc.rs @@ -796,6 +796,7 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; +pub const SYS_mseal: ::c_long = 462; 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/b32/x86/mod.rs b/src/unix/linux_like/linux/musl/b32/x86/mod.rs index d0ed21fa3f5d7..f43c7ea60f8c7 100644 --- a/src/unix/linux_like/linux/musl/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/x86/mod.rs @@ -936,6 +936,7 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; +pub const SYS_fchmodat2: ::c_long = 452; // offsets in user_regs_structs, from sys/reg.h pub const EBX: ::c_int = 0; 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 0d66884445421..1d84a15790cbc 100644 --- a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs @@ -561,6 +561,7 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; +pub const SYS_mseal: ::c_long = 462; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; diff --git a/src/unix/linux_like/linux/musl/b64/loongarch64/align.rs b/src/unix/linux_like/linux/musl/b64/loongarch64/align.rs new file mode 100644 index 0000000000000..dc191f51fdb1c --- /dev/null +++ b/src/unix/linux_like/linux/musl/b64/loongarch64/align.rs @@ -0,0 +1,40 @@ +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f64; 4] + } +} + +s! { + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_sigmask: ::sigset_t, + pub uc_mcontext: mcontext_t, + } + + #[repr(align(16))] + pub struct mcontext_t { + pub __pc: ::c_ulonglong, + pub __gregs: [::c_ulonglong; 32], + pub __flags: ::c_uint, + pub __extcontext: [::c_ulonglong; 0], + } + + #[repr(align(8))] + pub struct clone_args { + pub flags: ::c_ulonglong, + pub pidfd: ::c_ulonglong, + pub child_tid: ::c_ulonglong, + pub parent_tid: ::c_ulonglong, + pub exit_signal: ::c_ulonglong, + pub stack: ::c_ulonglong, + pub stack_size: ::c_ulonglong, + pub tls: ::c_ulonglong, + pub set_tid: ::c_ulonglong, + pub set_tid_size: ::c_ulonglong, + pub cgroup: ::c_ulonglong, + } +} diff --git a/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs b/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs new file mode 100644 index 0000000000000..59a824b237306 --- /dev/null +++ b/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs @@ -0,0 +1,669 @@ +//! LoongArch-specific definitions for 64-bit linux-like values + +pub type c_char = i8; +pub type wchar_t = ::c_int; + +pub type nlink_t = ::c_uint; +pub type blksize_t = ::c_int; +pub type fsblkcnt64_t = ::c_ulong; +pub type fsfilcnt64_t = ::c_ulong; +pub type __u64 = ::c_ulonglong; +pub type __s64 = ::c_longlong; + +s! { + pub struct pthread_attr_t { + __size: [::c_ulong; 7], + } + + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad1: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + __pad2: ::c_int, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_int; 2usize], + } + + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino64_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + pub __pad1: ::dev_t, + pub st_size: ::off64_t, + pub st_blksize: ::blksize_t, + pub __pad2: ::c_int, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_int; 2], + } + + pub struct statfs { + pub f_type: ::c_long, + pub f_bsize: ::c_long, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_long, + pub f_frsize: ::c_long, + pub f_flags: ::c_long, + pub f_spare: [::c_long; 4], + } + + pub struct statfs64 { + pub f_type: ::c_long, + pub f_bsize: ::c_long, + pub f_blocks: ::fsblkcnt64_t, + pub f_bfree: ::fsblkcnt64_t, + pub f_bavail: ::fsblkcnt64_t, + pub f_files: ::fsfilcnt64_t, + pub f_ffree: ::fsfilcnt64_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_long, + pub f_frsize: ::c_long, + pub f_flags: ::c_long, + pub f_spare: [::c_long; 4], + } + + pub struct ipc_perm { + pub __key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::c_uint, + pub __seq: ::c_ushort, + __pad2: ::c_ushort, + __unused1: ::c_ulong, + __unused2: ::c_ulong, + } + + pub struct user_regs_struct { + pub regs: [u64; 32], + pub orig_a0: u64, + pub csr_era: u64, + pub csr_badv: u64, + pub reserved: [u64; 10], + + } + + pub struct user_fp_struct { + pub fpr: [u64; 32], + pub fcc: u64, + pub fcsr: u32, + } +} + +pub const SYS_io_setup: ::c_long = 0; +pub const SYS_io_destroy: ::c_long = 1; +pub const SYS_io_submit: ::c_long = 2; +pub const SYS_io_cancel: ::c_long = 3; +pub const SYS_io_getevents: ::c_long = 4; +pub const SYS_setxattr: ::c_long = 5; +pub const SYS_lsetxattr: ::c_long = 6; +pub const SYS_fsetxattr: ::c_long = 7; +pub const SYS_getxattr: ::c_long = 8; +pub const SYS_lgetxattr: ::c_long = 9; +pub const SYS_fgetxattr: ::c_long = 10; +pub const SYS_listxattr: ::c_long = 11; +pub const SYS_llistxattr: ::c_long = 12; +pub const SYS_flistxattr: ::c_long = 13; +pub const SYS_removexattr: ::c_long = 14; +pub const SYS_lremovexattr: ::c_long = 15; +pub const SYS_fremovexattr: ::c_long = 16; +pub const SYS_getcwd: ::c_long = 17; +pub const SYS_lookup_dcookie: ::c_long = 18; +pub const SYS_eventfd2: ::c_long = 19; +pub const SYS_epoll_create1: ::c_long = 20; +pub const SYS_epoll_ctl: ::c_long = 21; +pub const SYS_epoll_pwait: ::c_long = 22; +pub const SYS_dup: ::c_long = 23; +pub const SYS_dup3: ::c_long = 24; +pub const SYS_fcntl: ::c_long = 25; +pub const SYS_inotify_init1: ::c_long = 26; +pub const SYS_inotify_add_watch: ::c_long = 27; +pub const SYS_inotify_rm_watch: ::c_long = 28; +pub const SYS_ioctl: ::c_long = 29; +pub const SYS_ioprio_set: ::c_long = 30; +pub const SYS_ioprio_get: ::c_long = 31; +pub const SYS_flock: ::c_long = 32; +pub const SYS_mknodat: ::c_long = 33; +pub const SYS_mkdirat: ::c_long = 34; +pub const SYS_unlinkat: ::c_long = 35; +pub const SYS_symlinkat: ::c_long = 36; +pub const SYS_linkat: ::c_long = 37; +pub const SYS_umount2: ::c_long = 39; +pub const SYS_mount: ::c_long = 40; +pub const SYS_pivot_root: ::c_long = 41; +pub const SYS_nfsservctl: ::c_long = 42; +pub const SYS_statfs: ::c_long = 43; +pub const SYS_fstatfs: ::c_long = 44; +pub const SYS_truncate: ::c_long = 45; +pub const SYS_ftruncate: ::c_long = 46; +pub const SYS_fallocate: ::c_long = 47; +pub const SYS_faccessat: ::c_long = 48; +pub const SYS_chdir: ::c_long = 49; +pub const SYS_fchdir: ::c_long = 50; +pub const SYS_chroot: ::c_long = 51; +pub const SYS_fchmod: ::c_long = 52; +pub const SYS_fchmodat: ::c_long = 53; +pub const SYS_fchownat: ::c_long = 54; +pub const SYS_fchown: ::c_long = 55; +pub const SYS_openat: ::c_long = 56; +pub const SYS_close: ::c_long = 57; +pub const SYS_vhangup: ::c_long = 58; +pub const SYS_pipe2: ::c_long = 59; +pub const SYS_quotactl: ::c_long = 60; +pub const SYS_getdents64: ::c_long = 61; +pub const SYS_lseek: ::c_long = 62; +pub const SYS_read: ::c_long = 63; +pub const SYS_write: ::c_long = 64; +pub const SYS_readv: ::c_long = 65; +pub const SYS_writev: ::c_long = 66; +pub const SYS_pread64: ::c_long = 67; +pub const SYS_pwrite64: ::c_long = 68; +pub const SYS_preadv: ::c_long = 69; +pub const SYS_pwritev: ::c_long = 70; +pub const SYS_sendfile: ::c_long = 71; +pub const SYS_pselect6: ::c_long = 72; +pub const SYS_ppoll: ::c_long = 73; +pub const SYS_signalfd4: ::c_long = 74; +pub const SYS_vmsplice: ::c_long = 75; +pub const SYS_splice: ::c_long = 76; +pub const SYS_tee: ::c_long = 77; +pub const SYS_readlinkat: ::c_long = 78; +pub const SYS_sync: ::c_long = 81; +pub const SYS_fsync: ::c_long = 82; +pub const SYS_fdatasync: ::c_long = 83; +pub const SYS_sync_file_range: ::c_long = 84; +pub const SYS_timerfd_create: ::c_long = 85; +pub const SYS_timerfd_settime: ::c_long = 86; +pub const SYS_timerfd_gettime: ::c_long = 87; +pub const SYS_utimensat: ::c_long = 88; +pub const SYS_acct: ::c_long = 89; +pub const SYS_capget: ::c_long = 90; +pub const SYS_capset: ::c_long = 91; +pub const SYS_personality: ::c_long = 92; +pub const SYS_exit: ::c_long = 93; +pub const SYS_exit_group: ::c_long = 94; +pub const SYS_waitid: ::c_long = 95; +pub const SYS_set_tid_address: ::c_long = 96; +pub const SYS_unshare: ::c_long = 97; +pub const SYS_futex: ::c_long = 98; +pub const SYS_set_robust_list: ::c_long = 99; +pub const SYS_get_robust_list: ::c_long = 100; +pub const SYS_nanosleep: ::c_long = 101; +pub const SYS_getitimer: ::c_long = 102; +pub const SYS_setitimer: ::c_long = 103; +pub const SYS_kexec_load: ::c_long = 104; +pub const SYS_init_module: ::c_long = 105; +pub const SYS_delete_module: ::c_long = 106; +pub const SYS_timer_create: ::c_long = 107; +pub const SYS_timer_gettime: ::c_long = 108; +pub const SYS_timer_getoverrun: ::c_long = 109; +pub const SYS_timer_settime: ::c_long = 110; +pub const SYS_timer_delete: ::c_long = 111; +pub const SYS_clock_settime: ::c_long = 112; +pub const SYS_clock_gettime: ::c_long = 113; +pub const SYS_clock_getres: ::c_long = 114; +pub const SYS_clock_nanosleep: ::c_long = 115; +pub const SYS_syslog: ::c_long = 116; +pub const SYS_ptrace: ::c_long = 117; +pub const SYS_sched_setparam: ::c_long = 118; +pub const SYS_sched_setscheduler: ::c_long = 119; +pub const SYS_sched_getscheduler: ::c_long = 120; +pub const SYS_sched_getparam: ::c_long = 121; +pub const SYS_sched_setaffinity: ::c_long = 122; +pub const SYS_sched_getaffinity: ::c_long = 123; +pub const SYS_sched_yield: ::c_long = 124; +pub const SYS_sched_get_priority_max: ::c_long = 125; +pub const SYS_sched_get_priority_min: ::c_long = 126; +pub const SYS_sched_rr_get_interval: ::c_long = 127; +pub const SYS_restart_syscall: ::c_long = 128; +pub const SYS_kill: ::c_long = 129; +pub const SYS_tkill: ::c_long = 130; +pub const SYS_tgkill: ::c_long = 131; +pub const SYS_sigaltstack: ::c_long = 132; +pub const SYS_rt_sigsuspend: ::c_long = 133; +pub const SYS_rt_sigaction: ::c_long = 134; +pub const SYS_rt_sigprocmask: ::c_long = 135; +pub const SYS_rt_sigpending: ::c_long = 136; +pub const SYS_rt_sigtimedwait: ::c_long = 137; +pub const SYS_rt_sigqueueinfo: ::c_long = 138; +pub const SYS_rt_sigreturn: ::c_long = 139; +pub const SYS_setpriority: ::c_long = 140; +pub const SYS_getpriority: ::c_long = 141; +pub const SYS_reboot: ::c_long = 142; +pub const SYS_setregid: ::c_long = 143; +pub const SYS_setgid: ::c_long = 144; +pub const SYS_setreuid: ::c_long = 145; +pub const SYS_setuid: ::c_long = 146; +pub const SYS_setresuid: ::c_long = 147; +pub const SYS_getresuid: ::c_long = 148; +pub const SYS_setresgid: ::c_long = 149; +pub const SYS_getresgid: ::c_long = 150; +pub const SYS_setfsuid: ::c_long = 151; +pub const SYS_setfsgid: ::c_long = 152; +pub const SYS_times: ::c_long = 153; +pub const SYS_setpgid: ::c_long = 154; +pub const SYS_getpgid: ::c_long = 155; +pub const SYS_getsid: ::c_long = 156; +pub const SYS_setsid: ::c_long = 157; +pub const SYS_getgroups: ::c_long = 158; +pub const SYS_setgroups: ::c_long = 159; +pub const SYS_uname: ::c_long = 160; +pub const SYS_sethostname: ::c_long = 161; +pub const SYS_setdomainname: ::c_long = 162; +pub const SYS_getrusage: ::c_long = 165; +pub const SYS_umask: ::c_long = 166; +pub const SYS_prctl: ::c_long = 167; +pub const SYS_getcpu: ::c_long = 168; +pub const SYS_gettimeofday: ::c_long = 169; +pub const SYS_settimeofday: ::c_long = 170; +pub const SYS_adjtimex: ::c_long = 171; +pub const SYS_getpid: ::c_long = 172; +pub const SYS_getppid: ::c_long = 173; +pub const SYS_getuid: ::c_long = 174; +pub const SYS_geteuid: ::c_long = 175; +pub const SYS_getgid: ::c_long = 176; +pub const SYS_getegid: ::c_long = 177; +pub const SYS_gettid: ::c_long = 178; +pub const SYS_sysinfo: ::c_long = 179; +pub const SYS_mq_open: ::c_long = 180; +pub const SYS_mq_unlink: ::c_long = 181; +pub const SYS_mq_timedsend: ::c_long = 182; +pub const SYS_mq_timedreceive: ::c_long = 183; +pub const SYS_mq_notify: ::c_long = 184; +pub const SYS_mq_getsetattr: ::c_long = 185; +pub const SYS_msgget: ::c_long = 186; +pub const SYS_msgctl: ::c_long = 187; +pub const SYS_msgrcv: ::c_long = 188; +pub const SYS_msgsnd: ::c_long = 189; +pub const SYS_semget: ::c_long = 190; +pub const SYS_semctl: ::c_long = 191; +pub const SYS_semtimedop: ::c_long = 192; +pub const SYS_semop: ::c_long = 193; +pub const SYS_shmget: ::c_long = 194; +pub const SYS_shmctl: ::c_long = 195; +pub const SYS_shmat: ::c_long = 196; +pub const SYS_shmdt: ::c_long = 197; +pub const SYS_socket: ::c_long = 198; +pub const SYS_socketpair: ::c_long = 199; +pub const SYS_bind: ::c_long = 200; +pub const SYS_listen: ::c_long = 201; +pub const SYS_accept: ::c_long = 202; +pub const SYS_connect: ::c_long = 203; +pub const SYS_getsockname: ::c_long = 204; +pub const SYS_getpeername: ::c_long = 205; +pub const SYS_sendto: ::c_long = 206; +pub const SYS_recvfrom: ::c_long = 207; +pub const SYS_setsockopt: ::c_long = 208; +pub const SYS_getsockopt: ::c_long = 209; +pub const SYS_shutdown: ::c_long = 210; +pub const SYS_sendmsg: ::c_long = 211; +pub const SYS_recvmsg: ::c_long = 212; +pub const SYS_readahead: ::c_long = 213; +pub const SYS_brk: ::c_long = 214; +pub const SYS_munmap: ::c_long = 215; +pub const SYS_mremap: ::c_long = 216; +pub const SYS_add_key: ::c_long = 217; +pub const SYS_request_key: ::c_long = 218; +pub const SYS_keyctl: ::c_long = 219; +pub const SYS_clone: ::c_long = 220; +pub const SYS_execve: ::c_long = 221; +pub const SYS_mmap: ::c_long = 222; +pub const SYS_fadvise64: ::c_long = 223; +pub const SYS_swapon: ::c_long = 224; +pub const SYS_swapoff: ::c_long = 225; +pub const SYS_mprotect: ::c_long = 226; +pub const SYS_msync: ::c_long = 227; +pub const SYS_mlock: ::c_long = 228; +pub const SYS_munlock: ::c_long = 229; +pub const SYS_mlockall: ::c_long = 230; +pub const SYS_munlockall: ::c_long = 231; +pub const SYS_mincore: ::c_long = 232; +pub const SYS_madvise: ::c_long = 233; +pub const SYS_remap_file_pages: ::c_long = 234; +pub const SYS_mbind: ::c_long = 235; +pub const SYS_get_mempolicy: ::c_long = 236; +pub const SYS_set_mempolicy: ::c_long = 237; +pub const SYS_migrate_pages: ::c_long = 238; +pub const SYS_move_pages: ::c_long = 239; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 240; +pub const SYS_perf_event_open: ::c_long = 241; +pub const SYS_accept4: ::c_long = 242; +pub const SYS_recvmmsg: ::c_long = 243; +pub const SYS_arch_specific_syscall: ::c_long = 244; +pub const SYS_wait4: ::c_long = 260; +pub const SYS_prlimit64: ::c_long = 261; +pub const SYS_fanotify_init: ::c_long = 262; +pub const SYS_fanotify_mark: ::c_long = 263; +pub const SYS_name_to_handle_at: ::c_long = 264; +pub const SYS_open_by_handle_at: ::c_long = 265; +pub const SYS_clock_adjtime: ::c_long = 266; +pub const SYS_syncfs: ::c_long = 267; +pub const SYS_setns: ::c_long = 268; +pub const SYS_sendmmsg: ::c_long = 269; +pub const SYS_process_vm_readv: ::c_long = 270; +pub const SYS_process_vm_writev: ::c_long = 271; +pub const SYS_kcmp: ::c_long = 272; +pub const SYS_finit_module: ::c_long = 273; +pub const SYS_sched_setattr: ::c_long = 274; +pub const SYS_sched_getattr: ::c_long = 275; +pub const SYS_renameat2: ::c_long = 276; +pub const SYS_seccomp: ::c_long = 277; +pub const SYS_getrandom: ::c_long = 278; +pub const SYS_memfd_create: ::c_long = 279; +pub const SYS_bpf: ::c_long = 280; +pub const SYS_execveat: ::c_long = 281; +pub const SYS_userfaultfd: ::c_long = 282; +pub const SYS_membarrier: ::c_long = 283; +pub const SYS_mlock2: ::c_long = 284; +pub const SYS_copy_file_range: ::c_long = 285; +pub const SYS_preadv2: ::c_long = 286; +pub const SYS_pwritev2: ::c_long = 287; +pub const SYS_pkey_mprotect: ::c_long = 288; +pub const SYS_pkey_alloc: ::c_long = 289; +pub const SYS_pkey_free: ::c_long = 290; +pub const SYS_statx: ::c_long = 291; +pub const SYS_io_pgetevents: ::c_long = 292; +pub const SYS_rseq: ::c_long = 293; +pub const SYS_kexec_file_load: ::c_long = 294; +pub const SYS_pidfd_send_signal: ::c_long = 424; +pub const SYS_io_uring_setup: ::c_long = 425; +pub const SYS_io_uring_enter: ::c_long = 426; +pub const SYS_io_uring_register: ::c_long = 427; +pub const SYS_open_tree: ::c_long = 428; +pub const SYS_move_mount: ::c_long = 429; +pub const SYS_fsopen: ::c_long = 430; +pub const SYS_fsconfig: ::c_long = 431; +pub const SYS_fsmount: ::c_long = 432; +pub const SYS_fspick: ::c_long = 433; +pub const SYS_pidfd_open: ::c_long = 434; +pub const SYS_clone3: ::c_long = 435; +pub const SYS_close_range: ::c_long = 436; +pub const SYS_openat2: ::c_long = 437; +pub const SYS_pidfd_getfd: ::c_long = 438; +pub const SYS_faccessat2: ::c_long = 439; +pub const SYS_process_madvise: ::c_long = 440; +pub const SYS_epoll_pwait2: ::c_long = 441; +pub const SYS_mount_setattr: ::c_long = 442; +pub const SYS_quotactl_fd: ::c_long = 443; +pub const SYS_landlock_create_ruleset: ::c_long = 444; +pub const SYS_landlock_add_rule: ::c_long = 445; +pub const SYS_landlock_restrict_self: ::c_long = 446; +pub const SYS_process_mrelease: ::c_long = 448; +pub const SYS_futex_waitv: ::c_long = 449; +pub const SYS_set_mempolicy_home_node: ::c_long = 450; +pub const SYS_cachestat: ::c_long = 451; +pub const SYS_fchmodat2: ::c_long = 452; +pub const SYS_map_shadow_stack: ::c_long = 453; +pub const SYS_futex_wake: ::c_long = 454; +pub const SYS_futex_wait: ::c_long = 455; +pub const SYS_futex_requeue: ::c_long = 456; + +pub const O_APPEND: ::c_int = 1024; +pub const O_DIRECT: ::c_int = 0x4000; +pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_LARGEFILE: ::c_int = 0; +pub const O_NOFOLLOW: ::c_int = 0x20000; +pub const O_CREAT: ::c_int = 64; +pub const O_EXCL: ::c_int = 128; +pub const O_NOCTTY: ::c_int = 256; +pub const O_NONBLOCK: ::c_int = 2048; +pub const O_SYNC: ::c_int = 1052672; +pub const O_RSYNC: ::c_int = 1052672; +pub const O_DSYNC: ::c_int = 4096; +pub const O_ASYNC: ::c_int = 4096; + +pub const SIGSTKSZ: ::size_t = 16384; +pub const MINSIGSTKSZ: ::size_t = 4096; + +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOSYS: ::c_int = 38; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const EMULTIHOP: ::c_int = 72; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EBADMSG: ::c_int = 74; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const ENOTSUP: ::c_int = EOPNOTSUPP; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ENOTCONN: ::c_int = 107; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const EHWPOISON: ::c_int = 133; +pub const ERFKILL: ::c_int = 132; + +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 0x00000004; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; + +pub const SIGCHLD: ::c_int = 17; +pub const SIGBUS: ::c_int = 7; +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIG_BLOCK: ::c_int = 0; +pub const SIG_UNBLOCK: ::c_int = 1; + +pub const F_GETLK: ::c_int = 5; +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 VEOF: usize = 4; + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; + +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_LOCKED: ::c_int = 0x02000; +pub const MAP_NORESERVE: ::c_int = 0x04000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; +pub const MAP_HUGETLB: ::c_int = 0x040000; +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; +pub const TAB3: ::c_int = 0x00001800; +pub const CR1: ::c_int = 0x00000200; +pub const CR2: ::c_int = 0x00000400; +pub const CR3: ::c_int = 0x00000600; +pub const FF1: ::c_int = 0x00008000; +pub const BS1: ::c_int = 0x00002000; +pub const VT1: ::c_int = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const EDEADLK: ::c_int = 35; +pub const EDEADLOCK: ::c_int = EDEADLK; +pub const EXTPROC: ::tcflag_t = 0x00010000; +pub const VEOL: usize = 11; +pub const VEOL2: usize = 16; +pub const VMIN: usize = 6; +pub const IEXTEN: ::tcflag_t = 0x00008000; +pub const TOSTOP: ::tcflag_t = 0x00000100; +pub const FLUSHO: ::tcflag_t = 0x00001000; + +cfg_if! { + if #[cfg(libc_align)] { + mod align; + pub use self::align::*; + } +} diff --git a/src/unix/linux_like/linux/musl/b64/mod.rs b/src/unix/linux_like/linux/musl/b64/mod.rs index 05586cdb44b68..d59343064c52e 100644 --- a/src/unix/linux_like/linux/musl/b64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/mod.rs @@ -157,6 +157,9 @@ cfg_if! { } else if #[cfg(any(target_arch = "riscv64"))] { mod riscv64; pub use self::riscv64::*; + } else if #[cfg(any(target_arch = "loongarch64"))] { + mod loongarch64; + pub use self::loongarch64::*; } else { // Unknown target_arch } diff --git a/src/unix/linux_like/linux/musl/b64/riscv64/align.rs b/src/unix/linux_like/linux/musl/b64/riscv64/align.rs index 48d152a5721ec..5b33f2375d39c 100644 --- a/src/unix/linux_like/linux/musl/b64/riscv64/align.rs +++ b/src/unix/linux_like/linux/musl/b64/riscv64/align.rs @@ -42,3 +42,20 @@ s_no_extra_traits! { pub __glibc_reserved: [::c_uint; 3], } } + +s! { + #[repr(align(8))] + pub struct clone_args { + pub flags: ::c_ulonglong, + pub pidfd: ::c_ulonglong, + pub child_tid: ::c_ulonglong, + pub parent_tid: ::c_ulonglong, + pub exit_signal: ::c_ulonglong, + pub stack: ::c_ulonglong, + pub stack_size: ::c_ulonglong, + pub tls: ::c_ulonglong, + pub set_tid: ::c_ulonglong, + pub set_tid_size: ::c_ulonglong, + pub cgroup: ::c_ulonglong, + } +} diff --git a/src/unix/linux_like/linux/musl/b64/s390x.rs b/src/unix/linux_like/linux/musl/b64/s390x.rs index aa4cbf87f8a22..567914f7b8cd5 100644 --- a/src/unix/linux_like/linux/musl/b64/s390x.rs +++ b/src/unix/linux_like/linux/musl/b64/s390x.rs @@ -722,3 +722,4 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; +pub const SYS_mseal: ::c_long = 462; 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 d0ec67534d2da..b1ede42064f97 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 @@ -608,6 +608,8 @@ pub const SYS_memfd_secret: ::c_long = 447; pub const SYS_process_mrelease: ::c_long = 448; pub const SYS_futex_waitv: ::c_long = 449; pub const SYS_set_mempolicy_home_node: ::c_long = 450; +pub const SYS_fchmodat2: ::c_long = 452; +pub const SYS_mseal: ::c_long = 462; // offsets in user_regs_structs, from sys/reg.h pub const R15: ::c_int = 0; diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 55229a3232f5f..5f2d96eca885e 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -667,6 +667,12 @@ pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209; pub const PTRACE_GETSIGMASK: ::c_uint = 0x420a; pub const PTRACE_SETSIGMASK: ::c_uint = 0x420b; +pub const RWF_HIPRI: ::c_int = 0x00000001; +pub const RWF_DSYNC: ::c_int = 0x00000002; +pub const RWF_SYNC: ::c_int = 0x00000004; +pub const RWF_NOWAIT: ::c_int = 0x00000008; +pub const RWF_APPEND: ::c_int = 0x00000010; + pub const AF_IB: ::c_int = 27; pub const AF_MPLS: ::c_int = 28; pub const AF_NFC: ::c_int = 39; @@ -843,7 +849,6 @@ extern "C" { new_limit: *const ::rlimit, old_limit: *mut ::rlimit, ) -> ::c_int; - pub fn ioctl(fd: ::c_int, request: ::c_int, ...) -> ::c_int; pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int; pub fn ptrace(request: ::c_int, ...) -> ::c_long; pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; @@ -858,6 +863,20 @@ extern "C" { dirfd: ::c_int, path: *const ::c_char, ) -> ::c_int; + pub fn preadv2( + fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + offset: ::off_t, + flags: ::c_int, + ) -> ::ssize_t; + pub fn pwritev2( + fd: ::c_int, + iov: *const ::iovec, + iovcnt: ::c_int, + offset: ::off_t, + flags: ::c_int, + ) -> ::ssize_t; pub fn getauxval(type_: ::c_ulong) -> ::c_ulong; // Added in `musl` 1.1.20 @@ -879,21 +898,6 @@ extern "C" { pub fn asctime_r(tm: *const ::tm, 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 strftime_l( - s: *mut ::c_char, - max: ::size_t, - format: *const ::c_char, - tm: *const ::tm, - locale: ::locale_t, - ) -> ::size_t; - pub fn strptime(s: *const ::c_char, format: *const ::c_char, tm: *mut ::tm) -> *mut ::c_char; - pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; pub fn basename(path: *mut ::c_char) -> *mut ::c_char; @@ -915,7 +919,8 @@ cfg_if! { target_arch = "mips64", target_arch = "powerpc64", target_arch = "s390x", - target_arch = "riscv64"))] { + target_arch = "riscv64", + target_arch = "loongarch64"))] { mod b64; pub use self::b64::*; } else if #[cfg(any(target_arch = "x86", diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs index 48b03e9ee43fa..32c65545a8905 100644 --- a/src/unix/linux_like/linux/uclibc/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mod.rs @@ -107,6 +107,64 @@ impl siginfo_t { } } +// Internal, for casts to access union fields +#[repr(C)] +struct sifields_sigchld { + si_pid: ::pid_t, + si_uid: ::uid_t, + si_status: ::c_int, + si_utime: ::c_long, + si_stime: ::c_long, +} +impl ::Copy for sifields_sigchld {} +impl ::Clone for sifields_sigchld { + fn clone(&self) -> sifields_sigchld { + *self + } +} + +// Internal, for casts to access union fields +#[repr(C)] +union sifields { + _align_pointer: *mut ::c_void, + sigchld: sifields_sigchld, +} + +// Internal, for casts to access union fields. Note that some variants +// of sifields start with a pointer, which makes the alignment of +// sifields vary on 32-bit and 64-bit architectures. +#[repr(C)] +struct siginfo_f { + _siginfo_base: [::c_int; 3], + sifields: sifields, +} + +impl siginfo_t { + unsafe fn sifields(&self) -> &sifields { + &(*(self as *const siginfo_t as *const siginfo_f)).sifields + } + + pub unsafe fn si_pid(&self) -> ::pid_t { + self.sifields().sigchld.si_pid + } + + pub unsafe fn si_uid(&self) -> ::uid_t { + self.sifields().sigchld.si_uid + } + + pub unsafe fn si_status(&self) -> ::c_int { + self.sifields().sigchld.si_status + } + + pub unsafe fn si_utime(&self) -> ::c_long { + self.sifields().sigchld.si_utime + } + + pub unsafe fn si_stime(&self) -> ::c_long { + self.sifields().sigchld.si_stime + } +} + pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; pub const MCL_ONFAULT: ::c_int = 0x0004; @@ -245,7 +303,7 @@ pub const BUFSIZ: ::c_int = 4096; 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 EXTPROC: ::tcflag_t = 0o200000; pub const FOPEN_MAX: ::c_int = 16; pub const F_GETOWN: ::c_int = 9; pub const F_OFD_GETLK: ::c_int = 36; @@ -272,7 +330,7 @@ pub const MAP_HUGE_1GB: ::c_int = 30 << MAP_HUGE_SHIFT; pub const MAP_HUGE_2GB: ::c_int = 31 << MAP_HUGE_SHIFT; pub const MAP_HUGE_16GB: ::c_int = 34 << MAP_HUGE_SHIFT; pub const MINSIGSTKSZ: ::c_int = 2048; -pub const MSG_COPY: ::c_int = 040000; +pub const MSG_COPY: ::c_int = 0o40000; pub const NI_MAXHOST: ::socklen_t = 1025; pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const PACKET_MR_UNICAST: ::c_int = 3; @@ -285,7 +343,7 @@ 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; +pub const SHM_EXEC: ::c_int = 0o100000; pub const SIGPOLL: ::c_int = SIGIO; pub const SOCK_DCCP: ::c_int = 6; pub const SOCK_PACKET: ::c_int = 10; @@ -295,7 +353,6 @@ pub const UDP_SEGMENT: ::c_int = 103; pub const YESEXPR: ::c_int = ((5) << 8) | (0); extern "C" { - pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int; pub fn pthread_rwlockattr_getkind_np( @@ -374,6 +431,7 @@ extern "C" { pub fn setrlimit(resource: ::__rlimit_resource_t, rlim: *const ::rlimit) -> ::c_int; pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int; pub fn setpriority(which: ::__priority_which_t, who: ::id_t, prio: ::c_int) -> ::c_int; + pub fn getauxval(type_: ::c_ulong) -> ::c_ulong; } cfg_if! { diff --git a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs index 384566c5bf379..fe657b70542ab 100644 --- a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs +++ b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs @@ -299,15 +299,15 @@ pub const EHOSTUNREACH: ::c_int = 113; // No route to host pub const EDQUOT: ::c_int = 122; // Quota exceeded pub const EOPNOTSUPP: ::c_int = 0x5f; pub const ENODATA: ::c_int = 0x3d; -pub const O_APPEND: ::c_int = 02000; -pub const O_ACCMODE: ::c_int = 0003; +pub const O_APPEND: ::c_int = 0o2000; +pub const O_ACCMODE: ::c_int = 0o003; pub const O_CLOEXEC: ::c_int = 0x80000; pub const O_CREAT: ::c_int = 0100; -pub const O_DIRECTORY: ::c_int = 0200000; -pub const O_EXCL: ::c_int = 0200; +pub const O_DIRECTORY: ::c_int = 0o200000; +pub const O_EXCL: ::c_int = 0o200; pub const O_NOFOLLOW: ::c_int = 0x20000; -pub const O_NONBLOCK: ::c_int = 04000; -pub const O_TRUNC: ::c_int = 01000; +pub const O_NONBLOCK: ::c_int = 0o4000; +pub const O_TRUNC: ::c_int = 0o1000; pub const NCCS: usize = 32; pub const SIG_SETMASK: ::c_int = 2; // Set the set of blocked signals pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; @@ -320,7 +320,7 @@ pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 32; pub const __SIZEOF_PTHREAD_BARRIERATTR_T: usize = 4; -pub const PIDFD_NONBLOCK: ::c_int = 04000; +pub const PIDFD_NONBLOCK: ::c_int = 0o4000; cfg_if! { if #[cfg(target_os = "l4re")] { diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 1b435e2353985..de27746971ed3 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -505,26 +505,26 @@ pub const O_RDWR: ::c_int = 2; pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC; -pub const S_IFIFO: ::mode_t = 4096; -pub const S_IFCHR: ::mode_t = 8192; -pub const S_IFBLK: ::mode_t = 24576; -pub const S_IFDIR: ::mode_t = 16384; -pub const S_IFREG: ::mode_t = 32768; -pub const S_IFLNK: ::mode_t = 40960; -pub const S_IFSOCK: ::mode_t = 49152; -pub const S_IFMT: ::mode_t = 61440; -pub const S_IRWXU: ::mode_t = 448; -pub const S_IXUSR: ::mode_t = 64; -pub const S_IWUSR: ::mode_t = 128; -pub const S_IRUSR: ::mode_t = 256; -pub const S_IRWXG: ::mode_t = 56; -pub const S_IXGRP: ::mode_t = 8; -pub const S_IWGRP: ::mode_t = 16; -pub const S_IRGRP: ::mode_t = 32; -pub const S_IRWXO: ::mode_t = 7; -pub const S_IXOTH: ::mode_t = 1; -pub const S_IWOTH: ::mode_t = 2; -pub const S_IROTH: ::mode_t = 4; +pub const S_IFIFO: ::mode_t = 0o1_0000; +pub const S_IFCHR: ::mode_t = 0o2_0000; +pub const S_IFBLK: ::mode_t = 0o6_0000; +pub const S_IFDIR: ::mode_t = 0o4_0000; +pub const S_IFREG: ::mode_t = 0o10_0000; +pub const S_IFLNK: ::mode_t = 0o12_0000; +pub const S_IFSOCK: ::mode_t = 0o14_0000; +pub const S_IFMT: ::mode_t = 0o17_0000; +pub const S_IRWXU: ::mode_t = 0o0700; +pub const S_IXUSR: ::mode_t = 0o0100; +pub const S_IWUSR: ::mode_t = 0o0200; +pub const S_IRUSR: ::mode_t = 0o0400; +pub const S_IRWXG: ::mode_t = 0o0070; +pub const S_IXGRP: ::mode_t = 0o0010; +pub const S_IWGRP: ::mode_t = 0o0020; +pub const S_IRGRP: ::mode_t = 0o0040; +pub const S_IRWXO: ::mode_t = 0o0007; +pub const S_IXOTH: ::mode_t = 0o0001; +pub const S_IWOTH: ::mode_t = 0o0002; +pub const S_IROTH: ::mode_t = 0o0004; pub const F_OK: ::c_int = 0; pub const R_OK: ::c_int = 4; pub const W_OK: ::c_int = 2; @@ -1739,11 +1739,6 @@ extern "C" { pub fn acct(filename: *const ::c_char) -> ::c_int; pub fn brk(addr: *mut ::c_void) -> ::c_int; pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void; - #[deprecated( - since = "0.2.66", - note = "causes memory corruption, see rust-lang/libc#1596" - )] - pub fn vfork() -> ::pid_t; pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int; pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int; pub fn wait4( @@ -1755,14 +1750,10 @@ extern "C" { pub fn login_tty(fd: ::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, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char, ) -> ::c_int; + pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int; pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; pub fn freeifaddrs(ifa: *mut ::ifaddrs); pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int; @@ -1775,6 +1766,21 @@ extern "C" { pub fn uname(buf: *mut ::utsname) -> ::c_int; pub fn strchrnul(s: *const ::c_char, c: ::c_int) -> *mut ::c_char; + + pub fn strftime( + s: *mut ::c_char, + max: ::size_t, + format: *const ::c_char, + tm: *const ::tm, + ) -> ::size_t; + pub fn strftime_l( + s: *mut ::c_char, + max: ::size_t, + format: *const ::c_char, + tm: *const ::tm, + locale: ::locale_t, + ) -> ::size_t; + pub fn strptime(s: *const ::c_char, format: *const ::c_char, tm: *mut ::tm) -> *mut ::c_char; } // LFS64 extensions diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 5da25ca24c173..1e6daface673a 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -235,9 +235,9 @@ cfg_if! { } pub const SIGIOT: ::c_int = 6; -pub const S_ISUID: ::mode_t = 0x800; -pub const S_ISGID: ::mode_t = 0x400; -pub const S_ISVTX: ::mode_t = 0x200; +pub const S_ISUID: ::mode_t = 0o4000; +pub const S_ISGID: ::mode_t = 0o2000; +pub const S_ISVTX: ::mode_t = 0o1000; cfg_if! { if #[cfg(not(any(target_os = "haiku", target_os = "illumos", @@ -305,6 +305,13 @@ pub const INADDR_ANY: in_addr_t = 0; pub const INADDR_BROADCAST: in_addr_t = 4294967295; pub const INADDR_NONE: in_addr_t = 4294967295; +pub const IN6ADDR_LOOPBACK_INIT: in6_addr = in6_addr { + s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1], +}; +pub const IN6ADDR_ANY_INIT: in6_addr = in6_addr { + s6_addr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], +}; + pub const ARPOP_REQUEST: u16 = 1; pub const ARPOP_REPLY: u16 = 2; @@ -313,6 +320,11 @@ pub const ATF_PERM: ::c_int = 0x04; pub const ATF_PUBL: ::c_int = 0x08; pub const ATF_USETRAILERS: ::c_int = 0x10; +extern "C" { + pub static in6addr_loopback: in6_addr; + pub static in6addr_any: in6_addr; +} + cfg_if! { if #[cfg(any(target_os = "l4re", target_os = "espidf"))] { // required libraries for L4Re and the ESP-IDF framework are linked externally, ATM @@ -369,6 +381,7 @@ cfg_if! { target_os = "ios", target_os = "tvos", target_os = "watchos", + target_os = "visionos", target_os = "android", target_os = "openbsd", target_os = "nto", @@ -395,7 +408,7 @@ cfg_if! { #[cfg_attr(feature = "rustc-dep-of-std", link(name = "c", cfg(not(target_feature = "crt-static"))))] extern {} - } else if #[cfg(target_env = "aix")] { + } else if #[cfg(target_os = "aix")] { #[link(name = "c")] #[link(name = "m")] #[link(name = "bsd")] @@ -590,7 +603,10 @@ extern "C" { #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] #[cfg_attr(target_os = "netbsd", link_name = "__socket30")] - #[cfg_attr(target_os = "illumos", link_name = "__xnet_socket")] + #[cfg_attr( + any(target_os = "illumos", target_os = "solaris"), + link_name = "__xnet_socket" + )] #[cfg_attr(target_os = "espidf", link_name = "lwip_socket")] pub fn socket(domain: ::c_int, ty: ::c_int, protocol: ::c_int) -> ::c_int; #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] @@ -598,7 +614,10 @@ extern "C" { all(target_os = "macos", target_arch = "x86"), link_name = "connect$UNIX2003" )] - #[cfg_attr(target_os = "illumos", link_name = "__xnet_connect")] + #[cfg_attr( + any(target_os = "illumos", target_os = "solaris"), + link_name = "__xnet_connect" + )] #[cfg_attr(target_os = "espidf", link_name = "lwip_connect")] pub fn connect(socket: ::c_int, address: *const sockaddr, len: socklen_t) -> ::c_int; #[cfg_attr( @@ -648,7 +667,10 @@ extern "C" { all(target_os = "macos", target_arch = "x86"), link_name = "socketpair$UNIX2003" )] - #[cfg_attr(target_os = "illumos", link_name = "__xnet_socketpair")] + #[cfg_attr( + any(target_os = "illumos", target_os = "solaris"), + link_name = "__xnet_socketpair" + )] pub fn socketpair( domain: ::c_int, type_: ::c_int, @@ -660,7 +682,10 @@ extern "C" { all(target_os = "macos", target_arch = "x86"), link_name = "sendto$UNIX2003" )] - #[cfg_attr(target_os = "illumos", link_name = "__xnet_sendto")] + #[cfg_attr( + any(target_os = "illumos", target_os = "solaris"), + link_name = "__xnet_sendto" + )] #[cfg_attr(target_os = "espidf", link_name = "lwip_sendto")] pub fn sendto( socket: ::c_int, @@ -840,13 +865,13 @@ extern "C" { pub fn execl(path: *const c_char, arg0: *const c_char, ...) -> ::c_int; pub fn execle(path: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int; pub fn execlp(file: *const ::c_char, arg0: *const ::c_char, ...) -> ::c_int; - pub fn execv(prog: *const c_char, argv: *const *const c_char) -> ::c_int; + pub fn execv(prog: *const c_char, argv: *const *mut c_char) -> ::c_int; pub fn execve( prog: *const c_char, - argv: *const *const c_char, - envp: *const *const c_char, + argv: *const *mut c_char, + envp: *const *mut c_char, ) -> ::c_int; - pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int; + pub fn execvp(c: *const c_char, argv: *const *mut c_char) -> ::c_int; pub fn fork() -> pid_t; pub fn fpathconf(filedes: ::c_int, name: ::c_int) -> c_long; pub fn getcwd(buf: *mut c_char, size: ::size_t) -> *mut c_char; @@ -872,6 +897,7 @@ extern "C" { pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long; pub fn pipe(fds: *mut ::c_int) -> ::c_int; pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int; + pub fn aligned_alloc(alignment: ::size_t, size: ::size_t) -> *mut ::c_void; #[cfg_attr( all(target_os = "macos", target_arch = "x86"), link_name = "read$UNIX2003" @@ -1018,7 +1044,8 @@ extern "C" { target_os = "macos", target_os = "ios", target_os = "tvos", - target_os = "watchos" + target_os = "watchos", + target_os = "visionos" ), link_name = "realpath$DARWIN_EXTSN" )] @@ -1030,6 +1057,7 @@ extern "C" { pub fn times(buf: *mut ::tms) -> ::clock_t; pub fn pthread_self() -> ::pthread_t; + pub fn pthread_equal(t1: ::pthread_t, t2: ::pthread_t) -> ::c_int; #[cfg_attr( all(target_os = "macos", target_arch = "x86"), link_name = "pthread_join$UNIX2003" @@ -1137,7 +1165,10 @@ extern "C" { pub fn pthread_rwlockattr_init(attr: *mut pthread_rwlockattr_t) -> ::c_int; pub fn pthread_rwlockattr_destroy(attr: *mut pthread_rwlockattr_t) -> ::c_int; - #[cfg_attr(target_os = "illumos", link_name = "__xnet_getsockopt")] + #[cfg_attr( + any(target_os = "illumos", target_os = "solaris"), + link_name = "__xnet_getsockopt" + )] #[cfg_attr(target_os = "espidf", link_name = "lwip_getsockopt")] pub fn getsockopt( sockfd: ::c_int, @@ -1156,7 +1187,10 @@ extern "C" { pub fn dlclose(handle: *mut ::c_void) -> ::c_int; #[cfg(not(all(target_arch = "powerpc", target_vendor = "nintendo")))] - #[cfg_attr(target_os = "illumos", link_name = "__xnet_getaddrinfo")] + #[cfg_attr( + any(target_os = "illumos", target_os = "solaris"), + link_name = "__xnet_getaddrinfo" + )] #[cfg_attr(target_os = "espidf", link_name = "lwip_getaddrinfo")] pub fn getaddrinfo( node: *const c_char, @@ -1186,7 +1220,8 @@ extern "C" { target_os = "macos", target_os = "ios", target_os = "tvos", - target_os = "watchos" + target_os = "watchos", + target_os = "visionos" ), link_name = "res_9_init" )] @@ -1367,6 +1402,23 @@ extern "C" { } +safe_f! { + // It seems htonl, etc are macros on macOS. So we have to reimplement them. So let's + // reimplement them for all UNIX platforms + pub {const} fn htonl(hostlong: u32) -> u32 { + u32::to_be(hostlong) + } + pub {const} fn htons(hostshort: u16) -> u16 { + u16::to_be(hostshort) + } + pub {const} fn ntohl(netlong: u32) -> u32 { + u32::from_be(netlong) + } + pub {const} fn ntohs(netshort: u16) -> u16 { + u16::from_be(netshort) + } +} + cfg_if! { if #[cfg(not(any(target_os = "emscripten", target_os = "android", @@ -1374,6 +1426,15 @@ cfg_if! { target_os = "nto")))] { extern "C" { pub fn adjtime(delta: *const timeval, olddelta: *mut timeval) -> ::c_int; + } + } +} + +cfg_if! { + if #[cfg(not(any(target_os = "emscripten", + target_os = "android", + target_os = "nto")))] { + extern "C" { pub fn stpncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char; } } @@ -1523,6 +1584,7 @@ cfg_if! { target_os = "ios", target_os = "tvos", target_os = "watchos", + target_os = "visionos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", diff --git a/src/unix/newlib/espidf/mod.rs b/src/unix/newlib/espidf/mod.rs index 409d7ad9bd784..e2e98ee9c394a 100644 --- a/src/unix/newlib/espidf/mod.rs +++ b/src/unix/newlib/espidf/mod.rs @@ -89,6 +89,16 @@ pub const MSG_EOR: ::c_int = 0x08; pub const PTHREAD_STACK_MIN: ::size_t = 768; +pub const SIGABRT: ::size_t = 1; +pub const SIGFPE: ::size_t = 1; +pub const SIGILL: ::size_t = 1; +pub const SIGINT: ::size_t = 1; +pub const SIGSEGV: ::size_t = 1; +pub const SIGTERM: ::size_t = 1; +pub const SIGHUP: ::size_t = 1; +pub const SIGQUIT: ::size_t = 1; +pub const NSIG: ::size_t = 2; + extern "C" { pub fn pthread_create( native: *mut ::pthread_t, diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index ed787e01868d4..45a2668aac71a 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -420,27 +420,27 @@ pub const FIOCLEX: ::c_ulong = 0x20006601; pub const FIONCLEX: ::c_ulong = 0x20006602; pub const S_BLKSIZE: ::mode_t = 1024; -pub const S_IREAD: ::mode_t = 256; -pub const S_IWRITE: ::mode_t = 128; -pub const S_IEXEC: ::mode_t = 64; -pub const S_ENFMT: ::mode_t = 1024; -pub const S_IFMT: ::mode_t = 61440; -pub const S_IFDIR: ::mode_t = 16384; -pub const S_IFCHR: ::mode_t = 8192; -pub const S_IFBLK: ::mode_t = 24576; -pub const S_IFREG: ::mode_t = 32768; -pub const S_IFLNK: ::mode_t = 40960; -pub const S_IFSOCK: ::mode_t = 49152; -pub const S_IFIFO: ::mode_t = 4096; -pub const S_IRUSR: ::mode_t = 256; -pub const S_IWUSR: ::mode_t = 128; -pub const S_IXUSR: ::mode_t = 64; -pub const S_IRGRP: ::mode_t = 32; -pub const S_IWGRP: ::mode_t = 16; -pub const S_IXGRP: ::mode_t = 8; -pub const S_IROTH: ::mode_t = 4; -pub const S_IWOTH: ::mode_t = 2; -pub const S_IXOTH: ::mode_t = 1; +pub const S_IREAD: ::mode_t = 0o0400; +pub const S_IWRITE: ::mode_t = 0o0200; +pub const S_IEXEC: ::mode_t = 0o0100; +pub const S_ENFMT: ::mode_t = 0o2000; +pub const S_IFMT: ::mode_t = 0o17_0000; +pub const S_IFDIR: ::mode_t = 0o4_0000; +pub const S_IFCHR: ::mode_t = 0o2_0000; +pub const S_IFBLK: ::mode_t = 0o6_0000; +pub const S_IFREG: ::mode_t = 0o10_0000; +pub const S_IFLNK: ::mode_t = 0o12_0000; +pub const S_IFSOCK: ::mode_t = 0o14_0000; +pub const S_IFIFO: ::mode_t = 0o1_0000; +pub const S_IRUSR: ::mode_t = 0o0400; +pub const S_IWUSR: ::mode_t = 0o0200; +pub const S_IXUSR: ::mode_t = 0o0100; +pub const S_IRGRP: ::mode_t = 0o0040; +pub const S_IWGRP: ::mode_t = 0o0020; +pub const S_IXGRP: ::mode_t = 0o0010; +pub const S_IROTH: ::mode_t = 0o0004; +pub const S_IWOTH: ::mode_t = 0o0002; +pub const S_IXOTH: ::mode_t = 0o0001; pub const SOL_TCP: ::c_int = 6; @@ -689,11 +689,7 @@ extern "C" { flags: ::c_int, ) -> ::c_int; pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; - pub fn fexecve( - fd: ::c_int, - argv: *const *const ::c_char, - envp: *const *const ::c_char, - ) -> ::c_int; + pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int; pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::c_void) -> ::c_int; pub fn getgrgid_r( gid: ::gid_t, diff --git a/src/unix/newlib/vita/mod.rs b/src/unix/newlib/vita/mod.rs index e80f061ea0ce5..d4c6955f36153 100644 --- a/src/unix/newlib/vita/mod.rs +++ b/src/unix/newlib/vita/mod.rs @@ -94,6 +94,8 @@ pub const SOCK_RAW: ::c_int = 3; pub const SOCK_RDM: ::c_int = 4; pub const SOCK_SEQPACKET: ::c_int = 5; +pub const SOMAXCONN: ::c_int = 128; + pub const FIONBIO: ::c_ulong = 1; pub const POLLIN: ::c_short = 0x0001; diff --git a/src/unix/nto/mod.rs b/src/unix/nto/mod.rs index bfb5c2ee5716d..716a0eb00b5bf 100644 --- a/src/unix/nto/mod.rs +++ b/src/unix/nto/mod.rs @@ -1609,12 +1609,12 @@ pub const ITIMER_REAL: ::c_int = 0; pub const ITIMER_VIRTUAL: ::c_int = 1; pub const ITIMER_PROF: ::c_int = 2; -pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x00000010; -pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x00000001; -pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x00000004; -pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x00000002; -pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_int = 0x00000400; -pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x00000040; +pub const POSIX_SPAWN_RESETIDS: ::c_short = 0x0010; +pub const POSIX_SPAWN_SETPGROUP: ::c_short = 0x0001; +pub const POSIX_SPAWN_SETSIGDEF: ::c_short = 0x0004; +pub const POSIX_SPAWN_SETSIGMASK: ::c_short = 0x0002; +pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_short = 0x0400; +pub const POSIX_SPAWN_SETSCHEDULER: ::c_short = 0x0040; pub const IPTOS_ECN_NOT_ECT: u8 = 0x00; @@ -2037,27 +2037,27 @@ pub const S_IEXEC: mode_t = ::S_IXUSR; pub const S_IWRITE: mode_t = ::S_IWUSR; pub const S_IREAD: mode_t = ::S_IRUSR; -pub const S_IFIFO: ::mode_t = 0x1000; -pub const S_IFCHR: ::mode_t = 0x2000; -pub const S_IFDIR: ::mode_t = 0x4000; -pub const S_IFBLK: ::mode_t = 0x6000; -pub const S_IFREG: ::mode_t = 0x8000; -pub const S_IFLNK: ::mode_t = 0xA000; -pub const S_IFSOCK: ::mode_t = 0xC000; -pub const S_IFMT: ::mode_t = 0xF000; - -pub const S_IXOTH: ::mode_t = 0o000001; -pub const S_IWOTH: ::mode_t = 0o000002; -pub const S_IROTH: ::mode_t = 0o000004; -pub const S_IRWXO: ::mode_t = 0o000007; -pub const S_IXGRP: ::mode_t = 0o000010; -pub const S_IWGRP: ::mode_t = 0o000020; -pub const S_IRGRP: ::mode_t = 0o000040; -pub const S_IRWXG: ::mode_t = 0o000070; -pub const S_IXUSR: ::mode_t = 0o000100; -pub const S_IWUSR: ::mode_t = 0o000200; -pub const S_IRUSR: ::mode_t = 0o000400; -pub const S_IRWXU: ::mode_t = 0o000700; +pub const S_IFIFO: ::mode_t = 0o1_0000; +pub const S_IFCHR: ::mode_t = 0o2_0000; +pub const S_IFDIR: ::mode_t = 0o4_0000; +pub const S_IFBLK: ::mode_t = 0o6_0000; +pub const S_IFREG: ::mode_t = 0o10_0000; +pub const S_IFLNK: ::mode_t = 0o12_0000; +pub const S_IFSOCK: ::mode_t = 0o14_0000; +pub const S_IFMT: ::mode_t = 0o17_0000; + +pub const S_IXOTH: ::mode_t = 0o0001; +pub const S_IWOTH: ::mode_t = 0o0002; +pub const S_IROTH: ::mode_t = 0o0004; +pub const S_IRWXO: ::mode_t = 0o0007; +pub const S_IXGRP: ::mode_t = 0o0010; +pub const S_IWGRP: ::mode_t = 0o0020; +pub const S_IRGRP: ::mode_t = 0o0040; +pub const S_IRWXG: ::mode_t = 0o0070; +pub const S_IXUSR: ::mode_t = 0o0100; +pub const S_IWUSR: ::mode_t = 0o0200; +pub const S_IRUSR: ::mode_t = 0o0400; +pub const S_IRWXU: ::mode_t = 0o0700; pub const F_LOCK: ::c_int = 1; pub const F_TEST: ::c_int = 3; @@ -2672,6 +2672,7 @@ pub const VRIGHT: usize = 29; pub const VUP: usize = 30; pub const XCASE: tcflag_t = 0x00000004; +pub const PTHREAD_BARRIER_SERIAL_THREAD: ::c_int = -1; pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0x00; pub const PTHREAD_CREATE_DETACHED: ::c_int = 0x01; @@ -2864,9 +2865,9 @@ safe_f! { // Network related functions are provided by libsocket and regex // functions are provided by libregex. +// In QNX <=7.0, libregex functions were included in libc itself. #[link(name = "socket")] -#[link(name = "regex")] - +#[cfg_attr(not(target_env = "nto70"), link(name = "regex"))] extern "C" { pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int; @@ -2935,8 +2936,8 @@ extern "C" { ) -> ::pid_t; pub fn execvpe( file: *const ::c_char, - argv: *const *const ::c_char, - envp: *const *const ::c_char, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char, ) -> ::c_int; pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; @@ -3339,7 +3340,10 @@ extern "C" { pub fn dl_iterate_phdr( callback: ::Option< unsafe extern "C" fn( - info: *const dl_phdr_info, + // The original .h file declares this as *const, but for consistency with other platforms, + // changing this to *mut to make it easier to use. + // Maybe in v0.3 all platforms should use this as a *const. + info: *mut dl_phdr_info, size: ::size_t, data: *mut ::c_void, ) -> ::c_int, diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index e219695107d7b..bc6e2a8a93d4e 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -585,7 +585,13 @@ pub const IP_MULTICAST_TTL: ::c_int = 33; pub const IP_MULTICAST_LOOP: ::c_int = 34; pub const IP_ADD_MEMBERSHIP: ::c_int = 35; pub const IP_DROP_MEMBERSHIP: ::c_int = 36; +pub const IP_TOS: ::c_int = 1; +pub const IP_RECVTOS: ::c_int = 2; +pub const IPPROTO_IGMP: ::c_int = 2; +pub const IPPROTO_PUP: ::c_int = 12; +pub const IPPROTO_IDP: ::c_int = 22; pub const IPPROTO_RAW: ::c_int = 255; +pub const IPPROTO_MAX: ::c_int = 255; // } // netinet/tcp.h @@ -695,26 +701,26 @@ pub const EPOLLONESHOT: ::c_int = 0; pub const EPOLLET: ::c_int = 0; // sys/stat.h -pub const S_IFMT: ::c_int = 0o0_170_000; -pub const S_IFDIR: ::c_int = 0o040_000; -pub const S_IFCHR: ::c_int = 0o020_000; -pub const S_IFBLK: ::c_int = 0o060_000; -pub const S_IFREG: ::c_int = 0o100_000; -pub const S_IFIFO: ::c_int = 0o010_000; -pub const S_IFLNK: ::c_int = 0o120_000; -pub const S_IFSOCK: ::c_int = 0o140_000; -pub const S_IRWXU: ::c_int = 0o0_700; -pub const S_IRUSR: ::c_int = 0o0_400; -pub const S_IWUSR: ::c_int = 0o0_200; -pub const S_IXUSR: ::c_int = 0o0_100; -pub const S_IRWXG: ::c_int = 0o0_070; -pub const S_IRGRP: ::c_int = 0o0_040; -pub const S_IWGRP: ::c_int = 0o0_020; -pub const S_IXGRP: ::c_int = 0o0_010; -pub const S_IRWXO: ::c_int = 0o0_007; -pub const S_IROTH: ::c_int = 0o0_004; -pub const S_IWOTH: ::c_int = 0o0_002; -pub const S_IXOTH: ::c_int = 0o0_001; +pub const S_IFMT: ::c_int = 0o17_0000; +pub const S_IFDIR: ::c_int = 0o4_0000; +pub const S_IFCHR: ::c_int = 0o2_0000; +pub const S_IFBLK: ::c_int = 0o6_0000; +pub const S_IFREG: ::c_int = 0o10_0000; +pub const S_IFIFO: ::c_int = 0o1_0000; +pub const S_IFLNK: ::c_int = 0o12_0000; +pub const S_IFSOCK: ::c_int = 0o14_0000; +pub const S_IRWXU: ::c_int = 0o0700; +pub const S_IRUSR: ::c_int = 0o0400; +pub const S_IWUSR: ::c_int = 0o0200; +pub const S_IXUSR: ::c_int = 0o0100; +pub const S_IRWXG: ::c_int = 0o0070; +pub const S_IRGRP: ::c_int = 0o0040; +pub const S_IWGRP: ::c_int = 0o0020; +pub const S_IXGRP: ::c_int = 0o0010; +pub const S_IRWXO: ::c_int = 0o0007; +pub const S_IROTH: ::c_int = 0o0004; +pub const S_IWOTH: ::c_int = 0o0002; +pub const S_IXOTH: ::c_int = 0o0001; // stdlib.h pub const EXIT_SUCCESS: ::c_int = 0; @@ -810,6 +816,7 @@ pub const SO_PROTOCOL: ::c_int = 38; pub const SO_DOMAIN: ::c_int = 39; pub const SOCK_STREAM: ::c_int = 1; pub const SOCK_DGRAM: ::c_int = 2; +pub const SOCK_RAW: ::c_int = 3; pub const SOCK_NONBLOCK: ::c_int = 0o4_000; pub const SOCK_CLOEXEC: ::c_int = 0o2_000_000; pub const SOCK_SEQPACKET: ::c_int = 5; diff --git a/src/unix/solarish/illumos.rs b/src/unix/solarish/illumos.rs index 404f013da2f98..ef3862ee41b34 100644 --- a/src/unix/solarish/illumos.rs +++ b/src/unix/solarish/illumos.rs @@ -81,6 +81,21 @@ extern "C" { ) -> ::c_int; pub fn pset_getloadavg(pset: ::psetid_t, load: *mut ::c_double, num: ::c_int) -> ::c_int; + pub fn pthread_attr_get_np(thread: ::pthread_t, attr: *mut ::pthread_attr_t) -> ::c_int; + pub fn pthread_attr_getstackaddr( + attr: *const ::pthread_attr_t, + stackaddr: *mut *mut ::c_void, + ) -> ::c_int; + pub fn pthread_attr_setstack( + attr: *mut ::pthread_attr_t, + stackaddr: *mut ::c_void, + stacksize: ::size_t, + ) -> ::c_int; + pub fn pthread_attr_setstackaddr( + attr: *mut ::pthread_attr_t, + stackaddr: *mut ::c_void, + ) -> ::c_int; + pub fn preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t; pub fn pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t; diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index d710c7f60b1bb..27f3bf920c116 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -120,6 +120,17 @@ s! { pub __sin6_src_id: u32 } + pub struct in_pktinfo { + pub ipi_ifindex: ::c_uint, + pub ipi_spec_dst: ::in_addr, + pub ipi_addr: ::in_addr, + } + + pub struct in6_pktinfo { + pub ipi6_addr: ::in6_addr, + pub ipi6_ifindex: ::c_uint, + } + pub struct passwd { pub pw_name: *mut ::c_char, pub pw_passwd: *mut ::c_char, @@ -135,7 +146,7 @@ s! { pub struct ifaddrs { pub ifa_next: *mut ifaddrs, pub ifa_name: *mut ::c_char, - pub ifa_flags: ::c_ulong, + pub ifa_flags: u64, pub ifa_addr: *mut ::sockaddr, pub ifa_netmask: *mut ::sockaddr, pub ifa_dstaddr: *mut ::sockaddr, @@ -1224,14 +1235,20 @@ pub const CLD_STOPPED: ::c_int = 5; pub const CLD_CONTINUED: ::c_int = 6; pub const IP_RECVDSTADDR: ::c_int = 0x7; +pub const IP_PKTINFO: ::c_int = 0x1a; +pub const IP_DONTFRAG: ::c_int = 0x1b; pub const IP_SEC_OPT: ::c_int = 0x22; pub const IPV6_UNICAST_HOPS: ::c_int = 0x5; pub const IPV6_MULTICAST_IF: ::c_int = 0x6; pub const IPV6_MULTICAST_HOPS: ::c_int = 0x7; pub const IPV6_MULTICAST_LOOP: ::c_int = 0x8; +pub const IPV6_PKTINFO: ::c_int = 0xb; pub const IPV6_RECVPKTINFO: ::c_int = 0x12; +pub const IPV6_RECVTCLASS: ::c_int = 0x19; +pub const IPV6_DONTFRAG: ::c_int = 0x21; pub const IPV6_SEC_OPT: ::c_int = 0x22; +pub const IPV6_TCLASS: ::c_int = 0x26; pub const IPV6_V6ONLY: ::c_int = 0x27; cfg_if! { @@ -1265,6 +1282,7 @@ pub const FOPEN_MAX: ::c_uint = 20; pub const FILENAME_MAX: ::c_uint = 1024; pub const L_tmpnam: ::c_uint = 25; pub const TMP_MAX: ::c_uint = 17576; +pub const PIPE_BUF: ::c_int = 5120; pub const GRND_NONBLOCK: ::c_uint = 0x0001; pub const GRND_RANDOM: ::c_uint = 0x0002; @@ -1287,29 +1305,29 @@ pub const O_ACCMODE: ::c_int = 0x600003; pub const O_XATTR: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x1000000; pub const O_DIRECT: ::c_int = 0x2000000; -pub const S_IFIFO: mode_t = 4096; -pub const S_IFCHR: mode_t = 8192; -pub const S_IFBLK: mode_t = 24576; -pub const S_IFDIR: mode_t = 16384; -pub const S_IFREG: mode_t = 32768; -pub const S_IFLNK: mode_t = 40960; -pub const S_IFSOCK: mode_t = 49152; -pub const S_IFMT: mode_t = 61440; -pub const S_IEXEC: mode_t = 64; -pub const S_IWRITE: mode_t = 128; -pub const S_IREAD: mode_t = 256; -pub const S_IRWXU: mode_t = 448; -pub const S_IXUSR: mode_t = 64; -pub const S_IWUSR: mode_t = 128; -pub const S_IRUSR: mode_t = 256; -pub const S_IRWXG: mode_t = 56; -pub const S_IXGRP: mode_t = 8; -pub const S_IWGRP: mode_t = 16; -pub const S_IRGRP: mode_t = 32; -pub const S_IRWXO: mode_t = 7; -pub const S_IXOTH: mode_t = 1; -pub const S_IWOTH: mode_t = 2; -pub const S_IROTH: mode_t = 4; +pub const S_IFIFO: mode_t = 0o1_0000; +pub const S_IFCHR: mode_t = 0o2_0000; +pub const S_IFBLK: mode_t = 0o6_0000; +pub const S_IFDIR: mode_t = 0o4_0000; +pub const S_IFREG: mode_t = 0o10_0000; +pub const S_IFLNK: mode_t = 0o12_0000; +pub const S_IFSOCK: mode_t = 0o14_0000; +pub const S_IFMT: mode_t = 0o17_0000; +pub const S_IEXEC: mode_t = 0o0100; +pub const S_IWRITE: mode_t = 0o0200; +pub const S_IREAD: mode_t = 0o0400; +pub const S_IRWXU: mode_t = 0o0700; +pub const S_IXUSR: mode_t = 0o0100; +pub const S_IWUSR: mode_t = 0o0200; +pub const S_IRUSR: mode_t = 0o0400; +pub const S_IRWXG: mode_t = 0o0070; +pub const S_IXGRP: mode_t = 0o0010; +pub const S_IWGRP: mode_t = 0o0020; +pub const S_IRGRP: mode_t = 0o0040; +pub const S_IRWXO: mode_t = 0o0007; +pub const S_IXOTH: mode_t = 0o0001; +pub const S_IWOTH: mode_t = 0o0002; +pub const S_IROTH: mode_t = 0o0004; pub const F_OK: ::c_int = 0; pub const R_OK: ::c_int = 4; pub const W_OK: ::c_int = 2; @@ -1760,8 +1778,9 @@ pub const SOCK_SEQPACKET: ::c_int = 6; pub const IP_MULTICAST_IF: ::c_int = 16; pub const IP_MULTICAST_TTL: ::c_int = 17; pub const IP_MULTICAST_LOOP: ::c_int = 18; -pub const IP_TTL: ::c_int = 4; pub const IP_HDRINCL: ::c_int = 2; +pub const IP_TOS: ::c_int = 3; +pub const IP_TTL: ::c_int = 4; pub const IP_ADD_MEMBERSHIP: ::c_int = 19; pub const IP_DROP_MEMBERSHIP: ::c_int = 20; pub const IPV6_JOIN_GROUP: ::c_int = 9; @@ -1815,6 +1834,7 @@ pub const SO_TYPE: ::c_int = 0x1008; pub const SO_PROTOTYPE: ::c_int = 0x1009; pub const SO_DOMAIN: ::c_int = 0x100c; pub const SO_TIMESTAMP: ::c_int = 0x1013; +pub const SO_EXCLBIND: ::c_int = 0x1015; pub const SCM_RIGHTS: ::c_int = 0x1010; pub const SCM_UCRED: ::c_int = 0x1012; @@ -2853,15 +2873,15 @@ extern "C" { ) -> ::c_int; pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; - #[cfg_attr(target_os = "illumos", link_name = "__xnet_bind")] + #[link_name = "__xnet_bind"] pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int; pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t; pub fn readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t; - #[cfg_attr(target_os = "illumos", link_name = "__xnet_sendmsg")] + #[link_name = "__xnet_sendmsg"] pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t; - #[cfg_attr(target_os = "illumos", link_name = "__xnet_recvmsg")] + #[link_name = "__xnet_recvmsg"] pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; pub fn accept4( fd: ::c_int, diff --git a/src/unix/solarish/solaris.rs b/src/unix/solarish/solaris.rs index 80bad281ea705..5ab67884f6a68 100644 --- a/src/unix/solarish/solaris.rs +++ b/src/unix/solarish/solaris.rs @@ -66,11 +66,7 @@ pub const F_DUP2FD_CLOEXEC: ::c_int = 48; pub const F_DUP2FD_CLOFORK: ::c_int = 50; extern "C" { - pub fn fexecve( - fd: ::c_int, - argv: *const *const ::c_char, - envp: *const *const ::c_char, - ) -> ::c_int; + pub fn fexecve(fd: ::c_int, argv: *const *mut ::c_char, envp: *const *mut ::c_char) -> ::c_int; pub fn mincore(addr: *const ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int; diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index 23637b6998a77..fc2aa5e51ae4c 100644 --- a/src/vxworks/mod.rs +++ b/src/vxworks/mod.rs @@ -91,6 +91,7 @@ pub type SEM_ID_KERNEL = ::OBJ_HANDLE; pub type RTP_ID = ::OBJ_HANDLE; pub type SD_ID = ::OBJ_HANDLE; pub type CONDVAR_ID = ::OBJ_HANDLE; +pub type STATUS = ::OBJ_HANDLE; // From vxTypes.h pub type _Vx_usr_arg_t = isize; @@ -613,6 +614,7 @@ pub const PTHREAD_STACK_MIN: usize = 4096; pub const _PTHREAD_SHARED_SEM_NAME_MAX: usize = 30; // ERRNO STUFF +pub const ERROR: ::c_int = -1; pub const OK: ::c_int = 0; pub const EPERM: ::c_int = 1; /* Not owner */ pub const ENOENT: ::c_int = 2; /* No such file or directory */ @@ -720,6 +722,33 @@ pub const S_nfsLib_NFSERR_SERVERFAULT: ::c_int = EIO; pub const S_nfsLib_NFSERR_BADTYPE: ::c_int = M_nfsStat | nfsstat::NFSERR_BADTYPE as ::c_int; pub const S_nfsLib_NFSERR_JUKEBOX: ::c_int = M_nfsStat | nfsstat::NFSERR_JUKEBOX as ::c_int; +// internal offset values for below constants +const taskErrorBase: ::c_int = 0x00030000; +const semErrorBase: ::c_int = 0x00160000; +const objErrorBase: ::c_int = 0x003d0000; + +// taskLibCommon.h +pub const S_taskLib_NAME_NOT_FOUND: ::c_int = taskErrorBase + 0x0065; +pub const S_taskLib_TASK_HOOK_TABLE_FULL: ::c_int = taskErrorBase + 0x0066; +pub const S_taskLib_TASK_HOOK_NOT_FOUND: ::c_int = taskErrorBase + 0x0067; +pub const S_taskLib_ILLEGAL_PRIORITY: ::c_int = taskErrorBase + 0x0068; + +// FIXME: could also be useful for TASK_DESC type +pub const VX_TASK_NAME_LENGTH: ::c_int = 31; + +// semLibCommon.h +pub const S_semLib_INVALID_STATE: ::c_int = semErrorBase + 0x0065; +pub const S_semLib_INVALID_OPTION: ::c_int = semErrorBase + 0x0066; +pub const S_semLib_INVALID_QUEUE_TYPE: ::c_int = semErrorBase + 0x0067; +pub const S_semLib_INVALID_OPERATION: ::c_int = semErrorBase + 0x0068; + +// objLibCommon.h +pub const S_objLib_OBJ_ID_ERROR: ::c_int = objErrorBase + 0x0001; +pub const S_objLib_OBJ_UNAVAILABLE: ::c_int = objErrorBase + 0x0002; +pub const S_objLib_OBJ_DELETED: ::c_int = objErrorBase + 0x0003; +pub const S_objLib_OBJ_TIMEOUT: ::c_int = objErrorBase + 0x0004; +pub const S_objLib_OBJ_NO_METHOD: ::c_int = objErrorBase + 0x0005; + // in.h pub const IPPROTO_IP: ::c_int = 0; pub const IPPROTO_IPV6: ::c_int = 41; @@ -741,33 +770,35 @@ pub const IPV6_ADD_MEMBERSHIP: ::c_int = 12; pub const IPV6_DROP_MEMBERSHIP: ::c_int = 13; // STAT Stuff -pub const S_IFMT: ::c_int = 0xf000; -pub const S_IFIFO: ::c_int = 0x1000; -pub const S_IFCHR: ::c_int = 0x2000; -pub const S_IFDIR: ::c_int = 0x4000; -pub const S_IFBLK: ::c_int = 0x6000; -pub const S_IFREG: ::c_int = 0x8000; -pub const S_IFLNK: ::c_int = 0xa000; -pub const S_IFSHM: ::c_int = 0xb000; -pub const S_IFSOCK: ::c_int = 0xc000; -pub const S_ISUID: ::c_int = 0x0800; -pub const S_ISGID: ::c_int = 0x0400; -pub const S_ISTXT: ::c_int = 0x0200; -pub const S_IRUSR: ::c_int = 0x0100; -pub const S_IWUSR: ::c_int = 0x0080; -pub const S_IXUSR: ::c_int = 0x0040; -pub const S_IRWXU: ::c_int = 0x01c0; -pub const S_IRGRP: ::c_int = 0x0020; -pub const S_IWGRP: ::c_int = 0x0010; -pub const S_IXGRP: ::c_int = 0x0008; -pub const S_IRWXG: ::c_int = 0x0038; -pub const S_IROTH: ::c_int = 0x0004; -pub const S_IWOTH: ::c_int = 0x0002; -pub const S_IXOTH: ::c_int = 0x0001; -pub const S_IRWXO: ::c_int = 0x0007; +pub const S_IFMT: ::c_int = 0o17_0000; +pub const S_IFIFO: ::c_int = 0o1_0000; +pub const S_IFCHR: ::c_int = 0o2_0000; +pub const S_IFDIR: ::c_int = 0o4_0000; +pub const S_IFBLK: ::c_int = 0o6_0000; +pub const S_IFREG: ::c_int = 0o10_0000; +pub const S_IFLNK: ::c_int = 0o12_0000; +pub const S_IFSHM: ::c_int = 0o13_0000; +pub const S_IFSOCK: ::c_int = 0o14_0000; +pub const S_ISUID: ::c_int = 0o4000; +pub const S_ISGID: ::c_int = 0o2000; +pub const S_ISTXT: ::c_int = 0o1000; +pub const S_ISVTX: mode_t = 0o1000; +pub const S_IRUSR: ::c_int = 0o0400; +pub const S_IWUSR: ::c_int = 0o0200; +pub const S_IXUSR: ::c_int = 0o0100; +pub const S_IRWXU: ::c_int = 0o0700; +pub const S_IRGRP: ::c_int = 0o0040; +pub const S_IWGRP: ::c_int = 0o0020; +pub const S_IXGRP: ::c_int = 0o0010; +pub const S_IRWXG: ::c_int = 0o0070; +pub const S_IROTH: ::c_int = 0o0004; +pub const S_IWOTH: ::c_int = 0o0002; +pub const S_IXOTH: ::c_int = 0o0001; +pub const S_IRWXO: ::c_int = 0o0007; // socket.h pub const SOL_SOCKET: ::c_int = 0xffff; +pub const SOMAXCONN: ::c_int = 128; pub const SO_DEBUG: ::c_int = 0x0001; pub const SO_REUSEADDR: ::c_int = 0x0004; @@ -1782,6 +1813,10 @@ extern "C" { pub fn taskIdSelf() -> ::TASK_ID; pub fn taskDelay(ticks: ::_Vx_ticks_t) -> ::c_int; + // taskLib.h + pub fn taskNameSet(task_id: ::TASK_ID, task_name: *mut ::c_char) -> ::c_int; + pub fn taskNameGet(task_id: ::TASK_ID, buf_name: *mut ::c_char, bufsize: ::size_t) -> ::c_int; + // rtpLibCommon.h pub fn rtpInfoGet(rtpId: ::RTP_ID, rtpStruct: *mut ::RTP_DESC) -> ::c_int; pub fn rtpSpawn( @@ -1841,6 +1876,10 @@ extern "C" { ) -> ::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; + + // vxCpuLib.h + fn vxCpuEnabledGet() -> ::cpuset_t; // Get set of running CPU's in the system + fn vxCpuConfiguredGet() -> ::cpuset_t; // Get set of Configured CPU's in the system } //Dummy functions, these don't really exist in VxWorks. @@ -1867,11 +1906,16 @@ safe_f! { } } -pub fn pread(_fd: ::c_int, _buf: *mut ::c_void, _count: ::size_t, _offset: off64_t) -> ::ssize_t { +pub unsafe fn pread( + _fd: ::c_int, + _buf: *mut ::c_void, + _count: ::size_t, + _offset: off64_t, +) -> ::ssize_t { -1 } -pub fn pwrite( +pub unsafe fn pwrite( _fd: ::c_int, _buf: *const ::c_void, _count: ::size_t, @@ -1879,7 +1923,12 @@ pub fn pwrite( ) -> ::ssize_t { -1 } -pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int { + +pub unsafe fn posix_memalign( + memptr: *mut *mut ::c_void, + align: ::size_t, + size: ::size_t, +) -> ::c_int { // check to see if align is a power of 2 and if align is a multiple // of sizeof(void *) if (align & align - 1 != 0) || (align as usize % size_of::<::size_t>() != 0) { diff --git a/src/wasi.rs b/src/wasi.rs index 39d6949146405..4e894d2d1f403 100644 --- a/src/wasi.rs +++ b/src/wasi.rs @@ -1,4 +1,8 @@ +// [wasi-libc](https://github.com/WebAssembly/wasi-libc) definitions. +// `wasi-libc` project provides multiple libraries including emulated features, but we list only basic features with `libc.a` here. + use super::{Send, Sync}; +use core::iter::Iterator; pub use ffi::c_void; @@ -175,6 +179,11 @@ s! { pub st_ctim: timespec, __reserved: [c_longlong; 3], } + + pub struct fd_set { + __nfds: usize, + __fds: [c_int; FD_SETSIZE as usize], + } } // Declare dirent outside of s! so that it doesn't implement Copy, Eq, Hash, @@ -239,29 +248,29 @@ pub const AT_SYMLINK_FOLLOW: c_int = 0x2; pub const AT_REMOVEDIR: c_int = 0x4; pub const UTIME_OMIT: c_long = 0xfffffffe; pub const UTIME_NOW: c_long = 0xffffffff; -pub const S_IFIFO: mode_t = 49152; -pub const S_IFCHR: mode_t = 8192; -pub const S_IFBLK: mode_t = 24576; -pub const S_IFDIR: mode_t = 16384; -pub const S_IFREG: mode_t = 32768; -pub const S_IFLNK: mode_t = 40960; -pub const S_IFSOCK: mode_t = 49152; -pub const S_IFMT: mode_t = 57344; -pub const S_IRWXO: mode_t = 0x7; -pub const S_IXOTH: mode_t = 0x1; -pub const S_IWOTH: mode_t = 0x2; -pub const S_IROTH: mode_t = 0x4; -pub const S_IRWXG: mode_t = 0x38; -pub const S_IXGRP: mode_t = 0x8; -pub const S_IWGRP: mode_t = 0x10; -pub const S_IRGRP: mode_t = 0x20; -pub const S_IRWXU: mode_t = 0x1c0; -pub const S_IXUSR: mode_t = 0x40; -pub const S_IWUSR: mode_t = 0x80; -pub const S_IRUSR: mode_t = 0x100; -pub const S_ISVTX: mode_t = 0x200; -pub const S_ISGID: mode_t = 0x400; -pub const S_ISUID: mode_t = 0x800; +pub const S_IFIFO: mode_t = 0o1_0000; +pub const S_IFCHR: mode_t = 0o2_0000; +pub const S_IFBLK: mode_t = 0o6_0000; +pub const S_IFDIR: mode_t = 0o4_0000; +pub const S_IFREG: mode_t = 0o10_0000; +pub const S_IFLNK: mode_t = 0o12_0000; +pub const S_IFSOCK: mode_t = 0o14_0000; +pub const S_IFMT: mode_t = 0o17_0000; +pub const S_IRWXO: mode_t = 0o0007; +pub const S_IXOTH: mode_t = 0o0001; +pub const S_IWOTH: mode_t = 0o0002; +pub const S_IROTH: mode_t = 0o0004; +pub const S_IRWXG: mode_t = 0o0070; +pub const S_IXGRP: mode_t = 0o0010; +pub const S_IWGRP: mode_t = 0o0020; +pub const S_IRGRP: mode_t = 0o0040; +pub const S_IRWXU: mode_t = 0o0700; +pub const S_IXUSR: mode_t = 0o0100; +pub const S_IWUSR: mode_t = 0o0200; +pub const S_IRUSR: mode_t = 0o0400; +pub const S_ISVTX: mode_t = 0o1000; +pub const S_ISGID: mode_t = 0o2000; +pub const S_ISUID: mode_t = 0o4000; pub const DT_UNKNOWN: u8 = 0; pub const DT_BLK: u8 = 1; pub const DT_CHR: u8 = 2; @@ -366,12 +375,26 @@ pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE; pub const _SC_IOV_MAX: c_int = 60; pub const _SC_SYMLOOP_MAX: c_int = 173; -pub static CLOCK_MONOTONIC: clockid_t = unsafe { clockid_t(ptr_addr_of!(_CLOCK_MONOTONIC)) }; -pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t = - unsafe { clockid_t(ptr_addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) }; -pub static CLOCK_REALTIME: clockid_t = unsafe { clockid_t(ptr_addr_of!(_CLOCK_REALTIME)) }; -pub static CLOCK_THREAD_CPUTIME_ID: clockid_t = - unsafe { clockid_t(ptr_addr_of!(_CLOCK_THREAD_CPUTIME_ID)) }; +cfg_if! { + if #[cfg(libc_ctest)] { + // skip these constants when this is active because `ctest` currently + // panics on parsing the constants below + } else { + // unsafe code here is required in the stable, but not in nightly + #[allow(unused_unsafe)] + pub static CLOCK_MONOTONIC: clockid_t = + unsafe { clockid_t(ptr_addr_of!(_CLOCK_MONOTONIC)) }; + #[allow(unused_unsafe)] + pub static CLOCK_PROCESS_CPUTIME_ID: clockid_t = + unsafe { clockid_t(ptr_addr_of!(_CLOCK_PROCESS_CPUTIME_ID)) }; + #[allow(unused_unsafe)] + pub static CLOCK_REALTIME: clockid_t = + unsafe { clockid_t(ptr_addr_of!(_CLOCK_REALTIME)) }; + #[allow(unused_unsafe)] + pub static CLOCK_THREAD_CPUTIME_ID: clockid_t = + unsafe { clockid_t(ptr_addr_of!(_CLOCK_THREAD_CPUTIME_ID)) }; + } +} pub const ABDAY_1: ::nl_item = 0x20000; pub const ABDAY_2: ::nl_item = 0x20001; @@ -438,6 +461,28 @@ pub const NOEXPR: ::nl_item = 0x50001; pub const YESSTR: ::nl_item = 0x50002; pub const NOSTR: ::nl_item = 0x50003; +f! { + pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool { + let set = &*set; + let n = set.__nfds; + return set.__fds[..n].iter().any(|p| *p == fd) + } + + pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () { + let set = &mut *set; + let n = set.__nfds; + if !set.__fds[..n].iter().any(|p| *p == fd) { + set.__nfds = n + 1; + set.__fds[n] = fd; + } + } + + pub fn FD_ZERO(set: *mut fd_set) -> () { + (*set).__nfds = 0; + return + } +} + #[cfg_attr( feature = "rustc-dep-of-std", link( @@ -733,6 +778,14 @@ extern "C" { pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; pub fn nl_langinfo_l(item: ::nl_item, loc: ::locale_t) -> *mut ::c_char; + pub fn select( + nfds: c_int, + readfds: *mut fd_set, + writefds: *mut fd_set, + errorfds: *mut fd_set, + timeout: *const timeval, + ) -> c_int; + pub fn __wasilibc_register_preopened_fd(fd: c_int, path: *const c_char) -> c_int; pub fn __wasilibc_fd_renumber(fd: c_int, newfd: c_int) -> c_int; pub fn __wasilibc_unlinkat(fd: c_int, path: *const c_char) -> c_int; diff --git a/src/windows/mod.rs b/src/windows/mod.rs index df4f8047e22ad..8fcdfbede0866 100644 --- a/src/windows/mod.rs +++ b/src/windows/mod.rs @@ -140,13 +140,13 @@ pub const _O_OBTAIN_DIR: ::c_int = 0x2000; pub const O_SEQUENTIAL: ::c_int = 0x0020; pub const O_RANDOM: ::c_int = 0x0010; -pub const S_IFCHR: ::c_int = 8192; -pub const S_IFDIR: ::c_int = 16384; -pub const S_IFREG: ::c_int = 32768; -pub const S_IFMT: ::c_int = 61440; -pub const S_IEXEC: ::c_int = 64; -pub const S_IWRITE: ::c_int = 128; -pub const S_IREAD: ::c_int = 256; +pub const S_IFCHR: ::c_int = 0o2_0000; +pub const S_IFDIR: ::c_int = 0o4_0000; +pub const S_IFREG: ::c_int = 0o10_0000; +pub const S_IFMT: ::c_int = 0o17_0000; +pub const S_IEXEC: ::c_int = 0o0100; +pub const S_IWRITE: ::c_int = 0o0200; +pub const S_IREAD: ::c_int = 0o0400; pub const LC_ALL: ::c_int = 0; pub const LC_COLLATE: ::c_int = 1; @@ -254,12 +254,6 @@ pub const SIG_GET: ::sighandler_t = 2; pub const SIG_SGE: ::sighandler_t = 3; pub const SIG_ACK: ::sighandler_t = 4; -// inline comment below appeases style checker -#[cfg(all(target_env = "msvc", feature = "rustc-dep-of-std"))] // " if " -#[link(name = "msvcrt", cfg(not(target_feature = "crt-static")))] -#[link(name = "libcmt", cfg(target_feature = "crt-static"))] -extern "C" {} - #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum FILE {} impl ::Copy for FILE {} @@ -460,15 +454,15 @@ extern "C" { prog: *const c_char, argv: *const *const c_char, envp: *const *const c_char, - ) -> ::c_int; + ) -> ::intptr_t; #[link_name = "_execvp"] - pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::c_int; + pub fn execvp(c: *const c_char, argv: *const *const c_char) -> ::intptr_t; #[link_name = "_execvpe"] pub fn execvpe( c: *const c_char, argv: *const *const c_char, envp: *const *const c_char, - ) -> ::c_int; + ) -> ::intptr_t; #[link_name = "_wexecv"] pub fn wexecv(prog: *const wchar_t, argv: *const *const wchar_t) -> ::intptr_t; #[link_name = "_wexecve"] @@ -518,6 +512,9 @@ extern "C" { pub fn aligned_malloc(size: size_t, alignment: size_t) -> *mut c_void; #[link_name = "_aligned_free"] pub fn aligned_free(ptr: *mut ::c_void); + #[link_name = "_aligned_realloc"] + pub fn aligned_realloc(memblock: *mut ::c_void, size: size_t, alignment: size_t) + -> *mut c_void; #[link_name = "_putenv"] pub fn putenv(envstring: *const ::c_char) -> ::c_int; #[link_name = "_wputenv"] diff --git a/triagebot.toml b/triagebot.toml index 8b989c8db5058..f11f0ae9c2316 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -1,6 +1,9 @@ [relabel] allow-unauthenticated = [ - "C-*", "O-*", "S-*" + "C-*", + "O-*", + "S-*", + "stable-nominated", ] [autolabel."S-waiting-on-review"] @@ -10,7 +13,10 @@ new_pr = true contributing_url = "https://github.com/rust-lang/libc/blob/HEAD/CONTRIBUTING.md" [assign.owners] -"*" = ["@JohnTitor"] +"*" = [ + "@JohnTitor", + "@tgross35", +] [mentions."src/unix/bsd/netbsdlike/openbsd"] message = "Some changes occurred in OpenBSD module"