[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: fork()/exec() dumping
- From: "Michael J. Hammel" <mjhammel graphics-muse org>
- To: gtk-app-devel-list redhat com
- Subject: Re: fork()/exec() dumping
- Date: Tue, 22 Jun 1999 14:51:12 -0600 (MDT)
Thus spoke Erik Mouw
> > using the regular fork() and exec() to execute the other application
>
> This is becoming a FAQ. Never mind, here we go again:
> /* child code */
> system("nxterm -T 'Alloc' -n KMan -e man /usr/man/man3/Alloc.3");
> _exit(0); /* note the use of _exit() instead of exit();
But this is different than fork'ing and exec'ing. system() returns to the
child and leaves exiting a responsibility of the child. exec'ing never
returns. I haven't tried this yet, but according to the original post the
problem was with exec'ing another program. There shouldn't be any problems
with exec'ing, should there?
> /* parent code: just wait for the child to exit */
> /* you can also install a signal handler for SIGCHLD */
> waitpid(pid, &status, WUNTRACED); /* anti zombie */
You don't want to wait on the child if you exec(). You should do a SIG_IGN
for children that call exec() or you'll end up with zombies.
--
Michael J. Hammel | We need somebody who can work
The Graphics Muse | independently and innovatively in the
mjhammel@graphics-muse.org | face of unreasonable demands."
http://www.graphics-muse.org Job posting at Stanford CS Department
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]