1/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2#ifndef CONFIG_H 3#define CONFIG_H 1 4 5#include <event.h> 6#include <platform/platform.h> 7 8#cmakedefine HAVE_ATOMIC ${HAVE_ATOMIC} 9 10#if (!defined(_EVENT_NUMERIC_VERSION) || _EVENT_NUMERIC_VERSION < 0x02000000) && !defined(WIN32) 11typedef int evutil_socket_t; 12#endif 13 14#ifdef WIN32 15#include <winsock2.h> 16#include <ws2tcpip.h> 17#include <windows.h> 18 19#define PATH_MAX 1024 20 21/* @todo investigate this one.. */ 22 23#define SOCKETPAIR_AF AF_INET 24#define get_socket_error() WSAGetLastError() 25 26typedef int in_port_t; 27typedef HANDLE pid_t; 28 29#define snprintf _snprintf 30#define strtoull(a, b, c) _strtoui64(a, b, c) 31#define strtoll(a, b, c) _strtoi64(a, b, c) 32/* to stop the stupid compiler to whine about this.. */ 33#ifndef __cplusplus 34#define strdup(a) _strdup(a) 35#define putenv(a) _putenv(a) 36#endif 37 38#define EX_OSERR EXIT_FAILURE 39#define EX_USAGE EXIT_FAILURE 40 41#else 42 43#if !defined(__cplusplus) && !defined(linux) && !defined(__GNUC__) 44typedef unsigned long long uint64_t; 45typedef long long int64_t; 46#endif 47 48#define closesocket(a) close(a) 49#define SOCKET int 50#define SOCKETPAIR_AF AF_UNIX 51#define SOCKET_ERROR -1 52#define INVALID_SOCKET -1 53#define get_socket_error() errno 54 55/* some POSIX systems need the following definition 56 * to get mlockall flags out of sys/mman.h. */ 57#ifndef _P1003_1B_VISIBLE 58#define _P1003_1B_VISIBLE 59#endif 60/* need this to get IOV_MAX on some platforms. */ 61#ifndef __need_IOV_MAX 62#define __need_IOV_MAX 63#endif 64 65#ifndef _POSIX_PTHREAD_SEMANTICS 66#define _POSIX_PTHREAD_SEMANTICS 67#endif 68 69#ifdef __sun 70#include <priv.h> 71#define HAVE_DROP_PRIVILEGES 1 72#endif 73 74#define HAVE_SIGIGNORE 1 75 76 77#include <sys/wait.h> 78#include <sys/socket.h> 79#include <netinet/in.h> 80#include <netdb.h> 81#include <unistd.h> 82#include <sys/stat.h> 83#include <sys/un.h> 84#include <sys/resource.h> 85#include <sys/uio.h> 86#include <netinet/tcp.h> 87#include <arpa/inet.h> 88#include <sys/mman.h> 89#include <sys/time.h> 90#include <signal.h> 91#include <sysexits.h> 92 93/* @todo trondn fixme!! */ 94#if !defined(__cplusplus) && !defined(PRIu64) 95#define PRIu64 "lu" 96#endif 97 98#if !defined(__cplusplus) && !defined(PRIu32) 99#define PRIu32 "u" 100#endif 101 102 103#endif 104 105/* Common section */ 106#include <stdlib.h> 107#include <inttypes.h> 108#include <sys/types.h> 109 110#ifndef __cplusplus 111#include <stdbool.h> 112#endif 113 114#ifndef IOV_MAX 115# define IOV_MAX 1024 116#endif 117#define SASL_ENABLED 118 119#define MEMCACHED_VERSION "${MEMCACHED_VERSION}" 120#define PRODUCT_VERSION "${PRODUCT_VERSION}" 121 122#endif 123