]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix statistics for x86 Windows builds
authorMichał Kępień <michal@isc.org>
Fri, 7 Jun 2019 13:21:43 +0000 (15:21 +0200)
committerOndřej Surý <ondrej@sury.org>
Thu, 20 Jun 2019 16:34:27 +0000 (18:34 +0200)
Using atomic_int_fast64_t variables with atomic functions on x86 does
not cause Visual Studio to report build errors, but such operations
yield useless results.  Since the isc_stat_t type is unconditionally
typedef'd to atomic_int_fast64_t, any code performing atomic operations
on isc_stat_t variables is broken in x86 Windows builds.  Fix by using
the atomic_int_fast32_t type for isc_stat_t in x86 Windows builds.

(cherry picked from commit e21103f2d37d339886b09387b08239c838d50ef1)

doc/arm/Bv9ARM-book.xml
lib/isc/stats.c

index d012f4c97b4f8b18f6ec917d2d611ff3382923e2..d2e672d431cbbacd6eaf80d671cc2167f18e96ee 100644 (file)
@@ -15358,6 +15358,15 @@ HOST-127.EXAMPLE. MX 0 .
            <acronym>BIND</acronym> 8 statistics, if applicable.
          </para>
 
+         <para>
+           Note: BIND statistics counters are signed 64-bit values on
+           all platforms except one: 32-bit Windows, where they are
+           signed 32-bit values.  Given that 32-bit values have a
+           vastly smaller range than 64-bit values, BIND statistics
+           counters in 32-bit Windows builds overflow significantly
+           more quickly than on all other platforms.
+         </para>
+
          <section xml:id="stats_counters"><info><title>Name Server Statistics Counters</title></info>
 
            <informaltable colsep="0" rowsep="0">
index bbdb1f91ead2ab7d81593c6b7904f92f4112650e..9a0e2f10ed780bfa177c8faf078e31e0e5d1c47e 100644 (file)
 #define ISC_STATS_MAGIC                        ISC_MAGIC('S', 't', 'a', 't')
 #define ISC_STATS_VALID(x)             ISC_MAGIC_VALID(x, ISC_STATS_MAGIC)
 
+#if defined(_WIN32) && !defined(_WIN64)
+typedef atomic_int_fast32_t isc_stat_t;
+#else
 typedef atomic_int_fast64_t isc_stat_t;
+#endif
 
 struct isc_stats {
        unsigned int            magic;