public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "J.A. Magallon" <jamagallon@able.es>
To: Robert Love <rml@tech9.net>
Cc: "Kuppuswamy, Priyadarshini" <Priyadarshini.Kuppuswamy@compaq.com>,
	linux-kernel@vger.kernel.org
Subject: Re: system call for finding the number of cpus??
Date: Mon, 8 Apr 2002 23:51:58 +0200	[thread overview]
Message-ID: <20020408215158.GA13043@werewolf.able.es> (raw)
In-Reply-To: <6B003D25ADBDE347B5542AFE6A55B42E01A4451A@tayexc13.americas.cpqcorp.net> <1018301108.913.167.camel@phantasy>


On 2002.04.08 Robert Love wrote:
>On Mon, 2002-04-08 at 17:18, Kuppuswamy, Priyadarshini wrote:
>
>>   I have a script that is using the /cpu/procinfo file to determine the
>>  number of cpus present in the system. But I would like to implement it 
>> using a system call rather than use the environment variables?? I couldn't
>> find a system call for linux that would give me the result. Could anyone
>> please let me know if there is one for redhat linux??
>
>Linux does not implement such a syscall.  Note
>

How about this:

#include <sys/sysinfo.h>       
...
    //nproc = get_nprocs(); // Available processors
    nproc = get_nprocs_conf(); // Configured processors (some can be down...)

(glibc 2.2.5, but i think it keeps working since time ago).

BTW, why linux does not implement sysconf(_SC_NPROC_[CONF,ONLN]) ??

TIA

-- 
J.A. Magallon                           #  Let the source be with you...        
mailto:jamagallon@able.es
Mandrake Linux release 8.3 (Cooker) for i586
Linux werewolf 2.4.19-pre6-jam1 #1 SMP Sun Apr 7 00:50:05 CEST 2002 i686

  parent reply	other threads:[~2002-04-08 21:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-08 21:18 system call for finding the number of cpus?? Kuppuswamy, Priyadarshini
2002-04-08 21:25 ` Robert Love
2002-04-08 21:27   ` Christoph Hellwig
2002-04-08 21:37     ` Mark Hahn
2002-04-08 22:02       ` Dr. David Alan Gilbert
2002-04-11 10:11         ` Rusty Russell
2002-04-08 21:58     ` H. Peter Anvin
2002-04-09 14:28       ` Vince Weaver
2002-04-08 21:51   ` J.A. Magallon [this message]
2002-04-08 22:59   ` David Ford
2002-04-08 21:56 ` Davide Libenzi
2002-04-08 21:58   ` J.A. Magallon
2002-04-08 22:08     ` Davide Libenzi
2002-04-09  1:12     ` Nicholas Miell
2002-04-09 15:37 ` Tigran Aivazian
  -- strict thread matches above, loose matches on Subject: below --
2002-04-08 21:54 Kuppuswamy, Priyadarshini
2002-04-08 22:05 ` Davide Libenzi
2002-04-08 22:12 ` J.A. Magallon
2002-04-09  5:36   ` Bernd Eckenfels
2002-04-09 15:39 ` Tigran Aivazian

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=20020408215158.GA13043@werewolf.able.es \
    --to=jamagallon@able.es \
    --cc=Priyadarshini.Kuppuswamy@compaq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rml@tech9.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox