Tizen RT Libs&Environment  v1.0 D5
spawn.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  ****************************************************************************/
18 
19 /****************************************************************************
20  * include/tinyara/spawn.h
21  *
22  * Copyright (C) 2013 Gregory Nutt. All rights reserved.
23  * Author: Gregory Nutt <gnutt@nuttx.org>
24  *
25  * Redistribution and use in source and binary forms, with or without
26  * modification, are permitted provided that the following conditions
27  * are met:
28  *
29  * 1. Redistributions of source code must retain the above copyright
30  * notice, this list of conditions and the following disclaimer.
31  * 2. Redistributions in binary form must reproduce the above copyright
32  * notice, this list of conditions and the following disclaimer in
33  * the documentation and/or other materials provided with the
34  * distribution.
35  * 3. Neither the name NuttX nor the names of its contributors may be
36  * used to endorse or promote products derived from this software
37  * without specific prior written permission.
38  *
39  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
40  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
41  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
42  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
43  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
44  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
45  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
46  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
47  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
49  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
50  * POSSIBILITY OF SUCH DAMAGE.
51  *
52  ****************************************************************************/
55 
56 #ifndef __INCLUDE_TINYARA_SPAWN_H
57 #define __INCLUDE_TINYARA_SPAWN_H
58 
59 /****************************************************************************
60  * Included Files
61  ****************************************************************************/
62 
63 #include <tinyara/config.h>
64 
65 #include <spawn.h>
66 
67 /****************************************************************************
68  * Pre-processor Definitions
69  ****************************************************************************/
70 
71 /****************************************************************************
72  * Type Definitions
73  ****************************************************************************/
74 /* This enumerator identifies a file action */
75 
85 };
86 
87 /* posix_spawn_file_actions_addclose(), posix_spawn_file_actions_adddup2(),
88  * and posix_spawn_file_actions_addopen() will allocate memory and append
89  * a new file action to an instance of posix_spawn_file_actions_t. The
90  * internal representation of these structures are defined below:
91  */
92 
98  FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */
99  enum spawn_file_actions_e action; /* A member of enum spawn_file_actions_e */
100 };
101 
107  FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */
108  enum spawn_file_actions_e action; /* SPAWN_FILE_ACTION_CLOSE */
109  int fd; /* The file descriptor to close */
110 };
111 
117  FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */
118  enum spawn_file_actions_e action; /* SPAWN_FILE_ACTION_DUP2 */
119  int fd1; /* The first file descriptor for dup2() */
120  int fd2; /* The second file descriptor for dup2() */
121 };
122 
128  FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */
129  enum spawn_file_actions_e action; /* SPAWN_FILE_ACTION_OPEN */
130  int fd; /* The file descriptor after opening */
131  int oflags; /* Open flags */
132  mode_t mode; /* File creation mode */
133  char path[1]; /* Start of the path to be
134  * opened */
135 };
136 
137 #define SIZEOF_OPEN_FILE_ACTION_S(n) \
138  (sizeof(struct spawn_open_file_action_s) + (n))
139 
140 /****************************************************************************
141  * Public Function Prototypes
142  ****************************************************************************/
143 
144 #ifdef __cplusplus
145 extern "C" {
146 #endif
147 
157 void add_file_action(FAR posix_spawn_file_actions_t *file_action, FAR struct spawn_general_file_action_s *entry);
158 
159 #ifdef __cplusplus
160 }
161 #endif
162 #endif /* __INCLUDE_TINYARA_SPAWN_H */
SPAWN APIs.
FAR struct spawn_general_file_action_s * flink
Definition: spawn.h:128
structure for spawn dup2 file action
Definition: spawn.h:116
structure for spawn close file action
Definition: spawn.h:106
structure for general file action
Definition: spawn.h:97
void add_file_action(FAR posix_spawn_file_actions_t *file_action, FAR struct spawn_general_file_action_s *entry)
Add the file action to the end for the file action list.
FAR void * posix_spawn_file_actions_t
Definition: spawn.h:137
structure for spawn open file action
Definition: spawn.h:127
FAR struct spawn_general_file_action_s * flink
Definition: spawn.h:107
enum spawn_file_actions_e action
Definition: spawn.h:99
spawn_file_actions_e
enum of spawn_file_action
Definition: spawn.h:80
FAR struct spawn_general_file_action_s * flink
Definition: spawn.h:98
FAR struct spawn_general_file_action_s * flink
Definition: spawn.h:117