blob: 7e52d5f5bcee04495d43010c525b16543470a787 [file] [log] [blame]
Francois Gougeteee695d2001-04-10 23:21:43 +00001/*
2 * Process definitions
3 *
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
Jon Griffiths5f175502003-07-18 22:57:15 +000010#ifndef __WINE_USE_MSVCRT
Francois Gougeta45907c2001-10-22 18:59:23 +000011#define __WINE_USE_MSVCRT
Jon Griffiths5f175502003-07-18 22:57:15 +000012#endif
Francois Gougeteee695d2001-04-10 23:21:43 +000013
Dimitrie O. Paun03774622004-06-25 01:19:15 +000014#ifndef _WCHAR_T_DEFINED
15#define _WCHAR_T_DEFINED
Alexandre Julliard3f5ff2f2002-12-18 20:17:20 +000016#ifndef __cplusplus
Dimitrie O. Paun03774622004-06-25 01:19:15 +000017typedef unsigned short wchar_t;
Alexandre Julliard3f5ff2f2002-12-18 20:17:20 +000018#endif
19#endif
Francois Gougeteee695d2001-04-10 23:21:43 +000020
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
27
28#define _WAIT_CHILD 0
29#define _WAIT_GRANDCHILD 1
30
Alexandre Julliardd1e46c52003-01-15 03:31:49 +000031#ifndef __stdcall
32# ifdef __i386__
33# ifdef __GNUC__
34# define __stdcall __attribute__((__stdcall__))
35# elif defined(_MSC_VER)
36 /* Nothing needs to be done. __stdcall already exists */
37# else
38# error You need to define __stdcall for your compiler
39# endif
40# else /* __i386__ */
41# define __stdcall
42# endif /* __i386__ */
43#endif /* __stdcall */
Francois Gougeteee695d2001-04-10 23:21:43 +000044
45#ifdef __cplusplus
46extern "C" {
47#endif
48
Alexandre Julliardd1e46c52003-01-15 03:31:49 +000049typedef void (*_beginthread_start_routine_t)(void *);
Patrik Stridvall57e57842002-02-02 18:42:11 +000050typedef unsigned int (__stdcall *_beginthreadex_start_routine_t)(void *);
Patrik Stridvall887c0352001-06-19 03:46:27 +000051
52unsigned long _beginthread(_beginthread_start_routine_t,unsigned int,void*);
53unsigned long _beginthreadex(void*,unsigned int,_beginthreadex_start_routine_t,void*,unsigned int,unsigned int*);
Francois Gougeteee695d2001-04-10 23:21:43 +000054int _cwait(int*,int,int);
55void _endthread(void);
Patrik Stridvall887c0352001-06-19 03:46:27 +000056void _endthreadex(unsigned int);
Francois Gougeteee695d2001-04-10 23:21:43 +000057int _execl(const char*,const char*,...);
58int _execle(const char*,const char*,...);
59int _execlp(const char*,const char*,...);
60int _execlpe(const char*,const char*,...);
61int _execv(const char*,char* const *);
62int _execve(const char*,char* const *,const char* const *);
63int _execvp(const char*,char* const *);
64int _execvpe(const char*,char* const *,const char* const *);
65int _getpid(void);
66int _spawnl(int,const char*,const char*,...);
67int _spawnle(int,const char*,const char*,...);
68int _spawnlp(int,const char*,const char*,...);
69int _spawnlpe(int,const char*,const char*,...);
70int _spawnv(int,const char*,const char* const *);
71int _spawnve(int,const char*,const char* const *,const char* const *);
Francois Gougetd5aebbe2001-11-19 02:09:49 +000072int _spawnvp(int,const char*,const char* const *);
Francois Gougeteee695d2001-04-10 23:21:43 +000073int _spawnvpe(int,const char*,const char* const *,const char* const *);
74
Dimitrie O. Paun03774622004-06-25 01:19:15 +000075void _c_exit(void);
76void _cexit(void);
77void _exit(int);
78void abort(void);
79void exit(int);
80int system(const char*);
Francois Gougeteee695d2001-04-10 23:21:43 +000081
Dimitrie O. Paun03774622004-06-25 01:19:15 +000082#ifndef _WPROCESS_DEFINED
83#define _WPROCESS_DEFINED
84int _wexecl(const wchar_t*,const wchar_t*,...);
85int _wexecle(const wchar_t*,const wchar_t*,...);
86int _wexeclp(const wchar_t*,const wchar_t*,...);
87int _wexeclpe(const wchar_t*,const wchar_t*,...);
88int _wexecv(const wchar_t*,const wchar_t* const *);
89int _wexecve(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
90int _wexecvp(const wchar_t*,const wchar_t* const *);
91int _wexecvpe(const wchar_t*,const wchar_t* const *,const wchar_t* const *);
92int _wspawnl(int,const wchar_t*,const wchar_t*,...);
93int _wspawnle(int,const wchar_t*,const wchar_t*,...);
94int _wspawnlp(int,const wchar_t*,const wchar_t*,...);
95int _wspawnlpe(int,const wchar_t*,const wchar_t*,...);
96int _wspawnv(int,const wchar_t*,const wchar_t* const *);
97int _wspawnve(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
98int _wspawnvp(int,const wchar_t*,const wchar_t* const *);
99int _wspawnvpe(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *);
100int _wsystem(const wchar_t*);
101#endif /* _WPROCESS_DEFINED */
Francois Gougeteee695d2001-04-10 23:21:43 +0000102
103#ifdef __cplusplus
104}
105#endif
106
107
Francois Gougeteee695d2001-04-10 23:21:43 +0000108#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
113
114#define WAIT_CHILD _WAIT_CHILD
115#define WAIT_GRANDCHILD _WAIT_GRANDCHILD
116
Madhura Sahasrabudhe992d1b92003-03-22 21:15:41 +0000117static inline int cwait(int *status, int pid, int action) { return _cwait(status, pid, action); }
118static inline int getpid(void) { return _getpid(); }
Madhura Sahasrabudhe992d1b92003-03-22 21:15:41 +0000119static inline int execv(const char* name, char* const* argv) { return _execv(name, argv); }
120static inline int execve(const char* name, char* const* argv, const char* const* envv) { return _execve(name, argv, envv); }
121static inline int execvp(const char* name, char* const* argv) { return _execvp(name, argv); }
122static inline int execvpe(const char* name, char* const* argv, const char* const* envv) { return _execvpe(name, argv, envv); }
Madhura Sahasrabudhe992d1b92003-03-22 21:15:41 +0000123static inline int spawnv(int flags, const char* name, const char* const* argv) { return _spawnv(flags, name, argv); }
124static inline int spawnve(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnve(flags, name, argv, envv); }
125static inline int spawnvp(int flags, const char* name, const char* const* argv) { return _spawnvp(flags, name, argv); }
126static inline int spawnvpe(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnvpe(flags, name, argv, envv); }
Alexandre Julliard98f02022003-03-26 01:29:56 +0000127
Marcus Meissner6b7e3e12005-04-25 10:48:59 +0000128#if defined(__GNUC__) && (__GNUC__ < 4)
Alexandre Julliard98f02022003-03-26 01:29:56 +0000129extern int execl(const char*,const char*,...) __attribute__((alias("_execl")));
130extern int execle(const char*,const char*,...) __attribute__((alias("_execle")));
131extern int execlp(const char*,const char*,...) __attribute__((alias("_execlp")));
132extern int execlpe(const char*,const char*,...) __attribute__((alias("_execlpe")));
133extern int spawnl(int,const char*,const char*,...) __attribute__((alias("_spawnl")));
134extern int spawnle(int,const char*,const char*,...) __attribute__((alias("_spawnle")));
135extern int spawnlp(int,const char*,const char*,...) __attribute__((alias("_spawnlp")));
136extern int spawnlpe(int,const char*,const char*,...) __attribute__((alias("_spawnlpe")));
137#else
138#define execl _execl
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__ */
147
Francois Gougeteee695d2001-04-10 23:21:43 +0000148#endif /* __WINE_PROCESS_H */