Skip to content

Commit 0ee0aee

Browse files
committed
freebsd 13 non thp userspace fn.
1 parent cf597c2 commit 0ee0aee

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

libc-test/build.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2169,6 +2169,9 @@ fn test_freebsd(target: &str) {
21692169
"F_KINFO" => true, // FIXME: depends how frequent freebsd 14 is updated on CI, this addition went this week only.
21702170
"SHM_RENAME_NOREPLACE"
21712171
| "SHM_RENAME_EXCHANGE"
2172+
| "SHM_LARGEPAGE_ALLOC_DEFAULT"
2173+
| "SHM_LARGEPAGE_ALLOC_NOWAIT"
2174+
| "SHM_LARGEPAGE_ALLOC_HARD"
21722175
| "MFD_CLOEXEC"
21732176
| "MFD_ALLOW_SEALING"
21742177
| "MFD_HUGETLB"
@@ -2258,7 +2261,9 @@ fn test_freebsd(target: &str) {
22582261
"SOCKCRED2SIZE" if Some(13) > freebsd_ver => true,
22592262

22602263
// Those are not available in FreeBSD 12.
2261-
"memfd_create" | "shm_rename" if Some(13) > freebsd_ver => true,
2264+
"memfd_create" | "shm_create_largepage" | "shm_rename" if Some(13) > freebsd_ver => {
2265+
true
2266+
}
22622267

22632268
_ => false,
22642269
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3619,6 +3619,9 @@ pub const MFD_CLOEXEC: ::c_uint = 0x00000001;
36193619
pub const MFD_ALLOW_SEALING: ::c_uint = 0x00000002;
36203620
pub const MFD_HUGETLB: ::c_uint = 0x00000004;
36213621

3622+
pub const SHM_LARGEPAGE_ALLOC_DEFAULT: ::c_int = 0;
3623+
pub const SHM_LARGEPAGE_ALLOC_NOWAIT: ::c_int = 1;
3624+
pub const SHM_LARGEPAGE_ALLOC_HARD: ::c_int = 2;
36223625
pub const SHM_RENAME_NOREPLACE: ::c_int = 1 << 0;
36233626
pub const SHM_RENAME_EXCHANGE: ::c_int = 1 << 1;
36243627

@@ -4163,6 +4166,13 @@ extern "C" {
41634166
pub fn adjtime(arg1: *const ::timeval, arg2: *mut ::timeval) -> ::c_int;
41644167
pub fn clock_getcpuclockid2(arg1: ::id_t, arg2: ::c_int, arg3: *mut clockid_t) -> ::c_int;
41654168

4169+
pub fn shm_create_largepage(
4170+
path: *const ::c_char,
4171+
flags: ::c_int,
4172+
psind: ::c_int,
4173+
alloc_policy: ::c_int,
4174+
mode: ::mode_t,
4175+
) -> ::c_int;
41664176
pub fn shm_rename(
41674177
path_from: *const ::c_char,
41684178
path_to: *const ::c_char,

0 commit comments

Comments
 (0)