--- ray/src/common/rtprocess.h 2003/11/14 17:22:06 3.9 +++ ray/src/common/rtprocess.h 2016/03/06 01:13:17 3.16 @@ -1,4 +1,4 @@ -/* RCSid $Id: rtprocess.h,v 3.9 2003/11/14 17:22:06 schorsch Exp $ */ +/* RCSid $Id: rtprocess.h,v 3.16 2016/03/06 01:13:17 schorsch Exp $ */ /* * rtprocess.h * Routines to communicate with separate process via dual pipes @@ -9,27 +9,17 @@ #define _RAD_PROCESS_H_ #include -#ifdef _WIN32 +#include +#if defined(_WIN32) || defined(_WIN64) #include /* DWORD etc. */ - #include - typedef DWORD pid_t; + typedef DWORD RT_PID; #include /* getpid() and others */ - #define nice(inc) win_nice(inc) - - #ifdef __cplusplus - extern "C" { - #endif - extern FILE *win_popen(char *command, char *type); - extern int win_pclose(FILE *p); - #ifdef __cplusplus - } - #endif - - #define popen(cmd,mode) win_popen(cmd,mode) - #define pclose(p) win_pclose(p) + #define getpid _getpid + #define execv _execv #else - #include #include + #include + typedef pid_t RT_PID; #endif #include "paths.h" @@ -43,8 +33,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. */ @@ -64,19 +54,22 @@ 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 */ +#define close_process(pd) close_processes(pd,1) + extern int open_process(SUBPROC *pd, char *av[]); -extern int close_process(SUBPROC *pd); +extern int close_processes(SUBPROC pd[], int nproc); extern int process(SUBPROC *pd, char *recvbuf, char *sendbuf, int nbr, int nbs); extern int readbuf(int fd, char *bpos, int siz); extern int writebuf(int fd, char *bpos, int siz); -#ifdef _WIN32 +#if defined(_WIN32) || defined(_WIN64) /* any non-negative increment will send the process to IDLE_PRIORITY_CLASS. */ +extern int win_kill(RT_PID pid, int sig /* ignored */); extern int win_nice(int inc); #endif