summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--libc-test/Cargo.toml4
-rw-r--r--libc-test/build.rs4
-rw-r--r--libc-test/semver/freebsd.txt1
-rw-r--r--libc-test/semver/linux.txt10
-rw-r--r--libc-test/semver/openbsd.txt1
-rw-r--r--src/unix/bsd/apple/mod.rs74
-rw-r--r--src/unix/bsd/freebsdlike/dragonfly/mod.rs8
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs10
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs10
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs10
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs10
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs7
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/mod.rs1
-rw-r--r--src/unix/bsd/netbsdlike/netbsd/mod.rs11
-rw-r--r--src/unix/bsd/netbsdlike/openbsd/mod.rs15
-rw-r--r--src/unix/linux_like/linux/arch/generic/mod.rs6
-rw-r--r--src/unix/linux_like/linux/mod.rs13
-rw-r--r--src/unix/solarish/mod.rs18
19 files changed, 210 insertions, 5 deletions
diff --git a/Cargo.toml b/Cargo.toml
index dd7c11a110..326310c934 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "libc"
-version = "0.2.142"
+version = "0.2.143"
authors = ["The Rust Project Developers"]
license = "MIT OR Apache-2.0"
readme = "README.md"
diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml
index 83bfcba9c6..f9540b4f5c 100644
--- a/libc-test/Cargo.toml
+++ b/libc-test/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "libc-test"
-version = "0.2.142"
+version = "0.2.143"
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.142"
+version = "0.2.143"
default-features = false
[build-dependencies]
diff --git a/libc-test/build.rs b/libc-test/build.rs
index e23b0d0a37..9f76583bff 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -821,6 +821,7 @@ fn test_solarish(target: &str) {
"sys/ioctl.h",
"sys/lgrp_user.h",
"sys/loadavg.h",
+ "sys/mkdev.h",
"sys/mman.h",
"sys/mount.h",
"sys/priv.h",
@@ -3683,6 +3684,9 @@ fn test_linux(target: &str) {
// FIXME: requires Linux >= 5.7:
"MREMAP_DONTUNMAP" if musl => true,
+ // FIXME: requires Linux >= v5.8
+ "IF_LINK_MODE_TESTING" if musl || sparc64 => true,
+
// FIXME: Requires more recent kernel headers (5.9 / 5.11):
| "CLOSE_RANGE_UNSHARE"
| "CLOSE_RANGE_CLOEXEC" if musl => true,
diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt
index ed9aceecbd..ffb424e8b5 100644
--- a/libc-test/semver/freebsd.txt
+++ b/libc-test/semver/freebsd.txt
@@ -785,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 4e9ff8d420..5d86647f08 100644
--- a/libc-test/semver/linux.txt
+++ b/libc-test/semver/linux.txt
@@ -839,6 +839,16 @@ HWTSTAMP_FILTER_PTP_V2_SYNC
HWTSTAMP_FILTER_PTP_V2_DELAY_REQ
HWTSTAMP_FILTER_NTP_ALL
IBSHIFT
+IF_LINK_MODE_DEFAULT
+IF_LINK_MODE_DORMANT
+IF_LINK_MODE_TESTING
+IF_OPER_DORMANT
+IF_OPER_DOWN
+IF_OPER_LOWERLAYERDOWN
+IF_OPER_NOTPRESENT
+IF_OPER_TESTING
+IF_OPER_UNKNOWN
+IF_OPER_UP
IFA_ADDRESS
IFA_ANYCAST
IFA_BROADCAST
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/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index 6de936227c..66f03f67f6 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/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
index 63c0594f41..72ea8c7504 100644
--- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs
+++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs
@@ -1578,6 +1578,14 @@ f! {
let (idx, offset) = ((cpu >> 6) & 3, cpu & 63);
0 != cpuset.ary[idx] & (1 << offset)
}
+
+ 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
+ }
}
safe_f! {
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
index f2d170fb28..de34069eab 100644
--- a/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
@@ -442,6 +442,16 @@ safe_f! {
}
}
+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;
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
index 5cd4eff26f..10fcaa03a4 100644
--- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
@@ -462,6 +462,16 @@ safe_f! {
}
}
+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;
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
index 56564eeb45..0e04a12e70 100644
--- a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs
@@ -481,6 +481,16 @@ safe_f! {
}
}
+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;
diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs
index d60f1a174f..a86ca6e7c5 100644
--- a/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs
@@ -481,6 +481,16 @@ safe_f! {
}
}
+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;
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 01a3bf9db8..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;
diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
index 210a2a392a..093b24fe95 100644
--- a/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -2472,6 +2472,17 @@ f! {
pub fn PROT_MPROTECT_EXTRACT(x: ::c_int) -> ::c_int {
(x >> 3) & 0x7
}
+
+ pub fn major(dev: ::dev_t) -> ::c_int {
+ (((dev as u32) & 0x000fff00) >> 8) as ::c_int
+ }
+
+ pub fn minor(dev: ::dev_t) -> ::c_int {
+ let mut res = 0;
+ res |= ((dev as u32) & 0xfff00000) >> 12;
+ res |= (dev as u32) & 0x000000ff;
+ res as ::c_int
+ }
}
safe_f! {
diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs
index 8099bad1d1..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;
@@ -1729,6 +1731,19 @@ f! {
(_ALIGN(::mem::size_of::<::cmsghdr>()) + _ALIGN(length as usize))
as ::c_uint
}
+
+ pub fn major(dev: ::dev_t) -> ::c_uint{
+ ((dev as ::c_uint) >> 8) & 0xff
+ }
+
+ pub fn minor(dev: ::dev_t) -> ::c_uint {
+ let dev = dev as ::c_uint;
+ let mut res = 0;
+ res |= (dev) & 0xff;
+ res |= ((dev) & 0xffff0000) >> 8;
+
+ res
+ }
}
safe_f! {
diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs
index 8acf5b5520..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;
@@ -113,7 +114,8 @@ 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;
}
diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs
index dae589fd14..45a383b405 100644
--- a/src/unix/linux_like/linux/mod.rs
+++ b/src/unix/linux_like/linux/mod.rs
@@ -3192,6 +3192,19 @@ pub const ALG_SET_AEAD_AUTHSIZE: ::c_int = 5;
pub const ALG_OP_DECRYPT: ::c_int = 0;
pub const ALG_OP_ENCRYPT: ::c_int = 1;
+// include/uapi/linux/if.h
+pub const IF_OPER_UNKNOWN: ::c_int = 0;
+pub const IF_OPER_NOTPRESENT: ::c_int = 1;
+pub const IF_OPER_DOWN: ::c_int = 2;
+pub const IF_OPER_LOWERLAYERDOWN: ::c_int = 3;
+pub const IF_OPER_TESTING: ::c_int = 4;
+pub const IF_OPER_DORMANT: ::c_int = 5;
+pub const IF_OPER_UP: ::c_int = 6;
+
+pub const IF_LINK_MODE_DEFAULT: ::c_int = 0;
+pub const IF_LINK_MODE_DORMANT: ::c_int = 1;
+pub const IF_LINK_MODE_TESTING: ::c_int = 2;
+
// include/uapi/linux/udp.h
pub const UDP_CORK: ::c_int = 1;
pub const UDP_ENCAP: ::c_int = 100;
diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs
index cc688331f4..48ab4dbb92 100644
--- a/src/unix/solarish/mod.rs
+++ b/src/unix/solarish/mod.rs
@@ -2584,6 +2584,8 @@ const _CMSG_HDR_ALIGNMENT: usize = 4;
const _CMSG_DATA_ALIGNMENT: usize = ::mem::size_of::<::c_int>();
+const NEWDEV: ::c_int = 1;
+
const_fn! {
{const} fn _CMSG_HDR_ALIGN(p: usize) -> usize {
(p + _CMSG_HDR_ALIGNMENT - 1) & !(_CMSG_HDR_ALIGNMENT - 1)
@@ -3198,6 +3200,10 @@ extern "C" {
) -> ::c_int;
pub fn sync();
+
+ fn __major(version: ::c_int, devnum: ::dev_t) -> ::major_t;
+ fn __minor(version: ::c_int, devnum: ::dev_t) -> ::minor_t;
+ fn __makedev(version: ::c_int, majdev: ::major_t, mindev: ::minor_t) -> ::dev_t;
}
#[link(name = "sendfile")]
@@ -3254,6 +3260,18 @@ extern "C" {
pub fn lgrp_root(cookie: ::lgrp_cookie_t) -> ::lgrp_id_t;
}
+pub unsafe fn major(device: ::dev_t) -> ::major_t {
+ __major(NEWDEV, device)
+}
+
+pub unsafe fn minor(device: ::dev_t) -> ::minor_t {
+ __minor(NEWDEV, device)
+}
+
+pub unsafe fn makedev(maj: ::major_t, min: ::minor_t) -> ::dev_t {
+ __makedev(NEWDEV, maj, min)
+}
+
mod compat;
pub use self::compat::*;