From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 84676 invoked by alias); 3 Apr 2019 09:28:02 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 84665 invoked by uid 89); 3 Apr 2019 09:28:02 -0000 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 Received: from mail-wr1-f49.google.com (HELO mail-wr1-f49.google.com) (209.85.221.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 03 Apr 2019 09:28:01 +0000 Received: by mail-wr1-f49.google.com with SMTP id r4so20330829wrq.8 for ; Wed, 03 Apr 2019 02:28:00 -0700 (PDT) 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== Return-Path: Received: from [10.0.0.1] ([91.139.110.250]) by smtp.googlemail.com with ESMTPSA id u189sm8426301wme.25.2019.04.03.02.27.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Apr 2019 02:27:57 -0700 (PDT) To: cygwin@cygwin.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, 03 Apr 2019 09:28:00 -0000 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 X-SW-Source: 2019-04/txt/msg00016.txt.bz2 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