VirtualBox

Ignore:
Timestamp:
Jan 6, 2023 8:34:59 PM (2 years ago)
Author:
vboxsync
Message:

Main/PerformanceSolaris.cpp: 4 warnings, two involving what seems like 32-bit code not properly updated to 64-bit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/solaris/PerformanceSolaris.cpp

    r96407 r98020  
    296296    {
    297297        *total = totalRAM;
    298         *available = cb / 1024;
     298        *available = (ULONG)RT_MIN(cb / 1024, ~(ULONG)0);
    299299        *used = *total - *available;
    300300    }
     
    322322        {
    323323            Assert((pid_t)process == psinfo.pr_pid);
    324             *used = psinfo.pr_rssize;
     324            *used = (ULONG)RT_MIN(psinfo.pr_rssize, ~(ULONG)0);
    325325        }
    326326        else
     
    378378uint64_t CollectorSolaris::wrapDetection(uint64_t cur, uint64_t prev, const char *name)
    379379{
    380     static bool fNotSeen = true;
    381 
    382     if (fNotSeen && cur < prev)
    383     {
    384         fNotSeen = false;
    385         LogRel(("Detected wrap on %s (%llu < %llu).\n", name, cur, prev));
    386     }
     380    if (cur < prev)
     381        LogRelMax(2, ("Detected wrap on %s (%llu < %llu).\n", name, cur, prev));
    387382    return cur;
    388383}
     
    429424    }
    430425    kstat_named_t *kn;
    431     if ((kn = (kstat_named_t *)kstat_data_lookup(ksAdapter, (char *)"rbytes64")) == 0)
    432     {
     426    if ((kn = (kstat_named_t *)kstat_data_lookup(ksAdapter, (char *)"rbytes64")) == NULL)
     427    {
     428        if ((kn = (kstat_named_t *)kstat_data_lookup(ksAdapter, (char *)"rbytes")) == NULL)
     429        {
     430            LogRel(("kstat_data_lookup(rbytes) -> %d, name=%s\n", errno, name));
     431            return VERR_INTERNAL_ERROR;
     432        }
     433#if ARCH_BITS == 32
    433434        if (g_fNotReported)
    434435        {
     
    436437            LogRel(("Failed to locate rbytes64, falling back to 32-bit counters...\n"));
    437438        }
    438         if ((kn = (kstat_named_t *)kstat_data_lookup(ksAdapter, (char *)"rbytes")) == 0)
    439         {
    440             LogRel(("kstat_data_lookup(rbytes) -> %d, name=%s\n", errno, name));
     439        *rx = wrapCorrection(kn->value.ul, *rx, "rbytes");
     440#else
     441        AssertCompile(sizeof(kn->value.ul) == sizeof(uint64_t));
     442        *rx = wrapDetection(kn->value.ul, *rx, "rbytes");
     443#endif
     444    }
     445    else
     446        *rx = wrapDetection(kn->value.ull, *rx, "rbytes64");
     447    if ((kn = (kstat_named_t *)kstat_data_lookup(ksAdapter, (char *)"obytes64")) == NULL)
     448    {
     449        if ((kn = (kstat_named_t *)kstat_data_lookup(ksAdapter, (char *)"obytes")) == NULL)
     450        {
     451            LogRel(("kstat_data_lookup(obytes) -> %d\n", errno));
    441452            return VERR_INTERNAL_ERROR;
    442453        }
    443         *rx = wrapCorrection(kn->value.ul, *rx, "rbytes");
    444     }
    445     else
    446         *rx = wrapDetection(kn->value.ull, *rx, "rbytes64");
    447     if ((kn = (kstat_named_t *)kstat_data_lookup(ksAdapter, (char *)"obytes64")) == 0)
    448     {
     454#if ARCH_BITS == 32
    449455        if (g_fNotReported)
    450456        {
     
    452458            LogRel(("Failed to locate obytes64, falling back to 32-bit counters...\n"));
    453459        }
    454         if ((kn = (kstat_named_t *)kstat_data_lookup(ksAdapter, (char *)"obytes")) == 0)
    455         {
    456             LogRel(("kstat_data_lookup(obytes) -> %d\n", errno));
    457             return VERR_INTERNAL_ERROR;
    458         }
    459460        *tx = wrapCorrection(kn->value.ul, *tx, "obytes");
     461#else
     462        AssertCompile(sizeof(kn->value.ul) == sizeof(uint64_t));
     463        *tx = wrapDetection(kn->value.ul, *tx, "obytes");
     464#endif
    460465    }
    461466    else
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