Vendors/lmdb: upgrade to latest version

This commit is contained in:
Vincent Bernardoff 2018-07-26 13:23:23 +02:00 committed by Pierre Chambart
parent 6cfd00e705
commit 2a4c6762a7
4 changed files with 38 additions and 16 deletions

View File

@ -136,7 +136,7 @@
* *
* @author Howard Chu, Symas Corporation. * @author Howard Chu, Symas Corporation.
* *
* @copyright Copyright 2011-2017 Howard Chu, Symas Corp. All rights reserved. * @copyright Copyright 2011-2018 Howard Chu, Symas Corp. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted only as authorized by the OpenLDAP * modification, are permitted only as authorized by the OpenLDAP

View File

@ -5,7 +5,7 @@
* BerkeleyDB API, but much simplified. * BerkeleyDB API, but much simplified.
*/ */
/* /*
* Copyright 2011-2017 Howard Chu, Symas Corp. * Copyright 2011-2018 Howard Chu, Symas Corp.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -48,29 +48,35 @@
* the full size. These APIs are defined in <wdm.h> and <ntifs.h> * the full size. These APIs are defined in <wdm.h> and <ntifs.h>
* but those headers are meant for driver-level development and * but those headers are meant for driver-level development and
* conflict with the regular user-level headers, so we explicitly * conflict with the regular user-level headers, so we explicitly
* declare them here. Using these APIs also means we must link to * declare them here. We get pointers to these functions from
* ntdll.dll, which is not linked by default in user code. * NTDLL.DLL at runtime, to avoid buildtime dependencies on any
* NTDLL import libraries.
*/ */
NTSTATUS WINAPI typedef NTSTATUS WINAPI (NtCreateSectionFunc)
NtCreateSection(OUT PHANDLE sh, IN ACCESS_MASK acc, (OUT PHANDLE sh, IN ACCESS_MASK acc,
IN void * oa OPTIONAL, IN void * oa OPTIONAL,
IN PLARGE_INTEGER ms OPTIONAL, IN PLARGE_INTEGER ms OPTIONAL,
IN ULONG pp, IN ULONG aa, IN HANDLE fh OPTIONAL); IN ULONG pp, IN ULONG aa, IN HANDLE fh OPTIONAL);
static NtCreateSectionFunc *NtCreateSection;
typedef enum _SECTION_INHERIT { typedef enum _SECTION_INHERIT {
ViewShare = 1, ViewShare = 1,
ViewUnmap = 2 ViewUnmap = 2
} SECTION_INHERIT; } SECTION_INHERIT;
NTSTATUS WINAPI typedef NTSTATUS WINAPI (NtMapViewOfSectionFunc)
NtMapViewOfSection(IN PHANDLE sh, IN HANDLE ph, (IN PHANDLE sh, IN HANDLE ph,
IN OUT PVOID *addr, IN ULONG_PTR zbits, IN OUT PVOID *addr, IN ULONG_PTR zbits,
IN SIZE_T cs, IN OUT PLARGE_INTEGER off OPTIONAL, IN SIZE_T cs, IN OUT PLARGE_INTEGER off OPTIONAL,
IN OUT PSIZE_T vs, IN SECTION_INHERIT ih, IN OUT PSIZE_T vs, IN SECTION_INHERIT ih,
IN ULONG at, IN ULONG pp); IN ULONG at, IN ULONG pp);
NTSTATUS WINAPI static NtMapViewOfSectionFunc *NtMapViewOfSection;
NtClose(HANDLE h);
typedef NTSTATUS WINAPI (NtCloseFunc)(HANDLE h);
static NtCloseFunc *NtClose;
/** 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
@ -4690,6 +4696,21 @@ mdb_env_open2(MDB_env *env, int prev)
env->me_pidquery = MDB_PROCESS_QUERY_LIMITED_INFORMATION; env->me_pidquery = MDB_PROCESS_QUERY_LIMITED_INFORMATION;
else else
env->me_pidquery = PROCESS_QUERY_INFORMATION; env->me_pidquery = PROCESS_QUERY_INFORMATION;
/* Grab functions we need from NTDLL */
if (!NtCreateSection) {
HMODULE h = GetModuleHandle("NTDLL.DLL");
if (!h)
return MDB_PROBLEM;
NtClose = (NtCloseFunc *)GetProcAddress(h, "NtClose");
if (!NtClose)
return MDB_PROBLEM;
NtMapViewOfSection = (NtMapViewOfSectionFunc *)GetProcAddress(h, "NtMapViewOfSection");
if (!NtMapViewOfSection)
return MDB_PROBLEM;
NtCreateSection = (NtCreateSectionFunc *)GetProcAddress(h, "NtCreateSection");
if (!NtCreateSection)
return MDB_PROBLEM;
}
#endif /* _WIN32 */ #endif /* _WIN32 */
#ifdef BROKEN_FDATASYNC #ifdef BROKEN_FDATASYNC
@ -5553,7 +5574,7 @@ mdb_env_close0(MDB_env *env, int excl)
if (env->me_fd != INVALID_HANDLE_VALUE) if (env->me_fd != INVALID_HANDLE_VALUE)
(void) close(env->me_fd); (void) close(env->me_fd);
if (env->me_txns) { if (env->me_txns) {
MDB_PID_T pid = env->me_pid; MDB_PID_T pid = getpid();
/* Clearing readers is done in this function because /* Clearing readers is done in this function because
* me_txkey with its destructor must be disabled first. * me_txkey with its destructor must be disabled first.
* *
@ -7648,8 +7669,9 @@ prep_subDB:
} else { } else {
memcpy((char *)mp + mp->mp_upper + PAGEBASE, (char *)fp + fp->mp_upper + PAGEBASE, memcpy((char *)mp + mp->mp_upper + PAGEBASE, (char *)fp + fp->mp_upper + PAGEBASE,
olddata.mv_size - fp->mp_upper - PAGEBASE); olddata.mv_size - fp->mp_upper - PAGEBASE);
memcpy((char *)(&mp->mp_ptrs), (char *)(&fp->mp_ptrs), NUMKEYS(fp) * sizeof(mp->mp_ptrs[0]));
for (i=0; i<NUMKEYS(fp); i++) for (i=0; i<NUMKEYS(fp); i++)
mp->mp_ptrs[i] = fp->mp_ptrs[i] + offset; mp->mp_ptrs[i] += offset;
} }
} }

View File

@ -3,8 +3,8 @@
/* $OpenLDAP$ */ /* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
* *
* Copyright 2000-2016 The OpenLDAP Foundation. * Copyright 2000-2018 The OpenLDAP Foundation.
* Portions Copyright 2001-2017 Howard Chu, Symas Corp. * Portions Copyright 2001-2018 Howard Chu, Symas Corp.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without

View File

@ -11,8 +11,8 @@
/* $OpenLDAP$ */ /* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
* *
* Copyright 2000-2016 The OpenLDAP Foundation. * Copyright 2000-2018 The OpenLDAP Foundation.
* Portions Copyright 2001-2017 Howard Chu, Symas Corp. * Portions Copyright 2001-2018 Howard Chu, Symas Corp.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without