VirtualBox

Changeset 47622 in vbox for trunk


Ignore:
Timestamp:
Aug 8, 2013 9:10:54 PM (11 years ago)
Author:
vboxsync
Message:

VBoxService/GuestCtrl: More message filtering for guest session + process threads; message processing not needed there, logging.

Location:
trunk/src/VBox/Additions/common/VBoxService
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp

    r47551 r47622  
    345345                                               GUEST_SESSION_NOTIFYTYPE_ERROR, rc /* uint32_t vs. int */);
    346346        if (RT_FAILURE(rc2))
    347         {
    348347            VBoxServiceError("Reporting session error status on open failed with rc=%Rrc\n", rc2);
    349             rc = rc2;
    350         }
    351348    }
    352349
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlProcess.cpp

    r47551 r47622  
    14371437    }
    14381438
     1439    VBoxServiceVerbose(3, "Guest process \"%s\" got client ID=%u, flags=0x%x\n",
     1440                       pProcess->StartupInfo.szCmd, pProcess->uClientID, pProcess->StartupInfo.uFlags);
     1441
     1442    /* The process thread is not interested in receiving any commands;
     1443     * tell the host service. */
     1444    rc = VbglR3GuestCtrlMsgFilterSet(pProcess->uClientID, 0 /* Skip all */, 0);
     1445    if (RT_FAILURE(rc))
     1446    {
     1447        VBoxServiceError("Unable to set message filter, rc=%Rrc\n", rc);
     1448        /* Non-critical. */
     1449    }
     1450
    14391451    rc = GstCntlSessionProcessAdd(pProcess->pSession, pProcess);
    14401452    if (RT_FAILURE(rc))
     
    14451457        return rc;
    14461458    }
    1447 
    1448     VBoxServiceVerbose(3, "Guest process \"%s\" got client ID=%u, flags=0x%x\n",
    1449                        pProcess->StartupInfo.szCmd, pProcess->uClientID, pProcess->StartupInfo.uFlags);
    14501459
    14511460    bool fSignalled = false; /* Indicator whether we signalled the thread user event already. */
     
    19361945               )
    19371946            {
    1938                 VBoxServiceVerbose(3, "[PID %RU32]: dump stdout\n",
    1939                                    pThis->uPID);
    19401947                char szDumpFile[RTPATH_MAX];
    19411948                if (!RTStrPrintf(szDumpFile, sizeof(szDumpFile), "VBoxService_Session%RU32_PID%RU32_StdOut.txt",
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlSession.cpp

    r47620 r47622  
    6363static int                  gstcntlSessionHandleFileSeek(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
    6464static int                  gstcntlSessionHandleFileTell(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
    65 extern int                  gstcntlSessionHandleProcExec(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
    66 extern int                  gstcntlSessionHandleProcInput(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx, void *pvScratchBuf, size_t cbScratchBuf);
    67 extern int                  gstcntlSessionHandleProcOutput(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
    68 extern int                  gstcntlSessionHandleProcTerminate(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
    69 extern int                  gstcntlSessionHandleProcWaitFor(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
    70 /* Guest -> Host handlers. */
     65static int                  gstcntlSessionHandleProcExec(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
     66static int                  gstcntlSessionHandleProcInput(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx, void *pvScratchBuf, size_t cbScratchBuf);
     67static int                  gstcntlSessionHandleProcOutput(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
     68static int                  gstcntlSessionHandleProcTerminate(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
     69static int                  gstcntlSessionHandleProcWaitFor(const PVBOXSERVICECTRLSESSION pSession, PVBGLR3GUESTCTRLCMDCTX pHostCtx);
    7170
    7271
     
    513512    AssertPtrReturn(pHostCtx, VERR_INVALID_POINTER);
    514513
    515     int rc;
     514    int rc = VINF_SUCCESS;
    516515    bool fStartAllowed = false; /* Flag indicating whether starting a process is allowed or not. */
    517516
    518     if (   (pHostCtx->uProtocol <  2 && pHostCtx->uNumParms == 11)
    519         || (pHostCtx->uProtocol >= 2 && pHostCtx->uNumParms == 12)
    520        )
     517    switch (pHostCtx->uProtocol)
     518    {
     519        case 1: /* Guest Additions < 4.3. */
     520            if (pHostCtx->uNumParms != 11)
     521                rc = VERR_NOT_SUPPORTED;
     522            break;
     523
     524        case 2: /* Guest Additions >= 4.3. */
     525            if (pHostCtx->uNumParms != 12)
     526                rc = VERR_NOT_SUPPORTED;
     527            break;
     528
     529        default:
     530            rc = VERR_NOT_SUPPORTED;
     531            break;
     532    }
     533
     534    if (RT_SUCCESS(rc))
    521535    {
    522536        VBOXSERVICECTRLPROCSTARTUPINFO startupInfo;
     
    568582        }
    569583    }
    570     else
    571         rc = VERR_NOT_SUPPORTED; /* Unsupported number of parameters. */
    572584
    573585    /* In case of an error we need to notify the host to not wait forever for our response. */
     
    648660            fPendingClose = true;
    649661#ifdef DEBUG_andy
    650             VBoxServiceVerbose(4, "Got last process input block for PID=%RU32 of size %RU32 ...\n",
     662            VBoxServiceVerbose(4, "Got last process input block for PID=%RU32 (%RU32 bytes) ...\n",
    651663                               uPID, cbSize);
    652664#endif
     
    795807
    796808    int rc = VINF_SUCCESS;
    797 
    798     /** @todo Implement asynchronous handling of all commands to speed up overall
    799      *        performance for handling multiple guest processes at once. At the moment
    800      *        only one guest process at a time can and will be served. */
    801 
    802809    /**
    803810     * Only anonymous sessions (that is, sessions which run with local
     
    926933        VBoxServiceVerbose(3, "Session ID=%RU32 thread running, client ID=%RU32\n",
    927934                           uSessionID, uClientID);
     935
     936        /* The session thread is not interested in receiving any commands;
     937         * tell the host service. */
     938        rc = VbglR3GuestCtrlMsgFilterSet(uClientID, 0 /* Skip all */, 0);
     939        if (RT_FAILURE(rc))
     940        {
     941            VBoxServiceError("Unable to set message filter, rc=%Rrc\n", rc);
     942            /* Non-critical. */
     943        }
    928944    }
    929945    else
     
    11401156            if (rc == VERR_TOO_MUCH_DATA)
    11411157            {
     1158#ifdef DEBUG
    11421159                VBoxServiceVerbose(4, "Message requires %RU32 parameters, but only 2 supplied -- retrying request (no error!)...\n", cParms);
     1160#endif
    11431161                rc = VINF_SUCCESS; /* Try to get "real" message in next block below. */
    11441162            }
     
    11471165            if (RT_SUCCESS(rc))
    11481166            {
     1167#ifdef DEBUG
    11491168                VBoxServiceVerbose(3, "Msg=%RU32 (%RU32 parms) retrieved\n", uMsg, cParms);
    1150 
     1169#endif
    11511170                /* Set number of parameters for current host context. */
    11521171                ctxHost.uNumParms = cParms;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette