gccrs: libgrust: Vendor Rust dependencies

This commits vendors and locks our dependencies so that our Rust components
do not need internet access to be built anymore. Tested in a docker container
with no network access.

We can think about merging the vendor directory once we have more than one
Rust component, e.g. when we add polonius to the mix.

libgrust/ChangeLog:

	* libformat_parser/.cargo/config: New file.
	* libformat_parser/vendor.NOTES: New file.
	* libformat_parser/vendor/libc/.cargo-checksum.json: New file.
	* libformat_parser/vendor/libc/CONTRIBUTING.md: New file.
	* libformat_parser/vendor/libc/Cargo.toml: New file.
	* libformat_parser/vendor/libc/LICENSE-APACHE: New file.
	* libformat_parser/vendor/libc/LICENSE-MIT: New file.
	* libformat_parser/vendor/libc/README.md: New file.
	* libformat_parser/vendor/libc/build.rs: New file.
	* libformat_parser/vendor/libc/rustfmt.toml: New file.
	* libformat_parser/vendor/libc/src/fixed_width_ints.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/align.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/mod.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/riscv64.rs: New file.
	* libformat_parser/vendor/libc/src/fuchsia/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/hermit/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/hermit/mod.rs: New file.
	* libformat_parser/vendor/libc/src/hermit/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/lib.rs: New file.
	* libformat_parser/vendor/libc/src/macros.rs: New file.
	* libformat_parser/vendor/libc/src/psp.rs: New file.
	* libformat_parser/vendor/libc/src/sgx.rs: New file.
	* libformat_parser/vendor/libc/src/solid/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/solid/arm.rs: New file.
	* libformat_parser/vendor/libc/src/solid/mod.rs: New file.
	* libformat_parser/vendor/libc/src/switch.rs: New file.
	* libformat_parser/vendor/libc/src/teeos/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/aix/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/aix/powerpc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b32/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/aarch64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/aarch64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/x86_64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/long_array.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/apple/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/x86_64.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/riscv64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/arm.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mips64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/powerpc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/riscv64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/sparc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86.rs: New file.
	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/haiku/b32.rs: New file.
	* libformat_parser/vendor/libc/src/unix/haiku/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/haiku/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/haiku/native.rs: New file.
	* libformat_parser/vendor/libc/src/unix/haiku/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/hurd/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/hurd/b32.rs: New file.
	* libformat_parser/vendor/libc/src/unix/hurd/b64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/hurd/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/hurd/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/arm.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/x86/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/x86/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/int128.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/riscv64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/riscv64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/x86_64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/android/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/lfs64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/generic/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/mips/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/powerpc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/sparc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/arm/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/arm/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/csky/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/csky/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/m68k/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mips/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mips/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/riscv32/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/sparc/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/x86/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/x86/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/fallback.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/ilp32.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/int128.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/lp64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/s390x.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/arm/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/arm/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/hexagon.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mips/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mips/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/x86/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/x86/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/int128.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/mips64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/powerpc64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/riscv64/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/s390x.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/lfs64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/non_exhaustive.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/no_align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/no_align.rs:
	New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/other.rs: New file.
	* libformat_parser/vendor/libc/src/unix/linux_like/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/aarch64/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/arm/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/espidf/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/generic.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/horizon/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/powerpc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/newlib/vita/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/no_align.rs: New file.
	* libformat_parser/vendor/libc/src/unix/nto/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/nto/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/nto/neutrino.rs: New file.
	* libformat_parser/vendor/libc/src/unix/nto/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/redox/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/compat.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/illumos.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/mod.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/solaris.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/x86.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/unix/solarish/x86_common.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/aarch64.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/arm.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/mod.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/powerpc.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/powerpc64.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/x86.rs: New file.
	* libformat_parser/vendor/libc/src/vxworks/x86_64.rs: New file.
	* libformat_parser/vendor/libc/src/wasi.rs: New file.
	* libformat_parser/vendor/libc/src/windows/gnu/align.rs: New file.
	* libformat_parser/vendor/libc/src/windows/gnu/mod.rs: New file.
	* libformat_parser/vendor/libc/src/windows/mod.rs: New file.
	* libformat_parser/vendor/libc/src/windows/msvc/mod.rs: New file.
	* libformat_parser/vendor/libc/src/xous.rs: New file.
	* libformat_parser/vendor/libc/tests/const_fn.rs: New file.
	* libformat_parser/vendor/unicode-xid/.cargo-checksum.json: New file.
	* libformat_parser/vendor/unicode-xid/COPYRIGHT: New file.
	* libformat_parser/vendor/unicode-xid/Cargo.toml: New file.
	* libformat_parser/vendor/unicode-xid/LICENSE-APACHE: New file.
	* libformat_parser/vendor/unicode-xid/LICENSE-MIT: New file.
	* libformat_parser/vendor/unicode-xid/README.md: New file.
	* libformat_parser/vendor/unicode-xid/benches/xid.rs: New file.
	* libformat_parser/vendor/unicode-xid/src/lib.rs: New file.
	* libformat_parser/vendor/unicode-xid/src/tables.rs: New file.
	* libformat_parser/vendor/unicode-xid/src/tests.rs: New file.
	* libformat_parser/vendor/unicode-xid/tests/exhaustive_tests.rs: New file.
This commit is contained in:
Arthur Cohen 2024-04-09 13:32:31 +02:00
parent 2340894554
commit 7e1d64a5dc
256 changed files with 123838 additions and 0 deletions

View file

@ -0,0 +1,5 @@
[source.crates-io]
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"

View file

@ -0,0 +1,5 @@
All of the Rust crates within libgrust should vendor their dependencies in order to allow cargo to build these crates without an internet connection.
This can be achieved with the `cargo vendor` subcommand, available by default on modern version of `cargo`.
If you update a dependency, remember to re-run `cargo vendor` in order to download the updated version of this library. This should be checked by `cargo build --offline` in our CI anyway, so there isn't much risk.

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,100 @@
# Contributing to `libc`
Welcome! If you are reading this document, it means you are interested in contributing
to the `libc` crate.
## v0.2 changes
If you want to add your changes to v0.2, please submit them to the `libc-0.2` branch.
If you want to add any breaking changes, it should be submitted to the main branch,
which has changes for v0.3.
We will support and make a new release for v0.2 until we make the first release of v0.3.
## Adding an API
Want to use an API which currently isn't bound in `libc`? It's quite easy to add
one!
The internal structure of this crate is designed to minimize the number of
`#[cfg]` attributes in order to easily be able to add new items which apply
to all platforms in the future. As a result, the crate is organized
hierarchically based on platform. Each module has a number of `#[cfg]`'d
children, but only one is ever actually compiled. Each module then reexports all
the contents of its children.
This means that for each platform that libc supports, the path from a
leaf module to the root will contain all bindings for the platform in question.
Consequently, this indicates where an API should be added! Adding an API at a
particular level in the hierarchy means that it is supported on all the child
platforms of that level. For example, when adding a Unix API it should be added
to `src/unix/mod.rs`, but when adding a Linux-only API it should be added to
`src/unix/linux_like/linux/mod.rs`.
If you're not 100% sure at what level of the hierarchy an API should be added
at, fear not! This crate has CI support which tests any binding against all
platforms supported, so you'll see failures if an API is added at the wrong
level or has different signatures across platforms.
New symbol(s) (i.e. functions, constants etc.) should also be added to the
symbols list(s) found in the `libc-test/semver` directory. These lists keep
track of what symbols are public in the libc crate and ensures they remain
available between changes to the crate. If the new symbol(s) are available on
all supported Unixes it should be added to `unix.txt` list<sup>1</sup>,
otherwise they should be added to the OS specific list(s).
With that in mind, the steps for adding a new API are:
1. Determine where in the module hierarchy your API should be added.
2. Add the API, including adding new symbol(s) to the semver lists.
3. Send a PR to this repo.
4. Wait for CI to pass, fixing errors.
5. Wait for a merge!
<sup>1</sup>: Note that this list has nothing to do with any Unix or Posix
standard, it's just a list shared between all OSs that declare `#[cfg(unix)]`.
## Test before you commit
We have two automated tests running on [GitHub Actions](https://github.com/rust-lang/libc/actions):
1. [`libc-test`](https://github.com/gnzlbg/ctest)
- `cd libc-test && cargo test`
- Use the `skip_*()` functions in `build.rs` if you really need a workaround.
2. Style checker
- [`sh ci/style.sh`](https://github.com/rust-lang/libc/blob/main/ci/style.sh)
## Breaking change policy
Sometimes an upstream adds a breaking change to their API e.g. removing outdated items,
changing the type signature, etc. And we probably should follow that change to build the
`libc` crate successfully. It's annoying to do the equivalent of semver-major versioning
for each such change. Instead, we mark the item as deprecated and do the actual change
after a certain period. The steps are:
1. Add `#[deprecated(since = "", note="")]` attribute to the item.
- The `since` field should have a next version of `libc`
(e.g., if the current version is `0.2.1`, it should be `0.2.2`).
- The `note` field should have a reason to deprecate and a tracking issue to call for comments
(e.g., "We consider removing this as the upstream removed it.
If you're using it, please comment on #XXX").
2. If we don't see any concerns for a while, do the change actually.
## Supported target policy
When Rust removes a support for a target, the libc crate also may remove the support anytime.
## Releasing your change to crates.io
Now that you've done the amazing job of landing your new API or your new
platform in this crate, the next step is to get that sweet, sweet usage from
crates.io! The only next step is to bump the version of libc and then publish
it. If you'd like to get a release out ASAP you can follow these steps:
1. Increment the patch version number in `Cargo.toml` and `libc-test/Cargo.toml`.
1. Send a PR to this repository. It should [look like this][example-pr], but it'd
also be nice to fill out the description with a small rationale for the
release (any rationale is ok though!).
1. Once merged, the release will be tagged and published by one of the libc crate
maintainers.
[example-pr]: https://github.com/rust-lang/libc/pull/2120

View file

@ -0,0 +1,175 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.
[package]
name = "libc"
version = "0.2.152"
authors = ["The Rust Project Developers"]
build = "build.rs"
exclude = [
"/ci/*",
"/.github/*",
"/.cirrus.yml",
"/triagebot.toml",
]
description = """
Raw FFI bindings to platform libraries like libc.
"""
homepage = "https://github.com/rust-lang/libc"
documentation = "https://docs.rs/libc/"
readme = "README.md"
keywords = [
"libc",
"ffi",
"bindings",
"operating",
"system",
]
categories = [
"external-ffi-bindings",
"no-std",
"os",
]
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/libc"
[package.metadata.docs.rs]
cargo-args = ["-Zbuild-std=core"]
default-target = "x86_64-unknown-linux-gnu"
features = [
"const-extern-fn",
"extra_traits",
]
targets = [
"aarch64-apple-darwin",
"aarch64-apple-ios",
"aarch64-linux-android",
"aarch64-pc-windows-msvc",
"aarch64-unknown-freebsd",
"aarch64-unknown-fuchsia",
"aarch64-unknown-hermit",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"aarch64-unknown-netbsd",
"aarch64-unknown-openbsd",
"aarch64-wrs-vxworks",
"arm-linux-androideabi",
"arm-unknown-linux-gnueabi",
"arm-unknown-linux-gnueabihf",
"arm-unknown-linux-musleabi",
"arm-unknown-linux-musleabihf",
"armebv7r-none-eabi",
"armebv7r-none-eabihf",
"armv5te-unknown-linux-gnueabi",
"armv5te-unknown-linux-musleabi",
"armv7-linux-androideabi",
"armv7-unknown-linux-gnueabihf",
"armv7-unknown-linux-musleabihf",
"armv7-wrs-vxworks-eabihf",
"armv7r-none-eabi",
"armv7r-none-eabihf",
"hexagon-unknown-linux-musl",
"i586-pc-windows-msvc",
"i586-unknown-linux-gnu",
"i586-unknown-linux-musl",
"i686-linux-android",
"i686-pc-windows-gnu",
"i686-pc-windows-msvc",
"i686-pc-windows-msvc",
"i686-unknown-freebsd",
"i686-unknown-haiku",
"i686-unknown-linux-gnu",
"i686-unknown-linux-musl",
"i686-unknown-netbsd",
"i686-unknown-openbsd",
"i686-wrs-vxworks",
"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-sony-psp",
"mipsel-unknown-linux-gnu",
"mipsel-unknown-linux-musl",
"nvptx64-nvidia-cuda",
"powerpc-unknown-linux-gnu",
"powerpc-unknown-linux-gnuspe",
"powerpc-unknown-netbsd",
"powerpc-wrs-vxworks",
"powerpc-wrs-vxworks-spe",
"powerpc64-unknown-freebsd",
"powerpc64-unknown-linux-gnu",
"powerpc64-wrs-vxworks",
"powerpc64le-unknown-linux-gnu",
"riscv32gc-unknown-linux-gnu",
"riscv32i-unknown-none-elf",
"riscv32imac-unknown-none-elf",
"riscv32imc-unknown-none-elf",
"riscv64gc-unknown-freebsd",
"riscv64gc-unknown-hermit",
"riscv64gc-unknown-linux-gnu",
"riscv64gc-unknown-linux-musl",
"riscv64gc-unknown-none-elf",
"riscv64imac-unknown-none-elf",
"s390x-unknown-linux-gnu",
"s390x-unknown-linux-musl",
"sparc-unknown-linux-gnu",
"sparc64-unknown-linux-gnu",
"sparc64-unknown-netbsd",
"sparcv9-sun-solaris",
"thumbv6m-none-eabi",
"thumbv7em-none-eabi",
"thumbv7em-none-eabihf",
"thumbv7m-none-eabi",
"thumbv7neon-linux-androideabi",
"thumbv7neon-unknown-linux-gnueabihf",
"wasm32-unknown-emscripten",
"wasm32-unknown-unknown",
"wasm32-wasi",
"x86_64-apple-darwin",
"x86_64-apple-ios",
"x86_64-fortanix-unknown-sgx",
"x86_64-linux-android",
"x86_64-pc-solaris",
"x86_64-pc-windows-gnu",
"x86_64-pc-windows-msvc",
"x86_64-unknown-dragonfly",
"x86_64-unknown-freebsd",
"x86_64-unknown-fuchsia",
"x86_64-unknown-haiku",
"x86_64-unknown-hermit",
"x86_64-unknown-illumos",
"x86_64-unknown-l4re-uclibc",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-gnux32",
"x86_64-unknown-linux-musl",
"x86_64-unknown-netbsd",
"x86_64-unknown-openbsd",
"x86_64-unknown-redox",
"x86_64-wrs-vxworks",
]
[dependencies.rustc-std-workspace-core]
version = "1.0.0"
optional = true
[features]
align = []
const-extern-fn = []
default = ["std"]
extra_traits = []
rustc-dep-of-std = [
"align",
"rustc-std-workspace-core",
]
std = []
use_std = ["std"]

View file

@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

View file

@ -0,0 +1,25 @@
Copyright (c) 2014-2020 The Rust Project Developers
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View file

@ -0,0 +1,118 @@
# libc - Raw FFI bindings to platforms' system libraries
[![GHA Status]][GitHub Actions] [![Cirrus CI Status]][Cirrus CI] [![Latest Version]][crates.io] [![Documentation]][docs.rs] ![License]
`libc` provides all of the definitions necessary to easily interoperate with C
code (or "C-like" code) on each of the platforms that Rust supports. This
includes type definitions (e.g. `c_int`), constants (e.g. `EINVAL`) as well as
function headers (e.g. `malloc`).
This crate exports all underlying platform types, functions, and constants under
the crate root, so all items are accessible as `libc::foo`. The types and values
of all the exported APIs match the platform that libc is compiled for.
More detailed information about the design of this library can be found in its
[associated RFC][rfc].
[rfc]: https://github.com/rust-lang/rfcs/blob/HEAD/text/1291-promote-libc.md
## v0.3 Roadmap
The main branch is now for v0.3 which has some breaking changes.
For v0.2, please submit PRs to the `libc-0.2` branch instead.
We will stop making new v0.2 releases once we release v0.3 on crates.io.
See the [tracking issue](https://github.com/rust-lang/libc/issues/3248) for details.
## Usage
Add the following to your `Cargo.toml`:
```toml
[dependencies]
libc = "0.2"
```
## Features
* `std`: by default `libc` links to the standard library. Disable this
feature to remove this dependency and be able to use `libc` in `#![no_std]`
crates.
* `extra_traits`: all `struct`s implemented in `libc` are `Copy` and `Clone`.
This feature derives `Debug`, `Eq`, `Hash`, and `PartialEq`.
* `const-extern-fn`: Changes some `extern fn`s into `const extern fn`s.
If you use Rust >= 1.62, this feature is implicitly enabled.
Otherwise it requires a nightly rustc.
* **deprecated**: `use_std` is deprecated, and is equivalent to `std`.
## Rust version support
The minimum supported Rust toolchain version is currently **Rust 1.13.0**.
(libc does not currently have any policy regarding changes to the minimum
supported Rust version; such policy is a work in progress.) APIs requiring
newer Rust features are only available on newer Rust toolchains:
| Feature | Version |
|----------------------|---------|
| `union` | 1.19.0 |
| `const mem::size_of` | 1.24.0 |
| `repr(align)` | 1.25.0 |
| `extra_traits` | 1.25.0 |
| `core::ffi::c_void` | 1.30.0 |
| `repr(packed(N))` | 1.33.0 |
| `cfg(target_vendor)` | 1.33.0 |
| `const-extern-fn` | 1.62.0 |
## Platform support
You can see the platform(target)-specific docs on [docs.rs], select a platform you want to see.
See
[`ci/build.sh`](https://github.com/rust-lang/libc/blob/HEAD/ci/build.sh)
for the platforms on which `libc` is guaranteed to build for each Rust
toolchain. The test-matrix at [GitHub Actions] and [Cirrus CI] show the
platforms in which `libc` tests are run.
<div class="platform_docs"></div>
## License
This project is licensed under either of
* [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)
([LICENSE-APACHE](https://github.com/rust-lang/libc/blob/HEAD/LICENSE-APACHE))
* [MIT License](https://opensource.org/licenses/MIT)
([LICENSE-MIT](https://github.com/rust-lang/libc/blob/HEAD/LICENSE-MIT))
at your option.
## Contributing
We welcome all people who want to contribute. Please see the [contributing
instructions] for more information.
[contributing instructions]: https://github.com/rust-lang/libc/blob/HEAD/CONTRIBUTING.md
Contributions in any form (issues, pull requests, etc.) to this project
must adhere to Rust's [Code of Conduct].
[Code of Conduct]: https://www.rust-lang.org/policies/code-of-conduct
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in `libc` by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.
[GitHub Actions]: https://github.com/rust-lang/libc/actions
[GHA Status]: https://github.com/rust-lang/libc/workflows/CI/badge.svg
[Cirrus CI]: https://cirrus-ci.com/github/rust-lang/libc
[Cirrus CI Status]: https://api.cirrus-ci.com/github/rust-lang/libc.svg
[crates.io]: https://crates.io/crates/libc
[Latest Version]: https://img.shields.io/crates/v/libc.svg
[Documentation]: https://docs.rs/libc/badge.svg
[docs.rs]: https://docs.rs/libc
[License]: https://img.shields.io/crates/l/libc.svg

View file

@ -0,0 +1,297 @@
use std::env;
use std::process::Command;
use std::str;
use std::string::String;
// List of cfgs this build script is allowed to set. The list is needed to support check-cfg, as we
// need to know all the possible cfgs that this script will set. If you need to set another cfg
// make sure to add it to this list as well.
const ALLOWED_CFGS: &'static [&'static str] = &[
"emscripten_new_stat_abi",
"freebsd10",
"freebsd11",
"freebsd12",
"freebsd13",
"freebsd14",
"freebsd15",
"libc_align",
"libc_cfg_target_vendor",
"libc_const_extern_fn",
"libc_const_extern_fn_unstable",
"libc_const_size_of",
"libc_core_cvoid",
"libc_deny_warnings",
"libc_int128",
"libc_long_array",
"libc_non_exhaustive",
"libc_packedN",
"libc_priv_mod_use",
"libc_ptr_addr_of",
"libc_thread_local",
"libc_underscore_const_names",
"libc_union",
];
// Extra values to allow for check-cfg.
const CHECK_CFG_EXTRA: &'static [(&'static str, &'static [&'static str])] = &[
("target_os", &["switch", "aix", "ohos", "hurd"]),
("target_env", &["illumos", "wasi", "aix", "ohos"]),
(
"target_arch",
&["loongarch64", "mips32r6", "mips64r6", "csky"],
),
];
fn main() {
// Avoid unnecessary re-building.
println!("cargo:rerun-if-changed=build.rs");
let (rustc_minor_ver, is_nightly) = rustc_minor_nightly();
let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
let align_cargo_feature = env::var("CARGO_FEATURE_ALIGN").is_ok();
let const_extern_fn_cargo_feature = env::var("CARGO_FEATURE_CONST_EXTERN_FN").is_ok();
let libc_ci = env::var("LIBC_CI").is_ok();
let libc_check_cfg = env::var("LIBC_CHECK_CFG").is_ok();
if env::var("CARGO_FEATURE_USE_STD").is_ok() {
println!(
"cargo:warning=\"libc's use_std cargo feature is deprecated since libc 0.2.55; \
please consider using the `std` cargo feature instead\""
);
}
// 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 => set_cfg("freebsd10"),
Some(11) if libc_ci => set_cfg("freebsd11"),
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(15) if libc_ci => set_cfg("freebsd15"),
Some(_) | None => set_cfg("freebsd11"),
}
match emcc_version_code() {
Some(v) if (v >= 30142) => set_cfg("emscripten_new_stat_abi"),
// Non-Emscripten or version < 3.1.42.
Some(_) | None => (),
}
// On CI: deny all warnings
if libc_ci {
set_cfg("libc_deny_warnings");
}
// Rust >= 1.15 supports private module use:
if rustc_minor_ver >= 15 || rustc_dep_of_std {
set_cfg("libc_priv_mod_use");
}
// Rust >= 1.19 supports unions:
if rustc_minor_ver >= 19 || rustc_dep_of_std {
set_cfg("libc_union");
}
// Rust >= 1.24 supports const mem::size_of:
if rustc_minor_ver >= 24 || rustc_dep_of_std {
set_cfg("libc_const_size_of");
}
// Rust >= 1.25 supports repr(align):
if rustc_minor_ver >= 25 || rustc_dep_of_std || align_cargo_feature {
set_cfg("libc_align");
}
// Rust >= 1.26 supports i128 and u128:
if rustc_minor_ver >= 26 || rustc_dep_of_std {
set_cfg("libc_int128");
}
// Rust >= 1.30 supports `core::ffi::c_void`, so libc can just re-export it.
// Otherwise, it defines an incompatible type to retaining
// backwards-compatibility.
if rustc_minor_ver >= 30 || rustc_dep_of_std {
set_cfg("libc_core_cvoid");
}
// Rust >= 1.33 supports repr(packed(N)) and cfg(target_vendor).
if rustc_minor_ver >= 33 || rustc_dep_of_std {
set_cfg("libc_packedN");
set_cfg("libc_cfg_target_vendor");
}
// Rust >= 1.40 supports #[non_exhaustive].
if rustc_minor_ver >= 40 || rustc_dep_of_std {
set_cfg("libc_non_exhaustive");
}
// Rust >= 1.47 supports long array:
if rustc_minor_ver >= 47 || rustc_dep_of_std {
set_cfg("libc_long_array");
}
if rustc_minor_ver >= 51 || rustc_dep_of_std {
set_cfg("libc_ptr_addr_of");
}
// Rust >= 1.37.0 allows underscores as anonymous constant names.
if rustc_minor_ver >= 37 || rustc_dep_of_std {
set_cfg("libc_underscore_const_names");
}
// #[thread_local] is currently unstable
if rustc_dep_of_std {
set_cfg("libc_thread_local");
}
// Rust >= 1.62.0 allows to use `const_extern_fn` for "Rust" and "C".
if rustc_minor_ver >= 62 {
set_cfg("libc_const_extern_fn");
} else {
// Rust < 1.62.0 requires a crate feature and feature gate.
if const_extern_fn_cargo_feature {
if !is_nightly || rustc_minor_ver < 40 {
panic!("const-extern-fn requires a nightly compiler >= 1.40");
}
set_cfg("libc_const_extern_fn_unstable");
set_cfg("libc_const_extern_fn");
}
}
// check-cfg is a nightly cargo/rustc feature to warn when unknown cfgs are used across the
// codebase. libc can configure it if the appropriate environment variable is passed. Since
// rust-lang/rust enforces it, this is useful when using a custom libc fork there.
//
// https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#check-cfg
if libc_check_cfg {
for cfg in ALLOWED_CFGS {
if rustc_minor_ver >= 75 {
println!("cargo:rustc-check-cfg=cfg({})", cfg);
} else {
println!("cargo:rustc-check-cfg=values({})", cfg);
}
}
for &(name, values) in CHECK_CFG_EXTRA {
let values = values.join("\",\"");
if rustc_minor_ver >= 75 {
println!("cargo:rustc-check-cfg=cfg({},values(\"{}\"))", name, values);
} else {
println!("cargo:rustc-check-cfg=values({},\"{}\")", name, values);
}
}
}
}
fn rustc_minor_nightly() -> (u32, bool) {
macro_rules! otry {
($e:expr) => {
match $e {
Some(e) => e,
None => panic!("Failed to get rustc version"),
}
};
}
let rustc = otry!(env::var_os("RUSTC"));
let output = Command::new(rustc)
.arg("--version")
.output()
.ok()
.expect("Failed to get rustc version");
if !output.status.success() {
panic!(
"failed to run rustc: {}",
String::from_utf8_lossy(output.stderr.as_slice())
);
}
let version = otry!(str::from_utf8(&output.stdout).ok());
let mut pieces = version.split('.');
if pieces.next() != Some("rustc 1") {
panic!("Failed to get rustc version");
}
let minor = pieces.next();
// If `rustc` was built from a tarball, its version string
// will have neither a git hash nor a commit date
// (e.g. "rustc 1.39.0"). Treat this case as non-nightly,
// since a nightly build should either come from CI
// or a git checkout
let nightly_raw = otry!(pieces.next()).split('-').nth(1);
let nightly = nightly_raw
.map(|raw| raw.starts_with("dev") || raw.starts_with("nightly"))
.unwrap_or(false);
let minor = otry!(otry!(minor).parse().ok());
(minor, nightly)
}
fn which_freebsd() -> Option<i32> {
let output = std::process::Command::new("freebsd-version").output().ok();
if output.is_none() {
return None;
}
let output = output.unwrap();
if !output.status.success() {
return None;
}
let stdout = String::from_utf8(output.stdout).ok();
if stdout.is_none() {
return None;
}
let stdout = stdout.unwrap();
match &stdout {
s if s.starts_with("10") => Some(10),
s if s.starts_with("11") => Some(11),
s if s.starts_with("12") => Some(12),
s if s.starts_with("13") => Some(13),
s if s.starts_with("14") => Some(14),
s if s.starts_with("15") => Some(15),
_ => None,
}
}
fn emcc_version_code() -> Option<u64> {
let output = std::process::Command::new("emcc")
.arg("-dumpversion")
.output()
.ok();
if output.is_none() {
return None;
}
let output = output.unwrap();
if !output.status.success() {
return None;
}
let stdout = String::from_utf8(output.stdout).ok();
if stdout.is_none() {
return None;
}
let version = stdout.unwrap();
// Some Emscripten versions come with `-git` attached, so split the
// version string also on the `-` char.
let mut pieces = version.trim().split(|c| c == '.' || c == '-');
let major = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
let minor = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
let patch = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
Some(major * 10000 + minor * 100 + patch)
}
fn set_cfg(cfg: &str) {
if !ALLOWED_CFGS.contains(&cfg) {
panic!("trying to set cfg {}, but it is not in ALLOWED_CFGS", cfg);
}
println!("cargo:rustc-cfg={}", cfg);
}

View file

@ -0,0 +1 @@
error_on_line_overflow = true

View file

@ -0,0 +1,99 @@
//! This module contains type aliases for C's fixed-width integer types .
//!
//! These aliases are deprecated: use the Rust types instead.
#[deprecated(since = "0.2.55", note = "Use i8 instead.")]
pub type int8_t = i8;
#[deprecated(since = "0.2.55", note = "Use i16 instead.")]
pub type int16_t = i16;
#[deprecated(since = "0.2.55", note = "Use i32 instead.")]
pub type int32_t = i32;
#[deprecated(since = "0.2.55", note = "Use i64 instead.")]
pub type int64_t = i64;
#[deprecated(since = "0.2.55", note = "Use u8 instead.")]
pub type uint8_t = u8;
#[deprecated(since = "0.2.55", note = "Use u16 instead.")]
pub type uint16_t = u16;
#[deprecated(since = "0.2.55", note = "Use u32 instead.")]
pub type uint32_t = u32;
#[deprecated(since = "0.2.55", note = "Use u64 instead.")]
pub type uint64_t = u64;
cfg_if! {
if #[cfg(all(libc_int128, target_arch = "aarch64", not(target_os = "windows")))] {
// This introduces partial support for FFI with __int128 and
// equivalent types on platforms where Rust's definition is validated
// to match the standard C ABI of that platform.
//
// Rust does not guarantee u128/i128 are sound for FFI, and its
// definitions are in fact known to be incompatible. [0]
//
// However these problems aren't fundamental, and are just platform
// inconsistencies. Specifically at the time of this writing:
//
// * For x64 SysV ABIs (everything but Windows), the types are underaligned.
// * For all Windows ABIs, Microsoft doesn't actually officially define __int128,
// and as a result different implementations don't actually agree on its ABI.
//
// But on the other major aarch64 platforms (android, linux, ios, macos) we have
// validated that rustc has the right ABI for these types. This is important because
// aarch64 uses these types in some fundamental OS types like user_fpsimd_struct,
// which represents saved simd registers.
//
// Any API which uses these types will need to `#[ignore(improper_ctypes)]`
// until the upstream rust issue is resolved, but this at least lets us make
// progress on platforms where this type is important.
//
// The list of supported architectures and OSes is intentionally very restricted,
// as careful work needs to be done to verify that a particular platform
// has a conformant ABI.
//
// [0]: https://github.com/rust-lang/rust/issues/54341
/// C `__int128` (a GCC extension that's part of many ABIs)
pub type __int128 = i128;
/// C `unsigned __int128` (a GCC extension that's part of many ABIs)
pub type __uint128 = u128;
/// C __int128_t (alternate name for [__int128][])
pub type __int128_t = i128;
/// C __uint128_t (alternate name for [__uint128][])
pub type __uint128_t = u128;
cfg_if! {
if #[cfg(libc_underscore_const_names)] {
macro_rules! static_assert_eq {
($a:expr, $b:expr) => {
const _: [(); $a] = [(); $b];
};
}
// NOTE: if you add more platforms to here, you may need to cfg
// these consts. They should always match the platform's values
// for `sizeof(__int128)` and `_Alignof(__int128)`.
const _SIZE_128: usize = 16;
const _ALIGN_128: usize = 16;
// Since Rust doesn't officially guarantee that these types
// have compatible ABIs, we const assert that these values have the
// known size/align of the target platform's libc. If rustc ever
// tries to regress things, it will cause a compilation error.
//
// This isn't a bullet-proof solution because e.g. it doesn't
// catch the fact that llvm and gcc disagree on how x64 __int128
// is actually *passed* on the stack (clang underaligns it for
// the same reason that rustc *never* properly aligns it).
static_assert_eq!(core::mem::size_of::<__int128>(), _SIZE_128);
static_assert_eq!(core::mem::align_of::<__int128>(), _ALIGN_128);
static_assert_eq!(core::mem::size_of::<__uint128>(), _SIZE_128);
static_assert_eq!(core::mem::align_of::<__uint128>(), _ALIGN_128);
static_assert_eq!(core::mem::size_of::<__int128_t>(), _SIZE_128);
static_assert_eq!(core::mem::align_of::<__int128_t>(), _ALIGN_128);
static_assert_eq!(core::mem::size_of::<__uint128_t>(), _SIZE_128);
static_assert_eq!(core::mem::align_of::<__uint128_t>(), _ALIGN_128);
}
}
}
}

View file

@ -0,0 +1,67 @@
pub type c_char = u8;
pub type __u64 = ::c_ulonglong;
pub type wchar_t = u32;
pub type nlink_t = ::c_ulong;
pub type blksize_t = ::c_long;
s! {
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_mode: ::mode_t,
pub st_nlink: ::nlink_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_rdev: ::dev_t,
__pad0: ::c_ulong,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
__pad1: ::c_int,
pub st_blocks: ::blkcnt_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
__unused: [::c_uint; 2],
}
pub struct stat64 {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_mode: ::mode_t,
pub st_nlink: ::nlink_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_rdev: ::dev_t,
__pad0: ::c_ulong,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
__pad1: ::c_int,
pub st_blocks: ::blkcnt_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
__unused: [::c_uint; 2],
}
pub struct ipc_perm {
pub __ipc_perm_key: ::key_t,
pub uid: ::uid_t,
pub gid: ::gid_t,
pub cuid: ::uid_t,
pub cgid: ::gid_t,
pub mode: ::mode_t,
pub __seq: ::c_ushort,
__unused1: ::c_ulong,
__unused2: ::c_ulong,
}
}
// From https://cs.opensource.google/fuchsia/fuchsia/+/main:zircon/third_party/ulib/musl/include/bits/signal.h;l=20-21;drc=0827b18ab9540c46f8037f407d17ea15a79e9ba7
pub const MINSIGSTKSZ: ::size_t = 6144;
pub const SIGSTKSZ: ::size_t = 12288;

View file

@ -0,0 +1,142 @@
macro_rules! expand_align {
() => {
s! {
#[cfg_attr(
any(
target_pointer_width = "32",
target_arch = "x86_64"
),
repr(align(4)))]
#[cfg_attr(
not(any(
target_pointer_width = "32",
target_arch = "x86_64"
)),
repr(align(8)))]
pub struct pthread_mutexattr_t {
size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T],
}
#[cfg_attr(target_pointer_width = "32",
repr(align(4)))]
#[cfg_attr(target_pointer_width = "64",
repr(align(8)))]
pub struct pthread_rwlockattr_t {
size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T],
}
#[repr(align(4))]
pub struct pthread_condattr_t {
size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
}
}
s_no_extra_traits! {
#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "arm",
target_arch = "x86_64")),
repr(align(4)))]
#[cfg_attr(any(target_pointer_width = "64",
not(any(target_arch = "arm",
target_arch = "x86_64"))),
repr(align(8)))]
pub struct pthread_mutex_t {
size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
}
#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "arm",
target_arch = "x86_64")),
repr(align(4)))]
#[cfg_attr(any(target_pointer_width = "64",
not(any(target_arch = "arm",
target_arch = "x86_64"))),
repr(align(8)))]
pub struct pthread_rwlock_t {
size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T],
}
#[cfg_attr(target_pointer_width = "32",
repr(align(4)))]
#[cfg_attr(target_pointer_width = "64",
repr(align(8)))]
#[cfg_attr(target_arch = "x86",
repr(align(4)))]
#[cfg_attr(not(target_arch = "x86"),
repr(align(8)))]
pub struct pthread_cond_t {
size: [u8; ::__SIZEOF_PTHREAD_COND_T],
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for pthread_cond_t {
fn eq(&self, other: &pthread_cond_t) -> bool {
self.size
.iter()
.zip(other.size.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for pthread_cond_t {}
impl ::fmt::Debug for pthread_cond_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("pthread_cond_t")
// FIXME: .field("size", &self.size)
.finish()
}
}
impl ::hash::Hash for pthread_cond_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.size.hash(state);
}
}
impl PartialEq for pthread_mutex_t {
fn eq(&self, other: &pthread_mutex_t) -> bool {
self.size
.iter()
.zip(other.size.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for pthread_mutex_t {}
impl ::fmt::Debug for pthread_mutex_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("pthread_mutex_t")
// FIXME: .field("size", &self.size)
.finish()
}
}
impl ::hash::Hash for pthread_mutex_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.size.hash(state);
}
}
impl PartialEq for pthread_rwlock_t {
fn eq(&self, other: &pthread_rwlock_t) -> bool {
self.size
.iter()
.zip(other.size.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for pthread_rwlock_t {}
impl ::fmt::Debug for pthread_rwlock_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("pthread_rwlock_t")
// FIXME: .field("size", &self.size)
.finish()
}
}
impl ::hash::Hash for pthread_rwlock_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.size.hash(state);
}
}
}
}
};
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,129 @@
macro_rules! expand_align {
() => {
s! {
pub struct pthread_mutexattr_t {
#[cfg(target_arch = "x86_64")]
__align: [::c_int; 0],
#[cfg(not(target_arch = "x86_64"))]
__align: [::c_long; 0],
size: [u8; ::__SIZEOF_PTHREAD_MUTEXATTR_T],
}
pub struct pthread_rwlockattr_t {
__align: [::c_long; 0],
size: [u8; ::__SIZEOF_PTHREAD_RWLOCKATTR_T],
}
pub struct pthread_condattr_t {
__align: [::c_int; 0],
size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
}
}
s_no_extra_traits! {
pub struct pthread_mutex_t {
#[cfg(any(target_arch = "arm",
all(target_arch = "x86_64",
target_pointer_width = "32")))]
__align: [::c_long; 0],
#[cfg(not(any(target_arch = "arm",
all(target_arch = "x86_64",
target_pointer_width = "32"))))]
__align: [::c_longlong; 0],
size: [u8; ::__SIZEOF_PTHREAD_MUTEX_T],
}
pub struct pthread_rwlock_t {
__align: [::c_long; 0],
__align: [::c_longlong; 0],
size: [u8; ::__SIZEOF_PTHREAD_RWLOCK_T],
}
pub struct pthread_cond_t {
__align: [*const ::c_void; 0],
#[cfg(not(target_env = "musl"))]
__align: [::c_longlong; 0],
size: [u8; ::__SIZEOF_PTHREAD_COND_T],
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for pthread_cond_t {
fn eq(&self, other: &pthread_cond_t) -> bool {
// Ignore __align field
self.size
.iter()
.zip(other.size.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for pthread_cond_t {}
impl ::fmt::Debug for pthread_cond_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("pthread_cond_t")
// Ignore __align field
// FIXME: .field("size", &self.size)
.finish()
}
}
impl ::hash::Hash for pthread_cond_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
// Ignore __align field
self.size.hash(state);
}
}
impl PartialEq for pthread_mutex_t {
fn eq(&self, other: &pthread_mutex_t) -> bool {
// Ignore __align field
self.size
.iter()
.zip(other.size.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for pthread_mutex_t {}
impl ::fmt::Debug for pthread_mutex_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("pthread_mutex_t")
// Ignore __align field
// FIXME: .field("size", &self.size)
.finish()
}
}
impl ::hash::Hash for pthread_mutex_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
// Ignore __align field
self.size.hash(state);
}
}
impl PartialEq for pthread_rwlock_t {
fn eq(&self, other: &pthread_rwlock_t) -> bool {
// Ignore __align field
self.size
.iter()
.zip(other.size.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for pthread_rwlock_t {}
impl ::fmt::Debug for pthread_rwlock_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("pthread_rwlock_t")
// Ignore __align field
// FIXME: .field("size", &self.size)
.finish()
}
}
impl ::hash::Hash for pthread_rwlock_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
// Ignore __align field
self.size.hash(state);
}
}
}
}
};
}

View file

@ -0,0 +1,44 @@
// From psABI Calling Convention for RV64
pub type c_char = u8;
pub type __u64 = ::c_ulonglong;
pub type wchar_t = i32;
pub type nlink_t = ::c_ulong;
pub type blksize_t = ::c_long;
pub type stat64 = stat;
s! {
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_nlink: ::nlink_t,
pub st_mode: ::mode_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
__pad0: ::c_int,
pub st_rdev: ::dev_t,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
__unused: [::c_long; 3],
}
// Not actually used, IPC calls just return ENOSYS
pub struct ipc_perm {
pub __ipc_perm_key: ::key_t,
pub uid: ::uid_t,
pub gid: ::gid_t,
pub cuid: ::uid_t,
pub cgid: ::gid_t,
pub mode: ::mode_t,
pub __seq: ::c_ushort,
__unused1: ::c_ulong,
__unused2: ::c_ulong,
}
}

View file

@ -0,0 +1,152 @@
pub type c_char = i8;
pub type wchar_t = i32;
pub type nlink_t = u64;
pub type blksize_t = ::c_long;
pub type __u64 = ::c_ulonglong;
s! {
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_nlink: ::nlink_t,
pub st_mode: ::mode_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
__pad0: ::c_int,
pub st_rdev: ::dev_t,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
__unused: [::c_long; 3],
}
pub struct stat64 {
pub st_dev: ::dev_t,
pub st_ino: ::ino64_t,
pub st_nlink: ::nlink_t,
pub st_mode: ::mode_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
__pad0: ::c_int,
pub st_rdev: ::dev_t,
pub st_size: ::off_t,
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt64_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
__reserved: [::c_long; 3],
}
pub struct mcontext_t {
__private: [u64; 32],
}
pub struct ipc_perm {
pub __ipc_perm_key: ::key_t,
pub uid: ::uid_t,
pub gid: ::gid_t,
pub cuid: ::uid_t,
pub cgid: ::gid_t,
pub mode: ::mode_t,
pub __seq: ::c_int,
__unused1: ::c_long,
__unused2: ::c_long
}
}
s_no_extra_traits! {
pub struct ucontext_t {
pub uc_flags: ::c_ulong,
pub uc_link: *mut ucontext_t,
pub uc_stack: ::stack_t,
pub uc_mcontext: mcontext_t,
pub uc_sigmask: ::sigset_t,
__private: [u8; 512],
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for ucontext_t {
fn eq(&self, other: &ucontext_t) -> bool {
self.uc_flags == other.uc_flags
&& self.uc_link == other.uc_link
&& self.uc_stack == other.uc_stack
&& self.uc_mcontext == other.uc_mcontext
&& self.uc_sigmask == other.uc_sigmask
&& self
.__private
.iter()
.zip(other.__private.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for ucontext_t {}
impl ::fmt::Debug for ucontext_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("ucontext_t")
.field("uc_flags", &self.uc_flags)
.field("uc_link", &self.uc_link)
.field("uc_stack", &self.uc_stack)
.field("uc_mcontext", &self.uc_mcontext)
.field("uc_sigmask", &self.uc_sigmask)
// FIXME: .field("__private", &self.__private)
.finish()
}
}
impl ::hash::Hash for ucontext_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.uc_flags.hash(state);
self.uc_link.hash(state);
self.uc_stack.hash(state);
self.uc_mcontext.hash(state);
self.uc_sigmask.hash(state);
self.__private.hash(state);
}
}
}
}
// offsets in user_regs_structs, from sys/reg.h
pub const R15: ::c_int = 0;
pub const R14: ::c_int = 1;
pub const R13: ::c_int = 2;
pub const R12: ::c_int = 3;
pub const RBP: ::c_int = 4;
pub const RBX: ::c_int = 5;
pub const R11: ::c_int = 6;
pub const R10: ::c_int = 7;
pub const R9: ::c_int = 8;
pub const R8: ::c_int = 9;
pub const RAX: ::c_int = 10;
pub const RCX: ::c_int = 11;
pub const RDX: ::c_int = 12;
pub const RSI: ::c_int = 13;
pub const RDI: ::c_int = 14;
pub const ORIG_RAX: ::c_int = 15;
pub const RIP: ::c_int = 16;
pub const CS: ::c_int = 17;
pub const EFLAGS: ::c_int = 18;
pub const RSP: ::c_int = 19;
pub const SS: ::c_int = 20;
pub const FS_BASE: ::c_int = 21;
pub const GS_BASE: ::c_int = 22;
pub const DS: ::c_int = 23;
pub const ES: ::c_int = 24;
pub const FS: ::c_int = 25;
pub const GS: ::c_int = 26;
pub const MAP_32BIT: ::c_int = 0x0040;
pub const SIGSTKSZ: ::size_t = 8192;
pub const MINSIGSTKSZ: ::size_t = 2048;

View file

@ -0,0 +1,2 @@
pub type c_char = u8;
pub type wchar_t = u32;

View file

@ -0,0 +1,61 @@
//! Hermit C types definition
pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
pub type c_ushort = u16;
pub type c_int = i32;
pub type c_uint = u32;
pub type c_float = f32;
pub type c_double = f64;
pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type intmax_t = i64;
pub type uintmax_t = u64;
pub type size_t = usize;
pub type ptrdiff_t = isize;
pub type intptr_t = isize;
pub type uintptr_t = usize;
pub type ssize_t = isize;
pub type c_long = i64;
pub type c_ulong = u64;
pub type wint_t = u32;
pub type wctype_t = i64;
pub type regoff_t = size_t;
pub type off_t = c_long;
cfg_if! {
if #[cfg(target_arch = "aarch64")] {
mod aarch64;
pub use self::aarch64::*;
} else if #[cfg(target_arch = "x86_64")] {
mod x86_64;
pub use self::x86_64::*;
} else {
// Unknown target_arch
}
}
cfg_if! {
if #[cfg(libc_core_cvoid)] {
pub use ::ffi::c_void;
} else {
// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
// enable more optimization opportunities around it recognizing things
// like malloc/free.
#[repr(u8)]
#[allow(missing_copy_implementations)]
#[allow(missing_debug_implementations)]
pub enum c_void {
// Two dummy variants so the #[repr] attribute can be used.
#[doc(hidden)]
__variant1,
#[doc(hidden)]
__variant2,
}
}
}

View file

@ -0,0 +1,2 @@
pub type c_char = i8;
pub type wchar_t = i32;

View file

@ -0,0 +1,165 @@
//! libc - Raw FFI bindings to platforms' system libraries
#![crate_name = "libc"]
#![crate_type = "rlib"]
#![allow(
renamed_and_removed_lints, // Keep this order.
unknown_lints, // Keep this order.
bad_style,
overflowing_literals,
improper_ctypes,
// This lint is renamed but we run CI for old stable rustc so should be here.
redundant_semicolon,
redundant_semicolons,
unused_macros,
unused_macro_rules,
)]
#![cfg_attr(libc_deny_warnings, deny(warnings))]
// Attributes needed when building as part of the standard library
#![cfg_attr(feature = "rustc-dep-of-std", feature(link_cfg, no_core))]
#![cfg_attr(libc_thread_local, feature(thread_local))]
// Enable extra lints:
#![cfg_attr(feature = "extra_traits", deny(missing_debug_implementations))]
#![deny(missing_copy_implementations, safe_packed_borrows)]
#![cfg_attr(not(feature = "rustc-dep-of-std"), no_std)]
#![cfg_attr(feature = "rustc-dep-of-std", no_core)]
#![cfg_attr(libc_const_extern_fn_unstable, feature(const_extern_fn))]
#[macro_use]
mod macros;
cfg_if! {
if #[cfg(feature = "rustc-dep-of-std")] {
extern crate rustc_std_workspace_core as core;
#[allow(unused_imports)]
use core::iter;
#[allow(unused_imports)]
use core::ops;
#[allow(unused_imports)]
use core::option;
}
}
cfg_if! {
if #[cfg(libc_priv_mod_use)] {
#[cfg(libc_core_cvoid)]
#[allow(unused_imports)]
use core::ffi;
#[allow(unused_imports)]
use core::fmt;
#[allow(unused_imports)]
use core::hash;
#[allow(unused_imports)]
use core::num;
#[allow(unused_imports)]
use core::mem;
#[doc(hidden)]
#[allow(unused_imports)]
use core::clone::Clone;
#[doc(hidden)]
#[allow(unused_imports)]
use core::marker::{Copy, Send, Sync};
#[doc(hidden)]
#[allow(unused_imports)]
use core::option::Option;
} else {
#[doc(hidden)]
#[allow(unused_imports)]
pub use core::fmt;
#[doc(hidden)]
#[allow(unused_imports)]
pub use core::hash;
#[doc(hidden)]
#[allow(unused_imports)]
pub use core::num;
#[doc(hidden)]
#[allow(unused_imports)]
pub use core::mem;
#[doc(hidden)]
#[allow(unused_imports)]
pub use core::clone::Clone;
#[doc(hidden)]
#[allow(unused_imports)]
pub use core::marker::{Copy, Send, Sync};
#[doc(hidden)]
#[allow(unused_imports)]
pub use core::option::Option;
}
}
cfg_if! {
if #[cfg(windows)] {
mod fixed_width_ints;
pub use fixed_width_ints::*;
mod windows;
pub use windows::*;
} else if #[cfg(target_os = "fuchsia")] {
mod fixed_width_ints;
pub use fixed_width_ints::*;
mod fuchsia;
pub use fuchsia::*;
} else if #[cfg(target_os = "switch")] {
mod fixed_width_ints;
pub use fixed_width_ints::*;
mod switch;
pub use switch::*;
} else if #[cfg(target_os = "psp")] {
mod fixed_width_ints;
pub use fixed_width_ints::*;
mod psp;
pub use psp::*;
} else if #[cfg(target_os = "vxworks")] {
mod fixed_width_ints;
pub use fixed_width_ints::*;
mod vxworks;
pub use vxworks::*;
} else if #[cfg(target_os = "solid_asp3")] {
mod fixed_width_ints;
pub use fixed_width_ints::*;
mod solid;
pub use solid::*;
} else if #[cfg(unix)] {
mod fixed_width_ints;
pub use fixed_width_ints::*;
mod unix;
pub use unix::*;
} else if #[cfg(target_os = "hermit")] {
mod fixed_width_ints;
pub use fixed_width_ints::*;
mod hermit;
pub use hermit::*;
} else if #[cfg(target_os = "teeos")] {
mod fixed_width_ints;
pub use fixed_width_ints::*;
mod teeos;
pub use teeos::*;
} else if #[cfg(all(target_env = "sgx", target_vendor = "fortanix"))] {
mod fixed_width_ints;
pub use fixed_width_ints::*;
mod sgx;
pub use sgx::*;
} else if #[cfg(any(target_env = "wasi", target_os = "wasi"))] {
mod fixed_width_ints;
pub use fixed_width_ints::*;
mod wasi;
pub use wasi::*;
} else if #[cfg(target_os = "xous")] {
mod fixed_width_ints;
pub use fixed_width_ints::*;
mod xous;
pub use xous::*;
} else {
// non-supported targets: empty...
}
}

View file

@ -0,0 +1,349 @@
/// A macro for defining #[cfg] if-else statements.
///
/// This is similar to the `if/elif` C preprocessor macro by allowing definition
/// of a cascade of `#[cfg]` cases, emitting the implementation which matches
/// first.
///
/// This allows you to conveniently provide a long list #[cfg]'d blocks of code
/// without having to rewrite each clause multiple times.
macro_rules! cfg_if {
// match if/else chains with a final `else`
($(
if #[cfg($($meta:meta),*)] { $($it:item)* }
) else * else {
$($it2:item)*
}) => {
cfg_if! {
@__items
() ;
$( ( ($($meta),*) ($($it)*) ), )*
( () ($($it2)*) ),
}
};
// match if/else chains lacking a final `else`
(
if #[cfg($($i_met:meta),*)] { $($i_it:item)* }
$(
else if #[cfg($($e_met:meta),*)] { $($e_it:item)* }
)*
) => {
cfg_if! {
@__items
() ;
( ($($i_met),*) ($($i_it)*) ),
$( ( ($($e_met),*) ($($e_it)*) ), )*
( () () ),
}
};
// Internal and recursive macro to emit all the items
//
// Collects all the negated `cfg`s in a list at the beginning and after the
// semicolon is all the remaining items
(@__items ($($not:meta,)*) ; ) => {};
(@__items ($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ),
$($rest:tt)*) => {
// Emit all items within one block, applying an appropriate #[cfg]. The
// #[cfg] will require all `$m` matchers specified and must also negate
// all previous matchers.
cfg_if! { @__apply cfg(all($($m,)* not(any($($not),*)))), $($it)* }
// Recurse to emit all other items in `$rest`, and when we do so add all
// our `$m` matchers to the list of `$not` matchers as future emissions
// will have to negate everything we just matched as well.
cfg_if! { @__items ($($not,)* $($m,)*) ; $($rest)* }
};
// Internal macro to Apply a cfg attribute to a list of items
(@__apply $m:meta, $($it:item)*) => {
$(#[$m] $it)*
};
}
macro_rules! s {
($($(#[$attr:meta])* pub $t:ident $i:ident { $($field:tt)* })*) => ($(
s!(it: $(#[$attr])* pub $t $i { $($field)* });
)*);
(it: $(#[$attr:meta])* pub union $i:ident { $($field:tt)* }) => (
compile_error!("unions cannot derive extra traits, use s_no_extra_traits instead");
);
(it: $(#[$attr:meta])* pub struct $i:ident { $($field:tt)* }) => (
__item! {
#[repr(C)]
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
#[allow(deprecated)]
$(#[$attr])*
pub struct $i { $($field)* }
}
#[allow(deprecated)]
impl ::Copy for $i {}
#[allow(deprecated)]
impl ::Clone for $i {
fn clone(&self) -> $i { *self }
}
);
}
macro_rules! s_no_extra_traits {
($($(#[$attr:meta])* pub $t:ident $i:ident { $($field:tt)* })*) => ($(
s_no_extra_traits!(it: $(#[$attr])* pub $t $i { $($field)* });
)*);
(it: $(#[$attr:meta])* pub union $i:ident { $($field:tt)* }) => (
cfg_if! {
if #[cfg(libc_union)] {
__item! {
#[repr(C)]
$(#[$attr])*
pub union $i { $($field)* }
}
impl ::Copy for $i {}
impl ::Clone for $i {
fn clone(&self) -> $i { *self }
}
}
}
);
(it: $(#[$attr:meta])* pub struct $i:ident { $($field:tt)* }) => (
__item! {
#[repr(C)]
$(#[$attr])*
pub struct $i { $($field)* }
}
#[allow(deprecated)]
impl ::Copy for $i {}
#[allow(deprecated)]
impl ::Clone for $i {
fn clone(&self) -> $i { *self }
}
);
}
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! {
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
$(#[$attr])*
pub enum $i { $($field)* }
}
impl ::Copy for $i {}
impl ::Clone for $i {
fn clone(&self) -> $i { *self }
}
)*);
}
macro_rules! s_paren {
($($(#[$attr:meta])* pub struct $i:ident ( $($field:tt)* ); )* ) => ($(
__item! {
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
$(#[$attr])*
pub struct $i ( $($field)* );
}
impl ::Copy for $i {}
impl ::Clone for $i {
fn clone(&self) -> $i { *self }
}
)*);
}
// This is a pretty horrible hack to allow us to conditionally mark
// some functions as 'const', without requiring users of this macro
// to care about the "const-extern-fn" feature.
//
// When 'const-extern-fn' is enabled, we emit the captured 'const' keyword
// in the expanded function.
//
// When 'const-extern-fn' is disabled, we always emit a plain 'pub unsafe extern fn'.
// Note that the expression matched by the macro is exactly the same - this allows
// users of this macro to work whether or not 'const-extern-fn' is enabled
//
// Unfortunately, we need to duplicate most of this macro between the 'cfg_if' blocks.
// This is because 'const unsafe extern fn' won't even parse on older compilers,
// so we need to avoid emitting it at all of 'const-extern-fn'.
//
// Specifically, moving the 'cfg_if' into the macro body will *not* work.
// Doing so would cause the '#[cfg(feature = "const-extern-fn")]' to be emitted
// into user code. The 'cfg' gate will not stop Rust from trying to parse the
// 'pub const unsafe extern fn', so users would get a compiler error even when
// the 'const-extern-fn' feature is disabled
//
// Note that users of this macro need to place 'const' in a weird position
// (after the closing ')' for the arguments, but before the return type).
// This was the only way I could satisfy the following two requirements:
// 1. Avoid ambiguity errors from 'macro_rules!' (which happen when writing '$foo:ident fn'
// 2. Allow users of this macro to mix 'pub fn foo' and 'pub const fn bar' within the same
// 'f!' block
cfg_if! {
if #[cfg(libc_const_extern_fn)] {
macro_rules! f {
($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident(
$($arg:ident: $argty:ty),*
) -> $ret:ty {
$($body:stmt);*
})*) => ($(
#[inline]
$(#[$attr])*
pub $($constness)* unsafe extern fn $i($($arg: $argty),*
) -> $ret {
$($body);*
}
)*)
}
macro_rules! safe_f {
($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident(
$($arg:ident: $argty:ty),*
) -> $ret:ty {
$($body:stmt);*
})*) => ($(
#[inline]
$(#[$attr])*
pub $($constness)* extern fn $i($($arg: $argty),*
) -> $ret {
$($body);*
}
)*)
}
macro_rules! const_fn {
($($(#[$attr:meta])* $({$constness:ident})* fn $i:ident(
$($arg:ident: $argty:ty),*
) -> $ret:ty {
$($body:stmt);*
})*) => ($(
#[inline]
$(#[$attr])*
$($constness)* fn $i($($arg: $argty),*
) -> $ret {
$($body);*
}
)*)
}
} else {
macro_rules! f {
($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident(
$($arg:ident: $argty:ty),*
) -> $ret:ty {
$($body:stmt);*
})*) => ($(
#[inline]
$(#[$attr])*
pub unsafe extern fn $i($($arg: $argty),*
) -> $ret {
$($body);*
}
)*)
}
macro_rules! safe_f {
($($(#[$attr:meta])* pub $({$constness:ident})* fn $i:ident(
$($arg:ident: $argty:ty),*
) -> $ret:ty {
$($body:stmt);*
})*) => ($(
#[inline]
$(#[$attr])*
pub extern fn $i($($arg: $argty),*
) -> $ret {
$($body);*
}
)*)
}
macro_rules! const_fn {
($($(#[$attr:meta])* $({$constness:ident})* fn $i:ident(
$($arg:ident: $argty:ty),*
) -> $ret:ty {
$($body:stmt);*
})*) => ($(
#[inline]
$(#[$attr])*
fn $i($($arg: $argty),*
) -> $ret {
$($body);*
}
)*)
}
}
}
macro_rules! __item {
($i:item) => {
$i
};
}
macro_rules! align_const {
($($(#[$attr:meta])*
pub const $name:ident : $t1:ty
= $t2:ident { $($field:tt)* };)*) => ($(
#[cfg(libc_align)]
$(#[$attr])*
pub const $name : $t1 = $t2 {
$($field)*
};
#[cfg(not(libc_align))]
$(#[$attr])*
pub const $name : $t1 = $t2 {
$($field)*
__align: [],
};
)*)
}
// This macro is used to deprecate items that should be accessed via the mach2 crate
macro_rules! deprecated_mach {
(pub const $id:ident: $ty:ty = $expr:expr;) => {
#[deprecated(
since = "0.2.55",
note = "Use the `mach2` crate instead",
)]
#[allow(deprecated)]
pub const $id: $ty = $expr;
};
($(pub const $id:ident: $ty:ty = $expr:expr;)*) => {
$(
deprecated_mach!(
pub const $id: $ty = $expr;
);
)*
};
(pub type $id:ident = $ty:ty;) => {
#[deprecated(
since = "0.2.55",
note = "Use the `mach2` crate instead",
)]
#[allow(deprecated)]
pub type $id = $ty;
};
($(pub type $id:ident = $ty:ty;)*) => {
$(
deprecated_mach!(
pub type $id = $ty;
);
)*
}
}
#[cfg(not(libc_ptr_addr_of))]
macro_rules! ptr_addr_of {
($place:expr) => {
&$place
};
}
#[cfg(libc_ptr_addr_of)]
macro_rules! ptr_addr_of {
($place:expr) => {
::core::ptr::addr_of!($place)
};
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,47 @@
//! SGX C types definition
pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
pub type c_ushort = u16;
pub type c_int = i32;
pub type c_uint = u32;
pub type c_float = f32;
pub type c_double = f64;
pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type intmax_t = i64;
pub type uintmax_t = u64;
pub type size_t = usize;
pub type ptrdiff_t = isize;
pub type intptr_t = isize;
pub type uintptr_t = usize;
pub type ssize_t = isize;
pub type c_char = i8;
pub type c_long = i64;
pub type c_ulong = u64;
pub const INT_MIN: c_int = -2147483648;
pub const INT_MAX: c_int = 2147483647;
cfg_if! {
if #[cfg(libc_core_cvoid)] {
pub use ::ffi::c_void;
} else {
// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
// enable more optimization opportunities around it recognizing things
// like malloc/free.
#[repr(u8)]
#[allow(missing_copy_implementations)]
#[allow(missing_debug_implementations)]
pub enum c_void {
// Two dummy variants so the #[repr] attribute can be used.
#[doc(hidden)]
__variant1,
#[doc(hidden)]
__variant2,
}
}
}

View file

@ -0,0 +1,4 @@
pub type c_char = i8;
pub type wchar_t = u32;
pub type c_long = i64;
pub type c_ulong = u64;

View file

@ -0,0 +1,4 @@
pub type c_char = i8;
pub type wchar_t = u32;
pub type c_long = i32;
pub type c_ulong = u32;

View file

@ -0,0 +1,904 @@
//! Interface to the [SOLID] C library
//!
//! [SOLID]: https://solid.kmckk.com/
pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
pub type c_ushort = u16;
pub type c_int = i32;
pub type c_uint = u32;
pub type c_float = f32;
pub type c_double = f64;
pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type intmax_t = i64;
pub type uintmax_t = u64;
pub type uintptr_t = usize;
pub type intptr_t = isize;
pub type ptrdiff_t = isize;
pub type size_t = ::uintptr_t;
pub type ssize_t = ::intptr_t;
pub type clock_t = c_uint;
pub type time_t = i64;
pub type clockid_t = c_int;
pub type timer_t = c_int;
pub type suseconds_t = c_int;
pub type useconds_t = c_uint;
pub type sighandler_t = size_t;
// sys/ansi.h
pub type __caddr_t = *mut c_char;
pub type __gid_t = u32;
pub type __in_addr_t = u32;
pub type __in_port_t = u16;
pub type __mode_t = u32;
pub type __off_t = i64;
pub type __pid_t = i32;
pub type __sa_family_t = u8;
pub type __socklen_t = c_uint;
pub type __uid_t = u32;
pub type __fsblkcnt_t = u64;
pub type __fsfilcnt_t = u64;
// locale.h
pub type locale_t = usize;
// nl_types.h
pub type nl_item = c_long;
// sys/types.h
pub type __va_list = *mut c_char;
pub type u_int8_t = u8;
pub type u_int16_t = u16;
pub type u_int32_t = u32;
pub type u_int64_t = u64;
pub type u_char = c_uchar;
pub type u_short = c_ushort;
pub type u_int = c_uint;
pub type u_long = c_ulong;
pub type unchar = c_uchar;
pub type ushort = c_ushort;
pub type uint = c_uint;
pub type ulong = c_ulong;
pub type u_quad_t = u64;
pub type quad_t = i64;
pub type qaddr_t = *mut quad_t;
pub type longlong_t = i64;
pub type u_longlong_t = u64;
pub type blkcnt_t = i64;
pub type blksize_t = i32;
pub type fsblkcnt_t = __fsblkcnt_t;
pub type fsfilcnt_t = __fsfilcnt_t;
pub type caddr_t = __caddr_t;
pub type daddr_t = i64;
pub type dev_t = u64;
pub type fixpt_t = u32;
pub type gid_t = __gid_t;
pub type idtype_t = c_int;
pub type id_t = u32;
pub type ino_t = u64;
pub type key_t = c_long;
pub type mode_t = __mode_t;
pub type nlink_t = u32;
pub type off_t = __off_t;
pub type pid_t = __pid_t;
pub type lwpid_t = i32;
pub type rlim_t = u64;
pub type segsz_t = i32;
pub type swblk_t = i32;
pub type mqd_t = c_int;
pub type cpuid_t = c_ulong;
pub type psetid_t = c_int;
s! {
// stat.h
pub struct stat {
pub st_dev: dev_t,
pub st_ino: ino_t,
pub st_mode: c_short,
pub st_nlink: c_short,
pub st_uid: c_short,
pub st_gid: c_short,
pub st_rdev: dev_t,
pub st_size: off_t,
pub st_atime: time_t,
pub st_mtime: time_t,
pub st_ctime: time_t,
pub st_blksize: blksize_t,
}
// time.h
pub struct tm {
pub tm_sec: c_int,
pub tm_min: c_int,
pub tm_hour: c_int,
pub tm_mday: c_int,
pub tm_mon: c_int,
pub tm_year: c_int,
pub tm_wday: c_int,
pub tm_yday: c_int,
pub tm_isdst: c_int,
pub tm_gmtoff: c_long,
pub tm_zone: *mut c_char,
}
// stdlib.h
pub struct qdiv_t {
pub quot: quad_t,
pub rem: quad_t,
}
pub struct lldiv_t {
pub quot: c_longlong,
pub rem: c_longlong,
}
pub struct div_t {
pub quot: c_int,
pub rem: c_int,
}
pub struct ldiv_t {
pub quot: c_long,
pub rem: c_long,
}
// locale.h
pub struct lconv {
pub decimal_point: *mut c_char,
pub thousands_sep: *mut c_char,
pub grouping: *mut c_char,
pub int_curr_symbol: *mut c_char,
pub currency_symbol: *mut c_char,
pub mon_decimal_point: *mut c_char,
pub mon_thousands_sep: *mut c_char,
pub mon_grouping: *mut c_char,
pub positive_sign: *mut c_char,
pub negative_sign: *mut c_char,
pub int_frac_digits: c_char,
pub frac_digits: c_char,
pub p_cs_precedes: c_char,
pub p_sep_by_space: c_char,
pub n_cs_precedes: c_char,
pub n_sep_by_space: c_char,
pub p_sign_posn: c_char,
pub n_sign_posn: c_char,
pub int_p_cs_precedes: c_char,
pub int_n_cs_precedes: c_char,
pub int_p_sep_by_space: c_char,
pub int_n_sep_by_space: c_char,
pub int_p_sign_posn: c_char,
pub int_n_sign_posn: c_char,
}
pub struct iovec {
pub iov_base: *mut c_void,
pub iov_len: size_t,
}
pub struct timeval {
pub tv_sec: c_long,
pub tv_usec: c_long,
}
}
pub const INT_MIN: c_int = -2147483648;
pub const INT_MAX: c_int = 2147483647;
pub const EXIT_FAILURE: c_int = 1;
pub const EXIT_SUCCESS: c_int = 0;
pub const RAND_MAX: c_int = 0x7fffffff;
pub const EOF: c_int = -1;
pub const SEEK_SET: c_int = 0;
pub const SEEK_CUR: c_int = 1;
pub const SEEK_END: c_int = 2;
pub const _IOFBF: c_int = 0;
pub const _IONBF: c_int = 2;
pub const _IOLBF: c_int = 1;
pub const BUFSIZ: c_uint = 1024;
pub const FOPEN_MAX: c_uint = 20;
pub const FILENAME_MAX: c_uint = 1024;
pub const O_RDONLY: c_int = 1;
pub const O_WRONLY: c_int = 2;
pub const O_RDWR: c_int = 4;
pub const O_APPEND: c_int = 8;
pub const O_CREAT: c_int = 0x10;
pub const O_EXCL: c_int = 0x400;
pub const O_TEXT: c_int = 0x100;
pub const O_BINARY: c_int = 0x200;
pub const O_TRUNC: c_int = 0x20;
pub const S_IEXEC: c_short = 0x0040;
pub const S_IWRITE: c_short = 0x0080;
pub const S_IREAD: c_short = 0x0100;
pub const S_IFCHR: c_short = 0x2000;
pub const S_IFDIR: c_short = 0x4000;
pub const S_IFMT: c_short = 0o160000;
pub const S_IFIFO: c_short = 0o0010000;
pub const S_IFBLK: c_short = 0o0060000;
pub const S_IFREG: c_short = 0o0100000;
pub const LC_ALL: c_int = 0;
pub const LC_COLLATE: c_int = 1;
pub const LC_CTYPE: c_int = 2;
pub const LC_MONETARY: c_int = 3;
pub const LC_NUMERIC: c_int = 4;
pub const LC_TIME: c_int = 5;
pub const LC_MESSAGES: c_int = 6;
pub const _LC_LAST: c_int = 7;
pub const EPERM: c_int = 1;
pub const ENOENT: c_int = 2;
pub const ESRCH: c_int = 3;
pub const EINTR: c_int = 4;
pub const EIO: c_int = 5;
pub const ENXIO: c_int = 6;
pub const E2BIG: c_int = 7;
pub const ENOEXEC: c_int = 8;
pub const EBADF: c_int = 9;
pub const ECHILD: c_int = 10;
pub const EAGAIN: c_int = 11;
pub const ENOMEM: c_int = 12;
pub const EACCES: c_int = 13;
pub const EFAULT: c_int = 14;
pub const ENOTBLK: c_int = 15;
pub const EBUSY: c_int = 16;
pub const EEXIST: c_int = 17;
pub const EXDEV: c_int = 18;
pub const ENODEV: c_int = 19;
pub const ENOTDIR: c_int = 20;
pub const EISDIR: c_int = 21;
pub const EINVAL: c_int = 22;
pub const ENFILE: c_int = 23;
pub const EMFILE: c_int = 24;
pub const ENOTTY: c_int = 25;
pub const ETXTBSY: c_int = 26;
pub const EFBIG: c_int = 27;
pub const ENOSPC: c_int = 28;
pub const ESPIPE: c_int = 29;
pub const EROFS: c_int = 30;
pub const EMLINK: c_int = 31;
pub const EPIPE: c_int = 32;
pub const EDOM: c_int = 33;
pub const ERANGE: c_int = 34;
pub const EDEADLK: c_int = 35;
pub const ENAMETOOLONG: c_int = 36;
pub const ENOLCK: c_int = 37;
pub const ENOSYS: c_int = 38;
pub const ENOTEMPTY: c_int = 39;
pub const ELOOP: c_int = 40;
pub const EWOULDBLOCK: c_int = EAGAIN;
pub const ENOMSG: c_int = 42;
pub const EIDRM: c_int = 43;
pub const ECHRNG: c_int = 44;
pub const EL2NSYNC: c_int = 45;
pub const EL3HLT: c_int = 46;
pub const EL3RST: c_int = 47;
pub const ELNRNG: c_int = 48;
pub const EUNATCH: c_int = 49;
pub const ENOCSI: c_int = 50;
pub const EL2HLT: c_int = 51;
pub const EBADE: c_int = 52;
pub const EBADR: c_int = 53;
pub const EXFULL: c_int = 54;
pub const ENOANO: c_int = 55;
pub const EBADRQC: c_int = 56;
pub const EBADSLT: c_int = 57;
pub const EDEADLOCK: c_int = EDEADLK;
pub const EBFONT: c_int = 59;
pub const ENOSTR: c_int = 60;
pub const ENODATA: c_int = 61;
pub const ETIME: c_int = 62;
pub const ENOSR: c_int = 63;
pub const ENONET: c_int = 64;
pub const ENOPKG: c_int = 65;
pub const EREMOTE: c_int = 66;
pub const ENOLINK: c_int = 67;
pub const EADV: c_int = 68;
pub const ESRMNT: c_int = 69;
pub const ECOMM: c_int = 70;
pub const EPROTO: c_int = 71;
pub const EMULTIHOP: c_int = 72;
pub const EDOTDOT: c_int = 73;
pub const EBADMSG: c_int = 74;
pub const EOVERFLOW: c_int = 75;
pub const ENOTUNIQ: c_int = 76;
pub const EBADFD: c_int = 77;
pub const EREMCHG: c_int = 78;
pub const ELIBACC: c_int = 79;
pub const ELIBBAD: c_int = 80;
pub const ELIBSCN: c_int = 81;
pub const ELIBMAX: c_int = 82;
pub const ELIBEXEC: c_int = 83;
pub const EILSEQ: c_int = 84;
pub const ERESTART: c_int = 85;
pub const ESTRPIPE: c_int = 86;
pub const EUSERS: c_int = 87;
pub const ENOTSOCK: c_int = 88;
pub const EDESTADDRREQ: c_int = 89;
pub const EMSGSIZE: c_int = 90;
pub const EPROTOTYPE: c_int = 91;
pub const ENOPROTOOPT: c_int = 92;
pub const EPROTONOSUPPORT: c_int = 93;
pub const ESOCKTNOSUPPORT: c_int = 94;
pub const EOPNOTSUPP: c_int = 95;
pub const EPFNOSUPPORT: c_int = 96;
pub const EAFNOSUPPORT: c_int = 97;
pub const EADDRINUSE: c_int = 98;
pub const EADDRNOTAVAIL: c_int = 99;
pub const ENETDOWN: c_int = 100;
pub const ENETUNREACH: c_int = 101;
pub const ENETRESET: c_int = 102;
pub const ECONNABORTED: c_int = 103;
pub const ECONNRESET: c_int = 104;
pub const ENOBUFS: c_int = 105;
pub const EISCONN: c_int = 106;
pub const ENOTCONN: c_int = 107;
pub const ESHUTDOWN: c_int = 108;
pub const ETOOMANYREFS: c_int = 109;
pub const ETIMEDOUT: c_int = 110;
pub const ECONNREFUSED: c_int = 111;
pub const EHOSTDOWN: c_int = 112;
pub const EHOSTUNREACH: c_int = 113;
pub const EALREADY: c_int = 114;
pub const EINPROGRESS: c_int = 115;
pub const ESTALE: c_int = 116;
pub const EUCLEAN: c_int = 117;
pub const ENOTNAM: c_int = 118;
pub const ENAVAIL: c_int = 119;
pub const EISNAM: c_int = 120;
pub const EREMOTEIO: c_int = 121;
pub const EDQUOT: c_int = 122;
pub const ENOMEDIUM: c_int = 123;
pub const EMEDIUMTYPE: c_int = 124;
pub const ECANCELED: c_int = 125;
pub const ENOKEY: c_int = 126;
pub const EKEYEXPIRED: c_int = 127;
pub const EKEYREVOKED: c_int = 128;
pub const EKEYREJECTED: c_int = 129;
pub const EOWNERDEAD: c_int = 130;
pub const ENOTRECOVERABLE: c_int = 131;
pub const ENOTSUP: c_int = 132;
pub const EFTYPE: c_int = 133;
// signal codes
pub const SIGHUP: c_int = 1;
pub const SIGINT: c_int = 2;
pub const SIGQUIT: c_int = 3;
pub const SIGILL: c_int = 4;
pub const SIGTRAP: c_int = 5;
pub const SIGABRT: c_int = 6;
pub const SIGIOT: c_int = SIGABRT;
pub const SIGEMT: c_int = 7;
pub const SIGFPE: c_int = 8;
pub const SIGKILL: c_int = 9;
pub const SIGBUS: c_int = 10;
pub const SIGSEGV: c_int = 11;
pub const SIGSYS: c_int = 12;
pub const SIGPIPE: c_int = 13;
pub const SIGALRM: c_int = 14;
pub const SIGTERM: c_int = 15;
pub const SIGURG: c_int = 16;
pub const SIGSTOP: c_int = 17;
pub const SIGTSTP: c_int = 18;
pub const SIGCONT: c_int = 19;
pub const SIGCHLD: c_int = 20;
pub const SIGTTIN: c_int = 21;
pub const SIGTTOU: c_int = 22;
pub const SIGIO: c_int = 23;
pub const SIGXCPU: c_int = 24;
pub const SIGXFSZ: c_int = 25;
pub const SIGVTALRM: c_int = 26;
pub const SIGPROF: c_int = 27;
pub const SIGWINCH: c_int = 28;
pub const SIGINFO: c_int = 29;
pub const SIGUSR1: c_int = 30;
pub const SIGUSR2: c_int = 31;
pub const SIGPWR: c_int = 32;
#[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 {}
impl ::Copy for fpos_t {}
impl ::Clone for fpos_t {
fn clone(&self) -> fpos_t {
*self
}
}
extern "C" {
// ctype.h
pub fn isalnum(c: c_int) -> c_int;
pub fn isalpha(c: c_int) -> c_int;
pub fn iscntrl(c: c_int) -> c_int;
pub fn isdigit(c: c_int) -> c_int;
pub fn isgraph(c: c_int) -> c_int;
pub fn islower(c: c_int) -> c_int;
pub fn isprint(c: c_int) -> c_int;
pub fn ispunct(c: c_int) -> c_int;
pub fn isspace(c: c_int) -> c_int;
pub fn isupper(c: c_int) -> c_int;
pub fn isxdigit(c: c_int) -> c_int;
pub fn isblank(c: c_int) -> c_int;
pub fn tolower(c: c_int) -> c_int;
pub fn toupper(c: c_int) -> c_int;
// stdio.h
pub fn __get_stdio_file(fileno: c_int) -> *mut FILE;
pub fn clearerr(arg1: *mut FILE);
pub fn fclose(arg1: *mut FILE) -> c_int;
pub fn feof(arg1: *mut FILE) -> c_int;
pub fn ferror(arg1: *mut FILE) -> c_int;
pub fn fflush(arg1: *mut FILE) -> c_int;
pub fn fgetc(arg1: *mut FILE) -> c_int;
pub fn fgets(arg1: *mut c_char, arg2: c_int, arg3: *mut FILE) -> *mut c_char;
pub fn fopen(arg1: *const c_char, arg2: *const c_char) -> *mut FILE;
pub fn fprintf(arg1: *mut FILE, arg2: *const c_char, ...) -> c_int;
pub fn fputc(arg1: c_int, arg2: *mut FILE) -> c_int;
pub fn fputs(arg1: *const c_char, arg2: *mut FILE) -> c_int;
pub fn fread(arg1: *mut c_void, arg2: size_t, arg3: size_t, arg4: *mut FILE) -> size_t;
pub fn freopen(arg1: *const c_char, arg2: *const c_char, arg3: *mut FILE) -> *mut FILE;
pub fn fscanf(arg1: *mut FILE, arg2: *const c_char, ...) -> c_int;
pub fn fseek(arg1: *mut FILE, arg2: c_long, arg3: c_int) -> c_int;
pub fn ftell(arg1: *mut FILE) -> c_long;
pub fn fwrite(arg1: *const c_void, arg2: size_t, arg3: size_t, arg4: *mut FILE) -> size_t;
pub fn getc(arg1: *mut FILE) -> c_int;
pub fn getchar() -> c_int;
pub fn perror(arg1: *const c_char);
pub fn printf(arg1: *const c_char, ...) -> c_int;
pub fn putc(arg1: c_int, arg2: *mut FILE) -> c_int;
pub fn putchar(arg1: c_int) -> c_int;
pub fn puts(arg1: *const c_char) -> c_int;
pub fn remove(arg1: *const c_char) -> c_int;
pub fn rewind(arg1: *mut FILE);
pub fn scanf(arg1: *const c_char, ...) -> c_int;
pub fn setbuf(arg1: *mut FILE, arg2: *mut c_char);
pub fn setvbuf(arg1: *mut FILE, arg2: *mut c_char, arg3: c_int, arg4: size_t) -> c_int;
pub fn sscanf(arg1: *const c_char, arg2: *const c_char, ...) -> c_int;
pub fn tmpfile() -> *mut FILE;
pub fn ungetc(arg1: c_int, arg2: *mut FILE) -> c_int;
pub fn vfprintf(arg1: *mut FILE, arg2: *const c_char, arg3: __va_list) -> c_int;
pub fn vprintf(arg1: *const c_char, arg2: __va_list) -> c_int;
pub fn gets(arg1: *mut c_char) -> *mut c_char;
pub fn sprintf(arg1: *mut c_char, arg2: *const c_char, ...) -> c_int;
pub fn tmpnam(arg1: *const c_char) -> *mut c_char;
pub fn vsprintf(arg1: *mut c_char, arg2: *const c_char, arg3: __va_list) -> c_int;
pub fn rename(arg1: *const c_char, arg2: *const c_char) -> c_int;
pub fn asiprintf(arg1: *mut *mut c_char, arg2: *const c_char, ...) -> c_int;
pub fn fiprintf(arg1: *mut FILE, arg2: *const c_char, ...) -> c_int;
pub fn fiscanf(arg1: *mut FILE, arg2: *const c_char, ...) -> c_int;
pub fn iprintf(arg1: *const c_char, ...) -> c_int;
pub fn iscanf(arg1: *const c_char, ...) -> c_int;
pub fn siprintf(arg1: *mut c_char, arg2: *const c_char, ...) -> c_int;
pub fn siscanf(arg1: *mut c_char, arg2: *const c_char, ...) -> c_int;
pub fn sniprintf(arg1: *mut c_char, arg2: size_t, arg3: *const c_char, ...) -> c_int;
pub fn vasiprintf(arg1: *mut *mut c_char, arg2: *const c_char, arg3: __va_list) -> c_int;
pub fn vfiprintf(arg1: *mut FILE, arg2: *const c_char, arg3: __va_list) -> c_int;
pub fn vfiscanf(arg1: *mut FILE, arg2: *const c_char, arg3: __va_list) -> c_int;
pub fn viprintf(arg1: *const c_char, arg2: __va_list) -> c_int;
pub fn viscanf(arg1: *const c_char, arg2: __va_list) -> c_int;
pub fn vsiprintf(arg1: *mut c_char, arg2: *const c_char, arg3: __va_list) -> c_int;
pub fn vsiscanf(arg1: *const c_char, arg2: *const c_char, arg3: __va_list) -> c_int;
pub fn vsniprintf(
arg1: *mut c_char,
arg2: size_t,
arg3: *const c_char,
arg4: __va_list,
) -> c_int;
pub fn vdiprintf(arg1: c_int, arg2: *const c_char, arg3: __va_list) -> c_int;
pub fn diprintf(arg1: c_int, arg2: *const c_char, ...) -> c_int;
pub fn fgetpos(arg1: *mut FILE, arg2: *mut fpos_t) -> c_int;
pub fn fsetpos(arg1: *mut FILE, arg2: *const fpos_t) -> c_int;
pub fn fdopen(arg1: c_int, arg2: *const c_char) -> *mut FILE;
pub fn fileno(arg1: *mut FILE) -> c_int;
pub fn flockfile(arg1: *mut FILE);
pub fn ftrylockfile(arg1: *mut FILE) -> c_int;
pub fn funlockfile(arg1: *mut FILE);
pub fn getc_unlocked(arg1: *mut FILE) -> c_int;
pub fn getchar_unlocked() -> c_int;
pub fn putc_unlocked(arg1: c_int, arg2: *mut FILE) -> c_int;
pub fn putchar_unlocked(arg1: c_int) -> c_int;
pub fn snprintf(arg1: *mut c_char, arg2: size_t, arg3: *const c_char, ...) -> c_int;
pub fn vsnprintf(
arg1: *mut c_char,
arg2: size_t,
arg3: *const c_char,
arg4: __va_list,
) -> c_int;
pub fn getw(arg1: *mut FILE) -> c_int;
pub fn putw(arg1: c_int, arg2: *mut FILE) -> c_int;
pub fn tempnam(arg1: *const c_char, arg2: *const c_char) -> *mut c_char;
pub fn fseeko(stream: *mut FILE, offset: off_t, whence: c_int) -> c_int;
pub fn ftello(stream: *mut FILE) -> off_t;
// stdlib.h
pub fn atof(arg1: *const c_char) -> f64;
pub fn strtod(arg1: *const c_char, arg2: *mut *mut c_char) -> f64;
pub fn drand48() -> f64;
pub fn erand48(arg1: *mut c_ushort) -> f64;
pub fn strtof(arg1: *const c_char, arg2: *mut *mut c_char) -> f32;
pub fn strtold(arg1: *const c_char, arg2: *mut *mut c_char) -> f64;
pub fn strtod_l(arg1: *const c_char, arg2: *mut *mut c_char, arg3: locale_t) -> f64;
pub fn strtof_l(arg1: *const c_char, arg2: *mut *mut c_char, arg3: locale_t) -> f32;
pub fn strtold_l(arg1: *const c_char, arg2: *mut *mut c_char, arg3: locale_t) -> f64;
pub fn _Exit(arg1: c_int) -> !;
pub fn abort() -> !;
pub fn abs(arg1: c_int) -> c_int;
pub fn atexit(arg1: ::Option<unsafe extern "C" fn()>) -> c_int;
pub fn atoi(arg1: *const c_char) -> c_int;
pub fn atol(arg1: *const c_char) -> c_long;
pub fn itoa(arg1: c_int, arg2: *mut c_char, arg3: c_int) -> *mut c_char;
pub fn ltoa(arg1: c_long, arg2: *mut c_char, arg3: c_int) -> *mut c_char;
pub fn ultoa(arg1: c_ulong, arg2: *mut c_char, arg3: c_int) -> *mut c_char;
pub fn bsearch(
arg1: *const c_void,
arg2: *const c_void,
arg3: size_t,
arg4: size_t,
arg5: ::Option<unsafe extern "C" fn(arg1: *const c_void, arg2: *const c_void) -> c_int>,
) -> *mut c_void;
pub fn calloc(arg1: size_t, arg2: size_t) -> *mut c_void;
pub fn div(arg1: c_int, arg2: c_int) -> div_t;
pub fn exit(arg1: c_int) -> !;
pub fn free(arg1: *mut c_void);
pub fn getenv(arg1: *const c_char) -> *mut c_char;
pub fn labs(arg1: c_long) -> c_long;
pub fn ldiv(arg1: c_long, arg2: c_long) -> ldiv_t;
pub fn malloc(arg1: size_t) -> *mut c_void;
pub fn qsort(
arg1: *mut c_void,
arg2: size_t,
arg3: size_t,
arg4: ::Option<unsafe extern "C" fn(arg1: *const c_void, arg2: *const c_void) -> c_int>,
);
pub fn rand() -> c_int;
pub fn realloc(arg1: *mut c_void, arg2: size_t) -> *mut c_void;
pub fn srand(arg1: c_uint);
pub fn strtol(arg1: *const c_char, arg2: *mut *mut c_char, arg3: c_int) -> c_long;
pub fn strtoul(arg1: *const c_char, arg2: *mut *mut c_char, arg3: c_int) -> c_ulong;
pub fn mblen(arg1: *const c_char, arg2: size_t) -> c_int;
pub fn mbstowcs(arg1: *mut wchar_t, arg2: *const c_char, arg3: size_t) -> size_t;
pub fn wctomb(arg1: *mut c_char, arg2: wchar_t) -> c_int;
pub fn mbtowc(arg1: *mut wchar_t, arg2: *const c_char, arg3: size_t) -> c_int;
pub fn wcstombs(arg1: *mut c_char, arg2: *const wchar_t, arg3: size_t) -> size_t;
pub fn rand_r(arg1: *mut c_uint) -> c_int;
pub fn jrand48(arg1: *mut c_ushort) -> c_long;
pub fn lcong48(arg1: *mut c_ushort);
pub fn lrand48() -> c_long;
pub fn mrand48() -> c_long;
pub fn nrand48(arg1: *mut c_ushort) -> c_long;
pub fn seed48(arg1: *mut c_ushort) -> *mut c_ushort;
pub fn srand48(arg1: c_long);
pub fn putenv(arg1: *mut c_char) -> c_int;
pub fn a64l(arg1: *const c_char) -> c_long;
pub fn l64a(arg1: c_long) -> *mut c_char;
pub fn random() -> c_long;
pub fn setstate(arg1: *mut c_char) -> *mut c_char;
pub fn initstate(arg1: c_uint, arg2: *mut c_char, arg3: size_t) -> *mut c_char;
pub fn srandom(arg1: c_uint);
pub fn mkostemp(arg1: *mut c_char, arg2: c_int) -> c_int;
pub fn mkostemps(arg1: *mut c_char, arg2: c_int, arg3: c_int) -> c_int;
pub fn mkdtemp(arg1: *mut c_char) -> *mut c_char;
pub fn mkstemp(arg1: *mut c_char) -> c_int;
pub fn mktemp(arg1: *mut c_char) -> *mut c_char;
pub fn atoll(arg1: *const c_char) -> c_longlong;
pub fn llabs(arg1: c_longlong) -> c_longlong;
pub fn lldiv(arg1: c_longlong, arg2: c_longlong) -> lldiv_t;
pub fn strtoll(arg1: *const c_char, arg2: *mut *mut c_char, arg3: c_int) -> c_longlong;
pub fn strtoull(arg1: *const c_char, arg2: *mut *mut c_char, arg3: c_int) -> c_ulonglong;
pub fn aligned_alloc(arg1: size_t, arg2: size_t) -> *mut c_void;
pub fn at_quick_exit(arg1: ::Option<unsafe extern "C" fn()>) -> c_int;
pub fn quick_exit(arg1: c_int);
pub fn setenv(arg1: *const c_char, arg2: *const c_char, arg3: c_int) -> c_int;
pub fn unsetenv(arg1: *const c_char) -> c_int;
pub fn humanize_number(
arg1: *mut c_char,
arg2: size_t,
arg3: i64,
arg4: *const c_char,
arg5: c_int,
arg6: c_int,
) -> c_int;
pub fn dehumanize_number(arg1: *const c_char, arg2: *mut i64) -> c_int;
pub fn getenv_r(arg1: *const c_char, arg2: *mut c_char, arg3: size_t) -> c_int;
pub fn heapsort(
arg1: *mut c_void,
arg2: size_t,
arg3: size_t,
arg4: ::Option<unsafe extern "C" fn(arg1: *const c_void, arg2: *const c_void) -> c_int>,
) -> c_int;
pub fn mergesort(
arg1: *mut c_void,
arg2: size_t,
arg3: size_t,
arg4: ::Option<unsafe extern "C" fn(arg1: *const c_void, arg2: *const c_void) -> c_int>,
) -> c_int;
pub fn radixsort(
arg1: *mut *const c_uchar,
arg2: c_int,
arg3: *const c_uchar,
arg4: c_uint,
) -> c_int;
pub fn sradixsort(
arg1: *mut *const c_uchar,
arg2: c_int,
arg3: *const c_uchar,
arg4: c_uint,
) -> c_int;
pub fn getprogname() -> *const c_char;
pub fn setprogname(arg1: *const c_char);
pub fn qabs(arg1: quad_t) -> quad_t;
pub fn strtoq(arg1: *const c_char, arg2: *mut *mut c_char, arg3: c_int) -> quad_t;
pub fn strtouq(arg1: *const c_char, arg2: *mut *mut c_char, arg3: c_int) -> u_quad_t;
pub fn strsuftoll(
arg1: *const c_char,
arg2: *const c_char,
arg3: c_longlong,
arg4: c_longlong,
) -> c_longlong;
pub fn strsuftollx(
arg1: *const c_char,
arg2: *const c_char,
arg3: c_longlong,
arg4: c_longlong,
arg5: *mut c_char,
arg6: size_t,
) -> c_longlong;
pub fn l64a_r(arg1: c_long, arg2: *mut c_char, arg3: c_int) -> c_int;
pub fn qdiv(arg1: quad_t, arg2: quad_t) -> qdiv_t;
pub fn strtol_l(
arg1: *const c_char,
arg2: *mut *mut c_char,
arg3: c_int,
arg4: locale_t,
) -> c_long;
pub fn strtoul_l(
arg1: *const c_char,
arg2: *mut *mut c_char,
arg3: c_int,
arg4: locale_t,
) -> c_ulong;
pub fn strtoll_l(
arg1: *const c_char,
arg2: *mut *mut c_char,
arg3: c_int,
arg4: locale_t,
) -> c_longlong;
pub fn strtoull_l(
arg1: *const c_char,
arg2: *mut *mut c_char,
arg3: c_int,
arg4: locale_t,
) -> c_ulonglong;
pub fn strtoq_l(
arg1: *const c_char,
arg2: *mut *mut c_char,
arg3: c_int,
arg4: locale_t,
) -> quad_t;
pub fn strtouq_l(
arg1: *const c_char,
arg2: *mut *mut c_char,
arg3: c_int,
arg4: locale_t,
) -> u_quad_t;
pub fn _mb_cur_max_l(arg1: locale_t) -> size_t;
pub fn mblen_l(arg1: *const c_char, arg2: size_t, arg3: locale_t) -> c_int;
pub fn mbstowcs_l(
arg1: *mut wchar_t,
arg2: *const c_char,
arg3: size_t,
arg4: locale_t,
) -> size_t;
pub fn wctomb_l(arg1: *mut c_char, arg2: wchar_t, arg3: locale_t) -> c_int;
pub fn mbtowc_l(arg1: *mut wchar_t, arg2: *const c_char, arg3: size_t, arg4: locale_t)
-> c_int;
pub fn wcstombs_l(
arg1: *mut c_char,
arg2: *const wchar_t,
arg3: size_t,
arg4: locale_t,
) -> size_t;
// string.h
pub fn memchr(arg1: *const c_void, arg2: c_int, arg3: size_t) -> *mut c_void;
pub fn memcmp(arg1: *const c_void, arg2: *const c_void, arg3: size_t) -> c_int;
pub fn memcpy(arg1: *mut c_void, arg2: *const c_void, arg3: size_t) -> *mut c_void;
pub fn memmove(arg1: *mut c_void, arg2: *const c_void, arg3: size_t) -> *mut c_void;
pub fn memset(arg1: *mut c_void, arg2: c_int, arg3: size_t) -> *mut c_void;
pub fn strcat(arg1: *mut c_char, arg2: *const c_char) -> *mut c_char;
pub fn strchr(arg1: *const c_char, arg2: c_int) -> *mut c_char;
pub fn strcmp(arg1: *const c_char, arg2: *const c_char) -> c_int;
pub fn strcoll(arg1: *const c_char, arg2: *const c_char) -> c_int;
pub fn strcpy(arg1: *mut c_char, arg2: *const c_char) -> *mut c_char;
pub fn strcspn(arg1: *const c_char, arg2: *const c_char) -> size_t;
pub fn strerror(arg1: c_int) -> *mut c_char;
pub fn strlen(arg1: *const c_char) -> size_t;
pub fn strncat(arg1: *mut c_char, arg2: *const c_char, arg3: size_t) -> *mut c_char;
pub fn strncmp(arg1: *const c_char, arg2: *const c_char, arg3: size_t) -> c_int;
pub fn strncpy(arg1: *mut c_char, arg2: *const c_char, arg3: size_t) -> *mut c_char;
pub fn strpbrk(arg1: *const c_char, arg2: *const c_char) -> *mut c_char;
pub fn strrchr(arg1: *const c_char, arg2: c_int) -> *mut c_char;
pub fn strspn(arg1: *const c_char, arg2: *const c_char) -> size_t;
pub fn strstr(arg1: *const c_char, arg2: *const c_char) -> *mut c_char;
pub fn strtok(arg1: *mut c_char, arg2: *const c_char) -> *mut c_char;
pub fn strtok_r(arg1: *mut c_char, arg2: *const c_char, arg3: *mut *mut c_char) -> *mut c_char;
pub fn strerror_r(arg1: c_int, arg2: *mut c_char, arg3: size_t) -> c_int;
pub fn strxfrm(arg1: *mut c_char, arg2: *const c_char, arg3: size_t) -> size_t;
pub fn memccpy(
arg1: *mut c_void,
arg2: *const c_void,
arg3: c_int,
arg4: size_t,
) -> *mut c_void;
pub fn strdup(arg1: *const c_char) -> *mut c_char;
pub fn stpcpy(arg1: *mut c_char, arg2: *const c_char) -> *mut c_char;
pub fn stpncpy(arg1: *mut c_char, arg2: *const c_char, arg3: size_t) -> *mut c_char;
pub fn strnlen(arg1: *const c_char, arg2: size_t) -> size_t;
pub fn memmem(
arg1: *const c_void,
arg2: size_t,
arg3: *const c_void,
arg4: size_t,
) -> *mut c_void;
pub fn strcasestr(arg1: *const c_char, arg2: *const c_char) -> *mut c_char;
pub fn strlcat(arg1: *mut c_char, arg2: *const c_char, arg3: size_t) -> size_t;
pub fn strlcpy(arg1: *mut c_char, arg2: *const c_char, arg3: size_t) -> size_t;
pub fn strsep(arg1: *mut *mut c_char, arg2: *const c_char) -> *mut c_char;
pub fn stresep(arg1: *mut *mut c_char, arg2: *const c_char, arg3: c_int) -> *mut c_char;
pub fn strndup(arg1: *const c_char, arg2: size_t) -> *mut c_char;
pub fn memrchr(arg1: *const c_void, arg2: c_int, arg3: size_t) -> *mut c_void;
pub fn explicit_memset(arg1: *mut c_void, arg2: c_int, arg3: size_t) -> *mut c_void;
pub fn consttime_memequal(arg1: *const c_void, arg2: *const c_void, arg3: size_t) -> c_int;
pub fn strcoll_l(arg1: *const c_char, arg2: *const c_char, arg3: locale_t) -> c_int;
pub fn strxfrm_l(
arg1: *mut c_char,
arg2: *const c_char,
arg3: size_t,
arg4: locale_t,
) -> size_t;
pub fn strerror_l(arg1: c_int, arg2: locale_t) -> *mut c_char;
// strings.h
pub fn bcmp(arg1: *const c_void, arg2: *const c_void, arg3: size_t) -> c_int;
pub fn bcopy(arg1: *const c_void, arg2: *mut c_void, arg3: size_t);
pub fn bzero(arg1: *mut c_void, arg2: size_t);
pub fn ffs(arg1: c_int) -> c_int;
pub fn popcount(arg1: c_uint) -> c_uint;
pub fn popcountl(arg1: c_ulong) -> c_uint;
pub fn popcountll(arg1: c_ulonglong) -> c_uint;
pub fn popcount32(arg1: u32) -> c_uint;
pub fn popcount64(arg1: u64) -> c_uint;
pub fn rindex(arg1: *const c_char, arg2: c_int) -> *mut c_char;
pub fn strcasecmp(arg1: *const c_char, arg2: *const c_char) -> c_int;
pub fn strncasecmp(arg1: *const c_char, arg2: *const c_char, arg3: size_t) -> c_int;
// signal.h
pub fn signal(arg1: c_int, arg2: sighandler_t) -> sighandler_t;
pub fn raise(arg1: c_int) -> c_int;
// time.h
pub fn asctime(arg1: *const tm) -> *mut c_char;
pub fn clock() -> clock_t;
pub fn ctime(arg1: *const time_t) -> *mut c_char;
pub fn difftime(arg1: time_t, arg2: time_t) -> f64;
pub fn gmtime(arg1: *const time_t) -> *mut tm;
pub fn localtime(arg1: *const time_t) -> *mut tm;
pub fn time(arg1: *mut time_t) -> time_t;
pub fn mktime(arg1: *mut tm) -> time_t;
pub fn strftime(
arg1: *mut c_char,
arg2: size_t,
arg3: *const c_char,
arg4: *const tm,
) -> size_t;
pub fn utime(arg1: *const c_char, arg2: *mut time_t) -> c_int;
pub fn asctime_r(arg1: *const tm, arg2: *mut c_char) -> *mut c_char;
pub fn ctime_r(arg1: *const time_t, arg2: *mut c_char) -> *mut c_char;
pub fn gmtime_r(arg1: *const time_t, arg2: *mut tm) -> *mut tm;
pub fn localtime_r(arg1: *const time_t, arg2: *mut tm) -> *mut tm;
// sys/stat.h
pub fn stat(arg1: *const c_char, arg2: *mut stat) -> c_int;
pub fn lstat(arg1: *const c_char, arg2: *mut stat) -> c_int;
pub fn fstat(arg1: c_int, arg2: *mut stat) -> c_int;
pub fn chmod(arg1: *const c_char, arg2: __mode_t) -> c_int;
pub fn mkdir(arg1: *const c_char, arg2: __mode_t) -> c_int;
// fcntl.h
pub fn open(arg1: *const c_char, arg2: c_int, ...) -> c_int;
pub fn creat(arg1: *const c_char, arg2: c_int) -> c_int;
pub fn close(arg1: c_int) -> c_int;
pub fn read(arg1: c_int, arg2: *mut c_void, arg3: c_int) -> c_int;
pub fn write(arg1: c_int, arg2: *const c_void, arg3: c_int) -> c_int;
pub fn unlink(arg1: *const c_char) -> c_int;
pub fn tell(arg1: c_int) -> c_long;
pub fn dup(arg1: c_int) -> c_int;
pub fn dup2(arg1: c_int, arg2: c_int) -> c_int;
pub fn access(arg1: *const c_char, arg2: c_int) -> c_int;
pub fn rmdir(arg1: *const c_char) -> c_int;
pub fn chdir(arg1: *const c_char) -> c_int;
pub fn _exit(arg1: c_int);
pub fn getwd(arg1: *mut c_char) -> *mut c_char;
pub fn getcwd(arg1: *mut c_char, arg2: size_t) -> *mut c_char;
pub static mut optarg: *mut c_char;
pub static mut opterr: c_int;
pub static mut optind: c_int;
pub static mut optopt: c_int;
pub static mut optreset: c_int;
pub fn getopt(arg1: c_int, arg2: *mut *mut c_char, arg3: *const c_char) -> c_int;
pub static mut suboptarg: *mut c_char;
pub fn getsubopt(
arg1: *mut *mut c_char,
arg2: *const *mut c_char,
arg3: *mut *mut c_char,
) -> c_int;
pub fn fcntl(arg1: c_int, arg2: c_int, ...) -> c_int;
pub fn getpid() -> pid_t;
pub fn sleep(arg1: c_uint) -> c_uint;
pub fn usleep(arg1: useconds_t) -> c_int;
// locale.h
pub fn localeconv() -> *mut lconv;
pub fn setlocale(arg1: c_int, arg2: *const c_char) -> *mut c_char;
pub fn duplocale(arg1: locale_t) -> locale_t;
pub fn freelocale(arg1: locale_t);
pub fn localeconv_l(arg1: locale_t) -> *mut lconv;
pub fn newlocale(arg1: c_int, arg2: *const c_char, arg3: locale_t) -> locale_t;
// langinfo.h
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
pub fn nl_langinfo_l(item: ::nl_item, locale: locale_t) -> *mut ::c_char;
// malloc.h
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
// sys/types.h
pub fn lseek(arg1: c_int, arg2: __off_t, arg3: c_int) -> __off_t;
}
cfg_if! {
if #[cfg(libc_core_cvoid)] {
pub use ::ffi::c_void;
} else {
// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
// enable more optimization opportunities around it recognizing things
// like malloc/free.
#[repr(u8)]
#[allow(missing_copy_implementations)]
#[allow(missing_debug_implementations)]
pub enum c_void {
// Two dummy variants so the #[repr] attribute can be used.
#[doc(hidden)]
__variant1,
#[doc(hidden)]
__variant2,
}
}
}
cfg_if! {
if #[cfg(target_arch = "aarch64")] {
mod aarch64;
pub use self::aarch64::*;
} else if #[cfg(any(target_arch = "arm"))] {
mod arm;
pub use self::arm::*;
} else {
// Unknown target_arch
}
}

View file

@ -0,0 +1,49 @@
//! Switch C type definitions
pub type c_schar = i8;
pub type c_uchar = u8;
pub type c_short = i16;
pub type c_ushort = u16;
pub type c_int = i32;
pub type c_uint = u32;
pub type c_float = f32;
pub type c_double = f64;
pub type c_longlong = i64;
pub type c_ulonglong = u64;
pub type intmax_t = i64;
pub type uintmax_t = u64;
pub type size_t = usize;
pub type ptrdiff_t = isize;
pub type intptr_t = isize;
pub type uintptr_t = usize;
pub type ssize_t = isize;
pub type off_t = i64;
pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type wchar_t = u32;
pub const INT_MIN: c_int = -2147483648;
pub const INT_MAX: c_int = 2147483647;
cfg_if! {
if #[cfg(libc_core_cvoid)] {
pub use ::ffi::c_void;
} else {
// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help
// enable more optimization opportunities around it recognizing things
// like malloc/free.
#[repr(u8)]
#[allow(missing_copy_implementations)]
#[allow(missing_debug_implementations)]
pub enum c_void {
// Two dummy variants so the #[repr] attribute can be used.
#[doc(hidden)]
__variant1,
#[doc(hidden)]
__variant2,
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,644 @@
pub type c_long = i64;
pub type c_ulong = u64;
s! {
pub struct sigset_t {
pub ss_set: [c_ulong; 4],
}
pub struct fd_set {
pub fds_bits: [c_long; 1024],
}
pub struct flock {
pub l_type: ::c_short,
pub l_whence: ::c_short,
pub l_sysid: ::c_uint,
pub l_pid: ::pid_t,
pub l_vfs: ::c_int,
pub l_start: ::off_t,
pub l_len: ::off_t,
}
pub struct statvfs {
pub f_bsize: ::c_ulong,
pub f_frsize: ::c_ulong,
pub f_blocks: ::fsblkcnt_t,
pub f_bfree: ::fsblkcnt_t,
pub f_bavail: ::fsblkcnt_t,
pub f_files: ::fsfilcnt_t,
pub f_ffree: ::fsfilcnt_t,
pub f_favail: ::fsfilcnt_t,
pub f_fsid: ::c_ulong,
pub f_basetype: [::c_char; 16],
pub f_flag: ::c_ulong,
pub f_namemax: ::c_ulong,
pub f_fstr: [::c_char; 32],
pub f_filler: [::c_ulong; 16]
}
pub struct pthread_rwlock_t {
__rw_word: [::c_long; 10],
}
pub struct pthread_cond_t {
__cv_word: [::c_long; 6],
}
pub struct pthread_mutex_t {
__mt_word: [::c_long; 8],
}
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_mode: ::mode_t,
pub st_nlink: ::nlink_t,
pub st_flag: ::c_ushort,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_rdev: ::dev_t,
pub st_ssize: ::c_int,
pub st_atime: ::st_timespec,
pub st_mtime: ::st_timespec,
pub st_ctime: ::st_timespec,
pub st_blksize: ::blksize_t,
pub st_blocks: ::blkcnt_t,
pub st_vfstype: ::c_int,
pub st_vfs: ::c_uint,
pub st_type: ::c_uint,
pub st_gen: ::c_uint,
pub st_reserved: [::c_uint; 9],
pub st_padto_ll: ::c_uint,
pub st_size: ::off_t,
}
pub struct statfs {
pub f_version: ::c_int,
pub f_type: ::c_int,
pub f_bsize: ::c_ulong,
pub f_blocks: ::fsblkcnt_t,
pub f_bfree: ::fsblkcnt_t,
pub f_bavail: ::fsblkcnt_t,
pub f_files: ::fsblkcnt_t,
pub f_ffree: ::fsblkcnt_t,
pub f_fsid: ::fsid64_t,
pub f_vfstype: ::c_int,
pub f_fsize: ::c_ulong,
pub f_vfsnumber: ::c_int,
pub f_vfsoff: ::c_int,
pub f_vfslen: ::c_int,
pub f_vfsvers: ::c_int,
pub f_fname: [::c_char; 32],
pub f_fpack: [::c_char; 32],
pub f_name_max: ::c_int,
}
pub struct aiocb {
pub aio_lio_opcode: ::c_int,
pub aio_fildes: ::c_int,
pub aio_word1: ::c_int,
pub aio_offset: ::off_t,
pub aio_buf: *mut ::c_void,
pub aio_return: ::ssize_t,
pub aio_errno: ::c_int,
pub aio_nbytes: ::size_t,
pub aio_reqprio: ::c_int,
pub aio_sigevent: ::sigevent,
pub aio_word2: ::c_int,
pub aio_fp: ::c_int,
pub aio_handle: *mut aiocb,
pub aio_reserved: [::c_uint; 2],
pub aio_sigev_tid: c_long,
}
pub struct ucontext_t {
pub __sc_onstack: ::c_int,
pub uc_sigmask: ::sigset_t,
pub __sc_uerror: ::c_int,
pub uc_mcontext: ::mcontext_t,
pub uc_link: *mut ucontext_t,
pub uc_stack: ::stack_t,
// Should be pointer to __extctx_t
pub __extctx: *mut ::c_void,
pub __extctx_magic: ::c_int,
pub __pad: [::c_int; 1],
}
pub struct mcontext_t {
pub gpr: [::c_ulonglong; 32],
pub msr: ::c_ulonglong,
pub iar: ::c_ulonglong,
pub lr: ::c_ulonglong,
pub ctr: ::c_ulonglong,
pub cr: ::c_uint,
pub xer: ::c_uint,
pub fpscr: ::c_uint,
pub fpscrx: ::c_uint,
pub except: [::c_ulonglong; 1],
// Should be array of double type
pub fpr: [::uint64_t; 32],
pub fpeu: ::c_char,
pub fpinfo: ::c_char,
pub fpscr24_31: ::c_char,
pub pad: [::c_char; 1],
pub excp_type: ::c_int,
}
pub struct utmpx {
pub ut_user: [::c_char; 256],
pub ut_id: [::c_char; 14],
pub ut_line: [::c_char; 64],
pub ut_pid: ::pid_t,
pub ut_type: ::c_short,
pub ut_tv: ::timeval,
pub ut_host: [::c_char; 256],
pub __dbl_word_pad: ::c_int,
pub __reservedA: [::c_int; 2],
pub __reservedV: [::c_int; 6],
}
pub struct pthread_spinlock_t {
pub __sp_word: [::c_long; 3],
}
pub struct pthread_barrier_t {
pub __br_word: [::c_long; 5],
}
pub struct msqid_ds {
pub msg_perm: ::ipc_perm,
pub msg_first: ::c_uint,
pub msg_last: ::c_uint,
pub msg_cbytes: ::c_uint,
pub msg_qnum: ::c_uint,
pub msg_qbytes: ::c_ulong,
pub msg_lspid: ::pid_t,
pub msg_lrpid: ::pid_t,
pub msg_stime: ::time_t,
pub msg_rtime: ::time_t,
pub msg_ctime: ::time_t,
pub msg_rwait: ::c_int,
pub msg_wwait: ::c_int,
pub msg_reqevents: ::c_ushort,
}
}
s_no_extra_traits! {
pub struct siginfo_t {
pub si_signo: ::c_int,
pub si_errno: ::c_int,
pub si_code: ::c_int,
pub si_pid: ::pid_t,
pub si_uid: ::uid_t,
pub si_status: ::c_int,
pub si_addr: *mut ::c_void,
pub si_band: ::c_long,
pub si_value: ::sigval,
pub __si_flags: ::c_int,
pub __pad: [::c_int; 3],
}
#[cfg(libc_union)]
pub union _kernel_simple_lock {
pub _slock: ::c_long,
// Should be pointer to 'lock_data_instrumented'
pub _slockp: *mut ::c_void,
}
pub struct fileops_t {
pub fo_rw: extern fn(file: *mut file, rw: ::uio_rw, io: *mut ::c_void, ext: ::c_long,
secattr: *mut ::c_void) -> ::c_int,
pub fo_ioctl: extern fn(file: *mut file, a: ::c_long, b: ::caddr_t, c: ::c_long,
d: ::c_long) -> ::c_int,
pub fo_select: extern fn(file: *mut file, a: ::c_int, b: *mut ::c_ushort,
c: extern fn()) -> ::c_int,
pub fo_close: extern fn(file: *mut file) -> ::c_int,
pub fo_fstat: extern fn(file: *mut file, sstat: *mut ::stat) -> ::c_int,
}
pub struct file {
pub f_flag: ::c_long,
pub f_count: ::c_int,
pub f_options: ::c_short,
pub f_type: ::c_short,
// Should be pointer to 'vnode'
pub f_data: *mut ::c_void,
pub f_offset: ::c_longlong,
pub f_dir_off: ::c_long,
// Should be pointer to 'cred'
pub f_cred: *mut ::c_void,
#[cfg(libc_union)]
pub f_lock: _kernel_simple_lock,
#[cfg(libc_union)]
pub f_offset_lock: _kernel_simple_lock,
pub f_vinfo: ::caddr_t,
pub f_ops: *mut fileops_t,
pub f_parentp: ::caddr_t,
pub f_fnamep: ::caddr_t,
pub f_fdata: [::c_char; 160],
}
#[cfg(libc_union)]
pub union __ld_info_file {
pub _ldinfo_fd: ::c_int,
pub _ldinfo_fp: *mut file,
pub _core_offset: ::c_long,
}
pub struct ld_info {
pub ldinfo_next: ::c_uint,
pub ldinfo_flags: ::c_uint,
#[cfg(libc_union)]
pub _file: __ld_info_file,
pub ldinfo_textorg: *mut ::c_void,
pub ldinfo_textsize: ::c_ulong,
pub ldinfo_dataorg: *mut ::c_void,
pub ldinfo_datasize: ::c_ulong,
pub ldinfo_filename: [::c_char; 2],
}
#[cfg(libc_union)]
pub union __pollfd_ext_u {
pub addr: *mut ::c_void,
pub data32: u32,
pub data: u64,
}
pub struct pollfd_ext {
pub fd: ::c_int,
pub events: ::c_ushort,
pub revents: ::c_ushort,
#[cfg(libc_union)]
pub data: __pollfd_ext_u,
}
}
impl siginfo_t {
pub unsafe fn si_addr(&self) -> *mut ::c_void {
self.si_addr
}
pub unsafe fn si_value(&self) -> ::sigval {
self.si_value
}
pub unsafe fn si_pid(&self) -> ::pid_t {
self.si_pid
}
pub unsafe fn si_uid(&self) -> ::uid_t {
self.si_uid
}
pub unsafe fn si_status(&self) -> ::c_int {
self.si_status
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for siginfo_t {
fn eq(&self, other: &siginfo_t) -> bool {
#[cfg(libc_union)]
let value_eq = self.si_value == other.si_value;
#[cfg(not(libc_union))]
let value_eq = true;
self.si_signo == other.si_signo
&& self.si_errno == other.si_errno
&& self.si_code == other.si_code
&& self.si_pid == other.si_pid
&& self.si_uid == other.si_uid
&& self.si_status == other.si_status
&& self.si_addr == other.si_addr
&& self.si_band == other.si_band
&& self.__si_flags == other.__si_flags
&& value_eq
}
}
impl Eq for siginfo_t {}
impl ::fmt::Debug for siginfo_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
let mut struct_formatter = f.debug_struct("siginfo_t");
struct_formatter.field("si_signo", &self.si_signo);
struct_formatter.field("si_errno", &self.si_errno);
struct_formatter.field("si_code", &self.si_code);
struct_formatter.field("si_pid", &self.si_pid);
struct_formatter.field("si_uid", &self.si_uid);
struct_formatter.field("si_status", &self.si_status);
struct_formatter.field("si_addr", &self.si_addr);
struct_formatter.field("si_band", &self.si_band);
#[cfg(libc_union)]
struct_formatter.field("si_value", &self.si_value);
struct_formatter.field("__si_flags", &self.__si_flags);
struct_formatter.finish()
}
}
impl ::hash::Hash for siginfo_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.si_signo.hash(state);
self.si_errno.hash(state);
self.si_code.hash(state);
self.si_pid.hash(state);
self.si_uid.hash(state);
self.si_status.hash(state);
self.si_addr.hash(state);
self.si_band.hash(state);
#[cfg(libc_union)]
self.si_value.hash(state);
self.__si_flags.hash(state);
}
}
#[cfg(libc_union)]
impl PartialEq for _kernel_simple_lock {
fn eq(&self, other: &_kernel_simple_lock) -> bool {
unsafe {
self._slock == other._slock
&& self._slockp == other._slockp
}
}
}
#[cfg(libc_union)]
impl Eq for _kernel_simple_lock {}
#[cfg(libc_union)]
impl ::fmt::Debug for _kernel_simple_lock {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("_kernel_simple_lock")
.field("_slock", unsafe { &self._slock })
.field("_slockp", unsafe { &self._slockp })
.finish()
}
}
#[cfg(libc_union)]
impl ::hash::Hash for _kernel_simple_lock {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
unsafe {
self._slock.hash(state);
self._slockp.hash(state);
}
}
}
impl PartialEq for fileops_t {
fn eq(&self, other: &fileops_t) -> bool {
self.fo_rw == other.fo_rw
&& self.fo_ioctl == other.fo_ioctl
&& self.fo_select == other.fo_select
&& self.fo_close == other.fo_close
&& self.fo_fstat == other.fo_fstat
}
}
impl Eq for fileops_t {}
impl ::fmt::Debug for fileops_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
let mut struct_formatter = f.debug_struct("fileops_t");
struct_formatter.field("fo_rw", &self.fo_rw);
struct_formatter.field("fo_ioctl", &self.fo_ioctl);
struct_formatter.field("fo_select", &self.fo_select);
struct_formatter.field("fo_close", &self.fo_close);
struct_formatter.field("fo_fstat", &self.fo_fstat);
struct_formatter.finish()
}
}
impl ::hash::Hash for fileops_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.fo_rw.hash(state);
self.fo_ioctl.hash(state);
self.fo_select.hash(state);
self.fo_close.hash(state);
self.fo_fstat.hash(state);
}
}
impl PartialEq for file {
fn eq(&self, other: &file) -> bool {
#[cfg(libc_union)]
let lock_eq = self.f_lock == other.f_lock
&& self.f_offset_lock == other.f_offset_lock;
#[cfg(not(libc_union))]
let lock_eq = true;
self.f_flag == other.f_flag
&& self.f_count == other.f_count
&& self.f_options == other.f_options
&& self.f_type == other.f_type
&& self.f_data == other.f_data
&& self.f_offset == other.f_offset
&& self.f_dir_off == other.f_dir_off
&& self.f_cred == other.f_cred
&& self.f_vinfo == other.f_vinfo
&& self.f_ops == other.f_ops
&& self.f_parentp == other.f_parentp
&& self.f_fnamep == other.f_fnamep
&& self.f_fdata == other.f_fdata
&& lock_eq
}
}
impl Eq for file {}
impl ::fmt::Debug for file {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
let mut struct_formatter = f.debug_struct("file");
struct_formatter.field("f_flag", &self.f_flag);
struct_formatter.field("f_count", &self.f_count);
struct_formatter.field("f_options", &self.f_options);
struct_formatter.field("f_type", &self.f_type);
struct_formatter.field("f_data", &self.f_data);
struct_formatter.field("f_offset", &self.f_offset);
struct_formatter.field("f_dir_off", &self.f_dir_off);
struct_formatter.field("f_cred", &self.f_cred);
#[cfg(libc_union)]
struct_formatter.field("f_lock", &self.f_lock);
#[cfg(libc_union)]
struct_formatter.field("f_offset_lock", &self.f_offset_lock);
struct_formatter.field("f_vinfo", &self.f_vinfo);
struct_formatter.field("f_ops", &self.f_ops);
struct_formatter.field("f_parentp", &self.f_parentp);
struct_formatter.field("f_fnamep", &self.f_fnamep);
struct_formatter.field("f_fdata", &self.f_fdata);
struct_formatter.finish()
}
}
impl ::hash::Hash for file {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.f_flag.hash(state);
self.f_count.hash(state);
self.f_options.hash(state);
self.f_type.hash(state);
self.f_data.hash(state);
self.f_offset.hash(state);
self.f_dir_off.hash(state);
self.f_cred.hash(state);
#[cfg(libc_union)]
self.f_lock.hash(state);
#[cfg(libc_union)]
self.f_offset_lock.hash(state);
self.f_vinfo.hash(state);
self.f_ops.hash(state);
self.f_parentp.hash(state);
self.f_fnamep.hash(state);
self.f_fdata.hash(state);
}
}
#[cfg(libc_union)]
impl PartialEq for __ld_info_file {
fn eq(&self, other: &__ld_info_file) -> bool {
unsafe {
self._ldinfo_fd == other._ldinfo_fd
&& self._ldinfo_fp == other._ldinfo_fp
&& self._core_offset == other._core_offset
}
}
}
#[cfg(libc_union)]
impl Eq for __ld_info_file {}
#[cfg(libc_union)]
impl ::fmt::Debug for __ld_info_file {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("__ld_info_file")
.field("_ldinfo_fd", unsafe { &self._ldinfo_fd })
.field("_ldinfo_fp", unsafe { &self._ldinfo_fp })
.field("_core_offset", unsafe { &self._core_offset })
.finish()
}
}
#[cfg(libc_union)]
impl ::hash::Hash for __ld_info_file {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
unsafe {
self._ldinfo_fd.hash(state);
self._ldinfo_fp.hash(state);
self._core_offset.hash(state);
}
}
}
impl PartialEq for ld_info {
fn eq(&self, other: &ld_info) -> bool {
#[cfg(libc_union)]
let file_eq = self._file == other._file;
#[cfg(not(libc_union))]
let file_eq = true;
self.ldinfo_next == other.ldinfo_next
&& self.ldinfo_flags == other.ldinfo_flags
&& self.ldinfo_textorg == other.ldinfo_textorg
&& self.ldinfo_textsize == other.ldinfo_textsize
&& self.ldinfo_dataorg == other.ldinfo_dataorg
&& self.ldinfo_datasize == other.ldinfo_datasize
&& self.ldinfo_filename == other.ldinfo_filename
&& file_eq
}
}
impl Eq for ld_info {}
impl ::fmt::Debug for ld_info {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
let mut struct_formatter = f.debug_struct("ld_info");
struct_formatter.field("ldinfo_next", &self.ldinfo_next);
struct_formatter.field("ldinfo_flags", &self.ldinfo_flags);
struct_formatter.field("ldinfo_textorg", &self.ldinfo_textorg);
struct_formatter.field("ldinfo_textsize", &self.ldinfo_textsize);
struct_formatter.field("ldinfo_dataorg", &self.ldinfo_dataorg);
struct_formatter.field("ldinfo_datasize", &self.ldinfo_datasize);
struct_formatter.field("ldinfo_filename", &self.ldinfo_filename);
#[cfg(libc_union)]
struct_formatter.field("_file", &self._file);
struct_formatter.finish()
}
}
impl ::hash::Hash for ld_info {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.ldinfo_next.hash(state);
self.ldinfo_flags.hash(state);
self.ldinfo_textorg.hash(state);
self.ldinfo_textsize.hash(state);
self.ldinfo_dataorg.hash(state);
self.ldinfo_datasize.hash(state);
self.ldinfo_filename.hash(state);
#[cfg(libc_union)]
self._file.hash(state);
}
}
#[cfg(libc_union)]
impl PartialEq for __pollfd_ext_u {
fn eq(&self, other: &__pollfd_ext_u) -> bool {
unsafe {
self.addr == other.addr
&& self.data32 == other.data32
&& self.data == other.data
}
}
}
#[cfg(libc_union)]
impl Eq for __pollfd_ext_u {}
#[cfg(libc_union)]
impl ::fmt::Debug for __pollfd_ext_u {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("__pollfd_ext_u")
.field("addr", unsafe { &self.addr })
.field("data32", unsafe { &self.data32 })
.field("data", unsafe { &self.data })
.finish()
}
}
#[cfg(libc_union)]
impl ::hash::Hash for __pollfd_ext_u {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
unsafe {
self.addr.hash(state);
self.data.hash(state);
self.data32.hash(state);
}
}
}
impl PartialEq for pollfd_ext {
fn eq(&self, other: &pollfd_ext) -> bool {
#[cfg(libc_union)]
let data_eq = self.data == other.data;
#[cfg(not(libc_union))]
let data_eq = true;
self.fd == other.fd
&& self.events == other.events
&& self.revents == other.revents
&& data_eq
}
}
impl Eq for pollfd_ext {}
impl ::fmt::Debug for pollfd_ext {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
let mut struct_formatter = f.debug_struct("pollfd_ext");
struct_formatter.field("fd", &self.fd);
struct_formatter.field("events", &self.events);
struct_formatter.field("revents", &self.revents);
#[cfg(libc_union)]
struct_formatter.field("data", &self.data);
struct_formatter.finish()
}
}
impl ::hash::Hash for pollfd_ext {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.fd.hash(state);
self.events.hash(state);
self.revents.hash(state);
#[cfg(libc_union)]
self.data.hash(state);
}
}
}
}
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
__mt_word: [0, 2, 0, 0, 0, 0, 0, 0],
};
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
__cv_word: [0, 0, 0, 0, 2, 0],
};
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
__rw_word: [2, 0, 0, 0, 0, 0, 0, 0, 0, 0],
};
pub const RLIM_INFINITY: ::c_ulong = 0x7fffffffffffffff;
extern "C" {
pub fn getsystemcfg(label: ::c_int) -> ::c_ulong;
}

View file

@ -0,0 +1,6 @@
s! {
#[repr(align(4))]
pub struct in6_addr {
pub s6_addr: [u8; 16],
}
}

View file

@ -0,0 +1,7 @@
s_no_extra_traits! {
#[allow(missing_debug_implementations)]
#[repr(align(16))]
pub struct max_align_t {
priv_: [f64; 2]
}
}

View file

@ -0,0 +1,119 @@
//! 32-bit specific Apple (ios/darwin) definitions
pub type c_long = i32;
pub type c_ulong = u32;
pub type boolean_t = ::c_int;
s! {
pub struct if_data {
pub ifi_type: ::c_uchar,
pub ifi_typelen: ::c_uchar,
pub ifi_physical: ::c_uchar,
pub ifi_addrlen: ::c_uchar,
pub ifi_hdrlen: ::c_uchar,
pub ifi_recvquota: ::c_uchar,
pub ifi_xmitquota: ::c_uchar,
pub ifi_unused1: ::c_uchar,
pub ifi_mtu: u32,
pub ifi_metric: u32,
pub ifi_baudrate: u32,
pub ifi_ipackets: u32,
pub ifi_ierrors: u32,
pub ifi_opackets: u32,
pub ifi_oerrors: u32,
pub ifi_collisions: u32,
pub ifi_ibytes: u32,
pub ifi_obytes: u32,
pub ifi_imcasts: u32,
pub ifi_omcasts: u32,
pub ifi_iqdrops: u32,
pub ifi_noproto: u32,
pub ifi_recvtiming: u32,
pub ifi_xmittiming: u32,
pub ifi_lastchange: ::timeval,
pub ifi_unused2: u32,
pub ifi_hwassist: u32,
pub ifi_reserved1: u32,
pub ifi_reserved2: u32,
}
pub struct bpf_hdr {
pub bh_tstamp: ::timeval,
pub bh_caplen: u32,
pub bh_datalen: u32,
pub bh_hdrlen: ::c_ushort,
}
pub struct malloc_zone_t {
__private: [::uintptr_t; 18], // FIXME: keeping private for now
}
}
s_no_extra_traits! {
pub struct pthread_attr_t {
__sig: c_long,
__opaque: [::c_char; 36]
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for pthread_attr_t {
fn eq(&self, other: &pthread_attr_t) -> bool {
self.__sig == other.__sig
&& self.__opaque
.iter()
.zip(other.__opaque.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for pthread_attr_t {}
impl ::fmt::Debug for pthread_attr_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("pthread_attr_t")
.field("__sig", &self.__sig)
// FIXME: .field("__opaque", &self.__opaque)
.finish()
}
}
impl ::hash::Hash for pthread_attr_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.__sig.hash(state);
self.__opaque.hash(state);
}
}
}
}
#[doc(hidden)]
#[deprecated(since = "0.2.55")]
pub const NET_RT_MAXID: ::c_int = 10;
pub const __PTHREAD_MUTEX_SIZE__: usize = 40;
pub const __PTHREAD_COND_SIZE__: usize = 24;
pub const __PTHREAD_CONDATTR_SIZE__: usize = 4;
pub const __PTHREAD_RWLOCK_SIZE__: usize = 124;
pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 12;
pub const TIOCTIMESTAMP: ::c_ulong = 0x40087459;
pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40087458;
pub const BIOCSETF: ::c_ulong = 0x80084267;
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8008426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4008426e;
pub const BIOCSETFNR: ::c_ulong = 0x8008427e;
extern "C" {
pub fn exchangedata(
path1: *const ::c_char,
path2: *const ::c_char,
options: ::c_ulong,
) -> ::c_int;
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View file

@ -0,0 +1,55 @@
pub type mcontext_t = *mut __darwin_mcontext64;
s_no_extra_traits! {
#[allow(missing_debug_implementations)]
pub struct max_align_t {
priv_: f64
}
}
s! {
pub struct ucontext_t {
pub uc_onstack: ::c_int,
pub uc_sigmask: ::sigset_t,
pub uc_stack: ::stack_t,
pub uc_link: *mut ::ucontext_t,
pub uc_mcsize: usize,
pub uc_mcontext: mcontext_t,
}
pub struct __darwin_mcontext64 {
pub __es: __darwin_arm_exception_state64,
pub __ss: __darwin_arm_thread_state64,
pub __ns: __darwin_arm_neon_state64,
}
pub struct __darwin_arm_exception_state64 {
pub __far: u64,
pub __esr: u32,
pub __exception: u32,
}
pub struct __darwin_arm_thread_state64 {
pub __x: [u64; 29],
pub __fp: u64,
pub __lr: u64,
pub __sp: u64,
pub __pc: u64,
pub __cpsr: u32,
pub __pad: u32,
}
// This type natively uses a uint128, but for a while we hacked
// it in with repr(align) and `[u64; 2]`. uint128 isn't available
// all the way back to our earliest supported versions so we
// preserver the old shim.
#[cfg_attr(not(libc_int128), repr(align(16)))]
pub struct __darwin_arm_neon_state64 {
#[cfg(libc_int128)]
pub __v: [::__uint128_t; 32],
#[cfg(not(libc_int128))]
pub __v: [[u64; 2]; 32],
pub __fpsr: u32,
pub __fpcr: u32,
}
}

View file

@ -0,0 +1,14 @@
pub type boolean_t = ::c_int;
s! {
pub struct malloc_zone_t {
__private: [::uintptr_t; 18], // FIXME: needs arm64 auth pointers support
}
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View file

@ -0,0 +1,7 @@
s_no_extra_traits! {
#[allow(missing_debug_implementations)]
#[repr(align(16))]
pub struct max_align_t {
priv_: [f64; 2]
}
}

View file

@ -0,0 +1,124 @@
//! 64-bit specific Apple (ios/darwin) definitions
pub type c_long = i64;
pub type c_ulong = u64;
s! {
pub struct timeval32 {
pub tv_sec: i32,
pub tv_usec: i32,
}
pub struct if_data {
pub ifi_type: ::c_uchar,
pub ifi_typelen: ::c_uchar,
pub ifi_physical: ::c_uchar,
pub ifi_addrlen: ::c_uchar,
pub ifi_hdrlen: ::c_uchar,
pub ifi_recvquota: ::c_uchar,
pub ifi_xmitquota: ::c_uchar,
pub ifi_unused1: ::c_uchar,
pub ifi_mtu: u32,
pub ifi_metric: u32,
pub ifi_baudrate: u32,
pub ifi_ipackets: u32,
pub ifi_ierrors: u32,
pub ifi_opackets: u32,
pub ifi_oerrors: u32,
pub ifi_collisions: u32,
pub ifi_ibytes: u32,
pub ifi_obytes: u32,
pub ifi_imcasts: u32,
pub ifi_omcasts: u32,
pub ifi_iqdrops: u32,
pub ifi_noproto: u32,
pub ifi_recvtiming: u32,
pub ifi_xmittiming: u32,
pub ifi_lastchange: timeval32,
pub ifi_unused2: u32,
pub ifi_hwassist: u32,
pub ifi_reserved1: u32,
pub ifi_reserved2: u32,
}
pub struct bpf_hdr {
pub bh_tstamp: ::timeval32,
pub bh_caplen: u32,
pub bh_datalen: u32,
pub bh_hdrlen: ::c_ushort,
}
}
s_no_extra_traits! {
pub struct pthread_attr_t {
__sig: c_long,
__opaque: [::c_char; 56]
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for pthread_attr_t {
fn eq(&self, other: &pthread_attr_t) -> bool {
self.__sig == other.__sig
&& self.__opaque
.iter()
.zip(other.__opaque.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for pthread_attr_t {}
impl ::fmt::Debug for pthread_attr_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("pthread_attr_t")
.field("__sig", &self.__sig)
// FIXME: .field("__opaque", &self.__opaque)
.finish()
}
}
impl ::hash::Hash for pthread_attr_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.__sig.hash(state);
self.__opaque.hash(state);
}
}
}
}
#[doc(hidden)]
#[deprecated(since = "0.2.55")]
pub const NET_RT_MAXID: ::c_int = 11;
pub const __PTHREAD_MUTEX_SIZE__: usize = 56;
pub const __PTHREAD_COND_SIZE__: usize = 40;
pub const __PTHREAD_CONDATTR_SIZE__: usize = 8;
pub const __PTHREAD_RWLOCK_SIZE__: usize = 192;
pub const __PTHREAD_RWLOCKATTR_SIZE__: usize = 16;
pub const TIOCTIMESTAMP: ::c_ulong = 0x40107459;
pub const TIOCDCDTIMESTAMP: ::c_ulong = 0x40107458;
pub const BIOCSETF: ::c_ulong = 0x80104267;
pub const BIOCSRTIMEOUT: ::c_ulong = 0x8010426d;
pub const BIOCGRTIMEOUT: ::c_ulong = 0x4010426e;
pub const BIOCSETFNR: ::c_ulong = 0x8010427e;
extern "C" {
pub fn exchangedata(
path1: *const ::c_char,
path2: *const ::c_char,
options: ::c_uint,
) -> ::c_int;
}
cfg_if! {
if #[cfg(target_arch = "x86_64")] {
mod x86_64;
pub use self::x86_64::*;
} else if #[cfg(target_arch = "aarch64")] {
mod aarch64;
pub use self::aarch64::*;
} else {
// Unknown target_arch
}
}

View file

@ -0,0 +1,7 @@
s_no_extra_traits! {
#[allow(missing_debug_implementations)]
#[repr(align(16))]
pub struct max_align_t {
priv_: [f64; 2]
}
}

View file

@ -0,0 +1,180 @@
pub type boolean_t = ::c_uint;
pub type mcontext_t = *mut __darwin_mcontext64;
s! {
pub struct ucontext_t {
pub uc_onstack: ::c_int,
pub uc_sigmask: ::sigset_t,
pub uc_stack: ::stack_t,
pub uc_link: *mut ::ucontext_t,
pub uc_mcsize: usize,
pub uc_mcontext: mcontext_t,
}
pub struct __darwin_mcontext64 {
pub __es: __darwin_x86_exception_state64,
pub __ss: __darwin_x86_thread_state64,
pub __fs: __darwin_x86_float_state64,
}
pub struct __darwin_x86_exception_state64 {
pub __trapno: u16,
pub __cpu: u16,
pub __err: u32,
pub __faultvaddr: u64,
}
pub struct __darwin_x86_thread_state64 {
pub __rax: u64,
pub __rbx: u64,
pub __rcx: u64,
pub __rdx: u64,
pub __rdi: u64,
pub __rsi: u64,
pub __rbp: u64,
pub __rsp: u64,
pub __r8: u64,
pub __r9: u64,
pub __r10: u64,
pub __r11: u64,
pub __r12: u64,
pub __r13: u64,
pub __r14: u64,
pub __r15: u64,
pub __rip: u64,
pub __rflags: u64,
pub __cs: u64,
pub __fs: u64,
pub __gs: u64,
}
pub struct __darwin_x86_float_state64 {
pub __fpu_reserved: [::c_int; 2],
__fpu_fcw: ::c_short,
__fpu_fsw: ::c_short,
pub __fpu_ftw: u8,
pub __fpu_rsrv1: u8,
pub __fpu_fop: u16,
pub __fpu_ip: u32,
pub __fpu_cs: u16,
pub __fpu_rsrv2: u16,
pub __fpu_dp: u32,
pub __fpu_ds: u16,
pub __fpu_rsrv3: u16,
pub __fpu_mxcsr: u32,
pub __fpu_mxcsrmask: u32,
pub __fpu_stmm0: __darwin_mmst_reg,
pub __fpu_stmm1: __darwin_mmst_reg,
pub __fpu_stmm2: __darwin_mmst_reg,
pub __fpu_stmm3: __darwin_mmst_reg,
pub __fpu_stmm4: __darwin_mmst_reg,
pub __fpu_stmm5: __darwin_mmst_reg,
pub __fpu_stmm6: __darwin_mmst_reg,
pub __fpu_stmm7: __darwin_mmst_reg,
pub __fpu_xmm0: __darwin_xmm_reg,
pub __fpu_xmm1: __darwin_xmm_reg,
pub __fpu_xmm2: __darwin_xmm_reg,
pub __fpu_xmm3: __darwin_xmm_reg,
pub __fpu_xmm4: __darwin_xmm_reg,
pub __fpu_xmm5: __darwin_xmm_reg,
pub __fpu_xmm6: __darwin_xmm_reg,
pub __fpu_xmm7: __darwin_xmm_reg,
pub __fpu_xmm8: __darwin_xmm_reg,
pub __fpu_xmm9: __darwin_xmm_reg,
pub __fpu_xmm10: __darwin_xmm_reg,
pub __fpu_xmm11: __darwin_xmm_reg,
pub __fpu_xmm12: __darwin_xmm_reg,
pub __fpu_xmm13: __darwin_xmm_reg,
pub __fpu_xmm14: __darwin_xmm_reg,
pub __fpu_xmm15: __darwin_xmm_reg,
// this field is actually [u8; 96], but defining it with a bigger type
// allows us to auto-implement traits for it since the length of the
// array is less than 32
__fpu_rsrv4: [u32; 24],
pub __fpu_reserved1: ::c_int,
}
pub struct __darwin_mmst_reg {
pub __mmst_reg: [::c_char; 10],
pub __mmst_rsrv: [::c_char; 6],
}
pub struct __darwin_xmm_reg {
pub __xmm_reg: [::c_char; 16],
}
pub struct malloc_introspection_t {
_private: [::uintptr_t; 16], // FIXME: keeping private for now
}
pub struct malloc_zone_t {
_reserved1: *mut ::c_void,
_reserved2: *mut ::c_void,
pub size: ::Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
ptr: *const ::c_void,
) -> ::size_t>,
pub malloc: ::Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
size: ::size_t,
) -> *mut ::c_void>,
pub calloc: ::Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
num_items: ::size_t,
size: ::size_t,
) -> *mut ::c_void>,
pub valloc: ::Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
size: ::size_t
) -> *mut ::c_void>,
pub free: ::Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
ptr: *mut ::c_void
)>,
pub realloc: ::Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
ptr: *mut ::c_void,
size: ::size_t,
) -> *mut ::c_void>,
pub destroy: ::Option<unsafe extern "C" fn(zone: *mut malloc_zone_t)>,
pub zone_name: *const ::c_char,
pub batch_malloc: ::Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
size: ::size_t,
results: *mut *mut ::c_void,
num_requested: ::c_uint,
) -> ::c_uint>,
pub batch_free: ::Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
to_be_freed: *mut *mut ::c_void,
num_to_be_freed: ::c_uint,
)>,
pub introspect: *mut malloc_introspection_t,
pub version: ::c_uint,
pub memalign: ::Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
alignment: ::size_t,
size: ::size_t,
) -> *mut ::c_void>,
pub free_definite_size: ::Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
ptr: *mut ::c_void,
size: ::size_t
)>,
pub pressure_relief: ::Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
goal: ::size_t,
) -> ::size_t>,
pub claimed_address: ::Option<unsafe extern "C" fn(
zone: *mut malloc_zone_t,
ptr: *mut ::c_void,
) -> ::boolean_t>,
}
}
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

View file

@ -0,0 +1,8 @@
s! {
pub struct ctl_info {
pub ctl_id: u32,
pub ctl_name: [::c_char; MAX_KCTL_NAME],
}
}
pub const MAX_KCTL_NAME: usize = 96;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,13 @@
// DragonFlyBSD's __error function is declared with "static inline", so it must
// be implemented in the libc crate, as a pointer to a static thread_local.
f! {
#[deprecated(since = "0.2.77", note = "Use `__errno_location()` instead")]
pub fn __error() -> *mut ::c_int {
&mut errno
}
}
extern "C" {
#[thread_local]
pub static mut errno: ::c_int;
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,146 @@
pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type wchar_t = u32;
pub type time_t = i64;
pub type suseconds_t = i64;
pub type register_t = i64;
s_no_extra_traits! {
pub struct gpregs {
pub gp_x: [::register_t; 30],
pub gp_lr: ::register_t,
pub gp_sp: ::register_t,
pub gp_elr: ::register_t,
pub gp_spsr: u32,
pub gp_pad: ::c_int,
}
pub struct fpregs {
pub fp_q: u128,
pub fp_sr: u32,
pub fp_cr: u32,
pub fp_flags: ::c_int,
pub fp_pad: ::c_int,
}
pub struct mcontext_t {
pub mc_gpregs: gpregs,
pub mc_fpregs: fpregs,
pub mc_flags: ::c_int,
pub mc_pad: ::c_int,
pub mc_spare: [u64; 8],
}
}
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 8 - 1;
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for gpregs {
fn eq(&self, other: &gpregs) -> bool {
self.gp_x.iter().zip(other.gp_x.iter()).all(|(a, b)| a == b) &&
self.gp_lr == other.gp_lr &&
self.gp_sp == other.gp_sp &&
self.gp_elr == other.gp_elr &&
self.gp_spsr == other.gp_spsr &&
self.gp_pad == other.gp_pad
}
}
impl Eq for gpregs {}
impl ::fmt::Debug for gpregs {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("gpregs")
.field("gp_x", &self.gp_x)
.field("gp_lr", &self.gp_lr)
.field("gp_sp", &self.gp_sp)
.field("gp_elr", &self.gp_elr)
.field("gp_spsr", &self.gp_spsr)
.field("gp_pad", &self.gp_pad)
.finish()
}
}
impl ::hash::Hash for gpregs {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.gp_x.hash(state);
self.gp_lr.hash(state);
self.gp_sp.hash(state);
self.gp_elr.hash(state);
self.gp_spsr.hash(state);
self.gp_pad.hash(state);
}
}
impl PartialEq for fpregs {
fn eq(&self, other: &fpregs) -> bool {
self.fp_q == other.fp_q &&
self.fp_sr == other.fp_sr &&
self.fp_cr == other.fp_cr &&
self.fp_flags == other.fp_flags &&
self.fp_pad == other.fp_pad
}
}
impl Eq for fpregs {}
impl ::fmt::Debug for fpregs {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("fpregs")
.field("fp_q", &self.fp_q)
.field("fp_sr", &self.fp_sr)
.field("fp_cr", &self.fp_cr)
.field("fp_flags", &self.fp_flags)
.field("fp_pad", &self.fp_pad)
.finish()
}
}
impl ::hash::Hash for fpregs {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.fp_q.hash(state);
self.fp_sr.hash(state);
self.fp_cr.hash(state);
self.fp_flags.hash(state);
self.fp_pad.hash(state);
}
}
impl PartialEq for mcontext_t {
fn eq(&self, other: &mcontext_t) -> bool {
self.mc_gpregs == other.mc_gpregs &&
self.mc_fpregs == other.mc_fpregs &&
self.mc_flags == other.mc_flags &&
self.mc_pad == other.mc_pad &&
self.mc_spare.iter().zip(other.mc_spare.iter()).all(|(a, b)| a == b)
}
}
impl Eq for mcontext_t {}
impl ::fmt::Debug for mcontext_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("mcontext_t")
.field("mc_gpregs", &self.mc_gpregs)
.field("mc_fpregs", &self.mc_fpregs)
.field("mc_flags", &self.mc_flags)
.field("mc_pad", &self.mc_pad)
.field("mc_spare", &self.mc_spare)
.finish()
}
}
impl ::hash::Hash for mcontext_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.mc_gpregs.hash(state);
self.mc_fpregs.hash(state);
self.mc_flags.hash(state);
self.mc_pad.hash(state);
self.mc_spare.hash(state);
}
}
}
}
pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4

View file

@ -0,0 +1,50 @@
pub type c_char = u8;
pub type c_long = i32;
pub type c_ulong = u32;
pub type wchar_t = u32;
pub type time_t = i64;
pub type suseconds_t = i32;
pub type register_t = i32;
s! {
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_mode: ::mode_t,
pub st_nlink: ::nlink_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_rdev: ::dev_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_atime_pad: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_mtime_pad: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
pub st_ctime_pad: ::c_long,
pub st_size: ::off_t,
pub st_blocks: ::blkcnt_t,
pub st_blksize: ::blksize_t,
pub st_flags: ::fflags_t,
pub st_gen: u32,
pub st_lspare: i32,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
pub st_birthtime_pad: ::c_long,
}
}
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 4 - 1;
}
}
pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4

View file

@ -0,0 +1,32 @@
#[repr(C)]
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_mode: ::mode_t,
pub st_nlink: ::nlink_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_rdev: ::dev_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
pub st_size: ::off_t,
pub st_blocks: ::blkcnt_t,
pub st_blksize: ::blksize_t,
pub st_flags: ::fflags_t,
pub st_gen: u32,
pub st_lspare: i32,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
}
impl ::Copy for ::stat {}
impl ::Clone for ::stat {
fn clone(&self) -> ::stat {
*self
}
}

View file

@ -0,0 +1,488 @@
// APIs that were changed after FreeBSD 11
// The type of `nlink_t` changed from `u16` to `u64` in FreeBSD 12:
pub type nlink_t = u16;
// Type of `dev_t` changed from `u32` to `u64` in FreeBSD 12:
pub type dev_t = u32;
// Type of `ino_t` changed from `unsigned int` to `unsigned long` in FreeBSD 12:
pub type ino_t = u32;
s! {
pub struct kevent {
pub ident: ::uintptr_t,
pub filter: ::c_short,
pub flags: ::c_ushort,
pub fflags: ::c_uint,
pub data: ::intptr_t,
pub udata: *mut ::c_void,
}
pub struct shmid_ds {
pub shm_perm: ::ipc_perm,
pub shm_segsz: ::size_t,
pub shm_lpid: ::pid_t,
pub shm_cpid: ::pid_t,
// Type of shm_nattc changed from `int` to `shmatt_t` (aka `unsigned
// int`) in FreeBSD 12:
pub shm_nattch: ::c_int,
pub shm_atime: ::time_t,
pub shm_dtime: ::time_t,
pub shm_ctime: ::time_t,
}
pub struct kinfo_proc {
/// Size of this structure.
pub ki_structsize: ::c_int,
/// Reserved: layout identifier.
pub ki_layout: ::c_int,
/// Address of command arguments.
pub ki_args: *mut ::pargs,
// This is normally "struct proc".
/// Address of proc.
pub ki_paddr: *mut ::c_void,
// This is normally "struct user".
/// Kernel virtual address of u-area.
pub ki_addr: *mut ::c_void,
// This is normally "struct vnode".
/// Pointer to trace file.
pub ki_tracep: *mut ::c_void,
// This is normally "struct vnode".
/// Pointer to executable file.
pub ki_textvp: *mut ::c_void,
// This is normally "struct filedesc".
/// Pointer to open file info.
pub ki_fd: *mut ::c_void,
// This is normally "struct vmspace".
/// Pointer to kernel vmspace struct.
pub ki_vmspace: *mut ::c_void,
/// Sleep address.
pub ki_wchan: *mut ::c_void,
/// Process identifier.
pub ki_pid: ::pid_t,
/// Parent process ID.
pub ki_ppid: ::pid_t,
/// Process group ID.
pub ki_pgid: ::pid_t,
/// tty process group ID.
pub ki_tpgid: ::pid_t,
/// Process session ID.
pub ki_sid: ::pid_t,
/// Terminal session ID.
pub ki_tsid: ::pid_t,
/// Job control counter.
pub ki_jobc: ::c_short,
/// Unused (just here for alignment).
pub ki_spare_short1: ::c_short,
/// Controlling tty dev.
pub ki_tdev: ::dev_t,
/// Signals arrived but not delivered.
pub ki_siglist: ::sigset_t,
/// Current signal mask.
pub ki_sigmask: ::sigset_t,
/// Signals being ignored.
pub ki_sigignore: ::sigset_t,
/// Signals being caught by user.
pub ki_sigcatch: ::sigset_t,
/// Effective user ID.
pub ki_uid: ::uid_t,
/// Real user ID.
pub ki_ruid: ::uid_t,
/// Saved effective user ID.
pub ki_svuid: ::uid_t,
/// Real group ID.
pub ki_rgid: ::gid_t,
/// Saved effective group ID.
pub ki_svgid: ::gid_t,
/// Number of groups.
pub ki_ngroups: ::c_short,
/// Unused (just here for alignment).
pub ki_spare_short2: ::c_short,
/// Groups.
pub ki_groups: [::gid_t; ::KI_NGROUPS],
/// Virtual size.
pub ki_size: ::vm_size_t,
/// Current resident set size in pages.
pub ki_rssize: ::segsz_t,
/// Resident set size before last swap.
pub ki_swrss: ::segsz_t,
/// Text size (pages) XXX.
pub ki_tsize: ::segsz_t,
/// Data size (pages) XXX.
pub ki_dsize: ::segsz_t,
/// Stack size (pages).
pub ki_ssize: ::segsz_t,
/// Exit status for wait & stop signal.
pub ki_xstat: ::u_short,
/// Accounting flags.
pub ki_acflag: ::u_short,
/// %cpu for process during `ki_swtime`.
pub ki_pctcpu: ::fixpt_t,
/// Time averaged value of `ki_cpticks`.
pub ki_estcpu: ::u_int,
/// Time since last blocked.
pub ki_slptime: ::u_int,
/// Time swapped in or out.
pub ki_swtime: ::u_int,
/// Number of copy-on-write faults.
pub ki_cow: ::u_int,
/// Real time in microsec.
pub ki_runtime: u64,
/// Starting time.
pub ki_start: ::timeval,
/// Time used by process children.
pub ki_childtime: ::timeval,
/// P_* flags.
pub ki_flag: ::c_long,
/// KI_* flags (below).
pub ki_kiflag: ::c_long,
/// Kernel trace points.
pub ki_traceflag: ::c_int,
/// S* process status.
pub ki_stat: ::c_char,
/// Process "nice" value.
pub ki_nice: i8, // signed char
/// Process lock (prevent swap) count.
pub ki_lock: ::c_char,
/// Run queue index.
pub ki_rqindex: ::c_char,
/// Which cpu we are on.
pub ki_oncpu_old: ::c_uchar,
/// Last cpu we were on.
pub ki_lastcpu_old: ::c_uchar,
/// Thread name.
pub ki_tdname: [::c_char; ::TDNAMLEN + 1],
/// Wchan message.
pub ki_wmesg: [::c_char; ::WMESGLEN + 1],
/// Setlogin name.
pub ki_login: [::c_char; ::LOGNAMELEN + 1],
/// Lock name.
pub ki_lockname: [::c_char; ::LOCKNAMELEN + 1],
/// Command name.
pub ki_comm: [::c_char; ::COMMLEN + 1],
/// Emulation name.
pub ki_emul: [::c_char; ::KI_EMULNAMELEN + 1],
/// Login class.
pub ki_loginclass: [::c_char; ::LOGINCLASSLEN + 1],
/// More thread name.
pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1],
/// Spare string space.
pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq
/// Spare room for growth.
pub ki_spareints: [::c_int; ::KI_NSPARE_INT],
/// Which cpu we are on.
pub ki_oncpu: ::c_int,
/// Last cpu we were on.
pub ki_lastcpu: ::c_int,
/// PID of tracing process.
pub ki_tracer: ::c_int,
/// P2_* flags.
pub ki_flag2: ::c_int,
/// Default FIB number.
pub ki_fibnum: ::c_int,
/// Credential flags.
pub ki_cr_flags: ::u_int,
/// Process jail ID.
pub ki_jid: ::c_int,
/// Number of threads in total.
pub ki_numthreads: ::c_int,
/// Thread ID.
pub ki_tid: ::lwpid_t,
/// Process priority.
pub ki_pri: ::priority,
/// Process rusage statistics.
pub ki_rusage: ::rusage,
/// rusage of children processes.
pub ki_rusage_ch: ::rusage,
// This is normally "struct pcb".
/// Kernel virtual addr of pcb.
pub ki_pcb: *mut ::c_void,
/// Kernel virtual addr of stack.
pub ki_kstack: *mut ::c_void,
/// User convenience pointer.
pub ki_udata: *mut ::c_void,
// This is normally "struct thread".
pub ki_tdaddr: *mut ::c_void,
pub ki_spareptrs: [*mut ::c_void; ::KI_NSPARE_PTR],
pub ki_sparelongs: [::c_long; ::KI_NSPARE_LONG],
/// PS_* flags.
pub ki_sflag: ::c_long,
/// kthread flag.
pub ki_tdflags: ::c_long,
}
}
s_no_extra_traits! {
pub struct dirent {
pub d_fileno: ::ino_t,
pub d_reclen: u16,
pub d_type: u8,
// Type of `d_namlen` changed from `char` to `u16` in FreeBSD 12:
pub d_namlen: u8,
pub d_name: [::c_char; 256],
}
pub struct statfs {
pub f_version: u32,
pub f_type: u32,
pub f_flags: u64,
pub f_bsize: u64,
pub f_iosize: u64,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: i64,
pub f_files: u64,
pub f_ffree: i64,
pub f_syncwrites: u64,
pub f_asyncwrites: u64,
pub f_syncreads: u64,
pub f_asyncreads: u64,
f_spare: [u64; 10],
pub f_namemax: u32,
pub f_owner: ::uid_t,
pub f_fsid: ::fsid_t,
f_charspare: [::c_char; 80],
pub f_fstypename: [::c_char; 16],
// Array length changed from 88 to 1024 in FreeBSD 12:
pub f_mntfromname: [::c_char; 88],
// Array length changed from 88 to 1024 in FreeBSD 12:
pub f_mntonname: [::c_char; 88],
}
pub struct vnstat {
pub vn_fileid: u64,
pub vn_size: u64,
pub vn_mntdir: *mut ::c_char,
pub vn_dev: u32,
pub vn_fsid: u32,
pub vn_type: ::c_int,
pub vn_mode: u16,
pub vn_devname: [::c_char; ::SPECNAMELEN as usize + 1],
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for statfs {
fn eq(&self, other: &statfs) -> bool {
self.f_version == other.f_version
&& self.f_type == other.f_type
&& self.f_flags == other.f_flags
&& self.f_bsize == other.f_bsize
&& self.f_iosize == other.f_iosize
&& self.f_blocks == other.f_blocks
&& self.f_bfree == other.f_bfree
&& self.f_bavail == other.f_bavail
&& self.f_files == other.f_files
&& self.f_ffree == other.f_ffree
&& self.f_syncwrites == other.f_syncwrites
&& self.f_asyncwrites == other.f_asyncwrites
&& self.f_syncreads == other.f_syncreads
&& self.f_asyncreads == other.f_asyncreads
&& self.f_namemax == other.f_namemax
&& self.f_owner == other.f_owner
&& self.f_fsid == other.f_fsid
&& self.f_fstypename == other.f_fstypename
&& self
.f_mntfromname
.iter()
.zip(other.f_mntfromname.iter())
.all(|(a,b)| a == b)
&& self
.f_mntonname
.iter()
.zip(other.f_mntonname.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for statfs {}
impl ::fmt::Debug for statfs {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("statfs")
.field("f_bsize", &self.f_bsize)
.field("f_iosize", &self.f_iosize)
.field("f_blocks", &self.f_blocks)
.field("f_bfree", &self.f_bfree)
.field("f_bavail", &self.f_bavail)
.field("f_files", &self.f_files)
.field("f_ffree", &self.f_ffree)
.field("f_syncwrites", &self.f_syncwrites)
.field("f_asyncwrites", &self.f_asyncwrites)
.field("f_syncreads", &self.f_syncreads)
.field("f_asyncreads", &self.f_asyncreads)
.field("f_namemax", &self.f_namemax)
.field("f_owner", &self.f_owner)
.field("f_fsid", &self.f_fsid)
.field("f_fstypename", &self.f_fstypename)
.field("f_mntfromname", &&self.f_mntfromname[..])
.field("f_mntonname", &&self.f_mntonname[..])
.finish()
}
}
impl ::hash::Hash for statfs {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.f_version.hash(state);
self.f_type.hash(state);
self.f_flags.hash(state);
self.f_bsize.hash(state);
self.f_iosize.hash(state);
self.f_blocks.hash(state);
self.f_bfree.hash(state);
self.f_bavail.hash(state);
self.f_files.hash(state);
self.f_ffree.hash(state);
self.f_syncwrites.hash(state);
self.f_asyncwrites.hash(state);
self.f_syncreads.hash(state);
self.f_asyncreads.hash(state);
self.f_namemax.hash(state);
self.f_owner.hash(state);
self.f_fsid.hash(state);
self.f_fstypename.hash(state);
self.f_mntfromname.hash(state);
self.f_mntonname.hash(state);
}
}
impl PartialEq for dirent {
fn eq(&self, other: &dirent) -> bool {
self.d_fileno == other.d_fileno
&& self.d_reclen == other.d_reclen
&& self.d_type == other.d_type
&& self.d_namlen == other.d_namlen
&& self
.d_name[..self.d_namlen as _]
.iter()
.zip(other.d_name.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for dirent {}
impl ::fmt::Debug for dirent {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("dirent")
.field("d_fileno", &self.d_fileno)
.field("d_reclen", &self.d_reclen)
.field("d_type", &self.d_type)
.field("d_namlen", &self.d_namlen)
.field("d_name", &&self.d_name[..self.d_namlen as _])
.finish()
}
}
impl ::hash::Hash for dirent {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.d_fileno.hash(state);
self.d_reclen.hash(state);
self.d_type.hash(state);
self.d_namlen.hash(state);
self.d_name[..self.d_namlen as _].hash(state);
}
}
impl PartialEq for vnstat {
fn eq(&self, other: &vnstat) -> bool {
let self_vn_devname: &[::c_char] = &self.vn_devname;
let other_vn_devname: &[::c_char] = &other.vn_devname;
self.vn_fileid == other.vn_fileid &&
self.vn_size == other.vn_size &&
self.vn_mntdir == other.vn_mntdir &&
self.vn_dev == other.vn_dev &&
self.vn_fsid == other.vn_fsid &&
self.vn_type == other.vn_type &&
self.vn_mode == other.vn_mode &&
self_vn_devname == other_vn_devname
}
}
impl Eq for vnstat {}
impl ::fmt::Debug for vnstat {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
let self_vn_devname: &[::c_char] = &self.vn_devname;
f.debug_struct("vnstat")
.field("vn_fileid", &self.vn_fileid)
.field("vn_size", &self.vn_size)
.field("vn_mntdir", &self.vn_mntdir)
.field("vn_dev", &self.vn_dev)
.field("vn_fsid", &self.vn_fsid)
.field("vn_type", &self.vn_type)
.field("vn_mode", &self.vn_mode)
.field("vn_devname", &self_vn_devname)
.finish()
}
}
impl ::hash::Hash for vnstat {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
let self_vn_devname: &[::c_char] = &self.vn_devname;
self.vn_fileid.hash(state);
self.vn_size.hash(state);
self.vn_mntdir.hash(state);
self.vn_dev.hash(state);
self.vn_fsid.hash(state);
self.vn_type.hash(state);
self.vn_mode.hash(state);
self_vn_devname.hash(state);
}
}
}
}
pub const ELAST: ::c_int = 96;
pub const RAND_MAX: ::c_int = 0x7fff_fffd;
pub const KI_NSPARE_PTR: usize = 6;
pub const MINCORE_SUPER: ::c_int = 0x20;
/// max length of devicename
pub const SPECNAMELEN: ::c_int = 63;
safe_f! {
pub {const} fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
let major = major as ::dev_t;
let minor = minor as ::dev_t;
(major << 8) | minor
}
}
f! {
pub fn major(dev: ::dev_t) -> ::c_int {
((dev >> 8) & 0xff) as ::c_int
}
pub fn minor(dev: ::dev_t) -> ::c_int {
(dev & 0xffff00ff) as ::c_int
}
}
extern "C" {
// Return type ::c_int was removed in FreeBSD 12
pub fn setgrent() -> ::c_int;
// Type of `addr` argument changed from `const void*` to `void*`
// in FreeBSD 12
pub fn mprotect(addr: *const ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
// Return type ::c_int was removed in FreeBSD 12
pub fn freelocale(loc: ::locale_t) -> ::c_int;
// Return type ::c_int changed to ::ssize_t in FreeBSD 12:
pub fn msgrcv(
msqid: ::c_int,
msgp: *mut ::c_void,
msgsz: ::size_t,
msgtyp: ::c_long,
msgflg: ::c_int,
) -> ::c_int;
// Type of `path` argument changed from `const void*` to `void*`
// in FreeBSD 12
pub fn dirname(path: *const ::c_char) -> *mut ::c_char;
pub fn basename(path: *const ::c_char) -> *mut ::c_char;
}
cfg_if! {
if #[cfg(any(target_arch = "x86_64",
target_arch = "aarch64",
target_arch = "riscv64"))] {
mod b64;
pub use self::b64::*;
}
}

View file

@ -0,0 +1,34 @@
#[repr(C)]
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_nlink: ::nlink_t,
pub st_mode: ::mode_t,
st_padding0: i16,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
st_padding1: i32,
pub st_rdev: ::dev_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
pub st_size: ::off_t,
pub st_blocks: ::blkcnt_t,
pub st_blksize: ::blksize_t,
pub st_flags: ::fflags_t,
pub st_gen: u64,
pub st_spare: [u64; 10],
}
impl ::Copy for ::stat {}
impl ::Clone for ::stat {
fn clone(&self) -> ::stat {
*self
}
}

View file

@ -0,0 +1,505 @@
// APIs in FreeBSD 12 that have changed since 11.
pub type nlink_t = u64;
pub type dev_t = u64;
pub type ino_t = ::c_ulong;
pub type shmatt_t = ::c_uint;
s! {
pub struct shmid_ds {
pub shm_perm: ::ipc_perm,
pub shm_segsz: ::size_t,
pub shm_lpid: ::pid_t,
pub shm_cpid: ::pid_t,
pub shm_nattch: ::shmatt_t,
pub shm_atime: ::time_t,
pub shm_dtime: ::time_t,
pub shm_ctime: ::time_t,
}
pub struct kevent {
pub ident: ::uintptr_t,
pub filter: ::c_short,
pub flags: ::c_ushort,
pub fflags: ::c_uint,
pub data: i64,
pub udata: *mut ::c_void,
pub ext: [u64; 4],
}
pub struct kvm_page {
pub version: ::c_uint,
pub paddr: ::c_ulong,
pub kmap_vaddr: ::c_ulong,
pub dmap_vaddr: ::c_ulong,
pub prot: ::vm_prot_t,
pub offset: ::u_long,
pub len: ::size_t,
}
pub struct kinfo_proc {
/// Size of this structure.
pub ki_structsize: ::c_int,
/// Reserved: layout identifier.
pub ki_layout: ::c_int,
/// Address of command arguments.
pub ki_args: *mut ::pargs,
// This is normally "struct proc".
/// Address of proc.
pub ki_paddr: *mut ::c_void,
// This is normally "struct user".
/// Kernel virtual address of u-area.
pub ki_addr: *mut ::c_void,
// This is normally "struct vnode".
/// Pointer to trace file.
pub ki_tracep: *mut ::c_void,
// This is normally "struct vnode".
/// Pointer to executable file.
pub ki_textvp: *mut ::c_void,
// This is normally "struct filedesc".
/// Pointer to open file info.
pub ki_fd: *mut ::c_void,
// This is normally "struct vmspace".
/// Pointer to kernel vmspace struct.
pub ki_vmspace: *mut ::c_void,
/// Sleep address.
pub ki_wchan: *mut ::c_void,
/// Process identifier.
pub ki_pid: ::pid_t,
/// Parent process ID.
pub ki_ppid: ::pid_t,
/// Process group ID.
pub ki_pgid: ::pid_t,
/// tty process group ID.
pub ki_tpgid: ::pid_t,
/// Process session ID.
pub ki_sid: ::pid_t,
/// Terminal session ID.
pub ki_tsid: ::pid_t,
/// Job control counter.
pub ki_jobc: ::c_short,
/// Unused (just here for alignment).
pub ki_spare_short1: ::c_short,
/// Controlling tty dev.
pub ki_tdev_freebsd11: u32,
/// Signals arrived but not delivered.
pub ki_siglist: ::sigset_t,
/// Current signal mask.
pub ki_sigmask: ::sigset_t,
/// Signals being ignored.
pub ki_sigignore: ::sigset_t,
/// Signals being caught by user.
pub ki_sigcatch: ::sigset_t,
/// Effective user ID.
pub ki_uid: ::uid_t,
/// Real user ID.
pub ki_ruid: ::uid_t,
/// Saved effective user ID.
pub ki_svuid: ::uid_t,
/// Real group ID.
pub ki_rgid: ::gid_t,
/// Saved effective group ID.
pub ki_svgid: ::gid_t,
/// Number of groups.
pub ki_ngroups: ::c_short,
/// Unused (just here for alignment).
pub ki_spare_short2: ::c_short,
/// Groups.
pub ki_groups: [::gid_t; ::KI_NGROUPS],
/// Virtual size.
pub ki_size: ::vm_size_t,
/// Current resident set size in pages.
pub ki_rssize: ::segsz_t,
/// Resident set size before last swap.
pub ki_swrss: ::segsz_t,
/// Text size (pages) XXX.
pub ki_tsize: ::segsz_t,
/// Data size (pages) XXX.
pub ki_dsize: ::segsz_t,
/// Stack size (pages).
pub ki_ssize: ::segsz_t,
/// Exit status for wait & stop signal.
pub ki_xstat: ::u_short,
/// Accounting flags.
pub ki_acflag: ::u_short,
/// %cpu for process during `ki_swtime`.
pub ki_pctcpu: ::fixpt_t,
/// Time averaged value of `ki_cpticks`.
pub ki_estcpu: ::u_int,
/// Time since last blocked.
pub ki_slptime: ::u_int,
/// Time swapped in or out.
pub ki_swtime: ::u_int,
/// Number of copy-on-write faults.
pub ki_cow: ::u_int,
/// Real time in microsec.
pub ki_runtime: u64,
/// Starting time.
pub ki_start: ::timeval,
/// Time used by process children.
pub ki_childtime: ::timeval,
/// P_* flags.
pub ki_flag: ::c_long,
/// KI_* flags (below).
pub ki_kiflag: ::c_long,
/// Kernel trace points.
pub ki_traceflag: ::c_int,
/// S* process status.
pub ki_stat: ::c_char,
/// Process "nice" value.
pub ki_nice: i8, // signed char
/// Process lock (prevent swap) count.
pub ki_lock: ::c_char,
/// Run queue index.
pub ki_rqindex: ::c_char,
/// Which cpu we are on.
pub ki_oncpu_old: ::c_uchar,
/// Last cpu we were on.
pub ki_lastcpu_old: ::c_uchar,
/// Thread name.
pub ki_tdname: [::c_char; ::TDNAMLEN + 1],
/// Wchan message.
pub ki_wmesg: [::c_char; ::WMESGLEN + 1],
/// Setlogin name.
pub ki_login: [::c_char; ::LOGNAMELEN + 1],
/// Lock name.
pub ki_lockname: [::c_char; ::LOCKNAMELEN + 1],
/// Command name.
pub ki_comm: [::c_char; ::COMMLEN + 1],
/// Emulation name.
pub ki_emul: [::c_char; ::KI_EMULNAMELEN + 1],
/// Login class.
pub ki_loginclass: [::c_char; ::LOGINCLASSLEN + 1],
/// More thread name.
pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1],
/// Spare string space.
pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq
/// Spare room for growth.
pub ki_spareints: [::c_int; ::KI_NSPARE_INT],
/// Controlling tty dev.
pub ki_tdev: ::dev_t,
/// Which cpu we are on.
pub ki_oncpu: ::c_int,
/// Last cpu we were on.
pub ki_lastcpu: ::c_int,
/// PID of tracing process.
pub ki_tracer: ::c_int,
/// P2_* flags.
pub ki_flag2: ::c_int,
/// Default FIB number.
pub ki_fibnum: ::c_int,
/// Credential flags.
pub ki_cr_flags: ::u_int,
/// Process jail ID.
pub ki_jid: ::c_int,
/// Number of threads in total.
pub ki_numthreads: ::c_int,
/// Thread ID.
pub ki_tid: ::lwpid_t,
/// Process priority.
pub ki_pri: ::priority,
/// Process rusage statistics.
pub ki_rusage: ::rusage,
/// rusage of children processes.
pub ki_rusage_ch: ::rusage,
// This is normally "struct pcb".
/// Kernel virtual addr of pcb.
pub ki_pcb: *mut ::c_void,
/// Kernel virtual addr of stack.
pub ki_kstack: *mut ::c_void,
/// User convenience pointer.
pub ki_udata: *mut ::c_void,
// This is normally "struct thread".
pub ki_tdaddr: *mut ::c_void,
pub ki_spareptrs: [*mut ::c_void; ::KI_NSPARE_PTR],
pub ki_sparelongs: [::c_long; ::KI_NSPARE_LONG],
/// PS_* flags.
pub ki_sflag: ::c_long,
/// kthread flag.
pub ki_tdflags: ::c_long,
}
}
s_no_extra_traits! {
pub struct dirent {
pub d_fileno: ::ino_t,
pub d_off: ::off_t,
pub d_reclen: u16,
pub d_type: u8,
d_pad0: u8,
pub d_namlen: u16,
d_pad1: u16,
pub d_name: [::c_char; 256],
}
pub struct statfs {
pub f_version: u32,
pub f_type: u32,
pub f_flags: u64,
pub f_bsize: u64,
pub f_iosize: u64,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: i64,
pub f_files: u64,
pub f_ffree: i64,
pub f_syncwrites: u64,
pub f_asyncwrites: u64,
pub f_syncreads: u64,
pub f_asyncreads: u64,
f_spare: [u64; 10],
pub f_namemax: u32,
pub f_owner: ::uid_t,
pub f_fsid: ::fsid_t,
f_charspare: [::c_char; 80],
pub f_fstypename: [::c_char; 16],
pub f_mntfromname: [::c_char; 1024],
pub f_mntonname: [::c_char; 1024],
}
pub struct vnstat {
pub vn_fileid: u64,
pub vn_size: u64,
pub vn_dev: u64,
pub vn_fsid: u64,
pub vn_mntdir: *mut ::c_char,
pub vn_type: ::c_int,
pub vn_mode: u16,
pub vn_devname: [::c_char; ::SPECNAMELEN as usize + 1],
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for statfs {
fn eq(&self, other: &statfs) -> bool {
self.f_version == other.f_version
&& self.f_type == other.f_type
&& self.f_flags == other.f_flags
&& self.f_bsize == other.f_bsize
&& self.f_iosize == other.f_iosize
&& self.f_blocks == other.f_blocks
&& self.f_bfree == other.f_bfree
&& self.f_bavail == other.f_bavail
&& self.f_files == other.f_files
&& self.f_ffree == other.f_ffree
&& self.f_syncwrites == other.f_syncwrites
&& self.f_asyncwrites == other.f_asyncwrites
&& self.f_syncreads == other.f_syncreads
&& self.f_asyncreads == other.f_asyncreads
&& self.f_namemax == other.f_namemax
&& self.f_owner == other.f_owner
&& self.f_fsid == other.f_fsid
&& self.f_fstypename == other.f_fstypename
&& self
.f_mntfromname
.iter()
.zip(other.f_mntfromname.iter())
.all(|(a,b)| a == b)
&& self
.f_mntonname
.iter()
.zip(other.f_mntonname.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for statfs {}
impl ::fmt::Debug for statfs {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("statfs")
.field("f_bsize", &self.f_bsize)
.field("f_iosize", &self.f_iosize)
.field("f_blocks", &self.f_blocks)
.field("f_bfree", &self.f_bfree)
.field("f_bavail", &self.f_bavail)
.field("f_files", &self.f_files)
.field("f_ffree", &self.f_ffree)
.field("f_syncwrites", &self.f_syncwrites)
.field("f_asyncwrites", &self.f_asyncwrites)
.field("f_syncreads", &self.f_syncreads)
.field("f_asyncreads", &self.f_asyncreads)
.field("f_namemax", &self.f_namemax)
.field("f_owner", &self.f_owner)
.field("f_fsid", &self.f_fsid)
.field("f_fstypename", &self.f_fstypename)
.field("f_mntfromname", &&self.f_mntfromname[..])
.field("f_mntonname", &&self.f_mntonname[..])
.finish()
}
}
impl ::hash::Hash for statfs {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.f_version.hash(state);
self.f_type.hash(state);
self.f_flags.hash(state);
self.f_bsize.hash(state);
self.f_iosize.hash(state);
self.f_blocks.hash(state);
self.f_bfree.hash(state);
self.f_bavail.hash(state);
self.f_files.hash(state);
self.f_ffree.hash(state);
self.f_syncwrites.hash(state);
self.f_asyncwrites.hash(state);
self.f_syncreads.hash(state);
self.f_asyncreads.hash(state);
self.f_namemax.hash(state);
self.f_owner.hash(state);
self.f_fsid.hash(state);
self.f_charspare.hash(state);
self.f_fstypename.hash(state);
self.f_mntfromname.hash(state);
self.f_mntonname.hash(state);
}
}
impl PartialEq for dirent {
fn eq(&self, other: &dirent) -> bool {
self.d_fileno == other.d_fileno
&& self.d_off == other.d_off
&& self.d_reclen == other.d_reclen
&& self.d_type == other.d_type
&& self.d_namlen == other.d_namlen
&& self
.d_name[..self.d_namlen as _]
.iter()
.zip(other.d_name.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for dirent {}
impl ::fmt::Debug for dirent {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("dirent")
.field("d_fileno", &self.d_fileno)
.field("d_off", &self.d_off)
.field("d_reclen", &self.d_reclen)
.field("d_type", &self.d_type)
.field("d_namlen", &self.d_namlen)
.field("d_name", &&self.d_name[..self.d_namlen as _])
.finish()
}
}
impl ::hash::Hash for dirent {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.d_fileno.hash(state);
self.d_off.hash(state);
self.d_reclen.hash(state);
self.d_type.hash(state);
self.d_namlen.hash(state);
self.d_name[..self.d_namlen as _].hash(state);
}
}
impl PartialEq for vnstat {
fn eq(&self, other: &vnstat) -> bool {
let self_vn_devname: &[::c_char] = &self.vn_devname;
let other_vn_devname: &[::c_char] = &other.vn_devname;
self.vn_fileid == other.vn_fileid &&
self.vn_size == other.vn_size &&
self.vn_dev == other.vn_dev &&
self.vn_fsid == other.vn_fsid &&
self.vn_mntdir == other.vn_mntdir &&
self.vn_type == other.vn_type &&
self.vn_mode == other.vn_mode &&
self_vn_devname == other_vn_devname
}
}
impl Eq for vnstat {}
impl ::fmt::Debug for vnstat {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
let self_vn_devname: &[::c_char] = &self.vn_devname;
f.debug_struct("vnstat")
.field("vn_fileid", &self.vn_fileid)
.field("vn_size", &self.vn_size)
.field("vn_dev", &self.vn_dev)
.field("vn_fsid", &self.vn_fsid)
.field("vn_mntdir", &self.vn_mntdir)
.field("vn_type", &self.vn_type)
.field("vn_mode", &self.vn_mode)
.field("vn_devname", &self_vn_devname)
.finish()
}
}
impl ::hash::Hash for vnstat {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
let self_vn_devname: &[::c_char] = &self.vn_devname;
self.vn_fileid.hash(state);
self.vn_size.hash(state);
self.vn_dev.hash(state);
self.vn_fsid.hash(state);
self.vn_mntdir.hash(state);
self.vn_type.hash(state);
self.vn_mode.hash(state);
self_vn_devname.hash(state);
}
}
}
}
pub const RAND_MAX: ::c_int = 0x7fff_fffd;
pub const ELAST: ::c_int = 97;
/// max length of devicename
pub const SPECNAMELEN: ::c_int = 63;
pub const KI_NSPARE_PTR: usize = 6;
pub const MINCORE_SUPER: ::c_int = 0x20;
safe_f! {
pub {const} fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
let major = major as ::dev_t;
let minor = minor as ::dev_t;
let mut dev = 0;
dev |= ((major & 0xffffff00) as dev_t) << 32;
dev |= ((major & 0x000000ff) as dev_t) << 8;
dev |= ((minor & 0x0000ff00) as dev_t) << 24;
dev |= ((minor & 0xffff00ff) as dev_t) << 0;
dev
}
}
f! {
pub fn major(dev: ::dev_t) -> ::c_int {
(((dev >> 32) & 0xffffff00) | ((dev >> 8) & 0xff)) as ::c_int
}
pub fn minor(dev: ::dev_t) -> ::c_int {
(((dev >> 24) & 0xff00) | (dev & 0xffff00ff)) as ::c_int
}
}
extern "C" {
pub fn setgrent();
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
pub fn freelocale(loc: ::locale_t);
pub fn msgrcv(
msqid: ::c_int,
msgp: *mut ::c_void,
msgsz: ::size_t,
msgtyp: ::c_long,
msgflg: ::c_int,
) -> ::ssize_t;
pub fn dirname(path: *mut ::c_char) -> *mut ::c_char;
pub fn basename(path: *mut ::c_char) -> *mut ::c_char;
}
cfg_if! {
if #[cfg(any(target_arch = "x86_64",
target_arch = "aarch64",
target_arch = "riscv64"))] {
mod b64;
pub use self::b64::*;
}
}
cfg_if! {
if #[cfg(target_arch = "x86_64")] {
mod x86_64;
pub use self::x86_64::*;
}
}

View file

@ -0,0 +1,5 @@
pub const PROC_KPTI_CTL: ::c_int = ::PROC_PROCCTL_MD_MIN;
pub const PROC_KPTI_CTL_ENABLE_ON_EXEC: ::c_int = 1;
pub const PROC_KPTI_CTL_DISABLE_ON_EXEC: ::c_int = 2;
pub const PROC_KPTI_STATUS: ::c_int = ::PROC_PROCCTL_MD_MIN + 1;
pub const PROC_KPTI_STATUS_ACTIVE: ::c_int = 0x80000000;

View file

@ -0,0 +1,34 @@
#[repr(C)]
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_nlink: ::nlink_t,
pub st_mode: ::mode_t,
st_padding0: i16,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
st_padding1: i32,
pub st_rdev: ::dev_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
pub st_size: ::off_t,
pub st_blocks: ::blkcnt_t,
pub st_blksize: ::blksize_t,
pub st_flags: ::fflags_t,
pub st_gen: u64,
pub st_spare: [u64; 10],
}
impl ::Copy for ::stat {}
impl ::Clone for ::stat {
fn clone(&self) -> ::stat {
*self
}
}

View file

@ -0,0 +1,546 @@
// APIs in FreeBSD 13 that have changed since 11.
pub type nlink_t = u64;
pub type dev_t = u64;
pub type ino_t = ::c_ulong;
pub type shmatt_t = ::c_uint;
pub type kpaddr_t = u64;
pub type kssize_t = i64;
pub type domainset_t = __c_anonymous_domainset;
s! {
pub struct shmid_ds {
pub shm_perm: ::ipc_perm,
pub shm_segsz: ::size_t,
pub shm_lpid: ::pid_t,
pub shm_cpid: ::pid_t,
pub shm_nattch: ::shmatt_t,
pub shm_atime: ::time_t,
pub shm_dtime: ::time_t,
pub shm_ctime: ::time_t,
}
pub struct kevent {
pub ident: ::uintptr_t,
pub filter: ::c_short,
pub flags: ::c_ushort,
pub fflags: ::c_uint,
pub data: i64,
pub udata: *mut ::c_void,
pub ext: [u64; 4],
}
pub struct kvm_page {
pub kp_version: ::u_int,
pub kp_paddr: ::kpaddr_t,
pub kp_kmap_vaddr: ::kvaddr_t,
pub kp_dmap_vaddr: ::kvaddr_t,
pub kp_prot: ::vm_prot_t,
pub kp_offset: ::off_t,
pub kp_len: ::size_t,
}
pub struct __c_anonymous_domainset {
_priv: [::uintptr_t; 4],
}
pub struct kinfo_proc {
/// Size of this structure.
pub ki_structsize: ::c_int,
/// Reserved: layout identifier.
pub ki_layout: ::c_int,
/// Address of command arguments.
pub ki_args: *mut ::pargs,
// This is normally "struct proc".
/// Address of proc.
pub ki_paddr: *mut ::c_void,
// This is normally "struct user".
/// Kernel virtual address of u-area.
pub ki_addr: *mut ::c_void,
// This is normally "struct vnode".
/// Pointer to trace file.
pub ki_tracep: *mut ::c_void,
// This is normally "struct vnode".
/// Pointer to executable file.
pub ki_textvp: *mut ::c_void,
// This is normally "struct filedesc".
/// Pointer to open file info.
pub ki_fd: *mut ::c_void,
// This is normally "struct vmspace".
/// Pointer to kernel vmspace struct.
pub ki_vmspace: *mut ::c_void,
/// Sleep address.
pub ki_wchan: *const ::c_void,
/// Process identifier.
pub ki_pid: ::pid_t,
/// Parent process ID.
pub ki_ppid: ::pid_t,
/// Process group ID.
pub ki_pgid: ::pid_t,
/// tty process group ID.
pub ki_tpgid: ::pid_t,
/// Process session ID.
pub ki_sid: ::pid_t,
/// Terminal session ID.
pub ki_tsid: ::pid_t,
/// Job control counter.
pub ki_jobc: ::c_short,
/// Unused (just here for alignment).
pub ki_spare_short1: ::c_short,
/// Controlling tty dev.
pub ki_tdev_freebsd11: u32,
/// Signals arrived but not delivered.
pub ki_siglist: ::sigset_t,
/// Current signal mask.
pub ki_sigmask: ::sigset_t,
/// Signals being ignored.
pub ki_sigignore: ::sigset_t,
/// Signals being caught by user.
pub ki_sigcatch: ::sigset_t,
/// Effective user ID.
pub ki_uid: ::uid_t,
/// Real user ID.
pub ki_ruid: ::uid_t,
/// Saved effective user ID.
pub ki_svuid: ::uid_t,
/// Real group ID.
pub ki_rgid: ::gid_t,
/// Saved effective group ID.
pub ki_svgid: ::gid_t,
/// Number of groups.
pub ki_ngroups: ::c_short,
/// Unused (just here for alignment).
pub ki_spare_short2: ::c_short,
/// Groups.
pub ki_groups: [::gid_t; ::KI_NGROUPS],
/// Virtual size.
pub ki_size: ::vm_size_t,
/// Current resident set size in pages.
pub ki_rssize: ::segsz_t,
/// Resident set size before last swap.
pub ki_swrss: ::segsz_t,
/// Text size (pages) XXX.
pub ki_tsize: ::segsz_t,
/// Data size (pages) XXX.
pub ki_dsize: ::segsz_t,
/// Stack size (pages).
pub ki_ssize: ::segsz_t,
/// Exit status for wait & stop signal.
pub ki_xstat: ::u_short,
/// Accounting flags.
pub ki_acflag: ::u_short,
/// %cpu for process during `ki_swtime`.
pub ki_pctcpu: ::fixpt_t,
/// Time averaged value of `ki_cpticks`.
pub ki_estcpu: ::u_int,
/// Time since last blocked.
pub ki_slptime: ::u_int,
/// Time swapped in or out.
pub ki_swtime: ::u_int,
/// Number of copy-on-write faults.
pub ki_cow: ::u_int,
/// Real time in microsec.
pub ki_runtime: u64,
/// Starting time.
pub ki_start: ::timeval,
/// Time used by process children.
pub ki_childtime: ::timeval,
/// P_* flags.
pub ki_flag: ::c_long,
/// KI_* flags (below).
pub ki_kiflag: ::c_long,
/// Kernel trace points.
pub ki_traceflag: ::c_int,
/// S* process status.
pub ki_stat: ::c_char,
/// Process "nice" value.
pub ki_nice: i8, // signed char
/// Process lock (prevent swap) count.
pub ki_lock: ::c_char,
/// Run queue index.
pub ki_rqindex: ::c_char,
/// Which cpu we are on.
pub ki_oncpu_old: ::c_uchar,
/// Last cpu we were on.
pub ki_lastcpu_old: ::c_uchar,
/// Thread name.
pub ki_tdname: [::c_char; ::TDNAMLEN + 1],
/// Wchan message.
pub ki_wmesg: [::c_char; ::WMESGLEN + 1],
/// Setlogin name.
pub ki_login: [::c_char; ::LOGNAMELEN + 1],
/// Lock name.
pub ki_lockname: [::c_char; ::LOCKNAMELEN + 1],
/// Command name.
pub ki_comm: [::c_char; ::COMMLEN + 1],
/// Emulation name.
pub ki_emul: [::c_char; ::KI_EMULNAMELEN + 1],
/// Login class.
pub ki_loginclass: [::c_char; ::LOGINCLASSLEN + 1],
/// More thread name.
pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1],
/// Spare string space.
pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq
/// Spare room for growth.
pub ki_spareints: [::c_int; ::KI_NSPARE_INT],
/// Controlling tty dev.
pub ki_tdev: u64,
/// Which cpu we are on.
pub ki_oncpu: ::c_int,
/// Last cpu we were on.
pub ki_lastcpu: ::c_int,
/// PID of tracing process.
pub ki_tracer: ::c_int,
/// P2_* flags.
pub ki_flag2: ::c_int,
/// Default FIB number.
pub ki_fibnum: ::c_int,
/// Credential flags.
pub ki_cr_flags: ::u_int,
/// Process jail ID.
pub ki_jid: ::c_int,
/// Number of threads in total.
pub ki_numthreads: ::c_int,
/// Thread ID.
pub ki_tid: ::lwpid_t,
/// Process priority.
pub ki_pri: ::priority,
/// Process rusage statistics.
pub ki_rusage: ::rusage,
/// rusage of children processes.
pub ki_rusage_ch: ::rusage,
// This is normally "struct pcb".
/// Kernel virtual addr of pcb.
pub ki_pcb: *mut ::c_void,
/// Kernel virtual addr of stack.
pub ki_kstack: *mut ::c_void,
/// User convenience pointer.
pub ki_udata: *mut ::c_void,
// This is normally "struct thread".
pub ki_tdaddr: *mut ::c_void,
// This is normally "struct pwddesc".
/// Pointer to process paths info.
pub ki_pd: *mut ::c_void,
pub ki_spareptrs: [*mut ::c_void; ::KI_NSPARE_PTR],
pub ki_sparelongs: [::c_long; ::KI_NSPARE_LONG],
/// PS_* flags.
pub ki_sflag: ::c_long,
/// kthread flag.
pub ki_tdflags: ::c_long,
}
}
s_no_extra_traits! {
pub struct dirent {
pub d_fileno: ::ino_t,
pub d_off: ::off_t,
pub d_reclen: u16,
pub d_type: u8,
d_pad0: u8,
pub d_namlen: u16,
d_pad1: u16,
pub d_name: [::c_char; 256],
}
pub struct statfs {
pub f_version: u32,
pub f_type: u32,
pub f_flags: u64,
pub f_bsize: u64,
pub f_iosize: u64,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: i64,
pub f_files: u64,
pub f_ffree: i64,
pub f_syncwrites: u64,
pub f_asyncwrites: u64,
pub f_syncreads: u64,
pub f_asyncreads: u64,
f_spare: [u64; 10],
pub f_namemax: u32,
pub f_owner: ::uid_t,
pub f_fsid: ::fsid_t,
f_charspare: [::c_char; 80],
pub f_fstypename: [::c_char; 16],
pub f_mntfromname: [::c_char; 1024],
pub f_mntonname: [::c_char; 1024],
}
pub struct vnstat {
pub vn_fileid: u64,
pub vn_size: u64,
pub vn_dev: u64,
pub vn_fsid: u64,
pub vn_mntdir: *mut ::c_char,
pub vn_type: ::c_int,
pub vn_mode: u16,
pub vn_devname: [::c_char; ::SPECNAMELEN as usize + 1],
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for statfs {
fn eq(&self, other: &statfs) -> bool {
self.f_version == other.f_version
&& self.f_type == other.f_type
&& self.f_flags == other.f_flags
&& self.f_bsize == other.f_bsize
&& self.f_iosize == other.f_iosize
&& self.f_blocks == other.f_blocks
&& self.f_bfree == other.f_bfree
&& self.f_bavail == other.f_bavail
&& self.f_files == other.f_files
&& self.f_ffree == other.f_ffree
&& self.f_syncwrites == other.f_syncwrites
&& self.f_asyncwrites == other.f_asyncwrites
&& self.f_syncreads == other.f_syncreads
&& self.f_asyncreads == other.f_asyncreads
&& self.f_namemax == other.f_namemax
&& self.f_owner == other.f_owner
&& self.f_fsid == other.f_fsid
&& self.f_fstypename == other.f_fstypename
&& self
.f_mntfromname
.iter()
.zip(other.f_mntfromname.iter())
.all(|(a,b)| a == b)
&& self
.f_mntonname
.iter()
.zip(other.f_mntonname.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for statfs {}
impl ::fmt::Debug for statfs {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("statfs")
.field("f_bsize", &self.f_bsize)
.field("f_iosize", &self.f_iosize)
.field("f_blocks", &self.f_blocks)
.field("f_bfree", &self.f_bfree)
.field("f_bavail", &self.f_bavail)
.field("f_files", &self.f_files)
.field("f_ffree", &self.f_ffree)
.field("f_syncwrites", &self.f_syncwrites)
.field("f_asyncwrites", &self.f_asyncwrites)
.field("f_syncreads", &self.f_syncreads)
.field("f_asyncreads", &self.f_asyncreads)
.field("f_namemax", &self.f_namemax)
.field("f_owner", &self.f_owner)
.field("f_fsid", &self.f_fsid)
.field("f_fstypename", &self.f_fstypename)
.field("f_mntfromname", &&self.f_mntfromname[..])
.field("f_mntonname", &&self.f_mntonname[..])
.finish()
}
}
impl ::hash::Hash for statfs {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.f_version.hash(state);
self.f_type.hash(state);
self.f_flags.hash(state);
self.f_bsize.hash(state);
self.f_iosize.hash(state);
self.f_blocks.hash(state);
self.f_bfree.hash(state);
self.f_bavail.hash(state);
self.f_files.hash(state);
self.f_ffree.hash(state);
self.f_syncwrites.hash(state);
self.f_asyncwrites.hash(state);
self.f_syncreads.hash(state);
self.f_asyncreads.hash(state);
self.f_namemax.hash(state);
self.f_owner.hash(state);
self.f_fsid.hash(state);
self.f_charspare.hash(state);
self.f_fstypename.hash(state);
self.f_mntfromname.hash(state);
self.f_mntonname.hash(state);
}
}
impl PartialEq for dirent {
fn eq(&self, other: &dirent) -> bool {
self.d_fileno == other.d_fileno
&& self.d_off == other.d_off
&& self.d_reclen == other.d_reclen
&& self.d_type == other.d_type
&& self.d_namlen == other.d_namlen
&& self
.d_name[..self.d_namlen as _]
.iter()
.zip(other.d_name.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for dirent {}
impl ::fmt::Debug for dirent {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("dirent")
.field("d_fileno", &self.d_fileno)
.field("d_off", &self.d_off)
.field("d_reclen", &self.d_reclen)
.field("d_type", &self.d_type)
.field("d_namlen", &self.d_namlen)
.field("d_name", &&self.d_name[..self.d_namlen as _])
.finish()
}
}
impl ::hash::Hash for dirent {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.d_fileno.hash(state);
self.d_off.hash(state);
self.d_reclen.hash(state);
self.d_type.hash(state);
self.d_namlen.hash(state);
self.d_name[..self.d_namlen as _].hash(state);
}
}
impl PartialEq for vnstat {
fn eq(&self, other: &vnstat) -> bool {
let self_vn_devname: &[::c_char] = &self.vn_devname;
let other_vn_devname: &[::c_char] = &other.vn_devname;
self.vn_fileid == other.vn_fileid &&
self.vn_size == other.vn_size &&
self.vn_dev == other.vn_dev &&
self.vn_fsid == other.vn_fsid &&
self.vn_mntdir == other.vn_mntdir &&
self.vn_type == other.vn_type &&
self.vn_mode == other.vn_mode &&
self_vn_devname == other_vn_devname
}
}
impl Eq for vnstat {}
impl ::fmt::Debug for vnstat {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
let self_vn_devname: &[::c_char] = &self.vn_devname;
f.debug_struct("vnstat")
.field("vn_fileid", &self.vn_fileid)
.field("vn_size", &self.vn_size)
.field("vn_dev", &self.vn_dev)
.field("vn_fsid", &self.vn_fsid)
.field("vn_mntdir", &self.vn_mntdir)
.field("vn_type", &self.vn_type)
.field("vn_mode", &self.vn_mode)
.field("vn_devname", &self_vn_devname)
.finish()
}
}
impl ::hash::Hash for vnstat {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
let self_vn_devname: &[::c_char] = &self.vn_devname;
self.vn_fileid.hash(state);
self.vn_size.hash(state);
self.vn_dev.hash(state);
self.vn_fsid.hash(state);
self.vn_mntdir.hash(state);
self.vn_type.hash(state);
self.vn_mode.hash(state);
self_vn_devname.hash(state);
}
}
}
}
pub const RAND_MAX: ::c_int = 0x7fff_ffff;
pub const ELAST: ::c_int = 97;
pub const KF_TYPE_EVENTFD: ::c_int = 13;
/// max length of devicename
pub const SPECNAMELEN: ::c_int = 255;
pub const KI_NSPARE_PTR: usize = 5;
/// domainset policies
pub const DOMAINSET_POLICY_INVALID: ::c_int = 0;
pub const DOMAINSET_POLICY_ROUNDROBIN: ::c_int = 1;
pub const DOMAINSET_POLICY_FIRSTTOUCH: ::c_int = 2;
pub const DOMAINSET_POLICY_PREFER: ::c_int = 3;
pub const DOMAINSET_POLICY_INTERLEAVE: ::c_int = 4;
pub const MINCORE_SUPER: ::c_int = 0x20;
safe_f! {
pub {const} fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
let major = major as ::dev_t;
let minor = minor as ::dev_t;
let mut dev = 0;
dev |= ((major & 0xffffff00) as dev_t) << 32;
dev |= ((major & 0x000000ff) as dev_t) << 8;
dev |= ((minor & 0x0000ff00) as dev_t) << 24;
dev |= ((minor & 0xffff00ff) as dev_t) << 0;
dev
}
}
f! {
pub fn major(dev: ::dev_t) -> ::c_int {
(((dev >> 32) & 0xffffff00) | ((dev >> 8) & 0xff)) as ::c_int
}
pub fn minor(dev: ::dev_t) -> ::c_int {
(((dev >> 24) & 0xff00) | (dev & 0xffff00ff)) as ::c_int
}
}
extern "C" {
pub fn setgrent();
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
pub fn freelocale(loc: ::locale_t);
pub fn msgrcv(
msqid: ::c_int,
msgp: *mut ::c_void,
msgsz: ::size_t,
msgtyp: ::c_long,
msgflg: ::c_int,
) -> ::ssize_t;
pub fn cpuset_getdomain(
level: ::cpulevel_t,
which: ::cpuwhich_t,
id: ::id_t,
setsize: ::size_t,
mask: *mut ::domainset_t,
policy: *mut ::c_int,
) -> ::c_int;
pub fn cpuset_setdomain(
level: ::cpulevel_t,
which: ::cpuwhich_t,
id: ::id_t,
setsize: ::size_t,
mask: *const ::domainset_t,
policy: ::c_int,
) -> ::c_int;
pub fn dirname(path: *mut ::c_char) -> *mut ::c_char;
pub fn basename(path: *mut ::c_char) -> *mut ::c_char;
}
#[link(name = "kvm")]
extern "C" {
pub fn kvm_kerndisp(kd: *mut ::kvm_t) -> ::kssize_t;
}
cfg_if! {
if #[cfg(any(target_arch = "x86_64",
target_arch = "aarch64",
target_arch = "riscv64"))] {
mod b64;
pub use self::b64::*;
}
}
cfg_if! {
if #[cfg(target_arch = "x86_64")] {
mod x86_64;
pub use self::x86_64::*;
}
}

View file

@ -0,0 +1,5 @@
pub const PROC_KPTI_CTL: ::c_int = ::PROC_PROCCTL_MD_MIN;
pub const PROC_KPTI_CTL_ENABLE_ON_EXEC: ::c_int = 1;
pub const PROC_KPTI_CTL_DISABLE_ON_EXEC: ::c_int = 2;
pub const PROC_KPTI_STATUS: ::c_int = ::PROC_PROCCTL_MD_MIN + 1;
pub const PROC_KPTI_STATUS_ACTIVE: ::c_int = 0x80000000;

View file

@ -0,0 +1,34 @@
#[repr(C)]
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_nlink: ::nlink_t,
pub st_mode: ::mode_t,
st_padding0: i16,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
st_padding1: i32,
pub st_rdev: ::dev_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
pub st_size: ::off_t,
pub st_blocks: ::blkcnt_t,
pub st_blksize: ::blksize_t,
pub st_flags: ::fflags_t,
pub st_gen: u64,
pub st_spare: [u64; 10],
}
impl ::Copy for ::stat {}
impl ::Clone for ::stat {
fn clone(&self) -> ::stat {
*self
}
}

View file

@ -0,0 +1,546 @@
// APIs in FreeBSD 14 that have changed since 11.
pub type nlink_t = u64;
pub type dev_t = u64;
pub type ino_t = ::c_ulong;
pub type shmatt_t = ::c_uint;
pub type kpaddr_t = u64;
pub type kssize_t = i64;
pub type domainset_t = __c_anonymous_domainset;
s! {
pub struct shmid_ds {
pub shm_perm: ::ipc_perm,
pub shm_segsz: ::size_t,
pub shm_lpid: ::pid_t,
pub shm_cpid: ::pid_t,
pub shm_nattch: ::shmatt_t,
pub shm_atime: ::time_t,
pub shm_dtime: ::time_t,
pub shm_ctime: ::time_t,
}
pub struct kevent {
pub ident: ::uintptr_t,
pub filter: ::c_short,
pub flags: ::c_ushort,
pub fflags: ::c_uint,
pub data: i64,
pub udata: *mut ::c_void,
pub ext: [u64; 4],
}
pub struct kvm_page {
pub kp_version: ::u_int,
pub kp_paddr: ::kpaddr_t,
pub kp_kmap_vaddr: ::kvaddr_t,
pub kp_dmap_vaddr: ::kvaddr_t,
pub kp_prot: ::vm_prot_t,
pub kp_offset: ::off_t,
pub kp_len: ::size_t,
}
pub struct __c_anonymous_domainset {
_priv: [::uintptr_t; 4],
}
pub struct kinfo_proc {
/// Size of this structure.
pub ki_structsize: ::c_int,
/// Reserved: layout identifier.
pub ki_layout: ::c_int,
/// Address of command arguments.
pub ki_args: *mut ::pargs,
// This is normally "struct proc".
/// Address of proc.
pub ki_paddr: *mut ::c_void,
// This is normally "struct user".
/// Kernel virtual address of u-area.
pub ki_addr: *mut ::c_void,
// This is normally "struct vnode".
/// Pointer to trace file.
pub ki_tracep: *mut ::c_void,
// This is normally "struct vnode".
/// Pointer to executable file.
pub ki_textvp: *mut ::c_void,
// This is normally "struct filedesc".
/// Pointer to open file info.
pub ki_fd: *mut ::c_void,
// This is normally "struct vmspace".
/// Pointer to kernel vmspace struct.
pub ki_vmspace: *mut ::c_void,
/// Sleep address.
pub ki_wchan: *const ::c_void,
/// Process identifier.
pub ki_pid: ::pid_t,
/// Parent process ID.
pub ki_ppid: ::pid_t,
/// Process group ID.
pub ki_pgid: ::pid_t,
/// tty process group ID.
pub ki_tpgid: ::pid_t,
/// Process session ID.
pub ki_sid: ::pid_t,
/// Terminal session ID.
pub ki_tsid: ::pid_t,
/// Job control counter.
pub ki_jobc: ::c_short,
/// Unused (just here for alignment).
pub ki_spare_short1: ::c_short,
/// Controlling tty dev.
pub ki_tdev_freebsd11: u32,
/// Signals arrived but not delivered.
pub ki_siglist: ::sigset_t,
/// Current signal mask.
pub ki_sigmask: ::sigset_t,
/// Signals being ignored.
pub ki_sigignore: ::sigset_t,
/// Signals being caught by user.
pub ki_sigcatch: ::sigset_t,
/// Effective user ID.
pub ki_uid: ::uid_t,
/// Real user ID.
pub ki_ruid: ::uid_t,
/// Saved effective user ID.
pub ki_svuid: ::uid_t,
/// Real group ID.
pub ki_rgid: ::gid_t,
/// Saved effective group ID.
pub ki_svgid: ::gid_t,
/// Number of groups.
pub ki_ngroups: ::c_short,
/// Unused (just here for alignment).
pub ki_spare_short2: ::c_short,
/// Groups.
pub ki_groups: [::gid_t; ::KI_NGROUPS],
/// Virtual size.
pub ki_size: ::vm_size_t,
/// Current resident set size in pages.
pub ki_rssize: ::segsz_t,
/// Resident set size before last swap.
pub ki_swrss: ::segsz_t,
/// Text size (pages) XXX.
pub ki_tsize: ::segsz_t,
/// Data size (pages) XXX.
pub ki_dsize: ::segsz_t,
/// Stack size (pages).
pub ki_ssize: ::segsz_t,
/// Exit status for wait & stop signal.
pub ki_xstat: ::u_short,
/// Accounting flags.
pub ki_acflag: ::u_short,
/// %cpu for process during `ki_swtime`.
pub ki_pctcpu: ::fixpt_t,
/// Time averaged value of `ki_cpticks`.
pub ki_estcpu: ::u_int,
/// Time since last blocked.
pub ki_slptime: ::u_int,
/// Time swapped in or out.
pub ki_swtime: ::u_int,
/// Number of copy-on-write faults.
pub ki_cow: ::u_int,
/// Real time in microsec.
pub ki_runtime: u64,
/// Starting time.
pub ki_start: ::timeval,
/// Time used by process children.
pub ki_childtime: ::timeval,
/// P_* flags.
pub ki_flag: ::c_long,
/// KI_* flags (below).
pub ki_kiflag: ::c_long,
/// Kernel trace points.
pub ki_traceflag: ::c_int,
/// S* process status.
pub ki_stat: ::c_char,
/// Process "nice" value.
pub ki_nice: i8, // signed char
/// Process lock (prevent swap) count.
pub ki_lock: ::c_char,
/// Run queue index.
pub ki_rqindex: ::c_char,
/// Which cpu we are on.
pub ki_oncpu_old: ::c_uchar,
/// Last cpu we were on.
pub ki_lastcpu_old: ::c_uchar,
/// Thread name.
pub ki_tdname: [::c_char; ::TDNAMLEN + 1],
/// Wchan message.
pub ki_wmesg: [::c_char; ::WMESGLEN + 1],
/// Setlogin name.
pub ki_login: [::c_char; ::LOGNAMELEN + 1],
/// Lock name.
pub ki_lockname: [::c_char; ::LOCKNAMELEN + 1],
/// Command name.
pub ki_comm: [::c_char; ::COMMLEN + 1],
/// Emulation name.
pub ki_emul: [::c_char; ::KI_EMULNAMELEN + 1],
/// Login class.
pub ki_loginclass: [::c_char; ::LOGINCLASSLEN + 1],
/// More thread name.
pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1],
/// Spare string space.
pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq
/// Spare room for growth.
pub ki_spareints: [::c_int; ::KI_NSPARE_INT],
/// Controlling tty dev.
pub ki_tdev: u64,
/// Which cpu we are on.
pub ki_oncpu: ::c_int,
/// Last cpu we were on.
pub ki_lastcpu: ::c_int,
/// PID of tracing process.
pub ki_tracer: ::c_int,
/// P2_* flags.
pub ki_flag2: ::c_int,
/// Default FIB number.
pub ki_fibnum: ::c_int,
/// Credential flags.
pub ki_cr_flags: ::u_int,
/// Process jail ID.
pub ki_jid: ::c_int,
/// Number of threads in total.
pub ki_numthreads: ::c_int,
/// Thread ID.
pub ki_tid: ::lwpid_t,
/// Process priority.
pub ki_pri: ::priority,
/// Process rusage statistics.
pub ki_rusage: ::rusage,
/// rusage of children processes.
pub ki_rusage_ch: ::rusage,
// This is normally "struct pcb".
/// Kernel virtual addr of pcb.
pub ki_pcb: *mut ::c_void,
/// Kernel virtual addr of stack.
pub ki_kstack: *mut ::c_void,
/// User convenience pointer.
pub ki_udata: *mut ::c_void,
// This is normally "struct thread".
pub ki_tdaddr: *mut ::c_void,
// This is normally "struct pwddesc".
/// Pointer to process paths info.
pub ki_pd: *mut ::c_void,
pub ki_spareptrs: [*mut ::c_void; ::KI_NSPARE_PTR],
pub ki_sparelongs: [::c_long; ::KI_NSPARE_LONG],
/// PS_* flags.
pub ki_sflag: ::c_long,
/// kthread flag.
pub ki_tdflags: ::c_long,
}
}
s_no_extra_traits! {
pub struct dirent {
pub d_fileno: ::ino_t,
pub d_off: ::off_t,
pub d_reclen: u16,
pub d_type: u8,
d_pad0: u8,
pub d_namlen: u16,
d_pad1: u16,
pub d_name: [::c_char; 256],
}
pub struct statfs {
pub f_version: u32,
pub f_type: u32,
pub f_flags: u64,
pub f_bsize: u64,
pub f_iosize: u64,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: i64,
pub f_files: u64,
pub f_ffree: i64,
pub f_syncwrites: u64,
pub f_asyncwrites: u64,
pub f_syncreads: u64,
pub f_asyncreads: u64,
f_spare: [u64; 10],
pub f_namemax: u32,
pub f_owner: ::uid_t,
pub f_fsid: ::fsid_t,
f_charspare: [::c_char; 80],
pub f_fstypename: [::c_char; 16],
pub f_mntfromname: [::c_char; 1024],
pub f_mntonname: [::c_char; 1024],
}
pub struct vnstat {
pub vn_fileid: u64,
pub vn_size: u64,
pub vn_dev: u64,
pub vn_fsid: u64,
pub vn_mntdir: *mut ::c_char,
pub vn_type: ::c_int,
pub vn_mode: u16,
pub vn_devname: [::c_char; ::SPECNAMELEN as usize + 1],
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for statfs {
fn eq(&self, other: &statfs) -> bool {
self.f_version == other.f_version
&& self.f_type == other.f_type
&& self.f_flags == other.f_flags
&& self.f_bsize == other.f_bsize
&& self.f_iosize == other.f_iosize
&& self.f_blocks == other.f_blocks
&& self.f_bfree == other.f_bfree
&& self.f_bavail == other.f_bavail
&& self.f_files == other.f_files
&& self.f_ffree == other.f_ffree
&& self.f_syncwrites == other.f_syncwrites
&& self.f_asyncwrites == other.f_asyncwrites
&& self.f_syncreads == other.f_syncreads
&& self.f_asyncreads == other.f_asyncreads
&& self.f_namemax == other.f_namemax
&& self.f_owner == other.f_owner
&& self.f_fsid == other.f_fsid
&& self.f_fstypename == other.f_fstypename
&& self
.f_mntfromname
.iter()
.zip(other.f_mntfromname.iter())
.all(|(a,b)| a == b)
&& self
.f_mntonname
.iter()
.zip(other.f_mntonname.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for statfs {}
impl ::fmt::Debug for statfs {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("statfs")
.field("f_bsize", &self.f_bsize)
.field("f_iosize", &self.f_iosize)
.field("f_blocks", &self.f_blocks)
.field("f_bfree", &self.f_bfree)
.field("f_bavail", &self.f_bavail)
.field("f_files", &self.f_files)
.field("f_ffree", &self.f_ffree)
.field("f_syncwrites", &self.f_syncwrites)
.field("f_asyncwrites", &self.f_asyncwrites)
.field("f_syncreads", &self.f_syncreads)
.field("f_asyncreads", &self.f_asyncreads)
.field("f_namemax", &self.f_namemax)
.field("f_owner", &self.f_owner)
.field("f_fsid", &self.f_fsid)
.field("f_fstypename", &self.f_fstypename)
.field("f_mntfromname", &&self.f_mntfromname[..])
.field("f_mntonname", &&self.f_mntonname[..])
.finish()
}
}
impl ::hash::Hash for statfs {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.f_version.hash(state);
self.f_type.hash(state);
self.f_flags.hash(state);
self.f_bsize.hash(state);
self.f_iosize.hash(state);
self.f_blocks.hash(state);
self.f_bfree.hash(state);
self.f_bavail.hash(state);
self.f_files.hash(state);
self.f_ffree.hash(state);
self.f_syncwrites.hash(state);
self.f_asyncwrites.hash(state);
self.f_syncreads.hash(state);
self.f_asyncreads.hash(state);
self.f_namemax.hash(state);
self.f_owner.hash(state);
self.f_fsid.hash(state);
self.f_charspare.hash(state);
self.f_fstypename.hash(state);
self.f_mntfromname.hash(state);
self.f_mntonname.hash(state);
}
}
impl PartialEq for dirent {
fn eq(&self, other: &dirent) -> bool {
self.d_fileno == other.d_fileno
&& self.d_off == other.d_off
&& self.d_reclen == other.d_reclen
&& self.d_type == other.d_type
&& self.d_namlen == other.d_namlen
&& self
.d_name[..self.d_namlen as _]
.iter()
.zip(other.d_name.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for dirent {}
impl ::fmt::Debug for dirent {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("dirent")
.field("d_fileno", &self.d_fileno)
.field("d_off", &self.d_off)
.field("d_reclen", &self.d_reclen)
.field("d_type", &self.d_type)
.field("d_namlen", &self.d_namlen)
.field("d_name", &&self.d_name[..self.d_namlen as _])
.finish()
}
}
impl ::hash::Hash for dirent {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.d_fileno.hash(state);
self.d_off.hash(state);
self.d_reclen.hash(state);
self.d_type.hash(state);
self.d_namlen.hash(state);
self.d_name[..self.d_namlen as _].hash(state);
}
}
impl PartialEq for vnstat {
fn eq(&self, other: &vnstat) -> bool {
let self_vn_devname: &[::c_char] = &self.vn_devname;
let other_vn_devname: &[::c_char] = &other.vn_devname;
self.vn_fileid == other.vn_fileid &&
self.vn_size == other.vn_size &&
self.vn_dev == other.vn_dev &&
self.vn_fsid == other.vn_fsid &&
self.vn_mntdir == other.vn_mntdir &&
self.vn_type == other.vn_type &&
self.vn_mode == other.vn_mode &&
self_vn_devname == other_vn_devname
}
}
impl Eq for vnstat {}
impl ::fmt::Debug for vnstat {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
let self_vn_devname: &[::c_char] = &self.vn_devname;
f.debug_struct("vnstat")
.field("vn_fileid", &self.vn_fileid)
.field("vn_size", &self.vn_size)
.field("vn_dev", &self.vn_dev)
.field("vn_fsid", &self.vn_fsid)
.field("vn_mntdir", &self.vn_mntdir)
.field("vn_type", &self.vn_type)
.field("vn_mode", &self.vn_mode)
.field("vn_devname", &self_vn_devname)
.finish()
}
}
impl ::hash::Hash for vnstat {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
let self_vn_devname: &[::c_char] = &self.vn_devname;
self.vn_fileid.hash(state);
self.vn_size.hash(state);
self.vn_dev.hash(state);
self.vn_fsid.hash(state);
self.vn_mntdir.hash(state);
self.vn_type.hash(state);
self.vn_mode.hash(state);
self_vn_devname.hash(state);
}
}
}
}
pub const RAND_MAX: ::c_int = 0x7fff_ffff;
pub const ELAST: ::c_int = 97;
pub const KF_TYPE_EVENTFD: ::c_int = 13;
/// max length of devicename
pub const SPECNAMELEN: ::c_int = 255;
pub const KI_NSPARE_PTR: usize = 5;
/// domainset policies
pub const DOMAINSET_POLICY_INVALID: ::c_int = 0;
pub const DOMAINSET_POLICY_ROUNDROBIN: ::c_int = 1;
pub const DOMAINSET_POLICY_FIRSTTOUCH: ::c_int = 2;
pub const DOMAINSET_POLICY_PREFER: ::c_int = 3;
pub const DOMAINSET_POLICY_INTERLEAVE: ::c_int = 4;
pub const MINCORE_SUPER: ::c_int = 0x60;
safe_f! {
pub {const} fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
let major = major as ::dev_t;
let minor = minor as ::dev_t;
let mut dev = 0;
dev |= ((major & 0xffffff00) as dev_t) << 32;
dev |= ((major & 0x000000ff) as dev_t) << 8;
dev |= ((minor & 0x0000ff00) as dev_t) << 24;
dev |= ((minor & 0xffff00ff) as dev_t) << 0;
dev
}
}
f! {
pub fn major(dev: ::dev_t) -> ::c_int {
(((dev >> 32) & 0xffffff00) | ((dev >> 8) & 0xff)) as ::c_int
}
pub fn minor(dev: ::dev_t) -> ::c_int {
(((dev >> 24) & 0xff00) | (dev & 0xffff00ff)) as ::c_int
}
}
extern "C" {
pub fn setgrent();
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
pub fn freelocale(loc: ::locale_t);
pub fn msgrcv(
msqid: ::c_int,
msgp: *mut ::c_void,
msgsz: ::size_t,
msgtyp: ::c_long,
msgflg: ::c_int,
) -> ::ssize_t;
pub fn cpuset_getdomain(
level: ::cpulevel_t,
which: ::cpuwhich_t,
id: ::id_t,
setsize: ::size_t,
mask: *mut ::domainset_t,
policy: *mut ::c_int,
) -> ::c_int;
pub fn cpuset_setdomain(
level: ::cpulevel_t,
which: ::cpuwhich_t,
id: ::id_t,
setsize: ::size_t,
mask: *const ::domainset_t,
policy: ::c_int,
) -> ::c_int;
pub fn dirname(path: *mut ::c_char) -> *mut ::c_char;
pub fn basename(path: *mut ::c_char) -> *mut ::c_char;
}
#[link(name = "kvm")]
extern "C" {
pub fn kvm_kerndisp(kd: *mut ::kvm_t) -> ::kssize_t;
}
cfg_if! {
if #[cfg(any(target_arch = "x86_64",
target_arch = "aarch64",
target_arch = "riscv64"))] {
mod b64;
pub use self::b64::*;
}
}
cfg_if! {
if #[cfg(target_arch = "x86_64")] {
mod x86_64;
pub use self::x86_64::*;
}
}

View file

@ -0,0 +1,12 @@
pub const PROC_KPTI_CTL: ::c_int = ::PROC_PROCCTL_MD_MIN;
pub const PROC_KPTI_CTL_ENABLE_ON_EXEC: ::c_int = 1;
pub const PROC_KPTI_CTL_DISABLE_ON_EXEC: ::c_int = 2;
pub const PROC_KPTI_STATUS: ::c_int = ::PROC_PROCCTL_MD_MIN + 1;
pub const PROC_KPTI_STATUS_ACTIVE: ::c_int = 0x80000000;
pub const PROC_LA_CTL: ::c_int = ::PROC_PROCCTL_MD_MIN + 2;
pub const PROC_LA_STATUS: ::c_int = ::PROC_PROCCTL_MD_MIN + 3;
pub const PROC_LA_CTL_LA48_ON_EXEC: ::c_int = 1;
pub const PROC_LA_CTL_LA57_ON_EXEC: ::c_int = 2;
pub const PROC_LA_CTL_DEFAULT_ON_EXEC: ::c_int = 3;
pub const PROC_LA_STATUS_LA48: ::c_int = 0x01000000;
pub const PROC_LA_STATUS_LA57: ::c_int = 0x02000000;

View file

@ -0,0 +1,34 @@
#[repr(C)]
#[cfg_attr(feature = "extra_traits", derive(Debug, Eq, Hash, PartialEq))]
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_nlink: ::nlink_t,
pub st_mode: ::mode_t,
st_padding0: i16,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
st_padding1: i32,
pub st_rdev: ::dev_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
pub st_size: ::off_t,
pub st_blocks: ::blkcnt_t,
pub st_blksize: ::blksize_t,
pub st_flags: ::fflags_t,
pub st_gen: u64,
pub st_spare: [u64; 10],
}
impl ::Copy for ::stat {}
impl ::Clone for ::stat {
fn clone(&self) -> ::stat {
*self
}
}

View file

@ -0,0 +1,546 @@
// APIs in FreeBSD 15 that have changed since 11.
pub type nlink_t = u64;
pub type dev_t = u64;
pub type ino_t = ::c_ulong;
pub type shmatt_t = ::c_uint;
pub type kpaddr_t = u64;
pub type kssize_t = i64;
pub type domainset_t = __c_anonymous_domainset;
s! {
pub struct shmid_ds {
pub shm_perm: ::ipc_perm,
pub shm_segsz: ::size_t,
pub shm_lpid: ::pid_t,
pub shm_cpid: ::pid_t,
pub shm_nattch: ::shmatt_t,
pub shm_atime: ::time_t,
pub shm_dtime: ::time_t,
pub shm_ctime: ::time_t,
}
pub struct kevent {
pub ident: ::uintptr_t,
pub filter: ::c_short,
pub flags: ::c_ushort,
pub fflags: ::c_uint,
pub data: i64,
pub udata: *mut ::c_void,
pub ext: [u64; 4],
}
pub struct kvm_page {
pub kp_version: ::u_int,
pub kp_paddr: ::kpaddr_t,
pub kp_kmap_vaddr: ::kvaddr_t,
pub kp_dmap_vaddr: ::kvaddr_t,
pub kp_prot: ::vm_prot_t,
pub kp_offset: ::off_t,
pub kp_len: ::size_t,
}
pub struct __c_anonymous_domainset {
_priv: [::uintptr_t; 4],
}
pub struct kinfo_proc {
/// Size of this structure.
pub ki_structsize: ::c_int,
/// Reserved: layout identifier.
pub ki_layout: ::c_int,
/// Address of command arguments.
pub ki_args: *mut ::pargs,
// This is normally "struct proc".
/// Address of proc.
pub ki_paddr: *mut ::c_void,
// This is normally "struct user".
/// Kernel virtual address of u-area.
pub ki_addr: *mut ::c_void,
// This is normally "struct vnode".
/// Pointer to trace file.
pub ki_tracep: *mut ::c_void,
// This is normally "struct vnode".
/// Pointer to executable file.
pub ki_textvp: *mut ::c_void,
// This is normally "struct filedesc".
/// Pointer to open file info.
pub ki_fd: *mut ::c_void,
// This is normally "struct vmspace".
/// Pointer to kernel vmspace struct.
pub ki_vmspace: *mut ::c_void,
/// Sleep address.
pub ki_wchan: *const ::c_void,
/// Process identifier.
pub ki_pid: ::pid_t,
/// Parent process ID.
pub ki_ppid: ::pid_t,
/// Process group ID.
pub ki_pgid: ::pid_t,
/// tty process group ID.
pub ki_tpgid: ::pid_t,
/// Process session ID.
pub ki_sid: ::pid_t,
/// Terminal session ID.
pub ki_tsid: ::pid_t,
/// Job control counter.
pub ki_jobc: ::c_short,
/// Unused (just here for alignment).
pub ki_spare_short1: ::c_short,
/// Controlling tty dev.
pub ki_tdev_freebsd11: u32,
/// Signals arrived but not delivered.
pub ki_siglist: ::sigset_t,
/// Current signal mask.
pub ki_sigmask: ::sigset_t,
/// Signals being ignored.
pub ki_sigignore: ::sigset_t,
/// Signals being caught by user.
pub ki_sigcatch: ::sigset_t,
/// Effective user ID.
pub ki_uid: ::uid_t,
/// Real user ID.
pub ki_ruid: ::uid_t,
/// Saved effective user ID.
pub ki_svuid: ::uid_t,
/// Real group ID.
pub ki_rgid: ::gid_t,
/// Saved effective group ID.
pub ki_svgid: ::gid_t,
/// Number of groups.
pub ki_ngroups: ::c_short,
/// Unused (just here for alignment).
pub ki_spare_short2: ::c_short,
/// Groups.
pub ki_groups: [::gid_t; ::KI_NGROUPS],
/// Virtual size.
pub ki_size: ::vm_size_t,
/// Current resident set size in pages.
pub ki_rssize: ::segsz_t,
/// Resident set size before last swap.
pub ki_swrss: ::segsz_t,
/// Text size (pages) XXX.
pub ki_tsize: ::segsz_t,
/// Data size (pages) XXX.
pub ki_dsize: ::segsz_t,
/// Stack size (pages).
pub ki_ssize: ::segsz_t,
/// Exit status for wait & stop signal.
pub ki_xstat: ::u_short,
/// Accounting flags.
pub ki_acflag: ::u_short,
/// %cpu for process during `ki_swtime`.
pub ki_pctcpu: ::fixpt_t,
/// Time averaged value of `ki_cpticks`.
pub ki_estcpu: ::u_int,
/// Time since last blocked.
pub ki_slptime: ::u_int,
/// Time swapped in or out.
pub ki_swtime: ::u_int,
/// Number of copy-on-write faults.
pub ki_cow: ::u_int,
/// Real time in microsec.
pub ki_runtime: u64,
/// Starting time.
pub ki_start: ::timeval,
/// Time used by process children.
pub ki_childtime: ::timeval,
/// P_* flags.
pub ki_flag: ::c_long,
/// KI_* flags (below).
pub ki_kiflag: ::c_long,
/// Kernel trace points.
pub ki_traceflag: ::c_int,
/// S* process status.
pub ki_stat: ::c_char,
/// Process "nice" value.
pub ki_nice: i8, // signed char
/// Process lock (prevent swap) count.
pub ki_lock: ::c_char,
/// Run queue index.
pub ki_rqindex: ::c_char,
/// Which cpu we are on.
pub ki_oncpu_old: ::c_uchar,
/// Last cpu we were on.
pub ki_lastcpu_old: ::c_uchar,
/// Thread name.
pub ki_tdname: [::c_char; ::TDNAMLEN + 1],
/// Wchan message.
pub ki_wmesg: [::c_char; ::WMESGLEN + 1],
/// Setlogin name.
pub ki_login: [::c_char; ::LOGNAMELEN + 1],
/// Lock name.
pub ki_lockname: [::c_char; ::LOCKNAMELEN + 1],
/// Command name.
pub ki_comm: [::c_char; ::COMMLEN + 1],
/// Emulation name.
pub ki_emul: [::c_char; ::KI_EMULNAMELEN + 1],
/// Login class.
pub ki_loginclass: [::c_char; ::LOGINCLASSLEN + 1],
/// More thread name.
pub ki_moretdname: [::c_char; ::MAXCOMLEN - ::TDNAMLEN + 1],
/// Spare string space.
pub ki_sparestrings: [[::c_char; 23]; 2], // little hack to allow PartialEq
/// Spare room for growth.
pub ki_spareints: [::c_int; ::KI_NSPARE_INT],
/// Controlling tty dev.
pub ki_tdev: u64,
/// Which cpu we are on.
pub ki_oncpu: ::c_int,
/// Last cpu we were on.
pub ki_lastcpu: ::c_int,
/// PID of tracing process.
pub ki_tracer: ::c_int,
/// P2_* flags.
pub ki_flag2: ::c_int,
/// Default FIB number.
pub ki_fibnum: ::c_int,
/// Credential flags.
pub ki_cr_flags: ::u_int,
/// Process jail ID.
pub ki_jid: ::c_int,
/// Number of threads in total.
pub ki_numthreads: ::c_int,
/// Thread ID.
pub ki_tid: ::lwpid_t,
/// Process priority.
pub ki_pri: ::priority,
/// Process rusage statistics.
pub ki_rusage: ::rusage,
/// rusage of children processes.
pub ki_rusage_ch: ::rusage,
// This is normally "struct pcb".
/// Kernel virtual addr of pcb.
pub ki_pcb: *mut ::c_void,
/// Kernel virtual addr of stack.
pub ki_kstack: *mut ::c_void,
/// User convenience pointer.
pub ki_udata: *mut ::c_void,
// This is normally "struct thread".
pub ki_tdaddr: *mut ::c_void,
// This is normally "struct pwddesc".
/// Pointer to process paths info.
pub ki_pd: *mut ::c_void,
pub ki_spareptrs: [*mut ::c_void; ::KI_NSPARE_PTR],
pub ki_sparelongs: [::c_long; ::KI_NSPARE_LONG],
/// PS_* flags.
pub ki_sflag: ::c_long,
/// kthread flag.
pub ki_tdflags: ::c_long,
}
}
s_no_extra_traits! {
pub struct dirent {
pub d_fileno: ::ino_t,
pub d_off: ::off_t,
pub d_reclen: u16,
pub d_type: u8,
d_pad0: u8,
pub d_namlen: u16,
d_pad1: u16,
pub d_name: [::c_char; 256],
}
pub struct statfs {
pub f_version: u32,
pub f_type: u32,
pub f_flags: u64,
pub f_bsize: u64,
pub f_iosize: u64,
pub f_blocks: u64,
pub f_bfree: u64,
pub f_bavail: i64,
pub f_files: u64,
pub f_ffree: i64,
pub f_syncwrites: u64,
pub f_asyncwrites: u64,
pub f_syncreads: u64,
pub f_asyncreads: u64,
f_spare: [u64; 10],
pub f_namemax: u32,
pub f_owner: ::uid_t,
pub f_fsid: ::fsid_t,
f_charspare: [::c_char; 80],
pub f_fstypename: [::c_char; 16],
pub f_mntfromname: [::c_char; 1024],
pub f_mntonname: [::c_char; 1024],
}
pub struct vnstat {
pub vn_fileid: u64,
pub vn_size: u64,
pub vn_dev: u64,
pub vn_fsid: u64,
pub vn_mntdir: *mut ::c_char,
pub vn_type: ::c_int,
pub vn_mode: u16,
pub vn_devname: [::c_char; ::SPECNAMELEN as usize + 1],
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for statfs {
fn eq(&self, other: &statfs) -> bool {
self.f_version == other.f_version
&& self.f_type == other.f_type
&& self.f_flags == other.f_flags
&& self.f_bsize == other.f_bsize
&& self.f_iosize == other.f_iosize
&& self.f_blocks == other.f_blocks
&& self.f_bfree == other.f_bfree
&& self.f_bavail == other.f_bavail
&& self.f_files == other.f_files
&& self.f_ffree == other.f_ffree
&& self.f_syncwrites == other.f_syncwrites
&& self.f_asyncwrites == other.f_asyncwrites
&& self.f_syncreads == other.f_syncreads
&& self.f_asyncreads == other.f_asyncreads
&& self.f_namemax == other.f_namemax
&& self.f_owner == other.f_owner
&& self.f_fsid == other.f_fsid
&& self.f_fstypename == other.f_fstypename
&& self
.f_mntfromname
.iter()
.zip(other.f_mntfromname.iter())
.all(|(a,b)| a == b)
&& self
.f_mntonname
.iter()
.zip(other.f_mntonname.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for statfs {}
impl ::fmt::Debug for statfs {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("statfs")
.field("f_bsize", &self.f_bsize)
.field("f_iosize", &self.f_iosize)
.field("f_blocks", &self.f_blocks)
.field("f_bfree", &self.f_bfree)
.field("f_bavail", &self.f_bavail)
.field("f_files", &self.f_files)
.field("f_ffree", &self.f_ffree)
.field("f_syncwrites", &self.f_syncwrites)
.field("f_asyncwrites", &self.f_asyncwrites)
.field("f_syncreads", &self.f_syncreads)
.field("f_asyncreads", &self.f_asyncreads)
.field("f_namemax", &self.f_namemax)
.field("f_owner", &self.f_owner)
.field("f_fsid", &self.f_fsid)
.field("f_fstypename", &self.f_fstypename)
.field("f_mntfromname", &&self.f_mntfromname[..])
.field("f_mntonname", &&self.f_mntonname[..])
.finish()
}
}
impl ::hash::Hash for statfs {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.f_version.hash(state);
self.f_type.hash(state);
self.f_flags.hash(state);
self.f_bsize.hash(state);
self.f_iosize.hash(state);
self.f_blocks.hash(state);
self.f_bfree.hash(state);
self.f_bavail.hash(state);
self.f_files.hash(state);
self.f_ffree.hash(state);
self.f_syncwrites.hash(state);
self.f_asyncwrites.hash(state);
self.f_syncreads.hash(state);
self.f_asyncreads.hash(state);
self.f_namemax.hash(state);
self.f_owner.hash(state);
self.f_fsid.hash(state);
self.f_charspare.hash(state);
self.f_fstypename.hash(state);
self.f_mntfromname.hash(state);
self.f_mntonname.hash(state);
}
}
impl PartialEq for dirent {
fn eq(&self, other: &dirent) -> bool {
self.d_fileno == other.d_fileno
&& self.d_off == other.d_off
&& self.d_reclen == other.d_reclen
&& self.d_type == other.d_type
&& self.d_namlen == other.d_namlen
&& self
.d_name[..self.d_namlen as _]
.iter()
.zip(other.d_name.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for dirent {}
impl ::fmt::Debug for dirent {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("dirent")
.field("d_fileno", &self.d_fileno)
.field("d_off", &self.d_off)
.field("d_reclen", &self.d_reclen)
.field("d_type", &self.d_type)
.field("d_namlen", &self.d_namlen)
.field("d_name", &&self.d_name[..self.d_namlen as _])
.finish()
}
}
impl ::hash::Hash for dirent {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.d_fileno.hash(state);
self.d_off.hash(state);
self.d_reclen.hash(state);
self.d_type.hash(state);
self.d_namlen.hash(state);
self.d_name[..self.d_namlen as _].hash(state);
}
}
impl PartialEq for vnstat {
fn eq(&self, other: &vnstat) -> bool {
let self_vn_devname: &[::c_char] = &self.vn_devname;
let other_vn_devname: &[::c_char] = &other.vn_devname;
self.vn_fileid == other.vn_fileid &&
self.vn_size == other.vn_size &&
self.vn_dev == other.vn_dev &&
self.vn_fsid == other.vn_fsid &&
self.vn_mntdir == other.vn_mntdir &&
self.vn_type == other.vn_type &&
self.vn_mode == other.vn_mode &&
self_vn_devname == other_vn_devname
}
}
impl Eq for vnstat {}
impl ::fmt::Debug for vnstat {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
let self_vn_devname: &[::c_char] = &self.vn_devname;
f.debug_struct("vnstat")
.field("vn_fileid", &self.vn_fileid)
.field("vn_size", &self.vn_size)
.field("vn_dev", &self.vn_dev)
.field("vn_fsid", &self.vn_fsid)
.field("vn_mntdir", &self.vn_mntdir)
.field("vn_type", &self.vn_type)
.field("vn_mode", &self.vn_mode)
.field("vn_devname", &self_vn_devname)
.finish()
}
}
impl ::hash::Hash for vnstat {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
let self_vn_devname: &[::c_char] = &self.vn_devname;
self.vn_fileid.hash(state);
self.vn_size.hash(state);
self.vn_dev.hash(state);
self.vn_fsid.hash(state);
self.vn_mntdir.hash(state);
self.vn_type.hash(state);
self.vn_mode.hash(state);
self_vn_devname.hash(state);
}
}
}
}
pub const RAND_MAX: ::c_int = 0x7fff_ffff;
pub const ELAST: ::c_int = 97;
pub const KF_TYPE_EVENTFD: ::c_int = 13;
/// max length of devicename
pub const SPECNAMELEN: ::c_int = 255;
pub const KI_NSPARE_PTR: usize = 5;
/// domainset policies
pub const DOMAINSET_POLICY_INVALID: ::c_int = 0;
pub const DOMAINSET_POLICY_ROUNDROBIN: ::c_int = 1;
pub const DOMAINSET_POLICY_FIRSTTOUCH: ::c_int = 2;
pub const DOMAINSET_POLICY_PREFER: ::c_int = 3;
pub const DOMAINSET_POLICY_INTERLEAVE: ::c_int = 4;
pub const MINCORE_SUPER: ::c_int = 0x60;
safe_f! {
pub {const} fn makedev(major: ::c_uint, minor: ::c_uint) -> ::dev_t {
let major = major as ::dev_t;
let minor = minor as ::dev_t;
let mut dev = 0;
dev |= ((major & 0xffffff00) as dev_t) << 32;
dev |= ((major & 0x000000ff) as dev_t) << 8;
dev |= ((minor & 0x0000ff00) as dev_t) << 24;
dev |= ((minor & 0xffff00ff) as dev_t) << 0;
dev
}
}
f! {
pub fn major(dev: ::dev_t) -> ::c_int {
(((dev >> 32) & 0xffffff00) | ((dev >> 8) & 0xff)) as ::c_int
}
pub fn minor(dev: ::dev_t) -> ::c_int {
(((dev >> 24) & 0xff00) | (dev & 0xffff00ff)) as ::c_int
}
}
extern "C" {
pub fn setgrent();
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int) -> ::c_int;
pub fn freelocale(loc: ::locale_t);
pub fn msgrcv(
msqid: ::c_int,
msgp: *mut ::c_void,
msgsz: ::size_t,
msgtyp: ::c_long,
msgflg: ::c_int,
) -> ::ssize_t;
pub fn cpuset_getdomain(
level: ::cpulevel_t,
which: ::cpuwhich_t,
id: ::id_t,
setsize: ::size_t,
mask: *mut ::domainset_t,
policy: *mut ::c_int,
) -> ::c_int;
pub fn cpuset_setdomain(
level: ::cpulevel_t,
which: ::cpuwhich_t,
id: ::id_t,
setsize: ::size_t,
mask: *const ::domainset_t,
policy: ::c_int,
) -> ::c_int;
pub fn dirname(path: *mut ::c_char) -> *mut ::c_char;
pub fn basename(path: *mut ::c_char) -> *mut ::c_char;
}
#[link(name = "kvm")]
extern "C" {
pub fn kvm_kerndisp(kd: *mut ::kvm_t) -> ::kssize_t;
}
cfg_if! {
if #[cfg(any(target_arch = "x86_64",
target_arch = "aarch64",
target_arch = "riscv64"))] {
mod b64;
pub use self::b64::*;
}
}
cfg_if! {
if #[cfg(target_arch = "x86_64")] {
mod x86_64;
pub use self::x86_64::*;
}
}

View file

@ -0,0 +1,12 @@
pub const PROC_KPTI_CTL: ::c_int = ::PROC_PROCCTL_MD_MIN;
pub const PROC_KPTI_CTL_ENABLE_ON_EXEC: ::c_int = 1;
pub const PROC_KPTI_CTL_DISABLE_ON_EXEC: ::c_int = 2;
pub const PROC_KPTI_STATUS: ::c_int = ::PROC_PROCCTL_MD_MIN + 1;
pub const PROC_KPTI_STATUS_ACTIVE: ::c_int = 0x80000000;
pub const PROC_LA_CTL: ::c_int = ::PROC_PROCCTL_MD_MIN + 2;
pub const PROC_LA_STATUS: ::c_int = ::PROC_PROCCTL_MD_MIN + 3;
pub const PROC_LA_CTL_LA48_ON_EXEC: ::c_int = 1;
pub const PROC_LA_CTL_LA57_ON_EXEC: ::c_int = 2;
pub const PROC_LA_CTL_DEFAULT_ON_EXEC: ::c_int = 3;
pub const PROC_LA_STATUS_LA48: ::c_int = 0x01000000;
pub const PROC_LA_STATUS_LA57: ::c_int = 0x02000000;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,47 @@
pub type c_char = u8;
pub type c_long = i32;
pub type c_ulong = u32;
pub type wchar_t = i32;
pub type time_t = i64;
pub type suseconds_t = i32;
pub type register_t = i32;
s! {
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_mode: ::mode_t,
pub st_nlink: ::nlink_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_rdev: ::dev_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
pub st_size: ::off_t,
pub st_blocks: ::blkcnt_t,
pub st_blksize: ::blksize_t,
pub st_flags: ::fflags_t,
pub st_gen: u32,
pub st_lspare: i32,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
}
}
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 4 - 1;
}
}
pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4

View file

@ -0,0 +1,47 @@
pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type wchar_t = i32;
pub type time_t = i64;
pub type suseconds_t = i64;
pub type register_t = i64;
s! {
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_mode: ::mode_t,
pub st_nlink: ::nlink_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_rdev: ::dev_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
pub st_size: ::off_t,
pub st_blocks: ::blkcnt_t,
pub st_blksize: ::blksize_t,
pub st_flags: ::fflags_t,
pub st_gen: u32,
pub st_lspare: i32,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
}
}
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 8 - 1;
}
}
pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4

View file

@ -0,0 +1,154 @@
pub type c_char = u8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type wchar_t = ::c_int;
pub type time_t = i64;
pub type suseconds_t = ::c_long;
pub type register_t = i64;
s_no_extra_traits! {
pub struct gpregs {
pub gp_ra: ::register_t,
pub gp_sp: ::register_t,
pub gp_gp: ::register_t,
pub gp_tp: ::register_t,
pub gp_t: [::register_t; 7],
pub gp_s: [::register_t; 12],
pub gp_a: [::register_t; 8],
pub gp_sepc: ::register_t,
pub gp_sstatus: ::register_t,
}
pub struct fpregs {
pub fp_x: [[::register_t; 2]; 32],
pub fp_fcsr: ::register_t,
pub fp_flags: ::c_int,
pub fp_pad: ::c_int,
}
pub struct mcontext_t {
pub mc_gpregs: gpregs,
pub mc_fpregs: fpregs,
pub mc_flags: ::c_int,
pub mc_pad: ::c_int,
pub mc_spare: [u64; 8],
}
}
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 8 - 1;
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for gpregs {
fn eq(&self, other: &gpregs) -> bool {
self.gp_ra == other.gp_ra &&
self.gp_sp == other.gp_sp &&
self.gp_gp == other.gp_gp &&
self.gp_tp == other.gp_tp &&
self.gp_t.iter().zip(other.gp_t.iter()).all(|(a, b)| a == b) &&
self.gp_s.iter().zip(other.gp_s.iter()).all(|(a, b)| a == b) &&
self.gp_a.iter().zip(other.gp_a.iter()).all(|(a, b)| a == b) &&
self.gp_sepc == other.gp_sepc &&
self.gp_sstatus == other.gp_sstatus
}
}
impl Eq for gpregs {}
impl ::fmt::Debug for gpregs {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("gpregs")
.field("gp_ra", &self.gp_ra)
.field("gp_sp", &self.gp_sp)
.field("gp_gp", &self.gp_gp)
.field("gp_tp", &self.gp_tp)
.field("gp_t", &self.gp_t)
.field("gp_s", &self.gp_s)
.field("gp_a", &self.gp_a)
.field("gp_sepc", &self.gp_sepc)
.field("gp_sstatus", &self.gp_sstatus)
.finish()
}
}
impl ::hash::Hash for gpregs {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.gp_ra.hash(state);
self.gp_sp.hash(state);
self.gp_gp.hash(state);
self.gp_tp.hash(state);
self.gp_t.hash(state);
self.gp_s.hash(state);
self.gp_a.hash(state);
self.gp_sepc.hash(state);
self.gp_sstatus.hash(state);
}
}
impl PartialEq for fpregs {
fn eq(&self, other: &fpregs) -> bool {
self.fp_x == other.fp_x &&
self.fp_fcsr == other.fp_fcsr &&
self.fp_flags == other.fp_flags &&
self.fp_pad == other.fp_pad
}
}
impl Eq for fpregs {}
impl ::fmt::Debug for fpregs {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("fpregs")
.field("fp_x", &self.fp_x)
.field("fp_fcsr", &self.fp_fcsr)
.field("fp_flags", &self.fp_flags)
.field("fp_pad", &self.fp_pad)
.finish()
}
}
impl ::hash::Hash for fpregs {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.fp_x.hash(state);
self.fp_fcsr.hash(state);
self.fp_flags.hash(state);
self.fp_pad.hash(state);
}
}
impl PartialEq for mcontext_t {
fn eq(&self, other: &mcontext_t) -> bool {
self.mc_gpregs == other.mc_gpregs &&
self.mc_fpregs == other.mc_fpregs &&
self.mc_flags == other.mc_flags &&
self.mc_pad == other.mc_pad &&
self.mc_spare.iter().zip(other.mc_spare.iter()).all(|(a, b)| a == b)
}
}
impl Eq for mcontext_t {}
impl ::fmt::Debug for mcontext_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("mcontext_t")
.field("mc_gpregs", &self.mc_gpregs)
.field("mc_fpregs", &self.mc_fpregs)
.field("mc_flags", &self.mc_flags)
.field("mc_pad", &self.mc_pad)
.field("mc_spare", &self.mc_spare)
.finish()
}
}
impl ::hash::Hash for mcontext_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.mc_gpregs.hash(state);
self.mc_fpregs.hash(state);
self.mc_flags.hash(state);
self.mc_pad.hash(state);
self.mc_spare.hash(state);
}
}
}
}
pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 4096; // 1024 * 4

View file

@ -0,0 +1,201 @@
pub type c_char = i8;
pub type c_long = i32;
pub type c_ulong = u32;
pub type wchar_t = i32;
pub type time_t = i32;
pub type suseconds_t = i32;
pub type register_t = i32;
s_no_extra_traits! {
pub struct mcontext_t {
pub mc_onstack: register_t,
pub mc_gs: register_t,
pub mc_fs: register_t,
pub mc_es: register_t,
pub mc_ds: register_t,
pub mc_edi: register_t,
pub mc_esi: register_t,
pub mc_ebp: register_t,
pub mc_isp: register_t,
pub mc_ebx: register_t,
pub mc_edx: register_t,
pub mc_ecx: register_t,
pub mc_eax: register_t,
pub mc_trapno: register_t,
pub mc_err: register_t,
pub mc_eip: register_t,
pub mc_cs: register_t,
pub mc_eflags: register_t,
pub mc_esp: register_t,
pub mc_ss: register_t,
pub mc_len: ::c_int,
pub mc_fpformat: ::c_int,
pub mc_ownedfp: ::c_int,
pub mc_flags: register_t,
pub mc_fpstate: [[::c_int; 32]; 4],
pub mc_fsbase: register_t,
pub mc_gsbase: register_t,
pub mc_xfpustate: register_t,
pub mc_xfpustate_len: register_t,
pub mc_spare2: [::c_int; 4],
}
}
s! {
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_mode: ::mode_t,
pub st_nlink: ::nlink_t,
pub st_uid: ::uid_t,
pub st_gid: ::gid_t,
pub st_rdev: ::dev_t,
pub st_atime: ::time_t,
pub st_atime_nsec: ::c_long,
pub st_mtime: ::time_t,
pub st_mtime_nsec: ::c_long,
pub st_ctime: ::time_t,
pub st_ctime_nsec: ::c_long,
pub st_size: ::off_t,
pub st_blocks: ::blkcnt_t,
pub st_blksize: ::blksize_t,
pub st_flags: ::fflags_t,
pub st_gen: u32,
pub st_lspare: i32,
pub st_birthtime: ::time_t,
pub st_birthtime_nsec: ::c_long,
__unused: [u8; 8],
}
pub struct ucontext_t {
pub uc_sigmask: ::sigset_t,
pub uc_mcontext: ::mcontext_t,
pub uc_link: *mut ::ucontext_t,
pub uc_stack: ::stack_t,
pub uc_flags: ::c_int,
__spare__: [::c_int; 4],
}
}
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 4 - 1;
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for mcontext_t {
fn eq(&self, other: &mcontext_t) -> bool {
self.mc_onstack == other.mc_onstack &&
self.mc_gs == other.mc_gs &&
self.mc_fs == other.mc_fs &&
self.mc_es == other.mc_es &&
self.mc_ds == other.mc_ds &&
self.mc_edi == other.mc_edi &&
self.mc_esi == other.mc_esi &&
self.mc_ebp == other.mc_ebp &&
self.mc_isp == other.mc_isp &&
self.mc_ebx == other.mc_ebx &&
self.mc_edx == other.mc_edx &&
self.mc_ecx == other.mc_ecx &&
self.mc_eax == other.mc_eax &&
self.mc_trapno == other.mc_trapno &&
self.mc_err == other.mc_err &&
self.mc_eip == other.mc_eip &&
self.mc_cs == other.mc_cs &&
self.mc_eflags == other.mc_eflags &&
self.mc_esp == other.mc_esp &&
self.mc_ss == other.mc_ss &&
self.mc_len == other.mc_len &&
self.mc_fpformat == other.mc_fpformat &&
self.mc_ownedfp == other.mc_ownedfp &&
self.mc_flags == other.mc_flags &&
self.mc_fpstate.iter().zip(other.mc_fpstate.iter()).all(|(a, b)| a == b) &&
self.mc_fsbase == other.mc_fsbase &&
self.mc_gsbase == other.mc_gsbase &&
self.mc_xfpustate == other.mc_xfpustate &&
self.mc_xfpustate_len == other.mc_xfpustate_len &&
self.mc_spare2.iter().zip(other.mc_spare2.iter()).all(|(a, b)| a == b)
}
}
impl Eq for mcontext_t {}
impl ::fmt::Debug for mcontext_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("mcontext_t")
.field("mc_onstack", &self.mc_onstack)
.field("mc_gs", &self.mc_gs)
.field("mc_fs", &self.mc_fs)
.field("mc_es", &self.mc_es)
.field("mc_ds", &self.mc_ds)
.field("mc_edi", &self.mc_edi)
.field("mc_esi", &self.mc_esi)
.field("mc_ebp", &self.mc_ebp)
.field("mc_isp", &self.mc_isp)
.field("mc_ebx", &self.mc_ebx)
.field("mc_edx", &self.mc_edx)
.field("mc_ecx", &self.mc_ecx)
.field("mc_eax", &self.mc_eax)
.field("mc_trapno", &self.mc_trapno)
.field("mc_err", &self.mc_err)
.field("mc_eip", &self.mc_eip)
.field("mc_cs", &self.mc_cs)
.field("mc_eflags", &self.mc_eflags)
.field("mc_esp", &self.mc_esp)
.field("mc_ss", &self.mc_ss)
.field("mc_len", &self.mc_len)
.field("mc_fpformat", &self.mc_fpformat)
.field("mc_ownedfp", &self.mc_ownedfp)
.field("mc_flags", &self.mc_flags)
.field("mc_fpstate", &self.mc_fpstate)
.field("mc_fsbase", &self.mc_fsbase)
.field("mc_gsbase", &self.mc_gsbase)
.field("mc_xfpustate", &self.mc_xfpustate)
.field("mc_xfpustate_len", &self.mc_xfpustate_len)
.field("mc_spare2", &self.mc_spare2)
.finish()
}
}
impl ::hash::Hash for mcontext_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.mc_onstack.hash(state);
self.mc_gs.hash(state);
self.mc_fs.hash(state);
self.mc_es.hash(state);
self.mc_ds.hash(state);
self.mc_edi.hash(state);
self.mc_esi.hash(state);
self.mc_ebp.hash(state);
self.mc_isp.hash(state);
self.mc_ebx.hash(state);
self.mc_edx.hash(state);
self.mc_ecx.hash(state);
self.mc_eax.hash(state);
self.mc_trapno.hash(state);
self.mc_err.hash(state);
self.mc_eip.hash(state);
self.mc_cs.hash(state);
self.mc_eflags.hash(state);
self.mc_esp.hash(state);
self.mc_ss.hash(state);
self.mc_len.hash(state);
self.mc_fpformat.hash(state);
self.mc_ownedfp.hash(state);
self.mc_flags.hash(state);
self.mc_fpstate.hash(state);
self.mc_fsbase.hash(state);
self.mc_gsbase.hash(state);
self.mc_xfpustate.hash(state);
self.mc_xfpustate_len.hash(state);
self.mc_spare2.hash(state);
}
}
}
}
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4

View file

@ -0,0 +1,197 @@
use {c_long, register_t};
s_no_extra_traits! {
#[allow(missing_debug_implementations)]
#[repr(align(16))]
pub struct max_align_t {
priv_: [f64; 4]
}
#[repr(align(16))]
pub struct mcontext_t {
pub mc_onstack: register_t,
pub mc_rdi: register_t,
pub mc_rsi: register_t,
pub mc_rdx: register_t,
pub mc_rcx: register_t,
pub mc_r8: register_t,
pub mc_r9: register_t,
pub mc_rax: register_t,
pub mc_rbx: register_t,
pub mc_rbp: register_t,
pub mc_r10: register_t,
pub mc_r11: register_t,
pub mc_r12: register_t,
pub mc_r13: register_t,
pub mc_r14: register_t,
pub mc_r15: register_t,
pub mc_trapno: u32,
pub mc_fs: u16,
pub mc_gs: u16,
pub mc_addr: register_t,
pub mc_flags: u32,
pub mc_es: u16,
pub mc_ds: u16,
pub mc_err: register_t,
pub mc_rip: register_t,
pub mc_cs: register_t,
pub mc_rflags: register_t,
pub mc_rsp: register_t,
pub mc_ss: register_t,
pub mc_len: c_long,
pub mc_fpformat: c_long,
pub mc_ownedfp: c_long,
pub mc_fpstate: [c_long; 64],
pub mc_fsbase: register_t,
pub mc_gsbase: register_t,
pub mc_xfpustate: register_t,
pub mc_xfpustate_len: register_t,
pub mc_spare: [c_long; 4],
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for mcontext_t {
fn eq(&self, other: &mcontext_t) -> bool {
self.mc_onstack == other.mc_onstack &&
self.mc_rdi == other.mc_rdi &&
self.mc_rsi == other.mc_rsi &&
self.mc_rdx == other.mc_rdx &&
self.mc_rcx == other.mc_rcx &&
self.mc_r8 == other.mc_r8 &&
self.mc_r9 == other.mc_r9 &&
self.mc_rax == other.mc_rax &&
self.mc_rbx == other.mc_rbx &&
self.mc_rbp == other.mc_rbp &&
self.mc_r10 == other.mc_r10 &&
self.mc_r11 == other.mc_r11 &&
self.mc_r12 == other.mc_r12 &&
self.mc_r13 == other.mc_r13 &&
self.mc_r14 == other.mc_r14 &&
self.mc_r15 == other.mc_r15 &&
self.mc_trapno == other.mc_trapno &&
self.mc_fs == other.mc_fs &&
self.mc_gs == other.mc_gs &&
self.mc_addr == other.mc_addr &&
self.mc_flags == other.mc_flags &&
self.mc_es == other.mc_es &&
self.mc_ds == other.mc_ds &&
self.mc_err == other.mc_err &&
self.mc_rip == other.mc_rip &&
self.mc_cs == other.mc_cs &&
self.mc_rflags == other.mc_rflags &&
self.mc_rsp == other.mc_rsp &&
self.mc_ss == other.mc_ss &&
self.mc_len == other.mc_len &&
self.mc_fpformat == other.mc_fpformat &&
self.mc_ownedfp == other.mc_ownedfp &&
self.mc_fpstate.iter().zip(other.mc_fpstate.iter())
.all(|(a, b)| a == b) &&
self.mc_fsbase == other.mc_fsbase &&
self.mc_gsbase == other.mc_gsbase &&
self.mc_xfpustate == other.mc_xfpustate &&
self.mc_xfpustate_len == other.mc_xfpustate_len &&
self.mc_spare == other.mc_spare
}
}
impl Eq for mcontext_t {}
impl ::fmt::Debug for mcontext_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("mcontext_t")
.field("mc_onstack", &self.mc_onstack)
.field("mc_rdi", &self.mc_rdi)
.field("mc_rsi", &self.mc_rsi)
.field("mc_rdx", &self.mc_rdx)
.field("mc_rcx", &self.mc_rcx)
.field("mc_r8", &self.mc_r8)
.field("mc_r9", &self.mc_r9)
.field("mc_rax", &self.mc_rax)
.field("mc_rbx", &self.mc_rbx)
.field("mc_rbp", &self.mc_rbp)
.field("mc_r10", &self.mc_r10)
.field("mc_r11", &self.mc_r11)
.field("mc_r12", &self.mc_r12)
.field("mc_r13", &self.mc_r13)
.field("mc_r14", &self.mc_r14)
.field("mc_r15", &self.mc_r15)
.field("mc_trapno", &self.mc_trapno)
.field("mc_fs", &self.mc_fs)
.field("mc_gs", &self.mc_gs)
.field("mc_addr", &self.mc_addr)
.field("mc_flags", &self.mc_flags)
.field("mc_es", &self.mc_es)
.field("mc_ds", &self.mc_ds)
.field("mc_err", &self.mc_err)
.field("mc_rip", &self.mc_rip)
.field("mc_cs", &self.mc_cs)
.field("mc_rflags", &self.mc_rflags)
.field("mc_rsp", &self.mc_rsp)
.field("mc_ss", &self.mc_ss)
.field("mc_len", &self.mc_len)
.field("mc_fpformat", &self.mc_fpformat)
.field("mc_ownedfp", &self.mc_ownedfp)
// FIXME: .field("mc_fpstate", &self.mc_fpstate)
.field("mc_fsbase", &self.mc_fsbase)
.field("mc_gsbase", &self.mc_gsbase)
.field("mc_xfpustate", &self.mc_xfpustate)
.field("mc_xfpustate_len", &self.mc_xfpustate_len)
.field("mc_spare", &self.mc_spare)
.finish()
}
}
impl ::hash::Hash for mcontext_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.mc_onstack.hash(state);
self.mc_rdi.hash(state);
self.mc_rsi.hash(state);
self.mc_rdx.hash(state);
self.mc_rcx.hash(state);
self.mc_r8.hash(state);
self.mc_r9.hash(state);
self.mc_rax.hash(state);
self.mc_rbx.hash(state);
self.mc_rbp.hash(state);
self.mc_r10.hash(state);
self.mc_r11.hash(state);
self.mc_r12.hash(state);
self.mc_r13.hash(state);
self.mc_r14.hash(state);
self.mc_r15.hash(state);
self.mc_trapno.hash(state);
self.mc_fs.hash(state);
self.mc_gs.hash(state);
self.mc_addr.hash(state);
self.mc_flags.hash(state);
self.mc_es.hash(state);
self.mc_ds.hash(state);
self.mc_err.hash(state);
self.mc_rip.hash(state);
self.mc_cs.hash(state);
self.mc_rflags.hash(state);
self.mc_rsp.hash(state);
self.mc_ss.hash(state);
self.mc_len.hash(state);
self.mc_fpformat.hash(state);
self.mc_ownedfp.hash(state);
self.mc_fpstate.hash(state);
self.mc_fsbase.hash(state);
self.mc_gsbase.hash(state);
self.mc_xfpustate.hash(state);
self.mc_xfpustate_len.hash(state);
self.mc_spare.hash(state);
}
}
}
}
s! {
pub struct ucontext_t {
pub uc_sigmask: ::sigset_t,
pub uc_mcontext: ::mcontext_t,
pub uc_link: *mut ::ucontext_t,
pub uc_stack: ::stack_t,
pub uc_flags: ::c_int,
__spare__: [::c_int; 4],
}
}

View file

@ -0,0 +1,334 @@
pub type c_char = i8;
pub type c_long = i64;
pub type c_ulong = u64;
pub type wchar_t = i32;
pub type time_t = i64;
pub type suseconds_t = i64;
pub type register_t = i64;
s! {
pub struct reg32 {
pub r_fs: u32,
pub r_es: u32,
pub r_ds: u32,
pub r_edi: u32,
pub r_esi: u32,
pub r_ebp: u32,
pub r_isp: u32,
pub r_ebx: u32,
pub r_edx: u32,
pub r_ecx: u32,
pub r_eax: u32,
pub r_trapno: u32,
pub r_err: u32,
pub r_eip: u32,
pub r_cs: u32,
pub r_eflags: u32,
pub r_esp: u32,
pub r_ss: u32,
pub r_gs: u32,
}
pub struct reg {
pub r_r15: i64,
pub r_r14: i64,
pub r_r13: i64,
pub r_r12: i64,
pub r_r11: i64,
pub r_r10: i64,
pub r_r9: i64,
pub r_r8: i64,
pub r_rdi: i64,
pub r_rsi: i64,
pub r_rbp: i64,
pub r_rbx: i64,
pub r_rdx: i64,
pub r_rcx: i64,
pub r_rax: i64,
pub r_trapno: u32,
pub r_fs: u16,
pub r_gs: u16,
pub r_err: u32,
pub r_es: u16,
pub r_ds: u16,
pub r_rip: i64,
pub r_cs: i64,
pub r_rflags: i64,
pub r_rsp: i64,
pub r_ss: i64,
}
}
s_no_extra_traits! {
pub struct fpreg32 {
pub fpr_env: [u32; 7],
pub fpr_acc: [[u8; 10]; 8],
pub fpr_ex_sw: u32,
pub fpr_pad: [u8; 64],
}
pub struct fpreg {
pub fpr_env: [u64; 4],
pub fpr_acc: [[u8; 16]; 8],
pub fpr_xacc: [[u8; 16]; 16],
pub fpr_spare: [u64; 12],
}
pub struct xmmreg {
pub xmm_env: [u32; 8],
pub xmm_acc: [[u8; 16]; 8],
pub xmm_reg: [[u8; 16]; 8],
pub xmm_pad: [u8; 224],
}
#[cfg(libc_union)]
pub union __c_anonymous_elf64_auxv_union {
pub a_val: ::c_long,
pub a_ptr: *mut ::c_void,
pub a_fcn: extern "C" fn(),
}
pub struct Elf64_Auxinfo {
pub a_type: ::c_long,
#[cfg(libc_union)]
pub a_un: __c_anonymous_elf64_auxv_union,
}
pub struct kinfo_file {
pub kf_structsize: ::c_int,
pub kf_type: ::c_int,
pub kf_fd: ::c_int,
pub kf_ref_count: ::c_int,
pub kf_flags: ::c_int,
_kf_pad0: ::c_int,
pub kf_offset: i64,
_priv: [::uintptr_t; 38], // FIXME if needed
pub kf_status: u16,
_kf_pad1: u16,
_kf_ispare0: ::c_int,
pub kf_cap_rights: ::cap_rights_t,
_kf_cap_spare: u64,
pub kf_path: [::c_char; ::PATH_MAX as usize],
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for fpreg32 {
fn eq(&self, other: &fpreg32) -> bool {
self.fpr_env == other.fpr_env &&
self.fpr_acc == other.fpr_acc &&
self.fpr_ex_sw == other.fpr_ex_sw &&
self.fpr_pad
.iter()
.zip(other.fpr_pad.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for fpreg32 {}
impl ::fmt::Debug for fpreg32 {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("fpreg32")
.field("fpr_env", &&self.fpr_env[..])
.field("fpr_acc", &self.fpr_acc)
.field("fpr_ex_sw", &self.fpr_ex_sw)
.field("fpr_pad", &&self.fpr_pad[..])
.finish()
}
}
impl ::hash::Hash for fpreg32 {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.fpr_env.hash(state);
self.fpr_acc.hash(state);
self.fpr_ex_sw.hash(state);
self.fpr_pad.hash(state);
}
}
impl PartialEq for fpreg {
fn eq(&self, other: &fpreg) -> bool {
self.fpr_env == other.fpr_env &&
self.fpr_acc == other.fpr_acc &&
self.fpr_xacc == other.fpr_xacc &&
self.fpr_spare == other.fpr_spare
}
}
impl Eq for fpreg {}
impl ::fmt::Debug for fpreg {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("fpreg")
.field("fpr_env", &self.fpr_env)
.field("fpr_acc", &self.fpr_acc)
.field("fpr_xacc", &self.fpr_xacc)
.field("fpr_spare", &self.fpr_spare)
.finish()
}
}
impl ::hash::Hash for fpreg {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.fpr_env.hash(state);
self.fpr_acc.hash(state);
self.fpr_xacc.hash(state);
self.fpr_spare.hash(state);
}
}
impl PartialEq for xmmreg {
fn eq(&self, other: &xmmreg) -> bool {
self.xmm_env == other.xmm_env &&
self.xmm_acc == other.xmm_acc &&
self.xmm_reg == other.xmm_reg &&
self.xmm_pad
.iter()
.zip(other.xmm_pad.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for xmmreg {}
impl ::fmt::Debug for xmmreg {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("xmmreg")
.field("xmm_env", &self.xmm_env)
.field("xmm_acc", &self.xmm_acc)
.field("xmm_reg", &self.xmm_reg)
.field("xmm_pad", &&self.xmm_pad[..])
.finish()
}
}
impl ::hash::Hash for xmmreg {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.xmm_env.hash(state);
self.xmm_acc.hash(state);
self.xmm_reg.hash(state);
self.xmm_pad.hash(state);
}
}
#[cfg(libc_union)]
impl PartialEq for __c_anonymous_elf64_auxv_union {
fn eq(&self, other: &__c_anonymous_elf64_auxv_union) -> bool {
unsafe { self.a_val == other.a_val
|| self.a_ptr == other.a_ptr
|| self.a_fcn == other.a_fcn }
}
}
#[cfg(libc_union)]
impl Eq for __c_anonymous_elf64_auxv_union {}
#[cfg(libc_union)]
impl ::fmt::Debug for __c_anonymous_elf64_auxv_union {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("a_val")
.field("a_val", unsafe { &self.a_val })
.finish()
}
}
#[cfg(not(libc_union))]
impl PartialEq for Elf64_Auxinfo {
fn eq(&self, other: &Elf64_Auxinfo) -> bool {
self.a_type == other.a_type
}
}
#[cfg(libc_union)]
impl PartialEq for Elf64_Auxinfo {
fn eq(&self, other: &Elf64_Auxinfo) -> bool {
self.a_type == other.a_type
&& self.a_un == other.a_un
}
}
impl Eq for Elf64_Auxinfo {}
#[cfg(not(libc_union))]
impl ::fmt::Debug for Elf64_Auxinfo {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("Elf64_Auxinfo")
.field("a_type", &self.a_type)
.finish()
}
}
#[cfg(libc_union)]
impl ::fmt::Debug for Elf64_Auxinfo {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("Elf64_Auxinfo")
.field("a_type", &self.a_type)
.field("a_un", &self.a_un)
.finish()
}
}
impl PartialEq for kinfo_file {
fn eq(&self, other: &kinfo_file) -> bool {
self.kf_structsize == other.kf_structsize &&
self.kf_type == other.kf_type &&
self.kf_fd == other.kf_fd &&
self.kf_ref_count == other.kf_ref_count &&
self.kf_flags == other.kf_flags &&
self.kf_offset == other.kf_offset &&
self.kf_status == other.kf_status &&
self.kf_cap_rights == other.kf_cap_rights &&
self.kf_path
.iter()
.zip(other.kf_path.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for kinfo_file {}
impl ::fmt::Debug for kinfo_file {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("kinfo_file")
.field("kf_structsize", &self.kf_structsize)
.field("kf_type", &self.kf_type)
.field("kf_fd", &self.kf_fd)
.field("kf_ref_count", &self.kf_ref_count)
.field("kf_flags", &self.kf_flags)
.field("kf_offset", &self.kf_offset)
.field("kf_status", &self.kf_status)
.field("kf_cap_rights", &self.kf_cap_rights)
.field("kf_path", &&self.kf_path[..])
.finish()
}
}
impl ::hash::Hash for kinfo_file {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.kf_structsize.hash(state);
self.kf_type.hash(state);
self.kf_fd.hash(state);
self.kf_ref_count.hash(state);
self.kf_flags.hash(state);
self.kf_offset.hash(state);
self.kf_status.hash(state);
self.kf_cap_rights.hash(state);
self.kf_path.hash(state);
}
}
}
}
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 8 - 1;
}
}
pub const MAP_32BIT: ::c_int = 0x00080000;
pub const MINSIGSTKSZ: ::size_t = 2048; // 512 * 4
pub const _MC_HASSEGS: u32 = 0x1;
pub const _MC_HASBASES: u32 = 0x2;
pub const _MC_HASFPXSTATE: u32 = 0x4;
pub const _MC_FLAG_MASK: u32 = _MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE;
pub const _MC_FPFMT_NODEV: c_long = 0x10000;
pub const _MC_FPFMT_XMM: c_long = 0x10002;
pub const _MC_FPOWNED_NONE: c_long = 0x20000;
pub const _MC_FPOWNED_FPU: c_long = 0x20001;
pub const _MC_FPOWNED_PCB: c_long = 0x20002;
cfg_if! {
if #[cfg(libc_align)] {
mod align;
pub use self::align::*;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,932 @@
pub type off_t = i64;
pub type useconds_t = u32;
pub type blkcnt_t = i64;
pub type socklen_t = u32;
pub type sa_family_t = u8;
pub type pthread_t = ::uintptr_t;
pub type nfds_t = ::c_uint;
pub type regoff_t = off_t;
s! {
pub struct sockaddr {
pub sa_len: u8,
pub sa_family: sa_family_t,
pub sa_data: [::c_char; 14],
}
pub struct sockaddr_in6 {
pub sin6_len: u8,
pub sin6_family: sa_family_t,
pub sin6_port: ::in_port_t,
pub sin6_flowinfo: u32,
pub sin6_addr: ::in6_addr,
pub sin6_scope_id: u32,
}
pub struct passwd {
pub pw_name: *mut ::c_char,
pub pw_passwd: *mut ::c_char,
pub pw_uid: ::uid_t,
pub pw_gid: ::gid_t,
pub pw_change: ::time_t,
pub pw_class: *mut ::c_char,
pub pw_gecos: *mut ::c_char,
pub pw_dir: *mut ::c_char,
pub pw_shell: *mut ::c_char,
pub pw_expire: ::time_t,
#[cfg(not(any(target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "netbsd",
target_os = "openbsd")))]
pub pw_fields: ::c_int,
}
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_dstaddr: *mut ::sockaddr,
pub ifa_data: *mut ::c_void,
#[cfg(target_os = "netbsd")]
pub ifa_addrflags: ::c_uint
}
pub struct fd_set {
#[cfg(all(target_pointer_width = "64",
any(target_os = "freebsd", target_os = "dragonfly")))]
fds_bits: [i64; FD_SETSIZE / 64],
#[cfg(not(all(target_pointer_width = "64",
any(target_os = "freebsd", target_os = "dragonfly"))))]
fds_bits: [i32; FD_SETSIZE / 32],
}
pub struct tm {
pub tm_sec: ::c_int,
pub tm_min: ::c_int,
pub tm_hour: ::c_int,
pub tm_mday: ::c_int,
pub tm_mon: ::c_int,
pub tm_year: ::c_int,
pub tm_wday: ::c_int,
pub tm_yday: ::c_int,
pub tm_isdst: ::c_int,
pub tm_gmtoff: ::c_long,
pub tm_zone: *mut ::c_char,
}
pub struct msghdr {
pub msg_name: *mut ::c_void,
pub msg_namelen: ::socklen_t,
pub msg_iov: *mut ::iovec,
pub msg_iovlen: ::c_int,
pub msg_control: *mut ::c_void,
pub msg_controllen: ::socklen_t,
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 fsid_t {
__fsid_val: [i32; 2],
}
pub struct if_nameindex {
pub if_index: ::c_uint,
pub if_name: *mut ::c_char,
}
pub struct regex_t {
__re_magic: ::c_int,
__re_nsub: ::size_t,
__re_endp: *const ::c_char,
__re_g: *mut ::c_void,
}
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 sockaddr_un {
pub sun_len: u8,
pub sun_family: sa_family_t,
pub sun_path: [c_char; 104]
}
pub struct utsname {
#[cfg(not(target_os = "dragonfly"))]
pub sysname: [::c_char; 256],
#[cfg(target_os = "dragonfly")]
pub sysname: [::c_char; 32],
#[cfg(not(target_os = "dragonfly"))]
pub nodename: [::c_char; 256],
#[cfg(target_os = "dragonfly")]
pub nodename: [::c_char; 32],
#[cfg(not(target_os = "dragonfly"))]
pub release: [::c_char; 256],
#[cfg(target_os = "dragonfly")]
pub release: [::c_char; 32],
#[cfg(not(target_os = "dragonfly"))]
pub version: [::c_char; 256],
#[cfg(target_os = "dragonfly")]
pub version: [::c_char; 32],
#[cfg(not(target_os = "dragonfly"))]
pub machine: [::c_char; 256],
#[cfg(target_os = "dragonfly")]
pub machine: [::c_char; 32],
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for sockaddr_un {
fn eq(&self, other: &sockaddr_un) -> bool {
self.sun_len == other.sun_len
&& self.sun_family == other.sun_family
&& self
.sun_path
.iter()
.zip(other.sun_path.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for sockaddr_un {}
impl ::fmt::Debug for sockaddr_un {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("sockaddr_un")
.field("sun_len", &self.sun_len)
.field("sun_family", &self.sun_family)
// FIXME: .field("sun_path", &self.sun_path)
.finish()
}
}
impl ::hash::Hash for sockaddr_un {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.sun_len.hash(state);
self.sun_family.hash(state);
self.sun_path.hash(state);
}
}
impl PartialEq for utsname {
fn eq(&self, other: &utsname) -> bool {
self.sysname
.iter()
.zip(other.sysname.iter())
.all(|(a,b)| a == b)
&& self
.nodename
.iter()
.zip(other.nodename.iter())
.all(|(a,b)| a == b)
&& self
.release
.iter()
.zip(other.release.iter())
.all(|(a,b)| a == b)
&& self
.version
.iter()
.zip(other.version.iter())
.all(|(a,b)| a == b)
&& self
.machine
.iter()
.zip(other.machine.iter())
.all(|(a,b)| a == b)
}
}
impl Eq for utsname {}
impl ::fmt::Debug for utsname {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("utsname")
// FIXME: .field("sysname", &self.sysname)
// FIXME: .field("nodename", &self.nodename)
// FIXME: .field("release", &self.release)
// FIXME: .field("version", &self.version)
// FIXME: .field("machine", &self.machine)
.finish()
}
}
impl ::hash::Hash for utsname {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.sysname.hash(state);
self.nodename.hash(state);
self.release.hash(state);
self.version.hash(state);
self.machine.hash(state);
}
}
}
}
pub const LC_ALL: ::c_int = 0;
pub const LC_COLLATE: ::c_int = 1;
pub const LC_CTYPE: ::c_int = 2;
pub const LC_MONETARY: ::c_int = 3;
pub const LC_NUMERIC: ::c_int = 4;
pub const LC_TIME: ::c_int = 5;
pub const LC_MESSAGES: ::c_int = 6;
pub const FIOCLEX: ::c_ulong = 0x20006601;
pub const FIONCLEX: ::c_ulong = 0x20006602;
pub const FIONREAD: ::c_ulong = 0x4004667f;
pub const FIONBIO: ::c_ulong = 0x8004667e;
pub const FIOASYNC: ::c_ulong = 0x8004667d;
pub const FIOSETOWN: ::c_ulong = 0x8004667c;
pub const FIOGETOWN: ::c_ulong = 0x4004667b;
pub const PATH_MAX: ::c_int = 1024;
pub const MAXPATHLEN: ::c_int = PATH_MAX;
pub const IOV_MAX: ::c_int = 1024;
pub const SA_ONSTACK: ::c_int = 0x0001;
pub const SA_SIGINFO: ::c_int = 0x0040;
pub const SA_RESTART: ::c_int = 0x0002;
pub const SA_RESETHAND: ::c_int = 0x0004;
pub const SA_NOCLDSTOP: ::c_int = 0x0008;
pub const SA_NODEFER: ::c_int = 0x0010;
pub const SA_NOCLDWAIT: ::c_int = 0x0020;
pub const SS_ONSTACK: ::c_int = 1;
pub const SS_DISABLE: ::c_int = 4;
pub const SIGCHLD: ::c_int = 20;
pub const SIGBUS: ::c_int = 10;
pub const SIGUSR1: ::c_int = 30;
pub const SIGUSR2: ::c_int = 31;
pub const SIGCONT: ::c_int = 19;
pub const SIGSTOP: ::c_int = 17;
pub const SIGTSTP: ::c_int = 18;
pub const SIGURG: ::c_int = 16;
pub const SIGIO: ::c_int = 23;
pub const SIGSYS: ::c_int = 12;
pub const SIGTTIN: ::c_int = 21;
pub const SIGTTOU: ::c_int = 22;
pub const SIGXCPU: ::c_int = 24;
pub const SIGXFSZ: ::c_int = 25;
pub const SIGVTALRM: ::c_int = 26;
pub const SIGPROF: ::c_int = 27;
pub const SIGWINCH: ::c_int = 28;
pub const SIGINFO: ::c_int = 29;
pub const SIG_SETMASK: ::c_int = 3;
pub const SIG_BLOCK: ::c_int = 0x1;
pub const SIG_UNBLOCK: ::c_int = 0x2;
pub const IP_TOS: ::c_int = 3;
pub const IP_MULTICAST_IF: ::c_int = 9;
pub const IP_MULTICAST_TTL: ::c_int = 10;
pub const IP_MULTICAST_LOOP: ::c_int = 11;
pub const IPV6_UNICAST_HOPS: ::c_int = 4;
pub const IPV6_MULTICAST_IF: ::c_int = 9;
pub const IPV6_MULTICAST_HOPS: ::c_int = 10;
pub const IPV6_MULTICAST_LOOP: ::c_int = 11;
pub const IPV6_V6ONLY: ::c_int = 27;
pub const IPTOS_ECN_NOTECT: 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 ST_RDONLY: ::c_ulong = 1;
pub const SCM_RIGHTS: ::c_int = 0x01;
pub const NCCS: usize = 20;
pub const O_ACCMODE: ::c_int = 0x3;
pub const O_RDONLY: ::c_int = 0;
pub const O_WRONLY: ::c_int = 1;
pub const O_RDWR: ::c_int = 2;
pub const O_APPEND: ::c_int = 8;
pub const O_CREAT: ::c_int = 512;
pub const O_TRUNC: ::c_int = 1024;
pub const O_EXCL: ::c_int = 2048;
pub const O_ASYNC: ::c_int = 0x40;
pub const O_SYNC: ::c_int = 0x80;
pub const O_NONBLOCK: ::c_int = 0x4;
pub const O_NOFOLLOW: ::c_int = 0x100;
pub const O_SHLOCK: ::c_int = 0x10;
pub const O_EXLOCK: ::c_int = 0x20;
pub const O_FSYNC: ::c_int = O_SYNC;
pub const O_NDELAY: ::c_int = O_NONBLOCK;
pub const F_GETOWN: ::c_int = 5;
pub const F_SETOWN: ::c_int = 6;
pub const F_RDLCK: ::c_short = 1;
pub const F_UNLCK: ::c_short = 2;
pub const F_WRLCK: ::c_short = 3;
pub const MNT_RDONLY: ::c_int = 0x00000001;
pub const MNT_SYNCHRONOUS: ::c_int = 0x00000002;
pub const MNT_NOEXEC: ::c_int = 0x00000004;
pub const MNT_NOSUID: ::c_int = 0x00000008;
pub const MNT_ASYNC: ::c_int = 0x00000040;
pub const MNT_EXPORTED: ::c_int = 0x00000100;
pub const MNT_UPDATE: ::c_int = 0x00010000;
pub const MNT_RELOAD: ::c_int = 0x00040000;
pub const MNT_FORCE: ::c_int = 0x00080000;
pub const Q_SYNC: ::c_int = 0x600;
pub const Q_QUOTAON: ::c_int = 0x100;
pub const Q_QUOTAOFF: ::c_int = 0x200;
pub const TCIOFF: ::c_int = 3;
pub const TCION: ::c_int = 4;
pub const TCOOFF: ::c_int = 1;
pub const TCOON: ::c_int = 2;
pub const TCIFLUSH: ::c_int = 1;
pub const TCOFLUSH: ::c_int = 2;
pub const TCIOFLUSH: ::c_int = 3;
pub const TCSANOW: ::c_int = 0;
pub const TCSADRAIN: ::c_int = 1;
pub const TCSAFLUSH: ::c_int = 2;
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 _POSIX_VDISABLE: ::cc_t = 0xff;
pub const IGNBRK: ::tcflag_t = 0x00000001;
pub const BRKINT: ::tcflag_t = 0x00000002;
pub const IGNPAR: ::tcflag_t = 0x00000004;
pub const PARMRK: ::tcflag_t = 0x00000008;
pub const INPCK: ::tcflag_t = 0x00000010;
pub const ISTRIP: ::tcflag_t = 0x00000020;
pub const INLCR: ::tcflag_t = 0x00000040;
pub const IGNCR: ::tcflag_t = 0x00000080;
pub const ICRNL: ::tcflag_t = 0x00000100;
pub const IXON: ::tcflag_t = 0x00000200;
pub const IXOFF: ::tcflag_t = 0x00000400;
pub const IXANY: ::tcflag_t = 0x00000800;
pub const IMAXBEL: ::tcflag_t = 0x00002000;
pub const OPOST: ::tcflag_t = 0x1;
pub const ONLCR: ::tcflag_t = 0x2;
pub const OXTABS: ::tcflag_t = 0x4;
pub const ONOEOT: ::tcflag_t = 0x8;
pub const CIGNORE: ::tcflag_t = 0x00000001;
pub const CSIZE: ::tcflag_t = 0x00000300;
pub const CS5: ::tcflag_t = 0x00000000;
pub const CS6: ::tcflag_t = 0x00000100;
pub const CS7: ::tcflag_t = 0x00000200;
pub const CS8: ::tcflag_t = 0x00000300;
pub const CSTOPB: ::tcflag_t = 0x00000400;
pub const CREAD: ::tcflag_t = 0x00000800;
pub const PARENB: ::tcflag_t = 0x00001000;
pub const PARODD: ::tcflag_t = 0x00002000;
pub const HUPCL: ::tcflag_t = 0x00004000;
pub const CLOCAL: ::tcflag_t = 0x00008000;
pub const ECHOKE: ::tcflag_t = 0x00000001;
pub const ECHOE: ::tcflag_t = 0x00000002;
pub const ECHOK: ::tcflag_t = 0x00000004;
pub const ECHO: ::tcflag_t = 0x00000008;
pub const ECHONL: ::tcflag_t = 0x00000010;
pub const ECHOPRT: ::tcflag_t = 0x00000020;
pub const ECHOCTL: ::tcflag_t = 0x00000040;
pub const ISIG: ::tcflag_t = 0x00000080;
pub const ICANON: ::tcflag_t = 0x00000100;
pub const ALTWERASE: ::tcflag_t = 0x00000200;
pub const IEXTEN: ::tcflag_t = 0x00000400;
pub const EXTPROC: ::tcflag_t = 0x00000800;
pub const TOSTOP: ::tcflag_t = 0x00400000;
pub const FLUSHO: ::tcflag_t = 0x00800000;
pub const NOKERNINFO: ::tcflag_t = 0x02000000;
pub const PENDIN: ::tcflag_t = 0x20000000;
pub const NOFLSH: ::tcflag_t = 0x80000000;
pub const MDMBUF: ::tcflag_t = 0x00100000;
pub const WNOHANG: ::c_int = 0x00000001;
pub const WUNTRACED: ::c_int = 0x00000002;
pub const RTLD_LAZY: ::c_int = 0x1;
pub const RTLD_NOW: ::c_int = 0x2;
pub const RTLD_NEXT: *mut ::c_void = -1isize as *mut ::c_void;
pub const RTLD_DEFAULT: *mut ::c_void = -2isize as *mut ::c_void;
pub const RTLD_SELF: *mut ::c_void = -3isize as *mut ::c_void;
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;
pub const TCP_NODELAY: ::c_int = 1;
pub const TCP_MAXSEG: ::c_int = 2;
pub const PIPE_BUF: usize = 512;
// si_code values for SIGBUS signal
pub const BUS_ADRALN: ::c_int = 1;
pub const BUS_ADRERR: ::c_int = 2;
pub const BUS_OBJERR: ::c_int = 3;
// si_code values for SIGCHLD signal
pub const CLD_EXITED: ::c_int = 1;
pub const CLD_KILLED: ::c_int = 2;
pub const CLD_DUMPED: ::c_int = 3;
pub const CLD_TRAPPED: ::c_int = 4;
pub const CLD_STOPPED: ::c_int = 5;
pub const CLD_CONTINUED: ::c_int = 6;
pub const POLLIN: ::c_short = 0x1;
pub const POLLPRI: ::c_short = 0x2;
pub const POLLOUT: ::c_short = 0x4;
pub const POLLERR: ::c_short = 0x8;
pub const POLLHUP: ::c_short = 0x10;
pub const POLLNVAL: ::c_short = 0x20;
pub const POLLRDNORM: ::c_short = 0x040;
pub const POLLWRNORM: ::c_short = 0x004;
pub const POLLRDBAND: ::c_short = 0x080;
pub const POLLWRBAND: ::c_short = 0x100;
pub const BIOCGBLEN: ::c_ulong = 0x40044266;
pub const BIOCSBLEN: ::c_ulong = 0xc0044266;
pub const BIOCFLUSH: ::c_uint = 0x20004268;
pub const BIOCPROMISC: ::c_uint = 0x20004269;
pub const BIOCGDLT: ::c_ulong = 0x4004426a;
pub const BIOCGETIF: ::c_ulong = 0x4020426b;
pub const BIOCSETIF: ::c_ulong = 0x8020426c;
pub const BIOCGSTATS: ::c_ulong = 0x4008426f;
pub const BIOCIMMEDIATE: ::c_ulong = 0x80044270;
pub const BIOCVERSION: ::c_ulong = 0x40044271;
pub const BIOCGHDRCMPLT: ::c_ulong = 0x40044274;
pub const BIOCSHDRCMPLT: ::c_ulong = 0x80044275;
pub const SIOCGIFADDR: ::c_ulong = 0xc0206921;
pub const REG_BASIC: ::c_int = 0o0000;
pub const REG_EXTENDED: ::c_int = 0o0001;
pub const REG_ICASE: ::c_int = 0o0002;
pub const REG_NOSUB: ::c_int = 0o0004;
pub const REG_NEWLINE: ::c_int = 0o0010;
pub const REG_NOSPEC: ::c_int = 0o0020;
pub const REG_PEND: ::c_int = 0o0040;
pub const REG_DUMP: ::c_int = 0o0200;
pub const REG_NOMATCH: ::c_int = 1;
pub const REG_BADPAT: ::c_int = 2;
pub const REG_ECOLLATE: ::c_int = 3;
pub const REG_ECTYPE: ::c_int = 4;
pub const REG_EESCAPE: ::c_int = 5;
pub const REG_ESUBREG: ::c_int = 6;
pub const REG_EBRACK: ::c_int = 7;
pub const REG_EPAREN: ::c_int = 8;
pub const REG_EBRACE: ::c_int = 9;
pub const REG_BADBR: ::c_int = 10;
pub const REG_ERANGE: ::c_int = 11;
pub const REG_ESPACE: ::c_int = 12;
pub const REG_BADRPT: ::c_int = 13;
pub const REG_EMPTY: ::c_int = 14;
pub const REG_ASSERT: ::c_int = 15;
pub const REG_INVARG: ::c_int = 16;
pub const REG_ATOI: ::c_int = 255;
pub const REG_ITOA: ::c_int = 0o0400;
pub const REG_NOTBOL: ::c_int = 0o00001;
pub const REG_NOTEOL: ::c_int = 0o00002;
pub const REG_STARTEND: ::c_int = 0o00004;
pub const REG_TRACE: ::c_int = 0o00400;
pub const REG_LARGE: ::c_int = 0o01000;
pub const REG_BACKR: ::c_int = 0o02000;
pub const TIOCCBRK: ::c_uint = 0x2000747a;
pub const TIOCSBRK: ::c_uint = 0x2000747b;
pub const PRIO_PROCESS: ::c_int = 0;
pub const PRIO_PGRP: ::c_int = 1;
pub const PRIO_USER: ::c_int = 2;
pub const ITIMER_REAL: ::c_int = 0;
pub const ITIMER_VIRTUAL: ::c_int = 1;
pub const ITIMER_PROF: ::c_int = 2;
f! {
pub fn CMSG_FIRSTHDR(mhdr: *const ::msghdr) -> *mut ::cmsghdr {
if (*mhdr).msg_controllen as usize >= ::mem::size_of::<::cmsghdr>() {
(*mhdr).msg_control as *mut ::cmsghdr
} else {
0 as *mut ::cmsghdr
}
}
pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
let fd = fd as usize;
(*set).fds_bits[fd / bits] &= !(1 << (fd % bits));
return
}
pub fn FD_ISSET(fd: ::c_int, set: *const fd_set) -> bool {
let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
let fd = fd as usize;
return ((*set).fds_bits[fd / bits] & (1 << (fd % bits))) != 0
}
pub fn FD_SET(fd: ::c_int, set: *mut fd_set) -> () {
let bits = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
let fd = fd as usize;
(*set).fds_bits[fd / bits] |= 1 << (fd % bits);
return
}
pub fn FD_ZERO(set: *mut fd_set) -> () {
for slot in (*set).fds_bits.iter_mut() {
*slot = 0;
}
}
}
safe_f! {
pub {const} fn WTERMSIG(status: ::c_int) -> ::c_int {
status & 0o177
}
pub {const} fn WIFEXITED(status: ::c_int) -> bool {
(status & 0o177) == 0
}
pub {const} fn WEXITSTATUS(status: ::c_int) -> ::c_int {
status >> 8
}
pub {const} fn WCOREDUMP(status: ::c_int) -> bool {
(status & 0o200) != 0
}
pub {const} fn QCMD(cmd: ::c_int, type_: ::c_int) -> ::c_int {
(cmd << 8) | (type_ & 0x00ff)
}
}
extern "C" {
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "getrlimit$UNIX2003"
)]
pub fn getrlimit(resource: ::c_int, rlim: *mut ::rlimit) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "setrlimit$UNIX2003"
)]
pub fn setrlimit(resource: ::c_int, rlim: *const ::rlimit) -> ::c_int;
pub fn strerror_r(errnum: ::c_int, buf: *mut c_char, buflen: ::size_t) -> ::c_int;
pub fn abs(i: ::c_int) -> ::c_int;
pub fn labs(i: ::c_long) -> ::c_long;
#[cfg_attr(
all(target_os = "freebsd", any(freebsd12, freebsd11, freebsd10)),
link_name = "rand@FBSD_1.0"
)]
pub fn rand() -> ::c_int;
#[cfg_attr(
all(target_os = "freebsd", any(freebsd12, freebsd11, freebsd10)),
link_name = "srand@FBSD_1.0"
)]
pub fn srand(seed: ::c_uint);
pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
pub fn freeifaddrs(ifa: *mut ::ifaddrs);
pub fn setgroups(ngroups: ::c_int, ptr: *const ::gid_t) -> ::c_int;
pub fn setlogin(name: *const ::c_char) -> ::c_int;
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
pub fn kqueue() -> ::c_int;
pub fn unmount(target: *const ::c_char, arg: ::c_int) -> ::c_int;
pub fn syscall(num: ::c_int, ...) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__getpwent50")]
pub fn getpwent() -> *mut passwd;
pub fn setpwent();
pub fn endpwent();
pub fn endgrent();
pub fn getgrent() -> *mut ::group;
pub fn getprogname() -> *const ::c_char;
pub fn setprogname(name: *const ::c_char);
pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
pub fn if_nameindex() -> *mut if_nameindex;
pub fn if_freenameindex(ptr: *mut if_nameindex);
pub fn getpeereid(socket: ::c_int, euid: *mut ::uid_t, egid: *mut ::gid_t) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", not(target_arch = "aarch64")),
link_name = "glob$INODE64"
)]
#[cfg_attr(target_os = "netbsd", link_name = "__glob30")]
#[cfg_attr(
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "glob@FBSD_1.0"
)]
pub fn glob(
pattern: *const ::c_char,
flags: ::c_int,
errfunc: ::Option<extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>,
pglob: *mut ::glob_t,
) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__globfree30")]
#[cfg_attr(
all(target_os = "freebsd", any(freebsd11, freebsd10)),
link_name = "globfree@FBSD_1.0"
)]
pub fn globfree(pglob: *mut ::glob_t);
pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86_64"),
link_name = "seekdir$INODE64"
)]
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "seekdir$INODE64$UNIX2003"
)]
pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
#[cfg_attr(
all(target_os = "macos", target_arch = "x86_64"),
link_name = "telldir$INODE64"
)]
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "telldir$INODE64$UNIX2003"
)]
pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
pub fn madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "msync$UNIX2003"
)]
#[cfg_attr(target_os = "netbsd", link_name = "__msync13")]
pub fn msync(addr: *mut ::c_void, len: ::size_t, flags: ::c_int) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "recvfrom$UNIX2003"
)]
pub fn recvfrom(
socket: ::c_int,
buf: *mut ::c_void,
len: ::size_t,
flags: ::c_int,
addr: *mut ::sockaddr,
addrlen: *mut ::socklen_t,
) -> ::ssize_t;
pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__futimes50")]
pub fn futimes(fd: ::c_int, times: *const ::timeval) -> ::c_int;
pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "bind$UNIX2003"
)]
pub fn bind(socket: ::c_int, address: *const ::sockaddr, address_len: ::socklen_t) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "writev$UNIX2003"
)]
pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "readv$UNIX2003"
)]
pub fn readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "sendmsg$UNIX2003"
)]
pub fn sendmsg(fd: ::c_int, msg: *const ::msghdr, flags: ::c_int) -> ::ssize_t;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "recvmsg$UNIX2003"
)]
pub fn recvmsg(fd: ::c_int, msg: *mut ::msghdr, flags: ::c_int) -> ::ssize_t;
pub fn sync();
pub fn getgrgid_r(
gid: ::gid_t,
grp: *mut ::group,
buf: *mut ::c_char,
buflen: ::size_t,
result: *mut *mut ::group,
) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "sigaltstack$UNIX2003"
)]
#[cfg_attr(target_os = "netbsd", link_name = "__sigaltstack14")]
pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
pub fn sem_close(sem: *mut sem_t) -> ::c_int;
pub fn getdtablesize() -> ::c_int;
pub fn getgrnam_r(
name: *const ::c_char,
grp: *mut ::group,
buf: *mut ::c_char,
buflen: ::size_t,
result: *mut *mut ::group,
) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "pthread_sigmask$UNIX2003"
)]
pub fn pthread_sigmask(how: ::c_int, set: *const sigset_t, oldset: *mut sigset_t) -> ::c_int;
pub fn sem_open(name: *const ::c_char, oflag: ::c_int, ...) -> *mut sem_t;
pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "pthread_cancel$UNIX2003"
)]
pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int;
pub fn pthread_kill(thread: ::pthread_t, sig: ::c_int) -> ::c_int;
pub fn sched_get_priority_min(policy: ::c_int) -> ::c_int;
pub fn sched_get_priority_max(policy: ::c_int) -> ::c_int;
pub fn sem_unlink(name: *const ::c_char) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__getpwnam_r50")]
pub fn getpwnam_r(
name: *const ::c_char,
pwd: *mut passwd,
buf: *mut ::c_char,
buflen: ::size_t,
result: *mut *mut passwd,
) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__getpwuid_r50")]
pub fn getpwuid_r(
uid: ::uid_t,
pwd: *mut passwd,
buf: *mut ::c_char,
buflen: ::size_t,
result: *mut *mut passwd,
) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "sigwait$UNIX2003"
)]
pub fn sigwait(set: *const sigset_t, sig: *mut ::c_int) -> ::c_int;
pub fn pthread_atfork(
prepare: ::Option<unsafe extern "C" fn()>,
parent: ::Option<unsafe extern "C" fn()>,
child: ::Option<unsafe extern "C" fn()>,
) -> ::c_int;
pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "popen$UNIX2003"
)]
pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
pub fn faccessat(
dirfd: ::c_int,
pathname: *const ::c_char,
mode: ::c_int,
flags: ::c_int,
) -> ::c_int;
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 acct(filename: *const ::c_char) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "wait4$UNIX2003"
)]
#[cfg_attr(
all(target_os = "freebsd", any(freebsd12, freebsd11, freebsd10)),
link_name = "wait4@FBSD_1.0"
)]
pub fn wait4(
pid: ::pid_t,
status: *mut ::c_int,
options: ::c_int,
rusage: *mut ::rusage,
) -> ::pid_t;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "getitimer$UNIX2003"
)]
pub fn getitimer(which: ::c_int, curr_value: *mut ::itimerval) -> ::c_int;
#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
link_name = "setitimer$UNIX2003"
)]
pub fn setitimer(
which: ::c_int,
new_value: *const ::itimerval,
old_value: *mut ::itimerval,
) -> ::c_int;
pub fn regcomp(preg: *mut regex_t, pattern: *const ::c_char, cflags: ::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 arc4random() -> u32;
pub fn arc4random_buf(buf: *mut ::c_void, size: ::size_t);
pub fn arc4random_uniform(l: u32) -> u32;
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 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 strftime(
buf: *mut ::c_char,
maxsize: ::size_t,
format: *const ::c_char,
timeptr: *const ::tm,
) -> ::size_t;
pub fn strftime_l(
buf: *mut ::c_char,
maxsize: ::size_t,
format: *const ::c_char,
timeptr: *const ::tm,
locale: ::locale_t,
) -> ::size_t;
}
cfg_if! {
if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))] {
mod apple;
pub use self::apple::*;
} else if #[cfg(any(target_os = "openbsd", target_os = "netbsd"))] {
mod netbsdlike;
pub use self::netbsdlike::*;
} else if #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] {
mod freebsdlike;
pub use self::freebsdlike::*;
} else {
// Unknown target_os
}
}

View file

@ -0,0 +1,863 @@
pub type wchar_t = i32;
pub type time_t = i64;
pub type mode_t = u32;
pub type nlink_t = u32;
pub type ino_t = u64;
pub type pthread_key_t = ::c_int;
pub type rlim_t = u64;
pub type speed_t = ::c_uint;
pub type tcflag_t = ::c_uint;
pub type nl_item = c_long;
pub type clockid_t = ::c_int;
pub type id_t = u32;
pub type sem_t = *mut sem;
pub type key_t = c_long;
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
impl ::Copy for timezone {}
impl ::Clone for timezone {
fn clone(&self) -> timezone {
*self
}
}
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum sem {}
impl ::Copy for sem {}
impl ::Clone for sem {
fn clone(&self) -> sem {
*self
}
}
s! {
pub struct sched_param {
pub sched_priority: ::c_int,
}
pub struct sigaction {
pub sa_sigaction: ::sighandler_t,
pub sa_mask: ::sigset_t,
pub sa_flags: ::c_int,
}
pub struct stack_t {
pub ss_sp: *mut ::c_void,
pub ss_size: ::size_t,
pub ss_flags: ::c_int,
}
pub struct in6_pktinfo {
pub ipi6_addr: ::in6_addr,
pub ipi6_ifindex: ::c_uint,
}
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; ::NCCS],
pub c_ispeed: ::c_int,
pub c_ospeed: ::c_int,
}
pub struct flock {
pub l_start: ::off_t,
pub l_len: ::off_t,
pub l_pid: ::pid_t,
pub l_type: ::c_short,
pub l_whence: ::c_short,
}
pub struct ipc_perm {
pub cuid: ::uid_t,
pub cgid: ::gid_t,
pub uid: ::uid_t,
pub gid: ::gid_t,
pub mode: ::mode_t,
#[cfg(target_os = "openbsd")]
pub seq: ::c_ushort,
#[cfg(target_os = "netbsd")]
pub _seq: ::c_ushort,
#[cfg(target_os = "openbsd")]
pub key: ::key_t,
#[cfg(target_os = "netbsd")]
pub _key: ::key_t,
}
pub struct ptrace_io_desc {
pub piod_op: ::c_int,
pub piod_offs: *mut ::c_void,
pub piod_addr: *mut ::c_void,
pub piod_len: ::size_t,
}
}
pub const D_T_FMT: ::nl_item = 0;
pub const D_FMT: ::nl_item = 1;
pub const T_FMT: ::nl_item = 2;
pub const T_FMT_AMPM: ::nl_item = 3;
pub const AM_STR: ::nl_item = 4;
pub const PM_STR: ::nl_item = 5;
pub const DAY_1: ::nl_item = 6;
pub const DAY_2: ::nl_item = 7;
pub const DAY_3: ::nl_item = 8;
pub const DAY_4: ::nl_item = 9;
pub const DAY_5: ::nl_item = 10;
pub const DAY_6: ::nl_item = 11;
pub const DAY_7: ::nl_item = 12;
pub const ABDAY_1: ::nl_item = 13;
pub const ABDAY_2: ::nl_item = 14;
pub const ABDAY_3: ::nl_item = 15;
pub const ABDAY_4: ::nl_item = 16;
pub const ABDAY_5: ::nl_item = 17;
pub const ABDAY_6: ::nl_item = 18;
pub const ABDAY_7: ::nl_item = 19;
pub const MON_1: ::nl_item = 20;
pub const MON_2: ::nl_item = 21;
pub const MON_3: ::nl_item = 22;
pub const MON_4: ::nl_item = 23;
pub const MON_5: ::nl_item = 24;
pub const MON_6: ::nl_item = 25;
pub const MON_7: ::nl_item = 26;
pub const MON_8: ::nl_item = 27;
pub const MON_9: ::nl_item = 28;
pub const MON_10: ::nl_item = 29;
pub const MON_11: ::nl_item = 30;
pub const MON_12: ::nl_item = 31;
pub const ABMON_1: ::nl_item = 32;
pub const ABMON_2: ::nl_item = 33;
pub const ABMON_3: ::nl_item = 34;
pub const ABMON_4: ::nl_item = 35;
pub const ABMON_5: ::nl_item = 36;
pub const ABMON_6: ::nl_item = 37;
pub const ABMON_7: ::nl_item = 38;
pub const ABMON_8: ::nl_item = 39;
pub const ABMON_9: ::nl_item = 40;
pub const ABMON_10: ::nl_item = 41;
pub const ABMON_11: ::nl_item = 42;
pub const ABMON_12: ::nl_item = 43;
pub const RADIXCHAR: ::nl_item = 44;
pub const THOUSEP: ::nl_item = 45;
pub const YESSTR: ::nl_item = 46;
pub const YESEXPR: ::nl_item = 47;
pub const NOSTR: ::nl_item = 48;
pub const NOEXPR: ::nl_item = 49;
pub const CRNCYSTR: ::nl_item = 50;
pub const CODESET: ::nl_item = 51;
pub const EXIT_FAILURE: ::c_int = 1;
pub const EXIT_SUCCESS: ::c_int = 0;
pub const RAND_MAX: ::c_int = 2147483647;
pub const EOF: ::c_int = -1;
pub const SEEK_SET: ::c_int = 0;
pub const SEEK_CUR: ::c_int = 1;
pub const SEEK_END: ::c_int = 2;
pub const _IOFBF: ::c_int = 0;
pub const _IONBF: ::c_int = 2;
pub const _IOLBF: ::c_int = 1;
pub const BUFSIZ: ::c_uint = 1024;
pub const FOPEN_MAX: ::c_uint = 20;
pub const FILENAME_MAX: ::c_uint = 1024;
pub const L_tmpnam: ::c_uint = 1024;
pub const O_NOCTTY: ::c_int = 32768;
pub const S_IFIFO: mode_t = 4096;
pub const S_IFCHR: mode_t = 8192;
pub const S_IFBLK: mode_t = 24576;
pub const S_IFDIR: mode_t = 16384;
pub const S_IFREG: mode_t = 32768;
pub const S_IFLNK: mode_t = 40960;
pub const S_IFSOCK: mode_t = 49152;
pub const S_IFMT: mode_t = 61440;
pub const S_IEXEC: mode_t = 64;
pub const S_IWRITE: mode_t = 128;
pub const S_IREAD: mode_t = 256;
pub const S_IRWXU: mode_t = 448;
pub const S_IXUSR: mode_t = 64;
pub const S_IWUSR: mode_t = 128;
pub const S_IRUSR: mode_t = 256;
pub const S_IRWXG: mode_t = 56;
pub const S_IXGRP: mode_t = 8;
pub const S_IWGRP: mode_t = 16;
pub const S_IRGRP: mode_t = 32;
pub const S_IRWXO: mode_t = 7;
pub const S_IXOTH: mode_t = 1;
pub const S_IWOTH: mode_t = 2;
pub const S_IROTH: mode_t = 4;
pub const F_OK: ::c_int = 0;
pub const R_OK: ::c_int = 4;
pub const W_OK: ::c_int = 2;
pub const X_OK: ::c_int = 1;
pub const STDIN_FILENO: ::c_int = 0;
pub const STDOUT_FILENO: ::c_int = 1;
pub const STDERR_FILENO: ::c_int = 2;
pub const F_LOCK: ::c_int = 1;
pub const F_TEST: ::c_int = 3;
pub const F_TLOCK: ::c_int = 2;
pub const F_ULOCK: ::c_int = 0;
pub const F_GETLK: ::c_int = 7;
pub const F_SETLK: ::c_int = 8;
pub const F_SETLKW: ::c_int = 9;
pub const SIGHUP: ::c_int = 1;
pub const SIGINT: ::c_int = 2;
pub const SIGQUIT: ::c_int = 3;
pub const SIGILL: ::c_int = 4;
pub const SIGABRT: ::c_int = 6;
pub const SIGEMT: ::c_int = 7;
pub const SIGFPE: ::c_int = 8;
pub const SIGKILL: ::c_int = 9;
pub const SIGSEGV: ::c_int = 11;
pub const SIGPIPE: ::c_int = 13;
pub const SIGALRM: ::c_int = 14;
pub const SIGTERM: ::c_int = 15;
pub const PROT_NONE: ::c_int = 0;
pub const PROT_READ: ::c_int = 1;
pub const PROT_WRITE: ::c_int = 2;
pub const PROT_EXEC: ::c_int = 4;
pub const MAP_FILE: ::c_int = 0x0000;
pub const MAP_SHARED: ::c_int = 0x0001;
pub const MAP_PRIVATE: ::c_int = 0x0002;
pub const MAP_FIXED: ::c_int = 0x0010;
pub const MAP_ANON: ::c_int = 0x1000;
pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
pub const IPC_CREAT: ::c_int = 0o001000;
pub const IPC_EXCL: ::c_int = 0o002000;
pub const IPC_NOWAIT: ::c_int = 0o004000;
pub const IPC_PRIVATE: ::key_t = 0;
pub const IPC_RMID: ::c_int = 0;
pub const IPC_SET: ::c_int = 1;
pub const IPC_STAT: ::c_int = 2;
pub const IPC_R: ::c_int = 0o000400;
pub const IPC_W: ::c_int = 0o000200;
pub const IPC_M: ::c_int = 0o010000;
pub const SHM_R: ::c_int = IPC_R;
pub const SHM_W: ::c_int = IPC_W;
pub const MCL_CURRENT: ::c_int = 0x0001;
pub const MCL_FUTURE: ::c_int = 0x0002;
pub const MS_ASYNC: ::c_int = 0x0001;
pub const EPERM: ::c_int = 1;
pub const ENOENT: ::c_int = 2;
pub const ESRCH: ::c_int = 3;
pub const EINTR: ::c_int = 4;
pub const EIO: ::c_int = 5;
pub const ENXIO: ::c_int = 6;
pub const E2BIG: ::c_int = 7;
pub const ENOEXEC: ::c_int = 8;
pub const EBADF: ::c_int = 9;
pub const ECHILD: ::c_int = 10;
pub const EDEADLK: ::c_int = 11;
pub const ENOMEM: ::c_int = 12;
pub const EACCES: ::c_int = 13;
pub const EFAULT: ::c_int = 14;
pub const ENOTBLK: ::c_int = 15;
pub const EBUSY: ::c_int = 16;
pub const EEXIST: ::c_int = 17;
pub const EXDEV: ::c_int = 18;
pub const ENODEV: ::c_int = 19;
pub const ENOTDIR: ::c_int = 20;
pub const EISDIR: ::c_int = 21;
pub const EINVAL: ::c_int = 22;
pub const ENFILE: ::c_int = 23;
pub const EMFILE: ::c_int = 24;
pub const ENOTTY: ::c_int = 25;
pub const ETXTBSY: ::c_int = 26;
pub const EFBIG: ::c_int = 27;
pub const ENOSPC: ::c_int = 28;
pub const ESPIPE: ::c_int = 29;
pub const EROFS: ::c_int = 30;
pub const EMLINK: ::c_int = 31;
pub const EPIPE: ::c_int = 32;
pub const EDOM: ::c_int = 33;
pub const ERANGE: ::c_int = 34;
pub const EAGAIN: ::c_int = 35;
pub const EWOULDBLOCK: ::c_int = 35;
pub const EINPROGRESS: ::c_int = 36;
pub const EALREADY: ::c_int = 37;
pub const ENOTSOCK: ::c_int = 38;
pub const EDESTADDRREQ: ::c_int = 39;
pub const EMSGSIZE: ::c_int = 40;
pub const EPROTOTYPE: ::c_int = 41;
pub const ENOPROTOOPT: ::c_int = 42;
pub const EPROTONOSUPPORT: ::c_int = 43;
pub const ESOCKTNOSUPPORT: ::c_int = 44;
pub const EOPNOTSUPP: ::c_int = 45;
pub const EPFNOSUPPORT: ::c_int = 46;
pub const EAFNOSUPPORT: ::c_int = 47;
pub const EADDRINUSE: ::c_int = 48;
pub const EADDRNOTAVAIL: ::c_int = 49;
pub const ENETDOWN: ::c_int = 50;
pub const ENETUNREACH: ::c_int = 51;
pub const ENETRESET: ::c_int = 52;
pub const ECONNABORTED: ::c_int = 53;
pub const ECONNRESET: ::c_int = 54;
pub const ENOBUFS: ::c_int = 55;
pub const EISCONN: ::c_int = 56;
pub const ENOTCONN: ::c_int = 57;
pub const ESHUTDOWN: ::c_int = 58;
pub const ETOOMANYREFS: ::c_int = 59;
pub const ETIMEDOUT: ::c_int = 60;
pub const ECONNREFUSED: ::c_int = 61;
pub const ELOOP: ::c_int = 62;
pub const ENAMETOOLONG: ::c_int = 63;
pub const EHOSTDOWN: ::c_int = 64;
pub const EHOSTUNREACH: ::c_int = 65;
pub const ENOTEMPTY: ::c_int = 66;
pub const EPROCLIM: ::c_int = 67;
pub const EUSERS: ::c_int = 68;
pub const EDQUOT: ::c_int = 69;
pub const ESTALE: ::c_int = 70;
pub const EREMOTE: ::c_int = 71;
pub const EBADRPC: ::c_int = 72;
pub const ERPCMISMATCH: ::c_int = 73;
pub const EPROGUNAVAIL: ::c_int = 74;
pub const EPROGMISMATCH: ::c_int = 75;
pub const EPROCUNAVAIL: ::c_int = 76;
pub const ENOLCK: ::c_int = 77;
pub const ENOSYS: ::c_int = 78;
pub const EFTYPE: ::c_int = 79;
pub const EAUTH: ::c_int = 80;
pub const ENEEDAUTH: ::c_int = 81;
pub const F_DUPFD: ::c_int = 0;
pub const F_GETFD: ::c_int = 1;
pub const F_SETFD: ::c_int = 2;
pub const F_GETFL: ::c_int = 3;
pub const F_SETFL: ::c_int = 4;
pub const SIGTRAP: ::c_int = 5;
pub const GLOB_APPEND: ::c_int = 0x0001;
pub const GLOB_DOOFFS: ::c_int = 0x0002;
pub const GLOB_ERR: ::c_int = 0x0004;
pub const GLOB_MARK: ::c_int = 0x0008;
pub const GLOB_NOCHECK: ::c_int = 0x0010;
pub const GLOB_NOSORT: ::c_int = 0x0020;
pub const GLOB_NOESCAPE: ::c_int = 0x1000;
pub const GLOB_NOSPACE: ::c_int = -1;
pub const GLOB_ABORTED: ::c_int = -2;
pub const GLOB_NOMATCH: ::c_int = -3;
pub const GLOB_NOSYS: ::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_DONTNEED: ::c_int = 4;
pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01;
pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02;
pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_int = 0x04;
pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x08;
pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x10;
pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x20;
pub const PTHREAD_CREATE_JOINABLE: ::c_int = 0;
pub const PTHREAD_CREATE_DETACHED: ::c_int = 1;
pub const PIOD_READ_D: ::c_int = 1;
pub const PIOD_WRITE_D: ::c_int = 2;
pub const PIOD_READ_I: ::c_int = 3;
pub const PIOD_WRITE_I: ::c_int = 4;
pub const PIOD_READ_AUXV: ::c_int = 5;
pub const PT_TRACE_ME: ::c_int = 0;
pub const PT_READ_I: ::c_int = 1;
pub const PT_READ_D: ::c_int = 2;
pub const PT_WRITE_I: ::c_int = 4;
pub const PT_WRITE_D: ::c_int = 5;
pub const PT_CONTINUE: ::c_int = 7;
pub const PT_KILL: ::c_int = 8;
pub const PT_ATTACH: ::c_int = 9;
pub const PT_DETACH: ::c_int = 10;
pub const PT_IO: ::c_int = 11;
// http://man.openbsd.org/OpenBSD-current/man2/clock_getres.2
// The man page says clock_gettime(3) can accept various values as clockid_t but
// http://fxr.watson.org/fxr/source/kern/kern_time.c?v=OPENBSD;im=excerpts#L161
// the implementation rejects anything other than the below two
//
// http://netbsd.gw.com/cgi-bin/man-cgi?clock_gettime
// https://github.com/jsonn/src/blob/HEAD/sys/kern/subr_time.c#L222
// Basically the same goes for NetBSD
pub const CLOCK_REALTIME: ::clockid_t = 0;
pub const CLOCK_MONOTONIC: ::clockid_t = 3;
pub const RLIMIT_CPU: ::c_int = 0;
pub const RLIMIT_FSIZE: ::c_int = 1;
pub const RLIMIT_DATA: ::c_int = 2;
pub const RLIMIT_STACK: ::c_int = 3;
pub const RLIMIT_CORE: ::c_int = 4;
pub const RLIMIT_RSS: ::c_int = 5;
pub const RLIMIT_MEMLOCK: ::c_int = 6;
pub const RLIMIT_NPROC: ::c_int = 7;
pub const RLIMIT_NOFILE: ::c_int = 8;
pub const RLIM_INFINITY: rlim_t = 0x7fff_ffff_ffff_ffff;
pub const RLIM_SAVED_MAX: rlim_t = RLIM_INFINITY;
pub const RLIM_SAVED_CUR: rlim_t = RLIM_INFINITY;
pub const RUSAGE_SELF: ::c_int = 0;
pub const RUSAGE_CHILDREN: ::c_int = -1;
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 MADV_FREE: ::c_int = 6;
// sys/fstypes.h in NetBSD, or sys/mount.h in OpenBSD
pub const MNT_NODEV: ::c_int = 0x00000010;
pub const MNT_LOCAL: ::c_int = 0x00001000;
pub const MNT_QUOTA: ::c_int = 0x00002000;
pub const AF_UNSPEC: ::c_int = 0;
pub const AF_LOCAL: ::c_int = 1;
pub const AF_UNIX: ::c_int = AF_LOCAL;
pub const AF_INET: ::c_int = 2;
pub const AF_IMPLINK: ::c_int = 3;
pub const AF_PUP: ::c_int = 4;
pub const AF_CHAOS: ::c_int = 5;
pub const AF_NS: ::c_int = 6;
pub const AF_ISO: ::c_int = 7;
pub const AF_OSI: ::c_int = AF_ISO;
pub const AF_DATAKIT: ::c_int = 9;
pub const AF_CCITT: ::c_int = 10;
pub const AF_SNA: ::c_int = 11;
pub const AF_DECnet: ::c_int = 12;
pub const AF_DLI: ::c_int = 13;
pub const AF_LAT: ::c_int = 14;
pub const AF_HYLINK: ::c_int = 15;
pub const AF_APPLETALK: ::c_int = 16;
pub const AF_LINK: ::c_int = 18;
pub const pseudo_AF_XTP: ::c_int = 19;
pub const AF_COIP: ::c_int = 20;
pub const AF_CNT: ::c_int = 21;
pub const pseudo_AF_RTIP: ::c_int = 22;
pub const AF_IPX: ::c_int = 23;
pub const AF_INET6: ::c_int = 24;
pub const pseudo_AF_PIP: ::c_int = 25;
pub const AF_ISDN: ::c_int = 26;
pub const AF_E164: ::c_int = AF_ISDN;
pub const AF_NATM: ::c_int = 27;
pub const PF_UNSPEC: ::c_int = AF_UNSPEC;
pub const PF_LOCAL: ::c_int = AF_LOCAL;
pub const PF_UNIX: ::c_int = PF_LOCAL;
pub const PF_INET: ::c_int = AF_INET;
pub const PF_IMPLINK: ::c_int = AF_IMPLINK;
pub const PF_PUP: ::c_int = AF_PUP;
pub const PF_CHAOS: ::c_int = AF_CHAOS;
pub const PF_NS: ::c_int = AF_NS;
pub const PF_ISO: ::c_int = AF_ISO;
pub const PF_OSI: ::c_int = AF_ISO;
pub const PF_DATAKIT: ::c_int = AF_DATAKIT;
pub const PF_CCITT: ::c_int = AF_CCITT;
pub const PF_SNA: ::c_int = AF_SNA;
pub const PF_DECnet: ::c_int = AF_DECnet;
pub const PF_DLI: ::c_int = AF_DLI;
pub const PF_LAT: ::c_int = AF_LAT;
pub const PF_HYLINK: ::c_int = AF_HYLINK;
pub const PF_APPLETALK: ::c_int = AF_APPLETALK;
pub const PF_LINK: ::c_int = AF_LINK;
pub const PF_XTP: ::c_int = pseudo_AF_XTP;
pub const PF_COIP: ::c_int = AF_COIP;
pub const PF_CNT: ::c_int = AF_CNT;
pub const PF_IPX: ::c_int = AF_IPX;
pub const PF_INET6: ::c_int = AF_INET6;
pub const PF_RTIP: ::c_int = pseudo_AF_RTIP;
pub const PF_PIP: ::c_int = pseudo_AF_PIP;
pub const PF_ISDN: ::c_int = AF_ISDN;
pub const PF_NATM: ::c_int = AF_NATM;
pub const SOCK_STREAM: ::c_int = 1;
pub const SOCK_DGRAM: ::c_int = 2;
pub const SOCK_RAW: ::c_int = 3;
pub const SOCK_RDM: ::c_int = 4;
pub const SOCK_SEQPACKET: ::c_int = 5;
pub const IP_TTL: ::c_int = 4;
pub const IP_HDRINCL: ::c_int = 2;
pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
pub const IPV6_RECVPKTINFO: ::c_int = 36;
pub const IPV6_PKTINFO: ::c_int = 46;
pub const IPV6_RECVTCLASS: ::c_int = 57;
pub const IPV6_TCLASS: ::c_int = 61;
pub const SOL_SOCKET: ::c_int = 0xffff;
pub const SO_DEBUG: ::c_int = 0x01;
pub const SO_ACCEPTCONN: ::c_int = 0x0002;
pub const SO_REUSEADDR: ::c_int = 0x0004;
pub const SO_KEEPALIVE: ::c_int = 0x0008;
pub const SO_DONTROUTE: ::c_int = 0x0010;
pub const SO_BROADCAST: ::c_int = 0x0020;
pub const SO_USELOOPBACK: ::c_int = 0x0040;
pub const SO_LINGER: ::c_int = 0x0080;
pub const SO_OOBINLINE: ::c_int = 0x0100;
pub const SO_REUSEPORT: ::c_int = 0x0200;
pub const SO_SNDBUF: ::c_int = 0x1001;
pub const SO_RCVBUF: ::c_int = 0x1002;
pub const SO_SNDLOWAT: ::c_int = 0x1003;
pub const SO_RCVLOWAT: ::c_int = 0x1004;
pub const SO_ERROR: ::c_int = 0x1007;
pub const SO_TYPE: ::c_int = 0x1008;
pub const SOMAXCONN: ::c_int = 128;
pub const MSG_OOB: ::c_int = 0x1;
pub const MSG_PEEK: ::c_int = 0x2;
pub const MSG_DONTROUTE: ::c_int = 0x4;
pub const MSG_EOR: ::c_int = 0x8;
pub const MSG_TRUNC: ::c_int = 0x10;
pub const MSG_CTRUNC: ::c_int = 0x20;
pub const MSG_WAITALL: ::c_int = 0x40;
pub const MSG_DONTWAIT: ::c_int = 0x80;
pub const MSG_BCAST: ::c_int = 0x100;
pub const MSG_MCAST: ::c_int = 0x200;
pub const MSG_NOSIGNAL: ::c_int = 0x400;
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x800;
pub const SHUT_RD: ::c_int = 0;
pub const SHUT_WR: ::c_int = 1;
pub const SHUT_RDWR: ::c_int = 2;
pub const LOCK_SH: ::c_int = 1;
pub const LOCK_EX: ::c_int = 2;
pub const LOCK_NB: ::c_int = 4;
pub const LOCK_UN: ::c_int = 8;
pub const IPPROTO_RAW: ::c_int = 255;
pub const _SC_ARG_MAX: ::c_int = 1;
pub const _SC_CHILD_MAX: ::c_int = 2;
pub const _SC_NGROUPS_MAX: ::c_int = 4;
pub const _SC_OPEN_MAX: ::c_int = 5;
pub const _SC_JOB_CONTROL: ::c_int = 6;
pub const _SC_SAVED_IDS: ::c_int = 7;
pub const _SC_VERSION: ::c_int = 8;
pub const _SC_BC_BASE_MAX: ::c_int = 9;
pub const _SC_BC_DIM_MAX: ::c_int = 10;
pub const _SC_BC_SCALE_MAX: ::c_int = 11;
pub const _SC_BC_STRING_MAX: ::c_int = 12;
pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 13;
pub const _SC_EXPR_NEST_MAX: ::c_int = 14;
pub const _SC_LINE_MAX: ::c_int = 15;
pub const _SC_RE_DUP_MAX: ::c_int = 16;
pub const _SC_2_VERSION: ::c_int = 17;
pub const _SC_2_C_BIND: ::c_int = 18;
pub const _SC_2_C_DEV: ::c_int = 19;
pub const _SC_2_CHAR_TERM: ::c_int = 20;
pub const _SC_2_FORT_DEV: ::c_int = 21;
pub const _SC_2_FORT_RUN: ::c_int = 22;
pub const _SC_2_LOCALEDEF: ::c_int = 23;
pub const _SC_2_SW_DEV: ::c_int = 24;
pub const _SC_2_UPE: ::c_int = 25;
pub const _SC_STREAM_MAX: ::c_int = 26;
pub const _SC_TZNAME_MAX: ::c_int = 27;
pub const _SC_PAGESIZE: ::c_int = 28;
pub const _SC_PAGE_SIZE: ::c_int = _SC_PAGESIZE;
pub const _SC_FSYNC: ::c_int = 29;
pub const _SC_XOPEN_SHM: ::c_int = 30;
pub const Q_GETQUOTA: ::c_int = 0x300;
pub const Q_SETQUOTA: ::c_int = 0x400;
pub const RTLD_GLOBAL: ::c_int = 0x100;
pub const LOG_NFACILITIES: ::c_int = 24;
pub const HW_NCPU: ::c_int = 3;
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 B19200: speed_t = 19200;
pub const B38400: speed_t = 38400;
pub const B7200: speed_t = 7200;
pub const B14400: speed_t = 14400;
pub const B28800: speed_t = 28800;
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 EXTA: speed_t = 19200;
pub const EXTB: speed_t = 38400;
pub const SEM_FAILED: *mut sem_t = 0 as *mut sem_t;
pub const CRTSCTS: ::tcflag_t = 0x00010000;
pub const CRTS_IFLOW: ::tcflag_t = CRTSCTS;
pub const CCTS_OFLOW: ::tcflag_t = CRTSCTS;
pub const OCRNL: ::tcflag_t = 0x10;
pub const TIOCEXCL: ::c_ulong = 0x2000740d;
pub const TIOCNXCL: ::c_ulong = 0x2000740e;
pub const TIOCFLUSH: ::c_ulong = 0x80047410;
pub const TIOCGETA: ::c_ulong = 0x402c7413;
pub const TIOCSETA: ::c_ulong = 0x802c7414;
pub const TIOCSETAW: ::c_ulong = 0x802c7415;
pub const TIOCSETAF: ::c_ulong = 0x802c7416;
pub const TIOCGETD: ::c_ulong = 0x4004741a;
pub const TIOCSETD: ::c_ulong = 0x8004741b;
pub const TIOCMGET: ::c_ulong = 0x4004746a;
pub const TIOCMBIC: ::c_ulong = 0x8004746b;
pub const TIOCMBIS: ::c_ulong = 0x8004746c;
pub const TIOCMSET: ::c_ulong = 0x8004746d;
pub const TIOCSTART: ::c_ulong = 0x2000746e;
pub const TIOCSTOP: ::c_ulong = 0x2000746f;
pub const TIOCSCTTY: ::c_ulong = 0x20007461;
pub const TIOCGWINSZ: ::c_ulong = 0x40087468;
pub const TIOCSWINSZ: ::c_ulong = 0x80087467;
pub const TIOCM_LE: ::c_int = 0o0001;
pub const TIOCM_DTR: ::c_int = 0o0002;
pub const TIOCM_RTS: ::c_int = 0o0004;
pub const TIOCM_ST: ::c_int = 0o0010;
pub const TIOCM_SR: ::c_int = 0o0020;
pub const TIOCM_CTS: ::c_int = 0o0040;
pub const TIOCM_CAR: ::c_int = 0o0100;
pub const TIOCM_RNG: ::c_int = 0o0200;
pub const TIOCM_DSR: ::c_int = 0o0400;
pub const TIOCM_CD: ::c_int = TIOCM_CAR;
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;
pub const TCP_INFO: ::c_int = 9;
#[link(name = "util")]
extern "C" {
pub fn setgrent();
pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int;
pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
pub fn accept4(
s: ::c_int,
addr: *mut ::sockaddr,
addrlen: *mut ::socklen_t,
flags: ::c_int,
) -> ::c_int;
pub fn mincore(addr: *mut ::c_void, len: ::size_t, vec: *mut ::c_char) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__clock_getres50")]
pub fn clock_getres(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__clock_gettime50")]
pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__clock_settime50")]
pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
pub fn __errno() -> *mut ::c_int;
pub fn shm_open(name: *const ::c_char, oflag: ::c_int, mode: ::mode_t) -> ::c_int;
pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
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 pwritev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t)
-> ::ssize_t;
pub fn preadv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int, offset: ::off_t) -> ::ssize_t;
pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
pub fn utimensat(
dirfd: ::c_int,
path: *const ::c_char,
times: *const ::timespec,
flag: ::c_int,
) -> ::c_int;
pub fn fdatasync(fd: ::c_int) -> ::c_int;
pub fn login_tty(fd: ::c_int) -> ::c_int;
pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
pub fn mknodat(
dirfd: ::c_int,
pathname: *const ::c_char,
mode: ::mode_t,
dev: dev_t,
) -> ::c_int;
pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char, mode: ::mode_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 pthread_condattr_setclock(
attr: *mut pthread_condattr_t,
clock_id: ::clockid_t,
) -> ::c_int;
pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
pub fn pthread_mutex_timedlock(
lock: *mut pthread_mutex_t,
abstime: *const ::timespec,
) -> ::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_setschedparam(
native: ::pthread_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 pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
pub fn getgrouplist(
name: *const ::c_char,
basegid: ::gid_t,
groups: *mut ::gid_t,
ngroups: *mut ::c_int,
) -> ::c_int;
pub fn initgroups(name: *const ::c_char, basegid: ::gid_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 uname(buf: *mut ::utsname) -> ::c_int;
pub fn shmget(key: ::key_t, size: ::size_t, shmflg: ::c_int) -> ::c_int;
pub fn shmat(shmid: ::c_int, shmaddr: *const ::c_void, shmflg: ::c_int) -> *mut ::c_void;
pub fn shmdt(shmaddr: *const ::c_void) -> ::c_int;
pub fn shmctl(shmid: ::c_int, cmd: ::c_int, buf: *mut ::shmid_ds) -> ::c_int;
pub fn execvpe(
file: *const ::c_char,
argv: *const *const ::c_char,
envp: *const *const ::c_char,
) -> ::c_int;
pub fn waitid(
idtype: idtype_t,
id: ::id_t,
infop: *mut ::siginfo_t,
options: ::c_int,
) -> ::c_int;
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;
}
extern "C" {
pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
pub fn gethostid() -> ::c_long;
pub fn sethostid(hostid: ::c_long) -> ::c_int;
pub fn ftok(path: *const ::c_char, id: ::c_int) -> ::key_t;
pub fn dirname(path: *mut ::c_char) -> *mut ::c_char;
pub fn basename(path: *mut ::c_char) -> *mut ::c_char;
pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
}
cfg_if! {
if #[cfg(target_os = "netbsd")] {
mod netbsd;
pub use self::netbsd::*;
} else if #[cfg(target_os = "openbsd")] {
mod openbsd;
pub use self::openbsd::*;
} else {
// Unknown target_os
}
}

View file

@ -0,0 +1,162 @@
use PT_FIRSTMACH;
pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = u8;
pub type greg_t = u64;
pub type __cpu_simple_lock_nv_t = ::c_uchar;
s! {
pub struct __fregset {
#[cfg(libc_union)]
pub __qregs: [__c_anonymous__freg; 32],
pub __fpcr: u32,
pub __fpsr: u32,
}
pub struct mcontext_t {
pub __gregs: [::greg_t; 32],
pub __fregs: __fregset,
__spare: [::greg_t; 8],
}
pub struct ucontext_t {
pub uc_flags: ::c_uint,
pub uc_link: *mut ucontext_t,
pub uc_sigmask: ::sigset_t,
pub uc_stack: ::stack_t,
pub uc_mcontext: mcontext_t,
}
}
s_no_extra_traits! {
#[cfg(libc_union)]
#[repr(align(16))]
pub union __c_anonymous__freg {
pub __b8: [u8; 16],
pub __h16: [u16; 8],
pub __s32: [u32; 4],
pub __d64: [u64; 2],
pub __q128: [u128; 1],
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
#[cfg(libc_union)]
impl PartialEq for __c_anonymous__freg {
fn eq(&self, other: &__c_anonymous__freg) -> bool {
unsafe {
self.__b8 == other.__b8
|| self.__h16 == other.__h16
|| self.__s32 == other.__s32
|| self.__d64 == other.__d64
|| self.__q128 == other.__q128
}
}
}
#[cfg(libc_union)]
impl Eq for __c_anonymous__freg {}
#[cfg(libc_union)]
impl ::fmt::Debug for __c_anonymous__freg {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
unsafe {
f.debug_struct("__c_anonymous__freg")
.field("__b8", &self.__b8)
.field("__h16", &self.__h16)
.field("__s32", &self.__s32)
.field("__d64", &self.__d64)
.field("__q128", &self.__q128)
.finish()
}
}
}
#[cfg(libc_union)]
impl ::hash::Hash for __c_anonymous__freg {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
unsafe {
self.__b8.hash(state);
self.__h16.hash(state);
self.__s32.hash(state);
self.__d64.hash(state);
self.__q128.hash(state);
}
}
}
}
}
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 4 - 1;
}
}
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;

View file

@ -0,0 +1,81 @@
use PT_FIRSTMACH;
pub type c_long = i32;
pub type c_ulong = u32;
pub type c_char = u8;
pub type __cpu_simple_lock_nv_t = ::c_int;
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 8 - 1;
}
}
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;

View file

@ -0,0 +1,21 @@
use PT_FIRSTMACH;
pub type c_long = i32;
pub type c_ulong = u32;
pub type c_char = i8;
pub type __cpu_simple_lock_nv_t = ::c_int;
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_longlong>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 8 - 1;
}
}
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;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,21 @@
use PT_FIRSTMACH;
pub type c_long = i32;
pub type c_ulong = u32;
pub type c_char = u8;
pub type __cpu_simple_lock_nv_t = ::c_int;
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_double>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 8 - 1;
}
}
pub const PT_STEP: ::c_int = PT_FIRSTMACH + 0;
pub const PT_GETREGS: ::c_int = PT_FIRSTMACH + 1;
pub const PT_SETREGS: ::c_int = PT_FIRSTMACH + 2;

View file

@ -0,0 +1,21 @@
use PT_FIRSTMACH;
pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = u8;
pub type __cpu_simple_lock_nv_t = ::c_int;
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 8 - 1;
}
}
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;

View file

@ -0,0 +1,8 @@
pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = i8;
pub type __cpu_simple_lock_nv_t = ::c_uchar;
// should be pub(crate), but that requires Rust 1.18.0
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 0xf;

View file

@ -0,0 +1,15 @@
pub type c_long = i32;
pub type c_ulong = u32;
pub type c_char = i8;
pub type __cpu_simple_lock_nv_t = ::c_uchar;
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 4 - 1;
}
}

View file

@ -0,0 +1,67 @@
use PT_FIRSTMACH;
pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = i8;
pub type c___greg_t = u64;
pub type __cpu_simple_lock_nv_t = ::c_uchar;
s! {
pub struct mcontext_t {
pub __gregs: [c___greg_t; 26],
pub _mc_tlsbase: c___greg_t,
pub __fpregs: [[::c_char;32]; 16],
}
pub struct ucontext_t {
pub uc_flags: ::c_uint,
pub uc_link: *mut ::ucontext_t,
pub uc_sigmask: ::sigset_t,
pub uc_stack: ::stack_t,
pub uc_mcontext: ::mcontext_t,
}
}
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 8 - 1;
}
}
pub const PT_STEP: ::c_int = PT_FIRSTMACH + 0;
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;

View file

@ -0,0 +1,30 @@
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_sp: ::c_ulong,
pub sc_lr: ::c_ulong,
pub sc_elr: ::c_ulong,
pub sc_spsr: ::c_ulong,
pub sc_x: [::c_ulong; 30],
pub sc_cookie: ::c_long,
}
}
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 8 - 1;
}
}
pub const _MAX_PAGE_SHIFT: u32 = 12;

View file

@ -0,0 +1,16 @@
pub type c_long = i32;
pub type c_ulong = u32;
pub type c_char = u8;
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_double>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 8 - 1;
}
}
pub const _MAX_PAGE_SHIFT: u32 = 12;

View file

@ -0,0 +1,8 @@
pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = i8;
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 7;
pub const _MAX_PAGE_SHIFT: u32 = 14;

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,16 @@
pub type c_long = i32;
pub type c_ulong = u32;
pub type c_char = u8;
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_double>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 8 - 1;
}
}
pub const _MAX_PAGE_SHIFT: u32 = 12;

View file

@ -0,0 +1,16 @@
pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = u8;
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 8 - 1;
}
}
pub const _MAX_PAGE_SHIFT: u32 = 12;

View file

@ -0,0 +1,35 @@
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! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 8 - 1;
}
}
pub const _MAX_PAGE_SHIFT: u32 = 12;

View file

@ -0,0 +1,8 @@
pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = i8;
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 0xf;
pub const _MAX_PAGE_SHIFT: u32 = 13;

View file

@ -0,0 +1,16 @@
pub type c_long = i32;
pub type c_ulong = u32;
pub type c_char = i8;
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_int>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 4 - 1;
}
}
pub const _MAX_PAGE_SHIFT: u32 = 12;

View file

@ -0,0 +1,130 @@
use PT_FIRSTMACH;
pub type c_long = i64;
pub type c_ulong = u64;
pub type c_char = i8;
pub type ucontext_t = sigcontext;
s! {
pub struct sigcontext {
pub sc_rdi: ::c_long,
pub sc_rsi: ::c_long,
pub sc_rdx: ::c_long,
pub sc_rcx: ::c_long,
pub sc_r8: ::c_long,
pub sc_r9: ::c_long,
pub sc_r10: ::c_long,
pub sc_r11: ::c_long,
pub sc_r12: ::c_long,
pub sc_r13: ::c_long,
pub sc_r14: ::c_long,
pub sc_r15: ::c_long,
pub sc_rbp: ::c_long,
pub sc_rbx: ::c_long,
pub sc_rax: ::c_long,
pub sc_gs: ::c_long,
pub sc_fs: ::c_long,
pub sc_es: ::c_long,
pub sc_ds: ::c_long,
pub sc_trapno: ::c_long,
pub sc_err: ::c_long,
pub sc_rip: ::c_long,
pub sc_cs: ::c_long,
pub sc_rflags: ::c_long,
pub sc_rsp: ::c_long,
pub sc_ss: ::c_long,
pub sc_fpstate: *mut fxsave64,
__sc_unused: ::c_int,
pub sc_mask: ::c_int,
pub sc_cookie: ::c_long,
}
}
s_no_extra_traits! {
#[repr(packed)]
pub struct fxsave64 {
pub fx_fcw: u16,
pub fx_fsw: u16,
pub fx_ftw: u8,
__fx_unused1: u8,
pub fx_fop: u16,
pub fx_rip: u64,
pub fx_rdp: u64,
pub fx_mxcsr: u32,
pub fx_mxcsr_mask: u32,
pub fx_st: [[u64; 2]; 8],
pub fx_xmm: [[u64; 2]; 16],
__fx_unused3: [u8; 96],
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
// `fxsave64` is packed, so field access is unaligned.
// use {x} to create temporary storage, copy field to it, and do aligned access.
impl PartialEq for fxsave64 {
fn eq(&self, other: &fxsave64) -> bool {
return {self.fx_fcw} == {other.fx_fcw} &&
{self.fx_fsw} == {other.fx_fsw} &&
{self.fx_ftw} == {other.fx_ftw} &&
{self.fx_fop} == {other.fx_fop} &&
{self.fx_rip} == {other.fx_rip} &&
{self.fx_rdp} == {other.fx_rdp} &&
{self.fx_mxcsr} == {other.fx_mxcsr} &&
{self.fx_mxcsr_mask} == {other.fx_mxcsr_mask} &&
{self.fx_st}.iter().zip({other.fx_st}.iter()).all(|(a,b)| a == b) &&
{self.fx_xmm}.iter().zip({other.fx_xmm}.iter()).all(|(a,b)| a == b)
}
}
impl Eq for fxsave64 {}
impl ::fmt::Debug for fxsave64 {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("fxsave64")
.field("fx_fcw", &{self.fx_fcw})
.field("fx_fsw", &{self.fx_fsw})
.field("fx_ftw", &{self.fx_ftw})
.field("fx_fop", &{self.fx_fop})
.field("fx_rip", &{self.fx_rip})
.field("fx_rdp", &{self.fx_rdp})
.field("fx_mxcsr", &{self.fx_mxcsr})
.field("fx_mxcsr_mask", &{self.fx_mxcsr_mask})
// FIXME: .field("fx_st", &{self.fx_st})
// FIXME: .field("fx_xmm", &{self.fx_xmm})
.finish()
}
}
impl ::hash::Hash for fxsave64 {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
{self.fx_fcw}.hash(state);
{self.fx_fsw}.hash(state);
{self.fx_ftw}.hash(state);
{self.fx_fop}.hash(state);
{self.fx_rip}.hash(state);
{self.fx_rdp}.hash(state);
{self.fx_mxcsr}.hash(state);
{self.fx_mxcsr_mask}.hash(state);
{self.fx_st}.hash(state);
{self.fx_xmm}.hash(state);
}
}
}
}
// should be pub(crate), but that requires Rust 1.18.0
cfg_if! {
if #[cfg(libc_const_size_of)] {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = ::mem::size_of::<::c_long>() - 1;
} else {
#[doc(hidden)]
pub const _ALIGNBYTES: usize = 8 - 1;
}
}
pub const _MAX_PAGE_SHIFT: u32 = 12;
pub const PT_STEP: ::c_int = PT_FIRSTMACH + 0;
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;

View file

@ -0,0 +1,20 @@
pub type c_long = i32;
pub type c_ulong = u32;
pub type time_t = i32;
pub type Elf_Addr = ::Elf32_Addr;
pub type Elf_Half = ::Elf32_Half;
pub type Elf_Phdr = ::Elf32_Phdr;
s! {
pub struct Elf32_Phdr {
pub p_type: ::Elf32_Word,
pub p_offset: ::Elf32_Off,
pub p_vaddr: ::Elf32_Addr,
pub p_paddr: ::Elf32_Addr,
pub p_filesz: ::Elf32_Word,
pub p_memsz: ::Elf32_Word,
pub p_flags: ::Elf32_Word,
pub p_align: ::Elf32_Word,
}
}

View file

@ -0,0 +1,20 @@
pub type c_ulong = u64;
pub type c_long = i64;
pub type time_t = i64;
pub type Elf_Addr = ::Elf64_Addr;
pub type Elf_Half = ::Elf64_Half;
pub type Elf_Phdr = ::Elf64_Phdr;
s! {
pub struct Elf64_Phdr {
pub p_type: ::Elf64_Word,
pub p_flags: ::Elf64_Word,
pub p_offset: ::Elf64_Off,
pub p_vaddr: ::Elf64_Addr,
pub p_paddr: ::Elf64_Addr,
pub p_filesz: ::Elf64_Xword,
pub p_memsz: ::Elf64_Xword,
pub p_align: ::Elf64_Xword,
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,264 @@
s_no_extra_traits! {
pub struct fpu_state {
pub control: ::c_ushort,
pub status: ::c_ushort,
pub tag: ::c_ushort,
pub opcode: ::c_ushort,
pub rip: ::c_ulong,
pub rdp: ::c_ulong,
pub mxcsr: ::c_uint,
pub mscsr_mask: ::c_uint,
pub _fpreg: [[::c_uchar; 8]; 16],
pub _xmm: [[::c_uchar; 16]; 16],
pub _reserved_416_511: [::c_uchar; 96],
}
pub struct xstate_hdr {
pub bv: ::c_ulong,
pub xcomp_bv: ::c_ulong,
pub _reserved: [::c_uchar; 48],
}
pub struct savefpu {
pub fp_fxsave: fpu_state,
pub fp_xstate: xstate_hdr,
pub _fp_ymm: [[::c_uchar; 16]; 16],
}
pub struct mcontext_t {
pub rax: ::c_ulong,
pub rbx: ::c_ulong,
pub rcx: ::c_ulong,
pub rdx: ::c_ulong,
pub rdi: ::c_ulong,
pub rsi: ::c_ulong,
pub rbp: ::c_ulong,
pub r8: ::c_ulong,
pub r9: ::c_ulong,
pub r10: ::c_ulong,
pub r11: ::c_ulong,
pub r12: ::c_ulong,
pub r13: ::c_ulong,
pub r14: ::c_ulong,
pub r15: ::c_ulong,
pub rsp: ::c_ulong,
pub rip: ::c_ulong,
pub rflags: ::c_ulong,
pub fpu: savefpu,
}
pub struct ucontext_t {
pub uc_link: *mut ucontext_t,
pub uc_sigmask: ::sigset_t,
pub uc_stack: ::stack_t,
pub uc_mcontext: mcontext_t,
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for fpu_state {
fn eq(&self, other: &fpu_state) -> bool {
self.control == other.control
&& self.status == other.status
&& self.tag == other.tag
&& self.opcode == other.opcode
&& self.rip == other.rip
&& self.rdp == other.rdp
&& self.mxcsr == other.mxcsr
&& self.mscsr_mask == other.mscsr_mask
&& self._fpreg.iter().zip(other._fpreg.iter()).all(|(a, b)| a == b)
&& self._xmm.iter().zip(other._xmm.iter()).all(|(a, b)| a == b)
&& self._reserved_416_511.
iter().
zip(other._reserved_416_511.iter()).
all(|(a, b)| a == b)
}
}
impl Eq for fpu_state {}
impl ::fmt::Debug for fpu_state {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("fpu_state")
.field("control", &self.control)
.field("status", &self.status)
.field("tag", &self.tag)
.field("opcode", &self.opcode)
.field("rip", &self.rip)
.field("rdp", &self.rdp)
.field("mxcsr", &self.mxcsr)
.field("mscsr_mask", &self.mscsr_mask)
// FIXME: .field("_fpreg", &self._fpreg)
// FIXME: .field("_xmm", &self._xmm)
// FIXME: .field("_reserved_416_511", &self._reserved_416_511)
.finish()
}
}
impl ::hash::Hash for fpu_state {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.control.hash(state);
self.status.hash(state);
self.tag.hash(state);
self.opcode.hash(state);
self.rip.hash(state);
self.rdp.hash(state);
self.mxcsr.hash(state);
self.mscsr_mask.hash(state);
self._fpreg.hash(state);
self._xmm.hash(state);
self._reserved_416_511.hash(state);
}
}
impl PartialEq for xstate_hdr {
fn eq(&self, other: &xstate_hdr) -> bool {
self.bv == other.bv
&& self.xcomp_bv == other.xcomp_bv
&& self._reserved.iter().zip(other._reserved.iter()).all(|(a, b)| a == b)
}
}
impl Eq for xstate_hdr {}
impl ::fmt::Debug for xstate_hdr {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("xstate_hdr")
.field("bv", &self.bv)
.field("xcomp_bv", &self.xcomp_bv)
// FIXME: .field("_reserved", &field._reserved)
.finish()
}
}
impl ::hash::Hash for xstate_hdr {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.bv.hash(state);
self.xcomp_bv.hash(state);
self._reserved.hash(state);
}
}
impl PartialEq for savefpu {
fn eq(&self, other: &savefpu) -> bool {
self.fp_fxsave == other.fp_fxsave
&& self.fp_xstate == other.fp_xstate
&& self._fp_ymm.iter().zip(other._fp_ymm.iter()).all(|(a, b)| a == b)
}
}
impl Eq for savefpu {}
impl ::fmt::Debug for savefpu {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("savefpu")
.field("fp_fxsave", &self.fp_fxsave)
.field("fp_xstate", &self.fp_xstate)
// FIXME: .field("_fp_ymm", &field._fp_ymm)
.finish()
}
}
impl ::hash::Hash for savefpu {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.fp_fxsave.hash(state);
self.fp_xstate.hash(state);
self._fp_ymm.hash(state);
}
}
impl PartialEq for mcontext_t {
fn eq(&self, other: &mcontext_t) -> bool {
self.rax == other.rax
&& self.rbx == other.rbx
&& self.rbx == other.rbx
&& self.rcx == other.rcx
&& self.rdx == other.rdx
&& self.rdi == other.rdi
&& self.rsi == other.rsi
&& self.r8 == other.r8
&& self.r9 == other.r9
&& self.r10 == other.r10
&& self.r11 == other.r11
&& self.r12 == other.r12
&& self.r13 == other.r13
&& self.r14 == other.r14
&& self.r15 == other.r15
&& self.rsp == other.rsp
&& self.rip == other.rip
&& self.rflags == other.rflags
&& self.fpu == other.fpu
}
}
impl Eq for mcontext_t {}
impl ::fmt::Debug for mcontext_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("mcontext_t")
.field("rax", &self.rax)
.field("rbx", &self.rbx)
.field("rcx", &self.rcx)
.field("rdx", &self.rdx)
.field("rdi", &self.rdi)
.field("rsi", &self.rsi)
.field("rbp", &self.rbp)
.field("r8", &self.r8)
.field("r9", &self.r9)
.field("r10", &self.r10)
.field("r11", &self.r11)
.field("r12", &self.r12)
.field("r13", &self.r13)
.field("r14", &self.r14)
.field("r15", &self.r15)
.field("rsp", &self.rsp)
.field("rip", &self.rip)
.field("rflags", &self.rflags)
.field("fpu", &self.fpu)
.finish()
}
}
impl ::hash::Hash for mcontext_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.rax.hash(state);
self.rbx.hash(state);
self.rcx.hash(state);
self.rdx.hash(state);
self.rdi.hash(state);
self.rsi.hash(state);
self.rbp.hash(state);
self.r8.hash(state);
self.r9.hash(state);
self.r10.hash(state);
self.r11.hash(state);
self.r12.hash(state);
self.r13.hash(state);
self.r14.hash(state);
self.r15.hash(state);
self.rsp.hash(state);
self.rip.hash(state);
self.rflags.hash(state);
self.fpu.hash(state);
}
}
impl PartialEq for ucontext_t {
fn eq(&self, other: &ucontext_t) -> bool {
self.uc_link == other.uc_link
&& self.uc_sigmask == other.uc_sigmask
&& self.uc_stack == other.uc_stack
&& self.uc_mcontext == other.uc_mcontext
}
}
impl Eq for ucontext_t {}
impl ::fmt::Debug for ucontext_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("ucontext_t")
.field("uc_link", &self.uc_link)
.field("uc_sigmask", &self.uc_sigmask)
.field("uc_stack", &self.uc_stack)
.field("uc_mcontext", &self.uc_mcontext)
.finish()
}
}
impl ::hash::Hash for ucontext_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.uc_link.hash(state);
self.uc_sigmask.hash(state);
self.uc_stack.hash(state);
self.uc_mcontext.hash(state);
}
}
}
}

View file

@ -0,0 +1 @@
// Placeholder file

View file

@ -0,0 +1,93 @@
pub type c_long = i32;
pub type c_ulong = u32;
pub type __int64_t = ::c_longlong;
pub type __uint64_t = ::c_ulonglong;
pub type int_fast16_t = ::c_int;
pub type int_fast32_t = ::c_int;
pub type int_fast64_t = ::c_longlong;
pub type uint_fast16_t = ::c_uint;
pub type uint_fast32_t = ::c_uint;
pub type uint_fast64_t = ::c_ulonglong;
pub type __quad_t = ::c_longlong;
pub type __u_quad_t = ::c_ulonglong;
pub type __intmax_t = ::c_longlong;
pub type __uintmax_t = ::c_ulonglong;
pub type __squad_type = ::__int64_t;
pub type __uquad_type = ::__uint64_t;
pub type __sword_type = ::c_int;
pub type __uword_type = ::c_uint;
pub type __slong32_type = ::c_long;
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;
pub type Elf32_Addr = u32;
pub type Elf32_Section = u16;
pub type Elf_Addr = ::Elf32_Addr;
pub type Elf_Half = ::Elf32_Half;
pub type Elf_Ehdr = ::Elf32_Ehdr;
pub type Elf_Phdr = ::Elf32_Phdr;
pub type Elf_Shdr = ::Elf32_Shdr;
pub type Elf_Sym = ::Elf32_Sym;
s! {
pub struct Elf32_Ehdr {
pub e_ident: [::c_uchar; 16],
pub e_type: Elf32_Half,
pub e_machine: Elf32_Half,
pub e_version: Elf32_Word,
pub e_entry: Elf32_Addr,
pub e_phoff: Elf32_Off,
pub e_shoff: Elf32_Off,
pub e_flags: Elf32_Word,
pub e_ehsize: Elf32_Half,
pub e_phentsize: Elf32_Half,
pub e_phnum: Elf32_Half,
pub e_shentsize: Elf32_Half,
pub e_shnum: Elf32_Half,
pub e_shstrndx: Elf32_Half,
}
pub struct Elf32_Shdr {
pub sh_name: Elf32_Word,
pub sh_type: Elf32_Word,
pub sh_flags: Elf32_Word,
pub sh_addr: Elf32_Addr,
pub sh_offset: Elf32_Off,
pub sh_size: Elf32_Word,
pub sh_link: Elf32_Word,
pub sh_info: Elf32_Word,
pub sh_addralign: Elf32_Word,
pub sh_entsize: Elf32_Word,
}
pub struct Elf32_Sym {
pub st_name: Elf32_Word,
pub st_value: Elf32_Addr,
pub st_size: Elf32_Word,
pub st_info: ::c_uchar,
pub st_other: ::c_uchar,
pub st_shndx: Elf32_Section,
}
pub struct Elf32_Phdr {
pub p_type: ::Elf32_Word,
pub p_offset: ::Elf32_Off,
pub p_vaddr: ::Elf32_Addr,
pub p_paddr: ::Elf32_Addr,
pub p_filesz: ::Elf32_Word,
pub p_memsz: ::Elf32_Word,
pub p_flags: ::Elf32_Word,
pub p_align: ::Elf32_Word,
}
}

View file

@ -0,0 +1,95 @@
pub type c_long = i64;
pub type c_ulong = u64;
pub type __int64_t = ::c_long;
pub type __uint64_t = ::c_ulong;
pub type int_fast16_t = ::c_long;
pub type int_fast32_t = ::c_long;
pub type int_fast64_t = ::c_long;
pub type uint_fast16_t = ::c_ulong;
pub type uint_fast32_t = ::c_ulong;
pub type uint_fast64_t = ::c_ulong;
pub type __quad_t = ::c_long;
pub type __u_quad_t = ::c_ulong;
pub type __intmax_t = ::c_long;
pub type __uintmax_t = ::c_ulong;
pub type __squad_type = ::c_long;
pub type __uquad_type = ::c_ulong;
pub type __sword_type = ::c_long;
pub type __uword_type = ::c_ulong;
pub type __slong32_type = ::c_int;
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;
pub type Elf64_Addr = u64;
pub type Elf64_Xword = u64;
pub type Elf64_Sxword = i64;
pub type Elf64_Section = u16;
pub type Elf_Addr = ::Elf64_Addr;
pub type Elf_Half = ::Elf64_Half;
pub type Elf_Ehdr = ::Elf64_Ehdr;
pub type Elf_Phdr = ::Elf64_Phdr;
pub type Elf_Shdr = ::Elf64_Shdr;
pub type Elf_Sym = ::Elf64_Sym;
s! {
pub struct Elf64_Ehdr {
pub e_ident: [::c_uchar; 16],
pub e_type: Elf64_Half,
pub e_machine: Elf64_Half,
pub e_version: Elf64_Word,
pub e_entry: Elf64_Addr,
pub e_phoff: Elf64_Off,
pub e_shoff: Elf64_Off,
pub e_flags: Elf64_Word,
pub e_ehsize: Elf64_Half,
pub e_phentsize: Elf64_Half,
pub e_phnum: Elf64_Half,
pub e_shentsize: Elf64_Half,
pub e_shnum: Elf64_Half,
pub e_shstrndx: Elf64_Half,
}
pub struct Elf64_Shdr {
pub sh_name: Elf64_Word,
pub sh_type: Elf64_Word,
pub sh_flags: Elf64_Xword,
pub sh_addr: Elf64_Addr,
pub sh_offset: Elf64_Off,
pub sh_size: Elf64_Xword,
pub sh_link: Elf64_Word,
pub sh_info: Elf64_Word,
pub sh_addralign: Elf64_Xword,
pub sh_entsize: Elf64_Xword,
}
pub struct Elf64_Sym {
pub st_name: Elf64_Word,
pub st_info: ::c_uchar,
pub st_other: ::c_uchar,
pub st_shndx: Elf64_Section,
pub st_value: Elf64_Addr,
pub st_size: Elf64_Xword,
}
pub struct Elf64_Phdr {
pub p_type: ::Elf64_Word,
pub p_flags: ::Elf64_Word,
pub p_offset: ::Elf64_Off,
pub p_vaddr: ::Elf64_Addr,
pub p_paddr: ::Elf64_Addr,
pub p_filesz: ::Elf64_Xword,
pub p_memsz: ::Elf64_Xword,
pub p_align: ::Elf64_Xword,
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
// Placeholder file

View file

@ -0,0 +1,550 @@
pub type c_char = u8;
pub type wchar_t = u32;
pub type greg_t = i32;
pub type mcontext_t = sigcontext;
s! {
pub struct sigcontext {
pub trap_no: ::c_ulong,
pub error_code: ::c_ulong,
pub oldmask: ::c_ulong,
pub arm_r0: ::c_ulong,
pub arm_r1: ::c_ulong,
pub arm_r2: ::c_ulong,
pub arm_r3: ::c_ulong,
pub arm_r4: ::c_ulong,
pub arm_r5: ::c_ulong,
pub arm_r6: ::c_ulong,
pub arm_r7: ::c_ulong,
pub arm_r8: ::c_ulong,
pub arm_r9: ::c_ulong,
pub arm_r10: ::c_ulong,
pub arm_fp: ::c_ulong,
pub arm_ip: ::c_ulong,
pub arm_sp: ::c_ulong,
pub arm_lr: ::c_ulong,
pub arm_pc: ::c_ulong,
pub arm_cpsr: ::c_ulong,
pub fault_address: ::c_ulong,
}
}
cfg_if! {
if #[cfg(libc_union)] {
s_no_extra_traits! {
pub struct __c_anonymous_uc_sigmask_with_padding {
pub uc_sigmask: ::sigset_t,
/* Android has a wrong (smaller) sigset_t on x86. */
__padding_rt_sigset: u32,
}
pub union __c_anonymous_uc_sigmask {
uc_sigmask: __c_anonymous_uc_sigmask_with_padding,
uc_sigmask64: ::sigset64_t,
}
pub struct ucontext_t {
pub uc_flags: ::c_ulong,
pub uc_link: *mut ucontext_t,
pub uc_stack: ::stack_t,
pub uc_mcontext: mcontext_t,
pub uc_sigmask__c_anonymous_union: __c_anonymous_uc_sigmask,
/* The kernel adds extra padding after uc_sigmask to match
* glibc sigset_t on ARM. */
__padding: [c_char; 120],
__align: [::c_longlong; 0],
uc_regspace: [::c_ulong; 128],
}
}
cfg_if! {
if #[cfg(feature = "extra_traits")] {
impl PartialEq for __c_anonymous_uc_sigmask_with_padding {
fn eq(
&self, other: &__c_anonymous_uc_sigmask_with_padding
) -> bool {
self.uc_sigmask == other.uc_sigmask
// Ignore padding
}
}
impl Eq for __c_anonymous_uc_sigmask_with_padding {}
impl ::fmt::Debug for __c_anonymous_uc_sigmask_with_padding {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("uc_sigmask_with_padding")
.field("uc_sigmask_with_padding", &self.uc_sigmask)
// Ignore padding
.finish()
}
}
impl ::hash::Hash for __c_anonymous_uc_sigmask_with_padding {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.uc_sigmask.hash(state)
// Ignore padding
}
}
impl PartialEq for __c_anonymous_uc_sigmask {
fn eq(&self, other: &__c_anonymous_uc_sigmask) -> bool {
unsafe { self.uc_sigmask == other.uc_sigmask }
}
}
impl Eq for __c_anonymous_uc_sigmask {}
impl ::fmt::Debug for __c_anonymous_uc_sigmask {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("uc_sigmask")
.field("uc_sigmask", unsafe { &self.uc_sigmask })
.finish()
}
}
impl ::hash::Hash for __c_anonymous_uc_sigmask {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
unsafe { self.uc_sigmask.hash(state) }
}
}
impl PartialEq for ucontext_t {
fn eq(&self, other: &Self) -> bool {
self.uc_flags == other.uc_flags
&& self.uc_link == other.uc_link
&& self.uc_stack == other.uc_stack
&& self.uc_mcontext == other.uc_mcontext
&& self.uc_sigmask__c_anonymous_union
== other.uc_sigmask__c_anonymous_union
&& &self.uc_regspace[..] == &other.uc_regspace[..]
// Ignore padding field
}
}
impl Eq for ucontext_t {}
impl ::fmt::Debug for ucontext_t {
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
f.debug_struct("ucontext_t")
.field("uc_flags", &self.uc_flags)
.field("uc_link", &self.uc_link)
.field("uc_stack", &self.uc_stack)
.field("uc_mcontext", &self.uc_mcontext)
.field(
"uc_sigmask__c_anonymous_union",
&self.uc_sigmask__c_anonymous_union
)
.field("uc_regspace", &&self.uc_regspace[..])
// Ignore padding field
.finish()
}
}
impl ::hash::Hash for ucontext_t {
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
self.uc_flags.hash(state);
self.uc_link.hash(state);
self.uc_stack.hash(state);
self.uc_mcontext.hash(state);
self.uc_sigmask__c_anonymous_union.hash(state);
self.uc_regspace[..].hash(state);
// Ignore padding field
}
}
}
}
}
}
pub const O_DIRECT: ::c_int = 0x10000;
pub const O_DIRECTORY: ::c_int = 0x4000;
pub const O_NOFOLLOW: ::c_int = 0x8000;
pub const O_LARGEFILE: ::c_int = 0o400000;
pub const SYS_restart_syscall: ::c_long = 0;
pub const SYS_exit: ::c_long = 1;
pub const SYS_fork: ::c_long = 2;
pub const SYS_read: ::c_long = 3;
pub const SYS_write: ::c_long = 4;
pub const SYS_open: ::c_long = 5;
pub const SYS_close: ::c_long = 6;
pub const SYS_creat: ::c_long = 8;
pub const SYS_link: ::c_long = 9;
pub const SYS_unlink: ::c_long = 10;
pub const SYS_execve: ::c_long = 11;
pub const SYS_chdir: ::c_long = 12;
pub const SYS_mknod: ::c_long = 14;
pub const SYS_chmod: ::c_long = 15;
pub const SYS_lchown: ::c_long = 16;
pub const SYS_lseek: ::c_long = 19;
pub const SYS_getpid: ::c_long = 20;
pub const SYS_mount: ::c_long = 21;
pub const SYS_setuid: ::c_long = 23;
pub const SYS_getuid: ::c_long = 24;
pub const SYS_ptrace: ::c_long = 26;
pub const SYS_pause: ::c_long = 29;
pub const SYS_access: ::c_long = 33;
pub const SYS_nice: ::c_long = 34;
pub const SYS_sync: ::c_long = 36;
pub const SYS_kill: ::c_long = 37;
pub const SYS_rename: ::c_long = 38;
pub const SYS_mkdir: ::c_long = 39;
pub const SYS_rmdir: ::c_long = 40;
pub const SYS_dup: ::c_long = 41;
pub const SYS_pipe: ::c_long = 42;
pub const SYS_times: ::c_long = 43;
pub const SYS_brk: ::c_long = 45;
pub const SYS_setgid: ::c_long = 46;
pub const SYS_getgid: ::c_long = 47;
pub const SYS_geteuid: ::c_long = 49;
pub const SYS_getegid: ::c_long = 50;
pub const SYS_acct: ::c_long = 51;
pub const SYS_umount2: ::c_long = 52;
pub const SYS_ioctl: ::c_long = 54;
pub const SYS_fcntl: ::c_long = 55;
pub const SYS_setpgid: ::c_long = 57;
pub const SYS_umask: ::c_long = 60;
pub const SYS_chroot: ::c_long = 61;
pub const SYS_ustat: ::c_long = 62;
pub const SYS_dup2: ::c_long = 63;
pub const SYS_getppid: ::c_long = 64;
pub const SYS_getpgrp: ::c_long = 65;
pub const SYS_setsid: ::c_long = 66;
pub const SYS_sigaction: ::c_long = 67;
pub const SYS_setreuid: ::c_long = 70;
pub const SYS_setregid: ::c_long = 71;
pub const SYS_sigsuspend: ::c_long = 72;
pub const SYS_sigpending: ::c_long = 73;
pub const SYS_sethostname: ::c_long = 74;
pub const SYS_setrlimit: ::c_long = 75;
pub const SYS_getrusage: ::c_long = 77;
pub const SYS_gettimeofday: ::c_long = 78;
pub const SYS_settimeofday: ::c_long = 79;
pub const SYS_getgroups: ::c_long = 80;
pub const SYS_setgroups: ::c_long = 81;
pub const SYS_symlink: ::c_long = 83;
pub const SYS_readlink: ::c_long = 85;
pub const SYS_uselib: ::c_long = 86;
pub const SYS_swapon: ::c_long = 87;
pub const SYS_reboot: ::c_long = 88;
pub const SYS_munmap: ::c_long = 91;
pub const SYS_truncate: ::c_long = 92;
pub const SYS_ftruncate: ::c_long = 93;
pub const SYS_fchmod: ::c_long = 94;
pub const SYS_fchown: ::c_long = 95;
pub const SYS_getpriority: ::c_long = 96;
pub const SYS_setpriority: ::c_long = 97;
pub const SYS_statfs: ::c_long = 99;
pub const SYS_fstatfs: ::c_long = 100;
pub const SYS_syslog: ::c_long = 103;
pub const SYS_setitimer: ::c_long = 104;
pub const SYS_getitimer: ::c_long = 105;
pub const SYS_stat: ::c_long = 106;
pub const SYS_lstat: ::c_long = 107;
pub const SYS_fstat: ::c_long = 108;
pub const SYS_vhangup: ::c_long = 111;
pub const SYS_wait4: ::c_long = 114;
pub const SYS_swapoff: ::c_long = 115;
pub const SYS_sysinfo: ::c_long = 116;
pub const SYS_fsync: ::c_long = 118;
pub const SYS_sigreturn: ::c_long = 119;
pub const SYS_clone: ::c_long = 120;
pub const SYS_setdomainname: ::c_long = 121;
pub const SYS_uname: ::c_long = 122;
pub const SYS_adjtimex: ::c_long = 124;
pub const SYS_mprotect: ::c_long = 125;
pub const SYS_sigprocmask: ::c_long = 126;
pub const SYS_init_module: ::c_long = 128;
pub const SYS_delete_module: ::c_long = 129;
pub const SYS_quotactl: ::c_long = 131;
pub const SYS_getpgid: ::c_long = 132;
pub const SYS_fchdir: ::c_long = 133;
pub const SYS_bdflush: ::c_long = 134;
pub const SYS_sysfs: ::c_long = 135;
pub const SYS_personality: ::c_long = 136;
pub const SYS_setfsuid: ::c_long = 138;
pub const SYS_setfsgid: ::c_long = 139;
pub const SYS_getdents: ::c_long = 141;
pub const SYS_flock: ::c_long = 143;
pub const SYS_msync: ::c_long = 144;
pub const SYS_readv: ::c_long = 145;
pub const SYS_writev: ::c_long = 146;
pub const SYS_getsid: ::c_long = 147;
pub const SYS_fdatasync: ::c_long = 148;
pub const SYS_mlock: ::c_long = 150;
pub const SYS_munlock: ::c_long = 151;
pub const SYS_mlockall: ::c_long = 152;
pub const SYS_munlockall: ::c_long = 153;
pub const SYS_sched_setparam: ::c_long = 154;
pub const SYS_sched_getparam: ::c_long = 155;
pub const SYS_sched_setscheduler: ::c_long = 156;
pub const SYS_sched_getscheduler: ::c_long = 157;
pub const SYS_sched_yield: ::c_long = 158;
pub const SYS_sched_get_priority_max: ::c_long = 159;
pub const SYS_sched_get_priority_min: ::c_long = 160;
pub const SYS_sched_rr_get_interval: ::c_long = 161;
pub const SYS_nanosleep: ::c_long = 162;
pub const SYS_mremap: ::c_long = 163;
pub const SYS_setresuid: ::c_long = 164;
pub const SYS_getresuid: ::c_long = 165;
pub const SYS_poll: ::c_long = 168;
pub const SYS_nfsservctl: ::c_long = 169;
pub const SYS_setresgid: ::c_long = 170;
pub const SYS_getresgid: ::c_long = 171;
pub const SYS_prctl: ::c_long = 172;
pub const SYS_rt_sigreturn: ::c_long = 173;
pub const SYS_rt_sigaction: ::c_long = 174;
pub const SYS_rt_sigprocmask: ::c_long = 175;
pub const SYS_rt_sigpending: ::c_long = 176;
pub const SYS_rt_sigtimedwait: ::c_long = 177;
pub const SYS_rt_sigqueueinfo: ::c_long = 178;
pub const SYS_rt_sigsuspend: ::c_long = 179;
pub const SYS_pread64: ::c_long = 180;
pub const SYS_pwrite64: ::c_long = 181;
pub const SYS_chown: ::c_long = 182;
pub const SYS_getcwd: ::c_long = 183;
pub const SYS_capget: ::c_long = 184;
pub const SYS_capset: ::c_long = 185;
pub const SYS_sigaltstack: ::c_long = 186;
pub const SYS_sendfile: ::c_long = 187;
pub const SYS_vfork: ::c_long = 190;
pub const SYS_ugetrlimit: ::c_long = 191;
pub const SYS_mmap2: ::c_long = 192;
pub const SYS_truncate64: ::c_long = 193;
pub const SYS_ftruncate64: ::c_long = 194;
pub const SYS_stat64: ::c_long = 195;
pub const SYS_lstat64: ::c_long = 196;
pub const SYS_fstat64: ::c_long = 197;
pub const SYS_lchown32: ::c_long = 198;
pub const SYS_getuid32: ::c_long = 199;
pub const SYS_getgid32: ::c_long = 200;
pub const SYS_geteuid32: ::c_long = 201;
pub const SYS_getegid32: ::c_long = 202;
pub const SYS_setreuid32: ::c_long = 203;
pub const SYS_setregid32: ::c_long = 204;
pub const SYS_getgroups32: ::c_long = 205;
pub const SYS_setgroups32: ::c_long = 206;
pub const SYS_fchown32: ::c_long = 207;
pub const SYS_setresuid32: ::c_long = 208;
pub const SYS_getresuid32: ::c_long = 209;
pub const SYS_setresgid32: ::c_long = 210;
pub const SYS_getresgid32: ::c_long = 211;
pub const SYS_chown32: ::c_long = 212;
pub const SYS_setuid32: ::c_long = 213;
pub const SYS_setgid32: ::c_long = 214;
pub const SYS_setfsuid32: ::c_long = 215;
pub const SYS_setfsgid32: ::c_long = 216;
pub const SYS_getdents64: ::c_long = 217;
pub const SYS_pivot_root: ::c_long = 218;
pub const SYS_mincore: ::c_long = 219;
pub const SYS_madvise: ::c_long = 220;
pub const SYS_fcntl64: ::c_long = 221;
pub const SYS_gettid: ::c_long = 224;
pub const SYS_readahead: ::c_long = 225;
pub const SYS_setxattr: ::c_long = 226;
pub const SYS_lsetxattr: ::c_long = 227;
pub const SYS_fsetxattr: ::c_long = 228;
pub const SYS_getxattr: ::c_long = 229;
pub const SYS_lgetxattr: ::c_long = 230;
pub const SYS_fgetxattr: ::c_long = 231;
pub const SYS_listxattr: ::c_long = 232;
pub const SYS_llistxattr: ::c_long = 233;
pub const SYS_flistxattr: ::c_long = 234;
pub const SYS_removexattr: ::c_long = 235;
pub const SYS_lremovexattr: ::c_long = 236;
pub const SYS_fremovexattr: ::c_long = 237;
pub const SYS_tkill: ::c_long = 238;
pub const SYS_sendfile64: ::c_long = 239;
pub const SYS_futex: ::c_long = 240;
pub const SYS_sched_setaffinity: ::c_long = 241;
pub const SYS_sched_getaffinity: ::c_long = 242;
pub const SYS_io_setup: ::c_long = 243;
pub const SYS_io_destroy: ::c_long = 244;
pub const SYS_io_getevents: ::c_long = 245;
pub const SYS_io_submit: ::c_long = 246;
pub const SYS_io_cancel: ::c_long = 247;
pub const SYS_exit_group: ::c_long = 248;
pub const SYS_lookup_dcookie: ::c_long = 249;
pub const SYS_epoll_create: ::c_long = 250;
pub const SYS_epoll_ctl: ::c_long = 251;
pub const SYS_epoll_wait: ::c_long = 252;
pub const SYS_remap_file_pages: ::c_long = 253;
pub const SYS_set_tid_address: ::c_long = 256;
pub const SYS_timer_create: ::c_long = 257;
pub const SYS_timer_settime: ::c_long = 258;
pub const SYS_timer_gettime: ::c_long = 259;
pub const SYS_timer_getoverrun: ::c_long = 260;
pub const SYS_timer_delete: ::c_long = 261;
pub const SYS_clock_settime: ::c_long = 262;
pub const SYS_clock_gettime: ::c_long = 263;
pub const SYS_clock_getres: ::c_long = 264;
pub const SYS_clock_nanosleep: ::c_long = 265;
pub const SYS_statfs64: ::c_long = 266;
pub const SYS_fstatfs64: ::c_long = 267;
pub const SYS_tgkill: ::c_long = 268;
pub const SYS_utimes: ::c_long = 269;
pub const SYS_arm_fadvise64_64: ::c_long = 270;
pub const SYS_pciconfig_iobase: ::c_long = 271;
pub const SYS_pciconfig_read: ::c_long = 272;
pub const SYS_pciconfig_write: ::c_long = 273;
pub const SYS_mq_open: ::c_long = 274;
pub const SYS_mq_unlink: ::c_long = 275;
pub const SYS_mq_timedsend: ::c_long = 276;
pub const SYS_mq_timedreceive: ::c_long = 277;
pub const SYS_mq_notify: ::c_long = 278;
pub const SYS_mq_getsetattr: ::c_long = 279;
pub const SYS_waitid: ::c_long = 280;
pub const SYS_socket: ::c_long = 281;
pub const SYS_bind: ::c_long = 282;
pub const SYS_connect: ::c_long = 283;
pub const SYS_listen: ::c_long = 284;
pub const SYS_accept: ::c_long = 285;
pub const SYS_getsockname: ::c_long = 286;
pub const SYS_getpeername: ::c_long = 287;
pub const SYS_socketpair: ::c_long = 288;
pub const SYS_send: ::c_long = 289;
pub const SYS_sendto: ::c_long = 290;
pub const SYS_recv: ::c_long = 291;
pub const SYS_recvfrom: ::c_long = 292;
pub const SYS_shutdown: ::c_long = 293;
pub const SYS_setsockopt: ::c_long = 294;
pub const SYS_getsockopt: ::c_long = 295;
pub const SYS_sendmsg: ::c_long = 296;
pub const SYS_recvmsg: ::c_long = 297;
pub const SYS_semop: ::c_long = 298;
pub const SYS_semget: ::c_long = 299;
pub const SYS_semctl: ::c_long = 300;
pub const SYS_msgsnd: ::c_long = 301;
pub const SYS_msgrcv: ::c_long = 302;
pub const SYS_msgget: ::c_long = 303;
pub const SYS_msgctl: ::c_long = 304;
pub const SYS_shmat: ::c_long = 305;
pub const SYS_shmdt: ::c_long = 306;
pub const SYS_shmget: ::c_long = 307;
pub const SYS_shmctl: ::c_long = 308;
pub const SYS_add_key: ::c_long = 309;
pub const SYS_request_key: ::c_long = 310;
pub const SYS_keyctl: ::c_long = 311;
pub const SYS_semtimedop: ::c_long = 312;
pub const SYS_vserver: ::c_long = 313;
pub const SYS_ioprio_set: ::c_long = 314;
pub const SYS_ioprio_get: ::c_long = 315;
pub const SYS_inotify_init: ::c_long = 316;
pub const SYS_inotify_add_watch: ::c_long = 317;
pub const SYS_inotify_rm_watch: ::c_long = 318;
pub const SYS_mbind: ::c_long = 319;
pub const SYS_get_mempolicy: ::c_long = 320;
pub const SYS_set_mempolicy: ::c_long = 321;
pub const SYS_openat: ::c_long = 322;
pub const SYS_mkdirat: ::c_long = 323;
pub const SYS_mknodat: ::c_long = 324;
pub const SYS_fchownat: ::c_long = 325;
pub const SYS_futimesat: ::c_long = 326;
pub const SYS_fstatat64: ::c_long = 327;
pub const SYS_unlinkat: ::c_long = 328;
pub const SYS_renameat: ::c_long = 329;
pub const SYS_linkat: ::c_long = 330;
pub const SYS_symlinkat: ::c_long = 331;
pub const SYS_readlinkat: ::c_long = 332;
pub const SYS_fchmodat: ::c_long = 333;
pub const SYS_faccessat: ::c_long = 334;
pub const SYS_pselect6: ::c_long = 335;
pub const SYS_ppoll: ::c_long = 336;
pub const SYS_unshare: ::c_long = 337;
pub const SYS_set_robust_list: ::c_long = 338;
pub const SYS_get_robust_list: ::c_long = 339;
pub const SYS_splice: ::c_long = 340;
pub const SYS_arm_sync_file_range: ::c_long = 341;
pub const SYS_tee: ::c_long = 342;
pub const SYS_vmsplice: ::c_long = 343;
pub const SYS_move_pages: ::c_long = 344;
pub const SYS_getcpu: ::c_long = 345;
pub const SYS_epoll_pwait: ::c_long = 346;
pub const SYS_kexec_load: ::c_long = 347;
pub const SYS_utimensat: ::c_long = 348;
pub const SYS_signalfd: ::c_long = 349;
pub const SYS_timerfd_create: ::c_long = 350;
pub const SYS_eventfd: ::c_long = 351;
pub const SYS_fallocate: ::c_long = 352;
pub const SYS_timerfd_settime: ::c_long = 353;
pub const SYS_timerfd_gettime: ::c_long = 354;
pub const SYS_signalfd4: ::c_long = 355;
pub const SYS_eventfd2: ::c_long = 356;
pub const SYS_epoll_create1: ::c_long = 357;
pub const SYS_dup3: ::c_long = 358;
pub const SYS_pipe2: ::c_long = 359;
pub const SYS_inotify_init1: ::c_long = 360;
pub const SYS_preadv: ::c_long = 361;
pub const SYS_pwritev: ::c_long = 362;
pub const SYS_rt_tgsigqueueinfo: ::c_long = 363;
pub const SYS_perf_event_open: ::c_long = 364;
pub const SYS_recvmmsg: ::c_long = 365;
pub const SYS_accept4: ::c_long = 366;
pub const SYS_fanotify_init: ::c_long = 367;
pub const SYS_fanotify_mark: ::c_long = 368;
pub const SYS_prlimit64: ::c_long = 369;
pub const SYS_name_to_handle_at: ::c_long = 370;
pub const SYS_open_by_handle_at: ::c_long = 371;
pub const SYS_clock_adjtime: ::c_long = 372;
pub const SYS_syncfs: ::c_long = 373;
pub const SYS_sendmmsg: ::c_long = 374;
pub const SYS_setns: ::c_long = 375;
pub const SYS_process_vm_readv: ::c_long = 376;
pub const SYS_process_vm_writev: ::c_long = 377;
pub const SYS_kcmp: ::c_long = 378;
pub const SYS_finit_module: ::c_long = 379;
pub const SYS_sched_setattr: ::c_long = 380;
pub const SYS_sched_getattr: ::c_long = 381;
pub const SYS_renameat2: ::c_long = 382;
pub const SYS_seccomp: ::c_long = 383;
pub const SYS_getrandom: ::c_long = 384;
pub const SYS_memfd_create: ::c_long = 385;
pub const SYS_bpf: ::c_long = 386;
pub const SYS_execveat: ::c_long = 387;
pub const SYS_userfaultfd: ::c_long = 388;
pub const SYS_membarrier: ::c_long = 389;
pub const SYS_mlock2: ::c_long = 390;
pub const SYS_copy_file_range: ::c_long = 391;
pub const SYS_preadv2: ::c_long = 392;
pub const SYS_pwritev2: ::c_long = 393;
pub const SYS_pkey_mprotect: ::c_long = 394;
pub const SYS_pkey_alloc: ::c_long = 395;
pub const SYS_pkey_free: ::c_long = 396;
pub const SYS_statx: ::c_long = 397;
pub const SYS_pidfd_send_signal: ::c_long = 424;
pub const SYS_io_uring_setup: ::c_long = 425;
pub const SYS_io_uring_enter: ::c_long = 426;
pub const SYS_io_uring_register: ::c_long = 427;
pub const SYS_open_tree: ::c_long = 428;
pub const SYS_move_mount: ::c_long = 429;
pub const SYS_fsopen: ::c_long = 430;
pub const SYS_fsconfig: ::c_long = 431;
pub const SYS_fsmount: ::c_long = 432;
pub const SYS_fspick: ::c_long = 433;
// offsets in mcontext_t.gregs from sys/ucontext.h
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 NGREG: ::c_int = 18;
f! {
// Sadly, Android before 5.0 (API level 21), the accept4 syscall is not
// exposed by the libc. As work-around, we implement it through `syscall`
// directly. This workaround can be removed if the minimum version of
// Android is bumped. When the workaround is removed, `accept4` can be
// moved back to `linux_like/mod.rs`
pub fn accept4(
fd: ::c_int,
addr: *mut ::sockaddr,
len: *mut ::socklen_t,
flg: ::c_int
) -> ::c_int {
::syscall(SYS_accept4, fd, addr, len, flg) as ::c_int
}
}

Some files were not shown because too many files have changed in this diff Show more