[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL v4 8/9] io: add QIOChannelCommand class
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PULL v4 8/9] io: add QIOChannelCommand class |
Date: |
Fri, 8 Jan 2016 09:59:49 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 |
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 */
> +
- Re: [Qemu-devel] [PULL v4 8/9] io: add QIOChannelCommand class,
Paolo Bonzini <=