I am trying to compile a program that requires the mmap(2) to support the flag MAP_SYNC, but my compiler reports that no such thing exists. Now, I manually verified the header file for mmap and found out that flag's absent. My system's man page also says that mmap doesn't have any such flag, but the man page available here says that the flag exists linux kernel 4.15+ which is true.

I'm already on kernel 5.0.0 and don't understand why the flag is absent, is there a way to fix this?

My system:

$ uname -a
Linux hostname 5.0.0-29-generic #31~18.04.1-Ubuntu SMP Thu Sep 12 18:29:21 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

$ lsb_release -a
No LSB modules are available.  
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS                                                                                                                       Release:        18.04
Codename:       bionic


  • 3
    The version of the running kernel (as reported by uname) has nothing to do with the version of the development packages which provide the C headers. You can define that flag yourself to the actual value, guarding it inside an #ifndef MAP_SYNC ... #endif.
    – user313992
    Sep 29, 2019 at 5:23
  • @mosvy I see thanks, is there a way I can update the headers?
    – lol
    Sep 29, 2019 at 5:26


You must log in to answer this question.

Browse other questions tagged .