diff options
author | Daniel Golle <daniel@makrotopia.org> | 2015-05-03 14:47:28 +0200 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2015-05-03 14:47:28 +0200 |
commit | 142a24a10b1551c5885f66ef7f7ce48a63dfd193 (patch) | |
tree | 1ac9535557a0a4ac69a3c04e73652a3a7bab7477 /utils | |
parent | ecb702d79b51ce7dff1bc620a77e6d68b806d708 (diff) |
lvm2: better workaround for missing mallinfo on musl
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/lvm2/patches/003-no-mallinfo.patch | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/utils/lvm2/patches/003-no-mallinfo.patch b/utils/lvm2/patches/003-no-mallinfo.patch index 13372362d..e81dbe9e4 100644 --- a/utils/lvm2/patches/003-no-mallinfo.patch +++ b/utils/lvm2/patches/003-no-mallinfo.patch @@ -1,13 +1,28 @@ -Index: LVM2.2.02.118/lib/mm/memlock.c +Index: LVM2.2.02.119/lib/mm/memlock.c =================================================================== ---- LVM2.2.02.118.orig/lib/mm/memlock.c -+++ LVM2.2.02.118/lib/mm/memlock.c -@@ -137,7 +137,7 @@ static void _touch_memory(void *mem, siz - - static void _allocate_memory(void) - { --#ifndef VALGRIND_POOL -+#if defined(__GLIBC__) && !defined(VALGRIND_POOL) - void *stack_mem; - struct rlimit limit; - int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks; +--- LVM2.2.02.119.orig/lib/mm/memlock.c ++++ LVM2.2.02.119/lib/mm/memlock.c +@@ -161,12 +161,15 @@ static void _allocate_memory(void) + * memory on free(), this is good enough for our purposes. + */ + while (missing > 0) { ++#ifdef __GLIBC__ + struct mallinfo inf = mallinfo(); + hblks = inf.hblks; ++#endif + + if ((areas[area] = malloc(_size_malloc_tmp))) + _touch_memory(areas[area], _size_malloc_tmp); + ++#ifdef __GLIBC__ + inf = mallinfo(); + + if (hblks < inf.hblks) { +@@ -179,6 +182,7 @@ static void _allocate_memory(void) + ++ area; + missing -= _size_malloc_tmp; + } ++#endif + + if (area == max_areas && missing > 0) { + /* Too bad. Warn the user and proceed, as things are |