1 /* 2 * process.h 3 * 4 * Function calls for spawning child processes. 5 * 6 * This file is part of the Mingw32 package. 7 * 8 * Contributors: 9 * Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp> 10 * 11 * THIS SOFTWARE IS NOT COPYRIGHTED 12 * 13 * This source code is offered for use in the public domain. You may 14 * use, modify or distribute it freely. 15 * 16 * This code is distributed in the hope that it will be useful but 17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 18 * DISCLAIMED. This includes but is not limited to warranties of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 * $Revision: 1.2 $ 22 * $Author: bellard $ 23 * $Date: 2005/04/17 13:14:29 $ 24 * 25 */ 26 27 #ifndef __STRICT_ANSI__ 28 29 #ifndef _PROCESS_H_ 30 #define _PROCESS_H_ 31 32 /* All the headers include this file. */ 33 #include <_mingw.h> 34 35 /* Includes a definition of _pid_t and pid_t */ 36 #include <sys/types.h> 37 38 /* 39 * Constants for cwait actions. 40 * Obsolete for Win32. 41 */ 42 #define _WAIT_CHILD 0 43 #define _WAIT_GRANDCHILD 1 44 45 #ifndef _NO_OLDNAMES 46 #define WAIT_CHILD _WAIT_CHILD 47 #define WAIT_GRANDCHILD _WAIT_GRANDCHILD 48 #endif /* Not _NO_OLDNAMES */ 49 50 /* 51 * Mode constants for spawn functions. 52 */ 53 #define _P_WAIT 0 54 #define _P_NOWAIT 1 55 #define _P_OVERLAY 2 56 #define _OLD_P_OVERLAY _P_OVERLAY 57 #define _P_NOWAITO 3 58 #define _P_DETACH 4 59 60 #ifndef _NO_OLDNAMES 61 #define P_WAIT _P_WAIT 62 #define P_NOWAIT _P_NOWAIT 63 #define P_OVERLAY _P_OVERLAY 64 #define OLD_P_OVERLAY _OLD_P_OVERLAY 65 #define P_NOWAITO _P_NOWAITO 66 #define P_DETACH _P_DETACH 67 #endif /* Not _NO_OLDNAMES */ 68 69 70 #ifndef RC_INVOKED 71 72 #ifdef __cplusplus 73 extern "C" { 74 #endif 75 76 void _cexit(void); 77 void _c_exit(void); 78 79 int _cwait (int*, _pid_t, int); 80 81 _pid_t _getpid(void); 82 83 int _execl (const char*, const char*, ...); 84 int _execle (const char*, const char*, ...); 85 int _execlp (const char*, const char*, ...); 86 int _execlpe (const char*, const char*, ...); 87 int _execv (const char*, char* const*); 88 int _execve (const char*, char* const*, char* const*); 89 int _execvp (const char*, char* const*); 90 int _execvpe (const char*, char* const*, char* const*); 91 92 int _spawnl (int, const char*, const char*, ...); 93 int _spawnle (int, const char*, const char*, ...); 94 int _spawnlp (int, const char*, const char*, ...); 95 int _spawnlpe (int, const char*, const char*, ...); 96 int _spawnv (int, const char*, char* const*); 97 int _spawnve (int, const char*, char* const*, char* const*); 98 int _spawnvp (int, const char*, char* const*); 99 int _spawnvpe (int, const char*, char* const*, char* const*); 100 101 /* 102 * The functions _beginthreadex and _endthreadex are not provided by CRTDLL. 103 * They are provided by MSVCRT. 104 * 105 * NOTE: Apparently _endthread calls CloseHandle on the handle of the thread, 106 * making for race conditions if you are not careful. Basically you have to 107 * make sure that no-one is going to do *anything* with the thread handle 108 * after the thread calls _endthread or returns from the thread function. 109 * 110 * NOTE: No old names for these functions. Use the underscore. 111 */ 112 unsigned long 113 _beginthread (void (*)(void *), unsigned, void*); 114 void _endthread (void); 115 116 #ifdef __MSVCRT__ 117 unsigned long 118 _beginthreadex (void *, unsigned, unsigned (__stdcall *) (void *), 119 void*, unsigned, unsigned*); 120 void _endthreadex (unsigned); 121 #endif 122 123 124 #ifndef _NO_OLDNAMES 125 /* 126 * Functions without the leading underscore, for portability. These functions 127 * live in liboldnames.a. 128 */ 129 int cwait (int*, pid_t, int); 130 pid_t getpid (void); 131 int execl (const char*, const char*, ...); 132 int execle (const char*, const char*, ...); 133 int execlp (const char*, const char*, ...); 134 int execlpe (const char*, const char*, ...); 135 int execv (const char*, char* const*); 136 int execve (const char*, char* const*, char* const*); 137 int execvp (const char*, char* const*); 138 int execvpe (const char*, char* const*, char* const*); 139 int spawnl (int, const char*, const char*, ...); 140 int spawnle (int, const char*, const char*, ...); 141 int spawnlp (int, const char*, const char*, ...); 142 int spawnlpe (int, const char*, const char*, ...); 143 int spawnv (int, const char*, char* const*); 144 int spawnve (int, const char*, char* const*, char* const*); 145 int spawnvp (int, const char*, char* const*); 146 int spawnvpe (int, const char*, char* const*, char* const*); 147 #endif /* Not _NO_OLDNAMES */ 148 149 #ifdef __cplusplus 150 } 151 #endif 152 153 #endif /* Not RC_INVOKED */ 154 155 #endif /* _PROCESS_H_ not defined */ 156 157 #endif /* Not __STRICT_ANSI__ */ 158 159