From a1ad8f220e60117503451fb0dcd5495822d89477 Mon Sep 17 00:00:00 2001 From: Egor Chesakov Date: Fri, 18 May 2018 15:03:00 -0700 Subject: [PATCH 1/2] Use sysconf(_SC_NPROCESSORS_CONF) instead of sysconf(_SC_NPROCESSORS_ONLN) in PAL --- src/pal/src/misc/sysinfo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pal/src/misc/sysinfo.cpp b/src/pal/src/misc/sysinfo.cpp index bc55dadd4b14..18403f00ed69 100644 --- a/src/pal/src/misc/sysinfo.cpp +++ b/src/pal/src/misc/sysinfo.cpp @@ -103,10 +103,10 @@ PAL_GetLogicalCpuCountFromOS() int nrcpus = 0; #if HAVE_SYSCONF - nrcpus = sysconf(_SC_NPROCESSORS_ONLN); + nrcpus = sysconf(_SC_NPROCESSORS_CONF); if (nrcpus < 1) { - ASSERT("sysconf failed for _SC_NPROCESSORS_ONLN (%d)\n", errno); + ASSERT("sysconf failed for _SC_NPROCESSORS_CONF (%d)\n", errno); } #elif HAVE_SYSCTL int rc; From 0c2dc2bb45fdfe67ef10aa8e1bd4c63dfb28cff8 Mon Sep 17 00:00:00 2001 From: Egor Chesakov Date: Fri, 18 May 2018 16:56:15 -0700 Subject: [PATCH 2/2] Use sysconf(_SC_NPROCESSORS_CONF) in GCToOSInterface::Initialize --- src/gc/unix/gcenv.unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gc/unix/gcenv.unix.cpp b/src/gc/unix/gcenv.unix.cpp index 737c5efcf032..fe7543dd3133 100644 --- a/src/gc/unix/gcenv.unix.cpp +++ b/src/gc/unix/gcenv.unix.cpp @@ -67,7 +67,7 @@ bool GCToOSInterface::Initialize() g_pageSizeUnixInl = uint32_t((pageSize > 0) ? pageSize : 0x1000); // Calculate and cache the number of processors on this machine - int cpuCount = sysconf(_SC_NPROCESSORS_ONLN); + int cpuCount = sysconf(_SC_NPROCESSORS_CONF); if (cpuCount == -1) { return false;