X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9bf049cea1d0bdabc36c9ffbb69ded21bf462ce4..33bd148331a48a87a0d266822a2fd190ba9616b3:/src/smpi/smpi_memory.cpp diff --git a/src/smpi/smpi_memory.cpp b/src/smpi/smpi_memory.cpp index 9296d975c8..4b62f24c5d 100644 --- a/src/smpi/smpi_memory.cpp +++ b/src/smpi/smpi_memory.cpp @@ -1,11 +1,11 @@ -/* Copyright (c) 2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2015-2017. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ #include #include +#include #include @@ -13,16 +13,17 @@ #include #include #include -#include "simgrid/sg_config.h" #include +#include +#include #ifndef WIN32 #include #include -#include "../xbt/memory_map.hpp" +#include "src/xbt/memory_map.hpp" -#include "private.h" +#include "src/smpi/private.h" #include "private.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_memory, smpi, "Memory layout support for SMPI"); @@ -30,7 +31,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_memory, smpi, "Memory layout support for SM int smpi_loaded_page = -1; char* smpi_start_data_exe = nullptr; int smpi_size_data_exe = 0; -bool smpi_privatize_global_variables; +int smpi_privatize_global_variables; static const int PROT_RWX = (PROT_READ | PROT_WRITE | PROT_EXEC); static const int PROT_RW = (PROT_READ | PROT_WRITE ); @@ -100,7 +101,7 @@ void smpi_really_switch_data_segment(int dest) void* tmp = mmap(TOPAGE(smpi_start_data_exe), smpi_size_data_exe, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED, current, 0); if (tmp != TOPAGE(smpi_start_data_exe)) - xbt_die("Couldn't map the new region"); + xbt_die("Couldn't map the new region (errno %d): %s", errno, strerror(errno)); smpi_loaded_page = dest; #endif } @@ -113,12 +114,7 @@ int smpi_is_privatisation_file(char* file) void smpi_initialize_global_memory_segments() { -#if !HAVE_PRIVATIZATION - smpi_privatize_global_variables=false; - xbt_die("You are trying to use privatization on a system that does not support it. Don't."); - return; -#else - +#if HAVE_PRIVATIZATION smpi_get_executable_global_size(); XBT_DEBUG ("bss+data segment found : size %d starting at %p", smpi_size_data_exe, smpi_start_data_exe ); @@ -181,6 +177,10 @@ Ask the Internet about tutorials on how to increase the files limit such as: htt smpi_privatisation_regions[i].file_descriptor = file_descriptor; smpi_privatisation_regions[i].address = address; } +#else /* ! HAVE_PRIVATIZATION */ + smpi_privatize_global_variables = false; + xbt_die("You are trying to use privatization on a system that does not support it. Don't."); + return; #endif }