Skip to content

Commit c9258c3

Browse files
committed
Auto merge of #2650 - sunfishcode:sunfishcode/mfd-huge-sizes, r=Amanieu
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
2 parents a769300 + d6422e2 commit c9258c3

File tree

5 files changed

+44
-16
lines changed

5 files changed

+44
-16
lines changed

ci/docker/mips-unknown-linux-musl/Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
66

77
RUN mkdir /toolchain
88

9-
# Linux kernel version: 4.14.151
10-
# See build_dir/target-mips_24kc_musl/linux-ar71xx_generic/linux-4.14.151
9+
# Linux kernel version: 5.4.154
10+
# See build_dir/target-mips_24kc_musl/linux-ath79_generic/linux-5.4.154
1111
# Musl version: 1.1.24
12-
# See staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl/info.mk
13-
RUN curl --retry 5 -L https://downloads.openwrt.org/releases/19.07.0-rc1/targets/ar71xx/generic/openwrt-sdk-19.07.0-rc1-ar71xx-generic_gcc-7.4.0_musl.Linux-x86_64.tar.xz | \
12+
# See staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl/info.mk
13+
RUN curl --retry 5 -L https://downloads.openwrt.org/releases/21.02.1/targets/ath79/generic/openwrt-sdk-21.02.1-ath79-generic_gcc-8.4.0_musl.Linux-x86_64.tar.xz | \
1414
tar xJf - -C /toolchain --strip-components=1
1515

1616
# See https://lkml.org/lkml/2014/3/14/269
1717
COPY sysinfo_guard.patch /toolchain
18-
RUN patch /toolchain/staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl/include/linux/kernel.h </toolchain/sysinfo_guard.patch
18+
RUN patch /toolchain/staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl/include/linux/kernel.h </toolchain/sysinfo_guard.patch
1919

20-
ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl/bin \
20+
ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl/bin \
2121
STAGING_DIR=/toolchain/staging_dir \
2222
CC_mips_unknown_linux_musl=mips-openwrt-linux-musl-gcc \
2323
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-musl-gcc \
24-
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl"
24+
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl"

ci/docker/mipsel-unknown-linux-musl/Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
66

77
RUN mkdir /toolchain
88

9-
# Linux kernel version: 4.14.151
10-
# See build_dir/target-mipsel_mips32_musl/linux-brcm47xx_generic/linux-4.14.151
9+
# Linux kernel version: 5.4.154
10+
# See build_dir/target-mipsel_mips32_musl/linux-brcm47xx_generic/linux-5.4.154
1111
# Musl version: 1.1.24
12-
# See staging_dir/toolchain-mipsel_mips32_gcc-7.4.0_musl/info.mk
13-
RUN curl --retry 5 -L https://downloads.openwrt.org/releases/19.07.0-rc1/targets/brcm47xx/generic/openwrt-sdk-19.07.0-rc1-brcm47xx-generic_gcc-7.4.0_musl.Linux-x86_64.tar.xz | \
12+
# See staging_dir/toolchain-mipsel_mips32_gcc-8.4.0_musl/info.mk
13+
RUN curl --retry 5 -L https://downloads.openwrt.org/releases/21.02.1/targets/bcm47xx/generic/openwrt-sdk-21.02.1-bcm47xx-generic_gcc-8.4.0_musl.Linux-x86_64.tar.xz | \
1414
tar xJf - -C /toolchain --strip-components=1
1515

1616
# See https://lkml.org/lkml/2014/3/14/269
1717
COPY sysinfo_guard.patch /toolchain
18-
RUN patch /toolchain/staging_dir/toolchain-mipsel_mips32_gcc-7.4.0_musl/include/linux/kernel.h </toolchain/sysinfo_guard.patch
18+
RUN patch /toolchain/staging_dir/toolchain-mipsel_mips32_gcc-8.4.0_musl/include/linux/kernel.h </toolchain/sysinfo_guard.patch
1919

20-
ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mipsel_mips32_gcc-7.4.0_musl/bin \
20+
ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mipsel_mips32_gcc-8.4.0_musl/bin \
2121
STAGING_DIR=/toolchain/staging_dir \
2222
CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-musl-gcc \
2323
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-musl-gcc \
24-
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mipsel -L /toolchain/staging_dir/toolchain-mipsel_mips32_gcc-7.4.0_musl"
24+
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mipsel -L /toolchain/staging_dir/toolchain-mipsel_mips32_gcc-8.4.0_musl"

ci/sysinfo_guard.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
+#ifdef __GLIBC__
66
#include <linux/sysinfo.h>
77
+#endif
8+
#include <linux/const.h>
89

9-
/*
10-
* 'kernel.h' contains some often-used function prototypes etc
10+
#endif /* _LINUX_KERNEL_H */

src/unix/linux_like/android/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,6 +1860,20 @@ pub const O_TMPFILE: ::c_int = 0o20000000 | O_DIRECTORY;
18601860
pub const MFD_CLOEXEC: ::c_uint = 0x0001;
18611861
pub const MFD_ALLOW_SEALING: ::c_uint = 0x0002;
18621862
pub const MFD_HUGETLB: ::c_uint = 0x0004;
1863+
pub const MFD_HUGE_64KB: ::c_uint = 0x40000000;
1864+
pub const MFD_HUGE_512KB: ::c_uint = 0x4c000000;
1865+
pub const MFD_HUGE_1MB: ::c_uint = 0x50000000;
1866+
pub const MFD_HUGE_2MB: ::c_uint = 0x54000000;
1867+
pub const MFD_HUGE_8MB: ::c_uint = 0x5c000000;
1868+
pub const MFD_HUGE_16MB: ::c_uint = 0x60000000;
1869+
pub const MFD_HUGE_32MB: ::c_uint = 0x64000000;
1870+
pub const MFD_HUGE_256MB: ::c_uint = 0x70000000;
1871+
pub const MFD_HUGE_512MB: ::c_uint = 0x74000000;
1872+
pub const MFD_HUGE_1GB: ::c_uint = 0x78000000;
1873+
pub const MFD_HUGE_2GB: ::c_uint = 0x7c000000;
1874+
pub const MFD_HUGE_16GB: ::c_uint = 0x88000000;
1875+
pub const MFD_HUGE_MASK: ::c_uint = 63;
1876+
pub const MFD_HUGE_SHIFT: ::c_uint = 26;
18631877

18641878
// these are used in the p_type field of Elf32_Phdr and Elf64_Phdr, which has
18651879
// 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)