home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / h.z / PROCESS.H < prev    next >
C/C++ Source or Header  |  1996-07-24  |  7KB  |  176 lines

  1. /*
  2.  *  process.h    Process spawning and related routines
  3.  *
  4.  *  Copyright by WATCOM International Corp. 1988-1996.  All rights reserved.
  5.  */
  6. #ifndef _PROCESS_H_INCLUDED
  7. #define _PROCESS_H_INCLUDED
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11.  
  12. #ifndef _COMDEF_H_INCLUDED
  13.  #include <_comdef.h>
  14. #endif
  15.  
  16. #ifndef _WCHAR_T_DEFINED
  17. #define _WCHAR_T_DEFINED
  18. #define _WCHAR_T_DEFINED_
  19. #ifdef __cplusplus
  20. typedef long char wchar_t;
  21. #else
  22. typedef unsigned short wchar_t;
  23. #endif
  24. #endif
  25.  
  26. /*
  27.  *  POSIX 1003.1 Prototypes
  28.  */
  29. _WCRTLINK extern int execl( const char *__path, const char *__arg0, ... );
  30. _WCRTLINK extern int execle( const char *__path, const char *__arg0, ... );
  31. _WCRTLINK extern int execlp( const char *__file, const char *__arg0, ... );
  32. _WCRTLINK extern int execv( const char *__path, const char *const __argv[] );
  33. _WCRTLINK extern int execve( const char *__path, const char *const __argv[], 
  34.                 const char *const __envp[] );
  35. _WCRTLINK extern int execvp( const char *__file, const char *const __argv[] );
  36.  
  37.  
  38. /* mode flags for spawnxxx routines */
  39. _WCRTLINK extern int __p_overlay;
  40.  
  41. #define P_WAIT        0
  42. #define P_NOWAIT    1
  43. #define P_OVERLAY   __p_overlay
  44. #define P_NOWAITO   3
  45.  
  46. /*
  47.  *  Prototypes for non-POSIX functions
  48.  */
  49.  
  50. _WCRTLINK extern int execlpe( const char *__file, const char *__arg0, ... );
  51. _WCRTLINK extern int execvpe( const char *__file, const char *const __argv[], 
  52.                   const char *const __envp[] );
  53.  
  54. #if defined(__386__) || defined(__AXP__) || defined(__PPC__)
  55. #if defined(__NT__)
  56. _WCRTLINK extern unsigned long _beginthread( 
  57.                 register void (*__start_address)(void *),
  58.         unsigned __stack_size, void *__arglist );
  59. _WCRTLINK extern unsigned long _beginthreadex( void *__security, 
  60.         unsigned __stack_size, 
  61.         register unsigned (__stdcall *__start_address)(void *),
  62.         void *__arglist, unsigned __initflag, unsigned *__thrdaddr );
  63. #pragma intrinsic(_beginthread,_beginthreadex);
  64. _WCRTLINK extern void _endthreadex( unsigned __retval );
  65. _WCRTLINK extern unsigned long __threadhandle( void );
  66. #else
  67. _WCRTLINK extern int  _beginthread( register void (*__start_address)(void *),
  68.    void *__stack_bottom, unsigned __stack_size, void *__arglist );
  69. #pragma intrinsic(_beginthread);
  70. #endif
  71. _WCRTLINK extern void _endthread();
  72. #else
  73. _WCRTLINK extern int _WCFAR  _beginthread( 
  74.     register void (_WCFAR *__start_address)(void _WCFAR *),
  75.     void _WCFAR *__stack_bottom, unsigned __stack_size, void _WCFAR *__arglist );
  76. #pragma intrinsic(_beginthread);
  77. _WCRTLINK extern void _WCFAR _endthread();
  78. #ifndef __SW_ZU
  79.   _WCRTLINK void _WCFAR *__chkstack( void _WCFAR * );
  80.   #define _beginthread( __sa, __sb, __ss, __al ) \
  81.         _beginthread( __sa, __chkstack(__sb), __ss, __al )
  82. #endif
  83. #endif
  84.  
  85. /* values for __action_code used with cwait() */
  86.  
  87. #define WAIT_CHILD 0
  88. #define WAIT_GRANDCHILD 1
  89.  
  90. _WCRTLINK extern int   cwait( int *__status, int __process_id, 
  91.                  int __action_code );
  92. _WCRTLINK extern int   _cwait( int *__status, int __process_id, 
  93.                  int __action_code );
  94. _WCRTLINK extern void  abort( void );
  95. _WCRTLINK extern void  exit( int __status );
  96. _WCRTLINK extern void  _exit( int __status );
  97. _WCRTLINK extern char *getcmd( char *__buffer );
  98. _WCRTLINK extern int   _bgetcmd( char *__buffer, int __len );
  99. _WCRTLINK extern char *_cmdname( char *__name );
  100. _WCRTLINK extern char *getenv( const char *__name );
  101. _WCRTLINK extern int   putenv( const char *__string );
  102. _WCRTLINK extern int   spawnl( int __mode, const char *__path, 
  103.                   const char *__arg0, ... );
  104. _WCRTLINK extern int   spawnle( int __mode, const char *__path, 
  105.                    const char *__arg0, ... );
  106. _WCRTLINK extern int   spawnlp( int __mode, const char *__path, 
  107.                    const char *__arg0, ... );
  108. _WCRTLINK extern int   spawnlpe( int __mode, const char *__path, 
  109.                 const char *__arg0, ... );
  110. _WCRTLINK extern int   spawnv( int __mode, const char *__path, 
  111.                   const char * const *__argv );
  112. _WCRTLINK extern int   spawnve( int __mode, const char *__path, 
  113.                    const char * const *__argv, 
  114.                    const char * const *__envp );
  115. _WCRTLINK extern int   spawnvp( int __mode, const char *__path, 
  116.                    const char * const *__argv );
  117. _WCRTLINK extern int   spawnvpe( int __mode, const char *__path, 
  118.                 const char * const *__argv, 
  119.                 const char * const *__envp );
  120. _WCRTLINK extern int   system( const char *__cmd );
  121.  
  122. _WCRTLINK extern wchar_t *  _wgetenv( const wchar_t *__name );
  123. _WCRTLINK extern int        _wsetenv( const wchar_t *__name,
  124.                       const wchar_t *__newvalue, 
  125.                       int __overwrite );
  126. _WCRTLINK extern int        _wputenv( const wchar_t *__env_string );
  127.  
  128. _WCRTLINK extern int    _wexecl( const wchar_t *__path, const wchar_t *__arg0, ... );
  129. _WCRTLINK extern int    _wexecle( const wchar_t *__path, const wchar_t *__arg0, ... );
  130. _WCRTLINK extern int    _wexeclp( const wchar_t *__file, const wchar_t *__arg0, ... );
  131. _WCRTLINK extern int    _wexecv( const wchar_t *__path, const wchar_t *const __argv[] );
  132. _WCRTLINK extern int    _wexecve( const wchar_t *__path, const wchar_t *const __argv[], 
  133.                   const wchar_t *const __envp[] );
  134. _WCRTLINK extern int    _wexecvp( const wchar_t *__file, const wchar_t *const __argv[] );
  135. _WCRTLINK extern int    _wexeclpe( const wchar_t *__file, const wchar_t *__arg0, ... );
  136. _WCRTLINK extern int    _wexecvpe( const wchar_t *__file, const wchar_t *const __argv[], 
  137.                    const wchar_t *const __envp[] );
  138. _WCRTLINK extern int    _wspawnl( int __mode, const wchar_t *__path, 
  139.                   const wchar_t *__arg0, ... );
  140. _WCRTLINK extern int    _wspawnle( int __mode, const wchar_t *__path, 
  141.                    const wchar_t *__arg0, ... );
  142. _WCRTLINK extern int    _wspawnlp( int __mode, const wchar_t *__path, 
  143.                    const wchar_t *__arg0, ... );
  144. _WCRTLINK extern int    _wspawnlpe( int __mode, const wchar_t *__path, 
  145.                     const wchar_t *__arg0, ... );
  146. _WCRTLINK extern int    _wspawnv( int __mode, const wchar_t *__path, 
  147.                   const wchar_t * const *__argv );
  148. _WCRTLINK extern int    _wspawnve( int __mode, const wchar_t *__path, 
  149.                    const wchar_t * const *__argv, 
  150.                    const wchar_t * const *__envp );
  151. _WCRTLINK extern int    _wspawnvp( int __mode, const wchar_t *__path, 
  152.                    const wchar_t * const *__argv );
  153. _WCRTLINK extern int    _wspawnvpe( int __mode, const wchar_t *__path, 
  154.                     const wchar_t * const *__argv, 
  155.                     const wchar_t * const *__envp );
  156. _WCRTLINK extern int    _wsystem( const wchar_t *__cmd );
  157.  
  158. #if defined(__NT__)
  159.  // For use when access to the DLL startup is required.
  160.  // this function pointer will be called after the C library startup
  161.  // and before the C++ library startup.
  162.  #if defined(_WINDOWS_)
  163.   extern BOOL (WINAPI *_pRawDllMain)( HANDLE, DWORD, LPVOID );
  164.  #else
  165.   extern int (__stdcall *_pRawDllMain)( void *, unsigned, void * );
  166.  #endif
  167. #endif
  168. _WCRTLINK extern int getpid( void );
  169. _WCRTLINK extern int wait( int *__status );
  170.  
  171.  
  172. #ifdef __cplusplus
  173. };
  174. #endif
  175. #endif
  176.