1
1

Handle asprintf errors with opal_asprintf wrapper

The Open MPI code base assumed that asprintf always behaved like
the FreeBSD variant, where ptr is set to NULL on error.  However,
the C standard (and Linux) only guarantee that the return code will
be -1 on error and leave ptr undefined.  Rather than fix all the
usage in the code, we use opal_asprintf() wrapper instead, which
guarantees the BSD-like behavior of ptr always being set to NULL.
In addition to being correct, this will fix many, many warnings
in the Open MPI code base.

Signed-off-by: Brian Barrett <bbarrett@amazon.com>
Этот коммит содержится в:
Brian Barrett 2018-10-06 16:58:16 -07:00
родитель c087365ead
Коммит e9e4d2a4bc
108 изменённых файлов: 698 добавлений и 483 удалений

Просмотреть файл

@ -12,6 +12,7 @@
* Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2009 Oak Ridge National Laboratory * Copyright (c) 2009 Oak Ridge National Laboratory
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -55,6 +56,7 @@
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/net.h" #include "opal/util/net.h"
#include "opal/util/opal_sos.h" #include "opal/util/opal_sos.h"
#include "opal/util/printf.h"
#include "orte/types.h" #include "orte/types.h"
#include "orte/util/show_help.h" #include "orte/util/show_help.h"
@ -225,7 +227,7 @@ int mca_btl_tcp2_component_open(void)
mca_btl_tcp2_component.tcp_port_min ); mca_btl_tcp2_component.tcp_port_min );
mca_btl_tcp2_component.tcp_port_min = 1024; mca_btl_tcp2_component.tcp_port_min = 1024;
} }
asprintf( &message, opal_asprintf( &message,
"The number of ports where the TCP BTL will try to bind (default %d)." "The number of ports where the TCP BTL will try to bind (default %d)."
" This parameter together with the port min, define a range of ports" " This parameter together with the port min, define a range of ports"
" where Open MPI will open sockets.", " where Open MPI will open sockets.",
@ -244,7 +246,7 @@ int mca_btl_tcp2_component_open(void)
mca_btl_tcp2_component.tcp6_port_min ); mca_btl_tcp2_component.tcp6_port_min );
mca_btl_tcp2_component.tcp6_port_min = 1024; mca_btl_tcp2_component.tcp6_port_min = 1024;
} }
asprintf( &message, opal_asprintf( &message,
"The number of ports where the TCP BTL will try to bind (default %d)." "The number of ports where the TCP BTL will try to bind (default %d)."
" This parameter together with the port min, define a range of ports" " This parameter together with the port min, define a range of ports"
" where Open MPI will open sockets.", " where Open MPI will open sockets.",

2
contrib/check_unnecessary_headers.sh Исполняемый файл → Обычный файл
Просмотреть файл

@ -122,7 +122,7 @@ SEARCH_HEADER[37]="opal/util/os_dirpath.h opal_os_dirpath_create opal_os_dirpath
SEARCH_HEADER[38]="opal/util/os_path.h opal_os_path opal_make_filename_os_friendly" SEARCH_HEADER[38]="opal/util/os_path.h opal_os_path opal_make_filename_os_friendly"
SEARCH_HEADER[39]="opal/util/output.h opal_output_stream_t opal_output_init opal_output_finalize opal_output_open opal_output_reopen opal_output_switch opal_output_reopen_all opal_output_close opal_output opal_output_verbose opal_output_vverbose opal_output_string opal_output_vstring opal_output_set_verbosity opal_output_get_verbosity opal_output_set_output_file_info OPAL_OUTPUT OPAL_OUTPUT_VERBOSE" SEARCH_HEADER[39]="opal/util/output.h opal_output_stream_t opal_output_init opal_output_finalize opal_output_open opal_output_reopen opal_output_switch opal_output_reopen_all opal_output_close opal_output opal_output_verbose opal_output_vverbose opal_output_string opal_output_vstring opal_output_set_verbosity opal_output_get_verbosity opal_output_set_output_file_info OPAL_OUTPUT OPAL_OUTPUT_VERBOSE"
SEARCH_HEADER[40]="opal/util/path.h opal_path_find opal_path_findv opal_path_is_absolute opal_find_absolute_path opal_path_access" SEARCH_HEADER[40]="opal/util/path.h opal_path_find opal_path_findv opal_path_is_absolute opal_find_absolute_path opal_path_access"
SEARCH_HEADER[41]="opal/util/printf.h snprintf vsnprintf asprintf vasprintf" SEARCH_HEADER[41]="opal/util/printf.h snprintf vsnprintf"
SEARCH_HEADER[42]="opal/util/show_help.h opal_show_help_init opal_show_help_finalize opal_show_help opal_show_vhelp opal_show_help_string opal_show_help_finish_parsing" SEARCH_HEADER[42]="opal/util/show_help.h opal_show_help_init opal_show_help_finalize opal_show_help opal_show_vhelp opal_show_help_string opal_show_help_finish_parsing"
SEARCH_HEADER[43]="opal/util/strncpy.h opal_strncpy" SEARCH_HEADER[43]="opal/util/strncpy.h opal_strncpy"
SEARCH_HEADER[44]="opal/util/sys_limits.h opal_sys_limits opal_util_init_sys_limits" SEARCH_HEADER[44]="opal/util/sys_limits.h opal_sys_limits opal_util_init_sys_limits"

Просмотреть файл

@ -11,6 +11,7 @@
#include "mpi.h" #include "mpi.h"
#include "opal/mca/pmix/pmix.h" #include "opal/mca/pmix/pmix.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/printf.h"
#include "orte/runtime/runtime.h" #include "orte/runtime/runtime.h"
#include "orte/util/proc_info.h" #include "orte/util/proc_info.h"
#include "orte/util/name_fns.h" #include "orte/util/name_fns.h"
@ -113,7 +114,7 @@ static void sample(void)
wait_for_release = true; wait_for_release = true;
/* log my own results as a single string so the output /* log my own results as a single string so the output
* doesn't get garbled on the other end */ * doesn't get garbled on the other end */
asprintf(&tmp, "Data for node %s", orte_process_info.nodename); opal_asprintf(&tmp, "Data for node %s", orte_process_info.nodename);
opal_argv_append_nosize(&answer, tmp); opal_argv_append_nosize(&answer, tmp);
free(tmp); free(tmp);
OPAL_LIST_FOREACH(kv, &response, opal_value_t) { OPAL_LIST_FOREACH(kv, &response, opal_value_t) {
@ -121,11 +122,11 @@ static void sample(void)
if (NULL != lt) { if (NULL != lt) {
OPAL_LIST_FOREACH(ival, lt, opal_value_t) { OPAL_LIST_FOREACH(ival, lt, opal_value_t) {
if (0 == strcmp(ival->key, OPAL_PMIX_DAEMON_MEMORY)) { if (0 == strcmp(ival->key, OPAL_PMIX_DAEMON_MEMORY)) {
asprintf(&tmp, "\tDaemon: %f", ival->data.fval); opal_asprintf(&tmp, "\tDaemon: %f", ival->data.fval);
opal_argv_append_nosize(&answer, tmp); opal_argv_append_nosize(&answer, tmp);
free(tmp); free(tmp);
} else if (0 == strcmp(ival->key, OPAL_PMIX_CLIENT_AVG_MEMORY)) { } else if (0 == strcmp(ival->key, OPAL_PMIX_CLIENT_AVG_MEMORY)) {
asprintf(&tmp, "\tClient: %f", ival->data.fval); opal_asprintf(&tmp, "\tClient: %f", ival->data.fval);
opal_argv_append_nosize(&answer, tmp); opal_argv_append_nosize(&answer, tmp);
free(tmp); free(tmp);
} else { } else {

Просмотреть файл

@ -22,6 +22,7 @@
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved.
* Copyright (c) 2017 Mellanox Technologies. All rights reserved. * Copyright (c) 2017 Mellanox Technologies. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -33,6 +34,7 @@
#include "opal/dss/dss.h" #include "opal/dss/dss.h"
#include "opal/mca/pmix/pmix.h" #include "opal/mca/pmix/pmix.h"
#include "opal/util/printf.h"
#include "ompi/proc/proc.h" #include "ompi/proc/proc.h"
#include "ompi/communicator/communicator.h" #include "ompi/communicator/communicator.h"
@ -900,7 +902,7 @@ static int ompi_comm_allreduce_pmix_reduce_complete (ompi_comm_request_t *reques
opal_dss.unload(&sbuf, (void**)&info.data.bo.bytes, &info.data.bo.size); opal_dss.unload(&sbuf, (void**)&info.data.bo.bytes, &info.data.bo.size);
OBJ_DESTRUCT(&sbuf); OBJ_DESTRUCT(&sbuf);
bytes_written = asprintf(&info.key, bytes_written = opal_asprintf(&info.key,
cid_context->send_first ? "%s:%s:send:%d" cid_context->send_first ? "%s:%s:send:%d"
: "%s:%s:recv:%d", : "%s:%s:recv:%d",
cid_context->port_string, cid_context->port_string,
@ -910,7 +912,7 @@ static int ompi_comm_allreduce_pmix_reduce_complete (ompi_comm_request_t *reques
if (bytes_written == -1) { if (bytes_written == -1) {
opal_output_verbose (verbosity_level, output_id, "writing info.key failed\n"); opal_output_verbose (verbosity_level, output_id, "writing info.key failed\n");
} else { } else {
bytes_written = asprintf(&pdat.value.key, bytes_written = opal_asprintf(&pdat.value.key,
cid_context->send_first ? "%s:%s:recv:%d" cid_context->send_first ? "%s:%s:recv:%d"
: "%s:%s:send:%d", : "%s:%s:send:%d",
cid_context->port_string, cid_context->port_string,

Просмотреть файл

@ -10,6 +10,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2010-2018 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -23,6 +24,7 @@
#include <string.h> #include <string.h>
#include "opal/class/opal_pointer_array.h" #include "opal/class/opal_pointer_array.h"
#include "opal/util/printf.h"
#include "ompi/datatype/ompi_datatype.h" #include "ompi/datatype/ompi_datatype.h"
#include "ompi/attribute/attribute.h" #include "ompi/attribute/attribute.h"
@ -110,7 +112,7 @@ ompi_datatype_duplicate( const ompi_datatype_t* oldType, ompi_datatype_t** newTy
new_ompi_datatype->args = NULL; new_ompi_datatype->args = NULL;
char *new_name; char *new_name;
asprintf(&new_name, "Dup %s", oldType->name); opal_asprintf(&new_name, "Dup %s", oldType->name);
strncpy(new_ompi_datatype->name, new_name, MPI_MAX_OBJECT_NAME - 1); strncpy(new_ompi_datatype->name, new_name, MPI_MAX_OBJECT_NAME - 1);
new_ompi_datatype->name[MPI_MAX_OBJECT_NAME - 1] = '\0'; new_ompi_datatype->name[MPI_MAX_OBJECT_NAME - 1] = '\0';
free(new_name); free(new_name);

Просмотреть файл

@ -1,5 +1,6 @@
/* /*
* Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009-2018 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -15,6 +16,7 @@
#include <unistd.h> #include <unistd.h>
#include "opal/runtime/opal.h" #include "opal/runtime/opal.h"
#include "opal/util/printf.h"
#include "opal/mca/dl/base/base.h" #include "opal/mca/dl/base/base.h"
#if !OPAL_HAVE_DL_SUPPORT #if !OPAL_HAVE_DL_SUPPORT
@ -119,7 +121,7 @@ static int do_test(void)
get here, manually prefix the filename with .libs/ and try get here, manually prefix the filename with .libs/ and try
again. */ again. */
char *rel_filename; char *rel_filename;
asprintf(&rel_filename, ".libs/%s", filename); opal_asprintf(&rel_filename, ".libs/%s", filename);
if (NULL == rel_filename) { if (NULL == rel_filename) {
return 1; return 1;
} }

Просмотреть файл

@ -13,6 +13,7 @@
* Copyright (c) 2007-2016 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007-2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -48,6 +49,7 @@
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/printf.h"
#include "opal/mca/installdirs/installdirs.h" #include "opal/mca/installdirs/installdirs.h"
#include "debuggers.h" #include "debuggers.h"
#include "ompi/mca/rte/rte.h" #include "ompi/mca/rte/rte.h"
@ -132,7 +134,7 @@ static void check(char *dir, char *file, char **locations)
{ {
char *str; char *str;
asprintf(&str, "%s/%s.so", dir, file); opal_asprintf(&str, "%s/%s.so", dir, file);
#if defined(HAVE_SYS_STAT_H) #if defined(HAVE_SYS_STAT_H)
{ {

Просмотреть файл

@ -18,6 +18,7 @@
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved. * Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2017 Research Organization for Information Science * Copyright (c) 2014-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -41,6 +42,7 @@
#include "opal/util/opal_getcwd.h" #include "opal/util/opal_getcwd.h"
#include "opal/util/proc.h" #include "opal/util/proc.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include "opal/dss/dss.h" #include "opal/dss/dss.h"
#include "opal/mca/hwloc/base/base.h" #include "opal/mca/hwloc/base/base.h"
#include "opal/mca/pmix/pmix.h" #include "opal/mca/pmix/pmix.h"
@ -153,7 +155,7 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root,
return OMPI_ERR_NOT_SUPPORTED; return OMPI_ERR_NOT_SUPPORTED;
} }
opal_argv_append_nosize(&members, nstring); opal_argv_append_nosize(&members, nstring);
(void)asprintf(&nstring, "%d", size); (void)opal_asprintf(&nstring, "%d", size);
opal_argv_append_nosize(&members, nstring); opal_argv_append_nosize(&members, nstring);
free(nstring); free(nstring);
} else { } else {
@ -208,11 +210,11 @@ int ompi_dpm_connect_accept(ompi_communicator_t *comm, int root,
OBJ_CONSTRUCT(&info, opal_value_t); OBJ_CONSTRUCT(&info, opal_value_t);
OBJ_CONSTRUCT(&pdat, opal_pmix_pdata_t); OBJ_CONSTRUCT(&pdat, opal_pmix_pdata_t);
if (send_first) { if (send_first) {
(void)asprintf(&info.key, "%s:connect", port_string); (void)opal_asprintf(&info.key, "%s:connect", port_string);
(void)asprintf(&pdat.value.key, "%s:accept", port_string); (void)opal_asprintf(&pdat.value.key, "%s:accept", port_string);
} else { } else {
(void)asprintf(&info.key, "%s:accept", port_string); (void)opal_asprintf(&info.key, "%s:accept", port_string);
(void)asprintf(&pdat.value.key, "%s:connect", port_string); (void)opal_asprintf(&pdat.value.key, "%s:connect", port_string);
} }
info.type = OPAL_STRING; info.type = OPAL_STRING;
info.data.string = opal_argv_join(members, ':'); info.data.string = opal_argv_join(members, ':');
@ -812,7 +814,7 @@ int ompi_dpm_spawn(int count, const char *array_of_commands[],
info = OBJ_NEW(opal_value_t); info = OBJ_NEW(opal_value_t);
info->key = strdup(OPAL_PMIX_PPR); info->key = strdup(OPAL_PMIX_PPR);
info->type = OPAL_STRING; info->type = OPAL_STRING;
(void)asprintf(&(info->data.string), "%s:n", slot_list); (void)opal_asprintf(&(info->data.string), "%s:n", slot_list);
opal_list_append(&job_info, &info->super); opal_list_append(&job_info, &info->super);
} }
ompi_info_get (array_of_info[i], "pernode", sizeof(slot_list) - 1, slot_list, &flag); ompi_info_get (array_of_info[i], "pernode", sizeof(slot_list) - 1, slot_list, &flag);

Просмотреть файл

@ -16,6 +16,7 @@
* Copyright (c) 2012 Los Alamos National Security, LLC. * Copyright (c) 2012 Los Alamos National Security, LLC.
* All rights reserved. * All rights reserved.
* Copyright (c) 2016 Intel, Inc. All rights reserved. * Copyright (c) 2016 Intel, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -194,7 +195,7 @@ static void backend_fatal_aggregate(char *type,
arg = va_arg(arglist, char*); arg = va_arg(arglist, char*);
va_end(arglist); va_end(arglist);
if (asprintf(&prefix, "[%s:%05d]", if (opal_asprintf(&prefix, "[%s:%05d]",
ompi_process_info.nodename, ompi_process_info.nodename,
(int) ompi_process_info.pid) == -1) { (int) ompi_process_info.pid) == -1) {
prefix = NULL; prefix = NULL;
@ -207,7 +208,7 @@ static void backend_fatal_aggregate(char *type,
if (NULL != error_code) { if (NULL != error_code) {
err_msg = ompi_mpi_errnum_get_string(*error_code); err_msg = ompi_mpi_errnum_get_string(*error_code);
if (NULL == err_msg) { if (NULL == err_msg) {
if (asprintf(&err_msg, unknown_error_code, if (opal_asprintf(&err_msg, unknown_error_code,
*error_code) == -1) { *error_code) == -1) {
err_msg = NULL; err_msg = NULL;
opal_output(0, "%s", "Could not write to err_msg"); opal_output(0, "%s", "Could not write to err_msg");
@ -333,7 +334,7 @@ static void backend_fatal_no_aggregate(char *type,
} }
if (NULL != name) { if (NULL != name) {
/* Don't use asprintf() here because there may be stack / /* Don't use opal_asprintf() here because there may be stack /
heap corruption by the time we're invoked, so just do heap corruption by the time we're invoked, so just do
it on the stack */ it on the stack */
str[0] = '\0'; str[0] = '\0';

Просмотреть файл

@ -5,6 +5,7 @@
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -27,9 +28,9 @@
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "opal/mca/installdirs/installdirs.h" #include "opal/mca/installdirs/installdirs.h"
#include "opal/util/printf.h"
#include "coll_fca.h" #include "coll_fca.h"
@ -1212,10 +1213,10 @@ static char *fca_check_file(char *file)
static char *fca_get_spec_file(void) static char *fca_get_spec_file(void)
{ {
char *file; char *file;
asprintf(&file, "%s/etc/fca_mpi_spec.ini", COLL_FCA_HOME); opal_asprintf(&file, "%s/etc/fca_mpi_spec.ini", COLL_FCA_HOME);
if (NULL == fca_check_file(file)) { if (NULL == fca_check_file(file)) {
free(file); free(file);
asprintf(&file, "%s/../fca/etc/fca_mpi_spec.ini", opal_install_dirs.prefix); opal_asprintf(&file, "%s/../fca/etc/fca_mpi_spec.ini", opal_install_dirs.prefix);
if (NULL == fca_check_file(file)) { if (NULL == fca_check_file(file)) {
free(file); free(file);
return NULL; return NULL;

Просмотреть файл

@ -14,6 +14,7 @@
* Copyright (c) 2011-2015 Los Alamos National Security, LLC. * Copyright (c) 2011-2015 Los Alamos National Security, LLC.
* All rights reserved. * All rights reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -30,6 +31,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include "ompi/constants.h" #include "ompi/constants.h"
#include "ompi/mca/coll/coll.h" #include "ompi/mca/coll/coll.h"
#include "coll_sm.h" #include "coll_sm.h"

Просмотреть файл

@ -16,6 +16,7 @@
* Copyright (c) 2014-2015 Research Organization for Information Science * Copyright (c) 2014-2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -51,6 +52,7 @@
#include "opal_stdint.h" #include "opal_stdint.h"
#include "opal/mca/hwloc/base/base.h" #include "opal/mca/hwloc/base/base.h"
#include "opal/util/os_path.h" #include "opal/util/os_path.h"
#include "opal/util/printf.h"
#include "ompi/communicator/communicator.h" #include "ompi/communicator/communicator.h"
#include "ompi/group/group.h" #include "ompi/group/group.h"
@ -518,7 +520,7 @@ static int bootstrap_comm(ompi_communicator_t *comm,
lowest_name = OMPI_CAST_RTE_NAME(&proc->super.proc_name); lowest_name = OMPI_CAST_RTE_NAME(&proc->super.proc_name);
} }
} }
asprintf(&shortpath, "coll-sm-cid-%d-name-%s.mmap", comm->c_contextid, opal_asprintf(&shortpath, "coll-sm-cid-%d-name-%s.mmap", comm->c_contextid,
OMPI_NAME_PRINT(lowest_name)); OMPI_NAME_PRINT(lowest_name));
if (NULL == shortpath) { if (NULL == shortpath) {
opal_output_verbose(10, ompi_coll_base_framework.framework_output, opal_output_verbose(10, ompi_coll_base_framework.framework_output,

Просмотреть файл

@ -9,6 +9,7 @@
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2017-2018 Los Alamos National Security, LLC. All rights * Copyright (c) 2017-2018 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -24,6 +25,7 @@
#include <opal/mca/base/mca_base_component_repository.h> #include <opal/mca/base/mca_base_component_repository.h>
#include <opal/class/opal_hash_table.h> #include <opal/class/opal_hash_table.h>
#include <opal/util/output.h> #include <opal/util/output.h>
#include "opal/util/printf.h"
#include <math.h> #include <math.h>
#if SIZEOF_LONG_LONG == SIZEOF_SIZE_T #if SIZEOF_LONG_LONG == SIZEOF_SIZE_T
@ -216,7 +218,7 @@ int mca_common_monitoring_init( void )
log10_2 = log10(2.); log10_2 = log10(2.);
/* Open the opal_output stream */ /* Open the opal_output stream */
gethostname(hostname, sizeof(hostname)); gethostname(hostname, sizeof(hostname));
asprintf(&mca_common_monitoring_output_stream_obj.lds_prefix, opal_asprintf(&mca_common_monitoring_output_stream_obj.lds_prefix,
"[%s:%06d] monitoring: ", hostname, getpid()); "[%s:%06d] monitoring: ", hostname, getpid());
mca_common_monitoring_output_stream_id = mca_common_monitoring_output_stream_id =
opal_output_open(&mca_common_monitoring_output_stream_obj); opal_output_open(&mca_common_monitoring_output_stream_obj);
@ -775,7 +777,7 @@ static int mca_common_monitoring_flush(int fd, char* filename)
OPAL_MONITORING_PRINT_ERR("Error while flushing: no filename provided"); OPAL_MONITORING_PRINT_ERR("Error while flushing: no filename provided");
return OMPI_ERROR; return OMPI_ERROR;
} else { } else {
asprintf(&tmpfn, "%s.%" PRId32 ".prof", filename, rank_world); opal_asprintf(&tmpfn, "%s.%" PRId32 ".prof", filename, rank_world);
pf = fopen(tmpfn, "w"); pf = fopen(tmpfn, "w");
free(tmpfn); free(tmpfn);
} }

Просмотреть файл

@ -9,6 +9,7 @@
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights * Copyright (c) 2012-2015 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -30,6 +31,7 @@
#include "opal/runtime/opal_cr.h" #include "opal/runtime/opal_cr.h"
#include "opal/mca/event/event.h" #include "opal/mca/event/event.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/printf.h"
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "ompi/mca/mca.h" #include "ompi/mca/mca.h"
@ -6283,7 +6285,7 @@ static void display_indv_timer_core(int idx, int proc, int msgs, bool direct) {
/* These timers do not mean anything in the aggregate, so only display /* These timers do not mean anything in the aggregate, so only display
* them when directly asked for */ * them when directly asked for */
if( direct && timing_enabled >= 2) { if( direct && timing_enabled >= 2) {
asprintf(&str, "Proc %2d, Msg %5d", proc, msgs); opal_asprintf(&str, "Proc %2d, Msg %5d", proc, msgs);
} else { } else {
return; return;
} }

Просмотреть файл

@ -3,6 +3,7 @@
* Copyright (c) 2017 Los Alamos National Security, LLC. All rights * Copyright (c) 2017 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* *
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -17,6 +18,7 @@
#include "ompi/mca/mtl/base/base.h" #include "ompi/mca/mtl/base/base.h"
#include "opal/datatype/opal_convertor.h" #include "opal/datatype/opal_convertor.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include <rdma/fabric.h> #include <rdma/fabric.h>
#include <rdma/fi_cm.h> #include <rdma/fi_cm.h>
@ -483,10 +485,10 @@ ompi_mtl_ofi_isend(struct mca_mtl_base_module_t *mtl,
if (OPAL_UNLIKELY(0 > ret)) { if (OPAL_UNLIKELY(0 > ret)) {
char *fi_api; char *fi_api;
if (ompi_mtl_ofi.fi_cq_data) { if (ompi_mtl_ofi.fi_cq_data) {
asprintf( &fi_api, "fi_tsendddata") ; opal_asprintf( &fi_api, "fi_tsendddata") ;
} }
else { else {
asprintf( &fi_api, "fi_send") ; opal_asprintf( &fi_api, "fi_send") ;
} }
opal_output_verbose(1, ompi_mtl_base_framework.framework_output, opal_output_verbose(1, ompi_mtl_base_framework.framework_output,
"%s:%d: %s failed: %s(%zd)", "%s:%d: %s failed: %s(%zd)",

Просмотреть файл

@ -5,6 +5,7 @@
* Copyright (c) 2014-2017 Cisco Systems, Inc. All rights reserved * Copyright (c) 2014-2017 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2015-2016 Los Alamos National Security, LLC. All rights * Copyright (c) 2015-2016 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -15,6 +16,7 @@
#include "mtl_ofi.h" #include "mtl_ofi.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
static int ompi_mtl_ofi_component_open(void); static int ompi_mtl_ofi_component_open(void);
static int ompi_mtl_ofi_component_query(mca_base_module_t **module, int *priority); static int ompi_mtl_ofi_component_query(mca_base_module_t **module, int *priority);
@ -143,7 +145,7 @@ ompi_mtl_ofi_component_register(void)
&prov_exclude); &prov_exclude);
ompi_mtl_ofi.ofi_progress_event_count = 100; ompi_mtl_ofi.ofi_progress_event_count = 100;
asprintf(&desc, "Max number of events to read each call to OFI progress (default: %d events will be read per OFI progress call)", ompi_mtl_ofi.ofi_progress_event_count); opal_asprintf(&desc, "Max number of events to read each call to OFI progress (default: %d events will be read per OFI progress call)", ompi_mtl_ofi.ofi_progress_event_count);
mca_base_component_var_register(&mca_mtl_ofi_component.super.mtl_version, mca_base_component_var_register(&mca_mtl_ofi_component.super.mtl_version,
"progress_event_cnt", "progress_event_cnt",
desc, desc,
@ -160,7 +162,7 @@ ompi_mtl_ofi_component_register(void)
} }
ofi_tag_mode = MTL_OFI_TAG_AUTO; ofi_tag_mode = MTL_OFI_TAG_AUTO;
asprintf(&desc, "Mode specifying how many bits to use for various MPI values in OFI/Libfabric" opal_asprintf(&desc, "Mode specifying how many bits to use for various MPI values in OFI/Libfabric"
" communications. Some Libfabric provider network types can support most of Open MPI" " communications. Some Libfabric provider network types can support most of Open MPI"
" needs; others can only supply a limited number of bits, which then must be split" " needs; others can only supply a limited number of bits, which then must be split"
" across the MPI communicator ID, MPI source rank, and MPI tag. Three different" " across the MPI communicator ID, MPI source rank, and MPI tag. Three different"

Просмотреть файл

@ -16,6 +16,7 @@
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved * Copyright (c) 2013-2017 Intel, Inc. All rights reserved
* Copyright (c) 2018 Research Organization for Information Science * Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -29,6 +30,7 @@
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/printf.h"
#include "ompi/proc/proc.h" #include "ompi/proc/proc.h"
#include "mtl_psm2.h" #include "mtl_psm2.h"
@ -147,19 +149,19 @@ static void ompi_mtl_psm2_set_shadow_env (struct ompi_mtl_psm2_shadow_variable *
switch (variable->variable_type) { switch (variable->variable_type) {
case MCA_BASE_VAR_TYPE_BOOL: case MCA_BASE_VAR_TYPE_BOOL:
ret = asprintf (&env_value, "%s=%d", variable->env_name, storage->boolval ? 1 : 0); ret = opal_asprintf (&env_value, "%s=%d", variable->env_name, storage->boolval ? 1 : 0);
break; break;
case MCA_BASE_VAR_TYPE_UNSIGNED_LONG: case MCA_BASE_VAR_TYPE_UNSIGNED_LONG:
if (0 == strcmp (variable->env_name, "PSM2_TRACEMASK")) { if (0 == strcmp (variable->env_name, "PSM2_TRACEMASK")) {
/* PSM2 documentation shows the tracemask as a hexidecimal number. to be consitent /* PSM2 documentation shows the tracemask as a hexidecimal number. to be consitent
* use hexidecimal here. */ * use hexidecimal here. */
ret = asprintf (&env_value, "%s=0x%lx", variable->env_name, storage->ulval); ret = opal_asprintf (&env_value, "%s=0x%lx", variable->env_name, storage->ulval);
} else { } else {
ret = asprintf (&env_value, "%s=%lu", variable->env_name, storage->ulval); ret = opal_asprintf (&env_value, "%s=%lu", variable->env_name, storage->ulval);
} }
break; break;
case MCA_BASE_VAR_TYPE_STRING: case MCA_BASE_VAR_TYPE_STRING:
ret = asprintf (&env_value, "%s=%s", variable->env_name, storage->stringval); ret = opal_asprintf (&env_value, "%s=%s", variable->env_name, storage->stringval);
break; break;
} }

Просмотреть файл

@ -13,6 +13,7 @@
* Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -30,6 +31,8 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "opal/util/printf.h"
#include "ompi/constants.h" #include "ompi/constants.h"
#include "ompi/op/op.h" #include "ompi/op/op.h"
#include "ompi/mca/op/op.h" #include "ompi/mca/op/op.h"
@ -132,7 +135,7 @@ static int example_component_register(void)
containing the major.minor.release version number from the containing the major.minor.release version number from the
libfoo support library (see configure.m4 for how we got these C libfoo support library (see configure.m4 for how we got these C
macros). */ macros). */
asprintf(&str, "%s.%s.%s", opal_asprintf(&str, "%s.%s.%s",
OP_EXAMPLE_LIBFOO_VERSION_MAJOR, OP_EXAMPLE_LIBFOO_VERSION_MAJOR,
OP_EXAMPLE_LIBFOO_VERSION_MINOR, OP_EXAMPLE_LIBFOO_VERSION_MINOR,
OP_EXAMPLE_LIBFOO_VERSION_RELEASE); OP_EXAMPLE_LIBFOO_VERSION_RELEASE);

Просмотреть файл

@ -9,6 +9,7 @@
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -18,6 +19,8 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "opal/util/printf.h"
#include "ompi/mca/osc/osc.h" #include "ompi/mca/osc/osc.h"
#include "ompi/mca/osc/base/base.h" #include "ompi/mca/osc/base/base.h"
#include "ompi/mca/osc/base/osc_base_obj_convert.h" #include "ompi/mca/osc/base/osc_base_obj_convert.h"
@ -435,7 +438,7 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit
"portals4 component creating window with id %d", "portals4 component creating window with id %d",
ompi_comm_get_cid(module->comm)); ompi_comm_get_cid(module->comm));
asprintf(&name, "portals4 window %d", ompi_comm_get_cid(module->comm)); opal_asprintf(&name, "portals4 window %d", ompi_comm_get_cid(module->comm));
ompi_win_set_name(win, name); ompi_win_set_name(win, name);
free(name); free(name);

Просмотреть файл

@ -17,6 +17,7 @@
* Copyright (c) 2015-2016 Research Organization for Information Science * Copyright (c) 2015-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -26,6 +27,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include <string.h> #include <string.h>
@ -411,7 +413,7 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit
/* fill in window information */ /* fill in window information */
*model = MPI_WIN_UNIFIED; *model = MPI_WIN_UNIFIED;
win->w_osc_module = (ompi_osc_base_module_t*) module; win->w_osc_module = (ompi_osc_base_module_t*) module;
asprintf(&name, "pt2pt window %d", ompi_comm_get_cid(module->comm)); opal_asprintf(&name, "pt2pt window %d", ompi_comm_get_cid(module->comm));
ompi_win_set_name(win, name); ompi_win_set_name(win, name);
free(name); free(name);

Просмотреть файл

@ -18,6 +18,7 @@
* Copyright (c) 2015-2017 Intel, Inc. All rights reserved. * Copyright (c) 2015-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2018 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -41,6 +42,7 @@
#include "opal/threads/mutex.h" #include "opal/threads/mutex.h"
#include "opal/util/arch.h" #include "opal/util/arch.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/printf.h"
#include "opal/align.h" #include "opal/align.h"
#if OPAL_CUDA_SUPPORT #if OPAL_CUDA_SUPPORT
#include "opal/datatype/opal_datatype_cuda.h" #include "opal/datatype/opal_datatype_cuda.h"
@ -181,7 +183,7 @@ static int ompi_osc_rdma_component_register (void)
mca_base_var_enum_t *new_enum; mca_base_var_enum_t *new_enum;
mca_osc_rdma_component.no_locks = false; mca_osc_rdma_component.no_locks = false;
asprintf(&description_str, "Enable optimizations available only if MPI_LOCK is " opal_asprintf(&description_str, "Enable optimizations available only if MPI_LOCK is "
"not used. Info key of same name overrides this value (default: %s)", "not used. Info key of same name overrides this value (default: %s)",
mca_osc_rdma_component.no_locks ? "true" : "false"); mca_osc_rdma_component.no_locks ? "true" : "false");
(void) mca_base_component_var_register(&mca_osc_rdma_component.super.osc_version, "no_locks", description_str, (void) mca_base_component_var_register(&mca_osc_rdma_component.super.osc_version, "no_locks", description_str,
@ -190,7 +192,7 @@ static int ompi_osc_rdma_component_register (void)
free(description_str); free(description_str);
mca_osc_rdma_component.acc_single_intrinsic = false; mca_osc_rdma_component.acc_single_intrinsic = false;
asprintf(&description_str, "Enable optimizations for MPI_Fetch_and_op, MPI_Accumulate, etc for codes " opal_asprintf(&description_str, "Enable optimizations for MPI_Fetch_and_op, MPI_Accumulate, etc for codes "
"that will not use anything more than a single predefined datatype (default: %s)", "that will not use anything more than a single predefined datatype (default: %s)",
mca_osc_rdma_component.acc_single_intrinsic ? "true" : "false"); mca_osc_rdma_component.acc_single_intrinsic ? "true" : "false");
(void) mca_base_component_var_register(&mca_osc_rdma_component.super.osc_version, "acc_single_intrinsic", (void) mca_base_component_var_register(&mca_osc_rdma_component.super.osc_version, "acc_single_intrinsic",
@ -199,7 +201,7 @@ static int ompi_osc_rdma_component_register (void)
free(description_str); free(description_str);
mca_osc_rdma_component.acc_use_amo = true; mca_osc_rdma_component.acc_use_amo = true;
asprintf(&description_str, "Enable the use of network atomic memory operations when using single " opal_asprintf(&description_str, "Enable the use of network atomic memory operations when using single "
"intrinsic optimizations. If not set network compare-and-swap will be " "intrinsic optimizations. If not set network compare-and-swap will be "
"used instread (default: %s)", mca_osc_rdma_component.acc_use_amo ? "true" : "false"); "used instread (default: %s)", mca_osc_rdma_component.acc_use_amo ? "true" : "false");
(void) mca_base_component_var_register(&mca_osc_rdma_component.super.osc_version, "acc_use_amo", description_str, (void) mca_base_component_var_register(&mca_osc_rdma_component.super.osc_version, "acc_use_amo", description_str,
@ -208,14 +210,14 @@ static int ompi_osc_rdma_component_register (void)
free(description_str); free(description_str);
mca_osc_rdma_component.buffer_size = 32768; mca_osc_rdma_component.buffer_size = 32768;
asprintf(&description_str, "Size of temporary buffers (default: %d)", mca_osc_rdma_component.buffer_size); opal_asprintf(&description_str, "Size of temporary buffers (default: %d)", mca_osc_rdma_component.buffer_size);
(void) mca_base_component_var_register (&mca_osc_rdma_component.super.osc_version, "buffer_size", description_str, (void) mca_base_component_var_register (&mca_osc_rdma_component.super.osc_version, "buffer_size", description_str,
MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0, OPAL_INFO_LVL_3, MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0, OPAL_INFO_LVL_3,
MCA_BASE_VAR_SCOPE_LOCAL, &mca_osc_rdma_component.buffer_size); MCA_BASE_VAR_SCOPE_LOCAL, &mca_osc_rdma_component.buffer_size);
free(description_str); free(description_str);
mca_osc_rdma_component.max_attach = 32; mca_osc_rdma_component.max_attach = 32;
asprintf(&description_str, "Maximum number of buffers that can be attached to a dynamic window. " opal_asprintf(&description_str, "Maximum number of buffers that can be attached to a dynamic window. "
"Keep in mind that each attached buffer will use a potentially limited " "Keep in mind that each attached buffer will use a potentially limited "
"resource (default: %d)", mca_osc_rdma_component.max_attach); "resource (default: %d)", mca_osc_rdma_component.max_attach);
(void) mca_base_component_var_register (&mca_osc_rdma_component.super.osc_version, "max_attach", description_str, (void) mca_base_component_var_register (&mca_osc_rdma_component.super.osc_version, "max_attach", description_str,
@ -224,7 +226,7 @@ static int ompi_osc_rdma_component_register (void)
free(description_str); free(description_str);
mca_osc_rdma_component.priority = 101; mca_osc_rdma_component.priority = 101;
asprintf(&description_str, "Priority of the osc/rdma component (default: %d)", opal_asprintf(&description_str, "Priority of the osc/rdma component (default: %d)",
mca_osc_rdma_component.priority); mca_osc_rdma_component.priority);
(void) mca_base_component_var_register (&mca_osc_rdma_component.super.osc_version, "priority", description_str, (void) mca_base_component_var_register (&mca_osc_rdma_component.super.osc_version, "priority", description_str,
MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0, OPAL_INFO_LVL_3, MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0, OPAL_INFO_LVL_3,
@ -241,7 +243,7 @@ static int ompi_osc_rdma_component_register (void)
OBJ_RELEASE(new_enum); OBJ_RELEASE(new_enum);
ompi_osc_rdma_btl_names = "openib,ugni,uct,ucp"; ompi_osc_rdma_btl_names = "openib,ugni,uct,ucp";
asprintf(&description_str, "Comma-delimited list of BTL component names to allow without verifying " opal_asprintf(&description_str, "Comma-delimited list of BTL component names to allow without verifying "
"connectivity. Do not add a BTL to to this list unless it can reach all " "connectivity. Do not add a BTL to to this list unless it can reach all "
"processes in any communicator used with an MPI window (default: %s)", "processes in any communicator used with an MPI window (default: %s)",
ompi_osc_rdma_btl_names); ompi_osc_rdma_btl_names);
@ -251,7 +253,7 @@ static int ompi_osc_rdma_component_register (void)
free(description_str); free(description_str);
ompi_osc_rdma_mtl_names = "psm2"; ompi_osc_rdma_mtl_names = "psm2";
asprintf(&description_str, "Comma-delimited list of MTL component names to lower the priority of rdma " opal_asprintf(&description_str, "Comma-delimited list of MTL component names to lower the priority of rdma "
"osc component favoring pt2pt osc (default: %s)", ompi_osc_rdma_mtl_names); "osc component favoring pt2pt osc (default: %s)", ompi_osc_rdma_mtl_names);
(void) mca_base_component_var_register (&mca_osc_rdma_component.super.osc_version, "mtls", description_str, (void) mca_base_component_var_register (&mca_osc_rdma_component.super.osc_version, "mtls", description_str,
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, OPAL_INFO_LVL_3, MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0, OPAL_INFO_LVL_3,
@ -585,7 +587,7 @@ static int allocate_state_shared (ompi_osc_rdma_module_t *module, void **base, s
} }
/* allocate the shared memory segment */ /* allocate the shared memory segment */
ret = asprintf (&data_file, "%s" OPAL_PATH_SEP "osc_rdma.%s.%x.%d", ret = opal_asprintf (&data_file, "%s" OPAL_PATH_SEP "osc_rdma.%s.%x.%d",
mca_osc_rdma_component.backing_directory, ompi_process_info.nodename, mca_osc_rdma_component.backing_directory, ompi_process_info.nodename,
OMPI_PROC_MY_NAME->jobid, ompi_comm_get_cid(module->comm)); OMPI_PROC_MY_NAME->jobid, ompi_comm_get_cid(module->comm));
if (0 > ret) { if (0 > ret) {
@ -1269,7 +1271,7 @@ static int ompi_osc_rdma_component_select (struct ompi_win_t *win, void **base,
/* fill in window information */ /* fill in window information */
*model = MPI_WIN_UNIFIED; *model = MPI_WIN_UNIFIED;
win->w_osc_module = (ompi_osc_base_module_t*) module; win->w_osc_module = (ompi_osc_base_module_t*) module;
asprintf(&name, "rdma window %d", ompi_comm_get_cid(module->comm)); opal_asprintf(&name, "rdma window %d", ompi_comm_get_cid(module->comm));
ompi_win_set_name(win, name); ompi_win_set_name(win, name);
free(name); free(name);

Просмотреть файл

@ -11,6 +11,7 @@
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved. * Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -27,6 +28,7 @@
#include "opal/util/sys_limits.h" #include "opal/util/sys_limits.h"
#include "opal/include/opal/align.h" #include "opal/include/opal/align.h"
#include "opal/util/info_subscriber.h" #include "opal/util/info_subscriber.h"
#include "opal/util/printf.h"
#include "osc_sm.h" #include "osc_sm.h"
@ -282,7 +284,7 @@ component_select(struct ompi_win_t *win, void **base, size_t size, int disp_unit
posts_size += OPAL_ALIGN_PAD_AMOUNT(posts_size, 64); posts_size += OPAL_ALIGN_PAD_AMOUNT(posts_size, 64);
if (0 == ompi_comm_rank (module->comm)) { if (0 == ompi_comm_rank (module->comm)) {
char *data_file; char *data_file;
ret = asprintf (&data_file, "%s" OPAL_PATH_SEP "osc_sm.%s.%x.%d.%d", ret = opal_asprintf (&data_file, "%s" OPAL_PATH_SEP "osc_sm.%s.%x.%d.%d",
mca_osc_sm_component.backing_directory, ompi_process_info.nodename, mca_osc_sm_component.backing_directory, ompi_process_info.nodename,
OMPI_PROC_MY_NAME->jobid, (int) OMPI_PROC_MY_NAME->vpid, ompi_comm_get_cid(module->comm)); OMPI_PROC_MY_NAME->jobid, (int) OMPI_PROC_MY_NAME->vpid, ompi_comm_get_cid(module->comm));
if (ret < 0) { if (ret < 0) {

Просмотреть файл

@ -1,5 +1,6 @@
/* /*
* Copyright (C) Mellanox Technologies Ltd. 2001-2017. ALL RIGHTS RESERVED. * Copyright (C) Mellanox Technologies Ltd. 2001-2017. ALL RIGHTS RESERVED.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -9,6 +10,8 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "opal/util/printf.h"
#include "ompi/mca/osc/osc.h" #include "ompi/mca/osc/osc.h"
#include "ompi/mca/osc/base/base.h" #include "ompi/mca/osc/base/base.h"
#include "ompi/mca/osc/base/osc_base_obj_convert.h" #include "ompi/mca/osc/base/osc_base_obj_convert.h"
@ -100,7 +103,7 @@ static int component_open(void) {
static int component_register(void) { static int component_register(void) {
char *description_str; char *description_str;
mca_osc_ucx_component.priority = 0; mca_osc_ucx_component.priority = 0;
asprintf(&description_str, "Priority of the osc/ucx component (default: %d)", opal_asprintf(&description_str, "Priority of the osc/ucx component (default: %d)",
mca_osc_ucx_component.priority); mca_osc_ucx_component.priority);
(void) mca_base_component_var_register(&mca_osc_ucx_component.super.osc_version, "priority", description_str, (void) mca_base_component_var_register(&mca_osc_ucx_component.super.osc_version, "priority", description_str,
MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0, OPAL_INFO_LVL_3, MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0, OPAL_INFO_LVL_3,
@ -378,7 +381,7 @@ static int component_select(struct ompi_win_t *win, void **base, size_t size, in
} }
*model = MPI_WIN_UNIFIED; *model = MPI_WIN_UNIFIED;
asprintf(&name, "ucx window %d", ompi_comm_get_cid(module->comm)); opal_asprintf(&name, "ucx window %d", ompi_comm_get_cid(module->comm));
ompi_win_set_name(win, name); ompi_win_set_name(win, name);
free(name); free(name);

Просмотреть файл

@ -8,6 +8,7 @@
* Copyright (c) 2016 Research Organization for Information Science * Copyright (c) 2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -19,6 +20,7 @@
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "opal/mca/base/mca_base_component_repository.h" #include "opal/mca/base/mca_base_component_repository.h"
#include "opal/util/printf.h"
#include "ompi/constants.h" #include "ompi/constants.h"
#include "ompi/mca/pml/base/base.h" #include "ompi/mca/pml/base/base.h"
#include "ompi/mca/vprotocol/vprotocol.h" #include "ompi/mca/vprotocol/vprotocol.h"
@ -141,7 +143,7 @@ static int mca_pml_v_component_close(void)
/* Mark that we have changed something */ /* Mark that we have changed something */
char *new_name; char *new_name;
asprintf(&new_name, "%s]v%s", opal_asprintf(&new_name, "%s]v%s",
mca_pml_v.host_pml_component.pmlm_version.mca_component_name, mca_pml_v.host_pml_component.pmlm_version.mca_component_name,
mca_vprotocol_component.pmlm_version.mca_component_name); mca_vprotocol_component.pmlm_version.mca_component_name);
size_t len = sizeof(mca_pml_base_selected_component.pmlm_version.mca_component_name); size_t len = sizeof(mca_pml_base_selected_component.pmlm_version.mca_component_name);

Просмотреть файл

@ -2,6 +2,7 @@
* Copyright (c) 2004-2007 The Trustees of the University of Tennessee. * Copyright (c) 2004-2007 The Trustees of the University of Tennessee.
* All rights reserved. * All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -10,8 +11,9 @@
*/ */
#include "ompi_config.h" #include "ompi_config.h"
#include "opal/util/output.h"
#include "opal/util/output.h"
#include "opal/util/printf.h"
#include "pml_v_output.h" #include "pml_v_output.h"
@ -42,7 +44,7 @@ int ompi_pml_v_output_open(char *output, int verbosity) {
} }
lds.lds_is_debugging = true; lds.lds_is_debugging = true;
gethostname(hostname, sizeof(hostname)); gethostname(hostname, sizeof(hostname));
asprintf(&lds.lds_prefix, "[%s:%05d] pml_v: ", hostname, getpid()); opal_asprintf(&lds.lds_prefix, "[%s:%05d] pml_v: ", hostname, getpid());
lds.lds_verbose_level = verbosity; lds.lds_verbose_level = verbosity;
mca_pml_v.output = opal_output_open(&lds); mca_pml_v.output = opal_output_open(&lds);
free(lds.lds_prefix); free(lds.lds_prefix);

Просмотреть файл

@ -2,6 +2,7 @@
* Copyright (c) 2004-2007 The Trustees of the University of Tennessee. * Copyright (c) 2004-2007 The Trustees of the University of Tennessee.
* All rights reserved. * All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -13,6 +14,7 @@
#define PML_V_OUTPUT_H_HAS_BEEN_INCLUDED #define PML_V_OUTPUT_H_HAS_BEEN_INCLUDED
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/printf.h"
#include "opal_stdint.h" #include "opal_stdint.h"
#include <stdio.h> #include <stdio.h>
#include "pml_v.h" #include "pml_v.h"
@ -29,7 +31,7 @@ static inline void V_OUTPUT_ERR(const char *fmt, ... )
char *str; char *str;
int ret; int ret;
va_start(list, fmt); va_start(list, fmt);
ret = vasprintf(&str, fmt, list); ret = opal_vasprintf(&str, fmt, list);
assert(-1 != ret); assert(-1 != ret);
(void)ret; // silence compiler warning (void)ret; // silence compiler warning
opal_output(0, "%s", str); opal_output(0, "%s", str);
@ -60,7 +62,7 @@ static inline void V_OUTPUT(const char* fmt, ... )
char *str; char *str;
int ret; int ret;
va_start(list, fmt); va_start(list, fmt);
ret = vasprintf(&str, fmt, list); ret = opal_vasprintf(&str, fmt, list);
assert(-1 != ret); assert(-1 != ret);
opal_output(mca_pml_v.output, "%s", str); opal_output(mca_pml_v.output, "%s", str);
free(str); free(str);
@ -72,7 +74,7 @@ static inline void V_OUTPUT_VERBOSE(int V, const char* fmt, ... ) {
char *str; char *str;
int ret; int ret;
va_start(list, fmt); va_start(list, fmt);
ret = vasprintf(&str, fmt, list); ret = opal_vasprintf(&str, fmt, list);
assert(-1 != ret); assert(-1 != ret);
opal_output_verbose(V, mca_pml_v.output, "%s", str); opal_output_verbose(V, mca_pml_v.output, "%s", str);
free(str); free(str);

Просмотреть файл

@ -6,6 +6,7 @@
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
*/ */
#include "ompi_config.h" #include "ompi_config.h"
@ -19,6 +20,7 @@
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/proc.h" #include "opal/util/proc.h"
#include "opal/util/opal_getcwd.h" #include "opal/util/opal_getcwd.h"
#include "opal/util/printf.h"
#include "opal/mca/pmix/pmix.h" #include "opal/mca/pmix/pmix.h"
#include "opal/threads/threads.h" #include "opal/threads/threads.h"
#include "opal/class/opal_list.h" #include "opal/class/opal_list.h"
@ -61,7 +63,7 @@ void ompi_rte_abort(int error_code, char *fmt, ...)
va_start(arglist, fmt); va_start(arglist, fmt);
if( NULL != fmt ) { if( NULL != fmt ) {
char* buffer = NULL; char* buffer = NULL;
vasprintf( &buffer, fmt, arglist ); opal_vasprintf( &buffer, fmt, arglist );
opal_output( 0, "%s", buffer ); opal_output( 0, "%s", buffer );
free( buffer ); free( buffer );
} }

Просмотреть файл

@ -6,6 +6,7 @@
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
*/ */
#include "ompi_config.h" #include "ompi_config.h"
@ -375,22 +376,22 @@ int ompi_rte_convert_process_name_to_string(char** name_string,
* it is passed back to us later * it is passed back to us later
*/ */
if (pmix_name_wildcard.jobid == name->jobid) { if (pmix_name_wildcard.jobid == name->jobid) {
asprintf(&tmp, "%s", OPAL_SCHEMA_WILDCARD_STRING); opal_asprintf(&tmp, "%s", OPAL_SCHEMA_WILDCARD_STRING);
} else if (pmix_name_invalid.jobid == name->jobid) { } else if (pmix_name_invalid.jobid == name->jobid) {
asprintf(&tmp, "%s", OPAL_SCHEMA_INVALID_STRING); opal_asprintf(&tmp, "%s", OPAL_SCHEMA_INVALID_STRING);
} else { } else {
asprintf(&tmp, "%lu", (unsigned long)name->jobid); opal_asprintf(&tmp, "%lu", (unsigned long)name->jobid);
} }
if (pmix_name_wildcard.vpid == name->vpid) { if (pmix_name_wildcard.vpid == name->vpid) {
asprintf(&tmp2, "%s%c%s", tmp, OPAL_SCHEMA_DELIMITER_CHAR, OPAL_SCHEMA_WILDCARD_STRING); opal_asprintf(&tmp2, "%s%c%s", tmp, OPAL_SCHEMA_DELIMITER_CHAR, OPAL_SCHEMA_WILDCARD_STRING);
} else if (pmix_name_invalid.vpid == name->vpid) { } else if (pmix_name_invalid.vpid == name->vpid) {
asprintf(&tmp2, "%s%c%s", tmp, OPAL_SCHEMA_DELIMITER_CHAR, OPAL_SCHEMA_INVALID_STRING); opal_asprintf(&tmp2, "%s%c%s", tmp, OPAL_SCHEMA_DELIMITER_CHAR, OPAL_SCHEMA_INVALID_STRING);
} else { } else {
asprintf(&tmp2, "%s%c%lu", tmp, OPAL_SCHEMA_DELIMITER_CHAR, (unsigned long)name->vpid); opal_asprintf(&tmp2, "%s%c%lu", tmp, OPAL_SCHEMA_DELIMITER_CHAR, (unsigned long)name->vpid);
} }
asprintf(name_string, "%s", tmp2); opal_asprintf(name_string, "%s", tmp2);
free(tmp); free(tmp);
free(tmp2); free(tmp2);
@ -589,12 +590,12 @@ int ompi_rte_init(int *pargc, char ***pargv)
* MPI-3 required info key * MPI-3 required info key
*/ */
if (NULL == getenv(OPAL_MCA_PREFIX"opal_ess_num_procs")) { if (NULL == getenv(OPAL_MCA_PREFIX"opal_ess_num_procs")) {
asprintf(&ev1, OPAL_MCA_PREFIX"opal_ess_num_procs=%d", pmix_process_info.num_procs); opal_asprintf(&ev1, OPAL_MCA_PREFIX"opal_ess_num_procs=%d", pmix_process_info.num_procs);
putenv(ev1); putenv(ev1);
added_num_procs = true; added_num_procs = true;
} }
if (NULL == getenv("OMPI_APP_CTX_NUM_PROCS")) { if (NULL == getenv("OMPI_APP_CTX_NUM_PROCS")) {
asprintf(&ev2, "OMPI_APP_CTX_NUM_PROCS=%d", pmix_process_info.num_procs); opal_asprintf(&ev2, "OMPI_APP_CTX_NUM_PROCS=%d", pmix_process_info.num_procs);
putenv(ev2); putenv(ev2);
added_app_ctx = true; added_app_ctx = true;
} }
@ -632,7 +633,7 @@ int ompi_rte_init(int *pargc, char ***pargv)
opal_output_verbose(2, ompi_rte_base_framework.framework_output, opal_output_verbose(2, ompi_rte_base_framework.framework_output,
"%s transport key %s", "%s transport key %s",
OPAL_NAME_PRINT(pmix_process_info.my_name), string_key); OPAL_NAME_PRINT(pmix_process_info.my_name), string_key);
asprintf(&envar, OPAL_MCA_PREFIX"opal_precondition_transports=%s", string_key); opal_asprintf(&envar, OPAL_MCA_PREFIX"opal_precondition_transports=%s", string_key);
putenv(envar); putenv(envar);
added_transport_keys = true; added_transport_keys = true;
/* cannot free the envar as that messes up our environ */ /* cannot free the envar as that messes up our environ */
@ -816,7 +817,7 @@ void ompi_rte_abort(int error_code, char *fmt, ...)
/* If there was a message, output it */ /* If there was a message, output it */
va_start(arglist, fmt); va_start(arglist, fmt);
if( NULL != fmt ) { if( NULL != fmt ) {
vasprintf( &buffer, fmt, arglist ); opal_vasprintf( &buffer, fmt, arglist );
} }
va_end(arglist); va_end(arglist);
@ -964,7 +965,7 @@ static char* pre_condition_transports_print(uint64_t *unique_key)
* number if the system has a different sized long (8 would be for * number if the system has a different sized long (8 would be for
* sizeof(int) == 4)). * sizeof(int) == 4)).
*/ */
asprintf(&format, "%%0%dx", (int)(sizeof(unsigned int)) * 2); opal_asprintf(&format, "%%0%dx", (int)(sizeof(unsigned int)) * 2);
/* print the first number */ /* print the first number */
int_ptr = (unsigned int*) &unique_key[0]; int_ptr = (unsigned int*) &unique_key[0];
@ -1015,7 +1016,7 @@ static int _setup_job_session_dir(char **sdir)
if( NULL == (tmpdir = getenv("TMP")) ) if( NULL == (tmpdir = getenv("TMP")) )
tmpdir = "/tmp"; tmpdir = "/tmp";
if (0 > asprintf(&pmix_process_info.job_session_dir, if (0 > opal_asprintf(&pmix_process_info.job_session_dir,
"%s/ompi.%s.%lu/jf.0/%u", tmpdir, "%s/ompi.%s.%lu/jf.0/%u", tmpdir,
pmix_process_info.nodename, pmix_process_info.nodename,
(unsigned long)uid, (unsigned long)uid,

Просмотреть файл

@ -4,6 +4,7 @@
* Copyright (c) 2012 Los Alamos National Security, LLC. All rights * Copyright (c) 2012 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -14,6 +15,7 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "vprotocol_pessimist_eventlog.h" #include "vprotocol_pessimist_eventlog.h"
#include "opal/mca/pmix/pmix.h" #include "opal/mca/pmix/pmix.h"
#include "opal/util/printf.h"
#include "ompi/dpm/dpm.h" #include "ompi/dpm/dpm.h"
int vprotocol_pessimist_event_logger_connect(int el_rank, ompi_communicator_t **el_comm) int vprotocol_pessimist_event_logger_connect(int el_rank, ompi_communicator_t **el_comm)
@ -27,7 +29,7 @@ int vprotocol_pessimist_event_logger_connect(int el_rank, ompi_communicator_t **
OBJ_CONSTRUCT(&results, opal_list_t); OBJ_CONSTRUCT(&results, opal_list_t);
pdat = OBJ_NEW(opal_pmix_pdata_t); pdat = OBJ_NEW(opal_pmix_pdata_t);
asprintf(&pdat->value.key, VPROTOCOL_EVENT_LOGGER_NAME_FMT, el_rank); opal_asprintf(&pdat->value.key, VPROTOCOL_EVENT_LOGGER_NAME_FMT, el_rank);
opal_list_append(&results, &pdat->super); opal_list_append(&results, &pdat->super);
rc = opal_pmix.lookup(&results, NULL); rc = opal_pmix.lookup(&results, NULL);

Просмотреть файл

@ -1,6 +1,7 @@
/* /*
* Copyright (c) 2004-2014 The Trustees of the University of Tennessee. * Copyright (c) 2004-2014 The Trustees of the University of Tennessee.
* All rights reserved. * All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -20,6 +21,7 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include "opal/datatype/opal_datatype_memcpy.h" #include "opal/datatype/opal_datatype_memcpy.h"
#include "opal/util/printf.h"
#include <fcntl.h> #include <fcntl.h>
#define sb mca_vprotocol_pessimist.sender_based #define sb mca_vprotocol_pessimist.sender_based
@ -96,7 +98,7 @@ int vprotocol_pessimist_sender_based_init(const char *mmapfile, size_t size)
OBJ_CONSTRUCT(&sb.sb_sendreq, opal_list_t); OBJ_CONSTRUCT(&sb.sb_sendreq, opal_list_t);
#endif #endif
asprintf(&path, "%s"OPAL_PATH_SEP"%s", ompi_process_info.proc_session_dir, opal_asprintf(&path, "%s"OPAL_PATH_SEP"%s", ompi_process_info.proc_session_dir,
mmapfile); mmapfile);
if(OPAL_SUCCESS != sb_mmap_file_open(path)) if(OPAL_SUCCESS != sb_mmap_file_open(path))
return OPAL_ERR_FILE_OPEN_FAILURE; return OPAL_ERR_FILE_OPEN_FAILURE;

Просмотреть файл

@ -17,6 +17,7 @@
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -26,6 +27,8 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "opal/util/printf.h"
#include "ompi/mpi/c/bindings.h" #include "ompi/mpi/c/bindings.h"
#include "ompi/runtime/params.h" #include "ompi/runtime/params.h"
#include "ompi/communicator/communicator.h" #include "ompi/communicator/communicator.h"
@ -108,7 +111,7 @@ int MPI_Type_create_f90_complex(int p, int r, MPI_Datatype *newtype)
datatype->super.flags |= OMPI_DATATYPE_FLAG_PREDEFINED; datatype->super.flags |= OMPI_DATATYPE_FLAG_PREDEFINED;
/* Mark the datatype as a special F90 convenience type */ /* Mark the datatype as a special F90 convenience type */
char *new_name; char *new_name;
asprintf(&new_name, "COMBINER %s", (*newtype)->name); opal_asprintf(&new_name, "COMBINER %s", (*newtype)->name);
size_t max_len = MPI_MAX_OBJECT_NAME; size_t max_len = MPI_MAX_OBJECT_NAME;
strncpy(datatype->name, new_name, max_len - 1); strncpy(datatype->name, new_name, max_len - 1);
datatype->name[max_len - 1] = '\0'; datatype->name[max_len - 1] = '\0';

Просмотреть файл

@ -16,6 +16,7 @@
* reserved. * reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -25,6 +26,8 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "opal/util/printf.h"
#include "ompi/mpi/c/bindings.h" #include "ompi/mpi/c/bindings.h"
#include "ompi/runtime/params.h" #include "ompi/runtime/params.h"
#include "ompi/communicator/communicator.h" #include "ompi/communicator/communicator.h"
@ -104,7 +107,7 @@ int MPI_Type_create_f90_integer(int r, MPI_Datatype *newtype)
datatype->super.flags |= OMPI_DATATYPE_FLAG_PREDEFINED; datatype->super.flags |= OMPI_DATATYPE_FLAG_PREDEFINED;
/* Mark the datatype as a special F90 convenience type */ /* Mark the datatype as a special F90 convenience type */
char *new_name; char *new_name;
asprintf(&new_name, "COMBINER %s", (*newtype)->name); opal_asprintf(&new_name, "COMBINER %s", (*newtype)->name);
size_t max_len = MPI_MAX_OBJECT_NAME; size_t max_len = MPI_MAX_OBJECT_NAME;
strncpy(datatype->name, new_name, max_len - 1); strncpy(datatype->name, new_name, max_len - 1);
datatype->name[max_len - 1] = '\0'; datatype->name[max_len - 1] = '\0';

Просмотреть файл

@ -17,6 +17,7 @@
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -26,6 +27,8 @@
#include "ompi_config.h" #include "ompi_config.h"
#include "opal/util/printf.h"
#include "ompi/mpi/c/bindings.h" #include "ompi/mpi/c/bindings.h"
#include "ompi/runtime/params.h" #include "ompi/runtime/params.h"
#include "ompi/communicator/communicator.h" #include "ompi/communicator/communicator.h"
@ -108,7 +111,7 @@ int MPI_Type_create_f90_real(int p, int r, MPI_Datatype *newtype)
datatype->super.flags |= OMPI_DATATYPE_FLAG_PREDEFINED; datatype->super.flags |= OMPI_DATATYPE_FLAG_PREDEFINED;
/* Mark the datatype as a special F90 convenience type */ /* Mark the datatype as a special F90 convenience type */
char *new_name; char *new_name;
asprintf(&new_name, "COMBINER %s", (*newtype)->name); opal_asprintf(&new_name, "COMBINER %s", (*newtype)->name);
size_t max_len = MPI_MAX_OBJECT_NAME; size_t max_len = MPI_MAX_OBJECT_NAME;
strncpy(datatype->name, new_name, max_len - 1); strncpy(datatype->name, new_name, max_len - 1);
datatype->name[max_len - 1] = '\0'; datatype->name[max_len - 1] = '\0';

Просмотреть файл

@ -15,6 +15,7 @@
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -37,6 +38,7 @@
#include "mpi.h" #include "mpi.h"
#include "opal/class/opal_object.h" #include "opal/class/opal_object.h"
#include "opal/util/printf.h"
#include "ompi/datatype/ompi_datatype.h" #include "ompi/datatype/ompi_datatype.h"
#include "ompi/mpi/fortran/base/fint_2_int.h" #include "ompi/mpi/fortran/base/fint_2_int.h"
@ -483,7 +485,7 @@ static inline bool ompi_op_is_valid(ompi_op_t * op, ompi_datatype_t * ddt,
/* Intrinsic ddt on intrinsic op */ /* Intrinsic ddt on intrinsic op */
if (-1 == ompi_op_ddt_map[ddt->id] || if (-1 == ompi_op_ddt_map[ddt->id] ||
NULL == op->o_func.intrinsic.fns[ompi_op_ddt_map[ddt->id]]) { NULL == op->o_func.intrinsic.fns[ompi_op_ddt_map[ddt->id]]) {
(void) asprintf(msg, (void) opal_asprintf(msg,
"%s: the reduction operation %s is not defined on the %s datatype", "%s: the reduction operation %s is not defined on the %s datatype",
func, op->o_name, ddt->name); func, op->o_name, ddt->name);
return false; return false;
@ -491,11 +493,11 @@ static inline bool ompi_op_is_valid(ompi_op_t * op, ompi_datatype_t * ddt,
} else { } else {
/* Non-intrinsic ddt on intrinsic op */ /* Non-intrinsic ddt on intrinsic op */
if ('\0' != ddt->name[0]) { if ('\0' != ddt->name[0]) {
(void) asprintf(msg, (void) opal_asprintf(msg,
"%s: the reduction operation %s is not defined for non-intrinsic datatypes (attempted with datatype named \"%s\")", "%s: the reduction operation %s is not defined for non-intrinsic datatypes (attempted with datatype named \"%s\")",
func, op->o_name, ddt->name); func, op->o_name, ddt->name);
} else { } else {
(void) asprintf(msg, (void) opal_asprintf(msg,
"%s: the reduction operation %s is not defined for non-intrinsic datatypes", "%s: the reduction operation %s is not defined for non-intrinsic datatypes",
func, op->o_name); func, op->o_name);
} }

Просмотреть файл

@ -12,6 +12,7 @@
* All rights reserved. * All rights reserved.
* Copyright (c) 2012 The University of Wisconsin-La Crosse. All rights * Copyright (c) 2012 The University of Wisconsin-La Crosse. All rights
* reserved. * reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -43,6 +44,7 @@
#include "opal/mca/event/event.h" #include "opal/mca/event/event.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/printf.h"
#include "opal/mca/crs/crs.h" #include "opal/mca/crs/crs.h"
#include "opal/mca/crs/base/base.h" #include "opal/mca/crs/base/base.h"
#include "opal/mca/installdirs/installdirs.h" #include "opal/mca/installdirs/installdirs.h"
@ -193,14 +195,14 @@ int ompi_cr_init(void)
/* Set the checkpoint and restart commands */ /* Set the checkpoint and restart commands */
/* Add the full path to the binary */ /* Add the full path to the binary */
asprintf(&MPIR_checkpoint_command, opal_asprintf(&MPIR_checkpoint_command,
"%s/ompi-checkpoint --crdebug --hnp-jobid %u", "%s/ompi-checkpoint --crdebug --hnp-jobid %u",
opal_install_dirs.bindir, opal_install_dirs.bindir,
ORTE_PROC_MY_HNP->jobid); ORTE_PROC_MY_HNP->jobid);
asprintf(&MPIR_restart_command, opal_asprintf(&MPIR_restart_command,
"%s/ompi-restart --crdebug ", "%s/ompi-restart --crdebug ",
opal_install_dirs.bindir); opal_install_dirs.bindir);
asprintf(&MPIR_checkpoint_listing_command, opal_asprintf(&MPIR_checkpoint_listing_command,
"%s/ompi-checkpoint -l --crdebug ", "%s/ompi-checkpoint -l --crdebug ",
opal_install_dirs.bindir); opal_install_dirs.bindir);

Просмотреть файл

@ -14,6 +14,7 @@
* Copyright (c) 2011-2012 University of Houston. All rights reserved. * Copyright (c) 2011-2012 University of Houston. All rights reserved.
* Copyright (c) 2010-2015 Los Alamos National Security, LLC. * Copyright (c) 2010-2015 Los Alamos National Security, LLC.
* All rights reserved. * All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -37,6 +38,7 @@
#endif #endif
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
const char *ompi_info_type_ompi = "ompi"; const char *ompi_info_type_ompi = "ompi";
const char *ompi_info_type_base = "base"; const char *ompi_info_type_base = "base";
@ -120,7 +122,7 @@ void ompi_info_show_ompi_version(const char *scope)
{ {
char *tmp, *tmp2; char *tmp, *tmp2;
(void)asprintf(&tmp, "%s:version:full", ompi_info_type_ompi); (void)opal_asprintf(&tmp, "%s:version:full", ompi_info_type_ompi);
tmp2 = opal_info_make_version_str(scope, tmp2 = opal_info_make_version_str(scope,
OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION, OMPI_MAJOR_VERSION, OMPI_MINOR_VERSION,
OMPI_RELEASE_VERSION, OMPI_RELEASE_VERSION,
@ -129,10 +131,10 @@ void ompi_info_show_ompi_version(const char *scope)
opal_info_out("Open MPI", tmp, tmp2); opal_info_out("Open MPI", tmp, tmp2);
free(tmp); free(tmp);
free(tmp2); free(tmp2);
(void)asprintf(&tmp, "%s:version:repo", ompi_info_type_ompi); (void)opal_asprintf(&tmp, "%s:version:repo", ompi_info_type_ompi);
opal_info_out("Open MPI repo revision", tmp, OMPI_REPO_REV); opal_info_out("Open MPI repo revision", tmp, OMPI_REPO_REV);
free(tmp); free(tmp);
(void)asprintf(&tmp, "%s:version:release_date", ompi_info_type_ompi); (void)opal_asprintf(&tmp, "%s:version:release_date", ompi_info_type_ompi);
opal_info_out("Open MPI release date", tmp, OMPI_RELEASE_DATE); opal_info_out("Open MPI release date", tmp, OMPI_RELEASE_DATE);
free(tmp); free(tmp);

Просмотреть файл

@ -14,6 +14,7 @@
* Copyright (c) 2014-2017 Research Organization for Information Science * Copyright (c) 2014-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved * Copyright (c) 2015 Intel, Inc. All rights reserved
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -288,7 +289,7 @@ void ompi_info_do_config(bool want_all)
/* setup strings that require allocation */ /* setup strings that require allocation */
if (OMPI_BUILD_FORTRAN_BINDINGS >= OMPI_FORTRAN_MPIFH_BINDINGS) { if (OMPI_BUILD_FORTRAN_BINDINGS >= OMPI_FORTRAN_MPIFH_BINDINGS) {
(void)asprintf(&fortran_mpifh, "yes (%s)", (void)opal_asprintf(&fortran_mpifh, "yes (%s)",
(OPAL_HAVE_WEAK_SYMBOLS ? "all" : (OPAL_HAVE_WEAK_SYMBOLS ? "all" :
(OMPI_FORTRAN_CAPS ? "caps" : (OMPI_FORTRAN_CAPS ? "caps" :
(OMPI_FORTRAN_PLAIN ? "lower case" : (OMPI_FORTRAN_PLAIN ? "lower case" :
@ -302,24 +303,24 @@ void ompi_info_do_config(bool want_all)
didn't work consistently to put it in _STRINGIFY because didn't work consistently to put it in _STRINGIFY because
sometimes the compiler would actually interpret the pragma sometimes the compiler would actually interpret the pragma
in there before stringify-ing it. */ in there before stringify-ing it. */
(void)asprintf(&fortran_have_ignore_tkr, "yes (%s)", (void)opal_asprintf(&fortran_have_ignore_tkr, "yes (%s)",
OMPI_FORTRAN_IGNORE_TKR_PREDECL); OMPI_FORTRAN_IGNORE_TKR_PREDECL);
} else { } else {
fortran_have_ignore_tkr = strdup("no"); fortran_have_ignore_tkr = strdup("no");
} }
#if OMPI_RTE_ORTE #if OMPI_RTE_ORTE
(void)asprintf(&threads, "%s (MPI_THREAD_MULTIPLE: yes, OPAL support: yes, OMPI progress: %s, ORTE progress: yes, Event lib: yes)", (void)opal_asprintf(&threads, "%s (MPI_THREAD_MULTIPLE: yes, OPAL support: yes, OMPI progress: %s, ORTE progress: yes, Event lib: yes)",
"posix", OPAL_ENABLE_PROGRESS_THREADS ? "yes" : "no"); "posix", OPAL_ENABLE_PROGRESS_THREADS ? "yes" : "no");
#else #else
(void)asprintf(&threads, "%s (MPI_THREAD_MULTIPLE: yes, OPAL support: yes, OMPI progress: %s, Event lib: yes)", (void)opal_asprintf(&threads, "%s (MPI_THREAD_MULTIPLE: yes, OPAL support: yes, OMPI progress: %s, Event lib: yes)",
"posix", OPAL_ENABLE_PROGRESS_THREADS ? "yes" : "no"); "posix", OPAL_ENABLE_PROGRESS_THREADS ? "yes" : "no");
#endif #endif
(void)asprintf(&ft_support, "%s (checkpoint thread: %s)", (void)opal_asprintf(&ft_support, "%s (checkpoint thread: %s)",
OPAL_ENABLE_FT ? "yes" : "no", OPAL_ENABLE_FT_THREAD ? "yes" : "no"); OPAL_ENABLE_FT ? "yes" : "no", OPAL_ENABLE_FT_THREAD ? "yes" : "no");
(void)asprintf(&crdebug_support, "%s", (void)opal_asprintf(&crdebug_support, "%s",
OPAL_ENABLE_CRDEBUG ? "yes" : "no"); OPAL_ENABLE_CRDEBUG ? "yes" : "no");
/* output values */ /* output values */

Просмотреть файл

@ -13,6 +13,7 @@
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science * Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -25,6 +26,7 @@
#include "opal/types.h" #include "opal/types.h"
#include "opal/util/error.h" #include "opal/util/error.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/printf.h"
#include "opal/dss/dss_internal.h" #include "opal/dss/dss_internal.h"
int opal_dss_pack(opal_buffer_t *buffer, int opal_dss_pack(opal_buffer_t *buffer,
@ -339,7 +341,7 @@ int opal_dss_pack_float(opal_buffer_t *buffer, const void *src,
char *convert; char *convert;
for (i = 0; i < num_vals; ++i) { for (i = 0; i < num_vals; ++i) {
asprintf(&convert, "%f", ssrc[i]); opal_asprintf(&convert, "%f", ssrc[i]);
if (OPAL_SUCCESS != (ret = opal_dss_pack_string(buffer, &convert, 1, OPAL_STRING))) { if (OPAL_SUCCESS != (ret = opal_dss_pack_string(buffer, &convert, 1, OPAL_STRING))) {
free(convert); free(convert);
return ret; return ret;
@ -360,7 +362,7 @@ int opal_dss_pack_double(opal_buffer_t *buffer, const void *src,
char *convert; char *convert;
for (i = 0; i < num_vals; ++i) { for (i = 0; i < num_vals; ++i) {
asprintf(&convert, "%f", ssrc[i]); opal_asprintf(&convert, "%f", ssrc[i]);
if (OPAL_SUCCESS != (ret = opal_dss_pack_string(buffer, &convert, 1, OPAL_STRING))) { if (OPAL_SUCCESS != (ret = opal_dss_pack_string(buffer, &convert, 1, OPAL_STRING))) {
free(convert); free(convert);
return ret; return ret;

Просмотреть файл

@ -13,6 +13,7 @@
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
* Copyright (c) 2014 Research Organization for Information Science * Copyright (c) 2014 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -26,6 +27,7 @@
#include <stdio.h> #include <stdio.h>
#include "opal/util/error.h" #include "opal/util/error.h"
#include "opal/util/printf.h"
#include "opal/dss/dss_internal.h" #include "opal/dss/dss_internal.h"
int opal_dss_print(char **output, char *prefix, void *src, opal_data_type_t type) int opal_dss_print(char **output, char *prefix, void *src, opal_data_type_t type)
@ -54,19 +56,19 @@ int opal_dss_print_byte(char **output, char *prefix, uint8_t *src, opal_data_typ
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_BYTE\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_BYTE\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_BYTE\tValue: %x", prefix, *src); opal_asprintf(output, "%sData type: OPAL_BYTE\tValue: %x", prefix, *src);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -79,19 +81,19 @@ int opal_dss_print_string(char **output, char *prefix, char *src, opal_data_type
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_STRING\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_STRING\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_STRING\tValue: %s", prefx, src); opal_asprintf(output, "%sData type: OPAL_STRING\tValue: %s", prefx, src);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -104,19 +106,19 @@ int opal_dss_print_size(char **output, char *prefix, size_t *src, opal_data_type
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_SIZE\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_SIZE\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_SIZE\tValue: %lu", prefx, (unsigned long) *src); opal_asprintf(output, "%sData type: OPAL_SIZE\tValue: %lu", prefx, (unsigned long) *src);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -129,19 +131,19 @@ int opal_dss_print_pid(char **output, char *prefix, pid_t *src, opal_data_type_t
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_PID\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_PID\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_PID\tValue: %lu", prefx, (unsigned long) *src); opal_asprintf(output, "%sData type: OPAL_PID\tValue: %lu", prefx, (unsigned long) *src);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -153,19 +155,19 @@ int opal_dss_print_bool(char **output, char *prefix, bool *src, opal_data_type_t
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_BOOL\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_BOOL\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_BOOL\tValue: %s", prefx, *src ? "TRUE" : "FALSE"); opal_asprintf(output, "%sData type: OPAL_BOOL\tValue: %s", prefx, *src ? "TRUE" : "FALSE");
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -178,19 +180,19 @@ int opal_dss_print_int(char **output, char *prefix, int *src, opal_data_type_t t
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_INT\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_INT\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_INT\tValue: %ld", prefx, (long) *src); opal_asprintf(output, "%sData type: OPAL_INT\tValue: %ld", prefx, (long) *src);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -203,19 +205,19 @@ int opal_dss_print_uint(char **output, char *prefix, int *src, opal_data_type_t
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_UINT\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_UINT\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_UINT\tValue: %lu", prefx, (unsigned long) *src); opal_asprintf(output, "%sData type: OPAL_UINT\tValue: %lu", prefx, (unsigned long) *src);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -228,19 +230,19 @@ int opal_dss_print_uint8(char **output, char *prefix, uint8_t *src, opal_data_ty
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_UINT8\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_UINT8\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_UINT8\tValue: %u", prefx, (unsigned int) *src); opal_asprintf(output, "%sData type: OPAL_UINT8\tValue: %u", prefx, (unsigned int) *src);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -253,19 +255,19 @@ int opal_dss_print_uint16(char **output, char *prefix, uint16_t *src, opal_data_
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_UINT16\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_UINT16\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_UINT16\tValue: %u", prefx, (unsigned int) *src); opal_asprintf(output, "%sData type: OPAL_UINT16\tValue: %u", prefx, (unsigned int) *src);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -278,19 +280,19 @@ int opal_dss_print_uint32(char **output, char *prefix, uint32_t *src, opal_data_
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_UINT32\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_UINT32\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_UINT32\tValue: %u", prefx, (unsigned int) *src); opal_asprintf(output, "%sData type: OPAL_UINT32\tValue: %u", prefx, (unsigned int) *src);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -303,19 +305,19 @@ int opal_dss_print_int8(char **output, char *prefix, int8_t *src, opal_data_type
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_INT8\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_INT8\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_INT8\tValue: %d", prefx, (int) *src); opal_asprintf(output, "%sData type: OPAL_INT8\tValue: %d", prefx, (int) *src);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -328,19 +330,19 @@ int opal_dss_print_int16(char **output, char *prefix, int16_t *src, opal_data_ty
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_INT16\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_INT16\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_INT16\tValue: %d", prefx, (int) *src); opal_asprintf(output, "%sData type: OPAL_INT16\tValue: %d", prefx, (int) *src);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -353,19 +355,19 @@ int opal_dss_print_int32(char **output, char *prefix, int32_t *src, opal_data_ty
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_INT32\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_INT32\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_INT32\tValue: %d", prefx, (int) *src); opal_asprintf(output, "%sData type: OPAL_INT32\tValue: %d", prefx, (int) *src);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -383,12 +385,12 @@ int opal_dss_print_uint64(char **output, char *prefix,
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_UINT64\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_UINT64\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -396,9 +398,9 @@ int opal_dss_print_uint64(char **output, char *prefix,
} }
#ifdef HAVE_INT64_T #ifdef HAVE_INT64_T
asprintf(output, "%sData type: OPAL_UINT64\tValue: %lu", prefx, (unsigned long) *src); opal_asprintf(output, "%sData type: OPAL_UINT64\tValue: %lu", prefx, (unsigned long) *src);
#else #else
asprintf(output, "%sData type: OPAL_UINT64\tValue: unsupported", prefx); opal_asprintf(output, "%sData type: OPAL_UINT64\tValue: unsupported", prefx);
#endif /* HAVE_INT64_T */ #endif /* HAVE_INT64_T */
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
@ -418,12 +420,12 @@ int opal_dss_print_int64(char **output, char *prefix,
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_INT64\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_INT64\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -431,9 +433,9 @@ int opal_dss_print_int64(char **output, char *prefix,
} }
#ifdef HAVE_INT64_T #ifdef HAVE_INT64_T
asprintf(output, "%sData type: OPAL_INT64\tValue: %ld", prefx, (long) *src); opal_asprintf(output, "%sData type: OPAL_INT64\tValue: %ld", prefx, (long) *src);
#else #else
asprintf(output, "%sData type: OPAL_INT64\tValue: unsupported", prefx); opal_asprintf(output, "%sData type: OPAL_INT64\tValue: unsupported", prefx);
#endif /* HAVE_INT64_T */ #endif /* HAVE_INT64_T */
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
@ -448,19 +450,19 @@ int opal_dss_print_float(char **output, char *prefix,
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_FLOAT\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_FLOAT\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_FLOAT\tValue: %f", prefx, *src); opal_asprintf(output, "%sData type: OPAL_FLOAT\tValue: %f", prefx, *src);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -474,19 +476,19 @@ int opal_dss_print_double(char **output, char *prefix,
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_DOUBLE\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_DOUBLE\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_DOUBLE\tValue: %f", prefx, *src); opal_asprintf(output, "%sData type: OPAL_DOUBLE\tValue: %f", prefx, *src);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -501,12 +503,12 @@ int opal_dss_print_time(char **output, char *prefix,
char *t; char *t;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_TIME\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_TIME\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -516,7 +518,7 @@ int opal_dss_print_time(char **output, char *prefix,
t = ctime(src); t = ctime(src);
t[strlen(t)-1] = '\0'; // remove trailing newline t[strlen(t)-1] = '\0'; // remove trailing newline
asprintf(output, "%sData type: OPAL_TIME\tValue: %s", prefx, t); opal_asprintf(output, "%sData type: OPAL_TIME\tValue: %s", prefx, t);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -530,19 +532,19 @@ int opal_dss_print_timeval(char **output, char *prefix,
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_TIMEVAL\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_TIMEVAL\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_TIMEVAL\tValue: %ld.%06ld", prefx, opal_asprintf(output, "%sData type: OPAL_TIMEVAL\tValue: %ld.%06ld", prefx,
(long)src->tv_sec, (long)src->tv_usec); (long)src->tv_sec, (long)src->tv_usec);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
@ -556,19 +558,19 @@ int opal_dss_print_null(char **output, char *prefix, void *src, opal_data_type_t
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_NULL\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_NULL\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_NULL", prefx); opal_asprintf(output, "%sData type: OPAL_NULL", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -587,19 +589,19 @@ int opal_dss_print_data_type(char **output, char *prefix, opal_data_type_t *src,
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_DATA_TYPE\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_DATA_TYPE\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_DATA_TYPE\tValue: %lu", prefx, (unsigned long) *src); opal_asprintf(output, "%sData type: OPAL_DATA_TYPE\tValue: %lu", prefx, (unsigned long) *src);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -614,19 +616,19 @@ int opal_dss_print_byte_object(char **output, char *prefix, opal_byte_object_t *
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_BYTE_OBJECT\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_BYTE_OBJECT\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_BYTE_OBJECT\tSize: %lu", prefx, (unsigned long) src->size); opal_asprintf(output, "%sData type: OPAL_BYTE_OBJECT\tSize: %lu", prefx, (unsigned long) src->size);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -642,18 +644,18 @@ int opal_dss_print_pstat(char **output, char *prefix, opal_pstats_t *src, opal_d
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_PSTATS\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_PSTATS\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sOPAL_PSTATS SAMPLED AT: %ld.%06ld\n%snode: %s rank: %d pid: %d cmd: %s state: %c pri: %d #threads: %d Processor: %d\n" opal_asprintf(output, "%sOPAL_PSTATS SAMPLED AT: %ld.%06ld\n%snode: %s rank: %d pid: %d cmd: %s state: %c pri: %d #threads: %d Processor: %d\n"
"%s\ttime: %ld.%06ld cpu: %5.2f PSS: %8.2f VMsize: %8.2f PeakVMSize: %8.2f RSS: %8.2f\n", "%s\ttime: %ld.%06ld cpu: %5.2f PSS: %8.2f VMsize: %8.2f PeakVMSize: %8.2f RSS: %8.2f\n",
prefx, (long)src->sample_time.tv_sec, (long)src->sample_time.tv_usec, prefx, (long)src->sample_time.tv_sec, (long)src->sample_time.tv_usec,
prefx, src->node, src->rank, src->pid, src->cmd, src->state[0], src->priority, src->num_threads, src->processor, prefx, src->node, src->rank, src->pid, src->cmd, src->state[0], src->priority, src->num_threads, src->processor,
@ -673,18 +675,18 @@ int opal_dss_print_node_stat(char **output, char *prefix, opal_node_stats_t *src
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_NODE_STATS\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_NODE_STATS\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sOPAL_NODE_STATS SAMPLED AT: %ld.%06ld\n%sTotal Mem: %5.2f Free Mem: %5.2f Buffers: %5.2f Cached: %5.2f\n" opal_asprintf(output, "%sOPAL_NODE_STATS SAMPLED AT: %ld.%06ld\n%sTotal Mem: %5.2f Free Mem: %5.2f Buffers: %5.2f Cached: %5.2f\n"
"%sSwapCached: %5.2f SwapTotal: %5.2f SwapFree: %5.2f Mapped: %5.2f\n" "%sSwapCached: %5.2f SwapTotal: %5.2f SwapFree: %5.2f Mapped: %5.2f\n"
"%s\tla: %5.2f\tla5: %5.2f\tla15: %5.2f\n", "%s\tla: %5.2f\tla5: %5.2f\tla15: %5.2f\n",
prefx, (long)src->sample_time.tv_sec, (long)src->sample_time.tv_usec, prefx, (long)src->sample_time.tv_sec, (long)src->sample_time.tv_usec,
@ -706,12 +708,12 @@ int opal_dss_print_value(char **output, char *prefix, opal_value_t *src, opal_da
char *prefx; char *prefx;
/* deal with NULL prefix */ /* deal with NULL prefix */
if (NULL == prefix) asprintf(&prefx, " "); if (NULL == prefix) opal_asprintf(&prefx, " ");
else prefx = prefix; else prefx = prefix;
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_VALUE\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_VALUE\tValue: NULL pointer", prefx);
if (prefx != prefix) { if (prefx != prefix) {
free(prefx); free(prefx);
} }
@ -720,101 +722,101 @@ int opal_dss_print_value(char **output, char *prefix, opal_value_t *src, opal_da
switch (src->type) { switch (src->type) {
case OPAL_BOOL: case OPAL_BOOL:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BOOL\tKey: %s\tValue: %s", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BOOL\tKey: %s\tValue: %s",
prefx, src->key, src->data.flag ? "true" : "false"); prefx, src->key, src->data.flag ? "true" : "false");
break; break;
case OPAL_BYTE: case OPAL_BYTE:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BYTE\tKey: %s\tValue: %x", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BYTE\tKey: %s\tValue: %x",
prefx, src->key, src->data.byte); prefx, src->key, src->data.byte);
break; break;
case OPAL_STRING: case OPAL_STRING:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_STRING\tKey: %s\tValue: %s", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_STRING\tKey: %s\tValue: %s",
prefx, src->key, src->data.string); prefx, src->key, src->data.string);
break; break;
case OPAL_SIZE: case OPAL_SIZE:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_SIZE\tKey: %s\tValue: %lu", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_SIZE\tKey: %s\tValue: %lu",
prefx, src->key, (unsigned long)src->data.size); prefx, src->key, (unsigned long)src->data.size);
break; break;
case OPAL_PID: case OPAL_PID:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_PID\tKey: %s\tValue: %lu", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_PID\tKey: %s\tValue: %lu",
prefx, src->key, (unsigned long)src->data.pid); prefx, src->key, (unsigned long)src->data.pid);
break; break;
case OPAL_INT: case OPAL_INT:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT\tKey: %s\tValue: %d", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT\tKey: %s\tValue: %d",
prefx, src->key, src->data.integer); prefx, src->key, src->data.integer);
break; break;
case OPAL_INT8: case OPAL_INT8:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT8\tKey: %s\tValue: %d", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT8\tKey: %s\tValue: %d",
prefx, src->key, (int)src->data.int8); prefx, src->key, (int)src->data.int8);
break; break;
case OPAL_INT16: case OPAL_INT16:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT16\tKey: %s\tValue: %d", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT16\tKey: %s\tValue: %d",
prefx, src->key, (int)src->data.int16); prefx, src->key, (int)src->data.int16);
break; break;
case OPAL_INT32: case OPAL_INT32:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT32\tKey: %s\tValue: %d", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT32\tKey: %s\tValue: %d",
prefx, src->key, src->data.int32); prefx, src->key, src->data.int32);
break; break;
case OPAL_INT64: case OPAL_INT64:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT64\tKey: %s\tValue: %ld", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_INT64\tKey: %s\tValue: %ld",
prefx, src->key, (long)src->data.int64); prefx, src->key, (long)src->data.int64);
break; break;
case OPAL_UINT: case OPAL_UINT:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT\tKey: %s\tValue: %u", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT\tKey: %s\tValue: %u",
prefx, src->key, src->data.uint); prefx, src->key, src->data.uint);
break; break;
case OPAL_UINT8: case OPAL_UINT8:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT8\tKey: %s\tValue: %u", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT8\tKey: %s\tValue: %u",
prefx, src->key, (unsigned int)src->data.uint8); prefx, src->key, (unsigned int)src->data.uint8);
break; break;
case OPAL_UINT16: case OPAL_UINT16:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT16\tKey: %s\tValue: %u", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT16\tKey: %s\tValue: %u",
prefx, src->key, (unsigned int)src->data.uint16); prefx, src->key, (unsigned int)src->data.uint16);
break; break;
case OPAL_UINT32: case OPAL_UINT32:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT32\tKey: %s\tValue: %u", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT32\tKey: %s\tValue: %u",
prefx, src->key, src->data.uint32); prefx, src->key, src->data.uint32);
break; break;
case OPAL_UINT64: case OPAL_UINT64:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT64\tKey: %s\tValue: %lu", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_UINT64\tKey: %s\tValue: %lu",
prefx, src->key, (unsigned long)src->data.uint64); prefx, src->key, (unsigned long)src->data.uint64);
break; break;
case OPAL_FLOAT: case OPAL_FLOAT:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_FLOAT\tKey: %s\tValue: %f", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_FLOAT\tKey: %s\tValue: %f",
prefx, src->key, src->data.fval); prefx, src->key, src->data.fval);
break; break;
case OPAL_DOUBLE: case OPAL_DOUBLE:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_DOUBLE\tKey: %s\tValue: %f", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_DOUBLE\tKey: %s\tValue: %f",
prefx, src->key, src->data.dval); prefx, src->key, src->data.dval);
break; break;
case OPAL_BYTE_OBJECT: case OPAL_BYTE_OBJECT:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BYTE_OBJECT\tKey: %s\tData: %s\tSize: %lu", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_BYTE_OBJECT\tKey: %s\tData: %s\tSize: %lu",
prefx, src->key, (NULL == src->data.bo.bytes) ? "NULL" : "NON-NULL", (unsigned long)src->data.bo.size); prefx, src->key, (NULL == src->data.bo.bytes) ? "NULL" : "NON-NULL", (unsigned long)src->data.bo.size);
break; break;
case OPAL_TIMEVAL: case OPAL_TIMEVAL:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_TIMEVAL\tKey: %s\tValue: %ld.%06ld", prefx, opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_TIMEVAL\tKey: %s\tValue: %ld.%06ld", prefx,
src->key, (long)src->data.tv.tv_sec, (long)src->data.tv.tv_usec); src->key, (long)src->data.tv.tv_sec, (long)src->data.tv.tv_usec);
break; break;
case OPAL_TIME: case OPAL_TIME:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_TIME\tKey: %s\tValue: %s", prefx, opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_TIME\tKey: %s\tValue: %s", prefx,
src->key, ctime(&src->data.time)); src->key, ctime(&src->data.time));
break; break;
case OPAL_NAME: case OPAL_NAME:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_NAME\tKey: %s\tValue: %s", prefx, opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_NAME\tKey: %s\tValue: %s", prefx,
src->key, OPAL_NAME_PRINT(src->data.name)); src->key, OPAL_NAME_PRINT(src->data.name));
break; break;
case OPAL_PTR: case OPAL_PTR:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_PTR\tKey: %s", prefx, src->key); opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_PTR\tKey: %s", prefx, src->key);
break; break;
case OPAL_ENVAR: case OPAL_ENVAR:
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_ENVAR\tKey: %s\tName: %s\tValue: %s\tSeparator: %c", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_ENVAR\tKey: %s\tName: %s\tValue: %s\tSeparator: %c",
prefx, src->key, prefx, src->key,
(NULL == src->data.envar.envar) ? "NULL" : src->data.envar.envar, (NULL == src->data.envar.envar) ? "NULL" : src->data.envar.envar,
(NULL == src->data.envar.value) ? "NULL" : src->data.envar.value, (NULL == src->data.envar.value) ? "NULL" : src->data.envar.value,
('\0' == src->data.envar.separator) ? ' ' : src->data.envar.separator); ('\0' == src->data.envar.separator) ? ' ' : src->data.envar.separator);
break; break;
default: default:
asprintf(output, "%sOPAL_VALUE: Data type: UNKNOWN\tKey: %s\tValue: UNPRINTABLE", opal_asprintf(output, "%sOPAL_VALUE: Data type: UNKNOWN\tKey: %s\tValue: UNPRINTABLE",
prefx, src->key); prefx, src->key);
break; break;
} }
@ -839,10 +841,10 @@ int opal_dss_print_name(char **output, char *prefix, opal_process_name_t *name,
*output = NULL; *output = NULL;
if (NULL == name) { if (NULL == name) {
asprintf(output, "%sData type: ORTE_PROCESS_NAME\tData Value: NULL", opal_asprintf(output, "%sData type: ORTE_PROCESS_NAME\tData Value: NULL",
(NULL == prefix ? " " : prefix)); (NULL == prefix ? " " : prefix));
} else { } else {
asprintf(output, "%sData type: ORTE_PROCESS_NAME\tData Value: [%d,%d]", opal_asprintf(output, "%sData type: ORTE_PROCESS_NAME\tData Value: [%d,%d]",
(NULL == prefix ? " " : prefix), name->jobid, name->vpid); (NULL == prefix ? " " : prefix), name->jobid, name->vpid);
} }
@ -859,11 +861,11 @@ int opal_dss_print_jobid(char **output, char *prefix,
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_JOBID\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_JOBID\tValue: NULL pointer", prefx);
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_JOBID\tValue: %s", prefx, opal_jobid_print(src->jobid)); opal_asprintf(output, "%sData type: OPAL_JOBID\tValue: %s", prefx, opal_jobid_print(src->jobid));
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
@ -877,11 +879,11 @@ int opal_dss_print_vpid(char **output, char *prefix,
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_VPID\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_VPID\tValue: NULL pointer", prefx);
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_VPID\tValue: %s", prefx, opal_vpid_print(src->vpid)); opal_asprintf(output, "%sData type: OPAL_VPID\tValue: %s", prefx, opal_vpid_print(src->vpid));
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
@ -895,11 +897,11 @@ int opal_dss_print_status(char **output, char *prefix,
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_STATUS\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_STATUS\tValue: NULL pointer", prefx);
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sData type: OPAL_STATUS\tValue: %s", prefx, opal_strerror(*src)); opal_asprintf(output, "%sData type: OPAL_STATUS\tValue: %s", prefx, opal_strerror(*src));
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
@ -914,11 +916,11 @@ int opal_dss_print_envar(char **output, char *prefix,
/* if src is NULL, just print data type and return */ /* if src is NULL, just print data type and return */
if (NULL == src) { if (NULL == src) {
asprintf(output, "%sData type: OPAL_ENVAR\tValue: NULL pointer", prefx); opal_asprintf(output, "%sData type: OPAL_ENVAR\tValue: NULL pointer", prefx);
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
asprintf(output, "%sOPAL_VALUE: Data type: OPAL_ENVAR\tName: %s\tValue: %s\tSeparator: %c", opal_asprintf(output, "%sOPAL_VALUE: Data type: OPAL_ENVAR\tName: %s\tValue: %s\tSeparator: %c",
prefx, (NULL == src->envar) ? "NULL" : src->envar, prefx, (NULL == src->envar) ? "NULL" : src->envar,
(NULL == src->value) ? "NULL" : src->value, (NULL == src->value) ? "NULL" : src->value,
('\0' == src->separator) ? ' ' : src->separator); ('\0' == src->separator) ? ' ' : src->separator);

Просмотреть файл

@ -11,6 +11,7 @@
* All rights reserved. * All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2014-2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -27,6 +28,7 @@
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "opal/constants.h" #include "opal/constants.h"
@ -231,7 +233,7 @@ void mca_base_cmd_line_wrap_args(char **args)
return; return;
} }
i += 2; i += 2;
asprintf(&tstr, "\"%s\"", args[i]); opal_asprintf(&tstr, "\"%s\"", args[i]);
free(args[i]); free(args[i]);
args[i] = tstr; args[i] = tstr;
} }

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -22,7 +23,7 @@
#include "opal/mca/mca.h" #include "opal/mca/mca.h"
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "opal/util/printf.h"
/* /*
* Function for comparing two mca_base_component_priority_t structs so * Function for comparing two mca_base_component_priority_t structs so
@ -142,7 +143,7 @@ int mca_base_component_compatible(
*/ */
char * mca_base_component_to_string(const mca_base_component_t *a) { char * mca_base_component_to_string(const mca_base_component_t *a) {
char * str = NULL; char * str = NULL;
if(0 > asprintf(&str, "%s.%s.%d.%d", a->mca_type_name, if(0 > opal_asprintf(&str, "%s.%s.%d.%d", a->mca_type_name,
a->mca_component_name, a->mca_component_major_version, a->mca_component_name, a->mca_component_major_version,
a->mca_component_minor_version)) { a->mca_component_minor_version)) {
return NULL; return NULL;

Просмотреть файл

@ -16,6 +16,7 @@
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -44,6 +45,7 @@
#include "opal/class/opal_hash_table.h" #include "opal/class/opal_hash_table.h"
#include "opal/util/basename.h" #include "opal/util/basename.h"
#include "opal/util/string_copy.h" #include "opal/util/string_copy.h"
#include "opal/util/printf.h"
#if OPAL_HAVE_DL_SUPPORT #if OPAL_HAVE_DL_SUPPORT
@ -185,7 +187,7 @@ static int file_exists(const char *filename, const char *ext)
return access (filename, F_OK) == 0; return access (filename, F_OK) == 0;
} }
ret = asprintf(&final, "%s.%s", filename, ext); ret = opal_asprintf(&final, "%s.%s", filename, ext);
if (0 > ret || NULL == final) { if (0 > ret || NULL == final) {
return 0; return 0;
} }
@ -433,7 +435,7 @@ int mca_base_component_repository_open (mca_base_framework_t *framework,
if( mca_base_component_track_load_errors ) { if( mca_base_component_track_load_errors ) {
mca_base_failed_component_t *f_comp = OBJ_NEW(mca_base_failed_component_t); mca_base_failed_component_t *f_comp = OBJ_NEW(mca_base_failed_component_t);
f_comp->comp = ri; f_comp->comp = ri;
asprintf(&(f_comp->error_msg), "%s", err_msg); opal_asprintf(&(f_comp->error_msg), "%s", err_msg);
opal_list_append(&framework->framework_failed_components, &f_comp->super); opal_list_append(&framework->framework_failed_components, &f_comp->super);
} }
@ -444,7 +446,7 @@ int mca_base_component_repository_open (mca_base_framework_t *framework,
Malloc out enough space for it. */ Malloc out enough space for it. */
do { do {
ret = asprintf (&struct_name, "mca_%s_%s_component", ri->ri_type, ri->ri_name); ret = opal_asprintf (&struct_name, "mca_%s_%s_component", ri->ri_type, ri->ri_name);
if (0 > ret) { if (0 > ret) {
ret = OPAL_ERR_OUT_OF_RESOURCE; ret = OPAL_ERR_OUT_OF_RESOURCE;
break; break;

Просмотреть файл

@ -4,6 +4,7 @@
* reserved. * reserved.
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -15,6 +16,7 @@
#include "opal/include/opal/constants.h" #include "opal/include/opal/constants.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/printf.h"
#include "mca_base_framework.h" #include "mca_base_framework.h"
#include "mca_base_var.h" #include "mca_base_var.h"
@ -82,7 +84,7 @@ int mca_base_framework_register (struct mca_base_framework_t *framework,
return ret; return ret;
} }
asprintf (&desc, "Default selection set of components for the %s framework (<none>" opal_asprintf (&desc, "Default selection set of components for the %s framework (<none>"
" means use all components that can be found)", framework->framework_name); " means use all components that can be found)", framework->framework_name);
ret = mca_base_var_register (framework->framework_project, framework->framework_name, ret = mca_base_var_register (framework->framework_project, framework->framework_name,
NULL, NULL, desc, MCA_BASE_VAR_TYPE_STRING, NULL, 0, NULL, NULL, desc, MCA_BASE_VAR_TYPE_STRING, NULL, 0,
@ -94,7 +96,7 @@ int mca_base_framework_register (struct mca_base_framework_t *framework,
} }
/* register a verbosity variable for this framework */ /* register a verbosity variable for this framework */
ret = asprintf (&desc, "Verbosity level for the %s framework (default: 0)", ret = opal_asprintf (&desc, "Verbosity level for the %s framework (default: 0)",
framework->framework_name); framework->framework_name);
if (0 > ret) { if (0 > ret) {
return OPAL_ERR_OUT_OF_RESOURCE; return OPAL_ERR_OUT_OF_RESOURCE;

Просмотреть файл

@ -14,6 +14,7 @@
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -79,16 +80,16 @@ int mca_base_open(void)
/* define the system and user default paths */ /* define the system and user default paths */
#if OPAL_WANT_HOME_CONFIG_FILES #if OPAL_WANT_HOME_CONFIG_FILES
mca_base_system_default_path = strdup(opal_install_dirs.opallibdir); mca_base_system_default_path = strdup(opal_install_dirs.opallibdir);
asprintf(&mca_base_user_default_path, "%s"OPAL_PATH_SEP".openmpi"OPAL_PATH_SEP"components", opal_home_directory()); opal_asprintf(&mca_base_user_default_path, "%s"OPAL_PATH_SEP".openmpi"OPAL_PATH_SEP"components", opal_home_directory());
#else #else
asprintf(&mca_base_system_default_path, "%s", opal_install_dirs.opallibdir); opal_asprintf(&mca_base_system_default_path, "%s", opal_install_dirs.opallibdir);
#endif #endif
/* see if the user wants to override the defaults */ /* see if the user wants to override the defaults */
if (NULL == mca_base_user_default_path) { if (NULL == mca_base_user_default_path) {
value = strdup(mca_base_system_default_path); value = strdup(mca_base_system_default_path);
} else { } else {
asprintf(&value, "%s%c%s", mca_base_system_default_path, opal_asprintf(&value, "%s%c%s", mca_base_system_default_path,
OPAL_ENV_SEP, mca_base_user_default_path); OPAL_ENV_SEP, mca_base_user_default_path);
} }
@ -156,7 +157,7 @@ int mca_base_open(void)
set_defaults(&lds); set_defaults(&lds);
} }
gethostname(hostname, sizeof(hostname)); gethostname(hostname, sizeof(hostname));
asprintf(&lds.lds_prefix, "[%s:%05d] ", hostname, getpid()); opal_asprintf(&lds.lds_prefix, "[%s:%05d] ", hostname, getpid());
opal_output_reopen(0, &lds); opal_output_reopen(0, &lds);
opal_output_verbose (MCA_BASE_VERBOSE_COMPONENT, 0, "mca: base: opening components"); opal_output_verbose (MCA_BASE_VERBOSE_COMPONENT, 0, "mca: base: opening components");
free(lds.lds_prefix); free(lds.lds_prefix);

Просмотреть файл

@ -8,6 +8,7 @@
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -24,6 +25,7 @@
#include "opal/class/opal_pointer_array.h" #include "opal/class/opal_pointer_array.h"
#include "opal/class/opal_hash_table.h" #include "opal/class/opal_hash_table.h"
#include "opal/util/printf.h"
static opal_hash_table_t mca_base_pvar_index_hash; static opal_hash_table_t mca_base_pvar_index_hash;
static opal_pointer_array_t registered_pvars; static opal_pointer_array_t registered_pvars;
@ -845,16 +847,16 @@ int mca_base_pvar_dump(int index, char ***out, mca_base_var_dump_type_t output_t
} }
/* build the message*/ /* build the message*/
(void)asprintf(&tmp, "mca:%s:%s:pvar:%s:", framework, component, full_name); (void)opal_asprintf(&tmp, "mca:%s:%s:pvar:%s:", framework, component, full_name);
(void)asprintf(out[0] + line++, "%sclass:%s", tmp, pvar_class_names[pvar->var_class]); (void)opal_asprintf(out[0] + line++, "%sclass:%s", tmp, pvar_class_names[pvar->var_class]);
(void)asprintf(out[0] + line++, "%sread-only:%s", tmp, mca_base_pvar_is_readonly(pvar) ? "true" : "false"); (void)opal_asprintf(out[0] + line++, "%sread-only:%s", tmp, mca_base_pvar_is_readonly(pvar) ? "true" : "false");
(void)asprintf(out[0] + line++, "%scontinuous:%s", tmp, mca_base_pvar_is_continuous(pvar) ? "true" : "false"); (void)opal_asprintf(out[0] + line++, "%scontinuous:%s", tmp, mca_base_pvar_is_continuous(pvar) ? "true" : "false");
(void)asprintf(out[0] + line++, "%satomic:%s", tmp, mca_base_pvar_is_atomic(pvar) ? "true" : "false"); (void)opal_asprintf(out[0] + line++, "%satomic:%s", tmp, mca_base_pvar_is_atomic(pvar) ? "true" : "false");
/* if it has a help message, output the help message */ /* if it has a help message, output the help message */
if (pvar->description) { if (pvar->description) {
(void)asprintf(out[0] + line++, "%shelp:%s", tmp, pvar->description); (void)opal_asprintf(out[0] + line++, "%shelp:%s", tmp, pvar->description);
} }
if (NULL != pvar->enumerator) { if (NULL != pvar->enumerator) {
@ -868,11 +870,11 @@ int mca_base_pvar_dump(int index, char ***out, mca_base_var_dump_type_t output_t
continue; continue;
} }
(void)asprintf(out[0] + line++, "%senumerator:value:%d:%s", tmp, enum_value, enum_string); (void)opal_asprintf(out[0] + line++, "%senumerator:value:%d:%s", tmp, enum_value, enum_string);
} }
} }
(void)asprintf(out[0] + line++, "%stype:%s", tmp, ompi_var_type_names[pvar->type]); (void)opal_asprintf(out[0] + line++, "%stype:%s", tmp, ompi_var_type_names[pvar->type]);
free(tmp); // release tmp storage free(tmp); // release tmp storage
} else { } else {
/* there will be at most three lines in the pretty print case */ /* there will be at most three lines in the pretty print case */
@ -881,11 +883,11 @@ int mca_base_pvar_dump(int index, char ***out, mca_base_var_dump_type_t output_t
return OPAL_ERR_OUT_OF_RESOURCE; return OPAL_ERR_OUT_OF_RESOURCE;
} }
(void)asprintf (out[0] + line++, "performance \"%s\" (type: %s, class: %s)", full_name, (void)opal_asprintf (out[0] + line++, "performance \"%s\" (type: %s, class: %s)", full_name,
ompi_var_type_names[pvar->type], pvar_class_names[pvar->var_class]); ompi_var_type_names[pvar->type], pvar_class_names[pvar->var_class]);
if (pvar->description) { if (pvar->description) {
(void)asprintf(out[0] + line++, "%s", pvar->description); (void)opal_asprintf(out[0] + line++, "%s", pvar->description);
} }
if (NULL != pvar->enumerator) { if (NULL != pvar->enumerator) {
@ -893,7 +895,7 @@ int mca_base_pvar_dump(int index, char ***out, mca_base_var_dump_type_t output_t
ret = pvar->enumerator->dump(pvar->enumerator, &values); ret = pvar->enumerator->dump(pvar->enumerator, &values);
if (OPAL_SUCCESS == ret) { if (OPAL_SUCCESS == ret) {
(void)asprintf (out[0] + line++, "Values: %s", values); (void)opal_asprintf (out[0] + line++, "Values: %s", values);
free (values); free (values);
} }
} }

Просмотреть файл

@ -17,6 +17,7 @@
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -386,7 +387,7 @@ static void resolve_relative_paths(char **file_prefix, char *file_path, bool rel
} }
else { else {
/* Prepend the files to the search list */ /* Prepend the files to the search list */
asprintf(&tmp_str, "%s%c%s", *file_prefix, sep, *files); opal_asprintf(&tmp_str, "%s%c%s", *file_prefix, sep, *files);
free (*files); free (*files);
*files = tmp_str; *files = tmp_str;
} }
@ -409,11 +410,11 @@ int mca_base_var_cache_files(bool rel_path_search)
} }
#if OPAL_WANT_HOME_CONFIG_FILES #if OPAL_WANT_HOME_CONFIG_FILES
asprintf(&mca_base_var_files, "%s"OPAL_PATH_SEP".openmpi" OPAL_PATH_SEP opal_asprintf(&mca_base_var_files, "%s"OPAL_PATH_SEP".openmpi" OPAL_PATH_SEP
"mca-params.conf%c%s" OPAL_PATH_SEP "openmpi-mca-params.conf", "mca-params.conf%c%s" OPAL_PATH_SEP "openmpi-mca-params.conf",
home, ',', opal_install_dirs.sysconfdir); home, ',', opal_install_dirs.sysconfdir);
#else #else
asprintf(&mca_base_var_files, "%s" OPAL_PATH_SEP "openmpi-mca-params.conf", opal_asprintf(&mca_base_var_files, "%s" OPAL_PATH_SEP "openmpi-mca-params.conf",
opal_install_dirs.sysconfdir); opal_install_dirs.sysconfdir);
#endif #endif
@ -434,7 +435,7 @@ int mca_base_var_cache_files(bool rel_path_search)
(void) mca_base_var_register_synonym (ret, "opal", "mca", NULL, "param_files", (void) mca_base_var_register_synonym (ret, "opal", "mca", NULL, "param_files",
MCA_BASE_VAR_SYN_FLAG_DEPRECATED); MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
ret = asprintf(&mca_base_var_override_file, "%s" OPAL_PATH_SEP "openmpi-mca-params-override.conf", ret = opal_asprintf(&mca_base_var_override_file, "%s" OPAL_PATH_SEP "openmpi-mca-params-override.conf",
opal_install_dirs.sysconfdir); opal_install_dirs.sysconfdir);
if (0 > ret) { if (0 > ret) {
return OPAL_ERR_OUT_OF_RESOURCE; return OPAL_ERR_OUT_OF_RESOURCE;
@ -488,7 +489,7 @@ int mca_base_var_cache_files(bool rel_path_search)
return ret; return ret;
} }
ret = asprintf(&mca_base_param_file_path, "%s" OPAL_PATH_SEP "amca-param-sets%c%s", ret = opal_asprintf(&mca_base_param_file_path, "%s" OPAL_PATH_SEP "amca-param-sets%c%s",
opal_install_dirs.opaldatadir, OPAL_ENV_SEP, cwd); opal_install_dirs.opaldatadir, OPAL_ENV_SEP, cwd);
if (0 > ret) { if (0 > ret) {
return OPAL_ERR_OUT_OF_RESOURCE; return OPAL_ERR_OUT_OF_RESOURCE;
@ -517,7 +518,7 @@ int mca_base_var_cache_files(bool rel_path_search)
if (NULL != mca_base_param_file_path) { if (NULL != mca_base_param_file_path) {
char *tmp_str = mca_base_param_file_path; char *tmp_str = mca_base_param_file_path;
asprintf(&mca_base_param_file_path, "%s%c%s", force_agg_path, OPAL_ENV_SEP, tmp_str); opal_asprintf(&mca_base_param_file_path, "%s%c%s", force_agg_path, OPAL_ENV_SEP, tmp_str);
free(tmp_str); free(tmp_str);
} else { } else {
mca_base_param_file_path = strdup(force_agg_path); mca_base_param_file_path = strdup(force_agg_path);
@ -598,7 +599,7 @@ static int var_set_string (mca_base_var_t *var, char *value)
in the future. */ in the future. */
if (0 == strncmp (value, "~/", 2)) { if (0 == strncmp (value, "~/", 2)) {
if (NULL != home) { if (NULL != home) {
ret = asprintf (&value, "%s/%s", home, value + 2); ret = opal_asprintf (&value, "%s/%s", home, value + 2);
if (0 > ret) { if (0 > ret) {
return OPAL_ERROR; return OPAL_ERROR;
} }
@ -617,7 +618,7 @@ static int var_set_string (mca_base_var_t *var, char *value)
tmp[0] = '\0'; tmp[0] = '\0';
tmp += 3; tmp += 3;
ret = asprintf (&tmp, "%s:%s%s%s", value, ret = opal_asprintf (&tmp, "%s:%s%s%s", value,
home ? home : "", home ? "/" : "", tmp); home ? home : "", home ? "/" : "", tmp);
free (value); free (value);
@ -894,7 +895,7 @@ int mca_base_var_env_name(const char *param_name,
assert (NULL != env_name); assert (NULL != env_name);
ret = asprintf(env_name, "%s%s", mca_prefix, param_name); ret = opal_asprintf(env_name, "%s%s", mca_prefix, param_name);
if (0 > ret) { if (0 > ret) {
return OPAL_ERR_OUT_OF_RESOURCE; return OPAL_ERR_OUT_OF_RESOURCE;
} }
@ -1049,7 +1050,7 @@ int mca_base_var_build_env(char ***env, int *num_env, bool internal)
goto cleanup; goto cleanup;
} }
ret = asprintf (&str, "%s%s=%s", mca_prefix, var->mbv_full_name, ret = opal_asprintf (&str, "%s%s=%s", mca_prefix, var->mbv_full_name,
value_string); value_string);
free (value_string); free (value_string);
if (0 > ret) { if (0 > ret) {
@ -1062,11 +1063,11 @@ int mca_base_var_build_env(char ***env, int *num_env, bool internal)
switch (var->mbv_source) { switch (var->mbv_source) {
case MCA_BASE_VAR_SOURCE_FILE: case MCA_BASE_VAR_SOURCE_FILE:
case MCA_BASE_VAR_SOURCE_OVERRIDE: case MCA_BASE_VAR_SOURCE_OVERRIDE:
asprintf (&str, "%sSOURCE_%s=FILE:%s", mca_prefix, var->mbv_full_name, opal_asprintf (&str, "%sSOURCE_%s=FILE:%s", mca_prefix, var->mbv_full_name,
mca_base_var_source_file (var)); mca_base_var_source_file (var));
break; break;
case MCA_BASE_VAR_SOURCE_COMMAND_LINE: case MCA_BASE_VAR_SOURCE_COMMAND_LINE:
asprintf (&str, "%sSOURCE_%s=COMMAND_LINE", mca_prefix, var->mbv_full_name); opal_asprintf (&str, "%sSOURCE_%s=COMMAND_LINE", mca_prefix, var->mbv_full_name);
break; break;
case MCA_BASE_VAR_SOURCE_ENV: case MCA_BASE_VAR_SOURCE_ENV:
case MCA_BASE_VAR_SOURCE_SET: case MCA_BASE_VAR_SOURCE_SET:
@ -1916,12 +1917,12 @@ static char *source_name(mca_base_var_t *var)
int rc; int rc;
if (fv) { if (fv) {
rc = asprintf(&ret, "file (%s:%d)", fv->mbvfv_file, fv->mbvfv_lineno); rc = opal_asprintf(&ret, "file (%s:%d)", fv->mbvfv_file, fv->mbvfv_lineno);
} else { } else {
rc = asprintf(&ret, "file (%s)", var->mbv_source_file); rc = opal_asprintf(&ret, "file (%s)", var->mbv_source_file);
} }
/* some compilers will warn if the return code of asprintf is not checked (even if it is cast to void) */ /* some compilers will warn if the return code of opal_asprintf is not checked (even if it is cast to void) */
if (0 > rc) { if (0 > rc) {
return NULL; return NULL;
} }
@ -1944,7 +1945,7 @@ static int var_value_string (mca_base_var_t *var, char **value_string)
* as "unset" by default. */ * as "unset" by default. */
if ((var->mbv_flags & MCA_BASE_VAR_FLAG_DEF_UNSET) && if ((var->mbv_flags & MCA_BASE_VAR_FLAG_DEF_UNSET) &&
(MCA_BASE_VAR_SOURCE_DEFAULT == var->mbv_source)){ (MCA_BASE_VAR_SOURCE_DEFAULT == var->mbv_source)){
asprintf (value_string, "%s", "unset"); opal_asprintf (value_string, "%s", "unset");
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
@ -1956,45 +1957,45 @@ static int var_value_string (mca_base_var_t *var, char **value_string)
if (NULL == var->mbv_enumerator) { if (NULL == var->mbv_enumerator) {
switch (var->mbv_type) { switch (var->mbv_type) {
case MCA_BASE_VAR_TYPE_INT: case MCA_BASE_VAR_TYPE_INT:
ret = asprintf (value_string, "%d", value->intval); ret = opal_asprintf (value_string, "%d", value->intval);
break; break;
case MCA_BASE_VAR_TYPE_INT32_T: case MCA_BASE_VAR_TYPE_INT32_T:
ret = asprintf (value_string, "%" PRId32, value->int32tval); ret = opal_asprintf (value_string, "%" PRId32, value->int32tval);
break; break;
case MCA_BASE_VAR_TYPE_UINT32_T: case MCA_BASE_VAR_TYPE_UINT32_T:
ret = asprintf (value_string, "%" PRIu32, value->uint32tval); ret = opal_asprintf (value_string, "%" PRIu32, value->uint32tval);
break; break;
case MCA_BASE_VAR_TYPE_INT64_T: case MCA_BASE_VAR_TYPE_INT64_T:
ret = asprintf (value_string, "%" PRId64, value->int64tval); ret = opal_asprintf (value_string, "%" PRId64, value->int64tval);
break; break;
case MCA_BASE_VAR_TYPE_UINT64_T: case MCA_BASE_VAR_TYPE_UINT64_T:
ret = asprintf (value_string, "%" PRIu64, value->uint64tval); ret = opal_asprintf (value_string, "%" PRIu64, value->uint64tval);
break; break;
case MCA_BASE_VAR_TYPE_LONG: case MCA_BASE_VAR_TYPE_LONG:
ret = asprintf (value_string, "%ld", value->longval); ret = opal_asprintf (value_string, "%ld", value->longval);
break; break;
case MCA_BASE_VAR_TYPE_UNSIGNED_INT: case MCA_BASE_VAR_TYPE_UNSIGNED_INT:
ret = asprintf (value_string, "%u", value->uintval); ret = opal_asprintf (value_string, "%u", value->uintval);
break; break;
case MCA_BASE_VAR_TYPE_UNSIGNED_LONG: case MCA_BASE_VAR_TYPE_UNSIGNED_LONG:
ret = asprintf (value_string, "%lu", value->ulval); ret = opal_asprintf (value_string, "%lu", value->ulval);
break; break;
case MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG: case MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG:
ret = asprintf (value_string, "%llu", value->ullval); ret = opal_asprintf (value_string, "%llu", value->ullval);
break; break;
case MCA_BASE_VAR_TYPE_SIZE_T: case MCA_BASE_VAR_TYPE_SIZE_T:
ret = asprintf (value_string, "%" PRIsize_t, value->sizetval); ret = opal_asprintf (value_string, "%" PRIsize_t, value->sizetval);
break; break;
case MCA_BASE_VAR_TYPE_STRING: case MCA_BASE_VAR_TYPE_STRING:
case MCA_BASE_VAR_TYPE_VERSION_STRING: case MCA_BASE_VAR_TYPE_VERSION_STRING:
ret = asprintf (value_string, "%s", ret = opal_asprintf (value_string, "%s",
value->stringval ? value->stringval : ""); value->stringval ? value->stringval : "");
break; break;
case MCA_BASE_VAR_TYPE_BOOL: case MCA_BASE_VAR_TYPE_BOOL:
ret = asprintf (value_string, "%d", value->boolval); ret = opal_asprintf (value_string, "%d", value->boolval);
break; break;
case MCA_BASE_VAR_TYPE_DOUBLE: case MCA_BASE_VAR_TYPE_DOUBLE:
ret = asprintf (value_string, "%lf", value->lfval); ret = opal_asprintf (value_string, "%lf", value->lfval);
break; break;
default: default:
ret = -1; ret = -1;
@ -2138,30 +2139,30 @@ int mca_base_var_dump(int vari, char ***out, mca_base_var_dump_type_t output_typ
} }
/* build the message*/ /* build the message*/
asprintf(&tmp, "mca:%s:%s:param:%s:", framework, component, opal_asprintf(&tmp, "mca:%s:%s:param:%s:", framework, component,
full_name); full_name);
/* Output the value */ /* Output the value */
char *colon = strchr(value_string, ':'); char *colon = strchr(value_string, ':');
if (NULL != colon) { if (NULL != colon) {
asprintf(out[0] + line++, "%svalue:\"%s\"", tmp, value_string); opal_asprintf(out[0] + line++, "%svalue:\"%s\"", tmp, value_string);
} else { } else {
asprintf(out[0] + line++, "%svalue:%s", tmp, value_string); opal_asprintf(out[0] + line++, "%svalue:%s", tmp, value_string);
} }
/* Output the source */ /* Output the source */
asprintf(out[0] + line++, "%ssource:%s", tmp, source_string); opal_asprintf(out[0] + line++, "%ssource:%s", tmp, source_string);
/* Output whether it's read only or writable */ /* Output whether it's read only or writable */
asprintf(out[0] + line++, "%sstatus:%s", tmp, opal_asprintf(out[0] + line++, "%sstatus:%s", tmp,
VAR_IS_SETTABLE(var[0]) ? "writeable" : "read-only"); VAR_IS_SETTABLE(var[0]) ? "writeable" : "read-only");
/* Output the info level of this parametere */ /* Output the info level of this parametere */
asprintf(out[0] + line++, "%slevel:%d", tmp, var->mbv_info_lvl + 1); opal_asprintf(out[0] + line++, "%slevel:%d", tmp, var->mbv_info_lvl + 1);
/* If it has a help message, output the help message */ /* If it has a help message, output the help message */
if (var->mbv_description) { if (var->mbv_description) {
asprintf(out[0] + line++, "%shelp:%s", tmp, var->mbv_description); opal_asprintf(out[0] + line++, "%shelp:%s", tmp, var->mbv_description);
} }
if (NULL != var->mbv_enumerator) { if (NULL != var->mbv_enumerator) {
@ -2175,18 +2176,18 @@ int mca_base_var_dump(int vari, char ***out, mca_base_var_dump_type_t output_typ
continue; continue;
} }
asprintf(out[0] + line++, "%senumerator:value:%d:%s", tmp, enum_value, enum_string); opal_asprintf(out[0] + line++, "%senumerator:value:%d:%s", tmp, enum_value, enum_string);
} }
} }
/* Is this variable deprecated? */ /* Is this variable deprecated? */
asprintf(out[0] + line++, "%sdeprecated:%s", tmp, VAR_IS_DEPRECATED(var[0]) ? "yes" : "no"); opal_asprintf(out[0] + line++, "%sdeprecated:%s", tmp, VAR_IS_DEPRECATED(var[0]) ? "yes" : "no");
asprintf(out[0] + line++, "%stype:%s", tmp, ompi_var_type_names[var->mbv_type]); opal_asprintf(out[0] + line++, "%stype:%s", tmp, ompi_var_type_names[var->mbv_type]);
/* Does this parameter have any synonyms or is it a synonym? */ /* Does this parameter have any synonyms or is it a synonym? */
if (VAR_IS_SYNONYM(var[0])) { if (VAR_IS_SYNONYM(var[0])) {
asprintf(out[0] + line++, "%ssynonym_of:name:%s", tmp, original->mbv_full_name); opal_asprintf(out[0] + line++, "%ssynonym_of:name:%s", tmp, original->mbv_full_name);
} else if (opal_value_array_get_size(&var->mbv_synonyms)) { } else if (opal_value_array_get_size(&var->mbv_synonyms)) {
for (i = 0 ; i < synonym_count ; ++i) { for (i = 0 ; i < synonym_count ; ++i) {
mca_base_var_t *synonym; mca_base_var_t *synonym;
@ -2196,7 +2197,7 @@ int mca_base_var_dump(int vari, char ***out, mca_base_var_dump_type_t output_typ
continue; continue;
} }
asprintf(out[0] + line++, "%ssynonym:name:%s", tmp, synonym->mbv_full_name); opal_asprintf(out[0] + line++, "%ssynonym:name:%s", tmp, synonym->mbv_full_name);
} }
} }
@ -2210,24 +2211,24 @@ int mca_base_var_dump(int vari, char ***out, mca_base_var_dump_type_t output_typ
return OPAL_ERR_OUT_OF_RESOURCE; return OPAL_ERR_OUT_OF_RESOURCE;
} }
asprintf (out[0], "%s \"%s\" (current value: \"%s\", data source: %s, level: %d %s, type: %s", opal_asprintf (out[0], "%s \"%s\" (current value: \"%s\", data source: %s, level: %d %s, type: %s",
VAR_IS_DEFAULT_ONLY(var[0]) ? "informational" : "parameter", VAR_IS_DEFAULT_ONLY(var[0]) ? "informational" : "parameter",
full_name, value_string, source_string, var->mbv_info_lvl + 1, full_name, value_string, source_string, var->mbv_info_lvl + 1,
info_lvl_strings[var->mbv_info_lvl], ompi_var_type_names[var->mbv_type]); info_lvl_strings[var->mbv_info_lvl], ompi_var_type_names[var->mbv_type]);
tmp = out[0][0]; tmp = out[0][0];
if (VAR_IS_DEPRECATED(var[0])) { if (VAR_IS_DEPRECATED(var[0])) {
asprintf (out[0], "%s, deprecated", tmp); opal_asprintf (out[0], "%s, deprecated", tmp);
free (tmp); free (tmp);
tmp = out[0][0]; tmp = out[0][0];
} }
/* Does this parameter have any synonyms or is it a synonym? */ /* Does this parameter have any synonyms or is it a synonym? */
if (VAR_IS_SYNONYM(var[0])) { if (VAR_IS_SYNONYM(var[0])) {
asprintf(out[0], "%s, synonym of: %s)", tmp, original->mbv_full_name); opal_asprintf(out[0], "%s, synonym of: %s)", tmp, original->mbv_full_name);
free (tmp); free (tmp);
} else if (synonym_count) { } else if (synonym_count) {
asprintf(out[0], "%s, synonyms: ", tmp); opal_asprintf(out[0], "%s, synonyms: ", tmp);
free (tmp); free (tmp);
for (i = 0 ; i < synonym_count ; ++i) { for (i = 0 ; i < synonym_count ; ++i) {
@ -2240,21 +2241,21 @@ int mca_base_var_dump(int vari, char ***out, mca_base_var_dump_type_t output_typ
tmp = out[0][0]; tmp = out[0][0];
if (synonym_count == i+1) { if (synonym_count == i+1) {
asprintf(out[0], "%s%s)", tmp, synonym->mbv_full_name); opal_asprintf(out[0], "%s%s)", tmp, synonym->mbv_full_name);
} else { } else {
asprintf(out[0], "%s%s, ", tmp, synonym->mbv_full_name); opal_asprintf(out[0], "%s%s, ", tmp, synonym->mbv_full_name);
} }
free(tmp); free(tmp);
} }
} else { } else {
asprintf(out[0], "%s)", tmp); opal_asprintf(out[0], "%s)", tmp);
free(tmp); free(tmp);
} }
line++; line++;
if (var->mbv_description) { if (var->mbv_description) {
asprintf(out[0] + line++, "%s", var->mbv_description); opal_asprintf(out[0] + line++, "%s", var->mbv_description);
} }
if (NULL != var->mbv_enumerator) { if (NULL != var->mbv_enumerator) {
@ -2262,7 +2263,7 @@ int mca_base_var_dump(int vari, char ***out, mca_base_var_dump_type_t output_typ
ret = var->mbv_enumerator->dump(var->mbv_enumerator, &values); ret = var->mbv_enumerator->dump(var->mbv_enumerator, &values);
if (OPAL_SUCCESS == ret) { if (OPAL_SUCCESS == ret) {
asprintf (out[0] + line++, "Valid values: %s", values); opal_asprintf (out[0] + line++, "Valid values: %s", values);
free (values); free (values);
} }
} }
@ -2274,7 +2275,7 @@ int mca_base_var_dump(int vari, char ***out, mca_base_var_dump_type_t output_typ
return OPAL_ERR_OUT_OF_RESOURCE; return OPAL_ERR_OUT_OF_RESOURCE;
} }
asprintf(out[0], "%s=%s (%s)", var->mbv_full_name, value_string, source_string); opal_asprintf(out[0], "%s=%s (%s)", var->mbv_full_name, value_string, source_string);
} }
free (value_string); free (value_string);

Просмотреть файл

@ -16,6 +16,7 @@
* Copyright (c) 2017 Research Organization for Information Science * Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -29,6 +30,7 @@
#include "opal/mca/base/mca_base_vari.h" #include "opal/mca/base/mca_base_vari.h"
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/printf.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -277,7 +279,7 @@ static int mca_base_var_enum_verbose_sfv (mca_base_var_enum_t *self, const int v
} }
if (string_value) { if (string_value) {
ret = asprintf (string_value, "%d", value); ret = opal_asprintf (string_value, "%d", value);
if (0 > ret) { if (0 > ret) {
return OPAL_ERR_OUT_OF_RESOURCE; return OPAL_ERR_OUT_OF_RESOURCE;
} }
@ -296,7 +298,7 @@ static int mca_base_var_enum_verbose_dump (mca_base_var_enum_t *self, char **out
return ret; return ret;
} }
ret = asprintf (&tmp, "%s, 0 - 100", *out); ret = opal_asprintf (&tmp, "%s, 0 - 100", *out);
free (*out); free (*out);
if (0 > ret) { if (0 > ret) {
*out = NULL; *out = NULL;
@ -419,7 +421,7 @@ static int enum_dump (mca_base_var_enum_t *self, char **out)
tmp = NULL; tmp = NULL;
for (i = 0; i < self->enum_value_count && self->enum_values[i].string ; ++i) { for (i = 0; i < self->enum_value_count && self->enum_values[i].string ; ++i) {
ret = asprintf (out, "%s%s%d:\"%s\"", tmp ? tmp : "", tmp ? ", " : "", self->enum_values[i].value, ret = opal_asprintf (out, "%s%s%d:\"%s\"", tmp ? tmp : "", tmp ? ", " : "", self->enum_values[i].value,
self->enum_values[i].string); self->enum_values[i].string);
if (tmp) free (tmp); if (tmp) free (tmp);
if (0 > ret) { if (0 > ret) {
@ -646,7 +648,7 @@ static int enum_string_from_value_flag (mca_base_var_enum_t *self, const int val
tmp = out; tmp = out;
ret = asprintf (&out, "%s%s%s", tmp ? tmp : "", tmp ? "," : "", flag_enum->enum_flags[i].string); ret = opal_asprintf (&out, "%s%s%s", tmp ? tmp : "", tmp ? "," : "", flag_enum->enum_flags[i].string);
free (tmp); free (tmp);
if (0 > ret) { if (0 > ret) {
@ -695,7 +697,7 @@ static int enum_dump_flag (mca_base_var_enum_t *self, char **out)
for (int i = 0; i < self->enum_value_count ; ++i) { for (int i = 0; i < self->enum_value_count ; ++i) {
tmp = *out; tmp = *out;
ret = asprintf (out, "%s%s0x%x:\"%s\"", tmp, i ? ", " : " ", flag_enum->enum_flags[i].flag, ret = opal_asprintf (out, "%s%s0x%x:\"%s\"", tmp, i ? ", " : " ", flag_enum->enum_flags[i].flag,
flag_enum->enum_flags[i].string); flag_enum->enum_flags[i].string);
free (tmp); free (tmp);
if (0 > ret) { if (0 > ret) {

Просмотреть файл

@ -13,6 +13,7 @@
* Copyright (c) 2012 Los Alamos National Security, LLC. * Copyright (c) 2012 Los Alamos National Security, LLC.
* All rights reserved. * All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -27,6 +28,7 @@
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/proc.h" #include "opal/util/proc.h"
#include "opal/util/printf.h"
#include "base.h" #include "base.h"
#include "btl_base_error.h" #include "btl_base_error.h"
@ -63,7 +65,7 @@ void mca_btl_base_error_no_nics(const char* transport,
char *procid; char *procid;
if (mca_btl_base_warn_component_unused) { if (mca_btl_base_warn_component_unused) {
/* print out no-nic warning if user told us to */ /* print out no-nic warning if user told us to */
asprintf(&procid, "%s", OPAL_NAME_PRINT(OPAL_PROC_MY_NAME)); opal_asprintf(&procid, "%s", OPAL_NAME_PRINT(OPAL_PROC_MY_NAME));
opal_show_help("help-mpi-btl-base.txt", "btl:no-nics", opal_show_help("help-mpi-btl-base.txt", "btl:no-nics",
true, procid, transport, opal_process_info.nodename, true, procid, transport, opal_process_info.nodename,

Просмотреть файл

@ -14,6 +14,7 @@
* reserved. * reserved.
* Copyright (c) 2018 Intel, Inc, All rights reserved * Copyright (c) 2018 Intel, Inc, All rights reserved
* *
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -24,6 +25,8 @@
#include "opal_config.h" #include "opal_config.h"
#include "opal/util/printf.h"
#include "opal/mca/btl/btl.h" #include "opal/mca/btl/btl.h"
#include "opal/mca/btl/base/base.h" #include "opal/mca/btl/base/base.h"
#include "opal/mca/hwloc/base/base.h" #include "opal/mca/hwloc/base/base.h"
@ -88,7 +91,7 @@ static int mca_btl_ofi_component_register(void)
char *msg; char *msg;
mca_btl_ofi_module_t *module = &mca_btl_ofi_module_template; mca_btl_ofi_module_t *module = &mca_btl_ofi_module_template;
asprintf(&msg, "BTL OFI mode of operation. Valid values are: %d = One-Sided only, %d=Two-Sided only, " opal_asprintf(&msg, "BTL OFI mode of operation. Valid values are: %d = One-Sided only, %d=Two-Sided only, "
"%d = Both one and two sided. BTL OFI is only optimized for one-sided communication", "%d = Both one and two sided. BTL OFI is only optimized for one-sided communication",
MCA_BTL_OFI_MODE_ONE_SIDED, MCA_BTL_OFI_MODE_ONE_SIDED,
MCA_BTL_OFI_MODE_TWO_SIDED, MCA_BTL_OFI_MODE_TWO_SIDED,

Просмотреть файл

@ -14,6 +14,7 @@
* reserved. * reserved.
* Copyright (c) 2018 Intel, Inc, All rights reserved * Copyright (c) 2018 Intel, Inc, All rights reserved
* *
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -24,6 +25,7 @@
#include "opal_config.h" #include "opal_config.h"
#include <string.h> #include <string.h>
#include "opal/class/opal_bitmap.h" #include "opal/class/opal_bitmap.h"
#include "opal/util/printf.h"
#include "opal/mca/btl/btl.h" #include "opal/mca/btl/btl.h"
#include "opal/datatype/opal_convertor.h" #include "opal/datatype/opal_convertor.h"
#include "opal/mca/mpool/base/base.h" #include "opal/mca/mpool/base/base.h"
@ -138,7 +140,7 @@ void mca_btl_ofi_rcache_init (mca_btl_ofi_module_t *module)
mca_rcache_base_resources_t rcache_resources; mca_rcache_base_resources_t rcache_resources;
char *tmp; char *tmp;
(void) asprintf (&tmp, "ofi.%s", module->linux_device_name); (void) opal_asprintf (&tmp, "ofi.%s", module->linux_device_name);
rcache_resources.cache_name = tmp; rcache_resources.cache_name = tmp;
rcache_resources.reg_data = (void *) module; rcache_resources.reg_data = (void *) module;

Просмотреть файл

@ -22,6 +22,7 @@
* Copyright (c) 2014-2015 Research Organization for Information Science * Copyright (c) 2014-2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2014 Bull SAS. All rights reserved * Copyright (c) 2014 Bull SAS. All rights reserved
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -36,6 +37,7 @@
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/arch.h" #include "opal/util/arch.h"
#include "opal/util/proc.h" #include "opal/util/proc.h"
#include "opal/util/printf.h"
#include "opal/include/opal_stdint.h" #include "opal/include/opal_stdint.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/mca/btl/btl.h" #include "opal/mca/btl/btl.h"
@ -144,11 +146,11 @@ void mca_btl_openib_show_init_error(const char *file, int line,
ret = -1; ret = -1;
#endif #endif
if (0 != ret) { if (0 != ret) {
asprintf(&str_limit, "Unknown"); opal_asprintf(&str_limit, "Unknown");
} else if (limit.rlim_cur == RLIM_INFINITY) { } else if (limit.rlim_cur == RLIM_INFINITY) {
asprintf(&str_limit, "unlimited"); opal_asprintf(&str_limit, "unlimited");
} else { } else {
asprintf(&str_limit, "%ld", (long)limit.rlim_cur); opal_asprintf(&str_limit, "%ld", (long)limit.rlim_cur);
} }
opal_show_help("help-mpi-btl-openib.txt", "init-fail-no-mem", opal_show_help("help-mpi-btl-openib.txt", "init-fail-no-mem",

Просмотреть файл

@ -22,6 +22,7 @@
* Copyright (c) 2014-2017 Research Organization for Information Science * Copyright (c) 2014-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2014 Bull SAS. All rights reserved. * Copyright (c) 2014 Bull SAS. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -64,6 +65,7 @@
#include "opal/mca/installdirs/installdirs.h" #include "opal/mca/installdirs/installdirs.h"
#include "opal_stdint.h" #include "opal_stdint.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include "opal/mca/btl/btl.h" #include "opal/mca/btl/btl.h"
#include "opal/mca/btl/base/base.h" #include "opal/mca/btl/base/base.h"
#include "opal/mca/mpool/base/base.h" #include "opal/mca/mpool/base/base.h"
@ -1861,7 +1863,7 @@ static int init_one_device(opal_list_t *btl_list, struct ibv_device* ib_dev)
"eager RDMA and progress threads", true); "eager RDMA and progress threads", true);
} }
asprintf (&rcache_resources.cache_name, "verbs.%" PRIu64, device->ib_dev_attr.node_guid); opal_asprintf (&rcache_resources.cache_name, "verbs.%" PRIu64, device->ib_dev_attr.node_guid);
rcache_resources.reg_data = (void*)device; rcache_resources.reg_data = (void*)device;
rcache_resources.sizeof_reg = sizeof(mca_btl_openib_reg_t); rcache_resources.sizeof_reg = sizeof(mca_btl_openib_reg_t);
rcache_resources.register_mem = openib_reg_mr; rcache_resources.register_mem = openib_reg_mr;

Просмотреть файл

@ -20,6 +20,7 @@
* Copyright (c) 2014-2016 Research Organization for Information Science * Copyright (c) 2014-2016 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -31,6 +32,7 @@
#include <string.h> #include <string.h>
#include "opal/util/bit_ops.h" #include "opal/util/bit_ops.h"
#include "opal/util/printf.h"
#include "opal/mca/common/verbs/common_verbs.h" #include "opal/mca/common/verbs/common_verbs.h"
#include "opal/mca/installdirs/installdirs.h" #include "opal/mca/installdirs/installdirs.h"
#include "opal/util/os_dirpath.h" #include "opal/util/os_dirpath.h"
@ -267,7 +269,7 @@ int btl_openib_register_mca_params(void)
MCA_BTL_OPENIB_CQ_POLL_BATCH_DEFAULT, &mca_btl_openib_component.cq_poll_batch, MCA_BTL_OPENIB_CQ_POLL_BATCH_DEFAULT, &mca_btl_openib_component.cq_poll_batch,
REGINT_GE_ONE)); REGINT_GE_ONE));
asprintf(&str, "%s/mca-btl-openib-device-params.ini", opal_asprintf(&str, "%s/mca-btl-openib-device-params.ini",
opal_install_dirs.opaldatadir); opal_install_dirs.opaldatadir);
if (NULL == str) { if (NULL == str) {
return OPAL_ERR_OUT_OF_RESOURCE; return OPAL_ERR_OUT_OF_RESOURCE;
@ -369,7 +371,7 @@ int btl_openib_register_mca_params(void)
"(must be >= 0)", "(must be >= 0)",
4, &mca_btl_openib_component.ib_qp_ous_rd_atom, 0)); 4, &mca_btl_openib_component.ib_qp_ous_rd_atom, 0));
asprintf(&msg, "OpenFabrics MTU, in bytes (if not specified in INI files). Valid values are: %d=256 bytes, %d=512 bytes, %d=1024 bytes, %d=2048 bytes, %d=4096 bytes", opal_asprintf(&msg, "OpenFabrics MTU, in bytes (if not specified in INI files). Valid values are: %d=256 bytes, %d=512 bytes, %d=1024 bytes, %d=2048 bytes, %d=4096 bytes",
IBV_MTU_256, IBV_MTU_256,
IBV_MTU_512, IBV_MTU_512,
IBV_MTU_1024, IBV_MTU_1024,
@ -645,7 +647,7 @@ int btl_openib_register_mca_params(void)
mid_qp_size = 1024; mid_qp_size = 1024;
} }
asprintf(&default_qps, opal_asprintf(&default_qps,
"S,128,256,192,128:S,%u,1024,1008,64:S,%u,1024,1008,64:S,%u,1024,1008,64", "S,128,256,192,128:S,%u,1024,1008,64:S,%u,1024,1008,64:S,%u,1024,1008,64",
mid_qp_size, mid_qp_size,
(uint32_t)mca_btl_openib_module.super.btl_eager_limit, (uint32_t)mca_btl_openib_module.super.btl_eager_limit,

Просмотреть файл

@ -8,6 +8,7 @@
* Copyright (c) 2014 Bull SAS. All rights reserved. * Copyright (c) 2014 Bull SAS. All rights reserved.
* Copyright (c) 2016 Los Alamos National Security, LLC. All rights * Copyright (c) 2016 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -28,6 +29,7 @@
#include <dlfcn.h> #include <dlfcn.h>
#include "opal/mca/btl/base/base.h" #include "opal/mca/btl/base/base.h"
#include "opal/util/printf.h"
#include "btl_openib_xrc.h" #include "btl_openib_xrc.h"
#include "btl_openib.h" #include "btl_openib.h"
@ -53,7 +55,7 @@ int mca_btl_openib_open_xrc_domain(struct mca_btl_openib_device_t *device)
#endif #endif
dev_name = ibv_get_device_name(device->ib_dev); dev_name = ibv_get_device_name(device->ib_dev);
len = asprintf(&xrc_file_name, len = opal_asprintf(&xrc_file_name,
"%s"OPAL_PATH_SEP"openib_xrc_domain_%s", "%s"OPAL_PATH_SEP"openib_xrc_domain_%s",
opal_process_info.job_session_dir, dev_name); opal_process_info.job_session_dir, dev_name);
if (0 > len) { if (0 > len) {

Просмотреть файл

@ -8,6 +8,7 @@
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* *
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -31,6 +32,7 @@
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/proc.h" #include "opal/util/proc.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include "opal/util/sys_limits.h" #include "opal/util/sys_limits.h"
#include "opal/align.h" #include "opal/align.h"
@ -90,7 +92,7 @@ int opal_btl_openib_connect_base_register(void)
} }
all_cpc_names = opal_argv_join(temp, ','); all_cpc_names = opal_argv_join(temp, ',');
opal_argv_free(temp); opal_argv_free(temp);
asprintf(&string, opal_asprintf(&string,
"Method used to select OpenFabrics connections (valid values: %s)", "Method used to select OpenFabrics connections (valid values: %s)",
all_cpc_names); all_cpc_names);
@ -102,7 +104,7 @@ int opal_btl_openib_connect_base_register(void)
&btl_openib_cpc_include); &btl_openib_cpc_include);
free(string); free(string);
asprintf(&string, opal_asprintf(&string,
"Method used to exclude OpenFabrics connections (valid values: %s)", "Method used to exclude OpenFabrics connections (valid values: %s)",
all_cpc_names); all_cpc_names);

Просмотреть файл

@ -12,6 +12,7 @@
* of Tennessee Research Foundation. All rights * of Tennessee Research Foundation. All rights
* reserved. * reserved.
* *
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -55,6 +56,7 @@
#include "opal/util/error.h" #include "opal/util/error.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/proc.h" #include "opal/util/proc.h"
#include "opal/util/printf.h"
#include "opal/runtime/opal_progress_threads.h" #include "opal/runtime/opal_progress_threads.h"
#include "btl_openib_proc.h" #include "btl_openib_proc.h"
@ -351,7 +353,7 @@ static void rdmacm_component_register(void)
static char *stringify(uint32_t addr) static char *stringify(uint32_t addr)
{ {
char *line = (char *) malloc(64); char *line = (char *) malloc(64);
asprintf(&line, "%d.%d.%d.%d (0x%x)", opal_asprintf(&line, "%d.%d.%d.%d (0x%x)",
#if defined(WORDS_BIGENDIAN) #if defined(WORDS_BIGENDIAN)
(addr >> 24), (addr >> 24),
(addr >> 16) & 0xff, (addr >> 16) & 0xff,

Просмотреть файл

@ -16,6 +16,7 @@
* reserved. * reserved.
* Copyright (c) 2011-2015 NVIDIA Corporation. All rights reserved. * Copyright (c) 2011-2015 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -46,6 +47,7 @@
#include "opal/util/bit_ops.h" #include "opal/util/bit_ops.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include "opal/mca/mpool/base/base.h" #include "opal/mca/mpool/base/base.h"
#include "opal/mca/common/sm/common_sm.h" #include "opal/mca/common/sm/common_sm.h"
@ -438,28 +440,28 @@ set_uniq_paths_for_init_rndv(mca_btl_smcuda_component_t *comp_ptr)
comp_ptr->sm_ctl_file_name = NULL; comp_ptr->sm_ctl_file_name = NULL;
comp_ptr->sm_rndv_file_name = NULL; comp_ptr->sm_rndv_file_name = NULL;
if (asprintf(&comp_ptr->sm_mpool_ctl_file_name, if (opal_asprintf(&comp_ptr->sm_mpool_ctl_file_name,
"%s"OPAL_PATH_SEP"shared_mem_cuda_pool.%s", "%s"OPAL_PATH_SEP"shared_mem_cuda_pool.%s",
opal_process_info.job_session_dir, opal_process_info.job_session_dir,
opal_process_info.nodename) < 0) { opal_process_info.nodename) < 0) {
/* rc set */ /* rc set */
goto out; goto out;
} }
if (asprintf(&comp_ptr->sm_mpool_rndv_file_name, if (opal_asprintf(&comp_ptr->sm_mpool_rndv_file_name,
"%s"OPAL_PATH_SEP"shared_mem_cuda_pool_rndv.%s", "%s"OPAL_PATH_SEP"shared_mem_cuda_pool_rndv.%s",
opal_process_info.job_session_dir, opal_process_info.job_session_dir,
opal_process_info.nodename) < 0) { opal_process_info.nodename) < 0) {
/* rc set */ /* rc set */
goto out; goto out;
} }
if (asprintf(&comp_ptr->sm_ctl_file_name, if (opal_asprintf(&comp_ptr->sm_ctl_file_name,
"%s"OPAL_PATH_SEP"shared_mem_cuda_btl_module.%s", "%s"OPAL_PATH_SEP"shared_mem_cuda_btl_module.%s",
opal_process_info.job_session_dir, opal_process_info.job_session_dir,
opal_process_info.nodename) < 0) { opal_process_info.nodename) < 0) {
/* rc set */ /* rc set */
goto out; goto out;
} }
if (asprintf(&comp_ptr->sm_rndv_file_name, if (opal_asprintf(&comp_ptr->sm_rndv_file_name,
"%s"OPAL_PATH_SEP"shared_mem_cuda_btl_rndv.%s", "%s"OPAL_PATH_SEP"shared_mem_cuda_btl_rndv.%s",
opal_process_info.job_session_dir, opal_process_info.job_session_dir,
opal_process_info.nodename) < 0) { opal_process_info.nodename) < 0) {

Просмотреть файл

@ -19,6 +19,7 @@
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved. * Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2017 Research Organization for Information Science * Copyright (c) 2014-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -68,6 +69,7 @@
#include "opal/util/net.h" #include "opal/util/net.h"
#include "opal/util/fd.h" #include "opal/util/fd.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include "opal/constants.h" #include "opal/constants.h"
#include "opal/mca/btl/btl.h" #include "opal/mca/btl/btl.h"
#include "opal/mca/btl/base/base.h" #include "opal/mca/btl/base/base.h"
@ -278,7 +280,7 @@ static int mca_btl_tcp_component_register(void)
"The minimum port where the TCP BTL will try to bind (default 1024)", "The minimum port where the TCP BTL will try to bind (default 1024)",
1024, OPAL_INFO_LVL_2, &mca_btl_tcp_component.tcp_port_min); 1024, OPAL_INFO_LVL_2, &mca_btl_tcp_component.tcp_port_min);
asprintf( &message, opal_asprintf( &message,
"The number of ports where the TCP BTL will try to bind (default %d)." "The number of ports where the TCP BTL will try to bind (default %d)."
" This parameter together with the port min, define a range of ports" " This parameter together with the port min, define a range of ports"
" where Open MPI will open sockets.", " where Open MPI will open sockets.",
@ -291,7 +293,7 @@ static int mca_btl_tcp_component_register(void)
mca_btl_tcp_param_register_int( "port_min_v6", mca_btl_tcp_param_register_int( "port_min_v6",
"The minimum port where the TCP BTL will try to bind (default 1024)", 1024, "The minimum port where the TCP BTL will try to bind (default 1024)", 1024,
OPAL_INFO_LVL_2, & mca_btl_tcp_component.tcp6_port_min ); OPAL_INFO_LVL_2, & mca_btl_tcp_component.tcp6_port_min );
asprintf( &message, opal_asprintf( &message,
"The number of ports where the TCP BTL will try to bind (default %d)." "The number of ports where the TCP BTL will try to bind (default %d)."
" This parameter together with the port min, define a range of ports" " This parameter together with the port min, define a range of ports"
" where Open MPI will open sockets.", " where Open MPI will open sockets.",

Просмотреть файл

@ -14,6 +14,7 @@
* Copyright (c) 2014 Intel, Inc. All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -54,6 +55,7 @@
#include "opal/util/net.h" #include "opal/util/net.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/proc.h" #include "opal/util/proc.h"
#include "opal/util/printf.h"
#include "opal/mca/btl/base/btl_base_error.h" #include "opal/mca/btl/base/btl_base_error.h"
#include "btl_tcp.h" #include "btl_tcp.h"
@ -850,7 +852,7 @@ static int mca_btl_tcp_endpoint_complete_connect(mca_btl_base_endpoint_t* btl_en
} }
if(so_error != 0) { if(so_error != 0) {
char *msg; char *msg;
asprintf(&msg, "connect() to %s:%d failed", opal_asprintf(&msg, "connect() to %s:%d failed",
opal_net_get_hostname((struct sockaddr*) &endpoint_addr), opal_net_get_hostname((struct sockaddr*) &endpoint_addr),
ntohs(((struct sockaddr_in*) &endpoint_addr)->sin_port)); ntohs(((struct sockaddr_in*) &endpoint_addr)->sin_port));
opal_show_help("help-mpi-btl-tcp.txt", "client connect fail", opal_show_help("help-mpi-btl-tcp.txt", "client connect fail",

Просмотреть файл

@ -17,6 +17,7 @@
* Copyright (c) 2015-2016 Los Alamos National Security, LLC. All rights * Copyright (c) 2015-2016 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2015-2018 Cisco Systems, Inc. All rights reserved * Copyright (c) 2015-2018 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -42,6 +43,7 @@
#include "opal/util/net.h" #include "opal/util/net.h"
#include "opal/util/proc.h" #include "opal/util/proc.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include "btl_tcp.h" #include "btl_tcp.h"
#include "btl_tcp_proc.h" #include "btl_tcp_proc.h"
@ -914,9 +916,9 @@ void mca_btl_tcp_proc_accept(mca_btl_tcp_proc_t* btl_proc, struct sockaddr* addr
(void*) &(btl_endpoint->endpoint_addr->addr_inet), (void*) &(btl_endpoint->endpoint_addr->addr_inet),
ip, sizeof(ip) - 1); ip, sizeof(ip) - 1);
if (NULL == addr_str) { if (NULL == addr_str) {
(void)asprintf(&tmp, "\n\t%s", ip); opal_asprintf(&tmp, "\n\t%s", ip);
} else { } else {
(void)asprintf(&tmp, "%s\n\t%s", addr_str, ip); opal_asprintf(&tmp, "%s\n\t%s", addr_str, ip);
free(addr_str); free(addr_str);
} }
addr_str = tmp; addr_str = tmp;

Просмотреть файл

@ -14,6 +14,7 @@
* reserved. * reserved.
* Copyright (c) 2018 Research Organization for Information Science * Copyright (c) 2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -28,6 +29,7 @@
#include "opal/mca/btl/base/base.h" #include "opal/mca/btl/base/base.h"
#include "opal/mca/hwloc/base/base.h" #include "opal/mca/hwloc/base/base.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/printf.h"
#include <string.h> #include <string.h>
@ -349,7 +351,7 @@ static int mca_btl_uct_component_process_uct_md (uct_md_resource_desc_t *md_desc
/* NTH: a registration cache shouldn't be necessary when using UCT but there are measurable /* NTH: a registration cache shouldn't be necessary when using UCT but there are measurable
* performance benefits to using rcache/grdma instead of assuming UCT will do the right * performance benefits to using rcache/grdma instead of assuming UCT will do the right
* thing. */ * thing. */
(void) asprintf (&tmp, "uct.%s", module->md_name); (void) opal_asprintf (&tmp, "uct.%s", module->md_name);
rcache_resources.cache_name = tmp; rcache_resources.cache_name = tmp;
rcache_resources.reg_data = (void *) module; rcache_resources.reg_data = (void *) module;

Просмотреть файл

@ -4,6 +4,7 @@
* reserved. * reserved.
* Copyright (c) 2011 UT-Battelle, LLC. All rights reserved. * Copyright (c) 2011 UT-Battelle, LLC. All rights reserved.
* Copyright (c) 2017 Intel, Inc. All rights reserved. * Copyright (c) 2017 Intel, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -17,6 +18,7 @@
#include "btl_ugni_smsg.h" #include "btl_ugni_smsg.h"
#include "opal/util/sys_limits.h" #include "opal/util/sys_limits.h"
#include "opal/util/printf.h"
#include <stdlib.h> #include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
@ -378,7 +380,7 @@ static int btl_ugni_component_register(void)
OBJ_RELEASE(new_enum); OBJ_RELEASE(new_enum);
if (mca_btl_ugni_ugni_page_size) { if (mca_btl_ugni_ugni_page_size) {
rc = asprintf (&mpool_hints_tmp, "page_size=%lu", mca_btl_ugni_ugni_page_size); rc = opal_asprintf (&mpool_hints_tmp, "page_size=%lu", mca_btl_ugni_ugni_page_size);
if (rc < 0) { if (rc < 0) {
return OPAL_ERR_OUT_OF_RESOURCE; return OPAL_ERR_OUT_OF_RESOURCE;
} }

Просмотреть файл

@ -2,6 +2,7 @@
* Copyright (c) 2014-2016 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2014-2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -28,6 +29,7 @@
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/fd.h" #include "opal/util/fd.h"
#include "opal/util/string_copy.h" #include "opal/util/string_copy.h"
#include "opal/util/printf.h"
#include "btl_usnic.h" #include "btl_usnic.h"
#include "btl_usnic_connectivity.h" #include "btl_usnic_connectivity.h"
@ -319,7 +321,7 @@ static void agent_sendto(int fd, char *buffer, ssize_t numbytes,
} }
char *msg; char *msg;
asprintf(&msg, "Unexpected sendto() error: errno=%d (%s)", opal_asprintf(&msg, "Unexpected sendto() error: errno=%d (%s)",
errno, strerror(errno)); errno, strerror(errno));
ABORT(msg); ABORT(msg);
/* Will not return */ /* Will not return */
@ -1176,7 +1178,7 @@ int opal_btl_usnic_connectivity_agent_init(void)
/* Will not return */ /* Will not return */
} }
asprintf(&ipc_filename, "%s/%s", opal_asprintf(&ipc_filename, "%s/%s",
opal_process_info.job_session_dir, CONNECTIVITY_SOCK_NAME); opal_process_info.job_session_dir, CONNECTIVITY_SOCK_NAME);
if (NULL == ipc_filename) { if (NULL == ipc_filename) {
OPAL_ERROR_LOG(OPAL_ERR_IN_ERRNO); OPAL_ERROR_LOG(OPAL_ERR_IN_ERRNO);

Просмотреть файл

@ -2,6 +2,7 @@
* Copyright (c) 2014-2016 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2014-2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -29,6 +30,7 @@
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/fd.h" #include "opal/util/fd.h"
#include "opal/util/string_copy.h" #include "opal/util/string_copy.h"
#include "opal/util/printf.h"
#include "btl_usnic.h" #include "btl_usnic.h"
#include "btl_usnic_module.h" #include "btl_usnic_module.h"
@ -62,7 +64,7 @@ int opal_btl_usnic_connectivity_client_init(void)
} }
char *ipc_filename = NULL; char *ipc_filename = NULL;
asprintf(&ipc_filename, "%s/%s", opal_asprintf(&ipc_filename, "%s/%s",
opal_process_info.job_session_dir, CONNECTIVITY_SOCK_NAME); opal_process_info.job_session_dir, CONNECTIVITY_SOCK_NAME);
if (NULL == ipc_filename) { if (NULL == ipc_filename) {
OPAL_ERROR_LOG(OPAL_ERR_IN_ERRNO); OPAL_ERROR_LOG(OPAL_ERR_IN_ERRNO);

Просмотреть файл

@ -18,6 +18,7 @@
* Copyright (c) 2014 Intel, Inc. All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -56,6 +57,7 @@
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/net.h" #include "opal/util/net.h"
#include "opal/util/if.h" #include "opal/util/if.h"
#include "opal/util/printf.h"
#include "opal/mca/base/mca_base_var.h" #include "opal/mca/base/mca_base_var.h"
#include "opal/mca/memchecker/base/base.h" #include "opal/mca/memchecker/base/base.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
@ -298,10 +300,10 @@ static int check_reg_mem_basics(void)
limit.rlim_cur == RLIM_INFINITY) { limit.rlim_cur == RLIM_INFINITY) {
return OPAL_SUCCESS; return OPAL_SUCCESS;
} else { } else {
asprintf(&str_limit, "%ld", (long)limit.rlim_cur); opal_asprintf(&str_limit, "%ld", (long)limit.rlim_cur);
} }
} else { } else {
asprintf(&str_limit, "Unknown"); opal_asprintf(&str_limit, "Unknown");
} }
opal_show_help("help-mpi-btl-usnic.txt", "check_reg_mem_basics fail", opal_show_help("help-mpi-btl-usnic.txt", "check_reg_mem_basics fail",

Просмотреть файл

@ -1,6 +1,7 @@
/* /*
* Copyright (c) 2013-2016 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013-2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved * Copyright (c) 2014 Intel, Inc. All rights reserved
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -15,6 +16,7 @@
#include <unistd.h> #include <unistd.h>
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include "btl_usnic_compat.h" #include "btl_usnic_compat.h"
#include "btl_usnic.h" #include "btl_usnic.h"
@ -242,7 +244,7 @@ void opal_btl_usnic_connectivity_map(void)
/* Filename is of the form: <prefix>-<hostname>.<pid>.<job>.<MCW /* Filename is of the form: <prefix>-<hostname>.<pid>.<job>.<MCW
rank>.txt */ rank>.txt */
asprintf(&filename, "%s-%s.pid%d.job%d.mcwrank%d.txt", opal_asprintf(&filename, "%s-%s.pid%d.job%d.mcwrank%d.txt",
mca_btl_usnic_component.connectivity_map_prefix, mca_btl_usnic_component.connectivity_map_prefix,
opal_get_proc_hostname(opal_proc_local_get()), opal_get_proc_hostname(opal_proc_local_get()),
getpid(), getpid(),

Просмотреть файл

@ -16,6 +16,7 @@
* Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights * Copyright (c) 2014-2016 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved * Copyright (c) 2014 Intel, Inc. All rights reserved
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -37,6 +38,7 @@
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/datatype/opal_convertor.h" #include "opal/datatype/opal_convertor.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include "opal/mca/memchecker/base/base.h" #include "opal/mca/memchecker/base/base.h"
#if BTL_IN_OPAL #if BTL_IN_OPAL
@ -2204,7 +2206,7 @@ static int init_mpool(opal_btl_usnic_module_t *module)
module->super.btl_mpool = module->super.btl_mpool =
mca_mpool_base_module_lookup (mca_btl_usnic_component.usnic_mpool_hints); mca_mpool_base_module_lookup (mca_btl_usnic_component.usnic_mpool_hints);
#else #else
asprintf(&mpool_resources.pool_name, "%s", opal_asprintf(&mpool_resources.pool_name, "%s",
module->linux_device_name); module->linux_device_name);
module->super.btl_mpool = module->super.btl_mpool =
mca_mpool_base_module_create(mca_btl_usnic_component.usnic_mpool_name, mca_mpool_base_module_create(mca_btl_usnic_component.usnic_mpool_name,

Просмотреть файл

@ -1,5 +1,6 @@
/* /*
* Copyright (c) 2013-2017 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013-2017 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -13,6 +14,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/printf.h"
#include "opal/mca/base/mca_base_var.h" #include "opal/mca/base/mca_base_var.h"
#include "opal/mca/base/mca_base_pvar.h" #include "opal/mca/base/mca_base_pvar.h"
@ -410,7 +412,7 @@ static void setup_mpit_pvars_enum(void)
c = (unsigned char*) &sin->sin_addr.s_addr; c = (unsigned char*) &sin->sin_addr.s_addr;
devices[i].value = i; devices[i].value = i;
rc = asprintf(&str, "%s,%hhu.%hhu.%hhu.%hhu/%" PRIu32, rc = opal_asprintf(&str, "%s,%hhu.%hhu.%hhu.%hhu/%" PRIu32,
m->linux_device_name, m->linux_device_name,
c[0], c[1], c[2], c[3], c[0], c[1], c[2], c[3],
usnic_netmask_to_cidrlen(sin->sin_addr.s_addr)); usnic_netmask_to_cidrlen(sin->sin_addr.s_addr));

Просмотреть файл

@ -18,6 +18,7 @@
* Copyright (c) 2014-2018 Intel, Inc. All rights reserved. * Copyright (c) 2014-2018 Intel, Inc. All rights reserved.
* Copyright (c) 2014-2018 Research Organization for Information Science * Copyright (c) 2014-2018 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -28,6 +29,7 @@
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include "opal/threads/mutex.h" #include "opal/threads/mutex.h"
#include "opal/mca/btl/base/btl_base_error.h" #include "opal/mca/btl/base/btl_base_error.h"
@ -528,7 +530,7 @@ static mca_btl_base_module_t **mca_btl_vader_component_init (int *num_btls,
if (MCA_BTL_VADER_XPMEM != mca_btl_vader_component.single_copy_mechanism) { if (MCA_BTL_VADER_XPMEM != mca_btl_vader_component.single_copy_mechanism) {
char *sm_file; char *sm_file;
rc = asprintf(&sm_file, "%s" OPAL_PATH_SEP "vader_segment.%s.%x.%d", mca_btl_vader_component.backing_directory, rc = opal_asprintf(&sm_file, "%s" OPAL_PATH_SEP "vader_segment.%s.%x.%d", mca_btl_vader_component.backing_directory,
opal_process_info.nodename, OPAL_PROC_MY_NAME.jobid, MCA_BTL_VADER_LOCAL_RANK); opal_process_info.nodename, OPAL_PROC_MY_NAME.jobid, MCA_BTL_VADER_LOCAL_RANK);
if (0 > rc) { if (0 > rc) {
free (btls); free (btls);

Просмотреть файл

@ -13,6 +13,7 @@
* Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -37,6 +38,7 @@
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/proc.h" #include "opal/util/proc.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/printf.h"
#include "opal/mca/rcache/base/base.h" #include "opal/mca/rcache/base/base.h"
#include "opal/runtime/opal_params.h" #include "opal/runtime/opal_params.h"
@ -388,7 +390,7 @@ int mca_common_cuda_stage_one_init(void)
/* If there's a non-empty search path, prepend it /* If there's a non-empty search path, prepend it
to the library filename */ to the library filename */
if (strlen(searchpaths[j]) > 0) { if (strlen(searchpaths[j]) > 0) {
asprintf(&filename, "%s/%s", searchpaths[j], cudalibs[i]); opal_asprintf(&filename, "%s/%s", searchpaths[j], cudalibs[i]);
} else { } else {
filename = strdup(cudalibs[i]); filename = strdup(cudalibs[i]);
} }

Просмотреть файл

@ -14,6 +14,7 @@
* All rights reserved. * All rights reserved.
* Copyright (c) 2011-2014 NVIDIA Corporation. All rights reserved. * Copyright (c) 2011-2014 NVIDIA Corporation. All rights reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved * Copyright (c) 2015 Intel, Inc. All rights reserved
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -23,6 +24,7 @@
#include "opal_config.h" #include "opal_config.h"
#include <string.h> #include <string.h>
#include "opal/util/printf.h"
#include "common_sm_mpool.h" #include "common_sm_mpool.h"
#include "opal/mca/common/sm/common_sm.h" #include "opal/mca/common/sm/common_sm.h"
#include "opal/mca/common/cuda/common_cuda.h" #include "opal/mca/common/cuda/common_cuda.h"
@ -222,7 +224,7 @@ int mca_common_sm_mpool_ft_event(int state) {
if(OPAL_CRS_CHECKPOINT == state) { if(OPAL_CRS_CHECKPOINT == state) {
/* Record the shared memory filename */ /* Record the shared memory filename */
asprintf( &file_name, "%s"OPAL_PATH_SEP"shared_mem_pool.%s", opal_asprintf( &file_name, "%s"OPAL_PATH_SEP"shared_mem_pool.%s",
opal_process_info.job_session_dir, opal_process_info.job_session_dir,
opal_proc_local_get()->proc_hostname ); opal_proc_local_get()->proc_hostname );
/* Disabled to get FT code compiled again /* Disabled to get FT code compiled again

Просмотреть файл

@ -1,6 +1,7 @@
/* /*
* Copyright (c) 2012-2016 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2012-2016 Cisco Systems, Inc. All rights reserved.
* *
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -42,6 +43,7 @@ const char *ibv_get_sysfs_path(void);
#include "opal/runtime/opal_params.h" #include "opal/runtime/opal_params.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/proc.h" #include "opal/util/proc.h"
#include "opal/util/printf.h"
/***********************************************************************/ /***********************************************************************/
@ -53,7 +55,7 @@ bool opal_common_verbs_check_basics(void)
struct stat s; struct stat s;
/* Check to see if $sysfsdir/class/infiniband/ exists */ /* Check to see if $sysfsdir/class/infiniband/ exists */
asprintf(&file, "%s/class/infiniband", ibv_get_sysfs_path()); opal_asprintf(&file, "%s/class/infiniband", ibv_get_sysfs_path());
if (NULL == file) { if (NULL == file) {
return false; return false;
} }

Просмотреть файл

@ -4,6 +4,7 @@
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* *
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -34,6 +35,7 @@
#include "opal/util/os_dirpath.h" #include "opal/util/os_dirpath.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/printf.h"
#include "opal/mca/compress/compress.h" #include "opal/mca/compress/compress.h"
#include "opal/mca/compress/base/base.h" #include "opal/mca/compress/base/base.h"
@ -54,12 +56,12 @@ int opal_compress_base_tar_create(char ** target)
pid_t child_pid = 0; pid_t child_pid = 0;
int status = 0; int status = 0;
asprintf(&tar_target, "%s.tar", *target); opal_asprintf(&tar_target, "%s.tar", *target);
child_pid = fork(); child_pid = fork();
if( 0 == child_pid ) { /* Child */ if( 0 == child_pid ) { /* Child */
char *cmd; char *cmd;
asprintf(&cmd, "tar -cf %s %s", tar_target, *target); opal_asprintf(&cmd, "tar -cf %s %s", tar_target, *target);
argv = opal_argv_split(cmd, ' '); argv = opal_argv_split(cmd, ' ');
status = execvp(argv[0], argv); status = execvp(argv[0], argv);
@ -101,7 +103,7 @@ int opal_compress_base_tar_extract(char ** target)
child_pid = fork(); child_pid = fork();
if( 0 == child_pid ) { /* Child */ if( 0 == child_pid ) { /* Child */
char *cmd; char *cmd;
asprintf(&cmd, "tar -xf %s", *target); opal_asprintf(&cmd, "tar -xf %s", *target);
argv = opal_argv_split(cmd, ' '); argv = opal_argv_split(cmd, ' ');
status = execvp(argv[0], argv); status = execvp(argv[0], argv);

Просмотреть файл

@ -6,6 +6,7 @@
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -27,6 +28,7 @@
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/printf.h"
#include "opal/constants.h" #include "opal/constants.h"
#include "opal/util/basename.h" #include "opal/util/basename.h"
@ -90,15 +92,15 @@ int opal_compress_bzip_compress_nb(char * fname, char **cname, char **postfix, p
if( is_dir ) { if( is_dir ) {
#if 0 #if 0
opal_compress_base_tar_create(&base_fname); opal_compress_base_tar_create(&base_fname);
asprintf(cname, "%s.bz2", base_fname); opal_asprintf(cname, "%s.bz2", base_fname);
asprintf(&cmd, "bzip2 %s", base_fname); opal_asprintf(&cmd, "bzip2 %s", base_fname);
#else #else
asprintf(cname, "%s.tar.bz2", base_fname); opal_asprintf(cname, "%s.tar.bz2", base_fname);
asprintf(&cmd, "tar -jcf %s %s", *cname, base_fname); opal_asprintf(&cmd, "tar -jcf %s %s", *cname, base_fname);
#endif #endif
} else { } else {
asprintf(cname, "%s.bz2", base_fname); opal_asprintf(cname, "%s.bz2", base_fname);
asprintf(&cmd, "bzip2 %s", base_fname); opal_asprintf(&cmd, "bzip2 %s", base_fname);
} }
opal_output_verbose(10, mca_compress_bzip_component.super.output_handle, opal_output_verbose(10, mca_compress_bzip_component.super.output_handle,
@ -120,7 +122,7 @@ int opal_compress_bzip_compress_nb(char * fname, char **cname, char **postfix, p
} else { } else {
*postfix = strdup(".bz2"); *postfix = strdup(".bz2");
} }
asprintf(cname, "%s%s", fname, *postfix); opal_asprintf(cname, "%s%s", fname, *postfix);
} }
else { else {
return OPAL_ERROR; return OPAL_ERROR;
@ -181,7 +183,7 @@ int opal_compress_bzip_decompress_nb(char * cname, char **fname, pid_t *child_pi
loc_pid = fork(); loc_pid = fork();
if( loc_pid == 0 ) { /* Child */ if( loc_pid == 0 ) { /* Child */
char * cmd; char * cmd;
asprintf(&cmd, "bunzip2 %s", cname); opal_asprintf(&cmd, "bunzip2 %s", cname);
opal_output_verbose(10, mca_compress_bzip_component.super.output_handle, opal_output_verbose(10, mca_compress_bzip_component.super.output_handle,
"compress:bzip: decompress_nb() command [%s]", "compress:bzip: decompress_nb() command [%s]",

Просмотреть файл

@ -6,6 +6,7 @@
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -27,6 +28,7 @@
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/printf.h"
#include "opal/constants.h" #include "opal/constants.h"
#include "opal/util/basename.h" #include "opal/util/basename.h"
@ -90,15 +92,15 @@ int opal_compress_gzip_compress_nb(char * fname, char **cname, char **postfix, p
if( is_dir ) { if( is_dir ) {
#if 0 #if 0
opal_compress_base_tar_create(&base_fname); opal_compress_base_tar_create(&base_fname);
asprintf(cname, "%s.gz", base_fname); opal_asprintf(cname, "%s.gz", base_fname);
asprintf(&cmd, "gzip %s", base_fname); opal_asprintf(&cmd, "gzip %s", base_fname);
#else #else
asprintf(cname, "%s.tar.gz", base_fname); opal_asprintf(cname, "%s.tar.gz", base_fname);
asprintf(&cmd, "tar -zcf %s %s", *cname, base_fname); opal_asprintf(&cmd, "tar -zcf %s %s", *cname, base_fname);
#endif #endif
} else { } else {
asprintf(cname, "%s.gz", base_fname); opal_asprintf(cname, "%s.gz", base_fname);
asprintf(&cmd, "gzip %s", base_fname); opal_asprintf(&cmd, "gzip %s", base_fname);
} }
opal_output_verbose(10, mca_compress_gzip_component.super.output_handle, opal_output_verbose(10, mca_compress_gzip_component.super.output_handle,
@ -120,7 +122,7 @@ int opal_compress_gzip_compress_nb(char * fname, char **cname, char **postfix, p
} else { } else {
*postfix = strdup(".gz"); *postfix = strdup(".gz");
} }
asprintf(cname, "%s%s", fname, *postfix); opal_asprintf(cname, "%s%s", fname, *postfix);
} }
else { else {
@ -184,7 +186,7 @@ int opal_compress_gzip_decompress_nb(char * cname, char **fname, pid_t *child_pi
/* Fork(gunzip) */ /* Fork(gunzip) */
loc_pid = fork(); loc_pid = fork();
if( loc_pid == 0 ) { /* Child */ if( loc_pid == 0 ) { /* Child */
asprintf(&cmd, "gunzip %s", cname); opal_asprintf(&cmd, "gunzip %s", cname);
opal_output_verbose(10, mca_compress_gzip_component.super.output_handle, opal_output_verbose(10, mca_compress_gzip_component.super.output_handle,
"compress:gzip: decompress_nb() command [%s]", "compress:gzip: decompress_nb() command [%s]",

Просмотреть файл

@ -11,6 +11,7 @@
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
* *
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -33,6 +34,7 @@
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/printf.h"
#include "opal/constants.h" #include "opal/constants.h"
#include "opal/mca/base/mca_base_var.h" #include "opal/mca/base/mca_base_var.h"
@ -369,7 +371,7 @@ int opal_crs_blcr_checkpoint(pid_t pid,
if( opal_crs_blcr_dev_null ) { if( opal_crs_blcr_dev_null ) {
loc_fname = strdup("/dev/null"); loc_fname = strdup("/dev/null");
} else { } else {
asprintf(&loc_fname, "%s/%s", snapshot->super.snapshot_directory, snapshot->context_filename); opal_asprintf(&loc_fname, "%s/%s", snapshot->super.snapshot_directory, snapshot->context_filename);
} }
#if OPAL_ENABLE_CRDEBUG == 1 #if OPAL_ENABLE_CRDEBUG == 1
@ -711,7 +713,7 @@ static int opal_crs_blcr_restart_cmd(char *fname, char **cmd)
return OPAL_CRS_ERROR; return OPAL_CRS_ERROR;
} }
asprintf(cmd, "%s %s", blcr_restart_cmd, fname); opal_asprintf(cmd, "%s %s", blcr_restart_cmd, fname);
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
@ -721,7 +723,7 @@ static int blcr_get_checkpoint_filename(char **fname, pid_t pid)
opal_output_verbose(10, mca_crs_blcr_component.super.output_handle, opal_output_verbose(10, mca_crs_blcr_component.super.output_handle,
"crs:blcr: get_checkpoint_filename(--, %d)", pid); "crs:blcr: get_checkpoint_filename(--, %d)", pid);
asprintf(fname, "ompi_blcr_context.%d", pid); opal_asprintf(fname, "ompi_blcr_context.%d", pid);
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
@ -779,7 +781,7 @@ static int blcr_cold_start(opal_crs_blcr_snapshot_t *snapshot) {
exit_status = OPAL_ERROR; exit_status = OPAL_ERROR;
goto cleanup; goto cleanup;
} }
asprintf(&snapshot->context_filename, "%s/%s", snapshot->super.snapshot_directory, tmp_argv[0]); opal_asprintf(&snapshot->context_filename, "%s/%s", snapshot->super.snapshot_directory, tmp_argv[0]);
/* /*
* Reset the cold_start flag * Reset the cold_start flag

Просмотреть файл

@ -4,6 +4,7 @@
* Copyright (c) 2010-2011 Alex Brick <bricka@ccs.neu.edu>. * Copyright (c) 2010-2011 Alex Brick <bricka@ccs.neu.edu>.
* All rights reserved. * All rights reserved.
* *
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -26,6 +27,7 @@
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/printf.h"
#include "opal/constants.h" #include "opal/constants.h"
#include "opal/mca/base/mca_base_var.h" #include "opal/mca/base/mca_base_var.h"
@ -158,7 +160,7 @@ int opal_crs_dmtcp_module_init(void)
* sleep_between_ckpt callback. * sleep_between_ckpt callback.
*/ */
asprintf(&temp_checkpoint_name, "checkpoint.dmtcp.%ld", syscall(SYS_getpid)); opal_asprintf(&temp_checkpoint_name, "checkpoint.dmtcp.%ld", syscall(SYS_getpid));
mtcp_init(temp_checkpoint_name, 0, 1); mtcp_init(temp_checkpoint_name, 0, 1);
mtcp_ok(); mtcp_ok();
@ -527,7 +529,7 @@ static int dmtcp_cold_start(opal_crs_dmtcp_snapshot_t *snapshot) {
goto cleanup; goto cleanup;
} }
asprintf(&(snapshot->context_filename), "%s/%s", snapshot->super.snapshot_directory, tmp_argv[0]); opal_asprintf(&(snapshot->context_filename), "%s/%s", snapshot->super.snapshot_directory, tmp_argv[0]);
opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle, opal_output_verbose(10, mca_crs_dmtcp_component.super.output_handle,
"crs:dmtcp: cold_start(%s)", snapshot->context_filename); "crs:dmtcp: cold_start(%s)", snapshot->context_filename);
@ -559,11 +561,11 @@ static int dmtcp_cold_start(opal_crs_dmtcp_snapshot_t *snapshot) {
static int dmtcp_generate_full_ckpt_path(opal_crs_dmtcp_snapshot_t *snapshot) static int dmtcp_generate_full_ckpt_path(opal_crs_dmtcp_snapshot_t *snapshot)
{ {
int retval; int retval;
retval = asprintf(&(snapshot->context_filename), "ompi_dmtcp_context.%ld", syscall(SYS_getpid)); retval = opal_asprintf(&(snapshot->context_filename), "ompi_dmtcp_context.%ld", syscall(SYS_getpid));
if(retval == -1) if(retval == -1)
return -1; return -1;
return asprintf(&full_ckpt_path, "%s/%s", snapshot->super.snapshot_directory, snapshot->context_filename); return opal_asprintf(&full_ckpt_path, "%s/%s", snapshot->super.snapshot_directory, snapshot->context_filename);
} }
/** /**

Просмотреть файл

@ -11,6 +11,7 @@
* reserved. * reserved.
* Copyright (c) 2007 Evergrid, Inc. All rights reserved. * Copyright (c) 2007 Evergrid, Inc. All rights reserved.
* *
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -34,6 +35,7 @@
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/printf.h"
#include "opal/constants.h" #include "opal/constants.h"
#include "opal/mca/base/mca_base_var.h" #include "opal/mca/base/mca_base_var.h"
@ -565,7 +567,7 @@ static int crs_self_find_function(char *prefix, char *suffix,
"crs:self: crs_self_find_function(--, %s, %s)", "crs:self: crs_self_find_function(--, %s, %s)",
prefix, suffix); prefix, suffix);
asprintf(&func_to_find, "%s_%s", prefix, suffix); opal_asprintf(&func_to_find, "%s_%s", prefix, suffix);
/* The RTLD_DEFAULT is a special handle that searches the default libraries /* The RTLD_DEFAULT is a special handle that searches the default libraries
* including the current application for the indicated symbol. This allows * including the current application for the indicated symbol. This allows
@ -654,7 +656,7 @@ static int opal_crs_self_restart_cmd(opal_crs_self_snapshot_t *snapshot, char **
* add_args = strdup("-mca crs self -mca crs_self_do_restart 1"); * add_args = strdup("-mca crs self -mca crs_self_do_restart 1");
*/ */
asprintf(cmd, "%s", snapshot->cmd_line); opal_asprintf(cmd, "%s", snapshot->cmd_line);
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }
@ -713,7 +715,7 @@ static int self_cold_start(opal_crs_self_snapshot_t *snapshot) {
exit_status = OPAL_ERROR; exit_status = OPAL_ERROR;
goto cleanup; goto cleanup;
} }
asprintf(&snapshot->cmd_line, "%s", tmp_argv[0]); opal_asprintf(&snapshot->cmd_line, "%s", tmp_argv[0]);
/* /*
* Reset the cold_start flag * Reset the cold_start flag

Просмотреть файл

@ -4,6 +4,7 @@
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2016 IBM Corporation. All rights reserved. * Copyright (c) 2016 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -23,6 +24,7 @@
#include "opal/constants.h" #include "opal/constants.h"
#include "opal/mca/dl/dl.h" #include "opal/mca/dl/dl.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/printf.h"
#include "dl_dlopen.h" #include "dl_dlopen.h"
@ -74,7 +76,7 @@ static int dlopen_open(const char *fname, bool use_ext, bool private_namespace,
ext = mca_dl_dlopen_component.filename_suffixes[++i]) { ext = mca_dl_dlopen_component.filename_suffixes[++i]) {
char *name; char *name;
asprintf(&name, "%s%s", fname, ext); opal_asprintf(&name, "%s%s", fname, ext);
if (NULL == name) { if (NULL == name) {
return OPAL_ERR_IN_ERRNO; return OPAL_ERR_IN_ERRNO;
} }
@ -182,7 +184,7 @@ static int dlopen_foreachfile(const char *search_path,
/* Make the absolute path name */ /* Make the absolute path name */
char *abs_name = NULL; char *abs_name = NULL;
asprintf(&abs_name, "%s/%s", dirs[i], de->d_name); opal_asprintf(&abs_name, "%s/%s", dirs[i], de->d_name);
if (NULL == abs_name) { if (NULL == abs_name) {
ret = OPAL_ERR_IN_ERRNO; ret = OPAL_ERR_IN_ERRNO;
goto error; goto error;

Просмотреть файл

@ -6,6 +6,7 @@
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* *
* Copyright (c) 2017 Intel, Inc. All rights reserved. * Copyright (c) 2017 Intel, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -21,6 +22,7 @@
#include "event.h" #include "event.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/printf.h"
/* /*
* Public string showing the sysinfo ompi_linux component version number * Public string showing the sysinfo ompi_linux component version number
@ -88,7 +90,7 @@ static int event_external_register (void) {
#endif #endif
avail = opal_argv_join((char**)all_available_eventops, ','); avail = opal_argv_join((char**)all_available_eventops, ',');
asprintf( &help_msg, opal_asprintf( &help_msg,
"Comma-delimited list of libevent subsystems " "Comma-delimited list of libevent subsystems "
"to use (%s -- available on your platform)", "to use (%s -- available on your platform)",
avail ); avail );

Просмотреть файл

@ -5,6 +5,7 @@
* Copyright (c) 2015 Intel, Inc. All rights reserved. * Copyright (c) 2015 Intel, Inc. All rights reserved.
* *
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -20,6 +21,7 @@
#include "opal_config.h" #include "opal_config.h"
#include "opal/constants.h" #include "opal/constants.h"
#include "opal/util/printf.h"
#include "opal/mca/event/event.h" #include "opal/mca/event/event.h"
#include "libevent2022.h" #include "libevent2022.h"
@ -171,7 +173,7 @@ static int libevent2022_register (void)
ompi_event_module_include = "poll"; ompi_event_module_include = "poll";
#endif #endif
asprintf( &help_msg, opal_asprintf( &help_msg,
"Comma-delimited list of libevent subsystems " "Comma-delimited list of libevent subsystems "
"to use (%s -- available on your platform)", "to use (%s -- available on your platform)",
available_eventops ); available_eventops );

Просмотреть файл

@ -3,6 +3,7 @@
* Copyright (c) 2017 Research Organization for Information Science * Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* *
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -12,6 +13,7 @@
#include "opal/constants.h" #include "opal/constants.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/printf.h"
#include "opal/dss/dss.h" #include "opal/dss/dss.h"
#include "opal/mca/hwloc/base/base.h" #include "opal/mca/hwloc/base/base.h"
@ -243,13 +245,13 @@ static void print_hwloc_obj(char **output, char *prefix,
/* print the object type */ /* print the object type */
hwloc_obj_type_snprintf(string, 1024, obj, 1); hwloc_obj_type_snprintf(string, 1024, obj, 1);
asprintf(&pfx, "\n%s\t", (NULL == prefix) ? "" : prefix); opal_asprintf(&pfx, "\n%s\t", (NULL == prefix) ? "" : prefix);
asprintf(&tmp, "%sType: %s Number of child objects: %u%sName=%s", opal_asprintf(&tmp, "%sType: %s Number of child objects: %u%sName=%s",
(NULL == prefix) ? "" : prefix, string, obj->arity, (NULL == prefix) ? "" : prefix, string, obj->arity,
pfx, (NULL == obj->name) ? "NULL" : obj->name); pfx, (NULL == obj->name) ? "NULL" : obj->name);
if (0 < hwloc_obj_attr_snprintf(string, 1024, obj, pfx, 1)) { if (0 < hwloc_obj_attr_snprintf(string, 1024, obj, pfx, 1)) {
/* print the attributes */ /* print the attributes */
asprintf(&tmp2, "%s%s%s", tmp, pfx, string); opal_asprintf(&tmp2, "%s%s%s", tmp, pfx, string);
free(tmp); free(tmp);
tmp = tmp2; tmp = tmp2;
} }
@ -258,28 +260,28 @@ static void print_hwloc_obj(char **output, char *prefix,
*/ */
if (NULL != obj->cpuset) { if (NULL != obj->cpuset) {
hwloc_bitmap_snprintf(string, OPAL_HWLOC_MAX_STRING, obj->cpuset); hwloc_bitmap_snprintf(string, OPAL_HWLOC_MAX_STRING, obj->cpuset);
asprintf(&tmp2, "%s%sCpuset: %s", tmp, pfx, string); opal_asprintf(&tmp2, "%s%sCpuset: %s", tmp, pfx, string);
free(tmp); free(tmp);
tmp = tmp2; tmp = tmp2;
} }
if (HWLOC_OBJ_MACHINE == obj->type) { if (HWLOC_OBJ_MACHINE == obj->type) {
/* root level object - add support values */ /* root level object - add support values */
support = (struct hwloc_topology_support*)hwloc_topology_get_support(topo); support = (struct hwloc_topology_support*)hwloc_topology_get_support(topo);
asprintf(&tmp2, "%s%sBind CPU proc: %s%sBind CPU thread: %s", tmp, pfx, opal_asprintf(&tmp2, "%s%sBind CPU proc: %s%sBind CPU thread: %s", tmp, pfx,
(support->cpubind->set_thisproc_cpubind) ? "TRUE" : "FALSE", pfx, (support->cpubind->set_thisproc_cpubind) ? "TRUE" : "FALSE", pfx,
(support->cpubind->set_thisthread_cpubind) ? "TRUE" : "FALSE"); (support->cpubind->set_thisthread_cpubind) ? "TRUE" : "FALSE");
free(tmp); free(tmp);
tmp = tmp2; tmp = tmp2;
asprintf(&tmp2, "%s%sBind MEM proc: %s%sBind MEM thread: %s", tmp, pfx, opal_asprintf(&tmp2, "%s%sBind MEM proc: %s%sBind MEM thread: %s", tmp, pfx,
(support->membind->set_thisproc_membind) ? "TRUE" : "FALSE", pfx, (support->membind->set_thisproc_membind) ? "TRUE" : "FALSE", pfx,
(support->membind->set_thisthread_membind) ? "TRUE" : "FALSE"); (support->membind->set_thisthread_membind) ? "TRUE" : "FALSE");
free(tmp); free(tmp);
tmp = tmp2; tmp = tmp2;
} }
asprintf(&tmp2, "%s%s\n", (NULL == *output) ? "" : *output, tmp); opal_asprintf(&tmp2, "%s%s\n", (NULL == *output) ? "" : *output, tmp);
free(tmp); free(tmp);
free(pfx); free(pfx);
asprintf(&pfx, "%s\t", (NULL == prefix) ? "" : prefix); opal_asprintf(&pfx, "%s\t", (NULL == prefix) ? "" : prefix);
for (i=0; i < obj->arity; i++) { for (i=0; i < obj->arity; i++) {
obj2 = obj->children[i]; obj2 = obj->children[i];
/* print the object */ /* print the object */

Просмотреть файл

@ -18,6 +18,7 @@
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (C) 2018 Mellanox Technologies, Ltd. * Copyright (C) 2018 Mellanox Technologies, Ltd.
* All rights reserved. * All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -51,6 +52,7 @@
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/os_dirpath.h" #include "opal/util/os_dirpath.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include "opal/threads/tsd.h" #include "opal/threads/tsd.h"
#include "opal/mca/pmix/pmix.h" #include "opal/mca/pmix/pmix.h"
@ -2061,7 +2063,7 @@ char* opal_hwloc_base_get_topo_signature(hwloc_topology_t topo)
endian = "unknown"; endian = "unknown";
#endif #endif
asprintf(&sig, "%dN:%dS:%dL3:%dL2:%dL1:%dC:%dH:%s:%s", opal_asprintf(&sig, "%dN:%dS:%dL3:%dL2:%dL1:%dC:%dH:%s:%s",
nnuma, nsocket, nl3, nl2, nl1, ncore, nhwt, arch, endian); nnuma, nsocket, nl3, nl2, nl1, ncore, nhwt, arch, endian);
return sig; return sig;
} }
@ -2137,14 +2139,14 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo,
hwloc_bitmap_list_asprintf(&tmp, result); hwloc_bitmap_list_asprintf(&tmp, result);
switch(obj->type) { switch(obj->type) {
case HWLOC_OBJ_NODE: case HWLOC_OBJ_NODE:
asprintf(&t2, "%sNM%s:", (NULL == locality) ? "" : locality, tmp); opal_asprintf(&t2, "%sNM%s:", (NULL == locality) ? "" : locality, tmp);
if (NULL != locality) { if (NULL != locality) {
free(locality); free(locality);
} }
locality = t2; locality = t2;
break; break;
case HWLOC_OBJ_SOCKET: case HWLOC_OBJ_SOCKET:
asprintf(&t2, "%sSK%s:", (NULL == locality) ? "" : locality, tmp); opal_asprintf(&t2, "%sSK%s:", (NULL == locality) ? "" : locality, tmp);
if (NULL != locality) { if (NULL != locality) {
free(locality); free(locality);
} }
@ -2153,21 +2155,21 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo,
#if HWLOC_API_VERSION < 0x20000 #if HWLOC_API_VERSION < 0x20000
case HWLOC_OBJ_CACHE: case HWLOC_OBJ_CACHE:
if (3 == obj->attr->cache.depth) { if (3 == obj->attr->cache.depth) {
asprintf(&t2, "%sL3%s:", (NULL == locality) ? "" : locality, tmp); opal_asprintf(&t2, "%sL3%s:", (NULL == locality) ? "" : locality, tmp);
if (NULL != locality) { if (NULL != locality) {
free(locality); free(locality);
} }
locality = t2; locality = t2;
break; break;
} else if (2 == obj->attr->cache.depth) { } else if (2 == obj->attr->cache.depth) {
asprintf(&t2, "%sL2%s:", (NULL == locality) ? "" : locality, tmp); opal_asprintf(&t2, "%sL2%s:", (NULL == locality) ? "" : locality, tmp);
if (NULL != locality) { if (NULL != locality) {
free(locality); free(locality);
} }
locality = t2; locality = t2;
break; break;
} else { } else {
asprintf(&t2, "%sL1%s:", (NULL == locality) ? "" : locality, tmp); opal_asprintf(&t2, "%sL1%s:", (NULL == locality) ? "" : locality, tmp);
if (NULL != locality) { if (NULL != locality) {
free(locality); free(locality);
} }
@ -2177,21 +2179,21 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo,
break; break;
#else #else
case HWLOC_OBJ_L3CACHE: case HWLOC_OBJ_L3CACHE:
asprintf(&t2, "%sL3%s:", (NULL == locality) ? "" : locality, tmp); opal_asprintf(&t2, "%sL3%s:", (NULL == locality) ? "" : locality, tmp);
if (NULL != locality) { if (NULL != locality) {
free(locality); free(locality);
} }
locality = t2; locality = t2;
break; break;
case HWLOC_OBJ_L2CACHE: case HWLOC_OBJ_L2CACHE:
asprintf(&t2, "%sL2%s:", (NULL == locality) ? "" : locality, tmp); opal_asprintf(&t2, "%sL2%s:", (NULL == locality) ? "" : locality, tmp);
if (NULL != locality) { if (NULL != locality) {
free(locality); free(locality);
} }
locality = t2; locality = t2;
break; break;
case HWLOC_OBJ_L1CACHE: case HWLOC_OBJ_L1CACHE:
asprintf(&t2, "%sL1%s:", (NULL == locality) ? "" : locality, tmp); opal_asprintf(&t2, "%sL1%s:", (NULL == locality) ? "" : locality, tmp);
if (NULL != locality) { if (NULL != locality) {
free(locality); free(locality);
} }
@ -2199,14 +2201,14 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo,
break; break;
#endif #endif
case HWLOC_OBJ_CORE: case HWLOC_OBJ_CORE:
asprintf(&t2, "%sCR%s:", (NULL == locality) ? "" : locality, tmp); opal_asprintf(&t2, "%sCR%s:", (NULL == locality) ? "" : locality, tmp);
if (NULL != locality) { if (NULL != locality) {
free(locality); free(locality);
} }
locality = t2; locality = t2;
break; break;
case HWLOC_OBJ_PU: case HWLOC_OBJ_PU:
asprintf(&t2, "%sHT%s:", (NULL == locality) ? "" : locality, tmp); opal_asprintf(&t2, "%sHT%s:", (NULL == locality) ? "" : locality, tmp);
if (NULL != locality) { if (NULL != locality) {
free(locality); free(locality);
} }

Просмотреть файл

@ -4,6 +4,7 @@
* Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2007 Sun Microsystem, Inc. All rights reserved. * Copyright (c) 2007 Sun Microsystem, Inc. All rights reserved.
* Copyright (c) 2010 Sandia National Laboratories. All rights reserved. * Copyright (c) 2010 Sandia National Laboratories. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -17,6 +18,7 @@
#include <string.h> #include <string.h>
#include "opal/util/os_path.h" #include "opal/util/os_path.h"
#include "opal/util/printf.h"
#include "opal/mca/installdirs/base/base.h" #include "opal/mca/installdirs/base/base.h"
#include "opal/mca/installdirs/installdirs.h" #include "opal/mca/installdirs/installdirs.h"
@ -32,7 +34,7 @@
tmp = retval; \ tmp = retval; \
*start_pos = '\0'; \ *start_pos = '\0'; \
end_pos = start_pos + strlen("${" #fieldname "}"); \ end_pos = start_pos + strlen("${" #fieldname "}"); \
asprintf(&retval, "%s%s%s", tmp, \ opal_asprintf(&retval, "%s%s%s", tmp, \
opal_install_dirs.ompiname + destdir_offset, \ opal_install_dirs.ompiname + destdir_offset, \
end_pos); \ end_pos); \
free(tmp); \ free(tmp); \
@ -41,7 +43,7 @@
tmp = retval; \ tmp = retval; \
*start_pos = '\0'; \ *start_pos = '\0'; \
end_pos = start_pos + strlen("@{" #fieldname "}"); \ end_pos = start_pos + strlen("@{" #fieldname "}"); \
asprintf(&retval, "%s%s%s", tmp, \ opal_asprintf(&retval, "%s%s%s", tmp, \
opal_install_dirs.ompiname + destdir_offset, \ opal_install_dirs.ompiname + destdir_offset, \
end_pos); \ end_pos); \
free(tmp); \ free(tmp); \

Просмотреть файл

@ -17,6 +17,7 @@
* All rights reserved. * All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -29,6 +30,7 @@
#include "opal/mca/mca.h" #include "opal/mca/mca.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/proc.h" #include "opal/util/proc.h"
#include "opal/util/printf.h"
#include "opal/class/opal_rb_tree.h" #include "opal/class/opal_rb_tree.h"
#include "mpool_base_tree.h" #include "mpool_base_tree.h"
@ -221,11 +223,11 @@ static void action(void *key, void *value)
successive items if we're supposed to catenate more successive items if we're supposed to catenate more
notices. */ notices. */
if (NULL == leak_msg) { if (NULL == leak_msg) {
asprintf(&leak_msg, " %lu bytes at address 0x%lx", opal_asprintf(&leak_msg, " %lu bytes at address 0x%lx",
(unsigned long) item->num_bytes, (unsigned long) item->num_bytes,
(unsigned long) key); (unsigned long) key);
} else { } else {
asprintf(&tmp, "%s\n %lu bytes at address 0x%lx", opal_asprintf(&tmp, "%s\n %lu bytes at address 0x%lx",
leak_msg, (unsigned long) item->num_bytes, leak_msg, (unsigned long) item->num_bytes,
(unsigned long) key); (unsigned long) key);
free(leak_msg); free(leak_msg);

Просмотреть файл

@ -19,6 +19,7 @@
* Copyright (c) 2017 Research Organization for Information Science * Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* *
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -39,6 +40,7 @@
#include "opal/runtime/opal_params.h" #include "opal/runtime/opal_params.h"
#include "opal/include/opal_stdint.h" #include "opal/include/opal_stdint.h"
#include "opal/mca/allocator/base/base.h" #include "opal/mca/allocator/base/base.h"
#include "opal/util/printf.h"
#include <fcntl.h> #include <fcntl.h>
#include <sys/mman.h> #include <sys/mman.h>
@ -133,7 +135,7 @@ void *mca_mpool_hugepage_seg_alloc (void *ctx, size_t *sizep)
count = opal_atomic_add_fetch_32 (&huge_page->count, 1); count = opal_atomic_add_fetch_32 (&huge_page->count, 1);
rc = asprintf (&path, "%s/hugepage.openmpi.%d.%d", huge_page->path, rc = opal_asprintf (&path, "%s/hugepage.openmpi.%d.%d", huge_page->path,
getpid (), count); getpid (), count);
if (0 > rc) { if (0 > rc) {
return NULL; return NULL;

Просмотреть файл

@ -16,6 +16,7 @@
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -55,6 +56,7 @@
#include "opal/util/keyval_parse.h" #include "opal/util/keyval_parse.h"
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/printf.h"
#include "opal/memoryhooks/memory.h" #include "opal/memoryhooks/memory.h"
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
@ -934,7 +936,7 @@ int opal_cr_refresh_environ(int prev_pid) {
* 1) We have already executed this function, and * 1) We have already executed this function, and
* 2) The file has been deleted on the previous round. * 2) The file has been deleted on the previous round.
*/ */
asprintf(&file_name, "%s/%s-%d", opal_tmp_directory(), OPAL_CR_BASE_ENV_NAME, prev_pid); opal_asprintf(&file_name, "%s/%s-%d", opal_tmp_directory(), OPAL_CR_BASE_ENV_NAME, prev_pid);
if (NULL == file_name) { if (NULL == file_name) {
return OPAL_ERR_OUT_OF_RESOURCE; return OPAL_ERR_OUT_OF_RESOURCE;
} }

Просмотреть файл

@ -16,6 +16,7 @@
* Copyright (c) 2011-2012 University of Houston. All rights reserved. * Copyright (c) 2011-2012 University of Houston. All rights reserved.
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved. * Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -42,6 +43,7 @@
#include "opal/util/error.h" #include "opal/util/error.h"
#include "opal/util/argv.h" #include "opal/util/argv.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include "opal/runtime/opal.h" #include "opal/runtime/opal.h"
#include "opal/dss/dss.h" #include "opal/dss/dss.h"
#include "opal/mca/base/mca_base_pvar.h" #include "opal/mca/base/mca_base_pvar.h"
@ -351,7 +353,7 @@ void opal_info_show_path(const char *type, const char *value)
pretty = strdup(type); pretty = strdup(type);
pretty[0] = toupper(pretty[0]); pretty[0] = toupper(pretty[0]);
asprintf(&path, "path:%s", type); opal_asprintf(&path, "path:%s", type);
opal_info_out(pretty, path, value); opal_info_out(pretty, path, value);
free(pretty); free(pretty);
free(path); free(path);
@ -601,7 +603,7 @@ void opal_info_do_type(opal_cmd_line_t *opal_info_cmd_line)
(void) mca_base_var_group_get(var->mbv_group_index, &group); (void) mca_base_var_group_get(var->mbv_group_index, &group);
for (j = 0 ; strings[j] ; ++j) { for (j = 0 ; strings[j] ; ++j) {
if (0 == j && opal_info_pretty) { if (0 == j && opal_info_pretty) {
asprintf (&message, "MCA %s", group->group_framework); opal_asprintf (&message, "MCA %s", group->group_framework);
opal_info_out(message, message, strings[j]); opal_info_out(message, message, strings[j]);
free(message); free(message);
} else { } else {
@ -661,7 +663,7 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, m
const mca_base_var_group_t *curr_group = NULL; const mca_base_var_group_t *curr_group = NULL;
char *component_msg = NULL; char *component_msg = NULL;
asprintf(&component_msg, " %s", group_component); opal_asprintf(&component_msg, " %s", group_component);
for (i = 0 ; i < count ; ++i) { for (i = 0 ; i < count ; ++i) {
ret = mca_base_var_get(variables[i], &var); ret = mca_base_var_get(variables[i], &var);
@ -672,7 +674,7 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, m
} }
if (opal_info_pretty && curr_group != group) { if (opal_info_pretty && curr_group != group) {
asprintf(&message, "MCA%s %s%s", requested ? "" : " (-)", opal_asprintf(&message, "MCA%s %s%s", requested ? "" : " (-)",
group->group_framework, group->group_framework,
component_msg ? component_msg : ""); component_msg ? component_msg : "");
opal_info_out(message, message, "---------------------------------------------------"); opal_info_out(message, message, "---------------------------------------------------");
@ -687,7 +689,7 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, m
for (j = 0 ; strings[j] ; ++j) { for (j = 0 ; strings[j] ; ++j) {
if (0 == j && opal_info_pretty) { if (0 == j && opal_info_pretty) {
asprintf (&message, "MCA%s %s%s", requested ? "" : " (-)", opal_asprintf (&message, "MCA%s %s%s", requested ? "" : " (-)",
group->group_framework, group->group_framework,
component_msg ? component_msg : ""); component_msg ? component_msg : "");
opal_info_out(message, message, strings[j]); opal_info_out(message, message, strings[j]);
@ -700,7 +702,7 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, m
if (!opal_info_pretty) { if (!opal_info_pretty) {
/* generate an entry indicating whether this variable is disabled or not. if the /* generate an entry indicating whether this variable is disabled or not. if the
* format in mca_base_var/pvar.c changes this needs to be changed as well */ * format in mca_base_var/pvar.c changes this needs to be changed as well */
asprintf (&message, "mca:%s:%s:param:%s:disabled:%s", group->group_framework, opal_asprintf (&message, "mca:%s:%s:param:%s:disabled:%s", group->group_framework,
group_component, var->mbv_full_name, requested ? "false" : "true"); group_component, var->mbv_full_name, requested ? "false" : "true");
opal_info_out("", "", message); opal_info_out("", "", message);
free (message); free (message);
@ -718,7 +720,7 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, m
} }
if (opal_info_pretty && curr_group != group) { if (opal_info_pretty && curr_group != group) {
asprintf(&message, "MCA%s %s%s", requested ? "" : " (-)", opal_asprintf(&message, "MCA%s %s%s", requested ? "" : " (-)",
group->group_framework, group->group_framework,
component_msg ? component_msg : ""); component_msg ? component_msg : "");
opal_info_out(message, message, "---------------------------------------------------"); opal_info_out(message, message, "---------------------------------------------------");
@ -733,7 +735,7 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, m
for (j = 0 ; strings[j] ; ++j) { for (j = 0 ; strings[j] ; ++j) {
if (0 == j && opal_info_pretty) { if (0 == j && opal_info_pretty) {
asprintf (&message, "MCA%s %s%s", requested ? "" : " (-)", opal_asprintf (&message, "MCA%s %s%s", requested ? "" : " (-)",
group->group_framework, group->group_framework,
component_msg ? component_msg : ""); component_msg ? component_msg : "");
opal_info_out(message, message, strings[j]); opal_info_out(message, message, strings[j]);
@ -746,7 +748,7 @@ static void opal_info_show_mca_group_params(const mca_base_var_group_t *group, m
if (!opal_info_pretty) { if (!opal_info_pretty) {
/* generate an entry indicating whether this variable is disabled or not. if the /* generate an entry indicating whether this variable is disabled or not. if the
* format in mca_base_var/pvar.c changes this needs to be changed as well */ * format in mca_base_var/pvar.c changes this needs to be changed as well */
asprintf (&message, "mca:%s:%s:pvar:%s:disabled:%s", group->group_framework, opal_asprintf (&message, "mca:%s:%s:pvar:%s:disabled:%s", group->group_framework,
group_component, pvar->name, requested ? "false" : "true"); group_component, pvar->name, requested ? "false" : "true");
opal_info_out("", "", message); opal_info_out("", "", message);
free (message); free (message);
@ -897,7 +899,7 @@ void opal_info_out(const char *pretty_message, const char *plain_message, const
if (opal_info_pretty && NULL != pretty_message) { if (opal_info_pretty && NULL != pretty_message) {
if (centerpoint > (int)strlen(pretty_message)) { if (centerpoint > (int)strlen(pretty_message)) {
asprintf(&spaces, "%*s", centerpoint - opal_asprintf(&spaces, "%*s", centerpoint -
(int)strlen(pretty_message), " "); (int)strlen(pretty_message), " ");
} else { } else {
spaces = strdup(""); spaces = strdup("");
@ -911,9 +913,9 @@ void opal_info_out(const char *pretty_message, const char *plain_message, const
} }
max_value_width = screen_width - strlen(spaces) - strlen(pretty_message) - 2; max_value_width = screen_width - strlen(spaces) - strlen(pretty_message) - 2;
if (0 < strlen(pretty_message)) { if (0 < strlen(pretty_message)) {
asprintf(&filler, "%s%s: ", spaces, pretty_message); opal_asprintf(&filler, "%s%s: ", spaces, pretty_message);
} else { } else {
asprintf(&filler, "%s ", spaces); opal_asprintf(&filler, "%s ", spaces);
} }
free(spaces); free(spaces);
spaces = NULL; spaces = NULL;
@ -923,7 +925,7 @@ void opal_info_out(const char *pretty_message, const char *plain_message, const
printf("%s%s\n", filler, v); printf("%s%s\n", filler, v);
break; break;
} else { } else {
asprintf(&spaces, "%*s", centerpoint + 2, " "); opal_asprintf(&spaces, "%*s", centerpoint + 2, " ");
/* Work backwards to find the first space before /* Work backwards to find the first space before
* max_value_width * max_value_width
@ -1005,7 +1007,7 @@ void opal_info_out_int(const char *pretty_message,
{ {
char *valstr; char *valstr;
asprintf(&valstr, "%d", (int)value); opal_asprintf(&valstr, "%d", (int)value);
opal_info_out(pretty_message, plain_message, valstr); opal_info_out(pretty_message, plain_message, valstr);
free(valstr); free(valstr);
} }
@ -1093,16 +1095,16 @@ static void opal_info_show_failed_component(const mca_base_component_repository_
char *message, *content; char *message, *content;
if (opal_info_pretty) { if (opal_info_pretty) {
asprintf(&message, "MCA %s", ri->ri_type); opal_asprintf(&message, "MCA %s", ri->ri_type);
asprintf(&content, "%s (failed to load) %s", ri->ri_name, error_msg); opal_asprintf(&content, "%s (failed to load) %s", ri->ri_name, error_msg);
opal_info_out(message, NULL, content); opal_info_out(message, NULL, content);
free(message); free(message);
free(content); free(content);
} else { } else {
asprintf(&message, "mca:%s:%s:failed", ri->ri_type, ri->ri_name); opal_asprintf(&message, "mca:%s:%s:failed", ri->ri_type, ri->ri_name);
asprintf(&content, "%s", error_msg); opal_asprintf(&content, "%s", error_msg);
opal_info_out(NULL, message, content); opal_info_out(NULL, message, content);
@ -1155,12 +1157,12 @@ void opal_info_show_mca_version(const mca_base_component_t* component,
component->mca_component_release_version, component->mca_component_release_version,
"", ""); "", "");
if (opal_info_pretty) { if (opal_info_pretty) {
asprintf(&message, "MCA %s", component->mca_type_name); opal_asprintf(&message, "MCA %s", component->mca_type_name);
printed = false; printed = false;
asprintf(&content, "%s (", component->mca_component_name); opal_asprintf(&content, "%s (", component->mca_component_name);
if (want_mca) { if (want_mca) {
asprintf(&tmp, "%sMCA v%s", content, mca_version); opal_asprintf(&tmp, "%sMCA v%s", content, mca_version);
free(content); free(content);
content = tmp; content = tmp;
printed = true; printed = true;
@ -1168,11 +1170,11 @@ void opal_info_show_mca_version(const mca_base_component_t* component,
if (want_type) { if (want_type) {
if (printed) { if (printed) {
asprintf(&tmp, "%s, ", content); opal_asprintf(&tmp, "%s, ", content);
free(content); free(content);
content = tmp; content = tmp;
} }
asprintf(&tmp, "%sAPI v%s", content, api_version); opal_asprintf(&tmp, "%sAPI v%s", content, api_version);
free(content); free(content);
content = tmp; content = tmp;
printed = true; printed = true;
@ -1180,17 +1182,17 @@ void opal_info_show_mca_version(const mca_base_component_t* component,
if (want_component) { if (want_component) {
if (printed) { if (printed) {
asprintf(&tmp, "%s, ", content); opal_asprintf(&tmp, "%s, ", content);
free(content); free(content);
content = tmp; content = tmp;
} }
asprintf(&tmp, "%sComponent v%s", content, component_version); opal_asprintf(&tmp, "%sComponent v%s", content, component_version);
free(content); free(content);
content = tmp; content = tmp;
printed = true; printed = true;
} }
if (NULL != content) { if (NULL != content) {
asprintf(&tmp, "%s)", content); opal_asprintf(&tmp, "%s)", content);
free(content); free(content);
} else { } else {
tmp = NULL; tmp = NULL;
@ -1203,19 +1205,19 @@ void opal_info_show_mca_version(const mca_base_component_t* component,
} }
} else { } else {
asprintf(&message, "mca:%s:%s:version", component->mca_type_name, component->mca_component_name); opal_asprintf(&message, "mca:%s:%s:version", component->mca_type_name, component->mca_component_name);
if (want_mca) { if (want_mca) {
asprintf(&tmp, "mca:%s", mca_version); opal_asprintf(&tmp, "mca:%s", mca_version);
opal_info_out(NULL, message, tmp); opal_info_out(NULL, message, tmp);
free(tmp); free(tmp);
} }
if (want_type) { if (want_type) {
asprintf(&tmp, "api:%s", api_version); opal_asprintf(&tmp, "api:%s", api_version);
opal_info_out(NULL, message, tmp); opal_info_out(NULL, message, tmp);
free(tmp); free(tmp);
} }
if (want_component) { if (want_component) {
asprintf(&tmp, "component:%s", component_version); opal_asprintf(&tmp, "component:%s", component_version);
opal_info_out(NULL, message, tmp); opal_info_out(NULL, message, tmp);
free(tmp); free(tmp);
} }
@ -1248,7 +1250,7 @@ char *opal_info_make_version_str(const char *scope,
snprintf(temp, BUFSIZ - 1, "%d.%d.%d", major, minor, release); snprintf(temp, BUFSIZ - 1, "%d.%d.%d", major, minor, release);
str = strdup(temp); str = strdup(temp);
if (NULL != greek) { if (NULL != greek) {
asprintf(&tmp, "%s%s", str, greek); opal_asprintf(&tmp, "%s%s", str, greek);
free(str); free(str);
str = tmp; str = tmp;
} }
@ -1275,7 +1277,7 @@ void opal_info_show_opal_version(const char *scope)
{ {
char *tmp, *tmp2; char *tmp, *tmp2;
asprintf(&tmp, "%s:version:full", opal_info_type_opal); opal_asprintf(&tmp, "%s:version:full", opal_info_type_opal);
tmp2 = opal_info_make_version_str(scope, tmp2 = opal_info_make_version_str(scope,
OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION, OPAL_MAJOR_VERSION, OPAL_MINOR_VERSION,
OPAL_RELEASE_VERSION, OPAL_RELEASE_VERSION,
@ -1284,10 +1286,10 @@ void opal_info_show_opal_version(const char *scope)
opal_info_out("OPAL", tmp, tmp2); opal_info_out("OPAL", tmp, tmp2);
free(tmp); free(tmp);
free(tmp2); free(tmp2);
asprintf(&tmp, "%s:version:repo", opal_info_type_opal); opal_asprintf(&tmp, "%s:version:repo", opal_info_type_opal);
opal_info_out("OPAL repo revision", tmp, OPAL_REPO_REV); opal_info_out("OPAL repo revision", tmp, OPAL_REPO_REV);
free(tmp); free(tmp);
asprintf(&tmp, "%s:version:release_date", opal_info_type_opal); opal_asprintf(&tmp, "%s:version:release_date", opal_info_type_opal);
opal_info_out("OPAL release date", tmp, OPAL_RELEASE_DATE); opal_info_out("OPAL release date", tmp, OPAL_RELEASE_DATE);
free(tmp); free(tmp);
} }

Просмотреть файл

@ -22,6 +22,7 @@
* Copyright (c) 2015 Mellanox Technologies, Inc. * Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved. * All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -47,6 +48,7 @@
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/timings.h" #include "opal/util/timings.h"
#include "opal/util/printf.h"
char *opal_signal_string = NULL; char *opal_signal_string = NULL;
char *opal_stacktrace_output_filename = NULL; char *opal_stacktrace_output_filename = NULL;
@ -109,10 +111,10 @@ int opal_register_params(void)
}; };
for (j = 0 ; signals[j] != -1 ; ++j) { for (j = 0 ; signals[j] != -1 ; ++j) {
if (j == 0) { if (j == 0) {
asprintf(&string, "%d", signals[j]); opal_asprintf(&string, "%d", signals[j]);
} else { } else {
char *tmp; char *tmp;
asprintf(&tmp, "%s,%d", string, signals[j]); opal_asprintf(&tmp, "%s,%d", string, signals[j]);
free(string); free(string);
string = tmp; string = tmp;
} }

Просмотреть файл

@ -13,6 +13,7 @@
* Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights * Copyright (c) 2007-2016 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -58,6 +59,7 @@
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/error.h" #include "opal/util/error.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/printf.h"
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "opal/runtime/opal.h" #include "opal/runtime/opal.h"
@ -374,11 +376,11 @@ notify_process_for_checkpoint(pid_t pid, char **fname, int term, opal_crs_state_
int value; int value;
/* A string copy of the pid */ /* A string copy of the pid */
asprintf(&tmp_pid, "%d", pid); opal_asprintf(&tmp_pid, "%d", pid);
/* Flip the read/write files for bi-directionality */ /* Flip the read/write files for bi-directionality */
asprintf(&prog_named_pipe_w, "%s/%s.%s", opal_cr_pipe_dir, OPAL_CR_NAMED_PROG_R, tmp_pid); opal_asprintf(&prog_named_pipe_w, "%s/%s.%s", opal_cr_pipe_dir, OPAL_CR_NAMED_PROG_R, tmp_pid);
asprintf(&prog_named_pipe_r, "%s/%s.%s", opal_cr_pipe_dir, OPAL_CR_NAMED_PROG_W, tmp_pid); opal_asprintf(&prog_named_pipe_r, "%s/%s.%s", opal_cr_pipe_dir, OPAL_CR_NAMED_PROG_W, tmp_pid);
/* /*
* Signal the application telling it that we wish to checkpoint * Signal the application telling it that we wish to checkpoint

Просмотреть файл

@ -16,6 +16,7 @@
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2011-2012 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2014 Hochschule Esslingen. All rights reserved. * Copyright (c) 2014 Hochschule Esslingen. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -62,6 +63,7 @@
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/error.h" #include "opal/util/error.h"
#include "opal/util/basename.h" #include "opal/util/basename.h"
#include "opal/util/printf.h"
#include "opal/mca/base/base.h" #include "opal/mca/base/base.h"
#include "opal/runtime/opal.h" #include "opal/runtime/opal.h"
@ -210,7 +212,7 @@ main(int argc, char *argv[])
char * full_metadata_path = NULL; char * full_metadata_path = NULL;
FILE * metadata = NULL; FILE * metadata = NULL;
asprintf(&full_metadata_path, "%s/%s/%s", opal_asprintf(&full_metadata_path, "%s/%s/%s",
opal_restart_globals.snapshot_loc, opal_restart_globals.snapshot_loc,
opal_restart_globals.snapshot_ref, opal_restart_globals.snapshot_ref,
opal_restart_globals.snapshot_metadata); opal_restart_globals.snapshot_metadata);
@ -293,10 +295,10 @@ main(int argc, char *argv[])
snapshot = OBJ_NEW(opal_crs_base_snapshot_t); snapshot = OBJ_NEW(opal_crs_base_snapshot_t);
snapshot->cold_start = true; snapshot->cold_start = true;
asprintf(&(snapshot->snapshot_directory), "%s/%s", opal_asprintf(&(snapshot->snapshot_directory), "%s/%s",
opal_restart_globals.snapshot_loc, opal_restart_globals.snapshot_loc,
opal_restart_globals.snapshot_ref); opal_restart_globals.snapshot_ref);
asprintf(&(snapshot->metadata_filename), "%s/%s", opal_asprintf(&(snapshot->metadata_filename), "%s/%s",
snapshot->snapshot_directory, snapshot->snapshot_directory,
opal_restart_globals.snapshot_metadata); opal_restart_globals.snapshot_metadata);
@ -421,7 +423,7 @@ static int initialize(int argc, char *argv[])
free(tmp_env_var); free(tmp_env_var);
tmp_env_var = NULL; tmp_env_var = NULL;
asprintf(&zip_dir, "%s/%s%s", opal_asprintf(&zip_dir, "%s/%s%s",
opal_restart_globals.snapshot_loc, opal_restart_globals.snapshot_loc,
opal_restart_globals.snapshot_ref, opal_restart_globals.snapshot_ref,
opal_restart_globals.snapshot_compress_postfix); opal_restart_globals.snapshot_compress_postfix);
@ -599,7 +601,7 @@ static int check_file(void)
/* /*
* Check for the existance of the snapshot handle in the snapshot directory * Check for the existance of the snapshot handle in the snapshot directory
*/ */
asprintf(&path_to_check, "%s/%s", opal_asprintf(&path_to_check, "%s/%s",
opal_restart_globals.snapshot_loc, opal_restart_globals.snapshot_loc,
opal_restart_globals.snapshot_ref); opal_restart_globals.snapshot_ref);
@ -642,8 +644,8 @@ static int post_env_vars(int prev_pid, opal_crs_base_snapshot_t *snapshot)
* This is needed so we can pass the previous environment to the restarted * This is needed so we can pass the previous environment to the restarted
* application process. * application process.
*/ */
asprintf(&proc_file, "%s/%s-%d", opal_tmp_directory(), OPAL_CR_BASE_ENV_NAME, prev_pid); opal_asprintf(&proc_file, "%s/%s-%d", opal_tmp_directory(), OPAL_CR_BASE_ENV_NAME, prev_pid);
asprintf(&command, "env | grep OMPI_ > %s", proc_file); opal_asprintf(&command, "env | grep OMPI_ > %s", proc_file);
opal_output_verbose(5, opal_restart_globals.output, opal_output_verbose(5, opal_restart_globals.output,
"post_env_vars: Execute: <%s>", command); "post_env_vars: Execute: <%s>", command);
@ -671,7 +673,7 @@ static int post_env_vars(int prev_pid, opal_crs_base_snapshot_t *snapshot)
free(command); free(command);
command = NULL; command = NULL;
} }
asprintf(&command, "mkdir -p %s", loc_mkdir[i]); opal_asprintf(&command, "mkdir -p %s", loc_mkdir[i]);
opal_output_verbose(5, opal_restart_globals.output, opal_output_verbose(5, opal_restart_globals.output,
"post_env_vars: Execute: <%s>", command); "post_env_vars: Execute: <%s>", command);
@ -696,7 +698,7 @@ static int post_env_vars(int prev_pid, opal_crs_base_snapshot_t *snapshot)
free(command); free(command);
command = NULL; command = NULL;
} }
asprintf(&command, "touch %s", loc_touch[i]); opal_asprintf(&command, "touch %s", loc_touch[i]);
opal_output_verbose(5, opal_restart_globals.output, opal_output_verbose(5, opal_restart_globals.output,
"post_env_vars: Execute: <%s>", command); "post_env_vars: Execute: <%s>", command);

Просмотреть файл

@ -15,6 +15,7 @@
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -53,6 +54,7 @@
#include "opal/util/few.h" #include "opal/util/few.h"
#include "opal/util/basename.h" #include "opal/util/basename.h"
#include "opal/util/os_path.h" #include "opal/util/os_path.h"
#include "opal/util/printf.h"
#define OPAL_INCLUDE_FLAG "-I" #define OPAL_INCLUDE_FLAG "-I"
#define OPAL_LIBDIR_FLAG "-L" #define OPAL_LIBDIR_FLAG "-L"
@ -320,7 +322,7 @@ data_callback(const char *key, const char *value)
if (0 != strcmp(options_data[parse_options_idx].path_includedir, "/usr/include") || if (0 != strcmp(options_data[parse_options_idx].path_includedir, "/usr/include") ||
0 == strncmp(options_data[parse_options_idx].language, "Fortran", strlen("Fortran"))) { 0 == strncmp(options_data[parse_options_idx].language, "Fortran", strlen("Fortran"))) {
char *line; char *line;
asprintf(&line, OPAL_INCLUDE_FLAG"%s", opal_asprintf(&line, OPAL_INCLUDE_FLAG"%s",
options_data[parse_options_idx].path_includedir); options_data[parse_options_idx].path_includedir);
opal_argv_append_nosize(&options_data[parse_options_idx].preproc_flags, line); opal_argv_append_nosize(&options_data[parse_options_idx].preproc_flags, line);
free(line); free(line);
@ -331,7 +333,7 @@ data_callback(const char *key, const char *value)
opal_install_dirs_expand(value); opal_install_dirs_expand(value);
if (0 != strcmp(options_data[parse_options_idx].path_libdir, "/usr/lib")) { if (0 != strcmp(options_data[parse_options_idx].path_libdir, "/usr/lib")) {
char *line; char *line;
asprintf(&line, OPAL_LIBDIR_FLAG"%s", opal_asprintf(&line, OPAL_LIBDIR_FLAG"%s",
options_data[parse_options_idx].path_libdir); options_data[parse_options_idx].path_libdir);
opal_argv_append_nosize(&options_data[parse_options_idx].link_flags, line); opal_argv_append_nosize(&options_data[parse_options_idx].link_flags, line);
free(line); free(line);
@ -344,7 +346,7 @@ data_callback(const char *key, const char *value)
if (0 != strcmp(options_data[parse_options_idx].path_opalincludedir, "/usr/include") || if (0 != strcmp(options_data[parse_options_idx].path_opalincludedir, "/usr/include") ||
0 == strncmp(options_data[parse_options_idx].language, "Fortran", strlen("Fortran"))) { 0 == strncmp(options_data[parse_options_idx].language, "Fortran", strlen("Fortran"))) {
char *line; char *line;
asprintf(&line, OPAL_INCLUDE_FLAG"%s", opal_asprintf(&line, OPAL_INCLUDE_FLAG"%s",
options_data[parse_options_idx].path_opalincludedir); options_data[parse_options_idx].path_opalincludedir);
opal_argv_append_nosize(&options_data[parse_options_idx].preproc_flags, line); opal_argv_append_nosize(&options_data[parse_options_idx].preproc_flags, line);
free(line); free(line);
@ -355,7 +357,7 @@ data_callback(const char *key, const char *value)
opal_install_dirs_expand(value); opal_install_dirs_expand(value);
if (0 != strcmp(options_data[parse_options_idx].path_opallibdir, "/usr/lib")) { if (0 != strcmp(options_data[parse_options_idx].path_opallibdir, "/usr/lib")) {
char *line; char *line;
asprintf(&line, OPAL_LIBDIR_FLAG"%s", opal_asprintf(&line, OPAL_LIBDIR_FLAG"%s",
options_data[parse_options_idx].path_opallibdir); options_data[parse_options_idx].path_opallibdir);
opal_argv_append_nosize(&options_data[parse_options_idx].link_flags, line); opal_argv_append_nosize(&options_data[parse_options_idx].link_flags, line);
free(line); free(line);
@ -371,7 +373,7 @@ data_init(const char *appname)
char *datafile; char *datafile;
/* now load the data */ /* now load the data */
asprintf(&datafile, "%s%s%s-wrapper-data.txt", opal_asprintf(&datafile, "%s%s%s-wrapper-data.txt",
opal_install_dirs.opaldatadir, OPAL_PATH_SEP, appname); opal_install_dirs.opaldatadir, OPAL_PATH_SEP, appname);
if (NULL == datafile) return OPAL_ERR_TEMP_OUT_OF_RESOURCE; if (NULL == datafile) return OPAL_ERR_TEMP_OUT_OF_RESOURCE;
@ -425,10 +427,10 @@ load_env_data(const char *project, const char *flag, char **data)
if (NULL == project || NULL == flag) return; if (NULL == project || NULL == flag) return;
asprintf(&envname, "%s_MPI%s", project, flag); opal_asprintf(&envname, "%s_MPI%s", project, flag);
if (NULL == (envvalue = getenv(envname))) { if (NULL == (envvalue = getenv(envname))) {
free(envname); free(envname);
asprintf(&envname, "%s_%s", project, flag); opal_asprintf(&envname, "%s_%s", project, flag);
if (NULL == (envvalue = getenv(envname))) { if (NULL == (envvalue = getenv(envname))) {
free(envname); free(envname);
return; return;
@ -449,10 +451,10 @@ load_env_data_argv(const char *project, const char *flag, char ***data)
if (NULL == project || NULL == flag) return; if (NULL == project || NULL == flag) return;
asprintf(&envname, "%s_MPI%s", project, flag); opal_asprintf(&envname, "%s_MPI%s", project, flag);
if (NULL == (envvalue = getenv(envname))) { if (NULL == (envvalue = getenv(envname))) {
free(envname); free(envname);
asprintf(&envname, "%s_%s", project, flag); opal_asprintf(&envname, "%s_%s", project, flag);
if (NULL == (envvalue = getenv(envname))) { if (NULL == (envvalue = getenv(envname))) {
free(envname); free(envname);
return; return;

Просмотреть файл

@ -16,6 +16,7 @@
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2017 FUJITSU LIMITED. All rights reserved. * Copyright (c) 2017 FUJITSU LIMITED. All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -35,6 +36,7 @@
#include "opal/util/string_copy.h" #include "opal/util/string_copy.h"
#include "opal/constants.h" #include "opal/constants.h"
#include "opal/util/proc.h" #include "opal/util/proc.h"
#include "opal/util/printf.h"
#include "opal/runtime/opal_params.h" #include "opal/runtime/opal_params.h"
#define MAX_CONVERTERS 5 #define MAX_CONVERTERS 5
@ -82,7 +84,7 @@ opal_strerror_unknown(int errnum, char **str)
if (0 != converters[i].init) { if (0 != converters[i].init) {
if (errnum < converters[i].err_base && if (errnum < converters[i].err_base &&
errnum > converters[i].err_max) { errnum > converters[i].err_max) {
asprintf(str, "Unknown error: %d (%s error %d)", opal_asprintf(str, "Unknown error: %d (%s error %d)",
errnum, converters[i].project, errnum, converters[i].project,
errnum - converters[i].err_base); errnum - converters[i].err_base);
return OPAL_SUCCESS; return OPAL_SUCCESS;
@ -90,7 +92,7 @@ opal_strerror_unknown(int errnum, char **str)
} }
} }
asprintf(str, "Unknown error: %d", errnum); opal_asprintf(str, "Unknown error: %d", errnum);
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }

Просмотреть файл

@ -13,6 +13,7 @@
* Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights * Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved. * Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -102,9 +103,9 @@ int opal_setenv(const char *name, const char *value, bool overwrite,
if (NULL == value) { if (NULL == value) {
value = ""; value = "";
asprintf(&newvalue, "%s=", name); opal_asprintf(&newvalue, "%s=", name);
} else { } else {
asprintf(&newvalue, "%s=%s", name, value); opal_asprintf(&newvalue, "%s=%s", name, value);
} }
if (NULL == newvalue) { if (NULL == newvalue) {
return OPAL_ERR_OUT_OF_RESOURCE; return OPAL_ERR_OUT_OF_RESOURCE;
@ -162,7 +163,7 @@ int opal_setenv(const char *name, const char *value, bool overwrite,
/* Make something easy to compare to */ /* Make something easy to compare to */
asprintf(&compare, "%s=", name); opal_asprintf(&compare, "%s=", name);
if (NULL == compare) { if (NULL == compare) {
free(newvalue); free(newvalue);
return OPAL_ERR_OUT_OF_RESOURCE; return OPAL_ERR_OUT_OF_RESOURCE;
@ -218,7 +219,7 @@ int opal_unsetenv(const char *name, char ***env)
/* Make something easy to compare to */ /* Make something easy to compare to */
asprintf(&compare, "%s=", name); opal_asprintf(&compare, "%s=", name);
if (NULL == compare) { if (NULL == compare) {
return OPAL_ERR_OUT_OF_RESOURCE; return OPAL_ERR_OUT_OF_RESOURCE;
} }

Просмотреть файл

@ -17,6 +17,7 @@
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2017 IBM Corporation. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved.
* Copyright (c) 2017-2018 Intel, Inc. All rights reserved. * Copyright (c) 2017-2018 Intel, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -44,6 +45,7 @@
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/string_copy.h" #include "opal/util/string_copy.h"
#include "opal/util/printf.h"
#include "opal/threads/mutex.h" #include "opal/threads/mutex.h"
#include "opal/constants.h" #include "opal/constants.h"
#include "opal/mca/pmix/pmix.h" #include "opal/mca/pmix/pmix.h"
@ -189,7 +191,7 @@ bool opal_output_init(void)
} }
} }
gethostname(hostname, sizeof(hostname)); gethostname(hostname, sizeof(hostname));
asprintf(&verbose.lds_prefix, "[%s:%05d] ", hostname, getpid()); opal_asprintf(&verbose.lds_prefix, "[%s:%05d] ", hostname, getpid());
for (i = 0; i < OPAL_OUTPUT_MAX_STREAMS; ++i) { for (i = 0; i < OPAL_OUTPUT_MAX_STREAMS; ++i) {
info[i].ldi_used = false; info[i].ldi_used = false;
@ -210,7 +212,7 @@ bool opal_output_init(void)
/* Set some defaults */ /* Set some defaults */
asprintf(&output_prefix, "output-pid%d-", getpid()); opal_asprintf(&output_prefix, "output-pid%d-", getpid());
output_dir = strdup(opal_tmp_directory()); output_dir = strdup(opal_tmp_directory());
/* Open the default verbose stream */ /* Open the default verbose stream */
@ -279,7 +281,7 @@ void opal_output_reopen_all(void)
free(verbose.lds_prefix); free(verbose.lds_prefix);
verbose.lds_prefix = NULL; verbose.lds_prefix = NULL;
} }
asprintf(&verbose.lds_prefix, "[%s:%05d] ", hostname, getpid()); opal_asprintf(&verbose.lds_prefix, "[%s:%05d] ", hostname, getpid());
#if 0 #if 0
int i; int i;
opal_output_stream_t lds; opal_output_stream_t lds;
@ -864,7 +866,7 @@ static int make_string(char **no_newline_string, output_desc_t *ldi,
/* Make the formatted string */ /* Make the formatted string */
vasprintf(no_newline_string, format, arglist); opal_vasprintf(no_newline_string, format, arglist);
total_len = len = strlen(*no_newline_string); total_len = len = strlen(*no_newline_string);
if ('\n' != (*no_newline_string)[len - 1]) { if ('\n' != (*no_newline_string)[len - 1]) {
want_newline = true; want_newline = true;

Просмотреть файл

@ -10,6 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2007-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2007-2014 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -32,6 +33,7 @@
#include <string.h> #include <string.h>
#ifndef HAVE_VASPRINTF
/* /*
* Make a good guess about how long a printf-style varargs formatted * Make a good guess about how long a printf-style varargs formatted
* string will be once all the % escapes are filled in. We don't * string will be once all the % escapes are filled in. We don't
@ -192,7 +194,7 @@ static int guess_strlen(const char *fmt, va_list ap)
return len; return len;
#endif #endif
} }
#endif /* #ifndef HAVE_VASPRINTF */
int opal_asprintf(char **ptr, const char *fmt, ...) int opal_asprintf(char **ptr, const char *fmt, ...)
{ {
@ -210,15 +212,18 @@ int opal_asprintf(char **ptr, const char *fmt, ...)
int opal_vasprintf(char **ptr, const char *fmt, va_list ap) int opal_vasprintf(char **ptr, const char *fmt, va_list ap)
{ {
int length;
va_list ap2;
#ifdef HAVE_VASPRINTF #ifdef HAVE_VASPRINTF
int length;
length = vasprintf(ptr, fmt, ap); length = vasprintf(ptr, fmt, ap);
if (length < 0) { if (length < 0) {
*ptr = NULL; *ptr = NULL;
} }
return length;
#else #else
int length;
va_list ap2;
/* va_list might have pointer to internal state and using /* va_list might have pointer to internal state and using
it twice is a bad idea. So make a copy for the second it twice is a bad idea. So make a copy for the second
@ -254,9 +259,9 @@ int opal_vasprintf(char **ptr, const char *fmt, va_list ap)
errno = ENOMEM; errno = ENOMEM;
return -1; return -1;
} }
#endif
return length; return length;
#endif
} }

Просмотреть файл

@ -12,6 +12,7 @@
* Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -160,11 +161,11 @@ static int open_file(const char *base, const char *topic)
filename = opal_os_path( false, search_dirs[i], base, NULL ); filename = opal_os_path( false, search_dirs[i], base, NULL );
opal_show_help_yyin = fopen(filename, "r"); opal_show_help_yyin = fopen(filename, "r");
if (NULL == opal_show_help_yyin) { if (NULL == opal_show_help_yyin) {
asprintf(&err_msg, "%s: %s", filename, strerror(errno)); opal_asprintf(&err_msg, "%s: %s", filename, strerror(errno));
base_len = strlen(base); base_len = strlen(base);
if (4 > base_len || 0 != strcmp(base + base_len - 4, ".txt")) { if (4 > base_len || 0 != strcmp(base + base_len - 4, ".txt")) {
free(filename); free(filename);
asprintf(&filename, "%s%s%s.txt", search_dirs[i], OPAL_PATH_SEP, base); opal_asprintf(&filename, "%s%s%s.txt", search_dirs[i], OPAL_PATH_SEP, base);
opal_show_help_yyin = fopen(filename, "r"); opal_show_help_yyin = fopen(filename, "r");
} }
} }
@ -308,7 +309,7 @@ char *opal_show_help_vstring(const char *filename, const char *topic,
if (OPAL_SUCCESS == rc) { if (OPAL_SUCCESS == rc) {
/* Apply the formatting to make the final output string */ /* Apply the formatting to make the final output string */
vasprintf(&output, single_string, arglist); opal_vasprintf(&output, single_string, arglist);
free(single_string); free(single_string);
} }

Просмотреть файл

@ -3,6 +3,7 @@
* All rights reserved. * All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science * Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -22,6 +23,7 @@
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/path.h" #include "opal/util/path.h"
#include "opal/util/show_help.h" #include "opal/util/show_help.h"
#include "opal/util/printf.h"
#include "opal/util/uri.h" #include "opal/util/uri.h"
@ -59,7 +61,7 @@ char *opal_filename_to_uri(const char *filename,
* the scheme can either be missing or given as "localhost" * the scheme can either be missing or given as "localhost"
*/ */
if (NULL == hostname) { if (NULL == hostname) {
asprintf(&uri, "file://%s", filename); opal_asprintf(&uri, "file://%s", filename);
return uri; return uri;
} }
@ -96,7 +98,7 @@ char *opal_filename_to_uri(const char *filename,
* ensure it was absolute, so the required separator should * ensure it was absolute, so the required separator should
* already be present * already be present
*/ */
asprintf(&uri, "file://%s%s", hostname, fn); opal_asprintf(&uri, "file://%s%s", hostname, fn);
free(fn); free(fn);
return uri; return uri;
} }

Просмотреть файл

@ -1,6 +1,7 @@
/* /*
* Copyright (c) 2015 Mellanox Technologies, Inc. * Copyright (c) 2015 Mellanox Technologies, Inc.
* All rights reserved. * All rights reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -19,6 +20,7 @@
#include "opal/util/opal_environ.h" #include "opal/util/opal_environ.h"
#include "opal/util/output.h" #include "opal/util/output.h"
#include "opal/util/printf.h"
#include "oshmem/version.h" #include "oshmem/version.h"
#include "oshmem/constants.h" #include "oshmem/constants.h"
@ -262,7 +264,7 @@ static int oshmem_info_get_heap_size(char *value, size_t *interp)
char *tmp = p; char *tmp = p;
if(!p) { if(!p) {
asprintf(&tmp, "%lld", size * factor); opal_asprintf(&tmp, "%lld", size * factor);
} }
if (tmp) { if (tmp) {

Просмотреть файл

@ -6,6 +6,7 @@
* and Technology (RIST). All rights reserved. * and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -35,6 +36,7 @@
#include "scoll_fca.h" #include "scoll_fca.h"
#include "opal/runtime/opal_progress.h" #include "opal/runtime/opal_progress.h"
#include "opal/util/printf.h"
#include "oshmem/proc/proc.h" #include "oshmem/proc/proc.h"
#include "oshmem/mca/memheap/memheap.h" #include "oshmem/mca/memheap/memheap.h"
/* /*
@ -200,10 +202,10 @@ static char *mca_scoll_fca_check_file(char *file)
static char *mca_scoll_fca_get_spec_file(void) static char *mca_scoll_fca_get_spec_file(void)
{ {
char *file; char *file;
asprintf(&file, "%s/etc/fca_mpi_spec.ini", COLL_FCA_HOME); opal_asprintf(&file, "%s/etc/fca_mpi_spec.ini", COLL_FCA_HOME);
if (NULL == mca_scoll_fca_check_file(file)) { if (NULL == mca_scoll_fca_check_file(file)) {
free(file); free(file);
asprintf(&file, "%s/../fca/etc/fca_mpi_spec.ini", opal_install_dirs.prefix); opal_asprintf(&file, "%s/../fca/etc/fca_mpi_spec.ini", opal_install_dirs.prefix);
if (NULL == mca_scoll_fca_check_file(file)) { if (NULL == mca_scoll_fca_check_file(file)) {
free(file); free(file);
return NULL; return NULL;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше