From: Jeff Dike <jdike@addtoit.com>
To: Stanislav Meduna <stano@meduna.org>
Cc: user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] sysconf(_SC_NPROCESSORS_CONF) returning zero
Date: Mon, 4 Aug 2008 16:33:20 -0400 [thread overview]
Message-ID: <20080804203319.GA14732@c2.user-mode-linux.org> (raw)
In-Reply-To: <48970AEC.6020503@meduna.org>
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...
[root@uml-test ~]# cc -o ncpus ncpus.c
[root@uml-test ~]# ./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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
next prev parent reply other threads:[~2008-08-04 20:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-04 13:58 [uml-devel] sysconf(_SC_NPROCESSORS_CONF) returning zero Stanislav Meduna
2008-08-04 20:33 ` Jeff Dike [this message]
2008-08-04 20:59 ` Stanislav Meduna
2008-08-04 21:47 ` Jeff Dike
2008-08-04 22:06 ` Stanislav Meduna
2008-08-04 22:07 ` Ingo van Lil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080804203319.GA14732@c2.user-mode-linux.org \
--to=jdike@addtoit.com \
--cc=stano@meduna.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.