VirtualBox

Changeset 29316 in vbox for trunk/src


Ignore:
Timestamp:
May 11, 2010 8:12:08 AM (15 years ago)
Author:
vboxsync
Message:

VBoxService: More generic way for letting services disable themselves; logging adjustments, some todos.

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

Legend:

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

    r29313 r29316  
    308308            {
    309309                /*
    310                  * HACK ALERT! If a service uses some sort of HGCM host service
    311                  * which is not available on the host (maybe because the host is
    312                  * using an older VBox version), just disable that service here.
     310                 * HACK ALERT! If a service uses some sort of functionality (like a
     311                 * certain HGCM host service which is not available on the host or
     312                 * some special OS feature which is not available on the current guest),
     313                 * just disable that service here in case the service told us so.
     314                 *
     315                 * This prevents terminating the whole VBoxService if a (or some) sub service(s) is/are
     316                 * not available.
    313317                 */
     318
    314319                /** @todo r=bird: This a generic thing that isn't necessarily restricted to
    315320                 *        HGCM.  Also, the service knows best whether a host service is required
     
    317322                 *        non-fatal init failure, or simply quietly pretend to work.  (Low
    318323                 *        prio.) */
    319                 if (rc == VERR_HGCM_SERVICE_NOT_FOUND)
    320                     VBoxServiceVerbose(0, "Service '%s' failed to find a HGCM service and was disabled\n",
     324                if (   rc == VERR_NOT_SUPPORTED
     325                    || rc == VERR_NOT_IMPLEMENTED)
     326                {
     327                    VBoxServiceVerbose(0, "Service '%s' disabled because a certain functionality is not implemented or supported, rc=%Rrc\n",
    321328                                       g_aServices[j].pDesc->pszName, rc);
     329                    g_aServices[j].fEnabled = false;
     330                }
    322331                else
    323332                {
     
    326335                    return rc;
    327336                }
    328                 g_aServices[j].fEnabled = false;
    329337            }
    330338        }
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp

    r29202 r29316  
    8989    else
    9090    {
    91         if (rc == VERR_HGCM_SERVICE_NOT_FOUND) /* Host service is not available; that's not fatal. */
    92             VBoxServiceVerbose(0, "Guest control service is not available\n");
     91        if (rc == VERR_HGCM_SERVICE_NOT_FOUND) /* Host service is not available. */
     92            VBoxServiceVerbose(0, "Control: Guest control service is not available\n");
    9393        else
    9494            VBoxServiceError("Control: Failed to connect to the guest control service! Error: %Rrc\n", rc);
    9595        RTSemEventMultiDestroy(g_hControlEvent);
    9696        g_hControlEvent = NIL_RTSEMEVENTMULTI;
     97
     98        /*
     99         * Not having the guest control service on the host renders this whole service
     100         * unusable, so report that we are not able to continue.
     101         */
     102        rc = VERR_NOT_SUPPORTED;
    97103    }
    98104    return rc;
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceStats.cpp

    r28800 r29316  
    118118    rc = VbglR3StatQueryInterval(&gCtx.cMsStatInterval);
    119119    if (RT_SUCCESS(rc))
    120         VBoxServiceVerbose(3, "VBoxStatsInit: new statistics interval %u seconds\n", gCtx.cMsStatInterval);
     120        VBoxServiceVerbose(3, "VBoxStatsInit: New statistics interval %u seconds\n", gCtx.cMsStatInterval);
    121121    else
    122122        VBoxServiceVerbose(3, "VBoxStatsInit: DeviceIoControl failed with %d\n", rc);
    123123
    124124#ifdef RT_OS_WINDOWS
     125    /** @todo Use RTLdr instead of LoadLibrary/GetProcAddress here! */
     126
    125127    /* NtQuerySystemInformation might be dropped in future releases, so load it dynamically as per Microsoft's recommendation */
    126128    HMODULE hMod = LoadLibrary("NTDLL.DLL");
     
    132134        else
    133135        {
    134             VBoxServiceError("VBoxStatsInit: NTDLL.NtQuerySystemInformation not found!!\n");
     136            VBoxServiceVerbose(3, "VBoxStatsInit: NTDLL.NtQuerySystemInformation not found!\n");
    135137            return VERR_NOT_IMPLEMENTED;
    136138        }
     
    146148        else
    147149        {
    148             /** @todo now fails in NT4; do we care? */
    149             VBoxServiceError("VBoxStatsInit: KERNEL32.GlobalMemoryStatusEx not found!!\n");
     150            /** @todo Now fails in NT4; do we care? */
     151            VBoxServiceVerbose(3, "VBoxStatsInit: KERNEL32.GlobalMemoryStatusEx not found!\n");
    150152            return VERR_NOT_IMPLEMENTED;
    151153        }
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp

    r29040 r29316  
    108108
    109109#ifdef RT_OS_WINDOWS
     110    /** @todo Use RTLdr instead of LoadLibrary/GetProcAddress here! */
     111
    110112    /* Get function pointers. */
    111113    HMODULE hKernel32 = LoadLibrary("kernel32");
     
    119121    rc = VbglR3GuestPropConnect(&g_uVMInfoGuestPropSvcClientID);
    120122    if (RT_SUCCESS(rc))
    121         VBoxServiceVerbose(3, "Property Service Client ID: %#x\n", g_uVMInfoGuestPropSvcClientID);
     123        VBoxServiceVerbose(3, "VMInfo: Property Service Client ID: %#x\n", g_uVMInfoGuestPropSvcClientID);
    122124    else
    123125    {
    124         VBoxServiceError("Failed to connect to the guest property service! Error: %Rrc\n", rc);
     126        if (rc == VERR_HGCM_SERVICE_NOT_FOUND) /* Host service is not available. */
     127            VBoxServiceVerbose(0, "VMInfo: Guest property service is not available\n");
     128        else
     129            VBoxServiceError("VMInfo: Failed to connect to the guest property service! Error: %Rrc\n", rc);
    125130        RTSemEventMultiDestroy(g_hVMInfoEvent);
    126131        g_hVMInfoEvent = NIL_RTSEMEVENTMULTI;
     132
     133        /*
     134         * Not having the guest property service on the host renders this whole service
     135         * unusable, so report that we are not able to continue.
     136         */
     137        rc = VERR_NOT_SUPPORTED;
    127138    }
    128139
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