OSDN Git Service

* NEWS: Add and adjust release notes for 4.0.
[mingw/mingw-org-wsl.git] / include / process.h
1 /**
2  * @file process.h
3  * Copyright 2012, 2013 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  * 
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  * 
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 #ifndef _PROCESS_H_
25 #define _PROCESS_H_
26 #pragma GCC system_header
27 #include <_mingw.h>
28
29 /* 
30  * Function calls for spawning child processes.
31  */
32
33 #include <sys/types.h> /* For _pid_t and pid_t. */
34 #include <stdint.h>  /* For intptr_t. */
35 /*
36  * Constants for cwait actions.
37  * Obsolete for Win32.
38  */
39 #define _WAIT_CHILD             0
40 #define _WAIT_GRANDCHILD        1
41
42 #ifndef _NO_OLDNAMES
43 #define WAIT_CHILD              _WAIT_CHILD
44 #define WAIT_GRANDCHILD         _WAIT_GRANDCHILD
45 #endif  /* Not _NO_OLDNAMES */
46
47 /*
48  * Mode constants for spawn functions.
49  */
50 #define _P_WAIT         0
51 #define _P_NOWAIT       1
52 #define _P_OVERLAY      2
53 #define _OLD_P_OVERLAY  _P_OVERLAY
54 #define _P_NOWAITO      3
55 #define _P_DETACH       4
56
57 #ifndef _NO_OLDNAMES
58 #define P_WAIT          _P_WAIT
59 #define P_NOWAIT        _P_NOWAIT
60 #define P_OVERLAY       _P_OVERLAY
61 #define OLD_P_OVERLAY   _OLD_P_OVERLAY
62 #define P_NOWAITO       _P_NOWAITO
63 #define P_DETACH        _P_DETACH
64 #endif  /* Not _NO_OLDNAMES */
65
66
67 #ifndef RC_INVOKED
68
69 #ifdef  __cplusplus
70 extern "C" {
71 #endif
72
73 _CRTIMP void __cdecl __MINGW_NOTHROW _cexit(void);
74 _CRTIMP void __cdecl __MINGW_NOTHROW _c_exit(void);
75
76 _CRTIMP int __cdecl __MINGW_NOTHROW _cwait (int*, _pid_t, int);
77
78 _CRTIMP _pid_t __cdecl __MINGW_NOTHROW _getpid(void);
79
80 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execl (const char*, const char*, ...);
81 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execle        (const char*, const char*, ...);
82 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execlp        (const char*, const char*, ...);
83 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execlpe       (const char*, const char*, ...);
84 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execv (const char*, const char* const*);
85 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execve        (const char*, const char* const*, const char* const*);
86 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execvp        (const char*, const char* const*);
87 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execvpe       (const char*, const char* const*, const char* const*);
88
89 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _spawnl        (int, const char*, const char*, ...);
90 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _spawnle       (int, const char*, const char*, ...);
91 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _spawnlp       (int, const char*, const char*, ...);
92 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _spawnlpe      (int, const char*, const char*, ...);
93 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _spawnv        (int, const char*, const char* const*);
94 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _spawnve       (int, const char*, const char* const*, const char* const*);
95 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _spawnvp       (int, const char*, const char* const*);
96 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _spawnvpe      (int, const char*, const char* const*, const char* const*);
97
98 #ifndef _WPROCESS_DEFINED
99 /* Also in wchar.h - keep in sync */
100 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecl        (const wchar_t*, const wchar_t*, ...);
101 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecle       (const wchar_t*, const wchar_t*, ...);
102 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexeclp       (const wchar_t*, const wchar_t*, ...);
103 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexeclpe      (const wchar_t*, const wchar_t*, ...);
104 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecv        (const wchar_t*, const wchar_t* const*);
105 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecve       (const wchar_t*, const wchar_t* const*, const wchar_t* const*);
106 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecvp       (const wchar_t*, const wchar_t* const*);
107 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wexecvpe      (const wchar_t*, const wchar_t* const*, const wchar_t* const*);
108
109 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnl       (int, const wchar_t*, const wchar_t*, ...);
110 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnle      (int, const wchar_t*, const wchar_t*, ...);
111 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnlp      (int, const wchar_t*, const wchar_t*, ...);
112 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnlpe     (int, const wchar_t*, const wchar_t*, ...);
113 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnv       (int, const wchar_t*, const wchar_t* const*);
114 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnve      (int, const wchar_t*, const wchar_t* const*, const wchar_t* const*);
115 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnvp      (int, const wchar_t*, const wchar_t* const*);
116 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW _wspawnvpe     (int, const wchar_t*, const wchar_t* const*, const wchar_t* const*);
117
118 #define _WPROCESS_DEFINED
119 #endif
120
121 /*
122  * NOTE: Apparently _endthread calls CloseHandle on the handle of the thread,
123  * making for race conditions if you are not careful. Basically you have to
124  * make sure that no-one is going to do *anything* with the thread handle
125  * after the thread calls _endthread or returns from the thread function.
126  *
127  * NOTE: No old names for these functions. Use the underscore.
128  */
129 _CRTIMP unsigned long __cdecl __MINGW_NOTHROW
130         _beginthread    (void (*)(void *), unsigned, void*);
131 _CRTIMP void __cdecl __MINGW_NOTHROW _endthread (void);
132
133 _CRTIMP unsigned long __cdecl __MINGW_NOTHROW
134         _beginthreadex  (void *, unsigned, unsigned (__stdcall *) (void *), 
135                          void*, unsigned, unsigned*);
136 _CRTIMP void __cdecl __MINGW_NOTHROW _endthreadex (unsigned);
137
138 #ifndef _NO_OLDNAMES
139 /*
140  * Functions without the leading underscore, for portability. These functions
141  * live in liboldnames.a.
142  */
143 _CRTIMP int  __cdecl __MINGW_NOTHROW cwait (int*, pid_t, int);
144 _CRTIMP pid_t __cdecl __MINGW_NOTHROW getpid (void);
145
146 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW execl  (const char*, const char*, ...);
147 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW execle (const char*, const char*, ...);
148 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW execlp (const char*, const char*, ...);
149 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW execlpe        (const char*, const char*,...);
150 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW execv  (const char*, const char* const*);
151 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW execve (const char*, const char* const*, const char* const*);
152 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW execvp (const char*, const char* const*);
153 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW execvpe        (const char*, const char* const*, const char* const*);
154
155 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW spawnl (int, const char*, const char*, ...);
156 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW spawnle        (int, const char*, const char*, ...);
157 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW spawnlp        (int, const char*, const char*, ...);
158 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW spawnlpe       (int, const char*, const char*, ...);
159 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW spawnv (int, const char*, const char* const*);
160 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW spawnve        (int, const char*, const char* const*, const char* const*);
161 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW spawnvp        (int, const char*, const char* const*);
162 _CRTIMP intptr_t __cdecl __MINGW_NOTHROW spawnvpe       (int, const char*, const char* const*, const char* const*);
163 #endif  /* Not _NO_OLDNAMES */
164
165 #ifdef  __cplusplus
166 }
167 #endif
168
169 #endif  /* Not RC_INVOKED */
170
171 #endif  /* _PROCESS_H_ not defined */