1posix_spawn_file_actions_aSdtdacnldoasred(3CC)LibrarpyosFiuxn_cstpiaownns_file_actions_addclose(3C)
2
3
4

NAME

6       posix_spawn_file_actions_addclose,  posix_spawn_file_actions_addopen  -
7       add close or open action to spawn file actions object
8

SYNOPSIS

10       #include <spawn.h>
11
12       int posix_spawn_file_actions_addclose(
13            posix_spawn_file_actions_t *file_actions, int fildes);
14
15
16       int posix_spawn_file_actions_addopen(
17            posix_spawn_file_actions_t *restrict file_actions, int fildes,
18            const char *restrict path, int oflag, mode_t mode);
19
20

DESCRIPTION

22       These functions add or delete a close or open action to  a  spawn  file
23       actions object.
24
25
26       A  spawn  file  actions  object  is  of type posix_spawn_file_actions_t
27       (defined in <spawn.h>) and is used to specify a series of actions to be
28       performed  by  a posix_spawn(3C) or posix_spawn(3C) operation to arrive
29       at the set of open file descriptors for the child process given the set
30       of open file descriptors of the parent.
31
32
33       A   spawn   file  actions  object,  when  passed  to  posix_spawn()  or
34       posix_spawnp(), specifies how the set of open file descriptors  in  the
35       calling  process  is  transformed  into  a set of potentially open file
36       descriptors for the spawned  process.  This  transformation  occurs  as
37       though the specified sequence of actions was performed exactly once, in
38       the context of the spawned process  (prior  to  execution  of  the  new
39       process  image),  in  the  order in which the actions were added to the
40       object.  Additionally, when the new process image is executed, any file
41       descriptor  (from  this  new  set) which has its FD_CLOEXEC flag set is
42       closed (see posix_spawn(3C)).
43
44
45       The posix_spawn_file_actions_addclose() function adds a close action to
46       the  object  referenced by file_actions that causes the file descriptor
47       fildes to be closed (as if close(fildes) had been called)  when  a  new
48       process is spawned using this file actions object.
49
50
51       The  posix_spawn_file_actions_addopen() function adds an open action to
52       the object referenced by file_actions that causes  the  file  named  by
53       path  to  be opened (as if open(path, oflag, mode) had been called, and
54       the returned file descriptor,  if  not  fildes,  had  been  changed  to
55       fildes)  when  a new process is spawned using this file actions object.
56       If fildes was already an open file descriptor, it is closed before  the
57       new file is opened.
58
59
60       The     string     described    by    path    is    copied    by    the
61       posix_spawn_file_actions_addopen() function.
62

RETURN VALUES

64       Upon successful completion, these functions  return  0.  Otherwise,  an
65       error number is returned to indicate the error.
66

ERRORS

68       These functions will fail if:
69
70       EBADF    The  value  specified by fildes is negative or greater than or
71                equal to {OPEN_MAX}.
72
73
74
75       These functions may fail if:
76
77       EINVAL    The value specified by file_actions is invalid.
78
79
80       ENOMEM    Insufficient memory exists to add to the spawn  file  actions
81                 object.
82
83
84
85       It  is  not considered an error for the fildes argument passed to these
86       functions to specify a file descriptor for which the  specified  opera‐
87       tion  could  not  be  performed at the time of the call. Any such error
88       will be detected when the associated file actions object is later  used
89       during a posix_spawn() or posix_spawnp() operation.
90
91
92       If  a close(2) operation is specified for a file descriptor that is not
93       open at the time of the call to posix_spawn()  or  posix_spawnp(),  the
94       close  operation  will  not  cause  the posix_spawn() or posix_spawnp()
95       operation to fail.
96

ATTRIBUTES

98       See attributes(5) for descriptions of the following attributes:
99
100
101
102
103       ┌─────────────────────────────┬─────────────────────────────┐
104       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
105       ├─────────────────────────────┼─────────────────────────────┤
106       │Interface Stability          │Committed                    │
107       ├─────────────────────────────┼─────────────────────────────┤
108       │MT-Level                     │MT-Safe                      │
109       ├─────────────────────────────┼─────────────────────────────┤
110       │Standard                     │See standards(5).            │
111       └─────────────────────────────┴─────────────────────────────┘
112

SEE ALSO

114       close(2),          dup(2),          open(2),           posix_spawn(3C),
115       posix_spawn_file_actions_adddup2(3C),
116       posix_spawn_file_actions_destroy(3C), attributes(5), standards(5)
117
118
119
120SunOS 5.11                        20 Feb 2p0o0s9ix_spawn_file_actions_addclose(3C)
Impressum