Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Use sysconf(_SC_NPROCESSORS_CONF) in PAL_GetLogicalCpuCountFromOS #18053

Merged
merged 2 commits into from
May 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/gc/unix/gcenv.unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/pal/src/misc/sysinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down