From: Augustin Degomme Date: Tue, 9 Aug 2022 14:00:13 +0000 (+0200) Subject: intercept getpid call in SMPI, to provide internal PID instead of same of for all... X-Git-Tag: v3.32~72 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c1faa7358aa680bd3d28867cabe55e3ee1332a7e intercept getpid call in SMPI, to provide internal PID instead of same of for all processes. --- diff --git a/include/smpi/smpi_helpers.h b/include/smpi/smpi_helpers.h index 5317deec37..d5a010094a 100644 --- a/include/smpi/smpi_helpers.h +++ b/include/smpi/smpi_helpers.h @@ -41,4 +41,5 @@ #define exit(x) smpi_exit(x) +#define getpid smpi_getpid #endif diff --git a/include/smpi/smpi_helpers_internal.h b/include/smpi/smpi_helpers_internal.h index c089449dc3..26f21486b3 100644 --- a/include/smpi/smpi_helpers_internal.h +++ b/include/smpi/smpi_helpers_internal.h @@ -12,6 +12,7 @@ #include #include +#include #if _POSIX_TIMERS #include #endif @@ -44,6 +45,8 @@ void* smpi_shared_malloc_intercept(size_t size, const char* file, int line); void* smpi_shared_calloc_intercept(size_t num_elm, size_t elem_size, const char* file, int line); void* smpi_shared_realloc_intercept(void* data, size_t size, const char* file, int line); void smpi_shared_free(void* data); + +pid_t smpi_getpid(); #ifdef __cplusplus [[noreturn]] // c++11 #else diff --git a/src/smpi/internals/smpi_bench.cpp b/src/smpi/internals/smpi_bench.cpp index f4687afbd8..e3987196be 100644 --- a/src/smpi/internals/smpi_bench.cpp +++ b/src/smpi/internals/smpi_bench.cpp @@ -483,3 +483,7 @@ int smpi_getopt (int argc, char *const *argv, const char *options) smpi_process()->set_optind(optind); return ret; } + +pid_t smpi_getpid(){ + return static_cast(simgrid::s4u::this_actor::get_pid()); +}