From 49e45ab3adc2f5bff3683c9eeff6f92d71bd5ab3 Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Thu, 29 Oct 2020 19:30:31 +0100 Subject: [PATCH 1/1] - compilation fix --- db5.3-atomic_compare_exchange.patch | 151 ++++++++++++++++++++++++++++ db5.3.spec | 2 + 2 files changed, 153 insertions(+) create mode 100644 db5.3-atomic_compare_exchange.patch diff --git a/db5.3-atomic_compare_exchange.patch b/db5.3-atomic_compare_exchange.patch new file mode 100644 index 0000000..6bbc582 --- /dev/null +++ b/db5.3-atomic_compare_exchange.patch @@ -0,0 +1,151 @@ +diff -ur db-5.3.28.orig/src/dbinc/atomic.h db-5.3.28/src/dbinc/atomic.h +--- db-5.3.28.orig/src/dbinc/atomic.h 2013-09-09 17:35:08.000000000 +0200 ++++ db-5.3.28/src/dbinc/atomic.h 2020-10-29 19:09:22.546238669 +0100 +@@ -25,7 +25,7 @@ + * atomic_dec(env, valueptr) + * Subtracts 1 from the db_atomic_t value, returning the new value. + * +- * atomic_compare_exchange(env, valueptr, oldval, newval) ++ * atomic_compare_exchange_db(env, valueptr, oldval, newval) + * If the db_atomic_t's value is still oldval, set it to newval. + * It returns 1 for success or 0 for failure. + * +@@ -115,12 +115,12 @@ + (WINCE_ATOMIC_MAGIC(p), \ + InterlockedDecrement((interlocked_val)(&(p)->value))) + #if defined(_MSC_VER) && _MSC_VER < 1300 +-#define atomic_compare_exchange(env, p, oldval, newval) \ ++#define atomic_compare_exchange_db(env, p, oldval, newval) \ + (WINCE_ATOMIC_MAGIC(p), \ + (InterlockedCompareExchange((PVOID *)(&(p)->value), \ + (PVOID)(newval), (PVOID)(oldval)) == (PVOID)(oldval))) + #else +-#define atomic_compare_exchange(env, p, oldval, newval) \ ++#define atomic_compare_exchange_db(env, p, oldval, newval) \ + (WINCE_ATOMIC_MAGIC(p), \ + (InterlockedCompareExchange((interlocked_val)(&(p)->value), \ + (newval), (oldval)) == (oldval))) +@@ -134,7 +134,7 @@ + atomic_inc_uint_nv((volatile unsigned int *) &(p)->value) + #define atomic_dec(env, p) \ + atomic_dec_uint_nv((volatile unsigned int *) &(p)->value) +-#define atomic_compare_exchange(env, p, oval, nval) \ ++#define atomic_compare_exchange_db(env, p, oval, nval) \ + (atomic_cas_32((volatile unsigned int *) &(p)->value, \ + (oval), (nval)) == (oval)) + #endif +@@ -143,8 +143,8 @@ + /* x86/x86_64 gcc */ + #define atomic_inc(env, p) __atomic_inc(p) + #define atomic_dec(env, p) __atomic_dec(p) +-#define atomic_compare_exchange(env, p, o, n) \ +- __atomic_compare_exchange((p), (o), (n)) ++#define atomic_compare_exchange_db(env, p, o, n) \ ++ __atomic_compare_exchange_db((p), (o), (n)) + static inline int __atomic_inc(db_atomic_t *p) + { + int temp; +@@ -176,7 +176,7 @@ + * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html + * which configure could be changed to use. + */ +-static inline int __atomic_compare_exchange( ++static inline int __atomic_compare_exchange_db( + db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval) + { + atomic_value_t was; +@@ -204,7 +204,7 @@ + */ + #define atomic_inc(env, p) (++(p)->value) + #define atomic_dec(env, p) (--(p)->value) +-#define atomic_compare_exchange(env, p, oldval, newval) \ ++#define atomic_compare_exchange_db(env, p, oldval, newval) \ + (DB_ASSERT(env, atomic_read(p) == (oldval)), \ + atomic_init(p, (newval)), 1) + #else +diff -ur db-5.3.28.orig/src/dbinc/mutex_int.h db-5.3.28/src/dbinc/mutex_int.h +--- db-5.3.28.orig/src/dbinc/mutex_int.h 2013-09-09 17:35:08.000000000 +0200 ++++ db-5.3.28/src/dbinc/mutex_int.h 2020-10-29 19:09:29.846238669 +0100 +@@ -1050,7 +1050,7 @@ + */ + #define MUTEXP_ACQUIRE(mutexp) \ + (F_ISSET(mutexp, DB_MUTEX_SHARED) ? \ +- atomic_compare_exchange(env, \ ++ atomic_compare_exchange_db(env, \ + &(mutexp)->sharecount, 0, MUTEX_SHARE_ISEXCLUSIVE) : \ + MUTEX_SET(&(mutexp)->tas)) + #else +diff -ur db-5.3.28.orig/src/dbinc_auto/int_def.in db-5.3.28/src/dbinc_auto/int_def.in +--- db-5.3.28.orig/src/dbinc_auto/int_def.in 2013-09-09 17:35:08.000000000 +0200 ++++ db-5.3.28/src/dbinc_auto/int_def.in 2020-10-29 19:09:56.642238669 +0100 +@@ -1488,7 +1488,7 @@ + #define __atomic_dec __atomic_dec@DB_VERSION_UNIQUE_NAME@ + #endif + #if !defined(HAVE_ATOMIC_SUPPORT) && defined(HAVE_MUTEX_SUPPORT) +-#define atomic_compare_exchange atomic_compare_exchange@DB_VERSION_UNIQUE_NAME@ ++#define atomic_compare_exchange_db atomic_compare_exchange_db@DB_VERSION_UNIQUE_NAME@ + #endif + #define __db_pthread_mutex_init __db_pthread_mutex_init@DB_VERSION_UNIQUE_NAME@ + #ifndef HAVE_MUTEX_HYBRID +diff -ur db-5.3.28.orig/src/dbinc_auto/mutex_ext.h db-5.3.28/src/dbinc_auto/mutex_ext.h +--- db-5.3.28.orig/src/dbinc_auto/mutex_ext.h 2013-09-09 17:35:08.000000000 +0200 ++++ db-5.3.28/src/dbinc_auto/mutex_ext.h 2020-10-29 19:10:00.649238669 +0100 +@@ -38,7 +38,7 @@ + atomic_value_t __atomic_dec __P((ENV *, db_atomic_t *)); + #endif + #if !defined(HAVE_ATOMIC_SUPPORT) && defined(HAVE_MUTEX_SUPPORT) +-int atomic_compare_exchange __P((ENV *, db_atomic_t *, atomic_value_t, atomic_value_t)); ++int atomic_compare_exchange_db __P((ENV *, db_atomic_t *, atomic_value_t, atomic_value_t)); + #endif + int __db_pthread_mutex_init __P((ENV *, db_mutex_t, u_int32_t)); + #ifndef HAVE_MUTEX_HYBRID +diff -ur db-5.3.28.orig/src/mutex/mut_method.c db-5.3.28/src/mutex/mut_method.c +--- db-5.3.28.orig/src/mutex/mut_method.c 2013-09-09 17:35:09.000000000 +0200 ++++ db-5.3.28/src/mutex/mut_method.c 2020-10-29 19:09:45.172238669 +0100 +@@ -445,11 +445,11 @@ + } + + /* +- * atomic_compare_exchange ++ * atomic_compare_exchange_db + * Use a mutex to provide an atomic decrement function + * + * PUBLIC: #if !defined(HAVE_ATOMIC_SUPPORT) && defined(HAVE_MUTEX_SUPPORT) +- * PUBLIC: int atomic_compare_exchange ++ * PUBLIC: int atomic_compare_exchange_db + * PUBLIC: __P((ENV *, db_atomic_t *, atomic_value_t, atomic_value_t)); + * PUBLIC: #endif + * Returns 1 if the *v was equal to oldval, else 0 +@@ -458,7 +458,7 @@ + * Sets the value to newval if and only if returning 1 + */ + int +-atomic_compare_exchange(env, v, oldval, newval) ++atomic_compare_exchange_db(env, v, oldval, newval) + ENV *env; + db_atomic_t *v; + atomic_value_t oldval; +diff -ur db-5.3.28.orig/src/mutex/mut_tas.c db-5.3.28/src/mutex/mut_tas.c +--- db-5.3.28.orig/src/mutex/mut_tas.c 2013-09-09 17:35:09.000000000 +0200 ++++ db-5.3.28/src/mutex/mut_tas.c 2020-10-29 19:09:40.046238669 +0100 +@@ -366,7 +366,7 @@ + mtxregion->stat.st_mutex_tas_spins; nspins > 0; --nspins) { + lock = atomic_read(&mutexp->sharecount); + if (lock == MUTEX_SHARE_ISEXCLUSIVE || +- !atomic_compare_exchange(env, ++ !atomic_compare_exchange_db(env, + &mutexp->sharecount, lock, lock + 1)) { + /* + * Some systems (notably those with newer Intel CPUs) +diff -ur db-5.3.28.orig/src/mutex/mut_win32.c db-5.3.28/src/mutex/mut_win32.c +--- db-5.3.28.orig/src/mutex/mut_win32.c 2013-09-09 17:35:09.000000000 +0200 ++++ db-5.3.28/src/mutex/mut_win32.c 2020-10-29 19:09:51.148238669 +0100 +@@ -361,7 +361,7 @@ + return (DB_LOCK_NOTGRANTED); + + continue; +- } else if (!atomic_compare_exchange(env, &mutexp->sharecount, ++ } else if (!atomic_compare_exchange_db(env, &mutexp->sharecount, + mtx_val, mtx_val + 1)) { + /* + * Some systems (notably those with newer Intel CPUs) diff --git a/db5.3.spec b/db5.3.spec index b53e435..0f92ab8 100644 --- a/db5.3.spec +++ b/db5.3.spec @@ -26,6 +26,7 @@ Source0: http://download.oracle.com/berkeley-db/db-%{ver}.tar.gz Patch0: %{name}-link.patch Patch1: %{name}-sql-features.patch Patch2: db-5.3.28-cwd-db_config.patch +Patch3: %{name}-atomic_compare_exchange.patch URL: http://www.oracle.com/technetwork/products/berkeleydb/downloads/index.html BuildRequires: automake %if %{with java} @@ -374,6 +375,7 @@ poleceń. %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 %build cp -f /usr/share/automake/config.sub dist -- 2.44.0