Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
new function gras_os_hostport, returning a constant form of gras_os_myname():gras_os_...
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Sun, 15 Jul 2007 11:34:14 +0000 (11:34 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Sun, 15 Jul 2007 11:34:14 +0000 (11:34 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3790 48e7efb5-ca39-0410-a469-dd3cf9ba447f

ChangeLog
include/gras/virtu.h
src/gras/Virtu/process.c

index 341723f..11f30bd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,8 @@ SimGrid (3.3-cvs) unstable; urgency=low
     linux ones too) [Mt]
   * New function: gras_agent_spawn() to launch a new process on
     current host. Only working in simulation for now.. [Mt]
+  * New function: gras_os_hostport() returning a constant form (ie,
+    not needing to be freed) of "gras_os_hostname():gras_os_myport()"
 
  XBT:
   * Make the backtrace of exceptions more human readable [Mt]
index 837ede6..8fe94ab 100644 (file)
@@ -53,6 +53,13 @@ gras_os_myname(void);
 /** @brief returns the number on which this process is listening for incoming messages */
 XBT_PUBLIC(int) gras_os_myport(void);
 
+/** @brief get the uri of the current process
+ *
+ * Returns the concatenation of gras_os_myname():gras_os_myport(). Please do not free the result.
+ */
+XBT_PUBLIC(const char *)
+gras_os_hostport(void);
+
 /** @brief get process identification
  *
  * Returns the process ID of the current process.  (This is often used
index 8f2ab4d..8daf4b7 100644 (file)
@@ -167,3 +167,12 @@ gras_procdata_exit() {
   }
   xbt_dynar_free( & _gras_procdata_fabrics );
 }
+
+
+const char *gras_os_hostport() {
+   static char *res=NULL;
+   if (res)
+     free(res); /* my port may have changed */
+   res = bprintf("%s:%d",gras_os_myname(),gras_os_myport());
+   return (const char*)res;
+}