2006-06-15 19:48:13 +00:00
|
|
|
/*
|
2009-10-27 20:40:18 +00:00
|
|
|
* include/common/config.h
|
|
|
|
* This files contains most of the user-configurable settings.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2000-2009 Willy Tarreau - w@1wt.eu
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation, version 2.1
|
|
|
|
* exclusively.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2006-06-15 19:48:13 +00:00
|
|
|
|
2006-06-29 15:53:05 +00:00
|
|
|
#ifndef _COMMON_CONFIG_H
|
|
|
|
#define _COMMON_CONFIG_H
|
2006-06-26 00:48:02 +00:00
|
|
|
|
2009-10-27 20:40:18 +00:00
|
|
|
#include <common/compiler.h>
|
2014-07-15 16:05:58 +00:00
|
|
|
#include <common/compat.h>
|
2006-06-29 15:53:05 +00:00
|
|
|
#include <common/defaults.h>
|
2006-06-15 19:48:13 +00:00
|
|
|
|
2006-06-29 16:54:54 +00:00
|
|
|
/* CONFIG_HAP_MEM_OPTIM
|
|
|
|
* This enables use of memory pools instead of malloc()/free(). There
|
|
|
|
* is no reason to disable it, except perhaps for rare debugging.
|
|
|
|
*/
|
|
|
|
#ifndef CONFIG_HAP_NO_MEM_OPTIM
|
|
|
|
# define CONFIG_HAP_MEM_OPTIM
|
|
|
|
#endif /* CONFIG_HAP_NO_MEM_OPTIM */
|
|
|
|
|
2017-08-29 07:51:52 +00:00
|
|
|
#ifdef USE_THREAD
|
|
|
|
#define THREAD_LOCAL __thread
|
|
|
|
#else
|
|
|
|
#define THREAD_LOCAL
|
|
|
|
#endif
|
|
|
|
|
2018-10-10 16:29:23 +00:00
|
|
|
/* Some architectures have a double-word CAS, sometimes even dual-8 bytes */
|
|
|
|
#if defined(__x86_64__) || defined (__aarch64__)
|
|
|
|
#define HA_HAVE_CAS_DW
|
|
|
|
#define HA_CAS_IS_8B
|
|
|
|
#elif defined(__arm__) && (defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__))
|
|
|
|
#define HA_HAVE_CAS_DW
|
|
|
|
#endif
|
|
|
|
|
2018-02-22 13:05:55 +00:00
|
|
|
/* On architectures supporting threads and double-word CAS, we can implement
|
|
|
|
* lock-less memory pools. This isn't supported for debugging modes however.
|
|
|
|
*/
|
2018-10-10 16:29:23 +00:00
|
|
|
#if defined(USE_THREAD) && defined(HA_HAVE_CAS_DW) && !defined(DEBUG_NO_LOCKLESS_POOLS) && !defined(DEBUG_UAF)
|
2018-02-22 13:05:55 +00:00
|
|
|
#define CONFIG_HAP_LOCKLESS_POOLS
|
2018-10-16 08:28:54 +00:00
|
|
|
#ifndef CONFIG_HAP_POOL_CACHE_SIZE
|
|
|
|
#define CONFIG_HAP_POOL_CACHE_SIZE 524288
|
|
|
|
#endif
|
2018-02-22 13:05:55 +00:00
|
|
|
#endif
|
|
|
|
|
2006-10-15 12:52:29 +00:00
|
|
|
/* CONFIG_HAP_INLINE_FD_SET
|
|
|
|
* This makes use of inline FD_* macros instead of calling equivalent
|
|
|
|
* functions. Benchmarks on a Pentium-M show that using functions is
|
|
|
|
* generally twice as fast. So it's better to keep this option unset.
|
|
|
|
*/
|
|
|
|
//#undef CONFIG_HAP_INLINE_FD_SET
|
|
|
|
|
2006-06-29 15:53:05 +00:00
|
|
|
#endif /* _COMMON_CONFIG_H */
|