I\'d like to spawn a collection of processes using posix_spawn(...) (or something very similar). This function accept an argument of type posix_spawn_file_actions_t, which a
Either set the FD_CLOEXEC (using fcntl()) on all open file descriptors before creating the new process, or have open() set the O_CLOEXEC flag.
From the posix_spawn() specification:
If file_actions is a null pointer, then file descriptors open in the calling process shall remain open in the child process, except for those whose close-on- exec flag FD_CLOEXEC is set (see fcntl() ).