Scenario:
I'm developing a daemon monitoring application which starts and stops daemons on by request (TCP-IP).
To achieve that, after forking, I'm calling setsid()
in order to "detach" the new process from the parent (the monitoring process).
When I try to kill one of the processes the monitoring application created it ends up defuncted.
Here's my code:
int retval;
char* arg_list[] = {
NULL /* The argument list must end with a NULL. */
};
retval = fork();
if (retval == 0)
{
umask(0);
setsid();
execv(LBSDPATH, arg_list);
exit(0);
}
As I understand, defunct/zombie process means that the parent haven't joined with the process yet. don't setsid()
solve it ?