00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029
00030 #ifndef fileno
00031 extern int fileno(FILE *f);
00032 #endif
00033
00034
00035 extern FILE *fdopen(int fildes, const char *type);
00036
00037 #ifndef WIN_NT
00038 extern int kill(pid_t pid, int sig);
00039 #endif
00040 #ifdef _cplusplus
00041 }
00042 #endif
00043
00044 #ifdef WIN_NT
00045 #define PIPE(filedes_array) _pipe(filedes_array, 5*MAXBUFSIZE, _O_TEXT)
00046 #define WAIT(pid, status) _cwait(&status, pid, 0)
00047 #define KILL_FAILED(pid) !TerminateProcess((HANDLE) pid,-1)
00048 #else
00049 #define PIPE(filedes_array) pipe(filedes_array)
00050 #define WAIT(pid, status) waitpid(pid, &status, 0)
00051 #define KILL_FAILED(pid) kill(pid, SIGKILL) < 0
00052 #endif
00053
00054 #ifdef __cplusplus
00055 }
00056 #endif
00057
00058 #define FREE_PROC_TABLE_CELL(pid) ((pid < 0) \
00059 || ((process_status(pid) != RUNNING) \
00060 && (process_status(pid) != STOPPED)))
00061
00062
00063 #define PIPE_TO_PROC_FAILED -1
00064 #define PIPE_FROM_PROC_FAILED -2
00065 #define SUB_PROC_FAILED -3
00066
00067 #define MAX_SUBPROC_PARAMS 50
00068
00069 #define MAX_SUBPROC_NUMBER 40
00070
00071
00072 #define RUNNING 1
00073 #define STOPPED 2
00074 #define EXITED_NORMALLY 3
00075 #define EXITED_ABNORMALLY 4
00076 #define ABORTED 5
00077 #define INVALID 6
00078 #define UNKNOWN 7