From: Mathieu Desnoyers Date: Thu, 1 Oct 2009 22:12:20 +0000 (-0400) Subject: urcu-bp: use mremap X-Git-Tag: v0.2.1~1 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=0617bf4c03c86fb9653c0887cde8ddbdb3b95658;p=urcu.git urcu-bp: use mremap Signed-off-by: Mathieu Desnoyers --- 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 ? */