Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 1 | /* |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 2 | include/common/config.h |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 3 | This files contains most of the user-configurable settings. |
| 4 | |
Willy Tarreau | 50e608d | 2007-05-13 18:26:08 +0200 | [diff] [blame^] | 5 | Copyright (C) 2000-2007 Willy Tarreau - w@1wt.eu |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 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 | */ |
| 21 | |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 22 | #ifndef _COMMON_CONFIG_H |
| 23 | #define _COMMON_CONFIG_H |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 24 | |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 25 | #include <common/defaults.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 26 | |
| 27 | /* this reduces the number of calls to select() by choosing appropriate |
| 28 | * sheduler precision in milliseconds. It should be near the minimum |
| 29 | * time that is needed by select() to collect all events. All timeouts |
| 30 | * are rounded up by adding this value prior to pass it to select(). |
| 31 | */ |
| 32 | #define SCHEDULER_RESOLUTION 9 |
| 33 | |
Willy Tarreau | e3ba5f0 | 2006-06-29 18:54:54 +0200 | [diff] [blame] | 34 | /* CONFIG_HAP_MEM_OPTIM |
| 35 | * This enables use of memory pools instead of malloc()/free(). There |
| 36 | * is no reason to disable it, except perhaps for rare debugging. |
| 37 | */ |
| 38 | #ifndef CONFIG_HAP_NO_MEM_OPTIM |
| 39 | # define CONFIG_HAP_MEM_OPTIM |
| 40 | #endif /* CONFIG_HAP_NO_MEM_OPTIM */ |
| 41 | |
Willy Tarreau | 50e608d | 2007-05-13 18:26:08 +0200 | [diff] [blame^] | 42 | /* CONFIG_HAP_MALLOC / CONFIG_HAP_CALLOC / CONFIG_HAP_FREE |
| 43 | * This macro allows to replace the malloc function with another one. |
| 44 | */ |
| 45 | #ifdef CONFIG_HAP_MALLOC |
| 46 | #define MALLOC CONFIG_HAP_MALLOC |
| 47 | #else |
| 48 | #define MALLOC malloc |
| 49 | #endif |
| 50 | |
| 51 | #ifdef CONFIG_HAP_CALLOC |
| 52 | #define CALLOC CONFIG_HAP_CALLOC |
| 53 | #else |
| 54 | #define CALLOC calloc |
| 55 | #endif |
| 56 | |
| 57 | #ifdef CONFIG_HAP_FREE |
| 58 | #define FREE CONFIG_HAP_FREE |
| 59 | #else |
| 60 | #define FREE free |
| 61 | #endif |
| 62 | |
Willy Tarreau | e3ba5f0 | 2006-06-29 18:54:54 +0200 | [diff] [blame] | 63 | |
Willy Tarreau | 2a42950 | 2006-10-15 14:52:29 +0200 | [diff] [blame] | 64 | /* CONFIG_HAP_INLINE_FD_SET |
| 65 | * This makes use of inline FD_* macros instead of calling equivalent |
| 66 | * functions. Benchmarks on a Pentium-M show that using functions is |
| 67 | * generally twice as fast. So it's better to keep this option unset. |
| 68 | */ |
| 69 | //#undef CONFIG_HAP_INLINE_FD_SET |
| 70 | |
Willy Tarreau | 390223b | 2006-10-15 23:43:42 +0200 | [diff] [blame] | 71 | /* CONFIG_HAP_USE_REGPARM |
| 72 | * This enables the use of register parameters for some functions where |
| 73 | * it may improve performance by a measurable factor. |
Willy Tarreau | fb27867 | 2006-10-15 15:38:50 +0200 | [diff] [blame] | 74 | */ |
Willy Tarreau | 390223b | 2006-10-15 23:43:42 +0200 | [diff] [blame] | 75 | #ifdef CONFIG_HAP_USE_REGPARM |
Willy Tarreau | fb27867 | 2006-10-15 15:38:50 +0200 | [diff] [blame] | 76 | #define REGPRM1 __attribute__((regparm(1))) |
| 77 | #define REGPRM2 __attribute__((regparm(2))) |
| 78 | #define REGPRM3 __attribute__((regparm(3))) |
Willy Tarreau | 390223b | 2006-10-15 23:43:42 +0200 | [diff] [blame] | 79 | #else |
| 80 | #define REGPRM1 |
| 81 | #define REGPRM2 |
| 82 | #define REGPRM3 |
Willy Tarreau | fb27867 | 2006-10-15 15:38:50 +0200 | [diff] [blame] | 83 | #endif |
Willy Tarreau | 2a42950 | 2006-10-15 14:52:29 +0200 | [diff] [blame] | 84 | |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 85 | #endif /* _COMMON_CONFIG_H */ |