Date: Tue, 17 Feb 1998 12:22:45 -0800 (PST) From: Doug White <dwhite@gdi.uoregon.edu> To: vel@ns.kbsu.ru Cc: questions@FreeBSD.ORG Subject: Re: Zombie processes Message-ID: <Pine.BSF.3.96.980217121703.12338K-100000@gdi.uoregon.edu> In-Reply-To: <199802171635.TAA01302@hub.kbsu.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 17 Feb 1998, Charlie wrote: > I have a small trouble with my program under FreeBSD. I do fork() to > create new process, and new process must do something and exit, but > parent process must continue. The simplest program looks like this: > > #include <stdio.h> > #include <unistd.h> > > main() > { > if (!fork()) > { > printf("This is child, exiting ...\n"); > return; > } > while(1); > } > > The created child process must write message and exit, but it doesn't exit > correctly. It hangs like "zombie" process until parent process exits. > > Why it happens ? Is there any way to solve or walk around this problem ? This is correct behavior for BSD programs. It's often not desired but correct in terms of the process model. If you want to reap children, add a signal handler for SIGCHLD to call wait(). Doug White | University of Oregon Internet: dwhite@resnet.uoregon.edu | Residence Networking Assistant http://gladstone.uoregon.edu/~dwhite | Computer Science Major To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980217121703.12338K-100000>