Using the signal() function

The C signal() function call alters the actions that the global error table specifies will be taken for a given condition. You can use signal() to do the following:
  • Ignore the condition completely. You do this by specifying signal(sig_num,SIG_IGN), where sig_num represents the condition to be ignored. When the action for the condition is to ignore it, the condition is considered to be disabled. The condition will therefore not be seen.
    Note: Exceptions to this rule are the SIGABND condition and the system or user abend represented by Language Environment message number 3250. These are never ignored, even if you specify SIG_IGN in a call to signal().
  • Reset condition handling to the defaults shown in Table 1. Actions for handling a condition are implicitly reset to the system default when the condition is reported, but at times you need to explicitly reset condition handling. Specify signal(sig_num, SIG_DFL), where sig_num is the condition to be reset.
  • Call a signal handler to handle the condition. Specify signal(sig_num, sig_handler), where sig_num represents the condition to be handled, and sig_handler represents a pointer to the user-written function that is called when the condition occurs.

    The signal handler specified in signal() is given a chance to handle a condition only after any user-written handler established using CEEHDLR is invoked.