zombie process remove without wait C
c, linux, unix
Solution
Simplest is to make SIGCHLD ignored in the parent:
signal(SIGCHLD, SIG_IGN);
After that, exiting child processes will just cleanly go away without needing to be waited on.
Note: This a bit of a quick&dirty approach, and assumes that you simply do not care about exit status of the child process, or about when it exits. If you do care, as you probably should in a real robust application, then see the other answer, about creating a proper signal handler function.
Addition: This is not universal in Unixes, but works at least on Linux. According to an UNIX FAQ, it is undefined behaviour in POSIX. This Mac OS X man page suggests that this behaviour was introduced in FreeBSD 5.0, and works on OS X, for example.
Problem
I've got a child process which just `exit(0)`. It became zombie. Is there way to remove it without `wait` or `waitpid` in parent process? ``` R+ ./server //parent R+ ./server //child Z+ (server) //child zombie ```