VirtualBox

Changeset 10481 in vbox


Ignore:
Timestamp:
Jul 10, 2008 7:58:15 PM (17 years ago)
Author:
vboxsync
Message:

cosmetics.

File:
1 edited

Legend:

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

    r10470 r10481  
    110110    strcpy(szFilename, "/sys/");
    111111    size_t cch = RTStrPrintfV(&szFilename[cchPrefix], sizeof(szFilename) - cchPrefix, pszFormat, va);
    112     NOREF(cch);
    113     Assert(cch < sizeof(szFilename) - cchPrefix - 1);
     112    Assert(cch < sizeof(szFilename) - cchPrefix - 1); NOREF(cch);
    114113
    115114    return open(szFilename, O_RDONLY, 0);
     
    249248static uint32_t rtMpLinuxGetFrequency(RTCPUID idCpu)
    250249{
    251     FILE *f = fopen("/proc/cpuinfo", "r");
    252     if (!f)
     250    FILE *pFile = fopen("/proc/cpuinfo", "r");
     251    if (!pFile)
    253252        return 0;
    254253
    255254    char sz[256];
    256     char *psz = NULL;
    257255    RTCPUID idCpuFound = NIL_RTCPUID;
    258     uint32_t freq = 0;
    259     while (fgets(sz, sizeof(sz), f))
    260     {
     256    uint32_t Frequency = 0;
     257    while (fgets(sz, sizeof(sz), pFile))
     258    {
     259        char *psz;
    261260        if (   !strncmp(sz, "processor", 9)
    262261            && (sz[10] == ' ' || sz[10] == '\t' || sz[10] == ':')
     
    279278            if (RT_SUCCESS(rc))
    280279            {
    281                 freq = v;
     280                Frequency = v;
    282281                break;
    283282            }
    284283        }
    285284    }
    286     fclose(f);
    287     return freq;
     285    fclose(pFile);
     286    return Frequency;
    288287}
    289288
     
    375374    if (kHz == -1)
    376375    {
    377         /* The file may be just unreadable - in that case use plan B, i.e.
     376        /*
     377         * The file may be just unreadable - in that case use plan B, i.e.
    378378         * /proc/cpuinfo to get the data we want. The assumption is that if
    379379         * cpuinfo_cur_freq doesn't exist then the speed won't change, and
    380380         * thus cur == max. If it does exist then cpuinfo contains the
    381          * current frequency. */
     381         * current frequency.
     382         */
    382383        kHz = rtMpLinuxGetFrequency(idCpu) * 1000;
    383384    }
     
    391392    if (kHz == -1)
    392393    {
    393         /* Check if the file isn't there - if it is there, then /proc/cpuinfo
    394          * would provide current frequency information, which is wrong. */
     394        /*
     395         * Check if the file isn't there - if it is there, then /proc/cpuinfo
     396         * would provide current frequency information, which is wrong.
     397         */
    395398        if (!rtLinuxSysFsExists("devices/system/cpu/cpu%d/cpufreq/cpuinfo_max_freq", (int)idCpu))
    396399            kHz = rtMpLinuxGetFrequency(idCpu) * 1000;
Note: See TracChangeset for help on using the changeset viewer.

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