SIGNAL(3F) UNIX Programmer's Manual SIGNAL(3F) NAME signal - change the action for a signal SYNOPSIS integer function signal(signum, proc, flag) integer signum, flag external proc DESCRIPTION When a process incurs a signal (see _s_i_g_n_a_l(2)) the default action is usually to clean up and abort. The user may choose to write an alternative signal handling routine. A call to _s_i_g_n_a_l is the way this alternate action is specified to the system. _S_i_g_n_u_m is the signal number (see _s_i_g_n_a_l(2)). If _f_l_a_g is negative, then _p_r_o_c must be the name of the user signal han- dling routine. If _f_l_a_g is zero or positive, then _p_r_o_c is ignored and the value of _f_l_a_g is passed to the system as the signal action definition. In particular, this is how previ- ously saved signal actions can be restored. Two possible values for _f_l_a_g have specific meanings: 0 means "use the default action" (See NOTES below), 1 means "ignore this sig- nal". A positive returned value is the previous action definition. A value greater than 1 is the address of a routine that was to have been called on occurrence of the given signal. The returned value can be used in subsequent calls to _s_i_g_n_a_l in order to restore a previous action definition. A negative returned value is the negation of a system error code. (See _p_e_r_r_o_r(3F)) FILES /usr/lib/libU77.a SEE ALSO signal(2), kill(3F), kill(1) NOTES f77 arranges to trap certain signals when a process is started. The only way to restore the default f77 action is to save the returned value from the first call to _s_i_g_n_a_l. When a user signal handling routine is called, UNIX resets the signal action definition to its original default value. Thus it is necessary to call _s_i_g_n_a_l(3F) from within the user signal handler in order to catch subsequent occurrences of the same signal. See _s_i_g_n_a_l(2) for a fuller explanation. If the user signal handler is called, it will be passed the signal number as an integer argument. Printed 7/31/83 1