How to detect defunct processes on Linux?

Posted by Hakan on Stack Overflow See other posts from Stack Overflow or by Hakan
Published on 2010-03-29T15:26:41Z Indexed on 2010/03/29 15:43 UTC
Read the original article Hit count: 536

Filed under:
|
|
|

I have a parent and a child process written in C language. Somewhere in the parent process HUP signal is sent to the child. I want my parent process to detect if the child is dead. But when I send SIGHUP, the child process becomes a zombie. How can I detect if the child is a zombie in the parent process? I try the code below, but it doesn't return me the desired result since the child process is still there but it is defunct.

kill(childPID, 0);

One more question; can I kill the zombie child without killing the parent?

Thanks.

© Stack Overflow or respective owner

Related posts about c

    Related posts about signals