diff options
-rw-r--r-- | libc-test/build.rs | 7 | ||||
-rw-r--r-- | src/unix/bsd/freebsdlike/freebsd/mod.rs | 10 |
2 files changed, 16 insertions, 1 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs index 9f4ccc5945..77087ba72f 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2154,6 +2154,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" @@ -2243,7 +2246,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, } diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 6c0fb3672b..f52cb322de 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -3561,6 +3561,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; @@ -4105,6 +4108,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, |