lkml.org 
[lkml]   [2002]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: system call for finding the number of cpus??

    On 8 Apr 2002, H. Peter Anvin wrote:
    > By author: Christoph Hellwig <hch@infradead.org>
    > > On Mon, Apr 08, 2002 at 05:25:08PM -0400, Robert Love wrote:
    > > > Linux does not implement such a syscall. Note
    > > >
    > > > cat /proc/cpuinfo | grep processor | wc -l
    > >
    > > I guess there is at least one architecture on which it breaks..
    > >
    >
    > Then that architecture should be fixed.

    Back in 1999 or so I actually came up with a patch that more-or-less came
    up with an arch-independent /proc/cpuinfo file. It touched off a
    mini-flamewar on linux-kernel, none of the arch maintainers wanted to
    change their pet format, and Linus silently dropped the patch.

    As maintainer of linux_logo I have to have a separate cpuinfo parser for
    each architecture.

    For number of CPU's..... x86 uses the "count processor/bogomips" type
    thing. Some architectures actually have an "active cpus:" type field.
    Some have a "processors total:" type field. And often the method that
    works changes from kernel to kernel, sometimes even within stable
    releases.

    But no, counting processors or bogomips doesn't work across the board.

    Should this be rectified somehow? I think it would take a proclomation
    from on high.

    What to do in the meantime? Well the sysconf() method sounds promising.
    If not you can dig out the sysinfo library included with linux_logo which
    does a reasonable job with most of the common architectures.

    Vince

    --
    ____________
    \ /\ /\ / Vince Weaver Linux 2.4.9 on a K6-2+, Up 45 days
    \/__\/__\/ vince@deater.net http://www.deater.net/weave


    -
    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/

    \
     
     \ /
      Last update: 2005-03-22 13:25    [W:0.021 / U:59.768 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site