Changeset 38870 in vbox for trunk/src/VBox
- Timestamp:
- Sep 27, 2011 8:32:04 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExecThread.cpp
r38866 r38870 348 348 switch (uHandleId) 349 349 { 350 case OUTPUT_HANDLE_ID_STDERR: /* StdErr */350 case OUTPUT_HANDLE_ID_STDERR: 351 351 pPipeBuf = &pData->stdErr; 352 352 break; 353 353 354 case OUTPUT_HANDLE_ID_STDOUT: /* StdOut */ 355 default: /* On VBox host < 4.1 this is 0, so default to stdout 356 * to not break things. */ 354 case OUTPUT_HANDLE_ID_STDOUT: 355 case OUTPUT_HANDLE_ID_STDOUT_DEPRECATED: 357 356 pPipeBuf = &pData->stdOut; 358 357 break; 359 } 360 AssertPtr(pPipeBuf); 361 362 #ifdef DEBUG_andy 363 VBoxServiceVerbose(4, "ControlExec: [PID %u]: Getting output from pipe buffer %u ...\n", 364 uPID, pPipeBuf->uPipeId); 365 #endif 366 /* If the stdout pipe buffer is enabled (that is, still could be filled by a running 367 * process) wait for the signal to arrive so that we don't return without any actual 368 * data read. */ 369 bool fEnabled = VBoxServicePipeBufIsEnabled(pPipeBuf); 370 if (fEnabled) 371 { 372 #ifdef DEBUG_andy 373 VBoxServiceVerbose(4, "ControlExec: [PID %u]: Waiting for pipe buffer %u (%ums)\n", 374 uPID, pPipeBuf->uPipeId, uTimeout); 375 #endif 376 rc = VBoxServicePipeBufWaitForEvent(pPipeBuf, uTimeout); 377 } 358 359 default: 360 rc = VERR_NOT_FOUND; /* Handle ID not found! */ 361 break; 362 } 363 378 364 if (RT_SUCCESS(rc)) 379 365 { 380 uint32_t cbRead = cbSize; /* Read as much as possible. */ 381 rc = VBoxServicePipeBufRead(pPipeBuf, pBuf, cbSize, &cbRead); 366 AssertPtr(pPipeBuf); 367 368 #ifdef DEBUG_andy 369 VBoxServiceVerbose(4, "ControlExec: [PID %u]: Getting output from pipe buffer %u ...\n", 370 uPID, pPipeBuf->uPipeId); 371 #endif 372 /* If the stdout pipe buffer is enabled (that is, still could be filled by a running 373 * process) wait for the signal to arrive so that we don't return without any actual 374 * data read. */ 375 bool fEnabled = VBoxServicePipeBufIsEnabled(pPipeBuf); 376 if (fEnabled) 377 { 378 #ifdef DEBUG_andy 379 VBoxServiceVerbose(4, "ControlExec: [PID %u]: Waiting for pipe buffer %u (%ums)\n", 380 uPID, pPipeBuf->uPipeId, uTimeout); 381 #endif 382 rc = VBoxServicePipeBufWaitForEvent(pPipeBuf, uTimeout); 383 } 382 384 if (RT_SUCCESS(rc)) 383 385 { 384 if ( !cbRead 385 && fEnabled) 386 uint32_t cbRead = cbSize; /* Read as much as possible. */ 387 rc = VBoxServicePipeBufRead(pPipeBuf, pBuf, cbSize, &cbRead); 388 if (RT_SUCCESS(rc)) 386 389 { 387 AssertReleaseMsg(!VBoxServicePipeBufIsEnabled(pPipeBuf), 388 ("[PID %u]: Waited (%ums) for active pipe buffer %u (%u size, %u bytes left), but nothing read!\n", 389 uPID, uTimeout, pPipeBuf->uPipeId, pPipeBuf->cbSize, pPipeBuf->cbSize - pPipeBuf->cbOffset)); 390 if ( !cbRead 391 && fEnabled) 392 { 393 AssertReleaseMsg(!VBoxServicePipeBufIsEnabled(pPipeBuf), 394 ("[PID %u]: Waited (%ums) for active pipe buffer %u (%u size, %u bytes left), but nothing read!\n", 395 uPID, uTimeout, pPipeBuf->uPipeId, pPipeBuf->cbSize, pPipeBuf->cbSize - pPipeBuf->cbOffset)); 396 } 397 if (pcbRead) 398 *pcbRead = cbRead; 390 399 } 391 if (pcbRead) 392 *pcbRead = cbRead; 400 else 401 VBoxServiceError("ControlExec: [PID %u]: Unable to read from pipe buffer %u, rc=%Rrc\n", 402 uPID, pPipeBuf->uPipeId, rc); 393 403 } 394 else395 VBoxServiceError("ControlExec: [PID %u]: Unable to read from pipe buffer %u, rc=%Rrc\n",396 uPID, pPipeBuf->uPipeId, rc);397 404 } 398 405 }
Note:
See TracChangeset
for help on using the changeset viewer.