diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-02-27 11:00:10 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-02-27 11:00:10 +0000 |
commit | 0238db34853380280ccf164918ebbb28260f4629 (patch) | |
tree | 2c47ddbbfa27e7a0479d5c12e78d77342780a4bd /src/arm | |
parent | dc3ae8f36ec69ca2a96a93feda501682ff168320 (diff) | |
download | gnunet-0238db34853380280ccf164918ebbb28260f4629.tar.gz gnunet-0238db34853380280ccf164918ebbb28260f4629.zip |
enabling use of pipes for signal communication also on UNIX to enable future integration with Java services
Diffstat (limited to 'src/arm')
-rw-r--r-- | src/arm/arm_api.c | 6 | ||||
-rw-r--r-- | src/arm/do_start_process.c | 5 | ||||
-rw-r--r-- | src/arm/gnunet-service-arm.c | 17 |
3 files changed, 22 insertions, 6 deletions
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) | |||
410 | { | 410 | { |
411 | /* Means we are ONLY running locally */ | 411 | /* Means we are ONLY running locally */ |
412 | /* we're clearly running a test, don't daemonize */ | 412 | /* we're clearly running a test, don't daemonize */ |
413 | proc = do_start_process (NULL, loprefix, binary, "-c", config, | 413 | proc = do_start_process (GNUNET_NO, |
414 | NULL, loprefix, binary, "-c", config, | ||
414 | #if DEBUG_ARM | 415 | #if DEBUG_ARM |
415 | "-L", "DEBUG", | 416 | "-L", "DEBUG", |
416 | #endif | 417 | #endif |
@@ -419,7 +420,8 @@ arm_service_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
419 | } | 420 | } |
420 | else | 421 | else |
421 | { | 422 | { |
422 | proc = do_start_process (NULL, loprefix, binary, "-c", config, | 423 | proc = do_start_process (GNUNET_NO, |
424 | NULL, loprefix, binary, "-c", config, | ||
423 | #if DEBUG_ARM | 425 | #if DEBUG_ARM |
424 | "-L", "DEBUG", | 426 | "-L", "DEBUG", |
425 | #endif | 427 | #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 @@ | |||
13 | * @return handle of the started process, NULL on error | 13 | * @return handle of the started process, NULL on error |
14 | */ | 14 | */ |
15 | static struct GNUNET_OS_Process * | 15 | static struct GNUNET_OS_Process * |
16 | do_start_process (const SOCKTYPE * lsocks, const char *first_arg, ...) | 16 | do_start_process (int pipe_control, |
17 | const SOCKTYPE * lsocks, const char *first_arg, ...) | ||
17 | { | 18 | { |
18 | va_list ap; | 19 | va_list ap; |
19 | char **argv; | 20 | char **argv; |
@@ -95,7 +96,7 @@ do_start_process (const SOCKTYPE * lsocks, const char *first_arg, ...) | |||
95 | /* *INDENT-ON* */ | 96 | /* *INDENT-ON* */ |
96 | va_end (ap); | 97 | va_end (ap); |
97 | argv[argv_size] = NULL; | 98 | argv[argv_size] = NULL; |
98 | proc = GNUNET_OS_start_process_v (lsocks, argv[0], argv); | 99 | proc = GNUNET_OS_start_process_v (pipe_control, lsocks, argv[0], argv); |
99 | while (argv_size > 0) | 100 | while (argv_size > 0) |
100 | GNUNET_free (argv[--argv_size]); | 101 | GNUNET_free (argv[--argv_size]); |
101 | GNUNET_free (argv); | 102 | 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 | |||
152 | */ | 152 | */ |
153 | int is_default; | 153 | int is_default; |
154 | 154 | ||
155 | /** | ||
156 | * Should we use pipes to signal this process? (YES for Java binaries and if we | ||
157 | * are on Windoze). | ||
158 | */ | ||
159 | int pipe_control; | ||
155 | }; | 160 | }; |
156 | 161 | ||
157 | /** | 162 | /** |
@@ -311,11 +316,13 @@ start_process (struct ServiceList *sl) | |||
311 | GNUNET_assert (NULL == sl->proc); | 316 | GNUNET_assert (NULL == sl->proc); |
312 | if (GNUNET_YES == use_debug) | 317 | if (GNUNET_YES == use_debug) |
313 | sl->proc = | 318 | sl->proc = |
314 | do_start_process (lsocks, loprefix, sl->binary, "-c", sl->config, "-L", | 319 | do_start_process (sl->pipe_control, |
320 | lsocks, loprefix, sl->binary, "-c", sl->config, "-L", | ||
315 | "DEBUG", options, NULL); | 321 | "DEBUG", options, NULL); |
316 | else | 322 | else |
317 | sl->proc = | 323 | sl->proc = |
318 | do_start_process (lsocks, loprefix, sl->binary, "-c", sl->config, | 324 | do_start_process (sl->pipe_control, |
325 | lsocks, loprefix, sl->binary, "-c", sl->config, | ||
319 | options, NULL); | 326 | options, NULL); |
320 | if (sl->proc == NULL) | 327 | if (sl->proc == NULL) |
321 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to start service `%s'\n"), | 328 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Failed to start service `%s'\n"), |
@@ -1070,6 +1077,12 @@ setup_service (void *cls, const char *section) | |||
1070 | sl->config = config; | 1077 | sl->config = config; |
1071 | sl->backoff = GNUNET_TIME_UNIT_MILLISECONDS; | 1078 | sl->backoff = GNUNET_TIME_UNIT_MILLISECONDS; |
1072 | sl->restart_at = GNUNET_TIME_UNIT_FOREVER_ABS; | 1079 | sl->restart_at = GNUNET_TIME_UNIT_FOREVER_ABS; |
1080 | #if WINDOWS | ||
1081 | sl->pipe_control = GNUNET_YES; | ||
1082 | #else | ||
1083 | if (GNUNET_CONFIGURATION_have_value (cfg, section, "PIPECONTROL")) | ||
1084 | sl->pipe_control = GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "PIPECONTROL"); | ||
1085 | #endif | ||
1073 | GNUNET_CONTAINER_DLL_insert (running_head, running_tail, sl); | 1086 | GNUNET_CONTAINER_DLL_insert (running_head, running_tail, sl); |
1074 | if (GNUNET_YES != | 1087 | if (GNUNET_YES != |
1075 | GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "AUTOSTART")) | 1088 | GNUNET_CONFIGURATION_get_value_yesno (cfg, section, "AUTOSTART")) |