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#cmakedefine HAVE_UMEM_H ${HAVE_UMEM_H} 6#cmakedefine HAVE_SYSEXITS_H ${HAVE_SYSEXITS_H} 7 8#include <platform/platform.h> 9 10#ifdef WIN32 11#include <ws2tcpip.h> 12 13extern char *strsep(char **stringp, const char *pattern); 14 15#define PATH_MAX 1024 16 17/* @todo investigate this one.. */ 18 19#define SOCKETPAIR_AF AF_INET 20#define get_socket_error() WSAGetLastError() 21 22typedef HANDLE pid_t; 23typedef char* caddr_t; 24 25#define snprintf _snprintf 26#define strtoull(a, b, c) _strtoui64(a, b, c) 27#define strtoll(a, b, c) _strtoi64(a, b, c) 28/* to stop the stupid compiler to whine about this.. */ 29#ifndef __cplusplus 30#define strdup(a) _strdup(a) 31#define putenv(a) _putenv(a) 32#endif 33 34 35#else 36 37#if !defined(__cplusplus) && !defined(linux) && !defined(__GNUC__) 38typedef unsigned long long uint64_t; 39typedef long long int64_t; 40#endif 41 42#define closesocket(a) close(a) 43#define SOCKET int 44#define SOCKETPAIR_AF AF_UNIX 45#define SOCKET_ERROR -1 46#define INVALID_SOCKET -1 47#define get_socket_error() errno 48 49/* some POSIX systems need the following definition 50* to get mlockall flags out of sys/mman.h. */ 51#ifndef _P1003_1B_VISIBLE 52#define _P1003_1B_VISIBLE 53#endif 54/* need this to get IOV_MAX on some platforms. */ 55#ifndef __need_IOV_MAX 56#define __need_IOV_MAX 57#endif 58 59#ifndef _POSIX_PTHREAD_SEMANTICS 60#define _POSIX_PTHREAD_SEMANTICS 61#endif 62 63#ifdef __sun 64#include <priv.h> 65#define HAVE_DROP_PRIVILEGES 1 66#endif 67 68#define HAVE_SIGIGNORE 1 69#define HAVE_SIGPIPE 1 70#define HAVE_SYS_UN_H 1 71#cmakedefine HAVE_GETPWNAM ${HAVE_GETPWNAM} 72#cmakedefine HAVE_GETRLIMIT ${HAVE_GETRLIMIT} 73#cmakedefine HAVE_MLOCKALL ${HAVE_MLOCKALL} 74#cmakedefine HAVE_GETPAGESIZES ${HAVE_GETPAGESIZES} 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 <pwd.h> 90#include <sys/time.h> 91#include <signal.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#ifdef HAVE_SYSEXITS_H 111#include <sysexits.h> 112#else 113#define EX_USAGE EXIT_FAILURE 114#define EX_OSERR EXIT_FAILURE 115#endif 116 117#ifndef __cplusplus 118#include <stdbool.h> 119#endif 120 121#ifndef IOV_MAX 122# define IOV_MAX 1024 123#endif 124#define SASL_ENABLED 125 126#define PACKAGE "moxi" 127#define VERSION "${MOXI_VERSION}" 128#define CONFLATE_DB_PATH "${CONFLATE_DB_PATH}" 129 130#include <event.h> 131 132#if (!defined(_EVENT_NUMERIC_VERSION) || _EVENT_NUMERIC_VERSION < 0x02000000) && !defined(WIN32) 133typedef int evutil_socket_t; 134#endif 135 136#ifndef DEFAULT_ERRORLOG 137#define DEFAULT_ERRORLOG ERRORLOG_STDERR 138#endif 139 140#if defined(WORDS_BIGENDIAN) && WORDS_BIGENDIAN > 1 141#define ENDIAN_BIG 1 142#else 143#define ENDIAN_LITTLE 1 144#endif 145 146#endif 147