I am on CentOS 7 with kernel version 3.10.0-1160.15.2.el7.x86_64.
When I tried to use MAP_HUGE_1GB and MAP_HUGE_2MB flags, g++-9.3.1 complained:
error: ‘MAP_HUGE_1GB’ was not declared in this scope; did you mean ‘MAP_HUGETLB’?
Then, I found this post, the answer suggested that I need to "#define _GNU_SOURCE before #include <sys/mman.h> because this is a nonstandard flag".
However, defining _GNU_SOURCE causes warning: "_GNU_SOURCE" redefined but g++ still complains those 2 flags aren't declared.
Then, I found this post, and it suggests that _GNU_SOURCE defined as libstdc++ is used.
Now, I am confused how to use MAP_HUGE_1GB and MAP_HUGE_2MB flags.
Thanks!