Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1diff --git a/dbinc/atomic.h b/dbinc/atomic.h 2index 0034dcc..160c8ea 100644 3--- a/dbinc/atomic.h 4+++ b/dbinc/atomic.h 5@@ -70,7 +70,7 @@ typedef struct { 6 * These have no memory barriers; the caller must include them when necessary. 7 */ 8 #define atomic_read(p) ((p)->value) 9-#define atomic_init(p, val) ((p)->value = (val)) 10+#define atomic_init_db(p, val) ((p)->value = (val)) 11 12 #ifdef HAVE_ATOMIC_SUPPORT 13 14@@ -144,7 +144,7 @@ typedef LONG volatile *interlocked_val; 15 #define atomic_inc(env, p) __atomic_inc(p) 16 #define atomic_dec(env, p) __atomic_dec(p) 17 #define atomic_compare_exchange(env, p, o, n) \ 18- __atomic_compare_exchange((p), (o), (n)) 19+ __atomic_compare_exchange_int((p), (o), (n)) 20 static inline int __atomic_inc(db_atomic_t *p) 21 { 22 int temp; 23@@ -176,7 +176,7 @@ static inline int __atomic_dec(db_atomic_t *p) 24 * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html 25 * which configure could be changed to use. 26 */ 27-static inline int __atomic_compare_exchange( 28+static inline int __atomic_compare_exchange_int( 29 db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval) 30 { 31 atomic_value_t was; 32@@ -206,7 +206,7 @@ static inline int __atomic_compare_exchange( 33 #define atomic_dec(env, p) (--(p)->value) 34 #define atomic_compare_exchange(env, p, oldval, newval) \ 35 (DB_ASSERT(env, atomic_read(p) == (oldval)), \ 36- atomic_init(p, (newval)), 1) 37+ atomic_init_db(p, (newval)), 1) 38 #else 39 #define atomic_inc(env, p) __atomic_inc(env, p) 40 #define atomic_dec(env, p) __atomic_dec(env, p) 41diff --git a/mp/mp_fget.c b/mp/mp_fget.c 42index 5fdee5a..0b75f57 100644 43--- a/mp/mp_fget.c 44+++ b/mp/mp_fget.c 45@@ -617,7 +617,7 @@ alloc: /* Allocate a new buffer header and data space. */ 46 47 /* Initialize enough so we can call __memp_bhfree. */ 48 alloc_bhp->flags = 0; 49- atomic_init(&alloc_bhp->ref, 1); 50+ atomic_init_db(&alloc_bhp->ref, 1); 51 #ifdef DIAGNOSTIC 52 if ((uintptr_t)alloc_bhp->buf & (sizeof(size_t) - 1)) { 53 __db_errx(env, 54@@ -911,7 +911,7 @@ alloc: /* Allocate a new buffer header and data space. */ 55 MVCC_MPROTECT(bhp->buf, mfp->stat.st_pagesize, 56 PROT_READ); 57 58- atomic_init(&alloc_bhp->ref, 1); 59+ atomic_init_db(&alloc_bhp->ref, 1); 60 MUTEX_LOCK(env, alloc_bhp->mtx_buf); 61 alloc_bhp->priority = bhp->priority; 62 alloc_bhp->pgno = bhp->pgno; 63diff --git a/mp/mp_mvcc.c b/mp/mp_mvcc.c 64index 34467d2..f05aa0c 100644 65--- a/mp/mp_mvcc.c 66+++ b/mp/mp_mvcc.c 67@@ -276,7 +276,7 @@ __memp_bh_freeze(dbmp, infop, hp, bhp, need_frozenp) 68 #else 69 memcpy(frozen_bhp, bhp, SSZA(BH, buf)); 70 #endif 71- atomic_init(&frozen_bhp->ref, 0); 72+ atomic_init_db(&frozen_bhp->ref, 0); 73 if (mutex != MUTEX_INVALID) 74 frozen_bhp->mtx_buf = mutex; 75 else if ((ret = __mutex_alloc(env, MTX_MPOOL_BH, 76@@ -428,7 +428,7 @@ __memp_bh_thaw(dbmp, infop, hp, frozen_bhp, alloc_bhp) 77 #endif 78 alloc_bhp->mtx_buf = mutex; 79 MUTEX_LOCK(env, alloc_bhp->mtx_buf); 80- atomic_init(&alloc_bhp->ref, 1); 81+ atomic_init_db(&alloc_bhp->ref, 1); 82 F_CLR(alloc_bhp, BH_FROZEN); 83 } 84 85diff --git a/mp/mp_region.c b/mp/mp_region.c 86index e6cece9..ddbe906 100644 87--- a/mp/mp_region.c 88+++ b/mp/mp_region.c 89@@ -224,7 +224,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg) 90 MTX_MPOOL_FILE_BUCKET, 0, &htab[i].mtx_hash)) != 0) 91 return (ret); 92 SH_TAILQ_INIT(&htab[i].hash_bucket); 93- atomic_init(&htab[i].hash_page_dirty, 0); 94+ atomic_init_db(&htab[i].hash_page_dirty, 0); 95 } 96 97 /* 98@@ -269,7 +269,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg) 99 hp->mtx_hash = (mtx_base == MUTEX_INVALID) ? MUTEX_INVALID : 100 mtx_base + i; 101 SH_TAILQ_INIT(&hp->hash_bucket); 102- atomic_init(&hp->hash_page_dirty, 0); 103+ atomic_init_db(&hp->hash_page_dirty, 0); 104 #ifdef HAVE_STATISTICS 105 hp->hash_io_wait = 0; 106 hp->hash_frozen = hp->hash_thawed = hp->hash_frozen_freed = 0; 107diff --git a/mutex/mut_method.c b/mutex/mut_method.c 108index 2588763..5c6d516 100644 109--- a/mutex/mut_method.c 110+++ b/mutex/mut_method.c 111@@ -426,7 +426,7 @@ atomic_compare_exchange(env, v, oldval, newval) 112 MUTEX_LOCK(env, mtx); 113 ret = atomic_read(v) == oldval; 114 if (ret) 115- atomic_init(v, newval); 116+ atomic_init_db(v, newval); 117 MUTEX_UNLOCK(env, mtx); 118 119 return (ret); 120diff --git a/mutex/mut_tas.c b/mutex/mut_tas.c 121index f3922e0..e40fcdf 100644 122--- a/mutex/mut_tas.c 123+++ b/mutex/mut_tas.c 124@@ -46,7 +46,7 @@ __db_tas_mutex_init(env, mutex, flags) 125 126 #ifdef HAVE_SHARED_LATCHES 127 if (F_ISSET(mutexp, DB_MUTEX_SHARED)) 128- atomic_init(&mutexp->sharecount, 0); 129+ atomic_init_db(&mutexp->sharecount, 0); 130 else 131 #endif 132 if (MUTEX_INIT(&mutexp->tas)) { 133@@ -486,7 +486,7 @@ __db_tas_mutex_unlock(env, mutex) 134 F_CLR(mutexp, DB_MUTEX_LOCKED); 135 /* Flush flag update before zeroing count */ 136 MEMBAR_EXIT(); 137- atomic_init(&mutexp->sharecount, 0); 138+ atomic_init_db(&mutexp->sharecount, 0); 139 } else { 140 DB_ASSERT(env, sharecount > 0); 141 MEMBAR_EXIT(); 142diff -ur a/dist/aclocal/clock.m4 b/dist/aclocal/clock.m4 143--- a/dist/aclocal/clock.m4 1969-12-31 19:00:01.000000000 -0500 144+++ b/dist/aclocal/clock.m4 2023-06-05 19:14:02.007080500 -0400 145@@ -21,6 +21,7 @@ 146 AC_CACHE_CHECK([for clock_gettime monotonic clock], db_cv_clock_monotonic, [ 147 AC_TRY_RUN([ 148 #include <sys/time.h> 149+int 150 main() { 151 struct timespec t; 152 return (clock_gettime(CLOCK_MONOTONIC, &t) != 0); 153diff -ur a/dist/aclocal/mutex.m4 b/dist/aclocal/mutex.m4 154--- a/dist/aclocal/mutex.m4 1969-12-31 19:00:01.000000000 -0500 155+++ b/dist/aclocal/mutex.m4 2023-06-05 19:14:47.214158196 -0400 156@@ -3,7 +3,9 @@ 157 # POSIX pthreads tests: inter-process safe and intra-process only. 158 AC_DEFUN(AM_PTHREADS_SHARED, [ 159 AC_TRY_RUN([ 160+#include <stdlib.h> 161 #include <pthread.h> 162+int 163 main() { 164 pthread_cond_t cond; 165 pthread_mutex_t mutex; 166@@ -24,6 +26,7 @@ main() { 167 pthread_mutexattr_destroy(&mutexattr)); 168 }], [db_cv_mutex="$1"],, 169 AC_TRY_LINK([ 170+#include <stdlib.h> 171 #include <pthread.h>],[ 172 pthread_cond_t cond; 173 pthread_mutex_t mutex; 174@@ -45,7 +48,9 @@ AC_TRY_LINK([ 175 ], [db_cv_mutex="$1"]))]) 176 AC_DEFUN(AM_PTHREADS_PRIVATE, [ 177 AC_TRY_RUN([ 178+#include <stdlib.h> 179 #include <pthread.h> 180+int 181 main() { 182 pthread_cond_t cond; 183 pthread_mutex_t mutex; 184@@ -64,6 +69,7 @@ main() { 185 pthread_mutexattr_destroy(&mutexattr)); 186 }], [db_cv_mutex="$1"],, 187 AC_TRY_LINK([ 188+#include <stdlib.h> 189 #include <pthread.h>],[ 190 pthread_cond_t cond; 191 pthread_mutex_t mutex; 192diff -ur a/dist/aclocal/sequence.m4 b/dist/aclocal/sequence.m4 193--- a/dist/aclocal/sequence.m4 1969-12-31 19:00:01.000000000 -0500 194+++ b/dist/aclocal/sequence.m4 2023-06-05 19:14:02.007869956 -0400 195@@ -43,6 +43,9 @@ 196 # test, which won't test for the appropriate printf format strings. 197 if test "$db_cv_build_sequence" = "yes"; then 198 AC_TRY_RUN([ 199+ #include <string.h> 200+ #include <stdio.h> 201+ int 202 main() { 203 $db_cv_seq_type l; 204 unsigned $db_cv_seq_type u; 205@@ -59,7 +62,9 @@ 206 return (1); 207 return (0); 208 }],, [db_cv_build_sequence="no"], 209- AC_TRY_LINK(,[ 210+ AC_TRY_LINK([ 211+ #include <string.h> 212+ #include <stdio.h>],[ 213 $db_cv_seq_type l; 214 unsigned $db_cv_seq_type u; 215 char buf@<:@100@:>@; 216diff -ur a/dist/RELEASE b/dist/RELEASE 217--- a/dist/RELEASE 1969-12-31 19:00:01.000000000 -0500 218+++ b/dist/RELEASE 2023-07-02 17:32:34.703953049 -0400 219@@ -7,5 +7,5 @@ 220 221 DB_VERSION_UNIQUE_NAME=`printf "_%d%03d" $DB_VERSION_MAJOR $DB_VERSION_MINOR` 222 223-DB_RELEASE_DATE=`date "+%B %e, %Y"` 224+DB_RELEASE_DATE="April 9, 2010" 225 DB_VERSION_STRING="Berkeley DB $DB_VERSION: ($DB_RELEASE_DATE)"