+/**
+ * Test killing via pipe.
+ */
+static int
+check_kill ()
+{
+ char *fn;
+
+ hello_pipe_stdin = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_YES, GNUNET_NO);
+ hello_pipe_stdout = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, GNUNET_YES);
+ if ((hello_pipe_stdout == NULL) || (hello_pipe_stdin == NULL))
+ {
+ return 1;
+ }
+ fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver");
+ proc =
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR,
+ hello_pipe_stdin, hello_pipe_stdout, NULL,
+ fn,
+ "gnunet-service-resolver", "-", NULL);
+ sleep (1); /* give process time to start, so we actually use the pipe-kill mechanism! */
+ GNUNET_free (fn);
+ if (0 != GNUNET_OS_process_kill (proc, GNUNET_TERM_SIG))
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
+ GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (proc));
+ GNUNET_OS_process_destroy (proc);
+ proc = NULL;
+ GNUNET_DISK_pipe_close (hello_pipe_stdout);
+ GNUNET_DISK_pipe_close (hello_pipe_stdin);
+ return 0;
+}
+
+
+/**
+ * Test killing via pipe.
+ */
+static int
+check_instant_kill ()
+{
+ char *fn;
+
+ hello_pipe_stdin = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_YES, GNUNET_NO);
+ hello_pipe_stdout = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, GNUNET_YES);
+ if ((hello_pipe_stdout == NULL) || (hello_pipe_stdin == NULL))
+ {
+ return 1;
+ }
+ fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver");
+ proc =
+ GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR,
+ hello_pipe_stdin, hello_pipe_stdout, NULL,
+ fn,
+ "gnunet-service-resolver", "-", NULL);
+ if (0 != GNUNET_OS_process_kill (proc, GNUNET_TERM_SIG))
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
+ }
+ GNUNET_free (fn);
+ GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (proc));
+ GNUNET_OS_process_destroy (proc);
+ proc = NULL;
+ GNUNET_DISK_pipe_close (hello_pipe_stdout);
+ GNUNET_DISK_pipe_close (hello_pipe_stdin);
+ return 0;
+}
+
+