1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
* Process definitions
*
* Derived from the mingw header written by Colin Peters.
* Modified for Wine use by Jon Griffiths and Francois Gouget.
* This file is in the public domain.
*/
#ifndef __WINE_PROCESS_H
#define __WINE_PROCESS_H
#include <crtdefs.h>
/* Process creation flags */
#define _P_WAIT 0
#define _P_NOWAIT 1
#define _P_OVERLAY 2
#define _P_NOWAITO 3
#define _P_DETACH 4
#define _WAIT_CHILD 0
#define _WAIT_GRANDCHILD 1
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*_beginthread_start_routine_t)(void *);
typedef unsigned int (__stdcall *_beginthreadex_start_routine_t)(void *);
uintptr_t _beginthread(_beginthread_start_routine_t,unsigned int,void*);
uintptr_t _beginthreadex(void*,unsigned int,_beginthreadex_start_routine_t,void*,unsigned int,unsigned int*);
intptr_t _cwait(int*,intptr_t,int);
void _endthread(void);
void _endthreadex(unsigned int);
intptr_t _execl(const char*,const char*,...);
intptr_t _execle(const char*,const char*,...);
intptr_t _execlp(const char*,const char*,...);
intptr_t _execlpe(const char*,const char*,...);
intptr_t _execv(const char*,char* const *);
intptr_t _execve(const char*,char* const *,const char* const *);
intptr_t _execvp(const char*,char* const *);
intptr_t _execvpe(const char*,char* const *,const char* const *);
int _getpid(void);
intptr_t _spawnl(int,const char*,const char*,...);
intptr_t _spawnle(int,const char*,const char*,...);
intptr_t _spawnlp(int,const char*,const char*,...);
intptr_t _spawnlpe(int,const char*,const char*,...);
intptr_t _spawnv(int,const char*,const char* const *);
intptr_t _spawnve(int,const char*,const char* const *,const char* const *);
intptr_t _spawnvp(int,const char*,const char* const *);
intptr_t _spawnvpe(int,const char*,const char* const *,const char* const *);
void _c_exit(void);
void _cexit(void);
void _exit(int);
void abort(void);
void exit(int);
int system(const char*);
#ifndef _WPROCESS_DEFINED
#define _WPROCESS_DEFINED
intptr_t _wexecl(const wchar_t*,const wchar_t*,...);
intptr_t _wexecle(const wchar_t*,const wchar_t*,...);
intptr_t _wexeclp(const wchar_t*,const wchar_t*,...);
intptr_t _wexeclpe(const wchar_t*,const wchar_t*,...);
intptr_t _wexecv(const wchar_t*,const wchar_t* const *);
intptr_t _wexecve(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
intptr_t _wexecvp(const wchar_t*,const wchar_t* const *);
intptr_t _wexecvpe(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
intptr_t _wspawnl(int,const wchar_t*,const wchar_t*,...);
intptr_t _wspawnle(int,const wchar_t*,const wchar_t*,...);
intptr_t _wspawnlp(int,const wchar_t*,const wchar_t*,...);
intptr_t _wspawnlpe(int,const wchar_t*,const wchar_t*,...);
intptr_t _wspawnv(int,const wchar_t*,const wchar_t* const *);
intptr_t _wspawnve(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
intptr_t _wspawnvp(int,const wchar_t*,const wchar_t* const *);
intptr_t _wspawnvpe(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
int _wsystem(const wchar_t*);
#endif /* _WPROCESS_DEFINED */
#ifdef __cplusplus
}
#endif
#define P_WAIT _P_WAIT
#define P_NOWAIT _P_NOWAIT
#define P_OVERLAY _P_OVERLAY
#define P_NOWAITO _P_NOWAITO
#define P_DETACH _P_DETACH
#define WAIT_CHILD _WAIT_CHILD
#define WAIT_GRANDCHILD _WAIT_GRANDCHILD
static inline intptr_t cwait(int *status, intptr_t pid, int action) { return _cwait(status, pid, action); }
static inline int getpid(void) { return _getpid(); }
static inline intptr_t execv(const char* name, char* const* argv) { return _execv(name, argv); }
static inline intptr_t execve(const char* name, char* const* argv, const char* const* envv) { return _execve(name, argv, envv); }
static inline intptr_t execvp(const char* name, char* const* argv) { return _execvp(name, argv); }
static inline intptr_t execvpe(const char* name, char* const* argv, const char* const* envv) { return _execvpe(name, argv, envv); }
static inline intptr_t spawnv(int flags, const char* name, const char* const* argv) { return _spawnv(flags, name, argv); }
static inline intptr_t spawnve(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnve(flags, name, argv, envv); }
static inline intptr_t spawnvp(int flags, const char* name, const char* const* argv) { return _spawnvp(flags, name, argv); }
static inline intptr_t spawnvpe(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnvpe(flags, name, argv, envv); }
#if defined(__GNUC__) && (__GNUC__ < 4)
extern intptr_t execl(const char*,const char*,...) __attribute__((alias("_execl")));
extern intptr_t execle(const char*,const char*,...) __attribute__((alias("_execle")));
extern intptr_t execlp(const char*,const char*,...) __attribute__((alias("_execlp")));
extern intptr_t execlpe(const char*,const char*,...) __attribute__((alias("_execlpe")));
extern intptr_t spawnl(int,const char*,const char*,...) __attribute__((alias("_spawnl")));
extern intptr_t spawnle(int,const char*,const char*,...) __attribute__((alias("_spawnle")));
extern intptr_t spawnlp(int,const char*,const char*,...) __attribute__((alias("_spawnlp")));
extern intptr_t spawnlpe(int,const char*,const char*,...) __attribute__((alias("_spawnlpe")));
#else
#define execl _execl
#define execle _execle
#define execlp _execlp
#define execlpe _execlpe
#define spawnl _spawnl
#define spawnle _spawnle
#define spawnlp _spawnlp
#define spawnlpe _spawnlpe
#endif /* __GNUC__ */
#endif /* __WINE_PROCESS_H */