X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:message-id:date:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=EVL qKpqwgtAKdk3YuZO+TGsKFivVVAso2h3D8OvUqLxfEtKy2/dnNhfhiBDzvvQxhHh 3WLTMajmkSI0rF4QXMTSYOCHqsFy85jeRlesIMepF4kk5zjalGTUNPLYlwLd6SF7 t2huwgU9L2w0NYH84hDY29xYDEqOe2btJbI0sj10= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:message-id:date:mime-version :content-type:content-transfer-encoding; s=default; bh=jiKiILir4 z5xCgGvwgsKfS/z6b8=; b=qO2GJFe26/DN7KdW0OQNgXdN471e+R5f1T7H0WT+D 9C3KvA9ollCR19GHME2AZjl5aojECmFx+23mk5XmAhKkApuo9BXUpu9fKdz5hpad mRUhVmFRvDUKueOMUUdItbtsHZZXlev18FV8l4lbHt5Uyf3BdmpNuE/CJVNdzSvM Ck= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,FROM_EXCESS_BASE64,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.1 spammy=k, act, HContent-Transfer-Encoding:8bit X-HELO: mail-wm1-f41.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:message-id:disposition-notification-to:date :user-agent:mime-version:content-language:content-transfer-encoding; bh=IxIVKz0J6P0v2hAlGYDV3qz6WpAR+QLftqnC8KD2Kes=; b=AlfZCA1aw7NzlnaxCRSAM5BSgqFZ2obD+b228RerJiFCqA0HH8LaT2RJHIpgaBY+T+ VhGBNihU+hcVYEB8gTrqOVq8NFA4KW2yNJfQ9kzQqOaDRAz1O+i3tj2jQplMhDMO5q7V pR4jvn5CDHefOla9UTVAyAcAYhijDrqXPppr41J5ah4djshSkd0PuItR0g3+Z9uqU76/ F2AMoIuNaq9IrXuAcDeWhHZ6lvesf4AuiLPavpf3kql5BETDov91OIfk19jtIjTvGAVy p5iF3LqysjuxD11+VUyayzDikdsnF+hR5Wbh1kfUM10AGv8zD2m/tvPKGYZkTiI5cfW0 g1eQ== From: =?UTF-8?B?UGV0ciBTa2/EjcOtaw==?= To: cygwin AT cygwin DOT com Subject: Re: uc_sigmask set in a sigaction signal handler not honored Message-ID: Date: Wed, 3 Apr 2019 16:39:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit > 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 Thanks for the feedback. > Would it suffice if the thread's signal mask is > changed to uc_sigmask when the signal function returns? That is the idea. It's what Linux and MacOS do. Petr Skocik -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple