branch update for HEAD-2003021201
[reactos.git] / include / msvcrt / 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  *  DISCLAIMED. This includes but is not limited to warranties of
19  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20  *
21  * $Revision$
22  * $Author$
23  * $Date$
24  *
25  */
26 /* Appropriated for Reactos Crtdll by Ariadne */
27 /* changed second argument of cwait from nPID to hProc */
28
29 #ifndef __STRICT_ANSI__
30
31 #ifndef _PROCESS_H_
32 #define _PROCESS_H_
33
34 /*
35  * Constants for cwait actions.
36  * Obsolete for Win32.
37  */
38 #define _WAIT_CHILD      0
39 #define _WAIT_GRANDCHILD 1
40
41 #ifndef _NO_OLDNAMES
42 #define WAIT_CHILD      _WAIT_CHILD
43 #define WAIT_GRANDCHILD _WAIT_GRANDCHILD
44 #endif  /* Not _NO_OLDNAMES */
45
46 /*
47  * Mode constants for spawn functions.
48  */
49 #define _P_WAIT     0
50 #define _P_NOWAIT   1
51 #define _P_OVERLAY  2
52 #define _OLD_P_OVERLAY  _P_OVERLAY
53 #define _P_NOWAITO  3
54 #define _P_DETACH   4
55
56 #ifndef _NO_OLDNAMES
57 #define P_WAIT      _P_WAIT
58 #define P_NOWAIT    _P_NOWAIT
59 #define P_OVERLAY   _P_OVERLAY
60 #define OLD_P_OVERLAY   _OLD_P_OVERLAY
61 #define P_NOWAITO   _P_NOWAITO
62 #define P_DETACH    _P_DETACH
63 #endif  /* Not _NO_OLDNAMES */
64
65
66 #ifdef  __cplusplus
67 extern "C" {
68 #endif
69
70 void    _cexit(void);
71 void    _c_exit(void);
72
73 int _cwait (int* pnStatus, int hProc, int nAction);
74
75 int _getpid(void);
76
77 int _execl      (const char* szPath, const char* szArgv0, ...);
78 int _execle     (const char* szPath, const char* szArgv0, ...);
79 int _execlp     (const char* szPath, const char* szArgv0, ...);
80 int _execlpe    (const char* szPath, const char* szArgv0, ...);
81 int _execv      (const char* szPath, char* const* szaArgv);
82 int _execve     (const char* szPath, char* const* szaArgv, char* const* szaEnv);
83 int _execvp     (const char* szPath, char* const* szaArgv);
84 int _execvpe    (const char* szPath, char* const* szaArgv, char* const* szaEnv);
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 (__cdecl *pfuncStart)(void*),
107              unsigned unStackSize, void* pArgList);
108 void    _endthread  (void);
109
110 #ifdef __MSVCRT__
111 unsigned long
112     _beginthreadex(void* pSecurity, unsigned unStackSize,
113              unsigned (__stdcall *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 #endif  /* Not _NO_OLDNAMES */
152
153 #ifdef  __cplusplus
154 }
155 #endif
156
157 #endif  /* _PROCESS_H_ not defined */
158
159 #endif  /* Not __STRICT_ANSI__ */
160