Skip to content
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

sys::memfd additional flags related to the hugetlb filesystem support. #2252

Merged
merged 1 commit into from
Dec 6, 2023
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
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(linux_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(linux_android)]
MFD_HUGE_1MB;
/// hugetlb size of 2MB.
#[cfg(linux_android)]
MFD_HUGE_2MB;
/// hugetlb size of 8MB.
#[cfg(linux_android)]
MFD_HUGE_8MB;
/// hugetlb size of 16MB.
#[cfg(linux_android)]
MFD_HUGE_16MB;
/// hugetlb size of 32MB.
#[cfg(linux_android)]
MFD_HUGE_32MB;
/// hugetlb size of 256MB.
#[cfg(linux_android)]
MFD_HUGE_256MB;
/// hugetlb size of 512MB.
#[cfg(linux_android)]
MFD_HUGE_512MB;
/// hugetlb size of 1GB.
#[cfg(linux_android)]
MFD_HUGE_1GB;
/// hugetlb size of 2GB.
#[cfg(linux_android)]
MFD_HUGE_2GB;
/// hugetlb size of 16GB.
#[cfg(linux_android)]
MFD_HUGE_16GB;
}
);

Expand Down