mdbx: portability - support for non-_GNU_SOURCE mode.

Change-Id: I9988d0ea8a9ddc06c799c65c4b2728bd17ff77e7
This commit is contained in:
Leonid Yuriev 2019-07-14 00:49:00 +03:00
parent 41f00485fd
commit 2544a621e7
2 changed files with 3 additions and 2 deletions

View File

@ -11707,7 +11707,7 @@ static int __cold mdbx_env_copy_asis(MDBX_env *env, MDBX_txn *read_txn,
/* Copy the data */ /* Copy the data */
const size_t data_bytes = pgno2bytes(env, read_txn->mt_next_pgno); const size_t data_bytes = pgno2bytes(env, read_txn->mt_next_pgno);
mdbx_jitter4testing(false); mdbx_jitter4testing(false);
#if __GLIBC_PREREQ(2, 27) #if __GLIBC_PREREQ(2, 27) && defined(_GNU_SOURCE)
for (off_t in_offset = meta_bytes; in_offset < (off_t)data_bytes;) { for (off_t in_offset = meta_bytes; in_offset < (off_t)data_bytes;) {
off_t out_offset = in_offset; off_t out_offset = in_offset;
ssize_t bytes_copied = copy_file_range( ssize_t bytes_copied = copy_file_range(

View File

@ -434,7 +434,8 @@ static __inline void mdbx_invalidate_cache(void *addr, size_t nbytes) {
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
/* libc compatibility stuff */ /* libc compatibility stuff */
#if __GLIBC_PREREQ(2, 1) #if (!defined(__GLIBC__) && __GLIBC_PREREQ(2, 1)) && \
(defined(_GNU_SOURCE) || defined(_BSD_SOURCE))
#define mdbx_asprintf asprintf #define mdbx_asprintf asprintf
#define mdbx_vasprintf vasprintf #define mdbx_vasprintf vasprintf
#else #else