-more datacache integration work
[oweals/gnunet.git] / src / testbed / gnunet_testbed_mpi_spawn.c
index c7b7aab0bbfe3b384bf89ea1bd8087b18a4e4996..3fb50cb8fcb0f165605e904dfe739d74c738a96a 100644 (file)
@@ -26,7 +26,7 @@ static int ret;
 static struct GNUNET_OS_Process *child;
 
 /**
- * The arguments including the binary to spawn 
+ * The arguments including the binary to spawn
  */
 static char **argv2;
 
@@ -58,17 +58,17 @@ static enum GNUNET_OS_ProcessStatusType child_status;
 /**
  * The shutdown task
  */
-static GNUNET_SCHEDULER_TaskIdentifier shutdown_task_id;
+static struct GNUNET_SCHEDULER_Task * shutdown_task_id;
 
 /**
  * Task to kill the child
  */
-static GNUNET_SCHEDULER_TaskIdentifier terminate_task_id;
+static struct GNUNET_SCHEDULER_Task * terminate_task_id;
 
 /**
  * Task to kill the child
  */
-static GNUNET_SCHEDULER_TaskIdentifier child_death_task_id;
+static struct GNUNET_SCHEDULER_Task * child_death_task_id;
 
 /**
  * The shutdown task
@@ -76,10 +76,10 @@ static GNUNET_SCHEDULER_TaskIdentifier child_death_task_id;
 static void
 shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  shutdown_task_id = GNUNET_SCHEDULER_NO_TASK;
+  shutdown_task_id = NULL;
   if (0 != child_exit_code)
   {
-    LOG (GNUNET_ERROR_TYPE_WARNING, "Child exited with error code: %lu\n", 
+    LOG (GNUNET_ERROR_TYPE_WARNING, "Child exited with error code: %lu\n",
          child_exit_code);
     ret = 128 + (int) child_exit_code;
   }
@@ -101,7 +101,7 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   static int hard_kill;
 
   GNUNET_assert (NULL != child);
-  terminate_task_id = 
+  terminate_task_id =
       GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
                                     &terminate_task, NULL);
   if (0 != hard_kill)
@@ -110,7 +110,7 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     {
     case 1:
     case 2:
-      LOG (GNUNET_ERROR_TYPE_WARNING, 
+      LOG (GNUNET_ERROR_TYPE_WARNING,
            "%d more interrupts needed to send SIGKILL to the child\n",
            3 - hard_kill);
       hard_kill++;
@@ -121,7 +121,7 @@ terminate_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
     }
   }
   hard_kill++;
-  GNUNET_break (0 == GNUNET_OS_process_kill (child, SIGTERM));
+  GNUNET_break (0 == GNUNET_OS_process_kill (child, GNUNET_TERM_SIG));
   LOG (GNUNET_ERROR_TYPE_INFO, _("Waiting for child to exit.\n"));
 }
 
@@ -140,7 +140,7 @@ child_death_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   char c[16];
 
   pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ);
-  child_death_task_id = GNUNET_SCHEDULER_NO_TASK;
+  child_death_task_id = NULL;
   if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY))
   {
     child_death_task_id =
@@ -152,7 +152,7 @@ child_death_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof (c)));
   LOG_DEBUG ("Child died\n");
   GNUNET_SCHEDULER_cancel (terminate_task_id);
-  terminate_task_id = GNUNET_SCHEDULER_NO_TASK;
+  terminate_task_id = NULL;
   GNUNET_assert (GNUNET_OK == GNUNET_OS_process_status (child, &child_status,
                                                         &child_exit_code));
   GNUNET_OS_process_destroy (child);
@@ -190,7 +190,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   char *hostname;
   size_t hostname_len;
   unsigned int nhosts;
-  
+
   null_cfg = GNUNET_CONFIGURATION_create ();
   nhosts = GNUNET_TESTBED_hosts_load_from_loadleveler (null_cfg, &hosts);
   if (0 == nhosts)
@@ -223,7 +223,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   if (NULL == tmpdir)
     tmpdir = getenv ("TMP");
   if (NULL == tmpdir)
-    tmpdir = getenv ("TEMP");  
+    tmpdir = getenv ("TEMP");
   if (NULL == tmpdir)
     tmpdir = "/tmp";
   (void) GNUNET_asprintf (&fn, "%s/gnunet-testbed-spawn.lock", tmpdir);
@@ -246,7 +246,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   /* Spawn the new process here */
   LOG (GNUNET_ERROR_TYPE_INFO, _("Spawning process `%s'\n"), argv2[0]);
   child = GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL,
-                                       NULL,
+                                       NULL, NULL,
                                        argv2[0], argv2);
   if (NULL == child)
   {
@@ -304,7 +304,7 @@ main (int argc, char *argv[])
     GNUNET_break (0);
     return 1;
   }
-  if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, 
+  if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO,
                                            GNUNET_NO, GNUNET_NO)))
   {
     GNUNET_break (0);
@@ -321,7 +321,7 @@ main (int argc, char *argv[])
   argv2 = GNUNET_malloc (sizeof (char *) * argc);
   for (cnt = 1; cnt < argc; cnt++)
     argv2[cnt - 1] = argv[cnt];
-  GNUNET_SCHEDULER_run (run, NULL);  
+  GNUNET_SCHEDULER_run (run, NULL);
   GNUNET_free (argv2);
   GNUNET_SIGNAL_handler_uninstall (shc_chld);
   shc_chld = NULL;