This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: signal/bsd_signal


> 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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]