Steps:
Fork and start process in a different program group
Stop process with SIGTSTP
Restart process with SIGCONT
Process ends
Problem: The SIGCHLD handler has:
waitpid(-1, &status, WNOHANG | WUNTRACED);
upon return pid=0 and WIFEXITED=1
so, the process exited, but I can't get the pid?
I need the pid.
From the man page: "if WNOHANG was specified and one or more child(ren) specified by pid exist, but have not yet changed state, then 0 is returned"
But it seems the status has changed to exited.