| 28 |
|
char *compath; |
| 29 |
|
int p0[2], p1[2]; |
| 30 |
|
|
| 31 |
< |
pd->pid = 0; |
| 31 |
> |
pd->pid = -1; |
| 32 |
|
pd->running = 0; /* not going yet */ |
| 33 |
|
|
| 34 |
|
if (av == NULL) /* cloning operation? */ |
| 92 |
|
if (nproc == 1) { /* await specific process? */ |
| 93 |
|
if (waitpid(pd->pid, &status, 0) != pd->pid) |
| 94 |
|
return(-1); |
| 95 |
< |
pd->pid = 0; |
| 95 |
> |
pd->pid = -1; |
| 96 |
|
return(status>>8 & 0xff); |
| 97 |
|
} |
| 98 |
|
/* else unordered wait */ |
| 99 |
|
while (togo > 0 && (pid = wait(&status)) >= 0) { |
| 100 |
|
for (i = nproc; i-- > 0; ) |
| 101 |
|
if (pd[i].pid == pid) { |
| 102 |
< |
pd[i].pid = 0; |
| 102 |
> |
pd[i].pid = -1; |
| 103 |
|
--togo; |
| 104 |
|
break; |
| 105 |
|
} |