I got the PID of a process and I need to check if it is a zombie using POSIX system calls in C. How should I do that?
The problem I'm having is that I have a process and it forks into many children, the children all do execs and sometimes I want to do the exec in background so I can't really wait() the children that go in background. I could wait() periodically (once in my main loop) but I need to know which processes are zombie so my father process doesn't hang while waiting for children that are not going to end soon.
If you are curious, I'm building a unix shell and it is in the shell nature to have the children processes behaving asynchronously.