qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] qemu-ga: guest-suspend: make the API synchr


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 1/2] qemu-ga: guest-suspend: make the API synchronous
Date: Fri, 11 May 2012 16:10:17 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

On 05/11/2012 01:19 PM, Luiz Capitulino wrote:
> Currently, qemu-ga has a SIGCHLD handler that automatically reaps terminated
> children processes. The idea is to avoid having qemu-ga commands blocked
> waiting for children to terminate.
> 

> +
> +    rpid = waitpid(pid, &status, 0);

You need to worry about signals interrupting the wait.  Something like:

while ((rpid = waitpid(pid, &status, 0) == -1 && errno == EINTR) {
}


> @@ -664,9 +633,16 @@ static void guest_suspend(const char *pmutils_bin, const 
> char *sysfile_str,
>      g_free(pmutils_path);
>  
>      if (pid < 0) {
> -        error_set(err, QERR_UNDEFINED_ERROR);
> +        goto exit_err;
> +    }
> +
> +    rpid = waitpid(pid, &status, 0);
> +    if (rpid == pid && WIFEXITED(status) && !WEXITSTATUS(status)) {
>          return;

And again.

-- 
Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]