From 82cf43dd887801b8b22b8aae8c02854d921915d5 Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Fri, 24 May 2019 18:07:22 -0700 Subject: Update libc crate to 0.2.55 This change updates the libc crate to version 0.2.55. Import subrepo libc/:libc at caf17a0641d29dc624621177f5756804dd180c13 --- libc/.github/issue_template.md | 24 + libc/.gitignore | 1 + libc/.travis.yml | 277 +- libc/CONTRIBUTING.md | 66 + libc/Cargo.lock | 340 --- libc/Cargo.toml | 3 +- libc/README.md | 226 +- libc/appveyor.yml | 6 +- libc/build.rs | 42 +- libc/ci/android-install-ndk.sh | 2 +- libc/ci/android-install-sdk.sh | 5 +- libc/ci/build.sh | 214 ++ libc/ci/docker/aarch64-linux-android/Dockerfile | 4 +- .../ci/docker/aarch64-unknown-linux-gnu/Dockerfile | 2 +- .../docker/aarch64-unknown-linux-musl/Dockerfile | 2 +- libc/ci/docker/arm-linux-androideabi/Dockerfile | 4 +- .../docker/arm-unknown-linux-gnueabihf/Dockerfile | 2 +- .../docker/arm-unknown-linux-musleabihf/Dockerfile | 2 +- libc/ci/docker/asmjs-unknown-emscripten/Dockerfile | 2 +- libc/ci/docker/i686-linux-android/Dockerfile | 4 +- libc/ci/docker/i686-unknown-linux-gnu/Dockerfile | 2 +- libc/ci/docker/i686-unknown-linux-musl/Dockerfile | 2 +- libc/ci/docker/mips-unknown-linux-gnu/Dockerfile | 2 +- libc/ci/docker/mips-unknown-linux-musl/Dockerfile | 2 +- .../mips64-unknown-linux-gnuabi64/Dockerfile | 2 +- .../mips64el-unknown-linux-gnuabi64/Dockerfile | 2 +- .../ci/docker/mipsel-unknown-linux-musl/Dockerfile | 2 +- .../ci/docker/powerpc-unknown-linux-gnu/Dockerfile | 3 +- .../docker/powerpc64-unknown-linux-gnu/Dockerfile | 2 +- .../powerpc64le-unknown-linux-gnu/Dockerfile | 2 +- libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile | 2 +- .../ci/docker/sparc64-unknown-linux-gnu/Dockerfile | 7 +- .../ci/docker/wasm32-unknown-emscripten/Dockerfile | 2 +- libc/ci/docker/wasm32-wasi/Dockerfile | 93 + libc/ci/docker/wasm32-wasi/clang.sh | 2 + libc/ci/docker/x86_64-linux-android/Dockerfile | 2 +- libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs | 3 +- libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile | 2 +- .../docker/x86_64-unknown-linux-gnux32/Dockerfile | 2 +- .../ci/docker/x86_64-unknown-linux-musl/Dockerfile | 2 +- libc/ci/dox.sh | 63 +- libc/ci/ios/deploy_and_run_on_ios_simulator.rs | 7 +- libc/ci/landing-page-footer.html | 3 - libc/ci/landing-page-head.html | 7 - libc/ci/linux-s390x.sh | 4 +- libc/ci/linux-sparc64.sh | 8 +- libc/ci/run.sh | 19 +- libc/ci/runtest-android.rs | 22 +- libc/ci/semver.sh | 70 + libc/ci/style.rs | 3 + libc/ci/switch.json | 37 + libc/ci/test-runner-linux | 15 +- libc/libc-test/Cargo.toml | 8 +- libc/libc-test/build.rs | 3185 ++++++++++++++++---- libc/libc-test/src/cmsg.c | 28 + libc/libc-test/test/cmsg.rs | 101 + libc/libc-test/test/linux_fcntl.rs | 7 +- libc/libc-test/test/main.rs | 2 +- libc/rustfmt.toml | 3 + libc/src/cloudabi/mod.rs | 20 +- libc/src/dox.rs | 224 -- libc/src/fuchsia/align.rs | 142 + libc/src/fuchsia/mod.rs | 549 ++-- libc/src/fuchsia/no_align.rs | 129 + libc/src/fuchsia/x86_64.rs | 62 +- libc/src/hermit/aarch64.rs | 2 + libc/src/hermit/mod.rs | 83 + libc/src/hermit/x86_64.rs | 2 + libc/src/lib.rs | 243 +- libc/src/macros.rs | 120 +- libc/src/redox/mod.rs | 394 --- libc/src/redox/net.rs | 124 - libc/src/sgx.rs | 6 +- libc/src/switch.rs | 6 +- libc/src/unix/align.rs | 6 + libc/src/unix/bsd/apple/b32.rs | 41 +- libc/src/unix/bsd/apple/b64.rs | 41 +- libc/src/unix/bsd/apple/mod.rs | 806 ++++- libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs | 294 +- libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs | 15 +- libc/src/unix/bsd/freebsdlike/freebsd/arm.rs | 47 + libc/src/unix/bsd/freebsdlike/freebsd/mod.rs | 356 ++- libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs | 44 + libc/src/unix/bsd/freebsdlike/freebsd/x86.rs | 14 +- libc/src/unix/bsd/freebsdlike/freebsd/x86_64.rs | 14 +- libc/src/unix/bsd/freebsdlike/mod.rs | 83 +- libc/src/unix/bsd/mod.rs | 168 +- libc/src/unix/bsd/netbsdlike/mod.rs | 80 +- libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs | 13 +- libc/src/unix/bsd/netbsdlike/netbsd/arm.rs | 13 +- libc/src/unix/bsd/netbsdlike/netbsd/mod.rs | 535 +++- libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs | 13 +- libc/src/unix/bsd/netbsdlike/netbsd/x86.rs | 13 +- libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs | 13 +- .../unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs | 113 - .../unix/bsd/netbsdlike/openbsdlike/bitrig/x86.rs | 2 - .../bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs | 10 - libc/src/unix/bsd/netbsdlike/openbsdlike/mod.rs | 295 +- .../bsd/netbsdlike/openbsdlike/openbsd/aarch64.rs | 13 +- .../unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs | 294 +- .../unix/bsd/netbsdlike/openbsdlike/openbsd/x86.rs | 13 +- .../bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs | 13 +- libc/src/unix/haiku/mod.rs | 194 +- libc/src/unix/hermit/mod.rs | 396 ++- libc/src/unix/mod.rs | 135 +- libc/src/unix/newlib/align.rs | 61 + libc/src/unix/newlib/mod.rs | 197 +- libc/src/unix/newlib/no_align.rs | 51 + libc/src/unix/no_align.rs | 6 + libc/src/unix/notbsd/android/b32/mod.rs | 2 +- libc/src/unix/notbsd/android/b64/mod.rs | 145 +- libc/src/unix/notbsd/android/mod.rs | 516 +++- libc/src/unix/notbsd/emscripten.rs | 1681 ----------- libc/src/unix/notbsd/emscripten/align.rs | 66 + libc/src/unix/notbsd/emscripten/mod.rs | 1802 +++++++++++ libc/src/unix/notbsd/emscripten/no_align.rs | 63 + libc/src/unix/notbsd/linux/align.rs | 98 + libc/src/unix/notbsd/linux/mips/align.rs | 13 + libc/src/unix/notbsd/linux/mips/mips32.rs | 10 +- libc/src/unix/notbsd/linux/mips/mips64.rs | 4 +- libc/src/unix/notbsd/linux/mips/mod.rs | 36 +- libc/src/unix/notbsd/linux/mips/no_align.rs | 10 + libc/src/unix/notbsd/linux/mod.rs | 566 ++-- libc/src/unix/notbsd/linux/musl/b32/mips.rs | 8 - libc/src/unix/notbsd/linux/musl/b32/x86.rs | 65 +- libc/src/unix/notbsd/linux/musl/b64/x86_64.rs | 65 +- libc/src/unix/notbsd/linux/musl/mod.rs | 73 +- libc/src/unix/notbsd/linux/no_align.rs | 80 + libc/src/unix/notbsd/linux/other/align.rs | 13 + libc/src/unix/notbsd/linux/other/b32/arm.rs | 3 - libc/src/unix/notbsd/linux/other/b32/x86.rs | 152 +- libc/src/unix/notbsd/linux/other/b64/aarch64.rs | 2 - libc/src/unix/notbsd/linux/other/b64/sparc64.rs | 2 +- libc/src/unix/notbsd/linux/other/b64/x86_64.rs | 144 +- libc/src/unix/notbsd/linux/other/mod.rs | 204 +- libc/src/unix/notbsd/linux/other/no_align.rs | 10 + libc/src/unix/notbsd/linux/s390x.rs | 1336 -------- libc/src/unix/notbsd/linux/s390x/align.rs | 10 + libc/src/unix/notbsd/linux/s390x/mod.rs | 1360 +++++++++ libc/src/unix/notbsd/linux/s390x/no_align.rs | 7 + libc/src/unix/notbsd/mod.rs | 288 +- libc/src/unix/redox/mod.rs | 588 ++++ libc/src/unix/solaris/mod.rs | 1470 --------- libc/src/unix/solarish/compat.rs | 21 + libc/src/unix/solarish/mod.rs | 2031 +++++++++++++ libc/src/unix/uclibc/align.rs | 66 + libc/src/unix/uclibc/arm/align.rs | 13 + libc/src/unix/uclibc/arm/mod.rs | 687 +++++ libc/src/unix/uclibc/arm/no_align.rs | 10 + libc/src/unix/uclibc/mips/mips32.rs | 639 ---- libc/src/unix/uclibc/mips/mips32/align.rs | 13 + libc/src/unix/uclibc/mips/mips32/mod.rs | 627 ++++ libc/src/unix/uclibc/mips/mips32/no_align.rs | 10 + libc/src/unix/uclibc/mips/mips64.rs | 214 -- libc/src/unix/uclibc/mips/mips64/align.rs | 10 + libc/src/unix/uclibc/mips/mips64/mod.rs | 213 ++ libc/src/unix/uclibc/mips/mips64/no_align.rs | 8 + libc/src/unix/uclibc/mod.rs | 260 +- libc/src/unix/uclibc/no_align.rs | 53 + libc/src/unix/uclibc/x86_64/align.rs | 77 + libc/src/unix/uclibc/x86_64/l4re.rs | 1 + libc/src/unix/uclibc/x86_64/mod.rs | 164 +- libc/src/unix/uclibc/x86_64/no_align.rs | 59 + libc/src/unix/uclibc/x86_64/other.rs | 1 + libc/src/wasi.rs | 1336 ++++++++ libc/src/windows/mod.rs | 23 +- nitrocli/CHANGELOG.md | 2 +- nitrocli/Cargo.lock | 12 +- 168 files changed, 19385 insertions(+), 9523 deletions(-) create mode 100644 libc/.github/issue_template.md create mode 100644 libc/CONTRIBUTING.md delete mode 100644 libc/Cargo.lock create mode 100644 libc/ci/build.sh create mode 100644 libc/ci/docker/wasm32-wasi/Dockerfile create mode 100755 libc/ci/docker/wasm32-wasi/clang.sh delete mode 100644 libc/ci/landing-page-footer.html delete mode 100644 libc/ci/landing-page-head.html create mode 100644 libc/ci/semver.sh create mode 100644 libc/ci/switch.json create mode 100644 libc/libc-test/src/cmsg.c create mode 100644 libc/libc-test/test/cmsg.rs create mode 100644 libc/rustfmt.toml delete mode 100644 libc/src/dox.rs create mode 100644 libc/src/fuchsia/align.rs create mode 100644 libc/src/fuchsia/no_align.rs create mode 100644 libc/src/hermit/aarch64.rs create mode 100644 libc/src/hermit/mod.rs create mode 100644 libc/src/hermit/x86_64.rs delete mode 100644 libc/src/redox/mod.rs delete mode 100644 libc/src/redox/net.rs create mode 100644 libc/src/unix/align.rs create mode 100644 libc/src/unix/bsd/freebsdlike/freebsd/arm.rs create mode 100644 libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs delete mode 100644 libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs delete mode 100644 libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86.rs delete mode 100644 libc/src/unix/bsd/netbsdlike/openbsdlike/bitrig/x86_64.rs create mode 100644 libc/src/unix/newlib/align.rs create mode 100644 libc/src/unix/newlib/no_align.rs create mode 100644 libc/src/unix/no_align.rs delete mode 100644 libc/src/unix/notbsd/emscripten.rs create mode 100644 libc/src/unix/notbsd/emscripten/align.rs create mode 100644 libc/src/unix/notbsd/emscripten/mod.rs create mode 100644 libc/src/unix/notbsd/emscripten/no_align.rs create mode 100644 libc/src/unix/notbsd/linux/align.rs create mode 100644 libc/src/unix/notbsd/linux/mips/align.rs create mode 100644 libc/src/unix/notbsd/linux/mips/no_align.rs create mode 100644 libc/src/unix/notbsd/linux/no_align.rs create mode 100644 libc/src/unix/notbsd/linux/other/align.rs create mode 100644 libc/src/unix/notbsd/linux/other/no_align.rs delete mode 100644 libc/src/unix/notbsd/linux/s390x.rs create mode 100644 libc/src/unix/notbsd/linux/s390x/align.rs create mode 100644 libc/src/unix/notbsd/linux/s390x/mod.rs create mode 100644 libc/src/unix/notbsd/linux/s390x/no_align.rs create mode 100644 libc/src/unix/redox/mod.rs delete mode 100644 libc/src/unix/solaris/mod.rs create mode 100644 libc/src/unix/solarish/compat.rs create mode 100644 libc/src/unix/solarish/mod.rs create mode 100644 libc/src/unix/uclibc/align.rs create mode 100644 libc/src/unix/uclibc/arm/align.rs create mode 100644 libc/src/unix/uclibc/arm/mod.rs create mode 100644 libc/src/unix/uclibc/arm/no_align.rs delete mode 100644 libc/src/unix/uclibc/mips/mips32.rs create mode 100644 libc/src/unix/uclibc/mips/mips32/align.rs create mode 100644 libc/src/unix/uclibc/mips/mips32/mod.rs create mode 100644 libc/src/unix/uclibc/mips/mips32/no_align.rs delete mode 100644 libc/src/unix/uclibc/mips/mips64.rs create mode 100644 libc/src/unix/uclibc/mips/mips64/align.rs create mode 100644 libc/src/unix/uclibc/mips/mips64/mod.rs create mode 100644 libc/src/unix/uclibc/mips/mips64/no_align.rs create mode 100644 libc/src/unix/uclibc/no_align.rs create mode 100644 libc/src/unix/uclibc/x86_64/align.rs create mode 100644 libc/src/unix/uclibc/x86_64/no_align.rs create mode 100644 libc/src/wasi.rs diff --git a/libc/.github/issue_template.md b/libc/.github/issue_template.md new file mode 100644 index 0000000..435bf35 --- /dev/null +++ b/libc/.github/issue_template.md @@ -0,0 +1,24 @@ + diff --git a/libc/.gitignore b/libc/.gitignore index f0ff259..bbbad4b 100644 --- a/libc/.gitignore +++ b/libc/.gitignore @@ -1,3 +1,4 @@ target Cargo.lock *~ +style diff --git a/libc/.travis.yml b/libc/.travis.yml index 52d2403..1fa0a8d 100644 --- a/libc/.travis.yml +++ b/libc/.travis.yml @@ -1,108 +1,253 @@ language: rust -rust: stable +rust: nightly sudo: required dist: xenial services: docker +stages: + - tools-and-build-and-tier1 + - tier2 + matrix: include: - # 1.13.0 compat - - env: TARGET=x86_64-unknown-linux-gnu - rust: 1.13.0 - script: rm -f Cargo.lock && cargo build + # TOOLS + - name: "Documentation" + env: TARGET=x86_64-unknown-linux-gnu + script: sh ci/dox.sh + install: + - travis_retry rustup component add rust-src + - travis_retry cargo install xargo + stage: tools-and-build-and-tier1 + - name: "Shellcheck" + install: true + script: + - shellcheck --version + - shellcheck ci/*.sh + stage: tools-and-build-and-tier1 + - name: "Style" install: true + script: + - rustc ci/style.rs && ./style src + # Disabled due to rust-lang/rustfmt#3341 + #- | + # if rustup component add rustfmt-preview ; then + # cargo fmt --all -- --check + # fi + stage: tools-and-build-and-tier1 + - name: "Semver Linux" + install: travis_retry cargo +nightly install semverver + script: sh ci/semver.sh + stage: tools-and-build-and-tier1 + - name: "Semver MacOSX" + install: travis_retry cargo +nightly install semverver + script: sh ci/semver.sh + os: osx + osx_image: xcode10 + stage: tools-and-build-and-tier1 - # build documentation - - env: TARGET=x86_64-unknown-linux-gnu + # BUILD stable, beta, nightly + - name: "Build Stable Rust" + script: sh ci/build.sh + stage: tools-and-build-and-tier1 + rust: stable + install: true + - name: "Build Beta Rust" + script: sh ci/build.sh + stage: tools-and-build-and-tier1 + rust: beta + install: true + - name: "Build Nightly Rust" + script: sh ci/build.sh + stage: tools-and-build-and-tier1 rust: nightly - script: sh ci/dox.sh + install: + - travis_retry rustup component add rust-src + - travis_retry cargo install xargo + - name: "Build Stable Rust" + script: sh ci/build.sh + stage: tools-and-build-and-tier1 + rust: stable + os: osx + osx_image: xcode10 install: true - - # stable compat - - env: TARGET=x86_64-unknown-linux-gnu + - name: "Build Beta Rust" + script: sh ci/build.sh + stage: tools-and-build-and-tier1 + rust: beta + os: osx + osx_image: xcode10 install: true - - env: TARGET=i686-unknown-linux-gnu - - os: osx - env: TARGET=x86_64-apple-darwin + - name: "Build Nightly Rust" + script: sh ci/build.sh + stage: tools-and-build-and-tier1 + rust: nightly + os: osx osx_image: xcode10 install: true - - os: osx - env: TARGET=i686-apple-darwin + - name: "Build Stable Rust 1.13.0" + script: sh ci/build.sh + stage: tools-and-build-and-tier1 + rust: 1.13.0 + install: true + - name: "Build Stable Rust 1.19.0" + script: sh ci/build.sh + stage: tools-and-build-and-tier1 + rust: 1.19.0 + install: true + - name: "Build Stable Rust 1.24.0" + script: sh ci/build.sh + stage: tools-and-build-and-tier1 + rust: 1.24.0 + install: true + - name: "Build Stable Rust 1.25.0" + script: sh ci/build.sh + stage: tools-and-build-and-tier1 + rust: 1.25.0 + install: true + - name: "Build Stable Rust 1.30.0" + script: sh ci/build.sh + stage: tools-and-build-and-tier1 + rust: 1.30.0 + install: true + - name: "Build Stable Rust 1.13.0" + script: sh ci/build.sh + stage: tools-and-build-and-tier1 + rust: 1.13.0 + os: osx osx_image: xcode10 - - env: TARGET=arm-linux-androideabi + install: true + - name: "Build Stable Rust 1.19.0" + script: sh ci/build.sh + stage: tools-and-build-and-tier1 + rust: 1.19.0 + os: osx + osx_image: xcode10 + install: true + - name: "Build Stable Rust 1.24.0" + script: sh ci/build.sh + stage: tools-and-build-and-tier1 + rust: 1.24.0 + os: osx + osx_image: xcode10 + install: true + - name: "Build Stable Rust 1.25.0" + script: sh ci/build.sh + stage: tools-and-build-and-tier1 + rust: 1.25.0 + os: osx + osx_image: xcode10 + install: true + - name: "Build Stable Rust 1.30.0" + script: sh ci/build.sh + stage: tools-and-build-and-tier1 + rust: 1.30.0 + os: osx + osx_image: xcode10 + install: true + - env: TARGET=i686-apple-darwin + os: osx + osx_image: xcode10 + stage: tools-and-build-and-tier1 + - env: TARGET=i686-unknown-linux-gnu + stage: tools-and-build-and-tier1 + - env: TARGET=x86_64-apple-darwin + os: osx + osx_image: xcode10 + install: true + stage: tools-and-build-and-tier1 + - env: TARGET=x86_64-unknown-linux-gnu + stage: tools-and-build-and-tier1 + install: true + + # Tier 2 targets - env: TARGET=aarch64-linux-android - # FIXME(#826) should reenable - #- env: TARGET=i686-linux-android - - env: TARGET=x86_64-linux-android - - env: TARGET=x86_64-unknown-linux-musl - - env: TARGET=i686-unknown-linux-musl - - env: TARGET=arm-unknown-linux-gnueabihf - - env: TARGET=arm-unknown-linux-musleabihf + stage: tier2 - env: TARGET=aarch64-unknown-linux-gnu + stage: tier2 - env: TARGET=aarch64-unknown-linux-musl - - env: TARGET=powerpc-unknown-linux-gnu - - env: TARGET=powerpc64-unknown-linux-gnu - - env: TARGET=powerpc64le-unknown-linux-gnu + stage: tier2 + - env: TARGET=arm-linux-androideabi + stage: tier2 + - env: TARGET=arm-unknown-linux-gnueabihf + stage: tier2 + - env: TARGET=arm-unknown-linux-musleabihf + stage: tier2 + - env: TARGET=asmjs-unknown-emscripten + stage: tier2 + - env: TARGET=i686-unknown-linux-musl + stage: tier2 + - env: TARGET=mips-unknown-linux-gnu + stage: tier2 - env: TARGET=mips-unknown-linux-musl - - env: TARGET=mipsel-unknown-linux-musl + stage: tier2 - env: TARGET=mips64-unknown-linux-gnuabi64 + stage: tier2 - env: TARGET=mips64el-unknown-linux-gnuabi64 - - env: TARGET=mips-unknown-linux-gnu + stage: tier2 + - env: TARGET=mipsel-unknown-linux-musl + stage: tier2 + - env: TARGET=powerpc-unknown-linux-gnu + stage: tier2 + - env: TARGET=powerpc64-unknown-linux-gnu + stage: tier2 + - env: TARGET=powerpc64le-unknown-linux-gnu + stage: tier2 - env: TARGET=s390x-unknown-linux-gnu + stage: tier2 - env: TARGET=sparc64-unknown-linux-gnu - - env: TARGET=asmjs-unknown-emscripten + stage: tier2 - env: TARGET=wasm32-unknown-emscripten - - # beta - - env: TARGET=x86_64-unknown-linux-gnu - rust: beta - install: true - - os: osx - env: TARGET=x86_64-apple-darwin - osx_image: xcode10 - rust: beta - install: true - - # nightly - - env: TARGET=x86_64-unknown-linux-gnu - rust: nightly - install: true - - os: osx - env: TARGET=x86_64-apple-darwin - osx_image: xcode10 - rust: nightly - install: true - # not available on stable - # without --release the build fails - # see https://github.com/rust-lang/rust/issues/45417 + stage: tier2 + - env: TARGET=x86_64-linux-android + stage: tier2 - env: TARGET=x86_64-unknown-linux-gnux32 OPT="--release" + stage: tier2 + - env: TARGET=x86_64-unknown-linux-musl + stage: tier2 + - env: TARGET=wasm32-wasi rust: nightly - - - env: TARGET=wasm32-unknown-unknown - install: rustup target add $TARGET - script: cargo build --no-default-features --target $TARGET --release - - - name: "Shellcheck" - install: true + stage: tier2 + - name: "Nintendo Switch - build libcore only" + rust: nightly + stage: tier2 + install: + - rustup component add rust-src + - (test -x $HOME/.cargo/bin/cargo-xbuild || cargo install cargo-xbuild) script: - - shellcheck --version - - shellcheck ci/*.sh + - mkdir -p target + - cd target + - wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb + - sudo dpkg -i devkitpro-pacman.deb + - sudo dkp-pacman -Sy + - sudo dkp-pacman -Syu + - sudo dkp-pacman -S -v --noconfirm switch-dev devkitA64 + - export PATH="$PATH:/opt/devkitpro/devkitA64/bin" + - export PATH="$PATH:/opt/devkitpro/tools/bin" + - cd .. + # Pull the target spec up into the current directory and then build + - mv ci/switch.json switch.json + - cargo xbuild --target switch.json + allow_failures: + # FIXME: android build bots time out irregularly + - env: TARGET=aarch64-linux-android + - env: TARGET=arm-linux-androideabi # FIXME: https://github.com/rust-lang/libc/issues/1226 - env: TARGET=asmjs-unknown-emscripten - env: TARGET=wasm32-unknown-emscripten + - name: "Semver Linux" + - name: "Semver MacOSX" + +install: travis_retry rustup target add $TARGET -install: rustup target add $TARGET script: - cargo generate-lockfile --manifest-path libc-test/Cargo.toml - - if [[ $TRAVIS_OS_NAME = "linux" ]]; then + - if [[ $TRAVIS_OS_NAME = "linux" ]] && [[ $BUILD_ONLY != "1" ]]; then sh ci/run-docker.sh $TARGET; else - export CARGO_TARGET_DIR=`pwd`/target; sh ci/run.sh $TARGET; fi - - rustc ci/style.rs && ./style src env: global: secure: "e2/3QjgRN9atOuSHp22TrYG7QVKcYUWY48Hi9b60w+r1+BhPkTseIJLte7WefRhdXtqpjjUJTooKDhnurFOeHaCT+nmBgiv+FPU893sBl4bhesY4m0vgUJVbNZcs6lTImYekWVb+aqjGdgV/XAgCw7c3kPmrZV0MzGDWL64Xaps=" diff --git a/libc/CONTRIBUTING.md b/libc/CONTRIBUTING.md new file mode 100644 index 0000000..0e5d0c6 --- /dev/null +++ b/libc/CONTRIBUTING.md @@ -0,0 +1,66 @@ +# Contributing to `libc` + +Welcome! If you are reading this document, it means you are interested in contributing +to the `libc` crate. + +## Adding an API + +Want to use an API which currently isn't bound in `libc`? It's quite easy to add +one! + +The internal structure of this crate is designed to minimize the number of +`#[cfg]` attributes in order to easily be able to add new items which apply +to all platforms in the future. As a result, the crate is organized +hierarchically based on platform. Each module has a number of `#[cfg]`'d +children, but only one is ever actually compiled. Each module then reexports all +the contents of its children. + +This means that for each platform that libc supports, the path from a +leaf module to the root will contain all bindings for the platform in question. +Consequently, this indicates where an API should be added! Adding an API at a +particular level in the hierarchy means that it is supported on all the child +platforms of that level. For example, when adding a Unix API it should be added +to `src/unix/mod.rs`, but when adding a Linux-only API it should be added to +`src/unix/notbsd/linux/mod.rs`. + +If you're not 100% sure at what level of the hierarchy an API should be added +at, fear not! This crate has CI support which tests any binding against all +platforms supported, so you'll see failures if an API is added at the wrong +level or has different signatures across platforms. + +With that in mind, the steps for adding a new API are: + +1. Determine where in the module hierarchy your API should be added. +2. Add the API. +3. Send a PR to this repo. +4. Wait for CI to pass, fixing errors. +5. Wait for a merge! + +### Test before you commit + +We have two automated tests running on [Travis](https://travis-ci.org/rust-lang/libc): + +1. [`libc-test`](https://github.com/alexcrichton/ctest) + - `cd libc-test && cargo test` + - Use the `skip_*()` functions in `build.rs` if you really need a workaround. +2. Style checker + - `rustc ci/style.rs && ./style src` + +### Releasing your change to crates.io + +Now that you've done the amazing job of landing your new API or your new +platform in this crate, the next step is to get that sweet, sweet usage from +crates.io! The only next step is to bump the version of libc and then publish +it. If you'd like to get a release out ASAP you can follow these steps: + +1. Update the version number in `Cargo.toml`, you'll just be bumping the patch + version number. +2. Run `cargo update` to regenerate the lockfile to encode your version bump in + the lock file. You may pull in some other updated dependencies, that's ok. +3. Send a PR to this repository. It should [look like this][example], but it'd + also be nice to fill out the description with a small rationale for the + release (any rationale is ok though!) +4. Once merged the release will be tagged and published by one of the libc crate + maintainers. + +[example]: https://github.com/rust-lang/libc/pull/583 diff --git a/libc/Cargo.lock b/libc/Cargo.lock deleted file mode 100644 index a8165ea..0000000 --- a/libc/Cargo.lock +++ /dev/null @@ -1,340 +0,0 @@ -[[package]] -name = "bitflags" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bitflags" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cc" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cfg-if" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "ctest" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_syntax 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "extprim" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "itoa" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "libc" -version = "0.2.47" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "libc" -version = "0.2.48" -dependencies = [ - "rustc-std-workspace-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "libc-test" -version = "0.1.0" -dependencies = [ - "ctest 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.48", -] - -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "log" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-traits" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "proc-macro2" -version = "0.4.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quote" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand_core" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-std-workspace-core" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ryu" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "serde" -version = "1.0.85" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_derive" -version = "1.0.85" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "serde_json" -version = "1.0.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syn" -version = "0.15.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syntex_errors" -version = "0.59.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syntex_pos" -version = "0.59.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "syntex_syntax" -version = "0.59.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "extprim 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", - "syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "term" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[metadata] -"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" -"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" -"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749" -"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" -"checksum ctest 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3574c0edc91c25cb50d1e4238f35ae2651b0beadf72bfec31fb4ead46b4eb5b8" -"checksum extprim 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "054bc2552b3f66fa8097e29e47255bfff583c08e737a67cbbb54b817ddaa5206" -"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" -"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -"checksum libc 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)" = "48450664a984b25d5b479554c29cc04e3150c97aa4c01da5604a2d4ed9151476" -"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" -"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" -"checksum proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)" = "38fddd23d98b2144d197c0eca5705632d4fe2667d14a6be5df8934f8d74f1978" -"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1" -"checksum rand 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dee497e66d8d76bf08ce20c8d36e16f93749ab0bf89975b4f8ae5cee660c2da2" -"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" -"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum rustc-std-workspace-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1956f5517128a2b6f23ab2dadf1a976f4f5b27962e7724c2bf3d45e539ec098c" -"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" -"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)" = "534b8b91a95e0f71bca3ed5824752d558da048d4248c91af873b63bd60519752" -"checksum serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)" = "a915306b0f1ac5607797697148c223bedeaa36bcc2e28a01441cd638cc6567b4" -"checksum serde_json 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)" = "574378d957d6dcdf1bbb5d562a15cbd5e644159432f84634b94e485267abbcc7" -"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9" -"checksum syntex_errors 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3133289179676c9f5c5b2845bf5a2e127769f4889fcbada43035ef6bd662605e" -"checksum syntex_pos 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "30ab669fa003d208c681f874bbc76d91cc3d32550d16b5d9d2087cf477316470" -"checksum syntex_syntax 0.59.1 (registry+https://github.com/rust-lang/crates.io-index)" = "03815b9f04d95828770d9c974aa39c6e1f6ef3114eb77a3ce09008a0d15dd142" -"checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1" -"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" -"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" -"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/libc/Cargo.toml b/libc/Cargo.toml index 9161644..ef500be 100644 --- a/libc/Cargo.toml +++ b/libc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libc" -version = "0.2.48" +version = "0.2.55" authors = ["The Rust Project Developers"] license = "MIT OR Apache-2.0" readme = "README.md" @@ -27,6 +27,7 @@ default = ["use_std"] use_std = [] align = [] rustc-dep-of-std = ['align', 'rustc-std-workspace-core'] +extra_traits = [] [workspace] members = ["libc-test"] diff --git a/libc/README.md b/libc/README.md index 636f10e..a974ccd 100644 --- a/libc/README.md +++ b/libc/README.md @@ -1,173 +1,103 @@ -libc +[![Travis-CI Status]][Travis-CI] [![Appveyor Status]][Appveyor] [![Cirrus-CI Status]][Cirrus-CI] [![Latest Version]][crates.io] [![Documentation]][docs.rs] ![License] + +libc - Raw FFI bindings to platforms' system libraries ==== -Raw FFI bindings to platform libraries like `libc`. +`libc` provides all of the definitions necessary to easily interoperate with C +code (or "C-like" code) on each of the platforms that Rust supports. This +includes type definitions (e.g. `c_int`), constants (e.g. `EINVAL`) as well as +function headers (e.g. `malloc`). + +This crate exports all underlying platform types, functions, and constants under +the crate root, so all items are accessible as `libc::foo`. The types and values +of all the exported APIs match the platform that libc is compiled for. -[![Build Status](https://travis-ci.org/rust-lang/libc.svg?branch=master)](https://travis-ci.org/rust-lang/libc) -[![Build status](https://ci.appveyor.com/api/projects/status/github/rust-lang/libc?svg=true)](https://ci.appveyor.com/project/rust-lang-libs/libc) -[![Build Status](https://api.cirrus-ci.com/github/rust-lang/libc.svg)](https://cirrus-ci.com/github/rust-lang/libc) -[![Latest version](https://img.shields.io/crates/v/libc.svg)](https://crates.io/crates/libc) -[![Documentation](https://docs.rs/libc/badge.svg)](https://docs.rs/libc) -![License](https://img.shields.io/crates/l/libc.svg) +More detailed information about the design of this library can be found in its +[associated RFC][rfc]. + +[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1291-promote-libc.md ## Usage -First, add the following to your `Cargo.toml`: +Add the following to your `Cargo.toml`: ```toml [dependencies] libc = "0.2" ``` -Next, add this to your crate root: +## Features -```rust -extern crate libc; -``` +* `use_std`: by default `libc` links to the standard library. Disable this + feature remove this dependency and be able to use `libc` in `#![no_std]` + crates. -Currently libc by default links to the standard library, but if you would -instead like to use libc in a `#![no_std]` situation or crate you can request -this via: +* `extra_traits`: all `struct`s implemented in `libc` are `Copy` and `Clone`. + This feature derives `Debug`, `Eq`, `Hash`, and `PartialEq`. -```toml -[dependencies] -libc = { version = "0.2", default-features = false } -``` +## Rust version support -By default libc uses private fields in structs in order to enforce a certain -memory alignment on them. These structs can be hard to instantiate outside of -libc. To make libc use `#[repr(align(x))]`, instead of the private fields, -activate the *align* feature. This requires Rust 1.25 or newer: +The minimum supported Rust toolchain version is **Rust 1.13.0** . APIs requiring +newer Rust features are only available on newer Rust toolchains: -```toml -[dependencies] -libc = { version = "0.2", features = ["align"] } -``` +| Feature | Version | +|----------------------|---------| +| `union` | 1.19.0 | +| `const mem::size_of` | 1.24.0 | +| `repr(align)` | 1.25.0 | +| `extra_traits` | 1.25.0 | +| `core::ffi::c_void` | 1.30.0 | +| `repr(packed(N))` | 1.33.0 | -## What is libc? +## Platform support -The primary purpose of this crate is to provide all of the definitions necessary -to easily interoperate with C code (or "C-like" code) on each of the platforms -that Rust supports. This includes type definitions (e.g. `c_int`), constants -(e.g. `EINVAL`) as well as function headers (e.g. `malloc`). +[Platform-specific documentation (master branch)][docs.master]. -This crate does not strive to have any form of compatibility across platforms, -but rather it is simply a straight binding to the system libraries on the -platform in question. +See +[`ci/build.sh`](https://github.com/rust-lang/libc/blob/master/libc-test/build.rs) +for the platforms on which `libc` is guaranteed to build for each Rust +toolchain. The test-matrix at [Travis-CI], [Appveyor], and [Cirrus-CI] show the +platforms in which `libc` tests are run. -## Public API +
-This crate exports all underlying platform types, functions, and constants under -the crate root, so all items are accessible as `libc::foo`. The types and values -of all the exported APIs match the platform that libc is compiled for. +## License -More detailed information about the design of this library can be found in its -[associated RFC][rfc]. +This project is licensed under either of -[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1291-promote-libc.md +* [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) + ([LICENSE-APACHE](LICENSE-APACHE)) + +* [MIT License](http://opensource.org/licenses/MIT) + ([LICENSE-MIT](LICENSE-MIT)) + +at your option. + +## Contributing + +We welcome all people who want to contribute. Please see the [contributing +instructions] for more information. + +[contributing instructions]: CONTRIBUTING.md + +Contributions in any form (issues, pull requests, etc.) to this project +must adhere to Rust's [Code of Conduct]. + +[Code of Conduct]: https://www.rust-lang.org/en-US/conduct.html + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in `libc` by you, as defined in the Apache-2.0 license, shall be +dual licensed as above, without any additional terms or conditions. -## Adding an API - -Want to use an API which currently isn't bound in `libc`? It's quite easy to add -one! - -The internal structure of this crate is designed to minimize the number of -`#[cfg]` attributes in order to easily be able to add new items which apply -to all platforms in the future. As a result, the crate is organized -hierarchically based on platform. Each module has a number of `#[cfg]`'d -children, but only one is ever actually compiled. Each module then reexports all -the contents of its children. - -This means that for each platform that libc supports, the path from a -leaf module to the root will contain all bindings for the platform in question. -Consequently, this indicates where an API should be added! Adding an API at a -particular level in the hierarchy means that it is supported on all the child -platforms of that level. For example, when adding a Unix API it should be added -to `src/unix/mod.rs`, but when adding a Linux-only API it should be added to -`src/unix/notbsd/linux/mod.rs`. - -If you're not 100% sure at what level of the hierarchy an API should be added -at, fear not! This crate has CI support which tests any binding against all -platforms supported, so you'll see failures if an API is added at the wrong -level or has different signatures across platforms. - -With that in mind, the steps for adding a new API are: - -1. Determine where in the module hierarchy your API should be added. -2. Add the API. -3. Send a PR to this repo. -4. Wait for CI to pass, fixing errors. -5. Wait for a merge! - -### Test before you commit - -We have two automated tests running on [Travis](https://travis-ci.org/rust-lang/libc): - -1. [`libc-test`](https://github.com/alexcrichton/ctest) - - `cd libc-test && cargo test` - - Use the `skip_*()` functions in `build.rs` if you really need a workaround. -2. Style checker - - `rustc ci/style.rs && ./style src` - -### Releasing your change to crates.io - -Now that you've done the amazing job of landing your new API or your new -platform in this crate, the next step is to get that sweet, sweet usage from -crates.io! The only next step is to bump the version of libc and then publish -it. If you'd like to get a release out ASAP you can follow these steps: - -1. Update the version number in `Cargo.toml`, you'll just be bumping the patch - version number. -2. Run `cargo update` to regenerate the lockfile to encode your version bump in - the lock file. You may pull in some other updated dependencies, that's ok. -3. Send a PR to this repository. It should [look like this][example], but it'd - also be nice to fill out the description with a small rationale for the - release (any rationale is ok though!) -4. Once merged the release will be tagged and published by one of the libc crate - maintainers. - -[example]: https://github.com/rust-lang/libc/pull/583 - -## Platforms and Documentation - -The following platforms are currently tested and have documentation available: - -Tested: - * [`i686-pc-windows-msvc`](https://rust-lang.github.io/libc/i686-pc-windows-msvc/libc/) - * [`x86_64-pc-windows-msvc`](https://rust-lang.github.io/libc/x86_64-pc-windows-msvc/libc/) - (Windows) - * [`i686-pc-windows-gnu`](https://rust-lang.github.io/libc/i686-pc-windows-gnu/libc/) - * [`x86_64-pc-windows-gnu`](https://rust-lang.github.io/libc/x86_64-pc-windows-gnu/libc/) - * [`i686-apple-darwin`](https://rust-lang.github.io/libc/i686-apple-darwin/libc/) - * [`x86_64-apple-darwin`](https://rust-lang.github.io/libc/x86_64-apple-darwin/libc/) - (OSX) - * `i386-apple-ios` - * `x86_64-apple-ios` - * [`i686-unknown-linux-gnu`](https://rust-lang.github.io/libc/i686-unknown-linux-gnu/libc/) - * [`x86_64-unknown-linux-gnu`](https://rust-lang.github.io/libc/x86_64-unknown-linux-gnu/libc/) - (Linux) - * [`x86_64-unknown-linux-musl`](https://rust-lang.github.io/libc/x86_64-unknown-linux-musl/libc/) - (Linux MUSL) - * [`aarch64-unknown-linux-gnu`](https://rust-lang.github.io/libc/aarch64-unknown-linux-gnu/libc/) - (Linux) - * `aarch64-unknown-linux-musl` - (Linux MUSL) - * [`sparc64-unknown-linux-gnu`](https://rust-lang.github.io/libc/sparc64-unknown-linux-gnu/libc/) - (Linux) - * [`mips-unknown-linux-gnu`](https://rust-lang.github.io/libc/mips-unknown-linux-gnu/libc/) - * [`arm-unknown-linux-gnueabihf`](https://rust-lang.github.io/libc/arm-unknown-linux-gnueabihf/libc/) - * [`arm-linux-androideabi`](https://rust-lang.github.io/libc/arm-linux-androideabi/libc/) - (Android) - * [`x86_64-unknown-freebsd`](https://rust-lang.github.io/libc/x86_64-unknown-freebsd/libc/) - * [`x86_64-unknown-openbsd`](https://rust-lang.github.io/libc/x86_64-unknown-openbsd/libc/) - * [`x86_64-rumprun-netbsd`](https://rust-lang.github.io/libc/x86_64-unknown-netbsd/libc/) - -The following may be supported, but are not guaranteed to always work: - - * `i686-unknown-freebsd` - * [`x86_64-unknown-bitrig`](https://rust-lang.github.io/libc/x86_64-unknown-bitrig/libc/) - * [`x86_64-unknown-dragonfly`](https://rust-lang.github.io/libc/x86_64-unknown-dragonfly/libc/) - * `i686-unknown-haiku` - * `x86_64-unknown-haiku` - * [`x86_64-unknown-netbsd`](https://rust-lang.github.io/libc/x86_64-unknown-netbsd/libc/) - * [`x86_64-sun-solaris`](https://rust-lang.github.io/libc/x86_64-sun-solaris/libc/) +[Travis-CI]: https://travis-ci.com/rust-lang/libc +[Travis-CI Status]: https://travis-ci.com/rust-lang/libc.svg?branch=master +[Appveyor]: https://ci.appveyor.com/project/rust-lang-libs/libc +[Appveyor Status]: https://ci.appveyor.com/api/projects/status/github/rust-lang/libc?svg=true +[Cirrus-CI]: https://cirrus-ci.com/github/rust-lang/libc +[Cirrus-CI Status]: https://api.cirrus-ci.com/github/rust-lang/libc.svg +[crates.io]: https://crates.io/crates/libc +[Latest Version]: https://img.shields.io/crates/v/libc.svg +[Documentation]: https://docs.rs/libc/badge.svg +[docs.rs]: https://docs.rs/libc +[License]: https://img.shields.io/crates/l/libc.svg +[docs.master]: https://rust-lang.github.io/libc/#platform-specific-documentation diff --git a/libc/appveyor.yml b/libc/appveyor.yml index 9fd4b26..b14230a 100644 --- a/libc/appveyor.yml +++ b/libc/appveyor.yml @@ -23,6 +23,6 @@ install: build: false test_script: - - cargo test --target %TARGET% - - cargo test --no-default-features --target %TARGET% - - cargo test --manifest-path libc-test/Cargo.toml --target %TARGET% + - cargo -vv test --target %TARGET% + - cargo -vv test --no-default-features --target %TARGET% + - cargo -vv test --manifest-path libc-test/Cargo.toml --target %TARGET% diff --git a/libc/build.rs b/libc/build.rs index 1852ed2..9b13376 100644 --- a/libc/build.rs +++ b/libc/build.rs @@ -3,12 +3,42 @@ use std::process::Command; use std::str; fn main() { - /* - * If `core::ffi::c_void` exists, libc can just re-export it. Otherwise, it - * must define an incompatible type to retain backwards-compatibility. - */ - if rustc_minor_version().expect("Failed to get rustc version") >= 30 { - println!("cargo:rustc-cfg=core_cvoid"); + let rustc_minor_ver = + rustc_minor_version().expect("Failed to get rustc version"); + let rustc_dep_of_std = + std::env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok(); + let align_cargo_feature = std::env::var("CARGO_FEATURE_ALIGN").is_ok(); + + // Rust >= 1.15 supports private module use: + if rustc_minor_ver >= 15 || rustc_dep_of_std { + println!("cargo:rustc-cfg=libc_priv_mod_use"); + } + + // Rust >= 1.19 supports unions: + if rustc_minor_ver >= 19 || rustc_dep_of_std { + println!("cargo:rustc-cfg=libc_union"); + } + + // Rust >= 1.24 supports const mem::size_of: + if rustc_minor_ver >= 24 || rustc_dep_of_std { + println!("cargo:rustc-cfg=libc_const_size_of"); + } + + // Rust >= 1.25 supports repr(align): + if rustc_minor_ver >= 25 || rustc_dep_of_std || align_cargo_feature { + println!("cargo:rustc-cfg=libc_align"); + } + + // Rust >= 1.30 supports `core::ffi::c_void`, so libc can just re-export it. + // Otherwise, it defines an incompatible type to retaining + // backwards-compatibility. + if rustc_minor_ver >= 30 || rustc_dep_of_std { + println!("cargo:rustc-cfg=libc_core_cvoid"); + } + + // Rust >= 1.33 supports repr(packed(N)) + if rustc_minor_ver >= 33 || rustc_dep_of_std { + println!("cargo:rustc-cfg=libc_packedN"); } } diff --git a/libc/ci/android-install-ndk.sh b/libc/ci/android-install-ndk.sh index ce11d00..54f7b2e 100644 --- a/libc/ci/android-install-ndk.sh +++ b/libc/ci/android-install-ndk.sh @@ -11,7 +11,7 @@ set -ex -curl --retry 5 -O https://dl.google.com/android/repository/android-ndk-r15b-linux-x86_64.zip +curl --retry 10 -O https://dl.google.com/android/repository/android-ndk-r15b-linux-x86_64.zip unzip -q android-ndk-r15b-linux-x86_64.zip case "$1" in diff --git a/libc/ci/android-install-sdk.sh b/libc/ci/android-install-sdk.sh index 6b5ac09..e011cfc 100644 --- a/libc/ci/android-install-sdk.sh +++ b/libc/ci/android-install-sdk.sh @@ -19,7 +19,7 @@ set -ex # which apparently magically accepts the licenses. mkdir sdk -curl --retry 5 https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -O +curl --retry 10 https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -O unzip -d sdk sdk-tools-linux-3859397.zip case "$1" in @@ -45,6 +45,9 @@ case "$1" in ;; esac; +# See: https://stackoverflow.com/a/51644855/1422197 +export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee' + # --no_https avoids # javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found yes | ./sdk/tools/bin/sdkmanager --licenses --no_https diff --git a/libc/ci/build.sh b/libc/ci/build.sh new file mode 100644 index 0000000..eb07c18 --- /dev/null +++ b/libc/ci/build.sh @@ -0,0 +1,214 @@ +#!/usr/bin/env sh + +# Checks that libc builds properly for all supported targets on a particular +# Rust version: + +set -ex + +RUST=${TRAVIS_RUST_VERSION} +OS=${TRAVIS_OS_NAME} + +echo "Testing Rust ${RUST} on ${OS}" + +test_target() { + CARGO="${1}" + TARGET="${2}" + NO_STD="${3}" + + opt= + if [ "${TARGET}" = "x86_64-unknown-linux-gnux32" ]; then + # FIXME: x86_64-unknown-linux-gnux32 fail to compile without + # --release + # + # See https://github.com/rust-lang/rust/issues/45417 + opt="--release" + fi + + # If there is a std component, fetch it: + if [ "${NO_STD}" != "1" ]; then + # FIXME: rustup often fails to download some artifacts due to network + # issues, so we retry this N times. + N=5 + n=0 + until [ $n -ge $N ] + do + if rustup target add "${TARGET}" --toolchain "${RUST}" ; then + break + fi + n=$((n+1)) + sleep 1 + done + fi + + # Test that libc builds without any default features (no libstd) + "$CARGO" "+${RUST}" build -vv $opt --no-default-features --target "${TARGET}" + + # Test that libc builds with default features (e.g. libstd) + # if the target supports libstd + if [ "$NO_STD" != "1" ]; then + "$CARGO" "+${RUST}" build -vv $opt --target "${TARGET}" + fi + + # Test that libc builds with the `extra_traits` feature + "$CARGO" "+${RUST}" build -vv $opt --no-default-features --target "${TARGET}" \ + --features extra_traits + + # Also test that it builds with `extra_traits` and default features: + if [ "$NO_STD" != "1" ]; then + "$CARGO" "+${RUST}" build -vv $opt --target "${TARGET}" \ + --features extra_traits + fi +} + +RUST_LINUX_TARGETS="\ +aarch64-linux-android \ +aarch64-unknown-linux-gnu \ +arm-linux-androideabi \ +arm-unknown-linux-gnueabi \ +arm-unknown-linux-gnueabihf \ +armv7-linux-androideabi \ +armv7-unknown-linux-gnueabihf \ +i586-unknown-linux-gnu \ +i686-linux-android \ +i686-unknown-freebsd \ +i686-unknown-linux-gnu \ +i686-unknown-linux-musl \ +mips-unknown-linux-gnu \ +mips-unknown-linux-musl \ +mips64-unknown-linux-gnuabi64 \ +mips64el-unknown-linux-gnuabi64 \ +mipsel-unknown-linux-gnu \ +mipsel-unknown-linux-gnu \ +mipsel-unknown-linux-musl \ +powerpc-unknown-linux-gnu \ +powerpc64-unknown-linux-gnu \ +powerpc64le-unknown-linux-gnu \ +s390x-unknown-linux-gnu \ +x86_64-unknown-freebsd \ +x86_64-unknown-linux-gnu \ +x86_64-unknown-linux-musl \ +x86_64-unknown-netbsd \ +" + +RUST_GT_1_13_LINUX_TARGETS="\ +arm-unknown-linux-musleabi \ +arm-unknown-linux-musleabihf \ +armv7-unknown-linux-musleabihf \ +sparc64-unknown-linux-gnu \ +wasm32-unknown-emscripten \ +x86_64-linux-android \ +x86_64-rumprun-netbsd \ +" +RUST_GT_1_19_LINUX_TARGETS="\ +aarch64-unknown-linux-musl \ +sparcv9-sun-solaris \ +wasm32-unknown-unknown \ +x86_64-sun-solaris \ +" +RUST_GT_1_24_LINUX_TARGETS="\ +i586-unknown-linux-musl \ +x86_64-unknown-cloudabi \ +" + +RUST_NIGHTLY_LINUX_TARGETS="\ +aarch64-fuchsia \ +armv5te-unknown-linux-gnueabi \ +armv5te-unknown-linux-musleabi \ +i686-pc-windows-gnu \ +wasm32-wasi \ +x86_64-fortanix-unknown-sgx \ +x86_64-fuchsia \ +x86_64-pc-windows-gnu \ +x86_64-unknown-linux-gnux32 \ +x86_64-unknown-redox \ +" + +RUST_OSX_TARGETS="\ +aarch64-apple-ios \ +armv7-apple-ios \ +armv7s-apple-ios \ +i386-apple-ios \ +i686-apple-darwin \ +x86_64-apple-darwin \ +x86_64-apple-ios \ +" + +# The targets are listed here alphabetically +TARGETS="" +case "${OS}" in + linux*) + TARGETS="${RUST_LINUX_TARGETS}" + + if [ "${RUST}" != "1.13.0" ]; then + TARGETS="${TARGETS} ${RUST_GT_1_13_LINUX_TARGETS}" + if [ "${RUST}" != "1.19.0" ]; then + TARGETS="${TARGETS} ${RUST_GT_1_19_LINUX_TARGETS}" + if [ "${RUST}" != "1.24.0" ]; then + TARGETS="${TARGETS} ${RUST_GT_1_24_LINUX_TARGETS}" + fi + fi + fi + + if [ "${RUST}" = "nightly" ]; then + TARGETS="${TARGETS} ${RUST_NIGHTLY_LINUX_TARGETS}" + fi + + ;; + osx*) + TARGETS="${RUST_OSX_TARGETS}" + ;; + *) + ;; +esac + +for TARGET in $TARGETS; do + test_target cargo "$TARGET" +done + +# FIXME: https://github.com/rust-lang/rust/issues/58564 +# sparc-unknown-linux-gnu +RUST_LINUX_NO_CORE_TARGETS="\ +aarch64-pc-windows-msvc \ +aarch64-unknown-cloudabi \ +aarch64-unknown-hermit \ +aarch64-unknown-netbsd \ +aarch64-unknown-openbsd \ +armebv7r-none-eabi \ +armebv7r-none-eabihf \ +armv7-unknown-cloudabi-eabihf \ +armv7r-none-eabi \ +armv7r-none-eabihf \ +i586-pc-windows-msvc \ +i686-pc-windows-msvc \ +i686-unknown-cloudabi \ +i686-unknown-haiku \ +i686-unknown-netbsd \ +i686-unknown-openbsd \ +mips-unknown-linux-uclibc \ +mipsel-unknown-linux-uclibc \ +nvptx64-nvidia-cuda \ +powerpc-unknown-linux-gnuspe \ +powerpc-unknown-netbsd \ +riscv32imac-unknown-none-elf \ +riscv32imc-unknown-none-elf \ +sparc64-unknown-netbsd \ +thumbv6m-none-eabi \ +thumbv7em-none-eabi \ +thumbv7em-none-eabihf \ +thumbv7m-none-eabi \ +thumbv7neon-linux-androideabi \ +thumbv7neon-unknown-linux-gnueabihf \ +thumbv8m.main-none-eabi \ +x86_64-pc-windows-msvc +x86_64-unknown-dragonfly \ +x86_64-unknown-haiku \ +x86_64-unknown-hermit \ +x86_64-unknown-l4re-uclibc \ +x86_64-unknown-openbsd \ +" + +if [ "${RUST}" = "nightly" ] && [ "${OS}" = "linux" ]; then + for TARGET in $RUST_LINUX_NO_CORE_TARGETS; do + test_target xargo "$TARGET" 1 + done +fi diff --git a/libc/ci/docker/aarch64-linux-android/Dockerfile b/libc/ci/docker/aarch64-linux-android/Dockerfile index 5fc83aa..1458423 100644 --- a/libc/ci/docker/aarch64-linux-android/Dockerfile +++ b/libc/ci/docker/aarch64-linux-android/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM ubuntu:19.04 RUN dpkg --add-architecture i386 && \ apt-get update && \ @@ -9,7 +9,7 @@ RUN dpkg --add-architecture i386 && \ python \ unzip \ expect \ - openjdk-9-jre \ + openjdk-11-jre \ libstdc++6:i386 \ libpulse0 \ gcc \ diff --git a/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile b/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile index 18214a3..716a445 100644 --- a/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev ca-certificates \ gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user diff --git a/libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile b/libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile index fbc47d9..143a960 100644 --- a/libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc make libc6-dev git curl ca-certificates \ diff --git a/libc/ci/docker/arm-linux-androideabi/Dockerfile b/libc/ci/docker/arm-linux-androideabi/Dockerfile index a3fc64b..acc784e 100644 --- a/libc/ci/docker/arm-linux-androideabi/Dockerfile +++ b/libc/ci/docker/arm-linux-androideabi/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM ubuntu:19.04 RUN dpkg --add-architecture i386 && \ apt-get update && \ @@ -9,7 +9,7 @@ RUN dpkg --add-architecture i386 && \ python \ unzip \ expect \ - openjdk-9-jre \ + openjdk-11-jre \ libstdc++6:i386 \ libpulse0 \ gcc \ diff --git a/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile b/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile index 9fe71dc..bcdbb22 100644 --- a/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile +++ b/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev ca-certificates \ gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user diff --git a/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile b/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile index 0d493ca..e29e854 100644 --- a/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile +++ b/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc make libc6-dev git curl ca-certificates \ diff --git a/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile b/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile index 3088fc5..6c08340 100644 --- a/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile +++ b/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM ubuntu:19.04 RUN apt-get update && \ apt-get install -y --no-install-recommends \ diff --git a/libc/ci/docker/i686-linux-android/Dockerfile b/libc/ci/docker/i686-linux-android/Dockerfile index f0836c3..59ea2d7 100644 --- a/libc/ci/docker/i686-linux-android/Dockerfile +++ b/libc/ci/docker/i686-linux-android/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM ubuntu:19.04 RUN dpkg --add-architecture i386 && \ apt-get update && \ @@ -9,7 +9,7 @@ RUN dpkg --add-architecture i386 && \ python \ unzip \ expect \ - openjdk-9-jre \ + openjdk-11-jre \ libstdc++6:i386 \ libpulse0 \ gcc \ diff --git a/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile b/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile index 03f3e8e..5563a7b 100644 --- a/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:18.04 +FROM ubuntu:19.04 RUN apt-get update RUN apt-get install -y --no-install-recommends \ gcc-multilib libc6-dev ca-certificates diff --git a/libc/ci/docker/i686-unknown-linux-musl/Dockerfile b/libc/ci/docker/i686-unknown-linux-musl/Dockerfile index b726e4d..c085c10 100644 --- a/libc/ci/docker/i686-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/i686-unknown-linux-musl/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN dpkg --add-architecture i386 RUN apt-get update diff --git a/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile b/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile index c66abd4..9f1bcaf 100644 --- a/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/libc/ci/docker/mips-unknown-linux-musl/Dockerfile b/libc/ci/docker/mips-unknown-linux-musl/Dockerfile index dde22fd..7f2764c 100644 --- a/libc/ci/docker/mips-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/mips-unknown-linux-musl/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \ diff --git a/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile b/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile index b9921fc..b97cdb4 100644 --- a/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile +++ b/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/libc/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile b/libc/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile index 434c908..7f79452 100644 --- a/libc/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile +++ b/libc/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile b/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile index 037bf64..03e8357 100644 --- a/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \ diff --git a/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile b/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile index 106ada4..9fa05af 100644 --- a/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ @@ -7,4 +7,5 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ ENV CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-linux-gnu-gcc \ CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc -L /usr/powerpc-linux-gnu" \ + CC=powerpc-linux-gnu-gcc \ PATH=$PATH:/rust/bin diff --git a/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile b/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile index a6ab66a..ab40789 100644 --- a/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/libc/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile b/libc/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile index 627123e..4dcd632 100644 --- a/libc/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile b/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile index 861f4f9..75c11c1 100644 --- a/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ curl ca-certificates \ diff --git a/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile b/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile index d9edaab..d1f4503 100644 --- a/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile @@ -1,14 +1,11 @@ -FROM debian:stretch +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ curl ca-certificates \ gcc libc6-dev \ gcc-sparc64-linux-gnu libc6-dev-sparc64-cross \ qemu-system-sparc64 openbios-sparc seabios ipxe-qemu \ - p7zip-full cpio linux-libc-dev-sparc64-cross linux-headers-4.9.0-3-common - -# Put linux/module.h into the right spot as it is not shipped by debian -RUN cp /usr/src/linux-headers-4.9.0-3-common/include/uapi/linux/module.h /usr/sparc64-linux-gnu/include/linux/ + p7zip-full cpio linux-libc-dev-sparc64-cross COPY linux-sparc64.sh / RUN bash /linux-sparc64.sh diff --git a/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile b/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile index 59bf7d9..de8e353 100644 --- a/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile +++ b/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM ubuntu:19.04 RUN apt-get update && \ apt-get install -y --no-install-recommends \ diff --git a/libc/ci/docker/wasm32-wasi/Dockerfile b/libc/ci/docker/wasm32-wasi/Dockerfile new file mode 100644 index 0000000..d963a44 --- /dev/null +++ b/libc/ci/docker/wasm32-wasi/Dockerfile @@ -0,0 +1,93 @@ +# In the first container we want to assemble the `wasi-sysroot` by compiling it +# from source. This requires a clang 8.0+ compiler with enough wasm support and +# then we're just running a standard `make` inside of what we clone. +FROM ubuntu:18.04 as wasi-sysroot + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + clang \ + cmake \ + curl \ + g++ \ + git \ + libc6-dev \ + libclang-dev \ + make \ + ssh \ + xz-utils + +# Fetch clang 8.0+ which is used to compile the wasi target and link our +# programs together. +RUN curl http://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz | tar xJf - +RUN mv /clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-18.04 /wasmcc + +# Note that we're using `git reset --hard` to pin to a specific commit for +# verification for now. The sysroot is currently in somewhat of a state of flux +# and is expected to have breaking changes, so this is an attempt to mitigate +# those breaking changes on `libc`'s own CI +RUN git clone https://github.com/CraneStation/wasi-sysroot && \ + cd wasi-sysroot && \ + git reset --hard eee6ee7566e26f2535eb6088c8494a112ff423b9 +RUN make -C wasi-sysroot install -j $(nproc) WASM_CC=/wasmcc/bin/clang INSTALL_DIR=/wasi-sysroot + +# This is a small wrapper script which executes the actual clang binary in +# `/wasmcc` and then is sure to pass the right `--sysroot` argument which we +# just built above. +COPY docker/wasm32-wasi/clang.sh /wasi-sysroot/bin/clang + +# In the second container we're going to build the `wasmtime` binary which is +# used to execute wasi executables. This is a standard Rust project so we're +# just checking out a known revision (which pairs with the sysroot one we +# downlaoded above) and then we're building it with Cargo +FROM ubuntu:18.04 as wasmtime + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + clang \ + cmake \ + curl \ + g++ \ + git \ + libclang-dev \ + make \ + ssh + +RUN curl -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH=/root/.cargo/bin:$PATH + +RUN apt-get install -y --no-install-recommends python +RUN git clone --recursive https://github.com/CraneStation/wasmtime wasmtime && \ + cd wasmtime && \ + git reset --hard 67edb00f29b62864b00179fe4bfa99bc29973285 +RUN cargo build --release --manifest-path wasmtime/Cargo.toml + +# And finally in the last image we're going to assemble everything together. +# We'll install things needed at runtime for now and then copy over the +# sysroot/wasmtime artifacts into their final location. +FROM ubuntu:18.04 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + gcc \ + libc6-dev \ + libxml2 \ + ca-certificates + +# Copy over clang we downloaded to link executables ... +COPY --from=wasi-sysroot /wasmcc /wasmcc/ +# ... and the sysroot we built to link executables against ... +COPY --from=wasi-sysroot /wasi-sysroot/ /wasi-sysroot/ +# ... and finally wasmtime to actually execute binaries +COPY --from=wasmtime /wasmtime/target/release/wasmtime /usr/bin/ + +# Of note here is our clang wrapper which just executes a normal clang +# executable with the right sysroot, and then we're sure to turn off the +# crt-static feature to ensure that the CRT that we're specifying with `clang` +# is used. +ENV CARGO_TARGET_WASM32_WASI_RUNNER=wasmtime \ + CARGO_TARGET_WASM32_WASI_LINKER=/wasi-sysroot/bin/clang \ + CC_wasm32_wasi=/wasi-sysroot/bin/clang \ + PATH=$PATH:/rust/bin \ + RUSTFLAGS=-Ctarget-feature=-crt-static diff --git a/libc/ci/docker/wasm32-wasi/clang.sh b/libc/ci/docker/wasm32-wasi/clang.sh new file mode 100755 index 0000000..6f29812 --- /dev/null +++ b/libc/ci/docker/wasm32-wasi/clang.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +exec /wasmcc/bin/clang --target=wasm32-wasi --sysroot /wasi-sysroot "$@" diff --git a/libc/ci/docker/x86_64-linux-android/Dockerfile b/libc/ci/docker/x86_64-linux-android/Dockerfile index 0cfbc48..b0984c0 100644 --- a/libc/ci/docker/x86_64-linux-android/Dockerfile +++ b/libc/ci/docker/x86_64-linux-android/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM ubuntu:19.04 RUN apt-get update && \ apt-get install -y --no-install-recommends \ diff --git a/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs b/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs index 94b5946..7e96fbf 100644 --- a/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs +++ b/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs @@ -47,7 +47,8 @@ fn find_ok(input: &mut Read, tx: mpsc::Sender<()>) { for line in BufReader::new(input).lines() { let line = line.unwrap(); println!("{}", line); - if line.starts_with("PASSED ") && line.contains(" tests") { + if (line.starts_with("PASSED ") && line.contains(" tests")) || + line.starts_with("test result: ok"){ tx.send(()).unwrap(); } } diff --git a/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile b/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile index 6ab9c92..0dbb191 100644 --- a/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:18.04 +FROM ubuntu:19.04 RUN apt-get update RUN apt-get install -y --no-install-recommends \ gcc libc6-dev ca-certificates diff --git a/libc/ci/docker/x86_64-unknown-linux-gnux32/Dockerfile b/libc/ci/docker/x86_64-unknown-linux-gnux32/Dockerfile index 03f3e8e..5563a7b 100644 --- a/libc/ci/docker/x86_64-unknown-linux-gnux32/Dockerfile +++ b/libc/ci/docker/x86_64-unknown-linux-gnux32/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:18.04 +FROM ubuntu:19.04 RUN apt-get update RUN apt-get install -y --no-install-recommends \ gcc-multilib libc6-dev ca-certificates diff --git a/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile b/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile index 0a27709..59164d2 100644 --- a/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update RUN apt-get install -y --no-install-recommends \ diff --git a/libc/ci/dox.sh b/libc/ci/dox.sh index 521743e..ce55081 100644 --- a/libc/ci/dox.sh +++ b/libc/ci/dox.sh @@ -6,28 +6,65 @@ set -ex -TARGETS=$(grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'| sed 's/)//') +TARGET_DOC_DIR=target/doc +README=README.md +PLATFORM_SUPPORT=platform-support.md -rm -rf target/doc -mkdir -p target/doc +rm -rf $TARGET_DOC_DIR +mkdir -p $TARGET_DOC_DIR -cp ci/landing-page-head.html target/doc/index.html +# List all targets that do currently build successfully: +# shellcheck disable=SC1003 +grep '[\d|\w|-]* \\' ci/build.sh > targets +sed -i.bak 's/ \\//g' targets +grep '^[_a-zA-Z0-9-]*$' targets > tmp && mv tmp targets -for target in $TARGETS; do - echo "documenting ${target}" +# Create a markdown list of supported platforms in $PLATFORM_SUPPORT +rm $PLATFORM_SUPPORT || true - rustdoc -o "target/doc/${target}" --target "${target}" src/lib.rs --cfg cross_platform_docs \ - --crate-name libc +printf '### Platform-specific documentation\n' >> $PLATFORM_SUPPORT - echo "
  • ${target}
  • " \ - >> target/doc/index.html -done +while read -r target; do + echo "documenting ${target}" -cat ci/landing-page-footer.html >> target/doc/index.html + case "${target}" in + *apple*) + # FIXME: + # We can't build docs of apple targets from Linux yet. + continue + ;; + *) + ;; + esac + + rustup target add "${target}" || true + + # If cargo doc fails, then try xargo: + if ! cargo doc --target "${target}" \ + --no-default-features --features extra_traits ; then + xargo doc --target "${target}" \ + --no-default-features --features extra_traits + fi + + cp -r "target/${target}/doc" "${TARGET_DOC_DIR}/${target}" + + echo "* [${target}](${target}/libc/index.html)" >> $PLATFORM_SUPPORT +done < targets + +# Replace
    with the contents of $PLATFORM_SUPPORT +cp $README $TARGET_DOC_DIR +line=$(grep -n '
    ' $README | cut -d ":" -f 1) + +set +x +{ head -n "$((line-1))" $README; cat $PLATFORM_SUPPORT; tail -n "+$((line+1))" $README; } > $TARGET_DOC_DIR/$README +set -x + +# Copy the licenses +cp LICENSE-* $TARGET_DOC_DIR/ # If we're on travis, not a PR, and on the right branch, publish! if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then pip install ghp_import --install-option="--prefix=$HOME/.local" - "${HOME}/.local/bin/ghp-import" -n target/doc + "${HOME}/.local/bin/ghp-import" $TARGET_DOC_DIR git push -qf "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" gh-pages fi diff --git a/libc/ci/ios/deploy_and_run_on_ios_simulator.rs b/libc/ci/ios/deploy_and_run_on_ios_simulator.rs index 95df52d..2075be6 100644 --- a/libc/ci/ios/deploy_and_run_on_ios_simulator.rs +++ b/libc/ci/ios/deploy_and_run_on_ios_simulator.rs @@ -129,8 +129,11 @@ fn run_app_on_simulator() { let stdout = String::from_utf8_lossy(&output.stdout); let passed = stdout.lines() - .find(|l| l.contains("PASSED")) - .map(|l| l.contains("tests")) + .find(|l| + (l.contains("PASSED") && + l.contains("tests")) || + l.contains("test result: ok") + ) .unwrap_or(false); println!("Shutting down simulator"); diff --git a/libc/ci/landing-page-footer.html b/libc/ci/landing-page-footer.html deleted file mode 100644 index 941cc8d..0000000 --- a/libc/ci/landing-page-footer.html +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/libc/ci/landing-page-head.html b/libc/ci/landing-page-head.html deleted file mode 100644 index fc69fa8..0000000 --- a/libc/ci/landing-page-head.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - -