From 0be7616521a744b6a0acb287357bc6805b8cb98b Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Wed, 17 Mar 2021 01:13:47 +0300 Subject: [PATCH] mdbx-posix: minor around `MAP_FIXED_NOREPLACE`. Change-Id: I0991a5ed1e1706442675d9514932fad30de372f8 --- src/osal.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/osal.c b/src/osal.c index 1564538c..eb44fd76 100644 --- a/src/osal.c +++ b/src/osal.c @@ -1464,6 +1464,10 @@ MDBX_INTERNAL_FUNC int mdbx_mmap(const int flags, mdbx_mmap_t *map, #ifndef MAP_NOSYNC #define MAP_NOSYNC 0 +#endif + +#ifndef MAP_FIXED_NOREPLACE +#define MAP_FIXED_NOREPLACE 0 #endif map->address = mmap( @@ -1742,12 +1746,7 @@ retry_mapview:; if (ptr == MAP_FAILED) { /* Try to mmap additional space beyond the end of mapping. */ ptr = mmap(map->dxb + map->limit, limit - map->limit, mmap_prot, - mmap_flags -#if defined(MAP_FIXED_NOREPLACE) - | MAP_FIXED_NOREPLACE -#endif /* MAP_FIXED_NOREPLACE */ - , - map->fd, map->limit); + mmap_flags | MAP_FIXED_NOREPLACE, map->fd, map->limit); if (ptr == map->dxb + map->limit) ptr = map->dxb; else if (ptr != MAP_FAILED) {