blob: 16f47c9e275313ce9965f9dac4e65156043ef529 [file] [log] [blame]
Willy Tarreaubaaee002006-06-26 02:48:02 +02001/*
Willy Tarreaucc05fba2009-10-27 21:40:18 +01002 * include/common/config.h
3 * This files contains most of the user-configurable settings.
4 *
5 * Copyright (C) 2000-2009 Willy Tarreau - w@1wt.eu
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation, version 2.1
10 * exclusively.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
Willy Tarreaubaaee002006-06-26 02:48:02 +020021
Willy Tarreau2dd0d472006-06-29 17:53:05 +020022#ifndef _COMMON_CONFIG_H
23#define _COMMON_CONFIG_H
Willy Tarreaubaaee002006-06-26 02:48:02 +020024
Willy Tarreaucc05fba2009-10-27 21:40:18 +010025#include <common/compiler.h>
Willy Tarreau65d805f2014-07-15 18:05:58 +020026#include <common/compat.h>
Willy Tarreau2dd0d472006-06-29 17:53:05 +020027#include <common/defaults.h>
Willy Tarreaubaaee002006-06-26 02:48:02 +020028
Willy Tarreaue3ba5f02006-06-29 18:54:54 +020029/* CONFIG_HAP_MEM_OPTIM
30 * This enables use of memory pools instead of malloc()/free(). There
31 * is no reason to disable it, except perhaps for rare debugging.
32 */
33#ifndef CONFIG_HAP_NO_MEM_OPTIM
34# define CONFIG_HAP_MEM_OPTIM
35#endif /* CONFIG_HAP_NO_MEM_OPTIM */
36
Christopher Faulete9bd6862017-08-29 09:51:52 +020037#ifdef USE_THREAD
38#define THREAD_LOCAL __thread
39#else
40#define THREAD_LOCAL
41#endif
42
Willy Tarreauf161d0f2018-02-22 14:05:55 +010043/* On architectures supporting threads and double-word CAS, we can implement
44 * lock-less memory pools. This isn't supported for debugging modes however.
45 */
Olivier Houcharddc21ff72019-01-29 15:20:16 +010046#if defined(USE_THREAD) && defined(HA_HAVE_CAS_DW) && !defined(DEBUG_NO_LOCKLESS_POOLS) && !defined(DEBUG_UAF) && !defined(DEBUG_FAIL_ALLOC)
Willy Tarreauf161d0f2018-02-22 14:05:55 +010047#define CONFIG_HAP_LOCKLESS_POOLS
Willy Tarreaue18db9e2018-10-16 10:28:54 +020048#ifndef CONFIG_HAP_POOL_CACHE_SIZE
49#define CONFIG_HAP_POOL_CACHE_SIZE 524288
50#endif
Willy Tarreauf161d0f2018-02-22 14:05:55 +010051#endif
52
Willy Tarreau2a429502006-10-15 14:52:29 +020053/* CONFIG_HAP_INLINE_FD_SET
54 * This makes use of inline FD_* macros instead of calling equivalent
55 * functions. Benchmarks on a Pentium-M show that using functions is
56 * generally twice as fast. So it's better to keep this option unset.
57 */
58//#undef CONFIG_HAP_INLINE_FD_SET
59
Willy Tarreau2dd0d472006-06-29 17:53:05 +020060#endif /* _COMMON_CONFIG_H */