]>
Commit | Line | Data |
---|---|---|
1 | #ifndef __CONFIG_H | |
2 | #define __CONFIG_H | |
3 | ||
4 | #ifdef __APPLE__ | |
5 | #include <AvailabilityMacros.h> | |
6 | #endif | |
7 | ||
8 | /* use tcmalloc's malloc_size() when available */ | |
9 | #if defined(USE_TCMALLOC) | |
10 | #include <google/tcmalloc.h> | |
11 | #if TC_VERSION_MAJOR >= 1 && TC_VERSION_MINOR >= 6 | |
12 | #define HAVE_MALLOC_SIZE 1 | |
13 | #define redis_malloc_size(p) tc_malloc_size(p) | |
14 | #endif | |
15 | #endif | |
16 | ||
17 | /* fallback to native malloc_size() for osx */ | |
18 | #if defined(__APPLE__) && !defined(HAVE_MALLOC_SIZE) | |
19 | #include <malloc/malloc.h> | |
20 | #define HAVE_MALLOC_SIZE 1 | |
21 | #define redis_malloc_size(p) malloc_size(p) | |
22 | #endif | |
23 | ||
24 | /* define redis_fstat to fstat or fstat64() */ | |
25 | #if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_6) | |
26 | #define redis_fstat fstat64 | |
27 | #define redis_stat stat64 | |
28 | #else | |
29 | #define redis_fstat fstat | |
30 | #define redis_stat stat | |
31 | #endif | |
32 | ||
33 | /* test for proc filesystem */ | |
34 | #ifdef __linux__ | |
35 | #define HAVE_PROCFS 1 | |
36 | #endif | |
37 | ||
38 | /* test for task_info() */ | |
39 | #if defined(__APPLE__) | |
40 | #define HAVE_TASKINFO 1 | |
41 | #endif | |
42 | ||
43 | /* test for backtrace() */ | |
44 | #if defined(__APPLE__) || defined(__linux__) | |
45 | #define HAVE_BACKTRACE 1 | |
46 | #endif | |
47 | ||
48 | /* test for polling API */ | |
49 | #ifdef __linux__ | |
50 | #define HAVE_EPOLL 1 | |
51 | #endif | |
52 | ||
53 | #if (defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_6)) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined (__NetBSD__) | |
54 | #define HAVE_KQUEUE 1 | |
55 | #endif | |
56 | ||
57 | /* define aof_fsync to fdatasync() in Linux and fsync() for all the rest */ | |
58 | #ifdef __linux__ | |
59 | #define aof_fsync fdatasync | |
60 | #else | |
61 | #define aof_fsync fsync | |
62 | #endif | |
63 | ||
64 | #endif |