process.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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 <[email protected]>
  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. #ifndef __STRICT_ANSI__
  27. #ifndef _PROCESS_H_
  28. #define _PROCESS_H_
  29. /* All the headers include this file. */
  30. #include <_mingw.h>
  31. /* Includes a definition of _pid_t and pid_t */
  32. #include <sys/types.h>
  33. /*
  34. * Constants for cwait actions.
  35. * Obsolete for Win32.
  36. */
  37. #define _WAIT_CHILD 0
  38. #define _WAIT_GRANDCHILD 1
  39. #ifndef _NO_OLDNAMES
  40. #define WAIT_CHILD _WAIT_CHILD
  41. #define WAIT_GRANDCHILD _WAIT_GRANDCHILD
  42. #endif /* Not _NO_OLDNAMES */
  43. /*
  44. * Mode constants for spawn functions.
  45. */
  46. #define _P_WAIT 0
  47. #define _P_NOWAIT 1
  48. #define _P_OVERLAY 2
  49. #define _OLD_P_OVERLAY _P_OVERLAY
  50. #define _P_NOWAITO 3
  51. #define _P_DETACH 4
  52. #ifndef _NO_OLDNAMES
  53. #define P_WAIT _P_WAIT
  54. #define P_NOWAIT _P_NOWAIT
  55. #define P_OVERLAY _P_OVERLAY
  56. #define OLD_P_OVERLAY _OLD_P_OVERLAY
  57. #define P_NOWAITO _P_NOWAITO
  58. #define P_DETACH _P_DETACH
  59. #endif /* Not _NO_OLDNAMES */
  60. #ifndef RC_INVOKED
  61. #ifdef __cplusplus
  62. extern "C" {
  63. #endif
  64. void _cexit(void);
  65. void _c_exit(void);
  66. int _cwait (int*, _pid_t, int);
  67. _pid_t _getpid(void);
  68. int _execl (const char*, const char*, ...);
  69. int _execle (const char*, const char*, ...);
  70. int _execlp (const char*, const char*, ...);
  71. int _execlpe (const char*, const char*, ...);
  72. int _execv (const char*, char* const*);
  73. int _execve (const char*, char* const*, char* const*);
  74. int _execvp (const char*, char* const*);
  75. int _execvpe (const char*, char* const*, char* const*);
  76. int _spawnl (int, const char*, const char*, ...);
  77. int _spawnle (int, const char*, const char*, ...);
  78. int _spawnlp (int, const char*, const char*, ...);
  79. int _spawnlpe (int, const char*, const char*, ...);
  80. int _spawnv (int, const char*, char* const*);
  81. int _spawnve (int, const char*, char* const*, char* const*);
  82. int _spawnvp (int, const char*, char* const*);
  83. int _spawnvpe (int, const char*, char* const*, char* const*);
  84. /*
  85. * The functions _beginthreadex and _endthreadex are not provided by CRTDLL.
  86. * They are provided by MSVCRT.
  87. *
  88. * NOTE: Apparently _endthread calls CloseHandle on the handle of the thread,
  89. * making for race conditions if you are not careful. Basically you have to
  90. * make sure that no-one is going to do *anything* with the thread handle
  91. * after the thread calls _endthread or returns from the thread function.
  92. *
  93. * NOTE: No old names for these functions. Use the underscore.
  94. */
  95. unsigned long
  96. _beginthread (void (*)(void *), unsigned, void*);
  97. void _endthread (void);
  98. #ifdef __MSVCRT__
  99. unsigned long
  100. _beginthreadex (void *, unsigned, unsigned (__stdcall *) (void *),
  101. void*, unsigned, unsigned*);
  102. void _endthreadex (unsigned);
  103. #endif
  104. #ifndef _NO_OLDNAMES
  105. /*
  106. * Functions without the leading underscore, for portability. These functions
  107. * live in liboldnames.a.
  108. */
  109. int cwait (int*, pid_t, int);
  110. pid_t getpid (void);
  111. int execl (const char*, const char*, ...);
  112. int execle (const char*, const char*, ...);
  113. int execlp (const char*, const char*, ...);
  114. int execlpe (const char*, const char*, ...);
  115. int execv (const char*, char* const*);
  116. int execve (const char*, char* const*, char* const*);
  117. int execvp (const char*, char* const*);
  118. int execvpe (const char*, char* const*, char* const*);
  119. int spawnl (int, const char*, const char*, ...);
  120. int spawnle (int, const char*, const char*, ...);
  121. int spawnlp (int, const char*, const char*, ...);
  122. int spawnlpe (int, const char*, const char*, ...);
  123. int spawnv (int, const char*, char* const*);
  124. int spawnve (int, const char*, char* const*, char* const*);
  125. int spawnvp (int, const char*, char* const*);
  126. int spawnvpe (int, const char*, char* const*, char* const*);
  127. #endif /* Not _NO_OLDNAMES */
  128. #ifdef __cplusplus
  129. }
  130. #endif
  131. #endif /* Not RC_INVOKED */
  132. #endif /* _PROCESS_H_ not defined */
  133. #endif /* Not __STRICT_ANSI__ */