--- ray/src/common/rtprocess.h 2003/07/14 22:23:59 3.4 +++ ray/src/common/rtprocess.h 2004/01/28 12:42:22 3.10 @@ -1,4 +1,4 @@ -/* RCSid $Id: rtprocess.h,v 3.4 2003/07/14 22:23:59 schorsch Exp $ */ +/* RCSid $Id: rtprocess.h,v 3.10 2004/01/28 12:42:22 schorsch Exp $ */ /* * rtprocess.h * Routines to communicate with separate process via dual pipes @@ -11,10 +11,27 @@ #include #ifdef _WIN32 #include /* DWORD etc. */ - typedef DWORD pid_t; + #include + 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) #else + #include #include + #include + typedef pid_t RT_PID; #endif #include "paths.h" @@ -28,12 +45,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. - - Some older Windows systems use negative PIDs. Open_process() and - close_process() will convert those to positive values during - runtime, so that client modules can still use -1 as invalid PID. + instead of the original int[3]. For that purpose, we typedef a + platform independent RT_PID. */ @@ -53,7 +66,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 */ @@ -63,6 +76,11 @@ extern int close_process(SUBPROC *pd); 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 +/* any non-negative increment will send the process to IDLE_PRIORITY_CLASS. */ +extern int win_nice(int inc); +#endif #ifdef __cplusplus