signal

Allows you to specify the way in which the signal sig is to be handled: use the default handling for the signal, ignore the signal, or call the signal handler at the address specified.

Format

#include  <signal.h>

void  (*signal (int sig, void (*func) (int)))
      (int);

Arguments

sig
The number or mnemonic associated with a signal. This argument is usually one of the mnemonics defined in the <signal.h> header file.
func
Either the action to take when the signal is raised, or the address of a function needed to handle the signal.

Description

If func is the constant SIG_DFL, the action for the given signal is reset to the default action, which is to terminate the receiving process. If the argument is SIG_IGN, the signal is ignored. Not all signals can be ignored.

If func is neither SIG_DFL nor SIG_IGN, it specifies the address of a signal-handling function. When the signal is raised, the addressed function is called with sig as its argument. When the addressed function returns, the interrupted process continues at the point of interruption. (This is called catching a signal. Signals are reset to SIG_DFL after they are caught, except as shown in Chapter 4.)

You must call the signal function each time you want to catch a signal.

See Section 4.2 for more information on signal handling.

To cause a OpenVMS exception or a signal to generate a UNIX style signal, user OpenVMS condition handlers must return SS$_RESIGNAL upon receiving any exception that they do not want to handle. Returning SS$_CONTINUE prevents the correct generation of a UNIX style signal. See Chapter 4 for a list of OpenVMS exceptions that correspond to UNIX signals.

Return Values
The address of the function previously established to handle the signal. 
SIG_ERR  Indicates that the sig argument is out of range. 


Previous Page | Next Page | Table of Contents | Index