Discussion:
Lingering defunct process after using execl on 5.0.6. Need help!
(too old to reply)
Philippe Hamel
2003-10-23 15:04:53 UTC
Permalink
Hi all.

Here's the call

##########################################################################
pid_t pid;

if ( ( pid = fork() ) < 0 )
{
printf("failed\n");
}
else
{
if ( !pid )
{
execl("execname", "execname", strVar1, strVar2, strVar3,
strVar4, NULL);
}
}

#############################################################################

I'm running this on OpenServer 5.0.6, compiled with gcc, here's the
version

# gcc -v
Reading specs from /usr/local/lib/gcc-lib/i386-pc-sco3.2v5.0.5/2.95.2/specs
gcc version 2.95.2 19991024 (release)


Everything runs fine, but when the child process is done, there's
always a "defunct" process left. And they add up and end up eating a
lot of ressources.

How do I fix that?

Thank you!

Philippe
John DuBois
2003-10-23 19:42:01 UTC
Permalink
Post by Philippe Hamel
Everything runs fine, but when the child process is done, there's
always a "defunct" process left. And they add up and end up eating a
lot of ressources.
How do I fix that?
Either wait for the child process in the parent or ignore SIGCHLD in the
parent. See the wait(S), waitpid(S), signal(S), signal(M), and sigaction(S)
man pages.

John
--
John DuBois ***@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/
Loading...