Hi Leo,

The attached patch could help.

Daniel

On 2017-02-07 13:14, Leo Vandewoestijne wrote:
Hi,


I tried to install knot 2.4.0 on FreeBSD 10.3 & 11.0.
On amd64 these complete fine, however on i386 they don't:

https://dns.company/downloads/knot2/knot2-2.4.0_103i386.log
https://dns.company/downloads/knot2/knot2-2.4.0_110i386.log

Is there anything I can do better to prevent this?
diff --git a/src/knot/nameserver/query_module.h 
b/src/knot/nameserver/query_module.h
index a8e8c41..2b47798 100644
--- a/src/knot/nameserver/query_module.h
+++ b/src/knot/nameserver/query_module.h
@@ -133,7 +133,7 @@ inline static void mod_ctr_incr(mod_ctr_t *stats, uint32_t 
idx, uint64_t val)
        mod_ctr_t *ctr = stats + idx;
        assert(ctr->count == 1);
 
-       __atomic_add_fetch(&ctr->counter, val, __ATOMIC_RELAXED);
+       __sync_fetch_and_add(&ctr->counter, val);
 }
 
 inline static void mod_ctr_decr(mod_ctr_t *stats, uint32_t idx, uint64_t val)
@@ -141,7 +141,7 @@ inline static void mod_ctr_decr(mod_ctr_t *stats, uint32_t 
idx, uint64_t val)
        mod_ctr_t *ctr = stats + idx;
        assert(ctr->count == 1);
 
-       __atomic_sub_fetch(&ctr->counter, val, __ATOMIC_RELAXED);
+       __sync_fetch_and_sub(&ctr->counter, val);
 }
 
 inline static void mod_ctrs_incr(mod_ctr_t *stats, uint32_t idx, uint32_t 
offset, uint64_t val)
@@ -151,9 +151,9 @@ inline static void mod_ctrs_incr(mod_ctr_t *stats, uint32_t 
idx, uint32_t offset
 
        // Increment the last counter if offset overflows.
        if (offset < ctr->count) {
-               __atomic_add_fetch(&ctr->counters[offset], val, 
__ATOMIC_RELAXED);
+               __sync_fetch_and_add(&ctr->counters[offset], val);
        } else {
-               __atomic_add_fetch(&ctr->counters[ctr->count - 1], val, 
__ATOMIC_RELAXED);
+               __sync_fetch_and_add(&ctr->counters[ctr->count - 1], val);
        }
 }
 
@@ -164,9 +164,9 @@ inline static void mod_ctrs_decr(mod_ctr_t *stats, uint32_t 
idx, uint32_t offset
 
        // Increment the last counter if offset overflows.
        if (offset < ctr->count) {
-               __atomic_sub_fetch(&ctr->counters[offset], val, 
__ATOMIC_RELAXED);
+               __sync_fetch_and_sub(&ctr->counters[offset], val);
        } else {
-               __atomic_sub_fetch(&ctr->counters[ctr->count - 1], val, 
__ATOMIC_RELAXED);
+               __sync_fetch_and_sub(&ctr->counters[ctr->count - 1], val);
        }
 }
 
_______________________________________________
knot-dns-users mailing list
[email protected]
https://lists.nic.cz/cgi-bin/mailman/listinfo/knot-dns-users

Reply via email to