mirror of
https://github.com/isar/libmdbx.git
synced 2025-05-21 20:47:46 +08:00
mdbx: перемещение и доработка проверки _FILE_OFFSET_BITS
для Android.
This commit is contained in:
parent
60c0483987
commit
f82cf6a4b3
@ -28,14 +28,6 @@
|
||||
typedef struct iov_ctx iov_ctx_t;
|
||||
#include "osal.h"
|
||||
|
||||
#if UINTPTR_MAX > 0xffffFFFFul || ULONG_MAX > 0xffffFFFFul || defined(_WIN64)
|
||||
#define MDBX_WORDBITS 64
|
||||
#define MDBX_WORDBITS_LN2 6
|
||||
#else
|
||||
#define MDBX_WORDBITS 32
|
||||
#define MDBX_WORDBITS_LN2 5
|
||||
#endif /* MDBX_WORDBITS */
|
||||
|
||||
#include "options.h"
|
||||
|
||||
#include "atomics-types.h"
|
||||
|
@ -93,10 +93,11 @@ __cold static void choice_fcntl(void) {
|
||||
|
||||
static int lck_op(const mdbx_filehandle_t fd, int cmd, const int lck, const off_t offset, off_t len) {
|
||||
STATIC_ASSERT(sizeof(off_t) >= sizeof(void *) && sizeof(off_t) >= sizeof(size_t));
|
||||
#ifdef __ANDROID_API__
|
||||
STATIC_ASSERT_MSG((sizeof(off_t) * 8 == MDBX_WORDBITS), "The bitness of system `off_t` type is mismatch. Please "
|
||||
"fix build and/or NDK configuration.");
|
||||
#endif /* Android */
|
||||
#if defined(__ANDROID_API__) && __ANDROID_API__ < 24
|
||||
STATIC_ASSERT_MSG((sizeof(off_t) * CHAR_BIT == MDBX_WORDBITS),
|
||||
"The bitness of system `off_t` type is mismatch. Please "
|
||||
"fix build and/or NDK configuration.");
|
||||
#endif /* Android && API < 24 */
|
||||
assert(offset >= 0 && len > 0);
|
||||
assert((uint64_t)offset < (uint64_t)INT64_MAX && (uint64_t)len < (uint64_t)INT64_MAX &&
|
||||
(uint64_t)(offset + len) > (uint64_t)offset);
|
||||
|
@ -193,7 +193,14 @@ typedef struct osal_mmap {
|
||||
#elif defined(__ANDROID_API__)
|
||||
|
||||
#if __ANDROID_API__ < 24
|
||||
/* https://android-developers.googleblog.com/2017/09/introducing-android-native-development.html
|
||||
* https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */
|
||||
#define MDBX_HAVE_PWRITEV 0
|
||||
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS != MDBX_WORDBITS
|
||||
#error "_FILE_OFFSET_BITS != MDBX_WORDBITS and __ANDROID_API__ < 24" (_FILE_OFFSET_BITS != MDBX_WORDBITS)
|
||||
#elif defined(__FILE_OFFSET_BITS) && __FILE_OFFSET_BITS != MDBX_WORDBITS
|
||||
#error "__FILE_OFFSET_BITS != MDBX_WORDBITS and __ANDROID_API__ < 24" (__FILE_OFFSET_BITS != MDBX_WORDBITS)
|
||||
#endif
|
||||
#else
|
||||
#define MDBX_HAVE_PWRITEV 1
|
||||
#endif
|
||||
|
@ -433,11 +433,6 @@ __extern_C key_t ftok(const char *, int);
|
||||
#if __ANDROID_API__ >= 21
|
||||
#include <sys/sendfile.h>
|
||||
#endif
|
||||
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS != MDBX_WORDBITS
|
||||
#error "_FILE_OFFSET_BITS != MDBX_WORDBITS" (_FILE_OFFSET_BITS != MDBX_WORDBITS)
|
||||
#elif defined(__FILE_OFFSET_BITS) && __FILE_OFFSET_BITS != MDBX_WORDBITS
|
||||
#error "__FILE_OFFSET_BITS != MDBX_WORDBITS" (__FILE_OFFSET_BITS != MDBX_WORDBITS)
|
||||
#endif
|
||||
#endif /* Android */
|
||||
|
||||
#if defined(HAVE_SYS_STAT_H) || __has_include(<sys/stat.h>)
|
||||
@ -522,6 +517,14 @@ __extern_C key_t ftok(const char *, int);
|
||||
#endif
|
||||
#endif /* __BYTE_ORDER__ || __ORDER_LITTLE_ENDIAN__ || __ORDER_BIG_ENDIAN__ */
|
||||
|
||||
#if UINTPTR_MAX > 0xffffFFFFul || ULONG_MAX > 0xffffFFFFul || defined(_WIN64)
|
||||
#define MDBX_WORDBITS 64
|
||||
#define MDBX_WORDBITS_LN2 6
|
||||
#else
|
||||
#define MDBX_WORDBITS 32
|
||||
#define MDBX_WORDBITS_LN2 5
|
||||
#endif /* MDBX_WORDBITS */
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Availability of CMOV or equivalent */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user