diff options
author | Chih-Hung Hsieh <chh@google.com> | 2019-10-29 11:19:31 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-10-29 11:19:31 -0700 |
commit | 2a7baf1f8893b06fcb939d5b3190da52752baad9 (patch) | |
tree | 77e9d53fcf8e5d301508155bd53b89d599382c51 | |
parent | d76aed15ddc5925b1e34edcd56b46f87872f5067 (diff) | |
parent | 7e7670338af25529290b3923724c42be9577d954 (diff) | |
download | libc-2a7baf1f8893b06fcb939d5b3190da52752baad9.tar.gz |
Use released libc-0.2.58 at crates.io am: e5870cff16 am: 1f0aac3f26 am: 91e2cf9d93
am: 7e7670338a
Change-Id: I4285cb06dd4a66b8c6e154c8abcf1ea222386a22
128 files changed, 2932 insertions, 8271 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json new file mode 100644 index 00000000..71b1c6af --- /dev/null +++ b/.cargo_vcs_info.json @@ -0,0 +1,5 @@ +{ + "git": { + "sha1": "0e2549387716c156b44a51882e349ad6ca9611c9" + } +} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ea5e0ac5..00000000 --- a/.travis.yml +++ /dev/null @@ -1,254 +0,0 @@ -language: rust -rust: nightly -sudo: required -dist: xenial -services: docker - -stages: - - tools-and-build-and-tier1 - - tier2 - -matrix: - include: - # 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 - # FIXME: https://github.com/koalaman/shellcheck/issues/1591 - - shellcheck -e SC2103 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 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 - 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 - - name: "Build Beta Rust" - script: sh ci/build.sh - stage: tools-and-build-and-tier1 - rust: beta - os: osx - osx_image: xcode10 - install: true - - name: "Build Nightly Rust" - script: sh ci/build.sh - stage: tools-and-build-and-tier1 - rust: nightly - os: osx - osx_image: xcode10 - install: true - - 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 - 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 - stage: tier2 - - env: TARGET=aarch64-unknown-linux-gnu - stage: tier2 - - env: TARGET=aarch64-unknown-linux-musl - 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-linux-android - stage: tier2 - - env: TARGET=i686-unknown-linux-musl - stage: tier2 - - env: TARGET=mips-unknown-linux-gnu - stage: tier2 - - env: TARGET=mips-unknown-linux-musl - stage: tier2 - - env: TARGET=mips64-unknown-linux-gnuabi64 - stage: tier2 - - env: TARGET=mips64el-unknown-linux-gnuabi64 - 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 - stage: tier2 - - env: TARGET=wasm32-unknown-emscripten - 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 - 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: - - 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: - - name: "Semver Linux" - - name: "Semver MacOSX" - -install: travis_retry rustup target add $TARGET - -script: - - cargo generate-lockfile --manifest-path libc-test/Cargo.toml - - if [[ $TRAVIS_OS_NAME = "linux" ]] && [[ $BUILD_ONLY != "1" ]]; then - sh ci/run-docker.sh $TARGET; - else - sh ci/run.sh $TARGET; - fi -env: - global: - secure: "e2/3QjgRN9atOuSHp22TrYG7QVKcYUWY48Hi9b60w+r1+BhPkTseIJLte7WefRhdXtqpjjUJTooKDhnurFOeHaCT+nmBgiv+FPU893sBl4bhesY4m0vgUJVbNZcs6lTImYekWVb+aqjGdgV/XAgCw7c3kPmrZV0MzGDWL64Xaps=" - -notifications: - email: - on_success: never @@ -1,20 +1,22 @@ +// This file is generated by cargo2android.py. + rust_library_rlib { name: "libc_rust", - crate_name: "libc", - edition: "2015", stem: "liblibc", - srcs: ["src/lib.rs"], host_supported: true, - + crate_name: "libc", + srcs: ["src/lib.rs"], + edition: "2015", features: [ - "std", "default", + "std", ], flags: [ - "--cfg libc_priv_mod_use", - "--cfg libc_union", - "--cfg libc_const_size_of", "--cfg libc_align", + "--cfg libc_const_size_of", "--cfg libc_core_cvoid", + "--cfg libc_packedN", + "--cfg libc_priv_mod_use", + "--cfg libc_union", ], } @@ -1,35 +1,43 @@ +# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO +# +# When uploading crates to the registry Cargo will automatically +# "normalize" Cargo.toml files for maximal compatibility +# with all versions of Cargo and also rewrite `path` dependencies +# to registry (e.g., crates.io) dependencies +# +# If you believe there's an error in this file please file an +# issue against the rust-lang/cargo repository. If you're +# editing this file be aware that the upstream Cargo.toml +# will likely look very different (and much more reasonable) + [package] name = "libc" version = "0.2.58" authors = ["The Rust Project Developers"] -license = "MIT OR Apache-2.0" -readme = "README.md" -repository = "https://github.com/rust-lang/libc" +build = "build.rs" +exclude = ["/ci/*", "/.travis.yml", "/appveyor.yml"] +description = "Raw FFI bindings to platform libraries like libc.\n" homepage = "https://github.com/rust-lang/libc" documentation = "http://doc.rust-lang.org/libc" -keywords = ["libc", "ffi", "bindings", "operating", "system" ] +readme = "README.md" +keywords = ["libc", "ffi", "bindings", "operating", "system"] categories = ["external-ffi-bindings", "no-std", "os"] -build = "build.rs" -exclude = ["/ci/*", "/.travis.yml", "/appveyor.yml"] -description = """ -Raw FFI bindings to platform libraries like libc. -""" - -[badges] -travis-ci = { repository = "rust-lang/libc" } -appveyor = { repository = "rust-lang/libc", project_name = "rust-lang-libs/libc" } - -[dependencies] -rustc-std-workspace-core = { version = "1.0.0", optional = true } +license = "MIT OR Apache-2.0" +repository = "https://github.com/rust-lang/libc" +[dependencies.rustc-std-workspace-core] +version = "1.0.0" +optional = true [features] -default = ["std"] -std = [] align = [] -rustc-dep-of-std = ['align', 'rustc-std-workspace-core'] +default = ["std"] extra_traits = [] -# use_std is deprecated, use `std` instead -use_std = [ 'std' ] +rustc-dep-of-std = ["align", "rustc-std-workspace-core"] +std = [] +use_std = ["std"] +[badges.appveyor] +project_name = "rust-lang-libs/libc" +repository = "rust-lang/libc" -[workspace] -members = ["libc-test"] +[badges.travis-ci] +repository = "rust-lang/libc" diff --git a/Cargo.toml.orig b/Cargo.toml.orig new file mode 100644 index 00000000..a881faef --- /dev/null +++ b/Cargo.toml.orig @@ -0,0 +1,35 @@ +[package] +name = "libc" +version = "0.2.58" +authors = ["The Rust Project Developers"] +license = "MIT OR Apache-2.0" +readme = "README.md" +repository = "https://github.com/rust-lang/libc" +homepage = "https://github.com/rust-lang/libc" +documentation = "http://doc.rust-lang.org/libc" +keywords = ["libc", "ffi", "bindings", "operating", "system" ] +categories = ["external-ffi-bindings", "no-std", "os"] +build = "build.rs" +exclude = ["/ci/*", "/.travis.yml", "/appveyor.yml"] +description = """ +Raw FFI bindings to platform libraries like libc. +""" + +[badges] +travis-ci = { repository = "rust-lang/libc" } +appveyor = { repository = "rust-lang/libc", project_name = "rust-lang-libs/libc" } + +[dependencies] +rustc-std-workspace-core = { version = "1.0.0", optional = true } + +[features] +default = ["std"] +std = [] +align = [] +rustc-dep-of-std = ['align', 'rustc-std-workspace-core'] +extra_traits = [] +# use_std is deprecated, use `std` instead +use_std = [ 'std' ] + +[workspace] +members = ["libc-test"] diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index b14230a0..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,28 +0,0 @@ -environment: - # When this was added there were revocation check failures when using the - # libcurl backend as libcurl checks by default, but rustup doesn't provide the - # switch to turn this off. Switch to Reqwest which looks to not check for - # revocation by default like libcurl does. - RUSTUP_USE_REQWEST: 1 - CARGO_HTTP_CHECK_REVOKE: false - matrix: - - TARGET: x86_64-pc-windows-gnu - MSYS2_BITS: 64 - - TARGET: i686-pc-windows-gnu - MSYS2_BITS: 32 - - TARGET: x86_64-pc-windows-msvc - - TARGET: i686-pc-windows-msvc -install: - - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - - rustup-init.exe -y --default-host %TARGET% - - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - - if defined MSYS2_BITS set PATH=%PATH%;C:\msys64\mingw%MSYS2_BITS%\bin - - rustc -V - - cargo -V - -build: false - -test_script: - - 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/ci/README.md b/ci/README.md deleted file mode 100644 index 28152e5d..00000000 --- a/ci/README.md +++ /dev/null @@ -1,243 +0,0 @@ -The goal of the libc crate is to have CI running everywhere to have the -strongest guarantees about the definitions that this library contains, and as a -result the CI is pretty complicated and also pretty large! Hopefully this can -serve as a guide through the sea of scripts in this directory and elsewhere in -this project. - -# Files - -First up, let's talk about the files in this directory: - -* `run-travis.sh` - a shell script run by all Travis builders, this is - responsible for setting up the rest of the environment such as installing new - packages, downloading Rust target libraries, etc. - -* `run.sh` - the actual script which runs tests for a particular architecture. - Called from the `run-travis.sh` script this will run all tests for the target - specified. - -* `cargo-config` - Cargo configuration of linkers to use copied into place by - the `run-travis.sh` script before builds are run. - -* `dox.sh` - script called from `run-travis.sh` on only the linux 64-bit nightly - Travis bots to build documentation for this crate. - -* `landing-page-*.html` - used by `dox.sh` to generate a landing page for all - architectures' documentation. - -* `run-qemu.sh` - see discussion about QEMU below - -* `mips`, `rumprun` - instructions to build the docker image for each respective - CI target - -# CI Systems - -Currently this repository leverages a combination of Travis CI and AppVeyor for -running tests. The triples tested are: - -* AppVeyor - * `{i686,x86_64}-pc-windows-{msvc,gnu}` -* Travis - * `{i686,x86_64,mips,aarch64}-unknown-linux-gnu` - * `{x86_64,aarch64}-unknown-linux-musl` - * `arm-unknown-linux-gnueabihf` - * `arm-linux-androideabi` - * `{i686,x86_64}-apple-{darwin,ios}` - * `x86_64-rumprun-netbsd` - * `x86_64-unknown-freebsd` - * `x86_64-unknown-openbsd` - -The Windows triples are all pretty standard, they just set up their environment -then run tests, no need for downloading any extra target libs (we just download -the right installer). The Intel Linux/OSX builds are similar in that we just -download the right target libs and run tests. Note that the Intel Linux/OSX -builds are run on stable/beta/nightly, but are the only ones that do so. - -The remaining architectures look like: - -* Android runs in a [docker image][android-docker] with an emulator, the NDK, - and the SDK already set up. The entire build happens within the docker image. -* The MIPS, ARM, and AArch64 builds all use the QEMU userspace emulator to run - the generated binary to actually verify the tests pass. -* The MUSL build just has to download a MUSL compiler and target libraries and - then otherwise runs tests normally. -* iOS builds need an extra linker flag currently, but beyond that they're built - as standard as everything else. -* The rumprun target builds an entire kernel from the test suite and then runs - it inside QEMU using the serial console to test whether it succeeded or - failed. -* The BSD builds, currently OpenBSD and FreeBSD, use QEMU to boot up a system - and compile/run tests. More information on that below. - -[android-docker]: https://github.com/rust-lang/rust-buildbot/blob/master/slaves/android/Dockerfile - -## QEMU - -Lots of the architectures tested here use QEMU in the tests, so it's worth going -over all the crazy capabilities QEMU has and the various flavors in which we use -it! - -First up, QEMU has userspace emulation where it doesn't boot a full kernel, it -just runs a binary from another architecture (using the `qemu-<arch>` wrappers). -We provide it the runtime path for the dynamically loaded system libraries, -however. This strategy is used for all Linux architectures that aren't intel. -Note that one downside of this QEMU system is that threads are barely -implemented, so we're careful to not spawn many threads. - -For the rumprun target the only output is a kernel image, so we just use that -plus the `rumpbake` command to create a full kernel image which is then run from -within QEMU. - -Finally, the fun part, the BSDs. Quite a few hoops are jumped through to get CI -working for these platforms, but the gist of it looks like: - -* Cross compiling from Linux to any of the BSDs seems to be quite non-standard. - We may be able to get it working but it might be difficult at that point to - ensure that the libc definitions align with what you'd get on the BSD itself. - As a result, we try to do compiles within the BSD distro. -* On Travis we can't run a VM-in-a-VM, so we resort to userspace emulation - (QEMU). -* Unfortunately on Travis we also can't use KVM, so the emulation is super slow. - -With all that in mind, the way BSD is tested looks like: - -1. Download a pre-prepared image for the OS being tested. -2. Generate the tests for the OS being tested. This involves running the `ctest` - library over libc to generate a Rust file and a C file which will then be - compiled into the final test. -3. Generate a disk image which will later be mounted by the OS being tested. - This image is mostly just the libc directory, but some modifications are made - to compile the generated files from step 2. -4. The kernel is booted in QEMU, and it is configured to detect the libc-test - image being available, run the test script, and then shut down afterwards. -5. Look for whether the tests passed in the serial console output of the kernel. - -There's some pretty specific instructions for setting up each image (detailed -below), but the main gist of this is that we must avoid a vanilla `cargo run` -inside of the `libc-test` directory (which is what it's intended for) because -that would compile `syntex_syntax`, a large library, with userspace emulation. -This invariably times out on Travis, so we can't do that. - -Once all those hoops are jumped through, however, we can be happy that we're -testing almost everything! - -Below are some details of how to set up the initial OS images which are -downloaded. Each image must be enabled have input/output over the serial -console, log in automatically at the serial console, detect if a second drive in -QEMU is available, and if so mount it, run a script (it'll specifically be -`run-qemu.sh` in this folder which is copied into the generated image talked -about above), and then shut down. - -### QEMU Setup - FreeBSD - -1. [Download the latest stable amd64-bootonly release ISO](https://www.freebsd.org/where.html). - E.g. FreeBSD-11.1-RELEASE-amd64-bootonly.iso -2. Create the disk image: `qemu-img create -f qcow2 FreeBSD-11.1-RELEASE-amd64.qcow2 2G` -3. Boot the machine: `qemu-system-x86_64 -cdrom FreeBSD-11.1-RELEASE-amd64-bootonly.iso -drive if=virtio,file=FreeBSD-11.1-RELEASE-amd64.qcow2 -net nic,model=virtio -net user` -4. Run the installer, and install FreeBSD: - 1. Install - 1. Continue with default keymap - 1. Set Hostname: freebsd-ci - 1. Distribution Select: - 1. Uncheck lib32 - 1. Uncheck ports - 1. Network Configuration: vtnet0 - 1. Configure IPv4? Yes - 1. DHCP? Yes - 1. Configure IPv6? No - 1. Resolver Configuration: Ok - 1. Mirror Selection: Main Site - 1. Partitioning: Auto (UFS) - 1. Partition: Entire Disk - 1. Partition Scheme: MBR - 1. App Partition: Ok - 1. Partition Editor: Finish - 1. Confirmation: Commit - 1. Wait for sets to install - 1. Set the root password to nothing (press enter twice) - 1. Set time zone to UTC - 1. Set Date: Skip - 1. Set Time: Skip - 1. System Configuration: - 1. Disable sshd - 1. Disable dumpdev - 1. System Hardening - 1. Disable Sendmail service - 1. Add User Accounts: No - 1. Final Configuration: Exit - 1. Manual Configuration: Yes - 1. `echo 'console="comconsole"' >> /boot/loader.conf` - 1. `echo 'autoboot_delay="0"' >> /boot/loader.conf` - 1. `echo 'ext2fs_load="YES"' >> /boot/loader.conf` - 1. Look at `/etc/ttys`, see what getty argument is for `ttyu0` (E.g. `3wire`) - 1. Edit `/etc/gettytab` (with `vi` for example), look for `ttyu0` argument, - prepend `:al=root` to the line beneath to have the machine auto-login as - root. E.g. - - 3wire:\ - :np:nc:sp#0: - becomes: - - 3wire:\ - :al=root:np:nc:sp#0: - - 1. Edit `/root/.login` and put this in it: - - [ -e /dev/vtbd1 ] || exit 0 - mount -t ext2fs /dev/vtbd1 /mnt - sh /mnt/run.sh /mnt - poweroff - - 1. Exit the post install shell: `exit` - 1. Back in in the installer choose Reboot - 1. If all went well the machine should reboot and show a login prompt. - If you switch to the serial console by choosing View > serial0 in - the qemu menu, you should be logged in as root. - 1. Shutdown the machine: `shutdown -p now` - -Helpful links - -* https://en.wikibooks.org/wiki/QEMU/Images -* https://blog.nekoconeko.nl/blog/2015/06/04/creating-an-openstack-freebsd-image.html -* https://www.freebsd.org/doc/handbook/serialconsole-setup.html - - -### QEMU setup - OpenBSD - -1. Download CD installer -2. `qemu-img create -f qcow2 foo.qcow2 2G` -3. `qemu -cdrom foo.iso -drive if=virtio,file=foo.qcow2 -net nic,model=virtio -net user` -4. run installer -5. `echo 'set tty com0' >> /etc/boot.conf` -6. `echo 'boot' >> /etc/boot.conf` -7. Modify /etc/ttys, change the `tty00` at the end from 'unknown off' to - 'vt220 on secure' -8. Modify same line in /etc/ttys to have `"/root/foo.sh"` as the shell -9. Add this script to `/root/foo.sh` - -``` -#!/bin/sh -exec 1>/dev/tty00 -exec 2>&1 - -if mount -t ext2fs /dev/sd1c /mnt; then - sh /mnt/run.sh /mnt - shutdown -ph now -fi - -# limited shell... -exec /bin/sh < /dev/tty00 -``` - -10. `chmod +x /root/foo.sh` - -Helpful links: - -* https://en.wikibooks.org/wiki/QEMU/Images -* http://www.openbsd.org/faq/faq7.html#SerCon - -# Questions? - -Hopefully that's at least somewhat of an introduction to everything going on -here, and feel free to ping @alexcrichton with questions! - diff --git a/ci/android-install-ndk.sh b/ci/android-install-ndk.sh deleted file mode 100644 index 723e7190..00000000 --- a/ci/android-install-ndk.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env sh -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -set -ex - -NDK=android-ndk-r19c -curl --retry 20 -O https://dl.google.com/android/repository/${NDK}-linux-x86_64.zip -unzip -q ${NDK}-linux-x86_64.zip - -case "$1" in - arm) - arch=arm - api=24 - ;; - armv7) - arch=arm - api=24 - ;; - aarch64) - arch=arm64 - api=24 - ;; - i686) - arch=x86 - api=28 - ;; - x86_64) - arch=x86_64 - api=28 - ;; - *) - echo "invalid arch: $1" - exit 1 - ;; -esac; - -${NDK}/build/tools/make_standalone_toolchain.py \ - --install-dir "/android/ndk-${1}" \ - --arch "${arch}" \ - --api ${api} - -rm -rf ./${NDK}-linux-x86_64.zip ./${NDK} diff --git a/ci/android-install-sdk.sh b/ci/android-install-sdk.sh deleted file mode 100644 index 7f210400..00000000 --- a/ci/android-install-sdk.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env sh -# Copyright 2016 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -set -ex - -# Prep the SDK and emulator -# -# Note that the update process requires that we accept a bunch of licenses, and -# we can't just pipe `yes` into it for some reason, so we take the same strategy -# located in https://github.com/appunite/docker by just wrapping it in a script -# which apparently magically accepts the licenses. - -SDK=4333796 -mkdir sdk -curl --retry 20 https://dl.google.com/android/repository/sdk-tools-linux-${SDK}.zip -O -unzip -q -d sdk sdk-tools-linux-${SDK}.zip - -case "$1" in - arm | armv7) - api=24 - image="system-images;android-${api};google_apis;armeabi-v7a" - ;; - aarch64) - api=24 - image="system-images;android-${api};google_apis;arm64-v8a" - ;; - i686) - api=28 - image="system-images;android-${api};default;x86" - ;; - x86_64) - api=28 - image="system-images;android-${api};default;x86_64" - ;; - *) - echo "invalid arch: $1" - exit 1 - ;; -esac; - -# Try to fix warning about missing file. -# See https://askubuntu.com/a/1078784 -mkdir -p /root/.android/ -echo '### User Sources for Android SDK Manager' >> /root/.android/repositories.cfg -echo '#Fri Nov 03 10:11:27 CET 2017 count=0' >> /root/.android/repositories.cfg - -# Print all available packages -# yes | ./sdk/tools/bin/sdkmanager --list --verbose - -# --no_https avoids -# javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found -# -# | grep -v = || true removes the progress bar output from the sdkmanager -# which produces an insane amount of output. -yes | ./sdk/tools/bin/sdkmanager --licenses --no_https | grep -v = || true -yes | ./sdk/tools/bin/sdkmanager --no_https \ - "emulator" \ - "platform-tools" \ - "platforms;android-${api}" \ - "${image}" | grep -v = || true - -echo "no" | - ./sdk/tools/bin/avdmanager create avd \ - --name "${1}" \ - --package "${image}" | grep -v = || true diff --git a/ci/android-sysimage.sh b/ci/android-sysimage.sh deleted file mode 100644 index 9eabd7c8..00000000 --- a/ci/android-sysimage.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -set -ex - -URL=https://dl.google.com/android/repository/sys-img/android - -main() { - local arch="${1}" - local name="${2}" - local dest=/system - local td - td="$(mktemp -d)" - - apt-get install --no-install-recommends e2tools - - pushd "${td}" - curl --retry 5 -O "${URL}/${name}" - unzip -q "${name}" - - local system - system="$(find . -name system.img)" - mkdir -p ${dest}/{bin,lib,lib64} - - # Extract android linker and libraries to /system - # This allows android executables to be run directly (or with qemu) - if [ "${arch}" = "x86_64" ] || [ "${arch}" = "arm64" ]; then - e2cp -p "${system}:/bin/linker64" "${dest}/bin/" - e2cp -p "${system}:/lib64/libdl.so" "${dest}/lib64/" - e2cp -p "${system}:/lib64/libc.so" "${dest}/lib64/" - e2cp -p "${system}:/lib64/libm.so" "${dest}/lib64/" - else - e2cp -p "${system}:/bin/linker" "${dest}/bin/" - e2cp -p "${system}:/lib/libdl.so" "${dest}/lib/" - e2cp -p "${system}:/lib/libc.so" "${dest}/lib/" - e2cp -p "${system}:/lib/libm.so" "${dest}/lib/" - fi - - # clean up - apt-get purge --auto-remove -y e2tools - - popd - - rm -rf "${td}" -} - -main "${@}" diff --git a/ci/build.sh b/ci/build.sh deleted file mode 100644 index 707dd4ac..00000000 --- a/ci/build.sh +++ /dev/null @@ -1,221 +0,0 @@ -#!/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 - # FIXME: https://github.com/rust-lang/rust/issues/61174 - if [ "${TARGET}" = "sparcv9-sun-solaris" ] || - [ "${TARGET}" = "x86_64-sun-solaris" ]; then - return 0 - 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-freebsd \ -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 \ -powerpc64-unknown-freebsd \ -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/ci/docker/aarch64-linux-android/Dockerfile b/ci/docker/aarch64-linux-android/Dockerfile deleted file mode 100644 index 6751dd93..00000000 --- a/ci/docker/aarch64-linux-android/Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -FROM ubuntu:19.04 - -RUN dpkg --add-architecture i386 && \ - apt-get update && \ - apt-get install -y --no-install-recommends \ - file \ - curl \ - ca-certificates \ - python \ - unzip \ - expect \ - openjdk-8-jre \ - libstdc++6:i386 \ - libpulse0 \ - gcc \ - libc6-dev - -WORKDIR /android/ -COPY android* /android/ - -ENV ANDROID_ARCH=aarch64 -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools - -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH -RUN sh /android/android-install-sdk.sh $ANDROID_ARCH -RUN mv /root/.android /tmp -RUN chmod 777 -R /tmp/.android -RUN chmod 755 /android/sdk/tools/* /android/sdk/emulator/qemu/linux-x86_64/* - -ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \ - CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=/tmp/runtest \ - HOME=/tmp - -ADD runtest-android.rs /tmp/runtest.rs -ENTRYPOINT [ \ - "bash", \ - "-c", \ - # set SHELL so android can detect a 64bits system, see - # http://stackoverflow.com/a/41789144 - "SHELL=/bin/dash /android/sdk/emulator/emulator @aarch64 -no-window & \ - rustc /tmp/runtest.rs -o /tmp/runtest && \ - exec \"$@\"", \ - "--" \ -] diff --git a/ci/docker/aarch64-unknown-linux-gnu/Dockerfile b/ci/docker/aarch64-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 716a445d..00000000 --- a/ci/docker/aarch64-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -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 -ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \ - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -L /usr/aarch64-linux-gnu" \ - PATH=$PATH:/rust/bin diff --git a/ci/docker/aarch64-unknown-linux-musl/Dockerfile b/ci/docker/aarch64-unknown-linux-musl/Dockerfile deleted file mode 100644 index e9634bf3..00000000 --- a/ci/docker/aarch64-unknown-linux-musl/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM ubuntu:19.04 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc make libc6-dev git curl ca-certificates \ - gcc-aarch64-linux-gnu qemu-user - -COPY install-musl.sh / -RUN sh /install-musl.sh aarch64 - -# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in libstd? -ENV PATH=$PATH:/musl-aarch64/bin:/rust/bin \ - CC_aarch64_unknown_linux_musl=musl-gcc \ - RUSTFLAGS='-Clink-args=-lgcc' \ - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc \ - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUNNER="qemu-aarch64 -L /musl-aarch64" diff --git a/ci/docker/arm-linux-androideabi/Dockerfile b/ci/docker/arm-linux-androideabi/Dockerfile deleted file mode 100644 index 544d1676..00000000 --- a/ci/docker/arm-linux-androideabi/Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -FROM ubuntu:19.04 - -RUN dpkg --add-architecture i386 && \ - apt-get update && \ - apt-get install -y --no-install-recommends \ - file \ - curl \ - ca-certificates \ - python \ - unzip \ - expect \ - openjdk-8-jre \ - libstdc++6:i386 \ - libpulse0 \ - gcc \ - libc6-dev - -WORKDIR /android/ -COPY android* /android/ - -ENV ANDROID_ARCH=arm -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools - -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH -RUN sh /android/android-install-sdk.sh $ANDROID_ARCH -RUN mv /root/.android /tmp -RUN chmod 777 -R /tmp/.android -RUN chmod 755 /android/sdk/tools/* /android/sdk/emulator/qemu/linux-x86_64/* - -ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \ - CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \ - HOME=/tmp - -ADD runtest-android.rs /tmp/runtest.rs -ENTRYPOINT [ \ - "bash", \ - "-c", \ - # set SHELL so android can detect a 64bits system, see - # http://stackoverflow.com/a/41789144 - "SHELL=/bin/dash /android/sdk/emulator/emulator @arm -no-window & \ - rustc /tmp/runtest.rs -o /tmp/runtest && \ - exec \"$@\"", \ - "--" \ -] diff --git a/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile b/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile deleted file mode 100644 index bcdbb227..00000000 --- a/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -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 -ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \ - CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER="qemu-arm -L /usr/arm-linux-gnueabihf" \ - PATH=$PATH:/rust/bin diff --git a/ci/docker/arm-unknown-linux-musleabihf/Dockerfile b/ci/docker/arm-unknown-linux-musleabihf/Dockerfile deleted file mode 100644 index 639b141d..00000000 --- a/ci/docker/arm-unknown-linux-musleabihf/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM ubuntu:19.04 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc make libc6-dev git curl ca-certificates \ - gcc-arm-linux-gnueabihf qemu-user - -COPY install-musl.sh / -RUN sh /install-musl.sh arm - -ENV PATH=$PATH:/musl-arm/bin:/rust/bin \ - CC_arm_unknown_linux_musleabihf=musl-gcc \ - CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_LINKER=musl-gcc \ - CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_RUNNER="qemu-arm -L /musl-arm" diff --git a/ci/docker/asmjs-unknown-emscripten/Dockerfile b/ci/docker/asmjs-unknown-emscripten/Dockerfile deleted file mode 100644 index 6c08340e..00000000 --- a/ci/docker/asmjs-unknown-emscripten/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM ubuntu:19.04 - -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - gcc \ - git \ - libc6-dev \ - python \ - xz-utils - -COPY emscripten.sh / -RUN bash /emscripten.sh - -ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_ASMJS_UNKNOWN_EMSCRIPTEN_RUNNER=node - -COPY emscripten-entry.sh / -ENTRYPOINT ["/emscripten-entry.sh"] diff --git a/ci/docker/i686-linux-android/Dockerfile b/ci/docker/i686-linux-android/Dockerfile deleted file mode 100644 index 54032205..00000000 --- a/ci/docker/i686-linux-android/Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -FROM ubuntu:19.04 - -RUN dpkg --add-architecture i386 && \ - apt-get update && \ - apt-get install -y --no-install-recommends \ - file \ - curl \ - ca-certificates \ - python \ - unzip \ - expect \ - openjdk-8-jre \ - libstdc++6:i386 \ - libpulse0 \ - gcc \ - libc6-dev - -WORKDIR /android/ -COPY android* /android/ - -ENV ANDROID_ARCH=i686 -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/tools:/android/sdk/platform-tools - -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH -RUN sh /android/android-install-sdk.sh $ANDROID_ARCH -RUN mv /root/.android /tmp -RUN chmod 777 -R /tmp/.android -RUN chmod 755 /android/sdk/tools/* /android/sdk/emulator/qemu/linux-x86_64/* - -ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \ - CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=/tmp/runtest \ - HOME=/tmp - -ADD runtest-android.rs /tmp/runtest.rs -ENTRYPOINT [ \ - "bash", \ - "-c", \ - # set SHELL so android can detect a 64bits system, see - # http://stackoverflow.com/a/41789144 - "SHELL=/bin/dash /android/sdk/emulator/emulator @i686 -no-window -no-accel & \ - rustc /tmp/runtest.rs -o /tmp/runtest && \ - exec \"$@\"", \ - "--" \ -] diff --git a/ci/docker/i686-unknown-linux-gnu/Dockerfile b/ci/docker/i686-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 5563a7b9..00000000 --- a/ci/docker/i686-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM ubuntu:19.04 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - gcc-multilib libc6-dev ca-certificates -ENV PATH=$PATH:/rust/bin diff --git a/ci/docker/i686-unknown-linux-musl/Dockerfile b/ci/docker/i686-unknown-linux-musl/Dockerfile deleted file mode 100644 index ac76a326..00000000 --- a/ci/docker/i686-unknown-linux-musl/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM ubuntu:19.04 - -RUN dpkg --add-architecture i386 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - gcc-multilib make libc6-dev git curl ca-certificates libc6:i386 - -COPY install-musl.sh / -RUN sh /install-musl.sh i686 - -ENV PATH=$PATH:/musl-i686/bin:/rust/bin \ - CC_i686_unknown_linux_musl=musl-gcc diff --git a/ci/docker/mips-unknown-linux-gnu/Dockerfile b/ci/docker/mips-unknown-linux-gnu/Dockerfile deleted file mode 100644 index c8623a56..00000000 --- a/ci/docker/mips-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM ubuntu:19.04 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates \ - gcc-mips-linux-gnu libc6-dev-mips-cross \ - qemu-system-mips linux-headers-generic - -ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \ - CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_RUNNER="qemu-mips -L /usr/mips-linux-gnu" \ - PATH=$PATH:/rust/bin diff --git a/ci/docker/mips-unknown-linux-musl/Dockerfile b/ci/docker/mips-unknown-linux-musl/Dockerfile deleted file mode 100644 index aee73bea..00000000 --- a/ci/docker/mips-unknown-linux-musl/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -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 \ - bzip2 - -RUN mkdir /toolchain - -# Note that this originally came from: -# https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 -RUN curl --retry 5 -L https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \ - tar xjf - -C /toolchain --strip-components=1 - -ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15/bin \ - CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \ - CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-gcc \ - CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15" diff --git a/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile b/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile deleted file mode 100644 index d4b972d3..00000000 --- a/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM ubuntu:19.04 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates \ - gcc-mips64-linux-gnuabi64 libc6-dev-mips64-cross \ - qemu-system-mips64 linux-headers-generic - -ENV CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER=mips64-linux-gnuabi64-gcc \ - CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_RUNNER="qemu-mips64 -L /usr/mips64-linux-gnuabi64" \ - CC_mips64_unknown_linux_gnuabi64=mips64-linux-gnuabi64-gcc \ - PATH=$PATH:/rust/bin diff --git a/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile b/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile deleted file mode 100644 index d0303dad..00000000 --- a/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM ubuntu:19.04 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates \ - gcc-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross \ - qemu-system-mips64el linux-headers-generic - -ENV CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_GNUABI64_LINKER=mips64el-linux-gnuabi64-gcc \ - CARGO_TARGET_MIPS64EL_UNKNOWN_LINUX_GNUABI64_RUNNER="qemu-mips64el -L /usr/mips64el-linux-gnuabi64" \ - CC_mips64el_unknown_linux_gnuabi64=mips64el-linux-gnuabi64-gcc \ - PATH=$PATH:/rust/bin diff --git a/ci/docker/mipsel-unknown-linux-musl/Dockerfile b/ci/docker/mipsel-unknown-linux-musl/Dockerfile deleted file mode 100644 index 03e83578..00000000 --- a/ci/docker/mipsel-unknown-linux-musl/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -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 \ - bzip2 - -RUN mkdir /toolchain - -# Note that this originally came from: -# https://downloads.openwrt.org/snapshots/trunk/malta/generic/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 -RUN curl --retry 5 -L https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \ - tar xjf - -C /toolchain --strip-components=2 - -ENV PATH=$PATH:/rust/bin:/toolchain/bin \ - CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \ - CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-gcc \ - CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mipsel -L /toolchain" diff --git a/ci/docker/powerpc-unknown-linux-gnu/Dockerfile b/ci/docker/powerpc-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 9fa05af1..00000000 --- a/ci/docker/powerpc-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM ubuntu:19.04 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates \ - gcc-powerpc-linux-gnu libc6-dev-powerpc-cross \ - qemu-system-ppc - -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/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile b/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile deleted file mode 100644 index ab407897..00000000 --- a/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM ubuntu:19.04 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates \ - gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross \ - qemu-system-ppc - -ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \ - CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64 -L /usr/powerpc64-linux-gnu" \ - CC=powerpc64-linux-gnu-gcc \ - PATH=$PATH:/rust/bin diff --git a/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile b/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 4dcd632e..00000000 --- a/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM ubuntu:19.04 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates \ - gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross \ - qemu-system-ppc - -ENV CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_LINKER=powerpc64le-linux-gnu-gcc \ - CARGO_TARGET_POWERPC64LE_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64le -L /usr/powerpc64le-linux-gnu" \ - CC=powerpc64le-linux-gnu-gcc \ - PATH=$PATH:/rust/bin diff --git a/ci/docker/s390x-unknown-linux-gnu/Dockerfile b/ci/docker/s390x-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 75c11c11..00000000 --- a/ci/docker/s390x-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM ubuntu:19.04 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - curl ca-certificates \ - gcc libc6-dev \ - gcc-s390x-linux-gnu libc6-dev-s390x-cross \ - qemu-system-s390x \ - cpio - -COPY linux-s390x.sh / -RUN bash /linux-s390x.sh - -COPY test-runner-linux / - -ENV CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc \ - CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER="/test-runner-linux s390x" \ - CC_s390x_unknown_linux_gnu=s390x-linux-gnu-gcc \ - PATH=$PATH:/rust/bin diff --git a/ci/docker/sparc64-unknown-linux-gnu/Dockerfile b/ci/docker/sparc64-unknown-linux-gnu/Dockerfile deleted file mode 100644 index d1f4503d..00000000 --- a/ci/docker/sparc64-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -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 - -COPY linux-sparc64.sh / -RUN bash /linux-sparc64.sh - -COPY test-runner-linux / - -ENV CARGO_TARGET_SPARC64_UNKNOWN_LINUX_GNU_LINKER=sparc64-linux-gnu-gcc \ - CARGO_TARGET_SPARC64_UNKNOWN_LINUX_GNU_RUNNER="/test-runner-linux sparc64" \ - CC_sparc64_unknown_linux_gnu=sparc64-linux-gnu-gcc \ - PATH=$PATH:/rust/bin diff --git a/ci/docker/wasm32-unknown-emscripten/Dockerfile b/ci/docker/wasm32-unknown-emscripten/Dockerfile deleted file mode 100644 index c0ce825e..00000000 --- a/ci/docker/wasm32-unknown-emscripten/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM ubuntu:19.04 - -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - ca-certificates \ - g++ \ - make \ - file \ - curl \ - gcc \ - git \ - libc6-dev \ - python \ - cmake \ - sudo \ - gdb \ - xz-utils - -COPY emscripten.sh / -RUN bash /emscripten.sh - -ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node-wrapper.sh - -COPY emscripten-entry.sh / -COPY docker/wasm32-unknown-emscripten/node-wrapper.sh /usr/local/bin/node-wrapper.sh -ENTRYPOINT ["/emscripten-entry.sh"] diff --git a/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh b/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh deleted file mode 100755 index 3122e2e2..00000000 --- a/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -set -e - -me=$1 -shift -dir=$(dirname $me) -file=$(basename $me) - -if echo $file | grep -q wasm; then - exit 0 # FIXME(rust-lang/cargo#4750) -fi - -cd $dir -exec node $file "$@" diff --git a/ci/docker/wasm32-wasi/Dockerfile b/ci/docker/wasm32-wasi/Dockerfile deleted file mode 100644 index d963a442..00000000 --- a/ci/docker/wasm32-wasi/Dockerfile +++ /dev/null @@ -1,93 +0,0 @@ -# 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/ci/docker/wasm32-wasi/clang.sh b/ci/docker/wasm32-wasi/clang.sh deleted file mode 100755 index 6f298128..00000000 --- a/ci/docker/wasm32-wasi/clang.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env sh -exec /wasmcc/bin/clang --target=wasm32-wasi --sysroot /wasi-sysroot "$@" diff --git a/ci/docker/x86_64-linux-android/Dockerfile b/ci/docker/x86_64-linux-android/Dockerfile deleted file mode 100644 index b0984c04..00000000 --- a/ci/docker/x86_64-linux-android/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM ubuntu:19.04 - -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - gcc \ - libc-dev \ - python \ - unzip - -WORKDIR /android/ -ENV ANDROID_ARCH=x86_64 -COPY android-install-ndk.sh /android/ -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH - -# We do not run x86_64-linux-android tests on an android emulator. -# See ci/android-sysimage.sh for informations about how tests are run. -COPY android-sysimage.sh /android/ -RUN bash /android/android-sysimage.sh x86_64 x86_64-24_r07.zip - -ENV PATH=$PATH:/rust/bin:/android/ndk-$ANDROID_ARCH/bin \ - CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android-gcc \ - CC_x86_64_linux_android=x86_64-linux-android-gcc \ - CXX_x86_64_linux_android=x86_64-linux-android-g++ \ - HOME=/tmp diff --git a/ci/docker/x86_64-rumprun-netbsd/Dockerfile b/ci/docker/x86_64-rumprun-netbsd/Dockerfile deleted file mode 100644 index a486d05b..00000000 --- a/ci/docker/x86_64-rumprun-netbsd/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM mato/rumprun-toolchain-hw-x86_64 -USER root -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - qemu -ENV PATH=$PATH:/rust/bin \ - CARGO_TARGET_X86_64_RUMPRUN_NETBSD_RUNNER=/tmp/runtest - -ADD docker/x86_64-rumprun-netbsd/runtest.rs /tmp/ -ENTRYPOINT ["sh", "-c", "rustc /tmp/runtest.rs -o /tmp/runtest && exec \"$@\"", "--"] diff --git a/ci/docker/x86_64-rumprun-netbsd/runtest.rs b/ci/docker/x86_64-rumprun-netbsd/runtest.rs deleted file mode 100644 index 7e96fbfa..00000000 --- a/ci/docker/x86_64-rumprun-netbsd/runtest.rs +++ /dev/null @@ -1,55 +0,0 @@ -use std::env; -use std::process::{Command, Stdio}; -use std::sync::mpsc; -use std::thread; -use std::time::Duration; -use std::io::{BufRead, BufReader, Read}; - -fn main() { - assert_eq!(env::args().len(), 2); - - let status = Command::new("rumprun-bake") - .arg("hw_virtio") - .arg("/tmp/libc-test.img") - .arg(env::args().nth(1).unwrap()) - .status() - .expect("failed to run rumprun-bake"); - assert!(status.success()); - - let mut child = Command::new("qemu-system-x86_64") - .arg("-nographic") - .arg("-vga").arg("none") - .arg("-m").arg("64") - .arg("-kernel").arg("/tmp/libc-test.img") - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .spawn() - .expect("failed to spawn qemu"); - - let mut stdout = child.stdout.take().unwrap(); - let mut stderr = child.stderr.take().unwrap(); - let (tx, rx) = mpsc::channel(); - let tx2 = tx.clone(); - let t1 = thread::spawn(move || find_ok(&mut stdout, tx)); - let t2 = thread::spawn(move || find_ok(&mut stderr, tx2)); - - let res = rx.recv_timeout(Duration::new(5, 0)); - child.kill().unwrap(); - t1.join().unwrap(); - t2.join().unwrap(); - - if res.is_err() { - panic!("didn't find success"); - } -} - -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")) || - line.starts_with("test result: ok"){ - tx.send(()).unwrap(); - } - } -} diff --git a/ci/docker/x86_64-unknown-linux-gnu/Dockerfile b/ci/docker/x86_64-unknown-linux-gnu/Dockerfile deleted file mode 100644 index bfa2b170..00000000 --- a/ci/docker/x86_64-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM ubuntu:19.04 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - gcc libc6-dev ca-certificates linux-headers-generic - -RUN apt search linux-headers -RUN ls /usr/src - -ENV PATH=$PATH:/rust/bin diff --git a/ci/docker/x86_64-unknown-linux-gnux32/Dockerfile b/ci/docker/x86_64-unknown-linux-gnux32/Dockerfile deleted file mode 100644 index 5563a7b9..00000000 --- a/ci/docker/x86_64-unknown-linux-gnux32/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM ubuntu:19.04 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - gcc-multilib libc6-dev ca-certificates -ENV PATH=$PATH:/rust/bin diff --git a/ci/docker/x86_64-unknown-linux-musl/Dockerfile b/ci/docker/x86_64-unknown-linux-musl/Dockerfile deleted file mode 100644 index 06a081b7..00000000 --- a/ci/docker/x86_64-unknown-linux-musl/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM ubuntu:19.04 - -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - gcc make libc6-dev git curl ca-certificates - -COPY install-musl.sh / -RUN sh /install-musl.sh x86_64 - -ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin diff --git a/ci/dox.sh b/ci/dox.sh deleted file mode 100644 index ce550814..00000000 --- a/ci/dox.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env sh - -# Builds documentation for all target triples that we have a registered URL for -# in liblibc. This scrapes the list of triples to document from `src/lib.rs` -# which has a bunch of `html_root_url` directives we pick up. - -set -ex - -TARGET_DOC_DIR=target/doc -README=README.md -PLATFORM_SUPPORT=platform-support.md - -rm -rf $TARGET_DOC_DIR -mkdir -p $TARGET_DOC_DIR - -# 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 - -# Create a markdown list of supported platforms in $PLATFORM_SUPPORT -rm $PLATFORM_SUPPORT || true - -printf '### Platform-specific documentation\n' >> $PLATFORM_SUPPORT - -while read -r target; do - echo "documenting ${target}" - - 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 <div class="platform_support"></div> with the contents of $PLATFORM_SUPPORT -cp $README $TARGET_DOC_DIR -line=$(grep -n '<div class="platform_docs"></div>' $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" $TARGET_DOC_DIR - git push -qf "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" gh-pages -fi diff --git a/ci/emscripten-entry.sh b/ci/emscripten-entry.sh deleted file mode 100755 index 0016f566..00000000 --- a/ci/emscripten-entry.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -set -ex - -# shellcheck disable=SC1091 -source /emsdk-portable/emsdk_env.sh &> /dev/null - -# emsdk-portable provides a node binary, but we need version 8 to run wasm -export PATH="/node-v12.3.1-linux-x64/bin:$PATH" - -exec "$@" diff --git a/ci/emscripten.sh b/ci/emscripten.sh deleted file mode 100644 index db313232..00000000 --- a/ci/emscripten.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2017 The Rust Project Developers. See the COPYRIGHT -# file at the top-level directory of this distribution and at -# http://rust-lang.org/COPYRIGHT. -# -# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -# option. This file may not be copied, modified, or distributed -# except according to those terms. - -set -ex - -hide_output() { - set +x - on_err=" -echo ERROR: An error was encountered with the build. -cat /tmp/build.log -exit 1 -" - trap '$on_err' ERR - bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & - PING_LOOP_PID=$! - "${@}" &> /tmp/build.log - trap - ERR - kill $PING_LOOP_PID - rm -f /tmp/build.log - set -x -} - -cd / -curl --retry 5 -L https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \ - tar -xz - -cd /emsdk-portable -./emsdk update -hide_output ./emsdk install sdk-1.38.15-64bit -./emsdk activate sdk-1.38.15-64bit - -# Compile and cache libc -# shellcheck disable=SC1091 -source ./emsdk_env.sh -echo "main(){}" > a.c -HOME=/emsdk-portable/ emcc a.c -HOME=/emsdk-portable/ emcc -s BINARYEN=1 a.c -rm -f a.* - -# Make emsdk usable by any user -cp /root/.emscripten /emsdk-portable -chmod a+rxw -R /emsdk-portable - -# node 8 is required to run wasm -cd / -curl --retry 5 -L https://nodejs.org/dist/v12.3.1/node-v12.3.1-linux-x64.tar.xz | \ - tar -xJ - diff --git a/ci/install-musl.sh b/ci/install-musl.sh deleted file mode 100644 index ab98c4f0..00000000 --- a/ci/install-musl.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env sh -# -# Install musl and musl-sanitized linux kernel headers -# to musl-{$1} directory - -set -ex - -MUSL_VERSION=1.1.22 -MUSL="musl-${MUSL_VERSION}" - -# Download, configure, build, and install musl: -curl --retry 5 https://www.musl-libc.org/releases/${MUSL}.tar.gz | tar xzf - - -cd $MUSL -case ${1} in - aarch64) - musl_arch=aarch64 - kernel_arch=arm64 - CC=aarch64-linux-gnu-gcc \ - ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes - make install -j4 - ;; - arm) - musl_arch=arm - kernel_arch=arm - CC=arm-linux-gnueabihf-gcc CFLAGS="-march=armv6 -marm -mfpu=vfp" \ - ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes - make install -j4 - ;; - i686) - # cross-compile musl for i686 using the system compiler on an x86_64 - # system. - musl_arch=i686 - kernel_arch=i386 - # Specifically pass -m32 in CFLAGS and override CC when running - # ./configure, since otherwise the script will fail to find a compiler. - CC=gcc CFLAGS="-m32" \ - ./configure --prefix="/musl-${musl_arch}" --disable-shared --target=i686 - # unset CROSS_COMPILE when running make; otherwise the makefile will - # call the non-existent binary 'i686-ar'. - make CROSS_COMPILE= install -j4 - ;; - x86_64) - musl_arch=x86_64 - kernel_arch=x86_64 - ./configure --prefix="/musl-${musl_arch}" - make install -j4 - ;; - *) - echo "Unknown target arch: \"${1}\"" - exit 1 - ;; -esac - - -# shellcheck disable=SC2103 -cd .. -rm -rf $MUSL - -# Download, configure, build, and install musl-sanitized kernel headers: -KERNEL_HEADER_VER="4.4.2-2" -curl --retry 5 -L \ - "https://github.com/sabotage-linux/kernel-headers/archive/v${KERNEL_HEADER_VER}.tar.gz" | \ - tar xzf - -( - cd kernel-headers-${KERNEL_HEADER_VER} - make ARCH="${kernel_arch}" prefix="/musl-${musl_arch}" install -j4 -) -rm -rf kernel-headers-${KERNEL_HEADER_VER} diff --git a/ci/ios/deploy_and_run_on_ios_simulator.rs b/ci/ios/deploy_and_run_on_ios_simulator.rs deleted file mode 100644 index 2075be6d..00000000 --- a/ci/ios/deploy_and_run_on_ios_simulator.rs +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// This is a script to deploy and execute a binary on an iOS simulator. -// The primary use of this is to be able to run unit tests on the simulator and -// retrieve the results. -// -// To do this through Cargo instead, use Dinghy -// (https://github.com/snipsco/dinghy): cargo dinghy install, then cargo dinghy -// test. - -use std::env; -use std::fs::{self, File}; -use std::io::Write; -use std::path::Path; -use std::process; -use std::process::Command; - -macro_rules! t { - ($e:expr) => (match $e { - Ok(e) => e, - Err(e) => panic!("{} failed with: {}", stringify!($e), e), - }) -} - -// Step one: Wrap as an app -fn package_as_simulator_app(crate_name: &str, test_binary_path: &Path) { - println!("Packaging simulator app"); - drop(fs::remove_dir_all("ios_simulator_app")); - t!(fs::create_dir("ios_simulator_app")); - t!(fs::copy(test_binary_path, - Path::new("ios_simulator_app").join(crate_name))); - - let mut f = t!(File::create("ios_simulator_app/Info.plist")); - t!(f.write_all(format!(r#" - <?xml version="1.0" encoding="UTF-8"?> - <!DOCTYPE plist PUBLIC - "-//Apple//DTD PLIST 1.0//EN" - "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> - <plist version="1.0"> - <dict> - <key>CFBundleExecutable</key> - <string>{}</string> - <key>CFBundleIdentifier</key> - <string>com.rust.unittests</string> - </dict> - </plist> - "#, crate_name).as_bytes())); -} - -// Step two: Start the iOS simulator -fn start_simulator() { - println!("Looking for iOS simulator"); - let output = t!(Command::new("xcrun").arg("simctl").arg("list").output()); - assert!(output.status.success()); - let mut simulator_exists = false; - let mut simulator_booted = false; - let mut found_rust_sim = false; - let stdout = t!(String::from_utf8(output.stdout)); - for line in stdout.lines() { - if line.contains("rust_ios") { - if found_rust_sim { - panic!("Duplicate rust_ios simulators found. Please \ - double-check xcrun simctl list."); - } - simulator_exists = true; - simulator_booted = line.contains("(Booted)"); - found_rust_sim = true; - } - } - - if simulator_exists == false { - println!("Creating iOS simulator"); - Command::new("xcrun") - .arg("simctl") - .arg("create") - .arg("rust_ios") - .arg("com.apple.CoreSimulator.SimDeviceType.iPhone-SE") - .arg("com.apple.CoreSimulator.SimRuntime.iOS-10-2") - .check_status(); - } else if simulator_booted == true { - println!("Shutting down already-booted simulator"); - Command::new("xcrun") - .arg("simctl") - .arg("shutdown") - .arg("rust_ios") - .check_status(); - } - - println!("Starting iOS simulator"); - // We can't uninstall the app (if present) as that will hang if the - // simulator isn't completely booted; just erase the simulator instead. - Command::new("xcrun").arg("simctl").arg("erase").arg("rust_ios").check_status(); - Command::new("xcrun").arg("simctl").arg("boot").arg("rust_ios").check_status(); -} - -// Step three: Install the app -fn install_app_to_simulator() { - println!("Installing app to simulator"); - Command::new("xcrun") - .arg("simctl") - .arg("install") - .arg("booted") - .arg("ios_simulator_app/") - .check_status(); -} - -// Step four: Run the app -fn run_app_on_simulator() { - println!("Running app"); - let output = t!(Command::new("xcrun") - .arg("simctl") - .arg("launch") - .arg("--console") - .arg("booted") - .arg("com.rust.unittests") - .output()); - - println!("status: {}", output.status); - println!("stdout --\n{}\n", String::from_utf8_lossy(&output.stdout)); - println!("stderr --\n{}\n", String::from_utf8_lossy(&output.stderr)); - - let stdout = String::from_utf8_lossy(&output.stdout); - let passed = stdout.lines() - .find(|l| - (l.contains("PASSED") && - l.contains("tests")) || - l.contains("test result: ok") - ) - .unwrap_or(false); - - println!("Shutting down simulator"); - Command::new("xcrun") - .arg("simctl") - .arg("shutdown") - .arg("rust_ios") - .check_status(); - if !passed { - panic!("tests didn't pass"); - } -} - -trait CheckStatus { - fn check_status(&mut self); -} - -impl CheckStatus for Command { - fn check_status(&mut self) { - println!("\trunning: {:?}", self); - assert!(t!(self.status()).success()); - } -} - -fn main() { - let args: Vec<String> = env::args().collect(); - if args.len() != 2 { - println!("Usage: {} <executable>", args[0]); - process::exit(-1); - } - - let test_binary_path = Path::new(&args[1]); - let crate_name = test_binary_path.file_name().unwrap(); - - package_as_simulator_app(crate_name.to_str().unwrap(), test_binary_path); - start_simulator(); - install_app_to_simulator(); - run_app_on_simulator(); -} diff --git a/ci/linux-s390x.sh b/ci/linux-s390x.sh deleted file mode 100644 index 00a7f881..00000000 --- a/ci/linux-s390x.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env sh - -set -ex - -mkdir -m 777 /qemu -cd /qemu - -curl --retry 5 -LO https://github.com/qemu/qemu/raw/master/pc-bios/s390-ccw.img -curl --retry 5 -LO http://ftp.debian.org/debian/dists/testing/main/installer-s390x/20190410/images/generic/kernel.debian -curl --retry 5 -LO http://ftp.debian.org/debian/dists/testing/main/installer-s390x/20190410/images/generic/initrd.debian - -mv kernel.debian kernel -mv initrd.debian initrd.gz - -mkdir init -cd init -gunzip -c ../initrd.gz | cpio -id -rm ../initrd.gz -cp /usr/s390x-linux-gnu/lib/libgcc_s.so.1 usr/lib/ -chmod a+w . diff --git a/ci/linux-sparc64.sh b/ci/linux-sparc64.sh deleted file mode 100644 index 5580a0e3..00000000 --- a/ci/linux-sparc64.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env sh - -set -ex - -mkdir -m 777 /qemu -cd /qemu - -curl --retry 5 -LO https://cdimage.debian.org/cdimage/ports/10.0/sparc64/iso-cd/debian-10.0-sparc64-NETINST-1.iso -7z e debian-10.0-sparc64-NETINST-1.iso boot/initrd.gz -7z e debian-10.0-sparc64-NETINST-1.iso boot/sparc64 -mv sparc64 kernel -rm debian-10.0-sparc64-NETINST-1.iso - -mkdir init -cd init -gunzip -c ../initrd.gz | cpio -id -rm ../initrd.gz -cp /usr/sparc64-linux-gnu/lib/libgcc_s.so.1 usr/lib/ -chmod a+w . diff --git a/ci/run-docker.sh b/ci/run-docker.sh deleted file mode 100755 index c656f590..00000000 --- a/ci/run-docker.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env sh - -# Small script to run tests for a target (or all targets) inside all the -# respective docker images. - -set -ex - -run() { - echo "Building docker container for target ${1}" - - # use -f so we can use ci/ as build context - docker build -t libc -f "ci/docker/${1}/Dockerfile" ci/ - mkdir -p target - if [ -w /dev/kvm ]; then - kvm="--volume /dev/kvm:/dev/kvm" - else - kvm="" - fi - - docker run \ - --user "$(id -u)":"$(id -g)" \ - --rm \ - --init \ - --volume "${HOME}/.cargo":/cargo \ - $kvm \ - --env CARGO_HOME=/cargo \ - --volume "$(rustc --print sysroot)":/rust:ro \ - --volume "$(pwd)":/checkout:ro \ - --volume "$(pwd)"/target:/checkout/target \ - --env CARGO_TARGET_DIR=/checkout/target \ - --workdir /checkout \ - libc \ - ci/run.sh "${1}" -} - -if [ -z "${1}" ]; then - for d in ci/docker/*; do - run "${d}" - done -else - run "${1}" -fi diff --git a/ci/run-qemu.sh b/ci/run-qemu.sh deleted file mode 100644 index 6fba6298..00000000 --- a/ci/run-qemu.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env sh - -# Initial script which is run inside of all qemu images. The first argument to -# this script (as arranged by the qemu image itself) is the path to where the -# libc crate is mounted. -# -# For qemu images we currently need to install Rust manually as this wasn't done -# by the initial run-travis.sh script -# -# FIXME: feels like run-travis.sh should be responsible for downloading the -# compiler. - -set -ex - -ROOT="${1}" -cp -r "${ROOT}/libc" /tmp/libc -cd /tmp/libc - -TARGET="$(cat "${ROOT}/TARGET")" -export CARGO_TARGET_DIR=/tmp - -case $TARGET in - *-openbsd) - pkg_add cargo gcc%4.9 rust - export CC=egcc - ;; - - *) - echo "Unknown target: ${TARGET}" - exit 1 - ;; -esac - -exec sh ci/run.sh "${TARGET}" diff --git a/ci/run.sh b/ci/run.sh deleted file mode 100755 index 8c56979e..00000000 --- a/ci/run.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env sh - -# Builds and runs tests for a particular target passed as an argument to this -# script. - -set -ex - -TARGET="${1}" - -# If we're going to run tests inside of a qemu image, then we don't need any of -# the scripts below. Instead, download the image, prepare a filesystem which has -# the current state of this repository, and then run the image. -# -# It's assume that all images, when run with two disks, will run the `run.sh` -# script from the second which we place inside. -if [ "$QEMU" != "" ]; then - tmpdir=/tmp/qemu-img-creation - mkdir -p "${tmpdir}" - - if [ -z "${QEMU#*.gz}" ]; then - # image is .gz : download and uncompress it - qemufile="$(echo "${QEMU%.gz}" | sed 's/\//__/g')" - if [ ! -f "${tmpdir}/${qemufile}" ]; then - curl --retry 5 "https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/${QEMU}" | \ - gunzip -d > "${tmpdir}/${qemufile}" - fi - elif [ -z "${QEMU#*.xz}" ]; then - # image is .xz : download and uncompress it - qemufile="$(echo "${QEMU%.xz}" | sed 's/\//__/g')" - if [ ! -f "${tmpdir}/${qemufile}" ]; then - curl --retry 5 "https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/${QEMU}" | \ - unxz > "${tmpdir}/${qemufile}" - fi - else - # plain qcow2 image: just download it - qemufile="$(echo "${QEMU}" | sed 's/\//__/g')" - if [ ! -f "${tmpdir}/${qemufile}" ]; then - curl --retry 5 "https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/${QEMU}" \ - > "${tmpdir}/${qemufile}" - fi - fi - - # Create a mount a fresh new filesystem image that we'll later pass to QEMU. - # This will have a `run.sh` script will which use the artifacts inside to run - # on the host. - rm -f "${tmpdir}/libc-test.img" - mkdir "${tmpdir}/mount" - - # Do the standard rigamarole of cross-compiling an executable and then the - # script to run just executes the binary. - cargo build \ - --manifest-path libc-test/Cargo.toml \ - --target "${TARGET}" \ - --test main - rm "${CARGO_TARGET_DIR}/${TARGET}"/debug/main-*.d - cp "${CARGO_TARGET_DIR}/${TARGET}"/debug/main-* "${tmpdir}"/mount/libc-test - # shellcheck disable=SC2016 - echo 'exec $1/libc-test' > "${tmpdir}/mount/run.sh" - - du -sh "${tmpdir}/mount" - genext2fs \ - --root "${tmpdir}/mount" \ - --size-in-blocks 100000 \ - "${tmpdir}/libc-test.img" - - # Pass -snapshot to prevent tampering with the disk images, this helps when - # running this script in development. The two drives are then passed next, - # first is the OS and second is the one we just made. Next the network is - # configured to work (I'm not entirely sure how), and then finally we turn off - # graphics and redirect the serial console output to out.log. - qemu-system-x86_64 \ - -m 1024 \ - -snapshot \ - -drive if=virtio,file="${tmpdir}/${qemufile}" \ - -drive if=virtio,file="${tmpdir}/libc-test.img" \ - -net nic,model=virtio \ - -net user \ - -nographic \ - -vga none 2>&1 | tee "${CARGO_TARGET_DIR}/out.log" - exec egrep "^(PASSED)|(test result: ok)" "${CARGO_TARGET_DIR}/out.log" -fi - -# FIXME: x86_64-unknown-linux-gnux32 fail to compile without --release -# See https://github.com/rust-lang/rust/issues/45417 -opt= -if [ "$TARGET" = "x86_64-unknown-linux-gnux32" ]; then - opt="--release" -fi - -export LIBC_CI=1 - -cargo test -vv $opt --no-default-features --manifest-path libc-test/Cargo.toml \ - --target "${TARGET}" - -cargo test -vv $opt --manifest-path libc-test/Cargo.toml --target "${TARGET}" - -cargo test -vv $opt --features extra_traits --manifest-path libc-test/Cargo.toml \ - --target "${TARGET}" diff --git a/ci/runtest-android.rs b/ci/runtest-android.rs deleted file mode 100644 index b8030c41..00000000 --- a/ci/runtest-android.rs +++ /dev/null @@ -1,47 +0,0 @@ -use std::env; -use std::process::Command; -use std::path::{Path, PathBuf}; - -fn main() { - let args = env::args_os() - .skip(1) - .filter(|arg| arg != "--quiet") - .collect::<Vec<_>>(); - assert_eq!(args.len(), 1); - let test = PathBuf::from(&args[0]); - let dst = Path::new("/data/local/tmp").join(test.file_name().unwrap()); - - let status = Command::new("adb") - .arg("wait-for-device") - .status() - .expect("failed to run: adb wait-for-device"); - assert!(status.success()); - - let status = Command::new("adb") - .arg("push") - .arg(&test) - .arg(&dst) - .status() - .expect("failed to run: adb pushr"); - assert!(status.success()); - - let output = Command::new("adb") - .arg("shell") - .arg(&dst) - .output() - .expect("failed to run: adb shell"); - assert!(status.success()); - - println!("status: {}\nstdout ---\n{}\nstderr ---\n{}", - output.status, - String::from_utf8_lossy(&output.stdout), - String::from_utf8_lossy(&output.stderr)); - - let stdout = String::from_utf8_lossy(&output.stdout); - stdout.lines().find(|l| - (l.starts_with("PASSED ") && l.contains(" tests")) || - l.starts_with("test result: ok") - ).unwrap_or_else(|| { - panic!("failed to find successful test run"); - }); -} diff --git a/ci/semver.sh b/ci/semver.sh deleted file mode 100644 index ac6be36f..00000000 --- a/ci/semver.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env sh - -# Checks that libc does not contain breaking changes for the following targets. - -set -ex - -OS=${TRAVIS_OS_NAME} - -echo "Testing Semver on ${OS}" - -TARGETS= -case "${OS}" in - *linux*) - TARGETS="\ -aarch64-fuchsia \ -aarch64-linux-android \ -aarch64-unknown-linux-gnu \ -aarch64-unknown-linux-musl \ -armv7-linux-androideabi \ -armv7-unknown-linux-gnueabihf \ -i586-unknown-linux-gnu \ -i586-unknown-linux-musl \ -i686-linux-android \ -i686-unknown-freebsd \ -i686-unknown-linux-gnu \ -i686-unknown-linux-musl \ -i686-pc-windows-gnu \ -x86_64-unknown-freebsd \ -x86_64-unknown-linux-gnu \ -x86_64-unknown-linux-musl \ -x86_64-unknown-netbsd \ -x86_64-unknown-cloudabi \ -x86_64-sun-solaris \ -x86_64-fuchsia \ -x86_64-pc-windows-gnu \ -x86_64-unknown-linux-gnux32 \ -x86_64-unknown-redox \ -x86_64-fortanix-unknown-sgx \ -wasm32-unknown-unknown \ -" - ;; - *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 \ -" - ;; -esac - -for TARGET in $TARGETS; do - # 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}" ; then - break - fi - n=$((n+1)) - sleep 1 - done - - cargo +nightly semver --api-guidelines --target="${TARGET}" -done diff --git a/ci/style.rs b/ci/style.rs deleted file mode 100644 index 481f57f7..00000000 --- a/ci/style.rs +++ /dev/null @@ -1,212 +0,0 @@ -//! Simple script to verify the coding style of this library -//! -//! ## How to run -//! -//! The first argument to this script is the directory to run on, so running -//! this script should be as simple as: -//! -//! ```notrust -//! rustc ci/style.rs -//! ./style src -//! ``` -//! -//! ## Guidelines -//! -//! The current style is: -//! -//! * No trailing whitespace -//! * No tabs -//! * 80-character lines -//! * `extern` instead of `extern "C"` -//! * Specific module layout: -//! 1. use directives -//! 2. typedefs -//! 3. structs -//! 4. constants -//! 5. f! { ... } functions -//! 6. extern functions -//! 7. modules + pub use -//! -//! Things not verified: -//! -//! * alignment -//! * 4-space tabs -//! * leading colons on paths - -use std::env; -use std::fs; -use std::io::prelude::*; -use std::path::Path; - -macro_rules! t { - ($e:expr) => (match $e { - Ok(e) => e, - Err(e) => panic!("{} failed with {}", stringify!($e), e), - }) -} - -fn main() { - let arg = env::args().skip(1).next().unwrap_or(".".to_string()); - - let mut errors = Errors { errs: false }; - walk(Path::new(&arg), &mut errors); - - if errors.errs { - panic!("found some lint errors"); - } else { - println!("good style!"); - } -} - -fn walk(path: &Path, err: &mut Errors) { - for entry in t!(path.read_dir()).map(|e| t!(e)) { - let path = entry.path(); - if t!(entry.file_type()).is_dir() { - walk(&path, err); - continue - } - - let name = entry.file_name().into_string().unwrap(); - match &name[..] { - n if !n.ends_with(".rs") => continue, - - "dox.rs" | - "lib.rs" | - "ctypes.rs" | - "libc.rs" | - "macros.rs" => continue, - - _ => {} - } - - let mut contents = String::new(); - t!(t!(fs::File::open(&path)).read_to_string(&mut contents)); - - check_style(&contents, &path, err); - } -} - -struct Errors { - errs: bool, -} - -#[derive(Clone, Copy, PartialEq)] -enum State { - Start, - Imports, - Typedefs, - Structs, - Constants, - FunctionDefinitions, - Functions, - Modules, -} - -fn check_style(file: &str, path: &Path, err: &mut Errors) { - let mut state = State::Start; - let mut s_macros = 0; - let mut f_macros = 0; - let mut prev_blank = false; - - for (i, line) in file.lines().enumerate() { - if line == "" { - if prev_blank { - err.error(path, i, "double blank line"); - } - prev_blank = true; - } else { - prev_blank = false; - } - if line != line.trim_right() { - err.error(path, i, "trailing whitespace"); - } - if line.contains("\t") { - err.error(path, i, "tab character"); - } - if line.len() > 80 { - err.error(path, i, "line longer than 80 chars"); - } - if line.contains("extern \"C\"") { - err.error(path, i, "use `extern` instead of `extern \"C\""); - } - if line.contains("#[cfg(") && !line.contains(" if ") - && !(line.contains("target_endian") || - line.contains("target_arch")) - { - if state != State::Structs { - err.error(path, i, "use cfg_if! and submodules \ - instead of #[cfg]"); - } - } - - let line = line.trim_left(); - let is_pub = line.starts_with("pub "); - let line = if is_pub {&line[4..]} else {line}; - - let line_state = if line.starts_with("use ") { - if line.contains("c_void") { - continue; - } - if is_pub { - State::Modules - } else { - State::Imports - } - } else if line.starts_with("const ") { - State::Constants - } else if line.starts_with("type ") { - State::Typedefs - } else if line.starts_with("s! {") { - s_macros += 1; - State::Structs - } else if line.starts_with("f! {") { - f_macros += 1; - State::FunctionDefinitions - } else if line.starts_with("extern ") { - State::Functions - } else if line.starts_with("mod ") { - State::Modules - } else { - continue - }; - - if state as usize > line_state as usize { - err.error(path, i, &format!("{} found after {} when \ - it belongs before", - line_state.desc(), state.desc())); - } - - if f_macros == 2 { - f_macros += 1; - err.error(path, i, "multiple f! macros in one module"); - } - if s_macros == 2 { - s_macros += 1; - err.error(path, i, "multiple s! macros in one module"); - } - - state = line_state; - } -} - -impl State { - fn desc(&self) -> &str { - match *self { - State::Start => "start", - State::Imports => "import", - State::Typedefs => "typedef", - State::Structs => "struct", - State::Constants => "constant", - State::FunctionDefinitions => "function definition", - State::Functions => "extern function", - State::Modules => "module", - } - } -} - -impl Errors { - fn error(&mut self, path: &Path, line: usize, msg: &str) { - self.errs = true; - println!("{}:{} - {}", path.display(), line + 1, msg); - } -} diff --git a/ci/switch.json b/ci/switch.json deleted file mode 100644 index bc189487..00000000 --- a/ci/switch.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "family": "unix", - "env": "newlib", - "target-env": "newlib", - "target-family": "unix", - "target-c-int-width": "32", - "target-endian": "little", - "target-pointer-width": "64", - "os": "horizon", - "arch": "aarch64", - "panic-strategy": "unwind", - "abi-blacklist": [ - "stdcall", - "fastcall", - "vectorcall", - "thiscall", - "win64", - "sysv64" - ], - "dynamic-linking" : false, - "features": "+a53,+strict-align", - "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", - "executables": true, - "position-independent-executables" : true, - "linker-flavor": "gcc", - "llvm-target": "aarch64-unknown-none", - "has-elf-tls" : false, - "linker-is-gnu" : true, - "disable-redzone" : true, - "relocation-model" : "pic", - "max-atomic-width": 128, - "exe-suffix": ".elf", - "staticlib-suffix" : ".a", - "trap-unreachable" : true, - "emit-debug-gdb-scripts" : true, - "requires-uwtable" : true -}
\ No newline at end of file diff --git a/ci/test-runner-linux b/ci/test-runner-linux deleted file mode 100755 index cad31ec4..00000000 --- a/ci/test-runner-linux +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -set -e - -arch=$1 -prog=$2 - -cd /qemu/init -echo "#!/bin/sh\n/prog --color=never" > run_prog.sh -chmod +x run_prog.sh -cp -f $2 prog -find . | cpio --create --format='newc' --quiet | gzip > ../initrd.gz -cd .. - -timeout 30s qemu-system-$arch \ - -m 1024 \ - -nographic \ - -kernel kernel \ - -initrd initrd.gz \ - -append init=/run_prog.sh > output || true - -# remove kernel messages -tr -d '\r' < output | egrep -v '^\[' - -egrep "(PASSED)|(test result: ok)" output > /dev/null diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml deleted file mode 100644 index 8d2d9033..00000000 --- a/libc-test/Cargo.toml +++ /dev/null @@ -1,54 +0,0 @@ -[package] -name = "libc-test" -version = "0.1.0" -authors = ["Alex Crichton <alex@alexcrichton.com>"] -build = "build.rs" - -[dependencies.libc] -path = ".." -default-features = false - -[build-dependencies] -cc = "1.0" -ctest = "0.2" - -[features] -default = [ "std" ] -std = [ "libc/std" ] -align = [ "libc/align" ] -extra_traits = [ "libc/extra_traits" ] - -[[test]] -name = "main" -path = "test/main.rs" -harness = false - -[[test]] -name = "linux-fcntl" -path = "test/linux_fcntl.rs" -harness = false - -[[test]] -name = "linux-ipv6" -path = "test/linux_ipv6.rs" -harness = false - -[[test]] -name = "linux-elf" -path = "test/linux_elf.rs" -harness = false - -[[test]] -name = "linux-strerror_r" -path = "test/linux_strerror_r.rs" -harness = false - -[[test]] -name = "linux-termios" -path = "test/linux_termios.rs" -harness = false - -[[test]] -name = "cmsg" -path = "test/cmsg.rs" -harness = true diff --git a/libc-test/build.rs b/libc-test/build.rs deleted file mode 100644 index 06386f81..00000000 --- a/libc-test/build.rs +++ /dev/null @@ -1,2394 +0,0 @@ -#![deny(warnings)] - -extern crate cc; -extern crate ctest; - -use std::env; - -fn do_cc() { - let target = env::var("TARGET").unwrap(); - if cfg!(unix) && !target.contains("wasi") { - cc::Build::new().file("src/cmsg.c").compile("cmsg"); - } -} - -fn do_ctest() { - match &env::var("TARGET").unwrap() { - t if t.contains("android") => return test_android(t), - t if t.contains("apple") => return test_apple(t), - t if t.contains("cloudabi") => return test_cloudabi(t), - t if t.contains("dragonfly") => return test_dragonflybsd(t), - t if t.contains("emscripten") => return test_emscripten(t), - t if t.contains("freebsd") => return test_freebsd(t), - t if t.contains("linux") => return test_linux(t), - t if t.contains("netbsd") => return test_netbsd(t), - t if t.contains("openbsd") => return test_openbsd(t), - t if t.contains("redox") => return test_redox(t), - t if t.contains("solaris") => return test_solaris(t), - t if t.contains("wasi") => return test_wasi(t), - t if t.contains("windows") => return test_windows(t), - t => panic!("unknown target {}", t), - } -} - -fn main() { - do_cc(); - do_ctest(); -} - -macro_rules! headers { - ($cfg:ident: [$m:expr]: $header:literal) => { - if $m { - $cfg.header($header); - } - }; - ($cfg:ident: $header:literal) => { - $cfg.header($header); - }; - ($($cfg:ident: $([$c:expr]:)* $header:literal,)*) => { - $(headers!($cfg: $([$c]:)* $header);)* - }; - ($cfg:ident: $( $([$c:expr]:)* $header:literal,)*) => { - headers!($($cfg: $([$c]:)* $header,)*); - }; - ($cfg:ident: $( $([$c:expr]:)* $header:literal),*) => { - headers!($($cfg: $([$c]:)* $header,)*); - }; -} - -fn test_apple(target: &str) { - assert!(target.contains("apple")); - let x86_64 = target.contains("x86_64"); - - let mut cfg = ctest::TestGenerator::new(); - cfg.flag("-Wno-deprecated-declarations"); - cfg.define("__APPLE_USE_RFC_3542", None); - - headers! { cfg: - "aio.h", - "ctype.h", - "dirent.h", - "dlfcn.h", - "errno.h", - "execinfo.h", - "fcntl.h", - "glob.h", - "grp.h", - "ifaddrs.h", - "langinfo.h", - "limits.h", - "locale.h", - "mach-o/dyld.h", - "mach/mach_time.h", - "malloc/malloc.h", - "net/bpf.h", - "net/if.h", - "net/if_arp.h", - "net/if_dl.h", - "net/if_utun.h", - "net/route.h", - "net/route.h", - "netdb.h", - "netinet/if_ether.h", - "netinet/in.h", - "netinet/in.h", - "netinet/ip.h", - "netinet/tcp.h", - "netinet/udp.h", - "poll.h", - "pthread.h", - "pwd.h", - "resolv.h", - "sched.h", - "semaphore.h", - "signal.h", - "spawn.h", - "stddef.h", - "stdint.h", - "stdio.h", - "stdlib.h", - "string.h", - "sys/event.h", - "sys/file.h", - "sys/ioctl.h", - "sys/ipc.h", - "sys/kern_control.h", - "sys/mman.h", - "sys/mount.h", - "sys/proc_info.h", - "sys/ptrace.h", - "sys/quota.h", - "sys/resource.h", - "sys/sem.h", - "sys/shm.h", - "sys/socket.h", - "sys/stat.h", - "sys/statvfs.h", - "sys/sys_domain.h", - "sys/sysctl.h", - "sys/time.h", - "sys/times.h", - "sys/types.h", - "sys/uio.h", - "sys/un.h", - "sys/utsname.h", - "sys/wait.h", - "sys/xattr.h", - "syslog.h", - "termios.h", - "time.h", - "unistd.h", - "util.h", - "utime.h", - "utmpx.h", - "wchar.h", - "xlocale.h", - [x86_64]: "crt_externs.h", - } - - cfg.skip_struct(move |ty| { - match ty { - // FIXME: actually a union - "sigval" => true, - - _ => false, - } - }); - - cfg.skip_const(move |name| { - match name { - // These OSX constants are removed in Sierra. - // https://developer.apple.com/library/content/releasenotes/General/APIDiffsMacOS10_12/Swift/Darwin.html - "KERN_KDENABLE_BG_TRACE" | "KERN_KDDISABLE_BG_TRACE" => true, - _ => false, - } - }); - - cfg.skip_fn(move |name| { - // skip those that are manually verified - match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" => true, - - // close calls the close_nocancel system call - "close" => true, - - _ => false, - } - }); - - cfg.skip_field_type(move |struct_, field| { - match (struct_, field) { - // FIXME: actually a union - ("sigevent", "sigev_value") => true, - _ => false, - } - }); - - cfg.volatile_item(|i| { - use ctest::VolatileItemKind::*; - match i { - StructField(ref n, ref f) if n == "aiocb" && f == "aio_buf" => { - true - } - _ => false, - } - }); - - cfg.type_name(move |ty, is_struct, is_union| { - match ty { - // Just pass all these through, no need for a "struct" prefix - "FILE" | "DIR" | "Dl_info" => ty.to_string(), - - // OSX calls this something else - "sighandler_t" => "sig_t".to_string(), - - t if is_union => format!("union {}", t), - t if t.ends_with("_t") => t.to_string(), - t if is_struct => format!("struct {}", t), - t => t.to_string(), - } - }); - - cfg.field_name(move |struct_, field| { - match field { - s if s.ends_with("_nsec") && struct_.starts_with("stat") => { - s.replace("e_nsec", "espec.tv_nsec") - } - // FIXME: sigaction actually contains a union with two variants: - // a sa_sigaction with type: (*)(int, struct __siginfo *, void *) - // a sa_handler with type sig_t - "sa_sigaction" if struct_ == "sigaction" => { - "sa_handler".to_string() - } - s => s.to_string(), - } - }); - - cfg.generate("../src/lib.rs", "main.rs"); -} - -fn test_openbsd(target: &str) { - assert!(target.contains("openbsd")); - - let mut cfg = ctest::TestGenerator::new(); - cfg.flag("-Wno-deprecated-declarations"); - - headers! { cfg: - "errno.h", - "fcntl.h", - "limits.h", - "locale.h", - "stddef.h", - "stdint.h", - "stdio.h", - "stdlib.h", - "sys/stat.h", - "sys/types.h", - "time.h", - "wchar.h", - "ctype.h", - "dirent.h", - "sys/socket.h", - "net/if.h", - "net/route.h", - "net/if_arp.h", - "netdb.h", - "netinet/in.h", - "netinet/ip.h", - "netinet/tcp.h", - "netinet/udp.h", - "resolv.h", - "pthread.h", - "dlfcn.h", - "signal.h", - "string.h", - "sys/file.h", - "sys/ioctl.h", - "sys/mman.h", - "sys/resource.h", - "sys/socket.h", - "sys/time.h", - "sys/un.h", - "sys/wait.h", - "unistd.h", - "utime.h", - "pwd.h", - "grp.h", - "sys/utsname.h", - "sys/ptrace.h", - "sys/mount.h", - "sys/uio.h", - "sched.h", - "termios.h", - "poll.h", - "syslog.h", - "semaphore.h", - "sys/statvfs.h", - "sys/times.h", - "glob.h", - "ifaddrs.h", - "langinfo.h", - "sys/sysctl.h", - "utmp.h", - "sys/event.h", - "net/if_dl.h", - "util.h", - "ufs/ufs/quota.h", - "pthread_np.h", - "sys/syscall.h", - } - - cfg.skip_struct(move |ty| { - match ty { - // FIXME: actually a union - "sigval" => true, - - _ => false, - } - }); - - cfg.skip_const(move |name| { - match name { - // Removed in OpenBSD 6.0 - "KERN_USERMOUNT" | "KERN_ARND" => true, - _ => false, - } - }); - - cfg.skip_fn(move |name| { - match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" | "execvpe" => true, - - // Removed in OpenBSD 6.5 - // https://marc.info/?l=openbsd-cvs&m=154723400730318 - "mincore" => true, - - _ => false, - } - }); - - cfg.type_name(move |ty, is_struct, is_union| { - match ty { - // Just pass all these through, no need for a "struct" prefix - "FILE" | "DIR" | "Dl_info" => ty.to_string(), - - // OSX calls this something else - "sighandler_t" => "sig_t".to_string(), - - t if is_union => format!("union {}", t), - t if t.ends_with("_t") => t.to_string(), - t if is_struct => format!("struct {}", t), - t => t.to_string(), - } - }); - - cfg.field_name(move |struct_, field| match field { - "st_birthtime" if struct_.starts_with("stat") => { - "__st_birthtime".to_string() - } - "st_birthtime_nsec" if struct_.starts_with("stat") => { - "__st_birthtimensec".to_string() - } - s if s.ends_with("_nsec") && struct_.starts_with("stat") => { - s.replace("e_nsec", ".tv_nsec") - } - "sa_sigaction" if struct_ == "sigaction" => "sa_handler".to_string(), - s => s.to_string(), - }); - - cfg.skip_field_type(move |struct_, field| { - // type siginfo_t.si_addr changed from OpenBSD 6.0 to 6.1 - (struct_ == "siginfo_t" && field == "si_addr") - }); - - cfg.generate("../src/lib.rs", "main.rs"); -} - -fn test_windows(target: &str) { - assert!(target.contains("windows")); - let gnu = target.contains("gnu"); - - let mut cfg = ctest::TestGenerator::new(); - cfg.define("_WIN32_WINNT", Some("0x8000")); - - headers! { cfg: - "direct.h", - "errno.h", - "fcntl.h", - "io.h", - "limits.h", - "locale.h", - "process.h", - "signal.h", - "stddef.h", - "stdint.h", - "stdio.h", - "stdlib.h", - "sys/stat.h", - "sys/types.h", - "sys/utime.h", - "time.h", - "wchar.h", - [gnu]: "ws2tcpip.h", - [!gnu]: "Winsock2.h", - } - - cfg.type_name(move |ty, is_struct, is_union| { - match ty { - // Just pass all these through, no need for a "struct" prefix - "FILE" | "DIR" | "Dl_info" => ty.to_string(), - - // FIXME: these don't exist: - "time64_t" => "__time64_t".to_string(), - "ssize_t" => "SSIZE_T".to_string(), - - "sighandler_t" if !gnu => "_crt_signal_t".to_string(), - "sighandler_t" if gnu => "__p_sig_fn_t".to_string(), - - t if is_union => format!("union {}", t), - t if t.ends_with("_t") => t.to_string(), - - // Windows uppercase structs don't have `struct` in front: - t if is_struct => { - if ty.clone().chars().next().unwrap().is_uppercase() { - t.to_string() - } else if t == "stat" { - "struct __stat64".to_string() - } else if t == "utimbuf" { - "struct __utimbuf64".to_string() - } else { - // put `struct` in front of all structs: - format!("struct {}", t) - } - } - t => t.to_string(), - } - }); - - cfg.fn_cname(move |name, cname| cname.unwrap_or(name).to_string()); - - cfg.skip_type(move |name| match name { - "SSIZE_T" if !gnu => true, - "ssize_t" if !gnu => true, - _ => false, - }); - - cfg.skip_const(move |name| { - match name { - // FIXME: API error: - // SIG_ERR type is "void (*)(int)", not "int" - "SIG_ERR" => true, - _ => false, - } - }); - - // FIXME: All functions point to the wrong addresses? - cfg.skip_fn_ptrcheck(|_| true); - - cfg.skip_signededness(move |c| { - match c { - // windows-isms - n if n.starts_with("P") => true, - n if n.starts_with("H") => true, - n if n.starts_with("LP") => true, - "sighandler_t" if gnu => true, - _ => false, - } - }); - - cfg.skip_fn(move |name| { - match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" | "execvpe" => true, - - _ => false, - } - }); - - cfg.generate("../src/lib.rs", "main.rs"); -} - -fn test_redox(target: &str) { - assert!(target.contains("redox")); - - let mut cfg = ctest::TestGenerator::new(); - cfg.flag("-Wno-deprecated-declarations"); - - headers! { - cfg: - "ctype.h", - "dirent.h", - "dlfcn.h", - "errno.h", - "execinfo.h", - "fcntl.h", - "glob.h", - "grp.h", - "ifaddrs.h", - "langinfo.h", - "limits.h", - "locale.h", - "net/if.h", - "net/if_arp.h", - "net/route.h", - "netdb.h", - "netinet/in.h", - "netinet/ip.h", - "netinet/tcp.h", - "netinet/udp.h", - "poll.h", - "pthread.h", - "pwd.h", - "resolv.h", - "sched.h", - "semaphore.h", - "string.h", - "strings.h", - "sys/file.h", - "sys/ioctl.h", - "sys/mman.h", - "sys/mount.h", - "sys/ptrace.h", - "sys/quota.h", - "sys/resource.h", - "sys/socket.h", - "sys/stat.h", - "sys/statvfs.h", - "sys/sysctl.h", - "sys/time.h", - "sys/times.h", - "sys/types.h", - "sys/uio.h", - "sys/un.h", - "sys/utsname.h", - "sys/wait.h", - "syslog.h", - "termios.h", - "time.h", - "unistd.h", - "utime.h", - "utmpx.h", - "wchar.h", - } - - cfg.generate("../src/lib.rs", "main.rs"); -} - -fn test_cloudabi(target: &str) { - assert!(target.contains("cloudabi")); - - let mut cfg = ctest::TestGenerator::new(); - cfg.flag("-Wno-deprecated-declarations"); - - headers! { - cfg: - "execinfo.h", - "glob.h", - "ifaddrs.h", - "langinfo.h", - "sys/ptrace.h", - "sys/quota.h", - "sys/sysctl.h", - "utmpx.h", - "ctype.h", - "dirent.h", - "dlfcn.h", - "errno.h", - "fcntl.h", - "grp.h", - "limits.h", - "locale.h", - "net/if.h", - "net/if_arp.h", - "net/route.h", - "netdb.h", - "netinet/in.h", - "netinet/ip.h", - "netinet/tcp.h", - "netinet/udp.h", - "poll.h", - "pthread.h", - "pwd.h", - "resolv.h", - "sched.h", - "semaphore.h", - "signal.h", - "stddef.h", - "stdint.h", - "stdio.h", - "stdlib.h", - "string.h", - "strings.h", - "sys/file.h", - "sys/ioctl.h", - "sys/mman.h", - "sys/mount.h", - "sys/resource.h", - "sys/socket.h", - "sys/stat.h", - "sys/statvfs.h", - "sys/time.h", - "sys/times.h", - "sys/types.h", - "sys/uio.h", - "sys/un.h", - "sys/utsname.h", - "sys/wait.h", - "syslog.h", - "termios.h", - "time.h", - "unistd.h", - "utime.h", - "wchar.h", - } - - cfg.generate("../src/lib.rs", "main.rs"); -} - -fn test_solaris(target: &str) { - assert!(target.contains("solaris")); - - let mut cfg = ctest::TestGenerator::new(); - cfg.flag("-Wno-deprecated-declarations"); - - cfg.define("_XOPEN_SOURCE", Some("700")); - cfg.define("__EXTENSIONS__", None); - cfg.define("_LCONV_C99", None); - - headers! { - cfg: - "ctype.h", - "dirent.h", - "dlfcn.h", - "errno.h", - "execinfo.h", - "fcntl.h", - "glob.h", - "grp.h", - "ifaddrs.h", - "langinfo.h", - "limits.h", - "locale.h", - "net/if.h", - "net/if_arp.h", - "net/route.h", - "netdb.h", - "netinet/in.h", - "netinet/ip.h", - "netinet/tcp.h", - "netinet/udp.h", - "poll.h", - "port.h", - "pthread.h", - "pwd.h", - "resolv.h", - "sched.h", - "semaphore.h", - "signal.h", - "stddef.h", - "stdint.h", - "stdio.h", - "stdlib.h", - "string.h", - "sys/epoll.h", - "sys/file.h", - "sys/filio.h", - "sys/ioctl.h", - "sys/loadavg.h", - "sys/mman.h", - "sys/mount.h", - "sys/resource.h", - "sys/socket.h", - "sys/stat.h", - "sys/statvfs.h", - "sys/time.h", - "sys/times.h", - "sys/types.h", - "sys/uio.h", - "sys/un.h", - "sys/utsname.h", - "sys/wait.h", - "syslog.h", - "termios.h", - "time.h", - "ucontext.h", - "unistd.h", - "utime.h", - "utmpx.h", - "wchar.h", - } - - cfg.skip_const(move |name| match name { - "DT_FIFO" | "DT_CHR" | "DT_DIR" | "DT_BLK" | "DT_REG" | "DT_LNK" - | "DT_SOCK" | "USRQUOTA" | "GRPQUOTA" | "PRIO_MIN" | "PRIO_MAX" => { - true - } - - _ => false, - }); - - cfg.skip_fn(move |name| { - // skip those that are manually verified - match name { - // const-ness only added recently - "dladdr" => true, - - // Definition of those functions as changed since unified headers - // from NDK r14b These changes imply some API breaking changes but - // are still ABI compatible. We can wait for the next major release - // to be compliant with the new API. - // - // FIXME: unskip these for next major release - "setpriority" | "personality" => true, - - // signal is defined with sighandler_t, so ignore - "signal" => true, - - "cfmakeraw" | "cfsetspeed" => true, - - // FIXME: mincore is defined with caddr_t on Solaris. - "mincore" => true, - - _ => false, - } - }); - - cfg.generate("../src/lib.rs", "main.rs"); -} - -fn test_netbsd(target: &str) { - assert!(target.contains("netbsd")); - let rumprun = target.contains("rumprun"); - let mut cfg = ctest::TestGenerator::new(); - - cfg.flag("-Wno-deprecated-declarations"); - cfg.define("_NETBSD_SOURCE", Some("1")); - - headers! { - cfg: - "errno.h", - "fcntl.h", - "limits.h", - "locale.h", - "stddef.h", - "stdint.h", - "stdio.h", - "stdlib.h", - "sys/stat.h", - "sys/types.h", - "time.h", - "wchar.h", - "aio.h", - "ctype.h", - "dirent.h", - "dlfcn.h", - "glob.h", - "grp.h", - "ifaddrs.h", - "langinfo.h", - "net/if.h", - "net/if_arp.h", - "net/if_dl.h", - "net/route.h", - "netdb.h", - "netinet/in.h", - "netinet/ip.h", - "netinet/tcp.h", - "netinet/udp.h", - "poll.h", - "pthread.h", - "pwd.h", - "resolv.h", - "sched.h", - "semaphore.h", - "signal.h", - "string.h", - "sys/extattr.h", - "sys/file.h", - "sys/ioctl.h", - "sys/ioctl_compat.h", - "sys/mman.h", - "sys/mount.h", - "sys/ptrace.h", - "sys/resource.h", - "sys/socket.h", - "sys/statvfs.h", - "sys/sysctl.h", - "sys/time.h", - "sys/times.h", - "sys/uio.h", - "sys/un.h", - "sys/utsname.h", - "sys/wait.h", - "syslog.h", - "termios.h", - "ufs/ufs/quota.h", - "ufs/ufs/quota1.h", - "unistd.h", - "util.h", - "utime.h", - "mqueue.h", - "netinet/dccp.h", - "sys/event.h", - "sys/quota.h", - } - - cfg.type_name(move |ty, is_struct, is_union| { - match ty { - // Just pass all these through, no need for a "struct" prefix - "FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr" - | "Elf64_Phdr" | "Elf32_Shdr" | "Elf64_Shdr" | "Elf32_Sym" - | "Elf64_Sym" | "Elf32_Ehdr" | "Elf64_Ehdr" | "Elf32_Chdr" - | "Elf64_Chdr" => ty.to_string(), - - // OSX calls this something else - "sighandler_t" => "sig_t".to_string(), - - t if is_union => format!("union {}", t), - - t if t.ends_with("_t") => t.to_string(), - - // put `struct` in front of all structs:. - t if is_struct => format!("struct {}", t), - - t => t.to_string(), - } - }); - - cfg.field_name(move |struct_, field| { - match field { - // Our stat *_nsec fields normally don't actually exist but are part - // of a timeval struct - s if s.ends_with("_nsec") && struct_.starts_with("stat") => { - s.replace("e_nsec", ".tv_nsec") - } - "u64" if struct_ == "epoll_event" => "data.u64".to_string(), - s => s.to_string(), - } - }); - - cfg.skip_type(move |ty| { - match ty { - // FIXME: sighandler_t is crazy across platforms - "sighandler_t" => true, - _ => false, - } - }); - - cfg.skip_struct(move |ty| { - match ty { - // This is actually a union, not a struct - "sigval" => true, - // These are tested as part of the linux_fcntl tests since there are - // header conflicts when including them with all the other structs. - "termios2" => true, - _ => false, - } - }); - - cfg.skip_signededness(move |c| { - match c { - "LARGE_INTEGER" | "float" | "double" => true, - n if n.starts_with("pthread") => true, - // sem_t is a struct or pointer - "sem_t" => true, - _ => false, - } - }); - - cfg.skip_const(move |name| { - match name { - "SIG_DFL" | "SIG_ERR" | "SIG_IGN" => true, // sighandler_t weirdness - "SIGUNUSED" => true, // removed in glibc 2.26 - - // weird signed extension or something like that? - "MS_NOUSER" => true, - "MS_RMT_MASK" => true, // updated in glibc 2.22 and musl 1.1.13 - "BOTHER" => true, - - _ => false, - } - }); - - cfg.skip_fn(move |name| { - match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" => true, - - "getrlimit" | "getrlimit64" | // non-int in 1st arg - "setrlimit" | "setrlimit64" | // non-int in 1st arg - "prlimit" | "prlimit64" | // non-int in 2nd arg - - // These functions presumably exist on netbsd but don't look like - // they're implemented on rumprun yet, just let them slide for now. - // Some of them look like they have headers but then don't have - // corresponding actual definitions either... - "shm_open" | - "shm_unlink" | - "syscall" | - "mq_open" | - "mq_close" | - "mq_getattr" | - "mq_notify" | - "mq_receive" | - "mq_send" | - "mq_setattr" | - "mq_timedreceive" | - "mq_timedsend" | - "mq_unlink" | - "ptrace" | - "sigaltstack" if rumprun => true, - - _ => false, - } - }); - - cfg.skip_field_type(move |struct_, field| { - // This is a weird union, don't check the type. - (struct_ == "ifaddrs" && field == "ifa_ifu") || - // sighandler_t type is super weird - (struct_ == "sigaction" && field == "sa_sigaction") || - // sigval is actually a union, but we pretend it's a struct - (struct_ == "sigevent" && field == "sigev_value") || - // aio_buf is "volatile void*" and Rust doesn't understand volatile - (struct_ == "aiocb" && field == "aio_buf") - }); - - cfg.generate("../src/lib.rs", "main.rs"); -} - -fn test_dragonflybsd(target: &str) { - assert!(target.contains("dragonfly")); - let mut cfg = ctest::TestGenerator::new(); - cfg.flag("-Wno-deprecated-declarations"); - - headers! { - cfg: - "aio.h", - "ctype.h", - "dirent.h", - "dlfcn.h", - "errno.h", - "execinfo.h", - "fcntl.h", - "glob.h", - "grp.h", - "ifaddrs.h", - "langinfo.h", - "limits.h", - "locale.h", - "mqueue.h", - "net/if.h", - "net/if_arp.h", - "net/if_dl.h", - "net/route.h", - "netdb.h", - "netinet/in.h", - "netinet/ip.h", - "netinet/tcp.h", - "netinet/udp.h", - "poll.h", - "pthread.h", - "pthread_np.h", - "pwd.h", - "resolv.h", - "sched.h", - "semaphore.h", - "signal.h", - "stddef.h", - "stdint.h", - "stdio.h", - "stdlib.h", - "string.h", - "sys/event.h", - "sys/file.h", - "sys/ioctl.h", - "sys/mman.h", - "sys/mount.h", - "sys/ptrace.h", - "sys/resource.h", - "sys/rtprio.h", - "sys/socket.h", - "sys/stat.h", - "sys/statvfs.h", - "sys/sysctl.h", - "sys/time.h", - "sys/times.h", - "sys/types.h", - "sys/uio.h", - "sys/un.h", - "sys/utsname.h", - "sys/wait.h", - "syslog.h", - "termios.h", - "time.h", - "ufs/ufs/quota.h", - "unistd.h", - "util.h", - "utime.h", - "utmpx.h", - "wchar.h", - } - - cfg.type_name(move |ty, is_struct, is_union| { - match ty { - // Just pass all these through, no need for a "struct" prefix - "FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr" - | "Elf64_Phdr" | "Elf32_Shdr" | "Elf64_Shdr" | "Elf32_Sym" - | "Elf64_Sym" | "Elf32_Ehdr" | "Elf64_Ehdr" | "Elf32_Chdr" - | "Elf64_Chdr" => ty.to_string(), - - // FIXME: OSX calls this something else - "sighandler_t" => "sig_t".to_string(), - - t if is_union => format!("union {}", t), - - t if t.ends_with("_t") => t.to_string(), - - // put `struct` in front of all structs:. - t if is_struct => format!("struct {}", t), - - t => t.to_string(), - } - }); - - cfg.field_name(move |struct_, field| { - match field { - // Our stat *_nsec fields normally don't actually exist but are part - // of a timeval struct - s if s.ends_with("_nsec") && struct_.starts_with("stat") => { - s.replace("e_nsec", ".tv_nsec") - } - "u64" if struct_ == "epoll_event" => "data.u64".to_string(), - // Field is named `type` in C but that is a Rust keyword, - // so these fields are translated to `type_` in the bindings. - "type_" if struct_ == "rtprio" => "type".to_string(), - s => s.to_string(), - } - }); - - cfg.skip_type(move |ty| { - match ty { - // sighandler_t is crazy across platforms - "sighandler_t" => true, - - _ => false, - } - }); - - cfg.skip_struct(move |ty| { - match ty { - // This is actually a union, not a struct - "sigval" => true, - - // FIXME: These are tested as part of the linux_fcntl tests since - // there are header conflicts when including them with all the other - // structs. - "termios2" => true, - - _ => false, - } - }); - - cfg.skip_signededness(move |c| { - match c { - "LARGE_INTEGER" | "float" | "double" => true, - // uuid_t is a struct, not an integer. - "uuid_t" => true, - n if n.starts_with("pthread") => true, - // sem_t is a struct or pointer - "sem_t" => true, - // mqd_t is a pointer on DragonFly - "mqd_t" => true, - - _ => false, - } - }); - - cfg.skip_const(move |name| { - match name { - "SIG_DFL" | "SIG_ERR" | "SIG_IGN" => true, // sighandler_t weirdness - - // weird signed extension or something like that? - "MS_NOUSER" => true, - "MS_RMT_MASK" => true, // updated in glibc 2.22 and musl 1.1.13 - - // These are defined for Solaris 11, but the crate is tested on - // illumos, where they are currently not defined - "EADI" - | "PORT_SOURCE_POSTWAIT" - | "PORT_SOURCE_SIGNAL" - | "PTHREAD_STACK_MIN" => true, - - // These change all the time from release to release of linux - // distros, let's just not bother trying to verify them. They - // shouldn't be used in code anyway... - "AF_MAX" | "PF_MAX" => true, - - _ => false, - } - }); - - cfg.skip_fn(move |name| { - // skip those that are manually verified - match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" => true, - - "getrlimit" | "getrlimit64" | // non-int in 1st arg - "setrlimit" | "setrlimit64" | // non-int in 1st arg - "prlimit" | "prlimit64" // non-int in 2nd arg - => true, - - _ => false, - } - }); - - cfg.skip_field_type(move |struct_, field| { - // This is a weird union, don't check the type. - (struct_ == "ifaddrs" && field == "ifa_ifu") || - // sighandler_t type is super weird - (struct_ == "sigaction" && field == "sa_sigaction") || - // sigval is actually a union, but we pretend it's a struct - (struct_ == "sigevent" && field == "sigev_value") || - // aio_buf is "volatile void*" and Rust doesn't understand volatile - (struct_ == "aiocb" && field == "aio_buf") - }); - - cfg.skip_field(move |struct_, field| { - // this is actually a union on linux, so we can't represent it well and - // just insert some padding. - (struct_ == "siginfo_t" && field == "_pad") || - // sigev_notify_thread_id is actually part of a sigev_un union - (struct_ == "sigevent" && field == "sigev_notify_thread_id") - }); - - cfg.generate("../src/lib.rs", "main.rs"); -} - -fn test_wasi(target: &str) { - assert!(target.contains("wasi")); - - let mut cfg = ctest::TestGenerator::new(); - cfg.define("_GNU_SOURCE", None); - - headers! { cfg: - "ctype.h", - "dirent.h", - "errno.h", - "fcntl.h", - "limits.h", - "locale.h", - "malloc.h", - "poll.h", - "sched.h", - "stdbool.h", - "stddef.h", - "stdint.h", - "stdio.h", - "stdlib.h", - "string.h", - "sys/resource.h", - "sys/select.h", - "sys/socket.h", - "sys/stat.h", - "sys/times.h", - "sys/types.h", - "sys/uio.h", - "sys/utsname.h", - "time.h", - "unistd.h", - "wasi/core.h", - "wasi/libc.h", - "wasi/libc-find-relpath.h", - "wchar.h", - } - - cfg.type_name(move |ty, is_struct, is_union| match ty { - "FILE" | "fd_set" | "DIR" => ty.to_string(), - t if is_union => format!("union {}", t), - t if t.starts_with("__wasi") && t.ends_with("_u") => { - format!("union {}", t) - } - t if t.starts_with("__wasi") && is_struct => format!("struct {}", t), - t if t.ends_with("_t") => t.to_string(), - t if is_struct => format!("struct {}", t), - t => t.to_string(), - }); - - cfg.field_name(move |_struct, field| { - match field { - // deal with fields as rust keywords - "type_" => "type".to_string(), - s => s.to_string(), - } - }); - - // Looks like LLD doesn't merge duplicate imports, so if the Rust - // code imports from a module and the C code also imports from a - // module we end up with two imports of function pointers which - // import the same thing but have different function pointers - cfg.skip_fn_ptrcheck(|f| f.starts_with("__wasi")); - - // d_name is declared as a flexible array in WASI libc, so it - // doesn't support sizeof. - cfg.skip_field(|s, field| s == "dirent" && field == "d_name"); - - cfg.generate("../src/lib.rs", "main.rs"); -} - -fn test_android(target: &str) { - assert!(target.contains("android")); - let target_pointer_width = match target { - t if t.contains("aarch64") || t.contains("x86_64") => 64, - t if t.contains("i686") || t.contains("arm") => 32, - t => panic!("unsupported target: {}", t), - }; - let x86 = target.contains("i686") || target.contains("x86_64"); - - let mut cfg = ctest::TestGenerator::new(); - cfg.define("_GNU_SOURCE", None); - - headers! { cfg: - "arpa/inet.h", - "asm/mman.h", - "ctype.h", - "dirent.h", - "dlfcn.h", - "errno.h", - "fcntl.h", - "grp.h", - "ifaddrs.h", - "limits.h", - "linux/dccp.h", - "linux/futex.h", - "linux/fs.h", - "linux/genetlink.h", - "linux/if_alg.h", - "linux/if_ether.h", - "linux/if_tun.h", - "linux/magic.h", - "linux/memfd.h", - "linux/module.h", - "linux/net_tstamp.h", - "linux/netfilter/nf_tables.h", - "linux/netfilter_ipv4.h", - "linux/netfilter_ipv6.h", - "linux/netlink.h", - "linux/quota.h", - "linux/reboot.h", - "linux/seccomp.h", - "linux/sockios.h", - "locale.h", - "malloc.h", - "net/ethernet.h", - "net/if.h", - "net/if_arp.h", - "net/route.h", - "netdb.h", - "netinet/in.h", - "netinet/ip.h", - "netinet/tcp.h", - "netinet/udp.h", - "netpacket/packet.h", - "poll.h", - "pthread.h", - "pty.h", - "pwd.h", - "resolv.h", - "sched.h", - "semaphore.h", - "signal.h", - "stddef.h", - "stdint.h", - "stdio.h", - "stdlib.h", - "string.h", - "sys/epoll.h", - "sys/eventfd.h", - "sys/file.h", - "sys/fsuid.h", - "sys/inotify.h", - "sys/ioctl.h", - "sys/mman.h", - "sys/mount.h", - "sys/personality.h", - "sys/prctl.h", - "sys/ptrace.h", - "sys/random.h", - "sys/reboot.h", - "sys/resource.h", - "sys/sendfile.h", - "sys/signalfd.h", - "sys/socket.h", - "sys/stat.h", - "sys/statvfs.h", - "sys/swap.h", - "sys/syscall.h", - "sys/sysinfo.h", - "sys/time.h", - "sys/times.h", - "sys/types.h", - "sys/uio.h", - "sys/un.h", - "sys/utsname.h", - "sys/vfs.h", - "sys/xattr.h", - "sys/wait.h", - "syslog.h", - "termios.h", - "time.h", - "unistd.h", - "utime.h", - "utmp.h", - "wchar.h", - "xlocale.h", - // time64_t is not defined for 64-bit targets If included it will - // generate the error 'Your time_t is already 64-bit' - [target_pointer_width == 32]: "time64.h", - [x86]: "sys/reg.h", - } - - cfg.type_name(move |ty, is_struct, is_union| { - match ty { - // Just pass all these through, no need for a "struct" prefix - "FILE" | "fd_set" | "Dl_info" => ty.to_string(), - - t if is_union => format!("union {}", t), - - t if t.ends_with("_t") => t.to_string(), - - // sigval is a struct in Rust, but a union in C: - "sigval" => format!("union sigval"), - - // put `struct` in front of all structs:. - t if is_struct => format!("struct {}", t), - - t => t.to_string(), - } - }); - - cfg.field_name(move |struct_, field| { - match field { - // Our stat *_nsec fields normally don't actually exist but are part - // of a timeval struct - s if s.ends_with("_nsec") && struct_.starts_with("stat") => { - s.to_string() - } - // FIXME: appears that `epoll_event.data` is an union - "u64" if struct_ == "epoll_event" => "data.u64".to_string(), - s => s.to_string(), - } - }); - - cfg.skip_type(move |ty| { - match ty { - // FIXME: `sighandler_t` type is incorrect, see: - // https://github.com/rust-lang/libc/issues/1359 - "sighandler_t" => true, - _ => false, - } - }); - - cfg.skip_struct(move |ty| { - match ty { - // These are tested as part of the linux_fcntl tests since there are - // header conflicts when including them with all the other structs. - "termios2" => true, - - _ => false, - } - }); - - cfg.skip_const(move |name| { - match name { - // FIXME: deprecated: not available in any header - // See: https://github.com/rust-lang/libc/issues/1356 - "ENOATTR" => true, - - // FIXME: still necessary? - "SIG_DFL" | "SIG_ERR" | "SIG_IGN" => true, // sighandler_t weirdness - // FIXME: deprecated - removed in glibc 2.26 - "SIGUNUSED" => true, - - _ => false, - } - }); - - cfg.skip_fn(move |name| { - // skip those that are manually verified - match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true, - - // There are two versions of the sterror_r function, see - // - // https://linux.die.net/man/3/strerror_r - // - // An XSI-compliant version provided if: - // - // (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE - // - // and a GNU specific version provided if _GNU_SOURCE is defined. - // - // libc provides bindings for the XSI-compliant version, which is - // preferred for portable applications. - // - // We skip the test here since here _GNU_SOURCE is defined, and - // test the XSI version below. - "strerror_r" => true, - - _ => false, - } - }); - - cfg.skip_field_type(move |struct_, field| { - // This is a weird union, don't check the type. - (struct_ == "ifaddrs" && field == "ifa_ifu") || - // sigval is actually a union, but we pretend it's a struct - (struct_ == "sigevent" && field == "sigev_value") - }); - - cfg.skip_field(move |struct_, field| { - // this is actually a union on linux, so we can't represent it well and - // just insert some padding. - (struct_ == "siginfo_t" && field == "_pad") || - // FIXME: `sa_sigaction` has type `sighandler_t` but that type is - // incorrect, see: https://github.com/rust-lang/libc/issues/1359 - (struct_ == "sigaction" && field == "sa_sigaction") || - // sigev_notify_thread_id is actually part of a sigev_un union - (struct_ == "sigevent" && field == "sigev_notify_thread_id") || - // signalfd had SIGSYS fields added in Android 4.19, but CI does not have that version yet. - (struct_ == "signalfd_siginfo" && (field == "ssi_syscall" || - field == "ssi_call_addr" || - field == "ssi_arch")) - }); - - cfg.generate("../src/lib.rs", "main.rs"); - - test_linux_like_apis(target); -} - -fn test_freebsd(target: &str) { - assert!(target.contains("freebsd")); - let mut cfg = ctest::TestGenerator::new(); - - let freebsd_ver = which_freebsd(); - - if let Some(12) = freebsd_ver { - // If the host is FreeBSD 12, run FreeBSD 12 tests - cfg.cfg("freebsd12", None); - } - - // Required for `getline`: - cfg.define("_WITH_GETLINE", None); - // Required for making freebsd11_stat available in the headers - cfg.define("_WANT_FREEBSD11_STAT", None); - - headers! { cfg: - "aio.h", - "arpa/inet.h", - "ctype.h", - "dirent.h", - "dlfcn.h", - "errno.h", - "fcntl.h", - "glob.h", - "grp.h", - "ifaddrs.h", - "langinfo.h", - "libutil.h", - "limits.h", - "locale.h", - "mqueue.h", - "net/bpf.h", - "net/if.h", - "net/if_arp.h", - "net/if_dl.h", - "net/route.h", - "netdb.h", - "netinet/ip.h", - "netinet/in.h", - "netinet/tcp.h", - "netinet/udp.h", - "poll.h", - "pthread.h", - "pthread_np.h", - "pwd.h", - "resolv.h", - "sched.h", - "semaphore.h", - "signal.h", - "spawn.h", - "stddef.h", - "stdint.h", - "stdio.h", - "stdlib.h", - "string.h", - "sys/event.h", - "sys/extattr.h", - "sys/file.h", - "sys/ioctl.h", - "sys/ipc.h", - "sys/jail.h", - "sys/mman.h", - "sys/mount.h", - "sys/msg.h", - "sys/procdesc.h", - "sys/ptrace.h", - "sys/resource.h", - "sys/rtprio.h", - "sys/shm.h", - "sys/socket.h", - "sys/stat.h", - "sys/statvfs.h", - "sys/sysctl.h", - "sys/time.h", - "sys/times.h", - "sys/types.h", - "sys/uio.h", - "sys/un.h", - "sys/utsname.h", - "sys/wait.h", - "syslog.h", - "termios.h", - "time.h", - "ufs/ufs/quota.h", - "unistd.h", - "utime.h", - "utmpx.h", - "wchar.h", - } - - cfg.type_name(move |ty, is_struct, is_union| { - match ty { - // Just pass all these through, no need for a "struct" prefix - "FILE" | "fd_set" | "Dl_info" | "DIR" => ty.to_string(), - - // FIXME: https://github.com/rust-lang/libc/issues/1273 - "sighandler_t" => "sig_t".to_string(), - - t if is_union => format!("union {}", t), - - t if t.ends_with("_t") => t.to_string(), - - // sigval is a struct in Rust, but a union in C: - "sigval" => format!("union sigval"), - - // put `struct` in front of all structs:. - t if is_struct => format!("struct {}", t), - - t => t.to_string(), - } - }); - - cfg.field_name(move |struct_, field| { - match field { - // Our stat *_nsec fields normally don't actually exist but are part - // of a timeval struct - s if s.ends_with("_nsec") && struct_.starts_with("stat") => { - s.replace("e_nsec", ".tv_nsec") - } - // Field is named `type` in C but that is a Rust keyword, - // so these fields are translated to `type_` in the bindings. - "type_" if struct_ == "rtprio" => "type".to_string(), - s => s.to_string(), - } - }); - - cfg.skip_const(move |name| { - match name { - // These constants were introduced in FreeBSD 12: - "SF_USER_READAHEAD" - | "EVFILT_EMPTY" - | "SO_REUSEPORT_LB" - | "IP_ORIGDSTADDR" - | "IP_RECVORIGDSTADDR" - | "IPV6_ORIGDSTADDR" - | "IPV6_RECVORIGDSTADDR" - if Some(12) != freebsd_ver => - { - true - } - - // FIXME: There are deprecated - remove in a couple of releases. - // These constants were removed in FreeBSD 11 (svn r273250) but will - // still be accepted and ignored at runtime. - "MAP_RENAME" | "MAP_NORESERVE" if Some(10) != freebsd_ver => true, - - // FIXME: There are deprecated - remove in a couple of releases. - // These constants were removed in FreeBSD 11 (svn r262489), - // and they've never had any legitimate use outside of the - // base system anyway. - "CTL_MAXID" | "KERN_MAXID" | "HW_MAXID" | "NET_MAXID" - | "USER_MAXID" => true, - - _ => false, - } - }); - - cfg.skip_fn(move |name| { - // skip those that are manually verified - match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true, - - // The `uname` function in the `utsname.h` FreeBSD header is a C - // inline function (has no symbol) that calls the `__xuname` symbol. - // Therefore the function pointer comparison does not make sense for it. - "uname" => true, - - // FIXME: Our API is unsound. The Rust API allows aliasing - // pointers, but the C API requires pointers not to alias. - // We should probably be at least using `&`/`&mut` here, see: - // https://github.com/gnzlbg/ctest/issues/68 - "lio_listio" => true, - - _ => false, - } - }); - - cfg.volatile_item(|i| { - use ctest::VolatileItemKind::*; - match i { - // aio_buf is a volatile void** but since we cannot express that in - // Rust types, we have to explicitly tell the checker about it here: - StructField(ref n, ref f) if n == "aiocb" && f == "aio_buf" => { - true - } - _ => false, - } - }); - - cfg.skip_field(move |struct_, field| { - // FIXME: `sa_sigaction` has type `sighandler_t` but that type is - // incorrect, see: https://github.com/rust-lang/libc/issues/1359 - (struct_ == "sigaction" && field == "sa_sigaction") - }); - - cfg.generate("../src/lib.rs", "main.rs"); -} - -fn test_emscripten(target: &str) { - assert!(target.contains("emscripten")); - - let mut cfg = ctest::TestGenerator::new(); - cfg.define("_GNU_SOURCE", None); // FIXME: ?? - - headers! { cfg: - "aio.h", - "ctype.h", - "dirent.h", - "dlfcn.h", - "errno.h", - "fcntl.h", - "glob.h", - "grp.h", - "ifaddrs.h", - "langinfo.h", - "limits.h", - "locale.h", - "malloc.h", - "mntent.h", - "mqueue.h", - "net/ethernet.h", - "net/if.h", - "net/if_arp.h", - "net/route.h", - "netdb.h", - "netinet/in.h", - "netinet/ip.h", - "netinet/tcp.h", - "netinet/udp.h", - "netpacket/packet.h", - "poll.h", - "pthread.h", - "pty.h", - "pwd.h", - "resolv.h", - "sched.h", - "sched.h", - "semaphore.h", - "shadow.h", - "signal.h", - "stddef.h", - "stdint.h", - "stdio.h", - "stdlib.h", - "string.h", - "sys/epoll.h", - "sys/eventfd.h", - "sys/file.h", - "sys/ioctl.h", - "sys/ipc.h", - "sys/mman.h", - "sys/mount.h", - "sys/msg.h", - "sys/personality.h", - "sys/prctl.h", - "sys/ptrace.h", - "sys/quota.h", - "sys/reboot.h", - "sys/resource.h", - "sys/sem.h", - "sys/sendfile.h", - "sys/shm.h", - "sys/signalfd.h", - "sys/socket.h", - "sys/stat.h", - "sys/statvfs.h", - "sys/swap.h", - "sys/syscall.h", - "sys/sysctl.h", - "sys/sysinfo.h", - "sys/time.h", - "sys/timerfd.h", - "sys/times.h", - "sys/types.h", - "sys/uio.h", - "sys/un.h", - "sys/user.h", - "sys/utsname.h", - "sys/vfs.h", - "sys/wait.h", - "sys/xattr.h", - "syslog.h", - "termios.h", - "time.h", - "ucontext.h", - "unistd.h", - "utime.h", - "utmp.h", - "utmpx.h", - "wchar.h", - } - - cfg.type_name(move |ty, is_struct, is_union| { - match ty { - // Just pass all these through, no need for a "struct" prefix - "FILE" | "fd_set" | "Dl_info" | "DIR" => ty.to_string(), - - t if is_union => format!("union {}", t), - - t if t.ends_with("_t") => t.to_string(), - - // put `struct` in front of all structs:. - t if is_struct => format!("struct {}", t), - - t => t.to_string(), - } - }); - - cfg.field_name(move |struct_, field| { - match field { - // Our stat *_nsec fields normally don't actually exist but are part - // of a timeval struct - s if s.ends_with("_nsec") && struct_.starts_with("stat") => { - s.replace("e_nsec", ".tv_nsec") - } - // FIXME: appears that `epoll_event.data` is an union - "u64" if struct_ == "epoll_event" => "data.u64".to_string(), - s => s.to_string(), - } - }); - - cfg.skip_type(move |ty| { - match ty { - // sighandler_t is crazy across platforms - // FIXME: is this necessary? - "sighandler_t" => true, - - _ => false, - } - }); - - cfg.skip_struct(move |ty| { - match ty { - // This is actually a union, not a struct - // FIXME: is this necessary? - "sigval" => true, - - _ => false, - } - }); - - cfg.skip_fn(move |name| { - match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true, - - _ => false, - } - }); - - cfg.skip_const(move |name| { - match name { - // FIXME: deprecated - SIGNUNUSED was removed in glibc 2.26 - // users should use SIGSYS instead - "SIGUNUSED" => true, - - // FIXME: emscripten uses different constants to constructs these - n if n.contains("__SIZEOF_PTHREAD") => true, - - _ => false, - } - }); - - cfg.skip_field_type(move |struct_, field| { - // This is a weird union, don't check the type. - // FIXME: is this necessary? - (struct_ == "ifaddrs" && field == "ifa_ifu") || - // sighandler_t type is super weird - // FIXME: is this necessary? - (struct_ == "sigaction" && field == "sa_sigaction") || - // sigval is actually a union, but we pretend it's a struct - // FIXME: is this necessary? - (struct_ == "sigevent" && field == "sigev_value") || - // aio_buf is "volatile void*" and Rust doesn't understand volatile - // FIXME: is this necessary? - (struct_ == "aiocb" && field == "aio_buf") - }); - - cfg.skip_field(move |struct_, field| { - // this is actually a union on linux, so we can't represent it well and - // just insert some padding. - // FIXME: is this necessary? - (struct_ == "siginfo_t" && field == "_pad") || - // musl names this __dummy1 but it's still there - // FIXME: is this necessary? - (struct_ == "glob_t" && field == "gl_flags") || - // musl seems to define this as an *anonymous* bitfield - // FIXME: is this necessary? - (struct_ == "statvfs" && field == "__f_unused") || - // sigev_notify_thread_id is actually part of a sigev_un union - (struct_ == "sigevent" && field == "sigev_notify_thread_id") || - // signalfd had SIGSYS fields added in Linux 4.18, but no libc release has them yet. - (struct_ == "signalfd_siginfo" && (field == "ssi_addr_lsb" || - field == "_pad2" || - field == "ssi_syscall" || - field == "ssi_call_addr" || - field == "ssi_arch")) - }); - - // FIXME: test linux like - cfg.generate("../src/lib.rs", "main.rs"); -} - -fn test_linux(target: &str) { - assert!(target.contains("linux")); - - // target_env - let gnu = target.contains("gnu"); - let musl = target.contains("musl"); - let uclibc = target.contains("uclibc"); - - match (gnu, musl, uclibc) { - (true, false, false) => (), - (false, true, false) => (), - (false, false, true) => (), - (_, _, _) => panic!( - "linux target lib is gnu: {}, musl: {}, uclibc: {}", - gnu, musl, uclibc - ), - } - - let arm = target.contains("arm"); - let x86_64 = target.contains("x86_64"); - let x86_32 = target.contains("i686"); - let x32 = target.contains("x32"); - let mips = target.contains("mips"); - let mips32_musl = mips && !target.contains("64") && musl; - let sparc64 = target.contains("sparc64"); - - let mut cfg = ctest::TestGenerator::new(); - cfg.define("_GNU_SOURCE", None); - // This macro re-deifnes fscanf,scanf,sscanf to link to the symbols that are - // deprecated since glibc >= 2.29. This allows Rust binaries to link against - // glibc versions older than 2.29. - cfg.define("__GLIBC_USE_DEPRECATED_SCANF", None); - - headers! { cfg: - "ctype.h", - "dirent.h", - "dlfcn.h", - "elf.h", - "fcntl.h", - "glob.h", - "grp.h", - "ifaddrs.h", - "langinfo.h", - "limits.h", - "link.h", - "locale.h", - "malloc.h", - "mntent.h", - "mqueue.h", - "net/ethernet.h", - "net/if.h", - "net/if_arp.h", - "net/route.h", - "netdb.h", - "netinet/in.h", - "netinet/ip.h", - "netinet/tcp.h", - "netinet/udp.h", - "netpacket/packet.h", - "poll.h", - "pthread.h", - "pty.h", - "pwd.h", - "resolv.h", - "sched.h", - "semaphore.h", - "shadow.h", - "signal.h", - "spawn.h", - "stddef.h", - "stdint.h", - "stdio.h", - "stdlib.h", - "string.h", - "sys/epoll.h", - "sys/eventfd.h", - "sys/file.h", - "sys/fsuid.h", - "sys/inotify.h", - "sys/ioctl.h", - "sys/ipc.h", - "sys/mman.h", - "sys/mount.h", - "sys/msg.h", - "sys/personality.h", - "sys/prctl.h", - "sys/ptrace.h", - "sys/quota.h", - // FIXME: the mips-musl CI build jobs use ancient musl 1.0.15: - [!mips32_musl]: "sys/random.h", - "sys/reboot.h", - "sys/resource.h", - "sys/sem.h", - "sys/sendfile.h", - "sys/shm.h", - "sys/signalfd.h", - "sys/socket.h", - "sys/stat.h", - "sys/statvfs.h", - "sys/swap.h", - "sys/syscall.h", - "sys/time.h", - "sys/timerfd.h", - "sys/times.h", - "sys/types.h", - "sys/uio.h", - "sys/un.h", - "sys/user.h", - "sys/utsname.h", - "sys/vfs.h", - "sys/wait.h", - "syslog.h", - "termios.h", - "time.h", - "ucontext.h", - "unistd.h", - "utime.h", - "utmp.h", - "utmpx.h", - "wchar.h", - "errno.h", - // `sys/io.h` is only available on x86*, Alpha, IA64, and 32-bit - // ARM: https://bugzilla.redhat.com/show_bug.cgi?id=1116162 - [x86_64 || x86_32 || arm]: "sys/io.h", - // `sys/reg.h` is only available on x86 and x86_64 - [x86_64 || x86_32]: "sys/reg.h", - // sysctl system call is deprecated and not available on musl - // It is also unsupported in x32: - [!(x32 || musl)]: "sys/sysctl.h", - // <execinfo.h> is not supported by musl: - // https://www.openwall.com/lists/musl/2015/04/09/3 - [!musl]: "execinfo.h", - } - - // Include linux headers at the end: - headers! { - cfg: - "asm/mman.h", - "linux/dccp.h", - "linux/falloc.h", - "linux/fs.h", - "linux/futex.h", - "linux/genetlink.h", - // FIXME: musl version 1.0.15 used by mips build jobs is ancient - [!mips32_musl]: "linux/if.h", - "linux/if_addr.h", - "linux/if_alg.h", - "linux/if_ether.h", - "linux/if_tun.h", - "linux/input.h", - "linux/magic.h", - "linux/memfd.h", - "linux/module.h", - "linux/net_tstamp.h", - "linux/netfilter/nf_tables.h", - "linux/netfilter_ipv4.h", - "linux/netfilter_ipv6.h", - "linux/netlink.h", - "linux/quota.h", - "linux/random.h", - "linux/reboot.h", - "linux/rtnetlink.h", - "linux/seccomp.h", - "linux/sockios.h", - "linux/vm_sockets.h", - "sys/auxv.h", - } - - // note: aio.h must be included before sys/mount.h - headers! { - cfg: - "sys/xattr.h", - "sys/sysinfo.h", - "aio.h", - } - - cfg.type_name(move |ty, is_struct, is_union| { - match ty { - // Just pass all these through, no need for a "struct" prefix - "FILE" | "fd_set" | "Dl_info" | "DIR" | "Elf32_Phdr" - | "Elf64_Phdr" | "Elf32_Shdr" | "Elf64_Shdr" | "Elf32_Sym" - | "Elf64_Sym" | "Elf32_Ehdr" | "Elf64_Ehdr" | "Elf32_Chdr" - | "Elf64_Chdr" => ty.to_string(), - - t if is_union => format!("union {}", t), - - t if t.ends_with("_t") => t.to_string(), - - // put `struct` in front of all structs:. - t if is_struct => format!("struct {}", t), - - t => t.to_string(), - } - }); - - cfg.field_name(move |struct_, field| { - match field { - // Our stat *_nsec fields normally don't actually exist but are part - // of a timeval struct - s if s.ends_with("_nsec") && struct_.starts_with("stat") => { - s.replace("e_nsec", ".tv_nsec") - } - // FIXME: epoll_event.data is actuall a union in C, but in Rust - // it is only a u64 because we only expose one field - // http://man7.org/linux/man-pages/man2/epoll_wait.2.html - "u64" if struct_ == "epoll_event" => "data.u64".to_string(), - // The following structs have a field called `type` in C, - // but `type` is a Rust keyword, so these fields are translated - // to `type_` in Rust. - "type_" - if struct_ == "input_event" - || struct_ == "input_mask" - || struct_ == "ff_effect" => - { - "type".to_string() - } - - s => s.to_string(), - } - }); - - cfg.skip_type(move |ty| { - match ty { - // FIXME: `sighandler_t` type is incorrect, see: - // https://github.com/rust-lang/libc/issues/1359 - "sighandler_t" => true, - - // These cannot be tested when "resolv.h" is included and are tested - // in the `linux_elf.rs` file. - "Elf64_Phdr" | "Elf32_Phdr" => true, - - // This type is private on Linux. It is implemented as a C `enum` - // (`c_uint`) and this clashes with the type of the `rlimit` APIs - // which expect a `c_int` even though both are ABI compatible. - "__rlimit_resource_t" => true, - - _ => false, - } - }); - - cfg.skip_struct(move |ty| { - match ty { - // These cannot be tested when "resolv.h" is included and are tested - // in the `linux_elf.rs` file. - "Elf64_Phdr" | "Elf32_Phdr" => true, - - // On Linux, the type of `ut_tv` field of `struct utmpx` - // can be an anonymous struct, so an extra struct, - // which is absent in glibc, has to be defined. - "__timeval" => true, - - // FIXME: This is actually a union, not a struct - "sigval" => true, - - // This type is tested in the `linux_termios.rs` file since there - // are header conflicts when including them with all the other - // structs. - "termios2" => true, - - // FIXME: musl version using by mips build jobs 1.0.15 is ancient: - "ifmap" | "ifreq" | "ifconf" if mips32_musl => true, - - _ => false, - } - }); - - cfg.skip_const(move |name| { - match name { - // These constants are not available if gnu headers have been included - // and can therefore not be tested here - // - // The IPV6 constants are tested in the `linux_ipv6.rs` tests: - | "IPV6_FLOWINFO" - | "IPV6_FLOWLABEL_MGR" - | "IPV6_FLOWINFO_SEND" - | "IPV6_FLOWINFO_FLOWLABEL" - | "IPV6_FLOWINFO_PRIORITY" - // The F_ fnctl constants are tested in the `linux_fnctl.rs` tests: - | "F_CANCELLK" - | "F_ADD_SEALS" - | "F_GET_SEALS" - | "F_SEAL_SEAL" - | "F_SEAL_SHRINK" - | "F_SEAL_GROW" - | "F_SEAL_WRITE" => true, - - // The musl-sanitized kernel headers used in CI - // target the Linux kernel 4.4 and do not contain the - // following constants: - // - // Requires Linux kernel 4.9 - | "FALLOC_FL_UNSHARE_RANGE" - // - // Require Linux kernel 5.x: - | "MSG_COPY" - if musl => true, - // Require Linux kernel 5.1: - "F_SEAL_FUTURE_WRITE" => true, - - // The musl version 1.0.22 used in CI does not - // contain these glibc constants yet: - | "RLIMIT_RTTIME" // should be in `resource.h` - | "TCP_COOKIE_TRANSACTIONS" // should be in the `netinet/tcp.h` header - if musl => true, - - // FIXME: deprecated: not available in any header - // See: https://github.com/rust-lang/libc/issues/1356 - "ENOATTR" => true, - - // FIXME: SIGUNUSED was removed in glibc 2.26 - // Users should use SIGSYS instead. - "SIGUNUSED" => true, - - // FIXME: conflicts with glibc headers and is tested in - // `linux_termios.rs` below: - "BOTHER" => true, - - // FIXME: on musl the pthread types are defined a little differently - // - these constants are used by the glibc implementation. - n if musl && n.contains("__SIZEOF_PTHREAD") => true, - - // FIXME: musl version 1.0.15 used by mips build jobs is ancient - t if mips32_musl && t.starts_with("IFF") => true, - "MFD_HUGETLB" | "AF_XDP" | "PF_XDP" if mips32_musl => true, - - _ => false, - } - }); - - cfg.skip_fn(move |name| { - // skip those that are manually verified - match name { - // FIXME: https://github.com/rust-lang/libc/issues/1272 - "execv" | "execve" | "execvp" | "execvpe" | "fexecve" => true, - - // There are two versions of the sterror_r function, see - // - // https://linux.die.net/man/3/strerror_r - // - // An XSI-compliant version provided if: - // - // (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) - // && ! _GNU_SOURCE - // - // and a GNU specific version provided if _GNU_SOURCE is defined. - // - // libc provides bindings for the XSI-compliant version, which is - // preferred for portable applications. - // - // We skip the test here since here _GNU_SOURCE is defined, and - // test the XSI version below. - "strerror_r" => true, - - // FIXME: Our API is unsound. The Rust API allows aliasing - // pointers, but the C API requires pointers not to alias. - // We should probably be at least using `&`/`&mut` here, see: - // https://github.com/gnzlbg/ctest/issues/68 - "lio_listio" if musl => true, - - // FIXME: the glibc version used by the Sparc64 build jobs - // which use Debian 10.0 is too old. - "statx" if sparc64 => true, - - _ => false, - } - }); - - cfg.skip_field_type(move |struct_, field| { - // This is a weird union, don't check the type. - (struct_ == "ifaddrs" && field == "ifa_ifu") || - // sighandler_t type is super weird - (struct_ == "sigaction" && field == "sa_sigaction") || - // __timeval type is a patch which doesn't exist in glibc - (struct_ == "utmpx" && field == "ut_tv") || - // sigval is actually a union, but we pretend it's a struct - (struct_ == "sigevent" && field == "sigev_value") || - // this one is an anonymous union - (struct_ == "ff_effect" && field == "u") - }); - - cfg.volatile_item(|i| { - use ctest::VolatileItemKind::*; - match i { - // aio_buf is a volatile void** but since we cannot express that in - // Rust types, we have to explicitly tell the checker about it here: - StructField(ref n, ref f) if n == "aiocb" && f == "aio_buf" => { - true - } - _ => false, - } - }); - - cfg.skip_field(move |struct_, field| { - // this is actually a union on linux, so we can't represent it well and - // just insert some padding. - (struct_ == "siginfo_t" && field == "_pad") || - // musl names this __dummy1 but it's still there - (musl && struct_ == "glob_t" && field == "gl_flags") || - // musl seems to define this as an *anonymous* bitfield - (musl && struct_ == "statvfs" && field == "__f_unused") || - // sigev_notify_thread_id is actually part of a sigev_un union - (struct_ == "sigevent" && field == "sigev_notify_thread_id") || - // signalfd had SIGSYS fields added in Linux 4.18, but no libc release - // has them yet. - (struct_ == "signalfd_siginfo" && (field == "ssi_addr_lsb" || - field == "_pad2" || - field == "ssi_syscall" || - field == "ssi_call_addr" || - field == "ssi_arch")) - }); - - cfg.generate("../src/lib.rs", "main.rs"); - - test_linux_like_apis(target); -} - -// This function tests APIs that are incompatible to test when other APIs -// are included (e.g. because including both sets of headers clashes) -fn test_linux_like_apis(target: &str) { - let musl = target.contains("musl"); - let linux = target.contains("linux"); - let emscripten = target.contains("emscripten"); - let android = target.contains("android"); - assert!(linux || android || emscripten); - - if linux || android || emscripten { - // test strerror_r from the `string.h` header - let mut cfg = ctest::TestGenerator::new(); - cfg.skip_type(|_| true).skip_static(|_| true); - - headers! { cfg: "string.h" } - cfg.skip_fn(|f| match f { - "strerror_r" => false, - _ => true, - }) - .skip_const(|_| true) - .skip_struct(|_| true); - cfg.generate("../src/lib.rs", "linux_strerror_r.rs"); - } - - if linux || android || emscripten { - // test fcntl - see: - // http://man7.org/linux/man-pages/man2/fcntl.2.html - let mut cfg = ctest::TestGenerator::new(); - - if musl { - cfg.header("fcntl.h"); - } else { - cfg.header("linux/fcntl.h"); - } - - cfg.skip_type(|_| true) - .skip_static(|_| true) - .skip_struct(|_| true) - .skip_fn(|_| true) - .skip_const(move |name| match name { - // test fcntl constants: - "F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" - | "F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW" - | "F_SEAL_WRITE" => false, - _ => true, - }) - .type_name(move |ty, is_struct, is_union| match ty { - t if is_struct => format!("struct {}", t), - t if is_union => format!("union {}", t), - t => t.to_string(), - }); - - cfg.generate("../src/lib.rs", "linux_fcntl.rs"); - } - - if linux || android { - // test termios - let mut cfg = ctest::TestGenerator::new(); - cfg.header("asm/termbits.h"); - cfg.skip_type(|_| true) - .skip_static(|_| true) - .skip_fn(|_| true) - .skip_const(|c| c != "BOTHER") - .skip_struct(|s| s != "termios2") - .type_name(move |ty, is_struct, is_union| match ty { - t if is_struct => format!("struct {}", t), - t if is_union => format!("union {}", t), - t => t.to_string(), - }); - cfg.generate("../src/lib.rs", "linux_termios.rs"); - } - - if linux || android { - // test IPV6_ constants: - let mut cfg = ctest::TestGenerator::new(); - headers! { - cfg: - "linux/in6.h" - } - cfg.skip_type(|_| true) - .skip_static(|_| true) - .skip_fn(|_| true) - .skip_const(|_| true) - .skip_struct(|_| true) - .skip_const(move |name| match name { - "IPV6_FLOWINFO" - | "IPV6_FLOWLABEL_MGR" - | "IPV6_FLOWINFO_SEND" - | "IPV6_FLOWINFO_FLOWLABEL" - | "IPV6_FLOWINFO_PRIORITY" => false, - _ => true, - }) - .type_name(move |ty, is_struct, is_union| match ty { - t if is_struct => format!("struct {}", t), - t if is_union => format!("union {}", t), - t => t.to_string(), - }); - cfg.generate("../src/lib.rs", "linux_ipv6.rs"); - } - - if linux || android { - // Test Elf64_Phdr and Elf32_Phdr - // These types have a field called `p_type`, but including - // "resolve.h" defines a `p_type` macro that expands to `__p_type` - // making the tests for these fails when both are included. - let mut cfg = ctest::TestGenerator::new(); - cfg.header("elf.h"); - cfg.skip_fn(|_| true) - .skip_static(|_| true) - .skip_fn(|_| true) - .skip_const(|_| true) - .type_name(move |ty, _is_struct, _is_union| ty.to_string()) - .skip_struct(move |ty| match ty { - "Elf64_Phdr" | "Elf32_Phdr" => false, - _ => true, - }) - .skip_type(move |ty| match ty { - "Elf64_Phdr" | "Elf32_Phdr" => false, - _ => true, - }); - cfg.generate("../src/lib.rs", "linux_elf.rs"); - } -} - -fn which_freebsd() -> Option<i32> { - let output = std::process::Command::new("freebsd-version") - .output() - .ok()?; - if !output.status.success() { - return None; - } - - let stdout = String::from_utf8(output.stdout).ok()?; - - match &stdout { - s if s.starts_with("11") => Some(11), - s if s.starts_with("12") => Some(12), - _ => None, - } -} diff --git a/libc-test/src/cmsg.c b/libc-test/src/cmsg.c deleted file mode 100644 index a8b1c371..00000000 --- a/libc-test/src/cmsg.c +++ /dev/null @@ -1,28 +0,0 @@ -#include <sys/param.h> -#include <sys/socket.h> - -// Since the cmsg(3) macros are macros instead of functions, they aren't -// available to FFI. libc must reimplement them, which is error-prone. This -// file provides FFI access to the actual macros so they can be tested against -// the Rust reimplementations. - -struct cmsghdr *cmsg_firsthdr(struct msghdr *msgh) { - return CMSG_FIRSTHDR(msgh); -} - -struct cmsghdr *cmsg_nxthdr(struct msghdr *msgh, struct cmsghdr *cmsg) { - return CMSG_NXTHDR(msgh, cmsg); -} - -size_t cmsg_space(size_t length) { - return CMSG_SPACE(length); -} - -size_t cmsg_len(size_t length) { - return CMSG_LEN(length); -} - -unsigned char *cmsg_data(struct cmsghdr *cmsg) { - return CMSG_DATA(cmsg); -} - diff --git a/libc-test/test/cmsg.rs b/libc-test/test/cmsg.rs deleted file mode 100644 index 83041633..00000000 --- a/libc-test/test/cmsg.rs +++ /dev/null @@ -1,101 +0,0 @@ -//! Compare libc's CMSG(3) family of functions against the actual C macros, for -//! various inputs. - -extern crate libc; - -#[cfg(unix)] -mod t { - - use libc::{self, c_uchar, c_uint, c_void, cmsghdr, msghdr}; - use std::mem; - - extern "C" { - pub fn cmsg_firsthdr(msgh: *const msghdr) -> *mut cmsghdr; - pub fn cmsg_nxthdr( - mhdr: *const msghdr, - cmsg: *const cmsghdr, - ) -> *mut cmsghdr; - pub fn cmsg_space(length: c_uint) -> usize; - pub fn cmsg_len(length: c_uint) -> usize; - pub fn cmsg_data(cmsg: *const cmsghdr) -> *mut c_uchar; - } - - #[test] - fn test_cmsg_data() { - for l in 0..128 { - let pcmsghdr = l as *const cmsghdr; - unsafe { - assert_eq!(libc::CMSG_DATA(pcmsghdr), cmsg_data(pcmsghdr)); - } - } - } - - #[test] - fn test_cmsg_firsthdr() { - let mut mhdr: msghdr = unsafe { mem::zeroed() }; - mhdr.msg_control = 0xdeadbeef as *mut c_void; - let pmhdr = &mhdr as *const msghdr; - for l in 0..128 { - mhdr.msg_controllen = l; - unsafe { - assert_eq!(libc::CMSG_FIRSTHDR(pmhdr), cmsg_firsthdr(pmhdr)); - } - } - } - - #[test] - fn test_cmsg_len() { - for l in 0..128 { - unsafe { - assert_eq!(libc::CMSG_LEN(l) as usize, cmsg_len(l)); - } - } - } - - // Skip on sparc64 - // https://github.com/rust-lang/libc/issues/1239 - #[cfg(not(target_arch = "sparc64"))] - #[test] - fn test_cmsg_nxthdr() { - use std::ptr; - - let mut buffer = [0u8; 256]; - let mut mhdr: msghdr = unsafe { mem::zeroed() }; - let pmhdr = &mhdr as *const msghdr; - for start_ofs in 0..64 { - let pcmsghdr = &mut buffer[start_ofs] as *mut u8 as *mut cmsghdr; - mhdr.msg_control = pcmsghdr as *mut c_void; - mhdr.msg_controllen = (160 - start_ofs) as _; - for cmsg_len in 0..64 { - for next_cmsg_len in 0..32 { - for i in buffer[start_ofs..].iter_mut() { - *i = 0; - } - unsafe { - (*pcmsghdr).cmsg_len = cmsg_len; - let libc_next = libc::CMSG_NXTHDR(pmhdr, pcmsghdr); - let next = cmsg_nxthdr(pmhdr, pcmsghdr); - assert_eq!(libc_next, next); - - if libc_next != ptr::null_mut() { - (*libc_next).cmsg_len = next_cmsg_len; - let libc_next = libc::CMSG_NXTHDR(pmhdr, pcmsghdr); - let next = cmsg_nxthdr(pmhdr, pcmsghdr); - assert_eq!(libc_next, next); - } - } - } - } - } - } - - #[test] - fn test_cmsg_space() { - unsafe { - for l in 0..128 { - assert_eq!(libc::CMSG_SPACE(l) as usize, cmsg_space(l)); - } - } - } - -} diff --git a/libc-test/test/linux_elf.rs b/libc-test/test/linux_elf.rs deleted file mode 100644 index d149c9aa..00000000 --- a/libc-test/test/linux_elf.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![allow(bad_style, improper_ctypes, unused, deprecated)] - -extern crate libc; -use libc::*; - -#[cfg(target_os = "linux")] -include!(concat!(env!("OUT_DIR"), "/linux_elf.rs")); - -#[cfg(not(target_os = "linux"))] -fn main() { - println!("PASSED 0 tests"); -} diff --git a/libc-test/test/linux_fcntl.rs b/libc-test/test/linux_fcntl.rs deleted file mode 100644 index 49c06cc4..00000000 --- a/libc-test/test/linux_fcntl.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![allow(bad_style, improper_ctypes, unused, deprecated)] - -extern crate libc; -use libc::*; - -#[cfg(any(target_os = "linux", target_os = "android"))] -include!(concat!(env!("OUT_DIR"), "/linux_fcntl.rs")); - -#[cfg(not(any(target_os = "linux", target_os = "android")))] -fn main() { - println!("PASSED 0 tests"); -} diff --git a/libc-test/test/linux_ipv6.rs b/libc-test/test/linux_ipv6.rs deleted file mode 100644 index 83c389ce..00000000 --- a/libc-test/test/linux_ipv6.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![allow(bad_style, improper_ctypes, unused, deprecated)] - -extern crate libc; -use libc::*; - -#[cfg(target_os = "linux")] -include!(concat!(env!("OUT_DIR"), "/linux_ipv6.rs")); - -#[cfg(not(target_os = "linux"))] -fn main() { - println!("PASSED 0 tests"); -} diff --git a/libc-test/test/linux_strerror_r.rs b/libc-test/test/linux_strerror_r.rs deleted file mode 100644 index 17db959d..00000000 --- a/libc-test/test/linux_strerror_r.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![allow(bad_style, improper_ctypes, unused, deprecated)] - -extern crate libc; -use libc::*; - -#[cfg(any(target_os = "linux", target_os = "android"))] -include!(concat!(env!("OUT_DIR"), "/linux_strerror_r.rs")); - -#[cfg(not(any(target_os = "linux", target_os = "android")))] -fn main() { - println!("PASSED 0 tests"); -} diff --git a/libc-test/test/linux_termios.rs b/libc-test/test/linux_termios.rs deleted file mode 100644 index 703a9b9b..00000000 --- a/libc-test/test/linux_termios.rs +++ /dev/null @@ -1,12 +0,0 @@ -#![allow(bad_style, improper_ctypes, unused, deprecated)] - -extern crate libc; -use libc::*; - -#[cfg(any(target_os = "linux", target_os = "android"))] -include!(concat!(env!("OUT_DIR"), "/linux_termios.rs")); - -#[cfg(not(any(target_os = "linux", target_os = "android")))] -fn main() { - println!("PASSED 0 tests"); -} diff --git a/libc-test/test/main.rs b/libc-test/test/main.rs deleted file mode 100644 index 62a587cf..00000000 --- a/libc-test/test/main.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![allow(bad_style, improper_ctypes, deprecated)] -extern crate libc; - -use libc::*; - -include!(concat!(env!("OUT_DIR"), "/main.rs")); diff --git a/src/fuchsia/aarch64.rs b/src/fuchsia/aarch64.rs index b7abcd6a..654e8d1b 100644 --- a/src/fuchsia/aarch64.rs +++ b/src/fuchsia/aarch64.rs @@ -80,3 +80,268 @@ pub const PF_MAX: ::c_int = 43; )] #[allow(deprecated)] pub const AF_MAX: ::c_int = PF_MAX; + +pub const SYS_io_setup: ::c_long = 0; +pub const SYS_io_destroy: ::c_long = 1; +pub const SYS_io_submit: ::c_long = 2; +pub const SYS_io_cancel: ::c_long = 3; +pub const SYS_io_getevents: ::c_long = 4; +pub const SYS_setxattr: ::c_long = 5; +pub const SYS_lsetxattr: ::c_long = 6; +pub const SYS_fsetxattr: ::c_long = 7; +pub const SYS_getxattr: ::c_long = 8; +pub const SYS_lgetxattr: ::c_long = 9; +pub const SYS_fgetxattr: ::c_long = 10; +pub const SYS_listxattr: ::c_long = 11; +pub const SYS_llistxattr: ::c_long = 12; +pub const SYS_flistxattr: ::c_long = 13; +pub const SYS_removexattr: ::c_long = 14; +pub const SYS_lremovexattr: ::c_long = 15; +pub const SYS_fremovexattr: ::c_long = 16; +pub const SYS_getcwd: ::c_long = 17; +pub const SYS_lookup_dcookie: ::c_long = 18; +pub const SYS_eventfd2: ::c_long = 19; +pub const SYS_epoll_create1: ::c_long = 20; +pub const SYS_epoll_ctl: ::c_long = 21; +pub const SYS_epoll_pwait: ::c_long = 22; +pub const SYS_dup: ::c_long = 23; +pub const SYS_dup3: ::c_long = 24; +pub const SYS_inotify_init1: ::c_long = 26; +pub const SYS_inotify_add_watch: ::c_long = 27; +pub const SYS_inotify_rm_watch: ::c_long = 28; +pub const SYS_ioctl: ::c_long = 29; +pub const SYS_ioprio_set: ::c_long = 30; +pub const SYS_ioprio_get: ::c_long = 31; +pub const SYS_flock: ::c_long = 32; +pub const SYS_mknodat: ::c_long = 33; +pub const SYS_mkdirat: ::c_long = 34; +pub const SYS_unlinkat: ::c_long = 35; +pub const SYS_symlinkat: ::c_long = 36; +pub const SYS_linkat: ::c_long = 37; +pub const SYS_renameat: ::c_long = 38; +pub const SYS_umount2: ::c_long = 39; +pub const SYS_mount: ::c_long = 40; +pub const SYS_pivot_root: ::c_long = 41; +pub const SYS_nfsservctl: ::c_long = 42; +pub const SYS_fallocate: ::c_long = 47; +pub const SYS_faccessat: ::c_long = 48; +pub const SYS_chdir: ::c_long = 49; +pub const SYS_fchdir: ::c_long = 50; +pub const SYS_chroot: ::c_long = 51; +pub const SYS_fchmod: ::c_long = 52; +pub const SYS_fchmodat: ::c_long = 53; +pub const SYS_fchownat: ::c_long = 54; +pub const SYS_fchown: ::c_long = 55; +pub const SYS_openat: ::c_long = 56; +pub const SYS_close: ::c_long = 57; +pub const SYS_vhangup: ::c_long = 58; +pub const SYS_pipe2: ::c_long = 59; +pub const SYS_quotactl: ::c_long = 60; +pub const SYS_getdents64: ::c_long = 61; +pub const SYS_read: ::c_long = 63; +pub const SYS_write: ::c_long = 64; +pub const SYS_readv: ::c_long = 65; +pub const SYS_writev: ::c_long = 66; +pub const SYS_pread64: ::c_long = 67; +pub const SYS_pwrite64: ::c_long = 68; +pub const SYS_preadv: ::c_long = 69; +pub const SYS_pwritev: ::c_long = 70; +pub const SYS_pselect6: ::c_long = 72; +pub const SYS_ppoll: ::c_long = 73; +pub const SYS_signalfd4: ::c_long = 74; +pub const SYS_vmsplice: ::c_long = 75; +pub const SYS_splice: ::c_long = 76; +pub const SYS_tee: ::c_long = 77; +pub const SYS_readlinkat: ::c_long = 78; +pub const SYS_sync: ::c_long = 81; +pub const SYS_fsync: ::c_long = 82; +pub const SYS_fdatasync: ::c_long = 83; +pub const SYS_sync_file_range: ::c_long = 84; +pub const SYS_timerfd_create: ::c_long = 85; +pub const SYS_timerfd_settime: ::c_long = 86; +pub const SYS_timerfd_gettime: ::c_long = 87; +pub const SYS_utimensat: ::c_long = 88; +pub const SYS_acct: ::c_long = 89; +pub const SYS_capget: ::c_long = 90; +pub const SYS_capset: ::c_long = 91; +pub const SYS_personality: ::c_long = 92; +pub const SYS_exit: ::c_long = 93; +pub const SYS_exit_group: ::c_long = 94; +pub const SYS_waitid: ::c_long = 95; +pub const SYS_set_tid_address: ::c_long = 96; +pub const SYS_unshare: ::c_long = 97; +pub const SYS_futex: ::c_long = 98; +pub const SYS_set_robust_list: ::c_long = 99; +pub const SYS_get_robust_list: ::c_long = 100; +pub const SYS_nanosleep: ::c_long = 101; +pub const SYS_getitimer: ::c_long = 102; +pub const SYS_setitimer: ::c_long = 103; +pub const SYS_kexec_load: ::c_long = 104; +pub const SYS_init_module: ::c_long = 105; +pub const SYS_delete_module: ::c_long = 106; +pub const SYS_timer_create: ::c_long = 107; +pub const SYS_timer_gettime: ::c_long = 108; +pub const SYS_timer_getoverrun: ::c_long = 109; +pub const SYS_timer_settime: ::c_long = 110; +pub const SYS_timer_delete: ::c_long = 111; +pub const SYS_clock_settime: ::c_long = 112; +pub const SYS_clock_gettime: ::c_long = 113; +pub const SYS_clock_getres: ::c_long = 114; +pub const SYS_clock_nanosleep: ::c_long = 115; +pub const SYS_syslog: ::c_long = 116; +pub const SYS_ptrace: ::c_long = 117; +pub const SYS_sched_setparam: ::c_long = 118; +pub const SYS_sched_setscheduler: ::c_long = 119; +pub const SYS_sched_getscheduler: ::c_long = 120; +pub const SYS_sched_getparam: ::c_long = 121; +pub const SYS_sched_setaffinity: ::c_long = 122; +pub const SYS_sched_getaffinity: ::c_long = 123; +pub const SYS_sched_yield: ::c_long = 124; +pub const SYS_sched_get_priority_max: ::c_long = 125; +pub const SYS_sched_get_priority_min: ::c_long = 126; +pub const SYS_sched_rr_get_interval: ::c_long = 127; +pub const SYS_restart_syscall: ::c_long = 128; +pub const SYS_kill: ::c_long = 129; +pub const SYS_tkill: ::c_long = 130; +pub const SYS_tgkill: ::c_long = 131; +pub const SYS_sigaltstack: ::c_long = 132; +pub const SYS_rt_sigsuspend: ::c_long = 133; +pub const SYS_rt_sigaction: ::c_long = 134; +pub const SYS_rt_sigprocmask: ::c_long = 135; +pub const SYS_rt_sigpending: ::c_long = 136; +pub const SYS_rt_sigtimedwait: ::c_long = 137; +pub const SYS_rt_sigqueueinfo: ::c_long = 138; +pub const SYS_rt_sigreturn: ::c_long = 139; +pub const SYS_setpriority: ::c_long = 140; +pub const SYS_getpriority: ::c_long = 141; +pub const SYS_reboot: ::c_long = 142; +pub const SYS_setregid: ::c_long = 143; +pub const SYS_setgid: ::c_long = 144; +pub const SYS_setreuid: ::c_long = 145; +pub const SYS_setuid: ::c_long = 146; +pub const SYS_setresuid: ::c_long = 147; +pub const SYS_getresuid: ::c_long = 148; +pub const SYS_setresgid: ::c_long = 149; +pub const SYS_getresgid: ::c_long = 150; +pub const SYS_setfsuid: ::c_long = 151; +pub const SYS_setfsgid: ::c_long = 152; +pub const SYS_times: ::c_long = 153; +pub const SYS_setpgid: ::c_long = 154; +pub const SYS_getpgid: ::c_long = 155; +pub const SYS_getsid: ::c_long = 156; +pub const SYS_setsid: ::c_long = 157; +pub const SYS_getgroups: ::c_long = 158; +pub const SYS_setgroups: ::c_long = 159; +pub const SYS_uname: ::c_long = 160; +pub const SYS_sethostname: ::c_long = 161; +pub const SYS_setdomainname: ::c_long = 162; +pub const SYS_getrlimit: ::c_long = 163; +pub const SYS_setrlimit: ::c_long = 164; +pub const SYS_getrusage: ::c_long = 165; +pub const SYS_umask: ::c_long = 166; +pub const SYS_prctl: ::c_long = 167; +pub const SYS_getcpu: ::c_long = 168; +pub const SYS_gettimeofday: ::c_long = 169; +pub const SYS_settimeofday: ::c_long = 170; +pub const SYS_adjtimex: ::c_long = 171; +pub const SYS_getpid: ::c_long = 172; +pub const SYS_getppid: ::c_long = 173; +pub const SYS_getuid: ::c_long = 174; +pub const SYS_geteuid: ::c_long = 175; +pub const SYS_getgid: ::c_long = 176; +pub const SYS_getegid: ::c_long = 177; +pub const SYS_gettid: ::c_long = 178; +pub const SYS_sysinfo: ::c_long = 179; +pub const SYS_mq_open: ::c_long = 180; +pub const SYS_mq_unlink: ::c_long = 181; +pub const SYS_mq_timedsend: ::c_long = 182; +pub const SYS_mq_timedreceive: ::c_long = 183; +pub const SYS_mq_notify: ::c_long = 184; +pub const SYS_mq_getsetattr: ::c_long = 185; +pub const SYS_msgget: ::c_long = 186; +pub const SYS_msgctl: ::c_long = 187; +pub const SYS_msgrcv: ::c_long = 188; +pub const SYS_msgsnd: ::c_long = 189; +pub const SYS_semget: ::c_long = 190; +pub const SYS_semctl: ::c_long = 191; +pub const SYS_semtimedop: ::c_long = 192; +pub const SYS_semop: ::c_long = 193; +pub const SYS_shmget: ::c_long = 194; +pub const SYS_shmctl: ::c_long = 195; +pub const SYS_shmat: ::c_long = 196; +pub const SYS_shmdt: ::c_long = 197; +pub const SYS_socket: ::c_long = 198; +pub const SYS_socketpair: ::c_long = 199; +pub const SYS_bind: ::c_long = 200; +pub const SYS_listen: ::c_long = 201; +pub const SYS_accept: ::c_long = 202; +pub const SYS_connect: ::c_long = 203; +pub const SYS_getsockname: ::c_long = 204; +pub const SYS_getpeername: ::c_long = 205; +pub const SYS_sendto: ::c_long = 206; +pub const SYS_recvfrom: ::c_long = 207; +pub const SYS_setsockopt: ::c_long = 208; +pub const SYS_getsockopt: ::c_long = 209; +pub const SYS_shutdown: ::c_long = 210; +pub const SYS_sendmsg: ::c_long = 211; +pub const SYS_recvmsg: ::c_long = 212; +pub const SYS_readahead: ::c_long = 213; +pub const SYS_brk: ::c_long = 214; +pub const SYS_munmap: ::c_long = 215; +pub const SYS_mremap: ::c_long = 216; +pub const SYS_add_key: ::c_long = 217; +pub const SYS_request_key: ::c_long = 218; +pub const SYS_keyctl: ::c_long = 219; +pub const SYS_clone: ::c_long = 220; +pub const SYS_execve: ::c_long = 221; +pub const SYS_swapon: ::c_long = 224; +pub const SYS_swapoff: ::c_long = 225; +pub const SYS_mprotect: ::c_long = 226; +pub const SYS_msync: ::c_long = 227; +pub const SYS_mlock: ::c_long = 228; +pub const SYS_munlock: ::c_long = 229; +pub const SYS_mlockall: ::c_long = 230; +pub const SYS_munlockall: ::c_long = 231; +pub const SYS_mincore: ::c_long = 232; +pub const SYS_madvise: ::c_long = 233; +pub const SYS_remap_file_pages: ::c_long = 234; +pub const SYS_mbind: ::c_long = 235; +pub const SYS_get_mempolicy: ::c_long = 236; +pub const SYS_set_mempolicy: ::c_long = 237; +pub const SYS_migrate_pages: ::c_long = 238; +pub const SYS_move_pages: ::c_long = 239; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 240; +pub const SYS_perf_event_open: ::c_long = 241; +pub const SYS_accept4: ::c_long = 242; +pub const SYS_recvmmsg: ::c_long = 243; +pub const SYS_wait4: ::c_long = 260; +pub const SYS_prlimit64: ::c_long = 261; +pub const SYS_fanotify_init: ::c_long = 262; +pub const SYS_fanotify_mark: ::c_long = 263; +pub const SYS_name_to_handle_at: ::c_long = 264; +pub const SYS_open_by_handle_at: ::c_long = 265; +pub const SYS_clock_adjtime: ::c_long = 266; +pub const SYS_syncfs: ::c_long = 267; +pub const SYS_setns: ::c_long = 268; +pub const SYS_sendmmsg: ::c_long = 269; +pub const SYS_process_vm_readv: ::c_long = 270; +pub const SYS_process_vm_writev: ::c_long = 271; +pub const SYS_kcmp: ::c_long = 272; +pub const SYS_finit_module: ::c_long = 273; +pub const SYS_sched_setattr: ::c_long = 274; +pub const SYS_sched_getattr: ::c_long = 275; +pub const SYS_renameat2: ::c_long = 276; +pub const SYS_seccomp: ::c_long = 277; +pub const SYS_getrandom: ::c_long = 278; +pub const SYS_memfd_create: ::c_long = 279; +pub const SYS_bpf: ::c_long = 280; +pub const SYS_execveat: ::c_long = 281; +pub const SYS_userfaultfd: ::c_long = 282; +pub const SYS_membarrier: ::c_long = 283; +pub const SYS_mlock2: ::c_long = 284; +pub const SYS_copy_file_range: ::c_long = 285; +pub const SYS_preadv2: ::c_long = 286; +pub const SYS_pwritev2: ::c_long = 287; +pub const SYS_pkey_mprotect: ::c_long = 288; +pub const SYS_pkey_alloc: ::c_long = 289; +pub const SYS_pkey_free: ::c_long = 290; diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index f2f98442..1d683415 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -432,6 +432,15 @@ s! { pub int_n_sign_posn: ::c_char, } + pub struct sigevent { + pub sigev_value: ::sigval, + pub sigev_signo: ::c_int, + pub sigev_notify: ::c_int, + pub sigev_notify_function: fn(::sigval), + pub sigev_notify_attributes: *mut pthread_attr_t, + pub __pad: [::c_char; 56 - 3 * 8 /* 8 == sizeof(long) */], + } + pub struct rlimit64 { pub rlim_cur: rlim64_t, pub rlim_max: rlim64_t, @@ -953,15 +962,6 @@ s_no_extra_traits! { pub nl_pid: u32, pub nl_groups: u32 } - - pub struct sigevent { - pub sigev_value: ::sigval, - pub sigev_signo: ::c_int, - pub sigev_notify: ::c_int, - pub sigev_notify_function: fn(::sigval), - pub sigev_notify_attributes: *mut pthread_attr_t, - pub __pad: [::c_char; 56 - 3 * 8 /* 8 == sizeof(long) */], - } } cfg_if! { @@ -1255,39 +1255,6 @@ cfg_if! { self.nl_groups.hash(state); } } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_value == other.sigev_value - && self.sigev_signo == other.sigev_signo - && self.sigev_notify == other.sigev_notify - && self.sigev_notify_function == other.sigev_notify_function - && self.sigev_notify_attributes - == other.sigev_notify_attributes - } - } - impl Eq for sigevent {} - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_value", &self.sigev_value) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_notify", &self.sigev_notify) - .field("sigev_notify_function", &self.sigev_notify_function) - .field("sigev_notify_attributes", - &self.sigev_notify_attributes) - .finish() - } - } - impl ::hash::Hash for sigevent { - fn hash<H: ::hash::Hasher>(&self, state: &mut H) { - self.sigev_value.hash(state); - self.sigev_signo.hash(state); - self.sigev_notify.hash(state); - self.sigev_notify_function.hash(state); - self.sigev_notify_attributes.hash(state); - } - } } } @@ -2596,6 +2563,9 @@ pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2; pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3; pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4; +pub const GRND_NONBLOCK: ::c_uint = 0x0001; +pub const GRND_RANDOM: ::c_uint = 0x0002; + pub const ITIMER_REAL: ::c_int = 0; pub const ITIMER_VIRTUAL: ::c_int = 1; pub const ITIMER_PROF: ::c_int = 2; diff --git a/src/fuchsia/x86_64.rs b/src/fuchsia/x86_64.rs index 0f1a4e9e..e01f16d4 100644 --- a/src/fuchsia/x86_64.rs +++ b/src/fuchsia/x86_64.rs @@ -117,6 +117,340 @@ cfg_if! { } } +// Syscall table + +pub const SYS_read: ::c_long = 0; +pub const SYS_write: ::c_long = 1; +pub const SYS_open: ::c_long = 2; +pub const SYS_close: ::c_long = 3; +pub const SYS_stat: ::c_long = 4; +pub const SYS_fstat: ::c_long = 5; +pub const SYS_lstat: ::c_long = 6; +pub const SYS_poll: ::c_long = 7; +pub const SYS_lseek: ::c_long = 8; +pub const SYS_mmap: ::c_long = 9; +pub const SYS_mprotect: ::c_long = 10; +pub const SYS_munmap: ::c_long = 11; +pub const SYS_brk: ::c_long = 12; +pub const SYS_rt_sigaction: ::c_long = 13; +pub const SYS_rt_sigprocmask: ::c_long = 14; +pub const SYS_rt_sigreturn: ::c_long = 15; +pub const SYS_ioctl: ::c_long = 16; +pub const SYS_pread64: ::c_long = 17; +pub const SYS_pwrite64: ::c_long = 18; +pub const SYS_readv: ::c_long = 19; +pub const SYS_writev: ::c_long = 20; +pub const SYS_access: ::c_long = 21; +pub const SYS_pipe: ::c_long = 22; +pub const SYS_select: ::c_long = 23; +pub const SYS_sched_yield: ::c_long = 24; +pub const SYS_mremap: ::c_long = 25; +pub const SYS_msync: ::c_long = 26; +pub const SYS_mincore: ::c_long = 27; +pub const SYS_madvise: ::c_long = 28; +pub const SYS_shmget: ::c_long = 29; +pub const SYS_shmat: ::c_long = 30; +pub const SYS_shmctl: ::c_long = 31; +pub const SYS_dup: ::c_long = 32; +pub const SYS_dup2: ::c_long = 33; +pub const SYS_pause: ::c_long = 34; +pub const SYS_nanosleep: ::c_long = 35; +pub const SYS_getitimer: ::c_long = 36; +pub const SYS_alarm: ::c_long = 37; +pub const SYS_setitimer: ::c_long = 38; +pub const SYS_getpid: ::c_long = 39; +pub const SYS_sendfile: ::c_long = 40; +pub const SYS_socket: ::c_long = 41; +pub const SYS_connect: ::c_long = 42; +pub const SYS_accept: ::c_long = 43; +pub const SYS_sendto: ::c_long = 44; +pub const SYS_recvfrom: ::c_long = 45; +pub const SYS_sendmsg: ::c_long = 46; +pub const SYS_recvmsg: ::c_long = 47; +pub const SYS_shutdown: ::c_long = 48; +pub const SYS_bind: ::c_long = 49; +pub const SYS_listen: ::c_long = 50; +pub const SYS_getsockname: ::c_long = 51; +pub const SYS_getpeername: ::c_long = 52; +pub const SYS_socketpair: ::c_long = 53; +pub const SYS_setsockopt: ::c_long = 54; +pub const SYS_getsockopt: ::c_long = 55; +pub const SYS_clone: ::c_long = 56; +pub const SYS_fork: ::c_long = 57; +pub const SYS_vfork: ::c_long = 58; +pub const SYS_execve: ::c_long = 59; +pub const SYS_exit: ::c_long = 60; +pub const SYS_wait4: ::c_long = 61; +pub const SYS_kill: ::c_long = 62; +pub const SYS_uname: ::c_long = 63; +pub const SYS_semget: ::c_long = 64; +pub const SYS_semop: ::c_long = 65; +pub const SYS_semctl: ::c_long = 66; +pub const SYS_shmdt: ::c_long = 67; +pub const SYS_msgget: ::c_long = 68; +pub const SYS_msgsnd: ::c_long = 69; +pub const SYS_msgrcv: ::c_long = 70; +pub const SYS_msgctl: ::c_long = 71; +pub const SYS_fcntl: ::c_long = 72; +pub const SYS_flock: ::c_long = 73; +pub const SYS_fsync: ::c_long = 74; +pub const SYS_fdatasync: ::c_long = 75; +pub const SYS_truncate: ::c_long = 76; +pub const SYS_ftruncate: ::c_long = 77; +pub const SYS_getdents: ::c_long = 78; +pub const SYS_getcwd: ::c_long = 79; +pub const SYS_chdir: ::c_long = 80; +pub const SYS_fchdir: ::c_long = 81; +pub const SYS_rename: ::c_long = 82; +pub const SYS_mkdir: ::c_long = 83; +pub const SYS_rmdir: ::c_long = 84; +pub const SYS_creat: ::c_long = 85; +pub const SYS_link: ::c_long = 86; +pub const SYS_unlink: ::c_long = 87; +pub const SYS_symlink: ::c_long = 88; +pub const SYS_readlink: ::c_long = 89; +pub const SYS_chmod: ::c_long = 90; +pub const SYS_fchmod: ::c_long = 91; +pub const SYS_chown: ::c_long = 92; +pub const SYS_fchown: ::c_long = 93; +pub const SYS_lchown: ::c_long = 94; +pub const SYS_umask: ::c_long = 95; +pub const SYS_gettimeofday: ::c_long = 96; +pub const SYS_getrlimit: ::c_long = 97; +pub const SYS_getrusage: ::c_long = 98; +pub const SYS_sysinfo: ::c_long = 99; +pub const SYS_times: ::c_long = 100; +pub const SYS_ptrace: ::c_long = 101; +pub const SYS_getuid: ::c_long = 102; +pub const SYS_syslog: ::c_long = 103; +pub const SYS_getgid: ::c_long = 104; +pub const SYS_setuid: ::c_long = 105; +pub const SYS_setgid: ::c_long = 106; +pub const SYS_geteuid: ::c_long = 107; +pub const SYS_getegid: ::c_long = 108; +pub const SYS_setpgid: ::c_long = 109; +pub const SYS_getppid: ::c_long = 110; +pub const SYS_getpgrp: ::c_long = 111; +pub const SYS_setsid: ::c_long = 112; +pub const SYS_setreuid: ::c_long = 113; +pub const SYS_setregid: ::c_long = 114; +pub const SYS_getgroups: ::c_long = 115; +pub const SYS_setgroups: ::c_long = 116; +pub const SYS_setresuid: ::c_long = 117; +pub const SYS_getresuid: ::c_long = 118; +pub const SYS_setresgid: ::c_long = 119; +pub const SYS_getresgid: ::c_long = 120; +pub const SYS_getpgid: ::c_long = 121; +pub const SYS_setfsuid: ::c_long = 122; +pub const SYS_setfsgid: ::c_long = 123; +pub const SYS_getsid: ::c_long = 124; +pub const SYS_capget: ::c_long = 125; +pub const SYS_capset: ::c_long = 126; +pub const SYS_rt_sigpending: ::c_long = 127; +pub const SYS_rt_sigtimedwait: ::c_long = 128; +pub const SYS_rt_sigqueueinfo: ::c_long = 129; +pub const SYS_rt_sigsuspend: ::c_long = 130; +pub const SYS_sigaltstack: ::c_long = 131; +pub const SYS_utime: ::c_long = 132; +pub const SYS_mknod: ::c_long = 133; +pub const SYS_uselib: ::c_long = 134; +pub const SYS_personality: ::c_long = 135; +pub const SYS_ustat: ::c_long = 136; +pub const SYS_statfs: ::c_long = 137; +pub const SYS_fstatfs: ::c_long = 138; +pub const SYS_sysfs: ::c_long = 139; +pub const SYS_getpriority: ::c_long = 140; +pub const SYS_setpriority: ::c_long = 141; +pub const SYS_sched_setparam: ::c_long = 142; +pub const SYS_sched_getparam: ::c_long = 143; +pub const SYS_sched_setscheduler: ::c_long = 144; +pub const SYS_sched_getscheduler: ::c_long = 145; +pub const SYS_sched_get_priority_max: ::c_long = 146; +pub const SYS_sched_get_priority_min: ::c_long = 147; +pub const SYS_sched_rr_get_interval: ::c_long = 148; +pub const SYS_mlock: ::c_long = 149; +pub const SYS_munlock: ::c_long = 150; +pub const SYS_mlockall: ::c_long = 151; +pub const SYS_munlockall: ::c_long = 152; +pub const SYS_vhangup: ::c_long = 153; +pub const SYS_modify_ldt: ::c_long = 154; +pub const SYS_pivot_root: ::c_long = 155; +pub const SYS__sysctl: ::c_long = 156; +pub const SYS_prctl: ::c_long = 157; +pub const SYS_arch_prctl: ::c_long = 158; +pub const SYS_adjtimex: ::c_long = 159; +pub const SYS_setrlimit: ::c_long = 160; +pub const SYS_chroot: ::c_long = 161; +pub const SYS_sync: ::c_long = 162; +pub const SYS_acct: ::c_long = 163; +pub const SYS_settimeofday: ::c_long = 164; +pub const SYS_mount: ::c_long = 165; +pub const SYS_umount2: ::c_long = 166; +pub const SYS_swapon: ::c_long = 167; +pub const SYS_swapoff: ::c_long = 168; +pub const SYS_reboot: ::c_long = 169; +pub const SYS_sethostname: ::c_long = 170; +pub const SYS_setdomainname: ::c_long = 171; +pub const SYS_iopl: ::c_long = 172; +pub const SYS_ioperm: ::c_long = 173; +pub const SYS_create_module: ::c_long = 174; +pub const SYS_init_module: ::c_long = 175; +pub const SYS_delete_module: ::c_long = 176; +pub const SYS_get_kernel_syms: ::c_long = 177; +pub const SYS_query_module: ::c_long = 178; +pub const SYS_quotactl: ::c_long = 179; +pub const SYS_nfsservctl: ::c_long = 180; +pub const SYS_getpmsg: ::c_long = 181; +pub const SYS_putpmsg: ::c_long = 182; +pub const SYS_afs_syscall: ::c_long = 183; +pub const SYS_tuxcall: ::c_long = 184; +pub const SYS_security: ::c_long = 185; +pub const SYS_gettid: ::c_long = 186; +pub const SYS_readahead: ::c_long = 187; +pub const SYS_setxattr: ::c_long = 188; +pub const SYS_lsetxattr: ::c_long = 189; +pub const SYS_fsetxattr: ::c_long = 190; +pub const SYS_getxattr: ::c_long = 191; +pub const SYS_lgetxattr: ::c_long = 192; +pub const SYS_fgetxattr: ::c_long = 193; +pub const SYS_listxattr: ::c_long = 194; +pub const SYS_llistxattr: ::c_long = 195; +pub const SYS_flistxattr: ::c_long = 196; +pub const SYS_removexattr: ::c_long = 197; +pub const SYS_lremovexattr: ::c_long = 198; +pub const SYS_fremovexattr: ::c_long = 199; +pub const SYS_tkill: ::c_long = 200; +pub const SYS_time: ::c_long = 201; +pub const SYS_futex: ::c_long = 202; +pub const SYS_sched_setaffinity: ::c_long = 203; +pub const SYS_sched_getaffinity: ::c_long = 204; +pub const SYS_set_thread_area: ::c_long = 205; +pub const SYS_io_setup: ::c_long = 206; +pub const SYS_io_destroy: ::c_long = 207; +pub const SYS_io_getevents: ::c_long = 208; +pub const SYS_io_submit: ::c_long = 209; +pub const SYS_io_cancel: ::c_long = 210; +pub const SYS_get_thread_area: ::c_long = 211; +pub const SYS_lookup_dcookie: ::c_long = 212; +pub const SYS_epoll_create: ::c_long = 213; +pub const SYS_epoll_ctl_old: ::c_long = 214; +pub const SYS_epoll_wait_old: ::c_long = 215; +pub const SYS_remap_file_pages: ::c_long = 216; +pub const SYS_getdents64: ::c_long = 217; +pub const SYS_set_tid_address: ::c_long = 218; +pub const SYS_restart_syscall: ::c_long = 219; +pub const SYS_semtimedop: ::c_long = 220; +pub const SYS_fadvise64: ::c_long = 221; +pub const SYS_timer_create: ::c_long = 222; +pub const SYS_timer_settime: ::c_long = 223; +pub const SYS_timer_gettime: ::c_long = 224; +pub const SYS_timer_getoverrun: ::c_long = 225; +pub const SYS_timer_delete: ::c_long = 226; +pub const SYS_clock_settime: ::c_long = 227; +pub const SYS_clock_gettime: ::c_long = 228; +pub const SYS_clock_getres: ::c_long = 229; +pub const SYS_clock_nanosleep: ::c_long = 230; +pub const SYS_exit_group: ::c_long = 231; +pub const SYS_epoll_wait: ::c_long = 232; +pub const SYS_epoll_ctl: ::c_long = 233; +pub const SYS_tgkill: ::c_long = 234; +pub const SYS_utimes: ::c_long = 235; +pub const SYS_vserver: ::c_long = 236; +pub const SYS_mbind: ::c_long = 237; +pub const SYS_set_mempolicy: ::c_long = 238; +pub const SYS_get_mempolicy: ::c_long = 239; +pub const SYS_mq_open: ::c_long = 240; +pub const SYS_mq_unlink: ::c_long = 241; +pub const SYS_mq_timedsend: ::c_long = 242; +pub const SYS_mq_timedreceive: ::c_long = 243; +pub const SYS_mq_notify: ::c_long = 244; +pub const SYS_mq_getsetattr: ::c_long = 245; +pub const SYS_kexec_load: ::c_long = 246; +pub const SYS_waitid: ::c_long = 247; +pub const SYS_add_key: ::c_long = 248; +pub const SYS_request_key: ::c_long = 249; +pub const SYS_keyctl: ::c_long = 250; +pub const SYS_ioprio_set: ::c_long = 251; +pub const SYS_ioprio_get: ::c_long = 252; +pub const SYS_inotify_init: ::c_long = 253; +pub const SYS_inotify_add_watch: ::c_long = 254; +pub const SYS_inotify_rm_watch: ::c_long = 255; +pub const SYS_migrate_pages: ::c_long = 256; +pub const SYS_openat: ::c_long = 257; +pub const SYS_mkdirat: ::c_long = 258; +pub const SYS_mknodat: ::c_long = 259; +pub const SYS_fchownat: ::c_long = 260; +pub const SYS_futimesat: ::c_long = 261; +pub const SYS_newfstatat: ::c_long = 262; +pub const SYS_unlinkat: ::c_long = 263; +pub const SYS_renameat: ::c_long = 264; +pub const SYS_linkat: ::c_long = 265; +pub const SYS_symlinkat: ::c_long = 266; +pub const SYS_readlinkat: ::c_long = 267; +pub const SYS_fchmodat: ::c_long = 268; +pub const SYS_faccessat: ::c_long = 269; +pub const SYS_pselect6: ::c_long = 270; +pub const SYS_ppoll: ::c_long = 271; +pub const SYS_unshare: ::c_long = 272; +pub const SYS_set_robust_list: ::c_long = 273; +pub const SYS_get_robust_list: ::c_long = 274; +pub const SYS_splice: ::c_long = 275; +pub const SYS_tee: ::c_long = 276; +pub const SYS_sync_file_range: ::c_long = 277; +pub const SYS_vmsplice: ::c_long = 278; +pub const SYS_move_pages: ::c_long = 279; +pub const SYS_utimensat: ::c_long = 280; +pub const SYS_epoll_pwait: ::c_long = 281; +pub const SYS_signalfd: ::c_long = 282; +pub const SYS_timerfd_create: ::c_long = 283; +pub const SYS_eventfd: ::c_long = 284; +pub const SYS_fallocate: ::c_long = 285; +pub const SYS_timerfd_settime: ::c_long = 286; +pub const SYS_timerfd_gettime: ::c_long = 287; +pub const SYS_accept4: ::c_long = 288; +pub const SYS_signalfd4: ::c_long = 289; +pub const SYS_eventfd2: ::c_long = 290; +pub const SYS_epoll_create1: ::c_long = 291; +pub const SYS_dup3: ::c_long = 292; +pub const SYS_pipe2: ::c_long = 293; +pub const SYS_inotify_init1: ::c_long = 294; +pub const SYS_preadv: ::c_long = 295; +pub const SYS_pwritev: ::c_long = 296; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 297; +pub const SYS_perf_event_open: ::c_long = 298; +pub const SYS_recvmmsg: ::c_long = 299; +pub const SYS_fanotify_init: ::c_long = 300; +pub const SYS_fanotify_mark: ::c_long = 301; +pub const SYS_prlimit64: ::c_long = 302; +pub const SYS_name_to_handle_at: ::c_long = 303; +pub const SYS_open_by_handle_at: ::c_long = 304; +pub const SYS_clock_adjtime: ::c_long = 305; +pub const SYS_syncfs: ::c_long = 306; +pub const SYS_sendmmsg: ::c_long = 307; +pub const SYS_setns: ::c_long = 308; +pub const SYS_getcpu: ::c_long = 309; +pub const SYS_process_vm_readv: ::c_long = 310; +pub const SYS_process_vm_writev: ::c_long = 311; +pub const SYS_kcmp: ::c_long = 312; +pub const SYS_finit_module: ::c_long = 313; +pub const SYS_sched_setattr: ::c_long = 314; +pub const SYS_sched_getattr: ::c_long = 315; +pub const SYS_renameat2: ::c_long = 316; +pub const SYS_seccomp: ::c_long = 317; +pub const SYS_getrandom: ::c_long = 318; +pub const SYS_memfd_create: ::c_long = 319; +pub const SYS_kexec_file_load: ::c_long = 320; +pub const SYS_bpf: ::c_long = 321; +pub const SYS_execveat: ::c_long = 322; +pub const SYS_userfaultfd: ::c_long = 323; +pub const SYS_membarrier: ::c_long = 324; +pub const SYS_mlock2: ::c_long = 325; +pub const SYS_copy_file_range: ::c_long = 326; +pub const SYS_preadv2: ::c_long = 327; +pub const SYS_pwritev2: ::c_long = 328; +// FIXME syscalls 329-331 have been added in musl 1.16 +// See discussion https://github.com/rust-lang/libc/pull/699 + // offsets in user_regs_structs, from sys/reg.h pub const R15: ::c_int = 0; pub const R14: ::c_int = 1; diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 1b7c6253..af28dba7 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -287,6 +287,14 @@ s! { pub int_n_sign_posn: ::c_char, } + pub struct sigevent { + pub sigev_notify: ::c_int, + pub sigev_signo: ::c_int, + pub sigev_value: ::sigval, + __unused1: *mut ::c_void, //actually a function pointer + pub sigev_notify_attributes: *mut ::pthread_attr_t + } + pub struct proc_taskinfo { pub pti_virtual_size: u64, pub pti_resident_size: u64, @@ -604,14 +612,6 @@ s_no_extra_traits!{ pub ut_host: [::c_char; _UTX_HOSTSIZE], ut_pad: [u32; 16], } - - pub struct sigevent { - pub sigev_notify: ::c_int, - pub sigev_signo: ::c_int, - pub sigev_value: ::sigval, - __unused1: *mut ::c_void, //actually a function pointer - pub sigev_notify_attributes: *mut ::pthread_attr_t - } } cfg_if! { @@ -1159,39 +1159,6 @@ cfg_if! { self.ut_pad.hash(state); } } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_notify == other.sigev_notify - && self.sigev_signo == other.sigev_signo - && self.sigev_value == other.sigev_value - && self.sigev_notify_attributes - == other.sigev_notify_attributes - } - } - - impl Eq for sigevent {} - - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_notify", &self.sigev_notify) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_value", &self.sigev_value) - .field("sigev_notify_attributes", - &self.sigev_notify_attributes) - .finish() - } - } - - impl ::hash::Hash for sigevent { - fn hash<H: ::hash::Hasher>(&self, state: &mut H) { - self.sigev_notify.hash(state); - self.sigev_signo.hash(state); - self.sigev_value.hash(state); - self.sigev_notify_attributes.hash(state); - } - } } } @@ -1737,6 +1704,11 @@ pub const TIOCPTYGRANT: ::c_uint = 0x20007454; pub const TIOCPTYGNAME: ::c_uint = 0x40807453; pub const TIOCPTYUNLK: ::c_uint = 0x20007452; +pub const FIONCLEX: ::c_uint = 0x20006602; +pub const FIONREAD: ::c_ulong = 0x4004667f; +pub const FIOASYNC: ::c_ulong = 0x8004667d; +pub const FIOSETOWN: ::c_ulong = 0x8004667c; +pub const FIOGETOWN: ::c_ulong = 0x4004667b; pub const FIODTYPE: ::c_ulong = 0x4004667a; pub const B0: speed_t = 0; diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index dadcda9c..26faffef 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -70,6 +70,19 @@ s! { pub mq_curmsgs: ::c_long, } + pub struct sigevent { + pub sigev_notify: ::c_int, + // The union is 8-byte in size, so it is aligned at a 8-byte offset. + #[cfg(target_pointer_width = "64")] + __unused1: ::c_int, + pub sigev_signo: ::c_int, //actually a union + // pad the union + #[cfg(target_pointer_width = "64")] + __unused2: ::c_int, + pub sigev_value: ::sigval, + __unused3: *mut ::c_void //actually a function pointer + } + pub struct statvfs { pub f_bsize: ::c_ulong, pub f_frsize: ::c_ulong, @@ -221,20 +234,6 @@ s_no_extra_traits! { pub f_asyncreads: ::c_long, pub f_mntfromname: [::c_char; 90], } - - pub struct sigevent { - pub sigev_notify: ::c_int, - // The union is 8-byte in size, so it is aligned at a 8-byte offset. - #[cfg(target_pointer_width = "64")] - __unused1: ::c_int, - pub sigev_signo: ::c_int, //actually a union - // pad the union - #[cfg(target_pointer_width = "64")] - __unused2: ::c_int, - pub sigev_value: ::sigval, - __unused3: *mut ::c_void //actually a function pointer - } - } cfg_if! { @@ -409,31 +408,6 @@ cfg_if! { self.f_mntfromname.hash(state); } } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_notify == other.sigev_notify - && self.sigev_signo == other.sigev_signo - && self.sigev_value == other.sigev_value - } - } - impl Eq for sigevent {} - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_notify", &self.sigev_notify) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_value", &self.sigev_value) - .finish() - } - } - impl ::hash::Hash for sigevent { - fn hash<H: ::hash::Hasher>(&self, state: &mut H) { - self.sigev_notify.hash(state); - self.sigev_signo.hash(state); - self.sigev_value.hash(state); - } - } } } diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index d91765dc..e5945517 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -46,6 +46,18 @@ s! { pub ip6: *mut ::in6_addr, } + pub struct sigevent { + pub sigev_notify: ::c_int, + pub sigev_signo: ::c_int, + pub sigev_value: ::sigval, + //The rest of the structure is actually a union. We expose only + //sigev_notify_thread_id because it's the most useful union member. + pub sigev_notify_thread_id: ::lwpid_t, + #[cfg(target_pointer_width = "64")] + __unused1: ::c_int, + __unused2: [::c_long; 7] + } + pub struct statvfs { pub f_bavail: ::fsblkcnt_t, pub f_bfree: ::fsblkcnt_t, @@ -139,18 +151,6 @@ s_no_extra_traits! { pub mq_curmsgs: ::c_long, __reserved: [::c_long; 4] } - - pub struct sigevent { - pub sigev_notify: ::c_int, - pub sigev_signo: ::c_int, - pub sigev_value: ::sigval, - //The rest of the structure is actually a union. We expose only - //sigev_notify_thread_id because it's the most useful union member. - pub sigev_notify_thread_id: ::lwpid_t, - #[cfg(target_pointer_width = "64")] - __unused1: ::c_int, - __unused2: [::c_long; 7] - } } cfg_if! { @@ -274,36 +274,6 @@ cfg_if! { self.mq_curmsgs.hash(state); } } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_notify == other.sigev_notify - && self.sigev_signo == other.sigev_signo - && self.sigev_value == other.sigev_value - && self.sigev_notify_thread_id - == other.sigev_notify_thread_id - } - } - impl Eq for sigevent {} - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_notify", &self.sigev_notify) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_value", &self.sigev_value) - .field("sigev_notify_thread_id", - &self.sigev_notify_thread_id) - .finish() - } - } - impl ::hash::Hash for sigevent { - fn hash<H: ::hash::Hasher>(&self, state: &mut H) { - self.sigev_notify.hash(state); - self.sigev_signo.hash(state); - self.sigev_value.hash(state); - self.sigev_notify_thread_id.hash(state); - } - } } } @@ -570,6 +540,14 @@ pub const TIOCSIG: ::c_uint = 0x2004745f; pub const TIOCM_DCD: ::c_int = 0x40; pub const H4DISC: ::c_int = 0x7; +pub const FIONCLEX: ::c_ulong = 0x20006602; +pub const FIONREAD: ::c_ulong = 0x4004667f; +pub const FIOASYNC: ::c_ulong = 0x8004667d; +pub const FIOSETOWN: ::c_ulong = 0x8004667c; +pub const FIOGETOWN: ::c_ulong = 0x4004667b; +pub const FIODTYPE: ::c_ulong = 0x4004667a; +pub const FIOGETLBA: ::c_ulong = 0x40046679; +pub const FIODGNAME: ::c_ulong = 0x80106678; pub const FIONWRITE: ::c_ulong = 0x40046677; pub const FIONSPACE: ::c_ulong = 0x40046676; pub const FIOSEEKDATA: ::c_ulong = 0xc0086661; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 48c790f9..64168ebe 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -997,10 +997,6 @@ pub const SLIPDISC: ::c_int = 0x4; pub const PPPDISC: ::c_int = 0x5; pub const NETGRAPHDISC: ::c_int = 0x6; -pub const FIODTYPE: ::c_ulong = 0x4004667a; -pub const FIOGETLBA: ::c_ulong = 0x40046679; -pub const FIODGNAME: ::c_ulong = 0x80106678; - pub const B0: speed_t = 0; pub const B50: speed_t = 50; pub const B75: speed_t = 75; diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 77f82b18..8bc6c7c6 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -233,12 +233,7 @@ pub const LC_TIME: ::c_int = 5; pub const LC_MESSAGES: ::c_int = 6; pub const FIOCLEX: ::c_ulong = 0x20006601; -pub const FIONCLEX: ::c_ulong = 0x20006602; -pub const FIONREAD: ::c_ulong = 0x4004667f; pub const FIONBIO: ::c_ulong = 0x8004667e; -pub const FIOASYNC: ::c_ulong = 0x8004667d; -pub const FIOSETOWN: ::c_ulong = 0x8004667c; -pub const FIOGETOWN: ::c_ulong = 0x4004667b; pub const PATH_MAX: ::c_int = 1024; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index c95b61af..9d710eb0 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -46,6 +46,14 @@ s! { pub mq_curmsgs: ::c_long, } + pub struct sigevent { + pub sigev_notify: ::c_int, + pub sigev_signo: ::c_int, + pub sigev_value: ::sigval, + __unused1: *mut ::c_void, //actually a function pointer + pub sigev_notify_attributes: *mut ::c_void + } + pub struct sigset_t { __bits: [u32; 4], } @@ -348,14 +356,6 @@ s_no_extra_traits! { __ss_pad2: i64, __ss_pad3: [u8; 112], } - - pub struct sigevent { - pub sigev_notify: ::c_int, - pub sigev_signo: ::c_int, - pub sigev_value: ::sigval, - __unused1: *mut ::c_void, //actually a function pointer - pub sigev_notify_attributes: *mut ::c_void - } } cfg_if! { @@ -658,36 +658,6 @@ cfg_if! { self.__ss_pad3.hash(state); } } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_notify == other.sigev_notify - && self.sigev_signo == other.sigev_signo - && self.sigev_value == other.sigev_value - && self.sigev_notify_attributes - == other.sigev_notify_attributes - } - } - impl Eq for sigevent {} - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_notify", &self.sigev_notify) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_value", &self.sigev_value) - .field("sigev_notify_attributes", - &self.sigev_notify_attributes) - .finish() - } - } - impl ::hash::Hash for sigevent { - fn hash<H: ::hash::Hasher>(&self, state: &mut H) { - self.sigev_notify.hash(state); - self.sigev_signo.hash(state); - self.sigev_value.hash(state); - self.sigev_notify_attributes.hash(state); - } - } } } @@ -1377,9 +1347,14 @@ pub const CHWFLOW: ::tcflag_t = ::MDMBUF | ::CRTSCTS | ::CDTRCTS; pub const SOCK_CLOEXEC: ::c_int = 0x10000000; pub const SOCK_NONBLOCK: ::c_int = 0x20000000; +pub const FIONCLEX: ::c_ulong = 0x20006602; // Uncomment on next NetBSD release // pub const FIOSEEKDATA: ::c_ulong = 0xc0086661; // pub const FIOSEEKHOLE: ::c_ulong = 0xc0086662; +pub const FIONREAD: ::c_ulong = 0x4004667f; +pub const FIOASYNC: ::c_ulong = 0x8004667d; +pub const FIOSETOWN: ::c_ulong = 0x8004667c; +pub const FIOGETOWN: ::c_ulong = 0x4004667b; pub const OFIOGETBMAP: ::c_ulong = 0xc004667a; pub const FIOGETBMAP: ::c_ulong = 0xc008667a; pub const FIONWRITE: ::c_ulong = 0x40046679; diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index f8f6ca98..be9a6cf3 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -287,6 +287,14 @@ s! { sa_userdata: *mut ::c_void, } + pub struct sigevent { + pub sigev_notify: ::c_int, + pub sigev_signo: ::c_int, + pub sigev_value: ::sigval, + __unused1: *mut ::c_void, // actually a function pointer + pub sigev_notify_attributes: *mut ::pthread_attr_t, + } + pub struct sem_t { pub se_type: i32, pub se_named_id: i32, // this is actually a union @@ -321,14 +329,6 @@ s_no_extra_traits! { pub d_reclen: ::c_ushort, pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX } - - pub struct sigevent { - pub sigev_notify: ::c_int, - pub sigev_signo: ::c_int, - pub sigev_value: ::sigval, - __unused1: *mut ::c_void, // actually a function pointer - pub sigev_notify_attributes: *mut ::pthread_attr_t, - } } cfg_if! { @@ -438,36 +438,6 @@ cfg_if! { self.d_name.hash(state); } } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_notify == other.sigev_notify - && self.sigev_signo == other.sigev_signo - && self.sigev_value == other.sigev_value - && self.sigev_notify_attributes - == other.sigev_notify_attributes - } - } - impl Eq for sigevent {} - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_notify", &self.sigev_notify) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_value", &self.sigev_value) - .field("sigev_notify_attributes", - &self.sigev_notify_attributes) - .finish() - } - } - impl ::hash::Hash for sigevent { - fn hash<H: ::hash::Hasher>(&self, state: &mut H) { - self.sigev_notify.hash(state); - self.sigev_signo.hash(state); - self.sigev_value.hash(state); - self.sigev_notify_attributes.hash(state); - } - } } } @@ -1183,31 +1153,6 @@ pub const TCIFLUSH: ::c_int = 0x01; pub const TCOFLUSH: ::c_int = 0x02; pub const TCIOFLUSH: ::c_int = 0x03; -pub const TCGETA: ::c_int = 0x8000; -pub const TCSETA: ::c_int = TCGETA + 1; -pub const TCSETAF: ::c_int = TCGETA + 2; -pub const TCSETAW: ::c_int = TCGETA + 3; -pub const TCWAITEVENT: ::c_int = TCGETA + 4; -pub const TCSBRK: ::c_int = TCGETA + 5; -pub const TCFLSH: ::c_int = TCGETA + 6; -pub const TCXONC: ::c_int = TCGETA + 7; -pub const TCQUERYCONNECTED: ::c_int = TCGETA + 8; -pub const TCGETBITS: ::c_int = TCGETA + 9; -pub const TCSETDTR: ::c_int = TCGETA + 10; -pub const TCSETRTS: ::c_int = TCGETA + 11; -pub const TIOCGWINSZ: ::c_int = TCGETA + 12; -pub const TIOCSWINSZ: ::c_int = TCGETA + 13; -pub const TCVTIME: ::c_int = TCGETA + 14; -pub const TIOCGPGRP: ::c_int = TCGETA + 15; -pub const TIOCSPGRP: ::c_int = TCGETA + 16; -pub const TIOCSCTTY: ::c_int = TCGETA + 17; -pub const TIOCMGET: ::c_int = TCGETA + 18; -pub const TIOCMSET: ::c_int = TCGETA + 19; -pub const TIOCSBRK: ::c_int = TCGETA + 20; -pub const TIOCCBRK: ::c_int = TCGETA + 21; -pub const TIOCMBIS: ::c_int = TCGETA + 22; -pub const TIOCMBIC: ::c_int = TCGETA + 23; - f! { pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { let fd = fd as usize; diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 24df7256..efaad41e 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -1147,8 +1147,8 @@ cfg_if! { } else if #[cfg(any(target_os = "linux", target_os = "android", target_os = "emscripten"))] { - mod linux_like; - pub use self::linux_like::*; + mod notbsd; + pub use self::notbsd::*; } else if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "freebsd", diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index 7e731096..f27874cb 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -408,7 +408,6 @@ pub const SEEK_END: ::c_int = 2; pub const FIONBIO: ::c_ulong = 1; pub const FIOCLEX: ::c_ulong = 0x20006601; -pub const FIONCLEX: ::c_ulong = 0x20006602; pub const S_BLKSIZE: ::mode_t = 1024; pub const S_IREAD: ::mode_t = 256; diff --git a/src/unix/linux_like/android/b32/arm.rs b/src/unix/notbsd/android/b32/arm.rs index 1320b16a..1320b16a 100644 --- a/src/unix/linux_like/android/b32/arm.rs +++ b/src/unix/notbsd/android/b32/arm.rs diff --git a/src/unix/linux_like/android/b32/mod.rs b/src/unix/notbsd/android/b32/mod.rs index e8fd20e4..e8fd20e4 100644 --- a/src/unix/linux_like/android/b32/mod.rs +++ b/src/unix/notbsd/android/b32/mod.rs diff --git a/src/unix/linux_like/android/b32/x86.rs b/src/unix/notbsd/android/b32/x86.rs index a56fa004..a56fa004 100644 --- a/src/unix/linux_like/android/b32/x86.rs +++ b/src/unix/notbsd/android/b32/x86.rs diff --git a/src/unix/linux_like/android/b64/aarch64.rs b/src/unix/notbsd/android/b64/aarch64.rs index cb1c81b2..cb1c81b2 100644 --- a/src/unix/linux_like/android/b64/aarch64.rs +++ b/src/unix/notbsd/android/b64/aarch64.rs diff --git a/src/unix/linux_like/android/b64/mod.rs b/src/unix/notbsd/android/b64/mod.rs index d9759bda..d9759bda 100644 --- a/src/unix/linux_like/android/b64/mod.rs +++ b/src/unix/notbsd/android/b64/mod.rs diff --git a/src/unix/linux_like/android/b64/x86_64.rs b/src/unix/notbsd/android/b64/x86_64.rs index 2ab6080a..2ab6080a 100644 --- a/src/unix/linux_like/android/b64/x86_64.rs +++ b/src/unix/notbsd/android/b64/x86_64.rs diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/notbsd/android/mod.rs index 26622629..f4fb83de 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -785,7 +785,6 @@ pub const PTHREAD_MUTEX_ERRORCHECK: ::c_int = 2; pub const PTHREAD_MUTEX_DEFAULT: ::c_int = PTHREAD_MUTEX_NORMAL; pub const FIOCLEX: ::c_int = 0x5451; -pub const FIONCLEX: ::c_int = 0x5450; pub const SIGCHLD: ::c_int = 17; pub const SIGBUS: ::c_int = 7; diff --git a/src/unix/linux_like/emscripten/align.rs b/src/unix/notbsd/emscripten/align.rs index 26a49b23..26a49b23 100644 --- a/src/unix/linux_like/emscripten/align.rs +++ b/src/unix/notbsd/emscripten/align.rs diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/notbsd/emscripten/mod.rs index 63e3e13f..ba13d8eb 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/notbsd/emscripten/mod.rs @@ -1295,7 +1295,7 @@ pub const RTLD_GLOBAL: ::c_int = 0x100; pub const RTLD_NOLOAD: ::c_int = 0x4; // TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux -// kernel 3.10). See also linux_like/mod.rs +// kernel 3.10). See also notbsd/mod.rs pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; pub const CLOCK_TAI: ::clockid_t = 11; diff --git a/src/unix/linux_like/emscripten/no_align.rs b/src/unix/notbsd/emscripten/no_align.rs index ece4dff1..ece4dff1 100644 --- a/src/unix/linux_like/emscripten/no_align.rs +++ b/src/unix/notbsd/emscripten/no_align.rs diff --git a/src/unix/linux_like/linux/align.rs b/src/unix/notbsd/linux/align.rs index 0ff4649b..0ff4649b 100644 --- a/src/unix/linux_like/linux/align.rs +++ b/src/unix/notbsd/linux/align.rs diff --git a/src/unix/linux_like/linux/gnu/align.rs b/src/unix/notbsd/linux/mips/align.rs index 4a0e0746..4a0e0746 100644 --- a/src/unix/linux_like/linux/gnu/align.rs +++ b/src/unix/notbsd/linux/mips/align.rs diff --git a/src/unix/linux_like/linux/gnu/b32/mips.rs b/src/unix/notbsd/linux/mips/mips32.rs index f21b8c4c..d9d55891 100644 --- a/src/unix/linux_like/linux/gnu/b32/mips.rs +++ b/src/unix/notbsd/linux/mips/mips32.rs @@ -1,7 +1,60 @@ +use pthread_mutex_t; + pub type c_char = i8; +pub type c_long = i32; +pub type c_ulong = u32; +pub type clock_t = i32; +pub type time_t = i32; +pub type suseconds_t = i32; pub type wchar_t = i32; +pub type off_t = i32; +pub type ino_t = u32; +pub type blkcnt_t = i32; +pub type blksize_t = i32; +pub type nlink_t = u32; +pub type __u64 = ::c_ulonglong; s! { + pub struct aiocb { + pub aio_fildes: ::c_int, + pub aio_lio_opcode: ::c_int, + pub aio_reqprio: ::c_int, + pub aio_buf: *mut ::c_void, + pub aio_nbytes: ::size_t, + pub aio_sigevent: ::sigevent, + __next_prio: *mut aiocb, + __abs_prio: ::c_int, + __policy: ::c_int, + __error_code: ::c_int, + __return_value: ::ssize_t, + pub aio_offset: off_t, + __unused1: [::c_char; 4], + __glibc_reserved: [::c_char; 32] + } + + pub struct stat { + pub st_dev: ::c_ulong, + st_pad1: [::c_long; 3], + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::c_ulong, + pub st_pad2: [::c_long; 2], + pub st_size: ::off_t, + st_pad3: ::c_long, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + pub st_blksize: ::blksize_t, + pub st_blocks: ::blkcnt_t, + st_pad5: [::c_long; 14], + } + pub struct stat64 { pub st_dev: ::c_ulong, st_pad1: [::c_long; 3], @@ -25,21 +78,6 @@ s! { st_pad5: [::c_long; 14], } - pub struct statfs { - pub f_type: ::c_long, - pub f_bsize: ::c_long, - pub f_frsize: ::c_long, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_files: ::fsblkcnt_t, - pub f_ffree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_fsid: ::fsid_t, - - pub f_namelen: ::c_long, - f_spare: [::c_long; 6], - } - pub struct statfs64 { pub f_type: ::c_long, pub f_bsize: ::c_long, @@ -55,6 +93,22 @@ s! { pub f_spare: [::c_long; 5], } + pub struct statvfs { + pub f_bsize: ::c_ulong, + pub f_frsize: ::c_ulong, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_favail: ::fsfilcnt_t, + pub f_fsid: ::c_ulong, + __f_unused: ::c_int, + pub f_flag: ::c_ulong, + pub f_namemax: ::c_ulong, + __f_spare: [::c_int; 6], + } + pub struct statvfs64 { pub f_bsize: ::c_ulong, pub f_frsize: ::c_ulong, @@ -71,10 +125,14 @@ s! { __f_spare: [::c_int; 6], } + pub struct pthread_attr_t { + __size: [u32; 9] + } + pub struct sigaction { pub sa_flags: ::c_int, pub sa_sigaction: ::sighandler_t, - pub sa_mask: ::sigset_t, + pub sa_mask: sigset_t, pub sa_restorer: ::Option<extern fn()>, _resv: [::c_int; 1], } @@ -85,6 +143,10 @@ s! { pub ss_flags: ::c_int, } + pub struct sigset_t { + __val: [::c_ulong; 32], + } + pub struct siginfo_t { pub si_signo: ::c_int, pub si_code: ::c_int, @@ -144,6 +206,46 @@ s! { __glibc_reserved5: ::c_ulong, } + pub struct statfs { + pub f_type: ::c_long, + pub f_bsize: ::c_long, + pub f_frsize: ::c_long, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_files: ::fsblkcnt_t, + pub f_ffree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_fsid: ::fsid_t, + + pub f_namelen: ::c_long, + f_spare: [::c_long; 6], + } + + pub struct msghdr { + pub msg_name: *mut ::c_void, + pub msg_namelen: ::socklen_t, + pub msg_iov: *mut ::iovec, + pub msg_iovlen: ::size_t, + pub msg_control: *mut ::c_void, + pub msg_controllen: ::size_t, + pub msg_flags: ::c_int, + } + + pub struct cmsghdr { + pub cmsg_len: ::size_t, + pub cmsg_level: ::c_int, + pub cmsg_type: ::c_int, + } + + pub struct termios { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; ::NCCS], + } + pub struct flock { pub l_type: ::c_short, pub l_whence: ::c_short, @@ -154,20 +256,85 @@ s! { pad: [::c_long; 4], } - pub struct termios2 { - pub c_iflag: ::tcflag_t, - pub c_oflag: ::tcflag_t, - pub c_cflag: ::tcflag_t, - pub c_lflag: ::tcflag_t, - pub c_line: ::cc_t, - pub c_cc: [::cc_t; 23], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, + pub struct sysinfo { + pub uptime: ::c_long, + pub loads: [::c_ulong; 3], + pub totalram: ::c_ulong, + pub freeram: ::c_ulong, + pub sharedram: ::c_ulong, + pub bufferram: ::c_ulong, + pub totalswap: ::c_ulong, + pub freeswap: ::c_ulong, + pub procs: ::c_ushort, + pub pad: ::c_ushort, + pub totalhigh: ::c_ulong, + pub freehigh: ::c_ulong, + pub mem_unit: ::c_uint, + pub _f: [::c_char; 8], } } +pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 24; +pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 32; +pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; +pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; + +align_const! { + #[cfg(target_endian = "little")] + pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, + ], + }; + #[cfg(target_endian = "little")] + pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, + ], + }; + #[cfg(target_endian = "little")] + pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, + ], + }; + #[cfg(target_endian = "big")] + pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, + ], + }; + #[cfg(target_endian = "big")] + pub const PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, + 0, 0, 0, + ], + }; + #[cfg(target_endian = "big")] + pub const PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = + pthread_mutex_t { + size: [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, + 0, 0, 0, + ], + }; +} + pub const O_LARGEFILE: ::c_int = 0x2000; +pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff; + pub const SYS_syscall: ::c_long = 4000 + 0; pub const SYS_exit: ::c_long = 4000 + 1; pub const SYS_fork: ::c_long = 4000 + 2; @@ -526,368 +693,3 @@ pub const SYS_pwritev2: ::c_long = 4000 + 362; pub const SYS_pkey_mprotect: ::c_long = 4000 + 363; pub const SYS_pkey_alloc: ::c_long = 4000 + 364; pub const SYS_pkey_free: ::c_long = 4000 + 365; - -pub const O_DIRECT: ::c_int = 0x8000; -pub const O_DIRECTORY: ::c_int = 0x10000; -pub const O_NOFOLLOW: ::c_int = 0x20000; - -pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff; -pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 5; -pub const RLIMIT_AS: ::__rlimit_resource_t = 6; -pub const RLIMIT_RSS: ::__rlimit_resource_t = 7; -pub const RLIMIT_NPROC: ::__rlimit_resource_t = 8; -pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 9; - -pub const O_APPEND: ::c_int = 8; -pub const O_CREAT: ::c_int = 256; -pub const O_EXCL: ::c_int = 1024; -pub const O_NOCTTY: ::c_int = 2048; -pub const O_NONBLOCK: ::c_int = 128; -pub const O_SYNC: ::c_int = 0x4010; -pub const O_RSYNC: ::c_int = 0x4010; -pub const O_DSYNC: ::c_int = 0x10; -pub const O_FSYNC: ::c_int = 0x4010; -pub const O_ASYNC: ::c_int = 0x1000; -pub const O_NDELAY: ::c_int = 0x80; - -pub const EDEADLK: ::c_int = 45; -pub const ENAMETOOLONG: ::c_int = 78; -pub const ENOLCK: ::c_int = 46; -pub const ENOSYS: ::c_int = 89; -pub const ENOTEMPTY: ::c_int = 93; -pub const ELOOP: ::c_int = 90; -pub const ENOMSG: ::c_int = 35; -pub const EIDRM: ::c_int = 36; -pub const ECHRNG: ::c_int = 37; -pub const EL2NSYNC: ::c_int = 38; -pub const EL3HLT: ::c_int = 39; -pub const EL3RST: ::c_int = 40; -pub const ELNRNG: ::c_int = 41; -pub const EUNATCH: ::c_int = 42; -pub const ENOCSI: ::c_int = 43; -pub const EL2HLT: ::c_int = 44; -pub const EBADE: ::c_int = 50; -pub const EBADR: ::c_int = 51; -pub const EXFULL: ::c_int = 52; -pub const ENOANO: ::c_int = 53; -pub const EBADRQC: ::c_int = 54; -pub const EBADSLT: ::c_int = 55; -pub const EDEADLOCK: ::c_int = 56; -pub const EMULTIHOP: ::c_int = 74; -pub const EOVERFLOW: ::c_int = 79; -pub const ENOTUNIQ: ::c_int = 80; -pub const EBADFD: ::c_int = 81; -pub const EBADMSG: ::c_int = 77; -pub const EREMCHG: ::c_int = 82; -pub const ELIBACC: ::c_int = 83; -pub const ELIBBAD: ::c_int = 84; -pub const ELIBSCN: ::c_int = 85; -pub const ELIBMAX: ::c_int = 86; -pub const ELIBEXEC: ::c_int = 87; -pub const EILSEQ: ::c_int = 88; -pub const ERESTART: ::c_int = 91; -pub const ESTRPIPE: ::c_int = 92; -pub const EUSERS: ::c_int = 94; -pub const ENOTSOCK: ::c_int = 95; -pub const EDESTADDRREQ: ::c_int = 96; -pub const EMSGSIZE: ::c_int = 97; -pub const EPROTOTYPE: ::c_int = 98; -pub const ENOPROTOOPT: ::c_int = 99; -pub const EPROTONOSUPPORT: ::c_int = 120; -pub const ESOCKTNOSUPPORT: ::c_int = 121; -pub const EOPNOTSUPP: ::c_int = 122; -pub const EPFNOSUPPORT: ::c_int = 123; -pub const EAFNOSUPPORT: ::c_int = 124; -pub const EADDRINUSE: ::c_int = 125; -pub const EADDRNOTAVAIL: ::c_int = 126; -pub const ENETDOWN: ::c_int = 127; -pub const ENETUNREACH: ::c_int = 128; -pub const ENETRESET: ::c_int = 129; -pub const ECONNABORTED: ::c_int = 130; -pub const ECONNRESET: ::c_int = 131; -pub const ENOBUFS: ::c_int = 132; -pub const EISCONN: ::c_int = 133; -pub const ENOTCONN: ::c_int = 134; -pub const ESHUTDOWN: ::c_int = 143; -pub const ETOOMANYREFS: ::c_int = 144; -pub const ETIMEDOUT: ::c_int = 145; -pub const ECONNREFUSED: ::c_int = 146; -pub const EHOSTDOWN: ::c_int = 147; -pub const EHOSTUNREACH: ::c_int = 148; -pub const EALREADY: ::c_int = 149; -pub const EINPROGRESS: ::c_int = 150; -pub const ESTALE: ::c_int = 151; -pub const EUCLEAN: ::c_int = 135; -pub const ENOTNAM: ::c_int = 137; -pub const ENAVAIL: ::c_int = 138; -pub const EISNAM: ::c_int = 139; -pub const EREMOTEIO: ::c_int = 140; -pub const EDQUOT: ::c_int = 1133; -pub const ENOMEDIUM: ::c_int = 159; -pub const EMEDIUMTYPE: ::c_int = 160; -pub const ECANCELED: ::c_int = 158; -pub const ENOKEY: ::c_int = 161; -pub const EKEYEXPIRED: ::c_int = 162; -pub const EKEYREVOKED: ::c_int = 163; -pub const EKEYREJECTED: ::c_int = 164; -pub const EOWNERDEAD: ::c_int = 165; -pub const ENOTRECOVERABLE: ::c_int = 166; -pub const ERFKILL: ::c_int = 167; - -pub const MAP_NORESERVE: ::c_int = 0x400; -pub const MAP_ANON: ::c_int = 0x800; -pub const MAP_ANONYMOUS: ::c_int = 0x800; -pub const MAP_GROWSDOWN: ::c_int = 0x1000; -pub const MAP_DENYWRITE: ::c_int = 0x2000; -pub const MAP_EXECUTABLE: ::c_int = 0x4000; -pub const MAP_LOCKED: ::c_int = 0x8000; -pub const MAP_POPULATE: ::c_int = 0x10000; -pub const MAP_NONBLOCK: ::c_int = 0x20000; -pub const MAP_STACK: ::c_int = 0x40000; - -pub const SOCK_STREAM: ::c_int = 2; -pub const SOCK_DGRAM: ::c_int = 1; - -pub const SOL_SOCKET: ::c_int = 0xffff; - -pub const SO_REUSEADDR: ::c_int = 0x0004; -pub const SO_KEEPALIVE: ::c_int = 0x0008; -pub const SO_DONTROUTE: ::c_int = 0x0010; -pub const SO_BROADCAST: ::c_int = 0x0020; -pub const SO_LINGER: ::c_int = 0x0080; -pub const SO_OOBINLINE: ::c_int = 0x0100; -pub const SO_REUSEPORT: ::c_int = 0x0200; -pub const SO_TYPE: ::c_int = 0x1008; -pub const SO_STYLE: ::c_int = SO_TYPE; -pub const SO_ERROR: ::c_int = 0x1007; -pub const SO_SNDBUF: ::c_int = 0x1001; -pub const SO_RCVBUF: ::c_int = 0x1002; -pub const SO_SNDLOWAT: ::c_int = 0x1003; -pub const SO_RCVLOWAT: ::c_int = 0x1004; -pub const SO_SNDTIMEO: ::c_int = 0x1005; -pub const SO_RCVTIMEO: ::c_int = 0x1006; -pub const SO_ACCEPTCONN: ::c_int = 0x1009; -pub const SO_PROTOCOL: ::c_int = 0x1028; -pub const SO_DOMAIN: ::c_int = 0x1029; -pub const SO_NO_CHECK: ::c_int = 11; -pub const SO_PASSCRED: ::c_int = 17; -pub const SO_PEERCRED: ::c_int = 18; -pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22; -pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23; -pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24; -pub const SO_ATTACH_FILTER: ::c_int = 26; -pub const SO_DETACH_FILTER: ::c_int = 27; -pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER; -pub const SO_PEERNAME: ::c_int = 28; -pub const SO_PEERSEC: ::c_int = 30; -pub const SO_SNDBUFFORCE: ::c_int = 31; -pub const SO_RCVBUFFORCE: ::c_int = 33; -pub const SO_PASSSEC: ::c_int = 34; -pub const SO_TIMESTAMPNS: ::c_int = 35; -pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS; - -pub const SO_WIFI_STATUS: ::c_int = 41; -pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS; -pub const SO_NOFCS: ::c_int = 43; -pub const SO_LOCK_FILTER: ::c_int = 44; -pub const SO_SELECT_ERR_QUEUE: ::c_int = 45; -pub const SO_MAX_PACING_RATE: ::c_int = 47; -pub const SO_BPF_EXTENSIONS: ::c_int = 48; -pub const SO_INCOMING_CPU: ::c_int = 49; -pub const SO_ATTACH_BPF: ::c_int = 50; -pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER; - -pub const FIOCLEX: ::c_ulong = 0x6601; -pub const FIONCLEX: ::c_ulong = 0x6602; -pub const FIONBIO: ::c_ulong = 0x667e; - -pub const SA_SIGINFO: ::c_int = 0x00000008; -pub const SA_NOCLDWAIT: ::c_int = 0x00010000; - -pub const SIGCHLD: ::c_int = 18; -pub const SIGBUS: ::c_int = 10; -pub const SIGTTIN: ::c_int = 26; -pub const SIGTTOU: ::c_int = 27; -pub const SIGXCPU: ::c_int = 30; -pub const SIGXFSZ: ::c_int = 31; -pub const SIGVTALRM: ::c_int = 28; -pub const SIGPROF: ::c_int = 29; -pub const SIGWINCH: ::c_int = 20; -pub const SIGUSR1: ::c_int = 16; -pub const SIGUSR2: ::c_int = 17; -pub const SIGCONT: ::c_int = 25; -pub const SIGSTOP: ::c_int = 23; -pub const SIGTSTP: ::c_int = 24; -pub const SIGURG: ::c_int = 21; -pub const SIGIO: ::c_int = 22; -pub const SIGSYS: ::c_int = 12; -pub const SIGPOLL: ::c_int = 22; -pub const SIGPWR: ::c_int = 19; -pub const SIG_SETMASK: ::c_int = 3; -pub const SIG_BLOCK: ::c_int = 0x1; -pub const SIG_UNBLOCK: ::c_int = 0x2; - -pub const POLLWRNORM: ::c_short = 0x004; -pub const POLLWRBAND: ::c_short = 0x100; - -pub const VEOF: usize = 16; -pub const VEOL: usize = 17; -pub const VEOL2: usize = 6; -pub const VMIN: usize = 4; -pub const IEXTEN: ::tcflag_t = 0x00000100; -pub const TOSTOP: ::tcflag_t = 0x00008000; -pub const FLUSHO: ::tcflag_t = 0x00002000; -pub const EXTPROC: ::tcflag_t = 0o200000; -pub const TCSANOW: ::c_int = 0x540e; -pub const TCSADRAIN: ::c_int = 0x540f; -pub const TCSAFLUSH: ::c_int = 0x5410; - -pub const PTRACE_GETFPXREGS: ::c_uint = 18; -pub const PTRACE_SETFPXREGS: ::c_uint = 19; - -pub const MAP_HUGETLB: ::c_int = 0x080000; - -pub const EFD_NONBLOCK: ::c_int = 0x80; - -pub const F_GETLK: ::c_int = 14; -pub const F_GETOWN: ::c_int = 23; -pub const F_SETOWN: ::c_int = 24; - -pub const SFD_NONBLOCK: ::c_int = 0x80; - -pub const TCGETS: ::c_ulong = 0x540d; -pub const TCSETS: ::c_ulong = 0x540e; -pub const TCSETSW: ::c_ulong = 0x540f; -pub const TCSETSF: ::c_ulong = 0x5410; -pub const TCGETA: ::c_ulong = 0x5401; -pub const TCSETA: ::c_ulong = 0x5402; -pub const TCSETAW: ::c_ulong = 0x5403; -pub const TCSETAF: ::c_ulong = 0x5404; -pub const TCSBRK: ::c_ulong = 0x5405; -pub const TCXONC: ::c_ulong = 0x5406; -pub const TCFLSH: ::c_ulong = 0x5407; -pub const TIOCGSOFTCAR: ::c_ulong = 0x5481; -pub const TIOCSSOFTCAR: ::c_ulong = 0x5482; -pub const TIOCINQ: ::c_ulong = 0x467f; -pub const TIOCLINUX: ::c_ulong = 0x5483; -pub const TIOCGSERIAL: ::c_ulong = 0x5484; -pub const TIOCEXCL: ::c_ulong = 0x740d; -pub const TIOCNXCL: ::c_ulong = 0x740e; -pub const TIOCSCTTY: ::c_ulong = 0x5480; -pub const TIOCGPGRP: ::c_ulong = 0x40047477; -pub const TIOCSPGRP: ::c_ulong = 0x80047476; -pub const TIOCOUTQ: ::c_ulong = 0x7472; -pub const TIOCSTI: ::c_ulong = 0x5472; -pub const TIOCGWINSZ: ::c_ulong = 0x40087468; -pub const TIOCSWINSZ: ::c_ulong = 0x80087467; -pub const TIOCMGET: ::c_ulong = 0x741d; -pub const TIOCMBIS: ::c_ulong = 0x741b; -pub const TIOCMBIC: ::c_ulong = 0x741c; -pub const TIOCMSET: ::c_ulong = 0x741a; -pub const FIONREAD: ::c_ulong = 0x467f; -pub const TIOCCONS: ::c_ulong = 0x80047478; - -pub const RTLD_DEEPBIND: ::c_int = 0x10; -pub const RTLD_GLOBAL: ::c_int = 0x4; -pub const RTLD_NOLOAD: ::c_int = 0x8; - -pub const MCL_CURRENT: ::c_int = 0x0001; -pub const MCL_FUTURE: ::c_int = 0x0002; - -pub const SIGSTKSZ: ::size_t = 8192; -pub const MINSIGSTKSZ: ::size_t = 2048; -pub const CBAUD: ::tcflag_t = 0o0010017; -pub const TAB1: ::tcflag_t = 0x00000800; -pub const TAB2: ::tcflag_t = 0x00001000; -pub const TAB3: ::tcflag_t = 0x00001800; -pub const CR1: ::tcflag_t = 0x00000200; -pub const CR2: ::tcflag_t = 0x00000400; -pub const CR3: ::tcflag_t = 0x00000600; -pub const FF1: ::tcflag_t = 0x00008000; -pub const BS1: ::tcflag_t = 0x00002000; -pub const VT1: ::tcflag_t = 0x00004000; -pub const VWERASE: usize = 14; -pub const VREPRINT: usize = 12; -pub const VSUSP: usize = 10; -pub const VSTART: usize = 8; -pub const VSTOP: usize = 9; -pub const VDISCARD: usize = 13; -pub const VTIME: usize = 5; -pub const IXON: ::tcflag_t = 0x00000400; -pub const IXOFF: ::tcflag_t = 0x00001000; -pub const ONLCR: ::tcflag_t = 0x4; -pub const CSIZE: ::tcflag_t = 0x00000030; -pub const CS6: ::tcflag_t = 0x00000010; -pub const CS7: ::tcflag_t = 0x00000020; -pub const CS8: ::tcflag_t = 0x00000030; -pub const CSTOPB: ::tcflag_t = 0x00000040; -pub const CREAD: ::tcflag_t = 0x00000080; -pub const PARENB: ::tcflag_t = 0x00000100; -pub const PARODD: ::tcflag_t = 0x00000200; -pub const HUPCL: ::tcflag_t = 0x00000400; -pub const CLOCAL: ::tcflag_t = 0x00000800; -pub const ECHOKE: ::tcflag_t = 0x00000800; -pub const ECHOE: ::tcflag_t = 0x00000010; -pub const ECHOK: ::tcflag_t = 0x00000020; -pub const ECHONL: ::tcflag_t = 0x00000040; -pub const ECHOPRT: ::tcflag_t = 0x00000400; -pub const ECHOCTL: ::tcflag_t = 0x00000200; -pub const ISIG: ::tcflag_t = 0x00000001; -pub const ICANON: ::tcflag_t = 0x00000002; -pub const PENDIN: ::tcflag_t = 0x00004000; -pub const NOFLSH: ::tcflag_t = 0x00000080; -pub const CIBAUD: ::tcflag_t = 0o02003600000; -pub const CBAUDEX: ::tcflag_t = 0o010000; -pub const VSWTC: usize = 7; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const XTABS: ::tcflag_t = 0o014000; - -pub const B0: ::speed_t = 0o000000; -pub const B50: ::speed_t = 0o000001; -pub const B75: ::speed_t = 0o000002; -pub const B110: ::speed_t = 0o000003; -pub const B134: ::speed_t = 0o000004; -pub const B150: ::speed_t = 0o000005; -pub const B200: ::speed_t = 0o000006; -pub const B300: ::speed_t = 0o000007; -pub const B600: ::speed_t = 0o000010; -pub const B1200: ::speed_t = 0o000011; -pub const B1800: ::speed_t = 0o000012; -pub const B2400: ::speed_t = 0o000013; -pub const B4800: ::speed_t = 0o000014; -pub const B9600: ::speed_t = 0o000015; -pub const B19200: ::speed_t = 0o000016; -pub const B38400: ::speed_t = 0o000017; -pub const EXTA: ::speed_t = B19200; -pub const EXTB: ::speed_t = B38400; -pub const BOTHER: ::speed_t = 0o010000; -pub const B57600: ::speed_t = 0o010001; -pub const B115200: ::speed_t = 0o010002; -pub const B230400: ::speed_t = 0o010003; -pub const B460800: ::speed_t = 0o010004; -pub const B500000: ::speed_t = 0o010005; -pub const B576000: ::speed_t = 0o010006; -pub const B921600: ::speed_t = 0o010007; -pub const B1000000: ::speed_t = 0o010010; -pub const B1152000: ::speed_t = 0o010011; -pub const B1500000: ::speed_t = 0o010012; -pub const B2000000: ::speed_t = 0o010013; -pub const B2500000: ::speed_t = 0o010014; -pub const B3000000: ::speed_t = 0o010015; -pub const B3500000: ::speed_t = 0o010016; -pub const B4000000: ::speed_t = 0o010017; - -pub const TIOCM_ST: ::c_int = 0x010; -pub const TIOCM_SR: ::c_int = 0x020; -pub const TIOCM_CTS: ::c_int = 0x040; -pub const TIOCM_CAR: ::c_int = 0x100; -pub const TIOCM_RNG: ::c_int = 0x200; -pub const TIOCM_DSR: ::c_int = 0x400; - -pub const EHWPOISON: ::c_int = 168; diff --git a/src/unix/linux_like/linux/gnu/b64/mips64.rs b/src/unix/notbsd/linux/mips/mips64.rs index baaa3300..f480e50a 100644 --- a/src/unix/linux_like/linux/gnu/b64/mips64.rs +++ b/src/unix/notbsd/linux/mips/mips64.rs @@ -1,15 +1,36 @@ use pthread_mutex_t; +pub type blkcnt_t = i64; pub type blksize_t = i64; pub type c_char = i8; pub type c_long = i64; pub type c_ulong = u64; +pub type ino_t = u64; pub type nlink_t = u64; +pub type off_t = i64; pub type suseconds_t = i64; +pub type time_t = i64; pub type wchar_t = i32; +pub type clock_t = i64; pub type __u64 = ::c_ulong; s! { + pub struct aiocb { + pub aio_fildes: ::c_int, + pub aio_lio_opcode: ::c_int, + pub aio_reqprio: ::c_int, + pub aio_buf: *mut ::c_void, + pub aio_nbytes: ::size_t, + pub aio_sigevent: ::sigevent, + __next_prio: *mut aiocb, + __abs_prio: ::c_int, + __policy: ::c_int, + __error_code: ::c_int, + __return_value: ::ssize_t, + pub aio_offset: off_t, + __glibc_reserved: [::c_char; 32] + } + pub struct stat { pub st_dev: ::c_ulong, st_pad1: [::c_long; 2], @@ -34,29 +55,6 @@ s! { st_pad5: [::c_long; 7], } - pub struct statfs { - pub f_type: ::c_long, - pub f_bsize: ::c_long, - pub f_frsize: ::c_long, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_files: ::fsblkcnt_t, - pub f_ffree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_fsid: ::fsid_t, - - pub f_namelen: ::c_long, - f_spare: [::c_long; 6], - } - - pub struct flock { - pub l_type: ::c_short, - pub l_whence: ::c_short, - pub l_start: ::off_t, - pub l_len: ::off_t, - pub l_pid: ::pid_t, - } - pub struct stat64 { pub st_dev: ::c_ulong, st_pad1: [::c_long; 2], @@ -132,7 +130,7 @@ s! { pub struct sigaction { pub sa_flags: ::c_int, pub sa_sigaction: ::sighandler_t, - pub sa_mask: ::sigset_t, + pub sa_mask: sigset_t, pub sa_restorer: ::Option<extern fn()>, } @@ -142,6 +140,10 @@ s! { pub ss_flags: ::c_int, } + pub struct sigset_t { + __size: [::c_ulong; 16], + } + pub struct siginfo_t { pub si_signo: ::c_int, pub si_code: ::c_int, @@ -176,15 +178,83 @@ s! { __unused5: ::c_ulong } - pub struct termios2 { + pub struct msqid_ds { + pub msg_perm: ::ipc_perm, + pub msg_stime: ::time_t, + pub msg_rtime: ::time_t, + pub msg_ctime: ::time_t, + __msg_cbytes: ::c_ulong, + pub msg_qnum: ::msgqnum_t, + pub msg_qbytes: ::msglen_t, + pub msg_lspid: ::pid_t, + pub msg_lrpid: ::pid_t, + __glibc_reserved4: ::c_ulong, + __glibc_reserved5: ::c_ulong, + } + + pub struct statfs { + pub f_type: ::c_long, + pub f_bsize: ::c_long, + pub f_frsize: ::c_long, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_files: ::fsblkcnt_t, + pub f_ffree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_fsid: ::fsid_t, + + pub f_namelen: ::c_long, + f_spare: [::c_long; 6], + } + + pub struct msghdr { + pub msg_name: *mut ::c_void, + pub msg_namelen: ::socklen_t, + pub msg_iov: *mut ::iovec, + pub msg_iovlen: ::size_t, + pub msg_control: *mut ::c_void, + pub msg_controllen: ::size_t, + pub msg_flags: ::c_int, + } + + pub struct cmsghdr { + pub cmsg_len: ::size_t, + pub cmsg_level: ::c_int, + pub cmsg_type: ::c_int, + } + + pub struct termios { pub c_iflag: ::tcflag_t, pub c_oflag: ::tcflag_t, pub c_cflag: ::tcflag_t, pub c_lflag: ::tcflag_t, pub c_line: ::cc_t, - pub c_cc: [::cc_t; 23], - pub c_ispeed: ::speed_t, - pub c_ospeed: ::speed_t, + pub c_cc: [::cc_t; ::NCCS], + } + + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } + + pub struct sysinfo { + pub uptime: ::c_long, + pub loads: [::c_ulong; 3], + pub totalram: ::c_ulong, + pub freeram: ::c_ulong, + pub sharedram: ::c_ulong, + pub bufferram: ::c_ulong, + pub totalswap: ::c_ulong, + pub freeswap: ::c_ulong, + pub procs: ::c_ushort, + pub pad: ::c_ushort, + pub totalhigh: ::c_ulong, + pub freehigh: ::c_ulong, + pub mem_unit: ::c_uint, + pub _f: [::c_char; 0], } } @@ -192,6 +262,7 @@ pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; +pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; align_const! { #[cfg(target_endian = "little")] @@ -244,6 +315,10 @@ align_const! { }; } +pub const O_LARGEFILE: ::c_int = 0; + +pub const RLIM_INFINITY: ::rlim_t = 0xffff_ffff_ffff_ffff; + pub const SYS_read: ::c_long = 5000 + 0; pub const SYS_write: ::c_long = 5000 + 1; pub const SYS_open: ::c_long = 5000 + 2; @@ -568,433 +643,3 @@ pub const SYS_pwritev2: ::c_long = 5000 + 322; pub const SYS_pkey_mprotect: ::c_long = 5000 + 323; pub const SYS_pkey_alloc: ::c_long = 5000 + 324; pub const SYS_pkey_free: ::c_long = 5000 + 325; - -pub const SFD_CLOEXEC: ::c_int = 0x080000; - -pub const NCCS: usize = 32; - -pub const O_TRUNC: ::c_int = 512; - -pub const O_NOATIME: ::c_int = 0o1000000; -pub const O_CLOEXEC: ::c_int = 0x80000; -pub const O_PATH: ::c_int = 0o10000000; -pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; - -pub const EBFONT: ::c_int = 59; -pub const ENOSTR: ::c_int = 60; -pub const ENODATA: ::c_int = 61; -pub const ETIME: ::c_int = 62; -pub const ENOSR: ::c_int = 63; -pub const ENONET: ::c_int = 64; -pub const ENOPKG: ::c_int = 65; -pub const EREMOTE: ::c_int = 66; -pub const ENOLINK: ::c_int = 67; -pub const EADV: ::c_int = 68; -pub const ESRMNT: ::c_int = 69; -pub const ECOMM: ::c_int = 70; -pub const EPROTO: ::c_int = 71; -pub const EDOTDOT: ::c_int = 73; - -pub const SA_NODEFER: ::c_int = 0x40000000; -pub const SA_RESETHAND: ::c_int = 0x80000000; -pub const SA_RESTART: ::c_int = 0x10000000; -pub const SA_NOCLDSTOP: ::c_int = 0x00000001; - -pub const POSIX_FADV_DONTNEED: ::c_int = 4; -pub const POSIX_FADV_NOREUSE: ::c_int = 5; - -pub const EPOLL_CLOEXEC: ::c_int = 0x80000; - -pub const EFD_CLOEXEC: ::c_int = 0x80000; - -pub const O_DIRECT: ::c_int = 0x8000; -pub const O_DIRECTORY: ::c_int = 0x10000; -pub const O_NOFOLLOW: ::c_int = 0x20000; - -pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 5; -pub const RLIMIT_AS: ::__rlimit_resource_t = 6; -pub const RLIMIT_RSS: ::__rlimit_resource_t = 7; -pub const RLIMIT_NPROC: ::__rlimit_resource_t = 8; -pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 9; - -pub const O_APPEND: ::c_int = 8; -pub const O_CREAT: ::c_int = 256; -pub const O_EXCL: ::c_int = 1024; -pub const O_NOCTTY: ::c_int = 2048; -pub const O_NONBLOCK: ::c_int = 128; -pub const O_SYNC: ::c_int = 0x4010; -pub const O_RSYNC: ::c_int = 0x4010; -pub const O_DSYNC: ::c_int = 0x10; -pub const O_FSYNC: ::c_int = 0x4010; -pub const O_ASYNC: ::c_int = 0x1000; -pub const O_NDELAY: ::c_int = 0x80; - -pub const EDEADLK: ::c_int = 45; -pub const ENAMETOOLONG: ::c_int = 78; -pub const ENOLCK: ::c_int = 46; -pub const ENOSYS: ::c_int = 89; -pub const ENOTEMPTY: ::c_int = 93; -pub const ELOOP: ::c_int = 90; -pub const ENOMSG: ::c_int = 35; -pub const EIDRM: ::c_int = 36; -pub const ECHRNG: ::c_int = 37; -pub const EL2NSYNC: ::c_int = 38; -pub const EL3HLT: ::c_int = 39; -pub const EL3RST: ::c_int = 40; -pub const ELNRNG: ::c_int = 41; -pub const EUNATCH: ::c_int = 42; -pub const ENOCSI: ::c_int = 43; -pub const EL2HLT: ::c_int = 44; -pub const EBADE: ::c_int = 50; -pub const EBADR: ::c_int = 51; -pub const EXFULL: ::c_int = 52; -pub const ENOANO: ::c_int = 53; -pub const EBADRQC: ::c_int = 54; -pub const EBADSLT: ::c_int = 55; -pub const EDEADLOCK: ::c_int = 56; -pub const EMULTIHOP: ::c_int = 74; -pub const EOVERFLOW: ::c_int = 79; -pub const ENOTUNIQ: ::c_int = 80; -pub const EBADFD: ::c_int = 81; -pub const EBADMSG: ::c_int = 77; -pub const EREMCHG: ::c_int = 82; -pub const ELIBACC: ::c_int = 83; -pub const ELIBBAD: ::c_int = 84; -pub const ELIBSCN: ::c_int = 85; -pub const ELIBMAX: ::c_int = 86; -pub const ELIBEXEC: ::c_int = 87; -pub const EILSEQ: ::c_int = 88; -pub const ERESTART: ::c_int = 91; -pub const ESTRPIPE: ::c_int = 92; -pub const EUSERS: ::c_int = 94; -pub const ENOTSOCK: ::c_int = 95; -pub const EDESTADDRREQ: ::c_int = 96; -pub const EMSGSIZE: ::c_int = 97; -pub const EPROTOTYPE: ::c_int = 98; -pub const ENOPROTOOPT: ::c_int = 99; -pub const EPROTONOSUPPORT: ::c_int = 120; -pub const ESOCKTNOSUPPORT: ::c_int = 121; -pub const EOPNOTSUPP: ::c_int = 122; -pub const EPFNOSUPPORT: ::c_int = 123; -pub const EAFNOSUPPORT: ::c_int = 124; -pub const EADDRINUSE: ::c_int = 125; -pub const EADDRNOTAVAIL: ::c_int = 126; -pub const ENETDOWN: ::c_int = 127; -pub const ENETUNREACH: ::c_int = 128; -pub const ENETRESET: ::c_int = 129; -pub const ECONNABORTED: ::c_int = 130; -pub const ECONNRESET: ::c_int = 131; -pub const ENOBUFS: ::c_int = 132; -pub const EISCONN: ::c_int = 133; -pub const ENOTCONN: ::c_int = 134; -pub const ESHUTDOWN: ::c_int = 143; -pub const ETOOMANYREFS: ::c_int = 144; -pub const ETIMEDOUT: ::c_int = 145; -pub const ECONNREFUSED: ::c_int = 146; -pub const EHOSTDOWN: ::c_int = 147; -pub const EHOSTUNREACH: ::c_int = 148; -pub const EALREADY: ::c_int = 149; -pub const EINPROGRESS: ::c_int = 150; -pub const ESTALE: ::c_int = 151; -pub const EUCLEAN: ::c_int = 135; -pub const ENOTNAM: ::c_int = 137; -pub const ENAVAIL: ::c_int = 138; -pub const EISNAM: ::c_int = 139; -pub const EREMOTEIO: ::c_int = 140; -pub const EDQUOT: ::c_int = 1133; -pub const ENOMEDIUM: ::c_int = 159; -pub const EMEDIUMTYPE: ::c_int = 160; -pub const ECANCELED: ::c_int = 158; -pub const ENOKEY: ::c_int = 161; -pub const EKEYEXPIRED: ::c_int = 162; -pub const EKEYREVOKED: ::c_int = 163; -pub const EKEYREJECTED: ::c_int = 164; -pub const EOWNERDEAD: ::c_int = 165; -pub const ENOTRECOVERABLE: ::c_int = 166; -pub const ERFKILL: ::c_int = 167; - -pub const MAP_NORESERVE: ::c_int = 0x400; -pub const MAP_ANON: ::c_int = 0x800; -pub const MAP_ANONYMOUS: ::c_int = 0x800; -pub const MAP_GROWSDOWN: ::c_int = 0x1000; -pub const MAP_DENYWRITE: ::c_int = 0x2000; -pub const MAP_EXECUTABLE: ::c_int = 0x4000; -pub const MAP_LOCKED: ::c_int = 0x8000; -pub const MAP_POPULATE: ::c_int = 0x10000; -pub const MAP_NONBLOCK: ::c_int = 0x20000; -pub const MAP_STACK: ::c_int = 0x40000; -pub const MAP_HUGETLB: ::c_int = 0x080000; - -pub const SOCK_STREAM: ::c_int = 2; -pub const SOCK_DGRAM: ::c_int = 1; - -pub const SOL_SOCKET: ::c_int = 0xffff; - -pub const SO_REUSEADDR: ::c_int = 0x0004; -pub const SO_KEEPALIVE: ::c_int = 0x0008; -pub const SO_DONTROUTE: ::c_int = 0x0010; -pub const SO_BROADCAST: ::c_int = 0x0020; -pub const SO_LINGER: ::c_int = 0x0080; -pub const SO_OOBINLINE: ::c_int = 0x0100; -pub const SO_REUSEPORT: ::c_int = 0x0200; -pub const SO_TYPE: ::c_int = 0x1008; -pub const SO_STYLE: ::c_int = SO_TYPE; -pub const SO_ERROR: ::c_int = 0x1007; -pub const SO_SNDBUF: ::c_int = 0x1001; -pub const SO_RCVBUF: ::c_int = 0x1002; -pub const SO_SNDLOWAT: ::c_int = 0x1003; -pub const SO_RCVLOWAT: ::c_int = 0x1004; -pub const SO_SNDTIMEO: ::c_int = 0x1005; -pub const SO_RCVTIMEO: ::c_int = 0x1006; -pub const SO_ACCEPTCONN: ::c_int = 0x1009; -pub const SO_PROTOCOL: ::c_int = 0x1028; -pub const SO_DOMAIN: ::c_int = 0x1029; -pub const SO_NO_CHECK: ::c_int = 11; -pub const SO_PRIORITY: ::c_int = 12; -pub const SO_BSDCOMPAT: ::c_int = 14; -pub const SO_PASSCRED: ::c_int = 17; -pub const SO_PEERCRED: ::c_int = 18; -pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22; -pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23; -pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24; -pub const SO_BINDTODEVICE: ::c_int = 25; -pub const SO_ATTACH_FILTER: ::c_int = 26; -pub const SO_DETACH_FILTER: ::c_int = 27; -pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER; -pub const SO_PEERNAME: ::c_int = 28; -pub const SO_TIMESTAMP: ::c_int = 29; -pub const SO_PEERSEC: ::c_int = 30; -pub const SO_SNDBUFFORCE: ::c_int = 31; -pub const SO_RCVBUFFORCE: ::c_int = 33; -pub const SO_PASSSEC: ::c_int = 34; -pub const SO_TIMESTAMPNS: ::c_int = 35; -pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS; -pub const SO_MARK: ::c_int = 36; -pub const SO_RXQ_OVFL: ::c_int = 40; -pub const SO_WIFI_STATUS: ::c_int = 41; -pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS; -pub const SO_PEEK_OFF: ::c_int = 42; -pub const SO_NOFCS: ::c_int = 43; -pub const SO_LOCK_FILTER: ::c_int = 44; -pub const SO_SELECT_ERR_QUEUE: ::c_int = 45; -pub const SO_BUSY_POLL: ::c_int = 46; -pub const SO_MAX_PACING_RATE: ::c_int = 47; -pub const SO_BPF_EXTENSIONS: ::c_int = 48; -pub const SO_INCOMING_CPU: ::c_int = 49; -pub const SO_ATTACH_BPF: ::c_int = 50; -pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER; - -pub const FIOCLEX: ::c_ulong = 0x6601; -pub const FIONCLEX: ::c_ulong = 0x6602; -pub const FIONBIO: ::c_ulong = 0x667e; - -pub const SA_ONSTACK: ::c_int = 0x08000000; -pub const SA_SIGINFO: ::c_int = 0x00000008; -pub const SA_NOCLDWAIT: ::c_int = 0x00010000; - -pub const SIGCHLD: ::c_int = 18; -pub const SIGBUS: ::c_int = 10; -pub const SIGTTIN: ::c_int = 26; -pub const SIGTTOU: ::c_int = 27; -pub const SIGXCPU: ::c_int = 30; -pub const SIGXFSZ: ::c_int = 31; -pub const SIGVTALRM: ::c_int = 28; -pub const SIGPROF: ::c_int = 29; -pub const SIGWINCH: ::c_int = 20; -pub const SIGUSR1: ::c_int = 16; -pub const SIGUSR2: ::c_int = 17; -pub const SIGCONT: ::c_int = 25; -pub const SIGSTOP: ::c_int = 23; -pub const SIGTSTP: ::c_int = 24; -pub const SIGURG: ::c_int = 21; -pub const SIGIO: ::c_int = 22; -pub const SIGSYS: ::c_int = 12; -pub const SIGPOLL: ::c_int = 22; -pub const SIGPWR: ::c_int = 19; -pub const SIG_SETMASK: ::c_int = 3; -pub const SIG_BLOCK: ::c_int = 0x1; -pub const SIG_UNBLOCK: ::c_int = 0x2; - -pub const POLLWRNORM: ::c_short = 0x004; -pub const POLLWRBAND: ::c_short = 0x100; - -pub const VEOF: usize = 16; -pub const VEOL: usize = 17; -pub const VEOL2: usize = 6; -pub const VMIN: usize = 4; -pub const IEXTEN: ::tcflag_t = 0x00000100; -pub const TOSTOP: ::tcflag_t = 0x00008000; -pub const FLUSHO: ::tcflag_t = 0x00002000; -pub const EXTPROC: ::tcflag_t = 0o200000; -pub const TCSANOW: ::c_int = 0x540e; -pub const TCSADRAIN: ::c_int = 0x540f; -pub const TCSAFLUSH: ::c_int = 0x5410; - -pub const PTRACE_GETFPREGS: ::c_uint = 14; -pub const PTRACE_SETFPREGS: ::c_uint = 15; -pub const PTRACE_DETACH: ::c_uint = 17; -pub const PTRACE_GETFPXREGS: ::c_uint = 18; -pub const PTRACE_SETFPXREGS: ::c_uint = 19; -pub const PTRACE_GETREGS: ::c_uint = 12; -pub const PTRACE_SETREGS: ::c_uint = 13; - -pub const EFD_NONBLOCK: ::c_int = 0x80; - -pub const F_RDLCK: ::c_int = 0; -pub const F_WRLCK: ::c_int = 1; -pub const F_UNLCK: ::c_int = 2; -pub const F_GETLK: ::c_int = 14; -pub const F_GETOWN: ::c_int = 23; -pub const F_SETOWN: ::c_int = 24; -pub const F_SETLK: ::c_int = 6; -pub const F_SETLKW: ::c_int = 7; - -pub const SFD_NONBLOCK: ::c_int = 0x80; - -pub const TCGETS: ::c_ulong = 0x540d; -pub const TCSETS: ::c_ulong = 0x540e; -pub const TCSETSW: ::c_ulong = 0x540f; -pub const TCSETSF: ::c_ulong = 0x5410; -pub const TCGETA: ::c_ulong = 0x5401; -pub const TCSETA: ::c_ulong = 0x5402; -pub const TCSETAW: ::c_ulong = 0x5403; -pub const TCSETAF: ::c_ulong = 0x5404; -pub const TCSBRK: ::c_ulong = 0x5405; -pub const TCXONC: ::c_ulong = 0x5406; -pub const TCFLSH: ::c_ulong = 0x5407; -pub const TIOCGSOFTCAR: ::c_ulong = 0x5481; -pub const TIOCSSOFTCAR: ::c_ulong = 0x5482; -pub const TIOCINQ: ::c_ulong = 0x467f; -pub const TIOCLINUX: ::c_ulong = 0x5483; -pub const TIOCGSERIAL: ::c_ulong = 0x5484; -pub const TIOCEXCL: ::c_ulong = 0x740d; -pub const TIOCNXCL: ::c_ulong = 0x740e; -pub const TIOCSCTTY: ::c_ulong = 0x5480; -pub const TIOCGPGRP: ::c_ulong = 0x40047477; -pub const TIOCSPGRP: ::c_ulong = 0x80047476; -pub const TIOCOUTQ: ::c_ulong = 0x7472; -pub const TIOCSTI: ::c_ulong = 0x5472; -pub const TIOCGWINSZ: ::c_ulong = 0x40087468; -pub const TIOCSWINSZ: ::c_ulong = 0x80087467; -pub const TIOCMGET: ::c_ulong = 0x741d; -pub const TIOCMBIS: ::c_ulong = 0x741b; -pub const TIOCMBIC: ::c_ulong = 0x741c; -pub const TIOCMSET: ::c_ulong = 0x741a; -pub const FIONREAD: ::c_ulong = 0x467f; -pub const TIOCCONS: ::c_ulong = 0x80047478; - -pub const RTLD_DEEPBIND: ::c_int = 0x10; -pub const RTLD_GLOBAL: ::c_int = 0x4; -pub const RTLD_NOLOAD: ::c_int = 0x8; - -pub const MCL_CURRENT: ::c_int = 0x0001; -pub const MCL_FUTURE: ::c_int = 0x0002; - -pub const SIGSTKSZ: ::size_t = 8192; -pub const MINSIGSTKSZ: ::size_t = 2048; -pub const CBAUD: ::tcflag_t = 0o0010017; -pub const TAB1: ::tcflag_t = 0x00000800; -pub const TAB2: ::tcflag_t = 0x00001000; -pub const TAB3: ::tcflag_t = 0x00001800; -pub const CR1: ::tcflag_t = 0x00000200; -pub const CR2: ::tcflag_t = 0x00000400; -pub const CR3: ::tcflag_t = 0x00000600; -pub const FF1: ::tcflag_t = 0x00008000; -pub const BS1: ::tcflag_t = 0x00002000; -pub const VT1: ::tcflag_t = 0x00004000; -pub const VWERASE: usize = 14; -pub const VREPRINT: usize = 12; -pub const VSUSP: usize = 10; -pub const VSTART: usize = 8; -pub const VSTOP: usize = 9; -pub const VDISCARD: usize = 13; -pub const VTIME: usize = 5; -pub const IXON: ::tcflag_t = 0x00000400; -pub const IXOFF: ::tcflag_t = 0x00001000; -pub const ONLCR: ::tcflag_t = 0x4; -pub const CSIZE: ::tcflag_t = 0x00000030; -pub const CS6: ::tcflag_t = 0x00000010; -pub const CS7: ::tcflag_t = 0x00000020; -pub const CS8: ::tcflag_t = 0x00000030; -pub const CSTOPB: ::tcflag_t = 0x00000040; -pub const CREAD: ::tcflag_t = 0x00000080; -pub const PARENB: ::tcflag_t = 0x00000100; -pub const PARODD: ::tcflag_t = 0x00000200; -pub const HUPCL: ::tcflag_t = 0x00000400; -pub const CLOCAL: ::tcflag_t = 0x00000800; -pub const ECHOKE: ::tcflag_t = 0x00000800; -pub const ECHOE: ::tcflag_t = 0x00000010; -pub const ECHOK: ::tcflag_t = 0x00000020; -pub const ECHONL: ::tcflag_t = 0x00000040; -pub const ECHOPRT: ::tcflag_t = 0x00000400; -pub const ECHOCTL: ::tcflag_t = 0x00000200; -pub const ISIG: ::tcflag_t = 0x00000001; -pub const ICANON: ::tcflag_t = 0x00000002; -pub const PENDIN: ::tcflag_t = 0x00004000; -pub const NOFLSH: ::tcflag_t = 0x00000080; -pub const CIBAUD: ::tcflag_t = 0o02003600000; -pub const CBAUDEX: ::tcflag_t = 0o010000; -pub const VSWTC: usize = 7; -pub const OLCUC: ::tcflag_t = 0o000002; -pub const NLDLY: ::tcflag_t = 0o000400; -pub const CRDLY: ::tcflag_t = 0o003000; -pub const TABDLY: ::tcflag_t = 0o014000; -pub const BSDLY: ::tcflag_t = 0o020000; -pub const FFDLY: ::tcflag_t = 0o100000; -pub const VTDLY: ::tcflag_t = 0o040000; -pub const XTABS: ::tcflag_t = 0o014000; - -pub const B0: ::speed_t = 0o000000; -pub const B50: ::speed_t = 0o000001; -pub const B75: ::speed_t = 0o000002; -pub const B110: ::speed_t = 0o000003; -pub const B134: ::speed_t = 0o000004; -pub const B150: ::speed_t = 0o000005; -pub const B200: ::speed_t = 0o000006; -pub const B300: ::speed_t = 0o000007; -pub const B600: ::speed_t = 0o000010; -pub const B1200: ::speed_t = 0o000011; -pub const B1800: ::speed_t = 0o000012; -pub const B2400: ::speed_t = 0o000013; -pub const B4800: ::speed_t = 0o000014; -pub const B9600: ::speed_t = 0o000015; -pub const B19200: ::speed_t = 0o000016; -pub const B38400: ::speed_t = 0o000017; -pub const EXTA: ::speed_t = B19200; -pub const EXTB: ::speed_t = B38400; -pub const BOTHER: ::speed_t = 0o010000; -pub const B57600: ::speed_t = 0o010001; -pub const B115200: ::speed_t = 0o010002; -pub const B230400: ::speed_t = 0o010003; -pub const B460800: ::speed_t = 0o010004; -pub const B500000: ::speed_t = 0o010005; -pub const B576000: ::speed_t = 0o010006; -pub const B921600: ::speed_t = 0o010007; -pub const B1000000: ::speed_t = 0o010010; -pub const B1152000: ::speed_t = 0o010011; -pub const B1500000: ::speed_t = 0o010012; -pub const B2000000: ::speed_t = 0o010013; -pub const B2500000: ::speed_t = 0o010014; -pub const B3000000: ::speed_t = 0o010015; -pub const B3500000: ::speed_t = 0o010016; -pub const B4000000: ::speed_t = 0o010017; - -pub const TIOCM_ST: ::c_int = 0x010; -pub const TIOCM_SR: ::c_int = 0x020; -pub const TIOCM_CTS: ::c_int = 0x040; -pub const TIOCM_CAR: ::c_int = 0x100; -pub const TIOCM_RNG: ::c_int = 0x200; -pub const TIOCM_DSR: ::c_int = 0x400; - -pub const EHWPOISON: ::c_int = 168; - -#[link(name = "util")] -extern { - pub fn sysctl(name: *mut ::c_int, - namelen: ::c_int, - oldp: *mut ::c_void, - oldlenp: *mut ::size_t, - newp: *mut ::c_void, - newlen: ::size_t) - -> ::c_int; -} diff --git a/src/unix/notbsd/linux/mips/mod.rs b/src/unix/notbsd/linux/mips/mod.rs new file mode 100644 index 00000000..8416daf3 --- /dev/null +++ b/src/unix/notbsd/linux/mips/mod.rs @@ -0,0 +1,1008 @@ +pub type pthread_t = c_ulong; +pub type shmatt_t = ::c_ulong; +pub type msgqnum_t = ::c_ulong; +pub type msglen_t = ::c_ulong; +pub type fsblkcnt_t = ::c_ulong; +pub type fsfilcnt_t = ::c_ulong; +pub type rlim_t = c_ulong; +pub type __priority_which_t = ::c_uint; +pub type __rlimit_resource_t = ::c_uint; + +s! { + pub struct glob64_t { + pub gl_pathc: ::size_t, + pub gl_pathv: *mut *mut ::c_char, + pub gl_offs: ::size_t, + pub gl_flags: ::c_int, + + __unused1: *mut ::c_void, + __unused2: *mut ::c_void, + __unused3: *mut ::c_void, + __unused4: *mut ::c_void, + __unused5: *mut ::c_void, + } + + pub struct termios2 { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; 23], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } + + pub struct nlmsghdr { + pub nlmsg_len: u32, + pub nlmsg_type: u16, + pub nlmsg_flags: u16, + pub nlmsg_seq: u32, + pub nlmsg_pid: u32, + } + + pub struct nlmsgerr { + pub error: ::c_int, + pub msg: nlmsghdr, + } + + pub struct nl_pktinfo { + pub group: u32, + } + + pub struct nl_mmap_req { + pub nm_block_size: ::c_uint, + pub nm_block_nr: ::c_uint, + pub nm_frame_size: ::c_uint, + pub nm_frame_nr: ::c_uint, + } + + pub struct nl_mmap_hdr { + pub nm_status: ::c_uint, + pub nm_len: ::c_uint, + pub nm_group: u32, + pub nm_pid: u32, + pub nm_uid: u32, + pub nm_gid: u32, + } + + pub struct nlattr { + pub nla_len: u16, + pub nla_type: u16, + } +} + +pub const MS_RMT_MASK: ::c_ulong = 0x02800051; + +pub const SFD_CLOEXEC: ::c_int = 0x080000; + +pub const NCCS: usize = 32; + +pub const O_TRUNC: ::c_int = 512; + +pub const O_NOATIME: ::c_int = 0o1000000; +pub const O_CLOEXEC: ::c_int = 0x80000; +pub const O_PATH: ::c_int = 0o10000000; +pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; + +pub const EBFONT: ::c_int = 59; +pub const ENOSTR: ::c_int = 60; +pub const ENODATA: ::c_int = 61; +pub const ETIME: ::c_int = 62; +pub const ENOSR: ::c_int = 63; +pub const ENONET: ::c_int = 64; +pub const ENOPKG: ::c_int = 65; +pub const EREMOTE: ::c_int = 66; +pub const ENOLINK: ::c_int = 67; +pub const EADV: ::c_int = 68; +pub const ESRMNT: ::c_int = 69; +pub const ECOMM: ::c_int = 70; +pub const EPROTO: ::c_int = 71; +pub const EDOTDOT: ::c_int = 73; + +pub const SA_NODEFER: ::c_int = 0x40000000; +pub const SA_RESETHAND: ::c_int = 0x80000000; +pub const SA_RESTART: ::c_int = 0x10000000; +pub const SA_NOCLDSTOP: ::c_int = 0x00000001; + +pub const EPOLL_CLOEXEC: ::c_int = 0x80000; + +pub const EFD_CLOEXEC: ::c_int = 0x80000; + +pub const BUFSIZ: ::c_uint = 8192; +pub const TMP_MAX: ::c_uint = 238328; +pub const FOPEN_MAX: ::c_uint = 16; +pub const POSIX_FADV_DONTNEED: ::c_int = 4; +pub const POSIX_FADV_NOREUSE: ::c_int = 5; +pub const POSIX_MADV_DONTNEED: ::c_int = 4; +pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41; +pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45; +pub const _SC_PII: ::c_int = 53; +pub const _SC_PII_XTI: ::c_int = 54; +pub const _SC_PII_SOCKET: ::c_int = 55; +pub const _SC_PII_INTERNET: ::c_int = 56; +pub const _SC_PII_OSI: ::c_int = 57; +pub const _SC_POLL: ::c_int = 58; +pub const _SC_SELECT: ::c_int = 59; +pub const _SC_PII_INTERNET_STREAM: ::c_int = 61; +pub const _SC_PII_INTERNET_DGRAM: ::c_int = 62; +pub const _SC_PII_OSI_COTS: ::c_int = 63; +pub const _SC_PII_OSI_CLTS: ::c_int = 64; +pub const _SC_PII_OSI_M: ::c_int = 65; +pub const _SC_T_IOV_MAX: ::c_int = 66; +pub const _SC_2_C_VERSION: ::c_int = 96; +pub const _SC_CHAR_BIT: ::c_int = 101; +pub const _SC_CHAR_MAX: ::c_int = 102; +pub const _SC_CHAR_MIN: ::c_int = 103; +pub const _SC_INT_MAX: ::c_int = 104; +pub const _SC_INT_MIN: ::c_int = 105; +pub const _SC_LONG_BIT: ::c_int = 106; +pub const _SC_WORD_BIT: ::c_int = 107; +pub const _SC_MB_LEN_MAX: ::c_int = 108; +pub const _SC_SSIZE_MAX: ::c_int = 110; +pub const _SC_SCHAR_MAX: ::c_int = 111; +pub const _SC_SCHAR_MIN: ::c_int = 112; +pub const _SC_SHRT_MAX: ::c_int = 113; +pub const _SC_SHRT_MIN: ::c_int = 114; +pub const _SC_UCHAR_MAX: ::c_int = 115; +pub const _SC_UINT_MAX: ::c_int = 116; +pub const _SC_ULONG_MAX: ::c_int = 117; +pub const _SC_USHRT_MAX: ::c_int = 118; +pub const _SC_NL_ARGMAX: ::c_int = 119; +pub const _SC_NL_LANGMAX: ::c_int = 120; +pub const _SC_NL_MSGMAX: ::c_int = 121; +pub const _SC_NL_NMAX: ::c_int = 122; +pub const _SC_NL_SETMAX: ::c_int = 123; +pub const _SC_NL_TEXTMAX: ::c_int = 124; +pub const _SC_BASE: ::c_int = 134; +pub const _SC_C_LANG_SUPPORT: ::c_int = 135; +pub const _SC_C_LANG_SUPPORT_R: ::c_int = 136; +pub const _SC_DEVICE_IO: ::c_int = 140; +pub const _SC_DEVICE_SPECIFIC: ::c_int = 141; +pub const _SC_DEVICE_SPECIFIC_R: ::c_int = 142; +pub const _SC_FD_MGMT: ::c_int = 143; +pub const _SC_FIFO: ::c_int = 144; +pub const _SC_PIPE: ::c_int = 145; +pub const _SC_FILE_ATTRIBUTES: ::c_int = 146; +pub const _SC_FILE_LOCKING: ::c_int = 147; +pub const _SC_FILE_SYSTEM: ::c_int = 148; +pub const _SC_MULTI_PROCESS: ::c_int = 150; +pub const _SC_SINGLE_PROCESS: ::c_int = 151; +pub const _SC_NETWORKING: ::c_int = 152; +pub const _SC_REGEX_VERSION: ::c_int = 156; +pub const _SC_SIGNALS: ::c_int = 158; +pub const _SC_SYSTEM_DATABASE: ::c_int = 162; +pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163; +pub const _SC_USER_GROUPS: ::c_int = 166; +pub const _SC_USER_GROUPS_R: ::c_int = 167; +pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 185; +pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 186; +pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 187; +pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 188; +pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 189; +pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 190; +pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 191; +pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 192; +pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 193; +pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 194; +pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 195; +pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 196; +pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 197; +pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 198; +pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 199; +pub const O_ACCMODE: ::c_int = 3; +pub const O_DIRECT: ::c_int = 0x8000; +pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_NOFOLLOW: ::c_int = 0x20000; +pub const ST_RELATIME: ::c_ulong = 4096; +pub const NI_MAXHOST: ::socklen_t = 1025; + +pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 5; +pub const RLIMIT_AS: ::__rlimit_resource_t = 6; +pub const RLIMIT_RSS: ::__rlimit_resource_t = 7; +pub const RLIMIT_NPROC: ::__rlimit_resource_t = 8; +pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 9; +pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = 16; + +pub const O_APPEND: ::c_int = 8; +pub const O_CREAT: ::c_int = 256; +pub const O_EXCL: ::c_int = 1024; +pub const O_NOCTTY: ::c_int = 2048; +pub const O_NONBLOCK: ::c_int = 128; +pub const O_SYNC: ::c_int = 0x4010; +pub const O_RSYNC: ::c_int = 0x4010; +pub const O_DSYNC: ::c_int = 0x10; +pub const O_FSYNC: ::c_int = 0x4010; +pub const O_ASYNC: ::c_int = 0x1000; +pub const O_NDELAY: ::c_int = 0x80; + +pub const SOCK_NONBLOCK: ::c_int = 128; + +pub const EDEADLK: ::c_int = 45; +pub const ENAMETOOLONG: ::c_int = 78; +pub const ENOLCK: ::c_int = 46; +pub const ENOSYS: ::c_int = 89; +pub const ENOTEMPTY: ::c_int = 93; +pub const ELOOP: ::c_int = 90; +pub const ENOMSG: ::c_int = 35; +pub const EIDRM: ::c_int = 36; +pub const ECHRNG: ::c_int = 37; +pub const EL2NSYNC: ::c_int = 38; +pub const EL3HLT: ::c_int = 39; +pub const EL3RST: ::c_int = 40; +pub const ELNRNG: ::c_int = 41; +pub const EUNATCH: ::c_int = 42; +pub const ENOCSI: ::c_int = 43; +pub const EL2HLT: ::c_int = 44; +pub const EBADE: ::c_int = 50; +pub const EBADR: ::c_int = 51; +pub const EXFULL: ::c_int = 52; +pub const ENOANO: ::c_int = 53; +pub const EBADRQC: ::c_int = 54; +pub const EBADSLT: ::c_int = 55; +pub const EDEADLOCK: ::c_int = 56; +pub const EMULTIHOP: ::c_int = 74; +pub const EOVERFLOW: ::c_int = 79; +pub const ENOTUNIQ: ::c_int = 80; +pub const EBADFD: ::c_int = 81; +pub const EBADMSG: ::c_int = 77; +pub const EREMCHG: ::c_int = 82; +pub const ELIBACC: ::c_int = 83; +pub const ELIBBAD: ::c_int = 84; +pub const ELIBSCN: ::c_int = 85; +pub const ELIBMAX: ::c_int = 86; +pub const ELIBEXEC: ::c_int = 87; +pub const EILSEQ: ::c_int = 88; +pub const ERESTART: ::c_int = 91; +pub const ESTRPIPE: ::c_int = 92; +pub const EUSERS: ::c_int = 94; +pub const ENOTSOCK: ::c_int = 95; +pub const EDESTADDRREQ: ::c_int = 96; +pub const EMSGSIZE: ::c_int = 97; +pub const EPROTOTYPE: ::c_int = 98; +pub const ENOPROTOOPT: ::c_int = 99; +pub const EPROTONOSUPPORT: ::c_int = 120; +pub const ESOCKTNOSUPPORT: ::c_int = 121; +pub const EOPNOTSUPP: ::c_int = 122; +pub const ENOTSUP: ::c_int = EOPNOTSUPP; +pub const EPFNOSUPPORT: ::c_int = 123; +pub const EAFNOSUPPORT: ::c_int = 124; +pub const EADDRINUSE: ::c_int = 125; +pub const EADDRNOTAVAIL: ::c_int = 126; +pub const ENETDOWN: ::c_int = 127; +pub const ENETUNREACH: ::c_int = 128; +pub const ENETRESET: ::c_int = 129; +pub const ECONNABORTED: ::c_int = 130; +pub const ECONNRESET: ::c_int = 131; +pub const ENOBUFS: ::c_int = 132; +pub const EISCONN: ::c_int = 133; +pub const ENOTCONN: ::c_int = 134; +pub const ESHUTDOWN: ::c_int = 143; +pub const ETOOMANYREFS: ::c_int = 144; +pub const ETIMEDOUT: ::c_int = 145; +pub const ECONNREFUSED: ::c_int = 146; +pub const EHOSTDOWN: ::c_int = 147; +pub const EHOSTUNREACH: ::c_int = 148; +pub const EALREADY: ::c_int = 149; +pub const EINPROGRESS: ::c_int = 150; +pub const ESTALE: ::c_int = 151; +pub const EUCLEAN: ::c_int = 135; +pub const ENOTNAM: ::c_int = 137; +pub const ENAVAIL: ::c_int = 138; +pub const EISNAM: ::c_int = 139; +pub const EREMOTEIO: ::c_int = 140; +pub const EDQUOT: ::c_int = 1133; +pub const ENOMEDIUM: ::c_int = 159; +pub const EMEDIUMTYPE: ::c_int = 160; +pub const ECANCELED: ::c_int = 158; +pub const ENOKEY: ::c_int = 161; +pub const EKEYEXPIRED: ::c_int = 162; +pub const EKEYREVOKED: ::c_int = 163; +pub const EKEYREJECTED: ::c_int = 164; +pub const EOWNERDEAD: ::c_int = 165; +pub const ENOTRECOVERABLE: ::c_int = 166; +pub const ERFKILL: ::c_int = 167; + +pub const LC_PAPER: ::c_int = 7; +pub const LC_NAME: ::c_int = 8; +pub const LC_ADDRESS: ::c_int = 9; +pub const LC_TELEPHONE: ::c_int = 10; +pub const LC_MEASUREMENT: ::c_int = 11; +pub const LC_IDENTIFICATION: ::c_int = 12; +pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER); +pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME); +pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS); +pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE); +pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT); +pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION); +pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK + | ::LC_NUMERIC_MASK + | ::LC_TIME_MASK + | ::LC_COLLATE_MASK + | ::LC_MONETARY_MASK + | ::LC_MESSAGES_MASK + | LC_PAPER_MASK + | LC_NAME_MASK + | LC_ADDRESS_MASK + | LC_TELEPHONE_MASK + | LC_MEASUREMENT_MASK + | LC_IDENTIFICATION_MASK; + +pub const MAP_NORESERVE: ::c_int = 0x400; +pub const MAP_ANON: ::c_int = 0x800; +pub const MAP_ANONYMOUS: ::c_int = 0x800; +pub const MAP_GROWSDOWN: ::c_int = 0x1000; +pub const MAP_DENYWRITE: ::c_int = 0x2000; +pub const MAP_EXECUTABLE: ::c_int = 0x4000; +pub const MAP_LOCKED: ::c_int = 0x8000; +pub const MAP_POPULATE: ::c_int = 0x10000; +pub const MAP_NONBLOCK: ::c_int = 0x20000; +pub const MAP_STACK: ::c_int = 0x40000; +pub const MAP_SHARED_VALIDATE: ::c_int = 0x3; +pub const MAP_FIXED_NOREPLACE: ::c_int = 0x100000; + +pub const SOCK_STREAM: ::c_int = 2; +pub const SOCK_DGRAM: ::c_int = 1; +pub const SOCK_SEQPACKET: ::c_int = 5; +pub const SOCK_DCCP: ::c_int = 6; +pub const SOCK_PACKET: ::c_int = 10; + +pub const SOL_SOCKET: ::c_int = 0xffff; + +pub const SO_REUSEADDR: ::c_int = 0x0004; +pub const SO_KEEPALIVE: ::c_int = 0x0008; +pub const SO_DONTROUTE: ::c_int = 0x0010; +pub const SO_BROADCAST: ::c_int = 0x0020; +pub const SO_LINGER: ::c_int = 0x0080; +pub const SO_OOBINLINE: ::c_int = 0x0100; +pub const SO_REUSEPORT: ::c_int = 0x0200; +pub const SO_TYPE: ::c_int = 0x1008; +pub const SO_STYLE: ::c_int = SO_TYPE; +pub const SO_ERROR: ::c_int = 0x1007; +pub const SO_SNDBUF: ::c_int = 0x1001; +pub const SO_RCVBUF: ::c_int = 0x1002; +pub const SO_SNDLOWAT: ::c_int = 0x1003; +pub const SO_RCVLOWAT: ::c_int = 0x1004; +pub const SO_SNDTIMEO: ::c_int = 0x1005; +pub const SO_RCVTIMEO: ::c_int = 0x1006; +pub const SO_ACCEPTCONN: ::c_int = 0x1009; +pub const SO_PROTOCOL: ::c_int = 0x1028; +pub const SO_DOMAIN: ::c_int = 0x1029; +pub const SO_NO_CHECK: ::c_int = 11; +pub const SO_PRIORITY: ::c_int = 12; +pub const SO_BSDCOMPAT: ::c_int = 14; +pub const SO_PASSCRED: ::c_int = 17; +pub const SO_PEERCRED: ::c_int = 18; +pub const SO_SECURITY_AUTHENTICATION: ::c_int = 22; +pub const SO_SECURITY_ENCRYPTION_TRANSPORT: ::c_int = 23; +pub const SO_SECURITY_ENCRYPTION_NETWORK: ::c_int = 24; +pub const SO_BINDTODEVICE: ::c_int = 25; +pub const SO_ATTACH_FILTER: ::c_int = 26; +pub const SO_DETACH_FILTER: ::c_int = 27; +pub const SO_GET_FILTER: ::c_int = SO_ATTACH_FILTER; +pub const SO_PEERNAME: ::c_int = 28; +pub const SO_TIMESTAMP: ::c_int = 29; +pub const SO_PEERSEC: ::c_int = 30; +pub const SO_SNDBUFFORCE: ::c_int = 31; +pub const SO_RCVBUFFORCE: ::c_int = 33; +pub const SO_PASSSEC: ::c_int = 34; +pub const SO_TIMESTAMPNS: ::c_int = 35; +pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS; +pub const SO_MARK: ::c_int = 36; +pub const SO_RXQ_OVFL: ::c_int = 40; +pub const SO_WIFI_STATUS: ::c_int = 41; +pub const SCM_WIFI_STATUS: ::c_int = SO_WIFI_STATUS; +pub const SO_PEEK_OFF: ::c_int = 42; +pub const SO_NOFCS: ::c_int = 43; +pub const SO_LOCK_FILTER: ::c_int = 44; +pub const SO_SELECT_ERR_QUEUE: ::c_int = 45; +pub const SO_BUSY_POLL: ::c_int = 46; +pub const SO_MAX_PACING_RATE: ::c_int = 47; +pub const SO_BPF_EXTENSIONS: ::c_int = 48; +pub const SO_INCOMING_CPU: ::c_int = 49; +pub const SO_ATTACH_BPF: ::c_int = 50; +pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER; + +/* DCCP socket options */ +pub const DCCP_SOCKOPT_PACKET_SIZE: ::c_int = 1; +pub const DCCP_SOCKOPT_SERVICE: ::c_int = 2; +pub const DCCP_SOCKOPT_CHANGE_L: ::c_int = 3; +pub const DCCP_SOCKOPT_CHANGE_R: ::c_int = 4; +pub const DCCP_SOCKOPT_GET_CUR_MPS: ::c_int = 5; +pub const DCCP_SOCKOPT_SERVER_TIMEWAIT: ::c_int = 6; +pub const DCCP_SOCKOPT_SEND_CSCOV: ::c_int = 10; +pub const DCCP_SOCKOPT_RECV_CSCOV: ::c_int = 11; +pub const DCCP_SOCKOPT_AVAILABLE_CCIDS: ::c_int = 12; +pub const DCCP_SOCKOPT_CCID: ::c_int = 13; +pub const DCCP_SOCKOPT_TX_CCID: ::c_int = 14; +pub const DCCP_SOCKOPT_RX_CCID: ::c_int = 15; +pub const DCCP_SOCKOPT_QPOLICY_ID: ::c_int = 16; +pub const DCCP_SOCKOPT_QPOLICY_TXQLEN: ::c_int = 17; +pub const DCCP_SOCKOPT_CCID_RX_INFO: ::c_int = 128; +pub const DCCP_SOCKOPT_CCID_TX_INFO: ::c_int = 192; + +/// maximum number of services provided on the same listening port +pub const DCCP_SERVICE_LIST_MAX_LEN: ::c_int = 32; + +pub const FIOCLEX: ::c_ulong = 0x6601; +pub const FIONBIO: ::c_ulong = 0x667e; + +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 0x00000008; +pub const SA_NOCLDWAIT: ::c_int = 0x00010000; + +pub const SIGCHLD: ::c_int = 18; +pub const SIGBUS: ::c_int = 10; +pub const SIGTTIN: ::c_int = 26; +pub const SIGTTOU: ::c_int = 27; +pub const SIGXCPU: ::c_int = 30; +pub const SIGXFSZ: ::c_int = 31; +pub const SIGVTALRM: ::c_int = 28; +pub const SIGPROF: ::c_int = 29; +pub const SIGWINCH: ::c_int = 20; +pub const SIGUSR1: ::c_int = 16; +pub const SIGUSR2: ::c_int = 17; +pub const SIGCONT: ::c_int = 25; +pub const SIGSTOP: ::c_int = 23; +pub const SIGTSTP: ::c_int = 24; +pub const SIGURG: ::c_int = 21; +pub const SIGIO: ::c_int = 22; +pub const SIGSYS: ::c_int = 12; +pub const SIGPOLL: ::c_int = 22; +pub const SIGPWR: ::c_int = 19; +pub const SIG_SETMASK: ::c_int = 3; +pub const SIG_BLOCK: ::c_int = 0x1; +pub const SIG_UNBLOCK: ::c_int = 0x2; + +pub const POLLWRNORM: ::c_short = 0x004; +pub const POLLWRBAND: ::c_short = 0x100; + +pub const PTHREAD_STACK_MIN: ::size_t = 131072; +pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 3; + +pub const ADFS_SUPER_MAGIC: ::c_long = 0x0000adf5; +pub const AFFS_SUPER_MAGIC: ::c_long = 0x0000adff; +pub const CODA_SUPER_MAGIC: ::c_long = 0x73757245; +pub const CRAMFS_MAGIC: ::c_long = 0x28cd3d45; +pub const EFS_SUPER_MAGIC: ::c_long = 0x00414a53; +pub const EXT2_SUPER_MAGIC: ::c_long = 0x0000ef53; +pub const EXT3_SUPER_MAGIC: ::c_long = 0x0000ef53; +pub const EXT4_SUPER_MAGIC: ::c_long = 0x0000ef53; +pub const HPFS_SUPER_MAGIC: ::c_long = 0xf995e849; +pub const HUGETLBFS_MAGIC: ::c_long = 0x958458f6; +pub const ISOFS_SUPER_MAGIC: ::c_long = 0x00009660; +pub const JFFS2_SUPER_MAGIC: ::c_long = 0x000072b6; +pub const MINIX_SUPER_MAGIC: ::c_long = 0x0000137f; +pub const MINIX_SUPER_MAGIC2: ::c_long = 0x0000138f; +pub const MINIX2_SUPER_MAGIC: ::c_long = 0x00002468; +pub const MINIX2_SUPER_MAGIC2: ::c_long = 0x00002478; +pub const MSDOS_SUPER_MAGIC: ::c_long = 0x00004d44; +pub const NCP_SUPER_MAGIC: ::c_long = 0x0000564c; +pub const NFS_SUPER_MAGIC: ::c_long = 0x00006969; +pub const OPENPROM_SUPER_MAGIC: ::c_long = 0x00009fa1; +pub const PROC_SUPER_MAGIC: ::c_long = 0x00009fa0; +pub const QNX4_SUPER_MAGIC: ::c_long = 0x0000002f; +pub const REISERFS_SUPER_MAGIC: ::c_long = 0x52654973; +pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b; +pub const TMPFS_MAGIC: ::c_long = 0x01021994; +pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; + +pub const VEOF: usize = 16; +pub const VEOL: usize = 17; +pub const VEOL2: usize = 6; +pub const VMIN: usize = 4; +pub const IEXTEN: ::tcflag_t = 0x00000100; +pub const TOSTOP: ::tcflag_t = 0x00008000; +pub const FLUSHO: ::tcflag_t = 0x00002000; +pub const EXTPROC: ::tcflag_t = 0o200000; +pub const TCSANOW: ::c_int = 0x540e; +pub const TCSADRAIN: ::c_int = 0x540f; +pub const TCSAFLUSH: ::c_int = 0x5410; + +pub const CPU_SETSIZE: ::c_int = 0x400; + +pub const PTRACE_TRACEME: ::c_uint = 0; +pub const PTRACE_PEEKTEXT: ::c_uint = 1; +pub const PTRACE_PEEKDATA: ::c_uint = 2; +pub const PTRACE_PEEKUSER: ::c_uint = 3; +pub const PTRACE_POKETEXT: ::c_uint = 4; +pub const PTRACE_POKEDATA: ::c_uint = 5; +pub const PTRACE_POKEUSER: ::c_uint = 6; +pub const PTRACE_CONT: ::c_uint = 7; +pub const PTRACE_KILL: ::c_uint = 8; +pub const PTRACE_SINGLESTEP: ::c_uint = 9; +pub const PTRACE_ATTACH: ::c_uint = 16; +pub const PTRACE_DETACH: ::c_uint = 17; +pub const PTRACE_SYSCALL: ::c_uint = 24; +pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200; +pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201; +pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202; +pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203; +pub const PTRACE_GETFPREGS: ::c_uint = 14; +pub const PTRACE_SETFPREGS: ::c_uint = 15; +pub const PTRACE_GETFPXREGS: ::c_uint = 18; +pub const PTRACE_SETFPXREGS: ::c_uint = 19; +pub const PTRACE_GETREGS: ::c_uint = 12; +pub const PTRACE_SETREGS: ::c_uint = 13; + +pub const MAP_HUGETLB: ::c_int = 0x080000; + +pub const EFD_NONBLOCK: ::c_int = 0x80; + +pub const F_RDLCK: ::c_int = 0; +pub const F_WRLCK: ::c_int = 1; +pub const F_UNLCK: ::c_int = 2; +pub const F_GETLK: ::c_int = 14; +pub const F_GETOWN: ::c_int = 23; +pub const F_SETOWN: ::c_int = 24; +pub const F_SETLK: ::c_int = 6; +pub const F_SETLKW: ::c_int = 7; + +pub const SFD_NONBLOCK: ::c_int = 0x80; + +pub const TCGETS: ::c_ulong = 0x540d; +pub const TCSETS: ::c_ulong = 0x540e; +pub const TCSETSW: ::c_ulong = 0x540f; +pub const TCSETSF: ::c_ulong = 0x5410; +pub const TCGETA: ::c_ulong = 0x5401; +pub const TCSETA: ::c_ulong = 0x5402; +pub const TCSETAW: ::c_ulong = 0x5403; +pub const TCSETAF: ::c_ulong = 0x5404; +pub const TCSBRK: ::c_ulong = 0x5405; +pub const TCXONC: ::c_ulong = 0x5406; +pub const TCFLSH: ::c_ulong = 0x5407; +pub const TIOCGSOFTCAR: ::c_ulong = 0x5481; +pub const TIOCSSOFTCAR: ::c_ulong = 0x5482; +pub const TIOCINQ: ::c_ulong = 0x467f; +pub const TIOCLINUX: ::c_ulong = 0x5483; +pub const TIOCGSERIAL: ::c_ulong = 0x5484; +pub const TIOCEXCL: ::c_ulong = 0x740d; +pub const TIOCNXCL: ::c_ulong = 0x740e; +pub const TIOCSCTTY: ::c_ulong = 0x5480; +pub const TIOCGPGRP: ::c_ulong = 0x40047477; +pub const TIOCSPGRP: ::c_ulong = 0x80047476; +pub const TIOCOUTQ: ::c_ulong = 0x7472; +pub const TIOCSTI: ::c_ulong = 0x5472; +pub const TIOCGWINSZ: ::c_ulong = 0x40087468; +pub const TIOCSWINSZ: ::c_ulong = 0x80087467; +pub const TIOCMGET: ::c_ulong = 0x741d; +pub const TIOCMBIS: ::c_ulong = 0x741b; +pub const TIOCMBIC: ::c_ulong = 0x741c; +pub const TIOCMSET: ::c_ulong = 0x741a; +pub const FIONREAD: ::c_ulong = 0x467f; +pub const TIOCCONS: ::c_ulong = 0x80047478; + +pub const RTLD_DEEPBIND: ::c_int = 0x10; +pub const RTLD_GLOBAL: ::c_int = 0x4; +pub const RTLD_NOLOAD: ::c_int = 0x8; + +pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; +pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; +pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278; +pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448; +pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216; + +pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567; +pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123; +pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF; +pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000; +pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC; +pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4; +pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2; +pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543; + +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; + +pub const SIGSTKSZ: ::size_t = 8192; +pub const MINSIGSTKSZ: ::size_t = 2048; +pub const CBAUD: ::tcflag_t = 0o0010017; +pub const TAB1: ::tcflag_t = 0x00000800; +pub const TAB2: ::tcflag_t = 0x00001000; +pub const TAB3: ::tcflag_t = 0x00001800; +pub const CR1: ::tcflag_t = 0x00000200; +pub const CR2: ::tcflag_t = 0x00000400; +pub const CR3: ::tcflag_t = 0x00000600; +pub const FF1: ::tcflag_t = 0x00008000; +pub const BS1: ::tcflag_t = 0x00002000; +pub const VT1: ::tcflag_t = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; + +pub const B0: ::speed_t = 0o000000; +pub const B50: ::speed_t = 0o000001; +pub const B75: ::speed_t = 0o000002; +pub const B110: ::speed_t = 0o000003; +pub const B134: ::speed_t = 0o000004; +pub const B150: ::speed_t = 0o000005; +pub const B200: ::speed_t = 0o000006; +pub const B300: ::speed_t = 0o000007; +pub const B600: ::speed_t = 0o000010; +pub const B1200: ::speed_t = 0o000011; +pub const B1800: ::speed_t = 0o000012; +pub const B2400: ::speed_t = 0o000013; +pub const B4800: ::speed_t = 0o000014; +pub const B9600: ::speed_t = 0o000015; +pub const B19200: ::speed_t = 0o000016; +pub const B38400: ::speed_t = 0o000017; +pub const EXTA: ::speed_t = B19200; +pub const EXTB: ::speed_t = B38400; +pub const BOTHER: ::speed_t = 0o010000; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const TIOCM_LE: ::c_int = 0x001; +pub const TIOCM_DTR: ::c_int = 0x002; +pub const TIOCM_RTS: ::c_int = 0x004; +pub const TIOCM_ST: ::c_int = 0x010; +pub const TIOCM_SR: ::c_int = 0x020; +pub const TIOCM_CTS: ::c_int = 0x040; +pub const TIOCM_CAR: ::c_int = 0x100; +pub const TIOCM_CD: ::c_int = TIOCM_CAR; +pub const TIOCM_RNG: ::c_int = 0x200; +pub const TIOCM_RI: ::c_int = TIOCM_RNG; +pub const TIOCM_DSR: ::c_int = 0x400; + +pub const EHWPOISON: ::c_int = 168; +pub const SIGEV_THREAD_ID: ::c_int = 4; +pub const EPOLLWAKEUP: ::c_int = 0x20000000; + +pub const NF_NETDEV_INGRESS: ::c_int = 0; +pub const NF_NETDEV_NUMHOOKS: ::c_int = 1; + +pub const NFPROTO_INET: ::c_int = 1; +pub const NFPROTO_NETDEV: ::c_int = 5; + +pub const NLA_ALIGNTO: ::c_int = 4; + +pub const GENL_UNS_ADMIN_PERM: ::c_int = 0x10; + +pub const GENL_ID_VFS_DQUOT: ::c_int = ::NLMSG_MIN_TYPE + 1; +pub const GENL_ID_PMCRAID: ::c_int = ::NLMSG_MIN_TYPE + 2; + +pub const NFT_TABLE_MAXNAMELEN: ::c_int = 256; +pub const NFT_CHAIN_MAXNAMELEN: ::c_int = 256; +pub const NFT_SET_MAXNAMELEN: ::c_int = 256; +pub const NFT_OBJ_MAXNAMELEN: ::c_int = 256; +pub const NFT_USERDATA_MAXLEN: ::c_int = 256; + +pub const NFT_REG_VERDICT: ::c_int = 0; +pub const NFT_REG_1: ::c_int = 1; +pub const NFT_REG_2: ::c_int = 2; +pub const NFT_REG_3: ::c_int = 3; +pub const NFT_REG_4: ::c_int = 4; +pub const __NFT_REG_MAX: ::c_int = 5; +pub const NFT_REG32_00: ::c_int = 8; +pub const NFT_REG32_01: ::c_int = 9; +pub const NFT_REG32_02: ::c_int = 10; +pub const NFT_REG32_03: ::c_int = 11; +pub const NFT_REG32_04: ::c_int = 12; +pub const NFT_REG32_05: ::c_int = 13; +pub const NFT_REG32_06: ::c_int = 14; +pub const NFT_REG32_07: ::c_int = 15; +pub const NFT_REG32_08: ::c_int = 16; +pub const NFT_REG32_09: ::c_int = 17; +pub const NFT_REG32_10: ::c_int = 18; +pub const NFT_REG32_11: ::c_int = 19; +pub const NFT_REG32_12: ::c_int = 20; +pub const NFT_REG32_13: ::c_int = 21; +pub const NFT_REG32_14: ::c_int = 22; +pub const NFT_REG32_15: ::c_int = 23; + +pub const NFT_REG_SIZE: ::c_int = 16; +pub const NFT_REG32_SIZE: ::c_int = 4; + +pub const NFT_CONTINUE: ::c_int = -1; +pub const NFT_BREAK: ::c_int = -2; +pub const NFT_JUMP: ::c_int = -3; +pub const NFT_GOTO: ::c_int = -4; +pub const NFT_RETURN: ::c_int = -5; + +pub const NFT_MSG_NEWTABLE: ::c_int = 0; +pub const NFT_MSG_GETTABLE: ::c_int = 1; +pub const NFT_MSG_DELTABLE: ::c_int = 2; +pub const NFT_MSG_NEWCHAIN: ::c_int = 3; +pub const NFT_MSG_GETCHAIN: ::c_int = 4; +pub const NFT_MSG_DELCHAIN: ::c_int = 5; +pub const NFT_MSG_NEWRULE: ::c_int = 6; +pub const NFT_MSG_GETRULE: ::c_int = 7; +pub const NFT_MSG_DELRULE: ::c_int = 8; +pub const NFT_MSG_NEWSET: ::c_int = 9; +pub const NFT_MSG_GETSET: ::c_int = 10; +pub const NFT_MSG_DELSET: ::c_int = 11; +pub const NFT_MSG_NEWSETELEM: ::c_int = 12; +pub const NFT_MSG_GETSETELEM: ::c_int = 13; +pub const NFT_MSG_DELSETELEM: ::c_int = 14; +pub const NFT_MSG_NEWGEN: ::c_int = 15; +pub const NFT_MSG_GETGEN: ::c_int = 16; +pub const NFT_MSG_TRACE: ::c_int = 17; +pub const NFT_MSG_NEWOBJ: ::c_int = 18; +pub const NFT_MSG_GETOBJ: ::c_int = 19; +pub const NFT_MSG_DELOBJ: ::c_int = 20; +pub const NFT_MSG_GETOBJ_RESET: ::c_int = 21; +pub const NFT_MSG_MAX: ::c_int = 25; + +pub const NFT_SET_ANONYMOUS: ::c_int = 0x1; +pub const NFT_SET_CONSTANT: ::c_int = 0x2; +pub const NFT_SET_INTERVAL: ::c_int = 0x4; +pub const NFT_SET_MAP: ::c_int = 0x8; +pub const NFT_SET_TIMEOUT: ::c_int = 0x10; +pub const NFT_SET_EVAL: ::c_int = 0x20; + +pub const NFT_SET_POL_PERFORMANCE: ::c_int = 0; +pub const NFT_SET_POL_MEMORY: ::c_int = 1; + +pub const NFT_SET_ELEM_INTERVAL_END: ::c_int = 0x1; + +pub const NFT_DATA_VALUE: ::c_uint = 0; +pub const NFT_DATA_VERDICT: ::c_uint = 0xffffff00; + +pub const NFT_DATA_RESERVED_MASK: ::c_uint = 0xffffff00; + +pub const NFT_DATA_VALUE_MAXLEN: ::c_int = 64; + +pub const NFT_BYTEORDER_NTOH: ::c_int = 0; +pub const NFT_BYTEORDER_HTON: ::c_int = 1; + +pub const NFT_CMP_EQ: ::c_int = 0; +pub const NFT_CMP_NEQ: ::c_int = 1; +pub const NFT_CMP_LT: ::c_int = 2; +pub const NFT_CMP_LTE: ::c_int = 3; +pub const NFT_CMP_GT: ::c_int = 4; +pub const NFT_CMP_GTE: ::c_int = 5; + +pub const NFT_RANGE_EQ: ::c_int = 0; +pub const NFT_RANGE_NEQ: ::c_int = 1; + +pub const NFT_LOOKUP_F_INV: ::c_int = (1 << 0); + +pub const NFT_DYNSET_OP_ADD: ::c_int = 0; +pub const NFT_DYNSET_OP_UPDATE: ::c_int = 1; + +pub const NFT_DYNSET_F_INV: ::c_int = (1 << 0); + +pub const NFT_PAYLOAD_LL_HEADER: ::c_int = 0; +pub const NFT_PAYLOAD_NETWORK_HEADER: ::c_int = 1; +pub const NFT_PAYLOAD_TRANSPORT_HEADER: ::c_int = 2; + +pub const NFT_PAYLOAD_CSUM_NONE: ::c_int = 0; +pub const NFT_PAYLOAD_CSUM_INET: ::c_int = 1; + +pub const NFT_META_LEN: ::c_int = 0; +pub const NFT_META_PROTOCOL: ::c_int = 1; +pub const NFT_META_PRIORITY: ::c_int = 2; +pub const NFT_META_MARK: ::c_int = 3; +pub const NFT_META_IIF: ::c_int = 4; +pub const NFT_META_OIF: ::c_int = 5; +pub const NFT_META_IIFNAME: ::c_int = 6; +pub const NFT_META_OIFNAME: ::c_int = 7; +pub const NFT_META_IIFTYPE: ::c_int = 8; +pub const NFT_META_OIFTYPE: ::c_int = 9; +pub const NFT_META_SKUID: ::c_int = 10; +pub const NFT_META_SKGID: ::c_int = 11; +pub const NFT_META_NFTRACE: ::c_int = 12; +pub const NFT_META_RTCLASSID: ::c_int = 13; +pub const NFT_META_SECMARK: ::c_int = 14; +pub const NFT_META_NFPROTO: ::c_int = 15; +pub const NFT_META_L4PROTO: ::c_int = 16; +pub const NFT_META_BRI_IIFNAME: ::c_int = 17; +pub const NFT_META_BRI_OIFNAME: ::c_int = 18; +pub const NFT_META_PKTTYPE: ::c_int = 19; +pub const NFT_META_CPU: ::c_int = 20; +pub const NFT_META_IIFGROUP: ::c_int = 21; +pub const NFT_META_OIFGROUP: ::c_int = 22; +pub const NFT_META_CGROUP: ::c_int = 23; +pub const NFT_META_PRANDOM: ::c_int = 24; + +pub const NFT_CT_STATE: ::c_int = 0; +pub const NFT_CT_DIRECTION: ::c_int = 1; +pub const NFT_CT_STATUS: ::c_int = 2; +pub const NFT_CT_MARK: ::c_int = 3; +pub const NFT_CT_SECMARK: ::c_int = 4; +pub const NFT_CT_EXPIRATION: ::c_int = 5; +pub const NFT_CT_HELPER: ::c_int = 6; +pub const NFT_CT_L3PROTOCOL: ::c_int = 7; +pub const NFT_CT_SRC: ::c_int = 8; +pub const NFT_CT_DST: ::c_int = 9; +pub const NFT_CT_PROTOCOL: ::c_int = 10; +pub const NFT_CT_PROTO_SRC: ::c_int = 11; +pub const NFT_CT_PROTO_DST: ::c_int = 12; +pub const NFT_CT_LABELS: ::c_int = 13; +pub const NFT_CT_PKTS: ::c_int = 14; +pub const NFT_CT_BYTES: ::c_int = 15; + +pub const NFT_LIMIT_PKTS: ::c_int = 0; +pub const NFT_LIMIT_PKT_BYTES: ::c_int = 1; + +pub const NFT_LIMIT_F_INV: ::c_int = (1 << 0); + +pub const NFT_QUEUE_FLAG_BYPASS: ::c_int = 0x01; +pub const NFT_QUEUE_FLAG_CPU_FANOUT: ::c_int = 0x02; +pub const NFT_QUEUE_FLAG_MASK: ::c_int = 0x03; + +pub const NFT_QUOTA_F_INV: ::c_int = (1 << 0); + +pub const NFT_REJECT_ICMP_UNREACH: ::c_int = 0; +pub const NFT_REJECT_TCP_RST: ::c_int = 1; +pub const NFT_REJECT_ICMPX_UNREACH: ::c_int = 2; + +pub const NFT_REJECT_ICMPX_NO_ROUTE: ::c_int = 0; +pub const NFT_REJECT_ICMPX_PORT_UNREACH: ::c_int = 1; +pub const NFT_REJECT_ICMPX_HOST_UNREACH: ::c_int = 2; +pub const NFT_REJECT_ICMPX_ADMIN_PROHIBITED: ::c_int = 3; + +pub const NFT_NAT_SNAT: ::c_int = 0; +pub const NFT_NAT_DNAT: ::c_int = 1; + +pub const NFT_TRACETYPE_UNSPEC: ::c_int = 0; +pub const NFT_TRACETYPE_POLICY: ::c_int = 1; +pub const NFT_TRACETYPE_RETURN: ::c_int = 2; +pub const NFT_TRACETYPE_RULE: ::c_int = 3; + +pub const NFT_NG_INCREMENTAL: ::c_int = 0; +pub const NFT_NG_RANDOM: ::c_int = 1; + +pub const RLIMIT_CPU: ::__rlimit_resource_t = 0; +pub const RLIMIT_FSIZE: ::__rlimit_resource_t = 1; +pub const RLIMIT_DATA: ::__rlimit_resource_t = 2; +pub const RLIMIT_STACK: ::__rlimit_resource_t = 3; +pub const RLIMIT_CORE: ::__rlimit_resource_t = 4; +pub const RLIMIT_LOCKS: ::__rlimit_resource_t = 10; +pub const RLIMIT_SIGPENDING: ::__rlimit_resource_t = 11; +pub const RLIMIT_MSGQUEUE: ::__rlimit_resource_t = 12; +pub const RLIMIT_NICE: ::__rlimit_resource_t = 13; +pub const RLIMIT_RTPRIO: ::__rlimit_resource_t = 14; + +#[doc(hidden)] +#[deprecated( + since = "0.2.55", + note = "If you are using this report to: \ + https://github.com/rust-lang/libc/issues/665" +)] +pub const AF_MAX: ::c_int = 45; +#[doc(hidden)] +#[deprecated( + since = "0.2.55", + note = "If you are using this report to: \ + https://github.com/rust-lang/libc/issues/665" +)] +#[allow(deprecated)] +pub const PF_MAX: ::c_int = AF_MAX; + +f! { + pub fn NLA_ALIGN(len: ::c_int) -> ::c_int { + return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1) + } +} + +#[link(name = "util")] +extern { + pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, + flags: ::c_int) -> ::c_int; + pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, + flags: ::c_int, timeout: *mut ::timespec) -> ::c_int; + + pub fn getrlimit64(resource: ::__rlimit_resource_t, + rlim: *mut ::rlimit64) -> ::c_int; + pub fn setrlimit64(resource: ::__rlimit_resource_t, + rlim: *const ::rlimit64) -> ::c_int; + pub fn getrlimit(resource: ::__rlimit_resource_t, + rlim: *mut ::rlimit) -> ::c_int; + pub fn setrlimit(resource: ::__rlimit_resource_t, + rlim: *const ::rlimit) -> ::c_int; + pub fn prlimit(pid: ::pid_t, + resource: ::__rlimit_resource_t, new_limit: *const ::rlimit, + old_limit: *mut ::rlimit) -> ::c_int; + pub fn prlimit64(pid: ::pid_t, + resource: ::__rlimit_resource_t, + new_limit: *const ::rlimit64, + old_limit: *mut ::rlimit64) -> ::c_int; + pub fn sysctl(name: *mut ::c_int, + namelen: ::c_int, + oldp: *mut ::c_void, + oldlenp: *mut ::size_t, + newp: *mut ::c_void, + newlen: ::size_t) + -> ::c_int; + pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; + pub fn backtrace(buf: *mut *mut ::c_void, + sz: ::c_int) -> ::c_int; + pub fn glob64(pattern: *const ::c_char, + flags: ::c_int, + errfunc: ::Option<extern fn(epath: *const ::c_char, + errno: ::c_int) + -> ::c_int>, + pglob: *mut glob64_t) -> ::c_int; + pub fn globfree64(pglob: *mut glob64_t); + pub fn ptrace(request: ::c_uint, ...) -> ::c_long; + pub fn pthread_attr_getaffinity_np(attr: *const ::pthread_attr_t, + cpusetsize: ::size_t, + cpuset: *mut ::cpu_set_t) -> ::c_int; + pub fn pthread_attr_setaffinity_np(attr: *mut ::pthread_attr_t, + cpusetsize: ::size_t, + cpuset: *const ::cpu_set_t) -> ::c_int; + pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int; + pub fn setpriority(which: ::__priority_which_t, who: ::id_t, + prio: ::c_int) -> ::c_int; + pub fn pthread_getaffinity_np(thread: ::pthread_t, + cpusetsize: ::size_t, + cpuset: *mut ::cpu_set_t) -> ::c_int; + pub fn pthread_setaffinity_np(thread: ::pthread_t, + cpusetsize: ::size_t, + cpuset: *const ::cpu_set_t) -> ::c_int; + pub fn sched_getcpu() -> ::c_int; +} + +cfg_if! { + if #[cfg(target_arch = "mips")] { + mod mips32; + pub use self::mips32::*; + } else if #[cfg(target_arch = "mips64")] { + mod mips64; + pub use self::mips64::*; + } else { + // Unknown target_arch + } +} + +cfg_if! { + if #[cfg(libc_align)] { + mod align; + pub use self::align::*; + } else { + mod no_align; + pub use self::no_align::*; + } +} diff --git a/src/unix/linux_like/linux/gnu/no_align.rs b/src/unix/notbsd/linux/mips/no_align.rs index e32bf673..e32bf673 100644 --- a/src/unix/linux_like/linux/gnu/no_align.rs +++ b/src/unix/notbsd/linux/mips/no_align.rs diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 6d9c5e72..3b7bc292 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -474,14 +474,6 @@ s! { pub cookie: u32, pub len: u32 } - - pub struct sockaddr_vm { - pub svm_family: ::sa_family_t, - pub svm_reserved1: ::c_ushort, - pub svm_port: ::c_uint, - pub svm_cid: ::c_uint, - pub svm_zero: [u8; 4] - } } s_no_extra_traits!{ @@ -2008,13 +2000,6 @@ pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5; pub const ALG_OP_DECRYPT: ::c_int = 0; pub const ALG_OP_ENCRYPT: ::c_int = 1; -// uapi/linux/vm_sockets.h -pub const VMADDR_CID_ANY: ::c_uint = 0xFFFFFFFF; -pub const VMADDR_CID_HYPERVISOR: ::c_uint = 0; -pub const VMADDR_CID_RESERVED: ::c_uint = 1; -pub const VMADDR_CID_HOST: ::c_uint = 2; -pub const VMADDR_PORT_ANY: ::c_uint = 0xFFFFFFFF; - // uapi/linux/inotify.h pub const IN_ACCESS: u32 = 0x0000_0001; pub const IN_MODIFY: u32 = 0x0000_0002; @@ -2309,20 +2294,10 @@ extern { msg_ptr: *mut ::c_char, msg_len: ::size_t, msq_prio: *mut ::c_uint) -> ::ssize_t; - pub fn mq_timedreceive(mqd: ::mqd_t, - msg_ptr: *mut ::c_char, - msg_len: ::size_t, - msq_prio: *mut ::c_uint, - abs_timeout: *const ::timespec) -> ::ssize_t; pub fn mq_send(mqd: ::mqd_t, msg_ptr: *const ::c_char, msg_len: ::size_t, msq_prio: ::c_uint) -> ::c_int; - pub fn mq_timedsend(mqd: ::mqd_t, - msg_ptr: *const ::c_char, - msg_len: ::size_t, - msq_prio: ::c_uint, - abs_timeout: *const ::timespec) -> ::c_int; pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int; pub fn mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, @@ -2672,9 +2647,16 @@ cfg_if! { if #[cfg(target_env = "musl")] { mod musl; pub use self::musl::*; - } else if #[cfg(target_env = "gnu")] { - mod gnu; - pub use self::gnu::*; + } else if #[cfg(any(target_arch = "mips", + target_arch = "mips64"))] { + mod mips; + pub use self::mips::*; + } else if #[cfg(any(target_arch = "s390x"))] { + mod s390x; + pub use self::s390x::*; + } else { + mod other; + pub use self::other::*; } } diff --git a/src/unix/linux_like/linux/musl/b32/arm.rs b/src/unix/notbsd/linux/musl/b32/arm.rs index 7d6dcfde..7162fdf1 100644 --- a/src/unix/linux_like/linux/musl/b32/arm.rs +++ b/src/unix/notbsd/linux/musl/b32/arm.rs @@ -162,7 +162,6 @@ pub const O_ASYNC: ::c_int = 0x2000; pub const O_LARGEFILE: ::c_int = 0o400000; pub const FIOCLEX: ::c_int = 0x5451; -pub const FIONCLEX: ::c_int = 0x5450; pub const FIONBIO: ::c_int = 0x5421; pub const RLIMIT_RSS: ::c_int = 5; @@ -843,11 +842,3 @@ pub const AF_MAX: ::c_int = 45; https://github.com/rust-lang/libc/issues/665" )] pub const PF_MAX: ::c_int = AF_MAX; - -extern { - pub fn getrandom( - buf: *mut ::c_void, - buflen: ::size_t, - flags: ::c_uint, - ) -> ::ssize_t; -} diff --git a/src/unix/linux_like/linux/musl/b32/mips.rs b/src/unix/notbsd/linux/musl/b32/mips.rs index 5ab1d733..fbecb490 100644 --- a/src/unix/linux_like/linux/musl/b32/mips.rs +++ b/src/unix/notbsd/linux/musl/b32/mips.rs @@ -173,7 +173,6 @@ pub const O_ASYNC: ::c_int = 0o10000; pub const O_LARGEFILE: ::c_int = 0x2000; pub const FIOCLEX: ::c_int = 0x6601; -pub const FIONCLEX: ::c_int = 0x6602; pub const FIONBIO: ::c_int = 0x667E; pub const RLIMIT_RSS: ::c_int = 7; diff --git a/src/unix/linux_like/linux/musl/b32/mod.rs b/src/unix/notbsd/linux/musl/b32/mod.rs index 4128a8e4..4128a8e4 100644 --- a/src/unix/linux_like/linux/musl/b32/mod.rs +++ b/src/unix/notbsd/linux/musl/b32/mod.rs diff --git a/src/unix/linux_like/linux/musl/b32/powerpc.rs b/src/unix/notbsd/linux/musl/b32/powerpc.rs index 04999c62..eafd7a65 100644 --- a/src/unix/linux_like/linux/musl/b32/powerpc.rs +++ b/src/unix/notbsd/linux/musl/b32/powerpc.rs @@ -166,7 +166,6 @@ pub const O_ASYNC: ::c_int = 0x2000; pub const O_LARGEFILE: ::c_int = 0x10000; pub const FIOCLEX: ::c_int = 0x20006601; -pub const FIONCLEX: ::c_int = 0x20006602; pub const FIONBIO: ::c_int = 0x8004667E; pub const RLIMIT_RSS: ::c_int = 5; @@ -869,11 +868,3 @@ pub const AF_MAX: ::c_int = 43; https://github.com/rust-lang/libc/issues/665" )] pub const PF_MAX: ::c_int = AF_MAX; - -extern { - pub fn getrandom( - buf: *mut ::c_void, - buflen: ::size_t, - flags: ::c_uint, - ) -> ::ssize_t; -} diff --git a/src/unix/linux_like/linux/musl/b32/x86.rs b/src/unix/notbsd/linux/musl/b32/x86.rs index 3ccf8070..3e8579a1 100644 --- a/src/unix/linux_like/linux/musl/b32/x86.rs +++ b/src/unix/notbsd/linux/musl/b32/x86.rs @@ -222,7 +222,6 @@ pub const O_ASYNC: ::c_int = 0x2000; pub const O_LARGEFILE: ::c_int = 0o0100000; pub const FIOCLEX: ::c_int = 0x5451; -pub const FIONCLEX: ::c_int = 0x5450; pub const FIONBIO: ::c_int = 0x5421; pub const RLIMIT_RSS: ::c_int = 5; @@ -951,11 +950,3 @@ pub const AF_MAX: ::c_int = 45; https://github.com/rust-lang/libc/issues/665" )] pub const PF_MAX: ::c_int = AF_MAX; - -extern { - pub fn getrandom( - buf: *mut ::c_void, - buflen: ::size_t, - flags: ::c_uint, - ) -> ::ssize_t; -} diff --git a/src/unix/linux_like/linux/musl/b64/aarch64.rs b/src/unix/notbsd/linux/musl/b64/aarch64.rs index a72d071b..16cb46d5 100644 --- a/src/unix/linux_like/linux/musl/b64/aarch64.rs +++ b/src/unix/notbsd/linux/musl/b64/aarch64.rs @@ -424,7 +424,6 @@ pub const B3500000: ::speed_t = 0o010016; pub const B4000000: ::speed_t = 0o010017; pub const FIOCLEX: ::c_int = 0x5451; -pub const FIONCLEX: ::c_int = 0x5450; pub const FIONBIO: ::c_int = 0x5421; pub const EDEADLK: ::c_int = 35; pub const EDEADLOCK: ::c_int = EDEADLK; diff --git a/src/unix/linux_like/linux/musl/b64/mod.rs b/src/unix/notbsd/linux/musl/b64/mod.rs index 12d5c849..34b37669 100644 --- a/src/unix/linux_like/linux/musl/b64/mod.rs +++ b/src/unix/notbsd/linux/musl/b64/mod.rs @@ -312,14 +312,6 @@ pub const VEOF: usize = 4; pub const POLLWRNORM: ::c_short = 0x100; pub const POLLWRBAND: ::c_short = 0x200; -extern { - pub fn getrandom( - buf: *mut ::c_void, - buflen: ::size_t, - flags: ::c_uint, - ) -> ::ssize_t; -} - cfg_if! { if #[cfg(target_arch = "aarch64")] { mod aarch64; diff --git a/src/unix/linux_like/linux/musl/b64/powerpc64.rs b/src/unix/notbsd/linux/musl/b64/powerpc64.rs index c8698287..4a8df270 100644 --- a/src/unix/linux_like/linux/musl/b64/powerpc64.rs +++ b/src/unix/notbsd/linux/musl/b64/powerpc64.rs @@ -448,7 +448,6 @@ pub const SYS_pwritev2: ::c_long = 381; pub const SYS_kexec_file_load: ::c_long = 382; pub const FIOCLEX: ::c_int = 0x20006601; -pub const FIONCLEX: ::c_int = 0x20006602; pub const FIONBIO: ::c_int = 0x8004667e; pub const EDEADLK: ::c_int = 58; pub const EDEADLOCK: ::c_int = EDEADLK; diff --git a/src/unix/linux_like/linux/musl/b64/x86_64.rs b/src/unix/notbsd/linux/musl/b64/x86_64.rs index 1a123ff4..df0ce40f 100644 --- a/src/unix/linux_like/linux/musl/b64/x86_64.rs +++ b/src/unix/notbsd/linux/musl/b64/x86_64.rs @@ -584,7 +584,6 @@ pub const B3500000: ::speed_t = 0o010016; pub const B4000000: ::speed_t = 0o010017; pub const FIOCLEX: ::c_int = 0x5451; -pub const FIONCLEX: ::c_int = 0x5450; pub const FIONBIO: ::c_int = 0x5421; pub const EDEADLK: ::c_int = 35; pub const EDEADLOCK: ::c_int = EDEADLK; diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/notbsd/linux/musl/mod.rs index 5dea49b9..99d3ed83 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/notbsd/linux/musl/mod.rs @@ -301,7 +301,7 @@ pub const RTLD_GLOBAL: ::c_int = 0x100; pub const RTLD_NOLOAD: ::c_int = 0x4; // TODO(#247) Temporarily musl-specific (available since musl 0.9.12 / Linux -// kernel 3.10). See also linux_like/mod.rs +// kernel 3.10). See also notbsd/mod.rs pub const CLOCK_SGI_CYCLE: ::clockid_t = 10; pub const CLOCK_TAI: ::clockid_t = 11; diff --git a/src/unix/linux_like/linux/no_align.rs b/src/unix/notbsd/linux/no_align.rs index 1f5f2eea..1f5f2eea 100644 --- a/src/unix/linux_like/linux/no_align.rs +++ b/src/unix/notbsd/linux/no_align.rs diff --git a/src/unix/notbsd/linux/other/align.rs b/src/unix/notbsd/linux/other/align.rs new file mode 100644 index 00000000..4a0e0746 --- /dev/null +++ b/src/unix/notbsd/linux/other/align.rs @@ -0,0 +1,13 @@ +s! { + // FIXME this is actually a union + #[cfg_attr(target_pointer_width = "32", + repr(align(4)))] + #[cfg_attr(target_pointer_width = "64", + repr(align(8)))] + pub struct sem_t { + #[cfg(target_pointer_width = "32")] + __size: [::c_char; 16], + #[cfg(target_pointer_width = "64")] + __size: [::c_char; 32], + } +} diff --git a/src/unix/linux_like/linux/gnu/b32/arm.rs b/src/unix/notbsd/linux/other/b32/arm.rs index e186c241..a2d190d6 100644 --- a/src/unix/linux_like/linux/gnu/b32/arm.rs +++ b/src/unix/notbsd/linux/other/b32/arm.rs @@ -2,37 +2,6 @@ pub type c_char = u8; pub type wchar_t = u32; s! { - pub struct sigaction { - pub sa_sigaction: ::sighandler_t, - pub sa_mask: ::sigset_t, - pub sa_flags: ::c_int, - pub sa_restorer: ::Option<extern fn()>, - } - - pub struct statfs { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - f_spare: [::__fsword_t; 5], - } - - pub struct flock { - pub l_type: ::c_short, - pub l_whence: ::c_short, - pub l_start: ::off_t, - pub l_len: ::off_t, - pub l_pid: ::pid_t, - } - pub struct ipc_perm { pub __key: ::key_t, pub uid: ::uid_t, @@ -143,169 +112,18 @@ s! { pub c_ispeed: ::speed_t, pub c_ospeed: ::speed_t, } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_errno: ::c_int, - pub si_code: ::c_int, - #[doc(hidden)] - #[deprecated( - since="0.2.54", - note="Please leave a comment on \ - https://github.com/rust-lang/libc/pull/1316 if you're using \ - this field" - )] - pub _pad: [::c_int; 29], - _align: [usize; 0], - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t - } } -pub const RLIM_INFINITY: ::rlim_t = !0; -pub const VEOF: usize = 4; -pub const RTLD_DEEPBIND: ::c_int = 0x8; -pub const RTLD_GLOBAL: ::c_int = 0x100; -pub const RTLD_NOLOAD: ::c_int = 0x4; pub const O_DIRECT: ::c_int = 0x10000; pub const O_DIRECTORY: ::c_int = 0x4000; pub const O_NOFOLLOW: ::c_int = 0x8000; pub const O_LARGEFILE: ::c_int = 0o400000; -pub const O_APPEND: ::c_int = 1024; -pub const O_CREAT: ::c_int = 64; -pub const O_EXCL: ::c_int = 128; -pub const O_NOCTTY: ::c_int = 256; -pub const O_NONBLOCK: ::c_int = 2048; -pub const O_SYNC: ::c_int = 1052672; -pub const O_RSYNC: ::c_int = 1052672; -pub const O_DSYNC: ::c_int = 4096; -pub const O_FSYNC: ::c_int = 0x101000; -pub const O_ASYNC: ::c_int = 0x2000; -pub const O_NDELAY: ::c_int = 0x800; -pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; -pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; -pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; -pub const RLIMIT_AS: ::__rlimit_resource_t = 9; -pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; -pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MAP_LOCKED: ::c_int = 0x02000; pub const MAP_NORESERVE: ::c_int = 0x04000; -pub const MAP_ANON: ::c_int = 0x0020; -pub const MAP_ANONYMOUS: ::c_int = 0x0020; -pub const MAP_DENYWRITE: ::c_int = 0x0800; -pub const MAP_EXECUTABLE: ::c_int = 0x01000; -pub const MAP_POPULATE: ::c_int = 0x08000; -pub const MAP_NONBLOCK: ::c_int = 0x010000; -pub const MAP_STACK: ::c_int = 0x020000; -pub const MAP_HUGETLB: ::c_int = 0x040000; -pub const MAP_GROWSDOWN: ::c_int = 0x0100; - -pub const SOL_SOCKET: ::c_int = 1; pub const EDEADLOCK: ::c_int = 35; -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; -pub const EDEADLK: ::c_int = 35; -pub const ENAMETOOLONG: ::c_int = 36; -pub const ENOLCK: ::c_int = 37; -pub const ENOSYS: ::c_int = 38; -pub const ENOTEMPTY: ::c_int = 39; -pub const ELOOP: ::c_int = 40; -pub const ENOMSG: ::c_int = 42; -pub const EIDRM: ::c_int = 43; -pub const ECHRNG: ::c_int = 44; -pub const EL2NSYNC: ::c_int = 45; -pub const EL3HLT: ::c_int = 46; -pub const EL3RST: ::c_int = 47; -pub const ELNRNG: ::c_int = 48; -pub const EUNATCH: ::c_int = 49; -pub const ENOCSI: ::c_int = 50; -pub const EL2HLT: ::c_int = 51; -pub const EBADE: ::c_int = 52; -pub const EBADR: ::c_int = 53; -pub const EXFULL: ::c_int = 54; -pub const ENOANO: ::c_int = 55; -pub const EBADRQC: ::c_int = 56; -pub const EBADSLT: ::c_int = 57; -pub const EMULTIHOP: ::c_int = 72; -pub const EOVERFLOW: ::c_int = 75; -pub const ENOTUNIQ: ::c_int = 76; -pub const EBADFD: ::c_int = 77; -pub const EBADMSG: ::c_int = 74; -pub const EREMCHG: ::c_int = 78; -pub const ELIBACC: ::c_int = 79; -pub const ELIBBAD: ::c_int = 80; -pub const ELIBSCN: ::c_int = 81; -pub const ELIBMAX: ::c_int = 82; -pub const ELIBEXEC: ::c_int = 83; -pub const EILSEQ: ::c_int = 84; -pub const ERESTART: ::c_int = 85; -pub const ESTRPIPE: ::c_int = 86; -pub const EUSERS: ::c_int = 87; -pub const ENOTSOCK: ::c_int = 88; -pub const EDESTADDRREQ: ::c_int = 89; -pub const EMSGSIZE: ::c_int = 90; -pub const EPROTOTYPE: ::c_int = 91; -pub const ENOPROTOOPT: ::c_int = 92; -pub const EPROTONOSUPPORT: ::c_int = 93; -pub const ESOCKTNOSUPPORT: ::c_int = 94; -pub const EOPNOTSUPP: ::c_int = 95; -pub const EPFNOSUPPORT: ::c_int = 96; -pub const EAFNOSUPPORT: ::c_int = 97; -pub const EADDRINUSE: ::c_int = 98; -pub const EADDRNOTAVAIL: ::c_int = 99; -pub const ENETDOWN: ::c_int = 100; -pub const ENETUNREACH: ::c_int = 101; -pub const ENETRESET: ::c_int = 102; -pub const ECONNABORTED: ::c_int = 103; -pub const ECONNRESET: ::c_int = 104; -pub const ENOBUFS: ::c_int = 105; -pub const EISCONN: ::c_int = 106; -pub const ENOTCONN: ::c_int = 107; -pub const ESHUTDOWN: ::c_int = 108; -pub const ETOOMANYREFS: ::c_int = 109; -pub const ETIMEDOUT: ::c_int = 110; -pub const ECONNREFUSED: ::c_int = 111; -pub const EHOSTDOWN: ::c_int = 112; -pub const EHOSTUNREACH: ::c_int = 113; -pub const EALREADY: ::c_int = 114; -pub const EINPROGRESS: ::c_int = 115; -pub const ESTALE: ::c_int = 116; -pub const EDQUOT: ::c_int = 122; -pub const ENOMEDIUM: ::c_int = 123; -pub const EMEDIUMTYPE: ::c_int = 124; -pub const ECANCELED: ::c_int = 125; -pub const ENOKEY: ::c_int = 126; -pub const EKEYEXPIRED: ::c_int = 127; -pub const EKEYREVOKED: ::c_int = 128; -pub const EKEYREJECTED: ::c_int = 129; -pub const EOWNERDEAD: ::c_int = 130; -pub const ENOTRECOVERABLE: ::c_int = 131; -pub const EHWPOISON: ::c_int = 133; -pub const ERFKILL: ::c_int = 132; -pub const SO_REUSEADDR: ::c_int = 2; -pub const SO_TYPE: ::c_int = 3; -pub const SO_ERROR: ::c_int = 4; -pub const SO_DONTROUTE: ::c_int = 5; -pub const SO_BROADCAST: ::c_int = 6; -pub const SO_SNDBUF: ::c_int = 7; -pub const SO_RCVBUF: ::c_int = 8; -pub const SO_KEEPALIVE: ::c_int = 9; -pub const SO_OOBINLINE: ::c_int = 10; -pub const SO_LINGER: ::c_int = 13; -pub const SO_REUSEPORT: ::c_int = 15; -pub const SO_ACCEPTCONN: ::c_int = 30; -pub const SO_PROTOCOL: ::c_int = 38; -pub const SO_DOMAIN: ::c_int = 39; pub const SO_PASSCRED: ::c_int = 16; pub const SO_PEERCRED: ::c_int = 17; pub const SO_RCVLOWAT: ::c_int = 18; @@ -315,57 +133,12 @@ pub const SO_SNDTIMEO: ::c_int = 21; pub const SO_SNDBUFFORCE: ::c_int = 32; pub const SO_RCVBUFFORCE: ::c_int = 33; -pub const SA_SIGINFO: ::c_int = 0x00000004; -pub const SA_NOCLDWAIT: ::c_int = 0x00000002; - -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; - pub const FIOCLEX: ::c_ulong = 0x5451; -pub const FIONCLEX: ::c_ulong = 0x5450; pub const FIONBIO: ::c_ulong = 0x5421; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; -pub const POLLWRNORM: ::c_short = 0x100; -pub const POLLWRBAND: ::c_short = 0x200; - -pub const F_GETLK: ::c_int = 5; -pub const F_GETOWN: ::c_int = 9; -pub const F_SETOWN: ::c_int = 8; - -pub const EFD_NONBLOCK: ::c_int = 0x800; -pub const SFD_NONBLOCK: ::c_int = 0x0800; - -pub const SIGCHLD: ::c_int = 17; -pub const SIGBUS: ::c_int = 7; -pub const SIGUSR1: ::c_int = 10; -pub const SIGUSR2: ::c_int = 12; -pub const SIGCONT: ::c_int = 18; -pub const SIGSTOP: ::c_int = 19; -pub const SIGTSTP: ::c_int = 20; -pub const SIGURG: ::c_int = 23; -pub const SIGIO: ::c_int = 29; -pub const SIGSYS: ::c_int = 31; -pub const SIGSTKFLT: ::c_int = 16; -#[deprecated( - since = "0.2.55", - note = "Use SIGSYS instead" -)] -pub const SIGUNUSED: ::c_int = 31; -pub const SIGPOLL: ::c_int = 29; -pub const SIGPWR: ::c_int = 30; -pub const SIG_SETMASK: ::c_int = 2; -pub const SIG_BLOCK: ::c_int = 0x000000; -pub const SIG_UNBLOCK: ::c_int = 0x01; -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; pub const SIGSTKSZ: ::size_t = 8192; pub const MINSIGSTKSZ: ::size_t = 2048; pub const CBAUD: ::tcflag_t = 0o0010017; @@ -483,31 +256,6 @@ pub const TIOCGRS485: ::c_int = 0x542E; pub const TIOCSRS485: ::c_int = 0x542F; pub const FIONREAD: ::c_ulong = 0x541B; -pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; -pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; -pub const TIOCEXCL: ::c_ulong = 0x540C; -pub const TIOCNXCL: ::c_ulong = 0x540D; -pub const TIOCSCTTY: ::c_ulong = 0x540E; -pub const TIOCSTI: ::c_ulong = 0x5412; -pub const TIOCMGET: ::c_ulong = 0x5415; -pub const TIOCMBIS: ::c_ulong = 0x5416; -pub const TIOCMBIC: ::c_ulong = 0x5417; -pub const TIOCMSET: ::c_ulong = 0x5418; -pub const TIOCCONS: ::c_ulong = 0x541D; - -pub const TCSANOW: ::c_int = 0; -pub const TCSADRAIN: ::c_int = 1; -pub const TCSAFLUSH: ::c_int = 2; - -pub const TIOCLINUX: ::c_ulong = 0x541C; -pub const TIOCGSERIAL: ::c_ulong = 0x541E; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; - // Syscall table pub const SYS_restart_syscall: ::c_long = 0; pub const SYS_exit: ::c_long = 1; diff --git a/src/unix/linux_like/linux/gnu/b32/mod.rs b/src/unix/notbsd/linux/other/b32/mod.rs index 2e584f21..08c0ed23 100644 --- a/src/unix/linux_like/linux/gnu/b32/mod.rs +++ b/src/unix/notbsd/linux/other/b32/mod.rs @@ -10,6 +10,7 @@ pub type suseconds_t = i32; pub type ino_t = u32; pub type off_t = i32; pub type blkcnt_t = i32; +pub type __fsword_t = i32; pub type fsblkcnt_t = ::c_ulong; pub type fsfilcnt_t = ::c_ulong; @@ -20,38 +21,20 @@ pub type msglen_t = ::c_ulong; pub type blksize_t = i32; pub type nlink_t = u32; pub type __u64 = ::c_ulonglong; -pub type __fsword_t = i32; s! { pub struct stat { - #[cfg(not(target_arch = "mips"))] pub st_dev: ::dev_t, - #[cfg(target_arch = "mips")] - pub st_dev: ::c_ulong, - - #[cfg(not(target_arch = "mips"))] __pad1: ::c_short, - #[cfg(target_arch = "mips")] - st_pad1: [::c_long; 3], pub st_ino: ::ino_t, pub st_mode: ::mode_t, pub st_nlink: ::nlink_t, pub st_uid: ::uid_t, pub st_gid: ::gid_t, - #[cfg(not(target_arch = "mips"))] pub st_rdev: ::dev_t, - #[cfg(target_arch = "mips")] - pub st_rdev: ::c_ulong, - #[cfg(not(target_arch = "mips"))] __pad2: ::c_short, - #[cfg(target_arch = "mips")] - st_pad2: [::c_long; 2], pub st_size: ::off_t, - #[cfg(target_arch = "mips")] - st_pad3: ::c_long, - #[cfg(not(target_arch = "mips"))] pub st_blksize: ::blksize_t, - #[cfg(not(target_arch = "mips"))] pub st_blocks: ::blkcnt_t, pub st_atime: ::time_t, pub st_atime_nsec: ::c_long, @@ -59,16 +42,8 @@ s! { pub st_mtime_nsec: ::c_long, pub st_ctime: ::time_t, pub st_ctime_nsec: ::c_long, - #[cfg(not(target_arch = "mips"))] __unused4: ::c_long, - #[cfg(not(target_arch = "mips"))] __unused5: ::c_long, - #[cfg(target_arch = "mips")] - pub st_blksize: ::blksize_t, - #[cfg(target_arch = "mips")] - pub st_blocks: ::blkcnt_t, - #[cfg(target_arch = "mips")] - st_pad5: [::c_long; 14], } pub struct statvfs { @@ -105,10 +80,6 @@ s! { pub totalswap: ::c_ulong, pub freeswap: ::c_ulong, pub procs: ::c_ushort, - #[deprecated( - since = "0.2.58", - note = "This padding field might become private in the future" - )] pub pad: ::c_ushort, pub totalhigh: ::c_ulong, pub freehigh: ::c_ulong, @@ -117,25 +88,170 @@ s! { } } +pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; +pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; + +pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; +pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; + +pub const O_APPEND: ::c_int = 1024; +pub const O_CREAT: ::c_int = 64; +pub const O_EXCL: ::c_int = 128; +pub const O_NOCTTY: ::c_int = 256; +pub const O_NONBLOCK: ::c_int = 2048; +pub const O_SYNC: ::c_int = 1052672; +pub const O_RSYNC: ::c_int = 1052672; +pub const O_DSYNC: ::c_int = 4096; +pub const O_FSYNC: ::c_int = 0x101000; pub const O_NOATIME: ::c_int = 0o1000000; pub const O_PATH: ::c_int = 0o10000000; pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; + +pub const EDEADLK: ::c_int = 35; +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOSYS: ::c_int = 38; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const EMULTIHOP: ::c_int = 72; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EBADMSG: ::c_int = 74; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ENOTCONN: ::c_int = 107; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const EHWPOISON: ::c_int = 133; +pub const ERFKILL: ::c_int = 132; + +pub const SOL_SOCKET: ::c_int = 1; + +pub const SO_REUSEADDR: ::c_int = 2; +pub const SO_TYPE: ::c_int = 3; +pub const SO_ERROR: ::c_int = 4; +pub const SO_DONTROUTE: ::c_int = 5; +pub const SO_BROADCAST: ::c_int = 6; +pub const SO_SNDBUF: ::c_int = 7; +pub const SO_RCVBUF: ::c_int = 8; +pub const SO_KEEPALIVE: ::c_int = 9; +pub const SO_OOBINLINE: ::c_int = 10; pub const SO_PRIORITY: ::c_int = 12; +pub const SO_LINGER: ::c_int = 13; pub const SO_BSDCOMPAT: ::c_int = 14; +pub const SO_REUSEPORT: ::c_int = 15; pub const SO_BINDTODEVICE: ::c_int = 25; pub const SO_TIMESTAMP: ::c_int = 29; +pub const SO_ACCEPTCONN: ::c_int = 30; pub const SO_MARK: ::c_int = 36; +pub const SO_PROTOCOL: ::c_int = 38; +pub const SO_DOMAIN: ::c_int = 39; pub const SO_RXQ_OVFL: ::c_int = 40; pub const SO_PEEK_OFF: ::c_int = 42; pub const SO_BUSY_POLL: ::c_int = 46; pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 0x00000004; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; + +pub const SIGCHLD: ::c_int = 17; +pub const SIGBUS: ::c_int = 7; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +#[deprecated( + since = "0.2.55", + note = "Use SIGSYS instead" +)] +pub const SIGUNUSED: ::c_int = 31; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIG_BLOCK: ::c_int = 0x000000; +pub const SIG_UNBLOCK: ::c_int = 0x01; + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +pub const O_ASYNC: ::c_int = 0x2000; +pub const O_NDELAY: ::c_int = 0x800; pub const PTRACE_DETACH: ::c_uint = 17; -pub const POSIX_FADV_DONTNEED: ::c_int = 4; -pub const POSIX_FADV_NOREUSE: ::c_int = 5; +pub const EFD_NONBLOCK: ::c_int = 0x800; + +pub const F_GETLK: ::c_int = 5; +pub const F_GETOWN: ::c_int = 9; +pub const F_SETOWN: ::c_int = 8; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; @@ -143,6 +259,18 @@ pub const F_RDLCK: ::c_int = 0; pub const F_WRLCK: ::c_int = 1; pub const F_UNLCK: ::c_int = 2; +pub const SFD_NONBLOCK: ::c_int = 0x0800; + +pub const TIOCEXCL: ::c_ulong = 0x540C; +pub const TIOCNXCL: ::c_ulong = 0x540D; +pub const TIOCSCTTY: ::c_ulong = 0x540E; +pub const TIOCSTI: ::c_ulong = 0x5412; +pub const TIOCMGET: ::c_ulong = 0x5415; +pub const TIOCMBIS: ::c_ulong = 0x5416; +pub const TIOCMBIC: ::c_ulong = 0x5417; +pub const TIOCMSET: ::c_ulong = 0x5418; +pub const TIOCCONS: ::c_ulong = 0x541D; + pub const SFD_CLOEXEC: ::c_int = 0x080000; pub const NCCS: usize = 32; @@ -255,9 +383,6 @@ cfg_if! { } else if #[cfg(target_arch = "arm")] { mod arm; pub use self::arm::*; - } else if #[cfg(target_arch = "mips")] { - mod mips; - pub use self::mips::*; } else if #[cfg(target_arch = "powerpc")] { mod powerpc; pub use self::powerpc::*; diff --git a/src/unix/linux_like/linux/gnu/b32/powerpc.rs b/src/unix/notbsd/linux/other/b32/powerpc.rs index 8f57b726..a64f0752 100644 --- a/src/unix/linux_like/linux/gnu/b32/powerpc.rs +++ b/src/unix/notbsd/linux/other/b32/powerpc.rs @@ -2,37 +2,6 @@ pub type c_char = u8; pub type wchar_t = i32; s! { - pub struct sigaction { - pub sa_sigaction: ::sighandler_t, - pub sa_mask: ::sigset_t, - pub sa_flags: ::c_int, - pub sa_restorer: ::Option<extern fn()>, - } - - pub struct statfs { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - f_spare: [::__fsword_t; 5], - } - - pub struct flock { - pub l_type: ::c_short, - pub l_whence: ::c_short, - pub l_start: ::off_t, - pub l_len: ::off_t, - pub l_pid: ::pid_t, - } - pub struct ipc_perm { __key: ::key_t, pub uid: ::uid_t, @@ -132,181 +101,18 @@ s! { __glibc_reserved4: ::c_ulong, __glibc_reserved5: ::c_ulong, } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_errno: ::c_int, - pub si_code: ::c_int, - #[doc(hidden)] - #[deprecated( - since="0.2.54", - note="Please leave a comment on \ - https://github.com/rust-lang/libc/pull/1316 if you're using \ - this field" - )] - pub _pad: [::c_int; 29], - _align: [usize; 0], - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t - } } -pub const RLIM_INFINITY: ::rlim_t = !0; -pub const VEOF: usize = 4; -pub const RTLD_DEEPBIND: ::c_int = 0x8; -pub const RTLD_GLOBAL: ::c_int = 0x100; -pub const RTLD_NOLOAD: ::c_int = 0x4; pub const O_DIRECT: ::c_int = 0x20000; pub const O_DIRECTORY: ::c_int = 0x4000; pub const O_NOFOLLOW: ::c_int = 0x8000; pub const O_LARGEFILE: ::c_int = 0o200000; -pub const O_APPEND: ::c_int = 1024; -pub const O_CREAT: ::c_int = 64; -pub const O_EXCL: ::c_int = 128; -pub const O_NOCTTY: ::c_int = 256; -pub const O_NONBLOCK: ::c_int = 2048; -pub const O_SYNC: ::c_int = 1052672; -pub const O_RSYNC: ::c_int = 1052672; -pub const O_DSYNC: ::c_int = 4096; -pub const O_FSYNC: ::c_int = 0x101000; -pub const O_ASYNC: ::c_int = 0x2000; -pub const O_NDELAY: ::c_int = 0x800; -pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; -pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; -pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; -pub const RLIMIT_AS: ::__rlimit_resource_t = 9; -pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; -pub const TCSANOW: ::c_int = 0; -pub const TCSADRAIN: ::c_int = 1; -pub const TCSAFLUSH: ::c_int = 2; - -pub const TIOCLINUX: ::c_ulong = 0x541C; -pub const TIOCGSERIAL: ::c_ulong = 0x541E; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; -pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MAP_LOCKED: ::c_int = 0x00080; pub const MAP_NORESERVE: ::c_int = 0x00040; -pub const MAP_ANON: ::c_int = 0x0020; -pub const MAP_ANONYMOUS: ::c_int = 0x0020; -pub const MAP_DENYWRITE: ::c_int = 0x0800; -pub const MAP_EXECUTABLE: ::c_int = 0x01000; -pub const MAP_POPULATE: ::c_int = 0x08000; -pub const MAP_NONBLOCK: ::c_int = 0x010000; -pub const MAP_STACK: ::c_int = 0x020000; -pub const MAP_HUGETLB: ::c_int = 0x040000; -pub const MAP_GROWSDOWN: ::c_int = 0x0100; - -pub const SOL_SOCKET: ::c_int = 1; pub const EDEADLOCK: ::c_int = 58; -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; -pub const EDEADLK: ::c_int = 35; -pub const ENAMETOOLONG: ::c_int = 36; -pub const ENOLCK: ::c_int = 37; -pub const ENOSYS: ::c_int = 38; -pub const ENOTEMPTY: ::c_int = 39; -pub const ELOOP: ::c_int = 40; -pub const ENOMSG: ::c_int = 42; -pub const EIDRM: ::c_int = 43; -pub const ECHRNG: ::c_int = 44; -pub const EL2NSYNC: ::c_int = 45; -pub const EL3HLT: ::c_int = 46; -pub const EL3RST: ::c_int = 47; -pub const ELNRNG: ::c_int = 48; -pub const EUNATCH: ::c_int = 49; -pub const ENOCSI: ::c_int = 50; -pub const EL2HLT: ::c_int = 51; -pub const EBADE: ::c_int = 52; -pub const EBADR: ::c_int = 53; -pub const EXFULL: ::c_int = 54; -pub const ENOANO: ::c_int = 55; -pub const EBADRQC: ::c_int = 56; -pub const EBADSLT: ::c_int = 57; -pub const EMULTIHOP: ::c_int = 72; -pub const EOVERFLOW: ::c_int = 75; -pub const ENOTUNIQ: ::c_int = 76; -pub const EBADFD: ::c_int = 77; -pub const EBADMSG: ::c_int = 74; -pub const EREMCHG: ::c_int = 78; -pub const ELIBACC: ::c_int = 79; -pub const ELIBBAD: ::c_int = 80; -pub const ELIBSCN: ::c_int = 81; -pub const ELIBMAX: ::c_int = 82; -pub const ELIBEXEC: ::c_int = 83; -pub const EILSEQ: ::c_int = 84; -pub const ERESTART: ::c_int = 85; -pub const ESTRPIPE: ::c_int = 86; -pub const EUSERS: ::c_int = 87; -pub const ENOTSOCK: ::c_int = 88; -pub const EDESTADDRREQ: ::c_int = 89; -pub const EMSGSIZE: ::c_int = 90; -pub const EPROTOTYPE: ::c_int = 91; -pub const ENOPROTOOPT: ::c_int = 92; -pub const EPROTONOSUPPORT: ::c_int = 93; -pub const ESOCKTNOSUPPORT: ::c_int = 94; -pub const EOPNOTSUPP: ::c_int = 95; -pub const EPFNOSUPPORT: ::c_int = 96; -pub const EAFNOSUPPORT: ::c_int = 97; -pub const EADDRINUSE: ::c_int = 98; -pub const EADDRNOTAVAIL: ::c_int = 99; -pub const ENETDOWN: ::c_int = 100; -pub const ENETUNREACH: ::c_int = 101; -pub const ENETRESET: ::c_int = 102; -pub const ECONNABORTED: ::c_int = 103; -pub const ECONNRESET: ::c_int = 104; -pub const ENOBUFS: ::c_int = 105; -pub const EISCONN: ::c_int = 106; -pub const ENOTCONN: ::c_int = 107; -pub const ESHUTDOWN: ::c_int = 108; -pub const ETOOMANYREFS: ::c_int = 109; -pub const ETIMEDOUT: ::c_int = 110; -pub const ECONNREFUSED: ::c_int = 111; -pub const EHOSTDOWN: ::c_int = 112; -pub const EHOSTUNREACH: ::c_int = 113; -pub const EALREADY: ::c_int = 114; -pub const EINPROGRESS: ::c_int = 115; -pub const ESTALE: ::c_int = 116; -pub const EDQUOT: ::c_int = 122; -pub const ENOMEDIUM: ::c_int = 123; -pub const EMEDIUMTYPE: ::c_int = 124; -pub const ECANCELED: ::c_int = 125; -pub const ENOKEY: ::c_int = 126; -pub const EKEYEXPIRED: ::c_int = 127; -pub const EKEYREVOKED: ::c_int = 128; -pub const EKEYREJECTED: ::c_int = 129; -pub const EOWNERDEAD: ::c_int = 130; -pub const ENOTRECOVERABLE: ::c_int = 131; -pub const EHWPOISON: ::c_int = 133; -pub const ERFKILL: ::c_int = 132; -pub const SO_REUSEADDR: ::c_int = 2; -pub const SO_TYPE: ::c_int = 3; -pub const SO_ERROR: ::c_int = 4; -pub const SO_DONTROUTE: ::c_int = 5; -pub const SO_BROADCAST: ::c_int = 6; -pub const SO_SNDBUF: ::c_int = 7; -pub const SO_RCVBUF: ::c_int = 8; -pub const SO_KEEPALIVE: ::c_int = 9; -pub const SO_OOBINLINE: ::c_int = 10; -pub const SO_LINGER: ::c_int = 13; -pub const SO_REUSEPORT: ::c_int = 15; -pub const SO_ACCEPTCONN: ::c_int = 30; -pub const SO_PROTOCOL: ::c_int = 38; -pub const SO_DOMAIN: ::c_int = 39; pub const SO_SNDBUFFORCE: ::c_int = 32; pub const SO_RCVBUFFORCE: ::c_int = 33; pub const SO_NO_CHECK: ::c_int = 11; @@ -317,69 +123,12 @@ pub const SO_SNDTIMEO: ::c_int = 19; pub const SO_PASSCRED: ::c_int = 20; pub const SO_PEERCRED: ::c_int = 21; -pub const SA_SIGINFO: ::c_int = 0x00000004; -pub const SA_NOCLDWAIT: ::c_int = 0x00000002; - -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; - pub const FIOCLEX: ::c_ulong = 0x20006601; -pub const FIONCLEX: ::c_ulong = 0x20006602; pub const FIONBIO: ::c_ulong = 0x8004667e; pub const MCL_CURRENT: ::c_int = 0x2000; pub const MCL_FUTURE: ::c_int = 0x4000; -pub const POLLWRNORM: ::c_short = 0x100; -pub const POLLWRBAND: ::c_short = 0x200; - -pub const F_GETLK: ::c_int = 5; -pub const F_GETOWN: ::c_int = 9; -pub const F_SETOWN: ::c_int = 8; - -pub const EFD_NONBLOCK: ::c_int = 0x800; -pub const SFD_NONBLOCK: ::c_int = 0x0800; - -pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; -pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; -pub const TIOCEXCL: ::c_ulong = 0x540C; -pub const TIOCNXCL: ::c_ulong = 0x540D; -pub const TIOCSCTTY: ::c_ulong = 0x540E; -pub const TIOCSTI: ::c_ulong = 0x5412; -pub const TIOCMGET: ::c_ulong = 0x5415; -pub const TIOCMBIS: ::c_ulong = 0x5416; -pub const TIOCMBIC: ::c_ulong = 0x5417; -pub const TIOCMSET: ::c_ulong = 0x5418; -pub const TIOCCONS: ::c_ulong = 0x541D; - -pub const SIGCHLD: ::c_int = 17; -pub const SIGBUS: ::c_int = 7; -pub const SIGUSR1: ::c_int = 10; -pub const SIGUSR2: ::c_int = 12; -pub const SIGCONT: ::c_int = 18; -pub const SIGSTOP: ::c_int = 19; -pub const SIGTSTP: ::c_int = 20; -pub const SIGURG: ::c_int = 23; -pub const SIGIO: ::c_int = 29; -pub const SIGSYS: ::c_int = 31; -pub const SIGSTKFLT: ::c_int = 16; -#[deprecated( - since = "0.2.55", - note = "Use SIGSYS instead" -)] -pub const SIGUNUSED: ::c_int = 31; -pub const SIGPOLL: ::c_int = 29; -pub const SIGPWR: ::c_int = 30; -pub const SIG_SETMASK: ::c_int = 2; -pub const SIG_BLOCK: ::c_int = 0x000000; -pub const SIG_UNBLOCK: ::c_int = 0x01; -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; pub const SIGSTKSZ: ::size_t = 0x4000; pub const MINSIGSTKSZ: ::size_t = 4096; pub const CBAUD: ::tcflag_t = 0xff; diff --git a/src/unix/linux_like/linux/gnu/b32/x86.rs b/src/unix/notbsd/linux/other/b32/x86.rs index 654a18d7..00f1f1a1 100644 --- a/src/unix/linux_like/linux/gnu/b32/x86.rs +++ b/src/unix/notbsd/linux/other/b32/x86.rs @@ -3,37 +3,6 @@ pub type wchar_t = i32; pub type greg_t = i32; s! { - pub struct sigaction { - pub sa_sigaction: ::sighandler_t, - pub sa_mask: ::sigset_t, - pub sa_flags: ::c_int, - pub sa_restorer: ::Option<extern fn()>, - } - - pub struct statfs { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - f_spare: [::__fsword_t; 5], - } - - pub struct flock { - pub l_type: ::c_short, - pub l_whence: ::c_short, - pub l_start: ::off_t, - pub l_len: ::off_t, - pub l_pid: ::pid_t, - } - pub struct _libc_fpreg { pub significand: [u16; 4], pub exponent: u16, @@ -217,27 +186,6 @@ s! { pub c_ispeed: ::speed_t, pub c_ospeed: ::speed_t, } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_errno: ::c_int, - pub si_code: ::c_int, - #[doc(hidden)] - #[deprecated( - since="0.2.54", - note="Please leave a comment on \ - https://github.com/rust-lang/libc/pull/1316 if you're using \ - this field" - )] - pub _pad: [::c_int; 29], - _align: [usize; 0], - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t - } } s_no_extra_traits!{ @@ -367,147 +315,17 @@ cfg_if! { } } -pub const RLIM_INFINITY: ::rlim_t = !0; -pub const VEOF: usize = 4; -pub const RTLD_DEEPBIND: ::c_int = 0x8; -pub const RTLD_GLOBAL: ::c_int = 0x100; -pub const RTLD_NOLOAD: ::c_int = 0x4; pub const O_DIRECT: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x10000; pub const O_NOFOLLOW: ::c_int = 0x20000; pub const O_LARGEFILE: ::c_int = 0o0100000; -pub const O_APPEND: ::c_int = 1024; -pub const O_CREAT: ::c_int = 64; -pub const O_EXCL: ::c_int = 128; -pub const O_NOCTTY: ::c_int = 256; -pub const O_NONBLOCK: ::c_int = 2048; -pub const O_SYNC: ::c_int = 1052672; -pub const O_RSYNC: ::c_int = 1052672; -pub const O_DSYNC: ::c_int = 4096; -pub const O_FSYNC: ::c_int = 0x101000; -pub const O_ASYNC: ::c_int = 0x2000; -pub const O_NDELAY: ::c_int = 0x800; -pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; -pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; -pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; -pub const RLIMIT_AS: ::__rlimit_resource_t = 9; -pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; -pub const SOL_SOCKET: ::c_int = 1; - -pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MAP_LOCKED: ::c_int = 0x02000; pub const MAP_NORESERVE: ::c_int = 0x04000; pub const MAP_32BIT: ::c_int = 0x0040; -pub const MAP_ANON: ::c_int = 0x0020; -pub const MAP_ANONYMOUS: ::c_int = 0x0020; -pub const MAP_DENYWRITE: ::c_int = 0x0800; -pub const MAP_EXECUTABLE: ::c_int = 0x01000; -pub const MAP_POPULATE: ::c_int = 0x08000; -pub const MAP_NONBLOCK: ::c_int = 0x010000; -pub const MAP_STACK: ::c_int = 0x020000; -pub const MAP_HUGETLB: ::c_int = 0x040000; -pub const MAP_GROWSDOWN: ::c_int = 0x0100; pub const EDEADLOCK: ::c_int = 35; -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; -pub const EDEADLK: ::c_int = 35; -pub const ENAMETOOLONG: ::c_int = 36; -pub const ENOLCK: ::c_int = 37; -pub const ENOSYS: ::c_int = 38; -pub const ENOTEMPTY: ::c_int = 39; -pub const ELOOP: ::c_int = 40; -pub const ENOMSG: ::c_int = 42; -pub const EIDRM: ::c_int = 43; -pub const ECHRNG: ::c_int = 44; -pub const EL2NSYNC: ::c_int = 45; -pub const EL3HLT: ::c_int = 46; -pub const EL3RST: ::c_int = 47; -pub const ELNRNG: ::c_int = 48; -pub const EUNATCH: ::c_int = 49; -pub const ENOCSI: ::c_int = 50; -pub const EL2HLT: ::c_int = 51; -pub const EBADE: ::c_int = 52; -pub const EBADR: ::c_int = 53; -pub const EXFULL: ::c_int = 54; -pub const ENOANO: ::c_int = 55; -pub const EBADRQC: ::c_int = 56; -pub const EBADSLT: ::c_int = 57; -pub const EMULTIHOP: ::c_int = 72; -pub const EOVERFLOW: ::c_int = 75; -pub const ENOTUNIQ: ::c_int = 76; -pub const EBADFD: ::c_int = 77; -pub const EBADMSG: ::c_int = 74; -pub const EREMCHG: ::c_int = 78; -pub const ELIBACC: ::c_int = 79; -pub const ELIBBAD: ::c_int = 80; -pub const ELIBSCN: ::c_int = 81; -pub const ELIBMAX: ::c_int = 82; -pub const ELIBEXEC: ::c_int = 83; -pub const EILSEQ: ::c_int = 84; -pub const ERESTART: ::c_int = 85; -pub const ESTRPIPE: ::c_int = 86; -pub const EUSERS: ::c_int = 87; -pub const ENOTSOCK: ::c_int = 88; -pub const EDESTADDRREQ: ::c_int = 89; -pub const EMSGSIZE: ::c_int = 90; -pub const EPROTOTYPE: ::c_int = 91; -pub const ENOPROTOOPT: ::c_int = 92; -pub const EPROTONOSUPPORT: ::c_int = 93; -pub const ESOCKTNOSUPPORT: ::c_int = 94; -pub const EOPNOTSUPP: ::c_int = 95; -pub const EPFNOSUPPORT: ::c_int = 96; -pub const EAFNOSUPPORT: ::c_int = 97; -pub const EADDRINUSE: ::c_int = 98; -pub const EADDRNOTAVAIL: ::c_int = 99; -pub const ENETDOWN: ::c_int = 100; -pub const ENETUNREACH: ::c_int = 101; -pub const ENETRESET: ::c_int = 102; -pub const ECONNABORTED: ::c_int = 103; -pub const ECONNRESET: ::c_int = 104; -pub const ENOBUFS: ::c_int = 105; -pub const EISCONN: ::c_int = 106; -pub const ENOTCONN: ::c_int = 107; -pub const ESHUTDOWN: ::c_int = 108; -pub const ETOOMANYREFS: ::c_int = 109; -pub const ETIMEDOUT: ::c_int = 110; -pub const ECONNREFUSED: ::c_int = 111; -pub const EHOSTDOWN: ::c_int = 112; -pub const EHOSTUNREACH: ::c_int = 113; -pub const EALREADY: ::c_int = 114; -pub const EINPROGRESS: ::c_int = 115; -pub const ESTALE: ::c_int = 116; -pub const EDQUOT: ::c_int = 122; -pub const ENOMEDIUM: ::c_int = 123; -pub const EMEDIUMTYPE: ::c_int = 124; -pub const ECANCELED: ::c_int = 125; -pub const ENOKEY: ::c_int = 126; -pub const EKEYEXPIRED: ::c_int = 127; -pub const EKEYREVOKED: ::c_int = 128; -pub const EKEYREJECTED: ::c_int = 129; -pub const EOWNERDEAD: ::c_int = 130; -pub const ENOTRECOVERABLE: ::c_int = 131; -pub const EHWPOISON: ::c_int = 133; -pub const ERFKILL: ::c_int = 132; -pub const SO_REUSEADDR: ::c_int = 2; -pub const SO_TYPE: ::c_int = 3; -pub const SO_ERROR: ::c_int = 4; -pub const SO_DONTROUTE: ::c_int = 5; -pub const SO_BROADCAST: ::c_int = 6; -pub const SO_SNDBUF: ::c_int = 7; -pub const SO_RCVBUF: ::c_int = 8; -pub const SO_KEEPALIVE: ::c_int = 9; -pub const SO_OOBINLINE: ::c_int = 10; -pub const SO_LINGER: ::c_int = 13; -pub const SO_REUSEPORT: ::c_int = 15; -pub const SO_ACCEPTCONN: ::c_int = 30; -pub const SO_PROTOCOL: ::c_int = 38; -pub const SO_DOMAIN: ::c_int = 39; pub const SO_SNDBUFFORCE: ::c_int = 32; pub const SO_RCVBUFFORCE: ::c_int = 33; pub const SO_NO_CHECK: ::c_int = 11; @@ -518,18 +336,7 @@ pub const SO_SNDLOWAT: ::c_int = 19; pub const SO_RCVTIMEO: ::c_int = 20; pub const SO_SNDTIMEO: ::c_int = 21; -pub const SA_SIGINFO: ::c_int = 0x00000004; -pub const SA_NOCLDWAIT: ::c_int = 0x00000002; - -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; - -pub const F_GETLK: ::c_int = 5; -pub const F_GETOWN: ::c_int = 9; -pub const F_SETOWN: ::c_int = 8; - pub const FIOCLEX: ::c_ulong = 0x5451; -pub const FIONCLEX: ::c_ulong = 0x5450; pub const FIONBIO: ::c_ulong = 0x5421; pub const PTRACE_GETFPXREGS: ::c_uint = 18; @@ -538,40 +345,6 @@ pub const PTRACE_SETFPXREGS: ::c_uint = 19; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; -pub const POLLWRNORM: ::c_short = 0x100; -pub const POLLWRBAND: ::c_short = 0x200; - -pub const EFD_NONBLOCK: ::c_int = 0x800; -pub const SFD_NONBLOCK: ::c_int = 0x0800; - -pub const SIGCHLD: ::c_int = 17; -pub const SIGBUS: ::c_int = 7; -pub const SIGUSR1: ::c_int = 10; -pub const SIGUSR2: ::c_int = 12; -pub const SIGCONT: ::c_int = 18; -pub const SIGSTOP: ::c_int = 19; -pub const SIGTSTP: ::c_int = 20; -pub const SIGURG: ::c_int = 23; -pub const SIGIO: ::c_int = 29; -pub const SIGSYS: ::c_int = 31; -pub const SIGSTKFLT: ::c_int = 16; -#[deprecated( - since = "0.2.55", - note = "Use SIGSYS instead" -)] -pub const SIGUNUSED: ::c_int = 31; -pub const SIGPOLL: ::c_int = 29; -pub const SIGPWR: ::c_int = 30; -pub const SIG_SETMASK: ::c_int = 2; -pub const SIG_BLOCK: ::c_int = 0x000000; -pub const SIG_UNBLOCK: ::c_int = 0x01; -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; pub const SIGSTKSZ: ::size_t = 8192; pub const MINSIGSTKSZ: ::size_t = 2048; pub const CBAUD: ::tcflag_t = 0o0010017; @@ -626,18 +399,6 @@ pub const FFDLY: ::tcflag_t = 0o100000; pub const VTDLY: ::tcflag_t = 0o040000; pub const XTABS: ::tcflag_t = 0o014000; -pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; -pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; -pub const TIOCEXCL: ::c_ulong = 0x540C; -pub const TIOCNXCL: ::c_ulong = 0x540D; -pub const TIOCSCTTY: ::c_ulong = 0x540E; -pub const TIOCSTI: ::c_ulong = 0x5412; -pub const TIOCMGET: ::c_ulong = 0x5415; -pub const TIOCMBIS: ::c_ulong = 0x5416; -pub const TIOCMBIC: ::c_ulong = 0x5417; -pub const TIOCMSET: ::c_ulong = 0x5418; -pub const TIOCCONS: ::c_ulong = 0x541D; - pub const B0: ::speed_t = 0o000000; pub const B50: ::speed_t = 0o000001; pub const B75: ::speed_t = 0o000002; @@ -701,19 +462,6 @@ pub const TIOCGRS485: ::c_int = 0x542E; pub const TIOCSRS485: ::c_int = 0x542F; pub const FIONREAD: ::c_ulong = 0x541B; -pub const TCSANOW: ::c_int = 0; -pub const TCSADRAIN: ::c_int = 1; -pub const TCSAFLUSH: ::c_int = 2; - -pub const TIOCLINUX: ::c_ulong = 0x541C; -pub const TIOCGSERIAL: ::c_ulong = 0x541E; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; - // Syscall table pub const SYS_restart_syscall: ::c_long = 0; pub const SYS_exit: ::c_long = 1; diff --git a/src/unix/linux_like/linux/gnu/b64/aarch64.rs b/src/unix/notbsd/linux/other/b64/aarch64.rs index 3e1bff5a..9699a7d4 100644 --- a/src/unix/linux_like/linux/gnu/b64/aarch64.rs +++ b/src/unix/notbsd/linux/other/b64/aarch64.rs @@ -12,39 +12,6 @@ pub type suseconds_t = i64; pub type __u64 = ::c_ulonglong; s! { - pub struct sigaction { - pub sa_sigaction: ::sighandler_t, - pub sa_mask: ::sigset_t, - #[cfg(target_arch = "sparc64")] - __reserved0: ::c_int, - pub sa_flags: ::c_int, - pub sa_restorer: ::Option<extern fn()>, - } - - pub struct statfs { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - f_spare: [::__fsword_t; 5], - } - - pub struct flock { - pub l_type: ::c_short, - pub l_whence: ::c_short, - pub l_start: ::off_t, - pub l_len: ::off_t, - pub l_pid: ::pid_t, - } - pub struct stat { pub st_dev: ::dev_t, pub st_ino: ::ino_t, @@ -174,44 +141,15 @@ s! { pub c_ispeed: ::speed_t, pub c_ospeed: ::speed_t, } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_errno: ::c_int, - pub si_code: ::c_int, - #[doc(hidden)] - #[deprecated( - since="0.2.54", - note="Please leave a comment on \ - https://github.com/rust-lang/libc/pull/1316 if you're using \ - this field" - )] - pub _pad: [::c_int; 29], - _align: [usize; 0], - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t - } } -pub const VEOF: usize = 4; pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; -pub const RTLD_DEEPBIND: ::c_int = 0x8; -pub const RTLD_GLOBAL: ::c_int = 0x100; -pub const RTLD_NOLOAD: ::c_int = 0x4; - pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; pub const TIOCGRS485: ::c_int = 0x542E; pub const TIOCSRS485: ::c_int = 0x542F; -pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; -pub const RLIMIT_AS: ::__rlimit_resource_t = 9; -pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; @@ -228,14 +166,8 @@ pub const O_NOATIME: ::c_int = 0o1000000; pub const O_PATH: ::c_int = 0o10000000; pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; -pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MAP_GROWSDOWN: ::c_int = 0x0100; -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; pub const EDEADLK: ::c_int = 35; pub const ENAMETOOLONG: ::c_int = 36; pub const ENOLCK: ::c_int = 37; @@ -315,9 +247,6 @@ pub const ENOTRECOVERABLE: ::c_int = 131; pub const EHWPOISON: ::c_int = 133; pub const ERFKILL: ::c_int = 132; -pub const POSIX_FADV_DONTNEED: ::c_int = 4; -pub const POSIX_FADV_NOREUSE: ::c_int = 5; - pub const SOL_SOCKET: ::c_int = 1; pub const SO_REUSEADDR: ::c_int = 2; @@ -373,20 +302,10 @@ pub const SO_INCOMING_CPU: ::c_int = 49; pub const SO_ATTACH_BPF: ::c_int = 50; pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER; -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; - pub const SA_ONSTACK: ::c_int = 0x08000000; pub const SA_SIGINFO: ::c_int = 0x00000004; pub const SA_NOCLDWAIT: ::c_int = 0x00000002; -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; pub const SIGCHLD: ::c_int = 17; pub const SIGBUS: ::c_int = 7; pub const SIGUSR1: ::c_int = 10; @@ -441,13 +360,6 @@ pub const TIOCMBIC: ::c_ulong = 0x5417; pub const TIOCMSET: ::c_ulong = 0x5418; pub const TIOCCONS: ::c_ulong = 0x541D; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; - pub const SFD_CLOEXEC: ::c_int = 0x080000; pub const NCCS: usize = 32; @@ -517,19 +429,10 @@ pub const O_NOFOLLOW: ::c_int = 0x8000; pub const MAP_LOCKED: ::c_int = 0x02000; pub const MAP_NORESERVE: ::c_int = 0x04000; -pub const MAP_ANON: ::c_int = 0x0020; -pub const MAP_ANONYMOUS: ::c_int = 0x0020; -pub const MAP_DENYWRITE: ::c_int = 0x0800; -pub const MAP_EXECUTABLE: ::c_int = 0x01000; -pub const MAP_POPULATE: ::c_int = 0x08000; -pub const MAP_NONBLOCK: ::c_int = 0x010000; -pub const MAP_STACK: ::c_int = 0x020000; -pub const MAP_HUGETLB: ::c_int = 0x040000; pub const EDEADLOCK: ::c_int = 35; pub const FIOCLEX: ::c_ulong = 0x5451; -pub const FIONCLEX: ::c_ulong = 0x5450; pub const FIONBIO: ::c_ulong = 0x5421; pub const MCL_CURRENT: ::c_int = 0x0001; @@ -650,13 +553,6 @@ pub const TIOCGWINSZ: ::c_ulong = 0x5413; pub const TIOCSWINSZ: ::c_ulong = 0x5414; pub const FIONREAD: ::c_ulong = 0x541B; -pub const TCSANOW: ::c_int = 0; -pub const TCSADRAIN: ::c_int = 1; -pub const TCSAFLUSH: ::c_int = 2; - -pub const TIOCLINUX: ::c_ulong = 0x541C; -pub const TIOCGSERIAL: ::c_ulong = 0x541E; - // Syscall table pub const SYS_io_setup: ::c_long = 0; pub const SYS_io_destroy: ::c_long = 1; diff --git a/src/unix/linux_like/linux/gnu/b64/mod.rs b/src/unix/notbsd/linux/other/b64/mod.rs index c91da0d9..7fcf8ba7 100644 --- a/src/unix/linux_like/linux/gnu/b64/mod.rs +++ b/src/unix/notbsd/linux/other/b64/mod.rs @@ -5,13 +5,13 @@ pub type time_t = i64; pub type ino_t = u64; pub type off_t = i64; pub type blkcnt_t = i64; +pub type __fsword_t = i64; pub type shmatt_t = u64; pub type msgqnum_t = u64; pub type msglen_t = u64; pub type fsblkcnt_t = u64; pub type fsfilcnt_t = u64; pub type rlim_t = u64; -pub type __fsword_t = i64; s! { pub struct sigset_t { @@ -51,10 +51,8 @@ s! { __glibc_reserved4: u64, __glibc_reserved5: u64, } - } -pub const RLIM_INFINITY: ::rlim_t = !0; pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; pub const O_LARGEFILE: ::c_int = 0; @@ -69,15 +67,18 @@ cfg_if! { } else if #[cfg(any(target_arch = "sparc64"))] { mod sparc64; pub use self::sparc64::*; - } else if #[cfg(any(target_arch = "mips64"))] { - mod mips64; - pub use self::mips64::*; - } else if #[cfg(any(target_arch = "s390x"))] { - mod s390x; - pub use self::s390x::*; } else if #[cfg(any(target_arch = "x86_64"))] { mod x86_64; pub use self::x86_64::*; + cfg_if! { + if #[cfg(target_pointer_width = "32")] { + mod x32; + pub use self::x32::*; + } else { + mod not_x32; + pub use self::not_x32::*; + } + } } else { // Unknown target_arch } diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs b/src/unix/notbsd/linux/other/b64/not_x32.rs index 97e21f27..97e21f27 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs +++ b/src/unix/notbsd/linux/other/b64/not_x32.rs diff --git a/src/unix/linux_like/linux/gnu/b64/powerpc64.rs b/src/unix/notbsd/linux/other/b64/powerpc64.rs index 43249598..d4538224 100644 --- a/src/unix/linux_like/linux/gnu/b64/powerpc64.rs +++ b/src/unix/notbsd/linux/other/b64/powerpc64.rs @@ -12,39 +12,6 @@ pub type suseconds_t = i64; pub type __u64 = ::c_ulong; s! { - pub struct sigaction { - pub sa_sigaction: ::sighandler_t, - pub sa_mask: ::sigset_t, - #[cfg(target_arch = "sparc64")] - __reserved0: ::c_int, - pub sa_flags: ::c_int, - pub sa_restorer: ::Option<extern fn()>, - } - - pub struct statfs { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - f_spare: [::__fsword_t; 5], - } - - pub struct flock { - pub l_type: ::c_short, - pub l_whence: ::c_short, - pub l_start: ::off_t, - pub l_len: ::off_t, - pub l_pid: ::pid_t, - } - pub struct stat { pub st_dev: ::dev_t, pub st_ino: ::ino_t, @@ -161,44 +128,13 @@ s! { __unused4: ::c_ulong, __unused5: ::c_ulong } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_errno: ::c_int, - pub si_code: ::c_int, - #[doc(hidden)] - #[deprecated( - since="0.2.54", - note="Please leave a comment on \ - https://github.com/rust-lang/libc/pull/1316 if you're using \ - this field" - )] - pub _pad: [::c_int; 29], - _align: [usize; 0], - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t - } } -pub const POSIX_FADV_DONTNEED: ::c_int = 4; -pub const POSIX_FADV_NOREUSE: ::c_int = 5; - -pub const RTLD_DEEPBIND: ::c_int = 0x8; -pub const RTLD_GLOBAL: ::c_int = 0x100; -pub const RTLD_NOLOAD: ::c_int = 0x4; -pub const VEOF: usize = 4; pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; -pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; -pub const RLIMIT_AS: ::__rlimit_resource_t = 9; -pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; @@ -215,16 +151,7 @@ pub const O_NOATIME: ::c_int = 0o1000000; pub const O_PATH: ::c_int = 0o10000000; pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; -pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MAP_GROWSDOWN: ::c_int = 0x0100; -pub const MAP_ANON: ::c_int = 0x0020; -pub const MAP_ANONYMOUS: ::c_int = 0x0020; -pub const MAP_DENYWRITE: ::c_int = 0x0800; -pub const MAP_EXECUTABLE: ::c_int = 0x01000; -pub const MAP_POPULATE: ::c_int = 0x08000; -pub const MAP_NONBLOCK: ::c_int = 0x010000; -pub const MAP_STACK: ::c_int = 0x020000; -pub const MAP_HUGETLB: ::c_int = 0x040000; pub const EDEADLK: ::c_int = 35; pub const ENAMETOOLONG: ::c_int = 36; @@ -360,20 +287,10 @@ pub const SO_INCOMING_CPU: ::c_int = 49; pub const SO_ATTACH_BPF: ::c_int = 50; pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER; -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; - pub const SA_ONSTACK: ::c_int = 0x08000000; pub const SA_SIGINFO: ::c_int = 0x00000004; pub const SA_NOCLDWAIT: ::c_int = 0x00000002; -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; pub const SIGCHLD: ::c_int = 17; pub const SIGBUS: ::c_int = 7; pub const SIGUSR1: ::c_int = 10; @@ -418,12 +335,6 @@ pub const F_UNLCK: ::c_int = 2; pub const SFD_NONBLOCK: ::c_int = 0x0800; -pub const TCSANOW: ::c_int = 0; -pub const TCSADRAIN: ::c_int = 1; -pub const TCSAFLUSH: ::c_int = 2; - -pub const TIOCLINUX: ::c_ulong = 0x541C; -pub const TIOCGSERIAL: ::c_ulong = 0x541E; pub const TIOCEXCL: ::c_ulong = 0x540C; pub const TIOCNXCL: ::c_ulong = 0x540D; pub const TIOCSCTTY: ::c_ulong = 0x540E; @@ -436,13 +347,6 @@ pub const TIOCCONS: ::c_ulong = 0x541D; pub const TIOCGRS485: ::c_int = 0x542E; pub const TIOCSRS485: ::c_int = 0x542F; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; - pub const SFD_CLOEXEC: ::c_int = 0x080000; pub const NCCS: usize = 32; @@ -538,14 +442,8 @@ pub const MAP_LOCKED: ::c_int = 0x00080; pub const MAP_NORESERVE: ::c_int = 0x00040; pub const EDEADLOCK: ::c_int = 58; -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; pub const FIOCLEX: ::c_ulong = 0x20006601; -pub const FIONCLEX: ::c_ulong = 0x20006602; pub const FIONBIO: ::c_ulong = 0x8004667e; pub const MCL_CURRENT: ::c_int = 0x2000; diff --git a/src/unix/linux_like/linux/gnu/b64/sparc64.rs b/src/unix/notbsd/linux/other/b64/sparc64.rs index d3f854e5..264a3f1d 100644 --- a/src/unix/linux_like/linux/gnu/b64/sparc64.rs +++ b/src/unix/notbsd/linux/other/b64/sparc64.rs @@ -12,60 +12,6 @@ pub type suseconds_t = i32; pub type __u64 = ::c_ulonglong; s! { - pub struct sigaction { - pub sa_sigaction: ::sighandler_t, - pub sa_mask: ::sigset_t, - #[cfg(target_arch = "sparc64")] - __reserved0: ::c_int, - pub sa_flags: ::c_int, - pub sa_restorer: ::Option<extern fn()>, - } - - pub struct statfs { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - f_spare: [::__fsword_t; 5], - } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_errno: ::c_int, - pub si_code: ::c_int, - #[doc(hidden)] - #[deprecated( - since="0.2.54", - note="Please leave a comment on \ - https://github.com/rust-lang/libc/pull/1316 if you're using \ - this field" - )] - pub _pad: [::c_int; 29], - _align: [usize; 0], - } - - pub struct flock { - pub l_type: ::c_short, - pub l_whence: ::c_short, - pub l_start: ::off_t, - pub l_len: ::off_t, - pub l_pid: ::pid_t, - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t - } - pub struct stat { pub st_dev: ::dev_t, __pad0: u64, @@ -197,21 +143,11 @@ s! { } } -pub const POSIX_FADV_DONTNEED: ::c_int = 4; -pub const POSIX_FADV_NOREUSE: ::c_int = 5; - -pub const VEOF: usize = 4; -pub const RTLD_DEEPBIND: ::c_int = 0x8; -pub const RTLD_GLOBAL: ::c_int = 0x100; -pub const RTLD_NOLOAD: ::c_int = 0x4; pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; pub const TIOCGSOFTCAR: ::c_ulong = 0x40047464; pub const TIOCSSOFTCAR: ::c_ulong = 0x80047465; -pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; -pub const RLIMIT_AS: ::__rlimit_resource_t = 9; -pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 6; pub const RLIMIT_NPROC: ::__rlimit_resource_t = 7; @@ -228,16 +164,7 @@ pub const O_NOATIME: ::c_int = 0x200000; pub const O_PATH: ::c_int = 0x1000000; pub const O_TMPFILE: ::c_int = 0x2000000 | O_DIRECTORY; -pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MAP_GROWSDOWN: ::c_int = 0x0200; -pub const MAP_ANON: ::c_int = 0x0020; -pub const MAP_ANONYMOUS: ::c_int = 0x0020; -pub const MAP_DENYWRITE: ::c_int = 0x0800; -pub const MAP_EXECUTABLE: ::c_int = 0x01000; -pub const MAP_POPULATE: ::c_int = 0x08000; -pub const MAP_NONBLOCK: ::c_int = 0x010000; -pub const MAP_STACK: ::c_int = 0x020000; -pub const MAP_HUGETLB: ::c_int = 0x040000; pub const EDEADLK: ::c_int = 78; pub const ENAMETOOLONG: ::c_int = 63; @@ -343,20 +270,10 @@ pub const SO_LINGER: ::c_int = 128; pub const SO_REUSEPORT: ::c_int = 0x200; pub const SO_ACCEPTCONN: ::c_int = 0x8000; -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; - pub const SA_ONSTACK: ::c_int = 1; pub const SA_SIGINFO: ::c_int = 0x200; pub const SA_NOCLDWAIT: ::c_int = 0x100; -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; pub const SIGCHLD: ::c_int = 20; pub const SIGBUS: ::c_int = 10; pub const SIGUSR1: ::c_int = 30; @@ -395,12 +312,6 @@ pub const F_UNLCK: ::c_int = 3; pub const SFD_NONBLOCK: ::c_int = 0x4000; -pub const TCSANOW: ::c_int = 0; -pub const TCSADRAIN: ::c_int = 1; -pub const TCSAFLUSH: ::c_int = 2; - -pub const TIOCLINUX: ::c_ulong = 0x541C; -pub const TIOCGSERIAL: ::c_ulong = 0x541E; pub const TIOCEXCL: ::c_ulong = 0x2000740d; pub const TIOCNXCL: ::c_ulong = 0x2000740e; pub const TIOCSCTTY: ::c_ulong = 0x20007484; @@ -411,13 +322,6 @@ pub const TIOCMBIC: ::c_ulong = 0x8004746b; pub const TIOCMSET: ::c_ulong = 0x8004746d; pub const TIOCCONS: ::c_ulong = 0x20007424; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; - pub const SFD_CLOEXEC: ::c_int = 0x400000; pub const NCCS: usize = 17; @@ -484,11 +388,6 @@ pub const MAP_LOCKED: ::c_int = 0x0100; pub const MAP_NORESERVE: ::c_int = 0x00040; pub const EDEADLOCK: ::c_int = 108; -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; pub const SO_PEERCRED: ::c_int = 0x40; pub const SO_RCVLOWAT: ::c_int = 0x800; @@ -497,7 +396,6 @@ pub const SO_RCVTIMEO: ::c_int = 0x2000; pub const SO_SNDTIMEO: ::c_int = 0x4000; pub const FIOCLEX: ::c_ulong = 0x20006601; -pub const FIONCLEX: ::c_ulong = 0x20006602; pub const FIONBIO: ::c_ulong = 0x8004667e; pub const MCL_CURRENT: ::c_int = 0x2000; diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs b/src/unix/notbsd/linux/other/b64/x32.rs index 37468818..37468818 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs +++ b/src/unix/notbsd/linux/other/b64/x32.rs diff --git a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs b/src/unix/notbsd/linux/other/b64/x86_64.rs index 1318713a..32f7265a 100644 --- a/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs +++ b/src/unix/notbsd/linux/other/b64/x86_64.rs @@ -9,60 +9,6 @@ pub type suseconds_t = i64; pub type __u64 = ::c_ulonglong; s! { - pub struct sigaction { - pub sa_sigaction: ::sighandler_t, - pub sa_mask: ::sigset_t, - #[cfg(target_arch = "sparc64")] - __reserved0: ::c_int, - pub sa_flags: ::c_int, - pub sa_restorer: ::Option<extern fn()>, - } - - pub struct statfs { - pub f_type: ::__fsword_t, - pub f_bsize: ::__fsword_t, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - - pub f_namelen: ::__fsword_t, - pub f_frsize: ::__fsword_t, - f_spare: [::__fsword_t; 5], - } - - pub struct flock { - pub l_type: ::c_short, - pub l_whence: ::c_short, - pub l_start: ::off_t, - pub l_len: ::off_t, - pub l_pid: ::pid_t, - } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_errno: ::c_int, - pub si_code: ::c_int, - #[doc(hidden)] - #[deprecated( - since="0.2.54", - note="Please leave a comment on \ - https://github.com/rust-lang/libc/pull/1316 if you're using \ - this field" - )] - pub _pad: [::c_int; 29], - _align: [u64; 0], - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t - } - pub struct stat { pub st_dev: ::dev_t, pub st_ino: ::ino_t, @@ -384,21 +330,11 @@ cfg_if! { } } -pub const POSIX_FADV_DONTNEED: ::c_int = 4; -pub const POSIX_FADV_NOREUSE: ::c_int = 5; - -pub const VEOF: usize = 4; -pub const RTLD_DEEPBIND: ::c_int = 0x8; -pub const RTLD_GLOBAL: ::c_int = 0x100; -pub const RTLD_NOLOAD: ::c_int = 0x4; pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; pub const TIOCGRS485: ::c_int = 0x542E; pub const TIOCSRS485: ::c_int = 0x542F; -pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; -pub const RLIMIT_AS: ::__rlimit_resource_t = 9; -pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; @@ -415,7 +351,6 @@ pub const O_NOATIME: ::c_int = 0o1000000; pub const O_PATH: ::c_int = 0o10000000; pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; -pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MAP_GROWSDOWN: ::c_int = 0x0100; pub const EDEADLK: ::c_int = 35; @@ -552,20 +487,10 @@ pub const SO_INCOMING_CPU: ::c_int = 49; pub const SO_ATTACH_BPF: ::c_int = 50; pub const SO_DETACH_BPF: ::c_int = SO_DETACH_FILTER; -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; - pub const SA_ONSTACK: ::c_int = 0x08000000; pub const SA_SIGINFO: ::c_int = 0x00000004; pub const SA_NOCLDWAIT: ::c_int = 0x00000002; -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; pub const SIGCHLD: ::c_int = 17; pub const SIGBUS: ::c_int = 7; pub const SIGUSR1: ::c_int = 10; @@ -610,12 +535,6 @@ pub const F_UNLCK: ::c_int = 2; pub const SFD_NONBLOCK: ::c_int = 0x0800; -pub const TCSANOW: ::c_int = 0; -pub const TCSADRAIN: ::c_int = 1; -pub const TCSAFLUSH: ::c_int = 2; - -pub const TIOCLINUX: ::c_ulong = 0x541C; -pub const TIOCGSERIAL: ::c_ulong = 0x541E; pub const TIOCEXCL: ::c_ulong = 0x540C; pub const TIOCNXCL: ::c_ulong = 0x540D; pub const TIOCSCTTY: ::c_ulong = 0x540E; @@ -626,13 +545,6 @@ pub const TIOCMBIC: ::c_ulong = 0x5417; pub const TIOCMSET: ::c_ulong = 0x5418; pub const TIOCCONS: ::c_ulong = 0x541D; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; - pub const SFD_CLOEXEC: ::c_int = 0x080000; pub const NCCS: usize = 32; @@ -672,27 +584,13 @@ pub const O_DIRECT: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x10000; pub const O_NOFOLLOW: ::c_int = 0x20000; -pub const MAP_HUGETLB: ::c_int = 0x040000; pub const MAP_LOCKED: ::c_int = 0x02000; pub const MAP_NORESERVE: ::c_int = 0x04000; pub const MAP_32BIT: ::c_int = 0x0040; -pub const MAP_ANON: ::c_int = 0x0020; -pub const MAP_ANONYMOUS: ::c_int = 0x0020; -pub const MAP_DENYWRITE: ::c_int = 0x0800; -pub const MAP_EXECUTABLE: ::c_int = 0x01000; -pub const MAP_POPULATE: ::c_int = 0x08000; -pub const MAP_NONBLOCK: ::c_int = 0x010000; -pub const MAP_STACK: ::c_int = 0x020000; pub const EDEADLOCK: ::c_int = 35; -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; pub const FIOCLEX: ::c_ulong = 0x5451; -pub const FIONCLEX: ::c_ulong = 0x5450; pub const FIONBIO: ::c_ulong = 0x5421; pub const PTRACE_GETFPREGS: ::c_uint = 14; @@ -887,13 +785,3 @@ extern { pub fn ioperm(from: ::c_ulong, num: ::c_ulong, turn_on: ::c_int) -> ::c_int; } - -cfg_if! { - if #[cfg(target_pointer_width = "32")] { - mod x32; - pub use self::x32::*; - } else { - mod not_x32; - pub use self::not_x32::*; - } -} diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/notbsd/linux/other/mod.rs index 13f7de59..9714f127 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/notbsd/linux/other/mod.rs @@ -61,6 +61,39 @@ s! { pub tv_usec: i32, } + pub struct sigaction { + pub sa_sigaction: ::sighandler_t, + pub sa_mask: ::sigset_t, + #[cfg(target_arch = "sparc64")] + __reserved0: ::c_int, + pub sa_flags: ::c_int, + pub sa_restorer: ::Option<extern fn()>, + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + #[doc(hidden)] + #[deprecated( + since="0.2.54", + note="Please leave a comment on \ + https://github.com/rust-lang/libc/pull/1316 if you're using \ + this field" + )] + pub _pad: [::c_int; 29], + #[cfg(target_arch = "x86_64")] + _align: [u64; 0], + #[cfg(not(target_arch = "x86_64"))] + _align: [usize; 0], + } + pub struct glob64_t { pub gl_pathc: ::size_t, pub gl_pathv: *mut *mut ::c_char, @@ -74,6 +107,22 @@ s! { __unused5: *mut ::c_void, } + pub struct statfs { + pub f_type: __fsword_t, + pub f_bsize: __fsword_t, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + + pub f_namelen: __fsword_t, + pub f_frsize: __fsword_t, + f_spare: [__fsword_t; 5], + } + pub struct msghdr { pub msg_name: *mut ::c_void, pub msg_namelen: ::socklen_t, @@ -97,18 +146,20 @@ s! { pub c_lflag: ::tcflag_t, pub c_line: ::cc_t, pub c_cc: [::cc_t; ::NCCS], - #[cfg(not(any( - target_arch = "sparc64", - target_arch = "mips", - target_arch = "mips64")))] + #[cfg(not(target_arch = "sparc64"))] pub c_ispeed: ::speed_t, - #[cfg(not(any( - target_arch = "sparc64", - target_arch = "mips", - target_arch = "mips64")))] + #[cfg(not(target_arch = "sparc64"))] pub c_ospeed: ::speed_t, } + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } + pub struct mallinfo { pub arena: ::c_int, pub ordblks: ::c_int, @@ -207,23 +258,19 @@ s_no_extra_traits! { pub ut_exit: __exit_status, #[cfg(any(target_arch = "aarch64", - target_arch = "s390x", all(target_pointer_width = "32", not(target_arch = "x86_64"))))] pub ut_session: ::c_long, #[cfg(any(target_arch = "aarch64", - target_arch = "s390x", all(target_pointer_width = "32", not(target_arch = "x86_64"))))] pub ut_tv: ::timeval, #[cfg(not(any(target_arch = "aarch64", - target_arch = "s390x", all(target_pointer_width = "32", not(target_arch = "x86_64")))))] pub ut_session: i32, #[cfg(not(any(target_arch = "aarch64", - target_arch = "s390x", all(target_pointer_width = "32", not(target_arch = "x86_64")))))] pub ut_tv: __timeval, @@ -303,9 +350,8 @@ pub const RLIMIT_SIGPENDING: ::__rlimit_resource_t = 11; pub const RLIMIT_MSGQUEUE: ::__rlimit_resource_t = 12; pub const RLIMIT_NICE: ::__rlimit_resource_t = 13; pub const RLIMIT_RTPRIO: ::__rlimit_resource_t = 14; -pub const RLIMIT_RTTIME: ::__rlimit_resource_t = 15; -pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = 16; +pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MS_RMT_MASK: ::c_ulong = 0x02800051; pub const __UT_LINESIZE: usize = 32; @@ -322,6 +368,13 @@ pub const USER_PROCESS: ::c_short = 7; pub const DEAD_PROCESS: ::c_short = 8; pub const ACCOUNTING: ::c_short = 9; +pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; +pub const RLIMIT_AS: ::__rlimit_resource_t = 9; +pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; +pub const RLIM_INFINITY: ::rlim_t = !0; +pub const RLIMIT_RTTIME: ::__rlimit_resource_t = 15; +pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = 16; + pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK; pub const SOL_RXRPC: ::c_int = 272; @@ -360,11 +413,25 @@ pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK | LC_MEASUREMENT_MASK | LC_IDENTIFICATION_MASK; +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_ANONYMOUS: ::c_int = 0x0020; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; pub const MAP_SHARED_VALIDATE: ::c_int = 0x3; pub const MAP_FIXED_NOREPLACE: ::c_int = 0x100000; pub const ENOTSUP: ::c_int = EOPNOTSUPP; - +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; pub const SOCK_SEQPACKET: ::c_int = 5; pub const SOCK_DCCP: ::c_int = 6; pub const SOCK_PACKET: ::c_int = 10; @@ -401,11 +468,21 @@ pub const DCCP_SOCKOPT_CCID_TX_INFO: ::c_int = 192; /// maximum number of services provided on the same listening port pub const DCCP_SERVICE_LIST_MAX_LEN: ::c_int = 32; +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; + pub const SIGEV_THREAD_ID: ::c_int = 4; pub const BUFSIZ: ::c_uint = 8192; pub const TMP_MAX: ::c_uint = 238328; pub const FOPEN_MAX: ::c_uint = 16; +pub const POSIX_FADV_DONTNEED: ::c_int = 4; +pub const POSIX_FADV_NOREUSE: ::c_int = 5; pub const POSIX_MADV_DONTNEED: ::c_int = 4; pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41; pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45; @@ -513,6 +590,8 @@ pub const SMB_SUPER_MAGIC: ::c_long = 0x0000517b; pub const TMPFS_MAGIC: ::c_long = 0x01021994; pub const USBDEVICE_SUPER_MAGIC: ::c_long = 0x00009fa2; +pub const VEOF: usize = 4; + pub const CPU_SETSIZE: ::c_int = 0x400; pub const PTRACE_TRACEME: ::c_uint = 0; @@ -540,9 +619,22 @@ pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209; pub const EPOLLWAKEUP: ::c_int = 0x20000000; +pub const MAP_HUGETLB: ::c_int = 0x040000; + pub const SEEK_DATA: ::c_int = 3; pub const SEEK_HOLE: ::c_int = 4; +pub const TCSANOW: ::c_int = 0; +pub const TCSADRAIN: ::c_int = 1; +pub const TCSAFLUSH: ::c_int = 2; + +pub const TIOCLINUX: ::c_ulong = 0x541C; +pub const TIOCGSERIAL: ::c_ulong = 0x541E; + +pub const RTLD_DEEPBIND: ::c_int = 0x8; +pub const RTLD_GLOBAL: ::c_int = 0x100; +pub const RTLD_NOLOAD: ::c_int = 0x4; + pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278; @@ -660,6 +752,12 @@ pub const GENL_ID_PMCRAID: ::c_int = ::NLMSG_MIN_TYPE + 2; pub const TIOCM_LE: ::c_int = 0x001; pub const TIOCM_DTR: ::c_int = 0x002; pub const TIOCM_RTS: ::c_int = 0x004; +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; pub const TIOCM_CD: ::c_int = TIOCM_CAR; pub const TIOCM_RI: ::c_int = TIOCM_RNG; @@ -912,12 +1010,8 @@ pub const STATX_ATTR_ENCRYPTED: ::c_int = 0x0800; pub const STATX_ATTR_AUTOMOUNT: ::c_int = 0x1000; cfg_if! { - if #[cfg(any( - target_arch = "arm", - target_arch = "x86", - target_arch = "x86_64", - target_arch = "s390x" - ))] { + if #[cfg(any(target_arch = "arm", target_arch = "x86", + target_arch = "x86_64"))] { pub const PTHREAD_STACK_MIN: ::size_t = 16384; } else if #[cfg(target_arch = "sparc64")] { pub const PTHREAD_STACK_MIN: ::size_t = 0x6000; @@ -967,11 +1061,6 @@ extern { tz: *mut ::timezone) -> ::c_int; pub fn statx(dirfd: ::c_int, pathname: *const c_char, flags: ::c_int, mask: ::c_uint, statxbuf: *mut statx) -> ::c_int; - pub fn getrandom( - buf: *mut ::c_void, - buflen: ::size_t, - flags: ::c_uint, - ) -> ::ssize_t; } #[link(name = "util")] @@ -1012,10 +1101,11 @@ extern { pub fn getauxval(type_: ::c_ulong) -> ::c_ulong; #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")] #[cfg_attr(target_os = "solaris", link_name = "__posix_getpwent_r")] - pub fn getpwent_r(pwd: *mut ::passwd, + pub fn getpwent_r(pwd: *mut ::unix::notbsd::linux::passwd, buf: *mut ::c_char, buflen: ::size_t, - result: *mut *mut ::passwd) -> ::c_int; + result: *mut *mut ::unix::notbsd + ::linux::passwd) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__getgrent_r50")] #[cfg_attr(target_os = "solaris", link_name = "__posix_getgrent_r")] pub fn getgrent_r(grp: *mut ::group, @@ -1027,15 +1117,12 @@ extern { cfg_if! { if #[cfg(any(target_arch = "x86", target_arch = "arm", - target_arch = "mips", target_arch = "powerpc"))] { mod b32; pub use self::b32::*; } else if #[cfg(any(target_arch = "x86_64", target_arch = "aarch64", target_arch = "powerpc64", - target_arch = "mips64", - target_arch = "s390x", target_arch = "sparc64"))] { mod b64; pub use self::b64::*; diff --git a/src/unix/notbsd/linux/other/no_align.rs b/src/unix/notbsd/linux/other/no_align.rs new file mode 100644 index 00000000..e32bf673 --- /dev/null +++ b/src/unix/notbsd/linux/other/no_align.rs @@ -0,0 +1,10 @@ +s! { + // FIXME this is actually a union + pub struct sem_t { + #[cfg(target_pointer_width = "32")] + __size: [::c_char; 16], + #[cfg(target_pointer_width = "64")] + __size: [::c_char; 32], + __align: [::c_long; 0], + } +} diff --git a/src/unix/notbsd/linux/s390x/align.rs b/src/unix/notbsd/linux/s390x/align.rs new file mode 100644 index 00000000..21e21907 --- /dev/null +++ b/src/unix/notbsd/linux/s390x/align.rs @@ -0,0 +1,10 @@ +s! { + // FIXME this is actually a union + #[cfg_attr(target_pointer_width = "32", + repr(align(4)))] + #[cfg_attr(target_pointer_width = "64", + repr(align(8)))] + pub struct sem_t { + __size: [::c_char; 32], + } +} diff --git a/src/unix/linux_like/linux/gnu/b64/s390x.rs b/src/unix/notbsd/linux/s390x/mod.rs index b8fda7ae..7a7b426a 100644 --- a/src/unix/linux_like/linux/gnu/b64/s390x.rs +++ b/src/unix/notbsd/linux/s390x/mod.rs @@ -1,61 +1,47 @@ -//! s390x - -use pthread_mutex_t; +use ::pthread_mutex_t; +pub type __rlimit_resource_t = ::c_uint; +pub type pthread_t = c_ulong; +pub type blkcnt_t = i64; pub type blksize_t = i64; pub type c_char = u8; pub type c_long = i64; pub type c_ulong = u64; +pub type fsblkcnt_t = u64; +pub type fsfilcnt_t = u64; +pub type ino_t = u64; pub type nlink_t = u64; +pub type off_t = i64; +pub type rlim_t = u64; pub type suseconds_t = i64; +pub type time_t = i64; pub type wchar_t = i32; pub type greg_t = u64; +pub type clock_t = i64; +pub type shmatt_t = ::c_ulong; +pub type msgqnum_t = ::c_ulong; +pub type msglen_t = ::c_ulong; +pub type __fsword_t = ::c_long; +pub type __priority_which_t = ::c_uint; pub type __u64 = u64; s! { - pub struct sigaction { - pub sa_sigaction: ::sighandler_t, - __glibc_reserved0: ::c_int, - pub sa_flags: ::c_int, - pub sa_restorer: ::Option<extern fn()>, - pub sa_mask: ::sigset_t, - } - - pub struct statfs { - pub f_type: ::c_uint, - pub f_bsize: ::c_uint, - pub f_blocks: ::fsblkcnt_t, - pub f_bfree: ::fsblkcnt_t, - pub f_bavail: ::fsblkcnt_t, - pub f_files: ::fsfilcnt_t, - pub f_ffree: ::fsfilcnt_t, - pub f_fsid: ::fsid_t, - pub f_namelen: ::c_uint, - pub f_frsize: ::c_uint, - pub f_flags: ::c_uint, - f_spare: [::c_uint; 4], - } - - pub struct flock { - pub l_type: ::c_short, - pub l_whence: ::c_short, - pub l_start: ::off_t, - pub l_len: ::off_t, - pub l_pid: ::pid_t, - } - - pub struct siginfo_t { - pub si_signo: ::c_int, - pub si_errno: ::c_int, - pub si_code: ::c_int, - _pad: ::c_int, - _pad2: [::c_long; 14], - } - - pub struct stack_t { - pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t + pub struct aiocb { + pub aio_fildes: ::c_int, + pub aio_lio_opcode: ::c_int, + pub aio_reqprio: ::c_int, + pub aio_buf: *mut ::c_void, + pub aio_nbytes: ::size_t, + pub aio_sigevent: ::sigevent, + __next_prio: *mut aiocb, + __abs_prio: ::c_int, + __policy: ::c_int, + __error_code: ::c_int, + __return_value: ::ssize_t, + pub aio_offset: off_t, + #[cfg(target_pointer_width = "32")] + __unused1: [::c_char; 4], + __glibc_reserved: [::c_char; 32] } pub struct stat { @@ -104,6 +90,32 @@ s! { __size: [::c_ulong; 7] } + pub struct sigaction { + pub sa_sigaction: ::sighandler_t, + __glibc_reserved0: ::c_int, + pub sa_flags: ::c_int, + pub sa_restorer: ::Option<extern fn()>, + pub sa_mask: sigset_t, + } + + pub struct stack_t { + pub ss_sp: *mut ::c_void, + pub ss_flags: ::c_int, + pub ss_size: ::size_t, + } + + pub struct sigset_t { + __size: [::c_ulong; 16], + } + + pub struct siginfo_t { + pub si_signo: ::c_int, + pub si_errno: ::c_int, + pub si_code: ::c_int, + _pad: ::c_int, + _pad2: [::c_long; 14], + } + pub struct ipc_perm { pub __key: ::key_t, pub uid: ::uid_t, @@ -130,6 +142,21 @@ s! { __unused5: ::c_ulong } + pub struct statfs { + pub f_type: ::c_uint, + pub f_bsize: ::c_uint, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_uint, + pub f_frsize: ::c_uint, + pub f_flags: ::c_uint, + f_spare: [::c_uint; 4], + } + pub struct statvfs { pub f_bsize: ::c_ulong, pub f_frsize: ::c_ulong, @@ -145,6 +172,33 @@ s! { __f_spare: [::c_int; 6], } + pub struct msghdr { + pub msg_name: *mut ::c_void, + pub msg_namelen: ::socklen_t, + pub msg_iov: *mut ::iovec, + pub msg_iovlen: ::size_t, + pub msg_control: *mut ::c_void, + pub msg_controllen: ::size_t, + pub msg_flags: ::c_int, + } + + pub struct cmsghdr { + pub cmsg_len: ::size_t, + pub cmsg_level: ::c_int, + pub cmsg_type: ::c_int, + } + + pub struct termios { + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_line: ::cc_t, + pub c_cc: [::cc_t; ::NCCS], + pub c_ispeed: ::speed_t, + pub c_ospeed: ::speed_t, + } + pub struct termios2 { pub c_iflag: ::tcflag_t, pub c_oflag: ::tcflag_t, @@ -156,6 +210,44 @@ s! { pub c_ospeed: ::speed_t, } + pub struct sysinfo { + pub uptime: ::c_long, + pub loads: [::c_ulong; 3], + pub totalram: ::c_ulong, + pub freeram: ::c_ulong, + pub sharedram: ::c_ulong, + pub bufferram: ::c_ulong, + pub totalswap: ::c_ulong, + pub freeswap: ::c_ulong, + pub procs: ::c_ushort, + pub pad: ::c_ushort, + pub totalhigh: ::c_ulong, + pub freehigh: ::c_ulong, + pub mem_unit: ::c_uint, + pub _f: [::c_char; 0], + } + + pub struct glob64_t { + pub gl_pathc: ::size_t, + pub gl_pathv: *mut *mut ::c_char, + pub gl_offs: ::size_t, + pub gl_flags: ::c_int, + + __unused1: *mut ::c_void, + __unused2: *mut ::c_void, + __unused3: *mut ::c_void, + __unused4: *mut ::c_void, + __unused5: *mut ::c_void, + } + + pub struct flock { + pub l_type: ::c_short, + pub l_whence: ::c_short, + pub l_start: ::off_t, + pub l_len: ::off_t, + pub l_pid: ::pid_t, + } + pub struct __psw_t { pub mask: u64, pub addr: u64, @@ -182,6 +274,20 @@ s! { pub uc_sigmask: ::sigset_t, } + pub struct msqid_ds { + pub msg_perm: ::ipc_perm, + pub msg_stime: ::time_t, + pub msg_rtime: ::time_t, + pub msg_ctime: ::time_t, + __msg_cbytes: ::c_ulong, + pub msg_qnum: ::msgqnum_t, + pub msg_qbytes: ::msglen_t, + pub msg_lspid: ::pid_t, + pub msg_lrpid: ::pid_t, + __glibc_reserved4: ::c_ulong, + __glibc_reserved5: ::c_ulong, + } + pub struct statfs64 { pub f_type: ::c_uint, pub f_bsize: ::c_uint, @@ -248,18 +354,15 @@ cfg_if! { } } -pub const POSIX_FADV_DONTNEED: ::c_int = 6; -pub const POSIX_FADV_NOREUSE: ::c_int = 7; +pub const MADV_SOFT_OFFLINE: ::c_int = 101; +pub const MS_RMT_MASK: ::c_ulong = 0x02800051; -pub const VEOF: usize = 4; -pub const RTLD_DEEPBIND: ::c_int = 0x8; -pub const RTLD_GLOBAL: ::c_int = 0x100; -pub const RTLD_NOLOAD: ::c_int = 0x4; pub const SFD_CLOEXEC: ::c_int = 0x080000; pub const NCCS: usize = 32; pub const O_TRUNC: ::c_int = 512; +pub const O_LARGEFILE: ::c_int = 0; pub const O_NOATIME: ::c_int = 0o1000000; pub const O_CLOEXEC: ::c_int = 0x80000; pub const O_PATH: ::c_int = 0o10000000; @@ -289,10 +392,14 @@ pub const EPOLL_CLOEXEC: ::c_int = 0x80000; pub const EFD_CLOEXEC: ::c_int = 0x80000; +pub const POSIX_FADV_DONTNEED: ::c_int = 6; +pub const POSIX_FADV_NOREUSE: ::c_int = 7; + pub const __SIZEOF_PTHREAD_CONDATTR_T: usize = 4; pub const __SIZEOF_PTHREAD_MUTEXATTR_T: usize = 4; pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; +pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: usize = 8; align_const! { pub const PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP: ::pthread_mutex_t = @@ -318,11 +425,6 @@ align_const! { }; } -pub const EUCLEAN: ::c_int = 117; -pub const ENOTNAM: ::c_int = 118; -pub const ENAVAIL: ::c_int = 119; -pub const EISNAM: ::c_int = 120; -pub const EREMOTEIO: ::c_int = 121; pub const EADDRINUSE: ::c_int = 98; pub const EADDRNOTAVAIL: ::c_int = 99; pub const ECONNABORTED: ::c_int = 103; @@ -333,12 +435,16 @@ pub const ENOSYS: ::c_int = 38; pub const ENOTCONN: ::c_int = 107; pub const ETIMEDOUT: ::c_int = 110; pub const FIOCLEX: ::c_ulong = 0x5451; -pub const FIONCLEX: ::c_ulong = 0x5450; pub const FIONBIO: ::c_ulong = 0x5421; +pub const MAP_ANON: ::c_int = 0x20; +pub const O_ACCMODE: ::c_int = 3; pub const O_APPEND: ::c_int = 1024; pub const O_CREAT: ::c_int = 64; pub const O_EXCL: ::c_int = 128; pub const O_NONBLOCK: ::c_int = 2048; +pub const PTHREAD_STACK_MIN: ::size_t = 16384; +pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 3; +pub const RLIM_INFINITY: ::rlim_t = 0xffffffffffffffff; pub const SA_NOCLDWAIT: ::c_int = 2; pub const SA_ONSTACK: ::c_int = 0x08000000; pub const SA_SIGINFO: ::c_int = 4; @@ -346,6 +452,8 @@ pub const SIGBUS: ::c_int = 7; pub const SIGSTKSZ: ::size_t = 0x2000; pub const MINSIGSTKSZ: ::size_t = 2048; pub const SIG_SETMASK: ::c_int = 2; +pub const SOCK_DGRAM: ::c_int = 2; +pub const SOCK_STREAM: ::c_int = 1; pub const SOL_SOCKET: ::c_int = 1; pub const SO_BROADCAST: ::c_int = 6; pub const SO_ERROR: ::c_int = 4; @@ -361,14 +469,13 @@ pub const SO_RXQ_OVFL: ::c_int = 40; pub const SO_PEEK_OFF: ::c_int = 42; pub const SO_BUSY_POLL: ::c_int = 46; -pub const SOCK_STREAM: ::c_int = 1; -pub const SOCK_DGRAM: ::c_int = 2; - pub const RLIMIT_RSS: ::__rlimit_resource_t = 5; -pub const RLIMIT_AS: ::__rlimit_resource_t = 9; -pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 7; +pub const RLIMIT_AS: ::__rlimit_resource_t = 9; pub const RLIMIT_NPROC: ::__rlimit_resource_t = 6; +pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 8; +pub const RLIMIT_RTTIME: ::__rlimit_resource_t = 15; +pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = 16; pub const O_NOCTTY: ::c_int = 256; pub const O_SYNC: ::c_int = 1052672; @@ -379,18 +486,44 @@ pub const O_DIRECT: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x10000; pub const O_NOFOLLOW: ::c_int = 0x20000; -pub const MADV_SOFT_OFFLINE: ::c_int = 101; -pub const MAP_GROWSDOWN: ::c_int = 0x0100; -pub const MAP_LOCKED: ::c_int = 0x02000; -pub const MAP_NORESERVE: ::c_int = 0x04000; -pub const MAP_ANON: ::c_int = 0x0020; +pub const SOCK_NONBLOCK: ::c_int = O_NONBLOCK; + +pub const LC_PAPER: ::c_int = 7; +pub const LC_NAME: ::c_int = 8; +pub const LC_ADDRESS: ::c_int = 9; +pub const LC_TELEPHONE: ::c_int = 10; +pub const LC_MEASUREMENT: ::c_int = 11; +pub const LC_IDENTIFICATION: ::c_int = 12; +pub const LC_PAPER_MASK: ::c_int = (1 << LC_PAPER); +pub const LC_NAME_MASK: ::c_int = (1 << LC_NAME); +pub const LC_ADDRESS_MASK: ::c_int = (1 << LC_ADDRESS); +pub const LC_TELEPHONE_MASK: ::c_int = (1 << LC_TELEPHONE); +pub const LC_MEASUREMENT_MASK: ::c_int = (1 << LC_MEASUREMENT); +pub const LC_IDENTIFICATION_MASK: ::c_int = (1 << LC_IDENTIFICATION); +pub const LC_ALL_MASK: ::c_int = ::LC_CTYPE_MASK + | ::LC_NUMERIC_MASK + | ::LC_TIME_MASK + | ::LC_COLLATE_MASK + | ::LC_MONETARY_MASK + | ::LC_MESSAGES_MASK + | LC_PAPER_MASK + | LC_NAME_MASK + | LC_ADDRESS_MASK + | LC_TELEPHONE_MASK + | LC_MEASUREMENT_MASK + | LC_IDENTIFICATION_MASK; + pub const MAP_ANONYMOUS: ::c_int = 0x0020; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; pub const MAP_DENYWRITE: ::c_int = 0x0800; pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_LOCKED: ::c_int = 0x02000; +pub const MAP_NORESERVE: ::c_int = 0x04000; pub const MAP_POPULATE: ::c_int = 0x08000; pub const MAP_NONBLOCK: ::c_int = 0x010000; pub const MAP_STACK: ::c_int = 0x020000; -pub const MAP_HUGETLB: ::c_int = 0x040000; +pub const MAP_SHARED_VALIDATE: ::c_int = 0x3; +pub const MAP_FIXED_NOREPLACE: ::c_int = 0x100000; pub const EDEADLOCK: ::c_int = 35; pub const ENAMETOOLONG: ::c_int = 36; @@ -436,6 +569,7 @@ pub const ENOPROTOOPT: ::c_int = 92; pub const EPROTONOSUPPORT: ::c_int = 93; pub const ESOCKTNOSUPPORT: ::c_int = 94; pub const EOPNOTSUPP: ::c_int = 95; +pub const ENOTSUP: ::c_int = EOPNOTSUPP; pub const EPFNOSUPPORT: ::c_int = 96; pub const EAFNOSUPPORT: ::c_int = 97; pub const ENETDOWN: ::c_int = 100; @@ -450,6 +584,11 @@ pub const EHOSTUNREACH: ::c_int = 113; pub const EALREADY: ::c_int = 114; pub const EINPROGRESS: ::c_int = 115; pub const ESTALE: ::c_int = 116; +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; pub const EDQUOT: ::c_int = 122; pub const ENOMEDIUM: ::c_int = 123; pub const EMEDIUMTYPE: ::c_int = 124; @@ -463,6 +602,8 @@ pub const ENOTRECOVERABLE: ::c_int = 131; pub const EHWPOISON: ::c_int = 133; pub const ERFKILL: ::c_int = 132; +pub const SOCK_SEQPACKET: ::c_int = 5; + pub const SO_TYPE: ::c_int = 3; pub const SO_DONTROUTE: ::c_int = 5; pub const SO_SNDBUF: ::c_int = 7; @@ -481,13 +622,17 @@ pub const SO_ACCEPTCONN: ::c_int = 30; pub const SO_SNDBUFFORCE: ::c_int = 32; pub const SO_RCVBUFFORCE: ::c_int = 33; -pub const SIGTTIN: ::c_int = 21; -pub const SIGTTOU: ::c_int = 22; -pub const SIGXCPU: ::c_int = 24; -pub const SIGXFSZ: ::c_int = 25; -pub const SIGVTALRM: ::c_int = 26; -pub const SIGPROF: ::c_int = 27; -pub const SIGWINCH: ::c_int = 28; +pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15; +pub const TCP_THIN_LINEAR_TIMEOUTS: ::c_int = 16; +pub const TCP_THIN_DUPACK: ::c_int = 17; +pub const TCP_USER_TIMEOUT: ::c_int = 18; +pub const TCP_REPAIR: ::c_int = 19; +pub const TCP_REPAIR_QUEUE: ::c_int = 20; +pub const TCP_QUEUE_SEQ: ::c_int = 21; +pub const TCP_REPAIR_OPTIONS: ::c_int = 22; +pub const TCP_FASTOPEN: ::c_int = 23; +pub const TCP_TIMESTAMP: ::c_int = 24; + pub const SIGCHLD: ::c_int = 17; pub const SIGUSR1: ::c_int = 10; pub const SIGUSR2: ::c_int = 12; @@ -503,14 +648,130 @@ pub const SIGSTKFLT: ::c_int = 16; note = "Use SIGSYS instead" )] pub const SIGUNUSED: ::c_int = 31; +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; pub const SIGPOLL: ::c_int = 29; pub const SIGPWR: ::c_int = 30; pub const SIG_BLOCK: ::c_int = 0x000000; pub const SIG_UNBLOCK: ::c_int = 0x01; +pub const BUFSIZ: ::c_uint = 8192; +pub const TMP_MAX: ::c_uint = 238328; +pub const FOPEN_MAX: ::c_uint = 16; +pub const POSIX_MADV_DONTNEED: ::c_int = 4; +pub const _SC_EQUIV_CLASS_MAX: ::c_int = 41; +pub const _SC_CHARCLASS_NAME_MAX: ::c_int = 45; +pub const _SC_PII: ::c_int = 53; +pub const _SC_PII_XTI: ::c_int = 54; +pub const _SC_PII_SOCKET: ::c_int = 55; +pub const _SC_PII_INTERNET: ::c_int = 56; +pub const _SC_PII_OSI: ::c_int = 57; +pub const _SC_POLL: ::c_int = 58; +pub const _SC_SELECT: ::c_int = 59; +pub const _SC_PII_INTERNET_STREAM: ::c_int = 61; +pub const _SC_PII_INTERNET_DGRAM: ::c_int = 62; +pub const _SC_PII_OSI_COTS: ::c_int = 63; +pub const _SC_PII_OSI_CLTS: ::c_int = 64; +pub const _SC_PII_OSI_M: ::c_int = 65; +pub const _SC_T_IOV_MAX: ::c_int = 66; +pub const _SC_2_C_VERSION: ::c_int = 96; +pub const _SC_CHAR_BIT: ::c_int = 101; +pub const _SC_CHAR_MAX: ::c_int = 102; +pub const _SC_CHAR_MIN: ::c_int = 103; +pub const _SC_INT_MAX: ::c_int = 104; +pub const _SC_INT_MIN: ::c_int = 105; +pub const _SC_LONG_BIT: ::c_int = 106; +pub const _SC_WORD_BIT: ::c_int = 107; +pub const _SC_MB_LEN_MAX: ::c_int = 108; +pub const _SC_SSIZE_MAX: ::c_int = 110; +pub const _SC_SCHAR_MAX: ::c_int = 111; +pub const _SC_SCHAR_MIN: ::c_int = 112; +pub const _SC_SHRT_MAX: ::c_int = 113; +pub const _SC_SHRT_MIN: ::c_int = 114; +pub const _SC_UCHAR_MAX: ::c_int = 115; +pub const _SC_UINT_MAX: ::c_int = 116; +pub const _SC_ULONG_MAX: ::c_int = 117; +pub const _SC_USHRT_MAX: ::c_int = 118; +pub const _SC_NL_ARGMAX: ::c_int = 119; +pub const _SC_NL_LANGMAX: ::c_int = 120; +pub const _SC_NL_MSGMAX: ::c_int = 121; +pub const _SC_NL_NMAX: ::c_int = 122; +pub const _SC_NL_SETMAX: ::c_int = 123; +pub const _SC_NL_TEXTMAX: ::c_int = 124; +pub const _SC_BASE: ::c_int = 134; +pub const _SC_C_LANG_SUPPORT: ::c_int = 135; +pub const _SC_C_LANG_SUPPORT_R: ::c_int = 136; +pub const _SC_DEVICE_IO: ::c_int = 140; +pub const _SC_DEVICE_SPECIFIC: ::c_int = 141; +pub const _SC_DEVICE_SPECIFIC_R: ::c_int = 142; +pub const _SC_FD_MGMT: ::c_int = 143; +pub const _SC_FIFO: ::c_int = 144; +pub const _SC_PIPE: ::c_int = 145; +pub const _SC_FILE_ATTRIBUTES: ::c_int = 146; +pub const _SC_FILE_LOCKING: ::c_int = 147; +pub const _SC_FILE_SYSTEM: ::c_int = 148; +pub const _SC_MULTI_PROCESS: ::c_int = 150; +pub const _SC_SINGLE_PROCESS: ::c_int = 151; +pub const _SC_NETWORKING: ::c_int = 152; +pub const _SC_REGEX_VERSION: ::c_int = 156; +pub const _SC_SIGNALS: ::c_int = 158; +pub const _SC_SYSTEM_DATABASE: ::c_int = 162; +pub const _SC_SYSTEM_DATABASE_R: ::c_int = 163; +pub const _SC_USER_GROUPS: ::c_int = 166; +pub const _SC_USER_GROUPS_R: ::c_int = 167; +pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 185; +pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 186; +pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 187; +pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 188; +pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 189; +pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 190; +pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 191; +pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 192; +pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 193; +pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 194; +pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 195; +pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 196; +pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 197; +pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 198; +pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 199; pub const O_ASYNC: ::c_int = 0x2000; pub const O_NDELAY: ::c_int = 0x800; +pub const ST_RELATIME: ::c_ulong = 4096; +pub const NI_MAXHOST: ::socklen_t = 1025; + +pub const ADFS_SUPER_MAGIC: ::c_int = 0x0000adf5; +pub const AFFS_SUPER_MAGIC: ::c_int = 0x0000adff; +pub const CODA_SUPER_MAGIC: ::c_int = 0x73757245; +pub const CRAMFS_MAGIC: ::c_int = 0x28cd3d45; +pub const EFS_SUPER_MAGIC: ::c_int = 0x00414a53; +pub const EXT2_SUPER_MAGIC: ::c_int = 0x0000ef53; +pub const EXT3_SUPER_MAGIC: ::c_int = 0x0000ef53; +pub const EXT4_SUPER_MAGIC: ::c_int = 0x0000ef53; +pub const HPFS_SUPER_MAGIC: ::c_int = 0xf995e849; +pub const HUGETLBFS_MAGIC: ::c_int = 0x958458f6; +pub const ISOFS_SUPER_MAGIC: ::c_int = 0x00009660; +pub const JFFS2_SUPER_MAGIC: ::c_int = 0x000072b6; +pub const MINIX_SUPER_MAGIC: ::c_int = 0x0000137f; +pub const MINIX_SUPER_MAGIC2: ::c_int = 0x0000138f; +pub const MINIX2_SUPER_MAGIC: ::c_int = 0x00002468; +pub const MINIX2_SUPER_MAGIC2: ::c_int = 0x00002478; +pub const MSDOS_SUPER_MAGIC: ::c_int = 0x00004d44; +pub const NCP_SUPER_MAGIC: ::c_int = 0x0000564c; +pub const NFS_SUPER_MAGIC: ::c_int = 0x00006969; +pub const OPENPROM_SUPER_MAGIC: ::c_int = 0x00009fa1; +pub const PROC_SUPER_MAGIC: ::c_int = 0x00009fa0; +pub const QNX4_SUPER_MAGIC: ::c_int = 0x0000002f; +pub const REISERFS_SUPER_MAGIC: ::c_int = 0x52654973; +pub const SMB_SUPER_MAGIC: ::c_int = 0x0000517b; +pub const TMPFS_MAGIC: ::c_int = 0x01021994; +pub const USBDEVICE_SUPER_MAGIC: ::c_int = 0x00009fa2; +pub const VEOF: usize = 4; pub const VEOL: usize = 11; pub const VEOL2: usize = 16; pub const VMIN: usize = 6; @@ -518,13 +779,41 @@ pub const IEXTEN: ::tcflag_t = 0x00008000; pub const TOSTOP: ::tcflag_t = 0x00000100; pub const FLUSHO: ::tcflag_t = 0x00001000; +pub const CPU_SETSIZE: ::c_int = 0x400; + pub const EXTPROC: ::tcflag_t = 0x00010000; +pub const PTRACE_TRACEME: ::c_uint = 0; +pub const PTRACE_PEEKTEXT: ::c_uint = 1; +pub const PTRACE_PEEKDATA: ::c_uint = 2; +pub const PTRACE_PEEKUSER: ::c_uint = 3; +pub const PTRACE_POKETEXT: ::c_uint = 4; +pub const PTRACE_POKEDATA: ::c_uint = 5; +pub const PTRACE_POKEUSER: ::c_uint = 6; +pub const PTRACE_CONT: ::c_uint = 7; +pub const PTRACE_KILL: ::c_uint = 8; +pub const PTRACE_SINGLESTEP: ::c_uint = 9; +pub const PTRACE_ATTACH: ::c_uint = 16; pub const PTRACE_DETACH: ::c_uint = 17; +pub const PTRACE_SYSCALL: ::c_uint = 24; +pub const PTRACE_SETOPTIONS: ::c_uint = 0x4200; +pub const PTRACE_GETEVENTMSG: ::c_uint = 0x4201; +pub const PTRACE_GETSIGINFO: ::c_uint = 0x4202; +pub const PTRACE_SETSIGINFO: ::c_uint = 0x4203; +pub const PTRACE_GETREGSET: ::c_uint = 0x4204; +pub const PTRACE_SETREGSET: ::c_uint = 0x4205; +pub const PTRACE_SEIZE: ::c_uint = 0x4206; +pub const PTRACE_INTERRUPT: ::c_uint = 0x4207; +pub const PTRACE_LISTEN: ::c_uint = 0x4208; +pub const PTRACE_PEEKSIGINFO: ::c_uint = 0x4209; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; +pub const EPOLLWAKEUP: ::c_int = 0x20000000; + +pub const MAP_HUGETLB: ::c_int = 0x040000; + pub const EFD_NONBLOCK: ::c_int = 0x800; pub const F_RDLCK: ::c_int = 0; @@ -536,8 +825,15 @@ pub const F_SETOWN: ::c_int = 8; pub const F_SETLK: ::c_int = 6; pub const F_SETLKW: ::c_int = 7; +pub const SEEK_DATA: ::c_int = 3; +pub const SEEK_HOLE: ::c_int = 4; + pub const SFD_NONBLOCK: ::c_int = 0x0800; +pub const TCSANOW: ::c_int = 0; +pub const TCSADRAIN: ::c_int = 1; +pub const TCSAFLUSH: ::c_int = 2; + pub const TCGETS: ::c_ulong = 0x5401; pub const TCSETS: ::c_ulong = 0x5402; pub const TCSETSW: ::c_ulong = 0x5403; @@ -552,6 +848,8 @@ pub const TCFLSH: ::c_ulong = 0x540B; pub const TIOCGSOFTCAR: ::c_ulong = 0x5419; pub const TIOCSSOFTCAR: ::c_ulong = 0x541A; pub const TIOCINQ: ::c_ulong = 0x541B; +pub const TIOCLINUX: ::c_ulong = 0x541C; +pub const TIOCGSERIAL: ::c_ulong = 0x541E; pub const TIOCEXCL: ::c_ulong = 0x540C; pub const TIOCNXCL: ::c_ulong = 0x540D; pub const TIOCSCTTY: ::c_ulong = 0x540E; @@ -568,18 +866,24 @@ pub const TIOCMSET: ::c_ulong = 0x5418; pub const FIONREAD: ::c_ulong = 0x541B; pub const TIOCCONS: ::c_ulong = 0x541D; -pub const TCSANOW: ::c_int = 0; -pub const TCSADRAIN: ::c_int = 1; -pub const TCSAFLUSH: ::c_int = 2; +pub const RTLD_DEEPBIND: ::c_int = 0x8; +pub const RTLD_GLOBAL: ::c_int = 0x100; +pub const RTLD_NOLOAD: ::c_int = 0x4; -pub const TIOCLINUX: ::c_ulong = 0x541C; -pub const TIOCGSERIAL: ::c_ulong = 0x541E; -pub const TIOCM_ST: ::c_int = 0x008; -pub const TIOCM_SR: ::c_int = 0x010; -pub const TIOCM_CTS: ::c_int = 0x020; -pub const TIOCM_CAR: ::c_int = 0x040; -pub const TIOCM_RNG: ::c_int = 0x080; -pub const TIOCM_DSR: ::c_int = 0x100; +pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; +pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; +pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278; +pub const LINUX_REBOOT_MAGIC2B: ::c_int = 369367448; +pub const LINUX_REBOOT_MAGIC2C: ::c_int = 537993216; + +pub const LINUX_REBOOT_CMD_RESTART: ::c_int = 0x01234567; +pub const LINUX_REBOOT_CMD_HALT: ::c_int = 0xCDEF0123; +pub const LINUX_REBOOT_CMD_CAD_ON: ::c_int = 0x89ABCDEF; +pub const LINUX_REBOOT_CMD_CAD_OFF: ::c_int = 0x00000000; +pub const LINUX_REBOOT_CMD_POWER_OFF: ::c_int = 0x4321FEDC; +pub const LINUX_REBOOT_CMD_RESTART2: ::c_int = 0xA1B2C3D4; +pub const LINUX_REBOOT_CMD_SW_SUSPEND: ::c_int = 0xD000FCE2; +pub const LINUX_REBOOT_CMD_KEXEC: ::c_int = 0x45584543; pub const VTIME: usize = 5; pub const VSWTC: usize = 7; @@ -608,6 +912,20 @@ pub const VTDLY: ::tcflag_t = 0o040000; pub const VT1: ::tcflag_t = 0x00004000; pub const XTABS: ::tcflag_t = 0o014000; +pub const TIOCM_LE: ::c_int = 0x001; +pub const TIOCM_DTR: ::c_int = 0x002; +pub const TIOCM_RTS: ::c_int = 0x004; +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_DSR: ::c_int = 0x100; +pub const TIOCM_CD: ::c_int = TIOCM_CAR; +pub const TIOCM_RI: ::c_int = TIOCM_RNG; + +pub const SIGEV_THREAD_ID: ::c_int = 4; + pub const CBAUD: ::speed_t = 0o010017; pub const B0: ::speed_t = 0o000000; pub const B50: ::speed_t = 0o000001; @@ -674,6 +992,17 @@ pub const POLLWRBAND: ::c_short = 0x200; pub const IXON: ::tcflag_t = 0o002000; pub const IXOFF: ::tcflag_t = 0o010000; +pub const RLIMIT_CPU: ::__rlimit_resource_t = 0; +pub const RLIMIT_FSIZE: ::__rlimit_resource_t = 1; +pub const RLIMIT_DATA: ::__rlimit_resource_t = 2; +pub const RLIMIT_STACK: ::__rlimit_resource_t = 3; +pub const RLIMIT_CORE: ::__rlimit_resource_t = 4; +pub const RLIMIT_LOCKS: ::__rlimit_resource_t = 10; +pub const RLIMIT_SIGPENDING: ::__rlimit_resource_t = 11; +pub const RLIMIT_MSGQUEUE: ::__rlimit_resource_t = 12; +pub const RLIMIT_NICE: ::__rlimit_resource_t = 13; +pub const RLIMIT_RTPRIO: ::__rlimit_resource_t = 14; + pub const SYS_exit: ::c_long = 1; pub const SYS_fork: ::c_long = 2; pub const SYS_read: ::c_long = 3; @@ -999,6 +1328,26 @@ pub const SYS_newfstatat: ::c_long = 293; #[link(name = "util")] extern { + pub fn sendmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, + flags: ::c_int) -> ::c_int; + pub fn recvmmsg(sockfd: ::c_int, msgvec: *mut ::mmsghdr, vlen: ::c_uint, + flags: ::c_int, timeout: *mut ::timespec) -> ::c_int; + + pub fn getrlimit64(resource: ::__rlimit_resource_t, + rlim: *mut ::rlimit64) -> ::c_int; + pub fn setrlimit64(resource: ::__rlimit_resource_t, + rlim: *const ::rlimit64) -> ::c_int; + pub fn getrlimit(resource: ::__rlimit_resource_t, + rlim: *mut ::rlimit) -> ::c_int; + pub fn setrlimit(resource: ::__rlimit_resource_t, + rlim: *const ::rlimit) -> ::c_int; + pub fn prlimit(pid: ::pid_t, + resource: ::__rlimit_resource_t, new_limit: *const ::rlimit, + old_limit: *mut ::rlimit) -> ::c_int; + pub fn prlimit64(pid: ::pid_t, + resource: ::__rlimit_resource_t, + new_limit: *const ::rlimit64, + old_limit: *mut ::rlimit64) -> ::c_int; pub fn sysctl(name: *mut ::c_int, namelen: ::c_int, @@ -1007,12 +1356,48 @@ extern { newp: *mut ::c_void, newlen: ::size_t) -> ::c_int; - pub fn getcontext(ucp: *mut ::ucontext_t) -> ::c_int; - pub fn setcontext(ucp: *const ::ucontext_t) -> ::c_int; - pub fn makecontext(ucp: *mut ::ucontext_t, + pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; + pub fn backtrace(buf: *mut *mut ::c_void, + sz: ::c_int) -> ::c_int; + pub fn glob64(pattern: *const ::c_char, + flags: ::c_int, + errfunc: ::Option<extern fn(epath: *const ::c_char, + errno: ::c_int) + -> ::c_int>, + pglob: *mut glob64_t) -> ::c_int; + pub fn globfree64(pglob: *mut glob64_t); + pub fn ptrace(request: ::c_uint, ...) -> ::c_long; + pub fn pthread_attr_getaffinity_np(attr: *const ::pthread_attr_t, + cpusetsize: ::size_t, + cpuset: *mut ::cpu_set_t) -> ::c_int; + pub fn pthread_attr_setaffinity_np(attr: *mut ::pthread_attr_t, + cpusetsize: ::size_t, + cpuset: *const ::cpu_set_t) -> ::c_int; + pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int; + pub fn setpriority(which: ::__priority_which_t, who: ::id_t, + prio: ::c_int) -> ::c_int; + pub fn pthread_getaffinity_np(thread: ::pthread_t, + cpusetsize: ::size_t, + cpuset: *mut ::cpu_set_t) -> ::c_int; + pub fn pthread_setaffinity_np(thread: ::pthread_t, + cpusetsize: ::size_t, + cpuset: *const ::cpu_set_t) -> ::c_int; + pub fn sched_getcpu() -> ::c_int; + pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int; + pub fn setcontext(ucp: *const ucontext_t) -> ::c_int; + pub fn makecontext(ucp: *mut ucontext_t, func: extern fn (), argc: ::c_int, ...); - pub fn swapcontext(uocp: *mut ::ucontext_t, - ucp: *const ::ucontext_t) -> ::c_int; + pub fn swapcontext(uocp: *mut ucontext_t, + ucp: *const ucontext_t) -> ::c_int; } +cfg_if! { + if #[cfg(libc_align)] { + mod align; + pub use self::align::*; + } else { + mod no_align; + pub use self::no_align::*; + } +} diff --git a/src/unix/notbsd/linux/s390x/no_align.rs b/src/unix/notbsd/linux/s390x/no_align.rs new file mode 100644 index 00000000..8909114c --- /dev/null +++ b/src/unix/notbsd/linux/s390x/no_align.rs @@ -0,0 +1,7 @@ +s! { + // FIXME this is actually a union + pub struct sem_t { + __size: [::c_char; 32], + __align: [::c_long; 0], + } +} diff --git a/src/unix/linux_like/mod.rs b/src/unix/notbsd/mod.rs index ad20dbee..27064662 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -135,6 +135,19 @@ s! { pub int_n_sign_posn: ::c_char, } + pub struct sigevent { + pub sigev_value: ::sigval, + pub sigev_signo: ::c_int, + pub sigev_notify: ::c_int, + // Actually a union. We only expose sigev_notify_thread_id because it's + // the most useful member + pub sigev_notify_thread_id: ::c_int, + #[cfg(target_pointer_width = "64")] + __unused1: [::c_int; 11], + #[cfg(target_pointer_width = "32")] + __unused1: [::c_int; 12] + } + pub struct in_pktinfo { pub ipi_ifindex: ::c_int, pub ipi_spec_dst: ::in_addr, @@ -229,19 +242,6 @@ s_no_extra_traits!{ pub machine: [::c_char; 65], pub domainname: [::c_char; 65] } - - pub struct sigevent { - pub sigev_value: ::sigval, - pub sigev_signo: ::c_int, - pub sigev_notify: ::c_int, - // Actually a union. We only expose sigev_notify_thread_id because it's - // the most useful member - pub sigev_notify_thread_id: ::c_int, - #[cfg(target_pointer_width = "64")] - __unused1: [::c_int; 11], - #[cfg(target_pointer_width = "32")] - __unused1: [::c_int; 12] - } } cfg_if! { @@ -387,36 +387,6 @@ cfg_if! { self.domainname.hash(state); } } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_value == other.sigev_value - && self.sigev_signo == other.sigev_signo - && self.sigev_notify == other.sigev_notify - && self.sigev_notify_thread_id - == other.sigev_notify_thread_id - } - } - impl Eq for sigevent {} - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_value", &self.sigev_value) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_notify", &self.sigev_notify) - .field("sigev_notify_thread_id", - &self.sigev_notify_thread_id) - .finish() - } - } - impl ::hash::Hash for sigevent { - fn hash<H: ::hash::Hasher>(&self, state: &mut H) { - self.sigev_value.hash(state); - self.sigev_signo.hash(state); - self.sigev_notify.hash(state); - self.sigev_notify_thread_id.hash(state); - } - } } } diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index b37e8ddb..49f76ea5 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -31,7 +31,6 @@ pub type pthread_t = ::c_uint; pub type pthread_key_t = ::c_uint; pub type blksize_t = ::c_int; pub type nl_item = ::c_int; -pub type mqd_t = *mut ::c_void; pub type id_t = ::c_int; pub type idtype_t = ::c_uint; @@ -211,6 +210,15 @@ s! { pub sa_mask: sigset_t, } + pub struct sigevent { + pub sigev_notify: ::c_int, + pub sigev_signo: ::c_int, + pub sigev_value: ::sigval, + pub ss_sp: *mut ::c_void, + pub sigev_notify_attributes: *const ::pthread_attr_t, + __sigev_pad2: ::c_int, + } + pub struct stack_t { pub ss_sp: *mut ::c_void, pub ss_size: ::size_t, @@ -323,14 +331,6 @@ s! { pub if_name: *mut ::c_char, } - pub struct mq_attr { - pub mq_flags: ::c_long, - pub mq_maxmsg: ::c_long, - pub mq_msgsize: ::c_long, - pub mq_curmsgs: ::c_long, - _pad: [::c_int; 4] - } - pub struct port_event { pub portev_events: ::c_int, pub portev_source: ::c_ushort, @@ -392,15 +392,6 @@ s_no_extra_traits! { pub sdl_slen: ::c_uchar, pub sdl_data: [::c_char; 244], } - - pub struct sigevent { - pub sigev_notify: ::c_int, - pub sigev_signo: ::c_int, - pub sigev_value: ::sigval, - pub ss_sp: *mut ::c_void, - pub sigev_notify_attributes: *const ::pthread_attr_t, - __sigev_pad2: ::c_int, - } } cfg_if! { @@ -636,40 +627,6 @@ cfg_if! { self.sdl_data.hash(state); } } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_notify == other.sigev_notify - && self.sigev_signo == other.sigev_signo - && self.sigev_value == other.sigev_value - && self.ss_sp == other.ss_sp - && self.sigev_notify_attributes - == other.sigev_notify_attributes - } - } - impl Eq for sigevent {} - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_notify", &self.sigev_notify) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_value", &self.sigev_value) - .field("ss_sp", &self.ss_sp) - .field("sigev_notify_attributes", - &self.sigev_notify_attributes) - .finish() - } - } - impl ::hash::Hash for sigevent { - fn hash<H: ::hash::Hasher>(&self, state: &mut H) { - self.sigev_notify.hash(state); - self.sigev_signo.hash(state); - self.sigev_value.hash(state); - self.ss_sp.hash(state); - self.sigev_notify_attributes.hash(state); - } - } - } } @@ -1980,31 +1937,6 @@ extern { pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t; - pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t; - pub fn mq_close(mqd: ::mqd_t) -> ::c_int; - pub fn mq_unlink(name: *const ::c_char) -> ::c_int; - pub fn mq_receive(mqd: ::mqd_t, - msg_ptr: *mut ::c_char, - msg_len: ::size_t, - msq_prio: *mut ::c_uint) -> ::ssize_t; - pub fn mq_timedreceive(mqd: ::mqd_t, - msg_ptr: *mut ::c_char, - msg_len: ::size_t, - msq_prio: *mut ::c_uint, - abs_timeout: *const ::timespec) -> ::ssize_t; - pub fn mq_send(mqd: ::mqd_t, - msg_ptr: *const ::c_char, - msg_len: ::size_t, - msq_prio: ::c_uint) -> ::c_int; - pub fn mq_timedsend(mqd: ::mqd_t, - msg_ptr: *const ::c_char, - msg_len: ::size_t, - msq_prio: ::c_uint, - abs_timeout: *const ::timespec) -> ::c_int; - pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int; - pub fn mq_setattr(mqd: ::mqd_t, - newattr: *const ::mq_attr, - oldattr: *mut ::mq_attr) -> ::c_int; pub fn port_create() -> ::c_int; pub fn port_associate(port: ::c_int, source: ::c_int, object: ::uintptr_t, events: ::c_int, user: *mut ::c_void) -> ::c_int; diff --git a/src/unix/uclibc/arm/mod.rs b/src/unix/uclibc/arm/mod.rs index 7680dcf0..16512859 100644 --- a/src/unix/uclibc/arm/mod.rs +++ b/src/unix/uclibc/arm/mod.rs @@ -51,12 +51,9 @@ s! { pub st_size: ::off_t, pub st_blksize: ::blksize_t, pub st_blocks: ::blkcnt_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_ulong, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_ulong, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_ulong, + pub st_atim: ::timespec, + pub st_mtim: ::timespec, + pub st_ctim: ::timespec, pub __unused4: ::c_ulong, pub __unused5: ::c_ulong, } @@ -75,12 +72,9 @@ s! { pub st_size: ::off64_t, pub st_blksize: ::blksize_t, pub st_blocks: ::blkcnt64_t, - pub st_atime: ::time_t, - pub st_atime_nsec: ::c_ulong, - pub st_mtime: ::time_t, - pub st_mtime_nsec: ::c_ulong, - pub st_ctime: ::time_t, - pub st_ctime_nsec: ::c_ulong, + pub st_atim: ::timespec, + pub st_mtim: ::timespec, + pub st_ctim: ::timespec, pub st_ino: ::ino64_t, } @@ -140,8 +134,8 @@ s! { pub struct stack_t { pub ss_sp: *mut ::c_void, - pub ss_flags: ::c_int, - pub ss_size: ::size_t, + ss_flags: ::c_int, + ss_size: ::size_t, } pub struct ipc_perm { @@ -221,8 +215,8 @@ pub const CLONE_NEWCGROUP: ::c_int = 0x02000000; // from linux/mod.rs pub const EPOLLEXCLUSIVE: ::c_int = 0x10000000; // from linux/mod.rs pub const EPOLLWAKEUP: ::c_int = 0x20000000; // from linux/other/mod.rs pub const EXTPROC: ::tcflag_t = 0o200000; // from asm-generic/termbits.h -pub const F_GETPIPE_SZ: ::c_int = 1032; // from linux_like/mod.rs -pub const F_SETPIPE_SZ: ::c_int = 1031; // from linux_like/mod.rs +pub const F_GETPIPE_SZ: ::c_int = 1032; // from notbsd/mod.rs +pub const F_SETPIPE_SZ: ::c_int = 1031; // from notbsd/mod.rs pub const LIO_NOP: ::c_int = 2; // from linux/mod.rs pub const LIO_NOWAIT: ::c_int = 1; // from linux/mod.rs pub const LIO_READ: ::c_int = 0; // from linux/mod.rs @@ -232,12 +226,12 @@ pub const MAP_HUGETLB: ::c_int = 0x040000; // from linux/other/mod.rs pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY; pub const RB_KEXEC: ::c_int = 0x45584543u32 as i32; // from linux/mod.rs pub const RB_SW_SUSPEND: ::c_int = 0xd000fce2u32 as i32; // from linux/mod.rs -pub const SO_BUSY_POLL: ::c_int = 46; // from src/unix/linux_like/mod.rs -pub const SO_PEEK_OFF: ::c_int = 42; // from src/unix/linux_like/mod.rs -pub const SO_REUSEPORT: ::c_int = 15; // from src/unix/linux_like/mod.rs -pub const SOL_NETLINK: ::c_int = 270; // from src/unix/linux_like/mod.rs +pub const SO_BUSY_POLL: ::c_int = 46; // from src/unix/notbsd/mod.rs +pub const SO_PEEK_OFF: ::c_int = 42; // from src/unix/notbsd/mod.rs +pub const SO_REUSEPORT: ::c_int = 15; // from src/unix/notbsd/mod.rs +pub const SOL_NETLINK: ::c_int = 270; // from src/unix/notbsd/mod.rs pub const _POSIX_VDISABLE: ::cc_t = 0; // from linux/mod.rs -pub const AT_EMPTY_PATH: ::c_int = 0x1000; // from linux_like/mod.rs +pub const AT_EMPTY_PATH: ::c_int = 0x1000; // from notbsd/mod.rs // autogenerated constants with hand tuned types pub const AT_NO_AUTOMOUNT: ::c_int = 0x800; @@ -400,7 +394,6 @@ pub const FF1: ::c_int = 0x8000; pub const FFDLY: ::c_int = 0x8000; pub const FIONBIO: ::c_ulong = 0x5421; pub const FIOCLEX: ::c_ulong = 0x5451; -pub const FIONCLEX: ::c_ulong = 0x5450; pub const FLUSHO: ::tcflag_t = 0x1000; pub const F_GETLK: ::c_int = 0x5; pub const F_SETLK: ::c_int = 0x6; @@ -469,7 +462,6 @@ pub const POLLRDBAND: ::c_short = 0x80; pub const POLLRDNORM: ::c_short = 0x40; pub const POLLWRBAND: ::c_short = 0x200; pub const POLLWRNORM: ::c_short = 0x100; -pub const PTHREAD_STACK_MIN: ::size_t = 16384; pub const QIF_ALL: u32 = 0x3f; pub const QIF_BLIMITS: u32 = 0x1; pub const QIF_BTIME: u32 = 0x10; @@ -496,7 +488,6 @@ pub const SIGIO: ::c_int = 0x1d; pub const SIGPROF: ::c_int = 0x1b; pub const SIGPWR: ::c_int = 0x1e; pub const SIGSTKFLT: ::c_int = 0x10; -pub const SIGSTKSZ: ::size_t = 8192; pub const SIGSTOP: ::c_int = 0x13; pub const SIGSYS: ::c_int = 0x1f; pub const SIGTSTP: ::c_int = 0x14; @@ -543,6 +534,7 @@ pub const SO_SNDLOWAT: ::c_int = 0x13; pub const SO_SNDTIMEO: ::c_int = 0x15; pub const SO_TIMESTAMP: ::c_int = 0x1d; pub const SO_TYPE: ::c_int = 0x3; +pub const SYS_gettid: ::c_int = 0xe0; pub const TAB1: ::c_int = 0x800; pub const TAB2: ::c_int = 0x1000; pub const TAB3: ::c_int = 0x1800; @@ -619,358 +611,6 @@ pub const _SC_V6_LP64_OFF64: ::c_int = 0xb2; pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 0xb3; pub const _SC_XOPEN_STREAMS: ::c_int = 0xf6; -// Syscall table is copied from src/unix/notbsd/linux/musl/b32/arm.rs -pub const SYS_restart_syscall: ::c_long = 0; -pub const SYS_exit: ::c_long = 1; -pub const SYS_fork: ::c_long = 2; -pub const SYS_read: ::c_long = 3; -pub const SYS_write: ::c_long = 4; -pub const SYS_open: ::c_long = 5; -pub const SYS_close: ::c_long = 6; -pub const SYS_creat: ::c_long = 8; -pub const SYS_link: ::c_long = 9; -pub const SYS_unlink: ::c_long = 10; -pub const SYS_execve: ::c_long = 11; -pub const SYS_chdir: ::c_long = 12; -pub const SYS_mknod: ::c_long = 14; -pub const SYS_chmod: ::c_long = 15; -pub const SYS_lchown: ::c_long = 16; -pub const SYS_lseek: ::c_long = 19; -pub const SYS_getpid: ::c_long = 20; -pub const SYS_mount: ::c_long = 21; -pub const SYS_setuid: ::c_long = 23; -pub const SYS_getuid: ::c_long = 24; -pub const SYS_ptrace: ::c_long = 26; -pub const SYS_pause: ::c_long = 29; -pub const SYS_access: ::c_long = 33; -pub const SYS_nice: ::c_long = 34; -pub const SYS_sync: ::c_long = 36; -pub const SYS_kill: ::c_long = 37; -pub const SYS_rename: ::c_long = 38; -pub const SYS_mkdir: ::c_long = 39; -pub const SYS_rmdir: ::c_long = 40; -pub const SYS_dup: ::c_long = 41; -pub const SYS_pipe: ::c_long = 42; -pub const SYS_times: ::c_long = 43; -pub const SYS_brk: ::c_long = 45; -pub const SYS_setgid: ::c_long = 46; -pub const SYS_getgid: ::c_long = 47; -pub const SYS_geteuid: ::c_long = 49; -pub const SYS_getegid: ::c_long = 50; -pub const SYS_acct: ::c_long = 51; -pub const SYS_umount2: ::c_long = 52; -pub const SYS_ioctl: ::c_long = 54; -pub const SYS_fcntl: ::c_long = 55; -pub const SYS_setpgid: ::c_long = 57; -pub const SYS_umask: ::c_long = 60; -pub const SYS_chroot: ::c_long = 61; -pub const SYS_ustat: ::c_long = 62; -pub const SYS_dup2: ::c_long = 63; -pub const SYS_getppid: ::c_long = 64; -pub const SYS_getpgrp: ::c_long = 65; -pub const SYS_setsid: ::c_long = 66; -pub const SYS_sigaction: ::c_long = 67; -pub const SYS_setreuid: ::c_long = 70; -pub const SYS_setregid: ::c_long = 71; -pub const SYS_sigsuspend: ::c_long = 72; -pub const SYS_sigpending: ::c_long = 73; -pub const SYS_sethostname: ::c_long = 74; -pub const SYS_setrlimit: ::c_long = 75; -pub const SYS_getrusage: ::c_long = 77; -pub const SYS_gettimeofday: ::c_long = 78; -pub const SYS_settimeofday: ::c_long = 79; -pub const SYS_getgroups: ::c_long = 80; -pub const SYS_setgroups: ::c_long = 81; -pub const SYS_symlink: ::c_long = 83; -pub const SYS_readlink: ::c_long = 85; -pub const SYS_uselib: ::c_long = 86; -pub const SYS_swapon: ::c_long = 87; -pub const SYS_reboot: ::c_long = 88; -pub const SYS_munmap: ::c_long = 91; -pub const SYS_truncate: ::c_long = 92; -pub const SYS_ftruncate: ::c_long = 93; -pub const SYS_fchmod: ::c_long = 94; -pub const SYS_fchown: ::c_long = 95; -pub const SYS_getpriority: ::c_long = 96; -pub const SYS_setpriority: ::c_long = 97; -pub const SYS_statfs: ::c_long = 99; -pub const SYS_fstatfs: ::c_long = 100; -pub const SYS_syslog: ::c_long = 103; -pub const SYS_setitimer: ::c_long = 104; -pub const SYS_getitimer: ::c_long = 105; -pub const SYS_stat: ::c_long = 106; -pub const SYS_lstat: ::c_long = 107; -pub const SYS_fstat: ::c_long = 108; -pub const SYS_vhangup: ::c_long = 111; -pub const SYS_wait4: ::c_long = 114; -pub const SYS_swapoff: ::c_long = 115; -pub const SYS_sysinfo: ::c_long = 116; -pub const SYS_fsync: ::c_long = 118; -pub const SYS_sigreturn: ::c_long = 119; -pub const SYS_clone: ::c_long = 120; -pub const SYS_setdomainname: ::c_long = 121; -pub const SYS_uname: ::c_long = 122; -pub const SYS_adjtimex: ::c_long = 124; -pub const SYS_mprotect: ::c_long = 125; -pub const SYS_sigprocmask: ::c_long = 126; -pub const SYS_init_module: ::c_long = 128; -pub const SYS_delete_module: ::c_long = 129; -pub const SYS_quotactl: ::c_long = 131; -pub const SYS_getpgid: ::c_long = 132; -pub const SYS_fchdir: ::c_long = 133; -pub const SYS_bdflush: ::c_long = 134; -pub const SYS_sysfs: ::c_long = 135; -pub const SYS_personality: ::c_long = 136; -pub const SYS_setfsuid: ::c_long = 138; -pub const SYS_setfsgid: ::c_long = 139; -pub const SYS__llseek: ::c_long = 140; -pub const SYS_getdents: ::c_long = 141; -pub const SYS__newselect: ::c_long = 142; -pub const SYS_flock: ::c_long = 143; -pub const SYS_msync: ::c_long = 144; -pub const SYS_readv: ::c_long = 145; -pub const SYS_writev: ::c_long = 146; -pub const SYS_getsid: ::c_long = 147; -pub const SYS_fdatasync: ::c_long = 148; -pub const SYS__sysctl: ::c_long = 149; -pub const SYS_mlock: ::c_long = 150; -pub const SYS_munlock: ::c_long = 151; -pub const SYS_mlockall: ::c_long = 152; -pub const SYS_munlockall: ::c_long = 153; -pub const SYS_sched_setparam: ::c_long = 154; -pub const SYS_sched_getparam: ::c_long = 155; -pub const SYS_sched_setscheduler: ::c_long = 156; -pub const SYS_sched_getscheduler: ::c_long = 157; -pub const SYS_sched_yield: ::c_long = 158; -pub const SYS_sched_get_priority_max: ::c_long = 159; -pub const SYS_sched_get_priority_min: ::c_long = 160; -pub const SYS_sched_rr_get_interval: ::c_long = 161; -pub const SYS_nanosleep: ::c_long = 162; -pub const SYS_mremap: ::c_long = 163; -pub const SYS_setresuid: ::c_long = 164; -pub const SYS_getresuid: ::c_long = 165; -pub const SYS_poll: ::c_long = 168; -pub const SYS_nfsservctl: ::c_long = 169; -pub const SYS_setresgid: ::c_long = 170; -pub const SYS_getresgid: ::c_long = 171; -pub const SYS_prctl: ::c_long = 172; -pub const SYS_rt_sigreturn: ::c_long = 173; -pub const SYS_rt_sigaction: ::c_long = 174; -pub const SYS_rt_sigprocmask: ::c_long = 175; -pub const SYS_rt_sigpending: ::c_long = 176; -pub const SYS_rt_sigtimedwait: ::c_long = 177; -pub const SYS_rt_sigqueueinfo: ::c_long = 178; -pub const SYS_rt_sigsuspend: ::c_long = 179; -pub const SYS_pread64: ::c_long = 180; -pub const SYS_pwrite64: ::c_long = 181; -pub const SYS_chown: ::c_long = 182; -pub const SYS_getcwd: ::c_long = 183; -pub const SYS_capget: ::c_long = 184; -pub const SYS_capset: ::c_long = 185; -pub const SYS_sigaltstack: ::c_long = 186; -pub const SYS_sendfile: ::c_long = 187; -pub const SYS_vfork: ::c_long = 190; -pub const SYS_ugetrlimit: ::c_long = 191; -pub const SYS_mmap2: ::c_long = 192; -pub const SYS_truncate64: ::c_long = 193; -pub const SYS_ftruncate64: ::c_long = 194; -pub const SYS_stat64: ::c_long = 195; -pub const SYS_lstat64: ::c_long = 196; -pub const SYS_fstat64: ::c_long = 197; -pub const SYS_lchown32: ::c_long = 198; -pub const SYS_getuid32: ::c_long = 199; -pub const SYS_getgid32: ::c_long = 200; -pub const SYS_geteuid32: ::c_long = 201; -pub const SYS_getegid32: ::c_long = 202; -pub const SYS_setreuid32: ::c_long = 203; -pub const SYS_setregid32: ::c_long = 204; -pub const SYS_getgroups32: ::c_long = 205; -pub const SYS_setgroups32: ::c_long = 206; -pub const SYS_fchown32: ::c_long = 207; -pub const SYS_setresuid32: ::c_long = 208; -pub const SYS_getresuid32: ::c_long = 209; -pub const SYS_setresgid32: ::c_long = 210; -pub const SYS_getresgid32: ::c_long = 211; -pub const SYS_chown32: ::c_long = 212; -pub const SYS_setuid32: ::c_long = 213; -pub const SYS_setgid32: ::c_long = 214; -pub const SYS_setfsuid32: ::c_long = 215; -pub const SYS_setfsgid32: ::c_long = 216; -pub const SYS_getdents64: ::c_long = 217; -pub const SYS_pivot_root: ::c_long = 218; -pub const SYS_mincore: ::c_long = 219; -pub const SYS_madvise: ::c_long = 220; -pub const SYS_fcntl64: ::c_long = 221; -pub const SYS_gettid: ::c_long = 224; -pub const SYS_readahead: ::c_long = 225; -pub const SYS_setxattr: ::c_long = 226; -pub const SYS_lsetxattr: ::c_long = 227; -pub const SYS_fsetxattr: ::c_long = 228; -pub const SYS_getxattr: ::c_long = 229; -pub const SYS_lgetxattr: ::c_long = 230; -pub const SYS_fgetxattr: ::c_long = 231; -pub const SYS_listxattr: ::c_long = 232; -pub const SYS_llistxattr: ::c_long = 233; -pub const SYS_flistxattr: ::c_long = 234; -pub const SYS_removexattr: ::c_long = 235; -pub const SYS_lremovexattr: ::c_long = 236; -pub const SYS_fremovexattr: ::c_long = 237; -pub const SYS_tkill: ::c_long = 238; -pub const SYS_sendfile64: ::c_long = 239; -pub const SYS_futex: ::c_long = 240; -pub const SYS_sched_setaffinity: ::c_long = 241; -pub const SYS_sched_getaffinity: ::c_long = 242; -pub const SYS_io_setup: ::c_long = 243; -pub const SYS_io_destroy: ::c_long = 244; -pub const SYS_io_getevents: ::c_long = 245; -pub const SYS_io_submit: ::c_long = 246; -pub const SYS_io_cancel: ::c_long = 247; -pub const SYS_exit_group: ::c_long = 248; -pub const SYS_lookup_dcookie: ::c_long = 249; -pub const SYS_epoll_create: ::c_long = 250; -pub const SYS_epoll_ctl: ::c_long = 251; -pub const SYS_epoll_wait: ::c_long = 252; -pub const SYS_remap_file_pages: ::c_long = 253; -pub const SYS_set_tid_address: ::c_long = 256; -pub const SYS_timer_create: ::c_long = 257; -pub const SYS_timer_settime: ::c_long = 258; -pub const SYS_timer_gettime: ::c_long = 259; -pub const SYS_timer_getoverrun: ::c_long = 260; -pub const SYS_timer_delete: ::c_long = 261; -pub const SYS_clock_settime: ::c_long = 262; -pub const SYS_clock_gettime: ::c_long = 263; -pub const SYS_clock_getres: ::c_long = 264; -pub const SYS_clock_nanosleep: ::c_long = 265; -pub const SYS_statfs64: ::c_long = 266; -pub const SYS_fstatfs64: ::c_long = 267; -pub const SYS_tgkill: ::c_long = 268; -pub const SYS_utimes: ::c_long = 269; -pub const SYS_pciconfig_iobase: ::c_long = 271; -pub const SYS_pciconfig_read: ::c_long = 272; -pub const SYS_pciconfig_write: ::c_long = 273; -pub const SYS_mq_open: ::c_long = 274; -pub const SYS_mq_unlink: ::c_long = 275; -pub const SYS_mq_timedsend: ::c_long = 276; -pub const SYS_mq_timedreceive: ::c_long = 277; -pub const SYS_mq_notify: ::c_long = 278; -pub const SYS_mq_getsetattr: ::c_long = 279; -pub const SYS_waitid: ::c_long = 280; -pub const SYS_socket: ::c_long = 281; -pub const SYS_bind: ::c_long = 282; -pub const SYS_connect: ::c_long = 283; -pub const SYS_listen: ::c_long = 284; -pub const SYS_accept: ::c_long = 285; -pub const SYS_getsockname: ::c_long = 286; -pub const SYS_getpeername: ::c_long = 287; -pub const SYS_socketpair: ::c_long = 288; -pub const SYS_send: ::c_long = 289; -pub const SYS_sendto: ::c_long = 290; -pub const SYS_recv: ::c_long = 291; -pub const SYS_recvfrom: ::c_long = 292; -pub const SYS_shutdown: ::c_long = 293; -pub const SYS_setsockopt: ::c_long = 294; -pub const SYS_getsockopt: ::c_long = 295; -pub const SYS_sendmsg: ::c_long = 296; -pub const SYS_recvmsg: ::c_long = 297; -pub const SYS_semop: ::c_long = 298; -pub const SYS_semget: ::c_long = 299; -pub const SYS_semctl: ::c_long = 300; -pub const SYS_msgsnd: ::c_long = 301; -pub const SYS_msgrcv: ::c_long = 302; -pub const SYS_msgget: ::c_long = 303; -pub const SYS_msgctl: ::c_long = 304; -pub const SYS_shmat: ::c_long = 305; -pub const SYS_shmdt: ::c_long = 306; -pub const SYS_shmget: ::c_long = 307; -pub const SYS_shmctl: ::c_long = 308; -pub const SYS_add_key: ::c_long = 309; -pub const SYS_request_key: ::c_long = 310; -pub const SYS_keyctl: ::c_long = 311; -pub const SYS_semtimedop: ::c_long = 312; -pub const SYS_vserver: ::c_long = 313; -pub const SYS_ioprio_set: ::c_long = 314; -pub const SYS_ioprio_get: ::c_long = 315; -pub const SYS_inotify_init: ::c_long = 316; -pub const SYS_inotify_add_watch: ::c_long = 317; -pub const SYS_inotify_rm_watch: ::c_long = 318; -pub const SYS_mbind: ::c_long = 319; -pub const SYS_get_mempolicy: ::c_long = 320; -pub const SYS_set_mempolicy: ::c_long = 321; -pub const SYS_openat: ::c_long = 322; -pub const SYS_mkdirat: ::c_long = 323; -pub const SYS_mknodat: ::c_long = 324; -pub const SYS_fchownat: ::c_long = 325; -pub const SYS_futimesat: ::c_long = 326; -pub const SYS_fstatat64: ::c_long = 327; -pub const SYS_unlinkat: ::c_long = 328; -pub const SYS_renameat: ::c_long = 329; -pub const SYS_linkat: ::c_long = 330; -pub const SYS_symlinkat: ::c_long = 331; -pub const SYS_readlinkat: ::c_long = 332; -pub const SYS_fchmodat: ::c_long = 333; -pub const SYS_faccessat: ::c_long = 334; -pub const SYS_pselect6: ::c_long = 335; -pub const SYS_ppoll: ::c_long = 336; -pub const SYS_unshare: ::c_long = 337; -pub const SYS_set_robust_list: ::c_long = 338; -pub const SYS_get_robust_list: ::c_long = 339; -pub const SYS_splice: ::c_long = 340; -pub const SYS_tee: ::c_long = 342; -pub const SYS_vmsplice: ::c_long = 343; -pub const SYS_move_pages: ::c_long = 344; -pub const SYS_getcpu: ::c_long = 345; -pub const SYS_epoll_pwait: ::c_long = 346; -pub const SYS_kexec_load: ::c_long = 347; -pub const SYS_utimensat: ::c_long = 348; -pub const SYS_signalfd: ::c_long = 349; -pub const SYS_timerfd_create: ::c_long = 350; -pub const SYS_eventfd: ::c_long = 351; -pub const SYS_fallocate: ::c_long = 352; -pub const SYS_timerfd_settime: ::c_long = 353; -pub const SYS_timerfd_gettime: ::c_long = 354; -pub const SYS_signalfd4: ::c_long = 355; -pub const SYS_eventfd2: ::c_long = 356; -pub const SYS_epoll_create1: ::c_long = 357; -pub const SYS_dup3: ::c_long = 358; -pub const SYS_pipe2: ::c_long = 359; -pub const SYS_inotify_init1: ::c_long = 360; -pub const SYS_preadv: ::c_long = 361; -pub const SYS_pwritev: ::c_long = 362; -pub const SYS_rt_tgsigqueueinfo: ::c_long = 363; -pub const SYS_perf_event_open: ::c_long = 364; -pub const SYS_recvmmsg: ::c_long = 365; -pub const SYS_accept4: ::c_long = 366; -pub const SYS_fanotify_init: ::c_long = 367; -pub const SYS_fanotify_mark: ::c_long = 368; -pub const SYS_prlimit64: ::c_long = 369; -pub const SYS_name_to_handle_at: ::c_long = 370; -pub const SYS_open_by_handle_at: ::c_long = 371; -pub const SYS_clock_adjtime: ::c_long = 372; -pub const SYS_syncfs: ::c_long = 373; -pub const SYS_sendmmsg: ::c_long = 374; -pub const SYS_setns: ::c_long = 375; -pub const SYS_process_vm_readv: ::c_long = 376; -pub const SYS_process_vm_writev: ::c_long = 377; -pub const SYS_kcmp: ::c_long = 378; -pub const SYS_finit_module: ::c_long = 379; -pub const SYS_sched_setattr: ::c_long = 380; -pub const SYS_sched_getattr: ::c_long = 381; -pub const SYS_renameat2: ::c_long = 382; -pub const SYS_seccomp: ::c_long = 383; -pub const SYS_getrandom: ::c_long = 384; -pub const SYS_memfd_create: ::c_long = 385; -pub const SYS_bpf: ::c_long = 386; -pub const SYS_execveat: ::c_long = 387; -pub const SYS_userfaultfd: ::c_long = 388; -pub const SYS_membarrier: ::c_long = 389; -pub const SYS_mlock2: ::c_long = 390; -pub const SYS_copy_file_range: ::c_long = 391; -pub const SYS_preadv2: ::c_long = 392; -pub const SYS_pwritev2: ::c_long = 393; -pub const SYS_pkey_mprotect: ::c_long = 394; -pub const SYS_pkey_alloc: ::c_long = 395; -pub const SYS_pkey_free: ::c_long = 396; - fn CMSG_ALIGN(len: usize) -> usize { len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1) } diff --git a/src/unix/uclibc/mips/mod.rs b/src/unix/uclibc/mips/mod.rs index 6a9b41c9..fa4b0cbb 100644 --- a/src/unix/uclibc/mips/mod.rs +++ b/src/unix/uclibc/mips/mod.rs @@ -224,7 +224,6 @@ pub const SO_MAX_PACING_RATE: ::c_int = 47; pub const SO_BPF_EXTENSIONS: ::c_int = 48; pub const FIOCLEX: ::c_ulong = 0x6601; -pub const FIONCLEX: ::c_ulong = 0x6602; pub const FIONBIO: ::c_ulong = 0x667e; pub const SA_ONSTACK: ::c_uint = 0x08000000; diff --git a/src/unix/uclibc/mod.rs b/src/unix/uclibc/mod.rs index 25e8f8bf..568e0bc2 100644 --- a/src/unix/uclibc/mod.rs +++ b/src/unix/uclibc/mod.rs @@ -146,6 +146,19 @@ s! { pub int_n_sign_posn: ::c_char, } + pub struct sigevent { + pub sigev_value: ::sigval, + pub sigev_signo: ::c_int, + pub sigev_notify: ::c_int, + // Actually a union. We only expose sigev_notify_thread_id because it's + // the most useful member + pub sigev_notify_thread_id: ::c_int, + #[cfg(target_pointer_width = "64")] + __unused1: [::c_int; 11], + #[cfg(target_pointer_width = "32")] + __unused1: [::c_int; 12] + } + pub struct rlimit64 { pub rlim_cur: rlim64_t, pub rlim_max: rlim64_t, @@ -355,19 +368,6 @@ s_no_extra_traits! { pub nl_pid: u32, pub nl_groups: u32 } - - pub struct sigevent { - pub sigev_value: ::sigval, - pub sigev_signo: ::c_int, - pub sigev_notify: ::c_int, - // Actually a union. We only expose sigev_notify_thread_id because it's - // the most useful member - pub sigev_notify_thread_id: ::c_int, - #[cfg(target_pointer_width = "64")] - __unused1: [::c_int; 11], - #[cfg(target_pointer_width = "32")] - __unused1: [::c_int; 12] - } } cfg_if! { @@ -424,36 +424,6 @@ cfg_if! { self.nl_groups.hash(state); } } - - impl PartialEq for sigevent { - fn eq(&self, other: &sigevent) -> bool { - self.sigev_value == other.sigev_value - && self.sigev_signo == other.sigev_signo - && self.sigev_notify == other.sigev_notify - && self.sigev_notify_thread_id - == other.sigev_notify_thread_id - } - } - impl Eq for sigevent {} - impl ::fmt::Debug for sigevent { - fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { - f.debug_struct("sigevent") - .field("sigev_value", &self.sigev_value) - .field("sigev_signo", &self.sigev_signo) - .field("sigev_notify", &self.sigev_notify) - .field("sigev_notify_thread_id", - &self.sigev_notify_thread_id) - .finish() - } - } - impl ::hash::Hash for sigevent { - fn hash<H: ::hash::Hasher>(&self, state: &mut H) { - self.sigev_value.hash(state); - self.sigev_signo.hash(state); - self.sigev_notify.hash(state); - self.sigev_notify_thread_id.hash(state); - } - } } } |