Mail Archives: cygwin/2012/12/31/19:19:15
--------------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 <signal.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
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--
- Raw text -