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 | |
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
72 files changed, 605 insertions, 736 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")) |
diff --git a/src/ats/test_ats_api_bandwidth_consumption.c b/src/ats/test_ats_api_bandwidth_consumption.c index 9b09f5a49..a84927d58 100644 --- a/src/ats/test_ats_api_bandwidth_consumption.c +++ b/src/ats/test_ats_api_bandwidth_consumption.c | |||
@@ -199,7 +199,7 @@ void | |||
199 | start_arm (const char *cfgname) | 199 | start_arm (const char *cfgname) |
200 | { | 200 | { |
201 | arm_proc = | 201 | arm_proc = |
202 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 202 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
203 | "gnunet-service-arm", | 203 | "gnunet-service-arm", |
204 | #if VERBOSE_ARM | 204 | #if VERBOSE_ARM |
205 | "-L", "DEBUG", | 205 | "-L", "DEBUG", |
diff --git a/src/ats/test_ats_api_scheduling.c b/src/ats/test_ats_api_scheduling.c index 9435a7b6f..892186cd1 100644 --- a/src/ats/test_ats_api_scheduling.c +++ b/src/ats/test_ats_api_scheduling.c | |||
@@ -156,7 +156,7 @@ void | |||
156 | start_arm (const char *cfgname) | 156 | start_arm (const char *cfgname) |
157 | { | 157 | { |
158 | arm_proc = | 158 | arm_proc = |
159 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 159 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
160 | "gnunet-service-arm", | 160 | "gnunet-service-arm", |
161 | #if VERBOSE_ARM | 161 | #if VERBOSE_ARM |
162 | "-L", "DEBUG", | 162 | "-L", "DEBUG", |
diff --git a/src/chat/test_chat.c b/src/chat/test_chat.c index 7cf8b19cf..fec5db02a 100644 --- a/src/chat/test_chat.c +++ b/src/chat/test_chat.c | |||
@@ -119,7 +119,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
119 | p->cfg = GNUNET_CONFIGURATION_create (); | 119 | p->cfg = GNUNET_CONFIGURATION_create (); |
120 | #if START_ARM | 120 | #if START_ARM |
121 | p->arm_proc = | 121 | p->arm_proc = |
122 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 122 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
123 | "gnunet-service-arm", | 123 | "gnunet-service-arm", |
124 | #if VERBOSE | 124 | #if VERBOSE |
125 | "-L", "DEBUG", | 125 | "-L", "DEBUG", |
diff --git a/src/chat/test_chat_private.c b/src/chat/test_chat_private.c index acec5bcf0..cbc90656f 100644 --- a/src/chat/test_chat_private.c +++ b/src/chat/test_chat_private.c | |||
@@ -133,7 +133,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
133 | p->cfg = GNUNET_CONFIGURATION_create (); | 133 | p->cfg = GNUNET_CONFIGURATION_create (); |
134 | #if START_ARM | 134 | #if START_ARM |
135 | p->arm_proc = | 135 | p->arm_proc = |
136 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 136 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
137 | "gnunet-service-arm", | 137 | "gnunet-service-arm", |
138 | #if VERBOSE | 138 | #if VERBOSE |
139 | "-L", "DEBUG", | 139 | "-L", "DEBUG", |
diff --git a/src/core/test_core_api.c b/src/core/test_core_api.c index 7bf091933..271c2ce08 100644 --- a/src/core/test_core_api.c +++ b/src/core/test_core_api.c | |||
@@ -319,7 +319,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
319 | p->cfg = GNUNET_CONFIGURATION_create (); | 319 | p->cfg = GNUNET_CONFIGURATION_create (); |
320 | #if START_ARM | 320 | #if START_ARM |
321 | p->arm_proc = | 321 | p->arm_proc = |
322 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 322 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
323 | "gnunet-service-arm", | 323 | "gnunet-service-arm", |
324 | #if VERBOSE | 324 | #if VERBOSE |
325 | "-L", "DEBUG", | 325 | "-L", "DEBUG", |
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c index 94c28fa81..645b27e74 100644 --- a/src/core/test_core_api_reliability.c +++ b/src/core/test_core_api_reliability.c | |||
@@ -442,7 +442,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
442 | p->cfg = GNUNET_CONFIGURATION_create (); | 442 | p->cfg = GNUNET_CONFIGURATION_create (); |
443 | #if START_ARM | 443 | #if START_ARM |
444 | p->arm_proc = | 444 | p->arm_proc = |
445 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 445 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
446 | "gnunet-service-arm", | 446 | "gnunet-service-arm", |
447 | #if VERBOSE | 447 | #if VERBOSE |
448 | "-L", "DEBUG", | 448 | "-L", "DEBUG", |
diff --git a/src/core/test_core_api_send_to_self.c b/src/core/test_core_api_send_to_self.c index f04f94fac..4fa73d951 100644 --- a/src/core/test_core_api_send_to_self.c +++ b/src/core/test_core_api_send_to_self.c | |||
@@ -170,7 +170,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
170 | core_cfg = GNUNET_CONFIGURATION_create (); | 170 | core_cfg = GNUNET_CONFIGURATION_create (); |
171 | 171 | ||
172 | arm_proc = | 172 | arm_proc = |
173 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 173 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
174 | "gnunet-service-arm", | 174 | "gnunet-service-arm", |
175 | #if VERBOSE | 175 | #if VERBOSE |
176 | "-L", "DEBUG", | 176 | "-L", "DEBUG", |
diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c index 876e3b0f8..2eca57512 100644 --- a/src/core/test_core_api_start_only.c +++ b/src/core/test_core_api_start_only.c | |||
@@ -148,7 +148,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
148 | p->cfg = GNUNET_CONFIGURATION_create (); | 148 | p->cfg = GNUNET_CONFIGURATION_create (); |
149 | #if START_ARM | 149 | #if START_ARM |
150 | p->arm_proc = | 150 | p->arm_proc = |
151 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 151 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
152 | "gnunet-service-arm", | 152 | "gnunet-service-arm", |
153 | #if VERBOSE | 153 | #if VERBOSE |
154 | "-L", "DEBUG", | 154 | "-L", "DEBUG", |
diff --git a/src/core/test_core_defaults.conf b/src/core/test_core_defaults.conf index 82f14a9d9..f91ee42bb 100644 --- a/src/core/test_core_defaults.conf +++ b/src/core/test_core_defaults.conf | |||
@@ -47,4 +47,7 @@ AUTOSTART = NO | |||
47 | AUTOSTART = NO | 47 | AUTOSTART = NO |
48 | 48 | ||
49 | [dv] | 49 | [dv] |
50 | AUTOSTART = NO \ No newline at end of file | 50 | AUTOSTART = NO |
51 | |||
52 | [chat] | ||
53 | AUTOSTART = NO | ||
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index f16cc5441..7c16531d8 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c | |||
@@ -569,7 +569,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
569 | p->cfg = GNUNET_CONFIGURATION_create (); | 569 | p->cfg = GNUNET_CONFIGURATION_create (); |
570 | #if START_ARM | 570 | #if START_ARM |
571 | p->arm_proc = | 571 | p->arm_proc = |
572 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 572 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
573 | "gnunet-service-arm", | 573 | "gnunet-service-arm", |
574 | #if VERBOSE | 574 | #if VERBOSE |
575 | "-L", "DEBUG", | 575 | "-L", "DEBUG", |
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c index 393972da2..aae152db8 100644 --- a/src/datastore/perf_datastore_api.c +++ b/src/datastore/perf_datastore_api.c | |||
@@ -343,7 +343,7 @@ check () | |||
343 | GNUNET_snprintf (cfg_name, sizeof (cfg_name), | 343 | GNUNET_snprintf (cfg_name, sizeof (cfg_name), |
344 | "test_datastore_api_data_%s.conf", plugin_name); | 344 | "test_datastore_api_data_%s.conf", plugin_name); |
345 | proc = | 345 | proc = |
346 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 346 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
347 | "gnunet-service-arm", | 347 | "gnunet-service-arm", |
348 | #if VERBOSE | 348 | #if VERBOSE |
349 | "-L", "DEBUG", | 349 | "-L", "DEBUG", |
diff --git a/src/datastore/test_datastore_api.c b/src/datastore/test_datastore_api.c index c93f5412e..25836ca66 100644 --- a/src/datastore/test_datastore_api.c +++ b/src/datastore/test_datastore_api.c | |||
@@ -526,7 +526,7 @@ check () | |||
526 | "test_datastore_api_data_%s.conf", plugin_name); | 526 | "test_datastore_api_data_%s.conf", plugin_name); |
527 | #if START_DATASTORE | 527 | #if START_DATASTORE |
528 | proc = | 528 | proc = |
529 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 529 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
530 | "gnunet-service-arm", | 530 | "gnunet-service-arm", |
531 | #if VERBOSE | 531 | #if VERBOSE |
532 | "-L", "DEBUG", | 532 | "-L", "DEBUG", |
diff --git a/src/datastore/test_datastore_api_management.c b/src/datastore/test_datastore_api_management.c index 2d5cc6bf9..4015c2cb2 100644 --- a/src/datastore/test_datastore_api_management.c +++ b/src/datastore/test_datastore_api_management.c | |||
@@ -311,7 +311,7 @@ check () | |||
311 | GNUNET_snprintf (cfg_name, sizeof (cfg_name), | 311 | GNUNET_snprintf (cfg_name, sizeof (cfg_name), |
312 | "test_datastore_api_data_%s.conf", plugin_name); | 312 | "test_datastore_api_data_%s.conf", plugin_name); |
313 | proc = | 313 | proc = |
314 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 314 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
315 | "gnunet-service-arm", | 315 | "gnunet-service-arm", |
316 | #if VERBOSE | 316 | #if VERBOSE |
317 | "-L", "DEBUG", | 317 | "-L", "DEBUG", |
diff --git a/src/datastore/test_defaults.conf b/src/datastore/test_defaults.conf index bbc1ad190..bdba91731 100644 --- a/src/datastore/test_defaults.conf +++ b/src/datastore/test_defaults.conf | |||
@@ -15,4 +15,7 @@ AUTOSTART = NO | |||
15 | AUTOSTART = NO | 15 | AUTOSTART = NO |
16 | 16 | ||
17 | [dv] | 17 | [dv] |
18 | AUTOSTART = NO \ No newline at end of file | 18 | AUTOSTART = NO |
19 | |||
20 | [chat] | ||
21 | AUTOSTART = NO | ||
diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c index b31cd1a72..182856a8e 100644 --- a/src/dht/test_dht_api.c +++ b/src/dht/test_dht_api.c | |||
@@ -263,7 +263,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
263 | p->cfg = GNUNET_CONFIGURATION_create (); | 263 | p->cfg = GNUNET_CONFIGURATION_create (); |
264 | #if START_ARM | 264 | #if START_ARM |
265 | p->arm_proc = | 265 | p->arm_proc = |
266 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 266 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
267 | "gnunet-service-arm", | 267 | "gnunet-service-arm", |
268 | #if VERBOSE_ARM | 268 | #if VERBOSE_ARM |
269 | "-L", "DEBUG", | 269 | "-L", "DEBUG", |
diff --git a/src/fs/test_fs_defaults.conf b/src/fs/test_fs_defaults.conf index 9dd717863..e32213bc3 100644 --- a/src/fs/test_fs_defaults.conf +++ b/src/fs/test_fs_defaults.conf | |||
@@ -75,4 +75,7 @@ AUTOSTART = NO | |||
75 | AUTOSTART = NO | 75 | AUTOSTART = NO |
76 | 76 | ||
77 | [dv] | 77 | [dv] |
78 | AUTOSTART = NO \ No newline at end of file | 78 | AUTOSTART = NO |
79 | |||
80 | [chat] | ||
81 | AUTOSTART = NO | ||
diff --git a/src/fs/test_fs_download.c b/src/fs/test_fs_download.c index 51020c4a2..570eab909 100644 --- a/src/fs/test_fs_download.c +++ b/src/fs/test_fs_download.c | |||
@@ -245,7 +245,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
245 | p->cfg = GNUNET_CONFIGURATION_create (); | 245 | p->cfg = GNUNET_CONFIGURATION_create (); |
246 | #if START_ARM | 246 | #if START_ARM |
247 | p->arm_proc = | 247 | p->arm_proc = |
248 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 248 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
249 | "gnunet-service-arm", | 249 | "gnunet-service-arm", |
250 | #if VERBOSE | 250 | #if VERBOSE |
251 | "-L", "DEBUG", | 251 | "-L", "DEBUG", |
diff --git a/src/fs/test_fs_download_indexed.c b/src/fs/test_fs_download_indexed.c index b9b791d1f..e8504f175 100644 --- a/src/fs/test_fs_download_indexed.c +++ b/src/fs/test_fs_download_indexed.c | |||
@@ -246,7 +246,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
246 | p->cfg = GNUNET_CONFIGURATION_create (); | 246 | p->cfg = GNUNET_CONFIGURATION_create (); |
247 | #if START_ARM | 247 | #if START_ARM |
248 | p->arm_proc = | 248 | p->arm_proc = |
249 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 249 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
250 | "gnunet-service-arm", | 250 | "gnunet-service-arm", |
251 | #if VERBOSE | 251 | #if VERBOSE |
252 | "-L", "DEBUG", | 252 | "-L", "DEBUG", |
diff --git a/src/fs/test_fs_download_persistence.c b/src/fs/test_fs_download_persistence.c index f0dc6f3a6..bcb1c54b6 100644 --- a/src/fs/test_fs_download_persistence.c +++ b/src/fs/test_fs_download_persistence.c | |||
@@ -295,7 +295,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
295 | p->cfg = GNUNET_CONFIGURATION_create (); | 295 | p->cfg = GNUNET_CONFIGURATION_create (); |
296 | #if START_ARM | 296 | #if START_ARM |
297 | p->arm_proc = | 297 | p->arm_proc = |
298 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 298 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
299 | "gnunet-service-arm", | 299 | "gnunet-service-arm", |
300 | #if VERBOSE | 300 | #if VERBOSE |
301 | "-L", "DEBUG", | 301 | "-L", "DEBUG", |
diff --git a/src/fs/test_fs_list_indexed.c b/src/fs/test_fs_list_indexed.c index 5df503a65..535f8ef58 100644 --- a/src/fs/test_fs_list_indexed.c +++ b/src/fs/test_fs_list_indexed.c | |||
@@ -188,7 +188,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
188 | p->cfg = GNUNET_CONFIGURATION_create (); | 188 | p->cfg = GNUNET_CONFIGURATION_create (); |
189 | #if START_ARM | 189 | #if START_ARM |
190 | p->arm_proc = | 190 | p->arm_proc = |
191 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 191 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
192 | "gnunet-service-arm", | 192 | "gnunet-service-arm", |
193 | #if VERBOSE | 193 | #if VERBOSE |
194 | "-L", "DEBUG", | 194 | "-L", "DEBUG", |
diff --git a/src/fs/test_fs_namespace.c b/src/fs/test_fs_namespace.c index 7ef5d89be..d25fd6f83 100644 --- a/src/fs/test_fs_namespace.c +++ b/src/fs/test_fs_namespace.c | |||
@@ -67,7 +67,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
67 | p->cfg = GNUNET_CONFIGURATION_create (); | 67 | p->cfg = GNUNET_CONFIGURATION_create (); |
68 | #if START_ARM | 68 | #if START_ARM |
69 | p->arm_proc = | 69 | p->arm_proc = |
70 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 70 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
71 | "gnunet-service-arm", | 71 | "gnunet-service-arm", |
72 | #if VERBOSE | 72 | #if VERBOSE |
73 | "-L", "DEBUG", | 73 | "-L", "DEBUG", |
diff --git a/src/fs/test_fs_namespace_list_updateable.c b/src/fs/test_fs_namespace_list_updateable.c index 1ad2fb5ac..44775ac0e 100644 --- a/src/fs/test_fs_namespace_list_updateable.c +++ b/src/fs/test_fs_namespace_list_updateable.c | |||
@@ -71,7 +71,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
71 | p->cfg = GNUNET_CONFIGURATION_create (); | 71 | p->cfg = GNUNET_CONFIGURATION_create (); |
72 | #if START_ARM | 72 | #if START_ARM |
73 | p->arm_proc = | 73 | p->arm_proc = |
74 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 74 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
75 | "gnunet-service-arm", | 75 | "gnunet-service-arm", |
76 | #if VERBOSE | 76 | #if VERBOSE |
77 | "-L", "DEBUG", | 77 | "-L", "DEBUG", |
diff --git a/src/fs/test_fs_publish.c b/src/fs/test_fs_publish.c index 1ae3ab451..e52743876 100644 --- a/src/fs/test_fs_publish.c +++ b/src/fs/test_fs_publish.c | |||
@@ -173,7 +173,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
173 | p->cfg = GNUNET_CONFIGURATION_create (); | 173 | p->cfg = GNUNET_CONFIGURATION_create (); |
174 | #if START_ARM | 174 | #if START_ARM |
175 | p->arm_proc = | 175 | p->arm_proc = |
176 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 176 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
177 | "gnunet-service-arm", | 177 | "gnunet-service-arm", |
178 | #if VERBOSE | 178 | #if VERBOSE |
179 | "-L", "DEBUG", | 179 | "-L", "DEBUG", |
diff --git a/src/fs/test_fs_publish_persistence.c b/src/fs/test_fs_publish_persistence.c index 0b7828256..7707eac32 100644 --- a/src/fs/test_fs_publish_persistence.c +++ b/src/fs/test_fs_publish_persistence.c | |||
@@ -236,7 +236,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
236 | p->cfg = GNUNET_CONFIGURATION_create (); | 236 | p->cfg = GNUNET_CONFIGURATION_create (); |
237 | #if START_ARM | 237 | #if START_ARM |
238 | p->arm_proc = | 238 | p->arm_proc = |
239 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 239 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
240 | "gnunet-service-arm", | 240 | "gnunet-service-arm", |
241 | #if VERBOSE | 241 | #if VERBOSE |
242 | "-L", "DEBUG", | 242 | "-L", "DEBUG", |
diff --git a/src/fs/test_fs_search.c b/src/fs/test_fs_search.c index e10461534..f6c8f00f8 100644 --- a/src/fs/test_fs_search.c +++ b/src/fs/test_fs_search.c | |||
@@ -174,7 +174,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
174 | p->cfg = GNUNET_CONFIGURATION_create (); | 174 | p->cfg = GNUNET_CONFIGURATION_create (); |
175 | #if START_ARM | 175 | #if START_ARM |
176 | p->arm_proc = | 176 | p->arm_proc = |
177 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 177 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
178 | "gnunet-service-arm", | 178 | "gnunet-service-arm", |
179 | #if VERBOSE | 179 | #if VERBOSE |
180 | "-L", "DEBUG", | 180 | "-L", "DEBUG", |
diff --git a/src/fs/test_fs_search_persistence.c b/src/fs/test_fs_search_persistence.c index bb38d92c7..38f88a82a 100644 --- a/src/fs/test_fs_search_persistence.c +++ b/src/fs/test_fs_search_persistence.c | |||
@@ -236,7 +236,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
236 | p->cfg = GNUNET_CONFIGURATION_create (); | 236 | p->cfg = GNUNET_CONFIGURATION_create (); |
237 | #if START_ARM | 237 | #if START_ARM |
238 | p->arm_proc = | 238 | p->arm_proc = |
239 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 239 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
240 | "gnunet-service-arm", | 240 | "gnunet-service-arm", |
241 | #if VERBOSE | 241 | #if VERBOSE |
242 | "-L", "DEBUG", | 242 | "-L", "DEBUG", |
diff --git a/src/fs/test_fs_start_stop.c b/src/fs/test_fs_start_stop.c index c65ad2fc1..0ef0723f9 100644 --- a/src/fs/test_fs_start_stop.c +++ b/src/fs/test_fs_start_stop.c | |||
@@ -57,7 +57,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
57 | p->cfg = GNUNET_CONFIGURATION_create (); | 57 | p->cfg = GNUNET_CONFIGURATION_create (); |
58 | #if START_ARM | 58 | #if START_ARM |
59 | p->arm_proc = | 59 | p->arm_proc = |
60 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 60 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
61 | "gnunet-service-arm", | 61 | "gnunet-service-arm", |
62 | #if VERBOSE | 62 | #if VERBOSE |
63 | "-L", "DEBUG", | 63 | "-L", "DEBUG", |
diff --git a/src/fs/test_fs_unindex.c b/src/fs/test_fs_unindex.c index cede0f5b7..a8b68a3cf 100644 --- a/src/fs/test_fs_unindex.c +++ b/src/fs/test_fs_unindex.c | |||
@@ -187,7 +187,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
187 | p->cfg = GNUNET_CONFIGURATION_create (); | 187 | p->cfg = GNUNET_CONFIGURATION_create (); |
188 | #if START_ARM | 188 | #if START_ARM |
189 | p->arm_proc = | 189 | p->arm_proc = |
190 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 190 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
191 | "gnunet-service-arm", | 191 | "gnunet-service-arm", |
192 | #if VERBOSE | 192 | #if VERBOSE |
193 | "-L", "DEBUG", | 193 | "-L", "DEBUG", |
diff --git a/src/fs/test_fs_unindex_persistence.c b/src/fs/test_fs_unindex_persistence.c index b13378f20..575e1715f 100644 --- a/src/fs/test_fs_unindex_persistence.c +++ b/src/fs/test_fs_unindex_persistence.c | |||
@@ -249,7 +249,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
249 | p->cfg = GNUNET_CONFIGURATION_create (); | 249 | p->cfg = GNUNET_CONFIGURATION_create (); |
250 | #if START_ARM | 250 | #if START_ARM |
251 | p->arm_proc = | 251 | p->arm_proc = |
252 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 252 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
253 | "gnunet-service-arm", | 253 | "gnunet-service-arm", |
254 | #if VERBOSE | 254 | #if VERBOSE |
255 | "-L", "DEBUG", | 255 | "-L", "DEBUG", |
diff --git a/src/hostlist/test_gnunet_daemon_hostlist.c b/src/hostlist/test_gnunet_daemon_hostlist.c index 056e56177..da3ab8b58 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist.c +++ b/src/hostlist/test_gnunet_daemon_hostlist.c | |||
@@ -140,7 +140,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
140 | p->cfg = GNUNET_CONFIGURATION_create (); | 140 | p->cfg = GNUNET_CONFIGURATION_create (); |
141 | #if START_ARM | 141 | #if START_ARM |
142 | p->arm_proc = | 142 | p->arm_proc = |
143 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 143 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
144 | "gnunet-service-arm", | 144 | "gnunet-service-arm", |
145 | #if VERBOSE | 145 | #if VERBOSE |
146 | "-L", "DEBUG", | 146 | "-L", "DEBUG", |
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c index b27710677..9ef8812f6 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c | |||
@@ -370,7 +370,7 @@ setup_learn_peer (struct PeerContext *p, const char *cfgname) | |||
370 | p->cfg = GNUNET_CONFIGURATION_create (); | 370 | p->cfg = GNUNET_CONFIGURATION_create (); |
371 | #if START_ARM | 371 | #if START_ARM |
372 | p->arm_proc = | 372 | p->arm_proc = |
373 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 373 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
374 | "gnunet-service-arm", | 374 | "gnunet-service-arm", |
375 | #if VERBOSE | 375 | #if VERBOSE |
376 | "-L", "DEBUG", | 376 | "-L", "DEBUG", |
@@ -406,7 +406,7 @@ setup_adv_peer (struct PeerContext *p, const char *cfgname) | |||
406 | p->cfg = GNUNET_CONFIGURATION_create (); | 406 | p->cfg = GNUNET_CONFIGURATION_create (); |
407 | #if START_ARM | 407 | #if START_ARM |
408 | p->arm_proc = | 408 | p->arm_proc = |
409 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 409 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
410 | "gnunet-service-arm", | 410 | "gnunet-service-arm", |
411 | #if VERBOSE | 411 | #if VERBOSE |
412 | "-L", "DEBUG", | 412 | "-L", "DEBUG", |
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c index e347673d8..a9915574b 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c | |||
@@ -144,7 +144,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
144 | p->cfg = GNUNET_CONFIGURATION_create (); | 144 | p->cfg = GNUNET_CONFIGURATION_create (); |
145 | #if START_ARM | 145 | #if START_ARM |
146 | p->arm_proc = | 146 | p->arm_proc = |
147 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 147 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
148 | "gnunet-service-arm", | 148 | "gnunet-service-arm", |
149 | #if VERBOSE | 149 | #if VERBOSE |
150 | "-L", "DEBUG", | 150 | "-L", "DEBUG", |
diff --git a/src/hostlist/test_hostlist_defaults.conf b/src/hostlist/test_hostlist_defaults.conf index 08c58b963..b74a6a615 100644 --- a/src/hostlist/test_hostlist_defaults.conf +++ b/src/hostlist/test_hostlist_defaults.conf | |||
@@ -50,4 +50,7 @@ AUTOSTART = NO | |||
50 | AUTOSTART = NO | 50 | AUTOSTART = NO |
51 | 51 | ||
52 | [dv] | 52 | [dv] |
53 | AUTOSTART = NO \ No newline at end of file | 53 | AUTOSTART = NO |
54 | |||
55 | [chat] | ||
56 | AUTOSTART = NO | ||
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h index 9c88a163b..18f553576 100644 --- a/src/include/gnunet_disk_lib.h +++ b/src/include/gnunet_disk_lib.h | |||
@@ -32,11 +32,6 @@ | |||
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Opaque handle used to access files. | ||
36 | */ | ||
37 | struct GNUNET_DISK_FileHandle; | ||
38 | |||
39 | /** | ||
40 | * Handle used to manage a pipe. | 35 | * Handle used to manage a pipe. |
41 | */ | 36 | */ |
42 | struct GNUNET_DISK_PipeHandle; | 37 | struct GNUNET_DISK_PipeHandle; |
@@ -759,36 +754,6 @@ GNUNET_DISK_file_unmap (struct GNUNET_DISK_MapHandle *h); | |||
759 | int | 754 | int |
760 | GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h); | 755 | GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h); |
761 | 756 | ||
762 | /** | ||
763 | * Creates a named pipe/FIFO and opens it | ||
764 | * @param fn pointer to the name of the named pipe or to NULL | ||
765 | * @param flags open flags | ||
766 | * @param perm access permissions | ||
767 | * @return pipe handle on success, NULL on error | ||
768 | */ | ||
769 | struct GNUNET_DISK_FileHandle * | ||
770 | GNUNET_DISK_npipe_create (char **fn, enum GNUNET_DISK_OpenFlags flags, | ||
771 | enum GNUNET_DISK_AccessPermissions perm); | ||
772 | |||
773 | /** | ||
774 | * Opens already existing named pipe/FIFO | ||
775 | * | ||
776 | * @param fn name of an existing named pipe | ||
777 | * @param flags open flags | ||
778 | * @param perm access permissions | ||
779 | * @return pipe handle on success, NULL on error | ||
780 | */ | ||
781 | struct GNUNET_DISK_FileHandle * | ||
782 | GNUNET_DISK_npipe_open (const char *fn, enum GNUNET_DISK_OpenFlags flags, | ||
783 | enum GNUNET_DISK_AccessPermissions perm); | ||
784 | |||
785 | /** | ||
786 | * Closes a named pipe/FIFO | ||
787 | * @param pipe named pipe | ||
788 | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise | ||
789 | */ | ||
790 | int | ||
791 | GNUNET_DISK_npipe_close (struct GNUNET_DISK_FileHandle *pipe); | ||
792 | 757 | ||
793 | #if 0 /* keep Emacsens' auto-indent happy */ | 758 | #if 0 /* keep Emacsens' auto-indent happy */ |
794 | { | 759 | { |
diff --git a/src/include/gnunet_os_lib.h b/src/include/gnunet_os_lib.h index c56947431..e9e484f78 100644 --- a/src/include/gnunet_os_lib.h +++ b/src/include/gnunet_os_lib.h | |||
@@ -27,6 +27,16 @@ | |||
27 | * @author Ioana Patrascu | 27 | * @author Ioana Patrascu |
28 | * @author Tzvetan Horozov | 28 | * @author Tzvetan Horozov |
29 | * @author Milan | 29 | * @author Milan |
30 | * | ||
31 | * This code manages child processes. We can communicate with child | ||
32 | * processes using signals. Because signals are not supported on W32 | ||
33 | * and Java (at least not nicely), we can alternatively use a pipe | ||
34 | * to send signals to the child processes (if the child process is | ||
35 | * a full-blown GNUnet process that supports reading signals from | ||
36 | * a pipe, of course). Naturally, this also only works for 'normal' | ||
37 | * termination via signals, and not as a replacement for SIGKILL. | ||
38 | * Thus using pipes to communicate signals should only be enabled if | ||
39 | * the child is a Java process OR if we are on Windoze. | ||
30 | */ | 40 | */ |
31 | 41 | ||
32 | #ifndef GNUNET_OS_LIB_H | 42 | #ifndef GNUNET_OS_LIB_H |
@@ -201,7 +211,7 @@ GNUNET_OS_process_current (void); | |||
201 | 211 | ||
202 | 212 | ||
203 | /** | 213 | /** |
204 | * Sends sig to the process | 214 | * Sends a signal to the process |
205 | * | 215 | * |
206 | * @param proc pointer to process structure | 216 | * @param proc pointer to process structure |
207 | * @param sig signal | 217 | * @param sig signal |
@@ -219,6 +229,7 @@ GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig); | |||
219 | void | 229 | void |
220 | GNUNET_OS_process_close (struct GNUNET_OS_Process *proc); | 230 | GNUNET_OS_process_close (struct GNUNET_OS_Process *proc); |
221 | 231 | ||
232 | |||
222 | /** | 233 | /** |
223 | * Get the pid of the process in question | 234 | * Get the pid of the process in question |
224 | * | 235 | * |
@@ -229,6 +240,7 @@ GNUNET_OS_process_close (struct GNUNET_OS_Process *proc); | |||
229 | pid_t | 240 | pid_t |
230 | GNUNET_OS_process_get_pid (struct GNUNET_OS_Process *proc); | 241 | GNUNET_OS_process_get_pid (struct GNUNET_OS_Process *proc); |
231 | 242 | ||
243 | |||
232 | /** | 244 | /** |
233 | * Set process priority | 245 | * Set process priority |
234 | * | 246 | * |
@@ -241,10 +253,10 @@ GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc, | |||
241 | enum GNUNET_SCHEDULER_Priority prio); | 253 | enum GNUNET_SCHEDULER_Priority prio); |
242 | 254 | ||
243 | 255 | ||
244 | |||
245 | /** | 256 | /** |
246 | * Start a process. | 257 | * Start a process. |
247 | * | 258 | * |
259 | * @param pipe_control should a pipe be used to send signals to the child? | ||
248 | * @param pipe_stdin pipe to use to send input to child process (or NULL) | 260 | * @param pipe_stdin pipe to use to send input to child process (or NULL) |
249 | * @param pipe_stdout pipe to use to get output from child process (or NULL) | 261 | * @param pipe_stdout pipe to use to get output from child process (or NULL) |
250 | * @param filename name of the binary | 262 | * @param filename name of the binary |
@@ -252,7 +264,8 @@ GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc, | |||
252 | * @return pointer to process structure of the new process, NULL on error | 264 | * @return pointer to process structure of the new process, NULL on error |
253 | */ | 265 | */ |
254 | struct GNUNET_OS_Process * | 266 | struct GNUNET_OS_Process * |
255 | GNUNET_OS_start_process_vap (struct GNUNET_DISK_PipeHandle *pipe_stdin, | 267 | GNUNET_OS_start_process_vap (int pipe_control, |
268 | struct GNUNET_DISK_PipeHandle *pipe_stdin, | ||
256 | struct GNUNET_DISK_PipeHandle *pipe_stdout, | 269 | struct GNUNET_DISK_PipeHandle *pipe_stdout, |
257 | const char *filename, | 270 | const char *filename, |
258 | char *const argv[]); | 271 | char *const argv[]); |
@@ -261,6 +274,7 @@ GNUNET_OS_start_process_vap (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
261 | /** | 274 | /** |
262 | * Start a process. | 275 | * Start a process. |
263 | * | 276 | * |
277 | * @param pipe_control should a pipe be used to send signals to the child? | ||
264 | * @param pipe_stdin pipe to use to send input to child process (or NULL) | 278 | * @param pipe_stdin pipe to use to send input to child process (or NULL) |
265 | * @param pipe_stdout pipe to use to get output from child process (or NULL) | 279 | * @param pipe_stdout pipe to use to get output from child process (or NULL) |
266 | * @param filename name of the binary | 280 | * @param filename name of the binary |
@@ -268,7 +282,8 @@ GNUNET_OS_start_process_vap (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
268 | * @return pointer to process structure of the new process, NULL on error | 282 | * @return pointer to process structure of the new process, NULL on error |
269 | */ | 283 | */ |
270 | struct GNUNET_OS_Process * | 284 | struct GNUNET_OS_Process * |
271 | GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | 285 | GNUNET_OS_start_process (int pipe_control, |
286 | struct GNUNET_DISK_PipeHandle *pipe_stdin, | ||
272 | struct GNUNET_DISK_PipeHandle *pipe_stdout, | 287 | struct GNUNET_DISK_PipeHandle *pipe_stdout, |
273 | const char *filename, ...); | 288 | const char *filename, ...); |
274 | 289 | ||
@@ -276,6 +291,7 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
276 | /** | 291 | /** |
277 | * Start a process. | 292 | * Start a process. |
278 | * | 293 | * |
294 | * @param pipe_control should a pipe be used to send signals to the child? | ||
279 | * @param pipe_stdin pipe to use to send input to child process (or NULL) | 295 | * @param pipe_stdin pipe to use to send input to child process (or NULL) |
280 | * @param pipe_stdout pipe to use to get output from child process (or NULL) | 296 | * @param pipe_stdout pipe to use to get output from child process (or NULL) |
281 | * @param filename name of the binary | 297 | * @param filename name of the binary |
@@ -283,13 +299,15 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
283 | * @return pointer to process structure of the new process, NULL on error | 299 | * @return pointer to process structure of the new process, NULL on error |
284 | */ | 300 | */ |
285 | struct GNUNET_OS_Process * | 301 | struct GNUNET_OS_Process * |
286 | GNUNET_OS_start_process_va (struct GNUNET_DISK_PipeHandle *pipe_stdin, | 302 | GNUNET_OS_start_process_va (int pipe_control, |
303 | struct GNUNET_DISK_PipeHandle *pipe_stdin, | ||
287 | struct GNUNET_DISK_PipeHandle *pipe_stdout, | 304 | struct GNUNET_DISK_PipeHandle *pipe_stdout, |
288 | const char *filename, va_list va); | 305 | const char *filename, va_list va); |
289 | 306 | ||
290 | /** | 307 | /** |
291 | * Start a process. | 308 | * Start a process. |
292 | * | 309 | * |
310 | * @param pipe_control should a pipe be used to send signals to the child? | ||
293 | * @param lsocks array of listen sockets to dup systemd-style (or NULL); | 311 | * @param lsocks array of listen sockets to dup systemd-style (or NULL); |
294 | * must be NULL on platforms where dup is not supported | 312 | * must be NULL on platforms where dup is not supported |
295 | * @param filename name of the binary | 313 | * @param filename name of the binary |
@@ -298,7 +316,9 @@ GNUNET_OS_start_process_va (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
298 | * @return pointer to process structure of the new process, NULL on error | 316 | * @return pointer to process structure of the new process, NULL on error |
299 | */ | 317 | */ |
300 | struct GNUNET_OS_Process * | 318 | struct GNUNET_OS_Process * |
301 | GNUNET_OS_start_process_v (const SOCKTYPE *lsocks, const char *filename, | 319 | GNUNET_OS_start_process_v (int pipe_control, |
320 | const SOCKTYPE *lsocks, | ||
321 | const char *filename, | ||
302 | char *const argv[]); | 322 | char *const argv[]); |
303 | 323 | ||
304 | 324 | ||
@@ -307,6 +327,7 @@ GNUNET_OS_start_process_v (const SOCKTYPE *lsocks, const char *filename, | |||
307 | */ | 327 | */ |
308 | struct GNUNET_OS_CommandHandle; | 328 | struct GNUNET_OS_CommandHandle; |
309 | 329 | ||
330 | |||
310 | /** | 331 | /** |
311 | * Type of a function to process a line of output. | 332 | * Type of a function to process a line of output. |
312 | * | 333 | * |
@@ -315,6 +336,7 @@ struct GNUNET_OS_CommandHandle; | |||
315 | */ | 336 | */ |
316 | typedef void (*GNUNET_OS_LineProcessor) (void *cls, const char *line); | 337 | typedef void (*GNUNET_OS_LineProcessor) (void *cls, const char *line); |
317 | 338 | ||
339 | |||
318 | /** | 340 | /** |
319 | * Stop/kill a command. | 341 | * Stop/kill a command. |
320 | * | 342 | * |
@@ -370,7 +392,13 @@ GNUNET_OS_process_wait (struct GNUNET_OS_Process *proc); | |||
370 | 392 | ||
371 | 393 | ||
372 | /** | 394 | /** |
373 | * Connects this process to its parent via pipe | 395 | * Connects this process to its parent via pipe; |
396 | * essentially, the parent control handler will read signal numbers | ||
397 | * from the 'GNUNET_OS_CONTROL_PIPE' (as given in an environment | ||
398 | * variable) and raise those signals. | ||
399 | * | ||
400 | * @param cls closure (unused) | ||
401 | * @param tc scheduler context (unused) | ||
374 | */ | 402 | */ |
375 | void | 403 | void |
376 | GNUNET_OS_install_parent_control_handler (void *cls, | 404 | GNUNET_OS_install_parent_control_handler (void *cls, |
diff --git a/src/include/platform.h b/src/include/platform.h index 179503731..7383e48ad 100644 --- a/src/include/platform.h +++ b/src/include/platform.h | |||
@@ -107,6 +107,7 @@ | |||
107 | #include <stdarg.h> | 107 | #include <stdarg.h> |
108 | #include <errno.h> | 108 | #include <errno.h> |
109 | #include <signal.h> | 109 | #include <signal.h> |
110 | #include <libgen.h> | ||
110 | #ifdef WINDOWS | 111 | #ifdef WINDOWS |
111 | #include <malloc.h> /* for alloca(), on other OSes it's in stdlib.h */ | 112 | #include <malloc.h> /* for alloca(), on other OSes it's in stdlib.h */ |
112 | #endif | 113 | #endif |
diff --git a/src/mesh/test_mesh_api.c b/src/mesh/test_mesh_api.c index d92c25938..fbc1fbaff 100644 --- a/src/mesh/test_mesh_api.c +++ b/src/mesh/test_mesh_api.c | |||
@@ -139,7 +139,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
139 | #endif | 139 | #endif |
140 | NULL); | 140 | NULL); |
141 | arm_pid = | 141 | arm_pid = |
142 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 142 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
143 | "gnunet-service-arm", | 143 | "gnunet-service-arm", |
144 | #if VERBOSE_ARM | 144 | #if VERBOSE_ARM |
145 | "-L", "DEBUG", | 145 | "-L", "DEBUG", |
diff --git a/src/mesh/test_mesh_local_1.c b/src/mesh/test_mesh_local_1.c index da65b36c4..73e2bdc13 100644 --- a/src/mesh/test_mesh_local_1.c +++ b/src/mesh/test_mesh_local_1.c | |||
@@ -300,7 +300,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
300 | #endif | 300 | #endif |
301 | NULL); | 301 | NULL); |
302 | arm_pid = | 302 | arm_pid = |
303 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 303 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
304 | "gnunet-service-arm", | 304 | "gnunet-service-arm", |
305 | #if VERBOSE_ARM | 305 | #if VERBOSE_ARM |
306 | "-L", "DEBUG", | 306 | "-L", "DEBUG", |
diff --git a/src/mesh/test_mesh_local_2.c b/src/mesh/test_mesh_local_2.c index eff15046f..b185f1b84 100644 --- a/src/mesh/test_mesh_local_2.c +++ b/src/mesh/test_mesh_local_2.c | |||
@@ -293,7 +293,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
293 | #endif | 293 | #endif |
294 | NULL); | 294 | NULL); |
295 | arm_pid = | 295 | arm_pid = |
296 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 296 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
297 | "gnunet-service-arm", | 297 | "gnunet-service-arm", |
298 | #if VERBOSE_ARM | 298 | #if VERBOSE_ARM |
299 | "-L", "DEBUG", | 299 | "-L", "DEBUG", |
diff --git a/src/namestore/test_namestore_api.c b/src/namestore/test_namestore_api.c index 3fd84d20f..62cfa808a 100644 --- a/src/namestore/test_namestore_api.c +++ b/src/namestore/test_namestore_api.c | |||
@@ -40,7 +40,7 @@ static int res; | |||
40 | static void | 40 | static void |
41 | start_arm (const char *cfgname) | 41 | start_arm (const char *cfgname) |
42 | { | 42 | { |
43 | arm = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 43 | arm = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
44 | "gnunet-service-arm", "-c", cfgname, | 44 | "gnunet-service-arm", "-c", cfgname, |
45 | #if VERBOSE_PEERS | 45 | #if VERBOSE_PEERS |
46 | "-L", "DEBUG", | 46 | "-L", "DEBUG", |
diff --git a/src/nat/nat.c b/src/nat/nat.c index 02ff7547b..744583f3d 100644 --- a/src/nat/nat.c +++ b/src/nat/nat.c | |||
@@ -843,7 +843,7 @@ start_gnunet_nat_server (struct GNUNET_NAT_Handle *h) | |||
843 | #endif | 843 | #endif |
844 | /* Start the server process */ | 844 | /* Start the server process */ |
845 | h->server_proc = | 845 | h->server_proc = |
846 | GNUNET_OS_start_process (NULL, h->server_stdout, | 846 | GNUNET_OS_start_process (GNUNET_NO, NULL, h->server_stdout, |
847 | "gnunet-helper-nat-server", | 847 | "gnunet-helper-nat-server", |
848 | "gnunet-helper-nat-server", | 848 | "gnunet-helper-nat-server", |
849 | h->internal_address, NULL); | 849 | h->internal_address, NULL); |
@@ -1342,7 +1342,8 @@ GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h, | |||
1342 | inet4, (unsigned int) h->adv_port); | 1342 | inet4, (unsigned int) h->adv_port); |
1343 | #endif | 1343 | #endif |
1344 | proc = | 1344 | proc = |
1345 | GNUNET_OS_start_process (NULL, NULL, "gnunet-helper-nat-client", | 1345 | GNUNET_OS_start_process (GNUNET_NO, |
1346 | NULL, NULL, "gnunet-helper-nat-client", | ||
1346 | "gnunet-helper-nat-client", h->internal_address, | 1347 | "gnunet-helper-nat-client", h->internal_address, |
1347 | inet4, port_as_string, NULL); | 1348 | inet4, port_as_string, NULL); |
1348 | if (NULL == proc) | 1349 | if (NULL == proc) |
diff --git a/src/nat/nat_mini.c b/src/nat/nat_mini.c index 6c48f28fe..830fdfd50 100644 --- a/src/nat/nat_mini.c +++ b/src/nat/nat_mini.c | |||
@@ -176,7 +176,7 @@ GNUNET_NAT_mini_get_external_ipv4 (struct GNUNET_TIME_Relative timeout, | |||
176 | return NULL; | 176 | return NULL; |
177 | } | 177 | } |
178 | eh->eip = | 178 | eh->eip = |
179 | GNUNET_OS_start_process (NULL, eh->opipe, "external-ip", "external-ip", | 179 | GNUNET_OS_start_process (GNUNET_NO, NULL, eh->opipe, "external-ip", "external-ip", |
180 | NULL); | 180 | NULL); |
181 | if (NULL == eh->eip) | 181 | if (NULL == eh->eip) |
182 | { | 182 | { |
diff --git a/src/nat/test_nat_test.c b/src/nat/test_nat_test.c index 2b9ef0f7c..64617880a 100644 --- a/src/nat/test_nat_test.c +++ b/src/nat/test_nat_test.c | |||
@@ -118,7 +118,7 @@ main (int argc, char *const argv[]) | |||
118 | } | 118 | } |
119 | 119 | ||
120 | gns = | 120 | gns = |
121 | GNUNET_OS_start_process (NULL, NULL, "gnunet-nat-server", | 121 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-nat-server", |
122 | "gnunet-nat-server", | 122 | "gnunet-nat-server", |
123 | #if VERBOSE | 123 | #if VERBOSE |
124 | "-L", "DEBUG", | 124 | "-L", "DEBUG", |
diff --git a/src/nse/test_nse_api.c b/src/nse/test_nse_api.c index 7e0ab0bbc..f6cde3fe4 100644 --- a/src/nse/test_nse_api.c +++ b/src/nse/test_nse_api.c | |||
@@ -110,7 +110,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
110 | p->cfg = GNUNET_CONFIGURATION_create (); | 110 | p->cfg = GNUNET_CONFIGURATION_create (); |
111 | #if START_ARM | 111 | #if START_ARM |
112 | p->arm_proc = | 112 | p->arm_proc = |
113 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 113 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
114 | "gnunet-service-arm", | 114 | "gnunet-service-arm", |
115 | #if VERBOSE_ARM | 115 | #if VERBOSE_ARM |
116 | "-L", "DEBUG", | 116 | "-L", "DEBUG", |
diff --git a/src/peerinfo/test_peerinfo_api.c b/src/peerinfo/test_peerinfo_api.c index fbd12c387..71da46be4 100644 --- a/src/peerinfo/test_peerinfo_api.c +++ b/src/peerinfo/test_peerinfo_api.c | |||
@@ -179,7 +179,7 @@ check () | |||
179 | GNUNET_GETOPT_OPTION_END | 179 | GNUNET_GETOPT_OPTION_END |
180 | }; | 180 | }; |
181 | proc = | 181 | proc = |
182 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-peerinfo", | 182 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-peerinfo", |
183 | "gnunet-service-peerinfo", | 183 | "gnunet-service-peerinfo", |
184 | #if DEBUG_PEERINFO | 184 | #if DEBUG_PEERINFO |
185 | "-L", "DEBUG", | 185 | "-L", "DEBUG", |
diff --git a/src/statistics/test_statistics_api.c b/src/statistics/test_statistics_api.c index efaf2d2ee..0647a4942 100644 --- a/src/statistics/test_statistics_api.c +++ b/src/statistics/test_statistics_api.c | |||
@@ -144,7 +144,7 @@ check () | |||
144 | struct GNUNET_OS_Process *proc; | 144 | struct GNUNET_OS_Process *proc; |
145 | 145 | ||
146 | proc = | 146 | proc = |
147 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", | 147 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-statistics", |
148 | "gnunet-service-statistics", | 148 | "gnunet-service-statistics", |
149 | #if DEBUG_STATISTICS | 149 | #if DEBUG_STATISTICS |
150 | "-L", "DEBUG", | 150 | "-L", "DEBUG", |
@@ -170,7 +170,7 @@ check () | |||
170 | #if START_SERVICE | 170 | #if START_SERVICE |
171 | /* restart to check persistence! */ | 171 | /* restart to check persistence! */ |
172 | proc = | 172 | proc = |
173 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", | 173 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-statistics", |
174 | "gnunet-service-statistics", | 174 | "gnunet-service-statistics", |
175 | #if DEBUG_STATISTICS | 175 | #if DEBUG_STATISTICS |
176 | "-L", "DEBUG", | 176 | "-L", "DEBUG", |
diff --git a/src/statistics/test_statistics_api_loop.c b/src/statistics/test_statistics_api_loop.c index eb739b752..32b176caa 100644 --- a/src/statistics/test_statistics_api_loop.c +++ b/src/statistics/test_statistics_api_loop.c | |||
@@ -97,7 +97,7 @@ check () | |||
97 | struct GNUNET_OS_Process *proc; | 97 | struct GNUNET_OS_Process *proc; |
98 | 98 | ||
99 | proc = | 99 | proc = |
100 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", | 100 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-statistics", |
101 | "gnunet-service-statistics", | 101 | "gnunet-service-statistics", |
102 | #if DEBUG_STATISTICS | 102 | #if DEBUG_STATISTICS |
103 | "-L", "DEBUG", | 103 | "-L", "DEBUG", |
diff --git a/src/statistics/test_statistics_api_watch.c b/src/statistics/test_statistics_api_watch.c index a70b8b311..979b5610e 100644 --- a/src/statistics/test_statistics_api_watch.c +++ b/src/statistics/test_statistics_api_watch.c | |||
@@ -127,7 +127,7 @@ check () | |||
127 | struct GNUNET_OS_Process *proc; | 127 | struct GNUNET_OS_Process *proc; |
128 | 128 | ||
129 | proc = | 129 | proc = |
130 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-statistics", | 130 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-statistics", |
131 | "gnunet-service-statistics", | 131 | "gnunet-service-statistics", |
132 | #if VERBOSE | 132 | #if VERBOSE |
133 | "-L", "DEBUG", | 133 | "-L", "DEBUG", |
diff --git a/src/stream/test_stream_local.c b/src/stream/test_stream_local.c index 63347d826..4da1258fc 100644 --- a/src/stream/test_stream_local.c +++ b/src/stream/test_stream_local.c | |||
@@ -331,7 +331,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
331 | #endif | 331 | #endif |
332 | NULL); | 332 | NULL); |
333 | arm_pid = | 333 | arm_pid = |
334 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 334 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
335 | "gnunet-service-arm", | 335 | "gnunet-service-arm", |
336 | #if VERBOSE_ARM | 336 | #if VERBOSE_ARM |
337 | "-L", "DEBUG", | 337 | "-L", "DEBUG", |
diff --git a/src/stream/test_stream_local_halfclose.c b/src/stream/test_stream_local_halfclose.c index 5acaf213a..61e531ae8 100644 --- a/src/stream/test_stream_local_halfclose.c +++ b/src/stream/test_stream_local_halfclose.c | |||
@@ -327,7 +327,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
327 | #endif | 327 | #endif |
328 | NULL); | 328 | NULL); |
329 | arm_pid = | 329 | arm_pid = |
330 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 330 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
331 | "gnunet-service-arm", | 331 | "gnunet-service-arm", |
332 | #if VERBOSE_ARM | 332 | #if VERBOSE_ARM |
333 | "-L", "DEBUG", | 333 | "-L", "DEBUG", |
diff --git a/src/testing/test_testing_defaults.conf b/src/testing/test_testing_defaults.conf index c4810c303..36a4f76ea 100644 --- a/src/testing/test_testing_defaults.conf +++ b/src/testing/test_testing_defaults.conf | |||
@@ -61,3 +61,6 @@ AUTOSTART = NO | |||
61 | 61 | ||
62 | [dv] | 62 | [dv] |
63 | AUTOSTART = NO | 63 | AUTOSTART = NO |
64 | |||
65 | [chat] | ||
66 | AUTOSTART = NO | ||
diff --git a/src/testing/testing.c b/src/testing/testing.c index 70da138a7..16cee9037 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -97,11 +97,9 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
97 | GNUNET_NO, &test_address, &empty); | 97 | GNUNET_NO, &test_address, &empty); |
98 | if (GNUNET_YES == empty) | 98 | if (GNUNET_YES == empty) |
99 | { | 99 | { |
100 | #if DEBUG_TESTING | ||
101 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 100 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
102 | "Skipping empty HELLO address of peer %s\n", | 101 | "Skipping empty HELLO address of peer %s\n", |
103 | GNUNET_i2s (&daemon->id)); | 102 | GNUNET_i2s (&daemon->id)); |
104 | #endif | ||
105 | return; | 103 | return; |
106 | } | 104 | } |
107 | #endif | 105 | #endif |
@@ -113,11 +111,9 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
113 | 111 | ||
114 | if (daemon->server != NULL) | 112 | if (daemon->server != NULL) |
115 | { | 113 | { |
116 | #if DEBUG_TESTING | ||
117 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 114 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
118 | "Received `%s' from transport service of `%4s', disconnecting core!\n", | 115 | "Received `%s' from transport service of `%4s', disconnecting core!\n", |
119 | "HELLO", GNUNET_i2s (&daemon->id)); | 116 | "HELLO", GNUNET_i2s (&daemon->id)); |
120 | #endif | ||
121 | GNUNET_CORE_disconnect (daemon->server); | 117 | GNUNET_CORE_disconnect (daemon->server); |
122 | daemon->server = NULL; | 118 | daemon->server = NULL; |
123 | } | 119 | } |
@@ -135,12 +131,9 @@ process_hello (void *cls, const struct GNUNET_MessageHeader *message) | |||
135 | GNUNET_TRANSPORT_get_hello_cancel (daemon->ghh); | 131 | GNUNET_TRANSPORT_get_hello_cancel (daemon->ghh); |
136 | daemon->ghh = NULL; | 132 | daemon->ghh = NULL; |
137 | } | 133 | } |
138 | #if DEBUG_TESTING | ||
139 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 134 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
140 | "Received `%s' from transport service of `%4s'\n", "HELLO", | 135 | "Received `%s' from transport service of `%4s'\n", "HELLO", |
141 | GNUNET_i2s (&daemon->id)); | 136 | GNUNET_i2s (&daemon->id)); |
142 | #endif | ||
143 | |||
144 | GNUNET_free_non_null (daemon->hello); | 137 | GNUNET_free_non_null (daemon->hello); |
145 | daemon->hello = GNUNET_malloc (msize); | 138 | daemon->hello = GNUNET_malloc (msize); |
146 | memcpy (daemon->hello, message, msize); | 139 | memcpy (daemon->hello, message, msize); |
@@ -192,11 +185,8 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
192 | char *dst; | 185 | char *dst; |
193 | int bytes_read; | 186 | int bytes_read; |
194 | 187 | ||
195 | #if DEBUG_TESTING | ||
196 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer %s FSM is in phase %u.\n", | 188 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer %s FSM is in phase %u.\n", |
197 | GNUNET_i2s (&d->id), d->phase); | 189 | GNUNET_i2s (&d->id), d->phase); |
198 | #endif | ||
199 | |||
200 | d->task = GNUNET_SCHEDULER_NO_TASK; | 190 | d->task = GNUNET_SCHEDULER_NO_TASK; |
201 | switch (d->phase) | 191 | switch (d->phase) |
202 | { | 192 | { |
@@ -229,10 +219,8 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
229 | return; | 219 | return; |
230 | } | 220 | } |
231 | GNUNET_OS_process_close (d->proc); | 221 | GNUNET_OS_process_close (d->proc); |
232 | #if DEBUG_TESTING | ||
233 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 222 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
234 | "Successfully copied configuration file.\n"); | 223 | "Successfully copied configuration file.\n"); |
235 | #endif | ||
236 | d->phase = SP_COPIED; | 224 | d->phase = SP_COPIED; |
237 | /* fall-through */ | 225 | /* fall-through */ |
238 | case SP_COPIED: | 226 | case SP_COPIED: |
@@ -254,14 +242,12 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
254 | } | 242 | } |
255 | if (NULL == d->hostname) | 243 | if (NULL == d->hostname) |
256 | { | 244 | { |
257 | #if DEBUG_TESTING | ||
258 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 245 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
259 | "Starting `%s', with command `%s %s %s %s'.\n", | 246 | "Starting `%s', with command `%s %s %s %s'.\n", |
260 | "gnunet-peerinfo", "gnunet-peerinfo", "-c", d->cfgfile, | 247 | "gnunet-peerinfo", "gnunet-peerinfo", "-c", d->cfgfile, |
261 | "-sq"); | 248 | "-sq"); |
262 | #endif | ||
263 | d->proc = | 249 | d->proc = |
264 | GNUNET_OS_start_process (NULL, d->pipe_stdout, "gnunet-peerinfo", | 250 | GNUNET_OS_start_process (GNUNET_YES, NULL, d->pipe_stdout, "gnunet-peerinfo", |
265 | "gnunet-peerinfo", "-c", d->cfgfile, "-sq", | 251 | "gnunet-peerinfo", "-c", d->cfgfile, "-sq", |
266 | NULL); | 252 | NULL); |
267 | GNUNET_DISK_pipe_close_end (d->pipe_stdout, GNUNET_DISK_PIPE_END_WRITE); | 253 | GNUNET_DISK_pipe_close_end (d->pipe_stdout, GNUNET_DISK_PIPE_END_WRITE); |
@@ -273,15 +259,13 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
273 | else | 259 | else |
274 | dst = GNUNET_strdup (d->hostname); | 260 | dst = GNUNET_strdup (d->hostname); |
275 | 261 | ||
276 | #if DEBUG_TESTING | ||
277 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 262 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
278 | "Starting `%s', with command `%s %s %s %s %s %s'.\n", | 263 | "Starting `%s', with command `%s %s %s %s %s %s'.\n", |
279 | "gnunet-peerinfo", "ssh", dst, "gnunet-peerinfo", "-c", | 264 | "gnunet-peerinfo", "ssh", dst, "gnunet-peerinfo", "-c", |
280 | d->cfgfile, "-sq"); | 265 | d->cfgfile, "-sq"); |
281 | #endif | ||
282 | if (d->ssh_port_str == NULL) | 266 | if (d->ssh_port_str == NULL) |
283 | { | 267 | { |
284 | d->proc = GNUNET_OS_start_process (NULL, d->pipe_stdout, "ssh", "ssh", | 268 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, d->pipe_stdout, "ssh", "ssh", |
285 | #if !DEBUG_TESTING | 269 | #if !DEBUG_TESTING |
286 | "-q", | 270 | "-q", |
287 | #endif | 271 | #endif |
@@ -291,7 +275,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
291 | else | 275 | else |
292 | { | 276 | { |
293 | d->proc = | 277 | d->proc = |
294 | GNUNET_OS_start_process (NULL, d->pipe_stdout, "ssh", "ssh", "-p", | 278 | GNUNET_OS_start_process (GNUNET_NO, NULL, d->pipe_stdout, "ssh", "ssh", "-p", |
295 | d->ssh_port_str, | 279 | d->ssh_port_str, |
296 | #if !DEBUG_TESTING | 280 | #if !DEBUG_TESTING |
297 | "-q", | 281 | "-q", |
@@ -317,10 +301,8 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
317 | GNUNET_DISK_pipe_close (d->pipe_stdout); | 301 | GNUNET_DISK_pipe_close (d->pipe_stdout); |
318 | return; | 302 | return; |
319 | } | 303 | } |
320 | #if DEBUG_TESTING | ||
321 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 304 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
322 | "Started `%s', waiting for hostkey.\n", "gnunet-peerinfo"); | 305 | "Started `%s', waiting for hostkey.\n", "gnunet-peerinfo"); |
323 | #endif | ||
324 | d->phase = SP_HOSTKEY_CREATE; | 306 | d->phase = SP_HOSTKEY_CREATE; |
325 | d->task = | 307 | d->task = |
326 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_absolute_get_remaining | 308 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_absolute_get_remaining |
@@ -410,9 +392,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
410 | { | 392 | { |
411 | d->phase = SP_TOPOLOGY_SETUP; | 393 | d->phase = SP_TOPOLOGY_SETUP; |
412 | } | 394 | } |
413 | #if DEBUG_TESTING | ||
414 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully got hostkey!\n"); | 395 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully got hostkey!\n"); |
415 | #endif | ||
416 | /* Fall through */ | 396 | /* Fall through */ |
417 | case SP_HOSTKEY_CREATED: | 397 | case SP_HOSTKEY_CREATED: |
418 | /* wait for topology finished */ | 398 | /* wait for topology finished */ |
@@ -435,18 +415,14 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
435 | /* start GNUnet on remote host */ | 415 | /* start GNUnet on remote host */ |
436 | if (NULL == d->hostname) | 416 | if (NULL == d->hostname) |
437 | { | 417 | { |
438 | #if DEBUG_TESTING | ||
439 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 418 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
440 | "Starting `%s', with command `%s %s %s %s %s %s'.\n", | 419 | "Starting `%s', with command `%s %s %s %s %s %s'.\n", |
441 | "gnunet-arm", "gnunet-arm", "-c", d->cfgfile, "-L", "DEBUG", | 420 | "gnunet-arm", "gnunet-arm", "-c", d->cfgfile, "-L", "DEBUG", |
442 | "-s"); | 421 | "-s"); |
443 | #endif | ||
444 | d->proc = | 422 | d->proc = |
445 | GNUNET_OS_start_process (NULL, NULL, "gnunet-arm", "gnunet-arm", "-c", | 423 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", "-c", |
446 | d->cfgfile, | 424 | d->cfgfile, |
447 | #if DEBUG_TESTING | ||
448 | "-L", "DEBUG", | 425 | "-L", "DEBUG", |
449 | #endif | ||
450 | "-s", "-q", "-T", | 426 | "-s", "-q", "-T", |
451 | GNUNET_TIME_relative_to_string | 427 | GNUNET_TIME_relative_to_string |
452 | (GNUNET_TIME_absolute_get_remaining | 428 | (GNUNET_TIME_absolute_get_remaining |
@@ -459,15 +435,13 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
459 | else | 435 | else |
460 | dst = GNUNET_strdup (d->hostname); | 436 | dst = GNUNET_strdup (d->hostname); |
461 | 437 | ||
462 | #if DEBUG_TESTING | ||
463 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 438 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
464 | "Starting `%s', with command `%s %s %s %s %s %s %s %s'.\n", | 439 | "Starting `%s', with command `%s %s %s %s %s %s %s %s'.\n", |
465 | "gnunet-arm", "ssh", dst, "gnunet-arm", "-c", d->cfgfile, | 440 | "gnunet-arm", "ssh", dst, "gnunet-arm", "-c", d->cfgfile, |
466 | "-L", "DEBUG", "-s", "-q"); | 441 | "-L", "DEBUG", "-s", "-q"); |
467 | #endif | ||
468 | if (d->ssh_port_str == NULL) | 442 | if (d->ssh_port_str == NULL) |
469 | { | 443 | { |
470 | d->proc = GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", | 444 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", |
471 | #if !DEBUG_TESTING | 445 | #if !DEBUG_TESTING |
472 | "-q", | 446 | "-q", |
473 | #endif | 447 | #endif |
@@ -484,7 +458,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
484 | { | 458 | { |
485 | 459 | ||
486 | d->proc = | 460 | d->proc = |
487 | GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", "-p", | 461 | GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", "-p", |
488 | d->ssh_port_str, | 462 | d->ssh_port_str, |
489 | #if !DEBUG_TESTING | 463 | #if !DEBUG_TESTING |
490 | "-q", | 464 | "-q", |
@@ -514,11 +488,9 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
514 | _("Failed to start `ssh' process.\n")); | 488 | _("Failed to start `ssh' process.\n")); |
515 | return; | 489 | return; |
516 | } | 490 | } |
517 | #if DEBUG_TESTING | ||
518 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 491 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
519 | "Started `%s', waiting for `%s' to be up.\n", "gnunet-arm", | 492 | "Started `%s', waiting for `%s' to be up.\n", "gnunet-arm", |
520 | "gnunet-service-core"); | 493 | "gnunet-service-core"); |
521 | #endif | ||
522 | d->phase = SP_START_ARMING; | 494 | d->phase = SP_START_ARMING; |
523 | d->task = | 495 | d->task = |
524 | GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_EXEC_WAIT, &start_fsm, | 496 | GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_EXEC_WAIT, &start_fsm, |
@@ -561,15 +533,11 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
561 | d); | 533 | d); |
562 | return; | 534 | return; |
563 | } | 535 | } |
564 | #if DEBUG_TESTING | ||
565 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully started `%s'.\n", | 536 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully started `%s'.\n", |
566 | "gnunet-arm"); | 537 | "gnunet-arm"); |
567 | #endif | ||
568 | GNUNET_free (d->proc); | 538 | GNUNET_free (d->proc); |
569 | d->phase = SP_START_CORE; | 539 | d->phase = SP_START_CORE; |
570 | #if DEBUG_TESTING | ||
571 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Calling CORE_connect\n"); | 540 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Calling CORE_connect\n"); |
572 | #endif | ||
573 | /* Fall through */ | 541 | /* Fall through */ |
574 | case SP_START_CORE: | 542 | case SP_START_CORE: |
575 | if (d->server != NULL) | 543 | if (d->server != NULL) |
@@ -588,12 +556,9 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
588 | _("Failed to connect to transport service!\n")); | 556 | _("Failed to connect to transport service!\n")); |
589 | return; | 557 | return; |
590 | } | 558 | } |
591 | #if DEBUG_TESTING | ||
592 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 559 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
593 | "Connected to transport service `%s', getting HELLO\n", | 560 | "Connected to transport service `%s', getting HELLO\n", |
594 | GNUNET_i2s (&d->id)); | 561 | GNUNET_i2s (&d->id)); |
595 | #endif | ||
596 | |||
597 | d->ghh = GNUNET_TRANSPORT_get_hello (d->th, &process_hello, d); | 562 | d->ghh = GNUNET_TRANSPORT_get_hello (d->th, &process_hello, d); |
598 | /* FIXME: store task ID somewhere! */ | 563 | /* FIXME: store task ID somewhere! */ |
599 | GNUNET_SCHEDULER_add_now (¬ify_daemon_started, d); | 564 | GNUNET_SCHEDULER_add_now (¬ify_daemon_started, d); |
@@ -669,9 +634,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
669 | return; | 634 | return; |
670 | } | 635 | } |
671 | #endif | 636 | #endif |
672 | #if DEBUG_TESTING | ||
673 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service startup complete!\n"); | 637 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service startup complete!\n"); |
674 | #endif | ||
675 | cb = d->cb; | 638 | cb = d->cb; |
676 | d->cb = NULL; | 639 | d->cb = NULL; |
677 | d->phase = SP_START_DONE; | 640 | d->phase = SP_START_DONE; |
@@ -706,9 +669,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
706 | return; | 669 | return; |
707 | } | 670 | } |
708 | #endif | 671 | #endif |
709 | #if DEBUG_TESTING | ||
710 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service shutdown complete.\n"); | 672 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service shutdown complete.\n"); |
711 | #endif | ||
712 | if (NULL != d->dead_cb) | 673 | if (NULL != d->dead_cb) |
713 | d->dead_cb (d->dead_cb_cls, NULL); | 674 | d->dead_cb (d->dead_cb_cls, NULL); |
714 | break; | 675 | break; |
@@ -784,9 +745,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
784 | GNUNET_free (d); | 745 | GNUNET_free (d); |
785 | return; | 746 | return; |
786 | } | 747 | } |
787 | #if DEBUG_TESTING | ||
788 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer shutdown complete.\n"); | 748 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer shutdown complete.\n"); |
789 | #endif | ||
790 | if (d->server != NULL) | 749 | if (d->server != NULL) |
791 | { | 750 | { |
792 | GNUNET_CORE_disconnect (d->server); | 751 | GNUNET_CORE_disconnect (d->server); |
@@ -849,10 +808,8 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
849 | d->update_cb (d->update_cb_cls, _("`scp' did not complete cleanly.\n")); | 808 | d->update_cb (d->update_cb_cls, _("`scp' did not complete cleanly.\n")); |
850 | return; | 809 | return; |
851 | } | 810 | } |
852 | #if DEBUG_TESTING | ||
853 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 811 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
854 | "Successfully copied configuration file.\n"); | 812 | "Successfully copied configuration file.\n"); |
855 | #endif | ||
856 | if (NULL != d->update_cb) | 813 | if (NULL != d->update_cb) |
857 | d->update_cb (d->update_cb_cls, NULL); | 814 | d->update_cb (d->update_cb_cls, NULL); |
858 | d->phase = SP_START_DONE; | 815 | d->phase = SP_START_DONE; |
@@ -937,18 +894,15 @@ GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon *d, | |||
937 | /* Check if this is a local or remote process */ | 894 | /* Check if this is a local or remote process */ |
938 | if (NULL != d->hostname) | 895 | if (NULL != d->hostname) |
939 | { | 896 | { |
940 | #if DEBUG_TESTING | ||
941 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 897 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
942 | "Starting gnunet-arm with config `%s' on host `%s'.\n", | 898 | "Starting gnunet-arm with config `%s' on host `%s'.\n", |
943 | d->cfgfile, d->hostname); | 899 | d->cfgfile, d->hostname); |
944 | #endif | ||
945 | |||
946 | if (d->username != NULL) | 900 | if (d->username != NULL) |
947 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); | 901 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); |
948 | else | 902 | else |
949 | arg = GNUNET_strdup (d->hostname); | 903 | arg = GNUNET_strdup (d->hostname); |
950 | 904 | ||
951 | d->proc = GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", | 905 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", |
952 | #if !DEBUG_TESTING | 906 | #if !DEBUG_TESTING |
953 | "-q", | 907 | "-q", |
954 | #endif | 908 | #endif |
@@ -967,11 +921,9 @@ GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon *d, | |||
967 | } | 921 | } |
968 | else | 922 | else |
969 | { | 923 | { |
970 | #if DEBUG_TESTING | ||
971 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 924 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
972 | "Starting gnunet-arm with config `%s' locally.\n", d->cfgfile); | 925 | "Starting gnunet-arm with config `%s' locally.\n", d->cfgfile); |
973 | #endif | 926 | d->proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", |
974 | d->proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-arm", "gnunet-arm", | ||
975 | #if DEBUG_TESTING | 927 | #if DEBUG_TESTING |
976 | "-L", "DEBUG", | 928 | "-L", "DEBUG", |
977 | #endif | 929 | #endif |
@@ -1010,29 +962,23 @@ GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d, | |||
1010 | GNUNET_assert (d->running == GNUNET_YES); | 962 | GNUNET_assert (d->running == GNUNET_YES); |
1011 | GNUNET_assert (d->phase == SP_START_DONE); | 963 | GNUNET_assert (d->phase == SP_START_DONE); |
1012 | 964 | ||
1013 | #if DEBUG_TESTING | ||
1014 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 965 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1015 | _("Starting service %s for peer `%4s'\n"), service, | 966 | _("Starting service %s for peer `%4s'\n"), service, |
1016 | GNUNET_i2s (&d->id)); | 967 | GNUNET_i2s (&d->id)); |
1017 | #endif | ||
1018 | |||
1019 | d->phase = SP_SERVICE_START; | 968 | d->phase = SP_SERVICE_START; |
1020 | d->max_timeout = GNUNET_TIME_relative_to_absolute (timeout); | 969 | d->max_timeout = GNUNET_TIME_relative_to_absolute (timeout); |
1021 | /* Check if this is a local or remote process */ | 970 | /* Check if this is a local or remote process */ |
1022 | if (NULL != d->hostname) | 971 | if (NULL != d->hostname) |
1023 | { | 972 | { |
1024 | #if DEBUG_TESTING | ||
1025 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 973 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1026 | "Starting gnunet-arm with config `%s' on host `%s'.\n", | 974 | "Starting gnunet-arm with config `%s' on host `%s'.\n", |
1027 | d->cfgfile, d->hostname); | 975 | d->cfgfile, d->hostname); |
1028 | #endif | ||
1029 | |||
1030 | if (d->username != NULL) | 976 | if (d->username != NULL) |
1031 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); | 977 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); |
1032 | else | 978 | else |
1033 | arg = GNUNET_strdup (d->hostname); | 979 | arg = GNUNET_strdup (d->hostname); |
1034 | 980 | ||
1035 | d->proc = GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", | 981 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", |
1036 | #if !DEBUG_TESTING | 982 | #if !DEBUG_TESTING |
1037 | "-q", | 983 | "-q", |
1038 | #endif | 984 | #endif |
@@ -1052,11 +998,9 @@ GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d, | |||
1052 | } | 998 | } |
1053 | else | 999 | else |
1054 | { | 1000 | { |
1055 | #if DEBUG_TESTING | ||
1056 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1001 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1057 | "Starting gnunet-arm with config `%s' locally.\n", d->cfgfile); | 1002 | "Starting gnunet-arm with config `%s' locally.\n", d->cfgfile); |
1058 | #endif | 1003 | d->proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", |
1059 | d->proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-arm", "gnunet-arm", | ||
1060 | #if DEBUG_TESTING | 1004 | #if DEBUG_TESTING |
1061 | "-L", "DEBUG", | 1005 | "-L", "DEBUG", |
1062 | #endif | 1006 | #endif |
@@ -1169,10 +1113,8 @@ GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1169 | GNUNET_asprintf (&temp_file_name, "%s/gnunet-testing-config", servicehome); | 1113 | GNUNET_asprintf (&temp_file_name, "%s/gnunet-testing-config", servicehome); |
1170 | ret->cfgfile = GNUNET_DISK_mktemp (temp_file_name); | 1114 | ret->cfgfile = GNUNET_DISK_mktemp (temp_file_name); |
1171 | GNUNET_free (temp_file_name); | 1115 | GNUNET_free (temp_file_name); |
1172 | #if DEBUG_TESTING | ||
1173 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1116 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1174 | "Setting up peer with configuration file `%s'.\n", ret->cfgfile); | 1117 | "Setting up peer with configuration file `%s'.\n", ret->cfgfile); |
1175 | #endif | ||
1176 | if (NULL == ret->cfgfile) | 1118 | if (NULL == ret->cfgfile) |
1177 | { | 1119 | { |
1178 | GNUNET_free_non_null (ret->ssh_port_str); | 1120 | GNUNET_free_non_null (ret->ssh_port_str); |
@@ -1249,10 +1191,8 @@ GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1249 | /* copy directory to remote host */ | 1191 | /* copy directory to remote host */ |
1250 | if (NULL != hostname) | 1192 | if (NULL != hostname) |
1251 | { | 1193 | { |
1252 | #if DEBUG_TESTING | ||
1253 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1194 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1254 | "Copying configuration directory to host `%s'.\n", hostname); | 1195 | "Copying configuration directory to host `%s'.\n", hostname); |
1255 | #endif | ||
1256 | baseservicehome = GNUNET_strdup (servicehome); | 1196 | baseservicehome = GNUNET_strdup (servicehome); |
1257 | /* Remove trailing /'s */ | 1197 | /* Remove trailing /'s */ |
1258 | while (baseservicehome[strlen (baseservicehome) - 1] == '/') | 1198 | while (baseservicehome[strlen (baseservicehome) - 1] == '/') |
@@ -1270,21 +1210,19 @@ GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1270 | GNUNET_free (baseservicehome); | 1210 | GNUNET_free (baseservicehome); |
1271 | if (ret->ssh_port_str == NULL) | 1211 | if (ret->ssh_port_str == NULL) |
1272 | { | 1212 | { |
1273 | ret->proc = GNUNET_OS_start_process (NULL, NULL, "scp", "scp", "-r", | 1213 | ret->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", "-r", |
1274 | #if !DEBUG_TESTING | 1214 | #if !DEBUG_TESTING |
1275 | "-q", | 1215 | "-q", |
1276 | #endif | 1216 | #endif |
1277 | servicehome, arg, NULL); | 1217 | servicehome, arg, NULL); |
1278 | #if DEBUG_TESTING | ||
1279 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1218 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1280 | "copying directory with command scp -r %s %s\n", | 1219 | "copying directory with command scp -r %s %s\n", |
1281 | servicehome, arg); | 1220 | servicehome, arg); |
1282 | #endif | ||
1283 | } | 1221 | } |
1284 | else | 1222 | else |
1285 | { | 1223 | { |
1286 | ret->proc = | 1224 | ret->proc = |
1287 | GNUNET_OS_start_process (NULL, NULL, "scp", "scp", "-r", "-P", | 1225 | GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", "-r", "-P", |
1288 | ret->ssh_port_str, | 1226 | ret->ssh_port_str, |
1289 | #if !DEBUG_TESTING | 1227 | #if !DEBUG_TESTING |
1290 | "-q", | 1228 | "-q", |
@@ -1322,10 +1260,8 @@ GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1322 | GNUNET_free (servicehome); | 1260 | GNUNET_free (servicehome); |
1323 | return ret; | 1261 | return ret; |
1324 | } | 1262 | } |
1325 | #if DEBUG_TESTING | ||
1326 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1263 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1327 | "No need to copy configuration file since we are running locally.\n"); | 1264 | "No need to copy configuration file since we are running locally.\n"); |
1328 | #endif | ||
1329 | ret->phase = SP_COPIED; | 1265 | ret->phase = SP_COPIED; |
1330 | /* FIXME: why add_cont? */ | 1266 | /* FIXME: why add_cont? */ |
1331 | GNUNET_SCHEDULER_add_continuation (&start_fsm, ret, | 1267 | GNUNET_SCHEDULER_add_continuation (&start_fsm, ret, |
@@ -1383,28 +1319,22 @@ GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d, | |||
1383 | /* state clean up and notifications */ | 1319 | /* state clean up and notifications */ |
1384 | GNUNET_free_non_null (d->hello); | 1320 | GNUNET_free_non_null (d->hello); |
1385 | 1321 | ||
1386 | #if DEBUG_TESTING | ||
1387 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Terminating peer `%4s'\n"), | 1322 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Terminating peer `%4s'\n"), |
1388 | GNUNET_i2s (&d->id)); | 1323 | GNUNET_i2s (&d->id)); |
1389 | #endif | ||
1390 | |||
1391 | d->phase = SP_START_ARMING; | 1324 | d->phase = SP_START_ARMING; |
1392 | 1325 | ||
1393 | /* Check if this is a local or remote process */ | 1326 | /* Check if this is a local or remote process */ |
1394 | if (NULL != d->hostname) | 1327 | if (NULL != d->hostname) |
1395 | { | 1328 | { |
1396 | #if DEBUG_TESTING | ||
1397 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1329 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1398 | "Stopping gnunet-arm with config `%s' on host `%s'.\n", | 1330 | "Stopping gnunet-arm with config `%s' on host `%s'.\n", |
1399 | d->cfgfile, d->hostname); | 1331 | d->cfgfile, d->hostname); |
1400 | #endif | ||
1401 | |||
1402 | if (d->username != NULL) | 1332 | if (d->username != NULL) |
1403 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); | 1333 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); |
1404 | else | 1334 | else |
1405 | arg = GNUNET_strdup (d->hostname); | 1335 | arg = GNUNET_strdup (d->hostname); |
1406 | 1336 | ||
1407 | d->proc = GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", | 1337 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", |
1408 | #if !DEBUG_TESTING | 1338 | #if !DEBUG_TESTING |
1409 | "-q", | 1339 | "-q", |
1410 | #endif | 1340 | #endif |
@@ -1419,11 +1349,9 @@ GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d, | |||
1419 | } | 1349 | } |
1420 | else | 1350 | else |
1421 | { | 1351 | { |
1422 | #if DEBUG_TESTING | ||
1423 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1352 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1424 | "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile); | 1353 | "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile); |
1425 | #endif | 1354 | d->proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", |
1426 | d->proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-arm", "gnunet-arm", | ||
1427 | #if DEBUG_TESTING | 1355 | #if DEBUG_TESTING |
1428 | "-L", "DEBUG", | 1356 | "-L", "DEBUG", |
1429 | #endif | 1357 | #endif |
@@ -1466,10 +1394,8 @@ GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d, | |||
1466 | d->phase = SP_START_DONE; | 1394 | d->phase = SP_START_DONE; |
1467 | } | 1395 | } |
1468 | 1396 | ||
1469 | #if DEBUG_TESTING | ||
1470 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Terminating peer `%4s'\n"), | 1397 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Terminating peer `%4s'\n"), |
1471 | GNUNET_i2s (&d->id)); | 1398 | GNUNET_i2s (&d->id)); |
1472 | #endif | ||
1473 | if (d->churned_services != NULL) | 1399 | if (d->churned_services != NULL) |
1474 | { | 1400 | { |
1475 | d->dead_cb (d->dead_cb_cls, "A service has already been turned off!!"); | 1401 | d->dead_cb (d->dead_cb_cls, "A service has already been turned off!!"); |
@@ -1481,18 +1407,15 @@ GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d, | |||
1481 | /* Check if this is a local or remote process */ | 1407 | /* Check if this is a local or remote process */ |
1482 | if (NULL != d->hostname) | 1408 | if (NULL != d->hostname) |
1483 | { | 1409 | { |
1484 | #if DEBUG_TESTING | ||
1485 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1410 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1486 | "Stopping gnunet-arm with config `%s' on host `%s'.\n", | 1411 | "Stopping gnunet-arm with config `%s' on host `%s'.\n", |
1487 | d->cfgfile, d->hostname); | 1412 | d->cfgfile, d->hostname); |
1488 | #endif | ||
1489 | |||
1490 | if (d->username != NULL) | 1413 | if (d->username != NULL) |
1491 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); | 1414 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); |
1492 | else | 1415 | else |
1493 | arg = GNUNET_strdup (d->hostname); | 1416 | arg = GNUNET_strdup (d->hostname); |
1494 | 1417 | ||
1495 | d->proc = GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", | 1418 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", |
1496 | #if !DEBUG_TESTING | 1419 | #if !DEBUG_TESTING |
1497 | "-q", | 1420 | "-q", |
1498 | #endif | 1421 | #endif |
@@ -1511,11 +1434,9 @@ GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d, | |||
1511 | } | 1434 | } |
1512 | else | 1435 | else |
1513 | { | 1436 | { |
1514 | #if DEBUG_TESTING | ||
1515 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1437 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1516 | "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile); | 1438 | "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile); |
1517 | #endif | 1439 | d->proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", |
1518 | d->proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-arm", "gnunet-arm", | ||
1519 | #if DEBUG_TESTING | 1440 | #if DEBUG_TESTING |
1520 | "-L", "DEBUG", | 1441 | "-L", "DEBUG", |
1521 | #endif | 1442 | #endif |
@@ -1556,10 +1477,8 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, | |||
1556 | 1477 | ||
1557 | if (NULL != d->cb) | 1478 | if (NULL != d->cb) |
1558 | { | 1479 | { |
1559 | #if DEBUG_TESTING | ||
1560 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Setting d->dead on peer `%4s'\n"), | 1480 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Setting d->dead on peer `%4s'\n"), |
1561 | GNUNET_i2s (&d->id)); | 1481 | GNUNET_i2s (&d->id)); |
1562 | #endif | ||
1563 | d->dead = GNUNET_YES; | 1482 | d->dead = GNUNET_YES; |
1564 | return; | 1483 | return; |
1565 | } | 1484 | } |
@@ -1604,10 +1523,8 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, | |||
1604 | } | 1523 | } |
1605 | */ | 1524 | */ |
1606 | /* shutdown ARM process (will terminate others) */ | 1525 | /* shutdown ARM process (will terminate others) */ |
1607 | #if DEBUG_TESTING | 1526 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Terminating peer `%4s'\n" , |
1608 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Terminating peer `%4s'\n"), | ||
1609 | GNUNET_i2s (&d->id)); | 1527 | GNUNET_i2s (&d->id)); |
1610 | #endif | ||
1611 | d->phase = SP_SHUTDOWN_START; | 1528 | d->phase = SP_SHUTDOWN_START; |
1612 | d->running = GNUNET_NO; | 1529 | d->running = GNUNET_NO; |
1613 | if (allow_restart == GNUNET_YES) | 1530 | if (allow_restart == GNUNET_YES) |
@@ -1622,18 +1539,15 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, | |||
1622 | /* Check if this is a local or remote process */ | 1539 | /* Check if this is a local or remote process */ |
1623 | if (NULL != d->hostname) | 1540 | if (NULL != d->hostname) |
1624 | { | 1541 | { |
1625 | #if DEBUG_TESTING | ||
1626 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1542 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1627 | "Stopping gnunet-arm with config `%s' on host `%s'.\n", | 1543 | "Stopping gnunet-arm with config `%s' on host `%s'.\n", |
1628 | d->cfgfile, d->hostname); | 1544 | d->cfgfile, d->hostname); |
1629 | #endif | ||
1630 | |||
1631 | if (d->username != NULL) | 1545 | if (d->username != NULL) |
1632 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); | 1546 | GNUNET_asprintf (&arg, "%s@%s", d->username, d->hostname); |
1633 | else | 1547 | else |
1634 | arg = GNUNET_strdup (d->hostname); | 1548 | arg = GNUNET_strdup (d->hostname); |
1635 | 1549 | ||
1636 | d->proc = GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", | 1550 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", |
1637 | #if !DEBUG_TESTING | 1551 | #if !DEBUG_TESTING |
1638 | "-q", | 1552 | "-q", |
1639 | #endif | 1553 | #endif |
@@ -1652,11 +1566,9 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, | |||
1652 | } | 1566 | } |
1653 | else | 1567 | else |
1654 | { | 1568 | { |
1655 | #if DEBUG_TESTING | ||
1656 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1569 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1657 | "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile); | 1570 | "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile); |
1658 | #endif | 1571 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "gnunet-arm", "gnunet-arm", |
1659 | d->proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-arm", "gnunet-arm", | ||
1660 | #if DEBUG_TESTING | 1572 | #if DEBUG_TESTING |
1661 | "-L", "DEBUG", | 1573 | "-L", "DEBUG", |
1662 | #endif | 1574 | #endif |
@@ -1715,17 +1627,15 @@ GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d, | |||
1715 | cb (cb_cls, NULL); | 1627 | cb (cb_cls, NULL); |
1716 | return; | 1628 | return; |
1717 | } | 1629 | } |
1718 | #if DEBUG_TESTING | ||
1719 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1630 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1720 | "Copying updated configuration file to remote host `%s'.\n", | 1631 | "Copying updated configuration file to remote host `%s'.\n", |
1721 | d->hostname); | 1632 | d->hostname); |
1722 | #endif | ||
1723 | d->phase = SP_CONFIG_UPDATE; | 1633 | d->phase = SP_CONFIG_UPDATE; |
1724 | if (NULL != d->username) | 1634 | if (NULL != d->username) |
1725 | GNUNET_asprintf (&arg, "%s@%s:%s", d->username, d->hostname, d->cfgfile); | 1635 | GNUNET_asprintf (&arg, "%s@%s:%s", d->username, d->hostname, d->cfgfile); |
1726 | else | 1636 | else |
1727 | GNUNET_asprintf (&arg, "%s:%s", d->hostname, d->cfgfile); | 1637 | GNUNET_asprintf (&arg, "%s:%s", d->hostname, d->cfgfile); |
1728 | d->proc = GNUNET_OS_start_process (NULL, NULL, "scp", "scp", | 1638 | d->proc = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", |
1729 | #if !DEBUG_TESTING | 1639 | #if !DEBUG_TESTING |
1730 | "-q", | 1640 | "-q", |
1731 | #endif | 1641 | #endif |
@@ -1915,11 +1825,8 @@ connect_notify (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
1915 | { | 1825 | { |
1916 | struct GNUNET_TESTING_ConnectContext *ctx = cls; | 1826 | struct GNUNET_TESTING_ConnectContext *ctx = cls; |
1917 | 1827 | ||
1918 | #if DEBUG_TESTING | ||
1919 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected peer %s to peer %s\n", | 1828 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected peer %s to peer %s\n", |
1920 | ctx->d1->shortname, GNUNET_i2s (peer)); | 1829 | ctx->d1->shortname, GNUNET_i2s (peer)); |
1921 | #endif | ||
1922 | |||
1923 | if (0 != memcmp (&ctx->d2->id, peer, sizeof (struct GNUNET_PeerIdentity))) | 1830 | if (0 != memcmp (&ctx->d2->id, peer, sizeof (struct GNUNET_PeerIdentity))) |
1924 | return; | 1831 | return; |
1925 | ctx->connected = GNUNET_YES; | 1832 | ctx->connected = GNUNET_YES; |
@@ -1949,18 +1856,14 @@ send_hello (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1949 | { | 1856 | { |
1950 | hello = GNUNET_HELLO_get_header (ctx->d2->hello); | 1857 | hello = GNUNET_HELLO_get_header (ctx->d2->hello); |
1951 | GNUNET_assert (hello != NULL); | 1858 | GNUNET_assert (hello != NULL); |
1952 | #if DEBUG_TESTING | ||
1953 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Offering hello of %s to %s\n", | 1859 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Offering hello of %s to %s\n", |
1954 | ctx->d2->shortname, ctx->d1->shortname); | 1860 | ctx->d2->shortname, ctx->d1->shortname); |
1955 | #endif | ||
1956 | GNUNET_TRANSPORT_offer_hello (ctx->d1th, hello, NULL, NULL); | 1861 | GNUNET_TRANSPORT_offer_hello (ctx->d1th, hello, NULL, NULL); |
1957 | GNUNET_assert (ctx->d1core != NULL); | 1862 | GNUNET_assert (ctx->d1core != NULL); |
1958 | #if DEBUG_TESTING | ||
1959 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1863 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1960 | "Sending connect request to TRANSPORT of %s for peer %s\n", | 1864 | "Sending connect request to TRANSPORT of %s for peer %s\n", |
1961 | GNUNET_i2s (&ctx->d1->id), | 1865 | GNUNET_i2s (&ctx->d1->id), |
1962 | GNUNET_h2s (&ctx->d2->id.hashPubKey)); | 1866 | GNUNET_h2s (&ctx->d2->id.hashPubKey)); |
1963 | #endif | ||
1964 | GNUNET_TRANSPORT_try_connect (ctx->d1th, &ctx->d2->id); | 1867 | GNUNET_TRANSPORT_try_connect (ctx->d1th, &ctx->d2->id); |
1965 | ctx->timeout_hello = | 1868 | ctx->timeout_hello = |
1966 | GNUNET_TIME_relative_add (ctx->timeout_hello, | 1869 | GNUNET_TIME_relative_add (ctx->timeout_hello, |
@@ -1989,13 +1892,10 @@ core_init_notify (void *cls, struct GNUNET_CORE_Handle *server, | |||
1989 | if (connect_ctx->send_hello == GNUNET_NO) | 1892 | if (connect_ctx->send_hello == GNUNET_NO) |
1990 | { | 1893 | { |
1991 | GNUNET_TRANSPORT_try_connect (connect_ctx->d1th, &connect_ctx->d2->id); | 1894 | GNUNET_TRANSPORT_try_connect (connect_ctx->d1th, &connect_ctx->d2->id); |
1992 | #if DEBUG_TESTING | ||
1993 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1895 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1994 | "Sending connect request to TRANSPORT of %s for peer %s\n", | 1896 | "Sending connect request to TRANSPORT of %s for peer %s\n", |
1995 | connect_ctx->d1->shortname, connect_ctx->d2->shortname); | 1897 | connect_ctx->d1->shortname, connect_ctx->d2->shortname); |
1996 | #endif | ||
1997 | } | 1898 | } |
1998 | |||
1999 | } | 1899 | } |
2000 | 1900 | ||
2001 | 1901 | ||
@@ -2015,11 +1915,9 @@ reattempt_daemons_connect (void *cls, | |||
2015 | ctx->timeout_task = GNUNET_SCHEDULER_NO_TASK; | 1915 | ctx->timeout_task = GNUNET_SCHEDULER_NO_TASK; |
2016 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) | 1916 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) |
2017 | return; | 1917 | return; |
2018 | #if DEBUG_TESTING_RECONNECT | ||
2019 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1918 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2020 | "re-attempting connect of peer %s to peer %s\n", | 1919 | "re-attempting connect of peer %s to peer %s\n", |
2021 | ctx->d1->shortname, ctx->d2->shortname); | 1920 | ctx->d1->shortname, ctx->d2->shortname); |
2022 | #endif | ||
2023 | ctx->connect_attempts--; | 1921 | ctx->connect_attempts--; |
2024 | GNUNET_assert (ctx->d1core == NULL); | 1922 | GNUNET_assert (ctx->d1core == NULL); |
2025 | ctx->d1core_ready = GNUNET_NO; | 1923 | ctx->d1core_ready = GNUNET_NO; |
@@ -2040,10 +1938,8 @@ reattempt_daemons_connect (void *cls, | |||
2040 | /* Don't know reason for initial connect failure, update the HELLO for the second peer */ | 1938 | /* Don't know reason for initial connect failure, update the HELLO for the second peer */ |
2041 | if (NULL != ctx->d2->hello) | 1939 | if (NULL != ctx->d2->hello) |
2042 | { | 1940 | { |
2043 | #if DEBUG_TESTING_RECONNECT | ||
2044 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "updating %s's HELLO\n", | 1941 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "updating %s's HELLO\n", |
2045 | ctx->d2->shortname); | 1942 | ctx->d2->shortname); |
2046 | #endif | ||
2047 | GNUNET_free (ctx->d2->hello); | 1943 | GNUNET_free (ctx->d2->hello); |
2048 | ctx->d2->hello = NULL; | 1944 | ctx->d2->hello = NULL; |
2049 | if (NULL != ctx->d2->th) | 1945 | if (NULL != ctx->d2->th) |
@@ -2059,21 +1955,17 @@ reattempt_daemons_connect (void *cls, | |||
2059 | ctx->d2->ghh = | 1955 | ctx->d2->ghh = |
2060 | GNUNET_TRANSPORT_get_hello (ctx->d2->th, &process_hello, ctx->d2); | 1956 | GNUNET_TRANSPORT_get_hello (ctx->d2->th, &process_hello, ctx->d2); |
2061 | } | 1957 | } |
2062 | #if DEBUG_TESTING_RECONNECT | ||
2063 | else | 1958 | else |
2064 | { | 1959 | { |
2065 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "didn't have %s's HELLO\n", | 1960 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "didn't have %s's HELLO\n", |
2066 | ctx->d2->shortname); | 1961 | ctx->d2->shortname); |
2067 | } | 1962 | } |
2068 | #endif | ||
2069 | 1963 | ||
2070 | if ((NULL == ctx->d2->hello) && (ctx->d2->th == NULL)) | 1964 | if ((NULL == ctx->d2->hello) && (ctx->d2->th == NULL)) |
2071 | { | 1965 | { |
2072 | #if DEBUG_TESTING_RECONNECT | ||
2073 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1966 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2074 | "didn't have %s's HELLO, trying to get it now\n", | 1967 | "didn't have %s's HELLO, trying to get it now\n", |
2075 | ctx->d2->shortname); | 1968 | ctx->d2->shortname); |
2076 | #endif | ||
2077 | ctx->d2->th = | 1969 | ctx->d2->th = |
2078 | GNUNET_TRANSPORT_connect (ctx->d2->cfg, &ctx->d2->id, NULL, NULL, NULL, | 1970 | GNUNET_TRANSPORT_connect (ctx->d2->cfg, &ctx->d2->id, NULL, NULL, NULL, |
2079 | NULL); | 1971 | NULL); |
@@ -2090,7 +1982,6 @@ reattempt_daemons_connect (void *cls, | |||
2090 | ctx->d2->ghh = | 1982 | ctx->d2->ghh = |
2091 | GNUNET_TRANSPORT_get_hello (ctx->d2->th, &process_hello, ctx->d2); | 1983 | GNUNET_TRANSPORT_get_hello (ctx->d2->th, &process_hello, ctx->d2); |
2092 | } | 1984 | } |
2093 | #if DEBUG_TESTING_RECONNECT | ||
2094 | else | 1985 | else |
2095 | { | 1986 | { |
2096 | if (NULL == ctx->d2->hello) | 1987 | if (NULL == ctx->d2->hello) |
@@ -2100,14 +1991,11 @@ reattempt_daemons_connect (void *cls, | |||
2100 | ctx->d2->shortname); | 1991 | ctx->d2->shortname); |
2101 | } | 1992 | } |
2102 | } | 1993 | } |
2103 | #endif | ||
2104 | 1994 | ||
2105 | if (ctx->send_hello == GNUNET_YES) | 1995 | if (ctx->send_hello == GNUNET_YES) |
2106 | { | 1996 | { |
2107 | #if DEBUG_TESTING_RECONNECT | ||
2108 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending %s's HELLO to %s\n", | 1997 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending %s's HELLO to %s\n", |
2109 | ctx->d1->shortname, ctx->d2->shortname); | 1998 | ctx->d1->shortname, ctx->d2->shortname); |
2110 | #endif | ||
2111 | ctx->d1th = | 1999 | ctx->d1th = |
2112 | GNUNET_TRANSPORT_connect (ctx->d1->cfg, &ctx->d1->id, ctx->d1, NULL, | 2000 | GNUNET_TRANSPORT_connect (ctx->d1->cfg, &ctx->d1->id, ctx->d1, NULL, |
2113 | NULL, NULL); | 2001 | NULL, NULL); |
@@ -2126,10 +2014,8 @@ reattempt_daemons_connect (void *cls, | |||
2126 | } | 2014 | } |
2127 | else | 2015 | else |
2128 | { | 2016 | { |
2129 | #if DEBUG_TESTING_RECONNECT | ||
2130 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to reconnect %s to %s\n", | 2017 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to reconnect %s to %s\n", |
2131 | ctx->d1->shortname, ctx->d2->shortname); | 2018 | ctx->d1->shortname, ctx->d2->shortname); |
2132 | #endif | ||
2133 | GNUNET_TRANSPORT_try_connect (ctx->d1th, &ctx->d2->id); | 2019 | GNUNET_TRANSPORT_try_connect (ctx->d1th, &ctx->d2->id); |
2134 | } | 2020 | } |
2135 | ctx->timeout_task = | 2021 | ctx->timeout_task = |
@@ -2177,10 +2063,8 @@ core_initial_iteration (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2177 | /* Peer not already connected, need to schedule connect request! */ | 2063 | /* Peer not already connected, need to schedule connect request! */ |
2178 | if (ctx->d1core == NULL) | 2064 | if (ctx->d1core == NULL) |
2179 | { | 2065 | { |
2180 | #if DEBUG_TESTING | ||
2181 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2066 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2182 | "Peers are NOT connected, connecting to core!\n"); | 2067 | "Peers are NOT connected, connecting to core!\n"); |
2183 | #endif | ||
2184 | ctx->d1core = | 2068 | ctx->d1core = |
2185 | GNUNET_CORE_connect (ctx->d1->cfg, 1, ctx, &core_init_notify, | 2069 | GNUNET_CORE_connect (ctx->d1->cfg, 1, ctx, &core_init_notify, |
2186 | &connect_notify, NULL, NULL, GNUNET_NO, NULL, | 2070 | &connect_notify, NULL, NULL, GNUNET_NO, NULL, |
@@ -2195,10 +2079,8 @@ core_initial_iteration (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
2195 | 2079 | ||
2196 | if ((NULL == ctx->d2->hello) && (ctx->d2->th == NULL)) /* Do not yet have the second peer's hello, set up a task to get it */ | 2080 | if ((NULL == ctx->d2->hello) && (ctx->d2->th == NULL)) /* Do not yet have the second peer's hello, set up a task to get it */ |
2197 | { | 2081 | { |
2198 | #if DEBUG_TESTING | ||
2199 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2082 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2200 | "Don't have d2's HELLO, trying to get it!\n"); | 2083 | "Don't have d2's HELLO, trying to get it!\n"); |
2201 | #endif | ||
2202 | ctx->d2->th = | 2084 | ctx->d2->th = |
2203 | GNUNET_TRANSPORT_connect (ctx->d2->cfg, &ctx->d2->id, NULL, NULL, NULL, | 2085 | GNUNET_TRANSPORT_connect (ctx->d2->cfg, &ctx->d2->id, NULL, NULL, NULL, |
2204 | NULL); | 2086 | NULL); |
@@ -2288,11 +2170,8 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1, | |||
2288 | ctx->connect_attempts = max_connect_attempts; | 2170 | ctx->connect_attempts = max_connect_attempts; |
2289 | ctx->connected = GNUNET_NO; | 2171 | ctx->connected = GNUNET_NO; |
2290 | ctx->send_hello = send_hello; | 2172 | ctx->send_hello = send_hello; |
2291 | #if DEBUG_TESTING | ||
2292 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asked to connect peer %s to peer %s\n", | 2173 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Asked to connect peer %s to peer %s\n", |
2293 | d1->shortname, d2->shortname); | 2174 | d1->shortname, d2->shortname); |
2294 | #endif | ||
2295 | |||
2296 | /* Core is up! Iterate over all _known_ peers first to check if we are already connected to the peer! */ | 2175 | /* Core is up! Iterate over all _known_ peers first to check if we are already connected to the peer! */ |
2297 | GNUNET_assert (GNUNET_OK == | 2176 | GNUNET_assert (GNUNET_OK == |
2298 | GNUNET_CORE_is_peer_connected (ctx->d1->cfg, &ctx->d2->id, | 2177 | GNUNET_CORE_is_peer_connected (ctx->d1->cfg, &ctx->d2->id, |
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 8a3ec44d4..2d0e9ef79 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c | |||
@@ -2928,7 +2928,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg) | |||
2928 | { | 2928 | { |
2929 | GNUNET_asprintf (&arg, "%s/friends", temp_service_path); | 2929 | GNUNET_asprintf (&arg, "%s/friends", temp_service_path); |
2930 | procarr[pg_iter] = | 2930 | procarr[pg_iter] = |
2931 | GNUNET_OS_start_process (NULL, NULL, "mv", "mv", mytemp, arg, NULL); | 2931 | GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "mv", "mv", mytemp, arg, NULL); |
2932 | GNUNET_assert (procarr[pg_iter] != NULL); | 2932 | GNUNET_assert (procarr[pg_iter] != NULL); |
2933 | #if VERBOSE_TESTING | 2933 | #if VERBOSE_TESTING |
2934 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2934 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -2950,7 +2950,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg) | |||
2950 | pg->peers[pg_iter].daemon->hostname, | 2950 | pg->peers[pg_iter].daemon->hostname, |
2951 | temp_service_path); | 2951 | temp_service_path); |
2952 | procarr[pg_iter] = | 2952 | procarr[pg_iter] = |
2953 | GNUNET_OS_start_process (NULL, NULL, "scp", "scp", mytemp, arg, NULL); | 2953 | GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", mytemp, arg, NULL); |
2954 | GNUNET_assert (procarr[pg_iter] != NULL); | 2954 | GNUNET_assert (procarr[pg_iter] != NULL); |
2955 | ret = GNUNET_OS_process_wait (procarr[pg_iter]); /* FIXME: schedule this, throttle! */ | 2955 | ret = GNUNET_OS_process_wait (procarr[pg_iter]); /* FIXME: schedule this, throttle! */ |
2956 | GNUNET_OS_process_close (procarr[pg_iter]); | 2956 | GNUNET_OS_process_close (procarr[pg_iter]); |
@@ -3127,7 +3127,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, | |||
3127 | { | 3127 | { |
3128 | GNUNET_asprintf (&arg, "%s/blacklist", temp_service_path); | 3128 | GNUNET_asprintf (&arg, "%s/blacklist", temp_service_path); |
3129 | procarr[pg_iter] = | 3129 | procarr[pg_iter] = |
3130 | GNUNET_OS_start_process (NULL, NULL, "mv", "mv", mytemp, arg, NULL); | 3130 | GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "mv", "mv", mytemp, arg, NULL); |
3131 | #if VERBOSE_TESTING | 3131 | #if VERBOSE_TESTING |
3132 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3132 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3133 | _("Copying file with command cp %s %s\n"), mytemp, arg); | 3133 | _("Copying file with command cp %s %s\n"), mytemp, arg); |
@@ -3147,7 +3147,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, | |||
3147 | pg->peers[pg_iter].daemon->hostname, | 3147 | pg->peers[pg_iter].daemon->hostname, |
3148 | temp_service_path); | 3148 | temp_service_path); |
3149 | procarr[pg_iter] = | 3149 | procarr[pg_iter] = |
3150 | GNUNET_OS_start_process (NULL, NULL, "scp", "scp", mytemp, arg, NULL); | 3150 | GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", mytemp, arg, NULL); |
3151 | GNUNET_assert (procarr[pg_iter] != NULL); | 3151 | GNUNET_assert (procarr[pg_iter] != NULL); |
3152 | GNUNET_OS_process_wait (procarr[pg_iter]); /* FIXME: add scheduled blacklist file copy that parallelizes file copying! */ | 3152 | GNUNET_OS_process_wait (procarr[pg_iter]); /* FIXME: add scheduled blacklist file copy that parallelizes file copying! */ |
3153 | 3153 | ||
@@ -5806,7 +5806,7 @@ start_peer_helper (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
5806 | 5806 | ||
5807 | /* FIXME: Doesn't support ssh_port option! */ | 5807 | /* FIXME: Doesn't support ssh_port option! */ |
5808 | helper->proc = | 5808 | helper->proc = |
5809 | GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", arg, | 5809 | GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", arg, |
5810 | "peerStartHelper.pl", tempdir, NULL); | 5810 | "peerStartHelper.pl", tempdir, NULL); |
5811 | GNUNET_assert (helper->proc != NULL); | 5811 | GNUNET_assert (helper->proc != NULL); |
5812 | #if DEBUG_TESTING | 5812 | #if DEBUG_TESTING |
@@ -6031,7 +6031,7 @@ GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
6031 | { | 6031 | { |
6032 | GNUNET_asprintf (&ssh_port_str, "%d", pg->hosts[i].sshport); | 6032 | GNUNET_asprintf (&ssh_port_str, "%d", pg->hosts[i].sshport); |
6033 | proc = | 6033 | proc = |
6034 | GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", "-P", ssh_port_str, | 6034 | GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", "-P", ssh_port_str, |
6035 | #if !DEBUG_TESTING | 6035 | #if !DEBUG_TESTING |
6036 | "-q", | 6036 | "-q", |
6037 | #endif | 6037 | #endif |
@@ -6039,7 +6039,7 @@ GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
6039 | } | 6039 | } |
6040 | else | 6040 | else |
6041 | proc = | 6041 | proc = |
6042 | GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", arg, "mkdir -p", | 6042 | GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", arg, "mkdir -p", |
6043 | tmpdir, NULL); | 6043 | tmpdir, NULL); |
6044 | GNUNET_assert (proc != NULL); | 6044 | GNUNET_assert (proc != NULL); |
6045 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 6045 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -6262,7 +6262,7 @@ GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
6262 | 6262 | ||
6263 | /* FIXME: Doesn't support ssh_port option! */ | 6263 | /* FIXME: Doesn't support ssh_port option! */ |
6264 | proc = | 6264 | proc = |
6265 | GNUNET_OS_start_process (NULL, NULL, "rsync", "rsync", "-r", | 6265 | GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "rsync", "rsync", "-r", |
6266 | newservicehome, arg, NULL); | 6266 | newservicehome, arg, NULL); |
6267 | #if DEBUG_TESTING | 6267 | #if DEBUG_TESTING |
6268 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 6268 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
diff --git a/src/transport/gnunet-transport-certificate-creation.c b/src/transport/gnunet-transport-certificate-creation.c index 9fd62fc9f..2ec8d36a6 100644 --- a/src/transport/gnunet-transport-certificate-creation.c +++ b/src/transport/gnunet-transport-certificate-creation.c | |||
@@ -57,7 +57,7 @@ main (int argc, char **argv) | |||
57 | /* Create RSA Private Key */ | 57 | /* Create RSA Private Key */ |
58 | /* openssl genrsa -out $1 1024 2> /dev/null */ | 58 | /* openssl genrsa -out $1 1024 2> /dev/null */ |
59 | openssl = | 59 | openssl = |
60 | GNUNET_OS_start_process (NULL, NULL, "openssl", "openssl", "genrsa", | 60 | GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "openssl", "openssl", "genrsa", |
61 | "-out", argv[1], "1024", NULL); | 61 | "-out", argv[1], "1024", NULL); |
62 | if (openssl == NULL) | 62 | if (openssl == NULL) |
63 | return 2; | 63 | return 2; |
@@ -67,7 +67,7 @@ main (int argc, char **argv) | |||
67 | /* Create a self-signed certificate in batch mode using rsa key */ | 67 | /* Create a self-signed certificate in batch mode using rsa key */ |
68 | /* openssl req -batch -days 365 -out $2 -new -x509 -key $1 2> /dev/null */ | 68 | /* openssl req -batch -days 365 -out $2 -new -x509 -key $1 2> /dev/null */ |
69 | openssl = | 69 | openssl = |
70 | GNUNET_OS_start_process (NULL, NULL, "openssl", "openssl", "req", | 70 | GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "openssl", "openssl", "req", |
71 | "-batch", "-days", "365", "-out", argv[2], | 71 | "-batch", "-days", "365", "-out", argv[2], |
72 | "-new", "-x509", "-key", argv[1], NULL); | 72 | "-new", "-x509", "-key", argv[1], NULL); |
73 | if (openssl == NULL) | 73 | if (openssl == NULL) |
diff --git a/src/transport/gnunet-transport-connect-running-peers.c b/src/transport/gnunet-transport-connect-running-peers.c index a640f38ab..5a5250920 100644 --- a/src/transport/gnunet-transport-connect-running-peers.c +++ b/src/transport/gnunet-transport-connect-running-peers.c | |||
@@ -256,7 +256,7 @@ connect_to_peer (const char *cfgname, GNUNET_TRANSPORT_ReceiveCallback rec, | |||
256 | GNUNET_DISK_directory_remove (p->servicehome); | 256 | GNUNET_DISK_directory_remove (p->servicehome); |
257 | /* | 257 | /* |
258 | * p->arm_proc = | 258 | * p->arm_proc = |
259 | * GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 259 | * GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
260 | * "gnunet-service-arm", "-c", cfgname, | 260 | * "gnunet-service-arm", "-c", cfgname, |
261 | * #if VERBOSE_PEERS | 261 | * #if VERBOSE_PEERS |
262 | * "-L", "DEBUG", | 262 | * "-L", "DEBUG", |
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index 5142ee642..ee977f5dc 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c | |||
@@ -275,7 +275,7 @@ do_test_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
275 | adv_port = bnd_port; | 275 | adv_port = bnd_port; |
276 | if (NULL == resolver) | 276 | if (NULL == resolver) |
277 | resolver = | 277 | resolver = |
278 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-resolver", | 278 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-resolver", |
279 | "gnunet-service-resolver", NULL); | 279 | "gnunet-service-resolver", NULL); |
280 | resolver_users++; | 280 | resolver_users++; |
281 | GNUNET_RESOLVER_connect (cfg); | 281 | GNUNET_RESOLVER_connect (cfg); |
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 2e0084ff7..8ec5a5e43 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -178,7 +178,7 @@ server_load_certificate (struct Plugin *plugin) | |||
178 | #endif | 178 | #endif |
179 | errno = 0; | 179 | errno = 0; |
180 | cert_creation = | 180 | cert_creation = |
181 | GNUNET_OS_start_process (NULL, NULL, | 181 | GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, |
182 | "gnunet-transport-certificate-creation", | 182 | "gnunet-transport-certificate-creation", |
183 | "gnunet-transport-certificate-creation", | 183 | "gnunet-transport-certificate-creation", |
184 | key_file, cert_file, NULL); | 184 | key_file, cert_file, NULL); |
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c index 822a6701d..4510ae12c 100644 --- a/src/transport/plugin_transport_wlan.c +++ b/src/transport/plugin_transport_wlan.c | |||
@@ -1487,7 +1487,7 @@ wlan_transport_start_wlan_helper (struct Plugin *plugin) | |||
1487 | if (GNUNET_OS_check_helper_binary (filenamehw) == GNUNET_YES) | 1487 | if (GNUNET_OS_check_helper_binary (filenamehw) == GNUNET_YES) |
1488 | { | 1488 | { |
1489 | plugin->server_proc = | 1489 | plugin->server_proc = |
1490 | GNUNET_OS_start_process (plugin->server_stdin, plugin->server_stdout, | 1490 | GNUNET_OS_start_process (GNUNET_NO, plugin->server_stdin, plugin->server_stdout, |
1491 | filenamehw, filenamehw, plugin->interface, | 1491 | filenamehw, filenamehw, plugin->interface, |
1492 | NULL); | 1492 | NULL); |
1493 | } | 1493 | } |
@@ -1514,7 +1514,7 @@ wlan_transport_start_wlan_helper (struct Plugin *plugin) | |||
1514 | absolute_filename, plugin->interface, plugin->testmode); | 1514 | absolute_filename, plugin->interface, plugin->testmode); |
1515 | #endif | 1515 | #endif |
1516 | plugin->server_proc = | 1516 | plugin->server_proc = |
1517 | GNUNET_OS_start_process (plugin->server_stdin, plugin->server_stdout, | 1517 | GNUNET_OS_start_process (GNUNET_NO, plugin->server_stdin, plugin->server_stdout, |
1518 | absolute_filename, absolute_filename, "1", | 1518 | absolute_filename, absolute_filename, "1", |
1519 | NULL); | 1519 | NULL); |
1520 | if (plugin->server_proc == NULL) | 1520 | if (plugin->server_proc == NULL) |
@@ -1534,7 +1534,7 @@ wlan_transport_start_wlan_helper (struct Plugin *plugin) | |||
1534 | #endif | 1534 | #endif |
1535 | 1535 | ||
1536 | plugin->server_proc = | 1536 | plugin->server_proc = |
1537 | GNUNET_OS_start_process (plugin->server_stdin, plugin->server_stdout, | 1537 | GNUNET_OS_start_process (GNUNET_NO, plugin->server_stdin, plugin->server_stdout, |
1538 | absolute_filename, absolute_filename, "2", | 1538 | absolute_filename, absolute_filename, "2", |
1539 | NULL); | 1539 | NULL); |
1540 | if (plugin->server_proc == NULL) | 1540 | if (plugin->server_proc == NULL) |
diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c index 3ef6e4b21..752106bfe 100644 --- a/src/transport/transport-testing.c +++ b/src/transport/transport-testing.c | |||
@@ -304,7 +304,8 @@ GNUNET_TRANSPORT_TESTING_start_peer (struct GNUNET_TRANSPORT_TESTING_handle | |||
304 | } | 304 | } |
305 | 305 | ||
306 | p->arm_proc = | 306 | p->arm_proc = |
307 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 307 | GNUNET_OS_start_process (GNUNET_YES, |
308 | NULL, NULL, "gnunet-service-arm", | ||
308 | "gnunet-service-arm", "-c", cfgname, | 309 | "gnunet-service-arm", "-c", cfgname, |
309 | #if VERBOSE_PEERS | 310 | #if VERBOSE_PEERS |
310 | "-L", "DEBUG", | 311 | "-L", "DEBUG", |
@@ -420,7 +421,8 @@ GNUNET_TRANSPORT_TESTING_restart_peer (struct GNUNET_TRANSPORT_TESTING_handle | |||
420 | goto fail; | 421 | goto fail; |
421 | 422 | ||
422 | p->arm_proc = | 423 | p->arm_proc = |
423 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 424 | GNUNET_OS_start_process (GNUNET_YES, |
425 | NULL, NULL, "gnunet-service-arm", | ||
424 | "gnunet-service-arm", "-c", cfgname, | 426 | "gnunet-service-arm", "-c", cfgname, |
425 | #if VERBOSE_PEERS | 427 | #if VERBOSE_PEERS |
426 | "-L", "DEBUG", | 428 | "-L", "DEBUG", |
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c index 8f9ba80f6..25226a3b4 100644 --- a/src/util/crypto_random.c +++ b/src/util/crypto_random.c | |||
@@ -280,9 +280,10 @@ entropy_generator (void *cls, const char *what, int printchar, int current, | |||
280 | LOG (GNUNET_ERROR_TYPE_INFO, _("Starting `%s' process to generate entropy\n"), | 280 | LOG (GNUNET_ERROR_TYPE_INFO, _("Starting `%s' process to generate entropy\n"), |
281 | "find"); | 281 | "find"); |
282 | genproc = | 282 | genproc = |
283 | GNUNET_OS_start_process (NULL, NULL, "sh", "sh", "-c", | 283 | GNUNET_OS_start_process (GNUNET_NO, |
284 | "exec find / -mount -type f -exec cp {} /dev/null \\; 2>/dev/null", | 284 | NULL, NULL, "sh", "sh", "-c", |
285 | NULL); | 285 | "exec find / -mount -type f -exec cp {} /dev/null \\; 2>/dev/null", |
286 | NULL); | ||
286 | } | 287 | } |
287 | 288 | ||
288 | 289 | ||
diff --git a/src/util/disk.c b/src/util/disk.c index e4d9f172a..e4d5ed32b 100644 --- a/src/util/disk.c +++ b/src/util/disk.c | |||
@@ -1610,7 +1610,7 @@ GNUNET_DISK_file_open (const char *fn, enum GNUNET_DISK_OpenFlags flags, | |||
1610 | mode = translate_unix_perms (perm); | 1610 | mode = translate_unix_perms (perm); |
1611 | } | 1611 | } |
1612 | 1612 | ||
1613 | fd = open (expfn, oflags | O_LARGEFILE, mode); | 1613 | fd = open (expfn, oflags | O_LARGEFILE | O_NONBLOCK, mode); |
1614 | if (fd == -1) | 1614 | if (fd == -1) |
1615 | { | 1615 | { |
1616 | if (0 == (flags & GNUNET_DISK_OPEN_FAILIFEXISTS)) | 1616 | if (0 == (flags & GNUNET_DISK_OPEN_FAILIFEXISTS)) |
@@ -2455,214 +2455,6 @@ GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p) | |||
2455 | 2455 | ||
2456 | 2456 | ||
2457 | /** | 2457 | /** |
2458 | * Creates a named pipe/FIFO and opens it | ||
2459 | * @param fn pointer to the name of the named pipe or to NULL | ||
2460 | * @param flags open flags | ||
2461 | * @param perm access permissions | ||
2462 | * @return pipe handle on success, NULL on error | ||
2463 | */ | ||
2464 | struct GNUNET_DISK_FileHandle * | ||
2465 | GNUNET_DISK_npipe_create (char **fn, enum GNUNET_DISK_OpenFlags flags, | ||
2466 | enum GNUNET_DISK_AccessPermissions perm) | ||
2467 | { | ||
2468 | #ifdef MINGW | ||
2469 | struct GNUNET_DISK_FileHandle *ret; | ||
2470 | HANDLE h = NULL; | ||
2471 | DWORD openMode; | ||
2472 | char *name; | ||
2473 | |||
2474 | openMode = 0; | ||
2475 | if (flags & GNUNET_DISK_OPEN_READWRITE) | ||
2476 | openMode = PIPE_ACCESS_DUPLEX; | ||
2477 | else if (flags & GNUNET_DISK_OPEN_READ) | ||
2478 | openMode = PIPE_ACCESS_INBOUND; | ||
2479 | else if (flags & GNUNET_DISK_OPEN_WRITE) | ||
2480 | openMode = PIPE_ACCESS_OUTBOUND; | ||
2481 | |||
2482 | if (flags & GNUNET_DISK_OPEN_FAILIFEXISTS) | ||
2483 | openMode |= FILE_FLAG_FIRST_PIPE_INSTANCE; | ||
2484 | |||
2485 | while (h == NULL) | ||
2486 | { | ||
2487 | DWORD error_code; | ||
2488 | |||
2489 | name = NULL; | ||
2490 | if (*fn != NULL) | ||
2491 | { | ||
2492 | GNUNET_asprintf (&name, "\\\\.\\pipe\\%.246s", fn); | ||
2493 | #if DEBUG_NPIPE | ||
2494 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2495 | "Trying to create an instance of named pipe `%s'\n", name); | ||
2496 | #endif | ||
2497 | /* 1) This might work just fine with UTF-8 strings as it is. | ||
2498 | * 2) This is only used by GNUnet itself, and only with latin names. | ||
2499 | */ | ||
2500 | h = CreateNamedPipe (name, openMode | FILE_FLAG_OVERLAPPED, | ||
2501 | PIPE_TYPE_BYTE | PIPE_READMODE_BYTE, 2, 1, 1, 0, | ||
2502 | NULL); | ||
2503 | } | ||
2504 | else | ||
2505 | { | ||
2506 | GNUNET_asprintf (fn, "\\\\.\\pipe\\gnunet-%llu", | ||
2507 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | ||
2508 | UINT64_MAX)); | ||
2509 | #if DEBUG_NPIPE | ||
2510 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Trying to create unique named pipe `%s'\n", | ||
2511 | *fn); | ||
2512 | #endif | ||
2513 | h = CreateNamedPipe (*fn, | ||
2514 | openMode | FILE_FLAG_OVERLAPPED | | ||
2515 | FILE_FLAG_FIRST_PIPE_INSTANCE, | ||
2516 | PIPE_TYPE_BYTE | PIPE_READMODE_BYTE, 2, 1, 1, 0, | ||
2517 | NULL); | ||
2518 | } | ||
2519 | error_code = GetLastError (); | ||
2520 | if (name) | ||
2521 | GNUNET_free (name); | ||
2522 | /* don't re-set name to NULL yet */ | ||
2523 | if (h == INVALID_HANDLE_VALUE) | ||
2524 | { | ||
2525 | SetErrnoFromWinError (error_code); | ||
2526 | #if DEBUG_NPIPE | ||
2527 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2528 | "Pipe creation have failed because of %d, errno is %d\n", error_code, | ||
2529 | errno); | ||
2530 | #endif | ||
2531 | if (name == NULL) | ||
2532 | { | ||
2533 | #if DEBUG_NPIPE | ||
2534 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2535 | "Pipe was to be unique, considering re-creation\n"); | ||
2536 | #endif | ||
2537 | GNUNET_free (*fn); | ||
2538 | *fn = NULL; | ||
2539 | if (error_code != ERROR_ACCESS_DENIED && error_code != ERROR_PIPE_BUSY) | ||
2540 | { | ||
2541 | return NULL; | ||
2542 | } | ||
2543 | #if DEBUG_NPIPE | ||
2544 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2545 | "Pipe name was not unique, trying again\n"); | ||
2546 | #endif | ||
2547 | h = NULL; | ||
2548 | } | ||
2549 | else | ||
2550 | return NULL; | ||
2551 | } | ||
2552 | } | ||
2553 | errno = 0; | ||
2554 | |||
2555 | ret = GNUNET_malloc (sizeof (*ret)); | ||
2556 | ret->h = h; | ||
2557 | ret->type = GNUNET_PIPE; | ||
2558 | |||
2559 | ret->oOverlapRead = GNUNET_malloc (sizeof (OVERLAPPED)); | ||
2560 | ret->oOverlapWrite = GNUNET_malloc (sizeof (OVERLAPPED)); | ||
2561 | |||
2562 | ret->oOverlapRead->hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); | ||
2563 | ret->oOverlapWrite->hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); | ||
2564 | |||
2565 | return ret; | ||
2566 | #else | ||
2567 | if (*fn == NULL) | ||
2568 | { | ||
2569 | char dir[] = "/tmp/gnunet-pipe-XXXXXX"; | ||
2570 | |||
2571 | if (mkdtemp (dir) == NULL) | ||
2572 | { | ||
2573 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "mkdtemp"); | ||
2574 | return NULL; | ||
2575 | } | ||
2576 | GNUNET_asprintf (fn, "%s/child-control", dir); | ||
2577 | } | ||
2578 | |||
2579 | if (mkfifo (*fn, translate_unix_perms (perm)) == -1) | ||
2580 | { | ||
2581 | if ((errno != EEXIST) || (0 != (flags & GNUNET_DISK_OPEN_FAILIFEXISTS))) | ||
2582 | return NULL; | ||
2583 | } | ||
2584 | |||
2585 | flags = flags & (~GNUNET_DISK_OPEN_FAILIFEXISTS); | ||
2586 | return GNUNET_DISK_file_open (*fn, flags, perm); | ||
2587 | #endif | ||
2588 | } | ||
2589 | |||
2590 | |||
2591 | /** | ||
2592 | * Opens already existing named pipe/FIFO | ||
2593 | * | ||
2594 | * @param fn name of an existing named pipe | ||
2595 | * @param flags open flags | ||
2596 | * @param perm access permissions | ||
2597 | * @return pipe handle on success, NULL on error | ||
2598 | */ | ||
2599 | struct GNUNET_DISK_FileHandle * | ||
2600 | GNUNET_DISK_npipe_open (const char *fn, enum GNUNET_DISK_OpenFlags flags, | ||
2601 | enum GNUNET_DISK_AccessPermissions perm) | ||
2602 | { | ||
2603 | #ifdef MINGW | ||
2604 | struct GNUNET_DISK_FileHandle *ret; | ||
2605 | HANDLE h; | ||
2606 | DWORD openMode; | ||
2607 | |||
2608 | openMode = 0; | ||
2609 | if (flags & GNUNET_DISK_OPEN_READWRITE) | ||
2610 | openMode = GENERIC_WRITE | GENERIC_READ; | ||
2611 | else if (flags & GNUNET_DISK_OPEN_READ) | ||
2612 | openMode = GENERIC_READ; | ||
2613 | else if (flags & GNUNET_DISK_OPEN_WRITE) | ||
2614 | openMode = GENERIC_WRITE; | ||
2615 | |||
2616 | h = CreateFile (fn, openMode, 0, NULL, OPEN_EXISTING, | ||
2617 | FILE_FLAG_OVERLAPPED | FILE_READ_ATTRIBUTES, NULL); | ||
2618 | if (h == INVALID_HANDLE_VALUE) | ||
2619 | { | ||
2620 | SetErrnoFromWinError (GetLastError ()); | ||
2621 | return NULL; | ||
2622 | } | ||
2623 | |||
2624 | ret = GNUNET_malloc (sizeof (*ret)); | ||
2625 | ret->h = h; | ||
2626 | ret->type = GNUNET_PIPE; | ||
2627 | ret->oOverlapRead = GNUNET_malloc (sizeof (OVERLAPPED)); | ||
2628 | ret->oOverlapWrite = GNUNET_malloc (sizeof (OVERLAPPED)); | ||
2629 | ret->oOverlapRead->hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); | ||
2630 | ret->oOverlapWrite->hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); | ||
2631 | |||
2632 | return ret; | ||
2633 | #else | ||
2634 | flags = flags & (~GNUNET_DISK_OPEN_FAILIFEXISTS); | ||
2635 | return GNUNET_DISK_file_open (fn, flags, perm); | ||
2636 | #endif | ||
2637 | } | ||
2638 | |||
2639 | |||
2640 | /** | ||
2641 | * Closes a named pipe/FIFO | ||
2642 | * @param pipe named pipe | ||
2643 | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise | ||
2644 | */ | ||
2645 | int | ||
2646 | GNUNET_DISK_npipe_close (struct GNUNET_DISK_FileHandle *pipe) | ||
2647 | { | ||
2648 | #ifndef MINGW | ||
2649 | return close (pipe->fd) == 0 ? GNUNET_OK : GNUNET_SYSERR; | ||
2650 | #else | ||
2651 | BOOL ret; | ||
2652 | |||
2653 | ret = CloseHandle (pipe->h); | ||
2654 | if (!ret) | ||
2655 | { | ||
2656 | SetErrnoFromWinError (GetLastError ()); | ||
2657 | return GNUNET_SYSERR; | ||
2658 | } | ||
2659 | else | ||
2660 | return GNUNET_OK; | ||
2661 | #endif | ||
2662 | } | ||
2663 | |||
2664 | |||
2665 | /** | ||
2666 | * Get the handle to a particular pipe end | 2458 | * Get the handle to a particular pipe end |
2667 | * | 2459 | * |
2668 | * @param p pipe | 2460 | * @param p pipe |
diff --git a/src/util/helper.c b/src/util/helper.c index e5d336e2f..43ec23a88 100644 --- a/src/util/helper.c +++ b/src/util/helper.c | |||
@@ -306,7 +306,8 @@ start_helper (struct GNUNET_HELPER_Handle *h) | |||
306 | h->fh_to_helper = | 306 | h->fh_to_helper = |
307 | GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE); | 307 | GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE); |
308 | h->helper_proc = | 308 | h->helper_proc = |
309 | GNUNET_OS_start_process_vap (h->helper_in, h->helper_out, | 309 | GNUNET_OS_start_process_vap (GNUNET_NO, |
310 | h->helper_in, h->helper_out, | ||
310 | h->binary_name, | 311 | h->binary_name, |
311 | h->binary_argv); | 312 | h->binary_argv); |
312 | if (NULL == h->helper_proc) | 313 | if (NULL == h->helper_proc) |
diff --git a/src/util/os_priority.c b/src/util/os_priority.c index 64dce4ba3..18dc4edaa 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c | |||
@@ -39,21 +39,252 @@ | |||
39 | 39 | ||
40 | #define GNUNET_OS_CONTROL_PIPE "GNUNET_OS_CONTROL_PIPE" | 40 | #define GNUNET_OS_CONTROL_PIPE "GNUNET_OS_CONTROL_PIPE" |
41 | 41 | ||
42 | #define DEBUG_OS GNUNET_EXTRA_LOGGING | ||
43 | |||
44 | struct GNUNET_OS_Process | 42 | struct GNUNET_OS_Process |
45 | { | 43 | { |
44 | /** | ||
45 | * PID of the process. | ||
46 | */ | ||
46 | pid_t pid; | 47 | pid_t pid; |
48 | |||
47 | #if WINDOWS | 49 | #if WINDOWS |
50 | /** | ||
51 | * Process handle. | ||
52 | */ | ||
48 | HANDLE handle; | 53 | HANDLE handle; |
49 | #endif | 54 | #endif |
50 | int sig; | 55 | |
56 | /** | ||
57 | * Pipe we use to signal the process (if used). | ||
58 | */ | ||
51 | struct GNUNET_DISK_FileHandle *control_pipe; | 59 | struct GNUNET_DISK_FileHandle *control_pipe; |
60 | |||
61 | /** | ||
62 | * Name of the pipe, NULL for none. | ||
63 | */ | ||
64 | char *childpipename; | ||
52 | }; | 65 | }; |
53 | 66 | ||
67 | |||
68 | /** | ||
69 | * Handle for 'this' process. | ||
70 | */ | ||
54 | static struct GNUNET_OS_Process current_process; | 71 | static struct GNUNET_OS_Process current_process; |
55 | 72 | ||
56 | 73 | ||
74 | /* MinGW version of named pipe API */ | ||
75 | #ifdef MINGW | ||
76 | /** | ||
77 | * Creates a named pipe/FIFO and opens it | ||
78 | * | ||
79 | * @param fn pointer to the name of the named pipe or to NULL | ||
80 | * @param flags open flags | ||
81 | * @param perm access permissions | ||
82 | * @return pipe handle on success, NULL on error | ||
83 | */ | ||
84 | static struct GNUNET_DISK_FileHandle * | ||
85 | npipe_create (char **fn, enum GNUNET_DISK_OpenFlags flags, | ||
86 | enum GNUNET_DISK_AccessPermissions perm) | ||
87 | { | ||
88 | struct GNUNET_DISK_FileHandle *ret; | ||
89 | HANDLE h = NULL; | ||
90 | DWORD openMode; | ||
91 | char *name; | ||
92 | |||
93 | openMode = 0; | ||
94 | if (flags & GNUNET_DISK_OPEN_READWRITE) | ||
95 | openMode = PIPE_ACCESS_DUPLEX; | ||
96 | else if (flags & GNUNET_DISK_OPEN_READ) | ||
97 | openMode = PIPE_ACCESS_INBOUND; | ||
98 | else if (flags & GNUNET_DISK_OPEN_WRITE) | ||
99 | openMode = PIPE_ACCESS_OUTBOUND; | ||
100 | if (flags & GNUNET_DISK_OPEN_FAILIFEXISTS) | ||
101 | openMode |= FILE_FLAG_FIRST_PIPE_INSTANCE; | ||
102 | |||
103 | while (h == NULL) | ||
104 | { | ||
105 | DWORD error_code; | ||
106 | |||
107 | name = NULL; | ||
108 | if (*fn != NULL) | ||
109 | { | ||
110 | GNUNET_asprintf (&name, "\\\\.\\pipe\\%.246s", fn); | ||
111 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
112 | "Trying to create an instance of named pipe `%s'\n", name); | ||
113 | /* 1) This might work just fine with UTF-8 strings as it is. | ||
114 | * 2) This is only used by GNUnet itself, and only with latin names. | ||
115 | */ | ||
116 | h = CreateNamedPipe (name, openMode | FILE_FLAG_OVERLAPPED, | ||
117 | PIPE_TYPE_BYTE | PIPE_READMODE_BYTE, 2, 1, 1, 0, | ||
118 | NULL); | ||
119 | } | ||
120 | else | ||
121 | { | ||
122 | GNUNET_asprintf (fn, "\\\\.\\pipe\\gnunet-%llu", | ||
123 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | ||
124 | UINT64_MAX)); | ||
125 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Trying to create unique named pipe `%s'\n", | ||
126 | *fn); | ||
127 | h = CreateNamedPipe (*fn, | ||
128 | openMode | FILE_FLAG_OVERLAPPED | | ||
129 | FILE_FLAG_FIRST_PIPE_INSTANCE, | ||
130 | PIPE_TYPE_BYTE | PIPE_READMODE_BYTE, 2, 1, 1, 0, | ||
131 | NULL); | ||
132 | } | ||
133 | error_code = GetLastError (); | ||
134 | if (name) | ||
135 | GNUNET_free (name); | ||
136 | /* don't re-set name to NULL yet */ | ||
137 | if (h == INVALID_HANDLE_VALUE) | ||
138 | { | ||
139 | SetErrnoFromWinError (error_code); | ||
140 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
141 | "Pipe creation have failed because of %d, errno is %d\n", error_code, | ||
142 | errno); | ||
143 | if (name == NULL) | ||
144 | { | ||
145 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
146 | "Pipe was to be unique, considering re-creation\n"); | ||
147 | GNUNET_free (*fn); | ||
148 | *fn = NULL; | ||
149 | if (error_code != ERROR_ACCESS_DENIED && error_code != ERROR_PIPE_BUSY) | ||
150 | { | ||
151 | return NULL; | ||
152 | } | ||
153 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
154 | "Pipe name was not unique, trying again\n"); | ||
155 | h = NULL; | ||
156 | } | ||
157 | else | ||
158 | return NULL; | ||
159 | } | ||
160 | } | ||
161 | errno = 0; | ||
162 | |||
163 | ret = GNUNET_malloc (sizeof (*ret)); | ||
164 | ret->h = h; | ||
165 | ret->type = GNUNET_PIPE; | ||
166 | ret->oOverlapRead = GNUNET_malloc (sizeof (OVERLAPPED)); | ||
167 | ret->oOverlapWrite = GNUNET_malloc (sizeof (OVERLAPPED)); | ||
168 | ret->oOverlapRead->hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); | ||
169 | ret->oOverlapWrite->hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); | ||
170 | return ret; | ||
171 | } | ||
172 | |||
173 | |||
174 | /** | ||
175 | * Opens already existing named pipe/FIFO | ||
176 | * | ||
177 | * @param fn name of an existing named pipe | ||
178 | * @param flags open flags | ||
179 | * @param perm access permissions | ||
180 | * @return pipe handle on success, NULL on error | ||
181 | */ | ||
182 | static struct GNUNET_DISK_FileHandle * | ||
183 | npipe_open (const char *fn, enum GNUNET_DISK_OpenFlags flags, | ||
184 | enum GNUNET_DISK_AccessPermissions perm) | ||
185 | { | ||
186 | struct GNUNET_DISK_FileHandle *ret; | ||
187 | HANDLE h; | ||
188 | DWORD openMode; | ||
189 | |||
190 | openMode = 0; | ||
191 | if (flags & GNUNET_DISK_OPEN_READWRITE) | ||
192 | openMode = GENERIC_WRITE | GENERIC_READ; | ||
193 | else if (flags & GNUNET_DISK_OPEN_READ) | ||
194 | openMode = GENERIC_READ; | ||
195 | else if (flags & GNUNET_DISK_OPEN_WRITE) | ||
196 | openMode = GENERIC_WRITE; | ||
197 | |||
198 | h = CreateFile (fn, openMode, 0, NULL, OPEN_EXISTING, | ||
199 | FILE_FLAG_OVERLAPPED | FILE_READ_ATTRIBUTES, NULL); | ||
200 | if (h == INVALID_HANDLE_VALUE) | ||
201 | { | ||
202 | SetErrnoFromWinError (GetLastError ()); | ||
203 | return NULL; | ||
204 | } | ||
205 | |||
206 | ret = GNUNET_malloc (sizeof (*ret)); | ||
207 | ret->h = h; | ||
208 | ret->type = GNUNET_PIPE; | ||
209 | ret->oOverlapRead = GNUNET_malloc (sizeof (OVERLAPPED)); | ||
210 | ret->oOverlapWrite = GNUNET_malloc (sizeof (OVERLAPPED)); | ||
211 | ret->oOverlapRead->hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); | ||
212 | ret->oOverlapWrite->hEvent = CreateEvent (NULL, FALSE, FALSE, NULL); | ||
213 | |||
214 | return ret; | ||
215 | } | ||
216 | |||
217 | #else | ||
218 | /* UNIX version of named-pipe API */ | ||
219 | |||
220 | /** | ||
221 | * Clean up a named pipe and the directory it was placed in. | ||
222 | * | ||
223 | * @param fn name of the pipe | ||
224 | */ | ||
225 | static void | ||
226 | cleanup_npipe (const char *fn) | ||
227 | { | ||
228 | char *dn; | ||
229 | char *dp; | ||
230 | |||
231 | if (0 != unlink (fn)) | ||
232 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn); | ||
233 | dn = GNUNET_strdup (fn); | ||
234 | dp = dirname (dn); | ||
235 | if (0 != rmdir (dp)) | ||
236 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "rmdir", dp); | ||
237 | GNUNET_free (dn); | ||
238 | } | ||
239 | |||
240 | |||
241 | /** | ||
242 | * Setup a named pipe. | ||
243 | * | ||
244 | * @param fn where to store the name of the new pipe, | ||
245 | * if *fn is non-null, the name of the pipe to setup | ||
246 | * @return GNUNET_OK on success | ||
247 | */ | ||
248 | static int | ||
249 | npipe_setup (char **fn) | ||
250 | { | ||
251 | if (NULL == *fn) | ||
252 | { | ||
253 | /* FIXME: hardwired '/tmp' path... is bad */ | ||
254 | char dir[] = "/tmp/gnunet-pipe-XXXXXX"; | ||
255 | |||
256 | if (NULL == mkdtemp (dir)) | ||
257 | { | ||
258 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "mkdtemp"); | ||
259 | return GNUNET_SYSERR; | ||
260 | } | ||
261 | GNUNET_asprintf (fn, "%s/child-control", dir); | ||
262 | } | ||
263 | if (-1 == mkfifo (*fn, S_IRUSR | S_IWUSR)) | ||
264 | return GNUNET_SYSERR; | ||
265 | return GNUNET_OK; | ||
266 | } | ||
267 | |||
268 | |||
269 | /** | ||
270 | * Open an existing named pipe. | ||
271 | * | ||
272 | * @param fn name of the file | ||
273 | * @param flags flags to use | ||
274 | * @param perm permissions to use | ||
275 | * @return NULL on error | ||
276 | */ | ||
277 | static struct GNUNET_DISK_FileHandle * | ||
278 | npipe_open (const char *fn, | ||
279 | enum GNUNET_DISK_OpenFlags flags, | ||
280 | enum GNUNET_DISK_AccessPermissions perm) | ||
281 | { | ||
282 | flags = flags & (~GNUNET_DISK_OPEN_FAILIFEXISTS); | ||
283 | return GNUNET_DISK_file_open (fn, flags, perm); | ||
284 | } | ||
285 | #endif | ||
286 | |||
287 | |||
57 | /** | 288 | /** |
58 | * This handler is called when there are control data to be read on the pipe | 289 | * This handler is called when there are control data to be read on the pipe |
59 | * | 290 | * |
@@ -64,44 +295,41 @@ static void | |||
64 | parent_control_handler (void *cls, | 295 | parent_control_handler (void *cls, |
65 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 296 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
66 | { | 297 | { |
67 | struct GNUNET_DISK_FileHandle *control_pipe = | 298 | struct GNUNET_DISK_FileHandle *control_pipe = cls; |
68 | (struct GNUNET_DISK_FileHandle *) cls; | ||
69 | int sig; | 299 | int sig; |
70 | 300 | ||
71 | #if DEBUG_OS | ||
72 | LOG (GNUNET_ERROR_TYPE_DEBUG, "`%s' invoked because of %d\n", __FUNCTION__, | 301 | LOG (GNUNET_ERROR_TYPE_DEBUG, "`%s' invoked because of %d\n", __FUNCTION__, |
73 | tc->reason); | 302 | tc->reason); |
74 | #endif | ||
75 | if (tc->reason & | 303 | if (tc->reason & |
76 | (GNUNET_SCHEDULER_REASON_SHUTDOWN | GNUNET_SCHEDULER_REASON_TIMEOUT | | 304 | (GNUNET_SCHEDULER_REASON_SHUTDOWN | GNUNET_SCHEDULER_REASON_TIMEOUT | |
77 | GNUNET_SCHEDULER_REASON_PREREQ_DONE)) | 305 | GNUNET_SCHEDULER_REASON_PREREQ_DONE)) |
78 | { | 306 | { |
79 | GNUNET_DISK_npipe_close (control_pipe); | 307 | GNUNET_DISK_file_close (control_pipe); |
308 | return; | ||
80 | } | 309 | } |
81 | else | 310 | if (GNUNET_DISK_file_read (control_pipe, &sig, sizeof (sig)) != |
311 | sizeof (sig)) | ||
82 | { | 312 | { |
83 | if (GNUNET_DISK_file_read (control_pipe, &sig, sizeof (sig)) != | 313 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "GNUNET_DISK_file_read"); |
84 | sizeof (sig)) | 314 | GNUNET_DISK_file_close (control_pipe); |
85 | { | 315 | return; |
86 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "GNUNET_DISK_file_read"); | ||
87 | GNUNET_DISK_npipe_close (control_pipe); | ||
88 | } | ||
89 | else | ||
90 | { | ||
91 | #if DEBUG_OS | ||
92 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got control code %d from parent\n", sig); | ||
93 | #endif | ||
94 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | ||
95 | control_pipe, &parent_control_handler, | ||
96 | control_pipe); | ||
97 | raise (sig); | ||
98 | } | ||
99 | } | 316 | } |
317 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Got control code %d from parent\n", sig); | ||
318 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | ||
319 | control_pipe, &parent_control_handler, | ||
320 | control_pipe); | ||
321 | raise (sig); | ||
100 | } | 322 | } |
101 | 323 | ||
102 | 324 | ||
103 | /** | 325 | /** |
104 | * Task that connects this process to its parent via pipe | 326 | * Task that connects this process to its parent via pipe; |
327 | * essentially, the parent control handler will read signal numbers | ||
328 | * from the 'GNUNET_OS_CONTROL_PIPE' (as given in an environment | ||
329 | * variable) and raise those signals. | ||
330 | * | ||
331 | * @param cls closure (unused) | ||
332 | * @param tc scheduler context (unused) | ||
105 | */ | 333 | */ |
106 | void | 334 | void |
107 | GNUNET_OS_install_parent_control_handler (void *cls, | 335 | GNUNET_OS_install_parent_control_handler (void *cls, |
@@ -112,27 +340,26 @@ GNUNET_OS_install_parent_control_handler (void *cls, | |||
112 | struct GNUNET_DISK_FileHandle *control_pipe; | 340 | struct GNUNET_DISK_FileHandle *control_pipe; |
113 | 341 | ||
114 | env_buf = getenv (GNUNET_OS_CONTROL_PIPE); | 342 | env_buf = getenv (GNUNET_OS_CONTROL_PIPE); |
115 | if ((env_buf == NULL) || (strlen (env_buf) <= 0)) | 343 | if ( (env_buf == NULL) || (strlen (env_buf) <= 0) ) |
116 | { | 344 | { |
117 | LOG (GNUNET_ERROR_TYPE_INFO, _("Not installing a handler because $%s=%s\n"), | 345 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
118 | GNUNET_OS_CONTROL_PIPE, env_buf); | 346 | "Not installing a handler because $%s is empty\n", |
347 | GNUNET_OS_CONTROL_PIPE); | ||
119 | putenv ("GNUNET_OS_CONTROL_PIPE="); | 348 | putenv ("GNUNET_OS_CONTROL_PIPE="); |
120 | return; | 349 | return; |
121 | } | 350 | } |
122 | control_pipe = | 351 | control_pipe = |
123 | GNUNET_DISK_npipe_open (env_buf, GNUNET_DISK_OPEN_READ, | 352 | npipe_open (env_buf, GNUNET_DISK_OPEN_READ, |
124 | GNUNET_DISK_PERM_USER_READ | | 353 | GNUNET_DISK_PERM_USER_READ | |
125 | GNUNET_DISK_PERM_USER_WRITE); | 354 | GNUNET_DISK_PERM_USER_WRITE); |
126 | if (control_pipe == NULL) | 355 | if (NULL == control_pipe) |
127 | { | 356 | { |
128 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "open", env_buf); | 357 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "open", env_buf); |
129 | putenv ("GNUNET_OS_CONTROL_PIPE="); | 358 | putenv ("GNUNET_OS_CONTROL_PIPE="); |
130 | return; | 359 | return; |
131 | } | 360 | } |
132 | #if DEBUG_OS | ||
133 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 361 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
134 | "Adding parent control handler pipe `%s' to the scheduler\n", env_buf); | 362 | "Adding parent control handler pipe `%s' to the scheduler\n", env_buf); |
135 | #endif | ||
136 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, control_pipe, | 363 | GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, control_pipe, |
137 | &parent_control_handler, control_pipe); | 364 | &parent_control_handler, control_pipe); |
138 | putenv ("GNUNET_OS_CONTROL_PIPE="); | 365 | putenv ("GNUNET_OS_CONTROL_PIPE="); |
@@ -160,104 +387,64 @@ GNUNET_OS_process_current () | |||
160 | } | 387 | } |
161 | 388 | ||
162 | 389 | ||
390 | /** | ||
391 | * Sends a signal to the process | ||
392 | * | ||
393 | * @param proc pointer to process structure | ||
394 | * @param sig signal | ||
395 | * @return 0 on success, -1 on error | ||
396 | */ | ||
163 | int | 397 | int |
164 | GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig) | 398 | GNUNET_OS_process_kill (struct GNUNET_OS_Process *proc, int sig) |
165 | { | 399 | { |
166 | #if ENABLE_WINDOWS_WORKAROUNDS | 400 | int ret; |
167 | int res = 0; | ||
168 | int ret = 0; | ||
169 | 401 | ||
402 | #if !WINDOWS | ||
403 | if ( (NULL == proc->control_pipe) && | ||
404 | (NULL != proc->childpipename) ) | ||
405 | proc->control_pipe = npipe_open (proc->childpipename, | ||
406 | GNUNET_DISK_OPEN_WRITE, | ||
407 | GNUNET_DISK_PERM_USER_READ | | ||
408 | GNUNET_DISK_PERM_USER_WRITE); | ||
409 | #endif | ||
410 | if (NULL == proc->control_pipe) | ||
411 | { | ||
412 | #if WINDOWS | ||
413 | /* no pipe and windows? can't do this */ | ||
414 | errno = EINVAL; | ||
415 | return -1; | ||
416 | #else | ||
417 | return kill (proc->pid, sig); | ||
418 | #endif | ||
419 | } | ||
170 | ret = GNUNET_DISK_file_write (proc->control_pipe, &sig, sizeof (sig)); | 420 | ret = GNUNET_DISK_file_write (proc->control_pipe, &sig, sizeof (sig)); |
171 | if (ret != sizeof (sig)) | 421 | if (ret == sizeof (sig)) |
422 | return 0; | ||
423 | /* pipe failed, try other methods */ | ||
424 | switch (sig) | ||
172 | { | 425 | { |
173 | if (errno == ECOMM) | 426 | case SIGHUP: |
174 | { | 427 | case SIGINT: |
175 | /* Child process is not controllable via pipe */ | 428 | case SIGKILL: |
176 | #if DEBUG_OS | 429 | case SIGTERM: |
177 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 430 | #if WINDOWS && !defined(__CYGWIN__) |
178 | "Child process is not controllable, will kill it directly\n"); | 431 | if (0 == TerminateProcess (proc->handle, 0)) |
179 | #endif | ||
180 | } | ||
181 | else if (errno == EPIPE) | ||
182 | { | 432 | { |
183 | #if DEBUG_OS | 433 | /* FIXME: set 'errno' */ |
184 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 434 | return -1; |
185 | "Failed to write into control pipe, because pipe is invalid (the child is most likely dead)\n"); | ||
186 | #endif | ||
187 | } | 435 | } |
188 | else | 436 | return 0; |
189 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
190 | "Failed to write into control pipe , errno is %d\n", errno); | ||
191 | #if WINDOWS && !defined(__CYGWIN__) | ||
192 | TerminateProcess (proc->handle, 0); | ||
193 | #else | 437 | #else |
194 | PLIBC_KILL (proc->pid, sig); | 438 | return PLIBC_KILL (proc->pid, sig); |
195 | #endif | ||
196 | } | ||
197 | else | ||
198 | { | ||
199 | #if DEBUG_OS | ||
200 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
201 | "Wrote control code into control pipe, now waiting\n"); | ||
202 | #endif | 439 | #endif |
203 | 440 | default: | |
204 | #if WINDOWS | 441 | #if WINDOWS |
205 | /* Give it 3 seconds to die, then kill it in a nice Windows-specific way */ | 442 | errno = EINVAL; |
206 | if (WaitForSingleObject (proc->handle, 3000) != WAIT_OBJECT_0) | 443 | return -1; |
207 | TerminateProcess (proc->handle, 0); | ||
208 | res = 0; | ||
209 | #else | 444 | #else |
210 | struct GNUNET_NETWORK_FDSet *rfds; | 445 | return kill (proc->pid, sig); |
211 | struct GNUNET_NETWORK_FDSet *efds; | 446 | #endif |
212 | |||
213 | rfds = GNUNET_NETWORK_fdset_create (); | ||
214 | efds = GNUNET_NETWORK_fdset_create (); | ||
215 | |||
216 | GNUNET_NETWORK_fdset_handle_set (rfds, proc->control_pipe); | ||
217 | GNUNET_NETWORK_fdset_handle_set (efds, proc->control_pipe); | ||
218 | |||
219 | /* Ndurner thought this up, and i have no idea what it does. | ||
220 | * There's have never been any code to answer the shutdown call | ||
221 | * (write a single int into the pipe, so that this function can read it). | ||
222 | * On *nix select() will probably tell that pipe is ready | ||
223 | * for reading, once the other process shuts down, | ||
224 | * but the read () call will fail, triggering a kill () | ||
225 | * on the pid that is already dead. This will probably result in non-0 | ||
226 | * return from kill(), and therefore from this function. | ||
227 | */ | ||
228 | while (1) | ||
229 | { | ||
230 | ret = | ||
231 | GNUNET_NETWORK_socket_select (rfds, NULL, efds, | ||
232 | GNUNET_TIME_relative_multiply | ||
233 | (GNUNET_TIME_relative_get_unit (), | ||
234 | 5000)); | ||
235 | |||
236 | if (ret < 1 || | ||
237 | GNUNET_NETWORK_fdset_handle_isset (efds, proc->control_pipe)) | ||
238 | { | ||
239 | /* Just to be sure */ | ||
240 | PLIBC_KILL (proc->pid, sig); | ||
241 | res = 0; | ||
242 | break; | ||
243 | } | ||
244 | else | ||
245 | { | ||
246 | if (GNUNET_DISK_file_read (proc->control_pipe, &ret, sizeof (ret)) != | ||
247 | GNUNET_OK) | ||
248 | res = PLIBC_KILL (proc->pid, sig); | ||
249 | |||
250 | /* Child signaled shutdown is in progress */ | ||
251 | continue; | ||
252 | } | ||
253 | } | ||
254 | #endif | ||
255 | } | 447 | } |
256 | |||
257 | return res; | ||
258 | #else | ||
259 | return kill (proc->pid, sig); | ||
260 | #endif | ||
261 | } | 448 | } |
262 | 449 | ||
263 | /** | 450 | /** |
@@ -279,13 +466,18 @@ GNUNET_OS_process_close (struct GNUNET_OS_Process *proc) | |||
279 | { | 466 | { |
280 | #if ENABLE_WINDOWS_WORKAROUNDS | 467 | #if ENABLE_WINDOWS_WORKAROUNDS |
281 | if (proc->control_pipe) | 468 | if (proc->control_pipe) |
282 | GNUNET_DISK_npipe_close (proc->control_pipe); | 469 | GNUNET_DISK_file_close (proc->control_pipe); |
283 | #endif | 470 | #endif |
284 | // FIXME NILS | 471 | // FIXME NILS |
285 | #ifdef WINDOWS | 472 | #ifdef WINDOWS |
286 | if (proc->handle != NULL) | 473 | if (proc->handle != NULL) |
287 | CloseHandle (proc->handle); | 474 | CloseHandle (proc->handle); |
288 | #endif | 475 | #endif |
476 | if (NULL != proc->childpipename) | ||
477 | { | ||
478 | cleanup_npipe (proc->childpipename); | ||
479 | GNUNET_free (proc->childpipename); | ||
480 | } | ||
289 | GNUNET_free (proc); | 481 | GNUNET_free (proc); |
290 | } | 482 | } |
291 | 483 | ||
@@ -417,11 +609,9 @@ GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc, | |||
417 | } | 609 | } |
418 | } | 610 | } |
419 | #else | 611 | #else |
420 | #if DEBUG_OS | ||
421 | LOG (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | 612 | LOG (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, |
422 | "Priority management not availabe for this platform\n"); | 613 | "Priority management not availabe for this platform\n"); |
423 | #endif | 614 | #endif |
424 | #endif | ||
425 | return GNUNET_OK; | 615 | return GNUNET_OK; |
426 | } | 616 | } |
427 | 617 | ||
@@ -531,6 +721,7 @@ CreateCustomEnvTable (char **vars) | |||
531 | /** | 721 | /** |
532 | * Start a process. | 722 | * Start a process. |
533 | * | 723 | * |
724 | * @param pipe_control should a pipe be used to send signals to the child? | ||
534 | * @param pipe_stdin pipe to use to send input to child process (or NULL) | 725 | * @param pipe_stdin pipe to use to send input to child process (or NULL) |
535 | * @param pipe_stdout pipe to use to get output from child process (or NULL) | 726 | * @param pipe_stdout pipe to use to get output from child process (or NULL) |
536 | * @param filename name of the binary | 727 | * @param filename name of the binary |
@@ -538,32 +729,25 @@ CreateCustomEnvTable (char **vars) | |||
538 | * @return pointer to process structure of the new process, NULL on error | 729 | * @return pointer to process structure of the new process, NULL on error |
539 | */ | 730 | */ |
540 | struct GNUNET_OS_Process * | 731 | struct GNUNET_OS_Process * |
541 | GNUNET_OS_start_process_vap (struct GNUNET_DISK_PipeHandle *pipe_stdin, | 732 | GNUNET_OS_start_process_vap (int pipe_control, |
733 | struct GNUNET_DISK_PipeHandle *pipe_stdin, | ||
542 | struct GNUNET_DISK_PipeHandle *pipe_stdout, | 734 | struct GNUNET_DISK_PipeHandle *pipe_stdout, |
543 | const char *filename, | 735 | const char *filename, |
544 | char *const argv[]) | 736 | char *const argv[]) |
545 | { | 737 | { |
546 | #if ENABLE_WINDOWS_WORKAROUNDS | 738 | #ifndef MINGW |
547 | char *childpipename = NULL; | 739 | char *childpipename = NULL; |
548 | struct GNUNET_DISK_FileHandle *control_pipe = NULL; | ||
549 | #endif | ||
550 | struct GNUNET_OS_Process *gnunet_proc = NULL; | 740 | struct GNUNET_OS_Process *gnunet_proc = NULL; |
551 | |||
552 | #ifndef MINGW | ||
553 | pid_t ret; | 741 | pid_t ret; |
554 | int fd_stdout_write; | 742 | int fd_stdout_write; |
555 | int fd_stdout_read; | 743 | int fd_stdout_read; |
556 | int fd_stdin_read; | 744 | int fd_stdin_read; |
557 | int fd_stdin_write; | 745 | int fd_stdin_write; |
558 | 746 | ||
559 | #if ENABLE_WINDOWS_WORKAROUNDS | 747 | if ( (GNUNET_YES == pipe_control) && |
560 | control_pipe = | 748 | (GNUNET_OK != |
561 | GNUNET_DISK_npipe_create (&childpipename, GNUNET_DISK_OPEN_WRITE, | 749 | npipe_setup (&childpipename)) ) |
562 | GNUNET_DISK_PERM_USER_READ | | 750 | return NULL; |
563 | GNUNET_DISK_PERM_USER_WRITE); | ||
564 | if (control_pipe == NULL) | ||
565 | return NULL; | ||
566 | #endif | ||
567 | if (pipe_stdout != NULL) | 751 | if (pipe_stdout != NULL) |
568 | { | 752 | { |
569 | GNUNET_DISK_internal_file_handle_ (GNUNET_DISK_pipe_handle | 753 | GNUNET_DISK_internal_file_handle_ (GNUNET_DISK_pipe_handle |
@@ -585,34 +769,24 @@ GNUNET_OS_start_process_vap (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
585 | } | 769 | } |
586 | 770 | ||
587 | ret = fork (); | 771 | ret = fork (); |
588 | if (ret != 0) | 772 | if (-1 == ret) |
589 | { | 773 | { |
590 | if (ret == -1) | 774 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "fork"); |
591 | { | 775 | GNUNET_free_non_null (childpipename); |
592 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "fork"); | 776 | return NULL; |
593 | #if ENABLE_WINDOWS_WORKAROUNDS | 777 | } |
594 | GNUNET_DISK_npipe_close (control_pipe); | 778 | if (0 != ret) |
595 | #endif | 779 | { |
596 | } | 780 | gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process)); |
597 | else | 781 | gnunet_proc->pid = ret; |
598 | { | 782 | gnunet_proc->childpipename = childpipename; |
599 | gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process)); | ||
600 | gnunet_proc->pid = ret; | ||
601 | #if ENABLE_WINDOWS_WORKAROUNDS | ||
602 | gnunet_proc->control_pipe = control_pipe; | ||
603 | #endif | ||
604 | } | ||
605 | #if ENABLE_WINDOWS_WORKAROUNDS | ||
606 | GNUNET_free (childpipename); | ||
607 | #endif | ||
608 | return gnunet_proc; | 783 | return gnunet_proc; |
609 | } | 784 | } |
610 | 785 | if (NULL != childpipename) | |
611 | #if ENABLE_WINDOWS_WORKAROUNDS | 786 | { |
612 | setenv (GNUNET_OS_CONTROL_PIPE, childpipename, 1); | 787 | setenv (GNUNET_OS_CONTROL_PIPE, childpipename, 1); |
613 | GNUNET_free (childpipename); | 788 | GNUNET_free (childpipename); |
614 | #endif | 789 | } |
615 | |||
616 | if (pipe_stdout != NULL) | 790 | if (pipe_stdout != NULL) |
617 | { | 791 | { |
618 | GNUNET_break (0 == close (fd_stdout_read)); | 792 | GNUNET_break (0 == close (fd_stdout_read)); |
@@ -633,6 +807,8 @@ GNUNET_OS_start_process_vap (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
633 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "execvp", filename); | 807 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "execvp", filename); |
634 | _exit (1); | 808 | _exit (1); |
635 | #else | 809 | #else |
810 | char *childpipename = NULL; | ||
811 | struct GNUNET_OS_Process *gnunet_proc = NULL; | ||
636 | char *arg; | 812 | char *arg; |
637 | unsigned int cmdlen; | 813 | unsigned int cmdlen; |
638 | char *cmd, *idx; | 814 | char *cmd, *idx; |
@@ -749,26 +925,31 @@ GNUNET_OS_start_process_vap (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
749 | &stdout_handle, sizeof (HANDLE)); | 925 | &stdout_handle, sizeof (HANDLE)); |
750 | start.hStdOutput = stdout_handle; | 926 | start.hStdOutput = stdout_handle; |
751 | } | 927 | } |
752 | 928 | if (GNUNET_YES == pipe_control) | |
753 | control_pipe = | ||
754 | GNUNET_DISK_npipe_create (&childpipename, GNUNET_DISK_OPEN_WRITE, | ||
755 | GNUNET_DISK_PERM_USER_READ | | ||
756 | GNUNET_DISK_PERM_USER_WRITE); | ||
757 | if (control_pipe == NULL) | ||
758 | { | 929 | { |
759 | GNUNET_free (cmd); | 930 | control_pipe = |
760 | GNUNET_free (path); | 931 | npipe_create (&childpipename, GNUNET_DISK_OPEN_WRITE, |
761 | return NULL; | 932 | GNUNET_DISK_PERM_USER_READ | |
933 | GNUNET_DISK_PERM_USER_WRITE); | ||
934 | if (control_pipe == NULL) | ||
935 | { | ||
936 | GNUNET_free (cmd); | ||
937 | GNUNET_free (path); | ||
938 | return NULL; | ||
939 | } | ||
940 | } | ||
941 | if (NULL != childpipename) | ||
942 | { | ||
943 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Opened the parent end of the pipe `%s'\n", | ||
944 | childpipename); | ||
945 | GNUNET_asprintf (&our_env[0], "%s=", GNUNET_OS_CONTROL_PIPE); | ||
946 | GNUNET_asprintf (&our_env[1], "%s", childpipename); | ||
947 | our_env[2] = NULL; | ||
948 | } | ||
949 | else | ||
950 | { | ||
951 | our_env[0] = NULL; | ||
762 | } | 952 | } |
763 | |||
764 | #if DEBUG_OS | ||
765 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Opened the parent end of the pipe `%s'\n", | ||
766 | childpipename); | ||
767 | #endif | ||
768 | |||
769 | GNUNET_asprintf (&our_env[0], "%s=", GNUNET_OS_CONTROL_PIPE); | ||
770 | GNUNET_asprintf (&our_env[1], "%s", childpipename); | ||
771 | our_env[2] = NULL; | ||
772 | env_block = CreateCustomEnvTable (our_env); | 953 | env_block = CreateCustomEnvTable (our_env); |
773 | GNUNET_free (our_env[0]); | 954 | GNUNET_free (our_env[0]); |
774 | GNUNET_free (our_env[1]); | 955 | GNUNET_free (our_env[1]); |
@@ -808,6 +989,7 @@ GNUNET_OS_start_process_vap (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
808 | /** | 989 | /** |
809 | * Start a process. | 990 | * Start a process. |
810 | * | 991 | * |
992 | * @param pipe_control should a pipe be used to send signals to the child? | ||
811 | * @param pipe_stdin pipe to use to send input to child process (or NULL) | 993 | * @param pipe_stdin pipe to use to send input to child process (or NULL) |
812 | * @param pipe_stdout pipe to use to get output from child process (or NULL) | 994 | * @param pipe_stdout pipe to use to get output from child process (or NULL) |
813 | * @param filename name of the binary | 995 | * @param filename name of the binary |
@@ -815,7 +997,8 @@ GNUNET_OS_start_process_vap (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
815 | * @return pointer to process structure of the new process, NULL on error | 997 | * @return pointer to process structure of the new process, NULL on error |
816 | */ | 998 | */ |
817 | struct GNUNET_OS_Process * | 999 | struct GNUNET_OS_Process * |
818 | GNUNET_OS_start_process_va (struct GNUNET_DISK_PipeHandle *pipe_stdin, | 1000 | GNUNET_OS_start_process_va (int pipe_control, |
1001 | struct GNUNET_DISK_PipeHandle *pipe_stdin, | ||
819 | struct GNUNET_DISK_PipeHandle *pipe_stdout, | 1002 | struct GNUNET_DISK_PipeHandle *pipe_stdout, |
820 | const char *filename, va_list va) | 1003 | const char *filename, va_list va) |
821 | { | 1004 | { |
@@ -835,7 +1018,8 @@ GNUNET_OS_start_process_va (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
835 | while (NULL != (argv[argc] = va_arg (ap, char *))) | 1018 | while (NULL != (argv[argc] = va_arg (ap, char *))) |
836 | argc++; | 1019 | argc++; |
837 | va_end (ap); | 1020 | va_end (ap); |
838 | ret = GNUNET_OS_start_process_vap (pipe_stdin, | 1021 | ret = GNUNET_OS_start_process_vap (pipe_control, |
1022 | pipe_stdin, | ||
839 | pipe_stdout, | 1023 | pipe_stdout, |
840 | filename, | 1024 | filename, |
841 | argv); | 1025 | argv); |
@@ -848,6 +1032,7 @@ GNUNET_OS_start_process_va (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
848 | /** | 1032 | /** |
849 | * Start a process. | 1033 | * Start a process. |
850 | * | 1034 | * |
1035 | * @param pipe_control should a pipe be used to send signals to the child? | ||
851 | * @param pipe_stdin pipe to use to send input to child process (or NULL) | 1036 | * @param pipe_stdin pipe to use to send input to child process (or NULL) |
852 | * @param pipe_stdout pipe to use to get output from child process (or NULL) | 1037 | * @param pipe_stdout pipe to use to get output from child process (or NULL) |
853 | * @param filename name of the binary | 1038 | * @param filename name of the binary |
@@ -857,7 +1042,8 @@ GNUNET_OS_start_process_va (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
857 | * | 1042 | * |
858 | */ | 1043 | */ |
859 | struct GNUNET_OS_Process * | 1044 | struct GNUNET_OS_Process * |
860 | GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | 1045 | GNUNET_OS_start_process (int pipe_control, |
1046 | struct GNUNET_DISK_PipeHandle *pipe_stdin, | ||
861 | struct GNUNET_DISK_PipeHandle *pipe_stdout, | 1047 | struct GNUNET_DISK_PipeHandle *pipe_stdout, |
862 | const char *filename, ...) | 1048 | const char *filename, ...) |
863 | { | 1049 | { |
@@ -865,7 +1051,7 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
865 | va_list ap; | 1051 | va_list ap; |
866 | 1052 | ||
867 | va_start (ap, filename); | 1053 | va_start (ap, filename); |
868 | ret = GNUNET_OS_start_process_va (pipe_stdin, pipe_stdout, filename, ap); | 1054 | ret = GNUNET_OS_start_process_va (pipe_control, pipe_stdin, pipe_stdout, filename, ap); |
869 | va_end (ap); | 1055 | va_end (ap); |
870 | return ret; | 1056 | return ret; |
871 | } | 1057 | } |
@@ -874,6 +1060,7 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
874 | /** | 1060 | /** |
875 | * Start a process. | 1061 | * Start a process. |
876 | * | 1062 | * |
1063 | * @param pipe_control should a pipe be used to send signals to the child? | ||
877 | * @param lsocks array of listen sockets to dup systemd-style (or NULL); | 1064 | * @param lsocks array of listen sockets to dup systemd-style (or NULL); |
878 | * must be NULL on platforms where dup is not supported | 1065 | * must be NULL on platforms where dup is not supported |
879 | * @param filename name of the binary | 1066 | * @param filename name of the binary |
@@ -881,20 +1068,17 @@ GNUNET_OS_start_process (struct GNUNET_DISK_PipeHandle *pipe_stdin, | |||
881 | * @return process ID of the new process, -1 on error | 1068 | * @return process ID of the new process, -1 on error |
882 | */ | 1069 | */ |
883 | struct GNUNET_OS_Process * | 1070 | struct GNUNET_OS_Process * |
884 | GNUNET_OS_start_process_v (const SOCKTYPE *lsocks, | 1071 | GNUNET_OS_start_process_v (int pipe_control, |
1072 | const SOCKTYPE *lsocks, | ||
885 | const char *filename, | 1073 | const char *filename, |
886 | char *const argv[]) | 1074 | char *const argv[]) |
887 | { | 1075 | { |
888 | #if ENABLE_WINDOWS_WORKAROUNDS | ||
889 | struct GNUNET_DISK_FileHandle *control_pipe = NULL; | ||
890 | char *childpipename = NULL; | ||
891 | #endif | ||
892 | |||
893 | #ifndef MINGW | 1076 | #ifndef MINGW |
894 | pid_t ret; | 1077 | pid_t ret; |
895 | char lpid[16]; | 1078 | char lpid[16]; |
896 | char fds[16]; | 1079 | char fds[16]; |
897 | struct GNUNET_OS_Process *gnunet_proc = NULL; | 1080 | struct GNUNET_OS_Process *gnunet_proc = NULL; |
1081 | char *childpipename = NULL; | ||
898 | int i; | 1082 | int i; |
899 | int j; | 1083 | int j; |
900 | int k; | 1084 | int k; |
@@ -903,15 +1087,9 @@ GNUNET_OS_start_process_v (const SOCKTYPE *lsocks, | |||
903 | int *lscp; | 1087 | int *lscp; |
904 | unsigned int ls; | 1088 | unsigned int ls; |
905 | 1089 | ||
906 | #if ENABLE_WINDOWS_WORKAROUNDS | 1090 | if ( (GNUNET_YES == pipe_control) && |
907 | control_pipe = | 1091 | (GNUNET_OK != npipe_setup (&childpipename)) ) |
908 | GNUNET_DISK_npipe_create (&childpipename, GNUNET_DISK_OPEN_WRITE, | 1092 | return NULL; |
909 | GNUNET_DISK_PERM_USER_READ | | ||
910 | GNUNET_DISK_PERM_USER_WRITE); | ||
911 | if (control_pipe == NULL) | ||
912 | return NULL; | ||
913 | #endif | ||
914 | |||
915 | lscp = NULL; | 1093 | lscp = NULL; |
916 | ls = 0; | 1094 | ls = 0; |
917 | if (lsocks != NULL) | 1095 | if (lsocks != NULL) |
@@ -922,36 +1100,26 @@ GNUNET_OS_start_process_v (const SOCKTYPE *lsocks, | |||
922 | GNUNET_array_append (lscp, ls, -1); | 1100 | GNUNET_array_append (lscp, ls, -1); |
923 | } | 1101 | } |
924 | ret = fork (); | 1102 | ret = fork (); |
925 | if (ret != 0) | 1103 | if (-1 == ret) |
926 | { | 1104 | { |
927 | if (ret == -1) | 1105 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "fork"); |
928 | { | 1106 | GNUNET_free_non_null (childpipename); |
929 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "fork"); | 1107 | GNUNET_array_grow (lscp, ls, 0); |
930 | #if ENABLE_WINDOWS_WORKAROUNDS | 1108 | return NULL; |
931 | GNUNET_DISK_npipe_close (control_pipe); | 1109 | } |
932 | #endif | 1110 | if (0 != ret) |
933 | } | 1111 | { |
934 | else | 1112 | gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process)); |
935 | { | 1113 | gnunet_proc->pid = ret; |
936 | gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process)); | 1114 | gnunet_proc->childpipename = childpipename; |
937 | gnunet_proc->pid = ret; | ||
938 | #if ENABLE_WINDOWS_WORKAROUNDS | ||
939 | gnunet_proc->control_pipe = control_pipe; | ||
940 | |||
941 | #endif | ||
942 | } | ||
943 | GNUNET_array_grow (lscp, ls, 0); | 1115 | GNUNET_array_grow (lscp, ls, 0); |
944 | #if ENABLE_WINDOWS_WORKAROUNDS | ||
945 | GNUNET_free (childpipename); | ||
946 | #endif | ||
947 | return gnunet_proc; | 1116 | return gnunet_proc; |
948 | } | 1117 | } |
949 | 1118 | if (NULL != childpipename) | |
950 | #if ENABLE_WINDOWS_WORKAROUNDS | 1119 | { |
951 | setenv (GNUNET_OS_CONTROL_PIPE, childpipename, 1); | 1120 | setenv (GNUNET_OS_CONTROL_PIPE, childpipename, 1); |
952 | GNUNET_free (childpipename); | 1121 | GNUNET_free (childpipename); |
953 | #endif | 1122 | } |
954 | |||
955 | if (lscp != NULL) | 1123 | if (lscp != NULL) |
956 | { | 1124 | { |
957 | /* read systemd documentation... */ | 1125 | /* read systemd documentation... */ |
@@ -999,6 +1167,8 @@ GNUNET_OS_start_process_v (const SOCKTYPE *lsocks, | |||
999 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "execvp", filename); | 1167 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "execvp", filename); |
1000 | _exit (1); | 1168 | _exit (1); |
1001 | #else | 1169 | #else |
1170 | struct GNUNET_DISK_FileHandle *control_pipe = NULL; | ||
1171 | char *childpipename = NULL; | ||
1002 | char **arg, **non_const_argv; | 1172 | char **arg, **non_const_argv; |
1003 | unsigned int cmdlen; | 1173 | unsigned int cmdlen; |
1004 | char *cmd, *idx; | 1174 | char *cmd, *idx; |
@@ -1006,9 +1176,7 @@ GNUNET_OS_start_process_v (const SOCKTYPE *lsocks, | |||
1006 | PROCESS_INFORMATION proc; | 1176 | PROCESS_INFORMATION proc; |
1007 | int argcount = 0; | 1177 | int argcount = 0; |
1008 | struct GNUNET_OS_Process *gnunet_proc = NULL; | 1178 | struct GNUNET_OS_Process *gnunet_proc = NULL; |
1009 | |||
1010 | char path[MAX_PATH + 1]; | 1179 | char path[MAX_PATH + 1]; |
1011 | |||
1012 | char *our_env[5] = { NULL, NULL, NULL, NULL, NULL }; | 1180 | char *our_env[5] = { NULL, NULL, NULL, NULL, NULL }; |
1013 | char *env_block = NULL; | 1181 | char *env_block = NULL; |
1014 | char *pathbuf; | 1182 | char *pathbuf; |
@@ -1023,7 +1191,7 @@ GNUNET_OS_start_process_v (const SOCKTYPE *lsocks, | |||
1023 | HANDLE lsocks_read; | 1191 | HANDLE lsocks_read; |
1024 | HANDLE lsocks_write; | 1192 | HANDLE lsocks_write; |
1025 | wchar_t wpath[MAX_PATH + 1], wcmd[32768]; | 1193 | wchar_t wpath[MAX_PATH + 1], wcmd[32768]; |
1026 | 1194 | int env_off; | |
1027 | int fail; | 1195 | int fail; |
1028 | 1196 | ||
1029 | /* Search in prefix dir (hopefully - the directory from which | 1197 | /* Search in prefix dir (hopefully - the directory from which |
@@ -1130,15 +1298,18 @@ GNUNET_OS_start_process_v (const SOCKTYPE *lsocks, | |||
1130 | memset (&start, 0, sizeof (start)); | 1298 | memset (&start, 0, sizeof (start)); |
1131 | start.cb = sizeof (start); | 1299 | start.cb = sizeof (start); |
1132 | 1300 | ||
1133 | control_pipe = | 1301 | if (GNUNET_YES == pipe_control) |
1134 | GNUNET_DISK_npipe_create (&childpipename, GNUNET_DISK_OPEN_WRITE, | ||
1135 | GNUNET_DISK_PERM_USER_READ | | ||
1136 | GNUNET_DISK_PERM_USER_WRITE); | ||
1137 | if (control_pipe == NULL) | ||
1138 | { | 1302 | { |
1139 | GNUNET_free (cmd); | 1303 | control_pipe = |
1140 | GNUNET_free (path); | 1304 | npipe_create (&childpipename, GNUNET_DISK_OPEN_WRITE, |
1141 | return NULL; | 1305 | GNUNET_DISK_PERM_USER_READ | |
1306 | GNUNET_DISK_PERM_USER_WRITE); | ||
1307 | if (control_pipe == NULL) | ||
1308 | { | ||
1309 | GNUNET_free (cmd); | ||
1310 | GNUNET_free (path); | ||
1311 | return NULL; | ||
1312 | } | ||
1142 | } | 1313 | } |
1143 | if (lsocks != NULL && lsocks[0] != INVALID_SOCKET) | 1314 | if (lsocks != NULL && lsocks[0] != INVALID_SOCKET) |
1144 | { | 1315 | { |
@@ -1160,29 +1331,25 @@ GNUNET_OS_start_process_v (const SOCKTYPE *lsocks, | |||
1160 | &lsocks_read, sizeof (HANDLE)); | 1331 | &lsocks_read, sizeof (HANDLE)); |
1161 | } | 1332 | } |
1162 | 1333 | ||
1163 | #if DEBUG_OS | 1334 | env_off = 0; |
1164 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Opened the parent end of the pipe `%s'\n", | 1335 | if (NULL != childpipename) |
1165 | childpipename); | 1336 | { |
1166 | #endif | 1337 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Opened the parent end of the pipe `%s'\n", |
1167 | 1338 | childpipename); | |
1168 | GNUNET_asprintf (&our_env[0], "%s=", GNUNET_OS_CONTROL_PIPE); | 1339 | GNUNET_asprintf (&our_env[env_off++], "%s=", GNUNET_OS_CONTROL_PIPE); |
1169 | GNUNET_asprintf (&our_env[1], "%s", childpipename); | 1340 | GNUNET_asprintf (&our_env[env_off++], "%s", childpipename); |
1170 | GNUNET_free (childpipename); | 1341 | GNUNET_free (childpipename); |
1171 | if (lsocks == NULL || lsocks[0] == INVALID_SOCKET) | 1342 | } |
1172 | our_env[2] = NULL; | 1343 | if ( (lsocks != NULL) && (lsocks[0] != INVALID_SOCKET)) |
1173 | else | ||
1174 | { | 1344 | { |
1175 | /*This will tell the child that we're going to send lsocks over the pipe*/ | 1345 | /*This will tell the child that we're going to send lsocks over the pipe*/ |
1176 | GNUNET_asprintf (&our_env[2], "%s=", "GNUNET_OS_READ_LSOCKS"); | 1346 | GNUNET_asprintf (&our_env[env_off++], "%s=", "GNUNET_OS_READ_LSOCKS"); |
1177 | GNUNET_asprintf (&our_env[3], "%lu", lsocks_read); | 1347 | GNUNET_asprintf (&our_env[env_off++], "%lu", lsocks_read); |
1178 | our_env[4] = NULL; | ||
1179 | } | 1348 | } |
1349 | our_env[env_off++] = NULL; | ||
1180 | env_block = CreateCustomEnvTable (our_env); | 1350 | env_block = CreateCustomEnvTable (our_env); |
1181 | GNUNET_free_non_null (our_env[0]); | 1351 | while (0 > env_off) |
1182 | GNUNET_free_non_null (our_env[1]); | 1352 | GNUNET_free_non_null (our_env[--env_off]); |
1183 | GNUNET_free_non_null (our_env[2]); | ||
1184 | GNUNET_free_non_null (our_env[3]); | ||
1185 | |||
1186 | if (ERROR_SUCCESS != plibc_conv_to_win_pathwconv(path, wpath) | 1353 | if (ERROR_SUCCESS != plibc_conv_to_win_pathwconv(path, wpath) |
1187 | || ERROR_SUCCESS != plibc_conv_to_win_pathwconv(cmd, wcmd) | 1354 | || ERROR_SUCCESS != plibc_conv_to_win_pathwconv(cmd, wcmd) |
1188 | || !CreateProcessW | 1355 | || !CreateProcessW |
@@ -1191,8 +1358,9 @@ GNUNET_OS_start_process_v (const SOCKTYPE *lsocks, | |||
1191 | { | 1358 | { |
1192 | SetErrnoFromWinError (GetLastError ()); | 1359 | SetErrnoFromWinError (GetLastError ()); |
1193 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "CreateProcess"); | 1360 | LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "CreateProcess"); |
1194 | GNUNET_DISK_npipe_close (control_pipe); | 1361 | if (NULL != control_pipe) |
1195 | if (lsocks != NULL) | 1362 | GNUNET_DISK_file_close (control_pipe); |
1363 | if (NULL != lsocks) | ||
1196 | GNUNET_DISK_pipe_close (lsocks_pipe); | 1364 | GNUNET_DISK_pipe_close (lsocks_pipe); |
1197 | GNUNET_free (env_block); | 1365 | GNUNET_free (env_block); |
1198 | GNUNET_free (cmd); | 1366 | GNUNET_free (cmd); |
@@ -1286,11 +1454,11 @@ GNUNET_OS_start_process_v (const SOCKTYPE *lsocks, | |||
1286 | */ | 1454 | */ |
1287 | TerminateProcess (gnunet_proc->handle, 0); | 1455 | TerminateProcess (gnunet_proc->handle, 0); |
1288 | CloseHandle (gnunet_proc->handle); | 1456 | CloseHandle (gnunet_proc->handle); |
1289 | GNUNET_DISK_npipe_close (gnunet_proc->control_pipe); | 1457 | if (NULL != gnunet_proc->control_pipe) |
1458 | GNUNET_DISK_file_close (gnunet_proc->control_pipe); | ||
1290 | GNUNET_free (gnunet_proc); | 1459 | GNUNET_free (gnunet_proc); |
1291 | return NULL; | 1460 | return NULL; |
1292 | } | 1461 | } |
1293 | |||
1294 | return gnunet_proc; | 1462 | return gnunet_proc; |
1295 | #endif | 1463 | #endif |
1296 | } | 1464 | } |
@@ -1599,7 +1767,7 @@ GNUNET_OS_command_run (GNUNET_OS_LineProcessor proc, void *proc_cls, | |||
1599 | if (NULL == opipe) | 1767 | if (NULL == opipe) |
1600 | return NULL; | 1768 | return NULL; |
1601 | va_start (ap, binary); | 1769 | va_start (ap, binary); |
1602 | eip = GNUNET_OS_start_process_va (NULL, opipe, binary, ap); | 1770 | eip = GNUNET_OS_start_process_va (GNUNET_NO, NULL, opipe, binary, ap); |
1603 | va_end (ap); | 1771 | va_end (ap); |
1604 | if (NULL == eip) | 1772 | if (NULL == eip) |
1605 | { | 1773 | { |
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index f1cecd4ef..c54672f5f 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -818,13 +818,11 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_Task task, void *task_cls) | |||
818 | current_lifeness = GNUNET_YES; | 818 | current_lifeness = GNUNET_YES; |
819 | GNUNET_SCHEDULER_add_continuation (task, task_cls, | 819 | GNUNET_SCHEDULER_add_continuation (task, task_cls, |
820 | GNUNET_SCHEDULER_REASON_STARTUP); | 820 | GNUNET_SCHEDULER_REASON_STARTUP); |
821 | #if ENABLE_WINDOWS_WORKAROUNDS | ||
822 | active_task = (void *) (long) -1; /* force passing of sanity check */ | 821 | active_task = (void *) (long) -1; /* force passing of sanity check */ |
823 | GNUNET_SCHEDULER_add_now_with_lifeness (GNUNET_NO, | 822 | GNUNET_SCHEDULER_add_now_with_lifeness (GNUNET_NO, |
824 | &GNUNET_OS_install_parent_control_handler, | 823 | &GNUNET_OS_install_parent_control_handler, |
825 | NULL); | 824 | NULL); |
826 | active_task = NULL; | 825 | active_task = NULL; |
827 | #endif | ||
828 | last_tr = 0; | 826 | last_tr = 0; |
829 | busy_wait_warning = 0; | 827 | busy_wait_warning = 0; |
830 | while (GNUNET_OK == check_lifeness ()) | 828 | while (GNUNET_OK == check_lifeness ()) |
diff --git a/src/util/test_common_logging_runtime_loglevels.c b/src/util/test_common_logging_runtime_loglevels.c index b6b9d6178..cdf1f660d 100644 --- a/src/util/test_common_logging_runtime_loglevels.c +++ b/src/util/test_common_logging_runtime_loglevels.c | |||
@@ -314,7 +314,7 @@ runone () | |||
314 | break; | 314 | break; |
315 | } | 315 | } |
316 | 316 | ||
317 | proc = GNUNET_OS_start_process (NULL, pipe_stdout, | 317 | proc = GNUNET_OS_start_process (GNUNET_NO, NULL, pipe_stdout, |
318 | #if MINGW | 318 | #if MINGW |
319 | "test_common_logging_dummy", | 319 | "test_common_logging_dummy", |
320 | #else | 320 | #else |
diff --git a/src/util/test_os_start_process.c b/src/util/test_os_start_process.c index 178a1d9ef..54638c12f 100644 --- a/src/util/test_os_start_process.c +++ b/src/util/test_os_start_process.c | |||
@@ -126,7 +126,7 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
126 | } | 126 | } |
127 | 127 | ||
128 | proc = | 128 | proc = |
129 | GNUNET_OS_start_process (hello_pipe_stdin, hello_pipe_stdout, fn, | 129 | GNUNET_OS_start_process (GNUNET_NO, hello_pipe_stdin, hello_pipe_stdout, fn, |
130 | "test_gnunet_echo_hello", "-", NULL); | 130 | "test_gnunet_echo_hello", "-", NULL); |
131 | GNUNET_free (fn); | 131 | GNUNET_free (fn); |
132 | 132 | ||
diff --git a/src/util/test_resolver_api.c b/src/util/test_resolver_api.c index 4ad5a2cf5..67d5f4640 100644 --- a/src/util/test_resolver_api.c +++ b/src/util/test_resolver_api.c | |||
@@ -393,7 +393,7 @@ check () | |||
393 | pfx = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR); | 393 | pfx = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR); |
394 | GNUNET_asprintf (&fn, "%s%cgnunet-service-resolver", pfx, DIR_SEPARATOR); | 394 | GNUNET_asprintf (&fn, "%s%cgnunet-service-resolver", pfx, DIR_SEPARATOR); |
395 | GNUNET_free (pfx); | 395 | GNUNET_free (pfx); |
396 | proc = GNUNET_OS_start_process (NULL, NULL, fn, "gnunet-service-resolver", | 396 | proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, fn, "gnunet-service-resolver", |
397 | #if VERBOSE | 397 | #if VERBOSE |
398 | "-L", "DEBUG", | 398 | "-L", "DEBUG", |
399 | #endif | 399 | #endif |
diff --git a/src/util/test_strings.c b/src/util/test_strings.c index 88de0b81b..570776a81 100644 --- a/src/util/test_strings.c +++ b/src/util/test_strings.c | |||
@@ -97,7 +97,9 @@ check () | |||
97 | GNUNET_free (r); | 97 | GNUNET_free (r); |
98 | b = GNUNET_STRINGS_to_utf8 ("TEST", 4, "ASCII"); | 98 | b = GNUNET_STRINGS_to_utf8 ("TEST", 4, "ASCII"); |
99 | WANT ("TEST", b); | 99 | WANT ("TEST", b); |
100 | GNUNET_log_skip (2, GNUNET_NO); | ||
100 | b = GNUNET_STRINGS_to_utf8 ("TEST", 4, "unknown"); | 101 | b = GNUNET_STRINGS_to_utf8 ("TEST", 4, "unknown"); |
102 | GNUNET_log_skip (0, GNUNET_YES); | ||
101 | WANT ("TEST", b); | 103 | WANT ("TEST", b); |
102 | return 0; | 104 | return 0; |
103 | } | 105 | } |
diff --git a/src/vpn/test_gnunet_vpn.c b/src/vpn/test_gnunet_vpn.c index 90895e452..005c7bd07 100644 --- a/src/vpn/test_gnunet_vpn.c +++ b/src/vpn/test_gnunet_vpn.c | |||
@@ -441,7 +441,7 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
441 | p->cfg = GNUNET_CONFIGURATION_create (); | 441 | p->cfg = GNUNET_CONFIGURATION_create (); |
442 | #if START_ARM | 442 | #if START_ARM |
443 | p->arm_proc = | 443 | p->arm_proc = |
444 | GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 444 | GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", |
445 | "gnunet-service-arm", | 445 | "gnunet-service-arm", |
446 | #if VERBOSE | 446 | #if VERBOSE |
447 | "-L", "DEBUG", | 447 | "-L", "DEBUG", |