您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CRM_CHECK函数代码示例

51自学网 2021-06-01 20:05:31
  C++
这篇教程C++ CRM_CHECK函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CRM_CHECK函数的典型用法代码示例。如果您正苦于以下问题:C++ CRM_CHECK函数的具体用法?C++ CRM_CHECK怎么用?C++ CRM_CHECK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CRM_CHECK函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: get_ais_nodeid

gbooleanget_ais_nodeid(uint32_t * id, char **uname){    struct iovec iov;    int retries = 0;    int rc = CS_OK;    cs_ipc_header_response_t header;    struct crm_ais_nodeid_resp_s answer;    header.error = CS_OK;    header.id = crm_class_nodeid;    header.size = sizeof(cs_ipc_header_response_t);    CRM_CHECK(id != NULL, return FALSE);    CRM_CHECK(uname != NULL, return FALSE);    iov.iov_base = &header;    iov.iov_len = header.size;  retry:    errno = 0;    rc = coroipcc_msg_send_reply_receive(ais_ipc_handle, &iov, 1, &answer, sizeof(answer));    if (rc == CS_OK) {        CRM_CHECK(answer.header.size == sizeof(struct crm_ais_nodeid_resp_s),                  crm_err("Odd message: id=%d, size=%d, error=%d",                          answer.header.id, answer.header.size, answer.header.error));        CRM_CHECK(answer.header.id == crm_class_nodeid,                  crm_err("Bad response id: %d", answer.header.id));    }    if ((rc == CS_ERR_TRY_AGAIN || rc == CS_ERR_QUEUE_FULL) && retries < 20) {        retries++;        crm_info("Peer overloaded: Re-sending message (Attempt %d of 20)", retries);        sleep(retries);         /* Proportional back off */        goto retry;    }    if (rc != CS_OK) {        crm_err("Sending nodeid request: FAILED (rc=%d): %s", rc, ais_error2text(rc));        return FALSE;    } else if (answer.header.error != CS_OK) {        crm_err("Bad response from peer: (rc=%d): %s", rc, ais_error2text(rc));        return FALSE;    }    crm_info("Server details: id=%u uname=%s cname=%s", answer.id, answer.uname, answer.cname);    *id = answer.id;    *uname = strdup(answer.uname);    ais_cluster_name = strdup(answer.cname);    return TRUE;}
开发者ID:buaaspy,项目名称:pacemaker,代码行数:54,


示例2: te_fence_node

static gbooleante_fence_node(crm_graph_t * graph, crm_action_t * action){    int rc = 0;    const char *id = NULL;    const char *uuid = NULL;    const char *target = NULL;    const char *type = NULL;    gboolean invalid_action = FALSE;    enum stonith_call_options options = st_opt_none;    id = ID(action->xml);    target = crm_element_value(action->xml, XML_LRM_ATTR_TARGET);    uuid = crm_element_value(action->xml, XML_LRM_ATTR_TARGET_UUID);    type = crm_meta_value(action->params, "stonith_action");    CRM_CHECK(id != NULL, invalid_action = TRUE);    CRM_CHECK(uuid != NULL, invalid_action = TRUE);    CRM_CHECK(type != NULL, invalid_action = TRUE);    CRM_CHECK(target != NULL, invalid_action = TRUE);    if (invalid_action) {        crm_log_xml_warn(action->xml, "BadAction");        return FALSE;    }    crm_notice("Requesting fencing (%s) of node %s "               CRM_XS " action=%s timeout=%d",               type, target, id, transition_graph->stonith_timeout);    /* Passing NULL means block until we can connect... */    te_connect_stonith(NULL);    if (crmd_join_phase_count(crm_join_confirmed) == 1) {        options |= st_opt_allow_suicide;    }    rc = stonith_api->cmds->fence(stonith_api, options, target, type,                                  transition_graph->stonith_timeout / 1000, 0);    stonith_api->cmds->register_callback(stonith_api, rc, transition_graph->stonith_timeout / 1000,                                         st_opt_timeout_updates,                                         generate_transition_key(transition_graph->id, action->id,                                                                 0, te_uuid),                                         "tengine_stonith_callback", tengine_stonith_callback);    return TRUE;}
开发者ID:yuusuke,项目名称:pacemaker,代码行数:48,


