Skip to content

Commit cafba83

Browse files
committed
Define the MFD_HUGE_* macros for Linux and Android.
This defines the `MFD_HUGE_*` flags which can accompany the `MEMFD_HUGETLB` flag in Linux's [`memfd_create`] call. [`memfd_create`]: https://man7.org/linux/man-pages/man2/memfd_create.2.html
1 parent 8bba79c commit cafba83

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/unix/linux_like/android/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,6 +1893,20 @@ pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
18931893
pub const MFD_CLOEXEC: ::c_uint = 0x0001;
18941894
pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002;
18951895
pub const MFD_HUGETLB: ::c_uint = 0x0004;
1896+
pub const MFD_HUGE_64KB: ::c_uint = 0x40000000;
1897+
pub const MFD_HUGE_512KB: ::c_uint = 0x4c000000;
1898+
pub const MFD_HUGE_1MB: ::c_uint = 0x50000000;
1899+
pub const MFD_HUGE_2MB: ::c_uint = 0x54000000;
1900+
pub const MFD_HUGE_8MB: ::c_uint = 0x5c000000;
1901+
pub const MFD_HUGE_16MB: ::c_uint = 0x60000000;
1902+
pub const MFD_HUGE_32MB: ::c_uint = 0x64000000;
1903+
pub const MFD_HUGE_256MB: ::c_uint = 0x70000000;
1904+
pub const MFD_HUGE_512MB: ::c_uint = 0x74000000;
1905+
pub const MFD_HUGE_1GB: ::c_uint = 0x78000000;
1906+
pub const MFD_HUGE_2GB: ::c_uint = 0x7c000000;
1907+
pub const MFD_HUGE_16GB: ::c_uint = 0x88000000;
1908+
pub const MFD_HUGE_MASK: ::c_uint = 63;
1909+
pub const MFD_HUGE_SHIFT: ::c_uint = 26;
18961910

18971911
// these are used in the p_type field of Elf32_Phdr and Elf64_Phdr, which has
18981912
// the type Elf32Word and Elf64Word respectively. Luckily, both of those are u32

src/unix/linux_like/linux/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,6 +1820,20 @@ pub const CMSPAR: ::tcflag_t = 0o10000000000;
18201820
pub const MFD_CLOEXEC: ::c_uint = 0x0001;
18211821
pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002;
18221822
pub const MFD_HUGETLB: ::c_uint = 0x0004;
1823+
pub const MFD_HUGE_64KB: ::c_uint = 0x40000000;
1824+
pub const MFD_HUGE_512KB: ::c_uint = 0x4c000000;
1825+
pub const MFD_HUGE_1MB: ::c_uint = 0x50000000;
1826+
pub const MFD_HUGE_2MB: ::c_uint = 0x54000000;
1827+
pub const MFD_HUGE_8MB: ::c_uint = 0x5c000000;
1828+
pub const MFD_HUGE_16MB: ::c_uint = 0x60000000;
1829+
pub const MFD_HUGE_32MB: ::c_uint = 0x64000000;
1830+
pub const MFD_HUGE_256MB: ::c_uint = 0x70000000;
1831+
pub const MFD_HUGE_512MB: ::c_uint = 0x74000000;
1832+
pub const MFD_HUGE_1GB: ::c_uint = 0x78000000;
1833+
pub const MFD_HUGE_2GB: ::c_uint = 0x7c000000;
1834+
pub const MFD_HUGE_16GB: ::c_uint = 0x88000000;
1835+
pub const MFD_HUGE_MASK: ::c_uint = 63;
1836+
pub const MFD_HUGE_SHIFT: ::c_uint = 26;
18231837

18241838
// linux/close_range.h
18251839
pub const CLOSE_RANGE_UNSHARE: ::c_uint = 1 << 1;

0 commit comments

Comments
 (0)