Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove commented code from surf_routing_cluster
authorJonathan Rouzaud-Cornabas <jonathan.rouzaud-cornabas@ens-lyon.fr>
Thu, 14 Feb 2013 12:03:05 +0000 (13:03 +0100)
committerJonathan Rouzaud-Cornabas <jonathan.rouzaud-cornabas@ens-lyon.fr>
Thu, 14 Feb 2013 12:03:05 +0000 (13:03 +0100)
37 files changed:
.gitignore
buildtools/Cmake/AddTests.cmake
buildtools/Cmake/CompleteInFiles.cmake
buildtools/Cmake/DefinePackages.cmake
buildtools/Cmake/MakeJava.cmake [new file with mode: 0644]
buildtools/Cmake/MakeLib.cmake
examples/java/cloud/cloud.tesh
examples/msg/bittorrent/bittorrent.c
examples/msg/bittorrent/bittorrent.h
examples/msg/bittorrent/bittorrent.tesh
examples/msg/bittorrent/peer.c
examples/msg/bittorrent/tracker.c
examples/smpi/CMakeLists.txt
include/msg/msg.h
include/xbt/dynar.h
src/bindings/java/jmsg_file.c
src/bindings/java/jmsg_process.c
src/bindings/java/jmsg_rngstream.c
src/bindings/java/jmsg_task.c
src/bindings/java/jmsg_vm.c
src/bindings/java/jmsg_vm.h
src/bindings/java/jxbt_utilities.h
src/bindings/java/org/simgrid/msg/Host.java
src/bindings/java/org/simgrid/msg/Process.java
src/bindings/java/org/simgrid/msg/VM.java
src/bindings/java/smx_context_cojava.c
src/bindings/java/smx_context_cojava.h
src/bindings/java/smx_context_java.c
src/bindings/java/smx_context_java.h
src/msg/msg_vm.c
src/simix/smx_user.c
src/smpi/smpi_base.c
src/surf/surf_routing_cluster.c
src/surf/surfxml_parse.c
src/xbt/dynar.c
teshsuite/smpi/mpich-test/env/runtests
tools/check_dist_archive

index 55dfe37..47a2888 100644 (file)
@@ -67,12 +67,13 @@ CMakeFiles
 CMakeCache.txt
 DartConfiguration.tcl
 simgrid.nsi
+TAGS
 Testing/
 Makefile
 bin/
 lib/
 manpages/
-build_dir/
+build_*/
 build/
 buildtools/Cmake/memcheck_tests.cmake
 buildtools/Cmake/test_prog/prog_va_copy.c
index bd6c5b8..1b3dda1 100644 (file)
@@ -446,13 +446,6 @@ if(NOT enable_memcheck)
         set_tests_properties(mc-centralized-raw PROPERTIES WILL_FAIL true)
       endif()
     endif()
-    set_tests_properties(msg-bittorrent-thread-parallel PROPERTIES ENVIRONMENT SG_TEST_EXENV=true WILL_FAIL true)
-    if(CONTEXT_UCONTEXT)
-      set_tests_properties(msg-bittorrent-ucontext-parallel PROPERTIES ENVIRONMENT SG_TEST_EXENV=true WILL_FAIL true)
-    endif()
-    if(HAVE_RAWCTX)
-      set_tests_properties(msg-bittorrent-raw-parallel PROPERTIES ENVIRONMENT SG_TEST_EXENV=true WILL_FAIL true)
-    endif()
   endif()
 
 endif()
index b33553e..a5bec10 100644 (file)
@@ -85,7 +85,8 @@ endif()
 if(enable_java)
   find_package(Java REQUIRED COMPONENTS Runtime Development)
   find_package(JNI REQUIRED)
-  include(UseJava)
+  message("-- [Java] JNI found: ${JNI_FOUND}")
+  message("-- [Java] JNI include dirs: ${JNI_INCLUDE_DIRS}")
   set(HAVE_Java 1)
 endif()
 if(enable_lua)
