Skip to content

Commit

Permalink
sys::memfd additional flags related to the hugetlb filesystem support.
Browse files Browse the repository at this point in the history
  • Loading branch information
devnexen committed Dec 6, 2023
1 parent da45140 commit c366102
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog/2252.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added new `MemFdCreateFlag` constants to `sys::memfd` on Linux and Android related to hugetlbfs support.
43 changes: 43 additions & 0 deletions src/sys/memfd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,49 @@ libc_bitflags!(
///
/// [`memfd_create(2)`]: https://man7.org/linux/man-pages/man2/memfd_create.2.html
MFD_ALLOW_SEALING;
/// Anonymous file will be created using huge pages. It should be safe now to
/// combine with [`MFD_ALLOW_SEALING`] too.
/// However, despite its presence, on FreeBSD it is unimplemented for now (ENOSYS).
///
/// See also the hugetlb filesystem in [`memfd_create(2)`].
///
/// [`memfd_create(2)`]: https://man7.org/linux/man-pages/man2/memfd_create.2.html
#[cfg(any(target_os = "linux", target_os = "android"))]
MFD_HUGETLB;
/// Following are to be used with [`MFD_HUGETLB`], indicating the desired hugetlb size.
///
/// See also the hugetlb filesystem in [`memfd_create(2)`].
///
/// [`memfd_create(2)`]: https://man7.org/linux/man-pages/man2/memfd_create.2.html
#[cfg(any(target_os = "linux", target_os = "android"))]
MFD_HUGE_1MB;
/// hugetlb size of 2MB.
#[cfg(any(target_os = "linux", target_os = "android"))]
MFD_HUGE_2MB;
/// hugetlb size of 8MB.
#[cfg(any(target_os = "linux", target_os = "android"))]
MFD_HUGE_8MB;
/// hugetlb size of 16MB.
#[cfg(any(target_os = "linux", target_os = "android"))]
MFD_HUGE_16MB;
/// hugetlb size of 32MB.
#[cfg(any(target_os = "linux", target_os = "android"))]
MFD_HUGE_32MB;
/// hugetlb size of 256MB.
#[cfg(any(target_os = "linux", target_os = "android"))]
MFD_HUGE_256MB;
/// hugetlb size of 512MB.
#[cfg(any(target_os = "linux", target_os = "android"))]
MFD_HUGE_512MB;
/// hugetlb size of 1GB.
#[cfg(any(target_os = "linux", target_os = "android"))]
MFD_HUGE_1GB;
/// hugetlb size of 2GB.
#[cfg(any(target_os = "linux", target_os = "android"))]
MFD_HUGE_2GB;
/// hugetlb size of 16GB.
#[cfg(any(target_os = "linux", target_os = "android"))]
MFD_HUGE_16GB;
}
);

Expand Down

0 comments on commit c366102

Please sign in to comment.