|
The bsd_signal() function provides a partially compatible interface for programs written to historical system interfaces (see USAGE below).
The function call bsd_signal(sig, func) has an effect as if implemented as:
|
void (*bsd_signal(int sig, void (*func)(int)))(int)
{
struct sigaction act, oact;
act.sa_handler = func;
act.sa_flags = SA_RESTART;
sigemptyset(&act.sa_mask);
sigaddset(&act.sa_mask, sig);
if (sigaction(sig, &act, &oact) == -1)
return(SIG_ERR);
return(oact.sa_handler);
}
|
The handler function should be declared:
where sig is the signal number. The behavior is undefined if func is a function that takes more than one argument, or an argument of a different type.
|