[lsb-discuss] LSB-compliant way to get number of processors?
Theodore Tso
tytso at mit.edu
Mon Aug 7 09:47:48 PDT 2006
On Mon, Aug 07, 2006 at 11:31:55AM +0100, Alan Cox wrote:
> Ar Llu, 2006-08-07 am 10:01 +0100, ysgrifennodd Dallman, John:
> > > I've found two ways so far to ask Linux how many processors
> > > it has: get_nprocs() and sysconf(_SC_NPROCESSORS_ONLN), but
> > > neither of them seem to be allowed in LSB-compliant code.
> >
> > Any offers? If we can't find a way to do this, Parasolid on
> > Linux is going to have to cease being LSB-compliant. This is
> > not a prospect I welcome, but delivering what the customer
> > are actually asking for has to take priority over things
> > they aren't bothered about.
>
> sysconf really ought to be in the LSB for some of those queries. I'd
> agree its a bug if it isnt
sysconf() _is_ in the LSB. What may be missing (although maybe I'm
looking in the wrong place; I would need to defer to someone like
Mats) is the definition of which names can be passed into sysconf()
and guaranteed to supported on all LSB platforms, such as
_SC_NPROCESSORS_ONLN, _SC_PAGESIZE. But there are references in the
LSB where it states that LSB applications are supposed to use
sysconf(_SC_PAGESIZE) in order to find the pagesize, so I assume that
means that the IA32 architecture suppliment must be defining
_SC_PAGESIZE somewhere, but I'm just not finding it....
- Ted
More information about the lsb-discuss
mailing list