Commit 7bc585b2 authored by Kinsbursky Stanislav's avatar Kinsbursky Stanislav Committed by Cyrill Gorcunov

parasite: heap engine update

1) Use macro for defining size mapped size.
2) Allow to allocate all space (including the last byte).
Signed-off-by: 's avatarStanislav Kinsbursky <skinsbursky@openvz.org>
Acked-by: 's avatarPavel Emelyanov <xemul@parallels.com>
[gorcunov@: MAX_BUF_SIZE tuneup, don't use ops without braces)]
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent 722398da
...@@ -28,9 +28,11 @@ static struct vma_entry vma; ...@@ -28,9 +28,11 @@ static struct vma_entry vma;
static int logfd = -1; static int logfd = -1;
static int tsock = -1; static int tsock = -1;
#define MAX_BUF_SIZE (10 << 20) /* Hope 10MB will be enough... */
static int brk_init(void) static int brk_init(void)
{ {
unsigned long heap_size = 10 * 1024 * 1024; unsigned long heap_size = MAX_BUF_SIZE;
unsigned long ret; unsigned long ret;
/* /*
* Map 10 MB. Hope this will be enough for unix skb's... * Map 10 MB. Hope this will be enough for unix skb's...
...@@ -54,7 +56,7 @@ static void brk_fini(void) ...@@ -54,7 +56,7 @@ static void brk_fini(void)
static void *brk_alloc(unsigned long bytes) static void *brk_alloc(unsigned long bytes)
{ {
void *addr = NULL; void *addr = NULL;
if (brk_end > (brk_tail + bytes)) { if (brk_end >= (brk_tail + bytes)) {
addr = brk_tail; addr = brk_tail;
brk_tail+= bytes; brk_tail+= bytes;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment