SIGSET(3J) UNIX Programmer's Manual SIGSET(3J) NAME sigset, signal, sighold, sigignore, sigrelse, sigpause - manage signals SYNOPSIS #include void action(); int action(); (_i_f _v_o_i_d _i_s _n_o_t _s_u_p_p_o_r_t_e_d) int sig; sigset(sig, action) signal(sig, action) sighold(sig) sigignore(sig) sigrelse(sig) sigpause(sig) cc ... -ljobs DESCRIPTION This is a package of signal management functions to manage the signals as described in _s_i_g_s_y_s(2J). These functions are not available in most versions of UNIX, and should not be used when the mechanisms of _s_i_g_n_a_l(2) would suffice, as they would then impair portability. These functions are con- tained in the _j_o_b_s library, obtained by specifying the loader option -ljobs. _S_i_g_s_e_t is used to provide a default signal handler for sig- nal _s_i_g. This function is remembered across subsequent calls to the other functions, and need not be specified again. After _s_i_g_s_e_t instances of _s_i_g will cause an interrupt to be taken at _f_u_n_c, with the signal then held so that recursive trapping due to the signal will not occur. During normal return from _f_u_n_c, the routines arrange for the signal action to be restored so that subsequent signals will also trap to _f_u_n_c. If a non-local exit is to be taken, then _s_i_g_r_e_l_s_e must be called to un-hold the signal action, restoring the origi- nal catch. _F_u_n_c may also be specified as SIG_DFL, SIG_IGN or SIG_HOLD, as described in _s_i_g_s_y_s(2J). The value speci- fied on the previous call to _s_i_g_s_e_t is returned; if _s_i_g_s_e_t has never been called, then the default action inherited from the system is returned. _S_i_g_n_a_l is like _s_i_g_s_e_t, but the signal will not be held when the action routine is called; rather it will have reverted to SIG_DFL. This is generally unsafe, but is included for backwards compatibility to the old signal mechanism. It should not be used. Printed 7/31/83 1 SIGSET(3J) UNIX Programmer's Manual SIGSET(3J) _S_i_g_h_o_l_d and _s_i_g_r_e_l_s_e may be used to block off _s_i_g in a piece of code where it cannot be tolerated. After _s_i_g_r_e_l_s_e the catch initially set with _s_i_g_s_e_t will be restored. _S_i_g_i_g_n_o_r_e can be used to temporarily set the action for _s_i_g to ignore the signal. If the signal had been held before the call to _s_i_g_i_g_n_o_r_e, any pending instance of the signal will be discarded. _S_i_g_p_a_u_s_e may be used by a routine which wishes to check for some condition produced at interrupt level by the _s_i_g sig- nal, and then to pause waiting for the condition to arise with the catch of the signal enabled. In correct usage it must be preceded by an instance of _s_i_g_h_o_l_d to block the sig- nal. _S_i_g_p_a_u_s_e is like _p_a_u_s_e in that it will return after _a_n_y signal is processed. The usual thing to do then is to reenable the hold with _s_i_g_h_o_l_d, check the condition again, and _s_i_g_p_a_u_s_e again if the condition has not arisen. SEE ALSO signal(2), sigsys(2J), intro(3J), tty(4) BUGS _S_i_g_h_o_l_d and _s_i_g_r_e_l_s_e do not nest; the first _s_i_g_r_e_l_s_e restores the default catch. These functions store information in data space. You thus must call _s_i_g_s_y_s(2J) rather than any of _s_i_g_s_e_t or _s_i_g_n_a_l after a _v_f_o_r_k(2) in the child which is to then _e_x_e_c. Printed 7/31/83 2