1 /** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the mingw-w64 runtime package. 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 */ 6 #ifndef _INC_PROCESS 7 #define _INC_PROCESS 8 9 #include <crtdefs.h> 10 #include <corecrt_startup.h> 11 12 /* Includes a definition of _pid_t and pid_t */ 13 #include <sys/types.h> 14 15 #ifndef _POSIX_ 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 #ifndef _P_WAIT 21 #define _P_WAIT 0 22 #define _P_NOWAIT 1 23 #define _OLD_P_OVERLAY 2 24 #define _P_NOWAITO 3 25 #define _P_DETACH 4 26 #define _P_OVERLAY 2 27 28 #define _WAIT_CHILD 0 29 #define _WAIT_GRANDCHILD 1 30 #endif 31 32 _CRTIMP uintptr_t __cdecl _beginthread(void (__cdecl *_StartAddress) (void *),unsigned _StackSize,void *_ArgList); 33 _CRTIMP void __cdecl _endthread(void) __MINGW_ATTRIB_NORETURN; 34 _CRTIMP uintptr_t __cdecl _beginthreadex(void *_Security,unsigned _StackSize,unsigned (__stdcall *_StartAddress) (void *),void *_ArgList,unsigned _InitFlag,unsigned *_ThrdAddr); 35 _CRTIMP void __cdecl _endthreadex(unsigned _Retval) __MINGW_ATTRIB_NORETURN; 36 37 #ifndef _CRT_TERMINATE_DEFINED 38 #define _CRT_TERMINATE_DEFINED 39 void __cdecl __MINGW_NOTHROW exit(int _Code) __MINGW_ATTRIB_NORETURN; 40 void __cdecl __MINGW_NOTHROW _exit(int _Code) __MINGW_ATTRIB_NORETURN; 41 42 #if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */ 43 /* C99 function name */ 44 void __cdecl _Exit(int) __MINGW_ATTRIB_NORETURN; 45 #ifndef __CRT__NO_INLINE _Exit(int status)46 __CRT_INLINE __MINGW_ATTRIB_NORETURN void __cdecl _Exit(int status) 47 { _exit(status); } 48 #endif /* !__CRT__NO_INLINE */ 49 #endif /* Not __NO_ISOCEXT */ 50 51 #pragma push_macro("abort") 52 #undef abort 53 void __cdecl __MINGW_ATTRIB_NORETURN abort(void); 54 #pragma pop_macro("abort") 55 56 #endif /* _CRT_TERMINATE_DEFINED */ 57 58 typedef void (__stdcall *_tls_callback_type)(void*,unsigned long,void*); 59 _CRTIMP void __cdecl _register_thread_local_exe_atexit_callback(_tls_callback_type callback); 60 61 void __cdecl __MINGW_NOTHROW _cexit(void); 62 void __cdecl __MINGW_NOTHROW _c_exit(void); 63 _CRTIMP int __cdecl _getpid(void); 64 _CRTIMP intptr_t __cdecl _cwait(int *_TermStat,intptr_t _ProcHandle,int _Action); 65 _CRTIMP intptr_t __cdecl _execl(const char *_Filename,const char *_ArgList,...); 66 _CRTIMP intptr_t __cdecl _execle(const char *_Filename,const char *_ArgList,...); 67 _CRTIMP intptr_t __cdecl _execlp(const char *_Filename,const char *_ArgList,...); 68 _CRTIMP intptr_t __cdecl _execlpe(const char *_Filename,const char *_ArgList,...); 69 _CRTIMP intptr_t __cdecl _execv(const char *_Filename,const char *const *_ArgList); 70 _CRTIMP intptr_t __cdecl _execve(const char *_Filename,const char *const *_ArgList,const char *const *_Env); 71 _CRTIMP intptr_t __cdecl _execvp(const char *_Filename,const char *const *_ArgList); 72 _CRTIMP intptr_t __cdecl _execvpe(const char *_Filename,const char *const *_ArgList,const char *const *_Env); 73 _CRTIMP intptr_t __cdecl _spawnl(int _Mode,const char *_Filename,const char *_ArgList,...); 74 _CRTIMP intptr_t __cdecl _spawnle(int _Mode,const char *_Filename,const char *_ArgList,...); 75 _CRTIMP intptr_t __cdecl _spawnlp(int _Mode,const char *_Filename,const char *_ArgList,...); 76 _CRTIMP intptr_t __cdecl _spawnlpe(int _Mode,const char *_Filename,const char *_ArgList,...); 77 78 #ifndef _SPAWNV_DEFINED 79 #define _SPAWNV_DEFINED 80 _CRTIMP intptr_t __cdecl _spawnv(int _Mode,const char *_Filename,const char *const *_ArgList); 81 _CRTIMP intptr_t __cdecl _spawnve(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env); 82 _CRTIMP intptr_t __cdecl _spawnvp(int _Mode,const char *_Filename,const char *const *_ArgList); 83 _CRTIMP intptr_t __cdecl _spawnvpe(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env); 84 #endif 85 86 #ifndef _CRT_SYSTEM_DEFINED 87 #define _CRT_SYSTEM_DEFINED 88 int __cdecl system(const char *_Command); 89 #endif 90 91 #ifndef _WEXEC_DEFINED 92 #define _WEXEC_DEFINED 93 _CRTIMP intptr_t __cdecl _wexecl(const wchar_t *_Filename,const wchar_t *_ArgList,...); 94 _CRTIMP intptr_t __cdecl _wexecle(const wchar_t *_Filename,const wchar_t *_ArgList,...); 95 _CRTIMP intptr_t __cdecl _wexeclp(const wchar_t *_Filename,const wchar_t *_ArgList,...); 96 _CRTIMP intptr_t __cdecl _wexeclpe(const wchar_t *_Filename,const wchar_t *_ArgList,...); 97 _CRTIMP intptr_t __cdecl _wexecv(const wchar_t *_Filename,const wchar_t *const *_ArgList); 98 _CRTIMP intptr_t __cdecl _wexecve(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); 99 _CRTIMP intptr_t __cdecl _wexecvp(const wchar_t *_Filename,const wchar_t *const *_ArgList); 100 _CRTIMP intptr_t __cdecl _wexecvpe(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); 101 #endif 102 103 #ifndef _WSPAWN_DEFINED 104 #define _WSPAWN_DEFINED 105 _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); 106 _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); 107 _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); 108 _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...); 109 _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); 110 _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); 111 _CRTIMP intptr_t __cdecl _wspawnvp(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList); 112 _CRTIMP intptr_t __cdecl _wspawnvpe(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env); 113 #endif 114 115 #ifndef _CRT_WSYSTEM_DEFINED 116 #define _CRT_WSYSTEM_DEFINED 117 _CRTIMP int __cdecl _wsystem(const wchar_t *_Command); 118 #endif 119 120 void __cdecl __security_init_cookie(void); 121 #if (defined(_X86_) && !defined(__x86_64)) 122 void __fastcall __security_check_cookie(uintptr_t _StackCookie); 123 __MINGW_ATTRIB_NORETURN void __cdecl __report_gsfailure(void); 124 #else 125 void __cdecl __security_check_cookie(uintptr_t _StackCookie); 126 __MINGW_ATTRIB_NORETURN void __cdecl __report_gsfailure(uintptr_t _StackCookie); 127 #endif 128 extern uintptr_t __security_cookie; 129 130 intptr_t __cdecl _loaddll(char *_Filename); 131 int __cdecl _unloaddll(intptr_t _Handle); 132 int (__cdecl *__cdecl _getdllprocaddr(intptr_t _Handle,char *_ProcedureName,intptr_t _Ordinal))(void); 133 134 #ifdef _DECL_DLLMAIN 135 #ifdef _WINDOWS_ 136 WINBOOL WINAPI DllMain(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved); 137 WINBOOL WINAPI _CRT_INIT(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved); 138 WINBOOL WINAPI _wCRT_INIT(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved); 139 extern WINBOOL (WINAPI *const _pRawDllMain)(HANDLE,DWORD,LPVOID); 140 #else 141 int __stdcall DllMain(void *_HDllHandle,unsigned _Reason,void *_Reserved); 142 int __stdcall _CRT_INIT(void *_HDllHandle,unsigned _Reason,void *_Reserved); 143 int __stdcall _wCRT_INIT(void *_HDllHandle,unsigned _Reason,void *_Reserved); 144 extern int (__stdcall *const _pRawDllMain)(void *,unsigned,void *); 145 #endif 146 #endif 147 148 #ifndef NO_OLDNAMES 149 #define P_WAIT _P_WAIT 150 #define P_NOWAIT _P_NOWAIT 151 #define P_OVERLAY _P_OVERLAY 152 #define OLD_P_OVERLAY _OLD_P_OVERLAY 153 #define P_NOWAITO _P_NOWAITO 154 #define P_DETACH _P_DETACH 155 #define WAIT_CHILD _WAIT_CHILD 156 #define WAIT_GRANDCHILD _WAIT_GRANDCHILD 157 158 intptr_t __cdecl cwait(int *_TermStat,intptr_t _ProcHandle,int _Action) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 159 #ifdef __GNUC__ 160 int __cdecl execl(const char *_Filename,const char *_ArgList,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 161 int __cdecl execle(const char *_Filename,const char *_ArgList,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 162 int __cdecl execlp(const char *_Filename,const char *_ArgList,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 163 int __cdecl execlpe(const char *_Filename,const char *_ArgList,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 164 #else 165 intptr_t __cdecl execl(const char *_Filename,const char *_ArgList,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 166 intptr_t __cdecl execle(const char *_Filename,const char *_ArgList,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 167 intptr_t __cdecl execlp(const char *_Filename,const char *_ArgList,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 168 intptr_t __cdecl execlpe(const char *_Filename,const char *_ArgList,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 169 #endif 170 intptr_t __cdecl spawnl(int,const char *_Filename,const char *_ArgList,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 171 intptr_t __cdecl spawnle(int,const char *_Filename,const char *_ArgList,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 172 intptr_t __cdecl spawnlp(int,const char *_Filename,const char *_ArgList,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 173 intptr_t __cdecl spawnlpe(int,const char *_Filename,const char *_ArgList,...) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 174 #ifndef _CRT_GETPID_DEFINED 175 #define _CRT_GETPID_DEFINED /* Also in unistd.h */ 176 int __cdecl getpid(void) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 177 #endif 178 #ifdef __GNUC__ 179 /* Those methods are predefined by gcc builtins to return int. So to prevent 180 stupid warnings, define them in POSIX way. This is save, because those 181 methods do not return in success case, so that the return value is not 182 really dependent to its scalar width. */ 183 int __cdecl execv(const char *_Filename,char *const _ArgList[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 184 int __cdecl execve(const char *_Filename,char *const _ArgList[],char *const _Env[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 185 int __cdecl execvp(const char *_Filename,char *const _ArgList[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 186 int __cdecl execvpe(const char *_Filename,char *const _ArgList[],char *const _Env[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 187 #else 188 intptr_t __cdecl execv(const char *_Filename,char *const _ArgList[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 189 intptr_t __cdecl execve(const char *_Filename,char *const _ArgList[],char *const _Env[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 190 intptr_t __cdecl execvp(const char *_Filename,char *const _ArgList[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 191 intptr_t __cdecl execvpe(const char *_Filename,char *const _ArgList[],char *const _Env[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 192 #endif 193 intptr_t __cdecl spawnv(int,const char *_Filename,char *const _ArgList[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 194 intptr_t __cdecl spawnve(int,const char *_Filename,char *const _ArgList[],char *const _Env[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 195 intptr_t __cdecl spawnvp(int,const char *_Filename,char *const _ArgList[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 196 intptr_t __cdecl spawnvpe(int,const char *_Filename,char *const _ArgList[],char *const _Env[]) __MINGW_ATTRIB_DEPRECATED_MSVC2005; 197 #endif 198 199 #ifdef __cplusplus 200 } 201 #endif 202 #endif 203 #endif 204