VirtualBox

Changeset 10421 in vbox


Ignore:
Timestamp:
Jul 9, 2008 1:52:22 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
33081
Message:

_SC_NPROCESSORS_CONF doesn't work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/linux/mp-linux.cpp

    r10419 r10421  
    219219 * @returns Max cpus.
    220220 */
    221 DECLINLINE(RTCPUID) rtMpLinuxMaxCpus(void)
    222 {
     221static RTCPUID rtMpLinuxMaxCpus(void)
     222{
     223#if 0 /* this doesn't do the right thing :-/ */
    223224    int cMax = sysconf(_SC_NPROCESSORS_CONF);
    224225    Assert(cMax >= 1);
    225226    return cMax;
     227#else
     228    static uint32_t s_cMax = 0;
     229    if (!s_cMax)
     230    {
     231        int cMax = 1;
     232        for (unsigned iCpu = 0; iCpu < RTCPUSET_MAX_CPUS; iCpu++)
     233            if (rtLinuxSysFsExists("devices/system/cpu/cpu%d", iCpu))
     234                cMax = iCpu + 1;
     235        ASMAtomicUoWriteU32((uint32_t volatile *)&s_cMax, cMax);
     236        return cMax;
     237    }
     238    return s_cMax;
     239#endif
    226240}
    227241
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette