delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/08/15/01:37:23

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,KHOP_PGP_SIGNED,SPF_HELO_PASS,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <502B3567.9090808@dancol.org>
Date: Tue, 14 Aug 2012 22:36:39 -0700
From: Daniel Colascione <dancol AT dancol DOT org>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Another sigwaitinfo problem (with testcase)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--------------enig4C7DECCC182030B47AE561E6
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

When run on a Linux machine, this program starts up and blocks on sigwaitin=
fo.
You can suspend and resume the program using usual job control facilities, =
and
on SIGINT, the program prints a message and exits. When the program resumes
after being stopped, it prints "resumed".

With the 2012-08-07 Cygwin snapshot, this program prints "resumed" immediat=
ely
after receiving SIGTSTP, then fails to respond to any signal, even signals =
not
in the blocked set. A simpler test program that just calls "raise (SIGSTOP)"
property stops itself before resuming execution.

#define _GNU_SOURCE 1
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <pthread.h>

int
main()
{
    sigset_t waitmask;
    int sig;

    sigemptyset (&waitmask);
    sigaddset (&waitmask, SIGTSTP);
    sigaddset (&waitmask, SIGINT);
    sigprocmask (SIG_BLOCK, &waitmask, NULL);

    for (;;) {
        sig =3D sigwaitinfo (&waitmask, NULL);
        fprintf (stderr, "got %s\n", sys_siglist[sig]);
        if (sig =3D=3D SIGTSTP) {
            raise (SIGSTOP); /* Block until somebody resumes us. */
        } else if (sig =3D=3D SIGINT) {
            fprintf(stderr, "exiting");
            break;
        }
    }

    return 0;
}


--------------enig4C7DECCC182030B47AE561E6
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 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlArNWoACgkQ17c2LVA10Vt4FACfY8RK1y+2K5FI7VtJzpV33AcB
u8sAnjrPY9URb8D+WIvv66yVmI9FCirp
=t8r3
-----END PGP SIGNATURE-----

--------------enig4C7DECCC182030B47AE561E6--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019