[HEADERS]
[reactos.git] / reactos / include / crt / process.h
index c57014b..591032f 100644 (file)
-/*
- * process.h
+/**
  * This file has no copyright assigned and is placed in the Public Domain.
- * This file is a part of the mingw-runtime package.
- * No warranty is given; refer to the file DISCLAIMER within the package.
- *
- * Function calls for spawning child processes.
- *
+ * This file is part of the w64 mingw-runtime package.
+ * No warranty is given; refer to the file DISCLAIMER within this package.
  */
+#ifndef _INC_PROCESS
+#define _INC_PROCESS
 
-#ifndef        _PROCESS_H_
-#define        _PROCESS_H_
-
-/* All the headers include this file. */
-#include <_mingw.h>
+#include <crtdefs.h>
 
 /* Includes a definition of _pid_t and pid_t */
 #include <sys/types.h>
 
-#include <stdint.h>
-
-/*
- * Constants for cwait actions.
- * Obsolete for Win32.
- */
-#define        _WAIT_CHILD             0
-#define        _WAIT_GRANDCHILD        1
-
-#ifndef        _NO_OLDNAMES
-#define        WAIT_CHILD              _WAIT_CHILD
-#define        WAIT_GRANDCHILD         _WAIT_GRANDCHILD
-#endif /* Not _NO_OLDNAMES */
-
-/*
- * Mode constants for spawn functions.
- */
-#define        _P_WAIT         0
-#define        _P_NOWAIT       1
-#define        _P_OVERLAY      2
-#define        _OLD_P_OVERLAY  _P_OVERLAY
-#define        _P_NOWAITO      3
-#define        _P_DETACH       4
-
-#ifndef        _NO_OLDNAMES
-#define        P_WAIT          _P_WAIT
-#define        P_NOWAIT        _P_NOWAIT
-#define        P_OVERLAY       _P_OVERLAY
-#define        OLD_P_OVERLAY   _OLD_P_OVERLAY
-#define        P_NOWAITO       _P_NOWAITO
-#define        P_DETACH        _P_DETACH
-#endif /* Not _NO_OLDNAMES */
-
-
-#ifndef RC_INVOKED
-
-#ifdef __cplusplus
+#ifndef _POSIX_
+#ifdef __cplusplus
 extern "C" {
 #endif
 
-_CRTIMP void __cdecl __MINGW_NOTHROW _cexit(void);
-_CRTIMP void __cdecl __MINGW_NOTHROW _c_exit(void);
-
-_CRTIMP int __cdecl __MINGW_NOTHROW _cwait (int*, _pid_t, int);
-
-_CRTIMP _pid_t __cdecl __MINGW_NOTHROW _getpid(void);
-
-_CRTIMP int __cdecl __MINGW_NOTHROW _execl     (const char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW _execle    (const char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW _execlp    (const char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW _execlpe   (const char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW _execv     (const char*, const char* const*);
-_CRTIMP int __cdecl __MINGW_NOTHROW _execve    (const char*, const char* const*, const char* const*);
-_CRTIMP int __cdecl __MINGW_NOTHROW _execvp    (const char*, const char* const*);
-_CRTIMP int __cdecl __MINGW_NOTHROW _execvpe   (const char*, const char* const*, const char* const*);
-
-_CRTIMP int __cdecl __MINGW_NOTHROW _spawnl    (int, const char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW _spawnle   (int, const char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW _spawnlp   (int, const char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW _spawnlpe  (int, const char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW _spawnv    (int, const char*, const char* const*);
-_CRTIMP int __cdecl __MINGW_NOTHROW _spawnve   (int, const char*, const char* const*, const char* const*);
-_CRTIMP int __cdecl __MINGW_NOTHROW _spawnvp   (int, const char*, const char* const*);
-_CRTIMP int __cdecl __MINGW_NOTHROW _spawnvpe  (int, const char*, const char* const*, const char* const*);
-
-
-/*
- * The functions _beginthreadex and _endthreadex are not provided by CRTDLL.
- * They are provided by MSVCRT.
- *
- * NOTE: Apparently _endthread calls CloseHandle on the handle of the thread,
- * making for race conditions if you are not careful. Basically you have to
- * make sure that no-one is going to do *anything* with the thread handle
- * after the thread calls _endthread or returns from the thread function.
- *
- * NOTE: No old names for these functions. Use the underscore.
- */
-_CRTIMP uintptr_t __cdecl __MINGW_NOTHROW
-       _beginthread    (void (*)(void *), unsigned, void*);
-_CRTIMP void __cdecl __MINGW_NOTHROW _endthread        (void);
+#define _P_WAIT 0
+#define _P_NOWAIT 1
+#define _OLD_P_OVERLAY 2
+#define _P_NOWAITO 3
+#define _P_DETACH 4
+#define _P_OVERLAY 2
+
+#define _WAIT_CHILD 0
+#define _WAIT_GRANDCHILD 1
+
+  _CRTIMP uintptr_t __cdecl _beginthread(void (__cdecl *_StartAddress) (void *),unsigned _StackSize,void *_ArgList);
+  _CRTIMP void __cdecl _endthread(void);
+  _CRTIMP uintptr_t __cdecl _beginthreadex(void *_Security,unsigned _StackSize,unsigned (__stdcall *_StartAddress) (void *),void *_ArgList,unsigned _InitFlag,unsigned *_ThrdAddr);
+  _CRTIMP void __cdecl _endthreadex(unsigned _Retval);
+
+#ifndef _CRT_TERMINATE_DEFINED
+#define _CRT_TERMINATE_DEFINED
+  __declspec(noreturn) void __cdecl exit(int _Code);
+  _CRTIMP __declspec(noreturn) void __cdecl _exit(int _Code);
+
+#if __MINGW_GNUC_PREREQ(4,4)
+#pragma push_macro("abort")
+#undef abort
+#endif
+  __declspec(noreturn) void __cdecl abort(void);
+#if __MINGW_GNUC_PREREQ(4,4)
+#pragma pop_macro("abort")
+#undef abort
+#endif
+#endif
 
-#ifdef __MSVCRT__
-_CRTIMP uintptr_t __cdecl __MINGW_NOTHROW
-       _beginthreadex  (void *, unsigned, unsigned (__stdcall *) (void *),
-                        void*, unsigned, unsigned*);
-_CRTIMP void __cdecl __MINGW_NOTHROW _endthreadex (unsigned);
+  _CRTIMP void __cdecl _cexit(void);
+  _CRTIMP void __cdecl _c_exit(void);
+  _CRTIMP int __cdecl _getpid(void);
+  _CRTIMP intptr_t __cdecl _cwait(int *_TermStat,intptr_t _ProcHandle,int _Action);
+  _CRTIMP intptr_t __cdecl _execl(const char *_Filename,const char *_ArgList,...);
+  _CRTIMP intptr_t __cdecl _execle(const char *_Filename,const char *_ArgList,...);
+  _CRTIMP intptr_t __cdecl _execlp(const char *_Filename,const char *_ArgList,...);
+  _CRTIMP intptr_t __cdecl _execlpe(const char *_Filename,const char *_ArgList,...);
+  _CRTIMP intptr_t __cdecl _execv(const char *_Filename,const char *const *_ArgList);
+  _CRTIMP intptr_t __cdecl _execve(const char *_Filename,const char *const *_ArgList,const char *const *_Env);
+  _CRTIMP intptr_t __cdecl _execvp(const char *_Filename,const char *const *_ArgList);
+  _CRTIMP intptr_t __cdecl _execvpe(const char *_Filename,const char *const *_ArgList,const char *const *_Env);
+  _CRTIMP intptr_t __cdecl _spawnl(int _Mode,const char *_Filename,const char *_ArgList,...);
+  _CRTIMP intptr_t __cdecl _spawnle(int _Mode,const char *_Filename,const char *_ArgList,...);
+  _CRTIMP intptr_t __cdecl _spawnlp(int _Mode,const char *_Filename,const char *_ArgList,...);
+  _CRTIMP intptr_t __cdecl _spawnlpe(int _Mode,const char *_Filename,const char *_ArgList,...);
+  _CRTIMP intptr_t __cdecl _spawnv(int _Mode,const char *_Filename,const char *const *_ArgList);
+  _CRTIMP intptr_t __cdecl _spawnve(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env);
+  _CRTIMP intptr_t __cdecl _spawnvp(int _Mode,const char *_Filename,const char *const *_ArgList);
+  _CRTIMP intptr_t __cdecl _spawnvpe(int _Mode,const char *_Filename,const char *const *_ArgList,const char *const *_Env);
+
+#ifndef _CRT_SYSTEM_DEFINED
+#define _CRT_SYSTEM_DEFINED
+  int __cdecl system(const char *_Command);
 #endif
 
+#ifndef _WPROCESS_DEFINED
+#define _WPROCESS_DEFINED
+  _CRTIMP intptr_t __cdecl _wexecl(const wchar_t *_Filename,const wchar_t *_ArgList,...);
+  _CRTIMP intptr_t __cdecl _wexecle(const wchar_t *_Filename,const wchar_t *_ArgList,...);
+  _CRTIMP intptr_t __cdecl _wexeclp(const wchar_t *_Filename,const wchar_t *_ArgList,...);
+  _CRTIMP intptr_t __cdecl _wexeclpe(const wchar_t *_Filename,const wchar_t *_ArgList,...);
+  _CRTIMP intptr_t __cdecl _wexecv(const wchar_t *_Filename,const wchar_t *const *_ArgList);
+  _CRTIMP intptr_t __cdecl _wexecve(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env);
+  _CRTIMP intptr_t __cdecl _wexecvp(const wchar_t *_Filename,const wchar_t *const *_ArgList);
+  _CRTIMP intptr_t __cdecl _wexecvpe(const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env);
+  _CRTIMP intptr_t __cdecl _wspawnl(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
+  _CRTIMP intptr_t __cdecl _wspawnle(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
+  _CRTIMP intptr_t __cdecl _wspawnlp(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
+  _CRTIMP intptr_t __cdecl _wspawnlpe(int _Mode,const wchar_t *_Filename,const wchar_t *_ArgList,...);
+  _CRTIMP intptr_t __cdecl _wspawnv(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList);
+  _CRTIMP intptr_t __cdecl _wspawnve(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env);
+  _CRTIMP intptr_t __cdecl _wspawnvp(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList);
+  _CRTIMP intptr_t __cdecl _wspawnvpe(int _Mode,const wchar_t *_Filename,const wchar_t *const *_ArgList,const wchar_t *const *_Env);
+#ifndef _CRT_WSYSTEM_DEFINED
+#define _CRT_WSYSTEM_DEFINED
+  _CRTIMP int __cdecl _wsystem(const wchar_t *_Command);
+#endif
+#endif
 
-#ifndef        _NO_OLDNAMES
-/*
- * Functions without the leading underscore, for portability. These functions
- * live in liboldnames.a.
- */
-_CRTIMP int  __cdecl __MINGW_NOTHROW cwait (int*, pid_t, int);
-_CRTIMP pid_t __cdecl __MINGW_NOTHROW getpid (void);
-_CRTIMP int __cdecl __MINGW_NOTHROW execl (const char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW execle (const char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW execlp (const char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW execlpe (const char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW execv (const char*, const char* const*);
-_CRTIMP int __cdecl __MINGW_NOTHROW execve (const char*, const char* const*, const char* const*);
-_CRTIMP int __cdecl __MINGW_NOTHROW execvp (const char*, const char* const*);
-_CRTIMP int __cdecl __MINGW_NOTHROW execvpe (const char*, const char* const*, const char* const*);
-_CRTIMP int __cdecl __MINGW_NOTHROW spawnl (int, const char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW spawnle (int, const char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW spawnlp (int, const char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW spawnlpe (int, const char*, const char*, ...);
-_CRTIMP int __cdecl __MINGW_NOTHROW spawnv (int, const char*, const char* const*);
-_CRTIMP int __cdecl __MINGW_NOTHROW spawnve (int, const char*, const char* const*, const char* const*);
-_CRTIMP int __cdecl __MINGW_NOTHROW spawnvp (int, const char*, const char* const*);
-_CRTIMP int __cdecl __MINGW_NOTHROW spawnvpe (int, const char*, const char* const*, const char* const*);
-#endif /* Not _NO_OLDNAMES */
-
-#ifdef __cplusplus
-}
+  void __cdecl __security_init_cookie(void);
+#if (defined(_X86_) && !defined(__x86_64))
+  void __fastcall __security_check_cookie(uintptr_t _StackCookie);
+  __declspec(noreturn) void __cdecl __report_gsfailure(void);
+#else
+  void __cdecl __security_check_cookie(uintptr_t _StackCookie);
+  __declspec(noreturn) void __cdecl __report_gsfailure(uintptr_t _StackCookie);
+#endif
+  extern uintptr_t __security_cookie;
+
+  intptr_t __cdecl _loaddll(char *_Filename);
+  int __cdecl _unloaddll(intptr_t _Handle);
+  int (__cdecl *__cdecl _getdllprocaddr(intptr_t _Handle,char *_ProcedureName,intptr_t _Ordinal))(void);
+
+#ifdef _DECL_DLLMAIN
+#ifdef _WINDOWS_
+  WINBOOL WINAPI DllMain(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved);
+  WINBOOL WINAPI _CRT_INIT(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved);
+  WINBOOL WINAPI _wCRT_INIT(HANDLE _HDllHandle,DWORD _Reason,LPVOID _Reserved);
+  extern WINBOOL (WINAPI *const _pRawDllMain)(HANDLE,DWORD,LPVOID);
+#else
+  int __stdcall DllMain(void *_HDllHandle,unsigned _Reason,void *_Reserved);
+  int __stdcall _CRT_INIT(void *_HDllHandle,unsigned _Reason,void *_Reserved);
+  int __stdcall _wCRT_INIT(void *_HDllHandle,unsigned _Reason,void *_Reserved);
+  extern int (__stdcall *const _pRawDllMain)(void *,unsigned,void *);
+#endif
 #endif
 
-#endif /* Not RC_INVOKED */
+#ifndef        NO_OLDNAMES
+#define P_WAIT _P_WAIT
+#define P_NOWAIT _P_NOWAIT
+#define P_OVERLAY _P_OVERLAY
+#define OLD_P_OVERLAY _OLD_P_OVERLAY
+#define P_NOWAITO _P_NOWAITO
+#define P_DETACH _P_DETACH
+#define WAIT_CHILD _WAIT_CHILD
+#define WAIT_GRANDCHILD _WAIT_GRANDCHILD
+
+  _CRTIMP intptr_t __cdecl cwait(int *_TermStat,intptr_t _ProcHandle,int _Action);
+#ifdef __GNUC__
+  _CRTIMP int __cdecl execl(const char *_Filename,const char *_ArgList,...);
+  _CRTIMP int __cdecl execle(const char *_Filename,const char *_ArgList,...);
+  _CRTIMP int __cdecl execlp(const char *_Filename,const char *_ArgList,...);
+  _CRTIMP int __cdecl execlpe(const char *_Filename,const char *_ArgList,...);
+#else
+  _CRTIMP intptr_t __cdecl execl(const char *_Filename,const char *_ArgList,...);
+  _CRTIMP intptr_t __cdecl execle(const char *_Filename,const char *_ArgList,...);
+  _CRTIMP intptr_t __cdecl execlp(const char *_Filename,const char *_ArgList,...);
+  _CRTIMP intptr_t __cdecl execlpe(const char *_Filename,const char *_ArgList,...);
+#endif
+  _CRTIMP intptr_t __cdecl spawnl(int,const char *_Filename,const char *_ArgList,...);
+  _CRTIMP intptr_t __cdecl spawnle(int,const char *_Filename,const char *_ArgList,...);
+  _CRTIMP intptr_t __cdecl spawnlp(int,const char *_Filename,const char *_ArgList,...);
+  _CRTIMP intptr_t __cdecl spawnlpe(int,const char *_Filename,const char *_ArgList,...);
+  _CRTIMP int __cdecl getpid(void);
+#ifdef __GNUC__
+  /* Those methods are predefined by gcc builtins to return int. So to prevent
+     stupid warnings, define them in POSIX way.  This is save, because those
+     methods do not return in success case, so that the return value is not
+     really dependent to its scalar width.  */
+  _CRTIMP int __cdecl execv(const char *_Filename,char *const _ArgList[]);
+  _CRTIMP int __cdecl execve(const char *_Filename,char *const _ArgList[],char *const _Env[]);
+  _CRTIMP int __cdecl execvp(const char *_Filename,char *const _ArgList[]);
+  _CRTIMP int __cdecl execvpe(const char *_Filename,char *const _ArgList[],char *const _Env[]);
+#else
+  _CRTIMP intptr_t __cdecl execv(const char *_Filename,char *const _ArgList[]);
+  _CRTIMP intptr_t __cdecl execve(const char *_Filename,char *const _ArgList[],char *const _Env[]);
+  _CRTIMP intptr_t __cdecl execvp(const char *_Filename,char *const _ArgList[]);
+  _CRTIMP intptr_t __cdecl execvpe(const char *_Filename,char *const _ArgList[],char *const _Env[]);
+#endif
+  _CRTIMP intptr_t __cdecl spawnv(int,const char *_Filename,char *const _ArgList[]);
+  _CRTIMP intptr_t __cdecl spawnve(int,const char *_Filename,char *const _ArgList[],char *const _Env[]);
+  _CRTIMP intptr_t __cdecl spawnvp(int,const char *_Filename,char *const _ArgList[]);
+  _CRTIMP intptr_t __cdecl spawnvpe(int,const char *_Filename,char *const _ArgList[],char *const _Env[]);
+#endif
 
-#endif /* _PROCESS_H_ not defined */
+#ifdef __cplusplus
+}
+#endif
+#endif
+#endif