/* Try opening fi->domain_attr->cq_cnt number of completion queues * simultaneously using a size hint of 0 (indicating the provider should choose * the size) */ static int cq_open_close_simultaneous(void) { int ret; int opened; size_t count; int testret = FAIL; struct fid_cq **cq_array; count = fi->domain_attr->cq_cnt; FT_DEBUG("testing creation of up to %zu simultaneous CQs\n", count); cq_array = calloc(count, sizeof(*cq_array)); if (!cq_array) return -FI_ENOMEM; ret = 0; for (opened = 0; opened < count && !ret; opened++) { ret = create_cq(&cq_array[opened], 0, 0, FI_CQ_FORMAT_UNSPEC, FI_WAIT_UNSPEC); } if (ret) { FT_WARN("fi_cq_open failed after %d (cq_cnt: %zu): %s", opened, count, fi_strerror(-ret)); } testret = PASS; FT_CLOSEV_FID(cq_array, opened); free(cq_array); return TEST_RET_VAL(ret, testret); }
bool ft_log_syslog_backend_init(struct ft_context * context) { bool ok; if (ft_log_syslog_dgram.base.socket.clazz != NULL) { FT_WARN("ft_log_syslog_backend already initialized"); return false; } ok = ft_dgram_init(&ft_log_syslog_dgram, &ft_log_syslog_backend_dgram_delegate, context, AF_LOCAL, SOCK_DGRAM, 0); if (!ok) return false; ok = ft_log_syslog_connect(); if (!ok) return false; if (ft_config.log_syslog.hostname == NULL) { char hostname[1024]; gethostname(hostname, sizeof(hostname)); char * c = strchr(hostname, '.'); if (c != NULL) *c ='\0'; ft_config.log_syslog.hostname = strdup(hostname); } if (ft_config.log_syslog.domainname == NULL) { char hostname[1024]; gethostname(hostname, sizeof(hostname)); ft_config.log_syslog.domainname = strdup(hostname); } return true; }
static void ft_log_syslog_backend_flush(ev_tstamp now) { if (ft_log_syslog_frame != NULL) { if (ft_log_syslog_frame->vec_limit > 0) { ft_log_syslog_send(false); } if (ft_log_syslog_frame != NULL) { if (ft_log_syslog_frame->vec_limit > 0) FT_WARN("Lost a data in a syslog log frame"); struct ft_frame * frame = ft_log_syslog_frame; ft_log_syslog_frame = NULL; ft_frame_return(frame); } } if (ft_log_syslog_dgram.base.socket.clazz != NULL) { ft_dgram_flush(&ft_log_syslog_dgram); } }