This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
glibc-2.2.3 alphaev6 sysconf(_SC_NPROCESSORS_CONF) returns 0
- To: "GNU C Library" <libc-alpha at sourceware dot cygnus dot com>
- Subject: glibc-2.2.3 alphaev6 sysconf(_SC_NPROCESSORS_CONF) returns 0
- From: "Ken Whaley" <ken at believe dot com>
- Date: Fri, 15 Jun 2001 19:00:34 -0700
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