Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Doug Evans <dje@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] Don't immediately SIGTERM the child of "target remote |".
Date: Sun, 27 Nov 2011 20:40:00 -0000	[thread overview]
Message-ID: <20111127204011.GA4606@host1.jankratochvil.net> (raw)
In-Reply-To: <20111124000052.14DC12461B1@ruffy.mtv.corp.google.com>

On Thu, 24 Nov 2011 01:00:51 +0100, Doug Evans wrote:
[...]
> -      int status;
> -      kill (state->pid, SIGTERM);
> +      int rc, status;
> +      void (*ofunc) ();	/* Previous SIGALRM handler.  */
                        ^int (or void)
> +
> +      /* Don't kill the task right away, give it a chance to shut down cleanly.
> +	 But don't wait forever though.  */
> +#if defined (HAVE_SIGACTION) && defined (SA_RESTART)
> +      {
> +	struct sigaction sa, osa;
> +	sa.sa_handler = sigalrm_handler;
> +	sigemptyset (&sa.sa_mask);
> +	sa.sa_flags = 0;
> +	sigaction (SIGALRM, &sa, &osa);
> +	ofunc = osa.sa_handler;
> +      }
> +#else
> +      ofunc = (void (*)()) signal (SIGALRM, sigalrm_handler);
> +#endif
[...]
> +      alarm (0);
> +      signal (SIGALRM, ofunc);

You should restore OSA, not just OFUNC.


Thanks,
Jan


  parent reply	other threads:[~2011-11-27 20:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-24  0:01 Doug Evans
2011-11-24  0:09 ` Doug Evans
2011-11-24  3:57 ` Eli Zaretskii
2011-11-24  6:20   ` Doug Evans
2011-11-27 20:40 ` Jan Kratochvil [this message]
2011-11-27 22:23   ` Doug Evans
2011-12-01 19:46     ` [RFA] " Doug Evans
2011-12-01 19:50       ` Jan Kratochvil
2011-12-01 20:13         ` Doug Evans
2011-12-01 20:20           ` Jan Kratochvil
2011-12-14 21:17             ` Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111127204011.GA4606@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox