lmdb: use pwritev() on non-windows systems (MDB_USE_PWRITEV).

Change-Id: Iebd69846fc87cd6bb584002b366837ecb631b603
This commit is contained in:
Leo Yuriev 2015-01-17 17:48:54 +03:00
parent 1ca2b54966
commit 48e85e891e

58
mdb.c
View File

@ -33,41 +33,43 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
#define _GNU_SOURCE 1 # define _GNU_SOURCE 1
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#include <malloc.h> # include <malloc.h>
#include <windows.h> # include <windows.h>
/** getpid() returns int; MinGW defines pid_t but MinGW64 typedefs it /** getpid() returns int; MinGW defines pid_t but MinGW64 typedefs it
* as int64 which is wrong. MSVC doesn't define it at all, so just * as int64 which is wrong. MSVC doesn't define it at all, so just
* don't use it. * don't use it.
*/ */
#define MDB_PID_T int # define MDB_PID_T int
#define MDB_THR_T DWORD # define MDB_THR_T DWORD
#include <sys/types.h> # include <sys/types.h>
#include <sys/stat.h> # include <sys/stat.h>
#ifdef __GNUC__ # ifdef __GNUC__
# include <sys/param.h> # include <sys/param.h>
# else
# define LITTLE_ENDIAN 1234
# define BIG_ENDIAN 4321
# define BYTE_ORDER LITTLE_ENDIAN
# ifndef SSIZE_MAX
# define SSIZE_MAX INT_MAX
# endif
# endif
#else #else
# define LITTLE_ENDIAN 1234 # include <sys/types.h>
# define BIG_ENDIAN 4321 # include <sys/stat.h>
# define BYTE_ORDER LITTLE_ENDIAN # define MDB_PID_T pid_t
# ifndef SSIZE_MAX # define MDB_THR_T pthread_t
# define SSIZE_MAX INT_MAX # include <sys/param.h>
# endif # include <sys/uio.h>
#endif # include <sys/mman.h>
#else # ifdef HAVE_SYS_FILE_H
#include <sys/types.h> # include <sys/file.h>
#include <sys/stat.h> # endif
#define MDB_PID_T pid_t # include <fcntl.h>
#define MDB_THR_T pthread_t # define MDB_USE_PWRITEV
#include <sys/param.h>
#include <sys/uio.h>
#include <sys/mman.h>
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
#endif
#include <fcntl.h>
#endif #endif
/***************************************************************************** /*****************************************************************************