VirtualBox

Ignore:
Timestamp:
Jan 24, 2023 3:32:43 PM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
155493
Message:

Main/src-server: rc -> hrc/vrc (partial). bugref:10223

Location:
trunk/src/VBox/Main/src-server/linux
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/linux/HostDnsServiceLinux.cpp

    r98103 r98288  
    185185     */
    186186    int aiStopPair[2];
    187     int rc = socketpair(AF_LOCAL, SOCK_DGRAM | SOCK_CLOEXEC, 0, aiStopPair);
     187    int iRc = socketpair(AF_LOCAL, SOCK_DGRAM | SOCK_CLOEXEC, 0, aiStopPair);
    188188    int iErr = errno;
    189     AssertLogRelMsgReturn(rc == 0, ("socketpair: failed (%d: %s)\n", iErr, strerror(iErr)), RTErrConvertFromErrno(iErr));
     189    AssertLogRelMsgReturn(iRc == 0, ("socketpair: failed (%d: %s)\n", iErr, strerror(iErr)), RTErrConvertFromErrno(iErr));
    190190
    191191    m_fdShutdown = aiStopPair[0];
     
    241241         * Wait for something to happen.
    242242         */
    243         rc = poll(aFdPolls, RT_ELEMENTS(aFdPolls), -1 /*infinite timeout*/);
    244         if (rc == -1)
     243        iRc = poll(aFdPolls, RT_ELEMENTS(aFdPolls), -1 /*infinite timeout*/);
     244        if (iRc == -1)
    245245        {
    246246            if (errno != EINTR)
    247247            {
    248                 LogRelMax(32, ("HostDnsServiceLinux::monitorThreadProc: poll failed %d: errno=%d\n", rc, errno));
     248                LogRelMax(32, ("HostDnsServiceLinux::monitorThreadProc: poll failed %d: errno=%d\n", iRc, errno));
    249249                RTThreadSleep(1);
    250250            }
    251251            continue;
    252252        }
    253         Log5Func(("poll returns %d: [0]=%#x [1]=%#x\n", rc, aFdPolls[1].revents, aFdPolls[0].revents));
     253        Log5Func(("poll returns %d: [0]=%#x [1]=%#x\n", iRc, aFdPolls[1].revents, aFdPolls[0].revents));
    254254
    255255        AssertMsgBreakStmt(   (aFdPolls[0].revents & (POLLERR | POLLNVAL)) == 0 /* (ok for fd=-1 too, revents=0 then) */
     
    322322                        if (iWdFileNew != -1)
    323323                        {
    324                             rc = inotify_rm_watch(iNotifyFd, iWdFileNew);
    325                             AssertMsg(rc >= 0, ("%d/%d\n", rc, errno));
     324                            iRc = inotify_rm_watch(iNotifyFd, iWdFileNew);
     325                            AssertMsg(iRc >= 0, ("%d/%d\n", iRc, errno));
    326326                            iWdFileNew = -1;
    327327                        }
     
    350350                            if (iWdFileNew >= 0)
    351351                            {
    352                                 rc = inotify_rm_watch(iNotifyFd, iWdFileNew);
    353                                 Log5Func(("dir: moved / created / deleted: dropped file watch (%d - rc=%d/err=%d)\n",
    354                                           iWdFileNew, rc, errno));
     352                                iRc = inotify_rm_watch(iNotifyFd, iWdFileNew);
     353                                Log5Func(("dir: moved / created / deleted: dropped file watch (%d - iRc=%d/err=%d)\n",
     354                                          iWdFileNew, iRc, errno));
    355355                                iWdFileNew = -1;
    356356                            }
    357357                            if (iWdSymDirNew >= 0)
    358358                            {
    359                                 rc = inotify_rm_watch(iNotifyFd, iWdSymDirNew);
    360                                 Log5Func(("dir: moved / created / deleted: dropped symlinked dir watch (%d - %s/%s - rc=%d/err=%d)\n",
    361                                           iWdSymDirNew, szRealResolvConf, &szRealResolvConf[offRealResolvConfName], rc, errno));
     359                                iRc = inotify_rm_watch(iNotifyFd, iWdSymDirNew);
     360                                Log5Func(("dir: moved / created / deleted: dropped symlinked dir watch (%d - %s/%s - iRc=%d/err=%d)\n",
     361                                          iWdSymDirNew, szRealResolvConf, &szRealResolvConf[offRealResolvConfName], iRc, errno));
    362362                                iWdSymDirNew = -1;
    363363                                offRealResolvConfName = 0;
     
    397397                        if (iWdFileNew >= 0)
    398398                        {
    399                             rc = inotify_rm_watch(iNotifyFd, iWdFileNew);
    400                             Log5Func(("symdir: moved / created / deleted: drop file watch (%d - rc=%d/err=%d)\n",
    401                                       iWdFileNew, rc, errno));
     399                            iRc = inotify_rm_watch(iNotifyFd, iWdFileNew);
     400                            Log5Func(("symdir: moved / created / deleted: drop file watch (%d - iRc=%d/err=%d)\n",
     401                                      iWdFileNew, iRc, errno));
    402402                            iWdFileNew = -1;
    403403                        }
  • trunk/src/VBox/Main/src-server/linux/HostHardwareLinux.cpp

    r98103 r98288  
    148148    AssertReturn(Number <= 7, false);
    149149    RTFILE File;
    150     int rc = RTFileOpen(&File, pcszNode, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_NON_BLOCK);
    151     if (RT_SUCCESS(rc))
     150    int vrc = RTFileOpen(&File, pcszNode, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_NON_BLOCK);
     151    if (RT_SUCCESS(vrc))
    152152    {
    153153        int rcIoCtl;
    154         rc = RTFileIoCtl(File, FDGETDRVTYP, pszName, 0, &rcIoCtl);
     154        vrc = RTFileIoCtl(File, FDGETDRVTYP, pszName, 0, &rcIoCtl);
    155155        RTFileClose(File);
    156         if (RT_SUCCESS(rc) && rcIoCtl >= 0)
     156        if (RT_SUCCESS(vrc) && rcIoCtl >= 0)
    157157            return true;
    158158    }
     
    310310
    311311    RTFILE hFile = NIL_RTFILE;
    312     int rc = RTFileOpen(&hFile, pcszNode, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_NON_BLOCK);
    313     if (RT_SUCCESS(rc))
     312    int vrc = RTFileOpen(&hFile, pcszNode, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_NON_BLOCK);
     313    if (RT_SUCCESS(vrc))
    314314    {
    315315        int                             rcIoCtl          = 0;
     
    323323        CdromCommandReq.data_direction = CGC_DATA_READ;
    324324        CdromCommandReq.timeout        = 5000;  /* ms */
    325         rc = RTFileIoCtl(hFile, CDROM_SEND_PACKET, &CdromCommandReq, 0, &rcIoCtl);
    326         if (RT_SUCCESS(rc) && rcIoCtl < 0)
    327             rc = RTErrConvertFromErrno(-CdromCommandReq.stat);
     325        vrc = RTFileIoCtl(hFile, CDROM_SEND_PACKET, &CdromCommandReq, 0, &rcIoCtl);
     326        if (RT_SUCCESS(vrc) && rcIoCtl < 0)
     327            vrc = RTErrConvertFromErrno(-CdromCommandReq.stat);
    328328        RTFileClose(hFile);
    329329
    330         if (RT_SUCCESS(rc))
     330        if (RT_SUCCESS(vrc))
    331331        {
    332332            if (pbType)
     
    347347        }
    348348    }
    349     LogRelFlowFunc(("returning %Rrc\n", rc));
    350     return rc;
     349    LogRelFlowFunc(("returning %Rrc\n", vrc));
     350    return vrc;
    351351}
    352352
     
    432432    AssertPtrReturn(pcszNode, false);
    433433    RTFILE File;
    434     int rc = RTFileOpen(&File, pcszNode, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_NON_BLOCK);
    435     if (RT_SUCCESS(rc))
     434    int vrc = RTFileOpen(&File, pcszNode, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE | RTFILE_O_NON_BLOCK);
     435    if (RT_SUCCESS(vrc))
    436436    {
    437437        int rcIoCtl;
    438         rc = RTFileIoCtl(File, NVME_IOCTL_ID, NULL, 0, &rcIoCtl);
     438        vrc = RTFileIoCtl(File, NVME_IOCTL_ID, NULL, 0, &rcIoCtl);
    439439        RTFileClose(File);
    440         if (RT_SUCCESS(rc) && rcIoCtl >= 0)
     440        if (RT_SUCCESS(vrc) && rcIoCtl >= 0)
    441441            return true;
    442442    }
     
    520520{
    521521    LogFlowThisFunc(("entered\n"));
    522     int rc;
     522    int vrc;
    523523    try
    524524    {
     
    527527         * environment variable. */
    528528        bool fSuccess = false;  /* Have we succeeded in finding anything yet? */
    529         rc = getDriveInfoFromEnv("VBOX_CDROM", &mDVDList, true /* isDVD */, &fSuccess);
     529        vrc = getDriveInfoFromEnv("VBOX_CDROM", &mDVDList, true /* isDVD */, &fSuccess);
    530530        setNoProbe(false);
    531         if (RT_SUCCESS(rc) && (!fSuccess || testing()))
    532             rc = getDriveInfoFromSysfs(&mDVDList, DVD, &fSuccess);
    533         if (RT_SUCCESS(rc) && testing())
     531        if (RT_SUCCESS(vrc) && (!fSuccess || testing()))
     532            vrc = getDriveInfoFromSysfs(&mDVDList, DVD, &fSuccess);
     533        if (RT_SUCCESS(vrc) && testing())
    534534        {
    535535            setNoProbe(true);
    536             rc = getDriveInfoFromSysfs(&mDVDList, DVD, &fSuccess);
     536            vrc = getDriveInfoFromSysfs(&mDVDList, DVD, &fSuccess);
    537537        }
    538538    }
    539539    catch (std::bad_alloc &e)
    540540    {
    541         rc = VERR_NO_MEMORY;
    542     }
    543     LogFlowThisFunc(("rc=%Rrc\n", rc));
    544     return rc;
     541        vrc = VERR_NO_MEMORY;
     542    }
     543    LogFlowThisFunc(("vrc=%Rrc\n", vrc));
     544    return vrc;
    545545}
    546546
     
    548548{
    549549    LogFlowThisFunc(("entered\n"));
    550     int rc;
     550    int vrc;
    551551    try
    552552    {
    553553        mFloppyList.clear();
    554554        bool fSuccess = false;  /* Have we succeeded in finding anything yet? */
    555         rc = getDriveInfoFromEnv("VBOX_FLOPPY", &mFloppyList, false /* isDVD */, &fSuccess);
     555        vrc = getDriveInfoFromEnv("VBOX_FLOPPY", &mFloppyList, false /* isDVD */, &fSuccess);
    556556        setNoProbe(false);
    557         if (RT_SUCCESS(rc) && (!fSuccess || testing()))
    558             rc = getDriveInfoFromSysfs(&mFloppyList, Floppy, &fSuccess);
    559         if (RT_SUCCESS(rc) && testing())
     557        if (RT_SUCCESS(vrc) && (!fSuccess || testing()))
     558            vrc = getDriveInfoFromSysfs(&mFloppyList, Floppy, &fSuccess);
     559        if (RT_SUCCESS(vrc) && testing())
    560560        {
    561561            setNoProbe(true);
    562             rc = getDriveInfoFromSysfs(&mFloppyList, Floppy, &fSuccess);
     562            vrc = getDriveInfoFromSysfs(&mFloppyList, Floppy, &fSuccess);
    563563        }
    564564    }
    565565    catch (std::bad_alloc &)
    566566    {
    567         rc = VERR_NO_MEMORY;
    568     }
    569     LogFlowThisFunc(("rc=%Rrc\n", rc));
    570     return rc;
     567        vrc = VERR_NO_MEMORY;
     568    }
     569    LogFlowThisFunc(("vrc=%Rrc\n", vrc));
     570    return vrc;
    571571}
    572572
     
    617617    AssertPtrNullReturn(pfSuccess, VERR_INVALID_POINTER);
    618618    LogFlowFunc(("pcszVar=%s, pList=%p, isDVD=%d, pfSuccess=%p\n", pcszVar, pList, isDVD, pfSuccess));
    619     int rc = VINF_SUCCESS;
     619    int vrc = VINF_SUCCESS;
    620620    bool success = false;
    621621    char *pszFreeMe = RTEnvDupEx(RTENV_DEFAULT, pcszVar);
     
    645645    catch (std::bad_alloc &)
    646646    {
    647         rc = VERR_NO_MEMORY;
     647        vrc = VERR_NO_MEMORY;
    648648    }
    649649    RTStrFree(pszFreeMe);
    650     LogFlowFunc(("rc=%Rrc, success=%d\n", rc, success));
    651     return rc;
     650    LogFlowFunc(("vrc=%Rrc, success=%d\n", vrc, success));
     651    return vrc;
    652652}
    653653
     
    696696    {
    697697        dev_t dev = 0;
    698         int rc = RTLinuxSysFsReadDevNumFile(&dev, "block/%s/dev", mpcszName);
    699         if (RT_FAILURE(rc) || dev == 0)
     698        int vrc = RTLinuxSysFsReadDevNumFile(&dev, "block/%s/dev", mpcszName);
     699        if (RT_FAILURE(vrc) || dev == 0)
    700700        {
    701701            misConsistent = false;
    702702            return false;
    703703        }
    704         rc = RTLinuxCheckDevicePath(dev, RTFS_TYPE_DEV_BLOCK, mszNode, sizeof(mszNode), "%s", mpcszName);
    705         return RT_SUCCESS(rc);
     704        vrc = RTLinuxCheckDevicePath(dev, RTFS_TYPE_DEV_BLOCK, mszNode, sizeof(mszNode), "%s", mpcszName);
     705        return RT_SUCCESS(vrc);
    706706    }
    707707
     
    714714    {
    715715        int64_t type = 0;
    716         int rc = RTLinuxSysFsReadIntFile(10, &type, "block/%s/device/type", mpcszName);
    717         if (RT_SUCCESS(rc) && type != TYPE_ROM)
     716        int vrc = RTLinuxSysFsReadIntFile(10, &type, "block/%s/device/type", mpcszName);
     717        if (RT_SUCCESS(vrc) && type != TYPE_ROM)
    718718            return;
    719719        if (type == TYPE_ROM)
    720720        {
    721721            char szVendor[128];
    722             rc = RTLinuxSysFsReadStrFile(szVendor, sizeof(szVendor), NULL, "block/%s/device/vendor", mpcszName);
    723             if (RT_SUCCESS(rc))
     722            vrc = RTLinuxSysFsReadStrFile(szVendor, sizeof(szVendor), NULL, "block/%s/device/vendor", mpcszName);
     723            if (RT_SUCCESS(vrc))
    724724            {
    725725                char szModel[128];
    726                 rc = RTLinuxSysFsReadStrFile(szModel, sizeof(szModel), NULL, "block/%s/device/model", mpcszName);
    727                 if (RT_SUCCESS(rc))
     726                vrc = RTLinuxSysFsReadStrFile(szModel, sizeof(szModel), NULL, "block/%s/device/model", mpcszName);
     727                if (RT_SUCCESS(vrc))
    728728                {
    729729                    misValid = true;
     
    747747        char szVendor[128] = "";
    748748        char szModel[128] = "";
    749         int rc = cdromDoInquiry(mszNode, &bType, szVendor, sizeof(szVendor), szModel, sizeof(szModel));
    750         if (RT_SUCCESS(rc) && bType == TYPE_ROM)
     749        int vrc = cdromDoInquiry(mszNode, &bType, szVendor, sizeof(szVendor), szModel, sizeof(szModel));
     750        if (RT_SUCCESS(vrc) && bType == TYPE_ROM)
    751751        {
    752752            misValid = true;
     
    772772        if (!noProbe())
    773773            fHaveName = floppyGetName(mszNode, mpcszName[2] - '0', szName);
    774         int rc = RTLinuxSysFsGetLinkDest(szDriver, sizeof(szDriver), NULL, "block/%s/%s",
    775                                          mpcszName, "device/driver");
    776         if (RT_SUCCESS(rc))
     774        int vrc = RTLinuxSysFsGetLinkDest(szDriver, sizeof(szDriver), NULL, "block/%s/%s", mpcszName, "device/driver");
     775        if (RT_SUCCESS(vrc))
    777776        {
    778777            if (RTStrCmp(szDriver, "floppy"))
     
    795794         */
    796795        int64_t type = 0;
    797         int rc = RTLinuxSysFsReadIntFile(10, &type, "block/%s/device/type", mpcszName);
    798         if (!RT_SUCCESS(rc) || type != TYPE_DISK)
     796        int vrc = RTLinuxSysFsReadIntFile(10, &type, "block/%s/device/type", mpcszName);
     797        if (!RT_SUCCESS(vrc) || type != TYPE_DISK)
    799798        {
    800799            if (noProbe() || !probeNVME(mszNode))
    801800            {
    802801                char szDriver[16];
    803                 rc = RTLinuxSysFsGetLinkDest(szDriver, sizeof(szDriver), NULL, "block/%s/%s",
    804                                                  mpcszName, "device/device/driver");
    805                 if (RT_FAILURE(rc) || RTStrCmp(szDriver, "nvme"))
    806                         return;
     802                vrc = RTLinuxSysFsGetLinkDest(szDriver, sizeof(szDriver), NULL, "block/%s/%s", mpcszName, "device/device/driver");
     803                if (RT_FAILURE(vrc) || RTStrCmp(szDriver, "nvme"))
     804                    return;
    807805            }
    808806        }
     
    810808        char szModel[128];
    811809        size_t cbRead = 0;
    812         rc = RTLinuxSysFsReadStrFile(szVendor, sizeof(szVendor), &cbRead, "block/%s/device/vendor", mpcszName);
     810        vrc = RTLinuxSysFsReadStrFile(szVendor, sizeof(szVendor), &cbRead, "block/%s/device/vendor", mpcszName);
    813811        szVendor[cbRead] = '\0';
    814812        /* Assume the model is always present. Vendor is not present for NVME disks */
    815813        cbRead = 0;
    816         rc = RTLinuxSysFsReadStrFile(szModel, sizeof(szModel), &cbRead, "block/%s/device/model", mpcszName);
     814        vrc = RTLinuxSysFsReadStrFile(szModel, sizeof(szModel), &cbRead, "block/%s/device/model", mpcszName);
    817815        szModel[cbRead] = '\0';
    818         if (RT_SUCCESS(rc))
     816        if (RT_SUCCESS(vrc))
    819817        {
    820818            misValid = true;
     
    870868    unsigned cFound = 0;
    871869    RTDIR hDir = NIL_RTDIR;
    872     int rc = RTDirOpen(&hDir, "/sys/block");
     870    int vrc = RTDirOpen(&hDir, "/sys/block");
    873871    /* This might mean that sysfs semantics have changed */
    874     AssertReturn(rc != VERR_FILE_NOT_FOUND, VINF_SUCCESS);
    875     if (RT_SUCCESS(rc))
     872    AssertReturn(vrc != VERR_FILE_NOT_FOUND, VINF_SUCCESS);
     873    if (RT_SUCCESS(vrc))
    876874    {
    877875        for (;;)
    878876        {
    879877            RTDIRENTRY entry;
    880             rc = RTDirRead(hDir, &entry, NULL);
    881             Assert(rc != VERR_BUFFER_OVERFLOW);  /* Should never happen... */
    882             if (RT_FAILURE(rc))  /* Including overflow and no more files */
     878            vrc = RTDirRead(hDir, &entry, NULL);
     879            Assert(vrc != VERR_BUFFER_OVERFLOW);  /* Should never happen... */
     880            if (RT_FAILURE(vrc))  /* Including overflow and no more files */
    883881                break;
    884882            if (entry.szName[0] == '.')
     
    895893            catch (std::bad_alloc &e)
    896894            {
    897                 rc = VERR_NO_MEMORY;
     895                vrc = VERR_NO_MEMORY;
    898896                break;
    899897            }
     
    902900        RTDirClose(hDir);
    903901    }
    904     if (rc == VERR_NO_MORE_FILES)
    905         rc = VINF_SUCCESS;
    906     else if (RT_FAILURE(rc))
     902    if (vrc == VERR_NO_MORE_FILES)
     903        vrc = VINF_SUCCESS;
     904    else if (RT_FAILURE(vrc))
    907905        /* Clean up again */
    908906        while (cFound-- > 0)
     
    910908    if (pfSuccess)
    911909        *pfSuccess = fSuccess;
    912     LogFlow (("rc=%Rrc, fSuccess=%u\n", rc, (unsigned)fSuccess));
    913     return rc;
     910    LogFlow (("vrc=%Rrc, fSuccess=%u\n", vrc, (unsigned)fSuccess));
     911    return vrc;
    914912}
    915913
     
    11811179#  endif
    11821180
    1183     int rc = iwInit(&mWatches);
    1184     if (RT_SUCCESS(rc))
    1185     {
    1186         rc = iwAddWatch(&mWatches, mpcszDevicesRoot);
    1187         if (RT_SUCCESS(rc))
    1188             rc = pipeCreateSimple(&mhWakeupPipeR, &mhWakeupPipeW);
    1189     }
    1190     mStatus = rc;
    1191     if (RT_FAILURE(rc))
     1181    int vrc = iwInit(&mWatches);
     1182    if (RT_SUCCESS(vrc))
     1183    {
     1184        vrc = iwAddWatch(&mWatches, mpcszDevicesRoot);
     1185        if (RT_SUCCESS(vrc))
     1186            vrc = pipeCreateSimple(&mhWakeupPipeR, &mhWakeupPipeW);
     1187    }
     1188    mStatus = vrc;
     1189    if (RT_FAILURE(vrc))
    11921190        term();
    11931191}
     
    12471245int hotplugInotifyImpl::Wait(RTMSINTERVAL aMillies)
    12481246{
    1249     int rc;
    1250 
    12511247    AssertRCReturn(mStatus, VERR_WRONG_ORDER);
    12521248    bool fEntered = ASMAtomicCmpXchgU32(&mfWaiting, 1, 0);
     
    12551251    VECTOR_PTR(char *) vecpchDevs;
    12561252    VEC_INIT_PTR(&vecpchDevs, char *, RTStrFree);
    1257     rc = readFilePaths(mpcszDevicesRoot, &vecpchDevs, false);
    1258     if (RT_SUCCESS(rc))
     1253    int vrc = readFilePaths(mpcszDevicesRoot, &vecpchDevs, false);
     1254    if (RT_SUCCESS(vrc))
    12591255    {
    12601256        char **ppszEntry;
    12611257        VEC_FOR_EACH(&vecpchDevs, char *, ppszEntry)
    1262             if (RT_FAILURE(rc = iwAddWatch(&mWatches, *ppszEntry)))
     1258            if (RT_FAILURE(vrc = iwAddWatch(&mWatches, *ppszEntry)))
    12631259                break;
    12641260
    1265         if (RT_SUCCESS(rc))
     1261        if (RT_SUCCESS(vrc))
    12661262        {
    12671263            struct pollfd pollFD[MAX_POLLID];
     
    12751271            {
    12761272                Assert(errno > 0);
    1277                 rc = RTErrConvertFromErrno(errno);
     1273                vrc = RTErrConvertFromErrno(errno);
    12781274            }
    12791275            else if (pollFD[RPIPE_ID].revents)
    12801276            {
    1281                 rc = drainWakeupPipe();
    1282                 if (RT_SUCCESS(rc))
    1283                     rc = VERR_INTERRUPTED;
     1277                vrc = drainWakeupPipe();
     1278                if (RT_SUCCESS(vrc))
     1279                    vrc = VERR_INTERRUPTED;
    12841280            }
    12851281            else if ((pollFD[INOTIFY_ID].revents))
    12861282            {
    12871283                if (cPolled == 1)
    1288                     rc = drainInotify();
     1284                    vrc = drainInotify();
    12891285                else
    1290                     AssertFailedStmt(rc = VERR_INTERNAL_ERROR);
     1286                    AssertFailedStmt(vrc = VERR_INTERNAL_ERROR);
    12911287            }
    12921288            else
    12931289            {
    12941290                if (errno == 0 && cPolled == 0)
    1295                     rc = VERR_TIMEOUT;
     1291                    vrc = VERR_TIMEOUT;
    12961292                else
    1297                     AssertFailedStmt(rc = VERR_INTERNAL_ERROR);
     1293                    AssertFailedStmt(vrc = VERR_INTERNAL_ERROR);
    12981294            }
    12991295        }
     
    13021298    mfWaiting = 0;
    13031299    VEC_CLEANUP_PTR(&vecpchDevs);
    1304     return rc;
     1300    return vrc;
    13051301}
    13061302
  • trunk/src/VBox/Main/src-server/linux/HostPowerLinux.cpp

    r98103 r98288  
    5959{
    6060    DBusError error;
    61     int rc;
    6261
    63     rc = RTDBusLoadLib();
    64     if (RT_FAILURE(rc))
     62    int vrc = RTDBusLoadLib();
     63    if (RT_FAILURE(vrc))
    6564    {
    6665        LogRel(("HostPowerServiceLinux: DBus library not found.  Service not available.\n"));
     
    9291
    9392    /* Create the new worker thread. */
    94     rc = RTThreadCreate(&mThread, HostPowerServiceLinux::powerChangeNotificationThread, this, 0 /* cbStack */,
    95                         RTTHREADTYPE_MSG_PUMP, RTTHREADFLAGS_WAITABLE, "MainPower");
    96     if (RT_FAILURE(rc))
     93    vrc = RTThreadCreate(&mThread, HostPowerServiceLinux::powerChangeNotificationThread, this, 0 /* cbStack */,
     94                         RTTHREADTYPE_MSG_PUMP, RTTHREADFLAGS_WAITABLE, "MainPower");
     95    if (RT_FAILURE(vrc))
    9796    {
    98         LogRel(("HostPowerServiceLinux: RTThreadCreate failed with %Rrc\n", rc));
     97        LogRel(("HostPowerServiceLinux: RTThreadCreate failed with %Rrc\n", vrc));
    9998        dbus_connection_unref(mpConnection);
    10099    }
  • trunk/src/VBox/Main/src-server/linux/NetIf-linux.cpp

    r98103 r98288  
    126126    {
    127127        /* Failed to get speed via sysfs, go to plan B. */
    128         int rc = NetIfAdpCtlOut(pszName, "speed", szBuf, sizeof(szBuf));
    129         if (RT_SUCCESS(rc))
     128        int vrc = NetIfAdpCtlOut(pszName, "speed", szBuf, sizeof(szBuf));
     129        if (RT_SUCCESS(vrc))
    130130            uSpeed = RTStrToUInt32(szBuf);
    131131    }
     
    230230{
    231231    char szDefaultIface[256];
    232     int rc = getDefaultIfaceName(szDefaultIface, sizeof(szDefaultIface));
    233     if (RT_FAILURE(rc))
     232    int vrc = getDefaultIfaceName(szDefaultIface, sizeof(szDefaultIface));
     233    if (RT_FAILURE(vrc))
    234234    {
    235235        Log(("NetIfList: Failed to find default interface.\n"));
     
    253253                NETIFINFO Info;
    254254                RT_ZERO(Info);
    255                 rc = getInterfaceInfo(sock, pszName, &Info);
    256                 if (RT_FAILURE(rc))
     255                vrc = getInterfaceInfo(sock, pszName, &Info);
     256                if (RT_FAILURE(vrc))
    257257                    break;
    258258                if (Info.enmMediumType == NETIF_T_ETHERNET)
     
    282282    }
    283283    else
    284         rc = VERR_INTERNAL_ERROR;
    285 
    286     return rc;
     284        vrc = VERR_INTERNAL_ERROR;
     285
     286    return vrc;
    287287}
    288288
    289289int NetIfGetConfigByName(PNETIFINFO pInfo)
    290290{
    291     int rc = VINF_SUCCESS;
    292291    int sock = socket(AF_INET, SOCK_DGRAM, 0);
    293292    if (sock < 0)
    294293        return VERR_NOT_IMPLEMENTED;
    295     rc = getInterfaceInfo(sock, pInfo->szShortName, pInfo);
     294    int vrc = getInterfaceInfo(sock, pInfo->szShortName, pInfo);
    296295    close(sock);
    297     return rc;
     296    return vrc;
    298297}
    299298
  • trunk/src/VBox/Main/src-server/linux/PerformanceLinux.cpp

    r98103 r98288  
    114114
    115115    uint64_t cb;
    116     int rc = RTSystemQueryTotalRam(&cb);
    117     if (RT_FAILURE(rc))
     116    int vrc = RTSystemQueryTotalRam(&cb);
     117    if (RT_FAILURE(vrc))
    118118        mTotalRAM = 0;
    119119    else
     
    130130    {
    131131        VMProcessStats vmStats;
    132         int rc = getRawProcessStats(*it, &vmStats.cpuUser, &vmStats.cpuKernel, &vmStats.pagesUsed);
     132        int vrc = getRawProcessStats(*it, &vmStats.cpuUser, &vmStats.cpuKernel, &vmStats.pagesUsed);
    133133        /* On failure, do NOT stop. Just skip the entry. Having the stats for
    134134         * one (probably broken) process frozen/zero is a minor issue compared
    135135         * to not updating many process stats and the host cpu stats. */
    136         if (RT_SUCCESS(rc))
     136        if (RT_SUCCESS(vrc))
    137137            mProcessStats[*it] = vmStats;
    138138    }
     
    146146int CollectorLinux::_getRawHostCpuLoad()
    147147{
    148     int rc = VINF_SUCCESS;
     148    int vrc = VINF_SUCCESS;
    149149    long long unsigned uUser, uNice, uKernel, uIdle, uIowait, uIrq, uSoftirq;
    150150    FILE *f = fopen("/proc/stat", "r");
     
    184184            }
    185185            else
    186                 rc = VERR_FILE_IO_ERROR;
     186                vrc = VERR_FILE_IO_ERROR;
    187187        }
    188188        else
    189             rc = VERR_FILE_IO_ERROR;
     189            vrc = VERR_FILE_IO_ERROR;
    190190        fclose(f);
    191191    }
    192192    else
    193         rc = VERR_ACCESS_DENIED;
    194 
    195     return rc;
     193        vrc = VERR_ACCESS_DENIED;
     194
     195    return vrc;
    196196}
    197197
     
    223223    AssertReturn(mTotalRAM, VERR_INTERNAL_ERROR);
    224224    uint64_t cb;
    225     int rc = RTSystemQueryAvailableRam(&cb);
    226     if (RT_SUCCESS(rc))
     225    int vrc = RTSystemQueryAvailableRam(&cb);
     226    if (RT_SUCCESS(vrc))
    227227    {
    228228        *total = mTotalRAM;
     
    230230        *used = *total - *available;
    231231    }
    232     return rc;
     232    return vrc;
    233233}
    234234
     
    257257    Assert(pszPath);
    258258
    259     int rc = VINF_SUCCESS;
     259    int vrc = VINF_SUCCESS;
    260260    if (!RTLinuxSysFsExists(pszPath))
    261         rc = VERR_FILE_NOT_FOUND;
     261        vrc = VERR_FILE_NOT_FOUND;
    262262    else
    263263    {
    264264        int64_t cSize = 0;
    265         rc = RTLinuxSysFsReadIntFile(0, &cSize, pszPath);
    266         if (RT_SUCCESS(rc))
     265        vrc = RTLinuxSysFsReadIntFile(0, &cSize, pszPath);
     266        if (RT_SUCCESS(vrc))
    267267            *size = cSize * 512;
    268268    }
    269269    RTStrFree(pszPath);
    270     return rc;
     270    return vrc;
    271271}
    272272
     
    286286int CollectorLinux::getRawProcessStats(RTPROCESS process, uint64_t *cpuUser, uint64_t *cpuKernel, ULONG *memPagesUsed)
    287287{
    288     int rc = VINF_SUCCESS;
     288    int vrc = VINF_SUCCESS;
    289289    char *pszName;
    290290    pid_t pid2;
     
    316316        }
    317317        else
    318             rc = VERR_FILE_IO_ERROR;
     318            vrc = VERR_FILE_IO_ERROR;
    319319        fclose(f);
    320320    }
    321321    else
    322         rc = VERR_ACCESS_DENIED;
    323 
    324     return rc;
     322        vrc = VERR_ACCESS_DENIED;
     323
     324    return vrc;
    325325}
    326326
     
    334334
    335335    int64_t cSize = 0;
    336     int rc = RTLinuxSysFsReadIntFile(0, &cSize, szIfName);
    337     if (RT_FAILURE(rc))
    338         return rc;
     336    int vrc = RTLinuxSysFsReadIntFile(0, &cSize, szIfName);
     337    if (RT_FAILURE(vrc))
     338        return vrc;
    339339
    340340    *rx = cSize;
     
    344344        return VERR_FILE_NOT_FOUND;
    345345
    346     rc = RTLinuxSysFsReadIntFile(0, &cSize, szIfName);
    347     if (RT_FAILURE(rc))
    348         return rc;
     346    vrc = RTLinuxSysFsReadIntFile(0, &cSize, szIfName);
     347    if (RT_FAILURE(vrc))
     348        return vrc;
    349349
    350350    *tx = cSize;
     
    355355{
    356356#if 0
    357     int rc = VINF_SUCCESS;
     357    int vrc = VINF_SUCCESS;
    358358    char szIfName[/*IFNAMSIZ*/ 16 + 36];
    359359    long long unsigned int u64Busy, tmp;
     
    370370        }
    371371        else
    372             rc = VERR_FILE_IO_ERROR;
     372            vrc = VERR_FILE_IO_ERROR;
    373373        fclose(f);
    374374    }
    375375    else
    376         rc = VERR_ACCESS_DENIED;
     376        vrc = VERR_ACCESS_DENIED;
    377377#else
    378     int rc = VERR_MISSING;
     378    int vrc = VERR_MISSING;
    379379    FILE *f = fopen("/proc/diskstats", "r");
    380380    if (f)
     
    406406                    *disk_ms   = u64Busy;
    407407                    *total_ms  = (uint64_t)(mSingleUser + mSingleKernel + mSingleIdle) * 1000 / mHZ;
    408                     rc = VINF_SUCCESS;
     408                    vrc = VINF_SUCCESS;
    409409                }
    410410                else
    411                     rc = VERR_FILE_IO_ERROR;
     411                    vrc = VERR_FILE_IO_ERROR;
    412412                break;
    413413            }
     
    417417#endif
    418418
    419     return rc;
     419    return vrc;
    420420}
    421421
     
    525525{
    526526    char szVolInfo[RTPATH_MAX];
    527     int rc = RTPathAppPrivateArch(szVolInfo,
    528                                   sizeof(szVolInfo) - sizeof("/" VBOXVOLINFO_NAME " ") - strlen(pcszVolume));
    529     if (RT_FAILURE(rc))
    530     {
    531         LogRel(("VolInfo: Failed to get program path, rc=%Rrc\n", rc));
     527    int vrc = RTPathAppPrivateArch(szVolInfo, sizeof(szVolInfo) - sizeof("/" VBOXVOLINFO_NAME " ") - strlen(pcszVolume));
     528    if (RT_FAILURE(vrc))
     529    {
     530        LogRel(("VolInfo: Failed to get program path, vrc=%Rrc\n", vrc));
    532531        return;
    533532    }
     
    568567                char szFsName[1024];
    569568                /* Try to resolve symbolic link if necessary. Yes, we access the file system here! */
    570                 int rc = RTPathReal(mntent->mnt_fsname, szFsName, sizeof(szFsName));
    571                 if (RT_FAILURE(rc))
     569                int vrc = RTPathReal(mntent->mnt_fsname, szFsName, sizeof(szFsName));
     570                if (RT_FAILURE(vrc))
    572571                    continue; /* something got wrong, just ignore this path */
    573572                /* check against the actual mtab entry, NOT the real path as /dev/mapper/xyz is
  • trunk/src/VBox/Main/src-server/linux/USBGetDevices.cpp

    r98103 r98288  
    293293        }
    294294
    295         int rc = usbfsReadSkipSuffix(&pszNext);
    296         if (RT_FAILURE(rc))
    297             return rc;
     295        int vrc = usbfsReadSkipSuffix(&pszNext);
     296        if (RT_FAILURE(vrc))
     297            return vrc;
    298298
    299299        *ppszNext = pszNext;
     
    379379         * Validate and skip stuff following the number.
    380380         */
    381         int rc = usbfsReadSkipSuffix(&pszNext);
    382         if (RT_FAILURE(rc))
    383             return rc;
     381        int vrc = usbfsReadSkipSuffix(&pszNext);
     382        if (RT_FAILURE(vrc))
     383            return vrc;
    384384        *ppszNext = pszNext;
    385385
     
    471471/** Just a worker for USBProxyServiceLinux::getDevices that avoids some code duplication. */
    472472static int usbfsAddDeviceToChain(PUSBDEVICE pDev, PUSBDEVICE *ppFirst, PUSBDEVICE **pppNext, const char *pszUsbfsRoot,
    473                                  bool fUnsupportedDevicesToo, int rc)
     473                                 bool fUnsupportedDevicesToo, int vrc)
    474474{
    475475    /* usbDeterminState requires the address. */
     
    495495        {
    496496            deviceFree(pDevNew);
    497             rc = VERR_NO_MEMORY;
     497            vrc = VERR_NO_MEMORY;
    498498        }
    499499    }
    500500    else
    501501    {
    502         rc = VERR_NO_MEMORY;
     502        vrc = VERR_NO_MEMORY;
    503503        deviceFreeMembers(pDev);
    504504    }
    505505
    506     return rc;
     506    return vrc;
    507507}
    508508
     
    535535    PUSBDEVICE pFirst = NULL;
    536536    FILE *pFile = NULL;
    537     int rc;
    538     rc = usbfsOpenDevicesFile(pszUsbfsRoot, &pFile);
    539     if (RT_SUCCESS(rc))
     537    int vrc = usbfsOpenDevicesFile(pszUsbfsRoot, &pFile);
     538    if (RT_SUCCESS(vrc))
    540539    {
    541540        PUSBDEVICE     *ppNext = NULL;
     
    547546
    548547        /* Set close on exit and hope no one is racing us. */
    549         rc = fcntl(fileno(pFile), F_SETFD, FD_CLOEXEC) >= 0
    550            ? VINF_SUCCESS
    551            : RTErrConvertFromErrno(errno);
    552         while (     RT_SUCCESS(rc)
    553                &&   fgets(szLine, sizeof(szLine), pFile))
     548        vrc = fcntl(fileno(pFile), F_SETFD, FD_CLOEXEC) >= 0
     549            ? VINF_SUCCESS
     550            : RTErrConvertFromErrno(errno);
     551        while (   RT_SUCCESS(vrc)
     552               && fgets(szLine, sizeof(szLine), pFile))
    554553        {
    555554            char   *psz;
     
    596595                    AssertMsg(cHits >= 3 || cHits == 0, ("cHits=%d\n", cHits));
    597596                    if (cHits >= 3)
    598                         rc = usbfsAddDeviceToChain(&Dev, &pFirst, &ppNext, pszUsbfsRoot, fUnsupportedDevicesToo, rc);
     597                        vrc = usbfsAddDeviceToChain(&Dev, &pFirst, &ppNext, pszUsbfsRoot, fUnsupportedDevicesToo, vrc);
    599598                    else
    600599                        deviceFreeMembers(&Dev);
     
    606605
    607606                    /* parse the line. */
    608                     while (*psz && RT_SUCCESS(rc))
     607                    while (*psz && RT_SUCCESS(vrc))
    609608                    {
    610609                        if (PREFIX("Bus="))
    611                             rc = usbfsRead8(pszValue, 10, &Dev.bBus, &psz);
     610                            vrc = usbfsRead8(pszValue, 10, &Dev.bBus, &psz);
    612611                        else if (PREFIX("Port="))
    613                             rc = usbfsRead8(pszValue, 10, &Dev.bPort, &psz);
     612                            vrc = usbfsRead8(pszValue, 10, &Dev.bPort, &psz);
    614613                        else if (PREFIX("Spd="))
    615                             rc = usbfsReadSpeed(pszValue, &Dev.enmSpeed, &psz);
     614                            vrc = usbfsReadSpeed(pszValue, &Dev.enmSpeed, &psz);
    616615                        else if (PREFIX("Dev#="))
    617                             rc = usbfsRead8(pszValue, 10, &Dev.bDevNum, &psz);
     616                            vrc = usbfsRead8(pszValue, 10, &Dev.bDevNum, &psz);
    618617                        else
    619618                            psz = usbfsReadSkip(psz);
     
    644643                 */
    645644                case 'D':
    646                     while (*psz && RT_SUCCESS(rc))
     645                    while (*psz && RT_SUCCESS(vrc))
    647646                    {
    648647                        if (PREFIX("Ver="))
    649                             rc = usbfsReadBCD(pszValue, 16, &Dev.bcdUSB, &psz);
     648                            vrc = usbfsReadBCD(pszValue, 16, &Dev.bcdUSB, &psz);
    650649                        else if (PREFIX("Cls="))
    651650                        {
    652                             rc = usbfsRead8(pszValue, 16, &Dev.bDeviceClass, &psz);
    653                             if (RT_SUCCESS(rc) && Dev.bDeviceClass == 9 /* HUB */)
     651                            vrc = usbfsRead8(pszValue, 16, &Dev.bDeviceClass, &psz);
     652                            if (RT_SUCCESS(vrc) && Dev.bDeviceClass == 9 /* HUB */)
    654653                                Dev.enmState = USBDEVICESTATE_UNSUPPORTED;
    655654                        }
    656655                        else if (PREFIX("Sub="))
    657                             rc = usbfsRead8(pszValue, 16, &Dev.bDeviceSubClass, &psz);
     656                            vrc = usbfsRead8(pszValue, 16, &Dev.bDeviceSubClass, &psz);
    658657                        else if (PREFIX("Prot="))
    659                             rc = usbfsRead8(pszValue, 16, &Dev.bDeviceProtocol, &psz);
     658                            vrc = usbfsRead8(pszValue, 16, &Dev.bDeviceProtocol, &psz);
    660659                        //else if (PREFIX("MxPS="))
    661                         //    rc = usbRead16(pszValue, 10, &Dev.wMaxPacketSize, &psz);
     660                        //    vrc = usbRead16(pszValue, 10, &Dev.wMaxPacketSize, &psz);
    662661                        else if (PREFIX("#Cfgs="))
    663                             rc = usbfsRead8(pszValue, 10, &Dev.bNumConfigurations, &psz);
     662                            vrc = usbfsRead8(pszValue, 10, &Dev.bNumConfigurations, &psz);
    664663                        else
    665664                            psz = usbfsReadSkip(psz);
     
    677676                 */
    678677                case 'P':
    679                     while (*psz && RT_SUCCESS(rc))
     678                    while (*psz && RT_SUCCESS(vrc))
    680679                    {
    681680                        if (PREFIX("Vendor="))
    682                             rc = usbfsRead16(pszValue, 16, &Dev.idVendor, &psz);
     681                            vrc = usbfsRead16(pszValue, 16, &Dev.idVendor, &psz);
    683682                        else if (PREFIX("ProdID="))
    684                             rc = usbfsRead16(pszValue, 16, &Dev.idProduct, &psz);
     683                            vrc = usbfsRead16(pszValue, 16, &Dev.idProduct, &psz);
    685684                        else if (PREFIX("Rev="))
    686                             rc = usbfsReadBCD(pszValue, 16, &Dev.bcdDevice, &psz);
     685                            vrc = usbfsReadBCD(pszValue, 16, &Dev.bcdDevice, &psz);
    687686                        else
    688687                            psz = usbfsReadSkip(psz);
     
    697696                case 'S':
    698697                    if (PREFIX("Manufacturer="))
    699                         rc = usbfsReadStr(pszValue, &Dev.pszManufacturer);
     698                        vrc = usbfsReadStr(pszValue, &Dev.pszManufacturer);
    700699                    else if (PREFIX("Product="))
    701                         rc = usbfsReadStr(pszValue, &Dev.pszProduct);
     700                        vrc = usbfsReadStr(pszValue, &Dev.pszProduct);
    702701                    else if (PREFIX("SerialNumber="))
    703702                    {
    704                         rc = usbfsReadStr(pszValue, &Dev.pszSerialNumber);
    705                         if (RT_SUCCESS(rc))
     703                        vrc = usbfsReadStr(pszValue, &Dev.pszSerialNumber);
     704                        if (RT_SUCCESS(vrc))
    706705                            Dev.u64SerialHash = USBLibHashSerial(pszValue);
    707706                    }
     
    735734                {
    736735                    /* Check for thing we don't support.  */
    737                     while (*psz && RT_SUCCESS(rc))
     736                    while (*psz && RT_SUCCESS(vrc))
    738737                    {
    739738                        if (PREFIX("Driver="))
    740739                        {
    741740                            const char *pszDriver = NULL;
    742                             rc = usbfsReadStr(pszValue, &pszDriver);
     741                            vrc = usbfsReadStr(pszValue, &pszDriver);
    743742                            if (   !pszDriver
    744743                                || !*pszDriver
     
    756755                        {
    757756                            uint8_t bInterfaceClass;
    758                             rc = usbfsRead8(pszValue, 16, &bInterfaceClass, &psz);
    759                             if (RT_SUCCESS(rc) && bInterfaceClass == 9 /* HUB */)
     757                            vrc = usbfsRead8(pszValue, 16, &bInterfaceClass, &psz);
     758                            if (RT_SUCCESS(vrc) && bInterfaceClass == 9 /* HUB */)
    760759                                Dev.enmState = USBDEVICESTATE_UNSUPPORTED;
    761760                        }
     
    789788        AssertMsg(cHits >= 3 || cHits == 0, ("cHits=%d\n", cHits));
    790789        if (cHits >= 3)
    791             rc = usbfsAddDeviceToChain(&Dev, &pFirst, &ppNext, pszUsbfsRoot, fUnsupportedDevicesToo, rc);
     790            vrc = usbfsAddDeviceToChain(&Dev, &pFirst, &ppNext, pszUsbfsRoot, fUnsupportedDevicesToo, vrc);
    792791
    793792        /*
    794793         * Success?
    795794         */
    796         if (RT_FAILURE(rc))
     795        if (RT_FAILURE(vrc))
    797796        {
    798797            while (pFirst)
     
    804803        }
    805804    }
    806     if (RT_FAILURE(rc))
    807         LogFlow(("USBProxyServiceLinux::getDevices: rc=%Rrc\n", rc));
     805    if (RT_FAILURE(vrc))
     806        LogFlow(("USBProxyServiceLinux::getDevices: vrc=%Rrc\n", vrc));
    808807    return pFirst;
    809808}
     
    892891
    893892    int64_t device;
    894     int rc = RTLinuxSysFsReadIntFile(10, &device, "%s/devnum", pszNode);
    895     if (RT_FAILURE(rc))
     893    int vrc = RTLinuxSysFsReadIntFile(10, &device, "%s/devnum", pszNode);
     894    if (RT_FAILURE(vrc))
    896895        return VINF_SUCCESS;
    897896
     
    901900
    902901    char szDevPath[RTPATH_MAX];
    903     rc = RTLinuxCheckDevicePath(devnum, RTFS_TYPE_DEV_CHAR,
    904                                 szDevPath, sizeof(szDevPath),
    905                                 "%s/%.3d/%.3d",
    906                                 pszDevicesRoot, bus, device);
    907     if (RT_FAILURE(rc))
     902    vrc = RTLinuxCheckDevicePath(devnum, RTFS_TYPE_DEV_CHAR, szDevPath, sizeof(szDevPath),
     903                                 "%s/%.3d/%.3d", pszDevicesRoot, bus, device);
     904    if (RT_FAILURE(vrc))
    908905        return VINF_SUCCESS;
    909906
     
    911908    if (usbsysfsInitDevInfo(&info, szDevPath, pszNode))
    912909    {
    913         rc = VEC_PUSH_BACK_OBJ(pvecDevInfo, USBDeviceInfo, &info);
    914         if (RT_SUCCESS(rc))
     910        vrc = VEC_PUSH_BACK_OBJ(pvecDevInfo, USBDeviceInfo, &info);
     911        if (RT_SUCCESS(vrc))
    915912            return VINF_SUCCESS;
    916913    }
     
    991988    if (pszDup)
    992989    {
    993         int rc = VEC_PUSH_BACK_PTR(&pInfo->mvecpszInterfaces, char *, pszDup);
    994         if (RT_SUCCESS(rc))
     990        int vrc = VEC_PUSH_BACK_PTR(&pInfo->mvecpszInterfaces, char *, pszDup);
     991        if (RT_SUCCESS(vrc))
    995992            return VINF_SUCCESS;
    996993        RTStrFree(pszDup);
     
    10101007{
    10111008    struct dirent entry, *pResult;
    1012     int err, rc;
     1009    int err;
    10131010
    10141011#if RT_GNUC_PREREQ(4, 6)
     
    10331030        if (!pszPathCopy)
    10341031            return VERR_NO_MEMORY;
    1035         if (RT_FAILURE(rc = VEC_PUSH_BACK_PTR(pvecpchDevs, char *, pszPathCopy)))
    1036             return rc;
     1032        int vrc = VEC_PUSH_BACK_PTR(pvecpchDevs, char *, pszPathCopy);
     1033        if (RT_FAILURE(vrc))
     1034            return vrc;
    10371035    }
    10381036    return RTErrConvertFromErrno(err);
     
    10581056    if (!pDir)
    10591057        return RTErrConvertFromErrno(errno);
    1060     int rc = usbsysfsReadFilePathsFromDir(pszPath, pDir, pvecpchDevs);
    1061     if (closedir(pDir) < 0 && RT_SUCCESS(rc))
    1062         rc = RTErrConvertFromErrno(errno);
    1063     return rc;
     1058    int vrc = usbsysfsReadFilePathsFromDir(pszPath, pDir, pvecpchDevs);
     1059    if (closedir(pDir) < 0 && RT_SUCCESS(vrc))
     1060        vrc = RTErrConvertFromErrno(errno);
     1061    return vrc;
    10641062}
    10651063
     
    10811079    LogFlowFunc (("pvecDevInfo=%p\n", pvecDevInfo));
    10821080
    1083     int rc = usbsysfsReadFilePaths("/sys/bus/usb/devices", pvecpchDevs);
    1084     if (RT_FAILURE(rc))
    1085         return rc;
     1081    int vrc = usbsysfsReadFilePaths("/sys/bus/usb/devices", pvecpchDevs);
     1082    if (RT_FAILURE(vrc))
     1083        return vrc;
    10861084
    10871085    char **ppszEntry;
    10881086    VEC_FOR_EACH(pvecpchDevs, char *, ppszEntry)
    10891087    {
    1090         rc = usbsysfsAddIfDevice(pszDevicesRoot, *ppszEntry, pvecDevInfo);
    1091         if (RT_FAILURE(rc))
    1092             return rc;
     1088        vrc = usbsysfsAddIfDevice(pszDevicesRoot, *ppszEntry, pvecDevInfo);
     1089        if (RT_FAILURE(vrc))
     1090            return vrc;
    10931091    }
    10941092
     
    10971095        VEC_FOR_EACH(pvecpchDevs, char *, ppszEntry)
    10981096        {
    1099             rc = usbsysfsAddIfInterfaceOf(*ppszEntry, pInfo);
    1100             if (RT_FAILURE(rc))
    1101                 return rc;
     1097            vrc = usbsysfsAddIfInterfaceOf(*ppszEntry, pInfo);
     1098            if (RT_FAILURE(vrc))
     1099                return vrc;
    11021100        }
    11031101    return VINF_SUCCESS;
     
    11121110    LogFlowFunc(("entered\n"));
    11131111    VEC_INIT_PTR(&vecpchDevs, char *, RTStrFree);
    1114     int rc = usbsysfsEnumerateHostDevicesWorker(pszDevicesRoot, pvecDevInfo, &vecpchDevs);
     1112    int vrc = usbsysfsEnumerateHostDevicesWorker(pszDevicesRoot, pvecDevInfo, &vecpchDevs);
    11151113    VEC_CLEANUP_PTR(&vecpchDevs);
    1116     LogFlowFunc(("rc=%Rrc\n", rc));
    1117     return rc;
     1114    LogFlowFunc(("vrc=%Rrc\n", vrc));
     1115    return vrc;
    11181116}
    11191117
     
    11851183                            ? pchDot  + 1
    11861184                            : pchDash + 1;
    1187     int rc = RTStrToUInt8Full(pszLastPort, 10, pu8Port);
    1188     if (rc != VINF_SUCCESS)
    1189     {
    1190         Log(("usbGetPortFromSysfsPath(%s): failed [3], rc=%Rrc\n", pszPath, rc));
     1185    int vrc = RTStrToUInt8Full(pszLastPort, 10, pu8Port);
     1186    if (vrc != VINF_SUCCESS)
     1187    {
     1188        Log(("usbGetPortFromSysfsPath(%s): failed [3], vrc=%Rrc\n", pszPath, vrc));
    11911189        return VERR_INVALID_PARAMETER;
    11921190    }
     
    12191217
    12201218    pszBuf = RTStrStripL(pszBuf);
    1221     int rc = RTStrToInt32Ex(pszBuf, &pszNext, 16, &i32);
    1222     if (   RT_FAILURE(rc)
    1223         || rc == VWRN_NUMBER_TOO_BIG
     1219    int vrc = RTStrToInt32Ex(pszBuf, &pszNext, 16, &i32);
     1220    if (   RT_FAILURE(vrc)
     1221        || vrc == VWRN_NUMBER_TOO_BIG
    12241222        || i32 < 0)
    12251223        return VERR_NUMBER_TOO_BIG;
     
    12291227            return VERR_NUMBER_TOO_BIG;
    12301228        int32_t i32Lo;
    1231         rc = RTStrToInt32Ex(pszNext+1, &pszNext, 16, &i32Lo);
    1232         if (   RT_FAILURE(rc)
    1233             || rc == VWRN_NUMBER_TOO_BIG
     1229        vrc = RTStrToInt32Ex(pszNext+1, &pszNext, 16, &i32Lo);
     1230        if (   RT_FAILURE(vrc)
     1231            || vrc == VWRN_NUMBER_TOO_BIG
    12341232            || i32Lo > 255
    12351233            || i32Lo < 0)
     
    12521250 * @returns uint8_t value of the given property.
    12531251 * @param   uBase       The base of the number in the sysfs property.
    1254  * @param   bDef        The default to set on error.
     1252 * @param   fDef        The default to set on error.
    12551253 * @param   pszFormat   The format string for the property.
    12561254 * @param   ...         Arguments for the format string.
    12571255 */
    1258 static uint8_t usbsysfsReadDevicePropertyU8Def(unsigned uBase, uint8_t bDef, const char *pszFormat, ...)
     1256static uint8_t usbsysfsReadDevicePropertyU8Def(unsigned uBase, uint8_t fDef, const char *pszFormat, ...)
    12591257{
    12601258    int64_t i64Tmp = 0;
     
    12621260    va_list va;
    12631261    va_start(va, pszFormat);
    1264     int rc = RTLinuxSysFsReadIntFileV(uBase, &i64Tmp, pszFormat, va);
     1262    int vrc = RTLinuxSysFsReadIntFileV(uBase, &i64Tmp, pszFormat, va);
    12651263    va_end(va);
    1266     if (RT_SUCCESS(rc))
     1264    if (RT_SUCCESS(vrc))
    12671265        return (uint8_t)i64Tmp;
    1268     else
    1269         return bDef;
     1266    return fDef;
    12701267}
    12711268
     
    12871284    va_list va;
    12881285    va_start(va, pszFormat);
    1289     int rc = RTLinuxSysFsReadIntFileV(uBase, &i64Tmp, pszFormat, va);
     1286    int vrc = RTLinuxSysFsReadIntFileV(uBase, &i64Tmp, pszFormat, va);
    12901287    va_end(va);
    1291     if (RT_SUCCESS(rc))
     1288    if (RT_SUCCESS(vrc))
    12921289        return (uint16_t)i64Tmp;
    1293     else
    1294         return u16Def;
     1290    return u16Def;
    12951291}
    12961292
     
    12981294static void usbsysfsFillInDevice(USBDEVICE *pDev, USBDeviceInfo *pInfo)
    12991295{
    1300     int rc;
     1296    int vrc;
    13011297    const char *pszSysfsPath = pInfo->mSysfsPath;
    13021298
     
    13191315
    13201316    /* For simplicity, we just do strcmps on the next one. */
    1321     rc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/speed", pszSysfsPath);
    1322     if (RT_FAILURE(rc) || cchRead == sizeof(szBuf))
     1317    vrc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/speed", pszSysfsPath);
     1318    if (RT_FAILURE(vrc) || cchRead == sizeof(szBuf))
    13231319        pDev->enmState = USBDEVICESTATE_UNSUPPORTED;
    13241320    else
     
    13291325                       : USBDEVICESPEED_UNKNOWN;
    13301326
    1331     rc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/version", pszSysfsPath);
    1332     if (RT_FAILURE(rc) || cchRead == sizeof(szBuf))
     1327    vrc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/version", pszSysfsPath);
     1328    if (RT_FAILURE(vrc) || cchRead == sizeof(szBuf))
    13331329        pDev->enmState = USBDEVICESTATE_UNSUPPORTED;
    13341330    else
    13351331    {
    1336         rc = usbsysfsConvertStrToBCD(szBuf, &pDev->bcdUSB);
    1337         if (RT_FAILURE(rc))
     1332        vrc = usbsysfsConvertStrToBCD(szBuf, &pDev->bcdUSB);
     1333        if (RT_FAILURE(vrc))
    13381334        {
    13391335            pDev->enmState = USBDEVICESTATE_UNSUPPORTED;
     
    13421338    }
    13431339
    1344     rc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/bcdDevice", pszSysfsPath);
    1345     if (RT_FAILURE(rc) || cchRead == sizeof(szBuf))
     1340    vrc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/bcdDevice", pszSysfsPath);
     1341    if (RT_FAILURE(vrc) || cchRead == sizeof(szBuf))
    13461342        pDev->bcdDevice = UINT16_MAX;
    13471343    else
    13481344    {
    1349         rc = usbsysfsConvertStrToBCD(szBuf, &pDev->bcdDevice);
    1350         if (RT_FAILURE(rc))
     1345        vrc = usbsysfsConvertStrToBCD(szBuf, &pDev->bcdDevice);
     1346        if (RT_FAILURE(vrc))
    13511347            pDev->bcdDevice = UINT16_MAX;
    13521348    }
    13531349
    13541350    /* Now do things that need string duplication */
    1355     rc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/product", pszSysfsPath);
    1356     if (RT_SUCCESS(rc) && cchRead < sizeof(szBuf))
     1351    vrc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/product", pszSysfsPath);
     1352    if (RT_SUCCESS(vrc) && cchRead < sizeof(szBuf))
    13571353    {
    13581354        USBLibPurgeEncoding(szBuf);
     
    13601356    }
    13611357
    1362     rc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/serial", pszSysfsPath);
    1363     if (RT_SUCCESS(rc) && cchRead < sizeof(szBuf))
     1358    vrc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/serial", pszSysfsPath);
     1359    if (RT_SUCCESS(vrc) && cchRead < sizeof(szBuf))
    13641360    {
    13651361        USBLibPurgeEncoding(szBuf);
     
    13681364    }
    13691365
    1370     rc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/manufacturer", pszSysfsPath);
    1371     if (RT_SUCCESS(rc) && cchRead < sizeof(szBuf))
     1366    vrc = RTLinuxSysFsReadStrFile(szBuf, sizeof(szBuf), &cchRead, "%s/manufacturer", pszSysfsPath);
     1367    if (RT_SUCCESS(vrc) && cchRead < sizeof(szBuf))
    13721368    {
    13731369        USBLibPurgeEncoding(szBuf);
     
    13831379    VEC_FOR_EACH(&pInfo->mvecpszInterfaces, char *, ppszIf)
    13841380    {
    1385         rc = RTLinuxSysFsGetLinkDest(szBuf, sizeof(szBuf), NULL, "%s/driver", *ppszIf);
    1386         if (RT_SUCCESS(rc) && pDev->enmState != USBDEVICESTATE_UNSUPPORTED)
     1381        vrc = RTLinuxSysFsGetLinkDest(szBuf, sizeof(szBuf), NULL, "%s/driver", *ppszIf);
     1382        if (RT_SUCCESS(vrc) && pDev->enmState != USBDEVICESTATE_UNSUPPORTED)
    13871383            pDev->enmState = (strcmp(szBuf, "hub") == 0)
    13881384                           ? USBDEVICESTATE_UNSUPPORTED
     
    14161412    VECTOR_OBJ(USBDeviceInfo) vecDevInfo;
    14171413    USBDeviceInfo *pInfo;
    1418     int rc;
    14191414
    14201415    VEC_INIT_OBJ(&vecDevInfo, USBDeviceInfo, usbsysfsCleanupDevInfo);
    1421     rc = usbsysfsEnumerateHostDevices(pszDevicesRoot, &vecDevInfo);
    1422     if (RT_FAILURE(rc))
     1416    int vrc = usbsysfsEnumerateHostDevices(pszDevicesRoot, &vecDevInfo);
     1417    if (RT_FAILURE(vrc))
    14231418        return NULL;
    14241419    VEC_FOR_EACH(&vecDevInfo, USBDeviceInfo, pInfo)
     
    14261421        USBDEVICE *pDev = (USBDEVICE *)RTMemAllocZ(sizeof(USBDEVICE));
    14271422        if (!pDev)
    1428             rc = VERR_NO_MEMORY;
    1429         if (RT_SUCCESS(rc))
     1423            vrc = VERR_NO_MEMORY;
     1424        if (RT_SUCCESS(vrc))
    14301425            usbsysfsFillInDevice(pDev, pInfo);
    1431         if (   RT_SUCCESS(rc)
     1426        if (   RT_SUCCESS(vrc)
    14321427            && (   pDev->enmState != USBDEVICESTATE_UNSUPPORTED
    14331428                || fUnsupportedDevicesToo)
     
    14451440        else
    14461441            deviceFree(pDev);
    1447         if (RT_FAILURE(rc))
     1442        if (RT_FAILURE(vrc))
    14481443            break;
    14491444    }
    1450     if (RT_FAILURE(rc))
     1445    if (RT_FAILURE(vrc))
    14511446        deviceListFree(&pFirst);
    14521447
  • trunk/src/VBox/Main/src-server/linux/USBProxyBackendLinux.cpp

    r98103 r98288  
    9999
    100100    const char *pcszDevicesRoot;
    101     int rc = USBProxyLinuxChooseMethod(&mUsingUsbfsDevices, &pcszDevicesRoot);
    102     if (RT_SUCCESS(rc))
     101    int vrc = USBProxyLinuxChooseMethod(&mUsingUsbfsDevices, &pcszDevicesRoot);
     102    if (RT_SUCCESS(vrc))
    103103    {
    104104        mDevicesRoot = pcszDevicesRoot;
    105         rc = mUsingUsbfsDevices ? initUsbfs() : initSysfs();
     105        vrc = mUsingUsbfsDevices ? initUsbfs() : initSysfs();
    106106        /* For the day when we have VBoxSVC release logging... */
    107         LogRel((RT_SUCCESS(rc) ? "Successfully initialised host USB using %s\n"
    108                                : "Failed to initialise host USB using %s\n",
     107        LogRel((RT_SUCCESS(vrc) ? "Successfully initialised host USB using %s\n"
     108                                : "Failed to initialise host USB using %s\n",
    109109                mUsingUsbfsDevices ? "USBFS" : "sysfs"));
    110110    }
    111111
    112     return rc;
     112    return vrc;
    113113}
    114114
     
    146146     * Open the devices file.
    147147     */
    148     int rc;
     148    int vrc;
    149149    char *pszDevices = RTPathJoinA(mDevicesRoot.c_str(), "devices");
    150150    if (pszDevices)
    151151    {
    152         rc = RTFileOpen(&mhFile, pszDevices, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
    153         if (RT_SUCCESS(rc))
     152        vrc = RTFileOpen(&mhFile, pszDevices, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE);
     153        if (RT_SUCCESS(vrc))
    154154        {
    155             rc = RTPipeCreate(&mhWakeupPipeR, &mhWakeupPipeW, 0 /*fFlags*/);
    156             if (RT_SUCCESS(rc))
     155            vrc = RTPipeCreate(&mhWakeupPipeR, &mhWakeupPipeW, 0 /*fFlags*/);
     156            if (RT_SUCCESS(vrc))
    157157            {
    158158                /*
    159159                 * Start the poller thread.
    160160                 */
    161                 rc = start();
    162                 if (RT_SUCCESS(rc))
     161                vrc = start();
     162                if (RT_SUCCESS(vrc))
    163163                {
    164164                    RTStrFree(pszDevices);
     
    172172            }
    173173            else
    174                 Log(("USBProxyBackendLinux::USBProxyBackendLinux: RTFilePipe failed with rc=%Rrc\n", rc));
     174                Log(("USBProxyBackendLinux::USBProxyBackendLinux: RTFilePipe failed with vrc=%Rrc\n", vrc));
    175175            RTFileClose(mhFile);
    176176        }
     
    180180    else
    181181    {
    182         rc = VERR_NO_MEMORY;
     182        vrc = VERR_NO_MEMORY;
    183183        Log(("USBProxyBackendLinux::USBProxyBackendLinux: out of memory!\n"));
    184184    }
    185185
    186     LogFlowThisFunc(("returns failure!!! (rc=%Rrc)\n", rc));
    187     return rc;
     186    LogFlowThisFunc(("returns failure!!! (vrc=%Rrc)\n", vrc));
     187    return vrc;
    188188}
    189189
     
    207207        return VERR_NO_MEMORY;
    208208    }
    209     int rc = mpWaiter->getStatus();
    210     if (RT_SUCCESS(rc) || rc == VERR_TIMEOUT || rc == VERR_TRY_AGAIN)
    211         rc = start();
    212     else if (rc == VERR_NOT_SUPPORTED)
     209    int vrc = mpWaiter->getStatus();
     210    if (RT_SUCCESS(vrc) || vrc == VERR_TIMEOUT || vrc == VERR_TRY_AGAIN)
     211        vrc = start();
     212    else if (vrc == VERR_NOT_SUPPORTED)
    213213        /* This can legitimately happen if hal or DBus are not running, but of
    214214         * course we can't start in this case. */
    215         rc = VINF_SUCCESS;
    216     return rc;
     215        vrc = VINF_SUCCESS;
     216    return vrc;
    217217
    218218#else  /* !VBOX_USB_WITH_SYSFS */
     
    307307int USBProxyBackendLinux::wait(RTMSINTERVAL aMillies)
    308308{
    309     int rc;
     309    int vrc;
    310310    if (mUsingUsbfsDevices)
    311         rc = waitUsbfs(aMillies);
     311        vrc = waitUsbfs(aMillies);
    312312    else
    313         rc = waitSysfs(aMillies);
    314     return rc;
     313        vrc = waitSysfs(aMillies);
     314    return vrc;
    315315}
    316316
     
    338338    PollFds[1].events    = POLLIN | POLLERR | POLLHUP;
    339339
    340     int rc = poll(&PollFds[0], 2, aMillies);
    341     if (rc == 0)
     340    int iRc = poll(&PollFds[0], 2, aMillies);
     341    if (iRc == 0)
    342342        return VERR_TIMEOUT;
    343     if (rc > 0)
     343    if (iRc > 0)
    344344    {
    345345        /* drain the pipe */
     
    347347        {
    348348            char szBuf[WAKE_UP_STRING_LEN];
    349             rc = RTPipeReadBlocking(mhWakeupPipeR, szBuf, sizeof(szBuf), NULL);
    350             AssertRC(rc);
     349            int vrc2 = RTPipeReadBlocking(mhWakeupPipeR, szBuf, sizeof(szBuf), NULL);
     350            AssertRC(vrc2);
    351351        }
    352352        return VINF_SUCCESS;
     
    359359{
    360360#ifdef VBOX_USB_WITH_SYSFS
    361     int rc = mpWaiter->Wait(aMillies);
    362     if (rc == VERR_TRY_AGAIN)
     361    int vrc = mpWaiter->Wait(aMillies);
     362    if (vrc == VERR_TRY_AGAIN)
    363363    {
    364364        RTThreadYield();
    365         rc = VINF_SUCCESS;
    366     }
    367     return rc;
     365        vrc = VINF_SUCCESS;
     366    }
     367    return vrc;
    368368#else  /* !VBOX_USB_WITH_SYSFS */
    369369    return USBProxyService::wait(aMillies);
     
    386386    }
    387387#endif /* VBOX_USB_WITH_SYSFS */
    388     int rc = RTPipeWriteBlocking(mhWakeupPipeW, WAKE_UP_STRING, WAKE_UP_STRING_LEN, NULL);
    389     if (RT_SUCCESS(rc))
     388    int vrc = RTPipeWriteBlocking(mhWakeupPipeW, WAKE_UP_STRING, WAKE_UP_STRING_LEN, NULL);
     389    if (RT_SUCCESS(vrc))
    390390        RTPipeFlush(mhWakeupPipeW);
    391     LogFlowFunc(("returning %Rrc\n", rc));
    392     return rc;
     391    LogFlowFunc(("returning %Rrc\n", vrc));
     392    return vrc;
    393393}
    394394
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