opal: replace opal_convert_jobid_to_string with opal_snprintf_jobid
Этот коммит содержится в:
родитель
e5cf2db3b7
Коммит
1d38430e43
6
opal/mca/pmix/external/pmix_ext_server_north.c
поставляемый
6
opal/mca/pmix/external/pmix_ext_server_north.c
поставляемый
@ -1,7 +1,7 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014-2015 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
@ -415,7 +415,7 @@ static void opal_lkupcbfunc(int status,
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(p, data, opal_pmix_pdata_t) {
|
||||
/* convert the jobid */
|
||||
(void)snprintf(d[n].proc.nspace, PMIX_MAX_NSLEN, "%s", opal_convert_jobid_to_string(p->proc.jobid));
|
||||
(void)opal_snprintf_jobid(d[n].proc.nspace, PMIX_MAX_NSLEN, p->proc.jobid);
|
||||
d[n].proc.rank = p->proc.vpid;
|
||||
(void)strncpy(d[n].key, p->value.key, PMIX_MAX_KEYLEN);
|
||||
pmix1_value_load(&d[n].value, &p->value);
|
||||
@ -534,7 +534,7 @@ static void opal_spncbfunc(int status, opal_jobid_t jobid, void *cbdata)
|
||||
if (NULL != opalcaddy->spwncbfunc) {
|
||||
rc = pmix1_convert_opalrc(status);
|
||||
/* convert the jobid */
|
||||
(void)snprintf(nspace, PMIX_MAX_NSLEN, "%s", opal_convert_jobid_to_string(jobid));
|
||||
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);
|
||||
opalcaddy->spwncbfunc(rc, nspace, opalcaddy->cbdata);
|
||||
}
|
||||
OBJ_RELEASE(opalcaddy);
|
||||
|
14
opal/mca/pmix/external/pmix_ext_server_south.c
поставляемый
14
opal/mca/pmix/external/pmix_ext_server_south.c
поставляемый
@ -1,7 +1,7 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014 Mellanox Technologies, Inc.
|
||||
@ -209,7 +209,7 @@ int pmix1_server_register_nspace(opal_jobid_t jobid,
|
||||
opal_pmix1_jobid_trkr_t *job;
|
||||
|
||||
/* convert the jobid */
|
||||
(void)snprintf(nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(jobid));
|
||||
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);
|
||||
|
||||
/* store this job in our list of known nspaces */
|
||||
job = OBJ_NEW(opal_pmix1_jobid_trkr_t);
|
||||
@ -295,7 +295,7 @@ int pmix1_server_register_client(const opal_process_name_t *proc,
|
||||
op->cbdata = cbdata;
|
||||
|
||||
/* convert the jobid */
|
||||
(void)strncpy(op->p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
|
||||
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
|
||||
op->p.rank = proc->vpid;
|
||||
|
||||
rc = PMIx_server_register_client(&op->p, uid, gid, server_object,
|
||||
@ -330,7 +330,7 @@ int pmix1_server_setup_fork(const opal_process_name_t *proc, char ***env)
|
||||
pmix_proc_t p;
|
||||
|
||||
/* convert the jobid */
|
||||
(void)strncpy(p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
|
||||
(void)opal_snprintf_jobid(p.nspace, PMIX_MAX_NSLEN, proc->jobid);
|
||||
p.rank = proc->vpid;
|
||||
|
||||
rc = PMIx_server_setup_fork(&p, env);
|
||||
@ -364,7 +364,7 @@ int pmix1_server_dmodex(const opal_process_name_t *proc,
|
||||
op->cbdata = cbdata;
|
||||
|
||||
/* convert the jobid */
|
||||
(void)strncpy(op->p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
|
||||
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
|
||||
op->p.rank = proc->vpid;
|
||||
|
||||
/* find the internally-cached data for this proc */
|
||||
@ -395,7 +395,7 @@ int pmix1_server_notify_error(int status,
|
||||
PMIX_PROC_CREATE(ps, psz);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(nm, procs, opal_namelist_t) {
|
||||
(void)snprintf(ps[n].nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(nm->name.jobid));
|
||||
(void)opal_snprintf_jobid(ps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
|
||||
ps[n].rank = (int)nm->name.vpid;
|
||||
++n;
|
||||
}
|
||||
@ -408,7 +408,7 @@ int pmix1_server_notify_error(int status,
|
||||
PMIX_PROC_CREATE(eps, esz);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(nm, error_procs, opal_namelist_t) {
|
||||
(void)snprintf(eps[n].nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(nm->name.jobid));
|
||||
(void)opal_snprintf_jobid(eps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
|
||||
eps[n].rank = (int)nm->name.vpid;
|
||||
++n;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
@ -415,7 +415,7 @@ static void opal_lkupcbfunc(int status,
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(p, data, opal_pmix_pdata_t) {
|
||||
/* convert the jobid */
|
||||
(void)snprintf(d[n].proc.nspace, PMIX_MAX_NSLEN, "%s", opal_convert_jobid_to_string(p->proc.jobid));
|
||||
(void)opal_snprintf_jobid(d[n].proc.nspace, PMIX_MAX_NSLEN, p->proc.jobid);
|
||||
d[n].proc.rank = p->proc.vpid;
|
||||
(void)strncpy(d[n].key, p->value.key, PMIX_MAX_KEYLEN);
|
||||
pmix1_value_load(&d[n].value, &p->value);
|
||||
@ -534,7 +534,7 @@ static void opal_spncbfunc(int status, opal_jobid_t jobid, void *cbdata)
|
||||
if (NULL != opalcaddy->spwncbfunc) {
|
||||
rc = pmix1_convert_opalrc(status);
|
||||
/* convert the jobid */
|
||||
(void)snprintf(nspace, PMIX_MAX_NSLEN, "%s", opal_convert_jobid_to_string(jobid));
|
||||
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);
|
||||
opalcaddy->spwncbfunc(rc, nspace, opalcaddy->cbdata);
|
||||
}
|
||||
OBJ_RELEASE(opalcaddy);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
@ -197,7 +197,7 @@ int pmix1_server_register_nspace(opal_jobid_t jobid,
|
||||
opal_pmix1_jobid_trkr_t *job;
|
||||
|
||||
/* convert the jobid */
|
||||
(void)snprintf(nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(jobid));
|
||||
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);
|
||||
|
||||
/* store this job in our list of known nspaces */
|
||||
job = OBJ_NEW(opal_pmix1_jobid_trkr_t);
|
||||
@ -283,7 +283,7 @@ int pmix1_server_register_client(const opal_process_name_t *proc,
|
||||
op->cbdata = cbdata;
|
||||
|
||||
/* convert the jobid */
|
||||
(void)strncpy(op->p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
|
||||
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
|
||||
op->p.rank = proc->vpid;
|
||||
|
||||
rc = PMIx_server_register_client(&op->p, uid, gid, server_object,
|
||||
@ -318,7 +318,7 @@ int pmix1_server_setup_fork(const opal_process_name_t *proc, char ***env)
|
||||
pmix_proc_t p;
|
||||
|
||||
/* convert the jobid */
|
||||
(void)strncpy(p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
|
||||
(void)opal_snprintf_jobid(p.nspace, PMIX_MAX_NSLEN, proc->jobid);
|
||||
p.rank = proc->vpid;
|
||||
|
||||
rc = PMIx_server_setup_fork(&p, env);
|
||||
@ -352,7 +352,7 @@ int pmix1_server_dmodex(const opal_process_name_t *proc,
|
||||
op->cbdata = cbdata;
|
||||
|
||||
/* convert the jobid */
|
||||
(void)strncpy(op->p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
|
||||
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
|
||||
op->p.rank = proc->vpid;
|
||||
|
||||
/* find the internally-cached data for this proc */
|
||||
@ -383,7 +383,7 @@ int pmix1_server_notify_error(int status,
|
||||
PMIX_PROC_CREATE(ps, psz);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(nm, procs, opal_namelist_t) {
|
||||
(void)snprintf(ps[n].nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(nm->name.jobid));
|
||||
(void)opal_snprintf_jobid(ps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
|
||||
ps[n].rank = (int)nm->name.vpid;
|
||||
++n;
|
||||
}
|
||||
@ -396,7 +396,7 @@ int pmix1_server_notify_error(int status,
|
||||
PMIX_PROC_CREATE(eps, esz);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(nm, error_procs, opal_namelist_t) {
|
||||
(void)snprintf(eps[n].nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(nm->name.jobid));
|
||||
(void)opal_snprintf_jobid(eps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
|
||||
eps[n].rank = (int)nm->name.vpid;
|
||||
++n;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
@ -415,7 +415,7 @@ static void opal_lkupcbfunc(int status,
|
||||
n=0;
|
||||
OPAL_LIST_FOREACH(p, data, opal_pmix_pdata_t) {
|
||||
/* convert the jobid */
|
||||
(void)snprintf(d[n].proc.nspace, PMIX_MAX_NSLEN, "%s", opal_convert_jobid_to_string(p->proc.jobid));
|
||||
(void)opal_snprintf_jobid(d[n].proc.nspace, PMIX_MAX_NSLEN, p->proc.jobid);
|
||||
d[n].proc.rank = p->proc.vpid;
|
||||
(void)strncpy(d[n].key, p->value.key, PMIX_MAX_KEYLEN);
|
||||
pmix120_value_load(&d[n].value, &p->value);
|
||||
@ -534,7 +534,7 @@ static void opal_spncbfunc(int status, opal_jobid_t jobid, void *cbdata)
|
||||
if (NULL != opalcaddy->spwncbfunc) {
|
||||
rc = pmix120_convert_opalrc(status);
|
||||
/* convert the jobid */
|
||||
(void)snprintf(nspace, PMIX_MAX_NSLEN, "%s", opal_convert_jobid_to_string(jobid));
|
||||
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);
|
||||
opalcaddy->spwncbfunc(rc, nspace, opalcaddy->cbdata);
|
||||
}
|
||||
OBJ_RELEASE(opalcaddy);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
||||
/*
|
||||
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2014 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
@ -140,7 +140,7 @@ int pmix120_server_register_nspace(opal_jobid_t jobid,
|
||||
opal_pmix120_jobid_trkr_t *job;
|
||||
|
||||
/* convert the jobid */
|
||||
(void)snprintf(nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(jobid));
|
||||
(void)opal_snprintf_jobid(nspace, PMIX_MAX_NSLEN, jobid);
|
||||
|
||||
/* store this job in our list of known nspaces */
|
||||
job = OBJ_NEW(opal_pmix120_jobid_trkr_t);
|
||||
@ -226,7 +226,7 @@ int pmix120_server_register_client(const opal_process_name_t *proc,
|
||||
op->cbdata = cbdata;
|
||||
|
||||
/* convert the jobid */
|
||||
(void)strncpy(op->p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
|
||||
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
|
||||
op->p.rank = proc->vpid;
|
||||
|
||||
rc = PMIx_server_register_client(&op->p, uid, gid, server_object,
|
||||
@ -261,7 +261,7 @@ int pmix120_server_setup_fork(const opal_process_name_t *proc, char ***env)
|
||||
pmix_proc_t p;
|
||||
|
||||
/* convert the jobid */
|
||||
(void)strncpy(p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
|
||||
(void)opal_snprintf_jobid(p.nspace, PMIX_MAX_NSLEN, proc->jobid);
|
||||
p.rank = proc->vpid;
|
||||
|
||||
rc = PMIx_server_setup_fork(&p, env);
|
||||
@ -295,7 +295,7 @@ int pmix120_server_dmodex(const opal_process_name_t *proc,
|
||||
op->cbdata = cbdata;
|
||||
|
||||
/* convert the jobid */
|
||||
(void)strncpy(op->p.nspace, opal_convert_jobid_to_string(proc->jobid), PMIX_MAX_NSLEN);
|
||||
(void)opal_snprintf_jobid(op->p.nspace, PMIX_MAX_NSLEN, proc->jobid);
|
||||
op->p.rank = proc->vpid;
|
||||
|
||||
/* find the internally-cached data for this proc */
|
||||
@ -326,7 +326,7 @@ int pmix120_server_notify_error(int status,
|
||||
PMIX_PROC_CREATE(ps, psz);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(nm, procs, opal_namelist_t) {
|
||||
(void)snprintf(ps[n].nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(nm->name.jobid));
|
||||
(void)opal_snprintf_jobid(ps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
|
||||
ps[n].rank = (int)nm->name.vpid;
|
||||
++n;
|
||||
}
|
||||
@ -339,7 +339,7 @@ int pmix120_server_notify_error(int status,
|
||||
PMIX_PROC_CREATE(eps, esz);
|
||||
n = 0;
|
||||
OPAL_LIST_FOREACH(nm, error_procs, opal_namelist_t) {
|
||||
(void)snprintf(eps[n].nspace, PMIX_MAX_NSLEN, opal_convert_jobid_to_string(nm->name.jobid));
|
||||
(void)opal_snprintf_jobid(eps[n].nspace, PMIX_MAX_NSLEN, nm->name.jobid);
|
||||
eps[n].rank = (int)nm->name.vpid;
|
||||
++n;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2013 Inria. All rights reserved.
|
||||
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
|
||||
* reserved.
|
||||
@ -154,10 +154,9 @@ static int opal_convert_process_name_to_string_should_never_be_called(char** nam
|
||||
return OPAL_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
static char* opal_convert_jobid_to_string_should_never_be_called(opal_jobid_t jobid)
|
||||
static int opal_snprintf_jobid_should_never_be_called(char* name_string, size_t size, opal_jobid_t jobid)
|
||||
{
|
||||
char *str = strdup("My JOBID");
|
||||
return str;
|
||||
return strncpy(name_string, "My JOBID", size);
|
||||
}
|
||||
|
||||
static int opal_convert_string_to_jobid_should_never_be_called(opal_jobid_t *jobid, const char *jobid_string)
|
||||
@ -175,7 +174,7 @@ char* (*opal_vpid_print)(const opal_vpid_t) = opal_vpid_print_should_never_be_ca
|
||||
char* (*opal_jobid_print)(const opal_jobid_t) = opal_jobid_print_should_never_be_called;
|
||||
int (*opal_convert_string_to_process_name)(opal_process_name_t *name, const char* name_string) = opal_convert_string_to_process_name_should_never_be_called;
|
||||
int (*opal_convert_process_name_to_string)(char** name_string, const opal_process_name_t *name) = opal_convert_process_name_to_string_should_never_be_called;
|
||||
char* (*opal_convert_jobid_to_string)(opal_jobid_t jobid) = opal_convert_jobid_to_string_should_never_be_called;
|
||||
int (*opal_snprintf_jobid)(char* name_string, size_t size, opal_jobid_t jobid) = opal_snprintf_jobid_should_never_be_called;
|
||||
int (*opal_convert_string_to_jobid)(opal_jobid_t *jobid, const char *jobid_string) = opal_convert_string_to_jobid_should_never_be_called;
|
||||
struct opal_proc_t *(*opal_proc_for_name) (const opal_process_name_t name) = opal_proc_for_name_should_never_be_called;
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* reserved.
|
||||
* Copyright (c) 2013 Inria. All rights reserved.
|
||||
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -133,7 +133,7 @@ OPAL_DECLSPEC extern int (*opal_convert_process_name_to_string)(char** name_stri
|
||||
const opal_process_name_t *name);
|
||||
OPAL_DECLSPEC extern char* (*opal_vpid_print)(const opal_vpid_t);
|
||||
OPAL_DECLSPEC extern char* (*opal_jobid_print)(const opal_jobid_t);
|
||||
OPAL_DECLSPEC extern char* (*opal_convert_jobid_to_string)(opal_jobid_t jobid);
|
||||
OPAL_DECLSPEC extern int (*opal_snprintf_jobid)(char* name_string, size_t size, opal_jobid_t jobid);
|
||||
OPAL_DECLSPEC extern int (*opal_convert_string_to_jobid)(opal_jobid_t *jobid, const char *jobid_string);
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,7 @@
|
||||
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014 Mellanox Technologies, Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -413,7 +413,7 @@ static void _cnct(int sd, short args, void *cbdata)
|
||||
}
|
||||
/* ask the global data server for the data - if we get it,
|
||||
* then we can complete the request */
|
||||
key = opal_convert_jobid_to_string(nm->name.jobid);
|
||||
orte_util_convert_jobid_to_string(&key, nm->name.jobid);
|
||||
opal_argv_append_nosize(&keys, key);
|
||||
free(key);
|
||||
if (ORTE_SUCCESS != (rc = pmix_server_lookup_fn(&nm->name, keys, cd->info, _cnlk, cd))) {
|
||||
|
@ -14,7 +14,7 @@
|
||||
* Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
|
||||
* Copyright (c) 2007-2008 Sun Microsystems, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
|
||||
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
*
|
||||
* $COPYRIGHT$
|
||||
@ -97,14 +97,6 @@ static int _convert_process_name_to_string(char** name_string,
|
||||
return orte_util_convert_process_name_to_string(name_string, name);
|
||||
}
|
||||
|
||||
static char*
|
||||
_convert_jobid_to_string(opal_jobid_t jobid)
|
||||
{
|
||||
char *str;
|
||||
orte_util_convert_jobid_to_string(&str, jobid);
|
||||
return str;
|
||||
}
|
||||
|
||||
static int
|
||||
_convert_string_to_jobid(opal_jobid_t *jobid, const char *jobid_string)
|
||||
{
|
||||
@ -156,7 +148,7 @@ int orte_init(int* pargc, char*** pargv, orte_proc_type_t flags)
|
||||
opal_compare_proc = _process_name_compare;
|
||||
opal_convert_string_to_process_name = _convert_string_to_process_name;
|
||||
opal_convert_process_name_to_string = _convert_process_name_to_string;
|
||||
opal_convert_jobid_to_string = _convert_jobid_to_string;
|
||||
opal_snprintf_jobid = orte_util_snprintf_jobid;
|
||||
opal_convert_string_to_jobid = _convert_string_to_jobid;
|
||||
|
||||
/* initialize the opal layer */
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014-2014 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -284,19 +284,39 @@ char* orte_util_print_vpids(const orte_vpid_t vpid)
|
||||
|
||||
|
||||
/*** STRING FUNCTIONS ***/
|
||||
int orte_util_convert_jobid_to_string(char **jobid_string, const orte_jobid_t jobid)
|
||||
|
||||
int orte_util_snprintf_jobid(char *jobid_string, size_t size, const orte_jobid_t jobid)
|
||||
{
|
||||
int rc;
|
||||
|
||||
/* check for wildcard value - handle appropriately */
|
||||
if (ORTE_JOBID_WILDCARD == jobid) {
|
||||
*jobid_string = strdup(ORTE_SCHEMA_WILDCARD_STRING);
|
||||
return ORTE_SUCCESS;
|
||||
return strncpy(jobid_string, ORTE_SCHEMA_WILDCARD_STRING, size);
|
||||
}
|
||||
|
||||
if (0 > asprintf(jobid_string, "%ld", (long) jobid)) {
|
||||
rc = snprintf(jobid_string, size, "%ld", (long) jobid);
|
||||
if (0 > rc) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int orte_util_convert_jobid_to_string(char **jobid_string, const orte_jobid_t jobid)
|
||||
{
|
||||
int rc;
|
||||
char str[256];
|
||||
rc = orte_util_snprintf_jobid(str, 255, jobid);
|
||||
if (0 > rc) {
|
||||
*jobid_string = NULL;
|
||||
return rc;
|
||||
}
|
||||
*jobid_string = strdup(str);
|
||||
if (NULL == *jobid_string) {
|
||||
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
||||
return ORTE_ERR_OUT_OF_RESOURCE;
|
||||
}
|
||||
return ORTE_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014 Research Organization for Information Science
|
||||
* Copyright (c) 2014-2016 Research Organization for Information Science
|
||||
* and Technology (RIST). All rights reserved.
|
||||
* $COPYRIGHT$
|
||||
*
|
||||
@ -114,6 +114,7 @@ typedef struct orte_namelist_t orte_namelist_t;
|
||||
|
||||
ORTE_DECLSPEC OBJ_CLASS_DECLARATION(orte_namelist_t);
|
||||
|
||||
ORTE_DECLSPEC int orte_util_snprintf_jobid(char *jobid_string, size_t size, const orte_jobid_t jobid);
|
||||
ORTE_DECLSPEC int orte_util_convert_jobid_to_string(char **jobid_string, const orte_jobid_t jobid);
|
||||
ORTE_DECLSPEC int orte_util_convert_string_to_jobid(orte_jobid_t *jobid, const char* jobidstring);
|
||||
ORTE_DECLSPEC int orte_util_convert_vpid_to_string(char **vpid_string, const orte_vpid_t vpid);
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user