index 090b6e7..bb7460c 100644 (file)
@@ -829,6 +829,7 @@ set(CMAKE_SOURCE_FILES
   buildtools/Cmake/GenerateDocWin.cmake
   buildtools/Cmake/MaintainerMode.cmake
   buildtools/Cmake/MakeExe.cmake
+  buildtools/Cmake/MakeJava.cmake
   buildtools/Cmake/MakeLib.cmake
   buildtools/Cmake/MakeLibWin.cmake
   buildtools/Cmake/Modules/FindF2c.cmake
diff --git a/buildtools/Cmake/MakeJava.cmake b/buildtools/Cmake/MakeJava.cmake
new file mode 100644 (file)
index 0000000..f9037de
--- /dev/null
@@ -0,0 +1,99 @@
+cmake_minimum_required(VERSION 2.8.6)
+
+include(UseJava)
+
+# Rules to build libSG_java
+#
+add_library(SG_java SHARED ${JMSG_C_SRC})
+set_target_properties(SG_java PROPERTIES VERSION ${libSG_java_version})
+get_target_property(COMMON_INCLUDES SG_java INCLUDE_DIRECTORIES)
+if (COMMON_INCLUDES)
+  set_target_properties(SG_java PROPERTIES
+    INCLUDE_DIRECTORIES "${COMMON_INCLUDES};${JNI_INCLUDE_DIRS}")
+else()
+  set_target_properties(SG_java PROPERTIES
+    INCLUDE_DIRECTORIES "${JNI_INCLUDE_DIRS}")
+endif()
+add_dependencies(SG_java simgrid)
+
+get_target_property(CHECK_INCLUDES SG_java INCLUDE_DIRECTORIES)
+message("-- [Java] SG_java includes: ${CHECK_INCLUDES}")
+
+if(WIN32)
+  get_target_property(SIMGRID_LIB_NAME_NAME SG_java LIBRARY_OUTPUT_NAME)
+  set_target_properties(SG_java PROPERTIES
+    LINK_FLAGS "-Wl,--subsystem,windows,--kill-at ${SIMGRID_LIB_NAME}"
+    PREFIX "")
+  find_path(PEXPORTS_PATH NAMES pexports.exe PATHS NO_DEFAULT_PATHS)
+  message(STATUS "pexports: ${PEXPORTS_PATH}")
+  if(PEXPORTS_PATH)
+    add_custom_command(TARGET SG_java POST_BUILD
+      COMMAND ${PEXPORTS_PATH}/pexports.exe ${CMAKE_BINARY_DIR}/SG_java.dll > ${CMAKE_BINARY_DIR}/SG_java.def)
+  endif(PEXPORTS_PATH)
+else()
+  target_link_libraries(SG_java simgrid)
+endif()
+
+# Rules to build simgrid.jar
+#
+
+## Files to include in simgrid.jar
+##
+set(SIMGRID_JAR "${CMAKE_BINARY_DIR}/simgrid.jar")
+set(MANIFEST_FILE "${CMAKE_HOME_DIRECTORY}/src/bindings/java/MANIFEST.MF")
+set(LIBSIMGRID_SO
+  ${CMAKE_SHARED_LIBRARY_PREFIX}simgrid${CMAKE_SHARED_LIBRARY_SUFFIX})
+set(LIBSG_JAVA_SO
+  ${CMAKE_SHARED_LIBRARY_PREFIX}SG_java${CMAKE_SHARED_LIBRARY_SUFFIX})
+
+## Name of the "NATIVE" folder in simgrid.jar
+##
+if(CMAKE_SYSTEM_PROCESSOR MATCHES ".86")
+  if(${ARCH_32_BITS})
+    set(JSG_BUNDLE "NATIVE/${CMAKE_SYSTEM_NAME}/i386/")
+  else()
+    set(JSG_BUNDLE "NATIVE/${CMAKE_SYSTEM_NAME}/amd64/")
+  endif()
+else()
+  message(WARNING "Unknown system type. Processor: ${CMAKE_SYSTEM_PROCESSOR}; System: ${CMAKE_SYSTEM_NAME}")
+  set(JSG_BUNDLE "NATIVE/${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR/")
+endif()
+message("-- [Java] Native libraries bundled into: ${JSG_BUNDLE}")
+
+## Don't strip libraries if not in release mode
+##
+if(release)
+  set(STRIP_COMMAND "${CMAKE_STRIP}")
+else()
+  set(STRIP_COMMAND "true")
+endif()
+
+## Here is how to build simgrid.jar
+##
+set(CMAKE_JAVA_TARGET_OUTPUT_NAME simgrid)
+add_jar(SG_java_pre_jar ${JMSG_JAVA_SRC})
+
+add_custom_command(
+  COMMENT "Finalize simgrid.jar..."
+  OUTPUT ${SIMGRID_JAR}_finalized
+  DEPENDS simgrid SG_java SG_java_pre_jar
+          ${SIMGRID_JAR} ${MANIFEST_FILE}
+          ${CMAKE_BINARY_DIR}/lib/${LIBSIMGRID_SO}
+          ${CMAKE_BINARY_DIR}/lib/${LIBSG_JAVA_SO}
+          ${CMAKE_HOME_DIRECTORY}/COPYING
+          ${CMAKE_HOME_DIRECTORY}/ChangeLog
+          ${CMAKE_HOME_DIRECTORY}/ChangeLog.SimGrid-java
+  COMMAND ${CMAKE_COMMAND} -E remove_directory "NATIVE"
+  COMMAND ${CMAKE_COMMAND} -E make_directory "${JSG_BUNDLE}"
+  COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/lib/${LIBSIMGRID_SO}" "${JSG_BUNDLE}"
+  COMMAND ${STRIP_COMMAND} -S "${JSG_BUNDLE}/${LIBSIMGRID_SO}"
+  COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/lib/${LIBSG_JAVA_SO}" "${JSG_BUNDLE}"
+  COMMAND ${STRIP_COMMAND} -S "${JSG_BUNDLE}/${LIBSG_JAVA_SO}"
+  COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_HOME_DIRECTORY}/COPYING" "${JSG_BUNDLE}"
+  COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_HOME_DIRECTORY}/ChangeLog" "${JSG_BUNDLE}"
+  COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_HOME_DIRECTORY}/ChangeLog.SimGrid-java" "${JSG_BUNDLE}"
+  COMMAND ${JAVA_ARCHIVE} -uvmf ${MANIFEST_FILE} ${SIMGRID_JAR} "NATIVE"
+  COMMAND ${CMAKE_COMMAND} -E remove ${SIMGRID_JAR}_finalized
+  COMMAND ${CMAKE_COMMAND} -E touch ${SIMGRID_JAR}_finalized
+  )
+add_custom_target(SG_java_jar ALL DEPENDS ${SIMGRID_JAR}_finalized)
index 0cc8a6a..f7adde3 100644 (file)
@@ -24,81 +24,7 @@ if(enable_smpi)
 endif()
 
 if(enable_java)
