From: Ondřej Surý Date: Sat, 22 Jan 2022 15:59:50 +0000 (+0100) Subject: Ignore the invalid L1 cache line size returned by sysconf() X-Git-Tag: v9.18.0~3^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b28327354da285319935a86f873043e4250c91db;p=thirdparty%2Fbind9.git Ignore the invalid L1 cache line size returned by sysconf() 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. --- diff --git a/lib/isc/os.c b/lib/isc/os.c index 2bb7dc2158b..9e2b08ce16f 100644 --- a/lib/isc/os.c +++ b/lib/isc/os.c @@ -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 }