summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cirrus.yml2
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md6
-rw-r--r--.github/workflows/bors.yml32
-rw-r--r--Cargo.toml2
-rw-r--r--ci/docker/sparc64-unknown-linux-gnu/Dockerfile3
-rw-r--r--ci/linux-sparc64.sh2
-rw-r--r--libc-test/Cargo.toml4
-rw-r--r--libc-test/build.rs82
-rw-r--r--libc-test/semver/freebsd.txt7
-rw-r--r--libc-test/semver/linux.txt7
-rw-r--r--libc-test/semver/netbsd.txt2
-rw-r--r--libc-test/semver/openbsd.txt1
-rw-r--r--libc-test/semver/redox.txt11
-rw-r--r--src/fuchsia/aarch64.rs1
-rw-r--r--src/fuchsia/mod.rs3
-rw-r--r--src/fuchsia/riscv64.rs44
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs7
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/mod.rs10
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/x86.rs155
-rw-r--r--src/unix/bsd/netbsdlike/netbsd/mod.rs56
-rw-r--r--src/unix/bsd/netbsdlike/openbsd/mod.rs2
-rw-r--r--src/unix/haiku/mod.rs2
-rw-r--r--src/unix/linux_like/linux/arch/generic/mod.rs10
-rw-r--r--src/unix/linux_like/linux/arch/mips/mod.rs3
-rw-r--r--src/unix/linux_like/linux/arch/powerpc/mod.rs3
-rw-r--r--src/unix/linux_like/linux/gnu/mod.rs17
-rw-r--r--src/unix/linux_like/linux/mod.rs2
-rw-r--r--src/unix/linux_like/mod.rs13
-rw-r--r--src/unix/newlib/mod.rs3
-rw-r--r--src/unix/newlib/vita/mod.rs175
-rw-r--r--src/unix/redox/mod.rs46
-rw-r--r--src/unix/solarish/mod.rs2
-rw-r--r--src/windows/mod.rs18
33 files changed, 601 insertions, 132 deletions
diff --git a/.cirrus.yml b/.cirrus.yml
index d9fc3c90a8..24f152846d 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -15,7 +15,7 @@ task:
task:
name: nightly x86_64-unknown-freebsd-13
freebsd_instance:
- image_family: freebsd-13-1
+ image_family: freebsd-13-2
setup_script:
- pkg install -y libnghttp2 curl
- curl https://sh.rustup.rs -sSf --output rustup.sh
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index a4958ba8c5..3e49d7473f 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -3,8 +3,10 @@ Thanks for considering submitting a PR!
Here's a checklist for things that will be checked during review or continuous integration.
- \[ ] Edit corresponding file(s) under `libc-test/semver` when you add/remove item(s)
+- \[ ] Your PR doesn't contain any *unstable* values like `*LAST` or `*MAX` (see [#3131](https://github.com/rust-lang/libc/issues/3131))
+- \[ ] If your PR increments version number, it must not contain any other changes
- \[ ] `rustc ci/style.rs && ./style src`
-- \[ ] `cd libc-test && cargo test` (This might fail on your env due to environment difference between your env and CI. Ignore failures if you are not sure.)
-- \[ ] Your PR that bumps up the crate version doesn't contain any other changes
+- \[ ] `cd libc-test && cargo test`
+ - (this might fail on your env due to environment difference between your env and CI. Ignore failures if you are not sure)
Delete this line and everything above before opening your PR.
diff --git a/.github/workflows/bors.yml b/.github/workflows/bors.yml
index e4e342a1b3..c295f332ae 100644
--- a/.github/workflows/bors.yml
+++ b/.github/workflows/bors.yml
@@ -259,36 +259,32 @@ jobs:
name: Build Channels macOS
needs: macos
- # FIXME: Use macOS 11 for now as CI failed with a linker error on macOS 12 image:
- # ld: in /.../x86_64-apple-darwin/lib/libstd-a4729905.rlib(rust.metadata.bin),
- # archive member 'rust.metadata.bin' with length 2958149 is not mach-o or llvm bitcode file '/.../x86_64-apple-darwin/lib/libstd-a4729905.rlib'
- # Possibly related: https://github.com/actions/runner-images/issues/6350
- runs-on: macos-11
env:
OS: macos
strategy:
fail-fast: true
max-parallel: 4
matrix:
- toolchain: [
- stable,
- beta,
- nightly,
- 1.13.0,
- 1.19.0,
- 1.24.0,
- 1.25.0,
- 1.30.0,
- ]
+ target:
+ - { toolchain: stable, os: macos-12 }
+ - { toolchain: beta, os: macos-12 }
+ - { toolchain: nightly, os: macos-12 }
+ # Use macOS 11 for older toolchains as newer Xcode donesn't work well.
+ - { toolchain: 1.13.0, os: macos-11 }
+ - { toolchain: 1.19.0, os: macos-11 }
+ - { toolchain: 1.24.0, os: macos-11 }
+ - { toolchain: 1.25.0, os: macos-11 }
+ - { toolchain: 1.30.0, os: macos-11 }
+ runs-on: ${{ matrix.target.os }}
steps:
- uses: rust-lang/simpleinfra/github-actions/cancel-outdated-builds@master
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
- uses: actions/checkout@v3
- name: Setup Rust toolchain
- run: TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/install-rust.sh
+ run: TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/install-rust.sh
- name: Execute build.sh
- run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh
+ run: LIBC_CI=1 TOOLCHAIN=${{ matrix.target.toolchain }} sh ./ci/build.sh
build_channels_windows:
permissions:
@@ -314,7 +310,7 @@ jobs:
run: rustup self update
shell: bash
- name: Execute build.sh
- run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} WIN_TARGET=${{ matrix.target }} sh ./ci/build.sh
+ run: LIBC_CI=1 TOOLCHAIN=${{ matrix.toolchain }} sh ./ci/build.sh
shell: bash
check_cfg:
diff --git a/Cargo.toml b/Cargo.toml
index 21b4e312bf..dd7c11a110 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "libc"
-version = "0.2.141"
+version = "0.2.142"
authors = ["The Rust Project Developers"]
license = "MIT OR Apache-2.0"
readme = "README.md"
diff --git a/ci/docker/sparc64-unknown-linux-gnu/Dockerfile b/ci/docker/sparc64-unknown-linux-gnu/Dockerfile
index d45e56195d..ff6810a7fa 100644
--- a/ci/docker/sparc64-unknown-linux-gnu/Dockerfile
+++ b/ci/docker/sparc64-unknown-linux-gnu/Dockerfile
@@ -1,5 +1,4 @@
-# FIXME: Update to 22.04 once Debian image of sparc64 has a newer glibc.
-FROM ubuntu:20.04
+FROM ubuntu:22.04
RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates \
diff --git a/ci/linux-sparc64.sh b/ci/linux-sparc64.sh
index db215cabf6..a42218a62e 100644
--- a/ci/linux-sparc64.sh
+++ b/ci/linux-sparc64.sh
@@ -5,7 +5,7 @@ set -ex
mkdir -m 777 /qemu
cd /qemu
-curl --retry 5 -LO https://cdimage.debian.org/cdimage/ports/snapshots/2022-03-28/debian-11.0.0-sparc64-NETINST-1.iso
+curl --retry 5 -LO https://cdimage.debian.org/cdimage/ports/snapshots/2022-12-09/debian-11.0.0-sparc64-NETINST-1.iso
7z e debian-11.0.0-sparc64-NETINST-1.iso install/initrd.gz
7z e debian-11.0.0-sparc64-NETINST-1.iso install/vmlinux
mv vmlinux kernel
diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml
index d72311c4e2..83bfcba9c6 100644
--- a/libc-test/Cargo.toml
+++ b/libc-test/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "libc-test"
-version = "0.2.141"
+version = "0.2.142"
authors = ["The Rust Project Developers"]
license = "MIT OR Apache-2.0"
build = "build.rs"
@@ -12,7 +12,7 @@ A test crate for the libc crate.
[dependencies.libc]
path = ".."
-version = "0.2.141"
+version = "0.2.142"
default-features = false
[build-dependencies]
diff --git a/libc-test/build.rs b/libc-test/build.rs
index ac0f996fc4..e23b0d0a37 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -1788,6 +1788,16 @@ fn test_android(target: &str) {
// kernel 5.10 minimum required
"MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ" | "MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ" => true,
+ // kernel 5.18 minimum
+ | "MADV_COLD"
+ | "MADV_DONTNEED_LOCKED"
+ | "MADV_PAGEOUT"
+ | "MADV_POPULATE_READ"
+ | "MADV_POPULATE_WRITE" => true,
+
+ // kernel 5.6 minimum required
+ "IPPROTO_MPTCP" => true,
+
_ => false,
}
});
@@ -2286,6 +2296,9 @@ fn test_freebsd(target: &str) {
// Added in FreeBSD 14
"EV_KEEPUDATA" if Some(14) > freebsd_ver => true,
+ // Added in FreeBSD 13.2
+ "AT_USRSTACKBASE" | "AT_USRSTACKLIM" if Some(13) > freebsd_ver => true,
+
_ => false,
}
});
@@ -3277,7 +3290,7 @@ fn test_linux(target: &str) {
"linux/netfilter_ipv6/ip6_tables.h",
"linux/netlink.h",
// FIXME: requires Linux >= 5.6:
- [!musl && !sparc64]: "linux/openat2.h",
+ [!musl]: "linux/openat2.h",
[!musl]: "linux/ptrace.h",
"linux/quota.h",
"linux/random.h",
@@ -3389,7 +3402,11 @@ fn test_linux(target: &str) {
return true;
}
// FIXME: musl CI has old headers
- if (musl || sparc64) && ty.starts_with("uinput_") {
+ if musl && ty.starts_with("uinput_") {
+ return true;
+ }
+ // FIXME: sparc64 CI has old headers
+ if sparc64 && (ty == "uinput_ff_erase" || ty == "uinput_abs_setup") {
return true;
}
// FIXME(https://github.com/rust-lang/libc/issues/1558): passing by
@@ -3444,9 +3461,6 @@ fn test_linux(target: &str) {
// FIXME: requires >= 5.4 kernel headers
"sockaddr_can" if musl => true,
- // FIXME: Unignore once we update Ubuntu to 22.04
- "mallinfo2" if sparc64 => true,
- "ptrace_rseq_configuration" if sparc64 => true,
"sctp_initmsg" | "sctp_sndrcvinfo" | "sctp_sndinfo" | "sctp_rcvinfo"
| "sctp_nxtinfo" | "sctp_prinfo" | "sctp_authinfo" => true,
@@ -3491,7 +3505,7 @@ fn test_linux(target: &str) {
return true;
}
}
- if musl || sparc64 {
+ if musl {
// FIXME: Requires >= 5.4.1 kernel headers
if name.starts_with("J1939")
|| name.starts_with("RTEXT_FILTER_")
@@ -3588,7 +3602,7 @@ fn test_linux(target: &str) {
| "UINPUT_VERSION"
| "SW_MAX"
| "SW_CNT"
- if mips || ppc64 || riscv64 || sparc64 => true,
+ if mips || ppc64 || riscv64 => true,
// FIXME: Not currently available in headers on ARM, MIPS and musl.
"NETLINK_GET_STRICT_CHK" if arm || mips || musl => true,
@@ -3657,24 +3671,24 @@ fn test_linux(target: &str) {
| "RESOLVE_IN_ROOT"
| "RESOLVE_NO_MAGICLINKS"
| "RESOLVE_NO_SYMLINKS"
- | "RESOLVE_NO_XDEV" if musl || sparc64 => true,
+ | "RESOLVE_NO_XDEV" if musl => true,
// FIXME: requires Linux >= 5.4:
| "CAN_J1939"
- | "CAN_NPROTO" if musl || sparc64 => true,
+ | "CAN_NPROTO" if musl => true,
// FIXME: requires Linux >= 5.6
- "GRND_INSECURE" if musl || sparc64 => true,
+ "GRND_INSECURE" if musl => true,
// FIXME: requires Linux >= 5.7:
- "MREMAP_DONTUNMAP" if musl || sparc64 => true,
+ "MREMAP_DONTUNMAP" if musl => true,
// FIXME: Requires more recent kernel headers (5.9 / 5.11):
| "CLOSE_RANGE_UNSHARE"
- | "CLOSE_RANGE_CLOEXEC" if musl || sparc64 => true,
+ | "CLOSE_RANGE_CLOEXEC" if musl => true,
// FIXME: requires Linux >= 5.12:
- "MPOL_F_NUMA_BALANCING" if musl || sparc64 => true,
+ "MPOL_F_NUMA_BALANCING" if musl => true,
// FIXME: Requires more recent kernel headers
| "NFNL_SUBSYS_COUNT" // bumped in v5.14
@@ -3686,33 +3700,13 @@ fn test_linux(target: &str) {
| "NFULA_VLAN_UNSPEC" // v5.4+
| "RTNLGRP_NEXTHOP" // linux v5.3+
| "RTNLGRP_BRVLAN" // linux v5.6+
- if musl || sparc64 => true,
-
- // FIXME: Unignore once we update Ubuntu to 22.04
- | "VMADDR_CID_LOCAL"
- | "STATX_MNT_ID"
- | "SYS_close_range"
- | "SYS_openat2"
- | "SYS_pidfd_getfd"
- | "SYS_faccessat2"
- | "SYS_process_madvise"
- | "SYS_epoll_pwait2"
- | "SYS_mount_setattr"
- | "SYS_quotactl_fd"
- | "SYS_landlock_create_ruleset"
- | "SYS_landlock_add_rule"
- | "SYS_landlock_restrict_self"
- | "SYS_process_mrelease"
- | "IFLA_PROP_LIST"
- | "IFLA_ALT_IFNAME"
- | "IFLA_PERM_ADDRESS"
- | "IFLA_PROTO_DOWN_REASON"
- | "STATX_ATTR_MOUNT_ROOT"
- | "STATX_ATTR_VERITY"
- | "STATX_ATTR_DAX"
- if sparc64 => true,
- // Added in Linux 5.13
- "PTRACE_GET_RSEQ_CONFIGURATION" if sparc64 => true,
+ if musl => true,
+
+ | "MADV_COLD"
+ | "MADV_PAGEOUT"
+ | "MADV_POPULATE_READ"
+ | "MADV_POPULATE_WRITE"
+ if musl => true,
// FIXME: Requires more recent kernel headers
| "IFLA_PARENT_DEV_NAME" // linux v5.13+
@@ -3721,11 +3715,12 @@ fn test_linux(target: &str) {
| "IFLA_TSO_MAX_SIZE" // linux v5.18+
| "IFLA_TSO_MAX_SEGS" // linux v5.18+
| "IFLA_ALLMULTI" // linux v6.0+
+ | "MADV_DONTNEED_LOCKED" // linux v5.18+
=> true,
"SCTP_FUTURE_ASSOC" | "SCTP_CURRENT_ASSOC" | "SCTP_ALL_ASSOC" | "SCTP_PEER_ADDR_THLDS_V2" => true, // linux 5.5+
// FIXME: Requires more recent kernel headers
- "HWTSTAMP_TX_ONESTEP_P2P" if sparc64 || musl => true, // linux v5.6+
+ "HWTSTAMP_TX_ONESTEP_P2P" if musl => true, // linux v5.6+
_ => false,
}
@@ -3761,9 +3756,6 @@ fn test_linux(target: &str) {
// https://github.com/gnzlbg/ctest/issues/68
"lio_listio" if musl => true,
- // FIXME: the glibc version used by the Sparc64 build jobs
- // which use Debian 10.0 is too old.
- "statx" if sparc64 => true,
// Needs glibc 2.34 or later.
"posix_spawn_file_actions_addclosefrom_np" if gnu && sparc64 => true,
// Needs glibc 2.35 or later.
@@ -3922,6 +3914,8 @@ fn test_linux(target: &str) {
"fpreg_t" if s390x => true,
"sockaddr_un" | "sembuf" | "ff_constant_effect" if mips32 && (gnu || musl) => true,
+
+ // The test doesn't work on some env:
"ipv6_mreq"
| "ip_mreq_source"
| "sockaddr_in6"
diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt
index 5776e8a421..ffb424e8b5 100644
--- a/libc-test/semver/freebsd.txt
+++ b/libc-test/semver/freebsd.txt
@@ -84,6 +84,7 @@ ATF_PERM
ATF_PUBL
ATF_USETRAILERS
AT_BASE
+AT_CANARY
AT_EACCESS
AT_EGID
AT_EMPTY_PATH
@@ -93,8 +94,13 @@ AT_EXECPATH
AT_FDCWD
AT_FLAGS
AT_GID
+AT_HWCAP
+AT_HWCAP2
+AT_NCPUS
AT_NOTELF
AT_NULL
+AT_OSRELDATE
+AT_PAGESIZES
AT_PAGESZ
AT_PHDR
AT_PHENT
@@ -779,6 +785,7 @@ MSG_NBIO
MSG_NOERROR
MSG_NOSIGNAL
MSG_NOTIFICATION
+MSG_WAITFORONE
NANOSECOND
NETGRAPHDISC
NET_RT_DUMP
diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt
index 27bd9accc2..4e9ff8d420 100644
--- a/libc-test/semver/linux.txt
+++ b/libc-test/semver/linux.txt
@@ -1286,22 +1286,29 @@ LOG_FTP
LOG_NFACILITIES
LOG_PERROR
L_tmpnam
+MADV_COLD
MADV_DODUMP
MADV_DOFORK
MADV_DONTDUMP
MADV_DONTFORK
MADV_DONTNEED
+MADV_DONTNEED_LOCKED
MADV_FREE
MADV_HUGEPAGE
MADV_HWPOISON
+MADV_KEEPONFORK
MADV_MERGEABLE
MADV_NOHUGEPAGE
MADV_NORMAL
+MADV_PAGEOUT
+MADV_POPULATE_READ
+MADV_POPULATE_WRITE
MADV_RANDOM
MADV_REMOVE
MADV_SEQUENTIAL
MADV_UNMERGEABLE
MADV_WILLNEED
+MADV_WIPEONFORK
MAP_DENYWRITE
MAP_EXECUTABLE
MAP_FILE
diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt
index 1ae531f55a..6dd75bde86 100644
--- a/libc-test/semver/netbsd.txt
+++ b/libc-test/semver/netbsd.txt
@@ -1567,3 +1567,5 @@ EXTATTR_NAMESPACE_EMPTY
extattr_list_fd
extattr_list_file
extattr_list_link
+EOWNERDEAD
+ENOTRECOVERABLE
diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt
index 090311982c..bcd65e09e5 100644
--- a/libc-test/semver/openbsd.txt
+++ b/libc-test/semver/openbsd.txt
@@ -527,6 +527,7 @@ MSG_CMSG_CLOEXEC
MSG_DONTWAIT
MSG_MCAST
MSG_NOSIGNAL
+MSG_WAITFORONE
MNT_LAZY
MNT_NOWAIT
MNT_WAIT
diff --git a/libc-test/semver/redox.txt b/libc-test/semver/redox.txt
index 4b6e126ea6..cd07660cc4 100644
--- a/libc-test/semver/redox.txt
+++ b/libc-test/semver/redox.txt
@@ -137,8 +137,8 @@ SO_PEERCRED
SO_PEERSEC
SO_PRIORITY
SO_PROTOCOL
-SO_REUSEPORT
SO_RCVBUFFORCE
+SO_REUSEPORT
SO_SNDBUFFORCE
TCFLSH
TCGETS
@@ -180,6 +180,7 @@ bsearch
chroot
clearerr
difftime
+endpwent
endservent
epoll_create
epoll_create1
@@ -189,12 +190,17 @@ epoll_wait
explicit_bzero
fchdir
fmemopen
+getdtablesize
+getgrgid_r
+getgrnam_r
+getgrouplist
getline
+getpwent
+getpwnam_r
getrlimit
getrusage
getservbyport
getservent
-getdtablesize
killpg
lockf
madvise
@@ -206,6 +212,7 @@ pipe2
pthread_condattr_setclock
qsort
reallocarray
+setpwent
setrlimit
setservent
strcasecmp
diff --git a/src/fuchsia/aarch64.rs b/src/fuchsia/aarch64.rs
index 259893c0fa..33e3934d66 100644
--- a/src/fuchsia/aarch64.rs
+++ b/src/fuchsia/aarch64.rs
@@ -62,5 +62,6 @@ s! {
}
}
+// 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;
diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs
index ea1ae466b2..6b12185413 100644
--- a/src/fuchsia/mod.rs
+++ b/src/fuchsia/mod.rs
@@ -4260,6 +4260,9 @@ cfg_if! {
} else if #[cfg(any(target_arch = "x86_64"))] {
mod x86_64;
pub use self::x86_64::*;
+ } else if #[cfg(any(target_arch = "riscv64"))] {
+ mod riscv64;
+ pub use self::riscv64::*;
} else {
// Unknown target_arch
}
diff --git a/src/fuchsia/riscv64.rs b/src/fuchsia/riscv64.rs
new file mode 100644
index 0000000000..de2b7197d7
--- /dev/null
+++ b/src/fuchsia/riscv64.rs
@@ -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,
+ }
+}
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs
index 7bf2534455..01d0b4328d 100644
--- a/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs
@@ -3,3 +3,10 @@ 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;
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index 2ee676d973..c453e7c9b1 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -3696,6 +3696,7 @@ pub const MSG_NBIO: ::c_int = 0x00004000;
pub const MSG_COMPAT: ::c_int = 0x00008000;
pub const MSG_CMSG_CLOEXEC: ::c_int = 0x00040000;
pub const MSG_NOSIGNAL: ::c_int = 0x20000;
+pub const MSG_WAITFORONE: ::c_int = 0x00080000;
// utmpx entry types
pub const EMPTY: ::c_short = 0;
@@ -3767,6 +3768,15 @@ pub const AT_EUID: ::c_int = 12;
pub const AT_GID: ::c_int = 13;
pub const AT_EGID: ::c_int = 14;
pub const AT_EXECPATH: ::c_int = 15;
+pub const AT_CANARY: ::c_int = 16;
+pub const AT_OSRELDATE: ::c_int = 18;
+pub const AT_NCPUS: ::c_int = 19;
+pub const AT_PAGESIZES: ::c_int = 20;
+pub const AT_TIMEKEEP: ::c_int = 22;
+pub const AT_HWCAP: ::c_int = 25;
+pub const AT_HWCAP2: ::c_int = 26;
+pub const AT_USRSTACKBASE: ::c_int = 35;
+pub const AT_USRSTACKLIM: ::c_int = 36;
pub const TABDLY: ::tcflag_t = 0x00000004;
pub const TAB0: ::tcflag_t = 0x00000000;
diff --git a/src/unix/bsd/freebsdlike/freebsd/x86.rs b/src/unix/bsd/freebsdlike/freebsd/x86.rs
index d3a3f34b0f..4046ec3109 100644
--- a/src/unix/bsd/freebsdlike/freebsd/x86.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/x86.rs
@@ -6,6 +6,41 @@ 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,
@@ -31,6 +66,15 @@ s! {
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
@@ -43,4 +87,115 @@ cfg_if! {
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
diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
index 402257fd3b..210a2a392a 100644
--- a/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -1464,7 +1464,15 @@ pub const ENOATTR: ::c_int = 93;
pub const EMULTIHOP: ::c_int = 94;
pub const ENOLINK: ::c_int = 95;
pub const EPROTO: ::c_int = 96;
-pub const ELAST: ::c_int = 96;
+pub const EOWNERDEAD: ::c_int = 97;
+pub const ENOTRECOVERABLE: ::c_int = 98;
+#[deprecated(
+ since = "0.2.143",
+ note = "This value will always match the highest defined error number \
+ and thus is not stable. \
+ See #3040 for more info."
+)]
+pub const ELAST: ::c_int = 98;
pub const F_DUPFD_CLOEXEC: ::c_int = 12;
pub const F_CLOSEM: ::c_int = 10;
@@ -2505,31 +2513,7 @@ extern "C" {
) -> ::c_int;
pub fn reallocarr(ptr: *mut ::c_void, number: ::size_t, size: ::size_t) -> ::c_int;
-}
-
-#[link(name = "rt")]
-extern "C" {
- pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
- pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
- pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
- pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
- pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
- #[link_name = "__aio_suspend50"]
- pub fn aio_suspend(
- aiocb_list: *const *const aiocb,
- nitems: ::c_int,
- timeout: *const ::timespec,
- ) -> ::c_int;
- pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
- pub fn lio_listio(
- mode: ::c_int,
- aiocb_list: *const *mut aiocb,
- nitems: ::c_int,
- sevp: *mut sigevent,
- ) -> ::c_int;
-}
-extern "C" {
pub fn chflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
pub fn fchflags(fd: ::c_int, flags: ::c_ulong) -> ::c_int;
pub fn lchflags(path: *const ::c_char, flags: ::c_ulong) -> ::c_int;
@@ -2959,6 +2943,28 @@ extern "C" {
pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
}
+#[link(name = "rt")]
+extern "C" {
+ pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
+ pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
+ pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
+ pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
+ pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
+ #[link_name = "__aio_suspend50"]
+ pub fn aio_suspend(
+ aiocb_list: *const *const aiocb,
+ nitems: ::c_int,
+ timeout: *const ::timespec,
+ ) -> ::c_int;
+ pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
+ pub fn lio_listio(
+ mode: ::c_int,
+ aiocb_list: *const *mut aiocb,
+ nitems: ::c_int,
+ sevp: *mut sigevent,
+ ) -> ::c_int;
+}
+
#[link(name = "util")]
extern "C" {
#[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")]
diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs
index 8099bad1d1..9e9de2e120 100644
--- a/src/unix/bsd/netbsdlike/openbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs
@@ -1073,6 +1073,8 @@ pub const IP_RECVIF: ::c_int = 30;
pub const TCP_MD5SIG: ::c_int = 0x04;
pub const TCP_NOPUSH: ::c_int = 0x10;
+pub const MSG_WAITFORONE: ::c_int = 0x1000;
+
pub const AF_ECMA: ::c_int = 8;
pub const AF_ROUTE: ::c_int = 17;
pub const AF_ENCAP: ::c_int = 28;
diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs
index 2fa3327834..c1a38f1b36 100644
--- a/src/unix/haiku/mod.rs
+++ b/src/unix/haiku/mod.rs
@@ -2055,7 +2055,7 @@ extern "C" {
) -> ::c_int;
}
-#[link(name = "unix")]
+#[link(name = "gnu")]
extern "C" {
pub fn memmem(
source: *const ::c_void,
diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs
index 4693978311..8acf5b5520 100644
--- a/src/unix/linux_like/linux/arch/generic/mod.rs
+++ b/src/unix/linux_like/linux/arch/generic/mod.rs
@@ -104,6 +104,8 @@ cfg_if! {
pub const SO_DETACH_REUSEPORT_BPF: ::c_int = 68;
}
}
+// pub const SO_PREFER_BUSY_POLL: ::c_int = 69;
+// pub const SO_BUSY_POLL_BUDGET: ::c_int = 70;
cfg_if! {
if #[cfg(any(target_arch = "x86",
@@ -114,16 +116,8 @@ cfg_if! {
target_arch = "s390x"))] {
pub const FICLONE: ::c_ulong = 0x40049409;
pub const FICLONERANGE: ::c_ulong = 0x4020940D;
- } else if #[cfg(any(target_arch = "mips",
- target_arch = "mips64",
- target_arch = "powerpc",
- target_arch = "powerpc64"))] {
- pub const FICLONE: ::c_ulong = 0x80049409;
- pub const FICLONERANGE: ::c_ulong = 0x8020940D;
}
}
-// pub const SO_PREFER_BUSY_POLL: ::c_int = 69;
-// pub const SO_BUSY_POLL_BUDGET: ::c_int = 70;
// Defined in unix/linux_like/mod.rs
// pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
diff --git a/src/unix/linux_like/linux/arch/mips/mod.rs b/src/unix/linux_like/linux/arch/mips/mod.rs
index 077417de52..34c00a2936 100644
--- a/src/unix/linux_like/linux/arch/mips/mod.rs
+++ b/src/unix/linux_like/linux/arch/mips/mod.rs
@@ -103,6 +103,9 @@ pub const SO_TIMESTAMPING: ::c_int = 37;
// pub const SO_PREFER_BUSY_POLL: ::c_int = 69;
// pub const SO_BUSY_POLL_BUDGET: ::c_int = 70;
+pub const FICLONE: ::c_ulong = 0x80049409;
+pub const FICLONERANGE: ::c_ulong = 0x8020940D;
+
// Defined in unix/linux_like/mod.rs
// pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
diff --git a/src/unix/linux_like/linux/arch/powerpc/mod.rs b/src/unix/linux_like/linux/arch/powerpc/mod.rs
index 637b7a1e34..64c3eaab54 100644
--- a/src/unix/linux_like/linux/arch/powerpc/mod.rs
+++ b/src/unix/linux_like/linux/arch/powerpc/mod.rs
@@ -85,6 +85,9 @@ pub const SO_BINDTOIFINDEX: ::c_int = 62;
// pub const SO_PREFER_BUSY_POLL: ::c_int = 69;
// pub const SO_BUSY_POLL_BUDGET: ::c_int = 70;
+pub const FICLONE: ::c_ulong = 0x80049409;
+pub const FICLONERANGE: ::c_ulong = 0x8020940D;
+
// Defined in unix/linux_like/mod.rs
// pub const SCM_TIMESTAMP: ::c_int = SO_TIMESTAMP;
pub const SCM_TIMESTAMPNS: ::c_int = SO_TIMESTAMPNS;
diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs
index 1aad8361ad..e88ad4eb2c 100644
--- a/src/unix/linux_like/linux/gnu/mod.rs
+++ b/src/unix/linux_like/linux/gnu/mod.rs
@@ -1240,9 +1240,6 @@ extern "C" {
pub fn reallocarray(ptr: *mut ::c_void, nmemb: ::size_t, size: ::size_t) -> *mut ::c_void;
pub fn ctermid(s: *mut ::c_char) -> *mut ::c_char;
-}
-
-extern "C" {
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int;
pub fn glob64(
@@ -1331,9 +1328,6 @@ extern "C" {
/// GNU version of `basename(3)`, defined in `string.h`.
#[link_name = "basename"]
pub fn gnu_basename(path: *const ::c_char) -> *mut ::c_char;
-}
-
-extern "C" {
pub fn dlmopen(lmid: Lmid_t, filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
pub fn dlinfo(handle: *mut ::c_void, request: ::c_int, info: *mut ::c_void) -> ::c_int;
pub fn dladdr1(
@@ -1343,15 +1337,10 @@ extern "C" {
flags: ::c_int,
) -> ::c_int;
pub fn malloc_trim(__pad: ::size_t) -> ::c_int;
-}
-
-extern "C" {
pub fn gnu_get_libc_release() -> *const ::c_char;
pub fn gnu_get_libc_version() -> *const ::c_char;
-}
-// posix/spawn.h
-extern "C" {
+ // posix/spawn.h
// Added in `glibc` 2.29
pub fn posix_spawn_file_actions_addchdir_np(
actions: *mut ::posix_spawn_file_actions_t,
@@ -1372,10 +1361,8 @@ extern "C" {
actions: *mut ::posix_spawn_file_actions_t,
tcfd: ::c_int,
) -> ::c_int;
-}
-// mntent.h
-extern "C" {
+ // mntent.h
pub fn getmntent_r(
stream: *mut ::FILE,
mntbuf: *mut ::mntent,
diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs
index a982901113..dae589fd14 100644
--- a/src/unix/linux_like/linux/mod.rs
+++ b/src/unix/linux_like/linux/mod.rs
@@ -1933,8 +1933,6 @@ pub const CLONE_PIDFD: ::c_int = 0x1000;
// netinet/in.h
// NOTE: These are in addition to the constants defined in src/unix/mod.rs
-/// Multipath TCP
-pub const IPPROTO_MPTCP: ::c_int = 262;
#[deprecated(
since = "0.2.80",
note = "This value was increased in the newer kernel \
diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs
index 584e308ce2..e08bb7dbb0 100644
--- a/src/unix/linux_like/mod.rs
+++ b/src/unix/linux_like/mod.rs
@@ -662,7 +662,18 @@ pub const MADV_HUGEPAGE: ::c_int = 14;
pub const MADV_NOHUGEPAGE: ::c_int = 15;
pub const MADV_DONTDUMP: ::c_int = 16;
pub const MADV_DODUMP: ::c_int = 17;
+pub const MADV_WIPEONFORK: ::c_int = 18;
+pub const MADV_KEEPONFORK: ::c_int = 19;
+pub const MADV_COLD: ::c_int = 20;
+pub const MADV_PAGEOUT: ::c_int = 21;
pub const MADV_HWPOISON: ::c_int = 100;
+cfg_if! {
+ if #[cfg(not(target_os = "emscripten"))] {
+ pub const MADV_POPULATE_READ: ::c_int = 22;
+ pub const MADV_POPULATE_WRITE: ::c_int = 23;
+ pub const MADV_DONTNEED_LOCKED: ::c_int = 24;
+ }
+}
pub const IFF_UP: ::c_int = 0x1;
pub const IFF_BROADCAST: ::c_int = 0x2;
@@ -905,6 +916,8 @@ pub const IPPROTO_UDPLITE: ::c_int = 136;
pub const IPPROTO_RAW: ::c_int = 255;
pub const IPPROTO_BEETPH: ::c_int = 94;
pub const IPPROTO_MPLS: ::c_int = 137;
+/// Multipath TCP
+pub const IPPROTO_MPTCP: ::c_int = 262;
pub const MCAST_EXCLUDE: ::c_int = 0;
pub const MCAST_INCLUDE: ::c_int = 1;
diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs
index 1477a60402..d46844268f 100644
--- a/src/unix/newlib/mod.rs
+++ b/src/unix/newlib/mod.rs
@@ -730,6 +730,9 @@ cfg_if! {
} else if #[cfg(target_os = "horizon")] {
mod horizon;
pub use self::horizon::*;
+ } else if #[cfg(target_os = "vita")] {
+ mod vita;
+ pub use self::vita::*;
} else if #[cfg(target_arch = "arm")] {
mod arm;
pub use self::arm::*;
diff --git a/src/unix/newlib/vita/mod.rs b/src/unix/newlib/vita/mod.rs
new file mode 100644
index 0000000000..801a408b99
--- /dev/null
+++ b/src/unix/newlib/vita/mod.rs
@@ -0,0 +1,175 @@
+pub type clock_t = ::c_long;
+
+pub type c_char = i8;
+pub type wchar_t = u32;
+
+pub type c_long = i32;
+pub type c_ulong = u32;
+
+s! {
+ pub struct sockaddr {
+ pub sa_family: ::sa_family_t,
+ pub sa_data: [::c_char; 14],
+ }
+
+ pub struct sockaddr_in6 {
+ 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 sockaddr_in {
+ pub sin_family: ::sa_family_t,
+ pub sin_port: ::in_port_t,
+ pub sin_addr: ::in_addr,
+ pub sin_zero: [u8; 8],
+ }
+
+ pub struct sockaddr_un {
+ pub sun_len: ::c_uchar,
+ pub sun_family: ::sa_family_t,
+ pub sun_path: [::c_char; 104usize],
+ }
+
+ pub struct sockaddr_storage {
+ pub ss_family: ::sa_family_t,
+ pub __ss_padding: [u8; 26],
+ }
+
+
+ pub struct sched_param {
+ pub sched_priority: ::c_int,
+ }
+}
+
+pub const AF_UNIX: ::c_int = 1;
+pub const AF_INET6: ::c_int = 23;
+
+pub const FIONBIO: ::c_ulong = 0x8004667e;
+
+pub const POLLIN: ::c_short = 1;
+pub const POLLPRI: ::c_short = 2;
+pub const POLLOUT: ::c_short = 4;
+pub const POLLERR: ::c_short = 8;
+pub const POLLHUP: ::c_short = 16;
+pub const POLLNVAL: ::c_short = 32;
+
+pub const RTLD_DEFAULT: *mut ::c_void = 0 as *mut ::c_void;
+
+pub const SOL_SOCKET: ::c_int = 0xffff;
+
+pub const MSG_OOB: ::c_int = 0x1;
+pub const MSG_PEEK: ::c_int = 0x2;
+pub const MSG_DONTROUTE: ::c_int = 0x4;
+pub const MSG_WAITALL: ::c_int = 0x8;
+pub const MSG_DONTWAIT: ::c_int = 0x10;
+pub const MSG_NOSIGNAL: ::c_int = 0x20;
+pub const MSG_TRUNC: ::c_int = 0x0100;
+pub const MSG_CTRUNC: ::c_int = 0x0200;
+
+pub const UTIME_OMIT: c_long = -1;
+pub const AT_FDCWD: ::c_int = -2;
+
+pub const O_DIRECTORY: ::c_int = 0x200000;
+pub const O_NOFOLLOW: ::c_int = 0x100000;
+
+pub const AT_EACCESS: ::c_int = 1;
+pub const AT_SYMLINK_NOFOLLOW: ::c_int = 2;
+pub const AT_SYMLINK_FOLLOW: ::c_int = 4;
+pub const AT_REMOVEDIR: ::c_int = 8;
+
+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 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 EAI_BADFLAGS: ::c_int = -1;
+pub const EAI_NONAME: ::c_int = -2;
+pub const EAI_AGAIN: ::c_int = -3;
+pub const EAI_FAIL: ::c_int = -4;
+pub const EAI_NODATA: ::c_int = -5;
+pub const EAI_FAMILY: ::c_int = -6;
+pub const EAI_SOCKTYPE: ::c_int = -7;
+pub const EAI_SERVICE: ::c_int = -8;
+pub const EAI_ADDRFAMILY: ::c_int = -9;
+pub const EAI_MEMORY: ::c_int = -10;
+pub const EAI_SYSTEM: ::c_int = -11;
+pub const EAI_OVERFLOW: ::c_int = -12;
+
+pub const _SC_PAGESIZE: ::c_int = 8;
+pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 51;
+pub const PTHREAD_STACK_MIN: ::size_t = 200;
+
+extern "C" {
+ pub fn futimens(fd: ::c_int, times: *const ::timespec) -> ::c_int;
+ pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
+ pub fn readv(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
+
+ pub fn pthread_create(
+ native: *mut ::pthread_t,
+ attr: *const ::pthread_attr_t,
+ f: extern "C" fn(_: *mut ::c_void) -> *mut ::c_void,
+ value: *mut ::c_void,
+ ) -> ::c_int;
+
+ pub fn pthread_attr_getschedparam(
+ attr: *const ::pthread_attr_t,
+ param: *mut sched_param,
+ ) -> ::c_int;
+
+ pub fn pthread_attr_setschedparam(
+ attr: *mut ::pthread_attr_t,
+ param: *const sched_param,
+ ) -> ::c_int;
+
+ pub fn pthread_attr_getprocessorid_np(
+ attr: *const ::pthread_attr_t,
+ processor_id: *mut ::c_int,
+ ) -> ::c_int;
+
+ pub fn pthread_attr_setprocessorid_np(
+ attr: *mut ::pthread_attr_t,
+ processor_id: ::c_int,
+ ) -> ::c_int;
+
+ pub fn pthread_getschedparam(
+ native: ::pthread_t,
+ policy: *mut ::c_int,
+ param: *mut ::sched_param,
+ ) -> ::c_int;
+
+ pub fn pthread_setschedparam(
+ native: ::pthread_t,
+ policy: ::c_int,
+ param: *const ::sched_param,
+ ) -> ::c_int;
+
+ pub fn pthread_condattr_getclock(
+ attr: *const ::pthread_condattr_t,
+ clock_id: *mut ::clockid_t,
+ ) -> ::c_int;
+
+ pub fn pthread_condattr_setclock(
+ attr: *mut ::pthread_condattr_t,
+ clock_id: ::clockid_t,
+ ) -> ::c_int;
+
+ pub fn pthread_getprocessorid_np() -> ::c_int;
+
+ pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
+}
+
+pub use crate::unix::newlib::generic::{sigset_t, stat};
diff --git a/src/unix/redox/mod.rs b/src/unix/redox/mod.rs
index dec47c610b..d946f46524 100644
--- a/src/unix/redox/mod.rs
+++ b/src/unix/redox/mod.rs
@@ -47,6 +47,7 @@ pub type speed_t = u32;
pub type suseconds_t = ::c_int;
pub type tcflag_t = u32;
pub type time_t = ::c_longlong;
+pub type id_t = ::c_uint;
#[cfg_attr(feature = "extra_traits", derive(Debug))]
pub enum timezone {}
@@ -527,6 +528,10 @@ pub const POLLOUT: ::c_short = 0x004;
pub const POLLERR: ::c_short = 0x008;
pub const POLLHUP: ::c_short = 0x010;
pub const POLLNVAL: ::c_short = 0x020;
+pub const POLLRDNORM: ::c_short = 0x040;
+pub const POLLRDBAND: ::c_short = 0x080;
+pub const POLLWRNORM: ::c_short = 0x100;
+pub const POLLWRBAND: ::c_short = 0x200;
// pthread.h
pub const PTHREAD_MUTEX_NORMAL: ::c_int = 0;
@@ -995,6 +1000,28 @@ extern "C" {
pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int;
pub fn getdtablesize() -> ::c_int;
+ // grp.h
+ pub fn getgrgid_r(
+ gid: ::gid_t,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group,
+ ) -> ::c_int;
+ pub fn getgrnam_r(
+ name: *const ::c_char,
+ grp: *mut ::group,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut ::group,
+ ) -> ::c_int;
+ pub fn getgrouplist(
+ user: *const ::c_char,
+ group: ::gid_t,
+ groups: *mut ::gid_t,
+ ngroups: *mut ::c_int,
+ ) -> ::c_int;
+
// malloc.h
pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
@@ -1027,6 +1054,16 @@ extern "C" {
) -> ::c_int;
// pwd.h
+ pub fn getpwent() -> *mut passwd;
+ pub fn setpwent();
+ pub fn endpwent();
+ pub fn getpwnam_r(
+ name: *const ::c_char,
+ pwd: *mut passwd,
+ buf: *mut ::c_char,
+ buflen: ::size_t,
+ result: *mut *mut passwd,
+ ) -> ::c_int;
pub fn getpwuid_r(
uid: ::uid_t,
pwd: *mut passwd,
@@ -1104,6 +1141,15 @@ extern "C" {
// strings.h
pub fn explicit_bzero(p: *mut ::c_void, len: ::size_t);
+
+ 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 getsubopt(
+ optionp: *mut *mut c_char,
+ tokens: *const *mut c_char,
+ valuep: *mut *mut c_char,
+ ) -> ::c_int;
}
cfg_if! {
diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs
index 12c88f31a1..cc688331f4 100644
--- a/src/unix/solarish/mod.rs
+++ b/src/unix/solarish/mod.rs
@@ -2579,7 +2579,7 @@ pub const AT_SUN_FPTYPE: ::c_uint = 2027;
// and 4 bytes everywhere else:
#[cfg(target_arch = "sparc64")]
const _CMSG_HDR_ALIGNMENT: usize = 8;
-#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+#[cfg(not(target_arch = "sparc64"))]
const _CMSG_HDR_ALIGNMENT: usize = 4;
const _CMSG_DATA_ALIGNMENT: usize = ::mem::size_of::<::c_int>();
diff --git a/src/windows/mod.rs b/src/windows/mod.rs
index 7f2f1ded19..26bff7f7a6 100644
--- a/src/windows/mod.rs
+++ b/src/windows/mod.rs
@@ -278,13 +278,17 @@ impl ::Clone for fpos_t {
}
// Special handling for all print and scan type functions because of https://github.com/rust-lang/libc/issues/2860
-#[cfg_attr(
- all(windows, target_env = "msvc"),
- link(name = "legacy_stdio_definitions")
-)]
-extern "C" {
- pub fn printf(format: *const c_char, ...) -> ::c_int;
- pub fn fprintf(stream: *mut FILE, format: *const c_char, ...) -> ::c_int;
+cfg_if! {
+ if #[cfg(not(feature = "rustc-dep-of-std"))] {
+ #[cfg_attr(
+ all(windows, target_env = "msvc"),
+ link(name = "legacy_stdio_definitions")
+ )]
+ extern "C" {
+ pub fn printf(format: *const c_char, ...) -> ::c_int;
+ pub fn fprintf(stream: *mut FILE, format: *const c_char, ...) -> ::c_int;
+ }
+ }
}
extern "C" {