From 52963abcdddae0ee2684c33a1f451b8a3cf0406b Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Sat, 25 Feb 2017 02:16:30 +0000 Subject: [PATCH 01/28] Removed old ci infrastructure. --- .travis.yml | 102 ----------------------------------- ci/README.md | 48 ----------------- ci/cargo-config | 18 ------- ci/run-all.sh | 29 ---------- ci/run-docker.sh | 15 ------ ci/run-travis.sh | 41 -------------- ci/run.sh | 137 ----------------------------------------------- 7 files changed, 390 deletions(-) delete mode 100644 .travis.yml delete mode 100644 ci/README.md delete mode 100644 ci/cargo-config delete mode 100755 ci/run-all.sh delete mode 100755 ci/run-docker.sh delete mode 100644 ci/run-travis.sh delete mode 100755 ci/run.sh diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e08e05e4f6..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,102 +0,0 @@ -# -# Operating Environment -# -language: rust -sudo: false -dist: trusty -services: - - docker -addons: - apt: - packages: - - gcc-multilib - - libcurl4-openssl-dev - - libelf-dev - - libdw-dev - - binutils-dev - -rust: - - 1.7.0 # Oldest supported version - - stable - - beta - - nightly - -# -# Environment Variables and Build Matrix -# -env: - global: - - PATH=$HOME/.local/bin:$PATH - - TRAVIS_CARGO_NIGHTLY_FEATURE="" - matrix: - - ARCH=x86_64 - - ARCH=i686 - -os: # OSX included in build matrix explicitly - - linux - -# Failures on nightly shouldn't fail the overall build. -matrix: - fast_finish: true - include: - # 32-bit and 64-bit OSX builds on oldest/stable - - os: osx - env: ARCH=x86_64 - rust: stable - - os: osx - env: ARCH=i686 - rust: stable - # Docker builds for other targets - - os: linux - env: TARGET=aarch64-unknown-linux-gnu DOCKER_IMAGE=posborne/rust-cross:arm - rust: 1.7.0 - sudo: true - - os: linux - env: TARGET=arm-unknown-linux-gnueabihf DOCKER_IMAGE=posborne/rust-cross:arm - rust: 1.7.0 - sudo: true - - os: linux - env: TARGET=mips-unknown-linux-gnu DOCKER_IMAGE=posborne/rust-cross:mips - rust: 1.7.0 - sudo: true - - os: linux - env: TARGET=mipsel-unknown-linux-gnu DOCKER_IMAGE=posborne/rust-cross:mips - rust: 1.7.0 - sudo: true - - os: linux - env: TARGET=arm-linux-androideabi DOCKER_IMAGE=posborne/rust-cross:android - rust: 1.7.0 - sudo: true - allow_failures: - - rust: nightly - # We need to upgrade the lowest supported version. However, the build - # infrastructure for arm/mips/android is not ready yet. - - rust: 1.7.0 - - env: TARGET=mips-unknown-linux-gnu DOCKER_IMAGE=posborne/rust-cross:mips - - env: TARGET=mipsel-unknown-linux-gnu DOCKER_IMAGE=posborne/rust-cross:mips - - env: TARGET=arm-linux-androideabi DOCKER_IMAGE=posborne/rust-cross:android - - -# -# Build/Test/Deploy Steps -# -before_script: - - pip install 'travis-cargo<0.2' --user - -script: - - bash ci/run-travis.sh - - | - if [ "$TRAVIS_OS_NAME" = "linux" ]; then - travis-cargo --only stable doc - fi - -after_success: - - | - if [ "$TRAVIS_OS_NAME" = "linux" ] && \ - [ "$TRAVIS_RUST_VERSION" = "stable" ] && \ - [ "$ARCH" = "x86_64" ]; then - # Upload docs for stable (on master) to gh-pages - travis-cargo --only stable doc-upload - # Measure code coverage using kcov and upload to coveralls.io - travis-cargo coveralls --no-sudo --verify - fi diff --git a/ci/README.md b/ci/README.md deleted file mode 100644 index c86fd7157d..0000000000 --- a/ci/README.md +++ /dev/null @@ -1,48 +0,0 @@ -Test Infrastructure -=================== - -The ci directory contains scripts that aid in the testing of nix both -in our continuous integration environment (Travis CI) but also for -developers working locally. - -Nix interfaces very directly with the underlying platform (usually via -libc) and changes need to be tested on a large number of platforms to -avoid problems. - -Running Tests For Host Architecture ------------------------------------ - -Running the tests for one's host architecture can be done by simply -doing the following: - - $ cargo test - -Running Tests Against All Architectures/Versions ------------------------------------------------- - -Testing for other architectures is more involved. Currently, -developers may run tests against several architectures and versions of -rust by running the `ci/run-all.sh` script. This scripts requires -that docker be set up. This will take some time: - - $ ci/run-all.sh - -The list of versions and architectures tested by this can be -determined by looking at the contents of the script. The docker image -used is [posborne/rust-cross][posborne/rust-cross]. - -[posborne/rust-cross]: https://github.com/rust-embedded/docker-rust-cross - -Running Test for Specific Architectures/Versions ------------------------------------------------- - -Suppose we have a failing test with Rust 1.7 on the raspberry pi. In -that case, we can run the following: - - $ DOCKER_IMAGE=posborne/rust-cross:arm \ - RUST_VERSION=1.7.0 \ - RUST_TARGET=arm-unknown-linux-gnueabihf ci/run-docker.sh - -Currently, the docker images only support Rust 1.7. To get a better -idea of combinations that might work, look at the contents of the -[travis configuration](../.travis.yml) or [run-all.sh](run-all.sh). diff --git a/ci/cargo-config b/ci/cargo-config deleted file mode 100644 index 6fee5be7a8..0000000000 --- a/ci/cargo-config +++ /dev/null @@ -1,18 +0,0 @@ -# Configuration of which linkers to call on Travis for various architectures -[target.arm-linux-androideabi] -linker = "arm-linux-androideabi-gcc" - -[target.arm-unknown-linux-gnueabihf] -linker = "arm-linux-gnueabihf-gcc-4.7" - -[target.mips-unknown-linux-gnu] -linker = "mips-linux-gnu-gcc-5" - -[target.mipsel-unknown-linux-gnu] -linker = "mipsel-linux-gnu-gcc-5" - -[target.aarch64-unknown-linux-gnu] -linker = "aarch64-linux-gnu-gcc-4.8" - -[target.powerpc-unknown-linux-gnu] -linker = "powerpc-linux-gnu-gcc-4.8" diff --git a/ci/run-all.sh b/ci/run-all.sh deleted file mode 100755 index a7d1ece9ea..0000000000 --- a/ci/run-all.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -# Build nix and all tests for as many versions and platforms as can be -# managed. This requires docker. -# - -set -e - -BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -RUN_DOCKER="${BASE_DIR}/ci/run-docker.sh" - -export RUST_VERSION=1.7.0 - -export DOCKER_IMAGE=posborne/rust-cross:x86 -RUST_TARGET=i686-unknown-linux-gnu ${RUN_DOCKER} -RUST_TARGET=x86_64-unknown-linux-gnu ${RUN_DOCKER} -RUST_TARGET=x86_64-unknown-linux-musl ${RUN_DOCKER} - -export DOCKER_IMAGE=posborne/rust-cross:arm -RUST_TARGET=aarch64-unknown-linux-gnu ${RUN_DOCKER} -RUST_TARGET=arm-linux-gnueabi ${RUN_DOCKER} -RUST_TARGET=arm-linux-gnueabihf ${RUN_DOCKER} - -export DOCKER_IMAGE=posborne/rust-cross:mips -RUST_TARGET=mips-unknown-linux-gnu ${RUN_DOCKER} -RUST_TARGET=mipsel-unknown-linux-gnu ${RUN_DOCKER} - -export DOCKER_IMAGE=posborne/rust-cross:android ${RUN_DOCKER} -RUST_TARGET=arm-linux-androideabi ${RUN_DOCKER} diff --git a/ci/run-docker.sh b/ci/run-docker.sh deleted file mode 100755 index 3ef831c32c..0000000000 --- a/ci/run-docker.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# -# Run the nix tests in a docker container. This script expects the following -# environment variables to be set: -# - DOCKER_IMAGE : Docker image to use for testing (e.g. posborne/rust-cross:arm) -# - RUST_VERSION : Rust Version to test against (e.g. 1.7.0) -# - RUST_TARGET : Target Triple to test - -BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" - -docker run -i -t \ - -v ${BASE_DIR}:/source \ - -e CARGO_TARGET_DIR=/build \ - ${DOCKER_IMAGE} \ - /source/ci/run.sh ${RUST_VERSION} ${RUST_TARGET} diff --git a/ci/run-travis.sh b/ci/run-travis.sh deleted file mode 100644 index 5be6372e51..0000000000 --- a/ci/run-travis.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -# -# Entry point for all travis builds, this will set up the Travis environment by -# downloading any dependencies. It will then execute the `run.sh` script to -# build and execute all tests. -# -# Much of this script was liberally stolen from rust-lang/libc -# -# Key variables that may be set from Travis: -# - TRAVIS_RUST_VERSION: 1.1.0 ... stable/nightly/beta -# - TRAVIS_OS_NAME: linux/osx -# - DOCKER_IMAGE: posborne/rust-cross:arm -# - TARGET: e.g. arm-unknown-linux-gnueabihf - -set -ex - -BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" - -if [ "$TRAVIS_OS_NAME" = "linux" ]; then - OS=unknown-linux-gnu -elif [ "$TRAVIS_OS_NAME" = "osx" ]; then - OS=apple-darwin -else - echo "Unexpected TRAVIS_OS_NAME: $TRAVIS_OS_NAME" - exit 1 -fi - -export HOST=$ARCH-$OS -if [ "$TARGET" = "" ]; then - TARGET=$HOST -fi - -if [ "$DOCKER_IMAGE" = "" ]; then - export RUST_TEST_THREADS=1 - curl -sSL "https://raw.githubusercontent.com/carllerche/travis-rust-matrix/master/test" | bash -else - export RUST_VERSION=${TRAVIS_RUST_VERSION} - export RUST_TARGET=${TARGET} - export DOCKER_IMAGE=${DOCKER_IMAGE} - ${BASE_DIR}/ci/run-docker.sh -fi diff --git a/ci/run.sh b/ci/run.sh deleted file mode 100755 index 770f5aa712..0000000000 --- a/ci/run.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/bash - -# Builds and runs tests for a particular target passed as an argument to this -# script. - -set -e - -# This should only be run in a docker container, so verify that -if [ ! $(pidof $0) = "1" ]; then - echo "run.sh should only be executed in a docker container" - echo "and that does not appear to be the case. Maybe you meant" - echo "to execute the tests via run-all.sh or run-docker.sh." - echo "" - echo "For more instructions, please refer to ci/README.md" - exit 1 -fi - -BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -MANIFEST_PATH="${BASE_DIR}/Cargo.toml" -BUILD_DIR="." - -VERSION="$1" -TARGET="$2" - -export DOCKER_ENVIRONMENT=1 -export RUST_TEST_THREADS=1 -export RUST_BACKTRACE=1 - -# -# Tell cargo what linker to use and whatever else is required -# -configure_cargo() { - mkdir -p .cargo - cp -b "${BASE_DIR}/ci/cargo-config" .cargo/config -} - -# -# We need to export CC for the tests to build properly (some C code is -# compiled) to work. We already tell Cargo about the compiler in the -# cargo config, so we just parse that info out of the cargo config -# -cc_for_target() { - awk "/\[target\.${TARGET}\]/{getline; print}" .cargo/config | - cut -d '=' -f2 | \ - tr -d '"' | tr -d ' ' -} - -cross_compile_tests() { - case "$TARGET" in - *-apple-ios) - cargo test --no-run --manifest-path="${MANIFEST_PATH}" --target "$TARGET" -- \ - -C link-args=-mios-simulator-version-min=7.0 - ;; - - *) - cargo test --no-run --verbose \ - --manifest-path="${MANIFEST_PATH}" \ - --target "$TARGET" - ;; - esac -} - -# This is a hack as we cannot currently -# ask cargo what test files it generated: -# https://github.com/rust-lang/cargo/issues/1924 -find_binaries() { - target_base_dir="${BUILD_DIR}/${TARGET}/debug" - - # find [[test]] sections and print the first line and - # hack it to what we want from there. Also "nix" for - # tests that are implicitly prsent - for test_base in $( awk '/\[\[test\]\]/{getline; print}' "${MANIFEST_PATH}" | \ - cut -d '=' -f2 | \ - tr -d '"' | \ - tr '-' '_' | \ - tr -d ' '; echo "nix" ); do - for path in ${target_base_dir}/${test_base}-* ; do - echo "${path} " - done - done -} - -test_binary() { - binary=$1 - - case "$TARGET" in - arm-linux-gnueabi-gcc) - qemu-arm -L /usr/arm-linux-gnueabihf "$binary" - ;; - - arm-unknown-linux-gnueabihf) - qemu-arm -L /usr/arm-linux-gnueabihf "$binary" - ;; - - mips-unknown-linux-gnu) - qemu-mips -L /usr/mips-linux-gnu "$binary" - ;; - - aarch64-unknown-linux-gnu) - qemu-aarch64 -L /usr/aarch64-linux-gnu "$binary" - ;; - - *-rumprun-netbsd) - rumprun-bake hw_virtio /tmp/nix-test.img "${binary}" - qemu-system-x86_64 -nographic -vga none -m 64 \ - -kernel /tmp/nix-test.img 2>&1 | tee /tmp/out & - sleep 5 - grep "^PASSED .* tests" /tmp/out - ;; - - *) - echo "Running binary: ${binary}" - ${binary} - ;; - esac -} - -echo "=======================================================" -echo "TESTING VERSION: ${VERSION}, TARGET: ${TARGET}" -echo "=======================================================" - -configure_cargo -export CC="$(cc_for_target)" -if [ "${CC}" = "" ]; then - unset CC -fi - -# select the proper version -multirust override ${VERSION} - -# build the tests -cross_compile_tests - -# and run the tests -for bin in $(find_binaries); do - test_binary "${bin}" -done From ee2bff1cc42f5cd8371c10d8d9228fe1c0261023 Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Sat, 25 Feb 2017 02:21:41 +0000 Subject: [PATCH 02/28] Added ci templates from `trust` v0.1.1 --- .travis.yml | 103 +++++++++++++++++++++++++++++++++++++++++++ appveyor.yml | 93 ++++++++++++++++++++++++++++++++++++++ ci/before_deploy.ps1 | 23 ++++++++++ ci/before_deploy.sh | 33 ++++++++++++++ ci/install.sh | 24 ++++++++++ ci/script.sh | 24 ++++++++++ 6 files changed, 300 insertions(+) create mode 100644 .travis.yml create mode 100644 appveyor.yml create mode 100644 ci/before_deploy.ps1 create mode 100644 ci/before_deploy.sh create mode 100644 ci/install.sh create mode 100644 ci/script.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..cf1fa42932 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,103 @@ +# Based on the "trust" template v0.1.1 +# https://github.com/japaric/trust/tree/v0.1.1 + +dist: trusty +language: rust +services: docker +sudo: required + +# TODO This is the Rust channel that build jobs will use by default but can be +# overridden on a case by case basis down below +rust: stable + +env: + global: + # TODO Update this to match the name of your project. + - CRATE_NAME=trust + + # default job + - TARGET=x86_64-unknown-linux-gnu + +matrix: + # TODO These are all the build jobs. Adjust as necessary. Comment out what you + # don't need + include: + # Linux + - env: TARGET=i686-unknown-linux-gnu + - env: TARGET=i686-unknown-linux-musl + # - env: TARGET=x86_64-unknown-linux-gnu # this is the default job + - env: TARGET=x86_64-unknown-linux-musl + + # OSX + - env: TARGET=i686-apple-darwin + os: osx + - env: TARGET=x86_64-apple-darwin + os: osx + + # *BSD + - env: TARGET=i686-unknown-freebsd DISABLE_TESTS=1 + - env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1 + - env: TARGET=x86_64-unknown-netbsd DISABLE_TESTS=1 + + # Other architectures + - env: TARGET=aarch64-unknown-linux-gnu + - env: TARGET=armv7-unknown-linux-gnueabihf + - env: TARGET=mips-unknown-linux-gnu + - env: TARGET=mips64-unknown-linux-gnuabi64 + - env: TARGET=mips64el-unknown-linux-gnuabi64 + - env: TARGET=mipsel-unknown-linux-gnu + - env: TARGET=powerpc-unknown-linux-gnu + - env: TARGET=powerpc64-unknown-linux-gnu + - env: TARGET=powerpc64le-unknown-linux-gnu + - env: TARGET=s390x-unknown-linux-gnu DISABLE_TESTS=1 + + # Testing other channels + - env: TARGET=x86_64-unknown-linux-gnu + rust: nightly + - env: TARGET=x86_64-apple-darwin + os: osx + rust: nightly + +install: + - sh ci/install.sh + - source ~/.cargo/env || true + +script: + - bash ci/script.sh + +before_deploy: + - sh ci/before_deploy.sh + +deploy: + # TODO update `api_key.secure` + # - Create a `public_repo` GitHub token. Go to: https://github.com/settings/tokens/new + # - Encrypt it: `travis encrypt GH_TOKEN=0123456789012345678901234567890123456789` + # - Paste the output down here + api_key: + secure: A9v3PIzQQ4U08OHFmDPQzNXbNHEb7YHyLXCvMF+dXFuNSvhUNlmQYykxqUf3dvikhJL2/bsZ14umm7ni7fQh0tGwJ4+lPpNzYAcweGgNXnWvjTpY6ovuRbr3gs4/srkyxp/GBDmSW5L8wFN3hKCB+Lm0YnIPB9IA2afP8a30+8VTXT9nv7pNqGny4ilN41ycr4DZi3sQoXdbruy7ClN7gsWW/GUiudBccHVIjmTapOFKLwZHODaUl/1/RDWQzh+i+17e1ivXuJPktDSrqmHPTZ15OjklnHKd6t179ry6VkGRg4R/R/YukVIqGzeaXGWAwdAQ5gE8cjGZghJLVi2jkDBJ85z8MvT+zLZLyliiuhLc/X8y7mkE1n0FKFtXXzFVt0l7V1LaEKbIbiV6XX3jsir4qgkqWjPHBZqO5mkGNFS16Dmt30/ZtEPAzXiINFXbWuWrpQ/LZ4NSto8IMrRTcoyDbAga/KYxJiNIeVuCe1E9dbytDM7K0GLtxJTul/WnnSeI6r//EFyC4bxYjyHhCXaag4q14KM+ak4rB0QgxsYzyGuh2MqyCoVj8YJLjLdKnL/SV7W7LPD40xlxvI6VCYTVi2ILHwL6vCxpukXYteX0c5IAIWkISDKu6nNBEgmCHXXPSqYSrgE5g7/QoCQHI8++nR8iKe0s7TWxZRydby8= + file_glob: true + file: $CRATE_NAME-$TRAVIS_TAG-$TARGET.* + on: + # TODO Here you can pick which targets will generate binary releases + # In this example, there are some targets that are tested using the stable + # and nightly channels. This condition makes sure there is only one release + # for such targets and that's generated using the stable channel + condition: $TRAVIS_RUST_VERSION = stable + tags: true + provider: releases + skip_cleanup: true + +cache: cargo +before_cache: + # Travis can't cache files that are not readable by "others" + - chmod -R a+r $HOME/.cargo + +branches: + only: + # release tags + - /^v\d+\.\d+\.\d+.*$/ + - master + +notifications: + email: + on_success: never diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000000..ca13308313 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,93 @@ +# Based on the "trust" template v0.1.1 +# https://github.com/japaric/trust/tree/v0.1.1 + +environment: + global: + # TODO This is the Rust channel that build jobs will use by default but can be + # overridden on a case by case basis down below + RUST_VERSION: stable + + # TODO Update this to match the name of your project. + CRATE_NAME: trust + + # TODO These are all the build jobs. Adjust as necessary. Comment out what you + # don't need + matrix: + # MinGW + - TARGET: i686-pc-windows-gnu + - TARGET: x86_64-pc-windows-gnu + + # MSVC + - TARGET: i686-pc-windows-msvc + - TARGET: x86_64-pc-windows-msvc + + # Testing other channels + - TARGET: x86_64-pc-windows-gnu + RUST_VERSION: nightly + - TARGET: x86_64-pc-windows-msvc + RUST_VERSION: nightly + +install: + - ps: >- + If ($Env:TARGET -eq 'x86_64-pc-windows-gnu') { + $Env:PATH += ';C:\msys64\mingw64\bin' + } ElseIf ($Env:TARGET -eq 'i686-pc-windows-gnu') { + $Env:PATH += ';C:\msys64\mingw32\bin' + } + - curl -sSf -o rustup-init.exe https://win.rustup.rs/ + - rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION% + - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin + - rustc -Vv + - cargo -V + +# TODO This is the "test phase", tweak it as you see fit +test_script: + # we don't run the "test phase" when doing deploys + - if [%APPVEYOR_REPO_TAG%]==[false] ( + cargo build --target %TARGET% && + cargo build --target %TARGET% --release && + cargo test --target %TARGET% && + cargo test --target %TARGET% --release && + cargo run --target %TARGET% && + cargo run --target %TARGET% --release + ) + +before_deploy: + # TODO Update this to build the artifacts that matter to you + - cargo rustc --target %TARGET% --release --bin hello -- -C lto + - ps: ci\before_deploy.ps1 + +deploy: + artifact: /.*\.zip/ + # TODO update `auth_token.secure` + # - Create a `public_repo` GitHub token. Go to: https://github.com/settings/tokens/new + # - Encrypt it. Go to https://ci.appveyor.com/tools/encrypt + # - Paste the output down here + auth_token: + secure: t3puM/2hOig26EHhAodcZBc61NywF7/PFEpimR6SwGaCiqS07KR5i7iAhSABmBp7 + description: '' + on: + # TODO Here you can pick which targets will generate binary releases + # In this example, there are some targets that are tested using the stable + # and nightly channels. This condition makes sure there is only one release + # for such targets and that's generated using the stable channel + RUST_VERSION: stable + appveyor_repo_tag: true + provider: GitHub + +cache: + - C:\Users\appveyor\.cargo\registry + - target + +branches: + only: + # Release tags + - /^v\d+\.\d+\.\d+.*$/ + - master + +notifications: + - provider: Email + on_build_success: false + +# disable automatic builds +build: false diff --git a/ci/before_deploy.ps1 b/ci/before_deploy.ps1 new file mode 100644 index 0000000000..191a30b88d --- /dev/null +++ b/ci/before_deploy.ps1 @@ -0,0 +1,23 @@ +# This script takes care of packaging the build artifacts that will go in the +# release zipfile + +$SRC_DIR = $PWD.Path +$STAGE = [System.Guid]::NewGuid().ToString() + +Set-Location $ENV:Temp +New-Item -Type Directory -Name $STAGE +Set-Location $STAGE + +$ZIP = "$SRC_DIR\$($Env:CRATE_NAME)-$($Env:APPVEYOR_REPO_TAG_NAME)-$($Env:TARGET).zip" + +# TODO Update this to package the right artifacts +Copy-Item "$SRC_DIR\target\$($Env:TARGET)\release\hello.exe" '.\' + +7z a "$ZIP" * + +Push-AppveyorArtifact "$ZIP" + +Remove-Item *.* -Force +Set-Location .. +Remove-Item $STAGE +Set-Location $SRC_DIR diff --git a/ci/before_deploy.sh b/ci/before_deploy.sh new file mode 100644 index 0000000000..026dc2898d --- /dev/null +++ b/ci/before_deploy.sh @@ -0,0 +1,33 @@ +# This script takes care of building your crate and packaging it for release + +set -ex + +main() { + local src=$(pwd) \ + stage= + + case $TRAVIS_OS_NAME in + linux) + stage=$(mktemp -d) + ;; + osx) + stage=$(mktemp -d -t tmp) + ;; + esac + + test -f Cargo.lock || cargo generate-lockfile + + # TODO Update this to build the artifacts that matter to you + cross rustc --bin hello --target $TARGET --release -- -C lto + + # TODO Update this to package the right artifacts + cp target/$TARGET/release/hello $stage/ + + cd $stage + tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz * + cd $src + + rm -rf $stage +} + +main diff --git a/ci/install.sh b/ci/install.sh new file mode 100644 index 0000000000..4093c9b2d7 --- /dev/null +++ b/ci/install.sh @@ -0,0 +1,24 @@ +set -ex + +main() { + curl https://sh.rustup.rs -sSf | \ + sh -s -- -y --default-toolchain $TRAVIS_RUST_VERSION + + local target= + if [ $TRAVIS_OS_NAME = linux ]; then + target=x86_64-unknown-linux-gnu + else + target=x86_64-apple-darwin + fi + + # TODO At some point you'll probably want to use a newer release of `cross`, + # simply change the argument to `--tag`. + curl -LSfs https://japaric.github.io/trust/install.sh | \ + sh -s -- \ + --force \ + --git japaric/cross \ + --tag v0.1.4 \ + --target $target +} + +main diff --git a/ci/script.sh b/ci/script.sh new file mode 100644 index 0000000000..de1f77c5d4 --- /dev/null +++ b/ci/script.sh @@ -0,0 +1,24 @@ +# This script takes care of testing your crate + +set -ex + +# TODO This is the "test phase", tweak it as you see fit +main() { + cross build --target $TARGET + cross build --target $TARGET --release + + if [ -n $DISABLE_TESTS ]; then + return + fi + + cross test --target $TARGET + cross test --target $TARGET --release + + cross run --target $TARGET + cross run --target $TARGET --release +} + +# we don't run the "test phase" when doing deploys +if [ -z $TRAVIS_TAG ]; then + main +fi From 129a9d853cabada39eb71b9f39f5347c719fa76f Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Sat, 25 Feb 2017 02:26:20 +0000 Subject: [PATCH 03/28] Removed appveyor -- this is a unix only lib. --- appveyor.yml | 93 ---------------------------------------------------- 1 file changed, 93 deletions(-) delete mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index ca13308313..0000000000 --- a/appveyor.yml +++ /dev/null @@ -1,93 +0,0 @@ -# Based on the "trust" template v0.1.1 -# https://github.com/japaric/trust/tree/v0.1.1 - -environment: - global: - # TODO This is the Rust channel that build jobs will use by default but can be - # overridden on a case by case basis down below - RUST_VERSION: stable - - # TODO Update this to match the name of your project. - CRATE_NAME: trust - - # TODO These are all the build jobs. Adjust as necessary. Comment out what you - # don't need - matrix: - # MinGW - - TARGET: i686-pc-windows-gnu - - TARGET: x86_64-pc-windows-gnu - - # MSVC - - TARGET: i686-pc-windows-msvc - - TARGET: x86_64-pc-windows-msvc - - # Testing other channels - - TARGET: x86_64-pc-windows-gnu - RUST_VERSION: nightly - - TARGET: x86_64-pc-windows-msvc - RUST_VERSION: nightly - -install: - - ps: >- - If ($Env:TARGET -eq 'x86_64-pc-windows-gnu') { - $Env:PATH += ';C:\msys64\mingw64\bin' - } ElseIf ($Env:TARGET -eq 'i686-pc-windows-gnu') { - $Env:PATH += ';C:\msys64\mingw32\bin' - } - - curl -sSf -o rustup-init.exe https://win.rustup.rs/ - - rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION% - - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - - rustc -Vv - - cargo -V - -# TODO This is the "test phase", tweak it as you see fit -test_script: - # we don't run the "test phase" when doing deploys - - if [%APPVEYOR_REPO_TAG%]==[false] ( - cargo build --target %TARGET% && - cargo build --target %TARGET% --release && - cargo test --target %TARGET% && - cargo test --target %TARGET% --release && - cargo run --target %TARGET% && - cargo run --target %TARGET% --release - ) - -before_deploy: - # TODO Update this to build the artifacts that matter to you - - cargo rustc --target %TARGET% --release --bin hello -- -C lto - - ps: ci\before_deploy.ps1 - -deploy: - artifact: /.*\.zip/ - # TODO update `auth_token.secure` - # - Create a `public_repo` GitHub token. Go to: https://github.com/settings/tokens/new - # - Encrypt it. Go to https://ci.appveyor.com/tools/encrypt - # - Paste the output down here - auth_token: - secure: t3puM/2hOig26EHhAodcZBc61NywF7/PFEpimR6SwGaCiqS07KR5i7iAhSABmBp7 - description: '' - on: - # TODO Here you can pick which targets will generate binary releases - # In this example, there are some targets that are tested using the stable - # and nightly channels. This condition makes sure there is only one release - # for such targets and that's generated using the stable channel - RUST_VERSION: stable - appveyor_repo_tag: true - provider: GitHub - -cache: - - C:\Users\appveyor\.cargo\registry - - target - -branches: - only: - # Release tags - - /^v\d+\.\d+\.\d+.*$/ - - master - -notifications: - - provider: Email - on_build_success: false - -# disable automatic builds -build: false From 399b1c1c5e61390300076a2db23561b7b8f3ba85 Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Sat, 25 Feb 2017 02:41:20 +0000 Subject: [PATCH 04/28] Updated .travis.yml --- .travis.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index cf1fa42932..87d36fd0be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,20 +6,19 @@ language: rust services: docker sudo: required -# TODO This is the Rust channel that build jobs will use by default but can be +# This is the Rust channel that build jobs will use by default but can be # overridden on a case by case basis down below rust: stable env: global: - # TODO Update this to match the name of your project. - - CRATE_NAME=trust + - CRATE_NAME=nix # default job - TARGET=x86_64-unknown-linux-gnu matrix: - # TODO These are all the build jobs. Adjust as necessary. Comment out what you + # These are all the build jobs. Adjust as necessary. Comment out what you # don't need include: # Linux @@ -44,12 +43,12 @@ matrix: - env: TARGET=armv7-unknown-linux-gnueabihf - env: TARGET=mips-unknown-linux-gnu - env: TARGET=mips64-unknown-linux-gnuabi64 - - env: TARGET=mips64el-unknown-linux-gnuabi64 - - env: TARGET=mipsel-unknown-linux-gnu + # - env: TARGET=mips64el-unknown-linux-gnuabi64 + # - env: TARGET=mipsel-unknown-linux-gnu - env: TARGET=powerpc-unknown-linux-gnu - env: TARGET=powerpc64-unknown-linux-gnu - - env: TARGET=powerpc64le-unknown-linux-gnu - - env: TARGET=s390x-unknown-linux-gnu DISABLE_TESTS=1 + # - env: TARGET=powerpc64le-unknown-linux-gnu + # - env: TARGET=s390x-unknown-linux-gnu DISABLE_TESTS=1 # Testing other channels - env: TARGET=x86_64-unknown-linux-gnu @@ -74,15 +73,17 @@ deploy: # - Encrypt it: `travis encrypt GH_TOKEN=0123456789012345678901234567890123456789` # - Paste the output down here api_key: - secure: A9v3PIzQQ4U08OHFmDPQzNXbNHEb7YHyLXCvMF+dXFuNSvhUNlmQYykxqUf3dvikhJL2/bsZ14umm7ni7fQh0tGwJ4+lPpNzYAcweGgNXnWvjTpY6ovuRbr3gs4/srkyxp/GBDmSW5L8wFN3hKCB+Lm0YnIPB9IA2afP8a30+8VTXT9nv7pNqGny4ilN41ycr4DZi3sQoXdbruy7ClN7gsWW/GUiudBccHVIjmTapOFKLwZHODaUl/1/RDWQzh+i+17e1ivXuJPktDSrqmHPTZ15OjklnHKd6t179ry6VkGRg4R/R/YukVIqGzeaXGWAwdAQ5gE8cjGZghJLVi2jkDBJ85z8MvT+zLZLyliiuhLc/X8y7mkE1n0FKFtXXzFVt0l7V1LaEKbIbiV6XX3jsir4qgkqWjPHBZqO5mkGNFS16Dmt30/ZtEPAzXiINFXbWuWrpQ/LZ4NSto8IMrRTcoyDbAga/KYxJiNIeVuCe1E9dbytDM7K0GLtxJTul/WnnSeI6r//EFyC4bxYjyHhCXaag4q14KM+ak4rB0QgxsYzyGuh2MqyCoVj8YJLjLdKnL/SV7W7LPD40xlxvI6VCYTVi2ILHwL6vCxpukXYteX0c5IAIWkISDKu6nNBEgmCHXXPSqYSrgE5g7/QoCQHI8++nR8iKe0s7TWxZRydby8= + secure: S1ktt0eqmfrEHnYPf4WO7mZtatz/FWfYWBp8nwdc0nd8H6UNZ9Dwy3tJpVe0N9rpB9vAFnkdw6R4jdkIcgxfory2F3F8k/mh8cWn0mkvh2N34YjHMYLnuVzOoFrWai7IcPfROpdlY0tGBlwNj5KMkeBnHUJzd2q4j/4j/tlrfmg= file_glob: true file: $CRATE_NAME-$TRAVIS_TAG-$TARGET.* on: - # TODO Here you can pick which targets will generate binary releases + # Here you can pick which targets will generate binary releases # In this example, there are some targets that are tested using the stable # and nightly channels. This condition makes sure there is only one release # for such targets and that's generated using the stable channel - condition: $TRAVIS_RUST_VERSION = stable + # + # Here we make it so we never generate binary releases + condition: $DEPLOY = never tags: true provider: releases skip_cleanup: true From fc09d70f1586ae92d21ca5f256b87106abcad226 Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Sat, 25 Feb 2017 20:02:22 +0000 Subject: [PATCH 05/28] Enabled tests for BSD. Added mipsel & mips64el --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 87d36fd0be..1bfce8d1ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,21 +34,21 @@ matrix: os: osx # *BSD - - env: TARGET=i686-unknown-freebsd DISABLE_TESTS=1 - - env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1 - - env: TARGET=x86_64-unknown-netbsd DISABLE_TESTS=1 + - env: TARGET=i686-unknown-freebsd + - env: TARGET=x86_64-unknown-freebsd + - env: TARGET=x86_64-unknown-netbsd # Other architectures - env: TARGET=aarch64-unknown-linux-gnu - env: TARGET=armv7-unknown-linux-gnueabihf - env: TARGET=mips-unknown-linux-gnu - env: TARGET=mips64-unknown-linux-gnuabi64 - # - env: TARGET=mips64el-unknown-linux-gnuabi64 - # - env: TARGET=mipsel-unknown-linux-gnu + - env: TARGET=mips64el-unknown-linux-gnuabi64 + - env: TARGET=mipsel-unknown-linux-gnu - env: TARGET=powerpc-unknown-linux-gnu - env: TARGET=powerpc64-unknown-linux-gnu # - env: TARGET=powerpc64le-unknown-linux-gnu - # - env: TARGET=s390x-unknown-linux-gnu DISABLE_TESTS=1 + # - env: TARGET=s390x-unknown-linux-gnu # Testing other channels - env: TARGET=x86_64-unknown-linux-gnu From 9adff82f5a1e3ded0e6a64cc5790dd4a62b41470 Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Sat, 25 Feb 2017 20:40:10 +0000 Subject: [PATCH 06/28] Added/removed CI arches. Added: - arm-unknown-linux-gnueabi - arm-unknown-linux-musleabi Removed: - powerpc64-unknown-linux-gnu (not suppported by nix) - mips64el-unknown-linux-gnu (not suppported by nix) - mipsel-unknown-linux-gnu (not suppported by nix) --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1bfce8d1ac..6b0afab542 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,9 +46,11 @@ matrix: - env: TARGET=mips64el-unknown-linux-gnuabi64 - env: TARGET=mipsel-unknown-linux-gnu - env: TARGET=powerpc-unknown-linux-gnu - - env: TARGET=powerpc64-unknown-linux-gnu + # - env: TARGET=powerpc64-unknown-linux-gnu # - env: TARGET=powerpc64le-unknown-linux-gnu # - env: TARGET=s390x-unknown-linux-gnu + - env: TARGET=arm-unknown-linux-gnueabi + - env: TARGET=arm-unknown-linux-musleabi # Testing other channels - env: TARGET=x86_64-unknown-linux-gnu From ed0c6d36889ae4cfa2273acc1ee3b7bb9f012b5b Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Sat, 25 Feb 2017 20:59:35 +0000 Subject: [PATCH 07/28] Removed arches. Removed: - mips64-unknown-linux-gnu - mips64el-unknown-linux-gnu - arm-unknown-linux-musleabi --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6b0afab542..8f780bdcf3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,15 +42,15 @@ matrix: - env: TARGET=aarch64-unknown-linux-gnu - env: TARGET=armv7-unknown-linux-gnueabihf - env: TARGET=mips-unknown-linux-gnu - - env: TARGET=mips64-unknown-linux-gnuabi64 - - env: TARGET=mips64el-unknown-linux-gnuabi64 + # - env: TARGET=mips64-unknown-linux-gnuabi64 + # - env: TARGET=mips64el-unknown-linux-gnuabi64 - env: TARGET=mipsel-unknown-linux-gnu - env: TARGET=powerpc-unknown-linux-gnu # - env: TARGET=powerpc64-unknown-linux-gnu # - env: TARGET=powerpc64le-unknown-linux-gnu # - env: TARGET=s390x-unknown-linux-gnu - env: TARGET=arm-unknown-linux-gnueabi - - env: TARGET=arm-unknown-linux-musleabi + # - env: TARGET=arm-unknown-linux-musleabi # Testing other channels - env: TARGET=x86_64-unknown-linux-gnu From c1dd0331044907e371da0f80d0df8ce4c271b597 Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Sat, 25 Feb 2017 21:00:36 +0000 Subject: [PATCH 08/28] Fixed ci/script.sh to run tests when desired. --- ci/script.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/script.sh b/ci/script.sh index de1f77c5d4..ddd7f9362a 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -7,7 +7,7 @@ main() { cross build --target $TARGET cross build --target $TARGET --release - if [ -n $DISABLE_TESTS ]; then + if [ ! -z $DISABLE_TESTS ]; then return fi From 1e84da2acf1c80cfeb4e7510c2b48337d0858920 Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Sat, 25 Feb 2017 21:18:53 +0000 Subject: [PATCH 09/28] Removed 'cargo run' directives from ci script. --- ci/script.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ci/script.sh b/ci/script.sh index ddd7f9362a..260fb073ab 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -2,8 +2,8 @@ set -ex -# TODO This is the "test phase", tweak it as you see fit main() { + # Build debug and release targets cross build --target $TARGET cross build --target $TARGET --release @@ -11,11 +11,13 @@ main() { return fi + # Run tests on debug and release targets. cross test --target $TARGET cross test --target $TARGET --release - cross run --target $TARGET - cross run --target $TARGET --release + # nix is a library -- no run target + # cross run --target $TARGET + # cross run --target $TARGET --release } # we don't run the "test phase" when doing deploys From cb416eeeabdf04fd693d87d4bd4c829445d125e8 Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Sat, 25 Feb 2017 21:33:30 +0000 Subject: [PATCH 10/28] Disable tests on BSD targets. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f780bdcf3..53bc090e02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,9 +34,9 @@ matrix: os: osx # *BSD - - env: TARGET=i686-unknown-freebsd - - env: TARGET=x86_64-unknown-freebsd - - env: TARGET=x86_64-unknown-netbsd + - env: TARGET=i686-unknown-freebsd DISABLE_TESTS=1 + - env: TARGET=x86_64-unknown-freebsd DISABLE_TESTS=1 + - env: TARGET=x86_64-unknown-netbsd DISABLE_TESTS=1 # Other architectures - env: TARGET=aarch64-unknown-linux-gnu From 22c37c25f9ea479fe84e613d3059f1a4099af5fc Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Sun, 26 Feb 2017 15:48:49 +0000 Subject: [PATCH 11/28] Removed commented `cargo run` targets in CI --- ci/script.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ci/script.sh b/ci/script.sh index 260fb073ab..39c3aeec73 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -14,10 +14,6 @@ main() { # Run tests on debug and release targets. cross test --target $TARGET cross test --target $TARGET --release - - # nix is a library -- no run target - # cross run --target $TARGET - # cross run --target $TARGET --release } # we don't run the "test phase" when doing deploys From a859ee3c9396dfdb118fcc2c8ecc697e2d303467 Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Sun, 26 Feb 2017 20:01:01 +0000 Subject: [PATCH 12/28] Switched bsd speed_t def. to libc::speed_t --- src/sys/termios.rs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/sys/termios.rs b/src/sys/termios.rs index e8df1ed95b..db80cc2dca 100644 --- a/src/sys/termios.rs +++ b/src/sys/termios.rs @@ -96,22 +96,14 @@ mod ffi { #[cfg(any(target_os = "macos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd"))] pub mod consts { - #[cfg(not(any(target_os = "dragonfly", target_os = "netbsd")))] - use libc::{c_int, c_ulong, c_uchar}; - #[cfg(any(target_os = "dragonfly", target_os = "netbsd"))] - use libc::{c_int, c_uint, c_uchar}; - #[cfg(not(any(target_os = "dragonfly", target_os = "netbsd")))] - pub type tcflag_t = c_ulong; - #[cfg(any(target_os = "dragonfly", target_os = "netbsd"))] - pub type tcflag_t = c_uint; + use libc; - pub type cc_t = c_uchar; + use libc::{c_int, c_uint, c_ulong, c_uchar}; - #[cfg(not(any(target_os = "dragonfly", target_os = "netbsd")))] - pub type speed_t = c_ulong; - #[cfg(any(target_os = "dragonfly", target_os = "netbsd"))] - pub type speed_t = c_uint; + pub type tcflag_t = libc::tcflag_t; + pub type cc_t = libc::cc_t; + pub type speed_t = libc::speed_t; #[repr(C)] #[derive(Clone, Copy)] From 219671727fdb354a87d6bf453ced0cdb16bbd232 Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Sun, 26 Feb 2017 21:28:00 +0000 Subject: [PATCH 13/28] Fixes nix-rust/nix#532 --- src/sys/event.rs | 14 ++++++++++---- src/sys/termios.rs | 6 +++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/sys/event.rs b/src/sys/event.rs index 3e2a6d43c9..494c12dd47 100644 --- a/src/sys/event.rs +++ b/src/sys/event.rs @@ -22,8 +22,14 @@ pub struct KEvent { target_os = "dragonfly", target_os = "macos", target_os = "ios"))] type type_of_udata = *mut ::c_void; +#[cfg(any(target_os = "openbsd", target_os = "freebsd", + target_os = "dragonfly", target_os = "macos", + target_os = "ios"))] +type type_of_data = libc::intptr_t; #[cfg(any(target_os = "netbsd"))] type type_of_udata = intptr_t; +#[cfg(any(target_os = "netbsd"))] +type type_of_data = libc::int64_t; #[cfg(not(target_os = "netbsd"))] type type_of_event_filter = i16; @@ -58,9 +64,9 @@ pub enum EventFilter { } #[cfg(target_os = "netbsd")] -type type_of_event_filter = i32; +type type_of_event_filter = libc::uint32_t; #[cfg(target_os = "netbsd")] -#[repr(u32)] +#[repr(i32)] #[derive(Clone, Copy, Debug, PartialEq)] pub enum EventFilter { EVFILT_READ = libc::EVFILT_READ, @@ -216,7 +222,7 @@ impl KEvent { filter: filter as type_of_event_filter, flags: flags.bits(), fflags: fflags.bits(), - data: data, + data: data as type_of_data, udata: udata as type_of_udata } } } @@ -238,7 +244,7 @@ impl KEvent { } pub fn data(&self) -> intptr_t { - self.kevent.data + self.kevent.data as intptr_t } pub fn udata(&self) -> intptr_t { diff --git a/src/sys/termios.rs b/src/sys/termios.rs index db80cc2dca..6ff7774751 100644 --- a/src/sys/termios.rs +++ b/src/sys/termios.rs @@ -158,7 +158,7 @@ mod ffi { B7200, B14400, B28800, B57600, B76800, B115200, B230400}; - #[cfg(any(target_os = "netbsd", target_os = "freebsd"))] + #[cfg(target_os = "freebsd")] use libc::{B460800, B921600}; match s { @@ -185,9 +185,9 @@ mod ffi { B76800 => BaudRate::B76800, B115200 => BaudRate::B115200, B230400 => BaudRate::B230400, - #[cfg(any(target_os = "netbsd", target_os = "freebsd"))] + #[cfg(target_os = "freebsd")] B460800 => BaudRate::B460800, - #[cfg(any(target_os = "netbsd", target_os = "freebsd"))] + #[cfg(target_os = "freebsd")] B921600 => BaudRate::B921600, b @ _ => unreachable!("Invalid baud constant: {}", b), } From 3354ffe91dcc217c6ac62f88d5e54a1ea34e5f7a Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Thu, 2 Mar 2017 18:01:58 +0000 Subject: [PATCH 14/28] Fixed constants for MIPS --- src/errno.rs | 558 ++++++++++++++++++++------------------- src/sys/socket/consts.rs | 50 ++-- 2 files changed, 306 insertions(+), 302 deletions(-) diff --git a/src/errno.rs b/src/errno.rs index 4218bf9cd3..d8aaf7f3f8 100644 --- a/src/errno.rs +++ b/src/errno.rs @@ -374,10 +374,10 @@ fn desc(errno: Errno) -> &'static str { #[cfg(any(target_os = "linux", target_os = "android"))] ENOTRECOVERABLE => "State not recoverable", - #[cfg(target_os = "linux")] + #[cfg(all(target_os = "linux", not(target_arch="mips")))] ERFKILL => "Operation not possible due to RF-kill", - #[cfg(target_os = "linux")] + #[cfg(all(target_os = "linux", not(target_arch="mips")))] EHWPOISON => "Memory page has hardware error", #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] @@ -522,143 +522,145 @@ fn desc(errno: Errno) -> &'static str { #[cfg(any(target_os = "linux", target_os = "android"))] mod consts { + use libc; + #[derive(Debug, Clone, PartialEq, Copy)] pub enum Errno { UnknownErrno = 0, - EPERM = 1, - ENOENT = 2, - ESRCH = 3, - EINTR = 4, - EIO = 5, - ENXIO = 6, - E2BIG = 7, - ENOEXEC = 8, - EBADF = 9, - ECHILD = 10, - EAGAIN = 11, - ENOMEM = 12, - EACCES = 13, - EFAULT = 14, - ENOTBLK = 15, - EBUSY = 16, - EEXIST = 17, - EXDEV = 18, - ENODEV = 19, - ENOTDIR = 20, - EISDIR = 21, - EINVAL = 22, - ENFILE = 23, - EMFILE = 24, - ENOTTY = 25, - ETXTBSY = 26, - EFBIG = 27, - ENOSPC = 28, - ESPIPE = 29, - EROFS = 30, - EMLINK = 31, - EPIPE = 32, - EDOM = 33, - ERANGE = 34, - EDEADLK = 35, - ENAMETOOLONG = 36, - ENOLCK = 37, - ENOSYS = 38, - ENOTEMPTY = 39, - ELOOP = 40, - ENOMSG = 42, - EIDRM = 43, - ECHRNG = 44, - EL2NSYNC = 45, - EL3HLT = 46, - EL3RST = 47, - ELNRNG = 48, - EUNATCH = 49, - ENOCSI = 50, - EL2HLT = 51, - EBADE = 52, - EBADR = 53, - EXFULL = 54, - ENOANO = 55, - EBADRQC = 56, - EBADSLT = 57, - EBFONT = 59, - ENOSTR = 60, - ENODATA = 61, - ETIME = 62, - ENOSR = 63, - ENONET = 64, - ENOPKG = 65, - EREMOTE = 66, - ENOLINK = 67, - EADV = 68, - ESRMNT = 69, - ECOMM = 70, - EPROTO = 71, - EMULTIHOP = 72, - EDOTDOT = 73, - EBADMSG = 74, - EOVERFLOW = 75, - ENOTUNIQ = 76, - EBADFD = 77, - EREMCHG = 78, - ELIBACC = 79, - ELIBBAD = 80, - ELIBSCN = 81, - ELIBMAX = 82, - ELIBEXEC = 83, - EILSEQ = 84, - ERESTART = 85, - ESTRPIPE = 86, - EUSERS = 87, - ENOTSOCK = 88, - EDESTADDRREQ = 89, - EMSGSIZE = 90, - EPROTOTYPE = 91, - ENOPROTOOPT = 92, - EPROTONOSUPPORT = 93, - ESOCKTNOSUPPORT = 94, - EOPNOTSUPP = 95, - EPFNOSUPPORT = 96, - EAFNOSUPPORT = 97, - EADDRINUSE = 98, - EADDRNOTAVAIL = 99, - ENETDOWN = 100, - ENETUNREACH = 101, - ENETRESET = 102, - ECONNABORTED = 103, - ECONNRESET = 104, - ENOBUFS = 105, - EISCONN = 106, - ENOTCONN = 107, - ESHUTDOWN = 108, - ETOOMANYREFS = 109, - ETIMEDOUT = 110, - ECONNREFUSED = 111, - EHOSTDOWN = 112, - EHOSTUNREACH = 113, - EALREADY = 114, - EINPROGRESS = 115, - ESTALE = 116, - EUCLEAN = 117, - ENOTNAM = 118, - ENAVAIL = 119, - EISNAM = 120, - EREMOTEIO = 121, - EDQUOT = 122, - ENOMEDIUM = 123, - EMEDIUMTYPE = 124, - ECANCELED = 125, - ENOKEY = 126, - EKEYEXPIRED = 127, - EKEYREVOKED = 128, - EKEYREJECTED = 129, - EOWNERDEAD = 130, - ENOTRECOVERABLE = 131, - - #[cfg(not(target_os = "android"))] - ERFKILL = 132, - #[cfg(not(target_os = "android"))] - EHWPOISON = 133, + EPERM = libc::EPERM as isize, + ENOENT = libc::ENOENT as isize, + ESRCH = libc::ESRCH as isize, + EINTR = libc::EINTR as isize, + EIO = libc::EIO as isize, + ENXIO = libc::ENXIO as isize, + E2BIG = libc::E2BIG as isize, + ENOEXEC = libc::ENOEXEC as isize, + EBADF = libc::EBADF as isize, + ECHILD = libc::ECHILD as isize, + EAGAIN = libc::EAGAIN as isize, + ENOMEM = libc::ENOMEM as isize, + EACCES = libc::EACCES as isize, + EFAULT = libc::EFAULT as isize, + ENOTBLK = libc::ENOTBLK as isize, + EBUSY = libc::EBUSY as isize, + EEXIST = libc::EEXIST as isize, + EXDEV = libc::EXDEV as isize, + ENODEV = libc::ENODEV as isize, + ENOTDIR = libc::ENOTDIR as isize, + EISDIR = libc::EISDIR as isize, + EINVAL = libc::EINVAL as isize, + ENFILE = libc::ENFILE as isize, + EMFILE = libc::EMFILE as isize, + ENOTTY = libc::ENOTTY as isize, + ETXTBSY = libc::ETXTBSY as isize, + EFBIG = libc::EFBIG as isize, + ENOSPC = libc::ENOSPC as isize, + ESPIPE = libc::ESPIPE as isize, + EROFS = libc::EROFS as isize, + EMLINK = libc::EMLINK as isize, + EPIPE = libc::EPIPE as isize, + EDOM = libc::EDOM as isize, + ERANGE = libc::ERANGE as isize, + EDEADLK = libc::EDEADLK as isize, + ENAMETOOLONG = libc::ENAMETOOLONG as isize, + ENOLCK = libc::ENOLCK as isize, + ENOSYS = libc::ENOSYS as isize, + ENOTEMPTY = libc::ENOTEMPTY as isize, + ELOOP = libc::ELOOP as isize, + ENOMSG = libc::ENOMSG as isize, + EIDRM = libc::EIDRM as isize, + ECHRNG = libc::ECHRNG as isize, + EL2NSYNC = libc::EL2NSYNC as isize, + EL3HLT = libc::EL3HLT as isize, + EL3RST = libc::EL3RST as isize, + ELNRNG = libc::ELNRNG as isize, + EUNATCH = libc::EUNATCH as isize, + ENOCSI = libc::ENOCSI as isize, + EL2HLT = libc::EL2HLT as isize, + EBADE = libc::EBADE as isize, + EBADR = libc::EBADR as isize, + EXFULL = libc::EXFULL as isize, + ENOANO = libc::ENOANO as isize, + EBADRQC = libc::EBADRQC as isize, + EBADSLT = libc::EBADSLT as isize, + EBFONT = libc::EBFONT as isize, + ENOSTR = libc::ENOSTR as isize, + ENODATA = libc::ENODATA as isize, + ETIME = libc::ETIME as isize, + ENOSR = libc::ENOSR as isize, + ENONET = libc::ENONET as isize, + ENOPKG = libc::ENOPKG as isize, + EREMOTE = libc::EREMOTE as isize, + ENOLINK = libc::ENOLINK as isize, + EADV = libc::EADV as isize, + ESRMNT = libc::ESRMNT as isize, + ECOMM = libc::ECOMM as isize, + EPROTO = libc::EPROTO as isize, + EMULTIHOP = libc::EMULTIHOP as isize, + EDOTDOT = libc::EDOTDOT as isize, + EBADMSG = libc::EBADMSG as isize, + EOVERFLOW = libc::EOVERFLOW as isize, + ENOTUNIQ = libc::ENOTUNIQ as isize, + EBADFD = libc::EBADFD as isize, + EREMCHG = libc::EREMCHG as isize, + ELIBACC = libc::ELIBACC as isize, + ELIBBAD = libc::ELIBBAD as isize, + ELIBSCN = libc::ELIBSCN as isize, + ELIBMAX = libc::ELIBMAX as isize, + ELIBEXEC = libc::ELIBEXEC as isize, + EILSEQ = libc::EILSEQ as isize, + ERESTART = libc::ERESTART as isize, + ESTRPIPE = libc::ESTRPIPE as isize, + EUSERS = libc::EUSERS as isize, + ENOTSOCK = libc::ENOTSOCK as isize, + EDESTADDRREQ = libc::EDESTADDRREQ as isize, + EMSGSIZE = libc::EMSGSIZE as isize, + EPROTOTYPE = libc::EPROTOTYPE as isize, + ENOPROTOOPT = libc::ENOPROTOOPT as isize, + EPROTONOSUPPORT = libc::EPROTONOSUPPORT as isize, + ESOCKTNOSUPPORT = libc::ESOCKTNOSUPPORT as isize, + EOPNOTSUPP = libc::EOPNOTSUPP as isize, + EPFNOSUPPORT = libc::EPFNOSUPPORT as isize, + EAFNOSUPPORT = libc::EAFNOSUPPORT as isize, + EADDRINUSE = libc::EADDRINUSE as isize, + EADDRNOTAVAIL = libc::EADDRNOTAVAIL as isize, + ENETDOWN = libc::ENETDOWN as isize, + ENETUNREACH = libc::ENETUNREACH as isize, + ENETRESET = libc::ENETRESET as isize, + ECONNABORTED = libc::ECONNABORTED as isize, + ECONNRESET = libc::ECONNRESET as isize, + ENOBUFS = libc::ENOBUFS as isize, + EISCONN = libc::EISCONN as isize, + ENOTCONN = libc::ENOTCONN as isize, + ESHUTDOWN = libc::ESHUTDOWN as isize, + ETOOMANYREFS = libc::ETOOMANYREFS as isize, + ETIMEDOUT = libc::ETIMEDOUT as isize, + ECONNREFUSED = libc::ECONNREFUSED as isize, + EHOSTDOWN = libc::EHOSTDOWN as isize, + EHOSTUNREACH = libc::EHOSTUNREACH as isize, + EALREADY = libc::EALREADY as isize, + EINPROGRESS = libc::EINPROGRESS as isize, + ESTALE = libc::ESTALE as isize, + EUCLEAN = libc::EUCLEAN as isize, + ENOTNAM = libc::ENOTNAM as isize, + ENAVAIL = libc::ENAVAIL as isize, + EISNAM = libc::EISNAM as isize, + EREMOTEIO = libc::EREMOTEIO as isize, + EDQUOT = libc::EDQUOT as isize, + ENOMEDIUM = libc::ENOMEDIUM as isize, + EMEDIUMTYPE = libc::EMEDIUMTYPE as isize, + ECANCELED = libc::ECANCELED as isize, + ENOKEY = libc::ENOKEY as isize, + EKEYEXPIRED = libc::EKEYEXPIRED as isize, + EKEYREVOKED = libc::EKEYREVOKED as isize, + EKEYREJECTED = libc::EKEYREJECTED as isize, + EOWNERDEAD = libc::EOWNERDEAD as isize, + ENOTRECOVERABLE = libc::ENOTRECOVERABLE as isize, + + #[cfg(not(any(target_os = "android", target_arch="mips")))] + ERFKILL = libc::ERFKILL as isize, + #[cfg(not(any(target_os = "android", target_arch="mips")))] + EHWPOISON = libc::EHWPOISON as isize, } pub const EWOULDBLOCK: Errno = Errno::EAGAIN; @@ -669,140 +671,140 @@ mod consts { match e { 0 => UnknownErrno, - 1 => EPERM, - 2 => ENOENT, - 3 => ESRCH, - 4 => EINTR, - 5 => EIO, - 6 => ENXIO, - 7 => E2BIG, - 8 => ENOEXEC, - 9 => EBADF, - 10 => ECHILD, - 11 => EAGAIN, - 12 => ENOMEM, - 13 => EACCES, - 14 => EFAULT, - 15 => ENOTBLK, - 16 => EBUSY, - 17 => EEXIST, - 18 => EXDEV, - 19 => ENODEV, - 20 => ENOTDIR, - 21 => EISDIR, - 22 => EINVAL, - 23 => ENFILE, - 24 => EMFILE, - 25 => ENOTTY, - 26 => ETXTBSY, - 27 => EFBIG, - 28 => ENOSPC, - 29 => ESPIPE, - 30 => EROFS, - 31 => EMLINK, - 32 => EPIPE, - 33 => EDOM, - 34 => ERANGE, - 35 => EDEADLK, - 36 => ENAMETOOLONG, - 37 => ENOLCK, - 38 => ENOSYS, - 39 => ENOTEMPTY, - 40 => ELOOP, - 42 => ENOMSG, - 43 => EIDRM, - 44 => ECHRNG, - 45 => EL2NSYNC, - 46 => EL3HLT, - 47 => EL3RST, - 48 => ELNRNG, - 49 => EUNATCH, - 50 => ENOCSI, - 51 => EL2HLT, - 52 => EBADE, - 53 => EBADR, - 54 => EXFULL, - 55 => ENOANO, - 56 => EBADRQC, - 57 => EBADSLT, - 59 => EBFONT, - 60 => ENOSTR, - 61 => ENODATA, - 62 => ETIME, - 63 => ENOSR, - 64 => ENONET, - 65 => ENOPKG, - 66 => EREMOTE, - 67 => ENOLINK, - 68 => EADV, - 69 => ESRMNT, - 70 => ECOMM, - 71 => EPROTO, - 72 => EMULTIHOP, - 73 => EDOTDOT, - 74 => EBADMSG, - 75 => EOVERFLOW, - 76 => ENOTUNIQ, - 77 => EBADFD, - 78 => EREMCHG, - 79 => ELIBACC, - 80 => ELIBBAD, - 81 => ELIBSCN, - 82 => ELIBMAX, - 83 => ELIBEXEC, - 84 => EILSEQ, - 85 => ERESTART, - 86 => ESTRPIPE, - 87 => EUSERS, - 88 => ENOTSOCK, - 89 => EDESTADDRREQ, - 90 => EMSGSIZE, - 91 => EPROTOTYPE, - 92 => ENOPROTOOPT, - 93 => EPROTONOSUPPORT, - 94 => ESOCKTNOSUPPORT, - 95 => EOPNOTSUPP, - 96 => EPFNOSUPPORT, - 97 => EAFNOSUPPORT, - 98 => EADDRINUSE, - 99 => EADDRNOTAVAIL, - 100 => ENETDOWN, - 101 => ENETUNREACH, - 102 => ENETRESET, - 103 => ECONNABORTED, - 104 => ECONNRESET, - 105 => ENOBUFS, - 106 => EISCONN, - 107 => ENOTCONN, - 108 => ESHUTDOWN, - 109 => ETOOMANYREFS, - 110 => ETIMEDOUT, - 111 => ECONNREFUSED, - 112 => EHOSTDOWN, - 113 => EHOSTUNREACH, - 114 => EALREADY, - 115 => EINPROGRESS, - 116 => ESTALE, - 117 => EUCLEAN, - 118 => ENOTNAM, - 119 => ENAVAIL, - 120 => EISNAM, - 121 => EREMOTEIO, - 122 => EDQUOT, - 123 => ENOMEDIUM, - 124 => EMEDIUMTYPE, - 125 => ECANCELED, - 126 => ENOKEY, - 127 => EKEYEXPIRED, - 128 => EKEYREVOKED, - 129 => EKEYREJECTED, - 130 => EOWNERDEAD, - 131 => ENOTRECOVERABLE, - - #[cfg(not(target_os = "android"))] - 132 => ERFKILL, - #[cfg(not(target_os = "android"))] - 133 => EHWPOISON, + libc::EPERM => EPERM, + libc::ENOENT => ENOENT, + libc::ESRCH => ESRCH, + libc::EINTR => EINTR, + libc::EIO => EIO, + libc::ENXIO => ENXIO, + libc::E2BIG => E2BIG, + libc::ENOEXEC => ENOEXEC, + libc::EBADF => EBADF, + libc::ECHILD => ECHILD, + libc::EAGAIN => EAGAIN, + libc::ENOMEM => ENOMEM, + libc::EACCES => EACCES, + libc::EFAULT => EFAULT, + libc::ENOTBLK => ENOTBLK, + libc::EBUSY => EBUSY, + libc::EEXIST => EEXIST, + libc::EXDEV => EXDEV, + libc::ENODEV => ENODEV, + libc::ENOTDIR => ENOTDIR, + libc::EISDIR => EISDIR, + libc::EINVAL => EINVAL, + libc::ENFILE => ENFILE, + libc::EMFILE => EMFILE, + libc::ENOTTY => ENOTTY, + libc::ETXTBSY => ETXTBSY, + libc::EFBIG => EFBIG, + libc::ENOSPC => ENOSPC, + libc::ESPIPE => ESPIPE, + libc::EROFS => EROFS, + libc::EMLINK => EMLINK, + libc::EPIPE => EPIPE, + libc::EDOM => EDOM, + libc::ERANGE => ERANGE, + libc::EDEADLK => EDEADLK, + libc::ENAMETOOLONG => ENAMETOOLONG, + libc::ENOLCK => ENOLCK, + libc::ENOSYS => ENOSYS, + libc::ENOTEMPTY => ENOTEMPTY, + libc::ELOOP => ELOOP, + libc::ENOMSG => ENOMSG, + libc::EIDRM => EIDRM, + libc::ECHRNG => ECHRNG, + libc::EL2NSYNC => EL2NSYNC, + libc::EL3HLT => EL3HLT, + libc::EL3RST => EL3RST, + libc::ELNRNG => ELNRNG, + libc::EUNATCH => EUNATCH, + libc::ENOCSI => ENOCSI, + libc::EL2HLT => EL2HLT, + libc::EBADE => EBADE, + libc::EBADR => EBADR, + libc::EXFULL => EXFULL, + libc::ENOANO => ENOANO, + libc::EBADRQC => EBADRQC, + libc::EBADSLT => EBADSLT, + libc::EBFONT => EBFONT, + libc::ENOSTR => ENOSTR, + libc::ENODATA => ENODATA, + libc::ETIME => ETIME, + libc::ENOSR => ENOSR, + libc::ENONET => ENONET, + libc::ENOPKG => ENOPKG, + libc::EREMOTE => EREMOTE, + libc::ENOLINK => ENOLINK, + libc::EADV => EADV, + libc::ESRMNT => ESRMNT, + libc::ECOMM => ECOMM, + libc::EPROTO => EPROTO, + libc::EMULTIHOP => EMULTIHOP, + libc::EDOTDOT => EDOTDOT, + libc::EBADMSG => EBADMSG, + libc::EOVERFLOW => EOVERFLOW, + libc::ENOTUNIQ => ENOTUNIQ, + libc::EBADFD => EBADFD, + libc::EREMCHG => EREMCHG, + libc::ELIBACC => ELIBACC, + libc::ELIBBAD => ELIBBAD, + libc::ELIBSCN => ELIBSCN, + libc::ELIBMAX => ELIBMAX, + libc::ELIBEXEC => ELIBEXEC, + libc::EILSEQ => EILSEQ, + libc::ERESTART => ERESTART, + libc::ESTRPIPE => ESTRPIPE, + libc::EUSERS => EUSERS, + libc::ENOTSOCK => ENOTSOCK, + libc::EDESTADDRREQ => EDESTADDRREQ, + libc::EMSGSIZE => EMSGSIZE, + libc::EPROTOTYPE => EPROTOTYPE, + libc::ENOPROTOOPT => ENOPROTOOPT, + libc::EPROTONOSUPPORT => EPROTONOSUPPORT, + libc::ESOCKTNOSUPPORT => ESOCKTNOSUPPORT, + libc::EOPNOTSUPP => EOPNOTSUPP, + libc::EPFNOSUPPORT => EPFNOSUPPORT, + libc::EAFNOSUPPORT => EAFNOSUPPORT, + libc::EADDRINUSE => EADDRINUSE, + libc::EADDRNOTAVAIL => EADDRNOTAVAIL, + libc::ENETDOWN => ENETDOWN, + libc::ENETUNREACH => ENETUNREACH, + libc::ENETRESET => ENETRESET, + libc::ECONNABORTED => ECONNABORTED, + libc::ECONNRESET => ECONNRESET, + libc::ENOBUFS => ENOBUFS, + libc::EISCONN => EISCONN, + libc::ENOTCONN => ENOTCONN, + libc::ESHUTDOWN => ESHUTDOWN, + libc::ETOOMANYREFS => ETOOMANYREFS, + libc::ETIMEDOUT => ETIMEDOUT, + libc::ECONNREFUSED => ECONNREFUSED, + libc::EHOSTDOWN => EHOSTDOWN, + libc::EHOSTUNREACH => EHOSTUNREACH, + libc::EALREADY => EALREADY, + libc::EINPROGRESS => EINPROGRESS, + libc::ESTALE => ESTALE, + libc::EUCLEAN => EUCLEAN, + libc::ENOTNAM => ENOTNAM, + libc::ENAVAIL => ENAVAIL, + libc::EISNAM => EISNAM, + libc::EREMOTEIO => EREMOTEIO, + libc::EDQUOT => EDQUOT, + libc::ENOMEDIUM => ENOMEDIUM, + libc::EMEDIUMTYPE => EMEDIUMTYPE, + libc::ECANCELED => ECANCELED, + libc::ENOKEY => ENOKEY, + libc::EKEYEXPIRED => EKEYEXPIRED, + libc::EKEYREVOKED => EKEYREVOKED, + libc::EKEYREJECTED => EKEYREJECTED, + libc::EOWNERDEAD => EOWNERDEAD, + libc::ENOTRECOVERABLE => ENOTRECOVERABLE, + + #[cfg(not(any(target_os = "android", target_arch="mips")))] + libc::ERFKILL => ERFKILL, + #[cfg(not(any(target_os = "android", target_arch="mips")))] + libc::EHWPOISON => EHWPOISON, _ => UnknownErrno, } } @@ -2057,13 +2059,15 @@ mod test { ENOTRECOVERABLE); } - #[test] - #[cfg(target_os = "linux")] - pub fn test_linux_not_android_errnos() { - check_errno!( - ERFKILL /*, - EHWPOISON */); - } + // This test fails because MIPS does not have + // ERFKILL or EHWPOISON. + // #[test] + // #[cfg(target_os = "linux")] + // pub fn test_linux_not_android_errnos() { + // check_errno!( + // ERFKILL /*, + // EHWPOISON */); + // } #[test] #[cfg(target_os = "freebsd")] diff --git a/src/sys/socket/consts.rs b/src/sys/socket/consts.rs index 9a1861fa3e..8e5440e147 100644 --- a/src/sys/socket/consts.rs +++ b/src/sys/socket/consts.rs @@ -11,14 +11,14 @@ mod os { pub const AF_NETLINK: c_int = 16; pub const AF_PACKET: c_int = 17; - pub const SOCK_STREAM: c_int = 1; - pub const SOCK_DGRAM: c_int = 2; - pub const SOCK_SEQPACKET: c_int = 5; - pub const SOCK_RAW: c_int = 3; + pub const SOCK_STREAM: c_int = libc::SOCK_STREAM; + pub const SOCK_DGRAM: c_int = libc::SOCK_DGRAM; + pub const SOCK_SEQPACKET: c_int = libc::SOCK_SEQPACKET; + pub const SOCK_RAW: c_int = libc::SOCK_RAW; pub const SOCK_RDM: c_int = 4; pub const SOL_IP: c_int = 0; - pub const SOL_SOCKET: c_int = 1; + pub const SOL_SOCKET: c_int = libc::SOL_SOCKET; pub const SOL_TCP: c_int = 6; pub const SOL_UDP: c_int = 17; pub const SOL_IPV6: c_int = 41; @@ -28,36 +28,36 @@ mod os { pub const IPPROTO_TCP: c_int = SOL_TCP; pub const IPPROTO_UDP: c_int = SOL_UDP; - pub const SO_ACCEPTCONN: c_int = 30; + pub const SO_ACCEPTCONN: c_int = libc::SO_ACCEPTCONN; pub const SO_BINDTODEVICE: c_int = 25; - pub const SO_BROADCAST: c_int = 6; + pub const SO_BROADCAST: c_int = libc::SO_BROADCAST; pub const SO_BSDCOMPAT: c_int = 14; pub const SO_DEBUG: c_int = 1; pub const SO_DOMAIN: c_int = 39; - pub const SO_ERROR: c_int = 4; - pub const SO_DONTROUTE: c_int = 5; - pub const SO_KEEPALIVE: c_int = 9; - pub const SO_LINGER: c_int = 13; + pub const SO_ERROR: c_int = libc::SO_ERROR; + pub const SO_DONTROUTE: c_int = libc::SO_DONTROUTE; + pub const SO_KEEPALIVE: c_int = libc::SO_KEEPALIVE; + pub const SO_LINGER: c_int = libc::SO_LINGER; pub const SO_MARK: c_int = 36; - pub const SO_OOBINLINE: c_int = 10; - pub const SO_PASSCRED: c_int = 16; + pub const SO_OOBINLINE: c_int = libc::SO_OOBINLINE; + pub const SO_PASSCRED: c_int = libc::SO_PASSCRED; pub const SO_PEEK_OFF: c_int = 42; - pub const SO_PEERCRED: c_int = 17; + pub const SO_PEERCRED: c_int = libc::SO_PEERCRED; pub const SO_PRIORITY: c_int = 12; pub const SO_PROTOCOL: c_int = 38; - pub const SO_RCVBUF: c_int = 8; + pub const SO_RCVBUF: c_int = libc::SO_RCVBUF; pub const SO_RCVBUFFORCE: c_int = 33; - pub const SO_RCVLOWAT: c_int = 18; - pub const SO_SNDLOWAT: c_int = 19; - pub const SO_RCVTIMEO: c_int = 20; - pub const SO_SNDTIMEO: c_int = 21; - pub const SO_REUSEADDR: c_int = 2; - pub const SO_REUSEPORT: c_int = 15; + pub const SO_RCVLOWAT: c_int = libc::SO_RCVLOWAT; + pub const SO_SNDLOWAT: c_int = libc::SO_SNDLOWAT; + pub const SO_RCVTIMEO: c_int = libc::SO_RCVTIMEO; + pub const SO_SNDTIMEO: c_int = libc::SO_SNDTIMEO; + pub const SO_REUSEADDR: c_int = libc::SO_REUSEADDR; + pub const SO_REUSEPORT: c_int = libc::SO_REUSEPORT; pub const SO_RXQ_OVFL: c_int = 40; - pub const SO_SNDBUF: c_int = 7; - pub const SO_SNDBUFFORCE: c_int = 32; + pub const SO_SNDBUF: c_int = libc::SO_SNDBUF; + pub const SO_SNDBUFFORCE: c_int = libc::SO_SNDBUFFORCE; pub const SO_TIMESTAMP: c_int = 29; - pub const SO_TYPE: c_int = 3; + pub const SO_TYPE: c_int = libc::SO_TYPE; pub const SO_BUSY_POLL: c_int = 46; #[cfg(target_os = "linux")] pub const SO_ORIGINAL_DST: c_int = 80; @@ -152,7 +152,7 @@ mod os { #[cfg(any(target_os = "macos", target_os = "ios"))] pub const SYSPROTO_CONTROL: c_int = 2; - pub const SO_ACCEPTCONN: c_int = 0x0002; + pub const SO_ACCEPTCONN: c_int = libc::SO_ACCEPTCONN; pub const SO_BROADCAST: c_int = 0x0020; pub const SO_DEBUG: c_int = 0x0001; #[cfg(not(target_os = "netbsd"))] From 0db6ed1a28b4fb4d408cd9b7c4dba0a79bccf1f7 Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Thu, 2 Mar 2017 18:45:51 +0000 Subject: [PATCH 15/28] Removed some socket constants from arch=arm --- src/sys/socket/consts.rs | 3 +++ src/sys/socket/sockopt.rs | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sys/socket/consts.rs b/src/sys/socket/consts.rs index 8e5440e147..ba3981c27b 100644 --- a/src/sys/socket/consts.rs +++ b/src/sys/socket/consts.rs @@ -40,8 +40,10 @@ mod os { pub const SO_LINGER: c_int = libc::SO_LINGER; pub const SO_MARK: c_int = 36; pub const SO_OOBINLINE: c_int = libc::SO_OOBINLINE; + #[cfg(not(target_arch="arm"))] pub const SO_PASSCRED: c_int = libc::SO_PASSCRED; pub const SO_PEEK_OFF: c_int = 42; + #[cfg(not(target_arch="arm"))] pub const SO_PEERCRED: c_int = libc::SO_PEERCRED; pub const SO_PRIORITY: c_int = 12; pub const SO_PROTOCOL: c_int = 38; @@ -55,6 +57,7 @@ mod os { pub const SO_REUSEPORT: c_int = libc::SO_REUSEPORT; pub const SO_RXQ_OVFL: c_int = 40; pub const SO_SNDBUF: c_int = libc::SO_SNDBUF; + #[cfg(not(target_arch="arm"))] pub const SO_SNDBUFFORCE: c_int = libc::SO_SNDBUFFORCE; pub const SO_TIMESTAMP: c_int = 29; pub const SO_TYPE: c_int = libc::SO_TYPE; diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index bf17347cf3..5d33341f76 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -152,7 +152,7 @@ sockopt_impl!(Both, Broadcast, consts::SOL_SOCKET, consts::SO_BROADCAST, bool); sockopt_impl!(Both, OobInline, consts::SOL_SOCKET, consts::SO_OOBINLINE, bool); sockopt_impl!(GetOnly, SocketError, consts::SOL_SOCKET, consts::SO_ERROR, i32); sockopt_impl!(Both, KeepAlive, consts::SOL_SOCKET, consts::SO_KEEPALIVE, bool); -#[cfg(target_os = "linux")] +#[cfg(all(target_os = "linux", not(target_arch="arm")))] sockopt_impl!(GetOnly, PeerCredentials, consts::SOL_SOCKET, consts::SO_PEERCRED, super::ucred); #[cfg(any(target_os = "macos", target_os = "ios"))] @@ -167,7 +167,7 @@ sockopt_impl!(Both, RcvBuf, consts::SOL_SOCKET, consts::SO_RCVBUF, usize); sockopt_impl!(Both, SndBuf, consts::SOL_SOCKET, consts::SO_SNDBUF, usize); #[cfg(target_os = "linux")] sockopt_impl!(SetOnly, RcvBufForce, consts::SOL_SOCKET, consts::SO_RCVBUFFORCE, usize); -#[cfg(target_os = "linux")] +#[cfg(all(target_os = "linux", not(target_arch="arm")))] sockopt_impl!(SetOnly, SndBufForce, consts::SOL_SOCKET, consts::SO_SNDBUFFORCE, usize); sockopt_impl!(GetOnly, SockType, consts::SOL_SOCKET, consts::SO_TYPE, super::SockType); #[cfg(any(target_os = "freebsd", From 57169b8a1e461553e5366e23c297e620eb3850f1 Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Thu, 2 Mar 2017 19:53:35 +0000 Subject: [PATCH 16/28] Fixed failing ioctl tests. --- test/sys/test_ioctl.rs | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/test/sys/test_ioctl.rs b/test/sys/test_ioctl.rs index 1d9fbcc834..b68622d148 100644 --- a/test/sys/test_ioctl.rs +++ b/test/sys/test_ioctl.rs @@ -10,21 +10,34 @@ ioctl!(read buf readbuf_test with 0, 0; u32); ioctl!(write buf writebuf_test with 0, 0; u32); ioctl!(readwrite buf readwritebuf_test with 0, 0; u32); -// See C code for source of values for op calculations: +// See C code for source of values for op calculations (does NOT work for mips/powerpc): // https://gist.github.com/posborne/83ea6880770a1aef332e +// +// TODO: Need a way to compute these constants at test time. Using precomputed +// values is fragile and needs to be maintained. #[cfg(any(target_os = "linux", target_os = "android"))] mod linux { #[test] fn test_op_none() { - assert_eq!(io!(b'q', 10), 0x0000710A); - assert_eq!(io!(b'a', 255), 0x000061FF); + if cfg!(any(target_arch = "mips", target_arch="powerpc")){ + assert_eq!(io!(b'q', 10), 0x2000710A); + assert_eq!(io!(b'a', 255), 0x200061FF); + } else { + assert_eq!(io!(b'q', 10), 0x0000710A); + assert_eq!(io!(b'a', 255), 0x000061FF); + } } #[test] fn test_op_write() { - assert_eq!(iow!(b'z', 10, 1), 0x40017A0A); - assert_eq!(iow!(b'z', 10, 512), 0x42007A0A); + if cfg!(any(target_arch = "mips", target_arch="powerpc")){ + assert_eq!(iow!(b'z', 10, 1), 0x80017A0A); + assert_eq!(iow!(b'z', 10, 512), 0x82007A0A); + } else { + assert_eq!(iow!(b'z', 10, 1), 0x40017A0A); + assert_eq!(iow!(b'z', 10, 512), 0x42007A0A); + } } #[cfg(target_pointer_width = "64")] @@ -35,8 +48,13 @@ mod linux { #[test] fn test_op_read() { - assert_eq!(ior!(b'z', 10, 1), 0x80017A0A); - assert_eq!(ior!(b'z', 10, 512), 0x82007A0A); + if cfg!(any(target_arch = "mips", target_arch="powerpc")){ + assert_eq!(ior!(b'z', 10, 1), 0x40017A0A); + assert_eq!(ior!(b'z', 10, 512), 0x42007A0A); + } else { + assert_eq!(ior!(b'z', 10, 1), 0x80017A0A); + assert_eq!(ior!(b'z', 10, 512), 0x82007A0A); + } } #[cfg(target_pointer_width = "64")] From 334e826c7cf319d386d98491fe2f2f26bb3ae209 Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Sun, 5 Mar 2017 19:26:57 +0000 Subject: [PATCH 17/28] Re-enabled errorno test for not_android. --- src/errno.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/errno.rs b/src/errno.rs index d8aaf7f3f8..a27abaa730 100644 --- a/src/errno.rs +++ b/src/errno.rs @@ -2059,15 +2059,13 @@ mod test { ENOTRECOVERABLE); } - // This test fails because MIPS does not have - // ERFKILL or EHWPOISON. - // #[test] - // #[cfg(target_os = "linux")] - // pub fn test_linux_not_android_errnos() { - // check_errno!( - // ERFKILL /*, - // EHWPOISON */); - // } + #[test] + #[cfg(all(target_os = "linux", not(target_arch = "mips")))] + pub fn test_linux_not_android_errnos() { + check_errno!( + ERFKILL /*, + EHWPOISON */); + } #[test] #[cfg(target_os = "freebsd")] From 90b22ff160b7b20fd815a783343a081dfad31948 Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Sat, 4 Mar 2017 23:27:34 +0000 Subject: [PATCH 18/28] Added missing syscalls for powerpc --- src/sys/syscall.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/sys/syscall.rs b/src/sys/syscall.rs index c2d9e51c12..692b4cef95 100644 --- a/src/sys/syscall.rs +++ b/src/sys/syscall.rs @@ -54,6 +54,16 @@ mod arch { pub static MEMFD_CREATE: Syscall = 354; } +#[cfg(target_arch = "powerpc")] +mod arch { + use libc::c_long; + + pub type Syscall = c_long; + + pub static SYSPIVOTROOT: Syscall = 203; + pub static MEMFD_CREATE: Syscall = 360; +} + extern { pub fn syscall(num: Syscall, ...) -> c_int; } From d623db97a26802bf5f5ed3ebdb87406f2f8ce9a1 Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Fri, 10 Mar 2017 15:46:58 +0000 Subject: [PATCH 19/28] Removed unused libc imports in termios. --- src/sys/termios.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sys/termios.rs b/src/sys/termios.rs index 6ff7774751..126d149c78 100644 --- a/src/sys/termios.rs +++ b/src/sys/termios.rs @@ -99,7 +99,7 @@ mod ffi { use libc; - use libc::{c_int, c_uint, c_ulong, c_uchar}; + use libc::c_int; pub type tcflag_t = libc::tcflag_t; pub type cc_t = libc::cc_t; From 09c00ed7d9d92db2a79baa3ed212e7e239edceb9 Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Fri, 10 Mar 2017 16:48:43 +0000 Subject: [PATCH 20/28] Removed tests on ARM for non-existant constants. --- src/sys/socket/consts.rs | 3 +++ src/sys/socket/sockopt.rs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sys/socket/consts.rs b/src/sys/socket/consts.rs index ba3981c27b..7c7e5848fb 100644 --- a/src/sys/socket/consts.rs +++ b/src/sys/socket/consts.rs @@ -434,12 +434,15 @@ mod test { TCP_CORK, // SO_BUSY_POLL, // SO_RXQ_OVFL, + #[cfg(not(target_arch="arm"))] SO_PASSCRED, SO_PRIORITY, // SO_PROTOCOL, SO_RCVBUFFORCE, // SO_PEEK_OFF, + #[cfg(not(target_arch="arm"))] SO_PEERCRED, + #[cfg(not(target_arch="arm"))] SO_SNDBUFFORCE, MSG_ERRQUEUE); } diff --git a/src/sys/socket/sockopt.rs b/src/sys/socket/sockopt.rs index 5d33341f76..61d85ec317 100644 --- a/src/sys/socket/sockopt.rs +++ b/src/sys/socket/sockopt.rs @@ -378,7 +378,7 @@ impl<'a> Set<'a, usize> for SetUsize { #[cfg(test)] mod test { - #[cfg(target_os = "linux")] + #[cfg(all(target_os = "linux", not(target_arch = "arm")))] #[test] fn can_get_peercred_on_unix_socket() { use super::super::*; From 56d20ca225570ab1e855f7b1d44aef1619019d66 Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Fri, 10 Mar 2017 16:56:32 +0000 Subject: [PATCH 21/28] Split socket consts. test across ARM arch. --- src/sys/socket/consts.rs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/sys/socket/consts.rs b/src/sys/socket/consts.rs index 7c7e5848fb..54213ef167 100644 --- a/src/sys/socket/consts.rs +++ b/src/sys/socket/consts.rs @@ -420,7 +420,7 @@ mod test { #[cfg(target_os = "linux")] #[test] - pub fn test_linux_consts() { + pub fn test_general_linux_consts() { // TODO Figure out how to test new constants check_const!( SOL_IP, @@ -434,16 +434,21 @@ mod test { TCP_CORK, // SO_BUSY_POLL, // SO_RXQ_OVFL, - #[cfg(not(target_arch="arm"))] - SO_PASSCRED, SO_PRIORITY, // SO_PROTOCOL, SO_RCVBUFFORCE, // SO_PEEK_OFF, - #[cfg(not(target_arch="arm"))] - SO_PEERCRED, - #[cfg(not(target_arch="arm"))] - SO_SNDBUFFORCE, MSG_ERRQUEUE); } + + #[cfg(all(target_os = "linux", not(target_arch="arm")))] + #[test] + pub fn test_linux_not_arm_consts() { + // TODO Figure out how to test new constants + check_const!( + SO_PASSCRED, + SO_PEERCRED, + SO_SNDBUFFORCE); + } + } From a83355423aedcaad46045470543a6588833632eb Mon Sep 17 00:00:00 2001 From: Zac Berkowitz Date: Fri, 7 Apr 2017 22:02:21 +0000 Subject: [PATCH 22/28] Updated changelog. --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 045756ddb3..c8b22f5956 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -112,6 +112,11 @@ This project adheres to [Semantic Versioning](http://semver.org/). ([#542](https://github.com/nix-rust/nix/pull/542) ### Fixed +- Fixed multiple issues compiling under different archetectures and OSes. + Now compiles on Linux/MIPS ([#538](https://github.com/nix-rust/nix/pull/538)), + `Linux/PPC` ([#553](https://github.com/nix-rust/nix/pull/553)), + `MacOS/x86_64,i686` ([#553](https://github.com/nix-rust/nix/pull/553), + and `NetBSD/x64_64` ([#538](https://github.com/nix-rust/nix/pull/538). - Fixed multiple issues with Unix domain sockets on non-Linux OSes ([#474](https://github.com/nix-rust/nix/pull/415)) - Fixed using kqueue with `EVFILT_USER` on FreeBSD From a8cf6cbb9de5c4a4f65687c424933220289e5333 Mon Sep 17 00:00:00 2001 From: Paul Osborne Date: Sun, 26 Feb 2017 20:13:31 -0600 Subject: [PATCH 23/28] ci: remove thread parallelism Fixes https://github.com/nix-rust/nix/issues/529, also refer to https://github.com/nix-rust/nix/issues/529 which first added this for the old CI infrastructure. Signed-off-by: Paul Osborne --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 53bc090e02..6edc4cc903 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ rust: stable env: global: - CRATE_NAME=nix + - CARGO_TEST_THREADS=1 # default job - TARGET=x86_64-unknown-linux-gnu From 86f6aa3704bb89ca97cde6001463c293ed28f4a8 Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Sat, 15 Apr 2017 10:32:42 -0700 Subject: [PATCH 24/28] Use min Rust version but test beta and nightly --- .travis.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6edc4cc903..47cafe6854 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ sudo: required # This is the Rust channel that build jobs will use by default but can be # overridden on a case by case basis down below -rust: stable +rust: 1.13.0 env: global: @@ -53,7 +53,25 @@ matrix: - env: TARGET=arm-unknown-linux-gnueabi # - env: TARGET=arm-unknown-linux-musleabi - # Testing other channels + # Testing beta on main targets + - env: TARGET=x86_64-unknown-linux-gnu + rust: beta + - env: TARGET=x86_64-apple-darwin + os: osx + rust: beta + + # Testing nightly on main targets (allowed to fail) + - env: TARGET=x86_64-unknown-linux-gnu + rust: nightly + - env: TARGET=x86_64-apple-darwin + os: osx + rust: nightly + + # Testing nightlies on main targets. These might fail because of issues + # with the compiler, so we allow failures here. + allow_failures: + # Failures for nightlies may be because of compiler bugs, so don't fail the + # build if these fail. - env: TARGET=x86_64-unknown-linux-gnu rust: nightly - env: TARGET=x86_64-apple-darwin From 6cfbb09d6feb1f3e8466aef1eb8e59750889486d Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Sat, 15 Apr 2017 10:32:54 -0700 Subject: [PATCH 25/28] Allow failures for currently failing targets --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 47cafe6854..8f25050184 100644 --- a/.travis.yml +++ b/.travis.yml @@ -77,6 +77,12 @@ matrix: - env: TARGET=x86_64-apple-darwin os: osx rust: nightly + # FIXME: targets that should pass but are currently failing + - env: TARGET=i686-unknown-linux-musl + - env: TARGET=x86_64-unknown-linux-musl + - env: TARGET=mips-unknown-linux-gnu + - env: TARGET=mipsel-unknown-linux-gnu + - env: TARGET=powerpc-unknown-linux-gnu install: - sh ci/install.sh From a076c7f5a43b3c899e537e6e82c8bcae7d31e8ee Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Wed, 12 Apr 2017 20:12:11 -0700 Subject: [PATCH 26/28] Increase minimum supported Rust version. We need to raise it up to 1.13 because our test infrastructure requires it --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 577a0fb2cc..ab6f80fdba 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ pub fn gethostname(name: &mut [u8]) -> Result<()>; ``` ## Requirements -Rust >= 1.9.0 +Rust >= 1.13.0 ## Usage From 48d142feb4ccfea30a5154d1ef9f0b4e0bba99bf Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Sat, 15 Apr 2017 12:11:18 -0700 Subject: [PATCH 27/28] Update changelog Some entries were erroneously listed under the 0.8.0 release. --- CHANGELOG.md | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8b22f5956..eac3072a9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,15 +5,24 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] - +### Added - Added `nix::unistd::{openat, fstatat, readlink, readlinkat}` - ([#497](https://github.com/nix-rust/nix/pull/551)) + ([#551](https://github.com/nix-rust/nix/pull/551)) ### Changed - Marked `sys::mman::{ mmap, munmap, madvise, munlock, msync }` as unsafe. ([#559](https://github.com/nix-rust/nix/pull/559)) - - +- Minimum supported Rust version is now 1.13 +- Removed `revents` argument from `PollFd::new()` as it's an output argument and + will be overwritten regardless of value. + ([#542](https://github.com/nix-rust/nix/pull/542) + +### Fixed +- Fixed multiple issues compiling under different archetectures and OSes. + Now compiles on Linux/MIPS ([#538](https://github.com/nix-rust/nix/pull/538)), + `Linux/PPC` ([#553](https://github.com/nix-rust/nix/pull/553)), + `MacOS/x86_64,i686` ([#553](https://github.com/nix-rust/nix/pull/553), + and `NetBSD/x64_64` ([#538](https://github.com/nix-rust/nix/pull/538). ## [0.8.0] 2017-03-02 @@ -60,8 +69,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). ([#540](https://github.com/nix-rust/nix/pull/540) ### Changed -- `::nix::sys::termios::{cfgetispeed, cfsetispeed, cfgetospeed, cfsetospeed}` - switched to use `BaudRate` enum from `speed_t`. +- `::nix::sys::termios::{cfgetispeed, cfsetispeed, cfgetospeed, cfsetospeed}` + switched to use `BaudRate` enum from `speed_t`. ([#518](https://github.com/nix-rust/nix/pull/518)) - `epoll_ctl` now could accept None as argument `event` when op is `EpollOp::EpollCtlDel`. @@ -107,16 +116,8 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Exposed all fcntl(2) operations at the module level, so they can be imported direclty instead of via `FcntlArg` enum. ([#541](https://github.com/nix-rust/nix/pull/541)) -- Removed `revents` argument from `PollFd::new()` as it's an output argument and - will be overwritten regardless of value. - ([#542](https://github.com/nix-rust/nix/pull/542) ### Fixed -- Fixed multiple issues compiling under different archetectures and OSes. - Now compiles on Linux/MIPS ([#538](https://github.com/nix-rust/nix/pull/538)), - `Linux/PPC` ([#553](https://github.com/nix-rust/nix/pull/553)), - `MacOS/x86_64,i686` ([#553](https://github.com/nix-rust/nix/pull/553), - and `NetBSD/x64_64` ([#538](https://github.com/nix-rust/nix/pull/538). - Fixed multiple issues with Unix domain sockets on non-Linux OSes ([#474](https://github.com/nix-rust/nix/pull/415)) - Fixed using kqueue with `EVFILT_USER` on FreeBSD From 56f5a0a0068c6a7ba69d5b91bf05f664b6dfc1a4 Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Sat, 15 Apr 2017 12:12:33 -0700 Subject: [PATCH 28/28] List supported targets in the README --- README.md | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ab6f80fdba..88e963942b 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,37 @@ pub unsafe extern fn gethostname(name: *mut c_char, len: size_t) -> c_int; pub fn gethostname(name: &mut [u8]) -> Result<()>; ``` -## Requirements -Rust >= 1.13.0 +## Supported Platforms + +nix target support consists of three tiers: + + * Tier 1 - Target is supported and CI both builds and tests + * Tier 2 - Target is supported and CI builds the target + * Tier 3 - Target is supported and CI both builds and tests but test failures + do not block merging code + +The following targets are all supported by nix on Rust 1.13.0 or newer: + +Tier 1: + * i686-unknown-linux-gnu + * x86_64-unknown-linux-gnu + * i686-apple-darwin + * x86_64-apple-darwin + * aarch64-unknown-linux-gnu + * armv7-unknown-linux-gnueabihf + * arm-unknown-linux-gnueabi + +Tier 2: + * i686-unknown-freebsd + * x86_64-unknown-freebsd + * x86_64-unknown-netbsd + +Tier 3: + * i686-unknown-linux-musl + * x86_64-unknown-linux-musl + * mips-unknown-linux-gnu + * mipsel-unknown-linux-gnu + * powerpc-unknown-linux-gnu ## Usage