All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>
Subject: Re: [Qemu-devel] [PULL v4 8/9] io: add QIOChannelCommand class
Date: Fri, 8 Jan 2016 09:59:49 +0100	[thread overview]
Message-ID: <568F7A85.4080409@redhat.com> (raw)
In-Reply-To: <1450441266-543-9-git-send-email-berrange@redhat.com>



On 18/12/2015 13:21, Daniel P. Berrange wrote:
> +#ifndef WIN32
> +static int qio_channel_command_abort(QIOChannelCommand *ioc,
> +                                     Error **errp)
> +{
> +    pid_t ret;
> +    int status;
> +    int step = 0;
> +
> +    /* See if intermediate process has exited; if not, try a nice
> +     * SIGTERM followed by a more severe SIGKILL.
> +     */
> + rewait:
> +    trace_qio_channel_command_abort(ioc, ioc->pid);
> +    ret = waitpid(ioc->pid, &status, WNOHANG);
> +    trace_qio_channel_command_wait(ioc, ioc->pid, ret, status);
> +    if (ret == (pid_t)-1) {
> +        if (errno == EINTR) {
> +            goto rewait;
> +        } else {
> +            error_setg_errno(errp, errno,
> +                             "Cannot wait on pid %llu",
> +                             (unsigned long long)ioc->pid);
> +            return -1;
> +        }
> +    } else if (ret == 0) {
> +        if (step == 0) {
> +            kill(ioc->pid, SIGTERM);
> +        } else if (step == 1) {
> +            kill(ioc->pid, SIGKILL);

Hi Daniel,

Coverity complains here that step is never set to 1.

Paolo

> +        } else {
> +            error_setg(errp,
> +                       "Process %llu refused to die",
> +                       (unsigned long long)ioc->pid);
> +            return -1;
> +        }
> +        usleep(10 * 1000);
> +        goto rewait;
> +    }
> +
> +    return 0;
> +}
> +#endif /* ! WIN32 */
> +

  reply	other threads:[~2016-01-08  8:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-18 12:20 [Qemu-devel] [PULL v4 0/9] Introduce I/O channels framework Daniel P. Berrange
2015-12-18 12:20 ` [Qemu-devel] [PULL v4 1/9] io: add abstract QIOChannel classes Daniel P. Berrange
2015-12-18 12:20 ` [Qemu-devel] [PULL v4 2/9] io: add helper module for creating watches on FDs Daniel P. Berrange
2015-12-18 12:21 ` [Qemu-devel] [PULL v4 3/9] io: add QIOTask class for async operations Daniel P. Berrange
2015-12-18 12:21 ` [Qemu-devel] [PULL v4 4/9] io: add QIOChannelSocket class Daniel P. Berrange
2016-01-08  9:04   ` Paolo Bonzini
2016-01-08 10:59     ` Daniel P. Berrange
2015-12-18 12:21 ` [Qemu-devel] [PULL v4 5/9] io: add QIOChannelFile class Daniel P. Berrange
2015-12-18 12:21 ` [Qemu-devel] [PULL v4 6/9] io: add QIOChannelTLS class Daniel P. Berrange
2015-12-18 12:21 ` [Qemu-devel] [PULL v4 7/9] io: add QIOChannelWebsock class Daniel P. Berrange
2015-12-18 12:21 ` [Qemu-devel] [PULL v4 8/9] io: add QIOChannelCommand class Daniel P. Berrange
2016-01-08  8:59   ` Paolo Bonzini [this message]
2016-01-08  9:11   ` Paolo Bonzini
2015-12-18 12:21 ` [Qemu-devel] [PULL v4 9/9] io: add QIOChannelBuffer class Daniel P. Berrange
2015-12-18 13:27 ` [Qemu-devel] [PULL v4 0/9] Introduce I/O channels framework Peter Maydell

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=568F7A85.4080409@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=berrange@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.