I'm trying to build an application which uses the MAP_FIXED_NOREPLACE
mmap flag. From the man page, it seems that the flag is supported since linux kernel 4.17. I currently have 5.4.0-53-generic
installed on my Ubuntu 18.04.5 system. When I try to build the application, I get the following error:
cc -MD -c -o ../nondebug/libpmemblk/set.o -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wpointer-arith -Wsign-conversion -Wsign-compare -Wconversion -Wunused-macros -Wmissing-field-initializers -Wfloat-equal -Wswitch-default -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -std=gnu99 -fno-common -pthread -DSRCVERSION=\"1.6+git703.g8cb972fe3\" -DSDS_ENABLED -I../include -I../common/ -fPIC ../../src/../src/common/set.c
../../src/../src/common/set.c: In function ‘util_replica_map_local_addr’:
../../src/../src/common/set.c:2661:13: error: ‘MAP_FIXED_NOREPLACE’ undeclared (first use in this function); did you mean ‘_IOS_NOREPLACE’?
flags | MAP_FIXED_NOREPLACE, 0) != 0) {
^~~~~~~~~~~~~~~~~~~
_IOS_NOREPLACE
../../src/../src/common/set.c:2661:13: note: each undeclared identifier is reported only once for each function it appears in
../Makefile.inc:328: recipe for target '../nondebug/libpmemblk/set.o' failed
I checked, and the file set.c
does include sys/mman.h
header required for mmap
. I'm not sure why the compiler is complaining about MAP_FIXED_NOREPLACE
, and how to fix this.