signal/bsd_signal
Roland McGrath
roland@frob.com
Wed Sep 6 14:02:00 GMT 2000
> What's the correct BSD behavior of signal? The current standard draft
> says that bsd_signal (what we also call signal) can be implemented
> with:
>
> void (*bsd_signal(int sig, void (*funct)(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);
> }
>
> This is basically what we habe except that we don't habe the
> sigaddset() call. Do we have to add it or not? Define signal and
> bsd_signal separately?
The 1003.l-1996 specification of sigaction makes that sigaddset call
redundant. The delivery of the signal uses a blocked signal set formed by
adding the signal (i.e. SIG) to the sa_mask set. The only observable
difference between having it or not is in what value
(sigaction(sig, 0, &oact), oact.sa_mask) has.
More information about the Libc-hacker
mailing list