Sources Bugzilla – Bug 1458
mremap() fifth argument and MREMAP_FIXED not exposed in glibc
Last modified: 2007-11-17 07:22:07 UTC
Since 2.3.31, the Linux kernel has allowed an additional 'flags' value for mremap(): MREMAP_FIXED (defined with the value 2), which serves a similar purpose to the mmap() MAP_FIXED flag. If this flag is supplied, then mremap() employs a fifth argument, 'new_address', which specifies a fixed address to which the mapping should be relocated. Currently, glibc does not expose the MREMAP_FIXED definition and the mremap() prototype does not expose the fifth argument. Can these definitions please be exposed in glibc.
I made the necessary changes for several architectures in the CVS trunk.
Unable to compile current snapshot(1017) on MIPS and ALPHA without # define MREMAP_FIXED 2 added to mman.h to sysdeps/unix/sysv/linux/alpha/bits/mman.h sysdeps/unix/sysv/linux/mips/bits/mman.h. Will attach patch
Created attachment 719 [details] Patch to fix REMAP_FIXED not defined error on MIPS and ALPHA
The patch is not needed anymore.
Making mremap() a function with variable number of arguments changes the ABI on x86_64. Code compiled before this change will treat %rax as scratch. After the change, the calling conventions expect %al to be set to the number of XMM registers passed. Is there a reason why mremap was not versioned after the change?