这篇教程C++ zbx_strlcpy函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中zbx_strlcpy函数的典型用法代码示例。如果您正苦于以下问题:C++ zbx_strlcpy函数的具体用法?C++ zbx_strlcpy怎么用?C++ zbx_strlcpy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了zbx_strlcpy函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: add_user_parameterint add_user_parameter(const char *itemkey, char *command, char *error, size_t max_error_len){ int i; char key[MAX_STRING_LEN], parameters[MAX_STRING_LEN]; unsigned flag = CF_USERPARAMETER; ZBX_METRIC metric; if (ZBX_COMMAND_ERROR == (i = parse_command(itemkey, key, sizeof(key), parameters, sizeof(parameters)))) { zbx_strlcpy(error, "syntax error", max_error_len); return FAIL; } else if (ZBX_COMMAND_WITH_PARAMS == i) { if (0 != strcmp(parameters, "*")) /* must be '*' parameters */ { zbx_strlcpy(error, "syntax error", max_error_len); return FAIL; } flag |= CF_HAVEPARAMS; } metric.key = key; metric.flags = flag; metric.function = &EXECUTE_USER_PARAMETER; metric.test_param = command; return add_metric(&metric, error, max_error_len);}
开发者ID:unix1986,项目名称:zabbix,代码行数:29,
示例2: setproctitle_set_status/****************************************************************************** * * * Function: setproctitle_set_status * * * * Purpose: set a process command line displayed by "ps" command. * * * * Comments: call this function when a process starts some interesting task. * * Program name argv[0] will be displayed "as-is" followed by ": " * * and a status message. * * * ******************************************************************************/void setproctitle_set_status(const char *status){#if defined(PS_OVERWRITE_ARGV) static int initialized = 0; if (1 == initialized) { size_t msg_size; msg_size = zbx_strlcpy(ps_buf, status, ps_buf_size); if (prev_msg_size > msg_size) memset(ps_buf + msg_size + 1, '/0', ps_buf_size - msg_size - 1); prev_msg_size = msg_size; } else if (NULL != ps_buf) { size_t start_pos; /* Initialization has not been moved to setproctitle_save_env() because setproctitle_save_env() */ /* is called from the main process and we do not change its command line. */ /* argv[] changing takes place only in child processes. */#if defined(PS_CONCAT_ARGV) start_pos = strlen(argv_int[0]);#else start_pos = strlen(ps_buf);#endif if (start_pos + 2 < ps_buf_size) /* is there space for ": " ? */ { zbx_strlcpy(ps_buf + start_pos, ": ", (size_t)3); ps_buf += start_pos + 2; ps_buf_size -= start_pos + 2; /* space after "argv[copy_first]: " for status message */ memset(ps_buf, '/0', ps_buf_size); prev_msg_size = zbx_strlcpy(ps_buf, status, ps_buf_size); initialized = 1; } }#elif defined(PS_PSTAT_ARGV) if (NULL != p_msg) { union pstun pst; zbx_strlcpy(p_msg, status, ps_buf_size_msg); pst.pst_command = ps_buf; pstat(PSTAT_SETCMD, pst, strlen(ps_buf), 0, 0); }#endif}
开发者ID:HupuInc,项目名称:zabbix,代码行数:63,
示例3: alias_expandvoid alias_expand(const char *orig, char *expanded, int exp_buf_len){ ALIAS *alias; for(alias = aliasList; alias!=NULL; alias = alias->next) { if (!strcmp(alias->name,orig)) { zbx_strlcpy(expanded, alias->value, exp_buf_len); return; } } zbx_strlcpy(expanded, orig, exp_buf_len);}
开发者ID:Shmuma,项目名称:z,代码行数:14,
示例4: set_ipmi_control_valueint set_ipmi_control_value(DC_ITEM *item, int value, char *error, size_t max_error_len){ zbx_ipmi_host_t *h; zbx_ipmi_control_t *c; zabbix_log(LOG_LEVEL_DEBUG, "In set_ipmi_control_value(control:%s, value:%d)", item->ipmi_sensor, value); if (NULL == os_hnd) { zbx_strlcpy(error, "IPMI handler is not initialised", max_error_len); zabbix_log(LOG_LEVEL_DEBUG, "%s", error); return NOTSUPPORTED; } h = init_ipmi_host(item->interface.addr, item->interface.port, item->host.ipmi_authtype, item->host.ipmi_privilege, item->host.ipmi_username, item->host.ipmi_password); if (0 == h->domain_up) { if (NULL != h->err) { zbx_strlcpy(error, h->err, max_error_len); zabbix_log(LOG_LEVEL_DEBUG, "%s", h->err); } return h->ret; } c = get_ipmi_control_by_name(h, item->ipmi_sensor); if (NULL == c) { zbx_snprintf(error, max_error_len, "control %[email C++ zbx_tcp_strerror函数代码示例 C++ zbx_strerror函数代码示例
|