On Mon, 2004-08-16 at 12:50, Dirk Meyer wrote: > Now you got me. What are process groups? My knowledge says: when a > child dies, the kernel sends SIGCHILD to the parent. The parent than > should 'wait' for it to remove the zombie process. If a process dies, > all children are now children of process 1 (init). So how can you get > information when a child of your child dies? Only your child gets > this. Your knoledge is correct unless you set a process group (also called group with a process leader).
Quoting unix man page: "Process groups are used for distribution of signals "... "If a session has a controlling terminal, CLOCAL is not set and a hangup occurs, then the session leader is sent a SIGHUP. If the session leader exits, the SIGHUP signal will be sent to each process in the foreground process group of the controlling terminal." So, all Freevo has to do is to set a process group being the process leader the helper child spwaned. Everything else is done by unix core libs (or kernel, don't really know). So, with this method, Freevo doesn't even have to know about existing subchilds. > How can any process know of a child pid of a child (without searching > the process structure in /proc)? I suppose it searches /proc, but it is done by unix libs, no need for Freevo to get involved :) > But if the child dies, the parent of the subchild is init. Since you > don't know about the subchild, you don't get termination > notification. Well, yes for normal operations. We have two scenarios, first, if you don't kill anything, the child will wait for the subchild to die and all goes well. Two, you need to kill the child; if process group is defined then the signal will be sent to subchild, both will die and no process will be orphan. Also, everything goes well. The missing line in Freevo that sets the process group is the following: (in class Popen4 before execvp) os.setpgid(0, os.getpid()) -- Bruno ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ Freevo-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freevo-devel
