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.
8 #ifndef __WINE_PROCESS_H
9 #define __WINE_PROCESS_H
10 #ifndef __WINE_USE_MSVCRT
11 #define __WINE_USE_MSVCRT
14 #ifndef _WCHAR_T_DEFINED
15 #define _WCHAR_T_DEFINED
17 typedef unsigned short wchar_t;
21 /* Process creation flags */
29 #define _WAIT_GRANDCHILD 1
34 # ifdef __APPLE__ /* Mac OS X uses a 16-byte aligned stack and not a 4-byte one */
35 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
37 # define __stdcall __attribute__((__stdcall__))
39 # elif defined(_MSC_VER)
40 /* Nothing needs to be done. __stdcall already exists */
42 # error You need to define __stdcall for your compiler
44 # elif defined(__x86_64__) && defined (__GNUC__)
45 # define __stdcall __attribute__((ms_abi))
49 #endif /* __stdcall */
55 typedef void (*_beginthread_start_routine_t
)(void *);
56 typedef unsigned int (__stdcall
*_beginthreadex_start_routine_t
)(void *);
58 uintptr_t _beginthread(_beginthread_start_routine_t
,unsigned int,void*);
59 uintptr_t _beginthreadex(void*,unsigned int,_beginthreadex_start_routine_t
,void*,unsigned int,unsigned int*);
60 intptr_t _cwait(int*,intptr_t,int);
61 void _endthread(void);
62 void _endthreadex(unsigned int);
63 intptr_t _execl(const char*,const char*,...);
64 intptr_t _execle(const char*,const char*,...);
65 intptr_t _execlp(const char*,const char*,...);
66 intptr_t _execlpe(const char*,const char*,...);
67 intptr_t _execv(const char*,char* const *);
68 intptr_t _execve(const char*,char* const *,const char* const *);
69 intptr_t _execvp(const char*,char* const *);
70 intptr_t _execvpe(const char*,char* const *,const char* const *);
72 intptr_t _spawnl(int,const char*,const char*,...);
73 intptr_t _spawnle(int,const char*,const char*,...);
74 intptr_t _spawnlp(int,const char*,const char*,...);
75 intptr_t _spawnlpe(int,const char*,const char*,...);
76 intptr_t _spawnv(int,const char*,const char* const *);
77 intptr_t _spawnve(int,const char*,const char* const *,const char* const *);
78 intptr_t _spawnvp(int,const char*,const char* const *);
79 intptr_t _spawnvpe(int,const char*,const char* const *,const char* const *);
86 int system(const char*);
88 #ifndef _WPROCESS_DEFINED
89 #define _WPROCESS_DEFINED
90 intptr_t _wexecl(const wchar_t*,const wchar_t*,...);
91 intptr_t _wexecle(const wchar_t*,const wchar_t*,...);
92 intptr_t _wexeclp(const wchar_t*,const wchar_t*,...);
93 intptr_t _wexeclpe(const wchar_t*,const wchar_t*,...);
94 intptr_t _wexecv(const wchar_t*,const wchar_t* const *);
95 intptr_t _wexecve(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
96 intptr_t _wexecvp(const wchar_t*,const wchar_t* const *);
97 intptr_t _wexecvpe(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
98 intptr_t _wspawnl(int,const wchar_t*,const wchar_t*,...);
99 intptr_t _wspawnle(int,const wchar_t*,const wchar_t*,...);
100 intptr_t _wspawnlp(int,const wchar_t*,const wchar_t*,...);
101 intptr_t _wspawnlpe(int,const wchar_t*,const wchar_t*,...);
102 intptr_t _wspawnv(int,const wchar_t*,const wchar_t* const *);
103 intptr_t _wspawnve(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
104 intptr_t _wspawnvp(int,const wchar_t*,const wchar_t* const *);
105 intptr_t _wspawnvpe(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
106 int _wsystem(const wchar_t*);
107 #endif /* _WPROCESS_DEFINED */
114 #define P_WAIT _P_WAIT
115 #define P_NOWAIT _P_NOWAIT
116 #define P_OVERLAY _P_OVERLAY
117 #define P_NOWAITO _P_NOWAITO
118 #define P_DETACH _P_DETACH
120 #define WAIT_CHILD _WAIT_CHILD
121 #define WAIT_GRANDCHILD _WAIT_GRANDCHILD
123 static inline intptr_t cwait(int *status
, intptr_t pid
, int action
) { return _cwait(status
, pid
, action
); }
124 static inline int getpid(void) { return _getpid(); }
125 static inline intptr_t execv(const char* name
, char* const* argv
) { return _execv(name
, argv
); }
126 static inline intptr_t execve(const char* name
, char* const* argv
, const char* const* envv
) { return _execve(name
, argv
, envv
); }
127 static inline intptr_t execvp(const char* name
, char* const* argv
) { return _execvp(name
, argv
); }
128 static inline intptr_t execvpe(const char* name
, char* const* argv
, const char* const* envv
) { return _execvpe(name
, argv
, envv
); }
129 static inline intptr_t spawnv(int flags
, const char* name
, const char* const* argv
) { return _spawnv(flags
, name
, argv
); }
130 static inline intptr_t spawnve(int flags
, const char* name
, const char* const* argv
, const char* const* envv
) { return _spawnve(flags
, name
, argv
, envv
); }
131 static inline intptr_t spawnvp(int flags
, const char* name
, const char* const* argv
) { return _spawnvp(flags
, name
, argv
); }
132 static inline intptr_t spawnvpe(int flags
, const char* name
, const char* const* argv
, const char* const* envv
) { return _spawnvpe(flags
, name
, argv
, envv
); }
134 #if defined(__GNUC__) && (__GNUC__ < 4)
135 extern intptr_t execl(const char*,const char*,...) __attribute__((alias("_execl")));
136 extern intptr_t execle(const char*,const char*,...) __attribute__((alias("_execle")));
137 extern intptr_t execlp(const char*,const char*,...) __attribute__((alias("_execlp")));
138 extern intptr_t execlpe(const char*,const char*,...) __attribute__((alias("_execlpe")));
139 extern intptr_t spawnl(int,const char*,const char*,...) __attribute__((alias("_spawnl")));
140 extern intptr_t spawnle(int,const char*,const char*,...) __attribute__((alias("_spawnle")));
141 extern intptr_t spawnlp(int,const char*,const char*,...) __attribute__((alias("_spawnlp")));
142 extern intptr_t spawnlpe(int,const char*,const char*,...) __attribute__((alias("_spawnlpe")));
145 #define execle _execle
146 #define execlp _execlp
147 #define execlpe _execlpe
148 #define spawnl _spawnl
149 #define spawnle _spawnle
150 #define spawnlp _spawnlp
151 #define spawnlpe _spawnlpe
152 #endif /* __GNUC__ */
154 #endif /* __WINE_PROCESS_H */