hello everybody!
Is there any way to identify if a process is defunct or if it is still running? (in C).
for example: by using a signal such as SIGCHLD?
thanx in advance
The easiest way to check if a process/child is a zombie/defunct is to read almost any entry from /proc/PID/.
If you read /proc/pid/status you will see
Name: defunct
State: Z (zombie)
/proc/pid/stat will be:
PID (defunct) Z ...
reads to /proc/pid/mem will fail
cwd, root and exe symbolic links will be broken.
cmdline will be empty.
Choose one.