mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-30 02:14:12 +08:00
mdbx: auto-define _GNU_SOURCE under control of MDBX_DISABLE_GNU_SOURCE.
Change-Id: I314d88b86517e3c44ad35fe02d3a27cb987c6d60
This commit is contained in:
parent
3c82ed0323
commit
7d621f6f0a
@ -291,7 +291,11 @@ add_mdbx_option(MDBX_ALLOY_BUILD "Build MDBX library as single object file" ON)
|
|||||||
add_mdbx_option(MDBX_TXN_CHECKOWNER "Checking transaction matches the calling thread inside libmdbx's API" ON)
|
add_mdbx_option(MDBX_TXN_CHECKOWNER "Checking transaction matches the calling thread inside libmdbx's API" ON)
|
||||||
add_mdbx_option(MDBX_TXN_CHECKPID "Paranoid checking PID inside libmdbx's API" AUTO)
|
add_mdbx_option(MDBX_TXN_CHECKPID "Paranoid checking PID inside libmdbx's API" AUTO)
|
||||||
mark_as_advanced(MDBX_TXN_CHECKPID)
|
mark_as_advanced(MDBX_TXN_CHECKPID)
|
||||||
if(APPLE)
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||||
|
add_mdbx_option(MDBX_DISABLE_GNU_SOURCE "Don't use nonstandard GNU/Linux extension functions" OFF)
|
||||||
|
mark_as_advanced(MDBX_DISABLE_GNU_SOURCE)
|
||||||
|
endif()
|
||||||
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||||
add_mdbx_option(MDBX_OSX_SPEED_INSTEADOF_DURABILITY "Disable use fcntl(F_FULLFSYNC) in favor of speed" OFF)
|
add_mdbx_option(MDBX_OSX_SPEED_INSTEADOF_DURABILITY "Disable use fcntl(F_FULLFSYNC) in favor of speed" OFF)
|
||||||
mark_as_advanced(MDBX_OSX_SPEED_INSTEADOF_DURABILITY)
|
mark_as_advanced(MDBX_OSX_SPEED_INSTEADOF_DURABILITY)
|
||||||
endif()
|
endif()
|
||||||
|
@ -20,7 +20,7 @@ suffix ?=
|
|||||||
|
|
||||||
CC ?= gcc
|
CC ?= gcc
|
||||||
LD ?= ld
|
LD ?= ld
|
||||||
MDBX_OPTIONS ?= -D_GNU_SOURCE=1 -DNDEBUG=1
|
MDBX_OPTIONS ?= -DNDEBUG=1
|
||||||
CFLAGS ?= -O2 -g3 -Wall -Werror -Wextra -ffunction-sections -fPIC -fvisibility=hidden -std=gnu11 -pthread
|
CFLAGS ?= -O2 -g3 -Wall -Werror -Wextra -ffunction-sections -fPIC -fvisibility=hidden -std=gnu11 -pthread
|
||||||
|
|
||||||
# LY: '--no-as-needed,-lrt' for ability to built with modern glibc, but then run with the old
|
# LY: '--no-as-needed,-lrt' for ability to built with modern glibc, but then run with the old
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
/* POSIX */
|
/* POSIX */
|
||||||
#cmakedefine01 MDBX_USE_ROBUST
|
#cmakedefine01 MDBX_USE_ROBUST
|
||||||
#cmakedefine01 MDBX_USE_OFDLOCKS
|
#cmakedefine01 MDBX_USE_OFDLOCKS
|
||||||
|
#cmakedefine01 MDBX_DISABLE_GNU_SOURCE
|
||||||
|
|
||||||
/* Simulate "AUTO" values of tristate options */
|
/* Simulate "AUTO" values of tristate options */
|
||||||
#cmakedefine MDBX_TXN_CHECKPID_AUTO
|
#cmakedefine MDBX_TXN_CHECKPID_AUTO
|
||||||
|
@ -15628,6 +15628,11 @@ __dll_export
|
|||||||
" MDBX_TXN_CHECKPID=" STRINGIFY(MDBX_TXN_CHECKPID)
|
" MDBX_TXN_CHECKPID=" STRINGIFY(MDBX_TXN_CHECKPID)
|
||||||
" MDBX_TXN_CHECKOWNER=" STRINGIFY(MDBX_TXN_CHECKOWNER)
|
" MDBX_TXN_CHECKOWNER=" STRINGIFY(MDBX_TXN_CHECKOWNER)
|
||||||
" MDBX_64BIT_ATOMIC=" STRINGIFY(MDBX_64BIT_ATOMIC)
|
" MDBX_64BIT_ATOMIC=" STRINGIFY(MDBX_64BIT_ATOMIC)
|
||||||
|
#ifdef _GNU_SOURCE
|
||||||
|
" _GNU_SOURCE=YES"
|
||||||
|
#else
|
||||||
|
" _GNU_SOURCE=NO"
|
||||||
|
#endif /* _GNU_SOURCE */
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
" MDBX_OSX_SPEED_INSTEADOF_DURABILITY=" STRINGIFY(MDBX_OSX_SPEED_INSTEADOF_DURABILITY)
|
" MDBX_OSX_SPEED_INSTEADOF_DURABILITY=" STRINGIFY(MDBX_OSX_SPEED_INSTEADOF_DURABILITY)
|
||||||
#endif /* MacOS */
|
#endif /* MacOS */
|
||||||
|
@ -49,6 +49,15 @@
|
|||||||
# define MDBX_INTERNAL_VAR extern
|
# define MDBX_INTERNAL_VAR extern
|
||||||
#endif /* MDBX_ALLOY */
|
#endif /* MDBX_ALLOY */
|
||||||
|
|
||||||
|
#ifndef MDBX_DISABLE_GNU_SOURCE
|
||||||
|
#define MDBX_DISABLE_GNU_SOURCE 0
|
||||||
|
#endif
|
||||||
|
#if MDBX_DISABLE_GNU_SOURCE
|
||||||
|
#undef _GNU_SOURCE
|
||||||
|
#elif defined(__linux__) || defined(__gnu_linux__)
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/* Should be defined before any includes */
|
/* Should be defined before any includes */
|
||||||
|
@ -1275,10 +1275,7 @@ retry_mapview:;
|
|||||||
return rc;
|
return rc;
|
||||||
#else
|
#else
|
||||||
if (limit != map->length) {
|
if (limit != map->length) {
|
||||||
#if defined(_GNU_SOURCE) && \
|
#if defined(_GNU_SOURCE) && (defined(__linux__) || defined(__gnu_linux__))
|
||||||
!(defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
|
|
||||||
defined(__BSD__) || defined(__NETBSD__) || defined(__bsdi__) || \
|
|
||||||
defined(__DragonFly__) || defined(__APPLE__) || defined(__MACH__))
|
|
||||||
void *ptr = mremap(map->address, map->length, limit,
|
void *ptr = mremap(map->address, map->length, limit,
|
||||||
/* LY: in case changing the mapping size calling code
|
/* LY: in case changing the mapping size calling code
|
||||||
must guarantees the absence of competing threads, and
|
must guarantees the absence of competing threads, and
|
||||||
@ -1292,7 +1289,7 @@ retry_mapview:;
|
|||||||
map->length = limit;
|
map->length = limit;
|
||||||
#else
|
#else
|
||||||
return MDBX_RESULT_TRUE;
|
return MDBX_RESULT_TRUE;
|
||||||
#endif /* mremap() <= _GNU_SOURCE && !__FreeBSD__ */
|
#endif /* _GNU_SOURCE && __linux__ */
|
||||||
}
|
}
|
||||||
return (flags & MDBX_RDONLY) ? MDBX_SUCCESS : mdbx_ftruncate(map->fd, size);
|
return (flags & MDBX_RDONLY) ? MDBX_SUCCESS : mdbx_ftruncate(map->fd, size);
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,7 +13,7 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
|||||||
# the RPATH to be used when installing, but only if it's not a system directory
|
# the RPATH to be used when installing, but only if it's not a system directory
|
||||||
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
|
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
|
||||||
if(isSystemDir EQUAL -1)
|
if(isSystemDir EQUAL -1)
|
||||||
if(APPLE)
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
||||||
set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
|
set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib")
|
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user