Re: system call for finding the number of cpus??

Bernd Eckenfels (ecki-news2002-03@lina.inka.de)
Tue, 9 Apr 2002 07:36:48 +0200


In article <20020408221223.GE13043@werewolf.able.es> you wrote:
> On 2002.04.08 "Kuppuswamy, Priyadarshini" wrote:
>>I don't think that (sysconf(_SC_NPROCESSORS_CONF)) command works on linux. It works on Unix. I tried that. It returns 1 when there are 4 processors on linux.
>>

> Tried and works. get_nproc_conf and _SC_NPROCESSORS_CONF work the same.

Using "strace getconf _NPROCESSORS_CONF" it tells me, that glibc is also
parsing /proc/cpuinfo.

BTW: there are _NPROCESSORS_CONF and _NPROCESSORS_ONLN, works for me:

3ecki@calista:~> getconf _NPROCESSORS_CONF
1
3ecki@calista:~> getconf _NPROCESSORS_ONLN
1
ecki@SeeDeBrCVS:~$ getconf _NPROCESSORS_CONF
2
ecki@SeeDeBrCVS:~$ getconf _NPROCESSORS_ONLN
2

Greetings
Bernd
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/