From 14aa5fae3c42f14a1c6a259dede93d5ca7ecb82c Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 14 Nov 2020 09:33:14 -0500 Subject: [PATCH] Fix many compiler warnings: - Add some missing AC_CHECK_SIZEOF's in configure.ac - Remove some unused variables - Initialize some variables - Fix some parameter types - Cast where appropriate/safe to fix warnings - Move ompi/mca/common/monitoring Fortran bindings to a separate .c file so that they can use different #define's than the C bindings, and therefore compile properly / without warnings. - Fix signedness discrepancies - Who knew? Separated these into multiple #if's, instead: ``` // This is undefined behavior #define HAVE_FOO defined(FOO) #define YOW (HAVE_FOO && defined(BAR)) ``` - Fix some typos in OMPI_BUILD_HOST logic - Don't "2>/dev/null" in OMPI_BUILD_HOST logic; it just hides errors Signed-off-by: Jeff Squyres --- configure.ac | 2 + ompi/dpm/dpm.c | 4 +- ompi/errhandler/errhandler.c | 4 +- ompi/mca/coll/adapt/coll_adapt_ireduce.c | 2 +- ompi/mca/common/monitoring/Makefile.am | 5 +- ompi/mca/common/monitoring/monitoring_prof.c | 58 +------------ .../mca/common/monitoring/monitoring_prof_f.c | 82 +++++++++++++++++++ ompi/mca/osc/rdma/osc_rdma_types.h | 5 +- ompi/mca/pml/base/pml_base_select.c | 4 +- ompi/mca/topo/treematch/treematch/tm_tree.c | 2 +- ompi/tools/mpisync/Makefile.am | 4 +- ompi/tools/ompi_info/Makefile.am | 4 +- opal/datatype/opal_datatype_pack.h | 3 +- opal/mca/base/mca_base_alias.c | 14 +++- .../memory/patcher/memory_patcher_component.c | 38 +++++---- oshmem/tools/oshmem_info/Makefile.am | 4 +- 16 files changed, 144 insertions(+), 91 deletions(-) create mode 100644 ompi/mca/common/monitoring/monitoring_prof_f.c diff --git a/configure.ac b/configure.ac index 2853d88bcc..fc4e18fb7f 100644 --- a/configure.ac +++ b/configure.ac @@ -459,7 +459,9 @@ AC_CHECK_SIZEOF(_Bool) AC_CHECK_SIZEOF(char) AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(unsigned int) AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(unsigned long) AC_CHECK_SIZEOF(long long) if test "$ac_cv_type_short_float" = yes; then AC_CHECK_SIZEOF(short float) diff --git a/ompi/dpm/dpm.c b/ompi/dpm/dpm.c index a289c16813..96f3722b22 100644 --- a/ompi/dpm/dpm.c +++ b/ompi/dpm/dpm.c @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2007-2018 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2007-2020 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2006-2009 University of Houston. All rights reserved. * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2011-2015 Los Alamos National Security, LLC. All rights @@ -651,7 +651,7 @@ static int dpm_convert(opal_list_t *infos, bool deprecated) { opal_info_item_t *iptr; - char *ck, *ptr, *help_str; + char *ck, *ptr, *help_str = NULL; int rc; char **tmp; dpm_conflicts_t *modifiers; diff --git a/ompi/errhandler/errhandler.c b/ompi/errhandler/errhandler.c index 53075032fe..8beaf8a313 100644 --- a/ompi/errhandler/errhandler.c +++ b/ompi/errhandler/errhandler.c @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2018 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2008-2020 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. @@ -282,7 +282,7 @@ static void *ompi_errhandler_event_cb(int fd, int flags, void *context) { /* TODO: this error should return to the caller and invoke an error * handler from the MPI API call. * For now, it is fatal. */ - ompi_mpi_errors_are_fatal_comm_handler(NULL, status, "PMIx Even Notification"); + ompi_mpi_errors_are_fatal_comm_handler(NULL, &status, "PMIx Event Notification"); return NULL; } diff --git a/ompi/mca/coll/adapt/coll_adapt_ireduce.c b/ompi/mca/coll/adapt/coll_adapt_ireduce.c index 32705e6e4b..4755b7730a 100644 --- a/ompi/mca/coll/adapt/coll_adapt_ireduce.c +++ b/ompi/mca/coll/adapt/coll_adapt_ireduce.c @@ -624,7 +624,7 @@ int ompi_coll_adapt_ireduce_generic(const void *sbuf, void *rbuf, int count, OPAL_OUTPUT_VERBOSE((30, mca_coll_adapt_component.adapt_output, "[%d]: distance %d, inbuf %p, inbuf->buff %p, inbuf->buff-lb %p, to_inbuf %p, inbuf_list %p\n", rank, con->distance, (void *) temp_inbuf, (void *) temp_inbuf->buff, - (char *) temp_inbuf->buff - lower_bound, + (void *) ((char *) temp_inbuf->buff - lower_bound), (void *) to_inbuf((char *) temp_inbuf->buff - lower_bound, con->distance), (void *) &con->inbuf_list)); opal_free_list_return_st(&con->inbuf_list, (opal_free_list_item_t *) temp_inbuf); diff --git a/ompi/mca/common/monitoring/Makefile.am b/ompi/mca/common/monitoring/Makefile.am index 942c218c98..0808881850 100644 --- a/ompi/mca/common/monitoring/Makefile.am +++ b/ompi/mca/common/monitoring/Makefile.am @@ -5,7 +5,7 @@ # Copyright (c) 2016 Inria. All rights reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. -# Copyright (c) 2018 Cisco Systems, Inc. All rights reserved +# Copyright (c) 2018-2020 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -28,6 +28,9 @@ lib_LTLIBRARIES += $(component_install) lib_LTLIBRARIES += ompi_monitoring_prof.la ompi_monitoring_prof_la_SOURCES = monitoring_prof.c +if OMPI_BUILD_FORTRAN_MPIFH_BINDINGS +ompi_monitoring_prof_la_SOURCES += monitoring_prof_f.c +endif ompi_monitoring_prof_la_LDFLAGS= \ -module -avoid-version -shared $(WRAPPER_EXTRA_LDFLAGS) ompi_monitoring_prof_la_LIBADD = \ diff --git a/ompi/mca/common/monitoring/monitoring_prof.c b/ompi/mca/common/monitoring/monitoring_prof.c index 1dcc0ca916..2c23e7fce8 100644 --- a/ompi/mca/common/monitoring/monitoring_prof.c +++ b/ompi/mca/common/monitoring/monitoring_prof.c @@ -4,7 +4,7 @@ * reserved. * Copyright (c) 2013-2017 Inria. All rights reserved. * Copyright (c) 2013-2015 Bull SAS. All rights reserved. - * Copyright (c) 2016-2018 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2016-2020 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * $COPYRIGHT$ @@ -398,59 +398,3 @@ int write_mat(char * filename, size_t * mat, unsigned int dim) return 0; } - -/** - * MPI binding for fortran - */ - -void monitoring_prof_mpi_init_f2c( MPI_Fint * ); -void monitoring_prof_mpi_finalize_f2c( MPI_Fint * ); - -void monitoring_prof_mpi_init_f2c( MPI_Fint *ierr ) { - int c_ierr; - int argc = 0; - char ** argv = NULL; - - c_ierr = MPI_Init(&argc, &argv); - if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); -} - -void monitoring_prof_mpi_finalize_f2c( MPI_Fint *ierr ) { - int c_ierr; - - c_ierr = MPI_Finalize(); - if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); -} - -#if OPAL_HAVE_WEAK_SYMBOLS -#pragma weak MPI_INIT = monitoring_prof_mpi_init_f2c -#pragma weak mpi_init = monitoring_prof_mpi_init_f2c -#pragma weak mpi_init_ = monitoring_prof_mpi_init_f2c -#pragma weak mpi_init__ = monitoring_prof_mpi_init_f2c -#pragma weak MPI_Init_f = monitoring_prof_mpi_init_f2c -#pragma weak MPI_Init_f08 = monitoring_prof_mpi_init_f2c - -#pragma weak MPI_FINALIZE = monitoring_prof_mpi_finalize_f2c -#pragma weak mpi_finalize = monitoring_prof_mpi_finalize_f2c -#pragma weak mpi_finalize_ = monitoring_prof_mpi_finalize_f2c -#pragma weak mpi_finalize__ = monitoring_prof_mpi_finalize_f2c -#pragma weak MPI_Finalize_f = monitoring_prof_mpi_finalize_f2c -#pragma weak MPI_Finalize_f08 = monitoring_prof_mpi_finalize_f2c -#elif OMPI_BUILD_FORTRAN_BINDINGS - -OMPI_GENERATE_F77_BINDINGS (MPI_INIT, - mpi_init, - mpi_init_, - mpi_init__, - monitoring_prof_mpi_init_f2c, - (MPI_Fint *ierr), - (ierr) ) - -OMPI_GENERATE_F77_BINDINGS (MPI_FINALIZE, - mpi_finalize, - mpi_finalize_, - mpi_finalize__, - monitoring_prof_mpi_finalize_f2c, - (MPI_Fint *ierr), - (ierr) ) -#endif diff --git a/ompi/mca/common/monitoring/monitoring_prof_f.c b/ompi/mca/common/monitoring/monitoring_prof_f.c new file mode 100644 index 0000000000..4e193a9b51 --- /dev/null +++ b/ompi/mca/common/monitoring/monitoring_prof_f.c @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2013-2017 The University of Tennessee and The University + * of Tennessee Research Foundation. All rights + * reserved. + * Copyright (c) 2013-2017 Inria. All rights reserved. + * Copyright (c) 2013-2015 Bull SAS. All rights reserved. + * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 Research Organization for Information Science + * and Technology (RIST). All rights reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +/* + * MPI binding for fortran + */ + +#define OMPI_BUILD_MPI_PROFILING 0 +#define OMPI_COMPILING_FORTRAN_WRAPPERS 1 + +#include + +#include "ompi_config.h" + +#include "ompi/mpi/fortran/mpif-h/bindings.h" +#include "ompi/mpi/fortran/base/constants.h" + + +void monitoring_prof_mpi_init_f2c( MPI_Fint * ); +void monitoring_prof_mpi_finalize_f2c( MPI_Fint * ); + +void monitoring_prof_mpi_init_f2c( MPI_Fint *ierr ) { + int c_ierr; + int argc = 0; + char ** argv = NULL; + + c_ierr = PMPI_Init(&argc, &argv); + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); +} + +void monitoring_prof_mpi_finalize_f2c( MPI_Fint *ierr ) { + int c_ierr; + + c_ierr = PMPI_Finalize(); + if (NULL != ierr) *ierr = OMPI_INT_2_FINT(c_ierr); +} + +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_INIT = monitoring_prof_mpi_init_f2c +#pragma weak mpi_init = monitoring_prof_mpi_init_f2c +#pragma weak mpi_init_ = monitoring_prof_mpi_init_f2c +#pragma weak mpi_init__ = monitoring_prof_mpi_init_f2c +#pragma weak MPI_Init_f = monitoring_prof_mpi_init_f2c +#pragma weak MPI_Init_f08 = monitoring_prof_mpi_init_f2c + +#pragma weak MPI_FINALIZE = monitoring_prof_mpi_finalize_f2c +#pragma weak mpi_finalize = monitoring_prof_mpi_finalize_f2c +#pragma weak mpi_finalize_ = monitoring_prof_mpi_finalize_f2c +#pragma weak mpi_finalize__ = monitoring_prof_mpi_finalize_f2c +#pragma weak MPI_Finalize_f = monitoring_prof_mpi_finalize_f2c +#pragma weak MPI_Finalize_f08 = monitoring_prof_mpi_finalize_f2c +#else + +OMPI_GENERATE_F77_BINDINGS (MPI_INIT, + mpi_init, + mpi_init_, + mpi_init__, + monitoring_prof_mpi_init_f2c, + (MPI_Fint *ierr), + (ierr) ) + +OMPI_GENERATE_F77_BINDINGS (MPI_FINALIZE, + mpi_finalize, + mpi_finalize_, + mpi_finalize__, + monitoring_prof_mpi_finalize_f2c, + (MPI_Fint *ierr), + (ierr) ) +#endif diff --git a/ompi/mca/osc/rdma/osc_rdma_types.h b/ompi/mca/osc/rdma/osc_rdma_types.h index d39f34faff..50f411fd0d 100644 --- a/ompi/mca/osc/rdma/osc_rdma_types.h +++ b/ompi/mca/osc/rdma/osc_rdma_types.h @@ -3,6 +3,7 @@ * Copyright (c) 2014-2018 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2020 Google, LLC. All rights reserved. + * Copyright (c) 2020 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -23,7 +24,7 @@ struct ompi_osc_rdma_peer_t; #if OPAL_HAVE_ATOMIC_MATH_64 typedef int64_t osc_rdma_base_t; -typedef int64_t osc_rdma_size_t; +typedef uint64_t osc_rdma_size_t; typedef int64_t osc_rdma_counter_t; typedef opal_atomic_int64_t osc_rdma_atomic_counter_t; @@ -32,7 +33,7 @@ typedef opal_atomic_int64_t osc_rdma_atomic_counter_t; #else typedef int32_t osc_rdma_base_t; -typedef int32_t osc_rdma_size_t; +typedef uint32_t osc_rdma_size_t; typedef int32_t osc_rdma_counter_t; typedef opal_atomic_int32_t osc_rdma_atomic_counter_t; diff --git a/ompi/mca/pml/base/pml_base_select.c b/ompi/mca/pml/base/pml_base_select.c index 2952e77c53..8b1a9989ef 100644 --- a/ompi/mca/pml/base/pml_base_select.c +++ b/ompi/mca/pml/base/pml_base_select.c @@ -13,7 +13,7 @@ * Copyright (c) 2012 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2013-2020 Intel, Inc. All rights reserved. - * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2015-2020 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2020 Amazon.com, Inc. or its affiliates. All Rights * reserved. * $COPYRIGHT$ @@ -368,7 +368,7 @@ mca_pml_base_pml_check_selected_impl(const char *my_pml, /* if that module doesn't match my own, return an error */ if ((size != strlen(my_pml) + 1) || (0 != strcmp(my_pml, remote_pml))) { - char *errhost; + char *errhost = NULL; OPAL_MODEX_RECV_VALUE_OPTIONAL(ret, PMIX_HOSTNAME, &proc_name, &(errhost), PMIX_STRING); opal_output(0, "%s selected pml %s, but peer %s on %s selected pml %s", diff --git a/ompi/mca/topo/treematch/treematch/tm_tree.c b/ompi/mca/topo/treematch/treematch/tm_tree.c index 39adda4059..11d3e46a2d 100644 --- a/ompi/mca/topo/treematch/treematch/tm_tree.c +++ b/ompi/mca/topo/treematch/treematch/tm_tree.c @@ -1828,7 +1828,7 @@ void group_nodes(tm_affinity_mat_t *aff_mat, tm_tree_t *tab_node, tm_tree_t *new best_selection = (group_list_t **)MALLOC(sizeof(group_list_t*)*solution_size); list_all_possible_groups(cost_mat, tab_node, 0, arity, 0, cur_group, &list); - assert( (int)list.val == nb_groups); + assert( list.val == nb_groups); tab_group = (group_list_t**)MALLOC(sizeof(group_list_t*)*nb_groups); list_to_tab(list.next, tab_group, nb_groups); if(verbose_level>=INFO) diff --git a/ompi/tools/mpisync/Makefile.am b/ompi/tools/mpisync/Makefile.am index 81ae5418d5..c02046c4af 100644 --- a/ompi/tools/mpisync/Makefile.am +++ b/ompi/tools/mpisync/Makefile.am @@ -9,7 +9,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2008-2020 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. # Copyright (c) 2012 Los Alamos National Security, LLC. # All rights reserved. @@ -33,7 +33,7 @@ AM_CFLAGS = \ -DOPAL_CONFIGURE_HOST="\"@OPAL_CONFIGURE_HOST@\"" \ -DOPAL_CONFIGURE_DATE="\"@OPAL_CONFIGURE_DATE@\"" \ -DOMPI_BUILD_USER="\"$$USER\"" \ - -DOMPI_BUILD_HOST="\"`(hostname || uname -n) | sed 1q`\"" \ + -DOMPI_BUILD_HOST="\"$${HOSTNAME:-`(hostname || uname -n) | sed 1q`}\"" \ -DOMPI_BUILD_DATE="\"`$(top_srcdir)/config/getdate.sh`\"" \ -DOMPI_BUILD_CFLAGS="\"@CFLAGS@\"" \ -DOMPI_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \ diff --git a/ompi/tools/ompi_info/Makefile.am b/ompi/tools/ompi_info/Makefile.am index c5a9c47670..fe739548c8 100644 --- a/ompi/tools/ompi_info/Makefile.am +++ b/ompi/tools/ompi_info/Makefile.am @@ -9,7 +9,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2008-2020 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. # Copyright (c) 2012 Los Alamos National Security, LLC. # All rights reserved. @@ -29,7 +29,7 @@ AM_CFLAGS = \ -DOPAL_CONFIGURE_HOST="\"@OPAL_CONFIGURE_HOST@\"" \ -DOPAL_CONFIGURE_DATE="\"@OPAL_CONFIGURE_DATE@\"" \ -DOMPI_BUILD_USER="\"$$USER\"" \ - -DOMPI_BUILD_HOST="\"$${HOSTNAME:-`(hostname || uname -n) 2> /dev/null | sed 1q`}\"" \ + -DOMPI_BUILD_HOST="\"$${HOSTNAME:-`(hostname || uname -n) | sed 1q`}\"" \ -DOMPI_BUILD_DATE="\"`$(top_srcdir)/config/getdate.sh`\"" \ -DOMPI_BUILD_CFLAGS="\"@CFLAGS@\"" \ -DOMPI_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \ diff --git a/opal/datatype/opal_datatype_pack.h b/opal/datatype/opal_datatype_pack.h index cbe488b7b7..d200f911fd 100644 --- a/opal/datatype/opal_datatype_pack.h +++ b/opal/datatype/opal_datatype_pack.h @@ -7,6 +7,7 @@ * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. * Copyright (c) 2017-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. + * Copyright (c) 2020 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -68,7 +69,7 @@ pack_partial_blocklen( opal_convertor_t* CONVERTOR, OPAL_DATATYPE_SAFEGUARD_POINTER( _memory, do_now_bytes, (CONVERTOR)->pBaseBuf, (CONVERTOR)->pDesc, (CONVERTOR)->count ); DO_DEBUG( opal_output( 0, "pack memcpy( %p, %p, %lu ) => space %lu [partial]\n", - _packed, (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); + (void*) _packed, (void*)_memory, (unsigned long)do_now_bytes, (unsigned long)(*(SPACE)) ); ); MEMCPY_CSUM( _packed, _memory, do_now_bytes, (CONVERTOR) ); *(memory) += (ptrdiff_t)do_now_bytes; if( do_now == left_in_block ) /* compensate if completed a blocklen */ diff --git a/opal/mca/base/mca_base_alias.c b/opal/mca/base/mca_base_alias.c index 9dd97b9eda..ad5e557d18 100644 --- a/opal/mca/base/mca_base_alias.c +++ b/opal/mca/base/mca_base_alias.c @@ -93,13 +93,23 @@ static char *mca_base_alias_generate_name (const char *project, const char *fram if (project_length) { strncat (tmp, project, length); - strncat (tmp, "_", 1); + // NOTE: We use strcat() here (and not strncat()) because + // we're appending a constant string with a fixed/hard-coded + // length. It's the exact equivalent of strncat(tmp, "_", 1), + // but strncat() would actually be more overhead. Indeed, GCC + // 10 emits a warning if we use strncatd() with a compile-time + // constant string as the source and a hard-coded length that + // is equivalent to the length of that compile-time constant + // string. So avoid the warning and use strcat(). + strcat (tmp, "_"); length -= project_length + 1; } if (framework_length) { strncat (tmp, framework, length); - strncat (tmp, "_", 1); + // Use strcat() here instead of strncat(); see the comment + // above for an explanation. + strcat (tmp, "_"); length -= framework_length + 1; } diff --git a/opal/mca/memory/patcher/memory_patcher_component.c b/opal/mca/memory/patcher/memory_patcher_component.c index 7187861a9d..8a83458fa1 100644 --- a/opal/mca/memory/patcher/memory_patcher_component.c +++ b/opal/mca/memory/patcher/memory_patcher_component.c @@ -10,7 +10,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2013-2017 Los Alamos National Security, LLC. All rights * reserved. * Copyright (c) 2016-2017 Research Organization for Information Science @@ -55,6 +55,18 @@ #include "memory_patcher.h" #undef opal_memory_changed +#if defined(SYS_shmdt) || (defined(IPCOP_shmdt) && defined(SYS_ipc)) +#define HAS_SHMDT 1 +#else +#define HAS_SHMDT 0 +#endif + +#if defined(SYS_shmat) ||(defined(IPCOP_shmat) && defined(SYS_ipc)) +#define HAS_SHMAT 1 +#else +#define HAS_SHMAT 0 +#endif + static int patcher_open(void); static int patcher_close(void); static int patcher_register(void); @@ -113,15 +125,25 @@ opal_memory_patcher_component_t mca_memory_patcher_component = { */ static void *_intercept_mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) __opal_attribute_noinline__; static int _intercept_munmap(void *start, size_t length) __opal_attribute_noinline__; +#if defined (SYS_mremap) #if defined(__linux__) static void *_intercept_mremap (void *start, size_t oldlen, size_t newlen, int flags, void *new_address) __opal_attribute_noinline__; #else static void *_intercept_mremap (void *start, size_t oldlen, void *new_address, size_t newlen, int flags) __opal_attribute_noinline__; -#endif +#endif // defined(__linux__) +#endif // defined(SYS_mremap) static int _intercept_madvise (void *start, size_t length, int advice) __opal_attribute_noinline__; +#if defined SYS_brk static int _intercept_brk (void *addr) __opal_attribute_noinline__; +#endif +#if defined(__linux__) +#if HAS_SHMAT static void *_intercept_shmat(int shmid, const void *shmaddr, int shmflg) __opal_attribute_noinline__; +#endif // HAS_SHMAT +#if HAS_SHMDT static int _intercept_shmdt (const void *shmaddr) __opal_attribute_noinline__; +#endif // HAS_SHMDT +#endif // defined(__linux__) #if defined (SYS_mmap) @@ -362,18 +384,6 @@ static int intercept_brk (void *addr) #define IPCOP_shmdt 22 #endif -#if defined(SYS_shmdt) || (defined(IPCOP_shmdt) && defined(SYS_ipc)) -#define HAS_SHMDT 1 -#else -#define HAS_SHMDT 0 -#endif - -#if defined(SYS_shmat) ||(defined(IPCOP_shmat) && defined(SYS_ipc)) -#define HAS_SHMAT 1 -#else -#define HAS_SHMAT 0 -#endif - #if HAS_SHMDT || HAS_SHMAT #if defined(__linux__) diff --git a/oshmem/tools/oshmem_info/Makefile.am b/oshmem/tools/oshmem_info/Makefile.am index 8cec565267..54335fe7cb 100644 --- a/oshmem/tools/oshmem_info/Makefile.am +++ b/oshmem/tools/oshmem_info/Makefile.am @@ -1,7 +1,7 @@ # # Copyright (c) 2014 Mellanox Technologies, Inc. # All rights reserved. -# Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2014-2020 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2016 IBM Corporation. All rights reserved. # Copyright (c) 2017 Research Organization for Information Science # and Technology (RIST). All rights reserved. @@ -18,7 +18,7 @@ AM_CPPFLAGS = \ -DOPAL_CONFIGURE_HOST="\"@OPAL_CONFIGURE_HOST@\"" \ -DOPAL_CONFIGURE_DATE="\"@OPAL_CONFIGURE_DATE@\"" \ -DOMPI_BUILD_USER="\"$$USER\"" \ - -DOMPI_BUILD_HOST="\"$${HOSTNAME:-`(hostname || uname -n) 2> /dev/null | sed 1q`}\"" \ + -DOMPI_BUILD_HOST="\"$${HOSTNAME:-`(hostname || uname -n) | sed 1q`}\"" \ -DOMPI_BUILD_DATE="\"`$(top_srcdir)/config/getdate.sh`\"" \ -DOMPI_BUILD_CFLAGS="\"@CFLAGS@\"" \ -DOMPI_BUILD_CPPFLAGS="\"@CPPFLAGS@\"" \