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

44
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 # else
# define LITTLE_ENDIAN 1234 # define LITTLE_ENDIAN 1234
# define BIG_ENDIAN 4321 # define BIG_ENDIAN 4321
# define BYTE_ORDER LITTLE_ENDIAN # define BYTE_ORDER LITTLE_ENDIAN
# ifndef SSIZE_MAX # ifndef SSIZE_MAX
# define SSIZE_MAX INT_MAX # define SSIZE_MAX INT_MAX
# endif # endif
#endif # endif
#else #else
#include <sys/types.h> # include <sys/types.h>
#include <sys/stat.h> # include <sys/stat.h>
#define MDB_PID_T pid_t # define MDB_PID_T pid_t
#define MDB_THR_T pthread_t # define MDB_THR_T pthread_t
#include <sys/param.h> # include <sys/param.h>
#include <sys/uio.h> # include <sys/uio.h>
#include <sys/mman.h> # include <sys/mman.h>
#ifdef HAVE_SYS_FILE_H # ifdef HAVE_SYS_FILE_H
#include <sys/file.h> # include <sys/file.h>
#endif # endif
#include <fcntl.h> # include <fcntl.h>
# define MDB_USE_PWRITEV
#endif #endif
/***************************************************************************** /*****************************************************************************