From: cherierm Date: Thu, 15 Nov 2007 18:06:01 +0000 (+0000) Subject: This commit concerned the reimplementation of the xbt context switch mechanism. X-Git-Tag: v3.3~801 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5873e2ce9c66711a168e9b419f0d1b6384ce1ffa This commit concerned the reimplementation of the xbt context switch mechanism. The gaol of this reimplementation is to separate the context switch mechanism of its implementation (context switch implementation based ucontext, based native threads or java threads). To do this, the code introduce a new concept : the context factory. This factory is responsible of the construction of the context adapted to the desired context implementation. Normally, the context factory to use is selected during the compilation process. But, for the java implementation of the context switch, the simgrid library select dynamically the context factory to use (the java context factory to use). This change also introduce three new concepts : the xbt_ucontext_t, the xbt_jcontext_t and the xbt_thread_context_t which derived from the concept xbt_context_t. Each of them is specialized to respect an interface contract. This contract is represented by function pointers such (start, stop, kill, schedule, yield...). For more details on this function pointers see the source code file xbt_context.c. The continuation gives the list of the modified, deleted and added files by this change. Modified files: src/msg/global.c get_pid is a function pointer src/msg/private.h use xbt_context.h instead context.h src/include/simix/simix.h java process management functions are not needed now src/java/simgrid/msg/ApplicationHandler.java remove an useless printed message src/java/simgrid/msg/msg.java simgrid for java and simgrid are now the same library so the name of the java library is also simgrid add the call of the native function selectContextFactory() for the context switch based on the java threads src/java/jmsg.c include the xbt_context_private.h which declare the context based java thread (jxbt_context.h doesn't exist any more) declare an define a new function native_to_java_process which returns the java process associated with a msg process define the native function java_simgrid_msg_Msg_selectContextFactory() use the xbt_context_stop() function to signal the end of the java thread instead the function xbt_context_exit() src/java/jmsg.h add the declaration of the java_simgrid_msg_Msg_selectContextFactory() function src/java/jmsg_host.c this file is now inclued from the file src/xbt/xbt_jcontext.c which declare the log category for java, so the macro XBT_LOG_EXTERNAL_CATEGORY is useless src/java/jmsg_parallel_task.c the same reason of the file src/java/jmsg_host.c src/java/jmsg_process.c the same reason of the file src/java/jmsg_host.c and this file needs to include src/xbt/xbt_jprocess.h instead the file src/xbt/context_private.h to get the definition of the java context src/java/jmsg_process.h include xbt_context.h instead the context.h header src/java/jxbt_utilities.c the same reason of the file src/java/jmsg_host.c src/simix/private.h include xbt_context.h instead the header context.h src/simix/smx_process.c modify the function SIMIX_jprocess_create() : this function doesn't use any more the simix java process management and the jprocess object is now passed as the fourth parameter of the function xbt_context_new(). src/surf/network.c it's pointers to functions src/surf/surfxml_parse.c just initialize the variable surf_file_to_parse to NULL src/surf/workstation_KCCFLN05.c function pointers usage and ANSI C variable declarations src/surf/workstation_ptask_L07.c function pointers usage and ANSI C variable declarations src/surf/surf.c adapt the code to the specific path separator of Windows src/xbt/xbt_main.c the function xbt_context_init() and xbt_context_exit() are now renamed xbt_context_mod_init() and xbt_context_mod_exit() src/xbt/xbt_modinter.h declaration of xbt_context_mod_init() and xbt_context_mod_exit() functions src/xbt/xbt_str.c avoid the warning thrown by the Visual C++ compiler when it meets a comparison between a signed and a unsigned integer src/gras/rl_stubs.c use xbt_context_mod_init() and xbt_context_mod_exit() instead xbt_context_init() and xbt_context_exit() src/makefile.am the java library build is now useless src/makefile.in this is the consequence of the previous change (makefile.am) Files to add: src/xbt/xbt_context_private.h this header replace the file context_private.h src/xbt/xbt_context.c this source file replace the file context.c include/xbt/xbt_context.h this file replace the file context.h src/xbt/xbt_context_factory.h this header declares the context factory structure used by xbt to build the adapted context src/xbt/xbt_thread_context.h this header declares the structure used in the switch context process based on the native threads src/xbt/xbt_thread_context.c this source file contains the implementation of the thread context src/xbt/xbt_ucontext.h this header declares the structure used in the switch context process based on the ucontext src/xbt/xbt_ucontext.c this source code file contains the implementation of the context based on the ucontext src/xbt/xbt_jcontext.h this header contains the declaration of the structure used in the switch context process based on the java thread src/xbt/xbt_jcontext.c this source code file contains the implementation of the context based on java thread Files to delete: src/xbt/context.c this file is replaced by the file src/xbt/xbt_context.c src/include/xbt/context.h this file is replaced by the file include/xbt/xbt_context.h src/xbt/context_private.h this file is replaced by the file src/xbt/xbt_context_private.h src/java/jxbt_context.h this file is useless (reimplemented in xbt_context.h) src/java/jxbt_context.c this file is useless (reimplemented in xbt_context.c) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5040 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/gras/rl_stubs.c b/src/gras/rl_stubs.c index f9474fe6e6..526b8a9ac6 100644 --- a/src/gras/rl_stubs.c +++ b/src/gras/rl_stubs.c @@ -11,6 +11,6 @@ #include "xbt_modinter.h" #include "xbt/sysdep.h" -void xbt_context_init(void) {} +void xbt_context_mod_init(void) {} -void xbt_context_exit(void) {} +void xbt_context_mod_exit(void) {} diff --git a/src/include/simix/simix.h b/src/include/simix/simix.h index 4d56103a9c..a3d6ec04b4 100644 --- a/src/include/simix/simix.h +++ b/src/include/simix/simix.h @@ -151,12 +151,6 @@ XBT_PUBLIC(smx_action_t) SIMIX_action_parallel_execute(char * name, void SIMIX_display_process_status(void); -/* Helper functions for jMSG: manipulate the context data without breaking the module separation */ -void SIMIX_process_set_jprocess(smx_process_t process, void *jp); -void* SIMIX_process_get_jprocess(smx_process_t process); -void SIMIX_process_set_jenv(smx_process_t process, void *je); -void* SIMIX_process_get_jenv(smx_process_t process); - SG_END_DECL() diff --git a/src/java/jmsg.c b/src/java/jmsg.c index d40d249d78..2495f52173 100644 --- a/src/java/jmsg.c +++ b/src/java/jmsg.c @@ -12,7 +12,7 @@ #include "msg/msg.h" #include "msg/private.h" #include "simix/private.h" -#include "java/jxbt_context.h" +#include "xbt/xbt_context_private.h" #include "jmsg_process.h" #include "jmsg_host.h" @@ -21,12 +21,13 @@ #include "jmsg_channel.h" #include "jxbt_utilities.h" -XBT_LOG_NEW_DEFAULT_CATEGORY(jmsg,"MSG for Java(TM)"); - #include "jmsg.h" static JavaVM * __java_vm = NULL; +static jobject +native_to_java_process(m_process_t process); + JavaVM * get_java_VM(void) { return __java_vm; @@ -41,6 +42,12 @@ get_current_thread_env(void) { return env; } +static jobject +native_to_java_process(m_process_t process) +{ + return ((xbt_jcontext_t)(process->simdata->s_process->simdata->context))->jprocess; +} + /* * The MSG process connected functions implementation. @@ -108,6 +115,8 @@ Java_simgrid_msg_Msg_processCreate(JNIEnv* env, jclass cls, jobject jprocess_arg /*data*/ (void*)process, jprocess,env, &process->simdata->s_process); + + DEBUG1("context created (s_process=%p)",process->simdata->s_process); @@ -176,7 +185,7 @@ Java_simgrid_msg_Msg_processKill(JNIEnv* env, jclass cls, jobject jprocess) { } /* delete the global reference */ - jprocess_delete_global_ref(SIMIX_process_get_jprocess(process->simdata->s_process),env); + jprocess_delete_global_ref(native_to_java_process(process),env); /* kill the native process (this wrapper is call by the destructor of the java * process instance) @@ -216,12 +225,12 @@ Java_simgrid_msg_Msg_processFromPID(JNIEnv* env, jclass cls, jint PID) { return NULL; } - if(!SIMIX_process_get_jprocess(process->simdata->s_process)) { + if(!native_to_java_process(process)) { jxbt_throw_native(env, xbt_strdup("SIMIX_process_get_jprocess() failed")); return NULL; } - return (jobject)SIMIX_process_get_jprocess(process->simdata->s_process); + return (jobject)(native_to_java_process(process)); } @@ -260,7 +269,7 @@ Java_simgrid_msg_Msg_processSelf(JNIEnv* env, jclass cls) { return NULL; } - jprocess = SIMIX_process_get_jprocess(process->simdata->s_process); + jprocess = native_to_java_process(process); if(!jprocess) jxbt_throw_native(env, xbt_strdup("SIMIX_process_get_jprocess() failed")); @@ -583,7 +592,7 @@ Java_simgrid_msg_Msg_taskGetSender(JNIEnv* env , jclass cls , jobject jtask) { } process = MSG_task_get_sender(task); - return SIMIX_process_get_jprocess(process->simdata->s_process); + return (jobject)native_to_java_process(process); } JNIEXPORT jobject JNICALL @@ -600,7 +609,7 @@ Java_simgrid_msg_Msg_parallelTaskGetSender(JNIEnv* env , jclass cls , jobject jt process = MSG_task_get_sender(task); - return SIMIX_process_get_jprocess(process->simdata->s_process); + return (jobject)native_to_java_process(process); } JNIEXPORT jobject JNICALL @@ -1099,7 +1108,7 @@ Java_simgrid_msg_Msg_processExit(JNIEnv* env, jclass cls, jobject jprocess) { return; } - jcontext_exit(process->simdata->s_process->simdata->context,0,get_current_thread_env()); + xbt_context_stop(0); } JNIEXPORT void JNICALL @@ -1160,4 +1169,20 @@ Java_simgrid_msg_Msg_allHosts(JNIEnv * env, jclass cls_arg) { return jtable; } + +JNIEXPORT void JNICALL +Java_simgrid_msg_Msg_selectContextFactory(JNIEnv * env, jclass class,jstring jname) +{ + int rv; + + /* get the C string from the java string*/ + const char* name = (*env)->GetStringUTFChars(env, jname, 0); + + rv = xbt_context_select_factory(name); + + (*env)->ReleaseStringUTFChars(env, jname, name); + + if(rv) + jxbt_throw_native(env, xbt_strdup("xbt_select_context_factory() failed")); +} diff --git a/src/java/jmsg.h b/src/java/jmsg.h index d38fa2cd6e..2dbd5f2d3b 100644 --- a/src/java/jmsg.h +++ b/src/java/jmsg.h @@ -29,6 +29,8 @@ get_current_thread_env(void); JNIEXPORT void JNICALL Java_simgrid_msg_Msg_processCreate(JNIEnv* env,jclass cls,jobject jprocess,jobject jhost); + + /* * Class simgrid_msg_Msg * Method processSuspend @@ -457,4 +459,8 @@ Java_simgrid_msg_Msg_createEnvironment(JNIEnv* env, jclass cls,jstring jplatform JNIEXPORT void JNICALL Java_simgrid_msg_Msg_platformLoad(JNIEnv* env, jclass cls, jobject jplatform); + +JNIEXPORT void JNICALL +Java_simgrid_msg_Msg_selectContextFactory(JNIEnv *, jclass, jstring); + #endif /* !MSG4JAVA_H */ diff --git a/src/java/jmsg_host.c b/src/java/jmsg_host.c index e9b481b138..1e76788f10 100644 --- a/src/java/jmsg_host.c +++ b/src/java/jmsg_host.c @@ -15,8 +15,6 @@ #include "jmsg_host.h" #include "jxbt_utilities.h" -XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg); - jobject jhost_new_instance(JNIEnv* env) { jclass cls = jxbt_get_class(env,"simgrid/msg/Host"); diff --git a/src/java/jmsg_parallel_task.c b/src/java/jmsg_parallel_task.c index 1af0f30bf8..7f9b83448c 100644 --- a/src/java/jmsg_parallel_task.c +++ b/src/java/jmsg_parallel_task.c @@ -15,8 +15,6 @@ #include "jmsg_parallel_task.h" #include "jxbt_utilities.h" -XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg); - jobject jparallel_task_ref(JNIEnv* env, jobject jparallel_task) { jobject newref = (*env)->NewGlobalRef(env,jparallel_task); diff --git a/src/java/jmsg_process.c b/src/java/jmsg_process.c index d8bb153038..286dbd8933 100644 --- a/src/java/jmsg_process.c +++ b/src/java/jmsg_process.c @@ -14,14 +14,7 @@ #include "jmsg.h" #include "jxbt_utilities.h" -#ifndef JAVA_SIMGRID -#define JAVA_SIMGRID -#endif - - -#include "xbt/context_private.h" - -XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg); +#include "xbt/xbt_jcontext.h" jobject @@ -194,7 +187,7 @@ jprocess_schedule(xbt_context_t context) { if(!id) return; - (*env)->CallVoidMethod(env,context->jprocess,id); + (*env)->CallVoidMethod(env,((xbt_jcontext_t)context)->jprocess,id); } @@ -212,6 +205,6 @@ jprocess_unschedule(xbt_context_t context) { if(!id) return; - (*env)->CallVoidMethod(env,context->jprocess,id); + (*env)->CallVoidMethod(env,((xbt_jcontext_t)context)->jprocess,id); } diff --git a/src/java/jmsg_process.h b/src/java/jmsg_process.h index 85bb94335b..7f563fcc99 100644 --- a/src/java/jmsg_process.h +++ b/src/java/jmsg_process.h @@ -15,7 +15,7 @@ #include #include "msg/msg.h" -#include "xbt/context.h" +#include "xbt/xbt_context.h" /** * This function returns a global reference to the java process instance diff --git a/src/java/jxbt_utilities.c b/src/java/jxbt_utilities.c index 6b9b7d1cb3..aa2b5c61ce 100644 --- a/src/java/jxbt_utilities.c +++ b/src/java/jxbt_utilities.c @@ -16,8 +16,6 @@ #include "xbt/str.h" #include "jxbt_utilities.h" -XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(jmsg); - /* *********** */ /* JNI GETTERS */ /* *********** */ diff --git a/src/java/simgrid/msg/ApplicationHandler.java b/src/java/simgrid/msg/ApplicationHandler.java index a5c13c01f2..16bef1d7a6 100644 --- a/src/java/simgrid/msg/ApplicationHandler.java +++ b/src/java/simgrid/msg/ApplicationHandler.java @@ -94,14 +94,12 @@ public final class ApplicationHandler extends DefaultHandler public void createProcess(){ try { - System.out.println("Create process " + function + " on the host " + hostName); Class cls = Class.forName(this.function); simgrid.msg.Process process = (simgrid.msg.Process)cls.newInstance(); process.name = process.getName(); //this.function; process.id = simgrid.msg.Process.nextProcessId++; Host host = Host.getByName(this.hostName); Msg.processCreate(process,host); - Vector args = processFactory.args; int size = args.size(); diff --git a/src/java/simgrid/msg/Msg.java b/src/java/simgrid/msg/Msg.java index 00384e7937..766692695c 100644 --- a/src/java/simgrid/msg/Msg.java +++ b/src/java/simgrid/msg/Msg.java @@ -83,9 +83,15 @@ public final class Msg { */ static { try { - System.loadLibrary("simgrid4java"); + System.loadLibrary("simgrid"); + Msg.selectContextFactory("jcontext_factory"); + } catch(NativeException e) + { + System.err.println(e.toString()); + e.printStackTrace(); + System.exit(1); } catch(UnsatisfiedLinkError e){ - System.err.println("Cannot load simgrid4java library : "); + System.err.println("Cannot load simgrid library : "); e.printStackTrace(); System.err.println("Please check your LD_LIBRARY_PATH, "+ "or copy the library to the current directory"); @@ -93,6 +99,9 @@ public final class Msg { } } + final static native + void selectContextFactory(String name) throws NativeException; + /****************************************************************** * The natively implemented methods connected to the MSG Process * ******************************************************************/ diff --git a/src/msg/global.c b/src/msg/global.c index 7109a43981..343608730e 100644 --- a/src/msg/global.c +++ b/src/msg/global.c @@ -43,7 +43,7 @@ void MSG_global_init_args(int *argc, char **argv) */ void MSG_global_init(int *argc, char **argv) { - xbt_getpid = &MSG_process_self_PID; + xbt_getpid = MSG_process_self_PID; if (!msg_global) { SIMIX_global_init(argc, argv); diff --git a/src/msg/private.h b/src/msg/private.h index bdaea3c0c3..42c5d7596d 100644 --- a/src/msg/private.h +++ b/src/msg/private.h @@ -18,7 +18,7 @@ #include "xbt/dynar.h" #include "xbt/swag.h" #include "xbt/dict.h" -#include "xbt/context.h" +#include "xbt/xbt_context.h" #include "xbt/config.h" /**************** datatypes **********************************/ diff --git a/src/simix/private.h b/src/simix/private.h index 8a31f69d8d..ccc29de3f6 100644 --- a/src/simix/private.h +++ b/src/simix/private.h @@ -15,7 +15,7 @@ #include "xbt/fifo.h" #include "xbt/swag.h" #include "xbt/dict.h" -#include "xbt/context.h" +#include "xbt/xbt_context.h" #include "xbt/config.h" #include "xbt/function_types.h" diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index 610b85cc16..548c9c6aa2 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -135,23 +135,24 @@ void SIMIX_jprocess_create(const char *name, smx_host_t host, simdata->argc = 0; simdata->argv = NULL; - simdata->context = xbt_context_new(name,NULL, NULL, NULL, + + simdata->context = xbt_context_new(name,NULL, NULL, jprocess, simix_global-> cleanup_process_function, process, /* argc/argv */ 0, NULL); - + /* Process structure */ process->name = xbt_strdup(name); process->simdata = simdata; process->data = data; - SIMIX_process_set_jprocess(process, jprocess); - SIMIX_process_set_jenv(process, jenv); xbt_swag_insert(process, host->simdata->process_list); /* fix current_process, about which xbt_context_start mocks around */ self = simix_global->current_process; + xbt_context_start(process->simdata->context); + simix_global->current_process = self; xbt_swag_insert(process, simix_global->process_list); @@ -388,25 +389,3 @@ int SIMIX_process_is_suspended(smx_process_t process) } -/* Helper functions for jMSG: manipulate the context data without breaking the module separation */ -#include "xbt/context.h" /* to pass java objects from MSG to the context */ - -void SIMIX_process_set_jprocess(smx_process_t process, void *jp) -{ - xbt_context_set_jprocess(process->simdata->context, jp); -} - -void *SIMIX_process_get_jprocess(smx_process_t process) -{ - return xbt_context_get_jprocess(process->simdata->context); -} - -void SIMIX_process_set_jenv(smx_process_t process, void *je) -{ - xbt_context_set_jenv(process->simdata->context, je); -} - -void *SIMIX_process_get_jenv(smx_process_t process) -{ - return xbt_context_get_jenv(process->simdata->context); -} diff --git a/src/surf/network.c b/src/surf/network.c index c63e89d447..a754926874 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -174,7 +174,7 @@ static void parse_route_set_route(void) } } -static void add_loopback() +static void add_loopback(void) { int i; /* Adding loopback if needed */ @@ -191,13 +191,14 @@ static void add_loopback() } } -static void add_route() +static void add_route(void) { xbt_ex_t e; int nb_link = 0; unsigned int cpt = 0; int link_list_capacity = 0; link_CM02_t *link_list = NULL; + char* link; if (routing_table == NULL) create_routing_table(); @@ -207,7 +208,7 @@ static void add_route() src_id = atoi(xbt_dynar_get_as(keys, 0, char*)); dst_id = atoi(xbt_dynar_get_as(keys, 1, char*)); - char* link = NULL; + link = NULL; xbt_dynar_foreach (links, cpt, link) { TRY { link_list[nb_link++] = xbt_dict_get(link_set, link); @@ -228,15 +229,15 @@ static void count_hosts(void) static void define_callbacks(const char *file) { /* Figuring out the network links */ - surfxml_add_callback(STag_surfxml_host_cb_list, &count_hosts); - surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init); - surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties); - surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints); - surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem); - surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route); - surfxml_add_callback(STag_surfxml_platform_cb_list, &init_route_table); - surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_route); - surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_loopback); + surfxml_add_callback(STag_surfxml_host_cb_list, count_hosts); + surfxml_add_callback(STag_surfxml_link_cb_list, parse_link_init); + surfxml_add_callback(STag_surfxml_prop_cb_list, parse_properties); + surfxml_add_callback(STag_surfxml_route_cb_list, parse_route_set_endpoints); + surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, parse_route_elem); + surfxml_add_callback(ETag_surfxml_route_cb_list, parse_route_set_route); + surfxml_add_callback(STag_surfxml_platform_cb_list, init_route_table); + surfxml_add_callback(ETag_surfxml_platform_cb_list, add_route); + surfxml_add_callback(ETag_surfxml_platform_cb_list, add_loopback); } static void *name_service(const char *name) diff --git a/src/surf/surf.c b/src/surf/surf.c index 637ebf2b5e..84ccf39437 100644 --- a/src/surf/surf.c +++ b/src/surf/surf.c @@ -379,7 +379,11 @@ FILE *surf_fopen(const char *name, const char *mode) path_name_len = strlen(path) + strlen(name) + 1; /* plus '/' */ path_name = xbt_realloc(path_name, path_name_len + 1); } + #ifdef WIN32 + sprintf(path_name, "%s\\%s", path, name); + #else sprintf(path_name, "%s/%s", path, name); + #endif file = fopen(path_name, mode); if (file) return file; diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 49fd6ac65e..b0803d57a9 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -49,7 +49,7 @@ static xbt_dynar_t surf_file_to_parse_stack = NULL; static XBT_INLINE void surfxml_call_cb_functions(xbt_dynar_t); YY_BUFFER_STATE surf_input_buffer; -FILE *surf_file_to_parse; +FILE *surf_file_to_parse = NULL; void make_route_table(void) { @@ -359,6 +359,6 @@ void parse_route_elem(void) void parse_platform_file(const char* file) { surf_parse_open(file); - xbt_assert1((!surf_parse()), "Parse error in %s", file); + xbt_assert1((!(*surf_parse)()), "Parse error in %s", file); surf_parse_close(); } diff --git a/src/surf/workstation_KCCFLN05.c b/src/surf/workstation_KCCFLN05.c index 573223233c..f64ae9337d 100644 --- a/src/surf/workstation_KCCFLN05.c +++ b/src/surf/workstation_KCCFLN05.c @@ -1165,7 +1165,7 @@ static void parse_route_set_route(void) } } -static void add_loopback() +static void add_loopback(void) { int i; /* Adding loopback if needed */ @@ -1183,13 +1183,14 @@ static void add_loopback() } } -static void add_route() +static void add_route(void) { xbt_ex_t e; int nb_link = 0; unsigned int cpt = 0; int link_list_capacity = 0; link_KCCFLN05_t *link_list = NULL; + char* link; if (routing_table == NULL) create_routing_table(); @@ -1203,7 +1204,7 @@ static void add_route() impact_on_src_with_other_recv = atof(xbt_dynar_get_as(keys, 4, char*)); impact_on_dst_with_other_send = atof(xbt_dynar_get_as(keys, 5, char*)); - char* link = NULL; + link = NULL; xbt_dynar_foreach (links, cpt, link) { TRY { link_list[nb_link++] = xbt_dict_get(link_set, link); @@ -1224,16 +1225,16 @@ static void define_callbacks(const char *file) /* Adding callback functions */ surf_parse_reset_parser(); - surfxml_add_callback(STag_surfxml_host_cb_list, &parse_cpu_init); - surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties); - surfxml_add_callback(STag_surfxml_router_cb_list, &parse_routers); - surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init); - surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints); - surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem); - surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route); - surfxml_add_callback(STag_surfxml_platform_cb_list, &init_route_table); - surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_route); - surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_loopback); + surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_init); + surfxml_add_callback(STag_surfxml_prop_cb_list, parse_properties); + surfxml_add_callback(STag_surfxml_router_cb_list, parse_routers); + surfxml_add_callback(STag_surfxml_link_cb_list, parse_link_init); + surfxml_add_callback(STag_surfxml_route_cb_list, parse_route_set_endpoints); + surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, parse_route_elem); + surfxml_add_callback(ETag_surfxml_route_cb_list, parse_route_set_route); + surfxml_add_callback(STag_surfxml_platform_cb_list, init_route_table); + surfxml_add_callback(ETag_surfxml_platform_cb_list, add_route); + surfxml_add_callback(ETag_surfxml_platform_cb_list, add_loopback); } /**************************************/ diff --git a/src/surf/workstation_ptask_L07.c b/src/surf/workstation_ptask_L07.c index 2eb7dcb6f1..ca617a90c6 100644 --- a/src/surf/workstation_ptask_L07.c +++ b/src/surf/workstation_ptask_L07.c @@ -898,13 +898,14 @@ static void add_loopback(void) } } -static void add_route() +static void add_route(void) { xbt_ex_t e; int nb_link = 0; unsigned int cpt = 0; int link_list_capacity = 0; link_L07_t *link_list = NULL; + char* link; if (routing_table == NULL) create_routing_table(); @@ -914,7 +915,7 @@ static void add_route() link_list_capacity = xbt_dynar_length(links); link_list = xbt_new(link_L07_t, link_list_capacity); - char* link = NULL; + link = NULL; xbt_dynar_foreach (links, cpt, link) { TRY { link_list[nb_link++] = xbt_dict_get(link_set, link); @@ -930,15 +931,15 @@ static void define_callbacks(const char *file) { /* Adding callback functions */ surf_parse_reset_parser(); - surfxml_add_callback(STag_surfxml_host_cb_list, &parse_cpu_init); - surfxml_add_callback(STag_surfxml_prop_cb_list, &parse_properties); - surfxml_add_callback(STag_surfxml_link_cb_list, &parse_link_init); - surfxml_add_callback(STag_surfxml_route_cb_list, &parse_route_set_endpoints); - surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem); - surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route); - surfxml_add_callback(STag_surfxml_platform_cb_list, &init_route_table); - surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_route); - surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_loopback); + surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_init); + surfxml_add_callback(STag_surfxml_prop_cb_list, parse_properties); + surfxml_add_callback(STag_surfxml_link_cb_list, parse_link_init); + surfxml_add_callback(STag_surfxml_route_cb_list, parse_route_set_endpoints); + surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, parse_route_elem); + surfxml_add_callback(ETag_surfxml_route_cb_list, parse_route_set_route); + surfxml_add_callback(STag_surfxml_platform_cb_list, init_route_table); + surfxml_add_callback(ETag_surfxml_platform_cb_list, add_route); + surfxml_add_callback(ETag_surfxml_platform_cb_list, add_loopback); } /**************************************/ diff --git a/src/xbt/xbt_main.c b/src/xbt/xbt_main.c index e1410b334e..6023ad04c7 100644 --- a/src/xbt/xbt_main.c +++ b/src/xbt/xbt_main.c @@ -37,7 +37,7 @@ xbt_init(int *argc, char **argv) { xbt_log_init(argc,argv); xbt_os_thread_mod_init(); - xbt_context_init(); + xbt_context_mod_init(); } /** @brief Finalize the xbt mechanisms. */ @@ -47,7 +47,7 @@ xbt_exit(){ if (xbt_initialized == 0) { xbt_fifo_exit(); xbt_dict_exit(); - xbt_context_exit(); + xbt_context_mod_exit(); xbt_os_thread_mod_exit(); xbt_log_exit(); } diff --git a/src/xbt/xbt_str.c b/src/xbt/xbt_str.c index 6167b1f548..edd062b38f 100644 --- a/src/xbt/xbt_str.c +++ b/src/xbt/xbt_str.c @@ -454,7 +454,7 @@ char *xbt_str_join(xbt_dynar_t dyn, const char*sep) { res = xbt_malloc(len); p=res; xbt_dynar_foreach(dyn,cpt,cursor) { - if (cpt