diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000000000..155c9905f91e1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,7 @@ +[*.sh] +# See https://github.com/mvdan/sh/blob/master/cmd/shfmt/shfmt.1.scd#examples +indent_style = space +indent_size = 4 + +switch_case_indent = true +space_redirects = true diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6678e42b6adb3..e9c1306af438b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -34,7 +34,7 @@ jobs: name: Clippy on ${{ matrix.os }} strategy: matrix: - os: [ubuntu-24.04, macos-14, windows-2022] + os: [ubuntu-24.04, macos-15, windows-2022] runs-on: ${{ matrix.os }} timeout-minutes: 10 steps: @@ -52,7 +52,7 @@ jobs: strategy: matrix: toolchain: [stable, nightly, 1.63.0] - os: [ubuntu-24.04, macos-14, windows-2022] + os: [ubuntu-24.04, macos-15, windows-2022] include: - toolchain: beta os: ubuntu-24.04 @@ -111,7 +111,7 @@ jobs: docker: true os: ubuntu-24.04 - target: aarch64-apple-darwin - os: macos-14 + os: macos-15 - target: x86_64-pc-windows-gnu os: windows-2022 env: @@ -187,6 +187,7 @@ jobs: - loongarch64-unknown-linux-musl - powerpc64-unknown-linux-gnu - powerpc64le-unknown-linux-gnu + - powerpc64le-unknown-linux-musl - riscv64gc-unknown-linux-gnu - s390x-unknown-linux-gnu - wasm32-unknown-emscripten @@ -221,6 +222,9 @@ jobs: - target: loongarch64-unknown-linux-musl env: RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1 + - target: powerpc64le-unknown-linux-musl + env: + RUST_LIBC_UNSTABLE_MUSL_V1_2_3: 1 # FIXME(ppc): SIGILL running tests, see # https://github.com/rust-lang/libc/pull/4254#issuecomment-2636288713 # - target: powerpc-unknown-linux-gnu diff --git a/.gitignore b/.gitignore index f0ff2599d09b5..7aef3038432cf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ target -Cargo.lock *~ diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000000000..76360464c7c7e --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,421 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "annotate-snippets" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "710e8eae58854cdc1790fcb56cca04d712a17be849eeb81da2a724bf4bae2bc4" +dependencies = [ + "anstyle", + "unicode-width", +] + +[[package]] +name = "anstyle" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" + +[[package]] +name = "cc" +version = "1.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1599538de2394445747c8cf7935946e3cc27e9625f889d979bfb2aaf569362" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" + +[[package]] +name = "ctest" +version = "0.1.0" + +[[package]] +name = "ctest-next" +version = "0.1.0" + +[[package]] +name = "ctest2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cf53ed2a9e25d98cd444fd6e73eae7de0a26a8cb9e3f998170c6901a1afa0e5" +dependencies = [ + "cc", + "garando_syntax", + "rustc_version", +] + +[[package]] +name = "dirs" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" +dependencies = [ + "cfg-if 0.1.10", + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc 0.2.174 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users", + "winapi", +] + +[[package]] +name = "garando_errors" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18495ec4aced5922809efe4d2862918ff0e8d75e122bde57bba9bae45965256a" +dependencies = [ + "garando_pos", + "libc 0.2.174 (registry+https://github.com/rust-lang/crates.io-index)", + "serde", + "term", + "unicode-xid", +] + +[[package]] +name = "garando_pos" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9386fc75dca486daefbbf5a8d2ea6f379237f95c9b982776159cd66f220aaf" +dependencies = [ + "serde", +] + +[[package]] +name = "garando_syntax" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8a383861d12fc78c251bbcb1ec252dd8338714ce02ab0cc393cfd02f40d32b" +dependencies = [ + "bitflags 1.3.2", + "garando_errors", + "garando_pos", + "log", + "serde", + "serde_json", + "unicode-xid", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if 1.0.1", + "libc 0.2.174 (registry+https://github.com/rust-lang/crates.io-index)", + "wasi", +] + +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "libc" +version = "0.2.174" +dependencies = [ + "rustc-std-workspace-core", +] + +[[package]] +name = "libc" +version = "0.2.174" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" + +[[package]] +name = "libc-test" +version = "0.1.0" +dependencies = [ + "annotate-snippets", + "cc", + "cfg-if 1.0.1", + "ctest2", + "glob", + "libc 0.2.174", + "proc-macro2", + "regex", + "syn", +] + +[[package]] +name = "libredox" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1580801010e535496706ba011c15f8532df6b42297d2e471fec38ceadd8c0638" +dependencies = [ + "bitflags 2.9.1", + "libc 0.2.174 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "memchr" +version = "2.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "rustc-std-workspace-core" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9c45b374136f52f2d6311062c7146bff20fec063c3f5d46a410bd937746955" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "semver" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "syn" +version = "2.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "term" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0863a3345e70f61d613eab32ee046ccd1bcc5f9105fe402c61fcd0c13eeb8b5" +dependencies = [ + "dirs", + "winapi", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "unicode-width" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index 9ac66aaeabc01..eb60f04af2f85 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -77,6 +77,7 @@ targets = [ "powerpc64-unknown-linux-gnu", "powerpc64-wrs-vxworks", "powerpc64le-unknown-linux-gnu", + "powerpc64le-unknown-linux-musl", "riscv32gc-unknown-linux-gnu", "riscv32i-unknown-none-elf", "riscv32imac-unknown-none-elf", @@ -128,7 +129,7 @@ targets = [ cargo-args = ["-Zbuild-std=core"] [dependencies] -rustc-std-workspace-core = { version = "1.0.0", optional = true } +rustc-std-workspace-core = { version = "1.0.1", optional = true } [features] default = ["std"] diff --git a/ci/android-install-sdk.sh b/ci/android-install-sdk.sh index 331e061357648..43e1153dcd331 100755 --- a/ci/android-install-sdk.sh +++ b/ci/android-install-sdk.sh @@ -15,27 +15,27 @@ wget -q --tries=20 "https://dl.google.com/android/repository/commandlinetools-li unzip -q -d sdk/cmdline-tools "commandlinetools-linux-${sdk}_latest.zip" case "$1" in - arm | armv7) - api=24 - image="system-images;android-${api};default;armeabi-v7a" - ;; - aarch64) - api=24 - image="system-images;android-${api};google_apis;arm64-v8a" - ;; - i686) - api=28 - image="system-images;android-${api};default;x86" - ;; - x86_64) - api=28 - image="system-images;android-${api};default;x86_64" - ;; - *) - echo "invalid arch: $1" - exit 1 - ;; -esac; + arm | armv7) + api=24 + image="system-images;android-${api};default;armeabi-v7a" + ;; + aarch64) + api=24 + image="system-images;android-${api};google_apis;arm64-v8a" + ;; + i686) + api=28 + image="system-images;android-${api};default;x86" + ;; + x86_64) + api=28 + image="system-images;android-${api};default;x86_64" + ;; + *) + echo "invalid arch: $1" + exit 1 + ;; +esac # Try to fix warning about missing file. # See https://askubuntu.com/a/1078784 @@ -53,9 +53,9 @@ echo '#Fri Nov 03 10:11:27 CET 2017 count=0' >> /root/.android/repositories.cfg # which produces an insane amount of output. yes | ./sdk/cmdline-tools/tools/bin/sdkmanager --licenses --no_https | grep -v = || true yes | ./sdk/cmdline-tools/tools/bin/sdkmanager --no_https \ - "platform-tools" \ - "platforms;android-${api}" \ - "${image}" | grep -v = || true + "platform-tools" \ + "platforms;android-${api}" \ + "${image}" | grep -v = || true # The newer emulator versions (31.3.12 or higher) fail to a valid AVD and the test gets stuck. # Until we figure out why, we use the older version (31.3.11). diff --git a/ci/docker/powerpc64le-unknown-linux-musl/Dockerfile b/ci/docker/powerpc64le-unknown-linux-musl/Dockerfile new file mode 100644 index 0000000000000..b25f284eddf7a --- /dev/null +++ b/ci/docker/powerpc64le-unknown-linux-musl/Dockerfile @@ -0,0 +1,15 @@ +FROM ubuntu:24.10 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + gcc make libc6-dev git curl ca-certificates \ + gcc-powerpc64le-linux-gnu qemu-user xz-utils patch rsync + +COPY install-musl.sh / +RUN /install-musl.sh powerpc64le + +# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in std? +ENV PATH=$PATH:/musl-powerpc64/bin:/rust/bin \ + CC_powerpc64le_unknown_linux_musl=musl-gcc \ + RUSTFLAGS='-Clink-args=-lgcc -L /musl-powerpc64/lib' \ + CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc \ + CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_MUSL_RUNNER="qemu-ppc64le -L /musl-powerpc64" diff --git a/ci/install-musl.sh b/ci/install-musl.sh index d3752a900ba6d..f5516553707d2 100755 --- a/ci/install-musl.sh +++ b/ci/install-musl.sh @@ -25,14 +25,14 @@ case ${1} in musl_arch=aarch64 kernel_arch=arm64 CC=aarch64-linux-gnu-gcc \ - ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes + ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes make install -j4 ;; arm) musl_arch=arm kernel_arch=arm CC=arm-linux-gnueabihf-gcc CFLAGS="-march=armv6 -marm -mfpu=vfp" \ - ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes + ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes make install -j4 ;; i686) @@ -43,7 +43,7 @@ case ${1} in # Specifically pass -m32 in CFLAGS and override CC when running # ./configure, since otherwise the script will fail to find a compiler. CC=gcc CFLAGS="-m32" \ - ./configure --prefix="/musl-${musl_arch}" --disable-shared --target=i686 + ./configure --prefix="/musl-${musl_arch}" --disable-shared --target=i686 # unset CROSS_COMPILE when running make; otherwise the makefile will # call the non-existent binary 'i686-ar'. make CROSS_COMPILE= install -j4 @@ -58,14 +58,21 @@ case ${1} in musl_arch=s390x kernel_arch=s390 CC=s390x-linux-gnu-gcc \ - ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes + ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes make install -j4 ;; loongarch64) musl_arch=loongarch64 kernel_arch=loongarch CC=loongarch64-linux-gnu-gcc-14 \ - ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes + ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes + make install -j4 + ;; + powerpc64*) + musl_arch=powerpc64 + kernel_arch=powerpc + CC="${1}-linux-gnu-gcc" CFLAGS="-mlong-double-64" \ + ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes make install -j4 ;; *) @@ -74,7 +81,6 @@ case ${1} in ;; esac - # shellcheck disable=SC2103 cd .. rm -rf "$musl" @@ -116,8 +122,8 @@ EOF base=$(basename "$url") curl --retry 5 -L "$url" > "$base" case $base in - linux-*) kernel=$base;; - patch-*) patch=$base;; + linux-*) kernel=$base ;; + patch-*) patch=$base ;; esac # Check if file is known grep -o "$base" alpine-sha512sums diff --git a/ci/install-rust.sh b/ci/install-rust.sh index 6e7b1930c59a2..69e8ba97a5d3d 100755 --- a/ci/install-rust.sh +++ b/ci/install-rust.sh @@ -9,9 +9,9 @@ toolchain="${TOOLCHAIN:-nightly}" os="${OS:-}" case "$(uname -s)" in - Linux*) os=linux ;; - Darwin*) os=macos ;; - MINGW*) os=windows ;; + Linux*) os=linux ;; + Darwin*) os=macos ;; + MINGW*) os=windows ;; *) echo "Unknown system $(uname -s)" exit 1 @@ -51,7 +51,7 @@ if [ "$os" = "windows" ]; then if [ -n "${ARCH_BITS:-}" ]; then echo "Fix MinGW" - for i in crt2.o dllcrt2.o libmingwex.a libmsvcrt.a ; do + for i in crt2.o dllcrt2.o libmingwex.a libmsvcrt.a; do cp -f "/C/ProgramData/Chocolatey/lib/mingw/tools/install/mingw$ARCH_BITS/$ARCH-w64-mingw32/lib/$i" "$(rustc --print sysroot)/lib/rustlib/$TARGET/lib" done fi @@ -71,6 +71,6 @@ until [ $n -ge $N ]; do break fi - n=$((n+1)) + n=$((n + 1)) sleep 1 done diff --git a/ci/run-docker.sh b/ci/run-docker.sh index 9411d39e5f670..db10c3b061ba8 100755 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -21,7 +21,7 @@ echo "${HOME}" pwd # Avoid "no space left on device" failure if running in CI -if [ "${CI:-0}" != "0" ] && [ "$target" = "aarch64-linux-android" ] ; then +if [ "${CI:-0}" != "0" ] && [ "$target" = "aarch64-linux-android" ]; then docker system prune -af docker system df fi diff --git a/ci/run.sh b/ci/run.sh index 1d4b5f5079d96..7b4525143d05a 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -5,92 +5,21 @@ set -eux -mirrors_url="https://ci-mirrors.rust-lang.org/libc" - target="$1" export RUST_BACKTRACE="${RUST_BACKTRACE:-1}" -# If we're going to run tests inside of a qemu image, then we don't need any of -# the scripts below. Instead, download the image, prepare a filesystem which has -# the current state of this repository, and then run the image. -# -# It's assume that all images, when run with two disks, will run the `run.sh` -# script from the second which we place inside. -if [ -n "${QEMU:-}" ]; then - tmpdir=/tmp/qemu-img-creation - mkdir -p "${tmpdir}" - - if [ -z "${QEMU#*.gz}" ]; then - # image is .gz : download and uncompress it - base_file="${QEMU%.gz}" - pipe_cmd="gunzip -d" - elif [ -z "${QEMU#*.xz}" ]; then - # image is .xz : download and uncompress it - base_file="${QEMU%.xz}" - pipe_cmd="unxz" - else - # plain qcow2 image: just download it - base_file="$QEMU" - pipe_cmd="cat" # nop to forward the result - fi - - qemufile="$(echo "$base_file" | sed 's/\//__/g')" - if [ ! -f "${tmpdir}/${qemufile}" ]; then - curl --retry 5 "${mirrors_url}/${QEMU}" | $pipe_cmd > "${tmpdir}/${qemufile}" - fi - - # Create a mount a fresh new filesystem image that we'll later pass to QEMU. - # This will have a `run.sh` script will which use the artifacts inside to run - # on the host. - rm -f "${tmpdir}/libc-test.img" - mkdir "${tmpdir}/mount" - - # Do the standard rigamarole of cross-compiling an executable and then the - # script to run just executes the binary. - cargo build \ - --manifest-path libc-test/Cargo.toml \ - --target "$target" \ - --test main ${LIBC_CI_ZBUILD_STD+"-Zbuild-std=core"} - rm "${CARGO_TARGET_DIR}/${target}"/debug/main-*.d - cp "${CARGO_TARGET_DIR}/${target}"/debug/main-* "${tmpdir}"/mount/libc-test - # shellcheck disable=SC2016 - echo 'exec $1/libc-test' > "${tmpdir}/mount/run.sh" - - du -sh "${tmpdir}/mount" - genext2fs \ - --root "${tmpdir}/mount" \ - --size-in-blocks 100000 \ - "${tmpdir}/libc-test.img" - - # Pass -snapshot to prevent tampering with the disk images, this helps when - # running this script in development. The two drives are then passed next, - # first is the OS and second is the one we just made. Next the network is - # configured to work (I'm not entirely sure how), and then finally we turn off - # graphics and redirect the serial console output to out.log. - qemu-system-x86_64 \ - -m 1024 \ - -snapshot \ - -drive if=virtio,file="${tmpdir}/${qemufile}" \ - -drive if=virtio,file="${tmpdir}/libc-test.img" \ - -net nic,model=virtio \ - -net user \ - -nographic \ - -vga none 2>&1 | tee "${CARGO_TARGET_DIR}/out.log" - exec grep -E "^(PASSED)|(test result: ok)" "${CARGO_TARGET_DIR}/out.log" -fi - cmd="cargo test --target $target ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}" test_flags="--skip check_style" # Run tests in the `libc` crate case "$target" in - # Only run `libc-test` + # Only run `libc-test` # FIXME(android): unit tests fail to start on Android *android*) cmd="$cmd --manifest-path libc-test/Cargo.toml" ;; *s390x*) cmd="$cmd --manifest-path libc-test/Cargo.toml" ;; # For all other platforms, test everything in the workspace - *) cmd="$cmd --workspace" + *) cmd="$cmd --workspace" ;; esac if [ "$target" = "s390x-unknown-linux-gnu" ]; then @@ -103,13 +32,13 @@ if [ "$target" = "s390x-unknown-linux-gnu" ]; then if [ "$passed" = "0" ]; then # shellcheck disable=SC2086 if $cmd --no-default-features -- $test_flags; then - passed=$((passed+1)) + passed=$((passed + 1)) continue fi elif [ "$passed" = "1" ]; then # shellcheck disable=SC2086 if $cmd -- $test_flags; then - passed=$((passed+1)) + passed=$((passed + 1)) continue fi elif [ "$passed" = "2" ]; then @@ -118,7 +47,7 @@ if [ "$target" = "s390x-unknown-linux-gnu" ]; then break fi fi - n=$((n+1)) + n=$((n + 1)) sleep 1 done else diff --git a/ci/style.sh b/ci/style.sh index 4e425f8806000..72465f71c760a 100755 --- a/ci/style.sh +++ b/ci/style.sh @@ -65,7 +65,7 @@ export LC_ALL=C for file in libc-test/semver/*.txt; do case "$file" in - *TODO*) continue ;; + *TODO*) continue ;; esac if ! sort -C "$file"; then @@ -82,7 +82,7 @@ for file in libc-test/semver/*.txt; do fi done -if shellcheck --version ; then +if shellcheck --version; then find . -name '*.sh' -print0 | xargs -0 shellcheck else echo "shellcheck not found" diff --git a/ci/verify-build.sh b/ci/verify-build.sh index f19ed9d774a08..e833de2e04c5b 100755 --- a/ci/verify-build.sh +++ b/ci/verify-build.sh @@ -14,9 +14,9 @@ filter="${FILTER:-}" host_target=$(rustc -vV | awk '/^host/ { print $2 }') case "$(uname -s)" in - Linux*) os=linux ;; - Darwin*) os=macos ;; - MINGW*) os=windows ;; + Linux*) os=linux ;; + Darwin*) os=macos ;; + MINGW*) os=windows ;; *) echo "Unknown system $(uname -s)" exit 1 @@ -25,7 +25,7 @@ esac echo "Testing Rust $rust on $os" -if [ "$TOOLCHAIN" = "nightly" ] ; then +if [ "$TOOLCHAIN" = "nightly" ]; then # For build-std rustup component add rust-src fi @@ -61,10 +61,10 @@ test_target() { N=5 n=0 until [ $n -ge $N ]; do - if rustup target add "$target" --toolchain "$rust" ; then + if rustup target add "$target" --toolchain "$rust"; then break fi - n=$((n+1)) + n=$((n + 1)) sleep 1 done fi @@ -77,7 +77,7 @@ test_target() { # Test with the equivalent of __USE_TIME_BITS64 RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64=1 $cmd case "$target" in - arm*-gnu*|i*86*-gnu|powerpc-*-gnu*|mips*-gnu|sparc-*-gnu|thumb-*gnu*) + arm*-gnu* | i*86*-gnu | powerpc-*-gnu* | mips*-gnu | sparc-*-gnu | thumb-*gnu*) # Test with the equivalent of _FILE_OFFSET_BITS=64 RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS=64 $cmd # Test with the equivalent of _TIME_BITS=64 @@ -161,11 +161,14 @@ x86_64-unknown-linux-musl \ x86_64-unknown-netbsd \ " +# FIXME(powerpc64le): powerpc64le-unknown-linux-musl is tier 2 since 1.85 and +# can be moved to rust_linux_targets once MSRV is increased rust_nightly_linux_targets="\ aarch64-unknown-fuchsia \ armv5te-unknown-linux-gnueabi \ armv5te-unknown-linux-musleabi \ i686-pc-windows-gnu \ +powerpc64le-unknown-linux-musl \ riscv64gc-unknown-linux-gnu \ x86_64-fortanix-unknown-sgx \ x86_64-pc-solaris \ diff --git a/ci/wasi.sh b/ci/wasi.sh index e7896233ad7f3..4928681b0a270 100755 --- a/ci/wasi.sh +++ b/ci/wasi.sh @@ -11,12 +11,8 @@ apt-get install -y --no-install-recommends \ # Wasmtime is used to execute tests and wasi-sdk is used to compile tests. # Download appropriate versions here and configure various flags below. -# -# At the time of this writing wasmtime 24.0.0 is the latest release and -# wasi-sdk-24 is the latest release, that these numbers match is just -# coincidence. -wasmtime=24.0.0 -wasi_sdk=24 +wasmtime=35.0.0 +wasi_sdk=25 curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v$wasmtime/wasmtime-v$wasmtime-x86_64-linux.tar.xz | tar xJf - diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml index 6379029be07a9..6c9d8c82ab07f 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -9,17 +9,17 @@ license = "MIT OR Apache-2.0" repository = "https://github.com/rust-lang/libc" [dependencies] -cfg-if = "1.0.0" +cfg-if = "1.0.1" libc = { path = "..", version = "0.2.171", default-features = false } [dev-dependencies] -syn = { version = "2.0.91", features = ["full", "visit"] } -proc-macro2 = { version = "1.0.92", features = ["span-locations"] } +syn = { version = "2.0.104", features = ["full", "visit"] } +proc-macro2 = { version = "1.0.95", features = ["span-locations"] } glob = "0.3.2" annotate-snippets = { version = "0.11.5", features = ["testing-colors"] } [build-dependencies] -cc = "1.0.83" +cc = "1.2.29" # FIXME: Use fork ctest until the maintainer gets back. ctest2 = "0.4.3" regex = "1.11.1" @@ -65,36 +65,11 @@ name = "linux-termios" path = "test/linux_termios.rs" harness = false -[[test]] -name = "cmsg" -path = "test/cmsg.rs" -harness = true - -[[test]] -name = "makedev" -path = "test/makedev.rs" -harness = true - -[[test]] -name = "errqueue" -path = "test/errqueue.rs" -harness = true - -[[test]] -name = "sigrt" -path = "test/sigrt.rs" -harness = true - [[test]] name = "semver" path = "test/semver.rs" harness = false -[[test]] -name = "primitive_types" -path = "test/primitive_types.rs" -harness = true - [[test]] name = "style" path = "test/check_style.rs" diff --git a/libc-test/build.rs b/libc-test/build.rs index f620e0659c0eb..7ea00da688a19 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -4735,6 +4735,16 @@ fn test_linux(target: &str) { // FIXME(linux): Requires >= 6.6 kernel headers. "PROC_EVENT_NONZERO_EXIT" => true, + // FIXME(linux): Requires >= 6.14 kernel headers. + "SECBIT_EXEC_DENY_INTERACTIVE" + | "SECBIT_EXEC_DENY_INTERACTIVE_LOCKED" + | "SECBIT_EXEC_RESTRICT_FILE" + | "SECBIT_EXEC_RESTRICT_FILE_LOCKED" + | "SECURE_ALL_UNPRIVILEGED" => true, + + // FIXME(linux): Value changed in 6.14 + "SECURE_ALL_BITS" | "SECURE_ALL_LOCKS" => true, + _ => false, } }); @@ -5660,6 +5670,22 @@ fn test_aix(target: &str) { // values because non-unique values are being used which will // fail the test when _ALL_SOURCE is defined. "EWOULDBLOCK" | "ENOTEMPTY" => true, + + // FIXME(ctest): These constants are intended for use as the 'int request' argument + // to 'ioctl()'. However, the AIX headers do not explicitly define their types. If a + // value has the sign bit set, it gets sign-extended to a 64-bit value in the 64-bit + // mode, which fails the comparison with the Rust definitions, where the type is + //`c_int`. + "BIOCSETF" | "BIOCSBLEN" | "BIOCSRTIMEOUT" | "BIOCIMMEDIATE" | "BIOCSETIF" | "FIONBIO" + | "FIOASYNC" | "FIOSETOWN" | "TIOCSETD" | "TIOCMODS" | "TIOCSETP" | "TIOCSETN" + | "TIOCFLUSH" | "TIOCSETC" | "SIOCADDMULTI" | "SIOCADDRT" | "SIOCDARP" | "SIOCDELMULTI" + | "SIOCGIFADDR" | "SIOCGIFBRDADDR" | "SIOCGIFCONF" | "SIOCGIFDSTADDR" | "SIOCGIFFLAGS" + | "SIOCGIFHWADDR" | "SIOCGIFMETRIC" | "SIOCGIFMTU" | "SIOCGIFNETMASK" | "SIOCSARP" + | "SIOCSIFADDR" | "SIOCSIFBRDADDR" | "SIOCSIFDSTADDR" | "SIOCSIFFLAGS" + | "SIOCSIFMETRIC" | "SIOCSIFMTU" | "SIOCSIFNETMASK" | "TIOCUCNTL" | "TIOCCONS" + | "TIOCPKT" | "TIOCSWINSZ" | "TIOCLBIS" | "TIOCLBIC" | "TIOCLSET" | "TIOCSLTC" + | "TIOCSPGRP" | "TIOCSTI" | "TIOCMSET" | "TIOCMBIS" | "TIOCMBIC" | "TIOCREMOTE" => true, + _ => false, }); @@ -5690,6 +5716,9 @@ fn test_aix(target: &str) { ("__context64", "fpr") => true, ("__tm_context_t", "fpr") => true, + // The _ALL_SOURCE type of 'f_fsid' differs from POSIX's on AIX. + ("statvfs", "f_fsid") => true, + _ => false, } }); @@ -5750,6 +5779,15 @@ fn test_aix(target: &str) { // The function is only available under macro _KERNEL in 'proto_uipc.h'. "getpeereid" => true, + // The AIX signatures for these non-POSIX functions differ from + // those on platforms like Linux: some arguments are not marked + // with the 'const' qualifier, even though they are not modified. + // To be consistent with other platforms, 'const' is added to the + // Rust declarations. However, this causes a mismatch with the AIX + // header signatures. Skipping. + "setdomainname" | "settimeofday" | "statfs" | "statfs64" | "statx" | "swapoff" + | "swapon" | "utmpname" | "setgroups" => true, + _ => false, } }); diff --git a/libc-test/semver/aix.txt b/libc-test/semver/aix.txt index 38553abf3f80d..1f3324e213f54 100644 --- a/libc-test/semver/aix.txt +++ b/libc-test/semver/aix.txt @@ -2601,6 +2601,7 @@ waitpid wchar_t wcslen wcstombs +winsize wmemchr write writev diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 5ab4aef3d8a35..47a029dfc6b8f 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -2776,6 +2776,10 @@ SCTP_STATUS SCTP_STREAM_RESET_INCOMING SCTP_STREAM_RESET_OUTGOING SCTP_UNORDERED +SECBIT_EXEC_DENY_INTERACTIVE +SECBIT_EXEC_DENY_INTERACTIVE_LOCKED +SECBIT_EXEC_RESTRICT_FILE +SECBIT_EXEC_RESTRICT_FILE_LOCKED SECBIT_KEEP_CAPS SECBIT_KEEP_CAPS_LOCKED SECBIT_NOROOT @@ -2815,6 +2819,7 @@ SECCOMP_USER_NOTIF_FLAG_CONTINUE SECUREBITS_DEFAULT SECURE_ALL_BITS SECURE_ALL_LOCKS +SECURE_ALL_UNPRIVILEGED SEEK_DATA SEEK_HOLE SELFMAG diff --git a/libc-test/test/check_style.rs b/libc-test/test/check_style.rs index ee5e134891104..24f793e4feb86 100644 --- a/libc-test/test/check_style.rs +++ b/libc-test/test/check_style.rs @@ -16,21 +16,32 @@ use std::path::Path; use style::{Result, StyleChecker}; +/// Relative to `src/`. +const SKIP_PREFIXES: &[&str] = &[ + // Don't run the style checker on the reorganized portion of the crate while we figure + // out what style we want. + "new/", +]; + #[test] fn check_style() { - let root_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("../src"); - walk(&root_dir).unwrap(); + let src_root = Path::new(env!("CARGO_MANIFEST_DIR")).join("../src"); + walk(&src_root).unwrap(); eprintln!("good style!"); } -fn walk(root_dir: &Path) -> Result<()> { +fn walk(src_root: &Path) -> Result<()> { let mut style_checker = StyleChecker::new(); for entry in glob::glob(&format!( "{}/**/*.rs", - root_dir.to_str().expect("dir should be valid UTF-8") + src_root.to_str().expect("dir should be valid UTF-8") ))? { let entry = entry?; + let relpath = entry.strip_prefix(src_root).expect("known path"); + if SKIP_PREFIXES.iter().any(|pfx| relpath.starts_with(pfx)) { + continue; + } let name = entry .file_name() diff --git a/libc-test/test/cmsg.rs b/libc-test/tests/cmsg.rs similarity index 95% rename from libc-test/test/cmsg.rs rename to libc-test/tests/cmsg.rs index 763819019b771..bba658c498aa9 100644 --- a/libc-test/test/cmsg.rs +++ b/libc-test/tests/cmsg.rs @@ -55,7 +55,6 @@ mod t { #[cfg(not(target_arch = "sparc64"))] #[test] fn test_cmsg_nxthdr() { - use std::ptr; // Helps to align the buffer on the stack. #[repr(align(8))] struct Align8(T); @@ -65,7 +64,7 @@ mod t { let mut mhdr: msghdr = unsafe { mem::zeroed() }; for start_ofs in 0..64 { let pcmsghdr = buffer.0.as_mut_ptr().cast::(); - mhdr.msg_control = pcmsghdr as *mut c_void; + mhdr.msg_control = pcmsghdr.cast::(); mhdr.msg_controllen = (160 - start_ofs) as _; for cmsg_len in 0..64 { // Address must be a multiple of 0x4 for testing on AIX. @@ -80,7 +79,7 @@ mod t { let next = cmsg_nxthdr(&mhdr, pcmsghdr); assert_eq!(libc_next, next); - if libc_next != ptr::null_mut() { + if !libc_next.is_null() { (*libc_next).cmsg_len = next_cmsg_len; let libc_next = libc::CMSG_NXTHDR(&mhdr, pcmsghdr); let next = cmsg_nxthdr(&mhdr, pcmsghdr); diff --git a/libc-test/test/errqueue.rs b/libc-test/tests/errqueue.rs similarity index 100% rename from libc-test/test/errqueue.rs rename to libc-test/tests/errqueue.rs diff --git a/libc-test/test/makedev.rs b/libc-test/tests/makedev.rs similarity index 100% rename from libc-test/test/makedev.rs rename to libc-test/tests/makedev.rs diff --git a/libc-test/test/primitive_types.rs b/libc-test/tests/primitive_types.rs similarity index 100% rename from libc-test/test/primitive_types.rs rename to libc-test/tests/primitive_types.rs diff --git a/libc-test/test/sigrt.rs b/libc-test/tests/sigrt.rs similarity index 100% rename from libc-test/test/sigrt.rs rename to libc-test/tests/sigrt.rs diff --git a/src/lib.rs b/src/lib.rs index a96ffc6ffe8ed..fb901944b22bd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -25,6 +25,7 @@ #[macro_use] mod macros; +mod new; cfg_if! { if #[cfg(feature = "rustc-dep-of-std")] { @@ -34,6 +35,9 @@ cfg_if! { pub use core::ffi::c_void; +#[allow(unused_imports)] // needed while the module is empty on some platforms +pub use new::*; + cfg_if! { if #[cfg(windows)] { mod primitives; diff --git a/src/new/bionic/mod.rs b/src/new/bionic/mod.rs new file mode 100644 index 0000000000000..644a4ab96d90f --- /dev/null +++ b/src/new/bionic/mod.rs @@ -0,0 +1,2 @@ +mod sys; +pub use sys::*; diff --git a/src/new/bionic/sys/mod.rs b/src/new/bionic/sys/mod.rs new file mode 100644 index 0000000000000..fd96d0821ac88 --- /dev/null +++ b/src/new/bionic/sys/mod.rs @@ -0,0 +1,2 @@ +mod socket; +pub use socket::*; diff --git a/src/new/bionic/sys/socket.rs b/src/new/bionic/sys/socket.rs new file mode 100644 index 0000000000000..49af36fe93356 --- /dev/null +++ b/src/new/bionic/sys/socket.rs @@ -0,0 +1,51 @@ +//! Header: `bionic/libc/include/sys/socket.h` + +use crate::prelude::*; + +s! { + pub struct msghdr { + pub msg_name: *mut c_void, + pub msg_namelen: crate::socklen_t, + pub msg_iov: *mut crate::iovec, + pub msg_iovlen: size_t, + pub msg_control: *mut c_void, + pub msg_controllen: size_t, + pub msg_flags: c_int, + } + + pub struct cmsghdr { + pub cmsg_len: size_t, + pub cmsg_level: c_int, + pub cmsg_type: c_int, + } + + pub struct ucred { + pub pid: crate::pid_t, + pub uid: crate::uid_t, + pub gid: crate::gid_t, + } +} + +extern "C" { + pub fn recvmmsg( + sockfd: c_int, + msgvec: *mut crate::mmsghdr, + vlen: c_uint, + flags: c_int, + timeout: *const crate::timespec, + ) -> c_int; + pub fn sendmmsg( + sockfd: c_int, + msgvec: *const crate::mmsghdr, + vlen: c_uint, + flags: c_int, + ) -> c_int; + pub fn recvfrom( + socket: c_int, + buf: *mut c_void, + len: size_t, + flags: c_int, + addr: *mut crate::sockaddr, + addrlen: *mut crate::socklen_t, + ) -> ssize_t; +} diff --git a/src/new/linux_uapi/linux/can.rs b/src/new/linux_uapi/linux/can.rs new file mode 100644 index 0000000000000..8e48b4a869bb8 --- /dev/null +++ b/src/new/linux_uapi/linux/can.rs @@ -0,0 +1,139 @@ +//! Header: `uapi/linux/can.h` + +// FIXME(ctest): we shouldn't have to specify the path but garando doesn't find modules otherwise +#[path = "can/j1939.rs"] +pub(crate) mod j1939; +#[path = "can/raw.rs"] +pub(crate) mod raw; + +pub use j1939::*; +pub use raw::*; + +use crate::prelude::*; + +pub const CAN_EFF_FLAG: canid_t = 0x80000000; +pub const CAN_RTR_FLAG: canid_t = 0x40000000; +pub const CAN_ERR_FLAG: canid_t = 0x20000000; + +pub const CAN_SFF_MASK: canid_t = 0x000007FF; +pub const CAN_EFF_MASK: canid_t = 0x1FFFFFFF; +pub const CAN_ERR_MASK: canid_t = 0x1FFFFFFF; +pub const CANXL_PRIO_MASK: crate::canid_t = CAN_SFF_MASK; + +pub type canid_t = u32; + +pub const CAN_SFF_ID_BITS: c_int = 11; +pub const CAN_EFF_ID_BITS: c_int = 29; +pub const CANXL_PRIO_BITS: c_int = CAN_SFF_ID_BITS; + +pub type can_err_mask_t = u32; + +pub const CAN_MAX_DLC: c_int = 8; +pub const CAN_MAX_DLEN: usize = 8; + +pub const CANFD_MAX_DLC: c_int = 15; +pub const CANFD_MAX_DLEN: usize = 64; + +pub const CANXL_MIN_DLC: c_int = 0; +pub const CANXL_MAX_DLC: c_int = 2047; +pub const CANXL_MAX_DLC_MASK: c_int = 0x07FF; +pub const CANXL_MIN_DLEN: usize = 1; +pub const CANXL_MAX_DLEN: usize = 2048; + +s! { + #[repr(align(8))] + pub struct can_frame { + pub can_id: canid_t, + // FIXME(1.0): this field was renamed to `len` in Linux 5.11 + pub can_dlc: u8, + __pad: u8, + __res0: u8, + pub len8_dlc: u8, + pub data: [u8; CAN_MAX_DLEN], + } +} + +pub const CANFD_BRS: c_int = 0x01; +pub const CANFD_ESI: c_int = 0x02; +pub const CANFD_FDF: c_int = 0x04; + +s! { + #[repr(align(8))] + pub struct canfd_frame { + pub can_id: canid_t, + pub len: u8, + pub flags: u8, + __res0: u8, + __res1: u8, + pub data: [u8; CANFD_MAX_DLEN], + } +} + +pub const CANXL_XLF: c_int = 0x80; +pub const CANXL_SEC: c_int = 0x01; + +s! { + #[repr(align(8))] + pub struct canxl_frame { + pub prio: canid_t, + pub flags: u8, + pub sdt: u8, + pub len: u16, + pub af: u32, + pub data: [u8; CANXL_MAX_DLEN], + } +} + +pub const CAN_MTU: usize = size_of::(); +pub const CANFD_MTU: usize = size_of::(); +pub const CANXL_MTU: usize = size_of::(); +// FIXME(offset_of): use `core::mem::offset_of!` once that is available +// https://github.com/rust-lang/rfcs/pull/3308 +// pub const CANXL_HDR_SIZE: usize = core::mem::offset_of!(canxl_frame, data); +pub const CANXL_HDR_SIZE: usize = 12; +pub const CANXL_MIN_MTU: usize = CANXL_HDR_SIZE + 64; +pub const CANXL_MAX_MTU: usize = CANXL_MTU; + +pub const CAN_RAW: c_int = 1; +pub const CAN_BCM: c_int = 2; +pub const CAN_TP16: c_int = 3; +pub const CAN_TP20: c_int = 4; +pub const CAN_MCNET: c_int = 5; +pub const CAN_ISOTP: c_int = 6; +pub const CAN_J1939: c_int = 7; +pub const CAN_NPROTO: c_int = 8; + +pub const SOL_CAN_BASE: c_int = 100; + +s_no_extra_traits! { + pub struct sockaddr_can { + pub can_family: crate::sa_family_t, + pub can_ifindex: c_int, + pub can_addr: __c_anonymous_sockaddr_can_can_addr, + } + + pub union __c_anonymous_sockaddr_can_can_addr { + pub tp: __c_anonymous_sockaddr_can_tp, + pub j1939: __c_anonymous_sockaddr_can_j1939, + } +} + +s! { + pub struct __c_anonymous_sockaddr_can_tp { + pub rx_id: canid_t, + pub tx_id: canid_t, + } + + pub struct __c_anonymous_sockaddr_can_j1939 { + pub name: u64, + pub pgn: u32, + pub addr: u8, + } + + pub struct can_filter { + pub can_id: canid_t, + pub can_mask: canid_t, + } +} + +pub const CAN_INV_FILTER: canid_t = 0x20000000; diff --git a/src/new/linux_uapi/linux/can/j1939.rs b/src/new/linux_uapi/linux/can/j1939.rs new file mode 100644 index 0000000000000..fdf425ce6c0c1 --- /dev/null +++ b/src/new/linux_uapi/linux/can/j1939.rs @@ -0,0 +1,60 @@ +//! `linux/can/j1939.h` + +pub use crate::linux::can::*; + +pub const J1939_MAX_UNICAST_ADDR: c_uchar = 0xfd; +pub const J1939_IDLE_ADDR: c_uchar = 0xfe; +pub const J1939_NO_ADDR: c_uchar = 0xff; +pub const J1939_NO_NAME: c_ulong = 0; +pub const J1939_PGN_REQUEST: c_uint = 0x0ea00; +pub const J1939_PGN_ADDRESS_CLAIMED: c_uint = 0x0ee00; +pub const J1939_PGN_ADDRESS_COMMANDED: c_uint = 0x0fed8; +pub const J1939_PGN_PDU1_MAX: c_uint = 0x3ff00; +pub const J1939_PGN_MAX: c_uint = 0x3ffff; +pub const J1939_NO_PGN: c_uint = 0x40000; + +pub type pgn_t = u32; +pub type priority_t = u8; +pub type name_t = u64; + +pub const SOL_CAN_J1939: c_int = SOL_CAN_BASE + CAN_J1939; + +// FIXME(cleanup): these could use c_enum if it can accept anonymous enums. + +pub const SO_J1939_FILTER: c_int = 1; +pub const SO_J1939_PROMISC: c_int = 2; +pub const SO_J1939_SEND_PRIO: c_int = 3; +pub const SO_J1939_ERRQUEUE: c_int = 4; + +pub const SCM_J1939_DEST_ADDR: c_int = 1; +pub const SCM_J1939_DEST_NAME: c_int = 2; +pub const SCM_J1939_PRIO: c_int = 3; +pub const SCM_J1939_ERRQUEUE: c_int = 4; + +pub const J1939_NLA_PAD: c_int = 0; +pub const J1939_NLA_BYTES_ACKED: c_int = 1; +pub const J1939_NLA_TOTAL_SIZE: c_int = 2; +pub const J1939_NLA_PGN: c_int = 3; +pub const J1939_NLA_SRC_NAME: c_int = 4; +pub const J1939_NLA_DEST_NAME: c_int = 5; +pub const J1939_NLA_SRC_ADDR: c_int = 6; +pub const J1939_NLA_DEST_ADDR: c_int = 7; + +pub const J1939_EE_INFO_NONE: c_int = 0; +pub const J1939_EE_INFO_TX_ABORT: c_int = 1; +pub const J1939_EE_INFO_RX_RTS: c_int = 2; +pub const J1939_EE_INFO_RX_DPO: c_int = 3; +pub const J1939_EE_INFO_RX_ABORT: c_int = 4; + +s! { + pub struct j1939_filter { + pub name: name_t, + pub name_mask: name_t, + pub pgn: pgn_t, + pub pgn_mask: pgn_t, + pub addr: u8, + pub addr_mask: u8, + } +} + +pub const J1939_FILTER_MAX: c_int = 512; diff --git a/src/new/linux_uapi/linux/can/raw.rs b/src/new/linux_uapi/linux/can/raw.rs new file mode 100644 index 0000000000000..1f92a13edbba6 --- /dev/null +++ b/src/new/linux_uapi/linux/can/raw.rs @@ -0,0 +1,15 @@ +//! `linux/can/raw.h` + +pub use crate::linux::can::*; + +pub const SOL_CAN_RAW: c_int = SOL_CAN_BASE + CAN_RAW; +pub const CAN_RAW_FILTER_MAX: c_int = 512; + +// FIXME(cleanup): use `c_enum!`, which needs to be adapted to allow omitting a type. +pub const CAN_RAW_FILTER: c_int = 1; +pub const CAN_RAW_ERR_FILTER: c_int = 2; +pub const CAN_RAW_LOOPBACK: c_int = 3; +pub const CAN_RAW_RECV_OWN_MSGS: c_int = 4; +pub const CAN_RAW_FD_FRAMES: c_int = 5; +pub const CAN_RAW_JOIN_FILTERS: c_int = 6; +pub const CAN_RAW_XL_FRAMES: c_int = 7; diff --git a/src/new/linux_uapi/linux/mod.rs b/src/new/linux_uapi/linux/mod.rs new file mode 100644 index 0000000000000..4a9c04d6396b1 --- /dev/null +++ b/src/new/linux_uapi/linux/mod.rs @@ -0,0 +1,4 @@ +//! The `linux` directory within `include/uapi` in the Linux source tree. + +pub(crate) mod can; +pub use can::*; diff --git a/src/new/linux_uapi/mod.rs b/src/new/linux_uapi/mod.rs new file mode 100644 index 0000000000000..e0d4e094c435f --- /dev/null +++ b/src/new/linux_uapi/mod.rs @@ -0,0 +1,4 @@ +//! This directory maps to `include/uapi` in the Linux source tree. + +pub(crate) mod linux; +pub use linux::*; diff --git a/src/new/mod.rs b/src/new/mod.rs new file mode 100644 index 0000000000000..0a2a55b0f469b --- /dev/null +++ b/src/new/mod.rs @@ -0,0 +1,15 @@ +//! This module contains the future directory structure. If possible, new definitions should +//! get added here. +//! +//! Eventually everything should be moved over, and we will move this directory to the top +//! level in `src`. + +cfg_if! { + if #[cfg(target_os = "linux")] { + mod linux_uapi; + pub use linux_uapi::*; + } else if #[cfg(target_os = "android")] { + mod bionic; + pub use bionic::*; + } +} diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index 13feca788cb3d..1ee8c53b5505b 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -825,20 +825,20 @@ pub const DLT_PPP: c_int = 0x17; pub const DLT_FDDI: c_int = 0xf; pub const DLT_ATM: c_int = 0x25; pub const DLT_IPOIB: c_int = 0xc7; -pub const BIOCSETF: c_long = -2146418073; -pub const BIOCGRTIMEOUT: c_long = 1074807406; -pub const BIOCGBLEN: c_long = 1074020966; -pub const BIOCSBLEN: c_long = -1073462682; -pub const BIOCFLUSH: c_long = 536887912; -pub const BIOCPROMISC: c_long = 536887913; -pub const BIOCGDLT: c_long = 1074020970; -pub const BIOCSRTIMEOUT: c_long = -2146418067; -pub const BIOCGSTATS: c_long = 1074283119; -pub const BIOCIMMEDIATE: c_long = -2147204496; -pub const BIOCVERSION: c_long = 1074020977; -pub const BIOCSDEVNO: c_long = 536887922; -pub const BIOCGETIF: c_long = 1075855979; -pub const BIOCSETIF: c_long = -2145369492; +pub const BIOCSETF: c_int = 0x80104267; +pub const BIOCGRTIMEOUT: c_int = 0x4010426e; +pub const BIOCGBLEN: c_int = 0x40044266; +pub const BIOCSBLEN: c_int = 0xc0044266; +pub const BIOCFLUSH: c_int = 0x20004268; +pub const BIOCPROMISC: c_int = 0x20004269; +pub const BIOCGDLT: c_int = 0x4004426a; +pub const BIOCSRTIMEOUT: c_int = 0x8010426d; +pub const BIOCGSTATS: c_int = 0x4008426f; +pub const BIOCIMMEDIATE: c_int = 0x80044270; +pub const BIOCVERSION: c_int = 0x40044271; +pub const BIOCSDEVNO: c_int = 0x20004272; +pub const BIOCGETIF: c_int = 0x4020426b; +pub const BIOCSETIF: c_int = 0x8020426c; pub const BPF_ABS: c_int = 32; pub const BPF_ADD: c_int = 0; pub const BPF_ALIGNMENT: c_ulong = 4; @@ -1362,22 +1362,22 @@ pub const Q_SETQUOTA: c_int = 0x400; // sys/ioctl.h pub const IOCPARM_MASK: c_int = 0x7f; -pub const IOC_VOID: c_long = 536870912; -pub const IOC_OUT: c_long = 1073741824; -pub const IOC_IN: c_long = -2147483648; -pub const IOC_INOUT: c_long = IOC_IN | IOC_OUT; -pub const FIOCLEX: c_long = 536897025; -pub const FIONCLEX: c_long = 536897026; -pub const FIONREAD: c_long = 1074030207; -pub const FIONBIO: c_long = -2147195266; -pub const FIOASYNC: c_long = -2147195267; -pub const FIOSETOWN: c_long = -2147195268; -pub const FIOGETOWN: c_long = 1074030203; -pub const TIOCGETD: c_long = 1074033664; -pub const TIOCSETD: c_long = -2147191807; -pub const TIOCHPCL: c_long = 536900610; -pub const TIOCMODG: c_long = 1074033667; -pub const TIOCMODS: c_long = -2147191804; +pub const IOC_VOID: c_int = 0x20000000; +pub const IOC_OUT: c_int = 0x40000000; +pub const IOC_IN: c_int = 0x40000000 << 1; +pub const IOC_INOUT: c_int = IOC_IN | IOC_OUT; +pub const FIOCLEX: c_int = 0x20006601; +pub const FIONCLEX: c_int = 0x20006602; +pub const FIONREAD: c_int = 0x4004667f; +pub const FIONBIO: c_int = 0x8004667e; +pub const FIOASYNC: c_int = 0x8004667d; +pub const FIOSETOWN: c_int = 0x8004667c; +pub const FIOGETOWN: c_int = 0x4004667b; +pub const TIOCGETD: c_int = 0x40047400; +pub const TIOCSETD: c_int = 0x80047401; +pub const TIOCHPCL: c_int = 0x20007402; +pub const TIOCMODG: c_int = 0x40047403; +pub const TIOCMODS: c_int = 0x80047404; pub const TIOCM_LE: c_int = 0x1; pub const TIOCM_DTR: c_int = 0x2; pub const TIOCM_RTS: c_int = 0x4; @@ -1389,46 +1389,46 @@ pub const TIOCM_CD: c_int = 0x40; pub const TIOCM_RNG: c_int = 0x80; pub const TIOCM_RI: c_int = 0x80; pub const TIOCM_DSR: c_int = 0x100; -pub const TIOCGETP: c_long = 1074164744; -pub const TIOCSETP: c_long = -2147060727; -pub const TIOCSETN: c_long = -2147060726; -pub const TIOCEXCL: c_long = 536900621; -pub const TIOCNXCL: c_long = 536900622; -pub const TIOCFLUSH: c_long = -2147191792; -pub const TIOCSETC: c_long = -2147060719; -pub const TIOCGETC: c_long = 1074164754; +pub const TIOCGETP: c_int = 0x40067408; +pub const TIOCSETP: c_int = 0x80067409; +pub const TIOCSETN: c_int = 0x8006740a; +pub const TIOCEXCL: c_int = 0x2000740d; +pub const TIOCNXCL: c_int = 0x2000740e; +pub const TIOCFLUSH: c_int = 0x80047410; +pub const TIOCSETC: c_int = 0x80067411; +pub const TIOCGETC: c_int = 0x40067412; pub const TANDEM: c_int = 0x1; pub const CBREAK: c_int = 0x2; pub const LCASE: c_int = 0x4; pub const MDMBUF: c_int = 0x800000; pub const XTABS: c_int = 0xc00; -pub const SIOCADDMULTI: c_long = -2145359567; -pub const SIOCADDRT: c_long = -2143784438; -pub const SIOCDARP: c_long = -2142476000; -pub const SIOCDELMULTI: c_long = -2145359566; -pub const SIOCDELRT: c_long = -2143784437; -pub const SIOCDIFADDR: c_long = -2144835303; -pub const SIOCGARP: c_long = -1068734170; -pub const SIOCGIFADDR: c_long = -1071093471; -pub const SIOCGIFBRDADDR: c_long = -1071093469; -pub const SIOCGIFCONF: c_long = -1072666299; -pub const SIOCGIFDSTADDR: c_long = -1071093470; -pub const SIOCGIFFLAGS: c_long = -1071093487; -pub const SIOCGIFHWADDR: c_long = -1068209771; -pub const SIOCGIFMETRIC: c_long = -1071093481; -pub const SIOCGIFMTU: c_long = -1071093418; -pub const SIOCGIFNETMASK: c_long = -1071093467; -pub const SIOCSARP: c_long = -2142476002; -pub const SIOCSIFADDR: c_long = -2144835316; -pub const SIOCSIFBRDADDR: c_long = -2144835309; -pub const SIOCSIFDSTADDR: c_long = -2144835314; -pub const SIOCSIFFLAGS: c_long = -2144835312; -pub const SIOCSIFMETRIC: c_long = -2144835304; -pub const SIOCSIFMTU: c_long = -2144835240; -pub const SIOCSIFNETMASK: c_long = -2144835306; -pub const TIOCUCNTL: c_long = -2147191706; -pub const TIOCCONS: c_long = -2147191710; -pub const TIOCPKT: c_long = -2147191696; +pub const SIOCADDMULTI: c_int = 0x80206931; +pub const SIOCADDRT: c_int = 0x8038720a; +pub const SIOCDARP: c_int = 0x804c6920; +pub const SIOCDELMULTI: c_int = 0x80206932; +pub const SIOCDELRT: c_int = 0x8038720b; +pub const SIOCDIFADDR: c_int = 0x80286919; +pub const SIOCGARP: c_int = 0xc04c6926; +pub const SIOCGIFADDR: c_int = 0xc0286921; +pub const SIOCGIFBRDADDR: c_int = 0xc0286923; +pub const SIOCGIFCONF: c_int = 0xc0106945; +pub const SIOCGIFDSTADDR: c_int = 0xc0286922; +pub const SIOCGIFFLAGS: c_int = 0xc0286911; +pub const SIOCGIFHWADDR: c_int = 0xc0546995; +pub const SIOCGIFMETRIC: c_int = 0xc0286917; +pub const SIOCGIFMTU: c_int = 0xc0286956; +pub const SIOCGIFNETMASK: c_int = 0xc0286925; +pub const SIOCSARP: c_int = 0x804c691e; +pub const SIOCSIFADDR: c_int = 0x8028690c; +pub const SIOCSIFBRDADDR: c_int = 0x80286913; +pub const SIOCSIFDSTADDR: c_int = 0x8028690e; +pub const SIOCSIFFLAGS: c_int = 0x80286910; +pub const SIOCSIFMETRIC: c_int = 0x80286918; +pub const SIOCSIFMTU: c_int = 0x80286958; +pub const SIOCSIFNETMASK: c_int = 0x80286916; +pub const TIOCUCNTL: c_int = 0x80047466; +pub const TIOCCONS: c_int = 0x80047462; +pub const TIOCPKT: c_int = 0x80047470; pub const TIOCPKT_DATA: c_int = 0; pub const TIOCPKT_FLUSHREAD: c_int = 1; pub const TIOCPKT_FLUSHWRITE: c_int = 2; @@ -2092,31 +2092,31 @@ pub const TCOON: c_int = 1; pub const TCIOFF: c_int = 2; pub const TCION: c_int = 3; pub const TIOC: c_int = 0x5400; -pub const TIOCGWINSZ: c_long = 1074295912; -pub const TIOCSWINSZ: c_long = -2146929561; -pub const TIOCLBIS: c_long = -2147191681; -pub const TIOCLBIC: c_long = -2147191682; -pub const TIOCLSET: c_long = -2147191683; -pub const TIOCLGET: c_long = 1074033788; -pub const TIOCSBRK: c_long = 536900731; -pub const TIOCCBRK: c_long = 536900730; -pub const TIOCSDTR: c_long = 536900729; -pub const TIOCCDTR: c_long = 536900728; -pub const TIOCSLTC: c_long = -2147060619; -pub const TIOCGLTC: c_long = 1074164852; -pub const TIOCOUTQ: c_long = 1074033779; -pub const TIOCNOTTY: c_long = 536900721; -pub const TIOCSTOP: c_long = 536900719; -pub const TIOCSTART: c_long = 536900718; -pub const TIOCGPGRP: c_long = 1074033783; -pub const TIOCSPGRP: c_long = -2147191690; -pub const TIOCGSID: c_long = 1074033736; -pub const TIOCSTI: c_long = -2147388302; -pub const TIOCMSET: c_long = -2147191699; -pub const TIOCMBIS: c_long = -2147191700; -pub const TIOCMBIC: c_long = -2147191701; -pub const TIOCMGET: c_long = 1074033770; -pub const TIOCREMOTE: c_long = -2147191703; +pub const TIOCGWINSZ: c_int = 0x40087468; +pub const TIOCSWINSZ: c_int = 0x80087467; +pub const TIOCLBIS: c_int = 0x8004747f; +pub const TIOCLBIC: c_int = 0x8004747e; +pub const TIOCLSET: c_int = 0x8004747d; +pub const TIOCLGET: c_int = 0x4004747c; +pub const TIOCSBRK: c_int = 0x2000747b; +pub const TIOCCBRK: c_int = 0x2000747a; +pub const TIOCSDTR: c_int = 0x20007479; +pub const TIOCCDTR: c_int = 0x20007478; +pub const TIOCSLTC: c_int = 0x80067475; +pub const TIOCGLTC: c_int = 0x40067474; +pub const TIOCOUTQ: c_int = 0x40047473; +pub const TIOCNOTTY: c_int = 0x20007471; +pub const TIOCSTOP: c_int = 0x2000746f; +pub const TIOCSTART: c_int = 0x2000746e; +pub const TIOCGPGRP: c_int = 0x40047477; +pub const TIOCSPGRP: c_int = 0x80047476; +pub const TIOCGSID: c_int = 0x40047448; +pub const TIOCSTI: c_int = 0x80017472; +pub const TIOCMSET: c_int = 0x8004746d; +pub const TIOCMBIS: c_int = 0x8004746c; +pub const TIOCMBIC: c_int = 0x8004746b; +pub const TIOCMGET: c_int = 0x4004746a; +pub const TIOCREMOTE: c_int = 0x80047469; // sys/user.h pub const MAXCOMLEN: c_int = 32; @@ -3250,15 +3250,15 @@ extern "C" { #[link_name = "nsendmsg"] pub fn sendmsg(sockfd: c_int, msg: *const msghdr, flags: c_int) -> ssize_t; pub fn setcontext(ucp: *const ucontext_t) -> c_int; - pub fn setdomainname(name: *mut c_char, len: c_int) -> c_int; - pub fn setgroups(ngroups: c_int, ptr: *mut crate::gid_t) -> c_int; + pub fn setdomainname(name: *const c_char, len: c_int) -> c_int; + pub fn setgroups(ngroups: c_int, ptr: *const crate::gid_t) -> c_int; pub fn setgrent(); pub fn setmntent(filename: *const c_char, ty: *const c_char) -> *mut crate::FILE; pub fn setpriority(which: c_int, who: id_t, priority: c_int) -> c_int; pub fn setpwent(); pub fn setrlimit(resource: c_int, rlim: *const crate::rlimit) -> c_int; pub fn setrlimit64(resource: c_int, rlim: *const rlimit64) -> c_int; - pub fn settimeofday(tv: *mut crate::timeval, tz: *mut crate::timezone) -> c_int; + pub fn settimeofday(tv: *const crate::timeval, tz: *const crate::timezone) -> c_int; pub fn setitimer( which: c_int, new_value: *const crate::itimerval, @@ -3285,10 +3285,10 @@ extern "C" { pub fn srand48(seed: c_long); pub fn stat64(path: *const c_char, buf: *mut stat64) -> c_int; pub fn stat64at(dirfd: c_int, path: *const c_char, buf: *mut stat64, flags: c_int) -> c_int; - pub fn statfs(path: *mut c_char, buf: *mut statfs) -> c_int; - pub fn statfs64(path: *mut c_char, buf: *mut statfs64) -> c_int; + pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int; + pub fn statfs64(path: *const c_char, buf: *mut statfs64) -> c_int; pub fn statvfs64(path: *const c_char, buf: *mut statvfs64) -> c_int; - pub fn statx(path: *mut c_char, buf: *mut stat, length: c_int, command: c_int) -> c_int; + pub fn statx(path: *const c_char, buf: *mut stat, length: c_int, command: c_int) -> c_int; pub fn strcasecmp_l( string1: *const c_char, string2: *const c_char, @@ -3310,8 +3310,8 @@ extern "C" { pub fn strptime(s: *const c_char, format: *const c_char, tm: *mut crate::tm) -> *mut c_char; pub fn strsep(string: *mut *mut c_char, delim: *const c_char) -> *mut c_char; pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> c_int; - pub fn swapoff(puath: *mut c_char) -> c_int; - pub fn swapon(path: *mut c_char) -> c_int; + pub fn swapoff(path: *const c_char) -> c_int; + pub fn swapon(path: *const c_char) -> c_int; pub fn sync(); pub fn telldir(dirp: *mut crate::DIR) -> c_long; pub fn timer_create( @@ -3332,7 +3332,7 @@ extern "C" { pub fn uname(buf: *mut crate::utsname) -> c_int; pub fn updwtmp(file: *const c_char, u: *const utmp); pub fn uselocale(loc: crate::locale_t) -> crate::locale_t; - pub fn utmpname(file: *mut c_char) -> c_int; + pub fn utmpname(file: *const c_char) -> c_int; pub fn utimensat( dirfd: c_int, path: *const c_char, diff --git a/src/unix/aix/powerpc64.rs b/src/unix/aix/powerpc64.rs index f379e2df71898..b2b7ea88f6e4e 100644 --- a/src/unix/aix/powerpc64.rs +++ b/src/unix/aix/powerpc64.rs @@ -29,7 +29,7 @@ s! { pub f_files: crate::fsfilcnt_t, pub f_ffree: crate::fsfilcnt_t, pub f_favail: crate::fsfilcnt_t, - pub f_fsid: crate::fsid_t, + pub f_fsid: c_ulong, pub f_basetype: [c_char; 16], pub f_flag: c_ulong, pub f_namemax: c_ulong, diff --git a/src/unix/bsd/apple/b32/mod.rs b/src/unix/bsd/apple/b32/mod.rs index bdc986da168a8..bd6762558f508 100644 --- a/src/unix/bsd/apple/b32/mod.rs +++ b/src/unix/bsd/apple/b32/mod.rs @@ -60,7 +60,6 @@ s_no_extra_traits! { __opaque: [c_char; crate::__PTHREAD_ONCE_SIZE__], } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f64; 2], diff --git a/src/unix/bsd/apple/b64/aarch64/mod.rs b/src/unix/bsd/apple/b64/aarch64/mod.rs index e300b76ae8228..a13013c09b03b 100644 --- a/src/unix/bsd/apple/b64/aarch64/mod.rs +++ b/src/unix/bsd/apple/b64/aarch64/mod.rs @@ -47,7 +47,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] pub struct max_align_t { priv_: f64, } diff --git a/src/unix/bsd/apple/b64/x86_64/mod.rs b/src/unix/bsd/apple/b64/x86_64/mod.rs index cfb1b8a8a5976..5365becf66c3e 100644 --- a/src/unix/bsd/apple/b64/x86_64/mod.rs +++ b/src/unix/bsd/apple/b64/x86_64/mod.rs @@ -172,7 +172,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f64; 2], diff --git a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs index 27addc6361d1e..fa85f11ce2812 100644 --- a/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs @@ -92,7 +92,6 @@ s_no_extra_traits! { pub a_un: __c_anonymous_elf64_auxv_union, } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4], diff --git a/src/unix/cygwin/mod.rs b/src/unix/cygwin/mod.rs index 2353f68dbc153..fde2c18936e71 100644 --- a/src/unix/cygwin/mod.rs +++ b/src/unix/cygwin/mod.rs @@ -453,7 +453,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4], diff --git a/src/unix/linux_like/android/b32/x86/mod.rs b/src/unix/linux_like/android/b32/x86/mod.rs index edbfd38552cb5..ca46c3c462246 100644 --- a/src/unix/linux_like/android/b32/x86/mod.rs +++ b/src/unix/linux_like/android/b32/x86/mod.rs @@ -51,7 +51,6 @@ s_no_extra_traits! { __fpregs_mem: _libc_fpstate, } - #[allow(missing_debug_implementations)] #[repr(align(8))] pub struct max_align_t { priv_: [f64; 2], diff --git a/src/unix/linux_like/android/b64/aarch64/mod.rs b/src/unix/linux_like/android/b64/aarch64/mod.rs index b678eb8da6aa4..3c6131089ee89 100644 --- a/src/unix/linux_like/android/b64/aarch64/mod.rs +++ b/src/unix/linux_like/android/b64/aarch64/mod.rs @@ -85,7 +85,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f32; 8], diff --git a/src/unix/linux_like/android/b64/riscv64/mod.rs b/src/unix/linux_like/android/b64/riscv64/mod.rs index c4dc98e010aed..ca8c727164ad7 100644 --- a/src/unix/linux_like/android/b64/riscv64/mod.rs +++ b/src/unix/linux_like/android/b64/riscv64/mod.rs @@ -55,7 +55,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f32; 8], diff --git a/src/unix/linux_like/android/b64/x86_64/mod.rs b/src/unix/linux_like/android/b64/x86_64/mod.rs index 3288f05e076aa..0fddeb7bc267f 100644 --- a/src/unix/linux_like/android/b64/x86_64/mod.rs +++ b/src/unix/linux_like/android/b64/x86_64/mod.rs @@ -112,7 +112,6 @@ s_no_extra_traits! { uc_sigmask64: crate::sigset64_t, } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4], diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 7201b09982eb7..100008ce5d8e9 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -1,6 +1,7 @@ //! Android-specific definitions for linux-like values use crate::prelude::*; +use crate::{cmsghdr, msghdr}; cfg_if! { if #[cfg(doc)] { @@ -74,22 +75,6 @@ s! { __val: [c_int; 2], } - pub struct msghdr { - pub msg_name: *mut c_void, - pub msg_namelen: crate::socklen_t, - pub msg_iov: *mut crate::iovec, - pub msg_iovlen: size_t, - pub msg_control: *mut c_void, - pub msg_controllen: size_t, - pub msg_flags: c_int, - } - - pub struct cmsghdr { - pub cmsg_len: size_t, - pub cmsg_level: c_int, - pub cmsg_type: c_int, - } - pub struct termios { pub c_iflag: crate::tcflag_t, pub c_oflag: crate::tcflag_t, @@ -203,12 +188,6 @@ s! { pub it_value: crate::timespec, } - pub struct ucred { - pub pid: crate::pid_t, - pub uid: crate::uid_t, - pub gid: crate::gid_t, - } - pub struct genlmsghdr { pub cmd: u8, pub version: u8, @@ -3501,14 +3480,6 @@ extern "C" { pub fn madvise(addr: *mut c_void, len: size_t, advice: c_int) -> c_int; pub fn msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int; pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int; - pub fn recvfrom( - socket: c_int, - buf: *mut c_void, - len: size_t, - flags: c_int, - addr: *mut crate::sockaddr, - addrlen: *mut crate::socklen_t, - ) -> ssize_t; pub fn getnameinfo( sa: *const crate::sockaddr, salen: crate::socklen_t, @@ -3821,19 +3792,6 @@ extern "C" { ) -> c_int; pub fn __errno() -> *mut c_int; pub fn inotify_rm_watch(fd: c_int, wd: u32) -> c_int; - pub fn sendmmsg( - sockfd: c_int, - msgvec: *const crate::mmsghdr, - vlen: c_uint, - flags: c_int, - ) -> c_int; - pub fn recvmmsg( - sockfd: c_int, - msgvec: *mut crate::mmsghdr, - vlen: c_uint, - flags: c_int, - timeout: *const crate::timespec, - ) -> c_int; pub fn inotify_init() -> c_int; pub fn inotify_init1(flags: c_int) -> c_int; pub fn inotify_add_watch(fd: c_int, path: *const c_char, mask: u32) -> c_int; diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs index 1d00f3d404ea1..7a43670536e4f 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -315,7 +315,6 @@ s! { pub ha: [c_uchar; crate::MAX_ADDR_LEN], } - #[allow(missing_debug_implementations)] #[repr(align(4))] pub struct pthread_mutex_t { size: [u8; crate::__SIZEOF_PTHREAD_MUTEX_T], @@ -382,7 +381,6 @@ s_no_extra_traits! { size: [u8; crate::__SIZEOF_PTHREAD_COND_T], } - #[allow(missing_debug_implementations)] #[repr(align(8))] pub struct max_align_t { priv_: [f64; 3], diff --git a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs index 3f81de3545de6..900851ab5f42c 100644 --- a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs @@ -232,13 +232,11 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(8))] pub struct max_align_t { priv_: [i64; 2], } - #[allow(missing_debug_implementations)] #[repr(align(8))] pub struct ucontext_t { pub uc_flags: c_ulong, diff --git a/src/unix/linux_like/linux/gnu/b32/csky/mod.rs b/src/unix/linux_like/linux/gnu/b32/csky/mod.rs index b8f73e2d5414a..95881894a4b94 100644 --- a/src/unix/linux_like/linux/gnu/b32/csky/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/csky/mod.rs @@ -168,7 +168,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(8))] pub struct max_align_t { priv_: [i64; 2], diff --git a/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs b/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs index 71b3dd316394c..d614fddeca9d9 100644 --- a/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs @@ -161,7 +161,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(2))] pub struct max_align_t { priv_: [i8; 20], diff --git a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs index 507672f8a974c..db0505a2473de 100644 --- a/src/unix/linux_like/linux/gnu/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/mips/mod.rs @@ -252,7 +252,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(8))] pub struct max_align_t { priv_: [f32; 4], diff --git a/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs b/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs index d9599ddb582fc..b04ee50462745 100644 --- a/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs @@ -197,7 +197,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] pub struct ucontext_t { pub __uc_flags: c_ulong, pub uc_link: *mut ucontext_t, @@ -206,7 +205,6 @@ s_no_extra_traits! { pub uc_mcontext: mcontext_t, } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct mcontext_t { pub __gregs: [c_ulong; 32], @@ -219,19 +217,16 @@ s_no_extra_traits! { pub __q: __riscv_mc_q_ext_state, } - #[allow(missing_debug_implementations)] pub struct __riscv_mc_f_ext_state { pub __f: [c_uint; 32], pub __fcsr: c_uint, } - #[allow(missing_debug_implementations)] pub struct __riscv_mc_d_ext_state { pub __f: [c_ulonglong; 32], pub __fcsr: c_uint, } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct __riscv_mc_q_ext_state { pub __f: [c_ulonglong; 64], diff --git a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs index cfe2101b4af77..f9d6a95ed036e 100644 --- a/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs @@ -198,7 +198,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(8))] pub struct max_align_t { priv_: [i64; 3], diff --git a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs index da6af94375e4f..5f0dfe90adf81 100644 --- a/src/unix/linux_like/linux/gnu/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/x86/mod.rs @@ -287,7 +287,6 @@ s_no_extra_traits! { __ssp: [c_ulong; 4], } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f64; 6], diff --git a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs index b310af8e4e531..28b4e40fde543 100644 --- a/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs @@ -242,7 +242,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f32; 8], 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 c67177c7067f9..8f15ce4d1529a 100644 --- a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs @@ -237,7 +237,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4], diff --git a/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs b/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs index 8bd9542a62f1e..56f30cd08a482 100644 --- a/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs @@ -187,7 +187,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4], diff --git a/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs b/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs index 5073a8af7a41e..047efe55b1a38 100644 --- a/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs @@ -194,7 +194,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [i64; 4], 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 6da6eeccca486..bfbc8ee5cf683 100644 --- a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs @@ -247,7 +247,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] pub struct ucontext_t { pub __uc_flags: c_ulong, pub uc_link: *mut ucontext_t, @@ -256,7 +255,6 @@ s_no_extra_traits! { pub uc_mcontext: mcontext_t, } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct mcontext_t { pub __gregs: [c_ulong; 32], @@ -269,19 +267,16 @@ s_no_extra_traits! { pub __q: __riscv_mc_q_ext_state, } - #[allow(missing_debug_implementations)] pub struct __riscv_mc_f_ext_state { pub __f: [c_uint; 32], pub __fcsr: c_uint, } - #[allow(missing_debug_implementations)] pub struct __riscv_mc_d_ext_state { pub __f: [c_ulonglong; 32], pub __fcsr: c_uint, } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct __riscv_mc_q_ext_state { pub __f: [c_ulonglong; 64], diff --git a/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs b/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs index cdbd9b43b28c7..c4203dc0b2da4 100644 --- a/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs @@ -197,7 +197,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [i64; 4], diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs index ea8aeda42d63d..f4555ee420230 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs @@ -317,7 +317,6 @@ s_no_extra_traits! { // __ssp: [c_ulonglong; 4], } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4], diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index e4874760155b1..7fd24d480c53a 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -58,15 +58,6 @@ cfg_if! { } } -// linux/can.h -pub type canid_t = u32; - -// linux/can/j1939.h -pub type can_err_mask_t = u32; -pub type pgn_t = u32; -pub type priority_t = u8; -pub type name_t = u64; - pub type iconv_t = *mut c_void; // linux/sctp.h @@ -730,33 +721,6 @@ s! { pub ee_data: u32, } - // linux/can.h - pub struct __c_anonymous_sockaddr_can_tp { - pub rx_id: canid_t, - pub tx_id: canid_t, - } - - pub struct __c_anonymous_sockaddr_can_j1939 { - pub name: u64, - pub pgn: u32, - pub addr: u8, - } - - pub struct can_filter { - pub can_id: canid_t, - pub can_mask: canid_t, - } - - // linux/can/j1939.h - pub struct j1939_filter { - pub name: name_t, - pub name_mask: name_t, - pub pgn: pgn_t, - pub pgn_mask: pgn_t, - pub addr: u8, - pub addr_mask: u8, - } - // linux/seccomp.h pub struct seccomp_data { pub nr: c_int, @@ -1574,18 +1538,15 @@ s_no_extra_traits! { pub sched_period: crate::__u64, } - #[allow(missing_debug_implementations)] pub union tpacket_req_u { pub req: crate::tpacket_req, pub req3: crate::tpacket_req3, } - #[allow(missing_debug_implementations)] pub union tpacket_bd_header_u { pub bh1: crate::tpacket_hdr_v1, } - #[allow(missing_debug_implementations)] pub struct tpacket_block_desc { pub version: __u32, pub offset_to_priv: __u32, @@ -1746,60 +1707,11 @@ s_no_extra_traits! { } // linux/net_tstamp.h - #[allow(missing_debug_implementations)] pub struct sock_txtime { pub clockid: crate::clockid_t, pub flags: __u32, } - // linux/can.h - #[repr(align(8))] - #[allow(missing_debug_implementations)] - pub struct can_frame { - pub can_id: canid_t, - // FIXME(1.0): this field was renamed to `len` in Linux 5.11 - pub can_dlc: u8, - __pad: u8, - __res0: u8, - pub len8_dlc: u8, - pub data: [u8; CAN_MAX_DLEN], - } - - #[repr(align(8))] - #[allow(missing_debug_implementations)] - pub struct canfd_frame { - pub can_id: canid_t, - pub len: u8, - pub flags: u8, - __res0: u8, - __res1: u8, - pub data: [u8; CANFD_MAX_DLEN], - } - - #[repr(align(8))] - #[allow(missing_debug_implementations)] - pub struct canxl_frame { - pub prio: canid_t, - pub flags: u8, - pub sdt: u8, - pub len: u16, - pub af: u32, - pub data: [u8; CANXL_MAX_DLEN], - } - - #[allow(missing_debug_implementations)] - pub union __c_anonymous_sockaddr_can_can_addr { - pub tp: __c_anonymous_sockaddr_can_tp, - pub j1939: __c_anonymous_sockaddr_can_j1939, - } - - #[allow(missing_debug_implementations)] - pub struct sockaddr_can { - pub can_family: crate::sa_family_t, - pub can_ifindex: c_int, - pub can_addr: __c_anonymous_sockaddr_can_can_addr, - } - // linux/wireless.h pub union iwreq_data { pub name: [c_char; crate::IFNAMSIZ], @@ -1848,7 +1760,6 @@ s_no_extra_traits! { pub rsv: [c_uint; 4], } - #[allow(missing_debug_implementations)] pub struct ptp_perout_request { pub anonymous_1: __c_anonymous_ptp_perout_request_1, pub period: ptp_clock_time, @@ -1858,7 +1769,6 @@ s_no_extra_traits! { } // linux/if_xdp.h - #[allow(missing_debug_implementations)] pub struct xsk_tx_metadata { pub flags: crate::__u64, pub xsk_tx_metadata_union: __c_anonymous_xsk_tx_metadata_union, @@ -4872,11 +4782,31 @@ pub const SECBIT_NO_CAP_AMBIENT_RAISE: c_int = issecure_mask(SECURE_NO_CAP_AMBIE pub const SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED: c_int = issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE_LOCKED); +const SECURE_EXEC_RESTRICT_FILE: c_int = 8; +const SECURE_EXEC_RESTRICT_FILE_LOCKED: c_int = 9; + +pub const SECBIT_EXEC_RESTRICT_FILE: c_int = issecure_mask(SECURE_EXEC_RESTRICT_FILE); +pub const SECBIT_EXEC_RESTRICT_FILE_LOCKED: c_int = issecure_mask(SECURE_EXEC_RESTRICT_FILE_LOCKED); + +const SECURE_EXEC_DENY_INTERACTIVE: c_int = 10; +const SECURE_EXEC_DENY_INTERACTIVE_LOCKED: c_int = 11; + +pub const SECBIT_EXEC_DENY_INTERACTIVE: c_int = issecure_mask(SECURE_EXEC_DENY_INTERACTIVE); +pub const SECBIT_EXEC_DENY_INTERACTIVE_LOCKED: c_int = + issecure_mask(SECURE_EXEC_DENY_INTERACTIVE_LOCKED); + pub const SECUREBITS_DEFAULT: c_int = 0x00000000; -pub const SECURE_ALL_BITS: c_int = - SECBIT_NOROOT | SECBIT_NO_SETUID_FIXUP | SECBIT_KEEP_CAPS | SECBIT_NO_CAP_AMBIENT_RAISE; +pub const SECURE_ALL_BITS: c_int = SECBIT_NOROOT + | SECBIT_NO_SETUID_FIXUP + | SECBIT_KEEP_CAPS + | SECBIT_NO_CAP_AMBIENT_RAISE + | SECBIT_EXEC_RESTRICT_FILE + | SECBIT_EXEC_DENY_INTERACTIVE; pub const SECURE_ALL_LOCKS: c_int = SECURE_ALL_BITS << 1; +pub const SECURE_ALL_UNPRIVILEGED: c_int = + issecure_mask(SECURE_EXEC_RESTRICT_FILE) | issecure_mask(SECURE_EXEC_DENY_INTERACTIVE); + const fn issecure_mask(x: c_int) -> c_int { 1 << x } @@ -5412,112 +5342,6 @@ pub const EDOM: c_int = 33; pub const ERANGE: c_int = 34; pub const EWOULDBLOCK: c_int = EAGAIN; -// linux/can.h -pub const CAN_EFF_FLAG: canid_t = 0x80000000; -pub const CAN_RTR_FLAG: canid_t = 0x40000000; -pub const CAN_ERR_FLAG: canid_t = 0x20000000; -pub const CAN_SFF_MASK: canid_t = 0x000007FF; -pub const CAN_EFF_MASK: canid_t = 0x1FFFFFFF; -pub const CAN_ERR_MASK: canid_t = 0x1FFFFFFF; -pub const CANXL_PRIO_MASK: crate::canid_t = CAN_SFF_MASK; - -pub const CAN_SFF_ID_BITS: c_int = 11; -pub const CAN_EFF_ID_BITS: c_int = 29; -pub const CANXL_PRIO_BITS: c_int = CAN_SFF_ID_BITS; - -pub const CAN_MAX_DLC: c_int = 8; -pub const CAN_MAX_DLEN: usize = 8; -pub const CANFD_MAX_DLC: c_int = 15; -pub const CANFD_MAX_DLEN: usize = 64; - -pub const CANFD_BRS: c_int = 0x01; -pub const CANFD_ESI: c_int = 0x02; -pub const CANFD_FDF: c_int = 0x04; - -pub const CANXL_MIN_DLC: c_int = 0; -pub const CANXL_MAX_DLC: c_int = 2047; -pub const CANXL_MAX_DLC_MASK: c_int = 0x07FF; -pub const CANXL_MIN_DLEN: usize = 1; -pub const CANXL_MAX_DLEN: usize = 2048; - -pub const CANXL_XLF: c_int = 0x80; -pub const CANXL_SEC: c_int = 0x01; - -pub const CAN_MTU: usize = size_of::(); -pub const CANFD_MTU: usize = size_of::(); -pub const CANXL_MTU: usize = size_of::(); -// FIXME(offset_of): use `core::mem::offset_of!` once that is available -// https://github.com/rust-lang/rfcs/pull/3308 -// pub const CANXL_HDR_SIZE: usize = core::mem::offset_of!(canxl_frame, data); -pub const CANXL_HDR_SIZE: usize = 12; -pub const CANXL_MIN_MTU: usize = CANXL_HDR_SIZE + 64; -pub const CANXL_MAX_MTU: usize = CANXL_MTU; - -pub const CAN_RAW: c_int = 1; -pub const CAN_BCM: c_int = 2; -pub const CAN_TP16: c_int = 3; -pub const CAN_TP20: c_int = 4; -pub const CAN_MCNET: c_int = 5; -pub const CAN_ISOTP: c_int = 6; -pub const CAN_J1939: c_int = 7; -pub const CAN_NPROTO: c_int = 8; - -pub const SOL_CAN_BASE: c_int = 100; - -pub const CAN_INV_FILTER: canid_t = 0x20000000; -pub const CAN_RAW_FILTER_MAX: c_int = 512; - -// linux/can/raw.h -pub const SOL_CAN_RAW: c_int = SOL_CAN_BASE + CAN_RAW; -pub const CAN_RAW_FILTER: c_int = 1; -pub const CAN_RAW_ERR_FILTER: c_int = 2; -pub const CAN_RAW_LOOPBACK: c_int = 3; -pub const CAN_RAW_RECV_OWN_MSGS: c_int = 4; -pub const CAN_RAW_FD_FRAMES: c_int = 5; -pub const CAN_RAW_JOIN_FILTERS: c_int = 6; -pub const CAN_RAW_XL_FRAMES: c_int = 7; - -// linux/can/j1939.h -pub const SOL_CAN_J1939: c_int = SOL_CAN_BASE + CAN_J1939; - -pub const J1939_MAX_UNICAST_ADDR: c_uchar = 0xfd; -pub const J1939_IDLE_ADDR: c_uchar = 0xfe; -pub const J1939_NO_ADDR: c_uchar = 0xff; -pub const J1939_NO_NAME: c_ulong = 0; -pub const J1939_PGN_REQUEST: c_uint = 0x0ea00; -pub const J1939_PGN_ADDRESS_CLAIMED: c_uint = 0x0ee00; -pub const J1939_PGN_ADDRESS_COMMANDED: c_uint = 0x0fed8; -pub const J1939_PGN_PDU1_MAX: c_uint = 0x3ff00; -pub const J1939_PGN_MAX: c_uint = 0x3ffff; -pub const J1939_NO_PGN: c_uint = 0x40000; - -pub const SO_J1939_FILTER: c_int = 1; -pub const SO_J1939_PROMISC: c_int = 2; -pub const SO_J1939_SEND_PRIO: c_int = 3; -pub const SO_J1939_ERRQUEUE: c_int = 4; - -pub const SCM_J1939_DEST_ADDR: c_int = 1; -pub const SCM_J1939_DEST_NAME: c_int = 2; -pub const SCM_J1939_PRIO: c_int = 3; -pub const SCM_J1939_ERRQUEUE: c_int = 4; - -pub const J1939_NLA_PAD: c_int = 0; -pub const J1939_NLA_BYTES_ACKED: c_int = 1; -pub const J1939_NLA_TOTAL_SIZE: c_int = 2; -pub const J1939_NLA_PGN: c_int = 3; -pub const J1939_NLA_SRC_NAME: c_int = 4; -pub const J1939_NLA_DEST_NAME: c_int = 5; -pub const J1939_NLA_SRC_ADDR: c_int = 6; -pub const J1939_NLA_DEST_ADDR: c_int = 7; - -pub const J1939_EE_INFO_NONE: c_int = 0; -pub const J1939_EE_INFO_TX_ABORT: c_int = 1; -pub const J1939_EE_INFO_RX_RTS: c_int = 2; -pub const J1939_EE_INFO_RX_DPO: c_int = 3; -pub const J1939_EE_INFO_RX_ABORT: c_int = 4; - -pub const J1939_FILTER_MAX: c_int = 512; - // linux/sctp.h pub const SCTP_FUTURE_ASSOC: c_int = 0; pub const SCTP_CURRENT_ASSOC: c_int = 1; diff --git a/src/unix/linux_like/linux/musl/b32/arm/mod.rs b/src/unix/linux_like/linux/musl/b32/arm/mod.rs index b9be033a2c2c4..a04f05ea50db8 100644 --- a/src/unix/linux_like/linux/musl/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/arm/mod.rs @@ -133,7 +133,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] pub struct ucontext_t { pub uc_flags: c_ulong, pub uc_link: *mut ucontext_t, @@ -143,7 +142,6 @@ s_no_extra_traits! { pub uc_regspace: [c_ulonglong; 64], } - #[allow(missing_debug_implementations)] #[repr(align(8))] pub struct max_align_t { priv_: (i64, i64), diff --git a/src/unix/linux_like/linux/musl/b32/mips/mod.rs b/src/unix/linux_like/linux/musl/b32/mips/mod.rs index 3f2b73decbec6..4f29b27ad0a14 100644 --- a/src/unix/linux_like/linux/musl/b32/mips/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/mips/mod.rs @@ -147,7 +147,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(8))] pub struct max_align_t { priv_: [f32; 4], diff --git a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs index 9b76105969343..0e2f53edcad4c 100644 --- a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs @@ -102,7 +102,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(8))] pub struct max_align_t { priv_: (i64, f64), diff --git a/src/unix/linux_like/linux/musl/b32/x86/mod.rs b/src/unix/linux_like/linux/musl/b32/x86/mod.rs index 583e0a51eacb0..ae8b7d761dd6f 100644 --- a/src/unix/linux_like/linux/musl/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/x86/mod.rs @@ -138,7 +138,6 @@ s_no_extra_traits! { __private: [u8; 112], } - #[allow(missing_debug_implementations)] #[repr(align(8))] pub struct max_align_t { priv_: [f64; 3], diff --git a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs index 243247edafc46..67151a8d37116 100644 --- a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs @@ -129,7 +129,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f32; 8], diff --git a/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs b/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs index 17724b528415e..e014fbf48c0da 100644 --- a/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs @@ -114,7 +114,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4], diff --git a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs index cf851c4660113..8389af961cf58 100644 --- a/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs @@ -86,7 +86,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] pub struct ucontext_t { pub __uc_flags: c_ulong, pub uc_link: *mut ucontext_t, @@ -95,7 +94,6 @@ s_no_extra_traits! { pub uc_mcontext: mcontext_t, } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct mcontext_t { pub __gregs: [c_ulong; 32], @@ -108,19 +106,16 @@ s_no_extra_traits! { pub __q: __riscv_mc_q_ext_state, } - #[allow(missing_debug_implementations)] pub struct __riscv_mc_f_ext_state { pub __f: [c_uint; 32], pub __fcsr: c_uint, } - #[allow(missing_debug_implementations)] pub struct __riscv_mc_d_ext_state { pub __f: [c_ulonglong; 32], pub __fcsr: c_uint, } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct __riscv_mc_q_ext_state { pub __f: [c_ulonglong; 64], diff --git a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs index 17a9f6ce47475..ce8319f015e97 100644 --- a/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs @@ -171,7 +171,6 @@ s_no_extra_traits! { __private: [u8; 512], } - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4], diff --git a/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs b/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs index b108e77c7cd32..380077711d797 100644 --- a/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs +++ b/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs @@ -28,7 +28,7 @@ s! { } } -#[allow(missing_debug_implementations)] +#[cfg_attr(feature = "extra_traits", derive(Debug))] pub struct pthread_attr_t { pub __detachstate: c_int, pub __schedpolicy: c_int, diff --git a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs index fbc87be74125d..1a2e4bcc1a897 100644 --- a/src/unix/linux_like/linux/uclibc/x86_64/mod.rs +++ b/src/unix/linux_like/linux/uclibc/x86_64/mod.rs @@ -293,7 +293,6 @@ s! { } s_no_extra_traits! { - #[allow(missing_debug_implementations)] pub struct dirent { pub d_ino: crate::ino64_t, pub d_off: off64_t, diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 4e0d6124d880a..98a093db2e742 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1792,24 +1792,24 @@ const_fn! { } f! { - pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { - if (*mhdr).msg_controllen as usize >= size_of::() { - (*mhdr).msg_control.cast::() + pub fn CMSG_FIRSTHDR(mhdr: *const crate::msghdr) -> *mut crate::cmsghdr { + if (*mhdr).msg_controllen as usize >= size_of::() { + (*mhdr).msg_control.cast::() } else { - core::ptr::null_mut::() + core::ptr::null_mut::() } } - pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut c_uchar { + pub fn CMSG_DATA(cmsg: *const crate::cmsghdr) -> *mut c_uchar { cmsg.offset(1) as *mut c_uchar } pub {const} fn CMSG_SPACE(length: c_uint) -> c_uint { - (CMSG_ALIGN(length as usize) + CMSG_ALIGN(size_of::())) as c_uint + (CMSG_ALIGN(length as usize) + CMSG_ALIGN(size_of::())) as c_uint } pub {const} fn CMSG_LEN(length: c_uint) -> c_uint { - CMSG_ALIGN(size_of::()) as c_uint + length + CMSG_ALIGN(size_of::()) as c_uint + length } pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () { diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 96209e7e72cd7..941f2faa99217 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -160,7 +160,6 @@ s! { pub revents: c_short, } - #[cfg(not(target_os = "aix"))] pub struct winsize { pub ws_row: c_ushort, pub ws_col: c_ushort, diff --git a/src/unix/solarish/solaris.rs b/src/unix/solarish/solaris.rs index 097ff1c9cd6bd..58b097a16269b 100644 --- a/src/unix/solarish/solaris.rs +++ b/src/unix/solarish/solaris.rs @@ -59,7 +59,6 @@ s! { s_no_extra_traits! { #[repr(packed)] - #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))] pub struct door_desc_t__d_data__d_desc { pub d_descriptor: c_int, pub d_id: crate::door_id_t, @@ -70,13 +69,11 @@ s_no_extra_traits! { d_resv: [c_int; 5], /* Check out /usr/include/sys/door.h */ } - #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))] pub struct door_desc_t { pub d_attributes: door_attr_t, pub d_data: door_desc_t__d_data, } - #[cfg_attr(feature = "extra_traits", allow(missing_debug_implementations))] pub struct door_arg_t { pub data_ptr: *const c_char, pub data_size: size_t, diff --git a/src/wasi/mod.rs b/src/wasi/mod.rs index 61061918c05fc..4abb2bc1f99e2 100644 --- a/src/wasi/mod.rs +++ b/src/wasi/mod.rs @@ -36,7 +36,6 @@ pub type locale_t = *mut __locale_struct; s_no_extra_traits! { #[repr(align(16))] - #[allow(missing_debug_implementations)] pub struct max_align_t { priv_: [f64; 4], } diff --git a/src/windows/gnu/mod.rs b/src/windows/gnu/mod.rs index a263dfa736bba..aee2c1efed108 100644 --- a/src/windows/gnu/mod.rs +++ b/src/windows/gnu/mod.rs @@ -3,7 +3,6 @@ use crate::prelude::*; cfg_if! { if #[cfg(target_pointer_width = "64")] { s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [f64; 4], @@ -11,7 +10,6 @@ cfg_if! { } } else if #[cfg(target_pointer_width = "32")] { s_no_extra_traits! { - #[allow(missing_debug_implementations)] #[repr(align(16))] pub struct max_align_t { priv_: [i64; 6], diff --git a/triagebot.toml b/triagebot.toml index 18c7fd79f8157..54d848f8f9cd3 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -61,7 +61,10 @@ trigger_files = [ trigger_files = ["src/unix/solarish/illumos.rs"] [autolabel."O-linux"] -trigger_files = ["src/unix/linux_like/linux"] +trigger_files = [ + "src/unix/linux_like/linux", + "src/reorg/linux_uapi", +] [autolabel."O-linux-like"] trigger_files = ["src/unix/linux_like/mod.rs"]