Changeset 32852 in vbox
- Timestamp:
- Sep 30, 2010 3:49:35 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/GuestControlSvc.h
r30013 r32852 62 62 /** Process timed out and was not killed successfully. */ 63 63 PROC_STS_TOA = 6, 64 /** Service is stopping, process was killed. */64 /** Service/OS is stopping, process was killed. */ 65 65 PROC_STS_DWN = 7, 66 66 /** Something went wrong (error code in flags). */ … … 88 88 /* The process status. */ 89 89 uint32_t u32Status; 90 /** Optional flags (not used atm). */90 /** Optional flags, varies, based on u32Status. */ 91 91 uint32_t u32Flags; 92 92 /** Optional data buffer (not used atm). */ -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp
r32777 r32852 258 258 259 259 AssertPtr(pThread); 260 261 AssertPtr(pThread); 260 Assert(pThread->enmType == VBoxServiceCtrlThreadDataExec); 262 261 PVBOXSERVICECTRLTHREADDATAEXEC pData = (PVBOXSERVICECTRLTHREADDATAEXEC)pThread->pvData; 263 262 AssertPtr(pData); … … 457 456 VBoxServiceVerbose(3, "ControlExec: Process got terminated because system/service is about to shutdown\n"); 458 457 uStatus = PROC_STS_DWN; /* Service is stopping, process was killed. */ 458 uFlags = pData->uFlags; /* Return handed-in execution flags back to the host. */ 459 459 } 460 460 else if (fProcessAlive) -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r32733 r32852 195 195 else if (!strcmp(a->argv[i], "--flags")) 196 196 { 197 if ( i + 1 >= a->argc 198 || RTStrToUInt32Full(a->argv[i + 1], 10, &uFlags) != VINF_SUCCESS) 199 usageOK = false; 200 else 201 ++i; 197 if (i + 1 >= a->argc) 198 usageOK = false; 199 else 200 { 201 /** @todo Needs a bit better processing as soon as we have more flags. */ 202 if (!strcmp(a->argv[i + 1], "ignoreorphanedchilds")) 203 uFlags |= ExecuteProcessFlag_IgnoreOrphanedProcesses; 204 else 205 usageOK = false; 206 ++i; 207 } 202 208 } 203 209 else if ( !strcmp(a->argv[i], "--username") … … 409 415 } 410 416 cbOutputData = 0; 417 fCompleted = true; /* rc contains a failure, so we'll go into aborted state down below. */ 411 418 } 412 419 else … … 489 496 if (FAILED(iRc)) 490 497 { 491 ComPtr<IVirtualBoxErrorInfo> execError; 492 rc = progress->COMGETTER(ErrorInfo)(execError.asOutParam()); 493 com::ErrorInfo info(execError, COM_IIDOF(IVirtualBoxErrorInfo)); 494 if (SUCCEEDED(rc) && info.isFullAvailable()) 498 com::ProgressErrorInfo info(progress); 499 if ( info.isFullAvailable() 500 || info.isBasicAvailable()) 495 501 { 496 502 /* If we got a VBOX_E_IPRT error we handle the error in a more gentle way … … 505 511 } 506 512 else 507 AssertMsgFailed(("Full error description is missing!\n")); 513 { 514 if (RT_FAILURE(rc)) 515 RTMsgError("Error while looking up error code, rc=%Rrc", rc); 516 else 517 com::GluePrintRCMessage(iRc); 518 } 508 519 } 509 520 else if (fVerbose) -
trunk/src/VBox/Main/GuestImpl.cpp
r32851 r32852 687 687 688 688 case PROC_STS_DWN: 689 LogRel(("Guest process (PID %u) exited because system is shutting down\n", pCBData->u32PID)); /** @todo Add process name */ 690 errMsg = Utf8StrFmt(Guest::tr("Process exited because system is shutting down")); 689 LogRel(("Guest process (PID %u) killed because system is shutting down\n", pCBData->u32PID)); /** @todo Add process name */ 690 /* 691 * If u32Flags has ExecuteProcessFlag_IgnoreOrphanedProcesses set, we don't report an error to 692 * our progress object. This is helpful for waiters which rely on the success of our progress object 693 * even if the executed process was killed because the system/VBoxService is shutting down. 694 * 695 * In this case u32Flags contains the actual execution flags reached in via Guest::ExecuteProcess(). 696 */ 697 if (pData->u32Flags & ExecuteProcessFlag_IgnoreOrphanedProcesses) 698 { 699 hr = it->second.pProgress->notifyComplete(S_OK); 700 AssertComRC(hr); 701 } 702 else 703 { 704 errMsg = Utf8StrFmt(Guest::tr("Process killed because system is shutting down")); 705 } 691 706 break; 692 707 … … 734 749 || fCanceled) /* If canceled we have to report E_FAIL! */ 735 750 { 751 /* Destroy all callbacks which are still waiting on something 752 * which is related to the current PID. */ 753 CallbackMapIter it2; 754 for (it2 = mCallbackMap.begin(); it2 != mCallbackMap.end(); it2++) 755 { 756 switch(it2->second.mType) 757 { 758 case VBOXGUESTCTRLCALLBACKTYPE_EXEC_START: 759 break; 760 761 /* When waiting for process output while the process is destroyed, 762 * make sure we also destroy the actual waiting operation (internal progress object) 763 * in order to not block the caller. */ 764 case VBOXGUESTCTRLCALLBACKTYPE_EXEC_OUTPUT: 765 { 766 PCALLBACKDATAEXECOUT pItData = (CALLBACKDATAEXECOUT*)it2->second.pvData; 767 AssertPtr(pItData); 768 if (pItData->u32PID == pCBData->u32PID) 769 destroyCtrlCallbackContext(it2); 770 break; 771 } 772 } 773 } 774 736 775 HRESULT hr2 = it->second.pProgress->notifyComplete(VBOX_E_IPRT_ERROR, 737 776 COM_IIDOF(IGuest), … … 967 1006 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 968 1007 969 if (aFlags != 0) /* Flags are not supported at the moment. */ 970 return E_INVALIDARG; 1008 /* Validate flags. */ 1009 if (aFlags) 1010 { 1011 if (!(aFlags & ExecuteProcessFlag_IgnoreOrphanedProcesses)) 1012 return E_INVALIDARG; 1013 } 971 1014 972 1015 HRESULT rc = S_OK; … … 1277 1320 /* 1278 1321 * Create progress object. 1279 * This progress object, compared to the one in executeProgress() above ,1322 * This progress object, compared to the one in executeProgress() above 1280 1323 * is only local and is used to determine whether the operation finished 1281 1324 * or got canceled. … … 1299 1342 AssertReturn(pData, VBOX_E_IPRT_ERROR); 1300 1343 RT_ZERO(*pData); 1344 /* Save PID + output flags for later use. */ 1345 pData->u32PID = aPID; 1346 pData->u32Flags = aFlags; 1347 /* Add job to callback contexts. */ 1301 1348 uint32_t uContextID = addCtrlCallbackContext(VBOXGUESTCTRLCALLBACKTYPE_EXEC_OUTPUT, 1302 1349 pData, sizeof(CALLBACKDATAEXECOUT), progress); -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r32536 r32852 7702 7702 </enum> 7703 7703 7704 <enum 7705 name="ExecuteProcessFlag" 7706 uuid="9a24c17d-bd46-4207-b247-517fdd6d6b8f" 7707 > 7708 <desc> 7709 Guest process execution flags. 7710 </desc> 7711 7712 <const name="None" value="0"> 7713 <desc>No flag set.</desc> 7714 </const> 7715 7716 <const name="IgnoreOrphanedProcesses" value="2"> 7717 <desc>Do not report an error when executed processes are still alive when VBoxService or the guest OS is shutting down.</desc> 7718 </const> 7719 </enum> 7720 7704 7721 <interface 7705 7722 name="IGuest" extends="$unknown"
Note:
See TracChangeset
for help on using the changeset viewer.