diff --git a/.cirrus.yml b/.cirrus.yml index e428871c41b84..7ce3b932ba084 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,40 +1,19 @@ task: - name: nightly x86_64-unknown-freebsd-13 - freebsd_instance: - image_family: freebsd-13-2 + only_if: $CIRRUS_BRANCH == 'main' || $CIRRUS_BASE_BRANCH == 'libc-0.2' || $CIRRUS_BASE_BRANCH == 'main' + matrix: + - name: nightly freebsd-13 + freebsd_instance: + image_family: freebsd-13-3 + - name: nightly freebsd-14 + freebsd_instance: + image: freebsd-14-0-release-amd64-ufs + - name: nightly freebsd-15 + freebsd_instance: + image_family: freebsd-15-0-snap setup_script: - pkg install -y libnghttp2 curl - curl https://sh.rustup.rs -sSf --output rustup.sh - sh rustup.sh -y --default-toolchain nightly --profile=minimal - - . $HOME/.cargo/env - test_script: - - . $HOME/.cargo/env - - LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd - - sh ci/run.sh x86_64-unknown-freebsd - -task: - name: nightly x86_64-unknown-freebsd-14 - freebsd_instance: - image: freebsd-14-0-release-amd64-ufs - setup_script: - - pkg install -y libnghttp2 curl - - curl https://sh.rustup.rs -sSf --output rustup.sh - - sh rustup.sh -y --default-toolchain nightly --profile=minimal - - . $HOME/.cargo/env - test_script: - - . $HOME/.cargo/env - - LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd - - sh ci/run.sh x86_64-unknown-freebsd - -task: - name: nightly x86_64-unknown-freebsd-15 - freebsd_instance: - image_family: freebsd-15-0-snap - setup_script: - - pkg install -y libnghttp2 curl - - curl https://sh.rustup.rs -sSf --output rustup.sh - - sh rustup.sh -y --default-toolchain nightly --profile=minimal - - . $HOME/.cargo/env test_script: - . $HOME/.cargo/env - LIBC_CI=1 sh ci/run.sh x86_64-unknown-freebsd diff --git a/.github/workflows/full_ci.yml b/.github/workflows/full_ci.yml index 605802d3c9301..6a4fbc7f4d332 100644 --- a/.github/workflows/full_ci.yml +++ b/.github/workflows/full_ci.yml @@ -63,10 +63,10 @@ jobs: 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-gnu + # env: + # ARCH_BITS: 32 + # ARCH: i686 - target: i686-pc-windows-msvc steps: - uses: actions/checkout@v4 @@ -140,45 +140,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) @@ -227,14 +188,6 @@ jobs: - { toolchain: stable, os: macos-13 } - { toolchain: beta, os: macos-13 } - { toolchain: nightly, os: macos-13 } - # Use macOS 11 for older toolchains as newer Xcode donesn't work well. - # FIXME: Disabled due to: - # error: failed to parse registry's information for: serde - #- { toolchain: 1.13.0, os: macos-11 } - - { toolchain: 1.19.0, os: macos-11 } - - { toolchain: 1.24.0, os: macos-11 } - - { toolchain: 1.25.0, os: macos-11 } - - { toolchain: 1.30.0, os: macos-11 } runs-on: ${{ matrix.target.os }} steps: - uses: actions/checkout@v4 @@ -291,11 +244,9 @@ jobs: 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/.github/workflows/main.yml b/.github/workflows/main.yml index c7784fc117df9..d22a4a19cc565 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,10 +58,10 @@ jobs: 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-gnu + # env: + # ARCH_BITS: 32 + # ARCH: i686 - target: i686-pc-windows-msvc steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/publish_0.2.yml b/.github/workflows/publish_0.2.yml new file mode 100644 index 0000000000000..768fbcac7d3cc --- /dev/null +++ b/.github/workflows/publish_0.2.yml @@ -0,0 +1,29 @@ +# release-plz for the stable 0.2 branch + +name: Release-plz v0.2 + +permissions: + pull-requests: write + contents: write + +on: + push: + branches: + - libc-0.2 + +jobs: + release-plz: + name: Release-plz v0.2 + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install Rust (rustup) + run: rustup update stable --no-self-update && rustup default stable + - name: Run release-plz + uses: MarcoIeni/release-plz-action@v0.5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/.release-plz.toml b/.release-plz.toml new file mode 100644 index 0000000000000..45fd917c3bffd --- /dev/null +++ b/.release-plz.toml @@ -0,0 +1,2 @@ +[workspace] +git_tag_name = "{{ version }}" diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000000000..4fcf6c3444619 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,54 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [0.2.156](https://github.com/rust-lang/libc/compare/0.2.155...0.2.156) - 2024-08-15 + +### Added +- F_ALLOCATEPERSIST for apple +- IP_RECVTTL/IPV6_RECVHOPLIMIT for FreeBSD/DragonFly + +### Fixed +- Remove macOS 11 usage on CI +- Allow dead_code lint + +### Other +- Enable publishing new versions via release-plz +- Add `release-plz` for the 0.2 branch +- Merge pull request [#3821](https://github.com/rust-lang/libc/pull/3821) from tgross35/backport-celery +- Modify QNX NTO platform support +- Adding constant SOMAXCONN to vxworks +- Add XATTR_CREATE, XATTR_REPLACE +- Change ifa_flags type to u64 for Solaris/illumos +- add confstr API and _CS_* to linux-gnu +- Merge pull request [#3814](https://github.com/rust-lang/libc/pull/3814) from tgross35/backport-hermit +- Merge pull request [#3813](https://github.com/rust-lang/libc/pull/3813) from tgross35/backport-futex-constants +- Merge pull request [#3812](https://github.com/rust-lang/libc/pull/3812) from tgross35/backport-fbsd-kinfo_file +- Merge pull request [#3811](https://github.com/rust-lang/libc/pull/3811) from tgross35/backport-riscv64-clone_args +- Merge pull request [#3810](https://github.com/rust-lang/libc/pull/3810) from tgross35/backport-haiku-b_app_image_symbol +- Merge pull request [#3807](https://github.com/rust-lang/libc/pull/3807) from sunshowers/illumos-pthread-pick +- vxWorks adding few errnoLib related constants. +- Disable hexagon-unknown-linux-musl testing for now +- Fix FreeBSD 15 CI +- Remove tier 3 targets from CI +- Tweak comment +- Disable `libregex` for QNX 7.0 +- Reference specific MSRV in comment +- `addr_of!(EXTERN_STATIC)` is now considered safe +- `rmx_state` has been removed +- skip API that requires a newer macOS SDK in tests +- add `os_sync_wait_on_address` and related definitions +- adding preadv2/pwritev2 to linux musl (1.2.5 min.) +- Merge pull request [#3716](https://github.com/rust-lang/libc/pull/3716) from devnexen/ipv6_dontfrag +- generalising IPV6_DONTFRAG to all bsd. +- Merge pull request [#3715](https://github.com/rust-lang/libc/pull/3715) from tesuji/ci-verbosity +- Merge pull request [#3700](https://github.com/rust-lang/libc/pull/3700) from asomers/freebsd-capsicum-libc0.2 +- Merge pull request [#3738](https://github.com/rust-lang/libc/pull/3738) from operutka/getauxval_uclibc +- Merge pull request [#3737](https://github.com/rust-lang/libc/pull/3737) from operutka/si_pid_uclibc +- Merge pull request [#3747](https://github.com/rust-lang/libc/pull/3747) from djkoloski/libc-0.2 +- Merge pull request [#3719](https://github.com/rust-lang/libc/pull/3719) from tesuji/ci-cirrus-cache +- Merge pull request [#3750](https://github.com/rust-lang/libc/pull/3750) from SteveLauC/feat/IP_RECVTTL_FreeBSD diff --git a/Cargo.toml b/Cargo.toml index b29a475a4d7b8..978eeac2121ff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libc" -version = "0.2.153" +version = "0.2.156" authors = ["The Rust Project Developers"] license = "MIT OR Apache-2.0" readme = "README.md" @@ -46,7 +46,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/build.rs b/build.rs index ec932007ae69f..5945799d2423d 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", @@ -34,7 +34,7 @@ const ALLOWED_CFGS: &'static [&'static str] = &[ // Extra values to allow for check-cfg. const CHECK_CFG_EXTRA: &'static [(&'static str, &'static [&'static str])] = &[ - ("target_os", &["switch", "aix", "ohos", "hurd"]), + ("target_os", &["switch", "aix", "ohos", "hurd", "visionos"]), ("target_env", &["illumos", "wasi", "aix", "ohos"]), ( "target_arch", @@ -51,7 +51,7 @@ fn main() { let align_cargo_feature = env::var("CARGO_FEATURE_ALIGN").is_ok(); let const_extern_fn_cargo_feature = env::var("CARGO_FEATURE_CONST_EXTERN_FN").is_ok(); let 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; if env::var("CARGO_FEATURE_USE_STD").is_ok() { println!( diff --git a/ci/build.sh b/ci/build.sh index 41225f9cdffd6..d90872f4e8c84 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 } @@ -211,6 +212,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 +226,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/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/libc-test/Cargo.toml b/libc-test/Cargo.toml index a9ae85e857fa5..14f824424761a 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -1,9 +1,11 @@ [package] name = "libc-test" -version = "0.2.153" +version = "0.2.155" +edition = "2018" authors = ["The Rust Project Developers"] license = "MIT OR Apache-2.0" build = "build.rs" +publish = false repository = "https://github.com/rust-lang/libc" homepage = "https://github.com/rust-lang/libc" description = """ @@ -12,7 +14,7 @@ A test crate for the libc crate. [dependencies.libc] path = ".." -version = "0.2.153" +version = "0.2.156" default-features = false [build-dependencies] diff --git a/libc-test/build.rs b/libc-test/build.rs index 782a65b749152..0746d3d607007 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -95,8 +95,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. @@ -106,7 +105,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); @@ -154,6 +156,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(); @@ -234,8 +239,11 @@ fn test_apple(target: &str) { "netinet/ip.h", "netinet/tcp.h", "netinet/udp.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", @@ -312,6 +320,8 @@ 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, _ => false, } @@ -322,6 +332,9 @@ 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, } }); @@ -340,6 +353,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, } }); @@ -365,6 +385,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, } }); @@ -379,6 +408,9 @@ fn test_apple(target: &str) { ("ifreq", "ifr_ifru") => true, ("ifkpi", "ifk_data") => true, ("ifconf", "ifc_ifcu") => true, + // FIXME: this field has been incorporated into a resized `rmx_filler` array. + ("rt_metrics", "rmx_state") => true, + ("rt_metrics", "rmx_filler") => true, _ => false, } }); @@ -1611,6 +1643,7 @@ fn test_android(target: &str) { "sched.h", "semaphore.h", "signal.h", + "spawn.h", "stddef.h", "stdint.h", "stdio.h", @@ -1765,6 +1798,9 @@ fn test_android(target: &str) { // These are tested in the `linux_elf.rs` file. "Elf64_Phdr" | "Elf32_Phdr" => true, + // These are intended to be opaque + "posix_spawn_file_actions_t" => true, + "posix_spawnattr_t" => true, _ => false, } }); @@ -2275,6 +2311,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, @@ -2468,6 +2510,12 @@ fn test_freebsd(target: &str) { true } + // FIXME: Removed in FreeBSD 15: + "LOCAL_CONNWAIT" if freebsd_ver >= Some(15) => true, + + // FIXME: The values has been changed in FreeBSD 15: + "CLOCK_BOOTTIME" if Some(15) <= freebsd_ver => true, + _ => false, } }); @@ -2516,6 +2564,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, } }); @@ -3321,6 +3372,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(); @@ -3443,6 +3495,8 @@ fn test_linux(target: &str) { // Include linux headers at the end: headers! { cfg: + [loongarch64]: "asm/hwcap.h", + [riscv64]: "asm/hwcap.h", "asm/mman.h", [gnu]: "linux/aio_abi.h", "linux/can.h", @@ -3898,6 +3952,12 @@ fn test_linux(target: &str) { | "SW_CNT" if ppc64 || riscv64 => true, + // FIXME: requires more recent kernel headers on CI + | "MFD_EXEC" + | "MFD_NOEXEC_SEAL" + | "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, @@ -4278,6 +4338,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, } }); diff --git a/libc-test/semver/android-aarch64.txt b/libc-test/semver/android-aarch64.txt index 9b4cc355e3f9e..8a38e32dd5022 100644 --- a/libc-test/semver/android-aarch64.txt +++ b/libc-test/semver/android-aarch64.txt @@ -10,6 +10,8 @@ HWCAP2_SVESM4 PROT_BTI PROT_MTE SYS_arch_specific_syscall +SYS_lseek +SYS_mmap SYS_syscalls SYS_fcntl __system_property_wait diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 901b7ca768d41..0bf7f422a2f49 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -627,6 +627,7 @@ FUTEX_CMP_REQUEUE FUTEX_CMP_REQUEUE_PI FUTEX_FD FUTEX_LOCK_PI +FUTEX_LOCK_PI2 FUTEX_PRIVATE_FLAG FUTEX_REQUEUE FUTEX_TRYLOCK_PI @@ -1881,6 +1882,7 @@ PROT_GROWSUP PROT_NONE PROT_READ PROT_WRITE +PTHREAD_BARRIER_SERIAL_THREAD PTHREAD_COND_INITIALIZER PTHREAD_CREATE_DETACHED PTHREAD_CREATE_JOINABLE @@ -2031,6 +2033,7 @@ RTLD_LAZY RTLD_LOCAL RTLD_NOLOAD RTLD_NOW +RTLD_NODELETE TCA_UNSPEC TCA_KIND TCA_OPTIONS @@ -2920,6 +2923,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 @@ -2990,6 +3008,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 diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index ce9c6097bbb88..4ca721005f139 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -428,6 +428,7 @@ FSOPT_REPORT_FULLSIZE FSOPT_RETURN_REALDEV F_ALLOCATEALL F_ALLOCATECONTIG +F_ALLOCATEPERSIST F_BARRIERFSYNC F_FREEZE_FS F_FULLFSYNC @@ -1022,6 +1023,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 +1032,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 @@ -2046,6 +2054,7 @@ open_memstream open_wmemstream openat openpty +os_clockid_t os_log_create os_log_t os_log_type_enabled @@ -2055,6 +2064,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 @@ -2284,3 +2300,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..d2d26b0fe0688 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 @@ -498,6 +501,7 @@ IPV6_DONTFRAG IP_HDRINCL IP_RECVDSTADDR IP_RECVIF +IP_RECVTTL IP_SENDSRCADDR IP_TOS ITIMER_PROF @@ -1308,6 +1312,7 @@ fstatfs futimes getdomainname getdtablesize +getentropy getgrent getgrent_r getgrgid @@ -1331,6 +1336,7 @@ getprogname getpwent getpwent_r getpwnam_r +getrandom getresgid getresuid getrlimit @@ -1587,3 +1593,4 @@ xucred eaccess dirname basename +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 1144c4d4c2481..00b00b7a57b04 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 @@ -576,6 +670,7 @@ IP_RECVIF IP_RECVORIGDSTADDR IP_DONTFRAG IP_RECVTOS +IP_RECVTTL IP_RSS_LISTEN_BUCKET IP_SENDSRCADDR IP_TOS @@ -974,6 +1069,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 @@ -1881,6 +1977,7 @@ jrand48 kevent key_t killpg +kinfo_file kinfo_getvmmap kinfo_proc kinfo_vmentry @@ -2251,3 +2348,4 @@ closefrom close_range eventfd_read eventfd_write +IPV6_RECVHOPLIMIT 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..a4ab1b2e568e0 100644 --- a/libc-test/semver/linux-aarch64.txt +++ b/libc-test/semver/linux-aarch64.txt @@ -66,6 +66,7 @@ SKF_NET_OFF SO_PRIORITY SO_PROTOCOL SYS_accept +SYS_fstat SYS_msgctl SYS_msgget SYS_msgrcv @@ -79,6 +80,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 9bbdee0771b60..6fa88e6c77927 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -511,6 +511,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 +614,7 @@ aio_write aiocb backtrace clock_adjtime +confstr copy_file_range ctermid dlinfo @@ -691,9 +695,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..a14498adc8396 100644 --- a/libc-test/semver/linux-i686.txt +++ b/libc-test/semver/linux-i686.txt @@ -96,6 +96,7 @@ SYS_fadvise64_64 SYS_fchown32 SYS_fcntl64 SYS_fork +SYS_fstat SYS_fstat64 SYS_fstatat64 SYS_fstatfs64 @@ -165,6 +166,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 2db034f813be7..5a48357cb79e5 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 @@ -66,19 +71,18 @@ getloadavg lio_listio ntptimeval open_wmemstream +preadv2 preadv64 prlimit prlimit64 process_vm_readv process_vm_writev +pwritev2 pwritev64 reallocarray timex euidaccess eaccess asctime_r -strftime -strftime_l -strptime dirname basename diff --git a/libc-test/semver/linux-powerpc.txt b/libc-test/semver/linux-powerpc.txt index 1d162417608fa..d9aacc973d972 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 @@ -110,6 +111,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..99be508e6bd59 100644 --- a/libc-test/semver/linux-powerpc64.txt +++ b/libc-test/semver/linux-powerpc64.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-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..2691801511782 100644 --- a/libc-test/semver/linux-riscv64gc.txt +++ b/libc-test/semver/linux-riscv64gc.txt @@ -46,6 +46,7 @@ SO_TIMESTAMPNS SO_WIFI_STATUS SYS_accept SYS_fadvise64 +SYS_fstat SYS_msgctl SYS_msgget SYS_msgrcv @@ -59,6 +60,7 @@ SYS_semget SYS_semop SYS_semtimedop SYS_sendfile +SYS_setrlimit SYS_shmat SYS_shmctl SYS_shmdt @@ -69,3 +71,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..f5d089e3d5e50 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 @@ -76,6 +77,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..6ad111e7308cc 100644 --- a/libc-test/semver/linux-x86_64.txt +++ b/libc-test/semver/linux-x86_64.txt @@ -93,6 +93,7 @@ SYS_epoll_wait SYS_eventfd SYS_fadvise64 SYS_fork +SYS_fstat SYS_futimesat SYS_getdents SYS_getpgrp @@ -120,6 +121,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 f14476525db06..6c649c26227ee 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 @@ -823,13 +824,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 @@ -1979,6 +1983,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 @@ -2876,7 +2881,6 @@ SYS_flistxattr SYS_flock SYS_fremovexattr SYS_fsetxattr -SYS_fstat SYS_fstatfs SYS_fsync SYS_ftruncate @@ -3031,7 +3035,6 @@ SYS_setregid SYS_setresgid SYS_setresuid SYS_setreuid -SYS_setrlimit SYS_setsid SYS_setsockopt SYS_settimeofday @@ -3834,8 +3837,11 @@ statvfs64 strcasecmp strcasestr strchrnul +strftime +strftime_l strncasecmp strndup +strptime strsignal swapoff swapon diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt index 353b1e7356ff5..35d64153f2650 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 diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt index fd4563212d60d..6f07fec590ff5 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 diff --git a/libc-test/semver/solarish.txt b/libc-test/semver/solarish.txt new file mode 100644 index 0000000000000..069508925c8ef --- /dev/null +++ b/libc-test/semver/solarish.txt @@ -0,0 +1 @@ +PIPE_BUF 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/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 4e028ff6cc45a..e396d37411a02 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; diff --git a/src/hermit.rs b/src/hermit.rs new file mode 100644 index 0000000000000..145d1241b190b --- /dev/null +++ b/src/hermit.rs @@ -0,0 +1,446 @@ +//! 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; + +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 7543c825782e2..0000000000000 --- a/src/hermit/mod.rs +++ /dev/null @@ -1,61 +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 - } -} - -cfg_if! { - if #[cfg(libc_core_cvoid)] { - pub use ::ffi::c_void; - } else { - // Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help - // enable more optimization opportunities around it recognizing things - // like malloc/free. - #[repr(u8)] - #[allow(missing_copy_implementations)] - #[allow(missing_debug_implementations)] - pub enum c_void { - // Two dummy variants so the #[repr] attribute can be used. - #[doc(hidden)] - __variant1, - #[doc(hidden)] - __variant2, - } - } -} diff --git a/src/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 1b6f0c077ab24..764d8e4cd096a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,6 +12,10 @@ 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 diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index 0fc923d6072f0..c072ae55e5836 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; @@ -1210,6 +1210,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; diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 2e7827231e65f..f21c0ae6e54aa 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -121,6 +121,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; @@ -504,6 +509,8 @@ s! { pub rmx_rtt: u32, pub rmx_rttvar: u32, pub rmx_pksent: u32, + /// This field does not exist anymore, the u32 is now part of a resized + /// `rmx_filler` array. pub rmx_state: u32, pub rmx_filler: [u32; 3], } @@ -3227,6 +3234,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; @@ -3234,6 +3259,8 @@ 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 O_EXEC: ::c_int = 0x40000000; +pub const O_SEARCH: ::c_int = O_EXEC | O_DIRECTORY; pub const S_IFIFO: mode_t = 4096; pub const S_IFCHR: mode_t = 8192; pub const S_IFBLK: mode_t = 24576; @@ -3589,6 +3616,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; @@ -4132,7 +4160,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; @@ -5421,6 +5448,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; @@ -5814,6 +5850,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); @@ -6475,7 +6545,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/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 78314084cc6ec..cb39077402f19 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -1637,6 +1637,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! { @@ -2593,6 +2610,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); + } + } } } @@ -2618,6 +2681,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; @@ -3875,11 +4061,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; @@ -5393,8 +5574,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; diff --git a/src/unix/bsd/freebsdlike/freebsd/x86.rs b/src/unix/bsd/freebsdlike/freebsd/x86.rs index 4046ec3109f14..c3c576ed66681 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86.rs @@ -199,3 +199,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 ae1fcf781047a..fb4597927f3d6 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs @@ -93,23 +93,6 @@ s_no_extra_traits! { #[cfg(libc_union)] 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! { @@ -253,52 +236,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); - } - } } } @@ -326,6 +263,8 @@ 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; + cfg_if! { if #[cfg(libc_align)] { mod align; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 00a944e42bf2d..e0a0fbd01443f 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -797,6 +797,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; @@ -970,6 +971,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; @@ -978,7 +981,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; @@ -1456,6 +1458,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 @@ -1829,6 +1836,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 9a2e6c463d36b..7acda9076d1f0 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, @@ -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; @@ -917,7 +919,7 @@ extern "C" { } cfg_if! { - if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))] { + 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/haiku/mod.rs b/src/unix/haiku/mod.rs index e7b0f34dd371a..4dc931cd047d9 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; @@ -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; @@ -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; diff --git a/src/unix/haiku/native.rs b/src/unix/haiku/native.rs index 62d6392fabdf5..85865ad24cea6 100644 --- a/src/unix/haiku/native.rs +++ b/src/unix/haiku/native.rs @@ -956,6 +956,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 diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index 2701649f6c646..71f1ac8d98c22 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -2760,6 +2760,10 @@ 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; diff --git a/src/unix/linux_like/android/b64/aarch64/mod.rs b/src/unix/linux_like/android/b64/aarch64/mod.rs index ac67fddabecd4..7b87a1d49dc3e 100644 --- a/src/unix/linux_like/android/b64/aarch64/mod.rs +++ b/src/unix/linux_like/android/b64/aarch64/mod.rs @@ -191,6 +191,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 +348,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; diff --git a/src/unix/linux_like/android/b64/mod.rs b/src/unix/linux_like/android/b64/mod.rs index 67d0dacf17e93..9639e1b4fa589 100644 --- a/src/unix/linux_like/android/b64/mod.rs +++ b/src/unix/linux_like/android/b64/mod.rs @@ -288,6 +288,7 @@ 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 AT_MINSIGSTKSZ: ::c_ulong = 51; pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t { value: 0, diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 2c1c1e9b91f27..535e874080633 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, @@ -1182,140 +1186,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; @@ -1328,6 +1347,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; @@ -1741,6 +1761,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; @@ -3002,6 +3023,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; diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs index 83f97fbd92936..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; 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/b64/loongarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs index 3e1719a76db79..ac3f88905f38e 100644 --- a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs @@ -264,20 +264,20 @@ align_const! { }; } -pub const HWCAP_CPUCFG: ::c_ulong = 1 << 0; -pub const HWCAP_LAM: ::c_ulong = 1 << 1; -pub const HWCAP_UAL: ::c_ulong = 1 << 2; -pub const HWCAP_FPU: ::c_ulong = 1 << 3; -pub const HWCAP_LSX: ::c_ulong = 1 << 4; -pub const HWCAP_LASX: ::c_ulong = 1 << 5; -pub const HWCAP_CRC32: ::c_ulong = 1 << 6; -pub const HWCAP_COMPLEX: ::c_ulong = 1 << 7; -pub const HWCAP_CRYPTO: ::c_ulong = 1 << 8; -pub const HWCAP_LVZ: ::c_ulong = 1 << 9; -pub const HWCAP_LBT_X86: ::c_ulong = 1 << 10; -pub const HWCAP_LBT_ARM: ::c_ulong = 1 << 11; -pub const HWCAP_LBT_MIPS: ::c_ulong = 1 << 12; -pub const HWCAP_PTW: ::c_ulong = 1 << 13; +pub const 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 8e06a135baa42..64f5cf10f8583 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/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index 9af519e9077df..d6e5eb69c7fbb 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -835,6 +835,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; @@ -1478,21 +1481,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"] diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index cbb3f7bdf5fe8..700b6fd0d408e 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -327,13 +327,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, } @@ -1841,6 +1842,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; @@ -2063,6 +2065,7 @@ align_const! { 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; @@ -4102,7 +4105,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; @@ -4133,6 +4136,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; @@ -4152,6 +4156,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; @@ -4678,7 +4686,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 @@ -4923,9 +4931,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; @@ -5012,6 +5017,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; 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/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index a4c1f708afd50..699c8181f8466 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -671,6 +671,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; @@ -862,6 +868,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 @@ -883,21 +903,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; } @@ -912,7 +917,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..637b5285a2c03 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; @@ -374,6 +432,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/mod.rs b/src/unix/linux_like/mod.rs index 35c7598c911d8..749c8a16d0148 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1775,6 +1775,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 3dca83305ad59..26a4029d94f87 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -369,6 +369,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 +396,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")] @@ -1042,7 +1043,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" )] @@ -1218,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" )] @@ -1406,6 +1409,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; } } @@ -1555,6 +1567,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/nto/mod.rs b/src/unix/nto/mod.rs index 9eef23458d14a..001b51a7da678 100644 --- a/src/unix/nto/mod.rs +++ b/src/unix/nto/mod.rs @@ -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; @@ -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 19315c3872c88..5036f458067b6 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -677,22 +677,22 @@ pub const EPOLL_CLOEXEC: ::c_int = 0x0100_0000; pub const EPOLL_CTL_ADD: ::c_int = 1; pub const EPOLL_CTL_DEL: ::c_int = 2; pub const EPOLL_CTL_MOD: ::c_int = 3; -pub const EPOLLIN: ::c_int = 1; -pub const EPOLLPRI: ::c_int = 0; -pub const EPOLLOUT: ::c_int = 2; -pub const EPOLLRDNORM: ::c_int = 0; -pub const EPOLLNVAL: ::c_int = 0; -pub const EPOLLRDBAND: ::c_int = 0; -pub const EPOLLWRNORM: ::c_int = 0; -pub const EPOLLWRBAND: ::c_int = 0; -pub const EPOLLMSG: ::c_int = 0; -pub const EPOLLERR: ::c_int = 0; -pub const EPOLLHUP: ::c_int = 0; -pub const EPOLLRDHUP: ::c_int = 0; -pub const EPOLLEXCLUSIVE: ::c_int = 0; -pub const EPOLLWAKEUP: ::c_int = 0; -pub const EPOLLONESHOT: ::c_int = 0; -pub const EPOLLET: ::c_int = 0; +pub const EPOLLIN: ::c_int = 0x001; +pub const EPOLLPRI: ::c_int = 0x002; +pub const EPOLLOUT: ::c_int = 0x004; +pub const EPOLLERR: ::c_int = 0x008; +pub const EPOLLHUP: ::c_int = 0x010; +pub const EPOLLNVAL: ::c_int = 0x020; +pub const EPOLLRDNORM: ::c_int = 0x040; +pub const EPOLLRDBAND: ::c_int = 0x080; +pub const EPOLLWRNORM: ::c_int = 0x100; +pub const EPOLLWRBAND: ::c_int = 0x200; +pub const EPOLLMSG: ::c_int = 0x400; +pub const EPOLLRDHUP: ::c_int = 0x2000; +pub const EPOLLEXCLUSIVE: ::c_int = 1 << 28; +pub const EPOLLWAKEUP: ::c_int = 1 << 29; +pub const EPOLLONESHOT: ::c_int = 1 << 30; +pub const EPOLLET: ::c_int = 1 << 31; // sys/stat.h pub const S_IFMT: ::c_int = 0o0_170_000; 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 c68cfba3c9932..5f5cff1f306f9 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -135,7 +135,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, @@ -1279,6 +1279,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; @@ -1829,6 +1830,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; diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index 43afbc3e2c23d..4f0274241394e 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; @@ -768,6 +797,7 @@ pub const S_IRWXO: ::c_int = 0x0007; // 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; diff --git a/src/wasi.rs b/src/wasi.rs index ae490bf94d7a2..8b32405b9fbfe 100644 --- a/src/wasi.rs +++ b/src/wasi.rs @@ -366,10 +366,14 @@ 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; +#[allow(unused_unsafe)] // `addr_of!(EXTERN_STATIC)` is now safe; remove `unsafe` when MSRV >= 1.82 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)) };