1 |
/* |
2 |
* process.h |
3 |
* |
4 |
* Declarations of functions for spawning child processes. |
5 |
* |
6 |
* $Id: process.h,v 0e4f78dbc1ba 2016/06/17 14:16:01 keithmarshall $ |
7 |
* |
8 |
* Written by Colin Peters <colin@bird.fu.is.saga-u.ac.jp> |
9 |
* Copyright (C) 1997-2001, 2003-2004, 2007-2008, 2016, MinGW.org Project. |
10 |
* |
11 |
* |
12 |
* Permission is hereby granted, free of charge, to any person obtaining a |
13 |
* copy of this software and associated documentation files (the "Software"), |
14 |
* to deal in the Software without restriction, including without limitation |
15 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, |
16 |
* and/or sell copies of the Software, and to permit persons to whom the |
17 |
* Software is furnished to do so, subject to the following conditions: |
18 |
* |
19 |
* The above copyright notice, this permission notice, and the following |
20 |
* disclaimer shall be included in all copies or substantial portions of |
21 |
* the Software. |
22 |
* |
23 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
24 |
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
25 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
26 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
27 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
28 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER |
29 |
* DEALINGS IN THE SOFTWARE. |
30 |
* |
31 |
*/ |
32 |
#ifndef _PROCESS_H |
33 |
#pragma GCC system_header |
34 |
|
35 |
/* Defer defining the normal _PROCESS_H multiple inclusion guard macro, |
36 |
* to facilitate selective inclusion by <wchar.h>, (in which case we do |
37 |
* not wish to define it). |
38 |
*/ |
39 |
#ifndef __WCHAR_H_SOURCED__ |
40 |
#define _PROCESS_H |
41 |
|
42 |
/* All MinGW headers must include <_mingw.h>; do so here, assuming |
43 |
* that <wchar.h> will have already taken care of it, for the case |
44 |
* of selective inclusion. |
45 |
*/ |
46 |
#include <_mingw.h> |
47 |
|
48 |
/* This gives us more than we really need, but it gets us _pid_t |
49 |
* (and its pid_t equivalent), which we do need. |
50 |
*/ |
51 |
#include <sys/types.h> |
52 |
|
53 |
/* Constants for cwait actions; obsolete for Win32. |
54 |
*/ |
55 |
#define _WAIT_CHILD 0 |
56 |
#define _WAIT_GRANDCHILD 1 |
57 |
|
58 |
#ifndef _NO_OLDNAMES |
59 |
#define WAIT_CHILD _WAIT_CHILD |
60 |
#define WAIT_GRANDCHILD _WAIT_GRANDCHILD |
61 |
#endif /* !_NO_OLDNAMES */ |
62 |
#endif /* !__WCHAR_H_SOURCED__ */ |
63 |
|
64 |
/* Mode constants for spawn() functions. |
65 |
*/ |
66 |
#define _P_WAIT 0 |
67 |
#define _P_NOWAIT 1 |
68 |
#define _P_OVERLAY 2 |
69 |
#define _OLD_P_OVERLAY _P_OVERLAY |
70 |
#define _P_NOWAITO 3 |
71 |
#define _P_DETACH 4 |
72 |
|
73 |
#ifndef _NO_OLDNAMES |
74 |
#define P_WAIT _P_WAIT |
75 |
#define P_NOWAIT _P_NOWAIT |
76 |
#define P_OVERLAY _P_OVERLAY |
77 |
#define OLD_P_OVERLAY _OLD_P_OVERLAY |
78 |
#define P_NOWAITO _P_NOWAITO |
79 |
#define P_DETACH _P_DETACH |
80 |
#endif /* !_NO_OLDNAMES */ |
81 |
|
82 |
#ifndef RC_INVOKED |
83 |
|
84 |
/* All Microsoft implementations of the exec() and spawn() functions |
85 |
* are declared with intptr_t as their return type; get its definition |
86 |
* by selective inclusion from "stdint.h"; (note: use #include "..." |
87 |
* here, to avoid side effects from any alternative <stdint.h>, which |
88 |
* is not in the same directory as this <process.h>). |
89 |
*/ |
90 |
#define __need_intptr_t |
91 |
#include "stdint.h" |
92 |
|
93 |
_BEGIN_C_DECLS |
94 |
|
95 |
#ifdef _PROCESS_H |
96 |
_CRTIMP __cdecl __MINGW_NOTHROW void _cexit (void); |
97 |
_CRTIMP __cdecl __MINGW_NOTHROW void _c_exit (void); |
98 |
|
99 |
_CRTIMP __cdecl __MINGW_NOTHROW int _cwait (int *, _pid_t, int); |
100 |
|
101 |
_CRTIMP __cdecl __MINGW_NOTHROW _pid_t _getpid (void); |
102 |
|
103 |
_CRTIMP __cdecl __MINGW_NOTHROW |
104 |
intptr_t _execl (const char *, const char *, ...); |
105 |
|
106 |
_CRTIMP __cdecl __MINGW_NOTHROW |
107 |
intptr_t _execle (const char *, const char *, ...); |
108 |
|
109 |
_CRTIMP __cdecl __MINGW_NOTHROW |
110 |
intptr_t _execlp (const char *, const char *, ...); |
111 |
|
112 |
_CRTIMP __cdecl __MINGW_NOTHROW |
113 |
intptr_t _execlpe (const char *, const char *, ...); |
114 |
|
115 |
_CRTIMP __cdecl __MINGW_NOTHROW |
116 |
intptr_t _execv (const char *, const char * const *); |
117 |
|
118 |
_CRTIMP __cdecl __MINGW_NOTHROW |
119 |
intptr_t _execve (const char *, const char * const *, const char * const *); |
120 |
|
121 |
_CRTIMP __cdecl __MINGW_NOTHROW |
122 |
intptr_t _execvp (const char *, const char * const *); |
123 |
|
124 |
_CRTIMP __cdecl __MINGW_NOTHROW |
125 |
intptr_t _execvpe (const char *, const char * const *, const char * const *); |
126 |
|
127 |
_CRTIMP __cdecl __MINGW_NOTHROW |
128 |
intptr_t _spawnl (int, const char *, const char *, ...); |
129 |
|
130 |
_CRTIMP __cdecl __MINGW_NOTHROW |
131 |
intptr_t _spawnle (int, const char *, const char *, ...); |
132 |
|
133 |
_CRTIMP __cdecl __MINGW_NOTHROW |
134 |
intptr_t _spawnlp (int, const char *, const char *, ...); |
135 |
|
136 |
_CRTIMP __cdecl __MINGW_NOTHROW |
137 |
intptr_t _spawnlpe (int, const char *, const char *, ...); |
138 |
|
139 |
_CRTIMP __cdecl __MINGW_NOTHROW |
140 |
intptr_t _spawnv (int, const char *, const char * const *); |
141 |
|
142 |
_CRTIMP __cdecl __MINGW_NOTHROW |
143 |
intptr_t _spawnve (int, const char *, const char * const *, const char * const *); |
144 |
|
145 |
_CRTIMP __cdecl __MINGW_NOTHROW |
146 |
intptr_t _spawnvp (int, const char *, const char * const *); |
147 |
|
148 |
_CRTIMP __cdecl __MINGW_NOTHROW |
149 |
intptr_t _spawnvpe (int, const char *, const char * const *, const char * const *); |
150 |
|
151 |
/* Thread initiation and termination functions. |
152 |
* |
153 |
* NOTE: Apparently _endthread() calls CloseHandle() on the handle of the |
154 |
* thread, creating a potential for race conditions, if you are not careful. |
155 |
* Basically, you MUST ensure that NOTHING attempts to do ANYTHING with the |
156 |
* thread handle after the thread calls _endthread(), or returns from the |
157 |
* thread function. |
158 |
* |
159 |
* NOTE: No old names for these functions. Use the underscore. |
160 |
*/ |
161 |
_CRTIMP __cdecl __MINGW_NOTHROW |
162 |
unsigned long _beginthread (void (*)(void *), unsigned, void *); |
163 |
|
164 |
_CRTIMP __cdecl __MINGW_NOTHROW void _endthread (void); |
165 |
|
166 |
#ifdef __MSVCRT__ |
167 |
_CRTIMP __cdecl __MINGW_NOTHROW unsigned long _beginthreadex |
168 |
(void *, unsigned, unsigned (__stdcall *) (void *), void *, unsigned, unsigned *); |
169 |
|
170 |
_CRTIMP __cdecl __MINGW_NOTHROW void _endthreadex (unsigned); |
171 |
#endif |
172 |
|
173 |
#ifndef _NO_OLDNAMES |
174 |
/* Functions named without the leading underscore, for portability. |
175 |
* These functions live in liboldnames.a. |
176 |
*/ |
177 |
_CRTIMP __cdecl __MINGW_NOTHROW int cwait (int *, pid_t, int); |
178 |
_CRTIMP __cdecl __MINGW_NOTHROW pid_t getpid (void); |
179 |
|
180 |
_CRTIMP __cdecl __MINGW_NOTHROW |
181 |
intptr_t execl (const char *, const char *, ...); |
182 |
|
183 |
_CRTIMP __cdecl __MINGW_NOTHROW |
184 |
intptr_t execle (const char *, const char *, ...); |
185 |
|
186 |
_CRTIMP __cdecl __MINGW_NOTHROW |
187 |
intptr_t execlp (const char *, const char *, ...); |
188 |
|
189 |
_CRTIMP __cdecl __MINGW_NOTHROW |
190 |
intptr_t execlpe (const char *, const char *,...); |
191 |
|
192 |
_CRTIMP __cdecl __MINGW_NOTHROW |
193 |
intptr_t execv (const char *, const char * const *); |
194 |
|
195 |
_CRTIMP __cdecl __MINGW_NOTHROW |
196 |
intptr_t execve (const char *, const char * const *, const char * const *); |
197 |
|
198 |
_CRTIMP __cdecl __MINGW_NOTHROW |
199 |
intptr_t execvp (const char *, const char * const *); |
200 |
|
201 |
_CRTIMP __cdecl __MINGW_NOTHROW |
202 |
intptr_t execvpe (const char *, const char * const *, const char * const *); |
203 |
|
204 |
_CRTIMP __cdecl __MINGW_NOTHROW |
205 |
intptr_t spawnl (int, const char *, const char *, ...); |
206 |
|
207 |
_CRTIMP __cdecl __MINGW_NOTHROW |
208 |
intptr_t spawnle (int, const char *, const char *, ...); |
209 |
|
210 |
_CRTIMP __cdecl __MINGW_NOTHROW |
211 |
intptr_t spawnlp (int, const char *, const char *, ...); |
212 |
|
213 |
_CRTIMP __cdecl __MINGW_NOTHROW |
214 |
intptr_t spawnlpe (int, const char *, const char *, ...); |
215 |
|
216 |
_CRTIMP __cdecl __MINGW_NOTHROW |
217 |
intptr_t spawnv (int, const char *, const char * const *); |
218 |
|
219 |
_CRTIMP __cdecl __MINGW_NOTHROW |
220 |
intptr_t spawnve (int, const char *, const char * const *, const char * const *); |
221 |
|
222 |
_CRTIMP __cdecl __MINGW_NOTHROW |
223 |
intptr_t spawnvp (int, const char *, const char * const *); |
224 |
|
225 |
_CRTIMP __cdecl __MINGW_NOTHROW |
226 |
intptr_t spawnvpe (int, const char *, const char * const *, const char * const *); |
227 |
|
228 |
#endif /* !_NO_OLDNAMES */ |
229 |
#endif /* _PROCESS_H */ |
230 |
|
231 |
#if ! (defined _PROCESS_H && defined _WCHAR_H) |
232 |
/* Wide character variations of the exec() and spawn() functions are |
233 |
* declared both when <process.h> is included directly, and when it is |
234 |
* selectively included by <wchar.h>; however, if both _PROCESS_H and |
235 |
* _WCHAR_H are defined, by the time we get to here, then this must be |
236 |
* the direct inclusion case, and these have already been declared as |
237 |
* a result of selective inclusion; there is no need to declare them |
238 |
* a second time. |
239 |
*/ |
240 |
_CRTIMP __cdecl __MINGW_NOTHROW |
241 |
intptr_t _wexecl (const wchar_t *, const wchar_t *, ...); |
242 |
|
243 |
_CRTIMP __cdecl __MINGW_NOTHROW |
244 |
intptr_t _wexecle (const wchar_t *, const wchar_t *, ...); |
245 |
|
246 |
_CRTIMP __cdecl __MINGW_NOTHROW |
247 |
intptr_t _wexeclp (const wchar_t *, const wchar_t *, ...); |
248 |
|
249 |
_CRTIMP __cdecl __MINGW_NOTHROW |
250 |
intptr_t _wexeclpe (const wchar_t *, const wchar_t *, ...); |
251 |
|
252 |
_CRTIMP __cdecl __MINGW_NOTHROW |
253 |
intptr_t _wexecv (const wchar_t *, const wchar_t * const *); |
254 |
|
255 |
_CRTIMP __cdecl __MINGW_NOTHROW intptr_t _wexecve |
256 |
(const wchar_t *, const wchar_t * const *, const wchar_t * const *); |
257 |
|
258 |
_CRTIMP __cdecl __MINGW_NOTHROW |
259 |
intptr_t _wexecvp (const wchar_t *, const wchar_t * const *); |
260 |
|
261 |
_CRTIMP __cdecl __MINGW_NOTHROW intptr_t _wexecvpe |
262 |
(const wchar_t *, const wchar_t * const *, const wchar_t * const *); |
263 |
|
264 |
_CRTIMP __cdecl __MINGW_NOTHROW |
265 |
intptr_t _wspawnl (int, const wchar_t *, const wchar_t *, ...); |
266 |
|
267 |
_CRTIMP __cdecl __MINGW_NOTHROW |
268 |
intptr_t _wspawnle (int, const wchar_t *, const wchar_t *, ...); |
269 |
|
270 |
_CRTIMP __cdecl __MINGW_NOTHROW |
271 |
intptr_t _wspawnlp (int, const wchar_t *, const wchar_t *, ...); |
272 |
|
273 |
_CRTIMP __cdecl __MINGW_NOTHROW |
274 |
intptr_t _wspawnlpe (int, const wchar_t *, const wchar_t *, ...); |
275 |
|
276 |
_CRTIMP __cdecl __MINGW_NOTHROW |
277 |
intptr_t _wspawnv (int, const wchar_t *, const wchar_t * const *); |
278 |
|
279 |
_CRTIMP __cdecl __MINGW_NOTHROW intptr_t _wspawnve |
280 |
(int, const wchar_t *, const wchar_t * const *, const wchar_t * const *); |
281 |
|
282 |
_CRTIMP __cdecl __MINGW_NOTHROW |
283 |
intptr_t _wspawnvp (int, const wchar_t *, const wchar_t * const *); |
284 |
|
285 |
_CRTIMP __cdecl __MINGW_NOTHROW intptr_t _wspawnvpe |
286 |
(int, const wchar_t *, const wchar_t * const *, const wchar_t * const *); |
287 |
|
288 |
#endif /* ! (_PROCESS_H && _WCHAR_H) */ |
289 |
|
290 |
_END_C_DECLS |
291 |
|
292 |
#endif /* ! RC_INVOKED */ |
293 |
#endif /* !_PROCESS_H: $RCSfile: process.h,v $: end of file */ |