Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 10 Mar 2016 14:12:40 +0000 (15:12 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 10 Mar 2016 14:18:42 +0000 (15:18 +0100)
98 files changed:
CMakeLists.txt
examples/smpi/NAS/CMakeLists.txt
include/simgrid_config.h.in
include/xbt/base.h
include/xbt/mmalloc.h
include/xbt/signal.hpp
include/xbt/string.hpp
include/xbt/sysdep.h
src/bindings/java/org/simgrid/msg/Comm.java
src/bindings/java/org/simgrid/msg/File.java
src/bindings/java/org/simgrid/msg/Host.java
src/bindings/java/org/simgrid/msg/HostFailureException.java
src/bindings/java/org/simgrid/msg/HostNotFoundException.java
src/bindings/java/org/simgrid/msg/JniException.java
src/bindings/java/org/simgrid/msg/Msg.java
src/bindings/java/org/simgrid/msg/MsgException.java
src/bindings/java/org/simgrid/msg/Mutex.java
src/bindings/java/org/simgrid/msg/NativeException.java
src/bindings/java/org/simgrid/msg/Process.java
src/include/mc/datatypes.h
src/include/mc/mc.h
src/include/surf/maxmin.h
src/include/surf/surf.h
src/mc/ChunkedData.cpp
src/mc/ObjectInformation.hpp
src/mc/PageStore.hpp
src/mc/Process.cpp
src/mc/RegionSnapshot.cpp
src/mc/mc_checkpoint.cpp
src/mc/mc_compare.cpp
src/mc/mc_dwarf.cpp
src/mc/mc_ignore.cpp
src/mc/mc_mmu.h
src/mc/mc_object_info.h [deleted file]
src/mc/mc_page_snapshot.cpp
src/mc/mc_smx.cpp
src/mc/mc_snapshot.cpp
src/mc/mc_snapshot.h
src/mc/mc_unw.cpp
src/mc/mc_unw_vmread.cpp
src/mc/simgrid_mc.cpp
src/portable.h [deleted file]
src/simdag/sd_daxloader.cpp
src/simdag/sd_dotloader.cpp
src/simgrid/sg_config.c
src/simix/BoostContext.cpp
src/simix/RawContext.cpp
src/simix/ThreadContext.cpp
src/simix/UContext.cpp
src/simix/smx_context.cpp
src/simix/smx_global.cpp
src/simix/smx_private.h
src/simix/smx_process.cpp
src/smpi/smpi_bench.cpp
src/smpi/smpi_dvfs.cpp
src/surf/surf_interface.cpp
src/surf/surf_private.h
src/xbt/automaton/automaton_lexer.yy.c
src/xbt/automaton/automatonparse_promela.c
src/xbt/automaton/parserPromela.lex
src/xbt/automaton/parserPromela.tab.cacc
src/xbt/automaton/parserPromela.yacc
src/xbt/backtrace_linux.c
src/xbt/cunit.c
src/xbt/dict.c
src/xbt/ex.c
src/xbt/log.c
src/xbt/mmalloc/mm.c
src/xbt/mmalloc/mm_module.c
src/xbt/mmalloc/mmorecore.c
src/xbt/mmalloc/mmprivate.h
src/xbt/parmap.cpp
src/xbt/snprintf.c
src/xbt/xbt_log_appender_file.c
src/xbt/xbt_log_layout_format.c
src/xbt/xbt_log_layout_simple.c
src/xbt/xbt_main.c
src/xbt/xbt_os_file.c
src/xbt/xbt_os_thread.c
src/xbt/xbt_os_time.c
src/xbt/xbt_str.c
teshsuite/mc/dwarf/dwarf.cpp
teshsuite/mc/dwarf_expression/dwarf_expression.cpp
teshsuite/simdag/platforms/Evaluate_parse_time.c
teshsuite/smpi/mpich3-test/coll/nonblocking3.c
teshsuite/smpi/mpich3-test/datatype/contents.c
teshsuite/smpi/mpich3-test/rma/linked_list.c
teshsuite/smpi/mpich3-test/rma/linked_list_bench_lock_all.c
teshsuite/smpi/mpich3-test/rma/linked_list_bench_lock_excl.c
teshsuite/smpi/mpich3-test/rma/linked_list_bench_lock_shr.c
teshsuite/smpi/mpich3-test/rma/linked_list_fop.c
teshsuite/smpi/mpich3-test/rma/linked_list_lockall.c
teshsuite/xbt/parmap_bench/parmap_bench.c
teshsuite/xbt/parmap_test/parmap_test.c
tools/cmake/DefinePackages.cmake
tools/cmake/GCCFlags.cmake
tools/cmake/Modules/FindValgrind.cmake
tools/cmake/src/internal_config.h.in

index b0a6d3c..c22fc86 100644 (file)
@@ -186,21 +186,26 @@ include_directories(${INCLUDES})
 include(${CMAKE_HOME_DIRECTORY}/tools/cmake/Option.cmake)
 
 ### Determine the assembly flavor that we need today
+set(HAVE_RAW_CONTEXTS 0)
 include(CMakeDetermineSystem)
 IF(CMAKE_SYSTEM_PROCESSOR MATCHES ".86|AMD64|amd64")
   IF(${ARCH_32_BITS})
     message(STATUS "System processor: i686 (${CMAKE_SYSTEM_PROCESSOR}, 32 bits)")
     set(PROCESSOR_i686 1)
+    set(PROCESSOR_x86_64 0)
   ELSE()
     message(STATUS "System processor: x86_64 (${CMAKE_SYSTEM_PROCESSOR}, 64 bits)")
+    set(PROCESSOR_i686 0)
     set(PROCESSOR_x86_64 1)
   ENDIF()
   if (WIN32)
-    message(STATUS "Disable fast raw contextes on Windows.")
+    message(STATUS "Disable fast raw contexts on Windows.")
   else()
     set(HAVE_RAW_CONTEXTS 1)
   endif()
-
+ELSE()
+  set(PROCESSOR_i686 0)
+  set(PROCESSOR_x86_64 0)
 ENDIF()
 
 include(CheckFunctionExists)
@@ -270,6 +275,7 @@ CHECK_LIBRARY_EXISTS(rt      clock_gettime           "" HAVE_POSIX_GETTIME)
 CHECK_LIBRARY_EXISTS(pthread pthread_create          "" HAVE_PTHREAD)
 CHECK_LIBRARY_EXISTS(pthread sem_init                "" HAVE_SEM_INIT_LIB)
 CHECK_LIBRARY_EXISTS(pthread sem_open                "" HAVE_SEM_OPEN_LIB)
+set(HAVE_PTHREAD_SETAFFINITY 0)
 CHECK_LIBRARY_EXISTS(pthread pthread_setaffinity_np  "" HAVE_PTHREAD_SETAFFINITY)
 
 if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
@@ -300,14 +306,13 @@ CHECK_FUNCTION_EXISTS(process_vm_readv HAVE_PROCESS_VM_READV)
 CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
 
 CHECK_SYMBOL_EXISTS(vasprintf stdio.h HAVE_VASPRINTF)
-if(MINGW) 
+if(MINGW)
   # The detection of vasprintf fails on MinGW, assumingly because it's
   # defined as an inline function in stdio.h instead of a regular
   # function. So force the result to be 1 despite of the test.
   set(HAVE_VASPRINTF 1)
 endif()
 
-
 #Check if __thread is defined
 execute_process(
   COMMAND "${CMAKE_C_COMPILER} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_thread_storage.c -o testprog"
@@ -373,6 +378,8 @@ if(enable_smpi)
     message (STATUS "Warning:  no support for SMPI automatic privatization on this platform")
     SET(HAVE_PRIVATIZATION 0)
   endif()
+else()
+  SET(HAVE_SMPI 0)
 endif()
 
 #--------------------------------------------------------------------------------------------------
@@ -624,6 +631,24 @@ endif()
 
 ### Generate the required headers and scripts
 #############################################
+
+# gcc makes no difference between "#define HAVE_FOOBAR" and "#define HAVE_FOOBAR 0" by default, 
+# but this too error prone. If you forget to include the config.h, you get weird segfaults.
+# If you include it everywhere, everything gets recompiled everytime.
+# So we include only where needed, and compile with -Wundef to notice the missing includes.
+# But cmake sometimes defines to the empty definition (#define HAVE_VALGRIND_H).
+# So we have to make sure that everything got a decent value before generating the files.
+foreach(var HAVE_EXECINFO_H HAVE_FUTEX_H HAVE_GETDTABLESIZE HAVE_GETTIMEOFDAY HAVE_MMAP
+            HAVE_NANOSLEEP  HAVE_POPEN HAVE_POSIX_GETTIME HAVE_PROCESS_VM_READV HAVE_SIGNAL_H
+           HAVE_SYS_PARAM_H HAVE_SYS_SYSCTL_H HAVE_SYSCONF HAVE_UCONTEXT_H HAVE_UNISTD_H
+           HAVE_VALGRIND_H HAVE_VASPRINTF)
+  if(${var})
+    set(${var} 1)
+  else()
+    set(${var} 0)
+  endif()
+endforeach()
+
 # Avoid triggering a (full) rebuild by touching the files if they did not really change
 configure_file("${CMAKE_HOME_DIRECTORY}/tools/cmake/src/internal_config.h.in" "${CMAKE_BINARY_DIR}/src/internal_config.h.generated"    @ONLY IMMEDIATE)
 configure_file("${CMAKE_HOME_DIRECTORY}/include/simgrid_config.h.in"          "${CMAKE_BINARY_DIR}/include/simgrid_config.h.generated" @ONLY IMMEDIATE)
@@ -869,7 +894,7 @@ message("##########################################")
 message("#### Content of src/internal_config.h ####")
 message("##########################################")
 file(STRINGS ${CMAKE_CURRENT_BINARY_DIR}/src/internal_config.h config_output)
-LIST(REMOVE_AT config_output 0 1 2 3 4 5 6 7 8) # Pass the file header
+LIST(REMOVE_AT config_output 0 1 2 3 4 5 6 7 8 9 10) # Pass the file header
 foreach(line ${config_output})
   message("   ${line}")
 endforeach()
index 804ec75..b4de3b0 100644 (file)
@@ -16,11 +16,10 @@ endif()
 
 set(examples_src  ${examples_src}  ${CMAKE_CURRENT_SOURCE_DIR}/nas_common.h
                                    ${CMAKE_CURRENT_SOURCE_DIR}/nas_common.c
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/setparams.c
                                    ${CMAKE_CURRENT_SOURCE_DIR}/is.c
                                    ${CMAKE_CURRENT_SOURCE_DIR}/dt.c
                                    ${CMAKE_CURRENT_SOURCE_DIR}/ep.c
-                                   ${CMAKE_CURRENT_SOURCE_DIR}/dt-folding.c
                                    ${CMAKE_CURRENT_SOURCE_DIR}/DGraph.c
                                    ${CMAKE_CURRENT_SOURCE_DIR}/DGraph.h
-                                                                             PARENT_SCOPE)
+                                                                              PARENT_SCOPE)
+set(txt_files     ${txt_files}    ${CMAKE_CURRENT_SOURCE_DIR}/README.install  PARENT_SCOPE)
\ No newline at end of file
index 4749db6..e440d19 100644 (file)
@@ -21,7 +21,7 @@
 
 #define HAVE_JEDULE     @HAVE_JEDULE@ /* Was Jedule compiled in?  */
 #define HAVE_LUA        @HAVE_LUA@ /* Was the Lua support compiled in? */
-#define HAVE_MALLOCATOR @HAVE_MALLOCATOR@ /* Whether mallocators (object pools) were activated at compilation time. */
+#define HAVE_MALLOCATOR @HAVE_MALLOCATOR@ /* Were mallocators (object pools) compiled in? */
 #define HAVE_MC         @HAVE_MC@ /* Was the model-checking compiled in? */
 #define HAVE_NS3        @HAVE_NS3@ /* Was the NS3 support compiled in? */
 
index d042d98..9d4ea07 100644 (file)
@@ -9,8 +9,6 @@
 #ifndef XBT_BASE_H
 #define XBT_BASE_H
 
-#include "simgrid_config.h"
-
 /* Define _GNU_SOURCE for getline, isfinite, etc. */
 #ifndef _GNU_SOURCE
   #define _GNU_SOURCE
index fb62d48..116a6c3 100644 (file)
@@ -7,18 +7,14 @@
 /* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
    This file was then part of the GNU C Library. */
 
-#ifndef MMALLOC_H
-#define MMALLOC_H 1
+#ifndef SIMGRID_MMALLOC_H
+#define SIMGRID_MMALLOC_H 1
 
 #include "src/internal_config.h"
-#ifdef HAVE_MMALLOC
+#if HAVE_MMALLOC
 
-#ifdef HAVE_STDDEF_H
-#  include <stddef.h>
-#else
-#  include <sys/types.h>        /* for size_t */
-#  include <stdio.h>            /* for NULL */
-#endif
+# include <sys/types.h>        /* for size_t */
+# include <stdio.h>            /* for NULL */
 
 #include "xbt/dynar.h"
 #include "xbt/dict.h"
@@ -79,4 +75,4 @@ void* malloc_no_memset(size_t n);
 SG_END_DECL()
 
 #endif
-#endif                          /* MMALLOC_H */
+#endif                          /* SIMGRID_MMALLOC_H */
index 714ae0d..26bd2df 100644 (file)
@@ -6,6 +6,7 @@
 #ifndef SIMGRID_XBT_SIGNAL_HPP
 #define SIMGRID_XBT_SIGNAL_HPP
 
+#include "simgrid_config.h"
 #if SIMGRID_HAVE_LIBSIG
 #include <sigc++/sigc++.h>
 #else
index 71f7545..633162a 100644 (file)
@@ -7,6 +7,7 @@
 #ifndef SIMGRIC_XBT_STRING_HPP
 #define SIMGRIC_XBT_STRING_HPP
 
+#include "src/internal_config.h"
 #if HAVE_MC
 
 #include <stdexcept>
index fa2012a..9141c69 100644 (file)
@@ -60,10 +60,6 @@ XBT_LOG_EXTERNAL_CATEGORY(xbt);
  *  @{
  */
 
-#if defined(_MSC_VER) && !defined(strdup)
-#  define strdup _strdup /* POSIX name is not ANSI complient blabla */
-#endif
-
 /** @brief Like strdup, but xbt_die() on error */
 static XBT_ALWAYS_INLINE char *xbt_strdup(const char *s) {
   char *res = NULL;
index 86c33cb..8d07c51 100644 (file)
@@ -11,13 +11,9 @@ package org.simgrid.msg;
  * between processes.
  */
 public class Comm {
-       /**
-        * Indicates if the communication is a receiving communication
-        */
+       /** Indicates if the communication is a receiving communication */
        protected boolean receiving;
-       /**
-        * Indicates if the communication is finished
-        */
+       /** Indicates if the communication is finished */
        protected boolean finished = false;
        /**
         * Represents the bind between the java comm and the
@@ -25,13 +21,9 @@ public class Comm {
         * automatically set.
         */
        private long bind = 0;
-       /**
-        * Represents the bind for the task object pointer. Don't touch it.
-        */
+       /** Represents the bind for the task object pointer. Don't touch it. */
        private long taskBind = 0;
-       /**
-        * Task associated with the comm. Beware, it can be null 
-        */
+       /** Task associated with the comm. Beware, it can be null */
        protected Task task = null;
        /**
         * Protected constructor, used by Comm factories
@@ -75,9 +67,7 @@ public class Comm {
                return task;
        }
 
-       /**
-        * Class initializer, to initialize various JNI stuff
-        */
+       /** Class initializer, to initialize various JNI stuff */
        public static native void nativeInit();
        static {
                org.simgrid.NativeLib.nativeInit();
index 456e474..633f1ff 100644 (file)
@@ -41,9 +41,7 @@ public class File {
         * @param nMemb is the number of elements of data to write 
         */
        public native long write(long size, long nMemb);
-       /**
-        * Close the file.      
-        */
+       /** Close the file. */
        public native void close();
 
        /** Class initializer, to initialize various JNI stuff */
index ae953ee..c15b2af 100644 (file)
@@ -49,18 +49,10 @@ public class Host {
         * @see                         Host.getByName().
         */ 
        private long bind;
-       /**
-        * Host name
-        */
        protected String name;
 
-       /**
-        * User data.
-        */ 
+       /** User data. */ 
        private Object data;
-       /**
-        *
-        */
        protected Host() {
                this.bind = 0;
                this.data = null;
@@ -84,26 +76,13 @@ public class Host {
         */ 
        public native static Host getByName(String name) 
                        throws HostNotFoundException, NullPointerException;
-       /**
-        * This static method returns the count of the installed hosts.
-        *
-        * @return                      The count of the installed hosts.
-        */ 
+       /** Counts the installed hosts. */ 
        public native static int getCount();
 
-       /**
-        * This static method return an instance to the host of the current process.
-        *
-        * @return                      The host on which the current process is executed.
-        */ 
+       /** Returns the host of the current process. */ 
        public native static Host currentHost();
 
-       /**
-        * This static method returns all of the hosts of the installed platform.
-        *
-        * @return                      An array containing all the hosts installed.
-        *
-        */ 
+       /** Returns all hosts of the installed platform. */ 
        public native static Host[] all();
 
        /** 
@@ -120,99 +99,54 @@ public class Host {
        public static native void setAsyncMailbox(String mailboxName);
 
 
-       /**
-        * This method returns the name of a host.
-        * @return                      The name of the host.
-        *
-        */ 
+       /** Returns the name of an host. */ 
        public String getName() {
                return name;
        }
 
-       /**
-        * Sets the data of the host.
-        * @param data
-        */
+       /** Sets the user data of the host. */
        public void setData(Object data) {
                this.data = data;
        } 
-       /**
-        * Gets the data of the host.
-        *
-        * @return The data object associated with the host.
-        */
+       /** Gets the user data of the host. */
        public Object getData() {
                return this.data;
        }
-
-       /**
-        * Checks whether a host has data.
-        *
-        * @return True if the host has an associated data object.
-        */
+       /** Returns true if the host has an associated data object. */
        public boolean hasData() {
                return null != this.data;
        }
 
-       /**
-        * This method start the host if it is off
-        */ 
+       /** Starts the host if it is off */ 
        public native void on();
-
-       /**
-        * This method stop the host if it is on
-        */ 
+       /** Stops the host if it is on */ 
        public native void off();
 
 
        /**
-        * This method returns the speed of the processor of a host,
+        * This method returns the speed of the processor of a host (in flops),
         * regardless of the current load of the machine.
-        *
-        * @return                      The speed of the processor of the host in flops.
-        *
         */ 
        public native double getSpeed();
-
-       /**
-        * This method returns the number of core of a host.
-        *
-        * @return                      The speed of the processor of the host in flops.
-        *
-        */ 
+       /** Returns the number of core of a host. */ 
        public native double getCoreNumber();
 
-       /**
-        * Returns the value of a given host property. 
-        */
+       /** Returns the value of a given host property. */
        public native String getProperty(String name);
-
-       /**
-        * Change the value of a given host property. 
-        */
+       /** Changes the value of a given host property. */
        public native void setProperty(String name, String value);
-
-       /** This method tests if a host is up and running.
-        * @return True if the host is available.
-        */
+       /** Tests if an host is up and running. */
        public native boolean isOn();
 
-       /** This methods returns the list of mount point names on an host
-        * @return An array containing all mounted storages on the host
-        */
+       /** Returns the list of mount point names on an host */
        public native Storage[] getMountedStorage();
-
-       /** This methods returns the list of storages attached to an host
-        * @return An array containing all storages (name) attached to the host
-        */
+       /** This methods returns the list of storages (names) attached to an host */
        public native String[] getAttachedStorage();
 
        /** Returns the amount of Joules consumed by that host so far */
        public native double getConsumedEnergy();
 
-       /**
-        * Class initializer, to initialize various JNI stuff
-        */
+       /** Class initializer, to initialize various JNI stuff */
        public static native void nativeInit();
        static {
                nativeInit();
index 01eb5b9..7070131 100644 (file)
@@ -1,5 +1,3 @@
-/* This exception is raised when looking for a non-existing host. */
-
 /* Copyright (c) 2006-2014. The SimGrid Team.
  * All rights reserved.                                                     */
 
@@ -8,9 +6,7 @@
 
 package org.simgrid.msg;
 
-/**
- * This exception is raised when the host on which you are running has just been rebooted.
- */
+/** This exception is raised when the host on which you are running has just been rebooted. */
 public class HostFailureException extends MsgException {
        private static final long serialVersionUID = 1L;
 
@@ -18,11 +14,7 @@ public class HostFailureException extends MsgException {
        public HostFailureException() {
                super();
        }
-       /**
-        * Constructs an <code>HostFailureException</code> with a detail message. 
-        *
-        * @param   s   the detail message.
-        */
+       /** Constructs an <code>HostFailureException</code> with a detail message. */
        public HostFailureException(String s) {
                super(s);
        }
index 86b830e..79ef54c 100644 (file)
@@ -1,5 +1,3 @@
-/* This exception is raised when looking for a non-existing host. */
-
 /* Copyright (c) 2006-2014. The SimGrid Team.
  * All rights reserved.                                                     */
 
@@ -8,9 +6,7 @@
 
 package org.simgrid.msg;
 
-/**
- * This exception is raised when looking for a non-existing host.
- */
+/** This exception is raised when looking for a non-existing host. */
 public class HostNotFoundException extends MsgException {
        private static final long serialVersionUID = 1L;
 
@@ -18,11 +14,7 @@ public class HostNotFoundException extends MsgException {
        public HostNotFoundException() {
                super();
        }
-       /**
-        * Constructs an <code>HostNotFoundException</code> with a detail message. 
-        *
-        * @param   s   the detail message.
-        */
+       /** Constructs an <code>HostNotFoundException</code> with a detail message. */
        public HostNotFoundException(String s) {
                super(s);
        }
index ee3cafe..322ffde 100644 (file)
@@ -16,20 +16,14 @@ public class JniException extends RuntimeException {
        private static final long serialVersionUID = 1L;
 
 
-       /**
-        * Constructs an <code>JniException</code> without a 
-        * detail message. 
-        */
+       /** Constructs an <code>JniException</code> without a detail message. */
        public JniException() {
                super();
        }
-       /**
-        * Constructs an <code>JniException</code> with a detail message. 
-        *
-        * @param   s   the detail message.
-        */ public JniException(String s) {
+       /** Constructs an <code>JniException</code> with a detail message. */ 
+       public JniException(String s) {
                 super(s);
-        }
+       }
        public JniException(String string, Exception e) {
                super(string,e);
        }
index 263a22f..d16eb99 100644 (file)
@@ -12,47 +12,26 @@ import org.simgrid.NativeLib;
 
 public final class Msg {
 
-       /** Retrieve the simulation time
-        * @return The simulation time.
-        */
+       /** Retrieves the simulation time */
        public final static native double getClock();
-       /**
-        * Issue a debug logging message.
-        * @param s message to log.
-        */
-       public final static native void debug(String s);
-       /**
-        * Issue an verbose logging message.
-        * @param s message to log.
-        */
-       public final static native void verb(String s);
-
-       /** Issue an information logging message
-        * @param s
-        */
-       public final static native void info(String s);
-       /**
-        * Issue an warning logging message.
-        * @param s message to log.
-        */
-       public final static native void warn(String s);
-       /**
-        * Issue an error logging message.
-        * @param s message to log.
-        */
-       public final static native void error(String s);
-       /**
-        * Issue an critical logging message.
-        * @param s message to log.
-        */
+       /** Issue a debug logging message. */
+       public final static native void debug(String msg);
+       /** Issue a verbose logging message. */
+       public final static native void verb(String msg);
+       /** Issue an information logging message */
+       public final static native void info(String msg);
+       /** Issue a warning logging message. */
+       public final static native void warn(String msg);
+       /** Issue an error logging message. */
+       public final static native void error(String msg);
+       /** Issue a critical logging message. */
        public final static native void critical(String s);
 
        /*********************************************************************************
         * Deployment and initialization related functions                               *
         *********************************************************************************/
 
-       /**
-        * The natively implemented method to initialize a MSG simulation.
+       /** Initialize a MSG simulation.
         *
         * @param args            The arguments of the command line of the simulation.
         */
@@ -61,8 +40,7 @@ public final class Msg {
        /** Tell the kernel that you want to use the energy plugin */
        public final static native void energyInit();
 
-       /**
-        * Run the MSG simulation.
+       /** Run the MSG simulation.
         *
         * The simulation is not cleaned afterward (see  
         * {@link #clean()} if you really insist on cleaning the C side), so you can freely 
@@ -75,22 +53,12 @@ public final class Msg {
        @Deprecated
        public final static void clean(){}
 
-       /**
-        * The native implemented method to create the environment of the simulation.
-        *
-        * @param platformFile    The XML file which contains the description of the environment of the simulation
-        *
-        */
+       /** Create the simulation environment by parsing a platform file. */
        public final static native void createEnvironment(String platformFile);
 
        public final static native As environmentGetRoutingRoot();
 
-       /**
-        * The method to deploy the simulation.
-        *
-        *
-        * @param deploymentFile
-        */
+       /** Starts your processes by parsing a deployment file. */
        public final static native void deployApplication(String deploymentFile);
 
        /** Example launcher. You can use it or provide your own launcher, as you wish
index bebfe32..e683264 100644 (file)
@@ -8,32 +8,16 @@
 
 package org.simgrid.msg;
 
-/**
- * This exception is an abstract class grouping all MSG-related exceptions
- *
- *  <!--
- *    DOXYGEN_NAVBAR_CHILD "HostNotFoundException"=classsimgrid_1_1msg_1_1HostNotFoundException.html
- *    DOXYGEN_NAVBAR_CHILD "JniException"=classsimgrid_1_1msg_1_1JniException.html
- *    DOXYGEN_NAVBAR_CHILD "NativeException"=classsimgrid_1_1msg_1_1NativeException.html
- *    DOXYGEN_NAVBAR_CHILD "ProcessNotFoundException"=classsimgrid_1_1msg_1_1ProcessNotFoundException.html
- *  -->
- */
+/** This exception is an abstract class grouping all MSG-related exceptions */
 public abstract class MsgException extends Exception {
        private static final long serialVersionUID = 1L;
 
-       /**
-        * Constructs an <code>MsgException</code> without a 
-        * detail message. 
-        */
+       /** Constructs an <code>MsgException</code> without a detail message. */
        public MsgException() {
                super();
        }
-       /**
-        * Constructs an <code>MsgException</code> with a detail message. 
-        *
-        * @param   s   the detail message.
-        */ 
-       public MsgException(String s) {
-               super(s);
+       /** Constructs an <code>MsgException</code> with a detail message. */ 
+       public MsgException(String msg) {
+               super(msg);
        }
 }
index ed7340b..d670f55 100644 (file)
@@ -8,7 +8,8 @@ package org.simgrid.msg;
 /** A mutex  implemented on top of SimGrid synchronization mechanisms. 
  * You can use it exactly the same way that you use the mutexes, 
  * but to handle the interactions between the processes within the simulation.   
- *
+ * 
+ * Don't mix simgrid synchronization with Java native one, or it will deadlock!
  */
 public class Mutex {
        private long bind; // The C object -- don't touch it
@@ -29,9 +30,7 @@ public class Mutex {
        public native void acquire();
        public native void release();
 
-       /**
-        * Class initializer, to initialize various JNI stuff
-        */
+       /** Class initializer, to initialize various JNI stuff */
        public static native void nativeInit();
        static {
                org.simgrid.NativeLib.nativeInit();
index 0787db1..73b2523 100644 (file)
@@ -8,18 +8,11 @@
 
 package org.simgrid.msg;
 
-/**
- * This exception is raised when there is an error within the C world of SimGrid. 
- * Refer to the string message for more info on what went wrong.
- */
+/** This exception is raised when there is an error within the C world of SimGrid. */
 public class NativeException extends MsgException {
        private static final long serialVersionUID = 1L;
 
-       /**
-        * Constructs an <code>NativeException</code> with a detail message. 
-        *
-        * @param   s   the detail message.
-        */
+       /** Constructs an <code>NativeException</code> with a detail message. */
        public NativeException(String s) {
                super(s);
        }
index f408d16..42d1276 100644 (file)
@@ -47,9 +47,7 @@ public abstract class Process implements Runnable {
         * access to it. It is set automatically during the build of the object.
         */
        private long bind;
-       /**
-        * Indicates if the process is started
-        */
+       /** Indicates if the process is started */
        boolean started;
        /**
         * Even if this attribute is public you must never access to it.
@@ -66,8 +64,7 @@ public abstract class Process implements Runnable {
 
        /** Time at which the process should be created  */
        protected double startTime = 0;
-       /** Time at which th
-        * Kill time of the process
+       /** Time at which the process should be killed.
         * 
         * Set at creation, and used internally by SimGrid
         */
@@ -83,9 +80,7 @@ public abstract class Process implements Runnable {
        public Vector<String> args;
 
 
-       /**
-        * Default constructor
-        */
+       /**  Default constructor */
        protected Process() {
                this.id = nextProcessId++;
                this.name = null;
index bb32dba..403a264 100644 (file)
@@ -10,7 +10,7 @@
 #include <src/internal_config.h>
 #include <xbt/base.h>
 
-#ifdef HAVE_UCONTEXT_H
+#if HAVE_UCONTEXT_H
 #include <ucontext.h>           /* context relative declarations */
 #endif
 
@@ -20,7 +20,7 @@ typedef struct s_mc_transition *mc_transition_t;
 
 typedef struct s_stack_region{
   void *address;
-#ifdef HAVE_UCONTEXT_H
+#if HAVE_UCONTEXT_H
   ucontext_t* context;
 #endif
   size_t size;
index 0e8da69..d6352f5 100644 (file)
@@ -10,7 +10,7 @@
 #include <src/internal_config.h>
 #include <simgrid/simix.h>
 #include <simgrid/modelchecker.h> /* our public interface (and definition of HAVE_MC) */
-#ifdef HAVE_UCONTEXT_H
+#if HAVE_UCONTEXT_H
 #include <ucontext.h>           /* context relative declarations */
 #endif
 
@@ -78,7 +78,7 @@ XBT_PUBLIC(void) MC_ignore_heap(void *address, size_t size);
 XBT_PUBLIC(void) MC_remove_ignore_heap(void *address, size_t size);
 XBT_PUBLIC(void) MC_ignore_local_variable(const char *var_name, const char *frame);
 XBT_PUBLIC(void) MC_ignore_global_variable(const char *var_name);
-#ifdef HAVE_UCONTEXT_H
+#if HAVE_UCONTEXT_H
 XBT_PUBLIC(void) MC_register_stack_area(void *stack, smx_process_t process, ucontext_t* context, size_t size);
 #endif
 
index 2e0f5ad..1c7e1e8 100644 (file)
@@ -7,7 +7,7 @@
 #ifndef _SURF_MAXMIN_H
 #define _SURF_MAXMIN_H
 
-#include "src/portable.h"
+#include "src/internal_config.h"
 #include "xbt/misc.h"
 #include "xbt/asserts.h"
 #include "surf/datatypes.h"
index 5a78792..405f4e0 100644 (file)
@@ -13,7 +13,7 @@
 #include "xbt/graph.h"
 #include "xbt/misc.h"
 #include "xbt/config.h"
-#include "src/portable.h"
+#include "src/internal_config.h"
 #include "surf/surf_routing.h"
 #include "surf/datatypes.h"
 #include "xbt/lib.h"
index 89dc272..4e8499e 100644 (file)
@@ -44,8 +44,9 @@ ChunkedData::ChunkedData(PageStore& store, AddressSpace& as,
       continue;
     }
 
-      RemotePtr<void> page = remote(addr.address() + (i << xbt_pagebits));
-      xbt_assert(mc_page_offset((void*)page.address())==0,
+      RemotePtr<void> page = remote((void*)
+        simgrid::mc::mmu::join(i, addr.address()));
+      xbt_assert(simgrid::mc::mmu::split(page.address()).second == 0,
         "Not at the beginning of a page");
 
         /* Adding another copy (and a syscall) will probably slow things a lot.
index ac1fd1b..56f80dc 100644 (file)
@@ -9,10 +9,12 @@
 
 #include <string>
 #include <unordered_map>
+#include <memory>
 #include <vector>
 
 #include <xbt/base.h>
 
+#include "src/xbt/memory_map.hpp"
 #include "src/mc/mc_forward.h"
 #include "src/mc/Type.hpp"
 #include "src/mc/Frame.hpp"
@@ -97,7 +99,10 @@ public:
     const char* name, const char* scope);
 };
 
-
+XBT_PRIVATE std::shared_ptr<ObjectInformation> createObjectInformation(
+  std::vector<simgrid::xbt::VmMap> const& maps, const char* name);
+XBT_PRIVATE void postProcessObjectInformation(
+  simgrid::mc::Process* process, simgrid::mc::ObjectInformation* info);
 
 }
 }
index 8ed78ad..ac0ac6f 100644 (file)
@@ -174,7 +174,7 @@ void PageStore::ref_page(size_t pageno)
 inline __attribute__((always_inline))
 const void* PageStore::get_page(std::size_t pageno) const
 {
-  return mc_page_from_number(this->memory_, pageno);
+  return (void*) simgrid::mc::mmu::join(pageno, (std::uintptr_t) this->memory_);
 }
 
 inline __attribute__((always_inline))
index 6434732..6bf24dc 100644 (file)
@@ -29,7 +29,6 @@
 #include <xbt/base.h>
 #include <xbt/mmalloc.h>
 
-#include "src/mc/mc_object_info.h"
 #include "src/mc/mc_unw.h"
 #include "src/mc/mc_snapshot.h"
 #include "src/mc/mc_ignore.h"
@@ -108,13 +107,17 @@ struct s_mc_memory_map_re {
 
 static char* get_lib_name(const char* pathname, struct s_mc_memory_map_re* res)
 {
-  const char* map_basename = xbt_basename((char*) pathname);
+  char* map_basename = xbt_basename(pathname);
 
   regmatch_t match;
-  if(regexec(&res->so_re, map_basename, 1, &match, 0))
+  if(regexec(&res->so_re, map_basename, 1, &match, 0)) {
+    free(map_basename);
     return nullptr;
+  }
 
   char* libname = strndup(map_basename, match.rm_so);
+  free(map_basename);
+  map_basename = nullptr;
 
   // Strip the version suffix:
   if(libname && !regexec(&res->version_re, libname, 1, &match, 0)) {
@@ -315,7 +318,7 @@ void Process::init_memory_map_info()
 
   const char* current_name = nullptr;
 
-  this->object_infos.resize(0);
+  this->object_infos.clear();
 
   for (size_t i=0; i < maps.size(); i++) {
     simgrid::xbt::VmMap const& reg = maps[i];
@@ -357,7 +360,7 @@ void Process::init_memory_map_info()
     }
 
     std::shared_ptr<simgrid::mc::ObjectInformation> info =
-      MC_find_object_info(this->memory_map_, pathname);
+      simgrid::mc::createObjectInformation(this->memory_map_, pathname);
     this->object_infos.push_back(info);
     if (is_executable)
       this->binary_info = info;
@@ -371,7 +374,7 @@ void Process::init_memory_map_info()
 
   // Resolve time (including accross differents objects):
   for (auto const& object_info : this->object_infos)
-    MC_post_process_object_info(this, object_info.get());
+    postProcessObjectInformation(this, object_info.get());
 
   xbt_assert(this->maestro_stack_start_, "Did not find maestro_stack_start");
   xbt_assert(this->maestro_stack_end_, "Did not find maestro_stack_end");
@@ -489,7 +492,7 @@ const void *Process::read_bytes(void* buffer, std::size_t size,
     std::shared_ptr<simgrid::mc::ObjectInformation> const& info =
       this->find_object_info_rw((void*)address.address());
     // Segment overlap is not handled.
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
     if (info.get() && this->privatized(*info)) {
       if (process_index < 0)
         xbt_die("Missing process index");
index 333aed2..0c80a3b 100644 (file)
@@ -140,14 +140,14 @@ RegionSnapshot sparse_region(RegionType region_type,
     "Not at the beginning of a page");
   xbt_assert((((uintptr_t)permanent_addr) & (xbt_pagesize-1)) == 0,
     "Not at the beginning of a page");
-  size_t page_count = mc_page_count(size);
+  size_t page_count = simgrid::mc::mmu::chunkCount(size);
 
   std::vector<std::uint64_t> pagemap;
   const size_t* ref_page_numbers = nullptr;
   if (use_soft_dirty) {
     pagemap.resize(page_count);
     process->read_pagemap(pagemap.data(),
-      mc_page_number(nullptr, permanent_addr), page_count);
+      simgrid::mc::mmu::split((std::size_t) permanent_addr).first, page_count);
     ref_page_numbers = ref_region->page_data().pagenos();
   }
 
index 3e9a705..99b11bc 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <unistd.h>
 
+#include <fcntl.h>
 #include <string.h>
 #include <link.h>
 #include <dirent.h>
@@ -14,6 +15,7 @@
 #include "src/mc/mc_private.h"
 #include "xbt/module.h"
 #include <xbt/mmalloc.h>
+#include <xbt/memory.hpp>
 #include "src/smpi/private.h"
 
 #include "src/xbt/mmalloc/mmprivate.h"
@@ -81,7 +83,7 @@ static void restore(mc_mem_region_t region)
   }
 }
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
 RegionSnapshot privatized_region(
     RegionType region_type, void *start_addr, void* permanent_addr,
     std::size_t size, const RegionSnapshot* ref_region
@@ -133,7 +135,7 @@ void add_region(int index, mc_snapshot_t snapshot,
     ref_region = mc_model_checker->parent_snapshot_->snapshot_regions[index].get();
 
   simgrid::mc::RegionSnapshot region;
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
   const bool privatization_aware = object_info
     && mc_model_checker->process().privatized(*object_info);
   if (privatization_aware && MC_smpi_process_count())
@@ -172,7 +174,7 @@ static void get_memory_regions(simgrid::mc::Process* process, mc_snapshot_t snap
     heap->heaplimit,
     process->get_malloc_info());
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
   if (mc_model_checker->process().privatized() && MC_smpi_process_count())
     // snapshot->privatization_index = smpi_loaded_page
     mc_model_checker->process().read_variable(
@@ -191,14 +193,19 @@ void find_object_address(
   std::vector<simgrid::xbt::VmMap> const& maps,
   simgrid::mc::ObjectInformation* result)
 {
-  char* file_name = xbt_strdup(result->file_name.c_str());
-  const char *name = xbt_basename(file_name);
+  char* name = xbt_basename(result->file_name.c_str());
+
   for (size_t i = 0; i < maps.size(); ++i) {
     simgrid::xbt::VmMap const& reg = maps[i];
-    if (maps[i].pathname.empty()
-        || strcmp(xbt_basename(maps[i].pathname.c_str()), name)) {
-      // Nothing to do
-    } else if ((reg.prot & PROT_WRITE)) {
+    if (maps[i].pathname.empty())
+      continue;
+    char* map_basename = xbt_basename(maps[i].pathname.c_str());
+    if (strcmp(name, map_basename) != 0) {
+      free(map_basename);
+      continue;
+    }
+    free(map_basename);
+    if ((reg.prot & PROT_WRITE)) {
       xbt_assert(!result->start_rw,
                  "Multiple read-write segments for %s, not supported",
                  maps[i].pathname.c_str());
@@ -238,7 +245,8 @@ void find_object_address(
 
   xbt_assert(result->start_rw);
   xbt_assert(result->start_exec);
-  free(file_name);
+
+  free(name);
 }
 
 /************************************* Take Snapshot ************************************/
@@ -498,7 +506,7 @@ static std::vector<s_fd_infos_t> get_current_fds(pid_t pid)
 
     link[res] = '\0';
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
     if(smpi_is_privatisation_file(link))
       continue;
 #endif
@@ -514,8 +522,14 @@ static std::vector<s_fd_infos_t> get_current_fds(pid_t pid)
       continue;
 
     // If dot_output enabled, do not handle the corresponding file
-    if (dot_output !=  nullptr && strcmp(xbt_basename(link), _sg_mc_dot_output_file) == 0)
-      continue;
+    if (dot_output != nullptr) {
+      char* link_basename = xbt_basename(link);
+      if (strcmp(link_basename, _sg_mc_dot_output_file) == 0) {
+        free(link_basename);
+        continue;
+      }
+      free(link_basename);
+    }
 
     // This is probably a shared memory used by lttng-ust:
     if(strncmp("/dev/shm/ust-shm-tmp-", link, 21)==0)
@@ -586,7 +600,7 @@ void restore_snapshot_regions(mc_snapshot_t snapshot)
       restore(region.get());
   }
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
   // TODO, send a message to implement this in the MCed process
   if(snapshot->privatization_index >= 0) {
     // Fix the privatization mmap:
index 4afbc79..232feec 100644 (file)
@@ -23,7 +23,7 @@
 #include "src/mc/ObjectInformation.hpp"
 #include "src/mc/Variable.hpp"
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
 #include "src/smpi/private.h"
 #endif
 
@@ -236,7 +236,7 @@ static int compare_global_variables(simgrid::mc::ObjectInformation* object_info,
 {
   xbt_assert(r1 && r2, "Missing region.");
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
   if (r1->storage_type() == simgrid::mc::StorageType::Privatized) {
     xbt_assert(process_index >= 0);
     if (r2->storage_type() != simgrid::mc::StorageType::Privatized)
index 7a754a4..7942ae2 100644 (file)
@@ -11,6 +11,7 @@
 #include <memory>
 #include <utility>
 
+#include <fcntl.h>
 #include <cstdlib>
 #define DW_LANG_Objc DW_LANG_ObjC       /* fix spelling error in older dwarf.h */
 #include <dwarf.h>
@@ -24,7 +25,6 @@
 #include "src/mc/mc_private.h"
 #include "src/mc/mc_dwarf.hpp"
 
-#include "src/mc/mc_object_info.h"
 #include "src/mc/Process.hpp"
 #include "src/mc/ObjectInformation.hpp"
 #include "src/mc/Variable.hpp"
@@ -1092,6 +1092,7 @@ std::string to_hex(std::vector<char> const& data)
 }
 
 /** Base directories for external debug files */
+static
 const char* debug_paths[] = {
   "/usr/lib/debug/",
   "/usr/local/lib/debug/",
@@ -1306,8 +1307,11 @@ static void MC_post_process_types(simgrid::mc::ObjectInformation* info)
   }
 }
 
+namespace simgrid {
+namespace mc {
+
 /** \brief Finds informations about a given shared object/executable */
-std::shared_ptr<simgrid::mc::ObjectInformation> MC_find_object_info(
+std::shared_ptr<simgrid::mc::ObjectInformation> createObjectInformation(
   std::vector<simgrid::xbt::VmMap> const& maps, const char *name)
 {
   std::shared_ptr<simgrid::mc::ObjectInformation> result =
@@ -1325,7 +1329,7 @@ std::shared_ptr<simgrid::mc::ObjectInformation> MC_find_object_info(
 
 /*************************************************************************/
 
-void MC_post_process_object_info(simgrid::mc::Process* process, simgrid::mc::ObjectInformation* info)
+void postProcessObjectInformation(simgrid::mc::Process* process, simgrid::mc::ObjectInformation* info)
 {
   for (auto& i : info->types) {
 
@@ -1354,6 +1358,9 @@ void MC_post_process_object_info(simgrid::mc::Process* process, simgrid::mc::Obj
   }
 }
 
+}
+}
+
 namespace simgrid {
 namespace dwarf {
 
index 1df9b1a..e04d7fc 100644 (file)
@@ -91,7 +91,7 @@ void MC_register_stack_area(void *stack, smx_process_t process, ucontext_t* cont
   region.block =
       ((char *) stack -
        (char *) heap->heapbase) / BLOCKSIZE + 1;
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
   if (smpi_privatize_global_variables && process)
     region.process_index = smpi_process_index_of_smx_process(process);
   else
index 1117208..1438db4 100644 (file)
 
 #include <simgrid_config.h>
 
-SG_BEGIN_DECL()
+
+namespace simgrid {
+namespace mc {
+// TODO, do not depend on xbt_pagesize/xbt_pagebits but our own chunk size
+namespace mmu {
+
+static int chunkSize()
+{
+  return xbt_pagesize;
+}
 
 /** @brief How many memory pages are necessary to store size bytes?
  *
@@ -24,7 +33,7 @@ SG_BEGIN_DECL()
  *  @return Number of memory pages
  */
 static inline __attribute__ ((always_inline))
-size_t mc_page_count(size_t size)
+std::size_t chunkCount(std::size_t size)
 {
   size_t page_count = size >> xbt_pagebits;
   if (size & (xbt_pagesize-1))
@@ -32,47 +41,37 @@ size_t mc_page_count(size_t size)
   return page_count;
 }
 
-/** @brief Get the virtual memory page number of a given address
- *
- *  @param address Address
- *  @return Virtual memory page number of the given address
- */
+/** @brief Split into chunk number and remaining offset */
 static inline __attribute__ ((always_inline))
-size_t mc_page_number(const void* base, const void* address)
+std::pair<std::size_t, std::uintptr_t> split(std::uintptr_t offset)
 {
-  xbt_assert(address>=base, "The address is not in the range");
-  return ((std::uintptr_t) address - (std::uintptr_t) base) >> xbt_pagebits;
+  return {
+    offset >> xbt_pagebits,
+    offset & (xbt_pagesize-1)
+  };
 }
 
-/** @brief Get the offset of an address within a memory page
- *
- *  @param address Address
- *  @return Offset within the memory page
- */
+/** Merge chunk number and remaining offset info a global offset */
 static inline __attribute__ ((always_inline))
-size_t mc_page_offset(const void* address)
+std::uintptr_t join(std::size_t page, std::uintptr_t offset)
 {
-  return ((std::uintptr_t) address) & (xbt_pagesize-1);
+  return ((std::uintptr_t) page << xbt_pagebits) + offset;
 }
 
-/** @brief Get the virtual address of a virtual memory page
- *
- *  @param base Address of the first page
- *  @param page Index of the page
- */
 static inline __attribute__ ((always_inline))
-void* mc_page_from_number(const void* base, size_t page)
+std::uintptr_t join(std::pair<std::size_t,std::uintptr_t> value)
 {
-  return (void*) ((char*)base + (page << xbt_pagebits));
+  return join(value.first, value.second);
 }
 
 static inline __attribute__ ((always_inline))
-bool mc_same_page(const void* a, const void* b)
+bool sameChunk(std::uintptr_t a, std::uintptr_t b)
 {
-  return ((std::uintptr_t) a >> xbt_pagebits)
-    == ((std::uintptr_t) b >> xbt_pagebits);
+  return (a >> xbt_pagebits) == (b >> xbt_pagebits);
 }
 
-SG_END_DECL()
+}
+}
+}
 
 #endif
diff --git a/src/mc/mc_object_info.h b/src/mc/mc_object_info.h
deleted file mode 100644 (file)
index da93084..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (c) 2007-2015. 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. */
-
-#ifndef SIMGRID_MC_OBJECT_INFO_H
-#define SIMGRID_MC_OBJECT_INFO_H
-
-#include <vector>
-#include <memory>
-
-#include <xbt/base.h>
-
-#include "src/mc/mc_forward.hpp"
-#include "src/xbt/memory_map.hpp"
-
-XBT_PRIVATE std::shared_ptr<simgrid::mc::ObjectInformation> MC_find_object_info(
-  std::vector<simgrid::xbt::VmMap> const& maps, const char* name);
-XBT_PRIVATE  void MC_post_process_object_info(simgrid::mc::Process* process, simgrid::mc::ObjectInformation* info);
-
-#endif
index 217b58e..7677ad1 100644 (file)
@@ -35,7 +35,7 @@ void mc_restore_page_snapshot_region(simgrid::mc::Process* process,
 {
   for (size_t i = 0; i != pages_copy.page_count(); ++i) {
     // Otherwise, copy the page:
-    void* target_page = mc_page_from_number(start_addr, i);
+    void* target_page = (void*) simgrid::mc::mmu::join(i, (std::uintptr_t) start_addr);
     const void* source_page = pages_copy.page(i);
     process->write_bytes(source_page, xbt_pagesize, remote(target_page));
   }
@@ -47,7 +47,7 @@ void mc_region_restore_sparse(simgrid::mc::Process* process, mc_mem_region_t reg
 {
   xbt_assert(((reg->permanent_address().address()) & (xbt_pagesize-1)) == 0,
     "Not at the beginning of a page");
-  xbt_assert(mc_page_count(reg->size()) == reg->page_data().page_count());
+  xbt_assert(simgrid::mc::mmu::chunkCount(reg->size()) == reg->page_data().page_count());
   mc_restore_page_snapshot_region(process,
     (void*) reg->permanent_address().address(), reg->page_data());
 }
index 07f11b8..ef15f63 100644 (file)
@@ -207,7 +207,7 @@ const char* MC_smx_process_get_name(smx_process_t p)
   return info->name.c_str();
 }
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
 int MC_smpi_process_count(void)
 {
   if (mc_mode == MC_MODE_CLIENT)
index eb9e92d..12a3ef6 100644 (file)
@@ -39,7 +39,7 @@ mc_mem_region_t mc_get_snapshot_region(
       continue;
 
     if (region->storage_type() == simgrid::mc::StorageType::Privatized) {
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
       // Use the current process index of the snapshot:
       if (process_index == simgrid::mc::ProcessIndexDisabled)
         process_index = snapshot->privatization_index;
@@ -74,8 +74,11 @@ const void* MC_region_read_fragmented(mc_mem_region_t region, void* target, cons
   // Last byte of the memory area:
   void* end = (char*) addr + size - 1;
 
+  // TODO, we assume the chunks are aligned to natural chunk boundaries.
+  // We should remove this assumption.
+
   // Page of the last byte of the memory area:
-  size_t page_end = mc_page_number(nullptr, end);
+  size_t page_end = simgrid::mc::mmu::split((std::uintptr_t) end).first;
 
   void* dest = target;
 
@@ -83,9 +86,11 @@ const void* MC_region_read_fragmented(mc_mem_region_t region, void* target, cons
     xbt_die("Missing destination buffer for fragmented memory access");
 
   // Read each page:
-  while (mc_page_number(nullptr, addr) != page_end) {
+  while (simgrid::mc::mmu::split((std::uintptr_t) addr).first != page_end) {
     void* snapshot_addr = mc_translate_address_region_chunked((uintptr_t) addr, region);
-    void* next_page = mc_page_from_number(nullptr, mc_page_number(NULL, addr) + 1);
+    void* next_page = (void*) simgrid::mc::mmu::join(
+      simgrid::mc::mmu::split((std::uintptr_t) addr).first + 1,
+      0);
     size_t readable = (char*) next_page - (char*) addr;
     memcpy(dest, snapshot_addr, readable);
     addr = (char*) addr + readable;
index baaed85..ff3551f 100644 (file)
@@ -38,10 +38,11 @@ XBT_PRIVATE void mc_region_restore_sparse(simgrid::mc::Process* process, mc_mem_
 static inline __attribute__((always_inline))
 void* mc_translate_address_region_chunked(uintptr_t addr, mc_mem_region_t region)
 {
-  size_t pageno = mc_page_number((void*)region->start().address(), (void*) addr);
-  const void* snapshot_page =
-    region->page_data().page(pageno);
-  return (char*) snapshot_page + mc_page_offset((void*) addr);
+  auto split = simgrid::mc::mmu::split(addr - region->start().address());
+  auto pageno = split.first;
+  auto offset = split.second;
+  const void* snapshot_page = region->page_data().page(pageno);
+  return (char*) snapshot_page + offset;
 }
 
 static inline __attribute__((always_inline))
@@ -249,7 +250,7 @@ const void* MC_region_read(
     {
       // Last byte of the region:
       void* end = (char*) addr + size - 1;
-      if (mc_same_page(addr, end) ) {
+      if (simgrid::mc::mmu::sameChunk((std::uintptr_t) addr, (std::uintptr_t) end) ) {
         // The memory is contained in a single page:
         return mc_translate_address_region_chunked((uintptr_t) addr, region);
       } else {
index ab43771..b172da9 100644 (file)
@@ -202,7 +202,7 @@ int mc_unw_init_context(
 
   // Take a copy of the context for our own purpose:
   context->context = *c;
-#if defined(PROCESSOR_x86_64) || defined(PROCESSOR_i686)
+#if SIMGRID_PROCESSOR_x86_64 || SIMGRID_PROCESSOR_i686
   // On x86_64, ucontext_t contains a pointer to itself for FP registers.
   // We don't really need support for FR registers as they are caller saved
   // and probably never use those fields as libunwind-x86_64 does not read
index 45e767b..29b015b 100644 (file)
@@ -7,6 +7,7 @@
 #include <sys/types.h>
 #include <sys/uio.h>
 
+#include <fcntl.h>
 #include <libunwind.h>
 #include <libunwind-ptrace.h>
 
@@ -51,7 +52,7 @@ static int access_mem(const unw_addr_space_t as,
   pid_t pid = _UPT_getpid(arg);
   size_t size = sizeof(unw_word_t);
 
-#ifdef HAVE_PROCESS_VM_READV
+#if HAVE_PROCESS_VM_READV
   // process_vm_read implementation.
   // This is only available since Linux 3.2.
 
index c05d0ae..1d19bc5 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <utility>
 
+#include <fcntl.h>
 #include <signal.h>
 #include <poll.h>
 
diff --git a/src/portable.h b/src/portable.h
deleted file mode 100644 (file)
index 4866871..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/* portable -- header loading to write portable code within SimGrid         */
-
-/* Copyright (c) 2004, 2016. 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. */
-
-#ifndef SIMGRID_PORTABLE_H
-#define SIMGRID_PORTABLE_H
-
-#include "simgrid_config.h"       /* what was compiled in? */
-#include "src/internal_config.h"  /* some information about the environment */
-
-#include "xbt/base.h"
-#include "xbt/misc.h"
-#ifdef _WIN32
-# include <windows.h>
-#endif
-
-#include <stdarg.h>
-#include <stdio.h>
-
-#ifdef HAVE_UNISTD_H
-#  include <unistd.h>
-#endif
-
-#ifdef HAVE_SYS_PARAM_H
-# include <sys/param.h>
-#endif
-#ifdef HAVE_SYS_SYSCTL_H
-# include <sys/sysctl.h>
-#endif
-
-/* File handling */
-
-#include <fcntl.h>
-
-#ifdef _WIN32
-  #ifndef EWOULDBLOCK
-  #define EWOULDBLOCK WSAEWOULDBLOCK
-  #endif
-
-  #ifndef EINPROGRESS
-  #define EINPROGRESS WSAEINPROGRESS
-  #endif
-
-  #ifndef ETIMEDOUT
-  #define ETIMEDOUT   WSAETIMEDOUT
-  #endif
-
-  #ifdef S_IRGRP
-    #undef S_IRGRP
-  #endif
-  #define S_IRGRP 0
-
-  #ifdef S_IWGRP
-    #undef S_IWGRP
-  #endif
-  #define S_IWGRP 0
-#endif
-
-#ifndef O_BINARY
-#  define O_BINARY 0
-#endif
-
-/* Time handling */
-#include <sys/time.h>
-#include <time.h>
-
-/* Signals */
-#ifdef HAVE_SIGNAL_H
-# include <signal.h>
-#endif
-
-/* What we need to extract the backtrace in exception handling code */
-#ifdef HAVE_EXECINFO_H
-#  include <execinfo.h>
-#endif
-
-#endif                          /* SIMGRID_PORTABLE_H */
index d9757d6..1b7109c 100644 (file)
@@ -297,7 +297,9 @@ xbt_dynar_t SD_daxload(const char *filename)
   }
 
   if (!acyclic_graph_detail(result)){
-    XBT_ERROR("The DAX described in %s is not a DAG. It contains a cycle.", xbt_basename(filename));
+    char* base = xbt_basename(filename);
+    XBT_ERROR("The DAX described in %s is not a DAG. It contains a cycle.", base);
+    free(base);
     xbt_dynar_foreach(result, cpt, file)
       SD_task_destroy(file);
     xbt_dynar_free_container(&result);
index 2a93172..423df63 100644 (file)
@@ -4,6 +4,7 @@
 /* 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 "src/internal_config.h"
 #include "src/simdag/simdag_private.h"
 #include "simgrid/simdag.h"
 #include "xbt/file.h"
@@ -11,7 +12,7 @@
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_dotparse, sd, "Parsing DOT files");
 
-#ifdef HAVE_GRAPHVIZ
+#if HAVE_GRAPHVIZ
 #include <graphviz/cgraph.h>
 #endif
 
@@ -239,7 +240,9 @@ xbt_dynar_t SD_dotload_generic(const char * filename, seq_par_t seq_or_par, bool
   }
 
   if (result && !acyclic_graph_detail(result)) {
-    XBT_ERROR("The DOT described in %s is not a DAG. It contains a cycle.", xbt_basename((char*)filename));
+    char* base = xbt_basename(filename);
+    XBT_ERROR("The DOT described in %s is not a DAG. It contains a cycle.", base);
+    free(base);
     xbt_dynar_free(&result);
     result = NULL;
   }
index 658c008..899f452 100644 (file)
@@ -19,7 +19,7 @@
 #include "simgrid/simix.h"
 #include "simgrid/sg_config.h"
 #include "simgrid_config.h" /* what was compiled in? */
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
 #include "smpi/smpi_interface.h"
 #endif
 #include "mc/mc.h"
@@ -286,7 +286,7 @@ static void _sg_cfg_cb__weight_S(const char *name, int pos)
   sg_weight_S_parameter = xbt_cfg_get_double(_sg_cfg_set, name);
 }
 
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
 /* callback of the mpi collectives */
 static void _sg_cfg_cb__coll(const char *category,
                              s_mpi_coll_description_t * table,
@@ -695,11 +695,11 @@ void sg_config_init(int *argc, char **argv)
         sprintf(description,
                 "Context factory to use in SIMIX. Possible values: %s",
                 dflt_ctx_fact);
-#ifdef HAVE_UCONTEXT_CONTEXTS
+#if HAVE_UCONTEXT_CONTEXTS
       dflt_ctx_fact = "ucontext";
       p += sprintf(p, ", %s", dflt_ctx_fact);
 #endif
-#ifdef HAVE_RAW_CONTEXTS
+#if HAVE_RAW_CONTEXTS
       dflt_ctx_fact = "raw";
       p += sprintf(p, ", %s", dflt_ctx_fact);
 #endif
@@ -745,7 +745,7 @@ void sg_config_init(int *argc, char **argv)
     xbt_cfg_register(&_sg_cfg_set, "contexts/synchro",
                      "Synchronization mode to use when running contexts in parallel (either futex, posix or busy_wait)",
                      xbt_cfgelm_string, 1, 1, _sg_cfg_cb_contexts_parallel_mode);
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
     xbt_cfg_setdefault_string(_sg_cfg_set, "contexts/synchro", "futex");
 #else //No futex on mac and posix is unimplememted yet
     xbt_cfg_setdefault_string(_sg_cfg_set, "contexts/synchro", "busy_wait");
@@ -789,7 +789,7 @@ void sg_config_init(int *argc, char **argv)
                      xbt_cfgelm_string, 1, 1, NULL);
     xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/IB_penalty_factors", "0.965;0.925;1.35");
     
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
     xbt_cfg_register(&_sg_cfg_set, "smpi/running_power",
                      "Power of the host running the simulation (in flop/s). Used to bench the operations.",
                      xbt_cfgelm_double, 1, 1, NULL);
index 8af1011..241ecc3 100644 (file)
@@ -38,7 +38,7 @@ public:
   void resume();
 };
 
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
 class BoostParallelContext : public BoostContext {
 public:
   BoostParallelContext(std::function<void()> code,
@@ -66,7 +66,7 @@ BoostContextFactory::BoostContextFactory()
 {
   BoostContext::parallel_ = SIMIX_context_is_parallel();
   if (BoostContext::parallel_) {
-#ifndef HAVE_THREAD_CONTEXTS
+#if !HAVE_THREAD_CONTEXTS
     xbt_die("No thread support for parallel context execution");
 #else
     int nthreads = SIMIX_context_get_nthreads();
@@ -81,7 +81,7 @@ BoostContextFactory::BoostContextFactory()
 
 BoostContextFactory::~BoostContextFactory()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   if (BoostContext::parmap_) {
     xbt_parmap_destroy(BoostContext::parmap_);
     BoostContext::parmap_ = nullptr;
@@ -95,7 +95,7 @@ smx_context_t BoostContextFactory::create_context(std::function<void()>  code,
 {
   BoostContext* context = nullptr;
   if (BoostContext::parallel_)
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
     context = this->new_context<BoostParallelContext>(
       std::move(code), cleanup_func, process);
 #else
@@ -109,7 +109,7 @@ smx_context_t BoostContextFactory::create_context(std::function<void()>  code,
 
 void BoostContextFactory::run_all()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   if (BoostContext::parallel_) {
     BoostContext::threads_working_ = 0;
     xbt_parmap_apply(BoostContext::parmap_,
@@ -232,7 +232,7 @@ void BoostSerialContext::stop()
 
 // BoostParallelContext
 
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
 
 void BoostParallelContext::suspend()
 {
index 96cedd1..4405027 100644 (file)
@@ -83,7 +83,7 @@ ContextFactory* raw_factory()
 
 // ***** Loads of static stuff
 
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
 static xbt_parmap_t raw_parmap;
 static simgrid::simix::RawContext** raw_workers_context;    /* space to save the worker context in each thread */
 static uintptr_t raw_threads_working;     /* number of threads that have started their work */
@@ -123,7 +123,7 @@ extern "C" raw_stack_t raw_makecontext(void* malloced_stack, int stack_size,
                                    rawctx_entry_point_t entry_point, void* arg);
 extern "C" void raw_swapcontext(raw_stack_t* old, raw_stack_t new_context);
 
-#if PROCESSOR_x86_64
+#if SIMGRID_PROCESSOR_x86_64
 __asm__ (
 #if defined(__APPLE__)
    ".text\n"
@@ -203,7 +203,7 @@ __asm__ (
    "   pop %rdi\n"
    "   ret\n"
 );
-#elif PROCESSOR_i686
+#elif SIMGRID_PROCESSOR_i686
 __asm__ (
 #if defined(__APPLE__) || defined(_WIN32)
    ".text\n"
@@ -286,7 +286,7 @@ RawContextFactory::RawContextFactory()
 #endif
   raw_context_parallel = SIMIX_context_is_parallel();
   if (raw_context_parallel) {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
     int nthreads = SIMIX_context_get_nthreads();
     xbt_os_thread_key_create(&raw_worker_id_key);
     // TODO, lazily init
@@ -305,7 +305,7 @@ RawContextFactory::RawContextFactory()
 
 RawContextFactory::~RawContextFactory()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   if (raw_parmap)
     xbt_parmap_destroy(raw_parmap);
   xbt_free(raw_workers_context);
@@ -380,7 +380,7 @@ void RawContextFactory::run_all_serial()
 
 void RawContextFactory::run_all_parallel()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   raw_threads_working = 0;
   if (raw_parmap == nullptr)
     raw_parmap = xbt_parmap_new(
@@ -428,7 +428,7 @@ void RawContext::suspend_serial()
 
 void RawContext::suspend_parallel()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   /* determine the next context */
   smx_process_t next_work = (smx_process_t) xbt_parmap_next(raw_parmap);
   RawContext* next_context = nullptr;
@@ -469,7 +469,7 @@ void RawContext::resume_serial()
 
 void RawContext::resume_parallel()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   uintptr_t worker_id = __sync_fetch_and_add(&raw_threads_working, 1);
   xbt_os_thread_set_specific(raw_worker_id_key, (void*) worker_id);
   RawContext* worker_context = (RawContext*) SIMIX_context_self();
index c84dc52..91857d8 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "xbt/function_types.h"
 #include "smx_private.h"
-#include "src/portable.h"           /* loads context system definitions */
+#include "src/internal_config.h"           /* loads context system definitions */
 #include "xbt/swag.h"
 #include "xbt/xbt_os_thread.h"
 #include "src/xbt_modinter.h"       /* prototype of os thread module's init/exit in XBT */
index 51a8afb..8852c73 100644 (file)
@@ -57,7 +57,7 @@ namespace simix {
 }
 }
 
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
 static xbt_parmap_t sysv_parmap;
 static simgrid::simix::ParallelUContext** sysv_workers_context;   /* space to save the worker's context in each thread */
 static uintptr_t sysv_threads_working;     /* number of threads that have started their work */
@@ -131,7 +131,7 @@ UContextFactory::UContextFactory() : ContextFactory("UContextFactory")
 {
   if (SIMIX_context_is_parallel()) {
     sysv_parallel = true;
-#ifdef HAVE_THREAD_CONTEXTS  /* To use parallel ucontexts a thread pool is needed */
+#if HAVE_THREAD_CONTEXTS  /* To use parallel ucontexts a thread pool is needed */
     int nthreads = SIMIX_context_get_nthreads();
     sysv_parmap = nullptr;
     sysv_workers_context = xbt_new(ParallelUContext*, nthreads);
@@ -147,7 +147,7 @@ UContextFactory::UContextFactory() : ContextFactory("UContextFactory")
 
 UContextFactory::~UContextFactory()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   if (sysv_parmap)
     xbt_parmap_destroy(sysv_parmap);
   xbt_free(sysv_workers_context);
@@ -161,7 +161,7 @@ UContextFactory::~UContextFactory()
 void UContextFactory::run_all()
 {
   if (sysv_parallel) {
-    #ifdef HAVE_THREAD_CONTEXTS
+    #if HAVE_THREAD_CONTEXTS
       sysv_threads_working = 0;
       // Parmap_apply ensures that every working thread get an index in the
       // process_to_run array (through an atomic fetch_and_add),
@@ -303,7 +303,7 @@ void ParallelUContext::stop()
 /** Run one particular simulated process on the current thread. */
 void ParallelUContext::resume()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   // What is my containing body?
   uintptr_t worker_id = __sync_fetch_and_add(&sysv_threads_working, 1);
   // Store the number of my containing body in os-thread-specific area :
@@ -344,7 +344,7 @@ void ParallelUContext::resume()
  */
 void ParallelUContext::suspend()
 {
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   /* determine the next context */
   // Get the next soul to embody now:
   smx_process_t next_work = (smx_process_t) xbt_parmap_next(sysv_parmap);
index 82a78fd..87ea4dc 100644 (file)
@@ -6,7 +6,7 @@
 /* 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 "src/portable.h"
+#include "src/internal_config.h"
 #include "xbt/log.h"
 #include "xbt/swag.h"
 #include "xbt/xbt_os_thread.h"
@@ -29,7 +29,7 @@
 #define _aligned_free  __mingw_aligned_free 
 #endif //MINGW
 
-#ifdef HAVE_VALGRIND_H
+#if HAVE_VALGRIND_H
 # include <valgrind/valgrind.h>
 #endif
 
@@ -40,7 +40,7 @@ int smx_context_stack_size;
 int smx_context_stack_size_was_set = 0;
 int smx_context_guard_size;
 int smx_context_guard_size_was_set = 0;
-#ifdef HAVE_THREAD_LOCAL_STORAGE
+#if HAVE_THREAD_LOCAL_STORAGE
 static XBT_THREAD_LOCAL smx_context_t smx_current_context_parallel;
 #else
 static xbt_os_thread_key_t smx_current_context_key = 0;
@@ -55,7 +55,7 @@ static e_xbt_parmap_mode_t smx_parallel_synchronization_mode = XBT_PARMAP_DEFAUL
  */
 void SIMIX_context_mod_init(void)
 {
-#if defined(HAVE_THREAD_CONTEXTS) && !defined(HAVE_THREAD_LOCAL_STORAGE)
+#if HAVE_THREAD_CONTEXTS && !HAVE_THREAD_LOCAL_STORAGE
   /* the __thread storage class is not available on this platform:
    * use getspecific/setspecific instead to store the current context in each thread */
   xbt_os_thread_key_create(&smx_current_context_key);
@@ -65,37 +65,37 @@ void SIMIX_context_mod_init(void)
     if (simgrid::simix::factory_initializer)
       simix_global->context_factory = simgrid::simix::factory_initializer();
     else { /* use the factory specified by --cfg=contexts/factory:value */
-#if defined(HAVE_THREAD_CONTEXTS)
+#if HAVE_THREAD_CONTEXTS
       if (!strcmp(smx_context_factory_name, "thread"))
         simix_global->context_factory = simgrid::simix::thread_factory();
 #else
       if (0);
 #endif
-#ifdef HAVE_UCONTEXT_CONTEXTS
+#if HAVE_UCONTEXT_CONTEXTS
       else if (!strcmp(smx_context_factory_name, "ucontext"))
         simix_global->context_factory = simgrid::simix::sysv_factory();
 #endif
-#ifdef HAVE_RAW_CONTEXTS
+#if HAVE_RAW_CONTEXTS
       else if (!strcmp(smx_context_factory_name, "raw"))
         simix_global->context_factory = simgrid::simix::raw_factory();
 #endif
-#ifdef HAVE_BOOST_CONTEXTS
+#if HAVE_BOOST_CONTEXTS
       else if (!strcmp(smx_context_factory_name, "boost"))
         simix_global->context_factory = simgrid::simix::boost_factory();
 #endif
       else {
         XBT_ERROR("Invalid context factory specified. Valid factories on this machine:");
-#ifdef HAVE_RAW_CONTEXTS
+#if HAVE_RAW_CONTEXTS
         XBT_ERROR("  raw: high performance context factory implemented specifically for SimGrid");
 #else
         XBT_ERROR("  (raw contexts were disabled at compilation time on this machine -- check configure logs for details)");
 #endif
-#ifdef HAVE_UCONTEXT_CONTEXTS
+#if HAVE_UCONTEXT_CONTEXTS
         XBT_ERROR("  ucontext: classical system V contexts (implemented with makecontext, swapcontext and friends)");
 #else
         XBT_ERROR("  (ucontext was disabled at compilation time on this machine -- check configure logs for details)");
 #endif
-#ifdef HAVE_BOOST_CONTEXTS
+#if HAVE_BOOST_CONTEXTS
         XBT_ERROR("  boost: this uses the boost libraries context implementation");
 #else
         XBT_ERROR("  (boost was disabled at compilation time on this machine -- check configure logs for details. Did you install the libboost-context-dev package?)");
@@ -160,7 +160,7 @@ void *SIMIX_context_stack_new(void)
     stack = xbt_malloc0(smx_context_stack_size);
   }
 
-#ifdef HAVE_VALGRIND_H
+#if HAVE_VALGRIND_H
   unsigned int valgrind_stack_id = VALGRIND_STACK_REGISTER(stack, (char *)stack + smx_context_stack_size);
   memcpy((char *)stack + smx_context_usable_stack_size, &valgrind_stack_id, sizeof valgrind_stack_id);
 #endif
@@ -173,7 +173,7 @@ void SIMIX_context_stack_delete(void *stack)
   if (!stack)
     return;
 
-#ifdef HAVE_VALGRIND_H
+#if HAVE_VALGRIND_H
   unsigned int valgrind_stack_id;
   memcpy(&valgrind_stack_id, (char *)stack + smx_context_usable_stack_size, sizeof valgrind_stack_id);
   VALGRIND_STACK_DEREGISTER(valgrind_stack_id);
@@ -225,7 +225,7 @@ void SIMIX_context_set_nthreads(int nb_threads) {
      nb_threads = xbt_os_get_numcores();
      XBT_INFO("Auto-setting contexts/nthreads to %d",nb_threads);
   }   
-#ifndef HAVE_THREAD_CONTEXTS
+#if !HAVE_THREAD_CONTEXTS
   xbt_assert(nb_threads == 1, "Parallel runs are impossible when the pthreads are missing.");
 #endif
   smx_parallel_contexts = nb_threads;
@@ -282,7 +282,7 @@ void SIMIX_context_set_parallel_mode(e_xbt_parmap_mode_t mode) {
 smx_context_t SIMIX_context_get_current(void)
 {
   if (SIMIX_context_is_parallel()) {
-#ifdef HAVE_THREAD_LOCAL_STORAGE
+#if HAVE_THREAD_LOCAL_STORAGE
     return smx_current_context_parallel;
 #else
     return xbt_os_thread_get_specific(smx_current_context_key);
@@ -300,7 +300,7 @@ smx_context_t SIMIX_context_get_current(void)
 void SIMIX_context_set_current(smx_context_t context)
 {
   if (SIMIX_context_is_parallel()) {
-#ifdef HAVE_THREAD_LOCAL_STORAGE
+#if HAVE_THREAD_LOCAL_STORAGE
     smx_current_context_parallel = context;
 #else
     xbt_os_thread_set_specific(smx_current_context_key, context);
index 2d559e7..b48faf5 100644 (file)
@@ -5,7 +5,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include <stdlib.h>
-#include "src/portable.h"
+#include "src/internal_config.h"
 
 #include "src/surf/surf_interface.hpp"
 #include "src/surf/storage_interface.hpp"
@@ -88,9 +88,9 @@ static void segvhandler(int signum, siginfo_t *siginfo, void *context)
     }
   } else  if (siginfo->si_signo == SIGSEGV) {
     fprintf(stderr, "Segmentation fault.\n");
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
     if (smpi_enabled() && !smpi_privatize_global_variables) {
-#ifdef HAVE_PRIVATIZATION
+#if HAVE_PRIVATIZATION
       fprintf(stderr,
         "Try to enable SMPI variable privatization with --cfg=smpi/privatize_global_variables:yes.\n");
 #else
index 938b5d4..caca310 100644 (file)
@@ -7,6 +7,7 @@
 #ifndef _SIMIX_PRIVATE_H
 #define _SIMIX_PRIVATE_H
 
+#include "src/internal_config.h"
 #include "simgrid/simix.h"
 #include "surf/surf.h"
 #include "xbt/base.h"
@@ -26,6 +27,8 @@
 #include "popping_private.h"
 #include "smx_synchro_private.h"
 
+#include <signal.h>
+
 #ifdef __cplusplus
 
 #include <simgrid/simix.hpp>
@@ -221,7 +224,7 @@ XBT_PUBLIC_DATA(char sigsegv_stack[SIGSTKSZ]);
 /* We are using the bottom of the stack to save some information, like the
  * valgrind_stack_id. Define smx_context_usable_stack_size to give the remaining
  * size for the stack. */
-#ifdef HAVE_VALGRIND_H
+#if HAVE_VALGRIND_H
 # define smx_context_usable_stack_size                                  \
   (smx_context_stack_size - sizeof(unsigned int)) /* for valgrind_stack_id */
 #else
index 99063d9..0215582 100644 (file)
@@ -294,7 +294,7 @@ smx_process_t SIMIX_process_create(
        process->ppid = SIMIX_process_get_PID(parent_process);
        /* SMPI process have their own data segment and
           each other inherit from their father */
-#ifdef HAVE_SMPI
+#if HAVE_SMPI
        if(smpi_privatize_global_variables){
          if( parent_process->pid != 0){
            SIMIX_segment_index_set(process, parent_process->segment_index);
@@ -383,7 +383,7 @@ smx_process_t SIMIX_process_attach(
     process->ppid = SIMIX_process_get_PID(parent_process);
    /* SMPI process have their own data segment and
       each other inherit from their father */
-  #ifdef HAVE_SMPI
+  #if HAVE_SMPI
     if(smpi_privatize_global_variables){
       if(parent_process->pid != 0){
         SIMIX_segment_index_set(process, parent_process->segment_index);
index e5d3510..00ded92 100644 (file)
@@ -616,7 +616,7 @@ void smpi_really_switch_data_segment(int dest) {
   if(smpi_size_data_exe == 0)//no need to switch
     return;
 
-#ifdef HAVE_PRIVATIZATION
+#if HAVE_PRIVATIZATION
   if(smpi_loaded_page==-1){//initial switch, do the copy from the real page here
     for (int i=0; i< smpi_process_count(); i++){
       memcpy(smpi_privatisation_regions[i].address, TOPAGE(smpi_start_data_exe), smpi_size_data_exe);
@@ -641,7 +641,7 @@ int smpi_is_privatisation_file(char* file)
 
 void smpi_initialize_global_memory_segments(){
 
-#ifndef HAVE_PRIVATIZATION
+#if !HAVE_PRIVATIZATION
   smpi_privatize_global_variables=0;
   xbt_die("You are trying to use privatization on a system that does not support it. Don't.");
   return;
@@ -712,7 +712,7 @@ Ask the Internet about tutorials on how to increase the files limit such as: htt
 void smpi_destroy_global_memory_segments(){
   if (smpi_size_data_exe == 0)//no need to switch
     return;
-#ifdef HAVE_PRIVATIZATION
+#if HAVE_PRIVATIZATION
   int i;
   for (i=0; i< smpi_process_count(); i++){
     if(munmap(smpi_privatisation_regions[i].address, smpi_size_data_exe) < 0) {
index 478f234..c5d9142 100644 (file)
@@ -68,7 +68,7 @@ double smpi_get_host_consumed_energy(void) {
   return sg_host_get_consumed_energy(SIMIX_host_self());
 }
 
-#ifdef SMPI_FORTRAN
+#if SMPI_FORTRAN
 
 #if defined(__alpha__) || defined(__sparc64__) || defined(__x86_64__) || defined(__ia64__)
 typedef int integer;
index d16f7c9..1dcc754 100644 (file)
@@ -4,7 +4,7 @@
 /* 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 "src/portable.h"
+#include "src/internal_config.h"
 #include "surf_private.h"
 #include "surf_interface.hpp"
 #include "network_interface.hpp"
@@ -103,7 +103,7 @@ s_surf_model_description_t surf_storage_model_description[] = {
   {NULL, NULL,  NULL}      /* this array must be NULL terminated */
 };
 
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
 static xbt_parmap_t surf_parmap = NULL; /* parallel map on models */
 #endif
 
@@ -342,7 +342,7 @@ void surf_exit(void)
     future_evt_set = nullptr;
   }
 
-#ifdef HAVE_THREAD_CONTEXTS
+#if HAVE_THREAD_CONTEXTS
   xbt_parmap_destroy(surf_parmap);
 #endif
 
index 2d74f70..080e5e2 100644 (file)
@@ -10,6 +10,7 @@
 #include "surf/surf.h"
 #include "surf/maxmin.h"
 #include "src/surf/trace_mgr.hpp"
+#include <stdio.h>
 
 #define NO_MAX_DURATION -1.0
 
index da2a760..4580e33 100644 (file)
@@ -529,7 +529,7 @@ char *xbt_automaton_parser_text;
 #line 10 "parserPromela.lex"
 
 #include "simgrid_config.h"
-#ifndef HAVE_UNISTD_H
+#if !HAVE_UNISTD_H
 #define YY_NO_UNISTD_H /* hello Windows */
 
 #ifdef _MSC_VER
index 2ed7b56..d62c20d 100644 (file)
@@ -6,10 +6,13 @@
 /* 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 "xbt/automaton.h"
 #include "src/internal_config.h"
+#include "xbt/automaton.h"
 #include <errno.h>
-#include <string.h>             /* strerror */
+#include <string.h>   /* strerror */
+#if HAVE_UNISTD_H
+# include <unistd.h>   /* isatty */
+#endif
 
 static xbt_automaton_t parsed_automaton;
 char* state_id_src;
index b93895b..b0dd1eb 100644 (file)
@@ -9,7 +9,7 @@
 %{
 
 #include "simgrid_config.h"
-#ifndef HAVE_UNISTD_H
+#if !HAVE_UNISTD_H
 #define YY_NO_UNISTD_H /* hello Windows */
 
 #ifdef _MSC_VER
index 46e1170..52a2cea 100644 (file)
@@ -73,7 +73,7 @@
 #line 7 "parserPromela.yacc" /* yacc.c:339  */
 
 #include "simgrid_config.h"
-#ifndef HAVE_UNISTD_H
+#if !HAVE_UNISTD_H
 #define YY_NO_UNISTD_H /* hello Windows */
 #endif
 
index d5789f0..b96bc93 100644 (file)
@@ -6,7 +6,7 @@
 
 %{
 #include "simgrid_config.h"
-#ifndef HAVE_UNISTD_H
+#if !HAVE_UNISTD_H
 #define YY_NO_UNISTD_H /* hello Windows */
 #endif
 
index 5bdd34c..a1a09e1 100644 (file)
@@ -7,6 +7,7 @@
 /* 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 <unistd.h>
 #include <execinfo.h>
 #include <sys/stat.h>
 
index 5235db6..01c3f3e 100644 (file)
@@ -9,7 +9,8 @@
 /* This is partially inspirated from the OSSP ts (Test Suite Library)       */
 /* At some point we should use https://github.com/google/googletest instead */
 
-#include "src/portable.h"
+#include "src/internal_config.h"
+#include <stdio.h>
 
 #include "xbt/sysdep.h"         /* bvprintf */
 #include "xbt/cunit.h"
index c2268fa..28c1165 100644 (file)
@@ -603,7 +603,7 @@ void xbt_dict_postexit(void)
 #ifdef SIMGRID_TEST
 #include "xbt.h"
 #include "xbt/ex.h"
-#include "src/portable.h"
+#include "src/internal_config.h"
 
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(xbt_dict);
index 7db2ce5..9d3dca6 100644 (file)
@@ -45,7 +45,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "src/portable.h"           /* execinfo when available */
+#include "src/internal_config.h"           /* execinfo when available */
 #include "xbt/ex.h"
 #include "xbt/str.h"
 #include "xbt/synchro_core.h"
@@ -57,7 +57,7 @@
 #include "simgrid/simix.h" /* SIMIX_process_self_get_name() */
 
 #undef HAVE_BACKTRACE
-#if defined(HAVE_EXECINFO_H) && defined(HAVE_POPEN) && defined(ADDR2LINE)
+#if HAVE_EXECINFO_H && HAVE_POPEN && defined(ADDR2LINE)
 # define HAVE_BACKTRACE 1       /* Hello linux box */
 #endif
 
@@ -120,7 +120,7 @@ void xbt_backtrace_display_current(void)
   xbt_backtrace_display(&e);
 }
 
-#if defined(HAVE_EXECINFO_H) && defined(HAVE_POPEN) && defined(ADDR2LINE)
+#if HAVE_EXECINFO_H && HAVE_POPEN && defined(ADDR2LINE)
 # include "src/xbt/backtrace_linux.c"
 #else
 # include "src/xbt/backtrace_dummy.c"
index 1a13c86..8701f99 100644 (file)
@@ -11,7 +11,7 @@
 #include <stdio.h>              /* snprintf */
 #include <stdlib.h>             /* snprintf */
 
-#include "src/portable.h"
+#include "src/internal_config.h"
 
 #include "src/xbt_modinter.h"
 
index 031bb3e..be48e42 100644 (file)
 
 /* Copyright 1996, 2000 Free Software Foundation  */
 
-#ifdef HAVE_UNISTD_H
+#define _GNU_SOURCE
+#include "src/internal_config.h"
+#if HAVE_UNISTD_H
 #include <unistd.h>             /* Prototypes for lseek, sbrk (maybe) */
 #endif
+
 #include "mfree.c"
 #include "mmalloc.c"
 #include "mrealloc.c"
index fea22d3..8d3b0d0 100644 (file)
@@ -32,7 +32,7 @@
 #include <fcntl.h>              /* After sys/types.h, at least for dpx/2.  */
 #include <sys/stat.h>
 #include <string.h>
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>             /* Prototypes for lseek */
 #endif
 #include "mmprivate.h"
index e78ba90..c80e74f 100644 (file)
@@ -11,7 +11,7 @@
    Contributed by Fred Fish at Cygnus Support.   fnf@cygnus.com */
 
 #include "src/internal_config.h"
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>             /* Prototypes for lseek */
 #endif
 #include <stdio.h>
index 2528b8f..ec15500 100644 (file)
@@ -17,7 +17,7 @@
 #include <xbt/base.h>
 #include <xbt/misc.h>
 
-#include "src/portable.h"
+#include "src/internal_config.h"
 #include "xbt/xbt_os_thread.h"
 #include "xbt/mmalloc.h"
 #include "xbt/ex.h"
index 1df0bf7..f574884 100644 (file)
@@ -7,7 +7,7 @@
 #include <atomic>
 
 #include "src/internal_config.h"
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
@@ -15,7 +15,7 @@
 #include <sys/syscall.h>
 #endif
 
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
 #include <linux/futex.h>
 #include <limits.h>
 #endif
@@ -45,7 +45,7 @@ static void xbt_parmap_posix_worker_signal(xbt_parmap_t parmap);
 static void xbt_parmap_posix_master_signal(xbt_parmap_t parmap);
 static void xbt_parmap_posix_worker_wait(xbt_parmap_t parmap, unsigned round);
 
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
 static void xbt_parmap_futex_master_wait(xbt_parmap_t parmap);
 static void xbt_parmap_futex_worker_signal(xbt_parmap_t parmap);
 static void xbt_parmap_futex_master_signal(xbt_parmap_t parmap);
@@ -131,7 +131,7 @@ xbt_parmap_t xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode)
   /* Create the pool of worker threads */
   xbt_parmap_thread_data_t data;
   parmap->workers[0] = NULL;
-#ifdef HAVE_PTHREAD_SETAFFINITY
+#if HAVE_PTHREAD_SETAFFINITY
   int core_bind = 0;
 #endif  
   for (unsigned int i = 1; i < num_workers; i++) {
@@ -139,7 +139,7 @@ xbt_parmap_t xbt_parmap_new(unsigned int num_workers, e_xbt_parmap_mode_t mode)
     data->parmap = parmap;
     data->worker_id = i;
     parmap->workers[i] = xbt_os_thread_create(NULL, xbt_parmap_worker_main, data, NULL);
-#ifdef HAVE_PTHREAD_SETAFFINITY
+#if HAVE_PTHREAD_SETAFFINITY
     xbt_os_thread_bind(parmap->workers[i], core_bind); 
     if (core_bind != xbt_os_get_numcores())
       core_bind++;
@@ -219,7 +219,7 @@ void xbt_parmap_destroy(xbt_parmap_t parmap)
 static void xbt_parmap_set_mode(xbt_parmap_t parmap, e_xbt_parmap_mode_t mode)
 {
   if (mode == XBT_PARMAP_DEFAULT) {
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
     mode = XBT_PARMAP_FUTEX;
 #else
     mode = XBT_PARMAP_POSIX;
@@ -243,7 +243,7 @@ static void xbt_parmap_set_mode(xbt_parmap_t parmap, e_xbt_parmap_mode_t mode)
 
 
     case XBT_PARMAP_FUTEX:
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
       parmap->master_wait_f = xbt_parmap_futex_master_wait;
       parmap->worker_signal_f = xbt_parmap_futex_worker_signal;
       parmap->master_signal_f = xbt_parmap_futex_master_signal;
@@ -439,7 +439,7 @@ static void *xbt_parmap_mc_worker_main(void *arg)
 }
 #endif
 
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
 static void futex_wait(unsigned *uaddr, unsigned val)
 {
   XBT_VERB("Waiting on futex %p", uaddr);
@@ -524,7 +524,7 @@ static void xbt_parmap_posix_worker_wait(xbt_parmap_t parmap, unsigned round)
   xbt_os_mutex_release(parmap->ready_mutex);
 }
 
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
 /**
  * \brief Starts the parmap: waits for all workers to be ready and returns.
  *
index 148a593..4f75d19 100644 (file)
@@ -52,8 +52,9 @@
 #include "xbt/sysdep.h"           /* xbt_abort() */
 #include "src/internal_config.h"  /* Do we need vasprintf? */
 #include <stdio.h>
+#include <assert.h>
 
-#if !defined(HAVE_VASPRINTF)
+#if !HAVE_VASPRINTF
 #include <stdarg.h> /* vsnprintf */
 int vasprintf(char **ptr, const char *fmt, va_list ap);
 int vasprintf(char **ptr, const char *fmt, va_list ap)
index 82f8141..27da686 100644 (file)
@@ -6,11 +6,9 @@
 /* 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 "src/internal_config.h"
 #include "xbt/sysdep.h"
 #include "src/xbt/log_private.h"
-#ifdef HAVE_SMPI
-#include "src/smpi/private.h" // to access bench_begin/end. Not ultraclean, I confess
-#endif
 #include <stdio.h>
 
 static void append_file(xbt_log_appender_t this_, char *str) {
@@ -26,13 +24,6 @@ static void free_(xbt_log_appender_t this_) {
     fclose(this_->data);
 }
 
-#ifdef HAVE_SMPI
-void __smpi_bench_dont (void); // Stupid prototype
-void __smpi_bench_dont (void) { /* I'm only a place-holder in case we link without SMPI */; }
-void smpi_bench_begin(void) __attribute__ ((weak, alias ("__smpi_bench_dont")));
-void smpi_bench_end(void)   __attribute__ ((weak, alias ("__smpi_bench_dont")));
-#endif
-
 XBT_LOG_EXTERNAL_CATEGORY(smpi); // To detect if SMPI is inited
 
 xbt_log_appender_t xbt_log_appender_file_new(char *arg) {
index b40d634..a541362 100644 (file)
@@ -6,7 +6,7 @@
 /* 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 "src/portable.h"       /* execinfo when available */
+#include "src/internal_config.h"       /* execinfo when available */
 #include "xbt/synchro_core.h"   /* xbt_thread_self_name */
 #include "src/xbt/ex_interface.h"
 #include "xbt/sysdep.h"
 #include "surf/surf.h"
 #include <stdio.h>
 
+#if HAVE_EXECINFO_H
+#  include <execinfo.h> /* Function backtrace */
+#endif
+
 extern const char *xbt_log_priority_names[8];
 
 static double format_begin_of_time = -1;
@@ -156,7 +160,7 @@ static int xbt_log_layout_format_doit(xbt_log_layout_t l,
         break;
       case 'b':                 /* backtrace; called %throwable in LOG4J */
       case 'B':         /* short backtrace; called %throwable{short} in LOG4J */
-#if defined(HAVE_EXECINFO_H) && defined(HAVE_POPEN) && defined(ADDR2LINE)
+#if HAVE_EXECINFO_H && HAVE_POPEN && defined(ADDR2LINE)
         {
           xbt_ex_t e;
 
index 8f25418..5ef77ba 100644 (file)
@@ -13,7 +13,7 @@
 #include "simgrid/simix.h"      /* SIMIX_host_self_get_name */
 #include "surf/surf.h"
 #include <stdio.h>
-#include "src/portable.h"
+#include "src/internal_config.h"
 
 extern const char *xbt_log_priority_names[8];
 extern int xbt_log_no_loc;
index 52ec606..61551df 100644 (file)
@@ -8,9 +8,9 @@
 
 #define XBT_LOG_LOCALLY_DEFINE_XBT_CHANNEL /* MSVC don't want it to be declared extern in headers and local here */
 
+
 #include "xbt/misc.h"
 #include "simgrid_config.h"
-#include "src/portable.h"
 #include "xbt/sysdep.h"
 #include "xbt/log.h"
 #include "xbt/dynar.h"
 
 #include "simgrid/sg_config.h"
 
+#include "src/internal_config.h"
 #include <stdio.h>
 #ifdef _WIN32
 #include <signal.h> /* To silence MSVC on abort() */
 #endif
+#if HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(module, xbt, "module handling");
 
@@ -84,12 +88,14 @@ static BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserv
 
 static void xbt_preinit(void) {
   unsigned int seed = 2147483647;
-#ifndef _WIN32
-  xbt_pagesize = sysconf(_SC_PAGESIZE);
-#else
+#ifdef _WIN32
   SYSTEM_INFO si;
   GetSystemInfo(&si);
   xbt_pagesize = si.dwPageSize;
+#elif HAVE_SYSCONF
+  xbt_pagesize = sysconf(_SC_PAGESIZE);
+#else
+  #error Cannot get page size.
 #endif
 
   xbt_pagebits = 0;
index 2dda1b2..4cc64d2 100644 (file)
@@ -9,7 +9,11 @@
 #include "xbt/sysdep.h"
 #include "xbt/file.h"    /* this module */
 #include "xbt/log.h"
-#include "src/portable.h"
+#include "src/internal_config.h"
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
 
 #ifndef _MSC_VER
 #include "libgen.h" /* POSIX dirname */
@@ -67,7 +71,7 @@ ssize_t xbt_getline(char **buf, size_t *n, FILE *stream)
  * The argument is never modified, and the returned value must be freed after use.
  */
 char *xbt_dirname(const char *path) {
-#if _MSC_VER
+#ifdef _MSC_VER
     char drive[_MAX_DRIVE];
     char dir[_MAX_DIR];
     errno_t err;
@@ -85,7 +89,7 @@ char *xbt_dirname(const char *path) {
  * The argument is never modified, and the returned value must be freed after use.
  */
 char *xbt_basename(const char *path) {
-#if _MSC_VER
+#ifdef _MSC_VER
     char file[1024];
     char ext[1024];
     errno_t err;
index 1003575..b80fb31 100644 (file)
@@ -9,7 +9,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "src/internal_config.h"
-#ifdef HAVE_PTHREAD_SETAFFINITY
+#if HAVE_PTHREAD_SETAFFINITY
 #define _GNU_SOURCE
 #include <sched.h>
 #endif
@@ -25,7 +25,8 @@
 #include <semaphore.h>
 #include <errno.h>
 
-#if defined(WIN32)
+#if defined(_WIN32)
+#include <windows.h>
 #elif defined(__MACH__) && defined(__APPLE__)
 #include <stdint.h>
 #include <sys/types.h>
@@ -37,7 +38,7 @@
 #include "xbt/sysdep.h"
 #include "xbt/ex.h"
 #include "src/xbt/ex_interface.h"  /* We play crude games with exceptions */
-#include "src/portable.h"
+#include "src/internal_config.h"
 #include "xbt/xbt_os_time.h"       /* Portable time facilities */
 #include "xbt/xbt_os_thread.h"     /* This module */
 #include "src/xbt_modinter.h"      /* Initialization/finalization of this module */
@@ -46,7 +47,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync_os, xbt, "Synchronization mechanism (OS
 
 
 /* use named sempahore when sem_init() does not work */
-#ifndef HAVE_SEM_INIT
+#if !HAVE_SEM_INIT
 static int next_sem_ID = 0;
 static xbt_os_mutex_t next_sem_ID_lock;
 #endif
@@ -124,7 +125,7 @@ void xbt_os_thread_mod_preinit(void)
 
   thread_mod_inited = 1;
 
-#ifndef HAVE_SEM_INIT
+#if !HAVE_SEM_INIT
   next_sem_ID_lock = xbt_os_mutex_init();
 #endif
 }
@@ -141,7 +142,7 @@ void xbt_os_thread_mod_postexit(void)
   free(main_thread);
   main_thread = NULL;
   thread_mod_inited = 0;
-#ifndef HAVE_SEM_INIT
+#if !HAVE_SEM_INIT
   xbt_os_mutex_destroy(next_sem_ID_lock);
 #endif
 
@@ -200,7 +201,7 @@ xbt_os_thread_t xbt_os_thread_create(const char *name,  pvoid_f_pvoid_t start_ro
  */
 int xbt_os_thread_bind(xbt_os_thread_t thread, int cpu){
   int errcode = 0;
-#ifdef HAVE_PTHREAD_SETAFFINITY
+#if HAVE_PTHREAD_SETAFFINITY
   pthread_t pthread = thread->t;
   cpu_set_t cpuset;
   CPU_ZERO(&cpuset);
@@ -399,7 +400,7 @@ void xbt_os_cond_destroy(xbt_os_cond_t cond)
 }
 
 typedef struct xbt_os_sem_ {
-#ifndef HAVE_SEM_INIT
+#if !HAVE_SEM_INIT
   char *name;
 #endif
   sem_t s;
@@ -418,7 +419,7 @@ xbt_os_sem_t xbt_os_sem_init(unsigned int value)
    * Any attempt to use it leads to ENOSYS (function not implemented).
    * If such a prehistoric system is detected, do the job with sem_open instead
    */
-#ifdef HAVE_SEM_INIT
+#if HAVE_SEM_INIT
   if (sem_init(&(res->s), 0, value) != 0)
     THROWF(system_error, errno, "sem_init() failed: %s", strerror(errno));
   res->ps = &(res->s);
@@ -462,7 +463,7 @@ void xbt_os_sem_release(xbt_os_sem_t sem)
 
 void xbt_os_sem_destroy(xbt_os_sem_t sem)
 {
-#ifdef HAVE_SEM_INIT
+#if HAVE_SEM_INIT
   if (sem_destroy(sem->ps) < 0)
     THROWF(system_error, errno, "sem_destroy() failed: %s",
            strerror(errno));
index 836bd17..0994708 100644 (file)
@@ -1,16 +1,17 @@
 /* xbt_os_time.c -- portable interface to time-related functions            */
 
-/* Copyright (c) 2007-2010, 2012-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2007-2016. 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 "src/internal_config.h"
 #include "xbt/sysdep.h"
-#include "xbt/xbt_os_time.h"    /* this module */
 #include "xbt/log.h"
-#include "src/portable.h"
+#include "xbt/xbt_os_time.h"    /* this module */
 #include <math.h>               /* floor */
+#include <sys/time.h>
+#include <time.h>
 
 #ifdef _WIN32
 #include <sys/timeb.h>
@@ -39,7 +40,7 @@
 
 double xbt_os_time(void)
 {
-#ifdef HAVE_GETTIMEOFDAY
+#if HAVE_GETTIMEOFDAY
   struct timeval tv;
   gettimeofday(&tv, NULL);
 #elif defined(_WIN32)
@@ -95,9 +96,9 @@ void xbt_os_sleep(double sec)
 
 
 struct s_xbt_os_timer {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   struct timespec start, stop, elapse;
-#elif defined(HAVE_GETTIMEOFDAY) || defined(_WIN32)
+#elif HAVE_GETTIMEOFDAY || defined(_WIN32)
   struct timeval start, stop, elapse;
 #else
   unsigned long int start, stop, elapse;
@@ -120,12 +121,12 @@ void xbt_os_timer_free(xbt_os_timer_t timer)
 
 double xbt_os_timer_elapsed(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   return ((double) timer->stop.tv_sec) - ((double) timer->start.tv_sec) +
                                           ((double) timer->elapse.tv_sec ) +
       ((((double) timer->stop.tv_nsec) -
         ((double) timer->start.tv_nsec) + ((double) timer->elapse.tv_nsec )) / 1e9);
-#elif defined(HAVE_GETTIMEOFDAY) || defined(_WIN32)
+#elif HAVE_GETTIMEOFDAY || defined(_WIN32)
   return ((double) timer->stop.tv_sec) - ((double) timer->start.tv_sec)
     + ((double) timer->elapse.tv_sec ) +
       ((((double) timer->stop.tv_usec) -
@@ -138,11 +139,11 @@ double xbt_os_timer_elapsed(xbt_os_timer_t timer)
 
 void xbt_os_walltimer_start(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   timer->elapse.tv_sec = 0;
   timer->elapse.tv_nsec = 0;
   clock_gettime(CLOCK_REALTIME, &(timer->start));
-#elif defined(HAVE_GETTIMEOFDAY)
+#elif HAVE_GETTIMEOFDAY
   timer->elapse.tv_sec = 0;
   timer->elapse.tv_usec = 0;
   gettimeofday(&(timer->start), NULL);
@@ -168,12 +169,12 @@ void xbt_os_walltimer_start(xbt_os_timer_t timer)
 
 void xbt_os_walltimer_resume(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
 
    timer->elapse.tv_nsec += timer->stop.tv_nsec - timer->start.tv_nsec;
   clock_gettime(CLOCK_REALTIME, &(timer->start));
-#elif defined(HAVE_GETTIMEOFDAY)
+#elif HAVE_GETTIMEOFDAY
   timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
   timer->elapse.tv_usec += timer->stop.tv_usec - timer->start.tv_usec;
   gettimeofday(&(timer->start), NULL);
@@ -199,9 +200,9 @@ void xbt_os_walltimer_resume(xbt_os_timer_t timer)
 
 void xbt_os_walltimer_stop(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   clock_gettime(CLOCK_REALTIME, &(timer->stop));
-#elif defined(HAVE_GETTIMEOFDAY)
+#elif HAVE_GETTIMEOFDAY
   gettimeofday(&(timer->stop), NULL);
 #elif defined(_WIN32)
   FILETIME ft;
@@ -222,11 +223,11 @@ void xbt_os_walltimer_stop(xbt_os_timer_t timer)
 
 void xbt_os_cputimer_start(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   timer->elapse.tv_sec = 0;
   timer->elapse.tv_nsec = 0;
   clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &(timer->start));
-#elif defined(HAVE_GETTIMEOFDAY)//return time and not cputime in this case
+#elif HAVE_GETTIMEOFDAY //return time and not cputime in this case
   timer->elapse.tv_sec = 0;
   timer->elapse.tv_usec = 0;
   gettimeofday(&(timer->start), NULL);
@@ -250,11 +251,11 @@ void xbt_os_cputimer_start(xbt_os_timer_t timer)
 
 void xbt_os_cputimer_resume(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
   timer->elapse.tv_nsec += timer->stop.tv_nsec - timer->start.tv_nsec;
   clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &(timer->start));
-#elif defined(HAVE_GETTIMEOFDAY)
+#elif HAVE_GETTIMEOFDAY
   timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
   timer->elapse.tv_usec += timer->stop.tv_usec - timer->start.tv_usec;
   gettimeofday(&(timer->start), NULL);
@@ -278,9 +279,9 @@ void xbt_os_cputimer_resume(xbt_os_timer_t timer)
 
 void xbt_os_cputimer_stop(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &(timer->stop));
-#elif defined(HAVE_GETTIMEOFDAY)
+#elif HAVE_GETTIMEOFDAY
   gettimeofday(&(timer->stop), NULL);
 #elif defined(_WIN32)
   HANDLE h = GetCurrentProcess();
@@ -300,11 +301,11 @@ void xbt_os_cputimer_stop(xbt_os_timer_t timer)
 
 void xbt_os_threadtimer_start(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   timer->elapse.tv_sec = 0;
   timer->elapse.tv_nsec = 0;
   clock_gettime(CLOCK_THREAD_CPUTIME_ID, &(timer->start));
-#elif defined(HAVE_GETTIMEOFDAY) && defined(__MACH__) && defined(__APPLE__)
+#elif HAVE_GETTIMEOFDAY && defined(__MACH__) && defined(__APPLE__)
   timer->elapse.tv_sec = 0;
   timer->elapse.tv_usec = 0;
   mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
@@ -313,7 +314,7 @@ void xbt_os_threadtimer_start(xbt_os_timer_t timer)
   thread_info(mach_thread_self(), THREAD_BASIC_INFO, (thread_info_t)thi, &count);
   timer->start.tv_usec =  thi->system_time.microseconds + thi->user_time.microseconds;
   timer->start.tv_sec = thi->system_time.seconds + thi->user_time.seconds;
-#elif defined(HAVE_GETTIMEOFDAY)//return time and not cputime in this case
+#elif HAVE_GETTIMEOFDAY //return time and not cputime in this case
   timer->elapse.tv_sec = 0;
   timer->elapse.tv_usec = 0;
   gettimeofday(&(timer->start), NULL);
@@ -335,11 +336,11 @@ void xbt_os_threadtimer_start(xbt_os_timer_t timer)
 
 void xbt_os_threadtimer_resume(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
   timer->elapse.tv_nsec += timer->stop.tv_nsec - timer->start.tv_nsec;
   clock_gettime(CLOCK_THREAD_CPUTIME_ID, &(timer->start));
-#elif defined(HAVE_GETTIMEOFDAY) && defined(__MACH__) && defined(__APPLE__)
+#elif HAVE_GETTIMEOFDAY && defined(__MACH__) && defined(__APPLE__)
   timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
   timer->elapse.tv_usec += timer->stop.tv_usec - timer->start.tv_usec;
   mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
@@ -348,7 +349,7 @@ void xbt_os_threadtimer_resume(xbt_os_timer_t timer)
   thread_info(mach_thread_self(), THREAD_BASIC_INFO, (thread_info_t)thi, &count);
   timer->start.tv_usec =  thi->system_time.microseconds + thi->user_time.microseconds;
   timer->start.tv_sec = thi->system_time.seconds + thi->user_time.seconds;
-#elif defined(HAVE_GETTIMEOFDAY)
+#elif HAVE_GETTIMEOFDAY
   timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
   timer->elapse.tv_usec += timer->stop.tv_usec - timer->start.tv_usec;
   gettimeofday(&(timer->start), NULL);
@@ -372,16 +373,16 @@ void xbt_os_threadtimer_resume(xbt_os_timer_t timer)
 
 void xbt_os_threadtimer_stop(xbt_os_timer_t timer)
 {
-#ifdef HAVE_POSIX_GETTIME
+#if HAVE_POSIX_GETTIME
   clock_gettime(CLOCK_THREAD_CPUTIME_ID, &(timer->stop));
-#elif defined(HAVE_GETTIMEOFDAY) && defined(__MACH__) && defined(__APPLE__)
+#elif HAVE_GETTIMEOFDAY && defined(__MACH__) && defined(__APPLE__)
   mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
   thread_basic_info_data_t thi_data;
   thread_basic_info_t thi = &thi_data;
   thread_info(mach_thread_self(), THREAD_BASIC_INFO, (thread_info_t)thi, &count);
   timer->stop.tv_usec =  thi->system_time.microseconds + thi->user_time.microseconds;
   timer->stop.tv_sec = thi->system_time.seconds + thi->user_time.seconds;
-#elif defined(HAVE_GETTIMEOFDAY)//if nothing else is available, return just time
+#elif HAVE_GETTIMEOFDAY //if nothing else is available, return just time
   gettimeofday(&(timer->stop), NULL);
 #elif defined(_WIN32)
   HANDLE h = GetCurrentThread();
index 14f928f..5c1e852 100644 (file)
@@ -6,7 +6,7 @@
 /* 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 "src/portable.h"
+#include "src/internal_config.h"
 #include "xbt/misc.h"
 #include "xbt/sysdep.h"
 #include "xbt/str.h"            /* headers of these functions */
index 83862c4..048984e 100644 (file)
@@ -14,7 +14,6 @@
 #include <mc/mc.h>
 
 #include "mc/datatypes.h"
-#include "src/mc/mc_object_info.h"
 #include "src/mc/mc_private.h"
 
 #include "src/mc/Process.hpp"
index fbe890e..f059b2c 100644 (file)
@@ -13,7 +13,6 @@
 #include <stdlib.h>
 
 #include "src/mc/mc_private.h"
-#include "src/mc/mc_object_info.h"
 
 #include "src/mc/Process.hpp"
 #include "src/mc/Type.hpp"
index 08fa38b..f21cb3a 100644 (file)
@@ -7,6 +7,11 @@
 //teshsuite/simdag/platforms/evaluate_parse_time ../examples/platforms/nancy.xml
 
 #include <stdio.h>
+#include "src/internal_config.h"
+#if HAVE_UNISTD_H
+#  include <unistd.h>
+#endif
+
 #include "simgrid/simdag.h"
 #include "surf/surf.h"
 #include "xbt/xbt_os_time.h"
index f160c5d..2a92994 100644 (file)
@@ -19,7 +19,7 @@
 #include <string.h>
 #include <assert.h>
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
index 2e96a9e..61ee87a 100644 (file)
@@ -5,7 +5,7 @@
  */
 #include "mpi.h"
 #include "mpitestconf.h"
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 #include <stdio.h>
index c0dc769..7b59c90 100644 (file)
@@ -23,7 +23,7 @@
 #include <assert.h>
 #include "mpitest.h"
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
index ef67050..304ac47 100644 (file)
@@ -19,7 +19,7 @@
 #include <assert.h>
 #include "mpitest.h"
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
index 8bf5427..288be5d 100644 (file)
@@ -19,7 +19,7 @@
 #include <assert.h>
 #include "mpitest.h"
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
index 62315ed..662cbc8 100644 (file)
@@ -19,7 +19,7 @@
 #include <assert.h>
 #include "mpitest.h"
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
index bb95b77..82a3ec2 100644 (file)
@@ -23,7 +23,7 @@
 #include <assert.h>
 #include "mpitest.h"
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
index f1373fb..2690692 100644 (file)
@@ -23,7 +23,7 @@
 #include <assert.h>
 #include "mpitest.h"
 
-#ifdef HAVE_UNISTD_H
+#if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
 
index b73e0b1..de148a0 100644 (file)
@@ -46,7 +46,7 @@ static const char *parmap_mode_name(e_xbt_parmap_mode_t mode)
 static int parmap_skip_mode(e_xbt_parmap_mode_t mode)
 {
   switch (mode) {
-#ifndef HAVE_FUTEX_H
+#if !HAVE_FUTEX_H
   case XBT_PARMAP_FUTEX:
     printf("not available\n");
     return 1;
index 76ac002..e2d5faf 100644 (file)
@@ -120,7 +120,7 @@ int main(int argc, char** argv)
   XBT_INFO("Basic testing posix");
   status += test_parmap_basic(XBT_PARMAP_POSIX);
   XBT_INFO("Basic testing futex");
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
   status += test_parmap_basic(XBT_PARMAP_FUTEX);
 #endif
   XBT_INFO("Basic testing busy wait");
@@ -129,7 +129,7 @@ int main(int argc, char** argv)
   XBT_INFO("Extended testing posix");
   status += test_parmap_extended(XBT_PARMAP_POSIX);
   XBT_INFO("Extended testing futex");
-#ifdef HAVE_FUTEX_H
+#if HAVE_FUTEX_H
   status += test_parmap_extended(XBT_PARMAP_FUTEX);
 #endif
   XBT_INFO("Extended testing busy wait");
index e6d711f..ef11ae1 100644 (file)
@@ -14,7 +14,6 @@ set(EXTRA_DIST
   src/include/surf/maxmin.h
   src/include/surf/surf.h
   src/msg/msg_private.h
-  src/portable.h
   src/simdag/dax.dtd
   src/simdag/dax_dtd.c
   src/simdag/dax_dtd.h
@@ -573,7 +572,6 @@ set(MC_SRC
   src/mc/mc_unw.h
   src/mc/mc_unw.cpp
   src/mc/mc_unw_vmread.cpp
-  src/mc/mc_object_info.h
   src/mc/mc_checkpoint.cpp
   src/mc/mc_snapshot.h
   src/mc/mc_snapshot.cpp
index 31c50d7..1b29b67 100644 (file)
@@ -13,7 +13,6 @@ set(warnCFLAGS "")
 set(optCFLAGS "")
 
 
-
 if(enable_compile_warnings)
   set(warnCFLAGS "-fno-common -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing -Wno-format-nonliteral -Werror ")
   if(CMAKE_COMPILER_IS_GNUCC)
@@ -32,6 +31,13 @@ if(enable_compile_warnings)
   set(CMAKE_JAVA_COMPILE_FLAGS "-Xlint")
 endif()
 
+# Activate the warnings on #if FOOBAR when FOOBAR has no value
+# It breaks on FreeBSD within Boost headers, so activate this only in Pure Hardcore debug mode.
+if(enable_maintainer_mode)
+  set(warnCFLAGS "${warnCFLAGS} -Wundef")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wundef")
+endif()
+
 # Se the optimisation flags
 # NOTE, we should CMAKE_BUILD_TYPE for this
 if(enable_compile_optimizations)
index d288173..bc33a8d 100644 (file)
@@ -20,7 +20,7 @@ if(enable_memcheck_xml)
 endif()
 
 if(VALGRIND_EXE)
-  execute_process(COMMAND "${VALGRIND_EXE} --version " OUTPUT_VARIABLE "VALGRIND_VERSION")
+  execute_process(COMMAND ${VALGRIND_EXE} --version  OUTPUT_VARIABLE "VALGRIND_VERSION")
   string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" NEW_VALGRIND_VERSION "${VALGRIND_VERSION}")
   if(NEW_VALGRIND_VERSION)
     message(STATUS "Valgrind version: ${NEW_VALGRIND_VERSION}")
index e64a921..e632714 100644 (file)
@@ -8,34 +8,35 @@
 /* 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 "simgrid_config.h"       /* what was compiled in? */
+
 /* Non-standard header files */
-#cmakedefine HAVE_EXECINFO_H @HAVE_EXECINFO_H@ /* <execinfo.h> */
-#cmakedefine HAVE_FUTEX_H    @HAVE_FUTEX_H@ /* <linux/futex.h> */
-#cmakedefine HAVE_SIGNAL_H   @HAVE_SIGNAL_H@ /* <signal.h> */
-#cmakedefine HAVE_UNISTD_H   @HAVE_UNISTD_H@ /* <unistd.h> */
-#cmakedefine HAVE_UCONTEXT_H @HAVE_UCONTEXT_H@ /* <ucontext.h> */
-#cmakedefine HAVE_VALGRIND_H @HAVE_VALGRIND_H@ /* <valgrind/valgrind.h> */
+#define HAVE_EXECINFO_H @HAVE_EXECINFO_H@ /* <execinfo.h> */
+#define HAVE_FUTEX_H    @HAVE_FUTEX_H@ /* <linux/futex.h> */
+#define HAVE_SIGNAL_H   @HAVE_SIGNAL_H@ /* <signal.h> */
+#define HAVE_UNISTD_H   @HAVE_UNISTD_H@ /* <unistd.h> */
+#define HAVE_UCONTEXT_H @HAVE_UCONTEXT_H@ /* <ucontext.h> */
+#define HAVE_VALGRIND_H @HAVE_VALGRIND_H@ /* <valgrind/valgrind.h> */
 
 /* Time portability */
-#cmakedefine HAVE_GETTIMEOFDAY  @HAVE_GETTIMEOFDAY@ /* Function gettimeofday */
-#cmakedefine HAVE_POSIX_GETTIME @HAVE_POSIX_GETTIME@ /* Function clock_gettime */
-#cmakedefine HAVE_NANOSLEEP     @HAVE_NANOSLEEP@ /* Function nanosleep */
+#define HAVE_GETTIMEOFDAY  @HAVE_GETTIMEOFDAY@ /* Function gettimeofday */
+#define HAVE_POSIX_GETTIME @HAVE_POSIX_GETTIME@ /* Function clock_gettime */
+#define HAVE_NANOSLEEP     @HAVE_NANOSLEEP@ /* Function nanosleep */
 
 /* The usable context factories */
-#cmakedefine HAVE_BOOST_CONTEXTS    @HAVE_BOOST_CONTEXTS@
-#cmakedefine HAVE_RAW_CONTEXTS      @HAVE_RAW_CONTEXTS@
-#cmakedefine HAVE_THREAD_CONTEXTS   @HAVE_THREAD_CONTEXTS@
-#cmakedefine HAVE_UCONTEXT_CONTEXTS @HAVE_UCONTEXT_CONTEXTS@
+#define HAVE_BOOST_CONTEXTS    @HAVE_BOOST_CONTEXTS@
+#define HAVE_RAW_CONTEXTS      @HAVE_RAW_CONTEXTS@
+#define HAVE_THREAD_CONTEXTS   @HAVE_THREAD_CONTEXTS@
+#define HAVE_UCONTEXT_CONTEXTS @HAVE_UCONTEXT_CONTEXTS@
 
 /* Variables for the thread contexts (and parallel mode of raw contexts) */
-#cmakedefine HAVE_PTHREAD              @HAVE_PTHREAD@ /* Define to 1 if threads are usable . */
-#cmakedefine HAVE_PTHREAD_SETAFFINITY  @HAVE_PTHREAD_SETAFFINITY@ /* Does not seems defined on Mac nor Windows */
-#cmakedefine HAVE_THREAD_LOCAL_STORAGE @HAVE_THREAD_LOCAL_STORAGE@ /* If __thread is available */
+#define HAVE_PTHREAD              @HAVE_PTHREAD@ /* Define to 1 if threads are usable . */
+#define HAVE_PTHREAD_SETAFFINITY  @HAVE_PTHREAD_SETAFFINITY@ /* Does not seems defined on Mac nor Windows */
+#define HAVE_THREAD_LOCAL_STORAGE @HAVE_THREAD_LOCAL_STORAGE@ /* If __thread is available */
 
 /* Variables for the raw contexts (to select the right assembly code) */
-#cmakedefine PROCESSOR_i686         @PROCESSOR_i686@
-#cmakedefine PROCESSOR_x86_64       @PROCESSOR_x86_64@
-#cmakedefine CMAKE_SYSTEM_PROCESSOR @CMAKE_SYSTEM_PROCESSOR@
+#define SIMGRID_PROCESSOR_i686         @PROCESSOR_i686@
+#define SIMGRID_PROCESSOR_x86_64       @PROCESSOR_x86_64@
 
 /* Variables for the SysV contexts */
 @sg_makecontext_stack_addr@
 #cmakedefine PTH_STACKGROWTH @PTH_STACKGROWTH@ /* Does the stack growth upward, or downward? */
 
 /* MC variables */
-#cmakedefine HAVE_GETDTABLESIZE    @HAVE_GETDTABLESIZE@ /* getdtablesize: get descriptor table size */
-#cmakedefine HAVE_MMALLOC          @HAVE_MMALLOC@ /* Did we compile mmalloc in? */
-#cmakedefine HAVE_PROCESS_VM_READV @HAVE_PROCESS_VM_READV@ /* process_vm_readv: transfer data between process address spaces */
-#cmakedefine HAVE_MC               @HAVE_MC@ /* Set to true if enable_model-checking is true and the dependencies available */
+#define HAVE_GETDTABLESIZE    @HAVE_GETDTABLESIZE@ /* getdtablesize: get descriptor table size */
+#define HAVE_MMALLOC          @HAVE_MMALLOC@ /* Did we compile mmalloc in? */
+#define HAVE_PROCESS_VM_READV @HAVE_PROCESS_VM_READV@ /* process_vm_readv: transfer data between process address spaces */
+#define HAVE_MC               @HAVE_MC@ /* Set to true if enable_model-checking is true and the dependencies available */
 
 /* SMPI variables */
-#cmakedefine HAVE_SMPI          @HAVE_SMPI@
-#cmakedefine SMPI_FORTRAN       @SMPI_FORTRAN@
-#cmakedefine HAVE_PRIVATIZATION @HAVE_PRIVATIZATION@ /* We have mmap and objdump to handle privatization */
+#define HAVE_SMPI          @HAVE_SMPI@
+#define SMPI_FORTRAN       @SMPI_FORTRAN@
+#define HAVE_PRIVATIZATION @HAVE_PRIVATIZATION@ /* We have mmap and objdump to handle privatization */
 
 /* Other function checks */
-#cmakedefine HAVE_MMAP      @HAVE_MMAP@ /* Function mmap */
-#cmakedefine HAVE_SEM_INIT  @HAVE_SEM_INIT@ /* Function sem_init (part of XPG6 standard only) */
-#cmakedefine HAVE_POPEN     @HAVE_POPEN@ /* Function popen */
-#cmakedefine HAVE_SYSCONF   @HAVE_SYSCONF@ /* Function sysconf */
-#cmakedefine HAVE_VASPRINTF @HAVE_VASPRINTF@ /* Function vasprintf */
+#define HAVE_MMAP      @HAVE_MMAP@ /* Function mmap */
+#define HAVE_SEM_INIT  @HAVE_SEM_INIT@ /* Function sem_init (part of XPG6 standard only) */
+#define HAVE_POPEN     @HAVE_POPEN@ /* Function popen */
+#define HAVE_SYSCONF   @HAVE_SYSCONF@ /* Function sysconf */
+#define HAVE_VASPRINTF @HAVE_VASPRINTF@ /* Function vasprintf */
 
 /* Other checks */
 #cmakedefine ADDR2LINE       "@ADDR2LINE@" /* Path to the addr2line tool */
-#cmakedefine HAVE_GRAPHVIZ   @HAVE_GRAPHVIZ@ /* The graphviz library */
+#define HAVE_GRAPHVIZ   @HAVE_GRAPHVIZ@ /* The graphviz library */