示例3: notify_crmd

voidnotify_crmd(crm_graph_t * graph){    const char *type = "unknown";    enum crmd_fsa_input event = I_NULL;    crm_debug("Processing transition completion in state %s", fsa_state2string(fsa_state));    CRM_CHECK(graph->complete, graph->complete = TRUE);    switch (graph->completion_action) {        case tg_stop:            type = "stop";            /* fall through */        case tg_done:            type = "done";            if (fsa_state == S_TRANSITION_ENGINE) {                event = I_TE_SUCCESS;            }            break;        case tg_restart:            type = "restart";            if (fsa_state == S_TRANSITION_ENGINE) {                if (transition_timer->period_ms > 0) {                    crm_timer_stop(transition_timer);                    crm_timer_start(transition_timer);                } else if (too_many_st_failures() == FALSE) {                    event = I_PE_CALC;                }            } else if (fsa_state == S_POLICY_ENGINE) {                register_fsa_action(A_PE_INVOKE);            }            break;        case tg_shutdown:            type = "shutdown";            if (is_set(fsa_input_register, R_SHUTDOWN)) {                event = I_STOP;            } else {                crm_err("We didn't ask to be shut down, yet our" " PE is telling us too.");                event = I_TERMINATE;            }    }    crm_debug("Transition %d status: %s - %s", graph->id, type, crm_str(graph->abort_reason));    graph->abort_reason = NULL;    graph->completion_action = tg_done;    clear_bit(fsa_input_register, R_IN_TRANSITION);    if (event != I_NULL) {        register_fsa_input(C_FSA_INTERNAL, event, NULL);    } else if (fsa_source) {        mainloop_set_trigger(fsa_source);    }}
开发者ID:JamesGuthrie,项目名称:pacemaker,代码行数:60,


示例4: update_dc

