1 // SPDX-License-Identifier: GPL-2.0
3 #define __EXPORTED_HEADERS__
7 #include <linux/fcntl.h>
8 #include <linux/memfd.h>
10 #include <sys/syscall.h>
14 int hugetlbfs_test
= 0;
17 * Copied from mlock2-tests.c
19 unsigned long default_huge_page_size(void)
21 unsigned long hps
= 0;
24 FILE *f
= fopen("/proc/meminfo", "r");
28 while (getline(&line
, &linelen
, f
) > 0) {
29 if (sscanf(line
, "Hugepagesize: %lu kB", &hps
) == 1) {
40 int sys_memfd_create(const char *name
, unsigned int flags
)
45 return syscall(__NR_memfd_create
, name
, flags
);