Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

221 lines
7.1 KiB

  1. /***
  2. *process.h - definition and declarations for process control functions
  3. *
  4. * Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file defines the modeflag values for spawnxx calls.
  8. * Only P_WAIT and P_OVERLAY are currently implemented on MS-DOS.
  9. * Also contains the function argument declarations for all
  10. * process control related routines.
  11. *
  12. *Revision History:
  13. * 08/24/87 JCR Added P_NOWAITO
  14. * 10/20/87 JCR Removed "MSC40_ONLY" entries and "MSSDK_ONLY" comments
  15. * 12-11-87 JCR Added "_loadds" functionality
  16. * 12-18-87 JCR Added _FAR_ to declarations
  17. * 01-11-88 JCR Added _beginthread/_endthread
  18. * 01-15-88 JCR Got rid of _p_overlay for MTRHEAD/DLL
  19. * 02-10-88 JCR Cleaned up white space
  20. * 05-08-88 SKS Removed bogus comment about "DOS 4"; Added "P_DETACH"
  21. * 08-22-88 GJF Modified to also work for the 386 (small model only)
  22. * 09-14-88 JCR Added _cexit and _c_exit declarations
  23. * 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
  24. * 06-08-89 JCR 386 _beginthread does NOT take a stackpointer arg
  25. * 08-01-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
  26. * 10-30-89 GJF Fixed copyright
  27. * 11-02-89 JCR Changed "DLL" to "_DLL"
  28. * 11-17-89 GJF Added const attribute to appropriate arg types
  29. * 03-01-90 GJF Added #ifndef _INC_PROCESS and #include <cruntime.h>
  30. * stuff. Also, removed some (now) useless preprocessor
  31. * directives.
  32. * 03-21-90 GJF Replaced _cdecl with _CALLTYPE1 or _CALLTYPE2 in
  33. * prototypes.
  34. * 04-10-90 GJF Replaced remaining instances of _cdecl (with _CALLTYPE1
  35. * or _VARTYPE1, as appropriate).
  36. * 10-12-90 GJF Changed return type of _beginthread() to unsigned long.
  37. * 01-17-91 GJF ANSI naming.
  38. * 08-20-91 JCR C++ and ANSI naming
  39. * 08-26-91 BWM Added prototypes for _loaddll, unloaddll, and
  40. * _getdllprocaddr.
  41. * 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
  42. * 07-22-92 GJF Deleted references to _wait for Win32.
  43. * 08-05-92 GJF Function calling type and variable type macros.
  44. * 08-28-92 GJF #ifdef-ed out for POSIX.
  45. * 09-03-92 GJF Merged two changes above.
  46. * 01-21-93 GJF Removed support for C6-386's _cdecl.
  47. *
  48. ****/
  49. #ifndef _INC_PROCESS
  50. #ifndef _POSIX_
  51. #ifdef __cplusplus
  52. extern "C" {
  53. #endif
  54. #ifndef _INTERNAL_IFSTRIP_
  55. #include <cruntime.h>
  56. #endif /* _INTERNAL_IFSTRIP_ */
  57. /* modeflag values for _spawnxx routines */
  58. #ifndef MTHREAD
  59. extern int _CRTVAR1 _p_overlay;
  60. #endif
  61. #define _P_WAIT 0
  62. #define _P_NOWAIT 1
  63. #ifdef MTHREAD
  64. #define _P_OVERLAY 2
  65. #else
  66. #define _P_OVERLAY _p_overlay
  67. #endif
  68. #define _OLD_P_OVERLAY 2
  69. #define _P_NOWAITO 3
  70. #define _P_DETACH 4
  71. /* Action codes for _cwait(). The action code argument to _cwait is ignored
  72. on Win32 though it is accepted for compatibilty with OS/2 */
  73. #define _WAIT_CHILD 0
  74. #define _WAIT_GRANDCHILD 1
  75. /* function prototypes */
  76. #ifdef MTHREAD
  77. unsigned long __cdecl _beginthread (void (__cdecl *) (void *),
  78. unsigned, void *);
  79. void __cdecl _endthread(void);
  80. #endif
  81. void __cdecl abort(void);
  82. void __cdecl _cexit(void);
  83. void __cdecl _c_exit(void);
  84. int __cdecl _cwait(int *, int, int);
  85. int __cdecl _execl(const char *, const char *, ...);
  86. int __cdecl _execle(const char *, const char *, ...);
  87. int __cdecl _execlp(const char *, const char *, ...);
  88. int __cdecl _execlpe(const char *, const char *, ...);
  89. int __cdecl _execv(const char *, const char * const *);
  90. int __cdecl _execve(const char *, const char * const *, const char * const *);
  91. int __cdecl _execvp(const char *, const char * const *);
  92. int __cdecl _execvpe(const char *, const char * const *, const char * const *);
  93. void __cdecl exit(int);
  94. void __cdecl _exit(int);
  95. int __cdecl _getpid(void);
  96. int __cdecl _spawnl(int, const char *, const char *, ...);
  97. int __cdecl _spawnle(int, const char *, const char *, ...);
  98. int __cdecl _spawnlp(int, const char *, const char *, ...);
  99. int __cdecl _spawnlpe(int, const char *, const char *, ...);
  100. int __cdecl _spawnv(int, const char *, const char * const *);
  101. int __cdecl _spawnve(int, const char *, const char * const *,
  102. const char * const *);
  103. int __cdecl _spawnvp(int, const char *, const char * const *);
  104. int __cdecl _spawnvpe(int, const char *, const char * const *,
  105. const char * const *);
  106. int __cdecl system(const char *);
  107. #ifndef _WIN32_
  108. int __cdecl _wait(int *);
  109. #endif
  110. int __cdecl _loaddll(char *);
  111. int __cdecl _unloaddll(int);
  112. int (__cdecl * __cdecl _getdllprocaddr(int, char *, int))();
  113. #ifdef _DECL_DLLMAIN
  114. /*
  115. * Declare DLL notification (initialization/termination) routines
  116. * The preferred method is for the user to provide DllMain() which will
  117. * be called automatically by the DLL entry point defined by the C run-
  118. * time library code. If the user wants to define the DLL entry point
  119. * routine, the user's entry point must call _CRT_INIT on all types of
  120. * notifications, as the very first thing on attach notifications and
  121. * as the very last thing on detach notifications.
  122. */
  123. #ifdef _WINDOWS_ /* Use types from WINDOWS.H */
  124. BOOL WINAPI DllMain(HANDLE, DWORD, LPVOID);
  125. BOOL WINAPI _CRT_INIT(HANDLE, DWORD, LPVOID);
  126. #else
  127. #ifdef _M_IX86
  128. int __stdcall DllMain(void *, unsigned, void *);
  129. int __stdcall _CRT_INIT(void *, unsigned, void *);
  130. #else
  131. int DllMain(void *, unsigned, void *);
  132. int _CRT_INIT(void *, unsigned, void *);
  133. #endif
  134. #endif /* _WINDOWS_ */
  135. #endif /* _DECL_DLLMAIN */
  136. #if !__STDC__
  137. /* Non-ANSI names for compatibility */
  138. #define P_WAIT _P_WAIT
  139. #define P_NOWAIT _P_NOWAIT
  140. #define P_OVERLAY _P_OVERLAY
  141. #define OLD_P_OVERLAY _OLD_P_OVERLAY
  142. #define P_NOWAITO _P_NOWAITO
  143. #define P_DETACH _P_DETACH
  144. #define WAIT_CHILD _WAIT_CHILD
  145. #define WAIT_GRANDCHILD _WAIT_GRANDCHILD
  146. #ifndef _DOSX32_
  147. #define cwait _cwait
  148. #define execl _execl
  149. #define execle _execle
  150. #define execlp _execlp
  151. #define execlpe _execlpe
  152. #define execv _execv
  153. #define execve _execve
  154. #define execvp _execvp
  155. #define execvpe _execvpe
  156. #define getpid _getpid
  157. #define spawnl _spawnl
  158. #define spawnle _spawnle
  159. #define spawnlp _spawnlp
  160. #define spawnlpe _spawnlpe
  161. #define spawnv _spawnv
  162. #define spawnve _spawnve
  163. #define spawnvp _spawnvp
  164. #define spawnvpe _spawnvpe
  165. #ifndef _WIN32_
  166. #define wait _wait
  167. #endif
  168. #else
  169. int __cdecl cwait(int *, int, int);
  170. int __cdecl execl(const char *, const char *, ...);
  171. int __cdecl execle(const char *, const char *, ...);
  172. int __cdecl execlp(const char *, const char *, ...);
  173. int __cdecl execlpe(const char *, const char *, ...);
  174. int __cdecl execv(const char *, const char * const *);
  175. int __cdecl execve(const char *, const char * const *, const char * const *);
  176. int __cdecl execvp(const char *, const char * const *);
  177. int __cdecl execvpe(const char *, const char * const *, const char * const *);
  178. int __cdecl getpid(void);
  179. int __cdecl spawnl(int, const char *, const char *, ...);
  180. int __cdecl spawnle(int, const char *, const char *, ...);
  181. int __cdecl spawnlp(int, const char *, const char *, ...);
  182. int __cdecl spawnlpe(int, const char *, const char *, ...);
  183. int __cdecl spawnv(int, const char *, const char * const *);
  184. int __cdecl spawnve(int, const char *, const char * const *,
  185. const char * const *);
  186. int __cdecl spawnvp(int, const char *, const char * const *);
  187. int __cdecl spawnvpe(int, const char *, const char * const *,
  188. const char * const *);
  189. #ifndef _WIN32_
  190. int __cdecl wait(int *);
  191. #endif
  192. #endif
  193. #endif
  194. #ifdef __cplusplus
  195. }
  196. #endif
  197. #endif /* _POSIX_ */
  198. #define _INC_PROCESS
  199. #endif /* _INC_PROCESS */