msvcrt/process.h: __stdcall__ defined safely for Mac OSX.
[wine/wine64.git] / include / msvcrt / process.h
blob0f7c0c6bc6f1c3175cad5d08b3df91eb7c04ffb7
1 /*
2 * Process definitions
4 * Derived from the mingw header written by Colin Peters.
5 * Modified for Wine use by Jon Griffiths and Francois Gouget.
6 * This file is in the public domain.
7 */
8 #ifndef __WINE_PROCESS_H
9 #define __WINE_PROCESS_H
10 #ifndef __WINE_USE_MSVCRT
11 #define __WINE_USE_MSVCRT
12 #endif
14 #ifndef _WCHAR_T_DEFINED
15 #define _WCHAR_T_DEFINED
16 #ifndef __cplusplus
17 typedef unsigned short wchar_t;
18 #endif
19 #endif
21 /* Process creation flags */
22 #define _P_WAIT 0
23 #define _P_NOWAIT 1
24 #define _P_OVERLAY 2
25 #define _P_NOWAITO 3
26 #define _P_DETACH 4
28 #define _WAIT_CHILD 0
29 #define _WAIT_GRANDCHILD 1
31 #ifndef __stdcall
32 # ifdef __i386__
33 # ifdef __GNUC__
34 # ifdef __APPLE__ /* Mac OSX uses 16-byte aligned stack and not a 4-byte one */
35 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
36 # else
37 # define __stdcall __attribute__((__stdcall__))
38 # endif
39 # elif defined(_MSC_VER)
40 /* Nothing needs to be done. __stdcall already exists */
41 # else
42 # error You need to define __stdcall for your compiler
43 # endif
44 # else /* __i386__ */
45 # define __stdcall
46 # endif /* __i386__ */
47 #endif /* __stdcall */
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
53 typedef void (*_beginthread_start_routine_t)(void *);
54 typedef unsigned int (__stdcall *_beginthreadex_start_routine_t)(void *);
56 uintptr_t _beginthread(_beginthread_start_routine_t,unsigned int,void*);
57 uintptr_t _beginthreadex(void*,unsigned int,_beginthreadex_start_routine_t,void*,unsigned int,unsigned int*);
58 intptr_t _cwait(int*,intptr_t,int);
59 void _endthread(void);
60 void _endthreadex(unsigned int);
61 intptr_t _execl(const char*,const char*,...);
62 intptr_t _execle(const char*,const char*,...);
63 intptr_t _execlp(const char*,const char*,...);
64 intptr_t _execlpe(const char*,const char*,...);
65 intptr_t _execv(const char*,char* const *);
66 intptr_t _execve(const char*,char* const *,const char* const *);
67 intptr_t _execvp(const char*,char* const *);
68 intptr_t _execvpe(const char*,char* const *,const char* const *);
69 int _getpid(void);
70 intptr_t _spawnl(int,const char*,const char*,...);
71 intptr_t _spawnle(int,const char*,const char*,...);
72 intptr_t _spawnlp(int,const char*,const char*,...);
73 intptr_t _spawnlpe(int,const char*,const char*,...);
74 intptr_t _spawnv(int,const char*,const char* const *);
75 intptr_t _spawnve(int,const char*,const char* const *,const char* const *);
76 intptr_t _spawnvp(int,const char*,const char* const *);
77 intptr_t _spawnvpe(int,const char*,const char* const *,const char* const *);
79 void _c_exit(void);
80 void _cexit(void);
81 void _exit(int);
82 void abort(void);
83 void exit(int);
84 int system(const char*);
86 #ifndef _WPROCESS_DEFINED
87 #define _WPROCESS_DEFINED
88 intptr_t _wexecl(const wchar_t*,const wchar_t*,...);
89 intptr_t _wexecle(const wchar_t*,const wchar_t*,...);
90 intptr_t _wexeclp(const wchar_t*,const wchar_t*,...);
91 intptr_t _wexeclpe(const wchar_t*,const wchar_t*,...);
92 intptr_t _wexecv(const wchar_t*,const wchar_t* const *);
93 intptr_t _wexecve(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
94 intptr_t _wexecvp(const wchar_t*,const wchar_t* const *);
95 intptr_t _wexecvpe(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
96 intptr_t _wspawnl(int,const wchar_t*,const wchar_t*,...);
97 intptr_t _wspawnle(int,const wchar_t*,const wchar_t*,...);
98 intptr_t _wspawnlp(int,const wchar_t*,const wchar_t*,...);
99 intptr_t _wspawnlpe(int,const wchar_t*,const wchar_t*,...);
100 intptr_t _wspawnv(int,const wchar_t*,const wchar_t* const *);
101 intptr_t _wspawnve(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
102 intptr_t _wspawnvp(int,const wchar_t*,const wchar_t* const *);
103 intptr_t _wspawnvpe(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
104 int _wsystem(const wchar_t*);
105 #endif /* _WPROCESS_DEFINED */
107 #ifdef __cplusplus
109 #endif
112 #define P_WAIT _P_WAIT
113 #define P_NOWAIT _P_NOWAIT
114 #define P_OVERLAY _P_OVERLAY
115 #define P_NOWAITO _P_NOWAITO
116 #define P_DETACH _P_DETACH
118 #define WAIT_CHILD _WAIT_CHILD
119 #define WAIT_GRANDCHILD _WAIT_GRANDCHILD
121 static inline intptr_t cwait(int *status, intptr_t pid, int action) { return _cwait(status, pid, action); }
122 static inline int getpid(void) { return _getpid(); }
123 static inline intptr_t execv(const char* name, char* const* argv) { return _execv(name, argv); }
124 static inline intptr_t execve(const char* name, char* const* argv, const char* const* envv) { return _execve(name, argv, envv); }
125 static inline intptr_t execvp(const char* name, char* const* argv) { return _execvp(name, argv); }
126 static inline intptr_t execvpe(const char* name, char* const* argv, const char* const* envv) { return _execvpe(name, argv, envv); }
127 static inline intptr_t spawnv(int flags, const char* name, const char* const* argv) { return _spawnv(flags, name, argv); }
128 static inline intptr_t spawnve(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnve(flags, name, argv, envv); }
129 static inline intptr_t spawnvp(int flags, const char* name, const char* const* argv) { return _spawnvp(flags, name, argv); }
130 static inline intptr_t spawnvpe(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnvpe(flags, name, argv, envv); }
132 #if defined(__GNUC__) && (__GNUC__ < 4)
133 extern intptr_t execl(const char*,const char*,...) __attribute__((alias("_execl")));
134 extern intptr_t execle(const char*,const char*,...) __attribute__((alias("_execle")));
135 extern intptr_t execlp(const char*,const char*,...) __attribute__((alias("_execlp")));
136 extern intptr_t execlpe(const char*,const char*,...) __attribute__((alias("_execlpe")));
137 extern intptr_t spawnl(int,const char*,const char*,...) __attribute__((alias("_spawnl")));
138 extern intptr_t spawnle(int,const char*,const char*,...) __attribute__((alias("_spawnle")));
139 extern intptr_t spawnlp(int,const char*,const char*,...) __attribute__((alias("_spawnlp")));
140 extern intptr_t spawnlpe(int,const char*,const char*,...) __attribute__((alias("_spawnlpe")));
141 #else
142 #define execl _execl
143 #define execle _execle
144 #define execlp _execlp
145 #define execlpe _execlpe
146 #define spawnl _spawnl
147 #define spawnle _spawnle
148 #define spawnlp _spawnlp
149 #define spawnlpe _spawnlpe
150 #endif /* __GNUC__ */
152 #endif /* __WINE_PROCESS_H */