X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-9.6 required=5.0 tests=AWL,BAYES_00,KHOP_PGP_SIGNED,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Message-ID: <50E22B6C.5060409@redhat.com> Date: Mon, 31 Dec 2012 17:18:52 -0700 From: Eric Blake User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: sigprocmask issue OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig0C924982F1EED75B797B31EA" X-IsSubscribed: yes 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 --------------enig0C924982F1EED75B797B31EA Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I'm reporting this now because gnulib unit tests found a failure in stock cygwin 1.7.17, but I'm still investigating whether it is a regression, and/or whether it has been fixed by snapshots. This relatively simple test case asserts that SIGINT is never delivered as required. #include #include #include #include #include #include static volatile int sigint_occurred; static void sigint_handler (int sig) { sigint_occurred++; } int main (int argc, char *argv[]) { sigset_t set; pid_t pid =3D getpid (); char command[80]; signal (SIGINT, sigint_handler); sigemptyset (&set); sigaddset (&set, SIGINT); /* Check error handling. */ assert (sigprocmask (1729, &set, NULL) =3D=3D -1); assert (errno =3D=3D EINVAL); /* Block SIGINT. */ assert (sigprocmask (SIG_BLOCK, &set, NULL) =3D=3D 0); /* Request a SIGINT signal from outside. */ printf ("running \"sh -c 'sleep 1; kill -%d %d' &\"\n", SIGINT, (int) pid); sprintf (command, "sh -c 'sleep 1; kill -%d %d' &", SIGINT, (int) pid); assert (system (command) =3D=3D 0); /* Wait. */ puts ("waiting"); sleep (2); /* The signal should not have arrived yet, because it is blocked. */ assert (sigint_occurred =3D=3D 0); /* Unblock SIGINT. */ puts ("unblocking"); assert (sigprocmask (SIG_UNBLOCK, &set, NULL) =3D=3D 0); /* The signal should have arrived now, because POSIX says "If there are any pending unblocked signals after the call to sigprocmask(), at least one of those signals shall be delivered before the call to sigprocmask() returns." */ assert (sigint_occurred =3D=3D 1); return 0; } --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enig0C924982F1EED75B797B31EA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with undefined - http://www.enigmail.net/ iQEcBAEBCAAGBQJQ4ittAAoJEKeha0olJ0Nq0fYH/jMggUE6RVbnDhU06ULAEIsp K87bImSmRE3pnzBEDh96wyNT6FOjQqGtARuKBFNyYv0dl7Whh/jK77B87E99/dTy 1I8KKtuMcYLfjCcbLuH7h8KxbtyaX1GjyAhNO+nh6aXYTxCJrsz5ZigSYZTfVymW hicprL9MqRW05gkRbPn9bBaL1JUworXSk0+NpE3jbJHgmIKYj6F+a2rcDJ5OsStF MLgXbSMLBKEts4hMyvJni2J2BJZnl4kdvdAWWCYOX/rd6edf5infpo7rMxy0uijU 6HPamgxZILorkjkif7vBe/LQQeug069si31Acnxi5QSc/1mYjlao7GsAWtuZ/4Q= =tgQW -----END PGP SIGNATURE----- --------------enig0C924982F1EED75B797B31EA--