On Mon, Aug 04, 2008 at 03:58:04PM +0200, Stanislav Meduna wrote:
> Hi,
>
> the following program
>
> ===
> #include <unistd.h>
> #include <stdio.h>
>
> main()
> {
> printf("Number of processors: %d\n", sysconf(_SC_NPROCESSORS_CONF));
> }
> ===
>
> produces
>
> Number of processors: 0
>
> on my system.
Works here...
[EMAIL PROTECTED] ~]# cc -o ncpus ncpus.c
[EMAIL PROTECTED] ~]# ./ncpus
Number of processors: 1
sysconf seems to be looking at /proc/stat, which looks like this here:
cpu 80 0 157 12771 984 0 0 0 0
cpu0 80 0 157 12771 984 0 0 0 0
intr 15259 12519 0 75 0 2590 0 0 0 0 0 0 74 0 0 1
ctxt 8081
btime 1217881784
processes 1144
procs_running 3
procs_blocked 0
I'd guess it's looking at the cpu0 (and cpu<n>) lines.
Jeff
--
Work email - jdike at linux dot intel dot com
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel