From: Arlin Davis Date: Mon, 17 Jul 2006 22:59:17 +0000 (+0000) Subject: r8565: Added errno reporting (message and return codes) during open to help diagnose... X-Git-Tag: libdapl-1.2.1~26 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=25fb8c376547de895a170194c09b2d72dfea789d;p=~ardavis%2Fdapl.git r8565: Added errno reporting (message and return codes) during open to help diagnose create thread issues. --- diff --git a/dapl/openib_cma/dapl_ib_util.c b/dapl/openib_cma/dapl_ib_util.c index 8d1818e..22d67a8 100644 --- a/dapl/openib_cma/dapl_ib_util.c +++ b/dapl/openib_cma/dapl_ib_util.c @@ -212,6 +212,7 @@ DAT_RETURN dapls_ib_open_hca(IN IB_HCA_NAME hca_name, IN DAPL_HCA *hca_ptr) struct rdma_cm_id *cm_id; union ibv_gid *gid; int ret; + DAT_RETURN dat_status; dapl_dbg_log(DAPL_DBG_TYPE_UTIL, " open_hca: %s - %p\n", hca_name, hca_ptr); @@ -225,8 +226,9 @@ DAT_RETURN dapls_ib_open_hca(IN IB_HCA_NAME hca_name, IN DAPL_HCA *hca_ptr) } dapl_os_unlock(&g_hca_lock); - if (dapli_ib_thread_init()) - return DAT_INTERNAL_ERROR; + dat_status = dapli_ib_thread_init(); + if (dat_status != DAT_SUCCESS) + return dat_status; /* HCA name will be hostname or IP address */ if (getipaddr((char*)hca_name, @@ -557,10 +559,10 @@ DAT_RETURN dapls_ib_setup_async_callback(IN DAPL_IA *ia_ptr, return DAT_SUCCESS; } -int dapli_ib_thread_init(void) +DAT_RETURN dapli_ib_thread_init(void) { long opts; - DAT_RETURN ret; + DAT_RETURN dat_status; dapl_dbg_log(DAPL_DBG_TYPE_UTIL, " ib_thread_init(%d)\n", getpid()); @@ -568,31 +570,27 @@ int dapli_ib_thread_init(void) dapl_os_lock(&g_hca_lock); if (g_ib_thread_state != IB_THREAD_INIT) { dapl_os_unlock(&g_hca_lock); - return 0; + return DAT_SUCCESS; } /* uCMA events non-blocking */ opts = fcntl(g_cm_events->fd, F_GETFL); /* uCMA */ if (opts < 0 || fcntl(g_cm_events->fd, F_SETFL, opts | O_NONBLOCK) < 0) { - dapl_dbg_log (DAPL_DBG_TYPE_ERR, - " dapl_ib_init: ERR with uCMA FD\n" ); dapl_os_unlock(&g_hca_lock); - return 1; + return(dapl_convert_errno(errno, "create_thread ERR: cm_fd")); } g_ib_thread_state = IB_THREAD_CREATE; dapl_os_unlock(&g_hca_lock); /* create thread to process inbound connect request */ - ret = dapl_os_thread_create(dapli_thread, NULL, &g_ib_thread); - if (ret != DAT_SUCCESS) - { - dapl_dbg_log(DAPL_DBG_TYPE_ERR, - " ib_thread_init: failed to create thread\n"); - return 1; - } - + dat_status = dapl_os_thread_create(dapli_thread, NULL, &g_ib_thread); + if (dat_status != DAT_SUCCESS) + return(dapl_convert_errno(errno, + "create_thread ERR:" + " check resource limits")); + /* wait for thread to start */ dapl_os_lock(&g_hca_lock); while (g_ib_thread_state != IB_THREAD_RUN) { @@ -609,7 +607,8 @@ int dapli_ib_thread_init(void) dapl_dbg_log(DAPL_DBG_TYPE_UTIL, " ib_thread_init(%d) exit\n",getpid()); - return 0; + + return DAT_SUCCESS; } void dapli_ib_thread_destroy(void) diff --git a/dapl/openib_cma/dapl_ib_util.h b/dapl/openib_cma/dapl_ib_util.h index 3e1f411..9c30a44 100644 --- a/dapl/openib_cma/dapl_ib_util.h +++ b/dapl/openib_cma/dapl_ib_util.h @@ -265,7 +265,7 @@ typedef uint32_t ib_shm_transport_t; int32_t dapls_ib_init (void); int32_t dapls_ib_release (void); void dapli_thread(void *arg); -int dapli_ib_thread_init(void); +DAT_RETURN dapli_ib_thread_init(void); void dapli_ib_thread_destroy(void); void dapli_cma_event_cb(void); void dapli_cq_event_cb(struct _ib_hca_transport *hca);