diff options
author | bors <bors@rust-lang.org> | 2022-01-21 00:46:52 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2022-01-21 00:46:52 +0000 |
commit | 72e41512de52649e70d470b159bbecb47d12c93d (patch) | |
tree | 4c4a51f9433e814dda443c86b0fc332eba22dbd8 | |
parent | 599fa5c8bf40f223fd50d3ae74e7b578a316a820 (diff) | |
parent | 0ee0aee6a799d5bf20b7cb67cc3e84e7a61eab6d (diff) | |
download | rust-libc-72e41512de52649e70d470b159bbecb47d12c93d.tar.gz |
Auto merge of #2638 - devnexen:shm_create_largepage_fbsd, r=Amanieu
freebsd 13 non thp userspace fn.
-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, |