From fc7f41210475aadebbc93854d2005281435a2168 Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Fri, 5 Sep 2014 11:32:21 +0200 Subject: [PATCH] [smpi] Simplify code for SMPI privatisation --- src/smpi/smpi_bench.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/smpi/smpi_bench.c b/src/smpi/smpi_bench.c index a7e06c0a15..0a74d87a4c 100644 --- a/src/smpi/smpi_bench.c +++ b/src/smpi/smpi_bench.c @@ -723,7 +723,7 @@ void smpi_initialize_global_memory_segments(){ for (i=0; i< SIMIX_process_count(); i++){ //create SIMIX_process_count() mappings of this size with the same data inside - void *address = NULL, *tmp = NULL; + void *address = NULL; char path[] = "/dev/shm/my-buffer-XXXXXX"; int status; int file_descriptor= mkstemp (path); @@ -738,15 +738,11 @@ void smpi_initialize_global_memory_segments(){ xbt_die("Impossible to set the size of the temporary file for memory mapping"); /* Ask for a free region */ - address = mmap (NULL, size_data_exe, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); + address = mmap (NULL, size_data_exe, PROT_READ | PROT_WRITE, MAP_SHARED, file_descriptor, 0); if (address == MAP_FAILED) xbt_die("Couldn't find a free region for memory mapping"); - tmp = mmap (address, size_data_exe, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, file_descriptor, 0); - - if (tmp != address) - xbt_die("Couldn't obtain the right address"); //initialize the values memcpy(address,TOPAGE(start_data_exe),size_data_exe); -- 2.20.1