summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-01-17 03:06:28 +0000
committerbors <bors@rust-lang.org>2022-01-17 03:06:28 +0000
commitdf679e80756d9a71e9a7b0b298c0c45ba7b70083 (patch)
tree66dceef4bb6f578f189767c3c908a3418e9233f5
parentf0ba214ebb49706e0d68d694e3448771e70ed8ed (diff)
parent0a57541a7101bd58051b1d193e5a71981715bacb (diff)
downloadrust-libc-df679e80756d9a71e9a7b0b298c0c45ba7b70083.tar.gz
Auto merge of #2631 - devnexen:fbsd13_upd_shm, r=Amanieu
shm api update from FreeBSD 13
-rw-r--r--libc-test/build.rs12
-rw-r--r--src/unix/bsd/freebsdlike/freebsd/mod.rs14
2 files changed, 26 insertions, 0 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index c85c7c8088..a3e52fa145 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -2167,6 +2167,15 @@ fn test_freebsd(target: &str) {
// Added in FreeBSD 14.
"F_KINFO" => true, // FIXME: depends how frequent freebsd 14 is updated on CI, this addition went this week only.
+ "SHM_RENAME_NOREPLACE"
+ | "SHM_RENAME_EXCHANGE"
+ | "MFD_CLOEXEC"
+ | "MFD_ALLOW_SEALING"
+ | "MFD_HUGETLB"
+ if Some(13) > freebsd_ver =>
+ {
+ true
+ }
_ => false,
}
@@ -2248,6 +2257,9 @@ fn test_freebsd(target: &str) {
// This is not available in FreeBSD 12.
"SOCKCRED2SIZE" if Some(13) > freebsd_ver => true,
+ // Those are not available in FreeBSD 12.
+ "memfd_create" | "shm_rename" if Some(13) > freebsd_ver => true,
+
_ => false,
}
});
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index a5c7c8cf00..c66e6df49c 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -3615,6 +3615,13 @@ pub const DST_CAN: ::c_int = 6;
pub const CPUCLOCK_WHICH_PID: ::c_int = 0;
pub const CPUCLOCK_WHICH_TID: ::c_int = 1;
+pub const MFD_CLOEXEC: ::c_uint = 0x00000001;
+pub const MFD_ALLOW_SEALING: ::c_uint = 0x00000002;
+pub const MFD_HUGETLB: ::c_uint = 0x00000004;
+
+pub const SHM_RENAME_NOREPLACE: ::c_int = 1 << 0;
+pub const SHM_RENAME_EXCHANGE: ::c_int = 1 << 1;
+
const_fn! {
{const} fn _ALIGN(p: usize) -> usize {
(p + _ALIGNBYTES) & !_ALIGNBYTES
@@ -4155,6 +4162,13 @@ extern "C" {
pub fn adjtime(arg1: *const ::timeval, arg2: *mut ::timeval) -> ::c_int;
pub fn clock_getcpuclockid2(arg1: ::id_t, arg2: ::c_int, arg3: *mut clockid_t) -> ::c_int;
+
+ pub fn shm_rename(
+ path_from: *const ::c_char,
+ path_to: *const ::c_char,
+ flags: ::c_int,
+ ) -> ::c_int;
+ pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int;
}
#[link(name = "kvm")]