signal()

Syntax
  #include <signal.h>

  
  _sig_func signal(int sig, _sig_func handler);

  
Description

signal() defines how the application shall respond to the sig signal. The various responses are given in the following table.

Table 1. Various responses to the signal() function's input signal
Handler Response to the signal
SIG_IGN The signal is ignored.
SIG_DFL The default response ( HALT).
a function The function is called with sig as parameter.

The signal handling function is defined as:

  typedef void (*_sig_func)(int sig); 
  

The signal can be raised using the raise() function. Before the handler is called, the response is reset to SIG_DFL.

In the CodeWarrior IDE, there are only two signals: SIGABRT indicates an abnormal program termination, and SIGTERM a normal program termination.

Return

If signal succeeds, it returns the previous response for the signal; otherwise it returns SIG_ERR and sets errno to a positive non-zero value.

See also

raise()