-  add_library(SG_java SHARED ${JMSG_C_SRC})
-  set_target_properties(SG_java PROPERTIES VERSION ${libSG_java_version})
-  get_target_property(COMMON_INCLUDES SG_java INCLUDE_DIRECTORIES)
-  set_target_properties(SG_java PROPERTIES
-    INCLUDE_DIRECTORIES "${COMMON_INCLUDES};${JNI_INCLUDE_DIRS}")
-  add_dependencies(SG_java simgrid)
-
-  if(WIN32)
-    get_target_property(SIMGRID_LIB_NAME_NAME SG_java LIBRARY_OUTPUT_NAME)
-    set_target_properties(SG_java PROPERTIES
-      LINK_FLAGS "-Wl,--subsystem,windows,--kill-at ${SIMGRID_LIB_NAME}"
-      PREFIX "")
-    find_path(PEXPORTS_PATH NAMES pexports.exe PATHS NO_DEFAULT_PATHS)
-    message(STATUS "pexports: ${PEXPORTS_PATH}")
-    if(PEXPORTS_PATH)
-      add_custom_command(TARGET SG_java POST_BUILD
-        COMMAND ${PEXPORTS_PATH}/pexports.exe ${CMAKE_BINARY_DIR}/SG_java.dll > ${CMAKE_BINARY_DIR}/SG_java.def)
-    endif(PEXPORTS_PATH)
-  else()
-    target_link_libraries(SG_java simgrid)
-  endif()
-
-  set(CMAKE_JAVA_TARGET_OUTPUT_NAME simgrid)
-  add_jar(SG_java_pre_jar ${JMSG_JAVA_SRC})
-
-  set(SIMGRID_JAR "${CMAKE_BINARY_DIR}/simgrid.jar")
-  set(MANIFEST_FILE "${CMAKE_HOME_DIRECTORY}/src/bindings/java/MANIFEST.MF")
-
-  if(CMAKE_SYSTEM_PROCESSOR MATCHES ".86")
-    if(${ARCH_32_BITS})
-      set(JSG_BUNDLE "NATIVE/${CMAKE_SYSTEM_NAME}/x86/")
-    else()
-      set(JSG_BUNDLE "NATIVE/${CMAKE_SYSTEM_NAME}/amd64/")
-    endif()
-  else()
-    message(WARNING "Unknown system type. Processor: ${CMAKE_SYSTEM_PROCESSOR}; System: ${CMAKE_SYSTEM_NAME}")
-    set(JSG_BUNDLE "NATIVE/${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR/")
-  endif()
-  message("Native libraries bundled into: ${JSG_BUNDLE}")
-
-  set(LIBSIMGRID_SO
-    ${CMAKE_SHARED_LIBRARY_PREFIX}simgrid${CMAKE_SHARED_LIBRARY_SUFFIX})
-  set(LIBSG_JAVA_SO
-    ${CMAKE_SHARED_LIBRARY_PREFIX}SG_java${CMAKE_SHARED_LIBRARY_SUFFIX})
-
-  if(release)
-    set(STRIP_COMMAND "${CMAKE_STRIP}")
-  else()
-    set(STRIP_COMMAND "true")
-  endif()
-
-  add_custom_command(
-    COMMENT "Finalize simgrid.jar..."
-    OUTPUT ${SIMGRID_JAR}_finalized
-    DEPENDS simgrid SG_java SG_java_pre_jar
-            ${SIMGRID_JAR} ${MANIFEST_FILE}
-            ${CMAKE_BINARY_DIR}/lib/${LIBSIMGRID_SO}
-            ${CMAKE_BINARY_DIR}/lib/${LIBSG_JAVA_SO}
-            ${CMAKE_HOME_DIRECTORY}/COPYING
-            ${CMAKE_HOME_DIRECTORY}/ChangeLog
-            ${CMAKE_HOME_DIRECTORY}/ChangeLog.SimGrid-java
-    COMMAND ${CMAKE_COMMAND} -E remove_directory "NATIVE"
-    COMMAND ${CMAKE_COMMAND} -E make_directory "${JSG_BUNDLE}"
-    COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/lib/${LIBSIMGRID_SO}" "${JSG_BUNDLE}"
-    COMMAND ${STRIP_COMMAND} -S "${JSG_BUNDLE}/${LIBSIMGRID_SO}"
-    COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/lib/${LIBSG_JAVA_SO}" "${JSG_BUNDLE}"
-    COMMAND ${STRIP_COMMAND} -S "${JSG_BUNDLE}/${LIBSG_JAVA_SO}"
-    COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_HOME_DIRECTORY}/COPYING" "${JSG_BUNDLE}"
-    COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_HOME_DIRECTORY}/ChangeLog" "${JSG_BUNDLE}"
-    COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_HOME_DIRECTORY}/ChangeLog.SimGrid-java" "${JSG_BUNDLE}"
-    COMMAND ${JAVA_ARCHIVE} -uvmf ${MANIFEST_FILE} ${SIMGRID_JAR} "NATIVE"
-    COMMAND ${CMAKE_COMMAND} -E remove ${SIMGRID_JAR}_finalized
-    COMMAND ${CMAKE_COMMAND} -E touch ${SIMGRID_JAR}_finalized
-    )
-  add_custom_target(SG_java_jar ALL DEPENDS ${SIMGRID_JAR}_finalized)
+  include(${CMAKE_HOME_DIRECTORY}/buildtools/Cmake/MakeJava.cmake)
 endif()
 
 add_dependencies(simgrid maintainer_files)
index 5554865..1f958c2 100644 (file)
@@ -154,6 +154,3 @@ $ java -cp ${classpath:=.} cloud/Cloud ${srcdir:=.}/platform.xml "--log=root.fmt
 > [1023.429105] (1:Master@Jacquelin) Let's shut down the simulation and kill everyone.
 > [1023.429105] (1:Master@Jacquelin) Master done.
 > [1023.429105] (21:Slave 19@Provost) Received "Task_19". Processing it.
-> [1023.429105] (21:Slave 19@Provost) "Task_19" done 
-> [1023.429105] (21:Slave 19@Provost) Receiving on slave_19
-
index e0e4c68..d6fd85d 100644 (file)
@@ -7,11 +7,17 @@
 #include "peer.h"
 #include "tracker.h"
 #include <msg/msg.h>
+#include <xbt/RngStream.h>
+
 /**
  * Bittorrent example launcher
  */
 int main(int argc, char *argv[])
 {
+  xbt_dynar_t host_list;
+  msg_host_t host;
+  unsigned i;
+
   MSG_init(&argc, argv);
 
   /* Check the arguments */
@@ -25,6 +31,15 @@ int main(int argc, char *argv[])
 
   MSG_create_environment(platform_file);
 
+  host_list = MSG_hosts_as_dynar();
+  xbt_dynar_foreach(host_list, i, host) {
+    char descr[512];
+    RngStream stream;
+    snprintf(descr, sizeof descr, "RngSream<%s>", MSG_host_get_name(host));
+    stream = RngStream_CreateStream(descr);
+    MSG_host_set_data(host, stream);
+  }
+
   MSG_function_register("tracker", tracker);
   MSG_function_register("peer", peer);
 
@@ -32,5 +47,11 @@ int main(int argc, char *argv[])
 
   MSG_main();
 
+  xbt_dynar_foreach(host_list, i, host) {
+    RngStream stream = MSG_host_get_data(host);
+    RngStream_DeleteStream(&stream);
+  }
+  xbt_dynar_free(&host_list);
+
   return 0;
 }
index 87881f4..2cad1e4 100644 (file)
@@ -53,4 +53,5 @@
  * Number of pieces the peer asks for simultaneously
  */
 #define MAX_PIECES 1
+
 #endif                          /* BITTORRENT_BITTORRENT_H_ */
