Skip to content

Commit df679e8

Browse files
committed
Auto merge of #2631 - devnexen:fbsd13_upd_shm, r=Amanieu
shm api update from FreeBSD 13
2 parents f0ba214 + 0a57541 commit df679e8

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

libc-test/build.rs

+12
Original file line numberDiff line numberDiff line change
@@ -2167,6 +2167,15 @@ fn test_freebsd(target: &str) {
21672167

21682168
// Added in FreeBSD 14.
21692169
"F_KINFO" => true, // FIXME: depends how frequent freebsd 14 is updated on CI, this addition went this week only.
2170+
"SHM_RENAME_NOREPLACE"
2171+
| "SHM_RENAME_EXCHANGE"
2172+
| "MFD_CLOEXEC"
2173+
| "MFD_ALLOW_SEALING"
2174+
| "MFD_HUGETLB"
2175+
if Some(13) > freebsd_ver =>
2176+
{
2177+
true
2178+
}
21702179

21712180
_ => false,
21722181
}
@@ -2248,6 +2257,9 @@ fn test_freebsd(target: &str) {
22482257
// This is not available in FreeBSD 12.
22492258
"SOCKCRED2SIZE" if Some(13) > freebsd_ver => true,
22502259

2260+
// Those are not available in FreeBSD 12.
2261+
"memfd_create" | "shm_rename" if Some(13) > freebsd_ver => true,
2262+
22512263
_ => false,
22522264
}
22532265
});

src/unix/bsd/freebsdlike/freebsd/mod.rs

+14
Original file line numberDiff line numberDiff line change
@@ -3615,6 +3615,13 @@ pub const DST_CAN: ::c_int = 6;
36153615
pub const CPUCLOCK_WHICH_PID: ::c_int = 0;
36163616
pub const CPUCLOCK_WHICH_TID: ::c_int = 1;
36173617

3618+
pub const MFD_CLOEXEC: ::c_uint = 0x00000001;
3619+
pub const MFD_ALLOW_SEALING: ::c_uint = 0x00000002;
3620+
pub const MFD_HUGETLB: ::c_uint = 0x00000004;
3621+
3622+
pub const SHM_RENAME_NOREPLACE: ::c_int = 1 << 0;
3623+
pub const SHM_RENAME_EXCHANGE: ::c_int = 1 << 1;
3624+
36183625
const_fn! {
36193626
{const} fn _ALIGN(p: usize) -> usize {
36203627
(p + _ALIGNBYTES) & !_ALIGNBYTES
@@ -4155,6 +4162,13 @@ extern "C" {
41554162

41564163
pub fn adjtime(arg1: *const ::timeval, arg2: *mut ::timeval) -> ::c_int;
41574164
pub fn clock_getcpuclockid2(arg1: ::id_t, arg2: ::c_int, arg3: *mut clockid_t) -> ::c_int;
4165+
4166+
pub fn shm_rename(
4167+
path_from: *const ::c_char,
4168+
path_to: *const ::c_char,
4169+
flags: ::c_int,
4170+
) -> ::c_int;
4171+
pub fn memfd_create(name: *const ::c_char, flags: ::c_uint) -> ::c_int;
41584172
}
41594173

41604174
#[link(name = "kvm")]

0 commit comments

Comments
 (0)