- Timestamp:
- Mar 2, 2016 9:45:03 AM (9 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxBalloonCtrl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxModBallooning.cpp
r57358 r59893 5 5 6 6 /* 7 * Copyright (C) 2011-201 3Oracle Corporation7 * Copyright (C) 2011-2016 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 29 29 using namespace com; 30 30 31 #define VBOX_MOD_BALLOONING_NAME "balloon ctrl"31 #define VBOX_MOD_BALLOONING_NAME "balloon" 32 32 33 33 /** -
trunk/src/VBox/Frontends/VBoxBalloonCtrl/VBoxWatchdog.cpp
r57358 r59893 5 5 6 6 /* 7 * Copyright (C) 2011-201 3Oracle Corporation7 * Copyright (C) 2011-2016 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 90 90 * The details of the services that has been compiled in. 91 91 */ 92 static struct 92 typedef struct VBOXWATCHDOGMOD 93 93 { 94 94 /** Pointer to the service descriptor. */ … … 98 98 /** Whether the module is enabled or not. */ 99 99 bool fEnabled; 100 } g_aModules[] = 100 } VBOXWATCHDOGMOD, *PVBOXWATCHDOGMOD; 101 102 static VBOXWATCHDOGMOD g_aModules[] = 101 103 { 102 104 { &g_ModBallooning, false /* Pre-inited */, true /* Enabled */ }, … … 106 108 enum GETOPTDEF_WATCHDOG 107 109 { 108 GETOPTDEF_WATCHDOG_DRYRUN = 1000 110 GETOPTDEF_WATCHDOG_DISABLE_MODULE = 1000, 111 GETOPTDEF_WATCHDOG_DRYRUN 109 112 }; 110 113 … … 117 120 #endif 118 121 /** For displayHelp(). */ 119 { "--dryrun", GETOPTDEF_WATCHDOG_DRYRUN, RTGETOPT_REQ_NOTHING }, 120 { "--help", 'h', RTGETOPT_REQ_NOTHING }, 121 { "--verbose", 'v', RTGETOPT_REQ_NOTHING }, 122 { "--pidfile", 'P', RTGETOPT_REQ_STRING }, 123 { "--logfile", 'F', RTGETOPT_REQ_STRING }, 124 { "--logrotate", 'R', RTGETOPT_REQ_UINT32 }, 125 { "--logsize", 'S', RTGETOPT_REQ_UINT64 }, 126 { "--loginterval", 'I', RTGETOPT_REQ_UINT32 } 122 { "--disable-<module>", GETOPTDEF_WATCHDOG_DISABLE_MODULE, RTGETOPT_REQ_NOTHING }, 123 { "--dryrun", GETOPTDEF_WATCHDOG_DRYRUN, RTGETOPT_REQ_NOTHING }, 124 { "--help", 'h', RTGETOPT_REQ_NOTHING }, 125 { "--verbose", 'v', RTGETOPT_REQ_NOTHING }, 126 { "--pidfile", 'P', RTGETOPT_REQ_STRING }, 127 { "--logfile", 'F', RTGETOPT_REQ_STRING }, 128 { "--logrotate", 'R', RTGETOPT_REQ_UINT32 }, 129 { "--logsize", 'S', RTGETOPT_REQ_UINT64 }, 130 { "--loginterval", 'I', RTGETOPT_REQ_UINT32 } 127 131 }; 128 132 … … 629 633 630 634 for (unsigned j = 0; j < RT_ELEMENTS(g_aModules); j++) 631 if (g_aModules[j].fEnabled) 632 { 633 rc = g_aModules[j].pDesc->pfnInit(); 634 if (RT_FAILURE(rc)) 635 { 636 const PVBOXWATCHDOGMOD pMod = &g_aModules[j]; 637 if (pMod->fEnabled) 638 { 639 int rc2 = pMod->pDesc->pfnInit(); 640 if (RT_FAILURE(rc2)) 635 641 { 636 if (rc != VERR_SERVICE_DISABLED)642 if (rc2 != VERR_SERVICE_DISABLED) 637 643 { 638 serviceLog("Module '%s' failed to initialize: %Rrc\n", 639 g_aModules[j].pDesc->pszName, rc); 644 serviceLog("Module '%s' failed to initialize: %Rrc\n", pMod->pDesc->pszName, rc2); 640 645 return rc; 641 646 } 642 g_aModules[j].fEnabled = false; 643 serviceLog(0, "Module '%s' was disabled because of missing functionality\n", 644 g_aModules[j].pDesc->pszName); 647 pMod->fEnabled = false; 648 serviceLog("Module '%s' was disabled because of missing functionality\n", pMod->pDesc->pszName); 645 649 646 650 } 647 651 } 652 else 653 serviceLog("Module '%s' disabled, skipping ...\n", pMod->pDesc->pszName); 654 } 648 655 649 656 return rc; … … 847 854 switch (g_aOptions[i].iShort) 848 855 { 856 case GETOPTDEF_WATCHDOG_DISABLE_MODULE: 857 pcszDescr = "Disables a module. See module list for built-in modules."; 858 break; 859 849 860 case GETOPTDEF_WATCHDOG_DRYRUN: 850 861 pcszDescr = "Dryrun mode -- do not perform any actions."; … … 887 898 { 888 899 if (g_aModules[j].pDesc->pszOptions) 889 RT Printf("%s", g_aModules[j].pDesc->pszOptions);900 RTStrmPrintf(g_pStdErr, "%s", g_aModules[j].pDesc->pszOptions); 890 901 } 891 902 892 903 /** @todo Change VBOXBALLOONCTRL_RELEASE_LOG to WATCHDOG*. */ 893 904 RTStrmPrintf(g_pStdErr, "\nUse environment variable VBOXBALLOONCTRL_RELEASE_LOG for logging options.\n"); 905 906 RTStrmPrintf(g_pStdErr, "\nValid module names are: "); 907 for (unsigned j = 0; j < RT_ELEMENTS(g_aModules); j++) 908 { 909 if (j > 0) 910 RTStrmPrintf(g_pStdErr, ", "); 911 RTStrmPrintf(g_pStdErr, "%s", g_aModules[j].pDesc->pszName); 912 } 913 RTStrmPrintf(g_pStdErr, "\n\n"); 894 914 } 895 915 … … 1026 1046 bool fFound = false; 1027 1047 1028 /** @todo Add "--disable-<module>" etc. here! */ 1048 char szModDisable[64]; 1049 for (unsigned j = 0; !fFound && j < RT_ELEMENTS(g_aModules); j++) 1050 { 1051 if (!RTStrPrintf(szModDisable, sizeof(szModDisable), "--disable-%s", g_aModules[j].pDesc->pszName)) 1052 continue; 1053 1054 if (!RTStrICmp(szModDisable, ValueUnion.psz)) 1055 { 1056 g_aModules[j].fEnabled = false; 1057 fFound = true; 1058 } 1059 } 1029 1060 1030 1061 if (!fFound) … … 1036 1067 for (unsigned j = 0; !fFound && j < RT_ELEMENTS(g_aModules); j++) 1037 1068 { 1069 if (!g_aModules[j].fEnabled) 1070 continue; 1071 1038 1072 int iArgCnt = argc - GetState.iNext + 1; 1039 1073 int iArgIndex = GetState.iNext - 1;
Note:
See TracChangeset
for help on using the changeset viewer.