- Timestamp:
- Apr 29, 2011 10:04:52 AM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 71465
- Location:
- trunk/src/VBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExec.cpp
r36756 r36887 191 191 192 192 /** 193 * Handle pending output data or error on standard out, standard error or the 194 * test pipe. 195 * 196 * @returns IPRT status code from client send. 197 * @param pThread The thread specific data. 193 * Handle pending output data/error on standard out or standard error. 194 * 195 * @return IPRT status code. 198 196 * @param hPollSet The polling set. 199 197 * @param fPollEvt The event mask returned by RTPollNoResume. 200 * @param phPipeR The pipe handle. 201 * @param pu32Crc The current CRC-32 of the stream. (In/Out) 202 * @param uHandleId The handle ID. 203 * 204 * @todo Put the last 4 parameters into a struct! 198 * @param phPipeR The pipe to be read from. 199 * @param uHandleId Handle ID of the pipe to be read from. 200 * @param pBuf Pointer to pipe buffer to store the read data into. 205 201 */ 206 202 static int VBoxServiceControlExecProcHandleOutputEvent(RTPOLLSET hPollSet, uint32_t fPollEvt, PRTPIPE phPipeR, 207 uint32_t uHandleId, PVBOXSERVICECTRLEXECPIPEBUF pStdOutBuf) 208 { 203 uint32_t uHandleId, PVBOXSERVICECTRLEXECPIPEBUF pBuf) 204 { 205 AssertPtrReturn(phPipeR, VERR_INVALID_POINTER); 206 AssertPtrReturn(pBuf, VERR_INVALID_POINTER); 207 209 208 #ifdef DEBUG 210 VBoxServiceVerbose(4, "ControlExec: HandleOutputEvent: fPollEvt=%#x\n", fPollEvt); 209 VBoxServiceVerbose(4, "ControlExec: HandleOutputEvent: fPollEvt=%#x, uHandle=%u\n", 210 fPollEvt, uHandleId); 211 211 #endif 212 212 … … 222 222 { 223 223 uint32_t cbWritten; 224 rc = VBoxServicePipeBufWriteToBuf(p StdOutBuf, abBuf,224 rc = VBoxServicePipeBufWriteToBuf(pBuf, abBuf, 225 225 cbRead, false /* Pending close */, &cbWritten); 226 226 if (RT_SUCCESS(rc)) … … 376 376 case VBOXSERVICECTRLPIPEID_STDERR: 377 377 rc = VBoxServiceControlExecProcHandleOutputEvent(hPollSet, fPollEvt, phStdErrR, 378 VBOXSERVICECTRLPIPEID_STDERR, &pData->std Out);378 VBOXSERVICECTRLPIPEID_STDERR, &pData->stdErr); 379 379 break; 380 380 … … 1348 1348 * on the host never will get completed! */ 1349 1349 /* cbRead now contains actual size. */ 1350 rc = VbglR3GuestCtrlExecSendOut(u32ClientId, uContextID, uPID, uHandleID, 0 /* Flags */,1350 rc = VbglR3GuestCtrlExecSendOut(u32ClientId, uContextID, uPID, uHandleID, uFlags, 1351 1351 pBuf, cbRead); 1352 1352 } -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlExecThread.cpp
r36749 r36887 27 27 #include <iprt/semaphore.h> 28 28 #include <iprt/string.h> 29 30 #include <VBox/HostServices/GuestControlSvc.h> 29 31 30 32 #include "VBoxServicePipeBuf.h" … … 285 287 switch (uHandleId) 286 288 { 287 case 2: /* StdErr */289 case OUTPUT_HANDLE_ID_STDERR: /* StdErr */ 288 290 pPipeBuf = &pData->stdErr; 289 291 break; 290 292 291 case 0: /* StdOut */293 case OUTPUT_HANDLE_ID_STDOUT: /* StdOut */ 292 294 default: 293 295 pPipeBuf = &pData->stdOut; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageGuestCtrl.cpp
r36784 r36887 408 408 409 409 Utf8Str Utf8Cmd; 410 uint32_t fFlags = 0; 410 uint32_t fExecFlags = ExecuteProcessFlag_None; 411 uint32_t fOutputFlags = ProcessOutputFlag_None; 411 412 com::SafeArray<IN_BSTR> args; 412 413 com::SafeArray<IN_BSTR> env; … … 418 419 bool fWaitForExit = false; 419 420 bool fWaitForStdOut = false; 420 bool fWaitForStdErr = false;421 421 bool fVerbose = false; 422 422 … … 450 450 451 451 case GETOPTDEF_EXEC_IGNOREORPHANEDPROCESSES: 452 f Flags |= ExecuteProcessFlag_IgnoreOrphanedProcesses;452 fExecFlags |= ExecuteProcessFlag_IgnoreOrphanedProcesses; 453 453 break; 454 454 … … 491 491 492 492 case GETOPTDEF_EXEC_WAITFORSTDERR: 493 fWaitForExit = true; 494 fWaitForStdErr = true; 493 fWaitForExit = (fOutputFlags |= ProcessOutputFlag_StdErr); 495 494 break; 496 495 … … 538 537 ULONG uPID = 0; 539 538 rc = guest->ExecuteProcess(Bstr(Utf8Cmd).raw(), 540 f Flags,539 fExecFlags, 541 540 ComSafeArrayAsInParam(args), 542 541 ComSafeArrayAsInParam(env), … … 590 589 * Some data left to output? 591 590 */ 592 if ( fWaitForStdOut 593 || fWaitForStdErr) 591 if (fOutputFlags || fWaitForStdOut) 594 592 { 595 593 /** @todo r=bird: The timeout argument is bogus in several … … 615 613 * unsigned 64-bit and never return 0. 616 614 */ 617 /** @todo r=bird: We must separate stderr and stdout 618 * output, seems bunched together here which 619 * won't do the trick for unix BOFHs. */ 620 rc = guest->GetProcessOutput(uPID, 0 /* aFlags */, 615 rc = guest->GetProcessOutput(uPID, fOutputFlags, 621 616 RT_MAX(0, cMsTimeout - (RTTimeMilliTS() - u64StartMS)) /* Timeout in ms */, 622 617 _64K, ComSafeArrayAsOutParam(aOutputData)); -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r36721 r36887 8144 8144 8145 8145 <enum 8146 name="ProcessOutputFlag" 8147 uuid="9979e85a-52bb-40b7-870c-57115e27e0f1" 8148 > 8149 <desc> 8150 Guest process output flags for specifying which 8151 type of output to retrieve. 8152 </desc> 8153 8154 <const name="None" value="0"> 8155 <desc>No flags set. Get output from stdout.</desc> 8156 </const> 8157 8158 <const name="StdErr" value="1"> 8159 <desc>Get output from stderr.</desc> 8160 </const> 8161 </enum> 8162 8163 <enum 8146 8164 name="CopyFileFlag" 8147 8165 uuid="23f79fdf-738a-493d-b80b-42d607c9b916" … … 8427 8445 <param name="flags" type="unsigned long" dir="in"> 8428 8446 <desc> 8429 Flags describing which output to retrieve.8447 <link to="ProcessOutputFlag"/> flags. 8430 8448 </desc> 8431 8449 </param> -
trunk/src/VBox/Main/src-client/GuestCtrlImpl.cpp
r36755 r36887 2031 2031 if (aSize < 0) 2032 2032 return setError(E_INVALIDARG, tr("The size argument (%lld) is negative"), aSize); 2033 if (aFlags != 0) /* Flags are not supported at the moment. */ 2034 return setError(E_INVALIDARG, tr("Unknown flags (%#x)"), aFlags); 2033 if (aFlags) 2034 { 2035 if (!(aFlags & ProcessOutputFlag_StdErr)) 2036 { 2037 return setError(E_INVALIDARG, tr("Unknown flags (%#x)"), aFlags); 2038 } 2039 } 2035 2040 2036 2041 AutoCaller autoCaller(this); … … 2060 2065 if (aTimeoutMS == 0) 2061 2066 aTimeoutMS = UINT32_MAX; 2067 /* Set handle ID. */ 2068 uint32_t uHandleID = OUTPUT_HANDLE_ID_STDOUT; /* Default */ 2069 if (aFlags & ProcessOutputFlag_StdErr) 2070 uHandleID = OUTPUT_HANDLE_ID_STDERR; 2062 2071 2063 2072 /* Search for existing PID. */ … … 2073 2082 Assert(uContextID > 0); 2074 2083 2075 com::SafeArray<BYTE> outputData((size_t)aSize);2076 2077 2084 VBOXHGCMSVCPARM paParms[5]; 2078 2085 int i = 0; 2079 2086 paParms[i++].setUInt32(uContextID); 2080 2087 paParms[i++].setUInt32(aPID); 2081 paParms[i++].setUInt32(aFlags); /** @todo Should represent stdout and/or stderr. */ 2082 2088 paParms[i++].setUInt32(uHandleID); 2089 paParms[i++].setUInt32(0 /* Flags, none set yet */); 2090 2091 com::SafeArray<BYTE> outputData((size_t)aSize); 2083 2092 int vrc = VINF_SUCCESS; 2084 2093
Note:
See TracChangeset
for help on using the changeset viewer.