diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 3e49d7473fdc5..70ed1ca355300 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,11 +1,14 @@ Thanks for considering submitting a PR! +We have the [contribution guide](https://github.com/rust-lang/libc/blob/main/CONTRIBUTING.md). Please read it if you're new here! + Here's a checklist for things that will be checked during review or continuous integration. -- \[ ] Edit corresponding file(s) under `libc-test/semver` when you add/remove item(s) -- \[ ] Your PR doesn't contain any *unstable* values like `*LAST` or `*MAX` (see [#3131](https://github.com/rust-lang/libc/issues/3131)) -- \[ ] If your PR increments version number, it must not contain any other changes -- \[ ] `rustc ci/style.rs && ./style src` +- \[ ] Edit corresponding file(s) under `libc-test/semver` when you add/remove item(s), e.g. edit `linux.txt` if you add an item to `src/unix/linux_like/linux/mod.rs` +- \[ ] Your PR doesn't contain any private or *unstable* values like `*LAST` or `*MAX` (see [#3131](https://github.com/rust-lang/libc/issues/3131)) +- \[ ] If your PR has a breaking change, please clarify it +- \[ ] If your PR increments version number, it must NOT contain any other changes (otherwise a release could be delayed) +- \[ ] Make sure `ci/style.sh` passes - \[ ] `cd libc-test && cargo test` - (this might fail on your env due to environment difference between your env and CI. Ignore failures if you are not sure) diff --git a/.github/workflows/bors.yml b/.github/workflows/bors.yml index 12069700cccb1..77f236c033e07 100644 --- a/.github/workflows/bors.yml +++ b/.github/workflows/bors.yml @@ -38,7 +38,7 @@ jobs: contents: read # to fetch code (actions/checkout) name: macOS - runs-on: macos-12 + runs-on: macos-13 strategy: fail-fast: true matrix: @@ -125,24 +125,14 @@ jobs: max-parallel: 12 matrix: target: [ - # FIXME: Mysterious failures in CI, see - # https://github.com/rust-lang/libc/issues/2081 - # aarch64-linux-android, + aarch64-linux-android, aarch64-unknown-linux-gnu, aarch64-unknown-linux-musl, arm-linux-androideabi, arm-unknown-linux-gnueabihf, arm-unknown-linux-musleabihf, - asmjs-unknown-emscripten, i686-linux-android, i686-unknown-linux-musl, - mips-unknown-linux-gnu, - mips-unknown-linux-musl, - # FIXME: Somehow failed on CI - # https://github.com/rust-lang/libc/runs/1659882216 - # mips64-unknown-linux-gnuabi64, - # mips64el-unknown-linux-gnuabi64, - mipsel-unknown-linux-musl, powerpc-unknown-linux-gnu, powerpc64-unknown-linux-gnu, powerpc64le-unknown-linux-gnu, @@ -269,9 +259,9 @@ jobs: max-parallel: 4 matrix: target: - - { toolchain: stable, os: macos-12 } - - { toolchain: beta, os: macos-12 } - - { toolchain: nightly, os: macos-12 } + - { toolchain: stable, os: macos-13 } + - { toolchain: beta, os: macos-13 } + - { toolchain: nightly, os: macos-13 } # Use macOS 11 for older toolchains as newer Xcode donesn't work well. # FIXME: Disabled due to: # error: failed to parse registry's information for: serde diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7a0e646bddd70..eaf4ffec2ad3c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -30,7 +30,7 @@ jobs: macos: name: macOS - runs-on: macos-12 + runs-on: macos-13 strategy: fail-fast: true matrix: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8c551dbdb576e..d487162a5fd5d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,7 +54,7 @@ We have two automated tests running on [GitHub Actions](https://github.com/rust- - `cd libc-test && cargo test` - Use the `skip_*()` functions in `build.rs` if you really need a workaround. 2. Style checker - - `rustc ci/style.rs && ./style src` + - [`sh ci/style.sh`](https://github.com/rust-lang/libc/blob/main/ci/style.sh) ## Breaking change policy diff --git a/Cargo.toml b/Cargo.toml index b70de560209fe..dff98cfbc9796 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libc" -version = "0.2.150" +version = "0.2.151" authors = ["The Rust Project Developers"] license = "MIT OR Apache-2.0" readme = "README.md" @@ -19,6 +19,7 @@ Raw FFI bindings to platform libraries like libc. features = ["const-extern-fn", "extra_traits"] default-target = "x86_64-unknown-linux-gnu" targets = [ + "aarch64-apple-darwin", "aarch64-apple-ios", "aarch64-linux-android", "aarch64-pc-windows-msvc", diff --git a/build.rs b/build.rs index d7a9b7f7811d2..ee99981881c04 100644 --- a/build.rs +++ b/build.rs @@ -59,15 +59,15 @@ fn main() { ); } - // The ABI of libc used by libstd is backward compatible with FreeBSD 10. + // The ABI of libc used by std is backward compatible with FreeBSD 12. // The ABI of libc from crates.io is backward compatible with FreeBSD 11. // // On CI, we detect the actual FreeBSD version and match its ABI exactly, // running tests to ensure that the ABI is correct. match which_freebsd() { - Some(10) if libc_ci || rustc_dep_of_std => set_cfg("freebsd10"), + Some(10) if libc_ci => set_cfg("freebsd10"), Some(11) if libc_ci => set_cfg("freebsd11"), - Some(12) if libc_ci => set_cfg("freebsd12"), + Some(12) if libc_ci || rustc_dep_of_std => set_cfg("freebsd12"), Some(13) if libc_ci => set_cfg("freebsd13"), Some(14) if libc_ci => set_cfg("freebsd14"), Some(_) | None => set_cfg("freebsd11"), diff --git a/ci/android-install-ndk.sh b/ci/android-install-ndk.sh index 463565125972f..ebe791af703b8 100644 --- a/ci/android-install-ndk.sh +++ b/ci/android-install-ndk.sh @@ -2,40 +2,10 @@ set -ex -NDK=android-ndk-r21d -wget --tries=20 -q https://dl.google.com/android/repository/${NDK}-linux-x86_64.zip -unzip -q ${NDK}-linux-x86_64.zip +NDK=android-ndk-r26b +wget --tries=20 -q https://dl.google.com/android/repository/${NDK}-linux.zip +unzip -q ${NDK}-linux.zip -case "$1" in - arm) - arch=arm - api=28 - ;; - armv7) - arch=arm - api=28 - ;; - aarch64) - arch=arm64 - api=28 - ;; - i686) - arch=x86 - api=28 - ;; - x86_64) - arch=x86_64 - api=28 - ;; - *) - echo "invalid arch: $1" - exit 1 - ;; -esac; +mv ./${NDK}/toolchains/llvm/prebuilt/linux-x86_64 /android -python3 ${NDK}/build/tools/make_standalone_toolchain.py \ - --install-dir "/android/ndk-${1}" \ - --arch "${arch}" \ - --api ${api} - -rm -rf ./${NDK}-linux-x86_64.zip ./${NDK} +rm -rf ./${NDK}-linux.zip ./${NDK} diff --git a/ci/build.sh b/ci/build.sh index 2a9d68f53859b..41225f9cdffd6 100644 --- a/ci/build.sh +++ b/ci/build.sh @@ -39,7 +39,7 @@ test_target() { done fi - # Test that libc builds without any default features (no libstd) + # Test that libc builds without any default features (no std) if [ "${NO_STD}" != "1" ]; then cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" else @@ -47,8 +47,8 @@ test_target() { RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \ -Z build-std=core,alloc -vv --no-default-features --target "${TARGET}" fi - # Test that libc builds with default features (e.g. libstd) - # if the target supports libstd + # Test that libc builds with default features (e.g. std) + # if the target supports std if [ "$NO_STD" != "1" ]; then cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}" else @@ -112,14 +112,6 @@ x86_64-unknown-linux-musl \ x86_64-unknown-netbsd \ " -# FIXME: builds of MIPS targets are currently broken on nightly. -# mips-unknown-linux-gnu \ -# mips-unknown-linux-musl \ -# mips64-unknown-linux-gnuabi64 \ -# mips64el-unknown-linux-gnuabi64 \ -# mipsel-unknown-linux-gnu \ -# mipsel-unknown-linux-musl \ - RUST_GT_1_13_LINUX_TARGETS="\ arm-unknown-linux-musleabi \ arm-unknown-linux-musleabihf \ @@ -238,9 +230,15 @@ i686-unknown-haiku \ i686-unknown-netbsd \ i686-unknown-openbsd \ i686-wrs-vxworks \ -mipsel-sony-psp \ +mips-unknown-linux-gnu \ +mips-unknown-linux-musl \ +mips64-unknown-linux-gnuabi64 \ mips64-unknown-linux-muslabi64 \ +mips64el-unknown-linux-gnuabi64 \ mips64el-unknown-linux-muslabi64 \ +mipsel-unknown-linux-gnu \ +mipsel-unknown-linux-musl \ +mipsel-sony-psp \ nvptx64-nvidia-cuda \ powerpc-unknown-linux-gnuspe \ powerpc-unknown-netbsd \ diff --git a/ci/docker/aarch64-linux-android/Dockerfile b/ci/docker/aarch64-linux-android/Dockerfile index 5dc0c0e7fed3f..7b8bdcfdadb32 100644 --- a/ci/docker/aarch64-linux-android/Dockerfile +++ b/ci/docker/aarch64-linux-android/Dockerfile @@ -19,9 +19,9 @@ WORKDIR /android/ COPY android* /android/ ENV ANDROID_ARCH=aarch64 -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools +ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH +RUN sh /android/android-install-ndk.sh RUN sh /android/android-install-sdk.sh $ANDROID_ARCH RUN mv /root/.android /tmp RUN chmod 777 -R /tmp/.android @@ -31,6 +31,7 @@ ENV PATH=$PATH:/rust/bin \ CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android28-clang \ CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=/tmp/runtest \ CC_aarch64_linux_android=aarch64-linux-android28-clang \ + AR_aarch64_linux_android=llvm-ar \ HOME=/tmp ADD runtest-android.rs /tmp/runtest.rs diff --git a/ci/docker/aarch64-unknown-linux-musl/Dockerfile b/ci/docker/aarch64-unknown-linux-musl/Dockerfile index c27a451792a47..bc15db0692297 100644 --- a/ci/docker/aarch64-unknown-linux-musl/Dockerfile +++ b/ci/docker/aarch64-unknown-linux-musl/Dockerfile @@ -7,7 +7,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY install-musl.sh / RUN sh /install-musl.sh aarch64 -# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in libstd? +# FIXME: shouldn't need the `-lgcc` here, shouldn't that be in std? ENV PATH=$PATH:/musl-aarch64/bin:/rust/bin \ CC_aarch64_unknown_linux_musl=musl-gcc \ RUSTFLAGS='-Clink-args=-lgcc -L /musl-aarch64/lib' \ diff --git a/ci/docker/arm-linux-androideabi/Dockerfile b/ci/docker/arm-linux-androideabi/Dockerfile index e51c50e0f53c6..d0fb3176de7e7 100644 --- a/ci/docker/arm-linux-androideabi/Dockerfile +++ b/ci/docker/arm-linux-androideabi/Dockerfile @@ -19,18 +19,19 @@ WORKDIR /android/ COPY android* /android/ ENV ANDROID_ARCH=arm -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools +ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH +RUN sh /android/android-install-ndk.sh 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/cmdline-tools/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_LINKER=armv7a-linux-androideabi28-clang \ CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \ - CC_arm_linux_androideabi=arm-linux-androideabi-gcc \ + CC_arm_linux_androideabi=armv7a-linux-androideabi28-clang \ + AR_arm_linux_androideabi=llvm-ar \ HOME=/tmp ADD runtest-android.rs /tmp/runtest.rs diff --git a/ci/docker/i686-linux-android/Dockerfile b/ci/docker/i686-linux-android/Dockerfile index 05846ea9bf077..a78c7cb6e8457 100644 --- a/ci/docker/i686-linux-android/Dockerfile +++ b/ci/docker/i686-linux-android/Dockerfile @@ -19,18 +19,19 @@ WORKDIR /android/ COPY android* /android/ ENV ANDROID_ARCH=i686 -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools +ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH +RUN sh /android/android-install-ndk.sh 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/cmdline-tools/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_LINKER=i686-linux-android28-clang \ CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=/tmp/runtest \ - CC_i686_linux_android=i686-linux-android-gcc \ + CC_i686_linux_android=i686-linux-android28-clang \ + AR_i686_linux_android=llvm-ar \ HOME=/tmp ADD runtest-android.rs /tmp/runtest.rs diff --git a/ci/docker/mips-unknown-linux-gnu/Dockerfile b/ci/docker/mips-unknown-linux-gnu/Dockerfile deleted file mode 100644 index 4c2bb1667b832..0000000000000 --- a/ci/docker/mips-unknown-linux-gnu/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM ubuntu:23.10 - -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 2df2e6a34725a..0000000000000 --- a/ci/docker/mips-unknown-linux-musl/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -FROM ubuntu:23.10 - -RUN apt-get update && apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \ - xz-utils patch - -RUN mkdir /toolchain - -# Linux kernel version: 5.4.154 -# See build_dir/target-mips_24kc_musl/linux-ath79_generic/linux-5.4.154 -# Musl version: 1.1.24 -# See staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl/info.mk -RUN curl --retry 5 -L https://downloads.openwrt.org/releases/21.02.1/targets/ath79/generic/openwrt-sdk-21.02.1-ath79-generic_gcc-8.4.0_musl.Linux-x86_64.tar.xz | \ - tar xJf - -C /toolchain --strip-components=1 - -# See https://lkml.org/lkml/2014/3/14/269 -COPY sysinfo_guard.patch /toolchain -RUN patch /toolchain/staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl/include/linux/kernel.h true, - // FIXME: libstd removed libresolv support: https://github.com/rust-lang/rust/pull/102766 + // FIXME: std removed libresolv support: https://github.com/rust-lang/rust/pull/102766 "res_init" => true, // FIXME: remove once the target in CI is updated @@ -518,20 +519,12 @@ fn test_openbsd(target: &str) { "util.h", "ufs/ufs/quota.h", "pthread_np.h", + "sys/reboot.h", "sys/syscall.h", "sys/shm.h", "sys/param.h", } - cfg.skip_type(move |ty| { - if ty.starts_with("__c_anonymous_") { - return true; - } - match ty { - _ => false, - } - }); - cfg.skip_struct(move |ty| { if ty.starts_with("__c_anonymous_") { return true; @@ -1015,6 +1008,10 @@ fn test_solarish(target: &str) { "madvise" | "mprotect" if is_illumos => true, "door_call" | "door_return" | "door_create" if is_illumos => true, + // The compat functions use these "native" functions linked to their + // non-prefixed implementations in libc. + "native_getpwent_r" | "native_getgrent_r" => true, + // Not visible when build with _XOPEN_SOURCE=700 "mmapobj" | "mmap64" | "meminfo" | "getpagesizes" | "getpagesizes2" => true, @@ -1023,6 +1020,12 @@ fn test_solarish(target: &str) { // value is not useful (always 0) so we can ignore it: "setservent" | "endservent" if is_illumos => true, + // Following illumos#3729, getifaddrs was changed to a + // redefine_extname symbol in order to preserve compatibility. + // Until better symbol binding story is figured out, it must be + // excluded from the tests. + "getifaddrs" if is_illumos => true, + _ => false, } }); @@ -1119,6 +1122,7 @@ fn test_netbsd(target: &str) { "netinet/dccp.h", "sys/event.h", "sys/quota.h", + "sys/reboot.h", "sys/shm.h", "iconv.h", } @@ -1551,6 +1555,7 @@ fn test_android(target: &str) { t => panic!("unsupported target: {}", t), }; let x86 = target.contains("i686") || target.contains("x86_64"); + let aarch64 = target.contains("aarch64"); let mut cfg = ctest_cfg(); cfg.define("_GNU_SOURCE", None); @@ -1569,6 +1574,7 @@ fn test_android(target: &str) { "libgen.h", "limits.h", "link.h", + "linux/sysctl.h", "locale.h", "malloc.h", "net/ethernet.h", @@ -1764,6 +1770,14 @@ fn test_android(target: &str) { // These are tested in the `linux_elf.rs` file. "Elf64_Phdr" | "Elf32_Phdr" => true, + // FIXME: The type of `iv` has been changed. + "af_alg_iv" => true, + + // FIXME: The size of struct has been changed: + "inotify_event" => true, + // FIXME: The field has been changed: + "sockaddr_vm" => true, + _ => false, } }); @@ -1830,6 +1844,9 @@ fn test_android(target: &str) { // kernel 5.6 minimum required "IPPROTO_MPTCP" | "IPPROTO_ETHERNET" => true, + // kernel 6.2 minimum + "TUN_F_USO4" | "TUN_F_USO6" | "IFF_NO_CARRIER" => true, + // FIXME: NDK r22 minimum required | "FDB_NOTIFY_BIT" | "FDB_NOTIFY_INACTIVE_BIT" @@ -1866,6 +1883,20 @@ fn test_android(target: &str) { | "NTF_EXT_LOCKED" | "ALG_SET_DRBG_ENTROPY" => true, + // FIXME: Something has been changed on r26b: + | "IPPROTO_MAX" + | "NFNL_SUBSYS_COUNT" + | "NF_NETDEV_NUMHOOKS" + | "NFT_MSG_MAX" + | "SW_MAX" + | "SW_CNT" => true, + + // FIXME: aarch64 env cannot find it: + | "PTRACE_GETREGS" + | "PTRACE_SETREGS" if aarch64 => true, + // FIXME: The value has been changed on r26b: + | "SYS_syscalls" if aarch64 => true, + _ => false, } }); @@ -1912,6 +1943,11 @@ fn test_android(target: &str) { // Added in API level 28, but some tests use level 24. "fread_unlocked" | "fwrite_unlocked" | "fgets_unlocked" | "fflush_unlocked" => true, + // FIXME: bad function pointers: + "isalnum" | "isalpha" | "iscntrl" | "isdigit" | "isgraph" | "islower" | "isprint" + | "ispunct" | "isspace" | "isupper" | "isxdigit" | "isblank" | "tolower" + | "toupper" => true, + _ => false, } }); @@ -1927,7 +1963,9 @@ fn test_android(target: &str) { // incorrect, see: https://github.com/rust-lang/libc/issues/1359 (struct_ == "sigaction" && field == "sa_sigaction") || // signalfd had SIGSYS fields added in Android 4.19, but CI does not have that version yet. - (struct_ == "signalfd_siginfo" && field == "ssi_call_addr") + (struct_ == "signalfd_siginfo" && field == "ssi_call_addr") || + // FIXME: Seems the type has been changed on NDK r26b + (struct_ == "flock64" && (field == "l_start" || field == "l_len")) }); cfg.skip_field(move |struct_, field| { @@ -2397,6 +2435,8 @@ fn test_freebsd(target: &str) { // the struct "__kvm" is quite tricky to bind so since we only use a pointer to it // for now, it doesn't matter too much... "kvm_t" => true, + // `eventfd(2)` and things come with it are added in FreeBSD 13 + "eventfd_t" if Some(13) > freebsd_ver => true, _ => false, } @@ -2474,6 +2514,8 @@ fn test_freebsd(target: &str) { | "aio_readv" | "aio_writev" | "copy_file_range" + | "eventfd_read" + | "eventfd_write" if Some(13) > freebsd_ver => { true @@ -3224,10 +3266,8 @@ fn test_linux(target: &str) { } let arm = target.contains("arm"); + let aarch64 = target.contains("aarch64"); let i686 = target.contains("i686"); - let mips = target.contains("mips"); - let mips32 = mips && !target.contains("64"); - let mips64 = mips && target.contains("64"); let ppc = target.contains("powerpc"); let ppc64 = target.contains("powerpc64"); let s390x = target.contains("s390x"); @@ -3235,7 +3275,7 @@ fn test_linux(target: &str) { let x32 = target.contains("x32"); let x86_32 = target.contains("i686"); let x86_64 = target.contains("x86_64"); - let aarch64_musl = target.contains("aarch64") && musl; + let aarch64_musl = aarch64 && musl; let gnueabihf = target.contains("gnueabihf"); let x86_64_gnux32 = target.contains("gnux32") && x86_64; let riscv64 = target.contains("riscv64"); @@ -3264,6 +3304,7 @@ fn test_linux(target: &str) { "libgen.h", "limits.h", "link.h", + "linux/sysctl.h", "locale.h", "malloc.h", "mntent.h", @@ -3377,6 +3418,7 @@ fn test_linux(target: &str) { "linux/if_alg.h", "linux/if_ether.h", "linux/if_tun.h", + "linux/if_xdp.h", "linux/input.h", "linux/ipv6.h", "linux/kexec.h", @@ -3414,6 +3456,7 @@ fn test_linux(target: &str) { "linux/uinput.h", "linux/vm_sockets.h", "linux/wait.h", + "linux/wireless.h", "sys/fanotify.h", // is not present on uclibc [!uclibc]: "sys/auxv.h", @@ -3593,6 +3636,47 @@ fn test_linux(target: &str) { // FIXME: The size of `iv` has been changed since Linux v6.0 // https://github.com/torvalds/linux/commit/94dfc73e7cf4a31da66b8843f0b9283ddd6b8381 "af_alg_iv" => true, + + // FIXME: Requires >= 5.1 kernel headers. + // Everything that uses install-musl.sh has 4.19 kernel headers. + "tls12_crypto_info_aes_gcm_256" + if (aarch64 || arm || i686 || s390x || x86_64) && musl => + { + true + } + + // FIXME: Requires >= 5.11 kernel headers. + // Everything that uses install-musl.sh has 4.19 kernel headers. + "tls12_crypto_info_chacha20_poly1305" + if (aarch64 || arm || i686 || s390x || x86_64) && musl => + { + true + } + + // FIXME: Requires >= 5.3 kernel headers. + // Everything that uses install-musl.sh has 4.19 kernel headers. + "xdp_options" if musl => true, + + // FIXME: Requires >= 5.4 kernel headers. + // Everything that uses install-musl.sh has 4.19 kernel headers. + "xdp_umem_reg" | "xdp_ring_offset" | "xdp_mmap_offsets" if musl => true, + + // FIXME: Requires >= 5.9 kernel headers. + // Everything that uses install-musl.sh has 4.19 kernel headers. + "xdp_statistics" if musl => true, + + // A new field was added in kernel 5.4, this is the old version for backwards compatibility. + // https://github.com/torvalds/linux/commit/77cd0d7b3f257fd0e3096b4fdcff1a7d38e99e10 + "xdp_ring_offset_v1" | "xdp_mmap_offsets_v1" => true, + + // Multiple new fields were added in kernel 5.9, this is the old version for backwards compatibility. + // https://github.com/torvalds/linux/commit/77cd0d7b3f257fd0e3096b4fdcff1a7d38e99e10 + "xdp_statistics_v1" => true, + + // A new field was added in kernel 5.4, this is the old version for backwards compatibility. + // https://github.com/torvalds/linux/commit/c05cd3645814724bdeb32a2b4d953b12bdea5f8c + "xdp_umem_reg_v1" => true, + _ => false, } }); @@ -3653,6 +3737,10 @@ fn test_linux(target: &str) { if name.starts_with("RLIM64") { return true; } + // CI fails because musl targets use Linux v4 kernel + if name.starts_with("NI_IDN") { + return true; + } } match name { // These constants are not available if gnu headers have been included @@ -3709,16 +3797,11 @@ fn test_linux(target: &str) { | "IPPROTO_ETHERNET" | "IPPROTO_MPTCP" => true, - // FIXME: Not currently available in headers - "P_PIDFD" if mips => true, - "SYS_pidfd_open" if mips => true, - - // FIXME: Not currently available in headers on MIPS - // Not yet implemented on sparc64 - "SYS_clone3" if mips | sparc64 => true, + // FIXME: Not yet implemented on sparc64 + "SYS_clone3" if sparc64 => true, - // FIXME: Not defined on ARM, gnueabihf, MIPS, musl, PowerPC, riscv64, s390x, and sparc64. - "SYS_memfd_secret" if arm | gnueabihf | mips | musl | ppc | riscv64 | s390x | sparc64 => true, + // FIXME: Not defined on ARM, gnueabihf, musl, PowerPC, riscv64, s390x, and sparc64. + "SYS_memfd_secret" if arm | gnueabihf | musl | ppc | riscv64 | s390x | sparc64 => true, // FIXME: Added in Linux 5.16 // https://github.com/torvalds/linux/commit/039c0ec9bb77446d7ada7f55f90af9299b28ca49 @@ -3736,10 +3819,10 @@ fn test_linux(target: &str) { | "UINPUT_VERSION" | "SW_MAX" | "SW_CNT" - if mips || ppc64 || riscv64 => true, + if ppc64 || riscv64 => true, - // FIXME: Not currently available in headers on ARM, MIPS and musl. - "NETLINK_GET_STRICT_CHK" if arm || mips || musl => true, + // FIXME: Not currently available in headers on ARM and musl. + "NETLINK_GET_STRICT_CHK" if arm || musl => true, // kernel constants not available in uclibc 1.0.34 | "EXTPROC" @@ -3862,6 +3945,9 @@ fn test_linux(target: &str) { // kernel 6.1 minimum "MADV_COLLAPSE" => true, + // kernel 6.2 minimum + "TUN_F_USO4" | "TUN_F_USO6" | "IFF_NO_CARRIER" => true, + // FIXME: Requires more recent kernel headers | "IFLA_PARENT_DEV_NAME" // linux v5.13+ | "IFLA_PARENT_DEV_BUS_NAME" // linux v5.13+ @@ -3914,6 +4000,63 @@ fn test_linux(target: &str) { // FIXME: Requires linux 6.5 "NFT_MSG_MAX" => true, + // FIXME: Requires >= 5.1 kernel headers. + // Everything that uses install-musl.sh has 4.19 kernel headers. + "TLS_1_3_VERSION" + | "TLS_1_3_VERSION_MAJOR" + | "TLS_1_3_VERSION_MINOR" + | "TLS_CIPHER_AES_GCM_256" + | "TLS_CIPHER_AES_GCM_256_IV_SIZE" + | "TLS_CIPHER_AES_GCM_256_KEY_SIZE" + | "TLS_CIPHER_AES_GCM_256_SALT_SIZE" + | "TLS_CIPHER_AES_GCM_256_TAG_SIZE" + | "TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE" + if (aarch64 || arm || i686 || s390x || x86_64) && musl => + { + true + } + + // FIXME: Requires >= 5.11 kernel headers. + // Everything that uses install-musl.sh has 4.19 kernel headers. + "TLS_CIPHER_CHACHA20_POLY1305" + | "TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE" + | "TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE" + | "TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE" + | "TLS_CIPHER_CHACHA20_POLY1305_TAG_SIZE" + | "TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE" + if (aarch64 || arm || i686 || s390x || x86_64) && musl => + { + true + } + + // FIXME: Requires >= 5.3 kernel headers. + // Everything that uses install-musl.sh has 4.19 kernel headers. + "XDP_OPTIONS_ZEROCOPY" | "XDP_OPTIONS" + if musl => + { + true + } + + // FIXME: Requires >= 5.4 kernel headers. + // Everything that uses install-musl.sh has 4.19 kernel headers. + "XSK_UNALIGNED_BUF_OFFSET_SHIFT" + | "XSK_UNALIGNED_BUF_ADDR_MASK" + | "XDP_UMEM_UNALIGNED_CHUNK_FLAG" + | "XDP_RING_NEED_WAKEUP" + | "XDP_USE_NEED_WAKEUP" + if musl => + { + true + } + + // FIXME: Requires >= 6.6 kernel headers. + "XDP_USE_SG" + | "XDP_PKT_CONTD" + => + { + true + } + _ => false, } }); @@ -4103,15 +4246,11 @@ fn test_linux(target: &str) { }); cfg.skip_roundtrip(move |s| match s { - // FIXME: - "utsname" if mips32 || mips64 => true, // FIXME: "mcontext_t" if s390x => true, // FIXME: This is actually a union. "fpreg_t" if s390x => true, - "sockaddr_un" | "sembuf" | "ff_constant_effect" if mips32 && (gnu || musl) => true, - // The test doesn't work on some env: "ipv6_mreq" | "ip_mreq_source" @@ -4131,7 +4270,7 @@ fn test_linux(target: &str) { | "sockaddr_nl" | "termios" | "nlmsgerr" - if (mips64 || sparc64) && gnu => + if sparc64 && gnu => { true } @@ -4144,7 +4283,7 @@ fn test_linux(target: &str) { "cmsghdr" => true, // FIXME: the call ABI of max_align_t is incorrect on these platforms: - "max_align_t" if i686 || mips64 || ppc64 => true, + "max_align_t" if i686 || ppc64 => true, _ => false, }); @@ -4580,6 +4719,7 @@ fn test_haiku(target: &str) { ("sigaction", "sa_sigaction") => true, ("sigevent", "sigev_value") => true, ("fpu_state", "_fpreg") => true, + ("cpu_topology_node_info", "data") => true, // these fields have a simplified data definition in libc ("fpu_state", "_xmm") => true, ("savefpu", "_fp_ymm") => true, @@ -4600,13 +4740,33 @@ fn test_haiku(target: &str) { cfg.type_name(move |ty, is_struct, is_union| { match ty { // Just pass all these through, no need for a "struct" prefix - "area_info" | "port_info" | "port_message_info" | "team_info" | "sem_info" - | "team_usage_info" | "thread_info" | "cpu_info" | "system_info" - | "object_wait_info" | "image_info" | "attr_info" | "index_info" | "fs_info" - | "FILE" | "DIR" | "Dl_info" => ty.to_string(), + "area_info" + | "port_info" + | "port_message_info" + | "team_info" + | "sem_info" + | "team_usage_info" + | "thread_info" + | "cpu_info" + | "system_info" + | "object_wait_info" + | "image_info" + | "attr_info" + | "index_info" + | "fs_info" + | "FILE" + | "DIR" + | "Dl_info" + | "topology_level_type" + | "cpu_topology_node_info" + | "cpu_topology_root_info" + | "cpu_topology_package_info" + | "cpu_topology_core_info" => ty.to_string(), // enums don't need a prefix - "directory_which" | "path_base_directory" => ty.to_string(), + "directory_which" | "path_base_directory" | "cpu_platform" | "cpu_vendor" => { + ty.to_string() + } // is actually a union "sigval" => format!("union sigval"), @@ -4625,6 +4785,7 @@ fn test_haiku(target: &str) { "type_" if struct_ == "sem_t" => "type".to_string(), "type_" if struct_ == "attr_info" => "type".to_string(), "type_" if struct_ == "index_info" => "type".to_string(), + "type_" if struct_ == "cpu_topology_node_info" => "type".to_string(), "image_type" if struct_ == "image_info" => "type".to_string(), s => s.to_string(), } diff --git a/libc-test/semver/TODO-unix.txt b/libc-test/semver/TODO-unix.txt index 3d4866076ebd1..3a6d318f23994 100644 --- a/libc-test/semver/TODO-unix.txt +++ b/libc-test/semver/TODO-unix.txt @@ -1,5 +1,4 @@ # These symbols are no-op or missing on these targets: -# * asmjs-unknown-emscripten # * wasm32-unknown-emscripten getpwuid_r pthread_atfork diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 09551d329c435..a7c235eefb3ed 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -613,6 +613,14 @@ FIONCLEX FIONREAD FLUSHO FOPEN_MAX +FS_IOC_GETFLAGS +FS_IOC_SETFLAGS +FS_IOC_GETVERSION +FS_IOC_SETVERSION +FS_IOC32_GETFLAGS +FS_IOC32_SETFLAGS +FS_IOC32_GETVERSION +FS_IOC32_SETVERSION FUTEX_CLOCK_REALTIME FUTEX_CMD_MASK FUTEX_CMP_REQUEUE @@ -699,6 +707,7 @@ IFF_MASTER IFF_MULTICAST IFF_NOARP IFF_NOTRAILERS +IFF_NO_CARRIER IFF_NO_PI IFF_POINTOPOINT IFF_PORTSEL @@ -708,6 +717,13 @@ IFF_SLAVE IFF_TAP IFF_TUN IFF_UP +TUN_F_CSUM +TUN_F_TSO4 +TUN_F_TSO6 +TUN_F_TSO_ECN +TUN_F_UFO +TUN_F_USO4 +TUN_F_USO6 IFNAMSIZ IF_NAMESIZE IFA_UNSPEC @@ -3748,3 +3764,7 @@ write writev dirname basename +eventfd_read +eventfd_write +HUGETLB_FLAG_ENCODE_SHIFT +MAP_HUGE_SHIFT diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index ef911271ff425..a3e2161ab9ee1 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -640,6 +640,7 @@ IPV6_HOPLIMIT IPV6_JOIN_GROUP IPV6_LEAVE_GROUP IPV6_PKTINFO +IPV6_RECVHOPLIMIT IPV6_RECVPKTINFO IPV6_RECVTCLASS IPV6_TCLASS @@ -649,6 +650,7 @@ IP_PKTINFO IP_RECVDSTADDR IP_RECVIF IP_RECVTOS +IP_RECVTTL IP_TOS ITIMER_PROF ITIMER_REAL @@ -1915,6 +1917,7 @@ getattrlistbulk getdate getdomainname getdtablesize +getentropy getfsstat getgrent getgrgid @@ -2264,6 +2267,8 @@ uselocale utimensat utmpx utmpxname +vm_allocate +vm_deallocate vm_inherit_t vm_map_t vm_prot_t diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index 43de5c8ccdb8c..9f436ced22a81 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -1100,6 +1100,7 @@ RFLINUXTHPN RFMEM RFNOWAIT RFPROC +RFSIGSHARE RFSPAWN RFTHREAD RFTSIGZMB @@ -2245,3 +2246,5 @@ dirname basename closefrom close_range +eventfd_read +eventfd_write diff --git a/libc-test/semver/fuchsia.txt b/libc-test/semver/fuchsia.txt index cf3c4a10d63e1..c876cc6a5b812 100644 --- a/libc-test/semver/fuchsia.txt +++ b/libc-test/semver/fuchsia.txt @@ -1472,3 +1472,5 @@ utimensat vhangup vmsplice waitid +HUGETLB_FLAG_ENCODE_SHIFT +MAP_HUGE_SHIFT diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index ad971de731bad..4d95520d3e9de 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -486,6 +486,29 @@ UDF_SUPER_MAGIC UNAME26 USBDEVICE_SUPER_MAGIC USER_PROCESS +XDP_SHARED_UMEM +XDP_COPY +XDP_ZEROCOPY +XDP_USE_NEED_WAKEUP +XDP_USE_SG +XDP_UMEM_UNALIGNED_CHUNK_FLAG +XDP_RING_NEED_WAKEUP +XDP_MMAP_OFFSETS +XDP_RX_RING +XDP_TX_RING +XDP_UMEM_REG +XDP_UMEM_FILL_RING +XDP_UMEM_COMPLETION_RING +XDP_STATISTICS +XDP_OPTIONS +XDP_OPTIONS_ZEROCOPY +XDP_PGOFF_RX_RING +XDP_PGOFF_TX_RING +XDP_UMEM_PGOFF_FILL_RING +XDP_UMEM_PGOFF_COMPLETION_RING +XSK_UNALIGNED_BUF_OFFSET_SHIFT +XSK_UNALIGNED_BUF_ADDR_MASK +XDP_PKT_CONTD XENFS_SUPER_MAGIC XFS_SUPER_MAGIC _SC_2_C_VERSION diff --git a/libc-test/semver/linux-musl.txt b/libc-test/semver/linux-musl.txt index 09c461350f9a5..09a63c7294a76 100644 --- a/libc-test/semver/linux-musl.txt +++ b/libc-test/semver/linux-musl.txt @@ -23,6 +23,30 @@ PF_XDP PIDFD_NONBLOCK PR_SET_VMA PR_SET_VMA_ANON_NAME +SOL_XDP +XDP_SHARED_UMEM +XDP_COPY +XDP_ZEROCOPY +XDP_USE_NEED_WAKEUP +XDP_USE_SG +XDP_UMEM_UNALIGNED_CHUNK_FLAG +XDP_RING_NEED_WAKEUP +XDP_MMAP_OFFSETS +XDP_RX_RING +XDP_TX_RING +XDP_UMEM_REG +XDP_UMEM_FILL_RING +XDP_UMEM_COMPLETION_RING +XDP_STATISTICS +XDP_OPTIONS +XDP_OPTIONS_ZEROCOPY +XDP_PGOFF_RX_RING +XDP_PGOFF_TX_RING +XDP_UMEM_PGOFF_FILL_RING +XDP_UMEM_PGOFF_COMPLETION_RING +XSK_UNALIGNED_BUF_OFFSET_SHIFT +XSK_UNALIGNED_BUF_ADDR_MASK +XDP_PKT_CONTD adjtimex aio_cancel aio_error diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 007692c9d4dbc..37aab57f23ee3 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -794,6 +794,14 @@ FIONCLEX FIONREAD FLUSHO FOPEN_MAX +FS_IOC_GETFLAGS +FS_IOC_SETFLAGS +FS_IOC_GETVERSION +FS_IOC_SETVERSION +FS_IOC32_GETFLAGS +FS_IOC32_SETFLAGS +FS_IOC32_GETVERSION +FS_IOC32_SETVERSION FUTEX_BITSET_MATCH_ANY FUTEX_CLOCK_REALTIME FUTEX_CMD_MASK @@ -932,6 +940,7 @@ IFF_LOWER_UP IFF_MASTER IFF_MULTICAST IFF_MULTI_QUEUE +IFF_NO_CARRIER IFF_NOARP IFF_NOFILTER TUN_TX_TIMESTAMP @@ -940,6 +949,8 @@ TUN_F_TSO4 TUN_F_TSO6 TUN_F_TSO_ECN TUN_F_UFO +TUN_F_USO4 +TUN_F_USO6 TUN_PKT_STRIP TUN_FLT_ALLMULTI IFF_NOTRAILERS @@ -1975,6 +1986,8 @@ PTHREAD_PRIO_INHERIT PTHREAD_PRIO_PROTECT PTHREAD_PROCESS_PRIVATE PTHREAD_PROCESS_SHARED +PTHREAD_INHERIT_SCHED +PTHREAD_EXPLICIT_SCHED PTHREAD_STACK_MIN PTHREAD_ONCE_INIT PTRACE_ATTACH @@ -2470,6 +2483,237 @@ SIOCSMIIREG SIOCSRARP SIOCOUTQNSD SIOCWANDEV +WIRELESS_EXT +SIOCSIWCOMMIT +SIOCGIWNAME +SIOCSIWNWID +SIOCGIWNWID +SIOCSIWFREQ +SIOCGIWFREQ +SIOCSIWMODE +SIOCGIWMODE +SIOCSIWSENS +SIOCGIWSENS +SIOCSIWRANGE +SIOCGIWRANGE +SIOCSIWPRIV +SIOCGIWPRIV +SIOCSIWSTATS +SIOCGIWSTATS +SIOCSIWSPY +SIOCGIWSPY +SIOCSIWTHRSPY +SIOCGIWTHRSPY +SIOCSIWAP +SIOCGIWAP +SIOCGIWAPLIST +SIOCSIWSCAN +SIOCGIWSCAN +SIOCSIWESSID +SIOCGIWESSID +SIOCSIWNICKN +SIOCGIWNICKN +SIOCSIWRATE +SIOCGIWRATE +SIOCSIWRTS +SIOCGIWRTS +SIOCSIWFRAG +SIOCGIWFRAG +SIOCSIWTXPOW +SIOCGIWTXPOW +SIOCSIWRETRY +SIOCGIWRETRY +SIOCSIWENCODE +SIOCGIWENCODE +SIOCSIWPOWER +SIOCGIWPOWER +SIOCSIWGENIE +SIOCGIWGENIE +SIOCSIWMLME +SIOCSIWAUTH +SIOCGIWAUTH +SIOCSIWENCODEEXT +SIOCGIWENCODEEXT +SIOCSIWPMKSA +SIOCIWFIRSTPRIV +SIOCIWLASTPRIV +SIOCIWFIRST +SIOCIWLAST +IWEVTXDROP +IWEVQUAL +IWEVCUSTOM +IWEVREGISTERED +IWEVEXPIRED +IWEVGENIE +IWEVMICHAELMICFAILURE +IWEVASSOCREQIE +IWEVASSOCRESPIE +IWEVPMKIDCAND +IWEVFIRST +IW_PRIV_TYPE_MASK +IW_PRIV_TYPE_NONE +IW_PRIV_TYPE_BYTE +IW_PRIV_TYPE_CHAR +IW_PRIV_TYPE_INT +IW_PRIV_TYPE_FLOAT +IW_PRIV_TYPE_ADDR +IW_PRIV_SIZE_FIXED +IW_PRIV_SIZE_MASK +IW_MAX_FREQUENCIES +IW_MAX_BITRATES +IW_MAX_TXPOWER +IW_MAX_SPY +IW_MAX_AP +IW_ESSID_MAX_SIZE +IW_MODE_AUTO +IW_MODE_ADHOC +IW_MODE_INFRA +IW_MODE_MASTER +IW_MODE_REPEAT +IW_MODE_SECOND +IW_MODE_MONITOR +IW_MODE_MESH +IW_QUAL_QUAL_UPDATED +IW_QUAL_LEVEL_UPDATED +IW_QUAL_NOISE_UPDATED +IW_QUAL_ALL_UPDATED +IW_QUAL_DBM +IW_QUAL_QUAL_INVALID +IW_QUAL_LEVEL_INVALID +IW_QUAL_NOISE_INVALID +IW_QUAL_RCPI +IW_QUAL_ALL_INVALID +IW_FREQ_AUTO +IW_FREQ_FIXED +IW_MAX_ENCODING_SIZES +IW_ENCODING_TOKEN_MAX +IW_ENCODE_INDEX +IW_ENCODE_FLAGS +IW_ENCODE_MODE +IW_ENCODE_DISABLED +IW_ENCODE_ENABLED +IW_ENCODE_RESTRICTED +IW_ENCODE_OPEN +IW_ENCODE_NOKEY +IW_ENCODE_TEMP +IW_POWER_ON +IW_POWER_TYPE +IW_POWER_PERIOD +IW_POWER_TIMEOUT +IW_POWER_MODE +IW_POWER_UNICAST_R +IW_POWER_MULTICAST_R +IW_POWER_ALL_R +IW_POWER_FORCE_S +IW_POWER_REPEATER +IW_POWER_MODIFIER +IW_POWER_MIN +IW_POWER_MAX +IW_POWER_RELATIVE +IW_TXPOW_TYPE +IW_TXPOW_DBM +IW_TXPOW_MWATT +IW_TXPOW_RELATIVE +IW_TXPOW_RANGE +IW_RETRY_ON +IW_RETRY_TYPE +IW_RETRY_LIMIT +IW_RETRY_LIFETIME +IW_RETRY_MODIFIER +IW_RETRY_MIN +IW_RETRY_MAX +IW_RETRY_RELATIVE +IW_RETRY_SHORT +IW_RETRY_LONG +IW_SCAN_DEFAULT +IW_SCAN_ALL_ESSID +IW_SCAN_THIS_ESSID +IW_SCAN_ALL_FREQ +IW_SCAN_THIS_FREQ +IW_SCAN_ALL_MODE +IW_SCAN_THIS_MODE +IW_SCAN_ALL_RATE +IW_SCAN_THIS_RATE +IW_SCAN_TYPE_ACTIVE +IW_SCAN_TYPE_PASSIVE +IW_SCAN_MAX_DATA +IW_SCAN_CAPA_NONE +IW_SCAN_CAPA_ESSID +IW_SCAN_CAPA_BSSID +IW_SCAN_CAPA_CHANNEL +IW_SCAN_CAPA_MODE +IW_SCAN_CAPA_RATE +IW_SCAN_CAPA_TYPE +IW_SCAN_CAPA_TIME +IW_CUSTOM_MAX +IW_GENERIC_IE_MAX +IW_MLME_DEAUTH +IW_MLME_DISASSOC +IW_MLME_AUTH +IW_MLME_ASSOC +IW_AUTH_INDEX +IW_AUTH_FLAGS +IW_AUTH_WPA_VERSION +IW_AUTH_CIPHER_PAIRWISE +IW_AUTH_CIPHER_GROUP +IW_AUTH_KEY_MGMT +IW_AUTH_TKIP_COUNTERMEASURES +IW_AUTH_DROP_UNENCRYPTED +IW_AUTH_80211_AUTH_ALG +IW_AUTH_WPA_ENABLED +IW_AUTH_RX_UNENCRYPTED_EAPOL +IW_AUTH_ROAMING_CONTROL +IW_AUTH_PRIVACY_INVOKED +IW_AUTH_CIPHER_GROUP_MGMT +IW_AUTH_MFP +IW_AUTH_WPA_VERSION_DISABLED +IW_AUTH_WPA_VERSION_WPA +IW_AUTH_WPA_VERSION_WPA2 +IW_AUTH_CIPHER_NONE +IW_AUTH_CIPHER_WEP40 +IW_AUTH_CIPHER_TKIP +IW_AUTH_CIPHER_CCMP +IW_AUTH_CIPHER_WEP104 +IW_AUTH_CIPHER_AES_CMAC +IW_AUTH_KEY_MGMT_802_1X +IW_AUTH_KEY_MGMT_PSK +IW_AUTH_ALG_OPEN_SYSTEM +IW_AUTH_ALG_SHARED_KEY +IW_AUTH_ALG_LEAP +IW_AUTH_ROAMING_ENABLE +IW_AUTH_ROAMING_DISABLE +IW_AUTH_MFP_DISABLED +IW_AUTH_MFP_OPTIONAL +IW_AUTH_MFP_REQUIRED +IW_ENCODE_SEQ_MAX_SIZE +IW_ENCODE_ALG_NONE +IW_ENCODE_ALG_WEP +IW_ENCODE_ALG_TKIP +IW_ENCODE_ALG_CCMP +IW_ENCODE_ALG_PMK +IW_ENCODE_ALG_AES_CMAC +IW_ENCODE_EXT_TX_SEQ_VALID +IW_ENCODE_EXT_RX_SEQ_VALID +IW_ENCODE_EXT_GROUP_KEY +IW_ENCODE_EXT_SET_TX_KEY +IW_MICFAILURE_KEY_ID +IW_MICFAILURE_GROUP +IW_MICFAILURE_PAIRWISE +IW_MICFAILURE_STAKEY +IW_MICFAILURE_COUNT +IW_ENC_CAPA_WPA +IW_ENC_CAPA_WPA2 +IW_ENC_CAPA_CIPHER_TKIP +IW_ENC_CAPA_CIPHER_CCMP +IW_ENC_CAPA_4WAY_HANDSHAKE +IW_PMKSA_ADD +IW_PMKSA_REMOVE +IW_PMKSA_FLUSH +IW_PMKID_LEN +IW_PMKID_CAND_PREAUTH +IW_EV_CHAR_PK_LEN +IW_EV_LCP_PK_LEN +IW_EV_POINT_PK_LEN SI_LOAD_SHIFT SND_CNT SND_MAX @@ -2907,7 +3151,34 @@ TIOCSCTTY TIOCSPGRP TIOCSSOFTCAR TIOCSTI +TLS_1_2_VERSION +TLS_1_2_VERSION_MAJOR +TLS_1_2_VERSION_MINOR +TLS_1_3_VERSION +TLS_1_3_VERSION_MAJOR +TLS_1_3_VERSION_MINOR +TLS_CIPHER_AES_GCM_128 +TLS_CIPHER_AES_GCM_128_IV_SIZE +TLS_CIPHER_AES_GCM_128_KEY_SIZE +TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE +TLS_CIPHER_AES_GCM_128_SALT_SIZE +TLS_CIPHER_AES_GCM_128_TAG_SIZE +TLS_CIPHER_AES_GCM_256 +TLS_CIPHER_AES_GCM_256_IV_SIZE +TLS_CIPHER_AES_GCM_256_KEY_SIZE +TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE +TLS_CIPHER_AES_GCM_256_SALT_SIZE +TLS_CIPHER_AES_GCM_256_TAG_SIZE +TLS_CIPHER_CHACHA20_POLY1305 +TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE +TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE +TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE +TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE +TLS_CIPHER_CHACHA20_POLY1305_TAG_SIZE TLS_GET_RECORD_TYPE +TLS_RX +TLS_SET_RECORD_TYPE +TLS_TX TUN_READQ_SIZE TUN_TAP_DEV TUN_TUN_DEV @@ -3386,6 +3657,12 @@ priority_t pread64 preadv pthread_attr_getguardsize +pthread_attr_getinheritsched +pthread_attr_setinheritsched +pthread_attr_getschedpolicy +pthread_attr_setschedpolicy +pthread_attr_getschedparam +pthread_attr_setschedparam pthread_attr_getstack pthread_attr_setguardsize pthread_cancel @@ -3581,3 +3858,5 @@ vhangup vmsplice wait4 waitid +eventfd_read +eventfd_write diff --git a/libc-test/semver/netbsd-aarch64.txt b/libc-test/semver/netbsd-aarch64.txt index e48c529a96c72..e1cdec5d0af24 100644 --- a/libc-test/semver/netbsd-aarch64.txt +++ b/libc-test/semver/netbsd-aarch64.txt @@ -1,3 +1,60 @@ +_REG_CPSR +_REG_ELR +_REG_FP +_REG_LR +_REG_PC +_REG_R0 +_REG_R1 +_REG_R10 +_REG_R11 +_REG_R12 +_REG_R13 +_REG_R14 +_REG_R15 +_REG_R2 +_REG_R3 +_REG_R4 +_REG_R5 +_REG_R6 +_REG_R7 +_REG_R8 +_REG_R9 +_REG_RV +_REG_SP +_REG_SPSR +_REG_TIPDR +_REG_X0 +_REG_X1 +_REG_X2 +_REG_X3 +_REG_X4 +_REG_X5 +_REG_X6 +_REG_X7 +_REG_X8 +_REG_X9 +_REG_X10 +_REG_X11 +_REG_X12 +_REG_X13 +_REG_X14 +_REG_X15 +_REG_X16 +_REG_X17 +_REG_X18 +_REG_X19 +_REG_X20 +_REG_X21 +_REG_X22 +_REG_X23 +_REG_X24 +_REG_X25 +_REG_X26 +_REG_X27 +_REG_X28 +_REG_X29 +_REG_X30 +_REG_X31 PT_GETFPREGS PT_GETREGS PT_SETFPREGS diff --git a/libc-test/semver/netbsd-x86_64.txt b/libc-test/semver/netbsd-x86_64.txt index 573099c8bb69b..0931370eeaecd 100644 --- a/libc-test/semver/netbsd-x86_64.txt +++ b/libc-test/semver/netbsd-x86_64.txt @@ -1,4 +1,28 @@ Aux64Info +_REG_DS +_REG_ERR +_REG_ES +_REG_FS +_REG_GS +_REG_R10 +_REG_R11 +_REG_R12 +_REG_R13 +_REG_R14 +_REG_R15 +_REG_R8 +_REG_R9 +_REG_RAX +_REG_RBP +_REG_RBX +_REG_RCX +_REG_RDI +_REG_RFLAGS +_REG_RIP +_REG_RSI +_REG_RSP +_REG_SS +_REG_TRAPNO PT_GETFPREGS PT_GETREGS PT_SETFPREGS diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt index a548a2d77d057..145f02b441cf1 100644 --- a/libc-test/semver/netbsd.txt +++ b/libc-test/semver/netbsd.txt @@ -643,6 +643,7 @@ MAP_NORESERVE MAP_REMAPDUP MAP_RENAME MAP_STACK +MAP_TRYFIXED MAP_WIRED MAXFREQ MAXPHASE @@ -863,6 +864,19 @@ Q_SETQUOTA Q_SYNC RADIXCHAR RAND_MAX +RB_ASKNAME +RB_AUTOBOOT +RB_DUMP +RB_HALT +RB_INITNAME +RB_KDB +RB_MINIROOT +RB_NOSYNC +RB_POWERDOWN +RB_RDONLY +RB_SINGLE +RB_STRING +RB_USERCONF REG_ASSERT REG_ATOI REG_BACKR @@ -1466,6 +1480,7 @@ readdir_r readlinkat reallocarr reallocarray +reboot recvmmsg recvmsg regcomp diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt index 0b11c5fdbbc7e..5b0064f72e65b 100644 --- a/libc-test/semver/openbsd.txt +++ b/libc-test/semver/openbsd.txt @@ -486,6 +486,7 @@ MAP_NOEXTEND MAP_NORESERVE MAP_RENAME MAP_STACK +MAP_TRYFIXED MCL_CURRENT MCL_FUTURE MDMBUF @@ -704,6 +705,20 @@ Q_SETQUOTA Q_SYNC RADIXCHAR RAND_MAX +RB_ASKNAME +RB_AUTOBOOT +RB_CONFIG +RB_DUMP +RB_GOODRANDOM +RB_HALT +RB_KDB +RB_INITNAME +RB_POWERDOWN +RB_RESET +RB_SERCONS +RB_TIMEBAD +RB_UNHIBERNATE +RB_USERREQ REG_ASSERT REG_ATOI REG_BACKR @@ -1174,6 +1189,7 @@ rand readdir_r readlinkat reallocarray +reboot recvmsg regcomp regerror diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index bf1a543609406..25124e6e0fcf8 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -3233,6 +3233,9 @@ pub const O_DIRECT: ::c_int = 0x00000800; pub const O_LARGEFILE: ::c_int = 0x00001000; pub const O_NOFOLLOW: ::c_int = 0x00000080; +pub const HUGETLB_FLAG_ENCODE_SHIFT: u32 = 26; +pub const MAP_HUGE_SHIFT: u32 = 26; + // intentionally not public, only used for fd_set cfg_if! { if #[cfg(target_pointer_width = "32")] { @@ -4104,7 +4107,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; pub fn reboot(how_to: ::c_int) -> ::c_int; diff --git a/src/macros.rs b/src/macros.rs index fd473702f72bd..beb80024dbfa3 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -120,6 +120,12 @@ macro_rules! s_no_extra_traits { ); } +macro_rules! missing { + ($($(#[$attr:meta])* pub enum $i:ident {})*) => ($( + $(#[$attr])* #[allow(missing_copy_implementations)] pub enum $i { } + )*); +} + macro_rules! e { ($($(#[$attr:meta])* pub enum $i:ident { $($field:tt)* })*) => ($( __item! { diff --git a/src/teeos/mod.rs b/src/teeos/mod.rs index cffe041976573..066f81ca55e4c 100644 --- a/src/teeos/mod.rs +++ b/src/teeos/mod.rs @@ -1106,6 +1106,12 @@ extern "C" { pub fn pthread_cond_wait(cond: *mut pthread_cond_t, lock: *mut pthread_mutex_t) -> c_int; + pub fn pthread_cond_timedwait( + cond: *mut pthread_cond_t, + lock: *mut pthread_mutex_t, + abstime: *const ::timespec, + ) -> ::c_int; + pub fn pthread_mutexattr_setrobust(attr: *mut pthread_mutexattr_t, robustness: c_int) -> c_int; pub fn pthread_create( diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index 0d7c2ed1d1b65..0fc923d6072f0 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -2889,7 +2889,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::size_t, serv: *mut ::c_char, - sevlen: ::size_t, + servlen: ::size_t, flags: ::c_int, ) -> ::c_int; pub fn getpagesize() -> ::c_int; diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 21efb23eb2e32..c7169a2274769 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -4075,6 +4075,7 @@ pub const IP_RECVDSTADDR: ::c_int = 7; pub const IP_ADD_MEMBERSHIP: ::c_int = 12; pub const IP_DROP_MEMBERSHIP: ::c_int = 13; pub const IP_RECVIF: ::c_int = 20; +pub const IP_RECVTTL: ::c_int = 24; pub const IP_BOUND_IF: ::c_int = 25; pub const IP_PKTINFO: ::c_int = 26; pub const IP_RECVTOS: ::c_int = 27; @@ -4084,6 +4085,7 @@ pub const IPV6_LEAVE_GROUP: ::c_int = 13; pub const IPV6_CHECKSUM: ::c_int = 26; pub const IPV6_RECVTCLASS: ::c_int = 35; pub const IPV6_TCLASS: ::c_int = 36; +pub const IPV6_RECVHOPLIMIT: ::c_int = 37; pub const IPV6_PKTINFO: ::c_int = 46; pub const IPV6_HOPLIMIT: ::c_int = 47; pub const IPV6_RECVPKTINFO: ::c_int = 61; @@ -5622,7 +5624,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; pub fn mincore(addr: *const ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int; @@ -6260,6 +6262,7 @@ extern "C" { pub fn sethostid(hostid: ::c_long); pub fn CCRandomGenerateBytes(bytes: *mut ::c_void, size: ::size_t) -> ::CCRNGStatus; + pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; pub fn _NSGetExecutablePath(buf: *mut ::c_char, bufsize: *mut u32) -> ::c_int; pub fn _NSGetEnviron() -> *mut *mut *mut ::c_char; @@ -6278,6 +6281,13 @@ extern "C" { inheritance: ::vm_inherit_t, ) -> ::kern_return_t; + pub fn vm_allocate( + target_task: vm_map_t, + address: *mut vm_address_t, + size: vm_size_t, + flags: ::c_int, + ) -> ::kern_return_t; + pub fn vm_deallocate( target_task: vm_map_t, address: vm_address_t, diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index c654ae42ef44a..799e3811ed44c 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -48,6 +48,8 @@ pub type cpusetid_t = ::c_int; pub type sctp_assoc_t = u32; +pub type eventfd_t = u64; + #[cfg_attr(feature = "extra_traits", derive(Debug, Hash, PartialEq, Eq))] #[repr(u32)] pub enum devstat_support_flags { @@ -3889,6 +3891,7 @@ pub const RFMEM: ::c_int = 32; pub const RFNOWAIT: ::c_int = 64; pub const RFCFDG: ::c_int = 4096; pub const RFTHREAD: ::c_int = 8192; +pub const RFSIGSHARE: ::c_int = 16384; pub const RFLINUXTHPN: ::c_int = 65536; pub const RFTSIGZMB: ::c_int = 524288; pub const RFSPAWN: ::c_int = 2147483648; @@ -5383,6 +5386,8 @@ extern "C" { pub fn setaudit(auditinfo: *const auditinfo_t) -> ::c_int; pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; + pub fn eventfd_read(fd: ::c_int, value: *mut eventfd_t) -> ::c_int; + pub fn eventfd_write(fd: ::c_int, value: eventfd_t) -> ::c_int; pub fn fdatasync(fd: ::c_int) -> ::c_int; diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index a787ac6db8553..07dc39be54e36 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -646,6 +646,10 @@ pub const TIOCM_RI: ::c_int = TIOCM_RNG; pub const TIMER_ABSTIME: ::c_int = 1; +// sys/reboot.h + +pub const RB_AUTOBOOT: ::c_int = 0; + #[link(name = "util")] extern "C" { pub fn setgrent(); diff --git a/src/unix/bsd/netbsdlike/netbsd/aarch64.rs b/src/unix/bsd/netbsdlike/netbsd/aarch64.rs index 7b895f63238d0..45bca4778c20c 100644 --- a/src/unix/bsd/netbsdlike/netbsd/aarch64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/aarch64.rs @@ -101,3 +101,62 @@ pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 0; pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 1; pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 2; pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 3; + +pub const _REG_R0: ::c_int = 0; +pub const _REG_R1: ::c_int = 1; +pub const _REG_R2: ::c_int = 2; +pub const _REG_R3: ::c_int = 3; +pub const _REG_R4: ::c_int = 4; +pub const _REG_R5: ::c_int = 5; +pub const _REG_R6: ::c_int = 6; +pub const _REG_R7: ::c_int = 7; +pub const _REG_R8: ::c_int = 8; +pub const _REG_R9: ::c_int = 9; +pub const _REG_R10: ::c_int = 10; +pub const _REG_R11: ::c_int = 11; +pub const _REG_R12: ::c_int = 12; +pub const _REG_R13: ::c_int = 13; +pub const _REG_R14: ::c_int = 14; +pub const _REG_R15: ::c_int = 15; +pub const _REG_CPSR: ::c_int = 16; +pub const _REG_X0: ::c_int = 0; +pub const _REG_X1: ::c_int = 1; +pub const _REG_X2: ::c_int = 2; +pub const _REG_X3: ::c_int = 3; +pub const _REG_X4: ::c_int = 4; +pub const _REG_X5: ::c_int = 5; +pub const _REG_X6: ::c_int = 6; +pub const _REG_X7: ::c_int = 7; +pub const _REG_X8: ::c_int = 8; +pub const _REG_X9: ::c_int = 9; +pub const _REG_X10: ::c_int = 10; +pub const _REG_X11: ::c_int = 11; +pub const _REG_X12: ::c_int = 12; +pub const _REG_X13: ::c_int = 13; +pub const _REG_X14: ::c_int = 14; +pub const _REG_X15: ::c_int = 15; +pub const _REG_X16: ::c_int = 16; +pub const _REG_X17: ::c_int = 17; +pub const _REG_X18: ::c_int = 18; +pub const _REG_X19: ::c_int = 19; +pub const _REG_X20: ::c_int = 20; +pub const _REG_X21: ::c_int = 21; +pub const _REG_X22: ::c_int = 22; +pub const _REG_X23: ::c_int = 23; +pub const _REG_X24: ::c_int = 24; +pub const _REG_X25: ::c_int = 25; +pub const _REG_X26: ::c_int = 26; +pub const _REG_X27: ::c_int = 27; +pub const _REG_X28: ::c_int = 28; +pub const _REG_X29: ::c_int = 29; +pub const _REG_X30: ::c_int = 30; +pub const _REG_X31: ::c_int = 31; +pub const _REG_ELR: ::c_int = 32; +pub const _REG_SPSR: ::c_int = 33; +pub const _REG_TIPDR: ::c_int = 34; + +pub const _REG_RV: ::c_int = _REG_X0; +pub const _REG_FP: ::c_int = _REG_X29; +pub const _REG_LR: ::c_int = _REG_X30; +pub const _REG_SP: ::c_int = _REG_X31; +pub const _REG_PC: ::c_int = _REG_ELR; diff --git a/src/unix/bsd/netbsdlike/netbsd/arm.rs b/src/unix/bsd/netbsdlike/netbsd/arm.rs index 4bf3ccd02b2c4..b5000d34d66fb 100644 --- a/src/unix/bsd/netbsdlike/netbsd/arm.rs +++ b/src/unix/bsd/netbsdlike/netbsd/arm.rs @@ -20,3 +20,62 @@ pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2; pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3; pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4; + +pub const _REG_R0: ::c_int = 0; +pub const _REG_R1: ::c_int = 1; +pub const _REG_R2: ::c_int = 2; +pub const _REG_R3: ::c_int = 3; +pub const _REG_R4: ::c_int = 4; +pub const _REG_R5: ::c_int = 5; +pub const _REG_R6: ::c_int = 6; +pub const _REG_R7: ::c_int = 7; +pub const _REG_R8: ::c_int = 8; +pub const _REG_R9: ::c_int = 9; +pub const _REG_R10: ::c_int = 10; +pub const _REG_R11: ::c_int = 11; +pub const _REG_R12: ::c_int = 12; +pub const _REG_R13: ::c_int = 13; +pub const _REG_R14: ::c_int = 14; +pub const _REG_R15: ::c_int = 15; +pub const _REG_CPSR: ::c_int = 16; +pub const _REG_X0: ::c_int = 0; +pub const _REG_X1: ::c_int = 1; +pub const _REG_X2: ::c_int = 2; +pub const _REG_X3: ::c_int = 3; +pub const _REG_X4: ::c_int = 4; +pub const _REG_X5: ::c_int = 5; +pub const _REG_X6: ::c_int = 6; +pub const _REG_X7: ::c_int = 7; +pub const _REG_X8: ::c_int = 8; +pub const _REG_X9: ::c_int = 9; +pub const _REG_X10: ::c_int = 10; +pub const _REG_X11: ::c_int = 11; +pub const _REG_X12: ::c_int = 12; +pub const _REG_X13: ::c_int = 13; +pub const _REG_X14: ::c_int = 14; +pub const _REG_X15: ::c_int = 15; +pub const _REG_X16: ::c_int = 16; +pub const _REG_X17: ::c_int = 17; +pub const _REG_X18: ::c_int = 18; +pub const _REG_X19: ::c_int = 19; +pub const _REG_X20: ::c_int = 20; +pub const _REG_X21: ::c_int = 21; +pub const _REG_X22: ::c_int = 22; +pub const _REG_X23: ::c_int = 23; +pub const _REG_X24: ::c_int = 24; +pub const _REG_X25: ::c_int = 25; +pub const _REG_X26: ::c_int = 26; +pub const _REG_X27: ::c_int = 27; +pub const _REG_X28: ::c_int = 28; +pub const _REG_X29: ::c_int = 29; +pub const _REG_X30: ::c_int = 30; +pub const _REG_X31: ::c_int = 31; +pub const _REG_ELR: ::c_int = 32; +pub const _REG_SPSR: ::c_int = 33; +pub const _REG_TIPDR: ::c_int = 34; + +pub const _REG_RV: ::c_int = _REG_R0; +pub const _REG_FP: ::c_int = _REG_R11; +pub const _REG_LR: ::c_int = _REG_R13; +pub const _REG_SP: ::c_int = _REG_R14; +pub const _REG_PC: ::c_int = _REG_R15; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index c612689a53f06..43b17e1a7ecf9 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -1701,6 +1701,7 @@ pub const O_DSYNC: ::c_int = 0x10000; pub const MAP_RENAME: ::c_int = 0x20; pub const MAP_NORESERVE: ::c_int = 0x40; pub const MAP_HASSEMAPHORE: ::c_int = 0x200; +pub const MAP_TRYFIXED: ::c_int = 0x400; pub const MAP_WIRED: ::c_int = 0x800; pub const MAP_STACK: ::c_int = 0x2000; // map alignment aliases for MAP_ALIGNED @@ -2396,33 +2397,6 @@ pub const LSZOMB: ::c_int = 5; pub const LSONPROC: ::c_int = 7; pub const LSSUSPENDED: ::c_int = 8; -pub const _REG_RDI: ::c_int = 0; -pub const _REG_RSI: ::c_int = 1; -pub const _REG_RDX: ::c_int = 2; -pub const _REG_RCX: ::c_int = 3; -pub const _REG_R8: ::c_int = 4; -pub const _REG_R9: ::c_int = 5; -pub const _REG_R10: ::c_int = 6; -pub const _REG_R11: ::c_int = 7; -pub const _REG_R12: ::c_int = 8; -pub const _REG_R13: ::c_int = 9; -pub const _REG_R14: ::c_int = 10; -pub const _REG_R15: ::c_int = 11; -pub const _REG_RBP: ::c_int = 12; -pub const _REG_RBX: ::c_int = 13; -pub const _REG_RAX: ::c_int = 14; -pub const _REG_GS: ::c_int = 15; -pub const _REG_FS: ::c_int = 16; -pub const _REG_ES: ::c_int = 17; -pub const _REG_DS: ::c_int = 18; -pub const _REG_TRAPNO: ::c_int = 19; -pub const _REG_ERR: ::c_int = 20; -pub const _REG_RIP: ::c_int = 21; -pub const _REG_CS: ::c_int = 22; -pub const _REG_RFLAGS: ::c_int = 23; -pub const _REG_RSP: ::c_int = 24; -pub const _REG_SS: ::c_int = 25; - // sys/xattr.h pub const XATTR_CREATE: ::c_int = 0x01; pub const XATTR_REPLACE: ::c_int = 0x02; @@ -2434,6 +2408,20 @@ pub const GRND_NONBLOCK: ::c_uint = 0x1; pub const GRND_RANDOM: ::c_uint = 0x2; pub const GRND_INSECURE: ::c_uint = 0x4; +// sys/reboot.h +pub const RB_ASKNAME: ::c_int = 0x000000001; +pub const RB_SINGLE: ::c_int = 0x000000002; +pub const RB_NOSYNC: ::c_int = 0x000000004; +pub const RB_HALT: ::c_int = 0x000000008; +pub const RB_INITNAME: ::c_int = 0x000000010; +pub const RB_KDB: ::c_int = 0x000000040; +pub const RB_RDONLY: ::c_int = 0x000000080; +pub const RB_DUMP: ::c_int = 0x000000100; +pub const RB_MINIROOT: ::c_int = 0x000000200; +pub const RB_STRING: ::c_int = 0x000000400; +pub const RB_POWERDOWN: ::c_int = RB_HALT | 0x000000800; +pub const RB_USERCONF: ::c_int = 0x000001000; + cfg_if! { if #[cfg(libc_const_extern_fn)] { @@ -2674,7 +2662,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int; @@ -2984,6 +2972,8 @@ extern "C" { newfd: ::c_int, ) -> ::c_int; pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; + + pub fn reboot(mode: ::c_int, bootstr: *mut ::c_char) -> ::c_int; } #[link(name = "rt")] diff --git a/src/unix/bsd/netbsdlike/netbsd/x86_64.rs b/src/unix/bsd/netbsdlike/netbsd/x86_64.rs index 2f6e4454577a0..ba259074f6129 100644 --- a/src/unix/bsd/netbsdlike/netbsd/x86_64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/x86_64.rs @@ -38,3 +38,30 @@ pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1; pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2; pub const PT_GETFPREGS: ::c_int = PT_FIRSTMACH + 3; pub const PT_SETFPREGS: ::c_int = PT_FIRSTMACH + 4; + +pub const _REG_RDI: ::c_int = 0; +pub const _REG_RSI: ::c_int = 1; +pub const _REG_RDX: ::c_int = 2; +pub const _REG_RCX: ::c_int = 3; +pub const _REG_R8: ::c_int = 4; +pub const _REG_R9: ::c_int = 5; +pub const _REG_R10: ::c_int = 6; +pub const _REG_R11: ::c_int = 7; +pub const _REG_R12: ::c_int = 8; +pub const _REG_R13: ::c_int = 9; +pub const _REG_R14: ::c_int = 10; +pub const _REG_R15: ::c_int = 11; +pub const _REG_RBP: ::c_int = 12; +pub const _REG_RBX: ::c_int = 13; +pub const _REG_RAX: ::c_int = 14; +pub const _REG_GS: ::c_int = 15; +pub const _REG_FS: ::c_int = 16; +pub const _REG_ES: ::c_int = 17; +pub const _REG_DS: ::c_int = 18; +pub const _REG_TRAPNO: ::c_int = 19; +pub const _REG_ERR: ::c_int = 20; +pub const _REG_RIP: ::c_int = 21; +pub const _REG_CS: ::c_int = 22; +pub const _REG_RFLAGS: ::c_int = 23; +pub const _REG_RSP: ::c_int = 24; +pub const _REG_SS: ::c_int = 25; diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index ea90ba780f3c5..08c816566166c 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -659,7 +659,7 @@ s_no_extra_traits! { pub ifru_metric: ::c_int, pub ifru_vnetid: i64, pub ifru_media: u64, - pub ifru_data: *mut ::c_char, + pub ifru_data: ::caddr_t, pub ifru_index: ::c_uint, } } @@ -1229,6 +1229,7 @@ pub const O_DSYNC: ::c_int = 128; pub const MAP_RENAME: ::c_int = 0x0000; pub const MAP_NORESERVE: ::c_int = 0x0000; pub const MAP_HASSEMAPHORE: ::c_int = 0x0000; +pub const MAP_TRYFIXED: ::c_int = 0; pub const EIPSEC: ::c_int = 82; pub const ENOMEDIUM: ::c_int = 85; @@ -1830,6 +1831,25 @@ pub const LC_ALL_MASK: ::c_int = (1 << _LC_LAST) - 2; pub const LC_GLOBAL_LOCALE: ::locale_t = -1isize as ::locale_t; +// sys/reboot.h +pub const RB_ASKNAME: ::c_int = 0x00001; +pub const RB_SINGLE: ::c_int = 0x00002; +pub const RB_NOSYNC: ::c_int = 0x00004; +pub const RB_HALT: ::c_int = 0x00008; +pub const RB_INITNAME: ::c_int = 0x00010; +pub const RB_KDB: ::c_int = 0x00040; +pub const RB_RDONLY: ::c_int = 0x00080; +pub const RB_DUMP: ::c_int = 0x00100; +pub const RB_MINIROOT: ::c_int = 0x00200; +pub const RB_CONFIG: ::c_int = 0x00400; +pub const RB_TIMEBAD: ::c_int = 0x00800; +pub const RB_POWERDOWN: ::c_int = 0x01000; +pub const RB_SERCONS: ::c_int = 0x02000; +pub const RB_USERREQ: ::c_int = 0x04000; +pub const RB_RESET: ::c_int = 0x08000; +pub const RB_GOODRANDOM: ::c_int = 0x10000; +pub const RB_UNHIBERNATE: ::c_int = 0x20000; + const_fn! { {const} fn _ALIGN(p: usize) -> usize { (p + _ALIGNBYTES) & !_ALIGNBYTES @@ -2057,6 +2077,8 @@ extern "C" { ) -> ::c_int; pub fn mimmutable(addr: *mut ::c_void, len: ::size_t) -> ::c_int; + + pub fn reboot(mode: ::c_int) -> ::c_int; } #[link(name = "execinfo")] diff --git a/src/unix/bsd/netbsdlike/openbsd/riscv64.rs b/src/unix/bsd/netbsdlike/openbsd/riscv64.rs index 99350ec8dc3d4..35f1672bbec9e 100644 --- a/src/unix/bsd/netbsdlike/openbsd/riscv64.rs +++ b/src/unix/bsd/netbsdlike/openbsd/riscv64.rs @@ -1,6 +1,25 @@ pub type c_long = i64; pub type c_ulong = u64; pub type c_char = u8; +pub type ucontext_t = sigcontext; + +s! { + pub struct sigcontext { + __sc_unused: ::c_int, + pub sc_mask: ::c_int, + pub sc_ra: ::c_long, + pub sc_sp: ::c_long, + pub sc_gp: ::c_long, + pub sc_tp: ::c_long, + pub sc_t: [::c_long; 7], + pub sc_s: [::c_long; 12], + pub sc_a: [::c_long; 8], + pub sc_sepc: ::c_long, + pub sc_f: [::c_long; 32], + pub sc_fcsr: ::c_long, + pub sc_cookie: ::c_long, + } +} // should be pub(crate), but that requires Rust 1.18.0 cfg_if! { diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index 00e9523c9865a..a7d1719983c8f 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -865,7 +865,7 @@ pub const LC_NUMERIC: ::c_int = 4; pub const LC_TIME: ::c_int = 5; pub const LC_MESSAGES: ::c_int = 6; -// FIXME: Haiku does not have MAP_FILE, but libstd/os.rs requires it +// FIXME: Haiku does not have MAP_FILE, but library/std/os.rs requires it pub const MAP_FILE: ::c_int = 0x00; pub const MAP_SHARED: ::c_int = 0x01; pub const MAP_PRIVATE: ::c_int = 0x02; @@ -1708,7 +1708,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; pub fn pthread_mutex_timedlock( diff --git a/src/unix/haiku/native.rs b/src/unix/haiku/native.rs index 44bcc1e3b75f4..62d6392fabdf5 100644 --- a/src/unix/haiku/native.rs +++ b/src/unix/haiku/native.rs @@ -197,6 +197,50 @@ e! { B_UTILITIES_DIRECTORY, B_PACKAGE_LINKS_DIRECTORY, } + + // kernel/OS.h + + pub enum topology_level_type { + B_TOPOLOGY_UNKNOWN, + B_TOPOLOGY_ROOT, + B_TOPOLOGY_SMT, + B_TOPOLOGY_CORE, + B_TOPOLOGY_PACKAGE, + } + + pub enum cpu_platform { + B_CPU_UNKNOWN, + B_CPU_x86, + B_CPU_x86_64, + B_CPU_PPC, + B_CPU_PPC_64, + B_CPU_M68K, + B_CPU_ARM, + B_CPU_ARM_64, + B_CPU_ALPHA, + B_CPU_MIPS, + B_CPU_SH, + B_CPU_SPARC, + B_CPU_RISC_V + } + + pub enum cpu_vendor { + B_CPU_VENDOR_UNKNOWN, + B_CPU_VENDOR_AMD, + B_CPU_VENDOR_CYRIX, + B_CPU_VENDOR_IDT, + B_CPU_VENDOR_INTEL, + B_CPU_VENDOR_NATIONAL_SEMICONDUCTOR, + B_CPU_VENDOR_RISE, + B_CPU_VENDOR_TRANSMETA, + B_CPU_VENDOR_VIA, + B_CPU_VENDOR_IBM, + B_CPU_VENDOR_MOTOROLA, + B_CPU_VENDOR_NEC, + B_CPU_VENDOR_HYGON, + B_CPU_VENDOR_SUN, + B_CPU_VENDOR_FUJITSU + } } s! { @@ -310,6 +354,19 @@ s! { pub events: u16 } + pub struct cpu_topology_root_info { + pub platform: cpu_platform, + } + + pub struct cpu_topology_package_info { + pub vendor: cpu_vendor, + pub cache_line_size: u32, + } + + pub struct cpu_topology_core_info { + pub model: u32, + pub default_frequency: u64, + } // kernel/fs_attr.h pub struct attr_info { pub type_: u32, @@ -412,6 +469,23 @@ s_no_extra_traits! { pub as_chars: [::c_char; 16], pub regs: __c_anonymous_regs, } + + #[cfg(libc_union)] + pub union __c_anonymous_cpu_topology_info_data { + pub root: cpu_topology_root_info, + pub package: cpu_topology_package_info, + pub core: cpu_topology_core_info, + } + + pub struct cpu_topology_node_info { + pub id: u32, + pub type_: topology_level_type, + pub level: u32, + #[cfg(libc_union)] + pub data: __c_anonymous_cpu_topology_info_data, + #[cfg(not(libc_union))] + pub data: cpu_topology_core_info, + } } cfg_if! { @@ -446,6 +520,50 @@ cfg_if! { } } } + + #[cfg(libc_union)] + impl PartialEq for __c_anonymous_cpu_topology_info_data { + fn eq(&self, other: &__c_anonymous_cpu_topology_info_data) -> bool { + unsafe { + self.root == other.root + || self.package == other.package + || self.core == other.core + } + } + } + #[cfg(libc_union)] + impl Eq for __c_anonymous_cpu_topology_info_data {} + #[cfg(libc_union)] + impl ::fmt::Debug for __c_anonymous_cpu_topology_info_data { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + unsafe { + f.debug_struct("__c_anonymous_cpu_topology_info_data") + .field("root", &self.root) + .field("package", &self.package) + .field("core", &self.core) + .finish() + } + } + } + + impl PartialEq for cpu_topology_node_info { + fn eq(&self, other: &cpu_topology_node_info) -> bool { + self.id == other.id + && self.type_ == other.type_ + && self.level == other.level + } + } + + impl Eq for cpu_topology_node_info {} + impl ::fmt::Debug for cpu_topology_node_info { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("cpu_topology_node_info") + .field("id", &self.id) + .field("type", &self.type_) + .field("level", &self.level) + .finish() + } + } } } @@ -1026,6 +1144,10 @@ extern "C" { info: *mut cpu_info, size: ::size_t, ) -> status_t; + pub fn get_cpu_topology_info( + topologyInfos: *mut cpu_topology_node_info, + topologyInfoCount: *mut u32, + ) -> status_t; pub fn is_computer_on() -> i32; pub fn is_computer_on_fire() -> ::c_double; pub fn send_signal(threadID: thread_id, signal: ::c_uint) -> ::c_int; diff --git a/src/unix/hurd/b32.rs b/src/unix/hurd/b32.rs index 7e83ed93000ed..7e82a91d3be03 100644 --- a/src/unix/hurd/b32.rs +++ b/src/unix/hurd/b32.rs @@ -25,6 +25,8 @@ pub type __ulong32_type = ::c_ulong; pub type __s64_type = ::__int64_t; pub type __u64_type = ::__uint64_t; +pub type __ipc_pid_t = ::c_ushort; + pub type Elf32_Half = u16; pub type Elf32_Word = u32; pub type Elf32_Off = u32; diff --git a/src/unix/hurd/b64.rs b/src/unix/hurd/b64.rs index 3b171f1045925..e2e502af2b645 100644 --- a/src/unix/hurd/b64.rs +++ b/src/unix/hurd/b64.rs @@ -25,6 +25,8 @@ pub type __ulong32_type = ::c_uint; pub type __s64_type = ::c_long; pub type __u64_type = ::c_ulong; +pub type __ipc_pid_t = ::c_int; + pub type Elf64_Half = u16; pub type Elf64_Word = u32; pub type Elf64_Off = u64; diff --git a/src/unix/hurd/mod.rs b/src/unix/hurd/mod.rs index 05d75851d9e8f..2701649f6c646 100644 --- a/src/unix/hurd/mod.rs +++ b/src/unix/hurd/mod.rs @@ -164,6 +164,7 @@ pub type pthread_key_t = __pthread_key; pub type pthread_once_t = __pthread_once; pub type __rlimit_resource = ::c_uint; +pub type __rlimit_resource_t = __rlimit_resource; pub type rlim_t = __rlim_t; pub type rlim64_t = __rlim64_t; @@ -215,6 +216,34 @@ pub type tcp_ca_state = ::c_uint; pub type idtype_t = ::c_uint; +pub type mqd_t = ::c_int; + +pub type Lmid_t = ::c_long; + +pub type regoff_t = ::c_int; + +pub type nl_item = ::c_int; + +pub type iconv_t = *mut ::c_void; + +#[cfg_attr(feature = "extra_traits", derive(Debug))] +pub enum fpos64_t {} // FIXME: fill this out with a struct +impl ::Copy for fpos64_t {} +impl ::Clone for fpos64_t { + fn clone(&self) -> fpos64_t { + *self + } +} + +#[cfg_attr(feature = "extra_traits", derive(Debug))] +pub enum timezone {} +impl ::Copy for timezone {} +impl ::Clone for timezone { + fn clone(&self) -> timezone { + *self + } +} + // structs s! { pub struct ip_mreq { @@ -228,6 +257,12 @@ s! { pub imr_ifindex: ::c_int, } + pub struct ip_mreq_source { + pub imr_multiaddr: in_addr, + pub imr_interface: in_addr, + pub imr_sourceaddr: in_addr, + } + pub struct sockaddr { pub sa_len: ::c_uchar, pub sa_family: sa_family_t, @@ -322,6 +357,12 @@ s! { pub msg_flags: ::c_int, } + pub struct cmsghdr { + pub cmsg_len: ::socklen_t, + pub cmsg_level: ::c_int, + pub cmsg_type: ::c_int, + } + pub struct dirent { pub d_ino: __ino_t, pub d_reclen: ::c_ushort, @@ -343,13 +384,39 @@ s! { } 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_cc: [cc_t; 20usize], - pub __ispeed: speed_t, - pub __ospeed: speed_t, + pub c_iflag: ::tcflag_t, + pub c_oflag: ::tcflag_t, + pub c_cflag: ::tcflag_t, + pub c_lflag: ::tcflag_t, + pub c_cc: [::cc_t; 20usize], + pub __ispeed: ::speed_t, + pub __ospeed: ::speed_t, + } + + pub struct mallinfo { + pub arena: ::c_int, + pub ordblks: ::c_int, + pub smblks: ::c_int, + pub hblks: ::c_int, + pub hblkhd: ::c_int, + pub usmblks: ::c_int, + pub fsmblks: ::c_int, + pub uordblks: ::c_int, + pub fordblks: ::c_int, + pub keepcost: ::c_int, + } + + pub struct mallinfo2 { + pub arena: ::size_t, + pub ordblks: ::size_t, + pub smblks: ::size_t, + pub hblks: ::size_t, + pub hblkhd: ::size_t, + pub usmblks: ::size_t, + pub fsmblks: ::size_t, + pub uordblks: ::size_t, + pub fordblks: ::size_t, + pub keepcost: ::size_t, } pub struct sigaction { @@ -389,7 +456,7 @@ s! { pub struct stat { pub st_fstype: ::c_int, - pub st_fsid: __fsid_t, + pub st_dev: __fsid_t, /* Actually st_fsid */ pub st_ino: __ino_t, pub st_gen: ::c_uint, pub st_rdev: __dev_t, @@ -429,6 +496,36 @@ s! { pub st_spare: [::c_int; 8usize], } + pub struct statx { + pub stx_mask: u32, + pub stx_blksize: u32, + pub stx_attributes: u64, + pub stx_nlink: u32, + pub stx_uid: u32, + pub stx_gid: u32, + pub stx_mode: u16, + __statx_pad1: [u16; 1], + pub stx_ino: u64, + pub stx_size: u64, + pub stx_blocks: u64, + pub stx_attributes_mask: u64, + pub stx_atime: ::statx_timestamp, + pub stx_btime: ::statx_timestamp, + pub stx_ctime: ::statx_timestamp, + pub stx_mtime: ::statx_timestamp, + pub stx_rdev_major: u32, + pub stx_rdev_minor: u32, + pub stx_dev_major: u32, + pub stx_dev_minor: u32, + __statx_pad2: [u64; 14], + } + + pub struct statx_timestamp { + pub tv_sec: i64, + pub tv_nsec: u32, + pub __statx_timestamp_pad1: [i32; 1], + } + pub struct statfs { pub f_type: ::c_uint, pub f_bsize: ::c_ulong, @@ -493,6 +590,36 @@ s! { pub f_spare: [::c_uint; 3usize], } + 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(all(not(target_arch = "x86_64"), target_pointer_width = "32"))] + __unused1: [::c_char; 4], + __glibc_reserved: [::c_char; 32] + } + + pub struct mq_attr { + pub mq_flags: ::c_long, + pub mq_maxmsg: ::c_long, + pub mq_msgsize: ::c_long, + pub mq_curmsgs: ::c_long, + } + + pub struct __exit_status { + pub e_termination: ::c_short, + pub e_exit: ::c_short, + } + #[cfg_attr(target_pointer_width = "32", repr(align(4)))] #[cfg_attr(target_pointer_width = "64", @@ -549,7 +676,7 @@ s! { } pub struct __pthread_attr { - pub __schedparam: __sched_param, + pub __schedparam: sched_param, pub __stackaddr: *mut ::c_void, pub __stacksize: size_t, pub __guardsize: size_t, @@ -578,12 +705,25 @@ s! { pub __data: *mut ::c_void, } + pub struct seminfo { + pub semmap: ::c_int, + pub semmni: ::c_int, + pub semmns: ::c_int, + pub semmnu: ::c_int, + pub semmsl: ::c_int, + pub semopm: ::c_int, + pub semume: ::c_int, + pub semusz: ::c_int, + pub semvmx: ::c_int, + pub semaem: ::c_int, + } + pub struct _IO_FILE { _unused: [u8; 0], } - pub struct __sched_param { - pub __sched_priority: ::c_int, + pub struct sched_param { + pub sched_priority: ::c_int, } pub struct iovec { @@ -601,6 +741,23 @@ s! { pub pw_shell: *mut ::c_char, } + pub struct spwd { + pub sp_namp: *mut ::c_char, + pub sp_pwdp: *mut ::c_char, + pub sp_lstchg: ::c_long, + pub sp_min: ::c_long, + pub sp_max: ::c_long, + pub sp_warn: ::c_long, + pub sp_inact: ::c_long, + pub sp_expire: ::c_long, + pub sp_flag: ::c_ulong, + } + + pub struct itimerspec { + pub it_interval: ::timespec, + pub it_value: ::timespec, + } + pub struct tm { pub tm_sec: ::c_int, pub tm_min: ::c_int, @@ -649,6 +806,59 @@ s! { pub dli_saddr: *mut ::c_void, } + pub struct ifaddrs { + pub ifa_next: *mut ifaddrs, + pub ifa_name: *mut c_char, + pub ifa_flags: ::c_uint, + pub ifa_addr: *mut ::sockaddr, + pub ifa_netmask: *mut ::sockaddr, + pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union + pub ifa_data: *mut ::c_void + } + + pub struct arpreq { + pub arp_pa: ::sockaddr, + pub arp_ha: ::sockaddr, + pub arp_flags: ::c_int, + pub arp_netmask: ::sockaddr, + pub arp_dev: [::c_char; 16], + } + + pub struct arpreq_old { + pub arp_pa: ::sockaddr, + pub arp_ha: ::sockaddr, + pub arp_flags: ::c_int, + pub arp_netmask: ::sockaddr, + } + + pub struct arphdr { + pub ar_hrd: u16, + pub ar_pro: u16, + pub ar_hln: u8, + pub ar_pln: u8, + pub ar_op: u16, + } + + pub struct arpd_request { + pub req: ::c_ushort, + pub ip: u32, + pub dev: ::c_ulong, + pub stamp: ::c_ulong, + pub updated: ::c_ulong, + pub ha: [::c_uchar; ::MAX_ADDR_LEN], + } + + pub struct mmsghdr { + pub msg_hdr: ::msghdr, + pub msg_len: ::c_uint, + } + + pub struct ifreq { + /// interface name, e.g. "en0" + pub ifr_name: [::c_char; ::IFNAMSIZ], + pub ifr_ifru: ::sockaddr, + } + pub struct __locale_struct { pub __locales: [*mut __locale_data; 13usize], pub __ctype_b: *const ::c_ushort, @@ -715,6 +925,204 @@ s! { pub l_len : __off64_t, pub l_pid : __pid_t, } + + pub struct glob_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 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 regex_t { + __buffer: *mut ::c_void, + __allocated: ::size_t, + __used: ::size_t, + __syntax: ::c_ulong, + __fastmap: *mut ::c_char, + __translate: *mut ::c_char, + __re_nsub: ::size_t, + __bitfield: u8, + } + + pub struct cpu_set_t { + #[cfg(all(target_pointer_width = "32", + not(target_arch = "x86_64")))] + bits: [u32; 32], + #[cfg(not(all(target_pointer_width = "32", + not(target_arch = "x86_64"))))] + bits: [u64; 16], + } + + pub struct if_nameindex { + pub if_index: ::c_uint, + pub if_name: *mut ::c_char, + } + + // System V IPC + pub struct msginfo { + pub msgpool: ::c_int, + pub msgmap: ::c_int, + pub msgmax: ::c_int, + pub msgmnb: ::c_int, + pub msgmni: ::c_int, + pub msgssz: ::c_int, + pub msgtql: ::c_int, + pub msgseg: ::c_ushort, + } + + pub struct sembuf { + pub sem_num: ::c_ushort, + pub sem_op: ::c_short, + pub sem_flg: ::c_short, + } + + pub struct mntent { + pub mnt_fsname: *mut ::c_char, + pub mnt_dir: *mut ::c_char, + pub mnt_type: *mut ::c_char, + pub mnt_opts: *mut ::c_char, + pub mnt_freq: ::c_int, + pub mnt_passno: ::c_int, + } + + pub struct posix_spawn_file_actions_t { + __allocated: ::c_int, + __used: ::c_int, + __actions: *mut ::c_int, + __pad: [::c_int; 16], + } + + pub struct posix_spawnattr_t { + __flags: ::c_short, + __pgrp: ::pid_t, + __sd: ::sigset_t, + __ss: ::sigset_t, + __sp: ::sched_param, + __policy: ::c_int, + __pad: [::c_int; 16], + } + + pub struct regmatch_t { + pub rm_so: regoff_t, + pub rm_eo: regoff_t, + } + + pub struct option { + pub name: *const ::c_char, + pub has_arg: ::c_int, + pub flag: *mut ::c_int, + pub val: ::c_int, + } + +} + +s_no_extra_traits! { + pub struct utmpx { + pub ut_type: ::c_short, + pub ut_pid: ::pid_t, + pub ut_line: [::c_char; __UT_LINESIZE], + pub ut_id: [::c_char; 4], + + pub ut_user: [::c_char; __UT_NAMESIZE], + pub ut_host: [::c_char; __UT_HOSTSIZE], + pub ut_exit: __exit_status, + + #[cfg(any( all(target_pointer_width = "32", + not(target_arch = "x86_64"))))] + pub ut_session: ::c_long, + #[cfg(any(all(target_pointer_width = "32", + not(target_arch = "x86_64"))))] + pub ut_tv: ::timeval, + + #[cfg(not(any(all(target_pointer_width = "32", + not(target_arch = "x86_64")))))] + pub ut_session: i32, + #[cfg(not(any(all(target_pointer_width = "32", + not(target_arch = "x86_64")))))] + pub ut_tv: __timeval, + + pub ut_addr_v6: [i32; 4], + __glibc_reserved: [::c_char; 20], + } +} + +cfg_if! { + if #[cfg(feature = "extra_traits")] { + impl PartialEq for utmpx { + fn eq(&self, other: &utmpx) -> bool { + self.ut_type == other.ut_type + && self.ut_pid == other.ut_pid + && self.ut_line == other.ut_line + && self.ut_id == other.ut_id + && self.ut_user == other.ut_user + && self + .ut_host + .iter() + .zip(other.ut_host.iter()) + .all(|(a,b)| a == b) + && self.ut_exit == other.ut_exit + && self.ut_session == other.ut_session + && self.ut_tv == other.ut_tv + && self.ut_addr_v6 == other.ut_addr_v6 + && self.__glibc_reserved == other.__glibc_reserved + } + } + + impl Eq for utmpx {} + + impl ::fmt::Debug for utmpx { + fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result { + f.debug_struct("utmpx") + .field("ut_type", &self.ut_type) + .field("ut_pid", &self.ut_pid) + .field("ut_line", &self.ut_line) + .field("ut_id", &self.ut_id) + .field("ut_user", &self.ut_user) + // FIXME: .field("ut_host", &self.ut_host) + .field("ut_exit", &self.ut_exit) + .field("ut_session", &self.ut_session) + .field("ut_tv", &self.ut_tv) + .field("ut_addr_v6", &self.ut_addr_v6) + .field("__glibc_reserved", &self.__glibc_reserved) + .finish() + } + } + + impl ::hash::Hash for utmpx { + fn hash(&self, state: &mut H) { + self.ut_type.hash(state); + self.ut_pid.hash(state); + self.ut_line.hash(state); + self.ut_id.hash(state); + self.ut_user.hash(state); + self.ut_host.hash(state); + self.ut_exit.hash(state); + self.ut_session.hash(state); + self.ut_tv.hash(state); + self.ut_addr_v6.hash(state); + self.__glibc_reserved.hash(state); + } + } + } } impl siginfo_t { @@ -740,16 +1148,69 @@ impl siginfo_t { } // const -pub const IPOPT_COPY: u8 = 0x80; -pub const IPOPT_NUMBER_MASK: u8 = 0x1f; -pub const IPOPT_CLASS_MASK: u8 = 0x60; -pub const IPTOS_ECN_MASK: u8 = 0x03; -pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000; +// aio.h +pub const AIO_CANCELED: ::c_int = 0; +pub const AIO_NOTCANCELED: ::c_int = 1; +pub const AIO_ALLDONE: ::c_int = 2; +pub const LIO_READ: ::c_int = 0; +pub const LIO_WRITE: ::c_int = 1; +pub const LIO_NOP: ::c_int = 2; +pub const LIO_WAIT: ::c_int = 0; +pub const LIO_NOWAIT: ::c_int = 1; + +// glob.h +pub const GLOB_ERR: ::c_int = 1 << 0; +pub const GLOB_MARK: ::c_int = 1 << 1; +pub const GLOB_NOSORT: ::c_int = 1 << 2; +pub const GLOB_DOOFFS: ::c_int = 1 << 3; +pub const GLOB_NOCHECK: ::c_int = 1 << 4; +pub const GLOB_APPEND: ::c_int = 1 << 5; +pub const GLOB_NOESCAPE: ::c_int = 1 << 6; + +pub const GLOB_NOSPACE: ::c_int = 1; +pub const GLOB_ABORTED: ::c_int = 2; +pub const GLOB_NOMATCH: ::c_int = 3; + +pub const GLOB_PERIOD: ::c_int = 1 << 7; +pub const GLOB_ALTDIRFUNC: ::c_int = 1 << 9; +pub const GLOB_BRACE: ::c_int = 1 << 10; +pub const GLOB_NOMAGIC: ::c_int = 1 << 11; +pub const GLOB_TILDE: ::c_int = 1 << 12; +pub const GLOB_ONLYDIR: ::c_int = 1 << 13; +pub const GLOB_TILDE_CHECK: ::c_int = 1 << 14; + +// ipc.h +pub const IPC_PRIVATE: ::key_t = 0; + +pub const IPC_CREAT: ::c_int = 0o1000; +pub const IPC_EXCL: ::c_int = 0o2000; +pub const IPC_NOWAIT: ::c_int = 0o4000; + +pub const IPC_RMID: ::c_int = 0; +pub const IPC_SET: ::c_int = 1; +pub const IPC_STAT: ::c_int = 2; +pub const IPC_INFO: ::c_int = 3; +pub const MSG_STAT: ::c_int = 11; +pub const MSG_INFO: ::c_int = 12; + +pub const MSG_NOERROR: ::c_int = 0o10000; +pub const MSG_EXCEPT: ::c_int = 0o20000; + +// shm.h +pub const SHM_R: ::c_int = 0o400; +pub const SHM_W: ::c_int = 0o200; + +pub const SHM_RDONLY: ::c_int = 0o10000; +pub const SHM_RND: ::c_int = 0o20000; +pub const SHM_REMAP: ::c_int = 0o40000; + +pub const SHM_LOCK: ::c_int = 11; +pub const SHM_UNLOCK: ::c_int = 12; // unistd.h -pub const STDIN_FILENO: c_long = 0; -pub const STDOUT_FILENO: c_long = 1; -pub const STDERR_FILENO: c_long = 2; +pub const STDIN_FILENO: ::c_int = 0; +pub const STDOUT_FILENO: ::c_int = 1; +pub const STDERR_FILENO: ::c_int = 2; pub const __FD_SETSIZE: usize = 256; pub const R_OK: ::c_int = 4; pub const W_OK: ::c_int = 2; @@ -769,6 +1230,9 @@ pub const F_TLOCK: ::c_int = 2; pub const F_TEST: ::c_int = 3; pub const CLOSE_RANGE_CLOEXEC: ::c_int = 4; +// stdio.h +pub const EOF: ::c_int = -1; + // stdlib.h pub const WNOHANG: ::c_int = 1; pub const WUNTRACED: ::c_int = 2; @@ -884,8 +1348,17 @@ pub const _SS_SIZE: usize = 128; pub const CMGROUP_MAX: usize = 16; pub const SOL_SOCKET: ::c_int = 65535; +// sys/time.h +pub const ITIMER_REAL: ::c_int = 0; +pub const ITIMER_VIRTUAL: ::c_int = 1; +pub const ITIMER_PROF: ::c_int = 2; + // netinet/in.h pub const SOL_IP: ::c_int = 0; +pub const SOL_TCP: ::c_int = 6; +pub const SOL_UDP: ::c_int = 17; +pub const SOL_IPV6: ::c_int = 41; +pub const SOL_ICMPV6: ::c_int = 58; pub const IP_OPTIONS: ::c_int = 1; pub const IP_HDRINCL: ::c_int = 2; pub const IP_TOS: ::c_int = 3; @@ -899,8 +1372,6 @@ pub const IP_MULTICAST_TTL: ::c_int = 10; pub const IP_MULTICAST_LOOP: ::c_int = 11; pub const IP_ADD_MEMBERSHIP: ::c_int = 12; pub const IP_DROP_MEMBERSHIP: ::c_int = 13; -pub const SOL_IPV6: ::c_int = 41; -pub const SOL_ICMPV6: ::c_int = 58; pub const IPV6_ADDRFORM: ::c_int = 1; pub const IPV6_2292PKTINFO: ::c_int = 2; pub const IPV6_2292HOPOPTS: ::c_int = 3; @@ -965,6 +1436,143 @@ pub const IN_LOOPBACKNET: u32 = 127; pub const INET_ADDRSTRLEN: usize = 16; pub const INET6_ADDRSTRLEN: usize = 46; +// netinet/ip.h +pub const IPTOS_TOS_MASK: u8 = 0x1E; +pub const IPTOS_PREC_MASK: u8 = 0xE0; + +pub const IPTOS_ECN_NOT_ECT: u8 = 0x00; + +pub const IPTOS_LOWDELAY: u8 = 0x10; +pub const IPTOS_THROUGHPUT: u8 = 0x08; +pub const IPTOS_RELIABILITY: u8 = 0x04; +pub const IPTOS_MINCOST: u8 = 0x02; + +pub const IPTOS_PREC_NETCONTROL: u8 = 0xe0; +pub const IPTOS_PREC_INTERNETCONTROL: u8 = 0xc0; +pub const IPTOS_PREC_CRITIC_ECP: u8 = 0xa0; +pub const IPTOS_PREC_FLASHOVERRIDE: u8 = 0x80; +pub const IPTOS_PREC_FLASH: u8 = 0x60; +pub const IPTOS_PREC_IMMEDIATE: u8 = 0x40; +pub const IPTOS_PREC_PRIORITY: u8 = 0x20; +pub const IPTOS_PREC_ROUTINE: u8 = 0x00; + +pub const IPTOS_ECN_MASK: u8 = 0x03; +pub const IPTOS_ECN_ECT1: u8 = 0x01; +pub const IPTOS_ECN_ECT0: u8 = 0x02; +pub const IPTOS_ECN_CE: u8 = 0x03; + +pub const IPOPT_COPY: u8 = 0x80; +pub const IPOPT_CLASS_MASK: u8 = 0x60; +pub const IPOPT_NUMBER_MASK: u8 = 0x1f; + +pub const IPOPT_CONTROL: u8 = 0x00; +pub const IPOPT_RESERVED1: u8 = 0x20; +pub const IPOPT_MEASUREMENT: u8 = 0x40; +pub const IPOPT_RESERVED2: u8 = 0x60; +pub const IPOPT_END: u8 = 0 | IPOPT_CONTROL; +pub const IPOPT_NOOP: u8 = 1 | IPOPT_CONTROL; +pub const IPOPT_SEC: u8 = 2 | IPOPT_CONTROL | IPOPT_COPY; +pub const IPOPT_LSRR: u8 = 3 | IPOPT_CONTROL | IPOPT_COPY; +pub const IPOPT_TIMESTAMP: u8 = 4 | IPOPT_MEASUREMENT; +pub const IPOPT_RR: u8 = 7 | IPOPT_CONTROL; +pub const IPOPT_SID: u8 = 8 | IPOPT_CONTROL | IPOPT_COPY; +pub const IPOPT_SSRR: u8 = 9 | IPOPT_CONTROL | IPOPT_COPY; +pub const IPOPT_RA: u8 = 20 | IPOPT_CONTROL | IPOPT_COPY; +pub const IPVERSION: u8 = 4; +pub const MAXTTL: u8 = 255; +pub const IPDEFTTL: u8 = 64; +pub const IPOPT_OPTVAL: u8 = 0; +pub const IPOPT_OLEN: u8 = 1; +pub const IPOPT_OFFSET: u8 = 2; +pub const IPOPT_MINOFF: u8 = 4; +pub const MAX_IPOPTLEN: u8 = 40; +pub const IPOPT_NOP: u8 = IPOPT_NOOP; +pub const IPOPT_EOL: u8 = IPOPT_END; +pub const IPOPT_TS: u8 = IPOPT_TIMESTAMP; +pub const IPOPT_TS_TSONLY: u8 = 0; +pub const IPOPT_TS_TSANDADDR: u8 = 1; +pub const IPOPT_TS_PRESPEC: u8 = 3; + +// net/if_arp.h +pub const ARPOP_REQUEST: u16 = 1; +pub const ARPOP_REPLY: u16 = 2; +pub const ARPOP_RREQUEST: u16 = 3; +pub const ARPOP_RREPLY: u16 = 4; +pub const ARPOP_InREQUEST: u16 = 8; +pub const ARPOP_InREPLY: u16 = 9; +pub const ARPOP_NAK: u16 = 10; + +pub const MAX_ADDR_LEN: usize = 7; +pub const ARPD_UPDATE: ::c_ushort = 0x01; +pub const ARPD_LOOKUP: ::c_ushort = 0x02; +pub const ARPD_FLUSH: ::c_ushort = 0x03; +pub const ATF_MAGIC: ::c_int = 0x80; + +pub const ATF_NETMASK: ::c_int = 0x20; +pub const ATF_DONTPUB: ::c_int = 0x40; + +pub const ARPHRD_NETROM: u16 = 0; +pub const ARPHRD_ETHER: u16 = 1; +pub const ARPHRD_EETHER: u16 = 2; +pub const ARPHRD_AX25: u16 = 3; +pub const ARPHRD_PRONET: u16 = 4; +pub const ARPHRD_CHAOS: u16 = 5; +pub const ARPHRD_IEEE802: u16 = 6; +pub const ARPHRD_ARCNET: u16 = 7; +pub const ARPHRD_APPLETLK: u16 = 8; +pub const ARPHRD_DLCI: u16 = 15; +pub const ARPHRD_ATM: u16 = 19; +pub const ARPHRD_METRICOM: u16 = 23; +pub const ARPHRD_IEEE1394: u16 = 24; +pub const ARPHRD_EUI64: u16 = 27; +pub const ARPHRD_INFINIBAND: u16 = 32; + +pub const ARPHRD_SLIP: u16 = 256; +pub const ARPHRD_CSLIP: u16 = 257; +pub const ARPHRD_SLIP6: u16 = 258; +pub const ARPHRD_CSLIP6: u16 = 259; +pub const ARPHRD_RSRVD: u16 = 260; +pub const ARPHRD_ADAPT: u16 = 264; +pub const ARPHRD_ROSE: u16 = 270; +pub const ARPHRD_X25: u16 = 271; +pub const ARPHRD_HWX25: u16 = 272; +pub const ARPHRD_CAN: u16 = 280; +pub const ARPHRD_PPP: u16 = 512; +pub const ARPHRD_CISCO: u16 = 513; +pub const ARPHRD_HDLC: u16 = ARPHRD_CISCO; +pub const ARPHRD_LAPB: u16 = 516; +pub const ARPHRD_DDCMP: u16 = 517; +pub const ARPHRD_RAWHDLC: u16 = 518; + +pub const ARPHRD_TUNNEL: u16 = 768; +pub const ARPHRD_TUNNEL6: u16 = 769; +pub const ARPHRD_FRAD: u16 = 770; +pub const ARPHRD_SKIP: u16 = 771; +pub const ARPHRD_LOOPBACK: u16 = 772; +pub const ARPHRD_LOCALTLK: u16 = 773; +pub const ARPHRD_FDDI: u16 = 774; +pub const ARPHRD_BIF: u16 = 775; +pub const ARPHRD_SIT: u16 = 776; +pub const ARPHRD_IPDDP: u16 = 777; +pub const ARPHRD_IPGRE: u16 = 778; +pub const ARPHRD_PIMREG: u16 = 779; +pub const ARPHRD_HIPPI: u16 = 780; +pub const ARPHRD_ASH: u16 = 781; +pub const ARPHRD_ECONET: u16 = 782; +pub const ARPHRD_IRDA: u16 = 783; +pub const ARPHRD_FCPP: u16 = 784; +pub const ARPHRD_FCAL: u16 = 785; +pub const ARPHRD_FCPL: u16 = 786; +pub const ARPHRD_FCFABRIC: u16 = 787; +pub const ARPHRD_IEEE802_TR: u16 = 800; +pub const ARPHRD_IEEE80211: u16 = 801; +pub const ARPHRD_IEEE80211_PRISM: u16 = 802; +pub const ARPHRD_IEEE80211_RADIOTAP: u16 = 803; +pub const ARPHRD_IEEE802154: u16 = 804; + +pub const ARPHRD_VOID: u16 = 0xFFFF; +pub const ARPHRD_NONE: u16 = 0xFFFE; + // bits/posix1_lim.h pub const _POSIX_AIO_LISTIO_MAX: usize = 2; pub const _POSIX_AIO_MAX: usize = 1; @@ -1063,13 +1671,13 @@ pub const NI_DGRAM: ::c_int = 16; pub const NI_IDN: ::c_int = 32; // time.h -pub const CLOCK_REALTIME: clockid_t = 0; -pub const CLOCK_MONOTONIC: clockid_t = 1; -pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2; -pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3; -pub const CLOCK_MONOTONIC_RAW: clockid_t = 4; -pub const CLOCK_REALTIME_COARSE: clockid_t = 5; -pub const CLOCK_MONOTONIC_COARSE: clockid_t = 6; +pub const CLOCK_REALTIME: ::clockid_t = 0; +pub const CLOCK_MONOTONIC: ::clockid_t = 1; +pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2; +pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3; +pub const CLOCK_MONOTONIC_RAW: ::clockid_t = 4; +pub const CLOCK_REALTIME_COARSE: ::clockid_t = 5; +pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6; pub const TIMER_ABSTIME: ::c_int = 1; pub const TIME_UTC: ::c_int = 1; @@ -1126,155 +1734,234 @@ pub const LC_MEASUREMENT_MASK: ::c_int = 2048; pub const LC_IDENTIFICATION_MASK: ::c_int = 4096; pub const LC_ALL_MASK: ::c_int = 8127; +pub const ABDAY_1: ::nl_item = 0x20000; +pub const ABDAY_2: ::nl_item = 0x20001; +pub const ABDAY_3: ::nl_item = 0x20002; +pub const ABDAY_4: ::nl_item = 0x20003; +pub const ABDAY_5: ::nl_item = 0x20004; +pub const ABDAY_6: ::nl_item = 0x20005; +pub const ABDAY_7: ::nl_item = 0x20006; + +pub const DAY_1: ::nl_item = 0x20007; +pub const DAY_2: ::nl_item = 0x20008; +pub const DAY_3: ::nl_item = 0x20009; +pub const DAY_4: ::nl_item = 0x2000A; +pub const DAY_5: ::nl_item = 0x2000B; +pub const DAY_6: ::nl_item = 0x2000C; +pub const DAY_7: ::nl_item = 0x2000D; + +pub const ABMON_1: ::nl_item = 0x2000E; +pub const ABMON_2: ::nl_item = 0x2000F; +pub const ABMON_3: ::nl_item = 0x20010; +pub const ABMON_4: ::nl_item = 0x20011; +pub const ABMON_5: ::nl_item = 0x20012; +pub const ABMON_6: ::nl_item = 0x20013; +pub const ABMON_7: ::nl_item = 0x20014; +pub const ABMON_8: ::nl_item = 0x20015; +pub const ABMON_9: ::nl_item = 0x20016; +pub const ABMON_10: ::nl_item = 0x20017; +pub const ABMON_11: ::nl_item = 0x20018; +pub const ABMON_12: ::nl_item = 0x20019; + +pub const MON_1: ::nl_item = 0x2001A; +pub const MON_2: ::nl_item = 0x2001B; +pub const MON_3: ::nl_item = 0x2001C; +pub const MON_4: ::nl_item = 0x2001D; +pub const MON_5: ::nl_item = 0x2001E; +pub const MON_6: ::nl_item = 0x2001F; +pub const MON_7: ::nl_item = 0x20020; +pub const MON_8: ::nl_item = 0x20021; +pub const MON_9: ::nl_item = 0x20022; +pub const MON_10: ::nl_item = 0x20023; +pub const MON_11: ::nl_item = 0x20024; +pub const MON_12: ::nl_item = 0x20025; + +pub const AM_STR: ::nl_item = 0x20026; +pub const PM_STR: ::nl_item = 0x20027; + +pub const D_T_FMT: ::nl_item = 0x20028; +pub const D_FMT: ::nl_item = 0x20029; +pub const T_FMT: ::nl_item = 0x2002A; +pub const T_FMT_AMPM: ::nl_item = 0x2002B; + +pub const ERA: ::nl_item = 0x2002C; +pub const ERA_D_FMT: ::nl_item = 0x2002E; +pub const ALT_DIGITS: ::nl_item = 0x2002F; +pub const ERA_D_T_FMT: ::nl_item = 0x20030; +pub const ERA_T_FMT: ::nl_item = 0x20031; + +pub const CODESET: ::nl_item = 14; +pub const CRNCYSTR: ::nl_item = 0x4000F; +pub const RADIXCHAR: ::nl_item = 0x10000; +pub const THOUSEP: ::nl_item = 0x10001; +pub const YESEXPR: ::nl_item = 0x50000; +pub const NOEXPR: ::nl_item = 0x50001; +pub const YESSTR: ::nl_item = 0x50002; +pub const NOSTR: ::nl_item = 0x50003; + +// reboot.h +pub const RB_AUTOBOOT: ::c_int = 0x0; +pub const RB_ASKNAME: ::c_int = 0x1; +pub const RB_SINGLE: ::c_int = 0x2; +pub const RB_KBD: ::c_int = 0x4; +pub const RB_HALT: ::c_int = 0x8; +pub const RB_INITNAME: ::c_int = 0x10; +pub const RB_DFLTROOT: ::c_int = 0x20; +pub const RB_NOBOOTRC: ::c_int = 0x20; +pub const RB_ALTBOOT: ::c_int = 0x40; +pub const RB_UNIPROC: ::c_int = 0x80; +pub const RB_DEBUGGER: ::c_int = 0x1000; + // semaphore.h pub const __SIZEOF_SEM_T: usize = 20; +pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t; // termios.h -pub const IGNBRK: tcflag_t = 1; -pub const BRKINT: tcflag_t = 2; -pub const IGNPAR: tcflag_t = 4; -pub const PARMRK: tcflag_t = 8; -pub const INPCK: tcflag_t = 16; -pub const ISTRIP: tcflag_t = 32; -pub const INLCR: tcflag_t = 64; -pub const IGNCR: tcflag_t = 128; -pub const ICRNL: tcflag_t = 256; -pub const IXON: tcflag_t = 512; -pub const IXOFF: tcflag_t = 1024; -pub const IXANY: tcflag_t = 2048; -pub const IMAXBEL: tcflag_t = 8192; -pub const IUCLC: tcflag_t = 16384; -pub const OPOST: tcflag_t = 1; -pub const ONLCR: tcflag_t = 2; -pub const ONOEOT: tcflag_t = 8; -pub const OCRNL: tcflag_t = 16; -pub const ONOCR: tcflag_t = 32; -pub const ONLRET: tcflag_t = 64; -pub const NLDLY: tcflag_t = 768; -pub const NL0: tcflag_t = 0; -pub const NL1: tcflag_t = 256; -pub const TABDLY: tcflag_t = 3076; -pub const TAB0: tcflag_t = 0; -pub const TAB1: tcflag_t = 1024; -pub const TAB2: tcflag_t = 2048; -pub const TAB3: tcflag_t = 4; -pub const CRDLY: tcflag_t = 12288; -pub const CR0: tcflag_t = 0; -pub const CR1: tcflag_t = 4096; -pub const CR2: tcflag_t = 8192; -pub const CR3: tcflag_t = 12288; -pub const FFDLY: tcflag_t = 16384; -pub const FF0: tcflag_t = 0; -pub const FF1: tcflag_t = 16384; -pub const BSDLY: tcflag_t = 32768; -pub const BS0: tcflag_t = 0; -pub const BS1: tcflag_t = 32768; -pub const VTDLY: tcflag_t = 65536; -pub const VT0: tcflag_t = 0; -pub const VT1: tcflag_t = 65536; -pub const OLCUC: tcflag_t = 131072; -pub const OFILL: tcflag_t = 262144; -pub const OFDEL: tcflag_t = 524288; -pub const CIGNORE: tcflag_t = 1; -pub const CSIZE: tcflag_t = 768; -pub const CS5: tcflag_t = 0; -pub const CS6: tcflag_t = 256; -pub const CS7: tcflag_t = 512; -pub const CS8: tcflag_t = 768; -pub const CSTOPB: tcflag_t = 1024; -pub const CREAD: tcflag_t = 2048; -pub const PARENB: tcflag_t = 4096; -pub const PARODD: tcflag_t = 8192; -pub const HUPCL: tcflag_t = 16384; -pub const CLOCAL: tcflag_t = 32768; -pub const CRTSCTS: tcflag_t = 65536; -pub const CRTS_IFLOW: tcflag_t = 65536; -pub const CCTS_OFLOW: tcflag_t = 65536; -pub const CDTRCTS: tcflag_t = 131072; -pub const MDMBUF: tcflag_t = 1048576; -pub const CHWFLOW: tcflag_t = 1245184; -pub const ECHOKE: tcflag_t = 1; -pub const _ECHOE: tcflag_t = 2; -pub const ECHOE: tcflag_t = 2; -pub const _ECHOK: tcflag_t = 4; -pub const ECHOK: tcflag_t = 4; -pub const _ECHO: tcflag_t = 8; -pub const ECHO: tcflag_t = 8; -pub const _ECHONL: tcflag_t = 16; -pub const ECHONL: tcflag_t = 16; -pub const ECHOPRT: tcflag_t = 32; -pub const ECHOCTL: tcflag_t = 64; -pub const _ISIG: tcflag_t = 128; -pub const ISIG: tcflag_t = 128; -pub const _ICANON: tcflag_t = 256; -pub const ICANON: tcflag_t = 256; -pub const ALTWERASE: tcflag_t = 512; -pub const _IEXTEN: tcflag_t = 1024; -pub const IEXTEN: tcflag_t = 1024; -pub const EXTPROC: tcflag_t = 2048; -pub const _TOSTOP: tcflag_t = 4194304; -pub const TOSTOP: tcflag_t = 4194304; -pub const FLUSHO: tcflag_t = 8388608; -pub const NOKERNINFO: tcflag_t = 33554432; -pub const PENDIN: tcflag_t = 536870912; -pub const _NOFLSH: tcflag_t = 2147483648; -pub const NOFLSH: tcflag_t = 2147483648; -pub const VEOF: cc_t = 0; -pub const VEOL: cc_t = 1; -pub const VEOL2: cc_t = 2; -pub const VERASE: cc_t = 3; -pub const VWERASE: cc_t = 4; -pub const VKILL: cc_t = 5; -pub const VREPRINT: cc_t = 6; -pub const VINTR: cc_t = 8; -pub const VQUIT: cc_t = 9; -pub const VSUSP: cc_t = 10; -pub const VDSUSP: cc_t = 11; -pub const VSTART: cc_t = 12; -pub const VSTOP: cc_t = 13; -pub const VLNEXT: cc_t = 14; -pub const VDISCARD: cc_t = 15; -pub const VMIN: cc_t = 16; -pub const VTIME: cc_t = 17; -pub const VSTATUS: cc_t = 18; +pub const IGNBRK: ::tcflag_t = 1; +pub const BRKINT: ::tcflag_t = 2; +pub const IGNPAR: ::tcflag_t = 4; +pub const PARMRK: ::tcflag_t = 8; +pub const INPCK: ::tcflag_t = 16; +pub const ISTRIP: ::tcflag_t = 32; +pub const INLCR: ::tcflag_t = 64; +pub const IGNCR: ::tcflag_t = 128; +pub const ICRNL: ::tcflag_t = 256; +pub const IXON: ::tcflag_t = 512; +pub const IXOFF: ::tcflag_t = 1024; +pub const IXANY: ::tcflag_t = 2048; +pub const IMAXBEL: ::tcflag_t = 8192; +pub const IUCLC: ::tcflag_t = 16384; +pub const OPOST: ::tcflag_t = 1; +pub const ONLCR: ::tcflag_t = 2; +pub const ONOEOT: ::tcflag_t = 8; +pub const OCRNL: ::tcflag_t = 16; +pub const ONOCR: ::tcflag_t = 32; +pub const ONLRET: ::tcflag_t = 64; +pub const NLDLY: ::tcflag_t = 768; +pub const NL0: ::tcflag_t = 0; +pub const NL1: ::tcflag_t = 256; +pub const TABDLY: ::tcflag_t = 3076; +pub const TAB0: ::tcflag_t = 0; +pub const TAB1: ::tcflag_t = 1024; +pub const TAB2: ::tcflag_t = 2048; +pub const TAB3: ::tcflag_t = 4; +pub const CRDLY: ::tcflag_t = 12288; +pub const CR0: ::tcflag_t = 0; +pub const CR1: ::tcflag_t = 4096; +pub const CR2: ::tcflag_t = 8192; +pub const CR3: ::tcflag_t = 12288; +pub const FFDLY: ::tcflag_t = 16384; +pub const FF0: ::tcflag_t = 0; +pub const FF1: ::tcflag_t = 16384; +pub const BSDLY: ::tcflag_t = 32768; +pub const BS0: ::tcflag_t = 0; +pub const BS1: ::tcflag_t = 32768; +pub const VTDLY: ::tcflag_t = 65536; +pub const VT0: ::tcflag_t = 0; +pub const VT1: ::tcflag_t = 65536; +pub const OLCUC: ::tcflag_t = 131072; +pub const OFILL: ::tcflag_t = 262144; +pub const OFDEL: ::tcflag_t = 524288; +pub const CIGNORE: ::tcflag_t = 1; +pub const CSIZE: ::tcflag_t = 768; +pub const CS5: ::tcflag_t = 0; +pub const CS6: ::tcflag_t = 256; +pub const CS7: ::tcflag_t = 512; +pub const CS8: ::tcflag_t = 768; +pub const CSTOPB: ::tcflag_t = 1024; +pub const CREAD: ::tcflag_t = 2048; +pub const PARENB: ::tcflag_t = 4096; +pub const PARODD: ::tcflag_t = 8192; +pub const HUPCL: ::tcflag_t = 16384; +pub const CLOCAL: ::tcflag_t = 32768; +pub const CRTSCTS: ::tcflag_t = 65536; +pub const CRTS_IFLOW: ::tcflag_t = 65536; +pub const CCTS_OFLOW: ::tcflag_t = 65536; +pub const CDTRCTS: ::tcflag_t = 131072; +pub const MDMBUF: ::tcflag_t = 1048576; +pub const CHWFLOW: ::tcflag_t = 1245184; +pub const ECHOKE: ::tcflag_t = 1; +pub const _ECHOE: ::tcflag_t = 2; +pub const ECHOE: ::tcflag_t = 2; +pub const _ECHOK: ::tcflag_t = 4; +pub const ECHOK: ::tcflag_t = 4; +pub const _ECHO: ::tcflag_t = 8; +pub const ECHO: ::tcflag_t = 8; +pub const _ECHONL: ::tcflag_t = 16; +pub const ECHONL: ::tcflag_t = 16; +pub const ECHOPRT: ::tcflag_t = 32; +pub const ECHOCTL: ::tcflag_t = 64; +pub const _ISIG: ::tcflag_t = 128; +pub const ISIG: ::tcflag_t = 128; +pub const _ICANON: ::tcflag_t = 256; +pub const ICANON: ::tcflag_t = 256; +pub const ALTWERASE: ::tcflag_t = 512; +pub const _IEXTEN: ::tcflag_t = 1024; +pub const IEXTEN: ::tcflag_t = 1024; +pub const EXTPROC: ::tcflag_t = 2048; +pub const _TOSTOP: ::tcflag_t = 4194304; +pub const TOSTOP: ::tcflag_t = 4194304; +pub const FLUSHO: ::tcflag_t = 8388608; +pub const NOKERNINFO: ::tcflag_t = 33554432; +pub const PENDIN: ::tcflag_t = 536870912; +pub const _NOFLSH: ::tcflag_t = 2147483648; +pub const NOFLSH: ::tcflag_t = 2147483648; +pub const VEOF: usize = 0; +pub const VEOL: usize = 1; +pub const VEOL2: usize = 2; +pub const VERASE: usize = 3; +pub const VWERASE: usize = 4; +pub const VKILL: usize = 5; +pub const VREPRINT: usize = 6; +pub const VINTR: usize = 8; +pub const VQUIT: usize = 9; +pub const VSUSP: usize = 10; +pub const VDSUSP: usize = 11; +pub const VSTART: usize = 12; +pub const VSTOP: usize = 13; +pub const VLNEXT: usize = 14; +pub const VDISCARD: usize = 15; +pub const VMIN: usize = 16; +pub const VTIME: usize = 17; +pub const VSTATUS: usize = 18; pub const NCCS: usize = 20; -pub const B0: speed_t = 0; -pub const B50: speed_t = 50; -pub const B75: speed_t = 75; -pub const B110: speed_t = 110; -pub const B134: speed_t = 134; -pub const B150: speed_t = 150; -pub const B200: speed_t = 200; -pub const B300: speed_t = 300; -pub const B600: speed_t = 600; -pub const B1200: speed_t = 1200; -pub const B1800: speed_t = 1800; -pub const B2400: speed_t = 2400; -pub const B4800: speed_t = 4800; -pub const B9600: speed_t = 9600; -pub const B7200: speed_t = 7200; -pub const B14400: speed_t = 14400; -pub const B19200: speed_t = 19200; -pub const B28800: speed_t = 28800; -pub const B38400: speed_t = 38400; -pub const EXTA: speed_t = 19200; -pub const EXTB: speed_t = 38400; -pub const B57600: speed_t = 57600; -pub const B76800: speed_t = 76800; -pub const B115200: speed_t = 115200; -pub const B230400: speed_t = 230400; -pub const B460800: speed_t = 460800; -pub const B500000: speed_t = 500000; -pub const B576000: speed_t = 576000; -pub const B921600: speed_t = 921600; -pub const B1000000: speed_t = 1000000; -pub const B1152000: speed_t = 1152000; -pub const B1500000: speed_t = 1500000; -pub const B2000000: speed_t = 2000000; -pub const B2500000: speed_t = 2500000; -pub const B3000000: speed_t = 3000000; -pub const B3500000: speed_t = 3500000; -pub const B4000000: speed_t = 4000000; +pub const B0: ::speed_t = 0; +pub const B50: ::speed_t = 50; +pub const B75: ::speed_t = 75; +pub const B110: ::speed_t = 110; +pub const B134: ::speed_t = 134; +pub const B150: ::speed_t = 150; +pub const B200: ::speed_t = 200; +pub const B300: ::speed_t = 300; +pub const B600: ::speed_t = 600; +pub const B1200: ::speed_t = 1200; +pub const B1800: ::speed_t = 1800; +pub const B2400: ::speed_t = 2400; +pub const B4800: ::speed_t = 4800; +pub const B9600: ::speed_t = 9600; +pub const B7200: ::speed_t = 7200; +pub const B14400: ::speed_t = 14400; +pub const B19200: ::speed_t = 19200; +pub const B28800: ::speed_t = 28800; +pub const B38400: ::speed_t = 38400; +pub const EXTA: ::speed_t = B19200; +pub const EXTB: ::speed_t = B38400; +pub const B57600: ::speed_t = 57600; +pub const B76800: ::speed_t = 76800; +pub const B115200: ::speed_t = 115200; +pub const B230400: ::speed_t = 230400; +pub const B460800: ::speed_t = 460800; +pub const B500000: ::speed_t = 500000; +pub const B576000: ::speed_t = 576000; +pub const B921600: ::speed_t = 921600; +pub const B1000000: ::speed_t = 1000000; +pub const B1152000: ::speed_t = 1152000; +pub const B1500000: ::speed_t = 1500000; +pub const B2000000: ::speed_t = 2000000; +pub const B2500000: ::speed_t = 2500000; +pub const B3000000: ::speed_t = 3000000; +pub const B3500000: ::speed_t = 3500000; +pub const B4000000: ::speed_t = 4000000; pub const TCSANOW: ::c_int = 0; pub const TCSADRAIN: ::c_int = 1; pub const TCSAFLUSH: ::c_int = 2; @@ -1286,10 +1973,10 @@ pub const TCOOFF: ::c_int = 1; pub const TCOON: ::c_int = 2; pub const TCIOFF: ::c_int = 3; pub const TCION: ::c_int = 4; -pub const TTYDEF_IFLAG: tcflag_t = 11042; -pub const TTYDEF_LFLAG: tcflag_t = 1483; -pub const TTYDEF_CFLAG: tcflag_t = 23040; -pub const TTYDEF_SPEED: tcflag_t = 9600; +pub const TTYDEF_IFLAG: ::tcflag_t = 11042; +pub const TTYDEF_LFLAG: ::tcflag_t = 1483; +pub const TTYDEF_CFLAG: ::tcflag_t = 23040; +pub const TTYDEF_SPEED: ::tcflag_t = 9600; pub const CEOL: u8 = 0u8; pub const CERASE: u8 = 127; pub const CMIN: u8 = 1; @@ -1299,6 +1986,7 @@ pub const CBRK: u8 = 0u8; // dlfcn.h pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; +pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void; pub const RTLD_LAZY: ::c_int = 1; pub const RTLD_NOW: ::c_int = 2; pub const RTLD_BINDING_MASK: ::c_int = 3; @@ -1467,35 +2155,35 @@ pub const SF_NOUNLINK: ::c_uint = 1048576; pub const SF_SNAPSHOT: ::c_uint = 2097152; pub const UTIME_NOW: ::c_long = -1; pub const UTIME_OMIT: ::c_long = -2; -pub const S_IFMT: mode_t = 61440; -pub const S_IFDIR: mode_t = 16384; -pub const S_IFCHR: mode_t = 8192; -pub const S_IFBLK: mode_t = 24576; -pub const S_IFREG: mode_t = 32768; -pub const S_IFIFO: mode_t = 4096; -pub const S_IFLNK: mode_t = 40960; -pub const S_IFSOCK: mode_t = 49152; -pub const S_ISUID: mode_t = 2048; -pub const S_ISGID: mode_t = 1024; -pub const S_ISVTX: mode_t = 512; -pub const S_IRUSR: mode_t = 256; -pub const S_IWUSR: mode_t = 128; -pub const S_IXUSR: mode_t = 64; -pub const S_IRWXU: mode_t = 448; -pub const S_IREAD: mode_t = 256; -pub const S_IWRITE: mode_t = 128; -pub const S_IEXEC: mode_t = 64; -pub const S_IRGRP: mode_t = 32; -pub const S_IWGRP: mode_t = 16; -pub const S_IXGRP: mode_t = 8; -pub const S_IRWXG: mode_t = 56; -pub const S_IROTH: mode_t = 4; -pub const S_IWOTH: mode_t = 2; -pub const S_IXOTH: mode_t = 1; -pub const S_IRWXO: mode_t = 7; -pub const ACCESSPERMS: mode_t = 511; -pub const ALLPERMS: mode_t = 4095; -pub const DEFFILEMODE: mode_t = 438; +pub const S_IFMT: ::mode_t = 61440; +pub const S_IFDIR: ::mode_t = 16384; +pub const S_IFCHR: ::mode_t = 8192; +pub const S_IFBLK: ::mode_t = 24576; +pub const S_IFREG: ::mode_t = 32768; +pub const S_IFIFO: ::mode_t = 4096; +pub const S_IFLNK: ::mode_t = 40960; +pub const S_IFSOCK: ::mode_t = 49152; +pub const S_ISUID: ::mode_t = 2048; +pub const S_ISGID: ::mode_t = 1024; +pub const S_ISVTX: ::mode_t = 512; +pub const S_IRUSR: ::mode_t = 256; +pub const S_IWUSR: ::mode_t = 128; +pub const S_IXUSR: ::mode_t = 64; +pub const S_IRWXU: ::mode_t = 448; +pub const S_IREAD: ::mode_t = 256; +pub const S_IWRITE: ::mode_t = 128; +pub const S_IEXEC: ::mode_t = 64; +pub const S_IRGRP: ::mode_t = 32; +pub const S_IWGRP: ::mode_t = 16; +pub const S_IXGRP: ::mode_t = 8; +pub const S_IRWXG: ::mode_t = 56; +pub const S_IROTH: ::mode_t = 4; +pub const S_IWOTH: ::mode_t = 2; +pub const S_IXOTH: ::mode_t = 1; +pub const S_IRWXO: ::mode_t = 7; +pub const ACCESSPERMS: ::mode_t = 511; +pub const ALLPERMS: ::mode_t = 4095; +pub const DEFFILEMODE: ::mode_t = 438; pub const S_BLKSIZE: usize = 512; pub const STATX_TYPE: ::c_uint = 1; pub const STATX_MODE: ::c_uint = 2; @@ -1547,34 +2235,34 @@ pub const TIOCPKT_IOCTL: ::c_int = 64; pub const TTYDISC: ::c_int = 0; pub const TABLDISC: ::c_int = 3; pub const SLIPDISC: ::c_int = 4; -pub const TANDEM: tcflag_t = 1; -pub const CBREAK: tcflag_t = 2; -pub const LCASE: tcflag_t = 4; -pub const CRMOD: tcflag_t = 16; -pub const RAW: tcflag_t = 32; -pub const ODDP: tcflag_t = 64; -pub const EVENP: tcflag_t = 128; -pub const ANYP: tcflag_t = 192; -pub const NLDELAY: tcflag_t = 768; -pub const NL2: tcflag_t = 512; -pub const NL3: tcflag_t = 768; -pub const TBDELAY: tcflag_t = 3072; -pub const XTABS: tcflag_t = 3072; -pub const CRDELAY: tcflag_t = 12288; -pub const VTDELAY: tcflag_t = 16384; -pub const BSDELAY: tcflag_t = 32768; -pub const ALLDELAY: tcflag_t = 65280; -pub const CRTBS: tcflag_t = 65536; -pub const PRTERA: tcflag_t = 131072; -pub const CRTERA: tcflag_t = 262144; -pub const TILDE: tcflag_t = 524288; -pub const LITOUT: tcflag_t = 2097152; -pub const NOHANG: tcflag_t = 16777216; -pub const L001000: tcflag_t = 33554432; -pub const CRTKIL: tcflag_t = 67108864; -pub const PASS8: tcflag_t = 134217728; -pub const CTLECH: tcflag_t = 268435456; -pub const DECCTQ: tcflag_t = 1073741824; +pub const TANDEM: ::tcflag_t = 1; +pub const CBREAK: ::tcflag_t = 2; +pub const LCASE: ::tcflag_t = 4; +pub const CRMOD: ::tcflag_t = 16; +pub const RAW: ::tcflag_t = 32; +pub const ODDP: ::tcflag_t = 64; +pub const EVENP: ::tcflag_t = 128; +pub const ANYP: ::tcflag_t = 192; +pub const NLDELAY: ::tcflag_t = 768; +pub const NL2: ::tcflag_t = 512; +pub const NL3: ::tcflag_t = 768; +pub const TBDELAY: ::tcflag_t = 3072; +pub const XTABS: ::tcflag_t = 3072; +pub const CRDELAY: ::tcflag_t = 12288; +pub const VTDELAY: ::tcflag_t = 16384; +pub const BSDELAY: ::tcflag_t = 32768; +pub const ALLDELAY: ::tcflag_t = 65280; +pub const CRTBS: ::tcflag_t = 65536; +pub const PRTERA: ::tcflag_t = 131072; +pub const CRTERA: ::tcflag_t = 262144; +pub const TILDE: ::tcflag_t = 524288; +pub const LITOUT: ::tcflag_t = 2097152; +pub const NOHANG: ::tcflag_t = 16777216; +pub const L001000: ::tcflag_t = 33554432; +pub const CRTKIL: ::tcflag_t = 67108864; +pub const PASS8: ::tcflag_t = 134217728; +pub const CTLECH: ::tcflag_t = 268435456; +pub const DECCTQ: ::tcflag_t = 1073741824; pub const FIONBIO: ::c_ulong = 0xa008007e; pub const FIONREAD: ::c_ulong = 0x6008007f; @@ -2007,7 +2695,6 @@ pub const TCPOPT_TSTAMP_HDR: u32 = 16844810; pub const TCP_MSS: usize = 512; pub const TCP_MAXWIN: usize = 65535; pub const TCP_MAX_WINSHIFT: usize = 14; -pub const SOL_TCP: ::c_int = 6; pub const TCPI_OPT_TIMESTAMPS: u8 = 1; pub const TCPI_OPT_SACK: u8 = 2; pub const TCPI_OPT_WSCALE: u8 = 4; @@ -2042,21 +2729,64 @@ pub const PROT_NONE: ::c_int = 0; pub const PROT_READ: ::c_int = 4; pub const PROT_WRITE: ::c_int = 2; pub const PROT_EXEC: ::c_int = 1; -pub const MAP_PRIVATE: ::c_int = 0; pub const MAP_FILE: ::c_int = 1; pub const MAP_ANON: ::c_int = 2; -pub const MAP_SHARED: ::c_int = 16; +pub const MAP_ANONYMOUS: ::c_int = MAP_ANON; +pub const MAP_TYPE: ::c_int = 15; pub const MAP_COPY: ::c_int = 32; +pub const MAP_SHARED: ::c_int = 16; +pub const MAP_PRIVATE: ::c_int = 0; pub const MAP_FIXED: ::c_int = 256; +pub const MAP_NOEXTEND: ::c_int = 512; +pub const MAP_HASSEMPHORE: ::c_int = 1024; +pub const MAP_INHERIT: ::c_int = 2048; pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void; -pub const MS_SYNC: ::c_int = 0; -pub const MS_ASYNC: ::c_int = 1; -pub const MS_INVALIDATE: ::c_int = 2; pub const MADV_NORMAL: ::c_int = 0; pub const MADV_RANDOM: ::c_int = 1; pub const MADV_SEQUENTIAL: ::c_int = 2; pub const MADV_WILLNEED: ::c_int = 3; pub const MADV_DONTNEED: ::c_int = 4; +pub const POSIX_MADV_NORMAL: ::c_int = 0; +pub const POSIX_MADV_RANDOM: ::c_int = 1; +pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; +pub const POSIX_MADV_WILLNEED: ::c_int = 3; +pub const POSIX_MADV_WONTNEED: ::c_int = 4; + +pub const MS_ASYNC: ::c_int = 1; +pub const MS_SYNC: ::c_int = 0; +pub const MS_INVALIDATE: ::c_int = 2; +pub const MREMAP_MAYMOVE: ::c_int = 1; +pub const MREMAP_FIXED: ::c_int = 2; +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; + +// spawn.h +pub const POSIX_SPAWN_USEVFORK: ::c_int = 64; +pub const POSIX_SPAWN_SETSID: ::c_int = 128; + +// sys/syslog.h +pub const LOG_CRON: ::c_int = 9 << 3; +pub const LOG_AUTHPRIV: ::c_int = 10 << 3; +pub const LOG_FTP: ::c_int = 11 << 3; +pub const LOG_PERROR: ::c_int = 0x20; + +// net/if.h +pub const IFF_UP: ::c_int = 0x1; +pub const IFF_BROADCAST: ::c_int = 0x2; +pub const IFF_DEBUG: ::c_int = 0x4; +pub const IFF_LOOPBACK: ::c_int = 0x8; +pub const IFF_POINTOPOINT: ::c_int = 0x10; +pub const IFF_NOTRAILERS: ::c_int = 0x20; +pub const IFF_RUNNING: ::c_int = 0x40; +pub const IFF_NOARP: ::c_int = 0x80; +pub const IFF_PROMISC: ::c_int = 0x100; +pub const IFF_ALLMULTI: ::c_int = 0x200; +pub const IFF_MASTER: ::c_int = 0x400; +pub const IFF_SLAVE: ::c_int = 0x800; +pub const IFF_MULTICAST: ::c_int = 0x1000; +pub const IFF_PORTSEL: ::c_int = 0x2000; +pub const IFF_AUTOMEDIA: ::c_int = 0x4000; +pub const IFF_DYNAMIC: ::c_int = 0x8000; // random.h pub const GRND_NONBLOCK: ::c_uint = 1; @@ -2391,21 +3121,21 @@ pub const PTHREAD_MUTEX_RECURSIVE: __pthread_mutex_type = 2; pub const PTHREAD_MUTEX_STALLED: __pthread_mutex_robustness = 0; pub const PTHREAD_MUTEX_ROBUST: __pthread_mutex_robustness = 256; -pub const RLIMIT_CPU: __rlimit_resource = 0; -pub const RLIMIT_FSIZE: __rlimit_resource = 1; -pub const RLIMIT_DATA: __rlimit_resource = 2; -pub const RLIMIT_STACK: __rlimit_resource = 3; -pub const RLIMIT_CORE: __rlimit_resource = 4; -pub const RLIMIT_RSS: __rlimit_resource = 5; -pub const RLIMIT_MEMLOCK: __rlimit_resource = 6; -pub const RLIMIT_NPROC: __rlimit_resource = 7; -pub const RLIMIT_OFILE: __rlimit_resource = 8; -pub const RLIMIT_NOFILE: __rlimit_resource = 8; -pub const RLIMIT_SBSIZE: __rlimit_resource = 9; -pub const RLIMIT_AS: __rlimit_resource = 10; -pub const RLIMIT_VMEM: __rlimit_resource = 10; -pub const RLIMIT_NLIMITS: __rlimit_resource = 11; -pub const RLIM_NLIMITS: __rlimit_resource = 11; +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_RSS: ::__rlimit_resource_t = 5; +pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 6; +pub const RLIMIT_NPROC: ::__rlimit_resource_t = 7; +pub const RLIMIT_OFILE: ::__rlimit_resource_t = 8; +pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 8; +pub const RLIMIT_SBSIZE: ::__rlimit_resource_t = 9; +pub const RLIMIT_AS: ::__rlimit_resource_t = 10; +pub const RLIMIT_VMEM: ::__rlimit_resource_t = 10; +pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = 11; +pub const RLIM_NLIMITS: ::__rlimit_resource_t = 11; pub const RUSAGE_SELF: __rusage_who = 0; pub const RUSAGE_CHILDREN: __rusage_who = -1; @@ -2414,6 +3144,10 @@ pub const PRIO_PROCESS: __priority_which = 0; pub const PRIO_PGRP: __priority_which = 1; pub const PRIO_USER: __priority_which = 2; +pub const __UT_LINESIZE: usize = 32; +pub const __UT_NAMESIZE: usize = 32; +pub const __UT_HOSTSIZE: usize = 256; + pub const SOCK_STREAM: ::c_int = 1; pub const SOCK_DGRAM: ::c_int = 2; pub const SOCK_RAW: ::c_int = 3; @@ -2431,6 +3165,7 @@ pub const MSG_CTRUNC: ::c_int = 32; pub const MSG_WAITALL: ::c_int = 64; pub const MSG_DONTWAIT: ::c_int = 128; pub const MSG_NOSIGNAL: ::c_int = 1024; +pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000; pub const SCM_RIGHTS: ::c_int = 1; pub const SCM_TIMESTAMP: ::c_int = 2; @@ -2693,8 +3428,105 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t { }; pub const PTHREAD_STACK_MIN: ::size_t = 0; +const_fn! { + {const} fn CMSG_ALIGN(len: usize) -> usize { + len + ::mem::size_of::() - 1 & !(::mem::size_of::() - 1) + } +} + // functions f! { + pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr { + if (*mhdr).msg_controllen as usize >= ::mem::size_of::() { + (*mhdr).msg_control as *mut cmsghdr + } else { + 0 as *mut cmsghdr + } + } + + pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut ::c_uchar { + cmsg.offset(1) as *mut ::c_uchar + } + + pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint { + (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::())) + as ::c_uint + } + + pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint { + CMSG_ALIGN(::mem::size_of::()) as ::c_uint + length + } + + pub fn CMSG_NXTHDR(mhdr: *const msghdr, + cmsg: *const cmsghdr) -> *mut cmsghdr { + if ((*cmsg).cmsg_len as usize) < ::mem::size_of::() { + return 0 as *mut cmsghdr; + }; + let next = (cmsg as usize + + CMSG_ALIGN((*cmsg).cmsg_len as usize)) + as *mut cmsghdr; + let max = (*mhdr).msg_control as usize + + (*mhdr).msg_controllen as usize; + if (next.offset(1)) as usize > max || + next as usize + CMSG_ALIGN((*next).cmsg_len as usize) > max + { + 0 as *mut cmsghdr + } else { + next as *mut cmsghdr + } + } + + pub fn CPU_ALLOC_SIZE(count: ::c_int) -> ::size_t { + let _dummy: cpu_set_t = ::mem::zeroed(); + let size_in_bits = 8 * ::mem::size_of_val(&_dummy.bits[0]); + ((count as ::size_t + size_in_bits - 1) / 8) as ::size_t + } + + pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { + for slot in cpuset.bits.iter_mut() { + *slot = 0; + } + } + + pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { + let size_in_bits + = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); + cpuset.bits[idx] |= 1 << offset; + () + } + + pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { + let size_in_bits + = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc + let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); + cpuset.bits[idx] &= !(1 << offset); + () + } + + pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool { + let size_in_bits = 8 * ::mem::size_of_val(&cpuset.bits[0]); + let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits); + 0 != (cpuset.bits[idx] & (1 << offset)) + } + + pub fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> ::c_int { + let mut s: u32 = 0; + let size_of_mask = ::mem::size_of_val(&cpuset.bits[0]); + for i in cpuset.bits[..(size / size_of_mask)].iter() { + s += i.count_ones(); + }; + s as ::c_int + } + + pub fn CPU_COUNT(cpuset: &cpu_set_t) -> ::c_int { + CPU_COUNT_S(::mem::size_of::(), cpuset) + } + + pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool { + set1.bits == set2.bits + } + pub fn major(dev: ::dev_t) -> ::c_uint { ((dev >> 8) & 0xff) as ::c_uint } @@ -2703,6 +3535,14 @@ f! { (dev & 0xffff00ff) as ::c_uint } + pub fn IPTOS_TOS(tos: u8) -> u8 { + tos & IPTOS_TOS_MASK + } + + pub fn IPTOS_PREC(tos: u8) -> u8 { + tos & IPTOS_PREC_MASK + } + pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () { let fd = fd as usize; let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8; @@ -2756,11 +3596,26 @@ extern "C" { pub fn __libc_current_sigrtmax() -> ::c_int; + pub fn wait4( + pid: ::pid_t, + status: *mut ::c_int, + options: ::c_int, + rusage: *mut ::rusage, + ) -> ::pid_t; + pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int) -> ::c_int; pub fn sigwait(__set: *const sigset_t, __sig: *mut ::c_int) -> ::c_int; + pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int; + pub fn sigtimedwait( + set: *const sigset_t, + info: *mut siginfo_t, + timeout: *const ::timespec, + ) -> ::c_int; + pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int; + pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int; pub fn ioctl(__fd: ::c_int, __request: ::c_ulong, ...) -> ::c_int; @@ -2806,10 +3661,72 @@ extern "C" { offset: ::off64_t, ) -> ::ssize_t; + pub fn fread_unlocked( + buf: *mut ::c_void, + size: ::size_t, + nobj: ::size_t, + stream: *mut ::FILE, + ) -> ::size_t; + + pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int; + pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int; + pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int; + pub fn aio_error(aiocbp: *const aiocb) -> ::c_int; + pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t; + pub fn aio_suspend( + aiocb_list: *const *const aiocb, + nitems: ::c_int, + timeout: *const ::timespec, + ) -> ::c_int; + pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int; + pub fn lio_listio( + mode: ::c_int, + aiocb_list: *const *mut aiocb, + nitems: ::c_int, + sevp: *mut ::sigevent, + ) -> ::c_int; + + pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t; + pub fn mq_close(mqd: ::mqd_t) -> ::c_int; + pub fn mq_unlink(name: *const ::c_char) -> ::c_int; + pub fn mq_receive( + mqd: ::mqd_t, + msg_ptr: *mut ::c_char, + msg_len: ::size_t, + msg_prio: *mut ::c_uint, + ) -> ::ssize_t; + pub fn mq_timedreceive( + mqd: ::mqd_t, + msg_ptr: *mut ::c_char, + msg_len: ::size_t, + msg_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, + msg_prio: ::c_uint, + ) -> ::c_int; + pub fn mq_timedsend( + mqd: ::mqd_t, + msg_ptr: *const ::c_char, + msg_len: ::size_t, + msg_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 lseek64(__fd: ::c_int, __offset: __off64_t, __whence: ::c_int) -> __off64_t; pub fn lseek(__fd: ::c_int, __offset: __off_t, __whence: ::c_int) -> __off_t; + pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int; + pub fn fseeko64(stream: *mut ::FILE, offset: ::off64_t, whence: ::c_int) -> ::c_int; + pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int; + pub fn ftello64(stream: *mut ::FILE) -> ::off64_t; + pub fn bind(__fd: ::c_int, __addr: *const sockaddr, __len: socklen_t) -> ::c_int; pub fn accept4( @@ -2819,6 +3736,13 @@ extern "C" { flg: ::c_int, ) -> ::c_int; + pub fn ppoll( + fds: *mut ::pollfd, + nfds: nfds_t, + timeout: *const ::timespec, + sigmask: *const sigset_t, + ) -> ::c_int; + pub fn recvmsg(__fd: ::c_int, __message: *mut msghdr, __flags: ::c_int) -> ::ssize_t; pub fn sendmsg(__fd: ::c_int, __message: *const msghdr, __flags: ::c_int) -> ssize_t; @@ -2832,12 +3756,95 @@ extern "C" { addrlen: *mut ::socklen_t, ) -> ::ssize_t; + pub fn sendfile( + out_fd: ::c_int, + in_fd: ::c_int, + offset: *mut off_t, + count: ::size_t, + ) -> ::ssize_t; + pub fn sendfile64( + out_fd: ::c_int, + in_fd: ::c_int, + offset: *mut off64_t, + count: ::size_t, + ) -> ::ssize_t; + pub fn shutdown(__fd: ::c_int, __how: ::c_int) -> ::c_int; pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int; + pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int; + pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int; + pub fn if_nameindex() -> *mut if_nameindex; + pub fn if_freenameindex(ptr: *mut if_nameindex); + + pub fn getnameinfo( + sa: *const ::sockaddr, + salen: ::socklen_t, + host: *mut ::c_char, + hostlen: ::socklen_t, + serv: *mut ::c_char, + servlen: ::socklen_t, + flags: ::c_int, + ) -> ::c_int; + + pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int; + pub fn freeifaddrs(ifa: *mut ::ifaddrs); pub fn uname(buf: *mut ::utsname) -> ::c_int; + pub fn gethostid() -> ::c_long; + pub fn sethostid(hostid: ::c_long) -> ::c_int; + + pub fn setpwent(); + pub fn endpwent(); + pub fn getpwent() -> *mut passwd; + pub fn setgrent(); + pub fn endgrent(); + pub fn getgrent() -> *mut ::group; + pub fn setspent(); + pub fn endspent(); + pub fn getspent() -> *mut spwd; + + pub fn getspnam(name: *const ::c_char) -> *mut spwd; + + pub fn getpwent_r( + pwd: *mut ::passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::passwd, + ) -> ::c_int; + pub fn getgrent_r( + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group, + ) -> ::c_int; + pub fn fgetpwent_r( + stream: *mut ::FILE, + pwd: *mut ::passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::passwd, + ) -> ::c_int; + pub fn fgetgrent_r( + stream: *mut ::FILE, + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group, + ) -> ::c_int; + + pub fn putpwent(p: *const ::passwd, stream: *mut ::FILE) -> ::c_int; + pub fn putgrent(grp: *const ::group, stream: *mut ::FILE) -> ::c_int; + + pub fn getpwnam_r( + name: *const ::c_char, + pwd: *mut passwd, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut passwd, + ) -> ::c_int; + pub fn getpwuid_r( uid: ::uid_t, pwd: *mut passwd, @@ -2846,23 +3853,111 @@ extern "C" { result: *mut *mut passwd, ) -> ::c_int; + pub fn fgetspent_r( + fp: *mut ::FILE, + spbuf: *mut ::spwd, + buf: *mut ::c_char, + buflen: ::size_t, + spbufp: *mut *mut ::spwd, + ) -> ::c_int; + pub fn sgetspent_r( + s: *const ::c_char, + spbuf: *mut ::spwd, + buf: *mut ::c_char, + buflen: ::size_t, + spbufp: *mut *mut ::spwd, + ) -> ::c_int; + pub fn getspent_r( + spbuf: *mut ::spwd, + buf: *mut ::c_char, + buflen: ::size_t, + spbufp: *mut *mut ::spwd, + ) -> ::c_int; + + pub fn getspnam_r( + name: *const ::c_char, + spbuf: *mut spwd, + buf: *mut ::c_char, + buflen: ::size_t, + spbufp: *mut *mut spwd, + ) -> ::c_int; + + // mntent.h + pub fn getmntent_r( + stream: *mut ::FILE, + mntbuf: *mut ::mntent, + buf: *mut ::c_char, + buflen: ::c_int, + ) -> *mut ::mntent; + + pub fn utmpname(file: *const ::c_char) -> ::c_int; + pub fn utmpxname(file: *const ::c_char) -> ::c_int; + pub fn getutxent() -> *mut utmpx; + pub fn getutxid(ut: *const utmpx) -> *mut utmpx; + pub fn getutxline(ut: *const utmpx) -> *mut utmpx; + pub fn pututxline(ut: *const utmpx) -> *mut utmpx; + pub fn setutxent(); + pub fn endutxent(); + + pub fn getresuid(ruid: *mut ::uid_t, euid: *mut ::uid_t, suid: *mut ::uid_t) -> ::c_int; + pub fn getresgid(rgid: *mut ::gid_t, egid: *mut ::gid_t, sgid: *mut ::gid_t) -> ::c_int; + pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int; + pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int; + + pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int; + + pub fn getgrgid(gid: ::gid_t) -> *mut ::group; + pub fn getgrgid_r( + gid: ::gid_t, + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group, + ) -> ::c_int; + + pub fn getgrnam(name: *const ::c_char) -> *mut ::group; + pub fn getgrnam_r( + name: *const ::c_char, + grp: *mut ::group, + buf: *mut ::c_char, + buflen: ::size_t, + result: *mut *mut ::group, + ) -> ::c_int; + + pub fn getgrouplist( + user: *const ::c_char, + group: ::gid_t, + groups: *mut ::gid_t, + ngroups: *mut ::c_int, + ) -> ::c_int; + pub fn setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int; + pub fn acct(filename: *const ::c_char) -> ::c_int; + + pub fn setmntent(filename: *const ::c_char, ty: *const ::c_char) -> *mut ::FILE; + pub fn getmntent(stream: *mut ::FILE) -> *mut ::mntent; + pub fn addmntent(stream: *mut ::FILE, mnt: *const ::mntent) -> ::c_int; + pub fn endmntent(streamp: *mut ::FILE) -> ::c_int; + pub fn hasmntopt(mnt: *const ::mntent, opt: *const ::c_char) -> *mut ::c_char; + pub fn pthread_create( native: *mut ::pthread_t, attr: *const ::pthread_attr_t, f: extern "C" fn(*mut ::c_void) -> *mut ::c_void, value: *mut ::c_void, ) -> ::c_int; - pub fn pthread_kill(__threadid: pthread_t, __signo: ::c_int) -> ::c_int; + pub fn pthread_kill(__threadid: ::pthread_t, __signo: ::c_int) -> ::c_int; + pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int; pub fn __pthread_equal(__t1: __pthread_t, __t2: __pthread_t) -> ::c_int; - pub fn pthread_getattr_np(__thr: pthread_t, __attr: *mut pthread_attr_t) -> ::c_int; + pub fn pthread_getattr_np(__thr: ::pthread_t, __attr: *mut pthread_attr_t) -> ::c_int; pub fn pthread_attr_getguardsize( __attr: *const pthread_attr_t, __guardsize: *mut ::size_t, ) -> ::c_int; + pub fn pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::size_t) -> ::c_int; pub fn pthread_attr_getstack( __attr: *const pthread_attr_t, @@ -2870,11 +3965,64 @@ extern "C" { __stacksize: *mut ::size_t, ) -> ::c_int; + pub fn pthread_mutexattr_getpshared( + attr: *const pthread_mutexattr_t, + pshared: *mut ::c_int, + ) -> ::c_int; + pub fn pthread_mutexattr_setpshared( + attr: *mut pthread_mutexattr_t, + pshared: ::c_int, + ) -> ::c_int; + + pub fn pthread_mutex_timedlock( + lock: *mut pthread_mutex_t, + abstime: *const ::timespec, + ) -> ::c_int; + + pub fn pthread_rwlockattr_getpshared( + attr: *const pthread_rwlockattr_t, + val: *mut ::c_int, + ) -> ::c_int; + pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: ::c_int) -> ::c_int; + + pub fn pthread_condattr_getclock( + attr: *const pthread_condattr_t, + clock_id: *mut clockid_t, + ) -> ::c_int; pub fn pthread_condattr_setclock( __attr: *mut pthread_condattr_t, __clock_id: __clockid_t, ) -> ::c_int; + pub fn pthread_condattr_getpshared( + attr: *const pthread_condattr_t, + pshared: *mut ::c_int, + ) -> ::c_int; + pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: ::c_int) -> ::c_int; + + pub fn pthread_once(control: *mut pthread_once_t, routine: extern "C" fn()) -> ::c_int; + pub fn pthread_barrierattr_init(attr: *mut ::pthread_barrierattr_t) -> ::c_int; + pub fn pthread_barrierattr_destroy(attr: *mut ::pthread_barrierattr_t) -> ::c_int; + pub fn pthread_barrierattr_getpshared( + attr: *const ::pthread_barrierattr_t, + shared: *mut ::c_int, + ) -> ::c_int; + pub fn pthread_barrierattr_setpshared( + attr: *mut ::pthread_barrierattr_t, + shared: ::c_int, + ) -> ::c_int; + pub fn pthread_barrier_init( + barrier: *mut pthread_barrier_t, + attr: *const ::pthread_barrierattr_t, + count: ::c_uint, + ) -> ::c_int; + pub fn pthread_barrier_destroy(barrier: *mut pthread_barrier_t) -> ::c_int; + pub fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> ::c_int; + pub fn pthread_spin_init(lock: *mut ::pthread_spinlock_t, pshared: ::c_int) -> ::c_int; + pub fn pthread_spin_destroy(lock: *mut ::pthread_spinlock_t) -> ::c_int; + pub fn pthread_spin_lock(lock: *mut ::pthread_spinlock_t) -> ::c_int; + pub fn pthread_spin_trylock(lock: *mut ::pthread_spinlock_t) -> ::c_int; + pub fn pthread_spin_unlock(lock: *mut ::pthread_spinlock_t) -> ::c_int; pub fn pthread_atfork( prepare: ::Option, parent: ::Option, @@ -2887,9 +4035,72 @@ extern "C" { __oldmask: *mut __sigset_t, ) -> ::c_int; + pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int; + pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int; + pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int; + pub fn sched_setscheduler( + pid: ::pid_t, + policy: ::c_int, + param: *const ::sched_param, + ) -> ::c_int; + pub fn pthread_getschedparam( + native: ::pthread_t, + policy: *mut ::c_int, + param: *mut ::sched_param, + ) -> ::c_int; + pub fn pthread_setschedparam( + native: ::pthread_t, + policy: ::c_int, + param: *const ::sched_param, + ) -> ::c_int; + + pub fn pthread_getcpuclockid(thread: ::pthread_t, clk_id: *mut ::clockid_t) -> ::c_int; + + pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int; + pub fn sem_destroy(sem: *mut sem_t) -> ::c_int; + pub fn sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int; + pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int; + pub fn clock_getres(__clock_id: clockid_t, __res: *mut ::timespec) -> ::c_int; pub fn clock_gettime(__clock_id: clockid_t, __tp: *mut ::timespec) -> ::c_int; pub fn clock_settime(__clock_id: clockid_t, __tp: *const ::timespec) -> ::c_int; + pub fn clock_getcpuclockid(pid: ::pid_t, clk_id: *mut ::clockid_t) -> ::c_int; + + pub fn clock_nanosleep( + clk_id: ::clockid_t, + flags: ::c_int, + rqtp: *const ::timespec, + rmtp: *mut ::timespec, + ) -> ::c_int; + + pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int; + pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int; + + pub fn asctime_r(tm: *const ::tm, buf: *mut ::c_char) -> *mut ::c_char; + pub fn ctime_r(timep: *const time_t, buf: *mut ::c_char) -> *mut ::c_char; + + pub fn strftime( + s: *mut ::c_char, + max: ::size_t, + format: *const ::c_char, + tm: *const ::tm, + ) -> ::size_t; + pub fn strptime(s: *const ::c_char, format: *const ::c_char, tm: *mut ::tm) -> *mut ::c_char; + + pub fn timer_create( + clockid: ::clockid_t, + sevp: *mut ::sigevent, + timerid: *mut ::timer_t, + ) -> ::c_int; + pub fn timer_delete(timerid: ::timer_t) -> ::c_int; + pub fn timer_getoverrun(timerid: ::timer_t) -> ::c_int; + pub fn timer_gettime(timerid: ::timer_t, curr_value: *mut ::itimerspec) -> ::c_int; + pub fn timer_settime( + timerid: ::timer_t, + flags: ::c_int, + new_value: *const ::itimerspec, + old_value: *mut ::itimerspec, + ) -> ::c_int; pub fn fstat(__fd: ::c_int, __buf: *mut stat) -> ::c_int; pub fn fstat64(__fd: ::c_int, __buf: *mut stat64) -> ::c_int; @@ -2907,6 +4118,14 @@ extern "C" { __flag: ::c_int, ) -> ::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 ftruncate(__fd: ::c_int, __length: __off_t) -> ::c_int; pub fn ftruncate64(__fd: ::c_int, __length: __off64_t) -> ::c_int; pub fn truncate64(__file: *const ::c_char, __length: __off64_t) -> ::c_int; @@ -2930,6 +4149,175 @@ extern "C" { pub fn openat(__fd: ::c_int, __file: *const ::c_char, __oflag: ::c_int, ...) -> ::c_int; pub fn openat64(__fd: ::c_int, __file: *const ::c_char, __oflag: ::c_int, ...) -> ::c_int; + pub fn fopen64(filename: *const c_char, mode: *const c_char) -> *mut ::FILE; + pub fn freopen64( + filename: *const c_char, + mode: *const c_char, + file: *mut ::FILE, + ) -> *mut ::FILE; + + pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int; + + pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int; + pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int; + pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int; + pub fn tmpfile64() -> *mut ::FILE; + + pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE; + + pub fn getdtablesize() -> ::c_int; + + // Added in `glibc` 2.34 + pub fn close_range(first: ::c_uint, last: ::c_uint, flags: ::c_int) -> ::c_int; + + pub fn openpty( + __amaster: *mut ::c_int, + __aslave: *mut ::c_int, + __name: *mut ::c_char, + __termp: *const termios, + __winp: *const ::winsize, + ) -> ::c_int; + + pub fn forkpty( + __amaster: *mut ::c_int, + __name: *mut ::c_char, + __termp: *const termios, + __winp: *const ::winsize, + ) -> ::pid_t; + + pub fn getpt() -> ::c_int; + pub fn ptsname_r(fd: ::c_int, buf: *mut ::c_char, buflen: ::size_t) -> ::c_int; + pub fn login_tty(fd: ::c_int) -> ::c_int; + + pub fn ctermid(s: *mut ::c_char) -> *mut ::c_char; + + pub fn clearenv() -> ::c_int; + + pub fn execveat( + dirfd: ::c_int, + pathname: *const ::c_char, + argv: *const *mut c_char, + envp: *const *mut c_char, + flags: ::c_int, + ) -> ::c_int; + pub fn execvpe( + file: *const ::c_char, + argv: *const *const ::c_char, + envp: *const *const ::c_char, + ) -> ::c_int; + pub fn fexecve( + fd: ::c_int, + argv: *const *const ::c_char, + envp: *const *const ::c_char, + ) -> ::c_int; + + pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int; + + // posix/spawn.h + pub fn posix_spawn( + pid: *mut ::pid_t, + path: *const ::c_char, + file_actions: *const ::posix_spawn_file_actions_t, + attrp: *const ::posix_spawnattr_t, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char, + ) -> ::c_int; + pub fn posix_spawnp( + pid: *mut ::pid_t, + file: *const ::c_char, + file_actions: *const ::posix_spawn_file_actions_t, + attrp: *const ::posix_spawnattr_t, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char, + ) -> ::c_int; + pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int; + pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int; + pub fn posix_spawnattr_getsigdefault( + attr: *const posix_spawnattr_t, + default: *mut ::sigset_t, + ) -> ::c_int; + pub fn posix_spawnattr_setsigdefault( + attr: *mut posix_spawnattr_t, + default: *const ::sigset_t, + ) -> ::c_int; + pub fn posix_spawnattr_getsigmask( + attr: *const posix_spawnattr_t, + default: *mut ::sigset_t, + ) -> ::c_int; + pub fn posix_spawnattr_setsigmask( + attr: *mut posix_spawnattr_t, + default: *const ::sigset_t, + ) -> ::c_int; + pub fn posix_spawnattr_getflags( + attr: *const posix_spawnattr_t, + flags: *mut ::c_short, + ) -> ::c_int; + pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: ::c_short) -> ::c_int; + pub fn posix_spawnattr_getpgroup( + attr: *const posix_spawnattr_t, + flags: *mut ::pid_t, + ) -> ::c_int; + pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: ::pid_t) -> ::c_int; + pub fn posix_spawnattr_getschedpolicy( + attr: *const posix_spawnattr_t, + flags: *mut ::c_int, + ) -> ::c_int; + pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: ::c_int) -> ::c_int; + pub fn posix_spawnattr_getschedparam( + attr: *const posix_spawnattr_t, + param: *mut ::sched_param, + ) -> ::c_int; + pub fn posix_spawnattr_setschedparam( + attr: *mut posix_spawnattr_t, + param: *const ::sched_param, + ) -> ::c_int; + + pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> ::c_int; + pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> ::c_int; + pub fn posix_spawn_file_actions_addopen( + actions: *mut posix_spawn_file_actions_t, + fd: ::c_int, + path: *const ::c_char, + oflag: ::c_int, + mode: ::mode_t, + ) -> ::c_int; + pub fn posix_spawn_file_actions_addclose( + actions: *mut posix_spawn_file_actions_t, + fd: ::c_int, + ) -> ::c_int; + pub fn posix_spawn_file_actions_adddup2( + actions: *mut posix_spawn_file_actions_t, + fd: ::c_int, + newfd: ::c_int, + ) -> ::c_int; + + // Added in `glibc` 2.29 + pub fn posix_spawn_file_actions_addchdir_np( + actions: *mut ::posix_spawn_file_actions_t, + path: *const ::c_char, + ) -> ::c_int; + // Added in `glibc` 2.29 + pub fn posix_spawn_file_actions_addfchdir_np( + actions: *mut ::posix_spawn_file_actions_t, + fd: ::c_int, + ) -> ::c_int; + // Added in `glibc` 2.34 + pub fn posix_spawn_file_actions_addclosefrom_np( + actions: *mut ::posix_spawn_file_actions_t, + from: ::c_int, + ) -> ::c_int; + // Added in `glibc` 2.35 + pub fn posix_spawn_file_actions_addtcsetpgrp_np( + actions: *mut ::posix_spawn_file_actions_t, + tcfd: ::c_int, + ) -> ::c_int; + + pub fn shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int; + pub fn shm_unlink(name: *const ::c_char) -> ::c_int; + + pub fn euidaccess(pathname: *const ::c_char, mode: ::c_int) -> ::c_int; + pub fn eaccess(pathname: *const ::c_char, mode: ::c_int) -> ::c_int; + pub fn faccessat( dirfd: ::c_int, pathname: *const ::c_char, @@ -2944,6 +4332,13 @@ extern "C" { pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64; pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, result: *mut *mut ::dirent) -> ::c_int; + pub fn readdir64_r( + dirp: *mut ::DIR, + entry: *mut ::dirent64, + result: *mut *mut ::dirent64, + ) -> ::c_int; + pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long); + pub fn telldir(dirp: *mut ::DIR) -> ::c_long; pub fn dirfd(dirp: *mut ::DIR) -> ::c_int; @@ -2961,6 +4356,14 @@ extern "C" { __offset: __off64_t, ) -> *mut ::c_void; + pub fn mremap( + addr: *mut ::c_void, + len: ::size_t, + new_len: ::size_t, + flags: ::c_int, + ... + ) -> *mut ::c_void; + pub fn mprotect(__addr: *mut ::c_void, __len: ::size_t, __prot: ::c_int) -> ::c_int; pub fn msync(__addr: *mut ::c_void, __len: ::size_t, __flags: ::c_int) -> ::c_int; @@ -2983,10 +4386,12 @@ extern "C" { pub fn madvise(__addr: *mut ::c_void, __len: ::size_t, __advice: ::c_int) -> ::c_int; - pub fn getrlimit(resource: ::__rlimit_resource, rlim: *mut ::rlimit) -> ::c_int; - pub fn getrlimit64(resource: ::__rlimit_resource, rlim: *mut ::rlimit64) -> ::c_int; - pub fn setrlimit(resource: ::__rlimit_resource, rlim: *const ::rlimit) -> ::c_int; - pub fn setrlimit64(resource: ::__rlimit_resource, rlim: *const ::rlimit64) -> ::c_int; + pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int; + + pub fn getrlimit(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit) -> ::c_int; + pub fn getrlimit64(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit64) -> ::c_int; + pub fn setrlimit(resource: ::__rlimit_resource_t, rlim: *const ::rlimit) -> ::c_int; + pub fn setrlimit64(resource: ::__rlimit_resource_t, rlim: *const ::rlimit64) -> ::c_int; pub fn getpriority(which: ::__priority_which, who: ::id_t) -> ::c_int; pub fn setpriority(which: ::__priority_which, who: ::id_t, prio: ::c_int) -> ::c_int; @@ -2994,7 +4399,179 @@ extern "C" { pub fn getrandom(__buffer: *mut ::c_void, __length: ::size_t, __flags: ::c_uint) -> ::ssize_t; pub fn getentropy(__buffer: *mut ::c_void, __length: ::size_t) -> ::c_int; + pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void; + pub fn memmem( + haystack: *const ::c_void, + haystacklen: ::size_t, + needle: *const ::c_void, + needlelen: ::size_t, + ) -> *mut ::c_void; + pub fn strchrnul(s: *const ::c_char, c: ::c_int) -> *mut ::c_char; + + pub fn abs(i: ::c_int) -> ::c_int; + pub fn labs(i: ::c_long) -> ::c_long; + pub fn rand() -> ::c_int; + pub fn srand(seed: ::c_uint); + + pub fn drand48() -> ::c_double; + pub fn erand48(xseed: *mut ::c_ushort) -> ::c_double; + pub fn lrand48() -> ::c_long; + pub fn nrand48(xseed: *mut ::c_ushort) -> ::c_long; + pub fn mrand48() -> ::c_long; + pub fn jrand48(xseed: *mut ::c_ushort) -> ::c_long; + pub fn srand48(seed: ::c_long); + pub fn seed48(xseed: *mut ::c_ushort) -> *mut ::c_ushort; + pub fn lcong48(p: *mut ::c_ushort); + + pub fn qsort_r( + base: *mut ::c_void, + num: ::size_t, + size: ::size_t, + compar: ::Option< + unsafe extern "C" fn(*const ::c_void, *const ::c_void, *mut ::c_void) -> ::c_int, + >, + arg: *mut ::c_void, + ); + + pub fn brk(addr: *mut ::c_void) -> ::c_int; + pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void; + + pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void; + pub fn mallopt(param: ::c_int, value: ::c_int) -> ::c_int; + + pub fn mallinfo() -> ::mallinfo; + pub fn mallinfo2() -> ::mallinfo2; + pub fn malloc_info(options: ::c_int, stream: *mut ::FILE) -> ::c_int; + pub fn malloc_usable_size(ptr: *mut ::c_void) -> ::size_t; + pub fn malloc_trim(__pad: ::size_t) -> ::c_int; + + pub fn iconv_open(tocode: *const ::c_char, fromcode: *const ::c_char) -> iconv_t; + pub fn iconv( + cd: iconv_t, + inbuf: *mut *mut ::c_char, + inbytesleft: *mut ::size_t, + outbuf: *mut *mut ::c_char, + outbytesleft: *mut ::size_t, + ) -> ::size_t; + pub fn iconv_close(cd: iconv_t) -> ::c_int; + + pub fn getopt_long( + argc: ::c_int, + argv: *const *mut c_char, + optstring: *const c_char, + longopts: *const option, + longindex: *mut ::c_int, + ) -> ::c_int; + pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int; + + pub fn reboot(how_to: ::c_int) -> ::c_int; + + pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int; + + pub fn regexec( + preg: *const ::regex_t, + input: *const ::c_char, + nmatch: ::size_t, + pmatch: *mut regmatch_t, + eflags: ::c_int, + ) -> ::c_int; + + pub fn regerror( + errcode: ::c_int, + preg: *const ::regex_t, + errbuf: *mut ::c_char, + errbuf_size: ::size_t, + ) -> ::size_t; + + pub fn regfree(preg: *mut ::regex_t); + + pub fn glob( + pattern: *const c_char, + flags: ::c_int, + errfunc: ::Option ::c_int>, + pglob: *mut ::glob_t, + ) -> ::c_int; + pub fn globfree(pglob: *mut ::glob_t); + + pub fn glob64( + pattern: *const ::c_char, + flags: ::c_int, + errfunc: ::Option ::c_int>, + pglob: *mut glob64_t, + ) -> ::c_int; + pub fn globfree64(pglob: *mut glob64_t); + + pub fn getxattr( + path: *const c_char, + name: *const c_char, + value: *mut ::c_void, + size: ::size_t, + ) -> ::ssize_t; + pub fn lgetxattr( + path: *const c_char, + name: *const c_char, + value: *mut ::c_void, + size: ::size_t, + ) -> ::ssize_t; + pub fn fgetxattr( + filedes: ::c_int, + name: *const c_char, + value: *mut ::c_void, + size: ::size_t, + ) -> ::ssize_t; + pub fn setxattr( + path: *const c_char, + name: *const c_char, + value: *const ::c_void, + size: ::size_t, + flags: ::c_int, + ) -> ::c_int; + pub fn lsetxattr( + path: *const c_char, + name: *const c_char, + value: *const ::c_void, + size: ::size_t, + flags: ::c_int, + ) -> ::c_int; + pub fn fsetxattr( + filedes: ::c_int, + name: *const c_char, + value: *const ::c_void, + size: ::size_t, + flags: ::c_int, + ) -> ::c_int; + pub fn listxattr(path: *const c_char, list: *mut c_char, size: ::size_t) -> ::ssize_t; + pub fn llistxattr(path: *const c_char, list: *mut c_char, size: ::size_t) -> ::ssize_t; + pub fn flistxattr(filedes: ::c_int, list: *mut c_char, size: ::size_t) -> ::ssize_t; + pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int; + pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int; + pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int; + + pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; + /// POSIX version of `basename(3)`, defined in `libgen.h`. + #[link_name = "__xpg_basename"] + pub fn posix_basename(path: *mut ::c_char) -> *mut ::c_char; + /// GNU version of `basename(3)`, defined in `string.h`. + #[link_name = "basename"] + pub fn gnu_basename(path: *const ::c_char) -> *mut ::c_char; + + pub fn dlmopen(lmid: Lmid_t, filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void; + pub fn dlinfo(handle: *mut ::c_void, request: ::c_int, info: *mut ::c_void) -> ::c_int; + pub fn dladdr1( + addr: *const ::c_void, + info: *mut ::Dl_info, + extra_info: *mut *mut ::c_void, + flags: ::c_int, + ) -> ::c_int; + + pub fn duplocale(base: ::locale_t) -> ::locale_t; + pub fn freelocale(loc: ::locale_t); + pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t; + pub fn uselocale(loc: ::locale_t) -> ::locale_t; + pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char; + pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char; + pub fn dl_iterate_phdr( callback: ::Option< unsafe extern "C" fn( @@ -3005,6 +4582,9 @@ extern "C" { >, data: *mut ::c_void, ) -> ::c_int; + + pub fn gnu_get_libc_release() -> *const ::c_char; + pub fn gnu_get_libc_version() -> *const ::c_char; } safe_f! { diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 98a9d9b2b8448..999a15440d12c 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -46,6 +46,8 @@ pub type Elf64_Off = u64; pub type Elf64_Word = u32; pub type Elf64_Xword = u64; +pub type eventfd_t = u64; + s! { pub struct stack_t { pub ss_sp: *mut ::c_void, @@ -1800,6 +1802,34 @@ pub const BLKIOOPT: ::c_int = 0x1279; pub const BLKSSZGET: ::c_int = 0x1268; pub const BLKPBSZGET: ::c_int = 0x127B; +cfg_if! { + // Those type are constructed using the _IOC macro + // DD-SS_SSSS_SSSS_SSSS-TTTT_TTTT-NNNN_NNNN + // where D stands for direction (either None (00), Read (01) or Write (11)) + // where S stands for size (int, long, struct...) + // where T stands for type ('f','v','X'...) + // where N stands for NR (NumbeR) + if #[cfg(any(target_arch = "x86", target_arch = "arm"))] { + pub const FS_IOC_GETFLAGS: ::c_int = 0x80046601; + pub const FS_IOC_SETFLAGS: ::c_int = 0x40046602; + pub const FS_IOC_GETVERSION: ::c_int = 0x80047601; + pub const FS_IOC_SETVERSION: ::c_int = 0x40047602; + pub const FS_IOC32_GETFLAGS: ::c_int = 0x80046601; + pub const FS_IOC32_SETFLAGS: ::c_int = 0x40046602; + pub const FS_IOC32_GETVERSION: ::c_int = 0x80047601; + pub const FS_IOC32_SETVERSION: ::c_int = 0x40047602; + } else if #[cfg(any(target_arch = "x86_64", target_arch = "riscv64", target_arch = "aarch64"))] { + pub const FS_IOC_GETFLAGS: ::c_int = 0x80086601; + pub const FS_IOC_SETFLAGS: ::c_int = 0x40086602; + pub const FS_IOC_GETVERSION: ::c_int = 0x80087601; + pub const FS_IOC_SETVERSION: ::c_int = 0x40087602; + pub const FS_IOC32_GETFLAGS: ::c_int = 0x80046601; + pub const FS_IOC32_SETFLAGS: ::c_int = 0x40046602; + pub const FS_IOC32_GETVERSION: ::c_int = 0x80047601; + pub const FS_IOC32_SETVERSION: ::c_int = 0x40047602; + } +} + pub const EAI_AGAIN: ::c_int = 2; pub const EAI_BADFLAGS: ::c_int = 3; pub const EAI_FAIL: ::c_int = 4; @@ -2481,6 +2511,7 @@ pub const IFF_TUN: ::c_int = 0x0001; pub const IFF_TAP: ::c_int = 0x0002; pub const IFF_NAPI: ::c_int = 0x0010; pub const IFF_NAPI_FRAGS: ::c_int = 0x0020; +pub const IFF_NO_CARRIER: ::c_int = 0x0040; pub const IFF_NO_PI: ::c_int = 0x1000; pub const IFF_ONE_QUEUE: ::c_int = 0x2000; pub const IFF_VNET_HDR: ::c_int = 0x4000; @@ -2490,6 +2521,14 @@ pub const IFF_ATTACH_QUEUE: ::c_int = 0x0200; pub const IFF_DETACH_QUEUE: ::c_int = 0x0400; pub const IFF_PERSIST: ::c_int = 0x0800; pub const IFF_NOFILTER: ::c_int = 0x1000; +// Features for GSO (TUNSETOFFLOAD) +pub const TUN_F_CSUM: ::c_uint = 0x01; +pub const TUN_F_TSO4: ::c_uint = 0x02; +pub const TUN_F_TSO6: ::c_uint = 0x04; +pub const TUN_F_TSO_ECN: ::c_uint = 0x08; +pub const TUN_F_UFO: ::c_uint = 0x10; +pub const TUN_F_USO4: ::c_uint = 0x20; +pub const TUN_F_USO6: ::c_uint = 0x40; // start android/platform/bionic/libc/kernel/uapi/linux/if_ether.h // from https://android.googlesource.com/platform/bionic/+/HEAD/libc/kernel/uapi/linux/if_ether.h @@ -3153,6 +3192,137 @@ pub const RTMSG_DELDEVICE: u32 = 0x12; pub const RTMSG_NEWROUTE: u32 = 0x21; pub const RTMSG_DELROUTE: u32 = 0x22; +pub const CTL_KERN: ::c_int = 1; +pub const CTL_VM: ::c_int = 2; +pub const CTL_NET: ::c_int = 3; +pub const CTL_FS: ::c_int = 5; +pub const CTL_DEBUG: ::c_int = 6; +pub const CTL_DEV: ::c_int = 7; +pub const CTL_BUS: ::c_int = 8; +pub const CTL_ABI: ::c_int = 9; +pub const CTL_CPU: ::c_int = 10; + +pub const CTL_BUS_ISA: ::c_int = 1; + +pub const INOTIFY_MAX_USER_INSTANCES: ::c_int = 1; +pub const INOTIFY_MAX_USER_WATCHES: ::c_int = 2; +pub const INOTIFY_MAX_QUEUED_EVENTS: ::c_int = 3; + +pub const KERN_OSTYPE: ::c_int = 1; +pub const KERN_OSRELEASE: ::c_int = 2; +pub const KERN_OSREV: ::c_int = 3; +pub const KERN_VERSION: ::c_int = 4; +pub const KERN_SECUREMASK: ::c_int = 5; +pub const KERN_PROF: ::c_int = 6; +pub const KERN_NODENAME: ::c_int = 7; +pub const KERN_DOMAINNAME: ::c_int = 8; +pub const KERN_PANIC: ::c_int = 15; +pub const KERN_REALROOTDEV: ::c_int = 16; +pub const KERN_SPARC_REBOOT: ::c_int = 21; +pub const KERN_CTLALTDEL: ::c_int = 22; +pub const KERN_PRINTK: ::c_int = 23; +pub const KERN_NAMETRANS: ::c_int = 24; +pub const KERN_PPC_HTABRECLAIM: ::c_int = 25; +pub const KERN_PPC_ZEROPAGED: ::c_int = 26; +pub const KERN_PPC_POWERSAVE_NAP: ::c_int = 27; +pub const KERN_MODPROBE: ::c_int = 28; +pub const KERN_SG_BIG_BUFF: ::c_int = 29; +pub const KERN_ACCT: ::c_int = 30; +pub const KERN_PPC_L2CR: ::c_int = 31; +pub const KERN_RTSIGNR: ::c_int = 32; +pub const KERN_RTSIGMAX: ::c_int = 33; +pub const KERN_SHMMAX: ::c_int = 34; +pub const KERN_MSGMAX: ::c_int = 35; +pub const KERN_MSGMNB: ::c_int = 36; +pub const KERN_MSGPOOL: ::c_int = 37; +pub const KERN_SYSRQ: ::c_int = 38; +pub const KERN_MAX_THREADS: ::c_int = 39; +pub const KERN_RANDOM: ::c_int = 40; +pub const KERN_SHMALL: ::c_int = 41; +pub const KERN_MSGMNI: ::c_int = 42; +pub const KERN_SEM: ::c_int = 43; +pub const KERN_SPARC_STOP_A: ::c_int = 44; +pub const KERN_SHMMNI: ::c_int = 45; +pub const KERN_OVERFLOWUID: ::c_int = 46; +pub const KERN_OVERFLOWGID: ::c_int = 47; +pub const KERN_SHMPATH: ::c_int = 48; +pub const KERN_HOTPLUG: ::c_int = 49; +pub const KERN_IEEE_EMULATION_WARNINGS: ::c_int = 50; +pub const KERN_S390_USER_DEBUG_LOGGING: ::c_int = 51; +pub const KERN_CORE_USES_PID: ::c_int = 52; +pub const KERN_TAINTED: ::c_int = 53; +pub const KERN_CADPID: ::c_int = 54; +pub const KERN_PIDMAX: ::c_int = 55; +pub const KERN_CORE_PATTERN: ::c_int = 56; +pub const KERN_PANIC_ON_OOPS: ::c_int = 57; +pub const KERN_HPPA_PWRSW: ::c_int = 58; +pub const KERN_HPPA_UNALIGNED: ::c_int = 59; +pub const KERN_PRINTK_RATELIMIT: ::c_int = 60; +pub const KERN_PRINTK_RATELIMIT_BURST: ::c_int = 61; +pub const KERN_PTY: ::c_int = 62; +pub const KERN_NGROUPS_MAX: ::c_int = 63; +pub const KERN_SPARC_SCONS_PWROFF: ::c_int = 64; +pub const KERN_HZ_TIMER: ::c_int = 65; +pub const KERN_UNKNOWN_NMI_PANIC: ::c_int = 66; +pub const KERN_BOOTLOADER_TYPE: ::c_int = 67; +pub const KERN_RANDOMIZE: ::c_int = 68; +pub const KERN_SETUID_DUMPABLE: ::c_int = 69; +pub const KERN_SPIN_RETRY: ::c_int = 70; +pub const KERN_ACPI_VIDEO_FLAGS: ::c_int = 71; +pub const KERN_IA64_UNALIGNED: ::c_int = 72; +pub const KERN_COMPAT_LOG: ::c_int = 73; +pub const KERN_MAX_LOCK_DEPTH: ::c_int = 74; + +pub const VM_OVERCOMMIT_MEMORY: ::c_int = 5; +pub const VM_PAGE_CLUSTER: ::c_int = 10; +pub const VM_DIRTY_BACKGROUND: ::c_int = 11; +pub const VM_DIRTY_RATIO: ::c_int = 12; +pub const VM_DIRTY_WB_CS: ::c_int = 13; +pub const VM_DIRTY_EXPIRE_CS: ::c_int = 14; +pub const VM_NR_PDFLUSH_THREADS: ::c_int = 15; +pub const VM_OVERCOMMIT_RATIO: ::c_int = 16; +pub const VM_PAGEBUF: ::c_int = 17; +pub const VM_HUGETLB_PAGES: ::c_int = 18; +pub const VM_SWAPPINESS: ::c_int = 19; +pub const VM_LOWMEM_RESERVE_RATIO: ::c_int = 20; +pub const VM_MIN_FREE_KBYTES: ::c_int = 21; +pub const VM_MAX_MAP_COUNT: ::c_int = 22; +pub const VM_LAPTOP_MODE: ::c_int = 23; +pub const VM_BLOCK_DUMP: ::c_int = 24; +pub const VM_HUGETLB_GROUP: ::c_int = 25; +pub const VM_VFS_CACHE_PRESSURE: ::c_int = 26; +pub const VM_LEGACY_VA_LAYOUT: ::c_int = 27; +pub const VM_SWAP_TOKEN_TIMEOUT: ::c_int = 28; +pub const VM_DROP_PAGECACHE: ::c_int = 29; +pub const VM_PERCPU_PAGELIST_FRACTION: ::c_int = 30; +pub const VM_ZONE_RECLAIM_MODE: ::c_int = 31; +pub const VM_MIN_UNMAPPED: ::c_int = 32; +pub const VM_PANIC_ON_OOM: ::c_int = 33; +pub const VM_VDSO_ENABLED: ::c_int = 34; + +pub const NET_CORE: ::c_int = 1; +pub const NET_ETHER: ::c_int = 2; +pub const NET_802: ::c_int = 3; +pub const NET_UNIX: ::c_int = 4; +pub const NET_IPV4: ::c_int = 5; +pub const NET_IPX: ::c_int = 6; +pub const NET_ATALK: ::c_int = 7; +pub const NET_NETROM: ::c_int = 8; +pub const NET_AX25: ::c_int = 9; +pub const NET_BRIDGE: ::c_int = 10; +pub const NET_ROSE: ::c_int = 11; +pub const NET_IPV6: ::c_int = 12; +pub const NET_X25: ::c_int = 13; +pub const NET_TR: ::c_int = 14; +pub const NET_DECNET: ::c_int = 15; +pub const NET_ECONET: ::c_int = 16; +pub const NET_SCTP: ::c_int = 17; +pub const NET_LLC: ::c_int = 18; +pub const NET_NETFILTER: ::c_int = 19; +pub const NET_DCCP: ::c_int = 20; +pub const HUGETLB_FLAG_ENCODE_SHIFT: ::c_int = 26; +pub const MAP_HUGE_SHIFT: ::c_int = HUGETLB_FLAG_ENCODE_SHIFT; + // Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the // following are only available on newer Linux versions than the versions // currently used in CI in some configurations, so we define them here. @@ -3293,7 +3463,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::size_t, serv: *mut ::c_char, - sevlen: ::size_t, + servlen: ::size_t, flags: ::c_int, ) -> ::c_int; pub fn preadv(fd: ::c_int, iov: *const ::iovec, count: ::c_int, offset: ::off_t) -> ::ssize_t; @@ -3428,6 +3598,8 @@ extern "C" { flags: ::c_uint, ) -> ::ssize_t; pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; + pub fn eventfd_read(fd: ::c_int, value: *mut eventfd_t) -> ::c_int; + pub fn eventfd_write(fd: ::c_int, value: eventfd_t) -> ::c_int; pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int; pub fn sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int; pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int; diff --git a/src/unix/linux_like/emscripten/mod.rs b/src/unix/linux_like/emscripten/mod.rs index 1c9e4e6f5b178..1dc607496a2ad 100644 --- a/src/unix/linux_like/emscripten/mod.rs +++ b/src/unix/linux_like/emscripten/mod.rs @@ -1702,7 +1702,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int; diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs index 10e1fcca630dd..b8e459631e49f 100644 --- a/src/unix/linux_like/linux/arch/generic/mod.rs +++ b/src/unix/linux_like/linux/arch/generic/mod.rs @@ -211,6 +211,34 @@ pub const BLKIOOPT: ::Ioctl = 0x1279; pub const BLKSSZGET: ::Ioctl = 0x1268; pub const BLKPBSZGET: ::Ioctl = 0x127B; +cfg_if! { + // Those type are constructed using the _IOC macro + // DD-SS_SSSS_SSSS_SSSS-TTTT_TTTT-NNNN_NNNN + // where D stands for direction (either None (00), Read (01) or Write (11)) + // where S stands for size (int, long, struct...) + // where T stands for type ('f','v','X'...) + // where N stands for NR (NumbeR) + if #[cfg(any(target_arch = "x86", target_arch = "arm"))] { + pub const FS_IOC_GETFLAGS: ::Ioctl = 0x80046601; + pub const FS_IOC_SETFLAGS: ::Ioctl = 0x40046602; + pub const FS_IOC_GETVERSION: ::Ioctl = 0x80047601; + pub const FS_IOC_SETVERSION: ::Ioctl = 0x40047602; + pub const FS_IOC32_GETFLAGS: ::Ioctl = 0x80046601; + pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x40046602; + pub const FS_IOC32_GETVERSION: ::Ioctl = 0x80047601; + pub const FS_IOC32_SETVERSION: ::Ioctl = 0x40047602; + } else if #[cfg(any(target_arch = "x86_64", target_arch = "riscv64", target_arch = "aarch64", target_arch = "s390x"))] { + pub const FS_IOC_GETFLAGS: ::Ioctl = 0x80086601; + pub const FS_IOC_SETFLAGS: ::Ioctl = 0x40086602; + pub const FS_IOC_GETVERSION: ::Ioctl = 0x80087601; + pub const FS_IOC_SETVERSION: ::Ioctl = 0x40087602; + pub const FS_IOC32_GETFLAGS: ::Ioctl = 0x80046601; + pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x40046602; + pub const FS_IOC32_GETVERSION: ::Ioctl = 0x80047601; + pub const FS_IOC32_SETVERSION: ::Ioctl = 0x40047602; + } +} + cfg_if! { if #[cfg(any(target_arch = "arm", target_arch = "s390x"))] { diff --git a/src/unix/linux_like/linux/arch/mips/mod.rs b/src/unix/linux_like/linux/arch/mips/mod.rs index 6c0aecf8cbac3..7699677026f2b 100644 --- a/src/unix/linux_like/linux/arch/mips/mod.rs +++ b/src/unix/linux_like/linux/arch/mips/mod.rs @@ -193,6 +193,34 @@ pub const BLKIOOPT: ::Ioctl = 0x20001279; pub const BLKSSZGET: ::Ioctl = 0x20001268; pub const BLKPBSZGET: ::Ioctl = 0x2000127B; +cfg_if! { + // Those type are constructed using the _IOC macro + // DD-SS_SSSS_SSSS_SSSS-TTTT_TTTT-NNNN_NNNN + // where D stands for direction (either None (00), Read (01) or Write (11)) + // where S stands for size (int, long, struct...) + // where T stands for type ('f','v','X'...) + // where N stands for NR (NumbeR) + if #[cfg(target_arch = "mips")] { + pub const FS_IOC_GETFLAGS: ::Ioctl = 0x40046601; + pub const FS_IOC_SETFLAGS: ::Ioctl = 0x80046602; + pub const FS_IOC_GETVERSION: ::Ioctl = 0x40047601; + pub const FS_IOC_SETVERSION: ::Ioctl = 0x80047602; + pub const FS_IOC32_GETFLAGS: ::Ioctl = 0x40046601; + pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x80046602; + pub const FS_IOC32_GETVERSION: ::Ioctl = 0x40047601; + pub const FS_IOC32_SETVERSION: ::Ioctl = 0x80047602; + } else if #[cfg(target_arch = "mips64")] { + pub const FS_IOC_GETFLAGS: ::Ioctl = 0x40086601; + pub const FS_IOC_SETFLAGS: ::Ioctl = 0x80086602; + pub const FS_IOC_GETVERSION: ::Ioctl = 0x40087601; + pub const FS_IOC_SETVERSION: ::Ioctl = 0x80087602; + pub const FS_IOC32_GETFLAGS: ::Ioctl = 0x40046601; + pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x80046602; + pub const FS_IOC32_GETVERSION: ::Ioctl = 0x40047601; + pub const FS_IOC32_SETVERSION: ::Ioctl = 0x80047602; + } +} + cfg_if! { if #[cfg(target_env = "musl")] { pub const TIOCGRS485: ::Ioctl = 0x4020542e; diff --git a/src/unix/linux_like/linux/arch/powerpc/mod.rs b/src/unix/linux_like/linux/arch/powerpc/mod.rs index 584be5b6c2860..27834dbfeabcc 100644 --- a/src/unix/linux_like/linux/arch/powerpc/mod.rs +++ b/src/unix/linux_like/linux/arch/powerpc/mod.rs @@ -179,6 +179,34 @@ pub const BLKSSZGET: ::Ioctl = 0x20001268; pub const BLKPBSZGET: ::Ioctl = 0x2000127B; //pub const FIOQSIZE: ::Ioctl = 0x40086680; +cfg_if! { + // Those type are constructed using the _IOC macro + // DD-SS_SSSS_SSSS_SSSS-TTTT_TTTT-NNNN_NNNN + // where D stands for direction (either None (00), Read (01) or Write (11)) + // where S stands for size (int, long, struct...) + // where T stands for type ('f','v','X'...) + // where N stands for NR (NumbeR) + if #[cfg(target_arch = "powerpc")] { + pub const FS_IOC_GETFLAGS: ::Ioctl = 0x40046601; + pub const FS_IOC_SETFLAGS: ::Ioctl = 0x80046602; + pub const FS_IOC_GETVERSION: ::Ioctl = 0x40047601; + pub const FS_IOC_SETVERSION: ::Ioctl = 0x80047602; + pub const FS_IOC32_GETFLAGS: ::Ioctl = 0x40046601; + pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x80046602; + pub const FS_IOC32_GETVERSION: ::Ioctl = 0x40047601; + pub const FS_IOC32_SETVERSION: ::Ioctl = 0x80047602; + } else if #[cfg(target_arch = "powerpc64")] { + pub const FS_IOC_GETFLAGS: ::Ioctl = 0x40086601; + pub const FS_IOC_SETFLAGS: ::Ioctl = 0x80086602; + pub const FS_IOC_GETVERSION: ::Ioctl = 0x40087601; + pub const FS_IOC_SETVERSION: ::Ioctl = 0x80087602; + pub const FS_IOC32_GETFLAGS: ::Ioctl = 0x40046601; + pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x80046602; + pub const FS_IOC32_GETVERSION: ::Ioctl = 0x40047601; + pub const FS_IOC32_SETVERSION: ::Ioctl = 0x80047602; + } +} + pub const TIOCM_LE: ::c_int = 0x001; pub const TIOCM_DTR: ::c_int = 0x002; pub const TIOCM_RTS: ::c_int = 0x004; diff --git a/src/unix/linux_like/linux/arch/sparc/mod.rs b/src/unix/linux_like/linux/arch/sparc/mod.rs index c7813aa46be61..fce466c778998 100644 --- a/src/unix/linux_like/linux/arch/sparc/mod.rs +++ b/src/unix/linux_like/linux/arch/sparc/mod.rs @@ -229,3 +229,31 @@ cfg_if! { pub const RLIM_INFINITY: ::rlim_t = 0x7fffffff; } } + +cfg_if! { + // Those type are constructed using the _IOC macro + // DD-SS_SSSS_SSSS_SSSS-TTTT_TTTT-NNNN_NNNN + // where D stands for direction (either None (00), Read (01) or Write (11)) + // where S stands for size (int, long, struct...) + // where T stands for type ('f','v','X'...) + // where N stands for NR (NumbeR) + if #[cfg(target_arch = "sparc")] { + pub const FS_IOC_GETFLAGS: ::Ioctl = 0x40046601; + pub const FS_IOC_SETFLAGS: ::Ioctl = 0x80046602; + pub const FS_IOC_GETVERSION: ::Ioctl = 0x40047601; + pub const FS_IOC_SETVERSION: ::Ioctl = 0x80047602; + pub const FS_IOC32_GETFLAGS: ::Ioctl = 0x40046601; + pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x80046602; + pub const FS_IOC32_GETVERSION: ::Ioctl = 0x40047601; + pub const FS_IOC32_SETVERSION: ::Ioctl = 0x80047602; + } else if #[cfg(target_arch = "sparc64")] { + pub const FS_IOC_GETFLAGS: ::Ioctl = 0x40086601; + pub const FS_IOC_SETFLAGS: ::Ioctl = 0x80086602; + pub const FS_IOC_GETVERSION: ::Ioctl = 0x40087601; + pub const FS_IOC_SETVERSION: ::Ioctl = 0x80087602; + pub const FS_IOC32_GETFLAGS: ::Ioctl = 0x40046601; + pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x80046602; + pub const FS_IOC32_GETVERSION: ::Ioctl = 0x40047601; + pub const FS_IOC32_SETVERSION: ::Ioctl = 0x80047602; + } +} diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index 377b9f122f150..e7284fd46f096 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -355,6 +355,83 @@ s! { #[cfg(libc_union)] pub u: __c_anonymous_ptrace_syscall_info_data, } + + // linux/if_xdp.h + + pub struct sockaddr_xdp { + pub sxdp_family: ::__u16, + pub sxdp_flags: ::__u16, + pub sxdp_ifindex: ::__u32, + pub sxdp_queue_id: ::__u32, + pub sxdp_shared_umem_fd: ::__u32, + } + + pub struct xdp_ring_offset { + pub producer: ::__u64, + pub consumer: ::__u64, + pub desc: ::__u64, + pub flags: ::__u64, + } + + pub struct xdp_mmap_offsets { + pub rx: xdp_ring_offset, + pub tx: xdp_ring_offset, + pub fr: xdp_ring_offset, + pub cr: xdp_ring_offset, + } + + pub struct xdp_ring_offset_v1 { + pub producer: ::__u64, + pub consumer: ::__u64, + pub desc: ::__u64, + } + + pub struct xdp_mmap_offsets_v1 { + pub rx: xdp_ring_offset_v1, + pub tx: xdp_ring_offset_v1, + pub fr: xdp_ring_offset_v1, + pub cr: xdp_ring_offset_v1, + } + + pub struct xdp_umem_reg { + pub addr: ::__u64, + pub len: ::__u64, + pub chunk_size: ::__u32, + pub headroom: ::__u32, + pub flags: ::__u32, + } + + pub struct xdp_umem_reg_v1 { + pub addr: ::__u64, + pub len: ::__u64, + pub chunk_size: ::__u32, + pub headroom: ::__u32, + } + + pub struct xdp_statistics { + pub rx_dropped: ::__u64, + pub rx_invalid_descs: ::__u64, + pub tx_invalid_descs: ::__u64, + pub rx_ring_full: ::__u64, + pub rx_fill_ring_empty_descs: ::__u64, + pub tx_ring_empty_descs: ::__u64, + } + + pub struct xdp_statistics_v1 { + pub rx_dropped: ::__u64, + pub rx_invalid_descs: ::__u64, + pub tx_invalid_descs: ::__u64, + } + + pub struct xdp_options { + pub flags: ::__u32, + } + + pub struct xdp_desc { + pub addr: ::__u64, + pub len: ::__u32, + pub options: ::__u32, + } } impl siginfo_t { @@ -920,6 +997,38 @@ 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; +// linux/if_xdp.h +pub const XDP_SHARED_UMEM: ::__u16 = 1 << 0; +pub const XDP_COPY: ::__u16 = 1 << 1; +pub const XDP_ZEROCOPY: ::__u16 = 1 << 2; +pub const XDP_USE_NEED_WAKEUP: ::__u16 = 1 << 3; +pub const XDP_USE_SG: ::__u16 = 1 << 4; + +pub const XDP_UMEM_UNALIGNED_CHUNK_FLAG: ::__u32 = 1 << 0; + +pub const XDP_RING_NEED_WAKEUP: ::__u32 = 1 << 0; + +pub const XDP_MMAP_OFFSETS: ::c_int = 1; +pub const XDP_RX_RING: ::c_int = 2; +pub const XDP_TX_RING: ::c_int = 3; +pub const XDP_UMEM_REG: ::c_int = 4; +pub const XDP_UMEM_FILL_RING: ::c_int = 5; +pub const XDP_UMEM_COMPLETION_RING: ::c_int = 6; +pub const XDP_STATISTICS: ::c_int = 7; +pub const XDP_OPTIONS: ::c_int = 8; + +pub const XDP_OPTIONS_ZEROCOPY: ::__u32 = 1 << 0; + +pub const XDP_PGOFF_RX_RING: ::off_t = 0; +pub const XDP_PGOFF_TX_RING: ::off_t = 0x80000000; +pub const XDP_UMEM_PGOFF_FILL_RING: ::c_ulonglong = 0x100000000; +pub const XDP_UMEM_PGOFF_COMPLETION_RING: ::c_ulonglong = 0x180000000; + +pub const XSK_UNALIGNED_BUF_OFFSET_SHIFT: ::c_int = 48; +pub const XSK_UNALIGNED_BUF_ADDR_MASK: ::c_ulonglong = (1 << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1; + +pub const XDP_PKT_CONTD: ::__u32 = 1 << 0; + // elf.h pub const NT_PRSTATUS: ::c_int = 1; pub const NT_PRFPREG: ::c_int = 2; diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 224300a64609e..b763ab6261bb9 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -52,13 +52,10 @@ pub type iconv_t = *mut ::c_void; // linux/sctp.h pub type sctp_assoc_t = ::__s32; -#[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum fpos64_t {} // FIXME: fill this out with a struct -impl ::Copy for fpos64_t {} -impl ::Clone for fpos64_t { - fn clone(&self) -> fpos64_t { - *self - } +pub type eventfd_t = u64; +missing! { + #[cfg_attr(feature = "extra_traits", derive(Debug))] + pub enum fpos64_t {} // FIXME: fill this out with a struct } s! { @@ -686,6 +683,37 @@ s! { pub rlim_cur: rlim64_t, pub rlim_max: rlim64_t, } + + // linux/tls.h + + pub struct tls_crypto_info { + pub version: ::__u16, + pub cipher_type: ::__u16, + } + + pub struct tls12_crypto_info_aes_gcm_128 { + pub info: tls_crypto_info, + pub iv: [::c_uchar; TLS_CIPHER_AES_GCM_128_IV_SIZE], + pub key: [::c_uchar; TLS_CIPHER_AES_GCM_128_KEY_SIZE], + pub salt: [::c_uchar; TLS_CIPHER_AES_GCM_128_SALT_SIZE], + pub rec_seq: [::c_uchar; TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE], + } + + pub struct tls12_crypto_info_aes_gcm_256 { + pub info: tls_crypto_info, + pub iv: [::c_uchar; TLS_CIPHER_AES_GCM_256_IV_SIZE], + pub key: [::c_uchar; TLS_CIPHER_AES_GCM_256_KEY_SIZE], + pub salt: [::c_uchar; TLS_CIPHER_AES_GCM_256_SALT_SIZE], + pub rec_seq: [::c_uchar; TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE], + } + + pub struct tls12_crypto_info_chacha20_poly1305 { + pub info: tls_crypto_info, + pub iv: [::c_uchar; TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE], + pub key: [::c_uchar; TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE], + pub salt: [::c_uchar; TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE], + pub rec_seq: [::c_uchar; TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE], + } } s_no_extra_traits! { @@ -1866,6 +1894,8 @@ pub const IFF_TUN: ::c_int = 0x0001; pub const IFF_TAP: ::c_int = 0x0002; pub const IFF_NAPI: ::c_int = 0x0010; pub const IFF_NAPI_FRAGS: ::c_int = 0x0020; +// Used in TUNSETIFF to bring up tun/tap without carrier +pub const IFF_NO_CARRIER: ::c_int = 0x0040; pub const IFF_NO_PI: ::c_int = 0x1000; // Read queue size pub const TUN_READQ_SIZE: ::c_short = 500; @@ -1886,11 +1916,13 @@ pub const IFF_NOFILTER: ::c_int = 0x1000; // Socket options pub const TUN_TX_TIMESTAMP: ::c_int = 1; // Features for GSO (TUNSETOFFLOAD) -pub const TUN_F_CSUM: ::c_ushort = 0x01; /* You can hand me unchecksummed packets. */ -pub const TUN_F_TSO4: ::c_ushort = 0x02; /* I can handle TSO for IPv4 packets */ -pub const TUN_F_TSO6: ::c_ushort = 0x04; /* I can handle TSO for IPv6 packets */ -pub const TUN_F_TSO_ECN: ::c_ushort = 0x08; /* I can handle TSO with ECN bits. */ -pub const TUN_F_UFO: ::c_ushort = 0x10; /* I can handle UFO packets */ +pub const TUN_F_CSUM: ::c_uint = 0x01; +pub const TUN_F_TSO4: ::c_uint = 0x02; +pub const TUN_F_TSO6: ::c_uint = 0x04; +pub const TUN_F_TSO_ECN: ::c_uint = 0x08; +pub const TUN_F_UFO: ::c_uint = 0x10; +pub const TUN_F_USO4: ::c_uint = 0x20; +pub const TUN_F_USO6: ::c_uint = 0x40; // Protocol info prepended to the packets (when IFF_NO_PI is not set) pub const TUN_PKT_STRIP: ::c_int = 0x0001; // Accept all multicast packets @@ -1964,6 +1996,8 @@ pub const PTHREAD_PRIO_INHERIT: ::c_int = 1; pub const PTHREAD_PRIO_PROTECT: ::c_int = 2; pub const PTHREAD_PROCESS_PRIVATE: ::c_int = 0; pub const PTHREAD_PROCESS_SHARED: ::c_int = 1; +pub const PTHREAD_INHERIT_SCHED: ::c_int = 0; +pub const PTHREAD_EXPLICIT_SCHED: ::c_int = 1; pub const __SIZEOF_PTHREAD_COND_T: usize = 48; pub const RENAME_NOREPLACE: ::c_uint = 1; @@ -2068,6 +2102,7 @@ pub const NI_NUMERICSERV: ::c_int = 2; pub const NI_NOFQDN: ::c_int = 4; pub const NI_NAMEREQD: ::c_int = 8; pub const NI_DGRAM: ::c_int = 16; +pub const NI_IDN: ::c_int = 32; pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::c_uint = 1; pub const SYNC_FILE_RANGE_WRITE: ::c_uint = 2; @@ -2854,6 +2889,293 @@ pub const SIOCSIFMAP: ::c_ulong = 0x00008971; pub const SIOCSHWTSTAMP: ::c_ulong = 0x000089b0; pub const SIOCGHWTSTAMP: ::c_ulong = 0x000089b1; +// wireless.h +pub const WIRELESS_EXT: ::c_ulong = 0x16; + +pub const SIOCSIWCOMMIT: ::c_ulong = 0x8B00; +pub const SIOCGIWNAME: ::c_ulong = 0x8B01; + +pub const SIOCSIWNWID: ::c_ulong = 0x8B02; +pub const SIOCGIWNWID: ::c_ulong = 0x8B03; +pub const SIOCSIWFREQ: ::c_ulong = 0x8B04; +pub const SIOCGIWFREQ: ::c_ulong = 0x8B05; +pub const SIOCSIWMODE: ::c_ulong = 0x8B06; +pub const SIOCGIWMODE: ::c_ulong = 0x8B07; +pub const SIOCSIWSENS: ::c_ulong = 0x8B08; +pub const SIOCGIWSENS: ::c_ulong = 0x8B09; + +pub const SIOCSIWRANGE: ::c_ulong = 0x8B0A; +pub const SIOCGIWRANGE: ::c_ulong = 0x8B0B; +pub const SIOCSIWPRIV: ::c_ulong = 0x8B0C; +pub const SIOCGIWPRIV: ::c_ulong = 0x8B0D; +pub const SIOCSIWSTATS: ::c_ulong = 0x8B0E; +pub const SIOCGIWSTATS: ::c_ulong = 0x8B0F; + +pub const SIOCSIWSPY: ::c_ulong = 0x8B10; +pub const SIOCGIWSPY: ::c_ulong = 0x8B11; +pub const SIOCSIWTHRSPY: ::c_ulong = 0x8B12; +pub const SIOCGIWTHRSPY: ::c_ulong = 0x8B13; + +pub const SIOCSIWAP: ::c_ulong = 0x8B14; +pub const SIOCGIWAP: ::c_ulong = 0x8B15; +pub const SIOCGIWAPLIST: ::c_ulong = 0x8B17; +pub const SIOCSIWSCAN: ::c_ulong = 0x8B18; +pub const SIOCGIWSCAN: ::c_ulong = 0x8B19; + +pub const SIOCSIWESSID: ::c_ulong = 0x8B1A; +pub const SIOCGIWESSID: ::c_ulong = 0x8B1B; +pub const SIOCSIWNICKN: ::c_ulong = 0x8B1C; +pub const SIOCGIWNICKN: ::c_ulong = 0x8B1D; + +pub const SIOCSIWRATE: ::c_ulong = 0x8B20; +pub const SIOCGIWRATE: ::c_ulong = 0x8B21; +pub const SIOCSIWRTS: ::c_ulong = 0x8B22; +pub const SIOCGIWRTS: ::c_ulong = 0x8B23; +pub const SIOCSIWFRAG: ::c_ulong = 0x8B24; +pub const SIOCGIWFRAG: ::c_ulong = 0x8B25; +pub const SIOCSIWTXPOW: ::c_ulong = 0x8B26; +pub const SIOCGIWTXPOW: ::c_ulong = 0x8B27; +pub const SIOCSIWRETRY: ::c_ulong = 0x8B28; +pub const SIOCGIWRETRY: ::c_ulong = 0x8B29; + +pub const SIOCSIWENCODE: ::c_ulong = 0x8B2A; +pub const SIOCGIWENCODE: ::c_ulong = 0x8B2B; + +pub const SIOCSIWPOWER: ::c_ulong = 0x8B2C; +pub const SIOCGIWPOWER: ::c_ulong = 0x8B2D; + +pub const SIOCSIWGENIE: ::c_ulong = 0x8B30; +pub const SIOCGIWGENIE: ::c_ulong = 0x8B31; + +pub const SIOCSIWMLME: ::c_ulong = 0x8B16; + +pub const SIOCSIWAUTH: ::c_ulong = 0x8B32; +pub const SIOCGIWAUTH: ::c_ulong = 0x8B33; + +pub const SIOCSIWENCODEEXT: ::c_ulong = 0x8B34; +pub const SIOCGIWENCODEEXT: ::c_ulong = 0x8B35; + +pub const SIOCSIWPMKSA: ::c_ulong = 0x8B36; + +pub const SIOCIWFIRSTPRIV: ::c_ulong = 0x8BE0; +pub const SIOCIWLASTPRIV: ::c_ulong = 0x8BFF; + +pub const SIOCIWFIRST: ::c_ulong = 0x8B00; +pub const SIOCIWLAST: ::c_ulong = SIOCIWLASTPRIV; + +pub const IWEVTXDROP: ::c_ulong = 0x8C00; +pub const IWEVQUAL: ::c_ulong = 0x8C01; +pub const IWEVCUSTOM: ::c_ulong = 0x8C02; +pub const IWEVREGISTERED: ::c_ulong = 0x8C03; +pub const IWEVEXPIRED: ::c_ulong = 0x8C04; +pub const IWEVGENIE: ::c_ulong = 0x8C05; +pub const IWEVMICHAELMICFAILURE: ::c_ulong = 0x8C06; +pub const IWEVASSOCREQIE: ::c_ulong = 0x8C07; +pub const IWEVASSOCRESPIE: ::c_ulong = 0x8C08; +pub const IWEVPMKIDCAND: ::c_ulong = 0x8C09; +pub const IWEVFIRST: ::c_ulong = 0x8C00; + +pub const IW_PRIV_TYPE_MASK: ::c_ulong = 0x7000; +pub const IW_PRIV_TYPE_NONE: ::c_ulong = 0x0000; +pub const IW_PRIV_TYPE_BYTE: ::c_ulong = 0x1000; +pub const IW_PRIV_TYPE_CHAR: ::c_ulong = 0x2000; +pub const IW_PRIV_TYPE_INT: ::c_ulong = 0x4000; +pub const IW_PRIV_TYPE_FLOAT: ::c_ulong = 0x5000; +pub const IW_PRIV_TYPE_ADDR: ::c_ulong = 0x6000; + +pub const IW_PRIV_SIZE_FIXED: ::c_ulong = 0x0800; + +pub const IW_PRIV_SIZE_MASK: ::c_ulong = 0x07FF; + +pub const IW_MAX_FREQUENCIES: usize = 32; +pub const IW_MAX_BITRATES: usize = 32; +pub const IW_MAX_TXPOWER: usize = 8; +pub const IW_MAX_SPY: usize = 8; +pub const IW_MAX_AP: usize = 64; +pub const IW_ESSID_MAX_SIZE: usize = 32; + +pub const IW_MODE_AUTO: usize = 0; +pub const IW_MODE_ADHOC: usize = 1; +pub const IW_MODE_INFRA: usize = 2; +pub const IW_MODE_MASTER: usize = 3; +pub const IW_MODE_REPEAT: usize = 4; +pub const IW_MODE_SECOND: usize = 5; +pub const IW_MODE_MONITOR: usize = 6; +pub const IW_MODE_MESH: usize = 7; + +pub const IW_QUAL_QUAL_UPDATED: ::c_ulong = 0x01; +pub const IW_QUAL_LEVEL_UPDATED: ::c_ulong = 0x02; +pub const IW_QUAL_NOISE_UPDATED: ::c_ulong = 0x04; +pub const IW_QUAL_ALL_UPDATED: ::c_ulong = 0x07; +pub const IW_QUAL_DBM: ::c_ulong = 0x08; +pub const IW_QUAL_QUAL_INVALID: ::c_ulong = 0x10; +pub const IW_QUAL_LEVEL_INVALID: ::c_ulong = 0x20; +pub const IW_QUAL_NOISE_INVALID: ::c_ulong = 0x40; +pub const IW_QUAL_RCPI: ::c_ulong = 0x80; +pub const IW_QUAL_ALL_INVALID: ::c_ulong = 0x70; + +pub const IW_FREQ_AUTO: ::c_ulong = 0x00; +pub const IW_FREQ_FIXED: ::c_ulong = 0x01; + +pub const IW_MAX_ENCODING_SIZES: usize = 8; +pub const IW_ENCODING_TOKEN_MAX: usize = 64; + +pub const IW_ENCODE_INDEX: ::c_ulong = 0x00FF; +pub const IW_ENCODE_FLAGS: ::c_ulong = 0xFF00; +pub const IW_ENCODE_MODE: ::c_ulong = 0xF000; +pub const IW_ENCODE_DISABLED: ::c_ulong = 0x8000; +pub const IW_ENCODE_ENABLED: ::c_ulong = 0x0000; +pub const IW_ENCODE_RESTRICTED: ::c_ulong = 0x4000; +pub const IW_ENCODE_OPEN: ::c_ulong = 0x2000; +pub const IW_ENCODE_NOKEY: ::c_ulong = 0x0800; +pub const IW_ENCODE_TEMP: ::c_ulong = 0x0400; + +pub const IW_POWER_ON: ::c_ulong = 0x0000; +pub const IW_POWER_TYPE: ::c_ulong = 0xF000; +pub const IW_POWER_PERIOD: ::c_ulong = 0x1000; +pub const IW_POWER_TIMEOUT: ::c_ulong = 0x2000; +pub const IW_POWER_MODE: ::c_ulong = 0x0F00; +pub const IW_POWER_UNICAST_R: ::c_ulong = 0x0100; +pub const IW_POWER_MULTICAST_R: ::c_ulong = 0x0200; +pub const IW_POWER_ALL_R: ::c_ulong = 0x0300; +pub const IW_POWER_FORCE_S: ::c_ulong = 0x0400; +pub const IW_POWER_REPEATER: ::c_ulong = 0x0800; +pub const IW_POWER_MODIFIER: ::c_ulong = 0x000F; +pub const IW_POWER_MIN: ::c_ulong = 0x0001; +pub const IW_POWER_MAX: ::c_ulong = 0x0002; +pub const IW_POWER_RELATIVE: ::c_ulong = 0x0004; + +pub const IW_TXPOW_TYPE: ::c_ulong = 0x00FF; +pub const IW_TXPOW_DBM: ::c_ulong = 0x0000; +pub const IW_TXPOW_MWATT: ::c_ulong = 0x0001; +pub const IW_TXPOW_RELATIVE: ::c_ulong = 0x0002; +pub const IW_TXPOW_RANGE: ::c_ulong = 0x1000; + +pub const IW_RETRY_ON: ::c_ulong = 0x0000; +pub const IW_RETRY_TYPE: ::c_ulong = 0xF000; +pub const IW_RETRY_LIMIT: ::c_ulong = 0x1000; +pub const IW_RETRY_LIFETIME: ::c_ulong = 0x2000; +pub const IW_RETRY_MODIFIER: ::c_ulong = 0x00FF; +pub const IW_RETRY_MIN: ::c_ulong = 0x0001; +pub const IW_RETRY_MAX: ::c_ulong = 0x0002; +pub const IW_RETRY_RELATIVE: ::c_ulong = 0x0004; +pub const IW_RETRY_SHORT: ::c_ulong = 0x0010; +pub const IW_RETRY_LONG: ::c_ulong = 0x0020; + +pub const IW_SCAN_DEFAULT: ::c_ulong = 0x0000; +pub const IW_SCAN_ALL_ESSID: ::c_ulong = 0x0001; +pub const IW_SCAN_THIS_ESSID: ::c_ulong = 0x0002; +pub const IW_SCAN_ALL_FREQ: ::c_ulong = 0x0004; +pub const IW_SCAN_THIS_FREQ: ::c_ulong = 0x0008; +pub const IW_SCAN_ALL_MODE: ::c_ulong = 0x0010; +pub const IW_SCAN_THIS_MODE: ::c_ulong = 0x0020; +pub const IW_SCAN_ALL_RATE: ::c_ulong = 0x0040; +pub const IW_SCAN_THIS_RATE: ::c_ulong = 0x0080; + +pub const IW_SCAN_TYPE_ACTIVE: usize = 0; +pub const IW_SCAN_TYPE_PASSIVE: usize = 1; + +pub const IW_SCAN_MAX_DATA: usize = 4096; + +pub const IW_SCAN_CAPA_NONE: ::c_ulong = 0x00; +pub const IW_SCAN_CAPA_ESSID: ::c_ulong = 0x01; +pub const IW_SCAN_CAPA_BSSID: ::c_ulong = 0x02; +pub const IW_SCAN_CAPA_CHANNEL: ::c_ulong = 0x04; +pub const IW_SCAN_CAPA_MODE: ::c_ulong = 0x08; +pub const IW_SCAN_CAPA_RATE: ::c_ulong = 0x10; +pub const IW_SCAN_CAPA_TYPE: ::c_ulong = 0x20; +pub const IW_SCAN_CAPA_TIME: ::c_ulong = 0x40; + +pub const IW_CUSTOM_MAX: ::c_ulong = 256; + +pub const IW_GENERIC_IE_MAX: ::c_ulong = 1024; + +pub const IW_MLME_DEAUTH: ::c_ulong = 0; +pub const IW_MLME_DISASSOC: ::c_ulong = 1; +pub const IW_MLME_AUTH: ::c_ulong = 2; +pub const IW_MLME_ASSOC: ::c_ulong = 3; + +pub const IW_AUTH_INDEX: ::c_ulong = 0x0FFF; +pub const IW_AUTH_FLAGS: ::c_ulong = 0xF000; + +pub const IW_AUTH_WPA_VERSION: usize = 0; +pub const IW_AUTH_CIPHER_PAIRWISE: usize = 1; +pub const IW_AUTH_CIPHER_GROUP: usize = 2; +pub const IW_AUTH_KEY_MGMT: usize = 3; +pub const IW_AUTH_TKIP_COUNTERMEASURES: usize = 4; +pub const IW_AUTH_DROP_UNENCRYPTED: usize = 5; +pub const IW_AUTH_80211_AUTH_ALG: usize = 6; +pub const IW_AUTH_WPA_ENABLED: usize = 7; +pub const IW_AUTH_RX_UNENCRYPTED_EAPOL: usize = 8; +pub const IW_AUTH_ROAMING_CONTROL: usize = 9; +pub const IW_AUTH_PRIVACY_INVOKED: usize = 10; +pub const IW_AUTH_CIPHER_GROUP_MGMT: usize = 11; +pub const IW_AUTH_MFP: usize = 12; + +pub const IW_AUTH_WPA_VERSION_DISABLED: ::c_ulong = 0x00000001; +pub const IW_AUTH_WPA_VERSION_WPA: ::c_ulong = 0x00000002; +pub const IW_AUTH_WPA_VERSION_WPA2: ::c_ulong = 0x00000004; + +pub const IW_AUTH_CIPHER_NONE: ::c_ulong = 0x00000001; +pub const IW_AUTH_CIPHER_WEP40: ::c_ulong = 0x00000002; +pub const IW_AUTH_CIPHER_TKIP: ::c_ulong = 0x00000004; +pub const IW_AUTH_CIPHER_CCMP: ::c_ulong = 0x00000008; +pub const IW_AUTH_CIPHER_WEP104: ::c_ulong = 0x00000010; +pub const IW_AUTH_CIPHER_AES_CMAC: ::c_ulong = 0x00000020; + +pub const IW_AUTH_KEY_MGMT_802_1X: usize = 1; +pub const IW_AUTH_KEY_MGMT_PSK: usize = 2; + +pub const IW_AUTH_ALG_OPEN_SYSTEM: ::c_ulong = 0x00000001; +pub const IW_AUTH_ALG_SHARED_KEY: ::c_ulong = 0x00000002; +pub const IW_AUTH_ALG_LEAP: ::c_ulong = 0x00000004; + +pub const IW_AUTH_ROAMING_ENABLE: usize = 0; +pub const IW_AUTH_ROAMING_DISABLE: usize = 1; + +pub const IW_AUTH_MFP_DISABLED: usize = 0; +pub const IW_AUTH_MFP_OPTIONAL: usize = 1; +pub const IW_AUTH_MFP_REQUIRED: usize = 2; + +pub const IW_ENCODE_SEQ_MAX_SIZE: usize = 8; + +pub const IW_ENCODE_ALG_NONE: usize = 0; +pub const IW_ENCODE_ALG_WEP: usize = 1; +pub const IW_ENCODE_ALG_TKIP: usize = 2; +pub const IW_ENCODE_ALG_CCMP: usize = 3; +pub const IW_ENCODE_ALG_PMK: usize = 4; +pub const IW_ENCODE_ALG_AES_CMAC: usize = 5; + +pub const IW_ENCODE_EXT_TX_SEQ_VALID: ::c_ulong = 0x00000001; +pub const IW_ENCODE_EXT_RX_SEQ_VALID: ::c_ulong = 0x00000002; +pub const IW_ENCODE_EXT_GROUP_KEY: ::c_ulong = 0x00000004; +pub const IW_ENCODE_EXT_SET_TX_KEY: ::c_ulong = 0x00000008; + +pub const IW_MICFAILURE_KEY_ID: ::c_ulong = 0x00000003; +pub const IW_MICFAILURE_GROUP: ::c_ulong = 0x00000004; +pub const IW_MICFAILURE_PAIRWISE: ::c_ulong = 0x00000008; +pub const IW_MICFAILURE_STAKEY: ::c_ulong = 0x00000010; +pub const IW_MICFAILURE_COUNT: ::c_ulong = 0x00000060; + +pub const IW_ENC_CAPA_WPA: ::c_ulong = 0x00000001; +pub const IW_ENC_CAPA_WPA2: ::c_ulong = 0x00000002; +pub const IW_ENC_CAPA_CIPHER_TKIP: ::c_ulong = 0x00000004; +pub const IW_ENC_CAPA_CIPHER_CCMP: ::c_ulong = 0x00000008; +pub const IW_ENC_CAPA_4WAY_HANDSHAKE: ::c_ulong = 0x00000010; + +pub const IW_PMKSA_ADD: usize = 1; +pub const IW_PMKSA_REMOVE: usize = 2; +pub const IW_PMKSA_FLUSH: usize = 3; + +pub const IW_PMKID_LEN: usize = 16; + +pub const IW_PMKID_CAND_PREAUTH: ::c_ulong = 0x00000001; + +pub const IW_EV_LCP_PK_LEN: usize = 4; + +pub const IW_EV_CHAR_PK_LEN: usize = IW_EV_LCP_PK_LEN + ::IFNAMSIZ; +pub const IW_EV_POINT_PK_LEN: usize = IW_EV_LCP_PK_LEN + 4; + pub const IPTOS_TOS_MASK: u8 = 0x1E; pub const IPTOS_PREC_MASK: u8 = 0xE0; @@ -3234,6 +3556,41 @@ pub const HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: ::c_uint = 14; pub const HWTSTAMP_FILTER_NTP_ALL: ::c_uint = 15; // linux/tls.h +pub const TLS_TX: ::c_int = 1; +pub const TLS_RX: ::c_int = 2; + +pub const TLS_1_2_VERSION_MAJOR: ::__u8 = 0x3; +pub const TLS_1_2_VERSION_MINOR: ::__u8 = 0x3; +pub const TLS_1_2_VERSION: ::__u16 = + ((TLS_1_2_VERSION_MAJOR as ::__u16) << 8) | (TLS_1_2_VERSION_MINOR as ::__u16); + +pub const TLS_1_3_VERSION_MAJOR: ::__u8 = 0x3; +pub const TLS_1_3_VERSION_MINOR: ::__u8 = 0x4; +pub const TLS_1_3_VERSION: ::__u16 = + ((TLS_1_3_VERSION_MAJOR as ::__u16) << 8) | (TLS_1_3_VERSION_MINOR as ::__u16); + +pub const TLS_CIPHER_AES_GCM_128: ::__u16 = 51; +pub const TLS_CIPHER_AES_GCM_128_IV_SIZE: usize = 8; +pub const TLS_CIPHER_AES_GCM_128_KEY_SIZE: usize = 16; +pub const TLS_CIPHER_AES_GCM_128_SALT_SIZE: usize = 4; +pub const TLS_CIPHER_AES_GCM_128_TAG_SIZE: usize = 16; +pub const TLS_CIPHER_AES_GCM_128_REC_SEQ_SIZE: usize = 8; + +pub const TLS_CIPHER_AES_GCM_256: ::__u16 = 52; +pub const TLS_CIPHER_AES_GCM_256_IV_SIZE: usize = 8; +pub const TLS_CIPHER_AES_GCM_256_KEY_SIZE: usize = 32; +pub const TLS_CIPHER_AES_GCM_256_SALT_SIZE: usize = 4; +pub const TLS_CIPHER_AES_GCM_256_TAG_SIZE: usize = 16; +pub const TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE: usize = 8; + +pub const TLS_CIPHER_CHACHA20_POLY1305: ::__u16 = 54; +pub const TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE: usize = 12; +pub const TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE: usize = 32; +pub const TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE: usize = 0; +pub const TLS_CIPHER_CHACHA20_POLY1305_TAG_SIZE: usize = 16; +pub const TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE: usize = 8; + +pub const TLS_SET_RECORD_TYPE: ::c_int = 1; pub const TLS_GET_RECORD_TYPE: ::c_int = 2; pub const SOL_TLS: ::c_int = 282; @@ -4029,6 +4386,139 @@ 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 CTL_KERN: ::c_int = 1; +pub const CTL_VM: ::c_int = 2; +pub const CTL_NET: ::c_int = 3; +pub const CTL_FS: ::c_int = 5; +pub const CTL_DEBUG: ::c_int = 6; +pub const CTL_DEV: ::c_int = 7; +pub const CTL_BUS: ::c_int = 8; +pub const CTL_ABI: ::c_int = 9; +pub const CTL_CPU: ::c_int = 10; + +pub const CTL_BUS_ISA: ::c_int = 1; + +pub const INOTIFY_MAX_USER_INSTANCES: ::c_int = 1; +pub const INOTIFY_MAX_USER_WATCHES: ::c_int = 2; +pub const INOTIFY_MAX_QUEUED_EVENTS: ::c_int = 3; + +pub const KERN_OSTYPE: ::c_int = 1; +pub const KERN_OSRELEASE: ::c_int = 2; +pub const KERN_OSREV: ::c_int = 3; +pub const KERN_VERSION: ::c_int = 4; +pub const KERN_SECUREMASK: ::c_int = 5; +pub const KERN_PROF: ::c_int = 6; +pub const KERN_NODENAME: ::c_int = 7; +pub const KERN_DOMAINNAME: ::c_int = 8; +pub const KERN_PANIC: ::c_int = 15; +pub const KERN_REALROOTDEV: ::c_int = 16; +pub const KERN_SPARC_REBOOT: ::c_int = 21; +pub const KERN_CTLALTDEL: ::c_int = 22; +pub const KERN_PRINTK: ::c_int = 23; +pub const KERN_NAMETRANS: ::c_int = 24; +pub const KERN_PPC_HTABRECLAIM: ::c_int = 25; +pub const KERN_PPC_ZEROPAGED: ::c_int = 26; +pub const KERN_PPC_POWERSAVE_NAP: ::c_int = 27; +pub const KERN_MODPROBE: ::c_int = 28; +pub const KERN_SG_BIG_BUFF: ::c_int = 29; +pub const KERN_ACCT: ::c_int = 30; +pub const KERN_PPC_L2CR: ::c_int = 31; +pub const KERN_RTSIGNR: ::c_int = 32; +pub const KERN_RTSIGMAX: ::c_int = 33; +pub const KERN_SHMMAX: ::c_int = 34; +pub const KERN_MSGMAX: ::c_int = 35; +pub const KERN_MSGMNB: ::c_int = 36; +pub const KERN_MSGPOOL: ::c_int = 37; +pub const KERN_SYSRQ: ::c_int = 38; +pub const KERN_MAX_THREADS: ::c_int = 39; +pub const KERN_RANDOM: ::c_int = 40; +pub const KERN_SHMALL: ::c_int = 41; +pub const KERN_MSGMNI: ::c_int = 42; +pub const KERN_SEM: ::c_int = 43; +pub const KERN_SPARC_STOP_A: ::c_int = 44; +pub const KERN_SHMMNI: ::c_int = 45; +pub const KERN_OVERFLOWUID: ::c_int = 46; +pub const KERN_OVERFLOWGID: ::c_int = 47; +pub const KERN_SHMPATH: ::c_int = 48; +pub const KERN_HOTPLUG: ::c_int = 49; +pub const KERN_IEEE_EMULATION_WARNINGS: ::c_int = 50; +pub const KERN_S390_USER_DEBUG_LOGGING: ::c_int = 51; +pub const KERN_CORE_USES_PID: ::c_int = 52; +pub const KERN_TAINTED: ::c_int = 53; +pub const KERN_CADPID: ::c_int = 54; +pub const KERN_PIDMAX: ::c_int = 55; +pub const KERN_CORE_PATTERN: ::c_int = 56; +pub const KERN_PANIC_ON_OOPS: ::c_int = 57; +pub const KERN_HPPA_PWRSW: ::c_int = 58; +pub const KERN_HPPA_UNALIGNED: ::c_int = 59; +pub const KERN_PRINTK_RATELIMIT: ::c_int = 60; +pub const KERN_PRINTK_RATELIMIT_BURST: ::c_int = 61; +pub const KERN_PTY: ::c_int = 62; +pub const KERN_NGROUPS_MAX: ::c_int = 63; +pub const KERN_SPARC_SCONS_PWROFF: ::c_int = 64; +pub const KERN_HZ_TIMER: ::c_int = 65; +pub const KERN_UNKNOWN_NMI_PANIC: ::c_int = 66; +pub const KERN_BOOTLOADER_TYPE: ::c_int = 67; +pub const KERN_RANDOMIZE: ::c_int = 68; +pub const KERN_SETUID_DUMPABLE: ::c_int = 69; +pub const KERN_SPIN_RETRY: ::c_int = 70; +pub const KERN_ACPI_VIDEO_FLAGS: ::c_int = 71; +pub const KERN_IA64_UNALIGNED: ::c_int = 72; +pub const KERN_COMPAT_LOG: ::c_int = 73; +pub const KERN_MAX_LOCK_DEPTH: ::c_int = 74; +pub const KERN_NMI_WATCHDOG: ::c_int = 75; +pub const KERN_PANIC_ON_NMI: ::c_int = 76; + +pub const VM_OVERCOMMIT_MEMORY: ::c_int = 5; +pub const VM_PAGE_CLUSTER: ::c_int = 10; +pub const VM_DIRTY_BACKGROUND: ::c_int = 11; +pub const VM_DIRTY_RATIO: ::c_int = 12; +pub const VM_DIRTY_WB_CS: ::c_int = 13; +pub const VM_DIRTY_EXPIRE_CS: ::c_int = 14; +pub const VM_NR_PDFLUSH_THREADS: ::c_int = 15; +pub const VM_OVERCOMMIT_RATIO: ::c_int = 16; +pub const VM_PAGEBUF: ::c_int = 17; +pub const VM_HUGETLB_PAGES: ::c_int = 18; +pub const VM_SWAPPINESS: ::c_int = 19; +pub const VM_LOWMEM_RESERVE_RATIO: ::c_int = 20; +pub const VM_MIN_FREE_KBYTES: ::c_int = 21; +pub const VM_MAX_MAP_COUNT: ::c_int = 22; +pub const VM_LAPTOP_MODE: ::c_int = 23; +pub const VM_BLOCK_DUMP: ::c_int = 24; +pub const VM_HUGETLB_GROUP: ::c_int = 25; +pub const VM_VFS_CACHE_PRESSURE: ::c_int = 26; +pub const VM_LEGACY_VA_LAYOUT: ::c_int = 27; +pub const VM_SWAP_TOKEN_TIMEOUT: ::c_int = 28; +pub const VM_DROP_PAGECACHE: ::c_int = 29; +pub const VM_PERCPU_PAGELIST_FRACTION: ::c_int = 30; +pub const VM_ZONE_RECLAIM_MODE: ::c_int = 31; +pub const VM_MIN_UNMAPPED: ::c_int = 32; +pub const VM_PANIC_ON_OOM: ::c_int = 33; +pub const VM_VDSO_ENABLED: ::c_int = 34; +pub const VM_MIN_SLAB: ::c_int = 35; + +pub const NET_CORE: ::c_int = 1; +pub const NET_ETHER: ::c_int = 2; +pub const NET_802: ::c_int = 3; +pub const NET_UNIX: ::c_int = 4; +pub const NET_IPV4: ::c_int = 5; +pub const NET_IPX: ::c_int = 6; +pub const NET_ATALK: ::c_int = 7; +pub const NET_NETROM: ::c_int = 8; +pub const NET_AX25: ::c_int = 9; +pub const NET_BRIDGE: ::c_int = 10; +pub const NET_ROSE: ::c_int = 11; +pub const NET_IPV6: ::c_int = 12; +pub const NET_X25: ::c_int = 13; +pub const NET_TR: ::c_int = 14; +pub const NET_DECNET: ::c_int = 15; +pub const NET_ECONET: ::c_int = 16; +pub const NET_SCTP: ::c_int = 17; +pub const NET_LLC: ::c_int = 18; +pub const NET_NETFILTER: ::c_int = 19; +pub const NET_DCCP: ::c_int = 20; +pub const NET_IRDA: ::c_int = 412; + f! { pub fn NLA_ALIGN(len: ::c_int) -> ::c_int { return ((len) + NLA_ALIGNTO - 1) & !(NLA_ALIGNTO - 1) @@ -4243,7 +4733,7 @@ cfg_if! { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; pub fn getloadavg( @@ -4602,6 +5092,9 @@ extern "C" { flags: ::c_uint, ) -> ::ssize_t; pub fn eventfd(init: ::c_uint, flags: ::c_int) -> ::c_int; + pub fn eventfd_read(fd: ::c_int, value: *mut eventfd_t) -> ::c_int; + pub fn eventfd_write(fd: ::c_int, value: eventfd_t) -> ::c_int; + pub fn sched_rr_get_interval(pid: ::pid_t, tp: *mut ::timespec) -> ::c_int; pub fn sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int; pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int; @@ -4684,6 +5177,27 @@ extern "C" { guardsize: *mut ::size_t, ) -> ::c_int; pub fn pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::size_t) -> ::c_int; + pub fn pthread_attr_getinheritsched( + attr: *const ::pthread_attr_t, + inheritsched: *mut ::c_int, + ) -> ::c_int; + pub fn pthread_attr_setinheritsched( + attr: *mut ::pthread_attr_t, + inheritsched: ::c_int, + ) -> ::c_int; + pub fn pthread_attr_getschedpolicy( + attr: *const ::pthread_attr_t, + policy: *mut ::c_int, + ) -> ::c_int; + pub fn pthread_attr_setschedpolicy(attr: *mut ::pthread_attr_t, policy: ::c_int) -> ::c_int; + pub fn pthread_attr_getschedparam( + attr: *const ::pthread_attr_t, + param: *mut ::sched_param, + ) -> ::c_int; + pub fn pthread_attr_setschedparam( + attr: *mut ::pthread_attr_t, + param: *const ::sched_param, + ) -> ::c_int; pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int; pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int; pub fn pthread_condattr_getpshared( diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index b67d55e99bb53..97429a7f3a21a 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -271,6 +271,83 @@ s! { pub maxerror: ::c_long, pub esterror: ::c_long, } + + // linux/if_xdp.h + + pub struct sockaddr_xdp { + pub sxdp_family: ::__u16, + pub sxdp_flags: ::__u16, + pub sxdp_ifindex: ::__u32, + pub sxdp_queue_id: ::__u32, + pub sxdp_shared_umem_fd: ::__u32, + } + + pub struct xdp_ring_offset { + pub producer: ::__u64, + pub consumer: ::__u64, + pub desc: ::__u64, + pub flags: ::__u64, + } + + pub struct xdp_mmap_offsets { + pub rx: xdp_ring_offset, + pub tx: xdp_ring_offset, + pub fr: xdp_ring_offset, + pub cr: xdp_ring_offset, + } + + pub struct xdp_ring_offset_v1 { + pub producer: ::__u64, + pub consumer: ::__u64, + pub desc: ::__u64, + } + + pub struct xdp_mmap_offsets_v1 { + pub rx: xdp_ring_offset_v1, + pub tx: xdp_ring_offset_v1, + pub fr: xdp_ring_offset_v1, + pub cr: xdp_ring_offset_v1, + } + + pub struct xdp_umem_reg { + pub addr: ::__u64, + pub len: ::__u64, + pub chunk_size: ::__u32, + pub headroom: ::__u32, + pub flags: ::__u32, + } + + pub struct xdp_umem_reg_v1 { + pub addr: ::__u64, + pub len: ::__u64, + pub chunk_size: ::__u32, + pub headroom: ::__u32, + } + + pub struct xdp_statistics { + pub rx_dropped: ::__u64, + pub rx_invalid_descs: ::__u64, + pub tx_invalid_descs: ::__u64, + pub rx_ring_full: ::__u64, + pub rx_fill_ring_empty_descs: ::__u64, + pub tx_ring_empty_descs: ::__u64, + } + + pub struct xdp_statistics_v1 { + pub rx_dropped: ::__u64, + pub rx_invalid_descs: ::__u64, + pub tx_invalid_descs: ::__u64, + } + + pub struct xdp_options { + pub flags: ::__u32, + } + + pub struct xdp_desc { + pub addr: ::__u64, + pub len: ::__u32, + pub options: ::__u32, + } } s_no_extra_traits! { @@ -703,6 +780,40 @@ pub const TIME_ERROR: ::c_int = 5; pub const TIME_BAD: ::c_int = TIME_ERROR; pub const MAXTC: ::c_long = 6; +pub const SOL_XDP: ::c_int = 283; + +// linux/if_xdp.h +pub const XDP_SHARED_UMEM: ::__u16 = 1 << 0; +pub const XDP_COPY: ::__u16 = 1 << 1; +pub const XDP_ZEROCOPY: ::__u16 = 1 << 2; +pub const XDP_USE_NEED_WAKEUP: ::__u16 = 1 << 3; +pub const XDP_USE_SG: ::__u16 = 1 << 4; + +pub const XDP_UMEM_UNALIGNED_CHUNK_FLAG: ::__u32 = 1 << 0; + +pub const XDP_RING_NEED_WAKEUP: ::__u32 = 1 << 0; + +pub const XDP_MMAP_OFFSETS: ::c_int = 1; +pub const XDP_RX_RING: ::c_int = 2; +pub const XDP_TX_RING: ::c_int = 3; +pub const XDP_UMEM_REG: ::c_int = 4; +pub const XDP_UMEM_FILL_RING: ::c_int = 5; +pub const XDP_UMEM_COMPLETION_RING: ::c_int = 6; +pub const XDP_STATISTICS: ::c_int = 7; +pub const XDP_OPTIONS: ::c_int = 8; + +pub const XDP_OPTIONS_ZEROCOPY: ::__u32 = 1 << 0; + +pub const XDP_PGOFF_RX_RING: ::off_t = 0; +pub const XDP_PGOFF_TX_RING: ::off_t = 0x80000000; +pub const XDP_UMEM_PGOFF_FILL_RING: ::c_ulonglong = 0x100000000; +pub const XDP_UMEM_PGOFF_COMPLETION_RING: ::c_ulonglong = 0x180000000; + +pub const XSK_UNALIGNED_BUF_OFFSET_SHIFT: ::c_int = 48; +pub const XSK_UNALIGNED_BUF_ADDR_MASK: ::c_ulonglong = (1 << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1; + +pub const XDP_PKT_CONTD: ::__u32 = 1 << 0; + cfg_if! { if #[cfg(target_arch = "s390x")] { pub const POSIX_FADV_DONTNEED: ::c_int = 6; diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs index 4afb98e957c9d..48b03e9ee43fa 100644 --- a/src/unix/linux_like/linux/uclibc/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mod.rs @@ -343,7 +343,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 26fd68de49c7c..35c7598c911d8 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -6,13 +6,9 @@ pub type timer_t = *mut ::c_void; pub type key_t = ::c_int; pub type id_t = ::c_uint; -#[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum timezone {} -impl ::Copy for timezone {} -impl ::Clone for timezone { - fn clone(&self) -> timezone { - *self - } +missing! { + #[cfg_attr(feature = "extra_traits", derive(Debug))] + pub enum timezone {} } s! { diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 9daebcaa6d364..3dca83305ad59 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -41,13 +41,9 @@ cfg_if! { } } -#[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum DIR {} -impl ::Copy for DIR {} -impl ::Clone for DIR { - fn clone(&self) -> DIR { - *self - } +missing! { + #[cfg_attr(feature = "extra_traits", derive(Debug))] + pub enum DIR {} } pub type locale_t = *mut ::c_void; @@ -321,7 +317,7 @@ cfg_if! { if #[cfg(any(target_os = "l4re", target_os = "espidf"))] { // required libraries for L4Re and the ESP-IDF framework are linked externally, ATM } else if #[cfg(feature = "std")] { - // cargo build, don't pull in anything extra as the libstd dep + // cargo build, don't pull in anything extra as the std dep // already pulls in all libs. } else if #[cfg(all(target_os = "linux", any(target_env = "gnu", target_env = "uclibc"), @@ -414,21 +410,11 @@ cfg_if! { } } -#[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum FILE {} -impl ::Copy for FILE {} -impl ::Clone for FILE { - fn clone(&self) -> FILE { - *self - } -} -#[cfg_attr(feature = "extra_traits", derive(Debug))] -pub enum fpos_t {} // FIXME: fill this out with a struct -impl ::Copy for fpos_t {} -impl ::Clone for fpos_t { - fn clone(&self) -> fpos_t { - *self - } +missing! { + #[cfg_attr(feature = "extra_traits", derive(Debug))] + pub enum FILE {} + #[cfg_attr(feature = "extra_traits", derive(Debug))] + pub enum fpos_t {} // FIXME: fill this out with a struct } extern "C" { diff --git a/src/unix/nto/mod.rs b/src/unix/nto/mod.rs index 91e531ffd7961..9eef23458d14a 100644 --- a/src/unix/nto/mod.rs +++ b/src/unix/nto/mod.rs @@ -3283,7 +3283,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs index cd219a777288f..17242eaf2a1df 100644 --- a/src/unix/redox/mod.rs +++ b/src/unix/redox/mod.rs @@ -28,7 +28,7 @@ pub type nfds_t = ::c_ulong; pub type nlink_t = ::c_ulong; pub type off_t = ::c_longlong; pub type pthread_t = *mut ::c_void; -// Must be usize due to libstd/sys_common/thread_local.rs, +// Must be usize due to library/std/sys_common/thread_local.rs, // should technically be *mut ::c_void pub type pthread_key_t = usize; pub type rlim_t = ::c_ulonglong; diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index a3fa56a65a67e..c34ff890b412a 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -2588,6 +2588,9 @@ const _CMSG_DATA_ALIGNMENT: usize = ::mem::size_of::<::c_int>(); const NEWDEV: ::c_int = 1; +// sys/sendfile.h +pub const SFV_FD_SELF: ::c_int = -2; + const_fn! { {const} fn _CMSG_HDR_ALIGN(p: usize) -> usize { (p + _CMSG_HDR_ALIGNMENT - 1) & !(_CMSG_HDR_ALIGNMENT - 1) @@ -2753,7 +2756,7 @@ extern "C" { host: *mut ::c_char, hostlen: ::socklen_t, serv: *mut ::c_char, - sevlen: ::socklen_t, + servlen: ::socklen_t, flags: ::c_int, ) -> ::c_int; pub fn setpwent(); @@ -3203,9 +3206,9 @@ extern "C" { pub fn sync(); - fn __major(version: ::c_int, devnum: ::dev_t) -> ::major_t; - fn __minor(version: ::c_int, devnum: ::dev_t) -> ::minor_t; - fn __makedev(version: ::c_int, majdev: ::major_t, mindev: ::minor_t) -> ::dev_t; + pub fn __major(version: ::c_int, devnum: ::dev_t) -> ::major_t; + pub fn __minor(version: ::c_int, devnum: ::dev_t) -> ::minor_t; + pub fn __makedev(version: ::c_int, majdev: ::major_t, mindev: ::minor_t) -> ::dev_t; } #[link(name = "sendfile")] diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index 21d33a4e5eddf..43afbc3e2c23d 100644 --- a/src/vxworks/mod.rs +++ b/src/vxworks/mod.rs @@ -582,8 +582,8 @@ pub const EAI_SERVICE: ::c_int = 9; pub const EAI_SOCKTYPE: ::c_int = 10; pub const EAI_SYSTEM: ::c_int = 11; -// This is not defined in vxWorks, but we have to define it here -// to make the building pass for getrandom and libstd, FIXME +// FIXME: This is not defined in vxWorks, but we have to define it here +// to make the building pass for getrandom and std pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void; //Clock Lib Stuff