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 # define __stdcall __attribute__((__stdcall__))
35 # elif defined(_MSC_VER)
36 /* Nothing needs to be done. __stdcall already exists */
38 # error You need to define __stdcall for your compiler
42 # endif /* __i386__ */
43 #endif /* __stdcall */
49 typedef void (*_beginthread_start_routine_t)(void *);
50 typedef unsigned int (__stdcall *_beginthreadex_start_routine_t)(void *);
52 unsigned long _beginthread(_beginthread_start_routine_t,unsigned int,void*);
53 unsigned long _beginthreadex(void*,unsigned int,_beginthreadex_start_routine_t,void*,unsigned int,unsigned int*);
54 int _cwait(int*,int,int);
55 void _endthread(void);
56 void _endthreadex(unsigned int);
57 int _execl(const char*,const char*,...);
58 int _execle(const char*,const char*,...);
59 int _execlp(const char*,const char*,...);
60 int _execlpe(const char*,const char*,...);
61 int _execv(const char*,char* const *);
62 int _execve(const char*,char* const *,const char* const *);
63 int _execvp(const char*,char* const *);
64 int _execvpe(const char*,char* const *,const char* const *);
66 int _spawnl(int,const char*,const char*,...);
67 int _spawnle(int,const char*,const char*,...);
68 int _spawnlp(int,const char*,const char*,...);
69 int _spawnlpe(int,const char*,const char*,...);
70 int _spawnv(int,const char*,const char* const *);
71 int _spawnve(int,const char*,const char* const *,const char* const *);
72 int _spawnvp(int,const char*,const char* const *);
73 int _spawnvpe(int,const char*,const char* const *,const char* const *);
80 int system(const char*);
82 #ifndef _WPROCESS_DEFINED
83 #define _WPROCESS_DEFINED
84 int _wexecl(const wchar_t*,const wchar_t*,...);
85 int _wexecle(const wchar_t*,const wchar_t*,...);
86 int _wexeclp(const wchar_t*,const wchar_t*,...);
87 int _wexeclpe(const wchar_t*,const wchar_t*,...);
88 int _wexecv(const wchar_t*,const wchar_t* const *);
89 int _wexecve(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
90 int _wexecvp(const wchar_t*,const wchar_t* const *);
91 int _wexecvpe(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
92 int _wspawnl(int,const wchar_t*,const wchar_t*,...);
93 int _wspawnle(int,const wchar_t*,const wchar_t*,...);
94 int _wspawnlp(int,const wchar_t*,const wchar_t*,...);
95 int _wspawnlpe(int,const wchar_t*,const wchar_t*,...);
96 int _wspawnv(int,const wchar_t*,const wchar_t* const *);
97 int _wspawnve(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
98 int _wspawnvp(int,const wchar_t*,const wchar_t* const *);
99 int _wspawnvpe(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
100 int _wsystem(const wchar_t*);
101 #endif /* _WPROCESS_DEFINED */
108 #define P_WAIT _P_WAIT
109 #define P_NOWAIT _P_NOWAIT
110 #define P_OVERLAY _P_OVERLAY
111 #define P_NOWAITO _P_NOWAITO
112 #define P_DETACH _P_DETACH
114 #define WAIT_CHILD _WAIT_CHILD
115 #define WAIT_GRANDCHILD _WAIT_GRANDCHILD
117 static inline int cwait(int *status, int pid, int action) { return _cwait(status, pid, action); }
118 static inline int getpid(void) { return _getpid(); }
119 static inline int execv(const char* name, char* const* argv) { return _execv(name, argv); }
120 static inline int execve(const char* name, char* const* argv, const char* const* envv) { return _execve(name, argv, envv); }
121 static inline int execvp(const char* name, char* const* argv) { return _execvp(name, argv); }
122 static inline int execvpe(const char* name, char* const* argv, const char* const* envv) { return _execvpe(name, argv, envv); }
123 static inline int spawnv(int flags, const char* name, const char* const* argv) { return _spawnv(flags, name, argv); }
124 static inline int spawnve(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnve(flags, name, argv, envv); }
125 static inline int spawnvp(int flags, const char* name, const char* const* argv) { return _spawnvp(flags, name, argv); }
126 static inline int spawnvpe(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnvpe(flags, name, argv, envv); }
128 #if defined(__GNUC__) && (__GNUC__ < 4)
129 extern int execl(const char*,const char*,...) __attribute__((alias("_execl")));
130 extern int execle(const char*,const char*,...) __attribute__((alias("_execle")));
131 extern int execlp(const char*,const char*,...) __attribute__((alias("_execlp")));
132 extern int execlpe(const char*,const char*,...) __attribute__((alias("_execlpe")));
133 extern int spawnl(int,const char*,const char*,...) __attribute__((alias("_spawnl")));
134 extern int spawnle(int,const char*,const char*,...) __attribute__((alias("_spawnle")));
135 extern int spawnlp(int,const char*,const char*,...) __attribute__((alias("_spawnlp")));
136 extern int spawnlpe(int,const char*,const char*,...) __attribute__((alias("_spawnlpe")));
139 #define execle _execle
140 #define execlp _execlp
141 #define execlpe _execlpe
142 #define spawnl _spawnl
143 #define spawnle _spawnle
144 #define spawnlp _spawnlp
145 #define spawnlpe _spawnlpe
146 #endif /* __GNUC__ */
148 #endif /* __WINE_PROCESS_H */