From: mquinson Date: Mon, 2 Jul 2007 16:31:29 +0000 (+0000) Subject: Convert GRAS pid from long int to int; setup a virtualization layer in XBT to choose... X-Git-Tag: v3.3~1717 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/037955e458fb05c8ad1a1bdc3509bac0664f87a2 Convert GRAS pid from long int to int; setup a virtualization layer in XBT to choose between GRAS and MSG when searching to compute the pid, for example in the logs git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3643 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/configure b/configure index 305bd02c68..77a451377b 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 1.159 . +# From configure.ac Revision: 1.161 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for simgrid 3.3-cvs. # @@ -27603,6 +27603,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27612,6 +27614,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27621,6 +27625,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27630,6 +27636,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27639,6 +27647,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27648,6 +27658,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27657,6 +27669,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27666,6 +27680,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27675,6 +27691,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27684,6 +27702,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27693,6 +27713,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27702,6 +27724,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27711,6 +27735,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27720,6 +27746,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27729,6 +27757,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27738,6 +27768,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27747,6 +27779,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27756,6 +27790,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27765,6 +27801,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27774,6 +27812,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27783,6 +27823,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27792,6 +27834,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27801,6 +27845,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done @@ -27810,6 +27856,8 @@ done \ examples/msg/run_msg_test \ examples/simdag/test_simdag \ + examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \ + examples/amok/saturate/test_sg examples/amok/saturate/test_rl \ ; do \ test -e $file && chmod +x $file; \ done diff --git a/examples/gras/all2all/Makefile.in b/examples/gras/all2all/Makefile.in index 89e2a6ce11..c772f57184 100644 --- a/examples/gras/all2all/Makefile.in +++ b/examples/gras/all2all/Makefile.in @@ -603,9 +603,9 @@ uninstall-am: uninstall-info-am mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-info-am -@GRAS_ARCH_32_BITS_TRUE@test-sg: force +@GRAS_ARCH_32_BITS_TRUE@test-sg: @GRAS_ARCH_32_BITS_TRUE@ $(TESTS_ENVIRONMENT) test_sg_32 -@GRAS_ARCH_32_BITS_FALSE@test-sg: force +@GRAS_ARCH_32_BITS_FALSE@test-sg: @GRAS_ARCH_32_BITS_FALSE@ $(TESTS_ENVIRONMENT) test_sg_64 test-rl: force @@ -613,7 +613,7 @@ test-rl: force force: -.PHONY: test_sg_32 test_SG_64 test_rl force +.PHONY: test_sg_32 test_SG_64 test_rl $(foreach proc, $(PROCESSES), _$(NAME)_$(proc).c) _$(NAME)_simulator.c: $(srcdir)/$(NAME).xml $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ [ x@EXEEXT@ = x ] || exenv=wine; $$exenv $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ $(NAME) $(srcdir)/$(NAME).xml diff --git a/examples/gras/chrono/Makefile.in b/examples/gras/chrono/Makefile.in index 17e1506428..a51d2f669f 100644 --- a/examples/gras/chrono/Makefile.in +++ b/examples/gras/chrono/Makefile.in @@ -591,9 +591,9 @@ uninstall-am: uninstall-info-am mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-info-am -@GRAS_ARCH_32_BITS_TRUE@test-sg: force +@GRAS_ARCH_32_BITS_TRUE@test-sg: @GRAS_ARCH_32_BITS_TRUE@ $(TESTS_ENVIRONMENT) test_sg_32 -@GRAS_ARCH_32_BITS_FALSE@test-sg: force +@GRAS_ARCH_32_BITS_FALSE@test-sg: @GRAS_ARCH_32_BITS_FALSE@ $(TESTS_ENVIRONMENT) test_sg_64 test-rl: force @@ -601,7 +601,7 @@ test-rl: force force: -.PHONY: test_sg_32 test_SG_64 test_rl force +.PHONY: test_sg_32 test_SG_64 test_rl $(foreach proc, $(PROCESSES), _$(NAME)_$(proc).c) _$(NAME)_simulator.c: $(srcdir)/$(NAME).xml $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ [ x@EXEEXT@ = x ] || exenv=wine; $$exenv $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ $(NAME) $(srcdir)/$(NAME).xml diff --git a/examples/gras/mmrpc/Makefile.in b/examples/gras/mmrpc/Makefile.in index b60e582618..c6a00fe872 100644 --- a/examples/gras/mmrpc/Makefile.in +++ b/examples/gras/mmrpc/Makefile.in @@ -606,9 +606,9 @@ uninstall-am: uninstall-info-am mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-info-am -@GRAS_ARCH_32_BITS_TRUE@test-sg: force +@GRAS_ARCH_32_BITS_TRUE@test-sg: @GRAS_ARCH_32_BITS_TRUE@ $(TESTS_ENVIRONMENT) test_sg_32 -@GRAS_ARCH_32_BITS_FALSE@test-sg: force +@GRAS_ARCH_32_BITS_FALSE@test-sg: @GRAS_ARCH_32_BITS_FALSE@ $(TESTS_ENVIRONMENT) test_sg_64 test-rl: force @@ -616,7 +616,7 @@ test-rl: force force: -.PHONY: test_sg_32 test_SG_64 test_rl force +.PHONY: test_sg_32 test_SG_64 test_rl $(foreach proc, $(PROCESSES), _$(NAME)_$(proc).c) _$(NAME)_simulator.c: $(srcdir)/$(NAME).xml $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ [ x@EXEEXT@ = x ] || exenv=wine; $$exenv $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ $(NAME) $(srcdir)/$(NAME).xml diff --git a/examples/gras/mutual_exclusion/simple_token/Makefile.in b/examples/gras/mutual_exclusion/simple_token/Makefile.in index 746bcb0910..845e4a3d97 100644 --- a/examples/gras/mutual_exclusion/simple_token/Makefile.in +++ b/examples/gras/mutual_exclusion/simple_token/Makefile.in @@ -594,9 +594,9 @@ uninstall-am: uninstall-info-am mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-info-am -@GRAS_ARCH_32_BITS_TRUE@test-sg: force +@GRAS_ARCH_32_BITS_TRUE@test-sg: @GRAS_ARCH_32_BITS_TRUE@ $(TESTS_ENVIRONMENT) test_sg_32 -@GRAS_ARCH_32_BITS_FALSE@test-sg: force +@GRAS_ARCH_32_BITS_FALSE@test-sg: @GRAS_ARCH_32_BITS_FALSE@ $(TESTS_ENVIRONMENT) test_sg_64 test-rl: force @@ -604,7 +604,7 @@ test-rl: force force: -.PHONY: test_sg_32 test_SG_64 test_rl force +.PHONY: test_sg_32 test_SG_64 test_rl $(foreach proc, $(PROCESSES), _$(NAME)_$(proc).c) _$(NAME)_simulator.c: $(srcdir)/$(NAME).xml $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ [ x@EXEEXT@ = x ] || exenv=wine; $$exenv $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ $(NAME) $(srcdir)/$(NAME).xml diff --git a/examples/gras/mutual_exclusion/simple_token/simple_token.c b/examples/gras/mutual_exclusion/simple_token/simple_token.c index 7931730852..5f0db6902a 100644 --- a/examples/gras/mutual_exclusion/simple_token/simple_token.c +++ b/examples/gras/mutual_exclusion/simple_token/simple_token.c @@ -129,7 +129,7 @@ int node (int argc,char *argv[]) { globals->tosuccessor = NULL; if (!gras_os_getpid() % 100) - INFO4("Launch node %ld (successor on %s:%d; listening on %d)", + INFO4("Launch node %d (successor on %s:%d; listening on %d)", gras_os_getpid(), host,peerport, myport); /* 4. Create my master socket for listening */ diff --git a/examples/gras/ping/Makefile.in b/examples/gras/ping/Makefile.in index 41131b5baf..510e9e7045 100644 --- a/examples/gras/ping/Makefile.in +++ b/examples/gras/ping/Makefile.in @@ -606,9 +606,9 @@ uninstall-am: uninstall-info-am mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-info-am -@GRAS_ARCH_32_BITS_TRUE@test-sg: force +@GRAS_ARCH_32_BITS_TRUE@test-sg: @GRAS_ARCH_32_BITS_TRUE@ $(TESTS_ENVIRONMENT) test_sg_32 -@GRAS_ARCH_32_BITS_FALSE@test-sg: force +@GRAS_ARCH_32_BITS_FALSE@test-sg: @GRAS_ARCH_32_BITS_FALSE@ $(TESTS_ENVIRONMENT) test_sg_64 test-rl: force @@ -616,7 +616,7 @@ test-rl: force force: -.PHONY: test_sg_32 test_SG_64 test_rl force +.PHONY: test_sg_32 test_SG_64 test_rl $(foreach proc, $(PROCESSES), _$(NAME)_$(proc).c) _$(NAME)_simulator.c: $(srcdir)/$(NAME).xml $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ [ x@EXEEXT@ = x ] || exenv=wine; $$exenv $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ $(NAME) $(srcdir)/$(NAME).xml diff --git a/examples/gras/pmm/Makefile.in b/examples/gras/pmm/Makefile.in index 252e238142..c3962860c4 100644 --- a/examples/gras/pmm/Makefile.in +++ b/examples/gras/pmm/Makefile.in @@ -600,9 +600,9 @@ uninstall-am: uninstall-info-am mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-info-am -@GRAS_ARCH_32_BITS_TRUE@test-sg: force +@GRAS_ARCH_32_BITS_TRUE@test-sg: @GRAS_ARCH_32_BITS_TRUE@ $(TESTS_ENVIRONMENT) test_sg_32 -@GRAS_ARCH_32_BITS_FALSE@test-sg: force +@GRAS_ARCH_32_BITS_FALSE@test-sg: @GRAS_ARCH_32_BITS_FALSE@ $(TESTS_ENVIRONMENT) test_sg_64 test-rl: force @@ -610,7 +610,7 @@ test-rl: force force: -.PHONY: test_sg_32 test_SG_64 test_rl force +.PHONY: test_sg_32 test_SG_64 test_rl $(foreach proc, $(PROCESSES), _$(NAME)_$(proc).c) _$(NAME)_simulator.c: $(srcdir)/$(NAME).xml $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ [ x@EXEEXT@ = x ] || exenv=wine; $$exenv $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ $(NAME) $(srcdir)/$(NAME).xml diff --git a/examples/gras/rpc/Makefile.in b/examples/gras/rpc/Makefile.in index 746f1b530e..9464f7b9ae 100644 --- a/examples/gras/rpc/Makefile.in +++ b/examples/gras/rpc/Makefile.in @@ -609,9 +609,9 @@ uninstall-am: uninstall-info-am mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-info-am -@GRAS_ARCH_32_BITS_TRUE@test-sg: force +@GRAS_ARCH_32_BITS_TRUE@test-sg: @GRAS_ARCH_32_BITS_TRUE@ $(TESTS_ENVIRONMENT) test_sg_32 -@GRAS_ARCH_32_BITS_FALSE@test-sg: force +@GRAS_ARCH_32_BITS_FALSE@test-sg: @GRAS_ARCH_32_BITS_FALSE@ $(TESTS_ENVIRONMENT) test_sg_64 test-rl: force @@ -619,7 +619,7 @@ test-rl: force force: -.PHONY: test_sg_32 test_SG_64 test_rl force +.PHONY: test_sg_32 test_SG_64 test_rl $(foreach proc, $(PROCESSES), _$(NAME)_$(proc).c) _$(NAME)_simulator.c: $(srcdir)/$(NAME).xml $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ [ x@EXEEXT@ = x ] || exenv=wine; $$exenv $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ $(NAME) $(srcdir)/$(NAME).xml diff --git a/examples/gras/timer/Makefile.in b/examples/gras/timer/Makefile.in index d75d546008..602a3eff2f 100644 --- a/examples/gras/timer/Makefile.in +++ b/examples/gras/timer/Makefile.in @@ -589,9 +589,9 @@ uninstall-am: uninstall-info-am mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-info-am -@GRAS_ARCH_32_BITS_TRUE@test-sg: force +@GRAS_ARCH_32_BITS_TRUE@test-sg: @GRAS_ARCH_32_BITS_TRUE@ $(TESTS_ENVIRONMENT) test_sg_32 -@GRAS_ARCH_32_BITS_FALSE@test-sg: force +@GRAS_ARCH_32_BITS_FALSE@test-sg: @GRAS_ARCH_32_BITS_FALSE@ $(TESTS_ENVIRONMENT) test_sg_64 test-rl: force @@ -599,7 +599,7 @@ test-rl: force force: -.PHONY: test_sg_32 test_SG_64 test_rl force +.PHONY: test_sg_32 test_SG_64 test_rl $(foreach proc, $(PROCESSES), _$(NAME)_$(proc).c) _$(NAME)_simulator.c: $(srcdir)/$(NAME).xml $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ [ x@EXEEXT@ = x ] || exenv=wine; $$exenv $(top_builddir)/tools/gras/gras_stub_generator@EXEEXT@ $(NAME) $(srcdir)/$(NAME).xml diff --git a/include/Makefile.am b/include/Makefile.am index 0aabfe1037..bbc189369f 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -2,6 +2,7 @@ include_HEADERS = gras.h xbt.h nobase_include_HEADERS = \ xbt/misc.h \ xbt/sysdep.h \ + xbt/virtu.h \ xbt/str.h \ xbt/function_types.h \ xbt/asserts.h xbt/ex.h \ diff --git a/include/Makefile.in b/include/Makefile.in index d301b2b21b..de1d575063 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -221,6 +221,7 @@ include_HEADERS = gras.h xbt.h nobase_include_HEADERS = \ xbt/misc.h \ xbt/sysdep.h \ + xbt/virtu.h \ xbt/str.h \ xbt/function_types.h \ xbt/asserts.h xbt/ex.h \ diff --git a/include/gras/virtu.h b/include/gras/virtu.h index 81d5bb0f2a..78fe16f105 100644 --- a/include/gras/virtu.h +++ b/include/gras/virtu.h @@ -49,7 +49,7 @@ XBT_PUBLIC(int) gras_os_myport(void); * Returns the process ID of the current process. (This is often used by routines that generate unique temporary file names.) */ -XBT_PUBLIC(long int) gras_os_getpid(void); +XBT_PUBLIC(int) gras_os_getpid(void); /** @} */ SG_END_DECL() diff --git a/include/xbt/ex.h b/include/xbt/ex.h index 9684a8cffe..3d7228352b 100644 --- a/include/xbt/ex.h +++ b/include/xbt/ex.h @@ -14,8 +14,9 @@ #ifndef __XBT_EX_H__ #define __XBT_EX_H__ -#include -#include +#include "xbt/sysdep.h" +#include "xbt/misc.h" +#include "xbt/virtu.h" /* do not include execinfo.h directly since it's not always available. Instead, copy the parts we need (and fake when it's not there) */ @@ -29,17 +30,16 @@ XBT_PUBLIC(int) backtrace (void **__array, int __size); # include #include -XBT_PUBLIC(int) gras_os_getpid(void); # define MAYDAY_SAVE(m) printf("%d %s:%d save %p\n", \ - gras_os_getpid(),__FILE__,__LINE__, \ + (*xbt_getpid)(),__FILE__,__LINE__, \ (m)->jb \ ), # define MAYDAY_RESTORE(m) printf("%d %s:%d restore %p\n", \ - gras_os_getpid(),__FILE__,__LINE__, \ + (*xbt_getpid)(),__FILE__,__LINE__, \ (m)->jb \ ), # define MAYDAY_CATCH(e) printf("%d %s:%d Catched '%s'\n", \ - gras_os_getpid(),__FILE__,__LINE__, \ + (*xbt_getpid)(),__FILE__,__LINE__, \ e.msg \ ), #else @@ -228,9 +228,6 @@ typedef struct { __ex_mctx_struct } __ex_mctx_t; * @{ */ -/* we need this symbol here, even if it breaks a bit the module separation */ -XBT_PUBLIC(long) int gras_os_getpid(void); - /** @brief different kind of errors */ typedef enum { unknown_error=0, /**< unknown error */ @@ -257,7 +254,7 @@ typedef struct { char *host; /**< NULL locally thrown exceptions; full hostname if remote ones */ /* FIXME: host should be hostname:port[#thread] */ char *procname; /**< Name of the process who thrown this */ - long int pid; /**< PID of the process who thrown this */ + int pid; /**< PID of the process who thrown this */ char *file; /**< Thrown point */ int line; /**< Thrown point */ char *func; /**< Thrown point */ @@ -411,7 +408,7 @@ extern void __xbt_ex_terminate_default(xbt_ex_t *e); __xbt_ex_ctx()->ctx_ex.remote = 0; \ __xbt_ex_ctx()->ctx_ex.host = (char*)NULL; \ __xbt_ex_ctx()->ctx_ex.procname = (char*)xbt_procname(); \ - __xbt_ex_ctx()->ctx_ex.pid = gras_os_getpid(); \ + __xbt_ex_ctx()->ctx_ex.pid = (*xbt_getpid)(); \ __xbt_ex_ctx()->ctx_ex.file = (char*)__FILE__; \ __xbt_ex_ctx()->ctx_ex.line = __LINE__; \ __xbt_ex_ctx()->ctx_ex.func = (char*)_XBT_FUNCTION; \ diff --git a/include/xbt/function_types.h b/include/xbt/function_types.h index 7e476a7463..0994fef1aa 100644 --- a/include/xbt/function_types.h +++ b/include/xbt/function_types.h @@ -28,4 +28,4 @@ SG_BEGIN_DECL() SG_END_DECL() -#endif /* XBT_MISC_H */ +#endif /* XBT_FUNCTION_TYPE_H */ diff --git a/include/xbt/virtu.h b/include/xbt/virtu.h new file mode 100644 index 0000000000..e5e12c4b4d --- /dev/null +++ b/include/xbt/virtu.h @@ -0,0 +1,26 @@ +/* $Id$ */ + +/* virtu - virtualization layer for XBT to choose between GRAS and MSG implementation */ + +/* Copyright (c) 2007 Martin Quinson */ +/* 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 __XBT_VIRTU_H__ +#define __XBT_VIRTU_H__ + +#include "xbt/misc.h" +#include "xbt/sysdep.h" +#include "xbt/function_types.h" + +SG_BEGIN_DECL() + + /* Get the PID of the current process */ + XBT_PUBLIC_DATA(int_f_void_t*) xbt_getpid; + +SG_END_DECL() + +#endif /* __XBT_VIRTU_H__ */ + diff --git a/libtool b/libtool index ce9db561bc..7cfbd4f086 100755 --- a/libtool +++ b/libtool @@ -325,7 +325,7 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM link_all_deplibs=no # Compile-time system search path for libraries -sys_lib_search_path_spec=" /usr/lib/gcc/i486-linux-gnu/4.1.2/ /usr/lib/gcc/i486-linux-gnu/4.1.2/ /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../i486-linux-gnu/lib/i486-linux-gnu/4.1.2/ /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../i486-linux-gnu/lib/ /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../i486-linux-gnu/4.1.2/ /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../ /lib/i486-linux-gnu/4.1.2/ /lib/ /usr/lib/i486-linux-gnu/4.1.2/ /usr/lib/" +sys_lib_search_path_spec=" /usr/lib/gcc/i486-linux-gnu/4.1.3/ /usr/lib/gcc/i486-linux-gnu/4.1.3/ /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../i486-linux-gnu/lib/i486-linux-gnu/4.1.3/ /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../i486-linux-gnu/lib/ /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../i486-linux-gnu/4.1.3/ /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../ /lib/i486-linux-gnu/4.1.3/ /lib/ /usr/lib/i486-linux-gnu/4.1.3/ /usr/lib/" # Run-time system search path for libraries sys_lib_dlsearch_path_spec="/lib /usr/lib /lib/i486-linux-gnu /usr/lib/i486-linux-gnu " @@ -7405,11 +7405,11 @@ striplib="strip --strip-unneeded" # Dependencies to place before the objects being linked to create a # shared library. -predep_objects="/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/4.1.2/crtbeginS.o" +predep_objects="/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/4.1.3/crtbeginS.o" # Dependencies to place after the objects being linked to create a # shared library. -postdep_objects="/usr/lib/gcc/i486-linux-gnu/4.1.2/crtendS.o /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crtn.o" +postdep_objects="/usr/lib/gcc/i486-linux-gnu/4.1.3/crtendS.o /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../lib/crtn.o" # Dependencies to place before the objects being linked to create a # shared library. @@ -7421,7 +7421,7 @@ postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s" # The library search path used internally by the compiler when linking # a shared library. -compiler_lib_search_path="-L/usr/lib/gcc/i486-linux-gnu/4.1.2 -L/usr/lib/gcc/i486-linux-gnu/4.1.2 -L/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib -L/lib/../lib -L/usr/lib/../lib" +compiler_lib_search_path="-L/usr/lib/gcc/i486-linux-gnu/4.1.3 -L/usr/lib/gcc/i486-linux-gnu/4.1.3 -L/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib" # Method to check whether dependent libraries are shared objects. deplibs_check_method="pass_all" @@ -7501,7 +7501,7 @@ variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COM link_all_deplibs=no # Compile-time system search path for libraries -sys_lib_search_path_spec=" /usr/lib/gcc/i486-linux-gnu/4.1.2/ /usr/lib/gcc/i486-linux-gnu/4.1.2/ /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../i486-linux-gnu/lib/i486-linux-gnu/4.1.2/ /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../i486-linux-gnu/lib/ /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../i486-linux-gnu/4.1.2/ /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../ /lib/i486-linux-gnu/4.1.2/ /lib/ /usr/lib/i486-linux-gnu/4.1.2/ /usr/lib/" +sys_lib_search_path_spec=" /usr/lib/gcc/i486-linux-gnu/4.1.3/ /usr/lib/gcc/i486-linux-gnu/4.1.3/ /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../i486-linux-gnu/lib/i486-linux-gnu/4.1.3/ /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../i486-linux-gnu/lib/ /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../i486-linux-gnu/4.1.3/ /usr/lib/gcc/i486-linux-gnu/4.1.3/../../../ /lib/i486-linux-gnu/4.1.3/ /lib/ /usr/lib/i486-linux-gnu/4.1.3/ /usr/lib/" # Run-time system search path for libraries sys_lib_dlsearch_path_spec="/lib /usr/lib /lib/i486-linux-gnu /usr/lib/i486-linux-gnu " diff --git a/src/Makefile.am b/src/Makefile.am index e87f858612..2cce60ca00 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -108,6 +108,7 @@ COMMON_SRC=\ xbt/ex.c \ \ xbt_modinter.h gras_modinter.h \ + xbt/xbt_virtu.c \ \ xbt/sysdep.c \ xbt/asserts.c \ @@ -251,6 +252,7 @@ BUILT_SOURCES=../include/surf/surfxml.h surf/surfxml.c \ testall_SOURCES= $(TEST_UNITS) simgrid_units_main.c testall_LDADD=libgras.la TESTS=testall +TESTS_ENVIRONMENT=$(SG_TEST_EXENV) EXTRA_DIST+=$(testall_SOURCES) diff --git a/src/Makefile.in b/src/Makefile.in index 1384c6e1ef..085091d0ca 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -77,15 +77,16 @@ am__installdirs = "$(DESTDIR)$(libdir)" libLTLIBRARIES_INSTALL = $(INSTALL) LTLIBRARIES = $(lib_LTLIBRARIES) libgras_la_LIBADD = -am__objects_1 = snprintf.lo xbt_str.lo ex.lo sysdep.lo asserts.lo \ - log.lo xbt_log_appender_file.lo xbt_log_layout_simple.lo \ - xbt_log_layout_format.lo mallocator.lo dynar.lo dict.lo \ - dict_elm.lo dict_cursor.lo dict_multi.lo heap.lo fifo.lo \ - swag.lo graph.lo set.lo xbt_matrix.lo xbt_peer.lo xbt_main.lo \ - config.lo cunit.lo graphxml_parse.lo gras.lo transport.lo \ - msg.lo rpc.lo timer.lo process.lo gras_module.lo ddt_create.lo \ - ddt_convert.lo ddt_exchange.lo cbps.lo datadesc.lo \ - ddt_parse.lo ddt_parse.yy.lo +am__objects_1 = snprintf.lo xbt_str.lo ex.lo xbt_virtu.lo sysdep.lo \ + asserts.lo log.lo xbt_log_appender_file.lo \ + xbt_log_layout_simple.lo xbt_log_layout_format.lo \ + mallocator.lo dynar.lo dict.lo dict_elm.lo dict_cursor.lo \ + dict_multi.lo heap.lo fifo.lo swag.lo graph.lo set.lo \ + xbt_matrix.lo xbt_peer.lo xbt_main.lo config.lo cunit.lo \ + graphxml_parse.lo gras.lo transport.lo msg.lo rpc.lo timer.lo \ + process.lo gras_module.lo ddt_create.lo ddt_convert.lo \ + ddt_exchange.lo cbps.lo datadesc.lo ddt_parse.lo \ + ddt_parse.yy.lo am__objects_2 = rl_stubs.lo xbt_thread.lo rl_transport.lo \ transport_plugin_file.lo transport_plugin_tcp.lo rl_emul.lo \ rl_process.lo rl_time.lo rl_dns.lo rl_msg.lo @@ -96,8 +97,8 @@ am_libgras_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ libgras_la_OBJECTS = $(am_libgras_la_OBJECTS) libsimgrid_la_LIBADD = am__libsimgrid_la_SOURCES_DIST = xbt/snprintf.c xbt/xbt_str.c xbt/ex.c \ - xbt_modinter.h gras_modinter.h xbt/sysdep.c xbt/asserts.c \ - xbt/log.c xbt/xbt_log_appender_file.c \ + xbt_modinter.h gras_modinter.h xbt/xbt_virtu.c xbt/sysdep.c \ + xbt/asserts.c xbt/log.c xbt/xbt_log_appender_file.c \ xbt/xbt_log_layout_simple.c xbt/xbt_log_layout_format.c \ xbt/mallocator.c xbt/dynar.c xbt/dict.c xbt/dict_elm.c \ xbt/dict_cursor.c xbt/dict_multi.c xbt/heap.c xbt/fifo.c \ @@ -399,20 +400,21 @@ VERSION_INFO = -version-info 2:0:0 # using this trick is ready for a "stable" release (say, in Debian). lib_LTLIBRARIES = libsimgrid.la libgras.la COMMON_SRC = xbt/snprintf.c xbt/xbt_str.c xbt/ex.c xbt_modinter.h \ - gras_modinter.h xbt/sysdep.c xbt/asserts.c xbt/log.c \ - xbt/xbt_log_appender_file.c xbt/xbt_log_layout_simple.c \ - xbt/xbt_log_layout_format.c xbt/mallocator.c xbt/dynar.c \ - xbt/dict.c xbt/dict_elm.c xbt/dict_cursor.c xbt/dict_multi.c \ - xbt/heap.c xbt/fifo.c xbt/swag.c xbt/graph.c xbt/set.c \ - xbt/xbt_matrix.c xbt/xbt_peer.c xbt/xbt_main.c xbt/config.c \ - xbt/cunit.c xbt/graphxml_parse.c gras/gras.c \ - gras/Transport/transport.c gras/Transport/transport_private.h \ - gras/Msg/msg.c gras/Msg/rpc.c gras/Msg/timer.c \ - gras/Msg/msg_interface.h gras/Msg/msg_private.h \ - gras/Virtu/process.c gras/Virtu/gras_module.c \ - gras/DataDesc/ddt_create.c gras/DataDesc/ddt_convert.c \ - gras/DataDesc/ddt_exchange.c gras/DataDesc/cbps.c \ - gras/DataDesc/datadesc.c gras/DataDesc/datadesc_interface.h \ + gras_modinter.h xbt/xbt_virtu.c xbt/sysdep.c xbt/asserts.c \ + xbt/log.c xbt/xbt_log_appender_file.c \ + xbt/xbt_log_layout_simple.c xbt/xbt_log_layout_format.c \ + xbt/mallocator.c xbt/dynar.c xbt/dict.c xbt/dict_elm.c \ + xbt/dict_cursor.c xbt/dict_multi.c xbt/heap.c xbt/fifo.c \ + xbt/swag.c xbt/graph.c xbt/set.c xbt/xbt_matrix.c \ + xbt/xbt_peer.c xbt/xbt_main.c xbt/config.c xbt/cunit.c \ + xbt/graphxml_parse.c gras/gras.c gras/Transport/transport.c \ + gras/Transport/transport_private.h gras/Msg/msg.c \ + gras/Msg/rpc.c gras/Msg/timer.c gras/Msg/msg_interface.h \ + gras/Msg/msg_private.h gras/Virtu/process.c \ + gras/Virtu/gras_module.c gras/DataDesc/ddt_create.c \ + gras/DataDesc/ddt_convert.c gras/DataDesc/ddt_exchange.c \ + gras/DataDesc/cbps.c gras/DataDesc/datadesc.c \ + gras/DataDesc/datadesc_interface.h \ gras/DataDesc/datadesc_private.h gras/DataDesc/ddt_parse.c \ gras/DataDesc/ddt_parse.yy.c gras/DataDesc/ddt_parse.yy.h RL_SRC = \ @@ -486,6 +488,7 @@ AMOK_SRC = \ @GRAMINE_MODE_FALSE@testall_SOURCES = $(TEST_UNITS) simgrid_units_main.c @GRAMINE_MODE_FALSE@testall_LDADD = libgras.la @GRAMINE_MODE_FALSE@TESTS = testall +@GRAMINE_MODE_FALSE@TESTS_ENVIRONMENT = $(SG_TEST_EXENV) ### ### Declare the library content @@ -703,6 +706,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbt_str.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbt_str_unit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbt_thread.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xbt_virtu.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ @@ -746,6 +750,13 @@ ex.lo: xbt/ex.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ex.lo `test -f 'xbt/ex.c' || echo '$(srcdir)/'`xbt/ex.c +xbt_virtu.lo: xbt/xbt_virtu.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xbt_virtu.lo -MD -MP -MF "$(DEPDIR)/xbt_virtu.Tpo" -c -o xbt_virtu.lo `test -f 'xbt/xbt_virtu.c' || echo '$(srcdir)/'`xbt/xbt_virtu.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/xbt_virtu.Tpo" "$(DEPDIR)/xbt_virtu.Plo"; else rm -f "$(DEPDIR)/xbt_virtu.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xbt/xbt_virtu.c' object='xbt_virtu.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xbt_virtu.lo `test -f 'xbt/xbt_virtu.c' || echo '$(srcdir)/'`xbt/xbt_virtu.c + sysdep.lo: xbt/sysdep.c @am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sysdep.lo -MD -MP -MF "$(DEPDIR)/sysdep.Tpo" -c -o sysdep.lo `test -f 'xbt/sysdep.c' || echo '$(srcdir)/'`xbt/sysdep.c; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sysdep.Tpo" "$(DEPDIR)/sysdep.Plo"; else rm -f "$(DEPDIR)/sysdep.Tpo"; exit 1; fi diff --git a/src/gras/Transport/transport_plugin_sg.c b/src/gras/Transport/transport_plugin_sg.c index e7b59a480a..32134a995e 100644 --- a/src/gras/Transport/transport_plugin_sg.c +++ b/src/gras/Transport/transport_plugin_sg.c @@ -145,7 +145,7 @@ void gras_trp_sg_socket_client(gras_trp_plugin_t self, sock->data = data; sock->incoming = 1; - DEBUG5("%s (PID %ld) connects in %s mode to %s:%d", + DEBUG5("%s (PID %d) connects in %s mode to %s:%d", SIMIX_process_get_name(SIMIX_process_self()), gras_os_getpid(), sock->meas?"meas":"regular", sock->peer_name,sock->peer_port); @@ -199,7 +199,7 @@ void gras_trp_sg_socket_server(gras_trp_plugin_t self, sock->data = data; - VERB6("'%s' (%ld) ears on %s:%d%s (%p)", + VERB6("'%s' (%d) ears on %s:%d%s (%p)", SIMIX_process_get_name(SIMIX_process_self()), gras_os_getpid(), host,sock->port,sock->meas? " (mode meas)":"",sock); diff --git a/src/gras/Virtu/rl_process.c b/src/gras/Virtu/rl_process.c index d044831cf4..7219c9a566 100644 --- a/src/gras/Virtu/rl_process.c +++ b/src/gras/Virtu/rl_process.c @@ -29,7 +29,7 @@ const char *xbt_procname(void) { else return ""; } -long int gras_os_getpid(void) { +int gras_os_getpid(void) { #ifdef _WIN32 return (long int) GetCurrentProcess(); #else diff --git a/src/gras/Virtu/sg_process.c b/src/gras/Virtu/sg_process.c index 017d860f09..ff44d661e5 100644 --- a/src/gras/Virtu/sg_process.c +++ b/src/gras/Virtu/sg_process.c @@ -50,7 +50,7 @@ gras_process_init() { trp_pd->cond = SIMIX_cond_init(); trp_pd->active_socket = xbt_fifo_new(); - VERB2("Creating process '%s' (%ld)", + VERB2("Creating process '%s' (%d)", SIMIX_process_get_name(SIMIX_process_self()), gras_os_getpid()); } @@ -75,11 +75,11 @@ gras_process_exit() { xbt_assert0(hd,"Run gras_process_init (ie, gras_init)!!"); - VERB2("GRAS: Finalizing process '%s' (%ld)", + VERB2("GRAS: Finalizing process '%s' (%d)", SIMIX_process_get_name(SIMIX_process_self()),gras_os_getpid()); if (xbt_dynar_length(msg_pd->msg_queue)) - WARN1("process %ld terminated, but some messages are still queued", + WARN1("process %d terminated, but some messages are still queued", gras_os_getpid()); /* if each process has its sockets list, we need to close them when the process finish */ @@ -130,7 +130,7 @@ const char* xbt_procname(void) { return ""; } -long int gras_os_getpid(void) { +int gras_os_getpid(void) { smx_process_t process = SIMIX_process_self(); diff --git a/src/gras/Virtu/virtu_private.h b/src/gras/Virtu/virtu_private.h index 275e2ec2f3..394012c658 100644 --- a/src/gras/Virtu/virtu_private.h +++ b/src/gras/Virtu/virtu_private.h @@ -34,8 +34,8 @@ typedef struct { */ xbt_dynar_t moddata; - long int pid; /* pid of process, only for SG */ - long int ppid; /* ppid of process, only for SG */ + int pid; /* pid of process, only for SG */ + int ppid; /* ppid of process, only for SG */ } gras_procdata_t; gras_procdata_t *gras_procdata_get(void); diff --git a/src/gras/gras.c b/src/gras/gras.c index 5368343600..4ab3eea60d 100644 --- a/src/gras/gras.c +++ b/src/gras/gras.c @@ -9,6 +9,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "xbt/log.h" +#include "xbt/virtu.h" /* set the XBT virtualization to use GRAS */ #include "xbt/module.h" /* xbt_init/exit */ #include "Virtu/virtu_interface.h" /* Module mechanism FIXME: deplace&rename */ @@ -44,7 +45,8 @@ static void gras_sigint_handler(int sig) { void gras_init(int *argc,char **argv) { VERB0("Initialize GRAS"); - + + xbt_getpid = &gras_os_getpid; /* First initialize the XBT */ xbt_init(argc,argv); diff --git a/src/msg/global.c b/src/msg/global.c index a09b97c6a7..9f9fceacfb 100644 --- a/src/msg/global.c +++ b/src/msg/global.c @@ -10,6 +10,7 @@ #include "msg/private.h" #include "xbt/sysdep.h" #include "xbt/log.h" +#include "xbt/virtu.h" #include "xbt/ex.h" /* ex_backtrace_display */ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_kernel, msg, "Logging specific to MSG (kernel)"); @@ -41,6 +42,7 @@ void MSG_global_init_args(int *argc, char **argv) */ void MSG_global_init(int *argc, char **argv) { + xbt_getpid = & MSG_process_self_PID; if (!msg_global) { SIMIX_global_init(argc, argv); diff --git a/src/xbt/ex.c b/src/xbt/ex.c index 075ab2910d..645acbaf0d 100644 --- a/src/xbt/ex.c +++ b/src/xbt/ex.c @@ -245,13 +245,13 @@ void xbt_ex_display(xbt_ex_t *e) { char *thrower=NULL; if (e->remote) - bprintf(" on host %s(%ld)",e->host,e->pid); + bprintf(" on host %s(%d)",e->host,e->pid); fprintf(stderr, - "** SimGrid: UNCAUGHT EXCEPTION received on %s(%ld): category: %s; value: %d\n" + "** SimGrid: UNCAUGHT EXCEPTION received on %s(%d): category: %s; value: %d\n" "** %s\n" "** Thrown by %s()%s\n", - gras_os_myname(),gras_os_getpid(), + gras_os_myname(),(*xbt_getpid)(), xbt_ex_catname(e->category), e->value, e->msg, e->procname,thrower?thrower:" in this process"); CRITICAL1("%s",e->msg); diff --git a/src/xbt/log.c b/src/xbt/log.c index 9a8f413986..390208d4a8 100644 --- a/src/xbt/log.c +++ b/src/xbt/log.c @@ -20,9 +20,11 @@ #include "xbt/misc.h" #include "xbt/ex.h" #include "xbt/sysdep.h" -#include +#include "xbt/log.h" #include "xbt/dynar.h" +XBT_PUBLIC_DATA(int) (*xbt_pid)(); + /** \addtogroup XBT_log * * This section describes the API to the log functions used diff --git a/src/xbt/xbt_log_layout_format.c b/src/xbt/xbt_log_layout_format.c index 3321e5aca9..27ac36bf64 100644 --- a/src/xbt/xbt_log_layout_format.c +++ b/src/xbt/xbt_log_layout_format.c @@ -89,9 +89,9 @@ static char *xbt_log_layout_format_doit(xbt_log_layout_t l, break; case 'i': /* process PID name; SimGrid extension */ if (precision == -1) - p += sprintf(p, "%ld", gras_os_getpid()); + p += sprintf(p, "%d", (*xbt_getpid)()); else { - p += sprintf(p, "%.*ld", precision, gras_os_getpid()); + p += sprintf(p, "%.*d", precision, (*xbt_getpid)()); precision = -1; } break; diff --git a/src/xbt/xbt_log_layout_simple.c b/src/xbt/xbt_log_layout_simple.c index f13017db4b..5933bf9ab0 100644 --- a/src/xbt/xbt_log_layout_simple.c +++ b/src/xbt/xbt_log_layout_simple.c @@ -35,8 +35,8 @@ static char *xbt_log_layout_simple_doit(xbt_log_layout_t l, p += sprintf(res,"[");; /* Display the proc info if available */ if(strlen(xbt_procname())) - p += sprintf(p,"%s:%s:(%ld) ", - gras_os_myname(), xbt_procname(),gras_os_getpid()); + p += sprintf(p,"%s:%s:(%d) ", + gras_os_myname(), xbt_procname(),(*xbt_getpid)()); /* Display the date */ p += sprintf(p,"%f] ", gras_os_time()-begin_of_time); diff --git a/src/xbt/xbt_virtu.c b/src/xbt/xbt_virtu.c new file mode 100644 index 0000000000..0e05bd34d6 --- /dev/null +++ b/src/xbt/xbt_virtu.c @@ -0,0 +1,19 @@ +/* $Id$ */ + +/* virtu - virtualization layer for XBT to choose between GRAS and MSG implementation */ + +/* Copyright (c) 2007 Martin Quinson. 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 "xbt/misc.h" +#include "xbt/virtu.h" +#include "xbt/function_types.h" + +static int xbt_fake_pid(void) { + return 0; +} + +int_f_void_t *xbt_getpid=&xbt_fake_pid; +