Skip to content

freebsd 13 non thp userspace fn. #2638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2169,6 +2169,9 @@ fn test_freebsd(target: &str) {
"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"
| "SHM_LARGEPAGE_ALLOC_DEFAULT"
| "SHM_LARGEPAGE_ALLOC_NOWAIT"
| "SHM_LARGEPAGE_ALLOC_HARD"
| "MFD_CLOEXEC"
| "MFD_ALLOW_SEALING"
| "MFD_HUGETLB"
Expand Down Expand Up @@ -2258,7 +2261,9 @@ fn test_freebsd(target: &str) {
"SOCKCRED2SIZE" if Some(13) > freebsd_ver => true,

// Those are not available in FreeBSD 12.
"memfd_create" | "shm_rename" if Some(13) > freebsd_ver => true,
"memfd_create" | "shm_create_largepage" | "shm_rename" if Some(13) > freebsd_ver => {
true
}

_ => false,
}
Expand Down
10 changes: 10 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3619,6 +3619,9 @@ 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_LARGEPAGE_ALLOC_DEFAULT: ::c_int = 0;
pub const SHM_LARGEPAGE_ALLOC_NOWAIT: ::c_int = 1;
pub const SHM_LARGEPAGE_ALLOC_HARD: ::c_int = 2;
pub const SHM_RENAME_NOREPLACE: ::c_int = 1 << 0;
pub const SHM_RENAME_EXCHANGE: ::c_int = 1 << 1;

Expand Down Expand Up @@ -4163,6 +4166,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_create_largepage(
path: *const ::c_char,
flags: ::c_int,
psind: ::c_int,
alloc_policy: ::c_int,
mode: ::mode_t,
) -> ::c_int;
pub fn shm_rename(
path_from: *const ::c_char,
path_to: *const ::c_char,
Expand Down