| 12 |
|
#ifdef _WIN32 |
| 13 |
|
#include <windows.h> /* DWORD etc. */ |
| 14 |
|
#include <stdio.h> |
| 15 |
< |
typedef DWORD pid_t; |
| 15 |
> |
typedef DWORD RT_PID; |
| 16 |
|
#include <process.h> /* getpid() and others */ |
| 17 |
|
#define nice(inc) win_nice(inc) |
| 18 |
|
|
| 21 |
|
#endif |
| 22 |
|
extern FILE *win_popen(char *command, char *type); |
| 23 |
|
extern int win_pclose(FILE *p); |
| 24 |
+ |
int win_kill(RT_PID pid, int sig /* ignored */); |
| 25 |
+ |
#define kill(pid,sig) win_kill(pid,sig) |
| 26 |
|
#ifdef __cplusplus |
| 27 |
|
} |
| 28 |
|
#endif |
| 29 |
< |
|
| 30 |
< |
#define popen(cmd,mode) win_popen(cmd,mode) |
| 31 |
< |
#define pclose(p) win_pclose(p) |
| 29 |
> |
#ifdef _MSC_VER |
| 30 |
> |
#define popen(cmd,mode) _popen(cmd,mode) |
| 31 |
> |
#define pclose(p) _pclose(p) |
| 32 |
> |
#else |
| 33 |
> |
#define popen(cmd,mode) win_popen(cmd,mode) |
| 34 |
> |
#define pclose(p) win_pclose(p) |
| 35 |
> |
#endif |
| 36 |
|
#else |
| 37 |
|
#include <stdio.h> |
| 38 |
|
#include <sys/param.h> |
| 39 |
+ |
#include <sys/types.h> |
| 40 |
+ |
typedef pid_t RT_PID; |
| 41 |
|
#endif |
| 42 |
|
|
| 43 |
|
#include "paths.h" |
| 51 |
|
|
| 52 |
|
This means that we shouldn't rely on PIDs and file descriptors |
| 53 |
|
being the same type, so we have to describe processes with a struct, |
| 54 |
< |
instead of the original int[3]. To keep things simple, we typedef |
| 55 |
< |
the posix pid_t on those systems that don't have it already. |
| 54 |
> |
instead of the original int[3]. For that purpose, we typedef a |
| 55 |
> |
platform independent RT_PID. |
| 56 |
|
*/ |
| 57 |
|
|
| 58 |
|
|
| 72 |
|
int r; /* read handle */ |
| 73 |
|
int w; /* write handle */ |
| 74 |
|
int running; /* doing something */ |
| 75 |
< |
pid_t pid; /* process ID */ |
| 75 |
> |
RT_PID pid; /* process ID */ |
| 76 |
|
} SUBPROC; |
| 77 |
|
|
| 78 |
|
#define SP_INACTIVE {-1,-1,0,0} /* for static initializations */ |