Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix copyright headers
[simgrid.git] / src / gras / Virtu / sg_process.c
index 569fd3a..d6497b0 100644 (file)
@@ -1,8 +1,7 @@
-/* $Id$ */
-
 /* process_sg - GRAS process handling on simulator                          */
 
-/* Copyright (c) 2003, 2004 Martin Quinson. All rights reserved.            */
+/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
+ * 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. */
@@ -48,6 +47,7 @@ void gras_process_init()
     /* First process on this host */
     hd = xbt_new(gras_hostdata_t, 1);
     hd->refcount = 1;
+    hd->ports = xbt_dynar_new(sizeof(gras_sg_portrec_t), NULL);
     SIMIX_host_set_data(SIMIX_host_self(), (void *) hd);
   } else {
     hd->refcount++;
@@ -61,7 +61,9 @@ void gras_process_init()
   } else
     pd->ppid = -1;
 
-  trp_pd->sockets_to_close = xbt_dynar_new(sizeof(gras_socket_t),NULL);
+  trp_pd->msg_selectable_sockets = xbt_queue_new(0, sizeof(gras_socket_t));
+
+  trp_pd->meas_selectable_sockets = xbt_queue_new(0, sizeof(gras_socket_t));
 
   VERB2("Creating process '%s' (%d)",
         SIMIX_process_get_name(SIMIX_process_self()), gras_os_getpid());
@@ -83,7 +85,9 @@ void gras_process_exit()
   gras_trp_procdata_t trp_pd =
     (gras_trp_procdata_t) gras_libdata_by_name("gras_trp");
 
-  xbt_dynar_free(&trp_pd->sockets_to_close);
+  xbt_queue_free(&trp_pd->msg_selectable_sockets);
+
+  xbt_queue_free(&trp_pd->meas_selectable_sockets);
 
 
   xbt_assert0(hd, "Run gras_process_init (ie, gras_init)!!");
@@ -110,6 +114,7 @@ void gras_process_exit()
     gras_socket_close(sock_iter);
   }
   if (!--(hd->refcount)) {
+    xbt_dynar_free(&hd->ports);
     free(hd);
   }
   gras_procdata_exit();
@@ -173,7 +178,7 @@ const char *xbt_procname(void)
     As a hack we check for maestro by looking to the assigned host, if it is
     NULL then we are sure is maestro
   */
-  if (process != NULL && SIMIX_host_self())
+  if (process != NULL && SIMIX_process_get_host(process))
     return SIMIX_process_get_name(process);
 
   return "";