1

After adding the flags MAP_SYNC | MAP_SHARED_VALIDATE I am getting error during compile time on mmap. I have included the header file <sys/mman.h>

I am using kernel version 5.6.8-1.el7.repo.x86_64 on centos-release-7-8.2003.0.el7.centos.x86_64

mmap(NULL, mapped_len, PROT_READ | PROT_WRITE, MAP_SYNC |MAP_SHARED_VALIDATE, uio_fd0, 2* 4096);
Marco Bonelli
  • 63,369
  • 21
  • 118
  • 128
Rahul K V
  • 41
  • 4

1 Answers1

1

Your C library version is older than your current kernel version. The MAP_SYNC and MAP_SHARED_VALIDATE flags were introduced in Linux 4.15 (2018), while glibc 2.17 was released in 2012. If you have the kernel headers installed, you should be able to #include <linux/mman.h> for those values.

how to upgrade?

It's not that easy. You should be able to update using yum update, but chances are that your glibc package is already up to date and the CentOS maintainers are just not upgrading the package for your specific CentOS release. This question is better suited on SuperUser or on Unix&Linux SE, I would suggest you to ask there.

Marco Bonelli
  • 63,369
  • 21
  • 118
  • 128