--- ray/src/common/rtprocess.h 2003/11/11 16:24:06 3.8 +++ ray/src/common/rtprocess.h 2014/03/04 17:06:13 3.12 @@ -1,4 +1,4 @@ -/* RCSid $Id: rtprocess.h,v 3.8 2003/11/11 16:24:06 greg Exp $ */ +/* RCSid $Id: rtprocess.h,v 3.12 2014/03/04 17:06:13 greg Exp $ */ /* * rtprocess.h * Routines to communicate with separate process via dual pipes @@ -12,7 +12,7 @@ #ifdef _WIN32 #include /* DWORD etc. */ #include - typedef DWORD pid_t; + typedef DWORD RT_PID; #include /* getpid() and others */ #define nice(inc) win_nice(inc) @@ -21,14 +21,23 @@ #endif extern FILE *win_popen(char *command, char *type); extern int win_pclose(FILE *p); + int win_kill(RT_PID pid, int sig /* ignored */); + #define kill(pid,sig) win_kill(pid,sig) #ifdef __cplusplus } #endif - - #define popen(cmd,mode) win_popen(cmd,mode) - #define pclose(p) win_pclose(p) + #ifdef _MSC_VER + #define popen(cmd,mode) _popen(cmd,mode) + #define pclose(p) _pclose(p) + #else + #define popen(cmd,mode) win_popen(cmd,mode) + #define pclose(p) win_pclose(p) + #endif #else + #include #include + #include + typedef pid_t RT_PID; #endif #include "paths.h" @@ -42,8 +51,8 @@ extern "C" { This means that we shouldn't rely on PIDs and file descriptors being the same type, so we have to describe processes with a struct, - instead of the original int[3]. To keep things simple, we typedef - the posix pid_t on those systems that don't have it already. + instead of the original int[3]. For that purpose, we typedef a + platform independent RT_PID. */ @@ -63,7 +72,7 @@ typedef struct { int r; /* read handle */ int w; /* write handle */ int running; /* doing something */ - pid_t pid; /* process ID */ + RT_PID pid; /* process ID */ } SUBPROC; #define SP_INACTIVE {-1,-1,0,0} /* for static initializations */