Re: fork()ing and SIGKILL and SIGSTOP
> On Dec 2, email@example.com (Adam Heath) wrote:
> > I am writing a program that listens on several ports, using fork() to
> > 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
> > implement this. I have tried signal(), and wait(), and neither will
> > 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
> "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
After I sent this, I got the bright idea to type "man kill" and discovered
this. Everything is now working the way I wanted it to. Now, I am going
to make it created a PID file for start-stop-daemon.
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-REQUEST@lists.debian.org . Trouble? e-mail to Bruce@Pixar.com