VirtualBox

Changeset 43978 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Nov 28, 2012 5:11:51 AM (12 years ago)
Author:
vboxsync
Message:

Main/Metrics: Host disk size for Solaris (#6345)

File:
1 edited

Legend:

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

    r43897 r43978  
    6666    virtual int getHostMemoryUsage(ULONG *total, ULONG *used, ULONG *available);
    6767    virtual int getHostFilesystemUsage(const char *name, ULONG *total, ULONG *used, ULONG *available);
     68    virtual int getHostDiskSize(const char *name, uint64_t *size);
    6869    virtual int getProcessMemoryUsage(RTPROCESS process, ULONG *used);
    6970
     
    494495
    495496    return VINF_SUCCESS;
     497}
     498
     499int CollectorSolaris::getHostDiskSize(const char *name, uint64_t *size)
     500{
     501    int rc = VINF_SUCCESS;
     502    AssertReturn(strlen(name) + 5 < KSTAT_STRLEN, VERR_INVALID_PARAMETER);
     503    LogFlowThisFunc(("n=%s\n", name));
     504    char szName[KSTAT_STRLEN];
     505    strcpy(szName, name);
     506    strcat(szName, ",err");
     507    kstat_t *ksDisk = kstat_lookup(mKC, "sderr", -1, szName);
     508    if (ksDisk != 0)
     509    {
     510        if (kstat_read(mKC, ksDisk, 0) == -1)
     511        {
     512            LogRel(("kstat_read(%s) -> %d\n", name, errno));
     513            rc = VERR_INTERNAL_ERROR;
     514        }
     515        else
     516        {
     517            kstat_named_t *kn;
     518            if ((kn = (kstat_named_t *)kstat_data_lookup(ksDisk, (char *)"Size")) == 0)
     519            {
     520                LogRel(("kstat_data_lookup(rbytes) -> %d, name=%s\n", errno, name));
     521                return VERR_INTERNAL_ERROR;
     522            }
     523            *size = kn->value.ull;
     524        }
     525    }
     526
     527    return rc;
    496528}
    497529
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