Francois Gouget | eee695d | 2001-04-10 23:21:43 +0000 | [diff] [blame] | 1 | /* |
| 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 Griffiths | 5f17550 | 2003-07-18 22:57:15 +0000 | [diff] [blame] | 10 | #ifndef __WINE_USE_MSVCRT |
Francois Gouget | a45907c | 2001-10-22 18:59:23 +0000 | [diff] [blame] | 11 | #define __WINE_USE_MSVCRT |
Jon Griffiths | 5f17550 | 2003-07-18 22:57:15 +0000 | [diff] [blame] | 12 | #endif |
Francois Gouget | eee695d | 2001-04-10 23:21:43 +0000 | [diff] [blame] | 13 | |
Dimitrie O. Paun | 0377462 | 2004-06-25 01:19:15 +0000 | [diff] [blame] | 14 | #ifndef _WCHAR_T_DEFINED |
| 15 | #define _WCHAR_T_DEFINED |
Alexandre Julliard | 3f5ff2f | 2002-12-18 20:17:20 +0000 | [diff] [blame] | 16 | #ifndef __cplusplus |
Dimitrie O. Paun | 0377462 | 2004-06-25 01:19:15 +0000 | [diff] [blame] | 17 | typedef unsigned short wchar_t; |
Alexandre Julliard | 3f5ff2f | 2002-12-18 20:17:20 +0000 | [diff] [blame] | 18 | #endif |
| 19 | #endif |
Francois Gouget | eee695d | 2001-04-10 23:21:43 +0000 | [diff] [blame] | 20 | |
| 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 Julliard | d1e46c5 | 2003-01-15 03:31:49 +0000 | [diff] [blame] | 31 | #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 Gouget | eee695d | 2001-04-10 23:21:43 +0000 | [diff] [blame] | 44 | |
| 45 | #ifdef __cplusplus |
| 46 | extern "C" { |
| 47 | #endif |
| 48 | |
Alexandre Julliard | d1e46c5 | 2003-01-15 03:31:49 +0000 | [diff] [blame] | 49 | typedef void (*_beginthread_start_routine_t)(void *); |
Patrik Stridvall | 57e5784 | 2002-02-02 18:42:11 +0000 | [diff] [blame] | 50 | typedef unsigned int (__stdcall *_beginthreadex_start_routine_t)(void *); |
Patrik Stridvall | 887c035 | 2001-06-19 03:46:27 +0000 | [diff] [blame] | 51 | |
| 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*); |
Francois Gouget | eee695d | 2001-04-10 23:21:43 +0000 | [diff] [blame] | 54 | int _cwait(int*,int,int); |
| 55 | void _endthread(void); |
Patrik Stridvall | 887c035 | 2001-06-19 03:46:27 +0000 | [diff] [blame] | 56 | void _endthreadex(unsigned int); |
Francois Gouget | eee695d | 2001-04-10 23:21:43 +0000 | [diff] [blame] | 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 *); |
| 65 | int _getpid(void); |
| 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 *); |
Francois Gouget | d5aebbe | 2001-11-19 02:09:49 +0000 | [diff] [blame] | 72 | int _spawnvp(int,const char*,const char* const *); |
Francois Gouget | eee695d | 2001-04-10 23:21:43 +0000 | [diff] [blame] | 73 | int _spawnvpe(int,const char*,const char* const *,const char* const *); |
| 74 | |
Dimitrie O. Paun | 0377462 | 2004-06-25 01:19:15 +0000 | [diff] [blame] | 75 | void _c_exit(void); |
| 76 | void _cexit(void); |
| 77 | void _exit(int); |
| 78 | void abort(void); |
| 79 | void exit(int); |
| 80 | int system(const char*); |
Francois Gouget | eee695d | 2001-04-10 23:21:43 +0000 | [diff] [blame] | 81 | |
Dimitrie O. Paun | 0377462 | 2004-06-25 01:19:15 +0000 | [diff] [blame] | 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 */ |
Francois Gouget | eee695d | 2001-04-10 23:21:43 +0000 | [diff] [blame] | 102 | |
| 103 | #ifdef __cplusplus |
| 104 | } |
| 105 | #endif |
| 106 | |
| 107 | |
Francois Gouget | eee695d | 2001-04-10 23:21:43 +0000 | [diff] [blame] | 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 |
| 113 | |
| 114 | #define WAIT_CHILD _WAIT_CHILD |
| 115 | #define WAIT_GRANDCHILD _WAIT_GRANDCHILD |
| 116 | |
Madhura Sahasrabudhe | 992d1b9 | 2003-03-22 21:15:41 +0000 | [diff] [blame] | 117 | static inline int cwait(int *status, int pid, int action) { return _cwait(status, pid, action); } |
| 118 | static inline int getpid(void) { return _getpid(); } |
Madhura Sahasrabudhe | 992d1b9 | 2003-03-22 21:15:41 +0000 | [diff] [blame] | 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); } |
Madhura Sahasrabudhe | 992d1b9 | 2003-03-22 21:15:41 +0000 | [diff] [blame] | 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); } |
Alexandre Julliard | 98f0202 | 2003-03-26 01:29:56 +0000 | [diff] [blame] | 127 | |
Marcus Meissner | 6b7e3e1 | 2005-04-25 10:48:59 +0000 | [diff] [blame] | 128 | #if defined(__GNUC__) && (__GNUC__ < 4) |
Alexandre Julliard | 98f0202 | 2003-03-26 01:29:56 +0000 | [diff] [blame] | 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"))); |
| 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 Gouget | eee695d | 2001-04-10 23:21:43 +0000 | [diff] [blame] | 148 | #endif /* __WINE_PROCESS_H */ |