index d5a8a9a..ec7df8a 100644 (file)
@@ -15,7 +15,7 @@ $ $SG_TEST_EXENV ${bindir:=.}/bittorrent ${srcdir:=.}/../msg_platform.xml ${srcd
 > [    0.000000] (8:peer@McGee) Hi, I'm joining the network with id 8
 > [ 3000.000000] (1:tracker@Jacquelin) Tracker is leaving
 > [ 5000.005340] (5:peer@Geoff) Here is my current status: 1111111111
-> [ 5000.012657] (7:peer@iRMX) Here is my current status: 1111111111
+> [ 5000.012635] (7:peer@iRMX) Here is my current status: 1111111111
 > [ 5000.048881] (2:peer@Boivin) Here is my current status: 1111111111
 > [ 5000.827441] (8:peer@McGee) Here is my current status: 1111111111
 > [ 5000.832977] (3:peer@Jean_Yves) Here is my current status: 1111111111
index 026be29..2a9db33 100644 (file)
@@ -239,7 +239,7 @@ void peer_init(peer_t peer, int id, int seed)
   peer->current_pieces = xbt_dynar_new(sizeof(int), NULL);
   peer->current_piece = -1;
 
-  peer->stream = RngStream_CreateStream("");
+  peer->stream = MSG_host_get_data(MSG_host_self());
   peer->comm_received = NULL;
 
   peer->round = 0;
@@ -265,8 +265,6 @@ void peer_free(peer_t peer)
   xbt_free(peer->pieces_count);
   xbt_free(peer->bitfield);
   xbt_free(peer->bitfield_blocks);
-
-  RngStream_DeleteStream(&peer->stream);
 }
 
 /**
index d619047..169b5d6 100644 (file)
@@ -19,7 +19,7 @@ int tracker(int argc, char *argv[])
 {
   int i;
 
-  RngStream stream = RngStream_CreateStream("tracker");
+  RngStream stream = MSG_host_get_data(MSG_host_self());
 
   //Checking arguments
   xbt_assert(argc == 2, "Wrong number of arguments for the tracker.");
@@ -78,8 +78,6 @@ int tracker(int argc, char *argv[])
   }
   //Free the peers list
   xbt_dynar_free(&peers_list);
-  //Free the RngStream object.
-  RngStream_DeleteStream(&stream);
 
   XBT_INFO("Tracker is leaving");
 
index 377d4c3..eda1d82 100644 (file)
@@ -59,15 +59,16 @@ set(bin_files
   )
 set(txt_files
   ${txt_files}
-  ${CMAKE_CURRENT_SOURCE_DIR}/replay/actions_bcast.txt
   ${CMAKE_CURRENT_SOURCE_DIR}/replay/actions0.txt
   ${CMAKE_CURRENT_SOURCE_DIR}/replay/actions1.txt
-  ${CMAKE_CURRENT_SOURCE_DIR}/replay/split_traces
   ${CMAKE_CURRENT_SOURCE_DIR}/replay/actions_allReduce.txt
-  ${CMAKE_CURRENT_SOURCE_DIR}/replay/actions_barrier.txt
-  ${CMAKE_CURRENT_SOURCE_DIR}/replay/actions_with_isend.txt
   ${CMAKE_CURRENT_SOURCE_DIR}/replay/actions_alltoall.txt
   ${CMAKE_CURRENT_SOURCE_DIR}/replay/actions_alltoallv.txt
+  ${CMAKE_CURRENT_SOURCE_DIR}/replay/actions_barrier.txt
+  ${CMAKE_CURRENT_SOURCE_DIR}/replay/actions_bcast.txt
+  ${CMAKE_CURRENT_SOURCE_DIR}/replay/actions_bcast_reduce_datatypes.txt
   ${CMAKE_CURRENT_SOURCE_DIR}/replay/actions_waitall.txt
+  ${CMAKE_CURRENT_SOURCE_DIR}/replay/actions_with_isend.txt
+  ${CMAKE_CURRENT_SOURCE_DIR}/replay/split_traces
   PARENT_SCOPE
   )  
index 20690c0..986a463 100644 (file)
@@ -43,16 +43,16 @@ XBT_PUBLIC(void) MSG_config(const char *key, const char *value);
  *
  *  We allow to link against compiled versions that differ in the patch level.
  */
-#define MSG_init(argc,argv)  {                      \
-         int ver_major,ver_minor,ver_patch;              \
-         sg_version(&ver_major,&ver_minor,&ver_patch);   \
-         if ((ver_major != SIMGRID_VERSION_MAJOR) ||     \
-             (ver_minor != SIMGRID_VERSION_MINOR)) {     \
-           fprintf(stderr,"FATAL ERROR: Your program was compiled with SimGrid version %d.%d.%d, and then linked against SimGrid %d.%d.%d. Please fix this.\n", \
-               SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH,ver_major,ver_minor,ver_patch);                          \
-         }                                               \
-         MSG_init_nocheck(argc,argv);                    \
-       }
+#define MSG_init(argc,argv)  {                                          \
+    int ver_major,ver_minor,ver_patch;                                  \
+    sg_version(&ver_major,&ver_minor,&ver_patch);                       \
+    if ((ver_major != SIMGRID_VERSION_MAJOR) ||                         \
+        (ver_minor != SIMGRID_VERSION_MINOR)) {                         \
+      fprintf(stderr,"FATAL ERROR: Your program was compiled with SimGrid version %d.%d.%d, and then linked against SimGrid %d.%d.%d. Please fix this.\n", \
+              SIMGRID_VERSION_MAJOR,SIMGRID_VERSION_MINOR,SIMGRID_VERSION_PATCH,ver_major,ver_minor,ver_patch); \
+    }                                                                   \
+    MSG_init_nocheck(argc,argv);                                        \
+  }
 
 XBT_PUBLIC(void) MSG_init_nocheck(int *argc, char **argv);
 XBT_PUBLIC(msg_error_t) MSG_main(void);
@@ -208,7 +208,7 @@ XBT_PUBLIC(double) MSG_task_get_compute_duration(msg_task_t task);
 XBT_PUBLIC(void) MSG_task_set_compute_duration(msg_task_t task,
                                                double compute_duration);
 XBT_PUBLIC(void) MSG_task_set_data_size(msg_task_t task,
-                                              double data_size);
+                                        double data_size);
 
 XBT_PUBLIC(double) MSG_task_get_remaining_computation(msg_task_t task);
 XBT_PUBLIC(double) MSG_task_get_remaining_communication(msg_task_t task);
@@ -271,7 +271,7 @@ XBT_PUBLIC(int) MSG_task_listen_from_host(const char *alias,
 XBT_PUBLIC(msg_error_t)
     MSG_task_send_with_timeout(msg_task_t task, const char *alias,
                            double timeout);
-    
+
 XBT_PUBLIC(msg_error_t)
     MSG_task_send_with_timeout_bounded(msg_task_t task, const char *alias,
                            double timeout, double maxrate);
@@ -292,6 +292,10 @@ XBT_PUBLIC(msg_error_t)
     MSG_mailbox_get_task_ext(msg_mailbox_t mailbox, msg_task_t * task,
                          msg_host_t host, double timeout);
 
+XBT_PUBLIC(msg_error_t)
+    MSG_mailbox_get_task_ext_bounded(msg_mailbox_t mailbox, msg_task_t *task,
+                                     msg_host_t host, double timeout, double rate);
+
 XBT_PUBLIC(msg_error_t)
     MSG_mailbox_put_with_timeout(msg_mailbox_t mailbox, msg_task_t task,
                              double timeout);
index d706778..5f0a615 100644 (file)
@@ -52,6 +52,12 @@ SG_BEGIN_DECL()
   * \skip end_of_doxygen
   * \until }
   *
