07-17-05 01:47 AM
In article <pan.2005.07.16.02.00.11.544713@ioplex.com>,
Michael B Allen <mba2000@ioplex.com> wrote:
> In the signal handler for my daemon processes I want to kill all processes
> when I get SIGQUIT. Currently I catch SIGQUIT and issue:
>
> kill(-process_group, SIGABRT);
>
> However this requires that I know the process group value. Is there
> a sure-fire way to get the process group id from within a signal
> handler? Would the following be suitable?
The top-most process of the daemon should establish itself as the
process group leader, so process_group == PID.
>
> killpg(0, SIGABRT);
Yes, that should work as well. 0 means to send to the current process's
group.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
[ Post a follow-up to this message ]
|