if (was_error == 0) { CRM_DEBUG("Registering with HA"); was_error = (register_with_ha(hb_cluster, crm_system_name, crmd_ha_input_dispatch, crmd_ha_input_callback, crmd_ha_input_destroy) == FALSE); } if (was_error == 0) { CRM_DEBUG("Registering with CCM"); was_error = register_with_ccm();
if (unlink(PID_FILE) == 0) { cl_log(LOG_INFO, "[%s] stopped", crm_system_name);
init_start(void){    long pid;    if ((pid = get_running_pid(PID_FILE, NULL)) > 0) {		cl_log(LOG_CRIT, "already running: [pid %ld].", pid);		exit(LSB_EXIT_OK);    }    cl_log(LOG_INFO, "Register PID");    register_pid(PID_FILE, FALSE, shutdown);	    cl_log_set_logfile(DAEMON_LOG);//    if (crm_debug()) {    cl_log_set_debugfile(DAEMON_DEBUG);//    }	    xmlInitParser();    pending_remote_replies = g_hash_table_new(&g_str_hash, &g_str_equal);    ipc_clients = g_hash_table_new(&g_str_hash, &g_str_equal);	    /* change the logging facility to the one used by heartbeat daemon */    hb_cluster = ll_cluster_new("heartbeat");	    int facility;    cl_log(LOG_INFO, "Switching to Heartbeat logger");    if ((facility = hb_cluster->llc_ops->get_logfacility(hb_cluster))>0) {		cl_log_set_facility(facility);    }        int was_error = 0;    CRM_DEBUG("Init server comms");    was_error = init_server_ipc_comms(CRM_SYSTEM_CRMD,				      crmd_client_connect,				      default_ipc_input_destroy);        if (was_error == 0) {		CRM_DEBUG("Registering with HA");		was_error = (register_with_ha(hb_cluster,					      crm_system_name,					      crmd_ha_input_dispatch,					      crmd_ha_input_callback,					      crmd_ha_input_destroy) == FALSE);    }    if (was_error == 0) {		CRM_DEBUG("Registering with CCM");		was_error = register_with_ccm();    }        if (was_error == 0) {		CRM_DEBUG("Finding our node name");		our_uname = hb_cluster->llc_ops->get_mynodeid(hb_cluster);		if (our_uname == NULL)		{			cl_log(LOG_ERR, "get_mynodeid() failed");			was_error = 1;		}		cl_log(LOG_INFO, "Hostname: %s", our_uname);    }    if (was_error == 0) {		/* Create the mainloop and run it... */		mainloop = g_main_new(FALSE);		cl_log(LOG_INFO, "Starting %s", crm_system_name);	#ifdef REALTIME_SUPPORT		static int  crm_realtime = 1;		if (crm_realtime == 1){			cl_enable_realtime();		}else if (crm_realtime == 0){			cl_disable_realtime();		}		cl_make_realtime(SCHED_RR, 5, 64, 64);#endif			g_main_run(mainloop);		return_to_orig_privs();    }        if (unlink(PID_FILE) == 0) {		cl_log(LOG_INFO, "[%s] stopped", crm_system_name);    }    FNRET(was_error);}