config.h 1.4 KB
Newer Older
1 2 3
#ifndef __CONFIG_H
#define __CONFIG_H

4 5 6 7
#ifdef __APPLE__
#include <AvailabilityMacros.h>
#endif

8 9 10 11 12 13 14 15 16 17 18
/* use tcmalloc's malloc_size() when available */
#if defined(USE_TCMALLOC)
#include <google/tcmalloc.h>
#if TC_VERSION_MAJOR >= 1 && TC_VERSION_MINOR >= 6
#define HAVE_MALLOC_SIZE 1
#define redis_malloc_size(p) tc_malloc_size(p)
#endif
#endif

/* fallback to native malloc_size() for osx */
#if defined(__APPLE__) && !defined(HAVE_MALLOC_SIZE)
19
#include <malloc/malloc.h>
20
#define HAVE_MALLOC_SIZE 1
21 22 23 24
#define redis_malloc_size(p) malloc_size(p)
#endif

/* define redis_fstat to fstat or fstat64() */
25
#if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_6)
26 27 28 29 30 31 32
#define redis_fstat fstat64
#define redis_stat stat64
#else
#define redis_fstat fstat
#define redis_stat stat
#endif

33 34 35 36 37
/* test for proc filesystem */
#ifdef __linux__
#define HAVE_PROCFS 1
#endif

38 39 40 41 42
/* test for task_info() */
#if defined(__APPLE__)
#define HAVE_TASKINFO 1
#endif

43 44 45 46 47
/* test for backtrace() */
#if defined(__APPLE__) || defined(__linux__)
#define HAVE_BACKTRACE 1
#endif

48 49 50 51 52
/* test for polling API */
#ifdef __linux__
#define HAVE_EPOLL 1
#endif

53
#if (defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_6)) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined (__NetBSD__)
H
Harish Mallipeddi 已提交
54 55 56
#define HAVE_KQUEUE 1
#endif

57 58 59 60 61 62 63
/* define aof_fsync to fdatasync() in Linux and fsync() for all the rest */
#ifdef __linux__
#define aof_fsync fdatasync
#else
#define aof_fsync fsync
#endif

64
#endif