Asynchronous signal delivery under z/OS UNIX

Your z/OS® UNIX application program might require its active processes to be able to react and respond to events occurring in the system or resulting from the actions of other processes communicating with its processes. One way of accomplishing such interprocess communication is for you to code your application program to identify signal conditions and determine how to react or respond when a signal condition is received from another application process.

Before you attempt to code your z/OS UNIX C/C++ application program to deliver and handle signals, you should identify all the processes that might cause signal conditions to be received by your application program's processes. You also need to know which signal condition codes are valid for your z/OS UNIX C/C++ application program and where the signal.h header file will be located and available to your application program. Your system programmer or the application program's designer should provide this information.
Note: Signal condition codes are defined in the signal.h include file.

A signal is a mechanism by which a process can be notified of, or affected by, an event occurring in the system. Examples of such events include hardware exceptions and specific actions by processes. The term signal also refers to an event itself.

The POSIX.1-defined sigaction() function allows a calling application process to examine a specific signal condition and specify the processing action to be associated with it.

You can code your application program to use the sigaction() function in different ways. Two simplistic examples of using signals within z/OS UNIX C/C++ application programs follow:

  1. A process is forked but the process is aborted if the signal handler receives an incorrect value.
  2. A request is received from a client process to provide information from a database. The server process is a single point of access to the database.

If coded properly for handling and delivering interprocess signals, your application program can receive signals from other processes and interpret those signals such that the appropriate processing procedure occurs for each specific signal condition received. Your application program also can send signals and wait for responses to signal handling events from other application processes. Note that signals are not the best method of interprocess communication, because they can easily be lost if more than one is delivered at the same time. You may want to use other methods of interprocess communication, such as pipes, message queues, shared memory, or semaphores.

For descriptions of the supported z/OS XL C/C++ signal handling functions, see z/OS XL C/C++ Runtime Library Reference.
Note: If your z/OS UNIX C/C++ application program calls a program written in a high-level language other than z/OS UNIX C/C++, you need to disable signal handling to block all signals from the z/OS UNIX C/C++ application program. If the called program encounters a program interrupt check situation, the results are unpredictable.