2013-04-16 23:57:27 -04:00
|
|
|
#ifndef TOKU_PORTABILITY_H
|
|
|
|
#define TOKU_PORTABILITY_H
|
|
|
|
|
2013-04-16 23:57:28 -04:00
|
|
|
// Tokutek portability layer
|
|
|
|
|
2013-04-16 23:57:27 -04:00
|
|
|
#if defined __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2013-04-16 23:57:28 -04:00
|
|
|
#if defined(_MSC_VER) || (defined(__INTEL_COMPILER) && defined(__ICL))
|
2013-04-16 23:57:27 -04:00
|
|
|
|
|
|
|
#define TOKU_WINDOWS 1
|
2013-04-16 23:57:28 -04:00
|
|
|
#define DEV_NULL_FILE "NUL"
|
2013-04-16 23:57:27 -04:00
|
|
|
|
2013-04-16 23:57:28 -04:00
|
|
|
#else
|
2013-04-16 23:57:27 -04:00
|
|
|
|
2013-04-16 23:57:28 -04:00
|
|
|
#define TOKU_WINDOWS 0
|
|
|
|
#define DEV_NULL_FILE "/dev/null"
|
2013-04-16 23:57:27 -04:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2013-04-16 23:57:28 -04:00
|
|
|
#if defined(TOKU_WINDOWS) && TOKU_WINDOWS
|
2013-04-16 23:57:27 -04:00
|
|
|
// Windows
|
|
|
|
|
|
|
|
// ntohl and htonl are defined in winsock.h
|
|
|
|
#include <winsock.h>
|
|
|
|
#include <direct.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include "stdint.h"
|
|
|
|
#include "inttypes.h"
|
|
|
|
#include "toku_pthread.h"
|
|
|
|
#include "unistd.h"
|
|
|
|
#include "misc.h"
|
|
|
|
|
|
|
|
#define UNUSED_WARNING(a) a=a /* To make up for missing attributes */
|
|
|
|
|
|
|
|
#if defined(__ICL)
|
|
|
|
#define __attribute__(x) /* Nothing */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#elif defined(__INTEL_COMPILER)
|
|
|
|
|
|
|
|
#if defined(__ICC)
|
|
|
|
// Intel linux
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#elif defined(__GNUC__)
|
|
|
|
// GCC linux
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
// Define ntohl using arpa/inet.h
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#error Not ICC and not GNUC. What compiler?
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "os.h"
|
|
|
|
|
|
|
|
#define UU(x) x __attribute__((__unused__))
|
|
|
|
|
|
|
|
#if defined __cplusplus
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|