Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Berkeley DB 4.8 patch for compilers that have __atomic_compare_exchange.
Binary files dbxml-2.5.16.orig/db-4.8.26/dbinc/.atomic.h.un~ and dbxml-2.5.16/db-4.8.26/dbinc/.atomic.h.un~ differ
diff -ruN dbxml-2.5.16.orig/db-4.8.26/dbinc/atomic.h dbxml-2.5.16/db-4.8.26/dbinc/atomic.h
--- dbxml-2.5.16.orig/db-4.8.26/dbinc/atomic.h 2013-06-03 21:04:07.000000000 +0200
+++ dbxml-2.5.16/db-4.8.26/dbinc/atomic.h 2013-06-03 21:10:53.000000000 +0200
@@ -144,7 +144,7 @@
#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))
+ __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;
@pakaplace

This comment has been minimized.

Copy link

@pakaplace pakaplace commented Sep 18, 2017

How do I apply this patch?

@jmjatlanta

This comment has been minimized.

Copy link

@jmjatlanta jmjatlanta commented Jan 4, 2019

How do I apply this patch?

Navigate to the file atomic.h that is in the dbinc directory. Somewhere around line 147, you will see _atomic_compare_exchange((p), (o), (n)) (as in line 9 above). Change that line to be __atomic_compare_exchange_db((p), (o), (n)). You are just adding a _db at the end of the function name.

You will also do something simolar around line 179. After that, re-run make to build Berkeley DB 4.8.

@Koff

This comment has been minimized.

Copy link

@Koff Koff commented Jan 24, 2020

You can just run sed -i 's/__atomic_compare_exchange/__atomic_compare_exchange_db/g' db-4.8.30.NC/dbinc/atomic.h

@danieldk

This comment has been minimized.

Copy link
Owner Author

@danieldk danieldk commented Jan 25, 2020

...or just use patch. From the main dbxml directory:

patch -p1 < gistfile1.txt 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment