uc_sigmask set in a sigaction signal handler not honored
Corinna Vinschen
corinna-cygwin@cygwin.com
Wed Apr 3 12:43:00 GMT 2019
On Apr 3 14:15, Corinna Vinschen wrote:
> On Apr 3 11:27, Petr Skočík wrote:
> > Hi. Correct me if I'm wrong but POSIX appears to define
> >
> > https://pubs.opengroup.org/onlinepubs/7908799/xsh/ucontext.h.html
> >
> > as, among other things, containing the field:
> >
> > sigset_t uc_sigmask the set of signals that are blocked when this
> > context is active
> >
> > and it also specifies that the third argument to a .sa_sigaction
> > signal handler is a ucontext_t* cast to void*.
> >
> > So it should follow that doing
> >
> > void act(int Sig, siginfo_t *Info, void *Uctx)
> > {
> > ucontext_t *uctx = Uctx;
> > sigfillset(&uctx->uc_sigmask);
> > }
> >
> > from a signal handler should alter the signal mask of the thread the
> > signal ran on.
> >
> > This is how Linux and MacOS behave, but not CygWin, as the following
> > program shows:
>
> What you're asking for is really complicated.
>
> The context given to act is the context at the time the signal function
> is called. In Cygwin (lower case w) this is a copy of the context.
>
> sigfillset() has not the faintest clue where this context comes from, it
> just sets the signal mask value without taking any further action.
>
> There are no provisions to control if the called function changes the
> context, other than via setcontext / swapcontext, and I don't see that
> POSIX requires anything else. Both functions change the current
> thread's sigmask according to the value of uc_sigmask.
Or maybe I'm just dumb. Would it suffice if the thread's signal mask is
changed to uc_sigmask when the signal function returns?
Corinna
--
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20190403/158d360a/attachment.sig>
More information about the Cygwin
mailing list