VirtualBox

Changeset 40682 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Mar 28, 2012 2:36:01 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
77136
Message:

VBoxService/GuestCtrl: Bugfixes.

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

Legend:

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

    r40529 r40682  
    234234    {
    235235        VBoxServiceVerbose(3, "Waiting for host msg ...\n");
    236         uint32_t uMsg;
    237         uint32_t cParms;
     236        uint32_t uMsg = 0;
     237        uint32_t cParms = 0;
    238238        rc = VbglR3GuestCtrlWaitForHostMsg(g_uControlSvcClientID, &uMsg, &cParms);
    239239        if (rc == VERR_TOO_MUCH_DATA)
     
    356356        VBoxServiceError("Starting process failed with rc=%Rrc\n", rc);
    357357
    358         int rc2 = VbglR3GuestCtrlExecReportStatus(uClientID, uContextID, 0 /* PID, invalid. */,
     358        /*
     359         * Note: The context ID can be 0 because we mabye weren't able to fetch the command
     360         *       from the host. The host in case has to deal with that!
     361         */
     362        int rc2 = VbglR3GuestCtrlExecReportStatus(uClientID, uContextID /* Might be 0 */, 0 /* PID, invalid */,
    359363                                                  PROC_STS_ERROR, rc,
    360364                                                  NULL /* pvData */, 0 /* cbData */);
     
    591595        if (RT_SUCCESS(rc))
    592596        {
    593             if (cbWritten || !cbSize) /* Did we write something or was there anything to write at all? */
    594             {
    595                 uStatus = INPUT_STS_WRITTEN;
    596                 uFlags = 0;
    597             }
     597            uStatus = INPUT_STS_WRITTEN;
     598            uFlags = 0; /* No flags at the moment. */
    598599        }
    599600        else
     
    752753            PVBOXSERVICECTRLTHREAD pNext = RTListNodeGetNext(&pThread->Node, VBOXSERVICECTRLTHREAD, Node);
    753754            bool fLast = RTListNodeIsLast(&g_lstControlThreadsInactive, &pThread->Node);
    754 
    755             int rc2 = VBoxServiceControlThreadWait(pThread, 30 * 1000 /* 30 seconds max. */);
     755            int rc2 = VBoxServiceControlThreadWait(pThread, 30 * 1000 /* 30 seconds max. */,
     756                                                   NULL /* rc */);
    756757            if (RT_SUCCESS(rc2))
    757758            {
     
    761762                if (RT_FAILURE(rc2))
    762763                {
    763                     VBoxServiceError("Stopping guest process thread failed with rc=%Rrc\n", rc2);
     764                    VBoxServiceError("Freeing guest process thread failed with rc=%Rrc\n", rc2);
    764765                    if (RT_SUCCESS(rc)) /* Keep original failure. */
    765766                        rc = rc2;
     
    806807
    807808        int rc2 = VBoxServiceControlThreadWait(pThread,
    808                                                30 * 1000 /* Wait 30 seconds max. */);
     809                                               30 * 1000 /* Wait 30 seconds max. */,
     810                                               NULL /* rc */);
    809811        if (RT_FAILURE(rc2))
    810812            VBoxServiceError("Guest process thread failed to stop; rc=%Rrc\n", rc2);
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControlThread.cpp

    r40531 r40682  
    236236 * @param   pThread             Thread to wait shutting down for.
    237237 * @param   RTMSINTERVAL        Timeout in ms to wait for shutdown.
     238 * @param   prc                 Where to store the thread's return code. Optional.
    238239 */
    239240int VBoxServiceControlThreadWait(const PVBOXSERVICECTRLTHREAD pThread,
    240                                  RTMSINTERVAL msTimeout)
     241                                 RTMSINTERVAL msTimeout, int *prc)
    241242{
    242243    AssertPtrReturn(pThread, VERR_INVALID_POINTER);
     244    /* prc is optional. */
     245
    243246    int rc = VINF_SUCCESS;
    244247    if (   pThread->Thread != NIL_RTTHREAD
    245248        && ASMAtomicReadBool(&pThread->fStarted))
    246249    {
    247         VBoxServiceVerbose(2, "[PID %u]: Waiting for shutdown ...\n",
    248                            pThread->uPID);
     250        VBoxServiceVerbose(2, "[PID %u]: Waiting for shutdown of pThread=0x%p = \"%s\"...\n",
     251                           pThread->uPID, pThread, pThread->pszCmd);
    249252
    250253        /* Wait a bit ... */
     
    258261        else
    259262        {
    260             if (RT_FAILURE(rcThread))
    261             {
    262                 VBoxServiceError("[PID %u]: Shutdown returned error rc=%Rrc\n",
    263                                  pThread->uPID, rcThread);
    264                 rc = rcThread;
    265             }
     263            VBoxServiceVerbose(3, "[PID %u]: Thread reported exit code=%Rrc\n",
     264                               pThread->uPID, rcThread);
     265            if (prc)
     266                *prc = rcThread;
    266267        }
    267268    }
     
    13791380{
    13801381    AssertPtrReturn(pThread, VERR_INVALID_POINTER);
    1381     VBoxServiceVerbose(3, "Thread of process \"%s\" started\n", pThread->pszCmd);
     1382    VBoxServiceVerbose(3, "Thread of process pThread=0x%p = \"%s\" started\n",
     1383                       pThread, pThread->pszCmd);
    13821384
    13831385    int rc = VBoxServiceControlListSet(VBOXSERVICECTRLTHREADLIST_RUNNING, pThread);
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceInternal.h

    r40158 r40682  
    55
    66/*
    7  * Copyright (C) 2007-2011 Oracle Corporation
     7 * Copyright (C) 2007-2012 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    397397extern int                      VBoxServiceControlThreadPerform(uint32_t uPID, PVBOXSERVICECTRLREQUEST pRequest);
    398398extern int                      VBoxServiceControlThreadStop(const PVBOXSERVICECTRLTHREAD pThread);
    399 extern int                      VBoxServiceControlThreadWait(const PVBOXSERVICECTRLTHREAD pThread, RTMSINTERVAL msTimeout);
     399extern int                      VBoxServiceControlThreadWait(const PVBOXSERVICECTRLTHREAD pThread,
     400                                                             RTMSINTERVAL msTimeout, int *prc);
    400401extern int                      VBoxServiceControlThreadFree(PVBOXSERVICECTRLTHREAD pThread);
    401402/* Request handling. */
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceToolBox.cpp

    r39612 r40682  
    55
    66/*
    7  * Copyright (C) 2011 Oracle Corporation
     7 * Copyright (C) 2012 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
Note: See TracChangeset for help on using the changeset viewer.

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