5
/* $Id: signals.c,v 1.3 2000-11-14 20:43:56 d3h325 Exp $ */
11
# include <sys/wait.h>
14
# include <sys/types.h>
20
# define SIG_ERR (RETSIGTYPE (*)(int))-1
24
RETSIGTYPE SigintHandler(int sig)
26
TCGMSG_caught_sigint = 1L;
27
Error("SigintHandler: signal was caught",0L);
32
* Trap the signal SIGINT so that we can propagate error
33
* conditions and also tidy up shared system resources in a
34
* manner not possible just by killing everyone
38
if ( signal(SIGINT, SigintHandler) == SIG_ERR)
39
Error("TrapSigint: error from signal setting SIGINT",(long) SIGINT);
44
* kill -SIGINT all of my beloved children
50
for (node=0; node<TCGMSG_nnodes; node++)
51
if (node != TCGMSG_nodeid)
52
(void) kill((int) TCGMSG_proc_info[node].pid, SIGINT);
56
RETSIGTYPE SigchldHandler(int sig)
61
TCGMSG_caught_sigint = 1;
62
Error("Child process terminated prematurely, status=",(long) status);
67
* Trap SIGCHLD so that can tell if children die unexpectedly.
71
if ( signal(SIGCHLD, SigchldHandler) == SIG_ERR)
72
Error("TrapSigchld: error from signal setting SIGCHLD", (long) SIGCHLD);