process-spec: add another flag FORK_WAIT to safe_fork()

This new flag will cause safe_fork() to wait for the forked off child
before returning. This allows us to unify a number of cases where we
immediately wait on the forked off child, witout running any code in the
parent after the fork, and without direct interest in the precise exit
status of the process, except recgonizing EXIT_SUCCESS vs everything
else.
This commit is contained in:
Lennart Poettering
2018-01-04 13:27:27 +01:00
parent 66fb11423b
commit 1f5d1e0247
8 changed files with 46 additions and 58 deletions
+1
View File
@@ -167,6 +167,7 @@ typedef enum ForkFlags {
FORK_NULL_STDIO = 1U << 3,
FORK_REOPEN_LOG = 1U << 4,
FORK_LOG = 1U << 5,
FORK_WAIT = 1U << 6,
} ForkFlags;
int safe_fork_full(const char *name, const int except_fds[], size_t n_except_fds, ForkFlags flags, pid_t *ret_pid);