Closed jmalak closed 3 months ago
I add new implementation for sysconf(_SC_NPROCESSORS_CONF). It looks like correct value is only available in kernel, because there can be also some hot-plugin CPU's that this value is not static. Such kernel information is available by sysfs /sys/devices/system/cpu/present. New implementation check info in this file and get number of really available CPU's (including hot-plugin CPU's if it is used).
sysconf(_SC_NPROCESSORS_CONF)
andsysconf(_SC_NPROCESSORS_ONLN)
is same and is correct only forsysconf(_SC_NPROCESSORS_ONLN)
. POSIX define output for both asthe system call sched_getaffinity is used for both now, but value returned by it is valid only for
_SC_NPROCESSORS_ONLN
.It is necessary to design new processing for
_SC_NPROCESSORS_CONF
to get proper value which represent real CPU count.