Lines Matching refs:pSession

56 static int                  gstcntlSessionFileAdd(PVBOXSERVICECTRLSESSION pSession, PVBOXSERVICECTRLFILE pFile);
57 static PVBOXSERVICECTRLFILE gstcntlSessionFileGetLocked(const PVBOXSERVICECTRLSESSION pSession, uint32_t uHandle);
60 static int gstcntlSessionHandleDirRemove(PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
61 static int gstcntlSessionHandleFileOpen(PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
62 static int gstcntlSessionHandleFileClose(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
63 static int gstcntlSessionHandleFileRead(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
64 static int gstcntlSessionHandleFileWrite(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx, void *pvScratchBuf, size_t cbScratchBuf);
65 static int gstcntlSessionHandleFileSeek(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
66 static int gstcntlSessionHandleFileTell(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
67 static int gstcntlSessionHandlePathRename(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
68 static int gstcntlSessionHandleProcExec(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
69 static int gstcntlSessionHandleProcInput(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx, void *pvScratchBuf, size_t cbScratchBuf);
70 static int gstcntlSessionHandleProcOutput(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
71 static int gstcntlSessionHandleProcTerminate(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
72 static int gstcntlSessionHandleProcWaitFor(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
109 static PVBOXSERVICECTRLFILE gstcntlSessionFileGetLocked(const PVBOXSERVICECTRLSESSION pSession,
112 AssertPtrReturn(pSession, NULL);
116 RTListForEach(&pSession->lstFiles, pFileCur, VBOXSERVICECTRLFILE, Node)
126 static int gstcntlSessionHandleDirRemove(PVBOXSERVICECTRLSESSION pSession,
129 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
199 static int gstcntlSessionHandleFileOpen(PVBOXSERVICECTRLSESSION pSession,
202 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
270 /* rc = */ RTListAppend(&pSession->lstFiles, &pFile->Node);
303 static int gstcntlSessionHandleFileClose(const PVBOXSERVICECTRLSESSION pSession,
306 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
315 pFile = gstcntlSessionFileGetLocked(pSession, uHandle);
339 static int gstcntlSessionHandleFileRead(const PVBOXSERVICECTRLSESSION pSession,
343 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
356 pFile = gstcntlSessionFileGetLocked(pSession, uHandle);
397 static int gstcntlSessionHandleFileReadAt(const PVBOXSERVICECTRLSESSION pSession,
401 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
416 pFile = gstcntlSessionFileGetLocked(pSession, uHandle);
457 static int gstcntlSessionHandleFileWrite(const PVBOXSERVICECTRLSESSION pSession,
461 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
477 pFile = gstcntlSessionFileGetLocked(pSession, uHandle);
505 static int gstcntlSessionHandleFileWriteAt(const PVBOXSERVICECTRLSESSION pSession,
509 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
525 pFile = gstcntlSessionFileGetLocked(pSession, uHandle);
554 static int gstcntlSessionHandleFileSeek(const PVBOXSERVICECTRLSESSION pSession,
557 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
572 pFile = gstcntlSessionFileGetLocked(pSession, uHandle);
624 static int gstcntlSessionHandleFileTell(const PVBOXSERVICECTRLSESSION pSession,
627 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
638 pFile = gstcntlSessionFileGetLocked(pSession, uHandle);
666 static int gstcntlSessionHandlePathRename(PVBOXSERVICECTRLSESSION pSession,
669 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
723 * @param pSession Guest session.
726 int gstcntlSessionHandleProcExec(PVBOXSERVICECTRLSESSION pSession,
729 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
790 rc = GstCntlSessionProcessStartAllowed(pSession, &fStartAllowed);
795 rc = GstCntlProcessStart(pSession, &startupInfo, pHostCtx->uContextID);
833 * @param pSession The session which is in charge.
838 int gstcntlSessionHandleProcInput(PVBOXSERVICECTRLSESSION pSession,
842 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
885 PVBOXSERVICECTRLPROCESS pProcess = GstCntlSessionRetainProcess(pSession, uPID);
911 * @param pSession The session which is in charge.
914 int gstcntlSessionHandleProcOutput(PVBOXSERVICECTRLSESSION pSession,
917 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
931 PVBOXSERVICECTRLPROCESS pProcess = GstCntlSessionRetainProcess(pSession, uPID);
957 * @param pSession The session which is in charge.
960 int gstcntlSessionHandleProcTerminate(const PVBOXSERVICECTRLSESSION pSession,
963 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
970 PVBOXSERVICECTRLPROCESS pProcess = GstCntlSessionRetainProcess(pSession, uPID);
989 int gstcntlSessionHandleProcWaitFor(const PVBOXSERVICECTRLSESSION pSession,
992 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
1001 PVBOXSERVICECTRLPROCESS pProcess = GstCntlSessionRetainProcess(pSession, uPID);
1015 int GstCntlSessionHandler(PVBOXSERVICECTRLSESSION pSession,
1020 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
1031 bool fImpersonated = ( pSession->uFlags & VBOXSERVICECTRLSESSION_FLAG_FORK
1032 || pSession->uFlags & VBOXSERVICECTRLSESSION_FLAG_ANONYMOUS);
1038 rc = GstCntlSessionClose(pSession);
1044 ? gstcntlSessionHandleDirRemove(pSession, pHostCtx)
1049 rc = gstcntlSessionHandleProcExec(pSession, pHostCtx);
1053 rc = gstcntlSessionHandleProcInput(pSession, pHostCtx,
1058 rc = gstcntlSessionHandleProcOutput(pSession, pHostCtx);
1062 rc = gstcntlSessionHandleProcTerminate(pSession, pHostCtx);
1066 rc = gstcntlSessionHandleProcWaitFor(pSession, pHostCtx);
1071 ? gstcntlSessionHandleFileOpen(pSession, pHostCtx)
1077 ? gstcntlSessionHandleFileClose(pSession, pHostCtx)
1083 ? gstcntlSessionHandleFileRead(pSession, pHostCtx,
1090 ? gstcntlSessionHandleFileReadAt(pSession, pHostCtx,
1097 ? gstcntlSessionHandleFileWrite(pSession, pHostCtx,
1104 ? gstcntlSessionHandleFileWriteAt(pSession, pHostCtx,
1111 ? gstcntlSessionHandleFileSeek(pSession, pHostCtx)
1117 ? gstcntlSessionHandleFileTell(pSession, pHostCtx)
1123 ? gstcntlSessionHandlePathRename(pSession, pHostCtx)
1349 RTEXITCODE gstcntlSessionForkWorker(PVBOXSERVICECTRLSESSION pSession)
1351 AssertPtrReturn(pSession, RTEXITCODE_FAILURE);
1356 pSession->StartupInfo.uSessionID);
1366 VBOX_GUESTCTRL_FILTER_BY_SESSION(pSession->StartupInfo.uSessionID);
1368 VBOX_GUESTCTRL_CONTEXTID_MAKE_SESSION(pSession->StartupInfo.uSessionID),
1388 VBGLR3GUESTCTRLCMDCTX ctx = { uClientID, VBOX_GUESTCTRL_CONTEXTID_MAKE_SESSION(pSession->StartupInfo.uSessionID) };
1394 pSession->StartupInfo.uSessionID, rc2);
1422 pSession->StartupInfo.uProtocol };
1446 rc = GstCntlSessionHandler(pSession, uMsg, &ctxHost,
1458 VBoxServiceVerbose(0, "Session %RU32 ended\n", pSession->StartupInfo.uSessionID);
1483 PVBOXSERVICECTRLPROCESS GstCntlSessionRetainProcess(PVBOXSERVICECTRLSESSION pSession, uint32_t uPID)
1485 AssertPtrReturn(pSession, NULL);
1488 int rc = RTCritSectEnter(&pSession->CritSect);
1492 RTListForEach(&pSession->lstProcesses, pCurProcess, VBOXSERVICECTRLPROCESS, Node)
1510 rc = RTCritSectLeave(&pSession->CritSect);
1518 int GstCntlSessionClose(PVBOXSERVICECTRLSESSION pSession)
1520 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
1523 pSession->StartupInfo.uSessionID);
1525 int rc = RTCritSectEnter(&pSession->CritSect);
1536 RTListForEach(&pSession->lstProcesses, pProcess, VBOXSERVICECTRLPROCESS, Node)
1545 pProcess = RTListGetFirst(&pSession->lstProcesses, VBOXSERVICECTRLPROCESS, Node);
1549 bool fLast = RTListNodeIsLast(&pSession->lstProcesses, &pProcess->Node);
1551 int rc2 = RTCritSectLeave(&pSession->CritSect);
1558 int rc3 = RTCritSectEnter(&pSession->CritSect);
1571 pProcess = RTListGetFirst(&pSession->lstProcesses, VBOXSERVICECTRLPROCESS, Node);
1575 bool fLast = RTListNodeIsLast(&pSession->lstProcesses, &pProcess->Node);
1585 AssertMsg(RTListIsEmpty(&pSession->lstProcesses),
1594 pFile = RTListGetFirst(&pSession->lstFiles, VBOXSERVICECTRLFILE, Node);
1598 bool fLast = RTListNodeIsLast(&pSession->lstFiles, &pFile->Node);
1616 AssertMsg(RTListIsEmpty(&pSession->lstFiles),
1619 int rc2 = RTCritSectLeave(&pSession->CritSect);
1628 int GstCntlSessionDestroy(PVBOXSERVICECTRLSESSION pSession)
1630 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
1632 int rc = GstCntlSessionClose(pSession);
1635 RTCritSectDelete(&pSession->CritSect);
1641 int GstCntlSessionInit(PVBOXSERVICECTRLSESSION pSession, uint32_t uFlags)
1643 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
1645 RTListInit(&pSession->lstProcesses);
1646 RTListInit(&pSession->lstFiles);
1648 pSession->uFlags = uFlags;
1651 int rc = RTCritSectInit(&pSession->CritSect);
1662 * @param pSession Guest session to add process to.
1665 int GstCntlSessionProcessAdd(PVBOXSERVICECTRLSESSION pSession,
1668 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
1671 int rc = RTCritSectEnter(&pSession->CritSect);
1675 pProcess->uPID, pSession->StartupInfo.uSessionID);
1678 /* rc = */ RTListAppend(&pSession->lstProcesses, &pProcess->Node);
1680 int rc2 = RTCritSectLeave(&pSession->CritSect);
1693 * @param pSession Guest session to remove process from.
1696 int GstCntlSessionProcessRemove(PVBOXSERVICECTRLSESSION pSession,
1699 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
1702 int rc = RTCritSectEnter(&pSession->CritSect);
1706 pProcess->uPID, pSession->StartupInfo.uSessionID);
1711 int rc2 = RTCritSectLeave(&pSession->CritSect);
1728 int GstCntlSessionProcessStartAllowed(const PVBOXSERVICECTRLSESSION pSession,
1731 AssertPtrReturn(pSession, VERR_INVALID_POINTER);
1734 int rc = RTCritSectEnter(&pSession->CritSect);
1742 if (pSession->uProcsMaxKept) /* If we allow unlimited processes (=0), take a shortcut. */
1746 RTListForEach(&pSession->lstProcesses, pProcess, VBOXSERVICECTRLPROCESS, Node)
1750 pSession->uProcsMaxKept, uProcsRunning);
1752 int32_t iProcsLeft = (pSession->uProcsMaxKept - uProcsRunning - 1);
1756 pSession->uProcsMaxKept);
1763 int rc2 = RTCritSectLeave(&pSession->CritSect);
2027 &pSession->StdIn.hChild, &pSession->StdIn.phChild, &pSession->hStdInW);
2031 &pSession->StdOut.hChild, &pSession->StdOut.phChild, &pSession->hStdOutR);
2035 &pSession->StdErr.hChild, &pSession->StdErr.phChild, &pSession->hStdErrR);
2038 rc = RTPollSetCreate(&pSession->hPollSet);
2040 rc = RTPollSetAddPipe(pSession->hPollSet, pSession->hStdInW, RTPOLL_EVT_ERROR,
2043 rc = RTPollSetAddPipe(pSession->hPollSet, pSession->hStdOutR, RTPOLL_EVT_READ | RTPOLL_EVT_ERROR,
2046 rc = RTPollSetAddPipe(pSession->hPollSet, pSession->hStdErrR, RTPOLL_EVT_READ | RTPOLL_EVT_ERROR,
2052 pSession->StdIn.phChild, pSession->StdOut.phChild, pSession->StdErr.phChild,
2053 !fAnonymous ? pSession->StartupInfo.szUser : NULL,
2054 !fAnonymous ? pSession->StartupInfo.szPassword : NULL,
2055 &pSession->hProcess);
2062 int rc2 = RTHandleClose(pSession->StdIn.phChild); AssertRC(rc2);
2063 pSession->StdIn.phChild = NULL;
2064 rc2 = RTHandleClose(pSession->StdOut.phChild); AssertRC(rc2);
2065 pSession->StdOut.phChild = NULL;
2066 rc2 = RTHandleClose(pSession->StdErr.phChild); AssertRC(rc2);
2067 pSession->StdErr.phChild = NULL;