On Fri, Apr 11, 2008 at 4:08 AM, Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx> wrote: > Hi... > > > On Thu, Apr 10, 2008 at 8:47 PM, black hole <neyrith@xxxxxxxxx> wrote: > > Hi, > > > > I want to solve the following situation in a better way than > > it is currently solved. I have come into a conclusion that > > the proper solution might actually involve kernel patch. > > I would like to discuss it here. > > > > Situation: > > I spawn several processes. I want this group of processes > > to terminate when any one of them terminates (dies, > > or just exits). > > > > A few of these processes are third party binaries. > > That programmatically only leaves me with the signal API > > Hmmm, sure you have to do it via kernel space? why not just create a > script that parse "ps" or "top" output for the PIDs and send all of > these processes SIGKILL or SIGTERMs? This also works but gives you a race condition. An instance to be killed can already be dead when you actually send a signal to its PID. You could kill a process you don't intend to. > strace...or maybe systemtap, could also be useful here. Trap do_fork() > or exec()...check the command name and collect the PIDs... the > details are left for your exercise :) That's an interesting point. Fortunately, the third party binaries do not create children (so far), therefore I don't have to do this. Also, I think I remember that a nasty binary can check if it is being strace-d and decide not to execute because of that. -bh- -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