Changeset 28233 in vbox for trunk/src/VBox
- Timestamp:
- Apr 13, 2010 8:23:52 AM (15 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestCtrl.cpp
r28218 r28233 224 224 ** @todo Docs! 225 225 */ 226 VBGLR3DECL(int) VbglR3GuestCtrlExecReportStatus(uint32_t u32ClientId,227 uint32_t u32PID,228 uint32_t u32Status,229 uint32_t u32Flags,230 void *pvData,231 uint32_t cbData)226 VBGLR3DECL(int) VbglR3GuestCtrlExecReportStatus(uint32_t u32ClientId, 227 uint32_t u32PID, 228 uint32_t u32Status, 229 uint32_t u32Flags, 230 void *pvData, 231 uint32_t cbData) 232 232 { 233 233 VBoxGuestCtrlHGCMMsgExecStatus Msg; … … 238 238 Msg.hdr.cParms = 4; 239 239 240 VbglHGCMParmUInt32Set(&Msg.pid, 0);241 VbglHGCMParmUInt32Set(&Msg.status, 0);242 VbglHGCMParmUInt32Set(&Msg.flags, 0);240 VbglHGCMParmUInt32Set(&Msg.pid, u32PID); 241 VbglHGCMParmUInt32Set(&Msg.status, u32Status); 242 VbglHGCMParmUInt32Set(&Msg.flags, u32Flags); 243 243 VbglHGCMParmPtrSet(&Msg.data, pvData, cbData); 244 244 -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp
r28218 r28233 235 235 236 236 237 static int VBoxServiceControlExecProcLoop( RTPROCESS hProcess, RTMSINTERVAL cMillies, RTPOLLSET hPollSet,237 static int VBoxServiceControlExecProcLoop(uint32_t uClientID, RTPROCESS hProcess, RTMSINTERVAL cMillies, RTPOLLSET hPollSet, 238 238 RTPIPE hStdInW, RTPIPE hStdOutR, RTPIPE hStdErrR) 239 239 { … … 260 260 * and that it's now OK to send input to the process. 261 261 */ 262 rc = VINF_SUCCESS; 262 rc = VbglR3GuestCtrlExecReportStatus(uClientID, hProcess, 263 PROC_STS_STARTED, 0 /* u32Flags */, 264 NULL /* pvData */, 0 /* cbData */); 263 265 264 266 /* … … 401 403 if (RT_SUCCESS(rc)) 402 404 { 405 uint32_t uStatus = PROC_STS_UNDEFINED; 406 uint32_t uFlags = 0; 407 403 408 if ( fProcessTimedOut && !fProcessAlive && MsProcessKilled != UINT64_MAX) 404 409 { 405 410 uStatus = PROC_STS_TOK; 406 411 } 407 412 else if (fProcessTimedOut && fProcessAlive && MsProcessKilled != UINT64_MAX) 408 413 { 409 414 uStatus = PROC_STS_TOA; 410 415 } 411 416 /*else if (g_fTerminate && (fProcessAlive || MsProcessKilled != UINT64_MAX)) 412 417 { 413 418 uStatus = PROC_STS_DWN; 414 419 }*/ 415 420 else if (fProcessAlive) 416 421 { 417 422 VBoxServiceError("Control: Process is alive when it should not!\n"); 418 423 } 419 424 else if (MsProcessKilled != UINT64_MAX) 420 425 { 421 422 } 423 else if ( ProcessStatus.enmReason == RTPROCEXITREASON_NORMAL 424 && ProcessStatus.iStatus == 0) 425 { 426 426 VBoxServiceError("Control: Process has been killed when it should not!\n"); 427 427 } 428 428 else if (ProcessStatus.enmReason == RTPROCEXITREASON_NORMAL) 429 429 { 430 430 uStatus = PROC_STS_TEN; 431 uFlags = ProcessStatus.iStatus; 431 432 } 432 433 else if (ProcessStatus.enmReason == RTPROCEXITREASON_SIGNAL) 433 434 { 434 435 uStatus = PROC_STS_TES; 436 uFlags = ProcessStatus.iStatus; 435 437 } 436 438 else if (ProcessStatus.enmReason == RTPROCEXITREASON_ABEND) 437 439 { 438 440 uStatus = PROC_STS_TEA; 441 uFlags = ProcessStatus.iStatus; 439 442 } 440 443 else 441 444 { 442 443 } 444 } 445 445 VBoxServiceError("Control: Process has reached an undefined status!\n"); 446 } 447 448 VBoxServiceVerbose(3, "Control: Process ended: Status=%u, Flags=%u\n", uStatus, uFlags); 449 rc = VbglR3GuestCtrlExecReportStatus(uClientID, hProcess, 450 uStatus, uFlags, 451 NULL /* pvData */, 0 /* cbData */); 452 } 446 453 RTMemFree(StdInBuf.pch); 447 454 return rc; … … 665 672 { 666 673 VBoxServiceVerbose(3, "Control: Process \"%s\" started.\n", pData->pszCmd); 667 rc = VbglR3GuestCtrlExecReportStatus(u32ClientID, 123, PROC_STATUS_STARTED,668 0 /* u32Flags */, NULL, 0);669 674 /** @todo Dump a bit more info here. */ 670 675 … … 679 684 phStdErr = NULL; 680 685 681 rc = VBoxServiceControlExecProcLoop(hProcess, pData->uTimeLimitMS, hPollSet, 686 /* Enter the process loop. */ 687 rc = VBoxServiceControlExecProcLoop(u32ClientID, 688 hProcess, pData->uTimeLimitMS, hPollSet, 682 689 hStdInW, hStdOutR, hStdErrR); 690 VBoxServiceVerbose(3, "Control: Process loop ended with rc=%Rrc\n", rc); 691 683 692 /* 684 693 * The handles that are no longer in the set have … … 713 722 714 723 /* 715 * Since we (hopefully) are the on eones that hold the thread data,724 * Since we (hopefully) are the only ones that hold the thread data, 716 725 * destroy them now. 717 726 */ -
trunk/src/VBox/HostServices/GuestControl/service.cpp
r28218 r28233 489 489 int Service::notifyHost(VBOXHGCMCALLHANDLE callHandle, uint32_t eFunction, uint32_t cParms, VBOXHGCMSVCPARM paParms[]) 490 490 { 491 LogFlowFunc (("eFunction=%ld, cParms=%ld, paParms=%p\n", 492 eFunction, cParms, paParms)); 493 HOSTCALLBACKDATA HostCallbackData; 494 HostCallbackData.u32Magic = HOSTCALLBACKMAGIC; 495 496 int rc = mpfnHostCallback (mpvHostData, 0 /*u32Function*/, 497 (void *)(&HostCallbackData), 498 sizeof(HostCallbackData)); 499 LogFlowFunc (("returning %Rrc\n", rc)); 491 LogFlowFunc(("eFunction=%ld, cParms=%ld, paParms=%p\n", 492 eFunction, cParms, paParms)); 493 494 int rc; 495 if ( eFunction == GUEST_EXEC_SEND_STATUS 496 && cParms == 4) 497 { 498 HOSTEXECCALLBACKDATA data; 499 data.u32Magic = HOSTCALLBACKMAGIC; 500 paParms[0].getUInt32(&data.pid); 501 paParms[1].getUInt32(&data.status); 502 paParms[2].getUInt32(&data.flags); 503 paParms[4].getPointer(&data.pvData, &data.cbData); 504 505 rc = mpfnHostCallback (mpvHostData, 0 /*u32Function*/, 506 (void *)(&data), 507 sizeof(data)); 508 } 509 else 510 rc = VERR_NOT_SUPPORTED; 511 LogFlowFunc(("returning %Rrc\n", rc)); 500 512 return rc; 501 513 } -
trunk/src/VBox/Main/GuestImpl.cpp
r28218 r28233 437 437 } 438 438 439 // static 440 DECLCALLBACK(int) Guest::doGuestCtrlNotification(void *pvExtension, 441 uint32_t u32Function, 442 void *pvParms, 443 uint32_t cbParms) 439 /** 440 * Static callback function for receiving updates on processes started on 441 * the guest side. 442 * 443 * @returns VBox status code. 444 * 445 * @todo 446 * 447 */ 448 DECLCALLBACK(int) Guest::doGuestCtrlExecNotification(void *pvExtension, 449 uint32_t u32Function, 450 void *pvParms, 451 uint32_t cbParms) 444 452 { 445 453 using namespace guestControl; … … 449 457 * changes to the object state. 450 458 */ 451 PHOST CALLBACKDATA pCBData = reinterpret_cast<PHOSTCALLBACKDATA>(pvParms);459 PHOSTEXECCALLBACKDATA pCBData = reinterpret_cast<PHOSTEXECCALLBACKDATA>(pvParms); 452 460 AssertPtr(pCBData); 453 AssertReturn(sizeof(HOST CALLBACKDATA) == cbParms, VERR_INVALID_PARAMETER);461 AssertReturn(sizeof(HOSTEXECCALLBACKDATA) == cbParms, VERR_INVALID_PARAMETER); 454 462 AssertReturn(HOSTCALLBACKMAGIC == pCBData->u32Magic, VERR_INVALID_PARAMETER); 455 463 LogFlowFunc(("pvExtension = %p, u32Function = %d, pvParms = %p, cbParms = %d\n", 456 464 pvExtension, u32Function, pvParms, cbParms)); 465 ComObjPtr<Guest> pGuest = reinterpret_cast<Guest *>(pvExtension); 457 466 458 467 int rc = VINF_SUCCESS; 459 Guest *pGuest = static_cast <Guest *>(pvExtension); 460 AssertPtr(pGuest); 461 462 switch (u32Function) 463 { 464 case GUEST_EXEC_SEND_STATUS: 465 LogFlowFunc(("GUEST_EXEC_SEND_STATUS\n")); 466 break; 467 468 default: 469 rc = VERR_NOT_SUPPORTED; 470 break; 471 } 468 if (u32Function == GUEST_EXEC_SEND_STATUS) 469 { 470 471 } 472 else 473 rc = VERR_NOT_SUPPORTED; 472 474 473 475 ASMAtomicWriteBool(&pGuest->mSignalled, true); … … 520 522 HGCMSVCEXTHANDLE hExt; 521 523 int vrc = HGCMHostRegisterServiceExtension(&hExt, "VBoxGuestControlSvc", 522 &Guest::doGuestCtrl Notification,524 &Guest::doGuestCtrlExecNotification, 523 525 this); 524 526 if (RT_SUCCESS(vrc)) … … 594 596 if (vmmDev) 595 597 { 596 LogFlow (("Guest::ExecuteProgram:numParms=%d\n", i));598 LogFlowFunc(("hgcmHostCall numParms=%d\n", i)); 597 599 vrc = vmmDev->hgcmHostCall("VBoxGuestControlSvc", HOST_EXEC_CMD, 598 600 i, paParms); 599 /** @todo Get the PID. */600 601 } 601 602 RTMemFree(pvEnv); … … 605 606 if (RT_SUCCESS(vrc)) 606 607 { 607 /* Wait for the HGCM low level callback */ 608 LogFlowFunc(("Waiting for HGCM callback (timeout=%ldms) ...\n", aTimeoutMS)); 609 610 /* 611 * Wait for the HGCM low level callback until the process 612 * has been started (or something went wrong). This is necessary to 613 * get the PID. 614 */ 608 615 mSignalled = false; 609 616 uint64_t u64Started = RTTimeMilliTS(); … … 622 629 RTThreadSleep(100); 623 630 } while (!mSignalled); 631 632 /* Did we get some status? */ 633 if (mSignalled) 634 { 635 636 } 624 637 #if 0 625 638 progress.queryInterfaceTo(aProgress); -
trunk/src/VBox/Main/include/GuestImpl.h
r28206 r28233 110 110 int prepareExecuteEnv(const char *pszEnv, void **ppvList, uint32_t *pcbList, uint32_t *pcEnv); 111 111 /** Static callback for handling guest notifications. */ 112 static DECLCALLBACK(int) doGuestCtrl Notification(void *pvExtension, uint32_t u32Function, void *pvParms, uint32_t cbParms);112 static DECLCALLBACK(int) doGuestCtrlExecNotification(void *pvExtension, uint32_t u32Function, void *pvParms, uint32_t cbParms); 113 113 # endif 114 114
Note:
See TracChangeset
for help on using the changeset viewer.