X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu-bp.c;h=9c3dbe7e15ef210b5da7c9d7638796207ad041c7;hp=0fdf1f44ffa10bb46e15429bdff59356af9167eb;hb=0617bf4c03c86fb9653c0887cde8ddbdb3b95658;hpb=fdee2e6dc73cc504ba24be89da539c68742e508e diff --git a/urcu-bp.c b/urcu-bp.c index 0fdf1f4..9c3dbe7 100644 --- a/urcu-bp.c +++ b/urcu-bp.c @@ -23,6 +23,7 @@ * IBM's contributions to this file may be relicensed under LGPLv2 or later. */ +#define _GNU_SOURCE #include #include #include @@ -265,10 +266,16 @@ static void resize_arena(struct registry_arena *arena, size_t len) { void *new_arena; - new_arena = mmap(arena->p, len, - PROT_READ | PROT_WRITE, - MAP_ANONYMOUS | MAP_PRIVATE, - -1, 0); + if (!arena->p) + new_arena = mmap(arena->p, len, + PROT_READ | PROT_WRITE, + MAP_ANONYMOUS | MAP_PRIVATE, + -1, 0); + else + new_arena = mremap(arena->p, arena->len, + len, MREMAP_MAYMOVE); + assert(new_arena != MAP_FAILED); + /* * re-used the same region ? */