2009-06-05 16:50:51 +08:00
|
|
|
#ifndef __CONFIG_H
|
|
|
|
#define __CONFIG_H
|
|
|
|
|
2009-07-24 20:32:58 +08:00
|
|
|
#ifdef __APPLE__
|
|
|
|
#include <AvailabilityMacros.h>
|
|
|
|
#endif
|
|
|
|
|
2010-10-23 16:18:48 +08:00
|
|
|
/* Use tcmalloc's malloc_size() when available.
|
|
|
|
* When tcmalloc is used, native OSX malloc_size() may never be used because
|
|
|
|
* this expects a different allocation scheme. Therefore, *exclusively* use
|
|
|
|
* either tcmalloc or OSX's malloc_size()! */
|
2010-10-23 15:59:28 +08:00
|
|
|
#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
|
2010-10-23 16:18:48 +08:00
|
|
|
#elif defined(__APPLE__)
|
2009-06-05 16:50:51 +08:00
|
|
|
#include <malloc/malloc.h>
|
2009-06-08 02:22:43 +08:00
|
|
|
#define HAVE_MALLOC_SIZE 1
|
2009-06-05 16:50:51 +08:00
|
|
|
#define redis_malloc_size(p) malloc_size(p)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* define redis_fstat to fstat or fstat64() */
|
2009-07-24 20:32:58 +08:00
|
|
|
#if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_6)
|
2009-06-05 16:50:51 +08:00
|
|
|
#define redis_fstat fstat64
|
|
|
|
#define redis_stat stat64
|
|
|
|
#else
|
|
|
|
#define redis_fstat fstat
|
|
|
|
#define redis_stat stat
|
|
|
|
#endif
|
|
|
|
|
2010-09-02 16:34:39 +08:00
|
|
|
/* test for proc filesystem */
|
|
|
|
#ifdef __linux__
|
|
|
|
#define HAVE_PROCFS 1
|
|
|
|
#endif
|
|
|
|
|
2010-09-02 16:57:58 +08:00
|
|
|
/* test for task_info() */
|
|
|
|
#if defined(__APPLE__)
|
|
|
|
#define HAVE_TASKINFO 1
|
|
|
|
#endif
|
|
|
|
|
2009-06-08 02:22:43 +08:00
|
|
|
/* test for backtrace() */
|
|
|
|
#if defined(__APPLE__) || defined(__linux__)
|
|
|
|
#define HAVE_BACKTRACE 1
|
|
|
|
#endif
|
|
|
|
|
2009-11-24 01:50:39 +08:00
|
|
|
/* test for polling API */
|
|
|
|
#ifdef __linux__
|
|
|
|
#define HAVE_EPOLL 1
|
|
|
|
#endif
|
|
|
|
|
2009-11-29 03:48:53 +08:00
|
|
|
#if (defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_6)) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined (__NetBSD__)
|
2009-11-28 21:46:21 +08:00
|
|
|
#define HAVE_KQUEUE 1
|
|
|
|
#endif
|
|
|
|
|
2010-05-02 21:05:34 +08:00
|
|
|
/* 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
|
|
|
|
|
2009-06-05 16:50:51 +08:00
|
|
|
#endif
|