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:to:from:subject:message-id:date:mime-version :content-type:content-transfer-encoding; q=dns; s=default; b=pRL 0TQ0eEJM1LcCbE1sty8f0YCtYv3BQaw1QQrHbs8YH68rGHz6r8NzSc1/sLJ6JId3 XGpec5IQWNeiRy5WeFNwXQQiBstkUq1/Xz10OA0EMcyTBHPCn+jjkhn++4W/3e/R 7Fv9jBj/AK/sVnb07o3PeBJMcP0DCLatQe5mFKx0= 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:to:from:subject:message-id:date:mime-version :content-type:content-transfer-encoding; s=default; bh=NMqpnoh5F ZzZwI34Te/PosTmNZA=; b=BVvDHEoIE3fElWZ+tEHPm5ev7DtMIrnyuM1RRFcgi SwFNUhQ6mVZuwN8XmcnE1R1CRc+3axg7IkC0G7lMdZXvaMZDy1xDedg4S70mwbwM Yu+MYPQpGWBDjjR/YKj2oFFVfnARqnEHW9iqe27X2sCrUxd1cDfKA5L2zz+6IpUR kM= 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=HX-Google-Smtp-Source:APXvYqz, act X-HELO: mail-wr1-f49.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:disposition-notification-to:date :user-agent:mime-version:content-language:content-transfer-encoding; bh=mdmfTucob7U58RIJQK0XK9gCzww2l9NTZFkuQDvyRVM=; b=hcqbcj2tRRldmmi7PCJuJCMN1P5awePhzCaVPlgzRw5jLZY379pC8M0dETdVruBTcq iiweM2ki2q0NW0wOC+R8li2TmWomoum52RopKUrD0iPVh7Oay+dwdns7DNkp2LevPI0y k4jit/+8+axKtViICu+BXFXttwn8rX2IXhtdZjAcEB9aB+H9GKu1T3ditAh0hfieqmBf QZwjjjr+f+Q1ad3CnS3K80t6+5JcH2G5huBcccFUL2oPSf6b0tq+jVvuokyN0WYjnQ+T drLkZadw5wQeCC3LYS7r23eRpzWzUsOFe1Nt206j8GYrn7evTnyru0vb2NPCZqDoW1Wc 9sLQ== To: cygwin AT cygwin DOT com From: =?UTF-8?B?UGV0ciBTa2/EjcOtaw==?= Subject: uc_sigmask set in a sigaction signal handler not honored Message-ID: <366918d8-b505-45be-dc28-303579f17341@gmail.com> Date: Wed, 3 Apr 2019 11:27:56 +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: 7bit 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: #include #include #include #include #include void prmask(void) { sigset_t mask; pthread_sigmask(SIG_SETMASK,0,&mask); for(int i=1; i<=64; i++){ printf("%d", sigismember(&mask,i)); } puts(""); } void act(int Sig, siginfo_t *Info, void *Uctx) { ucontext_t *uctx = Uctx; sigfillset(&uctx->uc_sigmask); } int main() { struct sigaction sa; sa.sa_sigaction = act; sa.sa_flags = SA_SIGINFO; sigfillset(&sa.sa_mask); prmask(); sigaction(SIGINT,&sa,0); sigaction(SIGALRM,&sa,0); if(1) setitimer(ITIMER_REAL,&(struct itimerval){.it_value={.tv_usec=10000}},0); pause(); prmask(); } I think this is a bug, so I'm reporting it. Do you think it can be fixed in the near future? Best regards, 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