lvm2: unbreak and update portability patch.

This commit is contained in:
Juan RP 2016-06-07 08:02:31 +02:00
parent e0d4cac517
commit 3d81871acc
1 changed files with 11 additions and 33 deletions

View File

@ -2,40 +2,7 @@ Portability fixes:
- Use fcntl.h for O_RDONLY and friends.
- Only use mallinfo with glibc.
- Use PTHREAD_MUTEX_RECURSIVE rather than the _NP (non portable) variants.
--- lib/mm/memlock.c 2014-11-29 00:07:42.000000000 +0100
+++ lib/mm/memlock.c 2014-12-28 08:25:12.424935165 +0100
@@ -133,7 +133,7 @@ static void _touch_memory(void *mem, siz
static void _allocate_memory(void)
{
-#ifndef VALGRIND_POOL
+#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
void *stack_mem;
struct rlimit limit;
int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks;
--- daemons/lvmetad/lvmetad-core.c 2014-11-29 00:07:42.000000000 +0100
+++ daemons/lvmetad/lvmetad-core.c 2014-12-28 08:29:16.406946052 +0100
@@ -124,7 +124,7 @@ static struct dm_config_tree *lock_vg(lv
if (!(vg = dm_hash_lookup(s->lock.vg, id))) {
if (!(vg = malloc(sizeof(pthread_mutex_t))) ||
pthread_mutexattr_init(&rec) ||
- pthread_mutexattr_settype(&rec, PTHREAD_MUTEX_RECURSIVE_NP) ||
+ pthread_mutexattr_settype(&rec, PTHREAD_MUTEX_RECURSIVE) ||
pthread_mutex_init(vg, &rec))
goto bad;
if (!dm_hash_insert(s->lock.vg, id, vg)) {
@@ -1152,7 +1152,7 @@ static int init(daemon_state *s)
ls->log = s->log;
pthread_mutexattr_init(&rec);
- pthread_mutexattr_settype(&rec, PTHREAD_MUTEX_RECURSIVE_NP);
+ pthread_mutexattr_settype(&rec, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&ls->lock.pvid_to_pvmeta, &rec);
pthread_mutex_init(&ls->lock.vgid_to_metadata, &rec);
pthread_mutex_init(&ls->lock.pvid_to_vgid, NULL);
--- libdaemon/server/daemon-server.c 2014-11-29 00:07:42.000000000 +0100
+++ libdaemon/server/daemon-server.c 2014-12-28 08:22:40.985928408 +0100
@@ -14,6 +14,7 @@
@ -47,3 +14,14 @@ Portability fixes:
#include <errno.h>
#include <pthread.h>
--- lib/mm/memlock.c.orig 2016-06-07 08:00:46.557058318 +0200
+++ lib/mm/memlock.c 2016-06-07 08:01:25.453505793 +0200
@@ -150,7 +150,7 @@ static void _touch_memory(void *mem, siz
static void _allocate_memory(void)
{
-#ifndef VALGRIND_POOL
+#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
void *stack_mem;
struct rlimit limit;
int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks;