2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-05 09:05:40 +00:00

Cache the isc_os_ncpu() result

It was discovered that on some platforms (f.e. Alpine Linux with MUSL)
the result of isc_os_ncpus() call differ when called before and after we
drop privileges.  This commit changes the isc_os_ncpus() call to cache
the result from the first call and thus always return the same value
during the runtime of the named.  The first call to isc_os_ncpus() is
made as soon as possible on the library initalization.
This commit is contained in:
Ondrej Sury
2021-07-12 14:21:21 +02:00
committed by Ondřej Surý
parent e04d69533d
commit 23751fe252
2 changed files with 18 additions and 6 deletions

View File

@@ -14,6 +14,7 @@
#include <isc/bind9.h>
#include <isc/lib.h>
#include <isc/mem.h>
#include <isc/os.h>
#include <isc/tls.h>
#include <isc/util.h>
@@ -45,6 +46,7 @@ isc__initialize(void) {
isc__mem_initialize();
isc__tls_initialize();
isc__trampoline_initialize();
(void)isc_os_ncpus();
}
void