Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Allow to retrieve the libdata of a remote host in SG
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 2 Jun 2006 00:09:53 +0000 (00:09 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Fri, 2 Jun 2006 00:09:53 +0000 (00:09 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2347 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/gras/Virtu/process.c
src/gras/Virtu/sg_process.c
src/gras/Virtu/virtu_private.h
src/gras/Virtu/virtu_sg.h

index 1f03f73..98c6481 100644 (file)
@@ -73,6 +73,11 @@ void gras_userdata_set(void *ud) {
 
 void *gras_libdata_by_name(const char *name) {
   gras_procdata_t *pd=gras_procdata_get();
+  return gras_libdata_by_name_from_procdata(name,pd);
+}
+
+/* this function is splitted from previous to allow SG to get libdata from remote hosts */
+void *gras_libdata_by_name_from_procdata(const char*name, gras_procdata_t* pd) {
   void *res=NULL;
   xbt_ex_t e;
 
index 4d1d907..ea01367 100644 (file)
@@ -15,6 +15,8 @@
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(gras_virtu_process);
 
+
+
 void
 gras_process_init() {
   gras_hostdata_t *hd=(gras_hostdata_t *)MSG_host_get_data(MSG_host_self());
@@ -131,7 +133,17 @@ gras_procdata_t *gras_procdata_get(void) {
 
   return pd;
 }
+void *
+gras_libdata_by_name_from_remote(const char *name, m_process_t p) {
+  gras_procdata_t *pd=
+    (gras_procdata_t *)MSG_process_get_data(p);
 
+  xbt_assert2(pd,"process '%s' on '%s' didn't run gras_process_init! (ie, gras_init)", 
+             MSG_process_get_name(p),MSG_host_get_name(MSG_process_get_host(p)));
+   
+  return gras_libdata_by_name_from_procdata(name, pd);
+}   
+  
 const char* xbt_procname(void) {
   const char *res = NULL;
   m_process_t process = MSG_process_self();
index b44246a..3787436 100644 (file)
@@ -26,5 +26,7 @@ typedef struct {
 } gras_procdata_t;
 
 gras_procdata_t *gras_procdata_get(void);
-
+void *gras_libdata_by_name_from_procdata(const char *name, gras_procdata_t* pd);
+   
+   
 #endif  /* GRAS_VIRTU_PRIVATE_H */
index 8bbc968..25f0854 100644 (file)
@@ -40,4 +40,13 @@ typedef struct {
 } gras_trp_sg_sock_data_t;
 
 
+void *gras_libdata_by_name_from_remote(const char *name, m_process_t p);
+/* The same function by id would be really dangerous.
+ * 
+ * Indeed, it would rely on the fact that all process register libdatas in
+ * the same order, which is wrong if they init amok modules in different
+ * order.
+ */
+   
+   
 #endif /* VIRTU_SG_H */