Running t_ptrace manually with the simplest possible code
shows the same problem:
--------------------------------------------
#include <err.h>
#include <unistd.h>
#include <sys/wait.h>
#include <stdio.h>
int main()
{
int i = fork();
if (i == -1)
err(1, "fork");
if (i == 0) {
execl("obj/t_ptrace" , "obj/t_ptrace", "-r", "6", (void *)0);
err(1, "execl");
}
int status;
int k;
while ((k = wait(&status)) > 0) {
printf("Process %d returned %d\n", k, status);
}
if (k < 0)
err(1, "wait");
}
-------------------------------------------------
hub$ obj/zoinx
Mark the parent process (PID 31116) a debugger of PID 40926
Mark the parent process (PID 31116) a debugger of PID 40926 again
Process 40926 returned 0
Process 40926 returned 0
zoinx: wait: No child processes
unless I'm missing something in how you're supposed to reap children ?...