VirtualBox

Changeset 28463 in vbox


Ignore:
Timestamp:
Apr 19, 2010 2:04:12 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
60250
Message:

Guest Control: Update (extended error info, callback bugfixes).

Location:
trunk/src/VBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp

    r28434 r28463  
    363363            if (cMsElapsed >= cMillies)
    364364            {
     365                VBoxServiceVerbose(3, "Control: Process timed out (%ums elapsed > %ums timeout), killing ...", cMsElapsed, cMillies);
     366
    365367                fProcessTimedOut = true;
    366368                if (    MsProcessKilled == UINT64_MAX
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp

    r28448 r28463  
    284284                /* Wait for process to exit ... */
    285285                ASSERT(progress);
    286                 rc = progress->WaitForCompletion(uTimeoutMS == 0 ? -1 /* Wait forever */ : uTimeoutMS);
     286                rc = progress->WaitForCompletion(uTimeoutMS == 0 ? -1 /* Wait forever */ : (uTimeoutMS + 5000));
    287287                if (FAILED(rc))
    288288                {
     
    300300                    LONG iRc;
    301301                    CHECK_ERROR_RET(progress, COMGETTER(ResultCode)(&iRc), rc);
    302 
    303                     if (verbose)
    304                         RTPrintf("Process completed.\n");
     302                    if (FAILED(iRc))
     303                    {
     304                        ComPtr<IVirtualBoxErrorInfo> execError;
     305                        rc = progress->COMGETTER(ErrorInfo)(execError.asOutParam());
     306                        com::ErrorInfo info (execError);
     307                        GluePrintErrorInfo(info);
     308                    }
     309                    else
     310                    {   
     311                        if (verbose)
     312                            RTPrintf("Process completed.\n");
     313                    }
    305314
    306315                    /* Print output if wanted. */
  • trunk/src/VBox/Main/GuestImpl.cpp

    r28448 r28463  
    492492                          PHOSTEXECCALLBACKDATA pData)
    493493{
     494    LogFlowFuncEnter();
    494495    int rc = VINF_SUCCESS;
    495496
     
    507508
    508509        /* Do progress handling. */
     510        Utf8Str errMsg;
     511        HRESULT rc2 = S_OK;
    509512        switch (pData->u32Status)
    510513        {
     514            case PROC_STS_STARTED:
     515                break;
     516
    511517            case PROC_STS_TEN: /* Terminated normally. */
     518                it->pProgress->notifyComplete(S_OK);
     519                break;
     520
    512521            case PROC_STS_TEA: /* Terminated abnormally. */
     522                errMsg = Utf8StrFmt(Guest::tr("Process terminated abnormally with status '%u'"),
     523                                    pCBData->u32Flags);
     524                break;
     525
    513526            case PROC_STS_TES: /* Terminated through signal. */
     527                errMsg = Utf8StrFmt(Guest::tr("Process terminated via signal with status '%u'"),
     528                                    pCBData->u32Flags);
     529                break;
     530
    514531            case PROC_STS_TOK:
     532                errMsg = Utf8StrFmt(Guest::tr("Process timed out and was killed"));
     533                break;
     534
    515535            case PROC_STS_TOA:
     536                errMsg = Utf8StrFmt(Guest::tr("Process timed out and could not be killed"));
     537                break;
     538
    516539            case PROC_STS_DWN:
    517 
    518                 if (!it->pProgress.isNull())
    519                     it->pProgress->notifyComplete(S_OK);
     540                errMsg = Utf8StrFmt(Guest::tr("Process exited because system is shutting down"));
    520541                break;
    521542
     
    524545        }
    525546
     547        if (   !it->pProgress.isNull()
     548            && errMsg.length())
     549        {
     550            it->pProgress->notifyComplete(E_FAIL /** @todo Find a better rc! */, COM_IIDOF(IGuest),
     551                                          (CBSTR)Guest::getComponentName(), errMsg.c_str());
     552        }
    526553        ASMAtomicWriteBool(&it->bCalled, true);
    527554    }
     555    LogFlowFuncLeave();
    528556    return rc;
    529557}
     
    542570void Guest::removeCtrlCallbackContext(Guest::CallbackListIter it)
    543571{
     572    LogFlowFuncEnter();
    544573    if (it->cbData)
    545574    {
     
    556585    }
    557586    mCallbackList.erase(it);
    558 }
    559 
     587    LogFlowFuncLeave();
     588}
     589
     590/* Adds a callback with a user provided data block and an optional progress object
     591 * to the callback list. A callback is identified by a unique context ID which is used
     592 * to identify a callback from the guest side. */
    560593uint32_t Guest::addCtrlCallbackContext(void *pvData, uint32_t cbData, Progress* pProgress)
    561594{
     595    LogFlowFuncEnter();
     596
    562597    uint32_t uNewContext = ASMAtomicIncU32(&mNextContextID);
    563598    /** @todo Add value clamping! */
     
    574609        removeCtrlCallbackContext(mCallbackList.begin());
    575610
     611    LogFlowFuncLeave();
    576612    return uNewContext;
    577613}
     
    608644         */
    609645        ComObjPtr <Progress> progress;
    610         HRESULT rc = progress.createObject();
     646        rc = progress.createObject();
    611647        if (SUCCEEDED(rc))
    612648        {
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