usemem: fix build on systems with old glibc's
Headers from old versions of glibc don't have MAP_HUGE_SHIFT, which
leads to this:
usemem.c:60:32: error: 'MAP_HUGE_SHIFT' undeclared (first use in this function)
#define MAP_HUGE_2MB (21 << MAP_HUGE_SHIFT)
With newer glibc's, MAP_HUGE_SHIFT is pulled in thusly:
usemem.c
sys/mman.h
bits/mman.h
bits/mman-linux.h
# define MAP_HUGE_SHIFT 26
As a workaround, define MAP_HUGE_SHIFT manually just as usemem does with
MAP_HUGE_2MB. While we're at it, remove the unused definition of
MAP_HUGE_1GB. Tested on arch, debian, and oracle linux with
./usemem -UO $((2**21)).
Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
1 file changed