Merging in 2.0.2.

This commit is contained in:
Geoffrey Challen
2017-01-09 22:37:50 -05:00
parent a0406ec181
commit 50cf3276e7
118 changed files with 1350 additions and 3158 deletions

View File

@@ -169,13 +169,16 @@ spawn(int njobs)
semcreate("1", &s1);
semcreate("2", &s2);
tprintf("Forking %d child processes...\n", njobs);
printf("Forking %d child processes...\n", njobs);
for (i=0; i<njobs; i++) {
pids[i] = fork();
if (pids[i] == -1) {
/* abandon the other procs; no way to kill them */
err(1, "fork");
/* continue with the procs we have; cannot kill them */
warn("fork");
warnx("*** Only started %u processes ***", i);
njobs = i;
break;
}
if (pids[i] == 0) {
/* child */
@@ -193,9 +196,9 @@ spawn(int njobs)
semopen(&s1);
semopen(&s2);
tprintf("Waiting for fork...\n");
printf("Waiting for fork...\n");
semP(&s1, njobs);
tprintf("Starting the execs...\n");
printf("Starting the execs...\n");
semV(&s2, njobs);
failed = 0;
@@ -219,7 +222,7 @@ spawn(int njobs)
warnx("%d children failed", failed);
}
else {
tprintf("Succeeded\n");
printf("Succeeded\n");
}
semclose(&s1);