posix_spawn_file_actions_adddup2()

add dup2 action to spawn file actions object 

Advanced Realtime Function


SYNOPSIS

#include <spawn.h>

int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *file_actions, int fildes, int newfildes);


DESCRIPTION

The posix_spawn_file_actions_adddup2() function adds a dup2 action to the file_actions object. This action causes the file descriptor fildes to be duplicated as newfildes (as if dup2(fildes, newfildes) had been called) when posix_spawn() or posix_spawnp() spawns a new process using this file actions object.

For more information on spawn file actions objects, see the posix_spawn_file_actions_addclose() reference page.


PARAMETERS

fildes 

Specifies a file descriptor.

file_actions 

Points to a spawn file actions object.

newfildes 

Specifies the file descriptor to be created as a duplicate of fildes.


RETURN VALUES

On successful completion, posix_spawn_file_actions_adddup2() returns zero.

Otherwise, this function returns one of the following error numbers:

EBADF 

One or both of the file descriptors specified, fildes and newfildes, is either a negative value or is greater than or equal to {OPEN_MAX}.

ENOMEM 

There is not enough memory to add to the spawn file actions object.

EINVAL 

The file_actions argument contains an invalid value.

Note:

It is not considered an error when fildes specifies a file descriptor for which the specified operation could not be performed at the time of the call. Such an error is, however, detected when the file actions object is later used in a posix_spawn() or posix_spawnp() function call.


CONFORMANCE

UNIX 03.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
dup2(), posix_spawn(), posix_spawn_file_actions_addclose(), posix_spawn_file_actions_destroy(), posix_spawnp()

Miscellaneous:
spawn


PTC MKS Toolkit 10.3 Documentation Build 39.