Changeset 39427 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Nov 25, 2011 2:29:43 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 75056
- Location:
- trunk/src/VBox/Additions/common
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibGuestCtrl.cpp
r38133 r39427 5 5 6 6 /* 7 * Copyright (C) 2010 Oracle Corporation7 * Copyright (C) 2010-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 109 109 VBoxGuestCtrlHGCMMsgType Msg; 110 110 111 Msg.hdr.result = VERR_WRONG_ORDER;111 Msg.hdr.result = VERR_WRONG_ORDER; 112 112 Msg.hdr.u32ClientID = u32ClientId; 113 113 Msg.hdr.u32Function = GUEST_GET_HOST_MSG; /* Tell the host we want our next command. */ 114 Msg.hdr.cParms = 2;/* Just peek for the next message! */114 Msg.hdr.cParms = 2; /* Just peek for the next message! */ 115 115 116 116 VbglHGCMParmUInt32Set(&Msg.msg, 0); … … 141 141 VBoxGuestCtrlHGCMMsgCancelPendingWaits Msg; 142 142 143 Msg.hdr.result = VERR_WRONG_ORDER;143 Msg.hdr.result = VERR_WRONG_ORDER; 144 144 Msg.hdr.u32ClientID = u32ClientId; 145 145 Msg.hdr.u32Function = GUEST_CANCEL_PENDING_WAITS; 146 Msg.hdr.cParms = 0;146 Msg.hdr.cParms = 0; 147 147 148 148 int rc = vbglR3DoIOCtl(VBOXGUEST_IOCTL_HGCM_CALL(sizeof(Msg)), &Msg, sizeof(Msg)); … … 167 167 ** @todo Docs! 168 168 */ 169 VBGLR3DECL(int) VbglR3GuestCtrlExecGetHostCmd (uint32_t u32ClientId, uint32_t uNumParms,170 uint32_t *puContext,171 char *pszCmd, uint32_t cbCmd,172 uint32_t *puFlags,173 char *pszArgs, uint32_t cbArgs, uint32_t *puNumArgs,174 char *pszEnv, uint32_t *pcbEnv, uint32_t *puNumEnvVars,175 char *pszUser, uint32_t cbUser,176 char *pszPassword, uint32_t cbPassword,177 uint32_t *puTimeLimit)169 VBGLR3DECL(int) VbglR3GuestCtrlExecGetHostCmdExec(uint32_t u32ClientId, uint32_t cParms, 170 uint32_t *puContext, 171 char *pszCmd, uint32_t cbCmd, 172 uint32_t *puFlags, 173 char *pszArgs, uint32_t cbArgs, uint32_t *pcArgs, 174 char *pszEnv, uint32_t *pcbEnv, uint32_t *pcEnvVars, 175 char *pszUser, uint32_t cbUser, 176 char *pszPassword, uint32_t cbPassword, 177 uint32_t *pcMsTimeLimit) 178 178 { 179 179 AssertPtrReturn(puContext, VERR_INVALID_PARAMETER); … … 181 181 AssertPtrReturn(puFlags, VERR_INVALID_PARAMETER); 182 182 AssertPtrReturn(pszArgs, VERR_INVALID_PARAMETER); 183 AssertPtrReturn(p uNumArgs, VERR_INVALID_PARAMETER);183 AssertPtrReturn(pcArgs, VERR_INVALID_PARAMETER); 184 184 AssertPtrReturn(pszEnv, VERR_INVALID_PARAMETER); 185 185 AssertPtrReturn(pcbEnv, VERR_INVALID_PARAMETER); 186 AssertPtrReturn(p uNumEnvVars, VERR_INVALID_PARAMETER);186 AssertPtrReturn(pcEnvVars, VERR_INVALID_PARAMETER); 187 187 AssertPtrReturn(pszUser, VERR_INVALID_PARAMETER); 188 188 AssertPtrReturn(pszPassword, VERR_INVALID_PARAMETER); 189 AssertPtrReturn(p uTimeLimit, VERR_INVALID_PARAMETER);189 AssertPtrReturn(pcMsTimeLimit, VERR_INVALID_PARAMETER); 190 190 191 191 VBoxGuestCtrlHGCMMsgExecCmd Msg; 192 192 193 Msg.hdr.result = VERR_WRONG_ORDER;193 Msg.hdr.result = VERR_WRONG_ORDER; 194 194 Msg.hdr.u32ClientID = u32ClientId; 195 195 Msg.hdr.u32Function = GUEST_GET_HOST_MSG; 196 Msg.hdr.cParms = uNumParms; 196 Msg.hdr.cParms = cParms; /** @todo r=bird: This isn't safe/right. The parameter count of this HGCM call 197 * is fixed from our point of view. */ 197 198 198 199 VbglHGCMParmUInt32Set(&Msg.context, 0); … … 220 221 Msg.context.GetUInt32(puContext); 221 222 Msg.flags.GetUInt32(puFlags); 222 Msg.num_args.GetUInt32(p uNumArgs);223 Msg.num_env.GetUInt32(p uNumEnvVars);223 Msg.num_args.GetUInt32(pcArgs); 224 Msg.num_env.GetUInt32(pcEnvVars); 224 225 Msg.cb_env.GetUInt32(pcbEnv); 225 Msg.timeout.GetUInt32(p uTimeLimit);226 Msg.timeout.GetUInt32(pcMsTimeLimit); 226 227 } 227 228 } … … 237 238 * @returns VBox status code. 238 239 * @param u32ClientId The client id returned by VbglR3GuestCtrlConnect(). 239 * @param uNumParms240 ** @todo Docs! 241 */ 242 VBGLR3DECL(int) VbglR3GuestCtrlExecGetHostCmdOutput(uint32_t u32ClientId, uint32_t uNumParms,240 * @param cParms 241 ** @todo Docs! 242 */ 243 VBGLR3DECL(int) VbglR3GuestCtrlExecGetHostCmdOutput(uint32_t u32ClientId, uint32_t cParms, 243 244 uint32_t *puContext, uint32_t *puPID, 244 245 uint32_t *puHandle, uint32_t *puFlags) … … 254 255 Msg.hdr.u32ClientID = u32ClientId; 255 256 Msg.hdr.u32Function = GUEST_GET_HOST_MSG; 256 Msg.hdr.cParms = uNumParms;257 Msg.hdr.cParms = cParms; 257 258 258 259 VbglHGCMParmUInt32Set(&Msg.context, 0); … … 289 290 * @returns VBox status code. 290 291 * @param u32ClientId The client id returned by VbglR3GuestCtrlConnect(). 291 * @param uNumParms292 ** @todo Docs! 293 */ 294 VBGLR3DECL(int) VbglR3GuestCtrlExecGetHostCmdInput(uint32_t u32ClientId, uint32_t uNumParms,292 * @param cParms 293 ** @todo Docs! 294 */ 295 VBGLR3DECL(int) VbglR3GuestCtrlExecGetHostCmdInput(uint32_t u32ClientId, uint32_t cParms, 295 296 uint32_t *puContext, uint32_t *puPID, 296 297 uint32_t *puFlags, 297 void *pvData,uint32_t cbData,298 void *pvData, uint32_t cbData, 298 299 uint32_t *pcbSize) 299 300 { … … 306 307 VBoxGuestCtrlHGCMMsgExecIn Msg; 307 308 308 Msg.hdr.result = VERR_WRONG_ORDER;309 Msg.hdr.result = VERR_WRONG_ORDER; 309 310 Msg.hdr.u32ClientID = u32ClientId; 310 311 Msg.hdr.u32Function = GUEST_GET_HOST_MSG; 311 Msg.hdr.cParms = uNumParms;312 Msg.hdr.cParms = cParms; 312 313 313 314 VbglHGCMParmUInt32Set(&Msg.context, 0); -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp
r39418 r39427 37 37 *******************************************************************************/ 38 38 /** The control interval (milliseconds). */ 39 uint32_t g_ControlInterval = 0;39 static uint32_t g_cMsControlInterval = 0; 40 40 /** The semaphore we're blocking our main control thread on. */ 41 RTSEMEVENTMULTIg_hControlEvent = NIL_RTSEMEVENTMULTI;41 static RTSEMEVENTMULTI g_hControlEvent = NIL_RTSEMEVENTMULTI; 42 42 /** The guest control service client ID. */ 43 43 static uint32_t g_GuestControlSvcClientID = 0; … … 45 45 * information to the host. Default is 25 processes. If 0 is specified, 46 46 * the maximum number of processes is unlimited. */ 47 uint32_tg_GuestControlProcsMaxKept = 25;47 static uint32_t g_GuestControlProcsMaxKept = 25; 48 48 /** List of guest control threads. */ 49 RTLISTNODEg_GuestControlThreads;49 static RTLISTNODE g_GuestControlThreads; 50 50 /** Critical section protecting g_GuestControlExecThreads. */ 51 RTCRITSECT g_GuestControlThreadsCritSect; 52 51 static RTCRITSECT g_GuestControlThreadsCritSect; 52 53 54 /******************************************************************************* 55 * Internal Functions * 56 *******************************************************************************/ 57 /** @todo Shorten "VBoxServiceControl" to "vbgsvcCntl". */ 53 58 static int VBoxServiceControlStartAllowed(bool *pbAllowed); 59 static int VBoxServiceControlHandleCmdStartProc(uint32_t u32ClientId, uint32_t uNumParms); 60 static int VBoxServiceControlHandleCmdSetInput(uint32_t u32ClientId, uint32_t uNumParms, size_t cbMaxBufSize); 61 static int VBoxServiceControlHandleCmdGetOutput(uint32_t u32ClientId, uint32_t uNumParms); 62 63 54 64 55 65 /** @copydoc VBOXSERVICE::pfnPreInit */ … … 99 109 else if (!strcmp(argv[*pi], "--control-interval")) 100 110 rc = VBoxServiceArgUInt32(argc, argv, "", pi, 101 &g_ ControlInterval, 1, UINT32_MAX - 1);111 &g_cMsControlInterval, 1, UINT32_MAX - 1); 102 112 else if (!strcmp(argv[*pi], "--control-procs-max-kept")) 103 113 rc = VBoxServiceArgUInt32(argc, argv, "", pi, … … 114 124 * Then create the event sem to block on. 115 125 */ 116 if (!g_ ControlInterval)117 g_ ControlInterval = 1000;126 if (!g_cMsControlInterval) 127 g_cMsControlInterval = 1000; 118 128 119 129 int rc = RTSemEventMultiCreate(&g_hControlEvent); … … 167 177 for (;;) 168 178 { 179 VBoxServiceVerbose(3, "Control: Waiting for host msg ...\n"); 169 180 uint32_t uMsg; 170 uint32_t uNumParms; 171 VBoxServiceVerbose(3, "Control: Waiting for host msg ...\n"); 172 rc = VbglR3GuestCtrlWaitForHostMsg(g_GuestControlSvcClientID, &uMsg, &uNumParms); 173 if (RT_FAILURE(rc)) 174 { 175 if (rc == VERR_TOO_MUCH_DATA) 176 { 177 VBoxServiceVerbose(4, "Control: Message requires %ld parameters, but only 2 supplied -- retrying request (no error!)...\n", uNumParms); 178 rc = VINF_SUCCESS; /* Try to get "real" message in next block below. */ 179 } 180 else 181 VBoxServiceVerbose(3, "Control: Getting host message failed with %Rrc\n", rc); /* VERR_GEN_IO_FAILURE seems to be normal if ran into timeout. */ 182 } 183 181 uint32_t cParms; 182 rc = VbglR3GuestCtrlWaitForHostMsg(g_GuestControlSvcClientID, &uMsg, &cParms); 183 if (rc == VERR_TOO_MUCH_DATA) 184 { 185 VBoxServiceVerbose(4, "Control: Message requires %ld parameters, but only 2 supplied -- retrying request (no error!)...\n", cParms); 186 rc = VINF_SUCCESS; /* Try to get "real" message in next block below. */ 187 } 188 else if (RT_FAILURE(rc)) 189 VBoxServiceVerbose(3, "Control: Getting host message failed with %Rrc\n", rc); /* VERR_GEN_IO_FAILURE seems to be normal if ran into timeout. */ 184 190 if (RT_SUCCESS(rc)) 185 191 { 186 VBoxServiceVerbose(3, "Control: Msg=%u (%u parms) retrieved\n", uMsg, uNumParms);187 switch (uMsg)192 VBoxServiceVerbose(3, "Control: Msg=%u (%u parms) retrieved\n", uMsg, cParms); 193 switch (uMsg) 188 194 { 189 195 case HOST_CANCEL_PENDING_WAITS: … … 192 198 193 199 case HOST_EXEC_CMD: 194 rc = VBoxServiceControlHandleCmdStartProc(g_GuestControlSvcClientID, uNumParms);200 rc = VBoxServiceControlHandleCmdStartProc(g_GuestControlSvcClientID, cParms); 195 201 break; 196 202 197 203 case HOST_EXEC_SET_INPUT: 198 204 /** @todo Make buffer size configurable via guest properties/argv! */ 199 rc = VBoxServiceControlHandleCmdSetInput(g_GuestControlSvcClientID, uNumParms, _1M /* Buffer size */);205 rc = VBoxServiceControlHandleCmdSetInput(g_GuestControlSvcClientID, cParms, _1M /* Buffer size */); 200 206 break; 201 207 202 208 case HOST_EXEC_GET_OUTPUT: 203 rc = VBoxServiceControlHandleCmdGetOutput(g_GuestControlSvcClientID, uNumParms);209 rc = VBoxServiceControlHandleCmdGetOutput(g_GuestControlSvcClientID, cParms); 204 210 break; 205 211 … … 231 237 * 232 238 * @returns IPRT status code. 233 * @param u32ClientIdThe HGCM client session ID.234 * @param uNumParmsThe number of parameters the host is offering.235 */ 236 int VBoxServiceControlHandleCmdStartProc(uint32_t uClientID, uint32_t uNumParms)237 { 238 uint32_t uContextID;239 char szCmd[_1K];240 uint32_t uFlags;241 char szArgs[_1K];242 uint32_t uNumArgs;243 char szEnv[_64K];244 uint32_t cbEnv = sizeof(szEnv);245 uint32_t uNumEnvVars;246 char szUser[128];247 char szPassword[128];248 uint32_t uTimeLimitMS;239 * @param idClient The HGCM client session ID. 240 * @param cParms The number of parameters the host is offering. 241 */ 242 static int VBoxServiceControlHandleCmdStartProc(uint32_t idClient, uint32_t cParms) 243 { 244 uint32_t uContextID; 245 char szCmd[_1K]; 246 uint32_t uFlags; 247 char szArgs[_1K]; 248 uint32_t cArgs; 249 char szEnv[_64K]; 250 uint32_t cbEnv = sizeof(szEnv); 251 uint32_t cEnvVars; 252 char szUser[128]; 253 char szPassword[128]; 254 uint32_t uTimeLimitMS; 249 255 250 256 #if 0 /* for valgrind */ … … 256 262 #endif 257 263 258 if ( uNumParms != 11)264 if (cParms != 11) 259 265 return VERR_INVALID_PARAMETER; 260 266 261 int rc = VbglR3GuestCtrlExecGetHostCmd (uClientID,262 uNumParms,263 &uContextID,264 /* Command */265 szCmd, sizeof(szCmd),266 /* Flags */267 &uFlags,268 /* Arguments */269 szArgs, sizeof(szArgs), &uNumArgs,270 /* Environment */271 szEnv, &cbEnv, &uNumEnvVars,272 /* Credentials */273 szUser, sizeof(szUser),274 szPassword, sizeof(szPassword),275 /* Timelimit */276 &uTimeLimitMS);267 int rc = VbglR3GuestCtrlExecGetHostCmdExec(idClient, 268 cParms, 269 &uContextID, 270 /* Command */ 271 szCmd, sizeof(szCmd), 272 /* Flags */ 273 &uFlags, 274 /* Arguments */ 275 szArgs, sizeof(szArgs), &cArgs, 276 /* Environment */ 277 szEnv, &cbEnv, &cEnvVars, 278 /* Credentials */ 279 szUser, sizeof(szUser), 280 szPassword, sizeof(szPassword), 281 /* Timelimit */ 282 &uTimeLimitMS); 277 283 if (RT_SUCCESS(rc)) 278 284 { 279 285 #ifdef DEBUG 280 286 VBoxServiceVerbose(3, "Control: Start process szCmd=%s, uFlags=%u, szArgs=%s, szEnv=%s, szUser=%s, szPW=%s, uTimeout=%u\n", 281 szCmd, uFlags, uNumArgs ? szArgs : "<None>", uNumEnvVars ? szEnv : "<None>", szUser, szPassword, uTimeLimitMS);287 szCmd, uFlags, cArgs ? szArgs : "<None>", cEnvVars ? szEnv : "<None>", szUser, szPassword, uTimeLimitMS); 282 288 #endif 283 289 bool fAllowed = false; … … 294 300 /** @todo Put the following params into a struct! */ 295 301 RTLISTNODE *pThreadNode; 296 rc = VBoxServiceControlThreadStart( uClientID, uContextID,297 szCmd, uFlags, szArgs, uNumArgs,298 szEnv, cbEnv, uNumEnvVars,302 rc = VBoxServiceControlThreadStart(idClient, uContextID, 303 szCmd, uFlags, szArgs, cArgs, 304 szEnv, cbEnv, cEnvVars, 299 305 szUser, szPassword, uTimeLimitMS, 300 306 &pThreadNode); … … 309 315 rc = rc2; 310 316 } 317 /** @todo r=bird: VbglR3GuestCtrlExecReportStatus isn't called for a number 318 * of error paths. Both here and in the thread. I guess that will leave the 319 * host waiting, possibly for ever, for a status report that never arrives. 320 * 321 * There are similar concerns with the termination status report in case the 322 * loop exitted with an error status (VBoxServiceControlThreadProcLoop). 323 */ 311 324 } 312 325 else /* Process start is not allowed due to policy settings. */ 313 326 { 314 327 /* Tell the host. */ 315 rc = VbglR3GuestCtrlExecReportStatus( uClientID, uContextID, 0 /* PID, invalid. */,328 rc = VbglR3GuestCtrlExecReportStatus(idClient, uContextID, 0 /* PID, invalid. */, 316 329 PROC_STS_ERROR, 317 330 !fAllowed ? VERR_MAX_PROCS_REACHED : rc, … … 427 440 * 428 441 * @returns IPRT status code. 429 * @param u32ClientId The HGCM client session ID. 430 * @param uNumParms The number of parameters the host is offering. 442 * @param idClient The HGCM client session ID. 443 * @param cParms The number of parameters the host is 444 * offering. 431 445 * @param cMaxBufSize The maximum buffer size for retrieving the input data. 432 446 */ 433 int VBoxServiceControlHandleCmdSetInput(uint32_t u32ClientId, uint32_t uNumParms, size_t cbMaxBufSize)447 static int VBoxServiceControlHandleCmdSetInput(uint32_t idClient, uint32_t cParms, size_t cbMaxBufSize) 434 448 { 435 449 uint32_t uContextID; … … 448 462 * Ask the host for the input data. 449 463 */ 450 int rc = VbglR3GuestCtrlExecGetHostCmdInput( u32ClientId, uNumParms,464 int rc = VbglR3GuestCtrlExecGetHostCmdInput(idClient, cParms, 451 465 &uContextID, &uPID, &uFlags, 452 466 pabBuffer, cbMaxBufSize, &cbSize); … … 515 529 * regardless whether we got data or not! Otherwise the progress object 516 530 * on the host never will get completed! */ 517 rc = VbglR3GuestCtrlExecReportStatusIn( u32ClientId, uContextID, uPID,531 rc = VbglR3GuestCtrlExecReportStatusIn(idClient, uContextID, uPID, 518 532 uStatus, uFlags, (uint32_t)cbWritten); 519 533 … … 529 543 * 530 544 * @return IPRT status code. 531 * @param u32ClientId idClient The HGCM client session ID. 532 * @param uNumParms cParms The number of parameters the host is 533 * offering. 534 */ 535 int VBoxServiceControlHandleCmdGetOutput(uint32_t u32ClientId, uint32_t uNumParms) 545 * @param idClient The HGCM client session ID. 546 * @param cParms The number of parameters the host is offering. 547 */ 548 static int VBoxServiceControlHandleCmdGetOutput(uint32_t idClient, uint32_t cParms) 536 549 { 537 550 uint32_t uContextID; … … 540 553 uint32_t uFlags; 541 554 542 int rc = VbglR3GuestCtrlExecGetHostCmdOutput( u32ClientId, uNumParms,555 int rc = VbglR3GuestCtrlExecGetHostCmdOutput(idClient, cParms, 543 556 &uContextID, &uPID, &uHandleID, &uFlags); 544 557 if (RT_SUCCESS(rc)) … … 567 580 * on the host never will get completed! */ 568 581 /* cbRead now contains actual size. */ 569 int rc2 = VbglR3GuestCtrlExecSendOut( u32ClientId, uContextID, uPID, uHandleID, uFlags,582 int rc2 = VbglR3GuestCtrlExecSendOut(idClient, uContextID, uPID, uHandleID, uFlags, 570 583 pBuf, cbRead); 571 584 if (RT_SUCCESS(rc)) … … 741 754 * @param uPID PID to search for. 742 755 */ 743 constPVBOXSERVICECTRLTHREAD VBoxServiceControlGetThreadLocked(uint32_t uPID)756 PVBOXSERVICECTRLTHREAD VBoxServiceControlGetThreadLocked(uint32_t uPID) 744 757 { 745 758 PVBOXSERVICECTRLTHREAD pThread = NULL; -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlThread.cpp
r39423 r39427 45 45 46 46 /** 47 * Allocates and gives back a thread data struct which then can be used by the worker thread. 48 * Needs to be freed with VBoxServiceControlExecDestroyThreadData(). 47 * Initialies the passed in thread data structure with the parameters given. 49 48 * 50 49 * @return IPRT status code. … … 63 62 * @param uTimeLimitMS Time limit (in ms) of the process' life time. 64 63 */ 65 int VBoxServiceControlExecThreadAlloc(PVBOXSERVICECTRLTHREAD pThread,66 67 68 69 70 64 static int gstsvcCntlExecThreadInit(PVBOXSERVICECTRLTHREAD pThread, 65 uint32_t u32ContextID, 66 const char *pszCmd, uint32_t uFlags, 67 const char *pszArgs, uint32_t uNumArgs, 68 const char *pszEnv, uint32_t cbEnv, uint32_t uNumEnvVars, 69 const char *pszUser, const char *pszPassword, uint32_t uTimeLimitMS) 71 70 { 72 71 AssertPtr(pThread); … … 392 391 if (fPollEvt == RTPOLL_EVT_READ) 393 392 { 394 char abBuf[_64K]; 393 /** @todo r=bird: Drop this in favor of using /dev/null 394 * (RTFileOpenBitBucket) instead of pipes. That'll simplify the code, 395 * speed stuff up, avoid trouble is RTPoll is buggy and be 396 * compatible with future wait-for-writeable-stderr/out host 397 * notifications. */ 398 char abBuf[_64K]; 395 399 size_t cbRead; 396 400 rc = RTPipeRead(*phPipeR, abBuf, sizeof(abBuf), &cbRead); … … 444 448 445 449 PVBOXSERVICECTRLREQUEST pRequest = pThread->pRequest; 446 AssertPtr(pRequest); 450 AssertPtr(pRequest); /** @todo r=bird: Print error and return if invalid pointer! */ 447 451 448 452 switch (pRequest->enmType) … … 458 462 459 463 case VBOXSERVICECTRLREQUEST_STDIN_WRITE: 460 /* Fall through is intentional. */461 464 case VBOXSERVICECTRLREQUEST_STDIN_WRITE_EOF: 462 465 { … … 484 487 485 488 case VBOXSERVICECTRLREQUEST_STDOUT_READ: 486 /* Fall through is intentional. */487 489 case VBOXSERVICECTRLREQUEST_STDERR_READ: 488 490 { … … 864 866 * @param phPipe Where to return the end of the pipe that we 865 867 * should service. Always set. 868 * 869 * @todo r=bird: Open the bitbucket like txsDoExecHlpRedir does when the host 870 * isn't interested in the guest output. This is easier to handle 871 * elsewhere. 866 872 */ 867 873 static int VBoxServiceControlThreadSetupPipe(int fd, PRTHANDLE ph, PRTHANDLE *pph, PRTPIPE phPipe) … … 1141 1147 1142 1148 /** 1143 * The actual worker routine (lo pp) for a started guest process.1149 * The actual worker routine (loop) for a started guest process. 1144 1150 * 1145 1151 * @return IPRT status code. 1146 1152 * @param PVBOXSERVICECTRLTHREAD Thread data associated with a started process. 1147 1153 */ 1148 static DECLCALLBACK(int)VBoxServiceControlThreadProcessWorker(PVBOXSERVICECTRLTHREAD pThread)1154 static int VBoxServiceControlThreadProcessWorker(PVBOXSERVICECTRLTHREAD pThread) 1149 1155 { 1150 1156 AssertPtrReturn(pThread, VERR_INVALID_POINTER); … … 1429 1435 return VERR_NO_MEMORY; 1430 1436 1431 int rc = VBoxServiceControlExecThreadAlloc(pThread,1432 1433 1434 1435 1436 1437 1437 int rc = gstsvcCntlExecThreadInit(pThread, 1438 uContextID, 1439 pszCmd, uFlags, 1440 pszArgs, uNumArgs, 1441 pszEnv, cbEnv, uNumEnvVars, 1442 pszUser, pszPassword, 1443 uTimeLimitMS); 1438 1444 if (RT_SUCCESS(rc)) 1439 1445 { 1440 static uint32_t uCtrlExecThread = 0; 1441 char szThreadName[32]; 1442 if (!RTStrPrintf(szThreadName, sizeof(szThreadName), "controlexec%ld", uCtrlExecThread++)) 1443 AssertMsgFailed(("Unable to create unique control exec thread name!\n")); 1444 1445 rc = RTThreadCreate(&pThread->Thread, VBoxServiceControlThread, 1446 (void *)(PVBOXSERVICECTRLTHREAD*)pThread, 0, 1447 RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, szThreadName); 1446 static uint32_t s_uCtrlExecThread = 0; 1447 1448 rc = RTThreadCreateF(&pThread->Thread, VBoxServiceControlThread, 1449 pThread /*pvUser*/, 0 /*cbStack*/, 1450 RTTHREADTYPE_DEFAULT, RTTHREADFLAGS_WAITABLE, "controlexec%u", s_uCtrlExecThread++); 1448 1451 if (RT_FAILURE(rc)) 1449 1452 { … … 1494 1497 1495 1498 int rc = VINF_SUCCESS; 1496 constPVBOXSERVICECTRLTHREAD pThread = VBoxServiceControlGetThreadLocked(uPID);1499 PVBOXSERVICECTRLTHREAD pThread = VBoxServiceControlGetThreadLocked(uPID); 1497 1500 if (pThread) 1498 1501 { -
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h
r39418 r39427 340 340 #ifdef VBOX_WITH_GUEST_CONTROL 341 341 /* Guest control functions. */ 342 extern int VBoxServiceControlHandleCmdStartProc(uint32_t u32ClientId, uint32_t uNumParms); 343 extern int VBoxServiceControlHandleCmdSetInput(uint32_t u32ClientId, uint32_t uNumParms, size_t cbMaxBufSize); 344 extern int VBoxServiceControlHandleCmdGetOutput(uint32_t u32ClientId, uint32_t uNumParms); 345 extern const PVBOXSERVICECTRLTHREAD VBoxServiceControlGetThreadLocked(uint32_t uPID); 342 extern PVBOXSERVICECTRLTHREAD VBoxServiceControlGetThreadLocked(uint32_t uPID); 346 343 extern void VBoxServiceControlThreadUnlock(const PVBOXSERVICECTRLTHREAD pThread); 347 344 extern int VBoxServiceControlAssignPID(PVBOXSERVICECTRLTHREAD pThread, uint32_t uPID);
Note:
See TracChangeset
for help on using the changeset viewer.