MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / main

Function main

mcp/pacemaker.c:793–1016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

791}
792
793int
794main(int argc, char **argv)
795{
796 int rc;
797 int flag;
798 int argerr = 0;
799
800 int option_index = 0;
801 gboolean shutdown = FALSE;
802
803 uid_t pcmk_uid = 0;
804 gid_t pcmk_gid = 0;
805 struct rlimit cores;
806 crm_ipc_t *old_instance = NULL;
807 qb_ipcs_service_t *ipcs = NULL;
808 const char *facility = daemon_option("logfacility");
809
810 set_daemon_option("mcp", "true");
811 set_daemon_option("use_logd", "off");
812
813 crm_log_init(NULL, LOG_INFO, TRUE, FALSE, argc, argv, FALSE);
814 crm_set_options(NULL, "mode [options]", long_options, "Start/Stop Pacemaker\n");
815
816 /* Restore the original facility so that read_config() does the right thing */
817 set_daemon_option("logfacility", facility);
818
819 while (1) {
820 flag = crm_get_option(argc, argv, &option_index);
821 if (flag == -1)
822 break;
823
824 switch (flag) {
825 case 'V':
826 crm_bump_log_level(argc, argv);
827 break;
828 case 'f':
829 /* Legacy */
830 break;
831 case 'p':
832 pid_file = optarg;
833 break;
834 case '$':
835 case '?':
836 crm_help(flag, EX_OK);
837 break;
838 case 'S':
839 shutdown = TRUE;
840 break;
841 case 'F':
842 printf("Pacemaker %s (Build: %s)\n Supporting: %s\n", VERSION, BUILD_VERSION,
843 CRM_FEATURES);
844 crm_exit(0);
845 default:
846 printf("Argument code 0%o (%c) is not (?yet?) supported\n", flag, flag);
847 ++argerr;
848 break;
849 }
850 }

Callers

nothing calls this directly

Calls 15

daemon_optionFunction · 0.85
set_daemon_optionFunction · 0.85
crm_log_initFunction · 0.85
crm_set_optionsFunction · 0.85
crm_get_optionFunction · 0.85
crm_bump_log_levelFunction · 0.85
crm_helpFunction · 0.85
crm_exitFunction · 0.85
crm_ipc_newFunction · 0.85
crm_ipc_connectFunction · 0.85
crm_ipc_connectedFunction · 0.85
crm_ipc_sendFunction · 0.85

Tested by

no test coverage detected