Initial fix of upstream merge.

This commit is contained in:
Geoffrey Challen
2017-02-09 10:09:30 -05:00
42 changed files with 828 additions and 74 deletions

View File

@@ -152,12 +152,20 @@ void
test(int nowait)
{
int pid0, pid1, pid2, pid3;
int depth = 0;
/*
* Caution: This generates processes geometrically.
*
* It is unrolled to encourage gcc to registerize the pids,
* to prevent wait/exit problems if fork corrupts memory.
*
* Note: if the depth prints trigger and show that the depth
* is too small, the most likely explanation is that the fork
* child is returning from the write() inside putchar()
* instead of from fork() and thus skipping the depth++. This
* is a fairly common problem caused by races in the kernel
* fork code.
*/
/*
@@ -184,18 +192,37 @@ test(int nowait)
pid0 = dofork();
nprintf(".");
write(fd, "A", 1);
depth++;
if (depth != 1) {
warnx("depth %d, should be 1", depth);
}
check();
pid1 = dofork();
nprintf(".");
write(fd, "B", 1);
depth++;
if (depth != 2) {
warnx("depth %d, should be 2", depth);
}
check();
pid2 = dofork();
nprintf(".");
write(fd, "C", 1);
depth++;
if (depth != 3) {
warnx("depth %d, should be 3", depth);
}
check();
pid3 = dofork();
nprintf(".");
write(fd, "D", 1);
depth++;
if (depth != 4) {
warnx("depth %d, should be 4", depth);
}
check();
/*