Guardian Procedure Calls Reference Manual
Handler Considerations
• The handler parameter must be one of these:
The address of an untyped native procedure that accepts these three parameters. These
parameters are passed to the handler by the system when the handler is invoked to catch
a signal:
◦
– SIGNUM
An INT(32) numeric value indicating the signal that caused the handler to be invoked.
– SIGINFO
A pointer whose value is currently NULL.
– UCONTEXT
A pointer to a structure of type UCONTEXT_T. It contains information regarding the
process context when the signal occurred. You can pass this pointer to the HIST_INIT_
procedure to get diagnostic information.
◦ (sighandler3_t)SIG_DFL
Causes default signal handling to be installed.
◦ (sighandler3_t)SIG_ABORT
Causes the process to be abnormally terminated when a signal occurs.
NOTE: This action is similar to calling ARMTRAP(-1,-1) for a TNS Guardian process.
◦ (sighandler3_t)SIG_DEBUG
Causes the process to enter debug mode when a signal occurs.
The typecast (sighandler3_t) is required because the SIG_DFL, SIGABORT and SIG_DEBUG
constants are defined for use with the OSS functions signal() and sigaction(), which
utilize a function pointer to a signal handler with only one parameter. The type
sighandler3_t is defined in tdmsig.h beginning with the H06.21 and J06.10 RVUs. For
earlier releases, you can declare sighandler_t locally:
typedef void (*sighandler3_t)(int, siginfo_t *, void *);
Alternatively, you can spell out the function pointer in the typecast, for example:
(void(*)(int,siginfo_t*,void*))SIG_DEBUG
Without the typecast, the TNS/R or TNS/E native C or C++ compiler issues a warning or an
error, respectively.
NOTE: The SIG_ABORT and SIG_DEBUG options are HP extensions to the POSIX.1 standard.
• If the signal was generated as a nondeferrable signal, the signal handler should not execute
a simple return; otherwise, process termination results. You must exit the signal handler using
either the SIGLONGJMP_ or LONGJMP_ procedure. SIGLONGJMP_ is preferred, because it
restores the signal mask that was saved by the corresponding SIGSETJMP_ procedure, so your
process can receive multiple occurrences of the same nondeferrable signal. LONGJMP_ does
not restore the signal mask; therefore the signal that was handled remains blocked.
For a deferrable signal, the signal handler can simply return, causing process execution to
resume where it was preempted by the signal.
1364 Guardian Procedure Calls (S)