1 /*
2  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  *
8  * See the COPYRIGHT file distributed with this work for additional
9  * information regarding copyright ownership.
10  */
11 
12 #pragma once
13 
14 #include <lmdb.h>
15 /*
16  * MDB_NOTLS is used to prevent problems after configuration is reloaded, due
17  * to the way LMDB's use of thread-local storage (TLS) interacts with the BIND9
18  * thread model.
19  */
20 #define DNS_LMDB_COMMON_FLAGS (MDB_CREATE | MDB_NOSUBDIR | MDB_NOTLS)
21 #ifndef __OpenBSD__
22 #define DNS_LMDB_FLAGS (DNS_LMDB_COMMON_FLAGS)
23 #else /* __OpenBSD__ */
24 /*
25  * OpenBSD does not have a unified buffer cache, which requires both reads and
26  * writes to be performed using mmap().
27  */
28 #define DNS_LMDB_FLAGS (DNS_LMDB_COMMON_FLAGS | MDB_WRITEMAP)
29 #endif /* __OpenBSD__ */
30