Changeset 38587 in vbox
- Timestamp:
- Aug 31, 2011 3:09:45 PM (13 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxService
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp
r38157 r38587 252 252 } 253 253 254 254 255 void VBoxServiceControlThreadSignalShutdown(const PVBOXSERVICECTRLTHREAD pThread) 255 256 { … … 263 264 AssertPtrReturn(pThread, VERR_INVALID_POINTER); 264 265 int rc = VINF_SUCCESS; 265 if (pThread->Thread != NIL_RTTHREAD) 266 if ( pThread->Thread != NIL_RTTHREAD 267 && !pThread->fShutdown) /* Only shutdown threads which aren't yet. */ 266 268 { 267 269 /* Wait a bit ... */ -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp
r38493 r38587 1411 1411 VBoxServiceError("ControlExec: [PID %u]: Failed to retrieve output, CID=%u, uHandle=%u, rc=%Rrc\n", 1412 1412 uPID, uContextID, uHandleID, rc); 1413 1414 1413 /* Note: Since the context ID is unique the request *has* to be completed here, 1415 1414 * regardless whether we got data or not! Otherwise the progress object -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExecThread.cpp
r38493 r38587 380 380 if (RT_SUCCESS(rc)) 381 381 { 382 uint32_t cbRead = cbSize; 382 uint32_t cbRead = cbSize; /* Read as much as possible. */ 383 383 rc = VBoxServicePipeBufRead(pPipeBuf, pBuf, cbSize, &cbRead); 384 384 if (RT_SUCCESS(rc)) 385 385 { 386 #if 0 387 if (!cbRead) 388 AssertReleaseMsg(fEnabled == VBoxServicePipeBufIsEnabled(pPipeBuf), 386 if ( !cbRead 387 && fEnabled) 388 { 389 AssertReleaseMsg(!VBoxServicePipeBufIsEnabled(pPipeBuf), 389 390 ("[PID %u]: Waited (%ums) for active pipe buffer %u (%u size, %u bytes left), but nothing read!\n", 390 391 uPID, uTimeout, pPipeBuf->uPipeId, pPipeBuf->cbSize, pPipeBuf->cbSize - pPipeBuf->cbOffset)); 391 #endif 392 } 392 393 if (pcbRead) 393 394 *pcbRead = cbRead; … … 409 410 410 411 412 int VBoxServiceControlExecThreadRemove(uint32_t uPID) 413 { 414 int rc = RTCritSectEnter(&g_GuestControlThreadsCritSect); 415 if (RT_SUCCESS(rc)) 416 { 417 PVBOXSERVICECTRLTHREAD pThread = vboxServiceControlExecThreadGetByPID(uPID); 418 if (pThread) 419 { 420 Assert(pThread->fStarted != pThread->fStopped); 421 if (pThread->fStopped) /* Only shut down stopped threads. */ 422 { 423 VBoxServiceVerbose(4, "ControlExec: [PID %u]: Removing thread ... \n", 424 uPID); 425 426 rc = VBoxServiceControlExecThreadShutdown(pThread); 427 428 RTListNodeRemove(&pThread->Node); 429 RTMemFree(pThread); 430 } 431 } 432 else 433 rc = VERR_NOT_FOUND; 434 435 int rc2 = RTCritSectLeave(&g_GuestControlThreadsCritSect); 436 if (RT_SUCCESS(rc)) 437 rc = rc2; 438 } 439 440 return rc; 441 } 442 443 /* Does not do locking, must be done by the caller! */ 411 444 int VBoxServiceControlExecThreadShutdown(const PVBOXSERVICECTRLTHREAD pThread) 412 445 { … … 437 470 int VBoxServiceControlExecThreadStartAllowed(bool *pbAllowed) 438 471 { 472 AssertPtrReturn(pbAllowed, VERR_INVALID_POINTER); 473 439 474 int rc = RTCritSectEnter(&g_GuestControlThreadsCritSect); 440 475 if (RT_SUCCESS(rc)) … … 445 480 */ 446 481 bool fLimitReached = false; 447 if (g_GuestControlProcsMaxKept) /* If we allow unlimited processes , take a shortcut. */482 if (g_GuestControlProcsMaxKept) /* If we allow unlimited processes (=0), take a shortcut. */ 448 483 { 449 484 /** @todo Put running/stopped (+ memory alloc) stats into global struct! */ … … 471 506 if (iProcsLeft < 0) 472 507 { 473 VBoxServiceVerbose(3, "ControlExec: Maximum running guest processes reached\n"); 508 VBoxServiceVerbose(3, "ControlExec: Maximum running guest processes reached (%u)\n", 509 g_GuestControlProcsMaxKept); 474 510 fLimitReached = true; 475 511 } … … 490 526 if (RT_FAILURE(rc2)) 491 527 { 492 VBoxServiceError("ControlExec: Unable to shut down thread due to policy, rc=%Rrc ", rc2);528 VBoxServiceError("ControlExec: Unable to shut down thread due to policy, rc=%Rrc\n", rc2); 493 529 if (RT_SUCCESS(rc)) 494 530 rc = rc2; … … 500 536 pNode = pNext; 501 537 538 Assert(uProcsToKill); 502 539 uProcsToKill--; 503 540 if (!uProcsToKill) 504 541 break; 505 506 542 } 507 543 } -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExecThread.h
r38180 r38587 31 31 int VBoxServiceControlExecThreadGetOutput(uint32_t uPID, uint32_t uHandleId, uint32_t uTimeout, 32 32 uint8_t *pBuf, uint32_t cbSize, uint32_t *pcbRead); 33 int VBoxServiceControlExecThreadRemove(uint32_t uPID); 33 34 int VBoxServiceControlExecThreadSetInput(uint32_t uPID, bool fPendingClose, uint8_t *pBuf, 34 35 uint32_t cbSize, uint32_t *pcbWritten); -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h
r38180 r38587 158 158 RTPIPE hNotificationPipeR; 159 159 /** The event semaphore for getting notified whether something 160 * has changed, e.g. written or read from this buffer. */160 * has changed, e.g. written to this buffer or enabled/disabled it. */ 161 161 RTSEMEVENT hEventSem; 162 162 } VBOXSERVICECTRLEXECPIPEBUF; -
trunk/src/VBox/Additions/common/VBoxService/VBoxServicePipeBuf.cpp
r38493 r38587 112 112 113 113 #ifdef DEBUG_andy 114 VBoxServiceVerbose(4, "Pipe [%u %u 0x%p %s] read pcbToRead=%u, cbSize=%u, cbAlloc=%u, cbOff=%u\n",114 VBoxServiceVerbose(4, "Pipe [%u %u 0x%p %s] read cbToRead=%u, cbSize=%u, cbAlloc=%u, cbOff=%u\n", 115 115 pBuf->uPID, pBuf->uPipeId, pBuf, pBuf->fEnabled ? "EN" : "DIS", cbToRead, pBuf->cbSize, pBuf->cbAllocated, pBuf->cbOffset); 116 116 #endif 117 if (pBuf->hEventSem != NIL_RTSEMEVENT) 118 { 119 rc = RTSemEventSignal(pBuf->hEventSem); 120 AssertRC(rc); 121 } 117 /* Don't signal event semaphore here -- we only read out something from 118 * this pipe buffer. */ 122 119 123 120 *pcbToRead = cbToRead;
Note:
See TracChangeset
for help on using the changeset viewer.