summaryrefslogtreecommitdiff
path: root/src/shared/enable-mempool.c
blob: fd582c0e78fcbf2a2a1496bf2726a26f87a85376 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* SPDX-License-Identifier: LGPL-2.1-or-later */

#include <stdbool.h>

#include "env-util.h"
#include "mempool.h"
#include "process-util.h"

bool mempool_enabled(void) {
        static int cache = -1;

        if (!is_main_thread())
                return false;

        if (cache < 0)
                cache = getenv_bool("SYSTEMD_MEMPOOL") != 0;

        return cache;
}