aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-07-09 19:04:19 +0000
committerChristian Grothoff <christian@grothoff.org>2012-07-09 19:04:19 +0000
commit8f9464256fc06a884bf589b4004262a0549d11b3 (patch)
treea088b8acbebdefe2acf0b41cfed4418830275b78 /src
parent817ee37a75fb8eb5887023d1a5152cb528ee2d5a (diff)
downloadgnunet-8f9464256fc06a884bf589b4004262a0549d11b3.tar.gz
gnunet-8f9464256fc06a884bf589b4004262a0549d11b3.zip
-LRN: Another take on std descriptor inheritance
Now descriptors are not inherited by default, you have to pass a set of flags to make it so. When pipes are given, flags have no effect. gnunet-arm now has two options to block stdout and stderr from being passed to gnunet-service-arm
Diffstat (limited to 'src')
-rw-r--r--src/arm/arm_api.c14
-rw-r--r--src/arm/do_start_process.c5
-rw-r--r--src/arm/gnunet-arm.c18
-rw-r--r--src/arm/gnunet-service-arm.c4
-rw-r--r--src/arm/test_arm_api.c4
-rw-r--r--src/arm/test_exponential_backoff.c4
-rw-r--r--src/arm/test_gnunet_service_manager.c2
-rw-r--r--src/chat/test_chat.c2
-rw-r--r--src/chat/test_chat_private.c2
-rw-r--r--src/core/test_core_api.c2
-rw-r--r--src/core/test_core_api_reliability.c2
-rw-r--r--src/core/test_core_api_start_only.c2
-rw-r--r--src/core/test_core_quota_compliance.c2
-rw-r--r--src/fs/gnunet-auto-share.c2
-rw-r--r--src/hostlist/test_gnunet_daemon_hostlist.c2
-rw-r--r--src/hostlist/test_gnunet_daemon_hostlist_learning.c4
-rw-r--r--src/hostlist/test_gnunet_daemon_hostlist_reconnect.c2
-rw-r--r--src/include/gnunet_arm_service.h3
-rw-r--r--src/include/gnunet_os_lib.h53
-rw-r--r--src/nat/nat.c6
-rw-r--r--src/nat/nat_mini.c2
-rw-r--r--src/nat/test_nat_test.c2
-rw-r--r--src/statistics/test_statistics_api.c4
-rw-r--r--src/statistics/test_statistics_api_loop.c2
-rw-r--r--src/statistics/test_statistics_api_watch.c2
-rw-r--r--src/statistics/test_statistics_api_watch_zero_value.c2
-rw-r--r--src/testbed/testbed_api_hosts.c4
-rw-r--r--src/testing/testing.c2
-rw-r--r--src/testing_old/test_testing_large_topology.c2
-rw-r--r--src/testing_old/test_testing_topology.c2
-rw-r--r--src/testing_old/testing.c38
-rw-r--r--src/testing_old/testing_group.c12
-rw-r--r--src/transport/gnunet-transport-certificate-creation.c4
-rw-r--r--src/transport/gnunet-transport.c2
-rw-r--r--src/transport/plugin_transport_http_server.c2
-rw-r--r--src/util/crypto_random.c2
-rw-r--r--src/util/gnunet-uri.c2
-rw-r--r--src/util/helper.c2
-rw-r--r--src/util/os_priority.c112
-rw-r--r--src/util/test_common_logging_runtime_loglevels.c2
-rw-r--r--src/util/test_os_start_process.c6
-rw-r--r--src/util/test_resolver_api.c2
42 files changed, 257 insertions, 88 deletions
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c
index 1b78d3393..a598a5fea 100644
--- a/src/arm/arm_api.c
+++ b/src/arm/arm_api.c
@@ -295,6 +295,11 @@ struct RequestContext
295 */ 295 */
296 uint16_t type; 296 uint16_t type;
297 297
298 /**
299 * Flags for passing std descriptors to ARM (when starting ARM).
300 */
301 enum GNUNET_OS_InheritStdioFlags std_inheritance;
302
298}; 303};
299 304
300#include "do_start_process.c" 305#include "do_start_process.c"
@@ -381,14 +386,14 @@ arm_service_report (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
381 { 386 {
382 /* Means we are ONLY running locally */ 387 /* Means we are ONLY running locally */
383 /* we're clearly running a test, don't daemonize */ 388 /* we're clearly running a test, don't daemonize */
384 proc = do_start_process (GNUNET_NO, 389 proc = do_start_process (GNUNET_NO, pos->std_inheritance,
385 NULL, loprefix, binary, "-c", config, 390 NULL, loprefix, binary, "-c", config,
386 /* no daemonization! */ 391 /* no daemonization! */
387 lopostfix, NULL); 392 lopostfix, NULL);
388 } 393 }
389 else 394 else
390 { 395 {
391 proc = do_start_process (GNUNET_NO, 396 proc = do_start_process (GNUNET_NO, pos->std_inheritance,
392 NULL, loprefix, binary, "-c", config, 397 NULL, loprefix, binary, "-c", config,
393 "-d", lopostfix, NULL); 398 "-d", lopostfix, NULL);
394 } 399 }
@@ -522,6 +527,7 @@ change_service (struct GNUNET_ARM_Handle *h, const char *service_name,
522 * 527 *
523 * @param h handle to ARM 528 * @param h handle to ARM
524 * @param service_name name of the service 529 * @param service_name name of the service
530 * @param std_inheritance inheritance of std streams
525 * @param timeout how long to wait before failing for good 531 * @param timeout how long to wait before failing for good
526 * @param cb callback to invoke when service is ready 532 * @param cb callback to invoke when service is ready
527 * @param cb_cls closure for callback 533 * @param cb_cls closure for callback
@@ -529,6 +535,7 @@ change_service (struct GNUNET_ARM_Handle *h, const char *service_name,
529void 535void
530GNUNET_ARM_start_service (struct GNUNET_ARM_Handle *h, 536GNUNET_ARM_start_service (struct GNUNET_ARM_Handle *h,
531 const char *service_name, 537 const char *service_name,
538 enum GNUNET_OS_InheritStdioFlags std_inheritance,
532 struct GNUNET_TIME_Relative timeout, 539 struct GNUNET_TIME_Relative timeout,
533 GNUNET_ARM_Callback cb, void *cb_cls) 540 GNUNET_ARM_Callback cb, void *cb_cls)
534{ 541{
@@ -547,12 +554,13 @@ GNUNET_ARM_start_service (struct GNUNET_ARM_Handle *h,
547 sctx->callback = cb; 554 sctx->callback = cb;
548 sctx->cls = cb_cls; 555 sctx->cls = cb_cls;
549 sctx->timeout = GNUNET_TIME_relative_to_absolute (timeout); 556 sctx->timeout = GNUNET_TIME_relative_to_absolute (timeout);
557 sctx->std_inheritance = std_inheritance;
550 memcpy (&sctx[1], service_name, slen); 558 memcpy (&sctx[1], service_name, slen);
551 GNUNET_CLIENT_service_test ("arm", h->cfg, timeout, &arm_service_report, 559 GNUNET_CLIENT_service_test ("arm", h->cfg, timeout, &arm_service_report,
552 sctx); 560 sctx);
553 return; 561 return;
554 } 562 }
555 if (h->client == NULL) 563 if (NULL == h->client)
556 { 564 {
557 client = GNUNET_CLIENT_connect ("arm", h->cfg); 565 client = GNUNET_CLIENT_connect ("arm", h->cfg);
558 if (client == NULL) 566 if (client == NULL)
diff --git a/src/arm/do_start_process.c b/src/arm/do_start_process.c
index 4554f5729..1bc56d540 100644
--- a/src/arm/do_start_process.c
+++ b/src/arm/do_start_process.c
@@ -8,13 +8,14 @@
8 * with spaces to the new process. 8 * with spaces to the new process.
9 * 9 *
10 * @param pipe_control should a pipe be used to send signals to the child? 10 * @param pipe_control should a pipe be used to send signals to the child?
11 * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
11 * @param lsocks array of listen sockets to dup starting at fd3 (systemd-style), or NULL 12 * @param lsocks array of listen sockets to dup starting at fd3 (systemd-style), or NULL
12 * @param first_arg first argument for argv (may be an empty string) 13 * @param first_arg first argument for argv (may be an empty string)
13 * @param ... more arguments, NULL terminated 14 * @param ... more arguments, NULL terminated
14 * @return handle of the started process, NULL on error 15 * @return handle of the started process, NULL on error
15 */ 16 */
16static struct GNUNET_OS_Process * 17static struct GNUNET_OS_Process *
17do_start_process (int pipe_control, 18do_start_process (int pipe_control, unsigned int std_inheritance,
18 const SOCKTYPE * lsocks, const char *first_arg, ...) 19 const SOCKTYPE * lsocks, const char *first_arg, ...)
19{ 20{
20 va_list ap; 21 va_list ap;
@@ -97,7 +98,7 @@ do_start_process (int pipe_control,
97/* *INDENT-ON* */ 98/* *INDENT-ON* */
98 va_end (ap); 99 va_end (ap);
99 argv[argv_size] = NULL; 100 argv[argv_size] = NULL;
100 proc = GNUNET_OS_start_process_v (pipe_control, lsocks, argv[0], argv); 101 proc = GNUNET_OS_start_process_v (pipe_control, std_inheritance, lsocks, argv[0], argv);
101 while (argv_size > 0) 102 while (argv_size > 0)
102 GNUNET_free (argv[--argv_size]); 103 GNUNET_free (argv[--argv_size]);
103 GNUNET_free (argv); 104 GNUNET_free (argv);
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c
index 8ce8375e7..84d91355a 100644
--- a/src/arm/gnunet-arm.c
+++ b/src/arm/gnunet-arm.c
@@ -127,6 +127,16 @@ static struct GNUNET_TIME_Relative timeout;
127 127
128 128
129/** 129/**
130 * Do we want to give our stdout to gnunet-service-arm?
131 */
132static unsigned int no_stdout = 0;
133
134/**
135 * Do we want to give our stderr to gnunet-service-arm?
136 */
137static unsigned int no_stderr = 0;
138
139/**
130 * Main continuation-passing-style loop. Runs the various 140 * Main continuation-passing-style loop. Runs the various
131 * jobs that we've been asked to do in order. 141 * jobs that we've been asked to do in order.
132 * 142 *
@@ -323,6 +333,8 @@ cps_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
323 if (start) 333 if (start)
324 { 334 {
325 GNUNET_ARM_start_service (h, "arm", 335 GNUNET_ARM_start_service (h, "arm",
336 (no_stdout ? 0 : GNUNET_OS_INHERIT_STD_OUT) |
337 (no_stderr ? 0 : GNUNET_OS_INHERIT_STD_ERR),
326 (0 == 338 (0 ==
327 timeout.rel_value) ? START_TIMEOUT : 339 timeout.rel_value) ? START_TIMEOUT :
328 timeout, &confirm_cb, "arm"); 340 timeout, &confirm_cb, "arm");
@@ -333,6 +345,8 @@ cps_loop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
333 if (init != NULL) 345 if (init != NULL)
334 { 346 {
335 GNUNET_ARM_start_service (h, init, 347 GNUNET_ARM_start_service (h, init,
348 (no_stdout ? 0 : GNUNET_OS_INHERIT_STD_OUT) |
349 (no_stderr ? 0 : GNUNET_OS_INHERIT_STD_ERR),
336 (0 == 350 (0 ==
337 timeout.rel_value) ? START_TIMEOUT : 351 timeout.rel_value) ? START_TIMEOUT :
338 timeout, &confirm_cb, init); 352 timeout, &confirm_cb, init);
@@ -422,6 +436,10 @@ main (int argc, char *const *argv)
422 GNUNET_YES, &GNUNET_GETOPT_set_ulong, &temp_timeout_ms}, 436 GNUNET_YES, &GNUNET_GETOPT_set_ulong, &temp_timeout_ms},
423 {'I', "info", NULL, gettext_noop ("List currently running services"), 437 {'I', "info", NULL, gettext_noop ("List currently running services"),
424 GNUNET_NO, &GNUNET_GETOPT_set_one, &list}, 438 GNUNET_NO, &GNUNET_GETOPT_set_one, &list},
439 {'O', "no-stdout", NULL, gettext_noop ("Don't let gnunet-service-arm inherit standard output"),
440 GNUNET_NO, &GNUNET_GETOPT_set_one, &no_stdout},
441 {'E', "no-stderr", NULL, gettext_noop ("Don't let gnunet-service-arm inherit standard error"),
442 GNUNET_NO, &GNUNET_GETOPT_set_one, &no_stderr},
425 GNUNET_GETOPT_OPTION_END 443 GNUNET_GETOPT_OPTION_END
426 }; 444 };
427 445
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c
index ce9104334..00dda263e 100644
--- a/src/arm/gnunet-service-arm.c
+++ b/src/arm/gnunet-service-arm.c
@@ -320,12 +320,12 @@ start_process (struct ServiceList *sl)
320 GNUNET_assert (NULL == sl->proc); 320 GNUNET_assert (NULL == sl->proc);
321 if (GNUNET_YES == use_debug) 321 if (GNUNET_YES == use_debug)
322 sl->proc = 322 sl->proc =
323 do_start_process (sl->pipe_control, 323 do_start_process (sl->pipe_control, GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
324 lsocks, loprefix, sl->binary, "-c", sl->config, "-L", 324 lsocks, loprefix, sl->binary, "-c", sl->config, "-L",
325 "DEBUG", options, NULL); 325 "DEBUG", options, NULL);
326 else 326 else
327 sl->proc = 327 sl->proc =
328 do_start_process (sl->pipe_control, 328 do_start_process (sl->pipe_control, GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
329 lsocks, loprefix, sl->binary, "-c", sl->config, 329 lsocks, loprefix, sl->binary, "-c", sl->config,
330 options, NULL); 330 options, NULL);
331 if (sl->proc == NULL) 331 if (sl->proc == NULL)
diff --git a/src/arm/test_arm_api.c b/src/arm/test_arm_api.c
index e4e4510ad..e9bda410b 100644
--- a/src/arm/test_arm_api.c
+++ b/src/arm/test_arm_api.c
@@ -109,7 +109,7 @@ arm_notify (void *cls, enum GNUNET_ARM_ProcessStatus success)
109 GNUNET_ARM_stop_service (arm, "arm", TIMEOUT, &arm_stopped, NULL); 109 GNUNET_ARM_stop_service (arm, "arm", TIMEOUT, &arm_stopped, NULL);
110#endif 110#endif
111 } 111 }
112 GNUNET_ARM_start_service (arm, "resolver", START_TIMEOUT, &resolver_notify, 112 GNUNET_ARM_start_service (arm, "resolver", GNUNET_OS_INHERIT_STD_OUT_AND_ERR, START_TIMEOUT, &resolver_notify,
113 NULL); 113 NULL);
114} 114}
115 115
@@ -121,7 +121,7 @@ task (void *cls, char *const *args, const char *cfgfile,
121 cfg = c; 121 cfg = c;
122 arm = GNUNET_ARM_connect (cfg, NULL); 122 arm = GNUNET_ARM_connect (cfg, NULL);
123#if START_ARM 123#if START_ARM
124 GNUNET_ARM_start_service (arm, "arm", START_TIMEOUT, &arm_notify, NULL); 124 GNUNET_ARM_start_service (arm, "arm", GNUNET_OS_INHERIT_STD_OUT_AND_ERR, START_TIMEOUT, &arm_notify, NULL);
125#else 125#else
126 arm_notify (NULL, GNUNET_YES); 126 arm_notify (NULL, GNUNET_YES);
127#endif 127#endif
diff --git a/src/arm/test_exponential_backoff.c b/src/arm/test_exponential_backoff.c
index 77bd9e2ce..1709dbdba 100644
--- a/src/arm/test_exponential_backoff.c
+++ b/src/arm/test_exponential_backoff.c
@@ -270,7 +270,7 @@ static void
270arm_notify (void *cls, enum GNUNET_ARM_ProcessStatus status) 270arm_notify (void *cls, enum GNUNET_ARM_ProcessStatus status)
271{ 271{
272 GNUNET_assert (status == GNUNET_ARM_PROCESS_STARTING); 272 GNUNET_assert (status == GNUNET_ARM_PROCESS_STARTING);
273 GNUNET_ARM_start_service (arm, "do-nothing", TIMEOUT, &do_nothing_notify, 273 GNUNET_ARM_start_service (arm, "do-nothing", GNUNET_OS_INHERIT_STD_OUT_AND_ERR, TIMEOUT, &do_nothing_notify,
274 NULL); 274 NULL);
275} 275}
276 276
@@ -365,7 +365,7 @@ task (void *cls, char *const *args, const char *cfgfile,
365 365
366 arm = GNUNET_ARM_connect (cfg, NULL); 366 arm = GNUNET_ARM_connect (cfg, NULL);
367#if START_ARM 367#if START_ARM
368 GNUNET_ARM_start_service (arm, "arm", GNUNET_TIME_UNIT_ZERO, &arm_notify, 368 GNUNET_ARM_start_service (arm, "arm", GNUNET_OS_INHERIT_STD_OUT_AND_ERR, GNUNET_TIME_UNIT_ZERO, &arm_notify,
369 NULL); 369 NULL);
370#else 370#else
371 arm_do_nothing (NULL, GNUNET_YES); 371 arm_do_nothing (NULL, GNUNET_YES);
diff --git a/src/arm/test_gnunet_service_manager.c b/src/arm/test_gnunet_service_manager.c
index fe3357161..2abcc9563 100644
--- a/src/arm/test_gnunet_service_manager.c
+++ b/src/arm/test_gnunet_service_manager.c
@@ -124,7 +124,7 @@ run (void *cls, char *const *args, const char *cfgfile,
124 cfg = c; 124 cfg = c;
125#if START_ARM 125#if START_ARM
126 arm = GNUNET_ARM_connect (cfg, NULL); 126 arm = GNUNET_ARM_connect (cfg, NULL);
127 GNUNET_ARM_start_service (arm, "arm", START_TIMEOUT, &arm_notify, NULL); 127 GNUNET_ARM_start_service (arm, "arm", GNUNET_OS_INHERIT_STD_OUT_AND_ERR, START_TIMEOUT, &arm_notify, NULL);
128#else 128#else
129 arm_notify (NULL, GNUNET_YES); 129 arm_notify (NULL, GNUNET_YES);
130#endif 130#endif
diff --git a/src/chat/test_chat.c b/src/chat/test_chat.c
index 370cb04ee..5dcb87966 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 (GNUNET_YES, NULL, NULL, "gnunet-service-arm", 122 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 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 0aebd8f8b..ec170a1dd 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 (GNUNET_YES, NULL, NULL, "gnunet-service-arm", 136 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 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 d1591328f..0512c9617 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 (GNUNET_YES, NULL, NULL, "gnunet-service-arm", 322 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 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 682424f89..d4afbc27d 100644
--- a/src/core/test_core_api_reliability.c
+++ b/src/core/test_core_api_reliability.c
@@ -429,7 +429,7 @@ setup_peer (struct PeerContext *p, const char *cfgname)
429 p->cfg = GNUNET_CONFIGURATION_create (); 429 p->cfg = GNUNET_CONFIGURATION_create ();
430#if START_ARM 430#if START_ARM
431 p->arm_proc = 431 p->arm_proc =
432 GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", 432 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-arm",
433 "gnunet-service-arm", 433 "gnunet-service-arm",
434 "-c", cfgname, NULL); 434 "-c", cfgname, NULL);
435#endif 435#endif
diff --git a/src/core/test_core_api_start_only.c b/src/core/test_core_api_start_only.c
index 7704b4387..a502fce6d 100644
--- a/src/core/test_core_api_start_only.c
+++ b/src/core/test_core_api_start_only.c
@@ -139,7 +139,7 @@ setup_peer (struct PeerContext *p, const char *cfgname)
139{ 139{
140 p->cfg = GNUNET_CONFIGURATION_create (); 140 p->cfg = GNUNET_CONFIGURATION_create ();
141 p->arm_proc = 141 p->arm_proc =
142 GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", 142 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-arm",
143 "gnunet-service-arm", 143 "gnunet-service-arm",
144 "-c", cfgname, NULL); 144 "-c", cfgname, NULL);
145 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 145 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index bee8c02b4..61fe21626 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -573,7 +573,7 @@ setup_peer (struct PeerContext *p, const char *cfgname)
573 p->cfg = GNUNET_CONFIGURATION_create (); 573 p->cfg = GNUNET_CONFIGURATION_create ();
574#if START_ARM 574#if START_ARM
575 p->arm_proc = 575 p->arm_proc =
576 GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", 576 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-arm",
577 "gnunet-service-arm", 577 "gnunet-service-arm",
578 "-c", cfgname, NULL); 578 "-c", cfgname, NULL);
579#endif 579#endif
diff --git a/src/fs/gnunet-auto-share.c b/src/fs/gnunet-auto-share.c
index f7026554d..9e2f45d3e 100644
--- a/src/fs/gnunet-auto-share.c
+++ b/src/fs/gnunet-auto-share.c
@@ -488,7 +488,7 @@ work (void *cls,
488 _("Publishing `%s'\n"), 488 _("Publishing `%s'\n"),
489 wi->filename); 489 wi->filename);
490 publish_proc = GNUNET_OS_start_process_vap (GNUNET_YES, 490 publish_proc = GNUNET_OS_start_process_vap (GNUNET_YES,
491 NULL, NULL, 491 0, NULL, NULL,
492 "gnunet-publish", 492 "gnunet-publish",
493 argv); 493 argv);
494 if (NULL == publish_proc) 494 if (NULL == publish_proc)
diff --git a/src/hostlist/test_gnunet_daemon_hostlist.c b/src/hostlist/test_gnunet_daemon_hostlist.c
index 5f07ce415..6e9f31a20 100644
--- a/src/hostlist/test_gnunet_daemon_hostlist.c
+++ b/src/hostlist/test_gnunet_daemon_hostlist.c
@@ -133,7 +133,7 @@ setup_peer (struct PeerContext *p, const char *cfgname)
133{ 133{
134 p->cfg = GNUNET_CONFIGURATION_create (); 134 p->cfg = GNUNET_CONFIGURATION_create ();
135 p->arm_proc = 135 p->arm_proc =
136 GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", 136 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-arm",
137 "gnunet-service-arm", 137 "gnunet-service-arm",
138 "-c", cfgname, NULL); 138 "-c", cfgname, NULL);
139 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 139 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c
index 6f0ab4c9e..8a0992dda 100644
--- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c
+++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c
@@ -385,7 +385,7 @@ setup_learn_peer (struct PeerContext *p, const char *cfgname)
385 385
386 p->cfg = GNUNET_CONFIGURATION_create (); 386 p->cfg = GNUNET_CONFIGURATION_create ();
387 p->arm_proc = 387 p->arm_proc =
388 GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", 388 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-arm",
389 "gnunet-service-arm", 389 "gnunet-service-arm",
390 "-c", cfgname, NULL); 390 "-c", cfgname, NULL);
391 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 391 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
@@ -416,7 +416,7 @@ setup_adv_peer (struct PeerContext *p, const char *cfgname)
416{ 416{
417 p->cfg = GNUNET_CONFIGURATION_create (); 417 p->cfg = GNUNET_CONFIGURATION_create ();
418 p->arm_proc = 418 p->arm_proc =
419 GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm", 419 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-arm",
420 "gnunet-service-arm", 420 "gnunet-service-arm",
421 "-c", cfgname, NULL); 421 "-c", cfgname, NULL);
422 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); 422 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c b/src/hostlist/test_gnunet_daemon_hostlist_reconnect.c
index ff6e4177d..1b1df9a3a 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 (GNUNET_YES, NULL, NULL, "gnunet-service-arm", 147 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 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/include/gnunet_arm_service.h b/src/include/gnunet_arm_service.h
index 116bfc5b4..0aa916bd4 100644
--- a/src/include/gnunet_arm_service.h
+++ b/src/include/gnunet_arm_service.h
@@ -37,6 +37,7 @@ extern "C"
37 37
38#include "gnunet_configuration_lib.h" 38#include "gnunet_configuration_lib.h"
39#include "gnunet_scheduler_lib.h" 39#include "gnunet_scheduler_lib.h"
40#include "gnunet_os_lib.h"
40#include "gnunet_time_lib.h" 41#include "gnunet_time_lib.h"
41 42
42/** 43/**
@@ -169,12 +170,14 @@ GNUNET_ARM_disconnect (struct GNUNET_ARM_Handle *h);
169 * 170 *
170 * @param h handle to ARM 171 * @param h handle to ARM
171 * @param service_name name of the service 172 * @param service_name name of the service
173 * @param std_inheritance flags controlling std descriptors inheritance
172 * @param timeout how long to wait before failing for good 174 * @param timeout how long to wait before failing for good
173 * @param cb callback to invoke when service is ready 175 * @param cb callback to invoke when service is ready
174 * @param cb_cls closure for callback 176 * @param cb_cls closure for callback
175 */ 177 */
176void 178void
177GNUNET_ARM_start_service (struct GNUNET_ARM_Handle *h, const char *service_name, 179GNUNET_ARM_start_service (struct GNUNET_ARM_Handle *h, const char *service_name,
180 enum GNUNET_OS_InheritStdioFlags std_inheritance,
178 struct GNUNET_TIME_Relative timeout, 181 struct GNUNET_TIME_Relative timeout,
179 GNUNET_ARM_Callback cb, void *cb_cls); 182 GNUNET_ARM_Callback cb, void *cb_cls);
180 183
diff --git a/src/include/gnunet_os_lib.h b/src/include/gnunet_os_lib.h
index 67b6cce0c..1d4828f48 100644
--- a/src/include/gnunet_os_lib.h
+++ b/src/include/gnunet_os_lib.h
@@ -54,6 +54,51 @@ extern "C"
54#include "gnunet_configuration_lib.h" 54#include "gnunet_configuration_lib.h"
55#include "gnunet_scheduler_lib.h" 55#include "gnunet_scheduler_lib.h"
56 56
57
58/**
59 * Flags that determine which of the standard streams
60 * should be inherited by the child process.
61 */
62enum GNUNET_OS_InheritStdioFlags
63{
64
65 /**
66 * No standard streams should be inherited.
67 */
68 GNUNET_OS_INHERIT_STD_NONE = 0,
69
70 /**
71 * When this flag is set, the child process will
72 * inherit stdin of the parent.
73 */
74 GNUNET_OS_INHERIT_STD_IN = 1,
75
76 /**
77 * When this flag is set, the child process will
78 * inherit stdout of the parent.
79 */
80 GNUNET_OS_INHERIT_STD_OUT = 2,
81
82 /**
83 * When this flag is set, the child process will
84 * inherit stderr of the parent.
85 */
86 GNUNET_OS_INHERIT_STD_ERR = 4,
87
88 /**
89 * When these flags are set, the child process will
90 * inherit stdout and stderr of the parent.
91 */
92 GNUNET_OS_INHERIT_STD_OUT_AND_ERR = 6,
93
94 /**
95 * Use this option to have all of the standard streams
96 * (stdin, stdout and stderror) be inherited.
97 */
98 GNUNET_OS_INHERIT_STD_ALL = 7
99};
100
101
57/** 102/**
58 * Process information (OS-dependent) 103 * Process information (OS-dependent)
59 */ 104 */
@@ -257,6 +302,7 @@ GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc,
257 * Start a process. 302 * Start a process.
258 * 303 *
259 * @param pipe_control should a pipe be used to send signals to the child? 304 * @param pipe_control should a pipe be used to send signals to the child?
305 * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
260 * @param pipe_stdin pipe to use to send input to child process (or NULL) 306 * @param pipe_stdin pipe to use to send input to child process (or NULL)
261 * @param pipe_stdout pipe to use to get output from child process (or NULL) 307 * @param pipe_stdout pipe to use to get output from child process (or NULL)
262 * @param filename name of the binary 308 * @param filename name of the binary
@@ -265,6 +311,7 @@ GNUNET_OS_set_process_priority (struct GNUNET_OS_Process *proc,
265 */ 311 */
266struct GNUNET_OS_Process * 312struct GNUNET_OS_Process *
267GNUNET_OS_start_process_vap (int pipe_control, 313GNUNET_OS_start_process_vap (int pipe_control,
314 enum GNUNET_OS_InheritStdioFlags std_inheritance,
268 struct GNUNET_DISK_PipeHandle *pipe_stdin, 315 struct GNUNET_DISK_PipeHandle *pipe_stdin,
269 struct GNUNET_DISK_PipeHandle *pipe_stdout, 316 struct GNUNET_DISK_PipeHandle *pipe_stdout,
270 const char *filename, 317 const char *filename,
@@ -275,6 +322,7 @@ GNUNET_OS_start_process_vap (int pipe_control,
275 * Start a process. 322 * Start a process.
276 * 323 *
277 * @param pipe_control should a pipe be used to send signals to the child? 324 * @param pipe_control should a pipe be used to send signals to the child?
325 * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
278 * @param pipe_stdin pipe to use to send input to child process (or NULL) 326 * @param pipe_stdin pipe to use to send input to child process (or NULL)
279 * @param pipe_stdout pipe to use to get output from child process (or NULL) 327 * @param pipe_stdout pipe to use to get output from child process (or NULL)
280 * @param filename name of the binary 328 * @param filename name of the binary
@@ -283,6 +331,7 @@ GNUNET_OS_start_process_vap (int pipe_control,
283 */ 331 */
284struct GNUNET_OS_Process * 332struct GNUNET_OS_Process *
285GNUNET_OS_start_process (int pipe_control, 333GNUNET_OS_start_process (int pipe_control,
334 enum GNUNET_OS_InheritStdioFlags std_inheritance,
286 struct GNUNET_DISK_PipeHandle *pipe_stdin, 335 struct GNUNET_DISK_PipeHandle *pipe_stdin,
287 struct GNUNET_DISK_PipeHandle *pipe_stdout, 336 struct GNUNET_DISK_PipeHandle *pipe_stdout,
288 const char *filename, ...); 337 const char *filename, ...);
@@ -292,6 +341,7 @@ GNUNET_OS_start_process (int pipe_control,
292 * Start a process. 341 * Start a process.
293 * 342 *
294 * @param pipe_control should a pipe be used to send signals to the child? 343 * @param pipe_control should a pipe be used to send signals to the child?
344 * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
295 * @param pipe_stdin pipe to use to send input to child process (or NULL) 345 * @param pipe_stdin pipe to use to send input to child process (or NULL)
296 * @param pipe_stdout pipe to use to get output from child process (or NULL) 346 * @param pipe_stdout pipe to use to get output from child process (or NULL)
297 * @param filename name of the binary 347 * @param filename name of the binary
@@ -300,6 +350,7 @@ GNUNET_OS_start_process (int pipe_control,
300 */ 350 */
301struct GNUNET_OS_Process * 351struct GNUNET_OS_Process *
302GNUNET_OS_start_process_va (int pipe_control, 352GNUNET_OS_start_process_va (int pipe_control,
353 enum GNUNET_OS_InheritStdioFlags std_inheritance,
303 struct GNUNET_DISK_PipeHandle *pipe_stdin, 354 struct GNUNET_DISK_PipeHandle *pipe_stdin,
304 struct GNUNET_DISK_PipeHandle *pipe_stdout, 355 struct GNUNET_DISK_PipeHandle *pipe_stdout,
305 const char *filename, va_list va); 356 const char *filename, va_list va);
@@ -308,6 +359,7 @@ GNUNET_OS_start_process_va (int pipe_control,
308 * Start a process. 359 * Start a process.
309 * 360 *
310 * @param pipe_control should a pipe be used to send signals to the child? 361 * @param pipe_control should a pipe be used to send signals to the child?
362 * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
311 * @param lsocks array of listen sockets to dup systemd-style (or NULL); 363 * @param lsocks array of listen sockets to dup systemd-style (or NULL);
312 * must be NULL on platforms where dup is not supported 364 * must be NULL on platforms where dup is not supported
313 * @param filename name of the binary 365 * @param filename name of the binary
@@ -317,6 +369,7 @@ GNUNET_OS_start_process_va (int pipe_control,
317 */ 369 */
318struct GNUNET_OS_Process * 370struct GNUNET_OS_Process *
319GNUNET_OS_start_process_v (int pipe_control, 371GNUNET_OS_start_process_v (int pipe_control,
372 enum GNUNET_OS_InheritStdioFlags std_inheritance,
320 const SOCKTYPE *lsocks, 373 const SOCKTYPE *lsocks,
321 const char *filename, 374 const char *filename,
322 char *const argv[]); 375 char *const argv[]);
diff --git a/src/nat/nat.c b/src/nat/nat.c
index 79604da7d..80d0fc2bd 100644
--- a/src/nat/nat.c
+++ b/src/nat/nat.c
@@ -835,7 +835,7 @@ start_gnunet_nat_server (struct GNUNET_NAT_Handle *h)
835 "gnunet-helper-nat-server", h->internal_address); 835 "gnunet-helper-nat-server", h->internal_address);
836 /* Start the server process */ 836 /* Start the server process */
837 h->server_proc = 837 h->server_proc =
838 GNUNET_OS_start_process (GNUNET_NO, NULL, h->server_stdout, 838 GNUNET_OS_start_process (GNUNET_NO, 0, NULL, h->server_stdout,
839 "gnunet-helper-nat-server", 839 "gnunet-helper-nat-server",
840 "gnunet-helper-nat-server", 840 "gnunet-helper-nat-server",
841 h->internal_address, NULL); 841 h->internal_address, NULL);
@@ -1332,8 +1332,8 @@ GNUNET_NAT_run_client (struct GNUNET_NAT_Handle *h,
1332 _("Running gnunet-helper-nat-client %s %s %u\n"), h->internal_address, 1332 _("Running gnunet-helper-nat-client %s %s %u\n"), h->internal_address,
1333 inet4, (unsigned int) h->adv_port); 1333 inet4, (unsigned int) h->adv_port);
1334 proc = 1334 proc =
1335 GNUNET_OS_start_process (GNUNET_NO, 1335 GNUNET_OS_start_process (GNUNET_NO, 0, NULL, NULL,
1336 NULL, NULL, "gnunet-helper-nat-client", 1336 "gnunet-helper-nat-client",
1337 "gnunet-helper-nat-client", h->internal_address, 1337 "gnunet-helper-nat-client", h->internal_address,
1338 inet4, port_as_string, NULL); 1338 inet4, port_as_string, NULL);
1339 if (NULL == proc) 1339 if (NULL == proc)
diff --git a/src/nat/nat_mini.c b/src/nat/nat_mini.c
index 82697a971..5dffa8120 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 (GNUNET_NO, NULL, eh->opipe, "external-ip", "external-ip", 179 GNUNET_OS_start_process (GNUNET_NO, 0, 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 891a7633a..c213ffa1e 100644
--- a/src/nat/test_nat_test.c
+++ b/src/nat/test_nat_test.c
@@ -102,7 +102,7 @@ main (int argc, char *const argv[])
102 } 102 }
103 103
104 gns = 104 gns =
105 GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-nat-server", 105 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-nat-server",
106 "gnunet-nat-server", 106 "gnunet-nat-server",
107 "-c", "test_nat_test_data.conf", "12345", NULL); 107 "-c", "test_nat_test_data.conf", "12345", NULL);
108 GNUNET_assert (NULL != gns); 108 GNUNET_assert (NULL != gns);
diff --git a/src/statistics/test_statistics_api.c b/src/statistics/test_statistics_api.c
index 11f02b817..ddebfa356 100644
--- a/src/statistics/test_statistics_api.c
+++ b/src/statistics/test_statistics_api.c
@@ -139,7 +139,7 @@ check ()
139 struct GNUNET_OS_Process *proc; 139 struct GNUNET_OS_Process *proc;
140 140
141 proc = 141 proc =
142 GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-statistics", 142 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-statistics",
143 "gnunet-service-statistics", 143 "gnunet-service-statistics",
144 "-c", "test_statistics_api_data.conf", NULL); 144 "-c", "test_statistics_api_data.conf", NULL);
145#endif 145#endif
@@ -162,7 +162,7 @@ check ()
162#if START_SERVICE 162#if START_SERVICE
163 /* restart to check persistence! */ 163 /* restart to check persistence! */
164 proc = 164 proc =
165 GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-statistics", 165 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-statistics",
166 "gnunet-service-statistics", 166 "gnunet-service-statistics",
167 "-c", "test_statistics_api_data.conf", NULL); 167 "-c", "test_statistics_api_data.conf", NULL);
168#endif 168#endif
diff --git a/src/statistics/test_statistics_api_loop.c b/src/statistics/test_statistics_api_loop.c
index 58114f278..ae798b830 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 (GNUNET_YES, NULL, NULL, "gnunet-service-statistics", 100 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 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 e976bd473..f3524aa7c 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 (GNUNET_YES, NULL, NULL, "gnunet-service-statistics", 130 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 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/statistics/test_statistics_api_watch_zero_value.c b/src/statistics/test_statistics_api_watch_zero_value.c
index 9fadf6a6c..fe3974fc9 100644
--- a/src/statistics/test_statistics_api_watch_zero_value.c
+++ b/src/statistics/test_statistics_api_watch_zero_value.c
@@ -160,7 +160,7 @@ check ()
160 struct GNUNET_OS_Process *proc; 160 struct GNUNET_OS_Process *proc;
161 161
162 proc = 162 proc =
163 GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-statistics", 163 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-statistics",
164 "gnunet-service-statistics", 164 "gnunet-service-statistics",
165#if VERBOSE 165#if VERBOSE
166 "-L", "DEBUG", 166 "-L", "DEBUG",
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c
index 326a64924..f42c954ab 100644
--- a/src/testbed/testbed_api_hosts.c
+++ b/src/testbed/testbed_api_hosts.c
@@ -385,6 +385,8 @@ GNUNET_TESTBED_host_run_ (const struct GNUNET_TESTBED_Host *host,
385 if ((NULL == host) || (0 == host->id)) 385 if ((NULL == host) || (0 == host->id))
386 { 386 {
387 h->process = GNUNET_OS_start_process_vap (GNUNET_YES, 387 h->process = GNUNET_OS_start_process_vap (GNUNET_YES,
388 GNUNET_OS_INHERIT_STD_OUT |
389 GNUNET_OS_INHERIT_STD_ERR,
388 h->cpipe, NULL, 390 h->cpipe, NULL,
389 "gnunet-service-testbed", 391 "gnunet-service-testbed",
390 binary_argv); 392 binary_argv);
@@ -414,6 +416,8 @@ GNUNET_TESTBED_host_run_ (const struct GNUNET_TESTBED_Host *host,
414 remote_args[argp++] = NULL; 416 remote_args[argp++] = NULL;
415 GNUNET_assert (argp == argc + 6 + 1); 417 GNUNET_assert (argp == argc + 6 + 1);
416 h->process = GNUNET_OS_start_process_vap (GNUNET_YES, 418 h->process = GNUNET_OS_start_process_vap (GNUNET_YES,
419 GNUNET_OS_INHERIT_STD_OUT |
420 GNUNET_OS_INHERIT_STD_ERR,
417 h->cpipe, NULL, 421 h->cpipe, NULL,
418 "ssh", 422 "ssh",
419 remote_args); 423 remote_args);
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 3631f7b74..da0526576 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -905,7 +905,7 @@ GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer)
905 return GNUNET_SYSERR; 905 return GNUNET_SYSERR;
906 } 906 }
907 GNUNET_assert (NULL != peer->cfgfile); 907 GNUNET_assert (NULL != peer->cfgfile);
908 peer->main_process = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, 908 peer->main_process = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL,
909 peer->main_binary, 909 peer->main_binary,
910 peer->main_binary, 910 peer->main_binary,
911 "-c", 911 "-c",
diff --git a/src/testing_old/test_testing_large_topology.c b/src/testing_old/test_testing_large_topology.c
index cd80db195..4b7e1d150 100644
--- a/src/testing_old/test_testing_large_topology.c
+++ b/src/testing_old/test_testing_large_topology.c
@@ -189,7 +189,7 @@ gather_log_data ()
189 GNUNET_asprintf (&peer_number, "%llu", num_peers); 189 GNUNET_asprintf (&peer_number, "%llu", num_peers);
190 GNUNET_asprintf (&connect_number, "%llu", expected_connections); 190 GNUNET_asprintf (&connect_number, "%llu", expected_connections);
191 mem_process = 191 mem_process =
192 GNUNET_OS_start_process (NULL, NULL, "./memsize.pl", "memsize.pl", 192 GNUNET_OS_start_process (NULL, NULL, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, "./memsize.pl", "memsize.pl",
193 "totals.txt", peer_number, connect_number, NULL); 193 "totals.txt", peer_number, connect_number, NULL);
194 GNUNET_OS_process_wait (mem_process); 194 GNUNET_OS_process_wait (mem_process);
195 GNUNET_OS_process_destroy (mem_process); 195 GNUNET_OS_process_destroy (mem_process);
diff --git a/src/testing_old/test_testing_topology.c b/src/testing_old/test_testing_topology.c
index 94cbc0df6..62fa89b32 100644
--- a/src/testing_old/test_testing_topology.c
+++ b/src/testing_old/test_testing_topology.c
@@ -194,7 +194,7 @@ gather_log_data ()
194 GNUNET_asprintf (&peer_number, "%llu", num_peers); 194 GNUNET_asprintf (&peer_number, "%llu", num_peers);
195 GNUNET_asprintf (&connect_number, "%llu", expected_connections); 195 GNUNET_asprintf (&connect_number, "%llu", expected_connections);
196 mem_process = 196 mem_process =
197 GNUNET_OS_start_process (NULL, NULL, "./memsize.pl", "memsize.pl", 197 GNUNET_OS_start_process (NULL, NULL, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, "./memsize.pl", "memsize.pl",
198 "totals.txt", peer_number, connect_number, NULL); 198 "totals.txt", peer_number, connect_number, NULL);
199 GNUNET_OS_process_wait (mem_process); 199 GNUNET_OS_process_wait (mem_process);
200 GNUNET_OS_process_destroy (mem_process); 200 GNUNET_OS_process_destroy (mem_process);
diff --git a/src/testing_old/testing.c b/src/testing_old/testing.c
index 5456d56cb..1b164aa0f 100644
--- a/src/testing_old/testing.c
+++ b/src/testing_old/testing.c
@@ -245,7 +245,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
245 "gnunet-peerinfo", "gnunet-peerinfo", "-c", d->cfgfile, 245 "gnunet-peerinfo", "gnunet-peerinfo", "-c", d->cfgfile,
246 "-sq"); 246 "-sq");
247 d->proc_arm_peerinfo = 247 d->proc_arm_peerinfo =
248 GNUNET_OS_start_process (GNUNET_YES, NULL, d->pipe_stdout, "gnunet-peerinfo", 248 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, d->pipe_stdout, "gnunet-peerinfo",
249 "gnunet-peerinfo", "-c", d->cfgfile, "-sq", 249 "gnunet-peerinfo", "-c", d->cfgfile, "-sq",
250 NULL); 250 NULL);
251 GNUNET_DISK_pipe_close_end (d->pipe_stdout, GNUNET_DISK_PIPE_END_WRITE); 251 GNUNET_DISK_pipe_close_end (d->pipe_stdout, GNUNET_DISK_PIPE_END_WRITE);
@@ -263,7 +263,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
263 d->cfgfile, "-sq"); 263 d->cfgfile, "-sq");
264 if (d->ssh_port_str == NULL) 264 if (d->ssh_port_str == NULL)
265 { 265 {
266 d->proc_arm_peerinfo = GNUNET_OS_start_process (GNUNET_NO, NULL, d->pipe_stdout, "ssh", "ssh", 266 d->proc_arm_peerinfo = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, d->pipe_stdout, "ssh", "ssh",
267 "-q", 267 "-q",
268 dst, "gnunet-peerinfo", "-c", 268 dst, "gnunet-peerinfo", "-c",
269 d->cfgfile, "-sq", NULL); 269 d->cfgfile, "-sq", NULL);
@@ -271,7 +271,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
271 else 271 else
272 { 272 {
273 d->proc_arm_peerinfo = 273 d->proc_arm_peerinfo =
274 GNUNET_OS_start_process (GNUNET_NO, NULL, d->pipe_stdout, "ssh", "ssh", "-p", 274 GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, d->pipe_stdout, "ssh", "ssh", "-p",
275 d->ssh_port_str, 275 d->ssh_port_str,
276 "-q", 276 "-q",
277 dst, "gnunet-peerinfo", "-c", d->cfgfile, 277 dst, "gnunet-peerinfo", "-c", d->cfgfile,
@@ -414,7 +414,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
414 "gnunet-arm", "gnunet-arm", "-c", d->cfgfile, 414 "gnunet-arm", "gnunet-arm", "-c", d->cfgfile,
415 "-s"); 415 "-s");
416 d->proc_arm_start = 416 d->proc_arm_start =
417 GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", "-c", 417 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm", "-c",
418 d->cfgfile, 418 d->cfgfile,
419 "-s", "-q", "-T", 419 "-s", "-q", "-T",
420 GNUNET_TIME_relative_to_string 420 GNUNET_TIME_relative_to_string
@@ -434,7 +434,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
434 "-s", "-q"); 434 "-s", "-q");
435 if (d->ssh_port_str == NULL) 435 if (d->ssh_port_str == NULL)
436 { 436 {
437 d->proc_arm_start = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", 437 d->proc_arm_start = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh",
438 "-q", 438 "-q",
439 dst, "gnunet-arm", 439 dst, "gnunet-arm",
440 "-c", d->cfgfile, "-s", "-q", "-T", 440 "-c", d->cfgfile, "-s", "-q", "-T",
@@ -446,7 +446,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
446 { 446 {
447 447
448 d->proc_arm_start = 448 d->proc_arm_start =
449 GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", "-p", 449 GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh", "-p",
450 d->ssh_port_str, 450 d->ssh_port_str,
451 "-q", 451 "-q",
452 dst, "gnunet-arm", 452 dst, "gnunet-arm",
@@ -892,7 +892,7 @@ GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon *d,
892 else 892 else
893 arg = GNUNET_strdup (d->hostname); 893 arg = GNUNET_strdup (d->hostname);
894 894
895 d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", 895 d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh",
896 "-q", 896 "-q",
897 arg, "gnunet-arm", 897 arg, "gnunet-arm",
898 "-c", d->cfgfile, "-i", service, "-q", 898 "-c", d->cfgfile, "-i", service, "-q",
@@ -908,7 +908,7 @@ GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon *d,
908 { 908 {
909 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 909 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
910 "Starting gnunet-arm with config `%s' locally.\n", d->cfgfile); 910 "Starting gnunet-arm with config `%s' locally.\n", d->cfgfile);
911 d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", 911 d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm",
912 "-c", d->cfgfile, "-i", service, "-q", 912 "-c", d->cfgfile, "-i", service, "-q",
913 "-T", 913 "-T",
914 GNUNET_TIME_relative_to_string (timeout), 914 GNUNET_TIME_relative_to_string (timeout),
@@ -960,7 +960,7 @@ GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d,
960 else 960 else
961 arg = GNUNET_strdup (d->hostname); 961 arg = GNUNET_strdup (d->hostname);
962 962
963 d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", 963 d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh",
964 "-q", 964 "-q",
965 arg, "gnunet-arm", 965 arg, "gnunet-arm",
966 "-c", d->cfgfile, "-i", service, "-q", 966 "-c", d->cfgfile, "-i", service, "-q",
@@ -977,7 +977,7 @@ GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d,
977 { 977 {
978 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 978 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
979 "Starting gnunet-arm with config `%s' locally.\n", d->cfgfile); 979 "Starting gnunet-arm with config `%s' locally.\n", d->cfgfile);
980 d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", 980 d->proc_arm_srv_start = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm",
981 "-c", d->cfgfile, "-i", service, "-q", 981 "-c", d->cfgfile, "-i", service, "-q",
982 "-T", 982 "-T",
983 GNUNET_TIME_relative_to_string (timeout), 983 GNUNET_TIME_relative_to_string (timeout),
@@ -1184,7 +1184,7 @@ GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
1184 GNUNET_free (baseservicehome); 1184 GNUNET_free (baseservicehome);
1185 if (ret->ssh_port_str == NULL) 1185 if (ret->ssh_port_str == NULL)
1186 { 1186 {
1187 ret->proc_arm_copying = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", "-r", 1187 ret->proc_arm_copying = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "scp", "scp", "-r",
1188 "-q", 1188 "-q",
1189 servicehome, arg, NULL); 1189 servicehome, arg, NULL);
1190 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1190 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1194,7 +1194,7 @@ GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
1194 else 1194 else
1195 { 1195 {
1196 ret->proc_arm_copying = 1196 ret->proc_arm_copying =
1197 GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", "-r", "-P", 1197 GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "scp", "scp", "-r", "-P",
1198 ret->ssh_port_str, 1198 ret->ssh_port_str,
1199 "-q", 1199 "-q",
1200 servicehome, arg, NULL); 1200 servicehome, arg, NULL);
@@ -1304,7 +1304,7 @@ GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d,
1304 else 1304 else
1305 arg = GNUNET_strdup (d->hostname); 1305 arg = GNUNET_strdup (d->hostname);
1306 1306
1307 d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", 1307 d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh",
1308 "-q", 1308 "-q",
1309 arg, "gnunet-arm", 1309 arg, "gnunet-arm",
1310 "-c", d->cfgfile, "-e", "-r", NULL); 1310 "-c", d->cfgfile, "-e", "-r", NULL);
@@ -1316,7 +1316,7 @@ GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d,
1316 { 1316 {
1317 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1317 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1318 "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile); 1318 "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile);
1319 d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", 1319 d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm",
1320 "-c", d->cfgfile, "-e", "-r", NULL); 1320 "-c", d->cfgfile, "-e", "-r", NULL);
1321 } 1321 }
1322 1322
@@ -1377,7 +1377,7 @@ GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d,
1377 else 1377 else
1378 arg = GNUNET_strdup (d->hostname); 1378 arg = GNUNET_strdup (d->hostname);
1379 1379
1380 d->proc_arm_srv_stop = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", 1380 d->proc_arm_srv_stop = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh",
1381 "-q", 1381 "-q",
1382 arg, "gnunet-arm", 1382 arg, "gnunet-arm",
1383 "-c", d->cfgfile, "-k", service, "-q", 1383 "-c", d->cfgfile, "-k", service, "-q",
@@ -1393,7 +1393,7 @@ GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d,
1393 { 1393 {
1394 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1394 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1395 "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile); 1395 "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile);
1396 d->proc_arm_srv_stop = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-arm", "gnunet-arm", 1396 d->proc_arm_srv_stop = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm",
1397 "-c", d->cfgfile, "-k", service, "-q", 1397 "-c", d->cfgfile, "-k", service, "-q",
1398 "-T", 1398 "-T",
1399 GNUNET_TIME_relative_to_string (timeout), 1399 GNUNET_TIME_relative_to_string (timeout),
@@ -1546,7 +1546,7 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d,
1546 else 1546 else
1547 arg = GNUNET_strdup (d->hostname); 1547 arg = GNUNET_strdup (d->hostname);
1548 1548
1549 d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", 1549 d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh",
1550 "-q", 1550 "-q",
1551 arg, "gnunet-arm", 1551 arg, "gnunet-arm",
1552 "-c", d->cfgfile, "-e", "-q", "-T", 1552 "-c", d->cfgfile, "-e", "-q", "-T",
@@ -1562,7 +1562,7 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d,
1562 { 1562 {
1563 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1563 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1564 "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile); 1564 "Stopping gnunet-arm with config `%s' locally.\n", d->cfgfile);
1565 d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "gnunet-arm", "gnunet-arm", 1565 d->proc_arm_stop = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-arm", "gnunet-arm",
1566 "-c", d->cfgfile, "-e", "-q", "-T", 1566 "-c", d->cfgfile, "-e", "-q", "-T",
1567 GNUNET_TIME_relative_to_string (timeout), 1567 GNUNET_TIME_relative_to_string (timeout),
1568 del_arg, NULL); 1568 del_arg, NULL);
@@ -1626,7 +1626,7 @@ GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d,
1626 GNUNET_asprintf (&arg, "%s@%s:%s", d->username, d->hostname, d->cfgfile); 1626 GNUNET_asprintf (&arg, "%s@%s:%s", d->username, d->hostname, d->cfgfile);
1627 else 1627 else
1628 GNUNET_asprintf (&arg, "%s:%s", d->hostname, d->cfgfile); 1628 GNUNET_asprintf (&arg, "%s:%s", d->hostname, d->cfgfile);
1629 d->proc_arm_copying = GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", 1629 d->proc_arm_copying = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "scp", "scp",
1630 "-q", 1630 "-q",
1631 d->cfgfile, arg, NULL); 1631 d->cfgfile, arg, NULL);
1632 GNUNET_free (arg); 1632 GNUNET_free (arg);
diff --git a/src/testing_old/testing_group.c b/src/testing_old/testing_group.c
index 086ce2720..62cc185ce 100644
--- a/src/testing_old/testing_group.c
+++ b/src/testing_old/testing_group.c
@@ -2904,7 +2904,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg)
2904 pg->peers[pg_iter].daemon->hostname, 2904 pg->peers[pg_iter].daemon->hostname,
2905 temp_service_path); 2905 temp_service_path);
2906 procarr[pg_iter] = 2906 procarr[pg_iter] =
2907 GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", mytemp, arg, NULL); 2907 GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "scp", "scp", mytemp, arg, NULL);
2908 GNUNET_assert (procarr[pg_iter] != NULL); 2908 GNUNET_assert (procarr[pg_iter] != NULL);
2909 ret = GNUNET_OS_process_wait (procarr[pg_iter]); /* FIXME: schedule this, throttle! */ 2909 ret = GNUNET_OS_process_wait (procarr[pg_iter]); /* FIXME: schedule this, throttle! */
2910 GNUNET_OS_process_destroy (procarr[pg_iter]); 2910 GNUNET_OS_process_destroy (procarr[pg_iter]);
@@ -3090,7 +3090,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg,
3090 pg->peers[pg_iter].daemon->hostname, 3090 pg->peers[pg_iter].daemon->hostname,
3091 temp_service_path); 3091 temp_service_path);
3092 procarr[pg_iter] = 3092 procarr[pg_iter] =
3093 GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", mytemp, arg, NULL); 3093 GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "scp", "scp", mytemp, arg, NULL);
3094 GNUNET_assert (procarr[pg_iter] != NULL); 3094 GNUNET_assert (procarr[pg_iter] != NULL);
3095 GNUNET_OS_process_wait (procarr[pg_iter]); /* FIXME: add scheduled blacklist file copy that parallelizes file copying! */ 3095 GNUNET_OS_process_wait (procarr[pg_iter]); /* FIXME: add scheduled blacklist file copy that parallelizes file copying! */
3096 3096
@@ -5693,7 +5693,7 @@ start_peer_helper (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
5693 5693
5694 /* FIXME: Doesn't support ssh_port option! */ 5694 /* FIXME: Doesn't support ssh_port option! */
5695 helper->proc = 5695 helper->proc =
5696 GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", arg, 5696 GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh", arg,
5697 "peerStartHelper.pl", tempdir, NULL); 5697 "peerStartHelper.pl", tempdir, NULL);
5698 GNUNET_assert (helper->proc != NULL); 5698 GNUNET_assert (helper->proc != NULL);
5699 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting peers with cmd ssh %s %s %s\n", 5699 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting peers with cmd ssh %s %s %s\n",
@@ -5916,13 +5916,13 @@ GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
5916 { 5916 {
5917 GNUNET_asprintf (&ssh_port_str, "%d", pg->hosts[i].sshport); 5917 GNUNET_asprintf (&ssh_port_str, "%d", pg->hosts[i].sshport);
5918 proc = 5918 proc =
5919 GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", "-P", ssh_port_str, 5919 GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh", "-P", ssh_port_str,
5920 "-q", 5920 "-q",
5921 arg, "mkdir -p", tmpdir, NULL); 5921 arg, "mkdir -p", tmpdir, NULL);
5922 } 5922 }
5923 else 5923 else
5924 proc = 5924 proc =
5925 GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "ssh", "ssh", arg, "mkdir -p", 5925 GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "ssh", "ssh", arg, "mkdir -p",
5926 tmpdir, NULL); 5926 tmpdir, NULL);
5927 GNUNET_assert (proc != NULL); 5927 GNUNET_assert (proc != NULL);
5928 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 5928 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -6141,7 +6141,7 @@ GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
6141 6141
6142 /* FIXME: Doesn't support ssh_port option! */ 6142 /* FIXME: Doesn't support ssh_port option! */
6143 proc = 6143 proc =
6144 GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "rsync", "rsync", "-r", 6144 GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "rsync", "rsync", "-r",
6145 newservicehome, arg, NULL); 6145 newservicehome, arg, NULL);
6146 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 6146 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
6147 "copying directory with command rsync -r %s %s\n", 6147 "copying directory with command rsync -r %s %s\n",
diff --git a/src/transport/gnunet-transport-certificate-creation.c b/src/transport/gnunet-transport-certificate-creation.c
index d5a7fcbd1..f7deb1206 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 (GNUNET_NO, NULL, NULL, "openssl", "openssl", "genrsa", 60 GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 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 (GNUNET_NO, NULL, NULL, "openssl", "openssl", "req", 70 GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, 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.c b/src/transport/gnunet-transport.c
index 42b7f6062..36c02014e 100644
--- a/src/transport/gnunet-transport.c
+++ b/src/transport/gnunet-transport.c
@@ -284,7 +284,7 @@ do_test_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg)
284 adv_port = bnd_port; 284 adv_port = bnd_port;
285 if (NULL == resolver) 285 if (NULL == resolver)
286 resolver = 286 resolver =
287 GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-resolver", 287 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, "gnunet-service-resolver",
288 "gnunet-service-resolver", NULL); 288 "gnunet-service-resolver", NULL);
289 resolver_users++; 289 resolver_users++;
290 GNUNET_RESOLVER_connect (cfg); 290 GNUNET_RESOLVER_connect (cfg);
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index 8ac301341..bd7829e6f 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -167,7 +167,7 @@ server_load_certificate (struct Plugin *plugin)
167 "No usable TLS certificate found, creating certificate\n"); 167 "No usable TLS certificate found, creating certificate\n");
168 errno = 0; 168 errno = 0;
169 cert_creation = 169 cert_creation =
170 GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, 170 GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL,
171 "gnunet-transport-certificate-creation", 171 "gnunet-transport-certificate-creation",
172 "gnunet-transport-certificate-creation", 172 "gnunet-transport-certificate-creation",
173 key_file, cert_file, NULL); 173 key_file, cert_file, NULL);
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c
index e8522d5e7..dbf71d78a 100644
--- a/src/util/crypto_random.c
+++ b/src/util/crypto_random.c
@@ -284,7 +284,7 @@ entropy_generator (void *cls, const char *what, int printchar, int current,
284 LOG (GNUNET_ERROR_TYPE_INFO, _("Starting `%s' process to generate entropy\n"), 284 LOG (GNUNET_ERROR_TYPE_INFO, _("Starting `%s' process to generate entropy\n"),
285 "find"); 285 "find");
286 genproc = 286 genproc =
287 GNUNET_OS_start_process (GNUNET_NO, 287 GNUNET_OS_start_process (GNUNET_NO, 0,
288 NULL, NULL, "sh", "sh", "-c", 288 NULL, NULL, "sh", "sh", "-c",
289 "exec find / -mount -type f -exec cp {} /dev/null \\; 2>/dev/null", 289 "exec find / -mount -type f -exec cp {} /dev/null \\; 2>/dev/null",
290 NULL); 290 NULL);
diff --git a/src/util/gnunet-uri.c b/src/util/gnunet-uri.c
index 6268360f2..8cc813be5 100644
--- a/src/util/gnunet-uri.c
+++ b/src/util/gnunet-uri.c
@@ -118,7 +118,7 @@ run (void *cls, char *const *args, const char *cfgfile,
118 GNUNET_DISK_pipe_handle (sigpipe, 118 GNUNET_DISK_pipe_handle (sigpipe,
119 GNUNET_DISK_PIPE_END_READ), 119 GNUNET_DISK_PIPE_END_READ),
120 &maint_child_death, NULL); 120 &maint_child_death, NULL);
121 p = GNUNET_OS_start_process (GNUNET_NO, 121 p = GNUNET_OS_start_process (GNUNET_NO, 0,
122 NULL, NULL, 122 NULL, NULL,
123 program, 123 program,
124 program, 124 program,
diff --git a/src/util/helper.c b/src/util/helper.c
index 6a84ff3ef..64f082bee 100644
--- a/src/util/helper.c
+++ b/src/util/helper.c
@@ -314,7 +314,7 @@ start_helper (struct GNUNET_HELPER_Handle *h)
314 h->fh_to_helper = 314 h->fh_to_helper =
315 GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE); 315 GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE);
316 h->helper_proc = 316 h->helper_proc =
317 GNUNET_OS_start_process_vap (GNUNET_NO, 317 GNUNET_OS_start_process_vap (GNUNET_NO, 0,
318 h->helper_in, h->helper_out, 318 h->helper_in, h->helper_out,
319 h->binary_name, 319 h->binary_name,
320 h->binary_argv); 320 h->binary_argv);
diff --git a/src/util/os_priority.c b/src/util/os_priority.c
index c9174dee9..3a10599b5 100644
--- a/src/util/os_priority.c
+++ b/src/util/os_priority.c
@@ -768,6 +768,10 @@ CreateCustomEnvTable (char **vars)
768 * Start a process. 768 * Start a process.
769 * 769 *
770 * @param pipe_control should a pipe be used to send signals to the child? 770 * @param pipe_control should a pipe be used to send signals to the child?
771 * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags controlling which
772 * std handles of the parent are inherited by the child.
773 * pipe_stdin and pipe_stdout take priority over std_inheritance
774 * (when they are non-NULL).
771 * @param pipe_stdin pipe to use to send input to child process (or NULL) 775 * @param pipe_stdin pipe to use to send input to child process (or NULL)
772 * @param pipe_stdout pipe to use to get output from child process (or NULL) 776 * @param pipe_stdout pipe to use to get output from child process (or NULL)
773 * @param lsocks array of listen sockets to dup systemd-style (or NULL); 777 * @param lsocks array of listen sockets to dup systemd-style (or NULL);
@@ -778,6 +782,7 @@ CreateCustomEnvTable (char **vars)
778 */ 782 */
779static struct GNUNET_OS_Process * 783static struct GNUNET_OS_Process *
780start_process (int pipe_control, 784start_process (int pipe_control,
785 enum GNUNET_OS_InheritStdioFlags std_inheritance,
781 struct GNUNET_DISK_PipeHandle *pipe_stdin, 786 struct GNUNET_DISK_PipeHandle *pipe_stdin,
782 struct GNUNET_DISK_PipeHandle *pipe_stdout, 787 struct GNUNET_DISK_PipeHandle *pipe_stdout,
783 const SOCKTYPE *lsocks, 788 const SOCKTYPE *lsocks,
@@ -870,6 +875,10 @@ start_process (int pipe_control,
870 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "dup2"); 875 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "dup2");
871 GNUNET_break (0 == close (fd_stdout_write)); 876 GNUNET_break (0 == close (fd_stdout_write));
872 } 877 }
878 else if (!(std_inheritance & GNUNET_OS_INHERIT_STD_OUT))
879 {
880 close (1);
881 }
873 if (pipe_stdin != NULL) 882 if (pipe_stdin != NULL)
874 { 883 {
875 884
@@ -878,6 +887,14 @@ start_process (int pipe_control,
878 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "dup2"); 887 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "dup2");
879 GNUNET_break (0 == close (fd_stdin_read)); 888 GNUNET_break (0 == close (fd_stdin_read));
880 } 889 }
890 else if (!(std_inheritance & GNUNET_OS_INHERIT_STD_IN))
891 {
892 close (0);
893 }
894 if (!(std_inheritance & GNUNET_OS_INHERIT_STD_ERR))
895 {
896 close (2);
897 }
881 if (lscp != NULL) 898 if (lscp != NULL)
882 { 899 {
883 /* read systemd documentation... */ 900 /* read systemd documentation... */
@@ -961,6 +978,10 @@ start_process (int pipe_control,
961 long lRet; 978 long lRet;
962 HANDLE stdin_handle; 979 HANDLE stdin_handle;
963 HANDLE stdout_handle; 980 HANDLE stdout_handle;
981 HANDLE stdih, stdoh, stdeh;
982 DWORD stdif, stdof, stdef;
983 BOOL bresult;
984 DWORD error_code;
964 985
965 if (GNUNET_SYSERR == GNUNET_OS_check_helper_binary (filename)) 986 if (GNUNET_SYSERR == GNUNET_OS_check_helper_binary (filename))
966 return NULL; /* not executable */ 987 return NULL; /* not executable */
@@ -1083,9 +1104,11 @@ start_process (int pipe_control,
1083 1104
1084 memset (&start, 0, sizeof (start)); 1105 memset (&start, 0, sizeof (start));
1085 start.cb = sizeof (start); 1106 start.cb = sizeof (start);
1086 if ((pipe_stdin != NULL) || (pipe_stdout != NULL)) 1107 if ((pipe_stdin != NULL) || (pipe_stdout != NULL) || (std_inheritance != 0))
1087 start.dwFlags |= STARTF_USESTDHANDLES; 1108 start.dwFlags |= STARTF_USESTDHANDLES;
1088 1109
1110 stdih = GetStdHandle (STD_INPUT_HANDLE);
1111 GetHandleInformation (stdih, &stdif);
1089 if (pipe_stdin != NULL) 1112 if (pipe_stdin != NULL)
1090 { 1113 {
1091 GNUNET_DISK_internal_file_handle_ (GNUNET_DISK_pipe_handle 1114 GNUNET_DISK_internal_file_handle_ (GNUNET_DISK_pipe_handle
@@ -1093,7 +1116,21 @@ start_process (int pipe_control,
1093 &stdin_handle, sizeof (HANDLE)); 1116 &stdin_handle, sizeof (HANDLE));
1094 start.hStdInput = stdin_handle; 1117 start.hStdInput = stdin_handle;
1095 } 1118 }
1119 if (stdih)
1120 {
1121 if (std_inheritance & GNUNET_OS_INHERIT_STD_IN)
1122 {
1123 SetHandleInformation (stdih, HANDLE_FLAG_INHERIT, 1);
1124 if (pipe_stdin == NULL)
1125 start.hStdInput = stdih;
1126 }
1127 else
1128 SetHandleInformation (stdih, HANDLE_FLAG_INHERIT, 0);
1129 }
1130
1096 1131
1132 stdoh = GetStdHandle (STD_OUTPUT_HANDLE);
1133 GetHandleInformation (stdoh, &stdof);
1097 if (pipe_stdout != NULL) 1134 if (pipe_stdout != NULL)
1098 { 1135 {
1099 GNUNET_DISK_internal_file_handle_ (GNUNET_DISK_pipe_handle 1136 GNUNET_DISK_internal_file_handle_ (GNUNET_DISK_pipe_handle
@@ -1102,6 +1139,30 @@ start_process (int pipe_control,
1102 &stdout_handle, sizeof (HANDLE)); 1139 &stdout_handle, sizeof (HANDLE));
1103 start.hStdOutput = stdout_handle; 1140 start.hStdOutput = stdout_handle;
1104 } 1141 }
1142 if (stdoh)
1143 {
1144 if (std_inheritance & GNUNET_OS_INHERIT_STD_OUT)
1145 {
1146 SetHandleInformation (stdoh, HANDLE_FLAG_INHERIT, 1);
1147 if (pipe_stdout == NULL)
1148 start.hStdOutput = stdoh;
1149 }
1150 else
1151 SetHandleInformation (stdoh, HANDLE_FLAG_INHERIT, 0);
1152 }
1153
1154 stdeh = GetStdHandle (STD_ERROR_HANDLE);
1155 GetHandleInformation (stdeh, &stdef);
1156 if (stdeh)
1157 {
1158 if (std_inheritance & GNUNET_OS_INHERIT_STD_ERR)
1159 {
1160 SetHandleInformation (stdeh, HANDLE_FLAG_INHERIT, 1);
1161 start.hStdError = stdeh;
1162 }
1163 else
1164 SetHandleInformation (stdeh, HANDLE_FLAG_INHERIT, 0);
1165 }
1105 1166
1106 if (GNUNET_YES == pipe_control) 1167 if (GNUNET_YES == pipe_control)
1107 { 1168 {
@@ -1179,24 +1240,36 @@ start_process (int pipe_control,
1179 return NULL; 1240 return NULL;
1180 } 1241 }
1181 1242
1182 if (!CreateProcessW (wpath, wcmd, NULL, NULL, TRUE, 1243 bresult = CreateProcessW (wpath, wcmd, NULL, NULL, TRUE,
1183 DETACHED_PROCESS | CREATE_SUSPENDED, env_block, NULL, &start, &proc)) 1244 DETACHED_PROCESS | CREATE_SUSPENDED, env_block, NULL, &start, &proc);
1245 error_code = GetLastError ();
1246
1247 if ((NULL == pipe_stdin) && (stdih))
1248 SetHandleInformation (stdih, HANDLE_FLAG_INHERIT, stdif);
1249
1250
1251 if ((NULL == pipe_stdout) && (stdoh))
1252 SetHandleInformation (stdoh, HANDLE_FLAG_INHERIT, stdof);
1253
1254 if (stdeh)
1255 SetHandleInformation (stdeh, HANDLE_FLAG_INHERIT, stdef);
1256
1257 GNUNET_free (env_block);
1258 GNUNET_free (cmd);
1259 free (wpath);
1260 free (wcmd);
1261
1262 if (!bresult)
1184 { 1263 {
1185 SetErrnoFromWinError (GetLastError ()); 1264 SetErrnoFromWinError (error_code);
1186 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "CreateProcess"); 1265 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "CreateProcess");
1187 if (NULL != control_pipe) 1266 if (NULL != control_pipe)
1188 GNUNET_DISK_file_close (control_pipe); 1267 GNUNET_DISK_file_close (control_pipe);
1189 if (NULL != lsocks) 1268 if (NULL != lsocks)
1190 GNUNET_DISK_pipe_close (lsocks_pipe); 1269 GNUNET_DISK_pipe_close (lsocks_pipe);
1191 GNUNET_free (env_block);
1192 GNUNET_free (cmd);
1193 free (wpath);
1194 free (wcmd);
1195 return NULL; 1270 return NULL;
1196 } 1271 }
1197 1272
1198 GNUNET_free (env_block);
1199
1200 gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process)); 1273 gnunet_proc = GNUNET_malloc (sizeof (struct GNUNET_OS_Process));
1201 gnunet_proc->pid = proc.dwProcessId; 1274 gnunet_proc->pid = proc.dwProcessId;
1202 gnunet_proc->handle = proc.hProcess; 1275 gnunet_proc->handle = proc.hProcess;
@@ -1206,9 +1279,6 @@ start_process (int pipe_control,
1206 1279
1207 ResumeThread (proc.hThread); 1280 ResumeThread (proc.hThread);
1208 CloseHandle (proc.hThread); 1281 CloseHandle (proc.hThread);
1209 GNUNET_free (cmd);
1210 free (wpath);
1211 free (wcmd);
1212 1282
1213 if (lsocks == NULL || lsocks[0] == INVALID_SOCKET) 1283 if (lsocks == NULL || lsocks[0] == INVALID_SOCKET)
1214 return gnunet_proc; 1284 return gnunet_proc;
@@ -1300,6 +1370,7 @@ start_process (int pipe_control,
1300 * Start a process. 1370 * Start a process.
1301 * 1371 *
1302 * @param pipe_control should a pipe be used to send signals to the child? 1372 * @param pipe_control should a pipe be used to send signals to the child?
1373 * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
1303 * @param pipe_stdin pipe to use to send input to child process (or NULL) 1374 * @param pipe_stdin pipe to use to send input to child process (or NULL)
1304 * @param pipe_stdout pipe to use to get output from child process (or NULL) 1375 * @param pipe_stdout pipe to use to get output from child process (or NULL)
1305 * @param filename name of the binary 1376 * @param filename name of the binary
@@ -1308,12 +1379,14 @@ start_process (int pipe_control,
1308 */ 1379 */
1309struct GNUNET_OS_Process * 1380struct GNUNET_OS_Process *
1310GNUNET_OS_start_process_vap (int pipe_control, 1381GNUNET_OS_start_process_vap (int pipe_control,
1382 enum GNUNET_OS_InheritStdioFlags std_inheritance,
1311 struct GNUNET_DISK_PipeHandle *pipe_stdin, 1383 struct GNUNET_DISK_PipeHandle *pipe_stdin,
1312 struct GNUNET_DISK_PipeHandle *pipe_stdout, 1384 struct GNUNET_DISK_PipeHandle *pipe_stdout,
1313 const char *filename, 1385 const char *filename,
1314 char *const argv[]) 1386 char *const argv[])
1315{ 1387{
1316 return start_process (pipe_control, 1388 return start_process (pipe_control,
1389 std_inheritance,
1317 pipe_stdin, 1390 pipe_stdin,
1318 pipe_stdout, 1391 pipe_stdout,
1319 NULL, 1392 NULL,
@@ -1326,6 +1399,7 @@ GNUNET_OS_start_process_vap (int pipe_control,
1326 * Start a process. 1399 * Start a process.
1327 * 1400 *
1328 * @param pipe_control should a pipe be used to send signals to the child? 1401 * @param pipe_control should a pipe be used to send signals to the child?
1402 * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
1329 * @param pipe_stdin pipe to use to send input to child process (or NULL) 1403 * @param pipe_stdin pipe to use to send input to child process (or NULL)
1330 * @param pipe_stdout pipe to use to get output from child process (or NULL) 1404 * @param pipe_stdout pipe to use to get output from child process (or NULL)
1331 * @param filename name of the binary 1405 * @param filename name of the binary
@@ -1334,6 +1408,7 @@ GNUNET_OS_start_process_vap (int pipe_control,
1334 */ 1408 */
1335struct GNUNET_OS_Process * 1409struct GNUNET_OS_Process *
1336GNUNET_OS_start_process_va (int pipe_control, 1410GNUNET_OS_start_process_va (int pipe_control,
1411 enum GNUNET_OS_InheritStdioFlags std_inheritance,
1337 struct GNUNET_DISK_PipeHandle *pipe_stdin, 1412 struct GNUNET_DISK_PipeHandle *pipe_stdin,
1338 struct GNUNET_DISK_PipeHandle *pipe_stdout, 1413 struct GNUNET_DISK_PipeHandle *pipe_stdout,
1339 const char *filename, va_list va) 1414 const char *filename, va_list va)
@@ -1355,6 +1430,7 @@ GNUNET_OS_start_process_va (int pipe_control,
1355 argc++; 1430 argc++;
1356 va_end (ap); 1431 va_end (ap);
1357 ret = GNUNET_OS_start_process_vap (pipe_control, 1432 ret = GNUNET_OS_start_process_vap (pipe_control,
1433 std_inheritance,
1358 pipe_stdin, 1434 pipe_stdin,
1359 pipe_stdout, 1435 pipe_stdout,
1360 filename, 1436 filename,
@@ -1369,6 +1445,7 @@ GNUNET_OS_start_process_va (int pipe_control,
1369 * Start a process. 1445 * Start a process.
1370 * 1446 *
1371 * @param pipe_control should a pipe be used to send signals to the child? 1447 * @param pipe_control should a pipe be used to send signals to the child?
1448 * @param std_inheritance a set of GNUNET_OS_INHERIT_STD_* flags
1372 * @param pipe_stdin pipe to use to send input to child process (or NULL) 1449 * @param pipe_stdin pipe to use to send input to child process (or NULL)
1373 * @param pipe_stdout pipe to use to get output from child process (or NULL) 1450 * @param pipe_stdout pipe to use to get output from child process (or NULL)
1374 * @param filename name of the binary 1451 * @param filename name of the binary
@@ -1379,6 +1456,7 @@ GNUNET_OS_start_process_va (int pipe_control,
1379 */ 1456 */
1380struct GNUNET_OS_Process * 1457struct GNUNET_OS_Process *
1381GNUNET_OS_start_process (int pipe_control, 1458GNUNET_OS_start_process (int pipe_control,
1459 enum GNUNET_OS_InheritStdioFlags std_inheritance,
1382 struct GNUNET_DISK_PipeHandle *pipe_stdin, 1460 struct GNUNET_DISK_PipeHandle *pipe_stdin,
1383 struct GNUNET_DISK_PipeHandle *pipe_stdout, 1461 struct GNUNET_DISK_PipeHandle *pipe_stdout,
1384 const char *filename, ...) 1462 const char *filename, ...)
@@ -1387,7 +1465,8 @@ GNUNET_OS_start_process (int pipe_control,
1387 va_list ap; 1465 va_list ap;
1388 1466
1389 va_start (ap, filename); 1467 va_start (ap, filename);
1390 ret = GNUNET_OS_start_process_va (pipe_control, pipe_stdin, pipe_stdout, filename, ap); 1468 ret = GNUNET_OS_start_process_va (pipe_control, std_inheritance, pipe_stdin,
1469 pipe_stdout, filename, ap);
1391 va_end (ap); 1470 va_end (ap);
1392 return ret; 1471 return ret;
1393} 1472}
@@ -1405,11 +1484,13 @@ GNUNET_OS_start_process (int pipe_control,
1405 */ 1484 */
1406struct GNUNET_OS_Process * 1485struct GNUNET_OS_Process *
1407GNUNET_OS_start_process_v (int pipe_control, 1486GNUNET_OS_start_process_v (int pipe_control,
1487 enum GNUNET_OS_InheritStdioFlags std_inheritance,
1408 const SOCKTYPE *lsocks, 1488 const SOCKTYPE *lsocks,
1409 const char *filename, 1489 const char *filename,
1410 char *const argv[]) 1490 char *const argv[])
1411{ 1491{
1412 return start_process (pipe_control, 1492 return start_process (pipe_control,
1493 std_inheritance,
1413 NULL, 1494 NULL,
1414 NULL, 1495 NULL,
1415 lsocks, 1496 lsocks,
@@ -1723,7 +1804,8 @@ GNUNET_OS_command_run (GNUNET_OS_LineProcessor proc, void *proc_cls,
1723 if (NULL == opipe) 1804 if (NULL == opipe)
1724 return NULL; 1805 return NULL;
1725 va_start (ap, binary); 1806 va_start (ap, binary);
1726 eip = GNUNET_OS_start_process_va (GNUNET_NO, NULL, opipe, binary, ap); 1807 /* redirect stdout, don't inherit stderr/stdin */
1808 eip = GNUNET_OS_start_process_va (GNUNET_NO, 0, NULL, opipe, binary, ap);
1727 va_end (ap); 1809 va_end (ap);
1728 if (NULL == eip) 1810 if (NULL == eip)
1729 { 1811 {
diff --git a/src/util/test_common_logging_runtime_loglevels.c b/src/util/test_common_logging_runtime_loglevels.c
index d01cd3bce..4c6ae0039 100644
--- a/src/util/test_common_logging_runtime_loglevels.c
+++ b/src/util/test_common_logging_runtime_loglevels.c
@@ -317,7 +317,7 @@ runone ()
317 break; 317 break;
318 } 318 }
319 319
320 proc = GNUNET_OS_start_process (GNUNET_NO, NULL, pipe_stdout, 320 proc = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, pipe_stdout,
321#if MINGW 321#if MINGW
322 "test_common_logging_dummy", 322 "test_common_logging_dummy",
323#else 323#else
diff --git a/src/util/test_os_start_process.c b/src/util/test_os_start_process.c
index 3c30c75f3..e24e09500 100644
--- a/src/util/test_os_start_process.c
+++ b/src/util/test_os_start_process.c
@@ -131,7 +131,7 @@ run_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
131 } 131 }
132 132
133 proc = 133 proc =
134 GNUNET_OS_start_process (GNUNET_NO, hello_pipe_stdin, hello_pipe_stdout, fn, 134 GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn,
135 "test_gnunet_echo_hello", "-", NULL); 135 "test_gnunet_echo_hello", "-", NULL);
136 GNUNET_free (fn); 136 GNUNET_free (fn);
137 137
@@ -200,7 +200,7 @@ check_kill ()
200 return 1; 200 return 1;
201 } 201 }
202 proc = 202 proc =
203 GNUNET_OS_start_process (GNUNET_YES, hello_pipe_stdin, hello_pipe_stdout, fn, 203 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn,
204 "gnunet-service-resolver", "-", NULL); 204 "gnunet-service-resolver", "-", NULL);
205 sleep (1); /* give process time to start, so we actually use the pipe-kill mechanism! */ 205 sleep (1); /* give process time to start, so we actually use the pipe-kill mechanism! */
206 if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) 206 if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
@@ -233,7 +233,7 @@ check_instant_kill ()
233 return 1; 233 return 1;
234 } 234 }
235 proc = 235 proc =
236 GNUNET_OS_start_process (GNUNET_YES, hello_pipe_stdin, hello_pipe_stdout, fn, 236 GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_ERR, hello_pipe_stdin, hello_pipe_stdout, fn,
237 "gnunet-service-resolver", "-", NULL); 237 "gnunet-service-resolver", "-", NULL);
238 if (0 != GNUNET_OS_process_kill (proc, SIGTERM)) 238 if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
239 { 239 {
diff --git a/src/util/test_resolver_api.c b/src/util/test_resolver_api.c
index f924661dd..b9ca81b0f 100644
--- a/src/util/test_resolver_api.c
+++ b/src/util/test_resolver_api.c
@@ -370,7 +370,7 @@ main (int argc, char *argv[])
370 pfx = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR); 370 pfx = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR);
371 GNUNET_asprintf (&fn, "%s%cgnunet-service-resolver", pfx, DIR_SEPARATOR); 371 GNUNET_asprintf (&fn, "%s%cgnunet-service-resolver", pfx, DIR_SEPARATOR);
372 GNUNET_free (pfx); 372 GNUNET_free (pfx);
373 proc = GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, fn, "gnunet-service-resolver", 373 proc = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, fn, "gnunet-service-resolver",
374 "-c", "test_resolver_api_data.conf", NULL); 374 "-c", "test_resolver_api_data.conf", NULL);
375 GNUNET_assert (NULL != proc); 375 GNUNET_assert (NULL != proc);
376 GNUNET_free (fn); 376 GNUNET_free (fn);