Changeset 47481 in vbox for trunk/src/VBox
- Timestamp:
- Jul 30, 2013 7:11:43 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp
r47476 r47481 1366 1366 * 1367 1367 * @return IPRT status code. 1368 * @param p Thread Threadto assign PID to.1368 * @param pProcess Process to assign PID to. 1369 1369 * @param uPID PID to assign to the specified guest control execution thread. 1370 1370 */ 1371 int gstcntlProcessAssignPID(PVBOXSERVICECTRLPROCESS p Thread, uint32_t uPID)1372 { 1373 AssertPtrReturn(p Thread, VERR_INVALID_POINTER);1371 int gstcntlProcessAssignPID(PVBOXSERVICECTRLPROCESS pProcess, uint32_t uPID) 1372 { 1373 AssertPtrReturn(pProcess, VERR_INVALID_POINTER); 1374 1374 AssertReturn(uPID, VERR_INVALID_PARAMETER); 1375 1375 1376 AssertPtr(p Thread->pSession);1377 int rc = RTCritSectEnter(&p Thread->pSession->CritSect);1376 AssertPtr(pProcess->pSession); 1377 int rc = RTCritSectEnter(&pProcess->pSession->CritSect); 1378 1378 if (RT_SUCCESS(rc)) 1379 1379 { 1380 1380 /* Search old threads using the desired PID and shut them down completely -- it's 1381 1381 * not used anymore. */ 1382 PVBOXSERVICECTRLPROCESS p ThreadCur;1383 bool fTryAgain = false;1382 PVBOXSERVICECTRLPROCESS pProcessCur; 1383 bool fTryAgain; 1384 1384 do 1385 1385 { 1386 RTListForEach(&pThread->pSession->lstProcessesActive, pThreadCur, VBOXSERVICECTRLPROCESS, Node) 1387 { 1388 if (pThreadCur->uPID == uPID) 1386 fTryAgain = false; 1387 RTListForEach(&pProcess->pSession->lstProcessesActive, pProcessCur, VBOXSERVICECTRLPROCESS, Node) 1388 { 1389 if (pProcessCur->uPID == uPID) 1389 1390 { 1390 Assert(p ThreadCur != pThread); /* can't happen */1391 Assert(pProcessCur != pProcess); /* can't happen */ 1391 1392 uint32_t uTriedPID = uPID; 1392 1393 uPID += 391939; 1393 VBoxServiceVerbose(2, "PID %RU32 was used before , trying again with %u...\n",1394 uTriedPID, uPID);1394 VBoxServiceVerbose(2, "PID %RU32 was used before (process %p), trying again with %RU32 ...\n", 1395 uTriedPID, pProcessCur, uPID); 1395 1396 fTryAgain = true; 1396 1397 break; … … 1400 1401 1401 1402 /* Assign PID to current thread. */ 1402 p Thread->uPID = uPID;1403 1404 rc = RTCritSectLeave(&p Thread->pSession->CritSect);1403 pProcess->uPID = uPID; 1404 1405 rc = RTCritSectLeave(&pProcess->pSession->CritSect); 1405 1406 AssertRC(rc); 1406 1407 }
Note:
See TracChangeset
for help on using the changeset viewer.