aboutsummaryrefslogtreecommitdiff
path: root/src/arm/gnunet-arm.c
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/arm/gnunet-arm.c
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/arm/gnunet-arm.c')
-rw-r--r--src/arm/gnunet-arm.c18
1 files changed, 18 insertions, 0 deletions
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