From: Doug Evans <dje@google.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] Don't immediately SIGTERM the child of "target remote |".
Date: Sun, 27 Nov 2011 22:23:00 -0000 [thread overview]
Message-ID: <CADPb22QegfZeLPZ9j1RXs4fPbn93Q_onv41OvhsUo9yPeoA6uw@mail.gmail.com> (raw)
In-Reply-To: <20111127204011.GA4606@host1.jankratochvil.net>
On Sun, Nov 27, 2011 at 12:40 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> 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.
The code was borrowed from remote-sim.c.
In this case I suspect it doesn't matter, but it's just as well to restore osa.
next prev parent reply other threads:[~2011-11-27 22:23 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
2011-11-27 22:23 ` Doug Evans [this message]
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=CADPb22QegfZeLPZ9j1RXs4fPbn93Q_onv41OvhsUo9yPeoA6uw@mail.gmail.com \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
/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