本文整理汇总了C++中HYDU_FUNC_ENTER函数的典型用法代码示例。如果您正苦于以下问题:C++ HYDU_FUNC_ENTER函数的具体用法?C++ HYDU_FUNC_ENTER怎么用?C++ HYDU_FUNC_ENTER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HYDU_FUNC_ENTER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HYDU_strsplit
HYD_status HYDU_strsplit(char *str, char **str1, char **str2, char sep)
{
int i;
HYD_status status = HYD_SUCCESS;
HYDU_FUNC_ENTER();
if (str == NULL)
HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR, "");
*str1 = HYDU_strdup(str);
for (i = 0; (*str1)[i] && ((*str1)[i] != sep); i++);
if ((*str1)[i] == 0) /* End of the string */
*str2 = NULL;
else {
*str2 = HYDU_strdup(&((*str1)[i + 1]));
(*str1)[i] = 0;
}
fn_exit:
HYDU_FUNC_EXIT();
return status;
fn_fail:
goto fn_exit;
}
示例2: HYDU_FUNC_ENTER
char *HYDU_size_t_to_str(size_t x)
{
int len = 1, i;
size_t max = 10;
char *str = NULL;
HYD_status status = HYD_SUCCESS;
HYDU_FUNC_ENTER();
while (x >= max) {
len++;
max *= 10;
}
len++;
HYDU_MALLOC(str, char *, len, status);
HYDU_ERR_POP(status, "unable to allocate memory\n");
for (i = 0; i < len; i++)
str[i] = '0';
HYDU_snprintf(str, len, "%llu", (unsigned long long) x);
fn_exit:
HYDU_FUNC_EXIT();
return str;
fn_fail:
goto fn_exit;
}
示例3: HYDU_str_alloc_and_join
HYD_status HYDU_str_alloc_and_join(char **strlist, char **strjoin)
{
int len = 0, i, count;
HYD_status status = HYD_SUCCESS;
HYDU_FUNC_ENTER();
for (i = 0; strlist[i] != NULL; i++) {
len += strlen(strlist[i]);
}
HYDU_MALLOC(*strjoin, char *, len + 1, status);
count = 0;
(*strjoin)[0] = 0;
for (i = 0; strlist[i] != NULL; i++) {
HYDU_snprintf(*strjoin + count, len - count + 1, "%s", strlist[i]);
count += strlen(strlist[i]);
}
fn_exit:
HYDU_FUNC_EXIT();
return status;
fn_fail:
goto fn_exit;
}
示例4: HYDU_env_to_str
HYD_status HYDU_env_to_str(struct HYD_env *env, char **str)
{
int i;
char *tmp[HYD_NUM_TMP_STRINGS];
HYD_status status = HYD_SUCCESS;
HYDU_FUNC_ENTER();
i = 0;
tmp[i++] = MPL_strdup("'");
tmp[i++] = MPL_strdup(env->env_name);
tmp[i++] = MPL_strdup("=");
tmp[i++] = env->env_value ? MPL_strdup(env->env_value) : MPL_strdup("");
tmp[i++] = MPL_strdup("'");
tmp[i++] = NULL;
status = HYDU_str_alloc_and_join(tmp, str);
HYDU_ERR_POP(status, "unable to join strings\n");
for (i = 0; tmp[i]; i++)
MPL_free(tmp[i]);
fn_exit:
HYDU_FUNC_EXIT();
return status;
fn_fail:
goto fn_exit;
}
示例5: fn_name_publish
static HYD_status fn_name_publish(int fd, int pid, int pgid, char *args[])
{
struct HYD_string_stash stash;
char *cmd, *thrid, *val, *name = NULL, *port = NULL;
int token_count, success;
struct HYD_pmcd_token *tokens = NULL;
HYD_status status = HYD_SUCCESS;
HYDU_FUNC_ENTER();
status = HYD_pmcd_pmi_args_to_tokens(args, &tokens, &token_count);
HYDU_ERR_POP(status, "unable to convert args to tokens\n");
thrid = HYD_pmcd_pmi_find_token_keyval(tokens, token_count, "thrid");
if ((val = HYD_pmcd_pmi_find_token_keyval(tokens, token_count, "name")) == NULL)
HYDU_ERR_POP(status, "cannot find token: name\n");
name = HYDU_strdup(val);
if ((val = HYD_pmcd_pmi_find_token_keyval(tokens, token_count, "port")) == NULL)
HYDU_ERR_POP(status, "cannot find token: port\n");
port = HYDU_strdup(val);
status = HYD_pmcd_pmi_publish(name, port, &success);
HYDU_ERR_POP(status, "error publishing service\n");
HYD_STRING_STASH_INIT(stash);
HYD_STRING_STASH(stash, HYDU_strdup("cmd=name-publish-response;"), status);
if (thrid) {
HYD_STRING_STASH(stash, HYDU_strdup("thrid="), status);
HYD_STRING_STASH(stash, HYDU_strdup(thrid), status);
HYD_STRING_STASH(stash, HYDU_strdup(";"), status);
}
if (!success) {
HYD_STRING_STASH(stash, HYDU_strdup("rc=1;errmsg=duplicate_service_"), status);
HYD_STRING_STASH(stash, HYDU_strdup(name), status);
HYD_STRING_STASH(stash, HYDU_strdup(";"), status);
}
else
HYD_STRING_STASH(stash, HYDU_strdup("rc=0;"), status);
HYD_STRING_SPIT(stash, cmd, status);
status = cmd_response(fd, pid, cmd);
HYDU_ERR_POP(status, "send command failed\n");
HYDU_FREE(cmd);
fn_exit:
if (tokens)
HYD_pmcd_pmi_free_tokens(tokens, token_count);
if (name)
HYDU_FREE(name);
if (port)
HYDU_FREE(port);
HYDU_FUNC_EXIT();
return status;
fn_fail:
goto fn_exit;
}
示例6: HYDU_append_env_str_to_list
HYD_status HYDU_append_env_str_to_list(const char *str, struct HYD_env **env_list)
{
char *my_str = NULL;
char *env_name, *env_value;
HYD_status status = HYD_SUCCESS;
HYDU_FUNC_ENTER();
my_str = env_value = MPL_strdup(str);
/* don't use strtok, it will mangle env values that contain '=' */
env_name = MPL_strsep(&env_value, "=");
HYDU_ASSERT(env_name != NULL, status);
status = HYDU_append_env_to_list(env_name, env_value, env_list);
HYDU_ERR_POP(status, "unable to append env to list\n");
fn_exit:
if (my_str)
MPL_free(my_str);
HYDU_FUNC_EXIT();
return status;
fn_fail:
goto fn_exit;
}
示例7: HYDU_putenv
HYD_status HYDU_putenv(struct HYD_env *env, HYD_env_overwrite_t overwrite)
{
char *tmp[HYD_NUM_TMP_STRINGS], *str;
int i;
HYD_status status = HYD_SUCCESS;
HYDU_FUNC_ENTER();
/* If the overwrite flag is false, just exit */
if (MPL_env2str(env->env_name, (const char **) &str) && overwrite == HYD_ENV_OVERWRITE_FALSE)
goto fn_exit;
i = 0;
tmp[i++] = MPL_strdup(env->env_name);
tmp[i++] = MPL_strdup("=");
tmp[i++] = env->env_value ? MPL_strdup(env->env_value) : MPL_strdup("");
tmp[i++] = NULL;
status = HYDU_str_alloc_and_join(tmp, &str);
HYDU_ERR_POP(status, "unable to join strings\n");
MPL_putenv(str);
for (i = 0; tmp[i]; i++)
MPL_free(tmp[i]);
fn_exit:
HYDU_FUNC_EXIT();
return status;
fn_fail:
goto fn_exit;
}
示例8: HYDU_send_strlist
HYD_status HYDU_send_strlist(int fd, char **strlist)
{
int i, list_len, len;
int sent, closed;
HYD_status status = HYD_SUCCESS;
HYDU_FUNC_ENTER();
/* Check how many arguments we have */
list_len = HYDU_strlist_lastidx(strlist);
status = HYDU_sock_write(fd, &list_len, sizeof(int), &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to write data to proxy\n");
HYDU_ASSERT(!closed, status);
/* Convert the string list to parseable data and send */
for (i = 0; strlist[i]; i++) {
len = strlen(strlist[i]) + 1;
status = HYDU_sock_write(fd, &len, sizeof(int), &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to write data to proxy\n");
HYDU_ASSERT(!closed, status);
status = HYDU_sock_write(fd, strlist[i], len, &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "unable to write data to proxy\n");
HYDU_ASSERT(!closed, status);
}
fn_exit:
HYDU_FUNC_EXIT();
return status;
fn_fail:
goto fn_exit;
}
示例9: HYDU_FUNC_ENTER
char *HYDU_find_full_path(const char *execname)
{
char *tmp[HYD_NUM_TMP_STRINGS] = { NULL }, *path = NULL, *test_path = NULL;
HYD_status status = HYD_SUCCESS;
HYDU_FUNC_ENTER();
status = HYDU_find_in_path(execname, &test_path);
HYDU_ERR_POP(status, "error while searching for executable in user path\n");
if (test_path) {
tmp[0] = MPL_strdup(test_path);
tmp[1] = MPL_strdup(execname);
tmp[2] = NULL;
status = HYDU_str_alloc_and_join(tmp, &path);
HYDU_ERR_POP(status, "error joining strings\n");
}
fn_exit:
HYDU_free_strlist(tmp);
if (test_path)
MPL_free(test_path);
HYDU_FUNC_EXIT();
return path;
fn_fail:
goto fn_exit;
}
示例10: send_cmd_downstream
static HYD_status send_cmd_downstream(int fd, const char *cmd)
{
char cmdlen[7];
int sent, closed;
HYD_status status = HYD_SUCCESS;
HYDU_FUNC_ENTER();
MPL_snprintf(cmdlen, 7, "%6u", (unsigned) strlen(cmd));
status = HYDU_sock_write(fd, cmdlen, 6, &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "error writing PMI line\n");
/* FIXME: We cannot abort when we are not able to send data
* downstream. The upper layer needs to handle this based on
* whether we want to abort or not.*/
HYDU_ASSERT(!closed, status);
if (HYD_pmcd_pmip.user_global.debug) {
HYDU_dump(stdout, "PMI response: %s\n", cmd);
}
status = HYDU_sock_write(fd, cmd, strlen(cmd), &sent, &closed, HYDU_SOCK_COMM_MSGWAIT);
HYDU_ERR_POP(status, "error writing PMI line\n");
HYDU_ASSERT(!closed, status);
fn_exit:
HYDU_FUNC_EXIT();
return status;
fn_fail:
goto fn_exit;
}
示例11: create_env_file
static HYD_status create_env_file(const struct HYD_env *envlist, int num_ranks, int *ranks)
{
HYD_status status = HYD_SUCCESS;
char filename[256];
FILE *f;
const struct HYD_env *e;
int ret;
int r;
HYDU_FUNC_ENTER();
for (r = 0; r < num_ranks; ++r) {
MPL_snprintf(filename, sizeof(filename), "/tmp/hydra-env-file-%d:%d", (int) getpid(),
ranks[r]);
f = fopen(filename, "w");
HYDU_ERR_CHKANDJUMP(status, f == NULL, HYD_INTERNAL_ERROR, "fopen failed: %s\n",
strerror(errno));
for (e = envlist; e; e = e->next) {
fprintf(f, "%s=%s\n", e->env_name, e->env_value);
}
ret = fclose(f);
HYDU_ERR_CHKANDJUMP(status, ret, HYD_INTERNAL_ERROR, "fclose failed: %s\n",
strerror(errno));
}
fn_exit:
HYDU_FUNC_EXIT();
return status;
fn_fail:
goto fn_exit;
}
示例12: HYDT_bscd_pbs_launcher_finalize
HYD_status HYDT_bscd_pbs_launcher_finalize(void)
{
int err;
HYD_status status = HYD_SUCCESS;
HYDU_FUNC_ENTER();
#if defined(HAVE_TM_H)
err = tm_finalize();
HYDU_ERR_CHKANDJUMP(status, err != TM_SUCCESS, HYD_INTERNAL_ERROR,
"error calling tm_finalize\n");
#endif /* HAVE_TM_H */
if (HYDT_bscd_pbs_sys) {
if (HYDT_bscd_pbs_sys->task_id)
HYDU_FREE(HYDT_bscd_pbs_sys->task_id);
if (HYDT_bscd_pbs_sys->spawn_events)
HYDU_FREE(HYDT_bscd_pbs_sys->spawn_events);
HYDU_FREE(HYDT_bscd_pbs_sys);
}
fn_exit:
HYDU_FUNC_EXIT();
return status;
fn_fail:
goto fn_exit;
}
示例13: HYDTI_bscd_ll_query_node_count
HYD_status HYDTI_bscd_ll_query_node_count(int *count)
{
char *hostfile;
HYD_status status = HYD_SUCCESS;
HYDU_FUNC_ENTER();
if (MPL_env2str("LOADL_HOSTFILE", (const char **) &hostfile) == 0)
hostfile = NULL;
if (hostfile == NULL) {
HYDU_ERR_SETANDJUMP(status, HYD_INTERNAL_ERROR, "No LL nodefile found\n");
}
else {
total_node_count = 0;
status = HYDU_parse_hostfile(hostfile, NULL, process_mfile_count);
HYDU_ERR_POP(status, "error parsing hostfile\n");
*count = total_node_count;
}
fn_exit:
HYDU_FUNC_EXIT();
return status;
fn_fail:
goto fn_exit;
}
示例14: HYDU_free_exec_list
void HYDU_free_exec_list(struct HYD_exec *exec_list)
{
struct HYD_exec *exec, *run;
HYDU_FUNC_ENTER();
exec = exec_list;
while (exec) {
run = exec->next;
HYDU_free_strlist(exec->exec);
if (exec->wdir)
HYDU_FREE(exec->wdir);
if (exec->env_prop)
HYDU_FREE(exec->env_prop);
HYDU_env_free_list(exec->user_env);
exec->user_env = NULL;
HYDU_FREE(exec);
exec = run;
}
HYDU_FUNC_EXIT();
}
示例15: HYDU_correct_wdir
HYD_status HYDU_correct_wdir(char **wdir)
{
char *tmp[HYD_NUM_TMP_STRINGS];
HYD_status status = HYD_SUCCESS;
HYDU_FUNC_ENTER();
if (*wdir == NULL) {
*wdir = HYDU_getcwd();
}
else if (*wdir[0] != '/') {
tmp[0] = HYDU_getcwd();
tmp[1] = HYDU_strdup("/");
tmp[2] = HYDU_strdup(*wdir);
tmp[3] = NULL;
HYDU_FREE(*wdir);
status = HYDU_str_alloc_and_join(tmp, wdir);
HYDU_ERR_POP(status, "unable to join strings\n");
HYDU_free_strlist(tmp);
}
fn_exit:
HYDU_FUNC_EXIT();
return status;
fn_fail:
goto fn_exit;
}