Guardian Programmer's Guide

Table Of Contents
Debugging, Trap Handling, and Signal Handling
Guardian Programmer’s Guide 421922-014
25 - 21
About Signals
Signals functions in the POSIX.1 standard. These are the signals functions
provided in the Open System Services (OSS) application program interface (API).
These functions are all available in C and most are available in pTAL.
HP signals extensions to the POSIX.1 standard. These procedures are written
especially for applications that focus on handling signals indicating conditions
known as traps in TNS processes. These procedures are available in pTAL and
in C.
About Signals
The following brief discussion provides basic POSIX.1 signal concepts and
terminology. It is intended to provide you with a framework to understand how to
handle signals in native Guardian processes. For more conceptual information, see
commercial texts on UNIX programming. For the specifics of the signals functions in
the OSS API, see the Open System Services System Calls Reference Manual and the
Open System Services Library Calls Reference Manual. For the specifics of the
procedures in the Guardian API, see the Guardian Procedure Calls Reference Manual.
Signal Generation, Delivery, and Actions
A signal is generated for a process when the event that causes the signal occurs.
When a signal is delivered to a process, an action for the signal is taken. During the
time between generation and delivery of a signal, the signal is pending.
A process can select one of three standard actions for most signals:
Let the default action apply. For most signals, the default action is to terminate the
process.
Ignore the signal. Delivery of the signal has no effect on the process. Some
signals, such as SIGSTOP, cannot be ignored.
Catch the signal. You supply a signal-catching function called a signal handler that
contains instructions to be executed when a particular signal occurs. Some
signals, such as SIGABEND, cannot be caught.
Blocking Signals
Each process has a signal mask that defines the set of signals currently blocked from
delivery to it. Signals that cannot be ignored cannot be blocked from delivery to a
process.
If the action associated with a blocked signal is anything other than to ignore the
signal, and if that signal is generated for the process, the signal remains pending until
the process either unblocks the signal or changes the action to ignore the signal.
If a blocked signal is generated for a process more than once before the process
unblocks the signal, it is discarded and only one instance of the signal remains