1POSIX_SPAWN_FILE_ACTIONS_ADDPDOUSPI2X(PP)rogrammer'PsOSMIaXn_uSaPlAWN_FILE_ACTIONS_ADDDUP2(P)
2
3
4
6 posix_spawn_file_actions_adddup2 - add dup2 action to spawn file
7 actions object (ADVANCED REALTIME)
8
10 #include <spawn.h>
11
12 int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *
13 file_actions, int fildes, int newfildes);
14
15
17 The posix_spawn_file_actions_adddup2() function shall add a dup2()
18 action to the object referenced by file_actions that shall cause the
19 file descriptor fildes to be duplicated as newfildes (as if dup2(
20 fildes, newfildes) had been called) when a new process is spawned using
21 this file actions object.
22
23 A spawn file actions object is as defined in
24 posix_spawn_file_actions_addclose() .
25
27 Upon successful completion, the posix_spawn_file_actions_adddup2()
28 function shall return zero; otherwise, an error number shall be
29 returned to indicate the error.
30
32 The posix_spawn_file_actions_adddup2() function shall fail if:
33
34 EBADF The value specified by fildes or newfildes is negative or
35 greater than or equal to {OPEN_MAX}.
36
37 ENOMEM Insufficient memory exists to add to the spawn file actions
38 object.
39
40
41 The posix_spawn_file_actions_adddup2() function may fail if:
42
43 EINVAL The value specified by file_actions is invalid.
44
45
46 It shall not be considered an error for the fildes argument passed to
47 the posix_spawn_file_actions_adddup2() function to specify a file
48 descriptor for which the specified operation could not be performed at
49 the time of the call. Any such error will be detected when the associ‐
50 ated file actions object is later used during a posix_spawn() or
51 posix_spawnp() operation.
52
53 The following sections are informative.
54
56 None.
57
59 The posix_spawn_file_actions_adddup2() function is part of the Spawn
60 option and need not be provided on all implementations.
61
63 Refer to the RATIONALE in posix_spawn_file_actions_addclose() .
64
66 None.
67
69 dup() , posix_spawn() , posix_spawn_file_actions_addclose() ,
70 posix_spawn_file_actions_destroy() , posix_spawnp() , the Base Defini‐
71 tions volume of IEEE Std 1003.1-2001, <spawn.h>
72
74 Portions of this text are reprinted and reproduced in electronic form
75 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
76 -- Portable Operating System Interface (POSIX), The Open Group Base
77 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
78 Electrical and Electronics Engineers, Inc and The Open Group. In the
79 event of any discrepancy between this version and the original IEEE and
80 The Open Group Standard, the original IEEE and The Open Group Standard
81 is the referee document. The original Standard can be obtained online
82 at http://www.opengroup.org/unix/online.html .
83
84
85
86IEEE/The Open Group 2003 POSIX_SPAWN_FILE_ACTIONS_ADDDUP2(P)