9 /* #include <killme_after.h>
11 /* void killme_after(seconds)
12 /* unsigned int seconds;
14 /* The killme_after() function does a best effort to terminate
15 /* the process after the specified time, should it still exist.
16 /* It is meant to be used in a signal handler, as an insurance
17 /* against getting stuck somewhere while preparing for exit.
19 /* None. This routine does a best effort, damn the torpedoes.
23 /* The Secure Mailer license must be distributed with this software.
26 /* IBM T.J. Watson Research
28 /* Yorktown Heights, NY 10598, USA
37 /* Utility library. */
39 #include <killme_after.h>
41 /* killme_after - self-assured death */
43 void killme_after(unsigned int seconds
)
45 struct sigaction sig_action
;
48 * Schedule an ALARM signal, and make sure the signal will be delivered
49 * even if we are being called from a signal handler and SIGALRM delivery
53 sigemptyset(&sig_action
.sa_mask
);
54 sig_action
.sa_flags
= 0;
55 sig_action
.sa_handler
= SIG_DFL
;
56 sigaction(SIGALRM
, &sig_action
, (struct sigaction
*) 0);
58 sigaddset(&sig_action
.sa_mask
, SIGALRM
);
59 sigprocmask(SIG_UNBLOCK
, &sig_action
.sa_mask
, (sigset_t
*) 0);