From 8f08e1c7edfdeb39f863e869e646429ceff273c1 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Wed, 11 Sep 2019 17:02:01 +0300 Subject: [PATCH] mdbx: fix cross-build & qemu-testing issues. Change-Id: I6b2343cc4e08c3cb706a190c4c515965182733a2 --- GNUmakefile | 6 +++--- src/elements/core.c | 4 ++-- src/elements/internals.h | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index bc62e85f..75d62820 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -138,14 +138,14 @@ check: all example mdbx_test example: mdbx.h tutorial/sample-mdbx.c libmdbx.$(SO_SUFFIX) $(CC) $(CFLAGS) -I. tutorial/sample-mdbx.c ./libmdbx.$(SO_SUFFIX) -o example -check-singleprocess: all +check-singleprocess: all mdbx_test rm -f $(TEST_DB) $(TEST_LOG) && (set -o pipefail; \ ./mdbx_test --repeat=4 --pathname=$(TEST_DB) --dont-cleanup-after --hill && \ ./mdbx_test --repeat=2 --pathname=$(TEST_DB) --dont-cleanup-before --dont-cleanup-after --copy \ | tee -a $(TEST_LOG) | tail -n 42) \ && ./mdbx_chk -vvn $(TEST_DB) && ./mdbx_chk -vvn $(TEST_DB)-copy -check-fault: all +check-fault: all mdbx_test rm -f $(TEST_DB) $(TEST_LOG) && (set -o pipefail; ./mdbx_test --pathname=$(TEST_DB) --inject-writefault=42 --dump-config --dont-cleanup-after basic | tee -a $(TEST_LOG) | tail -n 42) \ ; ./mdbx_chk -vvnw $(TEST_DB) && ([ ! -e $(TEST_DB)-copy ] || ./mdbx_chk -vvn $(TEST_DB)-copy) @@ -278,7 +278,7 @@ cross-qemu: @for CC in $(CROSS_LIST); do \ echo "===================== $$CC + qemu"; \ $(MAKE) clean && \ - CC=$$CC CXX=$$(echo $$CC | sed 's/-gcc/-g++/') EXE_LDFLAGS=-static XCFLAGS="-DMDBX_SAFE4QEMU $(XCFLAGS)" \ + CC=$$CC CXX=$$(echo $$CC | sed 's/-gcc/-g++/') EXE_LDFLAGS=-static MDBX_OPTIONS="-DMDBX_SAFE4QEMU $(MDBX_OPTIONS)" \ $(MAKE) check-singleprocess || exit $$?; \ done diff --git a/src/elements/core.c b/src/elements/core.c index 642bc8bc..60b29b4c 100644 --- a/src/elements/core.c +++ b/src/elements/core.c @@ -4814,7 +4814,7 @@ static int mdbx_page_flush(MDBX_txn *txn, pgno_t keep) { #if MDBX_CPU_CACHE_MMAP_NONCOHERENT #if defined(__linux__) || defined(__gnu_linux__) - if (linux_kernel_version >= 0x02060b00) + if (mdbx_linux_kernel_version >= 0x02060b00) /* Linux kernels older than version 2.6.11 ignore the addr and nbytes * arguments, making this function fairly expensive. Therefore, the * whole cache is always flushed. */ @@ -4839,7 +4839,7 @@ static int mdbx_page_flush(MDBX_txn *txn, pgno_t keep) { #if MDBX_CPU_CACHE_MMAP_NONCOHERENT && \ (defined(__linux__) || defined(__gnu_linux__)) - if (linux_kernel_version < 0x02060b00) { + if (mdbx_linux_kernel_version < 0x02060b00) { /* Linux kernels older than version 2.6.11 ignore the addr and nbytes * arguments, making this function fairly expensive. Therefore, the whole * cache is always flushed. */ diff --git a/src/elements/internals.h b/src/elements/internals.h index cab368a1..a2ff6801 100644 --- a/src/elements/internals.h +++ b/src/elements/internals.h @@ -174,7 +174,8 @@ #ifndef MDBX_USE_OFDLOCKS #define MDBX_USE_OFDLOCKS_CONFIG AUTO -#if defined(F_OFD_SETLK) && defined(F_OFD_SETLKW) && defined(F_OFD_GETLK) +#if defined(F_OFD_SETLK) && defined(F_OFD_SETLKW) && defined(F_OFD_GETLK) && \ + !defined(MDBX_SAFE4QEMU) #define MDBX_USE_OFDLOCKS 1 #else #define MDBX_USE_OFDLOCKS 0