VirtualBox

Ignore:
Timestamp:
Apr 18, 2020 2:13:58 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
137324
Message:

VBoxBalloonCtrl: VC++ 14.1 adjustments. Only include libc++ headers where needed. Elimited stupid std::string usage in --help, reformatted --help output. bugref:8489

Location:
trunk/src/VBox/Frontends/VBoxBalloonCtrl
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxModAPIMonitor.cpp

    r82968 r83798  
    626626    0 /* Not used */,
    627627    /* pszUsage. */
    628     " [--apimon-groups=<string[,stringN]>]\n"
    629     " [--apimon-isln-response=<cmd>] [--apimon-isln-timeout=<ms>]\n"
    630     " [--apimon-resp-timeout=<ms>]",
     628    "           [--apimon-groups=<string[,stringN]>]\n"
     629    "           [--apimon-isln-response=<cmd>] [--apimon-isln-timeout=<ms>]\n"
     630    "           [--apimon-resp-timeout=<ms>]",
    631631    /* pszOptions. */
    632     "--apimon-groups        Sets the VM groups for monitoring (all),\n"
    633     "                       comma-separated list.\n"
    634     "--apimon-isln-response Sets the isolation response to one of:\n"
    635     "                       none, pause, poweroff, save, shutdown\n"
    636     "                       (none).\n"
    637     "--apimon-isln-timeout  Sets the isolation timeout in ms (30s).\n"
    638     "--apimon-resp-timeout  Sets the response timeout in ms (30s).\n",
     632    "  --apimon-groups=<string[,...]>\n"
     633    "      Sets the VM groups for monitoring (all), comma-separated list.\n"
     634    "  --apimon-isln-response=<cmd>\n"
     635    "      Sets the isolation response to one of: none, pause, poweroff,\n"
     636    "      save, or shutdown.  Default: none\n"
     637    "  --apimon-isln-timeout=<ms>\n"
     638    "      Sets the isolation timeout in ms (30s).\n"
     639    "  --apimon-resp-timeout=<ms>\n"
     640    "      Sets the response timeout in ms (30s).\n",
    639641    /* methods. */
    640642    VBoxModAPIMonitorPreInit,
  • trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxModBallooning.cpp

    r82968 r83798  
    746746    0 /* Not used */,
    747747    /* pszUsage. */
    748     " [--balloon-dec=<MB>] [--balloon-groups=<string>] [--balloon-inc=<MB>]\n"
    749     " [--balloon-interval=<ms>] [--balloon-lower-limit=<MB>]\n"
    750     " [--balloon-max=<MB>]\n",
     748    "           [--balloon-dec=<MB>] [--balloon-groups=<string>]\n"
     749    "           [--balloon-inc=<MB>] [--balloon-interval=<ms>]\n"
     750    "           [--balloon-lower-limit=<MB>] [--balloon-max=<MB>]\n"
     751    "           [--balloon-safety-margin=<MB]\n",
    751752    /* pszOptions. */
    752     "--balloon-dec          Sets the ballooning decrement in MB (128 MB).\n"
    753     "--balloon-groups       Sets the VM groups for ballooning (all).\n"
    754     "--balloon-inc          Sets the ballooning increment in MB (256 MB).\n"
    755     "--balloon-interval     Sets the check interval in ms (30 seconds).\n"
    756     "--balloon-lower-limit  Sets the ballooning lower limit in MB (64 MB).\n"
    757     "--balloon-max          Sets the balloon maximum limit in MB (0 MB).\n"
    758     "                       Specifying \"0\" means disabled ballooning.\n"
     753    "  --balloon-dec=<MB>\n"
     754    "      Sets the ballooning decrement in MB (128 MB).\n"
     755    "  --balloon-groups=<string>\n"
     756    "      Sets the VM groups for ballooning (all).\n"
     757    "  --balloon-inc=<MB>\n"
     758    "      Sets the ballooning increment in MB (256 MB).\n"
     759    "  --balloon-interval=<ms>\n"
     760    "      Sets the check interval in ms (30 seconds).\n"
     761    "  --balloon-lower-limit=<MB>\n"
     762    "      Sets the ballooning lower limit in MB (64 MB).\n"
     763    "  --balloon-max=<MB>\n"
     764    "      Sets the balloon maximum limit in MB (0 MB).\n"
     765    "      Specifying \"0\" means disabled ballooning.\n"
    759766#if 1
    760767    /* (Legacy) note. */
    761     "Set \"VBoxInternal/Guest/BalloonSizeMax\" for a per-VM maximum ballooning size.\n"
     768    "      Set \"VBoxInternal/Guest/BalloonSizeMax\" for a per-VM\n"
     769    "      maximum ballooning size.\n"
    762770#endif
    763     "--balloon-safety-margin Free memory when deflating a balloon in MB (1024 MB).\n"
     771    "  --balloon-safety-margin=<MB>\n"
     772    "     Free memory when deflating a balloon in MB (1024 MB).\n"
    764773    ,
    765774    /* methods. */
  • trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxWatchdog.cpp

    r82968 r83798  
    5353#include <iprt/time.h>
    5454
    55 
    56 #include <algorithm>
    57 #include <string>
    5855#include <signal.h>
    5956
     
    6259using namespace com;
    6360
     61
     62/*********************************************************************************************************************************
     63*   Structures and Typedefs                                                                                                      *
     64*********************************************************************************************************************************/
     65/**
     66 * The details of the services that has been compiled in.
     67 */
     68typedef struct VBOXWATCHDOGMOD
     69{
     70    /** Pointer to the service descriptor. */
     71    PCVBOXMODULE    pDesc;
     72    /** Whether Pre-init was called. */
     73    bool            fPreInited;
     74    /** Whether the module is enabled or not. */
     75    bool            fEnabled;
     76} VBOXWATCHDOGMOD, *PVBOXWATCHDOGMOD;
     77
     78enum GETOPTDEF_WATCHDOG
     79{
     80    GETOPTDEF_WATCHDOG_DISABLE_MODULE = 1000,
     81    GETOPTDEF_WATCHDOG_DRYRUN
     82};
     83
     84
     85/*********************************************************************************************************************************
     86*   Global Variables                                                                                                             *
     87*********************************************************************************************************************************/
    6488/** External globals. */
    6589bool                                g_fDryrun     = false;
     
    6993mapVM                               g_mapVM;
    7094mapGroup                            g_mapGroup;
    71 # ifdef VBOX_WATCHDOG_GLOBAL_PERFCOL
     95#ifdef VBOX_WATCHDOG_GLOBAL_PERFCOL
    7296ComPtr<IPerformanceCollector>       g_pPerfCollector = NULL;
    73 # endif
     97#endif
    7498
    7599/** The critical section for the machines map. */
     
    87111static bool          g_fDaemonize = false;
    88112
    89 /**
    90  * The details of the services that has been compiled in.
    91  */
    92 typedef struct VBOXWATCHDOGMOD
    93 {
    94     /** Pointer to the service descriptor. */
    95     PCVBOXMODULE    pDesc;
    96     /** Whether Pre-init was called. */
    97     bool            fPreInited;
    98     /** Whether the module is enabled or not. */
    99     bool            fEnabled;
    100 } VBOXWATCHDOGMOD, *PVBOXWATCHDOGMOD;
    101 
    102113static VBOXWATCHDOGMOD g_aModules[] =
    103114{
     
    106117};
    107118
    108 enum GETOPTDEF_WATCHDOG
    109 {
    110     GETOPTDEF_WATCHDOG_DISABLE_MODULE = 1000,
    111     GETOPTDEF_WATCHDOG_DRYRUN
    112 };
    113 
    114119/**
    115120 * Command line arguments.
    116121 */
    117 static const RTGETOPTDEF g_aOptions[] = {
     122static const RTGETOPTDEF g_aOptions[] =
     123{
    118124#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX) || defined (RT_OS_SOLARIS) || defined(RT_OS_FREEBSD)
    119125    { "--background",           'b',                                       RTGETOPT_REQ_NOTHING },
     
    138144static NativeEventQueue         *g_pEventQ = NULL;
    139145
    140 /* Prototypes. */
     146
     147/*********************************************************************************************************************************
     148*   Internal Functions                                                                                                           *
     149*********************************************************************************************************************************/
    141150static int machineAdd(const Bstr &strUuid);
    142151static int machineRemove(const Bstr &strUuid);
     
    826835
    827836    RTStrmPrintf(g_pStdErr,
    828                  "Usage:\n"
    829                  " %s [-v|--verbose] [-h|-?|--help] [-P|--pidfile]\n"
    830                  " [-F|--logfile=<file>] [-R|--logrotate=<num>] [-S|--logsize=<bytes>]\n"
    831                  " [-I|--loginterval=<seconds>]\n", pszImage);
     837                 "Usage: %s [-v|--verbose] [-h|-?|--help] [-P|--pidfile]\n"
     838                 "           [-F|--logfile=<file>] [-R|--logrotate=<num>] \n"
     839                 "           [-S|--logsize=<bytes>] [-I|--loginterval=<seconds>]\n",
     840                 pszImage);
    832841    for (unsigned j = 0; j < RT_ELEMENTS(g_aModules); j++)
    833842        if (g_aModules[j].pDesc->pszUsage)
    834843            RTStrmPrintf(g_pStdErr, "%s", g_aModules[j].pDesc->pszUsage);
    835844
    836     RTStrmPrintf(g_pStdErr, "\n"
     845    RTStrmPrintf(g_pStdErr,
     846                 "\n"
    837847                 "Options:\n");
    838848
    839     for (unsigned i = 0;
    840          i < RT_ELEMENTS(g_aOptions);
    841          ++i)
    842     {
    843         std::string str(g_aOptions[i].pszLong);
    844         if (g_aOptions[i].iShort < 1000) /* Don't show short options which are defined by an ID! */
    845         {
    846             str += ", -";
    847             str += g_aOptions[i].iShort;
    848         }
    849         str += ":";
    850 
     849    for (unsigned i = 0; i < RT_ELEMENTS(g_aOptions); i++)
     850    {
    851851        const char *pcszDescr = "";
    852 
    853852        switch (g_aOptions[i].iShort)
    854853        {
     
    891890        }
    892891
    893         RTStrmPrintf(g_pStdErr, "%-23s%s\n", str.c_str(), pcszDescr);
     892        if (g_aOptions[i].iShort < 1000)
     893            RTStrmPrintf(g_pStdErr,
     894                         "  %s, -%c\n"
     895                         "      %s\n", g_aOptions[i].pszLong, g_aOptions[i].iShort, pcszDescr);
     896        else
     897            RTStrmPrintf(g_pStdErr,
     898                         "  %s\n"
     899                         "      %s\n", g_aOptions[i].pszLong, g_aOptions[i].iShort, pcszDescr);
    894900    }
    895901
  • trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxWatchdogInternal.h

    r82968 r83798  
    3535#endif /* !VBOX_ONLY_DOCS */
    3636
    37 #include <algorithm>
    3837#include <map>
    39 #include <sstream>
    40 #include <string>
    4138#include <vector>
    4239
  • trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxWatchdogUtils.cpp

    r82968 r83798  
    2222#include <VBox/com/array.h>
    2323#include "VBoxWatchdogInternal.h"
     24
     25#include <iprt/sanitized/sstream>
     26#include <algorithm>
    2427
    2528
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