13 |
|
#include <sys/types.h> |
14 |
|
#include <sys/wait.h> |
15 |
|
#include <fcntl.h> |
16 |
+ |
#include <stdlib.h> |
17 |
|
|
18 |
|
#include "rtprocess.h" |
19 |
+ |
#include "rtio.h" |
20 |
|
|
21 |
|
|
22 |
|
int |
25 |
|
char *av[] |
26 |
|
) |
27 |
|
{ |
26 |
– |
extern char *getpath(), *getenv(); |
28 |
|
char *compath; |
29 |
|
int p0[2], p1[2]; |
30 |
|
|
74 |
|
SUBPROC *pd |
75 |
|
) |
76 |
|
{ |
77 |
< |
int pid, status; |
77 |
> |
int status; |
78 |
|
|
79 |
|
if (!pd->running) |
80 |
|
return(0); |
80 |
– |
close(pd->r); |
81 |
|
close(pd->w); |
82 |
|
pd->running = 0; |
83 |
< |
if (waitpid(pd->pid, &status, 0) == pd->pid) |
83 |
> |
if (waitpid(pd->pid, &status, 0) == pd->pid) { |
84 |
> |
close(pd->r); |
85 |
|
return(status>>8 & 0xff); |
86 |
+ |
} |
87 |
|
return(-1); /* ? unknown status */ |
88 |
|
} |
89 |
|
|