Changeset 42436 in vbox for trunk/src/VBox
- Timestamp:
- Jul 27, 2012 2:03:52 PM (12 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/GuestProcessImpl.h
r42411 r42436 90 90 inline int callbackRemove(ULONG uContextID); 91 91 inline bool isAlive(void); 92 HRESULT hgcmResultToError(int rc);93 92 int onGuestDisconnected(GuestCtrlCallback *pCallback, PCALLBACKDATACLIENTDISCONNECTED pData); 94 93 int onProcessInputStatus(GuestCtrlCallback *pCallback, PCALLBACKDATAEXECINSTATUS pData); … … 97 96 int prepareExecuteEnv(const char *pszEnv, void **ppvList, ULONG *pcbList, ULONG *pcEnvVars); 98 97 int sendCommand(uint32_t uFunction, uint32_t uParms, PVBOXHGCMSVCPARM paParms); 99 int signalWaiters(ProcessWaitResult_T enmWaitResult, int rc = VINF_SUCCESS); 98 int setErrorInternal(int rc, const Utf8Str &strMessage); 99 int setErrorExternal(void); 100 int signalWaiters(ProcessWaitResult_T enmWaitResult); 100 101 static DECLCALLBACK(int) startProcessThread(RTTHREAD Thread, void *pvUser); 101 102 HRESULT waitResultToErrorEx(const GuestProcessWaitResult &waitResult, bool fLog); … … 125 126 /** The current process status. */ 126 127 ProcessStatus_T mStatus; 128 /** The overall rc of the process execution. */ 129 int mRC; 130 /** The overall error message of the 131 * process execution. */ 132 Utf8Str mErrorMsg; 127 133 /** The next upcoming context ID. */ 128 134 ULONG mNextContextID; -
trunk/src/VBox/Main/include/GuestSessionImpl.h
r42412 r42436 117 117 typedef std::vector <ComObjPtr<GuestFile> > SessionFiles; 118 118 /** Map of guest processes. The key specifies the internal process number. 119 * To retrieve the process' guest PID use the Id() method of the IPro gress interface. */120 typedef std::map < ULONG, ComObjPtr<GuestProcess> > SessionProcesses;119 * To retrieve the process' guest PID use the Id() method of the IProcess interface. */ 120 typedef std::map <uint32_t, ComObjPtr<GuestProcess> > SessionProcesses; 121 121 122 122 public: -
trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp
r42411 r42436 702 702 703 703 #ifdef DEBUG 704 LogFlowFunc(("uSession=%RU32, uProcess=%RU32, uCount=%RU32\n", 704 LogFlowFunc(("CID=%RU32, uSession=%RU32, uProcess=%RU32, uCount=%RU32\n", 705 pHeader->u32ContextID, 705 706 VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(pHeader->u32ContextID), 706 707 VBOX_GUESTCTRL_CONTEXTID_GET_PROCESS(pHeader->u32ContextID), … … 2686 2687 LogFlowFuncEnter(); 2687 2688 2688 AssertPtrReturn(pvData, VERR_INVALID_POINTER);2689 AssertReturn(cbData, VERR_INVALID_PARAMETER);2690 2691 2689 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 2692 2690 2691 uint32_t uSessionID = VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(uContextID); 2692 #ifdef DEBUG 2693 LogFlowFunc(("uSessionID=%RU32 (%RU32 total)\n", 2694 uSessionID, mData.mGuestSessions.size())); 2695 #endif 2693 2696 int rc; 2694 2697 GuestSessions::const_iterator itSession 2695 = mData.mGuestSessions.find( VBOX_GUESTCTRL_CONTEXTID_GET_SESSION(uContextID));2698 = mData.mGuestSessions.find(uSessionID); 2696 2699 if (itSession != mData.mGuestSessions.end()) 2697 2700 { … … 2765 2768 2766 2769 mData.mGuestSessions[uNewSessionID] = pGuestSession; 2770 2771 LogFlowFunc(("Added new session with session ID=%RU32\n", 2772 uNewSessionID)); 2767 2773 } 2768 2774 catch (int rc2) … … 2818 2824 case VERR_MAX_PROCS_REACHED: 2819 2825 hr = setError(VBOX_E_IPRT_ERROR, tr("Maximum number of guest sessions (%ld) reached"), 2820 V ERR_MAX_PROCS_REACHED);2826 VBOX_GUESTCTRL_MAX_SESSIONS); 2821 2827 break; 2822 2828 -
trunk/src/VBox/Main/src-client/GuestCtrlPrivate.cpp
r42411 r42436 374 374 while (*pszString != '\0' && RT_SUCCESS(rc)) 375 375 { 376 if (!RT_C_IS_ALNUM(*pszString++)) 376 if ( !RT_C_IS_ALNUM(*pszString) 377 && !RT_C_IS_GRAPH(*pszString)) 377 378 rc = VERR_INVALID_PARAMETER; 379 *pszString++; 378 380 } 379 381 … … 406 408 strValue = listPair.at(p++); 407 409 408 rc = Set(strKey, strValue); 410 #ifdef DEBUG 411 LogFlowFunc(("strKey=%s, strValue=%s\n", 412 strKey.c_str(), strValue.c_str())); 413 #endif 414 rc = Set(strKey, strValue); 409 415 } 410 416 -
trunk/src/VBox/Main/src-client/GuestProcessImpl.cpp
r42412 r42436 41 41 { 42 42 GuestProcessTask(GuestProcess *pProcess) 43 : mProcess(pProcess) { } 44 45 ~GuestProcessTask(void) { } 46 47 int rc() const { return mRC; } 48 bool isOk() const { return RT_SUCCESS(rc()); } 43 : mProcess(pProcess), 44 mRC(VINF_SUCCESS) { } 45 46 virtual ~GuestProcessTask(void) { } 47 48 int rc(void) const { return mRC; } 49 bool isOk(void) const { return RT_SUCCESS(rc()); } 49 50 50 51 const ComObjPtr<GuestProcess> mProcess; … … 74 75 mData.mPID = 0; 75 76 mData.mProcessID = 0; 77 mData.mRC = VINF_SUCCESS; 76 78 mData.mStatus = ProcessStatus_Undefined; 77 79 … … 97 99 int GuestProcess::init(Console *aConsole, GuestSession *aSession, ULONG aProcessID, const GuestProcessInfo &aProcInfo) 98 100 { 101 LogFlowThisFunc(("aConsole=%p, aSession=%p, aProcessID=%RU32\n", 102 aConsole, aSession, aProcessID)); 103 99 104 AssertPtrReturn(aSession, VERR_INVALID_POINTER); 100 105 … … 332 337 /* Create a new context ID ... */ 333 338 uNewContextID = VBOX_GUESTCTRL_CONTEXTID_MAKE(uSessionID, 334 mData.mProcessID, mData.mNextContextID ++);335 if ( uNewContextID == UINT32_MAX)339 mData.mProcessID, mData.mNextContextID); 340 if (mData.mNextContextID == VBOX_GUESTCTRL_MAX_CONTEXTS) 336 341 mData.mNextContextID = 0; 337 342 /* Is the context ID already used? Try next ID ... */ … … 344 349 break; 345 350 } 351 mData.mNextContextID++; 346 352 347 353 if (++uTries == UINT32_MAX) … … 358 364 if (puContextID) 359 365 *puContextID = uNewContextID; 366 367 LogFlowFunc(("Added new callback (Session: %RU32, Process: %RU32, Count=%RU32) CID=%RU32\n", 368 uSessionID, mData.mProcessID, mData.mNextContextID, uNewContextID)); 360 369 } 361 370 … … 500 509 } 501 510 502 HRESULT GuestProcess::hgcmResultToError(int rc)503 {504 if (RT_SUCCESS(rc))505 return S_OK;506 507 HRESULT hr;508 if (rc == VERR_INVALID_VM_HANDLE)509 hr = setErrorNoLog(VBOX_E_VM_ERROR,510 tr("VMM device is not available (is the VM running?)"));511 else if (rc == VERR_NOT_FOUND)512 hr = setErrorNoLog(VBOX_E_IPRT_ERROR,513 tr("The guest execution service is not ready (yet)"));514 else if (rc == VERR_HGCM_SERVICE_NOT_FOUND)515 hr= setErrorNoLog(VBOX_E_IPRT_ERROR,516 tr("The guest execution service is not available"));517 else /* HGCM call went wrong. */518 hr = setErrorNoLog(E_UNEXPECTED,519 tr("The HGCM call failed with error %Rrc"), rc);520 return hr;521 }522 523 511 bool GuestProcess::isReady(void) 524 512 { … … 546 534 pCallback->Signal(); 547 535 536 /* Do we need to report a termination? */ 537 ProcessWaitResult_T waitRes; 538 if (mData.mProcess.mFlags & ProcessCreateFlag_IgnoreOrphanedProcesses) 539 waitRes = ProcessWaitResult_Status; /* No, just report a status. */ 540 else 541 waitRes = ProcessWaitResult_Terminate; 542 548 543 /* Signal in any case. */ 549 int rc = signalWaiters( ProcessWaitResult_Status, VERR_CANCELLED);544 int rc = signalWaiters(waitRes); 550 545 AssertRC(rc); 551 546 … … 594 589 Assert(mData.mPID == pData->u32PID); 595 590 596 int callbackRC = VINF_SUCCESS;597 598 591 BOOL fSignal = FALSE; 599 ProcessWaitResult_T enmWaitResult;592 ProcessWaitResult_T waitRes; 600 593 uint32_t uWaitFlags = mData.mWaitEvent 601 594 ? mData.mWaitEvent->GetWaitFlags() : 0; … … 605 598 { 606 599 fSignal = (uWaitFlags & ProcessWaitForFlag_Start); 607 enmWaitResult= ProcessWaitResult_Status;600 waitRes = ProcessWaitResult_Status; 608 601 609 602 mData.mStatus = ProcessStatus_Started; … … 615 608 { 616 609 fSignal = (uWaitFlags & ProcessWaitForFlag_Terminate); 617 enmWaitResult= ProcessWaitResult_Status;610 waitRes = ProcessWaitResult_Status; 618 611 619 612 mData.mStatus = ProcessStatus_TerminatedNormally; … … 625 618 { 626 619 fSignal = (uWaitFlags & ProcessWaitForFlag_Terminate); 627 enmWaitResult= ProcessWaitResult_Status;620 waitRes = ProcessWaitResult_Status; 628 621 629 622 mData.mStatus = ProcessStatus_TerminatedSignal; 630 623 mData.mExitCode = pData->u32Flags; /* Contains the signal. */ 631 632 callbackRC = VERR_INTERRUPTED;633 624 break; 634 625 } … … 637 628 { 638 629 fSignal = (uWaitFlags & ProcessWaitForFlag_Terminate); 639 enmWaitResult= ProcessWaitResult_Status;630 waitRes = ProcessWaitResult_Status; 640 631 641 632 mData.mStatus = ProcessStatus_TerminatedAbnormally; 642 643 callbackRC = VERR_BROKEN_PIPE;644 633 break; 645 634 } … … 648 637 { 649 638 fSignal = (uWaitFlags & ProcessWaitForFlag_Terminate); 650 enmWaitResult= ProcessWaitResult_Timeout;639 waitRes = ProcessWaitResult_Timeout; 651 640 652 641 mData.mStatus = ProcessStatus_TimedOutKilled; 653 654 callbackRC = VERR_TIMEOUT;655 642 break; 656 643 } … … 659 646 { 660 647 fSignal = (uWaitFlags & ProcessWaitForFlag_Terminate); 661 enmWaitResult= ProcessWaitResult_Timeout;648 waitRes = ProcessWaitResult_Timeout; 662 649 663 650 mData.mStatus = ProcessStatus_TimedOutAbnormally; 664 665 callbackRC = VERR_TIMEOUT;666 651 break; 667 652 } … … 670 655 { 671 656 fSignal = (uWaitFlags & ProcessWaitForFlag_Terminate); 672 enmWaitResult = ProcessWaitResult_Status; 657 waitRes = (mData.mProcess.mFlags & ProcessCreateFlag_IgnoreOrphanedProcesses) 658 ? ProcessWaitResult_Terminate : ProcessWaitResult_Status; 673 659 674 660 mData.mStatus = ProcessStatus_Down; 675 676 /*677 * If mFlags has CreateProcessFlag_IgnoreOrphanedProcesses set, we don't report an error to678 * our progress object. This is helpful for waiters which rely on the success of our progress object679 * even if the executed process was killed because the system/VBoxService is shutting down.680 *681 * In this case mFlags contains the actual execution flags reached in via Guest::ExecuteProcess().682 */683 callbackRC = mData.mProcess.mFlags & ProcessCreateFlag_IgnoreOrphanedProcesses684 ? VINF_SUCCESS : VERR_OBJECT_DESTROYED;685 661 break; 686 662 } … … 689 665 { 690 666 fSignal = TRUE; /* Signal in any case. */ 691 enmWaitResult= ProcessWaitResult_Error;667 waitRes = ProcessWaitResult_Error; 692 668 693 669 mData.mStatus = ProcessStatus_Error; 694 670 695 callbackRC = pData->u32Flags; /** @todo int vs. uint32 -- IPRT errors are *negative* !!! */ 671 Utf8Str strError = Utf8StrFmt(tr("Guest process \"%s\" could not be started: ", mData.mProcess.mCommand.c_str())); 672 673 /* Note: It's not required that the process has been started before. */ 674 if (mData.mPID) 675 { 676 strError += Utf8StrFmt(tr("Error rc=%Rrc occured (PID %RU32)"), rc, mData.mPID); 677 } 678 else 679 { 680 /** @todo pData->u32Flags; /** @todo int vs. uint32 -- IPRT errors are *negative* !!! */ 681 switch (pData->u32Flags) /* pData->u32Flags contains the IPRT error code from guest side. */ 682 { 683 case VERR_FILE_NOT_FOUND: /* This is the most likely error. */ 684 strError += Utf8StrFmt(tr("The specified file was not found on guest")); 685 break; 686 687 case VERR_PATH_NOT_FOUND: 688 strError += Utf8StrFmt(tr("Could not resolve path to specified file was not found on guest")); 689 break; 690 691 case VERR_BAD_EXE_FORMAT: 692 strError += Utf8StrFmt(tr("The specified file is not an executable format on guest")); 693 break; 694 695 case VERR_AUTHENTICATION_FAILURE: 696 strError += Utf8StrFmt(tr("The specified user was not able to logon on guest")); 697 break; 698 699 case VERR_INVALID_NAME: 700 strError += Utf8StrFmt(tr("The specified file is an invalid name")); 701 break; 702 703 case VERR_TIMEOUT: 704 strError += Utf8StrFmt(tr("The guest did not respond within time")); 705 break; 706 707 case VERR_CANCELLED: 708 strError += Utf8StrFmt(tr("The execution operation was canceled")); 709 break; 710 711 case VERR_PERMISSION_DENIED: 712 strError += Utf8StrFmt(tr("Invalid user/password credentials")); 713 break; 714 715 case VERR_MAX_PROCS_REACHED: 716 strError += Utf8StrFmt(tr("Maximum number of parallel guest processes has been reached")); 717 break; 718 719 default: 720 strError += Utf8StrFmt(tr("Reported error %Rrc"), pData->u32Flags); 721 break; 722 } 723 } 724 725 rc = setErrorInternal(pData->u32Flags, strError); 726 AssertRC(rc); 696 727 break; 697 728 } … … 702 733 /* Silently skip this request. */ 703 734 fSignal = TRUE; /* Signal in any case. */ 704 enmWaitResult= ProcessWaitResult_Status;735 waitRes = ProcessWaitResult_Status; 705 736 706 737 mData.mStatus = ProcessStatus_Undefined; 707 708 callbackRC = VERR_NOT_IMPLEMENTED;709 738 break; 710 739 } … … 712 741 713 742 LogFlowFunc(("Got rc=%Rrc, waitResult=%d\n", 714 rc, enmWaitResult));743 rc, waitRes)); 715 744 716 745 /* 717 746 * Now do the signalling stuff. 718 747 */ 719 rc = pCallback->Signal( callbackRC);748 rc = pCallback->Signal(); 720 749 721 750 if (fSignal) 722 751 { 723 int rc2 = signalWaiters( enmWaitResult, callbackRC);752 int rc2 = signalWaiters(waitRes); 724 753 if (RT_SUCCESS(rc)) 725 754 rc = rc2; … … 814 843 } 815 844 816 int GuestProcess::signalWaiters(ProcessWaitResult_T enmWaitResult, int rc /*= VINF_SUCCESS*/) 817 { 818 LogFlowFunc(("enmWaitResult=%d, rc=%Rrc, mWaitCount=%RU32, mWaitEvent=%p\n", 819 enmWaitResult, rc, mData.mWaitCount, mData.mWaitEvent)); 820 821 /* Note: No write locking here -- already done in the callback dispatcher. */ 822 823 int rc2 = VINF_SUCCESS; 824 if (mData.mWaitEvent) 825 rc2 = mData.mWaitEvent->Signal(enmWaitResult, rc); 845 int GuestProcess::setErrorInternal(int rc, const Utf8Str &strMessage) 846 { 847 LogFlowFunc(("rc=%Rrc, strMsg=%s\n", rc, strMessage.c_str())); 848 849 Assert(RT_FAILURE(rc)); 850 Assert(!strMessage.isEmpty()); 851 852 #ifdef DEBUG 853 /* Do not allow overwriting an already set error. If this happens 854 * this means we forgot some error checking/locking somewhere. */ 855 Assert(RT_SUCCESS(mData.mRC)); 856 Assert(mData.mErrorMsg.isEmpty()); 857 #endif 858 859 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 860 861 mData.mStatus = ProcessStatus_Error; 862 mData.mRC = rc; 863 mData.mErrorMsg = strMessage; 864 865 int rc2 = signalWaiters(ProcessWaitResult_Error); 826 866 LogFlowFuncLeaveRC(rc2); 827 867 return rc2; 868 } 869 870 int GuestProcess::setErrorExternal(void) 871 { 872 return RT_SUCCESS(mData.mRC) 873 ? S_OK : setError(VBOX_E_IPRT_ERROR, "%s", mData.mErrorMsg.c_str()); 874 } 875 876 int GuestProcess::signalWaiters(ProcessWaitResult_T enmWaitResult) 877 { 878 LogFlowFunc(("enmWaitResult=%d, mWaitCount=%RU32, mWaitEvent=%p\n", 879 enmWaitResult, mData.mWaitCount, mData.mWaitEvent)); 880 881 /* Note: No write locking here -- already done in the caller. */ 882 883 int rc = VINF_SUCCESS; 884 if (mData.mWaitEvent) 885 rc = mData.mWaitEvent->Signal(enmWaitResult); 886 LogFlowFuncLeaveRC(rc); 887 return rc; 828 888 } 829 889 … … 910 970 911 971 rc = sendCommand(HOST_EXEC_CMD, i, paParms); 972 if (RT_FAILURE(rc)) 973 { 974 int rc2; 975 if (rc == VERR_INVALID_VM_HANDLE) 976 rc2 = setErrorInternal(rc, tr("VMM device is not available (is the VM running?)")); 977 else if (rc == VERR_NOT_FOUND) 978 rc2 = setErrorInternal(rc, tr("The guest execution service is not ready (yet)")); 979 else if (rc == VERR_HGCM_SERVICE_NOT_FOUND) 980 rc2 = setErrorInternal(rc, tr("The guest execution service is not available")); 981 else 982 rc2 = setErrorInternal(rc, Utf8StrFmt(tr("The HGCM call failed with error %Rrc"), rc)); 983 AssertRC(rc2); 984 } 912 985 } 913 986 … … 915 988 if (pszArgs) 916 989 RTStrFree(pszArgs); 917 918 if (RT_FAILURE(rc))919 mData.mStatus = ProcessStatus_Error;920 990 921 991 uint32_t uTimeoutMS = mData.mProcess.mTimeoutMS; … … 1006 1076 } 1007 1077 1008 int GuestProcess::waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestProcessWaitResult & guestResult)1078 int GuestProcess::waitFor(uint32_t fWaitFlags, ULONG uTimeoutMS, GuestProcessWaitResult &waitRes) 1009 1079 { 1010 1080 LogFlowThisFuncEnter(); … … 1019 1089 ProcessStatus_T curStatus = mData.mStatus; 1020 1090 1021 guestResult.mResult = ProcessWaitResult_None;1022 guestResult.mRC = VINF_SUCCESS;1023 1024 #if 1 1025 if ( (fWaitFlags & ProcessWaitForFlag_Start)1026 && (curStatus != ProcessStatus_Undefined))1027 { 1028 guestResult.mResult = ProcessWaitResult_Start; /** @todo Fix this. */1029 }1030 #else 1091 /* Did some error occur before? Then skip waiting and return. */ 1092 if (curStatus == ProcessStatus_Error) 1093 { 1094 waitRes.mResult = ProcessWaitResult_Error; 1095 return VINF_SUCCESS; 1096 } 1097 1098 waitRes.mResult = ProcessWaitResult_None; 1099 waitRes.mRC = VINF_SUCCESS; 1100 1031 1101 if ( (fWaitFlags & ProcessWaitForFlag_Terminate) 1032 1102 || (fWaitFlags & ProcessWaitForFlag_StdIn) … … 1040 1110 case ProcessStatus_TerminatedAbnormally: 1041 1111 case ProcessStatus_Down: 1042 guestResult.mResult = ProcessWaitResult_Terminate;1112 waitRes.mResult = ProcessWaitResult_Terminate; 1043 1113 break; 1044 1114 1045 1115 case ProcessStatus_TimedOutKilled: 1046 1116 case ProcessStatus_TimedOutAbnormally: 1047 guestResult.mResult = ProcessWaitResult_Timeout;1117 waitRes.mResult = ProcessWaitResult_Timeout; 1048 1118 break; 1049 1119 1050 1120 case ProcessStatus_Error: 1051 guestResult.mResult = ProcessWaitResult_Error; 1121 waitRes.mResult = ProcessWaitResult_Error; 1122 waitRes.mRC = mData.mRC; 1123 break; 1124 1125 case ProcessStatus_Undefined: 1126 case ProcessStatus_Starting: 1127 /* Do the waiting below. */ 1052 1128 break; 1053 1129 … … 1064 1140 case ProcessStatus_Paused: 1065 1141 case ProcessStatus_Terminating: 1066 guestResult.mResult = ProcessWaitResult_Start; 1142 case ProcessStatus_TerminatedNormally: 1143 case ProcessStatus_TerminatedSignal: 1144 case ProcessStatus_TerminatedAbnormally: 1145 case ProcessStatus_Down: 1146 waitRes.mResult = ProcessWaitResult_Start; 1147 break; 1148 1149 case ProcessStatus_Error: 1150 waitRes.mResult = ProcessWaitResult_Error; 1151 waitRes.mRC = mData.mRC; 1152 break; 1153 1154 case ProcessStatus_Undefined: 1155 case ProcessStatus_Starting: 1156 /* Do the waiting below. */ 1067 1157 break; 1068 1158 … … 1072 1162 } 1073 1163 } 1074 #endif 1164 1165 LogFlowFunc(("waitResult=%ld, waitRC=%Rrc\n", waitRes.mResult, waitRes.mRC)); 1075 1166 1076 1167 /* No waiting needed? Return immediately. */ 1077 if ( guestResult.mResult != ProcessWaitResult_None)1168 if (waitRes.mResult != ProcessWaitResult_None) 1078 1169 return VINF_SUCCESS; 1079 1170 … … 1090 1181 int rc = mData.mWaitEvent->Wait(uTimeoutMS); 1091 1182 if (RT_SUCCESS(rc)) 1092 guestResult= mData.mWaitEvent->GetResult();1183 waitRes = mData.mWaitEvent->GetResult(); 1093 1184 1094 1185 alock.acquire(); /* Get the lock again. */ … … 1208 1299 break; 1209 1300 1210 case VERR_NOT_AVAILABLE:1211 strMsg += Utf8StrFmt(tr("Guest control service is not ready"));1212 1213 1301 default: 1214 1302 strMsg += Utf8StrFmt(tr("Reported error %Rrc"), rc); … … 1331 1419 if (RT_SUCCESS(rc)) 1332 1420 { 1333 hr = waitResultToErrorEx(waitRes, true /* fLog */); 1334 if (SUCCEEDED(hr)) 1335 *aReason = waitRes.mResult; 1421 *aReason = waitRes.mResult; 1422 hr = setErrorExternal(); 1336 1423 } 1337 1424 else 1338 hr = setError(VBOX_E_IPRT_ERROR, 1339 tr("Waiting for process \"%s\" (PID %RU32) failed with rc=%Rrc"), 1340 mData.mProcess.mCommand.c_str(), mData.mPID, rc); 1341 LogFlowFuncLeaveRC(hr); 1425 { 1426 if (rc == VERR_TIMEOUT) 1427 hr = setError(VBOX_E_IPRT_ERROR, 1428 tr("Process \"%s\" (PID %RU32) did not respond within time (%RU32ms)"), 1429 mData.mProcess.mCommand.c_str(), mData.mPID, aTimeoutMS); 1430 else 1431 hr = setError(VBOX_E_IPRT_ERROR, 1432 tr("Waiting for process \"%s\" (PID %RU32) failed with rc=%Rrc"), 1433 mData.mProcess.mCommand.c_str(), mData.mPID, rc); 1434 } 1435 LogFlowFuncLeaveRC(rc); 1342 1436 return hr; 1343 1437 #endif /* VBOX_WITH_GUEST_CONTROL */ -
trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp
r42412 r42436 379 379 LogFlowFuncEnter(); 380 380 381 AssertPtrReturn(pvData, VERR_INVALID_POINTER);382 AssertReturn(cbData, VERR_INVALID_PARAMETER);383 384 381 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 385 382 383 uint32_t uProcessID = VBOX_GUESTCTRL_CONTEXTID_GET_PROCESS(uContextID); 384 #ifdef DEBUG 385 LogFlowFunc(("uProcessID=%RU32 (%RU32 total)\n", 386 uProcessID, mData.mProcesses.size())); 387 SessionProcesses::const_iterator i = mData.mProcesses.begin(); 388 while (i != mData.mProcesses.end()) 389 { 390 LogFlowFunc(("\tproc %RU32\n", i->first)); 391 i++; 392 } 393 #endif 386 394 int rc; 387 395 SessionProcesses::const_iterator itProc 388 = mData.mProcesses.find( VBOX_GUESTCTRL_CONTEXTID_GET_PROCESS(uContextID));396 = mData.mProcesses.find(uProcessID); 389 397 if (itProc != mData.mProcesses.end()) 390 398 { … … 448 456 int GuestSession::processCreateExInteral(GuestProcessInfo &procInfo, ComObjPtr<GuestProcess> &pProcess) 449 457 { 458 LogFlowFunc(("mCmd=%s, mFlags=%x, mTimeoutMS=%RU32\n", 459 procInfo.mCommand.c_str(), procInfo.mFlags, procInfo.mTimeoutMS)); 460 450 461 /* Validate flags. */ 451 462 if (procInfo.mFlags) … … 469 480 /** @tood Implement process priority + affinity. */ 470 481 482 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 483 471 484 int rc = VERR_MAX_PROCS_REACHED; 472 485 if (mData.mProcesses.size() >= VBOX_GUESTCTRL_MAX_PROCESSES) 473 486 return rc; 474 475 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);476 487 477 488 /* Create a new (host-based) process ID and assign it. */ … … 504 515 505 516 rc = pProcess->init(mData.mParent->getConsole() /* Console */, this /* Session */, 506 517 uNewProcessID, procInfo); 507 518 if (RT_FAILURE(rc)) throw rc; 508 519 509 520 /* Add the created process to our map. */ 510 521 mData.mProcesses[uNewProcessID] = pProcess; 522 523 LogFlowFunc(("Added new process (Session: %RU32) with process ID=%RU32\n", 524 mData.mId, uNewProcessID)); 511 525 } 512 526 catch (int rc2) … … 1011 1025 com::SafeArray<IN_BSTR> environment(ComSafeArrayInArg(aEnvironment)); 1012 1026 for (size_t i = 0; i < environment.size() && RT_SUCCESS(rc); i++) 1013 rc = mData.mEnvironment.Set(Utf8Str(environment[i]));1027 rc = procInfo.mEnvironment.Set(Utf8Str(environment[i])); 1014 1028 } 1015 1029 … … 1055 1069 { 1056 1070 case VERR_MAX_PROCS_REACHED: 1057 hr = setError(VBOX_E_IPRT_ERROR, tr("Maximum number of guest processes (%ld) reached"),1058 V ERR_MAX_PROCS_REACHED);1071 hr = setError(VBOX_E_IPRT_ERROR, tr("Maximum number of guest processes per session (%ld) reached"), 1072 VBOX_GUESTCTRL_MAX_PROCESSES); 1059 1073 break; 1060 1074 1061 1075 /** @todo Add more errors here. */ 1062 1076 1063 default:1077 default: 1064 1078 hr = setError(VBOX_E_IPRT_ERROR, tr("Could not create guest process, rc=%Rrc"), rc); 1065 1079 break;
Note:
See TracChangeset
for help on using the changeset viewer.