On Dec 2, [EMAIL PROTECTED] (Adam Heath) wrote: > I am writing a program that listens on several ports, using fork() to start > a separate thread for each port. I want to be able to kill each of the > child processes when the master parent terminates. I do not know how to > implement this. I have tried signal(), and wait(), and neither will allow > trapping of SIGKILL and SIGSTOP. I have registered a function with > atexit(), and that is not run either.
Neither SIGKILL or SIGSTOP can be caught -- otherwise you could write a program that couldn't be stopped without rebooting. > I know this can be done, because when PPPD is started, and I issue the > command "kill <PPPD pid>", PPPD runs the disconnect script before quitting. "kill <pid>" sends SIGTERM, which is probably what you are looking for. The general concept would be for the master to keep track of all of the child pids, and then when receiving SIGTERM, kill the children (kill()), and then wait for them to terminate (wait() or waitpid()). Steve Greenland -- The Mole - I think, therefore I scream "Addison, what are we going to do?" "Me, I'm examining the major Western religions. I'm looking for something that's soft on morality, generous with holidays, and has a short initiation period." [Dave and Maddie on Moonlighting] -- TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to [EMAIL PROTECTED] . Trouble? e-mail to [EMAIL PROTECTED]