本文整理匯總了C++中GNIX_WARN函數的典型用法代碼示例。如果您正苦於以下問題:C++ GNIX_WARN函數的具體用法?C++ GNIX_WARN怎麽用?C++ GNIX_WARN使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GNIX_WARN函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: gnix_write_proc_job
static int gnix_write_proc_job(char *val_str)
{
size_t count;
int fd;
int rc = 0;
char *filename = "/proc/job";
int val_str_len = strlen(val_str);
fd = open(filename, O_WRONLY);
if (fd < 0) {
GNIX_WARN(FI_LOG_FABRIC, "open(%s) failed, errno=%s\n",
filename, strerror(errno));
return -errno;
}
count = write(fd, val_str, val_str_len);
if (count != val_str_len) {
GNIX_WARN(FI_LOG_FABRIC, "write(%s) failed, errno=%s\n",
val_str, strerror(errno));
rc = -errno;
}
close(fd);
return rc;
}
示例2: _gnix_task_is_not_app
/* Indicate that the next task spawned will be restricted to cores assigned to
* corespec. */
int _gnix_task_is_not_app(void)
{
size_t count;
int fd;
char filename[PATH_MAX];
int rc = 0;
char val_str[] = "0";
int val_str_len = strlen(val_str);
snprintf(filename, PATH_MAX, "/proc/self/task/%ld/task_is_app",
syscall(SYS_gettid));
fd = open(filename, O_WRONLY);
if (fd < 0) {
GNIX_WARN(FI_LOG_FABRIC, "open(%s) failed, errno=%s\n",
filename, strerror(errno));
return -errno;
}
count = write(fd, val_str, val_str_len);
if (count != val_str_len) {
GNIX_WARN(FI_LOG_FABRIC, "write(%s, %s) failed, errno=%s\n",
filename, val_str, strerror(errno));
rc = -errno;
}
close(fd);
return rc;
}
示例3: _gnix_notifier_get_event
int
_gnix_notifier_get_event(struct gnix_mr_notifier *mrn, void* buf, size_t len)
{
int ret, ret_errno;
if ((mrn == NULL) || (buf == NULL) || (len <= 0)) {
GNIX_WARN(FI_LOG_MR,
"Invalid argument to _gnix_notifier_get_event\n");
return -FI_EINVAL;
}
fastlock_acquire(&mrn->lock);
if (*(mrn->cntr) > 0) {
GNIX_DEBUG(FI_LOG_MR, "reading kdreg event\n");
ret = read(mrn->fd, buf, len);
if (ret < 0) {
ret_errno = errno;
if (ret_errno != EAGAIN) {
GNIX_WARN(FI_LOG_MR,
"kdreg event read failed: %s\n",
strerror(ret_errno));
}
/* Not all of these map to fi_errno values */
ret = -ret_errno;
}
} else {
GNIX_DEBUG(FI_LOG_MR, "nothing to read from kdreg :(\n");
ret = -FI_EAGAIN;
}
fastlock_release(&mrn->lock);
return ret;
}
示例4: _gnix_mbox_alloc
int _gnix_mbox_alloc(struct gnix_mbox_alloc_handle *alloc_handle,
struct gnix_mbox **ptr)
{
struct gnix_slab *slab;
int position;
int ret;
GNIX_TRACE(FI_LOG_EP_CTRL, "\n");
if (!alloc_handle || !ptr) {
GNIX_WARN(FI_LOG_EP_CTRL, "Invalid alloc_handle or ptr.\n");
ret = -FI_EINVAL;
goto err;
}
fastlock_acquire(&alloc_handle->lock);
position = __find_free(alloc_handle, &slab);
if (position < 0) {
GNIX_DEBUG(FI_LOG_EP_CTRL, "Creating new slab.\n");
ret = __create_slab(alloc_handle);
if (ret) {
GNIX_WARN(FI_LOG_EP_CTRL, "Slab creation failed.\n");
goto err;
}
slab = container_of(alloc_handle->slab_list.tail,
struct gnix_slab, list_entry);
position = ret;
}
示例5: _gnix_pep_progress
/* Process incoming connection requests on a listening PEP. */
int _gnix_pep_progress(struct gnix_fid_pep *pep)
{
int accept_fd, ret;
fastlock_acquire(&pep->lock);
accept_fd = accept(pep->listen_fd, NULL, NULL);
if (accept_fd >= 0) {
/* New Connection. */
ret = __gnix_pep_connreq(pep, accept_fd);
if (ret != FI_SUCCESS) {
GNIX_WARN(FI_LOG_EP_CTRL,
"__gnix_pep_connreq failed, err: %d\n",
ret);
}
} else if (errno != EAGAIN) {
GNIX_WARN(FI_LOG_EP_CTRL,
"(accept) Unexpected errno on listen socket: %d\n",
errno);
}
fastlock_release(&pep->lock);
return FI_SUCCESS;
}
示例6: __basic_mr_reg_mr
static int __basic_mr_reg_mr(
struct gnix_fid_domain *domain,
uint64_t address,
uint64_t length,
struct _gnix_fi_reg_context *fi_reg_context,
void **handle) {
struct gnix_fid_mem_desc *md, *ret;
md = calloc(1, sizeof(*md));
if (!md) {
GNIX_WARN(FI_LOG_MR, "failed to allocate memory");
return -FI_ENOMEM;
}
ret = __gnix_register_region((void *) md, (void *) address, length,
fi_reg_context, (void *) domain);
if (!ret) {
GNIX_WARN(FI_LOG_MR, "failed to register memory");
free(md);
return -FI_ENOSPC;
}
*handle = (void *) md;
return FI_SUCCESS;
}
示例7: __gnix_amo_send_err
static int __gnix_amo_send_err(struct gnix_fid_ep *ep,
struct gnix_fab_req *req)
{
struct gnix_fid_cntr *cntr = NULL;
int rc = FI_SUCCESS;
uint64_t flags = req->flags & GNIX_AMO_COMPLETION_FLAGS;
if (ep->send_cq) {
rc = _gnix_cq_add_error(ep->send_cq, req->user_context,
flags, 0, 0, 0, 0, 0, FI_ECANCELED,
GNI_RC_TRANSACTION_ERROR, NULL);
if (rc) {
GNIX_WARN(FI_LOG_EP_DATA,
"_gnix_cq_add_error() failed: %d\n", rc);
}
}
if ((req->type == GNIX_FAB_RQ_AMO) &&
ep->write_cntr) {
cntr = ep->write_cntr;
} else if ((req->type == GNIX_FAB_RQ_FAMO ||
req->type == GNIX_FAB_RQ_CAMO) &&
ep->read_cntr) {
cntr = ep->read_cntr;
}
if (cntr) {
rc = _gnix_cntr_inc_err(cntr);
if (rc)
GNIX_WARN(FI_LOG_EP_DATA,
"_gnix_cntr_inc_err() failed: %d\n", rc);
}
return rc;
}
示例8: _gnix_buddy_allocator_destroy
int _gnix_buddy_allocator_destroy(gnix_buddy_alloc_handle_t *alloc_handle)
{
GNIX_TRACE(FI_LOG_EP_CTRL, "\n");
if (unlikely(!alloc_handle)) {
GNIX_WARN(FI_LOG_EP_CTRL,
"Invalid parameter to _gnix_buddy_allocator_destroy."
"\n");
return -FI_EINVAL;
}
fastlock_acquire(&alloc_handle->lock);
free(alloc_handle->lists);
while (_gnix_free_bitmap(&alloc_handle->bitmap)) {
GNIX_WARN(FI_LOG_EP_CTRL,
"Trying to free buddy allocator handle bitmap.\n");
sleep(1);
}
fastlock_release(&alloc_handle->lock);
fastlock_destroy(&alloc_handle->lock);
free(alloc_handle);
return FI_SUCCESS;
}
示例9: _gnix_cm_nic_free
int _gnix_cm_nic_free(struct gnix_cm_nic *cm_nic)
{
int ret = FI_SUCCESS;
gni_return_t status;
GNIX_TRACE(FI_LOG_EP_CTRL, "\n");
if (cm_nic == NULL)
return -FI_EINVAL;
if (cm_nic->dgram_hndl != NULL) {
ret = _gnix_dgram_hndl_free(cm_nic->dgram_hndl);
if (ret != FI_SUCCESS)
GNIX_WARN(FI_LOG_EP_CTRL,
"gnix_dgram_hndl_free returned %d\n",
ret);
}
if (cm_nic->gni_cdm_hndl != NULL) {
status = GNI_CdmDestroy(cm_nic->gni_cdm_hndl);
if (status != GNI_RC_SUCCESS) {
GNIX_WARN(FI_LOG_EP_CTRL,
"cdm destroy failed - %s\n",
gni_err_str[status]);
ret = gnixu_to_fi_errno(status);
}
}
free(cm_nic);
return ret;
}
示例10: __gnix_msg_send_err
static int __gnix_msg_send_err(struct gnix_fid_ep *ep, struct gnix_fab_req *req)
{
uint64_t flags = FI_SEND | FI_MSG;
int rc;
flags |= req->msg.send_flags & FI_TAGGED;
if (ep->send_cq) {
rc = _gnix_cq_add_error(ep->send_cq, req->user_context,
flags, 0, 0, 0, 0, 0, FI_ECANCELED,
GNI_RC_TRANSACTION_ERROR, NULL);
if (rc != FI_SUCCESS) {
GNIX_WARN(FI_LOG_EP_DATA,
"_gnix_cq_add_error() returned %d\n",
rc);
}
}
if (ep->send_cntr) {
rc = _gnix_cntr_inc_err(ep->send_cntr);
if (rc != FI_SUCCESS)
GNIX_WARN(FI_LOG_EP_DATA,
"_gnix_cntr_inc() failed: %d\n",
rc);
}
return FI_SUCCESS;
}
示例11: __gnix_msg_send_completion
static int __gnix_msg_send_completion(struct gnix_fid_ep *ep,
struct gnix_fab_req *req)
{
uint64_t flags = FI_SEND | FI_MSG;
int rc;
flags |= req->msg.send_flags & FI_TAGGED;
if ((req->msg.send_flags & FI_COMPLETION) && ep->send_cq) {
rc = _gnix_cq_add_event(ep->send_cq,
req->user_context,
flags, 0, 0, 0, 0, FI_ADDR_NOTAVAIL);
if (rc != FI_SUCCESS) {
GNIX_WARN(FI_LOG_EP_DATA,
"_gnix_cq_add_event returned %d\n",
rc);
}
}
if (ep->send_cntr) {
rc = _gnix_cntr_inc(ep->send_cntr);
if (rc != FI_SUCCESS)
GNIX_WARN(FI_LOG_EP_DATA,
"_gnix_cntr_inc() failed: %d\n",
rc);
}
return FI_SUCCESS;
}
示例12: __recv_err
static int __recv_err(struct gnix_fid_ep *ep, void *context, uint64_t flags,
size_t len, void *addr, uint64_t data, uint64_t tag,
size_t olen, int err, int prov_errno, void *err_data)
{
int rc;
if (ep->recv_cq) {
rc = _gnix_cq_add_error(ep->recv_cq, context, flags, len,
addr, data, tag, olen, err,
prov_errno, err_data);
if (rc != FI_SUCCESS) {
GNIX_WARN(FI_LOG_EP_DATA,
"_gnix_cq_add_error returned %d\n",
rc);
}
}
if (ep->recv_cntr) {
rc = _gnix_cntr_inc_err(ep->recv_cntr);
if (rc != FI_SUCCESS)
GNIX_WARN(FI_LOG_EP_DATA,
"_gnix_cntr_inc_err() failed: %d\n",
rc);
}
return FI_SUCCESS;
}
示例13: __recv_completion
static int __recv_completion(
struct gnix_fid_ep *ep,
struct gnix_fab_req *req,
void *context,
uint64_t flags,
size_t len,
void *addr,
uint64_t data,
uint64_t tag,
fi_addr_t src_addr)
{
int rc;
if ((req->msg.recv_flags & FI_COMPLETION) && ep->recv_cq) {
rc = _gnix_cq_add_event(ep->recv_cq, context, flags, len,
addr, data, tag, src_addr);
if (rc != FI_SUCCESS) {
GNIX_WARN(FI_LOG_EP_DATA,
"_gnix_cq_add_event returned %d\n",
rc);
}
}
if (ep->recv_cntr) {
rc = _gnix_cntr_inc(ep->recv_cntr);
if (rc != FI_SUCCESS)
GNIX_WARN(FI_LOG_EP_DATA,
"_gnix_cntr_inc() failed: %d\n",
rc);
}
return FI_SUCCESS;
}
示例14: __gnix_amo_send_completion
static int __gnix_amo_send_completion(struct gnix_fid_ep *ep,
struct gnix_fab_req *req)
{
struct gnix_fid_cntr *cntr = NULL;
int rc = FI_SUCCESS;
uint64_t flags = req->flags & GNIX_AMO_COMPLETION_FLAGS;
if ((req->flags & FI_COMPLETION) && ep->send_cq) {
rc = _gnix_cq_add_event(ep->send_cq, req->user_context,
flags, 0, 0, 0, 0, FI_ADDR_NOTAVAIL);
if (rc) {
GNIX_WARN(FI_LOG_EP_DATA,
"_gnix_cq_add_event() failed: %d\n", rc);
}
}
if ((req->type == GNIX_FAB_RQ_AMO) &&
ep->write_cntr) {
cntr = ep->write_cntr;
} else if ((req->type == GNIX_FAB_RQ_FAMO ||
req->type == GNIX_FAB_RQ_CAMO) &&
ep->read_cntr) {
cntr = ep->read_cntr;
}
if (cntr) {
rc = _gnix_cntr_inc(cntr);
if (rc)
GNIX_WARN(FI_LOG_EP_DATA,
"_gnix_cntr_inc() failed: %d\n", rc);
}
return FI_SUCCESS;
}
示例15: __gnix_fab_ops_get_val
static int
__gnix_fab_ops_get_val(struct fid *fid, fab_ops_val_t t, void *val)
{
GNIX_TRACE(FI_LOG_FABRIC, "\n");
assert(val);
if (fid->fclass != FI_CLASS_FABRIC) {
GNIX_WARN(FI_LOG_FABRIC, "Invalid fabric\n");
return -FI_EINVAL;
}
switch (t) {
case GNI_WAIT_THREAD_SLEEP:
*(uint32_t *)val = gnix_wait_thread_sleep_time;
break;
case GNI_DEFAULT_USER_REGISTRATION_LIMIT:
*(uint32_t *)val = gnix_default_user_registration_limit;
break;
case GNI_DEFAULT_PROV_REGISTRATION_LIMIT:
*(uint32_t *)val = gnix_default_prov_registration_limit;
break;
default:
GNIX_WARN(FI_LOG_FABRIC, ("Invalid fab_ops_val\n"));
}
return FI_SUCCESS;
}