Fixes
[reactos.git] / reactos / include / crtdll / process.h
1 /*
2 * process.h
3 *
4 * Function calls for spawning child processes.
5 *
6 * This file is part of the Mingw32 package.
7 *
8 * Contributors:
9 * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * $Revision: 1.3 $
22 * $Author: ariadne $
23 * $Date: 1999/04/02 21:42:06 $
24 *
25 */
26 /* Appropriated for Reactos Crtdll by Ariadne */
27 /* changed second argument of cwait from nPID to hProc */
28
29 #ifndef _PROCESS_H_
30 #define _PROCESS_H_
31
32 #ifndef __STRICT_ANSI__
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 void _cexit(void);
39 void _c_exit(void);
40
41 /*
42 * Constants for cwait actions.
43 * Obsolete for Win32.
44 */
45 #define _WAIT_CHILD 0
46 #define _WAIT_GRANDCHILD 1
47
48 #ifndef _NO_OLDNAMES
49 #define WAIT_CHILD _WAIT_CHILD
50 #define WAIT_GRANDCHILD _WAIT_GRANDCHILD
51 #endif /* Not _NO_OLDNAMES */
52
53 int _cwait (int* pnStatus, int hProc, int nAction);
54
55 int _getpid(void);
56
57 int _execl (const char* szPath, const char* szArgv0, ...);
58 int _execle (const char* szPath, const char* szArgv0, ...);
59 int _execlp (const char* szPath, const char* szArgv0, ...);
60 int _execlpe (const char* szPath, const char* szArgv0, ...);
61 int _execv (const char* szPath, char* const* szaArgv);
62 int _execve (const char* szPath, char* const* szaArgv, char* const* szaEnv);
63 int _execvp (const char* szPath, char* const* szaArgv);
64 int _execvpe (const char* szPath, char* const* szaArgv, char* const* szaEnv);
65
66
67 /*
68 * Mode constants for spawn functions.
69 */
70 #define _P_WAIT 0
71 #define _P_NOWAIT 1
72 #define _P_OVERLAY 2
73 #define _OLD_P_OVERLAY _P_OVERLAY
74 #define _P_NOWAITO 3
75 #define _P_DETACH 4
76
77 #ifndef _NO_OLDNAMES
78 #define P_WAIT _P_WAIT
79 #define P_NOWAIT _P_NOWAIT
80 #define P_OVERLAY _P_OVERLAY
81 #define OLD_P_OVERLAY _OLD_P_OVERLAY
82 #define P_NOWAITO _P_NOWAITO
83 #define P_DETACH _P_DETACH
84 #endif /* Not _NO_OLDNAMES */
85
86 int _spawnl (int nMode, const char* szPath, const char* szArgv0, ...);
87 int _spawnle (int nMode, const char* szPath, const char* szArgv0,...);
88 int _spawnlp (int nMode, const char* szPath, const char* szArgv0,...);
89 int _spawnlpe (int nMode, const char* szPath, const char* szArgv0,...);
90 int _spawnv (int nMode, const char* szPath, char* const* szaArgv);
91 int _spawnve (int nMode, const char* szPath, char* const* szaArgv, char* const* szaEnv);
92 int _spawnvp (int nMode, const char* szPath, char* const* szaArgv);
93 int _spawnvpe (int nMode, const char* szPath, char* const* szaArgv, char* const* szaEnv);
94 /*
95 * The functions _beginthreadex and _endthreadex are not provided by CRTDLL.
96 * They are provided by MSVCRT.
97 *
98 * NOTE: Apparently _endthread calls CloseHandle on the handle of the thread,
99 * making for race conditions if you are not careful. Basically you have to
100 * make sure that no-one is going to do *anything* with the thread handle
101 * after the thread calls _endthread or returns from the thread function.
102 *
103 * NOTE: No old names for these functions. Use the underscore.
104 */
105 unsigned long
106 _beginthread (void (*pfuncStart)(void *),
107 unsigned unStackSize, void* pArgList);
108 void _endthread (void);
109
110 #if __MSVCRT__
111 unsigned long
112 _beginthreadex (void *pSecurity, unsigned unStackSize,
113 unsigned (*pfuncStart)(void*), void* pArgList,
114 unsigned unInitFlags, unsigned* pThreadAddr);
115 void _endthreadex (unsigned unExitCode);
116 #endif
117
118
119 void *_loaddll (char *name);
120 int _unloaddll(void *handle);
121
122 unsigned long __threadid(void);
123 #define _threadid __threadid()
124 void * __threadhandle(void);
125
126
127 #ifndef _NO_OLDNAMES
128
129 #define cwait _cwait
130 #define getpid _getpid
131 #define execl _execl
132 #define execle _execle
133 #define execlp _execlp
134 #define execlpe _execlpe
135
136 #define execv _execv
137 #define execve _execve
138 #define execvp _execvp
139 #define execvpe _execvpe
140
141 #define spawnl _spawnl
142 #define spawnle _spawnle
143 #define spawnlp _spawnlp
144 #define spawnlpe _spawnlpe
145
146 #define spawnv _spawnv
147 #define spawnve _spawnve
148 #define spawnvp _spawnvp
149 #define spawnvpe _spawnvpe
150
151
152 #endif /* Not _NO_OLDNAMES */
153
154 #ifdef __cplusplus
155 }
156 #endif
157
158 #endif /* Not __STRICT_ANSI__ */
159
160 #endif /* _PROCESS_H_ not defined */