fd-util: Expose helper to pack fds into 3,4,5,...
This is useful for situations where an array of FDs is to be passed into a child process (i.e. by passing it through safe_fork). This function can be called in the child (before calling exec) to pack the FDs to all be next to each-other starting from SD_LISTEN_FDS_START (i.e. 3)
This commit is contained in:
committed by
Luca Boccassi
parent
034569150f
commit
85f660d46b
@@ -539,7 +539,7 @@ int fork_agent(const char *name, const int except[], size_t n_except, pid_t *ret
|
||||
|
||||
r = safe_fork_full(name,
|
||||
NULL,
|
||||
except,
|
||||
(int*) except, /* safe_fork_full only changes except if you pass in FORK_PACK_FDS, which we don't */
|
||||
n_except,
|
||||
FORK_RESET_SIGNALS|FORK_DEATHSIG_SIGTERM|FORK_CLOSE_ALL_FDS|FORK_REOPEN_LOG|FORK_RLIMIT_NOFILE_SAFE,
|
||||
ret_pid);
|
||||
|
||||
Reference in New Issue
Block a user