glibc-2.2.3 alphaev6 sysconf(_SC_NPROCESSORS_CONF) returns 0

Ken Whaley ken@believe.com
Fri Jun 15 18:57:00 GMT 2001


glibc-2.2.3 sysconf(_SC_NPROCESSORS_CONF) returns 0 on my system.
Admittedly, my system is broken, since my /proc/cpuinfo includes:
cpus detected          : 0
So, you could make a case that glibc-2.2.3 is correctly returning what my
system is reporting.

However, glibc-2.1.3's sysconf(_SC_NPROCESSORS_CONF) on this same 
system returns 1.  Since if sysconf is able to run at all, there must
be at least 1 cpu running, one could make a case that it should always
return at least 1.

The routines in question are sysdeps/unix/sysv/linux/getsysstats.c:
__get_nproc() and __get_nproc_conf().   I replaced "return result"
with  "return (result == 0) ? 1 : result;"

Ken



More information about the Libc-alpha mailing list