<defunct> processes (was Re: Trouble killing processes in SysV/AT)

Dave Decot decot at hpisod2.HP.COM
Sat May 14 05:14:32 AEST 1988


> P.S. In response to all those that replied to my questions Re: <defunct>
> processes, I discover the solution is simple. After every fclose(fp), where
> fp is the FILE * I got from popen, I do a wait(&j), and the zombies go away.

I'm surprised nobody mentioned to you that the routine pclose() (and not
fclose()) is supposed to be called to close stdio streams obtained
from popen().

Among other things, pclose() calls wait() to pick up the status of the
finished process and get rid of the zombie.

Pclose() is usually documented on the same page as popen(), so I don't
understand how everybody could have missed this.

Dave Decot
Hewlett-Packard Company
decot%hpda at hplabs.hp.com



More information about the Comp.unix.wizards mailing list