2006-06-15 19:48:13 +00:00
|
|
|
/*
|
2006-06-29 15:53:05 +00:00
|
|
|
include/common/config.h
|
2006-06-26 00:48:02 +00:00
|
|
|
This files contains most of the user-configurable settings.
|
|
|
|
|
2007-05-13 16:26:08 +00:00
|
|
|
Copyright (C) 2000-2007 Willy Tarreau - w@1wt.eu
|
2006-06-15 19:48:13 +00:00
|
|
|
|
|
|
|
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-29 15:53:05 +00:00
|
|
|
#ifndef _COMMON_CONFIG_H
|
|
|
|
#define _COMMON_CONFIG_H
|
2006-06-26 00:48:02 +00:00
|
|
|
|
2006-06-29 15:53:05 +00:00
|
|
|
#include <common/defaults.h>
|
2006-06-15 19:48:13 +00:00
|
|
|
|
2006-06-26 00:48:02 +00:00
|
|
|
/* this reduces the number of calls to select() by choosing appropriate
|
|
|
|
* sheduler precision in milliseconds. It should be near the minimum
|
|
|
|
* time that is needed by select() to collect all events. All timeouts
|
|
|
|
* are rounded up by adding this value prior to pass it to select().
|
|
|
|
*/
|
|
|
|
#define SCHEDULER_RESOLUTION 9
|
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 */
|
|
|
|
|
2007-05-13 16:26:08 +00:00
|
|
|
/* CONFIG_HAP_MALLOC / CONFIG_HAP_CALLOC / CONFIG_HAP_FREE
|
|
|
|
* This macro allows to replace the malloc function with another one.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_HAP_MALLOC
|
|
|
|
#define MALLOC CONFIG_HAP_MALLOC
|
|
|
|
#else
|
|
|
|
#define MALLOC malloc
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_HAP_CALLOC
|
|
|
|
#define CALLOC CONFIG_HAP_CALLOC
|
|
|
|
#else
|
|
|
|
#define CALLOC calloc
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_HAP_FREE
|
|
|
|
#define FREE CONFIG_HAP_FREE
|
|
|
|
#else
|
|
|
|
#define FREE free
|
|
|
|
#endif
|
|
|
|
|
2006-06-29 16:54:54 +00:00
|
|
|
|
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-10-15 21:43:42 +00:00
|
|
|
/* CONFIG_HAP_USE_REGPARM
|
|
|
|
* This enables the use of register parameters for some functions where
|
2008-08-17 15:06:37 +00:00
|
|
|
* it may improve performance by a measurable factor. This MUST NOT be
|
|
|
|
* enabled on gcc < 3 because it is ignored for function pointers.
|
2006-10-15 13:38:50 +00:00
|
|
|
*/
|
2008-08-17 15:06:37 +00:00
|
|
|
#if CONFIG_HAP_USE_REGPARM && __GNUC__ >= 3
|
2006-10-15 13:38:50 +00:00
|
|
|
#define REGPRM1 __attribute__((regparm(1)))
|
|
|
|
#define REGPRM2 __attribute__((regparm(2)))
|
|
|
|
#define REGPRM3 __attribute__((regparm(3)))
|
2006-10-15 21:43:42 +00:00
|
|
|
#else
|
|
|
|
#define REGPRM1
|
|
|
|
#define REGPRM2
|
|
|
|
#define REGPRM3
|
2006-10-15 13:38:50 +00:00
|
|
|
#endif
|
2006-10-15 12:52:29 +00:00
|
|
|
|
2008-08-29 13:48:49 +00:00
|
|
|
/* By default, gcc does not inline large chunks of code, but we want it to
|
|
|
|
* respect our choices.
|
|
|
|
*/
|
|
|
|
#if !defined(forceinline)
|
|
|
|
#if __GNUC__ < 3
|
|
|
|
#define forceinline inline
|
|
|
|
#else
|
|
|
|
#define forceinline inline __attribute__((always_inline))
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2006-06-29 15:53:05 +00:00
|
|
|
#endif /* _COMMON_CONFIG_H */
|