+  * Note that if you use dynars to store pointed data, the
+  * xbt_dynar_search(), xbt_dynar_search_or_negative() and
+  * xbt_dynar_member() won't be for you. Instead of comparing
+  * your pointed elements, they compare the pointer to them. See
+  * the documentation of xbt_dynar_search() for more info.
+  * 
   */
 /** @defgroup XBT_dynar_cons Dynar constructor and destructor
  *  @ingroup XBT_dynar
@@ -267,7 +273,7 @@ _xbt_dynar_cursor_get(const xbt_dynar_t dynar,
  *  @param _data
  *  @hideinitializer
  *
- * \note An example of usage:
+ * Here is an example of usage:
  * \code
 xbt_dynar_t dyn;
 unsigned int cpt;
@@ -276,6 +282,10 @@ xbt_dynar_foreach (dyn,cpt,str) {
   printf("Seen %s\n",str);
 }
 \endcode
+ * 
+ * Note that underneath, that's a simple for loop with no real black
+ * magic involved. It's perfectly safe to interrupt a foreach with a
+ * break or a return statement. 
  */
 #define xbt_dynar_foreach(_dynar,_cursor,_data) \
        for (_xbt_dynar_cursor_first(_dynar,&(_cursor))      ; \
index 1d45583..9266483 100644 (file)
@@ -6,12 +6,14 @@
   * under the terms of the license (GNU LGPL) which comes with this package. */
 #include "jmsg_file.h"
 #include "jxbt_utilities.h"
+
 void jfile_bind(JNIEnv *env, jobject jfile, msg_file_t stream) {
-  (*env)->SetLongField(env, jfile, jfile_field_bind, (jlong) (long) (stream));
+  (*env)->SetLongField(env, jfile, jfile_field_bind, (intptr_t)stream);
 }
 
 msg_file_t jfile_get_native(JNIEnv *env, jobject jfile) {
-  msg_file_t file = (msg_file_t)(*env)->GetLongField(env, jfile, jfile_field_bind);
+  msg_file_t file =
+    (msg_file_t)(intptr_t)(*env)->GetLongField(env, jfile, jfile_field_bind);
   return file;
 }
 
index 233a614..2f6216e 100644 (file)
@@ -56,17 +56,21 @@ void jprocess_join(jobject jprocess, JNIEnv * env)
 
 msg_process_t jprocess_to_native_process(jobject jprocess, JNIEnv * env)
 {
-  return (msg_process_t) (long) (*env)->GetLongField(env, jprocess, jprocess_field_Process_bind);
+  return
+    (msg_process_t)(intptr_t)(*env)->GetLongField(env, jprocess,
+                                                  jprocess_field_Process_bind);
 }
 
 void jprocess_bind(jobject jprocess, msg_process_t process, JNIEnv * env)
 {
-  (*env)->SetLongField(env, jprocess, jprocess_field_Process_bind, (jlong)(process));
+  (*env)->SetLongField(env, jprocess, jprocess_field_Process_bind,
+                       (intptr_t)process);
 }
 
 jlong jprocess_get_id(jobject jprocess, JNIEnv * env)
 {
-  return (*env)->GetLongField(env, jprocess, jprocess_field_Process_id);
+  return
+    (intptr_t)(*env)->GetLongField(env, jprocess, jprocess_field_Process_id);
 }
 
 jstring jprocess_get_name(jobject jprocess, JNIEnv * env)
@@ -128,7 +132,7 @@ Java_org_simgrid_msg_Process_create(JNIEnv * env,
   /* bind/retrieve the msg host */
   host = MSG_get_host_by_name(hostname);
 
-  if (!(host)) {    /* not binded */
+  if (!(host)) {    /* not bound */
     jxbt_throw_host_not_found(env, hostname);
     return;
   }
@@ -344,6 +348,8 @@ Java_org_simgrid_msg_Process_waitFor(JNIEnv * env, jobject jprocess,
 {
   msg_error_t rv;
   rv = MSG_process_sleep((double)jseconds);
+  if ((*env)->ExceptionOccurred(env))
+    return;
   if (rv != MSG_OK) {
     XBT_DEBUG("Status NOK");
     jmsg_throw_status(env,rv);
@@ -385,6 +391,7 @@ Java_org_simgrid_msg_Process_migrate(JNIEnv * env,
   msg_error_t rv = MSG_process_migrate(process, host);
   if (rv != MSG_OK) {
     jmsg_throw_status(env,rv);
+    return;
   }
   /* change the host java side */
   (*env)->SetObjectField(env, jprocess, jprocess_field_Process_host, jhost);
index a51c4cc..6610b84 100644 (file)
@@ -13,7 +13,8 @@
 jfieldID jrngstream_bind;
 
 RngStream jrngstream_to_native(JNIEnv *env, jobject jrngstream) {
-  RngStream rngstream = (RngStream) (*env)->GetLongField(env, jrngstream, jrngstream_bind);
+  RngStream rngstream =
+    (RngStream)(intptr_t)(*env)->GetLongField(env, jrngstream, jrngstream_bind);
   if (!rngstream) {
     jxbt_throw_notbound(env, "rngstream", jrngstream);
     return NULL;
@@ -33,7 +34,7 @@ Java_org_simgrid_msg_RngStream_create(JNIEnv *env, jobject jrngstream, jstring j
   const char *name = (*env)->GetStringUTFChars(env, jname, 0);
   RngStream rngstream = RngStream_CreateStream(name);
   //Bind the RngStream object
-  (*env)->SetLongField(env, jrngstream, jrngstream_bind, (jlong)rngstream);
+  (*env)->SetLongField(env, jrngstream, jrngstream_bind, (intptr_t)rngstream);
 
   (*env)->ReleaseStringUTFChars(env, jname, name);
 }
@@ -41,7 +42,7 @@ JNIEXPORT void JNICALL
 Java_org_simgrid_msg_RngStream_destroy(JNIEnv *env, jobject jrngstream) {
   RngStream rngstream = jrngstream_to_native(env, jrngstream);
   RngStream_DeleteStream(&rngstream);
-  (*env)->SetLongField(env, jrngstream, jrngstream_bind, (jlong)NULL);
+  (*env)->SetLongField(env, jrngstream, jrngstream_bind, (intptr_t)NULL);
 }
 JNIEXPORT jboolean JNICALL
 Java_org_simgrid_msg_RngStream_setPackageSeed(JNIEnv *env, jobject jrngstream, jintArray jseed) {
index f6b80d6..ddc1740 100644 (file)
@@ -30,12 +30,12 @@ static jfieldID jtask_field_Comm_receiving;
 
 void jtask_bind(jobject jtask, msg_task_t task, JNIEnv * env)
 {
-  (*env)->SetLongField(env, jtask, jtask_field_Task_bind, (jlong) (long) (task));
+  (*env)->SetLongField(env, jtask, jtask_field_Task_bind, (intptr_t)task);
 }
 
 msg_task_t jtask_to_native_task(jobject jtask, JNIEnv * env)
 {
-  return (msg_task_t) (long) (*env)->GetLongField(env, jtask, jtask_field_Task_bind);
+  return (msg_task_t)(intptr_t)(*env)->GetLongField(env, jtask, jtask_field_Task_bind);
 }
 
 jboolean jtask_is_valid(jobject jtask, JNIEnv * env)
@@ -218,6 +218,8 @@ Java_org_simgrid_msg_Task_execute(JNIEnv * env, jobject jtask)
   }
   msg_error_t rv;
   rv = MSG_task_execute(task);
+  if ((*env)->ExceptionOccurred(env))
+    return;
   if (rv != MSG_OK) {
     jmsg_throw_status(env, rv);
   }
@@ -433,6 +435,8 @@ Java_org_simgrid_msg_Task_receive(JNIEnv * env, jclass cls,
 
   alias = (*env)->GetStringUTFChars(env, jalias, 0);
   rv = MSG_task_receive_ext(task, alias, (double) jtimeout, host);
+  if ((*env)->ExceptionOccurred(env))
+    return NULL;
   if (rv != MSG_OK) {
     jmsg_throw_status(env,rv);
     return NULL;
index 7e98a81..0980d90 100644 (file)
 #include "msg/msg.h"
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg);
 
+static jfieldID jvm_field_bind;
+
 void jvm_bind(JNIEnv *env, jobject jvm, msg_vm_t vm) {
-  (*env)->SetLongField(env, jvm, jvm_field_bind, (jlong) (long) (vm));
+  (*env)->SetLongField(env, jvm, jvm_field_bind, (intptr_t)vm);
 }
 msg_vm_t jvm_get_native(JNIEnv *env, jobject jvm) {
-       msg_vm_t vm = (msg_vm_t)(*env)->GetLongField(env, jvm, jvm_field_bind);
-       return vm;
+  return (msg_vm_t)(intptr_t)(*env)->GetLongField(env, jvm, jvm_field_bind);
 }
 
 JNIEXPORT void JNICALL
@@ -61,8 +62,8 @@ Java_org_simgrid_msg_VM_bind(JNIEnv *env, jobject jvm, jobject jprocess) {
   msg_vm_t vm = jvm_get_native(env,jvm);
   msg_process_t process = jprocess_to_native_process(jprocess,env);
 
-  xbt_assert((vm != NULL), "VM object is not binded");
-  xbt_assert((process != NULL), "Process object is not binded.");
+  xbt_assert((vm != NULL), "VM object is not bound");
+  xbt_assert((process != NULL), "Process object is not bound.");
 
   MSG_vm_bind(vm,process);
 }
index 4933969..b0146de 100644 (file)
@@ -12,8 +12,6 @@
 #include <jni.h>
 #include "msg/msg.h"
 
-jfieldID jvm_field_bind;
-
 void jvm_bind(JNIEnv *env, jobject jvm, msg_vm_t vm);
 msg_vm_t jvm_get_native(JNIEnv *env, jobject jvm);
 
index 4752c7c..8d5084c 100644 (file)
@@ -10,6 +10,7 @@
 #define JXBT_UTILITY_H
 
 #include <jni.h>
+#include <stdint.h>
 
 /* *********** */
 /* JNI GETTERS */
index 6684147..c00dd54 100644 (file)
@@ -16,7 +16,7 @@ package org.simgrid.msg;
  * Thus it is represented as a physical resource with computing capabilities, some 
  * mailboxes to enable running process to communicate with remote ones, and some private 
  * data that can be only accessed by local process. An instance of this class is always 
- * binded with the corresponding native host. All the native hosts are automatically created 
+ * bound with the corresponding native host. All the native hosts are automatically created
  * during the call of the method Msg.createEnvironment(). This method take as parameter a
  * platform file which describes all elements of the platform (host, link, root..).
  * You cannot create a host yourself.
index 650606c..2b2c4b2 100644 (file)
@@ -195,7 +195,7 @@ public abstract class Process implements Runnable {
        }
        /**
         * The natively implemented method to create an MSG process.
-        * @param hostName    A valid (binded) host where create the process.
+        * @param hostName    A valid (bound) host where create the process.
         */
        protected native void create(String hostName) throws HostNotFoundException;
        /**
index 9389a55..13fa595 100644 (file)
@@ -58,7 +58,7 @@ public class VM {
         */     
        public native void bind(Process process);
        /** Removes the given process from the given VM, and kill it
-        *  Will raise a ProcessNotFound exception if the process were not binded to that VM
+        *  Will raise a ProcessNotFound exception if the process were not bound to that VM
         */     
        public native void unbind(Process process);
        /** Immediately change the host on which all processes are running
@@ -95,4 +95,12 @@ public class VM {
        public String getName() {
                return name;
        }               
+
+       /**
+        * Class initializer, to initialize various JNI stuff
+        */
+       public static native void nativeInit();
+       static {
+               nativeInit();
+       }
 }
index 00fe9b5..4983f73 100644 (file)
@@ -210,7 +210,9 @@ static void smx_ctx_cojava_suspend(smx_context_t context)
     else if (!java_context->bound) {
       java_context->bound = 1;
       smx_process_t process = SIMIX_process_self();
-      (*global_env)->SetLongField(global_env, java_context->jprocess, jprocess_field_Process_bind, (jlong)process);
+      (*global_env)->SetLongField(global_env, java_context->jprocess,
+                                  jprocess_field_Process_bind,
+                                  (intptr_t)process);
     }
 
     next_coroutine = java_context->jcoroutine;
@@ -236,7 +238,8 @@ static void smx_ctx_cojava_resume(smx_context_t new_context) {
   else if (!java_context->bound) {
     java_context->bound = 1;
     smx_process_t process = SIMIX_process_self();
-    (*global_env)->SetLongField(global_env, java_context->jprocess, jprocess_field_Process_bind, (jlong)process);
+    (*global_env)->SetLongField(global_env, java_context->jprocess,
+                                jprocess_field_Process_bind, (intptr_t)process);
   }
   (*global_env)->CallStaticVoidMethod(global_env, coclass, coroutine_yieldTo, java_context->jcoroutine);
 }
index 1f7a8de..695af57 100644 (file)
@@ -18,7 +18,7 @@ SG_BEGIN_DECL()
 
 typedef struct s_smx_ctx_cojava {
   s_smx_ctx_base_t super;       /* Fields of super implementation */
-  jobject jprocess;             /* the java process instance binded with the msg process structure */
+  jobject jprocess;             /* the java process instance bound with the msg process structure */
   JNIEnv *jenv;                 /* jni interface pointer associated to this thread */
   jobject jcoroutine;                                          /* java coroutine object */
   int bound:1;
index 02f6f7b..02406f2 100644 (file)
@@ -110,7 +110,8 @@ static void* smx_ctx_java_thread_run(void *data) {
   }
   else {
     smx_process_t process = SIMIX_process_self();
-    (*env)->SetLongField(env, context->jprocess, jprocess_field_Process_bind, (jlong)process);
+    (*env)->SetLongField(env, context->jprocess, jprocess_field_Process_bind,
+                         (intptr_t)process);
   }
   xbt_assert((context->jprocess != NULL), "Process not created...");
   //wait for the process to be able to begin
index 084c5d4..789bf17 100644 (file)
@@ -18,7 +18,7 @@ SG_BEGIN_DECL()
 
 typedef struct s_smx_ctx_java {
   s_smx_ctx_base_t super;       /* Fields of super implementation */
-  jobject jprocess;             /* the java process instance binded with the msg process structure */
+  jobject jprocess;             /* the java process instance bound with the msg process structure */
   JNIEnv *jenv;                 /* jni interface pointer associated to this thread */
   xbt_os_thread_t thread;
   xbt_os_sem_t begin;           /* this semaphore is used to schedule/yield the process  */
index 175317b..f46e7ca 100644 (file)
@@ -90,7 +90,7 @@ void MSG_vm_bind(msg_vm_t vm, msg_process_t process) {
 /** @brief Removes the given process from the given VM, and kill it
  *  @ingroup msg_VMs
  *
- *  Will raise a not_found exception if the process were not binded to that VM
+ *  Will raise a not_found exception if the process were not bound to that VM
  */
 void MSG_vm_unbind(msg_vm_t vm, msg_process_t process) {
   int pos = xbt_dynar_search(vm->processes,process);
index 650f46b..f618fdf 100644 (file)
@@ -747,14 +747,14 @@ double simcall_comm_change_rate_first_action(smx_rdv_t rdv, double newrate)
 
   item = xbt_fifo_get_first_item(rdv->comm_fifo);
   if (item != NULL) {
-         action = (smx_action_t) xbt_fifo_get_item_content(item);
-         if (action->comm.rate > newrate) {
-                 action->comm.rate = newrate;
-                 return newrate;
-         } else
-                 return action->comm.rate;
+    action = (smx_action_t) xbt_fifo_get_item_content(item);
+    if (action->comm.rate > newrate) {
+      action->comm.rate = newrate;
+      return newrate;
+    } else
+      return action->comm.rate;
   } else
-         return -1.0;
+    return -1.0;
 }
 
 
index 9e48e3c..6f89215 100644 (file)
@@ -325,7 +325,8 @@ void smpi_mpi_start(MPI_Request request)
     smpi_datatype_use(request->old_type);
     request->action = simcall_comm_irecv(mailbox, request->buf, &request->real_size, &match_recv, request);
 
-    double sleeptime = smpi_or(request->size);
+    //integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0
+    double sleeptime = request->detached ? smpi_or(request->size) : 0.0;
     if(sleeptime!=0.0){
         simcall_process_sleep(sleeptime);
         XBT_DEBUG("receiving size of %zu : sleep %lf ", request->size, smpi_or(request->size));
@@ -364,15 +365,16 @@ void smpi_mpi_start(MPI_Request request)
 
     //if we are giving back the control to the user without waiting for completion, we have to inject timings
     double sleeptime =0.0;
-    if(request->detached && !(request->flags & ISEND))
-      sleeptime = smpi_os(request->size);
-    else
-      sleeptime = smpi_ois(request->size);
+    if(request->detached || (request->flags & (ISEND|SSEND))){// issend should be treated as isend
+      //isend and send timings may be different
+      sleeptime = (request->flags & ISEND)? smpi_ois(request->size) : smpi_os(request->size);
+    }
 
     if(sleeptime!=0.0){
         simcall_process_sleep(sleeptime);
         XBT_DEBUG("sending size of %zu : sleep %lf ", request->size, smpi_os(request->size));
     }
+
     request->action =
       simcall_comm_isend(mailbox, request->size, -1.0,
                          request->buf, request->real_size,
@@ -483,8 +485,11 @@ void smpi_mpi_recv(void *buf, int count, MPI_Datatype datatype, int src,
 void smpi_mpi_send(void *buf, int count, MPI_Datatype datatype, int dst,
                    int tag, MPI_Comm comm)
 {
-  MPI_Request request;
-  request = smpi_mpi_isend(buf, count, datatype, dst, tag, comm);
+  MPI_Request request =
+      build_request(buf, count, datatype, smpi_comm_rank(comm), dst, tag,
+                    comm, NON_PERSISTENT | SEND);
+
+  smpi_mpi_start(request);
   smpi_mpi_wait(&request, MPI_STATUS_IGNORE);
 
 }
index a054bba..dc7fdbd 100644 (file)
@@ -67,62 +67,61 @@ static void cluster_get_graph(xbt_graph_t graph, xbt_dict_t nodes,
   int isrc;
   int table_size = xbt_dynar_length(rc->index_network_elm);
 
-  sg_routing_edge_t src, dst;
-  xbt_node_t current, previous, backboneNode,routerNode;
+  sg_routing_edge_t src;
+  xbt_node_t current, previous, backboneNode = NULL, routerNode;
   s_surf_parsing_link_up_down_t info;
 
   xbt_assert(((as_cluster_t) rc)->router,"Malformed cluster");
 
   /* create the router */
   char *link_name =
-                 ((sg_routing_edge_t) ((as_cluster_t) rc)->router)->name;
+    ((sg_routing_edge_t) ((as_cluster_t) rc)->router)->name;
   routerNode = new_xbt_graph_node(graph, link_name, nodes);
 
   if(((as_cluster_t) rc)->backbone) {
-         char *link_nameR =
-                         ((surf_resource_t) ((as_cluster_t) rc)->backbone)->name;
-         backboneNode = new_xbt_graph_node(graph, link_nameR, nodes);
+    char *link_nameR =
+      ((surf_resource_t) ((as_cluster_t) rc)->backbone)->name;
+    backboneNode = new_xbt_graph_node(graph, link_nameR, nodes);
 
-         new_xbt_graph_edge(graph, routerNode, backboneNode, edges);
+    new_xbt_graph_edge(graph, routerNode, backboneNode, edges);
   }
 
   for (isrc = 0; isrc < table_size; isrc++) {
-         src = xbt_dynar_get_as(rc->index_network_elm, isrc, sg_routing_edge_t);
+    src = xbt_dynar_get_as(rc->index_network_elm, isrc, sg_routing_edge_t);
 
-         if (src->rc_type != SURF_NETWORK_ELEMENT_ROUTER) {
-                         previous = new_xbt_graph_node(graph, src->name, nodes);
+    if (src->rc_type != SURF_NETWORK_ELEMENT_ROUTER) {
+      previous = new_xbt_graph_node(graph, src->name, nodes);
 
-                         info = xbt_dynar_get_as(rc->link_up_down_list, src->id,
-                                         s_surf_parsing_link_up_down_t);
+      info = xbt_dynar_get_as(rc->link_up_down_list, src->id,
+                              s_surf_parsing_link_up_down_t);
 
-                         if (info.link_up) {     // link up
+      if (info.link_up) {     // link up
 
-                                 char *link_name = ((surf_resource_t) info.link_up)->name;
-                                 current = new_xbt_graph_node(graph, link_name, nodes);
-                                 new_xbt_graph_edge(graph, previous, current, edges);
+        char *link_name = ((surf_resource_t) info.link_up)->name;
+        current = new_xbt_graph_node(graph, link_name, nodes);
+        new_xbt_graph_edge(graph, previous, current, edges);
 
-                                 if (((as_cluster_t) rc)->backbone) {
-                                         new_xbt_graph_edge(graph, current, backboneNode, edges);
-                                 } else {
-                                         new_xbt_graph_edge(graph, current, routerNode, edges);
-                                 }
+        if (((as_cluster_t) rc)->backbone) {
+          new_xbt_graph_edge(graph, current, backboneNode, edges);
+        } else {
+          new_xbt_graph_edge(graph, current, routerNode, edges);
+        }
 
-                         }
+      }
 
-                         if (info.link_down) {    // link down
-                                 char *link_name = ((surf_resource_t) info.link_down)->name;
-                                 current = new_xbt_graph_node(graph, link_name, nodes);
-                                 new_xbt_graph_edge(graph, previous, current, edges);
+      if (info.link_down) {    // link down
+        char *link_name = ((surf_resource_t) info.link_down)->name;
+        current = new_xbt_graph_node(graph, link_name, nodes);
+        new_xbt_graph_edge(graph, previous, current, edges);
 
-                                 if (((as_cluster_t) rc)->backbone) {
-                                         new_xbt_graph_edge(graph, current, backboneNode, edges);
-                                 } else {
-                                         new_xbt_graph_edge(graph, current, routerNode, edges);
-                                 }
-
-                         }
-                 }
+        if (((as_cluster_t) rc)->backbone) {
+          new_xbt_graph_edge(graph, current, backboneNode, edges);
+        } else {
+          new_xbt_graph_edge(graph, current, routerNode, edges);
+        }
+    }
   }
+
 }
 
 static void model_cluster_finalize(AS_t as)
index 2c03573..18a6f49 100644 (file)
@@ -841,6 +841,7 @@ void surf_parse_close(void)
   xbt_dynar_free(&surf_parsed_filename_stack);
 
   free(surf_parsed_filename);
+  surf_parsed_filename = NULL;
 
   if (surf_file_to_parse) {
     surf_parse__delete_buffer(surf_input_buffer);
index 720b376..8c7cd9f 100644 (file)
@@ -466,6 +466,19 @@ xbt_dynar_remove_n_at(xbt_dynar_t const dynar,
 
 /** @brief Returns the position of the element in the dynar
  *
+ * Beware that if your dynar contains pointed values (such as strings) instead 
+ * of scalar, this function compares the pointer value, not what's pointed. The only
+ * solution to search for a pointed value is then to write the foreach loop yourself:
+ * \code
+ * signed int position = -1;
+ * xbt_dynar_foreach(dynar, iter, elem) {
+ *    if (!memcmp(elem, searched_element, sizeof(*elem))) {
+ *        position = iter;
+ *        break;
+ *    }
+ * }
+ * \endcode
+ * 
  * Raises not_found_error if not found. If you have less than 2 millions elements,
  * you probably want to use #xbt_dynar_search_or_negative() instead, so that you
  * don't have to TRY/CATCH on element not found.
@@ -485,6 +498,10 @@ unsigned int xbt_dynar_search(xbt_dynar_t const dynar, void *const elem)
 
 /** @brief Returns the position of the element in the dynar (or -1 if not found)
  *
+ * Beware that if your dynar contains pointed values (such as
+ * strings) instead of scalar, this function is probably not what you
+ * want. Check the documentation of xbt_dynar_search() for more info.
+ * 
  * Note that usually, the dynar indices are unsigned integers. If you have more
  * than 2 million elements in your dynar, this very function will not work (but the other will).
  */
@@ -500,7 +517,12 @@ signed int xbt_dynar_search_or_negative(xbt_dynar_t const dynar, void *const ele
   return -1;
 }
 
-/** @brief Returns a boolean indicating whether the element is part of the dynar */
+/** @brief Returns a boolean indicating whether the element is part of the dynar 
+ *
+ * Beware that if your dynar contains pointed values (such as
+ * strings) instead of scalar, this function is probably not what you
+ * want. Check the documentation of xbt_dynar_search() for more info.
+ */
 int xbt_dynar_member(xbt_dynar_t const dynar, void *const elem)
 {
 
index 3ee7e01..75a58bf 100755 (executable)
@@ -120,7 +120,14 @@ RunTest getproc 1 "*** Test Get Processor Name ***"
 #
 # If there was a Unix standard interface to ps, we could check for orphaned
 # processes...
-if ps -fwu $LOGNAME > /dev/null 2>&1 ; then
+if ps --version | grep procps > /dev/null 2>&1 ; then
+   # This is a try to be a better choice than ps -u because it
+   # restricts the list of processes to those of the current session.
+   # The options are known to work with the ps command from the procps
+   # package.
+   SESSION=`ps -o sess= $$`
+   PSPGM="ps -o pid,tname,command -s $SESSION"
+elif ps -fwu $LOGNAME > /dev/null 2>&1 ; then
    # This is a better choice than ps aux because it restricts the list of 
    # processes to those of the running user.  The w is needed on some
    # systems to get a long output for the command
index 38fe76d..7937222 100755 (executable)
@@ -94,9 +94,9 @@ diffcmd() {
 colordiff=$(type -p colordiff)
 colorless() {
     if [ -x "$colordiff" ]; then
-        "$colordiff" | less -R -F
+        "$colordiff" | less -R -F -X
     else
-        less -F
+        less -F -X
     fi
 }