mempool: only enable mempool use when linked to libsystemd-shared.so

Mempool use is enabled or disabled based on the mempool_use_allowed symbol that
is linked in.

Should fix assert crashes in external programs caused by #9792.
Replaces #10286.

v2:
- use two different source files instead of a gcc constructor
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-10-11 11:10:37 +02:00
parent 7c48ea0280
commit a5d8835c78
7 changed files with 20 additions and 0 deletions
+2
View File
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include <stdbool.h>
#include <stddef.h>
struct pool;
@@ -22,6 +23,7 @@ static struct mempool pool_name = { \
.at_least = alloc_at_least, \
}
extern const bool mempool_use_allowed;
bool mempool_enabled(void);
#if VALGRIND