summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cirrus.yml2
-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/unix/bsd/apple/mod.rs74
-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/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.rs16
-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/windows/mod.rs18
28 files changed, 471 insertions, 131 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/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 8c20546771..5db14d467d 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -1789,6 +1789,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,
}
});
@@ -2287,6 +2297,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,
}
});
@@ -3278,7 +3291,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",
@@ -3390,7 +3403,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
@@ -3445,9 +3462,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,
@@ -3492,7 +3506,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_")
@@ -3589,7 +3603,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,
@@ -3658,24 +3672,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
@@ -3687,33 +3701,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+
@@ -3722,11 +3716,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,
}
@@ -3762,9 +3757,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.
@@ -3923,6 +3915,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/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index 3348a7a8af..e380000038 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -435,6 +435,80 @@ s! {
pub ifm_data: if_data,
}
+ pub struct ifa_msghdr {
+ pub ifam_msglen: ::c_ushort,
+ pub ifam_version: ::c_uchar,
+ pub ifam_type: ::c_uchar,
+ pub ifam_addrs: ::c_int,
+ pub ifam_flags: ::c_int,
+ pub ifam_index: ::c_ushort,
+ pub ifam_metric: ::c_int,
+ }
+
+ pub struct ifma_msghdr {
+ pub ifmam_msglen: ::c_ushort,
+ pub ifmam_version: ::c_uchar,
+ pub ifmam_type: ::c_uchar,
+ pub ifmam_addrs: ::c_int,
+ pub ifmam_flags: ::c_int,
+ pub ifmam_index: ::c_ushort,
+ }
+
+ pub struct ifma_msghdr2 {
+ pub ifmam_msglen: ::c_ushort,
+ pub ifmam_version: ::c_uchar,
+ pub ifmam_type: ::c_uchar,
+ pub ifmam_addrs: ::c_int,
+ pub ifmam_flags: ::c_int,
+ pub ifmam_index: ::c_ushort,
+ pub ifmam_refcount: i32,
+ }
+
+ pub struct rt_metrics {
+ pub rmx_locks: u32,
+ pub rmx_mtu: u32,
+ pub rmx_hopcount: u32,
+ pub rmx_expire: i32,
+ pub rmx_recvpipe: u32,
+ pub rmx_sendpipe: u32,
+ pub rmx_ssthresh: u32,
+ pub rmx_rtt: u32,
+ pub rmx_rttvar: u32,
+ pub rmx_pksent: u32,
+ pub rmx_state: u32,
+ pub rmx_filler: [u32; 3],
+ }
+
+ pub struct rt_msghdr {
+ pub rtm_msglen: ::c_ushort,
+ pub rtm_version: ::c_uchar,
+ pub rtm_type: ::c_uchar,
+ pub rtm_index: ::c_ushort,
+ pub rtm_flags: ::c_int,
+ pub rtm_addrs: ::c_int,
+ pub rtm_pid: ::pid_t,
+ pub rtm_seq: ::c_int,
+ pub rtm_errno: ::c_int,
+ pub rtm_use: ::c_int,
+ pub rtm_inits: u32,
+ pub rtm_rmx: rt_metrics,
+ }
+
+ pub struct rt_msghdr2 {
+ pub rtm_msglen: ::c_ushort,
+ pub rtm_version: ::c_uchar,
+ pub rtm_type: ::c_uchar,
+ pub rtm_index: ::c_ushort,
+ pub rtm_flags: ::c_int,
+ pub rtm_addrs: ::c_int,
+ pub rtm_refcnt: i32,
+ pub rtm_parentflags: ::c_int,
+ pub rtm_reserved: ::c_int,
+ pub rtm_use: ::c_int,
+ pub rtm_inits: u32,
+ pub rtm_rmx: rt_metrics,
+ }
+
pub struct termios {
pub c_iflag: ::tcflag_t,
pub c_oflag: ::tcflag_t,
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/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
index d9ffa923d8..093b24fe95 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;
@@ -2516,31 +2524,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;
@@ -2970,6 +2954,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 87f48b63b5..ef66311268 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..7bc94c6f05 100644
--- a/src/unix/linux_like/linux/arch/generic/mod.rs
+++ b/src/unix/linux_like/linux/arch/generic/mod.rs
@@ -94,7 +94,8 @@ cfg_if! {
// But they may still not have those _OLD ones.
if #[cfg(all(any(target_arch = "x86",
target_arch = "x86_64",
- target_arch = "aarch64"),
+ target_arch = "aarch64",
+ target_arch = "loongarch64"),
not(any(target_env = "musl", target_env = "ohos"))))] {
pub const SO_TIMESTAMP_NEW: ::c_int = 63;
pub const SO_TIMESTAMPNS_NEW: ::c_int = 64;
@@ -104,6 +105,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",
@@ -111,19 +114,12 @@ cfg_if! {
target_arch = "arm",
target_arch = "aarch64",
target_arch = "riscv64",
- target_arch = "s390x"))] {
+ target_arch = "s390x",
+ target_arch = "loongarch64"))] {
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/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" {