From 0238db34853380280ccf164918ebbb28260f4629 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 27 Feb 2012 11:00:10 +0000 Subject: enabling use of pipes for signal communication also on UNIX to enable future integration with Java services --- src/arm/arm_api.c | 6 ++++-- src/arm/do_start_process.c | 5 +++-- src/arm/gnunet-service-arm.c | 17 +++++++++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) (limited to 'src/arm') diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index 12395fea9..0f4ae6a4f 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c @@ -410,7 +410,8 @@ arm_service_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { /* Means we are ONLY running locally */ /* we're clearly running a test, don't daemonize */ - proc = do_start_process (NULL, loprefix, binary, "-c", config, + proc = do_start_process (GNUNET_NO, + NULL, loprefix, binary, "-c", config, #if DEBUG_ARM "-L", "DEBUG", #endif @@ -419,7 +420,8 @@ arm_service_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } else { - proc = do_start_process (NULL, loprefix, binary, "-c", config, + proc = do_start_process (GNUNET_NO, + NULL, loprefix, binary, "-c", config, #if DEBUG_ARM "-L", "DEBUG", #endif diff --git a/src/arm/do_start_process.c b/src/arm/do_start_process.c index fd7fc17ed..865ea8e7d 100644 --- a/src/arm/do_start_process.c +++ b/src/arm/do_start_process.c @@ -13,7 +13,8 @@ * @return handle of the started process, NULL on error */ static struct GNUNET_OS_Process * -do_start_process (const SOCKTYPE * lsocks, const char *first_arg, ...) +do_start_process (int pipe_control, + const SOCKTYPE * lsocks, const char *first_arg, ...) { va_list ap; char **argv; @@ -95,7 +96,7 @@ do_start_process (const SOCKTYPE * lsocks, const char *first_arg, ...) /* *INDENT-ON* */ va_end (ap); argv[argv_size] = NULL; - proc = GNUNET_OS_start_process_v (lsocks, argv[0], argv); + proc = GNUNET_OS_start_process_v (pipe_control, lsocks, argv[0], argv); while (argv_size > 0) GNUNET_free (argv[--argv_size]); GNUNET_free (argv); diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index 064cb9777..f4430ed0c 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c @@ -152,6 +152,11 @@ struct ServiceList */ int is_default; + /** + * Should we use pipes to signal this process? (YES for Java binaries and if we + * are on Windoze). + */ + int pipe_control; }; /** @@ -311,11 +316,13 @@ start_process (struct ServiceList *sl) GNUNET_assert (NULL == sl->proc); if (GNUNET_YES == use_debug) sl->proc = - do_start_process (lsocks, loprefix, sl->binary, "-c", sl->config, "-L", + do_start_process (sl->pipe_control, + lsocks, loprefix, sl->binary, "-c", sl->config, "-L", "DEBUG", options, NULL); else sl->proc = - do_start_process (lsocks, loprefix, sl->binary, "-c", sl->config, + do_start_process (sl->pipe_control, + lsocks, loprefix, sl->binary, "-c", sl->config, options, NULL); if (sl->proc == NULL) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to start service `%s'\n"), @@ -1070,6 +1077,12 @@ setup_service (void *cls, const char *section) sl->config = config; sl->backoff = GNUNET_TIME_UNIT_MILLISECONDS; sl->restart_at = GNUNET_TIME_UNIT_FOREVER_ABS; +#if WINDOWS + sl->pipe_control = GNUNET_YES; +#else + if (GNUNET_CONFIGURATION_have_value (cfg, section, "PIPECONTROL")) + sl->pipe_control = GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "PIPECONTROL"); +#endif GNUNET_CONTAINER_DLL_insert (running_head, running_tail, sl); if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "AUTOSTART")) -- cgit v1.2.3