本文整理汇总了C++中PMIX_ERROR_LOG函数的典型用法代码示例。如果您正苦于以下问题:C++ PMIX_ERROR_LOG函数的具体用法?C++ PMIX_ERROR_LOG怎么用?C++ PMIX_ERROR_LOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PMIX_ERROR_LOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pmix_ds12_lock_finalize
void pmix_ds12_lock_finalize(pmix_common_dstor_lock_ctx_t *lock_ctx)
{
ds12_lock_pthread_ctx_t *pthread_lock =
(ds12_lock_pthread_ctx_t*)*lock_ctx;
if (NULL == pthread_lock) {
PMIX_ERROR_LOG(PMIX_ERR_NOT_FOUND);
return;
}
if (0 != pthread_rwlock_destroy(pthread_lock->rwlock)) {
PMIX_ERROR_LOG(PMIX_ERROR);
return;
}
if (NULL == pthread_lock->segment) {
PMIX_ERROR_LOG(PMIX_ERROR);
return;
}
/* detach & unlink from current desc */
if (pthread_lock->segment->seg_cpid == getpid()) {
pmix_pshmem.segment_unlink(pthread_lock->segment);
}
pmix_pshmem.segment_detach(pthread_lock->segment);
free(pthread_lock->segment);
pthread_lock->segment = NULL;
pthread_lock->rwlock = NULL;
free(pthread_lock);
*lock_ctx = NULL;
}
示例2: pmix_bfrops_base_unpack_value
pmix_status_t pmix_bfrops_base_unpack_value(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
pmix_value_t *ptr;
int32_t i, n;
pmix_status_t ret;
ptr = (pmix_value_t *) dest;
n = *num_vals;
for (i = 0; i < n; ++i) {
/* unpack the type */
if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer, &ptr[i].type))) {
PMIX_ERROR_LOG(ret);
return ret;
}
/* unpack value */
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_val(regtypes, buffer, &ptr[i])) ) {
PMIX_ERROR_LOG(ret);
return ret;
}
}
return PMIX_SUCCESS;
}
示例3: pmix_bfrop_unpack_kval
pmix_status_t pmix_bfrop_unpack_kval(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
pmix_kval_t *ptr;
int32_t i, n, m;
pmix_status_t ret;
pmix_output_verbose(20, pmix_globals.debug_output,
"pmix_bfrop_unpack: %d kvals", *num_vals);
ptr = (pmix_kval_t*) dest;
n = *num_vals;
for (i = 0; i < n; ++i) {
PMIX_CONSTRUCT(&ptr[i], pmix_kval_t);
/* unpack the key */
m = 1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &ptr[i].key, &m, PMIX_STRING))) {
PMIX_ERROR_LOG(ret);
return ret;
}
/* allocate the space */
ptr[i].value = (pmix_value_t*)malloc(sizeof(pmix_value_t));
/* unpack the value */
m = 1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_value(buffer, ptr[i].value, &m, PMIX_VALUE))) {
PMIX_ERROR_LOG(ret);
return ret;
}
}
return PMIX_SUCCESS;
}
示例4: pmix_bfrops_base_unpack_sizet
/*
* SIZE_T
*/
pmix_status_t pmix_bfrops_base_unpack_sizet(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
pmix_status_t ret;
pmix_data_type_t remote_type;
if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer,
&remote_type))) {
PMIX_ERROR_LOG(ret);
return ret;
}
if (remote_type == BFROP_TYPE_SIZE_T) {
/* fast path it if the sizes are the same */
/* Turn around and unpack the real type */
PMIX_BFROPS_UNPACK_TYPE(ret, buffer, dest, num_vals, BFROP_TYPE_SIZE_T,
regtypes);
if (PMIX_SUCCESS != ret) {
PMIX_ERROR_LOG(ret);
}
} else {
/* slow path - types are different sizes */
PMIX_BFROP_UNPACK_SIZE_MISMATCH(regtypes, size_t, remote_type, ret);
}
return ret;
}
示例5: setup_app
static pmix_status_t setup_app(char *nspace, pmix_list_t *ilist)
{
uint64_t unique_key[2];
char *string_key, *cs_env;
int fd_rand;
size_t bytes_read;
pmix_kval_t *kv;
/* put the number here - or else create an appropriate string. this just needs to
* eventually be a string variable
*/
if(-1 == (fd_rand = open("/dev/urandom", O_RDONLY))) {
transports_use_rand(unique_key);
} else {
bytes_read = read(fd_rand, (char *) unique_key, 16);
if(bytes_read != 16) {
transports_use_rand(unique_key);
}
close(fd_rand);
}
if (NULL == (string_key = transports_print(unique_key))) {
PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE);
return PMIX_ERR_OUT_OF_RESOURCE;
}
if (PMIX_SUCCESS != pmix_mca_base_var_env_name("pmix_precondition_transports", &cs_env)) {
PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE);
free(string_key);
return PMIX_ERR_OUT_OF_RESOURCE;
}
kv = PMIX_NEW(pmix_kval_t);
if (NULL == kv) {
free(string_key);
free(cs_env);
return PMIX_ERR_OUT_OF_RESOURCE;
}
kv->key = strdup(PMIX_SET_ENVAR);
kv->value = (pmix_value_t*)malloc(sizeof(pmix_value_t));
if (NULL == kv->value) {
free(string_key);
free(cs_env);
PMIX_RELEASE(kv);
return PMIX_ERR_OUT_OF_RESOURCE;
}
kv->value->type = PMIX_STRING;
if (0 > asprintf(&kv->value->data.string, "%s=%s", cs_env, string_key)) {
free(string_key);
free(cs_env);
PMIX_RELEASE(kv);
return PMIX_ERR_OUT_OF_RESOURCE;
}
pmix_list_append(ilist, &kv->super);
free(cs_env);
free(string_key);
return PMIX_SUCCESS;
}
示例6: pmix_pack_proc_map
/* we need to pass three things to the client:
*
* (a) the list of nodes involved in this nspace
*
* (b) the hostname for each proc in this nspace
*
* (c) the list of procs on each node for reverse lookup
*/
void pmix_pack_proc_map(pmix_buffer_t *buf,
char **nodes, char **procs)
{
pmix_kval_t kv;
pmix_value_t val;
pmix_status_t rc;
pmix_buffer_t buf2;
size_t i, nnodes;
/* bozo check - need procs for each node */
if (pmix_argv_count(nodes) != pmix_argv_count(procs)) {
PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM);
return;
}
PMIX_CONSTRUCT(&buf2, pmix_buffer_t);
PMIX_CONSTRUCT(&kv, pmix_kval_t);
kv.value = &val;
val.type = PMIX_STRING;
/* pass the number of nodes involved in this namespace */
nnodes = pmix_argv_count(nodes);
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(&buf2, &nnodes, 1, PMIX_SIZE))) {
PMIX_ERROR_LOG(rc);
goto cleanup;
}
for (i=0; i < nnodes; i++) {
/* pass the complete list of procs on this node */
kv.key = nodes[i];
val.data.string = procs[i];
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(&buf2, &kv, 1, PMIX_KVAL))) {
PMIX_ERROR_LOG(rc);
kv.key = NULL;
val.data.string = NULL;
goto cleanup;
}
}
kv.key = NULL;
val.data.string = NULL;
/* pass the completed blob */
kv.key = PMIX_MAP_BLOB;
val.type = PMIX_BYTE_OBJECT;
val.data.bo.bytes = buf2.base_ptr;
val.data.bo.size = buf2.bytes_used;
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(buf, &kv, 1, PMIX_KVAL))) {
PMIX_ERROR_LOG(rc);
}
kv.key = NULL;
kv.value = NULL;
val.data.bo.bytes = NULL;
val.data.bo.size = 0;
cleanup:
PMIX_DESTRUCT(&buf2);
PMIX_DESTRUCT(&kv);
return;
}
示例7: PMIx_Disconnect_nb
int PMIx_Disconnect_nb(const pmix_proc_t procs[], size_t nprocs,
pmix_op_cbfunc_t cbfunc, void *cbdata)
{
pmix_buffer_t *msg;
pmix_cmd_t cmd = PMIX_DISCONNECTNB_CMD;
int rc;
pmix_cb_t *cb;
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: disconnect called");
if (pmix_client_globals.init_cntr <= 0) {
return PMIX_ERR_INIT;
}
/* if we aren't connected, don't attempt to send */
if (!pmix_globals.connected) {
return PMIX_ERR_UNREACH;
}
/* check for bozo input */
if (NULL == procs || 0 >= nprocs) {
return PMIX_ERR_BAD_PARAM;
}
msg = PMIX_NEW(pmix_buffer_t);
/* pack the cmd */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &cmd, 1, PMIX_CMD))) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack the number of procs */
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, &nprocs, 1, PMIX_SIZE))) {
PMIX_ERROR_LOG(rc);
return rc;
}
if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(msg, procs, nprocs, PMIX_PROC))) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* create a callback object as we need to pass it to the
* recv routine so we know which callback to use when
* the return message is recvd */
cb = PMIX_NEW(pmix_cb_t);
cb->op_cbfunc = cbfunc;
cb->cbdata = cbdata;
/* push the message into our event base to send to the server */
PMIX_ACTIVATE_SEND_RECV(&pmix_client_globals.myserver, msg, wait_cbfunc, cb);
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: disconnect completed");
return PMIX_SUCCESS;
}
示例8: pmix_bfrop_unpack_info
pmix_status_t pmix_bfrop_unpack_info(pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
pmix_info_t *ptr;
int32_t i, n, m;
pmix_status_t ret;
char *tmp;
pmix_output_verbose(20, pmix_globals.debug_output,
"pmix_bfrop_unpack: %d info", *num_vals);
ptr = (pmix_info_t *) dest;
n = *num_vals;
for (i = 0; i < n; ++i) {
memset(ptr[i].key, 0, sizeof(ptr[i].key));
memset(&ptr[i].value, 0, sizeof(pmix_value_t));
/* unpack key */
m=1;
tmp = NULL;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_string(buffer, &tmp, &m, PMIX_STRING))) {
PMIX_ERROR_LOG(ret);
return ret;
}
if (NULL == tmp) {
PMIX_ERROR_LOG(PMIX_ERROR);
return PMIX_ERROR;
}
(void)strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN);
free(tmp);
/* unpack the flags */
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_infodirs(buffer, &ptr[i].flags, &m, PMIX_INFO_DIRECTIVES))) {
PMIX_ERROR_LOG(ret);
return ret;
}
/* unpack value - since the value structure is statically-defined
* instead of a pointer in this struct, we directly unpack it to
* avoid the malloc */
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrop_unpack_int(buffer, &ptr[i].value.type, &m, PMIX_INT))) {
PMIX_ERROR_LOG(ret);
return ret;
}
pmix_output_verbose(20, pmix_globals.debug_output,
"pmix_bfrop_unpack: info type %d", ptr[i].value.type);
m=1;
if (PMIX_SUCCESS != (ret = unpack_val(buffer, &ptr[i].value))) {
PMIX_ERROR_LOG(ret);
return ret;
}
}
return PMIX_SUCCESS;
}
示例9: query_cbfunc
static void query_cbfunc(struct pmix_peer_t *peer,
pmix_ptl_hdr_t *hdr,
pmix_buffer_t *buf, void *cbdata)
{
pmix_query_caddy_t *cd = (pmix_query_caddy_t*)cbdata;
pmix_status_t rc;
pmix_shift_caddy_t *results;
int cnt;
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:query cback from server");
results = PMIX_NEW(pmix_shift_caddy_t);
/* unpack the status */
cnt = 1;
PMIX_BFROPS_UNPACK(rc, peer, buf, &results->status, &cnt, PMIX_STATUS);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
results->status = rc;
goto complete;
}
if (PMIX_SUCCESS != results->status) {
goto complete;
}
/* unpack any returned data */
cnt = 1;
PMIX_BFROPS_UNPACK(rc, peer, buf, &results->ninfo, &cnt, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
results->status = rc;
goto complete;
}
if (0 < results->ninfo) {
PMIX_INFO_CREATE(results->info, results->ninfo);
cnt = results->ninfo;
PMIX_BFROPS_UNPACK(rc, peer, buf, results->info, &cnt, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
results->status = rc;
goto complete;
}
}
complete:
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:query cback from server releasing");
/* release the caller */
if (NULL != cd->cbfunc) {
cd->cbfunc(results->status, results->info, results->ninfo, cd->cbdata, relcbfunc, results);
}
PMIX_RELEASE(cd);
}
示例10: pmix_bfrops_base_unpack_pdata
pmix_status_t pmix_bfrops_base_unpack_pdata(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer, void *dest,
int32_t *num_vals, pmix_data_type_t type)
{
pmix_pdata_t *ptr;
int32_t i, n, m;
pmix_status_t ret;
char *tmp;
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
"pmix_bfrop_unpack: %d pdata", *num_vals);
ptr = (pmix_pdata_t *) dest;
n = *num_vals;
for (i = 0; i < n; ++i) {
PMIX_PDATA_CONSTRUCT(&ptr[i]);
/* unpack the proc */
m=1;
PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &ptr[i].proc, &m, PMIX_PROC, regtypes);
if (PMIX_SUCCESS != ret) {
return ret;
}
/* unpack key */
m=1;
tmp = NULL;
PMIX_BFROPS_UNPACK_TYPE(ret, buffer, &tmp, &m, PMIX_STRING, regtypes);
if (PMIX_SUCCESS != ret) {
return ret;
}
if (NULL == tmp) {
PMIX_ERROR_LOG(PMIX_ERROR);
return PMIX_ERROR;
}
pmix_strncpy(ptr[i].key, tmp, PMIX_MAX_KEYLEN);
free(tmp);
/* unpack value - since the value structure is statically-defined
* instead of a pointer in this struct, we directly unpack it to
* avoid the malloc */
if (PMIX_SUCCESS != (ret = pmix_bfrop_get_data_type(regtypes, buffer, &ptr[i].value.type))) {
PMIX_ERROR_LOG(ret);
return ret;
}
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
"pmix_bfrop_unpack: pdata type %d %s", ptr[i].value.type, ptr[i].value.data.string);
m=1;
if (PMIX_SUCCESS != (ret = pmix_bfrops_base_unpack_val(regtypes, buffer, &ptr[i].value))) {
PMIX_ERROR_LOG(ret);
return ret;
}
}
return PMIX_SUCCESS;
}
示例11: pmix_bfrops_base_unpack_buffer
static pmix_status_t pmix_bfrops_base_unpack_buffer(pmix_pointer_array_t *regtypes,
pmix_buffer_t *buffer,
void *dst, int32_t *num_vals,
pmix_data_type_t type)
{
pmix_status_t rc;
pmix_data_type_t local_type;
pmix_output_verbose(20, pmix_bfrops_base_framework.framework_output,
"pmix_bfrops_base_unpack_buffer( %p, %p, %lu, %d )\n",
(void*)buffer, dst, (long unsigned int)*num_vals, (int)type);
/** Unpack the declared data type */
if (PMIX_BFROP_BUFFER_FULLY_DESC == buffer->type) {
if (PMIX_SUCCESS != (rc = pmix_bfrop_get_data_type(regtypes, buffer, &local_type))) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* if the data types don't match, then return an error */
if (type != local_type) {
pmix_output(0, "PMIX bfrop:unpack: got type %d when expecting type %d", local_type, type);
return PMIX_ERR_PACK_MISMATCH;
}
}
PMIX_BFROPS_UNPACK_TYPE(rc, buffer, dst, num_vals, type, regtypes);
return rc;
}
示例12: PMIx_Publish
PMIX_EXPORT pmix_status_t PMIx_Publish(const pmix_info_t info[],
size_t ninfo)
{
pmix_status_t rc;
pmix_cb_t *cb;
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix: publish called");
if (pmix_globals.init_cntr <= 0) {
return PMIX_ERR_INIT;
}
/* if we aren't connected, don't attempt to send */
if (!pmix_globals.connected) {
return PMIX_ERR_UNREACH;
}
/* create a callback object to let us know when it is done */
cb = PMIX_NEW(pmix_cb_t);
cb->active = true;
if (PMIX_SUCCESS != (rc = PMIx_Publish_nb(info, ninfo, op_cbfunc, cb))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(cb);
return rc;
}
/* wait for the server to ack our request */
PMIX_WAIT_FOR_COMPLETION(cb->active);
rc = (pmix_status_t)cb->status;
PMIX_RELEASE(cb);
return rc;
}
示例13: pack_fence
static pmix_status_t pack_fence(pmix_buffer_t *msg, pmix_cmd_t cmd,
const pmix_proc_t *procs, size_t nprocs,
const pmix_info_t *info, size_t ninfo)
{
pmix_status_t rc;
/* pack the cmd */
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &cmd, 1, PMIX_CMD);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack the number of procs */
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &nprocs, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack any provided procs - must always be at least one (our own) */
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, procs, nprocs, PMIX_PROC);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack the number of info */
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, &ninfo, 1, PMIX_SIZE);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
/* pack any provided info - may be NULL */
if (NULL != info && 0 < ninfo) {
PMIX_BFROPS_PACK(rc, pmix_client_globals.myserver,
msg, info, ninfo, PMIX_INFO);
if (PMIX_SUCCESS != rc) {
PMIX_ERROR_LOG(rc);
return rc;
}
}
return PMIX_SUCCESS;
}
示例14: wait_cbfunc
static void wait_cbfunc(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr,
pmix_buffer_t *buf, void *cbdata)
{
pmix_cb_t *cb = (pmix_cb_t*)cbdata;
pmix_status_t rc;
pmix_status_t ret;
int32_t cnt;
char *nspace;
pmix_buffer_t *bptr;
pmix_output_verbose(2, pmix_globals.debug_output,
"pmix:client recv callback activated with %d bytes",
(NULL == buf) ? -1 : (int)buf->bytes_used);
/* unpack the returned status */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(buf, &ret, &cnt, PMIX_INT))) {
PMIX_ERROR_LOG(rc);
ret = rc;
}
/* connect has to also pass back data from all nspace's involved in
* the operation, including our own. Each will come as a buffer */
cnt = 1;
while (PMIX_SUCCESS == (rc = pmix_bfrop.unpack(buf, &bptr, &cnt, PMIX_BUFFER))) {
/* unpack the nspace for this blob */
cnt = 1;
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(bptr, &nspace, &cnt, PMIX_STRING))) {
PMIX_ERROR_LOG(rc);
PMIX_RELEASE(bptr);
continue;
}
/* extract and process any proc-related info for this nspace */
pmix_client_process_nspace_blob(nspace, bptr);
PMIX_RELEASE(bptr);
}
if (PMIX_ERR_UNPACK_READ_PAST_END_OF_BUFFER != rc) {
PMIX_ERROR_LOG(rc);
ret = rc;
}
if (NULL != cb->op_cbfunc) {
cb->op_cbfunc(ret, cb->cbdata);
}
}
示例15: pmix_start_progress_thread
pmix_event_base_t* pmix_start_progress_thread()
{
pmix_event_base_t *ev_base;
/* Setup threading */
evthread_use_pthreads();
/* Create base for events */
if (NULL == (ev_base = (pmix_event_base_t*)event_base_new())) {
PMIX_ERROR_LOG(PMIX_ERR_OUT_OF_RESOURCE);
return NULL;
}
/* add an event it can block on */
if (0 > pipe(block_pipe)) {
PMIX_ERROR_LOG(PMIX_ERR_IN_ERRNO);
return NULL;
}
/* Make sure the pipe FDs are set to close-on-exec so that
they don't leak into children */
if (pmix_fd_set_cloexec(block_pipe[0]) != PMIX_SUCCESS ||
pmix_fd_set_cloexec(block_pipe[1]) != PMIX_SUCCESS) {
PMIX_ERROR_LOG(PMIX_ERR_IN_ERRNO);
close(block_pipe[0]);
close(block_pipe[1]);
event_base_free(ev_base);
return NULL;
}
event_assign(&block_ev, ev_base, block_pipe[0],
EV_READ, wakeup, NULL);
event_add(&block_ev, 0);
evlib_active = true;
block_active = true;
/* fork off a thread to progress it */
if (0 > pthread_create(&engine, NULL, progress_engine, (void*)ev_base)) {
PMIX_ERROR_LOG(PMIX_ERROR);
return NULL;
}
if (!thread_initalized) {
thread_initalized = true;
}
return ev_base;
}