fix prototypes of _beginthread and _beginthreadex
[reactos.git] / reactos / include / crt / process.h
1 /*
2 * process.h
3 * This file has no copyright assigned and is placed in the Public Domain.
4 * This file is a part of the mingw-runtime package.
5 * No warranty is given; refer to the file DISCLAIMER within the package.
6 *
7 * Function calls for spawning child processes.
8 *
9 */
10
11 #ifndef _PROCESS_H_
12 #define _PROCESS_H_
13
14 /* All the headers include this file. */
15 #include <_mingw.h>
16
17 /* Includes a definition of _pid_t and pid_t */
18 #include <sys/types.h>
19
20 #include <stdint.h>
21
22 /*
23 * Constants for cwait actions.
24 * Obsolete for Win32.
25 */
26 #define _WAIT_CHILD 0
27 #define _WAIT_GRANDCHILD 1
28
29 #ifndef _NO_OLDNAMES
30 #define WAIT_CHILD _WAIT_CHILD
31 #define WAIT_GRANDCHILD _WAIT_GRANDCHILD
32 #endif /* Not _NO_OLDNAMES */
33
34 /*
35 * Mode constants for spawn functions.
36 */
37 #define _P_WAIT 0
38 #define _P_NOWAIT 1
39 #define _P_OVERLAY 2
40 #define _OLD_P_OVERLAY _P_OVERLAY
41 #define _P_NOWAITO 3
42 #define _P_DETACH 4
43
44 #ifndef _NO_OLDNAMES
45 #define P_WAIT _P_WAIT
46 #define P_NOWAIT _P_NOWAIT
47 #define P_OVERLAY _P_OVERLAY
48 #define OLD_P_OVERLAY _OLD_P_OVERLAY
49 #define P_NOWAITO _P_NOWAITO
50 #define P_DETACH _P_DETACH
51 #endif /* Not _NO_OLDNAMES */
52
53
54 #ifndef RC_INVOKED
55
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59
60 _CRTIMP void __cdecl __MINGW_NOTHROW _cexit(void);
61 _CRTIMP void __cdecl __MINGW_NOTHROW _c_exit(void);
62
63 _CRTIMP int __cdecl __MINGW_NOTHROW _cwait (int*, _pid_t, int);
64
65 _CRTIMP _pid_t __cdecl __MINGW_NOTHROW _getpid(void);
66
67 _CRTIMP int __cdecl __MINGW_NOTHROW _execl (const char*, const char*, ...);
68 _CRTIMP int __cdecl __MINGW_NOTHROW _execle (const char*, const char*, ...);
69 _CRTIMP int __cdecl __MINGW_NOTHROW _execlp (const char*, const char*, ...);
70 _CRTIMP int __cdecl __MINGW_NOTHROW _execlpe (const char*, const char*, ...);
71 _CRTIMP int __cdecl __MINGW_NOTHROW _execv (const char*, const char* const*);
72 _CRTIMP int __cdecl __MINGW_NOTHROW _execve (const char*, const char* const*, const char* const*);
73 _CRTIMP int __cdecl __MINGW_NOTHROW _execvp (const char*, const char* const*);
74 _CRTIMP int __cdecl __MINGW_NOTHROW _execvpe (const char*, const char* const*, const char* const*);
75
76 _CRTIMP int __cdecl __MINGW_NOTHROW _spawnl (int, const char*, const char*, ...);
77 _CRTIMP int __cdecl __MINGW_NOTHROW _spawnle (int, const char*, const char*, ...);
78 _CRTIMP int __cdecl __MINGW_NOTHROW _spawnlp (int, const char*, const char*, ...);
79 _CRTIMP int __cdecl __MINGW_NOTHROW _spawnlpe (int, const char*, const char*, ...);
80 _CRTIMP int __cdecl __MINGW_NOTHROW _spawnv (int, const char*, const char* const*);
81 _CRTIMP int __cdecl __MINGW_NOTHROW _spawnve (int, const char*, const char* const*, const char* const*);
82 _CRTIMP int __cdecl __MINGW_NOTHROW _spawnvp (int, const char*, const char* const*);
83 _CRTIMP int __cdecl __MINGW_NOTHROW _spawnvpe (int, const char*, const char* const*, const char* const*);
84
85
86 /*
87 * The functions _beginthreadex and _endthreadex are not provided by CRTDLL.
88 * They are provided by MSVCRT.
89 *
90 * NOTE: Apparently _endthread calls CloseHandle on the handle of the thread,
91 * making for race conditions if you are not careful. Basically you have to
92 * make sure that no-one is going to do *anything* with the thread handle
93 * after the thread calls _endthread or returns from the thread function.
94 *
95 * NOTE: No old names for these functions. Use the underscore.
96 */
97 _CRTIMP uintptr_t __cdecl __MINGW_NOTHROW
98 _beginthread (void (*)(void *), unsigned, void*);
99 _CRTIMP void __cdecl __MINGW_NOTHROW _endthread (void);
100
101 #ifdef __MSVCRT__
102 _CRTIMP uintptr_t __cdecl __MINGW_NOTHROW
103 _beginthreadex (void *, unsigned, unsigned (__stdcall *) (void *),
104 void*, unsigned, unsigned*);
105 _CRTIMP void __cdecl __MINGW_NOTHROW _endthreadex (unsigned);
106 #endif
107
108
109 #ifndef _NO_OLDNAMES
110 /*
111 * Functions without the leading underscore, for portability. These functions
112 * live in liboldnames.a.
113 */
114 _CRTIMP int __cdecl __MINGW_NOTHROW cwait (int*, pid_t, int);
115 _CRTIMP pid_t __cdecl __MINGW_NOTHROW getpid (void);
116 _CRTIMP int __cdecl __MINGW_NOTHROW execl (const char*, const char*, ...);
117 _CRTIMP int __cdecl __MINGW_NOTHROW execle (const char*, const char*, ...);
118 _CRTIMP int __cdecl __MINGW_NOTHROW execlp (const char*, const char*, ...);
119 _CRTIMP int __cdecl __MINGW_NOTHROW execlpe (const char*, const char*, ...);
120 _CRTIMP int __cdecl __MINGW_NOTHROW execv (const char*, const char* const*);
121 _CRTIMP int __cdecl __MINGW_NOTHROW execve (const char*, const char* const*, const char* const*);
122 _CRTIMP int __cdecl __MINGW_NOTHROW execvp (const char*, const char* const*);
123 _CRTIMP int __cdecl __MINGW_NOTHROW execvpe (const char*, const char* const*, const char* const*);
124 _CRTIMP int __cdecl __MINGW_NOTHROW spawnl (int, const char*, const char*, ...);
125 _CRTIMP int __cdecl __MINGW_NOTHROW spawnle (int, const char*, const char*, ...);
126 _CRTIMP int __cdecl __MINGW_NOTHROW spawnlp (int, const char*, const char*, ...);
127 _CRTIMP int __cdecl __MINGW_NOTHROW spawnlpe (int, const char*, const char*, ...);
128 _CRTIMP int __cdecl __MINGW_NOTHROW spawnv (int, const char*, const char* const*);
129 _CRTIMP int __cdecl __MINGW_NOTHROW spawnve (int, const char*, const char* const*, const char* const*);
130 _CRTIMP int __cdecl __MINGW_NOTHROW spawnvp (int, const char*, const char* const*);
131 _CRTIMP int __cdecl __MINGW_NOTHROW spawnvpe (int, const char*, const char* const*, const char* const*);
132 #endif /* Not _NO_OLDNAMES */
133
134 #ifdef __cplusplus
135 }
136 #endif
137
138 #endif /* Not RC_INVOKED */
139
140 #endif /* _PROCESS_H_ not defined */