Guardian Programmer's Guide

Table Of Contents
Debugging, Trap Handling, and Signal Handling
Guardian Programmer’s Guide 421922-014
25 - 33
Examples
information provided in sig_contextP.
7. Unblocks all signals by clearing the process signal mask
in the jump buffer using the SIGJMP_MASKSET_() function.
8. Restores the process execution context (including the
process signal mask) and jumps to the location established
by the call to setjmp(), using the siglongjmp() function.
9. Restores the signal-handling state in globalHandler(),
which was installed by SIGACTION_INIT_() and saved by
SIGACTION_SUPPLANT_(), using the SIGACTION_RESTORE_()
function. */
#include <tdmsig.h> nolist
#include <setjmp.h> nolist
#include <histry.h> nolist
#include <stdio.h> nolist
#include <stdlib.h> nolist
jmp_buf jmpEnv;
sigjmp_buf sigJmpEnv;
void localHandler /* local signal handler for "worker" */
( int signo /* signal number */
, siginfo_t * siginfo /* NULL */
, void * sig_contextP /* pointer to saved process */
)
{
NSK_histWorkspace hws;
int error;
char buf [80];
printf ("localHandler: Signal %d occurred\n", signo);
/* Use HIST_FORMAT_() to produce an ASCII text
representation of the process execution context for the
process indicated by HIST_INIT() or HIST_GETPRIOR_(). */
error = HIST_INIT_ (&hws, HistVersion1, HO_Init_uContext,
sig_contextP);
if (error == HIST_OK)
do {
int len;
while ((len = HIST_FORMAT_ (&hws, buf, 79)) > 0) {
buf[ len ] = 0;
printf ("%s\n", buf);