aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_os_lib.h
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/include/gnunet_os_lib.h
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/include/gnunet_os_lib.h')
-rw-r--r--src/include/gnunet_os_lib.h53
1 files changed, 53 insertions, 0 deletions
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[]);