Add a duplicate a file descriptor action to a spawn file actions object
#include <spawn.h> int posix_spawn_file_actions_adddup2( posix_spawn_file_actions_t *fact_p, int fd, int new_fd);
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The posix_spawn_file_actions_adddup2() function adds a dup2() action to the object referenced by fact_p that causes the file descriptor fd to be duplicated as new_fd (as if a call were made to dup2(fd, new_fd)) when a new process is spawned using this file actions object.
It isn't considered an error for the fd argument to specify a file descriptor for which the specified operation couldn't be performed at the time of the call. Any such error will be detected when the associated file actions object is later used during a posix_spawn() or posix_spawnp() operation.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | Yes |
Signal handler | Yes |
Thread | Yes |