]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Ignore the invalid L1 cache line size returned by sysconf()
authorOndřej Surý <ondrej@isc.org>
Sat, 22 Jan 2022 15:59:50 +0000 (16:59 +0100)
committerOndřej Surý <ondrej@isc.org>
Sat, 22 Jan 2022 15:59:50 +0000 (16:59 +0100)
On some systems, the glibc can return 0 instead of cache-line size to
indicate the cache line sizes cannot be determined.  This is comment
from glibc source code:

    /* In general we cannot determine these values.  Therefore we
       return zero which indicates that no information is
       available.  */

As the goal of the check is to determine whether the L1 cache line size
is still 64 and we would use this value in case the sysconf() call is
not available, we can also ignore the invalid values returned by the
sysconf() call.

lib/isc/os.c

index 2bb7dc2158be49f625729c7f4913e4baa3cd5214..9e2b08ce16f28567d90ab1872d87c67dd135030d 100644 (file)
@@ -81,7 +81,7 @@ isc__os_initialize(void) {
        ncpus_initialize();
 #if defined(HAVE_SYSCONF) && defined(_SC_LEVEL1_DCACHE_LINESIZE)
        long s = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
-       RUNTIME_CHECK((size_t)s == (size_t)ISC_OS_CACHELINE_SIZE);
+       RUNTIME_CHECK((size_t)s == (size_t)ISC_OS_CACHELINE_SIZE || s <= 0);
 #endif
 }