IBM PASE for i Signal Handling

IBM PASE for i Signals and ILE Signals

OS/PASE signals and POSIX/ILE signals are independent, so it is not possible to directly call a handler for one signal type by raising the other type of signal. However, the Post an IBM® i PASE Signal (Qp2SignalPase) API can be used as the handler for any ILE signal to post a corresponding IBM PASE for i signal. An IBM PASE for i program can also define handlers for IBM PASE for i signals that call ILE procedures to post equivalent ILE signals. Program QP2SHELL and the IBM PASE for i fork function always setup handlers to map every ILE signal to a corresponding IBM PASE for i signal.


IBM i Messages and IBM PASE for i Programs

Many IBM i applications and system functions report errors with exception messages sent to program call message queues. See Message Handling Terms and Concepts for information about exception messages and program call message queues.

The system only creates program call message queues for ILE procedures and OMI programs. Any machine exception caused by an operation inside an IBM PASE for i program (such as MCH0601 for a storage reference error) is sent to the program call message queue for an (internal) ILE procedure in service program QP2USER. This ILE procedure is also the apparent caller of any ILE procedure the IBM PASE for i program calls directly (using _ILECALLX or _ILECALL), so any IBM i message the called procedure sends to its caller goes to the same message queue used for machine exceptions.


IBM i Exceptions and IBM PASE for i Signals

The ILE procedure in service program QP2USER that runs IBM PASE for i programs handles any exception and converts it to an IBM PASE for i signal, the same way POSIX/ILE C runtime converts exceptions to ILE signals. The specific signal used depends on the IBM i message identifier for the exception. IBM PASE for i and ILE use different signal numbers, but both map any specific message identifier to the same signal name (such as SIGSEGV). See WebSphere® Development Studio: ILE C/C++ Programmer's GuideLink to PDF for details.

An IBM PASE for i signal handler can determine whether a signal is associated with an exception message by inspecting field msgkey in the ucontext_t_os400 structure (declared in header file as400_types.h) that is passed as an argument to the handler. A non-zero value is the message reference key for the IBM i message that caused the signal. Zero indicates the signal is not associated with an IBM i message (which is always true for asynchronous signals). The IBM PASE for i program can use the message reference key to receive the exception message (see Receive Program Message for IBM PASE for i) for more details about the error.




[ Back to top | IBM PASE for i APIs | APIs by category ]