VirtualBox

Changeset 29345 in vbox for trunk/src/VBox/Additions


Ignore:
Timestamp:
May 11, 2010 12:22:48 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
61450
Message:

VBoxService,VBox/err.h: Use a dedicated status code for this, VERR_NOT_IMPLEMENTED and VERR_NOT_SUPPORTED are not suitable. Disable ballooning if either VbglR3MemBalloonRefresh or VBoxServiceBalloonSetUser fails instead of just checking the first. Don't display an error message on non-Windows hosts when ballooning is unavailbe (status code mixup).

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

Legend:

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

    r29343 r29345  
    310310            if (RT_FAILURE(rc))
    311311            {
    312                 /*
    313                  * HACK ALERT! If a service uses some sort of functionality (like a
    314                  * certain HGCM host service which is not available on the host or
    315                  * some special OS feature which is not available on the current guest),
    316                  * just disable that service here in case the service told us so.
    317                  *
    318                  * This prevents terminating the whole VBoxService if a (or some) sub service(s) is/are
    319                  * not available.
    320                  */
    321 
    322                 /** @todo r=bird: This a generic thing that isn't necessarily restricted to
    323                  *        HGCM.  Also, the service knows best whether a host service is required
    324                  *        or optional.  So, there service should either have a way of signalling
    325                  *        non-fatal init failure, or simply quietly pretend to work.  (Low
    326                  *        prio.) */
    327                 if (   rc == VERR_NOT_SUPPORTED
    328                     || rc == VERR_NOT_IMPLEMENTED)
    329                 {
    330                     VBoxServiceVerbose(0, "Service '%s' disabled because a certain functionality is not implemented or supported, rc=%Rrc\n",
    331                                        g_aServices[j].pDesc->pszName, rc);
    332                     g_aServices[j].fEnabled = false;
    333                 }
    334                 else
     312                if (rc != VERR_SERVICE_DISABLED)
    335313                {
    336314                    VBoxServiceError("Service '%s' failed to initialize: %Rrc\n",
     
    338316                    return rc;
    339317                }
     318                g_aServices[j].fEnabled = false;
     319                VBoxServiceVerbose(0, "Service '%s' was disabled because of missing functionality\n",
     320                                   g_aServices[j].pDesc->pszName);
     321
    340322            }
    341323        }
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceBalloon.cpp

    r29320 r29345  
    267267            g_cMemBalloonChunks = cNewChunks;
    268268    }
    269     else
    270     {
    271         if (rc == VERR_INVALID_PARAMETER) /* Host service is not available. */
     269    if (RT_FAILURE(rc))
     270    {
     271        /* If the service was not found, we disable this service without
     272           causing VBoxService to fail. */
     273        if (   rc == VERR_NOT_IMPLEMENTED
     274#ifdef RT_OS_WINDOWS /** @todo r=bird: Windows kernel driver should return VERR_NOT_IMPLEMENTED,
     275                      *  VERR_INVALID_PARAMETER has too many other uses. */
     276            || rc == VERR_INVALID_PARAMETER
     277#endif
     278            )
     279        {
    272280            VBoxServiceVerbose(0, "MemBalloon: Memory ballooning support is not available\n");
     281            rc = VERR_SERVICE_DISABLED;
     282        }
    273283        else
     284        {
    274285            VBoxServiceVerbose(3, "MemBalloon: VbglR3MemBalloonRefresh failed with %Rrc\n", rc);
     286            rc = VERR_SERVICE_DISABLED; /** @todo Playing safe for now, figure out the exact status codes here. */
     287        }
    275288        RTSemEventMultiDestroy(g_MemBalloonEvent);
    276289        g_MemBalloonEvent = NIL_RTSEMEVENTMULTI;
    277 
    278         /*
    279          * Not having the guest control service on the host renders this whole service
    280          * unusable, so report that we are not able to continue.
    281          */
    282         rc = VERR_NOT_SUPPORTED;
    283290    }
    284291
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceControl.cpp

    r29316 r29345  
    8989    else
    9090    {
     91        /* If the service was not found, we disable this service without
     92           causing VBoxService to fail. */
    9193        if (rc == VERR_HGCM_SERVICE_NOT_FOUND) /* Host service is not available. */
     94        {
    9295            VBoxServiceVerbose(0, "Control: Guest control service is not available\n");
     96            rc = VERR_SERVICE_DISABLED;
     97        }
    9398        else
    9499            VBoxServiceError("Control: Failed to connect to the guest control service! Error: %Rrc\n", rc);
    95100        RTSemEventMultiDestroy(g_hControlEvent);
    96101        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;
    103102    }
    104103    return rc;
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceStats.cpp

    r29316 r29345  
    55
    66/*
    7  * Copyright (C) 2006-2007 Oracle Corporation
     7 * Copyright (C) 2006-2010 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    135135        {
    136136            VBoxServiceVerbose(3, "VBoxStatsInit: NTDLL.NtQuerySystemInformation not found!\n");
    137             return VERR_NOT_IMPLEMENTED;
     137            return VERR_SERVICE_DISABLED;
    138138        }
    139139    }
     
    150150            /** @todo Now fails in NT4; do we care? */
    151151            VBoxServiceVerbose(3, "VBoxStatsInit: KERNEL32.GlobalMemoryStatusEx not found!\n");
    152             return VERR_NOT_IMPLEMENTED;
     152            return VERR_SERVICE_DISABLED;
    153153        }
    154154    }
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp

    r29316 r29345  
    108108
    109109#ifdef RT_OS_WINDOWS
    110     /** @todo Use RTLdr instead of LoadLibrary/GetProcAddress here! */
    111 
     110    /** @todo r=bird: call a windows specific init function and move
     111     *        g_pfnWTSGetActiveConsoleSessionId out of the global scope.  */
    112112    /* Get function pointers. */
    113113    HMODULE hKernel32 = LoadLibrary("kernel32");
     
    124124    else
    125125    {
     126        /* If the service was not found, we disable this service without
     127           causing VBoxService to fail. */
    126128        if (rc == VERR_HGCM_SERVICE_NOT_FOUND) /* Host service is not available. */
    127             VBoxServiceVerbose(0, "VMInfo: Guest property service is not available\n");
     129        {
     130            VBoxServiceVerbose(0, "VMInfo: Guest property service is not available, disabling the service\n");
     131            rc = VERR_SERVICE_DISABLED;
     132        }
    128133        else
    129134            VBoxServiceError("VMInfo: Failed to connect to the guest property service! Error: %Rrc\n", rc);
    130135        RTSemEventMultiDestroy(g_hVMInfoEvent);
    131136        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;
    138137    }
    139138
     
    142141        VBoxServicePropCacheCreate(&g_VMInfoPropCache, g_uVMInfoGuestPropSvcClientID);
    143142
    144         /** @todo r=bird: Setting Net/Count to 0 here is wrong and will confuse users.
    145          *        Besides, because it is the beacon updating it implies that all the
    146          *        other values are up to date too, but they aren't
    147          *        (VBoxServiceVMInfoWriteFixedProperties hasn't been called yet for
    148          *        instance).  I would suggest changing these statements to
    149          *        "declarations" or moving them. */
    150 
    151143        /*
    152          * Initialize some guest properties to have flags and reset values.
     144         * Declare some guest properties with flags and reset values.
    153145         */
    154146        VBoxServicePropCacheUpdateEntry(&g_VMInfoPropCache, "/VirtualBox/GuestInfo/OS/LoggedInUsersList",
     
    496488
    497489        /** @todo r=bird: if cInterfaces decreased compared to the previous run, zap
    498          *        the stale data. */
     490         *        the stale data.  This can probably be encorporated into the cache.  */
    499491
    500492
     
    549541         *        terminates). [don't remove till implemented]
    550542         */
    551         /** @todo r=bird: Drop the VbglR3GuestPropDelSet call here and make the cache
    552          *        remember what we've written. */
     543        /** @todo r=bird: Drop the VbglR3GuestPropDelSet call here and use the cache
     544         *        since it remembers what we've written. */
    553545        /* Delete the "../Net" branch. */
    554546        const char *apszPat[1] = { "/VirtualBox/GuestInfo/Net/*" };
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