mdbx-posix: minor around MAP_FIXED_NOREPLACE.

Change-Id: I0991a5ed1e1706442675d9514932fad30de372f8
This commit is contained in:
Leonid Yuriev 2021-03-17 01:13:47 +03:00
parent 0fd90de97e
commit 0be7616521

View File

@ -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) {