Skip to content

Commit 72e4151

Browse files
committed
Auto merge of #2638 - devnexen:shm_create_largepage_fbsd, r=Amanieu
freebsd 13 non thp userspace fn.
2 parents 599fa5c + 0ee0aee commit 72e4151

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

libc-test/build.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -2154,6 +2154,9 @@ fn test_freebsd(target: &str) {
21542154
"F_KINFO" => true, // FIXME: depends how frequent freebsd 14 is updated on CI, this addition went this week only.
21552155
"SHM_RENAME_NOREPLACE"
21562156
| "SHM_RENAME_EXCHANGE"
2157+
| "SHM_LARGEPAGE_ALLOC_DEFAULT"
2158+
| "SHM_LARGEPAGE_ALLOC_NOWAIT"
2159+
| "SHM_LARGEPAGE_ALLOC_HARD"
21572160
| "MFD_CLOEXEC"
21582161
| "MFD_ALLOW_SEALING"
21592162
| "MFD_HUGETLB"
@@ -2243,7 +2246,9 @@ fn test_freebsd(target: &str) {
22432246
"SOCKCRED2SIZE" if Some(13) > freebsd_ver => true,
22442247

22452248
// Those are not available in FreeBSD 12.
2246-
"memfd_create" | "shm_rename" if Some(13) > freebsd_ver => true,
2249+
"memfd_create" | "shm_create_largepage" | "shm_rename" if Some(13) > freebsd_ver => {
2250+
true
2251+
}
22472252

22482253
_ => false,
22492254
}

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

+10
Original file line numberDiff line numberDiff line change
@@ -3561,6 +3561,9 @@ pub const MFD_CLOEXEC: ::c_uint = 0x00000001;
35613561
pub const MFD_ALLOW_SEALING: ::c_uint = 0x00000002;
35623562
pub const MFD_HUGETLB: ::c_uint = 0x00000004;
35633563

3564+
pub const SHM_LARGEPAGE_ALLOC_DEFAULT: ::c_int = 0;
3565+
pub const SHM_LARGEPAGE_ALLOC_NOWAIT: ::c_int = 1;
3566+
pub const SHM_LARGEPAGE_ALLOC_HARD: ::c_int = 2;
35643567
pub const SHM_RENAME_NOREPLACE: ::c_int = 1 << 0;
35653568
pub const SHM_RENAME_EXCHANGE: ::c_int = 1 << 1;
35663569

@@ -4105,6 +4108,13 @@ extern "C" {
41054108
pub fn adjtime(arg1: *const ::timeval, arg2: *mut ::timeval) -> ::c_int;
41064109
pub fn clock_getcpuclockid2(arg1: ::id_t, arg2: ::c_int, arg3: *mut clockid_t) -> ::c_int;
41074110

4111+
pub fn shm_create_largepage(
4112+
path: *const ::c_char,
4113+
flags: ::c_int,
4114+
psind: ::c_int,
4115+
alloc_policy: ::c_int,
4116+
mode: ::mode_t,
4117+
) -> ::c_int;
41084118
pub fn shm_rename(
41094119
path_from: *const ::c_char,
41104120
path_to: *const ::c_char,

0 commit comments

Comments
 (0)