gbooleanupdate_dc(xmlNode * msg){    char *last_dc = fsa_our_dc;    const char *dc_version = NULL;    const char *welcome_from = NULL;    if (msg != NULL) {        gboolean invalid = FALSE;        dc_version = crm_element_value(msg, F_CRM_VERSION);        welcome_from = crm_element_value(msg, F_CRM_HOST_FROM);        CRM_CHECK(dc_version != NULL, return FALSE);        CRM_CHECK(welcome_from != NULL, return FALSE);        if (AM_I_DC && safe_str_neq(welcome_from, fsa_our_uname)) {            invalid = TRUE;        } else if (fsa_our_dc && safe_str_neq(welcome_from, fsa_our_dc)) {            invalid = TRUE;        }        if (invalid) {            CRM_CHECK(fsa_our_dc != NULL, crm_err("We have no DC"));            if (AM_I_DC) {                crm_err("Not updating DC to %s (%s): we are also a DC", welcome_from, dc_version);            } else {                crm_warn("New DC %s is not %s", welcome_from, fsa_our_dc);            }            register_fsa_action(A_CL_JOIN_QUERY | A_DC_TIMER_START);            return FALSE;        }    }
开发者ID:KevenChang,项目名称:pacemaker,代码行数:35,


示例5: get_xpath_object

static async_command_t *create_async_command(xmlNode *msg){    async_command_t *cmd = NULL;    xmlNode *op = get_xpath_object("//@"F_STONITH_ACTION, msg, LOG_ERR);    const char *action = crm_element_value(op, F_STONITH_ACTION);    CRM_CHECK(action != NULL, crm_log_xml_warn(msg, "NoAction"); return NULL);    crm_log_xml_trace(msg, "Command");    cmd = calloc(1, sizeof(async_command_t));    crm_element_value_int(msg, F_STONITH_CALLID,   &(cmd->id));    crm_element_value_int(msg, F_STONITH_CALLOPTS, &(cmd->options));    crm_element_value_int(msg, F_STONITH_TIMEOUT,  &(cmd->timeout));    cmd->origin = crm_element_value_copy(msg, F_ORIG);    cmd->remote = crm_element_value_copy(msg, F_STONITH_REMOTE);    cmd->client = crm_element_value_copy(msg, F_STONITH_CLIENTID);    cmd->client_name = crm_element_value_copy(msg, F_STONITH_CLIENTNAME);    cmd->op     = crm_element_value_copy(msg, F_STONITH_OPERATION);    cmd->action = strdup(action);    cmd->victim = crm_element_value_copy(op, F_STONITH_TARGET);    cmd->mode   = crm_element_value_copy(op, F_STONITH_MODE);    cmd->device = crm_element_value_copy(op, F_STONITH_DEVICE);    cmd->done   = st_child_done;    CRM_CHECK(cmd->op != NULL, crm_log_xml_warn(msg, "NoOp"); free_async_command(cmd); return NULL);    CRM_CHECK(cmd->client != NULL, crm_log_xml_warn(msg, "NoClient"));    cmd_list = g_list_append(cmd_list, cmd);    return cmd;}
开发者ID:Xarthisius,项目名称:pacemaker,代码行数:31,


示例6: cib_process_query

enum cib_errors cib_process_query(	const char *op, int options, const char *section, crm_data_t *input,	crm_data_t *existing_cib, crm_data_t **result_cib, crm_data_t **answer){	crm_data_t *obj_root = NULL;	enum cib_errors result = cib_ok;	crm_debug_2("Processing /"%s/" event for section=%s",		  op, crm_str(section));	CRM_CHECK(*answer == NULL, free_xml(*answer));	*answer = NULL;		if (safe_str_eq(XML_CIB_TAG_SECTION_ALL, section)) {		section = NULL;	}	obj_root = get_object_root(section, existing_cib);		if(obj_root == NULL) {		result = cib_NOTEXISTS;	} else {		*answer = obj_root;	}	if(result == cib_ok && *answer == NULL) {		crm_err("Error creating query response");		result = cib_output_data;	}		return result;}
开发者ID:sipwise,项目名称:heartbeat,代码行数:34,


示例7: te_fence_node

static gbooleante_fence_node(crm_graph_t * graph, crm_action_t * action){    int rc = 0;    const char *id = NULL;    const char *uuid = NULL;    const char *target = NULL;    const char *type = NULL;    gboolean invalid_action = FALSE;    enum stonith_call_options options = st_opt_none;    id = ID(action->xml);    target = crm_element_value(action->xml, XML_LRM_ATTR_TARGET);    uuid = crm_element_value(action->xml, XML_LRM_ATTR_TARGET_UUID);    type = crm_meta_value(action->params, "stonith_action");    CRM_CHECK(id != NULL, invalid_action = TRUE);    CRM_CHECK(uuid != NULL, invalid_action = TRUE);    CRM_CHECK(type != NULL, invalid_action = TRUE);    CRM_CHECK(target != NULL, invalid_action = TRUE);    if (invalid_action) {        crm_log_xml_warn(action->xml, "BadAction");        return FALSE;    }    te_log_action(LOG_INFO,                  "Executing %s fencing operation (%s) on %s (timeout=%d)",                  type, id, target, transition_graph->stonith_timeout);    /* Passing NULL means block until we can connect... */    te_connect_stonith(NULL);    if (finalized_nodes && g_hash_table_size(finalized_nodes) == 1) {        options |= st_opt_allow_suicide;    }    rc = stonith_api->cmds->fence(stonith_api, options, target, type,                                  transition_graph->stonith_timeout / 1000);    stonith_api->cmds->register_callback(stonith_api, rc, transition_graph->stonith_timeout / 1000,                                         FALSE, generate_transition_key(transition_graph->id,                                                                        action->id, 0, te_uuid),                                         "tengine_stonith_callback", tengine_stonith_callback);    return TRUE;}
开发者ID:fghaas,项目名称:pacemaker,代码行数:47,


示例8: notify_crmd

voidnotify_crmd(crm_graph_t *graph){		HA_Message *cmd = NULL;	int log_level = LOG_DEBUG;	const char *op = CRM_OP_TEABORT;	int pending_callbacks = num_cib_op_callbacks();		stop_te_timer(transition_timer);		if(pending_callbacks != 0) {		crm_warn("Delaying completion until all CIB updates complete");		return;	}	CRM_CHECK(graph->complete, graph->complete = TRUE);	switch(graph->completion_action) {		case tg_stop:			op = CRM_OP_TECOMPLETE;			log_level = LOG_INFO;			break;		case tg_abort:		case tg_restart:			op = CRM_OP_TEABORT;			break;		case tg_shutdown:			crm_info("Exiting after transition");			if (mainloop != NULL && g_main_is_running(mainloop)) {				g_main_quit(mainloop);				return;			}			exit(LSB_EXIT_OK);	}	te_log_action(log_level, "Transition %d status: %s - %s",		      graph->id, op, crm_str(graph->abort_reason));	print_graph(LOG_DEBUG_3, graph);		cmd = create_request(		op, NULL, NULL, CRM_SYSTEM_DC, CRM_SYSTEM_TENGINE, NULL);	if(graph->abort_reason != NULL) {		ha_msg_add(cmd, "message", graph->abort_reason);	}	send_ipc_message(crm_ch, cmd);	crm_msg_del(cmd);	graph->abort_reason = NULL;	graph->completion_action = tg_restart;	}
开发者ID:sipwise,项目名称:heartbeat,代码行数:57,


示例9: msgfromIPC_timeout

xmlNode *xmlfromIPC(IPC_Channel *ch, int timeout) {    xmlNode *xml = NULL;    HA_Message *msg = NULL;    #if HAVE_MSGFROMIPC_TIMEOUT    int ipc_rc = IPC_OK;    msg = msgfromIPC_timeout(ch, MSG_ALLOWINTR, timeout, &ipc_rc);        if(ipc_rc == IPC_TIMEOUT) {	crm_warn("No message received in the required interval (%ds)", timeout);	return NULL;	    } else if(ipc_rc == IPC_BROKEN) {	crm_debug("Peer disconnected");	return NULL;	    } else if(ipc_rc != IPC_OK) {	crm_err("msgfromIPC_timeout failed: rc=%d", ipc_rc);	return NULL;    } else if(msg == NULL) {	crm_err("Empty reply from msgfromIPC_timeout");	return NULL;    }#else    static gboolean do_show_error = TRUE;    if(timeout && do_show_error) {	crm_err("Timeouts are not supported by the current heartbeat libraries");	do_show_error = FALSE;    }    msg = msgfromIPC_noauth(ch);    if(msg == NULL) {	crm_debug("Empty reply from msgfromIPC_noauth");	return NULL;    }#endif    xml = convert_ha_message(NULL, msg, __FUNCTION__);    CRM_CHECK(xml != NULL, crm_err("Invalid ipc message"));    crm_msg_del(msg);    return xml;}
开发者ID:ClusterLabs,项目名称:pacemaker-1.0,代码行数:46,


示例10: get_cluster_pref

const char *get_cluster_pref(GHashTable * options, pe_cluster_option * option_list, int len, const char *name){    const char *value = NULL;    for (int lpc = 0; lpc < len; lpc++) {        if (safe_str_eq(name, option_list[lpc].name)) {            value = cluster_option(options,                                   option_list[lpc].is_valid,                                   option_list[lpc].name,                                   option_list[lpc].alt_name,                                   option_list[lpc].default_value);            return value;        }    }    CRM_CHECK(FALSE, crm_err("Bug: looking for unknown option '%s'", name));    return NULL;}
开发者ID:beekhof,项目名称:pacemaker,代码行数:18,


示例11: cib_process_query

intcib_process_query(const char *op, int options, const char *section, xmlNode * req, xmlNode * input,                  xmlNode * existing_cib, xmlNode ** result_cib, xmlNode ** answer){    xmlNode *obj_root = NULL;    int result = pcmk_ok;    crm_trace("Processing /"%s/" event for section=%s", op, crm_str(section));    if (options & cib_xpath) {        return cib_process_xpath(op, options, section, req, input,                                 existing_cib, result_cib, answer);    }    CRM_CHECK(*answer == NULL, free_xml(*answer));    *answer = NULL;    if (safe_str_eq(XML_CIB_TAG_SECTION_ALL, section)) {        section = NULL;    }    obj_root = get_object_root(section, existing_cib);    if (obj_root == NULL) {        result = -ENXIO;    } else if (options & cib_no_children) {        const char *tag = TYPE(obj_root);        xmlNode *shallow = create_xml_node(*answer, tag);        copy_in_properties(shallow, obj_root);        *answer = shallow;    } else {        *answer = obj_root;    }    if (result == pcmk_ok && *answer == NULL) {        crm_err("Error creating query response");        result = -ENOMSG;    }    return result;}
开发者ID:davidvossel,项目名称:pacemaker,代码行数:44,


示例12: copy_ha_msg_input

ha_msg_input_t *copy_ha_msg_input(ha_msg_input_t * orig){    ha_msg_input_t *copy = NULL;    xmlNodePtr data = NULL;    if (orig != NULL) {        crm_trace("Copy msg");        data = copy_xml(orig->msg);    } else {        crm_trace("No message to copy");    }    copy = new_ha_msg_input(data);    if (orig && orig->msg != NULL) {        CRM_CHECK(copy->msg != NULL, crm_err("copy failed"));    }    return copy;}
开发者ID:JamesGuthrie,项目名称:pacemaker,代码行数:19,


示例13: cib_prepare_diff

static intcib_prepare_diff(xmlNode * request, xmlNode ** data, const char **section){    xmlNode *input_fragment = NULL;    const char *update = crm_element_value(request, F_CIB_GLOBAL_UPDATE);    *data = NULL;    *section = NULL;    if (crm_is_true(update)) {        input_fragment = get_message_xml(request, F_CIB_UPDATE_DIFF);    } else {        input_fragment = get_message_xml(request, F_CIB_CALLDATA);    }    CRM_CHECK(input_fragment != NULL, crm_log_xml_warn(request, "no input"));    *data = cib_prepare_common(input_fragment, NULL);    return pcmk_ok;}
开发者ID:JamesGuthrie,项目名称:pacemaker,代码行数:20,


示例14: get_cluster_pref

const char *get_cluster_pref(GHashTable *options, pe_cluster_option *option_list, int len, const char *name){	int lpc = 0;	const char *value = NULL;	gboolean found = FALSE;	for(lpc = 0; lpc < len; lpc++) {		if(safe_str_eq(name, option_list[lpc].name)) {			found = TRUE;			value = cluster_option(options, 					       option_list[lpc].is_valid,					       option_list[lpc].name,					       option_list[lpc].alt_name,					       option_list[lpc].default_value);		}	}	CRM_CHECK(found, crm_err("No option named: %s", name));	CRM_ASSERT(value != NULL);	return value;}
开发者ID:ClusterLabs,项目名称:pacemaker-1.0,代码行数:20,


示例15: cib_ipc_accept

static int32_tcib_ipc_accept(qb_ipcs_connection_t *c, uid_t uid, gid_t gid){    cib_client_t *new_client = NULL;#if ENABLE_ACL    struct group *crm_grp = NULL;#endif    crm_trace("Connecting %p for uid=%d gid=%d pid=%d", c, uid, gid, crm_ipcs_client_pid(c));    if (cib_shutdown_flag) {        crm_info("Ignoring new client [%d] during shutdown", crm_ipcs_client_pid(c));        return -EPERM;    }    new_client = calloc(1, sizeof(cib_client_t));    new_client->ipc = c;    CRM_CHECK(new_client->id == NULL, free(new_client->id));    new_client->id = crm_generate_uuid();#if ENABLE_ACL    crm_grp = getgrnam(CRM_DAEMON_GROUP);    if (crm_grp) {        qb_ipcs_connection_auth_set(c, -1, crm_grp->gr_gid, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);    }    new_client->user = uid2username(uid);#endif    /* make sure we can find ourselves later for sync calls     * redirected to the master instance     */    g_hash_table_insert(client_list, new_client->id, new_client);    qb_ipcs_context_set(c, new_client);    return 0;}
开发者ID:kiranmurari,项目名称:pacemaker,代码行数:38,


示例16: master_color

node_t *master_color(resource_t * rsc, node_t * prefer, pe_working_set_t * data_set){    int promoted = 0;    GListPtr gIter = NULL;    GListPtr gIter2 = NULL;    GHashTableIter iter;    node_t *node = NULL;    node_t *chosen = NULL;    node_t *cons_node = NULL;    enum rsc_role_e next_role = RSC_ROLE_UNKNOWN;    clone_variant_data_t *clone_data = NULL;    get_clone_variant_data(clone_data, rsc);    if (is_not_set(rsc->flags, pe_rsc_provisional)) {        return NULL;    } else if (is_set(rsc->flags, pe_rsc_allocating)) {        crm_debug("Dependency loop detected involving %s", rsc->id);        return NULL;    }    apply_master_prefs(rsc);    clone_color(rsc, prefer, data_set);    set_bit(rsc->flags, pe_rsc_allocating);    /* count now tracks the number of masters allocated */    g_hash_table_iter_init(&iter, rsc->allowed_nodes);    while (g_hash_table_iter_next(&iter, NULL, (void **)&node)) {        node->count = 0;    }    /*     * assign priority     */    gIter = rsc->children;    for (; gIter != NULL; gIter = gIter->next) {        GListPtr list = NULL;        resource_t *child_rsc = (resource_t *) gIter->data;        crm_trace("Assigning priority for %s: %s", child_rsc->id,                    role2text(child_rsc->next_role));        if (child_rsc->fns->state(child_rsc, TRUE) == RSC_ROLE_STARTED) {            set_role_slave(child_rsc, TRUE);        }        chosen = child_rsc->fns->location(child_rsc, &list, FALSE);        if (g_list_length(list) > 1) {            crm_config_err("Cannot promote non-colocated child %s", child_rsc->id);        }        g_list_free(list);        if (chosen == NULL) {            continue;        }        next_role = child_rsc->fns->state(child_rsc, FALSE);        switch (next_role) {            case RSC_ROLE_STARTED:            case RSC_ROLE_UNKNOWN:                CRM_CHECK(chosen != NULL, break);                /*                 * Default to -1 if no value is set                 *                 * This allows master locations to be specified                 * based solely on rsc_location constraints,                 * but prevents anyone from being promoted if                 * neither a constraint nor a master-score is present                 */                child_rsc->priority = master_score(child_rsc, chosen, -1);                break;            case RSC_ROLE_SLAVE:            case RSC_ROLE_STOPPED:                child_rsc->priority = -INFINITY;                break;            case RSC_ROLE_MASTER:                /* We will arrive here if we're re-creating actions after a stonith                 */                break;            default:                CRM_CHECK(FALSE /* unhandled */ ,                          crm_err("Unknown resource role: %d for %s", next_role, child_rsc->id));        }        apply_master_location(child_rsc->rsc_location);        apply_master_location(rsc->rsc_location);        gIter2 = child_rsc->rsc_cons;        for (; gIter2 != NULL; gIter2 = gIter2->next) {            rsc_colocation_t *cons = (rsc_colocation_t *) gIter2->data;            child_rsc->cmds->rsc_colocation_lh(child_rsc, cons->rsc_rh, cons);        }//.........这里部分代码省略.........
开发者ID:smellman,项目名称:pacemaker,代码行数:101,


示例17: main

intmain(int argc, char **argv){    int flag;    int rc = 0;    int index = 0;    int argerr = 0;    struct passwd *pwentry = NULL;    crm_log_preinit(NULL, argc, argv);    crm_set_options(NULL, "[options]",                    long_options, "Daemon for storing and replicating the cluster configuration");    crm_peer_init();    mainloop_add_signal(SIGTERM, cib_shutdown);    mainloop_add_signal(SIGPIPE, cib_enable_writes);    cib_writer = mainloop_add_trigger(G_PRIORITY_LOW, write_cib_contents, NULL);    while (1) {        flag = crm_get_option(argc, argv, &index);        if (flag == -1)            break;        switch (flag) {            case 'V':                crm_bump_log_level(argc, argv);                break;            case 's':                stand_alone = TRUE;                preserve_status = TRUE;                cib_writes_enabled = FALSE;                pwentry = getpwnam(CRM_DAEMON_USER);                CRM_CHECK(pwentry != NULL,                          crm_perror(LOG_ERR, "Invalid uid (%s) specified", CRM_DAEMON_USER);                          return CRM_EX_FATAL);                rc = setgid(pwentry->pw_gid);                if (rc < 0) {                    crm_perror(LOG_ERR, "Could not set group to %d", pwentry->pw_gid);                    return CRM_EX_FATAL;                }                rc = initgroups(CRM_DAEMON_USER, pwentry->pw_gid);                if (rc < 0) {                    crm_perror(LOG_ERR, "Could not setup groups for user %d", pwentry->pw_uid);                    return CRM_EX_FATAL;                }                rc = setuid(pwentry->pw_uid);                if (rc < 0) {                    crm_perror(LOG_ERR, "Could not set user to %d", pwentry->pw_uid);                    return CRM_EX_FATAL;                }                break;            case '?':          /* Help message */                crm_help(flag, CRM_EX_OK);                break;            case 'w':                cib_writes_enabled = TRUE;                break;            case 'r':                cib_root = optarg;                break;            case 'm':                cib_metadata();                return CRM_EX_OK;            default:                ++argerr;                break;        }    }    if (argc - optind == 1 && safe_str_eq("metadata", argv[optind])) {        cib_metadata();        return CRM_EX_OK;    }    if (optind > argc) {        ++argerr;    }    if (argerr) {        crm_help('?', CRM_EX_USAGE);    }    crm_log_init(NULL, LOG_INFO, TRUE, FALSE, argc, argv, FALSE);    if (cib_root == NULL) {        cib_root = CRM_CONFIG_DIR;    } else {        crm_notice("Using custom config location: %s", cib_root);    }    if (pcmk__daemon_can_write(cib_root, NULL) == FALSE) {        crm_err("Terminating due to bad permissions on %s", cib_root);        fprintf(stderr, "ERROR: Bad permissions on %s (see logs for details)/n",                cib_root);        fflush(stderr);//.........这里部分代码省略.........
开发者ID:HideoYamauchi,项目名称:pacemaker,代码行数:101,


示例18: do_election_count_vote

voiddo_election_count_vote(long long action,		       enum crmd_fsa_cause cause,		       enum crmd_fsa_state cur_state,		       enum crmd_fsa_input current_input,		       fsa_data_t *msg_data){	int election_id = -1;	int log_level = LOG_INFO;	gboolean done = FALSE;	gboolean we_loose = FALSE;	const char *op             = NULL;		const char *vote_from      = NULL;	const char *your_version   = NULL;	const char *election_owner = NULL;	const char *reason	   = "unknown";	crm_node_t *our_node = NULL, *your_node = NULL;	ha_msg_input_t *vote = fsa_typed_data(fsa_dt_ha_msg);	static time_t last_election_win = 0;	static time_t last_election_loss = 0;		/* if the membership copy is NULL we REALLY shouldnt be voting	 * the question is how we managed to get here.	 */		CRM_CHECK(msg_data != NULL, return);	CRM_CHECK(crm_peer_cache != NULL, return);	CRM_CHECK(vote != NULL, crm_err("Bogus data from %s", msg_data->origin); return);	CRM_CHECK(vote->msg != NULL, crm_err("Bogus data from %s", msg_data->origin); return);		/* 受信メッセ
C++ CRM_LOG_ASSERT函数代码示例
C++ CRM_ASSERT函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。