C condition handling actions

In this section, the condition handling semantics of C-only applications are described as they relate to the Language Environment condition handling model. Condition handling for applications with both C and non-C routines is discussed in z/OS V2R1.0 Language Environment Writing Interlanguage Communication Applications.

If an exception occurs while a C routine is executing, the following activities are performed:

  1. The Language Environment enablement step of condition handling is entered.
    If the action defined for the exception is to ignore it for one of the following reasons, the condition is disabled. Execution continues at the next sequential instruction after the point where the condition occurred.
    • You have specified SIG_IGN in a call to the signal() function for any C condition except SIGABND or the system or user abend represented by the Language Environment message number 3250.
    • The exception is one of those listed as masked in Table 1.
    • You did not specify any action, but the default action for the condition is SIG_IGN (see Table 1).
    • You are running under CICS® and a CICS handler is pending.
  2. If SIG_IGN is not specified or defaulted for the exception, and the exception is not masked, the Language Environment condition step of condition handling is entered. These activities then occur:
    • If the debug tool is present, and the setting of the TEST runtime option indicates that it should be given control, it is invoked. See z/OS Language Environment Programming Reference for information about the TEST runtime option.
    • If the debug tool is not invoked, or does not handle the condition, any user-written condition handlers registered using CEEHDLR for that stack frame are invoked.
    • If no user-written condition handlers are registered for the condition that has occurred, and if you have registered a signal handler for the condition, that handler is invoked.
    • If the signal handler handles the condition, control returns to the routine in which the condition occurred. If the signal handler cannot handle the condition, it might force termination by issuing exit() or abort(), or might issue a longjmp().

      Condition handling can only continue after a signal handler gains control if you specify SIG_DFL in a call to signal(). If you do, the condition is percolated to the next user-written condition handler registered using CEEHDLR, or to the language-specific condition handler associated with the next stack frame.

    • If condition handlers at every stack frame have had a chance to respond to the condition and it still remains unhandled, the Language Environment default actions described in Table 1 take place.
    • If the Language Environment default action is to promote the condition to T_I_U (Termination Imminent due to an Unhandled condition), the termination imminent step of condition handling is entered.
  3. When the condition is promoted to T_I_U, Language Environment makes another pass of the stack looking for user-written condition handlers registered for T_I_U.

    If, on the next pass of the stack, no condition handler issued a resume or moved the resume cursor, Language Environment terminates the enclave.